diff --git a/.github/workflows/cache.yml b/.github/workflows/cache.yml deleted file mode 100644 index 80def8fb..00000000 --- a/.github/workflows/cache.yml +++ /dev/null @@ -1,43 +0,0 @@ ---- -# yamllint disable rule:line-length -name: Clear cache - -on: - schedule: - - cron: '30 1 * * 1-5' - workflow_dispatch: - -jobs: - job1: - name: Clear Docker - if: always() - runs-on: ${{ matrix.runner_label }} - strategy: - matrix: - runner_label: ${{ fromJSON('["lionco-runner-1", "lionco-runner-2", "lionco-runner-3", "lionco-runner-4", "lionco-runner-5", "lionco-runner-6", "lionco-runner-7", "lionco-runner-8", "lionco-runner-9", "lionco-runner-10"]') }} - steps: - - name: Stop old containers - run: docker ps -q | grep -q . && docker stop $(docker ps -q) -t0 || echo "No containers to stop" - - name: Remove old containers - run: docker ps -a -q | grep -q . && docker rm $(docker ps -a -q) || echo "No containers to remove" - - name: Remove all volumes - run: docker volume ls -q | grep -q . && docker volume rm $(docker volume ls -q) || echo "No volumes to remove" - - name: Delete old images - run: docker system prune --volumes --all --force - job2: - name: Clear workspaces - if: always() - needs: job1 - runs-on: ${{ matrix.runner_label }} - strategy: - matrix: - runner_label: ${{ fromJSON('["lionco-runner-1", "lionco-runner-2", "lionco-runner-3", "lionco-runner-4", "lionco-runner-5", "lionco-runner-6", "lionco-runner-7", "lionco-runner-8", "lionco-runner-9", "lionco-runner-10"]') }} - steps: - - name: Clean Workspace - if: always() - uses: AutoModality/action-clean@v1.1.0 - - uses: xembly/workflow-manager@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - run: clean - verbose: true diff --git a/.github/workflows/cleanup.yml b/.github/workflows/cleanup.yml index fa2ba7cb..11ca9fda 100644 --- a/.github/workflows/cleanup.yml +++ b/.github/workflows/cleanup.yml @@ -42,7 +42,7 @@ on: jobs: del_runs: - runs-on: self-hosted + runs-on: ubicloud-standard-2 steps: - name: Delete workflow runs uses: Mattraks/delete-workflow-runs@v2 diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 6d9db1f1..c2a53d6e 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -13,7 +13,7 @@ jobs: # This job only runs for pull request comments name: PR comment if: ${{ github.event.issue.pull_request }} - runs-on: ubuntu-latest + runs-on: ubicloud-standard-2 steps: - name: Send Notification uses: appleboy/telegram-action@master @@ -26,7 +26,7 @@ jobs: pull_requests_and_review: name: Pull request action or review if: ${{ !github.event.issue.pull_request }} - runs-on: ubuntu-latest + runs-on: ubicloud-standard-2 steps: - name: Send Notification uses: appleboy/telegram-action@master diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 40229036..798db0e0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -6,7 +6,7 @@ name: tests jobs: clippy: name: Actions - clippy - runs-on: self-hosted + runs-on: ubicloud-standard-4 steps: - uses: actions/checkout@v4 with: @@ -23,7 +23,7 @@ jobs: - run: cargo clippy --lib --target wasm32-unknown-unknown -- -D warnings coverage: name: Actions - unit tests coverage - runs-on: self-hosted + runs-on: ubicloud-standard-4 steps: - uses: actions/checkout@v4 with: @@ -32,7 +32,7 @@ jobs: run: sudo apt-get update && sudo apt-get install -y pkg-config libssl-dev - uses: actions-rs/toolchain@v1 with: - toolchain: nightly + toolchain: nightly-2023-12-21 profile: minimal override: true - name: Install cargo-tarpaulin @@ -59,7 +59,7 @@ jobs: coverage-summary-title: Code Coverage Summary rustfmt: name: Actions - rustfmt - runs-on: self-hosted + runs-on: ubicloud-standard-4 steps: - uses: actions/checkout@v4 with: @@ -73,7 +73,7 @@ jobs: - run: cargo fmt -- --check unit-test: name: Actions - unit test - runs-on: self-hosted + runs-on: ubicloud-standard-4 steps: - uses: actions/checkout@v4 with: @@ -89,7 +89,7 @@ jobs: RUST_BACKTRACE: 1 lint-test: name: Actions - integration tests lint - runs-on: self-hosted + runs-on: ubicloud-standard-4 steps: - name: Setup node uses: actions/setup-node@v4 @@ -104,7 +104,7 @@ jobs: run: cd integration_tests && yarn --ignore-engines && yarn lint images-prepare: name: Actions - images prepare - runs-on: self-hosted + runs-on: ubicloud-standard-4 steps: - name: Upgrade docker compose to use v2 run: sudo curl -L @@ -136,7 +136,7 @@ jobs: yarn build-images artifacts-prepare: name: Actions - artifacts prepare - runs-on: self-hosted + runs-on: ubicloud-standard-4 steps: - uses: actions/checkout@v4 with: @@ -157,7 +157,7 @@ jobs: needs: - images-prepare - artifacts-prepare - runs-on: self-hosted + runs-on: ubicloud-standard-4 steps: - name: Upgrade docker compose to use v2 run: sudo curl -L @@ -202,7 +202,7 @@ jobs: needs: - images-prepare - artifacts-prepare - runs-on: self-hosted + runs-on: ubicloud-standard-4 steps: - name: Upgrade docker compose to use v2 run: sudo curl -L @@ -247,7 +247,7 @@ jobs: needs: - images-prepare - artifacts-prepare - runs-on: self-hosted + runs-on: ubicloud-standard-4 steps: - name: Upgrade docker compose to use v2 run: sudo curl -L @@ -292,7 +292,7 @@ jobs: needs: - images-prepare - artifacts-prepare - runs-on: self-hosted + runs-on: ubicloud-standard-4 steps: - name: Upgrade docker compose to use v2 run: sudo curl -L @@ -337,7 +337,7 @@ jobs: needs: - images-prepare - artifacts-prepare - runs-on: self-hosted + runs-on: ubicloud-standard-4 steps: - name: Upgrade docker compose to use v2 run: sudo curl -L @@ -382,7 +382,7 @@ jobs: needs: - images-prepare - artifacts-prepare - runs-on: self-hosted + runs-on: ubicloud-standard-4 steps: - name: Upgrade docker compose to use v2 run: sudo curl -L @@ -427,7 +427,7 @@ jobs: needs: - images-prepare - artifacts-prepare - runs-on: self-hosted + runs-on: ubicloud-standard-4 steps: - name: Upgrade docker compose to use v2 run: sudo curl -L @@ -472,7 +472,7 @@ jobs: needs: - images-prepare - artifacts-prepare - runs-on: self-hosted + runs-on: ubicloud-standard-4 steps: - name: Upgrade docker compose to use v2 run: sudo curl -L @@ -517,7 +517,7 @@ jobs: needs: - images-prepare - artifacts-prepare - runs-on: self-hosted + runs-on: ubicloud-standard-4 steps: - name: Upgrade docker compose to use v2 run: sudo curl -L @@ -562,7 +562,7 @@ jobs: needs: - images-prepare - artifacts-prepare - runs-on: self-hosted + runs-on: ubicloud-standard-4 steps: - name: Upgrade docker compose to use v2 run: sudo curl -L @@ -607,7 +607,7 @@ jobs: needs: - images-prepare - artifacts-prepare - runs-on: self-hosted + runs-on: ubicloud-standard-4 steps: - name: Upgrade docker compose to use v2 run: sudo curl -L @@ -652,7 +652,7 @@ jobs: needs: - images-prepare - artifacts-prepare - runs-on: self-hosted + runs-on: ubicloud-standard-4 steps: - name: Upgrade docker compose to use v2 run: sudo curl -L diff --git a/Cargo.lock b/Cargo.lock index 5f728366..57d1e275 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -640,7 +640,7 @@ dependencies = [ [[package]] name = "drop-core" -version = "1.0.0" +version = "1.0.2" dependencies = [ "cosmos-sdk-proto", "cosmwasm-schema", @@ -673,7 +673,7 @@ dependencies = [ [[package]] name = "drop-factory" -version = "1.0.0" +version = "1.0.2" dependencies = [ "cosmwasm-schema", "cosmwasm-std", diff --git a/contracts/core/Cargo.toml b/contracts/core/Cargo.toml index 305d7bce..019e8cfb 100644 --- a/contracts/core/Cargo.toml +++ b/contracts/core/Cargo.toml @@ -3,7 +3,7 @@ authors = ["Sergey Ratiashvili "] description = "Contract to support staking core" edition = "2021" name = "drop-core" -version = "1.0.0" +version = "1.0.2" exclude = [ # Those files are rust-optimizer artifacts. You might want to commit them for convenience but they should not be part of the source code publication. diff --git a/contracts/core/src/contract.rs b/contracts/core/src/contract.rs index 851c3b2a..acc5d66f 100644 --- a/contracts/core/src/contract.rs +++ b/contracts/core/src/contract.rs @@ -1,8 +1,8 @@ use cosmwasm_schema::cw_serde; use cosmwasm_std::{ - attr, ensure, ensure_eq, ensure_ne, to_json_binary, Addr, Attribute, BankMsg, BankQuery, - Binary, Coin, CosmosMsg, CustomQuery, Decimal, Decimal256, Deps, DepsMut, Env, MessageInfo, - Order, QueryRequest, Response, StdError, StdResult, Uint128, Uint256, Uint64, WasmMsg, + attr, ensure, ensure_eq, ensure_ne, to_json_binary, Addr, Attribute, BankQuery, Binary, + CosmosMsg, CustomQuery, Decimal, Deps, DepsMut, Env, MessageInfo, Order, QueryRequest, + Response, StdError, StdResult, Uint128, Uint64, WasmMsg, }; use cw_storage_plus::Bound; use drop_helpers::answer::response; @@ -16,11 +16,7 @@ use drop_staking_base::{ ExecuteMsg, FailedBatchResponse, InstantiateMsg, LastPuppeteerResponse, LastStakerResponse, MigrateMsg, QueryMsg, }, - token::{ - ConfigResponse as TokenConfigResponse, ExecuteMsg as TokenExecuteMsg, - QueryMsg as TokenQueryMsg, - }, - withdrawal_voucher::ExecuteMsg as VoucherExecuteMsg, + token::{ConfigResponse as TokenConfigResponse, QueryMsg as TokenQueryMsg}, }, state::{ core::{ @@ -31,11 +27,9 @@ use drop_staking_base::{ LSM_SHARES_TO_REDEEM, PENDING_LSM_SHARES, TOTAL_LSM_SHARES, UNBOND_BATCH_ID, }, validatorset::ValidatorInfo, - withdrawal_voucher::{Metadata, Trait}, }, }; use neutron_sdk::bindings::{msg::NeutronMsg, query::NeutronQuery}; -use neutron_sdk::interchain_queries::v047::types::DECIMAL_FRACTIONAL; use prost::Message; pub type MessageWithFeeResponse = (CosmosMsg, Option>); @@ -1008,77 +1002,14 @@ fn execute_tick_unbonding( } fn execute_bond( - deps: DepsMut, - info: MessageInfo, - receiver: Option, - r#ref: Option, + _deps: DepsMut, + _info: MessageInfo, + _receiver: Option, + _: Option, ) -> ContractResult> { - let config = CONFIG.load(deps.storage)?; - let Coin { mut amount, denom } = cw_utils::one_coin(&info)?; - if let Some(bond_limit) = config.bond_limit { - if BONDED_AMOUNT.load(deps.storage)? + amount > bond_limit { - return Err(ContractError::BondLimitExceeded {}); - } - } - let denom_type = check_denom::check_denom(&deps.as_ref(), &denom, &config)?; - let mut msgs = vec![]; - let mut attrs = vec![attr("action", "bond")]; - let exchange_rate = query_exchange_rate(deps.as_ref(), &config)?; - attrs.push(attr("exchange_rate", exchange_rate.to_string())); - if let check_denom::DenomType::LsmShare(remote_denom, validator) = denom_type { - let share_amount = amount; - let real_amount = calc_lsm_share_underlying_amount( - deps.as_ref(), - &config.puppeteer_contract, - &amount, - validator, - )?; - if real_amount < config.lsm_min_bond_amount { - return Err(ContractError::LSMBondAmountIsBelowMinimum { - min_stake_amount: config.lsm_min_bond_amount, - bond_amount: real_amount, - }); - } - TOTAL_LSM_SHARES.update(deps.storage, |total| { - StdResult::Ok(total + real_amount.u128()) - })?; - PENDING_LSM_SHARES.update(deps.storage, denom, |one| { - let mut new = one.unwrap_or((remote_denom, Uint128::zero(), Uint128::zero())); - new.1 += share_amount; - new.2 += real_amount; - StdResult::Ok(new) - })?; - amount = real_amount; - } else { - // if it's not LSM share, we send this amount to the staker - msgs.push(CosmosMsg::Bank(BankMsg::Send { - to_address: config.staker_contract.to_string(), - amount: vec![Coin::new(amount.u128(), denom)], - })); - } - BONDED_AMOUNT.update(deps.storage, |total| StdResult::Ok(total + amount))?; - let issue_amount = amount * (Decimal::one() / exchange_rate); - attrs.push(attr("issue_amount", issue_amount.to_string())); - - let receiver = receiver.map_or(Ok::(info.sender.to_string()), |a| { - deps.api.addr_validate(&a)?; - Ok(a) - })?; - attrs.push(attr("receiver", receiver.clone())); - if let Some(r#ref) = r#ref { - if !r#ref.is_empty() { - attrs.push(attr("ref", r#ref)); - } - } - msgs.push(CosmosMsg::Wasm(WasmMsg::Execute { - contract_addr: config.token_contract.into_string(), - msg: to_json_binary(&TokenExecuteMsg::Mint { - amount: issue_amount, - receiver, - })?, - funds: vec![], - })); - Ok(response("execute-bond", CONTRACT_NAME, attrs).add_messages(msgs)) + Err(ContractError::Std(StdError::generic_err( + "Bonding is temporarily disabled due to protocol upgrade", + ))) } fn execute_update_config( @@ -1206,64 +1137,12 @@ fn execute_update_config( } fn execute_unbond( - deps: DepsMut, - info: MessageInfo, + _deps: DepsMut, + _info: MessageInfo, ) -> ContractResult> { - let attrs = vec![attr("action", "unbond")]; - let unbond_batch_id = UNBOND_BATCH_ID.load(deps.storage)?; - let config = CONFIG.load(deps.storage)?; - let ld_denom = LD_DENOM.load(deps.storage)?; - let dasset_amount = cw_utils::must_pay(&info, &ld_denom)?; - BONDED_AMOUNT.update(deps.storage, |total| StdResult::Ok(total - dasset_amount))?; - let mut unbond_batch = unbond_batches_map().load(deps.storage, unbond_batch_id)?; - unbond_batch.total_unbond_items += 1; - unbond_batch.total_dasset_amount_to_withdraw += dasset_amount; - unbond_batches_map().save(deps.storage, unbond_batch_id, &unbond_batch)?; - - let extension = Some(Metadata { - description: Some("Withdrawal voucher".into()), - name: "LDV voucher".to_string(), - batch_id: unbond_batch_id.to_string(), - amount: dasset_amount, - attributes: Some(vec![ - Trait { - display_type: None, - trait_type: "unbond_batch_id".to_string(), - value: unbond_batch_id.to_string(), - }, - Trait { - display_type: None, - trait_type: "received_amount".to_string(), - value: dasset_amount.to_string(), - }, - ]), - }); - - let msgs = vec![ - CosmosMsg::Wasm(WasmMsg::Execute { - contract_addr: config.withdrawal_voucher_contract.into_string(), - msg: to_json_binary(&VoucherExecuteMsg::Mint { - owner: info.sender.to_string(), - token_id: unbond_batch_id.to_string() - + "_" - + info.sender.to_string().as_str() - + "_" - + &unbond_batch.total_unbond_items.to_string(), - token_uri: None, - extension, - })?, - funds: vec![], - }), - CosmosMsg::Wasm(WasmMsg::Execute { - contract_addr: config.token_contract.into_string(), - msg: to_json_binary(&TokenExecuteMsg::Burn {})?, - funds: vec![Coin { - denom: ld_denom, - amount: dasset_amount, - }], - }), - ]; - Ok(response("execute-unbond", CONTRACT_NAME, attrs).add_messages(msgs)) + Err(ContractError::Std(StdError::generic_err( + "Unbonding is temporarily disabled due to protocol upgrade", + ))) } fn check_latest_icq_responses( @@ -1582,38 +1461,6 @@ fn get_pending_lsm_share_msg( } } -fn calc_lsm_share_underlying_amount( - deps: Deps, - puppeteer_contract: &Addr, - lsm_share: &Uint128, - validator: String, -) -> ContractResult { - let delegations = deps - .querier - .query_wasm_smart::( - puppeteer_contract, - &drop_puppeteer_base::msg::QueryMsg::Extension { - msg: drop_staking_base::msg::puppeteer::QueryExtMsg::Delegations {}, - }, - )? - .delegations - .delegations; - if delegations.is_empty() { - return Err(ContractError::NoDelegations {}); - } - let validator_info = delegations - .iter() - .find(|one| one.validator == validator) - .ok_or(ContractError::ValidatorInfoNotFound { - validator: validator.clone(), - })?; - let share = Decimal256::from_atomics(*lsm_share, 0)?; - Ok(Uint128::try_from( - share.checked_mul(validator_info.share_ratio)?.atomics() - / Uint256::from(DECIMAL_FRACTIONAL), - )?) -} - pub mod check_denom { use super::*; diff --git a/contracts/core/src/tests.rs b/contracts/core/src/tests.rs index a29e76c5..12ced5a8 100644 --- a/contracts/core/src/tests.rs +++ b/contracts/core/src/tests.rs @@ -5,8 +5,8 @@ use crate::contract::{ use cosmwasm_std::{ from_json, testing::{mock_env, mock_info, MockApi, MockStorage}, - to_json_binary, Addr, BankMsg, Coin, CosmosMsg, Decimal, Decimal256, Event, OwnedDeps, - Response, SubMsg, Timestamp, Uint128, WasmMsg, + to_json_binary, Addr, Coin, CosmosMsg, Decimal, Decimal256, Event, OwnedDeps, Response, SubMsg, + Timestamp, Uint128, WasmMsg, }; use drop_helpers::testing::{mock_dependencies, WasmMockQuerier}; use drop_puppeteer_base::{ @@ -19,7 +19,6 @@ use drop_staking_base::{ msg::{ core::{ExecuteMsg, FailedBatchResponse, InstantiateMsg}, puppeteer::{BalancesResponse, DelegationsResponse}, - staker::QueryMsg as StakerQueryMsg, strategy::QueryMsg as StrategyQueryMsg, }, state::core::{ @@ -2774,121 +2773,6 @@ fn test_execute_tick_unbonding_no_puppeteer_response() { assert_eq!(res, Err(ContractError::PuppeteerResponseIsNotReceived {})); } -#[test] -fn test_bond_wo_receiver() { - let mut deps = mock_dependencies(&[]); - let mut env = mock_env(); - env.block.time = Timestamp::from_seconds(1000); - FSM.set_initial_state(deps.as_mut().storage, ContractState::Idle) - .unwrap(); - BONDED_AMOUNT - .save(deps.as_mut().storage, &Uint128::zero()) - .unwrap(); - CONFIG - .save( - deps.as_mut().storage, - &get_default_config(1000, 3, 100, 100, 600, Uint128::one()), - ) - .unwrap(); - LD_DENOM - .save(deps.as_mut().storage, &"ld_denom".into()) - .unwrap(); - let res = execute( - deps.as_mut(), - env, - mock_info("some", &[Coin::new(1000, "base_denom")]), - ExecuteMsg::Bond { - receiver: None, - r#ref: None, - }, - ) - .unwrap(); - let bonded_amount = BONDED_AMOUNT.load(deps.as_ref().storage).unwrap(); - assert_eq!(bonded_amount, Uint128::from(1000u128)); - assert_eq!( - res, - Response::new() - .add_event( - Event::new("crates.io:drop-staking__drop-core-execute-bond") - .add_attribute("action", "bond") - .add_attribute("exchange_rate", "1") - .add_attribute("issue_amount", "1000") - .add_attribute("receiver", "some") - ) - .add_submessage(SubMsg::new(CosmosMsg::Bank(BankMsg::Send { - to_address: "staker_contract".to_string(), - amount: vec![Coin::new(1000, "base_denom")] - }))) - .add_submessage(SubMsg::new(CosmosMsg::Wasm(WasmMsg::Execute { - contract_addr: "token_contract".to_string(), - msg: to_json_binary(&drop_staking_base::msg::token::ExecuteMsg::Mint { - amount: Uint128::from(1000u128), - receiver: "some".to_string() - }) - .unwrap(), - funds: vec![], - }))) - ); -} - -#[test] -fn test_bond_with_receiver() { - let mut deps = mock_dependencies(&[]); - let mut env = mock_env(); - env.block.time = Timestamp::from_seconds(1000); - FSM.set_initial_state(deps.as_mut().storage, ContractState::Idle) - .unwrap(); - BONDED_AMOUNT - .save(deps.as_mut().storage, &Uint128::zero()) - .unwrap(); - CONFIG - .save( - deps.as_mut().storage, - &get_default_config(1000, 3, 100, 100, 600, Uint128::one()), - ) - .unwrap(); - LD_DENOM - .save(deps.as_mut().storage, &"ld_denom".into()) - .unwrap(); - let res = execute( - deps.as_mut(), - env, - mock_info("some", &[Coin::new(1000, "base_denom")]), - ExecuteMsg::Bond { - receiver: Some("receiver".to_string()), - r#ref: Some("ref".to_string()), - }, - ) - .unwrap(); - let bonded_amount = BONDED_AMOUNT.load(deps.as_ref().storage).unwrap(); - assert_eq!(bonded_amount, Uint128::from(1000u128)); - assert_eq!( - res, - Response::new() - .add_event( - Event::new("crates.io:drop-staking__drop-core-execute-bond") - .add_attribute("action", "bond") - .add_attribute("exchange_rate", "1") - .add_attribute("issue_amount", "1000") - .add_attribute("receiver", "receiver") - .add_attribute("ref", "ref") - ) - .add_submessage(SubMsg::new(CosmosMsg::Bank(BankMsg::Send { - to_address: "staker_contract".to_string(), - amount: vec![Coin::new(1000, "base_denom")] - }))) - .add_submessage(SubMsg::new(CosmosMsg::Wasm(WasmMsg::Execute { - contract_addr: "token_contract".to_string(), - msg: to_json_binary(&drop_staking_base::msg::token::ExecuteMsg::Mint { - amount: Uint128::from(1000u128), - receiver: "receiver".to_string() - }) - .unwrap(), - funds: vec![], - }))) - ); -} - #[test] fn check_failed_batch_query_deserialization() { let mut deps = mock_dependencies(&[]); @@ -2925,705 +2809,6 @@ fn check_failed_batch_query_deserialization() { } } -#[test] -fn test_bond_lsm_share_wrong_channel() { - let mut deps = mock_dependencies(&[]); - deps.querier.add_stargate_query_response( - "/ibc.applications.transfer.v1.Query/DenomTrace", - |_data| { - to_json_binary(&QueryDenomTraceResponse { - denom_trace: DenomTrace { - path: "transfer/wrong_channel".to_string(), - base_denom: "valoper1/1".to_string(), - }, - }) - .unwrap() - }, - ); - let mut env = mock_env(); - env.block.time = Timestamp::from_seconds(1000); - FSM.set_initial_state(deps.as_mut().storage, ContractState::Idle) - .unwrap(); - BONDED_AMOUNT - .save(deps.as_mut().storage, &Uint128::zero()) - .unwrap(); - CONFIG - .save( - deps.as_mut().storage, - &get_default_config(1000, 3, 100, 100, 600, Uint128::new(100)), - ) - .unwrap(); - let res = execute( - deps.as_mut(), - env, - mock_info("some", &[Coin::new(1000, "lsm_share")]), - ExecuteMsg::Bond { - receiver: None, - r#ref: None, - }, - ); - assert!(res.is_err()); - assert_eq!(res, Err(ContractError::InvalidDenom {})); -} - -#[test] -fn test_bond_lsm_share_increase_exchange_rate() { - let mut deps = mock_dependencies(&[Coin { - denom: "ld_denom".to_string(), - amount: Uint128::new(1001), - }]); - deps.querier.add_stargate_query_response( - "/ibc.applications.transfer.v1.Query/DenomTrace", - |_data| { - to_json_binary(&QueryDenomTraceResponse { - denom_trace: DenomTrace { - path: "transfer/transfer_channel".to_string(), - base_denom: "valoper1/1".to_string(), - }, - }) - .unwrap() - }, - ); - deps.querier - .add_wasm_query_response("validators_set_contract", |_| { - to_json_binary(&drop_staking_base::msg::validatorset::ValidatorResponse { - validator: Some(drop_staking_base::state::validatorset::ValidatorInfo { - valoper_address: "valoper1".to_string(), - weight: 1u64, - last_processed_remote_height: None, - last_processed_local_height: None, - last_validated_height: None, - last_commission_in_range: None, - uptime: Decimal::one(), - tombstone: false, - jailed_number: None, - init_proposal: None, - total_passed_proposals: 0u64, - total_voted_proposals: 0u64, - }), - }) - .unwrap() - }); - deps.querier - .add_wasm_query_response("staker_contract", |data| { - let req: StakerQueryMsg = from_json(data).unwrap(); - match req { - StakerQueryMsg::AllBalance {} => to_json_binary(&Uint128::new(1)).unwrap(), - _ => unimplemented!(), - } - }); - deps.querier - .add_wasm_query_response("puppeteer_contract", |_| { - to_json_binary(&DelegationsResponse { - delegations: Delegations { - delegations: vec![DropDelegation { - delegator: Addr::unchecked("delegator"), - validator: "valoper1".to_string(), - amount: Coin::new(1000, "remote_denom".to_string()), - share_ratio: Decimal256::one(), - }], - }, - remote_height: 10u64, - local_height: 10u64, - timestamp: Timestamp::from_seconds(90001), - }) - .unwrap() - }); - deps.querier - .add_wasm_query_response("puppeteer_contract", |_| { - to_json_binary(&DelegationsResponse { - delegations: Delegations { - delegations: vec![DropDelegation { - delegator: Addr::unchecked("delegator"), - validator: "valoper1".to_string(), - amount: Coin::new(1000, "remote_denom".to_string()), - share_ratio: Decimal256::one(), - }], - }, - remote_height: 10u64, - local_height: 10u64, - timestamp: Timestamp::from_seconds(90001), - }) - .unwrap() - }); - let mut env = mock_env(); - env.block.time = Timestamp::from_seconds(1000); - TOTAL_LSM_SHARES - .save(deps.as_mut().storage, &0u128) - .unwrap(); - FSM.set_initial_state(deps.as_mut().storage, ContractState::Idle) - .unwrap(); - BONDED_AMOUNT - .save(deps.as_mut().storage, &Uint128::zero()) - .unwrap(); - CONFIG - .save( - deps.as_mut().storage, - &get_default_config(1000, 3, 100, 100, 600, Uint128::new(1)), - ) - .unwrap(); - LD_DENOM - .save(deps.as_mut().storage, &"ld_denom".into()) - .unwrap(); - UNBOND_BATCH_ID.save(&mut deps.storage, &0).unwrap(); - unbond_batches_map() - .save( - &mut deps.storage, - 0, - &UnbondBatch { - total_dasset_amount_to_withdraw: Uint128::zero(), - expected_native_asset_amount: Uint128::zero(), - total_unbond_items: 0, - status: UnbondBatchStatus::New, - expected_release_time: 0, - slashing_effect: None, - unbonded_amount: None, - withdrawn_amount: None, - status_timestamps: get_default_unbond_batch_status_timestamps(), - }, - ) - .unwrap(); - let res = execute( - deps.as_mut(), - env, - mock_info("some", &[Coin::new(100500, "lsm_share")]), - ExecuteMsg::Bond { - receiver: None, - r#ref: None, - }, - ) - .unwrap(); - let issue_amount = res.events[0] - .attributes - .iter() - .find(|attribute| attribute.key == "issue_amount") - .unwrap() - .value - .parse::() - .unwrap(); - assert_eq!(issue_amount, 100500); -} - -#[test] -fn test_bond_lsm_share_wrong_validator() { - let mut deps = mock_dependencies(&[]); - deps.querier.add_stargate_query_response( - "/ibc.applications.transfer.v1.Query/DenomTrace", - |_data| { - to_json_binary(&QueryDenomTraceResponse { - denom_trace: DenomTrace { - path: "transfer/transfer_channel".to_string(), - base_denom: "outside_valoper1/1".to_string(), - }, - }) - .unwrap() - }, - ); - let query_called = std::rc::Rc::new(std::cell::RefCell::new(false)); - let query_called_cb = std::rc::Rc::clone(&query_called); - deps.querier - .add_wasm_query_response("validators_set_contract", move |request| { - let request = - from_json::(request).unwrap(); - if let drop_staking_base::msg::validatorset::QueryMsg::Validator { valoper } = request { - assert_eq!(valoper, "outside_valoper1".to_string()); - query_called_cb.replace(true); - to_json_binary(&drop_staking_base::msg::validatorset::ValidatorResponse { - validator: None, - }) - .unwrap() - } else { - unimplemented!() - } - }); - let mut env = mock_env(); - env.block.time = Timestamp::from_seconds(1000); - FSM.set_initial_state(deps.as_mut().storage, ContractState::Idle) - .unwrap(); - BONDED_AMOUNT - .save(deps.as_mut().storage, &Uint128::zero()) - .unwrap(); - CONFIG - .save( - deps.as_mut().storage, - &get_default_config(1000, 3, 100, 100, 600, Uint128::new(100)), - ) - .unwrap(); - let res = execute( - deps.as_mut(), - env, - mock_info("some", &[Coin::new(1000, "lsm_share")]), - ExecuteMsg::Bond { - receiver: None, - r#ref: None, - }, - ); - assert!(res.is_err()); - assert_eq!(res, Err(ContractError::InvalidDenom {})); - assert!(*query_called.borrow()); -} - -#[test] -fn test_bond_lsm_share_ok() { - let mut deps = mock_dependencies(&[]); - deps.querier.add_stargate_query_response( - "/ibc.applications.transfer.v1.Query/DenomTrace", - |_data| { - to_json_binary(&QueryDenomTraceResponse { - denom_trace: DenomTrace { - path: "transfer/transfer_channel".to_string(), - base_denom: "valoper1/1".to_string(), - }, - }) - .unwrap() - }, - ); - deps.querier - .add_wasm_query_response("validators_set_contract", |_| { - to_json_binary(&drop_staking_base::msg::validatorset::ValidatorResponse { - validator: Some(drop_staking_base::state::validatorset::ValidatorInfo { - valoper_address: "valoper1".to_string(), - weight: 1u64, - last_processed_remote_height: None, - last_processed_local_height: None, - last_validated_height: None, - last_commission_in_range: None, - uptime: Decimal::one(), - tombstone: false, - jailed_number: None, - init_proposal: None, - total_passed_proposals: 0u64, - total_voted_proposals: 0u64, - }), - }) - .unwrap() - }); - deps.querier - .add_wasm_query_response("puppeteer_contract", |_| { - to_json_binary(&DelegationsResponse { - delegations: Delegations { - delegations: vec![DropDelegation { - delegator: Addr::unchecked("delegator"), - validator: "valoper1".to_string(), - amount: Coin::new(1000, "remote_denom".to_string()), - share_ratio: Decimal256::one(), - }], - }, - remote_height: 10u64, - local_height: 10u64, - timestamp: Timestamp::from_seconds(90001), - }) - .unwrap() - }); - let mut env = mock_env(); - env.block.time = Timestamp::from_seconds(1000); - TOTAL_LSM_SHARES - .save(deps.as_mut().storage, &0u128) - .unwrap(); - FSM.set_initial_state(deps.as_mut().storage, ContractState::Idle) - .unwrap(); - BONDED_AMOUNT - .save(deps.as_mut().storage, &Uint128::zero()) - .unwrap(); - CONFIG - .save( - deps.as_mut().storage, - &get_default_config(1000, 3, 100, 100, 600, Uint128::new(100)), - ) - .unwrap(); - LD_DENOM - .save(deps.as_mut().storage, &"ld_denom".into()) - .unwrap(); - let res = execute( - deps.as_mut(), - env, - mock_info("some", &[Coin::new(1000, "lsm_share")]), - ExecuteMsg::Bond { - receiver: None, - r#ref: None, - }, - ) - .unwrap(); - let bonded_amount = BONDED_AMOUNT.load(deps.as_ref().storage).unwrap(); - let total_lsm_shares = TOTAL_LSM_SHARES.load(deps.as_ref().storage).unwrap(); - assert_eq!(bonded_amount, Uint128::from(1000u128)); - assert_eq!(total_lsm_shares, 1000u128); - assert_eq!( - res, - Response::new() - .add_event( - Event::new("crates.io:drop-staking__drop-core-execute-bond") - .add_attribute("action", "bond") - .add_attribute("exchange_rate", "1") - .add_attribute("issue_amount", "1000") - .add_attribute("receiver", "some") - ) - .add_submessage(SubMsg::new(CosmosMsg::Wasm(WasmMsg::Execute { - contract_addr: "token_contract".to_string(), - msg: to_json_binary(&drop_staking_base::msg::token::ExecuteMsg::Mint { - amount: Uint128::from(1000u128), - receiver: "some".to_string() - }) - .unwrap(), - funds: vec![], - }))) - ); -} - -#[test] -fn test_bond_lsm_share_ok_with_low_ratio() { - let mut deps = mock_dependencies(&[]); - deps.querier.add_stargate_query_response( - "/ibc.applications.transfer.v1.Query/DenomTrace", - |_data| { - to_json_binary(&QueryDenomTraceResponse { - denom_trace: DenomTrace { - path: "transfer/transfer_channel".to_string(), - base_denom: "valoper1/1".to_string(), - }, - }) - .unwrap() - }, - ); - deps.querier - .add_wasm_query_response("validators_set_contract", |_| { - to_json_binary(&drop_staking_base::msg::validatorset::ValidatorResponse { - validator: Some(drop_staking_base::state::validatorset::ValidatorInfo { - valoper_address: "valoper1".to_string(), - weight: 1u64, - last_processed_remote_height: None, - last_processed_local_height: None, - last_validated_height: None, - last_commission_in_range: None, - uptime: Decimal::one(), - tombstone: false, - jailed_number: None, - init_proposal: None, - total_passed_proposals: 0u64, - total_voted_proposals: 0u64, - }), - }) - .unwrap() - }); - deps.querier - .add_wasm_query_response("puppeteer_contract", |_| { - to_json_binary(&DelegationsResponse { - delegations: Delegations { - delegations: vec![DropDelegation { - delegator: Addr::unchecked("delegator"), - validator: "valoper1".to_string(), - amount: Coin::new(1000, "remote_denom".to_string()), - share_ratio: Decimal256::from_ratio(1u32, 2u32), - }], - }, - remote_height: 10u64, - local_height: 10u64, - timestamp: Timestamp::from_seconds(90001), - }) - .unwrap() - }); - let mut env = mock_env(); - env.block.time = Timestamp::from_seconds(1000); - TOTAL_LSM_SHARES - .save(deps.as_mut().storage, &0u128) - .unwrap(); - FSM.set_initial_state(deps.as_mut().storage, ContractState::Idle) - .unwrap(); - BONDED_AMOUNT - .save(deps.as_mut().storage, &Uint128::zero()) - .unwrap(); - CONFIG - .save( - deps.as_mut().storage, - &get_default_config(1000, 3, 100, 100, 600, Uint128::new(100)), - ) - .unwrap(); - LD_DENOM - .save(deps.as_mut().storage, &"ld_denom".into()) - .unwrap(); - let res = execute( - deps.as_mut(), - env, - mock_info("some", &[Coin::new(1000, "lsm_share")]), - ExecuteMsg::Bond { - receiver: None, - r#ref: None, - }, - ) - .unwrap(); - let bonded_amount = BONDED_AMOUNT.load(deps.as_ref().storage).unwrap(); - let total_lsm_shares = TOTAL_LSM_SHARES.load(deps.as_ref().storage).unwrap(); - let pending_lsm_shares = PENDING_LSM_SHARES - .load(deps.as_ref().storage, "lsm_share".to_string()) - .unwrap(); - assert_eq!( - pending_lsm_shares, - ( - "valoper1/1".to_string(), - Uint128::from(1000u128), - Uint128::from(500u128) - ) - ); - assert_eq!(bonded_amount, Uint128::from(500u128)); - assert_eq!(total_lsm_shares, 500u128); - assert_eq!( - res, - Response::new() - .add_event( - Event::new("crates.io:drop-staking__drop-core-execute-bond") - .add_attribute("action", "bond") - .add_attribute("exchange_rate", "1") - .add_attribute("issue_amount", "500") - .add_attribute("receiver", "some") - ) - .add_submessage(SubMsg::new(CosmosMsg::Wasm(WasmMsg::Execute { - contract_addr: "token_contract".to_string(), - msg: to_json_binary(&drop_staking_base::msg::token::ExecuteMsg::Mint { - amount: Uint128::from(500u128), - receiver: "some".to_string() - }) - .unwrap(), - funds: vec![], - }))) - ); -} - -#[test] -fn test_bond_lsm_share_ok_with_low_ratio_pending_already_there() { - let mut deps = mock_dependencies(&[]); - deps.querier.add_stargate_query_response( - "/ibc.applications.transfer.v1.Query/DenomTrace", - |_data| { - to_json_binary(&QueryDenomTraceResponse { - denom_trace: DenomTrace { - path: "transfer/transfer_channel".to_string(), - base_denom: "valoper1/1".to_string(), - }, - }) - .unwrap() - }, - ); - deps.querier - .add_wasm_query_response("validators_set_contract", |_| { - to_json_binary(&drop_staking_base::msg::validatorset::ValidatorResponse { - validator: Some(drop_staking_base::state::validatorset::ValidatorInfo { - valoper_address: "valoper1".to_string(), - weight: 1u64, - last_processed_remote_height: None, - last_processed_local_height: None, - last_validated_height: None, - last_commission_in_range: None, - uptime: Decimal::one(), - tombstone: false, - jailed_number: None, - init_proposal: None, - total_passed_proposals: 0u64, - total_voted_proposals: 0u64, - }), - }) - .unwrap() - }); - deps.querier - .add_wasm_query_response("puppeteer_contract", |_| { - to_json_binary(&DelegationsResponse { - delegations: Delegations { - delegations: vec![DropDelegation { - delegator: Addr::unchecked("delegator"), - validator: "valoper1".to_string(), - amount: Coin::new(1000, "remote_denom".to_string()), - share_ratio: Decimal256::from_ratio(1u32, 2u32), - }], - }, - remote_height: 10u64, - local_height: 10u64, - timestamp: Timestamp::from_seconds(90001), - }) - .unwrap() - }); - let mut env = mock_env(); - env.block.time = Timestamp::from_seconds(1000); - TOTAL_LSM_SHARES - .save(deps.as_mut().storage, &0u128) - .unwrap(); - PENDING_LSM_SHARES - .save( - deps.as_mut().storage, - "lsm_share".to_string(), - &( - "valoper1/1".to_string(), - Uint128::from(10000u128), - Uint128::from(5000u128), - ), - ) - .unwrap(); - FSM.set_initial_state(deps.as_mut().storage, ContractState::Idle) - .unwrap(); - BONDED_AMOUNT - .save(deps.as_mut().storage, &Uint128::zero()) - .unwrap(); - CONFIG - .save( - deps.as_mut().storage, - &get_default_config(1000, 3, 100, 100, 600, Uint128::new(100)), - ) - .unwrap(); - LD_DENOM - .save(deps.as_mut().storage, &"ld_denom".into()) - .unwrap(); - let res = execute( - deps.as_mut(), - env, - mock_info("some", &[Coin::new(1000, "lsm_share")]), - ExecuteMsg::Bond { - receiver: None, - r#ref: None, - }, - ) - .unwrap(); - let bonded_amount = BONDED_AMOUNT.load(deps.as_ref().storage).unwrap(); - let total_lsm_shares = TOTAL_LSM_SHARES.load(deps.as_ref().storage).unwrap(); - let pending_lsm_shares = PENDING_LSM_SHARES - .load(deps.as_ref().storage, "lsm_share".to_string()) - .unwrap(); - assert_eq!( - pending_lsm_shares, - ( - "valoper1/1".to_string(), - Uint128::from(11000u128), - Uint128::from(5500u128) - ) - ); - assert_eq!(bonded_amount, Uint128::from(500u128)); - assert_eq!(total_lsm_shares, 500u128); - assert_eq!( - res, - Response::new() - .add_event( - Event::new("crates.io:drop-staking__drop-core-execute-bond") - .add_attribute("action", "bond") - .add_attribute("exchange_rate", "1") - .add_attribute("issue_amount", "500") - .add_attribute("receiver", "some") - ) - .add_submessage(SubMsg::new(CosmosMsg::Wasm(WasmMsg::Execute { - contract_addr: "token_contract".to_string(), - msg: to_json_binary(&drop_staking_base::msg::token::ExecuteMsg::Mint { - amount: Uint128::from(500u128), - receiver: "some".to_string() - }) - .unwrap(), - funds: vec![], - }))) - ); -} - -#[test] -fn test_unbond() { - let mut deps = mock_dependencies(&[]); - let mut env = mock_env(); - env.block.time = Timestamp::from_seconds(1000); - FSM.set_initial_state(deps.as_mut().storage, ContractState::Idle) - .unwrap(); - BONDED_AMOUNT - .save(deps.as_mut().storage, &Uint128::from(1000u128)) - .unwrap(); - UNBOND_BATCH_ID.save(deps.as_mut().storage, &0u128).unwrap(); - unbond_batches_map() - .save( - deps.as_mut().storage, - 0, - &UnbondBatch { - total_dasset_amount_to_withdraw: Uint128::from(0u128), - expected_native_asset_amount: Uint128::from(0u128), - total_unbond_items: 0, - status: UnbondBatchStatus::New, - expected_release_time: 0, - slashing_effect: None, - unbonded_amount: None, - withdrawn_amount: None, - status_timestamps: get_default_unbond_batch_status_timestamps(), - }, - ) - .unwrap(); - CONFIG - .save( - deps.as_mut().storage, - &get_default_config(1000, 3, 100, 100, 600, Uint128::one()), - ) - .unwrap(); - LD_DENOM - .save(deps.as_mut().storage, &"ld_denom".into()) - .unwrap(); - let res = execute( - deps.as_mut(), - env, - mock_info("some_sender", &[Coin::new(1000, "ld_denom")]), - ExecuteMsg::Unbond {}, - ) - .unwrap(); - let unbond_batch = unbond_batches_map().load(deps.as_ref().storage, 0).unwrap(); - let extension = Some(drop_staking_base::state::withdrawal_voucher::Metadata { - description: Some("Withdrawal voucher".into()), - name: "LDV voucher".to_string(), - batch_id: "0".to_string(), - amount: Uint128::from(1000u128), - attributes: Some(vec![ - drop_staking_base::state::withdrawal_voucher::Trait { - display_type: None, - trait_type: "unbond_batch_id".to_string(), - value: "0".to_string(), - }, - drop_staking_base::state::withdrawal_voucher::Trait { - display_type: None, - trait_type: "received_amount".to_string(), - value: "1000".to_string(), - }, - ]), - }); - assert_eq!( - res, - Response::new() - .add_submessage(SubMsg::new(CosmosMsg::Wasm(WasmMsg::Execute { - contract_addr: "withdrawal_voucher_contract".to_string(), - msg: to_json_binary( - &drop_staking_base::msg::withdrawal_voucher::ExecuteMsg::Mint { - token_id: "0_some_sender_1".to_string(), - owner: "some_sender".to_string(), - token_uri: None, - extension, - } - ) - .unwrap(), - funds: vec![], - }))) - .add_submessage(SubMsg::new(CosmosMsg::Wasm(WasmMsg::Execute { - contract_addr: "token_contract".to_string(), - msg: to_json_binary(&drop_staking_base::msg::token::ExecuteMsg::Burn {}).unwrap(), - funds: vec![Coin::new(1000u128, "ld_denom")], - }))) - .add_event( - Event::new("crates.io:drop-staking__drop-core-execute-unbond") - .add_attribute("action", "unbond") - ) - ); - assert_eq!( - unbond_batch, - UnbondBatch { - total_dasset_amount_to_withdraw: Uint128::from(1000u128), - expected_native_asset_amount: Uint128::zero(), - total_unbond_items: 1, - status: UnbondBatchStatus::New, - expected_release_time: 0, - slashing_effect: None, - unbonded_amount: None, - withdrawn_amount: None, - status_timestamps: get_default_unbond_batch_status_timestamps(), - } - ); - let bonded_amount = BONDED_AMOUNT.load(deps.as_ref().storage).unwrap(); - assert_eq!(bonded_amount, Uint128::zero()); -} - fn null_request_packet() -> RequestPacket { RequestPacket { sequence: None, diff --git a/contracts/factory/Cargo.toml b/contracts/factory/Cargo.toml index 4defde89..3606112a 100644 --- a/contracts/factory/Cargo.toml +++ b/contracts/factory/Cargo.toml @@ -3,7 +3,7 @@ authors = ["Sergey Ratiashvili "] description = "Contract to deploy all Drop contracts" edition = "2021" name = "drop-factory" -version = "1.0.0" +version = "1.0.2" exclude = [ # Those files are rust-optimizer artifacts. You might want to commit them for convenience but they should not be part of the source code publication. diff --git a/contracts/factory/src/contract.rs b/contracts/factory/src/contract.rs index 3ef82a36..83380c73 100644 --- a/contracts/factory/src/contract.rs +++ b/contracts/factory/src/contract.rs @@ -613,7 +613,7 @@ fn get_contract_label(base: &str) -> String { pub fn migrate( deps: DepsMut, _env: Env, - _msg: MigrateMsg, + msg: MigrateMsg, ) -> ContractResult> { let version: semver::Version = CONTRACT_VERSION.parse()?; let storage_version: semver::Version = @@ -621,6 +621,75 @@ pub fn migrate( if storage_version < version { cw2::set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?; + + let mut messages = vec![]; + + let state = STATE.load(deps.storage)?; + + messages.push(CosmosMsg::Wasm(WasmMsg::Migrate { + contract_addr: state.core_contract.clone(), + new_code_id: msg.core_code_id, + msg: to_json_binary(&drop_staking_base::msg::core::MigrateMsg {})?, + })); + + messages.push(get_proxied_message( + state.core_contract, + drop_staking_base::msg::core::ExecuteMsg::UpdateConfig { + new_config: Box::new(drop_staking_base::state::core::ConfigOptional { + token_contract: None, + puppeteer_contract: None, + strategy_contract: None, + staker_contract: None, + withdrawal_voucher_contract: None, + withdrawal_manager_contract: None, + validators_set_contract: None, + base_denom: None, + remote_denom: None, + idle_min_interval: None, + unbonding_period: None, + unbonding_safe_period: None, + unbond_batch_switch_time: None, + transfer_channel_id: None, + lsm_redeem_threshold: Some(1), + lsm_min_bond_amount: None, + lsm_redeem_maximum_interval: None, + pump_ica_address: None, + rewards_receiver: None, + bond_limit: None, + emergency_address: None, + min_stake_amount: None, + }), + }, + vec![], + )?); + + messages.push(get_proxied_message( + state.staker_contract, + drop_staking_base::msg::staker::ExecuteMsg::UpdateConfig { + new_config: Box::new(drop_staking_base::state::staker::ConfigOptional { + timeout: None, + allowed_senders: None, + puppeteer_ica: None, + min_ibc_transfer: Some(Uint128::one()), + min_staking_amount: Some(Uint128::one()), + }), + }, + vec![], + )?); + + messages.push(get_proxied_message( + state.splitter_contract, + drop_staking_base::msg::splitter::ExecuteMsg::UpdateConfig { + new_config: drop_staking_base::state::splitter::Config { + denom: "ibc/C4CFF46FD6DE35CA4CF4CE031E643C8FDC9BA4B99AE598E9B0ED98FE3A2319F9" + .to_string(), + receivers: vec![], + }, + }, + vec![], + )?); + + return Ok(Response::new().add_messages(messages)); } Ok(Response::new()) diff --git a/contracts/factory/src/msg.rs b/contracts/factory/src/msg.rs index 3f5b2e47..b91da560 100644 --- a/contracts/factory/src/msg.rs +++ b/contracts/factory/src/msg.rs @@ -81,7 +81,9 @@ pub enum ExecuteMsg { AdminExecute { msgs: Vec> }, } #[cw_serde] -pub struct MigrateMsg {} +pub struct MigrateMsg { + pub core_code_id: u64, +} #[cw_serde] #[derive(QueryResponses)] diff --git a/integration_tests/dockerfiles/hermes/Dockerfile b/integration_tests/dockerfiles/hermes/Dockerfile index 7cd9d2ad..15d371a8 100644 --- a/integration_tests/dockerfiles/hermes/Dockerfile +++ b/integration_tests/dockerfiles/hermes/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:23.04 +FROM ubuntu:24.10 ARG HERMES_VERSION=v1.8.2 WORKDIR /app RUN apt-get update && apt-get install -y wget && \ diff --git a/integration_tests/dockerfiles/hermes/build.sh b/integration_tests/dockerfiles/hermes/build.sh index 4e8971f7..1cbd033a 100755 --- a/integration_tests/dockerfiles/hermes/build.sh +++ b/integration_tests/dockerfiles/hermes/build.sh @@ -8,5 +8,4 @@ if [[ "$CI" == "true" ]]; then else VERSION=":$VERSION" fi -docker build . -t ${ORG}hermes-test${VERSION} - +docker build . -t ${ORG}hermes-test${VERSION} \ No newline at end of file diff --git a/integration_tests/dockerfiles/neutronv2/build.sh b/integration_tests/dockerfiles/neutronv2/build.sh new file mode 100755 index 00000000..55992902 --- /dev/null +++ b/integration_tests/dockerfiles/neutronv2/build.sh @@ -0,0 +1,18 @@ +#!/bin/bash +DIR="$(dirname $0)" +COMMIT_HASH_OR_BRANCH="v6.0.0" +cd $DIR +VERSION=$(cat ../../package.json | jq -r '.version') +if [[ "$CI" == "true" ]]; then + VERSION="_$VERSION" + ORG=neutronorg/lionco-contracts: +else + VERSION=":$VERSION" +fi +git clone https://github.com/neutron-org/neutron +cd neutron +git checkout $COMMIT_HASH_OR_BRANCH +go mod tidy +docker buildx build --load --build-context app=. -t ${ORG}neutronv2-test${VERSION} --build-arg BINARY=neutrond . +cd .. +rm -rf ./neutron diff --git a/integration_tests/dockerfiles/neutronv2/options.json b/integration_tests/dockerfiles/neutronv2/options.json new file mode 100644 index 00000000..735979f8 --- /dev/null +++ b/integration_tests/dockerfiles/neutronv2/options.json @@ -0,0 +1,7 @@ +{ + "commands": { + "addGenesisAccount": "add-genesis-account", + "gentx": "gentx", + "collectGenTx": "collect-gentxs" + } +} \ No newline at end of file diff --git a/integration_tests/old_contracts/v1.0.1/drop_astroport_exchange_handler.wasm b/integration_tests/old_contracts/v1.0.1/drop_astroport_exchange_handler.wasm new file mode 100644 index 00000000..fea28f2b Binary files /dev/null and b/integration_tests/old_contracts/v1.0.1/drop_astroport_exchange_handler.wasm differ diff --git a/integration_tests/old_contracts/v1.0.1/drop_auto_withdrawer.wasm b/integration_tests/old_contracts/v1.0.1/drop_auto_withdrawer.wasm new file mode 100644 index 00000000..b5f47b51 Binary files /dev/null and b/integration_tests/old_contracts/v1.0.1/drop_auto_withdrawer.wasm differ diff --git a/integration_tests/old_contracts/v1.0.1/drop_core.wasm b/integration_tests/old_contracts/v1.0.1/drop_core.wasm new file mode 100644 index 00000000..642cdc52 Binary files /dev/null and b/integration_tests/old_contracts/v1.0.1/drop_core.wasm differ diff --git a/integration_tests/old_contracts/v1.0.1/drop_distribution.wasm b/integration_tests/old_contracts/v1.0.1/drop_distribution.wasm new file mode 100644 index 00000000..96626931 Binary files /dev/null and b/integration_tests/old_contracts/v1.0.1/drop_distribution.wasm differ diff --git a/integration_tests/old_contracts/v1.0.1/drop_factory.wasm b/integration_tests/old_contracts/v1.0.1/drop_factory.wasm new file mode 100644 index 00000000..ea0842c9 Binary files /dev/null and b/integration_tests/old_contracts/v1.0.1/drop_factory.wasm differ diff --git a/integration_tests/old_contracts/v1.0.1/drop_price_provider.wasm b/integration_tests/old_contracts/v1.0.1/drop_price_provider.wasm new file mode 100644 index 00000000..7306836b Binary files /dev/null and b/integration_tests/old_contracts/v1.0.1/drop_price_provider.wasm differ diff --git a/integration_tests/old_contracts/v1.0.1/drop_pump.wasm b/integration_tests/old_contracts/v1.0.1/drop_pump.wasm new file mode 100644 index 00000000..7865b353 Binary files /dev/null and b/integration_tests/old_contracts/v1.0.1/drop_pump.wasm differ diff --git a/integration_tests/old_contracts/v1.0.1/drop_puppeteer.wasm b/integration_tests/old_contracts/v1.0.1/drop_puppeteer.wasm new file mode 100644 index 00000000..3bfe5655 Binary files /dev/null and b/integration_tests/old_contracts/v1.0.1/drop_puppeteer.wasm differ diff --git a/integration_tests/old_contracts/v1.0.1/drop_rewards_manager.wasm b/integration_tests/old_contracts/v1.0.1/drop_rewards_manager.wasm new file mode 100644 index 00000000..1d5f3118 Binary files /dev/null and b/integration_tests/old_contracts/v1.0.1/drop_rewards_manager.wasm differ diff --git a/integration_tests/old_contracts/v1.0.1/drop_splitter.wasm b/integration_tests/old_contracts/v1.0.1/drop_splitter.wasm new file mode 100644 index 00000000..8ca0514c Binary files /dev/null and b/integration_tests/old_contracts/v1.0.1/drop_splitter.wasm differ diff --git a/integration_tests/old_contracts/v1.0.1/drop_staker.wasm b/integration_tests/old_contracts/v1.0.1/drop_staker.wasm new file mode 100644 index 00000000..309cc513 Binary files /dev/null and b/integration_tests/old_contracts/v1.0.1/drop_staker.wasm differ diff --git a/integration_tests/old_contracts/v1.0.1/drop_strategy.wasm b/integration_tests/old_contracts/v1.0.1/drop_strategy.wasm new file mode 100644 index 00000000..d3243d71 Binary files /dev/null and b/integration_tests/old_contracts/v1.0.1/drop_strategy.wasm differ diff --git a/integration_tests/old_contracts/v1.0.1/drop_token.wasm b/integration_tests/old_contracts/v1.0.1/drop_token.wasm new file mode 100644 index 00000000..37d9607c Binary files /dev/null and b/integration_tests/old_contracts/v1.0.1/drop_token.wasm differ diff --git a/integration_tests/old_contracts/v1.0.1/drop_validators_set.wasm b/integration_tests/old_contracts/v1.0.1/drop_validators_set.wasm new file mode 100644 index 00000000..255054ed Binary files /dev/null and b/integration_tests/old_contracts/v1.0.1/drop_validators_set.wasm differ diff --git a/integration_tests/old_contracts/v1.0.1/drop_validators_stats.wasm b/integration_tests/old_contracts/v1.0.1/drop_validators_stats.wasm new file mode 100644 index 00000000..c1cca8a6 Binary files /dev/null and b/integration_tests/old_contracts/v1.0.1/drop_validators_stats.wasm differ diff --git a/integration_tests/old_contracts/v1.0.1/drop_withdrawal_manager.wasm b/integration_tests/old_contracts/v1.0.1/drop_withdrawal_manager.wasm new file mode 100644 index 00000000..99f2d04a Binary files /dev/null and b/integration_tests/old_contracts/v1.0.1/drop_withdrawal_manager.wasm differ diff --git a/integration_tests/old_contracts/v1.0.1/drop_withdrawal_voucher.wasm b/integration_tests/old_contracts/v1.0.1/drop_withdrawal_voucher.wasm new file mode 100644 index 00000000..d38ca0b8 Binary files /dev/null and b/integration_tests/old_contracts/v1.0.1/drop_withdrawal_voucher.wasm differ diff --git a/integration_tests/package.json b/integration_tests/package.json index d53dfe9c..471958e3 100644 --- a/integration_tests/package.json +++ b/integration_tests/package.json @@ -17,6 +17,7 @@ "test:auto-withdrawer": "vitest --run auto-withdrawer.test.ts --bail 1", "test:gv": "vitest --run gv.test.ts --bail 1", "test:splitter": "vitest --run splitter.test.ts --bail 1", + "test:migration:v1.0.1-pre": "vitest --run migration-v1.0.1-pre.test.ts --bail 1", "debug": "vitest --inspect-brk --bail 1 --threads false --run core.test.ts", "watch": "vitest", "build-ts-client": "ts-node ./src/rebuild-client.ts", @@ -24,6 +25,7 @@ "build-gaia-image": "./dockerfiles/gaia/build.sh", "build-hermes-image": "./dockerfiles/hermes/build.sh", "build-neutron-image": "./dockerfiles/neutron/build.sh", + "build-neutron-v2-image": "./dockerfiles/neutronv2/build.sh", "build-neutron-query-relayer-image": "./dockerfiles/neutron-query-relayer/build.sh", "build-images": "./dockerfiles/build-all.sh && docker images", "lint": "eslint ./src -f compact", @@ -36,7 +38,7 @@ "@cosmjs/stargate": "^0.32.4", "@cosmjs/tendermint-rpc": "^0.32.4", "@neutron-org/client-ts": "^1.4.0", - "@neutron-org/cosmopark": "^1.7.3", + "@neutron-org/cosmopark": "1.7.14", "bech32": "^1.1.4", "decimal.js": "^10.4.3", "dotparser": "^1.1.1", @@ -57,4 +59,4 @@ }, "description": "Drop on Cosmos integration test", "repository": "git@github.com:hadronlabs-org/lionco-contracts.git" -} \ No newline at end of file +} diff --git a/integration_tests/src/testSuite.ts b/integration_tests/src/testSuite.ts index 92196367..1d0b9746 100644 --- a/integration_tests/src/testSuite.ts +++ b/integration_tests/src/testSuite.ts @@ -126,6 +126,41 @@ const networkConfigs = { `/opt/init-gaia.sh > /opt/init-gaia.log 2>&1`, ], }, + neutronv2: { + binary: 'neutrond', + chain_id: 'ntrntest', + denom: 'untrn', + image: `${ORG}neutronv2-test${VERSION}`, + prefix: 'neutron', + loglevel: 'debug', + trace: true, + public: true, + validators: 2, + validators_balance: ['1900000000', '100000000', '100000000'], + upload: [ + './artifacts/contracts', + './artifacts/contracts_thirdparty', + './artifacts/scripts/init-neutrond.sh', + ], + post_init: ['CHAINID=ntrntest CHAIN_DIR=/opt /opt/init-neutrond.sh'], + genesis_opts: { + 'app_state.crisis.constant_fee.denom': 'untrn', + }, + config_opts: { + 'consensus.timeout_commit': '500ms', + 'consensus.timeout_propose': '500ms', + }, + app_opts: { + 'api.enable': 'true', + 'api.address': 'tcp://0.0.0.0:1317', + 'api.swagger': 'true', + 'grpc.enable': 'true', + 'grpc.address': '0.0.0.0:9090', + 'minimum-gas-prices': '0.0025untrn', + 'rosetta.enable': 'true', + 'telemetry.prometheus-retention-time': 1000, + }, + }, neutron: { binary: 'neutrond', chain_id: 'ntrntest', @@ -241,6 +276,7 @@ const awaitNeutronChannels = (rest: string, rpc: string): Promise => const res = await client.IbcCoreChannelV1.query.queryChannels(undefined, { timeout: 1000, }); + console.log(res); if ( res.data.channels.length > 0 && res.data.channels[0].counterparty.channel_id !== '' @@ -388,8 +424,8 @@ export const setupPark = async ( ); if (relayers.hermes) { await awaitNeutronChannels( - `127.0.0.1:${instance.ports['neutron'].rest}`, - `127.0.0.1:${instance.ports['neutron'].rpc}`, + `127.0.0.1:${instance.ports['neutronv2'].rest}`, + `127.0.0.1:${instance.ports['neutronv2'].rpc}`, ).catch((e) => { console.log(`Failed to await neutron channels: ${e}`); throw e; diff --git a/integration_tests/src/testcases/auto-withdrawer.test.ts b/integration_tests/src/testcases/auto-withdrawer.test.ts index d100ee46..974fd981 100644 --- a/integration_tests/src/testcases/auto-withdrawer.test.ts +++ b/integration_tests/src/testcases/auto-withdrawer.test.ts @@ -266,7 +266,9 @@ describe('Auto withdrawer', () => { { const res = await client.upload( account.address, - fs.readFileSync(join(__dirname, '../../../artifacts/drop_core.wasm')), + fs.readFileSync( + join(__dirname, '../../old_contracts/v1.0.1/drop_core.wasm'), + ), 1.5, ); expect(res.codeId).toBeGreaterThan(0); @@ -275,7 +277,9 @@ describe('Auto withdrawer', () => { { const res = await client.upload( account.address, - fs.readFileSync(join(__dirname, '../../../artifacts/drop_token.wasm')), + fs.readFileSync( + join(__dirname, '../../old_contracts/v1.0.1/drop_token.wasm'), + ), 1.5, ); expect(res.codeId).toBeGreaterThan(0); @@ -285,7 +289,10 @@ describe('Auto withdrawer', () => { const res = await client.upload( account.address, fs.readFileSync( - join(__dirname, '../../../artifacts/drop_withdrawal_voucher.wasm'), + join( + __dirname, + '../../old_contracts/v1.0.1/drop_withdrawal_voucher.wasm', + ), ), 1.5, ); @@ -296,7 +303,10 @@ describe('Auto withdrawer', () => { const res = await client.upload( account.address, fs.readFileSync( - join(__dirname, '../../../artifacts/drop_withdrawal_manager.wasm'), + join( + __dirname, + '../../old_contracts/v1.0.1/drop_withdrawal_manager.wasm', + ), ), 1.5, ); @@ -307,7 +317,7 @@ describe('Auto withdrawer', () => { const res = await client.upload( account.address, fs.readFileSync( - join(__dirname, '../../../artifacts/drop_strategy.wasm'), + join(__dirname, '../../old_contracts/v1.0.1/drop_strategy.wasm'), ), 1.5, ); @@ -318,7 +328,7 @@ describe('Auto withdrawer', () => { const res = await client.upload( account.address, fs.readFileSync( - join(__dirname, '../../../artifacts/drop_distribution.wasm'), + join(__dirname, '../../old_contracts/v1.0.1/drop_distribution.wasm'), ), 1.5, ); @@ -329,7 +339,10 @@ describe('Auto withdrawer', () => { const res = await client.upload( account.address, fs.readFileSync( - join(__dirname, '../../../artifacts/drop_validators_set.wasm'), + join( + __dirname, + '../../old_contracts/v1.0.1/drop_validators_set.wasm', + ), ), 1.5, ); @@ -340,7 +353,7 @@ describe('Auto withdrawer', () => { const res = await client.upload( account.address, fs.readFileSync( - join(__dirname, '../../../artifacts/drop_puppeteer.wasm'), + join(__dirname, '../../old_contracts/v1.0.1/drop_puppeteer.wasm'), ), 1.5, ); @@ -351,7 +364,10 @@ describe('Auto withdrawer', () => { const res = await client.upload( account.address, fs.readFileSync( - join(__dirname, '../../../artifacts/drop_rewards_manager.wasm'), + join( + __dirname, + '../../old_contracts/v1.0.1/drop_rewards_manager.wasm', + ), ), 1.5, ); @@ -361,7 +377,9 @@ describe('Auto withdrawer', () => { { const res = await client.upload( account.address, - fs.readFileSync(join(__dirname, '../../../artifacts/drop_staker.wasm')), + fs.readFileSync( + join(__dirname, '../../old_contracts/v1.0.1/drop_staker.wasm'), + ), 1.5, ); expect(res.codeId).toBeGreaterThan(0); @@ -371,7 +389,7 @@ describe('Auto withdrawer', () => { const res = await client.upload( account.address, fs.readFileSync( - join(__dirname, '../../../artifacts/drop_splitter.wasm'), + join(__dirname, '../../old_contracts/v1.0.1/drop_splitter.wasm'), ), 1.5, ); @@ -381,7 +399,9 @@ describe('Auto withdrawer', () => { { const res = await client.upload( account.address, - fs.readFileSync(join(__dirname, '../../../artifacts/drop_pump.wasm')), + fs.readFileSync( + join(__dirname, '../../old_contracts/v1.0.1/drop_pump.wasm'), + ), 1.5, ); expect(res.codeId).toBeGreaterThan(0); @@ -389,7 +409,9 @@ describe('Auto withdrawer', () => { } const res = await client.upload( account.address, - fs.readFileSync(join(__dirname, '../../../artifacts/drop_factory.wasm')), + fs.readFileSync( + join(__dirname, '../../old_contracts/v1.0.1/drop_factory.wasm'), + ), 1.5, ); expect(res.codeId).toBeGreaterThan(0); @@ -794,7 +816,7 @@ describe('Auto withdrawer', () => { const res = await client.upload( account.address, fs.readFileSync( - join(__dirname, '../../../artifacts/drop_auto_withdrawer.wasm'), + join(__dirname, '../../old_contracts/v1.0.1/drop_auto_withdrawer.wasm'), ), 1.5, ); @@ -966,7 +988,9 @@ describe('Auto withdrawer', () => { const { client, account, neutronUserAddress } = context; const resUpload = await client.upload( account.address, - fs.readFileSync(join(__dirname, '../../../artifacts/drop_pump.wasm')), + fs.readFileSync( + join(__dirname, '../../old_contracts/v1.0.1/drop_pump.wasm'), + ), 1.5, ); expect(resUpload.codeId).toBeGreaterThan(0); diff --git a/integration_tests/src/testcases/core-slashing.test.ts b/integration_tests/src/testcases/core-slashing.test.ts index 34aafa8e..c82b5970 100644 --- a/integration_tests/src/testcases/core-slashing.test.ts +++ b/integration_tests/src/testcases/core-slashing.test.ts @@ -269,7 +269,9 @@ describe('Core Slashing', () => { { const res = await client.upload( account.address, - fs.readFileSync(join(__dirname, '../../../artifacts/drop_core.wasm')), + fs.readFileSync( + join(__dirname, '../../old_contracts/v1.0.1/drop_core.wasm'), + ), 1.5, ); expect(res.codeId).toBeGreaterThan(0); @@ -278,7 +280,9 @@ describe('Core Slashing', () => { { const res = await client.upload( account.address, - fs.readFileSync(join(__dirname, '../../../artifacts/drop_token.wasm')), + fs.readFileSync( + join(__dirname, '../../old_contracts/v1.0.1/drop_token.wasm'), + ), 1.5, ); expect(res.codeId).toBeGreaterThan(0); @@ -288,7 +292,10 @@ describe('Core Slashing', () => { const res = await client.upload( account.address, fs.readFileSync( - join(__dirname, '../../../artifacts/drop_withdrawal_voucher.wasm'), + join( + __dirname, + '../../old_contracts/v1.0.1/drop_withdrawal_voucher.wasm', + ), ), 1.5, ); @@ -299,7 +306,10 @@ describe('Core Slashing', () => { const res = await client.upload( account.address, fs.readFileSync( - join(__dirname, '../../../artifacts/drop_withdrawal_manager.wasm'), + join( + __dirname, + '../../old_contracts/v1.0.1/drop_withdrawal_manager.wasm', + ), ), 1.5, ); @@ -310,7 +320,7 @@ describe('Core Slashing', () => { const res = await client.upload( account.address, fs.readFileSync( - join(__dirname, '../../../artifacts/drop_strategy.wasm'), + join(__dirname, '../../old_contracts/v1.0.1/drop_strategy.wasm'), ), 1.5, ); @@ -321,7 +331,7 @@ describe('Core Slashing', () => { const res = await client.upload( account.address, fs.readFileSync( - join(__dirname, '../../../artifacts/drop_distribution.wasm'), + join(__dirname, '../../old_contracts/v1.0.1/drop_distribution.wasm'), ), 1.5, ); @@ -332,7 +342,10 @@ describe('Core Slashing', () => { const res = await client.upload( account.address, fs.readFileSync( - join(__dirname, '../../../artifacts/drop_validators_set.wasm'), + join( + __dirname, + '../../old_contracts/v1.0.1/drop_validators_set.wasm', + ), ), 1.5, ); @@ -343,7 +356,7 @@ describe('Core Slashing', () => { const res = await client.upload( account.address, fs.readFileSync( - join(__dirname, '../../../artifacts/drop_puppeteer.wasm'), + join(__dirname, '../../old_contracts/v1.0.1/drop_puppeteer.wasm'), ), 1.5, ); @@ -354,7 +367,10 @@ describe('Core Slashing', () => { const res = await client.upload( account.address, fs.readFileSync( - join(__dirname, '../../../artifacts/drop_rewards_manager.wasm'), + join( + __dirname, + '../../old_contracts/v1.0.1/drop_rewards_manager.wasm', + ), ), 1.5, ); @@ -364,7 +380,9 @@ describe('Core Slashing', () => { { const res = await client.upload( account.address, - fs.readFileSync(join(__dirname, '../../../artifacts/drop_staker.wasm')), + fs.readFileSync( + join(__dirname, '../../old_contracts/v1.0.1/drop_staker.wasm'), + ), 1.5, ); expect(res.codeId).toBeGreaterThan(0); @@ -374,7 +392,7 @@ describe('Core Slashing', () => { const res = await client.upload( account.address, fs.readFileSync( - join(__dirname, '../../../artifacts/drop_splitter.wasm'), + join(__dirname, '../../old_contracts/v1.0.1/drop_splitter.wasm'), ), 1.5, ); @@ -384,7 +402,9 @@ describe('Core Slashing', () => { { const res = await client.upload( account.address, - fs.readFileSync(join(__dirname, '../../../artifacts/drop_pump.wasm')), + fs.readFileSync( + join(__dirname, '../../old_contracts/v1.0.1/drop_pump.wasm'), + ), 1.5, ); expect(res.codeId).toBeGreaterThan(0); @@ -393,7 +413,9 @@ describe('Core Slashing', () => { const res = await client.upload( account.address, - fs.readFileSync(join(__dirname, '../../../artifacts/drop_factory.wasm')), + fs.readFileSync( + join(__dirname, '../../old_contracts/v1.0.1/drop_factory.wasm'), + ), 1.5, ); expect(res.codeId).toBeGreaterThan(0); @@ -735,7 +757,9 @@ describe('Core Slashing', () => { const { client, account, neutronUserAddress } = context; const resUpload = await client.upload( account.address, - fs.readFileSync(join(__dirname, '../../../artifacts/drop_pump.wasm')), + fs.readFileSync( + join(__dirname, '../../old_contracts/v1.0.1/drop_pump.wasm'), + ), 1.5, ); expect(resUpload.codeId).toBeGreaterThan(0); diff --git a/integration_tests/src/testcases/core.test.ts b/integration_tests/src/testcases/core.test.ts index 1ba32524..c6ebea03 100644 --- a/integration_tests/src/testcases/core.test.ts +++ b/integration_tests/src/testcases/core.test.ts @@ -272,7 +272,9 @@ describe('Core', () => { { const res = await client.upload( account.address, - fs.readFileSync(join(__dirname, '../../../artifacts/drop_core.wasm')), + fs.readFileSync( + join(__dirname, '../../old_contracts/v1.0.1/drop_core.wasm'), + ), 1.5, ); expect(res.codeId).toBeGreaterThan(0); @@ -281,7 +283,9 @@ describe('Core', () => { { const res = await client.upload( account.address, - fs.readFileSync(join(__dirname, '../../../artifacts/drop_token.wasm')), + fs.readFileSync( + join(__dirname, '../../old_contracts/v1.0.1/drop_token.wasm'), + ), 1.5, ); expect(res.codeId).toBeGreaterThan(0); @@ -291,7 +295,10 @@ describe('Core', () => { const res = await client.upload( account.address, fs.readFileSync( - join(__dirname, '../../../artifacts/drop_withdrawal_voucher.wasm'), + join( + __dirname, + '../../old_contracts/v1.0.1/drop_withdrawal_voucher.wasm', + ), ), 1.5, ); @@ -302,7 +309,10 @@ describe('Core', () => { const res = await client.upload( account.address, fs.readFileSync( - join(__dirname, '../../../artifacts/drop_withdrawal_manager.wasm'), + join( + __dirname, + '../../old_contracts/v1.0.1/drop_withdrawal_manager.wasm', + ), ), 1.5, ); @@ -312,7 +322,9 @@ describe('Core', () => { { const res = await client.upload( account.address, - fs.readFileSync(join(__dirname, '../../../artifacts/drop_pump.wasm')), + fs.readFileSync( + join(__dirname, '../../old_contracts/v1.0.1/drop_pump.wasm'), + ), 1.5, ); expect(res.codeId).toBeGreaterThan(0); @@ -322,7 +334,7 @@ describe('Core', () => { const res = await client.upload( account.address, fs.readFileSync( - join(__dirname, '../../../artifacts/drop_strategy.wasm'), + join(__dirname, '../../old_contracts/v1.0.1/drop_strategy.wasm'), ), 1.5, ); @@ -333,7 +345,7 @@ describe('Core', () => { const res = await client.upload( account.address, fs.readFileSync( - join(__dirname, '../../../artifacts/drop_distribution.wasm'), + join(__dirname, '../../old_contracts/v1.0.1/drop_distribution.wasm'), ), 1.5, ); @@ -344,7 +356,10 @@ describe('Core', () => { const res = await client.upload( account.address, fs.readFileSync( - join(__dirname, '../../../artifacts/drop_validators_set.wasm'), + join( + __dirname, + '../../old_contracts/v1.0.1/drop_validators_set.wasm', + ), ), 1.5, ); @@ -355,7 +370,7 @@ describe('Core', () => { const res = await client.upload( account.address, fs.readFileSync( - join(__dirname, '../../../artifacts/drop_puppeteer.wasm'), + join(__dirname, '../../old_contracts/v1.0.1/drop_puppeteer.wasm'), ), 1.5, ); @@ -366,7 +381,10 @@ describe('Core', () => { const res = await client.upload( account.address, fs.readFileSync( - join(__dirname, '../../../artifacts/drop_rewards_manager.wasm'), + join( + __dirname, + '../../old_contracts/v1.0.1/drop_rewards_manager.wasm', + ), ), 1.5, ); @@ -377,7 +395,7 @@ describe('Core', () => { const res = await client.upload( account.address, fs.readFileSync( - join(__dirname, '../../../artifacts/drop_splitter.wasm'), + join(__dirname, '../../old_contracts/v1.0.1/drop_splitter.wasm'), ), 1.5, ); @@ -387,7 +405,9 @@ describe('Core', () => { { const res = await client.upload( account.address, - fs.readFileSync(join(__dirname, '../../../artifacts/drop_staker.wasm')), + fs.readFileSync( + join(__dirname, '../../old_contracts/v1.0.1/drop_staker.wasm'), + ), 1.5, ); expect(res.codeId).toBeGreaterThan(0); @@ -396,7 +416,9 @@ describe('Core', () => { const res = await client.upload( account.address, - fs.readFileSync(join(__dirname, '../../../artifacts/drop_factory.wasm')), + fs.readFileSync( + join(__dirname, '../../old_contracts/v1.0.1/drop_factory.wasm'), + ), 1.5, ); expect(res.codeId).toBeGreaterThan(0); @@ -1099,7 +1121,9 @@ describe('Core', () => { const { client, account, neutronUserAddress } = context; const resUpload = await client.upload( account.address, - fs.readFileSync(join(__dirname, '../../../artifacts/drop_pump.wasm')), + fs.readFileSync( + join(__dirname, '../../old_contracts/v1.0.1/drop_pump.wasm'), + ), 1.5, ); expect(resUpload.codeId).toBeGreaterThan(0); diff --git a/integration_tests/src/testcases/migration-v1.0.1-pre.test.ts b/integration_tests/src/testcases/migration-v1.0.1-pre.test.ts new file mode 100644 index 00000000..1723f366 --- /dev/null +++ b/integration_tests/src/testcases/migration-v1.0.1-pre.test.ts @@ -0,0 +1,2577 @@ +import { describe, expect, it, beforeAll, afterAll } from 'vitest'; +import { + DropCore, + DropFactory, + DropPump, + DropPuppeteer, + DropStrategy, + DropWithdrawalManager, + DropWithdrawalVoucher, + DropRewardsManager, + DropStaker, + DropSplitter, + DropToken, +} from 'drop-ts-client'; +import { + QueryClient, + StakingExtension, + BankExtension, + setupStakingExtension, + setupBankExtension, + SigningStargateClient, +} from '@cosmjs/stargate'; +import { MsgTransfer } from 'cosmjs-types/ibc/applications/transfer/v1/tx'; +import { join } from 'path'; +import { Tendermint34Client } from '@cosmjs/tendermint-rpc'; +import { SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate'; +import { Client as NeutronClient } from '@neutron-org/client-ts'; +import { + AccountData, + coins, + DirectSecp256k1HdWallet, +} from '@cosmjs/proto-signing'; +import { GasPrice } from '@cosmjs/stargate'; +import { awaitBlocks, setupPark } from '../testSuite'; +import fs from 'fs'; +import Cosmopark from '@neutron-org/cosmopark'; +import { waitFor } from '../helpers/waitFor'; +import { + ResponseHookMsg, + UnbondBatch, +} from 'drop-ts-client/lib/contractLib/dropCore'; +import { stringToPath } from '@cosmjs/crypto'; +import { sleep } from '../helpers/sleep'; +import { waitForTx } from '../helpers/waitForTx'; +import { waitForPuppeteerICQ } from '../helpers/waitForPuppeteerICQ'; +import { instrumentCoreClass } from '../helpers/knot'; +import { checkExchangeRate } from '../helpers/exchangeRate'; + +const DropTokenClass = DropToken.Client; +const DropFactoryClass = DropFactory.Client; +const DropCoreClass = DropCore.Client; +const DropPumpClass = DropPump.Client; +const DropStakerClass = DropStaker.Client; +const DropPuppeteerClass = DropPuppeteer.Client; +const DropStrategyClass = DropStrategy.Client; +const DropWithdrawalVoucherClass = DropWithdrawalVoucher.Client; +const DropWithdrawalManagerClass = DropWithdrawalManager.Client; +const DropRewardsManagerClass = DropRewardsManager.Client; +const DropRewardsPumpClass = DropPump.Client; +const DropSplitterClass = DropSplitter.Client; + +const UNBONDING_TIME = 360; + +describe('Core', () => { + const context: { + park?: Cosmopark; + contractAddress?: string; + wallet?: DirectSecp256k1HdWallet; + gaiaWallet?: DirectSecp256k1HdWallet; + gaiaWallet2?: DirectSecp256k1HdWallet; + factoryContractClient?: InstanceType; + coreContractClient?: InstanceType; + stakerContractClient?: InstanceType; + strategyContractClient?: InstanceType; + pumpContractClient?: InstanceType; + puppeteerContractClient?: InstanceType; + splitterContractClient?: InstanceType; + tokenContractClient?: InstanceType; + withdrawalVoucherContractClient?: InstanceType< + typeof DropWithdrawalVoucherClass + >; + withdrawalManagerContractClient?: InstanceType< + typeof DropWithdrawalManagerClass + >; + rewardsManagerContractClient?: InstanceType; + rewardsPumpContractClient?: InstanceType; + account?: AccountData; + icaAddress?: string; + stakerIcaAddress?: string; + rewardsPumpIcaAddress?: string; + client?: SigningCosmWasmClient; + gaiaClient?: SigningStargateClient; + gaiaUserAddress?: string; + gaiaUserAddress2?: string; + gaiaQueryClient?: QueryClient & StakingExtension & BankExtension; + neutronRPCEndpoint?: string; + neutronClient?: InstanceType; + neutronUserAddress?: string; + neutronSecondUserAddress?: string; + validatorAddress?: string; + secondValidatorAddress?: string; + tokenizedDenomOnNeutron?: string; + codeIds: { + core?: number; + token?: number; + withdrawalVoucher?: number; + withdrawalManager?: number; + strategy?: number; + staker?: number; + puppeteer?: number; + validatorsSet?: number; + distribution?: number; + rewardsManager?: number; + splitter?: number; + pump?: number; + }; + exchangeRate?: number; + neutronIBCDenom?: string; + ldDenom?: string; + } = { codeIds: {} }; + + beforeAll(async (t) => { + context.park = await setupPark( + t, + ['neutronv2', 'gaia'], + { + gaia: { + genesis_opts: { + 'app_state.staking.params.unbonding_time': `${UNBONDING_TIME}s`, + }, + }, + neutronv2: { + genesis_opts: { + 'app_state.staking.params.bond_denom': `untrn`, + }, + }, + }, + { + neutron: true, + hermes: { + config: { + 'chains.1.trusting_period': '2m0s', + }, + }, + }, + ); + context.wallet = await DirectSecp256k1HdWallet.fromMnemonic( + context.park.config.wallets.demowallet1.mnemonic, + { + prefix: 'neutron', + }, + ); + context.gaiaWallet = await DirectSecp256k1HdWallet.fromMnemonic( + context.park.config.wallets.demowallet1.mnemonic, + { + prefix: 'cosmos', + }, + ); + context.gaiaWallet2 = await DirectSecp256k1HdWallet.fromMnemonic( + context.park.config.wallets.demo1.mnemonic, + { + prefix: 'cosmos', + }, + ); + context.account = (await context.wallet.getAccounts())[0]; + context.neutronClient = new NeutronClient({ + apiURL: `http://127.0.0.1:${context.park.ports.neutronv2.rest}`, + rpcURL: `127.0.0.1:${context.park.ports.neutronv2.rpc}`, + prefix: 'neutron', + }); + context.neutronRPCEndpoint = `http://127.0.0.1:${context.park.ports.neutronv2.rpc}`; + context.client = await SigningCosmWasmClient.connectWithSigner( + context.neutronRPCEndpoint, + context.wallet, + { + gasPrice: GasPrice.fromString('0.025untrn'), + }, + ); + context.gaiaClient = await SigningStargateClient.connectWithSigner( + `http://127.0.0.1:${context.park.ports.gaia.rpc}`, + context.gaiaWallet, + { + gasPrice: GasPrice.fromString('0.025stake'), + }, + ); + const tmClient = await Tendermint34Client.connect( + `http://127.0.0.1:${context.park.ports.gaia.rpc}`, + ); + context.gaiaQueryClient = QueryClient.withExtensions( + tmClient, + setupStakingExtension, + setupBankExtension, + ); + const secondWallet = await DirectSecp256k1HdWallet.fromMnemonic( + context.park.config.wallets.demo2.mnemonic, + { + prefix: 'neutron', + }, + ); + context.neutronSecondUserAddress = ( + await secondWallet.getAccounts() + )[0].address; + }); + + afterAll(async () => { + await context.park.stop(); + }); + + it('transfer tokens to neutron', async () => { + context.gaiaUserAddress = ( + await context.gaiaWallet.getAccounts() + )[0].address; + context.gaiaUserAddress2 = ( + await context.gaiaWallet2.getAccounts() + )[0].address; + context.neutronUserAddress = ( + await context.wallet.getAccounts() + )[0].address; + { + const wallet = await DirectSecp256k1HdWallet.fromMnemonic( + context.park.config.master_mnemonic, + { + prefix: 'cosmosvaloper', + hdPaths: [stringToPath("m/44'/118'/1'/0/0") as any], + }, + ); + context.validatorAddress = (await wallet.getAccounts())[0].address; + } + { + const wallet = await DirectSecp256k1HdWallet.fromMnemonic( + context.park.config.master_mnemonic, + { + prefix: 'cosmosvaloper', + hdPaths: [stringToPath("m/44'/118'/2'/0/0") as any], + }, + ); + context.secondValidatorAddress = (await wallet.getAccounts())[0].address; + } + + const { gaiaClient, gaiaUserAddress, neutronUserAddress, neutronClient } = + context; + const res = await gaiaClient.signAndBroadcast( + gaiaUserAddress, + [ + { + typeUrl: '/ibc.applications.transfer.v1.MsgTransfer', + value: MsgTransfer.fromPartial({ + sender: gaiaUserAddress, + sourceChannel: 'channel-0', + sourcePort: 'transfer', + receiver: neutronUserAddress, + token: { denom: 'stake', amount: '2000000' }, + timeoutTimestamp: BigInt((Date.now() + 10 * 60 * 1000) * 1e6), + timeoutHeight: { + revisionHeight: BigInt(0), + revisionNumber: BigInt(0), + }, + }), + }, + ], + 2, + ); + expect(res.transactionHash).toHaveLength(64); + await waitFor(async () => { + const balances = + await neutronClient.CosmosBankV1Beta1.query.queryAllBalances( + neutronUserAddress, + ); + context.neutronIBCDenom = balances.data.balances.find((b) => + b.denom.startsWith('ibc/'), + )?.denom; + return balances.data.balances.length > 1; + }, 60_000); + expect(context.neutronIBCDenom).toBeTruthy(); + }); + + it('instantiate', async () => { + const { client, account } = context; + context.codeIds = {}; + + { + const res = await client.upload( + account.address, + fs.readFileSync( + join(__dirname, '../../old_contracts/v1.0.1/drop_core.wasm'), + ), + 1.5, + ); + expect(res.codeId).toBeGreaterThan(0); + context.codeIds.core = res.codeId; + } + { + const res = await client.upload( + account.address, + fs.readFileSync( + join(__dirname, '../../old_contracts/v1.0.1/drop_token.wasm'), + ), + 1.5, + ); + expect(res.codeId).toBeGreaterThan(0); + context.codeIds.token = res.codeId; + } + { + const res = await client.upload( + account.address, + fs.readFileSync( + join( + __dirname, + '../../old_contracts/v1.0.1/drop_withdrawal_voucher.wasm', + ), + ), + 1.5, + ); + expect(res.codeId).toBeGreaterThan(0); + context.codeIds.withdrawalVoucher = res.codeId; + } + { + const res = await client.upload( + account.address, + fs.readFileSync( + join( + __dirname, + '../../old_contracts/v1.0.1/drop_withdrawal_manager.wasm', + ), + ), + 1.5, + ); + expect(res.codeId).toBeGreaterThan(0); + context.codeIds.withdrawalManager = res.codeId; + } + { + const res = await client.upload( + account.address, + fs.readFileSync( + join(__dirname, '../../old_contracts/v1.0.1/drop_pump.wasm'), + ), + 1.5, + ); + expect(res.codeId).toBeGreaterThan(0); + context.codeIds.pump = res.codeId; + } + { + const res = await client.upload( + account.address, + fs.readFileSync( + join(__dirname, '../../old_contracts/v1.0.1/drop_strategy.wasm'), + ), + 1.5, + ); + expect(res.codeId).toBeGreaterThan(0); + context.codeIds.strategy = res.codeId; + } + { + const res = await client.upload( + account.address, + fs.readFileSync( + join(__dirname, '../../old_contracts/v1.0.1/drop_distribution.wasm'), + ), + 1.5, + ); + expect(res.codeId).toBeGreaterThan(0); + context.codeIds.distribution = res.codeId; + } + { + const res = await client.upload( + account.address, + fs.readFileSync( + join( + __dirname, + '../../old_contracts/v1.0.1/drop_validators_set.wasm', + ), + ), + 1.5, + ); + expect(res.codeId).toBeGreaterThan(0); + context.codeIds.validatorsSet = res.codeId; + } + { + const res = await client.upload( + account.address, + fs.readFileSync( + join(__dirname, '../../old_contracts/v1.0.1/drop_puppeteer.wasm'), + ), + 1.5, + ); + expect(res.codeId).toBeGreaterThan(0); + context.codeIds.puppeteer = res.codeId; + } + { + const res = await client.upload( + account.address, + fs.readFileSync( + join( + __dirname, + '../../old_contracts/v1.0.1/drop_rewards_manager.wasm', + ), + ), + 1.5, + ); + expect(res.codeId).toBeGreaterThan(0); + context.codeIds.rewardsManager = res.codeId; + } + { + const res = await client.upload( + account.address, + fs.readFileSync( + join(__dirname, '../../old_contracts/v1.0.1/drop_splitter.wasm'), + ), + 1.5, + ); + expect(res.codeId).toBeGreaterThan(0); + context.codeIds.splitter = res.codeId; + } + { + const res = await client.upload( + account.address, + fs.readFileSync( + join(__dirname, '../../old_contracts/v1.0.1/drop_staker.wasm'), + ), + 1.5, + ); + expect(res.codeId).toBeGreaterThan(0); + context.codeIds.staker = res.codeId; + } + + const res = await client.upload( + account.address, + fs.readFileSync( + join(__dirname, '../../old_contracts/v1.0.1/drop_factory.wasm'), + ), + 1.5, + ); + expect(res.codeId).toBeGreaterThan(0); + const instantiateRes = await DropFactory.Client.instantiate( + client, + account.address, + res.codeId, + { + sdk_version: process.env.SDK_VERSION || '0.46.0', + local_denom: 'untrn', + code_ids: { + core_code_id: context.codeIds.core, + token_code_id: context.codeIds.token, + withdrawal_voucher_code_id: context.codeIds.withdrawalVoucher, + withdrawal_manager_code_id: context.codeIds.withdrawalManager, + strategy_code_id: context.codeIds.strategy, + staker_code_id: context.codeIds.staker, + distribution_code_id: context.codeIds.distribution, + validators_set_code_id: context.codeIds.validatorsSet, + puppeteer_code_id: context.codeIds.puppeteer, + rewards_manager_code_id: context.codeIds.rewardsManager, + splitter_code_id: context.codeIds.splitter, + rewards_pump_code_id: context.codeIds.pump, + }, + remote_opts: { + connection_id: 'connection-0', + transfer_channel_id: 'channel-0', + reverse_transfer_channel_id: 'channel-0', + port_id: 'transfer', + denom: 'stake', + update_period: 2, + timeout: { + local: 60, + remote: 60, + }, + }, + salt: 'salt', + subdenom: 'drop', + token_metadata: { + description: 'Drop token', + display: 'drop', + exponent: 6, + name: 'Drop liquid staking token', + symbol: 'DROP', + uri: null, + uri_hash: null, + }, + base_denom: context.neutronIBCDenom, + core_params: { + idle_min_interval: 40, + unbond_batch_switch_time: 60, + unbonding_safe_period: 10, + unbonding_period: 360, + lsm_redeem_threshold: 2, + lsm_min_bond_amount: '1000', + lsm_redeem_max_interval: 60_000, + bond_limit: '0', + min_stake_amount: '2', + icq_update_delay: 5, + }, + staker_params: { + min_stake_amount: '10000', + min_ibc_transfer: '10000', + }, + }, + 'drop-staking-factory', + 'auto', + [], + account.address, + ); + expect(instantiateRes.contractAddress).toHaveLength(66); + context.contractAddress = instantiateRes.contractAddress; + context.factoryContractClient = new DropFactory.Client( + client, + context.contractAddress, + ); + }); + + it('query factory state', async () => { + const { factoryContractClient: contractClient, neutronClient } = context; + const res = await contractClient.queryState(); + expect(res).toBeTruthy(); + const tokenContractInfo = + await neutronClient.CosmwasmWasmV1.query.queryContractInfo( + res.token_contract, + ); + expect(tokenContractInfo.data.contract_info.label).toBe( + 'drop-staking-token', + ); + const stakerContractInfo = + await neutronClient.CosmwasmWasmV1.query.queryContractInfo( + res.staker_contract, + ); + expect(stakerContractInfo.data.contract_info.label).toBe( + 'drop-staking-staker', + ); + const coreContractInfo = + await neutronClient.CosmwasmWasmV1.query.queryContractInfo( + res.core_contract, + ); + expect(coreContractInfo.data.contract_info.label).toBe('drop-staking-core'); + const withdrawalVoucherContractInfo = + await neutronClient.CosmwasmWasmV1.query.queryContractInfo( + res.withdrawal_voucher_contract, + ); + expect(withdrawalVoucherContractInfo.data.contract_info.label).toBe( + 'drop-staking-withdrawal-voucher', + ); + const withdrawalManagerContractInfo = + await neutronClient.CosmwasmWasmV1.query.queryContractInfo( + res.withdrawal_manager_contract, + ); + expect(withdrawalManagerContractInfo.data.contract_info.label).toBe( + 'drop-staking-withdrawal-manager', + ); + const puppeteerContractInfo = + await neutronClient.CosmwasmWasmV1.query.queryContractInfo( + res.puppeteer_contract, + ); + expect(puppeteerContractInfo.data.contract_info.label).toBe( + 'drop-staking-puppeteer', + ); + context.coreContractClient = instrumentCoreClass( + new DropCore.Client(context.client, res.core_contract), + ); + context.withdrawalVoucherContractClient = new DropWithdrawalVoucher.Client( + context.client, + res.withdrawal_voucher_contract, + ); + context.withdrawalManagerContractClient = new DropWithdrawalManager.Client( + context.client, + res.withdrawal_manager_contract, + ); + context.rewardsManagerContractClient = new DropRewardsManager.Client( + context.client, + res.rewards_manager_contract, + ); + context.strategyContractClient = new DropStrategy.Client( + context.client, + res.strategy_contract, + ); + context.stakerContractClient = new DropStaker.Client( + context.client, + res.staker_contract, + ); + context.rewardsPumpContractClient = new DropPump.Client( + context.client, + res.rewards_pump_contract, + ); + context.tokenContractClient = new DropToken.Client( + context.client, + res.token_contract, + ); + context.puppeteerContractClient = new DropPuppeteer.Client( + context.client, + res.puppeteer_contract, + ); + context.splitterContractClient = new DropSplitter.Client( + context.client, + res.splitter_contract, + ); + }); + + it('register staker ICA', async () => { + const { stakerContractClient, neutronUserAddress } = context; + const res = await stakerContractClient.registerICA( + neutronUserAddress, + 1.5, + undefined, + [{ amount: '1000000', denom: 'untrn' }], + ); + expect(res.transactionHash).toHaveLength(64); + let ica = ''; + await waitFor(async () => { + const res = await stakerContractClient.queryIca(); + switch (res) { + case 'none': + case 'in_progress': + case 'timeout': + return false; + default: + ica = res.registered.ica_address; + return true; + } + }, 100_000); + expect(ica).toHaveLength(65); + expect(ica.startsWith('cosmos')).toBeTruthy(); + context.stakerIcaAddress = ica; + }); + it('setup ICA for rewards pump', async () => { + const { rewardsPumpContractClient, neutronUserAddress } = context; + const res = await rewardsPumpContractClient.registerICA( + neutronUserAddress, + 1.5, + undefined, + [{ amount: '1000000', denom: 'untrn' }], + ); + expect(res.transactionHash).toHaveLength(64); + let ica = ''; + await waitFor(async () => { + const res = await rewardsPumpContractClient.queryIca(); + switch (res) { + case 'none': + case 'in_progress': + case 'timeout': + return false; + default: + ica = res.registered.ica_address; + return true; + } + }, 100_000); + expect(ica).toHaveLength(65); + expect(ica.startsWith('cosmos')).toBeTruthy(); + context.rewardsPumpIcaAddress = ica; + }); + + it('register puppeteer ICA', async () => { + const { puppeteerContractClient, neutronUserAddress } = context; + const res = await puppeteerContractClient.registerICA( + neutronUserAddress, + 1.5, + undefined, + [{ amount: '1000000', denom: 'untrn' }], + ); + expect(res.transactionHash).toHaveLength(64); + let ica = ''; + await waitFor(async () => { + const res = await puppeteerContractClient.queryIca(); + switch (res) { + case 'none': + case 'in_progress': + case 'timeout': + return false; + default: + ica = res.registered.ica_address; + return true; + } + }, 100_000); + expect(ica).toHaveLength(65); + expect(ica.startsWith('cosmos')).toBeTruthy(); + context.icaAddress = ica; + }); + it('set puppeteer ICA to the staker', async () => { + const res = await context.factoryContractClient.adminExecute( + context.neutronUserAddress, + { + msgs: [ + { + wasm: { + execute: { + contract_addr: context.stakerContractClient.contractAddress, + msg: Buffer.from( + JSON.stringify({ + update_config: { + new_config: { + puppeteer_ica: context.icaAddress, + }, + }, + }), + ).toString('base64'), + funds: [], + }, + }, + }, + ], + }, + 1.5, + undefined, + [], + ); + expect(res.transactionHash).toHaveLength(64); + }); + it('grant staker to delegate funds from puppeteer ICA and set up rewards receiver', async () => { + const { neutronUserAddress } = context; + const res = await context.factoryContractClient.adminExecute( + neutronUserAddress, + { + msgs: [ + { + wasm: { + execute: { + contract_addr: context.puppeteerContractClient.contractAddress, + msg: Buffer.from( + JSON.stringify({ + setup_protocol: { + delegate_grantee: context.stakerIcaAddress, + rewards_withdraw_address: context.rewardsPumpIcaAddress, + }, + }), + ).toString('base64'), + funds: [ + { + amount: '20000', + denom: 'untrn', + }, + ], + }, + }, + }, + ], + }, + 1.5, + undefined, + [ + { + amount: '20000', + denom: 'untrn', + }, + ], + ); + expect(res.transactionHash).toHaveLength(64); + const pupRes = await context.puppeteerContractClient.queryTxState(); + expect(pupRes.status).toBe('waiting_for_ack'); + }); + it('wait puppeteer response', async () => { + const { puppeteerContractClient } = context; + await waitFor(async () => { + const res = await puppeteerContractClient.queryTxState(); + return res.status === 'idle'; + }, 100_000); + }); + it('verify grant', async () => { + const res = await context.park.executeInNetwork( + 'gaia', + `${context.park.config.networks['gaia'].binary} query authz grants-by-grantee ${context.stakerIcaAddress} --output json`, + ); + const out = JSON.parse(res.out); + expect(out.grants).toHaveLength(1); + const grant = out.grants[0]; + expect(grant.granter).toEqual(context.icaAddress); + expect(grant.grantee).toEqual(context.stakerIcaAddress); + }); + + it('query exchange rate', async () => { + const { coreContractClient } = context; + context.exchangeRate = parseFloat( + await coreContractClient.queryExchangeRate(), + ); + expect(context.exchangeRate).toEqual(1); + await checkExchangeRate(context); + }); + + it('bond w/o receiver', async () => { + const { + coreContractClient, + neutronClient, + neutronUserAddress, + neutronIBCDenom, + } = context; + const res = await coreContractClient.bond( + neutronUserAddress, + {}, + 1.6, + undefined, + [ + { + amount: '500000', + denom: neutronIBCDenom, + }, + ], + ); + expect(res.transactionHash).toHaveLength(64); + await awaitBlocks(`http://127.0.0.1:${context.park.ports.gaia.rpc}`, 1); + const balances = + await neutronClient.CosmosBankV1Beta1.query.queryAllBalances( + neutronUserAddress, + ); + + const ldBalance = balances.data.balances.find((one) => + one.denom.startsWith('factory'), + ); + + expect(ldBalance).toEqual({ + denom: `factory/${context.tokenContractClient.contractAddress}/drop`, + amount: String(Math.floor(500_000 / context.exchangeRate)), + }); + + context.ldDenom = ldBalance?.denom; + + await checkExchangeRate(context); + }); + it('verify bonded amount', async () => { + const { coreContractClient } = context; + const bonded = await coreContractClient.queryTotalBonded(); + expect(bonded).toEqual('500000'); + }); + + it('delegate tokens on gaia side', async () => { + const wallet = await DirectSecp256k1HdWallet.fromMnemonic( + context.park.config.master_mnemonic, + { + prefix: 'cosmosvaloper', + hdPaths: [stringToPath("m/44'/118'/1'/0/0") as any], + }, + ); + context.validatorAddress = (await wallet.getAccounts())[0].address; + const res = await context.park.executeInNetwork( + 'gaia', + `gaiad tx staking delegate ${context.validatorAddress} 1000000stake --from ${context.gaiaUserAddress} --yes --chain-id testgaia --home=/opt --keyring-backend=test --output json`, + ); + expect(res.exitCode).toBe(0); + const out = JSON.parse(res.out); + expect(out.code).toBe(0); + expect(out.txhash).toHaveLength(64); + await waitForTx(context.gaiaClient, out.txhash); + }); + it('tokenize share on gaia side', async () => { + const res = await context.park.executeInNetwork( + 'gaia', + `gaiad tx staking tokenize-share ${context.validatorAddress} 600000stake ${context.gaiaUserAddress} --from ${context.gaiaUserAddress} --yes --chain-id testgaia --home=/opt --keyring-backend=test --gas auto --gas-adjustment 2 --output json`, + ); + expect(res.exitCode).toBe(0); + const out = JSON.parse(res.out); + expect(out.code).toBe(0); + expect(out.txhash).toHaveLength(64); + await waitForTx(context.gaiaClient, out.txhash); + const balances = await context.gaiaQueryClient.bank.allBalances( + context.gaiaUserAddress, + ); + expect( + balances.find((a) => a.denom == `${context.validatorAddress}/1`), + ).toEqual({ + denom: `${context.validatorAddress}/1`, + amount: '600000', + }); + }); + it('transfer tokenized share to neutron', async () => { + const res = await context.park.executeInNetwork( + 'gaia', + `gaiad tx ibc-transfer transfer transfer channel-0 ${context.neutronUserAddress} 600000${context.validatorAddress}/1 --from ${context.gaiaUserAddress} --yes --chain-id testgaia --home=/opt --keyring-backend=test --gas auto --gas-adjustment 2 --output json`, + ); + expect(res.exitCode).toBe(0); + const out = JSON.parse(res.out); + expect(out.code).toBe(0); + expect(out.txhash).toHaveLength(64); + await waitForTx(context.gaiaClient, out.txhash); + }); + it('wait for neutron to receive tokenized share', async () => { + const { neutronClient, neutronUserAddress } = context; + let balances; + await waitFor(async () => { + balances = + await neutronClient.CosmosBankV1Beta1.query.queryAllBalances( + neutronUserAddress, + ); + return balances.data.balances.some((b) => b.amount === '600000'); + }); + const shareOnNeutron = balances.data.balances.find( + (b) => b.amount === '600000', + ); + expect(shareOnNeutron).toBeDefined(); + expect(shareOnNeutron?.amount).toBe('600000'); + context.tokenizedDenomOnNeutron = shareOnNeutron?.denom; + }); + it('add validators into validators set', async () => { + const { + neutronUserAddress, + factoryContractClient, + validatorAddress, + secondValidatorAddress, + } = context; + const res = await factoryContractClient.proxy( + neutronUserAddress, + { + validator_set: { + update_validators: { + validators: [ + { + valoper_address: validatorAddress, + weight: 1, + }, + { + valoper_address: secondValidatorAddress, + weight: 1, + }, + ], + }, + }, + }, + 1.5, + undefined, + [ + { + amount: '1000000', + denom: 'untrn', + }, + ], + ); + expect(res.transactionHash).toHaveLength(64); + }); + + it('unbond', async () => { + const { coreContractClient, neutronUserAddress, ldDenom } = context; + let res = await coreContractClient.unbond( + neutronUserAddress, + 1.6, + undefined, + [ + { + amount: Math.floor(200_000 / context.exchangeRate).toString(), + denom: ldDenom, + }, + ], + ); + expect(res.transactionHash).toHaveLength(64); + res = await coreContractClient.unbond(neutronUserAddress, 1.6, undefined, [ + { + amount: Math.floor(300_000 / context.exchangeRate).toString(), + denom: ldDenom, + }, + ]); + expect(res.transactionHash).toHaveLength(64); + await checkExchangeRate(context); + }); + + it('validate unbonding batch', async () => { + const batch = await context.coreContractClient.queryUnbondBatch({ + batch_id: '0', + }); + expect(batch).toBeTruthy(); + expect(batch).toEqual({ + slashing_effect: null, + status_timestamps: expect.any(Object), + expected_release_time: 0, + status: 'new', + total_dasset_amount_to_withdraw: '500000', + expected_native_asset_amount: '0', + total_unbond_items: 2, + unbonded_amount: null, + withdrawn_amount: null, + }); + }); + + it('check core contract settings', async () => { + const { coreContractClient } = context; + const config = await coreContractClient.queryConfig(); + expect(config.lsm_redeem_threshold).toBe(2); + }); + + it('check staker contract settings', async () => { + const { stakerContractClient } = context; + const config = await stakerContractClient.queryConfig(); + expect((config as any).min_ibc_transfer).toBe('10000'); + expect((config as any).min_staking_amount).toBe('10000'); + }); + + it('check splitter contract settings', async () => { + const { splitterContractClient, stakerContractClient, neutronIBCDenom } = + context; + const config = await splitterContractClient.queryConfig(); + expect(config).toMatchObject({ + denom: neutronIBCDenom, + receivers: [[stakerContractClient.contractAddress, '10000']], + }); + }); + + it('upload new code and run migration', async () => { + const { client, account, contractAddress } = context; + + { + const res = await client.upload( + account.address, + fs.readFileSync(join(__dirname, '../../../artifacts/drop_core.wasm')), + 1.5, + ); + expect(res.codeId).toBeGreaterThan(0); + context.codeIds.core = res.codeId; + } + + const res = await client.upload( + account.address, + fs.readFileSync(join(__dirname, '../../../artifacts/drop_factory.wasm')), + 1.5, + ); + expect(res.codeId).toBeGreaterThan(0); + + const fee = { + amount: coins(5000, 'untrn'), + gas: '2000000', + }; + + const result = await client.migrate( + account.address, + contractAddress, + res.codeId, + { + core_code_id: context.codeIds.core, + }, + fee, + ); + + expect(result.transactionHash).toHaveLength(64); + + await awaitBlocks( + `http://127.0.0.1:${context.park.ports.neutronv2.rpc}`, + 3, + ); + }); + + it('check core contract settings', async () => { + const { coreContractClient } = context; + const config = await coreContractClient.queryConfig(); + expect(config.lsm_redeem_threshold).toBe(1); + }); + + it('check staker contract settings', async () => { + const { stakerContractClient } = context; + const config = await stakerContractClient.queryConfig(); + expect((config as any).min_ibc_transfer).toBe('1'); + expect((config as any).min_staking_amount).toBe('1'); + }); + + it('check splitter contract settings', async () => { + const { splitterContractClient } = context; + const config = await splitterContractClient.queryConfig(); + expect(config).toMatchObject({ + denom: + 'ibc/C4CFF46FD6DE35CA4CF4CE031E643C8FDC9BA4B99AE598E9B0ED98FE3A2319F9', + receivers: [], + }); + }); + + it('bond failed temporarily disabled', async () => { + const { coreContractClient, neutronUserAddress, neutronIBCDenom } = context; + await expect( + coreContractClient.bond(neutronUserAddress, {}, 1.6, undefined, [ + { + amount: '500000', + denom: neutronIBCDenom, + }, + ]), + ).rejects.toThrowError( + /Bonding is temporarily disabled due to protocol upgrade/, + ); + await checkExchangeRate(context); + }); + + it('unbond failed temporarily disabled', async () => { + const { coreContractClient, neutronUserAddress } = context; + await expect( + coreContractClient.unbond(neutronUserAddress, 1.6, undefined, [ + { + amount: '1000', + denom: 'untrn', + }, + ]), + ).rejects.toThrowError( + /Unbonding is temporarily disabled due to protocol upgrade/, + ); + await checkExchangeRate(context); + }); + + describe.skip('state machine', () => { + const ica: { balance?: number } = {}; + describe('prepare', () => { + it('get ICA balance', async () => { + const { gaiaClient } = context; + const res = await gaiaClient.getBalance(context.icaAddress, 'stake'); + ica.balance = parseInt(res.amount); + expect(ica.balance).toEqual(0); + }); + it('deploy pump', async () => { + const { client, account, neutronUserAddress } = context; + const resUpload = await client.upload( + account.address, + fs.readFileSync(join(__dirname, '../../../artifacts/drop_pump.wasm')), + 1.5, + ); + expect(resUpload.codeId).toBeGreaterThan(0); + const { codeId } = resUpload; + const res = await DropPump.Client.instantiate( + client, + neutronUserAddress, + codeId, + { + connection_id: 'connection-0', + local_denom: 'untrn', + timeout: { + local: 60, + remote: 60, + }, + dest_address: + context.withdrawalManagerContractClient.contractAddress, + dest_port: 'transfer', + dest_channel: 'channel-0', + refundee: neutronUserAddress, + owner: account.address, + }, + 'drop-staking-pump', + 1.5, + [], + ); + expect(res.contractAddress).toHaveLength(66); + context.pumpContractClient = new DropPump.Client( + client, + res.contractAddress, + ); + await context.pumpContractClient.registerICA( + neutronUserAddress, + 1.5, + undefined, + [ + { + amount: '1000000', + denom: 'untrn', + }, + ], + ); + let ica = ''; + await waitFor(async () => { + const res = await context.pumpContractClient.queryIca(); + switch (res) { + case 'none': + case 'in_progress': + case 'timeout': + return false; + default: + ica = res.registered.ica_address; + return true; + } + }, 50_000); + expect(ica).toHaveLength(65); + expect(ica.startsWith('cosmos')).toBeTruthy(); + const resFactory = await context.factoryContractClient.updateConfig( + neutronUserAddress, + { + core: { + pump_ica_address: ica, + }, + }, + ); + expect(resFactory.transactionHash).toHaveLength(64); + }); + it('get machine state', async () => { + const state = await context.coreContractClient.queryContractState(); + expect(state).toEqual('idle'); + }); + }); + describe('paused tick', () => { + it('pause protocol', async () => { + const { + account, + factoryContractClient: contractClient, + neutronUserAddress, + } = context; + + await contractClient.pause(account.address); + + await expect( + context.coreContractClient.tick(neutronUserAddress, 1.5, undefined, [ + { + amount: '1000000', + denom: 'untrn', + }, + ]), + ).rejects.toThrowError(/Contract execution is paused/); + + await contractClient.unpause(account.address); + }); + }); + describe('first cycle', () => { + it('staker ibc transfer', async () => { + const { neutronUserAddress } = context; + const res = await context.stakerContractClient.iBCTransfer( + neutronUserAddress, + 1.5, + undefined, + [{ amount: '20000', denom: 'untrn' }], + ); + expect(res.transactionHash).toHaveLength(64); + await waitFor(async () => { + const res = await context.stakerContractClient.queryTxState(); + return res.status === 'idle'; + }, 80_000); + const balances = await context.gaiaClient.getAllBalances( + context.stakerIcaAddress, + ); + expect(balances).toEqual([ + { + amount: '1000000', + denom: context.park.config.networks.gaia.denom, + }, + ]); + }); + it('tick', async () => { + const { + gaiaClient, + neutronUserAddress, + coreContractClient, + puppeteerContractClient, + } = context; + + await waitForPuppeteerICQ( + gaiaClient, + coreContractClient, + puppeteerContractClient, + ); + + const res = await context.coreContractClient.tick( + neutronUserAddress, + 1.5, + undefined, + [ + { + amount: '1000000', + denom: 'untrn', + }, + ], + ); + expect(res.transactionHash).toHaveLength(64); + const state = await context.coreContractClient.queryContractState(); + expect(state).toEqual('staking_bond'); + const stakerState = await context.stakerContractClient.queryTxState(); + expect(stakerState).toEqual({ + reply_to: context.coreContractClient.contractAddress, + status: 'waiting_for_ack', + seq_id: 1, + transaction: { + stake: { + amount: '1000000', + }, + }, + }); + await checkExchangeRate(context); + }); + it('second tick is failed bc no response from puppeteer yet', async () => { + const { neutronUserAddress } = context; + + await expect( + context.coreContractClient.tick( + neutronUserAddress, + 1.5, + undefined, + [], + ), + ).rejects.toThrowError(/Staker response is not received/); + }); + it('state of fsm is staking_bond', async () => { + const state = await context.coreContractClient.queryContractState(); + expect(state).toEqual('staking_bond'); + }); + it('wait for staker to get into idle state', async () => { + let response; + await waitFor(async () => { + try { + response = await context.stakerContractClient.queryTxState(); + } catch (e) { + // + } + return response.status === 'idle'; + }, 100_000); + }); + it('get staker ICA zeroed balance', async () => { + const { gaiaClient } = context; + const res = await gaiaClient.getBalance( + context.stakerIcaAddress, + context.park.config.networks.gaia.denom, + ); + const balance = parseInt(res.amount); + expect(balance).toEqual(0); + }); + it('wait delegations', async () => { + await waitFor(async () => { + const res: any = await context.puppeteerContractClient.queryExtension( + { + msg: { + delegations: {}, + }, + }, + ); + return res && res.delegations.delegations.length > 0; + }, 100_000); + }); + it('tick goes to unbonding', async () => { + const { + neutronUserAddress, + gaiaClient, + coreContractClient, + puppeteerContractClient, + } = context; + + await waitForPuppeteerICQ( + gaiaClient, + coreContractClient, + puppeteerContractClient, + ); + + const res = await context.coreContractClient.tick( + neutronUserAddress, + 1.5, + undefined, + [ + { + amount: '1000000', + denom: 'untrn', + }, + ], + ); + expect(res.transactionHash).toHaveLength(64); + const state = await context.coreContractClient.queryContractState(); + expect(state).toEqual('unbonding'); + await checkExchangeRate(context); + }); + it('tick is failed bc no response from puppeteer yet', async () => { + const { neutronUserAddress } = context; + await expect( + context.coreContractClient.tick( + neutronUserAddress, + 1.5, + undefined, + [], + ), + ).rejects.toThrowError(/Puppeteer response is not received/); + }); + it('query one unbonding batch', async () => { + const batch = await context.coreContractClient.queryUnbondBatch({ + batch_id: '0', + }); + expect(batch).toBeTruthy(); + expect(batch).toEqual({ + slashing_effect: null, + status: 'unbond_requested', + status_timestamps: expect.any(Object), + expected_release_time: 0, + total_dasset_amount_to_withdraw: '500000', + expected_native_asset_amount: '500000', + total_unbond_items: 2, + unbonded_amount: null, + withdrawn_amount: null, + }); + }); + it('query all unbonding batches at once', async () => { + const { unbond_batches: unbondBatches, next_page_key: nextPageKey } = + await context.coreContractClient.queryUnbondBatches({}); + + expect(unbondBatches.length).toEqual(2); + expect(nextPageKey).toBeNull(); + + const [firstBatch, secondBatch] = unbondBatches; + expect(firstBatch).toBeTruthy(); + expect(secondBatch).toBeTruthy(); + expect(firstBatch).toEqual({ + slashing_effect: null, + status: 'unbond_requested', + status_timestamps: expect.any(Object), + expected_release_time: 0, + total_dasset_amount_to_withdraw: '500000', + expected_native_asset_amount: '500000', + total_unbond_items: 2, + unbonded_amount: null, + withdrawn_amount: null, + }); + expect(secondBatch).toEqual({ + slashing_effect: null, + status: 'new', + status_timestamps: expect.any(Object), + expected_release_time: 0, + total_dasset_amount_to_withdraw: '0', + expected_native_asset_amount: '0', + total_unbond_items: 0, + unbonded_amount: null, + withdrawn_amount: null, + }); + }); + it('query all unbonding batches with limit and page key', async () => { + const { + unbond_batches: firstUnbondBatches, + next_page_key: firstNextPageKey, + } = await context.coreContractClient.queryUnbondBatches({ + limit: '1', + }); + + expect(firstUnbondBatches.length).toEqual(1); + expect(firstNextPageKey).toBeTruthy(); + + const [firstBatch] = firstUnbondBatches; + expect(firstBatch).toBeTruthy(); + expect(firstBatch).toEqual({ + slashing_effect: null, + status: 'unbond_requested', + status_timestamps: expect.any(Object), + expected_release_time: 0, + total_dasset_amount_to_withdraw: '500000', + expected_native_asset_amount: '500000', + total_unbond_items: 2, + unbonded_amount: null, + withdrawn_amount: null, + }); + + const { + unbond_batches: secondUnbondBatches, + next_page_key: secondNextPageKey, + } = await context.coreContractClient.queryUnbondBatches({ + limit: '1', + page_key: firstNextPageKey, + }); + + expect(secondUnbondBatches.length).toEqual(1); + expect(secondNextPageKey).toBeNull(); + + const [secondBatch] = secondUnbondBatches; + expect(firstBatch).toBeTruthy(); + expect(secondBatch).toEqual({ + slashing_effect: null, + status: 'new', + status_timestamps: expect.any(Object), + expected_release_time: 0, + total_dasset_amount_to_withdraw: '0', + expected_native_asset_amount: '0', + total_unbond_items: 0, + unbonded_amount: null, + withdrawn_amount: null, + }); + }); + it('wait for response from puppeteer', async () => { + let response; + await waitFor(async () => { + try { + response = ( + await context.coreContractClient.queryLastPuppeteerResponse() + ).response; + } catch (e) { + // + } + return !!response; + }, 100_000); + }); + it('next tick goes to idle', async () => { + const { + neutronUserAddress, + gaiaClient, + coreContractClient, + puppeteerContractClient, + } = context; + + await waitForPuppeteerICQ( + gaiaClient, + coreContractClient, + puppeteerContractClient, + ); + + const res = await context.coreContractClient.tick( + neutronUserAddress, + 1.5, + undefined, + [], + ); + expect(res.transactionHash).toHaveLength(64); + const state = await context.coreContractClient.queryContractState(); + expect(state).toEqual('idle'); + await checkExchangeRate(context); + }); + it('verify that unbonding batch is in unbonding state', async () => { + const batch = await context.coreContractClient.queryUnbondBatch({ + batch_id: '0', + }); + expect(batch).toBeTruthy(); + expect(batch).toEqual({ + slashing_effect: null, + status: 'unbonding', + status_timestamps: expect.any(Object), + expected_release_time: expect.any(Number), + total_dasset_amount_to_withdraw: '500000', + expected_native_asset_amount: '500000', + total_unbond_items: 2, + unbonded_amount: null, + withdrawn_amount: null, + }); + }); + }); + describe('second cycle', () => { + const balance = 0; + it('idle tick', async () => { + const { + neutronUserAddress, + gaiaClient, + coreContractClient, + puppeteerContractClient, + } = context; + + await waitForPuppeteerICQ( + gaiaClient, + coreContractClient, + puppeteerContractClient, + ); + + const res = await context.coreContractClient.tick( + neutronUserAddress, + 1.5, + undefined, + [], + ); + expect(res.transactionHash).toHaveLength(64); + const state = await context.coreContractClient.queryContractState(); + expect(state).toEqual('claiming'); + await checkExchangeRate(context); + }); + it('wait for response from puppeteer', async () => { + let response; + await waitFor(async () => { + try { + response = ( + await context.coreContractClient.queryLastPuppeteerResponse() + ).response; + } catch (e) { + // + } + return !!response; + }, 100_000); + }); + it('get rewards pump ICA balance', async () => { + const { gaiaClient } = context; + const res = await gaiaClient.getBalance( + context.rewardsPumpIcaAddress, + 'stake', + ); + const newBalance = parseInt(res.amount); + expect(newBalance).toBeGreaterThan(balance); + }); + it('wait for balance to update', async () => { + const { remote_height: currentHeight } = + (await context.puppeteerContractClient.queryExtension({ + msg: { + balances: {}, + }, + })) as any; + await waitFor(async () => { + const { remote_height: nowHeight } = + (await context.puppeteerContractClient.queryExtension({ + msg: { + balances: {}, + }, + })) as any; + return nowHeight !== currentHeight; + }, 30_000); + }); + it('next tick goes to idle', async () => { + const { + neutronUserAddress, + gaiaClient, + coreContractClient, + puppeteerContractClient, + } = context; + + await waitForPuppeteerICQ( + gaiaClient, + coreContractClient, + puppeteerContractClient, + ); + + const res = await context.coreContractClient.tick( + neutronUserAddress, + 1.5, + undefined, + [], + ); + expect(res.transactionHash).toHaveLength(64); + const state = await context.coreContractClient.queryContractState(); + expect(state).toEqual('idle'); + await checkExchangeRate(context); + }); + }); + describe('third cycle (LSM-shares)', () => { + let lsmDenoms: string[] = []; + let oldBalanceDenoms: string[] = []; + describe('prepare', () => { + describe('create LSM shares and send them to neutron', () => { + it('get balances', async () => { + const oldBalances = + await context.neutronClient.CosmosBankV1Beta1.query.queryAllBalances( + context.neutronUserAddress, + ); + oldBalanceDenoms = oldBalances.data.balances.map((b) => b.denom); + }); + it('update idle interval', async () => { + const { factoryContractClient, neutronUserAddress } = context; + const res = await factoryContractClient.updateConfig( + neutronUserAddress, + { + core: { + idle_min_interval: 10000, + }, + }, + ); + expect(res.transactionHash).toHaveLength(64); + }); + it('delegate', async () => { + { + const res = await context.park.executeInNetwork( + 'gaia', + `gaiad tx staking delegate ${context.validatorAddress} 100000stake --from ${context.gaiaUserAddress} --yes --chain-id testgaia --home=/opt --keyring-backend=test --output json`, + ); + expect(res.exitCode).toBe(0); + const out = JSON.parse(res.out); + expect(out.code).toBe(0); + expect(out.txhash).toHaveLength(64); + await waitForTx(context.gaiaClient, out.txhash); + } + { + const res = await context.park.executeInNetwork( + 'gaia', + `gaiad tx staking delegate ${context.secondValidatorAddress} 100000stake --from ${context.gaiaUserAddress} --yes --chain-id testgaia --home=/opt --keyring-backend=test --output json`, + ); + expect(res.exitCode).toBe(0); + const out = JSON.parse(res.out); + expect(out.code).toBe(0); + expect(out.txhash).toHaveLength(64); + await waitForTx(context.gaiaClient, out.txhash); + } + }); + it('tokenize shares', async () => { + { + const res = await context.park.executeInNetwork( + 'gaia', + `gaiad tx staking tokenize-share ${context.validatorAddress} 60000stake ${context.gaiaUserAddress} --from ${context.gaiaUserAddress} --yes --chain-id testgaia --home=/opt --keyring-backend=test --gas auto --gas-adjustment 2 --output json`, + ); + expect(res.exitCode).toBe(0); + const out = JSON.parse(res.out); + expect(out.code).toBe(0); + expect(out.txhash).toHaveLength(64); + await waitForTx(context.gaiaClient, out.txhash); + const balances = await context.gaiaQueryClient.bank.allBalances( + context.gaiaUserAddress, + ); + expect( + balances.find( + (a) => a.denom == `${context.validatorAddress}/2`, + ), + ).toEqual({ + denom: `${context.validatorAddress}/2`, + amount: '60000', + }); + } + { + const res = await context.park.executeInNetwork( + 'gaia', + `gaiad tx staking tokenize-share ${context.secondValidatorAddress} 60000stake ${context.gaiaUserAddress} --from ${context.gaiaUserAddress} --yes --chain-id testgaia --home=/opt --keyring-backend=test --gas auto --gas-adjustment 2 --output json`, + ); + expect(res.exitCode).toBe(0); + const out = JSON.parse(res.out); + expect(out.code).toBe(0); + expect(out.txhash).toHaveLength(64); + await waitForTx(context.gaiaClient, out.txhash); + const balances = await context.gaiaQueryClient.bank.allBalances( + context.gaiaUserAddress, + ); + expect( + balances.find( + (a) => a.denom == `${context.secondValidatorAddress}/3`, + ), + ).toEqual({ + denom: `${context.secondValidatorAddress}/3`, + amount: '60000', + }); + } + }); + it('transfer shares to neutron', async () => { + { + const res = await context.park.executeInNetwork( + 'gaia', + `gaiad tx ibc-transfer transfer transfer channel-0 ${context.neutronUserAddress} 60000${context.validatorAddress}/2 --from ${context.gaiaUserAddress} --yes --chain-id testgaia --home=/opt --keyring-backend=test --gas auto --gas-adjustment 2 --output json`, + ); + expect(res.exitCode).toBe(0); + const out = JSON.parse(res.out); + expect(out.code).toBe(0); + expect(out.txhash).toHaveLength(64); + await waitForTx(context.gaiaClient, out.txhash); + } + await sleep(10_000); + { + const res = await context.park.executeInNetwork( + 'gaia', + `gaiad tx ibc-transfer transfer transfer channel-0 ${context.neutronUserAddress} 60000${context.secondValidatorAddress}/3 --from ${context.gaiaUserAddress} --yes --chain-id testgaia --home=/opt --keyring-backend=test --gas auto --gas-adjustment 2 --output json`, + ); + expect(res.exitCode).toBe(0); + const out = JSON.parse(res.out); + expect(out.code).toBe(0); + expect(out.txhash).toHaveLength(64); + await waitForTx(context.gaiaClient, out.txhash); + } + }); + it('wait for balances to come', async () => { + await waitFor(async () => { + const newbalances = + await context.neutronClient.CosmosBankV1Beta1.query.queryAllBalances( + context.neutronUserAddress, + ); + const newDenoms = newbalances.data.balances.map((b) => b.denom); + const diff = newDenoms.filter( + (d) => !oldBalanceDenoms.includes(d), + ); + lsmDenoms = diff; + return diff.length === 2; + }, 500_000); + }); + }); + + it('bond LSM shares', async () => { + { + const { coreContractClient, neutronUserAddress } = context; + const res = await coreContractClient.bond( + neutronUserAddress, + {}, + 1.6, + undefined, + [ + { + amount: '60000', + denom: lsmDenoms[0], + }, + ], + ); + expect(res.transactionHash).toHaveLength(64); + await checkExchangeRate(context); + } + { + const { coreContractClient, neutronUserAddress } = context; + const res = await coreContractClient.bond( + neutronUserAddress, + {}, + 1.6, + undefined, + [ + { + amount: '60000', + denom: lsmDenoms[1], + }, + ], + ); + expect(res.transactionHash).toHaveLength(64); + await checkExchangeRate(context); + } + }); + it('verify pending lsm shares', async () => { + const pending = + await context.coreContractClient.queryPendingLSMShares(); + expect(pending).toHaveLength(2); + }); + }); + describe('transfering', () => { + it('tick', async () => { + const { + neutronUserAddress, + gaiaClient, + coreContractClient, + puppeteerContractClient, + } = context; + + await waitForPuppeteerICQ( + gaiaClient, + coreContractClient, + puppeteerContractClient, + ); + + const res = await context.coreContractClient.tick( + neutronUserAddress, + 1.5, + undefined, + [], + ); + expect(res.transactionHash).toHaveLength(64); + const state = await context.coreContractClient.queryContractState(); + expect(state).toEqual('l_s_m_transfer'); + await checkExchangeRate(context); + }); + it('wait for the response from puppeteer', async () => { + let response: ResponseHookMsg; + await waitFor(async () => { + try { + response = ( + await context.coreContractClient.queryLastPuppeteerResponse() + ).response; + } catch (e) { + // + } + return !!response; + }, 100_000); + expect(response).toBeTruthy(); + expect(response).toHaveProperty('success'); + }); + it('wait for ICQ update', async () => { + await waitForPuppeteerICQ( + context.gaiaClient, + context.coreContractClient, + context.puppeteerContractClient, + ); + }); + it('one lsm share is gone from the contract balance', async () => { + const balances = + await context.neutronClient.CosmosBankV1Beta1.query.queryAllBalances( + context.coreContractClient.contractAddress, + ); + expect( + balances.data.balances.find((one) => one.denom === lsmDenoms[0]), + ).toBeFalsy(); + }); + it('await for pending length decrease', async () => { + let pending: any; + await waitFor(async () => { + try { + const res = + await context.coreContractClient.queryPendingLSMShares(); + pending = res; + } catch (e) { + // + } + return !!pending && pending.length === 1; + }, 60_000); + }); + it('tick to idle', async () => { + const { neutronUserAddress } = context; + const res = await context.coreContractClient.tick( + neutronUserAddress, + 1.5, + undefined, + [], + ); + expect(res.transactionHash).toHaveLength(64); + const state = await context.coreContractClient.queryContractState(); + expect(state).toEqual('idle'); + await checkExchangeRate(context); + }); + it('tick to lsm transfer', async () => { + const { neutronUserAddress } = context; + const res = await context.coreContractClient.tick( + neutronUserAddress, + 1.5, + undefined, + [], + ); + expect(res.transactionHash).toHaveLength(64); + const state = await context.coreContractClient.queryContractState(); + expect(state).toEqual('l_s_m_transfer'); + await checkExchangeRate(context); + }); + it('wait for the response from puppeteer', async () => { + let response: ResponseHookMsg; + await waitFor(async () => { + try { + response = ( + await context.coreContractClient.queryLastPuppeteerResponse() + ).response; + } catch (e) { + // + } + return !!response; + }, 100_000); + expect(response).toBeTruthy(); + expect(response).toHaveProperty('success'); + }); + it('wait for ICQ update', async () => { + await waitForPuppeteerICQ( + context.gaiaClient, + context.coreContractClient, + context.puppeteerContractClient, + ); + }); + it('second lsm share is gone from the contract balance', async () => { + const balances = + await context.neutronClient.CosmosBankV1Beta1.query.queryAllBalances( + context.coreContractClient.contractAddress, + ); + expect( + balances.data.balances.find((one) => one.denom === lsmDenoms[1]), + ).toBeFalsy(); + }); + it('await for pending length decrease', async () => { + let pending: any; + await waitFor(async () => { + try { + const res = + await context.coreContractClient.queryPendingLSMShares(); + pending = res; + } catch (e) { + // + } + return !!pending && pending.length === 0; + }, 60_000); + expect(pending).toEqual([]); + }); + }); + describe('redeem', () => { + let delegationsSum = 0; + it('query delegations', async () => { + const res: any = await context.puppeteerContractClient.queryExtension( + { + msg: { + delegations: {}, + }, + }, + ); + for (const d of res.delegations.delegations) { + delegationsSum += parseInt(d.amount.amount); + } + }); + it('verify pending lsm shares to unbond', async () => { + const pending = + await context.coreContractClient.queryLSMSharesToRedeem(); + expect(pending).toHaveLength(2); + }); + it('tick to idle', async () => { + const { + gaiaClient, + neutronUserAddress, + coreContractClient, + puppeteerContractClient, + } = context; + await waitForPuppeteerICQ( + gaiaClient, + coreContractClient, + puppeteerContractClient, + ); + const res = await context.coreContractClient.tick( + neutronUserAddress, + 1.5, + undefined, + [], + ); + expect(res.transactionHash).toHaveLength(64); + const state = await context.coreContractClient.queryContractState(); + expect(state).toEqual('idle'); + await checkExchangeRate(context); + }); + it('tick to redeem', async () => { + const { neutronUserAddress } = context; + const res = await context.coreContractClient.tick( + neutronUserAddress, + 1.5, + undefined, + [], + ); + expect(res.transactionHash).toHaveLength(64); + const state = await context.coreContractClient.queryContractState(); + expect(state).toEqual('l_s_m_redeem'); + await checkExchangeRate(context); + }); + it('imeediately tick again fails', async () => { + const { neutronUserAddress } = context; + await expect( + context.coreContractClient.tick( + neutronUserAddress, + 1.5, + undefined, + [], + ), + ).rejects.toThrowError(/Puppeteer response is not received/); + }); + it('await for pending length decrease', async () => { + await waitFor(async () => { + const pending = + await context.coreContractClient.queryLSMSharesToRedeem(); + return pending.length === 0; + }, 30_000); + }); + it('wait for delegations to come', async () => { + const { remote_height: currentHeight } = + await context.puppeteerContractClient.queryExtension({ + msg: { + delegations: {}, + }, + }); + await waitFor(async () => { + const { remote_height: nowHeight } = + await context.puppeteerContractClient.queryExtension({ + msg: { + delegations: {}, + }, + }); + return nowHeight !== currentHeight; + }); + }); + it('query delegations', async () => { + const res: any = await context.puppeteerContractClient.queryExtension( + { + msg: { + delegations: {}, + }, + }, + ); + let newDelegationsSum = 0; + for (const d of res.delegations.delegations) { + newDelegationsSum += parseInt(d.amount.amount); + } + expect(newDelegationsSum - delegationsSum).toEqual(120_000); + }); + it('verify exchange rate', async () => { + const newExchangeRate = + await context.coreContractClient.queryExchangeRate(); + expect(parseFloat(newExchangeRate)).toEqual(1); + await checkExchangeRate(context); + }); + }); + }); + + describe('forth cycle', () => { + it('validate NFT', async () => { + const { withdrawalVoucherContractClient, neutronUserAddress } = context; + const vouchers = await withdrawalVoucherContractClient.queryTokens({ + owner: context.neutronUserAddress, + }); + expect(vouchers.tokens.length).toBe(2); + expect(vouchers.tokens[0]).toBe(`0_${neutronUserAddress}_1`); + let tokenId = vouchers.tokens[0]; + let voucher = await withdrawalVoucherContractClient.queryNftInfo({ + token_id: tokenId, + }); + expect(voucher).toBeTruthy(); + expect(voucher).toMatchObject({ + extension: { + amount: '200000', + attributes: [ + { + display_type: null, + trait_type: 'unbond_batch_id', + value: '0', + }, + { + display_type: null, + trait_type: 'received_amount', + value: '200000', + }, + ], + batch_id: '0', + description: 'Withdrawal voucher', + name: 'LDV voucher', + }, + token_uri: null, + }); + expect(vouchers.tokens[1]).toBe(`0_${neutronUserAddress}_2`); + tokenId = vouchers.tokens[1]; + voucher = await withdrawalVoucherContractClient.queryNftInfo({ + token_id: tokenId, + }); + expect(voucher).toBeTruthy(); + expect(voucher).toMatchObject({ + extension: { + amount: '300000', + attributes: [ + { + display_type: null, + trait_type: 'unbond_batch_id', + value: '0', + }, + { + display_type: null, + trait_type: 'received_amount', + value: '300000', + }, + ], + batch_id: '0', + description: 'Withdrawal voucher', + name: 'LDV voucher', + }, + token_uri: null, + }); + }); + it('bond tokenized share from registered validator', async () => { + const { coreContractClient, neutronUserAddress } = context; + const res = await coreContractClient.bond( + neutronUserAddress, + {}, + 1.6, + undefined, + [ + { + amount: '20000', + denom: context.tokenizedDenomOnNeutron, + }, + ], + ); + expect(res.transactionHash).toHaveLength(64); + await checkExchangeRate(context); + }); + it('try to withdraw from paused manager', async () => { + const { + withdrawalVoucherContractClient, + neutronUserAddress, + factoryContractClient: contractClient, + account, + } = context; + + await contractClient.pause(account.address); + + const tokenId = `0_${neutronUserAddress}_1`; + await expect( + withdrawalVoucherContractClient.sendNft(neutronUserAddress, { + token_id: tokenId, + contract: context.withdrawalManagerContractClient.contractAddress, + msg: Buffer.from( + JSON.stringify({ + withdraw: {}, + }), + ).toString('base64'), + }), + ).rejects.toThrowError(/Contract execution is paused/); + + await contractClient.unpause(account.address); + }); + it('try to withdraw before withdrawn', async () => { + const { withdrawalVoucherContractClient, neutronUserAddress } = context; + const tokenId = `0_${neutronUserAddress}_1`; + await expect( + withdrawalVoucherContractClient.sendNft(neutronUserAddress, { + token_id: tokenId, + contract: context.withdrawalManagerContractClient.contractAddress, + msg: Buffer.from( + JSON.stringify({ + withdraw: {}, + }), + ).toString('base64'), + }), + ).rejects.toThrowError(/is not withdrawn yet/); + }); + it('update idle interval', async () => { + const { factoryContractClient, neutronUserAddress } = context; + const res = await factoryContractClient.updateConfig( + neutronUserAddress, + { + core: { + idle_min_interval: 10, + }, + }, + ); + expect(res.transactionHash).toHaveLength(64); + await sleep(10 * 1000); + }); + it('wait until unbonding period is finished', async () => { + const batchInfo = await context.coreContractClient.queryUnbondBatch({ + batch_id: '0', + }); + const currentTime = Math.floor(Date.now() / 1000); + if (batchInfo.expected_release_time > currentTime) { + const diffMs = + (batchInfo.expected_release_time - currentTime + 1) * 1000; + await sleep(diffMs); + } + }); + it('wait until fresh ICA balance is delivered', async () => { + const batchInfo = await context.coreContractClient.queryUnbondBatch({ + batch_id: '0', + }); + await waitFor(async () => { + const icaTs = Math.floor( + ( + (await context.puppeteerContractClient.queryExtension({ + msg: { + balances: {}, + }, + })) as any + ).timestamp / 1e9, + ); + return icaTs > batchInfo.expected_release_time; + }, 50_000); + }); + it('tick to idle', async () => { + const { coreContractClient, neutronUserAddress } = context; + await coreContractClient.tick(neutronUserAddress, 1.5, undefined, []); + const state = await context.coreContractClient.queryContractState(); + expect(state).toEqual('idle'); + await checkExchangeRate(context); + }); + it('tick to claiming', async () => { + const { + coreContractClient, + neutronUserAddress, + puppeteerContractClient, + } = context; + await waitForPuppeteerICQ( + context.gaiaClient, + coreContractClient, + puppeteerContractClient, + ); + await coreContractClient.tick(neutronUserAddress, 1.5, undefined, []); + const state = await context.coreContractClient.queryContractState(); + expect(state).toEqual('claiming'); + await checkExchangeRate(context); + }); + it('wait for the response from puppeteer', async () => { + let response: ResponseHookMsg; + await waitFor(async () => { + try { + response = ( + await context.coreContractClient.queryLastPuppeteerResponse() + ).response; + } catch (e) { + return false; + } + if (!response || !('success' in response)) return false; + return true; + }, 30_000); + }); + it('wait for balance to update', async () => { + const { remote_height: currentHeight } = + (await context.puppeteerContractClient.queryExtension({ + msg: { + balances: {}, + }, + })) as any; + await waitFor(async () => { + const { remote_height: nowHeight } = + (await context.puppeteerContractClient.queryExtension({ + msg: { + balances: {}, + }, + })) as any; + return nowHeight !== currentHeight; + }, 30_000); + }); + it('tick to idle', async () => { + const { + gaiaClient, + coreContractClient, + neutronUserAddress, + puppeteerContractClient, + } = context; + + await waitForPuppeteerICQ( + gaiaClient, + coreContractClient, + puppeteerContractClient, + ); + + await coreContractClient.tick(neutronUserAddress, 1.5, undefined, []); + const state = await context.coreContractClient.queryContractState(); + expect(state).toEqual('idle'); + }); + it('validate rewards pump ICA balance', async () => { + const { gaiaClient, rewardsPumpIcaAddress } = context; + const res = await gaiaClient.getBalance(rewardsPumpIcaAddress, 'stake'); + const newBalance = parseInt(res.amount); + expect(newBalance).toBeGreaterThan(0); + await checkExchangeRate(context); + }); + it('validate unbonding batch', async () => { + const batch = await context.coreContractClient.queryUnbondBatch({ + batch_id: '0', + }); + expect(batch).toEqual({ + slashing_effect: '1', + status: 'withdrawn', + status_timestamps: expect.any(Object), + expected_release_time: expect.any(Number), + total_dasset_amount_to_withdraw: '500000', + expected_native_asset_amount: '500000', + total_unbond_items: 2, + unbonded_amount: '500000', + withdrawn_amount: null, + }); + }); + it('withdraw with non funded withdrawal manager', async () => { + const { + withdrawalVoucherContractClient: voucherContractClient, + neutronUserAddress, + } = context; + const tokenId = `0_${neutronUserAddress}_1`; + await expect( + voucherContractClient.sendNft(neutronUserAddress, { + token_id: tokenId, + contract: context.withdrawalManagerContractClient.contractAddress, + msg: Buffer.from( + JSON.stringify({ + withdraw: {}, + }), + ).toString('base64'), + }), + ).rejects.toThrowError(/spendable balance [\w/]+ is smaller than/); + }); + it('fund withdrawal manager', async () => { + const { pumpContractClient, neutronUserAddress } = context; + await pumpContractClient.push( + neutronUserAddress, + { + coins: [{ amount: '500000', denom: 'stake' }], + }, + 1.5, + undefined, + [{ amount: '20000', denom: 'untrn' }], + ); + await waitFor(async () => { + const balances = + await context.neutronClient.CosmosBankV1Beta1.query.queryAllBalances( + context.withdrawalManagerContractClient.contractAddress, + ); + return balances.data.balances.length > 0; + }, 40_000); + await checkExchangeRate(context); + }); + it('withdraw', async () => { + const { + withdrawalVoucherContractClient: voucherContractClient, + neutronUserAddress, + neutronClient, + neutronIBCDenom, + } = context; + const balanceBefore = parseInt( + ( + await neutronClient.CosmosBankV1Beta1.query.queryBalance( + neutronUserAddress, + { denom: neutronIBCDenom }, + ) + ).data.balance.amount, + ); + const tokenId = `0_${neutronUserAddress}_1`; + const res = await voucherContractClient.sendNft(neutronUserAddress, { + token_id: tokenId, + contract: context.withdrawalManagerContractClient.contractAddress, + msg: Buffer.from( + JSON.stringify({ + withdraw: {}, + }), + ).toString('base64'), + }); + expect(res.transactionHash).toHaveLength(64); + const balance = + await neutronClient.CosmosBankV1Beta1.query.queryBalance( + neutronUserAddress, + { denom: neutronIBCDenom }, + ); + expect(parseInt(balance.data.balance.amount) - balanceBefore).toBe( + 200000, + ); + await checkExchangeRate(context); + }); + it('withdraw to custom receiver', async () => { + const { + withdrawalVoucherContractClient: voucherContractClient, + neutronUserAddress, + neutronSecondUserAddress, + neutronClient, + neutronIBCDenom, + } = context; + const balanceBefore = parseInt( + ( + await neutronClient.CosmosBankV1Beta1.query.queryBalance( + neutronSecondUserAddress, + { denom: neutronIBCDenom }, + ) + ).data.balance.amount, + ); + expect(balanceBefore).toEqual(0); + const tokenId = `0_${neutronUserAddress}_2`; + const res = await voucherContractClient.sendNft(neutronUserAddress, { + token_id: tokenId, + contract: context.withdrawalManagerContractClient.contractAddress, + msg: Buffer.from( + JSON.stringify({ + withdraw: { + receiver: neutronSecondUserAddress, + }, + }), + ).toString('base64'), + }); + expect(res.transactionHash).toHaveLength(64); + const balance = + await neutronClient.CosmosBankV1Beta1.query.queryBalance( + neutronSecondUserAddress, + { denom: neutronIBCDenom }, + ); + expect(parseInt(balance.data.balance.amount)).toBe(300000); + }); + }); + + describe('fifth cycle (unbond before delegation)', () => { + it('tick to claiming', async () => { + const { + coreContractClient, + neutronUserAddress, + puppeteerContractClient, + } = context; + await waitForPuppeteerICQ( + context.gaiaClient, + coreContractClient, + puppeteerContractClient, + ); + await coreContractClient.tick(neutronUserAddress, 1.5, undefined, []); + const state = await context.coreContractClient.queryContractState(); + expect(state).toEqual('claiming'); + await checkExchangeRate(context); + }); + it('wait for the response from puppeteer', async () => { + let response: ResponseHookMsg; + await waitFor(async () => { + try { + response = ( + await context.coreContractClient.queryLastPuppeteerResponse() + ).response; + } catch (e) { + return false; + } + if (!response || !('success' in response)) return false; + return true; + }, 30_000); + }); + it('tick to idle', async () => { + const { + gaiaClient, + coreContractClient, + neutronUserAddress, + puppeteerContractClient, + } = context; + + await waitForPuppeteerICQ( + gaiaClient, + coreContractClient, + puppeteerContractClient, + ); + + await coreContractClient.tick(neutronUserAddress, 1.5, undefined, []); + const state = await context.coreContractClient.queryContractState(); + expect(state).toEqual('idle'); + await checkExchangeRate(context); + }); + it('bond and unbond ibc coins', async () => { + const { + coreContractClient, + ldDenom, + neutronUserAddress, + neutronIBCDenom, + } = context; + let res = await coreContractClient.bond( + neutronUserAddress, + {}, + 1.6, + undefined, + [ + { + amount: '1000000', + denom: neutronIBCDenom, + }, + ], + ); + + expect(res.transactionHash).toHaveLength(64); + + await awaitBlocks(`http://127.0.0.1:${context.park.ports.gaia.rpc}`, 1); + + res = await context.stakerContractClient.iBCTransfer( + neutronUserAddress, + 1.5, + undefined, + [{ amount: '20000', denom: 'untrn' }], + ); + + expect(res.transactionHash).toHaveLength(64); + + await awaitBlocks(`http://127.0.0.1:${context.park.ports.gaia.rpc}`, 1); + + res = await coreContractClient.unbond( + neutronUserAddress, + 1.6, + undefined, + [ + { + amount: '1000000', + denom: ldDenom, + }, + ], + ); + + expect(res.transactionHash).toHaveLength(64); + await checkExchangeRate(context); + }); + }); + describe('sixth stake rewards', () => { + let rewardsPumpIcaBalance = 0; + it('pump rewards', async () => { + const { rewardsPumpContractClient, neutronUserAddress, gaiaClient } = + context; + rewardsPumpIcaBalance = parseInt( + (await gaiaClient.getBalance(context.rewardsPumpIcaAddress, 'stake')) + .amount, + 10, + ); + await rewardsPumpContractClient.push( + neutronUserAddress, + { + coins: [ + { amount: rewardsPumpIcaBalance.toString(), denom: 'stake' }, + ], + }, + 1.5, + undefined, + [{ amount: '20000', denom: 'untrn' }], + ); + await waitFor(async () => { + const balances = + await context.neutronClient.CosmosBankV1Beta1.query.queryAllBalances( + context.splitterContractClient.contractAddress, + ); + return balances.data.balances.length > 0; + }, 60_000); + }); + it('top up splitter', async () => { + const res = await context.client.sendTokens( + context.neutronUserAddress, + context.splitterContractClient.contractAddress, + [ + { + amount: (10000 - rewardsPumpIcaBalance).toString(), + denom: context.neutronIBCDenom, + }, + ], + 1.5, + ); + expect(res.transactionHash).toHaveLength(64); + }); + it('split it', async () => { + const res = await context.splitterContractClient.distribute( + context.neutronUserAddress, + 1.5, + undefined, + ); + expect(res.transactionHash).toHaveLength(64); + const stakerBalance = ( + await context.neutronClient.CosmosBankV1Beta1.query.queryBalance( + context.stakerContractClient.contractAddress, + { denom: context.neutronIBCDenom }, + ) + ).data.balance.amount; + expect(parseInt(stakerBalance, 10)).toEqual(10000); + }); + it('staker ibc transfer', async () => { + const { neutronUserAddress } = context; + const res = await context.stakerContractClient.iBCTransfer( + neutronUserAddress, + 1.5, + undefined, + [{ amount: '20000', denom: 'untrn' }], + ); + expect(res.transactionHash).toHaveLength(64); + await waitFor(async () => { + const res = await context.stakerContractClient.queryTxState(); + return res.status === 'idle'; + }, 80_000); + const balances = await context.gaiaClient.getAllBalances( + context.stakerIcaAddress, + ); + expect(balances).toEqual([ + { + amount: '1010000', + denom: context.park.config.networks.gaia.denom, + }, + ]); + }); + }); + }); +}); diff --git a/integration_tests/src/tests.yml b/integration_tests/src/tests.yml index 3c118568..60539d05 100644 --- a/integration_tests/src/tests.yml +++ b/integration_tests/src/tests.yml @@ -34,7 +34,7 @@ jobs: run: sudo apt-get update && sudo apt-get install -y pkg-config libssl-dev - uses: actions-rs/toolchain@v1 with: - toolchain: nightly + toolchain: nightly-2023-12-21 profile: minimal override: true - name: Install cargo-tarpaulin diff --git a/integration_tests/yarn.lock b/integration_tests/yarn.lock index 99681715..30a4a83b 100644 --- a/integration_tests/yarn.lock +++ b/integration_tests/yarn.lock @@ -580,10 +580,10 @@ events "^3.3.0" protobufjs "^7.2.0" -"@neutron-org/contracts2ts@1.4.6": - version "1.4.6" - resolved "https://registry.yarnpkg.com/@neutron-org/contracts2ts/-/contracts2ts-1.4.6.tgz#81b3c8ac675d9ce50ab51da4dfd2a27376b99d3e" - integrity sha512-se2DswFcGoXB2iTK14BJ5FxHSqOPxZRiJZyG7UT8QtIVNeBMogFeUub29zoJUBYpRtoxgQO8OOHF5vBS4hWM/g== +"@neutron-org/contracts2ts@1.5.2": + version "1.5.2" + resolved "https://registry.yarnpkg.com/@neutron-org/contracts2ts/-/contracts2ts-1.5.2.tgz#ff323a6238904b4fec60cc6c2b45da646f5da620" + integrity sha512-JkxOqV1TAyJKBhmmInncex3FDSRF9Z9Y+E9u87YmrQVUr4OHZdO3oclaGAtglB1IQSqe2RfZp3iHnT7JrIM8jQ== dependencies: "@apidevtools/json-schema-ref-parser" "^11.5.4" "@cosmjs/cosmwasm-stargate" "^0.32.4" @@ -600,15 +600,15 @@ lodash "^4.17.21" node-recursive-directory "^1.2.0" -"@neutron-org/cosmopark@^1.7.3": - version "1.7.3" - resolved "https://registry.yarnpkg.com/@neutron-org/cosmopark/-/cosmopark-1.7.3.tgz#0bf2da78100bb690ffc537b9048cbeab16eedd2b" - integrity sha512-V/EDCw6FB30+l0PFkO4JhD3fk6tskgxTkOy30k8X51wuYrVQx3MEGxG71Vwq424GNU6R6AGQgMIbMTAg+SOzDA== +"@neutron-org/cosmopark@1.7.14": + version "1.7.14" + resolved "https://registry.yarnpkg.com/@neutron-org/cosmopark/-/cosmopark-1.7.14.tgz#75eec7d140a2346e6e792454c21e365a83ae7f83" + integrity sha512-pOn8TvH2VbwJ1JnylE2/aPJnHI2wWjTBPVvR+oK7upQsuot7jr3lZ1EkpSKRTnOK9fVbqck7GCt8bnP8tnU32A== dependencies: "@iarna/toml" "^2.2.5" commander "^11.0.0" docker-cli-js "^2.10.0" - docker-compose "^0.24.2" + docker-compose "1.1.0" lodash "^4.17.21" pino "^8.17.2" rimraf "^5.0.7" @@ -1549,10 +1549,10 @@ docker-cli-js@^2.10.0: lodash.snakecase "^4.1.1" nodeify-ts "1.0.6" -docker-compose@^0.24.2: - version "0.24.8" - resolved "https://registry.yarnpkg.com/docker-compose/-/docker-compose-0.24.8.tgz#6c125e6b9e04cf68ced47e2596ef2bb93ee9694e" - integrity sha512-plizRs/Vf15H+GCVxq2EUvyPK7ei9b/cVesHvjnX4xaXjM9spHe2Ytq0BitndFgvTJ3E3NljPNUEl7BAN43iZw== +docker-compose@1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/docker-compose/-/docker-compose-1.1.0.tgz#ccc21b280430357e51e192e29dc7b4cef81f3784" + integrity sha512-VrkQJNafPQ5d6bGULW0P6KqcxSkv3ZU5Wn2wQA19oB71o7+55vQ9ogFe2MMeNbK+jc9rrKVy280DnHO5JLMWOQ== dependencies: yaml "^2.2.2" @@ -1582,7 +1582,7 @@ dotparser@^1.1.1: "@cosmjs/cosmwasm-stargate" "^0.32.4" "@cosmjs/proto-signing" "^0.32.4" "@neutron-org/client-ts" "^1.4.0" - "@neutron-org/contracts2ts" "1.4.6" + "@neutron-org/contracts2ts" "1.5.2" eastasianwidth@^0.2.0: version "0.2.0" @@ -3223,7 +3223,16 @@ std-env@^3.3.3: resolved "https://registry.yarnpkg.com/std-env/-/std-env-3.7.0.tgz#c9f7386ced6ecf13360b6c6c55b8aaa4ef7481d2" integrity sha512-JPbdCEQLj1w5GilpiHAx3qJvFndqybBysA3qUOnznweH4QbNYUsW/ea8QzSrnh0vNsezMMw5bcVool8lM0gwzg== -"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0: +"string-width-cjs@npm:string-width@^4.2.0": + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + +string-width@^4.1.0: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -3248,7 +3257,14 @@ string_decoder@^1.1.1, string_decoder@^1.3.0: dependencies: safe-buffer "~5.2.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1": + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + +strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== diff --git a/ts-client/lib/contractLib/dropAstroportExchangeHandler.d.ts b/ts-client/lib/contractLib/dropAstroportExchangeHandler.d.ts index 8710be8e..33079ba7 100644 --- a/ts-client/lib/contractLib/dropAstroportExchangeHandler.d.ts +++ b/ts-client/lib/contractLib/dropAstroportExchangeHandler.d.ts @@ -174,12 +174,24 @@ export declare class Client { contractAddress: string; constructor(client: CosmWasmClient | SigningCosmWasmClient, contractAddress: string); mustBeSigningClient(): Error; - static instantiate(client: SigningCosmWasmClient, sender: string, codeId: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[]): Promise; - static instantiate2(client: SigningCosmWasmClient, sender: string, codeId: number, salt: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[]): Promise; + static instantiate(client: SigningCosmWasmClient, sender: string, codeId: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], admin?: string): Promise; + static instantiate2(client: SigningCosmWasmClient, sender: string, codeId: number, salt: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], admin?: string): Promise; queryConfig: () => Promise; queryOwnership: () => Promise; updateConfig: (sender: string, args: UpdateConfigArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + updateConfigMsg: (args: UpdateConfigArgs) => { + update_config: UpdateConfigArgs; + }; updateSwapOperations: (sender: string, args: UpdateSwapOperationsArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + updateSwapOperationsMsg: (args: UpdateSwapOperationsArgs) => { + update_swap_operations: UpdateSwapOperationsArgs; + }; exchange: (sender: string, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + exchangeMsg: () => { + exchange: {}; + }; updateOwnership: (sender: string, args: UpdateOwnershipArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + updateOwnershipMsg: (args: UpdateOwnershipArgs) => { + update_ownership: UpdateOwnershipArgs; + }; } diff --git a/ts-client/lib/contractLib/dropAstroportExchangeHandler.js b/ts-client/lib/contractLib/dropAstroportExchangeHandler.js index ec0a8f42..803d1bc1 100644 --- a/ts-client/lib/contractLib/dropAstroportExchangeHandler.js +++ b/ts-client/lib/contractLib/dropAstroportExchangeHandler.js @@ -14,15 +14,15 @@ class Client { mustBeSigningClient() { return new Error("This client is not a SigningCosmWasmClient"); } - static async instantiate(client, sender, codeId, initMsg, label, fees, initCoins) { + static async instantiate(client, sender, codeId, initMsg, label, fees, initCoins, admin) { const res = await client.instantiate(sender, codeId, initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } - static async instantiate2(client, sender, codeId, salt, initMsg, label, fees, initCoins) { + static async instantiate2(client, sender, codeId, salt, initMsg, label, fees, initCoins, admin) { const res = await client.instantiate2(sender, codeId, new Uint8Array([salt]), initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } @@ -36,25 +36,29 @@ class Client { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_config: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateConfigMsg(args), fee || "auto", memo, funds); }; + updateConfigMsg = (args) => { return { update_config: args }; }; updateSwapOperations = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_swap_operations: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateSwapOperationsMsg(args), fee || "auto", memo, funds); }; + updateSwapOperationsMsg = (args) => { return { update_swap_operations: args }; }; exchange = async (sender, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { exchange: {} }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.exchangeMsg(), fee || "auto", memo, funds); }; + exchangeMsg = () => { return { exchange: {} }; }; updateOwnership = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_ownership: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateOwnershipMsg(args), fee || "auto", memo, funds); }; + updateOwnershipMsg = (args) => { return { update_ownership: args }; }; } exports.Client = Client; diff --git a/ts-client/lib/contractLib/dropAutoWithdrawer.d.ts b/ts-client/lib/contractLib/dropAutoWithdrawer.d.ts index 866a36b3..07e95de0 100644 --- a/ts-client/lib/contractLib/dropAutoWithdrawer.d.ts +++ b/ts-client/lib/contractLib/dropAutoWithdrawer.d.ts @@ -91,11 +91,20 @@ export declare class Client { contractAddress: string; constructor(client: CosmWasmClient | SigningCosmWasmClient, contractAddress: string); mustBeSigningClient(): Error; - static instantiate(client: SigningCosmWasmClient, sender: string, codeId: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[]): Promise; - static instantiate2(client: SigningCosmWasmClient, sender: string, codeId: number, salt: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[]): Promise; + static instantiate(client: SigningCosmWasmClient, sender: string, codeId: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], admin?: string): Promise; + static instantiate2(client: SigningCosmWasmClient, sender: string, codeId: number, salt: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], admin?: string): Promise; queryBondings: (args: BondingsArgs) => Promise; queryConfig: () => Promise; bond: (sender: string, args: BondArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + bondMsg: (args: BondArgs) => { + bond: BondArgs; + }; unbond: (sender: string, args: UnbondArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + unbondMsg: (args: UnbondArgs) => { + unbond: UnbondArgs; + }; withdraw: (sender: string, args: WithdrawArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + withdrawMsg: (args: WithdrawArgs) => { + withdraw: WithdrawArgs; + }; } diff --git a/ts-client/lib/contractLib/dropAutoWithdrawer.js b/ts-client/lib/contractLib/dropAutoWithdrawer.js index b171a937..6fc8be53 100644 --- a/ts-client/lib/contractLib/dropAutoWithdrawer.js +++ b/ts-client/lib/contractLib/dropAutoWithdrawer.js @@ -14,15 +14,15 @@ class Client { mustBeSigningClient() { return new Error("This client is not a SigningCosmWasmClient"); } - static async instantiate(client, sender, codeId, initMsg, label, fees, initCoins) { + static async instantiate(client, sender, codeId, initMsg, label, fees, initCoins, admin) { const res = await client.instantiate(sender, codeId, initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } - static async instantiate2(client, sender, codeId, salt, initMsg, label, fees, initCoins) { + static async instantiate2(client, sender, codeId, salt, initMsg, label, fees, initCoins, admin) { const res = await client.instantiate2(sender, codeId, new Uint8Array([salt]), initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } @@ -36,19 +36,22 @@ class Client { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { bond: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.bondMsg(args), fee || "auto", memo, funds); }; + bondMsg = (args) => { return { bond: args }; }; unbond = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { unbond: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.unbondMsg(args), fee || "auto", memo, funds); }; + unbondMsg = (args) => { return { unbond: args }; }; withdraw = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { withdraw: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.withdrawMsg(args), fee || "auto", memo, funds); }; + withdrawMsg = (args) => { return { withdraw: args }; }; } exports.Client = Client; diff --git a/ts-client/lib/contractLib/dropCore.d.ts b/ts-client/lib/contractLib/dropCore.d.ts index be6a2e87..07c3e340 100644 --- a/ts-client/lib/contractLib/dropCore.d.ts +++ b/ts-client/lib/contractLib/dropCore.d.ts @@ -482,8 +482,8 @@ export declare class Client { contractAddress: string; constructor(client: CosmWasmClient | SigningCosmWasmClient, contractAddress: string); mustBeSigningClient(): Error; - static instantiate(client: SigningCosmWasmClient, sender: string, codeId: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[]): Promise; - static instantiate2(client: SigningCosmWasmClient, sender: string, codeId: number, salt: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[]): Promise; + static instantiate(client: SigningCosmWasmClient, sender: string, codeId: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], admin?: string): Promise; + static instantiate2(client: SigningCosmWasmClient, sender: string, codeId: number, salt: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], admin?: string): Promise; queryConfig: () => Promise; queryOwner: () => Promise; queryExchangeRate: () => Promise; @@ -500,15 +500,51 @@ export declare class Client { queryFailedBatch: () => Promise; queryPauseInfo: () => Promise; bond: (sender: string, args: BondArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + bondMsg: (args: BondArgs) => { + bond: BondArgs; + }; unbond: (sender: string, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + unbondMsg: () => { + unbond: {}; + }; updateConfig: (sender: string, args: UpdateConfigArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + updateConfigMsg: (args: UpdateConfigArgs) => { + update_config: UpdateConfigArgs; + }; updateWithdrawnAmount: (sender: string, args: UpdateWithdrawnAmountArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + updateWithdrawnAmountMsg: (args: UpdateWithdrawnAmountArgs) => { + update_withdrawn_amount: UpdateWithdrawnAmountArgs; + }; tick: (sender: string, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + tickMsg: () => { + tick: {}; + }; puppeteerHook: (sender: string, args: PuppeteerHookArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + puppeteerHookMsg: (args: PuppeteerHookArgs) => { + puppeteer_hook: PuppeteerHookArgs; + }; stakerHook: (sender: string, args: StakerHookArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + stakerHookMsg: (args: StakerHookArgs) => { + staker_hook: StakerHookArgs; + }; resetBondedAmount: (sender: string, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + resetBondedAmountMsg: () => { + reset_bonded_amount: {}; + }; processEmergencyBatch: (sender: string, args: ProcessEmergencyBatchArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + processEmergencyBatchMsg: (args: ProcessEmergencyBatchArgs) => { + process_emergency_batch: ProcessEmergencyBatchArgs; + }; pause: (sender: string, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + pauseMsg: () => { + pause: {}; + }; unpause: (sender: string, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + unpauseMsg: () => { + unpause: {}; + }; updateOwnership: (sender: string, args: UpdateOwnershipArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + updateOwnershipMsg: (args: UpdateOwnershipArgs) => { + update_ownership: UpdateOwnershipArgs; + }; } diff --git a/ts-client/lib/contractLib/dropCore.js b/ts-client/lib/contractLib/dropCore.js index a4ebc942..848a6f1a 100644 --- a/ts-client/lib/contractLib/dropCore.js +++ b/ts-client/lib/contractLib/dropCore.js @@ -14,15 +14,15 @@ class Client { mustBeSigningClient() { return new Error("This client is not a SigningCosmWasmClient"); } - static async instantiate(client, sender, codeId, initMsg, label, fees, initCoins) { + static async instantiate(client, sender, codeId, initMsg, label, fees, initCoins, admin) { const res = await client.instantiate(sender, codeId, initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } - static async instantiate2(client, sender, codeId, salt, initMsg, label, fees, initCoins) { + static async instantiate2(client, sender, codeId, salt, initMsg, label, fees, initCoins, admin) { const res = await client.instantiate2(sender, codeId, new Uint8Array([salt]), initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } @@ -75,73 +75,85 @@ class Client { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { bond: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.bondMsg(args), fee || "auto", memo, funds); }; + bondMsg = (args) => { return { bond: args }; }; unbond = async (sender, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { unbond: {} }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.unbondMsg(), fee || "auto", memo, funds); }; + unbondMsg = () => { return { unbond: {} }; }; updateConfig = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_config: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateConfigMsg(args), fee || "auto", memo, funds); }; + updateConfigMsg = (args) => { return { update_config: args }; }; updateWithdrawnAmount = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_withdrawn_amount: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateWithdrawnAmountMsg(args), fee || "auto", memo, funds); }; + updateWithdrawnAmountMsg = (args) => { return { update_withdrawn_amount: args }; }; tick = async (sender, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { tick: {} }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.tickMsg(), fee || "auto", memo, funds); }; + tickMsg = () => { return { tick: {} }; }; puppeteerHook = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { puppeteer_hook: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.puppeteerHookMsg(args), fee || "auto", memo, funds); }; + puppeteerHookMsg = (args) => { return { puppeteer_hook: args }; }; stakerHook = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { staker_hook: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.stakerHookMsg(args), fee || "auto", memo, funds); }; + stakerHookMsg = (args) => { return { staker_hook: args }; }; resetBondedAmount = async (sender, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { reset_bonded_amount: {} }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.resetBondedAmountMsg(), fee || "auto", memo, funds); }; + resetBondedAmountMsg = () => { return { reset_bonded_amount: {} }; }; processEmergencyBatch = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { process_emergency_batch: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.processEmergencyBatchMsg(args), fee || "auto", memo, funds); }; + processEmergencyBatchMsg = (args) => { return { process_emergency_batch: args }; }; pause = async (sender, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { pause: {} }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.pauseMsg(), fee || "auto", memo, funds); }; + pauseMsg = () => { return { pause: {} }; }; unpause = async (sender, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { unpause: {} }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.unpauseMsg(), fee || "auto", memo, funds); }; + unpauseMsg = () => { return { unpause: {} }; }; updateOwnership = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_ownership: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateOwnershipMsg(args), fee || "auto", memo, funds); }; + updateOwnershipMsg = (args) => { return { update_ownership: args }; }; } exports.Client = Client; diff --git a/ts-client/lib/contractLib/dropDistribution.d.ts b/ts-client/lib/contractLib/dropDistribution.d.ts index fcf8b8df..23bb7c50 100644 --- a/ts-client/lib/contractLib/dropDistribution.d.ts +++ b/ts-client/lib/contractLib/dropDistribution.d.ts @@ -48,8 +48,8 @@ export declare class Client { contractAddress: string; constructor(client: CosmWasmClient | SigningCosmWasmClient, contractAddress: string); mustBeSigningClient(): Error; - static instantiate(client: SigningCosmWasmClient, sender: string, codeId: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[]): Promise; - static instantiate2(client: SigningCosmWasmClient, sender: string, codeId: number, salt: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[]): Promise; + static instantiate(client: SigningCosmWasmClient, sender: string, codeId: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], admin?: string): Promise; + static instantiate2(client: SigningCosmWasmClient, sender: string, codeId: number, salt: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], admin?: string): Promise; queryCalcDeposit: (args: CalcDepositArgs) => Promise; queryCalcWithdraw: (args: CalcWithdrawArgs) => Promise; } diff --git a/ts-client/lib/contractLib/dropDistribution.js b/ts-client/lib/contractLib/dropDistribution.js index f544d519..d08aff62 100644 --- a/ts-client/lib/contractLib/dropDistribution.js +++ b/ts-client/lib/contractLib/dropDistribution.js @@ -14,15 +14,15 @@ class Client { mustBeSigningClient() { return new Error("This client is not a SigningCosmWasmClient"); } - static async instantiate(client, sender, codeId, initMsg, label, fees, initCoins) { + static async instantiate(client, sender, codeId, initMsg, label, fees, initCoins, admin) { const res = await client.instantiate(sender, codeId, initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } - static async instantiate2(client, sender, codeId, salt, initMsg, label, fees, initCoins) { + static async instantiate2(client, sender, codeId, salt, initMsg, label, fees, initCoins, admin) { const res = await client.instantiate2(sender, codeId, new Uint8Array([salt]), initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } diff --git a/ts-client/lib/contractLib/dropFactory.d.ts b/ts-client/lib/contractLib/dropFactory.d.ts index 183eb2e7..0d027902 100644 --- a/ts-client/lib/contractLib/dropFactory.d.ts +++ b/ts-client/lib/contractLib/dropFactory.d.ts @@ -1193,14 +1193,32 @@ export declare class Client { contractAddress: string; constructor(client: CosmWasmClient | SigningCosmWasmClient, contractAddress: string); mustBeSigningClient(): Error; - static instantiate(client: SigningCosmWasmClient, sender: string, codeId: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[]): Promise; - static instantiate2(client: SigningCosmWasmClient, sender: string, codeId: number, salt: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[]): Promise; + static instantiate(client: SigningCosmWasmClient, sender: string, codeId: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], admin?: string): Promise; + static instantiate2(client: SigningCosmWasmClient, sender: string, codeId: number, salt: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], admin?: string): Promise; queryState: () => Promise; queryPauseInfo: () => Promise; updateConfig: (sender: string, args: UpdateConfigArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + updateConfigMsg: (args: UpdateConfigArgs) => { + update_config: UpdateConfigArgs; + }; proxy: (sender: string, args: ProxyArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + proxyMsg: (args: ProxyArgs) => { + proxy: ProxyArgs; + }; adminExecute: (sender: string, args: AdminExecuteArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + adminExecuteMsg: (args: AdminExecuteArgs) => { + admin_execute: AdminExecuteArgs; + }; updateOwnership: (sender: string, args: UpdateOwnershipArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + updateOwnershipMsg: (args: UpdateOwnershipArgs) => { + update_ownership: UpdateOwnershipArgs; + }; pause: (sender: string, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + pauseMsg: () => { + pause: {}; + }; unpause: (sender: string, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + unpauseMsg: () => { + unpause: {}; + }; } diff --git a/ts-client/lib/contractLib/dropFactory.js b/ts-client/lib/contractLib/dropFactory.js index e233dc10..c440223a 100644 --- a/ts-client/lib/contractLib/dropFactory.js +++ b/ts-client/lib/contractLib/dropFactory.js @@ -14,15 +14,15 @@ class Client { mustBeSigningClient() { return new Error("This client is not a SigningCosmWasmClient"); } - static async instantiate(client, sender, codeId, initMsg, label, fees, initCoins) { + static async instantiate(client, sender, codeId, initMsg, label, fees, initCoins, admin) { const res = await client.instantiate(sender, codeId, initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } - static async instantiate2(client, sender, codeId, salt, initMsg, label, fees, initCoins) { + static async instantiate2(client, sender, codeId, salt, initMsg, label, fees, initCoins, admin) { const res = await client.instantiate2(sender, codeId, new Uint8Array([salt]), initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } @@ -36,37 +36,43 @@ class Client { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_config: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateConfigMsg(args), fee || "auto", memo, funds); }; + updateConfigMsg = (args) => { return { update_config: args }; }; proxy = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { proxy: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.proxyMsg(args), fee || "auto", memo, funds); }; + proxyMsg = (args) => { return { proxy: args }; }; adminExecute = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { admin_execute: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.adminExecuteMsg(args), fee || "auto", memo, funds); }; + adminExecuteMsg = (args) => { return { admin_execute: args }; }; updateOwnership = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_ownership: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateOwnershipMsg(args), fee || "auto", memo, funds); }; + updateOwnershipMsg = (args) => { return { update_ownership: args }; }; pause = async (sender, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { pause: {} }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.pauseMsg(), fee || "auto", memo, funds); }; + pauseMsg = () => { return { pause: {} }; }; unpause = async (sender, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { unpause: {} }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.unpauseMsg(), fee || "auto", memo, funds); }; + unpauseMsg = () => { return { unpause: {} }; }; } exports.Client = Client; diff --git a/ts-client/lib/contractLib/dropHookTester.d.ts b/ts-client/lib/contractLib/dropHookTester.d.ts index 16e54f4c..d0465e63 100644 --- a/ts-client/lib/contractLib/dropHookTester.d.ts +++ b/ts-client/lib/contractLib/dropHookTester.d.ts @@ -214,14 +214,32 @@ export declare class Client { contractAddress: string; constructor(client: CosmWasmClient | SigningCosmWasmClient, contractAddress: string); mustBeSigningClient(): Error; - static instantiate(client: SigningCosmWasmClient, sender: string, codeId: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[]): Promise; - static instantiate2(client: SigningCosmWasmClient, sender: string, codeId: number, salt: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[]): Promise; + static instantiate(client: SigningCosmWasmClient, sender: string, codeId: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], admin?: string): Promise; + static instantiate2(client: SigningCosmWasmClient, sender: string, codeId: number, salt: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], admin?: string): Promise; queryAnswers: () => Promise; queryErrors: () => Promise; setConfig: (sender: string, args: SetConfigArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + setConfigMsg: (args: SetConfigArgs) => { + set_config: SetConfigArgs; + }; undelegate: (sender: string, args: UndelegateArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + undelegateMsg: (args: UndelegateArgs) => { + undelegate: UndelegateArgs; + }; redelegate: (sender: string, args: RedelegateArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + redelegateMsg: (args: RedelegateArgs) => { + redelegate: RedelegateArgs; + }; tokenizeShare: (sender: string, args: TokenizeShareArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + tokenizeShareMsg: (args: TokenizeShareArgs) => { + tokenize_share: TokenizeShareArgs; + }; redeemShare: (sender: string, args: RedeemShareArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + redeemShareMsg: (args: RedeemShareArgs) => { + redeem_share: RedeemShareArgs; + }; puppeteerHook: (sender: string, args: PuppeteerHookArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + puppeteerHookMsg: (args: PuppeteerHookArgs) => { + puppeteer_hook: PuppeteerHookArgs; + }; } diff --git a/ts-client/lib/contractLib/dropHookTester.js b/ts-client/lib/contractLib/dropHookTester.js index 3d004ab6..e360a159 100644 --- a/ts-client/lib/contractLib/dropHookTester.js +++ b/ts-client/lib/contractLib/dropHookTester.js @@ -14,15 +14,15 @@ class Client { mustBeSigningClient() { return new Error("This client is not a SigningCosmWasmClient"); } - static async instantiate(client, sender, codeId, initMsg, label, fees, initCoins) { + static async instantiate(client, sender, codeId, initMsg, label, fees, initCoins, admin) { const res = await client.instantiate(sender, codeId, initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } - static async instantiate2(client, sender, codeId, salt, initMsg, label, fees, initCoins) { + static async instantiate2(client, sender, codeId, salt, initMsg, label, fees, initCoins, admin) { const res = await client.instantiate2(sender, codeId, new Uint8Array([salt]), initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } @@ -36,37 +36,43 @@ class Client { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { set_config: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.setConfigMsg(args), fee || "auto", memo, funds); }; + setConfigMsg = (args) => { return { set_config: args }; }; undelegate = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { undelegate: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.undelegateMsg(args), fee || "auto", memo, funds); }; + undelegateMsg = (args) => { return { undelegate: args }; }; redelegate = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { redelegate: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.redelegateMsg(args), fee || "auto", memo, funds); }; + redelegateMsg = (args) => { return { redelegate: args }; }; tokenizeShare = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { tokenize_share: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.tokenizeShareMsg(args), fee || "auto", memo, funds); }; + tokenizeShareMsg = (args) => { return { tokenize_share: args }; }; redeemShare = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { redeem_share: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.redeemShareMsg(args), fee || "auto", memo, funds); }; + redeemShareMsg = (args) => { return { redeem_share: args }; }; puppeteerHook = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { puppeteer_hook: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.puppeteerHookMsg(args), fee || "auto", memo, funds); }; + puppeteerHookMsg = (args) => { return { puppeteer_hook: args }; }; } exports.Client = Client; diff --git a/ts-client/lib/contractLib/dropPriceProvider.d.ts b/ts-client/lib/contractLib/dropPriceProvider.d.ts index 5dfc8a3a..2c097aba 100644 --- a/ts-client/lib/contractLib/dropPriceProvider.d.ts +++ b/ts-client/lib/contractLib/dropPriceProvider.d.ts @@ -98,11 +98,20 @@ export declare class Client { contractAddress: string; constructor(client: CosmWasmClient | SigningCosmWasmClient, contractAddress: string); mustBeSigningClient(): Error; - static instantiate(client: SigningCosmWasmClient, sender: string, codeId: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[]): Promise; - static instantiate2(client: SigningCosmWasmClient, sender: string, codeId: number, salt: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[]): Promise; + static instantiate(client: SigningCosmWasmClient, sender: string, codeId: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], admin?: string): Promise; + static instantiate2(client: SigningCosmWasmClient, sender: string, codeId: number, salt: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], admin?: string): Promise; queryPrice: (args: PriceArgs) => Promise; queryOwnership: () => Promise; removeDenom: (sender: string, args: RemoveDenomArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + removeDenomMsg: (args: RemoveDenomArgs) => { + remove_denom: RemoveDenomArgs; + }; setPrice: (sender: string, args: SetPriceArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + setPriceMsg: (args: SetPriceArgs) => { + set_price: SetPriceArgs; + }; updateOwnership: (sender: string, args: UpdateOwnershipArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + updateOwnershipMsg: (args: UpdateOwnershipArgs) => { + update_ownership: UpdateOwnershipArgs; + }; } diff --git a/ts-client/lib/contractLib/dropPriceProvider.js b/ts-client/lib/contractLib/dropPriceProvider.js index 25e396dc..b91c3f1a 100644 --- a/ts-client/lib/contractLib/dropPriceProvider.js +++ b/ts-client/lib/contractLib/dropPriceProvider.js @@ -14,15 +14,15 @@ class Client { mustBeSigningClient() { return new Error("This client is not a SigningCosmWasmClient"); } - static async instantiate(client, sender, codeId, initMsg, label, fees, initCoins) { + static async instantiate(client, sender, codeId, initMsg, label, fees, initCoins, admin) { const res = await client.instantiate(sender, codeId, initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } - static async instantiate2(client, sender, codeId, salt, initMsg, label, fees, initCoins) { + static async instantiate2(client, sender, codeId, salt, initMsg, label, fees, initCoins, admin) { const res = await client.instantiate2(sender, codeId, new Uint8Array([salt]), initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } @@ -36,19 +36,22 @@ class Client { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { remove_denom: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.removeDenomMsg(args), fee || "auto", memo, funds); }; + removeDenomMsg = (args) => { return { remove_denom: args }; }; setPrice = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { set_price: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.setPriceMsg(args), fee || "auto", memo, funds); }; + setPriceMsg = (args) => { return { set_price: args }; }; updateOwnership = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_ownership: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateOwnershipMsg(args), fee || "auto", memo, funds); }; + updateOwnershipMsg = (args) => { return { update_ownership: args }; }; } exports.Client = Client; diff --git a/ts-client/lib/contractLib/dropProposalVotesPoc.d.ts b/ts-client/lib/contractLib/dropProposalVotesPoc.d.ts index 318eb072..80284b27 100644 --- a/ts-client/lib/contractLib/dropProposalVotesPoc.d.ts +++ b/ts-client/lib/contractLib/dropProposalVotesPoc.d.ts @@ -45,11 +45,20 @@ export declare class Client { contractAddress: string; constructor(client: CosmWasmClient | SigningCosmWasmClient, contractAddress: string); mustBeSigningClient(): Error; - static instantiate(client: SigningCosmWasmClient, sender: string, codeId: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[]): Promise; - static instantiate2(client: SigningCosmWasmClient, sender: string, codeId: number, salt: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[]): Promise; + static instantiate(client: SigningCosmWasmClient, sender: string, codeId: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], admin?: string): Promise; + static instantiate2(client: SigningCosmWasmClient, sender: string, codeId: number, salt: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], admin?: string): Promise; queryConfig: () => Promise; queryMetrics: () => Promise; updateConfig: (sender: string, args: UpdateConfigArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + updateConfigMsg: (args: UpdateConfigArgs) => { + update_config: UpdateConfigArgs; + }; updateActiveProposals: (sender: string, args: UpdateActiveProposalsArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + updateActiveProposalsMsg: (args: UpdateActiveProposalsArgs) => { + update_active_proposals: UpdateActiveProposalsArgs; + }; updateVotersList: (sender: string, args: UpdateVotersListArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + updateVotersListMsg: (args: UpdateVotersListArgs) => { + update_voters_list: UpdateVotersListArgs; + }; } diff --git a/ts-client/lib/contractLib/dropProposalVotesPoc.js b/ts-client/lib/contractLib/dropProposalVotesPoc.js index 8ec1824d..8ee40092 100644 --- a/ts-client/lib/contractLib/dropProposalVotesPoc.js +++ b/ts-client/lib/contractLib/dropProposalVotesPoc.js @@ -14,15 +14,15 @@ class Client { mustBeSigningClient() { return new Error("This client is not a SigningCosmWasmClient"); } - static async instantiate(client, sender, codeId, initMsg, label, fees, initCoins) { + static async instantiate(client, sender, codeId, initMsg, label, fees, initCoins, admin) { const res = await client.instantiate(sender, codeId, initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } - static async instantiate2(client, sender, codeId, salt, initMsg, label, fees, initCoins) { + static async instantiate2(client, sender, codeId, salt, initMsg, label, fees, initCoins, admin) { const res = await client.instantiate2(sender, codeId, new Uint8Array([salt]), initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } @@ -36,19 +36,22 @@ class Client { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_config: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateConfigMsg(args), fee || "auto", memo, funds); }; + updateConfigMsg = (args) => { return { update_config: args }; }; updateActiveProposals = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_active_proposals: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateActiveProposalsMsg(args), fee || "auto", memo, funds); }; + updateActiveProposalsMsg = (args) => { return { update_active_proposals: args }; }; updateVotersList = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_voters_list: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateVotersListMsg(args), fee || "auto", memo, funds); }; + updateVotersListMsg = (args) => { return { update_voters_list: args }; }; } exports.Client = Client; diff --git a/ts-client/lib/contractLib/dropProviderProposalsPoc.d.ts b/ts-client/lib/contractLib/dropProviderProposalsPoc.d.ts index fb5f6735..d8a8c610 100644 --- a/ts-client/lib/contractLib/dropProviderProposalsPoc.d.ts +++ b/ts-client/lib/contractLib/dropProviderProposalsPoc.d.ts @@ -134,12 +134,18 @@ export declare class Client { contractAddress: string; constructor(client: CosmWasmClient | SigningCosmWasmClient, contractAddress: string); mustBeSigningClient(): Error; - static instantiate(client: SigningCosmWasmClient, sender: string, codeId: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[]): Promise; - static instantiate2(client: SigningCosmWasmClient, sender: string, codeId: number, salt: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[]): Promise; + static instantiate(client: SigningCosmWasmClient, sender: string, codeId: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], admin?: string): Promise; + static instantiate2(client: SigningCosmWasmClient, sender: string, codeId: number, salt: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], admin?: string): Promise; queryConfig: () => Promise; queryGetProposal: (args: GetProposalArgs) => Promise; queryGetProposals: () => Promise; queryMetrics: () => Promise; updateConfig: (sender: string, args: UpdateConfigArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + updateConfigMsg: (args: UpdateConfigArgs) => { + update_config: UpdateConfigArgs; + }; updateProposalVotes: (sender: string, args: UpdateProposalVotesArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + updateProposalVotesMsg: (args: UpdateProposalVotesArgs) => { + update_proposal_votes: UpdateProposalVotesArgs; + }; } diff --git a/ts-client/lib/contractLib/dropProviderProposalsPoc.js b/ts-client/lib/contractLib/dropProviderProposalsPoc.js index 4d97f030..f3bd7bbf 100644 --- a/ts-client/lib/contractLib/dropProviderProposalsPoc.js +++ b/ts-client/lib/contractLib/dropProviderProposalsPoc.js @@ -14,15 +14,15 @@ class Client { mustBeSigningClient() { return new Error("This client is not a SigningCosmWasmClient"); } - static async instantiate(client, sender, codeId, initMsg, label, fees, initCoins) { + static async instantiate(client, sender, codeId, initMsg, label, fees, initCoins, admin) { const res = await client.instantiate(sender, codeId, initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } - static async instantiate2(client, sender, codeId, salt, initMsg, label, fees, initCoins) { + static async instantiate2(client, sender, codeId, salt, initMsg, label, fees, initCoins, admin) { const res = await client.instantiate2(sender, codeId, new Uint8Array([salt]), initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } @@ -42,13 +42,15 @@ class Client { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_config: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateConfigMsg(args), fee || "auto", memo, funds); }; + updateConfigMsg = (args) => { return { update_config: args }; }; updateProposalVotes = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_proposal_votes: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateProposalVotesMsg(args), fee || "auto", memo, funds); }; + updateProposalVotesMsg = (args) => { return { update_proposal_votes: args }; }; } exports.Client = Client; diff --git a/ts-client/lib/contractLib/dropPump.d.ts b/ts-client/lib/contractLib/dropPump.d.ts index 724e02d9..4ba9647b 100644 --- a/ts-client/lib/contractLib/dropPump.d.ts +++ b/ts-client/lib/contractLib/dropPump.d.ts @@ -148,14 +148,29 @@ export declare class Client { contractAddress: string; constructor(client: CosmWasmClient | SigningCosmWasmClient, contractAddress: string); mustBeSigningClient(): Error; - static instantiate(client: SigningCosmWasmClient, sender: string, codeId: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[]): Promise; - static instantiate2(client: SigningCosmWasmClient, sender: string, codeId: number, salt: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[]): Promise; + static instantiate(client: SigningCosmWasmClient, sender: string, codeId: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], admin?: string): Promise; + static instantiate2(client: SigningCosmWasmClient, sender: string, codeId: number, salt: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], admin?: string): Promise; queryConfig: () => Promise; queryIca: () => Promise; queryOwnership: () => Promise; registerICA: (sender: string, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + registerICAMsg: () => { + register_i_c_a: {}; + }; push: (sender: string, args: PushArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + pushMsg: (args: PushArgs) => { + push: PushArgs; + }; refund: (sender: string, args: RefundArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + refundMsg: (args: RefundArgs) => { + refund: RefundArgs; + }; updateConfig: (sender: string, args: UpdateConfigArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + updateConfigMsg: (args: UpdateConfigArgs) => { + update_config: UpdateConfigArgs; + }; updateOwnership: (sender: string, args: UpdateOwnershipArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + updateOwnershipMsg: (args: UpdateOwnershipArgs) => { + update_ownership: UpdateOwnershipArgs; + }; } diff --git a/ts-client/lib/contractLib/dropPump.js b/ts-client/lib/contractLib/dropPump.js index 847a9f82..e65edc84 100644 --- a/ts-client/lib/contractLib/dropPump.js +++ b/ts-client/lib/contractLib/dropPump.js @@ -14,15 +14,15 @@ class Client { mustBeSigningClient() { return new Error("This client is not a SigningCosmWasmClient"); } - static async instantiate(client, sender, codeId, initMsg, label, fees, initCoins) { + static async instantiate(client, sender, codeId, initMsg, label, fees, initCoins, admin) { const res = await client.instantiate(sender, codeId, initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } - static async instantiate2(client, sender, codeId, salt, initMsg, label, fees, initCoins) { + static async instantiate2(client, sender, codeId, salt, initMsg, label, fees, initCoins, admin) { const res = await client.instantiate2(sender, codeId, new Uint8Array([salt]), initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } @@ -39,31 +39,36 @@ class Client { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { register_i_c_a: {} }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.registerICAMsg(), fee || "auto", memo, funds); }; + registerICAMsg = () => { return { register_i_c_a: {} }; }; push = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { push: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.pushMsg(args), fee || "auto", memo, funds); }; + pushMsg = (args) => { return { push: args }; }; refund = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { refund: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.refundMsg(args), fee || "auto", memo, funds); }; + refundMsg = (args) => { return { refund: args }; }; updateConfig = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_config: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateConfigMsg(args), fee || "auto", memo, funds); }; + updateConfigMsg = (args) => { return { update_config: args }; }; updateOwnership = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_ownership: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateOwnershipMsg(args), fee || "auto", memo, funds); }; + updateOwnershipMsg = (args) => { return { update_ownership: args }; }; } exports.Client = Client; diff --git a/ts-client/lib/contractLib/dropPuppeteer.d.ts b/ts-client/lib/contractLib/dropPuppeteer.d.ts index 4d9e9c91..e9a5a7fd 100644 --- a/ts-client/lib/contractLib/dropPuppeteer.d.ts +++ b/ts-client/lib/contractLib/dropPuppeteer.d.ts @@ -255,8 +255,8 @@ export declare class Client { contractAddress: string; constructor(client: CosmWasmClient | SigningCosmWasmClient, contractAddress: string); mustBeSigningClient(): Error; - static instantiate(client: SigningCosmWasmClient, sender: string, codeId: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[]): Promise; - static instantiate2(client: SigningCosmWasmClient, sender: string, codeId: number, salt: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[]): Promise; + static instantiate(client: SigningCosmWasmClient, sender: string, codeId: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], admin?: string): Promise; + static instantiate2(client: SigningCosmWasmClient, sender: string, codeId: number, salt: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], admin?: string): Promise; queryConfig: () => Promise; queryIca: () => Promise; queryTransactions: () => Promise; @@ -264,18 +264,63 @@ export declare class Client { queryExtension: (args: ExtensionArgs) => Promise; queryTxState: () => Promise; registerICA: (sender: string, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + registerICAMsg: () => { + register_i_c_a: {}; + }; registerQuery: (sender: string, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + registerQueryMsg: () => { + register_query: {}; + }; registerBalanceAndDelegatorDelegationsQuery: (sender: string, args: RegisterBalanceAndDelegatorDelegationsQueryArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + registerBalanceAndDelegatorDelegationsQueryMsg: (args: RegisterBalanceAndDelegatorDelegationsQueryArgs) => { + register_balance_and_delegator_delegations_query: RegisterBalanceAndDelegatorDelegationsQueryArgs; + }; registerDelegatorUnbondingDelegationsQuery: (sender: string, args: RegisterDelegatorUnbondingDelegationsQueryArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + registerDelegatorUnbondingDelegationsQueryMsg: (args: RegisterDelegatorUnbondingDelegationsQueryArgs) => { + register_delegator_unbonding_delegations_query: RegisterDelegatorUnbondingDelegationsQueryArgs; + }; registerNonNativeRewardsBalancesQuery: (sender: string, args: RegisterNonNativeRewardsBalancesQueryArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + registerNonNativeRewardsBalancesQueryMsg: (args: RegisterNonNativeRewardsBalancesQueryArgs) => { + register_non_native_rewards_balances_query: RegisterNonNativeRewardsBalancesQueryArgs; + }; setupProtocol: (sender: string, args: SetupProtocolArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + setupProtocolMsg: (args: SetupProtocolArgs) => { + setup_protocol: SetupProtocolArgs; + }; undelegate: (sender: string, args: UndelegateArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + undelegateMsg: (args: UndelegateArgs) => { + undelegate: UndelegateArgs; + }; redelegate: (sender: string, args: RedelegateArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + redelegateMsg: (args: RedelegateArgs) => { + redelegate: RedelegateArgs; + }; tokenizeShare: (sender: string, args: TokenizeShareArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + tokenizeShareMsg: (args: TokenizeShareArgs) => { + tokenize_share: TokenizeShareArgs; + }; redeemShares: (sender: string, args: RedeemSharesArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + redeemSharesMsg: (args: RedeemSharesArgs) => { + redeem_shares: RedeemSharesArgs; + }; iBCTransfer: (sender: string, args: IBCTransferArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + iBCTransferMsg: (args: IBCTransferArgs) => { + i_b_c_transfer: IBCTransferArgs; + }; transfer: (sender: string, args: TransferArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + transferMsg: (args: TransferArgs) => { + transfer: TransferArgs; + }; claimRewardsAndOptionalyTransfer: (sender: string, args: ClaimRewardsAndOptionalyTransferArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + claimRewardsAndOptionalyTransferMsg: (args: ClaimRewardsAndOptionalyTransferArgs) => { + claim_rewards_and_optionaly_transfer: ClaimRewardsAndOptionalyTransferArgs; + }; updateConfig: (sender: string, args: UpdateConfigArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + updateConfigMsg: (args: UpdateConfigArgs) => { + update_config: UpdateConfigArgs; + }; updateOwnership: (sender: string, args: UpdateOwnershipArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + updateOwnershipMsg: (args: UpdateOwnershipArgs) => { + update_ownership: UpdateOwnershipArgs; + }; } diff --git a/ts-client/lib/contractLib/dropPuppeteer.js b/ts-client/lib/contractLib/dropPuppeteer.js index ef3712bb..a36ea86e 100644 --- a/ts-client/lib/contractLib/dropPuppeteer.js +++ b/ts-client/lib/contractLib/dropPuppeteer.js @@ -14,15 +14,15 @@ class Client { mustBeSigningClient() { return new Error("This client is not a SigningCosmWasmClient"); } - static async instantiate(client, sender, codeId, initMsg, label, fees, initCoins) { + static async instantiate(client, sender, codeId, initMsg, label, fees, initCoins, admin) { const res = await client.instantiate(sender, codeId, initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } - static async instantiate2(client, sender, codeId, salt, initMsg, label, fees, initCoins) { + static async instantiate2(client, sender, codeId, salt, initMsg, label, fees, initCoins, admin) { const res = await client.instantiate2(sender, codeId, new Uint8Array([salt]), initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } @@ -48,91 +48,106 @@ class Client { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { register_i_c_a: {} }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.registerICAMsg(), fee || "auto", memo, funds); }; + registerICAMsg = () => { return { register_i_c_a: {} }; }; registerQuery = async (sender, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { register_query: {} }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.registerQueryMsg(), fee || "auto", memo, funds); }; + registerQueryMsg = () => { return { register_query: {} }; }; registerBalanceAndDelegatorDelegationsQuery = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { register_balance_and_delegator_delegations_query: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.registerBalanceAndDelegatorDelegationsQueryMsg(args), fee || "auto", memo, funds); }; + registerBalanceAndDelegatorDelegationsQueryMsg = (args) => { return { register_balance_and_delegator_delegations_query: args }; }; registerDelegatorUnbondingDelegationsQuery = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { register_delegator_unbonding_delegations_query: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.registerDelegatorUnbondingDelegationsQueryMsg(args), fee || "auto", memo, funds); }; + registerDelegatorUnbondingDelegationsQueryMsg = (args) => { return { register_delegator_unbonding_delegations_query: args }; }; registerNonNativeRewardsBalancesQuery = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { register_non_native_rewards_balances_query: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.registerNonNativeRewardsBalancesQueryMsg(args), fee || "auto", memo, funds); }; + registerNonNativeRewardsBalancesQueryMsg = (args) => { return { register_non_native_rewards_balances_query: args }; }; setupProtocol = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { setup_protocol: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.setupProtocolMsg(args), fee || "auto", memo, funds); }; + setupProtocolMsg = (args) => { return { setup_protocol: args }; }; undelegate = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { undelegate: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.undelegateMsg(args), fee || "auto", memo, funds); }; + undelegateMsg = (args) => { return { undelegate: args }; }; redelegate = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { redelegate: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.redelegateMsg(args), fee || "auto", memo, funds); }; + redelegateMsg = (args) => { return { redelegate: args }; }; tokenizeShare = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { tokenize_share: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.tokenizeShareMsg(args), fee || "auto", memo, funds); }; + tokenizeShareMsg = (args) => { return { tokenize_share: args }; }; redeemShares = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { redeem_shares: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.redeemSharesMsg(args), fee || "auto", memo, funds); }; + redeemSharesMsg = (args) => { return { redeem_shares: args }; }; iBCTransfer = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { i_b_c_transfer: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.iBCTransferMsg(args), fee || "auto", memo, funds); }; + iBCTransferMsg = (args) => { return { i_b_c_transfer: args }; }; transfer = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { transfer: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.transferMsg(args), fee || "auto", memo, funds); }; + transferMsg = (args) => { return { transfer: args }; }; claimRewardsAndOptionalyTransfer = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { claim_rewards_and_optionaly_transfer: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.claimRewardsAndOptionalyTransferMsg(args), fee || "auto", memo, funds); }; + claimRewardsAndOptionalyTransferMsg = (args) => { return { claim_rewards_and_optionaly_transfer: args }; }; updateConfig = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_config: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateConfigMsg(args), fee || "auto", memo, funds); }; + updateConfigMsg = (args) => { return { update_config: args }; }; updateOwnership = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_ownership: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateOwnershipMsg(args), fee || "auto", memo, funds); }; + updateOwnershipMsg = (args) => { return { update_ownership: args }; }; } exports.Client = Client; diff --git a/ts-client/lib/contractLib/dropRewardsManager.d.ts b/ts-client/lib/contractLib/dropRewardsManager.d.ts index b099d9c0..22f38968 100644 --- a/ts-client/lib/contractLib/dropRewardsManager.d.ts +++ b/ts-client/lib/contractLib/dropRewardsManager.d.ts @@ -112,15 +112,33 @@ export declare class Client { contractAddress: string; constructor(client: CosmWasmClient | SigningCosmWasmClient, contractAddress: string); mustBeSigningClient(): Error; - static instantiate(client: SigningCosmWasmClient, sender: string, codeId: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[]): Promise; - static instantiate2(client: SigningCosmWasmClient, sender: string, codeId: number, salt: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[]): Promise; + static instantiate(client: SigningCosmWasmClient, sender: string, codeId: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], admin?: string): Promise; + static instantiate2(client: SigningCosmWasmClient, sender: string, codeId: number, salt: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], admin?: string): Promise; queryHandlers: () => Promise; queryOwnership: () => Promise; queryPauseInfo: () => Promise; addHandler: (sender: string, args: AddHandlerArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + addHandlerMsg: (args: AddHandlerArgs) => { + add_handler: AddHandlerArgs; + }; removeHandler: (sender: string, args: RemoveHandlerArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + removeHandlerMsg: (args: RemoveHandlerArgs) => { + remove_handler: RemoveHandlerArgs; + }; exchangeRewards: (sender: string, args: ExchangeRewardsArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + exchangeRewardsMsg: (args: ExchangeRewardsArgs) => { + exchange_rewards: ExchangeRewardsArgs; + }; updateOwnership: (sender: string, args: UpdateOwnershipArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + updateOwnershipMsg: (args: UpdateOwnershipArgs) => { + update_ownership: UpdateOwnershipArgs; + }; pause: (sender: string, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + pauseMsg: () => { + pause: {}; + }; unpause: (sender: string, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + unpauseMsg: () => { + unpause: {}; + }; } diff --git a/ts-client/lib/contractLib/dropRewardsManager.js b/ts-client/lib/contractLib/dropRewardsManager.js index 39e29e8d..67c48512 100644 --- a/ts-client/lib/contractLib/dropRewardsManager.js +++ b/ts-client/lib/contractLib/dropRewardsManager.js @@ -14,15 +14,15 @@ class Client { mustBeSigningClient() { return new Error("This client is not a SigningCosmWasmClient"); } - static async instantiate(client, sender, codeId, initMsg, label, fees, initCoins) { + static async instantiate(client, sender, codeId, initMsg, label, fees, initCoins, admin) { const res = await client.instantiate(sender, codeId, initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } - static async instantiate2(client, sender, codeId, salt, initMsg, label, fees, initCoins) { + static async instantiate2(client, sender, codeId, salt, initMsg, label, fees, initCoins, admin) { const res = await client.instantiate2(sender, codeId, new Uint8Array([salt]), initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } @@ -39,37 +39,43 @@ class Client { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { add_handler: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.addHandlerMsg(args), fee || "auto", memo, funds); }; + addHandlerMsg = (args) => { return { add_handler: args }; }; removeHandler = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { remove_handler: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.removeHandlerMsg(args), fee || "auto", memo, funds); }; + removeHandlerMsg = (args) => { return { remove_handler: args }; }; exchangeRewards = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { exchange_rewards: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.exchangeRewardsMsg(args), fee || "auto", memo, funds); }; + exchangeRewardsMsg = (args) => { return { exchange_rewards: args }; }; updateOwnership = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_ownership: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateOwnershipMsg(args), fee || "auto", memo, funds); }; + updateOwnershipMsg = (args) => { return { update_ownership: args }; }; pause = async (sender, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { pause: {} }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.pauseMsg(), fee || "auto", memo, funds); }; + pauseMsg = () => { return { pause: {} }; }; unpause = async (sender, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { unpause: {} }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.unpauseMsg(), fee || "auto", memo, funds); }; + unpauseMsg = () => { return { unpause: {} }; }; } exports.Client = Client; diff --git a/ts-client/lib/contractLib/dropSplitter.d.ts b/ts-client/lib/contractLib/dropSplitter.d.ts index 72286cd8..d29c8724 100644 --- a/ts-client/lib/contractLib/dropSplitter.d.ts +++ b/ts-client/lib/contractLib/dropSplitter.d.ts @@ -100,11 +100,20 @@ export declare class Client { contractAddress: string; constructor(client: CosmWasmClient | SigningCosmWasmClient, contractAddress: string); mustBeSigningClient(): Error; - static instantiate(client: SigningCosmWasmClient, sender: string, codeId: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[]): Promise; - static instantiate2(client: SigningCosmWasmClient, sender: string, codeId: number, salt: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[]): Promise; + static instantiate(client: SigningCosmWasmClient, sender: string, codeId: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], admin?: string): Promise; + static instantiate2(client: SigningCosmWasmClient, sender: string, codeId: number, salt: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], admin?: string): Promise; queryConfig: () => Promise; queryOwnership: () => Promise; distribute: (sender: string, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + distributeMsg: () => { + distribute: {}; + }; updateConfig: (sender: string, args: UpdateConfigArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + updateConfigMsg: (args: UpdateConfigArgs) => { + update_config: UpdateConfigArgs; + }; updateOwnership: (sender: string, args: UpdateOwnershipArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + updateOwnershipMsg: (args: UpdateOwnershipArgs) => { + update_ownership: UpdateOwnershipArgs; + }; } diff --git a/ts-client/lib/contractLib/dropSplitter.js b/ts-client/lib/contractLib/dropSplitter.js index 45046a96..4537da66 100644 --- a/ts-client/lib/contractLib/dropSplitter.js +++ b/ts-client/lib/contractLib/dropSplitter.js @@ -14,15 +14,15 @@ class Client { mustBeSigningClient() { return new Error("This client is not a SigningCosmWasmClient"); } - static async instantiate(client, sender, codeId, initMsg, label, fees, initCoins) { + static async instantiate(client, sender, codeId, initMsg, label, fees, initCoins, admin) { const res = await client.instantiate(sender, codeId, initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } - static async instantiate2(client, sender, codeId, salt, initMsg, label, fees, initCoins) { + static async instantiate2(client, sender, codeId, salt, initMsg, label, fees, initCoins, admin) { const res = await client.instantiate2(sender, codeId, new Uint8Array([salt]), initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } @@ -36,19 +36,22 @@ class Client { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { distribute: {} }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.distributeMsg(), fee || "auto", memo, funds); }; + distributeMsg = () => { return { distribute: {} }; }; updateConfig = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_config: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateConfigMsg(args), fee || "auto", memo, funds); }; + updateConfigMsg = (args) => { return { update_config: args }; }; updateOwnership = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_ownership: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateOwnershipMsg(args), fee || "auto", memo, funds); }; + updateOwnershipMsg = (args) => { return { update_ownership: args }; }; } exports.Client = Client; diff --git a/ts-client/lib/contractLib/dropStaker.d.ts b/ts-client/lib/contractLib/dropStaker.d.ts index a0cae6b4..55e9a96a 100644 --- a/ts-client/lib/contractLib/dropStaker.d.ts +++ b/ts-client/lib/contractLib/dropStaker.d.ts @@ -185,8 +185,8 @@ export declare class Client { contractAddress: string; constructor(client: CosmWasmClient | SigningCosmWasmClient, contractAddress: string); mustBeSigningClient(): Error; - static instantiate(client: SigningCosmWasmClient, sender: string, codeId: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[]): Promise; - static instantiate2(client: SigningCosmWasmClient, sender: string, codeId: number, salt: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[]): Promise; + static instantiate(client: SigningCosmWasmClient, sender: string, codeId: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], admin?: string): Promise; + static instantiate2(client: SigningCosmWasmClient, sender: string, codeId: number, salt: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], admin?: string): Promise; queryConfig: () => Promise; queryNonStakedBalance: () => Promise; queryAllBalance: () => Promise; @@ -194,8 +194,23 @@ export declare class Client { queryTxState: () => Promise; queryOwnership: () => Promise; registerICA: (sender: string, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + registerICAMsg: () => { + register_i_c_a: {}; + }; stake: (sender: string, args: StakeArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + stakeMsg: (args: StakeArgs) => { + stake: StakeArgs; + }; iBCTransfer: (sender: string, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + iBCTransferMsg: () => { + i_b_c_transfer: {}; + }; updateConfig: (sender: string, args: UpdateConfigArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + updateConfigMsg: (args: UpdateConfigArgs) => { + update_config: UpdateConfigArgs; + }; updateOwnership: (sender: string, args: UpdateOwnershipArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + updateOwnershipMsg: (args: UpdateOwnershipArgs) => { + update_ownership: UpdateOwnershipArgs; + }; } diff --git a/ts-client/lib/contractLib/dropStaker.js b/ts-client/lib/contractLib/dropStaker.js index 0d2fbf70..7b1adaca 100644 --- a/ts-client/lib/contractLib/dropStaker.js +++ b/ts-client/lib/contractLib/dropStaker.js @@ -14,15 +14,15 @@ class Client { mustBeSigningClient() { return new Error("This client is not a SigningCosmWasmClient"); } - static async instantiate(client, sender, codeId, initMsg, label, fees, initCoins) { + static async instantiate(client, sender, codeId, initMsg, label, fees, initCoins, admin) { const res = await client.instantiate(sender, codeId, initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } - static async instantiate2(client, sender, codeId, salt, initMsg, label, fees, initCoins) { + static async instantiate2(client, sender, codeId, salt, initMsg, label, fees, initCoins, admin) { const res = await client.instantiate2(sender, codeId, new Uint8Array([salt]), initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } @@ -48,31 +48,36 @@ class Client { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { register_i_c_a: {} }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.registerICAMsg(), fee || "auto", memo, funds); }; + registerICAMsg = () => { return { register_i_c_a: {} }; }; stake = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { stake: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.stakeMsg(args), fee || "auto", memo, funds); }; + stakeMsg = (args) => { return { stake: args }; }; iBCTransfer = async (sender, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { i_b_c_transfer: {} }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.iBCTransferMsg(), fee || "auto", memo, funds); }; + iBCTransferMsg = () => { return { i_b_c_transfer: {} }; }; updateConfig = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_config: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateConfigMsg(args), fee || "auto", memo, funds); }; + updateConfigMsg = (args) => { return { update_config: args }; }; updateOwnership = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_ownership: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateOwnershipMsg(args), fee || "auto", memo, funds); }; + updateOwnershipMsg = (args) => { return { update_ownership: args }; }; } exports.Client = Client; diff --git a/ts-client/lib/contractLib/dropStrategy.d.ts b/ts-client/lib/contractLib/dropStrategy.d.ts index 35111c0f..69e8f0f9 100644 --- a/ts-client/lib/contractLib/dropStrategy.d.ts +++ b/ts-client/lib/contractLib/dropStrategy.d.ts @@ -117,12 +117,18 @@ export declare class Client { contractAddress: string; constructor(client: CosmWasmClient | SigningCosmWasmClient, contractAddress: string); mustBeSigningClient(): Error; - static instantiate(client: SigningCosmWasmClient, sender: string, codeId: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[]): Promise; - static instantiate2(client: SigningCosmWasmClient, sender: string, codeId: number, salt: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[]): Promise; + static instantiate(client: SigningCosmWasmClient, sender: string, codeId: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], admin?: string): Promise; + static instantiate2(client: SigningCosmWasmClient, sender: string, codeId: number, salt: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], admin?: string): Promise; queryConfig: () => Promise; queryCalcDeposit: (args: CalcDepositArgs) => Promise; queryCalcWithdraw: (args: CalcWithdrawArgs) => Promise; queryOwnership: () => Promise; updateConfig: (sender: string, args: UpdateConfigArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + updateConfigMsg: (args: UpdateConfigArgs) => { + update_config: UpdateConfigArgs; + }; updateOwnership: (sender: string, args: UpdateOwnershipArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + updateOwnershipMsg: (args: UpdateOwnershipArgs) => { + update_ownership: UpdateOwnershipArgs; + }; } diff --git a/ts-client/lib/contractLib/dropStrategy.js b/ts-client/lib/contractLib/dropStrategy.js index 8f4b56b9..2c792eb3 100644 --- a/ts-client/lib/contractLib/dropStrategy.js +++ b/ts-client/lib/contractLib/dropStrategy.js @@ -14,15 +14,15 @@ class Client { mustBeSigningClient() { return new Error("This client is not a SigningCosmWasmClient"); } - static async instantiate(client, sender, codeId, initMsg, label, fees, initCoins) { + static async instantiate(client, sender, codeId, initMsg, label, fees, initCoins, admin) { const res = await client.instantiate(sender, codeId, initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } - static async instantiate2(client, sender, codeId, salt, initMsg, label, fees, initCoins) { + static async instantiate2(client, sender, codeId, salt, initMsg, label, fees, initCoins, admin) { const res = await client.instantiate2(sender, codeId, new Uint8Array([salt]), initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } @@ -42,13 +42,15 @@ class Client { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_config: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateConfigMsg(args), fee || "auto", memo, funds); }; + updateConfigMsg = (args) => { return { update_config: args }; }; updateOwnership = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_ownership: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateOwnershipMsg(args), fee || "auto", memo, funds); }; + updateOwnershipMsg = (args) => { return { update_ownership: args }; }; } exports.Client = Client; diff --git a/ts-client/lib/contractLib/dropToken.d.ts b/ts-client/lib/contractLib/dropToken.d.ts index b6254ea7..8736f3b6 100644 --- a/ts-client/lib/contractLib/dropToken.d.ts +++ b/ts-client/lib/contractLib/dropToken.d.ts @@ -133,12 +133,24 @@ export declare class Client { contractAddress: string; constructor(client: CosmWasmClient | SigningCosmWasmClient, contractAddress: string); mustBeSigningClient(): Error; - static instantiate(client: SigningCosmWasmClient, sender: string, codeId: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[]): Promise; - static instantiate2(client: SigningCosmWasmClient, sender: string, codeId: number, salt: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[]): Promise; + static instantiate(client: SigningCosmWasmClient, sender: string, codeId: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], admin?: string): Promise; + static instantiate2(client: SigningCosmWasmClient, sender: string, codeId: number, salt: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], admin?: string): Promise; queryConfig: () => Promise; queryOwnership: () => Promise; mint: (sender: string, args: MintArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + mintMsg: (args: MintArgs) => { + mint: MintArgs; + }; burn: (sender: string, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + burnMsg: () => { + burn: {}; + }; setTokenMetadata: (sender: string, args: SetTokenMetadataArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + setTokenMetadataMsg: (args: SetTokenMetadataArgs) => { + set_token_metadata: SetTokenMetadataArgs; + }; updateOwnership: (sender: string, args: UpdateOwnershipArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + updateOwnershipMsg: (args: UpdateOwnershipArgs) => { + update_ownership: UpdateOwnershipArgs; + }; } diff --git a/ts-client/lib/contractLib/dropToken.js b/ts-client/lib/contractLib/dropToken.js index 2e951450..1f269dd2 100644 --- a/ts-client/lib/contractLib/dropToken.js +++ b/ts-client/lib/contractLib/dropToken.js @@ -14,15 +14,15 @@ class Client { mustBeSigningClient() { return new Error("This client is not a SigningCosmWasmClient"); } - static async instantiate(client, sender, codeId, initMsg, label, fees, initCoins) { + static async instantiate(client, sender, codeId, initMsg, label, fees, initCoins, admin) { const res = await client.instantiate(sender, codeId, initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } - static async instantiate2(client, sender, codeId, salt, initMsg, label, fees, initCoins) { + static async instantiate2(client, sender, codeId, salt, initMsg, label, fees, initCoins, admin) { const res = await client.instantiate2(sender, codeId, new Uint8Array([salt]), initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } @@ -36,25 +36,29 @@ class Client { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { mint: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.mintMsg(args), fee || "auto", memo, funds); }; + mintMsg = (args) => { return { mint: args }; }; burn = async (sender, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { burn: {} }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.burnMsg(), fee || "auto", memo, funds); }; + burnMsg = () => { return { burn: {} }; }; setTokenMetadata = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { set_token_metadata: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.setTokenMetadataMsg(args), fee || "auto", memo, funds); }; + setTokenMetadataMsg = (args) => { return { set_token_metadata: args }; }; updateOwnership = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_ownership: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateOwnershipMsg(args), fee || "auto", memo, funds); }; + updateOwnershipMsg = (args) => { return { update_ownership: args }; }; } exports.Client = Client; diff --git a/ts-client/lib/contractLib/dropValidatorsSet.d.ts b/ts-client/lib/contractLib/dropValidatorsSet.d.ts index fc8da52b..17c13cba 100644 --- a/ts-client/lib/contractLib/dropValidatorsSet.d.ts +++ b/ts-client/lib/contractLib/dropValidatorsSet.d.ts @@ -213,15 +213,30 @@ export declare class Client { contractAddress: string; constructor(client: CosmWasmClient | SigningCosmWasmClient, contractAddress: string); mustBeSigningClient(): Error; - static instantiate(client: SigningCosmWasmClient, sender: string, codeId: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[]): Promise; - static instantiate2(client: SigningCosmWasmClient, sender: string, codeId: number, salt: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[]): Promise; + static instantiate(client: SigningCosmWasmClient, sender: string, codeId: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], admin?: string): Promise; + static instantiate2(client: SigningCosmWasmClient, sender: string, codeId: number, salt: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], admin?: string): Promise; queryConfig: () => Promise; queryValidator: (args: ValidatorArgs) => Promise; queryValidators: () => Promise; queryOwnership: () => Promise; updateConfig: (sender: string, args: UpdateConfigArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + updateConfigMsg: (args: UpdateConfigArgs) => { + update_config: UpdateConfigArgs; + }; updateValidators: (sender: string, args: UpdateValidatorsArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + updateValidatorsMsg: (args: UpdateValidatorsArgs) => { + update_validators: UpdateValidatorsArgs; + }; updateValidatorsInfo: (sender: string, args: UpdateValidatorsInfoArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + updateValidatorsInfoMsg: (args: UpdateValidatorsInfoArgs) => { + update_validators_info: UpdateValidatorsInfoArgs; + }; updateValidatorsVoting: (sender: string, args: UpdateValidatorsVotingArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + updateValidatorsVotingMsg: (args: UpdateValidatorsVotingArgs) => { + update_validators_voting: UpdateValidatorsVotingArgs; + }; updateOwnership: (sender: string, args: UpdateOwnershipArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + updateOwnershipMsg: (args: UpdateOwnershipArgs) => { + update_ownership: UpdateOwnershipArgs; + }; } diff --git a/ts-client/lib/contractLib/dropValidatorsSet.js b/ts-client/lib/contractLib/dropValidatorsSet.js index a24dcabe..6614e805 100644 --- a/ts-client/lib/contractLib/dropValidatorsSet.js +++ b/ts-client/lib/contractLib/dropValidatorsSet.js @@ -14,15 +14,15 @@ class Client { mustBeSigningClient() { return new Error("This client is not a SigningCosmWasmClient"); } - static async instantiate(client, sender, codeId, initMsg, label, fees, initCoins) { + static async instantiate(client, sender, codeId, initMsg, label, fees, initCoins, admin) { const res = await client.instantiate(sender, codeId, initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } - static async instantiate2(client, sender, codeId, salt, initMsg, label, fees, initCoins) { + static async instantiate2(client, sender, codeId, salt, initMsg, label, fees, initCoins, admin) { const res = await client.instantiate2(sender, codeId, new Uint8Array([salt]), initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } @@ -42,31 +42,36 @@ class Client { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_config: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateConfigMsg(args), fee || "auto", memo, funds); }; + updateConfigMsg = (args) => { return { update_config: args }; }; updateValidators = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_validators: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateValidatorsMsg(args), fee || "auto", memo, funds); }; + updateValidatorsMsg = (args) => { return { update_validators: args }; }; updateValidatorsInfo = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_validators_info: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateValidatorsInfoMsg(args), fee || "auto", memo, funds); }; + updateValidatorsInfoMsg = (args) => { return { update_validators_info: args }; }; updateValidatorsVoting = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_validators_voting: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateValidatorsVotingMsg(args), fee || "auto", memo, funds); }; + updateValidatorsVotingMsg = (args) => { return { update_validators_voting: args }; }; updateOwnership = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_ownership: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateOwnershipMsg(args), fee || "auto", memo, funds); }; + updateOwnershipMsg = (args) => { return { update_ownership: args }; }; } exports.Client = Client; diff --git a/ts-client/lib/contractLib/dropValidatorsStats.d.ts b/ts-client/lib/contractLib/dropValidatorsStats.d.ts index cc95ce66..ae3a8d4a 100644 --- a/ts-client/lib/contractLib/dropValidatorsStats.d.ts +++ b/ts-client/lib/contractLib/dropValidatorsStats.d.ts @@ -64,10 +64,13 @@ export declare class Client { contractAddress: string; constructor(client: CosmWasmClient | SigningCosmWasmClient, contractAddress: string); mustBeSigningClient(): Error; - static instantiate(client: SigningCosmWasmClient, sender: string, codeId: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[]): Promise; - static instantiate2(client: SigningCosmWasmClient, sender: string, codeId: number, salt: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[]): Promise; + static instantiate(client: SigningCosmWasmClient, sender: string, codeId: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], admin?: string): Promise; + static instantiate2(client: SigningCosmWasmClient, sender: string, codeId: number, salt: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], admin?: string): Promise; queryConfig: () => Promise; queryKVQueryIds: () => Promise; queryState: () => Promise; registerStatsQueries: (sender: string, args: RegisterStatsQueriesArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + registerStatsQueriesMsg: (args: RegisterStatsQueriesArgs) => { + register_stats_queries: RegisterStatsQueriesArgs; + }; } diff --git a/ts-client/lib/contractLib/dropValidatorsStats.js b/ts-client/lib/contractLib/dropValidatorsStats.js index 03fbe6d0..4a8eb805 100644 --- a/ts-client/lib/contractLib/dropValidatorsStats.js +++ b/ts-client/lib/contractLib/dropValidatorsStats.js @@ -14,15 +14,15 @@ class Client { mustBeSigningClient() { return new Error("This client is not a SigningCosmWasmClient"); } - static async instantiate(client, sender, codeId, initMsg, label, fees, initCoins) { + static async instantiate(client, sender, codeId, initMsg, label, fees, initCoins, admin) { const res = await client.instantiate(sender, codeId, initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } - static async instantiate2(client, sender, codeId, salt, initMsg, label, fees, initCoins) { + static async instantiate2(client, sender, codeId, salt, initMsg, label, fees, initCoins, admin) { const res = await client.instantiate2(sender, codeId, new Uint8Array([salt]), initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } @@ -39,7 +39,8 @@ class Client { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { register_stats_queries: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.registerStatsQueriesMsg(args), fee || "auto", memo, funds); }; + registerStatsQueriesMsg = (args) => { return { register_stats_queries: args }; }; } exports.Client = Client; diff --git a/ts-client/lib/contractLib/dropWithdrawalManager.d.ts b/ts-client/lib/contractLib/dropWithdrawalManager.d.ts index e0ae5e4e..ca24d7cb 100644 --- a/ts-client/lib/contractLib/dropWithdrawalManager.d.ts +++ b/ts-client/lib/contractLib/dropWithdrawalManager.d.ts @@ -118,14 +118,29 @@ export declare class Client { contractAddress: string; constructor(client: CosmWasmClient | SigningCosmWasmClient, contractAddress: string); mustBeSigningClient(): Error; - static instantiate(client: SigningCosmWasmClient, sender: string, codeId: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[]): Promise; - static instantiate2(client: SigningCosmWasmClient, sender: string, codeId: number, salt: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[]): Promise; + static instantiate(client: SigningCosmWasmClient, sender: string, codeId: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], admin?: string): Promise; + static instantiate2(client: SigningCosmWasmClient, sender: string, codeId: number, salt: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], admin?: string): Promise; queryConfig: () => Promise; queryOwnership: () => Promise; queryPauseInfo: () => Promise; updateConfig: (sender: string, args: UpdateConfigArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + updateConfigMsg: (args: UpdateConfigArgs) => { + update_config: UpdateConfigArgs; + }; receiveNft: (sender: string, args: ReceiveNftArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + receiveNftMsg: (args: ReceiveNftArgs) => { + receive_nft: ReceiveNftArgs; + }; updateOwnership: (sender: string, args: UpdateOwnershipArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + updateOwnershipMsg: (args: UpdateOwnershipArgs) => { + update_ownership: UpdateOwnershipArgs; + }; pause: (sender: string, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + pauseMsg: () => { + pause: {}; + }; unpause: (sender: string, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + unpauseMsg: () => { + unpause: {}; + }; } diff --git a/ts-client/lib/contractLib/dropWithdrawalManager.js b/ts-client/lib/contractLib/dropWithdrawalManager.js index b588d7d2..e6c35c7a 100644 --- a/ts-client/lib/contractLib/dropWithdrawalManager.js +++ b/ts-client/lib/contractLib/dropWithdrawalManager.js @@ -14,15 +14,15 @@ class Client { mustBeSigningClient() { return new Error("This client is not a SigningCosmWasmClient"); } - static async instantiate(client, sender, codeId, initMsg, label, fees, initCoins) { + static async instantiate(client, sender, codeId, initMsg, label, fees, initCoins, admin) { const res = await client.instantiate(sender, codeId, initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } - static async instantiate2(client, sender, codeId, salt, initMsg, label, fees, initCoins) { + static async instantiate2(client, sender, codeId, salt, initMsg, label, fees, initCoins, admin) { const res = await client.instantiate2(sender, codeId, new Uint8Array([salt]), initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } @@ -39,31 +39,36 @@ class Client { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_config: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateConfigMsg(args), fee || "auto", memo, funds); }; + updateConfigMsg = (args) => { return { update_config: args }; }; receiveNft = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { receive_nft: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.receiveNftMsg(args), fee || "auto", memo, funds); }; + receiveNftMsg = (args) => { return { receive_nft: args }; }; updateOwnership = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_ownership: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateOwnershipMsg(args), fee || "auto", memo, funds); }; + updateOwnershipMsg = (args) => { return { update_ownership: args }; }; pause = async (sender, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { pause: {} }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.pauseMsg(), fee || "auto", memo, funds); }; + pauseMsg = () => { return { pause: {} }; }; unpause = async (sender, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { unpause: {} }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.unpauseMsg(), fee || "auto", memo, funds); }; + unpauseMsg = () => { return { unpause: {} }; }; } exports.Client = Client; diff --git a/ts-client/lib/contractLib/dropWithdrawalVoucher.d.ts b/ts-client/lib/contractLib/dropWithdrawalVoucher.d.ts index 7c13e95e..87724dd9 100644 --- a/ts-client/lib/contractLib/dropWithdrawalVoucher.d.ts +++ b/ts-client/lib/contractLib/dropWithdrawalVoucher.d.ts @@ -326,8 +326,8 @@ export declare class Client { contractAddress: string; constructor(client: CosmWasmClient | SigningCosmWasmClient, contractAddress: string); mustBeSigningClient(): Error; - static instantiate(client: SigningCosmWasmClient, sender: string, codeId: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[]): Promise; - static instantiate2(client: SigningCosmWasmClient, sender: string, codeId: number, salt: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[]): Promise; + static instantiate(client: SigningCosmWasmClient, sender: string, codeId: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], admin?: string): Promise; + static instantiate2(client: SigningCosmWasmClient, sender: string, codeId: number, salt: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], admin?: string): Promise; queryOwnerOf: (args: OwnerOfArgs) => Promise; queryApproval: (args: ApprovalArgs) => Promise; queryApprovals: (args: ApprovalsArgs) => Promise; @@ -343,13 +343,43 @@ export declare class Client { queryExtension: (args: ExtensionArgs) => Promise; queryOwnership: () => Promise; transferNft: (sender: string, args: TransferNftArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + transferNftMsg: (args: TransferNftArgs) => { + transfer_nft: TransferNftArgs; + }; sendNft: (sender: string, args: SendNftArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + sendNftMsg: (args: SendNftArgs) => { + send_nft: SendNftArgs; + }; approve: (sender: string, args: ApproveArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + approveMsg: (args: ApproveArgs) => { + approve: ApproveArgs; + }; revoke: (sender: string, args: RevokeArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + revokeMsg: (args: RevokeArgs) => { + revoke: RevokeArgs; + }; approveAll: (sender: string, args: ApproveAllArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + approveAllMsg: (args: ApproveAllArgs) => { + approve_all: ApproveAllArgs; + }; revokeAll: (sender: string, args: RevokeAllArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + revokeAllMsg: (args: RevokeAllArgs) => { + revoke_all: RevokeAllArgs; + }; mint: (sender: string, args: MintArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + mintMsg: (args: MintArgs) => { + mint: MintArgs; + }; burn: (sender: string, args: BurnArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + burnMsg: (args: BurnArgs) => { + burn: BurnArgs; + }; extension: (sender: string, args: ExtensionArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + extensionMsg: (args: ExtensionArgs) => { + extension: ExtensionArgs; + }; updateOwnership: (sender: string, args: UpdateOwnershipArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise; + updateOwnershipMsg: (args: UpdateOwnershipArgs) => { + update_ownership: UpdateOwnershipArgs; + }; } diff --git a/ts-client/lib/contractLib/dropWithdrawalVoucher.js b/ts-client/lib/contractLib/dropWithdrawalVoucher.js index 9e1e220d..cbc6815d 100644 --- a/ts-client/lib/contractLib/dropWithdrawalVoucher.js +++ b/ts-client/lib/contractLib/dropWithdrawalVoucher.js @@ -14,15 +14,15 @@ class Client { mustBeSigningClient() { return new Error("This client is not a SigningCosmWasmClient"); } - static async instantiate(client, sender, codeId, initMsg, label, fees, initCoins) { + static async instantiate(client, sender, codeId, initMsg, label, fees, initCoins, admin) { const res = await client.instantiate(sender, codeId, initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } - static async instantiate2(client, sender, codeId, salt, initMsg, label, fees, initCoins) { + static async instantiate2(client, sender, codeId, salt, initMsg, label, fees, initCoins, admin) { const res = await client.instantiate2(sender, codeId, new Uint8Array([salt]), initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } @@ -72,61 +72,71 @@ class Client { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { transfer_nft: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.transferNftMsg(args), fee || "auto", memo, funds); }; + transferNftMsg = (args) => { return { transfer_nft: args }; }; sendNft = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { send_nft: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.sendNftMsg(args), fee || "auto", memo, funds); }; + sendNftMsg = (args) => { return { send_nft: args }; }; approve = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { approve: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.approveMsg(args), fee || "auto", memo, funds); }; + approveMsg = (args) => { return { approve: args }; }; revoke = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { revoke: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.revokeMsg(args), fee || "auto", memo, funds); }; + revokeMsg = (args) => { return { revoke: args }; }; approveAll = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { approve_all: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.approveAllMsg(args), fee || "auto", memo, funds); }; + approveAllMsg = (args) => { return { approve_all: args }; }; revokeAll = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { revoke_all: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.revokeAllMsg(args), fee || "auto", memo, funds); }; + revokeAllMsg = (args) => { return { revoke_all: args }; }; mint = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { mint: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.mintMsg(args), fee || "auto", memo, funds); }; + mintMsg = (args) => { return { mint: args }; }; burn = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { burn: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.burnMsg(args), fee || "auto", memo, funds); }; + burnMsg = (args) => { return { burn: args }; }; extension = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { extension: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.extensionMsg(args), fee || "auto", memo, funds); }; + extensionMsg = (args) => { return { extension: args }; }; updateOwnership = async (sender, args, fee, memo, funds) => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_ownership: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateOwnershipMsg(args), fee || "auto", memo, funds); }; + updateOwnershipMsg = (args) => { return { update_ownership: args }; }; } exports.Client = Client; diff --git a/ts-client/package.json b/ts-client/package.json index 7b95eeee..64d4332b 100644 --- a/ts-client/package.json +++ b/ts-client/package.json @@ -8,7 +8,7 @@ }, "dependencies": { "@neutron-org/client-ts": "^1.4.0", - "@neutron-org/contracts2ts": "1.4.6", + "@neutron-org/contracts2ts": "1.5.2", "@cosmjs/cosmwasm-stargate": "^0.32.4", "@cosmjs/proto-signing": "^0.32.4" }, diff --git a/ts-client/src/contractLib/dropAstroportExchangeHandler.ts b/ts-client/src/contractLib/dropAstroportExchangeHandler.ts index 3c9632ac..dd86b26b 100644 --- a/ts-client/src/contractLib/dropAstroportExchangeHandler.ts +++ b/ts-client/src/contractLib/dropAstroportExchangeHandler.ts @@ -195,7 +195,7 @@ export class Client { this.client = client; this.contractAddress = contractAddress; } - mustBeSigningClient() { + mustBeSigningClient(): Error { return new Error("This client is not a SigningCosmWasmClient"); } static async instantiate( @@ -206,9 +206,10 @@ export class Client { label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], + admin?: string, ): Promise { const res = await client.instantiate(sender, codeId, initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } @@ -221,9 +222,10 @@ export class Client { label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], + admin?: string, ): Promise { const res = await client.instantiate2(sender, codeId, new Uint8Array([salt]), initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } @@ -235,18 +237,22 @@ export class Client { } updateConfig = async(sender:string, args: UpdateConfigArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_config: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateConfigMsg(args), fee || "auto", memo, funds); } + updateConfigMsg = (args: UpdateConfigArgs): { update_config: UpdateConfigArgs } => { return { update_config: args }; } updateSwapOperations = async(sender:string, args: UpdateSwapOperationsArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_swap_operations: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateSwapOperationsMsg(args), fee || "auto", memo, funds); } + updateSwapOperationsMsg = (args: UpdateSwapOperationsArgs): { update_swap_operations: UpdateSwapOperationsArgs } => { return { update_swap_operations: args }; } exchange = async(sender: string, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { exchange: {} }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.exchangeMsg(), fee || "auto", memo, funds); } + exchangeMsg = (): { exchange: {} } => { return { exchange: {} } } updateOwnership = async(sender:string, args: UpdateOwnershipArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_ownership: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateOwnershipMsg(args), fee || "auto", memo, funds); } + updateOwnershipMsg = (args: UpdateOwnershipArgs): { update_ownership: UpdateOwnershipArgs } => { return { update_ownership: args }; } } diff --git a/ts-client/src/contractLib/dropAutoWithdrawer.ts b/ts-client/src/contractLib/dropAutoWithdrawer.ts index 67af0672..0bd5b31a 100644 --- a/ts-client/src/contractLib/dropAutoWithdrawer.ts +++ b/ts-client/src/contractLib/dropAutoWithdrawer.ts @@ -104,7 +104,7 @@ export class Client { this.client = client; this.contractAddress = contractAddress; } - mustBeSigningClient() { + mustBeSigningClient(): Error { return new Error("This client is not a SigningCosmWasmClient"); } static async instantiate( @@ -115,9 +115,10 @@ export class Client { label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], + admin?: string, ): Promise { const res = await client.instantiate(sender, codeId, initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } @@ -130,9 +131,10 @@ export class Client { label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], + admin?: string, ): Promise { const res = await client.instantiate2(sender, codeId, new Uint8Array([salt]), initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } @@ -144,14 +146,17 @@ export class Client { } bond = async(sender:string, args: BondArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { bond: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.bondMsg(args), fee || "auto", memo, funds); } + bondMsg = (args: BondArgs): { bond: BondArgs } => { return { bond: args }; } unbond = async(sender:string, args: UnbondArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { unbond: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.unbondMsg(args), fee || "auto", memo, funds); } + unbondMsg = (args: UnbondArgs): { unbond: UnbondArgs } => { return { unbond: args }; } withdraw = async(sender:string, args: WithdrawArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { withdraw: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.withdrawMsg(args), fee || "auto", memo, funds); } + withdrawMsg = (args: WithdrawArgs): { withdraw: WithdrawArgs } => { return { withdraw: args }; } } diff --git a/ts-client/src/contractLib/dropCore.ts b/ts-client/src/contractLib/dropCore.ts index 32d30b3d..a90c20a1 100644 --- a/ts-client/src/contractLib/dropCore.ts +++ b/ts-client/src/contractLib/dropCore.ts @@ -554,7 +554,7 @@ export class Client { this.client = client; this.contractAddress = contractAddress; } - mustBeSigningClient() { + mustBeSigningClient(): Error { return new Error("This client is not a SigningCosmWasmClient"); } static async instantiate( @@ -565,9 +565,10 @@ export class Client { label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], + admin?: string, ): Promise { const res = await client.instantiate(sender, codeId, initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } @@ -580,9 +581,10 @@ export class Client { label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], + admin?: string, ): Promise { const res = await client.instantiate2(sender, codeId, new Uint8Array([salt]), initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } @@ -633,50 +635,62 @@ export class Client { } bond = async(sender:string, args: BondArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { bond: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.bondMsg(args), fee || "auto", memo, funds); } + bondMsg = (args: BondArgs): { bond: BondArgs } => { return { bond: args }; } unbond = async(sender: string, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { unbond: {} }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.unbondMsg(), fee || "auto", memo, funds); } + unbondMsg = (): { unbond: {} } => { return { unbond: {} } } updateConfig = async(sender:string, args: UpdateConfigArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_config: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateConfigMsg(args), fee || "auto", memo, funds); } + updateConfigMsg = (args: UpdateConfigArgs): { update_config: UpdateConfigArgs } => { return { update_config: args }; } updateWithdrawnAmount = async(sender:string, args: UpdateWithdrawnAmountArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_withdrawn_amount: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateWithdrawnAmountMsg(args), fee || "auto", memo, funds); } + updateWithdrawnAmountMsg = (args: UpdateWithdrawnAmountArgs): { update_withdrawn_amount: UpdateWithdrawnAmountArgs } => { return { update_withdrawn_amount: args }; } tick = async(sender: string, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { tick: {} }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.tickMsg(), fee || "auto", memo, funds); } + tickMsg = (): { tick: {} } => { return { tick: {} } } puppeteerHook = async(sender:string, args: PuppeteerHookArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { puppeteer_hook: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.puppeteerHookMsg(args), fee || "auto", memo, funds); } + puppeteerHookMsg = (args: PuppeteerHookArgs): { puppeteer_hook: PuppeteerHookArgs } => { return { puppeteer_hook: args }; } stakerHook = async(sender:string, args: StakerHookArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { staker_hook: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.stakerHookMsg(args), fee || "auto", memo, funds); } + stakerHookMsg = (args: StakerHookArgs): { staker_hook: StakerHookArgs } => { return { staker_hook: args }; } resetBondedAmount = async(sender: string, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { reset_bonded_amount: {} }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.resetBondedAmountMsg(), fee || "auto", memo, funds); } + resetBondedAmountMsg = (): { reset_bonded_amount: {} } => { return { reset_bonded_amount: {} } } processEmergencyBatch = async(sender:string, args: ProcessEmergencyBatchArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { process_emergency_batch: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.processEmergencyBatchMsg(args), fee || "auto", memo, funds); } + processEmergencyBatchMsg = (args: ProcessEmergencyBatchArgs): { process_emergency_batch: ProcessEmergencyBatchArgs } => { return { process_emergency_batch: args }; } pause = async(sender: string, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { pause: {} }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.pauseMsg(), fee || "auto", memo, funds); } + pauseMsg = (): { pause: {} } => { return { pause: {} } } unpause = async(sender: string, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { unpause: {} }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.unpauseMsg(), fee || "auto", memo, funds); } + unpauseMsg = (): { unpause: {} } => { return { unpause: {} } } updateOwnership = async(sender:string, args: UpdateOwnershipArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_ownership: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateOwnershipMsg(args), fee || "auto", memo, funds); } + updateOwnershipMsg = (args: UpdateOwnershipArgs): { update_ownership: UpdateOwnershipArgs } => { return { update_ownership: args }; } } diff --git a/ts-client/src/contractLib/dropDistribution.ts b/ts-client/src/contractLib/dropDistribution.ts index 79418eb5..27102e86 100644 --- a/ts-client/src/contractLib/dropDistribution.ts +++ b/ts-client/src/contractLib/dropDistribution.ts @@ -58,7 +58,7 @@ export class Client { this.client = client; this.contractAddress = contractAddress; } - mustBeSigningClient() { + mustBeSigningClient(): Error { return new Error("This client is not a SigningCosmWasmClient"); } static async instantiate( @@ -69,9 +69,10 @@ export class Client { label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], + admin?: string, ): Promise { const res = await client.instantiate(sender, codeId, initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } @@ -84,9 +85,10 @@ export class Client { label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], + admin?: string, ): Promise { const res = await client.instantiate2(sender, codeId, new Uint8Array([salt]), initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } diff --git a/ts-client/src/contractLib/dropFactory.ts b/ts-client/src/contractLib/dropFactory.ts index 231c9aa7..d4d3b1b6 100644 --- a/ts-client/src/contractLib/dropFactory.ts +++ b/ts-client/src/contractLib/dropFactory.ts @@ -1277,7 +1277,7 @@ export class Client { this.client = client; this.contractAddress = contractAddress; } - mustBeSigningClient() { + mustBeSigningClient(): Error { return new Error("This client is not a SigningCosmWasmClient"); } static async instantiate( @@ -1288,9 +1288,10 @@ export class Client { label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], + admin?: string, ): Promise { const res = await client.instantiate(sender, codeId, initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } @@ -1303,9 +1304,10 @@ export class Client { label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], + admin?: string, ): Promise { const res = await client.instantiate2(sender, codeId, new Uint8Array([salt]), initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } @@ -1317,26 +1319,32 @@ export class Client { } updateConfig = async(sender:string, args: UpdateConfigArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_config: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateConfigMsg(args), fee || "auto", memo, funds); } + updateConfigMsg = (args: UpdateConfigArgs): { update_config: UpdateConfigArgs } => { return { update_config: args }; } proxy = async(sender:string, args: ProxyArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { proxy: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.proxyMsg(args), fee || "auto", memo, funds); } + proxyMsg = (args: ProxyArgs): { proxy: ProxyArgs } => { return { proxy: args }; } adminExecute = async(sender:string, args: AdminExecuteArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { admin_execute: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.adminExecuteMsg(args), fee || "auto", memo, funds); } + adminExecuteMsg = (args: AdminExecuteArgs): { admin_execute: AdminExecuteArgs } => { return { admin_execute: args }; } updateOwnership = async(sender:string, args: UpdateOwnershipArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_ownership: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateOwnershipMsg(args), fee || "auto", memo, funds); } + updateOwnershipMsg = (args: UpdateOwnershipArgs): { update_ownership: UpdateOwnershipArgs } => { return { update_ownership: args }; } pause = async(sender: string, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { pause: {} }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.pauseMsg(), fee || "auto", memo, funds); } + pauseMsg = (): { pause: {} } => { return { pause: {} } } unpause = async(sender: string, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { unpause: {} }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.unpauseMsg(), fee || "auto", memo, funds); } + unpauseMsg = (): { unpause: {} } => { return { unpause: {} } } } diff --git a/ts-client/src/contractLib/dropHookTester.ts b/ts-client/src/contractLib/dropHookTester.ts index c573c746..975125f9 100644 --- a/ts-client/src/contractLib/dropHookTester.ts +++ b/ts-client/src/contractLib/dropHookTester.ts @@ -241,7 +241,7 @@ export class Client { this.client = client; this.contractAddress = contractAddress; } - mustBeSigningClient() { + mustBeSigningClient(): Error { return new Error("This client is not a SigningCosmWasmClient"); } static async instantiate( @@ -252,9 +252,10 @@ export class Client { label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], + admin?: string, ): Promise { const res = await client.instantiate(sender, codeId, initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } @@ -267,9 +268,10 @@ export class Client { label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], + admin?: string, ): Promise { const res = await client.instantiate2(sender, codeId, new Uint8Array([salt]), initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } @@ -281,26 +283,32 @@ export class Client { } setConfig = async(sender:string, args: SetConfigArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { set_config: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.setConfigMsg(args), fee || "auto", memo, funds); } + setConfigMsg = (args: SetConfigArgs): { set_config: SetConfigArgs } => { return { set_config: args }; } undelegate = async(sender:string, args: UndelegateArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { undelegate: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.undelegateMsg(args), fee || "auto", memo, funds); } + undelegateMsg = (args: UndelegateArgs): { undelegate: UndelegateArgs } => { return { undelegate: args }; } redelegate = async(sender:string, args: RedelegateArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { redelegate: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.redelegateMsg(args), fee || "auto", memo, funds); } + redelegateMsg = (args: RedelegateArgs): { redelegate: RedelegateArgs } => { return { redelegate: args }; } tokenizeShare = async(sender:string, args: TokenizeShareArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { tokenize_share: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.tokenizeShareMsg(args), fee || "auto", memo, funds); } + tokenizeShareMsg = (args: TokenizeShareArgs): { tokenize_share: TokenizeShareArgs } => { return { tokenize_share: args }; } redeemShare = async(sender:string, args: RedeemShareArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { redeem_share: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.redeemShareMsg(args), fee || "auto", memo, funds); } + redeemShareMsg = (args: RedeemShareArgs): { redeem_share: RedeemShareArgs } => { return { redeem_share: args }; } puppeteerHook = async(sender:string, args: PuppeteerHookArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { puppeteer_hook: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.puppeteerHookMsg(args), fee || "auto", memo, funds); } + puppeteerHookMsg = (args: PuppeteerHookArgs): { puppeteer_hook: PuppeteerHookArgs } => { return { puppeteer_hook: args }; } } diff --git a/ts-client/src/contractLib/dropPriceProvider.ts b/ts-client/src/contractLib/dropPriceProvider.ts index 18ec4a65..737e7702 100644 --- a/ts-client/src/contractLib/dropPriceProvider.ts +++ b/ts-client/src/contractLib/dropPriceProvider.ts @@ -115,7 +115,7 @@ export class Client { this.client = client; this.contractAddress = contractAddress; } - mustBeSigningClient() { + mustBeSigningClient(): Error { return new Error("This client is not a SigningCosmWasmClient"); } static async instantiate( @@ -126,9 +126,10 @@ export class Client { label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], + admin?: string, ): Promise { const res = await client.instantiate(sender, codeId, initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } @@ -141,9 +142,10 @@ export class Client { label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], + admin?: string, ): Promise { const res = await client.instantiate2(sender, codeId, new Uint8Array([salt]), initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } @@ -155,14 +157,17 @@ export class Client { } removeDenom = async(sender:string, args: RemoveDenomArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { remove_denom: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.removeDenomMsg(args), fee || "auto", memo, funds); } + removeDenomMsg = (args: RemoveDenomArgs): { remove_denom: RemoveDenomArgs } => { return { remove_denom: args }; } setPrice = async(sender:string, args: SetPriceArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { set_price: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.setPriceMsg(args), fee || "auto", memo, funds); } + setPriceMsg = (args: SetPriceArgs): { set_price: SetPriceArgs } => { return { set_price: args }; } updateOwnership = async(sender:string, args: UpdateOwnershipArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_ownership: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateOwnershipMsg(args), fee || "auto", memo, funds); } + updateOwnershipMsg = (args: UpdateOwnershipArgs): { update_ownership: UpdateOwnershipArgs } => { return { update_ownership: args }; } } diff --git a/ts-client/src/contractLib/dropProposalVotesPoc.ts b/ts-client/src/contractLib/dropProposalVotesPoc.ts index 6dbdc7e1..5bf85ad4 100644 --- a/ts-client/src/contractLib/dropProposalVotesPoc.ts +++ b/ts-client/src/contractLib/dropProposalVotesPoc.ts @@ -55,7 +55,7 @@ export class Client { this.client = client; this.contractAddress = contractAddress; } - mustBeSigningClient() { + mustBeSigningClient(): Error { return new Error("This client is not a SigningCosmWasmClient"); } static async instantiate( @@ -66,9 +66,10 @@ export class Client { label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], + admin?: string, ): Promise { const res = await client.instantiate(sender, codeId, initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } @@ -81,9 +82,10 @@ export class Client { label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], + admin?: string, ): Promise { const res = await client.instantiate2(sender, codeId, new Uint8Array([salt]), initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } @@ -95,14 +97,17 @@ export class Client { } updateConfig = async(sender:string, args: UpdateConfigArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_config: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateConfigMsg(args), fee || "auto", memo, funds); } + updateConfigMsg = (args: UpdateConfigArgs): { update_config: UpdateConfigArgs } => { return { update_config: args }; } updateActiveProposals = async(sender:string, args: UpdateActiveProposalsArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_active_proposals: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateActiveProposalsMsg(args), fee || "auto", memo, funds); } + updateActiveProposalsMsg = (args: UpdateActiveProposalsArgs): { update_active_proposals: UpdateActiveProposalsArgs } => { return { update_active_proposals: args }; } updateVotersList = async(sender:string, args: UpdateVotersListArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_voters_list: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateVotersListMsg(args), fee || "auto", memo, funds); } + updateVotersListMsg = (args: UpdateVotersListArgs): { update_voters_list: UpdateVotersListArgs } => { return { update_voters_list: args }; } } diff --git a/ts-client/src/contractLib/dropProviderProposalsPoc.ts b/ts-client/src/contractLib/dropProviderProposalsPoc.ts index 70126a1f..20cf8435 100644 --- a/ts-client/src/contractLib/dropProviderProposalsPoc.ts +++ b/ts-client/src/contractLib/dropProviderProposalsPoc.ts @@ -145,7 +145,7 @@ export class Client { this.client = client; this.contractAddress = contractAddress; } - mustBeSigningClient() { + mustBeSigningClient(): Error { return new Error("This client is not a SigningCosmWasmClient"); } static async instantiate( @@ -156,9 +156,10 @@ export class Client { label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], + admin?: string, ): Promise { const res = await client.instantiate(sender, codeId, initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } @@ -171,9 +172,10 @@ export class Client { label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], + admin?: string, ): Promise { const res = await client.instantiate2(sender, codeId, new Uint8Array([salt]), initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } @@ -191,10 +193,12 @@ export class Client { } updateConfig = async(sender:string, args: UpdateConfigArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_config: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateConfigMsg(args), fee || "auto", memo, funds); } + updateConfigMsg = (args: UpdateConfigArgs): { update_config: UpdateConfigArgs } => { return { update_config: args }; } updateProposalVotes = async(sender:string, args: UpdateProposalVotesArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_proposal_votes: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateProposalVotesMsg(args), fee || "auto", memo, funds); } + updateProposalVotesMsg = (args: UpdateProposalVotesArgs): { update_proposal_votes: UpdateProposalVotesArgs } => { return { update_proposal_votes: args }; } } diff --git a/ts-client/src/contractLib/dropPump.ts b/ts-client/src/contractLib/dropPump.ts index 9dabc47b..e0ead87b 100644 --- a/ts-client/src/contractLib/dropPump.ts +++ b/ts-client/src/contractLib/dropPump.ts @@ -167,7 +167,7 @@ export class Client { this.client = client; this.contractAddress = contractAddress; } - mustBeSigningClient() { + mustBeSigningClient(): Error { return new Error("This client is not a SigningCosmWasmClient"); } static async instantiate( @@ -178,9 +178,10 @@ export class Client { label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], + admin?: string, ): Promise { const res = await client.instantiate(sender, codeId, initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } @@ -193,9 +194,10 @@ export class Client { label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], + admin?: string, ): Promise { const res = await client.instantiate2(sender, codeId, new Uint8Array([salt]), initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } @@ -210,22 +212,27 @@ export class Client { } registerICA = async(sender: string, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { register_i_c_a: {} }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.registerICAMsg(), fee || "auto", memo, funds); } + registerICAMsg = (): { register_i_c_a: {} } => { return { register_i_c_a: {} } } push = async(sender:string, args: PushArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { push: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.pushMsg(args), fee || "auto", memo, funds); } + pushMsg = (args: PushArgs): { push: PushArgs } => { return { push: args }; } refund = async(sender:string, args: RefundArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { refund: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.refundMsg(args), fee || "auto", memo, funds); } + refundMsg = (args: RefundArgs): { refund: RefundArgs } => { return { refund: args }; } updateConfig = async(sender:string, args: UpdateConfigArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_config: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateConfigMsg(args), fee || "auto", memo, funds); } + updateConfigMsg = (args: UpdateConfigArgs): { update_config: UpdateConfigArgs } => { return { update_config: args }; } updateOwnership = async(sender:string, args: UpdateOwnershipArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_ownership: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateOwnershipMsg(args), fee || "auto", memo, funds); } + updateOwnershipMsg = (args: UpdateOwnershipArgs): { update_ownership: UpdateOwnershipArgs } => { return { update_ownership: args }; } } diff --git a/ts-client/src/contractLib/dropPuppeteer.ts b/ts-client/src/contractLib/dropPuppeteer.ts index 7aa8a4d1..e05358f9 100644 --- a/ts-client/src/contractLib/dropPuppeteer.ts +++ b/ts-client/src/contractLib/dropPuppeteer.ts @@ -301,7 +301,7 @@ export class Client { this.client = client; this.contractAddress = contractAddress; } - mustBeSigningClient() { + mustBeSigningClient(): Error { return new Error("This client is not a SigningCosmWasmClient"); } static async instantiate( @@ -312,9 +312,10 @@ export class Client { label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], + admin?: string, ): Promise { const res = await client.instantiate(sender, codeId, initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } @@ -327,9 +328,10 @@ export class Client { label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], + admin?: string, ): Promise { const res = await client.instantiate2(sender, codeId, new Uint8Array([salt]), initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } @@ -353,62 +355,77 @@ export class Client { } registerICA = async(sender: string, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { register_i_c_a: {} }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.registerICAMsg(), fee || "auto", memo, funds); } + registerICAMsg = (): { register_i_c_a: {} } => { return { register_i_c_a: {} } } registerQuery = async(sender: string, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { register_query: {} }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.registerQueryMsg(), fee || "auto", memo, funds); } + registerQueryMsg = (): { register_query: {} } => { return { register_query: {} } } registerBalanceAndDelegatorDelegationsQuery = async(sender:string, args: RegisterBalanceAndDelegatorDelegationsQueryArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { register_balance_and_delegator_delegations_query: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.registerBalanceAndDelegatorDelegationsQueryMsg(args), fee || "auto", memo, funds); } + registerBalanceAndDelegatorDelegationsQueryMsg = (args: RegisterBalanceAndDelegatorDelegationsQueryArgs): { register_balance_and_delegator_delegations_query: RegisterBalanceAndDelegatorDelegationsQueryArgs } => { return { register_balance_and_delegator_delegations_query: args }; } registerDelegatorUnbondingDelegationsQuery = async(sender:string, args: RegisterDelegatorUnbondingDelegationsQueryArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { register_delegator_unbonding_delegations_query: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.registerDelegatorUnbondingDelegationsQueryMsg(args), fee || "auto", memo, funds); } + registerDelegatorUnbondingDelegationsQueryMsg = (args: RegisterDelegatorUnbondingDelegationsQueryArgs): { register_delegator_unbonding_delegations_query: RegisterDelegatorUnbondingDelegationsQueryArgs } => { return { register_delegator_unbonding_delegations_query: args }; } registerNonNativeRewardsBalancesQuery = async(sender:string, args: RegisterNonNativeRewardsBalancesQueryArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { register_non_native_rewards_balances_query: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.registerNonNativeRewardsBalancesQueryMsg(args), fee || "auto", memo, funds); } + registerNonNativeRewardsBalancesQueryMsg = (args: RegisterNonNativeRewardsBalancesQueryArgs): { register_non_native_rewards_balances_query: RegisterNonNativeRewardsBalancesQueryArgs } => { return { register_non_native_rewards_balances_query: args }; } setupProtocol = async(sender:string, args: SetupProtocolArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { setup_protocol: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.setupProtocolMsg(args), fee || "auto", memo, funds); } + setupProtocolMsg = (args: SetupProtocolArgs): { setup_protocol: SetupProtocolArgs } => { return { setup_protocol: args }; } undelegate = async(sender:string, args: UndelegateArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { undelegate: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.undelegateMsg(args), fee || "auto", memo, funds); } + undelegateMsg = (args: UndelegateArgs): { undelegate: UndelegateArgs } => { return { undelegate: args }; } redelegate = async(sender:string, args: RedelegateArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { redelegate: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.redelegateMsg(args), fee || "auto", memo, funds); } + redelegateMsg = (args: RedelegateArgs): { redelegate: RedelegateArgs } => { return { redelegate: args }; } tokenizeShare = async(sender:string, args: TokenizeShareArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { tokenize_share: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.tokenizeShareMsg(args), fee || "auto", memo, funds); } + tokenizeShareMsg = (args: TokenizeShareArgs): { tokenize_share: TokenizeShareArgs } => { return { tokenize_share: args }; } redeemShares = async(sender:string, args: RedeemSharesArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { redeem_shares: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.redeemSharesMsg(args), fee || "auto", memo, funds); } + redeemSharesMsg = (args: RedeemSharesArgs): { redeem_shares: RedeemSharesArgs } => { return { redeem_shares: args }; } iBCTransfer = async(sender:string, args: IBCTransferArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { i_b_c_transfer: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.iBCTransferMsg(args), fee || "auto", memo, funds); } + iBCTransferMsg = (args: IBCTransferArgs): { i_b_c_transfer: IBCTransferArgs } => { return { i_b_c_transfer: args }; } transfer = async(sender:string, args: TransferArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { transfer: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.transferMsg(args), fee || "auto", memo, funds); } + transferMsg = (args: TransferArgs): { transfer: TransferArgs } => { return { transfer: args }; } claimRewardsAndOptionalyTransfer = async(sender:string, args: ClaimRewardsAndOptionalyTransferArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { claim_rewards_and_optionaly_transfer: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.claimRewardsAndOptionalyTransferMsg(args), fee || "auto", memo, funds); } + claimRewardsAndOptionalyTransferMsg = (args: ClaimRewardsAndOptionalyTransferArgs): { claim_rewards_and_optionaly_transfer: ClaimRewardsAndOptionalyTransferArgs } => { return { claim_rewards_and_optionaly_transfer: args }; } updateConfig = async(sender:string, args: UpdateConfigArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_config: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateConfigMsg(args), fee || "auto", memo, funds); } + updateConfigMsg = (args: UpdateConfigArgs): { update_config: UpdateConfigArgs } => { return { update_config: args }; } updateOwnership = async(sender:string, args: UpdateOwnershipArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_ownership: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateOwnershipMsg(args), fee || "auto", memo, funds); } + updateOwnershipMsg = (args: UpdateOwnershipArgs): { update_ownership: UpdateOwnershipArgs } => { return { update_ownership: args }; } } diff --git a/ts-client/src/contractLib/dropRewardsManager.ts b/ts-client/src/contractLib/dropRewardsManager.ts index 966c4ea5..d41b2ea3 100644 --- a/ts-client/src/contractLib/dropRewardsManager.ts +++ b/ts-client/src/contractLib/dropRewardsManager.ts @@ -131,7 +131,7 @@ export class Client { this.client = client; this.contractAddress = contractAddress; } - mustBeSigningClient() { + mustBeSigningClient(): Error { return new Error("This client is not a SigningCosmWasmClient"); } static async instantiate( @@ -142,9 +142,10 @@ export class Client { label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], + admin?: string, ): Promise { const res = await client.instantiate(sender, codeId, initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } @@ -157,9 +158,10 @@ export class Client { label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], + admin?: string, ): Promise { const res = await client.instantiate2(sender, codeId, new Uint8Array([salt]), initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } @@ -174,26 +176,32 @@ export class Client { } addHandler = async(sender:string, args: AddHandlerArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { add_handler: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.addHandlerMsg(args), fee || "auto", memo, funds); } + addHandlerMsg = (args: AddHandlerArgs): { add_handler: AddHandlerArgs } => { return { add_handler: args }; } removeHandler = async(sender:string, args: RemoveHandlerArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { remove_handler: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.removeHandlerMsg(args), fee || "auto", memo, funds); } + removeHandlerMsg = (args: RemoveHandlerArgs): { remove_handler: RemoveHandlerArgs } => { return { remove_handler: args }; } exchangeRewards = async(sender:string, args: ExchangeRewardsArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { exchange_rewards: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.exchangeRewardsMsg(args), fee || "auto", memo, funds); } + exchangeRewardsMsg = (args: ExchangeRewardsArgs): { exchange_rewards: ExchangeRewardsArgs } => { return { exchange_rewards: args }; } updateOwnership = async(sender:string, args: UpdateOwnershipArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_ownership: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateOwnershipMsg(args), fee || "auto", memo, funds); } + updateOwnershipMsg = (args: UpdateOwnershipArgs): { update_ownership: UpdateOwnershipArgs } => { return { update_ownership: args }; } pause = async(sender: string, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { pause: {} }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.pauseMsg(), fee || "auto", memo, funds); } + pauseMsg = (): { pause: {} } => { return { pause: {} } } unpause = async(sender: string, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { unpause: {} }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.unpauseMsg(), fee || "auto", memo, funds); } + unpauseMsg = (): { unpause: {} } => { return { unpause: {} } } } diff --git a/ts-client/src/contractLib/dropSplitter.ts b/ts-client/src/contractLib/dropSplitter.ts index 94eff612..d50312a9 100644 --- a/ts-client/src/contractLib/dropSplitter.ts +++ b/ts-client/src/contractLib/dropSplitter.ts @@ -117,7 +117,7 @@ export class Client { this.client = client; this.contractAddress = contractAddress; } - mustBeSigningClient() { + mustBeSigningClient(): Error { return new Error("This client is not a SigningCosmWasmClient"); } static async instantiate( @@ -128,9 +128,10 @@ export class Client { label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], + admin?: string, ): Promise { const res = await client.instantiate(sender, codeId, initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } @@ -143,9 +144,10 @@ export class Client { label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], + admin?: string, ): Promise { const res = await client.instantiate2(sender, codeId, new Uint8Array([salt]), initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } @@ -157,14 +159,17 @@ export class Client { } distribute = async(sender: string, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { distribute: {} }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.distributeMsg(), fee || "auto", memo, funds); } + distributeMsg = (): { distribute: {} } => { return { distribute: {} } } updateConfig = async(sender:string, args: UpdateConfigArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_config: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateConfigMsg(args), fee || "auto", memo, funds); } + updateConfigMsg = (args: UpdateConfigArgs): { update_config: UpdateConfigArgs } => { return { update_config: args }; } updateOwnership = async(sender:string, args: UpdateOwnershipArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_ownership: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateOwnershipMsg(args), fee || "auto", memo, funds); } + updateOwnershipMsg = (args: UpdateOwnershipArgs): { update_ownership: UpdateOwnershipArgs } => { return { update_ownership: args }; } } diff --git a/ts-client/src/contractLib/dropStaker.ts b/ts-client/src/contractLib/dropStaker.ts index 27915eb4..ff59f450 100644 --- a/ts-client/src/contractLib/dropStaker.ts +++ b/ts-client/src/contractLib/dropStaker.ts @@ -206,7 +206,7 @@ export class Client { this.client = client; this.contractAddress = contractAddress; } - mustBeSigningClient() { + mustBeSigningClient(): Error { return new Error("This client is not a SigningCosmWasmClient"); } static async instantiate( @@ -217,9 +217,10 @@ export class Client { label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], + admin?: string, ): Promise { const res = await client.instantiate(sender, codeId, initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } @@ -232,9 +233,10 @@ export class Client { label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], + admin?: string, ): Promise { const res = await client.instantiate2(sender, codeId, new Uint8Array([salt]), initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } @@ -258,22 +260,27 @@ export class Client { } registerICA = async(sender: string, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { register_i_c_a: {} }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.registerICAMsg(), fee || "auto", memo, funds); } + registerICAMsg = (): { register_i_c_a: {} } => { return { register_i_c_a: {} } } stake = async(sender:string, args: StakeArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { stake: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.stakeMsg(args), fee || "auto", memo, funds); } + stakeMsg = (args: StakeArgs): { stake: StakeArgs } => { return { stake: args }; } iBCTransfer = async(sender: string, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { i_b_c_transfer: {} }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.iBCTransferMsg(), fee || "auto", memo, funds); } + iBCTransferMsg = (): { i_b_c_transfer: {} } => { return { i_b_c_transfer: {} } } updateConfig = async(sender:string, args: UpdateConfigArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_config: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateConfigMsg(args), fee || "auto", memo, funds); } + updateConfigMsg = (args: UpdateConfigArgs): { update_config: UpdateConfigArgs } => { return { update_config: args }; } updateOwnership = async(sender:string, args: UpdateOwnershipArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_ownership: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateOwnershipMsg(args), fee || "auto", memo, funds); } + updateOwnershipMsg = (args: UpdateOwnershipArgs): { update_ownership: UpdateOwnershipArgs } => { return { update_ownership: args }; } } diff --git a/ts-client/src/contractLib/dropStrategy.ts b/ts-client/src/contractLib/dropStrategy.ts index 123fc0b3..abf8cbde 100644 --- a/ts-client/src/contractLib/dropStrategy.ts +++ b/ts-client/src/contractLib/dropStrategy.ts @@ -134,7 +134,7 @@ export class Client { this.client = client; this.contractAddress = contractAddress; } - mustBeSigningClient() { + mustBeSigningClient(): Error { return new Error("This client is not a SigningCosmWasmClient"); } static async instantiate( @@ -145,9 +145,10 @@ export class Client { label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], + admin?: string, ): Promise { const res = await client.instantiate(sender, codeId, initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } @@ -160,9 +161,10 @@ export class Client { label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], + admin?: string, ): Promise { const res = await client.instantiate2(sender, codeId, new Uint8Array([salt]), initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } @@ -180,10 +182,12 @@ export class Client { } updateConfig = async(sender:string, args: UpdateConfigArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_config: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateConfigMsg(args), fee || "auto", memo, funds); } + updateConfigMsg = (args: UpdateConfigArgs): { update_config: UpdateConfigArgs } => { return { update_config: args }; } updateOwnership = async(sender:string, args: UpdateOwnershipArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_ownership: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateOwnershipMsg(args), fee || "auto", memo, funds); } + updateOwnershipMsg = (args: UpdateOwnershipArgs): { update_ownership: UpdateOwnershipArgs } => { return { update_ownership: args }; } } diff --git a/ts-client/src/contractLib/dropToken.ts b/ts-client/src/contractLib/dropToken.ts index c2f36e41..1ac1f377 100644 --- a/ts-client/src/contractLib/dropToken.ts +++ b/ts-client/src/contractLib/dropToken.ts @@ -150,7 +150,7 @@ export class Client { this.client = client; this.contractAddress = contractAddress; } - mustBeSigningClient() { + mustBeSigningClient(): Error { return new Error("This client is not a SigningCosmWasmClient"); } static async instantiate( @@ -161,9 +161,10 @@ export class Client { label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], + admin?: string, ): Promise { const res = await client.instantiate(sender, codeId, initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } @@ -176,9 +177,10 @@ export class Client { label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], + admin?: string, ): Promise { const res = await client.instantiate2(sender, codeId, new Uint8Array([salt]), initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } @@ -190,18 +192,22 @@ export class Client { } mint = async(sender:string, args: MintArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { mint: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.mintMsg(args), fee || "auto", memo, funds); } + mintMsg = (args: MintArgs): { mint: MintArgs } => { return { mint: args }; } burn = async(sender: string, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { burn: {} }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.burnMsg(), fee || "auto", memo, funds); } + burnMsg = (): { burn: {} } => { return { burn: {} } } setTokenMetadata = async(sender:string, args: SetTokenMetadataArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { set_token_metadata: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.setTokenMetadataMsg(args), fee || "auto", memo, funds); } + setTokenMetadataMsg = (args: SetTokenMetadataArgs): { set_token_metadata: SetTokenMetadataArgs } => { return { set_token_metadata: args }; } updateOwnership = async(sender:string, args: UpdateOwnershipArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_ownership: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateOwnershipMsg(args), fee || "auto", memo, funds); } + updateOwnershipMsg = (args: UpdateOwnershipArgs): { update_ownership: UpdateOwnershipArgs } => { return { update_ownership: args }; } } diff --git a/ts-client/src/contractLib/dropValidatorsSet.ts b/ts-client/src/contractLib/dropValidatorsSet.ts index 0b57c962..51adc4ea 100644 --- a/ts-client/src/contractLib/dropValidatorsSet.ts +++ b/ts-client/src/contractLib/dropValidatorsSet.ts @@ -235,7 +235,7 @@ export class Client { this.client = client; this.contractAddress = contractAddress; } - mustBeSigningClient() { + mustBeSigningClient(): Error { return new Error("This client is not a SigningCosmWasmClient"); } static async instantiate( @@ -246,9 +246,10 @@ export class Client { label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], + admin?: string, ): Promise { const res = await client.instantiate(sender, codeId, initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } @@ -261,9 +262,10 @@ export class Client { label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], + admin?: string, ): Promise { const res = await client.instantiate2(sender, codeId, new Uint8Array([salt]), initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } @@ -281,22 +283,27 @@ export class Client { } updateConfig = async(sender:string, args: UpdateConfigArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_config: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateConfigMsg(args), fee || "auto", memo, funds); } + updateConfigMsg = (args: UpdateConfigArgs): { update_config: UpdateConfigArgs } => { return { update_config: args }; } updateValidators = async(sender:string, args: UpdateValidatorsArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_validators: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateValidatorsMsg(args), fee || "auto", memo, funds); } + updateValidatorsMsg = (args: UpdateValidatorsArgs): { update_validators: UpdateValidatorsArgs } => { return { update_validators: args }; } updateValidatorsInfo = async(sender:string, args: UpdateValidatorsInfoArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_validators_info: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateValidatorsInfoMsg(args), fee || "auto", memo, funds); } + updateValidatorsInfoMsg = (args: UpdateValidatorsInfoArgs): { update_validators_info: UpdateValidatorsInfoArgs } => { return { update_validators_info: args }; } updateValidatorsVoting = async(sender:string, args: UpdateValidatorsVotingArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_validators_voting: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateValidatorsVotingMsg(args), fee || "auto", memo, funds); } + updateValidatorsVotingMsg = (args: UpdateValidatorsVotingArgs): { update_validators_voting: UpdateValidatorsVotingArgs } => { return { update_validators_voting: args }; } updateOwnership = async(sender:string, args: UpdateOwnershipArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_ownership: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateOwnershipMsg(args), fee || "auto", memo, funds); } + updateOwnershipMsg = (args: UpdateOwnershipArgs): { update_ownership: UpdateOwnershipArgs } => { return { update_ownership: args }; } } diff --git a/ts-client/src/contractLib/dropValidatorsStats.ts b/ts-client/src/contractLib/dropValidatorsStats.ts index 59f60ae1..7052c44d 100644 --- a/ts-client/src/contractLib/dropValidatorsStats.ts +++ b/ts-client/src/contractLib/dropValidatorsStats.ts @@ -75,7 +75,7 @@ export class Client { this.client = client; this.contractAddress = contractAddress; } - mustBeSigningClient() { + mustBeSigningClient(): Error { return new Error("This client is not a SigningCosmWasmClient"); } static async instantiate( @@ -86,9 +86,10 @@ export class Client { label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], + admin?: string, ): Promise { const res = await client.instantiate(sender, codeId, initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } @@ -101,9 +102,10 @@ export class Client { label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], + admin?: string, ): Promise { const res = await client.instantiate2(sender, codeId, new Uint8Array([salt]), initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } @@ -118,6 +120,7 @@ export class Client { } registerStatsQueries = async(sender:string, args: RegisterStatsQueriesArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { register_stats_queries: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.registerStatsQueriesMsg(args), fee || "auto", memo, funds); } + registerStatsQueriesMsg = (args: RegisterStatsQueriesArgs): { register_stats_queries: RegisterStatsQueriesArgs } => { return { register_stats_queries: args }; } } diff --git a/ts-client/src/contractLib/dropWithdrawalManager.ts b/ts-client/src/contractLib/dropWithdrawalManager.ts index 2f94f180..3b58380f 100644 --- a/ts-client/src/contractLib/dropWithdrawalManager.ts +++ b/ts-client/src/contractLib/dropWithdrawalManager.ts @@ -137,7 +137,7 @@ export class Client { this.client = client; this.contractAddress = contractAddress; } - mustBeSigningClient() { + mustBeSigningClient(): Error { return new Error("This client is not a SigningCosmWasmClient"); } static async instantiate( @@ -148,9 +148,10 @@ export class Client { label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], + admin?: string, ): Promise { const res = await client.instantiate(sender, codeId, initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } @@ -163,9 +164,10 @@ export class Client { label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], + admin?: string, ): Promise { const res = await client.instantiate2(sender, codeId, new Uint8Array([salt]), initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } @@ -180,22 +182,27 @@ export class Client { } updateConfig = async(sender:string, args: UpdateConfigArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_config: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateConfigMsg(args), fee || "auto", memo, funds); } + updateConfigMsg = (args: UpdateConfigArgs): { update_config: UpdateConfigArgs } => { return { update_config: args }; } receiveNft = async(sender:string, args: ReceiveNftArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { receive_nft: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.receiveNftMsg(args), fee || "auto", memo, funds); } + receiveNftMsg = (args: ReceiveNftArgs): { receive_nft: ReceiveNftArgs } => { return { receive_nft: args }; } updateOwnership = async(sender:string, args: UpdateOwnershipArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_ownership: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateOwnershipMsg(args), fee || "auto", memo, funds); } + updateOwnershipMsg = (args: UpdateOwnershipArgs): { update_ownership: UpdateOwnershipArgs } => { return { update_ownership: args }; } pause = async(sender: string, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { pause: {} }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.pauseMsg(), fee || "auto", memo, funds); } + pauseMsg = (): { pause: {} } => { return { pause: {} } } unpause = async(sender: string, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { unpause: {} }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.unpauseMsg(), fee || "auto", memo, funds); } + unpauseMsg = (): { unpause: {} } => { return { unpause: {} } } } diff --git a/ts-client/src/contractLib/dropWithdrawalVoucher.ts b/ts-client/src/contractLib/dropWithdrawalVoucher.ts index 2e111e99..5f7f816c 100644 --- a/ts-client/src/contractLib/dropWithdrawalVoucher.ts +++ b/ts-client/src/contractLib/dropWithdrawalVoucher.ts @@ -377,7 +377,7 @@ export class Client { this.client = client; this.contractAddress = contractAddress; } - mustBeSigningClient() { + mustBeSigningClient(): Error { return new Error("This client is not a SigningCosmWasmClient"); } static async instantiate( @@ -388,9 +388,10 @@ export class Client { label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], + admin?: string, ): Promise { const res = await client.instantiate(sender, codeId, initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } @@ -403,9 +404,10 @@ export class Client { label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[], + admin?: string, ): Promise { const res = await client.instantiate2(sender, codeId, new Uint8Array([salt]), initMsg, label, fees, { - ...(initCoins && initCoins.length && { funds: initCoins }), + ...(initCoins && initCoins.length && { funds: initCoins }), ...(admin && { admin: admin }), }); return res; } @@ -453,42 +455,52 @@ export class Client { } transferNft = async(sender:string, args: TransferNftArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { transfer_nft: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.transferNftMsg(args), fee || "auto", memo, funds); } + transferNftMsg = (args: TransferNftArgs): { transfer_nft: TransferNftArgs } => { return { transfer_nft: args }; } sendNft = async(sender:string, args: SendNftArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { send_nft: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.sendNftMsg(args), fee || "auto", memo, funds); } + sendNftMsg = (args: SendNftArgs): { send_nft: SendNftArgs } => { return { send_nft: args }; } approve = async(sender:string, args: ApproveArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { approve: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.approveMsg(args), fee || "auto", memo, funds); } + approveMsg = (args: ApproveArgs): { approve: ApproveArgs } => { return { approve: args }; } revoke = async(sender:string, args: RevokeArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { revoke: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.revokeMsg(args), fee || "auto", memo, funds); } + revokeMsg = (args: RevokeArgs): { revoke: RevokeArgs } => { return { revoke: args }; } approveAll = async(sender:string, args: ApproveAllArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { approve_all: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.approveAllMsg(args), fee || "auto", memo, funds); } + approveAllMsg = (args: ApproveAllArgs): { approve_all: ApproveAllArgs } => { return { approve_all: args }; } revokeAll = async(sender:string, args: RevokeAllArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { revoke_all: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.revokeAllMsg(args), fee || "auto", memo, funds); } + revokeAllMsg = (args: RevokeAllArgs): { revoke_all: RevokeAllArgs } => { return { revoke_all: args }; } mint = async(sender:string, args: MintArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { mint: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.mintMsg(args), fee || "auto", memo, funds); } + mintMsg = (args: MintArgs): { mint: MintArgs } => { return { mint: args }; } burn = async(sender:string, args: BurnArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { burn: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.burnMsg(args), fee || "auto", memo, funds); } + burnMsg = (args: BurnArgs): { burn: BurnArgs } => { return { burn: args }; } extension = async(sender:string, args: ExtensionArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { extension: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.extensionMsg(args), fee || "auto", memo, funds); } + extensionMsg = (args: ExtensionArgs): { extension: ExtensionArgs } => { return { extension: args }; } updateOwnership = async(sender:string, args: UpdateOwnershipArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } - return this.client.execute(sender, this.contractAddress, { update_ownership: args }, fee || "auto", memo, funds); + return this.client.execute(sender, this.contractAddress, this.updateOwnershipMsg(args), fee || "auto", memo, funds); } + updateOwnershipMsg = (args: UpdateOwnershipArgs): { update_ownership: UpdateOwnershipArgs } => { return { update_ownership: args }; } } diff --git a/ts-client/yarn.lock b/ts-client/yarn.lock index a79e5ea8..e883dff3 100644 --- a/ts-client/yarn.lock +++ b/ts-client/yarn.lock @@ -486,10 +486,9 @@ events "^3.3.0" protobufjs "^7.2.0" -"@neutron-org/contracts2ts@1.4.6": - version "1.4.6" - resolved "https://registry.yarnpkg.com/@neutron-org/contracts2ts/-/contracts2ts-1.4.6.tgz#81b3c8ac675d9ce50ab51da4dfd2a27376b99d3e" - integrity sha512-se2DswFcGoXB2iTK14BJ5FxHSqOPxZRiJZyG7UT8QtIVNeBMogFeUub29zoJUBYpRtoxgQO8OOHF5vBS4hWM/g== +"@neutron-org/contracts2ts@neutron-org/contracts2ts#instantiate_admin_support": + version "1.5.0" + resolved "https://codeload.github.com/neutron-org/contracts2ts/tar.gz/fd12ed5eaafaf5bb86bf2aec1efb404b886b7680" dependencies: "@apidevtools/json-schema-ref-parser" "^11.5.4" "@cosmjs/cosmwasm-stargate" "^0.32.4"