From 1be9ae72d4e8cc04ae310b83812518fb7323d850 Mon Sep 17 00:00:00 2001 From: nhpd Date: Thu, 10 Oct 2024 18:53:59 +0400 Subject: [PATCH] remove bindings --- contracts/ibc_transfer/Cargo.toml | 1 + contracts/ibc_transfer/src/contract.rs | 72 +-- .../src/contract.rs | 30 +- .../neutron_interchain_txs/src/contract.rs | 2 - packages/neutron-sdk/Cargo.toml | 1 + .../neutron-sdk/src/bin/neutron-sdk-schema.rs | 13 +- packages/neutron-sdk/src/bindings/dex/mod.rs | 3 - packages/neutron-sdk/src/bindings/dex/msg.rs | 102 ---- .../neutron-sdk/src/bindings/dex/query.rs | 231 -------- .../neutron-sdk/src/bindings/dex/types.rs | 199 ------- .../neutron-sdk/src/bindings/marketmap/mod.rs | 2 - .../src/bindings/marketmap/query.rs | 48 -- .../src/bindings/marketmap/types.rs | 84 --- packages/neutron-sdk/src/bindings/mod.rs | 4 - packages/neutron-sdk/src/bindings/msg.rs | 505 +----------------- .../neutron-sdk/src/bindings/oracle/mod.rs | 2 - .../neutron-sdk/src/bindings/oracle/query.rs | 40 -- .../neutron-sdk/src/bindings/oracle/types.rs | 23 - packages/neutron-sdk/src/bindings/query.rs | 171 ------ packages/neutron-sdk/src/lib.rs | 1 - packages/neutron-sdk/src/query/min_ibc_fee.rs | 18 - packages/neutron-sdk/src/query/mod.rs | 3 - .../neutron-sdk/src/query/token_factory.rs | 54 -- .../src/query/total_burned_neutrons.rs | 18 - 24 files changed, 59 insertions(+), 1568 deletions(-) delete mode 100644 packages/neutron-sdk/src/bindings/dex/mod.rs delete mode 100644 packages/neutron-sdk/src/bindings/dex/msg.rs delete mode 100644 packages/neutron-sdk/src/bindings/dex/query.rs delete mode 100644 packages/neutron-sdk/src/bindings/dex/types.rs delete mode 100644 packages/neutron-sdk/src/bindings/marketmap/mod.rs delete mode 100644 packages/neutron-sdk/src/bindings/marketmap/query.rs delete mode 100644 packages/neutron-sdk/src/bindings/marketmap/types.rs delete mode 100644 packages/neutron-sdk/src/bindings/oracle/mod.rs delete mode 100644 packages/neutron-sdk/src/bindings/oracle/query.rs delete mode 100644 packages/neutron-sdk/src/bindings/oracle/types.rs delete mode 100644 packages/neutron-sdk/src/bindings/query.rs delete mode 100644 packages/neutron-sdk/src/query/min_ibc_fee.rs delete mode 100644 packages/neutron-sdk/src/query/mod.rs delete mode 100644 packages/neutron-sdk/src/query/token_factory.rs delete mode 100644 packages/neutron-sdk/src/query/total_burned_neutrons.rs diff --git a/contracts/ibc_transfer/Cargo.toml b/contracts/ibc_transfer/Cargo.toml index e53f6dae..c253a0d7 100644 --- a/contracts/ibc_transfer/Cargo.toml +++ b/contracts/ibc_transfer/Cargo.toml @@ -26,6 +26,7 @@ serde-json-wasm = { workspace = true } cw-storage-plus = { workspace = true, features = ["iterator"]} cosmwasm-schema = { workspace = true } neutron-sdk = { path = "../../packages/neutron-sdk", default-features = false } +neutron-std = "4.2.2-rc" [dev-dependencies] cosmwasm-schema = { workspace = true } diff --git a/contracts/ibc_transfer/src/contract.rs b/contracts/ibc_transfer/src/contract.rs index 46ddeb0c..187c06c6 100644 --- a/contracts/ibc_transfer/src/contract.rs +++ b/contracts/ibc_transfer/src/contract.rs @@ -3,20 +3,17 @@ use cosmwasm_std::{ StdError, StdResult, SubMsg, }; use cw2::set_contract_version; +use neutron_std::types::neutron::transfer::MsgTransfer; use neutron_sdk::interchain_txs::helpers::decode_message_response; -use neutron_sdk::proto_types::neutron::transfer::MsgTransferResponse; +use neutron_sdk::proto_types::neutron::transfer::{MsgTransferResponse}; use neutron_sdk::{ - bindings::{ - msg::{IbcFee, NeutronMsg}, - query::NeutronQuery, - }, - query::min_ibc_fee::query_min_ibc_fee, sudo::msg::{RequestPacket, RequestPacketTimeoutHeight, TransferSudoMsg}, NeutronResult, }; +use neutron_std::types::cosmos::base::v1beta1::Coin as SuperCoin; // TODO: rename use schemars::JsonSchema; use serde::{Deserialize, Serialize}; - +use neutron_sdk::proto_types::neutron::feerefunder::{Fee, FeerefunderQuerier}; use crate::{ msg::{ExecuteMsg, InstantiateMsg, MigrateMsg}, state::{ @@ -45,11 +42,11 @@ pub fn instantiate( #[entry_point] pub fn execute( - deps: DepsMut, + deps: DepsMut, env: Env, _: MessageInfo, msg: ExecuteMsg, -) -> NeutronResult> { +) -> StdResult { match msg { // NOTE: this is an example contract that shows how to make IBC transfers! // Please add necessary authorization or other protection mechanisms @@ -100,7 +97,7 @@ pub enum SudoPayload { // saves payload to process later to the storage and returns a SubmitTX Cosmos SubMsg with necessary reply id fn msg_with_sudo_callback>, T>( - deps: DepsMut, + deps: DepsMut, msg: C, payload: SudoPayload, ) -> StdResult> { @@ -143,46 +140,44 @@ pub fn reply(deps: DepsMut, env: Env, msg: Reply) -> StdResult { } fn execute_send( - mut deps: DepsMut, + mut deps: DepsMut, env: Env, channel: String, to: String, denom: String, amount: u128, timeout_height: Option, -) -> NeutronResult> { +) -> StdResult { // contract must pay for relaying of acknowledgements // See more info here: https://docs.neutron.org/neutron/feerefunder/overview - let fee = min_ntrn_ibc_fee(query_min_ibc_fee(deps.as_ref())?.min_fee); - let coin1 = coin(amount, denom.clone()); - let msg1 = NeutronMsg::IbcTransfer { + let fee = min_ntrn_ibc_fee(query_min_fee(deps.as_ref())?); + let msg1 = MsgTransfer { source_port: "transfer".to_string(), source_channel: channel.clone(), sender: env.contract.address.to_string(), receiver: to.clone(), - token: coin1, - timeout_height: RequestPacketTimeoutHeight { - revision_number: Some(2), - revision_height: timeout_height.or(Some(DEFAULT_TIMEOUT_HEIGHT)), - }, + token: Some(SuperCoin{ denom: denom.clone(), amount: amount.to_string() }), + timeout_height: Some(neutron_std::types::ibc::core::client::v1::Height { + revision_number: 2, + revision_height: timeout_height.unwrap_or_else(|| DEFAULT_TIMEOUT_HEIGHT), + }), timeout_timestamp: 0, memo: "".to_string(), - fee: fee.clone(), + fee: Some(fee.clone()), }; - let coin2 = coin(2 * amount, denom); - let msg2 = NeutronMsg::IbcTransfer { + let msg2 = MsgTransfer { source_port: "transfer".to_string(), source_channel: channel, sender: env.contract.address.to_string(), receiver: to, - token: coin2, - timeout_height: RequestPacketTimeoutHeight { - revision_number: Some(2), - revision_height: timeout_height.or(Some(DEFAULT_TIMEOUT_HEIGHT)), - }, + token: Some(SuperCoin{ denom, amount: (2 * amount).to_string() }), + timeout_height: Some(neutron_std::types::ibc::core::client::v1::Height { + revision_number: 2, + revision_height: timeout_height.unwrap_or_else(|| DEFAULT_TIMEOUT_HEIGHT), + }), timeout_timestamp: 0, memo: "".to_string(), - fee, + fee: Some(fee.clone()), }; // prepare first transfer message with payload of Type1 let submsg1 = msg_with_sudo_callback( @@ -279,17 +274,26 @@ pub fn migrate(deps: DepsMut, _env: Env, _msg: MigrateMsg) -> StdResult IbcFee { - IbcFee { - recv_fee: fee.recv_fee, +fn query_min_fee(deps: Deps) -> StdResult { + let querier = FeerefunderQuerier::new(&deps.querier); + let params = querier.params()?; + let params_inner = params.params.ok_or_else(|| StdError::generic_err("no params found for feerefunder"))?; + let min_fee = params_inner.min_fee.ok_or_else(|| StdError::generic_err("no minimum fee param for feerefunder"))?; + + Ok(min_fee) +} + +fn min_ntrn_ibc_fee(fee: Fee) -> neutron_std::types::neutron::feerefunder::Fee { + neutron_std::types::neutron::feerefunder::Fee { + recv_fee: fee.recv_fee.iter().map(|r| SuperCoin{ denom: r.denom.to_string(), amount: r.amount.clone() } ).collect(), ack_fee: fee .ack_fee - .into_iter() + .iter().map(|r| SuperCoin{ denom: r.denom.to_string(), amount: r.amount.clone() } ) .filter(|a| a.denom == FEE_DENOM) .collect(), timeout_fee: fee .timeout_fee - .into_iter() + .iter().map(|r| SuperCoin{ denom: r.denom.to_string(), amount: r.amount.clone() } ) .filter(|a| a.denom == FEE_DENOM) .collect(), } diff --git a/contracts/neutron_interchain_queries/src/contract.rs b/contracts/neutron_interchain_queries/src/contract.rs index 53e94f0d..ac5e723a 100644 --- a/contracts/neutron_interchain_queries/src/contract.rs +++ b/contracts/neutron_interchain_queries/src/contract.rs @@ -63,11 +63,11 @@ pub fn instantiate( #[cfg_attr(not(feature = "library"), entry_point)] pub fn execute( - _deps: DepsMut, + _deps: DepsMut, _env: Env, _: MessageInfo, msg: ExecuteMsg, -) -> NeutronResult> { +) -> NeutronResult { match msg { ExecuteMsg::RegisterBalancesQuery { connection_id, @@ -148,7 +148,7 @@ pub fn register_balances_query( addr: String, denoms: Vec, update_period: u64, -) -> NeutronResult> { +) -> NeutronResult { let msg = new_register_balances_query_msg(connection_id, addr, denoms, update_period)?; Ok(Response::new().add_message(msg)) @@ -158,7 +158,7 @@ pub fn register_bank_total_supply_query( connection_id: String, denoms: Vec, update_period: u64, -) -> NeutronResult> { +) -> NeutronResult { let msg = new_register_bank_total_supply_query_msg(connection_id, denoms, update_period)?; Ok(Response::new().add_message(msg)) @@ -167,7 +167,7 @@ pub fn register_bank_total_supply_query( pub fn register_distribution_fee_pool_query( connection_id: String, update_period: u64, -) -> NeutronResult> { +) -> NeutronResult { let msg = new_register_distribution_fee_pool_query_msg(connection_id, update_period)?; Ok(Response::new().add_message(msg)) @@ -177,7 +177,7 @@ pub fn register_gov_proposal_query( connection_id: String, proposals_ids: Vec, update_period: u64, -) -> NeutronResult> { +) -> NeutronResult { let msg = new_register_gov_proposals_query_msg(connection_id, proposals_ids, update_period)?; Ok(Response::new().add_message(msg)) @@ -187,7 +187,7 @@ pub fn register_staking_validators_query( connection_id: String, validators: Vec, update_period: u64, -) -> NeutronResult> { +) -> NeutronResult { let msg = new_register_staking_validators_query_msg(connection_id, validators, update_period)?; Ok(Response::new().add_message(msg)) @@ -197,7 +197,7 @@ pub fn register_validators_signing_infos_query( connection_id: String, validators: Vec, update_period: u64, -) -> NeutronResult> { +) -> NeutronResult { let msg = new_register_validators_signing_infos_query_msg(connection_id, validators, update_period)?; @@ -209,7 +209,7 @@ pub fn register_delegations_query( delegator: String, validators: Vec, update_period: u64, -) -> NeutronResult> { +) -> NeutronResult { let msg = new_register_delegator_delegations_query_msg( connection_id, delegator, @@ -225,7 +225,7 @@ pub fn register_unbonding_delegations_query( delegator: String, validators: Vec, update_period: u64, -) -> NeutronResult> { +) -> NeutronResult { let msg = new_register_delegator_unbonding_delegations_query_msg( connection_id, delegator, @@ -241,7 +241,7 @@ pub fn register_transfers_query( recipient: String, update_period: u64, min_height: Option, -) -> NeutronResult> { +) -> NeutronResult { let msg = new_register_transfers_query_msg(connection_id, recipient, update_period, min_height)?; @@ -253,7 +253,7 @@ pub fn register_cw20_balance_query( update_period: u64, cw20_contract_address: String, account_address: String, -) -> NeutronResult> { +) -> NeutronResult { // cw_storage_plus uses this prefix for maps let mut storage_key = vec![0u8, 7u8]; @@ -275,7 +275,7 @@ pub fn update_interchain_query( new_keys: Option>, new_update_period: Option, new_recipient: Option, -) -> NeutronResult> { +) -> NeutronResult { let new_filter = new_recipient.map(|recipient| { vec![TransactionFilterItem { field: RECIPIENT_FIELD.to_string(), @@ -289,13 +289,13 @@ pub fn update_interchain_query( Ok(Response::new().add_message(update_msg)) } -pub fn remove_interchain_query(query_id: u64) -> NeutronResult> { +pub fn remove_interchain_query(query_id: u64) -> NeutronResult { let remove_msg = NeutronMsg::remove_interchain_query(query_id); Ok(Response::new().add_message(remove_msg)) } #[cfg_attr(not(feature = "library"), entry_point)] -pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> NeutronResult { +pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> NeutronResult { match msg { //TODO: check if query.result.height is too old (for all interchain queries) QueryMsg::Balance { query_id } => Ok(to_json_binary(&query_balance(deps, env, query_id)?)?), diff --git a/contracts/neutron_interchain_txs/src/contract.rs b/contracts/neutron_interchain_txs/src/contract.rs index a23cb4b5..cddab948 100644 --- a/contracts/neutron_interchain_txs/src/contract.rs +++ b/contracts/neutron_interchain_txs/src/contract.rs @@ -22,12 +22,10 @@ use neutron_sdk::proto_types::neutron::interchaintxs::v1::MsgSubmitTxResponse; use neutron_sdk::{ bindings::{ msg::NeutronMsg, - query::{NeutronQuery, QueryInterchainAccountAddressResponse}, types::ProtobufAny, }, interchain_txs::helpers::{decode_message_response, get_port_id}, interchain_txs::v047::helpers::decode_acknowledgement_response, - query::min_ibc_fee::query_min_ibc_fee, sudo::msg::{RequestPacket, SudoMsg}, NeutronError, NeutronResult, }; diff --git a/packages/neutron-sdk/Cargo.toml b/packages/neutron-sdk/Cargo.toml index ad1fcfc0..5d710d23 100644 --- a/packages/neutron-sdk/Cargo.toml +++ b/packages/neutron-sdk/Cargo.toml @@ -25,6 +25,7 @@ prost-types = { workspace = true } tendermint-proto = { workspace = true } speedate = { workspace = true } chrono = { version = "0.4.22", default-features = false } +neutron-std = { version = "4.2.2-rc" } neutron-std-derive = { version = "0.20.1", path = "../neutron-std-derive" } [dev-dependencies] diff --git a/packages/neutron-sdk/src/bin/neutron-sdk-schema.rs b/packages/neutron-sdk/src/bin/neutron-sdk-schema.rs index 6132c48b..31ce2532 100644 --- a/packages/neutron-sdk/src/bin/neutron-sdk-schema.rs +++ b/packages/neutron-sdk/src/bin/neutron-sdk-schema.rs @@ -1,14 +1,3 @@ -use std::env::current_dir; -use std::fs::create_dir_all; - -use cosmwasm_schema::{export_schema, remove_schemas, schema_for}; -use neutron_sdk::bindings::{msg::NeutronMsg, query::NeutronQuery}; - fn main() { - let mut out_dir = current_dir().unwrap(); - out_dir.push("schema"); - create_dir_all(&out_dir).unwrap(); - remove_schemas(&out_dir).unwrap(); - export_schema(&schema_for!(NeutronMsg), &out_dir); - export_schema(&schema_for!(NeutronQuery), &out_dir); + // TODO: remove this file } diff --git a/packages/neutron-sdk/src/bindings/dex/mod.rs b/packages/neutron-sdk/src/bindings/dex/mod.rs deleted file mode 100644 index 299b4f33..00000000 --- a/packages/neutron-sdk/src/bindings/dex/mod.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub mod msg; -pub mod query; -pub mod types; diff --git a/packages/neutron-sdk/src/bindings/dex/msg.rs b/packages/neutron-sdk/src/bindings/dex/msg.rs deleted file mode 100644 index d1e06baa..00000000 --- a/packages/neutron-sdk/src/bindings/dex/msg.rs +++ /dev/null @@ -1,102 +0,0 @@ -use crate::bindings::dex::types::LimitOrderType; -use cosmwasm_std::Uint128; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -use super::types::{DepositOptions, MultiHopRoute, PrecDec}; - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub enum DexMsg { - /// Deposit provides liquidity to a specific trading pair by depositing tokens - /// at a specific price into one or both sides of the pair in “a liquidity pool” - Deposit { - /// The account to which PoolShares will be issued - receiver: String, - /// Denom for one side of the deposit - token_a: String, - /// Denom for the opposing side of the deposit - token_b: String, - /// Amounts of tokenA to deposit - amounts_a: Vec, - /// Amounts of tokenB to deposit - amounts_b: Vec, - /// Tick indexes to deposit at defined in terms of TokenA to TokenB (ie. TokenA is on the left) - tick_indexes_a_to_b: Vec, - /// Fees to use for each deposit - fees: Vec, - /// Additional deposit options - options: Vec, - }, - /// Withdraw is used to redeem PoolShares for the user’s pro-rata - /// portion of tokens within a liquidity pool. Users can withdraw from a pool at any time - Withdrawal { - /// The account to which the tokens are credited - receiver: String, - /// Denom for one side of the deposit - token_a: String, - /// Denom for the opposing side of the deposit - token_b: String, - /// Amount of shares to remove from each pool - shares_to_remove: Vec, - /// Tick indexes of the target LiquidityPools defined in terms of TokenA to TokenB - /// (ie. TokenA is on the left) - tick_indexes_a_to_b: Vec, - /// Fee for the target LiquidityPools - fees: Vec, - }, - /// PlaceLimitOrder provides the primary mechanism for trading on the Duality Dex. Limit - /// orders can provide liquidity to the Dex (“Maker Limit Orders”) and/or can be used to - /// trade against preexisting liquidity (“Taker Limit Orders”) - PlaceLimitOrder { - /// Account to which TokenOut is credited or that will be allowed to - /// withdraw or cancel a maker order - receiver: String, - /// Token being “sold” - token_in: String, - /// Token being “bought” - token_out: String, - /// Limit tick for a limit order, specified in terms of TokenIn to TokenOut - tick_index_in_to_out: i64, - /// Amount of TokenIn to be traded - amount_in: Uint128, - /// Type of limit order to be used. Must be one of: - /// GOOD_TIL_CANCELLED, FILL_OR_KILL, IMMEDIATE_OR_CANCEL, JUST_IN_TIME, or GOOD_TIL_TIME - order_type: LimitOrderType, - // expirationTime is only valid if orderType == GOOD_TIL_TIME. - /// Expiration time for order. Only valid for GOOD_TIL_TIME limit orders - expiration_time: Option, - /// Maximum amount of TokenB can be bought. For everything except JUST_IN_TIME OrderType - max_amount_out: Option, - /// Accepts standard decimals and decimals with scientific notation (ie. 1234.23E-7) - limit_sell_price: String, - }, - /// WithdrawFilledLimitOrder. Once a limit order has been filled – either partially or in - /// its entirety, it can be withdrawn at any time. Withdrawing from a limit order credits - /// all available proceeds to the user. Withdraw can be called on a limit order multiple - /// times as new proceeds become available - WithdrawFilledLimitOrder { - /// TrancheKey for the target limit order - tranche_key: String, - }, - /// CancelLimitOrder. Standard Taker limit orders (Good-til-cancelled & Good-til-Time) - /// can be canceled at any time if they have not been completely filled - CancelLimitOrder { - /// TrancheKey for the target limit order - tranche_key: String, - }, - /// MultiHopSwap provides a swapping mechanism to achieve better prices by routing - /// through a series of pools - MultiHopSwap { - /// Account to which TokenOut is credited - receiver: String, - /// Array of possible routes - routes: Vec, - /// Amount of TokenIn to swap - amount_in: Uint128, - /// Minimum price that that must be satisfied for a route to succeed - exit_limit_price: PrecDec, - /// If true all routes are run and the route with the best price is used - pick_best_route: bool, - }, -} diff --git a/packages/neutron-sdk/src/bindings/dex/query.rs b/packages/neutron-sdk/src/bindings/dex/query.rs deleted file mode 100644 index 0f39f74b..00000000 --- a/packages/neutron-sdk/src/bindings/dex/query.rs +++ /dev/null @@ -1,231 +0,0 @@ -use crate::bindings::dex::types::{ - DepositRecord, LimitOrderTranche, LimitOrderTrancheUser, LimitOrderType, MultiHopRoute, Params, - Pool, PoolMetadata, PoolReserves, PrecDec, TickLiquidity, -}; -use crate::bindings::query::{PageRequest, PageResponse}; -use cosmwasm_std::{Coin, Int128}; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub enum DexQuery { - /// Parameters queries the parameters of the module. - Params {}, - /// Queries a LimitOrderTrancheUser by index. - LimitOrderTrancheUser { - address: String, - tranche_key: String, - }, - /// Queries a list of LimitOrderTrancheMap items. - LimitOrderTrancheUserAll { pagination: Option }, - /// Queries a list of LimitOrderTrancheUser items for a given address. - LimitOrderTrancheUserAllByAddress { - address: String, - pagination: Option, - }, - /// Queries a LimitOrderTranche by index. - LimitOrderTranche { - pair_id: String, - tick_index: i64, - token_in: String, - tranche_key: String, - }, - /// Queries a list of LimitOrderTranche items for a given pairID / TokenIn combination. - LimitOrderTrancheAll { - pair_id: String, - token_in: String, - pagination: Option, - }, - /// Queries a list of UserDeposits items. - UserDepositAll { - address: String, - include_pool_data: bool, - pagination: Option, - }, - /// Queries a list of TickLiquidity items. - TickLiquidityAll { - pair_id: String, - token_in: String, - pagination: Option, - }, - /// Queries a InactiveLimitOrderTranche by index. - InactiveLimitOrderTranche { - pair_id: String, - tick_index: i64, - token_in: String, - tranche_key: String, - }, - /// Queries a list of InactiveLimitOrderTranche items. - InactiveLimitOrderTrancheAll { pagination: Option }, - /// Queries a list of PoolReserves items. - PoolReservesAll { - pair_id: String, - token_in: String, - pagination: Option, - }, - /// Queries a PoolReserve by index - PoolReserves { - pair_id: String, - token_in: String, - tick_index: i64, - fee: u64, - }, - /// Queries the simulated result of a multihop swap - EstimateMultiHopSwap { - creator: String, - receiver: String, - routes: Vec, - amount_in: Int128, - exit_limit_price: PrecDec, - pick_best_route: bool, - }, - /// Queries the simulated result of a PlaceLimit order - EstimatePlaceLimitOrder { - creator: String, - receiver: String, - token_in: String, - token_out: String, - tick_index_in_to_out: i64, - amount_in: Int128, - order_type: LimitOrderType, - // expirationTime is only valid iff orderType == GOOD_TIL_TIME. - expiration_time: Option, - max_amount_out: Option, - }, - /// Queries a pool by pair, tick and fee - Pool { - pair_id: String, - tick_index: i64, - fee: u64, - }, - /// Queries a pool by ID - #[serde(rename = "pool_by_id")] - PoolByID { pool_id: u64 }, - /// Queries a PoolMetadata by ID - PoolMetadata { id: u64 }, - /// Queries a list of PoolMetadata items. - PoolMetadataAll { pagination: Option }, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct ParamsResponse { - pub params: Params, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct LimitOrderTrancheUserResponse { - pub limit_order_tranche_user: Option, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct AllLimitOrderTrancheUserResponse { - #[serde(default)] - pub limit_order_tranche_user: Vec, - pub pagination: Option, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, Default)] -#[serde(rename_all = "snake_case")] -pub struct AllUserLimitOrdersResponse { - #[serde(default)] - pub limit_orders: Vec, - pub pagination: Option, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct LimitOrderTrancheResponse { - pub limit_order_tranche: Option, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, Default)] -#[serde(rename_all = "snake_case")] -pub struct AllLimitOrderTrancheResponse { - #[serde(default)] - pub limit_order_tranche: Vec, - pub pagination: Option, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, Default)] -#[serde(rename_all = "snake_case")] -pub struct AllUserDepositsResponse { - #[serde(default)] - pub deposits: Vec, - pub pagination: Option, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct AllTickLiquidityResponse { - pub tick_liquidity: Vec, - pub pagination: Option, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct InactiveLimitOrderTrancheResponse { - pub inactive_limit_order_tranche: LimitOrderTranche, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct AllInactiveLimitOrderTrancheResponse { - pub inactive_limit_order_tranche: Vec, - pub pagination: Option, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct AllPoolReservesResponse { - pub pool_reserves: Vec, - pub pagination: Option, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct PoolReservesResponse { - pub pool_reserves: PoolReserves, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct EstimateMultiHopSwapResponse { - pub coin_out: Coin, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct EstimatePlaceLimitOrderResponse { - /// Total amount of coin used for the limit order - /// You can derive makerLimitInCoin using the equation: totalInCoin = swapInCoin + makerLimitInCoin - pub total_in_coin: Coin, - /// Total amount of the token in that was immediately swapped for swapOutCoin - pub swap_in_coin: Coin, - /// Total amount of coin received from the taker portion of the limit order - /// This is the amount of coin immediately available in the users account after executing the - /// limit order. It does not include any future proceeds from the maker portion which will have withdrawn in the future - pub swap_out_coin: Coin, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct PoolResponse { - pub pool: Pool, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct PoolMetadataResponse { - pub pool_metadata: PoolMetadata, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct AllPoolMetadataResponse { - pub pool_metadata: Vec, - pub pagination: Option, -} diff --git a/packages/neutron-sdk/src/bindings/dex/types.rs b/packages/neutron-sdk/src/bindings/dex/types.rs deleted file mode 100644 index 58c4742b..00000000 --- a/packages/neutron-sdk/src/bindings/dex/types.rs +++ /dev/null @@ -1,199 +0,0 @@ -use cosmwasm_std::Int128; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, Default)] -#[serde(rename_all = "SCREAMING_SNAKE_CASE")] -pub enum LimitOrderType { - #[default] - /// Good-til-Cancelled limit orders are hybrid maker and taker limit orders. - /// They will attempt to trade the supplied AmountIn at the TickIndex or better. - /// However, if they total AmountIn cannot be traded at the limit price they are remaining - /// amount will be placed as a maker limit order. The proceeds from the taker portion - /// are deposited into the user’s account immediately, however, the proceeds from the - /// maker portion must be explicitly withdrawn via WithdrawLimitOrder. - GoodTilCancelled, - /// Fill-or-Kill limit orders are taker limit orders that either successfully swap 100% - /// of the supplied AmountIn or return an error. If there is insufficient liquidity to - /// complete the trade at or above the supplied TickIndex a Fill-or-Kill order will - /// return an error `codespace: dex, code: 1134` - /// ( ErrGoodTilOrderWithoutExpiration). - FillOrKill, - /// Immediate-or-Cancel limit orders are taker orders that will swap as much as of the - /// AmountIn as possible given available liquidity above the supplied TickIndex. - /// Unlike Fill-or-Kill orders they will still successfully complete even if they - /// are only able to partially trade through the AmountIn at the TickIndex or better. - ImmediateOrCancel, - /// Just-in-Time limit orders are an advanced maker limit order that provides tradeable - /// liquidity for exactly one block. At the end of the same block in which the Just-in-Time - /// order was submitted the order is canceled and any untraded portion will no longer be - /// usable as active liquidity. - JustInTime, - /// Good-til-Time limit order function exactly the same as Good-til-Cancelled limit orders - /// first trying to trade as a taker limit order and then placing any remaining amount - /// as a maker limit order. However, the maker portion of the limit order has a specified ExpirationTime. - /// After the ExpirationTime the order will be cancelled and can no longer be traded against. - /// When withdrawing a Good-til-Time limit order the user will receive both the successfully - /// traded portion of the limit order (TokenOut) as well as any remaining untraded amount (TokenIn). - GoodTilTime, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, Default)] -#[serde(rename_all = "snake_case", default)] -pub struct LimitOrderTrancheUser { - pub trade_pair_id: TradePairID, - pub tick_index_taker_to_maker: i64, - pub tranche_key: String, - pub address: String, - pub shares_owned: Int128, - pub shares_withdrawn: Int128, - pub shares_cancelled: Int128, - pub order_type: LimitOrderType, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct LimitOrderTrancheKey { - pub trade_pair_id: TradePairID, - pub tick_index_taker_to_maker: i64, - pub tranche_key: String, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct LimitOrderTranche { - pub key: LimitOrderTrancheKey, - pub reserves_maker_denom: Int128, - pub reserves_taker_denom: Int128, - pub total_maker_denom: Int128, - pub total_taker_denom: Int128, - pub expiration_time: Option, - pub price_taker_to_maker: PrecDec, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, Default)] -#[serde(rename_all = "snake_case")] -pub struct TradePairID { - pub maker_denom: String, - pub taker_denom: String, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, Default)] -#[serde(rename_all = "snake_case")] -pub struct FailedDeposit { - pub deposit_idx: Option, - pub error: Option, -} - -// TODO implement math for PrecDec -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -#[serde(from = "String")] -#[serde(into = "String")] -pub struct PrecDec { - pub i: String, -} - -#[allow(clippy::from_over_into)] -impl Into for PrecDec { - fn into(self) -> String { - self.i - } -} - -impl From for PrecDec { - fn from(value: String) -> Self { - PrecDec { i: value } - } -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct DepositOptions { - pub disable_autoswap: Option, - pub fail_tx_on_bel: Option, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct MultiHopRoute { - pub hops: Vec, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct Params { - pub fee_tiers: Vec, - pub paused: bool, - pub max_jits_per_block: u64, - pub good_til_purge_allowance: u64, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, Default)] -#[serde(rename_all = "snake_case")] -#[serde(default)] -pub struct PoolMetadata { - pub id: u64, - pub tick: i64, - pub fee: u64, - pub pair_id: PairID, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct Pool { - #[serde(default)] - pub id: u64, - pub lower_tick0: Option, - pub upper_tick1: Option, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct DepositRecord { - pub pair_id: PairID, - pub shares_owned: Int128, - pub center_tick_index: i64, - pub lower_tick_index: i64, - pub upper_tick_index: i64, - pub fee: Option, - pub total_shares: Option, - pub pool: Option, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, Default)] -#[serde(rename_all = "snake_case")] -pub struct PairID { - pub token0: String, - pub token1: String, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct TickLiquidity { - pub liquidity: Liquidity, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub enum Liquidity { - PoolReserves(PoolReserves), - LimitOrderTranche(LimitOrderTranche), -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct PoolReserves { - pub key: PoolReservesKey, - pub reserves_maker_denom: Int128, - pub price_taker_to_maker: PrecDec, - pub price_opposite_taker_to_maker: PrecDec, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct PoolReservesKey { - pub trade_pair_id: TradePairID, - pub tick_index_taker_to_maker: i64, - pub fee: Option, -} diff --git a/packages/neutron-sdk/src/bindings/marketmap/mod.rs b/packages/neutron-sdk/src/bindings/marketmap/mod.rs deleted file mode 100644 index e44ca515..00000000 --- a/packages/neutron-sdk/src/bindings/marketmap/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub mod query; -pub mod types; diff --git a/packages/neutron-sdk/src/bindings/marketmap/query.rs b/packages/neutron-sdk/src/bindings/marketmap/query.rs deleted file mode 100644 index b62b8f90..00000000 --- a/packages/neutron-sdk/src/bindings/marketmap/query.rs +++ /dev/null @@ -1,48 +0,0 @@ -use crate::bindings::marketmap::types::{Market, MarketMap, Params}; -use crate::bindings::oracle::types::CurrencyPair; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub enum MarketMapQuery { - /// Parameters queries the parameters of the module. - Params {}, - LastUpdated {}, - MarketMap {}, - Market { - currency_pair: CurrencyPair, - }, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct ParamsResponse { - pub params: Params, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct LastUpdatedResponse { - pub last_updated: Option, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct MarketMapResponse { - /// **market_map** defines the global set of market configurations for all providers - /// and markets. - pub market_map: MarketMap, - /// **last_updated** is the last block height that the market map was updated. - /// This field can be used as an optimization for clients checking if there - /// is a new update to the map. - pub last_updated: Option, - /// **chain_id** is the chain identifier for the market map. - pub chain_id: String, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct MarketResponse { - pub market: Market, -} diff --git a/packages/neutron-sdk/src/bindings/marketmap/types.rs b/packages/neutron-sdk/src/bindings/marketmap/types.rs deleted file mode 100644 index d3ffe95f..00000000 --- a/packages/neutron-sdk/src/bindings/marketmap/types.rs +++ /dev/null @@ -1,84 +0,0 @@ -use schemars::{JsonSchema, Map}; -use serde::{Deserialize, Serialize}; - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct Params { - pub admin: String, - pub market_authorities: Vec, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct MarketMap { - pub markets: Map, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct Market { - /// **ticker** is the full list of tickers and their associated configurations - /// to be stored on-chain. - pub ticker: Ticker, - pub provider_configs: Vec, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct ProviderConfig { - /// **name** corresponds to the name of the provider for which the configuration is - /// being set. - pub name: String, - /// **off_chain_ticker** is the off-chain representation of the ticker i.e. BTC/USD. - /// The off-chain ticker is unique to a given provider and is used to fetch the - /// price of the ticker from the provider. - pub off_chain_ticker: String, - /// **normalize_by_pair** is the currency pair for this ticker to be normalized by. - /// For example, if the desired Ticker is BTC/USD, this market could be reached - /// using: OffChainTicker = BTC/USDT NormalizeByPair = USDT/USD This field is - /// optional and nullable. - pub normalize_by_pair: Option, - /// **invert** is a boolean indicating if the BASE and QUOTE of the market should - /// be inverted. i.e. BASE -> QUOTE, QUOTE -> BASE - #[serde(default)] - pub invert: bool, - /// **metadata_json** is a string of JSON that encodes any extra configuration - /// for the given provider config. - #[serde( - default, - rename(serialize = "metadata_JSON", deserialize = "metadata_JSON") - )] - pub metadata_json: String, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -pub struct CurrencyPair { - #[serde(rename(serialize = "Base", deserialize = "Base"))] - pub base: String, - #[serde(rename(serialize = "Quote", deserialize = "Quote"))] - pub quote: String, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct Ticker { - /// **currency_pair** is the currency pair for this ticker. - pub currency_pair: CurrencyPair, - /// **decimals** is the number of decimal places for the ticker. The number of - /// decimal places is used to convert the price to a human-readable format. - pub decimals: u64, - /// **min_provider_count** is the minimum number of providers required to consider - /// the ticker valid. - pub min_provider_count: u64, - /// **enabled** is the flag that denotes if the Ticker is enabled for price - /// fetching by an oracle. - #[serde(default)] - pub enabled: bool, - /// **metadata_json** is a string of JSON that encodes any extra configuration - /// for the given ticker. , - #[serde( - default, - rename(serialize = "metadata_JSON", deserialize = "metadata_JSON") - )] - pub metadata_json: String, -} diff --git a/packages/neutron-sdk/src/bindings/mod.rs b/packages/neutron-sdk/src/bindings/mod.rs index e09ce752..08938b58 100644 --- a/packages/neutron-sdk/src/bindings/mod.rs +++ b/packages/neutron-sdk/src/bindings/mod.rs @@ -1,7 +1,3 @@ -pub mod dex; -pub mod marketmap; #[allow(deprecated)] pub mod msg; -pub mod oracle; -pub mod query; pub mod types; diff --git a/packages/neutron-sdk/src/bindings/msg.rs b/packages/neutron-sdk/src/bindings/msg.rs index cc2c3fed..a8292044 100644 --- a/packages/neutron-sdk/src/bindings/msg.rs +++ b/packages/neutron-sdk/src/bindings/msg.rs @@ -5,8 +5,6 @@ use crate::{ sudo::msg::RequestPacketTimeoutHeight, NeutronResult, }; - -use crate::bindings::dex::msg::DexMsg; use cosmwasm_std::{Binary, Coin, CosmosMsg, CustomMsg, DenomUnit, StdError, Uint128}; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; @@ -35,511 +33,14 @@ pub enum ChannelOrdering { OrderUnordered, } +#[deprecated(note = "Please use neutron-std autogenerated messages instead of wasmbindings", since = "0.12.0")] #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] #[serde(rename_all = "snake_case")] /// A number of Custom messages that can call into the Neutron bindings. pub enum NeutronMsg { - /// RegisterInterchainAccount registers an interchain account on remote chain. - RegisterInterchainAccount { - /// **connection_id** is an IBC connection identifier between Neutron and remote chain. - connection_id: String, - - /// **interchain_account_id** is an identifier of your new interchain account. Can be any string. - /// This identifier allows contracts to have multiple interchain accounts on remote chains. - interchain_account_id: String, - - /// **register_fee** is a fees required to be payed to register interchain account - register_fee: Option>, - - /// **ordering** is an order of channel. Can be ordered or unordered. - /// Set to ordered if not specified. - ordering: Option, - }, - - /// SubmitTx starts the process of executing any Cosmos-SDK *msgs* on remote chain. - SubmitTx { - /// **connection_id** is an IBC connection identifier between Neutron and remote chain. - connection_id: String, - - /// **interchain_account_id** is an identifier of your interchain account from which you want to execute msgs. - interchain_account_id: String, - - /// **msgs** is a list of protobuf encoded Cosmos-SDK messages you want to execute on remote chain. - msgs: Vec, - - /// **memo** is a memo you want to attach to your interchain transaction.It behaves like a memo in usual Cosmos transaction. - memo: String, - - /// **timeout** is a timeout in seconds after which the packet times out. - timeout: u64, - - /// ***fee** is an ibc fee for the transaction. - fee: IbcFee, - }, - - /// RegisterInterchainQuery registers an interchain query. - RegisterInterchainQuery { - /// **query_type** is a query type identifier ('tx' or 'kv' for now). - query_type: String, - - /// **keys** is the KV-storage keys for which we want to get values from remote chain. - keys: Vec, - - /// **transactions_filter** is the filter for transaction search ICQ. - transactions_filter: String, - - /// **connection_id** is an IBC connection identifier between Neutron and remote chain. - connection_id: String, - - /// **update_period** is used to say how often the query must be updated. - update_period: u64, - }, - - /// RegisterInterchainQuery updates an interchain query. - UpdateInterchainQuery { - /// **query_id** is the ID of the query we want to update. - query_id: u64, - - /// **new_keys** is the new query keys to retrieve. - new_keys: Option>, - - /// **new_update_period** is a new update period of the query. - new_update_period: Option, - - /// **new_transactions_filter** is a new transactions filter of the query. - new_transactions_filter: Option, - }, - - /// RemoveInterchainQuery removes as interchain query. - RemoveInterchainQuery { - /// **query_id** is ID of the query we want to remove. - query_id: u64, - }, - /// IbcTransfer sends a fungible token packet over IBC. - IbcTransfer { - // the port on which the packet will be sent - source_port: String, - // the channel by which the packet will be sent - source_channel: String, - // the tokens to be transferred - token: Coin, - // the sender address - sender: String, - // the recipient address on the destination chain - receiver: String, - // Timeout height relative to the current block height. - // The timeout is disabled when set to 0. - timeout_height: RequestPacketTimeoutHeight, - // Timeout timestamp in absolute nanoseconds since unix epoch. - // The timeout is disabled when set to 0. - timeout_timestamp: u64, - // Memo to be sent along with transaction. - memo: String, - // Fees to refund relayer for different kinds of `SudoMsg` transmission - // Unused fee types will be returned to msg sender. - fee: IbcFee, - }, /// SubmitAdminProposal sends a proposal to neutron's Admin module. /// This type of messages can be only executed by Neutron DAO. SubmitAdminProposal { admin_proposal: AdminProposal }, - - /// TokenFactory message. - /// Contracts can create denoms, namespaced under the contract's address. - /// A contract may create any number of independent sub-denoms. - CreateDenom { subdenom: String }, - - /// TokenFactory message. - /// Contracts can change the admin of a denom that they are the admin of. - ChangeAdmin { - denom: String, - new_admin_address: String, - }, - - /// TokenFactory message. - /// Contracts can mint native tokens for an existing factory denom - /// that they are the admin of. - MintTokens { - denom: String, - amount: Uint128, - mint_to_address: String, - }, - - /// TokenFactory message. - /// Contracts can burn native tokens for an existing factory denom - /// that they are the admin of. - /// Currently, the burn from address must be the admin contract. - BurnTokens { - denom: String, - amount: Uint128, - /// Must be set to `""` for now - burn_from_address: String, - }, - - /// TokenFactory message. - /// Contracts can set before send hooks for denoms, namespaced under the contract's address. - SetBeforeSendHook { - denom: String, - contract_addr: String, - }, - - /// TokenFactoryMessage - /// Contracts can force specified `amount` of an existing factory denom - /// that they are admin of to a `transfer_to_address` from a `transfer_from_address`. - ForceTransfer { - denom: String, - amount: Uint128, - transfer_from_address: String, - transfer_to_address: String, - }, - - /// TokenFactoryMessage - /// Contracts can set a metadata for of an existing factory denom - /// that they are admin of. - SetDenomMetadata { - /// **description** description of a token - description: String, - /// **denom_units** represents the list of DenomUnit's for a given coin - denom_units: Vec, - /// **base** represents the base denom (should be the DenomUnit with exponent = 0). - base: String, - /// **display** indicates the suggested denom that should be - /// displayed in clients. - display: String, - /// **name** defines the name of the token (eg: Cosmos Atom) - name: String, - /// **symbol** is the token symbol usually shown on exchanges (eg: ATOM). This can - /// be the same as the display. - symbol: String, - /// **uri** to a document (on or off-chain) that contains additional information. Optional. - uri: String, - /// **uri_hash** is a sha256 hash of a document pointed by URI. It's used to verify that - /// the document didn't change. Optional. - uri_hash: String, - }, - - /// AddSchedule adds new schedule with a given `name`. - /// Until schedule is removed it will execute all `msgs` every `period` blocks. - /// First execution is at least on `current_block + period` block. - /// [Permissioned - DAO Only] - AddSchedule { - /// Name of a new schedule. - /// Needed to be able to `RemoveSchedule` and to log information about it - name: String, - /// period in blocks with which `msgs` will be executed - period: u64, - /// list of cosmwasm messages to be executed - msgs: Vec, - /// execution stage where schedule will be executed - execution_stage: String, - }, - - /// RemoveSchedule removes the schedule with a given `name`. - /// [Permissioned - DAO or Security DAO only] - RemoveSchedule { name: String }, - - /// Contractmanager message - /// Resubmits failed acknowledgement. - /// Acknowledgement failure is created when contract returns error or acknowledgement is out of gas. - /// [Permissioned - only from contract that is initial caller of IBC transaction] - ResubmitFailure { failure_id: u64 }, - - /// Dex messages - Dex(DexMsg), -} - -impl NeutronMsg { - /// Basic helper to define a register interchain account message: - /// * **connection_id** is an IBC connection identifier between Neutron and remote chain; - /// * **interchain_account_id** is an identifier of your new interchain account. Can be any string. - /// * **ordering** is an ordering of ICA channel. Set to ORDERED if not specified - pub fn register_interchain_account( - connection_id: String, - interchain_account_id: String, - register_fee: Option>, - ordering: Option, - ) -> Self { - NeutronMsg::RegisterInterchainAccount { - connection_id, - interchain_account_id, - register_fee, - ordering, - } - } - - /// Basic helper to define a submit tx message: - /// * **connection_id** is an IBC connection identifier between Neutron and remote chain; - /// * **interchain_account_id** is an identifier of your interchain account from which you want to execute msgs; - /// * **msgs** is a list of protobuf encoded Cosmos-SDK messages you want to execute on remote chain; - /// * **memo** is a memo you want to attach to your interchain transaction. It behaves like a memo in usual Cosmos transaction; - /// * **timeout** is a timeout in seconds after which the packet times out. - /// * **fee** is a fee that is used for different kinds of callbacks. Unused fee types will be returned to msg sender. - pub fn submit_tx( - connection_id: String, - interchain_account_id: String, - msgs: Vec, - memo: String, - timeout: u64, - fee: IbcFee, - ) -> Self { - NeutronMsg::SubmitTx { - connection_id, - interchain_account_id, - msgs, - memo, - timeout, - fee, - } - } - - /// Basic helper to define a register interchain query message: - /// * **query** is a query type identifier ('tx' or 'kv' for now) with a payload: - /// - when the query enum is 'kv' then payload is the KV-storage keys for which we want to get - /// values from remote chain; - /// - when the query enum is 'tx' then payload is the filters for transaction search ICQ, - /// maximum allowed number of filters is 32. - /// * **connection_id** is an IBC connection identifier between Neutron and remote chain; - /// * **update_period** is used to say how often (in neutron blocks) the query must be updated. - pub fn register_interchain_query( - query: QueryPayload, - connection_id: String, - update_period: u64, - ) -> NeutronResult { - Ok(match query { - QueryPayload::KV(keys) => NeutronMsg::RegisterInterchainQuery { - query_type: QueryType::KV.into(), - keys, - transactions_filter: String::new(), - connection_id, - update_period, - }, - QueryPayload::TX(transactions_filters) => NeutronMsg::RegisterInterchainQuery { - query_type: QueryType::TX.into(), - keys: vec![], - transactions_filter: to_string(&transactions_filters) - .map_err(|e| StdError::generic_err(e.to_string()))?, - connection_id, - update_period, - }, - }) - } - - /// Basic helper to define a update interchain query message: - /// * **query_id** is ID of the query we want to update; - /// * **new_keys** is encoded keys to query; - /// * **new_update_period** is used to say how often (in neutron blocks) the query must be updated. - pub fn update_interchain_query( - query_id: u64, - new_keys: Option>, - new_update_period: Option, - new_transactions_filter: Option>, - ) -> NeutronResult { - Ok(NeutronMsg::UpdateInterchainQuery { - query_id, - new_keys, - new_update_period, - new_transactions_filter: match new_transactions_filter { - Some(filters) => { - Some(to_string(&filters).map_err(|e| StdError::generic_err(e.to_string()))?) - } - None => None, - }, - }) - } - - /// Basic helper to define a remove interchain query message: - /// * **query_id** is ID of the query we want to remove. - pub fn remove_interchain_query(query_id: u64) -> Self { - NeutronMsg::RemoveInterchainQuery { query_id } - } - - /// Basic helper to define a parameter change proposal passed to AdminModule: - /// * **proposal** is struct which contains proposal that should change network parameter. - pub fn submit_param_change_proposal(proposal: ParamChangeProposal) -> Self { - NeutronMsg::SubmitAdminProposal { - admin_proposal: AdminProposal::ParamChangeProposal(proposal), - } - } - - #[deprecated( - since = "0.11.0", - note = "Used only for querying old proposals. Will fail if executed in a new proposal. Use submit_proposal_execute_message instead" - )] - /// Basic helper to define an ibc upgrade proposal passed to AdminModule: - /// * **proposal** is struct which contains proposal that upgrades network. - pub fn submit_upgrade_proposal(proposal: UpgradeProposal) -> Self { - NeutronMsg::SubmitAdminProposal { - admin_proposal: AdminProposal::UpgradeProposal(proposal), - } - } - - #[deprecated( - since = "0.11.0", - note = "Used only for querying old proposals. Will fail if executed in a new proposal. Use submit_proposal_execute_message instead" - )] - /// Basic helper to define an ibc update client change proposal passed to AdminModule: - /// * **proposal** is struct which contains proposal updates cliient. - pub fn submit_client_update_proposal(proposal: ClientUpdateProposal) -> Self { - NeutronMsg::SubmitAdminProposal { - admin_proposal: AdminProposal::ClientUpdateProposal(proposal), - } - } - - /// Basic helper to define sdk47 compatible proposal passed to AdminModule: - /// * **proposal** is struct which contains JSON encoded sdk message. - pub fn submit_proposal_execute_message(proposal: ProposalExecuteMessage) -> Self { - NeutronMsg::SubmitAdminProposal { - admin_proposal: AdminProposal::ProposalExecuteMessage(proposal), - } - } - - /// Basic helper to build create denom message passed to TokenFactory module: - /// * **subdenom** is a subdenom name for denom to be created. - pub fn submit_create_denom(subdenom: impl Into) -> Self { - NeutronMsg::CreateDenom { - subdenom: subdenom.into(), - } - } - - /// Basic helper to define change of admin for a token passed to TokenFactory module: - /// * **denom** is a name of the denom to change an admin for; - /// * **new_admin_address** is a new admin address for a denom. - pub fn submit_change_admin( - denom: impl Into, - new_admin_address: impl Into, - ) -> Self { - NeutronMsg::ChangeAdmin { - denom: denom.into(), - new_admin_address: new_admin_address.into(), - } - } - - /// Basic helper to define mint tokens passed to TokenFactory module: - /// * **denom** is a name of the denom; - /// * **amount** is an amount of tokens to mint; - /// * **mint_to_address** is an address that will receive minted tokens. - pub fn submit_mint_tokens( - denom: impl Into, - amount: Uint128, - mint_to_address: impl Into, - ) -> Self { - NeutronMsg::MintTokens { - denom: denom.into(), - amount, - mint_to_address: mint_to_address.into(), - } - } - - /// Basic helper to define burn tokens passed to TokenFactory module: - /// * **denom** is a name of the denom; - /// * **amount** is an amount of tokens to burn. - /// * **burn_from_address** is an address tokens will be burned from - pub fn submit_burn_tokens( - denom: impl Into, - amount: Uint128, - burn_from_address: Option, - ) -> Self { - NeutronMsg::BurnTokens { - denom: denom.into(), - amount, - burn_from_address: burn_from_address.unwrap_or_default(), - } - } - - /// Basic helper to create set before send hook message passed to TokenFactory module: - /// * **denom** is a name for denom for hook to be created. - pub fn submit_set_before_send_hook( - denom: impl Into, - contract_addr: impl Into, - ) -> Self { - NeutronMsg::SetBeforeSendHook { - denom: denom.into(), - contract_addr: contract_addr.into(), - } - } - - /// Basic helper to create force transfer message passed to TokenFactory module: - /// * **denom** is a name for a denom to transfer; - /// * **amount** is an amount of **denom** tokens to transfer; - /// * **from_address** is from which address to transfer tokens; - /// * **to_address** is where to transfer tokens. - pub fn submit_force_transfer( - denom: impl Into, - amount: Uint128, - from_address: impl Into, - to_address: impl Into, - ) -> Self { - NeutronMsg::ForceTransfer { - denom: denom.into(), - amount, - transfer_from_address: from_address.into(), - transfer_to_address: to_address.into(), - } - } - /// Basic helper to create a set denom metadata message passed to TokenFactory module: - /// * **description** description of a token; - /// * **denom_units** represents the list of DenomUnit's for a given coin; - /// * **base** represents the base denom (should be the DenomUnit with exponent = 0); - /// * **display** indicates the suggested denom that should be - /// displayed in clients; - /// * **name** defines the name of the token (eg: Cosmos Atom); - /// * **symbol** is the token symbol usually shown on exchanges (eg: ATOM). This can - /// be the same as the display; - /// * **uri** to a document (on or off-chain) that contains additional information. Optional; - /// * **uri_hash** is a sha256 hash of a document pointed by URI. It's used to verify that - /// the document didn't change. Optional. - #[allow(clippy::too_many_arguments)] - pub fn submit_set_denom_metadata( - description: String, - denom_units: Vec, - base: String, - display: String, - name: String, - symbol: String, - uri: String, - uri_hash: String, - ) -> Self { - NeutronMsg::SetDenomMetadata { - description, - denom_units, - base, - display, - name, - symbol, - uri, - uri_hash, - } - } - - /// Basic helper to define add schedule passed to Cron module: - /// * **name** is a name of the schedule; - /// * **period** is a period of schedule execution in blocks; - /// * **msgs** is the messages that will be executed. - /// * **execution_stage** is the stage where schedule will be executed. - pub fn submit_add_schedule( - name: String, - period: u64, - msgs: Vec, - execution_stage: ExecutionStage, - ) -> Self { - NeutronMsg::AddSchedule { - name, - period, - msgs, - execution_stage: execution_stage.as_str_name().to_string(), - } - } - - /// Basic helper to define remove schedule passed to Cron module: - /// * **name** is a name of the schedule to be removed. - pub fn submit_remove_schedule(name: String) -> Self { - NeutronMsg::RemoveSchedule { name } - } - - /// Basic helper to define resubmit failure passed to Contractmanager module: - /// * **failure_id** is an id of the failure to be resubmitted. - pub fn submit_resubmit_failure(failure_id: u64) -> Self { - NeutronMsg::ResubmitFailure { failure_id } - } } impl From for CosmosMsg { @@ -574,7 +75,7 @@ pub struct MsgRegisterInterchainAccountResponse { pub struct MsgSubmitTxResponse { /// **sequence_id** is a channel's sequence_id for outgoing ibc packet. Unique per a channel. pub sequence_id: u64, - /// **channel** is a src channel on neutron side trasaction was submitted from. + /// **channel** is a src channel on neutron side transaction was submitted from. pub channel: String, } @@ -584,7 +85,7 @@ pub struct MsgSubmitTxResponse { pub struct MsgIbcTransferResponse { /// **sequence_id** is a channel's sequence_id for outgoing ibc packet. Unique per a channel. pub sequence_id: u64, - /// **channel** is a src channel on neutron side trasaction was submitted from. + /// **channel** is a src channel on neutron side transaction was submitted from. pub channel: String, } diff --git a/packages/neutron-sdk/src/bindings/oracle/mod.rs b/packages/neutron-sdk/src/bindings/oracle/mod.rs deleted file mode 100644 index e44ca515..00000000 --- a/packages/neutron-sdk/src/bindings/oracle/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub mod query; -pub mod types; diff --git a/packages/neutron-sdk/src/bindings/oracle/query.rs b/packages/neutron-sdk/src/bindings/oracle/query.rs deleted file mode 100644 index 73d01683..00000000 --- a/packages/neutron-sdk/src/bindings/oracle/query.rs +++ /dev/null @@ -1,40 +0,0 @@ -use crate::bindings::oracle::types::{CurrencyPair, QuotePrice}; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub enum OracleQuery { - GetAllCurrencyPairs {}, - GetPrice { currency_pair: CurrencyPair }, - GetPrices { currency_pair_ids: Vec }, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct GetPriceResponse { - /// **price** represents the quote-price for the CurrencyPair given in - /// GetPriceRequest (possibly nil if no update has been made) - pub price: QuotePrice, - /// **nonce** represents the nonce for the CurrencyPair if it exists in state - pub nonce: u64, - /// **decimals* represents the number of decimals that the quote-price is - /// represented in. For Pairs where ETHEREUM is the quote this will be 18, - /// otherwise it will be 8. - pub decimals: u64, - /// *id** represents the identifier for the CurrencyPair. - #[serde(default)] - pub id: u64, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct GetPricesResponse { - pub prices: Vec, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct GetAllCurrencyPairsResponse { - pub currency_pairs: Vec, -} diff --git a/packages/neutron-sdk/src/bindings/oracle/types.rs b/packages/neutron-sdk/src/bindings/oracle/types.rs deleted file mode 100644 index 6afde01f..00000000 --- a/packages/neutron-sdk/src/bindings/oracle/types.rs +++ /dev/null @@ -1,23 +0,0 @@ -use cosmwasm_std::Int128; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -pub struct CurrencyPair { - #[serde(rename(serialize = "Base", deserialize = "Base"))] - pub base: String, - #[serde(rename(serialize = "Quote", deserialize = "Quote"))] - pub quote: String, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct QuotePrice { - pub price: Int128, - /// **block_timestamp** tracks the block height associated with this price update. - /// We include block timestamp alongside the price to ensure that smart - /// contracts and applications are not utilizing stale oracle prices - pub block_timestamp: String, - /// **block_height** is height of block mentioned above - pub block_height: Option, -} diff --git a/packages/neutron-sdk/src/bindings/query.rs b/packages/neutron-sdk/src/bindings/query.rs deleted file mode 100644 index 94c36199..00000000 --- a/packages/neutron-sdk/src/bindings/query.rs +++ /dev/null @@ -1,171 +0,0 @@ -use crate::bindings::marketmap::query::MarketMapQuery; -use crate::bindings::oracle::query::OracleQuery; -use crate::bindings::types::{Failure, InterchainQueryResult, RegisteredQuery}; -use cosmwasm_std::{Binary, CustomQuery, QueryRequest}; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -use super::dex::query::DexQuery; - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -/// The queries to interact with neutron specific blockchain modules. -pub enum NeutronQuery { - /// Query a result of registered interchain query on remote chain - InterchainQueryResult { - /// **query_id** is an ID registered interchain query - query_id: u64, - }, - - /// Query a registered interchain account address for a specific connection_id - /// Every contract may have as many interchain accounts as necessary. - InterchainAccountAddress { - /// **owner_address** is an address of contract which registered interchain account - owner_address: String, - - /// **interchain_account_id** is an identifier of your interchain account. Can be any string - /// This identifier allows contracts to have multiple interchain accounts on remote chains - interchain_account_id: String, - - /// **connection_id** is an IBC connection identifier between Neutron and remote chain - connection_id: String, - }, - - /// Query all registered interchain queries on all remote chains - RegisteredInterchainQueries { - owners: Vec, - connection_id: String, - pagination: PageRequest, - }, - - /// Query registered interchain query with a specific query_id - RegisteredInterchainQuery { - /// **query_id** is an ID registered interchain query - query_id: u64, - }, - - /// Query total amount of burned neutron fees - TotalBurnedNeutronsAmount {}, - - /// Query minimum IBC fee - MinIbcFee {}, - - /// TokenFactory query. Given a subdenom minted by a contract via - /// [`NeutronMsg::MintTokens`](crate::bindings::msg::NeutronMsg::MintTokens), - /// returns the full denom as used by [`BankMsg::Send`](cosmwasm_std::BankMsg::Send). - FullDenom { - creator_addr: String, - subdenom: String, - }, - - /// TokenFactory query. Returns the admin of a denom, if the denom is a TokenFactory denom. - DenomAdmin { - subdenom: String, - }, - - /// TokenFactory query. Returns the before send hook address of a denom, if the denom is a TokenFactory denom. - BeforeSendHook { - denom: String, - }, - - /// Contractmanager query. Returns the failures for a particular contract address. - Failures { - address: String, - pagination: PageRequest, - }, - - Dex(DexQuery), - - MarketMap(MarketMapQuery), - - Oracle(OracleQuery), -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct PageRequest { - /// **key** is a value returned in PageResponse.next_key to begin - /// querying the next page most efficiently. Only one of offset or key - /// should be set. - pub key: Binary, - /// **offset** is a numeric offset that can be used when key is unavailable. - /// It is less efficient than using key. Only one of offset or key should - /// be set. - pub offset: u64, - /// **limit** is the total number of results to be returned in the result page. - /// If left empty it will default to a value to be set by each app. - pub limit: u64, - /// **count_total** is set to true to indicate that the result set should include - /// a count of the total number of items available for pagination in UIs. - /// count_total is only respected when offset is used. It is ignored when key - /// is set. - pub count_total: bool, - /// reverse is set to true if results are to be returned in the descending order. - pub reverse: bool, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct PageResponse { - /// **next_key** is the key to be passed to PageRequest.key to - /// query the next page most efficiently. It will be empty if - /// there are no more results. - pub next_key: Option, - /// **total** is total number of results available if PageRequest.count_total - /// was set, its value is undefined otherwise - pub total: Option, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct QueryRegisteredQueriesResponse { - /// **registered_queries** is a list of registered queries - pub registered_queries: Vec, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct QueryRegisteredQueryResponse { - /// **registered_query** is a registered query - pub registered_query: RegisteredQuery, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct QueryRegisteredQueryResultResponse { - pub result: InterchainQueryResult, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct QueryInterchainAccountAddressResponse { - /// **interchain_account_address** is a interchain account address on the remote chain - pub interchain_account_address: String, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct QueryFailuresResponse { - /// **failures** is a list of failures of sudo handler calls - pub failures: Vec, -} - -impl CustomQuery for NeutronQuery {} - -impl From for QueryRequest { - fn from(msg: DexQuery) -> Self { - QueryRequest::Custom(NeutronQuery::Dex(msg)) - } -} - -impl From for QueryRequest { - fn from(msg: MarketMapQuery) -> Self { - QueryRequest::Custom(NeutronQuery::MarketMap(msg)) - } -} - -impl From for QueryRequest { - fn from(msg: OracleQuery) -> Self { - QueryRequest::Custom(NeutronQuery::Oracle(msg)) - } -} diff --git a/packages/neutron-sdk/src/lib.rs b/packages/neutron-sdk/src/lib.rs index ac788cfc..b419643d 100644 --- a/packages/neutron-sdk/src/lib.rs +++ b/packages/neutron-sdk/src/lib.rs @@ -12,7 +12,6 @@ pub mod interchain_queries; pub mod interchain_txs; #[allow(deprecated, clippy::module_inception)] pub mod proto_types; -pub mod query; mod serde; pub mod shim; pub mod sudo; diff --git a/packages/neutron-sdk/src/query/min_ibc_fee.rs b/packages/neutron-sdk/src/query/min_ibc_fee.rs deleted file mode 100644 index 42e27c72..00000000 --- a/packages/neutron-sdk/src/query/min_ibc_fee.rs +++ /dev/null @@ -1,18 +0,0 @@ -use crate::{ - bindings::{msg::IbcFee, query::NeutronQuery}, - NeutronResult, -}; -use cosmwasm_std::Deps; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct MinIbcFeeResponse { - pub min_fee: IbcFee, -} - -pub fn query_min_ibc_fee(deps: Deps) -> NeutronResult { - let query = NeutronQuery::MinIbcFee {}; - Ok(deps.querier.query(&query.into())?) -} diff --git a/packages/neutron-sdk/src/query/mod.rs b/packages/neutron-sdk/src/query/mod.rs deleted file mode 100644 index aea5e3f8..00000000 --- a/packages/neutron-sdk/src/query/mod.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub mod min_ibc_fee; -pub mod token_factory; -pub mod total_burned_neutrons; diff --git a/packages/neutron-sdk/src/query/token_factory.rs b/packages/neutron-sdk/src/query/token_factory.rs deleted file mode 100644 index 82060562..00000000 --- a/packages/neutron-sdk/src/query/token_factory.rs +++ /dev/null @@ -1,54 +0,0 @@ -use crate::{bindings::query::NeutronQuery, NeutronResult}; -use cosmwasm_std::Deps; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct FullDenomResponse { - pub denom: String, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct DenomAdminResponse { - pub admin: String, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct BeforeSendHookResponse { - pub contract_addr: String, -} - -pub fn query_full_denom( - deps: Deps, - creator_addr: impl Into, - subdenom: impl Into, -) -> NeutronResult { - let query = NeutronQuery::FullDenom { - creator_addr: creator_addr.into(), - subdenom: subdenom.into(), - }; - Ok(deps.querier.query(&query.into())?) -} - -pub fn query_denom_admin( - deps: Deps, - subdenom: impl Into, -) -> NeutronResult { - let query = NeutronQuery::DenomAdmin { - subdenom: subdenom.into(), - }; - Ok(deps.querier.query(&query.into())?) -} - -pub fn query_before_send_hook( - deps: Deps, - denom: impl Into, -) -> NeutronResult { - let query = NeutronQuery::BeforeSendHook { - denom: denom.into(), - }; - Ok(deps.querier.query(&query.into())?) -} diff --git a/packages/neutron-sdk/src/query/total_burned_neutrons.rs b/packages/neutron-sdk/src/query/total_burned_neutrons.rs deleted file mode 100644 index 61d8fe21..00000000 --- a/packages/neutron-sdk/src/query/total_burned_neutrons.rs +++ /dev/null @@ -1,18 +0,0 @@ -use crate::{bindings::query::NeutronQuery, NeutronResult}; -use cosmwasm_std::{Coin, Deps}; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct TotalBurnedNeutronsAmountResponse { - pub coin: Coin, -} - -/// Returns total amount of burned neutron fees -pub fn query_total_burned_neutrons( - deps: Deps, -) -> NeutronResult { - let query = NeutronQuery::TotalBurnedNeutronsAmount {}; - Ok(deps.querier.query(&query.into())?) -}