Skip to content

Commit

Permalink
Merge pull request #162 from neutron-org/feat/add_simulateXXQueries
Browse files Browse the repository at this point in the history
Feat: Add SimulateXX queries
  • Loading branch information
pr0n00gler authored Sep 24, 2024
2 parents 59e441f + f3aa326 commit 38197fb
Show file tree
Hide file tree
Showing 7 changed files with 352 additions and 17 deletions.
17 changes: 17 additions & 0 deletions contracts/neutron_interchain_txs/schema/execute_msg.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@
"interchain_account_id": {
"type": "string"
},
"ordering": {
"anyOf": [
{
"$ref": "#/definitions/ChannelOrdering"
},
{
"type": "null"
}
]
},
"register_fee": {
"type": "array",
"items": {
Expand Down Expand Up @@ -122,6 +132,13 @@
}
],
"definitions": {
"ChannelOrdering": {
"type": "string",
"enum": [
"ORDER_ORDERED",
"ORDER_UNORDERED"
]
},
"Coin": {
"type": "object",
"required": [
Expand Down
40 changes: 32 additions & 8 deletions packages/neutron-sdk/schema/neutron_msg.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@
"description": "**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.",
"type": "string"
},
"ordering": {
"description": "**ordering** is an order of channel. Can be ordered or unordered. Set to ordered if not specified.",
"anyOf": [
{
"$ref": "#/definitions/ChannelOrdering"
},
{
"type": "null"
}
]
},
"register_fee": {
"description": "*register_fee** is a fees required to be payed to register interchain account",
"type": [
Expand Down Expand Up @@ -160,7 +171,7 @@
],
"properties": {
"new_keys": {
"description": "*new_keys** is the new query keys to retrive.",
"description": "*new_keys** is the new query keys to retrieve.",
"type": [
"array",
"null"
Expand Down Expand Up @@ -810,6 +821,13 @@
},
"additionalProperties": false
},
"ChannelOrdering": {
"type": "string",
"enum": [
"ORDER_ORDERED",
"ORDER_UNORDERED"
]
},
"ClearAdminProposal": {
"description": "Deprecated. SudoContractProposal defines the struct for clear admin proposal.",
"deprecated": true,
Expand Down Expand Up @@ -907,14 +925,20 @@
},
"additionalProperties": false
},
"DepositOption": {
"DepositOptions": {
"type": "object",
"required": [
"disable_swap"
],
"properties": {
"disable_swap": {
"type": "boolean"
"disable_autoswap": {
"type": [
"boolean",
"null"
]
},
"fail_tx_on_bel": {
"type": [
"boolean",
"null"
]
}
},
"additionalProperties": false
Expand Down Expand Up @@ -968,7 +992,7 @@
"description": "Additional deposit options",
"type": "array",
"items": {
"$ref": "#/definitions/DepositOption"
"$ref": "#/definitions/DepositOptions"
}
},
"receiver": {
Expand Down
4 changes: 2 additions & 2 deletions packages/neutron-sdk/src/bindings/dex/msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use cosmwasm_std::Uint128;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};

use super::types::{DepositOption, MultiHopRoute, PrecDec};
use super::types::{DepositOptions, MultiHopRoute, PrecDec};

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[serde(rename_all = "snake_case")]
Expand All @@ -26,7 +26,7 @@ pub enum DexMsg {
/// Fees to use for each deposit
fees: Vec<u64>,
/// Additional deposit options
options: Vec<DepositOption>,
options: Vec<DepositOptions>,
},
/// 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
Expand Down
12 changes: 10 additions & 2 deletions packages/neutron-sdk/src/bindings/dex/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ pub struct TradePairID {
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<u64>,
pub error: Option<String>,
}

// TODO implement math for PrecDec
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[serde(rename_all = "snake_case")]
Expand All @@ -102,8 +109,9 @@ impl From<String> for PrecDec {

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub struct DepositOption {
pub disable_swap: bool,
pub struct DepositOptions {
pub disable_autoswap: Option<bool>,
pub fail_tx_on_bel: Option<bool>,
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
Expand Down
2 changes: 1 addition & 1 deletion packages/neutron-sdk/src/proto_types/NEUTRON_COMMIT
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1bf83371924e7f3f5a756c8a9ea35e2d607a984e
6bef62c6d9182b51fd5facc41088689c809b96d5
Loading

0 comments on commit 38197fb

Please sign in to comment.