From 6da2278cd76c2f14d5285327bc81b7e115de1459 Mon Sep 17 00:00:00 2001 From: nhpd Date: Fri, 11 Oct 2024 18:40:42 +0400 Subject: [PATCH] fix compile and warning errors --- contracts/ibc_transfer/src/contract.rs | 9 +- .../src/contract.rs | 4 +- .../neutron_interchain_txs/src/contract.rs | 7 +- packages/neutron-sdk/schema/neutron_msg.json | 1740 ----------------- .../neutron-sdk/schema/neutron_query.json | 1139 ----------- .../neutron-sdk/src/bin/neutron-sdk-schema.rs | 3 - packages/neutron-sdk/src/bindings/msg.rs | 13 +- packages/neutron-sdk/src/bindings/types.rs | 224 +-- .../src/interchain_queries/types.rs | 5 +- .../src/interchain_queries/v045/helpers.rs | 2 +- packages/neutron-sdk/src/lib.rs | 1 - packages/neutron-sdk/src/serde/mod.rs | 104 - 12 files changed, 15 insertions(+), 3236 deletions(-) delete mode 100644 packages/neutron-sdk/schema/neutron_msg.json delete mode 100644 packages/neutron-sdk/schema/neutron_query.json delete mode 100644 packages/neutron-sdk/src/bin/neutron-sdk-schema.rs delete mode 100644 packages/neutron-sdk/src/serde/mod.rs diff --git a/contracts/ibc_transfer/src/contract.rs b/contracts/ibc_transfer/src/contract.rs index 159fb065..c506225f 100644 --- a/contracts/ibc_transfer/src/contract.rs +++ b/contracts/ibc_transfer/src/contract.rs @@ -1,13 +1,10 @@ use cosmwasm_std::{ - coin, entry_point, Binary, CosmosMsg, Deps, DepsMut, Env, MessageInfo, Reply, Response, - StdError, StdResult, SubMsg, + entry_point, Binary, CosmosMsg, Deps, DepsMut, Env, MessageInfo, Reply, Response, StdError, + StdResult, SubMsg, }; use cw2::set_contract_version; use neutron_sdk::interchain_txs::helpers::decode_message_response; -use neutron_sdk::{ - sudo::msg::{RequestPacket, RequestPacketTimeoutHeight, TransferSudoMsg}, - NeutronResult, -}; +use neutron_sdk::sudo::msg::{RequestPacket, TransferSudoMsg}; use neutron_std::types::neutron::transfer::{MsgTransfer, MsgTransferResponse}; // TODO: rename use neutron_std::types::cosmos::base::v1beta1::Coin as SuperCoin; diff --git a/contracts/neutron_interchain_queries/src/contract.rs b/contracts/neutron_interchain_queries/src/contract.rs index 6fd0ff1e..b6ab93b4 100644 --- a/contracts/neutron_interchain_queries/src/contract.rs +++ b/contracts/neutron_interchain_queries/src/contract.rs @@ -7,9 +7,7 @@ use cosmwasm_std::{ }; use cw2::set_contract_version; use neutron_sdk::interchain_queries::v047::register_queries::new_register_validators_signing_infos_query_msg; -use neutron_std::types::neutron::interchainqueries::{ - InterchainqueriesQuerier, KvKey, QueryResult, RegisteredQuery, -}; +use neutron_std::types::neutron::interchainqueries::{KvKey, RegisteredQuery}; // TODO: fix name use neutron_sdk::interchain_queries::v045::register_queries::{ remove_interchain_query as helpers_remove_interchain_query, diff --git a/contracts/neutron_interchain_txs/src/contract.rs b/contracts/neutron_interchain_txs/src/contract.rs index e12884b5..4697af1a 100644 --- a/contracts/neutron_interchain_txs/src/contract.rs +++ b/contracts/neutron_interchain_txs/src/contract.rs @@ -1,7 +1,7 @@ use cosmos_sdk_proto::traits::Message; use cosmwasm_std::{ - to_json_binary, Addr, Binary, Coin as CoinSDK, CosmosMsg, CustomQuery, Deps, DepsMut, Env, - MessageInfo, Reply, Response, StdError, StdResult, SubMsg, + to_json_binary, Addr, Binary, CosmosMsg, CustomQuery, Deps, DepsMut, Env, MessageInfo, Reply, + Response, StdError, StdResult, SubMsg, }; use cw2::set_contract_version; use neutron_std::shim::Timestamp; @@ -12,10 +12,9 @@ use crate::storage::{ save_reply_payload, save_sudo_payload, AcknowledgementResult, SudoPayload, ACKNOWLEDGEMENT_RESULTS, INTERCHAIN_ACCOUNTS, SUDO_PAYLOAD_REPLY_ID, }; -use neutron_sdk::bindings::msg::{ChannelOrdering, IbcFee}; +use neutron_sdk::bindings::msg::ChannelOrdering; use neutron_sdk::interchain_queries::v045::register_queries::register_interchain_account; use neutron_sdk::{ - bindings::types::ProtobufAny, interchain_txs::helpers::{decode_message_response, get_port_id}, interchain_txs::v047::helpers::decode_acknowledgement_response, sudo::msg::{RequestPacket, SudoMsg}, diff --git a/packages/neutron-sdk/schema/neutron_msg.json b/packages/neutron-sdk/schema/neutron_msg.json deleted file mode 100644 index d43ee446..00000000 --- a/packages/neutron-sdk/schema/neutron_msg.json +++ /dev/null @@ -1,1740 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "NeutronMsg", - "description": "A number of Custom messages that can call into the Neutron bindings.", - "oneOf": [ - { - "description": "RegisterInterchainAccount registers an interchain account on remote chain.", - "type": "object", - "required": [ - "register_interchain_account" - ], - "properties": { - "register_interchain_account": { - "type": "object", - "required": [ - "connection_id", - "interchain_account_id" - ], - "properties": { - "connection_id": { - "description": "*connection_id** is an IBC connection identifier between Neutron and remote chain.", - "type": "string" - }, - "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" - }, - "ordering": { - "description": "**ordering** is an order of channel. Can be ordered or unordered. Set to ordered if not specified.", - "anyOf": [ - { - "$ref": "#/definitions/ChannelOrdering" - }, - { - "type": "null" - } - ] - }, - "register_fee": { - "description": "*register_fee** is a fees required to be payed to register interchain account", - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/definitions/Coin" - } - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "SubmitTx starts the process of executing any Cosmos-SDK *msgs* on remote chain.", - "type": "object", - "required": [ - "submit_tx" - ], - "properties": { - "submit_tx": { - "type": "object", - "required": [ - "connection_id", - "fee", - "interchain_account_id", - "memo", - "msgs", - "timeout" - ], - "properties": { - "connection_id": { - "description": "*connection_id** is an IBC connection identifier between Neutron and remote chain.", - "type": "string" - }, - "fee": { - "description": "**fee** is an ibc fee for the transaction.", - "allOf": [ - { - "$ref": "#/definitions/IbcFee" - } - ] - }, - "interchain_account_id": { - "description": "*interchain_account_id** is an identifier of your interchain account from which you want to execute msgs.", - "type": "string" - }, - "memo": { - "description": "*memo** is a memo you want to attach to your interchain transaction.It behaves like a memo in usual Cosmos transaction.", - "type": "string" - }, - "msgs": { - "description": "*msgs** is a list of protobuf encoded Cosmos-SDK messages you want to execute on remote chain.", - "type": "array", - "items": { - "$ref": "#/definitions/ProtobufAny" - } - }, - "timeout": { - "description": "*timeout** is a timeout in seconds after which the packet times out.", - "type": "integer", - "format": "uint64", - "minimum": 0.0 - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "RegisterInterchainQuery registers an interchain query.", - "type": "object", - "required": [ - "register_interchain_query" - ], - "properties": { - "register_interchain_query": { - "type": "object", - "required": [ - "connection_id", - "keys", - "query_type", - "transactions_filter", - "update_period" - ], - "properties": { - "connection_id": { - "description": "*connection_id** is an IBC connection identifier between Neutron and remote chain.", - "type": "string" - }, - "keys": { - "description": "*keys** is the KV-storage keys for which we want to get values from remote chain.", - "type": "array", - "items": { - "$ref": "#/definitions/KVKey" - } - }, - "query_type": { - "description": "*query_type** is a query type identifier ('tx' or 'kv' for now).", - "type": "string" - }, - "transactions_filter": { - "description": "*transactions_filter** is the filter for transaction search ICQ.", - "type": "string" - }, - "update_period": { - "description": "*update_period** is used to say how often the query must be updated.", - "type": "integer", - "format": "uint64", - "minimum": 0.0 - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "RegisterInterchainQuery updates an interchain query.", - "type": "object", - "required": [ - "update_interchain_query" - ], - "properties": { - "update_interchain_query": { - "type": "object", - "required": [ - "query_id" - ], - "properties": { - "new_keys": { - "description": "*new_keys** is the new query keys to retrieve.", - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/definitions/KVKey" - } - }, - "new_transactions_filter": { - "description": "*new_transactions_filter** is a new transactions filter of the query.", - "type": [ - "string", - "null" - ] - }, - "new_update_period": { - "description": "*new_update_period** is a new update period of the query.", - "type": [ - "integer", - "null" - ], - "format": "uint64", - "minimum": 0.0 - }, - "query_id": { - "description": "*query_id** is the ID of the query we want to update.", - "type": "integer", - "format": "uint64", - "minimum": 0.0 - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "RemoveInterchainQuery removes as interchain query.", - "type": "object", - "required": [ - "remove_interchain_query" - ], - "properties": { - "remove_interchain_query": { - "type": "object", - "required": [ - "query_id" - ], - "properties": { - "query_id": { - "description": "*query_id** is ID of the query we want to remove.", - "type": "integer", - "format": "uint64", - "minimum": 0.0 - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "IbcTransfer sends a fungible token packet over IBC.", - "type": "object", - "required": [ - "ibc_transfer" - ], - "properties": { - "ibc_transfer": { - "type": "object", - "required": [ - "fee", - "memo", - "receiver", - "sender", - "source_channel", - "source_port", - "timeout_height", - "timeout_timestamp", - "token" - ], - "properties": { - "fee": { - "$ref": "#/definitions/IbcFee" - }, - "memo": { - "type": "string" - }, - "receiver": { - "type": "string" - }, - "sender": { - "type": "string" - }, - "source_channel": { - "type": "string" - }, - "source_port": { - "type": "string" - }, - "timeout_height": { - "$ref": "#/definitions/RequestPacketTimeoutHeight" - }, - "timeout_timestamp": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - }, - "token": { - "$ref": "#/definitions/Coin" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "SubmitAdminProposal sends a proposal to neutron's Admin module. This type of messages can be only executed by Neutron DAO.", - "type": "object", - "required": [ - "submit_admin_proposal" - ], - "properties": { - "submit_admin_proposal": { - "type": "object", - "required": [ - "admin_proposal" - ], - "properties": { - "admin_proposal": { - "$ref": "#/definitions/AdminProposal" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "TokenFactory message. Contracts can create denoms, namespaced under the contract's address. A contract may create any number of independent sub-denoms.", - "type": "object", - "required": [ - "create_denom" - ], - "properties": { - "create_denom": { - "type": "object", - "required": [ - "subdenom" - ], - "properties": { - "subdenom": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "TokenFactory message. Contracts can change the admin of a denom that they are the admin of.", - "type": "object", - "required": [ - "change_admin" - ], - "properties": { - "change_admin": { - "type": "object", - "required": [ - "denom", - "new_admin_address" - ], - "properties": { - "denom": { - "type": "string" - }, - "new_admin_address": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "TokenFactory message. Contracts can mint native tokens for an existing factory denom that they are the admin of.", - "type": "object", - "required": [ - "mint_tokens" - ], - "properties": { - "mint_tokens": { - "type": "object", - "required": [ - "amount", - "denom", - "mint_to_address" - ], - "properties": { - "amount": { - "$ref": "#/definitions/Uint128" - }, - "denom": { - "type": "string" - }, - "mint_to_address": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "TokenFactory message. Contracts can burn native tokens for an existing factory denom that they are the admin of. Currently, the burn from address must be the admin contract.", - "type": "object", - "required": [ - "burn_tokens" - ], - "properties": { - "burn_tokens": { - "type": "object", - "required": [ - "amount", - "burn_from_address", - "denom" - ], - "properties": { - "amount": { - "$ref": "#/definitions/Uint128" - }, - "burn_from_address": { - "description": "Must be set to `\"\"` for now", - "type": "string" - }, - "denom": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "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 - } - }, - "additionalProperties": false - }, - { - "description": "TokenFactoryMessage Contracts can force specified `amount` of an existing factory denom that they are admin of to a `transfer_to_address` from a `transfer_from_address`.", - "type": "object", - "required": [ - "force_transfer" - ], - "properties": { - "force_transfer": { - "type": "object", - "required": [ - "amount", - "denom", - "transfer_from_address", - "transfer_to_address" - ], - "properties": { - "amount": { - "$ref": "#/definitions/Uint128" - }, - "denom": { - "type": "string" - }, - "transfer_from_address": { - "type": "string" - }, - "transfer_to_address": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "TokenFactoryMessage Contracts can set a metadata for of an existing factory denom that they are admin of.", - "type": "object", - "required": [ - "set_denom_metadata" - ], - "properties": { - "set_denom_metadata": { - "type": "object", - "required": [ - "base", - "denom_units", - "description", - "display", - "name", - "symbol", - "uri", - "uri_hash" - ], - "properties": { - "base": { - "description": "*base** represents the base denom (should be the DenomUnit with exponent = 0).", - "type": "string" - }, - "denom_units": { - "description": "*denom_units** represents the list of DenomUnit's for a given coin", - "type": "array", - "items": { - "$ref": "#/definitions/DenomUnit" - } - }, - "description": { - "description": "*description** description of a token", - "type": "string" - }, - "display": { - "description": "**display** indicates the suggested denom that should be displayed in clients.", - "type": "string" - }, - "name": { - "description": "*name** defines the name of the token (eg: Cosmos Atom)", - "type": "string" - }, - "symbol": { - "description": "**symbol** is the token symbol usually shown on exchanges (eg: ATOM). This can be the same as the display.", - "type": "string" - }, - "uri": { - "description": "*uri** to a document (on or off-chain) that contains additional information. Optional.", - "type": "string" - }, - "uri_hash": { - "description": "**uri_hash** is a sha256 hash of a document pointed by URI. It's used to verify that the document didn't change. Optional.", - "type": "string" - } - }, - "additionalProperties": false - } - }, - "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", - "required": [ - "add_schedule" - ], - "properties": { - "add_schedule": { - "type": "object", - "required": [ - "msgs", - "name", - "period" - ], - "properties": { - "msgs": { - "description": "list of cosmwasm messages to be executed", - "type": "array", - "items": { - "$ref": "#/definitions/MsgExecuteContract" - } - }, - "name": { - "description": "Name of a new schedule. Needed to be able to `RemoveSchedule` and to log information about it", - "type": "string" - }, - "period": { - "description": "period in blocks with which `msgs` will be executed", - "type": "integer", - "format": "uint64", - "minimum": 0.0 - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "RemoveSchedule removes the schedule with a given `name`. [Permissioned - DAO or Security DAO only]", - "type": "object", - "required": [ - "remove_schedule" - ], - "properties": { - "remove_schedule": { - "type": "object", - "required": [ - "name" - ], - "properties": { - "name": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "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 - } - }, - "additionalProperties": false - }, - { - "description": "Dex messages", - "type": "object", - "required": [ - "dex" - ], - "properties": { - "dex": { - "$ref": "#/definitions/DexMsg" - } - }, - "additionalProperties": false - } - ], - "definitions": { - "AdminProposal": { - "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" - ], - "properties": { - "param_change_proposal": { - "$ref": "#/definitions/ParamChangeProposal" - } - }, - "additionalProperties": false - }, - { - "description": "Deprecated. Proposal to upgrade IBC client", - "deprecated": true, - "type": "object", - "required": [ - "upgrade_proposal" - ], - "properties": { - "upgrade_proposal": { - "$ref": "#/definitions/UpgradeProposal" - } - }, - "additionalProperties": false - }, - { - "description": "Deprecated. Proposal to update IBC client", - "deprecated": true, - "type": "object", - "required": [ - "client_update_proposal" - ], - "properties": { - "client_update_proposal": { - "$ref": "#/definitions/ClientUpdateProposal" - } - }, - "additionalProperties": false - }, - { - "description": "Proposal to execute CosmosMsg.", - "type": "object", - "required": [ - "proposal_execute_message" - ], - "properties": { - "proposal_execute_message": { - "$ref": "#/definitions/ProposalExecuteMessage" - } - }, - "additionalProperties": false - }, - { - "description": "Deprecated. Proposal to upgrade network", - "deprecated": true, - "type": "object", - "required": [ - "software_upgrade_proposal" - ], - "properties": { - "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" - ], - "properties": { - "pin_codes_proposal": { - "$ref": "#/definitions/PinCodesProposal" - } - }, - "additionalProperties": false - }, - { - "description": "Deprecated. Deprecated. Proposal to unpin wasm contract codes.", - "deprecated": true, - "type": "object", - "required": [ - "unpin_codes_proposal" - ], - "properties": { - "unpin_codes_proposal": { - "$ref": "#/definitions/UnpinCodesProposal" - } - }, - "additionalProperties": false - }, - { - "description": "Deprecated. Proposal to call sudo on contract.", - "deprecated": true, - "type": "object", - "required": [ - "sudo_contract_proposal" - ], - "properties": { - "sudo_contract_proposal": { - "$ref": "#/definitions/SudoContractProposal" - } - }, - "additionalProperties": false - }, - { - "description": "Deprecated. Proposal to update contract admin.", - "deprecated": true, - "type": "object", - "required": [ - "update_admin_proposal" - ], - "properties": { - "update_admin_proposal": { - "$ref": "#/definitions/UpdateAdminProposal" - } - }, - "additionalProperties": false - }, - { - "description": "Deprecated. Proposal to clear contract admin.", - "deprecated": true, - "type": "object", - "required": [ - "clear_admin_proposal" - ], - "properties": { - "clear_admin_proposal": { - "$ref": "#/definitions/ClearAdminProposal" - } - }, - "additionalProperties": false - } - ] - }, - "Binary": { - "description": "Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec. See also .", - "type": "string" - }, - "CancelSoftwareUpgradeProposal": { - "description": "Deprecated. CancelSoftwareUpgradeProposal defines the struct for cancel software upgrade proposal.", - "deprecated": true, - "type": "object", - "required": [ - "description", - "title" - ], - "properties": { - "description": { - "description": "*description** is a text description of proposal. Non unique.", - "type": "string" - }, - "title": { - "description": "*title** is a text title of proposal. Non unique.", - "type": "string" - } - }, - "additionalProperties": false - }, - "ChannelOrdering": { - "type": "string", - "enum": [ - "ORDER_ORDERED", - "ORDER_UNORDERED" - ] - }, - "ClearAdminProposal": { - "description": "Deprecated. SudoContractProposal defines the struct for clear admin proposal.", - "deprecated": true, - "type": "object", - "required": [ - "contract", - "description", - "title" - ], - "properties": { - "contract": { - "description": "*contract** is an address of contract admin will be removed.", - "type": "string" - }, - "description": { - "description": "*description** is a text description of proposal.", - "type": "string" - }, - "title": { - "description": "*title** is a text title of proposal.", - "type": "string" - } - }, - "additionalProperties": false - }, - "ClientUpdateProposal": { - "description": "ClientUpdateProposal defines the struct for client update proposal.", - "deprecated": true, - "type": "object", - "required": [ - "description", - "subject_client_id", - "substitute_client_id", - "title" - ], - "properties": { - "description": { - "description": "*description** is a text description of proposal. Non unique.", - "type": "string" - }, - "subject_client_id": { - "description": "*subject_client_id** is a subject client id.", - "type": "string" - }, - "substitute_client_id": { - "description": "*substitute_client_id** is a substitute client id.", - "type": "string" - }, - "title": { - "description": "*title** is a text title of proposal.", - "type": "string" - } - }, - "additionalProperties": false - }, - "Coin": { - "type": "object", - "required": [ - "amount", - "denom" - ], - "properties": { - "amount": { - "$ref": "#/definitions/Uint128" - }, - "denom": { - "type": "string" - } - }, - "additionalProperties": false - }, - "DenomUnit": { - "description": "Replicates the cosmos-sdk bank module DenomUnit type", - "type": "object", - "required": [ - "aliases", - "denom", - "exponent" - ], - "properties": { - "aliases": { - "type": "array", - "items": { - "type": "string" - } - }, - "denom": { - "type": "string" - }, - "exponent": { - "type": "integer", - "format": "uint32", - "minimum": 0.0 - } - }, - "additionalProperties": false - }, - "DepositOptions": { - "type": "object", - "properties": { - "disable_autoswap": { - "type": [ - "boolean", - "null" - ] - }, - "fail_tx_on_bel": { - "type": [ - "boolean", - "null" - ] - } - }, - "additionalProperties": false - }, - "DexMsg": { - "oneOf": [ - { - "description": "Deposit provides liquidity to a specific trading pair by depositing tokens at a specific price into one or both sides of the pair in “a liquidity pool”", - "type": "object", - "required": [ - "deposit" - ], - "properties": { - "deposit": { - "type": "object", - "required": [ - "amounts_a", - "amounts_b", - "fees", - "options", - "receiver", - "tick_indexes_a_to_b", - "token_a", - "token_b" - ], - "properties": { - "amounts_a": { - "description": "Amounts of tokenA to deposit", - "type": "array", - "items": { - "$ref": "#/definitions/Uint128" - } - }, - "amounts_b": { - "description": "Amounts of tokenB to deposit", - "type": "array", - "items": { - "$ref": "#/definitions/Uint128" - } - }, - "fees": { - "description": "Fees to use for each deposit", - "type": "array", - "items": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - } - }, - "options": { - "description": "Additional deposit options", - "type": "array", - "items": { - "$ref": "#/definitions/DepositOptions" - } - }, - "receiver": { - "description": "The account to which PoolShares will be issued", - "type": "string" - }, - "tick_indexes_a_to_b": { - "description": "Tick indexes to deposit at defined in terms of TokenA to TokenB (ie. TokenA is on the left)", - "type": "array", - "items": { - "type": "integer", - "format": "int64" - } - }, - "token_a": { - "description": "Denom for one side of the deposit", - "type": "string" - }, - "token_b": { - "description": "Denom for the opposing side of the deposit", - "type": "string" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Withdraw is used to redeem PoolShares for the user’s pro-rata portion of tokens within a liquidity pool. Users can withdraw from a pool at any time", - "type": "object", - "required": [ - "withdrawal" - ], - "properties": { - "withdrawal": { - "type": "object", - "required": [ - "fees", - "receiver", - "shares_to_remove", - "tick_indexes_a_to_b", - "token_a", - "token_b" - ], - "properties": { - "fees": { - "description": "Fee for the target LiquidityPools", - "type": "array", - "items": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - } - }, - "receiver": { - "description": "The account to which the tokens are credited", - "type": "string" - }, - "shares_to_remove": { - "description": "Amount of shares to remove from each pool", - "type": "array", - "items": { - "$ref": "#/definitions/Uint128" - } - }, - "tick_indexes_a_to_b": { - "description": "Tick indexes of the target LiquidityPools defined in terms of TokenA to TokenB (ie. TokenA is on the left)", - "type": "array", - "items": { - "type": "integer", - "format": "int64" - } - }, - "token_a": { - "description": "Denom for one side of the deposit", - "type": "string" - }, - "token_b": { - "description": "Denom for the opposing side of the deposit", - "type": "string" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "PlaceLimitOrder provides the primary mechanism for trading on the Duality Dex. Limit orders can provide liquidity to the Dex (“Maker Limit Orders”) and/or can be used to trade against preexisting liquidity (“Taker Limit Orders”)", - "type": "object", - "required": [ - "place_limit_order" - ], - "properties": { - "place_limit_order": { - "type": "object", - "required": [ - "amount_in", - "limit_sell_price", - "order_type", - "receiver", - "tick_index_in_to_out", - "token_in", - "token_out" - ], - "properties": { - "amount_in": { - "description": "Amount of TokenIn to be traded", - "allOf": [ - { - "$ref": "#/definitions/Uint128" - } - ] - }, - "expiration_time": { - "description": "Expiration time for order. Only valid for GOOD_TIL_TIME limit orders", - "type": [ - "integer", - "null" - ], - "format": "uint64", - "minimum": 0.0 - }, - "limit_sell_price": { - "description": "Accepts standard decimals and decimals with scientific notation (ie. 1234.23E-7)", - "type": "string" - }, - "max_amount_out": { - "description": "Maximum amount of TokenB can be bought. For everything except JUST_IN_TIME OrderType", - "anyOf": [ - { - "$ref": "#/definitions/Uint128" - }, - { - "type": "null" - } - ] - }, - "order_type": { - "description": "Type of limit order to be used. Must be one of: GOOD_TIL_CANCELLED, FILL_OR_KILL, IMMEDIATE_OR_CANCEL, JUST_IN_TIME, or GOOD_TIL_TIME", - "allOf": [ - { - "$ref": "#/definitions/LimitOrderType" - } - ] - }, - "receiver": { - "description": "Account to which TokenOut is credited or that will be allowed to withdraw or cancel a maker order", - "type": "string" - }, - "tick_index_in_to_out": { - "description": "Limit tick for a limit order, specified in terms of TokenIn to TokenOut", - "type": "integer", - "format": "int64" - }, - "token_in": { - "description": "Token being “sold”", - "type": "string" - }, - "token_out": { - "description": "Token being “bought”", - "type": "string" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "WithdrawFilledLimitOrder. Once a limit order has been filled – either partially or in its entirety, it can be withdrawn at any time. Withdrawing from a limit order credits all available proceeds to the user. Withdraw can be called on a limit order multiple times as new proceeds become available", - "type": "object", - "required": [ - "withdraw_filled_limit_order" - ], - "properties": { - "withdraw_filled_limit_order": { - "type": "object", - "required": [ - "tranche_key" - ], - "properties": { - "tranche_key": { - "description": "TrancheKey for the target limit order", - "type": "string" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "CancelLimitOrder. Standard Taker limit orders (Good-til-cancelled & Good-til-Time) can be canceled at any time if they have not been completely filled", - "type": "object", - "required": [ - "cancel_limit_order" - ], - "properties": { - "cancel_limit_order": { - "type": "object", - "required": [ - "tranche_key" - ], - "properties": { - "tranche_key": { - "description": "TrancheKey for the target limit order", - "type": "string" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "MultiHopSwap provides a swapping mechanism to achieve better prices by routing through a series of pools", - "type": "object", - "required": [ - "multi_hop_swap" - ], - "properties": { - "multi_hop_swap": { - "type": "object", - "required": [ - "amount_in", - "exit_limit_price", - "pick_best_route", - "receiver", - "routes" - ], - "properties": { - "amount_in": { - "description": "Amount of TokenIn to swap", - "allOf": [ - { - "$ref": "#/definitions/Uint128" - } - ] - }, - "exit_limit_price": { - "description": "Minimum price that that must be satisfied for a route to succeed", - "allOf": [ - { - "$ref": "#/definitions/PrecDec" - } - ] - }, - "pick_best_route": { - "description": "If true all routes are run and the route with the best price is used", - "type": "boolean" - }, - "receiver": { - "description": "Account to which TokenOut is credited", - "type": "string" - }, - "routes": { - "description": "Array of possible routes", - "type": "array", - "items": { - "$ref": "#/definitions/MultiHopRoute" - } - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - } - ] - }, - "IbcFee": { - "description": "IbcFee defines struct for fees that refund the relayer for `SudoMsg` messages submission. Unused fee kind will be returned back to message sender. Please refer to these links for more information: IBC transaction structure - General mechanics of fee payments - ", - "type": "object", - "required": [ - "ack_fee", - "recv_fee", - "timeout_fee" - ], - "properties": { - "ack_fee": { - "description": "*ack_fee** is an amount of coins to refund relayer for submitting ack message for a particular IBC packet.", - "type": "array", - "items": { - "$ref": "#/definitions/Coin" - } - }, - "recv_fee": { - "description": "**recv_fee** currently is used for compatibility with ICS-29 interface only and must be set to zero (i.e. 0untrn), because Neutron's fee module can't refund relayer for submission of Recv IBC packets due to compatibility with target chains.", - "type": "array", - "items": { - "$ref": "#/definitions/Coin" - } - }, - "timeout_fee": { - "description": "*timeout_fee** amount of coins to refund relayer for submitting timeout message for a particular IBC packet.", - "type": "array", - "items": { - "$ref": "#/definitions/Coin" - } - } - }, - "additionalProperties": false - }, - "KVKey": { - "description": "Describes a KV key for which you want to get value from the storage on remote chain", - "type": "object", - "required": [ - "key", - "path" - ], - "properties": { - "key": { - "description": "*key** is a key you want to read from the storage", - "allOf": [ - { - "$ref": "#/definitions/Binary" - } - ] - }, - "path": { - "description": "*path** is a path to the storage (storage prefix) where you want to read value by key (usually name of cosmos-packages module: 'staking', 'bank', etc.)", - "type": "string" - } - }, - "additionalProperties": false - }, - "LimitOrderType": { - "oneOf": [ - { - "description": "Good-til-Cancelled limit orders are hybrid maker and taker limit orders. They will attempt to trade the supplied AmountIn at the TickIndex or better. However, if they total AmountIn cannot be traded at the limit price they are remaining amount will be placed as a maker limit order. The proceeds from the taker portion are deposited into the user’s account immediately, however, the proceeds from the maker portion must be explicitly withdrawn via WithdrawLimitOrder.", - "type": "string", - "enum": [ - "GOOD_TIL_CANCELLED" - ] - }, - { - "description": "Fill-or-Kill limit orders are taker limit orders that either successfully swap 100% of the supplied AmountIn or return an error. If there is insufficient liquidity to complete the trade at or above the supplied TickIndex a Fill-or-Kill order will return an error `codespace: dex, code: 1134` ( ErrGoodTilOrderWithoutExpiration).", - "type": "string", - "enum": [ - "FILL_OR_KILL" - ] - }, - { - "description": "Immediate-or-Cancel limit orders are taker orders that will swap as much as of the AmountIn as possible given available liquidity above the supplied TickIndex. Unlike Fill-or-Kill orders they will still successfully complete even if they are only able to partially trade through the AmountIn at the TickIndex or better.", - "type": "string", - "enum": [ - "IMMEDIATE_OR_CANCEL" - ] - }, - { - "description": "Just-in-Time limit orders are an advanced maker limit order that provides tradeable liquidity for exactly one block. At the end of the same block in which the Just-in-Time order was submitted the order is canceled and any untraded portion will no longer be usable as active liquidity.", - "type": "string", - "enum": [ - "JUST_IN_TIME" - ] - }, - { - "description": "Good-til-Time limit order function exactly the same as Good-til-Cancelled limit orders first trying to trade as a taker limit order and then placing any remaining amount as a maker limit order. However, the maker portion of the limit order has a specified ExpirationTime. After the ExpirationTime the order will be cancelled and can no longer be traded against. When withdrawing a Good-til-Time limit order the user will receive both the successfully traded portion of the limit order (TokenOut) as well as any remaining untraded amount (TokenIn).", - "type": "string", - "enum": [ - "GOOD_TIL_TIME" - ] - } - ] - }, - "MsgExecuteContract": { - "description": "MsgExecuteContract defines a call to the contract execution", - "type": "object", - "required": [ - "contract", - "msg" - ], - "properties": { - "contract": { - "description": "*contract** is a contract address that will be called", - "type": "string" - }, - "msg": { - "description": "*msg** is a contract call message", - "type": "string" - } - }, - "additionalProperties": false - }, - "MultiHopRoute": { - "type": "object", - "required": [ - "hops" - ], - "properties": { - "hops": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "additionalProperties": false - }, - "ParamChange": { - "description": "ParamChange defines the struct for parameter change request.", - "type": "object", - "required": [ - "key", - "subspace", - "value" - ], - "properties": { - "key": { - "description": "*key** is a name of parameter. Unique for subspace.", - "type": "string" - }, - "subspace": { - "description": "*subspace** is a key of module to which the parameter to change belongs. Unique for each module.", - "type": "string" - }, - "value": { - "description": "*value** is a new value for given parameter. Non unique.", - "type": "string" - } - }, - "additionalProperties": false - }, - "ParamChangeProposal": { - "description": "ParamChangeProposal defines the struct for single parameter change proposal.", - "type": "object", - "required": [ - "description", - "param_changes", - "title" - ], - "properties": { - "description": { - "description": "*description** is a text description of proposal. Non unique.", - "type": "string" - }, - "param_changes": { - "description": "*param_changes** is a vector of params to be changed. Non unique.", - "type": "array", - "items": { - "$ref": "#/definitions/ParamChange" - } - }, - "title": { - "description": "*title** is a text title of proposal. Non unique.", - "type": "string" - } - }, - "additionalProperties": false - }, - "PinCodesProposal": { - "description": "Deprecated. PinCodesProposal defines the struct for pin contract codes proposal.", - "deprecated": true, - "type": "object", - "required": [ - "code_ids", - "description", - "title" - ], - "properties": { - "code_ids": { - "description": "*code_ids** is an array of codes to be pined.", - "type": "array", - "items": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - } - }, - "description": { - "description": "*description** is a text description of proposal.", - "type": "string" - }, - "title": { - "description": "*title** is a text title of proposal.", - "type": "string" - } - }, - "additionalProperties": false - }, - "Plan": { - "description": "Plan defines the struct for planned upgrade.", - "type": "object", - "required": [ - "height", - "info", - "name" - ], - "properties": { - "height": { - "description": "*height** is a height at which the upgrade must be performed", - "type": "integer", - "format": "int64" - }, - "info": { - "description": "*info** is any application specific upgrade info to be included on-chain", - "type": "string" - }, - "name": { - "description": "*name** is a name for the upgrade", - "type": "string" - } - }, - "additionalProperties": false - }, - "PrecDec": { - "type": "object", - "required": [ - "i" - ], - "properties": { - "i": { - "type": "string" - } - }, - "additionalProperties": false - }, - "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" - } - }, - "additionalProperties": false - }, - "ProtobufAny": { - "description": "Type for wrapping any protobuf message", - "type": "object", - "required": [ - "type_url", - "value" - ], - "properties": { - "type_url": { - "description": "*type_url** describes the type of the serialized message", - "type": "string" - }, - "value": { - "description": "*value** must be a valid serialized protocol buffer of the above specified type", - "allOf": [ - { - "$ref": "#/definitions/Binary" - } - ] - } - }, - "additionalProperties": false - }, - "RequestPacketTimeoutHeight": { - "type": "object", - "properties": { - "revision_height": { - "type": [ - "integer", - "null" - ], - "format": "uint64", - "minimum": 0.0 - }, - "revision_number": { - "type": [ - "integer", - "null" - ], - "format": "uint64", - "minimum": 0.0 - } - }, - "additionalProperties": false - }, - "SoftwareUpgradeProposal": { - "description": "Deprecated. SoftwareUpgradeProposal defines the struct for software upgrade proposal.", - "deprecated": true, - "type": "object", - "required": [ - "description", - "plan", - "title" - ], - "properties": { - "description": { - "description": "*description** is a text description of proposal. Non unique.", - "type": "string" - }, - "plan": { - "description": "*plan** is a plan of upgrade.", - "allOf": [ - { - "$ref": "#/definitions/Plan" - } - ] - }, - "title": { - "description": "*title** is a text title of proposal. Non unique.", - "type": "string" - } - }, - "additionalProperties": false - }, - "SudoContractProposal": { - "description": "Deprecated. SudoContractProposal defines the struct for sudo execution proposal.", - "deprecated": true, - "type": "object", - "required": [ - "contract", - "description", - "msg", - "title" - ], - "properties": { - "contract": { - "description": "*contract** is an address of contract to be executed.", - "type": "string" - }, - "description": { - "description": "*description** is a text description of proposal.", - "type": "string" - }, - "msg": { - "description": "**msg*** is a sudo message.", - "allOf": [ - { - "$ref": "#/definitions/Binary" - } - ] - }, - "title": { - "description": "*title** is a text title of proposal.", - "type": "string" - } - }, - "additionalProperties": false - }, - "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" - }, - "UnpinCodesProposal": { - "description": "Deprecated. UnpinCodesProposal defines the struct for unpin contract codes proposal.", - "deprecated": true, - "type": "object", - "required": [ - "code_ids", - "description", - "title" - ], - "properties": { - "code_ids": { - "description": "*code_ids** is an array of codes to be unpined.", - "type": "array", - "items": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - } - }, - "description": { - "description": "*description** is a text description of proposal.", - "type": "string" - }, - "title": { - "description": "*title** is a text title of proposal.", - "type": "string" - } - }, - "additionalProperties": false - }, - "UpdateAdminProposal": { - "description": "Deprecated. UpdateAdminProposal defines the struct for update admin proposal.", - "deprecated": true, - "type": "object", - "required": [ - "contract", - "description", - "new_admin", - "title" - ], - "properties": { - "contract": { - "description": "*contract** is an address of contract to update admin.", - "type": "string" - }, - "description": { - "description": "*description** is a text description of proposal.", - "type": "string" - }, - "new_admin": { - "description": "**new_admin*** is an address of new admin", - "type": "string" - }, - "title": { - "description": "*title** is a text title of proposal.", - "type": "string" - } - }, - "additionalProperties": false - }, - "UpgradeProposal": { - "description": "UpgradeProposal defines the struct for IBC upgrade proposal.", - "deprecated": true, - "type": "object", - "required": [ - "description", - "plan", - "title", - "upgraded_client_state" - ], - "properties": { - "description": { - "description": "*description** is a text description of proposal.", - "type": "string" - }, - "plan": { - "description": "*plan** is a plan of upgrade.", - "allOf": [ - { - "$ref": "#/definitions/Plan" - } - ] - }, - "title": { - "description": "*title** is a text title of proposal.", - "type": "string" - }, - "upgraded_client_state": { - "description": "*upgraded_client_state** is an upgraded client state.", - "allOf": [ - { - "$ref": "#/definitions/ProtobufAny" - } - ] - } - }, - "additionalProperties": false - } - } -} diff --git a/packages/neutron-sdk/schema/neutron_query.json b/packages/neutron-sdk/schema/neutron_query.json deleted file mode 100644 index 48a911b0..00000000 --- a/packages/neutron-sdk/schema/neutron_query.json +++ /dev/null @@ -1,1139 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "NeutronQuery", - "description": "The queries to interact with neutron specific blockchain modules.", - "oneOf": [ - { - "description": "Query a result of registered interchain query on remote chain", - "type": "object", - "required": [ - "interchain_query_result" - ], - "properties": { - "interchain_query_result": { - "type": "object", - "required": [ - "query_id" - ], - "properties": { - "query_id": { - "description": "*query_id** is an ID registered interchain query", - "type": "integer", - "format": "uint64", - "minimum": 0.0 - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Query a registered interchain account address for a specific connection_id Every contract may have as many interchain accounts as necessary.", - "type": "object", - "required": [ - "interchain_account_address" - ], - "properties": { - "interchain_account_address": { - "type": "object", - "required": [ - "connection_id", - "interchain_account_id", - "owner_address" - ], - "properties": { - "connection_id": { - "description": "*connection_id** is an IBC connection identifier between Neutron and remote chain", - "type": "string" - }, - "interchain_account_id": { - "description": "**interchain_account_id** is an identifier of your interchain account. Can be any string This identifier allows contracts to have multiple interchain accounts on remote chains", - "type": "string" - }, - "owner_address": { - "description": "*owner_address** is an address of contract which registered interchain account", - "type": "string" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Query all registered interchain queries on all remote chains", - "type": "object", - "required": [ - "registered_interchain_queries" - ], - "properties": { - "registered_interchain_queries": { - "type": "object", - "required": [ - "connection_id", - "owners", - "pagination" - ], - "properties": { - "connection_id": { - "type": "string" - }, - "owners": { - "type": "array", - "items": { - "type": "string" - } - }, - "pagination": { - "$ref": "#/definitions/PageRequest" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Query registered interchain query with a specific query_id", - "type": "object", - "required": [ - "registered_interchain_query" - ], - "properties": { - "registered_interchain_query": { - "type": "object", - "required": [ - "query_id" - ], - "properties": { - "query_id": { - "description": "*query_id** is an ID registered interchain query", - "type": "integer", - "format": "uint64", - "minimum": 0.0 - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Query total amount of burned neutron fees", - "type": "object", - "required": [ - "total_burned_neutrons_amount" - ], - "properties": { - "total_burned_neutrons_amount": { - "type": "object", - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Query minimum IBC fee", - "type": "object", - "required": [ - "min_ibc_fee" - ], - "properties": { - "min_ibc_fee": { - "type": "object", - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "TokenFactory query. Given a subdenom minted by a contract via [`NeutronMsg::MintTokens`](crate::bindings::msg::NeutronMsg::MintTokens), returns the full denom as used by [`BankMsg::Send`](cosmwasm_std::BankMsg::Send).", - "type": "object", - "required": [ - "full_denom" - ], - "properties": { - "full_denom": { - "type": "object", - "required": [ - "creator_addr", - "subdenom" - ], - "properties": { - "creator_addr": { - "type": "string" - }, - "subdenom": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "TokenFactory query. Returns the admin of a denom, if the denom is a TokenFactory denom.", - "type": "object", - "required": [ - "denom_admin" - ], - "properties": { - "denom_admin": { - "type": "object", - "required": [ - "subdenom" - ], - "properties": { - "subdenom": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "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 - } - }, - "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 - } - }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "dex" - ], - "properties": { - "dex": { - "$ref": "#/definitions/DexQuery" - } - }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "market_map" - ], - "properties": { - "market_map": { - "$ref": "#/definitions/MarketMapQuery" - } - }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "oracle" - ], - "properties": { - "oracle": { - "$ref": "#/definitions/OracleQuery" - } - }, - "additionalProperties": false - } - ], - "definitions": { - "Binary": { - "description": "Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec. See also .", - "type": "string" - }, - "CurrencyPair": { - "type": "object", - "required": [ - "Base", - "Quote" - ], - "properties": { - "Base": { - "type": "string" - }, - "Quote": { - "type": "string" - } - }, - "additionalProperties": false - }, - "DexQuery": { - "oneOf": [ - { - "description": "Parameters queries the parameters of the module.", - "type": "object", - "required": [ - "params" - ], - "properties": { - "params": { - "type": "object", - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Queries a LimitOrderTrancheUser by index.", - "type": "object", - "required": [ - "limit_order_tranche_user" - ], - "properties": { - "limit_order_tranche_user": { - "type": "object", - "required": [ - "address", - "tranche_key" - ], - "properties": { - "address": { - "type": "string" - }, - "tranche_key": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Queries a list of LimitOrderTrancheMap items.", - "type": "object", - "required": [ - "limit_order_tranche_user_all" - ], - "properties": { - "limit_order_tranche_user_all": { - "type": "object", - "properties": { - "pagination": { - "anyOf": [ - { - "$ref": "#/definitions/PageRequest" - }, - { - "type": "null" - } - ] - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Queries a list of LimitOrderTrancheUser items for a given address.", - "type": "object", - "required": [ - "limit_order_tranche_user_all_by_address" - ], - "properties": { - "limit_order_tranche_user_all_by_address": { - "type": "object", - "required": [ - "address" - ], - "properties": { - "address": { - "type": "string" - }, - "pagination": { - "anyOf": [ - { - "$ref": "#/definitions/PageRequest" - }, - { - "type": "null" - } - ] - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Queries a LimitOrderTranche by index.", - "type": "object", - "required": [ - "limit_order_tranche" - ], - "properties": { - "limit_order_tranche": { - "type": "object", - "required": [ - "pair_id", - "tick_index", - "token_in", - "tranche_key" - ], - "properties": { - "pair_id": { - "type": "string" - }, - "tick_index": { - "type": "integer", - "format": "int64" - }, - "token_in": { - "type": "string" - }, - "tranche_key": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Queries a list of LimitOrderTranche items for a given pairID / TokenIn combination.", - "type": "object", - "required": [ - "limit_order_tranche_all" - ], - "properties": { - "limit_order_tranche_all": { - "type": "object", - "required": [ - "pair_id", - "token_in" - ], - "properties": { - "pagination": { - "anyOf": [ - { - "$ref": "#/definitions/PageRequest" - }, - { - "type": "null" - } - ] - }, - "pair_id": { - "type": "string" - }, - "token_in": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Queries a list of UserDeposits items.", - "type": "object", - "required": [ - "user_deposit_all" - ], - "properties": { - "user_deposit_all": { - "type": "object", - "required": [ - "address", - "include_pool_data" - ], - "properties": { - "address": { - "type": "string" - }, - "include_pool_data": { - "type": "boolean" - }, - "pagination": { - "anyOf": [ - { - "$ref": "#/definitions/PageRequest" - }, - { - "type": "null" - } - ] - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Queries a list of TickLiquidity items.", - "type": "object", - "required": [ - "tick_liquidity_all" - ], - "properties": { - "tick_liquidity_all": { - "type": "object", - "required": [ - "pair_id", - "token_in" - ], - "properties": { - "pagination": { - "anyOf": [ - { - "$ref": "#/definitions/PageRequest" - }, - { - "type": "null" - } - ] - }, - "pair_id": { - "type": "string" - }, - "token_in": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Queries a InactiveLimitOrderTranche by index.", - "type": "object", - "required": [ - "inactive_limit_order_tranche" - ], - "properties": { - "inactive_limit_order_tranche": { - "type": "object", - "required": [ - "pair_id", - "tick_index", - "token_in", - "tranche_key" - ], - "properties": { - "pair_id": { - "type": "string" - }, - "tick_index": { - "type": "integer", - "format": "int64" - }, - "token_in": { - "type": "string" - }, - "tranche_key": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Queries a list of InactiveLimitOrderTranche items.", - "type": "object", - "required": [ - "inactive_limit_order_tranche_all" - ], - "properties": { - "inactive_limit_order_tranche_all": { - "type": "object", - "properties": { - "pagination": { - "anyOf": [ - { - "$ref": "#/definitions/PageRequest" - }, - { - "type": "null" - } - ] - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Queries a list of PoolReserves items.", - "type": "object", - "required": [ - "pool_reserves_all" - ], - "properties": { - "pool_reserves_all": { - "type": "object", - "required": [ - "pair_id", - "token_in" - ], - "properties": { - "pagination": { - "anyOf": [ - { - "$ref": "#/definitions/PageRequest" - }, - { - "type": "null" - } - ] - }, - "pair_id": { - "type": "string" - }, - "token_in": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Queries a PoolReserve by index", - "type": "object", - "required": [ - "pool_reserves" - ], - "properties": { - "pool_reserves": { - "type": "object", - "required": [ - "fee", - "pair_id", - "tick_index", - "token_in" - ], - "properties": { - "fee": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - }, - "pair_id": { - "type": "string" - }, - "tick_index": { - "type": "integer", - "format": "int64" - }, - "token_in": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Queries the simulated result of a multihop swap", - "type": "object", - "required": [ - "estimate_multi_hop_swap" - ], - "properties": { - "estimate_multi_hop_swap": { - "type": "object", - "required": [ - "amount_in", - "creator", - "exit_limit_price", - "pick_best_route", - "receiver", - "routes" - ], - "properties": { - "amount_in": { - "$ref": "#/definitions/Int128" - }, - "creator": { - "type": "string" - }, - "exit_limit_price": { - "$ref": "#/definitions/PrecDec" - }, - "pick_best_route": { - "type": "boolean" - }, - "receiver": { - "type": "string" - }, - "routes": { - "type": "array", - "items": { - "$ref": "#/definitions/MultiHopRoute" - } - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Queries the simulated result of a PlaceLimit order", - "type": "object", - "required": [ - "estimate_place_limit_order" - ], - "properties": { - "estimate_place_limit_order": { - "type": "object", - "required": [ - "amount_in", - "creator", - "order_type", - "receiver", - "tick_index_in_to_out", - "token_in", - "token_out" - ], - "properties": { - "amount_in": { - "$ref": "#/definitions/Int128" - }, - "creator": { - "type": "string" - }, - "expiration_time": { - "type": [ - "integer", - "null" - ], - "format": "uint64", - "minimum": 0.0 - }, - "max_amount_out": { - "anyOf": [ - { - "$ref": "#/definitions/Int128" - }, - { - "type": "null" - } - ] - }, - "order_type": { - "$ref": "#/definitions/LimitOrderType" - }, - "receiver": { - "type": "string" - }, - "tick_index_in_to_out": { - "type": "integer", - "format": "int64" - }, - "token_in": { - "type": "string" - }, - "token_out": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Queries a pool by pair, tick and fee", - "type": "object", - "required": [ - "pool" - ], - "properties": { - "pool": { - "type": "object", - "required": [ - "fee", - "pair_id", - "tick_index" - ], - "properties": { - "fee": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - }, - "pair_id": { - "type": "string" - }, - "tick_index": { - "type": "integer", - "format": "int64" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Queries a pool by ID", - "type": "object", - "required": [ - "pool_by_id" - ], - "properties": { - "pool_by_id": { - "type": "object", - "required": [ - "pool_id" - ], - "properties": { - "pool_id": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Queries a PoolMetadata by ID", - "type": "object", - "required": [ - "pool_metadata" - ], - "properties": { - "pool_metadata": { - "type": "object", - "required": [ - "id" - ], - "properties": { - "id": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Queries a list of PoolMetadata items.", - "type": "object", - "required": [ - "pool_metadata_all" - ], - "properties": { - "pool_metadata_all": { - "type": "object", - "properties": { - "pagination": { - "anyOf": [ - { - "$ref": "#/definitions/PageRequest" - }, - { - "type": "null" - } - ] - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - } - ] - }, - "Int128": { - "description": "An implementation of i128 that is using strings for JSON encoding/decoding, such that the full i128 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 `i128` to get the value out:\n\n``` # use cosmwasm_std::Int128; let a = Int128::from(258i128); assert_eq!(a.i128(), 258); ```", - "type": "string" - }, - "LimitOrderType": { - "oneOf": [ - { - "description": "Good-til-Cancelled limit orders are hybrid maker and taker limit orders. They will attempt to trade the supplied AmountIn at the TickIndex or better. However, if they total AmountIn cannot be traded at the limit price they are remaining amount will be placed as a maker limit order. The proceeds from the taker portion are deposited into the user’s account immediately, however, the proceeds from the maker portion must be explicitly withdrawn via WithdrawLimitOrder.", - "type": "string", - "enum": [ - "GOOD_TIL_CANCELLED" - ] - }, - { - "description": "Fill-or-Kill limit orders are taker limit orders that either successfully swap 100% of the supplied AmountIn or return an error. If there is insufficient liquidity to complete the trade at or above the supplied TickIndex a Fill-or-Kill order will return an error `codespace: dex, code: 1134` ( ErrGoodTilOrderWithoutExpiration).", - "type": "string", - "enum": [ - "FILL_OR_KILL" - ] - }, - { - "description": "Immediate-or-Cancel limit orders are taker orders that will swap as much as of the AmountIn as possible given available liquidity above the supplied TickIndex. Unlike Fill-or-Kill orders they will still successfully complete even if they are only able to partially trade through the AmountIn at the TickIndex or better.", - "type": "string", - "enum": [ - "IMMEDIATE_OR_CANCEL" - ] - }, - { - "description": "Just-in-Time limit orders are an advanced maker limit order that provides tradeable liquidity for exactly one block. At the end of the same block in which the Just-in-Time order was submitted the order is canceled and any untraded portion will no longer be usable as active liquidity.", - "type": "string", - "enum": [ - "JUST_IN_TIME" - ] - }, - { - "description": "Good-til-Time limit order function exactly the same as Good-til-Cancelled limit orders first trying to trade as a taker limit order and then placing any remaining amount as a maker limit order. However, the maker portion of the limit order has a specified ExpirationTime. After the ExpirationTime the order will be cancelled and can no longer be traded against. When withdrawing a Good-til-Time limit order the user will receive both the successfully traded portion of the limit order (TokenOut) as well as any remaining untraded amount (TokenIn).", - "type": "string", - "enum": [ - "GOOD_TIL_TIME" - ] - } - ] - }, - "MarketMapQuery": { - "oneOf": [ - { - "description": "Parameters queries the parameters of the module.", - "type": "object", - "required": [ - "params" - ], - "properties": { - "params": { - "type": "object", - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "last_updated" - ], - "properties": { - "last_updated": { - "type": "object", - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "market_map" - ], - "properties": { - "market_map": { - "type": "object", - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "market" - ], - "properties": { - "market": { - "type": "object", - "required": [ - "currency_pair" - ], - "properties": { - "currency_pair": { - "$ref": "#/definitions/CurrencyPair" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - } - ] - }, - "MultiHopRoute": { - "type": "object", - "required": [ - "hops" - ], - "properties": { - "hops": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "additionalProperties": false - }, - "OracleQuery": { - "oneOf": [ - { - "type": "object", - "required": [ - "get_all_currency_pairs" - ], - "properties": { - "get_all_currency_pairs": { - "type": "object", - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "get_price" - ], - "properties": { - "get_price": { - "type": "object", - "required": [ - "currency_pair" - ], - "properties": { - "currency_pair": { - "$ref": "#/definitions/CurrencyPair" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "get_prices" - ], - "properties": { - "get_prices": { - "type": "object", - "required": [ - "currency_pair_ids" - ], - "properties": { - "currency_pair_ids": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - } - ] - }, - "PageRequest": { - "type": "object", - "required": [ - "count_total", - "key", - "limit", - "offset", - "reverse" - ], - "properties": { - "count_total": { - "description": "**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.", - "type": "boolean" - }, - "key": { - "description": "**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.", - "allOf": [ - { - "$ref": "#/definitions/Binary" - } - ] - }, - "limit": { - "description": "**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.", - "type": "integer", - "format": "uint64", - "minimum": 0.0 - }, - "offset": { - "description": "**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.", - "type": "integer", - "format": "uint64", - "minimum": 0.0 - }, - "reverse": { - "description": "reverse is set to true if results are to be returned in the descending order.", - "type": "boolean" - } - }, - "additionalProperties": false - }, - "PrecDec": { - "type": "object", - "required": [ - "i" - ], - "properties": { - "i": { - "type": "string" - } - }, - "additionalProperties": false - } - } -} diff --git a/packages/neutron-sdk/src/bin/neutron-sdk-schema.rs b/packages/neutron-sdk/src/bin/neutron-sdk-schema.rs deleted file mode 100644 index 31ce2532..00000000 --- a/packages/neutron-sdk/src/bin/neutron-sdk-schema.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - // TODO: remove this file -} diff --git a/packages/neutron-sdk/src/bindings/msg.rs b/packages/neutron-sdk/src/bindings/msg.rs index 092231e0..23ed7465 100644 --- a/packages/neutron-sdk/src/bindings/msg.rs +++ b/packages/neutron-sdk/src/bindings/msg.rs @@ -1,13 +1,7 @@ -use crate::{ - bindings::types::ProtobufAny, - interchain_queries::types::{QueryPayload, QueryType, TransactionFilterItem}, - sudo::msg::RequestPacketTimeoutHeight, - NeutronResult, -}; -use cosmwasm_std::{Binary, Coin, CosmosMsg, CustomMsg, DenomUnit, StdError, Uint128}; +use cosmwasm_std::{Binary, Coin, CosmosMsg, CustomMsg}; +use neutron_std::shim::Any; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; -use serde_json_wasm::to_string; #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] /// IbcFee defines struct for fees that refund the relayer for `SudoMsg` messages submission. @@ -226,7 +220,8 @@ pub struct UpgradeProposal { /// **plan** is a plan of upgrade. pub plan: Plan, /// **upgraded_client_state** is an upgraded client state. - pub upgraded_client_state: ProtobufAny, + // TODO: correct? + pub upgraded_client_state: Any, } #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] diff --git a/packages/neutron-sdk/src/bindings/types.rs b/packages/neutron-sdk/src/bindings/types.rs index 791731d7..3c92fe92 100644 --- a/packages/neutron-sdk/src/bindings/types.rs +++ b/packages/neutron-sdk/src/bindings/types.rs @@ -1,10 +1,8 @@ -use cosmwasm_std::{Binary, Coin}; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use std::fmt::Write as _; -use crate::interchain_queries::types::QueryType; - +// TODO: do we need it? /// Encodes bytes slice into hex string pub fn encode_hex(bytes: &[u8]) -> String { let mut s = String::with_capacity(bytes.len() * 2); @@ -14,6 +12,7 @@ pub fn encode_hex(bytes: &[u8]) -> String { s } +// TODO: do we need it? /// Decodes hex string into bytes vec pub fn decode_hex(s: &str) -> Option> { (0..s.len()) @@ -22,40 +21,6 @@ pub fn decode_hex(s: &str) -> Option> { .collect() } -// #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -// #[serde(rename_all = "snake_case")] -// pub struct RegisteredQuery { -// /// The unique id of the registered query. -// pub id: u64, -// /// The address that registered the query. -// pub owner: String, -// /// The KV-storage keys for which we want to get values from remote chain -// pub keys: Vec, -// /// The query type identifier (i.e. 'kv' or 'tx' for now) -// pub query_type: QueryType, -// /// The filter for transaction search ICQ -// pub transactions_filter: String, -// /// The IBC connection ID for getting ConsensusState to verify proofs. -// pub connection_id: String, -// /// Parameter that defines how often the query must be updated. -// pub update_period: u64, -// /// The local chain last block height when the query result was updated. -// #[serde(default)] -// pub last_submitted_result_local_height: u64, -// /// The remote chain last block height when the query result was updated. -// #[serde(default)] -// pub last_submitted_result_remote_height: Height, -// /// Amount of coins deposited for the query. -// #[serde(default)] -// pub deposit: Vec, -// /// Timeout before query becomes available for everybody to remove. -// #[serde(default)] -// pub submit_timeout: u64, -// /// The local chain height when the query was registered. -// #[serde(default)] -// pub registered_at_height: u64, -// } - #[derive(Default, Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] #[serde(rename_all = "snake_case")] pub struct Height { @@ -66,188 +31,3 @@ pub struct Height { #[serde(default)] pub revision_height: u64, } - -/// InterchainQueryResult is a result data for a registered query -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct InterchainQueryResult { - /// **kv_results** is a raw key-value pairs of query result - pub kv_results: Vec, - - /// **height** is a height of remote chain - pub height: u64, - - #[serde(default)] - /// **revision** is a revision of remote chain - pub revision: u64, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -/// Describes value in the Cosmos-SDK KV-storage on remote chain -pub struct StorageValue { - /// **storage_prefix** is a path to the storage (storage prefix) where you want to read value by key (usually name of cosmos-packages module: 'staking', 'bank', etc.) - pub storage_prefix: String, - - /// **key** is a key under which the **value** is stored in the storage on remote chain - pub key: Binary, - - /// **value** is a value which is stored under the **key** in the storage on remote chain - 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 -pub struct ProtobufAny { - /// **type_url** describes the type of the serialized message - pub type_url: String, - - /// **value** must be a valid serialized protocol buffer of the above specified type - pub value: Binary, -} - -impl ProtobufAny { - /// Helper to create new ProtobufAny type: - /// * **type_url** describes the type of the serialized message - /// * **value** must be a valid serialized protocol buffer of the above specified type - pub fn new(type_url: String, value: Binary) -> Self { - ProtobufAny { type_url, value } - } -} - -const KV_PATH_KEY_DELIMITER: &str = "/"; -const KV_KEYS_DELIMITER: &str = ","; - -// #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -// #[serde(rename_all = "snake_case")] -// /// Describes a KV key for which you want to get value from the storage on remote chain -// pub struct KVKey { -// /// **path** is a path to the storage (storage prefix) where you want to read value by key (usually name of cosmos-packages module: 'staking', 'bank', etc.) -// pub path: String, -// -// /// **key** is a key you want to read from the storage -// pub key: Binary, -// } -// -// impl KVKey { -// /// Creates KVKey from string -// /// Returns None on failure -// pub fn from_string>(s: S) -> Option { -// let split: Vec<&str> = s.as_ref().split(KV_PATH_KEY_DELIMITER).collect(); -// if split.len() < 2 { -// return None; -// } -// -// Some(KVKey { -// path: split[0].to_string(), -// key: Binary::new(decode_hex(split[1])?), -// }) -// } -// } -// -// #[allow(clippy::from_over_into)] -// impl Into for &KVKey { -// fn into(self) -> String { -// let mut s = String::with_capacity( -// self.path.len() + KV_PATH_KEY_DELIMITER.len() + self.key.len() * 2, -// ); -// -// s.push_str(&self.path); -// s.push_str(KV_PATH_KEY_DELIMITER); -// s.push_str(&encode_hex(&self.key)); -// -// s -// } -// } -// -// /// KVKeys describes vec of KVKey structures -// pub struct KVKeys(pub Vec); -// -// impl KVKeys { -// /// Creates KVKeys from string -// /// Returns None on failure -// pub fn from_string>(s: S) -> Option { -// let split = s.as_ref().split(KV_KEYS_DELIMITER); -// -// Some(KVKeys( -// split -// .map(KVKey::from_string) -// .collect::>>()?, -// )) -// } -// } -// -// #[allow(clippy::from_over_into)] -// impl Into for KVKeys { -// fn into(self) -> String { -// self.0 -// .iter() -// .map(|kv| kv.into()) -// .collect::>() -// .join(KV_KEYS_DELIMITER) -// } -// } diff --git a/packages/neutron-sdk/src/interchain_queries/types.rs b/packages/neutron-sdk/src/interchain_queries/types.rs index ddc53a78..7225bbbf 100644 --- a/packages/neutron-sdk/src/interchain_queries/types.rs +++ b/packages/neutron-sdk/src/interchain_queries/types.rs @@ -1,7 +1,4 @@ -use crate::{ - // bindings::types::{StorageValue}, - errors::error::NeutronResult, -}; +use crate::errors::error::NeutronResult; use cosmwasm_std::{from_json, StdError, Uint128}; use neutron_std::types::neutron::interchainqueries::{KvKey, StorageValue}; use schemars::{JsonSchema, _serde_json::Value}; diff --git a/packages/neutron-sdk/src/interchain_queries/v045/helpers.rs b/packages/neutron-sdk/src/interchain_queries/v045/helpers.rs index f24fb6bc..6bdc90da 100644 --- a/packages/neutron-sdk/src/interchain_queries/v045/helpers.rs +++ b/packages/neutron-sdk/src/interchain_queries/v045/helpers.rs @@ -9,7 +9,7 @@ use crate::interchain_queries::v045::types::{ }; use crate::NeutronError; use cosmos_sdk_proto::cosmos::staking::v1beta1::Commission as ValidatorCommission; -use cosmwasm_std::{Binary, Decimal, Uint128}; +use cosmwasm_std::{Decimal, Uint128}; use neutron_std::types::neutron::interchainqueries::KvKey; use std::str::{from_utf8, FromStr}; diff --git a/packages/neutron-sdk/src/lib.rs b/packages/neutron-sdk/src/lib.rs index aae2f460..c7ba23e0 100644 --- a/packages/neutron-sdk/src/lib.rs +++ b/packages/neutron-sdk/src/lib.rs @@ -12,7 +12,6 @@ pub mod bindings; mod errors; pub mod interchain_queries; pub mod interchain_txs; -mod serde; pub mod sudo; pub use errors::error::{NeutronError, NeutronResult}; diff --git a/packages/neutron-sdk/src/serde/mod.rs b/packages/neutron-sdk/src/serde/mod.rs deleted file mode 100644 index 5461e99a..00000000 --- a/packages/neutron-sdk/src/serde/mod.rs +++ /dev/null @@ -1,104 +0,0 @@ -pub mod as_str { - use serde::{de, Deserialize, Deserializer, Serializer}; - use std::{fmt::Display, str::FromStr}; - - pub fn deserialize<'de, T, D>(deserializer: D) -> Result - where - T: FromStr, - T::Err: Display, - D: Deserializer<'de>, - { - let s = String::deserialize(deserializer)?; - T::from_str(&s).map_err(de::Error::custom) - } - - pub fn serialize(value: &T, serializer: S) -> Result - where - S: Serializer, - T: Display, - { - serializer.serialize_str(&value.to_string()) - } -} - -pub mod as_str_vec { - use serde::{de, Deserialize, Deserializer, Serialize, Serializer}; - use std::{fmt::Display, str::FromStr}; - - pub fn deserialize<'de, T, D>(deserializer: D) -> Result, D::Error> - where - T: FromStr, - T::Err: Display, - D: Deserializer<'de>, - { - let vec_of_strings: Vec = Vec::deserialize(deserializer)?; - vec_of_strings - .into_iter() - .map(|s| T::from_str(&s).map_err(de::Error::custom)) - .collect() - } - - pub fn serialize(values: &[T], serializer: S) -> Result - where - S: Serializer, - T: Display, - { - let vec_of_strings: Vec = values.iter().map(|value| value.to_string()).collect(); - vec_of_strings.serialize(serializer) - } -} - -pub mod as_base64_encoded_string { - use cosmwasm_std::Binary; - use serde::{de, Deserialize, Deserializer, Serialize, Serializer}; - - pub fn deserialize<'de, D>(deserializer: D) -> Result, D::Error> - where - D: Deserializer<'de>, - { - let encoded_string = String::deserialize(deserializer)?; - Binary::from_base64(&encoded_string) - .map(|b| b.to_vec()) - .map_err(de::Error::custom) - } - - pub fn serialize(values: &[u8], serializer: S) -> Result - where - S: Serializer, - { - Binary::new(values.to_vec()) - .to_base64() - .serialize(serializer) - } -} - -pub mod as_option_base64_encoded_string { - use cosmwasm_std::Binary; - use serde::{de, Deserialize, Deserializer, Serialize, Serializer}; - - pub fn deserialize<'de, D>(deserializer: D) -> Result>, D::Error> - where - D: Deserializer<'de>, - { - let encoded_string: Option = Option::deserialize(deserializer)?; - match encoded_string { - Some(s) => Binary::from_base64(&s) - .map(|b| Some(b.to_vec())) - .map_err(de::Error::custom), - None => Ok(None), - } - } - - pub fn serialize(value: &Option>, serializer: S) -> Result - where - S: Serializer, - { - match value { - Some(vec) => { - let encoded_string = Binary::new(vec.clone()).to_base64(); - encoded_string.serialize(serializer) - } - None => serializer.serialize_none(), - } - } -}