diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 84b4f808..bfc09a8f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -15,7 +15,7 @@ jobs: fetch-depth: 1 - uses: actions-rs/toolchain@v1 with: - toolchain: 1.68.2 + toolchain: 1.71.0 components: clippy profile: minimal override: true @@ -31,7 +31,7 @@ jobs: fetch-depth: 1 - uses: actions-rs/toolchain@v1 with: - toolchain: 1.68.2 + toolchain: 1.71.0 components: rustfmt profile: minimal override: true @@ -49,7 +49,7 @@ jobs: fetch-depth: 1 - uses: actions-rs/toolchain@v1 with: - toolchain: 1.68.2 + toolchain: 1.71.0 profile: minimal - run: cargo fetch --verbose - run: cargo build diff --git a/Cargo.toml b/Cargo.toml index 2ac57ace..7c671fdb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,10 +21,12 @@ serde-json-wasm = "1.0.0" cw-storage-plus = "1.1.0" cosmwasm-schema = { version = "1.4.0", default-features = false } base64 = "0.21.4" -prost = "0.12.1" +prost = "0.12.3" prost-types = "0.12.1" cosmos-sdk-proto = { version = "0.20.0", default-features = false } bech32 = "0.9.1" thiserror = "1.0.49" protobuf = { version = "3.3.0" } hex = "0.4.3" +tendermint-proto = "0.34" +speedate = "0.13.0" diff --git a/Makefile b/Makefile index 73883462..58fe610d 100644 --- a/Makefile +++ b/Makefile @@ -13,9 +13,6 @@ clippy: fmt: @cargo fmt -- --check -build_proto: - @./build_proto.sh - compile: @./build_release.sh @@ -23,4 +20,4 @@ check_contracts: @cargo install cosmwasm-check @cosmwasm-check --available-capabilities iterator,staking,stargate,neutron artifacts/*.wasm -build: build_proto schema clippy test fmt compile check_contracts \ No newline at end of file +build: schema clippy test fmt compile check_contracts \ No newline at end of file diff --git a/README.md b/README.md index 2cff54ec..83c437c3 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ The Neutron SDK is contained inside `packages` folder and consists of the follow | Neutron Bindings | https://github.com/neutron-org/neutron-sdk/tree/main/packages/neutron-sdk/src/bindings | Structures and helper methods for interacting with Neutron blockchain | | Neutron Sudo | https://github.com/neutron-org/neutron-sdk/tree/main/packages/neutron-sdk/src/sudo | Structures for Sudo Contract callbacks from Neutron blockchain | | Neutron Errors | https://github.com/neutron-org/neutron-sdk/tree/main/packages/neutron-sdk/src/errors | Structures and helpers for Neutron specific error and result types | -| Neutron Proto Types | https://github.com/neutron-org/neutron-sdk/tree/main/packages/neutron-sdk/src/proto_types | Neutron specific protobuf types. | +| Neutron Stargate | https://github.com/neutron-org/neutron-sdk/tree/main/packages/neutron-sdk/src/stargate | Structures and helpers for interacting with Neutron via Stargate | ### Example Contracts diff --git a/build_proto.sh b/build_proto.sh deleted file mode 100755 index b8d4a220..00000000 --- a/build_proto.sh +++ /dev/null @@ -1,8 +0,0 @@ -docker build thirdparty/protoc-image -t protoc_builder - -docker run --rm \ --v $PWD:/opt \ -protoc_builder sh -c "protoc \ --I/opt/proto \ -/opt/proto/transfer/v1/*.proto \ ---rust_out /opt/packages/neutron-sdk/src/proto_types/" \ No newline at end of file diff --git a/contracts/ibc_transfer/src/contract.rs b/contracts/ibc_transfer/src/contract.rs index 6afca24d..2c9ab62e 100644 --- a/contracts/ibc_transfer/src/contract.rs +++ b/contracts/ibc_transfer/src/contract.rs @@ -1,5 +1,5 @@ use cosmwasm_std::{ - coin, entry_point, from_binary, Binary, CosmosMsg, Deps, DepsMut, Env, MessageInfo, Reply, + coin, entry_point, from_json, Binary, CosmosMsg, Deps, DepsMut, Env, MessageInfo, Reply, Response, StdError, StdResult, SubMsg, }; use cw2::set_contract_version; @@ -112,8 +112,8 @@ 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_binary( - &msg.result + let resp: MsgIbcTransferResponse = from_json( + msg.result .into_result() .map_err(StdError::generic_err)? .data diff --git a/contracts/ibc_transfer/src/state.rs b/contracts/ibc_transfer/src/state.rs index 82ee71aa..cdd2a315 100644 --- a/contracts/ibc_transfer/src/state.rs +++ b/contracts/ibc_transfer/src/state.rs @@ -1,4 +1,4 @@ -use cosmwasm_std::{from_binary, to_vec, Binary, StdResult, Storage}; +use cosmwasm_std::{from_json, to_json_vec, Binary, StdResult, Storage}; use cw_storage_plus::{Item, Map}; use crate::contract::SudoPayload; @@ -28,13 +28,13 @@ pub fn get_next_id(store: &mut dyn Storage) -> StdResult { pub fn save_reply_payload(store: &mut dyn Storage, payload: SudoPayload) -> StdResult { let id = get_next_id(store)?; - REPLY_QUEUE_ID.save(store, id, &to_vec(&payload)?)?; + REPLY_QUEUE_ID.save(store, id, &to_json_vec(&payload)?)?; Ok(id) } pub fn read_reply_payload(store: &dyn Storage, id: u64) -> StdResult { let data = REPLY_QUEUE_ID.load(store, id)?; - from_binary(&Binary(data)) + from_json(Binary(data)) } /// SUDO_PAYLOAD - tmp storage for sudo handler payloads @@ -50,7 +50,7 @@ pub fn save_sudo_payload( seq_id: u64, payload: SudoPayload, ) -> StdResult<()> { - SUDO_PAYLOAD.save(store, (channel_id, seq_id), &to_vec(&payload)?) + SUDO_PAYLOAD.save(store, (channel_id, seq_id), &to_json_vec(&payload)?) } pub fn read_sudo_payload( @@ -59,5 +59,5 @@ pub fn read_sudo_payload( seq_id: u64, ) -> StdResult { let data = SUDO_PAYLOAD.load(store, (channel_id, seq_id))?; - from_binary(&Binary(data)) + from_json(Binary(data)) } diff --git a/contracts/neutron_interchain_queries/src/contract.rs b/contracts/neutron_interchain_queries/src/contract.rs index 3216ece3..9b49a41e 100644 --- a/contracts/neutron_interchain_queries/src/contract.rs +++ b/contracts/neutron_interchain_queries/src/contract.rs @@ -2,8 +2,8 @@ use cosmos_sdk_proto::cosmos::bank::v1beta1::MsgSend; use cosmos_sdk_proto::cosmos::tx::v1beta1::{TxBody, TxRaw}; use cosmos_sdk_proto::traits::Message; use cosmwasm_std::{ - entry_point, to_binary, Binary, Deps, DepsMut, Env, MessageInfo, Response, StdError, StdResult, - Uint128, + entry_point, to_json_binary, Binary, Deps, DepsMut, Env, MessageInfo, Response, StdError, + StdResult, Uint128, }; use cw2::set_contract_version; @@ -250,27 +250,27 @@ pub fn remove_interchain_query(query_id: u64) -> NeutronResult, 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_binary(&query_balance(deps, env, query_id)?)?), + QueryMsg::Balance { query_id } => Ok(to_json_binary(&query_balance(deps, env, query_id)?)?), QueryMsg::BankTotalSupply { query_id } => { - Ok(to_binary(&query_bank_total(deps, env, query_id)?)?) + Ok(to_json_binary(&query_bank_total(deps, env, query_id)?)?) } - QueryMsg::DistributionFeePool { query_id } => Ok(to_binary(&query_distribution_fee_pool( - deps, env, query_id, - )?)?), - QueryMsg::StakingValidators { query_id } => { - Ok(to_binary(&query_staking_validators(deps, env, query_id)?)?) - } - QueryMsg::GovernmentProposals { query_id } => Ok(to_binary(&query_government_proposals( + QueryMsg::DistributionFeePool { query_id } => Ok(to_json_binary( + &query_distribution_fee_pool(deps, env, query_id)?, + )?), + QueryMsg::StakingValidators { query_id } => Ok(to_json_binary(&query_staking_validators( deps, env, query_id, )?)?), + QueryMsg::GovernmentProposals { query_id } => Ok(to_json_binary( + &query_government_proposals(deps, env, query_id)?, + )?), QueryMsg::GetDelegations { query_id } => { - Ok(to_binary(&query_delegations(deps, env, query_id)?)?) + Ok(to_json_binary(&query_delegations(deps, env, query_id)?)?) } QueryMsg::Cw20Balance { query_id } => { - Ok(to_binary(&query_cw20_balance(deps, env, query_id)?)?) + Ok(to_json_binary(&query_cw20_balance(deps, env, query_id)?)?) } QueryMsg::GetRegisteredQuery { query_id } => { - Ok(to_binary(&get_registered_query(deps, query_id)?)?) + Ok(to_json_binary(&get_registered_query(deps, query_id)?)?) } QueryMsg::GetRecipientTxs { recipient } => query_recipient_txs(deps, recipient), } @@ -280,7 +280,7 @@ fn query_recipient_txs(deps: Deps, recipient: String) -> NeutronRe let txs = RECIPIENT_TXS .load(deps.storage, &recipient) .unwrap_or_default(); - Ok(to_binary(&GetRecipientTxsResponse { transfers: txs })?) + Ok(to_json_binary(&GetRecipientTxsResponse { transfers: txs })?) } pub fn query_cw20_balance( diff --git a/contracts/neutron_interchain_queries/src/testing/mock_querier.rs b/contracts/neutron_interchain_queries/src/testing/mock_querier.rs index e57382a3..b82c8b94 100644 --- a/contracts/neutron_interchain_queries/src/testing/mock_querier.rs +++ b/contracts/neutron_interchain_queries/src/testing/mock_querier.rs @@ -3,7 +3,7 @@ use std::marker::PhantomData; use cosmwasm_std::testing::{MockApi, MockQuerier, MockStorage}; use cosmwasm_std::{ - from_slice, Binary, Coin, ContractResult, CustomQuery, FullDelegation, OwnedDeps, Querier, + from_json, Binary, Coin, ContractResult, CustomQuery, FullDelegation, OwnedDeps, Querier, QuerierResult, QueryRequest, SystemError, SystemResult, Uint128, Validator, }; use schemars::JsonSchema; @@ -43,7 +43,7 @@ pub struct WasmMockQuerier { impl Querier for WasmMockQuerier { fn raw_query(&self, bin_request: &[u8]) -> QuerierResult { - let request: QueryRequest = match from_slice(bin_request) { + let request: QueryRequest = match from_json(bin_request) { Ok(v) => v, Err(e) => { return QuerierResult::Err(SystemError::InvalidRequest { diff --git a/contracts/neutron_interchain_queries/src/testing/tests.rs b/contracts/neutron_interchain_queries/src/testing/tests.rs index fdd34cf2..1bc4f421 100644 --- a/contracts/neutron_interchain_queries/src/testing/tests.rs +++ b/contracts/neutron_interchain_queries/src/testing/tests.rs @@ -16,8 +16,8 @@ use cosmos_sdk_proto::traits::Message; use cosmos_sdk_proto::Any; use cosmwasm_std::testing::{mock_env, mock_info, MockApi, MockStorage}; use cosmwasm_std::{ - from_binary, to_binary, Addr, Binary, Coin, Decimal, Delegation, Env, MessageInfo, OwnedDeps, - StdError, Uint128, + from_json, to_json_binary, Addr, Binary, Coin, Decimal, Delegation, Env, MessageInfo, + OwnedDeps, StdError, Uint128, }; use neutron_sdk::bindings::query::{ NeutronQuery, QueryRegisteredQueryResponse, QueryRegisteredQueryResultResponse, @@ -257,7 +257,7 @@ fn test_query_balance() { ); let query_balance = QueryMsg::Balance { query_id: 1 }; let resp: BalanceResponse = - from_binary(&query(deps.as_ref(), mock_env(), query_balance).unwrap()).unwrap(); + from_json(query(deps.as_ref(), mock_env(), query_balance).unwrap()).unwrap(); assert_eq!( resp, BalanceResponse { @@ -304,11 +304,11 @@ fn test_bank_total_supply_query() { deps.querier.add_registered_queries(1, registered_query); deps.querier - .add_query_response(1, to_binary(&total_supply_response).unwrap()); + .add_query_response(1, to_json_binary(&total_supply_response).unwrap()); let bank_total_balance = QueryMsg::BankTotalSupply { query_id: 1 }; let resp: TotalSupplyResponse = - from_binary(&query(deps.as_ref(), mock_env(), bank_total_balance).unwrap()).unwrap(); + from_json(query(deps.as_ref(), mock_env(), bank_total_balance).unwrap()).unwrap(); assert_eq!( resp, TotalSupplyResponse { @@ -347,7 +347,7 @@ fn test_distribution_fee_pool_query() { ); let fee_pool_balance = QueryMsg::DistributionFeePool { query_id: 1 }; let resp: FeePoolResponse = - from_binary(&query(deps.as_ref(), mock_env(), fee_pool_balance).unwrap()).unwrap(); + from_json(query(deps.as_ref(), mock_env(), fee_pool_balance).unwrap()).unwrap(); assert_eq!( resp, FeePoolResponse { @@ -393,11 +393,11 @@ fn test_gov_proposals_query() { deps.querier.add_registered_queries(1, registered_query); deps.querier - .add_query_response(1, to_binary(&proposals_response).unwrap()); + .add_query_response(1, to_json_binary(&proposals_response).unwrap()); let government_proposal = QueryMsg::GovernmentProposals { query_id: 1 }; let resp: ProposalResponse = - from_binary(&query(deps.as_ref(), mock_env(), government_proposal).unwrap()).unwrap(); + from_json(query(deps.as_ref(), mock_env(), government_proposal).unwrap()).unwrap(); assert_eq!( resp, ProposalResponse { @@ -503,10 +503,10 @@ fn test_staking_validators_query() { deps.querier.add_registered_queries(1, registered_query); deps.querier - .add_query_response(1, to_binary(&validators_response).unwrap()); + .add_query_response(1, to_json_binary(&validators_response).unwrap()); let staking_validators = QueryMsg::StakingValidators { query_id: 1 }; let resp: ValidatorResponse = - from_binary(&query(deps.as_ref(), mock_env(), staking_validators).unwrap()).unwrap(); + from_json(query(deps.as_ref(), mock_env(), staking_validators).unwrap()).unwrap(); assert_eq!( resp, ValidatorResponse { @@ -649,12 +649,12 @@ fn test_query_delegator_delegations() { build_registered_query_response(1, QueryParam::Keys(keys.0), QueryType::KV, 987); deps.querier - .add_query_response(1, to_binary(&delegations_response).unwrap()); + .add_query_response(1, to_json_binary(&delegations_response).unwrap()); deps.querier.add_registered_queries(1, registered_query); let query_delegations = QueryMsg::GetDelegations { query_id: 1 }; let resp: DelegatorDelegationsResponse = - from_binary(&query(deps.as_ref(), mock_env(), query_delegations).unwrap()).unwrap(); + from_json(query(deps.as_ref(), mock_env(), query_delegations).unwrap()).unwrap(); assert_eq!( resp, diff --git a/contracts/neutron_interchain_txs/schema/execute_msg.json b/contracts/neutron_interchain_txs/schema/execute_msg.json index 32b0ae95..528b52cc 100644 --- a/contracts/neutron_interchain_txs/schema/execute_msg.json +++ b/contracts/neutron_interchain_txs/schema/execute_msg.json @@ -12,7 +12,8 @@ "type": "object", "required": [ "connection_id", - "interchain_account_id" + "interchain_account_id", + "register_fee" ], "properties": { "connection_id": { @@ -20,6 +21,12 @@ }, "interchain_account_id": { "type": "string" + }, + "register_fee": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } } } } @@ -110,5 +117,26 @@ }, "additionalProperties": false } - ] + ], + "definitions": { + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } } diff --git a/contracts/neutron_interchain_txs/src/contract.rs b/contracts/neutron_interchain_txs/src/contract.rs index 71df7894..6823589e 100644 --- a/contracts/neutron_interchain_txs/src/contract.rs +++ b/contracts/neutron_interchain_txs/src/contract.rs @@ -6,8 +6,8 @@ use cosmos_sdk_proto::traits::Message; #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - to_binary, Binary, CosmosMsg, CustomQuery, Deps, DepsMut, Env, MessageInfo, Reply, Response, - StdError, StdResult, SubMsg, + to_json_binary, Binary, Coin as CoinSDK, CosmosMsg, CustomQuery, Deps, DepsMut, Env, + MessageInfo, Reply, Response, StdError, StdResult, SubMsg, }; use cw2::set_contract_version; use schemars::JsonSchema; @@ -78,7 +78,14 @@ pub fn execute( ExecuteMsg::Register { connection_id, interchain_account_id, - } => execute_register_ica(deps, env, connection_id, interchain_account_id), + register_fee, + } => execute_register_ica( + deps, + env, + connection_id, + interchain_account_id, + register_fee, + ), ExecuteMsg::Delegate { validator, interchain_account_id, @@ -144,7 +151,7 @@ pub fn query_interchain_address( }; let res: QueryInterchainAccountAddressResponse = deps.querier.query(&query.into())?; - Ok(to_binary(&res)?) + Ok(to_json_binary(&res)?) } // returns ICA address from the contract storage. The address was saved in sudo_open_ack method @@ -153,7 +160,11 @@ pub fn query_interchain_address_contract( env: Env, interchain_account_id: String, ) -> NeutronResult { - Ok(to_binary(&get_ica(deps, &env, &interchain_account_id)?)?) + Ok(to_json_binary(&get_ica( + deps, + &env, + &interchain_account_id, + )?)?) } // returns the result @@ -165,12 +176,12 @@ pub fn query_acknowledgement_result( ) -> NeutronResult { let port_id = get_port_id(env.contract.address.as_str(), &interchain_account_id); let res = ACKNOWLEDGEMENT_RESULTS.may_load(deps.storage, (port_id, sequence_id))?; - Ok(to_binary(&res)?) + Ok(to_json_binary(&res)?) } pub fn query_errors_queue(deps: Deps) -> NeutronResult { let res = read_errors_from_queue(deps.storage)?; - Ok(to_binary(&res)?) + Ok(to_json_binary(&res)?) } // saves payload to process later to the storage and returns a SubmitTX Cosmos SubMsg with necessary reply id @@ -188,9 +199,13 @@ fn execute_register_ica( env: Env, connection_id: String, interchain_account_id: String, + register_fee: Vec, ) -> NeutronResult> { - let register = - NeutronMsg::register_interchain_account(connection_id, interchain_account_id.clone()); + let register = NeutronMsg::register_interchain_account( + connection_id, + interchain_account_id.clone(), + Some(register_fee), + ); let key = get_port_id(env.contract.address.as_str(), &interchain_account_id); // we are saving empty data here because we handle response of registering ICA in sudo_open_ack method INTERCHAIN_ACCOUNTS.save(deps.storage, key, &None)?; diff --git a/contracts/neutron_interchain_txs/src/msg.rs b/contracts/neutron_interchain_txs/src/msg.rs index 5c24f5fc..b81e72c7 100644 --- a/contracts/neutron_interchain_txs/src/msg.rs +++ b/contracts/neutron_interchain_txs/src/msg.rs @@ -1,3 +1,4 @@ +use cosmwasm_std::Coin; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; @@ -34,6 +35,7 @@ pub enum ExecuteMsg { Register { connection_id: String, interchain_account_id: String, + register_fee: Vec, }, Delegate { interchain_account_id: String, diff --git a/contracts/neutron_interchain_txs/src/storage.rs b/contracts/neutron_interchain_txs/src/storage.rs index 27a7eeea..ea4687d1 100644 --- a/contracts/neutron_interchain_txs/src/storage.rs +++ b/contracts/neutron_interchain_txs/src/storage.rs @@ -1,4 +1,4 @@ -use cosmwasm_std::{from_binary, to_vec, Binary, Order, StdResult, Storage}; +use cosmwasm_std::{from_json, to_json_vec, Binary, Order, StdResult, Storage}; use cw_storage_plus::{Item, Map}; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; @@ -38,12 +38,12 @@ pub enum AcknowledgementResult { } pub fn save_reply_payload(store: &mut dyn Storage, payload: SudoPayload) -> StdResult<()> { - REPLY_ID_STORAGE.save(store, &to_vec(&payload)?) + REPLY_ID_STORAGE.save(store, &to_json_vec(&payload)?) } pub fn read_reply_payload(store: &dyn Storage) -> StdResult { let data = REPLY_ID_STORAGE.load(store)?; - from_binary(&Binary(data)) + from_json(Binary(data)) } pub fn add_error_to_queue(store: &mut dyn Storage, error_msg: String) -> Option<()> { @@ -69,7 +69,7 @@ pub fn read_sudo_payload( seq_id: u64, ) -> StdResult { let data = SUDO_PAYLOAD.load(store, (channel_id, seq_id))?; - from_binary(&Binary(data)) + from_json(Binary(data)) } pub fn save_sudo_payload( @@ -78,5 +78,5 @@ pub fn save_sudo_payload( seq_id: u64, payload: SudoPayload, ) -> StdResult<()> { - SUDO_PAYLOAD.save(store, (channel_id, seq_id), &to_vec(&payload)?) + SUDO_PAYLOAD.save(store, (channel_id, seq_id), &to_json_vec(&payload)?) } diff --git a/contracts/neutron_interchain_txs/src/testing/tests.rs b/contracts/neutron_interchain_txs/src/testing/tests.rs index ab57cb8b..de11aad6 100644 --- a/contracts/neutron_interchain_txs/src/testing/tests.rs +++ b/contracts/neutron_interchain_txs/src/testing/tests.rs @@ -6,7 +6,7 @@ use crate::{ }; use cosmwasm_std::{ - from_binary, + from_json, testing::{MockApi, MockQuerier, MockStorage}, OwnedDeps, }; @@ -27,7 +27,7 @@ fn test_query_errors_queue() { let mut deps = mock_dependencies(); let result = query_errors_queue(deps.as_ref()).unwrap(); - let result: Vec<(Vec, String)> = from_binary(&result).unwrap(); + let result: Vec<(Vec, String)> = from_json(result).unwrap(); assert_eq!(0, result.len()); @@ -38,7 +38,7 @@ fn test_query_errors_queue() { .unwrap(); let result = query_errors_queue(deps.as_ref()).unwrap(); - let result: Vec<(Vec, String)> = from_binary(&result).unwrap(); + let result: Vec<(Vec, String)> = from_json(result).unwrap(); assert_eq!(1, result.len()); } diff --git a/packages/neutron-sdk/Cargo.toml b/packages/neutron-sdk/Cargo.toml index 0cfe3b75..49e30845 100644 --- a/packages/neutron-sdk/Cargo.toml +++ b/packages/neutron-sdk/Cargo.toml @@ -9,7 +9,7 @@ homepage = "https://neutron.org" readme = "README.md" [dependencies] -cosmwasm-std = { workspace = true } +cosmwasm-std = { workspace = true, features = ["stargate"] } cosmos-sdk-proto = { workspace = true } serde = { workspace = true } schemars = { workspace = true } @@ -18,6 +18,10 @@ bech32 = { workspace = true } thiserror = { workspace = true } protobuf = { workspace = true } cosmwasm-schema = { workspace = true } +prost = { workspace = true } +prost-types = { workspace = true } +tendermint-proto = { workspace = true } +speedate = { workspace = true } [dev-dependencies] base64 = { workspace = true } diff --git a/packages/neutron-sdk/schema/neutron_msg.json b/packages/neutron-sdk/schema/neutron_msg.json index ddb82215..a9acef08 100644 --- a/packages/neutron-sdk/schema/neutron_msg.json +++ b/packages/neutron-sdk/schema/neutron_msg.json @@ -24,6 +24,16 @@ "interchain_account_id": { "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" + }, + "register_fee": { + "description": "*register_fee** is a fees required to be payed to register interchain account", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Coin" + } } } } @@ -388,6 +398,31 @@ }, "additionalProperties": false }, + { + "description": "TokenFactory message. Contracts can set before send hooks for denoms, namespaced under the contract's address.", + "type": "object", + "required": [ + "set_before_send_hook" + ], + "properties": { + "set_before_send_hook": { + "type": "object", + "required": [ + "contract_addr", + "denom" + ], + "properties": { + "contract_addr": { + "type": "string" + }, + "denom": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, { "description": "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]", "type": "object", @@ -445,6 +480,29 @@ } }, "additionalProperties": false + }, + { + "description": "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]", + "type": "object", + "required": [ + "resubmit_failure" + ], + "properties": { + "resubmit_failure": { + "type": "object", + "required": [ + "failure_id" + ], + "properties": { + "failure_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + } + }, + "additionalProperties": false } ], "definitions": { @@ -452,6 +510,7 @@ "description": "AdminProposal defines the struct for various proposals which Neutron's Admin Module may accept.", "oneOf": [ { + "description": "Proposal to change params. Note that this works for old params. New params has their own `MsgUpdateParams` msgs that can be supplied to `ProposalExecuteMessage`", "type": "object", "required": [ "param_change_proposal" @@ -464,54 +523,75 @@ "additionalProperties": false }, { + "description": "Proposal to upgrade IBC client", "type": "object", "required": [ - "software_upgrade_proposal" + "upgrade_proposal" ], "properties": { - "software_upgrade_proposal": { - "$ref": "#/definitions/SoftwareUpgradeProposal" + "upgrade_proposal": { + "$ref": "#/definitions/UpgradeProposal" } }, "additionalProperties": false }, { + "description": "Proposal to update IBC client", "type": "object", "required": [ - "cancel_software_upgrade_proposal" + "client_update_proposal" ], "properties": { - "cancel_software_upgrade_proposal": { - "$ref": "#/definitions/CancelSoftwareUpgradeProposal" + "client_update_proposal": { + "$ref": "#/definitions/ClientUpdateProposal" } }, "additionalProperties": false }, { + "description": "Proposal to execute CosmosMsg.", "type": "object", "required": [ - "upgrade_proposal" + "proposal_execute_message" ], "properties": { - "upgrade_proposal": { - "$ref": "#/definitions/UpgradeProposal" + "proposal_execute_message": { + "$ref": "#/definitions/ProposalExecuteMessage" } }, "additionalProperties": false }, { + "description": "Deprecated. Proposal to upgrade network", + "deprecated": true, "type": "object", "required": [ - "client_update_proposal" + "software_upgrade_proposal" ], "properties": { - "client_update_proposal": { - "$ref": "#/definitions/ClientUpdateProposal" + "software_upgrade_proposal": { + "$ref": "#/definitions/SoftwareUpgradeProposal" } }, "additionalProperties": false }, { + "description": "Deprecated. Proposal to cancel existing software upgrade", + "deprecated": true, + "type": "object", + "required": [ + "cancel_software_upgrade_proposal" + ], + "properties": { + "cancel_software_upgrade_proposal": { + "$ref": "#/definitions/CancelSoftwareUpgradeProposal" + } + }, + "additionalProperties": false + }, + { + "description": "Deprecated. Will fail to execute if you use it. Deprecated. Proposal to pin wasm contract codes", + "deprecated": true, "type": "object", "required": [ "pin_codes_proposal" @@ -524,6 +604,8 @@ "additionalProperties": false }, { + "description": "Deprecated. Deprecated. Proposal to unpin wasm contract codes.", + "deprecated": true, "type": "object", "required": [ "unpin_codes_proposal" @@ -536,6 +618,8 @@ "additionalProperties": false }, { + "description": "Deprecated. Proposal to call sudo on contract.", + "deprecated": true, "type": "object", "required": [ "sudo_contract_proposal" @@ -548,6 +632,8 @@ "additionalProperties": false }, { + "description": "Deprecated. Proposal to update contract admin.", + "deprecated": true, "type": "object", "required": [ "update_admin_proposal" @@ -560,6 +646,8 @@ "additionalProperties": false }, { + "description": "Deprecated. Proposal to clear contract admin.", + "deprecated": true, "type": "object", "required": [ "clear_admin_proposal" @@ -578,7 +666,8 @@ "type": "string" }, "CancelSoftwareUpgradeProposal": { - "description": "CancelSoftwareUpgradeProposal defines the struct for cancel software upgrade proposal.", + "description": "Deprecated. CancelSoftwareUpgradeProposal defines the struct for cancel software upgrade proposal.", + "deprecated": true, "type": "object", "required": [ "description", @@ -596,7 +685,8 @@ } }, "ClearAdminProposal": { - "description": "SudoContractProposal defines the struct for clear admin proposal.", + "description": "Deprecated. SudoContractProposal defines the struct for clear admin proposal.", + "deprecated": true, "type": "object", "required": [ "contract", @@ -783,7 +873,8 @@ } }, "PinCodesProposal": { - "description": "PinCodesProposal defines the struct for pin contract codes proposal.", + "description": "Deprecated. PinCodesProposal defines the struct for pin contract codes proposal.", + "deprecated": true, "type": "object", "required": [ "code_ids", @@ -834,6 +925,19 @@ } } }, + "ProposalExecuteMessage": { + "description": "ProposalExecuteMessage defines the struct for sdk47 compatible admin proposal.", + "type": "object", + "required": [ + "message" + ], + "properties": { + "message": { + "description": "*message** is a json representing an sdk message passed to admin module to execute.", + "type": "string" + } + } + }, "ProtobufAny": { "description": "Type for wrapping any protobuf message", "type": "object", @@ -878,7 +982,8 @@ } }, "SoftwareUpgradeProposal": { - "description": "SoftwareUpgradeProposal defines the struct for software upgrade proposal.", + "description": "Deprecated. SoftwareUpgradeProposal defines the struct for software upgrade proposal.", + "deprecated": true, "type": "object", "required": [ "description", @@ -905,7 +1010,8 @@ } }, "SudoContractProposal": { - "description": "SudoContractProposal defines the struct for sudo execution proposal.", + "description": "Deprecated. SudoContractProposal defines the struct for sudo execution proposal.", + "deprecated": true, "type": "object", "required": [ "contract", @@ -941,7 +1047,8 @@ "type": "string" }, "UnpinCodesProposal": { - "description": "UnpinCodesProposal defines the struct for unpin contract codes proposal.", + "description": "Deprecated. UnpinCodesProposal defines the struct for unpin contract codes proposal.", + "deprecated": true, "type": "object", "required": [ "code_ids", @@ -969,7 +1076,8 @@ } }, "UpdateAdminProposal": { - "description": "UpdateAdminProposal defines the struct for update admin proposal.", + "description": "Deprecated. UpdateAdminProposal defines the struct for update admin proposal.", + "deprecated": true, "type": "object", "required": [ "contract", @@ -997,7 +1105,7 @@ } }, "UpgradeProposal": { - "description": "UpgradeProposal defines the struct for upgrade proposal.", + "description": "UpgradeProposal defines the struct for IBC upgrade proposal.", "type": "object", "required": [ "description", diff --git a/packages/neutron-sdk/schema/neutron_query.json b/packages/neutron-sdk/schema/neutron_query.json index 15abd5f9..06e194db 100644 --- a/packages/neutron-sdk/schema/neutron_query.json +++ b/packages/neutron-sdk/schema/neutron_query.json @@ -186,6 +186,52 @@ } }, "additionalProperties": false + }, + { + "description": "TokenFactory query. Returns the before send hook address of a denom, if the denom is a TokenFactory denom.", + "type": "object", + "required": [ + "before_send_hook" + ], + "properties": { + "before_send_hook": { + "type": "object", + "required": [ + "denom" + ], + "properties": { + "denom": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Contractmanager query. Returns the failures for a particular contract address.", + "type": "object", + "required": [ + "failures" + ], + "properties": { + "failures": { + "type": "object", + "required": [ + "address", + "pagination" + ], + "properties": { + "address": { + "type": "string" + }, + "pagination": { + "$ref": "#/definitions/PageRequest" + } + } + } + }, + "additionalProperties": false } ], "definitions": { diff --git a/packages/neutron-sdk/src/bindings/mod.rs b/packages/neutron-sdk/src/bindings/mod.rs index 299b4f33..8ebe3644 100644 --- a/packages/neutron-sdk/src/bindings/mod.rs +++ b/packages/neutron-sdk/src/bindings/mod.rs @@ -1,3 +1,4 @@ +#[allow(deprecated)] pub mod msg; 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 b102210e..d8be335c 100644 --- a/packages/neutron-sdk/src/bindings/msg.rs +++ b/packages/neutron-sdk/src/bindings/msg.rs @@ -38,6 +38,9 @@ pub enum NeutronMsg { /// **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>, }, /// SubmitTx starts the process of executing any Cosmos-SDK *msgs* on remote chain. @@ -131,12 +134,14 @@ pub enum NeutronMsg { /// 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. @@ -145,6 +150,7 @@ pub enum NeutronMsg { amount: Uint128, mint_to_address: String, }, + /// TokenFactory message. /// Contracts can burn native tokens for an existing factory denom /// that they are the admin of. @@ -156,6 +162,13 @@ pub enum NeutronMsg { 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, + }, + /// 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. @@ -169,9 +182,16 @@ pub enum NeutronMsg { /// list of cosmwasm messages to be executed msgs: Vec, }, + /// 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 }, } impl NeutronMsg { @@ -181,10 +201,12 @@ impl NeutronMsg { pub fn register_interchain_account( connection_id: String, interchain_account_id: String, + register_fee: Option>, ) -> Self { NeutronMsg::RegisterInterchainAccount { connection_id, interchain_account_id, + register_fee, } } @@ -299,25 +321,7 @@ impl NeutronMsg { } } - /// Basic helper to define a parameter change proposal passed to AdminModule: - /// * **proposal** is struct which contains proposal that sets upgrade block. - pub fn submit_software_upgrade_proposal(proposal: SoftwareUpgradeProposal) -> Self { - NeutronMsg::SubmitAdminProposal { - admin_proposal: AdminProposal::SoftwareUpgradeProposal(proposal), - } - } - - /// Basic helper to define a parameter change proposal passed to AdminModule: - /// * **proposal** is struct which contains proposal that cancels software upgrade. - pub fn submit_cancel_software_upgrade_proposal( - proposal: CancelSoftwareUpgradeProposal, - ) -> Self { - NeutronMsg::SubmitAdminProposal { - admin_proposal: AdminProposal::CancelSoftwareUpgradeProposal(proposal), - } - } - - /// Basic helper to define a parameter change proposal passed to AdminModule: + /// 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 { @@ -325,23 +329,7 @@ impl NeutronMsg { } } - /// Basic helper to define a parameter change proposal passed to AdminModule: - /// * **proposal** is struct which contains proposal that pins code ids. - pub fn submit_pin_codes_proposal(proposal: PinCodesProposal) -> Self { - NeutronMsg::SubmitAdminProposal { - admin_proposal: AdminProposal::PinCodesProposal(proposal), - } - } - - /// Basic helper to define a parameter change proposal passed to AdminModule: - /// * **proposal** is struct which contains proposal that unpins codes ids. - pub fn submit_unpin_codes_proposal(proposal: UnpinCodesProposal) -> Self { - NeutronMsg::SubmitAdminProposal { - admin_proposal: AdminProposal::UnpinCodesProposal(proposal), - } - } - - /// Basic helper to define a parameter change proposal passed to AdminModule: + /// 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 { @@ -349,28 +337,25 @@ impl NeutronMsg { } } - /// Basic helper to define a parameter change proposal passed to AdminModule: - /// * **proposal** is struct which contains proposal updates admin of contract. - pub fn submit_update_admin_proposal(proposal: UpdateAdminProposal) -> Self { + /// 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::UpdateAdminProposal(proposal), - } - } - - /// Basic helper to define a parameter change proposal passed to AdminModule: - /// * **proposal** is struct which contains proposal that clears admin of contract. - pub fn submit_clear_admin_proposal(proposal: ClearAdminProposal) -> Self { - NeutronMsg::SubmitAdminProposal { - admin_proposal: AdminProposal::ClearAdminProposal(proposal), + 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, @@ -381,6 +366,10 @@ impl NeutronMsg { } } + // 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, @@ -393,6 +382,9 @@ impl NeutronMsg { } } + // 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. pub fn submit_burn_tokens(denom: impl Into, amount: Uint128) -> Self { NeutronMsg::BurnTokens { denom: denom.into(), @@ -401,13 +393,37 @@ impl NeutronMsg { } } + // 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 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. pub fn submit_add_schedule(name: String, period: u64, msgs: Vec) -> Self { NeutronMsg::AddSchedule { name, period, msgs } } + // 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 { @@ -450,15 +466,67 @@ pub struct MsgIbcTransferResponse { #[serde(rename_all = "snake_case")] /// AdminProposal defines the struct for various proposals which Neutron's Admin Module may accept. pub enum AdminProposal { + /// Proposal to change params. Note that this works for old params. + /// New params has their own `MsgUpdateParams` msgs that can be supplied to `ProposalExecuteMessage` ParamChangeProposal(ParamChangeProposal), - SoftwareUpgradeProposal(SoftwareUpgradeProposal), - CancelSoftwareUpgradeProposal(CancelSoftwareUpgradeProposal), + + /// Proposal to upgrade IBC client UpgradeProposal(UpgradeProposal), + + /// Proposal to update IBC client ClientUpdateProposal(ClientUpdateProposal), + + /// Proposal to execute CosmosMsg. + ProposalExecuteMessage(ProposalExecuteMessage), + + #[deprecated( + since = "0.7.0", + note = "Used only for querying old proposals. Will fail if executed in a new proposal. Use ProposalExecuteMessage instead" + )] + /// Deprecated. Proposal to upgrade network + SoftwareUpgradeProposal(SoftwareUpgradeProposal), + + #[deprecated( + since = "0.7.0", + note = "Used only for querying old proposals. Will fail if executed in a new proposal. Use ProposalExecuteMessage instead" + )] + /// Deprecated. Proposal to cancel existing software upgrade + CancelSoftwareUpgradeProposal(CancelSoftwareUpgradeProposal), + + /// Deprecated. Will fail to execute if you use it. + #[deprecated( + since = "0.7.0", + note = "Used only for querying old proposals. Will fail if executed in a new proposal. Use ProposalExecuteMessage instead" + )] + /// Deprecated. Proposal to pin wasm contract codes PinCodesProposal(PinCodesProposal), + + #[deprecated( + since = "0.7.0", + note = "Used only for querying old proposals. Will fail if executed in a new proposal. Use ProposalExecuteMessage instead" + )] + /// Deprecated. Deprecated. Proposal to unpin wasm contract codes. UnpinCodesProposal(UnpinCodesProposal), + + #[deprecated( + since = "0.7.0", + note = "Used only for querying old proposals. Will fail if executed in a new proposal. Use ProposalExecuteMessage instead" + )] + /// Deprecated. Proposal to call sudo on contract. SudoContractProposal(SudoContractProposal), + + #[deprecated( + since = "0.7.0", + note = "Used only for querying old proposals. Will fail if executed in a new proposal. Use ProposalExecuteMessage instead" + )] + /// Deprecated. Proposal to update contract admin. UpdateAdminProposal(UpdateAdminProposal), + + #[deprecated( + since = "0.7.0", + note = "Used only for querying old proposals. Will fail if executed in a new proposal. Use ProposalExecuteMessage instead" + )] + /// Deprecated. Proposal to clear contract admin. ClearAdminProposal(ClearAdminProposal), } @@ -486,28 +554,6 @@ pub struct ParamChange { pub value: String, } -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -/// SoftwareUpgradeProposal defines the struct for software upgrade proposal. -pub struct SoftwareUpgradeProposal { - /// **title** is a text title of proposal. Non unique. - pub title: String, - /// **description** is a text description of proposal. Non unique. - pub description: String, - /// **plan** is a plan of upgrade. - pub plan: Plan, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -/// CancelSoftwareUpgradeProposal defines the struct for cancel software upgrade proposal. -pub struct CancelSoftwareUpgradeProposal { - /// **title** is a text title of proposal. Non unique. - pub title: String, - /// **description** is a text description of proposal. Non unique. - pub description: String, -} - #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] #[serde(rename_all = "snake_case")] /// Plan defines the struct for planned upgrade. @@ -522,7 +568,7 @@ pub struct Plan { #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] #[serde(rename_all = "snake_case")] -/// UpgradeProposal defines the struct for upgrade proposal. +/// UpgradeProposal defines the struct for IBC upgrade proposal. pub struct UpgradeProposal { /// **title** is a text title of proposal. pub title: String, @@ -550,31 +596,59 @@ pub struct ClientUpdateProposal { #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] #[serde(rename_all = "snake_case")] -/// PinCodesProposal defines the struct for pin contract codes proposal. -pub struct PinCodesProposal { - /// **title** is a text title of proposal. +/// ProposalExecuteMessage defines the struct for sdk47 compatible admin proposal. +pub struct ProposalExecuteMessage { + /// **message** is a json representing an sdk message passed to admin module to execute. + pub message: String, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +#[serde(rename_all = "snake_case")] +/// MsgExecuteContract defines a call to the contract execution +pub struct MsgExecuteContract { + /// **contract** is a contract address that will be called + pub contract: String, + /// **msg** is a contract call message + pub msg: String, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +#[serde(rename_all = "snake_case")] +#[deprecated( + since = "0.7.0", + note = "Used only for querying old proposals. Will fail if executed in a new proposal. Use ProposalExecuteMessage instead" +)] +/// Deprecated. SoftwareUpgradeProposal defines the struct for software upgrade proposal. +pub struct SoftwareUpgradeProposal { + /// **title** is a text title of proposal. Non unique. pub title: String, - /// **description** is a text description of proposal. + /// **description** is a text description of proposal. Non unique. pub description: String, - /// **code_ids** is an array of codes to be pined. - pub code_ids: Vec, + /// **plan** is a plan of upgrade. + pub plan: Plan, } #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] #[serde(rename_all = "snake_case")] -/// UnpinCodesProposal defines the struct for unpin contract codes proposal. -pub struct UnpinCodesProposal { - /// **title** is a text title of proposal. +#[deprecated( + since = "0.7.0", + note = "Used only for querying old proposals. Will fail if executed in a new proposal. Use ProposalExecuteMessage instead" +)] +/// Deprecated. CancelSoftwareUpgradeProposal defines the struct for cancel software upgrade proposal. +pub struct CancelSoftwareUpgradeProposal { + /// **title** is a text title of proposal. Non unique. pub title: String, - /// **description** is a text description of proposal. + /// **description** is a text description of proposal. Non unique. pub description: String, - /// **code_ids** is an array of codes to be unpined. - pub code_ids: Vec, } #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] #[serde(rename_all = "snake_case")] -/// SudoContractProposal defines the struct for sudo execution proposal. +#[deprecated( + since = "0.7.0", + note = "Used only for querying old proposals. Will fail if executed in a new proposal. Use ProposalExecuteMessage instead" +)] +/// Deprecated. SudoContractProposal defines the struct for sudo execution proposal. pub struct SudoContractProposal { /// **title** is a text title of proposal. pub title: String, @@ -588,7 +662,43 @@ pub struct SudoContractProposal { #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] #[serde(rename_all = "snake_case")] -/// UpdateAdminProposal defines the struct for update admin proposal. +#[deprecated( + since = "0.7.0", + note = "Used only for querying old proposals. Will fail if executed in a new proposal. Use ProposalExecuteMessage instead" +)] +/// Deprecated. PinCodesProposal defines the struct for pin contract codes proposal. +pub struct PinCodesProposal { + /// **title** is a text title of proposal. + pub title: String, + /// **description** is a text description of proposal. + pub description: String, + /// **code_ids** is an array of codes to be pined. + pub code_ids: Vec, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +#[serde(rename_all = "snake_case")] +#[deprecated( + since = "0.7.0", + note = "Used only for querying old proposals. Will fail if executed in a new proposal. Use ProposalExecuteMessage instead" +)] +/// Deprecated. UnpinCodesProposal defines the struct for unpin contract codes proposal. +pub struct UnpinCodesProposal { + /// **title** is a text title of proposal. + pub title: String, + /// **description** is a text description of proposal. + pub description: String, + /// **code_ids** is an array of codes to be unpined. + pub code_ids: Vec, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +#[serde(rename_all = "snake_case")] +#[deprecated( + since = "0.7.0", + note = "Used only for querying old proposals. Will fail if executed in a new proposal. Use ProposalExecuteMessage instead" +)] +/// Deprecated. UpdateAdminProposal defines the struct for update admin proposal. pub struct UpdateAdminProposal { /// **title** is a text title of proposal. pub title: String, @@ -602,7 +712,11 @@ pub struct UpdateAdminProposal { #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] #[serde(rename_all = "snake_case")] -/// SudoContractProposal defines the struct for clear admin proposal. +#[deprecated( + since = "0.7.0", + note = "Used only for querying old proposals. Will fail if executed in a new proposal. Use ProposalExecuteMessage instead" +)] +/// Deprecated. SudoContractProposal defines the struct for clear admin proposal. pub struct ClearAdminProposal { /// **title** is a text title of proposal. pub title: String, @@ -611,13 +725,3 @@ pub struct ClearAdminProposal { /// **contract** is an address of contract admin will be removed. pub contract: String, } - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -/// MsgExecuteContract defines a call to the contract execution -pub struct MsgExecuteContract { - /// **contract** is a contract address that will be called - pub contract: String, - /// **msg** is a contract call message - pub msg: String, -} diff --git a/packages/neutron-sdk/src/bindings/query.rs b/packages/neutron-sdk/src/bindings/query.rs index b61a797f..5810b8ab 100644 --- a/packages/neutron-sdk/src/bindings/query.rs +++ b/packages/neutron-sdk/src/bindings/query.rs @@ -1,5 +1,5 @@ -use crate::bindings::types::{InterchainQueryResult, RegisteredQuery}; -use cosmwasm_std::{Binary, CustomQuery}; +use crate::bindings::types::{Failure, InterchainQueryResult, RegisteredQuery}; +use cosmwasm_std::{Binary, CustomQuery, Uint64}; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; @@ -56,6 +56,15 @@ pub enum NeutronQuery { /// 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, + }, } #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] @@ -64,21 +73,33 @@ 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. - key: Binary, + 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. - offset: u64, + 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. - limit: u64, + 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. - count_total: bool, + pub count_total: bool, /// reverse is set to true if results are to be returned in the descending order. - reverse: bool, + 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)] @@ -108,4 +129,11 @@ pub struct QueryInterchainAccountAddressResponse { 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 {} diff --git a/packages/neutron-sdk/src/bindings/types.rs b/packages/neutron-sdk/src/bindings/types.rs index 48509d32..01d95c80 100644 --- a/packages/neutron-sdk/src/bindings/types.rs +++ b/packages/neutron-sdk/src/bindings/types.rs @@ -96,6 +96,69 @@ pub struct StorageValue { pub value: Binary, } +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +#[serde(rename_all = "snake_case")] +/// Acknowledgement Failure of sudo handler; can be resubmitted. +pub struct Failure { + /// **address** of the failed contract + pub address: String, + /// **id** of the failure under specific address + pub id: u64, + /// **ack_type** is an acknowledgement type ('ack' or 'timeout') + pub ack_type: String, + /// **packet** is an IBC Packet that was sent + pub packet: Option, + /// **ack** is an acknowledgement data + pub ack: Option, +} + +#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, JsonSchema, Debug)] +#[serde(rename_all = "snake_case")] +/// IBC packet +pub struct Packet { + /// **sequence** number of packet in ordered channel + pub sequence: u64, + + /// **source_port** of packet packet + pub source_port: String, + + /// **source_channel** of a packet + pub source_channel: String, + + /// **destination_port** of a packet + pub destination_port: String, + + /// **destination_channel** of a packet + pub destination_channel: String, + + /// **data** of a packet + pub data: Binary, + + /// **timeout_height** of a packet + pub timeout_height: Option, + + /// **timeout_timestamp** of a packet + pub timeout_timestamp: Option, +} + +#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, JsonSchema, Debug)] +#[serde(rename_all = "snake_case")] +/// IBC message Acknowledgement +pub struct Acknowledgement { + #[serde(rename(serialize = "response", deserialize = "Response"))] + pub response: AcknowledgementResponse, +} + +#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, JsonSchema, Debug)] +#[serde(rename_all = "snake_case")] +/// IBC message acknowledgement response +pub enum AcknowledgementResponse { + /// Error response + Error(String), + /// Successful response with result as encoded binary + Result(Binary), +} + #[derive(Serialize, Deserialize, Clone, PartialEq, Eq, JsonSchema, Debug)] #[serde(rename_all = "snake_case")] /// Type for wrapping any protobuf message diff --git a/packages/neutron-sdk/src/interchain_queries/v045/testing.rs b/packages/neutron-sdk/src/interchain_queries/v045/testing.rs index bfcacc36..db7abbae 100644 --- a/packages/neutron-sdk/src/interchain_queries/v045/testing.rs +++ b/packages/neutron-sdk/src/interchain_queries/v045/testing.rs @@ -22,7 +22,7 @@ use cosmos_sdk_proto::cosmos::staking::v1beta1::{ }; use cosmos_sdk_proto::traits::Message; use cosmwasm_std::{ - to_binary, Addr, Binary, Coin as StdCoin, Decimal, Delegation as StdDelegation, Uint128, + to_json_binary, Addr, Binary, Coin as StdCoin, Decimal, Delegation as StdDelegation, Uint128, }; use hex; use std::ops::Mul; @@ -728,7 +728,7 @@ fn test_delegations_reconstruct() { if ts.stake_denom.is_empty() { return Default::default(); } - to_binary(&ts.stake_denom).unwrap() + to_json_binary(&ts.stake_denom).unwrap() }, }]; diff --git a/packages/neutron-sdk/src/interchain_queries/v045/types.rs b/packages/neutron-sdk/src/interchain_queries/v045/types.rs index 072565d0..24555633 100644 --- a/packages/neutron-sdk/src/interchain_queries/v045/types.rs +++ b/packages/neutron-sdk/src/interchain_queries/v045/types.rs @@ -10,7 +10,7 @@ use cosmos_sdk_proto::cosmos::{ staking::v1beta1::{Delegation, Validator as CosmosValidator}, }; use cosmos_sdk_proto::traits::Message; -use cosmwasm_std::{from_binary, Addr, Coin, Decimal, StdError, Uint128}; +use cosmwasm_std::{from_json, Addr, Coin, Decimal, StdError, Uint128}; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use std::{ops::Div, str::FromStr}; @@ -87,7 +87,7 @@ impl KVReconstruct for Uint128 { let value = storage_values .first() .ok_or_else(|| StdError::generic_err("empty query result"))?; - let balance: Uint128 = from_binary(&value.value)?; + let balance: Uint128 = from_json(&value.value)?; Ok(balance) } } @@ -348,7 +348,7 @@ impl KVReconstruct for Delegations { "denom is empty".into(), )); } - let denom: String = from_binary(&storage_values[0].value)?; + let denom: String = from_json(&storage_values[0].value)?; // the rest are delegations and validators alternately for chunk in storage_values[1..].chunks(2) { diff --git a/packages/neutron-sdk/src/lib.rs b/packages/neutron-sdk/src/lib.rs index 6cdff2c2..c4a0d106 100644 --- a/packages/neutron-sdk/src/lib.rs +++ b/packages/neutron-sdk/src/lib.rs @@ -4,6 +4,7 @@ pub mod interchain_queries; pub mod interchain_txs; pub mod proto_types; pub mod query; +pub mod stargate; pub mod sudo; pub use errors::error::{NeutronError, NeutronResult}; diff --git a/packages/neutron-sdk/src/proto_types/NEUTRON_COMMIT b/packages/neutron-sdk/src/proto_types/NEUTRON_COMMIT new file mode 100644 index 00000000..9c2c8938 --- /dev/null +++ b/packages/neutron-sdk/src/proto_types/NEUTRON_COMMIT @@ -0,0 +1 @@ +60b7d38358efb2f8e45e25ee4db8e19a6462dd9e \ No newline at end of file diff --git a/packages/neutron-sdk/src/proto_types/mod.rs b/packages/neutron-sdk/src/proto_types/mod.rs index 8574d1c1..4b65755c 100644 --- a/packages/neutron-sdk/src/proto_types/mod.rs +++ b/packages/neutron-sdk/src/proto_types/mod.rs @@ -1,3 +1,45 @@ -// @generated +pub mod neutron { + pub mod dex { + include!("neutron.dex.rs"); + } -pub mod transfer; + pub mod interchaintxs { + pub mod v1 { + include!("neutron.interchaintxs.v1.rs"); + } + } + + pub mod feeburner { + include!("neutron.feeburner.rs"); + } + + pub mod interchainqueries { + include!("neutron.interchainqueries.rs"); + } + + pub mod cron { + include!("neutron.cron.rs"); + } + pub mod transfer { + include!("neutron.transfer.rs"); + } + + pub mod feerefunder { + include!("neutron.feerefunder.rs"); + } + + pub mod contractmanager { + include!("neutron.contractmanager.rs"); + pub mod v1 { + include!("neutron.contractmanager.v1.rs"); + } + } +} + +pub mod osmosis { + pub mod tokenfactory { + pub mod v1beta1 { + include!("osmosis.tokenfactory.v1beta1.rs"); + } + } +} diff --git a/packages/neutron-sdk/src/proto_types/neutron.contractmanager.rs b/packages/neutron-sdk/src/proto_types/neutron.contractmanager.rs new file mode 100644 index 00000000..6be30075 --- /dev/null +++ b/packages/neutron-sdk/src/proto_types/neutron.contractmanager.rs @@ -0,0 +1,90 @@ +// @generated +/// Failure message contains information about ACK failures and can be used to +/// replay ACK in case of requirement. +/// Note that Failure means that sudo handler to cosmwasm contract failed for +/// some reason +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Failure { + /// Address of the failed contract + #[prost(string, tag = "1")] + pub address: ::prost::alloc::string::String, + /// Id of the failure under specific address + #[prost(uint64, tag = "2")] + pub id: u64, + /// Serialized MessageSudoCallback with Packet and Ack(if exists) + #[prost(bytes = "vec", tag = "3")] + pub sudo_payload: ::prost::alloc::vec::Vec, + /// Redacted error response of the sudo call. Full error is emitted as an event + #[prost(string, tag = "4")] + pub error: ::prost::alloc::string::String, +} +/// Params defines the parameters for the module. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Params { + #[prost(uint64, tag = "1")] + pub sudo_call_gas_limit: u64, +} +/// GenesisState defines the contractmanager module's genesis state. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GenesisState { + #[prost(message, optional, tag = "1")] + pub params: ::core::option::Option, + /// List of the contract failures + /// + /// this line is used by starport scaffolding # genesis/proto/state + #[prost(message, repeated, tag = "2")] + pub failures_list: ::prost::alloc::vec::Vec, +} +/// QueryParamsRequest is request type for the Query/Params RPC method. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryParamsRequest {} +/// QueryParamsResponse is response type for the Query/Params RPC method. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryParamsResponse { + /// params holds all the parameters of this module. + #[prost(message, optional, tag = "1")] + pub params: ::core::option::Option, +} +/// QueryFailuresRequest is request type for the Query/Failures RPC method. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryFailuresRequest { + /// address of the contract which Sudo call failed. + #[prost(string, tag = "1")] + pub address: ::prost::alloc::string::String, + /// ID of the failure for the given contract. + #[prost(uint64, tag = "2")] + pub failure_id: u64, + #[prost(message, optional, tag = "3")] + pub pagination: + ::core::option::Option, +} +/// QueryFailuresResponse is response type for the Query/Failures RPC method. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryFailuresResponse { + #[prost(message, repeated, tag = "1")] + pub failures: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag = "2")] + pub pagination: + ::core::option::Option, +} +/// MsgUpdateParams is the MsgUpdateParams request type. +/// +/// Since: 0.47 +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateParams { + /// Authority is the address of the governance account. + #[prost(string, tag = "1")] + pub authority: ::prost::alloc::string::String, + /// params defines the x/contractmanager parameters to update. + /// + /// NOTE: All parameters must be supplied. + #[prost(message, optional, tag = "2")] + pub params: ::core::option::Option, +} +/// MsgUpdateParamsResponse defines the response structure for executing a +/// MsgUpdateParams message. +/// +/// Since: 0.47 +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateParamsResponse {} +// @@protoc_insertion_point(module) diff --git a/packages/neutron-sdk/src/proto_types/neutron.contractmanager.v1.rs b/packages/neutron-sdk/src/proto_types/neutron.contractmanager.v1.rs new file mode 100644 index 00000000..8c8d460a --- /dev/null +++ b/packages/neutron-sdk/src/proto_types/neutron.contractmanager.v1.rs @@ -0,0 +1,21 @@ +// @generated +/// Deprecated. Used only for migration purposes. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Failure { + /// ChannelId + #[prost(string, tag = "1")] + pub channel_id: ::prost::alloc::string::String, + /// Address of the failed contract + #[prost(string, tag = "2")] + pub address: ::prost::alloc::string::String, + /// id of the failure under specific address + #[prost(uint64, tag = "3")] + pub id: u64, + /// ACK id to restore + #[prost(uint64, tag = "4")] + pub ack_id: u64, + /// Acknowledgement type + #[prost(string, tag = "5")] + pub ack_type: ::prost::alloc::string::String, +} +// @@protoc_insertion_point(module) diff --git a/packages/neutron-sdk/src/proto_types/neutron.cron.rs b/packages/neutron-sdk/src/proto_types/neutron.cron.rs new file mode 100644 index 00000000..29816935 --- /dev/null +++ b/packages/neutron-sdk/src/proto_types/neutron.cron.rs @@ -0,0 +1,105 @@ +// @generated +/// Params defines the parameters for the module. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Params { + /// Security address that can remove schedules + #[prost(string, tag = "1")] + pub security_address: ::prost::alloc::string::String, + /// Limit of schedules executed in one block + #[prost(uint64, tag = "2")] + pub limit: u64, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Schedule { + /// Name of schedule + #[prost(string, tag = "1")] + pub name: ::prost::alloc::string::String, + /// Period in blocks + #[prost(uint64, tag = "2")] + pub period: u64, + /// Msgs that will be executed every period amount of time + #[prost(message, repeated, tag = "3")] + pub msgs: ::prost::alloc::vec::Vec, + /// Last execution's block height + #[prost(uint64, tag = "4")] + pub last_execute_height: u64, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgExecuteContract { + /// Contract is the address of the smart contract + #[prost(string, tag = "1")] + pub contract: ::prost::alloc::string::String, + /// Msg is json encoded message to be passed to the contract + #[prost(string, tag = "2")] + pub msg: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ScheduleCount { + /// Count is the number of current schedules + #[prost(int32, tag = "1")] + pub count: i32, +} +/// GenesisState defines the cron module's genesis state. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GenesisState { + #[prost(message, repeated, tag = "2")] + pub schedule_list: ::prost::alloc::vec::Vec, + /// this line is used by starport scaffolding # genesis/proto/state + #[prost(message, optional, tag = "1")] + pub params: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryParamsRequest {} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryParamsResponse { + /// params holds all the parameters of this module. + #[prost(message, optional, tag = "1")] + pub params: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryGetScheduleRequest { + #[prost(string, tag = "1")] + pub name: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryGetScheduleResponse { + #[prost(message, optional, tag = "1")] + pub schedule: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QuerySchedulesRequest { + #[prost(message, optional, tag = "1")] + pub pagination: + ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QuerySchedulesResponse { + #[prost(message, repeated, tag = "1")] + pub schedules: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag = "2")] + pub pagination: + ::core::option::Option, +} +// this line is used by starport scaffolding # proto/tx/message + +/// MsgUpdateParams is the MsgUpdateParams request type. +/// +/// Since: 0.47 +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateParams { + /// Authority is the address of the governance account. + #[prost(string, tag = "1")] + pub authority: ::prost::alloc::string::String, + /// params defines the x/cron parameters to update. + /// + /// NOTE: All parameters must be supplied. + #[prost(message, optional, tag = "2")] + pub params: ::core::option::Option, +} +/// MsgUpdateParamsResponse defines the response structure for executing a +/// MsgUpdateParams message. +/// +/// Since: 0.47 +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateParamsResponse {} +// @@protoc_insertion_point(module) diff --git a/packages/neutron-sdk/src/proto_types/neutron.dex.rs b/packages/neutron-sdk/src/proto_types/neutron.dex.rs new file mode 100644 index 00000000..09ddf6db --- /dev/null +++ b/packages/neutron-sdk/src/proto_types/neutron.dex.rs @@ -0,0 +1,633 @@ +// @generated +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PairId { + #[prost(string, tag = "1")] + pub token0: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub token1: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DepositRecord { + #[prost(message, optional, tag = "1")] + pub pair_id: ::core::option::Option, + #[prost(string, tag = "2")] + pub shares_owned: ::prost::alloc::string::String, + #[prost(int64, tag = "3")] + pub center_tick_index: i64, + #[prost(int64, tag = "4")] + pub lower_tick_index: i64, + #[prost(int64, tag = "5")] + pub upper_tick_index: i64, + #[prost(uint64, tag = "6")] + pub fee: u64, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TradePairId { + #[prost(string, tag = "2")] + pub maker_denom: ::prost::alloc::string::String, + #[prost(string, tag = "3")] + pub taker_denom: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct LimitOrderTrancheKey { + #[prost(message, optional, tag = "1")] + pub trade_pair_id: ::core::option::Option, + #[prost(int64, tag = "2")] + pub tick_index_taker_to_maker: i64, + #[prost(string, tag = "3")] + pub tranche_key: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct LimitOrderTranche { + #[prost(message, optional, tag = "1")] + pub key: ::core::option::Option, + #[prost(string, tag = "2")] + pub reserves_maker_denom: ::prost::alloc::string::String, + #[prost(string, tag = "3")] + pub reserves_taker_denom: ::prost::alloc::string::String, + #[prost(string, tag = "4")] + pub total_maker_denom: ::prost::alloc::string::String, + #[prost(string, tag = "5")] + pub total_taker_denom: ::prost::alloc::string::String, + /// expiration_time is represented as an RFC 3339 formatted date. + /// LimitOrders with expiration_time set are valid as long as blockTime <= expiration_time. + /// JIT orders also use expiration_time to handle deletion, but represent a special case. + /// All JIT orders have an expiration_time of 0001-01-01T00:00:00Z, and an exception is made to + /// still treat these orders as live. Order deletion still functions the + /// same, and the orders will be deleted at the end of the block. + #[prost(message, optional, tag = "6")] + pub expiration_time: ::core::option::Option<::prost_types::Timestamp>, + #[prost(string, tag = "7")] + pub price_taker_to_maker: ::prost::alloc::string::String, +} +/// Params defines the parameters for the module. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Params { + #[prost(uint64, repeated, tag = "1")] + pub fee_tiers: ::prost::alloc::vec::Vec, + #[prost(string, tag = "2")] + pub max_true_taker_spread: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DepositOptions { + #[prost(bool, tag = "1")] + pub disable_autoswap: bool, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgDeposit { + #[prost(string, tag = "1")] + pub creator: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub receiver: ::prost::alloc::string::String, + #[prost(string, tag = "3")] + pub token_a: ::prost::alloc::string::String, + #[prost(string, tag = "4")] + pub token_b: ::prost::alloc::string::String, + #[prost(string, repeated, tag = "5")] + pub amounts_a: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + #[prost(string, repeated, tag = "6")] + pub amounts_b: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + #[prost(int64, repeated, tag = "7")] + pub tick_indexes_a_to_b: ::prost::alloc::vec::Vec, + #[prost(uint64, repeated, tag = "8")] + pub fees: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag = "9")] + pub options: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgDepositResponse { + #[prost(string, repeated, tag = "1")] + pub reserve0_deposited: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + #[prost(string, repeated, tag = "2")] + pub reserve1_deposited: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgWithdrawal { + #[prost(string, tag = "1")] + pub creator: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub receiver: ::prost::alloc::string::String, + #[prost(string, tag = "3")] + pub token_a: ::prost::alloc::string::String, + #[prost(string, tag = "4")] + pub token_b: ::prost::alloc::string::String, + #[prost(string, repeated, tag = "5")] + pub shares_to_remove: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + #[prost(int64, repeated, tag = "6")] + pub tick_indexes_a_to_b: ::prost::alloc::vec::Vec, + #[prost(uint64, repeated, tag = "7")] + pub fees: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgWithdrawalResponse {} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgPlaceLimitOrder { + #[prost(string, tag = "1")] + pub creator: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub receiver: ::prost::alloc::string::String, + #[prost(string, tag = "3")] + pub token_in: ::prost::alloc::string::String, + #[prost(string, tag = "4")] + pub token_out: ::prost::alloc::string::String, + #[prost(int64, tag = "5")] + pub tick_index_in_to_out: i64, + #[prost(string, tag = "7")] + pub amount_in: ::prost::alloc::string::String, + #[prost(enumeration = "LimitOrderType", tag = "8")] + pub order_type: i32, + /// expirationTime is only valid iff orderType == GOOD_TIL_TIME. + #[prost(message, optional, tag = "9")] + pub expiration_time: ::core::option::Option<::prost_types::Timestamp>, + #[prost(string, tag = "10")] + pub max_amount_out: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgPlaceLimitOrderResponse { + #[prost(string, tag = "1")] + pub tranche_key: ::prost::alloc::string::String, + /// Total amount of coin used for the limit order + #[prost(message, optional, tag = "2")] + pub coin_in: ::core::option::Option, + /// 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 + #[prost(message, optional, tag = "3")] + pub taker_coin_out: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgWithdrawFilledLimitOrder { + #[prost(string, tag = "1")] + pub creator: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub tranche_key: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgWithdrawFilledLimitOrderResponse {} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgCancelLimitOrder { + #[prost(string, tag = "1")] + pub creator: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub tranche_key: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgCancelLimitOrderResponse {} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MultiHopRoute { + #[prost(string, repeated, tag = "1")] + pub hops: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgMultiHopSwap { + #[prost(string, tag = "1")] + pub creator: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub receiver: ::prost::alloc::string::String, + #[prost(message, repeated, tag = "3")] + pub routes: ::prost::alloc::vec::Vec, + #[prost(string, tag = "4")] + pub amount_in: ::prost::alloc::string::String, + #[prost(string, tag = "5")] + pub exit_limit_price: ::prost::alloc::string::String, + /// If pickBestRoute == true then all routes are run and the route with the + /// best price is chosen otherwise, the first succesful route is used. + #[prost(bool, tag = "6")] + pub pick_best_route: bool, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgMultiHopSwapResponse { + #[prost(message, optional, tag = "1")] + pub coin_out: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateParams { + /// Authority is the address of the governance account. + #[prost(string, tag = "1")] + pub authority: ::prost::alloc::string::String, + /// NOTE: All parameters must be supplied. + #[prost(message, optional, tag = "2")] + pub params: ::core::option::Option, +} +/// MsgUpdateParamsResponse defines the response structure for executing a +/// MsgUpdateParams message. +/// +/// Since: 0.47 +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateParamsResponse {} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum LimitOrderType { + GoodTilCancelled = 0, + FillOrKill = 1, + ImmediateOrCancel = 2, + JustInTime = 3, + GoodTilTime = 4, +} +impl LimitOrderType { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + LimitOrderType::GoodTilCancelled => "GOOD_TIL_CANCELLED", + LimitOrderType::FillOrKill => "FILL_OR_KILL", + LimitOrderType::ImmediateOrCancel => "IMMEDIATE_OR_CANCEL", + LimitOrderType::JustInTime => "JUST_IN_TIME", + LimitOrderType::GoodTilTime => "GOOD_TIL_TIME", + } + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct LimitOrderTrancheUser { + #[prost(message, optional, tag = "1")] + pub trade_pair_id: ::core::option::Option, + #[prost(int64, tag = "2")] + pub tick_index_taker_to_maker: i64, + #[prost(string, tag = "3")] + pub tranche_key: ::prost::alloc::string::String, + #[prost(string, tag = "4")] + pub address: ::prost::alloc::string::String, + #[prost(string, tag = "5")] + pub shares_owned: ::prost::alloc::string::String, + #[prost(string, tag = "6")] + pub shares_withdrawn: ::prost::alloc::string::String, + #[prost(string, tag = "7")] + pub shares_cancelled: ::prost::alloc::string::String, + #[prost(enumeration = "LimitOrderType", tag = "8")] + pub order_type: i32, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PoolMetadata { + #[prost(uint64, tag = "1")] + pub id: u64, + #[prost(int64, tag = "2")] + pub tick: i64, + #[prost(uint64, tag = "3")] + pub fee: u64, + #[prost(message, optional, tag = "4")] + pub pair_id: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PoolReservesKey { + #[prost(message, optional, tag = "1")] + pub trade_pair_id: ::core::option::Option, + #[prost(int64, tag = "2")] + pub tick_index_taker_to_maker: i64, + #[prost(uint64, tag = "3")] + pub fee: u64, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PoolReserves { + #[prost(message, optional, tag = "1")] + pub key: ::core::option::Option, + #[prost(string, tag = "2")] + pub reserves_maker_denom: ::prost::alloc::string::String, + #[prost(string, tag = "3")] + pub price_taker_to_maker: ::prost::alloc::string::String, + #[prost(string, tag = "4")] + pub price_opposite_taker_to_maker: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TickLiquidity { + #[prost(oneof = "tick_liquidity::Liquidity", tags = "1, 2")] + pub liquidity: ::core::option::Option, +} +/// Nested message and enum types in `TickLiquidity`. +pub mod tick_liquidity { + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Liquidity { + #[prost(message, tag = "1")] + PoolReserves(super::PoolReserves), + #[prost(message, tag = "2")] + LimitOrderTranche(super::LimitOrderTranche), + } +} +/// GenesisState defines the dex module's genesis state. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GenesisState { + #[prost(message, optional, tag = "1")] + pub params: ::core::option::Option, + #[prost(message, repeated, tag = "2")] + pub tick_liquidity_list: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag = "3")] + pub inactive_limit_order_tranche_list: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag = "4")] + pub limit_order_tranche_user_list: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag = "5")] + pub pool_metadata_list: ::prost::alloc::vec::Vec, + /// this line is used by starport scaffolding # genesis/proto/state + #[prost(uint64, tag = "6")] + pub pool_count: u64, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct LimitOrderExpiration { + /// see limitOrderTranche.proto for details on goodTilDate + #[prost(message, optional, tag = "1")] + pub expiration_time: ::core::option::Option<::prost_types::Timestamp>, + #[prost(bytes = "vec", tag = "2")] + pub tranche_ref: ::prost::alloc::vec::Vec, +} +// NOTE: This struct is never actually stored in the KV store. It is merely a +// convenience wrapper for holding both sides of a pool. + +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Pool { + #[prost(uint64, tag = "1")] + pub id: u64, + #[prost(message, optional, tag = "2")] + pub lower_tick0: ::core::option::Option, + #[prost(message, optional, tag = "3")] + pub upper_tick1: ::core::option::Option, +} +/// QueryParamsRequest is request type for the Query/Params RPC method. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryParamsRequest {} +/// QueryParamsResponse is response type for the Query/Params RPC method. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryParamsResponse { + /// params holds all the parameters of this module. + #[prost(message, optional, tag = "1")] + pub params: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryGetLimitOrderTrancheUserRequest { + #[prost(string, tag = "1")] + pub address: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub tranche_key: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryGetLimitOrderTrancheUserResponse { + #[prost(message, optional, tag = "1")] + pub limit_order_tranche_user: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryAllLimitOrderTrancheUserRequest { + #[prost(message, optional, tag = "1")] + pub pagination: + ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryAllLimitOrderTrancheUserResponse { + #[prost(message, repeated, tag = "1")] + pub limit_order_tranche_user: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag = "2")] + pub pagination: + ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryGetLimitOrderTrancheRequest { + #[prost(string, tag = "1")] + pub pair_id: ::prost::alloc::string::String, + #[prost(int64, tag = "2")] + pub tick_index: i64, + #[prost(string, tag = "3")] + pub token_in: ::prost::alloc::string::String, + #[prost(string, tag = "4")] + pub tranche_key: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryGetLimitOrderTrancheResponse { + #[prost(message, optional, tag = "1")] + pub limit_order_tranche: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryAllLimitOrderTrancheRequest { + #[prost(string, tag = "1")] + pub pair_id: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub token_in: ::prost::alloc::string::String, + #[prost(message, optional, tag = "3")] + pub pagination: + ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryAllLimitOrderTrancheResponse { + #[prost(message, repeated, tag = "1")] + pub limit_order_tranche: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag = "2")] + pub pagination: + ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryAllUserDepositsRequest { + #[prost(string, tag = "1")] + pub address: ::prost::alloc::string::String, + #[prost(message, optional, tag = "2")] + pub pagination: + ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryAllUserDepositsResponse { + #[prost(message, repeated, tag = "1")] + pub deposits: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag = "2")] + pub pagination: + ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryAllUserLimitOrdersRequest { + #[prost(string, tag = "1")] + pub address: ::prost::alloc::string::String, + #[prost(message, optional, tag = "2")] + pub pagination: + ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryAllUserLimitOrdersResponse { + #[prost(message, repeated, tag = "1")] + pub limit_orders: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag = "2")] + pub pagination: + ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryAllTickLiquidityRequest { + #[prost(string, tag = "1")] + pub pair_id: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub token_in: ::prost::alloc::string::String, + #[prost(message, optional, tag = "3")] + pub pagination: + ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryAllTickLiquidityResponse { + #[prost(message, repeated, tag = "1")] + pub tick_liquidity: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag = "2")] + pub pagination: + ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryGetInactiveLimitOrderTrancheRequest { + #[prost(string, tag = "1")] + pub pair_id: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub token_in: ::prost::alloc::string::String, + #[prost(int64, tag = "3")] + pub tick_index: i64, + #[prost(string, tag = "4")] + pub tranche_key: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryGetInactiveLimitOrderTrancheResponse { + #[prost(message, optional, tag = "1")] + pub inactive_limit_order_tranche: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryAllInactiveLimitOrderTrancheRequest { + #[prost(message, optional, tag = "1")] + pub pagination: + ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryAllInactiveLimitOrderTrancheResponse { + #[prost(message, repeated, tag = "1")] + pub inactive_limit_order_tranche: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag = "2")] + pub pagination: + ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryAllPoolReservesRequest { + #[prost(string, tag = "1")] + pub pair_id: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub token_in: ::prost::alloc::string::String, + #[prost(message, optional, tag = "3")] + pub pagination: + ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryAllPoolReservesResponse { + #[prost(message, repeated, tag = "1")] + pub pool_reserves: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag = "2")] + pub pagination: + ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryGetPoolReservesRequest { + #[prost(string, tag = "1")] + pub pair_id: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub token_in: ::prost::alloc::string::String, + #[prost(int64, tag = "3")] + pub tick_index: i64, + #[prost(uint64, tag = "4")] + pub fee: u64, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryGetPoolReservesResponse { + #[prost(message, optional, tag = "1")] + pub pool_reserves: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryEstimateMultiHopSwapRequest { + #[prost(string, tag = "1")] + pub creator: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub receiver: ::prost::alloc::string::String, + #[prost(message, repeated, tag = "3")] + pub routes: ::prost::alloc::vec::Vec, + #[prost(string, tag = "4")] + pub amount_in: ::prost::alloc::string::String, + #[prost(string, tag = "5")] + pub exit_limit_price: ::prost::alloc::string::String, + /// If pickBestRoute == true then all routes are run and the route with the + /// best price is chosen otherwise, the first succesful route is used. + #[prost(bool, tag = "6")] + pub pick_best_route: bool, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryEstimateMultiHopSwapResponse { + #[prost(message, optional, tag = "1")] + pub coin_out: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryEstimatePlaceLimitOrderRequest { + #[prost(string, tag = "1")] + pub creator: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub receiver: ::prost::alloc::string::String, + #[prost(string, tag = "3")] + pub token_in: ::prost::alloc::string::String, + #[prost(string, tag = "4")] + pub token_out: ::prost::alloc::string::String, + #[prost(int64, tag = "5")] + pub tick_index_in_to_out: i64, + #[prost(string, tag = "6")] + pub amount_in: ::prost::alloc::string::String, + #[prost(enumeration = "LimitOrderType", tag = "7")] + pub order_type: i32, + /// expirationTime is only valid iff orderType == GOOD_TIL_TIME. + #[prost(message, optional, tag = "8")] + pub expiration_time: ::core::option::Option<::prost_types::Timestamp>, + #[prost(string, tag = "9")] + pub max_amount_out: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryEstimatePlaceLimitOrderResponse { + /// Total amount of coin used for the limit order + /// You can derive makerLimitInCoin using the equation: totalInCoin = + /// swapInCoin + makerLimitInCoin + #[prost(message, optional, tag = "1")] + pub total_in_coin: ::core::option::Option, + /// Total amount of the token in that was immediately swapped for swapOutCoin + #[prost(message, optional, tag = "2")] + pub swap_in_coin: ::core::option::Option, + /// 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 + #[prost(message, optional, tag = "3")] + pub swap_out_coin: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryPoolRequest { + #[prost(string, tag = "1")] + pub pair_id: ::prost::alloc::string::String, + #[prost(int64, tag = "2")] + pub tick_index: i64, + #[prost(uint64, tag = "3")] + pub fee: u64, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryPoolByIdRequest { + #[prost(uint64, tag = "1")] + pub pool_id: u64, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryPoolResponse { + #[prost(message, optional, tag = "1")] + pub pool: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryGetPoolMetadataRequest { + #[prost(uint64, tag = "1")] + pub id: u64, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryGetPoolMetadataResponse { + #[prost(message, optional, tag = "1")] + pub pool_metadata: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryAllPoolMetadataRequest { + #[prost(message, optional, tag = "1")] + pub pagination: + ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryAllPoolMetadataResponse { + #[prost(message, repeated, tag = "1")] + pub pool_metadata: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag = "2")] + pub pagination: + ::core::option::Option, +} +// @@protoc_insertion_point(module) diff --git a/packages/neutron-sdk/src/proto_types/neutron.feeburner.rs b/packages/neutron-sdk/src/proto_types/neutron.feeburner.rs new file mode 100644 index 00000000..b1581e35 --- /dev/null +++ b/packages/neutron-sdk/src/proto_types/neutron.feeburner.rs @@ -0,0 +1,72 @@ +// @generated +/// Params defines the parameters for the module. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Params { + /// Defines Neutron denom, which will be burned during fee processing, any + /// other denom will be sent to Treasury + #[prost(string, tag = "1")] + pub neutron_denom: ::prost::alloc::string::String, + /// Deprecated in v0.4.4. Is not used anymore + #[prost(string, tag = "2")] + pub reserve_address: ::prost::alloc::string::String, + /// Defines treasury address + #[prost(string, tag = "3")] + pub treasury_address: ::prost::alloc::string::String, +} +/// TotalBurnedNeutronsAmount defines total amount of burned neutron fees +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TotalBurnedNeutronsAmount { + #[prost(message, optional, tag = "1")] + pub coin: ::core::option::Option, +} +/// GenesisState defines the feeburner module's genesis state. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GenesisState { + #[prost(message, optional, tag = "1")] + pub params: ::core::option::Option, + /// this line is used by starport scaffolding # genesis/proto/state + #[prost(message, optional, tag = "2")] + pub total_burned_neutrons_amount: ::core::option::Option, +} +/// QueryParamsRequest is request type for the Query/Params RPC method. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryParamsRequest {} +/// QueryParamsResponse is response type for the Query/Params RPC method. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryParamsResponse { + /// params holds all the parameters of this module. + #[prost(message, optional, tag = "1")] + pub params: ::core::option::Option, +} +/// QueryTotalBurnedNeutronsAmountRequest is request type for the +/// Query/QueryTotalBurnedNeutronsAmount method. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryTotalBurnedNeutronsAmountRequest {} +/// QueryTotalBurnedNeutronsAmountResponse is response type for the +/// Query/QueryTotalBurnedNeutronsAmount method. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryTotalBurnedNeutronsAmountResponse { + #[prost(message, optional, tag = "1")] + pub total_burned_neutrons_amount: ::core::option::Option, +} +/// MsgUpdateParams is the MsgUpdateParams request type. +/// +/// Since: 0.47 +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateParams { + /// Authority is the address of the governance account. + #[prost(string, tag = "1")] + pub authority: ::prost::alloc::string::String, + /// params defines the x/feeburner parameters to update. + /// + /// NOTE: All parameters must be supplied. + #[prost(message, optional, tag = "2")] + pub params: ::core::option::Option, +} +/// MsgUpdateParamsResponse defines the response structure for executing a +/// MsgUpdateParams message. +/// +/// Since: 0.47 +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateParamsResponse {} +// @@protoc_insertion_point(module) diff --git a/packages/neutron-sdk/src/proto_types/neutron.feerefunder.rs b/packages/neutron-sdk/src/proto_types/neutron.feerefunder.rs new file mode 100644 index 00000000..3e4b1ac8 --- /dev/null +++ b/packages/neutron-sdk/src/proto_types/neutron.feerefunder.rs @@ -0,0 +1,92 @@ +// @generated +/// Fee defines the ICS29 receive, acknowledgement and timeout fees +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Fee { + /// the packet receive fee + #[prost(message, repeated, tag = "1")] + pub recv_fee: ::prost::alloc::vec::Vec, + /// the packet acknowledgement fee + #[prost(message, repeated, tag = "2")] + pub ack_fee: ::prost::alloc::vec::Vec, + /// the packet timeout fee + #[prost(message, repeated, tag = "3")] + pub timeout_fee: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PacketId { + #[prost(string, tag = "1")] + pub channel_id: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub port_id: ::prost::alloc::string::String, + #[prost(uint64, tag = "3")] + pub sequence: u64, +} +/// Params defines the parameters for the module. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Params { + #[prost(message, optional, tag = "1")] + pub min_fee: ::core::option::Option, +} +/// GenesisState defines the fee module's genesis state. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GenesisState { + #[prost(message, optional, tag = "1")] + pub params: ::core::option::Option, + /// this line is used by starport scaffolding # genesis/proto/state + #[prost(message, repeated, tag = "2")] + pub fee_infos: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct FeeInfo { + #[prost(string, tag = "1")] + pub payer: ::prost::alloc::string::String, + #[prost(message, optional, tag = "2")] + pub packet_id: ::core::option::Option, + #[prost(message, optional, tag = "3")] + pub fee: ::core::option::Option, +} +/// QueryParamsRequest is request type for the Query/Params RPC method. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryParamsRequest {} +/// QueryParamsResponse is response type for the Query/Params RPC method. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryParamsResponse { + /// params holds all the parameters of this module. + #[prost(message, optional, tag = "1")] + pub params: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct FeeInfoRequest { + #[prost(string, tag = "1")] + pub channel_id: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub port_id: ::prost::alloc::string::String, + #[prost(uint64, tag = "3")] + pub sequence: u64, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct FeeInfoResponse { + #[prost(message, optional, tag = "1")] + pub fee_info: ::core::option::Option, +} +/// MsgUpdateParams is the MsgUpdateParams request type. +/// +/// Since: 0.47 +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateParams { + /// Authority is the address of the governance account. + #[prost(string, tag = "1")] + pub authority: ::prost::alloc::string::String, + /// params defines the x/feerefunder parameters to update. + /// + /// NOTE: All parameters must be supplied. + #[prost(message, optional, tag = "2")] + pub params: ::core::option::Option, +} +/// MsgUpdateParamsResponse defines the response structure for executing a +/// MsgUpdateParams message. +/// +/// Since: 0.47 +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateParamsResponse {} +// @@protoc_insertion_point(module) diff --git a/packages/neutron-sdk/src/proto_types/neutron.interchainqueries.rs b/packages/neutron-sdk/src/proto_types/neutron.interchainqueries.rs new file mode 100644 index 00000000..1d09fed9 --- /dev/null +++ b/packages/neutron-sdk/src/proto_types/neutron.interchainqueries.rs @@ -0,0 +1,290 @@ +// @generated +/// Params defines the parameters for the module. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Params { + /// Defines amount of blocks required before query becomes available for + /// removal by anybody + #[prost(uint64, tag = "1")] + pub query_submit_timeout: u64, + /// Amount of coins deposited for the query. + #[prost(message, repeated, tag = "2")] + pub query_deposit: ::prost::alloc::vec::Vec, + /// Amount of tx hashes to be removed during a single EndBlock. Can vary to + /// balance between network cleaning speed and EndBlock duration. A zero value + /// means no limit. + #[prost(uint64, tag = "3")] + pub tx_query_removal_limit: u64, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RegisteredQuery { + /// The unique id of the registered query. + #[prost(uint64, tag = "1")] + pub id: u64, + /// The address that registered the query. + #[prost(string, tag = "2")] + pub owner: ::prost::alloc::string::String, + /// The query type identifier: `kv` or `tx` now + #[prost(string, tag = "3")] + pub query_type: ::prost::alloc::string::String, + /// The KV-storage keys for which we want to get values from remote chain + #[prost(message, repeated, tag = "4")] + pub keys: ::prost::alloc::vec::Vec, + /// The filter for transaction search ICQ + #[prost(string, tag = "5")] + pub transactions_filter: ::prost::alloc::string::String, + /// The IBC connection ID for getting ConsensusState to verify proofs + #[prost(string, tag = "6")] + pub connection_id: ::prost::alloc::string::String, + /// Parameter that defines how often the query must be updated. + #[prost(uint64, tag = "7")] + pub update_period: u64, + /// The local chain last block height when the query result was updated. + #[prost(uint64, tag = "8")] + pub last_submitted_result_local_height: u64, + /// The remote chain last block height when the query result was updated. + #[prost(message, optional, tag = "9")] + pub last_submitted_result_remote_height: + ::core::option::Option, + /// Amount of coins deposited for the query. + #[prost(message, repeated, tag = "10")] + pub deposit: ::prost::alloc::vec::Vec, + /// Timeout before query becomes available for everybody to remove. + #[prost(uint64, tag = "11")] + pub submit_timeout: u64, + /// The local chain height when the query was registered. + #[prost(uint64, tag = "12")] + pub registered_at_height: u64, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct KvKey { + /// Path (storage prefix) to the storage where you want to read value by key + /// (usually name of cosmos-sdk module: 'staking', 'bank', etc.) + #[prost(string, tag = "1")] + pub path: ::prost::alloc::string::String, + /// Key you want to read from the storage + #[prost(bytes = "vec", tag = "2")] + pub key: ::prost::alloc::vec::Vec, +} +/// GenesisState defines the interchainqueries module's genesis state. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GenesisState { + #[prost(message, optional, tag = "1")] + pub params: ::core::option::Option, + #[prost(message, repeated, tag = "2")] + pub registered_queries: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgRegisterInterchainQuery { + /// defines a query type: `kv` or `tx` now + #[prost(string, tag = "1")] + pub query_type: ::prost::alloc::string::String, + /// is used to define KV-storage keys for which we want to get values from + /// remote chain + #[prost(message, repeated, tag = "2")] + pub keys: ::prost::alloc::vec::Vec, + /// is used to define a filter for transaction search ICQ + #[prost(string, tag = "3")] + pub transactions_filter: ::prost::alloc::string::String, + /// is IBC connection ID for getting ConsensusState to verify proofs + #[prost(string, tag = "4")] + pub connection_id: ::prost::alloc::string::String, + /// is used to specify how often (in neutron blocks) the query must be updated + #[prost(uint64, tag = "5")] + pub update_period: u64, + /// is the signer of the message + #[prost(string, tag = "6")] + pub sender: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgRegisterInterchainQueryResponse { + #[prost(uint64, tag = "1")] + pub id: u64, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgSubmitQueryResult { + #[prost(uint64, tag = "1")] + pub query_id: u64, + #[prost(string, tag = "2")] + pub sender: ::prost::alloc::string::String, + /// is the IBC client ID for an IBC connection between Neutron chain and target + /// chain (where the result was obtained from) + #[prost(string, tag = "3")] + pub client_id: ::prost::alloc::string::String, + #[prost(message, optional, tag = "4")] + pub result: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryResult { + #[prost(message, repeated, tag = "1")] + pub kv_results: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag = "2")] + pub block: ::core::option::Option, + #[prost(uint64, tag = "3")] + pub height: u64, + #[prost(uint64, tag = "4")] + pub revision: u64, + #[prost(bool, tag = "5")] + pub allow_kv_callbacks: bool, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StorageValue { + /// is the substore name (acc, staking, etc.) + #[prost(string, tag = "1")] + pub storage_prefix: ::prost::alloc::string::String, + /// is the key in IAVL store + #[prost(bytes = "vec", tag = "2")] + pub key: ::prost::alloc::vec::Vec, + /// is the value in IAVL store + #[prost(bytes = "vec", tag = "3")] + pub value: ::prost::alloc::vec::Vec, + /// is the Merkle Proof which proves existence of key-value pair in IAVL + /// storage + #[prost(message, optional, tag = "4")] + pub proof: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Block { + /// We need to know block X+1 to verify response of transaction for block X + /// since LastResultsHash is root hash of all results from the txs from the + /// previous block + #[prost(message, optional, tag = "1")] + pub next_block_header: ::core::option::Option<::prost_types::Any>, + /// We need to know block X to verify inclusion of transaction for block X + #[prost(message, optional, tag = "2")] + pub header: ::core::option::Option<::prost_types::Any>, + #[prost(message, optional, tag = "3")] + pub tx: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TxValue { + #[prost(message, optional, tag = "1")] + pub response: ::core::option::Option, + /// is the Merkle Proof which proves existence of response in block with height + /// next_block_header.Height + #[prost(message, optional, tag = "2")] + pub delivery_proof: ::core::option::Option, + /// is the Merkle Proof which proves existence of data in block with height + /// header.Height + #[prost(message, optional, tag = "3")] + pub inclusion_proof: ::core::option::Option, + /// is body of the transaction + #[prost(bytes = "vec", tag = "4")] + pub data: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgSubmitQueryResultResponse {} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgRemoveInterchainQueryRequest { + #[prost(uint64, tag = "1")] + pub query_id: u64, + /// is the signer of the message + #[prost(string, tag = "2")] + pub sender: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgRemoveInterchainQueryResponse {} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateInterchainQueryRequest { + #[prost(uint64, tag = "1")] + pub query_id: u64, + #[prost(message, repeated, tag = "2")] + pub new_keys: ::prost::alloc::vec::Vec, + #[prost(uint64, tag = "3")] + pub new_update_period: u64, + #[prost(string, tag = "4")] + pub new_transactions_filter: ::prost::alloc::string::String, + /// is the signer of the message + #[prost(string, tag = "5")] + pub sender: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateInterchainQueryResponse {} +/// MsgUpdateParams is the MsgUpdateParams request type. +/// +/// Since: 0.47 +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateParams { + /// Authority is the address of the governance account. + #[prost(string, tag = "1")] + pub authority: ::prost::alloc::string::String, + /// params defines the x/interchainqueries parameters to update. + /// + /// NOTE: All parameters must be supplied. + #[prost(message, optional, tag = "2")] + pub params: ::core::option::Option, +} +/// MsgUpdateParamsResponse defines the response structure for executing a +/// MsgUpdateParams message. +/// +/// Since: 0.47 +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateParamsResponse {} +/// QueryParamsRequest is request type for the Query/Params RPC method. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryParamsRequest {} +/// QueryParamsResponse is response type for the Query/Params RPC method. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryParamsResponse { + /// params holds all the parameters of this module. + #[prost(message, optional, tag = "1")] + pub params: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryRegisteredQueriesRequest { + #[prost(string, repeated, tag = "1")] + pub owners: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + #[prost(string, tag = "2")] + pub connection_id: ::prost::alloc::string::String, + #[prost(message, optional, tag = "3")] + pub pagination: + ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryRegisteredQueriesResponse { + #[prost(message, repeated, tag = "1")] + pub registered_queries: ::prost::alloc::vec::Vec, + /// pagination defines the pagination in the response. + #[prost(message, optional, tag = "2")] + pub pagination: + ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryRegisteredQueryRequest { + #[prost(uint64, tag = "1")] + pub query_id: u64, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryRegisteredQueryResponse { + #[prost(message, optional, tag = "1")] + pub registered_query: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryRegisteredQueryResultRequest { + #[prost(uint64, tag = "1")] + pub query_id: u64, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryRegisteredQueryResultResponse { + #[prost(message, optional, tag = "1")] + pub result: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Transaction { + #[prost(uint64, tag = "1")] + pub id: u64, + #[prost(uint64, tag = "2")] + pub height: u64, + #[prost(bytes = "vec", tag = "3")] + pub data: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryLastRemoteHeight { + #[prost(string, tag = "1")] + pub connection_id: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryLastRemoteHeightResponse { + #[prost(uint64, tag = "1")] + pub height: u64, +} +// @@protoc_insertion_point(module) diff --git a/packages/neutron-sdk/src/proto_types/neutron.interchaintxs.v1.rs b/packages/neutron-sdk/src/proto_types/neutron.interchaintxs.v1.rs new file mode 100644 index 00000000..8bfefc25 --- /dev/null +++ b/packages/neutron-sdk/src/proto_types/neutron.interchaintxs.v1.rs @@ -0,0 +1,119 @@ +// @generated +/// Params defines the parameters for the module. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Params { + /// Defines maximum amount of messages to be passed in MsgSubmitTx + #[prost(uint64, tag = "1")] + pub msg_submit_tx_max_messages: u64, + /// Defines a minimum fee required to register interchain account + #[prost(message, repeated, tag = "2")] + pub register_fee: ::prost::alloc::vec::Vec, +} +/// GenesisState defines the interchaintxs module's genesis state. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GenesisState { + #[prost(message, optional, tag = "1")] + pub params: ::core::option::Option, +} +/// QueryParamsRequest is request type for the Query/Params RPC method. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryParamsRequest {} +/// QueryParamsResponse is response type for the Query/Params RPC method. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryParamsResponse { + /// params holds all the parameters of this module. + #[prost(message, optional, tag = "1")] + pub params: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryInterchainAccountAddressRequest { + /// owner_address is the owner of the interchain account on the controller + /// chain + #[prost(string, tag = "1")] + pub owner_address: ::prost::alloc::string::String, + /// interchain_account_id is an identifier of your interchain account from + /// which you want to execute msgs + #[prost(string, tag = "2")] + pub interchain_account_id: ::prost::alloc::string::String, + /// connection_id is an IBC connection identifier between Neutron and remote + /// chain + #[prost(string, tag = "3")] + pub connection_id: ::prost::alloc::string::String, +} +/// Query response for an interchain account address +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryInterchainAccountAddressResponse { + /// The corresponding interchain account address on the host chain + #[prost(string, tag = "1")] + pub interchain_account_address: ::prost::alloc::string::String, +} +/// MsgRegisterInterchainAccount is used to register an account on a remote zone. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgRegisterInterchainAccount { + #[prost(string, tag = "1")] + pub from_address: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub connection_id: ::prost::alloc::string::String, + #[prost(string, tag = "3")] + pub interchain_account_id: ::prost::alloc::string::String, + #[prost(message, repeated, tag = "4")] + pub register_fee: ::prost::alloc::vec::Vec, +} +/// MsgRegisterInterchainAccountResponse is the response type for +/// MsgRegisterInterchainAccount. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgRegisterInterchainAccountResponse {} +/// MsgSubmitTx defines the payload for Msg/SubmitTx +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgSubmitTx { + #[prost(string, tag = "1")] + pub from_address: ::prost::alloc::string::String, + /// interchain_account_id is supposed to be the unique identifier, e.g., + /// lido/kava. This allows contracts to have more than one interchain accounts + /// on remote zone This identifier will be a part of the portID that we'll + /// claim our capability for. + #[prost(string, tag = "2")] + pub interchain_account_id: ::prost::alloc::string::String, + #[prost(string, tag = "3")] + pub connection_id: ::prost::alloc::string::String, + #[prost(message, repeated, tag = "4")] + pub msgs: ::prost::alloc::vec::Vec<::prost_types::Any>, + #[prost(string, tag = "5")] + pub memo: ::prost::alloc::string::String, + /// timeout in seconds after which the packet times out + #[prost(uint64, tag = "6")] + pub timeout: u64, + #[prost(message, optional, tag = "7")] + pub fee: ::core::option::Option, +} +/// MsgSubmitTxResponse defines the response for Msg/SubmitTx +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgSubmitTxResponse { + /// channel's sequence_id for outgoing ibc packet. Unique per a channel. + #[prost(uint64, tag = "1")] + pub sequence_id: u64, + /// channel src channel on neutron side transaction was submitted from + #[prost(string, tag = "2")] + pub channel: ::prost::alloc::string::String, +} +/// MsgUpdateParams is the MsgUpdateParams request type. +/// +/// Since: 0.47 +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateParams { + /// Authority is the address of the governance account. + #[prost(string, tag = "1")] + pub authority: ::prost::alloc::string::String, + /// params defines the x/interchaintxs parameters to update. + /// + /// NOTE: All parameters must be supplied. + #[prost(message, optional, tag = "2")] + pub params: ::core::option::Option, +} +/// MsgUpdateParamsResponse defines the response structure for executing a +/// MsgUpdateParams message. +/// +/// Since: 0.47 +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateParamsResponse {} +// @@protoc_insertion_point(module) diff --git a/packages/neutron-sdk/src/proto_types/neutron.transfer.rs b/packages/neutron-sdk/src/proto_types/neutron.transfer.rs new file mode 100644 index 00000000..c01c5ab4 --- /dev/null +++ b/packages/neutron-sdk/src/proto_types/neutron.transfer.rs @@ -0,0 +1,43 @@ +// @generated +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgTransfer { + /// the port on which the packet will be sent + #[prost(string, tag = "1")] + pub source_port: ::prost::alloc::string::String, + /// the channel by which the packet will be sent + #[prost(string, tag = "2")] + pub source_channel: ::prost::alloc::string::String, + /// the tokens to be transferred + #[prost(message, optional, tag = "3")] + pub token: ::core::option::Option, + /// the sender address + #[prost(string, tag = "4")] + pub sender: ::prost::alloc::string::String, + /// the recipient address on the destination chain + #[prost(string, tag = "5")] + pub receiver: ::prost::alloc::string::String, + /// Timeout height relative to the current block height. + /// The timeout is disabled when set to 0. + #[prost(message, optional, tag = "6")] + pub timeout_height: ::core::option::Option, + /// Timeout timestamp in absolute nanoseconds since unix epoch. + /// The timeout is disabled when set to 0. + #[prost(uint64, tag = "7")] + pub timeout_timestamp: u64, + #[prost(string, tag = "8")] + pub memo: ::prost::alloc::string::String, + #[prost(message, optional, tag = "9")] + pub fee: ::core::option::Option, +} +/// MsgTransferResponse is the modified response type for +/// ibc-go MsgTransfer. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgTransferResponse { + /// channel's sequence_id for outgoing ibc packet. Unique per a channel. + #[prost(uint64, tag = "1")] + pub sequence_id: u64, + /// channel src channel on neutron side trasaction was submitted from + #[prost(string, tag = "2")] + pub channel: ::prost::alloc::string::String, +} +// @@protoc_insertion_point(module) diff --git a/packages/neutron-sdk/src/proto_types/osmosis.tokenfactory.v1beta1.rs b/packages/neutron-sdk/src/proto_types/osmosis.tokenfactory.v1beta1.rs new file mode 100644 index 00000000..a56fbd9b --- /dev/null +++ b/packages/neutron-sdk/src/proto_types/osmosis.tokenfactory.v1beta1.rs @@ -0,0 +1,229 @@ +// @generated +/// DenomAuthorityMetadata specifies metadata for addresses that have specific +/// capabilities over a token factory denom. Right now there is only one Admin +/// permission, but is planned to be extended to the future. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DenomAuthorityMetadata { + /// Can be empty for no admin, or a valid osmosis address + #[prost(string, tag = "1")] + pub admin: ::prost::alloc::string::String, +} +/// Params defines the parameters for the tokenfactory module. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Params { + /// DenomCreationFee defines the fee to be charged on the creation of a new + /// denom. The fee is drawn from the MsgCreateDenom's sender account, and + /// transferred to the community pool. + #[prost(message, repeated, tag = "1")] + pub denom_creation_fee: ::prost::alloc::vec::Vec, + /// DenomCreationGasConsume defines the gas cost for creating a new denom. + /// This is intended as a spam deterrence mechanism. + /// + /// See: + #[prost(uint64, tag = "2")] + pub denom_creation_gas_consume: u64, + /// FeeCollectorAddress is the address where fees collected from denom creation + /// are sent to + #[prost(string, tag = "3")] + pub fee_collector_address: ::prost::alloc::string::String, +} +/// GenesisState defines the tokenfactory module's genesis state. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GenesisState { + /// params defines the paramaters of the module. + #[prost(message, optional, tag = "1")] + pub params: ::core::option::Option, + #[prost(message, repeated, tag = "2")] + pub factory_denoms: ::prost::alloc::vec::Vec, +} +/// GenesisDenom defines a tokenfactory denom that is defined within genesis +/// state. The structure contains DenomAuthorityMetadata which defines the +/// denom's admin. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GenesisDenom { + #[prost(string, tag = "1")] + pub denom: ::prost::alloc::string::String, + #[prost(message, optional, tag = "2")] + pub authority_metadata: ::core::option::Option, +} +/// QueryParamsRequest is the request type for the Query/Params RPC method. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryParamsRequest {} +/// QueryParamsResponse is the response type for the Query/Params RPC method. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryParamsResponse { + /// params defines the parameters of the module. + #[prost(message, optional, tag = "1")] + pub params: ::core::option::Option, +} +/// QueryDenomAuthorityMetadataRequest defines the request structure for the +/// DenomAuthorityMetadata gRPC query. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryDenomAuthorityMetadataRequest { + #[prost(string, tag = "1")] + pub creator: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub subdenom: ::prost::alloc::string::String, +} +/// QueryDenomAuthorityMetadataResponse defines the response structure for the +/// DenomAuthorityMetadata gRPC query. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryDenomAuthorityMetadataResponse { + #[prost(message, optional, tag = "1")] + pub authority_metadata: ::core::option::Option, +} +/// QueryDenomsFromCreatorRequest defines the request structure for the +/// DenomsFromCreator gRPC query. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryDenomsFromCreatorRequest { + #[prost(string, tag = "1")] + pub creator: ::prost::alloc::string::String, +} +/// QueryDenomsFromCreatorRequest defines the response structure for the +/// DenomsFromCreator gRPC query. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryDenomsFromCreatorResponse { + #[prost(string, repeated, tag = "1")] + pub denoms: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryBeforeSendHookAddressRequest { + #[prost(string, tag = "1")] + pub creator: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub subdenom: ::prost::alloc::string::String, +} +/// QueryBeforeSendHookAddressResponse defines the response structure for the +/// DenomBeforeSendHook gRPC query. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryBeforeSendHookAddressResponse { + #[prost(string, tag = "1")] + pub contract_addr: ::prost::alloc::string::String, +} +/// MsgCreateDenom defines the message structure for the CreateDenom gRPC service +/// method. It allows an account to create a new denom. It requires a sender +/// address and a sub denomination. The (sender_address, sub_denomination) tuple +/// must be unique and cannot be re-used. +/// +/// The resulting denom created is defined as +/// . The resulting denom's admin is +/// originally set to be the creator, but this can be changed later. The token +/// denom does not indicate the current admin. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgCreateDenom { + #[prost(string, tag = "1")] + pub sender: ::prost::alloc::string::String, + /// subdenom can be up to 44 "alphanumeric" characters long. + #[prost(string, tag = "2")] + pub subdenom: ::prost::alloc::string::String, +} +/// MsgCreateDenomResponse is the return value of MsgCreateDenom +/// It returns the full string of the newly created denom +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgCreateDenomResponse { + #[prost(string, tag = "1")] + pub new_token_denom: ::prost::alloc::string::String, +} +/// MsgMint is the sdk.Msg type for allowing an admin account to mint +/// more of a token. For now, we only support minting to the sender account +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgMint { + #[prost(string, tag = "1")] + pub sender: ::prost::alloc::string::String, + #[prost(message, optional, tag = "2")] + pub amount: ::core::option::Option, + #[prost(string, tag = "3")] + pub mint_to_address: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgMintResponse {} +/// MsgBurn is the sdk.Msg type for allowing an admin account to burn +/// a token. For now, we only support burning from the sender account. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgBurn { + #[prost(string, tag = "1")] + pub sender: ::prost::alloc::string::String, + #[prost(message, optional, tag = "2")] + pub amount: ::core::option::Option, + #[prost(string, tag = "3")] + pub burn_from_address: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgBurnResponse {} +/// MsgChangeAdmin is the sdk.Msg type for allowing an admin account to reassign +/// adminship of a denom to a new account +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgChangeAdmin { + #[prost(string, tag = "1")] + pub sender: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub denom: ::prost::alloc::string::String, + #[prost(string, tag = "3")] + pub new_admin: ::prost::alloc::string::String, +} +/// MsgChangeAdminResponse defines the response structure for an executed +/// MsgChangeAdmin message. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgChangeAdminResponse {} +/// MsgSetBeforeSendHook is the sdk.Msg type for allowing an admin account to +/// assign a CosmWasm contract to call with a BeforeSend hook +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgSetBeforeSendHook { + #[prost(string, tag = "1")] + pub sender: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub denom: ::prost::alloc::string::String, + #[prost(string, tag = "3")] + pub contract_addr: ::prost::alloc::string::String, +} +/// MsgSetBeforeSendHookResponse defines the response structure for an executed +/// MsgSetBeforeSendHook message. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgSetBeforeSendHookResponse {} +/// MsgSetDenomMetadata is the sdk.Msg type for allowing an admin account to set +/// the denom's bank metadata +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgSetDenomMetadata { + #[prost(string, tag = "1")] + pub sender: ::prost::alloc::string::String, + #[prost(message, optional, tag = "2")] + pub metadata: ::core::option::Option, +} +/// MsgSetDenomMetadataResponse defines the response structure for an executed +/// MsgSetDenomMetadata message. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgSetDenomMetadataResponse {} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgForceTransfer { + #[prost(string, tag = "1")] + pub sender: ::prost::alloc::string::String, + #[prost(message, optional, tag = "2")] + pub amount: ::core::option::Option, + #[prost(string, tag = "3")] + pub transfer_from_address: ::prost::alloc::string::String, + #[prost(string, tag = "4")] + pub transfer_to_address: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgForceTransferResponse {} +/// MsgUpdateParams is the MsgUpdateParams request type. +/// +/// Since: 0.47 +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateParams { + /// Authority is the address of the governance account. + #[prost(string, tag = "1")] + pub authority: ::prost::alloc::string::String, + /// params defines the x/tokenfactory parameters to update. + /// + /// NOTE: All parameters must be supplied. + #[prost(message, optional, tag = "2")] + pub params: ::core::option::Option, +} +/// MsgUpdateParamsResponse defines the response structure for executing a +/// MsgUpdateParams message. +/// +/// Since: 0.47 +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateParamsResponse {} +// @@protoc_insertion_point(module) diff --git a/packages/neutron-sdk/src/proto_types/transfer.rs b/packages/neutron-sdk/src/proto_types/transfer.rs deleted file mode 100644 index 4743fc09..00000000 --- a/packages/neutron-sdk/src/proto_types/transfer.rs +++ /dev/null @@ -1,217 +0,0 @@ -// This file is generated by rust-protobuf 3.3.0. Do not edit -// .proto file is parsed by protoc --rust-out=... -// @generated - -// https://github.com/rust-lang/rust-clippy/issues/702 -#![allow(unknown_lints)] -#![allow(clippy::all)] - -#![allow(unused_attributes)] -#![cfg_attr(rustfmt, rustfmt::skip)] - -#![allow(box_pointers)] -#![allow(dead_code)] -#![allow(missing_docs)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] -#![allow(non_upper_case_globals)] -#![allow(trivial_casts)] -#![allow(unused_results)] -#![allow(unused_mut)] - -//! Generated file from `transfer/v1/transfer.proto` - -/// Generated files are compatible only with the same version -/// of protobuf runtime. -const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_3_0; - -/// MsgTransferResponse is the modified response type for -/// ibc-go MsgTransfer. -// @@protoc_insertion_point(message:neutron.transfer.MsgTransferResponse) -#[derive(PartialEq,Clone,Default,Debug)] -pub struct MsgTransferResponse { - // message fields - /// channel's sequence_id for outgoing ibc packet. Unique per a channel. - // @@protoc_insertion_point(field:neutron.transfer.MsgTransferResponse.sequence_id) - pub sequence_id: u64, - /// channel src channel on neutron side trasaction was submitted from - // @@protoc_insertion_point(field:neutron.transfer.MsgTransferResponse.channel) - pub channel: ::std::string::String, - // special fields - // @@protoc_insertion_point(special_field:neutron.transfer.MsgTransferResponse.special_fields) - pub special_fields: ::protobuf::SpecialFields, -} - -impl<'a> ::std::default::Default for &'a MsgTransferResponse { - fn default() -> &'a MsgTransferResponse { - ::default_instance() - } -} - -impl MsgTransferResponse { - pub fn new() -> MsgTransferResponse { - ::std::default::Default::default() - } - - fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { - let mut fields = ::std::vec::Vec::with_capacity(2); - let mut oneofs = ::std::vec::Vec::with_capacity(0); - fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( - "sequence_id", - |m: &MsgTransferResponse| { &m.sequence_id }, - |m: &mut MsgTransferResponse| { &mut m.sequence_id }, - )); - fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( - "channel", - |m: &MsgTransferResponse| { &m.channel }, - |m: &mut MsgTransferResponse| { &mut m.channel }, - )); - ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( - "MsgTransferResponse", - fields, - oneofs, - ) - } -} - -impl ::protobuf::Message for MsgTransferResponse { - const NAME: &'static str = "MsgTransferResponse"; - - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { - while let Some(tag) = is.read_raw_tag_or_eof()? { - match tag { - 8 => { - self.sequence_id = is.read_uint64()?; - }, - 18 => { - self.channel = is.read_string()?; - }, - tag => { - ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u64 { - let mut my_size = 0; - if self.sequence_id != 0 { - my_size += ::protobuf::rt::uint64_size(1, self.sequence_id); - } - if !self.channel.is_empty() { - my_size += ::protobuf::rt::string_size(2, &self.channel); - } - my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); - self.special_fields.cached_size().set(my_size as u32); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if self.sequence_id != 0 { - os.write_uint64(1, self.sequence_id)?; - } - if !self.channel.is_empty() { - os.write_string(2, &self.channel)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn special_fields(&self) -> &::protobuf::SpecialFields { - &self.special_fields - } - - fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { - &mut self.special_fields - } - - fn new() -> MsgTransferResponse { - MsgTransferResponse::new() - } - - fn clear(&mut self) { - self.sequence_id = 0; - self.channel.clear(); - self.special_fields.clear(); - } - - fn default_instance() -> &'static MsgTransferResponse { - static instance: MsgTransferResponse = MsgTransferResponse { - sequence_id: 0, - channel: ::std::string::String::new(), - special_fields: ::protobuf::SpecialFields::new(), - }; - &instance - } -} - -impl ::protobuf::MessageFull for MsgTransferResponse { - fn descriptor() -> ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); - descriptor.get(|| file_descriptor().message_by_package_relative_name("MsgTransferResponse").unwrap()).clone() - } -} - -impl ::std::fmt::Display for MsgTransferResponse { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MsgTransferResponse { - type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; -} - -static file_descriptor_proto_data: &'static [u8] = b"\ - \n\x1atransfer/v1/transfer.proto\x12\x10neutron.transfer\"P\n\x13MsgTran\ - sferResponse\x12\x1f\n\x0bsequence_id\x18\x01\x20\x01(\x04R\nsequenceId\ - \x12\x18\n\x07channel\x18\x02\x20\x01(\tR\x07channelJ\xfd\x02\n\x06\x12\ - \x04\0\0\x0b\x01\n\x08\n\x01\x0c\x12\x03\0\0\x12\n\x08\n\x01\x02\x12\x03\ - \x02\0\x19\nX\n\x02\x04\0\x12\x04\x06\0\x0b\x01\x1aL\x20MsgTransferRespo\ - nse\x20is\x20the\x20modified\x20response\x20type\x20for\n\x20ibc-go\x20M\ - sgTransfer.\n\n\n\n\x03\x04\0\x01\x12\x03\x06\x08\x1b\nS\n\x04\x04\0\x02\ - \0\x12\x03\x08\x02\x19\x1aF\x20channel's\x20sequence_id\x20for\x20outgoi\ - ng\x20ibc\x20packet.\x20Unique\x20per\x20a\x20channel.\n\n\x0c\n\x05\x04\ - \0\x02\0\x05\x12\x03\x08\x02\x08\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\x08\ - \t\x14\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03\x08\x17\x18\nP\n\x04\x04\0\ - \x02\x01\x12\x03\n\x02\x15\x1aC\x20channel\x20src\x20channel\x20on\x20ne\ - utron\x20side\x20trasaction\x20was\x20submitted\x20from\n\n\x0c\n\x05\ - \x04\0\x02\x01\x05\x12\x03\n\x02\x08\n\x0c\n\x05\x04\0\x02\x01\x01\x12\ - \x03\n\t\x10\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03\n\x13\x14b\x06proto3\ -"; - -/// `FileDescriptorProto` object which was a source for this generated file -fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { - static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new(); - file_descriptor_proto_lazy.get(|| { - ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() - }) -} - -/// `FileDescriptor` object which allows dynamic access to files -pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { - static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new(); - static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new(); - file_descriptor.get(|| { - let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { - let mut deps = ::std::vec::Vec::with_capacity(0); - let mut messages = ::std::vec::Vec::with_capacity(1); - messages.push(MsgTransferResponse::generated_message_descriptor_data()); - let mut enums = ::std::vec::Vec::with_capacity(0); - ::protobuf::reflect::GeneratedFileDescriptor::new_generated( - file_descriptor_proto(), - deps, - messages, - enums, - ) - }); - ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) - }) -} diff --git a/packages/neutron-sdk/src/query/token_factory.rs b/packages/neutron-sdk/src/query/token_factory.rs index 28590589..82060562 100644 --- a/packages/neutron-sdk/src/query/token_factory.rs +++ b/packages/neutron-sdk/src/query/token_factory.rs @@ -15,6 +15,12 @@ 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, @@ -36,3 +42,13 @@ pub fn query_denom_admin( }; 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/stargate/README.md b/packages/neutron-sdk/src/stargate/README.md new file mode 100644 index 00000000..62fdb856 --- /dev/null +++ b/packages/neutron-sdk/src/stargate/README.md @@ -0,0 +1,11 @@ +# Neutron Stargate interface + +This package contains list of helpers to interact with Neutron blockchain via Stargate. + +### Dex module + +For the `dex` module, there are helpers for all possible messages and queries in the package. The helpers have manually written adapted types for requests and responses instead of proto generated ones because proto-gen works poorly with rust code as the output. + +- helpers to construct CosmosMsgs to the dex module are placed in the [msg_dex.rs](https://github.com/neutron-org/neutron-sdk/tree/main/packages/neutron-sdk/src/stargate/dex/msg.rs) file; +- helpers to retrieve data from the dex module are placed in the [query_dex.rs](https://github.com/neutron-org/neutron-sdk/tree/main/packages/neutron-sdk/src/stargate/dex/query.rs) file; +- different types (e.g. request/response types) are placed in the [types_dex.rs](https://github.com/neutron-org/neutron-sdk/tree/main/packages/neutron-sdk/src/stargate/dex/types.rs) file. diff --git a/packages/neutron-sdk/src/stargate/aux.rs b/packages/neutron-sdk/src/stargate/aux.rs new file mode 100644 index 00000000..20a4bdf5 --- /dev/null +++ b/packages/neutron-sdk/src/stargate/aux.rs @@ -0,0 +1,43 @@ +use cosmwasm_std::{Binary, CosmosMsg, Deps, QueryRequest, StdResult}; +use prost_types::Timestamp as TimestampGen; +use serde::de::DeserializeOwned; + +/// makes a stargate query by a given path and req and returns a response deserialised into a +/// given response model. +/// +/// * **req** is a proto request model. Most likely it's a result of proto code generation; +/// * **path** is an RPC request path. Should be one of allowlisted stargate query paths; +/// +/// Since stargate query results are JSON-encoded instead of protobuf-encoded, the Res is +/// expected to have a serde::de::DeserializeOwned trait. Why JSON, not proto? See the link: +/// https://github.com/CosmWasm/wasmd/blob/6f6be7880f1caa666b86aaafea625208d70675dc/x/wasm/keeper/query_plugins.go#L360 +pub fn make_stargate_query(deps: Deps, path: &str, req: Req) -> StdResult +where + Req: prost::Message, + Res: DeserializeOwned, +{ + deps.querier.query(&QueryRequest::Stargate { + path: path.to_string(), + data: req.encode_to_vec().into(), + }) +} + +/// creates a CosmosMsg::Stargate with given request payload and path. +/// +/// * **req** is a proto request model. Most likely it's a result of proto code generation; +/// * **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 { + CosmosMsg::Stargate:: { + type_url: path.to_string(), + value: Binary::from(req.encode_to_vec()), + } +} + +/// creates a prost_types::Timestamp from a given unix timestamp value in seconds. +pub(crate) fn proto_timestamp_from_i64(timestamp: i64) -> TimestampGen { + TimestampGen { + seconds: timestamp, + nanos: 0, + } +} diff --git a/packages/neutron-sdk/src/stargate/dex/mod.rs b/packages/neutron-sdk/src/stargate/dex/mod.rs new file mode 100644 index 00000000..299b4f33 --- /dev/null +++ b/packages/neutron-sdk/src/stargate/dex/mod.rs @@ -0,0 +1,3 @@ +pub mod msg; +pub mod query; +pub mod types; diff --git a/packages/neutron-sdk/src/stargate/dex/msg.rs b/packages/neutron-sdk/src/stargate/dex/msg.rs new file mode 100644 index 00000000..bd321445 --- /dev/null +++ b/packages/neutron-sdk/src/stargate/dex/msg.rs @@ -0,0 +1,61 @@ +use crate::bindings::msg::NeutronMsg; +use crate::proto_types::neutron::dex::{ + MsgCancelLimitOrder, MsgDeposit, MsgMultiHopSwap, MsgPlaceLimitOrder, + MsgWithdrawFilledLimitOrder, MsgWithdrawal, +}; +use crate::stargate::aux::create_stargate_msg; +use crate::stargate::dex::types::{ + CancelLimitOrderRequest, DepositRequest, MultiHopSwapRequest, PlaceLimitOrderRequest, + WithdrawFilledLimitOrderRequest, WithdrawalRequest, +}; +use cosmwasm_std::CosmosMsg; + +const DEPOSIT_MSG_PATH: &str = "/neutron.dex.MsgDeposit"; +const WITHDRAWAL_MSG_PATH: &str = "/neutron.dex.MsgWithdrawal"; +const PLACE_LIMIT_ORDER_MSG_PATH: &str = "/neutron.dex.MsgPlaceLimitOrder"; +const WITHDRAW_FILLED_LIMIT_ORDER_MSG_PATH: &str = "/neutron.dex.MsgWithdrawFilledLimitOrder"; +const CANCEL_LIMIT_ORDER_MSG_PATH: &str = "/neutron.dex.MsgCancelLimitOrder"; +const MULTI_HOP_SWAP_MSG_PATH: &str = "/neutron.dex.MsgMultiHopSwap"; + +/// 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”. +pub fn msg_deposit(req: DepositRequest) -> CosmosMsg { + create_stargate_msg(DEPOSIT_MSG_PATH, MsgDeposit::from(req)) +} + +/// Redeems PoolShares for the user’s pro-rata portion of tokens within a liquidity pool. When +/// withdrawing from a pool they will receive token_a and token_b in the same ratio as what is +/// currently present in the pool. +pub fn msg_withdrawal(req: WithdrawalRequest) -> CosmosMsg { + create_stargate_msg(WITHDRAWAL_MSG_PATH, MsgWithdrawal::from(req)) +} + +/// Provides new liquidity to the dex that can be swapped through by other traders. +pub fn msg_place_limit_order(req: PlaceLimitOrderRequest) -> CosmosMsg { + create_stargate_msg(PLACE_LIMIT_ORDER_MSG_PATH, MsgPlaceLimitOrder::from(req)) +} + +/// Withdraws all available credits from an either partially or entirely fulfilled limit order. +pub fn msg_withdraw_filled_limit_order( + req: WithdrawFilledLimitOrderRequest, +) -> CosmosMsg { + create_stargate_msg( + WITHDRAW_FILLED_LIMIT_ORDER_MSG_PATH, + MsgWithdrawFilledLimitOrder::from(req), + ) +} + +/// Cancels a standard taker limit order (Good-til-cancelled | Good-til-time) if it has not been +/// completely filled. Once a limit order is canceled any remaining “TokenIn” liquidity is returned +/// to the user. +/// +/// NOTE: Cancelling a partially filled limit order does not withdraw the traded portion. A separate +/// call must be made to `WithdrawFilledLimitOrder` to withdraw any proceeds from the limit order. +pub fn msg_cancel_limit_order(req: CancelLimitOrderRequest) -> CosmosMsg { + create_stargate_msg(CANCEL_LIMIT_ORDER_MSG_PATH, MsgCancelLimitOrder::from(req)) +} + +/// Swaps by routing through a series of pools to achieve better prices. +pub fn msg_multi_hop_swap(req: MultiHopSwapRequest) -> CosmosMsg { + create_stargate_msg(MULTI_HOP_SWAP_MSG_PATH, MsgMultiHopSwap::from(req)) +} diff --git a/packages/neutron-sdk/src/stargate/dex/query.rs b/packages/neutron-sdk/src/stargate/dex/query.rs new file mode 100644 index 00000000..c0c30b08 --- /dev/null +++ b/packages/neutron-sdk/src/stargate/dex/query.rs @@ -0,0 +1,242 @@ +use crate::proto_types::neutron::dex::{ + QueryAllInactiveLimitOrderTrancheRequest, QueryAllLimitOrderTrancheRequest, + QueryAllLimitOrderTrancheUserRequest, QueryAllPoolMetadataRequest, QueryAllPoolReservesRequest, + QueryAllTickLiquidityRequest, QueryAllUserDepositsRequest, QueryAllUserLimitOrdersRequest, + QueryEstimateMultiHopSwapRequest, QueryEstimatePlaceLimitOrderRequest, + QueryGetInactiveLimitOrderTrancheRequest, QueryGetLimitOrderTrancheRequest, + QueryGetLimitOrderTrancheUserRequest, QueryGetPoolMetadataRequest, QueryGetPoolReservesRequest, + QueryParamsRequest, QueryPoolByIdRequest, QueryPoolRequest, +}; +use crate::stargate::aux::make_stargate_query; +use crate::stargate::dex::types::{ + AllInactiveLimitOrderTrancheRequest, AllInactiveLimitOrderTrancheResponse, + AllLimitOrderTrancheRequest, AllLimitOrderTrancheResponse, AllPoolMetadataRequest, + AllPoolMetadataResponse, AllPoolReservesRequest, AllPoolReservesResponse, + AllTickLiquidityRequest, AllTickLiquidityResponse, AllUserDepositsRequest, + AllUserDepositsResponse, AllUserLimitOrdersRequest, AllUserLimitOrdersResponse, + EstimateMultiHopSwapRequest, EstimateMultiHopSwapResponse, EstimatePlaceLimitOrderRequest, + EstimatePlaceLimitOrderResponse, GetInactiveLimitOrderTrancheRequest, + GetInactiveLimitOrderTrancheResponse, GetLimitOrderTrancheRequest, + GetLimitOrderTrancheResponse, GetPoolMetadataRequest, GetPoolMetadataResponse, + GetPoolReservesRequest, GetPoolReservesResponse, LimitOrderTrancheUserAllRequest, + LimitOrderTrancheUserAllResponse, LimitOrderTrancheUserRequest, LimitOrderTrancheUserResponse, + ParamsRequest, ParamsResponse, PoolByIdRequest, PoolRequest, PoolResponse, +}; +use cosmwasm_std::{Deps, StdResult}; + +const PARAMS_QUERY_PATH: &str = "/neutron.dex.Query/Params"; +const LIMIT_ORDER_TRANCHE_USER_QUERY_PATH: &str = "/neutron.dex.Query/LimitOrderTrancheUser"; +const LIMIT_ORDER_TRANCHE_USER_ALL_QUERY_PATH: &str = "/neutron.dex.Query/LimitOrderTrancheUserAll"; +const LIMIT_ORDER_TRANCHE_USER_ALL_BY_ADDRESS_QUERY_PATH: &str = + "/neutron.dex.Query/LimitOrderTrancheUserAllByAddress"; +const LIMIT_ORDER_TRANCHE_QUERY_PATH: &str = "/neutron.dex.Query/LimitOrderTranche"; +const LIMIT_ORDER_TRANCHE_ALL_QUERY_PATH: &str = "/neutron.dex.Query/LimitOrderTrancheAll"; +const USER_DEPOSITS_ALL_QUERY_PATH: &str = "/neutron.dex.Query/UserDepositsAll"; +const TICK_LIQUIDITY_ALL_QUERY_PATH: &str = "/neutron.dex.Query/TickLiquidityAll"; +const INACTIVE_LIMIT_ORDER_TRANCHE_QUERY_PATH: &str = + "/neutron.dex.Query/InactiveLimitOrderTranche"; +const INACTIVE_LIMIT_ORDER_TRANCHE_ALL_QUERY_PATH: &str = + "/neutron.dex.Query/InactiveLimitOrderTrancheAll"; +const POOL_RESERVES_ALL_QUERY_PATH: &str = "/neutron.dex.Query/PoolReservesAll"; +const POOL_RESERVES_QUERY_PATH: &str = "/neutron.dex.Query/PoolReserves"; +const ESTIMATE_MULTI_HOP_SWAP_QUERY_PATH: &str = "/neutron.dex.Query/EstimateMultiHopSwap"; +const ESTIMATE_PLACE_LIMIT_ORDER_QUERY_PATH: &str = "/neutron.dex.Query/EstimatePlaceLimitOrder"; +const POOL_QUERY_PATH: &str = "/neutron.dex.Query/Pool"; +const POOL_BY_ID_QUERY_PATH: &str = "/neutron.dex.Query/PoolByID"; +const POOL_METADATA_QUERY_PATH: &str = "/neutron.dex.Query/PoolMetadata"; +const POOL_METADATA_ALL_QUERY_PATH: &str = "/neutron.dex.Query/PoolMetadataAll"; + +/// Queries the parameters of the module. +pub fn get_params(deps: Deps, req: ParamsRequest) -> StdResult { + make_stargate_query(deps, PARAMS_QUERY_PATH, QueryParamsRequest::from(req)) +} + +/// Retrieves a `LimitOrderTrancheUser` by user address and tranche key. +pub fn get_limit_order_tranche_user( + deps: Deps, + req: LimitOrderTrancheUserRequest, +) -> StdResult { + make_stargate_query( + deps, + LIMIT_ORDER_TRANCHE_USER_QUERY_PATH, + QueryGetLimitOrderTrancheUserRequest::from(req), + ) +} + +/// Retrieves a list of `LimitOrderTrancheUser` items. +pub fn get_limit_order_tranche_user_all( + deps: Deps, + req: LimitOrderTrancheUserAllRequest, +) -> StdResult { + make_stargate_query( + deps, + LIMIT_ORDER_TRANCHE_USER_ALL_QUERY_PATH, + QueryAllLimitOrderTrancheUserRequest::from(req), + ) +} + +/// Retrieves a list of `LimitOrderTrancheUser` items by user address. +pub fn get_limit_order_tranche_user_all_by_address( + deps: Deps, + req: AllUserLimitOrdersRequest, +) -> StdResult { + make_stargate_query( + deps, + LIMIT_ORDER_TRANCHE_USER_ALL_BY_ADDRESS_QUERY_PATH, + QueryAllUserLimitOrdersRequest::from(req), + ) +} + +/// Retrieves a `LimitOrderTranche` by a tranche's key (pair_id + token_in + tick_index + tranche_key). +pub fn get_limit_order_tranche( + deps: Deps, + req: GetLimitOrderTrancheRequest, +) -> StdResult { + make_stargate_query( + deps, + LIMIT_ORDER_TRANCHE_QUERY_PATH, + QueryGetLimitOrderTrancheRequest::from(req), + ) +} + +/// Retrieves a list of `LimitOrderTranche` items for a given pair_id / token_in combination. +pub fn get_limit_order_tranche_all( + deps: Deps, + req: AllLimitOrderTrancheRequest, +) -> StdResult { + make_stargate_query( + deps, + LIMIT_ORDER_TRANCHE_ALL_QUERY_PATH, + QueryAllLimitOrderTrancheRequest::from(req), + ) +} + +/// Retrieves a list of `DepositRecord` items by user address. +pub fn get_user_deposits_all( + deps: Deps, + req: AllUserDepositsRequest, +) -> StdResult { + make_stargate_query( + deps, + USER_DEPOSITS_ALL_QUERY_PATH, + QueryAllUserDepositsRequest::from(req), + ) +} + +/// Retrieves a list of `TickLiquidity` items for a given pair_id / token_in combination. +pub fn get_tick_liquidity_all( + deps: Deps, + req: AllTickLiquidityRequest, +) -> StdResult { + make_stargate_query( + deps, + TICK_LIQUIDITY_ALL_QUERY_PATH, + QueryAllTickLiquidityRequest::from(req), + ) +} + +/// Retrieves an inactive `LimitOrderTranche` by index. +pub fn get_inactive_limit_order_tranche( + deps: Deps, + req: GetInactiveLimitOrderTrancheRequest, +) -> StdResult { + make_stargate_query( + deps, + INACTIVE_LIMIT_ORDER_TRANCHE_QUERY_PATH, + QueryGetInactiveLimitOrderTrancheRequest::from(req), + ) +} + +/// Retrieves a list of inactive `LimitOrderTranche` items. +pub fn get_inactive_limit_order_tranche_all( + deps: Deps, + req: AllInactiveLimitOrderTrancheRequest, +) -> StdResult { + make_stargate_query( + deps, + INACTIVE_LIMIT_ORDER_TRANCHE_ALL_QUERY_PATH, + QueryAllInactiveLimitOrderTrancheRequest::from(req), + ) +} + +/// Retrieves a list of `PoolReserves` items for a given pair_id / token_in combination. +pub fn get_pool_reserves_all( + deps: Deps, + req: AllPoolReservesRequest, +) -> StdResult { + make_stargate_query( + deps, + POOL_RESERVES_ALL_QUERY_PATH, + QueryAllPoolReservesRequest::from(req), + ) +} + +/// Retrieves a `PoolReserves` by pool reserves key (pair_id + token_in + tick_index + fee). +pub fn get_pool_reserves( + deps: Deps, + req: GetPoolReservesRequest, +) -> StdResult { + make_stargate_query( + deps, + POOL_RESERVES_QUERY_PATH, + QueryGetPoolReservesRequest::from(req), + ) +} + +/// Queries the simulated result of a multihop swap. +pub fn get_estimate_multi_hop_swap( + deps: Deps, + req: EstimateMultiHopSwapRequest, +) -> StdResult { + make_stargate_query( + deps, + ESTIMATE_MULTI_HOP_SWAP_QUERY_PATH, + QueryEstimateMultiHopSwapRequest::from(req), + ) +} + +/// Queries the simulated result of a limit order placement. +pub fn get_estimate_place_limit_order( + deps: Deps, + req: EstimatePlaceLimitOrderRequest, +) -> StdResult { + make_stargate_query( + deps, + ESTIMATE_PLACE_LIMIT_ORDER_QUERY_PATH, + QueryEstimatePlaceLimitOrderRequest::from(req), + ) +} + +/// Queries a pool by pair, tick and fee. +pub fn get_pool(deps: Deps, req: PoolRequest) -> StdResult { + make_stargate_query(deps, POOL_QUERY_PATH, QueryPoolRequest::from(req)) +} + +/// Queries a pool by ID. +pub fn get_pool_by_id(deps: Deps, req: PoolByIdRequest) -> StdResult { + make_stargate_query(deps, POOL_BY_ID_QUERY_PATH, QueryPoolByIdRequest::from(req)) +} + +/// Queries a `PoolMetadata` by ID. +pub fn get_pool_metadata( + deps: Deps, + req: GetPoolMetadataRequest, +) -> StdResult { + make_stargate_query( + deps, + POOL_METADATA_QUERY_PATH, + QueryGetPoolMetadataRequest::from(req), + ) +} + +/// Queries a list of `PoolMetadata` items. +pub fn get_pool_metadata_all( + deps: Deps, + req: AllPoolMetadataRequest, +) -> StdResult { + make_stargate_query( + deps, + POOL_METADATA_ALL_QUERY_PATH, + QueryAllPoolMetadataRequest::from(req), + ) +} diff --git a/packages/neutron-sdk/src/stargate/dex/types.rs b/packages/neutron-sdk/src/stargate/dex/types.rs new file mode 100644 index 00000000..51b3077b --- /dev/null +++ b/packages/neutron-sdk/src/stargate/dex/types.rs @@ -0,0 +1,845 @@ +use crate::bindings::query::{PageRequest, PageResponse}; +use crate::proto_types::neutron::dex::{ + DepositOptions as DepositOptionsGen, MsgCancelLimitOrder, MsgDeposit, MsgMultiHopSwap, + MsgPlaceLimitOrder, MsgWithdrawFilledLimitOrder, MsgWithdrawal, MultiHopRoute, + QueryAllInactiveLimitOrderTrancheRequest, QueryAllLimitOrderTrancheRequest, + QueryAllLimitOrderTrancheUserRequest, QueryAllPoolMetadataRequest, QueryAllPoolReservesRequest, + QueryAllTickLiquidityRequest, QueryAllUserDepositsRequest, QueryAllUserLimitOrdersRequest, + QueryEstimateMultiHopSwapRequest, QueryEstimatePlaceLimitOrderRequest, + QueryGetInactiveLimitOrderTrancheRequest, QueryGetLimitOrderTrancheRequest, + QueryGetLimitOrderTrancheUserRequest, QueryGetPoolMetadataRequest, QueryGetPoolReservesRequest, + QueryParamsRequest, QueryPoolByIdRequest, QueryPoolRequest, +}; +use crate::stargate::aux::proto_timestamp_from_i64; +use cosmos_sdk_proto::cosmos::base::query::v1beta1::PageRequest as PageRequestGen; +use cosmwasm_std::{Coin, Int128, Int64, Uint64}; +use schemars::JsonSchema; +use serde::{Deserialize, Deserializer, Serialize}; +use speedate::DateTime; + +/// JIT_LIMIT_ORDER_TYPE_EXP_DATE_TIME is the default golang time.Time value used for JIT limit +/// order type in the dex module. +pub const JIT_LIMIT_ORDER_TYPE_EXP_DATE_TIME: &str = "0001-01-01T00:00:00Z"; +/// JIT_LIMIT_ORDER_TYPE_EXP_TIMESTAMP is a mock unix timestamp value used to replace timestamp +/// calc for JIT_LIMIT_ORDER_TYPE_EXP_DATE_TIME because the timestamp for this date time is invalid. +pub const JIT_LIMIT_ORDER_TYPE_EXP_TIMESTAMP: i64 = 0; + +// Deposit message + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +pub struct DepositRequest { + /// The account from which deposit Tokens will be debited. + pub sender: String, + /// The account to which PoolShares will be issued. + pub receiver: String, + /// Denom for one side of the deposit. + pub token_a: String, + /// Denom for the opposing side of the deposit. + pub token_b: String, + /// Amounts of token_a to deposit. + pub amounts_a: Vec, + /// Amounts of token_b to deposit. + pub amounts_b: Vec, + /// Tick indexes to deposit at defined in terms of token_a to token_b (i.e. token_a is on the left). + pub tick_indexes_a_to_b: Vec, + /// Fees to use for each deposit. + pub fees: Vec, + /// Additional deposit options. + pub options: Vec, +} + +impl From for MsgDeposit { + fn from(v: DepositRequest) -> MsgDeposit { + MsgDeposit { + creator: v.sender, + receiver: v.receiver, + token_a: v.token_a, + token_b: v.token_b, + amounts_a: v.amounts_a, + amounts_b: v.amounts_b, + tick_indexes_a_to_b: v.tick_indexes_a_to_b, + fees: v.fees, + options: v.options.into_iter().map(|o| o.into()).collect(), + } + } +} + +// Withdrawal message + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +pub struct WithdrawalRequest { + /// The account from which the PoolShares are removed. + pub sender: String, + /// The account to which the tokens are credited. + pub receiver: String, + /// Denom for one side of the deposit. + pub token_a: String, + /// Denom for the opposing side of the deposit. + pub token_b: String, + /// Amount of shares to remove from each pool. + pub shares_to_remove: Vec, + /// Tick indexes of the target LiquidityPools defined in terms of tokan_a to token_b (i.e. + /// token_a is on the left). + pub tick_indexes_a_to_b: Vec, + /// Fee for the target LiquidityPools. + pub fees: Vec, +} + +impl From for MsgWithdrawal { + fn from(v: WithdrawalRequest) -> MsgWithdrawal { + MsgWithdrawal { + creator: v.sender, + receiver: v.receiver, + token_a: v.token_a, + token_b: v.token_b, + shares_to_remove: v.shares_to_remove, + tick_indexes_a_to_b: v.tick_indexes_a_to_b, + fees: v.fees, + } + } +} + +// PlaceLimitOrder message + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +pub struct PlaceLimitOrderRequest { + /// Account from which token_in is debited. + pub sender: String, + /// Account to which token_out is credited or that will be allowed to withdraw or cancel a + /// maker order. + pub receiver: String, + /// Token being “sold”. + pub token_in: String, + /// Token being “bought”. + pub token_out: String, + /// Limit tick for a limit order, specified in terms of token_in to token_out. + pub tick_index_in_to_out: i64, + /// Amount of TokenIn to be traded. + pub amount_in: String, + /// Type of limit order to be used. + pub order_type: LimitOrderType, + /// Expiration time for order. Only valid for GoodTilTime limit orders. + pub expiration_time: Option, + pub max_amount_out: Option, +} + +impl From for MsgPlaceLimitOrder { + fn from(v: PlaceLimitOrderRequest) -> MsgPlaceLimitOrder { + MsgPlaceLimitOrder { + creator: v.sender, + receiver: v.receiver, + token_in: v.token_in, + token_out: v.token_out, + tick_index_in_to_out: v.tick_index_in_to_out, + amount_in: v.amount_in, + order_type: v.order_type as i32, + expiration_time: v.expiration_time.map(proto_timestamp_from_i64), + max_amount_out: v.max_amount_out.unwrap_or_default(), + } + } +} + +// WithdrawFilledLimitOrder message + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +pub struct WithdrawFilledLimitOrderRequest { + /// Account which controls the limit order and to which proceeds are credited. + pub sender: String, + /// Tranche key for the target limit order. + pub tranche_key: String, +} + +impl From for MsgWithdrawFilledLimitOrder { + fn from(v: WithdrawFilledLimitOrderRequest) -> MsgWithdrawFilledLimitOrder { + MsgWithdrawFilledLimitOrder { + creator: v.sender, + tranche_key: v.tranche_key, + } + } +} + +// CancelLimitOrder message + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +pub struct CancelLimitOrderRequest { + /// Account which controls the limit order and to which any untraded amount is credited. + pub sender: String, + /// Tranche key for the target limit order. + pub tranche_key: String, +} + +impl From for MsgCancelLimitOrder { + fn from(v: CancelLimitOrderRequest) -> MsgCancelLimitOrder { + MsgCancelLimitOrder { + creator: v.sender, + tranche_key: v.tranche_key, + } + } +} + +// MultiHopSwap message + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +pub struct MultiHopSwapRequest { + /// Account from which token_in is debited. + pub sender: String, + /// Account to which token_out is credited. + pub receiver: String, + /// Array of possible routes. E.g. [[“token_a”, “token_c”, “token_d”, “token_b”]]. The complete + /// amount of specified by `amount_in` will always be used. If there is insufficient liquidity + /// in a route to swap 100% of the `amount_in` the route will fail. The first route that does + /// not run out of liquidity, hit the `exit_limit_price` or return an error will be used. + pub routes: Vec>, + /// Amount of token_in to swap. + pub amount_in: String, + /// Minimum price that that must be satisfied for a route to succeed. + pub exit_limit_price: String, + /// If true all routes are run and the route with the best price is used. + pub pick_best_route: bool, +} + +impl From for MsgMultiHopSwap { + fn from(v: MultiHopSwapRequest) -> MsgMultiHopSwap { + MsgMultiHopSwap { + creator: v.sender, + receiver: v.receiver, + routes: v + .routes + .into_iter() + .map(|r| MultiHopRoute { hops: r }) + .collect(), + amount_in: v.amount_in, + exit_limit_price: v.exit_limit_price, + pick_best_route: v.pick_best_route, + } + } +} + +// Params query + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +pub struct ParamsRequest {} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +pub struct ParamsResponse { + pub params: Params, +} + +impl From for QueryParamsRequest { + fn from(_: ParamsRequest) -> QueryParamsRequest { + QueryParamsRequest {} + } +} + +// LimitOrderTrancheUser query + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +pub struct LimitOrderTrancheUserRequest { + pub address: String, + pub tranche_key: String, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +pub struct LimitOrderTrancheUserResponse { + pub limit_order_tranche_user: Option, +} + +impl From for QueryGetLimitOrderTrancheUserRequest { + fn from(v: LimitOrderTrancheUserRequest) -> QueryGetLimitOrderTrancheUserRequest { + QueryGetLimitOrderTrancheUserRequest { + address: v.address, + tranche_key: v.tranche_key, + } + } +} + +// LimitOrderTrancheUserAll query + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +pub struct LimitOrderTrancheUserAllRequest { + pub pagination: Option, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +pub struct LimitOrderTrancheUserAllResponse { + pub limit_order_tranche_user: Vec, + pub pagination: Option, +} + +impl From for QueryAllLimitOrderTrancheUserRequest { + fn from(v: LimitOrderTrancheUserAllRequest) -> QueryAllLimitOrderTrancheUserRequest { + QueryAllLimitOrderTrancheUserRequest { + pagination: convert_page_request(v.pagination), + } + } +} + +// LimitOrderTrancheUserAllByAddress query + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +pub struct AllUserLimitOrdersRequest { + pub address: String, + pub pagination: Option, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +pub struct AllUserLimitOrdersResponse { + pub limit_orders: Vec, + pub pagination: Option, +} + +impl From for QueryAllUserLimitOrdersRequest { + fn from(v: AllUserLimitOrdersRequest) -> QueryAllUserLimitOrdersRequest { + QueryAllUserLimitOrdersRequest { + address: v.address, + pagination: convert_page_request(v.pagination), + } + } +} + +// LimitOrderTranche query + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +pub struct GetLimitOrderTrancheRequest { + pub pair_id: String, + pub tick_index: i64, + pub token_in: String, + pub tranche_key: String, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +pub struct GetLimitOrderTrancheResponse { + pub limit_order_tranche: Option, +} + +impl From for QueryGetLimitOrderTrancheRequest { + fn from(v: GetLimitOrderTrancheRequest) -> QueryGetLimitOrderTrancheRequest { + QueryGetLimitOrderTrancheRequest { + pair_id: v.pair_id, + tick_index: v.tick_index, + token_in: v.token_in, + tranche_key: v.tranche_key, + } + } +} + +// LimitOrderTrancheAll query + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +pub struct AllLimitOrderTrancheRequest { + pub pair_id: String, + pub token_in: String, + pub pagination: Option, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +pub struct AllLimitOrderTrancheResponse { + pub limit_order_tranche: Vec, + pub pagination: Option, +} + +impl From for QueryAllLimitOrderTrancheRequest { + fn from(v: AllLimitOrderTrancheRequest) -> QueryAllLimitOrderTrancheRequest { + QueryAllLimitOrderTrancheRequest { + pair_id: v.pair_id, + token_in: v.token_in, + pagination: convert_page_request(v.pagination), + } + } +} + +// UserDepositsAll query + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +pub struct AllUserDepositsRequest { + pub address: String, + pub pagination: Option, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +pub struct AllUserDepositsResponse { + pub deposits: Vec, + pub pagination: Option, +} + +impl From for QueryAllUserDepositsRequest { + fn from(v: AllUserDepositsRequest) -> QueryAllUserDepositsRequest { + QueryAllUserDepositsRequest { + address: v.address, + pagination: convert_page_request(v.pagination), + } + } +} + +// TickLiquidityAll query + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +pub struct AllTickLiquidityRequest { + pub pair_id: String, + pub token_in: String, + pub pagination: Option, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +pub struct AllTickLiquidityResponse { + pub tick_liquidity: Vec, + pub pagination: Option, +} + +impl From for QueryAllTickLiquidityRequest { + fn from(v: AllTickLiquidityRequest) -> QueryAllTickLiquidityRequest { + QueryAllTickLiquidityRequest { + pair_id: v.pair_id, + token_in: v.token_in, + pagination: convert_page_request(v.pagination), + } + } +} + +// InactiveLimitOrderTranche query + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +pub struct GetInactiveLimitOrderTrancheRequest { + pub pair_id: String, + pub token_in: String, + pub tick_index: i64, + pub tranche_key: String, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +pub struct GetInactiveLimitOrderTrancheResponse { + pub inactive_limit_order_tranche: LimitOrderTranche, +} + +impl From for QueryGetInactiveLimitOrderTrancheRequest { + fn from(v: GetInactiveLimitOrderTrancheRequest) -> QueryGetInactiveLimitOrderTrancheRequest { + QueryGetInactiveLimitOrderTrancheRequest { + pair_id: v.pair_id, + token_in: v.token_in, + tick_index: v.tick_index, + tranche_key: v.tranche_key, + } + } +} + +// InactiveLimitOrderTrancheAll query + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +pub struct AllInactiveLimitOrderTrancheRequest { + pub pagination: Option, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +pub struct AllInactiveLimitOrderTrancheResponse { + pub inactive_limit_order_tranche: Vec, + pub pagination: Option, +} + +impl From for QueryAllInactiveLimitOrderTrancheRequest { + fn from(v: AllInactiveLimitOrderTrancheRequest) -> QueryAllInactiveLimitOrderTrancheRequest { + QueryAllInactiveLimitOrderTrancheRequest { + pagination: convert_page_request(v.pagination), + } + } +} + +// PoolReservesAll query + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +pub struct AllPoolReservesRequest { + pub pair_id: String, + pub token_in: String, + pub pagination: Option, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +pub struct AllPoolReservesResponse { + pub pool_reserves: Vec, + pub pagination: Option, +} + +impl From for QueryAllPoolReservesRequest { + fn from(v: AllPoolReservesRequest) -> QueryAllPoolReservesRequest { + QueryAllPoolReservesRequest { + pair_id: v.pair_id, + token_in: v.token_in, + pagination: convert_page_request(v.pagination), + } + } +} + +// PoolReserves query + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +pub struct GetPoolReservesRequest { + pub pair_id: String, + pub token_in: String, + pub tick_index: i64, + pub fee: u64, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +pub struct GetPoolReservesResponse { + pub pool_reserves: PoolReserves, +} + +impl From for QueryGetPoolReservesRequest { + fn from(v: GetPoolReservesRequest) -> QueryGetPoolReservesRequest { + QueryGetPoolReservesRequest { + pair_id: v.pair_id, + token_in: v.token_in, + tick_index: v.tick_index, + fee: v.fee, + } + } +} + +// EstimateMultiHopSwap query + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +pub struct EstimateMultiHopSwapRequest { + pub creator: String, + pub receiver: String, + pub routes: Vec>, + pub amount_in: String, + pub exit_limit_price: String, + pub pick_best_route: bool, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +pub struct EstimateMultiHopSwapResponse { + pub coin_out: Coin, +} + +impl From for QueryEstimateMultiHopSwapRequest { + fn from(v: EstimateMultiHopSwapRequest) -> QueryEstimateMultiHopSwapRequest { + QueryEstimateMultiHopSwapRequest { + creator: v.creator, + receiver: v.receiver, + routes: v + .routes + .into_iter() + .map(|r| MultiHopRoute { hops: r }) + .collect(), + amount_in: v.amount_in, + exit_limit_price: v.exit_limit_price, + pick_best_route: v.pick_best_route, + } + } +} + +// EstimatePlaceLimitOrder query + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +pub struct EstimatePlaceLimitOrderRequest { + pub creator: String, + pub receiver: String, + pub token_in: String, + pub token_out: String, + pub tick_index_in_to_out: i64, + pub amount_in: String, + pub order_type: LimitOrderType, + pub expiration_time: Option, + pub max_amount_out: Option, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +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, +} + +impl From for QueryEstimatePlaceLimitOrderRequest { + fn from(v: EstimatePlaceLimitOrderRequest) -> QueryEstimatePlaceLimitOrderRequest { + QueryEstimatePlaceLimitOrderRequest { + creator: v.creator, + receiver: v.receiver, + token_in: v.token_in, + token_out: v.token_out, + tick_index_in_to_out: v.tick_index_in_to_out, + amount_in: v.amount_in, + order_type: v.order_type as i32, + expiration_time: v.expiration_time.map(proto_timestamp_from_i64), + max_amount_out: v.max_amount_out.unwrap_or_default(), + } + } +} + +// Pool query + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +pub struct PoolRequest { + pub pair_id: String, + pub tick_index: i64, + pub fee: u64, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +pub struct PoolResponse { + pub pool: Pool, +} + +impl From for QueryPoolRequest { + fn from(v: PoolRequest) -> QueryPoolRequest { + QueryPoolRequest { + pair_id: v.pair_id, + tick_index: v.tick_index, + fee: v.fee, + } + } +} + +// PoolByID query + +pub struct PoolByIdRequest { + pub pool_id: u64, +} + +impl From for QueryPoolByIdRequest { + fn from(v: PoolByIdRequest) -> QueryPoolByIdRequest { + QueryPoolByIdRequest { pool_id: v.pool_id } + } +} + +// PoolMetadata query + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +pub struct GetPoolMetadataRequest { + pub id: u64, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +pub struct GetPoolMetadataResponse { + #[serde(rename(deserialize = "Pool_metadata"))] + pub pool_metadata: PoolMetadata, +} + +impl From for QueryGetPoolMetadataRequest { + fn from(v: GetPoolMetadataRequest) -> QueryGetPoolMetadataRequest { + QueryGetPoolMetadataRequest { id: v.id } + } +} + +// PoolMetadataAll query + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +pub struct AllPoolMetadataRequest { + pub pagination: Option, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +pub struct AllPoolMetadataResponse { + pub pool_metadata: Vec, + pub pagination: Option, +} + +impl From for QueryAllPoolMetadataRequest { + fn from(v: AllPoolMetadataRequest) -> QueryAllPoolMetadataRequest { + QueryAllPoolMetadataRequest { + pagination: convert_page_request(v.pagination), + } + } +} + +// Common + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +pub struct DepositOptions { + /// Autoswap provides a mechanism for users to deposit the entirety of their specified deposit + /// amounts by paying a small fee. By default the `autoswap` option is enabled. + pub disable_autoswap: bool, +} + +impl From for DepositOptionsGen { + fn from(o: DepositOptions) -> DepositOptionsGen { + DepositOptionsGen { + disable_autoswap: o.disable_autoswap, + } + } +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +pub struct Params { + pub fee_tiers: Vec, + pub max_true_taker_spread: String, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +#[schemars(with = "String")] +#[serde(rename_all = "SCREAMING_SNAKE_CASE")] +pub enum LimitOrderType { + GoodTilCancelled = 0, + FillOrKill = 1, + ImmediateOrCancel = 2, + JustInTime = 3, + GoodTilTime = 4, +} + +impl TryFrom for LimitOrderType { + type Error = String; + + fn try_from(v: i32) -> Result { + match v { + 0 => Ok(LimitOrderType::GoodTilCancelled), + 1 => Ok(LimitOrderType::FillOrKill), + 2 => Ok(LimitOrderType::ImmediateOrCancel), + 3 => Ok(LimitOrderType::JustInTime), + 4 => Ok(LimitOrderType::GoodTilTime), + _ => Err(format!( + "invalid numeric value for LimitOrderType {}: expected 0-4", + v + )), + } + } +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +pub struct LimitOrderTrancheUser { + pub trade_pair_id: TradePairID, + pub tick_index_taker_to_maker: Int64, + 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)] +pub struct LimitOrderTrancheKey { + pub trade_pair_id: TradePairID, + pub tick_index_taker_to_maker: Int64, + pub tranche_key: String, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +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, + /// unix timestamp in seconds; + #[serde(deserialize_with = "deserialize_expiration_time")] + pub expiration_time: Option, + /// a decimal with precision equal to 26 + pub price_taker_to_maker: String, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +pub struct DepositRecord { + pub pair_id: PairID, + pub shares_owned: Int128, + pub center_tick_index: Int64, + pub lower_tick_index: Int64, + pub upper_tick_index: Int64, + pub fee: Option, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, Default)] +pub struct PairID { + pub token0: String, + pub token1: String, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +#[serde(rename_all = "snake_case")] +pub enum TickLiquidity { + PoolReserves(PoolReserves), + LimitOrderTranche(LimitOrderTranche), +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +pub struct PoolReserves { + pub key: PoolReservesKey, + pub reserves_maker_denom: Int128, + /// a decimal with precision equal to 26 + pub price_taker_to_maker: String, + /// a decimal with precision equal to 26 + pub price_opposite_taker_to_maker: String, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +pub struct PoolReservesKey { + pub trade_pair_id: TradePairID, + pub tick_index_taker_to_maker: Int64, + pub fee: Option, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +pub struct TradePairID { + pub maker_denom: String, + pub taker_denom: String, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +pub struct Pool { + pub id: Uint64, + pub lower_tick0: Option, + pub lower_tick1: Option, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, Default)] +pub struct PoolMetadata { + pub id: Uint64, + pub tick: Int64, + pub fee: Uint64, + pub pair_id: PairID, +} + +fn convert_page_request(page_request: Option) -> Option { + match page_request { + Some(p) => Some(PageRequestGen { + key: p.key.into(), + offset: p.offset, + limit: p.limit, + count_total: p.count_total, + reverse: p.reverse, + }), + None => None, + } +} + +/// deserialize_expiration_time deserealizes an optional expiration_time value on dex module's rules: +/// - if it's None, it returns None (non-expiring limit orders); +/// - if it's a default golang time.Time value used for JIT limit order type (0001-01-01T00:00:00Z), +/// it returns 0, because the timestamp for this value is invalid (-62135596800); +/// - in the rest of the cases, it assumes it's a valid RFC 3339 formatted date time and tries to +/// parse it and returns a unix timestamp. +fn deserialize_expiration_time<'de, D>(deserializer: D) -> Result, D::Error> +where + D: Deserializer<'de>, +{ + // Deserialize the field as an Option<&str> + let opt_date_time_string: Option<&str> = Option::deserialize(deserializer)?; + + match opt_date_time_string { + None => Ok(None), + + Some(date_time_str) => match date_time_str { + JIT_LIMIT_ORDER_TYPE_EXP_DATE_TIME => { + Ok(Some(JIT_LIMIT_ORDER_TYPE_EXP_TIMESTAMP.into())) + } + + // some RFC 3339 formatted date time to be parsed to a unix timestamp + _ => Ok(Some( + DateTime::parse_str_rfc3339(date_time_str) + .map_err(|_| { + serde::de::Error::invalid_value( + serde::de::Unexpected::Str(date_time_str), + &"an RFC 3339 formatted date time", + ) + })? + .timestamp() + .into(), + )), + }, + } +} diff --git a/packages/neutron-sdk/src/stargate/mod.rs b/packages/neutron-sdk/src/stargate/mod.rs new file mode 100644 index 00000000..0ba58e2a --- /dev/null +++ b/packages/neutron-sdk/src/stargate/mod.rs @@ -0,0 +1,2 @@ +pub mod aux; +pub mod dex; diff --git a/proto/transfer/v1/transfer.proto b/proto/transfer/v1/transfer.proto deleted file mode 100644 index 572fe419..00000000 --- a/proto/transfer/v1/transfer.proto +++ /dev/null @@ -1,12 +0,0 @@ -syntax = "proto3"; - -package neutron.transfer; - -// MsgTransferResponse is the modified response type for -// ibc-go MsgTransfer. -message MsgTransferResponse { - // channel's sequence_id for outgoing ibc packet. Unique per a channel. - uint64 sequence_id = 1; - // channel src channel on neutron side trasaction was submitted from - string channel = 2; -} diff --git a/thirdparty/protoc-image/Dockerfile b/thirdparty/protoc-image/Dockerfile deleted file mode 100644 index 683c3073..00000000 --- a/thirdparty/protoc-image/Dockerfile +++ /dev/null @@ -1,26 +0,0 @@ -FROM rust:1.71.0 - -ENV PROTOC_VERSION 3.20.0 - -RUN set -x; \ - export PROTOC_ZIP=$(echo "protoc-$PROTOC_VERSION-linux-$(uname -m).zip" | sed 's/aarch/aarch_/g'); \ - apt update \ - && apt install -y \ - clang \ - cmake \ - lcov \ - libudev-dev \ - mscgen \ - net-tools \ - rsync \ - sudo \ - golang \ - unzip \ - \ - && apt remove -y libcurl4-openssl-dev \ - && rm -rf /var/lib/apt/lists/* \ - && curl -OL https://github.com/google/protobuf/releases/download/v$PROTOC_VERSION/$PROTOC_ZIP \ - && unzip -o $PROTOC_ZIP -d /usr/local bin/protoc \ - && unzip -o $PROTOC_ZIP -d /usr/local include/* \ - && rm -f $PROTOC_ZIP \ - && cargo install protobuf-codegen --version 3.3.0 --locked