diff --git a/contracts/ibc_transfer/src/contract.rs b/contracts/ibc_transfer/src/contract.rs index 2c9ab62e..f2c22ece 100644 --- a/contracts/ibc_transfer/src/contract.rs +++ b/contracts/ibc_transfer/src/contract.rs @@ -1,11 +1,13 @@ use cosmwasm_std::{ - coin, entry_point, from_json, Binary, CosmosMsg, Deps, DepsMut, Env, MessageInfo, Reply, - Response, StdError, StdResult, SubMsg, + coin, entry_point, Binary, CosmosMsg, Deps, DepsMut, Env, MessageInfo, Reply, Response, + StdError, StdResult, SubMsg, }; use cw2::set_contract_version; +use neutron_sdk::interchain_txs::helpers::decode_message_response; +use neutron_sdk::proto_types::neutron::transfer::MsgTransferResponse; use neutron_sdk::{ bindings::{ - msg::{IbcFee, MsgIbcTransferResponse, NeutronMsg}, + msg::{IbcFee, NeutronMsg}, query::NeutronQuery, }, query::min_ibc_fee::query_min_ibc_fee, @@ -112,14 +114,18 @@ fn msg_with_sudo_callback>, T>( // and process this payload when an acknowledgement for the SubmitTx message is received in Sudo handler fn prepare_sudo_payload(mut deps: DepsMut, _env: Env, msg: Reply) -> StdResult { let payload = read_reply_payload(deps.storage, msg.id)?; - let resp: MsgIbcTransferResponse = from_json( - msg.result + let resp: MsgTransferResponse = decode_message_response( + &msg.result .into_result() .map_err(StdError::generic_err)? - .data - .ok_or_else(|| StdError::generic_err("no result"))?, + .msg_responses[0] + .clone() + .value + .to_vec(), ) .map_err(|e| StdError::generic_err(format!("failed to parse response: {:?}", e)))?; + deps.api + .debug(format!("WASMDEBUG: reply msg: {:?}", resp).as_str()); let seq_id = resp.sequence_id; let channel_id = resp.channel; save_sudo_payload(deps.branch().storage, channel_id, seq_id, payload)?; diff --git a/contracts/neutron_interchain_txs/src/contract.rs b/contracts/neutron_interchain_txs/src/contract.rs index 6518ada0..695f5f81 100644 --- a/contracts/neutron_interchain_txs/src/contract.rs +++ b/contracts/neutron_interchain_txs/src/contract.rs @@ -13,9 +13,10 @@ use serde::{Deserialize, Serialize}; use crate::msg::{ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg}; use neutron_sdk::bindings::msg::IbcFee; +use neutron_sdk::proto_types::neutron::interchaintxs::v1::MsgSubmitTxResponse; use neutron_sdk::{ bindings::{ - msg::{MsgSubmitTxResponse, NeutronMsg}, + msg::NeutronMsg, query::{NeutronQuery, QueryInterchainAccountAddressResponse}, types::ProtobufAny, }, @@ -615,13 +616,14 @@ fn sudo_error(deps: DepsMut, request: RequestPacket, details: String) -> StdResu // and process this payload when an acknowledgement for the SubmitTx message is received in Sudo handler fn prepare_sudo_payload(mut deps: DepsMut, _env: Env, msg: Reply) -> StdResult { let payload = read_reply_payload(deps.storage)?; - let resp: MsgSubmitTxResponse = serde_json_wasm::from_slice( - msg.result + let resp: MsgSubmitTxResponse = decode_message_response( + &msg.result .into_result() .map_err(StdError::generic_err)? - .data - .ok_or_else(|| StdError::generic_err("no result"))? - .as_slice(), + .msg_responses[0] + .clone() + .value + .to_vec(), ) .map_err(|e| StdError::generic_err(format!("failed to parse response: {:?}", e)))?; deps.api diff --git a/packages/neutron-sdk/schema/neutron_msg.json b/packages/neutron-sdk/schema/neutron_msg.json index c667340d..6a23b3f2 100644 --- a/packages/neutron-sdk/schema/neutron_msg.json +++ b/packages/neutron-sdk/schema/neutron_msg.json @@ -629,7 +629,8 @@ "additionalProperties": false }, { - "description": "Proposal to upgrade IBC client", + "description": "Depreacteed Proposal to upgrade IBC client", + "deprecated": true, "type": "object", "required": [ "upgrade_proposal" @@ -642,7 +643,8 @@ "additionalProperties": false }, { - "description": "Proposal to update IBC client", + "description": "Deprecated. Proposal to update IBC client", + "deprecated": true, "type": "object", "required": [ "client_update_proposal" @@ -816,6 +818,7 @@ }, "ClientUpdateProposal": { "description": "ClientUpdateProposal defines the struct for client update proposal.", + "deprecated": true, "type": "object", "required": [ "description", @@ -1628,6 +1631,7 @@ }, "UpgradeProposal": { "description": "UpgradeProposal defines the struct for IBC upgrade proposal.", + "deprecated": true, "type": "object", "required": [ "description", diff --git a/packages/neutron-sdk/schema/neutron_query.json b/packages/neutron-sdk/schema/neutron_query.json index af319ba5..1a8f4cd4 100644 --- a/packages/neutron-sdk/schema/neutron_query.json +++ b/packages/neutron-sdk/schema/neutron_query.json @@ -244,6 +244,30 @@ } }, "additionalProperties": false + }, + { + "type": "object", + "required": [ + "market_map" + ], + "properties": { + "market_map": { + "$ref": "#/definitions/MarketMapQuery" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "oracle" + ], + "properties": { + "oracle": { + "$ref": "#/definitions/OracleQuery" + } + }, + "additionalProperties": false } ], "definitions": { @@ -251,6 +275,21 @@ "description": "Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec. See also .", "type": "string" }, + "CurrencyPair": { + "type": "object", + "required": [ + "Base", + "Quote" + ], + "properties": { + "Base": { + "type": "string" + }, + "Quote": { + "type": "string" + } + } + }, "DexQuery": { "oneOf": [ { @@ -872,6 +911,67 @@ } ] }, + "MarketMapQuery": { + "oneOf": [ + { + "description": "Parameters queries the parameters of the module.", + "type": "object", + "required": [ + "params" + ], + "properties": { + "params": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "last_updated" + ], + "properties": { + "last_updated": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "market_map" + ], + "properties": { + "market_map": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "market" + ], + "properties": { + "market": { + "type": "object", + "required": [ + "currency_pair" + ], + "properties": { + "currency_pair": { + "$ref": "#/definitions/CurrencyPair" + } + } + } + }, + "additionalProperties": false + } + ] + }, "MultiHopRoute": { "type": "object", "required": [ @@ -886,6 +986,65 @@ } } }, + "OracleQuery": { + "oneOf": [ + { + "type": "object", + "required": [ + "get_all_currency_pairs" + ], + "properties": { + "get_all_currency_pairs": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_price" + ], + "properties": { + "get_price": { + "type": "object", + "required": [ + "currency_pair" + ], + "properties": { + "currency_pair": { + "$ref": "#/definitions/CurrencyPair" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_prices" + ], + "properties": { + "get_prices": { + "type": "object", + "required": [ + "currency_pair_ids" + ], + "properties": { + "currency_pair_ids": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + }, + "additionalProperties": false + } + ] + }, "PageRequest": { "type": "object", "required": [ diff --git a/packages/neutron-sdk/src/stargate/aux.rs b/packages/neutron-sdk/src/stargate/aux.rs index 132310e6..24c8431a 100644 --- a/packages/neutron-sdk/src/stargate/aux.rs +++ b/packages/neutron-sdk/src/stargate/aux.rs @@ -16,6 +16,7 @@ where Req: prost::Message, Res: DeserializeOwned, { + #[allow(deprecated)] deps.querier.query(&QueryRequest::Stargate { path: path.to_string(), data: req.encode_to_vec().into(), @@ -28,6 +29,7 @@ where /// * **path** is an RPC request path. See Msg service definitions in neutron modules' proto files /// for additional info. pub fn create_stargate_msg(path: &str, req: Req) -> CosmosMsg { + #[allow(deprecated)] CosmosMsg::Stargate:: { type_url: path.to_string(), value: Binary::from(req.encode_to_vec()),