diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index f159d439..7959e3cd 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -9,50 +9,14 @@ on: - "main" jobs: - deps: - name: dependencies - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - fetch-depth: 1 - - - name: Cache dependencies - uses: actions/cache@v3 - with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - - - name: Load toolchain - uses: dtolnay/rust-toolchain@stable - with: - toolchain: stable - targets: wasm32-unknown-unknown - - - run: cargo fetch --verbose - - run: cargo build - - run: cargo wasm - unit-test: strategy: fail-fast: true - needs: deps - name: unit-test runs-on: ubuntu-latest steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - fetch-depth: 1 + - uses: actions/checkout@v4 - name: Cache dependencies uses: actions/cache@v3 @@ -65,45 +29,32 @@ jobs: target/ key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - - name: Load toolchain - uses: dtolnay/rust-toolchain@stable - with: - toolchain: stable - targets: wasm32-unknown-unknown + - name: Install Rust + run: rustup update stable + + - name: Install target + run: rustup target add wasm32-unknown-unknown - run: cargo test --workspace --exclude hpl-tests coverage: - needs: deps - - name: coverage runs-on: ubuntu-latest - container: - image: xd009642/tarpaulin:develop-nightly - options: --security-opt seccomp=unconfined + env: + CARGO_TERM_COLOR: always steps: - - name: Checkout repository - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - - name: Cache dependencies - uses: actions/cache@v3 - with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + - name: Install Rust + run: rustup update nightly + + - name: Install target + run: rustup target add wasm32-unknown-unknown - - run: rustup target add wasm32-unknown-unknown + - name: Install cargo-llvm-cov + uses: taiki-e/install-action@cargo-llvm-cov - name: Generate code coverage - run: | - cargo +nightly tarpaulin \ - --verbose \ - --workspace --exclude hpl-tests \ - --timeout 120 --out Xml + run: cargo llvm-cov --all-features --workspace --exclude hpl-tests --codecov --output-path codecov.json - name: Upload to codecov.io uses: codecov/codecov-action@v3 diff --git a/contracts/hooks/aggregate/Cargo.toml b/contracts/hooks/aggregate/Cargo.toml new file mode 100644 index 00000000..7d196235 --- /dev/null +++ b/contracts/hooks/aggregate/Cargo.toml @@ -0,0 +1,42 @@ +[package] +name = "hpl-hook-aggregate" +version.workspace = true +authors.workspace = true +edition.workspace = true +license.workspace = true +repository.workspace = true +homepage.workspace = true +documentation.workspace = true +keywords.workspace = true + +[lib] +crate-type = ["cdylib", "rlib"] + +[features] +# for more explicit tests, cargo test --features=backtraces +backtraces = ["cosmwasm-std/backtraces"] +# use library feature to disable all instantiate/execute/query exports +library = [] + +[dependencies] +cosmwasm-std.workspace = true +cosmwasm-storage.workspace = true +cosmwasm-schema.workspace = true + +cw-storage-plus.workspace = true +cw2.workspace = true +cw-utils.workspace = true + +schemars.workspace = true +serde-json-wasm.workspace = true + +thiserror.workspace = true + +hpl-ownable.workspace = true +hpl-interface.workspace = true + +[dev-dependencies] +rstest.workspace = true +ibcx-test-utils.workspace = true + +anyhow.workspace = true diff --git a/contracts/hooks/aggregate/src/error.rs b/contracts/hooks/aggregate/src/error.rs new file mode 100644 index 00000000..babe75a3 --- /dev/null +++ b/contracts/hooks/aggregate/src/error.rs @@ -0,0 +1,16 @@ +use cosmwasm_std::StdError; + +#[derive(thiserror::Error, Debug, PartialEq)] +pub enum ContractError { + #[error("{0}")] + Std(#[from] StdError), + + #[error("{0}")] + PaymentError(#[from] cw_utils::PaymentError), + + #[error("unauthorized")] + Unauthorized {}, + + #[error("hook paused")] + Paused {}, +} diff --git a/contracts/hooks/aggregate/src/lib.rs b/contracts/hooks/aggregate/src/lib.rs new file mode 100644 index 00000000..4ffcb579 --- /dev/null +++ b/contracts/hooks/aggregate/src/lib.rs @@ -0,0 +1,186 @@ +mod error; + +#[cfg(not(feature = "library"))] +use cosmwasm_std::entry_point; +use cosmwasm_std::{ + ensure_eq, Addr, Coin, CosmosMsg, Deps, DepsMut, Env, Event, HexBinary, MessageInfo, + QueryResponse, Response, StdResult, +}; +use cw_storage_plus::Item; +use error::ContractError; +use hpl_interface::{ + hook::{ + aggregate::{AggregateHookQueryMsg, ExecuteMsg, HooksResponse, InstantiateMsg, QueryMsg}, + post_dispatch, HookQueryMsg, MailboxResponse, PostDispatchMsg, QuoteDispatchMsg, + QuoteDispatchResponse, + }, + to_binary, + types::Message, +}; +use hpl_ownable::get_owner; + +// version info for migration info +pub const CONTRACT_NAME: &str = env!("CARGO_PKG_NAME"); +pub const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION"); + +pub const HOOKS_KEY: &str = "hooks"; +pub const HOOKS: Item> = Item::new(HOOKS_KEY); + +fn new_event(name: &str) -> Event { + Event::new(format!("hpl_hook_aggregate::{}", name)) +} + +#[cfg_attr(not(feature = "library"), entry_point)] +pub fn instantiate( + deps: DepsMut, + _env: Env, + info: MessageInfo, + msg: InstantiateMsg, +) -> Result { + cw2::set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?; + + let owner = deps.api.addr_validate(&msg.owner)?; + let hooks = msg + .hooks + .iter() + .map(|v| deps.api.addr_validate(v)) + .collect::>()?; + + hpl_ownable::initialize(deps.storage, &owner)?; + + HOOKS.save(deps.storage, &hooks)?; + + Ok(Response::new().add_event( + new_event("initialize") + .add_attribute("sender", info.sender) + .add_attribute("owner", owner) + .add_attribute("hooks", msg.hooks.join(",")), + )) +} + +#[cfg_attr(not(feature = "library"), entry_point)] +pub fn execute( + deps: DepsMut, + env: Env, + info: MessageInfo, + msg: ExecuteMsg, +) -> Result { + match msg { + ExecuteMsg::Ownable(msg) => Ok(hpl_ownable::handle(deps, env, info, msg)?), + ExecuteMsg::PostDispatch(PostDispatchMsg { message, metadata }) => { + // aggregate it + let hooks = HOOKS.load(deps.storage)?; + + let msgs: Vec = hooks + .into_iter() + .map(|v| { + let quote = hpl_interface::hook::quote_dispatch( + &deps.querier, + &v, + metadata.clone(), + message.clone(), + )?; + let msg = post_dispatch( + v, + metadata.clone(), + message.clone(), + quote.gas_amount.map(|v| vec![v]), + )? + .into(); + + Ok(msg) + }) + .collect::>()?; + + let decoded_msg: Message = message.into(); + + // do nothing + Ok(Response::new().add_messages(msgs).add_event( + new_event("post_dispatch").add_attribute("message_id", decoded_msg.id().to_hex()), + )) + } + ExecuteMsg::SetHooks { hooks } => { + ensure_eq!( + get_owner(deps.storage)?, + info.sender, + ContractError::Unauthorized {} + ); + + let parsed_hooks = hooks + .iter() + .map(|v| deps.api.addr_validate(v)) + .collect::>()?; + + HOOKS.save(deps.storage, &parsed_hooks)?; + + Ok(Response::new().add_event( + new_event("set_hooks") + .add_attribute("sender", info.sender) + .add_attribute("hooks", hooks.join(",")), + )) + } + } +} + +#[cfg_attr(not(feature = "library"), entry_point)] +pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> Result { + match msg { + QueryMsg::Ownable(msg) => Ok(hpl_ownable::handle_query(deps, env, msg)?), + QueryMsg::Hook(msg) => match msg { + HookQueryMsg::Mailbox {} => to_binary(get_mailbox(deps)), + HookQueryMsg::QuoteDispatch(QuoteDispatchMsg { metadata, message }) => { + to_binary(quote_dispatch(deps, metadata, message)) + } + }, + QueryMsg::AggregateHook(msg) => match msg { + AggregateHookQueryMsg::Hooks {} => to_binary(get_hooks(deps)), + }, + } +} + +fn get_mailbox(_deps: Deps) -> Result { + Ok(MailboxResponse { + mailbox: "unrestricted".to_string(), + }) +} + +fn quote_dispatch( + deps: Deps, + metadata: HexBinary, + message: HexBinary, +) -> Result { + let hooks = HOOKS.load(deps.storage)?; + + let mut total: Option = None; + + for hook in hooks { + let res = hpl_interface::hook::quote_dispatch( + &deps.querier, + hook, + metadata.clone(), + message.clone(), + )?; + + if let Some(gas_amount) = res.gas_amount { + total = match total { + Some(mut v) => { + v.amount += gas_amount.amount; + Some(v) + } + None => Some(gas_amount), + }; + } + } + + Ok(QuoteDispatchResponse { gas_amount: total }) +} + +fn get_hooks(deps: Deps) -> Result { + Ok(HooksResponse { + hooks: HOOKS + .load(deps.storage)? + .into_iter() + .map(|v| v.into()) + .collect(), + }) +} diff --git a/contracts/igps/core/src/contract.rs b/contracts/igps/core/src/contract.rs index fbd4a3f7..e9df7605 100644 --- a/contracts/igps/core/src/contract.rs +++ b/contracts/igps/core/src/contract.rs @@ -7,7 +7,7 @@ use hpl_interface::igp::core::{ExecuteMsg, IgpQueryMsg, InstantiateMsg, QueryMsg use hpl_interface::igp::oracle::IgpGasOracleQueryMsg; use hpl_interface::to_binary; -use crate::{ContractError, BENEFICIARY, CONTRACT_NAME, CONTRACT_VERSION, GAS_TOKEN, HRP, MAILBOX}; +use crate::{ContractError, BENEFICIARY, CONTRACT_NAME, CONTRACT_VERSION, GAS_TOKEN, HRP}; fn new_event(name: &str) -> Event { Event::new(format!("hpl_igp_core::{}", name)) @@ -23,13 +23,11 @@ pub fn instantiate( cw2::set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?; let owner = deps.api.addr_validate(&msg.owner)?; - let mailbox = deps.api.addr_validate(&msg.mailbox)?; let beneficiary = deps.api.addr_validate(&msg.beneficiary)?; hpl_ownable::initialize(deps.storage, &owner)?; BENEFICIARY.save(deps.storage, &beneficiary)?; - MAILBOX.save(deps.storage, &mailbox)?; GAS_TOKEN.save(deps.storage, &msg.gas_token)?; HRP.save(deps.storage, &msg.hrp)?; diff --git a/contracts/igps/core/src/execute.rs b/contracts/igps/core/src/execute.rs index c8dd1c64..49097b7e 100644 --- a/contracts/igps/core/src/execute.rs +++ b/contracts/igps/core/src/execute.rs @@ -1,6 +1,6 @@ use crate::event::{emit_claim, emit_pay_for_gas, emit_post_dispatch, emit_set_beneficiary}; use crate::query::quote_gas_price; -use crate::{ContractError, BENEFICIARY, DEFAULT_GAS_USAGE, GAS_TOKEN, HRP, MAILBOX}; +use crate::{ContractError, BENEFICIARY, DEFAULT_GAS_USAGE, GAS_TOKEN, HRP}; use cosmwasm_std::{ coins, ensure, ensure_eq, BankMsg, DepsMut, Env, HexBinary, MessageInfo, Response, Uint128, @@ -55,12 +55,6 @@ pub fn post_dispatch( info: MessageInfo, req: PostDispatchMsg, ) -> Result { - ensure_eq!( - info.sender, - MAILBOX.load(deps.storage)?, - ContractError::Unauthorized {} - ); - let message: Message = req.message.clone().into(); let hrp = HRP.load(deps.storage)?; diff --git a/contracts/igps/core/src/lib.rs b/contracts/igps/core/src/lib.rs index d6b60c4d..02d0d3ff 100644 --- a/contracts/igps/core/src/lib.rs +++ b/contracts/igps/core/src/lib.rs @@ -22,9 +22,6 @@ pub const DEFAULT_GAS_USAGE: u128 = 25_000; pub const HRP_KEY: &str = "hrp"; pub const HRP: Item = Item::new(HRP_KEY); -pub const MAILBOX_KEY: &str = "mailbox"; -pub const MAILBOX: Item = Item::new(MAILBOX_KEY); - pub const GAS_TOKEN_KEY: &str = "gas_token"; pub const GAS_TOKEN: Item = Item::new(GAS_TOKEN_KEY); diff --git a/contracts/igps/core/src/query.rs b/contracts/igps/core/src/query.rs index 5eb14279..db736d56 100644 --- a/contracts/igps/core/src/query.rs +++ b/contracts/igps/core/src/query.rs @@ -1,5 +1,5 @@ use crate::error::ContractError; -use crate::{BENEFICIARY, DEFAULT_GAS_USAGE, GAS_TOKEN, MAILBOX, TOKEN_EXCHANGE_RATE_SCALE}; +use crate::{BENEFICIARY, DEFAULT_GAS_USAGE, GAS_TOKEN, TOKEN_EXCHANGE_RATE_SCALE}; use cosmwasm_std::{coin, Addr, Deps, QuerierWrapper, Storage, Uint256}; use hpl_interface::hook::{MailboxResponse, QuoteDispatchMsg, QuoteDispatchResponse}; @@ -7,11 +7,9 @@ use hpl_interface::igp::core::{BeneficiaryResponse, QuoteGasPaymentResponse}; use hpl_interface::igp::oracle::{self, GetExchangeRateAndGasPriceResponse, IgpGasOracleQueryMsg}; use hpl_interface::types::{IGPMetadata, Message}; -pub fn get_mailbox(deps: Deps) -> Result { - let mailbox = MAILBOX.load(deps.storage)?; - +pub fn get_mailbox(_deps: Deps) -> Result { Ok(MailboxResponse { - mailbox: mailbox.into(), + mailbox: "unrestricted".to_string(), }) } diff --git a/contracts/igps/core/src/tests/contract.rs b/contracts/igps/core/src/tests/contract.rs index 3ac63e3e..e539cfc8 100644 --- a/contracts/igps/core/src/tests/contract.rs +++ b/contracts/igps/core/src/tests/contract.rs @@ -13,7 +13,7 @@ use hpl_router::get_routes; use ibcx_test_utils::{addr, gen_bz}; use rstest::{fixture, rstest}; -use crate::{BENEFICIARY, DEFAULT_GAS_USAGE, GAS_TOKEN, HRP, MAILBOX}; +use crate::{BENEFICIARY, DEFAULT_GAS_USAGE, GAS_TOKEN, HRP}; use super::IGP; @@ -62,22 +62,14 @@ macro_rules! arg_fixture { arg_fixture!(deployer, Addr, addr("deployer")); arg_fixture!(hrp, &'static str, "test"); arg_fixture!(owner, Addr, addr("owner")); -arg_fixture!(mailbox, Addr, addr("mailbox")); arg_fixture!(gas_token, &'static str, "utest"); arg_fixture!(beneficiary, Addr, addr("beneficiary")); #[fixture] -fn igp( - deployer: Addr, - hrp: &str, - owner: Addr, - mailbox: Addr, - gas_token: &str, - beneficiary: Addr, -) -> IGP { +fn igp(deployer: Addr, hrp: &str, owner: Addr, gas_token: &str, beneficiary: Addr) -> IGP { let mut igp = IGP::new(mock_dependencies(), mock_env()); - igp.init(&deployer, hrp, &owner, &mailbox, gas_token, &beneficiary) + igp.init(&deployer, hrp, &owner, gas_token, &beneficiary) .unwrap(); igp @@ -101,7 +93,6 @@ fn test_init(igp: IGP) { assert_eq!(get_owner(storage).unwrap(), "owner"); assert_eq!(BENEFICIARY.load(storage).unwrap(), "beneficiary"); assert_eq!(GAS_TOKEN.load(storage).unwrap(), "utest"); - assert_eq!(MAILBOX.load(storage).unwrap(), "mailbox"); assert_eq!(HRP.load(storage).unwrap(), "test"); } @@ -249,8 +240,6 @@ fn test_pay_for_gas( #[case(addr("mailbox"), true, Some(300_000))] #[case(addr("mailbox"), true, None)] #[case(addr("mailbox"), false, None)] -#[should_panic(expected = "unauthorized")] -#[case(addr("owner"), true, Some(300_000))] fn test_post_dispatch( #[values("osmo", "neutron")] hrp: &str, #[with(vec![(1, "oracle/2/150".into())])] igp_routes: (IGP, Vec<(u32, String)>), diff --git a/contracts/igps/core/src/tests/mod.rs b/contracts/igps/core/src/tests/mod.rs index 5abdd987..d0dd96f3 100644 --- a/contracts/igps/core/src/tests/mod.rs +++ b/contracts/igps/core/src/tests/mod.rs @@ -42,7 +42,6 @@ impl IGP { sender: &Addr, hrp: &str, owner: &Addr, - mailbox: &Addr, gas_token: &str, beneficiary: &Addr, ) -> Result { @@ -53,7 +52,6 @@ impl IGP { InstantiateMsg { hrp: hrp.to_string(), owner: owner.to_string(), - mailbox: mailbox.to_string(), gas_token: gas_token.to_string(), beneficiary: beneficiary.to_string(), }, diff --git a/contracts/isms/aggregate/Cargo.toml b/contracts/isms/aggregate/Cargo.toml new file mode 100644 index 00000000..e5c9f663 --- /dev/null +++ b/contracts/isms/aggregate/Cargo.toml @@ -0,0 +1,43 @@ +[package] +name = "hpl-ism-aggregate" +version.workspace = true +authors.workspace = true +edition.workspace = true +license.workspace = true +repository.workspace = true +homepage.workspace = true +documentation.workspace = true +keywords.workspace = true + +[lib] +crate-type = ["cdylib", "rlib"] + +[features] +# for more explicit tests, cargo test --features=backtraces +backtraces = ["cosmwasm-std/backtraces"] +# use library feature to disable all instantiate/execute/query exports +library = [] + +[dependencies] +cosmwasm-std.workspace = true +cosmwasm-storage.workspace = true +cosmwasm-schema.workspace = true + +cw-storage-plus.workspace = true +cw2.workspace = true + +sha2.workspace = true +ripemd.workspace = true + +bech32.workspace = true +schemars.workspace = true + +thiserror.workspace = true + +hpl-ownable.workspace = true +hpl-interface.workspace = true + +[dev-dependencies] + +serde.workspace = true +anyhow.workspace = true diff --git a/contracts/isms/aggregate/src/error.rs b/contracts/isms/aggregate/src/error.rs new file mode 100644 index 00000000..6ceb0a7d --- /dev/null +++ b/contracts/isms/aggregate/src/error.rs @@ -0,0 +1,17 @@ +use cosmwasm_std::{StdError, VerificationError}; +use thiserror::Error; + +#[derive(Error, Debug, PartialEq)] +pub enum ContractError { + #[error("{0}")] + Std(#[from] StdError), + + #[error("{0}")] + VerificationError(#[from] VerificationError), + + #[error("unauthorized")] + Unauthorized, + + #[error("route not found")] + RouteNotFound {}, +} diff --git a/contracts/isms/aggregate/src/lib.rs b/contracts/isms/aggregate/src/lib.rs new file mode 100644 index 00000000..3d8b32d6 --- /dev/null +++ b/contracts/isms/aggregate/src/lib.rs @@ -0,0 +1,149 @@ +mod error; + +pub use crate::error::ContractError; +#[cfg(not(feature = "library"))] +use cosmwasm_std::entry_point; +use cosmwasm_std::{ + ensure_eq, Addr, Deps, DepsMut, Env, Event, HexBinary, MessageInfo, QueryResponse, Response, + StdResult, +}; +use cw2::set_contract_version; +use cw_storage_plus::Item; +use hpl_interface::{ + ism::{ + aggregate::{ExecuteMsg, InstantiateMsg, QueryMsg}, + IsmQueryMsg, IsmType, ModuleTypeResponse, VerifyInfoResponse, VerifyResponse, + }, + to_binary, + types::AggregateMetadata, +}; +use hpl_ownable::get_owner; + +// version info for migration info +pub const CONTRACT_NAME: &str = env!("CARGO_PKG_NAME"); +pub const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION"); + +const ISMS_KEY: &str = "isms"; +const ISMS: Item> = Item::new(ISMS_KEY); + +const THRESHOLD_KEY: &str = "threshold"; +const THRESHOLD: Item = Item::new(THRESHOLD_KEY); + +fn new_event(name: &str) -> Event { + Event::new(format!("hpl_ism_aggregate::{}", name)) +} + +#[cfg_attr(not(feature = "library"), entry_point)] +pub fn instantiate( + deps: DepsMut, + _env: Env, + info: MessageInfo, + msg: InstantiateMsg, +) -> Result { + set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?; + + let owner = deps.api.addr_validate(&msg.owner)?; + let isms = msg + .isms + .iter() + .map(|v| deps.api.addr_validate(v)) + .collect::>()?; + + hpl_ownable::initialize(deps.storage, &owner)?; + + ISMS.save(deps.storage, &isms)?; + THRESHOLD.save(deps.storage, &msg.threshold)?; + + Ok(Response::new().add_event( + new_event("instantiate") + .add_attribute("sender", info.sender) + .add_attribute("owner", owner) + .add_attribute("isms", msg.isms.join(",")) + .add_attribute("threshold", msg.threshold.to_string()), + )) +} + +#[cfg_attr(not(feature = "library"), entry_point)] +pub fn execute( + deps: DepsMut, + env: Env, + info: MessageInfo, + msg: ExecuteMsg, +) -> Result { + match msg { + ExecuteMsg::Ownable(msg) => Ok(hpl_ownable::handle(deps, env, info, msg)?), + ExecuteMsg::SetIsms { isms } => { + ensure_eq!( + get_owner(deps.storage)?, + info.sender, + ContractError::Unauthorized + ); + + let parsed_isms = isms + .iter() + .map(|v| deps.api.addr_validate(v)) + .collect::>()?; + + ISMS.save(deps.storage, &parsed_isms)?; + + Ok(Response::new() + .add_event(new_event("set_isms").add_attribute("isms", isms.join(",")))) + } + } +} + +#[cfg_attr(not(feature = "library"), entry_point)] +pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> Result { + use IsmQueryMsg::*; + + match msg { + QueryMsg::Ownable(msg) => Ok(hpl_ownable::handle_query(deps, env, msg)?), + + QueryMsg::Ism(msg) => match msg { + ModuleType {} => to_binary({ + Ok::<_, ContractError>(ModuleTypeResponse { + typ: IsmType::Aggregation, + }) + }), + Verify { metadata, message } => to_binary(verify(deps, metadata, message)), + VerifyInfo { message } => to_binary(verify_info(deps, message)), + }, + } +} + +fn verify( + deps: Deps, + metadata: HexBinary, + message: HexBinary, +) -> Result { + let isms = ISMS.load(deps.storage)?; + + let mut threshold = THRESHOLD.load(deps.storage)?; + + for (ism, meta) in AggregateMetadata::from_hex(metadata, isms) { + let verified = hpl_interface::ism::verify(&deps.querier, ism, meta, message.clone())?; + + if verified { + threshold -= 1; + } + + if threshold == 0 { + break; + } + } + + Ok(VerifyResponse { + verified: threshold == 0, + }) +} + +fn verify_info(deps: Deps, _message: HexBinary) -> Result { + Ok(VerifyInfoResponse { + threshold: THRESHOLD.load(deps.storage)?, + validators: ISMS + .load(deps.storage)? + .into_iter() + .map(|v| v.to_string()) + .collect(), + }) +} diff --git a/contracts/isms/multisig/src/lib.rs b/contracts/isms/multisig/src/lib.rs index 34f484b8..3330d8f6 100644 --- a/contracts/isms/multisig/src/lib.rs +++ b/contracts/isms/multisig/src/lib.rs @@ -39,14 +39,14 @@ pub fn eth_hash(message: HexBinary) -> Result { pub fn multisig_hash( mut domain_hash: Vec, mut root: Vec, - mut index: Vec, + index: u32, mut message_id: Vec, ) -> Result { let mut bz = vec![]; bz.append(&mut domain_hash); bz.append(&mut root); - bz.append(&mut index); + bz.append(&mut index.to_be_bytes().to_vec()); bz.append(&mut message_id); let hash = keccak256_hash(&bz); diff --git a/contracts/isms/multisig/src/query.rs b/contracts/isms/multisig/src/query.rs index b060a925..2f1529d8 100644 --- a/contracts/isms/multisig/src/query.rs +++ b/contracts/isms/multisig/src/query.rs @@ -38,6 +38,8 @@ pub fn verify_message( let threshold = THRESHOLD.load(deps.storage, message.origin_domain)?; let validators = VALIDATORS.load(deps.storage, message.origin_domain)?; + let merkle_index = metadata.merkle_index(); + let verifiable_cases = product( validators.0.into_iter().map(|v| v.signer_pubkey).collect(), metadata.signatures, @@ -46,7 +48,7 @@ pub fn verify_message( let multisig_hash = multisig_hash( domain_hash(message.origin_domain, metadata.origin_merkle_tree)?.to_vec(), metadata.merkle_root.to_vec(), - metadata.merkle_index.to_vec(), + merkle_index, message.id().to_vec(), )?; diff --git a/contracts/warp/cw20/Cargo.toml b/contracts/warp/cw20/Cargo.toml index 593cc1ba..4ed1c449 100644 --- a/contracts/warp/cw20/Cargo.toml +++ b/contracts/warp/cw20/Cargo.toml @@ -43,6 +43,8 @@ hpl-router.workspace = true hpl-interface.workspace = true [dev-dependencies] +osmosis-test-tube.workspace = true +ibcx-test-utils.workspace = true rstest.workspace = true anyhow.workspace = true k256.workspace = true diff --git a/contracts/warp/cw20/src/contract.rs b/contracts/warp/cw20/src/contract.rs index aade209e..2b06b440 100644 --- a/contracts/warp/cw20/src/contract.rs +++ b/contracts/warp/cw20/src/contract.rs @@ -1,8 +1,8 @@ #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - ensure_eq, from_binary, CosmosMsg, Deps, DepsMut, Env, Event, HexBinary, MessageInfo, - QueryResponse, Reply, Response, SubMsg, Uint256, WasmMsg, + ensure_eq, from_binary, CosmosMsg, Deps, DepsMut, Env, HexBinary, MessageInfo, QueryResponse, + Reply, Response, SubMsg, Uint256, WasmMsg, }; use cw20::Cw20ReceiveMsg; @@ -34,33 +34,39 @@ pub fn instantiate( let mode: TokenMode = msg.token.clone().into(); let owner = deps.api.addr_validate(&msg.owner)?; + let mailbox = deps.api.addr_validate(&msg.mailbox)?; HRP.save(deps.storage, &msg.hrp)?; MODE.save(deps.storage, &mode)?; - MAILBOX.save(deps.storage, &deps.api.addr_validate(&msg.mailbox)?)?; + MAILBOX.save(deps.storage, &mailbox)?; hpl_ownable::initialize(deps.storage, &owner)?; - let mut denom = "".into(); - - let msgs = match msg.token { + let (msgs, denom) = match msg.token { TokenModeMsg::Bridged(token) => { - vec![SubMsg::reply_on_success( + let mut token_init_msg = token.init_msg; + token_init_msg.mint = Some(cw20::MinterResponse { + minter: env.contract.address.to_string(), + cap: None, + }); + + let msgs = vec![SubMsg::reply_on_success( WasmMsg::Instantiate { admin: Some(env.contract.address.to_string()), code_id: token.code_id, - msg: cosmwasm_std::to_binary(&token.init_msg)?, + msg: cosmwasm_std::to_binary(&token_init_msg)?, funds: vec![], label: "token warp cw20".to_string(), }, REPLY_ID_CREATE_DENOM, - )] + )]; + + (msgs, token_init_msg.name) } TokenModeMsg::Collateral(token) => { let token_addr = deps.api.addr_validate(&token.address)?; TOKEN.save(deps.storage, &token_addr)?; - denom = token_addr.to_string(); - vec![] + (vec![], token_addr.into()) } }; @@ -83,6 +89,7 @@ pub fn execute( use ExecuteMsg::*; match msg { + Ownable(msg) => Ok(hpl_ownable::handle(deps, env, info, msg)?), Router(msg) => Ok(hpl_router::handle(deps, env, info, msg)?), Handle(msg) => mailbox_handle(deps, info, msg), Receive(msg) => { @@ -112,9 +119,8 @@ pub fn reply(deps: DepsMut, _env: Env, msg: Reply) -> Result Result { Ok(TokenModeResponse { mode }) } + +#[cfg(test)] +mod test { + use cosmwasm_std::{ + testing::{mock_dependencies, mock_env, mock_info, MockApi, MockQuerier, MockStorage}, + Empty, OwnedDeps, Uint128, + }; + use hpl_interface::{ + build_test_executor, build_test_querier, + core::HandleMsg, + router::DomainRouteSet, + warp::cw20::{Cw20ModeBridged, Cw20ModeCollateral}, + }; + use hpl_router::set_routes; + use ibcx_test_utils::{addr, gen_bz}; + use rstest::{fixture, rstest}; + + use super::*; + + build_test_querier!(super::query); + build_test_executor!(super::execute); + + const DEPLOYER: &str = "sender"; + const OWNER: &str = "owner"; + const MAILBOX: &str = "mailbox"; + const TOKEN: &str = "token"; + + const CW20_BRIDGED_CODE_ID: u64 = 1; + const CW20_BRIDGED_NAME: &str = "cw20-created"; + const CW20_COLLATERAL_ADDRESS: &str = "cw20-exisiting"; + + type Cw20TokenMode = TokenModeMsg; + type TestDeps = OwnedDeps; + + #[fixture] + fn token_mode_bridged() -> Cw20TokenMode { + TokenModeMsg::Bridged(Cw20ModeBridged { + code_id: CW20_BRIDGED_CODE_ID, + init_msg: cw20_base::msg::InstantiateMsg { + name: CW20_BRIDGED_NAME.to_string(), + symbol: CW20_BRIDGED_NAME.to_string(), + decimals: 1, + initial_balances: vec![], + mint: None, + marketing: None, + } + .into(), + }) + } + + #[fixture] + fn token_mode_collateral() -> Cw20TokenMode { + TokenModeMsg::Collateral(Cw20ModeCollateral { + address: CW20_COLLATERAL_ADDRESS.to_string(), + }) + } + + #[fixture] + fn deps( + #[default(vec![])] routes: Vec<(u32, HexBinary)>, + #[default("osmo")] hrp: &str, + #[default(Some(TOKEN))] token: Option<&str>, + token_mode_collateral: Cw20TokenMode, + ) -> (TestDeps, Response) { + let mut deps = mock_dependencies(); + + let res = instantiate( + deps.as_mut(), + mock_env(), + mock_info(DEPLOYER, &[]), + InstantiateMsg { + token: token_mode_collateral, + hrp: hrp.to_string(), + owner: OWNER.to_string(), + mailbox: MAILBOX.to_string(), + }, + ) + .unwrap(); + + if let Some(token) = token { + super::TOKEN + .save(deps.as_mut().storage, &addr(token)) + .unwrap(); + } + + if !routes.is_empty() { + set_routes( + deps.as_mut().storage, + &addr(OWNER), + routes + .into_iter() + .map(|v| DomainRouteSet { + domain: v.0, + route: Some(v.1), + }) + .collect(), + ) + .unwrap(); + } + + (deps, res) + } + + #[rstest] + #[case(token_mode_bridged())] + #[case(token_mode_collateral())] + fn test_queries(#[values("osmo", "neutron")] hrp: &str, #[case] token_mode: Cw20TokenMode) { + let (deps, _) = deps(vec![], hrp, Some(TOKEN), token_mode.clone()); + + let res: warp::TokenTypeResponse = test_query( + deps.as_ref(), + QueryMsg::TokenDefault(warp::TokenWarpDefaultQueryMsg::TokenType {}), + ); + assert_eq!( + res.typ, + warp::TokenType::CW20 { + contract: TOKEN.into() + } + ); + + let res: warp::TokenModeResponse = test_query( + deps.as_ref(), + QueryMsg::TokenDefault(warp::TokenWarpDefaultQueryMsg::TokenMode {}), + ); + assert_eq!(res.mode, token_mode.into()); + } + + #[rstest] + #[case(token_mode_bridged())] + #[case(token_mode_collateral())] + fn test_init(#[values("osmo", "neutron")] hrp: &str, #[case] token_mode: Cw20TokenMode) { + let (deps, res) = deps(vec![], hrp, None, token_mode.clone()); + + let storage = deps.as_ref().storage; + let mode = token_mode.clone().into(); + + assert_eq!(super::HRP.load(storage).unwrap(), hrp); + assert_eq!(super::MODE.load(storage).unwrap(), mode); + assert_eq!(super::MAILBOX.load(storage).unwrap(), MAILBOX); + + match token_mode { + TokenModeMsg::Bridged(mut v) => { + v.init_msg.mint = Some(cw20::MinterResponse { + minter: mock_env().contract.address.into(), + cap: None, + }); + + assert!(!super::TOKEN.exists(storage)); + + let reply = res.messages.get(0).unwrap(); + assert_eq!(reply.id, REPLY_ID_CREATE_DENOM); + assert_eq!( + reply.msg, + CosmosMsg::Wasm(WasmMsg::Instantiate { + admin: Some(mock_env().contract.address.to_string()), + code_id: v.code_id, + msg: cosmwasm_std::to_binary(&v.init_msg).unwrap(), + funds: vec![], + label: "token warp cw20".to_string() + }) + ) + } + TokenModeMsg::Collateral(v) => { + assert_eq!(super::TOKEN.load(storage).unwrap(), v.address); + assert!(res.messages.is_empty()) + } + } + } + + enum Method { + Handle, + Receive, + } + + fn default_cw20_receive_msg() -> Cw20ReceiveMsg { + Cw20ReceiveMsg { + sender: Default::default(), + amount: Default::default(), + msg: Default::default(), + } + } + + #[rstest] + #[should_panic(expected = "unauthorized")] + #[case(MAILBOX, Method::Receive)] + #[should_panic(expected = "unauthorized")] + #[case(TOKEN, Method::Handle)] + fn test_execute_authority( + deps: (TestDeps, Response), + #[case] sender: &str, + #[case] method: Method, + ) { + let (mut deps, _) = deps; + + let msg = match method { + Method::Handle => ExecuteMsg::Handle(HandleMsg::default()), + Method::Receive => ExecuteMsg::Receive(default_cw20_receive_msg()), + }; + + test_execute(deps.as_mut(), &addr(sender), msg, vec![]); + } + + #[rstest] + #[case(1, gen_bz(32), token_mode_bridged())] + #[case(1, gen_bz(32), token_mode_collateral())] + #[should_panic(expected = "route not found")] + #[case(2, gen_bz(32), token_mode_collateral())] + fn test_mailbox_handle( + #[values("osmo", "neutron")] hrp: &str, + #[case] domain: u32, + #[case] route: HexBinary, + #[case] token_mode: Cw20TokenMode, + ) { + let (mut deps, _) = deps( + vec![(1, route.clone())], + hrp, + Some(TOKEN), + token_mode.clone(), + ); + + let sender = MAILBOX; + + let warp_msg = warp::Message { + recipient: gen_bz(32), + amount: Uint256::from_u128(100), + metadata: HexBinary::default(), + }; + + let handle_msg = HandleMsg { + origin: domain, + sender: route, + body: warp_msg.clone().into(), + }; + + let res = test_execute( + deps.as_mut(), + &addr(sender), + ExecuteMsg::Handle(handle_msg), + vec![], + ); + let msg = &res.messages.get(0).unwrap().msg; + + match token_mode { + TokenModeMsg::Bridged(_) => { + assert_eq!( + cosmwasm_std::to_binary(msg).unwrap(), + cosmwasm_std::to_binary(&CosmosMsg::::Wasm( + conv::to_mint_msg( + TOKEN, + bech32_encode(hrp, warp_msg.recipient.as_slice()).unwrap(), + warp_msg.amount + ) + .unwrap() + )) + .unwrap() + ) + } + TokenModeMsg::Collateral(_) => { + assert_eq!( + cosmwasm_std::to_binary(msg).unwrap(), + cosmwasm_std::to_binary(&CosmosMsg::::Wasm( + conv::to_send_msg( + TOKEN, + bech32_encode(hrp, warp_msg.recipient.as_slice()).unwrap(), + warp_msg.amount + ) + .unwrap() + )) + .unwrap() + ); + } + } + } + + #[rstest] + #[case(1, gen_bz(32), token_mode_bridged())] + #[case(1, gen_bz(32), token_mode_collateral())] + #[should_panic(expected = "route not found")] + #[case(2, gen_bz(32), token_mode_collateral())] + fn test_transfer_remote( + #[values("osmo", "neutron")] hrp: &str, + #[case] domain: u32, + #[case] route: HexBinary, + #[case] token_mode: Cw20TokenMode, + ) { + let (mut deps, _) = deps( + vec![(1, route.clone())], + hrp, + Some(TOKEN), + token_mode.clone(), + ); + + let sender = addr("sender"); + let recipient = gen_bz(32); + + let receive_msg = Cw20ReceiveMsg { + sender: sender.to_string(), + amount: Uint128::new(100), + msg: cosmwasm_std::to_binary(&ReceiveMsg::TransferRemote { + dest_domain: domain, + recipient: recipient.clone(), + }) + .unwrap(), + }; + + let res = test_execute( + deps.as_mut(), + &addr(TOKEN), + ExecuteMsg::Receive(receive_msg), + vec![], + ); + let msgs = res.messages.into_iter().map(|v| v.msg).collect::>(); + + let warp_msg = warp::Message { + recipient, + amount: Uint256::from_u128(100), + metadata: HexBinary::default(), + }; + + let dispatch_msg = + mailbox::dispatch(MAILBOX, domain, route, warp_msg.into(), None, None).unwrap(); + + match token_mode { + TokenModeMsg::Bridged(_) => { + assert_eq!( + cosmwasm_std::to_binary(&msgs).unwrap(), + cosmwasm_std::to_binary(&vec![ + CosmosMsg::from(conv::to_burn_msg(TOKEN, Uint128::new(100)).unwrap()), + dispatch_msg, + ]) + .unwrap(), + ); + } + TokenModeMsg::Collateral(_) => { + assert_eq!( + cosmwasm_std::to_binary(&msgs).unwrap(), + cosmwasm_std::to_binary(&vec![dispatch_msg]).unwrap(), + ); + } + } + } +} diff --git a/contracts/warp/cw20/src/error.rs b/contracts/warp/cw20/src/error.rs index a4fef9b4..fc498fa4 100644 --- a/contracts/warp/cw20/src/error.rs +++ b/contracts/warp/cw20/src/error.rs @@ -9,21 +9,21 @@ pub enum ContractError { #[error("{0}")] ParseReplyError(#[from] cw_utils::ParseReplyError), - #[error("Unauthorized")] + #[error("unauthorized")] Unauthorized, - #[error("WrongLength")] + #[error("wrong length")] WrongLength {}, - #[error("InvalidTokenOption")] + #[error("invalid token option")] InvalidTokenOption, - #[error("InvalidReplyId")] + #[error("invalid reply id")] InvalidReplyId, - #[error("InvalidReceiveMsg")] + #[error("invalid receive msg")] InvalidReceiveMsg, - #[error("NoRouter domain:{domain:?}")] + #[error("no router for domain {domain:?}")] NoRouter { domain: u32 }, } diff --git a/contracts/warp/cw20/src/lib.rs b/contracts/warp/cw20/src/lib.rs index 02e02014..0924bda9 100644 --- a/contracts/warp/cw20/src/lib.rs +++ b/contracts/warp/cw20/src/lib.rs @@ -6,9 +6,6 @@ pub mod contract; mod conv; pub mod error; -#[cfg(test)] -mod tests; - // reply message pub const REPLY_ID_CREATE_DENOM: u64 = 0; diff --git a/contracts/warp/cw20/src/tests/contracts.rs b/contracts/warp/cw20/src/tests/contracts.rs deleted file mode 100644 index dbf24122..00000000 --- a/contracts/warp/cw20/src/tests/contracts.rs +++ /dev/null @@ -1,292 +0,0 @@ -// use std::str::FromStr; - -// use cosmwasm_std::{testing::mock_env, to_binary, Addr, Binary, CosmosMsg, Uint256, WasmMsg}; -// use hpl_interface::{ -// types::bech32_encode, -// warp::{self, cw20::TokenOption}, -// }; -// use rstest::rstest; - -// use crate::{error::ContractError, tests::TokenCW20, TOKEN}; - -// #[rstest] -// #[case("osmo")] -// #[case("neutron")] -// fn test_router_role(#[case] hrp: &str) -> anyhow::Result<()> { -// let deployer = Addr::unchecked("deployer"); -// let mailbox = Addr::unchecked("mailbox"); -// let owner = Addr::unchecked("owner"); - -// let token = Addr::unchecked("token-native"); -// let domain = 999; -// let router = Binary(b"hello".to_vec()); - -// let mut warp = TokenCW20::default(); - -// warp.init( -// &deployer, -// &owner, -// &mailbox, -// Some(TokenOption::Reuse { -// contract: token.to_string(), -// }), -// TokenMode::Bridged, -// hrp, -// )?; - -// // err -// let err = warp -// .router_enroll(&mailbox, domain, router.clone()) -// .unwrap_err(); -// assert_eq!(err, ContractError::Unauthorized); - -// // ok -// warp.router_enroll(&owner, domain, router)?; - -// Ok(()) -// } - -// #[rstest] -// #[case("osmo")] -// #[case("neutron")] -// fn test_outbound_transfer(#[case] hrp: &str) -> anyhow::Result<()> { -// let deployer = Addr::unchecked("deployer"); -// let mailbox = Addr::unchecked("mailbox"); -// let router = Addr::unchecked("router"); -// let owner = Addr::unchecked("owner"); - -// let token = Addr::unchecked("token-cw20"); -// let amount: u64 = 100_000; - -// let user_remote = Addr::unchecked("user-remote____________________1"); - -// let dest_domain = 1; - -// let env = mock_env(); - -// let burn_msg: CosmosMsg = WasmMsg::Execute { -// contract_addr: token.to_string(), -// msg: to_binary(&cw20::Cw20ExecuteMsg::Burn { -// amount: amount.into(), -// })?, -// funds: vec![], -// } -// .into(); - -// let dispatch_msg: CosmosMsg = WasmMsg::Execute { -// contract_addr: mailbox.to_string(), -// msg: to_binary(&mailbox::ExecuteMsg::Dispatch { -// dest_domain, -// recipient_addr: Binary(router.as_bytes().to_vec()).into(), -// msg_body: token::Message { -// recipient: Binary(user_remote.as_bytes().to_vec()), -// amount: Uint256::from_str(&amount.to_string())?, -// metadata: Binary::default(), -// } -// .into(), -// })?, -// funds: vec![], -// } -// .into(); - -// for (mode, routers, expected_resp) in [ -// ( -// TokenMode::Bridged, -// vec![(dest_domain, Binary(router.as_bytes().to_vec()))], -// Ok(vec![burn_msg, dispatch_msg.clone()]), -// ), -// ( -// TokenMode::Bridged, -// vec![], -// Err(ContractError::NoRouter { -// domain: dest_domain, -// }), -// ), -// ( -// TokenMode::Collateral, -// vec![(dest_domain, Binary(router.as_bytes().to_vec()))], -// Ok(vec![dispatch_msg]), -// ), -// ( -// TokenMode::Collateral, -// vec![], -// Err(ContractError::NoRouter { -// domain: dest_domain, -// }), -// ), -// ] { -// let mut warp = TokenCW20 { -// env: env.clone(), -// ..Default::default() -// }; - -// warp.init( -// &deployer, -// &owner, -// &mailbox, -// Some(TokenOption::Reuse { -// contract: token.to_string(), -// }), -// mode.clone(), -// hrp, -// )?; -// if mode == TokenMode::Collateral { -// TOKEN.save(&mut warp.deps.storage, &token)?; -// } - -// for (domain, router) in routers { -// warp.router_enroll(&owner, domain, router)?; -// } - -// let resp = warp.transfer_remote( -// &deployer, -// &token, -// amount.into(), -// dest_domain, -// user_remote.as_bytes().into(), -// ); - -// assert_eq!( -// resp.map(|v| v.messages.into_iter().map(|v| v.msg).collect::>()), -// expected_resp -// ); -// } - -// Ok(()) -// } - -// #[rstest] -// #[case("osmo")] -// #[case("neutron")] -// fn test_inbound_transfer(#[case] hrp: &str) -> anyhow::Result<()> { -// let deployer = Addr::unchecked("deployer"); -// let mailbox = Addr::unchecked("mailbox"); -// let router = Addr::unchecked("router"); -// let owner = Addr::unchecked("owner"); -// let errortic = Addr::unchecked("errortic"); - -// let token = Addr::unchecked("token-cw20"); -// let amount = 100_000; - -// let user_remote = Addr::unchecked("user-remote____________________1"); - -// let env = mock_env(); - -// let origin_domain = 1; - -// let mint_msg: CosmosMsg = WasmMsg::Execute { -// contract_addr: token.to_string(), -// msg: to_binary(&cw20::Cw20ExecuteMsg::Mint { -// recipient: bech32_encode(hrp, user_remote.as_bytes())?.to_string(), -// amount: amount.into(), -// })?, -// funds: vec![], -// } -// .into(); - -// let send_msg: CosmosMsg = WasmMsg::Execute { -// contract_addr: token.to_string(), -// msg: to_binary(&cw20::Cw20ExecuteMsg::Transfer { -// recipient: bech32_encode(hrp, user_remote.as_bytes())?.to_string(), -// amount: amount.into(), -// })?, -// funds: vec![], -// } -// .into(); - -// let default_msg = token::Message { -// recipient: user_remote.as_bytes().to_vec().into(), -// amount: Uint256::from_u128(amount), -// metadata: Binary::default(), -// }; - -// for (mode, sender, origin, origin_sender, token_msg, expected_resp) in [ -// // happy -// ( -// TokenMode::Bridged, -// &mailbox, -// origin_domain, -// &router, -// default_msg.clone(), -// Ok(vec![mint_msg]), -// ), -// ( -// TokenMode::Collateral, -// &mailbox, -// origin_domain, -// &router, -// default_msg.clone(), -// Ok(vec![send_msg]), -// ), -// // errors -// ( -// TokenMode::Bridged, -// &errortic, -// origin_domain, -// &router, -// default_msg.clone(), -// Err(ContractError::Unauthorized), -// ), -// ( -// TokenMode::Bridged, -// &mailbox, -// origin_domain, -// &errortic, -// default_msg.clone(), -// Err(ContractError::Unauthorized), -// ), -// ( -// TokenMode::Collateral, -// &errortic, -// origin_domain, -// &router, -// default_msg.clone(), -// Err(ContractError::Unauthorized), -// ), -// ( -// TokenMode::Collateral, -// &mailbox, -// origin_domain, -// &errortic, -// default_msg, -// Err(ContractError::Unauthorized), -// ), -// ] { -// let mut warp = TokenCW20 { -// env: env.clone(), -// ..Default::default() -// }; - -// warp.init( -// &deployer, -// &owner, -// &mailbox, -// Some(TokenOption::Reuse { -// contract: token.to_string(), -// }), -// mode.clone(), -// hrp, -// )?; -// if mode == TokenMode::Collateral { -// TOKEN.save(&mut warp.deps.storage, &token)?; -// } - -// warp.router_enroll(&owner, origin_domain, router.as_bytes().into())?; - -// let resp = warp.mailbox_handle( -// sender, -// mailbox::HandleMsg { -// origin, -// sender: origin_sender.as_bytes().to_vec().into(), -// body: token_msg.into(), -// }, -// ); - -// assert_eq!( -// resp.map(|v| v.messages.into_iter().map(|v| v.msg).collect::>()), -// expected_resp -// ); -// } - -// Ok(()) -// } diff --git a/contracts/warp/cw20/src/tests/mod.rs b/contracts/warp/cw20/src/tests/mod.rs deleted file mode 100644 index e26b05af..00000000 --- a/contracts/warp/cw20/src/tests/mod.rs +++ /dev/null @@ -1,115 +0,0 @@ -// use cosmwasm_std::{ -// from_binary, -// testing::{mock_dependencies, mock_env, mock_info, MockApi, MockQuerier, MockStorage}, -// to_binary, Addr, Binary, Empty, Env, MessageInfo, OwnedDeps, Response, Uint128, -// }; -// use hpl_interface::{ -// mailbox, router, -// token::TokenMode, -// token_cw20::{ExecuteMsg, QueryMsg, ReceiveMsg}, -// }; -// use serde::de::DeserializeOwned; - -// use crate::{ -// contract::{execute, instantiate, query}, -// error::ContractError, -// msg::{InstantiateMsg, TokenOption}, -// }; - -// mod contracts; - -// pub struct TokenCW20 { -// pub deps: OwnedDeps, -// pub env: Env, -// } - -// impl Default for TokenCW20 { -// fn default() -> Self { -// Self { -// deps: mock_dependencies(), -// env: mock_env(), -// } -// } -// } - -// impl TokenCW20 { -// pub fn init( -// &mut self, -// sender: &Addr, -// owner: &Addr, -// mailbox: &Addr, -// token: Option, -// mode: TokenMode, -// hrp: &str, -// ) -> Result { -// instantiate( -// self.deps.as_mut(), -// self.env.clone(), -// mock_info(sender.as_str(), &[]), -// InstantiateMsg { -// token, -// mode, -// hrp: hrp.to_string(), -// owner: owner.to_string(), -// mailbox: mailbox.to_string(), -// }, -// ) -// } - -// fn execute(&mut self, info: MessageInfo, msg: ExecuteMsg) -> Result { -// execute(self.deps.as_mut(), self.env.clone(), info, msg) -// } - -// #[allow(dead_code)] -// fn query(&self, msg: QueryMsg) -> Result { -// query(self.deps.as_ref(), self.env.clone(), msg) -// .map(|v| from_binary::(&v))? -// .map_err(|e| e.into()) -// } - -// pub fn router_enroll( -// &mut self, -// sender: &Addr, -// domain: u32, -// router: Binary, -// ) -> Result { -// self.execute( -// mock_info(sender.as_str(), &[]), -// ExecuteMsg::Router(router::RouterMsg::EnrollRemoteRouter { -// set: router::RouterSet { domain, router }, -// }), -// ) -// } - -// pub fn mailbox_handle( -// &mut self, -// sender: &Addr, -// handle_msg: mailbox::HandleMsg, -// ) -> Result { -// self.execute( -// mock_info(sender.as_str(), &[]), -// ExecuteMsg::Handle(handle_msg), -// ) -// } - -// pub fn transfer_remote( -// &mut self, -// sender: &Addr, -// token: &Addr, -// amount: Uint128, -// dest_domain: u32, -// recipient: Binary, -// ) -> Result { -// self.execute( -// mock_info(token.as_str(), &[]), -// ExecuteMsg::Receive(cw20::Cw20ReceiveMsg { -// sender: sender.to_string(), -// amount, -// msg: to_binary(&ReceiveMsg::TransferRemote { -// dest_domain, -// recipient, -// })?, -// }), -// ) -// } -// } diff --git a/contracts/warp/native/Cargo.toml b/contracts/warp/native/Cargo.toml index c0b218e1..9b0e3789 100644 --- a/contracts/warp/native/Cargo.toml +++ b/contracts/warp/native/Cargo.toml @@ -44,6 +44,7 @@ hpl-router.workspace = true hpl-interface.workspace = true [dev-dependencies] +ibcx-test-utils.workspace = true rstest.workspace = true anyhow.workspace = true k256.workspace = true diff --git a/contracts/warp/native/src/contract.rs b/contracts/warp/native/src/contract.rs index 2c71d8c4..c778693c 100644 --- a/contracts/warp/native/src/contract.rs +++ b/contracts/warp/native/src/contract.rs @@ -42,9 +42,7 @@ pub fn instantiate( hpl_ownable::initialize(deps.storage, &owner)?; - let mut denom = "".into(); - - let msgs = match msg.token { + let (msgs, denom) = match msg.token { // create native denom if token is bridged TokenModeMsg::Bridged(token) => { let mut msgs = vec![]; @@ -64,13 +62,12 @@ pub fn instantiate( ))); } - msgs + (msgs, token.denom) } // use denom directly if token is native TokenModeMsg::Collateral(token) => { TOKEN.save(deps.storage, &token.denom)?; - denom = token.denom; - vec![] + (vec![], token.denom) } }; @@ -90,10 +87,13 @@ pub fn execute( info: MessageInfo, msg: ExecuteMsg, ) -> Result { + use ExecuteMsg::*; + match msg { - ExecuteMsg::Router(msg) => Ok(hpl_router::handle(deps, env, info, msg)?), - ExecuteMsg::Handle(msg) => mailbox_handle(deps, env, info, msg), - ExecuteMsg::TransferRemote { + Ownable(msg) => Ok(hpl_ownable::handle(deps, env, info, msg)?), + Router(msg) => Ok(hpl_router::handle(deps, env, info, msg)?), + Handle(msg) => mailbox_handle(deps, env, info, msg), + TransferRemote { dest_domain, recipient, } => transfer_remote(deps, env, info, dest_domain, recipient), @@ -110,9 +110,8 @@ pub fn reply(deps: DepsMut, _env: Env, msg: Reply) -> Result Result { Ok(TokenModeResponse { mode }) } + +#[cfg(test)] +mod test { + use cosmwasm_std::{ + coin, + testing::{mock_dependencies, mock_env, mock_info, MockApi, MockQuerier, MockStorage}, + Coin, OwnedDeps, + }; + use hpl_interface::{ + build_test_executor, build_test_querier, + core::HandleMsg, + router::DomainRouteSet, + warp::native::{Metadata, NativeModeBriged, NativeModeCollateral}, + }; + use hpl_router::set_route; + use ibcx_test_utils::{addr, gen_bz}; + use rstest::{fixture, rstest}; + + use super::*; + + build_test_executor!(super::execute); + build_test_querier!(super::query); + + type NativeTokenMode = TokenModeMsg; + type TestDeps = OwnedDeps; + + const DEPLOYER: &str = "deployer"; + const OWNER: &str = "owner"; + const MAILBOX: &str = "mailbox"; + const DENOM: &str = "utest"; + + #[fixture] + fn metadata(#[default(true)] empty: bool) -> Option { + if empty { + None + } else { + Some(Metadata { + description: "testtesttest".into(), + denom_units: vec![], + base: "basebasebase".into(), + display: "displaydisplaydisplay".into(), + name: DENOM.into(), + symbol: DENOM.into(), + }) + } + } + + #[fixture] + fn token_mode_bridged(metadata: Option) -> NativeTokenMode { + TokenModeMsg::Bridged(NativeModeBriged { + denom: DENOM.into(), + metadata, + }) + } + + #[fixture] + fn token_mode_collateral() -> NativeTokenMode { + TokenModeMsg::Collateral(NativeModeCollateral { + denom: DENOM.into(), + }) + } + + #[fixture] + fn deps( + #[default(token_mode_collateral())] token_mode: NativeTokenMode, + #[default("osmo")] hrp: &str, + ) -> TestDeps { + let mut deps = mock_dependencies(); + + super::instantiate( + deps.as_mut(), + mock_env(), + mock_info(DEPLOYER, &[]), + super::InstantiateMsg { + token: token_mode, + hrp: hrp.into(), + owner: OWNER.into(), + mailbox: MAILBOX.into(), + }, + ) + .unwrap(); + + deps + } + + #[rstest] + #[case(token_mode_bridged(metadata(true)))] + #[case(token_mode_bridged(metadata(false)))] + #[case(token_mode_collateral())] + fn test_queries(#[values("osmo", "neutron")] hrp: &str, #[case] token_mode: NativeTokenMode) { + let mut deps = deps(token_mode.clone(), hrp); + + if TokenMode::from(token_mode.clone()) == TokenMode::Bridged { + super::TOKEN + .save(deps.as_mut().storage, &DENOM.into()) + .unwrap(); + } + + let res: warp::TokenTypeResponse = test_query( + deps.as_ref(), + QueryMsg::TokenDefault(warp::TokenWarpDefaultQueryMsg::TokenType {}), + ); + assert_eq!( + res.typ, + warp::TokenType::Native(warp::TokenTypeNative::Fungible { + denom: DENOM.into() + }) + ); + + let res: warp::TokenModeResponse = test_query( + deps.as_ref(), + QueryMsg::TokenDefault(warp::TokenWarpDefaultQueryMsg::TokenMode {}), + ); + assert_eq!(res.mode, token_mode.into()); + } + + #[rstest] + #[case(token_mode_bridged(metadata(true)))] + #[case(token_mode_bridged(metadata(false)))] + #[case(token_mode_collateral())] + fn test_init(#[values("osmo", "neutron")] hrp: &str, #[case] token_mode: NativeTokenMode) { + let mut deps = mock_dependencies(); + + let res = super::instantiate( + deps.as_mut(), + mock_env(), + mock_info(DEPLOYER, &[]), + super::InstantiateMsg { + token: token_mode.clone(), + hrp: hrp.into(), + owner: OWNER.into(), + mailbox: MAILBOX.into(), + }, + ) + .unwrap(); + + let storage = deps.as_ref().storage; + assert_eq!(super::HRP.load(storage).unwrap(), hrp); + assert_eq!( + super::MODE.load(storage).unwrap(), + token_mode.clone().into() + ); + assert_eq!(super::MAILBOX.load(storage).unwrap(), MAILBOX); + + match token_mode { + TokenModeMsg::Bridged(v) => { + if v.metadata.is_some() { + assert_eq!(res.messages.len(), 2); + } else { + assert_eq!(res.messages.len(), 1); + } + } + TokenModeMsg::Collateral(_) => { + assert_eq!(res.messages.len(), 0); + assert_eq!(super::TOKEN.load(storage).unwrap(), DENOM); + } + } + } + + #[rstest] + #[case(MAILBOX, 1, gen_bz(32))] + #[should_panic(expected = "unauthorized")] + #[case(OWNER, 1, gen_bz(32))] + #[should_panic(expected = "route not found")] + #[case(MAILBOX, 2, gen_bz(32))] + fn test_mailbox_handle( + mut deps: TestDeps, + #[case] sender: &str, + #[case] origin_domain: u32, + #[case] origin_sender: HexBinary, + ) { + let recipient = gen_bz(32); + + let handle_msg = HandleMsg { + origin: origin_domain, + sender: origin_sender.clone(), + body: warp::Message { + recipient: recipient.clone(), + amount: Uint256::from_u128(100), + metadata: HexBinary::default(), + } + .into(), + }; + + set_route( + deps.as_mut().storage, + &addr(OWNER), + DomainRouteSet { + domain: 1, + route: Some(origin_sender), + }, + ) + .unwrap(); + + let res = test_execute( + deps.as_mut(), + &addr(sender), + ExecuteMsg::Handle(handle_msg), + vec![], + ); + let mut msgs: Vec<_> = res.messages.into_iter().map(|v| v.msg).collect(); + + let mode = MODE.load(deps.as_ref().storage).unwrap(); + + assert_eq!( + msgs.pop().unwrap(), + conv::to_send_msg( + &bech32_encode("osmo", recipient.as_slice()).unwrap(), + vec![coin(100, DENOM)] + ) + .into() + ); + + if mode == TokenMode::Bridged { + assert_eq!( + msgs.pop().unwrap(), + conv::to_mint_msg(&mock_env().contract.address, DENOM, "100").into() + ); + } else { + assert!(msgs.is_empty()); + } + } + + #[rstest] + #[case(1, gen_bz(32), gen_bz(32), vec![coin(100, DENOM)])] + #[should_panic(expected = "route not found")] + #[case(2, gen_bz(32), gen_bz(32), vec![coin(100, DENOM)])] + #[should_panic(expected = "No funds sent")] + #[case(1, gen_bz(32), gen_bz(32), vec![])] + #[should_panic(expected = "Must send reserve token 'utest'")] + #[case(1, gen_bz(32), gen_bz(32), vec![coin(100, "uatom")])] + #[should_panic(expected = "Sent more than one denomination")] + #[case(1, gen_bz(32), gen_bz(32), vec![coin(100, DENOM), coin(100, "uatom")])] + fn test_transfer_remote( + mut deps: TestDeps, + #[case] dest_domain: u32, + #[case] dest_router: HexBinary, + #[case] dest_recipient: HexBinary, + #[case] funds: Vec, + ) { + set_route( + deps.as_mut().storage, + &addr(OWNER), + DomainRouteSet { + domain: 1, + route: Some(dest_router.clone()), + }, + ) + .unwrap(); + + let res = test_execute( + deps.as_mut(), + &addr("sender"), + ExecuteMsg::TransferRemote { + dest_domain, + recipient: dest_recipient.clone(), + }, + funds, + ); + let mut msgs: Vec<_> = res.messages.into_iter().map(|v| v.msg).collect(); + + let mode = MODE.load(deps.as_ref().storage).unwrap(); + + assert_eq!( + msgs.last().unwrap(), + &mailbox::dispatch( + MAILBOX, + dest_domain, + dest_router, + warp::Message { + recipient: dest_recipient, + amount: Uint256::from_u128(100), + metadata: HexBinary::default(), + } + .into(), + None, + None + ) + .unwrap() + ); + msgs.remove(msgs.len() - 1); // remove last (dispatch) msg + + if mode == TokenMode::Bridged { + assert_eq!( + msgs.pop().unwrap(), + conv::to_burn_msg(&mock_env().contract.address, DENOM, "100").into() + ); + } else { + assert!(msgs.is_empty()); + } + } +} diff --git a/contracts/warp/native/src/error.rs b/contracts/warp/native/src/error.rs index e0715bce..25a421cc 100644 --- a/contracts/warp/native/src/error.rs +++ b/contracts/warp/native/src/error.rs @@ -12,15 +12,15 @@ pub enum ContractError { #[error("{0}")] RecoverPubkeyError(#[from] RecoverPubkeyError), - #[error("Unauthorized")] + #[error("unauthorized")] Unauthorized, - #[error("WrongLength")] + #[error("wrong length")] WrongLength, - #[error("InvalidReplyId")] + #[error("invalid reply id")] InvalidReplyId, - #[error("NoRouter domain:{domain:?}")] + #[error("no route for domain {domain:?}")] NoRouter { domain: u32 }, } diff --git a/contracts/warp/native/src/lib.rs b/contracts/warp/native/src/lib.rs index 426030f8..3b625710 100644 --- a/contracts/warp/native/src/lib.rs +++ b/contracts/warp/native/src/lib.rs @@ -7,9 +7,6 @@ mod conv; pub mod error; mod proto; -#[cfg(test)] -mod tests; - // reply message pub const REPLY_ID_CREATE_DENOM: u64 = 0; diff --git a/contracts/warp/native/src/tests/contracts.rs b/contracts/warp/native/src/tests/contracts.rs deleted file mode 100644 index c7d92baa..00000000 --- a/contracts/warp/native/src/tests/contracts.rs +++ /dev/null @@ -1,279 +0,0 @@ -// use std::str::FromStr; - -// use cosmwasm_std::{ -// coin, testing::mock_env, to_binary, Addr, BankMsg, CosmosMsg, HexBinary, Uint256, WasmMsg, -// }; -// use hpl_interface::{ -// core::mailbox, -// types::bech32_encode, -// warp::{self, TokenMode}, -// }; -// use rstest::rstest; - -// use crate::{ -// error::ContractError, -// proto::{self, MsgBurn, MsgMint}, -// }; - -// use super::TokenNative; - -// #[rstest] -// #[case("osmo")] -// #[case("neutron")] -// fn test_init(#[case] hrp: &str) -> anyhow::Result<()> { -// let deployer = Addr::unchecked("deployer"); -// let mailbox = Addr::unchecked("mailbox"); -// let owner = Addr::unchecked("owner"); - -// let mut warp = TokenNative::default(); - -// warp.init( -// &deployer, -// hrp, -// &owner, -// &mailbox, -// "token-warp", -// None, -// TokenMode::Bridged, -// )?; - -// Ok(()) -// } - -// #[rstest] -// #[case("osmo")] -// #[case("neutron")] -// fn test_router_role(#[case] hrp: &str) -> anyhow::Result<()> { -// let deployer = Addr::unchecked("deployer"); -// let mailbox = Addr::unchecked("mailbox"); -// let owner = Addr::unchecked("owner"); - -// let denom = "token-native"; -// let domain = 999; -// let router = b"hello".to_vec(); - -// let mut warp = TokenNative::default(); - -// warp.init_hack(&deployer, &owner, &mailbox, hrp, denom, TokenMode::Bridged)?; - -// // err -// let err = warp -// .router_enroll(&mailbox, domain, router.clone()) -// .unwrap_err(); -// assert_eq!(err, ContractError::Unauthorized); - -// // ok -// warp.router_enroll(&owner, domain, router)?; - -// Ok(()) -// } - -// #[rstest] -// fn test_outbound_transfer(#[values("osmo", "neutron")] hrp: &str) -> anyhow::Result<()> { -// let deployer = Addr::unchecked("deployer"); -// let mailbox = Addr::unchecked("mailbox"); -// let router = Addr::unchecked("router"); -// let owner = Addr::unchecked("owner"); - -// let denom = "token-native"; -// let amount = 100_000; - -// let user_remote = Addr::unchecked("user-remote"); - -// let dest_domain = 1; - -// let env = mock_env(); - -// let burn_msg: CosmosMsg = MsgBurn { -// sender: env.contract.address.to_string(), -// amount: Some(proto::Coin { -// amount: amount.to_string(), -// denom: denom.to_string(), -// }), -// } -// .into(); - -// let dispatch_msg = mailbox::dispatch( -// mailbox, -// dest_domain, -// router.as_bytes().to_vec().into(), -// warp::Message { -// recipient: user_remote.as_bytes().to_vec().into(), -// amount: Uint256::from_str(&amount.to_string())?, -// metadata: HexBinary::default(), -// } -// .into(), -// None, -// None, -// ); - -// for (mode, routers, expected_resp) in [ -// ( -// TokenMode::Bridged, -// vec![(dest_domain, router.as_bytes().into())], -// Ok(vec![burn_msg, dispatch_msg.clone()]), -// ), -// ( -// TokenMode::Bridged, -// vec![], -// Err(ContractError::NoRouter { -// domain: dest_domain, -// }), -// ), -// ( -// TokenMode::Collateral, -// vec![(dest_domain, router.as_bytes().into())], -// Ok(vec![dispatch_msg]), -// ), -// ( -// TokenMode::Collateral, -// vec![], -// Err(ContractError::NoRouter { -// domain: dest_domain, -// }), -// ), -// ] { -// let mut warp = TokenNative { -// env: env.clone(), -// ..Default::default() -// }; - -// warp.init_hack(&deployer, &owner, &mailbox, hrp, denom, mode)?; - -// for (domain, router) in routers { -// warp.router_enroll(&owner, domain, router)?; -// } - -// let resp = warp.transfer_remote( -// &owner, -// coin(amount, denom), -// dest_domain, -// user_remote.as_bytes().into(), -// ); - -// assert_eq!( -// resp.map(|v| v.messages.into_iter().map(|v| v.msg).collect::>()), -// expected_resp -// ); -// } - -// Ok(()) -// } - -// #[rstest] -// #[case("osmo")] -// #[case("neutron")] -// fn test_inbound_transfer(#[case] hrp: &str) -> anyhow::Result<()> { -// let deployer = Addr::unchecked("deployer"); -// let mailbox = Addr::unchecked("mailbox"); -// let router = Addr::unchecked("router"); -// let owner = Addr::unchecked("owner"); -// let errortic = Addr::unchecked("errortic"); - -// let denom = "token-native"; -// let amount = 100_000; - -// let user_remote = Addr::unchecked("user-remote____________________1"); - -// let env = mock_env(); - -// let origin_domain = 1; - -// let mint_msg: CosmosMsg = MsgMint { -// sender: env.contract.address.to_string(), -// amount: Some(proto::Coin { -// amount: amount.to_string(), -// denom: denom.to_string(), -// }), -// } -// .into(); - -// let send_msg: CosmosMsg = BankMsg::Send { -// to_address: bech32_encode(hrp, user_remote.as_bytes())?.to_string(), -// amount: vec![coin(amount, denom)], -// } -// .into(); - -// let default_msg = token::Message { -// recipient: user_remote.as_bytes().to_vec().into(), -// amount: Uint256::from_u128(amount), -// metadata: Binary::default(), -// }; - -// for (mode, sender, origin, origin_sender, token_msg, expected_resp) in [ -// // happy -// ( -// TokenMode::Bridged, -// &mailbox, -// origin_domain, -// &router, -// default_msg.clone(), -// Ok(vec![mint_msg, send_msg.clone()]), -// ), -// ( -// TokenMode::Collateral, -// &mailbox, -// origin_domain, -// &router, -// default_msg.clone(), -// Ok(vec![send_msg]), -// ), -// // errors -// ( -// TokenMode::Bridged, -// &errortic, -// origin_domain, -// &router, -// default_msg.clone(), -// Err(ContractError::Unauthorized), -// ), -// ( -// TokenMode::Bridged, -// &mailbox, -// origin_domain, -// &errortic, -// default_msg.clone(), -// Err(ContractError::Unauthorized), -// ), -// ( -// TokenMode::Collateral, -// &errortic, -// origin_domain, -// &router, -// default_msg.clone(), -// Err(ContractError::Unauthorized), -// ), -// ( -// TokenMode::Collateral, -// &mailbox, -// origin_domain, -// &errortic, -// default_msg, -// Err(ContractError::Unauthorized), -// ), -// ] { -// let mut warp = TokenNative { -// env: env.clone(), -// ..Default::default() -// }; - -// warp.init_hack(&deployer, &owner, &mailbox, hrp, denom, mode)?; -// warp.router_enroll(&owner, origin_domain, router.as_bytes().into())?; - -// let resp = warp.mailbox_handle( -// sender, -// mailbox::HandleMsg { -// origin, -// sender: origin_sender.as_bytes().to_vec().into(), -// body: token_msg.into(), -// }, -// ); - -// assert_eq!( -// resp.map(|v| v.messages.into_iter().map(|v| v.msg).collect::>()), -// expected_resp -// ); -// } - -// Ok(()) -// } diff --git a/contracts/warp/native/src/tests/mod.rs b/contracts/warp/native/src/tests/mod.rs deleted file mode 100644 index e3c7904a..00000000 --- a/contracts/warp/native/src/tests/mod.rs +++ /dev/null @@ -1,132 +0,0 @@ -// use cosmwasm_std::{ -// from_binary, -// testing::{mock_dependencies, mock_env, mock_info, MockApi, MockQuerier, MockStorage}, -// Addr, Binary, Coin, Empty, Env, MessageInfo, OwnedDeps, Response, -// }; -// use hpl_interface::{ -// mailbox, router, -// token::TokenMode, -// token_native::{ExecuteMsg, QueryMsg}, -// }; -// use serde::de::DeserializeOwned; - -// use crate::{ -// contract::{execute, instantiate, query}, -// error::ContractError, -// msg::{InstantiateMsg, Metadata}, -// state::{HRP, MAILBOX, MODE, OWNER, TOKEN}, -// }; - -// mod contracts; - -// pub struct TokenNative { -// pub deps: OwnedDeps, -// pub env: Env, -// } - -// impl Default for TokenNative { -// fn default() -> Self { -// Self { -// deps: mock_dependencies(), -// env: mock_env(), -// } -// } -// } - -// impl TokenNative { -// #[allow(clippy::too_many_arguments)] -// pub fn init( -// &mut self, -// sender: &Addr, -// hrp: &str, -// owner: &Addr, -// mailbox: &Addr, -// denom: &str, -// metadata: Option, -// mode: TokenMode, -// ) -> Result { -// instantiate( -// self.deps.as_mut(), -// self.env.clone(), -// mock_info(sender.as_str(), &[]), -// InstantiateMsg { -// denom: denom.to_string(), -// metadata, -// mode, -// hrp: hrp.to_string(), -// owner: owner.to_string(), -// mailbox: mailbox.to_string(), -// }, -// ) -// } - -// pub fn init_hack( -// &mut self, -// _sender: &Addr, -// owner: &Addr, -// mailbox: &Addr, -// hrp: &str, -// denom: &str, -// mode: TokenMode, -// ) -> anyhow::Result<()> { -// MODE.save(&mut self.deps.storage, &mode)?; -// HRP.save(&mut self.deps.storage, &hrp.to_string())?; -// TOKEN.save(&mut self.deps.storage, &denom.to_string())?; -// OWNER.save(&mut self.deps.storage, owner)?; -// MAILBOX.save(&mut self.deps.storage, mailbox)?; - -// Ok(()) -// } - -// fn execute(&mut self, info: MessageInfo, msg: ExecuteMsg) -> Result { -// execute(self.deps.as_mut(), self.env.clone(), info, msg) -// } - -// #[allow(dead_code)] -// fn query(&self, msg: QueryMsg) -> Result { -// query(self.deps.as_ref(), self.env.clone(), msg) -// .map(|v| from_binary::(&v))? -// .map_err(|e| e.into()) -// } - -// pub fn router_enroll( -// &mut self, -// sender: &Addr, -// domain: u32, -// router: Binary, -// ) -> Result { -// self.execute( -// mock_info(sender.as_str(), &[]), -// ExecuteMsg::Router(router::RouterMsg::EnrollRemoteRouter { -// set: router::RouterSet { domain, router }, -// }), -// ) -// } - -// pub fn mailbox_handle( -// &mut self, -// sender: &Addr, -// handle_msg: mailbox::HandleMsg, -// ) -> Result { -// self.execute( -// mock_info(sender.as_str(), &[]), -// ExecuteMsg::Handle(handle_msg), -// ) -// } - -// pub fn transfer_remote( -// &mut self, -// sender: &Addr, -// fund: Coin, -// dest_domain: u32, -// recipient: Binary, -// ) -> Result { -// self.execute( -// mock_info(sender.as_str(), &[fund]), -// ExecuteMsg::TransferRemote { -// dest_domain, -// recipient, -// }, -// ) -// } -// } diff --git a/integration-test/Cargo.toml b/integration-test/Cargo.toml index 9e9ed859..63f76ff3 100644 --- a/integration-test/Cargo.toml +++ b/integration-test/Cargo.toml @@ -39,6 +39,9 @@ ripemd.workspace = true hex-literal.workspace = true ibcx-test-utils.workspace = true +rstest.workspace = true +cw20.workspace = true + hpl-ownable.workspace = true hpl-ism-multisig.workspace = true hpl-interface.workspace = true diff --git a/integration-test/tests/contracts/cw/deploy.rs b/integration-test/tests/contracts/cw/deploy.rs index b9a03c0e..5bb262de 100644 --- a/integration-test/tests/contracts/cw/deploy.rs +++ b/integration-test/tests/contracts/cw/deploy.rs @@ -5,33 +5,32 @@ use cosmwasm_std::HexBinary; use hpl_interface::{ core::mailbox, router::{DomainRouteSet, RouterMsg}, - warp::{self, cw20::Cw20ModeBridged}, + warp::{self, cw20::Cw20ModeBridged, native::NativeModeBriged}, }; -use test_tube::{Account, Runner, SigningAccount, Wasm}; +use osmosis_test_tube::osmosis_std::types::cosmwasm::wasm::v1::MsgInstantiateContractResponse; +use test_tube::{Account, ExecuteResponse, Runner, SigningAccount, Wasm}; use super::{ types::{Codes, CoreDeployments}, Hook, Ism, }; -fn instantiate<'a, M: Serialize, R: Runner<'a>>( +pub fn instantiate<'a, M: Serialize, R: Runner<'a>>( wasm: &Wasm<'a, R>, code: u64, deployer: &SigningAccount, name: &str, msg: &M, -) -> eyre::Result { - Ok(wasm - .instantiate( - code, - msg, - Some(&deployer.address()), - Some(name), - &[], - deployer, - )? - .data - .address) +) -> ExecuteResponse { + wasm.instantiate( + code, + msg, + Some(&deployer.address()), + Some(name), + &[], + deployer, + ) + .unwrap() } #[allow(clippy::too_many_arguments)] @@ -57,11 +56,13 @@ pub fn deploy_core<'a, R: Runner<'a>>( owner: deployer.address(), domain: origin_domain, }, - )?; + ) + .data + .address; // set default ism, hook, igp - let default_ism = default_ism.deploy(wasm, codes, deployer)?; + let default_ism = default_ism.deploy(wasm, codes, owner, deployer)?; let default_hook = default_hook.deploy(wasm, codes, mailbox.clone(), owner, deployer)?; let required_hook = required_hook.deploy(wasm, codes, mailbox.clone(), owner, deployer)?; @@ -106,7 +107,9 @@ pub fn deploy_core<'a, R: Runner<'a>>( &ReceiverInitMsg { hrp: hrp.to_string(), }, - )?; + ) + .data + .address; Ok(CoreDeployments { mailbox, @@ -126,29 +129,48 @@ pub fn deploy_warp_route_bridged<'a, R: Runner<'a>>( hrp: &str, codes: &Codes, denom: String, -) -> eyre::Result { - instantiate( - wasm, - codes.warp_cw20, - deployer, - "warp-cw20", - &warp::cw20::InstantiateMsg { - token: warp::TokenModeMsg::Bridged(Cw20ModeBridged { - code_id: codes.cw20_base, - init_msg: Box::new(warp::cw20::Cw20InitMsg { - name: denom.clone(), - symbol: denom, - decimals: 6, - initial_balances: vec![], - mint: None, - marketing: None, + token_type: warp::TokenType, +) -> ExecuteResponse { + match token_type { + warp::TokenType::Native(_) => instantiate( + wasm, + codes.warp_native, + deployer, + "warp-native", + &warp::native::InstantiateMsg { + token: warp::TokenModeMsg::Bridged(NativeModeBriged { + denom, + metadata: None, }), - }), - hrp: hrp.to_string(), - owner: owner.address(), - mailbox: mailbox.to_string(), - }, - ) + hrp: hrp.to_string(), + owner: owner.address(), + mailbox: mailbox.to_string(), + }, + ), + warp::TokenType::CW20 { .. } => instantiate( + wasm, + codes.warp_cw20, + deployer, + "warp-cw20", + &warp::cw20::InstantiateMsg { + token: warp::TokenModeMsg::Bridged(Cw20ModeBridged { + code_id: codes.cw20_base, + init_msg: Box::new(warp::cw20::Cw20InitMsg { + name: denom.clone(), + symbol: denom, + decimals: 6, + initial_balances: vec![], + mint: None, + marketing: None, + }), + }), + hrp: hrp.to_string(), + owner: owner.address(), + mailbox: mailbox.to_string(), + }, + ), + warp::TokenType::CW721 { .. } => todo!(), + } } #[allow(dead_code)] @@ -160,10 +182,10 @@ pub fn deploy_warp_route_collateral<'a, R: Runner<'a>>( hrp: &str, codes: &Codes, denom: String, -) -> eyre::Result { +) -> ExecuteResponse { if denom.starts_with(format!("{hrp}1").as_str()) { // cw20 - let route = instantiate( + instantiate( wasm, codes.warp_cw20, deployer, @@ -176,12 +198,10 @@ pub fn deploy_warp_route_collateral<'a, R: Runner<'a>>( owner: owner.address(), mailbox: mailbox.to_string(), }, - )?; - - Ok(route) + ) } else { // native - let route = instantiate( + instantiate( wasm, codes.warp_native, deployer, @@ -192,9 +212,7 @@ pub fn deploy_warp_route_collateral<'a, R: Runner<'a>>( owner: owner.address(), mailbox: mailbox.to_string(), }, - )?; - - Ok(route) + ) } } diff --git a/integration-test/tests/contracts/cw/hook.rs b/integration-test/tests/contracts/cw/hook.rs index 863dfda7..c7d4cfb3 100644 --- a/integration-test/tests/contracts/cw/hook.rs +++ b/integration-test/tests/contracts/cw/hook.rs @@ -10,7 +10,7 @@ use ibcx_test_utils::addr; use osmosis_test_tube::Wasm; use test_tube::{Account, Runner, SigningAccount}; -use super::{igp::Igp, types::Codes}; +use super::{igp::Igp, instantiate, types::Codes}; #[allow(dead_code)] pub enum Hook { @@ -43,8 +43,8 @@ pub enum Hook { }, } +#[allow(dead_code)] impl Hook { - #[allow(dead_code)] pub fn mock(gas: Uint256) -> Self { Self::Mock { gas } } @@ -183,6 +183,36 @@ impl Hook { Ok(hook) } + fn deploy_aggregate<'a, R: Runner<'a>>( + wasm: &Wasm<'a, R>, + code: u64, + codes: &Codes, + mailbox: String, + hooks: Vec, + owner: &SigningAccount, + deployer: &SigningAccount, + ) -> eyre::Result { + use hpl_interface::hook::aggregate::*; + + let hook_addrs = hooks + .into_iter() + .map(|hook| hook.deploy(wasm, codes, mailbox.clone(), owner, deployer)) + .collect::>>()?; + + let hook = instantiate( + wasm, + code, + deployer, + "cw-hpl-hook-aggregate", + &InstantiateMsg { + owner: owner.address(), + hooks: hook_addrs, + }, + ); + + Ok(hook.data.address) + } + pub fn deploy<'a, R: Runner<'a>>( self, wasm: &Wasm<'a, R>, @@ -193,7 +223,7 @@ impl Hook { ) -> eyre::Result { match self { Hook::Mock { gas } => Self::deploy_mock(wasm, codes, gas, deployer), - Hook::Igp(igp) => Ok(igp.deploy(wasm, codes, mailbox, owner, deployer)?.core), + Hook::Igp(igp) => Ok(igp.deploy(wasm, codes, owner, deployer)?.core), Hook::Merkle {} => Self::deploy_merkle(wasm, codes, mailbox, owner, deployer), Hook::Pausable {} => Self::deploy_pausable(wasm, codes, owner, deployer), Hook::Routing { routes } => Self::deploy_routing( @@ -266,16 +296,15 @@ impl Hook { Ok(hook_addr) } - Hook::Aggregate { .. } => todo!(), + Hook::Aggregate { hooks } => Self::deploy_aggregate( + wasm, + codes.hook_aggregate, + codes, + mailbox, + hooks, + owner, + deployer, + ), } } } - -pub fn prepare_routing_hook(routes: Vec<(u32, u128)>) -> Hook { - let routes = routes - .into_iter() - .map(|(domain, _)| (domain, Hook::Merkle {})) - .collect(); - - Hook::routing(routes) -} diff --git a/integration-test/tests/contracts/cw/igp.rs b/integration-test/tests/contracts/cw/igp.rs index 7479922c..a1ccaadb 100644 --- a/integration-test/tests/contracts/cw/igp.rs +++ b/integration-test/tests/contracts/cw/igp.rs @@ -25,7 +25,6 @@ impl Igp { self, wasm: &Wasm<'a, R>, codes: &Codes, - mailbox: String, owner: &SigningAccount, deployer: &SigningAccount, ) -> eyre::Result { @@ -35,7 +34,6 @@ impl Igp { &igp::core::InstantiateMsg { hrp: self.hrp, owner: owner.address(), - mailbox, gas_token: self.gas_token, beneficiary: self.beneficiary, }, diff --git a/integration-test/tests/contracts/cw/ism.rs b/integration-test/tests/contracts/cw/ism.rs index 302dd18a..6cc17a44 100644 --- a/integration-test/tests/contracts/cw/ism.rs +++ b/integration-test/tests/contracts/cw/ism.rs @@ -16,6 +16,11 @@ pub enum Ism { validators: validator::TestValidators, }, + Aggregate { + isms: Vec, + threshold: u8, + }, + #[allow(dead_code)] Mock, } @@ -50,6 +55,7 @@ impl Ism { codes: &Codes, hrp: String, set: validator::TestValidators, + owner: &SigningAccount, deployer: &SigningAccount, ) -> eyre::Result { let multisig_ism = wasm @@ -57,7 +63,7 @@ impl Ism { codes.ism_multisig, &hpl_interface::ism::multisig::InstantiateMsg { hrp: hrp.to_string(), - owner: deployer.address(), + owner: owner.address(), }, None, None, @@ -73,7 +79,7 @@ impl Ism { set: set.to_set(&hrp), }, &[], - deployer, + owner, )?; wasm.execute( @@ -85,7 +91,7 @@ impl Ism { }, }, &[], - deployer, + owner, )?; Ok(multisig_ism) @@ -95,19 +101,20 @@ impl Ism { wasm: &Wasm<'a, R>, codes: &Codes, isms: Vec<(u32, Self)>, + owner: &SigningAccount, deployer: &SigningAccount, ) -> eyre::Result { let routing_ism = wasm .instantiate( codes.ism_routing, &hpl_interface::ism::routing::InstantiateMsg { - owner: deployer.address(), + owner: owner.address(), isms: isms .into_iter() .map(|(domain, ism)| { Ok(hpl_interface::ism::routing::IsmSet { domain, - address: ism.deploy(wasm, codes, deployer)?, + address: ism.deploy(wasm, codes, owner, deployer)?, }) }) .collect::>>()?, @@ -123,10 +130,45 @@ impl Ism { Ok(routing_ism) } + fn deploy_aggregate<'a, R: Runner<'a>>( + wasm: &Wasm<'a, R>, + codes: &Codes, + isms: Vec, + threshold: u8, + owner: &SigningAccount, + deployer: &SigningAccount, + ) -> eyre::Result { + use hpl_interface::ism::aggregate::*; + + let ism_addrs = isms + .into_iter() + .map(|v| v.deploy(wasm, codes, owner, deployer)) + .collect::>>()?; + + let aggregate_ism = wasm + .instantiate( + codes.ism_aggregate, + &InstantiateMsg { + owner: owner.address(), + isms: ism_addrs, + threshold, + }, + None, + None, + &[], + deployer, + )? + .data + .address; + + Ok(aggregate_ism) + } + pub fn deploy<'a, R: Runner<'a>>( self, wasm: &Wasm<'a, R>, codes: &Codes, + owner: &SigningAccount, deployer: &SigningAccount, ) -> eyre::Result { match self { @@ -134,8 +176,11 @@ impl Ism { Self::Multisig { hrp, validators: set, - } => Self::deploy_multisig(wasm, codes, hrp, set, deployer), - Self::Routing(isms) => Self::deploy_routing(wasm, codes, isms, deployer), + } => Self::deploy_multisig(wasm, codes, hrp, set, owner, deployer), + Self::Aggregate { isms, threshold } => { + Self::deploy_aggregate(wasm, codes, isms, threshold, owner, deployer) + } + Self::Routing(isms) => Self::deploy_routing(wasm, codes, isms, owner, deployer), } } } @@ -144,7 +189,13 @@ pub fn prepare_routing_ism(info: Vec<(u32, &str, TestValidators)>) -> Ism { let mut isms = vec![]; for (domain, hrp, set) in info { - isms.push((domain, Ism::multisig(hrp, set))); + isms.push(( + domain, + Ism::Aggregate { + isms: vec![Ism::multisig(hrp, set)], + threshold: 1, + }, + )); } Ism::routing(isms) diff --git a/integration-test/tests/contracts/cw/mod.rs b/integration-test/tests/contracts/cw/mod.rs index 28a25936..c0762aee 100644 --- a/integration-test/tests/contracts/cw/mod.rs +++ b/integration-test/tests/contracts/cw/mod.rs @@ -6,8 +6,8 @@ mod setup; mod store; mod types; -pub use deploy::deploy_core; -pub use hook::{prepare_routing_hook, Hook}; +pub use deploy::*; +pub use hook::Hook; pub use ism::{prepare_routing_ism, Ism}; pub use setup::{setup_env, Env}; pub use store::store_code; diff --git a/integration-test/tests/contracts/cw/setup.rs b/integration-test/tests/contracts/cw/setup.rs index fafa83af..28ee591a 100644 --- a/integration-test/tests/contracts/cw/setup.rs +++ b/integration-test/tests/contracts/cw/setup.rs @@ -1,14 +1,17 @@ use std::{collections::BTreeMap, path::PathBuf}; -use cosmwasm_std::{coin, Coin}; +use cosmwasm_std::{coin, Coin, Uint256}; use hpl_interface::igp::oracle::RemoteGasDataConfig; use test_tube::{Account, Module, Runner, SigningAccount, Wasm}; use crate::validator::TestValidators; use super::{ - deploy_core, igp::Igp, prepare_routing_hook, prepare_routing_ism, store_code, - types::CoreDeployments, Hook, + deploy_core, + igp::Igp, + prepare_routing_ism, store_code, + types::{Codes, CoreDeployments}, + Hook, }; const DEFAULT_GAS: u128 = 300_000; @@ -18,6 +21,7 @@ pub struct Env<'a, R: Runner<'a>> { pub app: &'a R, pub core: CoreDeployments, + pub codes: Codes, pub domain: u32, acc_gen: Box SigningAccount>, @@ -58,14 +62,20 @@ pub fn setup_env<'a, R: Runner<'a>>( .map(|v| (v.domain, hrp, v.clone())) .collect(), ); - let default_hook = - prepare_routing_hook(validators.iter().map(|v| (v.domain, DEFAULT_GAS)).collect()); - let required_hook = Hook::Igp(Igp { - hrp: hrp.to_string(), - gas_token: "uosmo".to_string(), - beneficiary: deployer.address(), - oracle_configs: oracle_config.to_vec(), - }); + + let default_hook = Hook::mock(Uint256::from_u128(DEFAULT_GAS)); + + let required_hook = Hook::Aggregate { + hooks: vec![ + Hook::Merkle {}, + Hook::Igp(Igp { + hrp: hrp.to_string(), + gas_token: "uosmo".to_string(), + beneficiary: deployer.address(), + oracle_configs: oracle_config.to_vec(), + }), + ], + }; let wasm = Wasm::new(app); let codes = store_code(&wasm, &deployer, artifacts)?; @@ -86,6 +96,7 @@ pub fn setup_env<'a, R: Runner<'a>>( app, core, + codes, domain, acc_gen: Box::new(acc_gen), diff --git a/integration-test/tests/contracts/cw/store.rs b/integration-test/tests/contracts/cw/store.rs index 0e3a69ea..9db25a4d 100644 --- a/integration-test/tests/contracts/cw/store.rs +++ b/integration-test/tests/contracts/cw/store.rs @@ -7,9 +7,10 @@ use super::types::{Codes, CodesMap}; const DEFAULT_ARTIFACTS_PATH: &str = "../target/wasm32-unknown-unknown/release/"; -const CONTRACTS: [&str; 16] = [ +const CONTRACTS: [&str; 18] = [ "mailbox", "validator_announce", + "hook_aggregate", "hook_merkle", "hook_pausable", "hook_routing", @@ -17,6 +18,7 @@ const CONTRACTS: [&str; 16] = [ "hook_routing_fallback", "igp", "igp_oracle", + "ism_aggregate", "ism_multisig", "ism_routing", "test_mock_hook", diff --git a/integration-test/tests/contracts/cw/types.rs b/integration-test/tests/contracts/cw/types.rs index 41ec7468..d1f58024 100644 --- a/integration-test/tests/contracts/cw/types.rs +++ b/integration-test/tests/contracts/cw/types.rs @@ -17,6 +17,7 @@ pub struct Codes { #[serde(rename = "validator_announce")] pub va: u64, + pub hook_aggregate: u64, pub hook_merkle: u64, pub hook_pausable: u64, pub hook_routing: u64, @@ -26,6 +27,7 @@ pub struct Codes { pub igp: u64, pub igp_oracle: u64, + pub ism_aggregate: u64, pub ism_multisig: u64, pub ism_routing: u64, diff --git a/integration-test/tests/mailbox.rs b/integration-test/tests/mailbox.rs index 69ca8807..26aeef0a 100644 --- a/integration-test/tests/mailbox.rs +++ b/integration-test/tests/mailbox.rs @@ -8,14 +8,18 @@ use cosmwasm_std::{attr, coin, Attribute, Binary, Uint128}; use ethers::{ prelude::parse_log, providers::Middleware, signers::Signer, types::TransactionReceipt, }; -use osmosis_test_tube::{Account, Module, OsmosisTestApp, Wasm}; +use ibcx_test_utils::addr; +use osmosis_test_tube::{ + osmosis_std::types::cosmwasm::wasm::v1::MsgExecuteContractResponse, Account, Module, + OsmosisTestApp, Wasm, +}; use hpl_interface::{ core::mailbox::{self, DispatchMsg}, igp::oracle::RemoteGasDataConfig, - types::{bech32_decode, bech32_encode, bech32_to_h256}, + types::{bech32_decode, bech32_encode, bech32_to_h256, AggregateMetadata}, }; -use test_tube::Runner; +use test_tube::{ExecuteResponse, Runner}; use crate::{ constants::*, @@ -35,9 +39,9 @@ fn sorted(mut attrs: Vec) -> Vec { attrs } -async fn send_msg<'a, M, S, R>( - anvil: ð::Env, - cosmos: &cw::Env<'a, R>, +async fn send_msg_cw_to_evm<'a, M, S, R>( + from: &cw::Env<'a, R>, + to: ð::Env, ) -> eyre::Result where M: Middleware + 'static, @@ -45,13 +49,13 @@ where R: Runner<'a>, { let mut receiver = [0u8; 32]; - receiver[12..].copy_from_slice(&anvil.core.msg_receiver.address().0); - let _sender = bech32_decode(cosmos.acc_tester.address().as_str())?; + receiver[12..].copy_from_slice(&to.core.msg_receiver.address().0); + let _sender = bech32_decode(from.acc_tester.address().as_str())?; let msg_body = b"hello world"; // dispatch - let dispatch_res = Wasm::new(cosmos.app).execute( - &cosmos.core.mailbox, + let dispatch_res = Wasm::new(from.app).execute( + &from.core.mailbox, &mailbox::ExecuteMsg::Dispatch(DispatchMsg { dest_domain: DOMAIN_EVM, recipient_addr: receiver.into(), @@ -60,13 +64,13 @@ where metadata: None, }), &[coin(56_000_000, "uosmo")], - &cosmos.acc_tester, + &from.acc_tester, )?; let dispatch = parse_dispatch_from_res(&dispatch_res.events); let _dispatch_id = parse_dispatch_id_from_res(&dispatch_res.events); - let process_tx = anvil + let process_tx = to .core .mailbox .process(vec![].into(), Binary::from(dispatch.message).0.into()); @@ -75,6 +79,79 @@ where Ok(process_tx_res) } +async fn send_msg_evm_to_cw<'a, M, S, R>( + from: ð::Env, + to: &cw::Env<'a, R>, +) -> eyre::Result> +where + M: Middleware + 'static, + S: Signer + 'static, + R: Runner<'a>, +{ + // prepare message arguments + let sender = bech32_encode("osmo", from.acc_owner.address().as_bytes())?; + let receiver = bech32_to_h256(&to.core.msg_receiver)?; + let msg_body = b"hello world"; + + // dispatch + let dispatch_tx_call = from + .core + .mailbox + .dispatch(DOMAIN_OSMO, receiver, msg_body.into()); + let dispatch_res = dispatch_tx_call.send().await?.await?.unwrap(); + + let dispatch: DispatchFilter = parse_log(dispatch_res.logs[0].clone())?; + let dispatch_id: DispatchIdFilter = parse_log(dispatch_res.logs[1].clone())?; + + // generate ism metadata + let multisig_ism_metadata = to.get_validator_set(DOMAIN_EVM)?.make_metadata( + from.core.mailbox.address(), + from.core.mailbox.root().await?, + from.core.mailbox.count().await? - 1, + dispatch_id.message_id, + true, + )?; + + let aggregate_ism_metadata = AggregateMetadata::new(vec![( + addr(&to.core.default_ism), + multisig_ism_metadata.into(), + )]); + + // process + let process_res = Wasm::new(to.app).execute( + &to.core.mailbox, + &mailbox::ExecuteMsg::Process { + metadata: aggregate_ism_metadata.into(), + message: dispatch.message.to_vec().into(), + }, + &[], + &to.acc_owner, + )?; + let process_recv_evt = process_res + .events + .iter() + .find(|v| v.ty == "wasm-mailbox_msg_received") + .unwrap(); + + assert_eq!( + process_recv_evt.attributes, + sorted(vec![ + Attribute { + key: "_contract_address".to_string(), + value: to.core.msg_receiver.clone(), + }, + attr("sender", sender), + attr( + "origin", + from.core.mailbox.local_domain().await?.to_string() + ), + attr("body", std::str::from_utf8(msg_body)?), + ]), + ); + + Ok(process_res) +} + #[tokio::test] async fn test_mailbox_cw_to_evm() -> eyre::Result<()> { // init Osmosis env @@ -96,7 +173,7 @@ async fn test_mailbox_cw_to_evm() -> eyre::Result<()> { // init Anvil env let anvil1 = eth::setup_env(DOMAIN_EVM).await?; - let _ = send_msg(&anvil1, &osmo).await?; + let _ = send_msg_cw_to_evm(&osmo, &anvil1).await?; Ok(()) } @@ -122,61 +199,7 @@ async fn test_mailbox_evm_to_cw() -> eyre::Result<()> { // init Anvil env let anvil1 = eth::setup_env(DOMAIN_EVM).await?; - // prepare message arguments - let sender = bech32_encode("osmo", anvil1.acc_owner.address().as_bytes())?; - let receiver = bech32_to_h256(&osmo.core.msg_receiver)?; - let msg_body = b"hello world"; - - // dispatch - let dispatch_tx_call = anvil1 - .core - .mailbox - .dispatch(DOMAIN_OSMO, receiver, msg_body.into()); - let dispatch_res = dispatch_tx_call.send().await?.await?.unwrap(); - - let dispatch: DispatchFilter = parse_log(dispatch_res.logs[0].clone())?; - let dispatch_id: DispatchIdFilter = parse_log(dispatch_res.logs[1].clone())?; - - // generate ism metadata - let ism_metadata = osmo.get_validator_set(DOMAIN_EVM)?.make_metadata( - anvil1.core.mailbox.address(), - anvil1.core.mailbox.root().await?, - anvil1.core.mailbox.count().await?, - dispatch_id.message_id, - true, - )?; - - // process - let process_res = Wasm::new(osmo.app).execute( - &osmo.core.mailbox, - &mailbox::ExecuteMsg::Process { - metadata: ism_metadata.into(), - message: dispatch.message.to_vec().into(), - }, - &[], - &osmo.acc_owner, - )?; - let process_recv_evt = process_res - .events - .iter() - .find(|v| v.ty == "wasm-mailbox_msg_received") - .unwrap(); - - assert_eq!( - process_recv_evt.attributes, - sorted(vec![ - Attribute { - key: "_contract_address".to_string(), - value: osmo.core.msg_receiver, - }, - attr("sender", sender), - attr( - "origin", - anvil1.core.mailbox.local_domain().await?.to_string() - ), - attr("body", std::str::from_utf8(msg_body)?), - ]), - ); + let _ = send_msg_evm_to_cw(&anvil1, &osmo).await?; Ok(()) } diff --git a/integration-test/tests/validator.rs b/integration-test/tests/validator.rs index 959f0fbd..23e360a7 100644 --- a/integration-test/tests/validator.rs +++ b/integration-test/tests/validator.rs @@ -145,7 +145,7 @@ impl TestValidators { let multisig_hash = hpl_ism_multisig::multisig_hash( hpl_ism_multisig::domain_hash(self.domain, addr.to_vec().into())?.to_vec(), merkle_root.to_vec(), - merkle_index.to_be_bytes().to_vec(), + merkle_index, message_id.to_vec(), )?; @@ -206,7 +206,7 @@ fn test_validator() { .make_metadata( H160::from_slice(gen_bz(20).as_slice()), gen_bz(32).as_slice().try_into().unwrap(), - 1, + 0, message_id.as_slice().try_into().unwrap(), true, ) diff --git a/integration-test/tests/warp.rs b/integration-test/tests/warp.rs new file mode 100644 index 00000000..5821b530 --- /dev/null +++ b/integration-test/tests/warp.rs @@ -0,0 +1,288 @@ +#[allow(dead_code)] +mod constants; +mod contracts; +mod event; +mod validator; + +use std::collections::BTreeMap; + +use cosmwasm_std::{Event, Uint128}; +use hpl_interface::{igp::oracle::RemoteGasDataConfig, warp}; +use osmosis_test_tube::{ + osmosis_std::types::osmosis::tokenfactory::{ + self, + v1beta1::{MsgChangeAdmin, MsgCreateDenom}, + }, + OsmosisTestApp, TokenFactory, +}; +use rstest::rstest; +use test_tube::{Account, Module, Wasm}; + +use crate::{constants::*, contracts::cw, validator::TestValidators}; + +fn wasm_events(events: Vec) -> BTreeMap> { + events + .into_iter() + .filter(|v| v.ty.starts_with("wasm-")) + .map(|v| { + ( + v.ty, + v.attributes + .into_iter() + .map(|x| (x.key, x.value)) + .collect::>(), + ) + }) + .collect::>() +} + +#[tokio::test] +async fn test_cw20_colleteral() -> eyre::Result<()> { + let osmo_app = OsmosisTestApp::new(); + let osmo = cw::setup_env( + &osmo_app, + |app, coins| app.init_account(coins).unwrap(), + None::<&str>, + "osmo", + DOMAIN_OSMO, + &[TestValidators::new(DOMAIN_EVM, 5, 3)], + &[RemoteGasDataConfig { + remote_domain: DOMAIN_EVM, + token_exchange_rate: Uint128::from(10u128.pow(4)), + gas_price: Uint128::from(10u128.pow(9)), + }], + )?; + + let wasm = Wasm::new(&osmo_app); + + // deploy new cw20 token + let mock_token = cw::instantiate( + &wasm, + osmo.codes.cw20_base, + &osmo.acc_deployer, + "cw20-base", + &hpl_interface::warp::cw20::Cw20InitMsg { + name: "denomdenom".into(), + symbol: "denomdenom".into(), + decimals: 6, + initial_balances: vec![], + mint: Some(cw20::MinterResponse { + minter: osmo.acc_owner.address(), + cap: None, + }), + marketing: None, + }, + ) + .data + .address; + + // deploy warp route with deployed cw20 token + let warp_resp = cw::deploy_warp_route_collateral( + &wasm, + &osmo.acc_owner, + &osmo.acc_deployer, + &osmo.core.mailbox, + "osmo", + &osmo.codes, + mock_token.clone(), + ); + + let events = wasm_events(warp_resp.events); + assert_eq!( + events["wasm-hpl_warp_cw20::instantiate"]["denom"], + mock_token + ); + + // move cw20 token's minter to warp route contract + wasm.execute( + &mock_token, + &cw20::Cw20ExecuteMsg::UpdateMinter { + new_minter: Some(warp_resp.data.address), + }, + &[], + &osmo.acc_owner, + )?; + + // ready to mint / burn! + + Ok(()) +} + +#[rstest] +#[tokio::test] +async fn test_cw20_bridged() -> eyre::Result<()> { + let osmo_app = OsmosisTestApp::new(); + let osmo = cw::setup_env( + &osmo_app, + |app, coins| app.init_account(coins).unwrap(), + None::<&str>, + "osmo", + DOMAIN_OSMO, + &[TestValidators::new(DOMAIN_EVM, 5, 3)], + &[RemoteGasDataConfig { + remote_domain: DOMAIN_EVM, + token_exchange_rate: Uint128::from(10u128.pow(4)), + gas_price: Uint128::from(10u128.pow(9)), + }], + )?; + + let wasm = Wasm::new(&osmo_app); + + let warp_resp = cw::deploy_warp_route_bridged( + &wasm, + &osmo.acc_owner, + &osmo.acc_deployer, + &osmo.core.mailbox, + "osmo", + &osmo.codes, + "denomdenom".into(), + warp::TokenType::CW20 { + contract: "".into(), + }, + ); + + let events = wasm_events(warp_resp.events); + assert_eq!( + events["wasm-hpl_warp_cw20::instantiate"]["denom"], + "denomdenom" + ); + + let token_addr_from_evt = &events["wasm-hpl_warp_cw20::reply-init"]["new_token"]; + let token_info: cw20::TokenInfoResponse = + wasm.query(token_addr_from_evt, &cw20::Cw20QueryMsg::TokenInfo {})?; + assert_eq!(token_info.name, "denomdenom"); + + let minter_info: Option = + wasm.query(token_addr_from_evt, &cw20::Cw20QueryMsg::Minter {})?; + assert_eq!(minter_info.unwrap().minter, warp_resp.data.address); + + Ok(()) +} + +#[rstest] +#[case("utest")] +#[tokio::test] +async fn test_native_collateral(#[case] denom: &str) -> eyre::Result<()> { + let osmo_app = OsmosisTestApp::new(); + let osmo = cw::setup_env( + &osmo_app, + |app, coins| app.init_account(coins).unwrap(), + None::<&str>, + "osmo", + DOMAIN_OSMO, + &[TestValidators::new(DOMAIN_EVM, 5, 3)], + &[RemoteGasDataConfig { + remote_domain: DOMAIN_EVM, + token_exchange_rate: Uint128::from(10u128.pow(4)), + gas_price: Uint128::from(10u128.pow(9)), + }], + )?; + + let wasm = Wasm::new(&osmo_app); + let tf = TokenFactory::new(&osmo_app); + + let mock_token = tf + .create_denom( + MsgCreateDenom { + sender: osmo.acc_deployer.address(), + subdenom: denom.to_string(), + }, + &osmo.acc_deployer, + )? + .data + .new_token_denom; + + let warp_resp = cw::deploy_warp_route_collateral( + &wasm, + &osmo.acc_owner, + &osmo.acc_deployer, + &osmo.core.mailbox, + "osmo", + &osmo.codes, + mock_token.clone(), + ); + + let events = wasm_events(warp_resp.events); + assert_eq!( + events["wasm-hpl_warp_native::instantiate"]["denom"], + mock_token + ); + + let resp = tf.query_denom_authority_metadata( + &tokenfactory::v1beta1::QueryDenomAuthorityMetadataRequest { + denom: mock_token.clone(), + }, + )?; + assert_eq!( + resp.authority_metadata.unwrap().admin, + osmo.acc_deployer.address() + ); + + tf.change_admin( + MsgChangeAdmin { + sender: osmo.acc_deployer.address(), + denom: mock_token, + new_admin: warp_resp.data.address, + }, + &osmo.acc_deployer, + )?; + + // ready to test! + + Ok(()) +} + +#[rstest] +#[case("utest")] +#[tokio::test] +async fn test_native_bridged(#[case] denom: &str) -> eyre::Result<()> { + let osmo_app = OsmosisTestApp::new(); + let osmo = cw::setup_env( + &osmo_app, + |app, coins| app.init_account(coins).unwrap(), + None::<&str>, + "osmo", + DOMAIN_OSMO, + &[TestValidators::new(DOMAIN_EVM, 5, 3)], + &[RemoteGasDataConfig { + remote_domain: DOMAIN_EVM, + token_exchange_rate: Uint128::from(10u128.pow(4)), + gas_price: Uint128::from(10u128.pow(9)), + }], + )?; + + let wasm = Wasm::new(&osmo_app); + let tf = TokenFactory::new(&osmo_app); + + let warp_resp = cw::deploy_warp_route_bridged( + &wasm, + &osmo.acc_owner, + &osmo.acc_deployer, + &osmo.core.mailbox, + "osmo", + &osmo.codes, + denom.into(), + warp::TokenType::Native(warp::TokenTypeNative::Fungible { denom: "".into() }), + ); + + let events = wasm_events(warp_resp.events); + assert_eq!(events["wasm-hpl_warp_native::instantiate"]["denom"], denom); + + let new_denom = &events["wasm-hpl_warp_native::reply-init"]["denom"]; + assert_eq!( + new_denom.clone(), + format!("factory/{}/{denom}", warp_resp.data.address) + ); + + let resp = tf.query_denom_authority_metadata( + &tokenfactory::v1beta1::QueryDenomAuthorityMetadataRequest { + denom: new_denom.clone(), + }, + )?; + assert_eq!( + resp.authority_metadata.unwrap().admin, + warp_resp.data.address + ); + + Ok(()) +} diff --git a/packages/interface/src/core/mailbox.rs b/packages/interface/src/core/mailbox.rs index da5c1b77..9732ac4c 100644 --- a/packages/interface/src/core/mailbox.rs +++ b/packages/interface/src/core/mailbox.rs @@ -1,6 +1,7 @@ use cosmwasm_schema::{cw_serde, QueryResponses}; use cosmwasm_std::{wasm_execute, Addr, Api, CosmosMsg, HexBinary, StdResult}; +#[allow(unused_imports)] use crate::{ hook::QuoteDispatchResponse, ownable::{OwnableMsg, OwnableQueryMsg}, diff --git a/packages/interface/src/core/mod.rs b/packages/interface/src/core/mod.rs index 2aaf00f4..7dee669b 100644 --- a/packages/interface/src/core/mod.rs +++ b/packages/interface/src/core/mod.rs @@ -5,6 +5,7 @@ pub mod mailbox; pub mod va; #[cw_serde] +#[derive(Default)] pub struct HandleMsg { pub origin: u32, pub sender: HexBinary, diff --git a/packages/interface/src/core/va.rs b/packages/interface/src/core/va.rs index 7bf018ae..8e8c6463 100644 --- a/packages/interface/src/core/va.rs +++ b/packages/interface/src/core/va.rs @@ -35,3 +35,5 @@ pub struct GetAnnounceStorageLocationsResponse { pub struct GetAnnouncedValidatorsResponse { pub validators: Vec, } + + diff --git a/packages/interface/src/hook/aggregate.rs b/packages/interface/src/hook/aggregate.rs new file mode 100644 index 00000000..0036cb46 --- /dev/null +++ b/packages/interface/src/hook/aggregate.rs @@ -0,0 +1,72 @@ +use cosmwasm_schema::{cw_serde, QueryResponses}; + +use crate::ownable::{OwnableMsg, OwnableQueryMsg}; + +use super::{HookQueryMsg, PostDispatchMsg}; + +pub const TREE_DEPTH: usize = 32; + +#[cw_serde] +pub struct InstantiateMsg { + pub owner: String, + pub hooks: Vec, +} + +#[cw_serde] +pub enum ExecuteMsg { + Ownable(OwnableMsg), + PostDispatch(PostDispatchMsg), + SetHooks { hooks: Vec }, +} + +#[cw_serde] +#[derive(QueryResponses)] +#[query_responses(nested)] +pub enum QueryMsg { + Ownable(OwnableQueryMsg), + Hook(HookQueryMsg), + AggregateHook(AggregateHookQueryMsg), +} + +#[cw_serde] +#[derive(QueryResponses)] +pub enum AggregateHookQueryMsg { + #[returns(HooksResponse)] + Hooks {}, +} + +#[cw_serde] +pub struct HooksResponse { + pub hooks: Vec, +} + +#[cfg(test)] +mod test { + use cosmwasm_std::HexBinary; + + use super::*; + use crate::{ + hook::{ExpectedHookQueryMsg, PostDispatchMsg, QuoteDispatchMsg}, + msg_checker, + }; + + #[test] + fn test_hook_interface() { + let _checked: ExecuteMsg = msg_checker( + PostDispatchMsg { + metadata: HexBinary::default(), + message: HexBinary::default(), + } + .wrap(), + ); + + let _checked: QueryMsg = msg_checker(ExpectedHookQueryMsg::Hook(HookQueryMsg::Mailbox {})); + let _checked: QueryMsg = msg_checker( + QuoteDispatchMsg { + metadata: HexBinary::default(), + message: HexBinary::default(), + } + .request(), + ); + } +} diff --git a/packages/interface/src/hook/mod.rs b/packages/interface/src/hook/mod.rs index ec1580d4..9d2a036d 100644 --- a/packages/interface/src/hook/mod.rs +++ b/packages/interface/src/hook/mod.rs @@ -1,3 +1,4 @@ +pub mod aggregate; pub mod merkle; pub mod pausable; pub mod routing; diff --git a/packages/interface/src/igp/core.rs b/packages/interface/src/igp/core.rs index 66cdd48b..01e488f4 100644 --- a/packages/interface/src/igp/core.rs +++ b/packages/interface/src/igp/core.rs @@ -13,7 +13,6 @@ use super::oracle::IgpGasOracleQueryMsg; pub struct InstantiateMsg { pub hrp: String, pub owner: String, - pub mailbox: String, pub gas_token: String, pub beneficiary: String, } diff --git a/packages/interface/src/ism/aggregate.rs b/packages/interface/src/ism/aggregate.rs new file mode 100644 index 00000000..a0262a22 --- /dev/null +++ b/packages/interface/src/ism/aggregate.rs @@ -0,0 +1,54 @@ +use cosmwasm_schema::{cw_serde, QueryResponses}; + +use crate::ownable::{OwnableMsg, OwnableQueryMsg}; + +use super::IsmQueryMsg; + +#[cw_serde] +pub struct InstantiateMsg { + pub owner: String, + pub isms: Vec, + pub threshold: u8, +} + +#[cw_serde] +pub enum ExecuteMsg { + Ownable(OwnableMsg), + + SetIsms { isms: Vec }, +} + +#[cw_serde] +#[derive(QueryResponses)] +#[query_responses(nested)] +pub enum QueryMsg { + Ownable(OwnableQueryMsg), + + Ism(IsmQueryMsg), +} + +#[cfg(test)] +mod test { + use cosmwasm_std::HexBinary; + + use super::*; + use crate::{ism::IsmQueryMsg, msg_checker}; + + #[test] + fn test_ism_interface() { + let _checked: QueryMsg = msg_checker(IsmQueryMsg::ModuleType {}.wrap()); + let _checked: QueryMsg = msg_checker( + IsmQueryMsg::Verify { + metadata: HexBinary::default(), + message: HexBinary::default(), + } + .wrap(), + ); + let _checked: QueryMsg = msg_checker( + IsmQueryMsg::VerifyInfo { + message: HexBinary::default(), + } + .wrap(), + ); + } +} diff --git a/packages/interface/src/ism/mod.rs b/packages/interface/src/ism/mod.rs index 75fa3a8a..18d10299 100644 --- a/packages/interface/src/ism/mod.rs +++ b/packages/interface/src/ism/mod.rs @@ -1,3 +1,4 @@ +pub mod aggregate; pub mod multisig; pub mod routing; diff --git a/packages/interface/src/types/metadata.rs b/packages/interface/src/types/metadata.rs index eb93c7ad..15b56ab1 100644 --- a/packages/interface/src/types/metadata.rs +++ b/packages/interface/src/types/metadata.rs @@ -115,23 +115,61 @@ impl From for MessageIdMultisigIsmMetadata { } } +impl MessageIdMultisigIsmMetadata { + pub fn merkle_index(&self) -> u32 { + u32::from_be_bytes(self.merkle_index.to_vec().try_into().unwrap()) + } +} + +use std::convert::AsMut; + +fn clone_into_array(slice: &[T]) -> A +where + A: Sized + Default + AsMut<[T]>, + T: Clone, +{ + let mut a = Default::default(); + >::as_mut(&mut a).clone_from_slice(slice); + a +} + #[cw_serde] -pub struct AggregateIsmMetadata(pub BTreeMap); +pub struct AggregateMetadata(BTreeMap); + +impl AggregateMetadata { + pub const RANGE_SIZE: usize = 4; -impl AggregateIsmMetadata { - const RANGE_SIZE: usize = 4; + pub fn new(set: Vec<(Addr, HexBinary)>) -> Self { + Self(set.into_iter().collect()) + } +} - pub fn from_hex(v: HexBinary, isms: Vec) -> Self { +impl Iterator for AggregateMetadata { + type Item = (Addr, HexBinary); + + fn next(&mut self) -> Option { + self.0.pop_first() + } +} + +impl AggregateMetadata { + pub fn from_hex(v: HexBinary, addrs: Vec) -> Self { Self( - isms.into_iter() + addrs + .into_iter() .enumerate() .map(|(i, ism)| { let start = i * Self::RANGE_SIZE * 2; let mid = start + Self::RANGE_SIZE; let end = mid + Self::RANGE_SIZE; - let meta_start = usize::from_be_bytes(v[start..mid].try_into().unwrap()); - let meta_end = usize::from_be_bytes(v[mid..end].try_into().unwrap()); + let mut meta_start = [0u8; 4]; + meta_start.copy_from_slice(&v[start..mid]); + let mut meta_end = [0u8; 4]; + meta_end.copy_from_slice(&v[mid..end]); + + let meta_start = u32::from_be_bytes(meta_start) as usize; + let meta_end = u32::from_be_bytes(meta_end) as usize; (ism, v[meta_start..meta_end].to_vec().into()) }) @@ -140,13 +178,44 @@ impl AggregateIsmMetadata { } } -// impl From for HexBinary { -// fn from(v: AggregateIsmMetadata) -> Self { -// v.0.into_iter().fold(vec![], |acc, (ism, metaedata)| { +impl From for HexBinary { + fn from(v: AggregateMetadata) -> Self { + let pos_start = v.0.len() * AggregateMetadata::RANGE_SIZE * 2; + + let ls: Vec<( + [u8; AggregateMetadata::RANGE_SIZE], + [u8; AggregateMetadata::RANGE_SIZE], + HexBinary, + )> = + v.0.values() + .fold(vec![] as Vec<(usize, usize, HexBinary)>, |mut acc, m| { + let l = acc.last().map(|v| v.1).unwrap_or(pos_start); + + acc.push((l, l + m.len(), m.clone())); + acc + }) + .into_iter() + .map(|(start, end, metadata)| { + ( + clone_into_array(&start.to_be_bytes()[AggregateMetadata::RANGE_SIZE..]), + clone_into_array(&end.to_be_bytes()[AggregateMetadata::RANGE_SIZE..]), + metadata, + ) + }) + .collect(); -// }) -// } -// } + let mut pos = vec![]; + let mut metadata = vec![]; + + for (start, end, meta) in ls { + pos.extend_from_slice(&start); + pos.extend_from_slice(&end); + metadata.extend_from_slice(meta.as_slice()); + } + + [pos, metadata].concat().into() + } +} #[cw_serde] pub struct IGPMetadata { @@ -198,10 +267,27 @@ impl IGPMetadata { #[cfg(test)] mod test { - use ibcx_test_utils::hex; + use ibcx_test_utils::{addr, gen_bz, hex}; use super::*; + #[test] + fn test_aggregate() { + let set = vec![ + (addr("test1"), gen_bz(12)), + (addr("test2"), gen_bz(12)), + (addr("test3"), gen_bz(12)), + ]; + + let metadata = AggregateMetadata::new(set); + let isms = metadata.0.clone().into_keys().collect(); + + let metadata_bz: HexBinary = metadata.clone().into(); + + let new_metadata = AggregateMetadata::from_hex(metadata_bz, isms); + assert_eq!(metadata, new_metadata); + } + #[test] fn test_message_id_multisig_metadata() { let testdata = hex("fadafdf4db5e6264d450bafa5951b2180b8fe8aac2e012f280784ae841e9a7f732a2601709a27a5e370a59f98a67b5da6baa522b6421edf2ea240d94d84511a800000000df4eaf1947af0858139b90054561d5ab2a423b4ad8d75a5ec7f9e860fd3de1bb3924e2593e29b595aae2717538c0af6d6ae9fc20477da49d223a0d928a1efb311bdf4eaf1947af0858139b90054561d5ab2a423b4ad8d75a5ec7f9e860fd3de1bb3924e2593e29b595aae2717538c0af6d6ae9fc20477da49d223a0d928a1efb311b"); diff --git a/packages/interface/src/warp/cw20.rs b/packages/interface/src/warp/cw20.rs index 6b20cf87..fbdc4794 100644 --- a/packages/interface/src/warp/cw20.rs +++ b/packages/interface/src/warp/cw20.rs @@ -3,7 +3,7 @@ use cosmwasm_std::HexBinary; use crate::{ core, - ownable::OwnableQueryMsg, + ownable::{OwnableMsg, OwnableQueryMsg}, router::{self, RouterQuery}, }; @@ -53,6 +53,7 @@ pub enum ReceiveMsg { #[cw_serde] pub enum ExecuteMsg { + Ownable(OwnableMsg), Router(router::RouterMsg), /// handle transfer remote diff --git a/packages/interface/src/warp/native.rs b/packages/interface/src/warp/native.rs index a880be38..35a91079 100644 --- a/packages/interface/src/warp/native.rs +++ b/packages/interface/src/warp/native.rs @@ -3,7 +3,7 @@ use cosmwasm_std::HexBinary; use crate::{ core, - ownable::OwnableQueryMsg, + ownable::{OwnableMsg, OwnableQueryMsg}, router::{RouterMsg, RouterQuery}, }; @@ -52,6 +52,7 @@ pub struct InstantiateMsg { #[cw_serde] pub enum ExecuteMsg { + Ownable(OwnableMsg), Router(RouterMsg), // handle transfer remote diff --git a/packages/schema/src/main.rs b/packages/schema/src/main.rs index e6e929b1..15a6338e 100644 --- a/packages/schema/src/main.rs +++ b/packages/schema/src/main.rs @@ -4,169 +4,44 @@ use std::{ }; use cosmwasm_schema::generate_api; -use cosmwasm_std::Empty; use hpl_interface::{ core as hpl_core, hook as hpl_hook, igp as hpl_igp, ism as hpl_ism, warp as hpl_warp, }; -pub fn main() { - let mut apis = vec![]; - - { - use hpl_core::mailbox::*; - - apis.push(generate_api! { - name: "hpl_mailbox", - instantiate: InstantiateMsg, - migrate: Empty, - execute: ExecuteMsg, - query: QueryMsg, - }); - } - - { - use hpl_core::va::*; - - apis.push(generate_api! { - name: "hpl_validator_announce", - instantiate: InstantiateMsg, - migrate: Empty, - execute: ExecuteMsg, - query: QueryMsg, - }); - } - - { - use hpl_hook::merkle::*; - - apis.push(generate_api! { - name: "hpl_hook_merkle", - instantiate: InstantiateMsg, - migrate: Empty, - execute: ExecuteMsg, - query: QueryMsg, - }); - } - - { - use hpl_hook::pausable::*; - - apis.push(generate_api! { - name: "hpl_hook_pausable", - instantiate: InstantiateMsg, - migrate: Empty, - execute: ExecuteMsg, - query: QueryMsg, - }); - } - - { - use hpl_hook::routing::*; - - apis.push(generate_api! { - name: "hpl_hook_routing", - instantiate: InstantiateMsg, - migrate: Empty, - execute: ExecuteMsg, - query: QueryMsg, - }); - } - - { - use hpl_hook::routing_custom::*; - - apis.push(generate_api! { - name: "hpl_hook_routing_custom", - instantiate: InstantiateMsg, - migrate: Empty, - execute: ExecuteMsg, - query: QueryMsg, - }); - } - - { - use hpl_hook::routing_fallback::*; - - apis.push(generate_api! { - name: "hpl_hook_routing_fallback", - instantiate: InstantiateMsg, - migrate: Empty, - execute: ExecuteMsg, - query: QueryMsg, - }); - } - - { - use hpl_igp::core::*; - - apis.push(generate_api! { - name: "hpl_igp", - instantiate: InstantiateMsg, - migrate: Empty, - execute: ExecuteMsg, - query: QueryMsg, - }); - } - - { - use hpl_igp::oracle::*; - - apis.push(generate_api! { - name: "hpl_igp_oracle", - instantiate: InstantiateMsg, - migrate: Empty, - execute: ExecuteMsg, - query: QueryMsg, - }); - } - - { - use hpl_ism::multisig::*; - - apis.push(generate_api! { - name: "hpl_ism_multisig", - instantiate: InstantiateMsg, - migrate: Empty, - execute: ExecuteMsg, - query: QueryMsg, - }); - } - - { - use hpl_ism::routing::*; - - apis.push(generate_api! { - name: "hpl_ism_routing", - instantiate: InstantiateMsg, - migrate: Empty, - execute: ExecuteMsg, - query: QueryMsg, - }); - } - - { - use hpl_warp::cw20::*; - - apis.push(generate_api! { - name: "hpl_warp_cw20", - instantiate: InstantiateMsg, - migrate: Empty, - execute: ExecuteMsg, - query: QueryMsg, - }); - } - - { - use hpl_warp::native::*; +macro_rules! fetch_api { + ($module:ty, $name:tt) => { + generate_api! { + name: $name, + instantiate: $module::InstantiateMsg, + execute: $module::ExecuteMsg, + query: $module::QueryMsg, + } + }; +} - apis.push(generate_api! { - name: "hpl_warp_native", - instantiate: InstantiateMsg, - migrate: Empty, - execute: ExecuteMsg, - query: QueryMsg, - }); - } +pub fn main() { + let apis = vec![ + // core + fetch_api!(hpl_core::mailbox, "mailbox"), + fetch_api!(hpl_core::va, "validator_announce"), + // hooks + fetch_api!(hpl_hook::aggregate, "hook_aggregate"), + fetch_api!(hpl_hook::merkle, "hook_merkle"), + fetch_api!(hpl_hook::pausable, "hook_pausable"), + fetch_api!(hpl_hook::routing, "hook_routing"), + fetch_api!(hpl_hook::routing_custom, "hook_routing_custom"), + fetch_api!(hpl_hook::routing_fallback, "hook_routing_fallback"), + // igps + fetch_api!(hpl_igp::core, "igp"), + fetch_api!(hpl_igp::oracle, "igp_oracle"), + // isms + fetch_api!(hpl_ism::aggregate, "ism_aggregate"), + fetch_api!(hpl_ism::multisig, "ism_multisig"), + fetch_api!(hpl_ism::routing, "ism_routing"), + // warps + fetch_api!(hpl_warp::cw20, "warp_cw20"), + fetch_api!(hpl_warp::native, "warp_native"), + ]; let mut base = current_dir().unwrap(); base.push("schema"); @@ -178,6 +53,7 @@ pub fn main() { let filename = api.contract_name.clone(); let api_str = api.render().to_string().unwrap(); - write(base.join(format!("{filename}.json")), api_str).unwrap(); + create_dir_all(base.join(&filename)).unwrap(); + write(base.join(format!("{filename}/{filename}.json")), api_str).unwrap(); } } diff --git a/scripts/.env.example b/scripts/.env.example deleted file mode 100644 index c2c3b2df..00000000 --- a/scripts/.env.example +++ /dev/null @@ -1,2 +0,0 @@ -SIGNING_ADDRESS="" -SIGNING_MNEMONIC="" diff --git a/scripts/.gitignore b/scripts/.gitignore index c9358322..70264f89 100644 --- a/scripts/.gitignore +++ b/scripts/.gitignore @@ -1,4 +1,5 @@ /dist /context .env +config.yaml /node_modules diff --git a/scripts/deploy.ts b/scripts/action/deploy.ts similarity index 85% rename from scripts/deploy.ts rename to scripts/action/deploy.ts index 584dc5ee..1d845432 100644 --- a/scripts/deploy.ts +++ b/scripts/action/deploy.ts @@ -1,21 +1,18 @@ -import { - ExecuteResult, - SigningCosmWasmClient, -} from "@cosmjs/cosmwasm-stargate"; +import { SigningCosmWasmClient } from "@cosmjs/cosmwasm-stargate"; import { DirectSecp256k1HdWallet } from "@cosmjs/proto-signing"; import { GasPrice } from "@cosmjs/stargate"; -import { loadContext } from "./src/load_context"; -import HplMailbox from "./src/contracts/hpl_mailbox"; -import { BaseContract, Context } from "./src/types"; -import HplHookMerkle from "./src/contracts/hpl_hook_merkle"; -import HplTestMockHook from "./src/contracts/hpl_test_mock_hook"; -import HplIgpGasOracle from "./src/contracts/hpl_igp_oracle"; -import HplIgp from "./src/contracts/hpl_igp"; -import HplIsmMultisig from "./src/contracts/hpl_ism_multisig"; +import { loadContext } from "../src/load_context"; +import HplMailbox from "../src/contracts/hpl_mailbox"; +import { Context } from "../src/types"; +import HplHookMerkle from "../src/contracts/hpl_hook_merkle"; +import HplTestMockHook from "../src/contracts/hpl_test_mock_hook"; +import HplIgpGasOracle from "../src/contracts/hpl_igp_oracle"; +import HplIgp from "../src/contracts/hpl_igp"; +import HplIsmMultisig from "../src/contracts/hpl_ism_multisig"; import { writeFileSync } from "fs"; -import HplValidatorAnnounce from "./src/contracts/hpl_validator_announce"; -import HplTestMockMsgReceiver from "./src/contracts/hpl_test_mock_msg_receiver"; +import HplValidatorAnnounce from "../src/contracts/hpl_validator_announce"; +import HplTestMockMsgReceiver from "../src/contracts/hpl_test_mock_msg_receiver"; const NETWORK_ID = process.env.NETWORK_ID || "osmo-test-5"; const NETWORK_HRP = process.env.NETWORK_HRP || "osmo"; @@ -115,7 +112,9 @@ async function main() { ); // init igp oracle - ctx.contracts[igp_oracle.contractName] = await igp_oracle.instantiate({}); + ctx.contracts[igp_oracle.contractName] = await igp_oracle.instantiate({ + owner: ctx.address!, + }); // init igp ctx.contracts[igp.contractName] = await igp.instantiate({ diff --git a/scripts/action/fetch.ts b/scripts/action/fetch.ts new file mode 100644 index 00000000..f6d4ef72 --- /dev/null +++ b/scripts/action/fetch.ts @@ -0,0 +1,25 @@ +import { SigningCosmWasmClient } from "@cosmjs/cosmwasm-stargate"; +import { Context } from "../src/types"; +import { Client } from "../src/config"; + +type Const = new ( + address: string | undefined, + codeId: number | undefined, + digest: string, + signer: string, + client: SigningCosmWasmClient +) => T; + +export class ContractFetcher { + constructor(private ctx: Context, private client: Client) {} + + public get(f: Const, name: string): T { + return new f( + this.ctx.contracts[name].address, + this.ctx.contracts[name].codeId, + this.ctx.contracts[name].digest, + this.client.signer, + this.client.wasm + ); + } +} diff --git a/scripts/action/link.ts b/scripts/action/link.ts new file mode 100644 index 00000000..bf6acda4 --- /dev/null +++ b/scripts/action/link.ts @@ -0,0 +1,46 @@ +import { loadContext } from "../src/load_context"; +import { config, getSigningClient } from "../src/config"; + +import HplWarpNative from "../src/contracts/hpl_warp_native"; +import HplIsmMultisig from "../src/contracts/hpl_ism_multisig"; +import { ContractFetcher } from "./fetch"; +import { addPad } from "../src/conv"; + +async function main() { + const client = await getSigningClient(config); + + const ctx = loadContext(config.network.id); + + const fetcher = new ContractFetcher(ctx, client); + + const ism_multisig = fetcher.get(HplIsmMultisig, "hpl_ism_multisig"); + + let res; + + res = await ism_multisig.execute({ + enroll_validator: { + set: { + domain: 5, + validator: client.signer, + validator_pubkey: client.signer_pubkey, + }, + }, + }); + console.log(res.events.filter((v) => v.type.startsWith("wasm"))); + + const warp_native_ibc = fetcher.get(HplWarpNative, "hpl_warp_native_ibc"); + + res = await warp_native_ibc.execute({ + router: { + set_route: { + set: { + domain: 5, + route: addPad("0xaB7011fa44868E023C869635eE33875629Aec8db"), + }, + }, + }, + }); + console.log(res.events.filter((v) => v.type.startsWith("wasm"))); +} + +main().catch(console.error); diff --git a/scripts/action/mailbox.ts b/scripts/action/mailbox.ts new file mode 100644 index 00000000..afdbc005 --- /dev/null +++ b/scripts/action/mailbox.ts @@ -0,0 +1,82 @@ +import { Command } from "commander"; + +import { version } from "../package.json"; +import { config, getSigningClient } from "../src/config"; +import HplMailbox from "../src/contracts/hpl_mailbox"; +import { addPad } from "../src/conv"; +import { loadContext } from "../src/load_context"; +import { ContractFetcher } from "./fetch"; +import { ExecuteResult } from "@cosmjs/cosmwasm-stargate"; + +const program = new Command(); + +program.name("Mailbox CLI").version(version); + +program + .command("dispatch") + .argument("", 'destination domain, e.g. "5"') + .argument("", "recipient address in hex") + .argument("", "message body in utf-8") + .action(makeHandler("dispatch")); + +program + .command("process") + .argument("", "metadata in hex") + .argument("", "message body in hex") + .action(makeHandler("process")); + +program.parseAsync(process.argv).catch(console.error); + +const parseWasmEventLog = (res: ExecuteResult) => { + return res.events + .filter((v) => v.type.startsWith("wasm")) + .map((v) => ({ + "@type": v.type.slice(5), + ...Object.fromEntries(v.attributes.map((x) => [x.key, x.value])), + })); +}; + +function makeHandler( + action: "dispatch" | "process" +): (...args: any[]) => void | Promise { + const ctx = loadContext(config.network.id); + + const loadDeps = async () => { + const client = await getSigningClient(config); + const fetcher = new ContractFetcher(ctx, client); + const mailbox = fetcher.get(HplMailbox, "hpl_mailbox"); + return { mailbox }; + }; + + switch (action) { + case "dispatch": + return async ( + dest_domain: string, + recipient_addr: string, + msg_body: string + ) => { + const { mailbox } = await loadDeps(); + + const res = await mailbox.execute({ + dispatch: { + dest_domain: Number(dest_domain), + recipient_addr: addPad(recipient_addr), + msg_body: Buffer.from(msg_body, "utf-8").toString("hex"), + }, + }); + console.log(parseWasmEventLog(res)); + }; + case "process": + return async (metadata: string, msg_body: string) => { + const { mailbox } = await loadDeps(); + + const res = await mailbox.execute({ + process: { + metadata, + msg_body, + }, + }); + console.log(parseWasmEventLog(res)); + }; + } +} diff --git a/scripts/action/multisig.ts b/scripts/action/multisig.ts new file mode 100644 index 00000000..f53ae1b7 --- /dev/null +++ b/scripts/action/multisig.ts @@ -0,0 +1,175 @@ +import { Command } from "commander"; + +import { version } from "../package.json"; +import { loadContext } from "../src/load_context"; +import { config } from "../src/config"; +import { fromBech32 } from "@cosmjs/encoding"; +import { Secp256k1, keccak256 } from "@cosmjs/crypto"; +import { readFileSync, writeFileSync } from "fs"; +import { DirectSecp256k1Wallet } from "@cosmjs/proto-signing"; + +type CheckpointInfo = { + origin_domain: number; + origin_merkle_tree: string; + merkle_root: string; + merkle_index: number; +}; + +const toHex = (v: Uint8Array): string => { + return Buffer.from(v).toString("hex"); +}; + +const fromHex = (v: string): Uint8Array => { + return Buffer.from(v, "hex"); +}; + +const u8 = (v: string): Uint8Array => { + return fromHex(Number(v).toString(16).padStart(8, "0")); +}; + +const program = new Command(); +const common = { output: `${process.cwd()}/signature.json` }; + +program.name("Multisig CLI").version(version); + +program + .command("sign") + .argument("", 'origin domain, e.g. "5"') + .argument("", "merkle root in hex") + .argument("", "merkle index") + .argument("", "message id in hex") + .option("-o, --output ", "output file", common.output) + .option("-p --prefix ", "bech32 prefix", "dual") + .requiredOption("-k --key ", "private key") + .action(sign); + +program + .command("join") + .argument("", "signature files (comma separated)") + .option("-o, --output ", "output file", common.output) + .option("-p --prefix ", "bech32 prefix", "dual") + .action(join); + +program.parseAsync(process.argv).catch(console.error); + +async function sign( + origin_domain_str: string, + merkle_root: string, + merkle_index_str: string, + message_id: string, + options: { output: string; prefix: string; key: string } +) { + const ctx = loadContext(config.network.id); + const origin_domain = u8(origin_domain_str); + const merkle_index = u8(merkle_index_str); + + const origin_merkle_str = ctx.contracts.hpl_hook_merkle.address!; + const origin_merkle = Buffer.from(fromBech32(origin_merkle_str).data); + + const domain_hash = keccak256( + Buffer.concat([ + origin_domain, + origin_merkle, + Buffer.from("HYPERLANE", "utf-8"), + ]) + ); + + const multisig_hash = keccak256( + Buffer.concat([ + domain_hash, + fromHex(merkle_root), + merkle_index, + fromHex(message_id), + ]) + ); + + const verify_digest = keccak256( + Buffer.concat([ + Buffer.from(`\x19Ethereum Signed Message:\n${multisig_hash.length}`), + multisig_hash, + ]) + ); + + const keypair = await Secp256k1.makeKeypair(fromHex(options.key)); + const key = await DirectSecp256k1Wallet.fromKey( + keypair.privkey, + options.prefix + ); + + const [{ address }] = await key.getAccounts(); + + const signature = await Secp256k1.createSignature( + verify_digest, + keypair.privkey + ); + + type Output = { + address: string; + signature: string; + } & CheckpointInfo; + + const output: Output = { + origin_domain: Number(origin_domain_str), + origin_merkle_tree: origin_merkle.toString("hex"), + merkle_root, + merkle_index: Number(merkle_index_str), + address: address, + signature: toHex(signature.toFixedLength()), + }; + + writeFileSync(options.output, JSON.stringify(output, null, 2)); +} + +async function join( + signature_paths: string[], + options: { output: string; prefix: string } +) { + const ctx = loadContext(config.network.id); + + const origin_merkle_str = ctx.contracts.hpl_hook_merkle.address!; + const origin_merkle = Buffer.from(fromBech32(origin_merkle_str).data); + + type Output = { + address: string; + signature: string; + } & CheckpointInfo; + + type Joined = { + signatures: Record; + } & CheckpointInfo; + + let joined: Joined | null = null; + + for (const path of signature_paths) { + const output: Output = JSON.parse(readFileSync(path, "utf-8")); + + if (joined) { + joined.signatures[output.address!] = output.signature!; + continue; + } + + joined = { + origin_domain: output.origin_domain, + origin_merkle_tree: output.origin_merkle_tree, + merkle_root: output.merkle_root, + merkle_index: output.merkle_index, + signatures: { + [output.address]: output.signature, + }, + }; + } + + if (!joined) { + console.error("no signature given"); + return; + } + + const metadata = Buffer.concat([ + fromHex(joined.origin_merkle_tree), + fromHex(joined.merkle_root), + u8(joined.merkle_index.toString()), + Buffer.concat(Object.values(joined.signatures).map((v) => fromHex(v))), + ]); + + console.log(metadata.toString("hex")); +} diff --git a/scripts/action/warp.ts b/scripts/action/warp.ts new file mode 100644 index 00000000..4ed62aff --- /dev/null +++ b/scripts/action/warp.ts @@ -0,0 +1,35 @@ +import { loadContext } from "../src/load_context"; +import HplMailbox from "../src/contracts/hpl_mailbox"; +import HplWarpNative from "../src/contracts/hpl_warp_native"; +import { config, getSigningClient } from "../src/config"; +import { ContractFetcher } from "./fetch"; + +async function main() { + const client = await getSigningClient(config); + + const ctx = loadContext(config.network.id); + + const fetcher = new ContractFetcher(ctx, client); + + const mailbox = fetcher.get(HplMailbox, "hpl_mailbox"); + + const warp_native = fetcher.get(HplWarpNative, "hpl_warp_native"); + + const target_denom = + "ibc/B5CB286F69D48B2C4F6F8D8CF59011C40590DCF8A91617A5FBA9FF0A7B21307F"; + + const ibc_route = await warp_native.instantiate({ + token: { + collateral: { + denom: target_denom, + }, + }, + hrp: "dual", + owner: client.signer, + mailbox: mailbox.address!, + }); + + console.log("ibc_route", ibc_route); +} + +main().catch(console.error); diff --git a/scripts/config.example.yaml b/scripts/config.example.yaml new file mode 100644 index 00000000..b4a213c6 --- /dev/null +++ b/scripts/config.example.yaml @@ -0,0 +1,8 @@ +network: + id: "localosmosis" + hrp: "osmo" + url: "http://localhost:26657" + gas: "0.025uosmo" + domain: "2303" + +signer: deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef diff --git a/scripts/fill.ts b/scripts/fill.ts index 9f165773..e8232353 100644 --- a/scripts/fill.ts +++ b/scripts/fill.ts @@ -10,6 +10,7 @@ import { ARTIFACTS } from "./artifacts"; async function getSigningClient(): Promise<{ client: SigningCosmWasmClient; address: string; + pubkey: string; }> { const mnemonic = process.env["SIGNING_MNEMONIC"] as string; const wallet = await DirectSecp256k1HdWallet.fromMnemonic(mnemonic, { @@ -24,11 +25,14 @@ async function getSigningClient(): Promise<{ gasPrice: GasPrice.fromString("0.025uosmo"), } ); - return { client, address }; + + const pubkey = process.env["SIGNING_PUBKEY"] as string; + + return { client, address, pubkey }; } async function main() { - const { client, address: owner } = await getSigningClient(); + const { client, address: owner, pubkey } = await getSigningClient(); const { hpl_hub: { address: hpl_hub }, @@ -43,6 +47,8 @@ async function main() { let execRes: ExecuteResult; + // =========================== hpl_routing + // =========================== hpl_hub { const originDomain = await client.queryContractSmart(hpl_hub, { diff --git a/scripts/package.json b/scripts/package.json index aac1f75a..8b6796ec 100644 --- a/scripts/package.json +++ b/scripts/package.json @@ -18,15 +18,19 @@ "@cosmjs/encoding": "^0.31.0", "@cosmjs/proto-signing": "^0.31.0", "@cosmjs/stargate": "^0.31.0", + "@cosmjs/tendermint-rpc": "0.31.0", "axios": "^1.4.0", "colors": "^1.4.0", + "commander": "^11.1.0", "inversify": "^6.0.1", "readline": "^1.3.0", "reflect-metadata": "^0.1.13" }, "devDependencies": { + "@types/js-yaml": "^4.0.8", "@types/node": "^20.4.4", "ts-node": "^10.9.1", + "ts-yaml": "^1.0.0", "tsx": "^3.13.0", "typescript": "^5.1.6" } diff --git a/scripts/pnpm-lock.yaml b/scripts/pnpm-lock.yaml index cfbbe4b7..3ef0d902 100644 --- a/scripts/pnpm-lock.yaml +++ b/scripts/pnpm-lock.yaml @@ -26,12 +26,18 @@ dependencies: '@cosmjs/stargate': specifier: ^0.31.0 version: 0.31.0 + '@cosmjs/tendermint-rpc': + specifier: 0.31.0 + version: 0.31.0 axios: specifier: ^1.4.0 version: 1.4.0 colors: specifier: ^1.4.0 version: 1.4.0 + commander: + specifier: ^11.1.0 + version: 11.1.0 inversify: specifier: ^6.0.1 version: 6.0.1 @@ -43,12 +49,18 @@ dependencies: version: 0.1.13 devDependencies: + '@types/js-yaml': + specifier: ^4.0.8 + version: 4.0.8 '@types/node': specifier: ^20.4.4 version: 20.4.4 ts-node: specifier: ^10.9.1 version: 10.9.1(@types/node@20.4.4)(typescript@5.1.6) + ts-yaml: + specifier: ^1.0.0 + version: 1.0.0 tsx: specifier: ^3.13.0 version: 3.13.0 @@ -77,10 +89,10 @@ packages: /@cosmjs/amino@0.31.0: resolution: {integrity: sha512-xJ5CCEK7H79FTpOuEmlpSzVI+ZeYESTVvO3wHDgbnceIyAne3C68SvyaKqLUR4uJB0Z4q4+DZHbqW6itUiv4lA==} dependencies: - '@cosmjs/crypto': 0.31.0 - '@cosmjs/encoding': 0.31.0 - '@cosmjs/math': 0.31.0 - '@cosmjs/utils': 0.31.0 + '@cosmjs/crypto': 0.31.1 + '@cosmjs/encoding': 0.31.1 + '@cosmjs/math': 0.31.1 + '@cosmjs/utils': 0.31.1 dev: false /@cosmjs/cosmwasm-launchpad@0.25.6: @@ -151,6 +163,18 @@ packages: libsodium-wrappers-sumo: 0.7.11 dev: false + /@cosmjs/crypto@0.31.1: + resolution: {integrity: sha512-4R/SqdzdVzd4E5dpyEh1IKm5GbTqwDogutyIyyb1bcOXiX/x3CrvPI9Tb4WSIMDLvlb5TVzu2YnUV51Q1+6mMA==} + dependencies: + '@cosmjs/encoding': 0.31.1 + '@cosmjs/math': 0.31.1 + '@cosmjs/utils': 0.31.1 + '@noble/hashes': 1.3.1 + bn.js: 5.2.1 + elliptic: 6.5.4 + libsodium-wrappers-sumo: 0.7.11 + dev: false + /@cosmjs/encoding@0.25.6: resolution: {integrity: sha512-0imUOB8XkUstI216uznPaX1hqgvLQ2Xso3zJj5IV5oJuNlsfDj9nt/iQxXWbJuettc6gvrFfpf+Vw2vBZSZ75g==} dependencies: @@ -167,10 +191,18 @@ packages: readonly-date: 1.0.0 dev: false - /@cosmjs/json-rpc@0.31.0: - resolution: {integrity: sha512-Ix2Cil2qysiLNrX+E0w3vtwCrqxGVq8jklpLA7B2vtMrw7tru/rS65fdFSy8ep0wUNLL6Ud32VXa5K0YObDOMA==} + /@cosmjs/encoding@0.31.1: + resolution: {integrity: sha512-IuxP6ewwX6vg9sUJ8ocJD92pkerI4lyG8J5ynAM3NaX3q+n+uMoPRSQXNeL9bnlrv01FF1kIm8if/f5F7ZPtkA==} dependencies: - '@cosmjs/stream': 0.31.0 + base64-js: 1.5.1 + bech32: 1.1.4 + readonly-date: 1.0.0 + dev: false + + /@cosmjs/json-rpc@0.31.1: + resolution: {integrity: sha512-gIkCj2mUDHAxvmJnHtybXtMLZDeXrkDZlujjzhvJlWsIuj1kpZbKtYqh+eNlfwhMkMMAlQa/y4422jDmizW+ng==} + dependencies: + '@cosmjs/stream': 0.31.1 xstream: 11.14.0 dev: false @@ -200,6 +232,12 @@ packages: bn.js: 5.2.1 dev: false + /@cosmjs/math@0.31.1: + resolution: {integrity: sha512-kiuHV6m6DSB8/4UV1qpFhlc4ul8SgLXTGRlYkYiIIP4l0YNeJ+OpPYaOlEgx4Unk2mW3/O2FWYj7Jc93+BWXng==} + dependencies: + bn.js: 5.2.1 + dev: false + /@cosmjs/proto-signing@0.31.0: resolution: {integrity: sha512-JNlyOJRkn8EKB9mCthkjr6lVX6eyVQ09PFdmB4/DR874E62dFTvQ+YvyKMAgN7K7Dcjj26dVlAD3f6Xs7YOGDg==} dependencies: @@ -212,10 +250,10 @@ packages: long: 4.0.0 dev: false - /@cosmjs/socket@0.31.0: - resolution: {integrity: sha512-WDh9gTyiP3OCXvSAJJn33+Ef3XqMWag+bpR1TdMBxTmlTxuvU+kPy4cf6P2OF+jkkUBEA5Se2EAju0eFbJMT+w==} + /@cosmjs/socket@0.31.1: + resolution: {integrity: sha512-XTtEr+x3WGbqkzoGX0sCkwVqf5n+bBqDwqNgb+DWaBABQxHVRuuainrTVp0Yc91D3Iy2twLQzeBA9OrRxDSerw==} dependencies: - '@cosmjs/stream': 0.31.0 + '@cosmjs/stream': 0.31.1 isomorphic-ws: 4.0.1(ws@7.5.9) ws: 7.5.9 xstream: 11.14.0 @@ -251,16 +289,22 @@ packages: xstream: 11.14.0 dev: false + /@cosmjs/stream@0.31.1: + resolution: {integrity: sha512-xsIGD9bpBvYYZASajCyOevh1H5pDdbOWmvb4UwGZ78doGVz3IC3Kb9BZKJHIX2fjq9CMdGVJHmlM+Zp5aM8yZA==} + dependencies: + xstream: 11.14.0 + dev: false + /@cosmjs/tendermint-rpc@0.31.0: resolution: {integrity: sha512-yo9xbeuI6UoEKIhFZ9g0dvUKLqnBzwdpEc/uldQygQc51j38gQVwFko+6sjmhieJqRYYvrYumcbJMiV6GFM9aA==} dependencies: - '@cosmjs/crypto': 0.31.0 - '@cosmjs/encoding': 0.31.0 - '@cosmjs/json-rpc': 0.31.0 - '@cosmjs/math': 0.31.0 - '@cosmjs/socket': 0.31.0 - '@cosmjs/stream': 0.31.0 - '@cosmjs/utils': 0.31.0 + '@cosmjs/crypto': 0.31.1 + '@cosmjs/encoding': 0.31.1 + '@cosmjs/json-rpc': 0.31.1 + '@cosmjs/math': 0.31.1 + '@cosmjs/socket': 0.31.1 + '@cosmjs/stream': 0.31.1 + '@cosmjs/utils': 0.31.1 axios: 0.21.4 readonly-date: 1.0.0 xstream: 11.14.0 @@ -278,6 +322,10 @@ packages: resolution: {integrity: sha512-nNcycZWUYLNJlrIXgpcgVRqdl6BXjF4YlXdxobQWpW9Tikk61bEGeAFhDYtC0PwHlokCNw0KxWiHGJL4nL7Q5A==} dev: false + /@cosmjs/utils@0.31.1: + resolution: {integrity: sha512-n4Se1wu4GnKwztQHNFfJvUeWcpvx3o8cWhSbNs9JQShEuB3nv3R5lqFBtDCgHZF/emFQAP+ZjF8bTfCs9UBGhA==} + dev: false + /@cspotcode/source-map-support@0.8.1: resolution: {integrity: sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==} engines: {node: '>=12'} @@ -563,6 +611,10 @@ packages: resolution: {integrity: sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==} dev: true + /@types/js-yaml@4.0.8: + resolution: {integrity: sha512-m6jnPk1VhlYRiLFm3f8X9Uep761f+CK8mHyS65LutH2OhmBF0BeMEjHgg05usH8PLZMWWc/BUR9RPmkvpWnyRA==} + dev: true + /@types/long@4.0.2: resolution: {integrity: sha512-MqTGEo5bj5t157U6fA/BiDynNkn0YknVdh48CMPkTSpFTVmvao5UQmm7uEF6xBEo7qIMAlY/JSleYaE6VOdpaA==} dev: false @@ -585,6 +637,17 @@ packages: resolution: {integrity: sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==} dev: true + /argparse@1.0.10: + resolution: {integrity: sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==} + dependencies: + sprintf-js: 1.0.3 + dev: true + + /arrify@1.0.1: + resolution: {integrity: sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA==} + engines: {node: '>=0.10.0'} + dev: true + /asynckit@0.4.0: resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} dev: false @@ -649,6 +712,11 @@ packages: delayed-stream: 1.0.0 dev: false + /commander@11.1.0: + resolution: {integrity: sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==} + engines: {node: '>=16'} + dev: false + /cosmjs-types@0.8.0: resolution: {integrity: sha512-Q2Mj95Fl0PYMWEhA2LuGEIhipF7mQwd9gTQ85DdP9jjjopeoGaDxvmPa5nakNzsq7FnO1DMTatXTAx6bxMH7Lg==} dependencies: @@ -673,6 +741,11 @@ packages: engines: {node: '>=0.4.0'} dev: false + /diff@3.5.0: + resolution: {integrity: sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==} + engines: {node: '>=0.3.1'} + dev: true + /diff@4.0.2: resolution: {integrity: sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==} engines: {node: '>=0.3.1'} @@ -720,6 +793,12 @@ packages: '@esbuild/win32-x64': 0.18.20 dev: true + /esprima@4.0.1: + resolution: {integrity: sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==} + engines: {node: '>=4'} + hasBin: true + dev: true + /fast-deep-equal@3.1.3: resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} dev: false @@ -844,6 +923,14 @@ packages: resolution: {integrity: sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==} dev: false + /js-yaml@3.14.1: + resolution: {integrity: sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==} + hasBin: true + dependencies: + argparse: 1.0.10 + esprima: 4.0.1 + dev: true + /libsodium-sumo@0.7.11: resolution: {integrity: sha512-bY+7ph7xpk51Ez2GbE10lXAQ5sJma6NghcIDaSPbM/G9elfrjLa0COHl/7P6Wb/JizQzl5UQontOOP1z0VwbLA==} dev: false @@ -892,6 +979,17 @@ packages: resolution: {integrity: sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg==} dev: false + /minimist@1.2.8: + resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==} + dev: true + + /mkdirp@0.5.6: + resolution: {integrity: sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==} + hasBin: true + dependencies: + minimist: 1.2.8 + dev: true + /object-keys@1.1.1: resolution: {integrity: sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==} engines: {node: '>= 0.4'} @@ -981,6 +1079,10 @@ packages: engines: {node: '>=0.10.0'} dev: true + /sprintf-js@1.0.3: + resolution: {integrity: sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==} + dev: true + /string_decoder@1.3.0: resolution: {integrity: sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==} dependencies: @@ -1023,6 +1125,28 @@ packages: yn: 3.1.1 dev: true + /ts-node@6.2.0: + resolution: {integrity: sha512-ZNT+OEGfUNVMGkpIaDJJ44Zq3Yr0bkU/ugN1PHbU+/01Z7UV1fsELRiTx1KuQNvQ1A3pGh3y25iYF6jXgxV21A==} + engines: {node: '>=4.2.0'} + hasBin: true + dependencies: + arrify: 1.0.1 + buffer-from: 1.1.2 + diff: 3.5.0 + make-error: 1.3.6 + minimist: 1.2.8 + mkdirp: 0.5.6 + source-map-support: 0.5.21 + yn: 2.0.0 + dev: true + + /ts-yaml@1.0.0: + resolution: {integrity: sha512-g5D8X+8VhhljTWT5M4A9O8+ONj6WNB34E/WUAMr7DBxyC6S8lFJ2tgv24hfOcwz2x0hUIifBlPSf4nnh2NGY6A==} + dependencies: + js-yaml: 3.14.1 + ts-node: 6.2.0 + dev: true + /tsx@3.13.0: resolution: {integrity: sha512-rjmRpTu3as/5fjNq/kOkOtihgLxuIz6pbKdj9xwP4J5jOLkBxw/rjN5ANw+KyrrOXV5uB7HC8+SrrSJxT65y+A==} hasBin: true @@ -1068,6 +1192,11 @@ packages: symbol-observable: 2.0.3 dev: false + /yn@2.0.0: + resolution: {integrity: sha512-uTv8J/wiWTgUTg+9vLTi//leUl5vDQS6uii/emeTb2ssY7vl6QWf2fFbIIGjnhjvbdKlU0ed7QPgY1htTC86jQ==} + engines: {node: '>=4'} + dev: true + /yn@3.1.1: resolution: {integrity: sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==} engines: {node: '>=6'} diff --git a/scripts/src/config.ts b/scripts/src/config.ts new file mode 100644 index 00000000..f79d74f6 --- /dev/null +++ b/scripts/src/config.ts @@ -0,0 +1,79 @@ +import yaml from "js-yaml"; +import { readFileSync } from "fs"; +import { SigningCosmWasmClient } from "@cosmjs/cosmwasm-stargate"; +import { + Tendermint34Client, + Tendermint37Client, + TendermintClient, +} from "@cosmjs/tendermint-rpc"; +import { DirectSecp256k1Wallet } from "@cosmjs/proto-signing"; +import { GasPrice, SigningStargateClient } from "@cosmjs/stargate"; + +export type Config = { + network: { + id: string; + hrp: string; + url: string; + gas: string; + domain: number; + tm_version?: "34" | "37"; + }; + + signer: string; +}; + +export type Client = { + wasm: SigningCosmWasmClient; + stargate: SigningStargateClient; + signer: string; + signer_pubkey: string; +}; + +const path = process.env.CONFIG || `${process.cwd()}/config.yaml`; + +export const config = yaml.load(readFileSync(path, "utf-8")) as Config; + +export async function getSigningClient({ + network, + signer, +}: Config): Promise { + const wallet = await DirectSecp256k1Wallet.fromKey( + Buffer.from(signer, "hex"), + network.hrp + ); + + const [account] = await wallet.getAccounts(); + + let clientBase: TendermintClient; + + switch (network.tm_version || "37") { + case "34": + clientBase = await Tendermint34Client.connect(network.url); + break; + case "37": + clientBase = await Tendermint37Client.connect(network.url); + break; + } + + const wasm = await SigningCosmWasmClient.createWithSigner( + clientBase, + wallet, + { + gasPrice: GasPrice.fromString(network.gas), + } + ); + const stargate = await SigningStargateClient.createWithSigner( + clientBase, + wallet, + { + gasPrice: GasPrice.fromString(network.gas), + } + ); + + return { + wasm, + stargate, + signer: account.address, + signer_pubkey: Buffer.from(account.pubkey).toString("hex"), + }; +} diff --git a/scripts/src/conv.ts b/scripts/src/conv.ts new file mode 100644 index 00000000..ac1b9488 --- /dev/null +++ b/scripts/src/conv.ts @@ -0,0 +1,4 @@ +export const addPad = (v: string): string => { + const s = v.startsWith("0x") ? v.slice(2) : v; + return s.padStart(64, "0"); +}; diff --git a/scripts/src/index.ts b/scripts/src/index.ts index 9cf672ba..f2317383 100644 --- a/scripts/src/index.ts +++ b/scripts/src/index.ts @@ -4,19 +4,13 @@ import { loadContext, saveContext } from "./load_context"; import { getTargetContract, getTargetContractName } from "./contracts"; import { CodeUpdate, CodeCreate, Context } from "./types"; import * as readline from "readline"; -import { SigningCosmWasmClient } from "@cosmjs/cosmwasm-stargate"; -import { DirectSecp256k1HdWallet } from "@cosmjs/proto-signing"; -import { GasPrice } from "@cosmjs/stargate"; + import { AxiosError } from "axios"; import { CONTAINER } from "./ioc"; import { runMigrations } from "./migrations"; +import { config, getSigningClient } from "./config"; colors.enable(); -const NETWORK_ID = process.env.NETWORK_ID || "osmo-test-5"; -const NETWORK_HRP = process.env.NETWORK_HRP || "osmo"; -const NETWORK_URL = - process.env.NETWORK_URL || "https://rpc.osmotest5.osmosis.zone"; -const NETWORK_GAS = process.env.NETWORK_GAS || "0.025uosmo"; function askQuestion(query: string) { const rl = readline.createInterface({ @@ -32,36 +26,21 @@ function askQuestion(query: string) { ); } -async function getSigningClient(): Promise<{ - client: SigningCosmWasmClient; - address: string; -}> { - const mnemonic = process.env["SIGNING_MNEMONIC"] as string; - const wallet = await DirectSecp256k1HdWallet.fromMnemonic(mnemonic, { - prefix: NETWORK_HRP, - }); - const [{ address }] = await wallet.getAccounts(); - - const client = await SigningCosmWasmClient.connectWithSigner( - NETWORK_URL, - wallet, - { - gasPrice: GasPrice.fromString(NETWORK_GAS), - } - ); - return { client, address }; -} - async function main() { const digest = await loadWasmFileDigest(); - const context = await loadContext(NETWORK_ID); + const context = loadContext(config.network.id); const targetContractName = getTargetContractName(); - const { client, address } = await getSigningClient(); - context.address = address; + const client = await getSigningClient(config); + context.address = client.signer; CONTAINER.bind(Context).toConstantValue(context); - const contracts = getTargetContract(context, client, address, CONTAINER); + const contracts = getTargetContract( + context, + client.wasm, + client.signer, + CONTAINER + ); console.log("check exist contracts...."); const codeChanges = targetContractName @@ -128,7 +107,7 @@ async function main() { contract.digest = v.digest; const contractContext = await contract.upload(); context.contracts[v.contractName] = contractContext; - saveContext(NETWORK_ID, context); + saveContext(config.network.id, context); console.log("OK".green, "as", contractContext.codeId); } catch (e) { @@ -141,7 +120,7 @@ async function main() { console.log("No contracts to upload."); } - runMigrations(NETWORK_ID, false); + runMigrations(config.network.id, false); } main(); diff --git a/scripts/src/load_wasm.ts b/scripts/src/load_wasm.ts index e269aab5..a1f9cdeb 100644 --- a/scripts/src/load_wasm.ts +++ b/scripts/src/load_wasm.ts @@ -53,5 +53,5 @@ export async function loadWasmFileDigest() { } export function getWasmPath(contractName: string): string { - return path.join(directoryPath, `${contractName}-aarch64.wasm`); + return path.join(directoryPath, `${contractName}.wasm`); } diff --git a/scripts/src/migrations/initialize.ts b/scripts/src/migrations/initialize.ts index 9dfe6eab..9e48f4f1 100644 --- a/scripts/src/migrations/initialize.ts +++ b/scripts/src/migrations/initialize.ts @@ -44,7 +44,9 @@ export default class InitializeStandalone implements Migration { // init igp oracle this.ctx.contracts[this.igp_oracle.contractName] = - await this.igp_oracle.instantiate({}); + await this.igp_oracle.instantiate({ + owner: this.ctx.address!, + }); // init igp this.ctx.contracts[this.igp.contractName] = await this.igp.instantiate({ @@ -52,7 +54,7 @@ export default class InitializeStandalone implements Migration { owner: this.ctx.address!, mailbox: this.ctx.contracts[this.mailbox.contractName].address, gas_token: "token", - beneficairy: this.ctx.address!, + beneficiary: this.ctx.address!, }); // init ism multisig diff --git a/scripts/src/migrations/mailbox.ts b/scripts/src/migrations/mailbox.ts index 1016733c..05d86b2c 100644 --- a/scripts/src/migrations/mailbox.ts +++ b/scripts/src/migrations/mailbox.ts @@ -18,7 +18,8 @@ export default class MailboxMigration implements Migration { run = async (): Promise => { const mailboxInit: HplMailboxInstantiateMsg = { owner: this.ctx.address!, - default_ism: this.ism_multisig.address!, + hrp: "dual", + domain: 33333, } this.ctx.contracts[this.mailbox.contractName] = await this.mailbox.instantiate(mailboxInit); return this.ctx; diff --git a/scripts/src/migrations/mailbox_related.ts b/scripts/src/migrations/mailbox_related.ts index 7b2d61cc..ef9a383f 100644 --- a/scripts/src/migrations/mailbox_related.ts +++ b/scripts/src/migrations/mailbox_related.ts @@ -23,24 +23,24 @@ export default class MailboxMigration implements Migration { ) {} run = async (): Promise => { - const routingMsgs: HplIsmRoutingInstantiateMsg = { - owner: this.ctx.address!, - isms: [ - { - domain: 4337, - address: this.mailbox.address!, - }, - ], - }; - this.ctx.contracts[this.ismRouting.contractName] = - await this.ismRouting.instantiate(routingMsgs); + // const routingMsgs: HplIsmRoutingInstantiateMsg = { + // owner: this.ctx.address!, + // isms: [ + // { + // domain: 4337, + // address: this.mailbox.address!, + // }, + // ], + // }; + // this.ctx.contracts[this.ismRouting.contractName] = + // await this.ismRouting.instantiate(routingMsgs); - const vaMsg: HplValidatorAnnounceInstantiateMsg = { - addr_prefix: "osmo", - mailbox: this.mailbox.address!, - local_domain: 4337, - }; - this.ctx.contracts[this.va.contractName] = await this.va.instantiate(vaMsg); + // const vaMsg: HplValidatorAnnounceInstantiateMsg = { + // addr_prefix: "osmo", + // mailbox: this.mailbox.address!, + // local_domain: 4337, + // }; + // this.ctx.contracts[this.va.contractName] = await this.va.instantiate(vaMsg); return this.ctx; }; diff --git a/scripts/src/types.ts b/scripts/src/types.ts index 811ad22b..d3467ca8 100644 --- a/scripts/src/types.ts +++ b/scripts/src/types.ts @@ -1,4 +1,7 @@ -import { SigningCosmWasmClient } from "@cosmjs/cosmwasm-stargate"; +import { + ExecuteResult, + SigningCosmWasmClient, +} from "@cosmjs/cosmwasm-stargate"; import { getWasmPath } from "./load_wasm"; import fs from "fs"; @@ -83,11 +86,10 @@ export abstract class BaseContract implements Contract { } public async instantiate(msg: any): Promise { - const instantiateMsg = msg as HplMailboxInstantiateMsg; const contract = await this.client.instantiate( this.signer, this.codeId!, - instantiateMsg, + msg, this.contractName, "auto", { admin: this.signer } @@ -96,6 +98,36 @@ export abstract class BaseContract implements Contract { this.address = contract.contractAddress; return this.getContractContext(); } + + // overloads + public async execute(msg: any): Promise; + public async execute( + msg: any, + funds: { denom: string; amount: string }[] + ): Promise; + + // implementation + public async execute( + msg: any, + funds?: { denom: string; amount: string }[] + ): Promise { + const res = await this.client.execute( + this.signer, + this.address!, + msg, + "auto", + undefined, + funds + ); + + return res; + } + + public async query(msg: any): Promise { + const res = await this.client.queryContractSmart(this.address!, msg); + + return res; + } } export interface ContractConstructor { @@ -144,7 +176,8 @@ export interface HplIsmRoutingInstantiateMsg { export interface HplMailboxInstantiateMsg { owner: string; - default_ism: string; + hrp: string; + domain: number; } export interface HplMulticallInstantiateMsg { diff --git a/scripts/tsconfig.json b/scripts/tsconfig.json index 0f802280..25615870 100644 --- a/scripts/tsconfig.json +++ b/scripts/tsconfig.json @@ -1,9 +1,6 @@ { "compilerOptions": { - "lib": [ - "es2021", - "webworker" - ], + "lib": ["es2021", "webworker"], "module": "commonjs", "target": "es2021", "strict": true, @@ -16,8 +13,7 @@ "emitDecoratorMetadata": true, "strictPropertyInitialization": false, "outDir": "dist", - "declaration": true /* Skip type checking all .d.ts files. */ + "declaration": true /* Skip type checking all .d.ts files. */ }, - "include": [ "src/**/*.ts", "*.ts" ], + "include": ["src/**/*.ts", "*.ts", "action/**/*.ts"] } - diff --git a/scripts/warp.ts b/scripts/warp.ts deleted file mode 100644 index 51c9c31b..00000000 --- a/scripts/warp.ts +++ /dev/null @@ -1,90 +0,0 @@ -import { SigningCosmWasmClient } from "@cosmjs/cosmwasm-stargate"; -import { DirectSecp256k1HdWallet } from "@cosmjs/proto-signing"; -import { GasPrice } from "@cosmjs/stargate"; - -import { loadContext } from "./src/load_context"; -import HplMailbox from "./src/contracts/hpl_mailbox"; -import { Context } from "./src/types"; -import HplWarpNative from "./src/contracts/hpl_warp_native"; - -const NETWORK_ID = process.env.NETWORK_ID || "osmo-test-5"; -const NETWORK_HRP = process.env.NETWORK_HRP || "osmo"; -const NETWORK_URL = - process.env.NETWORK_URL || "https://rpc.osmotest5.osmosis.zone"; -const NETWORK_GAS = process.env.NETWORK_GAS || "0.025uosmo"; - -async function getSigningClient(): Promise<{ - client: SigningCosmWasmClient; - address: string; -}> { - const mnemonic = process.env["SIGNING_MNEMONIC"] as string; - const wallet = await DirectSecp256k1HdWallet.fromMnemonic(mnemonic, { - prefix: NETWORK_HRP, - }); - const [{ address }] = await wallet.getAccounts(); - - const client = await SigningCosmWasmClient.connectWithSigner( - NETWORK_URL, - wallet, - { - gasPrice: GasPrice.fromString(NETWORK_GAS), - } - ); - return { client, address }; -} - -type Const = new ( - address: string | undefined, - codeId: number | undefined, - digest: string, - signer: string, - client: SigningCosmWasmClient -) => T; - -class ContractFetcher { - constructor( - private ctx: Context, - private owner: string, - private client: SigningCosmWasmClient - ) {} - - public get(f: Const, name: string): T { - return new f( - this.ctx.contracts[name].address, - this.ctx.contracts[name].codeId, - this.ctx.contracts[name].digest, - this.owner, - this.client - ); - } -} - -async function main() { - const { client, address: owner } = await getSigningClient(); - - const ctx = loadContext(NETWORK_ID); - - const fetcher = new ContractFetcher(ctx, owner, client); - - const mailbox = fetcher.get(HplMailbox, "hpl_mailbox"); - - const warp_native = fetcher.get(HplWarpNative, "hpl_warp_native"); - - const target_denom = - "ibc/B5CB286F69D48B2C4F6F8D8CF59011C40590DCF8A91617A5FBA9FF0A7B21307F"; - - const ibc_route = await warp_native.instantiate({ - token: { - collateral: { - denom: target_denom, - }, - }, - hrp: "dual", - owner, - mailbox: mailbox.address!, - }); - - console.log("ibc_route", ibc_route); -} - -main().catch(console.error); diff --git a/ts/sdk/package.json b/ts/sdk/package.json index a2c07f88..21c5f9c0 100644 --- a/ts/sdk/package.json +++ b/ts/sdk/package.json @@ -20,37 +20,39 @@ ] }, "devDependencies": { - "@cosmwasm/ts-codegen": "^0.16.5", - "@rollup/plugin-commonjs": "^25.0.2", - "@rollup/plugin-node-resolve": "^15.1.0", - "@swc/core": "^1.2.198", - "@swc/helpers": "^0.3.17", - "@types/eslint": "^8.4.1", - "@types/jest": "^27.4.1", - "@types/prettier": "^2.6.0", - "@typescript-eslint/eslint-plugin": "^5.21.0", - "@typescript-eslint/parser": "^5.21.0", - "eslint": "^8.14.0", - "eslint-config-prettier": "^8.5.0", - "eslint-plugin-prettier": "^4.0.0", - "jest": "^27.5.1", - "prettier": "^2.6.2", - "regenerator-runtime": "^0.13.9", - "rollup": "^2.70.2", + "@cosmjs/amino": "^0.31.1", + "@cosmwasm/ts-codegen": "^0.35.3", + "@rollup/plugin-commonjs": "^25.0.7", + "@rollup/plugin-node-resolve": "^15.2.3", + "@swc/core": "^1.3.93", + "@swc/helpers": "^0.5.3", + "@types/eslint": "^8.44.4", + "@types/jest": "^29.5.5", + "@types/prettier": "^3.0.0", + "@typescript-eslint/eslint-plugin": "^6.8.0", + "@typescript-eslint/parser": "^6.8.0", + "eslint": "^8.51.0", + "eslint-config-prettier": "^9.0.0", + "eslint-plugin-prettier": "^5.0.1", + "jest": "^29.7.0", + "prettier": "^3.0.3", + "regenerator-runtime": "^0.14.0", + "rollup": "^4.1.4", "rollup-plugin-terser": "^7.0.2", - "rollup-plugin-typescript2": "^0.31.2", - "ts-jest": "^27.1.4", - "ts-jest-resolver": "^2.0.0", - "typedoc": "^0.22.15", - "typedoc-plugin-markdown": "^3.12.1", - "typescript": "^4.6.3" + "rollup-plugin-typescript2": "^0.36.0", + "ts-jest": "^29.1.1", + "ts-jest-resolver": "^2.0.1", + "tslib": "^2.6.2", + "typedoc": "^0.25.2", + "typedoc-plugin-markdown": "^3.16.0", + "typescript": "^5.2.2" }, "scripts": { "doc": "typedoc src/index.ts", "test": "jest --passWithNoTests", "lint": "eslint \"*/**/*.{ts,js,json}\"", "lint:fix": "eslint \"*/**/*.{ts,js,json}\" --fix", - "build": "rollup --config ./rollup.config.js", + "build": "rollup --config ./rollup.config.js --bundleConfigAsCjs", "prepublishOnly": "npm run doc && npm run lint && npm run test && npm run build", "codegen": "node ./scripts/codegen" }, @@ -60,8 +62,8 @@ }, "license": "MIT OR Apache-2.0", "dependencies": { - "@cosmjs/cosmwasm-stargate": "^0.28.11", - "@cosmjs/encoding": "^0.30.1", + "@cosmjs/cosmwasm-stargate": "^0.31.1", + "@cosmjs/encoding": "^0.31.1", "cosmjs-types": "^0.8.0", "cosmwasm": "^1.1.1" } diff --git a/ts/sdk/scripts/codegen.js b/ts/sdk/scripts/codegen.js index f3e867d1..6071ee5b 100644 --- a/ts/sdk/scripts/codegen.js +++ b/ts/sdk/scripts/codegen.js @@ -3,17 +3,19 @@ const path = require("path"); const fs = require("fs"); const pkgRoot = path.join(__dirname, ".."); -const contractsDir = path.join(pkgRoot, "..", "..", "contracts"); + +const schemaDir = path.join(pkgRoot, "..", "..", "schema"); const contracts = fs - .readdirSync(contractsDir, { withFileTypes: true }) + .readdirSync(schemaDir, { withFileTypes: true }) .filter((c) => c.isDirectory()) .map((c) => ({ name: c.name, - dir: path.join(contractsDir, c.name), + dir: path.join(schemaDir, c.name), })); const outPath = path.join(pkgRoot, "src", "contracts"); + fs.rmSync(outPath, { recursive: true, force: true }); codegen({ diff --git a/ts/sdk/src/contracts/HookAggregate.client.ts b/ts/sdk/src/contracts/HookAggregate.client.ts new file mode 100644 index 00000000..415087b5 --- /dev/null +++ b/ts/sdk/src/contracts/HookAggregate.client.ts @@ -0,0 +1,106 @@ +/** +* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. +* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, +* and run the @cosmwasm/ts-codegen generate command to regenerate this file. +*/ + +import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from "@cosmjs/cosmwasm-stargate"; +import { StdFee } from "@cosmjs/amino"; +import { InstantiateMsg, ExecuteMsg, OwnableMsg, HexBinary, PostDispatchMsg, QueryMsg, OwnableQueryMsg, HookQueryMsg, AggregateHookQueryMsg, QuoteDispatchMsg, Addr, OwnerResponse, PendingOwnerResponse, HooksResponse, MailboxResponse, Uint128, QuoteDispatchResponse, Coin } from "./HookAggregate.types"; +export interface HookAggregateReadOnlyInterface { + contractAddress: string; + ownable: (ownableQueryMsg: OwnableQueryMsg) => Promise; + hook: (hookQueryMsg: HookQueryMsg) => Promise; + aggregateHook: (aggregateHookQueryMsg: AggregateHookQueryMsg) => Promise; +} +export class HookAggregateQueryClient implements HookAggregateReadOnlyInterface { + client: CosmWasmClient; + contractAddress: string; + + constructor(client: CosmWasmClient, contractAddress: string) { + this.client = client; + this.contractAddress = contractAddress; + this.ownable = this.ownable.bind(this); + this.hook = this.hook.bind(this); + this.aggregateHook = this.aggregateHook.bind(this); + } + + ownable = async (ownableQueryMsg: OwnableQueryMsg): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + ownable: ownableQueryMsg + }); + }; + hook = async (hookQueryMsg: HookQueryMsg): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + hook: hookQueryMsg + }); + }; + aggregateHook = async (aggregateHookQueryMsg: AggregateHookQueryMsg): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + aggregate_hook: aggregateHookQueryMsg + }); + }; +} +export interface HookAggregateInterface extends HookAggregateReadOnlyInterface { + contractAddress: string; + sender: string; + ownable: (ownableMsg: OwnableMsg, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + postDispatch: ({ + message, + metadata + }: { + message: HexBinary; + metadata: HexBinary; + }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + setHooks: ({ + hooks + }: { + hooks: string[]; + }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; +} +export class HookAggregateClient extends HookAggregateQueryClient implements HookAggregateInterface { + client: SigningCosmWasmClient; + sender: string; + contractAddress: string; + + constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string) { + super(client, contractAddress); + this.client = client; + this.sender = sender; + this.contractAddress = contractAddress; + this.ownable = this.ownable.bind(this); + this.postDispatch = this.postDispatch.bind(this); + this.setHooks = this.setHooks.bind(this); + } + + ownable = async (ownableMsg: OwnableMsg, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + ownable: ownableMsg + }, fee, memo, _funds); + }; + postDispatch = async ({ + message, + metadata + }: { + message: HexBinary; + metadata: HexBinary; + }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + post_dispatch: { + message, + metadata + } + }, fee, memo, _funds); + }; + setHooks = async ({ + hooks + }: { + hooks: string[]; + }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + set_hooks: { + hooks + } + }, fee, memo, _funds); + }; +} \ No newline at end of file diff --git a/ts/sdk/src/contracts/HookAggregate.message-composer.ts b/ts/sdk/src/contracts/HookAggregate.message-composer.ts new file mode 100644 index 00000000..b45839ab --- /dev/null +++ b/ts/sdk/src/contracts/HookAggregate.message-composer.ts @@ -0,0 +1,94 @@ +/** +* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. +* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, +* and run the @cosmwasm/ts-codegen generate command to regenerate this file. +*/ + +import { MsgExecuteContractEncodeObject } from "@cosmjs/cosmwasm-stargate"; +import { MsgExecuteContract } from "cosmjs-types/cosmwasm/wasm/v1/tx"; +import { toUtf8 } from "@cosmjs/encoding"; +import { InstantiateMsg, ExecuteMsg, OwnableMsg, HexBinary, PostDispatchMsg, QueryMsg, OwnableQueryMsg, HookQueryMsg, AggregateHookQueryMsg, QuoteDispatchMsg, Addr, OwnerResponse, PendingOwnerResponse, HooksResponse, MailboxResponse, Uint128, QuoteDispatchResponse, Coin } from "./HookAggregate.types"; +export interface HookAggregateMsg { + contractAddress: string; + sender: string; + ownable: (ownableMsg: OwnableMsg, _funds?: Coin[]) => MsgExecuteContractEncodeObject; + postDispatch: ({ + message, + metadata + }: { + message: HexBinary; + metadata: HexBinary; + }, _funds?: Coin[]) => MsgExecuteContractEncodeObject; + setHooks: ({ + hooks + }: { + hooks: string[]; + }, _funds?: Coin[]) => MsgExecuteContractEncodeObject; +} +export class HookAggregateMsgComposer implements HookAggregateMsg { + sender: string; + contractAddress: string; + + constructor(sender: string, contractAddress: string) { + this.sender = sender; + this.contractAddress = contractAddress; + this.ownable = this.ownable.bind(this); + this.postDispatch = this.postDispatch.bind(this); + this.setHooks = this.setHooks.bind(this); + } + + ownable = (ownableMsg: OwnableMsg, _funds?: Coin[]): MsgExecuteContractEncodeObject => { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", + value: MsgExecuteContract.fromPartial({ + sender: this.sender, + contract: this.contractAddress, + msg: toUtf8(JSON.stringify({ + ownable: ownableMsg + })), + funds: _funds + }) + }; + }; + postDispatch = ({ + message, + metadata + }: { + message: HexBinary; + metadata: HexBinary; + }, _funds?: Coin[]): MsgExecuteContractEncodeObject => { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", + value: MsgExecuteContract.fromPartial({ + sender: this.sender, + contract: this.contractAddress, + msg: toUtf8(JSON.stringify({ + post_dispatch: { + message, + metadata + } + })), + funds: _funds + }) + }; + }; + setHooks = ({ + hooks + }: { + hooks: string[]; + }, _funds?: Coin[]): MsgExecuteContractEncodeObject => { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", + value: MsgExecuteContract.fromPartial({ + sender: this.sender, + contract: this.contractAddress, + msg: toUtf8(JSON.stringify({ + set_hooks: { + hooks + } + })), + funds: _funds + }) + }; + }; +} \ No newline at end of file diff --git a/ts/sdk/src/contracts/HookAggregate.types.ts b/ts/sdk/src/contracts/HookAggregate.types.ts new file mode 100644 index 00000000..df4b3153 --- /dev/null +++ b/ts/sdk/src/contracts/HookAggregate.types.ts @@ -0,0 +1,79 @@ +/** +* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. +* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, +* and run the @cosmwasm/ts-codegen generate command to regenerate this file. +*/ + +export interface InstantiateMsg { + hooks: string[]; + owner: string; +} +export type ExecuteMsg = { + ownable: OwnableMsg; +} | { + post_dispatch: PostDispatchMsg; +} | { + set_hooks: { + hooks: string[]; + }; +}; +export type OwnableMsg = { + init_ownership_transfer: { + next_owner: string; + }; +} | { + revoke_ownership_transfer: {}; +} | { + claim_ownership: {}; +}; +export type HexBinary = string; +export interface PostDispatchMsg { + message: HexBinary; + metadata: HexBinary; +} +export type QueryMsg = { + ownable: OwnableQueryMsg; +} | { + hook: HookQueryMsg; +} | { + aggregate_hook: AggregateHookQueryMsg; +}; +export type OwnableQueryMsg = { + get_owner: {}; +} | { + get_pending_owner: {}; +}; +export type HookQueryMsg = { + quote_dispatch: QuoteDispatchMsg; +} | { + mailbox: {}; +}; +export type AggregateHookQueryMsg = { + hooks: {}; +}; +export interface QuoteDispatchMsg { + message: HexBinary; + metadata: HexBinary; +} +export type Addr = string; +export interface OwnerResponse { + owner: Addr; +} +export interface PendingOwnerResponse { + pending_owner?: Addr | null; +} +export interface HooksResponse { + hooks: string[]; +} +export interface MailboxResponse { + mailbox: string; +} +export type Uint128 = string; +export interface QuoteDispatchResponse { + gas_amount?: Coin | null; +} +export interface Coin { + amount: Uint128; + denom: string; + [k: string]: unknown; +} \ No newline at end of file diff --git a/ts/sdk/src/contracts/HookMerkle.client.ts b/ts/sdk/src/contracts/HookMerkle.client.ts new file mode 100644 index 00000000..ff3da4fd --- /dev/null +++ b/ts/sdk/src/contracts/HookMerkle.client.ts @@ -0,0 +1,89 @@ +/** +* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. +* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, +* and run the @cosmwasm/ts-codegen generate command to regenerate this file. +*/ + +import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from "@cosmjs/cosmwasm-stargate"; +import { StdFee } from "@cosmjs/amino"; +import { InstantiateMsg, ExecuteMsg, OwnableMsg, HexBinary, PostDispatchMsg, QueryMsg, OwnableQueryMsg, HookQueryMsg, MerkleHookQueryMsg, QuoteDispatchMsg, BranchResponse, CheckPointResponse, CountResponse, Addr, OwnerResponse, PendingOwnerResponse, MailboxResponse, Uint128, QuoteDispatchResponse, Coin, RootResponse, TreeResponse } from "./HookMerkle.types"; +export interface HookMerkleReadOnlyInterface { + contractAddress: string; + ownable: (ownableQueryMsg: OwnableQueryMsg) => Promise; + hook: (hookQueryMsg: HookQueryMsg) => Promise; + merkleHook: (merkleHookQueryMsg: MerkleHookQueryMsg) => Promise; +} +export class HookMerkleQueryClient implements HookMerkleReadOnlyInterface { + client: CosmWasmClient; + contractAddress: string; + + constructor(client: CosmWasmClient, contractAddress: string) { + this.client = client; + this.contractAddress = contractAddress; + this.ownable = this.ownable.bind(this); + this.hook = this.hook.bind(this); + this.merkleHook = this.merkleHook.bind(this); + } + + ownable = async (ownableQueryMsg: OwnableQueryMsg): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + ownable: ownableQueryMsg + }); + }; + hook = async (hookQueryMsg: HookQueryMsg): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + hook: hookQueryMsg + }); + }; + merkleHook = async (merkleHookQueryMsg: MerkleHookQueryMsg): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + merkle_hook: merkleHookQueryMsg + }); + }; +} +export interface HookMerkleInterface extends HookMerkleReadOnlyInterface { + contractAddress: string; + sender: string; + ownable: (ownableMsg: OwnableMsg, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + postDispatch: ({ + message, + metadata + }: { + message: HexBinary; + metadata: HexBinary; + }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; +} +export class HookMerkleClient extends HookMerkleQueryClient implements HookMerkleInterface { + client: SigningCosmWasmClient; + sender: string; + contractAddress: string; + + constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string) { + super(client, contractAddress); + this.client = client; + this.sender = sender; + this.contractAddress = contractAddress; + this.ownable = this.ownable.bind(this); + this.postDispatch = this.postDispatch.bind(this); + } + + ownable = async (ownableMsg: OwnableMsg, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + ownable: ownableMsg + }, fee, memo, _funds); + }; + postDispatch = async ({ + message, + metadata + }: { + message: HexBinary; + metadata: HexBinary; + }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + post_dispatch: { + message, + metadata + } + }, fee, memo, _funds); + }; +} \ No newline at end of file diff --git a/ts/sdk/src/contracts/HookMerkle.message-composer.ts b/ts/sdk/src/contracts/HookMerkle.message-composer.ts new file mode 100644 index 00000000..0cf1ddb0 --- /dev/null +++ b/ts/sdk/src/contracts/HookMerkle.message-composer.ts @@ -0,0 +1,69 @@ +/** +* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. +* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, +* and run the @cosmwasm/ts-codegen generate command to regenerate this file. +*/ + +import { MsgExecuteContractEncodeObject } from "@cosmjs/cosmwasm-stargate"; +import { MsgExecuteContract } from "cosmjs-types/cosmwasm/wasm/v1/tx"; +import { toUtf8 } from "@cosmjs/encoding"; +import { InstantiateMsg, ExecuteMsg, OwnableMsg, HexBinary, PostDispatchMsg, QueryMsg, OwnableQueryMsg, HookQueryMsg, MerkleHookQueryMsg, QuoteDispatchMsg, BranchResponse, CheckPointResponse, CountResponse, Addr, OwnerResponse, PendingOwnerResponse, MailboxResponse, Uint128, QuoteDispatchResponse, Coin, RootResponse, TreeResponse } from "./HookMerkle.types"; +export interface HookMerkleMsg { + contractAddress: string; + sender: string; + ownable: (ownableMsg: OwnableMsg, _funds?: Coin[]) => MsgExecuteContractEncodeObject; + postDispatch: ({ + message, + metadata + }: { + message: HexBinary; + metadata: HexBinary; + }, _funds?: Coin[]) => MsgExecuteContractEncodeObject; +} +export class HookMerkleMsgComposer implements HookMerkleMsg { + sender: string; + contractAddress: string; + + constructor(sender: string, contractAddress: string) { + this.sender = sender; + this.contractAddress = contractAddress; + this.ownable = this.ownable.bind(this); + this.postDispatch = this.postDispatch.bind(this); + } + + ownable = (ownableMsg: OwnableMsg, _funds?: Coin[]): MsgExecuteContractEncodeObject => { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", + value: MsgExecuteContract.fromPartial({ + sender: this.sender, + contract: this.contractAddress, + msg: toUtf8(JSON.stringify({ + ownable: ownableMsg + })), + funds: _funds + }) + }; + }; + postDispatch = ({ + message, + metadata + }: { + message: HexBinary; + metadata: HexBinary; + }, _funds?: Coin[]): MsgExecuteContractEncodeObject => { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", + value: MsgExecuteContract.fromPartial({ + sender: this.sender, + contract: this.contractAddress, + msg: toUtf8(JSON.stringify({ + post_dispatch: { + message, + metadata + } + })), + funds: _funds + }) + }; + }; +} \ No newline at end of file diff --git a/ts/sdk/src/contracts/HookMerkle.types.ts b/ts/sdk/src/contracts/HookMerkle.types.ts new file mode 100644 index 00000000..5fa33d5f --- /dev/null +++ b/ts/sdk/src/contracts/HookMerkle.types.ts @@ -0,0 +1,97 @@ +/** +* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. +* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, +* and run the @cosmwasm/ts-codegen generate command to regenerate this file. +*/ + +export interface InstantiateMsg { + mailbox: string; + owner: string; +} +export type ExecuteMsg = { + ownable: OwnableMsg; +} | { + post_dispatch: PostDispatchMsg; +}; +export type OwnableMsg = { + init_ownership_transfer: { + next_owner: string; + }; +} | { + revoke_ownership_transfer: {}; +} | { + claim_ownership: {}; +}; +export type HexBinary = string; +export interface PostDispatchMsg { + message: HexBinary; + metadata: HexBinary; +} +export type QueryMsg = { + ownable: OwnableQueryMsg; +} | { + hook: HookQueryMsg; +} | { + merkle_hook: MerkleHookQueryMsg; +}; +export type OwnableQueryMsg = { + get_owner: {}; +} | { + get_pending_owner: {}; +}; +export type HookQueryMsg = { + quote_dispatch: QuoteDispatchMsg; +} | { + mailbox: {}; +}; +export type MerkleHookQueryMsg = { + count: {}; +} | { + root: {}; +} | { + branch: {}; +} | { + tree: {}; +} | { + check_point: {}; +}; +export interface QuoteDispatchMsg { + message: HexBinary; + metadata: HexBinary; +} +export interface BranchResponse { + branch: [HexBinary, HexBinary, HexBinary, HexBinary, HexBinary, HexBinary, HexBinary, HexBinary, HexBinary, HexBinary, HexBinary, HexBinary, HexBinary, HexBinary, HexBinary, HexBinary, HexBinary, HexBinary, HexBinary, HexBinary, HexBinary, HexBinary, HexBinary, HexBinary, HexBinary, HexBinary, HexBinary, HexBinary, HexBinary, HexBinary, HexBinary, HexBinary]; +} +export interface CheckPointResponse { + count: number; + root: HexBinary; +} +export interface CountResponse { + count: number; +} +export type Addr = string; +export interface OwnerResponse { + owner: Addr; +} +export interface PendingOwnerResponse { + pending_owner?: Addr | null; +} +export interface MailboxResponse { + mailbox: string; +} +export type Uint128 = string; +export interface QuoteDispatchResponse { + gas_amount?: Coin | null; +} +export interface Coin { + amount: Uint128; + denom: string; + [k: string]: unknown; +} +export interface RootResponse { + root: HexBinary; +} +export interface TreeResponse { + branch: [HexBinary, HexBinary, HexBinary, HexBinary, HexBinary, HexBinary, HexBinary, HexBinary, HexBinary, HexBinary, HexBinary, HexBinary, HexBinary, HexBinary, HexBinary, HexBinary, HexBinary, HexBinary, HexBinary, HexBinary, HexBinary, HexBinary, HexBinary, HexBinary, HexBinary, HexBinary, HexBinary, HexBinary, HexBinary, HexBinary, HexBinary, HexBinary]; + count: number; +} \ No newline at end of file diff --git a/ts/sdk/src/contracts/HookPausable.client.ts b/ts/sdk/src/contracts/HookPausable.client.ts new file mode 100644 index 00000000..ad6c68db --- /dev/null +++ b/ts/sdk/src/contracts/HookPausable.client.ts @@ -0,0 +1,96 @@ +/** +* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. +* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, +* and run the @cosmwasm/ts-codegen generate command to regenerate this file. +*/ + +import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from "@cosmjs/cosmwasm-stargate"; +import { StdFee } from "@cosmjs/amino"; +import { InstantiateMsg, ExecuteMsg, OwnableMsg, PausableMsg, HexBinary, PostDispatchMsg, QueryMsg, PausableQueryMsg, OwnableQueryMsg, HookQueryMsg, QuoteDispatchMsg, Addr, OwnerResponse, PendingOwnerResponse, MailboxResponse, PauseInfoResponse, Uint128, QuoteDispatchResponse, Coin } from "./HookPausable.types"; +export interface HookPausableReadOnlyInterface { + contractAddress: string; + pausable: (pausableQueryMsg: PausableQueryMsg) => Promise; + ownable: (ownableQueryMsg: OwnableQueryMsg) => Promise; + hook: (hookQueryMsg: HookQueryMsg) => Promise; +} +export class HookPausableQueryClient implements HookPausableReadOnlyInterface { + client: CosmWasmClient; + contractAddress: string; + + constructor(client: CosmWasmClient, contractAddress: string) { + this.client = client; + this.contractAddress = contractAddress; + this.pausable = this.pausable.bind(this); + this.ownable = this.ownable.bind(this); + this.hook = this.hook.bind(this); + } + + pausable = async (pausableQueryMsg: PausableQueryMsg): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + pausable: pausableQueryMsg + }); + }; + ownable = async (ownableQueryMsg: OwnableQueryMsg): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + ownable: ownableQueryMsg + }); + }; + hook = async (hookQueryMsg: HookQueryMsg): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + hook: hookQueryMsg + }); + }; +} +export interface HookPausableInterface extends HookPausableReadOnlyInterface { + contractAddress: string; + sender: string; + ownable: (ownableMsg: OwnableMsg, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + pausable: (pausableMsg: PausableMsg, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + postDispatch: ({ + message, + metadata + }: { + message: HexBinary; + metadata: HexBinary; + }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; +} +export class HookPausableClient extends HookPausableQueryClient implements HookPausableInterface { + client: SigningCosmWasmClient; + sender: string; + contractAddress: string; + + constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string) { + super(client, contractAddress); + this.client = client; + this.sender = sender; + this.contractAddress = contractAddress; + this.ownable = this.ownable.bind(this); + this.pausable = this.pausable.bind(this); + this.postDispatch = this.postDispatch.bind(this); + } + + ownable = async (ownableMsg: OwnableMsg, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + ownable: ownableMsg + }, fee, memo, _funds); + }; + pausable = async (pausableMsg: PausableMsg, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + pausable: pausableMsg + }, fee, memo, _funds); + }; + postDispatch = async ({ + message, + metadata + }: { + message: HexBinary; + metadata: HexBinary; + }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + post_dispatch: { + message, + metadata + } + }, fee, memo, _funds); + }; +} \ No newline at end of file diff --git a/ts/sdk/src/contracts/HookPausable.message-composer.ts b/ts/sdk/src/contracts/HookPausable.message-composer.ts new file mode 100644 index 00000000..96428741 --- /dev/null +++ b/ts/sdk/src/contracts/HookPausable.message-composer.ts @@ -0,0 +1,84 @@ +/** +* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. +* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, +* and run the @cosmwasm/ts-codegen generate command to regenerate this file. +*/ + +import { MsgExecuteContractEncodeObject } from "@cosmjs/cosmwasm-stargate"; +import { MsgExecuteContract } from "cosmjs-types/cosmwasm/wasm/v1/tx"; +import { toUtf8 } from "@cosmjs/encoding"; +import { InstantiateMsg, ExecuteMsg, OwnableMsg, PausableMsg, HexBinary, PostDispatchMsg, QueryMsg, PausableQueryMsg, OwnableQueryMsg, HookQueryMsg, QuoteDispatchMsg, Addr, OwnerResponse, PendingOwnerResponse, MailboxResponse, PauseInfoResponse, Uint128, QuoteDispatchResponse, Coin } from "./HookPausable.types"; +export interface HookPausableMsg { + contractAddress: string; + sender: string; + ownable: (ownableMsg: OwnableMsg, _funds?: Coin[]) => MsgExecuteContractEncodeObject; + pausable: (pausableMsg: PausableMsg, _funds?: Coin[]) => MsgExecuteContractEncodeObject; + postDispatch: ({ + message, + metadata + }: { + message: HexBinary; + metadata: HexBinary; + }, _funds?: Coin[]) => MsgExecuteContractEncodeObject; +} +export class HookPausableMsgComposer implements HookPausableMsg { + sender: string; + contractAddress: string; + + constructor(sender: string, contractAddress: string) { + this.sender = sender; + this.contractAddress = contractAddress; + this.ownable = this.ownable.bind(this); + this.pausable = this.pausable.bind(this); + this.postDispatch = this.postDispatch.bind(this); + } + + ownable = (ownableMsg: OwnableMsg, _funds?: Coin[]): MsgExecuteContractEncodeObject => { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", + value: MsgExecuteContract.fromPartial({ + sender: this.sender, + contract: this.contractAddress, + msg: toUtf8(JSON.stringify({ + ownable: ownableMsg + })), + funds: _funds + }) + }; + }; + pausable = (pausableMsg: PausableMsg, _funds?: Coin[]): MsgExecuteContractEncodeObject => { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", + value: MsgExecuteContract.fromPartial({ + sender: this.sender, + contract: this.contractAddress, + msg: toUtf8(JSON.stringify({ + pausable: pausableMsg + })), + funds: _funds + }) + }; + }; + postDispatch = ({ + message, + metadata + }: { + message: HexBinary; + metadata: HexBinary; + }, _funds?: Coin[]): MsgExecuteContractEncodeObject => { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", + value: MsgExecuteContract.fromPartial({ + sender: this.sender, + contract: this.contractAddress, + msg: toUtf8(JSON.stringify({ + post_dispatch: { + message, + metadata + } + })), + funds: _funds + }) + }; + }; +} \ No newline at end of file diff --git a/ts/sdk/src/contracts/HookPausable.types.ts b/ts/sdk/src/contracts/HookPausable.types.ts new file mode 100644 index 00000000..8f0cc1bf --- /dev/null +++ b/ts/sdk/src/contracts/HookPausable.types.ts @@ -0,0 +1,82 @@ +/** +* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. +* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, +* and run the @cosmwasm/ts-codegen generate command to regenerate this file. +*/ + +export interface InstantiateMsg { + owner: string; + paused: boolean; +} +export type ExecuteMsg = { + ownable: OwnableMsg; +} | { + pausable: PausableMsg; +} | { + post_dispatch: PostDispatchMsg; +}; +export type OwnableMsg = { + init_ownership_transfer: { + next_owner: string; + }; +} | { + revoke_ownership_transfer: {}; +} | { + claim_ownership: {}; +}; +export type PausableMsg = { + pause: {}; +} | { + release: {}; +}; +export type HexBinary = string; +export interface PostDispatchMsg { + message: HexBinary; + metadata: HexBinary; +} +export type QueryMsg = { + pausable: PausableQueryMsg; +} | { + ownable: OwnableQueryMsg; +} | { + hook: HookQueryMsg; +}; +export type PausableQueryMsg = { + pause_info: {}; +}; +export type OwnableQueryMsg = { + get_owner: {}; +} | { + get_pending_owner: {}; +}; +export type HookQueryMsg = { + quote_dispatch: QuoteDispatchMsg; +} | { + mailbox: {}; +}; +export interface QuoteDispatchMsg { + message: HexBinary; + metadata: HexBinary; +} +export type Addr = string; +export interface OwnerResponse { + owner: Addr; +} +export interface PendingOwnerResponse { + pending_owner?: Addr | null; +} +export interface MailboxResponse { + mailbox: string; +} +export interface PauseInfoResponse { + paused: boolean; +} +export type Uint128 = string; +export interface QuoteDispatchResponse { + gas_amount?: Coin | null; +} +export interface Coin { + amount: Uint128; + denom: string; + [k: string]: unknown; +} \ No newline at end of file diff --git a/ts/sdk/src/contracts/HookRouting.client.ts b/ts/sdk/src/contracts/HookRouting.client.ts new file mode 100644 index 00000000..9fe9d8be --- /dev/null +++ b/ts/sdk/src/contracts/HookRouting.client.ts @@ -0,0 +1,96 @@ +/** +* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. +* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, +* and run the @cosmwasm/ts-codegen generate command to regenerate this file. +*/ + +import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from "@cosmjs/cosmwasm-stargate"; +import { StdFee } from "@cosmjs/amino"; +import { InstantiateMsg, ExecuteMsg, OwnableMsg, HexBinary, RouterMsgForAddr, Addr, PostDispatchMsg, DomainRouteSetForAddr, QueryMsg, OwnableQueryMsg, RouterQueryForAddr, Order, HookQueryMsg, QuoteDispatchMsg, DomainsResponse, OwnerResponse, PendingOwnerResponse, RouteResponseForAddr, RoutesResponseForAddr, MailboxResponse, Empty, Uint128, QuoteDispatchResponse, Coin } from "./HookRouting.types"; +export interface HookRoutingReadOnlyInterface { + contractAddress: string; + ownable: (ownableQueryMsg: OwnableQueryMsg) => Promise; + router: (routerQueryForAddr: RouterQueryForAddr) => Promise; + hook: (hookQueryMsg: HookQueryMsg) => Promise; +} +export class HookRoutingQueryClient implements HookRoutingReadOnlyInterface { + client: CosmWasmClient; + contractAddress: string; + + constructor(client: CosmWasmClient, contractAddress: string) { + this.client = client; + this.contractAddress = contractAddress; + this.ownable = this.ownable.bind(this); + this.router = this.router.bind(this); + this.hook = this.hook.bind(this); + } + + ownable = async (ownableQueryMsg: OwnableQueryMsg): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + ownable: ownableQueryMsg + }); + }; + router = async (routerQueryForAddr: RouterQueryForAddr): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + router: routerQueryForAddr + }); + }; + hook = async (hookQueryMsg: HookQueryMsg): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + hook: hookQueryMsg + }); + }; +} +export interface HookRoutingInterface extends HookRoutingReadOnlyInterface { + contractAddress: string; + sender: string; + ownable: (ownableMsg: OwnableMsg, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + postDispatch: ({ + message, + metadata + }: { + message: HexBinary; + metadata: HexBinary; + }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + router: (routerMsgForAddr: RouterMsgForAddr, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; +} +export class HookRoutingClient extends HookRoutingQueryClient implements HookRoutingInterface { + client: SigningCosmWasmClient; + sender: string; + contractAddress: string; + + constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string) { + super(client, contractAddress); + this.client = client; + this.sender = sender; + this.contractAddress = contractAddress; + this.ownable = this.ownable.bind(this); + this.postDispatch = this.postDispatch.bind(this); + this.router = this.router.bind(this); + } + + ownable = async (ownableMsg: OwnableMsg, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + ownable: ownableMsg + }, fee, memo, _funds); + }; + postDispatch = async ({ + message, + metadata + }: { + message: HexBinary; + metadata: HexBinary; + }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + post_dispatch: { + message, + metadata + } + }, fee, memo, _funds); + }; + router = async (routerMsgForAddr: RouterMsgForAddr, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + router: routerMsgForAddr + }, fee, memo, _funds); + }; +} \ No newline at end of file diff --git a/ts/sdk/src/contracts/HookRouting.message-composer.ts b/ts/sdk/src/contracts/HookRouting.message-composer.ts new file mode 100644 index 00000000..d859ada6 --- /dev/null +++ b/ts/sdk/src/contracts/HookRouting.message-composer.ts @@ -0,0 +1,84 @@ +/** +* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. +* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, +* and run the @cosmwasm/ts-codegen generate command to regenerate this file. +*/ + +import { MsgExecuteContractEncodeObject } from "@cosmjs/cosmwasm-stargate"; +import { MsgExecuteContract } from "cosmjs-types/cosmwasm/wasm/v1/tx"; +import { toUtf8 } from "@cosmjs/encoding"; +import { InstantiateMsg, ExecuteMsg, OwnableMsg, HexBinary, RouterMsgForAddr, Addr, PostDispatchMsg, DomainRouteSetForAddr, QueryMsg, OwnableQueryMsg, RouterQueryForAddr, Order, HookQueryMsg, QuoteDispatchMsg, DomainsResponse, OwnerResponse, PendingOwnerResponse, RouteResponseForAddr, RoutesResponseForAddr, MailboxResponse, Empty, Uint128, QuoteDispatchResponse, Coin } from "./HookRouting.types"; +export interface HookRoutingMsg { + contractAddress: string; + sender: string; + ownable: (ownableMsg: OwnableMsg, _funds?: Coin[]) => MsgExecuteContractEncodeObject; + postDispatch: ({ + message, + metadata + }: { + message: HexBinary; + metadata: HexBinary; + }, _funds?: Coin[]) => MsgExecuteContractEncodeObject; + router: (routerMsgForAddr: RouterMsgForAddr, _funds?: Coin[]) => MsgExecuteContractEncodeObject; +} +export class HookRoutingMsgComposer implements HookRoutingMsg { + sender: string; + contractAddress: string; + + constructor(sender: string, contractAddress: string) { + this.sender = sender; + this.contractAddress = contractAddress; + this.ownable = this.ownable.bind(this); + this.postDispatch = this.postDispatch.bind(this); + this.router = this.router.bind(this); + } + + ownable = (ownableMsg: OwnableMsg, _funds?: Coin[]): MsgExecuteContractEncodeObject => { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", + value: MsgExecuteContract.fromPartial({ + sender: this.sender, + contract: this.contractAddress, + msg: toUtf8(JSON.stringify({ + ownable: ownableMsg + })), + funds: _funds + }) + }; + }; + postDispatch = ({ + message, + metadata + }: { + message: HexBinary; + metadata: HexBinary; + }, _funds?: Coin[]): MsgExecuteContractEncodeObject => { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", + value: MsgExecuteContract.fromPartial({ + sender: this.sender, + contract: this.contractAddress, + msg: toUtf8(JSON.stringify({ + post_dispatch: { + message, + metadata + } + })), + funds: _funds + }) + }; + }; + router = (routerMsgForAddr: RouterMsgForAddr, _funds?: Coin[]): MsgExecuteContractEncodeObject => { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", + value: MsgExecuteContract.fromPartial({ + sender: this.sender, + contract: this.contractAddress, + msg: toUtf8(JSON.stringify({ + router: routerMsgForAddr + })), + funds: _funds + }) + }; + }; +} \ No newline at end of file diff --git a/ts/sdk/src/contracts/HookRouting.types.ts b/ts/sdk/src/contracts/HookRouting.types.ts new file mode 100644 index 00000000..58061753 --- /dev/null +++ b/ts/sdk/src/contracts/HookRouting.types.ts @@ -0,0 +1,109 @@ +/** +* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. +* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, +* and run the @cosmwasm/ts-codegen generate command to regenerate this file. +*/ + +export interface InstantiateMsg { + owner: string; +} +export type ExecuteMsg = { + ownable: OwnableMsg; +} | { + post_dispatch: PostDispatchMsg; +} | { + router: RouterMsgForAddr; +}; +export type OwnableMsg = { + init_ownership_transfer: { + next_owner: string; + }; +} | { + revoke_ownership_transfer: {}; +} | { + claim_ownership: {}; +}; +export type HexBinary = string; +export type RouterMsgForAddr = { + set_route: { + set: DomainRouteSetForAddr; + }; +} | { + set_routes: { + set: DomainRouteSetForAddr[]; + }; +}; +export type Addr = string; +export interface PostDispatchMsg { + message: HexBinary; + metadata: HexBinary; +} +export interface DomainRouteSetForAddr { + domain: number; + route?: Addr | null; +} +export type QueryMsg = { + ownable: OwnableQueryMsg; +} | { + router: RouterQueryForAddr; +} | { + hook: HookQueryMsg; +}; +export type OwnableQueryMsg = { + get_owner: {}; +} | { + get_pending_owner: {}; +}; +export type RouterQueryForAddr = { + domains: {}; +} | { + get_route: { + domain: number; + }; +} | { + list_routes: { + limit?: number | null; + offset?: number | null; + order?: Order | null; + }; +}; +export type Order = "asc" | "desc"; +export type HookQueryMsg = { + quote_dispatch: QuoteDispatchMsg; +} | { + mailbox: {}; +}; +export interface QuoteDispatchMsg { + message: HexBinary; + metadata: HexBinary; +} +export interface DomainsResponse { + domains: number[]; +} +export interface OwnerResponse { + owner: Addr; +} +export interface PendingOwnerResponse { + pending_owner?: Addr | null; +} +export interface RouteResponseForAddr { + route: DomainRouteSetForAddr; +} +export interface RoutesResponseForAddr { + routes: DomainRouteSetForAddr[]; +} +export interface MailboxResponse { + mailbox: string; +} +export interface Empty { + [k: string]: unknown; +} +export type Uint128 = string; +export interface QuoteDispatchResponse { + gas_amount?: Coin | null; +} +export interface Coin { + amount: Uint128; + denom: string; + [k: string]: unknown; +} \ No newline at end of file diff --git a/ts/sdk/src/contracts/HookRoutingCustom.client.ts b/ts/sdk/src/contracts/HookRoutingCustom.client.ts new file mode 100644 index 00000000..7f188c5f --- /dev/null +++ b/ts/sdk/src/contracts/HookRoutingCustom.client.ts @@ -0,0 +1,166 @@ +/** +* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. +* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, +* and run the @cosmwasm/ts-codegen generate command to regenerate this file. +*/ + +import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from "@cosmjs/cosmwasm-stargate"; +import { StdFee } from "@cosmjs/amino"; +import { InstantiateMsg, ExecuteMsg, OwnableMsg, HexBinary, RouterMsgForAddr, Addr, PostDispatchMsg, DomainRouteSetForAddr, RegisterCustomHookMsg, ClearCustomHookMsg, QueryMsg, OwnableQueryMsg, RouterQueryForAddr, Order, HookQueryMsg, CustomRoutingHookQueryMsg, QuoteDispatchMsg, CustomHookResponse, CustomHooksResponse, DomainsResponse, OwnerResponse, PendingOwnerResponse, RouteResponseForAddr, RoutesResponseForAddr, MailboxResponse, Empty, Uint128, QuoteDispatchResponse, Coin } from "./HookRoutingCustom.types"; +export interface HookRoutingCustomReadOnlyInterface { + contractAddress: string; + ownable: (ownableQueryMsg: OwnableQueryMsg) => Promise; + router: (routerQueryForAddr: RouterQueryForAddr) => Promise; + hook: (hookQueryMsg: HookQueryMsg) => Promise; + customRoutingHook: (customRoutingHookQueryMsg: CustomRoutingHookQueryMsg) => Promise; +} +export class HookRoutingCustomQueryClient implements HookRoutingCustomReadOnlyInterface { + client: CosmWasmClient; + contractAddress: string; + + constructor(client: CosmWasmClient, contractAddress: string) { + this.client = client; + this.contractAddress = contractAddress; + this.ownable = this.ownable.bind(this); + this.router = this.router.bind(this); + this.hook = this.hook.bind(this); + this.customRoutingHook = this.customRoutingHook.bind(this); + } + + ownable = async (ownableQueryMsg: OwnableQueryMsg): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + ownable: ownableQueryMsg + }); + }; + router = async (routerQueryForAddr: RouterQueryForAddr): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + router: routerQueryForAddr + }); + }; + hook = async (hookQueryMsg: HookQueryMsg): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + hook: hookQueryMsg + }); + }; + customRoutingHook = async (customRoutingHookQueryMsg: CustomRoutingHookQueryMsg): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + custom_routing_hook: customRoutingHookQueryMsg + }); + }; +} +export interface HookRoutingCustomInterface extends HookRoutingCustomReadOnlyInterface { + contractAddress: string; + sender: string; + ownable: (ownableMsg: OwnableMsg, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + postDispatch: ({ + message, + metadata + }: { + message: HexBinary; + metadata: HexBinary; + }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + router: (routerMsgForAddr: RouterMsgForAddr, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + registerCustomHook: ({ + destDomain, + hook, + recipient + }: { + destDomain: number; + hook: string; + recipient: string; + }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + registerCustomHooks: (fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + clearCustomHook: ({ + destDomain, + recipient + }: { + destDomain: number; + recipient: string; + }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + clearCustomHooks: (fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; +} +export class HookRoutingCustomClient extends HookRoutingCustomQueryClient implements HookRoutingCustomInterface { + client: SigningCosmWasmClient; + sender: string; + contractAddress: string; + + constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string) { + super(client, contractAddress); + this.client = client; + this.sender = sender; + this.contractAddress = contractAddress; + this.ownable = this.ownable.bind(this); + this.postDispatch = this.postDispatch.bind(this); + this.router = this.router.bind(this); + this.registerCustomHook = this.registerCustomHook.bind(this); + this.registerCustomHooks = this.registerCustomHooks.bind(this); + this.clearCustomHook = this.clearCustomHook.bind(this); + this.clearCustomHooks = this.clearCustomHooks.bind(this); + } + + ownable = async (ownableMsg: OwnableMsg, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + ownable: ownableMsg + }, fee, memo, _funds); + }; + postDispatch = async ({ + message, + metadata + }: { + message: HexBinary; + metadata: HexBinary; + }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + post_dispatch: { + message, + metadata + } + }, fee, memo, _funds); + }; + router = async (routerMsgForAddr: RouterMsgForAddr, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + router: routerMsgForAddr + }, fee, memo, _funds); + }; + registerCustomHook = async ({ + destDomain, + hook, + recipient + }: { + destDomain: number; + hook: string; + recipient: string; + }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + register_custom_hook: { + dest_domain: destDomain, + hook, + recipient + } + }, fee, memo, _funds); + }; + registerCustomHooks = async (fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + register_custom_hooks: {} + }, fee, memo, _funds); + }; + clearCustomHook = async ({ + destDomain, + recipient + }: { + destDomain: number; + recipient: string; + }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + clear_custom_hook: { + dest_domain: destDomain, + recipient + } + }, fee, memo, _funds); + }; + clearCustomHooks = async (fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + clear_custom_hooks: {} + }, fee, memo, _funds); + }; +} \ No newline at end of file diff --git a/ts/sdk/src/contracts/HookRoutingCustom.message-composer.ts b/ts/sdk/src/contracts/HookRoutingCustom.message-composer.ts new file mode 100644 index 00000000..d8ba97b7 --- /dev/null +++ b/ts/sdk/src/contracts/HookRoutingCustom.message-composer.ts @@ -0,0 +1,179 @@ +/** +* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. +* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, +* and run the @cosmwasm/ts-codegen generate command to regenerate this file. +*/ + +import { MsgExecuteContractEncodeObject } from "@cosmjs/cosmwasm-stargate"; +import { MsgExecuteContract } from "cosmjs-types/cosmwasm/wasm/v1/tx"; +import { toUtf8 } from "@cosmjs/encoding"; +import { InstantiateMsg, ExecuteMsg, OwnableMsg, HexBinary, RouterMsgForAddr, Addr, PostDispatchMsg, DomainRouteSetForAddr, RegisterCustomHookMsg, ClearCustomHookMsg, QueryMsg, OwnableQueryMsg, RouterQueryForAddr, Order, HookQueryMsg, CustomRoutingHookQueryMsg, QuoteDispatchMsg, CustomHookResponse, CustomHooksResponse, DomainsResponse, OwnerResponse, PendingOwnerResponse, RouteResponseForAddr, RoutesResponseForAddr, MailboxResponse, Empty, Uint128, QuoteDispatchResponse, Coin } from "./HookRoutingCustom.types"; +export interface HookRoutingCustomMsg { + contractAddress: string; + sender: string; + ownable: (ownableMsg: OwnableMsg, _funds?: Coin[]) => MsgExecuteContractEncodeObject; + postDispatch: ({ + message, + metadata + }: { + message: HexBinary; + metadata: HexBinary; + }, _funds?: Coin[]) => MsgExecuteContractEncodeObject; + router: (routerMsgForAddr: RouterMsgForAddr, _funds?: Coin[]) => MsgExecuteContractEncodeObject; + registerCustomHook: ({ + destDomain, + hook, + recipient + }: { + destDomain: number; + hook: string; + recipient: string; + }, _funds?: Coin[]) => MsgExecuteContractEncodeObject; + registerCustomHooks: (_funds?: Coin[]) => MsgExecuteContractEncodeObject; + clearCustomHook: ({ + destDomain, + recipient + }: { + destDomain: number; + recipient: string; + }, _funds?: Coin[]) => MsgExecuteContractEncodeObject; + clearCustomHooks: (_funds?: Coin[]) => MsgExecuteContractEncodeObject; +} +export class HookRoutingCustomMsgComposer implements HookRoutingCustomMsg { + sender: string; + contractAddress: string; + + constructor(sender: string, contractAddress: string) { + this.sender = sender; + this.contractAddress = contractAddress; + this.ownable = this.ownable.bind(this); + this.postDispatch = this.postDispatch.bind(this); + this.router = this.router.bind(this); + this.registerCustomHook = this.registerCustomHook.bind(this); + this.registerCustomHooks = this.registerCustomHooks.bind(this); + this.clearCustomHook = this.clearCustomHook.bind(this); + this.clearCustomHooks = this.clearCustomHooks.bind(this); + } + + ownable = (ownableMsg: OwnableMsg, _funds?: Coin[]): MsgExecuteContractEncodeObject => { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", + value: MsgExecuteContract.fromPartial({ + sender: this.sender, + contract: this.contractAddress, + msg: toUtf8(JSON.stringify({ + ownable: ownableMsg + })), + funds: _funds + }) + }; + }; + postDispatch = ({ + message, + metadata + }: { + message: HexBinary; + metadata: HexBinary; + }, _funds?: Coin[]): MsgExecuteContractEncodeObject => { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", + value: MsgExecuteContract.fromPartial({ + sender: this.sender, + contract: this.contractAddress, + msg: toUtf8(JSON.stringify({ + post_dispatch: { + message, + metadata + } + })), + funds: _funds + }) + }; + }; + router = (routerMsgForAddr: RouterMsgForAddr, _funds?: Coin[]): MsgExecuteContractEncodeObject => { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", + value: MsgExecuteContract.fromPartial({ + sender: this.sender, + contract: this.contractAddress, + msg: toUtf8(JSON.stringify({ + router: routerMsgForAddr + })), + funds: _funds + }) + }; + }; + registerCustomHook = ({ + destDomain, + hook, + recipient + }: { + destDomain: number; + hook: string; + recipient: string; + }, _funds?: Coin[]): MsgExecuteContractEncodeObject => { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", + value: MsgExecuteContract.fromPartial({ + sender: this.sender, + contract: this.contractAddress, + msg: toUtf8(JSON.stringify({ + register_custom_hook: { + dest_domain: destDomain, + hook, + recipient + } + })), + funds: _funds + }) + }; + }; + registerCustomHooks = (_funds?: Coin[]): MsgExecuteContractEncodeObject => { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", + value: MsgExecuteContract.fromPartial({ + sender: this.sender, + contract: this.contractAddress, + msg: toUtf8(JSON.stringify({ + register_custom_hooks: {} + })), + funds: _funds + }) + }; + }; + clearCustomHook = ({ + destDomain, + recipient + }: { + destDomain: number; + recipient: string; + }, _funds?: Coin[]): MsgExecuteContractEncodeObject => { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", + value: MsgExecuteContract.fromPartial({ + sender: this.sender, + contract: this.contractAddress, + msg: toUtf8(JSON.stringify({ + clear_custom_hook: { + dest_domain: destDomain, + recipient + } + })), + funds: _funds + }) + }; + }; + clearCustomHooks = (_funds?: Coin[]): MsgExecuteContractEncodeObject => { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", + value: MsgExecuteContract.fromPartial({ + sender: this.sender, + contract: this.contractAddress, + msg: toUtf8(JSON.stringify({ + clear_custom_hooks: {} + })), + funds: _funds + }) + }; + }; +} \ No newline at end of file diff --git a/ts/sdk/src/contracts/HookRoutingCustom.types.ts b/ts/sdk/src/contracts/HookRoutingCustom.types.ts new file mode 100644 index 00000000..d501ae08 --- /dev/null +++ b/ts/sdk/src/contracts/HookRoutingCustom.types.ts @@ -0,0 +1,149 @@ +/** +* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. +* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, +* and run the @cosmwasm/ts-codegen generate command to regenerate this file. +*/ + +export interface InstantiateMsg { + owner: string; +} +export type ExecuteMsg = { + ownable: OwnableMsg; +} | { + post_dispatch: PostDispatchMsg; +} | { + router: RouterMsgForAddr; +} | { + register_custom_hook: RegisterCustomHookMsg; +} | { + register_custom_hooks: RegisterCustomHookMsg[]; +} | { + clear_custom_hook: ClearCustomHookMsg; +} | { + clear_custom_hooks: ClearCustomHookMsg[]; +}; +export type OwnableMsg = { + init_ownership_transfer: { + next_owner: string; + }; +} | { + revoke_ownership_transfer: {}; +} | { + claim_ownership: {}; +}; +export type HexBinary = string; +export type RouterMsgForAddr = { + set_route: { + set: DomainRouteSetForAddr; + }; +} | { + set_routes: { + set: DomainRouteSetForAddr[]; + }; +}; +export type Addr = string; +export interface PostDispatchMsg { + message: HexBinary; + metadata: HexBinary; +} +export interface DomainRouteSetForAddr { + domain: number; + route?: Addr | null; +} +export interface RegisterCustomHookMsg { + dest_domain: number; + hook: string; + recipient: string; +} +export interface ClearCustomHookMsg { + dest_domain: number; + recipient: string; +} +export type QueryMsg = { + ownable: OwnableQueryMsg; +} | { + router: RouterQueryForAddr; +} | { + hook: HookQueryMsg; +} | { + custom_routing_hook: CustomRoutingHookQueryMsg; +}; +export type OwnableQueryMsg = { + get_owner: {}; +} | { + get_pending_owner: {}; +}; +export type RouterQueryForAddr = { + domains: {}; +} | { + get_route: { + domain: number; + }; +} | { + list_routes: { + limit?: number | null; + offset?: number | null; + order?: Order | null; + }; +}; +export type Order = "asc" | "desc"; +export type HookQueryMsg = { + quote_dispatch: QuoteDispatchMsg; +} | { + mailbox: {}; +}; +export type CustomRoutingHookQueryMsg = { + custom_hook: { + dest_domain: number; + recipient: string; + }; +} | { + custom_hooks: { + dest_domain: number; + limit?: number | null; + offset?: string | null; + order?: Order | null; + }; +}; +export interface QuoteDispatchMsg { + message: HexBinary; + metadata: HexBinary; +} +export interface CustomHookResponse { + dest_domain: number; + hook: string; + recipient: string; +} +export interface CustomHooksResponse { + custom_hooks: CustomHookResponse[]; +} +export interface DomainsResponse { + domains: number[]; +} +export interface OwnerResponse { + owner: Addr; +} +export interface PendingOwnerResponse { + pending_owner?: Addr | null; +} +export interface RouteResponseForAddr { + route: DomainRouteSetForAddr; +} +export interface RoutesResponseForAddr { + routes: DomainRouteSetForAddr[]; +} +export interface MailboxResponse { + mailbox: string; +} +export interface Empty { + [k: string]: unknown; +} +export type Uint128 = string; +export interface QuoteDispatchResponse { + gas_amount?: Coin | null; +} +export interface Coin { + amount: Uint128; + denom: string; + [k: string]: unknown; +} \ No newline at end of file diff --git a/ts/sdk/src/contracts/HookRoutingFallback.client.ts b/ts/sdk/src/contracts/HookRoutingFallback.client.ts new file mode 100644 index 00000000..b45ade38 --- /dev/null +++ b/ts/sdk/src/contracts/HookRoutingFallback.client.ts @@ -0,0 +1,113 @@ +/** +* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. +* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, +* and run the @cosmwasm/ts-codegen generate command to regenerate this file. +*/ + +import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from "@cosmjs/cosmwasm-stargate"; +import { StdFee } from "@cosmjs/amino"; +import { InstantiateMsg, ExecuteMsg, OwnableMsg, HexBinary, RouterMsgForAddr, Addr, PostDispatchMsg, DomainRouteSetForAddr, QueryMsg, OwnableQueryMsg, RouterQueryForAddr, Order, HookQueryMsg, QuoteDispatchMsg, DomainsResponse, OwnerResponse, PendingOwnerResponse, RouteResponseForAddr, RoutesResponseForAddr, MailboxResponse, Empty, Uint128, QuoteDispatchResponse, Coin } from "./HookRoutingFallback.types"; +export interface HookRoutingFallbackReadOnlyInterface { + contractAddress: string; + ownable: (ownableQueryMsg: OwnableQueryMsg) => Promise; + router: (routerQueryForAddr: RouterQueryForAddr) => Promise; + hook: (hookQueryMsg: HookQueryMsg) => Promise; +} +export class HookRoutingFallbackQueryClient implements HookRoutingFallbackReadOnlyInterface { + client: CosmWasmClient; + contractAddress: string; + + constructor(client: CosmWasmClient, contractAddress: string) { + this.client = client; + this.contractAddress = contractAddress; + this.ownable = this.ownable.bind(this); + this.router = this.router.bind(this); + this.hook = this.hook.bind(this); + } + + ownable = async (ownableQueryMsg: OwnableQueryMsg): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + ownable: ownableQueryMsg + }); + }; + router = async (routerQueryForAddr: RouterQueryForAddr): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + router: routerQueryForAddr + }); + }; + hook = async (hookQueryMsg: HookQueryMsg): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + hook: hookQueryMsg + }); + }; +} +export interface HookRoutingFallbackInterface extends HookRoutingFallbackReadOnlyInterface { + contractAddress: string; + sender: string; + ownable: (ownableMsg: OwnableMsg, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + postDispatch: ({ + message, + metadata + }: { + message: HexBinary; + metadata: HexBinary; + }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + router: (routerMsgForAddr: RouterMsgForAddr, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + setFallbackHook: ({ + hook + }: { + hook: string; + }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; +} +export class HookRoutingFallbackClient extends HookRoutingFallbackQueryClient implements HookRoutingFallbackInterface { + client: SigningCosmWasmClient; + sender: string; + contractAddress: string; + + constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string) { + super(client, contractAddress); + this.client = client; + this.sender = sender; + this.contractAddress = contractAddress; + this.ownable = this.ownable.bind(this); + this.postDispatch = this.postDispatch.bind(this); + this.router = this.router.bind(this); + this.setFallbackHook = this.setFallbackHook.bind(this); + } + + ownable = async (ownableMsg: OwnableMsg, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + ownable: ownableMsg + }, fee, memo, _funds); + }; + postDispatch = async ({ + message, + metadata + }: { + message: HexBinary; + metadata: HexBinary; + }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + post_dispatch: { + message, + metadata + } + }, fee, memo, _funds); + }; + router = async (routerMsgForAddr: RouterMsgForAddr, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + router: routerMsgForAddr + }, fee, memo, _funds); + }; + setFallbackHook = async ({ + hook + }: { + hook: string; + }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + set_fallback_hook: { + hook + } + }, fee, memo, _funds); + }; +} \ No newline at end of file diff --git a/ts/sdk/src/contracts/HookRoutingFallback.message-composer.ts b/ts/sdk/src/contracts/HookRoutingFallback.message-composer.ts new file mode 100644 index 00000000..d1b12397 --- /dev/null +++ b/ts/sdk/src/contracts/HookRoutingFallback.message-composer.ts @@ -0,0 +1,109 @@ +/** +* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. +* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, +* and run the @cosmwasm/ts-codegen generate command to regenerate this file. +*/ + +import { MsgExecuteContractEncodeObject } from "@cosmjs/cosmwasm-stargate"; +import { MsgExecuteContract } from "cosmjs-types/cosmwasm/wasm/v1/tx"; +import { toUtf8 } from "@cosmjs/encoding"; +import { InstantiateMsg, ExecuteMsg, OwnableMsg, HexBinary, RouterMsgForAddr, Addr, PostDispatchMsg, DomainRouteSetForAddr, QueryMsg, OwnableQueryMsg, RouterQueryForAddr, Order, HookQueryMsg, QuoteDispatchMsg, DomainsResponse, OwnerResponse, PendingOwnerResponse, RouteResponseForAddr, RoutesResponseForAddr, MailboxResponse, Empty, Uint128, QuoteDispatchResponse, Coin } from "./HookRoutingFallback.types"; +export interface HookRoutingFallbackMsg { + contractAddress: string; + sender: string; + ownable: (ownableMsg: OwnableMsg, _funds?: Coin[]) => MsgExecuteContractEncodeObject; + postDispatch: ({ + message, + metadata + }: { + message: HexBinary; + metadata: HexBinary; + }, _funds?: Coin[]) => MsgExecuteContractEncodeObject; + router: (routerMsgForAddr: RouterMsgForAddr, _funds?: Coin[]) => MsgExecuteContractEncodeObject; + setFallbackHook: ({ + hook + }: { + hook: string; + }, _funds?: Coin[]) => MsgExecuteContractEncodeObject; +} +export class HookRoutingFallbackMsgComposer implements HookRoutingFallbackMsg { + sender: string; + contractAddress: string; + + constructor(sender: string, contractAddress: string) { + this.sender = sender; + this.contractAddress = contractAddress; + this.ownable = this.ownable.bind(this); + this.postDispatch = this.postDispatch.bind(this); + this.router = this.router.bind(this); + this.setFallbackHook = this.setFallbackHook.bind(this); + } + + ownable = (ownableMsg: OwnableMsg, _funds?: Coin[]): MsgExecuteContractEncodeObject => { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", + value: MsgExecuteContract.fromPartial({ + sender: this.sender, + contract: this.contractAddress, + msg: toUtf8(JSON.stringify({ + ownable: ownableMsg + })), + funds: _funds + }) + }; + }; + postDispatch = ({ + message, + metadata + }: { + message: HexBinary; + metadata: HexBinary; + }, _funds?: Coin[]): MsgExecuteContractEncodeObject => { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", + value: MsgExecuteContract.fromPartial({ + sender: this.sender, + contract: this.contractAddress, + msg: toUtf8(JSON.stringify({ + post_dispatch: { + message, + metadata + } + })), + funds: _funds + }) + }; + }; + router = (routerMsgForAddr: RouterMsgForAddr, _funds?: Coin[]): MsgExecuteContractEncodeObject => { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", + value: MsgExecuteContract.fromPartial({ + sender: this.sender, + contract: this.contractAddress, + msg: toUtf8(JSON.stringify({ + router: routerMsgForAddr + })), + funds: _funds + }) + }; + }; + setFallbackHook = ({ + hook + }: { + hook: string; + }, _funds?: Coin[]): MsgExecuteContractEncodeObject => { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", + value: MsgExecuteContract.fromPartial({ + sender: this.sender, + contract: this.contractAddress, + msg: toUtf8(JSON.stringify({ + set_fallback_hook: { + hook + } + })), + funds: _funds + }) + }; + }; +} \ No newline at end of file diff --git a/ts/sdk/src/contracts/HookRoutingFallback.types.ts b/ts/sdk/src/contracts/HookRoutingFallback.types.ts new file mode 100644 index 00000000..df30de08 --- /dev/null +++ b/ts/sdk/src/contracts/HookRoutingFallback.types.ts @@ -0,0 +1,113 @@ +/** +* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. +* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, +* and run the @cosmwasm/ts-codegen generate command to regenerate this file. +*/ + +export interface InstantiateMsg { + owner: string; +} +export type ExecuteMsg = { + ownable: OwnableMsg; +} | { + post_dispatch: PostDispatchMsg; +} | { + router: RouterMsgForAddr; +} | { + set_fallback_hook: { + hook: string; + }; +}; +export type OwnableMsg = { + init_ownership_transfer: { + next_owner: string; + }; +} | { + revoke_ownership_transfer: {}; +} | { + claim_ownership: {}; +}; +export type HexBinary = string; +export type RouterMsgForAddr = { + set_route: { + set: DomainRouteSetForAddr; + }; +} | { + set_routes: { + set: DomainRouteSetForAddr[]; + }; +}; +export type Addr = string; +export interface PostDispatchMsg { + message: HexBinary; + metadata: HexBinary; +} +export interface DomainRouteSetForAddr { + domain: number; + route?: Addr | null; +} +export type QueryMsg = { + ownable: OwnableQueryMsg; +} | { + router: RouterQueryForAddr; +} | { + hook: HookQueryMsg; +}; +export type OwnableQueryMsg = { + get_owner: {}; +} | { + get_pending_owner: {}; +}; +export type RouterQueryForAddr = { + domains: {}; +} | { + get_route: { + domain: number; + }; +} | { + list_routes: { + limit?: number | null; + offset?: number | null; + order?: Order | null; + }; +}; +export type Order = "asc" | "desc"; +export type HookQueryMsg = { + quote_dispatch: QuoteDispatchMsg; +} | { + mailbox: {}; +}; +export interface QuoteDispatchMsg { + message: HexBinary; + metadata: HexBinary; +} +export interface DomainsResponse { + domains: number[]; +} +export interface OwnerResponse { + owner: Addr; +} +export interface PendingOwnerResponse { + pending_owner?: Addr | null; +} +export interface RouteResponseForAddr { + route: DomainRouteSetForAddr; +} +export interface RoutesResponseForAddr { + routes: DomainRouteSetForAddr[]; +} +export interface MailboxResponse { + mailbox: string; +} +export interface Empty { + [k: string]: unknown; +} +export type Uint128 = string; +export interface QuoteDispatchResponse { + gas_amount?: Coin | null; +} +export interface Coin { + amount: Uint128; + denom: string; + [k: string]: unknown; +} \ No newline at end of file diff --git a/ts/sdk/src/contracts/Hub.client.ts b/ts/sdk/src/contracts/Hub.client.ts deleted file mode 100644 index de9a3790..00000000 --- a/ts/sdk/src/contracts/Hub.client.ts +++ /dev/null @@ -1,75 +0,0 @@ -/** -* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5. -* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, -* and run the @cosmwasm/ts-codegen generate command to regenerate this file. -*/ - -import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from "@cosmjs/cosmwasm-stargate"; -import { Coin, StdFee } from "@cosmjs/amino"; -import { InstantiateMsg, ExecuteMsg, QueryMsg, MigrateMsg, OriginDomainResponse } from "./Hub.types"; -export interface HubReadOnlyInterface { - contractAddress: string; - originDomain: () => Promise; -} -export class HubQueryClient implements HubReadOnlyInterface { - client: CosmWasmClient; - contractAddress: string; - - constructor(client: CosmWasmClient, contractAddress: string) { - this.client = client; - this.contractAddress = contractAddress; - this.originDomain = this.originDomain.bind(this); - } - - originDomain = async (): Promise => { - return this.client.queryContractSmart(this.contractAddress, { - origin_domain: {} - }); - }; -} -export interface HubInterface extends HubReadOnlyInterface { - contractAddress: string; - sender: string; - instantiate: ({ - defaultIsm, - owner - }: { - defaultIsm: string; - owner: string; - }, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; - migrate: (fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; -} -export class HubClient extends HubQueryClient implements HubInterface { - client: SigningCosmWasmClient; - sender: string; - contractAddress: string; - - constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string) { - super(client, contractAddress); - this.client = client; - this.sender = sender; - this.contractAddress = contractAddress; - this.instantiate = this.instantiate.bind(this); - this.migrate = this.migrate.bind(this); - } - - instantiate = async ({ - defaultIsm, - owner - }: { - defaultIsm: string; - owner: string; - }, fee: number | StdFee | "auto" = "auto", memo?: string, funds?: Coin[]): Promise => { - return await this.client.execute(this.sender, this.contractAddress, { - instantiate: { - default_ism: defaultIsm, - owner - } - }, fee, memo, funds); - }; - migrate = async (fee: number | StdFee | "auto" = "auto", memo?: string, funds?: Coin[]): Promise => { - return await this.client.execute(this.sender, this.contractAddress, { - migrate: {} - }, fee, memo, funds); - }; -} \ No newline at end of file diff --git a/ts/sdk/src/contracts/Hub.types.ts b/ts/sdk/src/contracts/Hub.types.ts deleted file mode 100644 index 80fa00c1..00000000 --- a/ts/sdk/src/contracts/Hub.types.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** -* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5. -* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, -* and run the @cosmwasm/ts-codegen generate command to regenerate this file. -*/ - -export interface InstantiateMsg { - mailbox_code: number; - origin_domain: number; -} -export type ExecuteMsg = { - instantiate: { - default_ism: string; - owner: string; - }; -} | { - migrate: {}; -}; -export type QueryMsg = { - origin_domain: {}; -}; -export interface MigrateMsg {} -export interface OriginDomainResponse { - domain: number; -} \ No newline at end of file diff --git a/ts/sdk/src/contracts/Igp.client.ts b/ts/sdk/src/contracts/Igp.client.ts new file mode 100644 index 00000000..45544b63 --- /dev/null +++ b/ts/sdk/src/contracts/Igp.client.ts @@ -0,0 +1,166 @@ +/** +* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. +* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, +* and run the @cosmwasm/ts-codegen generate command to regenerate this file. +*/ + +import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from "@cosmjs/cosmwasm-stargate"; +import { StdFee } from "@cosmjs/amino"; +import { InstantiateMsg, ExecuteMsg, OwnableMsg, RouterMsgForAddr, Addr, HexBinary, Uint256, DomainRouteSetForAddr, PostDispatchMsg, QueryMsg, OwnableQueryMsg, HookQueryMsg, RouterQueryForAddr, Order, IgpGasOracleQueryMsg, IgpQueryMsg, QuoteDispatchMsg, BeneficiaryResponse, DomainsResponse, Uint128, GetExchangeRateAndGasPriceResponse, OwnerResponse, PendingOwnerResponse, RouteResponseForAddr, RoutesResponseForAddr, MailboxResponse, Empty, QuoteDispatchResponse, Coin, QuoteGasPaymentResponse } from "./Igp.types"; +export interface IgpReadOnlyInterface { + contractAddress: string; + ownable: (ownableQueryMsg: OwnableQueryMsg) => Promise; + hook: (hookQueryMsg: HookQueryMsg) => Promise; + router: (routerQueryForAddr: RouterQueryForAddr) => Promise; + oracle: (igpGasOracleQueryMsg: IgpGasOracleQueryMsg) => Promise; + igp: (igpQueryMsg: IgpQueryMsg) => Promise; +} +export class IgpQueryClient implements IgpReadOnlyInterface { + client: CosmWasmClient; + contractAddress: string; + + constructor(client: CosmWasmClient, contractAddress: string) { + this.client = client; + this.contractAddress = contractAddress; + this.ownable = this.ownable.bind(this); + this.hook = this.hook.bind(this); + this.router = this.router.bind(this); + this.oracle = this.oracle.bind(this); + this.igp = this.igp.bind(this); + } + + ownable = async (ownableQueryMsg: OwnableQueryMsg): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + ownable: ownableQueryMsg + }); + }; + hook = async (hookQueryMsg: HookQueryMsg): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + hook: hookQueryMsg + }); + }; + router = async (routerQueryForAddr: RouterQueryForAddr): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + router: routerQueryForAddr + }); + }; + oracle = async (igpGasOracleQueryMsg: IgpGasOracleQueryMsg): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + oracle: igpGasOracleQueryMsg + }); + }; + igp = async (igpQueryMsg: IgpQueryMsg): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + igp: igpQueryMsg + }); + }; +} +export interface IgpInterface extends IgpReadOnlyInterface { + contractAddress: string; + sender: string; + ownable: (ownableMsg: OwnableMsg, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + router: (routerMsgForAddr: RouterMsgForAddr, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + postDispatch: ({ + message, + metadata + }: { + message: HexBinary; + metadata: HexBinary; + }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + setBeneficiary: ({ + beneficiary + }: { + beneficiary: string; + }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + payForGas: ({ + destDomain, + gasAmount, + messageId, + refundAddress + }: { + destDomain: number; + gasAmount: Uint256; + messageId: HexBinary; + refundAddress: string; + }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + claim: (fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; +} +export class IgpClient extends IgpQueryClient implements IgpInterface { + client: SigningCosmWasmClient; + sender: string; + contractAddress: string; + + constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string) { + super(client, contractAddress); + this.client = client; + this.sender = sender; + this.contractAddress = contractAddress; + this.ownable = this.ownable.bind(this); + this.router = this.router.bind(this); + this.postDispatch = this.postDispatch.bind(this); + this.setBeneficiary = this.setBeneficiary.bind(this); + this.payForGas = this.payForGas.bind(this); + this.claim = this.claim.bind(this); + } + + ownable = async (ownableMsg: OwnableMsg, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + ownable: ownableMsg + }, fee, memo, _funds); + }; + router = async (routerMsgForAddr: RouterMsgForAddr, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + router: routerMsgForAddr + }, fee, memo, _funds); + }; + postDispatch = async ({ + message, + metadata + }: { + message: HexBinary; + metadata: HexBinary; + }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + post_dispatch: { + message, + metadata + } + }, fee, memo, _funds); + }; + setBeneficiary = async ({ + beneficiary + }: { + beneficiary: string; + }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + set_beneficiary: { + beneficiary + } + }, fee, memo, _funds); + }; + payForGas = async ({ + destDomain, + gasAmount, + messageId, + refundAddress + }: { + destDomain: number; + gasAmount: Uint256; + messageId: HexBinary; + refundAddress: string; + }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + pay_for_gas: { + dest_domain: destDomain, + gas_amount: gasAmount, + message_id: messageId, + refund_address: refundAddress + } + }, fee, memo, _funds); + }; + claim = async (fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + claim: {} + }, fee, memo, _funds); + }; +} \ No newline at end of file diff --git a/ts/sdk/src/contracts/Igp.message-composer.ts b/ts/sdk/src/contracts/Igp.message-composer.ts new file mode 100644 index 00000000..4539cd6c --- /dev/null +++ b/ts/sdk/src/contracts/Igp.message-composer.ts @@ -0,0 +1,164 @@ +/** +* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. +* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, +* and run the @cosmwasm/ts-codegen generate command to regenerate this file. +*/ + +import { MsgExecuteContractEncodeObject } from "@cosmjs/cosmwasm-stargate"; +import { MsgExecuteContract } from "cosmjs-types/cosmwasm/wasm/v1/tx"; +import { toUtf8 } from "@cosmjs/encoding"; +import { InstantiateMsg, ExecuteMsg, OwnableMsg, RouterMsgForAddr, Addr, HexBinary, Uint256, DomainRouteSetForAddr, PostDispatchMsg, QueryMsg, OwnableQueryMsg, HookQueryMsg, RouterQueryForAddr, Order, IgpGasOracleQueryMsg, IgpQueryMsg, QuoteDispatchMsg, BeneficiaryResponse, DomainsResponse, Uint128, GetExchangeRateAndGasPriceResponse, OwnerResponse, PendingOwnerResponse, RouteResponseForAddr, RoutesResponseForAddr, MailboxResponse, Empty, QuoteDispatchResponse, Coin, QuoteGasPaymentResponse } from "./Igp.types"; +export interface IgpMsg { + contractAddress: string; + sender: string; + ownable: (ownableMsg: OwnableMsg, _funds?: Coin[]) => MsgExecuteContractEncodeObject; + router: (routerMsgForAddr: RouterMsgForAddr, _funds?: Coin[]) => MsgExecuteContractEncodeObject; + postDispatch: ({ + message, + metadata + }: { + message: HexBinary; + metadata: HexBinary; + }, _funds?: Coin[]) => MsgExecuteContractEncodeObject; + setBeneficiary: ({ + beneficiary + }: { + beneficiary: string; + }, _funds?: Coin[]) => MsgExecuteContractEncodeObject; + payForGas: ({ + destDomain, + gasAmount, + messageId, + refundAddress + }: { + destDomain: number; + gasAmount: Uint256; + messageId: HexBinary; + refundAddress: string; + }, _funds?: Coin[]) => MsgExecuteContractEncodeObject; + claim: (_funds?: Coin[]) => MsgExecuteContractEncodeObject; +} +export class IgpMsgComposer implements IgpMsg { + sender: string; + contractAddress: string; + + constructor(sender: string, contractAddress: string) { + this.sender = sender; + this.contractAddress = contractAddress; + this.ownable = this.ownable.bind(this); + this.router = this.router.bind(this); + this.postDispatch = this.postDispatch.bind(this); + this.setBeneficiary = this.setBeneficiary.bind(this); + this.payForGas = this.payForGas.bind(this); + this.claim = this.claim.bind(this); + } + + ownable = (ownableMsg: OwnableMsg, _funds?: Coin[]): MsgExecuteContractEncodeObject => { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", + value: MsgExecuteContract.fromPartial({ + sender: this.sender, + contract: this.contractAddress, + msg: toUtf8(JSON.stringify({ + ownable: ownableMsg + })), + funds: _funds + }) + }; + }; + router = (routerMsgForAddr: RouterMsgForAddr, _funds?: Coin[]): MsgExecuteContractEncodeObject => { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", + value: MsgExecuteContract.fromPartial({ + sender: this.sender, + contract: this.contractAddress, + msg: toUtf8(JSON.stringify({ + router: routerMsgForAddr + })), + funds: _funds + }) + }; + }; + postDispatch = ({ + message, + metadata + }: { + message: HexBinary; + metadata: HexBinary; + }, _funds?: Coin[]): MsgExecuteContractEncodeObject => { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", + value: MsgExecuteContract.fromPartial({ + sender: this.sender, + contract: this.contractAddress, + msg: toUtf8(JSON.stringify({ + post_dispatch: { + message, + metadata + } + })), + funds: _funds + }) + }; + }; + setBeneficiary = ({ + beneficiary + }: { + beneficiary: string; + }, _funds?: Coin[]): MsgExecuteContractEncodeObject => { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", + value: MsgExecuteContract.fromPartial({ + sender: this.sender, + contract: this.contractAddress, + msg: toUtf8(JSON.stringify({ + set_beneficiary: { + beneficiary + } + })), + funds: _funds + }) + }; + }; + payForGas = ({ + destDomain, + gasAmount, + messageId, + refundAddress + }: { + destDomain: number; + gasAmount: Uint256; + messageId: HexBinary; + refundAddress: string; + }, _funds?: Coin[]): MsgExecuteContractEncodeObject => { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", + value: MsgExecuteContract.fromPartial({ + sender: this.sender, + contract: this.contractAddress, + msg: toUtf8(JSON.stringify({ + pay_for_gas: { + dest_domain: destDomain, + gas_amount: gasAmount, + message_id: messageId, + refund_address: refundAddress + } + })), + funds: _funds + }) + }; + }; + claim = (_funds?: Coin[]): MsgExecuteContractEncodeObject => { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", + value: MsgExecuteContract.fromPartial({ + sender: this.sender, + contract: this.contractAddress, + msg: toUtf8(JSON.stringify({ + claim: {} + })), + funds: _funds + }) + }; + }; +} \ No newline at end of file diff --git a/ts/sdk/src/contracts/Igp.types.ts b/ts/sdk/src/contracts/Igp.types.ts new file mode 100644 index 00000000..504ede4b --- /dev/null +++ b/ts/sdk/src/contracts/Igp.types.ts @@ -0,0 +1,153 @@ +/** +* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. +* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, +* and run the @cosmwasm/ts-codegen generate command to regenerate this file. +*/ + +export interface InstantiateMsg { + beneficiary: string; + gas_token: string; + hrp: string; + owner: string; +} +export type ExecuteMsg = { + ownable: OwnableMsg; +} | { + router: RouterMsgForAddr; +} | { + post_dispatch: PostDispatchMsg; +} | { + set_beneficiary: { + beneficiary: string; + }; +} | { + pay_for_gas: { + dest_domain: number; + gas_amount: Uint256; + message_id: HexBinary; + refund_address: string; + }; +} | { + claim: {}; +}; +export type OwnableMsg = { + init_ownership_transfer: { + next_owner: string; + }; +} | { + revoke_ownership_transfer: {}; +} | { + claim_ownership: {}; +}; +export type RouterMsgForAddr = { + set_route: { + set: DomainRouteSetForAddr; + }; +} | { + set_routes: { + set: DomainRouteSetForAddr[]; + }; +}; +export type Addr = string; +export type HexBinary = string; +export type Uint256 = string; +export interface DomainRouteSetForAddr { + domain: number; + route?: Addr | null; +} +export interface PostDispatchMsg { + message: HexBinary; + metadata: HexBinary; +} +export type QueryMsg = { + ownable: OwnableQueryMsg; +} | { + hook: HookQueryMsg; +} | { + router: RouterQueryForAddr; +} | { + oracle: IgpGasOracleQueryMsg; +} | { + igp: IgpQueryMsg; +}; +export type OwnableQueryMsg = { + get_owner: {}; +} | { + get_pending_owner: {}; +}; +export type HookQueryMsg = { + quote_dispatch: QuoteDispatchMsg; +} | { + mailbox: {}; +}; +export type RouterQueryForAddr = { + domains: {}; +} | { + get_route: { + domain: number; + }; +} | { + list_routes: { + limit?: number | null; + offset?: number | null; + order?: Order | null; + }; +}; +export type Order = "asc" | "desc"; +export type IgpGasOracleQueryMsg = { + get_exchange_rate_and_gas_price: { + dest_domain: number; + }; +}; +export type IgpQueryMsg = { + beneficiary: {}; +} | { + quote_gas_payment: { + dest_domain: number; + gas_amount: Uint256; + }; +}; +export interface QuoteDispatchMsg { + message: HexBinary; + metadata: HexBinary; +} +export interface BeneficiaryResponse { + beneficiary: string; +} +export interface DomainsResponse { + domains: number[]; +} +export type Uint128 = string; +export interface GetExchangeRateAndGasPriceResponse { + exchange_rate: Uint128; + gas_price: Uint128; +} +export interface OwnerResponse { + owner: Addr; +} +export interface PendingOwnerResponse { + pending_owner?: Addr | null; +} +export interface RouteResponseForAddr { + route: DomainRouteSetForAddr; +} +export interface RoutesResponseForAddr { + routes: DomainRouteSetForAddr[]; +} +export interface MailboxResponse { + mailbox: string; +} +export interface Empty { + [k: string]: unknown; +} +export interface QuoteDispatchResponse { + gas_amount?: Coin | null; +} +export interface Coin { + amount: Uint128; + denom: string; + [k: string]: unknown; +} +export interface QuoteGasPaymentResponse { + gas_needed: Uint256; +} \ No newline at end of file diff --git a/ts/sdk/src/contracts/IgpOracle.client.ts b/ts/sdk/src/contracts/IgpOracle.client.ts new file mode 100644 index 00000000..093f2e1d --- /dev/null +++ b/ts/sdk/src/contracts/IgpOracle.client.ts @@ -0,0 +1,94 @@ +/** +* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. +* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, +* and run the @cosmwasm/ts-codegen generate command to regenerate this file. +*/ + +import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from "@cosmjs/cosmwasm-stargate"; +import { Coin, StdFee } from "@cosmjs/amino"; +import { InstantiateMsg, ExecuteMsg, OwnableMsg, Uint128, RemoteGasDataConfig, QueryMsg, OwnableQueryMsg, IgpGasOracleQueryMsg, GetExchangeRateAndGasPriceResponse, Addr, OwnerResponse, PendingOwnerResponse } from "./IgpOracle.types"; +export interface IgpOracleReadOnlyInterface { + contractAddress: string; + ownable: (ownableQueryMsg: OwnableQueryMsg) => Promise; + oracle: (igpGasOracleQueryMsg: IgpGasOracleQueryMsg) => Promise; +} +export class IgpOracleQueryClient implements IgpOracleReadOnlyInterface { + client: CosmWasmClient; + contractAddress: string; + + constructor(client: CosmWasmClient, contractAddress: string) { + this.client = client; + this.contractAddress = contractAddress; + this.ownable = this.ownable.bind(this); + this.oracle = this.oracle.bind(this); + } + + ownable = async (ownableQueryMsg: OwnableQueryMsg): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + ownable: ownableQueryMsg + }); + }; + oracle = async (igpGasOracleQueryMsg: IgpGasOracleQueryMsg): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + oracle: igpGasOracleQueryMsg + }); + }; +} +export interface IgpOracleInterface extends IgpOracleReadOnlyInterface { + contractAddress: string; + sender: string; + ownership: (ownableMsg: OwnableMsg, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + setRemoteGasDataConfigs: ({ + configs + }: { + configs: RemoteGasDataConfig[]; + }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + setRemoteGasData: ({ + config + }: { + config: RemoteGasDataConfig; + }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; +} +export class IgpOracleClient extends IgpOracleQueryClient implements IgpOracleInterface { + client: SigningCosmWasmClient; + sender: string; + contractAddress: string; + + constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string) { + super(client, contractAddress); + this.client = client; + this.sender = sender; + this.contractAddress = contractAddress; + this.ownership = this.ownership.bind(this); + this.setRemoteGasDataConfigs = this.setRemoteGasDataConfigs.bind(this); + this.setRemoteGasData = this.setRemoteGasData.bind(this); + } + + ownership = async (ownableMsg: OwnableMsg, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + ownership: ownableMsg + }, fee, memo, _funds); + }; + setRemoteGasDataConfigs = async ({ + configs + }: { + configs: RemoteGasDataConfig[]; + }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + set_remote_gas_data_configs: { + configs + } + }, fee, memo, _funds); + }; + setRemoteGasData = async ({ + config + }: { + config: RemoteGasDataConfig; + }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + set_remote_gas_data: { + config + } + }, fee, memo, _funds); + }; +} \ No newline at end of file diff --git a/ts/sdk/src/contracts/IgpOracle.message-composer.ts b/ts/sdk/src/contracts/IgpOracle.message-composer.ts new file mode 100644 index 00000000..b74b8896 --- /dev/null +++ b/ts/sdk/src/contracts/IgpOracle.message-composer.ts @@ -0,0 +1,90 @@ +/** +* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. +* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, +* and run the @cosmwasm/ts-codegen generate command to regenerate this file. +*/ + +import { Coin } from "@cosmjs/amino"; +import { MsgExecuteContractEncodeObject } from "@cosmjs/cosmwasm-stargate"; +import { MsgExecuteContract } from "cosmjs-types/cosmwasm/wasm/v1/tx"; +import { toUtf8 } from "@cosmjs/encoding"; +import { InstantiateMsg, ExecuteMsg, OwnableMsg, Uint128, RemoteGasDataConfig, QueryMsg, OwnableQueryMsg, IgpGasOracleQueryMsg, GetExchangeRateAndGasPriceResponse, Addr, OwnerResponse, PendingOwnerResponse } from "./IgpOracle.types"; +export interface IgpOracleMsg { + contractAddress: string; + sender: string; + ownership: (ownableMsg: OwnableMsg, _funds?: Coin[]) => MsgExecuteContractEncodeObject; + setRemoteGasDataConfigs: ({ + configs + }: { + configs: RemoteGasDataConfig[]; + }, _funds?: Coin[]) => MsgExecuteContractEncodeObject; + setRemoteGasData: ({ + config + }: { + config: RemoteGasDataConfig; + }, _funds?: Coin[]) => MsgExecuteContractEncodeObject; +} +export class IgpOracleMsgComposer implements IgpOracleMsg { + sender: string; + contractAddress: string; + + constructor(sender: string, contractAddress: string) { + this.sender = sender; + this.contractAddress = contractAddress; + this.ownership = this.ownership.bind(this); + this.setRemoteGasDataConfigs = this.setRemoteGasDataConfigs.bind(this); + this.setRemoteGasData = this.setRemoteGasData.bind(this); + } + + ownership = (ownableMsg: OwnableMsg, _funds?: Coin[]): MsgExecuteContractEncodeObject => { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", + value: MsgExecuteContract.fromPartial({ + sender: this.sender, + contract: this.contractAddress, + msg: toUtf8(JSON.stringify({ + ownership: ownableMsg + })), + funds: _funds + }) + }; + }; + setRemoteGasDataConfigs = ({ + configs + }: { + configs: RemoteGasDataConfig[]; + }, _funds?: Coin[]): MsgExecuteContractEncodeObject => { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", + value: MsgExecuteContract.fromPartial({ + sender: this.sender, + contract: this.contractAddress, + msg: toUtf8(JSON.stringify({ + set_remote_gas_data_configs: { + configs + } + })), + funds: _funds + }) + }; + }; + setRemoteGasData = ({ + config + }: { + config: RemoteGasDataConfig; + }, _funds?: Coin[]): MsgExecuteContractEncodeObject => { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", + value: MsgExecuteContract.fromPartial({ + sender: this.sender, + contract: this.contractAddress, + msg: toUtf8(JSON.stringify({ + set_remote_gas_data: { + config + } + })), + funds: _funds + }) + }; + }; +} \ No newline at end of file diff --git a/ts/sdk/src/contracts/IgpOracle.types.ts b/ts/sdk/src/contracts/IgpOracle.types.ts new file mode 100644 index 00000000..ab2e9e0c --- /dev/null +++ b/ts/sdk/src/contracts/IgpOracle.types.ts @@ -0,0 +1,61 @@ +/** +* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. +* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, +* and run the @cosmwasm/ts-codegen generate command to regenerate this file. +*/ + +export interface InstantiateMsg { + owner: string; +} +export type ExecuteMsg = { + ownership: OwnableMsg; +} | { + set_remote_gas_data_configs: { + configs: RemoteGasDataConfig[]; + }; +} | { + set_remote_gas_data: { + config: RemoteGasDataConfig; + }; +}; +export type OwnableMsg = { + init_ownership_transfer: { + next_owner: string; + }; +} | { + revoke_ownership_transfer: {}; +} | { + claim_ownership: {}; +}; +export type Uint128 = string; +export interface RemoteGasDataConfig { + gas_price: Uint128; + remote_domain: number; + token_exchange_rate: Uint128; +} +export type QueryMsg = { + ownable: OwnableQueryMsg; +} | { + oracle: IgpGasOracleQueryMsg; +}; +export type OwnableQueryMsg = { + get_owner: {}; +} | { + get_pending_owner: {}; +}; +export type IgpGasOracleQueryMsg = { + get_exchange_rate_and_gas_price: { + dest_domain: number; + }; +}; +export interface GetExchangeRateAndGasPriceResponse { + exchange_rate: Uint128; + gas_price: Uint128; +} +export type Addr = string; +export interface OwnerResponse { + owner: Addr; +} +export interface PendingOwnerResponse { + pending_owner?: Addr | null; +} \ No newline at end of file diff --git a/ts/sdk/src/contracts/IsmAggregate.client.ts b/ts/sdk/src/contracts/IsmAggregate.client.ts new file mode 100644 index 00000000..f14731f7 --- /dev/null +++ b/ts/sdk/src/contracts/IsmAggregate.client.ts @@ -0,0 +1,77 @@ +/** +* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. +* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, +* and run the @cosmwasm/ts-codegen generate command to regenerate this file. +*/ + +import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from "@cosmjs/cosmwasm-stargate"; +import { Coin, StdFee } from "@cosmjs/amino"; +import { InstantiateMsg, ExecuteMsg, OwnableMsg, QueryMsg, OwnableQueryMsg, IsmQueryMsg, HexBinary, Addr, OwnerResponse, PendingOwnerResponse, IsmType, ModuleTypeResponse, VerifyResponse, VerifyInfoResponse } from "./IsmAggregate.types"; +export interface IsmAggregateReadOnlyInterface { + contractAddress: string; + ownable: (ownableQueryMsg: OwnableQueryMsg) => Promise; + ism: (ismQueryMsg: IsmQueryMsg) => Promise; +} +export class IsmAggregateQueryClient implements IsmAggregateReadOnlyInterface { + client: CosmWasmClient; + contractAddress: string; + + constructor(client: CosmWasmClient, contractAddress: string) { + this.client = client; + this.contractAddress = contractAddress; + this.ownable = this.ownable.bind(this); + this.ism = this.ism.bind(this); + } + + ownable = async (ownableQueryMsg: OwnableQueryMsg): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + ownable: ownableQueryMsg + }); + }; + ism = async (ismQueryMsg: IsmQueryMsg): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + ism: ismQueryMsg + }); + }; +} +export interface IsmAggregateInterface extends IsmAggregateReadOnlyInterface { + contractAddress: string; + sender: string; + ownable: (ownableMsg: OwnableMsg, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + setIsms: ({ + isms + }: { + isms: string[]; + }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; +} +export class IsmAggregateClient extends IsmAggregateQueryClient implements IsmAggregateInterface { + client: SigningCosmWasmClient; + sender: string; + contractAddress: string; + + constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string) { + super(client, contractAddress); + this.client = client; + this.sender = sender; + this.contractAddress = contractAddress; + this.ownable = this.ownable.bind(this); + this.setIsms = this.setIsms.bind(this); + } + + ownable = async (ownableMsg: OwnableMsg, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + ownable: ownableMsg + }, fee, memo, _funds); + }; + setIsms = async ({ + isms + }: { + isms: string[]; + }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + set_isms: { + isms + } + }, fee, memo, _funds); + }; +} \ No newline at end of file diff --git a/ts/sdk/src/contracts/Hub.message-composer.ts b/ts/sdk/src/contracts/IsmAggregate.message-composer.ts similarity index 53% rename from ts/sdk/src/contracts/Hub.message-composer.ts rename to ts/sdk/src/contracts/IsmAggregate.message-composer.ts index c39bcdb1..a14ced9d 100644 --- a/ts/sdk/src/contracts/Hub.message-composer.ts +++ b/ts/sdk/src/contracts/IsmAggregate.message-composer.ts @@ -1,69 +1,64 @@ /** -* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5. +* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * and run the @cosmwasm/ts-codegen generate command to regenerate this file. */ import { Coin } from "@cosmjs/amino"; -import { MsgExecuteContractEncodeObject } from "cosmwasm"; +import { MsgExecuteContractEncodeObject } from "@cosmjs/cosmwasm-stargate"; import { MsgExecuteContract } from "cosmjs-types/cosmwasm/wasm/v1/tx"; import { toUtf8 } from "@cosmjs/encoding"; -import { InstantiateMsg, ExecuteMsg, QueryMsg, MigrateMsg, OriginDomainResponse } from "./Hub.types"; -export interface HubMessage { +import { InstantiateMsg, ExecuteMsg, OwnableMsg, QueryMsg, OwnableQueryMsg, IsmQueryMsg, HexBinary, Addr, OwnerResponse, PendingOwnerResponse, IsmType, ModuleTypeResponse, VerifyResponse, VerifyInfoResponse } from "./IsmAggregate.types"; +export interface IsmAggregateMsg { contractAddress: string; sender: string; - instantiate: ({ - defaultIsm, - owner + ownable: (ownableMsg: OwnableMsg, _funds?: Coin[]) => MsgExecuteContractEncodeObject; + setIsms: ({ + isms }: { - defaultIsm: string; - owner: string; - }, funds?: Coin[]) => MsgExecuteContractEncodeObject; - migrate: (funds?: Coin[]) => MsgExecuteContractEncodeObject; + isms: string[]; + }, _funds?: Coin[]) => MsgExecuteContractEncodeObject; } -export class HubMessageComposer implements HubMessage { +export class IsmAggregateMsgComposer implements IsmAggregateMsg { sender: string; contractAddress: string; constructor(sender: string, contractAddress: string) { this.sender = sender; this.contractAddress = contractAddress; - this.instantiate = this.instantiate.bind(this); - this.migrate = this.migrate.bind(this); + this.ownable = this.ownable.bind(this); + this.setIsms = this.setIsms.bind(this); } - instantiate = ({ - defaultIsm, - owner - }: { - defaultIsm: string; - owner: string; - }, funds?: Coin[]): MsgExecuteContractEncodeObject => { + ownable = (ownableMsg: OwnableMsg, _funds?: Coin[]): MsgExecuteContractEncodeObject => { return { typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", value: MsgExecuteContract.fromPartial({ sender: this.sender, contract: this.contractAddress, msg: toUtf8(JSON.stringify({ - instantiate: { - default_ism: defaultIsm, - owner - } + ownable: ownableMsg })), - funds + funds: _funds }) }; }; - migrate = (funds?: Coin[]): MsgExecuteContractEncodeObject => { + setIsms = ({ + isms + }: { + isms: string[]; + }, _funds?: Coin[]): MsgExecuteContractEncodeObject => { return { typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", value: MsgExecuteContract.fromPartial({ sender: this.sender, contract: this.contractAddress, msg: toUtf8(JSON.stringify({ - migrate: {} + set_isms: { + isms + } })), - funds + funds: _funds }) }; }; diff --git a/ts/sdk/src/contracts/IsmAggregate.types.ts b/ts/sdk/src/contracts/IsmAggregate.types.ts new file mode 100644 index 00000000..5b89cd47 --- /dev/null +++ b/ts/sdk/src/contracts/IsmAggregate.types.ts @@ -0,0 +1,68 @@ +/** +* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. +* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, +* and run the @cosmwasm/ts-codegen generate command to regenerate this file. +*/ + +export interface InstantiateMsg { + isms: string[]; + owner: string; + threshold: number; +} +export type ExecuteMsg = { + ownable: OwnableMsg; +} | { + set_isms: { + isms: string[]; + }; +}; +export type OwnableMsg = { + init_ownership_transfer: { + next_owner: string; + }; +} | { + revoke_ownership_transfer: {}; +} | { + claim_ownership: {}; +}; +export type QueryMsg = { + ownable: OwnableQueryMsg; +} | { + ism: IsmQueryMsg; +}; +export type OwnableQueryMsg = { + get_owner: {}; +} | { + get_pending_owner: {}; +}; +export type IsmQueryMsg = { + module_type: {}; +} | { + verify: { + message: HexBinary; + metadata: HexBinary; + }; +} | { + verify_info: { + message: HexBinary; + }; +}; +export type HexBinary = string; +export type Addr = string; +export interface OwnerResponse { + owner: Addr; +} +export interface PendingOwnerResponse { + pending_owner?: Addr | null; +} +export type IsmType = "unused" | "routing" | "aggregation" | "legacy_multisig" | "merkle_root_multisig" | "message_id_multisig" | "null" | "ccip_read"; +export interface ModuleTypeResponse { + type: IsmType; +} +export interface VerifyResponse { + verified: boolean; +} +export interface VerifyInfoResponse { + threshold: number; + validators: string[]; +} \ No newline at end of file diff --git a/ts/sdk/src/contracts/IsmMultisig.client.ts b/ts/sdk/src/contracts/IsmMultisig.client.ts index 5f6ea397..347dddb0 100644 --- a/ts/sdk/src/contracts/IsmMultisig.client.ts +++ b/ts/sdk/src/contracts/IsmMultisig.client.ts @@ -1,22 +1,17 @@ /** -* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5. +* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * and run the @cosmwasm/ts-codegen generate command to regenerate this file. */ import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from "@cosmjs/cosmwasm-stargate"; import { Coin, StdFee } from "@cosmjs/amino"; -import { InstantiateMsg, ExecuteMsg, Binary, ValidatorSet, ThresholdSet, QueryMsg, HexBinary, MigrateMsg, ISMType, ModuleTypeResponse, VerifyResponse } from "./IsmMultisig.types"; +import { InstantiateMsg, ExecuteMsg, OwnableMsg, HexBinary, ValidatorSet, ThresholdSet, QueryMsg, OwnableQueryMsg, IsmQueryMsg, MultisigIsmQueryMsg, EnrolledValidatorsResponse, Addr, OwnerResponse, PendingOwnerResponse, IsmType, ModuleTypeResponse, VerifyResponse, VerifyInfoResponse } from "./IsmMultisig.types"; export interface IsmMultisigReadOnlyInterface { contractAddress: string; - moduleType: () => Promise; - verify: ({ - message, - metadata - }: { - message: HexBinary; - metadata: HexBinary; - }) => Promise; + ownable: (ownableQueryMsg: OwnableQueryMsg) => Promise; + ism: (ismQueryMsg: IsmQueryMsg) => Promise; + multisigIsm: (multisigIsmQueryMsg: MultisigIsmQueryMsg) => Promise; } export class IsmMultisigQueryClient implements IsmMultisigReadOnlyInterface { client: CosmWasmClient; @@ -25,67 +20,58 @@ export class IsmMultisigQueryClient implements IsmMultisigReadOnlyInterface { constructor(client: CosmWasmClient, contractAddress: string) { this.client = client; this.contractAddress = contractAddress; - this.moduleType = this.moduleType.bind(this); - this.verify = this.verify.bind(this); + this.ownable = this.ownable.bind(this); + this.ism = this.ism.bind(this); + this.multisigIsm = this.multisigIsm.bind(this); } - moduleType = async (): Promise => { + ownable = async (ownableQueryMsg: OwnableQueryMsg): Promise => { return this.client.queryContractSmart(this.contractAddress, { - module_type: {} + ownable: ownableQueryMsg }); }; - verify = async ({ - message, - metadata - }: { - message: HexBinary; - metadata: HexBinary; - }): Promise => { + ism = async (ismQueryMsg: IsmQueryMsg): Promise => { return this.client.queryContractSmart(this.contractAddress, { - verify: { - message, - metadata - } + ism: ismQueryMsg + }); + }; + multisigIsm = async (multisigIsmQueryMsg: MultisigIsmQueryMsg): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + multisig_ism: multisigIsmQueryMsg }); }; } export interface IsmMultisigInterface extends IsmMultisigReadOnlyInterface { contractAddress: string; sender: string; + ownable: (ownableMsg: OwnableMsg, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; enrollValidator: ({ set }: { set: ValidatorSet; - }, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; enrollValidators: ({ set }: { set: ValidatorSet[]; - }, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; unenrollValidator: ({ domain, validator }: { domain: number; validator: string; - }, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; setThreshold: ({ set }: { set: ThresholdSet; - }, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; setThresholds: ({ set }: { set: ThresholdSet[]; - }, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; - initTransferOwnership: ({ - owner - }: { - owner: string; - }, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; - finishTransferOwnership: (fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; - revokeTransferOwnership: (fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; } export class IsmMultisigClient extends IsmMultisigQueryClient implements IsmMultisigInterface { client: SigningCosmWasmClient; @@ -97,37 +83,40 @@ export class IsmMultisigClient extends IsmMultisigQueryClient implements IsmMult this.client = client; this.sender = sender; this.contractAddress = contractAddress; + this.ownable = this.ownable.bind(this); this.enrollValidator = this.enrollValidator.bind(this); this.enrollValidators = this.enrollValidators.bind(this); this.unenrollValidator = this.unenrollValidator.bind(this); this.setThreshold = this.setThreshold.bind(this); this.setThresholds = this.setThresholds.bind(this); - this.initTransferOwnership = this.initTransferOwnership.bind(this); - this.finishTransferOwnership = this.finishTransferOwnership.bind(this); - this.revokeTransferOwnership = this.revokeTransferOwnership.bind(this); } + ownable = async (ownableMsg: OwnableMsg, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + ownable: ownableMsg + }, fee, memo, _funds); + }; enrollValidator = async ({ set }: { set: ValidatorSet; - }, fee: number | StdFee | "auto" = "auto", memo?: string, funds?: Coin[]): Promise => { + }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { enroll_validator: { set } - }, fee, memo, funds); + }, fee, memo, _funds); }; enrollValidators = async ({ set }: { set: ValidatorSet[]; - }, fee: number | StdFee | "auto" = "auto", memo?: string, funds?: Coin[]): Promise => { + }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { enroll_validators: { set } - }, fee, memo, funds); + }, fee, memo, _funds); }; unenrollValidator = async ({ domain, @@ -135,55 +124,34 @@ export class IsmMultisigClient extends IsmMultisigQueryClient implements IsmMult }: { domain: number; validator: string; - }, fee: number | StdFee | "auto" = "auto", memo?: string, funds?: Coin[]): Promise => { + }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { unenroll_validator: { domain, validator } - }, fee, memo, funds); + }, fee, memo, _funds); }; setThreshold = async ({ set }: { set: ThresholdSet; - }, fee: number | StdFee | "auto" = "auto", memo?: string, funds?: Coin[]): Promise => { + }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { set_threshold: { set } - }, fee, memo, funds); + }, fee, memo, _funds); }; setThresholds = async ({ set }: { set: ThresholdSet[]; - }, fee: number | StdFee | "auto" = "auto", memo?: string, funds?: Coin[]): Promise => { + }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { set_thresholds: { set } - }, fee, memo, funds); - }; - initTransferOwnership = async ({ - owner - }: { - owner: string; - }, fee: number | StdFee | "auto" = "auto", memo?: string, funds?: Coin[]): Promise => { - return await this.client.execute(this.sender, this.contractAddress, { - init_transfer_ownership: { - owner - } - }, fee, memo, funds); - }; - finishTransferOwnership = async (fee: number | StdFee | "auto" = "auto", memo?: string, funds?: Coin[]): Promise => { - return await this.client.execute(this.sender, this.contractAddress, { - finish_transfer_ownership: {} - }, fee, memo, funds); - }; - revokeTransferOwnership = async (fee: number | StdFee | "auto" = "auto", memo?: string, funds?: Coin[]): Promise => { - return await this.client.execute(this.sender, this.contractAddress, { - revoke_transfer_ownership: {} - }, fee, memo, funds); + }, fee, memo, _funds); }; } \ No newline at end of file diff --git a/ts/sdk/src/contracts/IsmMultisig.message-composer.ts b/ts/sdk/src/contracts/IsmMultisig.message-composer.ts index fb0eedf6..3e6da1d6 100644 --- a/ts/sdk/src/contracts/IsmMultisig.message-composer.ts +++ b/ts/sdk/src/contracts/IsmMultisig.message-composer.ts @@ -1,74 +1,79 @@ /** -* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5. +* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * and run the @cosmwasm/ts-codegen generate command to regenerate this file. */ import { Coin } from "@cosmjs/amino"; -import { MsgExecuteContractEncodeObject } from "cosmwasm"; +import { MsgExecuteContractEncodeObject } from "@cosmjs/cosmwasm-stargate"; import { MsgExecuteContract } from "cosmjs-types/cosmwasm/wasm/v1/tx"; import { toUtf8 } from "@cosmjs/encoding"; -import { InstantiateMsg, ExecuteMsg, Binary, ValidatorSet, ThresholdSet, QueryMsg, HexBinary, MigrateMsg, ISMType, ModuleTypeResponse, VerifyResponse } from "./IsmMultisig.types"; -export interface IsmMultisigMessage { +import { InstantiateMsg, ExecuteMsg, OwnableMsg, HexBinary, ValidatorSet, ThresholdSet, QueryMsg, OwnableQueryMsg, IsmQueryMsg, MultisigIsmQueryMsg, EnrolledValidatorsResponse, Addr, OwnerResponse, PendingOwnerResponse, IsmType, ModuleTypeResponse, VerifyResponse, VerifyInfoResponse } from "./IsmMultisig.types"; +export interface IsmMultisigMsg { contractAddress: string; sender: string; + ownable: (ownableMsg: OwnableMsg, _funds?: Coin[]) => MsgExecuteContractEncodeObject; enrollValidator: ({ set }: { set: ValidatorSet; - }, funds?: Coin[]) => MsgExecuteContractEncodeObject; + }, _funds?: Coin[]) => MsgExecuteContractEncodeObject; enrollValidators: ({ set }: { set: ValidatorSet[]; - }, funds?: Coin[]) => MsgExecuteContractEncodeObject; + }, _funds?: Coin[]) => MsgExecuteContractEncodeObject; unenrollValidator: ({ domain, validator }: { domain: number; validator: string; - }, funds?: Coin[]) => MsgExecuteContractEncodeObject; + }, _funds?: Coin[]) => MsgExecuteContractEncodeObject; setThreshold: ({ set }: { set: ThresholdSet; - }, funds?: Coin[]) => MsgExecuteContractEncodeObject; + }, _funds?: Coin[]) => MsgExecuteContractEncodeObject; setThresholds: ({ set }: { set: ThresholdSet[]; - }, funds?: Coin[]) => MsgExecuteContractEncodeObject; - initTransferOwnership: ({ - owner - }: { - owner: string; - }, funds?: Coin[]) => MsgExecuteContractEncodeObject; - finishTransferOwnership: (funds?: Coin[]) => MsgExecuteContractEncodeObject; - revokeTransferOwnership: (funds?: Coin[]) => MsgExecuteContractEncodeObject; + }, _funds?: Coin[]) => MsgExecuteContractEncodeObject; } -export class IsmMultisigMessageComposer implements IsmMultisigMessage { +export class IsmMultisigMsgComposer implements IsmMultisigMsg { sender: string; contractAddress: string; constructor(sender: string, contractAddress: string) { this.sender = sender; this.contractAddress = contractAddress; + this.ownable = this.ownable.bind(this); this.enrollValidator = this.enrollValidator.bind(this); this.enrollValidators = this.enrollValidators.bind(this); this.unenrollValidator = this.unenrollValidator.bind(this); this.setThreshold = this.setThreshold.bind(this); this.setThresholds = this.setThresholds.bind(this); - this.initTransferOwnership = this.initTransferOwnership.bind(this); - this.finishTransferOwnership = this.finishTransferOwnership.bind(this); - this.revokeTransferOwnership = this.revokeTransferOwnership.bind(this); } + ownable = (ownableMsg: OwnableMsg, _funds?: Coin[]): MsgExecuteContractEncodeObject => { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", + value: MsgExecuteContract.fromPartial({ + sender: this.sender, + contract: this.contractAddress, + msg: toUtf8(JSON.stringify({ + ownable: ownableMsg + })), + funds: _funds + }) + }; + }; enrollValidator = ({ set }: { set: ValidatorSet; - }, funds?: Coin[]): MsgExecuteContractEncodeObject => { + }, _funds?: Coin[]): MsgExecuteContractEncodeObject => { return { typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", value: MsgExecuteContract.fromPartial({ @@ -79,7 +84,7 @@ export class IsmMultisigMessageComposer implements IsmMultisigMessage { set } })), - funds + funds: _funds }) }; }; @@ -87,7 +92,7 @@ export class IsmMultisigMessageComposer implements IsmMultisigMessage { set }: { set: ValidatorSet[]; - }, funds?: Coin[]): MsgExecuteContractEncodeObject => { + }, _funds?: Coin[]): MsgExecuteContractEncodeObject => { return { typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", value: MsgExecuteContract.fromPartial({ @@ -98,7 +103,7 @@ export class IsmMultisigMessageComposer implements IsmMultisigMessage { set } })), - funds + funds: _funds }) }; }; @@ -108,7 +113,7 @@ export class IsmMultisigMessageComposer implements IsmMultisigMessage { }: { domain: number; validator: string; - }, funds?: Coin[]): MsgExecuteContractEncodeObject => { + }, _funds?: Coin[]): MsgExecuteContractEncodeObject => { return { typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", value: MsgExecuteContract.fromPartial({ @@ -120,7 +125,7 @@ export class IsmMultisigMessageComposer implements IsmMultisigMessage { validator } })), - funds + funds: _funds }) }; }; @@ -128,7 +133,7 @@ export class IsmMultisigMessageComposer implements IsmMultisigMessage { set }: { set: ThresholdSet; - }, funds?: Coin[]): MsgExecuteContractEncodeObject => { + }, _funds?: Coin[]): MsgExecuteContractEncodeObject => { return { typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", value: MsgExecuteContract.fromPartial({ @@ -139,7 +144,7 @@ export class IsmMultisigMessageComposer implements IsmMultisigMessage { set } })), - funds + funds: _funds }) }; }; @@ -147,7 +152,7 @@ export class IsmMultisigMessageComposer implements IsmMultisigMessage { set }: { set: ThresholdSet[]; - }, funds?: Coin[]): MsgExecuteContractEncodeObject => { + }, _funds?: Coin[]): MsgExecuteContractEncodeObject => { return { typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", value: MsgExecuteContract.fromPartial({ @@ -158,52 +163,7 @@ export class IsmMultisigMessageComposer implements IsmMultisigMessage { set } })), - funds - }) - }; - }; - initTransferOwnership = ({ - owner - }: { - owner: string; - }, funds?: Coin[]): MsgExecuteContractEncodeObject => { - return { - typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", - value: MsgExecuteContract.fromPartial({ - sender: this.sender, - contract: this.contractAddress, - msg: toUtf8(JSON.stringify({ - init_transfer_ownership: { - owner - } - })), - funds - }) - }; - }; - finishTransferOwnership = (funds?: Coin[]): MsgExecuteContractEncodeObject => { - return { - typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", - value: MsgExecuteContract.fromPartial({ - sender: this.sender, - contract: this.contractAddress, - msg: toUtf8(JSON.stringify({ - finish_transfer_ownership: {} - })), - funds - }) - }; - }; - revokeTransferOwnership = (funds?: Coin[]): MsgExecuteContractEncodeObject => { - return { - typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", - value: MsgExecuteContract.fromPartial({ - sender: this.sender, - contract: this.contractAddress, - msg: toUtf8(JSON.stringify({ - revoke_transfer_ownership: {} - })), - funds + funds: _funds }) }; }; diff --git a/ts/sdk/src/contracts/IsmMultisig.types.ts b/ts/sdk/src/contracts/IsmMultisig.types.ts index 9ae1d242..6705cfbe 100644 --- a/ts/sdk/src/contracts/IsmMultisig.types.ts +++ b/ts/sdk/src/contracts/IsmMultisig.types.ts @@ -1,14 +1,16 @@ /** -* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5. +* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * and run the @cosmwasm/ts-codegen generate command to regenerate this file. */ export interface InstantiateMsg { - chain_hpl: string; + hrp: string; owner: string; } export type ExecuteMsg = { + ownable: OwnableMsg; +} | { enroll_validator: { set: ValidatorSet; }; @@ -29,39 +31,74 @@ export type ExecuteMsg = { set_thresholds: { set: ThresholdSet[]; }; -} | { - init_transfer_ownership: { - owner: string; +}; +export type OwnableMsg = { + init_ownership_transfer: { + next_owner: string; }; } | { - finish_transfer_ownership: []; + revoke_ownership_transfer: {}; } | { - revoke_transfer_ownership: []; + claim_ownership: {}; }; -export type Binary = string; +export type HexBinary = string; export interface ValidatorSet { domain: number; validator: string; - validator_pubkey: Binary; + validator_pubkey: HexBinary; } export interface ThresholdSet { domain: number; threshold: number; } export type QueryMsg = { + ownable: OwnableQueryMsg; +} | { + ism: IsmQueryMsg; +} | { + multisig_ism: MultisigIsmQueryMsg; +}; +export type OwnableQueryMsg = { + get_owner: {}; +} | { + get_pending_owner: {}; +}; +export type IsmQueryMsg = { module_type: {}; } | { verify: { message: HexBinary; metadata: HexBinary; }; +} | { + verify_info: { + message: HexBinary; + }; }; -export type HexBinary = string; -export interface MigrateMsg {} -export type ISMType = "unused" | "routing" | "aggregation" | "legacy_multisig" | "multisig" | "owned"; +export type MultisigIsmQueryMsg = { + enrolled_validators: { + domain: number; + }; +}; +export interface EnrolledValidatorsResponse { + threshold: number; + validators: string[]; +} +export type Addr = string; +export interface OwnerResponse { + owner: Addr; +} +export interface PendingOwnerResponse { + pending_owner?: Addr | null; +} +export type IsmType = "unused" | "routing" | "aggregation" | "legacy_multisig" | "merkle_root_multisig" | "message_id_multisig" | "null" | "ccip_read"; export interface ModuleTypeResponse { - type: ISMType; + type: IsmType; } export interface VerifyResponse { verified: boolean; +} +export interface VerifyInfoResponse { + threshold: number; + validators: string[]; } \ No newline at end of file diff --git a/ts/sdk/src/contracts/IsmRouting.client.ts b/ts/sdk/src/contracts/IsmRouting.client.ts new file mode 100644 index 00000000..4d03c70d --- /dev/null +++ b/ts/sdk/src/contracts/IsmRouting.client.ts @@ -0,0 +1,84 @@ +/** +* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. +* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, +* and run the @cosmwasm/ts-codegen generate command to regenerate this file. +*/ + +import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from "@cosmjs/cosmwasm-stargate"; +import { Coin, StdFee } from "@cosmjs/amino"; +import { InstantiateMsg, IsmSet, ExecuteMsg, OwnableMsg, QueryMsg, OwnableQueryMsg, IsmQueryMsg, HexBinary, RoutingIsmQueryMsg, Addr, OwnerResponse, PendingOwnerResponse, IsmType, ModuleTypeResponse, RouteResponse, VerifyResponse, VerifyInfoResponse } from "./IsmRouting.types"; +export interface IsmRoutingReadOnlyInterface { + contractAddress: string; + ownable: (ownableQueryMsg: OwnableQueryMsg) => Promise; + ism: (ismQueryMsg: IsmQueryMsg) => Promise; + routingIsm: (routingIsmQueryMsg: RoutingIsmQueryMsg) => Promise; +} +export class IsmRoutingQueryClient implements IsmRoutingReadOnlyInterface { + client: CosmWasmClient; + contractAddress: string; + + constructor(client: CosmWasmClient, contractAddress: string) { + this.client = client; + this.contractAddress = contractAddress; + this.ownable = this.ownable.bind(this); + this.ism = this.ism.bind(this); + this.routingIsm = this.routingIsm.bind(this); + } + + ownable = async (ownableQueryMsg: OwnableQueryMsg): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + ownable: ownableQueryMsg + }); + }; + ism = async (ismQueryMsg: IsmQueryMsg): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + ism: ismQueryMsg + }); + }; + routingIsm = async (routingIsmQueryMsg: RoutingIsmQueryMsg): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + routing_ism: routingIsmQueryMsg + }); + }; +} +export interface IsmRoutingInterface extends IsmRoutingReadOnlyInterface { + contractAddress: string; + sender: string; + ownable: (ownableMsg: OwnableMsg, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + set: ({ + ism + }: { + ism: IsmSet; + }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; +} +export class IsmRoutingClient extends IsmRoutingQueryClient implements IsmRoutingInterface { + client: SigningCosmWasmClient; + sender: string; + contractAddress: string; + + constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string) { + super(client, contractAddress); + this.client = client; + this.sender = sender; + this.contractAddress = contractAddress; + this.ownable = this.ownable.bind(this); + this.set = this.set.bind(this); + } + + ownable = async (ownableMsg: OwnableMsg, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + ownable: ownableMsg + }, fee, memo, _funds); + }; + set = async ({ + ism + }: { + ism: IsmSet; + }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + set: { + ism + } + }, fee, memo, _funds); + }; +} \ No newline at end of file diff --git a/ts/sdk/src/contracts/IsmRouting.message-composer.ts b/ts/sdk/src/contracts/IsmRouting.message-composer.ts new file mode 100644 index 00000000..9eb29b04 --- /dev/null +++ b/ts/sdk/src/contracts/IsmRouting.message-composer.ts @@ -0,0 +1,65 @@ +/** +* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. +* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, +* and run the @cosmwasm/ts-codegen generate command to regenerate this file. +*/ + +import { Coin } from "@cosmjs/amino"; +import { MsgExecuteContractEncodeObject } from "@cosmjs/cosmwasm-stargate"; +import { MsgExecuteContract } from "cosmjs-types/cosmwasm/wasm/v1/tx"; +import { toUtf8 } from "@cosmjs/encoding"; +import { InstantiateMsg, IsmSet, ExecuteMsg, OwnableMsg, QueryMsg, OwnableQueryMsg, IsmQueryMsg, HexBinary, RoutingIsmQueryMsg, Addr, OwnerResponse, PendingOwnerResponse, IsmType, ModuleTypeResponse, RouteResponse, VerifyResponse, VerifyInfoResponse } from "./IsmRouting.types"; +export interface IsmRoutingMsg { + contractAddress: string; + sender: string; + ownable: (ownableMsg: OwnableMsg, _funds?: Coin[]) => MsgExecuteContractEncodeObject; + set: ({ + ism + }: { + ism: IsmSet; + }, _funds?: Coin[]) => MsgExecuteContractEncodeObject; +} +export class IsmRoutingMsgComposer implements IsmRoutingMsg { + sender: string; + contractAddress: string; + + constructor(sender: string, contractAddress: string) { + this.sender = sender; + this.contractAddress = contractAddress; + this.ownable = this.ownable.bind(this); + this.set = this.set.bind(this); + } + + ownable = (ownableMsg: OwnableMsg, _funds?: Coin[]): MsgExecuteContractEncodeObject => { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", + value: MsgExecuteContract.fromPartial({ + sender: this.sender, + contract: this.contractAddress, + msg: toUtf8(JSON.stringify({ + ownable: ownableMsg + })), + funds: _funds + }) + }; + }; + set = ({ + ism + }: { + ism: IsmSet; + }, _funds?: Coin[]): MsgExecuteContractEncodeObject => { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", + value: MsgExecuteContract.fromPartial({ + sender: this.sender, + contract: this.contractAddress, + msg: toUtf8(JSON.stringify({ + set: { + ism + } + })), + funds: _funds + }) + }; + }; +} \ No newline at end of file diff --git a/ts/sdk/src/contracts/IsmRouting.types.ts b/ts/sdk/src/contracts/IsmRouting.types.ts new file mode 100644 index 00000000..1fef4857 --- /dev/null +++ b/ts/sdk/src/contracts/IsmRouting.types.ts @@ -0,0 +1,81 @@ +/** +* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. +* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, +* and run the @cosmwasm/ts-codegen generate command to regenerate this file. +*/ + +export interface InstantiateMsg { + isms: IsmSet[]; + owner: string; +} +export interface IsmSet { + address: string; + domain: number; +} +export type ExecuteMsg = { + ownable: OwnableMsg; +} | { + set: { + ism: IsmSet; + }; +}; +export type OwnableMsg = { + init_ownership_transfer: { + next_owner: string; + }; +} | { + revoke_ownership_transfer: {}; +} | { + claim_ownership: {}; +}; +export type QueryMsg = { + ownable: OwnableQueryMsg; +} | { + ism: IsmQueryMsg; +} | { + routing_ism: RoutingIsmQueryMsg; +}; +export type OwnableQueryMsg = { + get_owner: {}; +} | { + get_pending_owner: {}; +}; +export type IsmQueryMsg = { + module_type: {}; +} | { + verify: { + message: HexBinary; + metadata: HexBinary; + }; +} | { + verify_info: { + message: HexBinary; + }; +}; +export type HexBinary = string; +export type RoutingIsmQueryMsg = { + route: { + message: HexBinary; + }; +}; +export type Addr = string; +export interface OwnerResponse { + owner: Addr; +} +export interface PendingOwnerResponse { + pending_owner?: Addr | null; +} +export type IsmType = "unused" | "routing" | "aggregation" | "legacy_multisig" | "merkle_root_multisig" | "message_id_multisig" | "null" | "ccip_read"; +export interface ModuleTypeResponse { + type: IsmType; +} +export interface RouteResponse { + ism: string; +} +export interface VerifyResponse { + verified: boolean; +} +export interface VerifyInfoResponse { + threshold: number; + validators: string[]; +} \ No newline at end of file diff --git a/ts/sdk/src/contracts/Mailbox.client.ts b/ts/sdk/src/contracts/Mailbox.client.ts index c040af09..0c50b69f 100644 --- a/ts/sdk/src/contracts/Mailbox.client.ts +++ b/ts/sdk/src/contracts/Mailbox.client.ts @@ -1,19 +1,17 @@ /** -* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5. +* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * and run the @cosmwasm/ts-codegen generate command to regenerate this file. */ import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from "@cosmjs/cosmwasm-stargate"; -import { Coin, StdFee } from "@cosmjs/amino"; -import { InstantiateMsg, ExecuteMsg, HexBinary, QueryMsg, MigrateMsg, CheckPointResponse, CountResponse, NonceResponse, PausedResponse, RootResponse } from "./Mailbox.types"; +import { StdFee } from "@cosmjs/amino"; +import { InstantiateMsg, ExecuteMsg, OwnableMsg, HexBinary, DispatchMsg, QueryMsg, OwnableQueryMsg, MailboxHookQueryMsg, MailboxQueryMsg, DefaultHookResponse, DefaultIsmResponse, Addr, OwnerResponse, PendingOwnerResponse, HrpResponse, LatestDispatchedIdResponse, LocalDomainResponse, MessageDeliveredResponse, NonceResponse, Uint128, QuoteDispatchResponse, Coin, RecipientIsmResponse, RequiredHookResponse } from "./Mailbox.types"; export interface MailboxReadOnlyInterface { contractAddress: string; - root: () => Promise; - count: () => Promise; - checkPoint: () => Promise; - paused: () => Promise; - nonce: () => Promise; + ownable: (ownableQueryMsg: OwnableQueryMsg) => Promise; + hook: (mailboxHookQueryMsg: MailboxHookQueryMsg) => Promise; + mailbox: (mailboxQueryMsg: MailboxQueryMsg) => Promise; } export class MailboxQueryClient implements MailboxReadOnlyInterface { client: CosmWasmClient; @@ -22,65 +20,66 @@ export class MailboxQueryClient implements MailboxReadOnlyInterface { constructor(client: CosmWasmClient, contractAddress: string) { this.client = client; this.contractAddress = contractAddress; - this.root = this.root.bind(this); - this.count = this.count.bind(this); - this.checkPoint = this.checkPoint.bind(this); - this.paused = this.paused.bind(this); - this.nonce = this.nonce.bind(this); + this.ownable = this.ownable.bind(this); + this.hook = this.hook.bind(this); + this.mailbox = this.mailbox.bind(this); } - root = async (): Promise => { + ownable = async (ownableQueryMsg: OwnableQueryMsg): Promise => { return this.client.queryContractSmart(this.contractAddress, { - root: {} + ownable: ownableQueryMsg }); }; - count = async (): Promise => { + hook = async (mailboxHookQueryMsg: MailboxHookQueryMsg): Promise => { return this.client.queryContractSmart(this.contractAddress, { - count: {} + hook: mailboxHookQueryMsg }); }; - checkPoint = async (): Promise => { + mailbox = async (mailboxQueryMsg: MailboxQueryMsg): Promise => { return this.client.queryContractSmart(this.contractAddress, { - check_point: {} - }); - }; - paused = async (): Promise => { - return this.client.queryContractSmart(this.contractAddress, { - paused: {} - }); - }; - nonce = async (): Promise => { - return this.client.queryContractSmart(this.contractAddress, { - nonce: {} + mailbox: mailboxQueryMsg }); }; } export interface MailboxInterface extends MailboxReadOnlyInterface { contractAddress: string; sender: string; - pause: (fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; - unpause: (fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; - setDefaultISM: ({ + ownable: (ownableMsg: OwnableMsg, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + setDefaultIsm: ({ ism }: { ism: string; - }, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + setDefaultHook: ({ + hook + }: { + hook: string; + }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + setRequiredHook: ({ + hook + }: { + hook: string; + }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; dispatch: ({ destDomain, + hook, + metadata, msgBody, recipientAddr }: { destDomain: number; + hook?: string; + metadata?: HexBinary; msgBody: HexBinary; recipientAddr: HexBinary; - }, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; process: ({ message, metadata }: { message: HexBinary; metadata: HexBinary; - }, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; } export class MailboxClient extends MailboxQueryClient implements MailboxInterface { client: SigningCosmWasmClient; @@ -92,50 +91,74 @@ export class MailboxClient extends MailboxQueryClient implements MailboxInterfac this.client = client; this.sender = sender; this.contractAddress = contractAddress; - this.pause = this.pause.bind(this); - this.unpause = this.unpause.bind(this); - this.setDefaultISM = this.setDefaultISM.bind(this); + this.ownable = this.ownable.bind(this); + this.setDefaultIsm = this.setDefaultIsm.bind(this); + this.setDefaultHook = this.setDefaultHook.bind(this); + this.setRequiredHook = this.setRequiredHook.bind(this); this.dispatch = this.dispatch.bind(this); this.process = this.process.bind(this); } - pause = async (fee: number | StdFee | "auto" = "auto", memo?: string, funds?: Coin[]): Promise => { - return await this.client.execute(this.sender, this.contractAddress, { - pause: {} - }, fee, memo, funds); - }; - unpause = async (fee: number | StdFee | "auto" = "auto", memo?: string, funds?: Coin[]): Promise => { + ownable = async (ownableMsg: OwnableMsg, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { - unpause: {} - }, fee, memo, funds); + ownable: ownableMsg + }, fee, memo, _funds); }; - setDefaultISM = async ({ + setDefaultIsm = async ({ ism }: { ism: string; - }, fee: number | StdFee | "auto" = "auto", memo?: string, funds?: Coin[]): Promise => { + }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { - set_default_i_s_m: { + set_default_ism: { ism } - }, fee, memo, funds); + }, fee, memo, _funds); + }; + setDefaultHook = async ({ + hook + }: { + hook: string; + }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + set_default_hook: { + hook + } + }, fee, memo, _funds); + }; + setRequiredHook = async ({ + hook + }: { + hook: string; + }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + set_required_hook: { + hook + } + }, fee, memo, _funds); }; dispatch = async ({ destDomain, + hook, + metadata, msgBody, recipientAddr }: { destDomain: number; + hook?: string; + metadata?: HexBinary; msgBody: HexBinary; recipientAddr: HexBinary; - }, fee: number | StdFee | "auto" = "auto", memo?: string, funds?: Coin[]): Promise => { + }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { dispatch: { dest_domain: destDomain, + hook, + metadata, msg_body: msgBody, recipient_addr: recipientAddr } - }, fee, memo, funds); + }, fee, memo, _funds); }; process = async ({ message, @@ -143,12 +166,12 @@ export class MailboxClient extends MailboxQueryClient implements MailboxInterfac }: { message: HexBinary; metadata: HexBinary; - }, fee: number | StdFee | "auto" = "auto", memo?: string, funds?: Coin[]): Promise => { + }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { process: { message, metadata } - }, fee, memo, funds); + }, fee, memo, _funds); }; } \ No newline at end of file diff --git a/ts/sdk/src/contracts/Mailbox.message-composer.ts b/ts/sdk/src/contracts/Mailbox.message-composer.ts index f99faf24..e310804f 100644 --- a/ts/sdk/src/contracts/Mailbox.message-composer.ts +++ b/ts/sdk/src/contracts/Mailbox.message-composer.ts @@ -1,109 +1,151 @@ /** -* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5. +* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * and run the @cosmwasm/ts-codegen generate command to regenerate this file. */ -import { Coin } from "@cosmjs/amino"; -import { MsgExecuteContractEncodeObject } from "cosmwasm"; +import { MsgExecuteContractEncodeObject } from "@cosmjs/cosmwasm-stargate"; import { MsgExecuteContract } from "cosmjs-types/cosmwasm/wasm/v1/tx"; import { toUtf8 } from "@cosmjs/encoding"; -import { InstantiateMsg, ExecuteMsg, HexBinary, QueryMsg, MigrateMsg, CheckPointResponse, CountResponse, NonceResponse, PausedResponse, RootResponse } from "./Mailbox.types"; -export interface MailboxMessage { +import { InstantiateMsg, ExecuteMsg, OwnableMsg, HexBinary, DispatchMsg, QueryMsg, OwnableQueryMsg, MailboxHookQueryMsg, MailboxQueryMsg, DefaultHookResponse, DefaultIsmResponse, Addr, OwnerResponse, PendingOwnerResponse, HrpResponse, LatestDispatchedIdResponse, LocalDomainResponse, MessageDeliveredResponse, NonceResponse, Uint128, QuoteDispatchResponse, Coin, RecipientIsmResponse, RequiredHookResponse } from "./Mailbox.types"; +export interface MailboxMsg { contractAddress: string; sender: string; - pause: (funds?: Coin[]) => MsgExecuteContractEncodeObject; - unpause: (funds?: Coin[]) => MsgExecuteContractEncodeObject; - setDefaultISM: ({ + ownable: (ownableMsg: OwnableMsg, _funds?: Coin[]) => MsgExecuteContractEncodeObject; + setDefaultIsm: ({ ism }: { ism: string; - }, funds?: Coin[]) => MsgExecuteContractEncodeObject; + }, _funds?: Coin[]) => MsgExecuteContractEncodeObject; + setDefaultHook: ({ + hook + }: { + hook: string; + }, _funds?: Coin[]) => MsgExecuteContractEncodeObject; + setRequiredHook: ({ + hook + }: { + hook: string; + }, _funds?: Coin[]) => MsgExecuteContractEncodeObject; dispatch: ({ destDomain, + hook, + metadata, msgBody, recipientAddr }: { destDomain: number; + hook?: string; + metadata?: HexBinary; msgBody: HexBinary; recipientAddr: HexBinary; - }, funds?: Coin[]) => MsgExecuteContractEncodeObject; + }, _funds?: Coin[]) => MsgExecuteContractEncodeObject; process: ({ message, metadata }: { message: HexBinary; metadata: HexBinary; - }, funds?: Coin[]) => MsgExecuteContractEncodeObject; + }, _funds?: Coin[]) => MsgExecuteContractEncodeObject; } -export class MailboxMessageComposer implements MailboxMessage { +export class MailboxMsgComposer implements MailboxMsg { sender: string; contractAddress: string; constructor(sender: string, contractAddress: string) { this.sender = sender; this.contractAddress = contractAddress; - this.pause = this.pause.bind(this); - this.unpause = this.unpause.bind(this); - this.setDefaultISM = this.setDefaultISM.bind(this); + this.ownable = this.ownable.bind(this); + this.setDefaultIsm = this.setDefaultIsm.bind(this); + this.setDefaultHook = this.setDefaultHook.bind(this); + this.setRequiredHook = this.setRequiredHook.bind(this); this.dispatch = this.dispatch.bind(this); this.process = this.process.bind(this); } - pause = (funds?: Coin[]): MsgExecuteContractEncodeObject => { + ownable = (ownableMsg: OwnableMsg, _funds?: Coin[]): MsgExecuteContractEncodeObject => { return { typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", value: MsgExecuteContract.fromPartial({ sender: this.sender, contract: this.contractAddress, msg: toUtf8(JSON.stringify({ - pause: {} + ownable: ownableMsg })), - funds + funds: _funds }) }; }; - unpause = (funds?: Coin[]): MsgExecuteContractEncodeObject => { + setDefaultIsm = ({ + ism + }: { + ism: string; + }, _funds?: Coin[]): MsgExecuteContractEncodeObject => { return { typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", value: MsgExecuteContract.fromPartial({ sender: this.sender, contract: this.contractAddress, msg: toUtf8(JSON.stringify({ - unpause: {} + set_default_ism: { + ism + } })), - funds + funds: _funds }) }; }; - setDefaultISM = ({ - ism + setDefaultHook = ({ + hook }: { - ism: string; - }, funds?: Coin[]): MsgExecuteContractEncodeObject => { + hook: string; + }, _funds?: Coin[]): MsgExecuteContractEncodeObject => { return { typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", value: MsgExecuteContract.fromPartial({ sender: this.sender, contract: this.contractAddress, msg: toUtf8(JSON.stringify({ - set_default_i_s_m: { - ism + set_default_hook: { + hook + } + })), + funds: _funds + }) + }; + }; + setRequiredHook = ({ + hook + }: { + hook: string; + }, _funds?: Coin[]): MsgExecuteContractEncodeObject => { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", + value: MsgExecuteContract.fromPartial({ + sender: this.sender, + contract: this.contractAddress, + msg: toUtf8(JSON.stringify({ + set_required_hook: { + hook } })), - funds + funds: _funds }) }; }; dispatch = ({ destDomain, + hook, + metadata, msgBody, recipientAddr }: { destDomain: number; + hook?: string; + metadata?: HexBinary; msgBody: HexBinary; recipientAddr: HexBinary; - }, funds?: Coin[]): MsgExecuteContractEncodeObject => { + }, _funds?: Coin[]): MsgExecuteContractEncodeObject => { return { typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", value: MsgExecuteContract.fromPartial({ @@ -112,11 +154,13 @@ export class MailboxMessageComposer implements MailboxMessage { msg: toUtf8(JSON.stringify({ dispatch: { dest_domain: destDomain, + hook, + metadata, msg_body: msgBody, recipient_addr: recipientAddr } })), - funds + funds: _funds }) }; }; @@ -126,7 +170,7 @@ export class MailboxMessageComposer implements MailboxMessage { }: { message: HexBinary; metadata: HexBinary; - }, funds?: Coin[]): MsgExecuteContractEncodeObject => { + }, _funds?: Coin[]): MsgExecuteContractEncodeObject => { return { typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", value: MsgExecuteContract.fromPartial({ @@ -138,7 +182,7 @@ export class MailboxMessageComposer implements MailboxMessage { metadata } })), - funds + funds: _funds }) }; }; diff --git a/ts/sdk/src/contracts/Mailbox.types.ts b/ts/sdk/src/contracts/Mailbox.types.ts index 7a7d5d98..a01b17e8 100644 --- a/ts/sdk/src/contracts/Mailbox.types.ts +++ b/ts/sdk/src/contracts/Mailbox.types.ts @@ -1,59 +1,131 @@ /** -* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5. +* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * and run the @cosmwasm/ts-codegen generate command to regenerate this file. */ export interface InstantiateMsg { - default_ism: string; + domain: number; + hrp: string; owner: string; } export type ExecuteMsg = { - pause: {}; -} | { - unpause: {}; + ownable: OwnableMsg; } | { - set_default_i_s_m: { + set_default_ism: { ism: string; }; } | { - dispatch: { - dest_domain: number; - msg_body: HexBinary; - recipient_addr: HexBinary; + set_default_hook: { + hook: string; + }; +} | { + set_required_hook: { + hook: string; }; +} | { + dispatch: DispatchMsg; } | { process: { message: HexBinary; metadata: HexBinary; }; }; +export type OwnableMsg = { + init_ownership_transfer: { + next_owner: string; + }; +} | { + revoke_ownership_transfer: {}; +} | { + claim_ownership: {}; +}; export type HexBinary = string; +export interface DispatchMsg { + dest_domain: number; + hook?: string | null; + metadata?: HexBinary | null; + msg_body: HexBinary; + recipient_addr: HexBinary; +} export type QueryMsg = { - root: {}; + ownable: OwnableQueryMsg; +} | { + hook: MailboxHookQueryMsg; +} | { + mailbox: MailboxQueryMsg; +}; +export type OwnableQueryMsg = { + get_owner: {}; } | { - count: {}; + get_pending_owner: {}; +}; +export type MailboxHookQueryMsg = { + quote_dispatch: DispatchMsg; +}; +export type MailboxQueryMsg = { + hrp: {}; } | { - check_point: {}; + local_domain: {}; } | { - paused: {}; + message_delivered: { + id: HexBinary; + }; +} | { + default_ism: {}; +} | { + default_hook: {}; +} | { + required_hook: {}; } | { nonce: {}; +} | { + recipient_ism: { + recipient_addr: string; + }; +} | { + latest_dispatch_id: {}; }; -export interface MigrateMsg {} -export interface CheckPointResponse { - count: number; - root: HexBinary; +export interface DefaultHookResponse { + default_hook: string; +} +export interface DefaultIsmResponse { + default_ism: string; } -export interface CountResponse { - count: number; +export type Addr = string; +export interface OwnerResponse { + owner: Addr; +} +export interface PendingOwnerResponse { + pending_owner?: Addr | null; +} +export interface HrpResponse { + hrp: string; +} +export interface LatestDispatchedIdResponse { + message_id: HexBinary; +} +export interface LocalDomainResponse { + local_domain: number; +} +export interface MessageDeliveredResponse { + delivered: boolean; } export interface NonceResponse { nonce: number; } -export interface PausedResponse { - paused: boolean; +export type Uint128 = string; +export interface QuoteDispatchResponse { + gas_amount?: Coin | null; +} +export interface Coin { + amount: Uint128; + denom: string; + [k: string]: unknown; +} +export interface RecipientIsmResponse { + ism: string; } -export interface RootResponse { - root: HexBinary; +export interface RequiredHookResponse { + required_hook: string; } \ No newline at end of file diff --git a/ts/sdk/src/contracts/Multicall.client.ts b/ts/sdk/src/contracts/Multicall.client.ts deleted file mode 100644 index f0f9556e..00000000 --- a/ts/sdk/src/contracts/Multicall.client.ts +++ /dev/null @@ -1,100 +0,0 @@ -/** -* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5. -* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, -* and run the @cosmwasm/ts-codegen generate command to regenerate this file. -*/ - -import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from "@cosmjs/cosmwasm-stargate"; -import { StdFee } from "@cosmjs/amino"; -import { InstantiateMsg, ExecuteMsg, CosmosMsgForEmpty, BankMsg, Uint128, StakingMsg, DistributionMsg, Binary, IbcMsg, Timestamp, Uint64, WasmMsg, GovMsg, VoteOption, HexBinary, Coin, Empty, IbcTimeout, IbcTimeoutBlock, HandleMsg, QueryMsg, StaticCall, MigrateMsg, AggregateResponse } from "./Multicall.types"; -export interface MulticallReadOnlyInterface { - contractAddress: string; - aggregateStatic: ({ - req - }: { - req: StaticCall[]; - }) => Promise; -} -export class MulticallQueryClient implements MulticallReadOnlyInterface { - client: CosmWasmClient; - contractAddress: string; - - constructor(client: CosmWasmClient, contractAddress: string) { - this.client = client; - this.contractAddress = contractAddress; - this.aggregateStatic = this.aggregateStatic.bind(this); - } - - aggregateStatic = async ({ - req - }: { - req: StaticCall[]; - }): Promise => { - return this.client.queryContractSmart(this.contractAddress, { - aggregate_static: { - req - } - }); - }; -} -export interface MulticallInterface extends MulticallReadOnlyInterface { - contractAddress: string; - sender: string; - aggregate: ({ - req - }: { - req: CosmosMsgForEmpty[]; - }, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; - handle: ({ - body, - origin, - sender - }: { - body: HexBinary; - origin: number; - sender: HexBinary; - }, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; -} -export class MulticallClient extends MulticallQueryClient implements MulticallInterface { - client: SigningCosmWasmClient; - sender: string; - contractAddress: string; - - constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string) { - super(client, contractAddress); - this.client = client; - this.sender = sender; - this.contractAddress = contractAddress; - this.aggregate = this.aggregate.bind(this); - this.handle = this.handle.bind(this); - } - - aggregate = async ({ - req - }: { - req: CosmosMsgForEmpty[]; - }, fee: number | StdFee | "auto" = "auto", memo?: string, funds?: Coin[]): Promise => { - return await this.client.execute(this.sender, this.contractAddress, { - aggregate: { - req - } - }, fee, memo, funds); - }; - handle = async ({ - body, - origin, - sender - }: { - body: HexBinary; - origin: number; - sender: HexBinary; - }, fee: number | StdFee | "auto" = "auto", memo?: string, funds?: Coin[]): Promise => { - return await this.client.execute(this.sender, this.contractAddress, { - handle: { - body, - origin, - sender - } - }, fee, memo, funds); - }; -} \ No newline at end of file diff --git a/ts/sdk/src/contracts/Multicall.message-composer.ts b/ts/sdk/src/contracts/Multicall.message-composer.ts deleted file mode 100644 index ae170ff7..00000000 --- a/ts/sdk/src/contracts/Multicall.message-composer.ts +++ /dev/null @@ -1,84 +0,0 @@ -/** -* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5. -* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, -* and run the @cosmwasm/ts-codegen generate command to regenerate this file. -*/ - -import { MsgExecuteContractEncodeObject } from "cosmwasm"; -import { MsgExecuteContract } from "cosmjs-types/cosmwasm/wasm/v1/tx"; -import { toUtf8 } from "@cosmjs/encoding"; -import { InstantiateMsg, ExecuteMsg, CosmosMsgForEmpty, BankMsg, Uint128, StakingMsg, DistributionMsg, Binary, IbcMsg, Timestamp, Uint64, WasmMsg, GovMsg, VoteOption, HexBinary, Coin, Empty, IbcTimeout, IbcTimeoutBlock, HandleMsg, QueryMsg, StaticCall, MigrateMsg, AggregateResponse } from "./Multicall.types"; -export interface MulticallMessage { - contractAddress: string; - sender: string; - aggregate: ({ - req - }: { - req: CosmosMsgForEmpty[]; - }, funds?: Coin[]) => MsgExecuteContractEncodeObject; - handle: ({ - body, - origin, - sender - }: { - body: HexBinary; - origin: number; - sender: HexBinary; - }, funds?: Coin[]) => MsgExecuteContractEncodeObject; -} -export class MulticallMessageComposer implements MulticallMessage { - sender: string; - contractAddress: string; - - constructor(sender: string, contractAddress: string) { - this.sender = sender; - this.contractAddress = contractAddress; - this.aggregate = this.aggregate.bind(this); - this.handle = this.handle.bind(this); - } - - aggregate = ({ - req - }: { - req: CosmosMsgForEmpty[]; - }, funds?: Coin[]): MsgExecuteContractEncodeObject => { - return { - typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", - value: MsgExecuteContract.fromPartial({ - sender: this.sender, - contract: this.contractAddress, - msg: toUtf8(JSON.stringify({ - aggregate: { - req - } - })), - funds - }) - }; - }; - handle = ({ - body, - origin, - sender - }: { - body: HexBinary; - origin: number; - sender: HexBinary; - }, funds?: Coin[]): MsgExecuteContractEncodeObject => { - return { - typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", - value: MsgExecuteContract.fromPartial({ - sender: this.sender, - contract: this.contractAddress, - msg: toUtf8(JSON.stringify({ - handle: { - body, - origin, - sender - } - })), - funds - }) - }; - }; -} \ No newline at end of file diff --git a/ts/sdk/src/contracts/Multicall.types.ts b/ts/sdk/src/contracts/Multicall.types.ts deleted file mode 100644 index c2343d5f..00000000 --- a/ts/sdk/src/contracts/Multicall.types.ts +++ /dev/null @@ -1,186 +0,0 @@ -/** -* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5. -* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, -* and run the @cosmwasm/ts-codegen generate command to regenerate this file. -*/ - -export interface InstantiateMsg { - mailbox: string; - owner: string; -} -export type ExecuteMsg = { - aggregate: { - req: CosmosMsgForEmpty[]; - }; -} | { - handle: HandleMsg; -}; -export type CosmosMsgForEmpty = { - bank: BankMsg; -} | { - custom: Empty; -} | { - staking: StakingMsg; -} | { - distribution: DistributionMsg; -} | { - stargate: { - type_url: string; - value: Binary; - [k: string]: unknown; - }; -} | { - ibc: IbcMsg; -} | { - wasm: WasmMsg; -} | { - gov: GovMsg; -}; -export type BankMsg = { - send: { - amount: Coin[]; - to_address: string; - [k: string]: unknown; - }; -} | { - burn: { - amount: Coin[]; - [k: string]: unknown; - }; -}; -export type Uint128 = string; -export type StakingMsg = { - delegate: { - amount: Coin; - validator: string; - [k: string]: unknown; - }; -} | { - undelegate: { - amount: Coin; - validator: string; - [k: string]: unknown; - }; -} | { - redelegate: { - amount: Coin; - dst_validator: string; - src_validator: string; - [k: string]: unknown; - }; -}; -export type DistributionMsg = { - set_withdraw_address: { - address: string; - [k: string]: unknown; - }; -} | { - withdraw_delegator_reward: { - validator: string; - [k: string]: unknown; - }; -}; -export type Binary = string; -export type IbcMsg = { - transfer: { - amount: Coin; - channel_id: string; - timeout: IbcTimeout; - to_address: string; - [k: string]: unknown; - }; -} | { - send_packet: { - channel_id: string; - data: Binary; - timeout: IbcTimeout; - [k: string]: unknown; - }; -} | { - close_channel: { - channel_id: string; - [k: string]: unknown; - }; -}; -export type Timestamp = Uint64; -export type Uint64 = string; -export type WasmMsg = { - execute: { - contract_addr: string; - funds: Coin[]; - msg: Binary; - [k: string]: unknown; - }; -} | { - instantiate: { - admin?: string | null; - code_id: number; - funds: Coin[]; - label: string; - msg: Binary; - [k: string]: unknown; - }; -} | { - migrate: { - contract_addr: string; - msg: Binary; - new_code_id: number; - [k: string]: unknown; - }; -} | { - update_admin: { - admin: string; - contract_addr: string; - [k: string]: unknown; - }; -} | { - clear_admin: { - contract_addr: string; - [k: string]: unknown; - }; -}; -export type GovMsg = { - vote: { - proposal_id: number; - vote: VoteOption; - [k: string]: unknown; - }; -}; -export type VoteOption = "yes" | "no" | "abstain" | "no_with_veto"; -export type HexBinary = string; -export interface Coin { - amount: Uint128; - denom: string; - [k: string]: unknown; -} -export interface Empty { - [k: string]: unknown; -} -export interface IbcTimeout { - block?: IbcTimeoutBlock | null; - timestamp?: Timestamp | null; - [k: string]: unknown; -} -export interface IbcTimeoutBlock { - height: number; - revision: number; - [k: string]: unknown; -} -export interface HandleMsg { - body: HexBinary; - origin: number; - sender: HexBinary; -} -export type QueryMsg = { - aggregate_static: { - req: StaticCall[]; - }; -}; -export interface StaticCall { - data: Binary; - path: string; -} -export interface MigrateMsg {} -export interface AggregateResponse { - resp: Binary[]; -} \ No newline at end of file diff --git a/ts/sdk/src/contracts/ValidatorAnnounce.client.ts b/ts/sdk/src/contracts/ValidatorAnnounce.client.ts new file mode 100644 index 00000000..b02be612 --- /dev/null +++ b/ts/sdk/src/contracts/ValidatorAnnounce.client.ts @@ -0,0 +1,90 @@ +/** +* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. +* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, +* and run the @cosmwasm/ts-codegen generate command to regenerate this file. +*/ + +import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from "@cosmjs/cosmwasm-stargate"; +import { Coin, StdFee } from "@cosmjs/amino"; +import { InstantiateMsg, ExecuteMsg, HexBinary, QueryMsg, GetAnnounceStorageLocationsResponse, GetAnnouncedValidatorsResponse } from "./ValidatorAnnounce.types"; +export interface ValidatorAnnounceReadOnlyInterface { + contractAddress: string; + getAnnounceStorageLocations: ({ + validators + }: { + validators: HexBinary[]; + }) => Promise; + getAnnouncedValidators: () => Promise; +} +export class ValidatorAnnounceQueryClient implements ValidatorAnnounceReadOnlyInterface { + client: CosmWasmClient; + contractAddress: string; + + constructor(client: CosmWasmClient, contractAddress: string) { + this.client = client; + this.contractAddress = contractAddress; + this.getAnnounceStorageLocations = this.getAnnounceStorageLocations.bind(this); + this.getAnnouncedValidators = this.getAnnouncedValidators.bind(this); + } + + getAnnounceStorageLocations = async ({ + validators + }: { + validators: HexBinary[]; + }): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + get_announce_storage_locations: { + validators + } + }); + }; + getAnnouncedValidators = async (): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + get_announced_validators: {} + }); + }; +} +export interface ValidatorAnnounceInterface extends ValidatorAnnounceReadOnlyInterface { + contractAddress: string; + sender: string; + announce: ({ + signature, + storageLocation, + validator + }: { + signature: HexBinary; + storageLocation: string; + validator: HexBinary; + }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; +} +export class ValidatorAnnounceClient extends ValidatorAnnounceQueryClient implements ValidatorAnnounceInterface { + client: SigningCosmWasmClient; + sender: string; + contractAddress: string; + + constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string) { + super(client, contractAddress); + this.client = client; + this.sender = sender; + this.contractAddress = contractAddress; + this.announce = this.announce.bind(this); + } + + announce = async ({ + signature, + storageLocation, + validator + }: { + signature: HexBinary; + storageLocation: string; + validator: HexBinary; + }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + announce: { + signature, + storage_location: storageLocation, + validator + } + }, fee, memo, _funds); + }; +} \ No newline at end of file diff --git a/ts/sdk/src/contracts/ValidatorAnnounce.message-composer.ts b/ts/sdk/src/contracts/ValidatorAnnounce.message-composer.ts new file mode 100644 index 00000000..9681cd0b --- /dev/null +++ b/ts/sdk/src/contracts/ValidatorAnnounce.message-composer.ts @@ -0,0 +1,60 @@ +/** +* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. +* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, +* and run the @cosmwasm/ts-codegen generate command to regenerate this file. +*/ + +import { Coin } from "@cosmjs/amino"; +import { MsgExecuteContractEncodeObject } from "@cosmjs/cosmwasm-stargate"; +import { MsgExecuteContract } from "cosmjs-types/cosmwasm/wasm/v1/tx"; +import { toUtf8 } from "@cosmjs/encoding"; +import { InstantiateMsg, ExecuteMsg, HexBinary, QueryMsg, GetAnnounceStorageLocationsResponse, GetAnnouncedValidatorsResponse } from "./ValidatorAnnounce.types"; +export interface ValidatorAnnounceMsg { + contractAddress: string; + sender: string; + announce: ({ + signature, + storageLocation, + validator + }: { + signature: HexBinary; + storageLocation: string; + validator: HexBinary; + }, _funds?: Coin[]) => MsgExecuteContractEncodeObject; +} +export class ValidatorAnnounceMsgComposer implements ValidatorAnnounceMsg { + sender: string; + contractAddress: string; + + constructor(sender: string, contractAddress: string) { + this.sender = sender; + this.contractAddress = contractAddress; + this.announce = this.announce.bind(this); + } + + announce = ({ + signature, + storageLocation, + validator + }: { + signature: HexBinary; + storageLocation: string; + validator: HexBinary; + }, _funds?: Coin[]): MsgExecuteContractEncodeObject => { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", + value: MsgExecuteContract.fromPartial({ + sender: this.sender, + contract: this.contractAddress, + msg: toUtf8(JSON.stringify({ + announce: { + signature, + storage_location: storageLocation, + validator + } + })), + funds: _funds + }) + }; + }; +} \ No newline at end of file diff --git a/ts/sdk/src/contracts/ValidatorAnnounce.types.ts b/ts/sdk/src/contracts/ValidatorAnnounce.types.ts new file mode 100644 index 00000000..9f4c2100 --- /dev/null +++ b/ts/sdk/src/contracts/ValidatorAnnounce.types.ts @@ -0,0 +1,31 @@ +/** +* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. +* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, +* and run the @cosmwasm/ts-codegen generate command to regenerate this file. +*/ + +export interface InstantiateMsg { + hrp: string; + mailbox: string; +} +export type ExecuteMsg = { + announce: { + signature: HexBinary; + storage_location: string; + validator: HexBinary; + }; +}; +export type HexBinary = string; +export type QueryMsg = { + get_announce_storage_locations: { + validators: HexBinary[]; + }; +} | { + get_announced_validators: {}; +}; +export interface GetAnnounceStorageLocationsResponse { + storage_locations: [string, string[]][]; +} +export interface GetAnnouncedValidatorsResponse { + validators: string[]; +} \ No newline at end of file diff --git a/ts/sdk/src/contracts/WarpCw20.client.ts b/ts/sdk/src/contracts/WarpCw20.client.ts new file mode 100644 index 00000000..af2705b5 --- /dev/null +++ b/ts/sdk/src/contracts/WarpCw20.client.ts @@ -0,0 +1,128 @@ +/** +* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. +* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, +* and run the @cosmwasm/ts-codegen generate command to regenerate this file. +*/ + +import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from "@cosmjs/cosmwasm-stargate"; +import { Coin, StdFee } from "@cosmjs/amino"; +import { TokenModeMsgForCw20ModeBridgedAndCw20ModeCollateral, Uint128, Logo, EmbeddedLogo, Binary, InstantiateMsg, Cw20ModeBridged, InstantiateMsg1, Cw20Coin, InstantiateMarketingInfo, MinterResponse, Cw20ModeCollateral, ExecuteMsg, OwnableMsg, RouterMsgForHexBinary, HexBinary, DomainRouteSetForHexBinary, HandleMsg, Cw20ReceiveMsg, QueryMsg, OwnableQueryMsg, RouterQueryForHexBinary, Order, TokenWarpDefaultQueryMsg, DomainsResponse, Addr, OwnerResponse, PendingOwnerResponse, RouteResponseForHexBinary, RoutesResponseForHexBinary, Empty, TokenMode, TokenModeResponse, TokenType, TokenTypeNative, TokenTypeResponse } from "./WarpCw20.types"; +export interface WarpCw20ReadOnlyInterface { + contractAddress: string; + ownable: (ownableQueryMsg: OwnableQueryMsg) => Promise; + router: (routerQueryForHexBinary: RouterQueryForHexBinary) => Promise; + tokenDefault: (tokenWarpDefaultQueryMsg: TokenWarpDefaultQueryMsg) => Promise; +} +export class WarpCw20QueryClient implements WarpCw20ReadOnlyInterface { + client: CosmWasmClient; + contractAddress: string; + + constructor(client: CosmWasmClient, contractAddress: string) { + this.client = client; + this.contractAddress = contractAddress; + this.ownable = this.ownable.bind(this); + this.router = this.router.bind(this); + this.tokenDefault = this.tokenDefault.bind(this); + } + + ownable = async (ownableQueryMsg: OwnableQueryMsg): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + ownable: ownableQueryMsg + }); + }; + router = async (routerQueryForHexBinary: RouterQueryForHexBinary): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + router: routerQueryForHexBinary + }); + }; + tokenDefault = async (tokenWarpDefaultQueryMsg: TokenWarpDefaultQueryMsg): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + token_default: tokenWarpDefaultQueryMsg + }); + }; +} +export interface WarpCw20Interface extends WarpCw20ReadOnlyInterface { + contractAddress: string; + sender: string; + ownable: (ownableMsg: OwnableMsg, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + router: (routerMsgForHexBinary: RouterMsgForHexBinary, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + handle: ({ + body, + origin, + sender + }: { + body: HexBinary; + origin: number; + sender: HexBinary; + }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + receive: ({ + amount, + msg, + sender + }: { + amount: Uint128; + msg: Binary; + sender: string; + }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; +} +export class WarpCw20Client extends WarpCw20QueryClient implements WarpCw20Interface { + client: SigningCosmWasmClient; + sender: string; + contractAddress: string; + + constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string) { + super(client, contractAddress); + this.client = client; + this.sender = sender; + this.contractAddress = contractAddress; + this.ownable = this.ownable.bind(this); + this.router = this.router.bind(this); + this.handle = this.handle.bind(this); + this.receive = this.receive.bind(this); + } + + ownable = async (ownableMsg: OwnableMsg, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + ownable: ownableMsg + }, fee, memo, _funds); + }; + router = async (routerMsgForHexBinary: RouterMsgForHexBinary, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + router: routerMsgForHexBinary + }, fee, memo, _funds); + }; + handle = async ({ + body, + origin, + sender + }: { + body: HexBinary; + origin: number; + sender: HexBinary; + }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + handle: { + body, + origin, + sender + } + }, fee, memo, _funds); + }; + receive = async ({ + amount, + msg, + sender + }: { + amount: Uint128; + msg: Binary; + sender: string; + }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + receive: { + amount, + msg, + sender + } + }, fee, memo, _funds); + }; +} \ No newline at end of file diff --git a/ts/sdk/src/contracts/WarpCw20.message-composer.ts b/ts/sdk/src/contracts/WarpCw20.message-composer.ts new file mode 100644 index 00000000..9048e60b --- /dev/null +++ b/ts/sdk/src/contracts/WarpCw20.message-composer.ts @@ -0,0 +1,125 @@ +/** +* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. +* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, +* and run the @cosmwasm/ts-codegen generate command to regenerate this file. +*/ + +import { Coin } from "@cosmjs/amino"; +import { MsgExecuteContractEncodeObject } from "@cosmjs/cosmwasm-stargate"; +import { MsgExecuteContract } from "cosmjs-types/cosmwasm/wasm/v1/tx"; +import { toUtf8 } from "@cosmjs/encoding"; +import { TokenModeMsgForCw20ModeBridgedAndCw20ModeCollateral, Uint128, Logo, EmbeddedLogo, Binary, InstantiateMsg, Cw20ModeBridged, InstantiateMsg1, Cw20Coin, InstantiateMarketingInfo, MinterResponse, Cw20ModeCollateral, ExecuteMsg, OwnableMsg, RouterMsgForHexBinary, HexBinary, DomainRouteSetForHexBinary, HandleMsg, Cw20ReceiveMsg, QueryMsg, OwnableQueryMsg, RouterQueryForHexBinary, Order, TokenWarpDefaultQueryMsg, DomainsResponse, Addr, OwnerResponse, PendingOwnerResponse, RouteResponseForHexBinary, RoutesResponseForHexBinary, Empty, TokenMode, TokenModeResponse, TokenType, TokenTypeNative, TokenTypeResponse } from "./WarpCw20.types"; +export interface WarpCw20Msg { + contractAddress: string; + sender: string; + ownable: (ownableMsg: OwnableMsg, _funds?: Coin[]) => MsgExecuteContractEncodeObject; + router: (routerMsgForHexBinary: RouterMsgForHexBinary, _funds?: Coin[]) => MsgExecuteContractEncodeObject; + handle: ({ + body, + origin, + sender + }: { + body: HexBinary; + origin: number; + sender: HexBinary; + }, _funds?: Coin[]) => MsgExecuteContractEncodeObject; + receive: ({ + amount, + msg, + sender + }: { + amount: Uint128; + msg: Binary; + sender: string; + }, _funds?: Coin[]) => MsgExecuteContractEncodeObject; +} +export class WarpCw20MsgComposer implements WarpCw20Msg { + sender: string; + contractAddress: string; + + constructor(sender: string, contractAddress: string) { + this.sender = sender; + this.contractAddress = contractAddress; + this.ownable = this.ownable.bind(this); + this.router = this.router.bind(this); + this.handle = this.handle.bind(this); + this.receive = this.receive.bind(this); + } + + ownable = (ownableMsg: OwnableMsg, _funds?: Coin[]): MsgExecuteContractEncodeObject => { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", + value: MsgExecuteContract.fromPartial({ + sender: this.sender, + contract: this.contractAddress, + msg: toUtf8(JSON.stringify({ + ownable: ownableMsg + })), + funds: _funds + }) + }; + }; + router = (routerMsgForHexBinary: RouterMsgForHexBinary, _funds?: Coin[]): MsgExecuteContractEncodeObject => { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", + value: MsgExecuteContract.fromPartial({ + sender: this.sender, + contract: this.contractAddress, + msg: toUtf8(JSON.stringify({ + router: routerMsgForHexBinary + })), + funds: _funds + }) + }; + }; + handle = ({ + body, + origin, + sender + }: { + body: HexBinary; + origin: number; + sender: HexBinary; + }, _funds?: Coin[]): MsgExecuteContractEncodeObject => { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", + value: MsgExecuteContract.fromPartial({ + sender: this.sender, + contract: this.contractAddress, + msg: toUtf8(JSON.stringify({ + handle: { + body, + origin, + sender + } + })), + funds: _funds + }) + }; + }; + receive = ({ + amount, + msg, + sender + }: { + amount: Uint128; + msg: Binary; + sender: string; + }, _funds?: Coin[]): MsgExecuteContractEncodeObject => { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", + value: MsgExecuteContract.fromPartial({ + sender: this.sender, + contract: this.contractAddress, + msg: toUtf8(JSON.stringify({ + receive: { + amount, + msg, + sender + } + })), + funds: _funds + }) + }; + }; +} \ No newline at end of file diff --git a/ts/sdk/src/contracts/WarpCw20.types.ts b/ts/sdk/src/contracts/WarpCw20.types.ts new file mode 100644 index 00000000..6fd8021f --- /dev/null +++ b/ts/sdk/src/contracts/WarpCw20.types.ts @@ -0,0 +1,177 @@ +/** +* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. +* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, +* and run the @cosmwasm/ts-codegen generate command to regenerate this file. +*/ + +export type TokenModeMsgForCw20ModeBridgedAndCw20ModeCollateral = { + bridged: Cw20ModeBridged; +} | { + collateral: Cw20ModeCollateral; +}; +export type Uint128 = string; +export type Logo = { + url: string; +} | { + embedded: EmbeddedLogo; +}; +export type EmbeddedLogo = { + svg: Binary; +} | { + png: Binary; +}; +export type Binary = string; +export interface InstantiateMsg { + hrp: string; + mailbox: string; + owner: string; + token: TokenModeMsgForCw20ModeBridgedAndCw20ModeCollateral; +} +export interface Cw20ModeBridged { + code_id: number; + init_msg: InstantiateMsg1; +} +export interface InstantiateMsg1 { + decimals: number; + initial_balances: Cw20Coin[]; + marketing?: InstantiateMarketingInfo | null; + mint?: MinterResponse | null; + name: string; + symbol: string; +} +export interface Cw20Coin { + address: string; + amount: Uint128; +} +export interface InstantiateMarketingInfo { + description?: string | null; + logo?: Logo | null; + marketing?: string | null; + project?: string | null; +} +export interface MinterResponse { + cap?: Uint128 | null; + minter: string; +} +export interface Cw20ModeCollateral { + address: string; +} +export type ExecuteMsg = { + ownable: OwnableMsg; +} | { + router: RouterMsgForHexBinary; +} | { + handle: HandleMsg; +} | { + receive: Cw20ReceiveMsg; +}; +export type OwnableMsg = { + init_ownership_transfer: { + next_owner: string; + }; +} | { + revoke_ownership_transfer: {}; +} | { + claim_ownership: {}; +}; +export type RouterMsgForHexBinary = { + set_route: { + set: DomainRouteSetForHexBinary; + }; +} | { + set_routes: { + set: DomainRouteSetForHexBinary[]; + }; +}; +export type HexBinary = string; +export interface DomainRouteSetForHexBinary { + domain: number; + route?: HexBinary | null; +} +export interface HandleMsg { + body: HexBinary; + origin: number; + sender: HexBinary; +} +export interface Cw20ReceiveMsg { + amount: Uint128; + msg: Binary; + sender: string; +} +export type QueryMsg = { + ownable: OwnableQueryMsg; +} | { + router: RouterQueryForHexBinary; +} | { + token_default: TokenWarpDefaultQueryMsg; +}; +export type OwnableQueryMsg = { + get_owner: {}; +} | { + get_pending_owner: {}; +}; +export type RouterQueryForHexBinary = { + domains: {}; +} | { + get_route: { + domain: number; + }; +} | { + list_routes: { + limit?: number | null; + offset?: number | null; + order?: Order | null; + }; +}; +export type Order = "asc" | "desc"; +export type TokenWarpDefaultQueryMsg = { + token_type: {}; +} | { + token_mode: {}; +}; +export interface DomainsResponse { + domains: number[]; +} +export type Addr = string; +export interface OwnerResponse { + owner: Addr; +} +export interface PendingOwnerResponse { + pending_owner?: Addr | null; +} +export interface RouteResponseForHexBinary { + route: DomainRouteSetForHexBinary; +} +export interface RoutesResponseForHexBinary { + routes: DomainRouteSetForHexBinary[]; +} +export interface Empty { + [k: string]: unknown; +} +export type TokenMode = "bridged" | "collateral"; +export interface TokenModeResponse { + mode: TokenMode; +} +export type TokenType = { + native: TokenTypeNative; +} | { + c_w20: { + contract: string; + }; +} | { + c_w721: { + contract: string; + }; +}; +export type TokenTypeNative = { + fungible: { + denom: string; + }; +} | { + non_fungible: { + class: string; + }; +}; +export interface TokenTypeResponse { + type: TokenType; +} \ No newline at end of file diff --git a/ts/sdk/src/contracts/WarpNative.client.ts b/ts/sdk/src/contracts/WarpNative.client.ts new file mode 100644 index 00000000..e3b43357 --- /dev/null +++ b/ts/sdk/src/contracts/WarpNative.client.ts @@ -0,0 +1,123 @@ +/** +* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. +* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, +* and run the @cosmwasm/ts-codegen generate command to regenerate this file. +*/ + +import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from "@cosmjs/cosmwasm-stargate"; +import { Coin, StdFee } from "@cosmjs/amino"; +import { TokenModeMsgForNativeModeBrigedAndNativeModeCollateral, InstantiateMsg, NativeModeBriged, Metadata, DenomUnit, NativeModeCollateral, ExecuteMsg, OwnableMsg, RouterMsgForHexBinary, HexBinary, DomainRouteSetForHexBinary, HandleMsg, QueryMsg, OwnableQueryMsg, RouterQueryForHexBinary, Order, TokenWarpDefaultQueryMsg, DomainsResponse, Addr, OwnerResponse, PendingOwnerResponse, RouteResponseForHexBinary, RoutesResponseForHexBinary, Empty, TokenMode, TokenModeResponse, TokenType, TokenTypeNative, TokenTypeResponse } from "./WarpNative.types"; +export interface WarpNativeReadOnlyInterface { + contractAddress: string; + ownable: (ownableQueryMsg: OwnableQueryMsg) => Promise; + router: (routerQueryForHexBinary: RouterQueryForHexBinary) => Promise; + tokenDefault: (tokenWarpDefaultQueryMsg: TokenWarpDefaultQueryMsg) => Promise; +} +export class WarpNativeQueryClient implements WarpNativeReadOnlyInterface { + client: CosmWasmClient; + contractAddress: string; + + constructor(client: CosmWasmClient, contractAddress: string) { + this.client = client; + this.contractAddress = contractAddress; + this.ownable = this.ownable.bind(this); + this.router = this.router.bind(this); + this.tokenDefault = this.tokenDefault.bind(this); + } + + ownable = async (ownableQueryMsg: OwnableQueryMsg): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + ownable: ownableQueryMsg + }); + }; + router = async (routerQueryForHexBinary: RouterQueryForHexBinary): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + router: routerQueryForHexBinary + }); + }; + tokenDefault = async (tokenWarpDefaultQueryMsg: TokenWarpDefaultQueryMsg): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + token_default: tokenWarpDefaultQueryMsg + }); + }; +} +export interface WarpNativeInterface extends WarpNativeReadOnlyInterface { + contractAddress: string; + sender: string; + ownable: (ownableMsg: OwnableMsg, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + router: (routerMsgForHexBinary: RouterMsgForHexBinary, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + handle: ({ + body, + origin, + sender + }: { + body: HexBinary; + origin: number; + sender: HexBinary; + }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + transferRemote: ({ + destDomain, + recipient + }: { + destDomain: number; + recipient: HexBinary; + }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; +} +export class WarpNativeClient extends WarpNativeQueryClient implements WarpNativeInterface { + client: SigningCosmWasmClient; + sender: string; + contractAddress: string; + + constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string) { + super(client, contractAddress); + this.client = client; + this.sender = sender; + this.contractAddress = contractAddress; + this.ownable = this.ownable.bind(this); + this.router = this.router.bind(this); + this.handle = this.handle.bind(this); + this.transferRemote = this.transferRemote.bind(this); + } + + ownable = async (ownableMsg: OwnableMsg, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + ownable: ownableMsg + }, fee, memo, _funds); + }; + router = async (routerMsgForHexBinary: RouterMsgForHexBinary, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + router: routerMsgForHexBinary + }, fee, memo, _funds); + }; + handle = async ({ + body, + origin, + sender + }: { + body: HexBinary; + origin: number; + sender: HexBinary; + }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + handle: { + body, + origin, + sender + } + }, fee, memo, _funds); + }; + transferRemote = async ({ + destDomain, + recipient + }: { + destDomain: number; + recipient: HexBinary; + }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + transfer_remote: { + dest_domain: destDomain, + recipient + } + }, fee, memo, _funds); + }; +} \ No newline at end of file diff --git a/ts/sdk/src/contracts/WarpNative.message-composer.ts b/ts/sdk/src/contracts/WarpNative.message-composer.ts new file mode 100644 index 00000000..97af2402 --- /dev/null +++ b/ts/sdk/src/contracts/WarpNative.message-composer.ts @@ -0,0 +1,120 @@ +/** +* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. +* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, +* and run the @cosmwasm/ts-codegen generate command to regenerate this file. +*/ + +import { Coin } from "@cosmjs/amino"; +import { MsgExecuteContractEncodeObject } from "@cosmjs/cosmwasm-stargate"; +import { MsgExecuteContract } from "cosmjs-types/cosmwasm/wasm/v1/tx"; +import { toUtf8 } from "@cosmjs/encoding"; +import { TokenModeMsgForNativeModeBrigedAndNativeModeCollateral, InstantiateMsg, NativeModeBriged, Metadata, DenomUnit, NativeModeCollateral, ExecuteMsg, OwnableMsg, RouterMsgForHexBinary, HexBinary, DomainRouteSetForHexBinary, HandleMsg, QueryMsg, OwnableQueryMsg, RouterQueryForHexBinary, Order, TokenWarpDefaultQueryMsg, DomainsResponse, Addr, OwnerResponse, PendingOwnerResponse, RouteResponseForHexBinary, RoutesResponseForHexBinary, Empty, TokenMode, TokenModeResponse, TokenType, TokenTypeNative, TokenTypeResponse } from "./WarpNative.types"; +export interface WarpNativeMsg { + contractAddress: string; + sender: string; + ownable: (ownableMsg: OwnableMsg, _funds?: Coin[]) => MsgExecuteContractEncodeObject; + router: (routerMsgForHexBinary: RouterMsgForHexBinary, _funds?: Coin[]) => MsgExecuteContractEncodeObject; + handle: ({ + body, + origin, + sender + }: { + body: HexBinary; + origin: number; + sender: HexBinary; + }, _funds?: Coin[]) => MsgExecuteContractEncodeObject; + transferRemote: ({ + destDomain, + recipient + }: { + destDomain: number; + recipient: HexBinary; + }, _funds?: Coin[]) => MsgExecuteContractEncodeObject; +} +export class WarpNativeMsgComposer implements WarpNativeMsg { + sender: string; + contractAddress: string; + + constructor(sender: string, contractAddress: string) { + this.sender = sender; + this.contractAddress = contractAddress; + this.ownable = this.ownable.bind(this); + this.router = this.router.bind(this); + this.handle = this.handle.bind(this); + this.transferRemote = this.transferRemote.bind(this); + } + + ownable = (ownableMsg: OwnableMsg, _funds?: Coin[]): MsgExecuteContractEncodeObject => { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", + value: MsgExecuteContract.fromPartial({ + sender: this.sender, + contract: this.contractAddress, + msg: toUtf8(JSON.stringify({ + ownable: ownableMsg + })), + funds: _funds + }) + }; + }; + router = (routerMsgForHexBinary: RouterMsgForHexBinary, _funds?: Coin[]): MsgExecuteContractEncodeObject => { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", + value: MsgExecuteContract.fromPartial({ + sender: this.sender, + contract: this.contractAddress, + msg: toUtf8(JSON.stringify({ + router: routerMsgForHexBinary + })), + funds: _funds + }) + }; + }; + handle = ({ + body, + origin, + sender + }: { + body: HexBinary; + origin: number; + sender: HexBinary; + }, _funds?: Coin[]): MsgExecuteContractEncodeObject => { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", + value: MsgExecuteContract.fromPartial({ + sender: this.sender, + contract: this.contractAddress, + msg: toUtf8(JSON.stringify({ + handle: { + body, + origin, + sender + } + })), + funds: _funds + }) + }; + }; + transferRemote = ({ + destDomain, + recipient + }: { + destDomain: number; + recipient: HexBinary; + }, _funds?: Coin[]): MsgExecuteContractEncodeObject => { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", + value: MsgExecuteContract.fromPartial({ + sender: this.sender, + contract: this.contractAddress, + msg: toUtf8(JSON.stringify({ + transfer_remote: { + dest_domain: destDomain, + recipient + } + })), + funds: _funds + }) + }; + }; +} \ No newline at end of file diff --git a/ts/sdk/src/contracts/WarpNative.types.ts b/ts/sdk/src/contracts/WarpNative.types.ts new file mode 100644 index 00000000..bff8412c --- /dev/null +++ b/ts/sdk/src/contracts/WarpNative.types.ts @@ -0,0 +1,154 @@ +/** +* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. +* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, +* and run the @cosmwasm/ts-codegen generate command to regenerate this file. +*/ + +export type TokenModeMsgForNativeModeBrigedAndNativeModeCollateral = { + bridged: NativeModeBriged; +} | { + collateral: NativeModeCollateral; +}; +export interface InstantiateMsg { + hrp: string; + mailbox: string; + owner: string; + token: TokenModeMsgForNativeModeBrigedAndNativeModeCollateral; +} +export interface NativeModeBriged { + denom: string; + metadata?: Metadata | null; +} +export interface Metadata { + base: string; + denom_units: DenomUnit[]; + description: string; + display: string; + name: string; + symbol: string; +} +export interface DenomUnit { + aliases: string[]; + denom: string; + exponent: number; +} +export interface NativeModeCollateral { + denom: string; +} +export type ExecuteMsg = { + ownable: OwnableMsg; +} | { + router: RouterMsgForHexBinary; +} | { + handle: HandleMsg; +} | { + transfer_remote: { + dest_domain: number; + recipient: HexBinary; + }; +}; +export type OwnableMsg = { + init_ownership_transfer: { + next_owner: string; + }; +} | { + revoke_ownership_transfer: {}; +} | { + claim_ownership: {}; +}; +export type RouterMsgForHexBinary = { + set_route: { + set: DomainRouteSetForHexBinary; + }; +} | { + set_routes: { + set: DomainRouteSetForHexBinary[]; + }; +}; +export type HexBinary = string; +export interface DomainRouteSetForHexBinary { + domain: number; + route?: HexBinary | null; +} +export interface HandleMsg { + body: HexBinary; + origin: number; + sender: HexBinary; +} +export type QueryMsg = { + ownable: OwnableQueryMsg; +} | { + router: RouterQueryForHexBinary; +} | { + token_default: TokenWarpDefaultQueryMsg; +}; +export type OwnableQueryMsg = { + get_owner: {}; +} | { + get_pending_owner: {}; +}; +export type RouterQueryForHexBinary = { + domains: {}; +} | { + get_route: { + domain: number; + }; +} | { + list_routes: { + limit?: number | null; + offset?: number | null; + order?: Order | null; + }; +}; +export type Order = "asc" | "desc"; +export type TokenWarpDefaultQueryMsg = { + token_type: {}; +} | { + token_mode: {}; +}; +export interface DomainsResponse { + domains: number[]; +} +export type Addr = string; +export interface OwnerResponse { + owner: Addr; +} +export interface PendingOwnerResponse { + pending_owner?: Addr | null; +} +export interface RouteResponseForHexBinary { + route: DomainRouteSetForHexBinary; +} +export interface RoutesResponseForHexBinary { + routes: DomainRouteSetForHexBinary[]; +} +export interface Empty { + [k: string]: unknown; +} +export type TokenMode = "bridged" | "collateral"; +export interface TokenModeResponse { + mode: TokenMode; +} +export type TokenType = { + native: TokenTypeNative; +} | { + c_w20: { + contract: string; + }; +} | { + c_w721: { + contract: string; + }; +}; +export type TokenTypeNative = { + fungible: { + denom: string; + }; +} | { + non_fungible: { + class: string; + }; +}; +export interface TokenTypeResponse { + type: TokenType; +} \ No newline at end of file diff --git a/ts/sdk/src/contracts/index.ts b/ts/sdk/src/contracts/index.ts index a678f866..f1b6c425 100644 --- a/ts/sdk/src/contracts/index.ts +++ b/ts/sdk/src/contracts/index.ts @@ -1,36 +1,113 @@ /** -* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5. +* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * and run the @cosmwasm/ts-codegen generate command to regenerate this file. */ -import * as _0 from "./Hub.types"; -import * as _1 from "./Hub.client"; -import * as _2 from "./Hub.message-composer"; -import * as _3 from "./IsmMultisig.types"; -import * as _4 from "./IsmMultisig.client"; -import * as _5 from "./IsmMultisig.message-composer"; -import * as _6 from "./Mailbox.types"; -import * as _7 from "./Mailbox.client"; -import * as _8 from "./Mailbox.message-composer"; -import * as _9 from "./Multicall.types"; -import * as _10 from "./Multicall.client"; -import * as _11 from "./Multicall.message-composer"; +import * as _0 from "./HookAggregate.types"; +import * as _1 from "./HookAggregate.client"; +import * as _2 from "./HookAggregate.message-composer"; +import * as _3 from "./HookMerkle.types"; +import * as _4 from "./HookMerkle.client"; +import * as _5 from "./HookMerkle.message-composer"; +import * as _6 from "./HookPausable.types"; +import * as _7 from "./HookPausable.client"; +import * as _8 from "./HookPausable.message-composer"; +import * as _9 from "./HookRouting.types"; +import * as _10 from "./HookRouting.client"; +import * as _11 from "./HookRouting.message-composer"; +import * as _12 from "./HookRoutingCustom.types"; +import * as _13 from "./HookRoutingCustom.client"; +import * as _14 from "./HookRoutingCustom.message-composer"; +import * as _15 from "./HookRoutingFallback.types"; +import * as _16 from "./HookRoutingFallback.client"; +import * as _17 from "./HookRoutingFallback.message-composer"; +import * as _18 from "./Igp.types"; +import * as _19 from "./Igp.client"; +import * as _20 from "./Igp.message-composer"; +import * as _21 from "./IgpOracle.types"; +import * as _22 from "./IgpOracle.client"; +import * as _23 from "./IgpOracle.message-composer"; +import * as _24 from "./IsmAggregate.types"; +import * as _25 from "./IsmAggregate.client"; +import * as _26 from "./IsmAggregate.message-composer"; +import * as _27 from "./IsmMultisig.types"; +import * as _28 from "./IsmMultisig.client"; +import * as _29 from "./IsmMultisig.message-composer"; +import * as _30 from "./IsmRouting.types"; +import * as _31 from "./IsmRouting.client"; +import * as _32 from "./IsmRouting.message-composer"; +import * as _33 from "./Mailbox.types"; +import * as _34 from "./Mailbox.client"; +import * as _35 from "./Mailbox.message-composer"; +import * as _36 from "./ValidatorAnnounce.types"; +import * as _37 from "./ValidatorAnnounce.client"; +import * as _38 from "./ValidatorAnnounce.message-composer"; +import * as _39 from "./WarpCw20.types"; +import * as _40 from "./WarpCw20.client"; +import * as _41 from "./WarpCw20.message-composer"; +import * as _42 from "./WarpNative.types"; +import * as _43 from "./WarpNative.client"; +import * as _44 from "./WarpNative.message-composer"; export namespace contracts { - export const Hub = { ..._0, + export const HookAggregate = { ..._0, ..._1, ..._2 }; - export const IsmMultisig = { ..._3, + export const HookMerkle = { ..._3, ..._4, ..._5 }; - export const Mailbox = { ..._6, + export const HookPausable = { ..._6, ..._7, ..._8 }; - export const Multicall = { ..._9, + export const HookRouting = { ..._9, ..._10, ..._11 }; + export const HookRoutingCustom = { ..._12, + ..._13, + ..._14 + }; + export const HookRoutingFallback = { ..._15, + ..._16, + ..._17 + }; + export const Igp = { ..._18, + ..._19, + ..._20 + }; + export const IgpOracle = { ..._21, + ..._22, + ..._23 + }; + export const IsmAggregate = { ..._24, + ..._25, + ..._26 + }; + export const IsmMultisig = { ..._27, + ..._28, + ..._29 + }; + export const IsmRouting = { ..._30, + ..._31, + ..._32 + }; + export const Mailbox = { ..._33, + ..._34, + ..._35 + }; + export const ValidatorAnnounce = { ..._36, + ..._37, + ..._38 + }; + export const WarpCw20 = { ..._39, + ..._40, + ..._41 + }; + export const WarpNative = { ..._42, + ..._43, + ..._44 + }; } \ No newline at end of file diff --git a/ts/sdk/tsconfig.bundle.json b/ts/sdk/tsconfig.bundle.json index 7c08eb76..dda4a35f 100644 --- a/ts/sdk/tsconfig.bundle.json +++ b/ts/sdk/tsconfig.bundle.json @@ -6,7 +6,6 @@ "target": "ES5", // Output settings. - "charset": "utf-8", "newLine": "LF", "sourceMap": true, diff --git a/ts/sdk/types/contracts/Hub.client.d.ts b/ts/sdk/types/contracts/Hub.client.d.ts deleted file mode 100644 index 4aaf8ad2..00000000 --- a/ts/sdk/types/contracts/Hub.client.d.ts +++ /dev/null @@ -1,39 +0,0 @@ -/** -* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5. -* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, -* and run the @cosmwasm/ts-codegen generate command to regenerate this file. -*/ -import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from "@cosmjs/cosmwasm-stargate"; -import { Coin, StdFee } from "@cosmjs/amino"; -import { OriginDomainResponse } from "./Hub.types"; -export interface HubReadOnlyInterface { - contractAddress: string; - originDomain: () => Promise; -} -export declare class HubQueryClient implements HubReadOnlyInterface { - client: CosmWasmClient; - contractAddress: string; - constructor(client: CosmWasmClient, contractAddress: string); - originDomain: () => Promise; -} -export interface HubInterface extends HubReadOnlyInterface { - contractAddress: string; - sender: string; - instantiate: ({ defaultIsm, owner }: { - defaultIsm: string; - owner: string; - }, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; - migrate: (fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; -} -export declare class HubClient extends HubQueryClient implements HubInterface { - client: SigningCosmWasmClient; - sender: string; - contractAddress: string; - constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string); - instantiate: ({ defaultIsm, owner }: { - defaultIsm: string; - owner: string; - }, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; - migrate: (fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; -} -//# sourceMappingURL=Hub.client.d.ts.map \ No newline at end of file diff --git a/ts/sdk/types/contracts/Hub.client.d.ts.map b/ts/sdk/types/contracts/Hub.client.d.ts.map deleted file mode 100644 index a05649b3..00000000 --- a/ts/sdk/types/contracts/Hub.client.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Hub.client.d.ts","sourceRoot":"","sources":["../../src/contracts/Hub.client.ts"],"names":[],"mappings":"AAAA;;;;EAIE;AAEF,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AACjG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAoD,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACrG,MAAM,WAAW,oBAAoB;IACnC,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,OAAO,CAAC,oBAAoB,CAAC,CAAC;CACnD;AACD,qBAAa,cAAe,YAAW,oBAAoB;IACzD,MAAM,EAAE,cAAc,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;gBAEZ,MAAM,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM;IAM3D,YAAY,QAAa,QAAQ,oBAAoB,CAAC,CAIpD;CACH;AACD,MAAM,WAAW,YAAa,SAAQ,oBAAoB;IACxD,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,CAAC,EACZ,UAAU,EACV,KAAK,EACN,EAAE;QACD,UAAU,EAAE,MAAM,CAAC;QACnB,KAAK,EAAE,MAAM,CAAC;KACf,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,IAAI,EAAE,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;IAC5F,OAAO,EAAE,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,IAAI,EAAE,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;CACpG;AACD,qBAAa,SAAU,SAAQ,cAAe,YAAW,YAAY;IACnE,MAAM,EAAE,qBAAqB,CAAC;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,CAAC;gBAEZ,MAAM,EAAE,qBAAqB,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM;IASlF,WAAW;oBAIG,MAAM;eACX,MAAM;aACP,MAAM,GAAG,MAAM,GAAG,MAAM,SAAkB,MAAM,UAAU,IAAI,EAAE,KAAG,QAAQ,aAAa,CAAC,CAO/F;IACF,OAAO,SAAe,MAAM,GAAG,MAAM,GAAG,MAAM,SAAkB,MAAM,UAAU,IAAI,EAAE,KAAG,QAAQ,aAAa,CAAC,CAI7G;CACH"} \ No newline at end of file diff --git a/ts/sdk/types/contracts/Hub.message-composer.d.ts b/ts/sdk/types/contracts/Hub.message-composer.d.ts deleted file mode 100644 index b76720d7..00000000 --- a/ts/sdk/types/contracts/Hub.message-composer.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** -* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5. -* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, -* and run the @cosmwasm/ts-codegen generate command to regenerate this file. -*/ -import { Coin } from "@cosmjs/amino"; -import { MsgExecuteContractEncodeObject } from "cosmwasm"; -export interface HubMessage { - contractAddress: string; - sender: string; - instantiate: ({ defaultIsm, owner }: { - defaultIsm: string; - owner: string; - }, funds?: Coin[]) => MsgExecuteContractEncodeObject; - migrate: (funds?: Coin[]) => MsgExecuteContractEncodeObject; -} -export declare class HubMessageComposer implements HubMessage { - sender: string; - contractAddress: string; - constructor(sender: string, contractAddress: string); - instantiate: ({ defaultIsm, owner }: { - defaultIsm: string; - owner: string; - }, funds?: Coin[]) => MsgExecuteContractEncodeObject; - migrate: (funds?: Coin[]) => MsgExecuteContractEncodeObject; -} -//# sourceMappingURL=Hub.message-composer.d.ts.map \ No newline at end of file diff --git a/ts/sdk/types/contracts/Hub.message-composer.d.ts.map b/ts/sdk/types/contracts/Hub.message-composer.d.ts.map deleted file mode 100644 index 24a9a23b..00000000 --- a/ts/sdk/types/contracts/Hub.message-composer.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Hub.message-composer.d.ts","sourceRoot":"","sources":["../../src/contracts/Hub.message-composer.ts"],"names":[],"mappings":"AAAA;;;;EAIE;AAEF,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,8BAA8B,EAAE,MAAM,UAAU,CAAC;AAI1D,MAAM,WAAW,UAAU;IACzB,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,CAAC,EACZ,UAAU,EACV,KAAK,EACN,EAAE;QACD,UAAU,EAAE,MAAM,CAAC;QACnB,KAAK,EAAE,MAAM,CAAC;KACf,EAAE,KAAK,CAAC,EAAE,IAAI,EAAE,KAAK,8BAA8B,CAAC;IACrD,OAAO,EAAE,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,KAAK,8BAA8B,CAAC;CAC7D;AACD,qBAAa,kBAAmB,YAAW,UAAU;IACnD,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,CAAC;gBAEZ,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM;IAOnD,WAAW;oBAIG,MAAM;eACX,MAAM;eACJ,IAAI,EAAE,KAAG,8BAA8B,CAehD;IACF,OAAO,WAAY,IAAI,EAAE,KAAG,8BAA8B,CAYxD;CACH"} \ No newline at end of file diff --git a/ts/sdk/types/contracts/Hub.types.d.ts b/ts/sdk/types/contracts/Hub.types.d.ts deleted file mode 100644 index d560a729..00000000 --- a/ts/sdk/types/contracts/Hub.types.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** -* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5. -* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, -* and run the @cosmwasm/ts-codegen generate command to regenerate this file. -*/ -export interface InstantiateMsg { - mailbox_code: number; - origin_domain: number; -} -export type ExecuteMsg = { - instantiate: { - default_ism: string; - owner: string; - }; -} | { - migrate: {}; -}; -export type QueryMsg = { - origin_domain: {}; -}; -export interface MigrateMsg { -} -export interface OriginDomainResponse { - domain: number; -} -//# sourceMappingURL=Hub.types.d.ts.map \ No newline at end of file diff --git a/ts/sdk/types/contracts/Hub.types.d.ts.map b/ts/sdk/types/contracts/Hub.types.d.ts.map deleted file mode 100644 index d877c8b0..00000000 --- a/ts/sdk/types/contracts/Hub.types.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Hub.types.d.ts","sourceRoot":"","sources":["../../src/contracts/Hub.types.ts"],"names":[],"mappings":"AAAA;;;;EAIE;AAEF,MAAM,WAAW,cAAc;IAC7B,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;CACvB;AACD,MAAM,MAAM,UAAU,GAAG;IACvB,WAAW,EAAE;QACX,WAAW,EAAE,MAAM,CAAC;QACpB,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;CACH,GAAG;IACF,OAAO,EAAE,EAAE,CAAC;CACb,CAAC;AACF,MAAM,MAAM,QAAQ,GAAG;IACrB,aAAa,EAAE,EAAE,CAAC;CACnB,CAAC;AACF,MAAM,WAAW,UAAU;CAAG;AAC9B,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAC;CAChB"} \ No newline at end of file diff --git a/ts/sdk/types/contracts/IsmMultisig.client.d.ts b/ts/sdk/types/contracts/IsmMultisig.client.d.ts deleted file mode 100644 index 2cd77325..00000000 --- a/ts/sdk/types/contracts/IsmMultisig.client.d.ts +++ /dev/null @@ -1,79 +0,0 @@ -/** -* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5. -* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, -* and run the @cosmwasm/ts-codegen generate command to regenerate this file. -*/ -import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from "@cosmjs/cosmwasm-stargate"; -import { Coin, StdFee } from "@cosmjs/amino"; -import { ValidatorSet, ThresholdSet, HexBinary, ModuleTypeResponse, VerifyResponse } from "./IsmMultisig.types"; -export interface IsmMultisigReadOnlyInterface { - contractAddress: string; - moduleType: () => Promise; - verify: ({ message, metadata }: { - message: HexBinary; - metadata: HexBinary; - }) => Promise; -} -export declare class IsmMultisigQueryClient implements IsmMultisigReadOnlyInterface { - client: CosmWasmClient; - contractAddress: string; - constructor(client: CosmWasmClient, contractAddress: string); - moduleType: () => Promise; - verify: ({ message, metadata }: { - message: HexBinary; - metadata: HexBinary; - }) => Promise; -} -export interface IsmMultisigInterface extends IsmMultisigReadOnlyInterface { - contractAddress: string; - sender: string; - enrollValidator: ({ set }: { - set: ValidatorSet; - }, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; - enrollValidators: ({ set }: { - set: ValidatorSet[]; - }, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; - unenrollValidator: ({ domain, validator }: { - domain: number; - validator: string; - }, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; - setThreshold: ({ set }: { - set: ThresholdSet; - }, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; - setThresholds: ({ set }: { - set: ThresholdSet[]; - }, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; - initTransferOwnership: ({ owner }: { - owner: string; - }, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; - finishTransferOwnership: (fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; - revokeTransferOwnership: (fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; -} -export declare class IsmMultisigClient extends IsmMultisigQueryClient implements IsmMultisigInterface { - client: SigningCosmWasmClient; - sender: string; - contractAddress: string; - constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string); - enrollValidator: ({ set }: { - set: ValidatorSet; - }, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; - enrollValidators: ({ set }: { - set: ValidatorSet[]; - }, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; - unenrollValidator: ({ domain, validator }: { - domain: number; - validator: string; - }, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; - setThreshold: ({ set }: { - set: ThresholdSet; - }, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; - setThresholds: ({ set }: { - set: ThresholdSet[]; - }, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; - initTransferOwnership: ({ owner }: { - owner: string; - }, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; - finishTransferOwnership: (fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; - revokeTransferOwnership: (fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; -} -//# sourceMappingURL=IsmMultisig.client.d.ts.map \ No newline at end of file diff --git a/ts/sdk/types/contracts/IsmMultisig.client.d.ts.map b/ts/sdk/types/contracts/IsmMultisig.client.d.ts.map deleted file mode 100644 index e2403fa5..00000000 --- a/ts/sdk/types/contracts/IsmMultisig.client.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"IsmMultisig.client.d.ts","sourceRoot":"","sources":["../../src/contracts/IsmMultisig.client.ts"],"names":[],"mappings":"AAAA;;;;EAIE;AAEF,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AACjG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAsC,YAAY,EAAE,YAAY,EAAY,SAAS,EAAuB,kBAAkB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACnL,MAAM,WAAW,4BAA4B;IAC3C,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAC9C,MAAM,EAAE,CAAC,EACP,OAAO,EACP,QAAQ,EACT,EAAE;QACD,OAAO,EAAE,SAAS,CAAC;QACnB,QAAQ,EAAE,SAAS,CAAC;KACrB,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;CAC/B;AACD,qBAAa,sBAAuB,YAAW,4BAA4B;IACzE,MAAM,EAAE,cAAc,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;gBAEZ,MAAM,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM;IAO3D,UAAU,QAAa,QAAQ,kBAAkB,CAAC,CAIhD;IACF,MAAM;iBAIK,SAAS;kBACR,SAAS;UACjB,QAAQ,cAAc,CAAC,CAOzB;CACH;AACD,MAAM,WAAW,oBAAqB,SAAQ,4BAA4B;IACxE,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,CAAC,EAChB,GAAG,EACJ,EAAE;QACD,GAAG,EAAE,YAAY,CAAC;KACnB,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,IAAI,EAAE,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;IAC5F,gBAAgB,EAAE,CAAC,EACjB,GAAG,EACJ,EAAE;QACD,GAAG,EAAE,YAAY,EAAE,CAAC;KACrB,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,IAAI,EAAE,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;IAC5F,iBAAiB,EAAE,CAAC,EAClB,MAAM,EACN,SAAS,EACV,EAAE;QACD,MAAM,EAAE,MAAM,CAAC;QACf,SAAS,EAAE,MAAM,CAAC;KACnB,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,IAAI,EAAE,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;IAC5F,YAAY,EAAE,CAAC,EACb,GAAG,EACJ,EAAE;QACD,GAAG,EAAE,YAAY,CAAC;KACnB,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,IAAI,EAAE,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;IAC5F,aAAa,EAAE,CAAC,EACd,GAAG,EACJ,EAAE;QACD,GAAG,EAAE,YAAY,EAAE,CAAC;KACrB,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,IAAI,EAAE,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;IAC5F,qBAAqB,EAAE,CAAC,EACtB,KAAK,EACN,EAAE;QACD,KAAK,EAAE,MAAM,CAAC;KACf,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,IAAI,EAAE,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;IAC5F,uBAAuB,EAAE,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,IAAI,EAAE,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;IACnH,uBAAuB,EAAE,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,IAAI,EAAE,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;CACpH;AACD,qBAAa,iBAAkB,SAAQ,sBAAuB,YAAW,oBAAoB;IAC3F,MAAM,EAAE,qBAAqB,CAAC;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,CAAC;gBAEZ,MAAM,EAAE,qBAAqB,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM;IAelF,eAAe;aAGR,YAAY;aACX,MAAM,GAAG,MAAM,GAAG,MAAM,SAAkB,MAAM,UAAU,IAAI,EAAE,KAAG,QAAQ,aAAa,CAAC,CAM/F;IACF,gBAAgB;aAGT,YAAY,EAAE;aACb,MAAM,GAAG,MAAM,GAAG,MAAM,SAAkB,MAAM,UAAU,IAAI,EAAE,KAAG,QAAQ,aAAa,CAAC,CAM/F;IACF,iBAAiB;gBAIP,MAAM;mBACH,MAAM;aACX,MAAM,GAAG,MAAM,GAAG,MAAM,SAAkB,MAAM,UAAU,IAAI,EAAE,KAAG,QAAQ,aAAa,CAAC,CAO/F;IACF,YAAY;aAGL,YAAY;aACX,MAAM,GAAG,MAAM,GAAG,MAAM,SAAkB,MAAM,UAAU,IAAI,EAAE,KAAG,QAAQ,aAAa,CAAC,CAM/F;IACF,aAAa;aAGN,YAAY,EAAE;aACb,MAAM,GAAG,MAAM,GAAG,MAAM,SAAkB,MAAM,UAAU,IAAI,EAAE,KAAG,QAAQ,aAAa,CAAC,CAM/F;IACF,qBAAqB;eAGZ,MAAM;aACP,MAAM,GAAG,MAAM,GAAG,MAAM,SAAkB,MAAM,UAAU,IAAI,EAAE,KAAG,QAAQ,aAAa,CAAC,CAM/F;IACF,uBAAuB,SAAe,MAAM,GAAG,MAAM,GAAG,MAAM,SAAkB,MAAM,UAAU,IAAI,EAAE,KAAG,QAAQ,aAAa,CAAC,CAI7H;IACF,uBAAuB,SAAe,MAAM,GAAG,MAAM,GAAG,MAAM,SAAkB,MAAM,UAAU,IAAI,EAAE,KAAG,QAAQ,aAAa,CAAC,CAI7H;CACH"} \ No newline at end of file diff --git a/ts/sdk/types/contracts/IsmMultisig.message-composer.d.ts b/ts/sdk/types/contracts/IsmMultisig.message-composer.d.ts deleted file mode 100644 index f39b8033..00000000 --- a/ts/sdk/types/contracts/IsmMultisig.message-composer.d.ts +++ /dev/null @@ -1,60 +0,0 @@ -/** -* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5. -* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, -* and run the @cosmwasm/ts-codegen generate command to regenerate this file. -*/ -import { Coin } from "@cosmjs/amino"; -import { MsgExecuteContractEncodeObject } from "cosmwasm"; -import { ValidatorSet, ThresholdSet } from "./IsmMultisig.types"; -export interface IsmMultisigMessage { - contractAddress: string; - sender: string; - enrollValidator: ({ set }: { - set: ValidatorSet; - }, funds?: Coin[]) => MsgExecuteContractEncodeObject; - enrollValidators: ({ set }: { - set: ValidatorSet[]; - }, funds?: Coin[]) => MsgExecuteContractEncodeObject; - unenrollValidator: ({ domain, validator }: { - domain: number; - validator: string; - }, funds?: Coin[]) => MsgExecuteContractEncodeObject; - setThreshold: ({ set }: { - set: ThresholdSet; - }, funds?: Coin[]) => MsgExecuteContractEncodeObject; - setThresholds: ({ set }: { - set: ThresholdSet[]; - }, funds?: Coin[]) => MsgExecuteContractEncodeObject; - initTransferOwnership: ({ owner }: { - owner: string; - }, funds?: Coin[]) => MsgExecuteContractEncodeObject; - finishTransferOwnership: (funds?: Coin[]) => MsgExecuteContractEncodeObject; - revokeTransferOwnership: (funds?: Coin[]) => MsgExecuteContractEncodeObject; -} -export declare class IsmMultisigMessageComposer implements IsmMultisigMessage { - sender: string; - contractAddress: string; - constructor(sender: string, contractAddress: string); - enrollValidator: ({ set }: { - set: ValidatorSet; - }, funds?: Coin[]) => MsgExecuteContractEncodeObject; - enrollValidators: ({ set }: { - set: ValidatorSet[]; - }, funds?: Coin[]) => MsgExecuteContractEncodeObject; - unenrollValidator: ({ domain, validator }: { - domain: number; - validator: string; - }, funds?: Coin[]) => MsgExecuteContractEncodeObject; - setThreshold: ({ set }: { - set: ThresholdSet; - }, funds?: Coin[]) => MsgExecuteContractEncodeObject; - setThresholds: ({ set }: { - set: ThresholdSet[]; - }, funds?: Coin[]) => MsgExecuteContractEncodeObject; - initTransferOwnership: ({ owner }: { - owner: string; - }, funds?: Coin[]) => MsgExecuteContractEncodeObject; - finishTransferOwnership: (funds?: Coin[]) => MsgExecuteContractEncodeObject; - revokeTransferOwnership: (funds?: Coin[]) => MsgExecuteContractEncodeObject; -} -//# sourceMappingURL=IsmMultisig.message-composer.d.ts.map \ No newline at end of file diff --git a/ts/sdk/types/contracts/IsmMultisig.message-composer.d.ts.map b/ts/sdk/types/contracts/IsmMultisig.message-composer.d.ts.map deleted file mode 100644 index 89907a6e..00000000 --- a/ts/sdk/types/contracts/IsmMultisig.message-composer.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"IsmMultisig.message-composer.d.ts","sourceRoot":"","sources":["../../src/contracts/IsmMultisig.message-composer.ts"],"names":[],"mappings":"AAAA;;;;EAIE;AAEF,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,8BAA8B,EAAE,MAAM,UAAU,CAAC;AAG1D,OAAO,EAAsC,YAAY,EAAE,YAAY,EAAgF,MAAM,qBAAqB,CAAC;AACnL,MAAM,WAAW,kBAAkB;IACjC,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,CAAC,EAChB,GAAG,EACJ,EAAE;QACD,GAAG,EAAE,YAAY,CAAC;KACnB,EAAE,KAAK,CAAC,EAAE,IAAI,EAAE,KAAK,8BAA8B,CAAC;IACrD,gBAAgB,EAAE,CAAC,EACjB,GAAG,EACJ,EAAE;QACD,GAAG,EAAE,YAAY,EAAE,CAAC;KACrB,EAAE,KAAK,CAAC,EAAE,IAAI,EAAE,KAAK,8BAA8B,CAAC;IACrD,iBAAiB,EAAE,CAAC,EAClB,MAAM,EACN,SAAS,EACV,EAAE;QACD,MAAM,EAAE,MAAM,CAAC;QACf,SAAS,EAAE,MAAM,CAAC;KACnB,EAAE,KAAK,CAAC,EAAE,IAAI,EAAE,KAAK,8BAA8B,CAAC;IACrD,YAAY,EAAE,CAAC,EACb,GAAG,EACJ,EAAE;QACD,GAAG,EAAE,YAAY,CAAC;KACnB,EAAE,KAAK,CAAC,EAAE,IAAI,EAAE,KAAK,8BAA8B,CAAC;IACrD,aAAa,EAAE,CAAC,EACd,GAAG,EACJ,EAAE;QACD,GAAG,EAAE,YAAY,EAAE,CAAC;KACrB,EAAE,KAAK,CAAC,EAAE,IAAI,EAAE,KAAK,8BAA8B,CAAC;IACrD,qBAAqB,EAAE,CAAC,EACtB,KAAK,EACN,EAAE;QACD,KAAK,EAAE,MAAM,CAAC;KACf,EAAE,KAAK,CAAC,EAAE,IAAI,EAAE,KAAK,8BAA8B,CAAC;IACrD,uBAAuB,EAAE,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,KAAK,8BAA8B,CAAC;IAC5E,uBAAuB,EAAE,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,KAAK,8BAA8B,CAAC;CAC7E;AACD,qBAAa,0BAA2B,YAAW,kBAAkB;IACnE,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,CAAC;gBAEZ,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM;IAanD,eAAe;aAGR,YAAY;eACR,IAAI,EAAE,KAAG,8BAA8B,CAchD;IACF,gBAAgB;aAGT,YAAY,EAAE;eACV,IAAI,EAAE,KAAG,8BAA8B,CAchD;IACF,iBAAiB;gBAIP,MAAM;mBACH,MAAM;eACR,IAAI,EAAE,KAAG,8BAA8B,CAehD;IACF,YAAY;aAGL,YAAY;eACR,IAAI,EAAE,KAAG,8BAA8B,CAchD;IACF,aAAa;aAGN,YAAY,EAAE;eACV,IAAI,EAAE,KAAG,8BAA8B,CAchD;IACF,qBAAqB;eAGZ,MAAM;eACJ,IAAI,EAAE,KAAG,8BAA8B,CAchD;IACF,uBAAuB,WAAY,IAAI,EAAE,KAAG,8BAA8B,CAYxE;IACF,uBAAuB,WAAY,IAAI,EAAE,KAAG,8BAA8B,CAYxE;CACH"} \ No newline at end of file diff --git a/ts/sdk/types/contracts/IsmMultisig.types.d.ts b/ts/sdk/types/contracts/IsmMultisig.types.d.ts deleted file mode 100644 index 5af7afee..00000000 --- a/ts/sdk/types/contracts/IsmMultisig.types.d.ts +++ /dev/null @@ -1,68 +0,0 @@ -/** -* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5. -* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, -* and run the @cosmwasm/ts-codegen generate command to regenerate this file. -*/ -export interface InstantiateMsg { - chain_hpl: string; - owner: string; -} -export type ExecuteMsg = { - enroll_validator: { - set: ValidatorSet; - }; -} | { - enroll_validators: { - set: ValidatorSet[]; - }; -} | { - unenroll_validator: { - domain: number; - validator: string; - }; -} | { - set_threshold: { - set: ThresholdSet; - }; -} | { - set_thresholds: { - set: ThresholdSet[]; - }; -} | { - init_transfer_ownership: { - owner: string; - }; -} | { - finish_transfer_ownership: []; -} | { - revoke_transfer_ownership: []; -}; -export type Binary = string; -export interface ValidatorSet { - domain: number; - validator: string; - validator_pubkey: Binary; -} -export interface ThresholdSet { - domain: number; - threshold: number; -} -export type QueryMsg = { - module_type: {}; -} | { - verify: { - message: HexBinary; - metadata: HexBinary; - }; -}; -export type HexBinary = string; -export interface MigrateMsg { -} -export type ISMType = "unused" | "routing" | "aggregation" | "legacy_multisig" | "multisig" | "owned"; -export interface ModuleTypeResponse { - type: ISMType; -} -export interface VerifyResponse { - verified: boolean; -} -//# sourceMappingURL=IsmMultisig.types.d.ts.map \ No newline at end of file diff --git a/ts/sdk/types/contracts/IsmMultisig.types.d.ts.map b/ts/sdk/types/contracts/IsmMultisig.types.d.ts.map deleted file mode 100644 index 8e682873..00000000 --- a/ts/sdk/types/contracts/IsmMultisig.types.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"IsmMultisig.types.d.ts","sourceRoot":"","sources":["../../src/contracts/IsmMultisig.types.ts"],"names":[],"mappings":"AAAA;;;;EAIE;AAEF,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;CACf;AACD,MAAM,MAAM,UAAU,GAAG;IACvB,gBAAgB,EAAE;QAChB,GAAG,EAAE,YAAY,CAAC;KACnB,CAAC;CACH,GAAG;IACF,iBAAiB,EAAE;QACjB,GAAG,EAAE,YAAY,EAAE,CAAC;KACrB,CAAC;CACH,GAAG;IACF,kBAAkB,EAAE;QAClB,MAAM,EAAE,MAAM,CAAC;QACf,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;CACH,GAAG;IACF,aAAa,EAAE;QACb,GAAG,EAAE,YAAY,CAAC;KACnB,CAAC;CACH,GAAG;IACF,cAAc,EAAE;QACd,GAAG,EAAE,YAAY,EAAE,CAAC;KACrB,CAAC;CACH,GAAG;IACF,uBAAuB,EAAE;QACvB,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;CACH,GAAG;IACF,yBAAyB,EAAE,EAAE,CAAC;CAC/B,GAAG;IACF,yBAAyB,EAAE,EAAE,CAAC;CAC/B,CAAC;AACF,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC;AAC5B,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AACD,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB;AACD,MAAM,MAAM,QAAQ,GAAG;IACrB,WAAW,EAAE,EAAE,CAAC;CACjB,GAAG;IACF,MAAM,EAAE;QACN,OAAO,EAAE,SAAS,CAAC;QACnB,QAAQ,EAAE,SAAS,CAAC;KACrB,CAAC;CACH,CAAC;AACF,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC;AAC/B,MAAM,WAAW,UAAU;CAAG;AAC9B,MAAM,MAAM,OAAO,GAAG,QAAQ,GAAG,SAAS,GAAG,aAAa,GAAG,iBAAiB,GAAG,UAAU,GAAG,OAAO,CAAC;AACtG,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,OAAO,CAAC;CACf;AACD,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,OAAO,CAAC;CACnB"} \ No newline at end of file diff --git a/ts/sdk/types/contracts/Mailbox.client.d.ts b/ts/sdk/types/contracts/Mailbox.client.d.ts deleted file mode 100644 index f31e8562..00000000 --- a/ts/sdk/types/contracts/Mailbox.client.d.ts +++ /dev/null @@ -1,65 +0,0 @@ -/** -* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5. -* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, -* and run the @cosmwasm/ts-codegen generate command to regenerate this file. -*/ -import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from "@cosmjs/cosmwasm-stargate"; -import { Coin, StdFee } from "@cosmjs/amino"; -import { HexBinary, CheckPointResponse, CountResponse, NonceResponse, PausedResponse, RootResponse } from "./Mailbox.types"; -export interface MailboxReadOnlyInterface { - contractAddress: string; - root: () => Promise; - count: () => Promise; - checkPoint: () => Promise; - paused: () => Promise; - nonce: () => Promise; -} -export declare class MailboxQueryClient implements MailboxReadOnlyInterface { - client: CosmWasmClient; - contractAddress: string; - constructor(client: CosmWasmClient, contractAddress: string); - root: () => Promise; - count: () => Promise; - checkPoint: () => Promise; - paused: () => Promise; - nonce: () => Promise; -} -export interface MailboxInterface extends MailboxReadOnlyInterface { - contractAddress: string; - sender: string; - pause: (fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; - unpause: (fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; - setDefaultISM: ({ ism }: { - ism: string; - }, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; - dispatch: ({ destDomain, msgBody, recipientAddr }: { - destDomain: number; - msgBody: HexBinary; - recipientAddr: HexBinary; - }, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; - process: ({ message, metadata }: { - message: HexBinary; - metadata: HexBinary; - }, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; -} -export declare class MailboxClient extends MailboxQueryClient implements MailboxInterface { - client: SigningCosmWasmClient; - sender: string; - contractAddress: string; - constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string); - pause: (fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; - unpause: (fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; - setDefaultISM: ({ ism }: { - ism: string; - }, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; - dispatch: ({ destDomain, msgBody, recipientAddr }: { - destDomain: number; - msgBody: HexBinary; - recipientAddr: HexBinary; - }, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; - process: ({ message, metadata }: { - message: HexBinary; - metadata: HexBinary; - }, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; -} -//# sourceMappingURL=Mailbox.client.d.ts.map \ No newline at end of file diff --git a/ts/sdk/types/contracts/Mailbox.client.d.ts.map b/ts/sdk/types/contracts/Mailbox.client.d.ts.map deleted file mode 100644 index 7772095a..00000000 --- a/ts/sdk/types/contracts/Mailbox.client.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Mailbox.client.d.ts","sourceRoot":"","sources":["../../src/contracts/Mailbox.client.ts"],"names":[],"mappings":"AAAA;;;;EAIE;AAEF,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AACjG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAA8B,SAAS,EAAwB,kBAAkB,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC9K,MAAM,WAAW,wBAAwB;IACvC,eAAe,EAAE,MAAM,CAAC;IACxB,IAAI,EAAE,MAAM,OAAO,CAAC,YAAY,CAAC,CAAC;IAClC,KAAK,EAAE,MAAM,OAAO,CAAC,aAAa,CAAC,CAAC;IACpC,UAAU,EAAE,MAAM,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAC9C,MAAM,EAAE,MAAM,OAAO,CAAC,cAAc,CAAC,CAAC;IACtC,KAAK,EAAE,MAAM,OAAO,CAAC,aAAa,CAAC,CAAC;CACrC;AACD,qBAAa,kBAAmB,YAAW,wBAAwB;IACjE,MAAM,EAAE,cAAc,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;gBAEZ,MAAM,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM;IAU3D,IAAI,QAAa,QAAQ,YAAY,CAAC,CAIpC;IACF,KAAK,QAAa,QAAQ,aAAa,CAAC,CAItC;IACF,UAAU,QAAa,QAAQ,kBAAkB,CAAC,CAIhD;IACF,MAAM,QAAa,QAAQ,cAAc,CAAC,CAIxC;IACF,KAAK,QAAa,QAAQ,aAAa,CAAC,CAItC;CACH;AACD,MAAM,WAAW,gBAAiB,SAAQ,wBAAwB;IAChE,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,IAAI,EAAE,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;IACjG,OAAO,EAAE,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,IAAI,EAAE,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;IACnG,aAAa,EAAE,CAAC,EACd,GAAG,EACJ,EAAE;QACD,GAAG,EAAE,MAAM,CAAC;KACb,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,IAAI,EAAE,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;IAC5F,QAAQ,EAAE,CAAC,EACT,UAAU,EACV,OAAO,EACP,aAAa,EACd,EAAE;QACD,UAAU,EAAE,MAAM,CAAC;QACnB,OAAO,EAAE,SAAS,CAAC;QACnB,aAAa,EAAE,SAAS,CAAC;KAC1B,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,IAAI,EAAE,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;IAC5F,OAAO,EAAE,CAAC,EACR,OAAO,EACP,QAAQ,EACT,EAAE;QACD,OAAO,EAAE,SAAS,CAAC;QACnB,QAAQ,EAAE,SAAS,CAAC;KACrB,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,IAAI,EAAE,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;CAC7F;AACD,qBAAa,aAAc,SAAQ,kBAAmB,YAAW,gBAAgB;IAC/E,MAAM,EAAE,qBAAqB,CAAC;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,CAAC;gBAEZ,MAAM,EAAE,qBAAqB,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM;IAYlF,KAAK,SAAe,MAAM,GAAG,MAAM,GAAG,MAAM,SAAkB,MAAM,UAAU,IAAI,EAAE,KAAG,QAAQ,aAAa,CAAC,CAI3G;IACF,OAAO,SAAe,MAAM,GAAG,MAAM,GAAG,MAAM,SAAkB,MAAM,UAAU,IAAI,EAAE,KAAG,QAAQ,aAAa,CAAC,CAI7G;IACF,aAAa;aAGN,MAAM;aACL,MAAM,GAAG,MAAM,GAAG,MAAM,SAAkB,MAAM,UAAU,IAAI,EAAE,KAAG,QAAQ,aAAa,CAAC,CAM/F;IACF,QAAQ;oBAKM,MAAM;iBACT,SAAS;uBACH,SAAS;aAClB,MAAM,GAAG,MAAM,GAAG,MAAM,SAAkB,MAAM,UAAU,IAAI,EAAE,KAAG,QAAQ,aAAa,CAAC,CAQ/F;IACF,OAAO;iBAII,SAAS;kBACR,SAAS;aACb,MAAM,GAAG,MAAM,GAAG,MAAM,SAAkB,MAAM,UAAU,IAAI,EAAE,KAAG,QAAQ,aAAa,CAAC,CAO/F;CACH"} \ No newline at end of file diff --git a/ts/sdk/types/contracts/Mailbox.message-composer.d.ts b/ts/sdk/types/contracts/Mailbox.message-composer.d.ts deleted file mode 100644 index 5bc854b9..00000000 --- a/ts/sdk/types/contracts/Mailbox.message-composer.d.ts +++ /dev/null @@ -1,46 +0,0 @@ -/** -* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5. -* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, -* and run the @cosmwasm/ts-codegen generate command to regenerate this file. -*/ -import { Coin } from "@cosmjs/amino"; -import { MsgExecuteContractEncodeObject } from "cosmwasm"; -import { HexBinary } from "./Mailbox.types"; -export interface MailboxMessage { - contractAddress: string; - sender: string; - pause: (funds?: Coin[]) => MsgExecuteContractEncodeObject; - unpause: (funds?: Coin[]) => MsgExecuteContractEncodeObject; - setDefaultISM: ({ ism }: { - ism: string; - }, funds?: Coin[]) => MsgExecuteContractEncodeObject; - dispatch: ({ destDomain, msgBody, recipientAddr }: { - destDomain: number; - msgBody: HexBinary; - recipientAddr: HexBinary; - }, funds?: Coin[]) => MsgExecuteContractEncodeObject; - process: ({ message, metadata }: { - message: HexBinary; - metadata: HexBinary; - }, funds?: Coin[]) => MsgExecuteContractEncodeObject; -} -export declare class MailboxMessageComposer implements MailboxMessage { - sender: string; - contractAddress: string; - constructor(sender: string, contractAddress: string); - pause: (funds?: Coin[]) => MsgExecuteContractEncodeObject; - unpause: (funds?: Coin[]) => MsgExecuteContractEncodeObject; - setDefaultISM: ({ ism }: { - ism: string; - }, funds?: Coin[]) => MsgExecuteContractEncodeObject; - dispatch: ({ destDomain, msgBody, recipientAddr }: { - destDomain: number; - msgBody: HexBinary; - recipientAddr: HexBinary; - }, funds?: Coin[]) => MsgExecuteContractEncodeObject; - process: ({ message, metadata }: { - message: HexBinary; - metadata: HexBinary; - }, funds?: Coin[]) => MsgExecuteContractEncodeObject; -} -//# sourceMappingURL=Mailbox.message-composer.d.ts.map \ No newline at end of file diff --git a/ts/sdk/types/contracts/Mailbox.message-composer.d.ts.map b/ts/sdk/types/contracts/Mailbox.message-composer.d.ts.map deleted file mode 100644 index bfd14cd1..00000000 --- a/ts/sdk/types/contracts/Mailbox.message-composer.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Mailbox.message-composer.d.ts","sourceRoot":"","sources":["../../src/contracts/Mailbox.message-composer.ts"],"names":[],"mappings":"AAAA;;;;EAIE;AAEF,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,8BAA8B,EAAE,MAAM,UAAU,CAAC;AAG1D,OAAO,EAA8B,SAAS,EAAwG,MAAM,iBAAiB,CAAC;AAC9K,MAAM,WAAW,cAAc;IAC7B,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,KAAK,8BAA8B,CAAC;IAC1D,OAAO,EAAE,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,KAAK,8BAA8B,CAAC;IAC5D,aAAa,EAAE,CAAC,EACd,GAAG,EACJ,EAAE;QACD,GAAG,EAAE,MAAM,CAAC;KACb,EAAE,KAAK,CAAC,EAAE,IAAI,EAAE,KAAK,8BAA8B,CAAC;IACrD,QAAQ,EAAE,CAAC,EACT,UAAU,EACV,OAAO,EACP,aAAa,EACd,EAAE;QACD,UAAU,EAAE,MAAM,CAAC;QACnB,OAAO,EAAE,SAAS,CAAC;QACnB,aAAa,EAAE,SAAS,CAAC;KAC1B,EAAE,KAAK,CAAC,EAAE,IAAI,EAAE,KAAK,8BAA8B,CAAC;IACrD,OAAO,EAAE,CAAC,EACR,OAAO,EACP,QAAQ,EACT,EAAE;QACD,OAAO,EAAE,SAAS,CAAC;QACnB,QAAQ,EAAE,SAAS,CAAC;KACrB,EAAE,KAAK,CAAC,EAAE,IAAI,EAAE,KAAK,8BAA8B,CAAC;CACtD;AACD,qBAAa,sBAAuB,YAAW,cAAc;IAC3D,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,CAAC;gBAEZ,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM;IAUnD,KAAK,WAAY,IAAI,EAAE,KAAG,8BAA8B,CAYtD;IACF,OAAO,WAAY,IAAI,EAAE,KAAG,8BAA8B,CAYxD;IACF,aAAa;aAGN,MAAM;eACF,IAAI,EAAE,KAAG,8BAA8B,CAchD;IACF,QAAQ;oBAKM,MAAM;iBACT,SAAS;uBACH,SAAS;eACf,IAAI,EAAE,KAAG,8BAA8B,CAgBhD;IACF,OAAO;iBAII,SAAS;kBACR,SAAS;eACV,IAAI,EAAE,KAAG,8BAA8B,CAehD;CACH"} \ No newline at end of file diff --git a/ts/sdk/types/contracts/Mailbox.types.d.ts b/ts/sdk/types/contracts/Mailbox.types.d.ts deleted file mode 100644 index 1ab081a1..00000000 --- a/ts/sdk/types/contracts/Mailbox.types.d.ts +++ /dev/null @@ -1,60 +0,0 @@ -/** -* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5. -* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, -* and run the @cosmwasm/ts-codegen generate command to regenerate this file. -*/ -export interface InstantiateMsg { - default_ism: string; - owner: string; -} -export type ExecuteMsg = { - pause: {}; -} | { - unpause: {}; -} | { - set_default_i_s_m: { - ism: string; - }; -} | { - dispatch: { - dest_domain: number; - msg_body: HexBinary; - recipient_addr: HexBinary; - }; -} | { - process: { - message: HexBinary; - metadata: HexBinary; - }; -}; -export type HexBinary = string; -export type QueryMsg = { - root: {}; -} | { - count: {}; -} | { - check_point: {}; -} | { - paused: {}; -} | { - nonce: {}; -}; -export interface MigrateMsg { -} -export interface CheckPointResponse { - count: number; - root: HexBinary; -} -export interface CountResponse { - count: number; -} -export interface NonceResponse { - nonce: number; -} -export interface PausedResponse { - paused: boolean; -} -export interface RootResponse { - root: HexBinary; -} -//# sourceMappingURL=Mailbox.types.d.ts.map \ No newline at end of file diff --git a/ts/sdk/types/contracts/Mailbox.types.d.ts.map b/ts/sdk/types/contracts/Mailbox.types.d.ts.map deleted file mode 100644 index ef1e024a..00000000 --- a/ts/sdk/types/contracts/Mailbox.types.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Mailbox.types.d.ts","sourceRoot":"","sources":["../../src/contracts/Mailbox.types.ts"],"names":[],"mappings":"AAAA;;;;EAIE;AAEF,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;CACf;AACD,MAAM,MAAM,UAAU,GAAG;IACvB,KAAK,EAAE,EAAE,CAAC;CACX,GAAG;IACF,OAAO,EAAE,EAAE,CAAC;CACb,GAAG;IACF,iBAAiB,EAAE;QACjB,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;CACH,GAAG;IACF,QAAQ,EAAE;QACR,WAAW,EAAE,MAAM,CAAC;QACpB,QAAQ,EAAE,SAAS,CAAC;QACpB,cAAc,EAAE,SAAS,CAAC;KAC3B,CAAC;CACH,GAAG;IACF,OAAO,EAAE;QACP,OAAO,EAAE,SAAS,CAAC;QACnB,QAAQ,EAAE,SAAS,CAAC;KACrB,CAAC;CACH,CAAC;AACF,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC;AAC/B,MAAM,MAAM,QAAQ,GAAG;IACrB,IAAI,EAAE,EAAE,CAAC;CACV,GAAG;IACF,KAAK,EAAE,EAAE,CAAC;CACX,GAAG;IACF,WAAW,EAAE,EAAE,CAAC;CACjB,GAAG;IACF,MAAM,EAAE,EAAE,CAAC;CACZ,GAAG;IACF,KAAK,EAAE,EAAE,CAAC;CACX,CAAC;AACF,MAAM,WAAW,UAAU;CAAG;AAC9B,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,SAAS,CAAC;CACjB;AACD,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;CACf;AACD,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;CACf;AACD,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,OAAO,CAAC;CACjB;AACD,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,SAAS,CAAC;CACjB"} \ No newline at end of file diff --git a/ts/sdk/types/contracts/Multicall.client.d.ts b/ts/sdk/types/contracts/Multicall.client.d.ts deleted file mode 100644 index a40b2313..00000000 --- a/ts/sdk/types/contracts/Multicall.client.d.ts +++ /dev/null @@ -1,49 +0,0 @@ -/** -* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5. -* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, -* and run the @cosmwasm/ts-codegen generate command to regenerate this file. -*/ -import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from "@cosmjs/cosmwasm-stargate"; -import { StdFee } from "@cosmjs/amino"; -import { CosmosMsgForEmpty, HexBinary, Coin, StaticCall, AggregateResponse } from "./Multicall.types"; -export interface MulticallReadOnlyInterface { - contractAddress: string; - aggregateStatic: ({ req }: { - req: StaticCall[]; - }) => Promise; -} -export declare class MulticallQueryClient implements MulticallReadOnlyInterface { - client: CosmWasmClient; - contractAddress: string; - constructor(client: CosmWasmClient, contractAddress: string); - aggregateStatic: ({ req }: { - req: StaticCall[]; - }) => Promise; -} -export interface MulticallInterface extends MulticallReadOnlyInterface { - contractAddress: string; - sender: string; - aggregate: ({ req }: { - req: CosmosMsgForEmpty[]; - }, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; - handle: ({ body, origin, sender }: { - body: HexBinary; - origin: number; - sender: HexBinary; - }, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; -} -export declare class MulticallClient extends MulticallQueryClient implements MulticallInterface { - client: SigningCosmWasmClient; - sender: string; - contractAddress: string; - constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string); - aggregate: ({ req }: { - req: CosmosMsgForEmpty[]; - }, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; - handle: ({ body, origin, sender }: { - body: HexBinary; - origin: number; - sender: HexBinary; - }, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; -} -//# sourceMappingURL=Multicall.client.d.ts.map \ No newline at end of file diff --git a/ts/sdk/types/contracts/Multicall.client.d.ts.map b/ts/sdk/types/contracts/Multicall.client.d.ts.map deleted file mode 100644 index b75e6b78..00000000 --- a/ts/sdk/types/contracts/Multicall.client.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Multicall.client.d.ts","sourceRoot":"","sources":["../../src/contracts/Multicall.client.ts"],"names":[],"mappings":"AAAA;;;;EAIE;AAEF,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AACjG,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAA8B,iBAAiB,EAAiH,SAAS,EAAE,IAAI,EAA2D,UAAU,EAAc,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtT,MAAM,WAAW,0BAA0B;IACzC,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,CAAC,EAChB,GAAG,EACJ,EAAE;QACD,GAAG,EAAE,UAAU,EAAE,CAAC;KACnB,KAAK,OAAO,CAAC,iBAAiB,CAAC,CAAC;CAClC;AACD,qBAAa,oBAAqB,YAAW,0BAA0B;IACrE,MAAM,EAAE,cAAc,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;gBAEZ,MAAM,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM;IAM3D,eAAe;aAGR,UAAU,EAAE;UACf,QAAQ,iBAAiB,CAAC,CAM5B;CACH;AACD,MAAM,WAAW,kBAAmB,SAAQ,0BAA0B;IACpE,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,CAAC,EACV,GAAG,EACJ,EAAE;QACD,GAAG,EAAE,iBAAiB,EAAE,CAAC;KAC1B,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,IAAI,EAAE,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;IAC5F,MAAM,EAAE,CAAC,EACP,IAAI,EACJ,MAAM,EACN,MAAM,EACP,EAAE;QACD,IAAI,EAAE,SAAS,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,SAAS,CAAC;KACnB,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,IAAI,EAAE,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;CAC7F;AACD,qBAAa,eAAgB,SAAQ,oBAAqB,YAAW,kBAAkB;IACrF,MAAM,EAAE,qBAAqB,CAAC;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,CAAC;gBAEZ,MAAM,EAAE,qBAAqB,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM;IASlF,SAAS;aAGF,iBAAiB,EAAE;aAClB,MAAM,GAAG,MAAM,GAAG,MAAM,SAAkB,MAAM,UAAU,IAAI,EAAE,KAAG,QAAQ,aAAa,CAAC,CAM/F;IACF,MAAM;cAKE,SAAS;gBACP,MAAM;gBACN,SAAS;aACX,MAAM,GAAG,MAAM,GAAG,MAAM,SAAkB,MAAM,UAAU,IAAI,EAAE,KAAG,QAAQ,aAAa,CAAC,CAQ/F;CACH"} \ No newline at end of file diff --git a/ts/sdk/types/contracts/Multicall.message-composer.d.ts b/ts/sdk/types/contracts/Multicall.message-composer.d.ts deleted file mode 100644 index 148affa4..00000000 --- a/ts/sdk/types/contracts/Multicall.message-composer.d.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** -* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5. -* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, -* and run the @cosmwasm/ts-codegen generate command to regenerate this file. -*/ -import { MsgExecuteContractEncodeObject } from "cosmwasm"; -import { CosmosMsgForEmpty, HexBinary, Coin } from "./Multicall.types"; -export interface MulticallMessage { - contractAddress: string; - sender: string; - aggregate: ({ req }: { - req: CosmosMsgForEmpty[]; - }, funds?: Coin[]) => MsgExecuteContractEncodeObject; - handle: ({ body, origin, sender }: { - body: HexBinary; - origin: number; - sender: HexBinary; - }, funds?: Coin[]) => MsgExecuteContractEncodeObject; -} -export declare class MulticallMessageComposer implements MulticallMessage { - sender: string; - contractAddress: string; - constructor(sender: string, contractAddress: string); - aggregate: ({ req }: { - req: CosmosMsgForEmpty[]; - }, funds?: Coin[]) => MsgExecuteContractEncodeObject; - handle: ({ body, origin, sender }: { - body: HexBinary; - origin: number; - sender: HexBinary; - }, funds?: Coin[]) => MsgExecuteContractEncodeObject; -} -//# sourceMappingURL=Multicall.message-composer.d.ts.map \ No newline at end of file diff --git a/ts/sdk/types/contracts/Multicall.message-composer.d.ts.map b/ts/sdk/types/contracts/Multicall.message-composer.d.ts.map deleted file mode 100644 index 5966e606..00000000 --- a/ts/sdk/types/contracts/Multicall.message-composer.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Multicall.message-composer.d.ts","sourceRoot":"","sources":["../../src/contracts/Multicall.message-composer.ts"],"names":[],"mappings":"AAAA;;;;EAIE;AAEF,OAAO,EAAE,8BAA8B,EAAE,MAAM,UAAU,CAAC;AAG1D,OAAO,EAA8B,iBAAiB,EAAiH,SAAS,EAAE,IAAI,EAAsG,MAAM,mBAAmB,CAAC;AACtT,MAAM,WAAW,gBAAgB;IAC/B,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,CAAC,EACV,GAAG,EACJ,EAAE;QACD,GAAG,EAAE,iBAAiB,EAAE,CAAC;KAC1B,EAAE,KAAK,CAAC,EAAE,IAAI,EAAE,KAAK,8BAA8B,CAAC;IACrD,MAAM,EAAE,CAAC,EACP,IAAI,EACJ,MAAM,EACN,MAAM,EACP,EAAE;QACD,IAAI,EAAE,SAAS,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,SAAS,CAAC;KACnB,EAAE,KAAK,CAAC,EAAE,IAAI,EAAE,KAAK,8BAA8B,CAAC;CACtD;AACD,qBAAa,wBAAyB,YAAW,gBAAgB;IAC/D,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,CAAC;gBAEZ,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM;IAOnD,SAAS;aAGF,iBAAiB,EAAE;eACf,IAAI,EAAE,KAAG,8BAA8B,CAchD;IACF,MAAM;cAKE,SAAS;gBACP,MAAM;gBACN,SAAS;eACR,IAAI,EAAE,KAAG,8BAA8B,CAgBhD;CACH"} \ No newline at end of file diff --git a/ts/sdk/types/contracts/Multicall.types.d.ts b/ts/sdk/types/contracts/Multicall.types.d.ts deleted file mode 100644 index 9074afae..00000000 --- a/ts/sdk/types/contracts/Multicall.types.d.ts +++ /dev/null @@ -1,187 +0,0 @@ -/** -* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5. -* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, -* and run the @cosmwasm/ts-codegen generate command to regenerate this file. -*/ -export interface InstantiateMsg { - mailbox: string; - owner: string; -} -export type ExecuteMsg = { - aggregate: { - req: CosmosMsgForEmpty[]; - }; -} | { - handle: HandleMsg; -}; -export type CosmosMsgForEmpty = { - bank: BankMsg; -} | { - custom: Empty; -} | { - staking: StakingMsg; -} | { - distribution: DistributionMsg; -} | { - stargate: { - type_url: string; - value: Binary; - [k: string]: unknown; - }; -} | { - ibc: IbcMsg; -} | { - wasm: WasmMsg; -} | { - gov: GovMsg; -}; -export type BankMsg = { - send: { - amount: Coin[]; - to_address: string; - [k: string]: unknown; - }; -} | { - burn: { - amount: Coin[]; - [k: string]: unknown; - }; -}; -export type Uint128 = string; -export type StakingMsg = { - delegate: { - amount: Coin; - validator: string; - [k: string]: unknown; - }; -} | { - undelegate: { - amount: Coin; - validator: string; - [k: string]: unknown; - }; -} | { - redelegate: { - amount: Coin; - dst_validator: string; - src_validator: string; - [k: string]: unknown; - }; -}; -export type DistributionMsg = { - set_withdraw_address: { - address: string; - [k: string]: unknown; - }; -} | { - withdraw_delegator_reward: { - validator: string; - [k: string]: unknown; - }; -}; -export type Binary = string; -export type IbcMsg = { - transfer: { - amount: Coin; - channel_id: string; - timeout: IbcTimeout; - to_address: string; - [k: string]: unknown; - }; -} | { - send_packet: { - channel_id: string; - data: Binary; - timeout: IbcTimeout; - [k: string]: unknown; - }; -} | { - close_channel: { - channel_id: string; - [k: string]: unknown; - }; -}; -export type Timestamp = Uint64; -export type Uint64 = string; -export type WasmMsg = { - execute: { - contract_addr: string; - funds: Coin[]; - msg: Binary; - [k: string]: unknown; - }; -} | { - instantiate: { - admin?: string | null; - code_id: number; - funds: Coin[]; - label: string; - msg: Binary; - [k: string]: unknown; - }; -} | { - migrate: { - contract_addr: string; - msg: Binary; - new_code_id: number; - [k: string]: unknown; - }; -} | { - update_admin: { - admin: string; - contract_addr: string; - [k: string]: unknown; - }; -} | { - clear_admin: { - contract_addr: string; - [k: string]: unknown; - }; -}; -export type GovMsg = { - vote: { - proposal_id: number; - vote: VoteOption; - [k: string]: unknown; - }; -}; -export type VoteOption = "yes" | "no" | "abstain" | "no_with_veto"; -export type HexBinary = string; -export interface Coin { - amount: Uint128; - denom: string; - [k: string]: unknown; -} -export interface Empty { - [k: string]: unknown; -} -export interface IbcTimeout { - block?: IbcTimeoutBlock | null; - timestamp?: Timestamp | null; - [k: string]: unknown; -} -export interface IbcTimeoutBlock { - height: number; - revision: number; - [k: string]: unknown; -} -export interface HandleMsg { - body: HexBinary; - origin: number; - sender: HexBinary; -} -export type QueryMsg = { - aggregate_static: { - req: StaticCall[]; - }; -}; -export interface StaticCall { - data: Binary; - path: string; -} -export interface MigrateMsg { -} -export interface AggregateResponse { - resp: Binary[]; -} -//# sourceMappingURL=Multicall.types.d.ts.map \ No newline at end of file diff --git a/ts/sdk/types/contracts/Multicall.types.d.ts.map b/ts/sdk/types/contracts/Multicall.types.d.ts.map deleted file mode 100644 index 80d4217e..00000000 --- a/ts/sdk/types/contracts/Multicall.types.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Multicall.types.d.ts","sourceRoot":"","sources":["../../src/contracts/Multicall.types.ts"],"names":[],"mappings":"AAAA;;;;EAIE;AAEF,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf;AACD,MAAM,MAAM,UAAU,GAAG;IACvB,SAAS,EAAE;QACT,GAAG,EAAE,iBAAiB,EAAE,CAAC;KAC1B,CAAC;CACH,GAAG;IACF,MAAM,EAAE,SAAS,CAAC;CACnB,CAAC;AACF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,OAAO,CAAC;CACf,GAAG;IACF,MAAM,EAAE,KAAK,CAAC;CACf,GAAG;IACF,OAAO,EAAE,UAAU,CAAC;CACrB,GAAG;IACF,YAAY,EAAE,eAAe,CAAC;CAC/B,GAAG;IACF,QAAQ,EAAE;QACR,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;QACd,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;KACtB,CAAC;CACH,GAAG;IACF,GAAG,EAAE,MAAM,CAAC;CACb,GAAG;IACF,IAAI,EAAE,OAAO,CAAC;CACf,GAAG;IACF,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AACF,MAAM,MAAM,OAAO,GAAG;IACpB,IAAI,EAAE;QACJ,MAAM,EAAE,IAAI,EAAE,CAAC;QACf,UAAU,EAAE,MAAM,CAAC;QACnB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;KACtB,CAAC;CACH,GAAG;IACF,IAAI,EAAE;QACJ,MAAM,EAAE,IAAI,EAAE,CAAC;QACf,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;KACtB,CAAC;CACH,CAAC;AACF,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC;AAC7B,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,EAAE;QACR,MAAM,EAAE,IAAI,CAAC;QACb,SAAS,EAAE,MAAM,CAAC;QAClB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;KACtB,CAAC;CACH,GAAG;IACF,UAAU,EAAE;QACV,MAAM,EAAE,IAAI,CAAC;QACb,SAAS,EAAE,MAAM,CAAC;QAClB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;KACtB,CAAC;CACH,GAAG;IACF,UAAU,EAAE;QACV,MAAM,EAAE,IAAI,CAAC;QACb,aAAa,EAAE,MAAM,CAAC;QACtB,aAAa,EAAE,MAAM,CAAC;QACtB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;KACtB,CAAC;CACH,CAAC;AACF,MAAM,MAAM,eAAe,GAAG;IAC5B,oBAAoB,EAAE;QACpB,OAAO,EAAE,MAAM,CAAC;QAChB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;KACtB,CAAC;CACH,GAAG;IACF,yBAAyB,EAAE;QACzB,SAAS,EAAE,MAAM,CAAC;QAClB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;KACtB,CAAC;CACH,CAAC;AACF,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC;AAC5B,MAAM,MAAM,MAAM,GAAG;IACnB,QAAQ,EAAE;QACR,MAAM,EAAE,IAAI,CAAC;QACb,UAAU,EAAE,MAAM,CAAC;QACnB,OAAO,EAAE,UAAU,CAAC;QACpB,UAAU,EAAE,MAAM,CAAC;QACnB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;KACtB,CAAC;CACH,GAAG;IACF,WAAW,EAAE;QACX,UAAU,EAAE,MAAM,CAAC;QACnB,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,UAAU,CAAC;QACpB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;KACtB,CAAC;CACH,GAAG;IACF,aAAa,EAAE;QACb,UAAU,EAAE,MAAM,CAAC;QACnB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;KACtB,CAAC;CACH,CAAC;AACF,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC;AAC/B,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC;AAC5B,MAAM,MAAM,OAAO,GAAG;IACpB,OAAO,EAAE;QACP,aAAa,EAAE,MAAM,CAAC;QACtB,KAAK,EAAE,IAAI,EAAE,CAAC;QACd,GAAG,EAAE,MAAM,CAAC;QACZ,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;KACtB,CAAC;CACH,GAAG;IACF,WAAW,EAAE;QACX,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACtB,OAAO,EAAE,MAAM,CAAC;QAChB,KAAK,EAAE,IAAI,EAAE,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;QACd,GAAG,EAAE,MAAM,CAAC;QACZ,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;KACtB,CAAC;CACH,GAAG;IACF,OAAO,EAAE;QACP,aAAa,EAAE,MAAM,CAAC;QACtB,GAAG,EAAE,MAAM,CAAC;QACZ,WAAW,EAAE,MAAM,CAAC;QACpB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;KACtB,CAAC;CACH,GAAG;IACF,YAAY,EAAE;QACZ,KAAK,EAAE,MAAM,CAAC;QACd,aAAa,EAAE,MAAM,CAAC;QACtB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;KACtB,CAAC;CACH,GAAG;IACF,WAAW,EAAE;QACX,aAAa,EAAE,MAAM,CAAC;QACtB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;KACtB,CAAC;CACH,CAAC;AACF,MAAM,MAAM,MAAM,GAAG;IACnB,IAAI,EAAE;QACJ,WAAW,EAAE,MAAM,CAAC;QACpB,IAAI,EAAE,UAAU,CAAC;QACjB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;KACtB,CAAC;CACH,CAAC;AACF,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,IAAI,GAAG,SAAS,GAAG,cAAc,CAAC;AACnE,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC;AAC/B,MAAM,WAAW,IAAI;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACtB;AACD,MAAM,WAAW,KAAK;IACpB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACtB;AACD,MAAM,WAAW,UAAU;IACzB,KAAK,CAAC,EAAE,eAAe,GAAG,IAAI,CAAC;IAC/B,SAAS,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;IAC7B,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACtB;AACD,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACtB;AACD,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,SAAS,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,SAAS,CAAC;CACnB;AACD,MAAM,MAAM,QAAQ,GAAG;IACrB,gBAAgB,EAAE;QAChB,GAAG,EAAE,UAAU,EAAE,CAAC;KACnB,CAAC;CACH,CAAC;AACF,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AACD,MAAM,WAAW,UAAU;CAAG;AAC9B,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB"} \ No newline at end of file diff --git a/ts/sdk/types/contracts/index.d.ts b/ts/sdk/types/contracts/index.d.ts deleted file mode 100644 index 936d728c..00000000 --- a/ts/sdk/types/contracts/index.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -/** -* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5. -* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, -* and run the @cosmwasm/ts-codegen generate command to regenerate this file. -*/ -import * as _1 from "./Hub.client"; -import * as _2 from "./Hub.message-composer"; -import * as _4 from "./IsmMultisig.client"; -import * as _5 from "./IsmMultisig.message-composer"; -import * as _7 from "./Mailbox.client"; -import * as _8 from "./Mailbox.message-composer"; -import * as _10 from "./Multicall.client"; -import * as _11 from "./Multicall.message-composer"; -export declare namespace contracts { - const Hub: { - HubMessageComposer: typeof _2.HubMessageComposer; - HubQueryClient: typeof _1.HubQueryClient; - HubClient: typeof _1.HubClient; - }; - const IsmMultisig: { - IsmMultisigMessageComposer: typeof _5.IsmMultisigMessageComposer; - IsmMultisigQueryClient: typeof _4.IsmMultisigQueryClient; - IsmMultisigClient: typeof _4.IsmMultisigClient; - }; - const Mailbox: { - MailboxMessageComposer: typeof _8.MailboxMessageComposer; - MailboxQueryClient: typeof _7.MailboxQueryClient; - MailboxClient: typeof _7.MailboxClient; - }; - const Multicall: { - MulticallMessageComposer: typeof _11.MulticallMessageComposer; - MulticallQueryClient: typeof _10.MulticallQueryClient; - MulticallClient: typeof _10.MulticallClient; - }; -} -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/ts/sdk/types/contracts/index.d.ts.map b/ts/sdk/types/contracts/index.d.ts.map deleted file mode 100644 index a93dea97..00000000 --- a/ts/sdk/types/contracts/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contracts/index.ts"],"names":[],"mappings":"AAAA;;;;EAIE;AAGF,OAAO,KAAK,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAE7C,OAAO,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC3C,OAAO,KAAK,EAAE,MAAM,gCAAgC,CAAC;AAErD,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAEjD,OAAO,KAAK,GAAG,MAAM,oBAAoB,CAAC;AAC1C,OAAO,KAAK,GAAG,MAAM,8BAA8B,CAAC;AACpD,yBAAiB,SAAS,CAAC;IAClB,MAAM,GAAG;;;;KAGf,CAAC;IACK,MAAM,WAAW;;;;KAGvB,CAAC;IACK,MAAM,OAAO;;;;KAGnB,CAAC;IACK,MAAM,SAAS;;;;KAGrB,CAAC;CACH"} \ No newline at end of file diff --git a/ts/sdk/types/index.d.ts b/ts/sdk/types/index.d.ts deleted file mode 100644 index 14e3ba3d..00000000 --- a/ts/sdk/types/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { contracts } from "./contracts"; -export default contracts; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/ts/sdk/types/index.d.ts.map b/ts/sdk/types/index.d.ts.map deleted file mode 100644 index e157bfd4..00000000 --- a/ts/sdk/types/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,eAAe,SAAS,CAAC"} \ No newline at end of file