From 89d365928d5652fceef923c5140d668c26e2e5e3 Mon Sep 17 00:00:00 2001 From: puneetmahajan Date: Sat, 4 Oct 2025 20:54:25 +0400 Subject: [PATCH 1/2] update ibc-go and wasm, remove fork, use correct versions --- package-lock.json | 4 +- package.json | 2 +- proto/cosmwasm/wasm/v1/authz.proto | 38 +- proto/cosmwasm/wasm/v1/genesis.proto | 4 +- proto/cosmwasm/wasm/v1/ibc.proto | 3 + .../{proposal.proto => proposal_legacy.proto} | 87 +- proto/cosmwasm/wasm/v1/query.proto | 119 +- proto/cosmwasm/wasm/v1/tx.proto | 198 ++- proto/cosmwasm/wasm/v1/types.proto | 26 +- proto/ibc/applications/fee/v1/ack.proto | 17 - proto/ibc/applications/fee/v1/fee.proto | 56 - proto/ibc/applications/fee/v1/genesis.proto | 66 - proto/ibc/applications/fee/v1/metadata.proto | 16 - proto/ibc/applications/fee/v1/query.proto | 222 --- proto/ibc/applications/fee/v1/tx.proto | 112 -- .../controller/v1/controller.proto | 6 +- .../controller/v1/query.proto | 5 +- .../controller/v1/tx.proto | 57 +- .../genesis/v1/genesis.proto | 44 +- .../interchain_accounts/host/v1/host.proto | 19 +- .../interchain_accounts/host/v1/query.proto | 2 +- .../interchain_accounts/host/v1/tx.proto | 60 + .../interchain_accounts/v1/account.proto | 7 +- .../interchain_accounts/v1/metadata.proto | 8 +- .../interchain_accounts/v1/packet.proto | 2 +- .../ibc/applications/transfer/v1/authz.proto | 9 +- .../applications/transfer/v1/denomtrace.proto | 16 + .../applications/transfer/v1/genesis.proto | 20 +- .../transfer/{v2 => v1}/packet.proto | 4 +- .../ibc/applications/transfer/v1/query.proto | 67 +- .../ibc/applications/transfer/v1/token.proto | 24 + .../applications/transfer/v1/transfer.proto | 24 +- proto/ibc/applications/transfer/v1/tx.proto | 56 +- proto/ibc/core/channel/v1/channel.proto | 45 +- proto/ibc/core/channel/v1/genesis.proto | 17 +- proto/ibc/core/channel/v1/query.proto | 30 +- proto/ibc/core/channel/v1/tx.proto | 139 +- proto/ibc/core/channel/v2/genesis.proto | 39 + proto/ibc/core/channel/v2/packet.proto | 68 + proto/ibc/core/channel/v2/query.proto | 199 +++ proto/ibc/core/channel/v2/tx.proto | 117 ++ proto/ibc/core/client/v1/client.proto | 63 +- proto/ibc/core/client/v1/genesis.proto | 30 +- proto/ibc/core/client/v1/query.proto | 60 +- proto/ibc/core/client/v1/tx.proto | 134 +- proto/ibc/core/client/v2/config.proto | 14 + proto/ibc/core/client/v2/counterparty.proto | 13 + proto/ibc/core/client/v2/genesis.proto | 23 + proto/ibc/core/client/v2/query.proto | 46 + proto/ibc/core/client/v2/tx.proto | 58 + proto/ibc/core/commitment/v1/commitment.proto | 13 +- proto/ibc/core/commitment/v2/commitment.proto | 40 + proto/ibc/core/connection/v1/connection.proto | 22 +- proto/ibc/core/connection/v1/genesis.proto | 7 +- proto/ibc/core/connection/v1/query.proto | 8 +- proto/ibc/core/connection/v1/tx.proto | 122 +- proto/ibc/core/types/v1/genesis.proto | 17 +- .../lightclients/localhost/v2/localhost.proto | 16 - .../solomachine/v2/solomachine.proto | 38 +- .../solomachine/v3/solomachine.proto | 24 +- .../tendermint/v1/tendermint.proto | 56 +- proto/ibc/lightclients/wasm/v1/genesis.proto | 20 + proto/ibc/lightclients/wasm/v1/query.proto | 46 + proto/ibc/lightclients/wasm/v1/tx.proto | 66 + proto/ibc/lightclients/wasm/v1/wasm.proto | 43 + scripts/update-protos.sh | 4 +- src/cosmwasm/wasm/v1/authz.ts | 134 ++ src/cosmwasm/wasm/v1/ibc.ts | 36 + .../v1/{proposal.ts => proposal_legacy.ts} | 8 +- src/cosmwasm/wasm/v1/query.ts | 419 +++++- src/cosmwasm/wasm/v1/tx.amino.ts | 157 +- src/cosmwasm/wasm/v1/tx.registry.ts | 128 ++ src/cosmwasm/wasm/v1/tx.ts | 600 +++++++- src/cosmwasm/wasm/v1/types.ts | 25 - src/ibc/applications/fee/v1/ack.ts | 82 - src/ibc/applications/fee/v1/fee.ts | 298 ---- src/ibc/applications/fee/v1/genesis.ts | 421 ------ src/ibc/applications/fee/v1/metadata.ts | 69 - src/ibc/applications/fee/v1/query.ts | 1317 ----------------- src/ibc/applications/fee/v1/tx.amino.ts | 248 ---- src/ibc/applications/fee/v1/tx.registry.ts | 147 -- src/ibc/applications/fee/v1/tx.ts | 571 ------- .../controller/v1/tx.amino.ts | 36 +- .../controller/v1/tx.registry.ts | 33 +- .../interchain_accounts/controller/v1/tx.ts | 129 ++ .../interchain_accounts/host/v1/host.ts | 74 +- .../interchain_accounts/host/v1/tx.amino.ts | 67 + .../host/v1/tx.registry.ts | 85 ++ .../interchain_accounts/host/v1/tx.ts | 278 ++++ src/ibc/applications/transfer/v1/authz.ts | 20 + .../applications/transfer/v1/denomtrace.ts | 73 + src/ibc/applications/transfer/v1/genesis.ts | 24 +- .../transfer/{v2 => v1}/packet.ts | 2 +- src/ibc/applications/transfer/v1/query.ts | 329 ++-- src/ibc/applications/transfer/v1/token.ts | 135 ++ src/ibc/applications/transfer/v1/transfer.ts | 117 +- src/ibc/applications/transfer/v1/tx.amino.ts | 35 +- .../applications/transfer/v1/tx.registry.ts | 33 +- src/ibc/applications/transfer/v1/tx.ts | 137 +- src/ibc/client.ts | 20 +- src/ibc/core/channel/v1/channel.ts | 74 +- src/ibc/core/channel/v1/query.ts | 159 +- src/ibc/core/channel/v1/tx.ts | 7 + src/ibc/core/channel/v2/genesis.ts | 268 ++++ src/ibc/core/channel/v2/packet.ts | 389 +++++ src/ibc/core/channel/v2/query.ts | 1315 ++++++++++++++++ src/ibc/core/channel/v2/tx.amino.ts | 320 ++++ src/ibc/core/channel/v2/tx.registry.ts | 147 ++ src/ibc/core/channel/v2/tx.ts | 667 +++++++++ src/ibc/core/client/v1/client.ts | 198 +-- src/ibc/core/client/v1/genesis.ts | 10 +- src/ibc/core/client/v1/query.ts | 311 +++- src/ibc/core/client/v1/tx.amino.ts | 166 ++- src/ibc/core/client/v1/tx.registry.ts | 135 +- src/ibc/core/client/v1/tx.ts | 505 ++++++- src/ibc/core/client/v2/config.ts | 63 + src/ibc/core/client/v2/counterparty.ts | 73 + src/ibc/core/client/v2/genesis.ts | 131 ++ src/ibc/core/client/v2/query.ts | 243 +++ src/ibc/core/client/v2/tx.amino.ts | 82 + src/ibc/core/client/v2/tx.registry.ts | 85 ++ src/ibc/core/client/v2/tx.ts | 275 ++++ src/ibc/core/commitment/v1/commitment.ts | 57 - src/ibc/core/commitment/v2/commitment.ts | 89 ++ src/ibc/core/connection/v1/connection.ts | 2 +- src/ibc/core/connection/v1/tx.amino.ts | 29 + src/ibc/core/connection/v1/tx.registry.ts | 32 + src/ibc/core/connection/v1/tx.ts | 147 +- src/ibc/core/types/v1/genesis.ts | 37 + .../lightclients/localhost/v2/localhost.ts | 58 - .../solomachine/v3/solomachine.ts | 2 +- .../lightclients/tendermint/v1/tendermint.ts | 2 +- src/ibc/lightclients/wasm/v1/genesis.ts | 112 ++ src/ibc/lightclients/wasm/v1/query.ts | 256 ++++ src/ibc/lightclients/wasm/v1/tx.amino.ts | 87 ++ src/ibc/lightclients/wasm/v1/tx.registry.ts | 116 ++ src/ibc/lightclients/wasm/v1/tx.ts | 376 +++++ src/ibc/lightclients/wasm/v1/wasm.ts | 249 ++++ 138 files changed, 11728 insertions(+), 4870 deletions(-) rename proto/cosmwasm/wasm/v1/{proposal.proto => proposal_legacy.proto} (85%) delete mode 100644 proto/ibc/applications/fee/v1/ack.proto delete mode 100644 proto/ibc/applications/fee/v1/fee.proto delete mode 100644 proto/ibc/applications/fee/v1/genesis.proto delete mode 100644 proto/ibc/applications/fee/v1/metadata.proto delete mode 100644 proto/ibc/applications/fee/v1/query.proto delete mode 100644 proto/ibc/applications/fee/v1/tx.proto create mode 100644 proto/ibc/applications/interchain_accounts/host/v1/tx.proto create mode 100644 proto/ibc/applications/transfer/v1/denomtrace.proto rename proto/ibc/applications/transfer/{v2 => v1}/packet.proto (82%) create mode 100644 proto/ibc/applications/transfer/v1/token.proto create mode 100644 proto/ibc/core/channel/v2/genesis.proto create mode 100644 proto/ibc/core/channel/v2/packet.proto create mode 100644 proto/ibc/core/channel/v2/query.proto create mode 100644 proto/ibc/core/channel/v2/tx.proto create mode 100644 proto/ibc/core/client/v2/config.proto create mode 100644 proto/ibc/core/client/v2/counterparty.proto create mode 100644 proto/ibc/core/client/v2/genesis.proto create mode 100644 proto/ibc/core/client/v2/query.proto create mode 100644 proto/ibc/core/client/v2/tx.proto create mode 100644 proto/ibc/core/commitment/v2/commitment.proto delete mode 100644 proto/ibc/lightclients/localhost/v2/localhost.proto create mode 100644 proto/ibc/lightclients/wasm/v1/genesis.proto create mode 100644 proto/ibc/lightclients/wasm/v1/query.proto create mode 100644 proto/ibc/lightclients/wasm/v1/tx.proto create mode 100644 proto/ibc/lightclients/wasm/v1/wasm.proto rename src/cosmwasm/wasm/v1/{proposal.ts => proposal_legacy.ts} (99%) delete mode 100644 src/ibc/applications/fee/v1/ack.ts delete mode 100644 src/ibc/applications/fee/v1/fee.ts delete mode 100644 src/ibc/applications/fee/v1/genesis.ts delete mode 100644 src/ibc/applications/fee/v1/metadata.ts delete mode 100644 src/ibc/applications/fee/v1/query.ts delete mode 100644 src/ibc/applications/fee/v1/tx.amino.ts delete mode 100644 src/ibc/applications/fee/v1/tx.registry.ts delete mode 100644 src/ibc/applications/fee/v1/tx.ts create mode 100644 src/ibc/applications/interchain_accounts/host/v1/tx.amino.ts create mode 100644 src/ibc/applications/interchain_accounts/host/v1/tx.registry.ts create mode 100644 src/ibc/applications/interchain_accounts/host/v1/tx.ts create mode 100644 src/ibc/applications/transfer/v1/denomtrace.ts rename src/ibc/applications/transfer/{v2 => v1}/packet.ts (98%) create mode 100644 src/ibc/applications/transfer/v1/token.ts create mode 100644 src/ibc/core/channel/v2/genesis.ts create mode 100644 src/ibc/core/channel/v2/packet.ts create mode 100644 src/ibc/core/channel/v2/query.ts create mode 100644 src/ibc/core/channel/v2/tx.amino.ts create mode 100644 src/ibc/core/channel/v2/tx.registry.ts create mode 100644 src/ibc/core/channel/v2/tx.ts create mode 100644 src/ibc/core/client/v2/config.ts create mode 100644 src/ibc/core/client/v2/counterparty.ts create mode 100644 src/ibc/core/client/v2/genesis.ts create mode 100644 src/ibc/core/client/v2/query.ts create mode 100644 src/ibc/core/client/v2/tx.amino.ts create mode 100644 src/ibc/core/client/v2/tx.registry.ts create mode 100644 src/ibc/core/client/v2/tx.ts create mode 100644 src/ibc/core/commitment/v2/commitment.ts delete mode 100644 src/ibc/lightclients/localhost/v2/localhost.ts create mode 100644 src/ibc/lightclients/wasm/v1/genesis.ts create mode 100644 src/ibc/lightclients/wasm/v1/query.ts create mode 100644 src/ibc/lightclients/wasm/v1/tx.amino.ts create mode 100644 src/ibc/lightclients/wasm/v1/tx.registry.ts create mode 100644 src/ibc/lightclients/wasm/v1/tx.ts create mode 100644 src/ibc/lightclients/wasm/v1/wasm.ts diff --git a/package-lock.json b/package-lock.json index eed02cd..706676f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "persistenceonejs", - "version": "3.0.1", + "version": "3.0.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "persistenceonejs", - "version": "3.0.1", + "version": "3.0.2", "license": "ASLv2", "devDependencies": { "@cosmjs/amino": "^0.31.1", diff --git a/package.json b/package.json index 0597917..f30ca9b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "persistenceonejs", - "version": "3.0.1", + "version": "3.0.2", "description": "Client side JS libraries for persistenceSDK transaction generation, signing and broadcasting.", "main": "main/index.js", "module": "module/index.js", diff --git a/proto/cosmwasm/wasm/v1/authz.proto b/proto/cosmwasm/wasm/v1/authz.proto index cca4f03..eb50c76 100644 --- a/proto/cosmwasm/wasm/v1/authz.proto +++ b/proto/cosmwasm/wasm/v1/authz.proto @@ -4,12 +4,25 @@ package cosmwasm.wasm.v1; import "gogoproto/gogo.proto"; import "cosmos_proto/cosmos.proto"; import "cosmos/base/v1beta1/coin.proto"; +import "cosmwasm/wasm/v1/types.proto"; import "google/protobuf/any.proto"; import "amino/amino.proto"; option go_package = "github.com/CosmWasm/wasmd/x/wasm/types"; option (gogoproto.goproto_getters_all) = false; +// StoreCodeAuthorization defines authorization for wasm code upload. +// Since: wasmd 0.42 +message StoreCodeAuthorization { + option (amino.name) = "wasm/StoreCodeAuthorization"; + option (cosmos_proto.implements_interface) = + "cosmos.authz.v1beta1.Authorization"; + + // Grants for code upload + repeated CodeGrant grants = 1 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; +} + // ContractExecutionAuthorization defines authorization for wasm execute. // Since: wasmd 0.30 message ContractExecutionAuthorization { @@ -34,11 +47,23 @@ message ContractMigrationAuthorization { [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; } +// CodeGrant a granted permission for a single code +message CodeGrant { + // CodeHash is the unique identifier created by wasmvm + // Wildcard "*" is used to specify any kind of grant. + bytes code_hash = 1; + + // InstantiatePermission is the superset access control to apply + // on contract creation. + // Optional + AccessConfig instantiate_permission = 2; +} + // ContractGrant a granted permission for a single contract // Since: wasmd 0.30 message ContractGrant { // Contract is the bech32 address of the smart contract - string contract = 1; + string contract = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // Limit defines execution limits that are enforced and updated when the grant // is applied. When the limit lapsed the grant is removed. @@ -75,7 +100,8 @@ message MaxFundsLimit { repeated cosmos.base.v1beta1.Coin amounts = 1 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (amino.encoding) = "legacy_coins" ]; } @@ -93,7 +119,8 @@ message CombinedLimit { repeated cosmos.base.v1beta1.Coin amounts = 2 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (amino.encoding) = "legacy_coins" ]; } @@ -127,5 +154,8 @@ message AcceptedMessagesFilter { "cosmwasm.wasm.v1.ContractAuthzFilterX"; // Messages is the list of raw contract messages - repeated bytes messages = 1 [ (gogoproto.casttype) = "RawContractMessage" ]; + repeated bytes messages = 1 [ + (gogoproto.casttype) = "RawContractMessage", + (amino.encoding) = "inline_json" + ]; } diff --git a/proto/cosmwasm/wasm/v1/genesis.proto b/proto/cosmwasm/wasm/v1/genesis.proto index 68e8b18..9082c8b 100644 --- a/proto/cosmwasm/wasm/v1/genesis.proto +++ b/proto/cosmwasm/wasm/v1/genesis.proto @@ -4,6 +4,7 @@ package cosmwasm.wasm.v1; import "gogoproto/gogo.proto"; import "cosmwasm/wasm/v1/types.proto"; import "amino/amino.proto"; +import "cosmos_proto/cosmos.proto"; option go_package = "github.com/CosmWasm/wasmd/x/wasm/types"; @@ -40,7 +41,8 @@ message Code { // Contract struct encompasses ContractAddress, ContractInfo, and ContractState message Contract { - string contract_address = 1; + string contract_address = 1 + [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; ContractInfo contract_info = 2 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; repeated Model contract_state = 3 diff --git a/proto/cosmwasm/wasm/v1/ibc.proto b/proto/cosmwasm/wasm/v1/ibc.proto index feaad29..a04e4f8 100644 --- a/proto/cosmwasm/wasm/v1/ibc.proto +++ b/proto/cosmwasm/wasm/v1/ibc.proto @@ -31,6 +31,9 @@ message MsgIBCSendResponse { uint64 sequence = 1; } +// MsgIBCWriteAcknowledgementResponse +message MsgIBCWriteAcknowledgementResponse {} + // MsgIBCCloseChannel port and channel need to be owned by the contract message MsgIBCCloseChannel { string channel = 2 [ (gogoproto.moretags) = "yaml:\"source_channel\"" ]; diff --git a/proto/cosmwasm/wasm/v1/proposal.proto b/proto/cosmwasm/wasm/v1/proposal_legacy.proto similarity index 85% rename from proto/cosmwasm/wasm/v1/proposal.proto rename to proto/cosmwasm/wasm/v1/proposal_legacy.proto index eedbb9b..d6d7a7d 100644 --- a/proto/cosmwasm/wasm/v1/proposal.proto +++ b/proto/cosmwasm/wasm/v1/proposal_legacy.proto @@ -26,7 +26,7 @@ message StoreCodeProposal { // Description is a human readable text string description = 2; // RunAs is the address that is passed to the contract's environment as sender - string run_as = 3; + string run_as = 3 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // WASMByteCode can be raw or gzip compressed bytes wasm_byte_code = 4 [ (gogoproto.customname) = "WASMByteCode" ]; // Used in v1beta1 @@ -59,20 +59,24 @@ message InstantiateContractProposal { // Description is a human readable text string description = 2; // RunAs is the address that is passed to the contract's environment as sender - string run_as = 3; + string run_as = 3 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // Admin is an optional address that can execute migrations - string admin = 4; + string admin = 4 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // CodeID is the reference to the stored WASM code uint64 code_id = 5 [ (gogoproto.customname) = "CodeID" ]; - // Label is optional metadata to be stored with a constract instance. + // Label is optional metadata to be stored with a contract instance. string label = 6; // Msg json encoded message to be passed to the contract on instantiation - bytes msg = 7 [ (gogoproto.casttype) = "RawContractMessage" ]; + bytes msg = 7 [ + (gogoproto.casttype) = "RawContractMessage", + (amino.encoding) = "inline_json" + ]; // Funds coins that are transferred to the contract on instantiation repeated cosmos.base.v1beta1.Coin funds = 8 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (amino.encoding) = "legacy_coins" ]; } @@ -89,21 +93,25 @@ message InstantiateContract2Proposal { string title = 1; // Description is a human readable text string description = 2; - // RunAs is the address that is passed to the contract's enviroment as sender - string run_as = 3; + // RunAs is the address that is passed to the contract's environment as sender + string run_as = 3 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // Admin is an optional address that can execute migrations - string admin = 4; + string admin = 4 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // CodeID is the reference to the stored WASM code uint64 code_id = 5 [ (gogoproto.customname) = "CodeID" ]; - // Label is optional metadata to be stored with a constract instance. + // Label is optional metadata to be stored with a contract instance. string label = 6; // Msg json encode message to be passed to the contract on instantiation - bytes msg = 7 [ (gogoproto.casttype) = "RawContractMessage" ]; + bytes msg = 7 [ + (gogoproto.casttype) = "RawContractMessage", + (amino.encoding) = "inline_json" + ]; // Funds coins that are transferred to the contract on instantiation repeated cosmos.base.v1beta1.Coin funds = 8 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (amino.encoding) = "legacy_coins" ]; // Salt is an arbitrary value provided by the sender. Size can be 1 to 64. bytes salt = 9; @@ -128,11 +136,14 @@ message MigrateContractProposal { // Note: skipping 3 as this was previously used for unneeded run_as // Contract is the address of the smart contract - string contract = 4; + string contract = 4 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // CodeID references the new WASM code uint64 code_id = 5 [ (gogoproto.customname) = "CodeID" ]; // Msg json encoded message to be passed to the contract on migration - bytes msg = 6 [ (gogoproto.casttype) = "RawContractMessage" ]; + bytes msg = 6 [ + (gogoproto.casttype) = "RawContractMessage", + (amino.encoding) = "inline_json" + ]; } // Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for @@ -149,9 +160,12 @@ message SudoContractProposal { // Description is a human readable text string description = 2; // Contract is the address of the smart contract - string contract = 3; + string contract = 3 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // Msg json encoded message to be passed to the contract as sudo - bytes msg = 4 [ (gogoproto.casttype) = "RawContractMessage" ]; + bytes msg = 4 [ + (gogoproto.casttype) = "RawContractMessage", + (amino.encoding) = "inline_json" + ]; } // Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for @@ -168,16 +182,20 @@ message ExecuteContractProposal { // Description is a human readable text string description = 2; // RunAs is the address that is passed to the contract's environment as sender - string run_as = 3; + string run_as = 3 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // Contract is the address of the smart contract - string contract = 4; + string contract = 4 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // Msg json encoded message to be passed to the contract as execute - bytes msg = 5 [ (gogoproto.casttype) = "RawContractMessage" ]; + bytes msg = 5 [ + (gogoproto.casttype) = "RawContractMessage", + (amino.encoding) = "inline_json" + ]; // Funds coins that are transferred to the contract on instantiation repeated cosmos.base.v1beta1.Coin funds = 6 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (amino.encoding) = "legacy_coins" ]; } @@ -195,9 +213,12 @@ message UpdateAdminProposal { // Description is a human readable text string description = 2; // NewAdmin address to be set - string new_admin = 3 [ (gogoproto.moretags) = "yaml:\"new_admin\"" ]; + string new_admin = 3 [ + (gogoproto.moretags) = "yaml:\"new_admin\"", + (cosmos_proto.scalar) = "cosmos.AddressString" + ]; // Contract is the address of the smart contract - string contract = 4; + string contract = 4 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; } // Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for @@ -214,7 +235,7 @@ message ClearAdminProposal { // Description is a human readable text string description = 2; // Contract is the address of the smart contract - string contract = 3; + string contract = 3 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; } // Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for @@ -227,9 +248,9 @@ message PinCodesProposal { option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content"; // Title is a short summary - string title = 1 [ (gogoproto.moretags) = "yaml:\"title\"" ]; + string title = 1; // Description is a human readable text - string description = 2 [ (gogoproto.moretags) = "yaml:\"description\"" ]; + string description = 2; // CodeIDs references the new WASM codes repeated uint64 code_ids = 3 [ (gogoproto.customname) = "CodeIDs", @@ -247,9 +268,9 @@ message UnpinCodesProposal { option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content"; // Title is a short summary - string title = 1 [ (gogoproto.moretags) = "yaml:\"title\"" ]; + string title = 1; // Description is a human readable text - string description = 2 [ (gogoproto.moretags) = "yaml:\"description\"" ]; + string description = 2; // CodeIDs references the WASM codes repeated uint64 code_ids = 3 [ (gogoproto.customname) = "CodeIDs", @@ -300,7 +321,7 @@ message StoreAndInstantiateContractProposal { // Description is a human readable text string description = 2; // RunAs is the address that is passed to the contract's environment as sender - string run_as = 3; + string run_as = 3 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // WASMByteCode can be raw or gzip compressed bytes wasm_byte_code = 4 [ (gogoproto.customname) = "WASMByteCode" ]; // InstantiatePermission to apply on contract creation, optional @@ -309,15 +330,19 @@ message StoreAndInstantiateContractProposal { bool unpin_code = 6; // Admin is an optional address that can execute migrations string admin = 7; - // Label is optional metadata to be stored with a constract instance. + // Label is optional metadata to be stored with a contract instance. string label = 8; // Msg json encoded message to be passed to the contract on instantiation - bytes msg = 9 [ (gogoproto.casttype) = "RawContractMessage" ]; + bytes msg = 9 [ + (gogoproto.casttype) = "RawContractMessage", + (amino.encoding) = "inline_json" + ]; // Funds coins that are transferred to the contract on instantiation repeated cosmos.base.v1beta1.Coin funds = 10 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (amino.encoding) = "legacy_coins" ]; // Source is the URL where the code is hosted string source = 11; diff --git a/proto/cosmwasm/wasm/v1/query.proto b/proto/cosmwasm/wasm/v1/query.proto index d14f315..e52b6b0 100644 --- a/proto/cosmwasm/wasm/v1/query.proto +++ b/proto/cosmwasm/wasm/v1/query.proto @@ -5,7 +5,9 @@ import "gogoproto/gogo.proto"; import "cosmwasm/wasm/v1/types.proto"; import "google/api/annotations.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; +import "cosmos/query/v1/query.proto"; import "amino/amino.proto"; +import "cosmos_proto/cosmos.proto"; option go_package = "github.com/CosmWasm/wasmd/x/wasm/types"; option (gogoproto.goproto_getters_all) = false; @@ -16,27 +18,32 @@ service Query { // ContractInfo gets the contract meta data rpc ContractInfo(QueryContractInfoRequest) returns (QueryContractInfoResponse) { + option (cosmos.query.v1.module_query_safe) = true; option (google.api.http).get = "/cosmwasm/wasm/v1/contract/{address}"; } // ContractHistory gets the contract code history rpc ContractHistory(QueryContractHistoryRequest) returns (QueryContractHistoryResponse) { + option (cosmos.query.v1.module_query_safe) = true; option (google.api.http).get = "/cosmwasm/wasm/v1/contract/{address}/history"; } // ContractsByCode lists all smart contracts for a code id rpc ContractsByCode(QueryContractsByCodeRequest) returns (QueryContractsByCodeResponse) { + option (cosmos.query.v1.module_query_safe) = true; option (google.api.http).get = "/cosmwasm/wasm/v1/code/{code_id}/contracts"; } // AllContractState gets all raw store data for a single contract rpc AllContractState(QueryAllContractStateRequest) returns (QueryAllContractStateResponse) { + option (cosmos.query.v1.module_query_safe) = true; option (google.api.http).get = "/cosmwasm/wasm/v1/contract/{address}/state"; } // RawContractState gets single key from the raw store data of a contract rpc RawContractState(QueryRawContractStateRequest) returns (QueryRawContractStateResponse) { + option (cosmos.query.v1.module_query_safe) = true; option (google.api.http).get = "/cosmwasm/wasm/v1/contract/{address}/raw/{query_data}"; } @@ -46,38 +53,63 @@ service Query { option (google.api.http).get = "/cosmwasm/wasm/v1/contract/{address}/smart/{query_data}"; } - // Code gets the binary code and metadata for a singe wasm code + // Code gets the binary code and metadata for a single wasm code rpc Code(QueryCodeRequest) returns (QueryCodeResponse) { + option (cosmos.query.v1.module_query_safe) = true; option (google.api.http).get = "/cosmwasm/wasm/v1/code/{code_id}"; } // Codes gets the metadata for all stored wasm codes rpc Codes(QueryCodesRequest) returns (QueryCodesResponse) { + option (cosmos.query.v1.module_query_safe) = true; option (google.api.http).get = "/cosmwasm/wasm/v1/code"; } + // CodeInfo gets the metadata for a single wasm code + rpc CodeInfo(QueryCodeInfoRequest) returns (QueryCodeInfoResponse) { + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = "/cosmwasm/wasm/v1/code-info/{code_id}"; + } + // PinnedCodes gets the pinned code ids rpc PinnedCodes(QueryPinnedCodesRequest) returns (QueryPinnedCodesResponse) { + option (cosmos.query.v1.module_query_safe) = true; option (google.api.http).get = "/cosmwasm/wasm/v1/codes/pinned"; } // Params gets the module params rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (cosmos.query.v1.module_query_safe) = true; option (google.api.http).get = "/cosmwasm/wasm/v1/codes/params"; } // ContractsByCreator gets the contracts by creator rpc ContractsByCreator(QueryContractsByCreatorRequest) returns (QueryContractsByCreatorResponse) { + option (cosmos.query.v1.module_query_safe) = true; option (google.api.http).get = "/cosmwasm/wasm/v1/contracts/creator/{creator_address}"; } + + // WasmLimitsConfig gets the configured limits for static validation of Wasm + // files, encoded in JSON. + rpc WasmLimitsConfig(QueryWasmLimitsConfigRequest) + returns (QueryWasmLimitsConfigResponse) { + option (google.api.http).get = "/cosmwasm/wasm/v1/wasm-limits-config"; + } + + // BuildAddress builds a contract address + rpc BuildAddress(QueryBuildAddressRequest) + returns (QueryBuildAddressResponse) { + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = "/cosmwasm/wasm/v1/contract/build_address"; + } } // QueryContractInfoRequest is the request type for the Query/ContractInfo RPC // method message QueryContractInfoRequest { // address is the address of the contract to query - string address = 1; + string address = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; } // QueryContractInfoResponse is the response type for the Query/ContractInfo RPC // method @@ -85,7 +117,7 @@ message QueryContractInfoResponse { option (gogoproto.equal) = true; // address is the address of the contract - string address = 1; + string address = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; ContractInfo contract_info = 2 [ (gogoproto.embed) = true, (gogoproto.nullable) = false, @@ -98,7 +130,7 @@ message QueryContractInfoResponse { // RPC method message QueryContractHistoryRequest { // address is the address of the contract to query - string address = 1; + string address = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // pagination defines an optional pagination for the request. cosmos.base.query.v1beta1.PageRequest pagination = 2; } @@ -115,7 +147,7 @@ message QueryContractHistoryResponse { // QueryContractsByCodeRequest is the request type for the Query/ContractsByCode // RPC method message QueryContractsByCodeRequest { - uint64 code_id = 1; // grpc-gateway_out does not support Go style CodID + uint64 code_id = 1; // grpc-gateway_out does not support Go style CodeID // pagination defines an optional pagination for the request. cosmos.base.query.v1beta1.PageRequest pagination = 2; } @@ -124,7 +156,8 @@ message QueryContractsByCodeRequest { // Query/ContractsByCode RPC method message QueryContractsByCodeResponse { // contracts are a set of contract addresses - repeated string contracts = 1; + repeated string contracts = 1 + [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // pagination defines the pagination in the response. cosmos.base.query.v1beta1.PageResponse pagination = 2; @@ -134,7 +167,7 @@ message QueryContractsByCodeResponse { // Query/AllContractState RPC method message QueryAllContractStateRequest { // address is the address of the contract - string address = 1; + string address = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // pagination defines an optional pagination for the request. cosmos.base.query.v1beta1.PageRequest pagination = 2; } @@ -152,7 +185,7 @@ message QueryAllContractStateResponse { // Query/RawContractState RPC method message QueryRawContractStateRequest { // address is the address of the contract - string address = 1; + string address = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; bytes query_data = 2; } @@ -167,21 +200,44 @@ message QueryRawContractStateResponse { // Query/SmartContractState RPC method message QuerySmartContractStateRequest { // address is the address of the contract - string address = 1; + string address = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // QueryData contains the query data passed to the contract - bytes query_data = 2 [ (gogoproto.casttype) = "RawContractMessage" ]; + bytes query_data = 2 [ + (gogoproto.casttype) = "RawContractMessage", + (amino.encoding) = "inline_json" + ]; } // QuerySmartContractStateResponse is the response type for the // Query/SmartContractState RPC method message QuerySmartContractStateResponse { // Data contains the json data returned from the smart contract - bytes data = 1 [ (gogoproto.casttype) = "RawContractMessage" ]; + bytes data = 1 [ + (gogoproto.casttype) = "RawContractMessage", + (amino.encoding) = "inline_json" + ]; } // QueryCodeRequest is the request type for the Query/Code RPC method message QueryCodeRequest { - uint64 code_id = 1; // grpc-gateway_out does not support Go style CodID + uint64 code_id = 1; // grpc-gateway_out does not support Go style CodeID +} + +// QueryCodeInfoRequest is the request type for the Query/CodeInfo RPC method +message QueryCodeInfoRequest { + uint64 code_id = 1; // grpc-gateway_out does not support Go style CodeID +} + +// QueryCodeInfoResponse is the response type for the Query/CodeInfo RPC method +message QueryCodeInfoResponse { + option (gogoproto.equal) = true; + + uint64 code_id = 1 [ (gogoproto.customname) = "CodeID" ]; + string creator = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + bytes checksum = 3 [ (gogoproto.casttype) = + "github.com/cometbft/cometbft/libs/bytes.HexBytes" ]; + AccessConfig instantiate_permission = 4 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; } // CodeInfoResponse contains code meta data from CodeInfo @@ -192,7 +248,7 @@ message CodeInfoResponse { (gogoproto.customname) = "CodeID", (gogoproto.jsontag) = "id" ]; // id for legacy support - string creator = 2; + string creator = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; bytes data_hash = 3 [ (gogoproto.casttype) = "github.com/cometbft/cometbft/libs/bytes.HexBytes" ]; @@ -253,7 +309,7 @@ message QueryParamsResponse { // Query/ContractsByCreator RPC method. message QueryContractsByCreatorRequest { // CreatorAddress is the address of contract creator - string creator_address = 1; + string creator_address = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // Pagination defines an optional pagination for the request. cosmos.base.query.v1beta1.PageRequest pagination = 2; } @@ -262,7 +318,38 @@ message QueryContractsByCreatorRequest { // Query/ContractsByCreator RPC method. message QueryContractsByCreatorResponse { // ContractAddresses result set - repeated string contract_addresses = 1; + repeated string contract_addresses = 1 + [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // Pagination defines the pagination in the response. cosmos.base.query.v1beta1.PageResponse pagination = 2; -} \ No newline at end of file +} + +// QueryWasmLimitsConfigRequest is the request type for the +// Query/WasmLimitsConfig RPC method. +message QueryWasmLimitsConfigRequest {} + +// QueryWasmLimitsConfigResponse is the response type for the +// Query/WasmLimitsConfig RPC method. It contains the JSON encoded limits for +// static validation of Wasm files. +message QueryWasmLimitsConfigResponse { string config = 1; } + +// QueryBuildAddressRequest is the request type for the Query/BuildAddress RPC +// method. +message QueryBuildAddressRequest { + // CodeHash is the hash of the code + string code_hash = 1; + // CreatorAddress is the address of the contract instantiator + string creator_address = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + // Salt is a hex encoded salt + string salt = 3; + // InitArgs are optional json encoded init args to be used in contract address + // building if provided + bytes init_args = 4; +} + +// QueryBuildAddressResponse is the response type for the Query/BuildAddress RPC +// method. +message QueryBuildAddressResponse { + // Address is the contract address + string address = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; +} diff --git a/proto/cosmwasm/wasm/v1/tx.proto b/proto/cosmwasm/wasm/v1/tx.proto index 90905f5..4dfe744 100644 --- a/proto/cosmwasm/wasm/v1/tx.proto +++ b/proto/cosmwasm/wasm/v1/tx.proto @@ -13,6 +13,8 @@ option (gogoproto.goproto_getters_all) = false; // Msg defines the wasm Msg service. service Msg { + option (cosmos.msg.v1.service) = true; + // StoreCode to submit Wasm code to the system rpc StoreCode(MsgStoreCode) returns (MsgStoreCodeResponse); // InstantiateContract creates a new smart contract instance for the given @@ -27,7 +29,7 @@ service Msg { rpc ExecuteContract(MsgExecuteContract) returns (MsgExecuteContractResponse); // Migrate runs a code upgrade/ downgrade for a smart contract rpc MigrateContract(MsgMigrateContract) returns (MsgMigrateContractResponse); - // UpdateAdmin sets a new admin for a smart contract + // UpdateAdmin sets a new admin for a smart contract rpc UpdateAdmin(MsgUpdateAdmin) returns (MsgUpdateAdminResponse); // ClearAdmin removes any admin stored for a smart contract rpc ClearAdmin(MsgClearAdmin) returns (MsgClearAdminResponse); @@ -60,6 +62,27 @@ service Msg { // Since: 0.40 rpc StoreAndInstantiateContract(MsgStoreAndInstantiateContract) returns (MsgStoreAndInstantiateContractResponse); + // RemoveCodeUploadParamsAddresses defines a governance operation for + // removing addresses from code upload params. + // The authority is defined in the keeper. + rpc RemoveCodeUploadParamsAddresses(MsgRemoveCodeUploadParamsAddresses) + returns (MsgRemoveCodeUploadParamsAddressesResponse); + // AddCodeUploadParamsAddresses defines a governance operation for + // adding addresses to code upload params. + // The authority is defined in the keeper. + rpc AddCodeUploadParamsAddresses(MsgAddCodeUploadParamsAddresses) + returns (MsgAddCodeUploadParamsAddressesResponse); + // StoreAndMigrateContract defines a governance operation for storing + // and migrating the contract. The authority is defined in the keeper. + // + // Since: 0.42 + rpc StoreAndMigrateContract(MsgStoreAndMigrateContract) + returns (MsgStoreAndMigrateContractResponse); + // UpdateContractLabel sets a new label for a smart contract + // + // Since: 0.43 + rpc UpdateContractLabel(MsgUpdateContractLabel) + returns (MsgUpdateContractLabelResponse); } // MsgStoreCode submit Wasm code to the system @@ -68,7 +91,7 @@ message MsgStoreCode { option (cosmos.msg.v1.signer) = "sender"; // Sender is the actor that signed the messages - string sender = 1; + string sender = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // WASMByteCode can be raw or gzip compressed bytes wasm_byte_code = 2 [ (gogoproto.customname) = "WASMByteCode" ]; // Used in v1beta1 @@ -92,52 +115,60 @@ message MsgInstantiateContract { option (cosmos.msg.v1.signer) = "sender"; // Sender is the that actor that signed the messages - string sender = 1; + string sender = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // Admin is an optional address that can execute migrations - string admin = 2; + string admin = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // CodeID is the reference to the stored WASM code uint64 code_id = 3 [ (gogoproto.customname) = "CodeID" ]; // Label is optional metadata to be stored with a contract instance. string label = 4; // Msg json encoded message to be passed to the contract on instantiation - bytes msg = 5 [ (gogoproto.casttype) = "RawContractMessage" ]; + bytes msg = 5 [ + (gogoproto.casttype) = "RawContractMessage", + (amino.encoding) = "inline_json" + ]; // Funds coins that are transferred to the contract on instantiation repeated cosmos.base.v1beta1.Coin funds = 6 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (amino.encoding) = "legacy_coins" ]; } // MsgInstantiateContractResponse return instantiation result data message MsgInstantiateContractResponse { // Address is the bech32 address of the new contract instance. - string address = 1; + string address = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // Data contains bytes to returned from the contract bytes data = 2; } // MsgInstantiateContract2 create a new smart contract instance for the given -// code id with a predicable address. +// code id with a predictable address. message MsgInstantiateContract2 { option (amino.name) = "wasm/MsgInstantiateContract2"; option (cosmos.msg.v1.signer) = "sender"; // Sender is the that actor that signed the messages - string sender = 1; + string sender = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // Admin is an optional address that can execute migrations - string admin = 2; + string admin = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // CodeID is the reference to the stored WASM code uint64 code_id = 3 [ (gogoproto.customname) = "CodeID" ]; // Label is optional metadata to be stored with a contract instance. string label = 4; // Msg json encoded message to be passed to the contract on instantiation - bytes msg = 5 [ (gogoproto.casttype) = "RawContractMessage" ]; + bytes msg = 5 [ + (gogoproto.casttype) = "RawContractMessage", + (amino.encoding) = "inline_json" + ]; // Funds coins that are transferred to the contract on instantiation repeated cosmos.base.v1beta1.Coin funds = 6 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (amino.encoding) = "legacy_coins" ]; // Salt is an arbitrary value provided by the sender. Size can be 1 to 64. bytes salt = 7; @@ -149,7 +180,7 @@ message MsgInstantiateContract2 { // MsgInstantiateContract2Response return instantiation result data message MsgInstantiateContract2Response { // Address is the bech32 address of the new contract instance. - string address = 1; + string address = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // Data contains bytes to returned from the contract bytes data = 2; } @@ -160,16 +191,20 @@ message MsgExecuteContract { option (cosmos.msg.v1.signer) = "sender"; // Sender is the that actor that signed the messages - string sender = 1; + string sender = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // Contract is the address of the smart contract - string contract = 2; + string contract = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // Msg json encoded message to be passed to the contract - bytes msg = 3 [ (gogoproto.casttype) = "RawContractMessage" ]; + bytes msg = 3 [ + (gogoproto.casttype) = "RawContractMessage", + (amino.encoding) = "inline_json" + ]; // Funds coins that are transferred to the contract on execution repeated cosmos.base.v1beta1.Coin funds = 5 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (amino.encoding) = "legacy_coins" ]; } @@ -185,13 +220,16 @@ message MsgMigrateContract { option (cosmos.msg.v1.signer) = "sender"; // Sender is the that actor that signed the messages - string sender = 1; + string sender = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // Contract is the address of the smart contract - string contract = 2; + string contract = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // CodeID references the new WASM code uint64 code_id = 3 [ (gogoproto.customname) = "CodeID" ]; // Msg json encoded message to be passed to the contract on migration - bytes msg = 4 [ (gogoproto.casttype) = "RawContractMessage" ]; + bytes msg = 4 [ + (gogoproto.casttype) = "RawContractMessage", + (amino.encoding) = "inline_json" + ]; } // MsgMigrateContractResponse returns contract migration result data. @@ -207,11 +245,11 @@ message MsgUpdateAdmin { option (cosmos.msg.v1.signer) = "sender"; // Sender is the that actor that signed the messages - string sender = 1; + string sender = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // NewAdmin address to be set - string new_admin = 2; + string new_admin = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // Contract is the address of the smart contract - string contract = 3; + string contract = 3 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; } // MsgUpdateAdminResponse returns empty data @@ -223,9 +261,9 @@ message MsgClearAdmin { option (cosmos.msg.v1.signer) = "sender"; // Sender is the actor that signed the messages - string sender = 1; + string sender = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // Contract is the address of the smart contract - string contract = 3; + string contract = 3 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; } // MsgClearAdminResponse returns empty data @@ -237,7 +275,7 @@ message MsgUpdateInstantiateConfig { option (cosmos.msg.v1.signer) = "sender"; // Sender is the that actor that signed the messages - string sender = 1; + string sender = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // CodeID references the stored WASM code uint64 code_id = 2 [ (gogoproto.customname) = "CodeID" ]; // NewInstantiatePermission is the new access control @@ -281,9 +319,12 @@ message MsgSudoContract { string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // Contract is the address of the smart contract - string contract = 2; + string contract = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // Msg json encoded message to be passed to the contract as sudo - bytes msg = 3 [ (gogoproto.casttype) = "RawContractMessage" ]; + bytes msg = 3 [ + (gogoproto.casttype) = "RawContractMessage", + (amino.encoding) = "inline_json" + ]; } // MsgSudoContractResponse defines the response structure for executing a @@ -357,17 +398,21 @@ message MsgStoreAndInstantiateContract { // pinned to cache. bool unpin_code = 5; // Admin is an optional address that can execute migrations - string admin = 6; - // Label is optional metadata to be stored with a constract instance. + string admin = 6 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + // Label is optional metadata to be stored with a contract instance. string label = 7; // Msg json encoded message to be passed to the contract on instantiation - bytes msg = 8 [ (gogoproto.casttype) = "RawContractMessage" ]; + bytes msg = 8 [ + (gogoproto.casttype) = "RawContractMessage", + (amino.encoding) = "inline_json" + ]; // Funds coins that are transferred from the authority account to the contract // on instantiation repeated cosmos.base.v1beta1.Coin funds = 9 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (amino.encoding) = "legacy_coins" ]; // Source is the URL where the code is hosted string source = 10; @@ -385,7 +430,92 @@ message MsgStoreAndInstantiateContract { // Since: 0.40 message MsgStoreAndInstantiateContractResponse { // Address is the bech32 address of the new contract instance. - string address = 1; + string address = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + // Data contains bytes to returned from the contract bytes data = 2; -} \ No newline at end of file +} + +// MsgAddCodeUploadParamsAddresses is the +// MsgAddCodeUploadParamsAddresses request type. +message MsgAddCodeUploadParamsAddresses { + option (amino.name) = "wasm/MsgAddCodeUploadParamsAddresses"; + option (cosmos.msg.v1.signer) = "authority"; + + // Authority is the address of the governance account. + string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + repeated string addresses = 2 [ (gogoproto.moretags) = "yaml:\"addresses\"" ]; +} + +// MsgAddCodeUploadParamsAddressesResponse defines the response +// structure for executing a MsgAddCodeUploadParamsAddresses message. +message MsgAddCodeUploadParamsAddressesResponse {} + +// MsgRemoveCodeUploadParamsAddresses is the +// MsgRemoveCodeUploadParamsAddresses request type. +message MsgRemoveCodeUploadParamsAddresses { + option (amino.name) = "wasm/MsgRemoveCodeUploadParamsAddresses"; + option (cosmos.msg.v1.signer) = "authority"; + + // Authority is the address of the governance account. + string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + repeated string addresses = 2 [ (gogoproto.moretags) = "yaml:\"addresses\"" ]; +} + +// MsgRemoveCodeUploadParamsAddressesResponse defines the response +// structure for executing a MsgRemoveCodeUploadParamsAddresses message. +message MsgRemoveCodeUploadParamsAddressesResponse {} + +// MsgStoreAndMigrateContract is the MsgStoreAndMigrateContract +// request type. +// +// Since: 0.42 +message MsgStoreAndMigrateContract { + option (amino.name) = "wasm/MsgStoreAndMigrateContract"; + option (cosmos.msg.v1.signer) = "authority"; + + // Authority is the address of the governance account. + string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + // WASMByteCode can be raw or gzip compressed + bytes wasm_byte_code = 2 [ (gogoproto.customname) = "WASMByteCode" ]; + // InstantiatePermission to apply on contract creation, optional + AccessConfig instantiate_permission = 3; + // Contract is the address of the smart contract + string contract = 4; + // Msg json encoded message to be passed to the contract on migration + bytes msg = 5 [ + (gogoproto.casttype) = "RawContractMessage", + (amino.encoding) = "inline_json" + ]; +} + +// MsgStoreAndMigrateContractResponse defines the response structure +// for executing a MsgStoreAndMigrateContract message. +// +// Since: 0.42 +message MsgStoreAndMigrateContractResponse { + // CodeID is the reference to the stored WASM code + uint64 code_id = 1 [ (gogoproto.customname) = "CodeID" ]; + // Checksum is the sha256 hash of the stored code + bytes checksum = 2; + // Data contains bytes to returned from the contract + bytes data = 3; +} + +// MsgUpdateContractLabel sets a new label for a smart contract +message MsgUpdateContractLabel { + option (amino.name) = "wasm/MsgUpdateContractLabel"; + option (cosmos.msg.v1.signer) = "sender"; + + // Sender is the that actor that signed the messages + string sender = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + // NewLabel string to be set + string new_label = 2; + // Contract is the address of the smart contract + string contract = 3 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; +} + +// MsgUpdateContractLabelResponse returns empty data +message MsgUpdateContractLabelResponse {} diff --git a/proto/cosmwasm/wasm/v1/types.proto b/proto/cosmwasm/wasm/v1/types.proto index 6d8db3a..ad53085 100644 --- a/proto/cosmwasm/wasm/v1/types.proto +++ b/proto/cosmwasm/wasm/v1/types.proto @@ -20,10 +20,9 @@ enum AccessType { // AccessTypeNobody forbidden ACCESS_TYPE_NOBODY = 1 [ (gogoproto.enumvalue_customname) = "AccessTypeNobody" ]; - // AccessTypeOnlyAddress restricted to a single address - // Deprecated: use AccessTypeAnyOfAddresses instead - ACCESS_TYPE_ONLY_ADDRESS = 2 - [ (gogoproto.enumvalue_customname) = "AccessTypeOnlyAddress" ]; + + reserved 2; // was AccessTypeOnlyAddress + // AccessTypeEverybody unrestricted ACCESS_TYPE_EVERYBODY = 3 [ (gogoproto.enumvalue_customname) = "AccessTypeEverybody" ]; @@ -43,10 +42,10 @@ message AccessConfig { option (gogoproto.goproto_stringer) = true; AccessType permission = 1 [ (gogoproto.moretags) = "yaml:\"permission\"" ]; - // Address - // Deprecated: replaced by addresses - string address = 2 [ (gogoproto.moretags) = "yaml:\"address\"" ]; - repeated string addresses = 3 [ (gogoproto.moretags) = "yaml:\"addresses\"" ]; + reserved 2; // was address + + repeated string addresses = 3 + [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; } // Params defines the set of wasm parameters. @@ -66,7 +65,7 @@ message CodeInfo { // CodeHash is the unique identifier created by wasmvm bytes code_hash = 1; // Creator address who initially stored the code - string creator = 2; + string creator = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // Used in v1beta1 reserved 3, 4; // InstantiateConfig access control to apply on contract creation, optional @@ -81,9 +80,9 @@ message ContractInfo { // CodeID is the reference to the stored Wasm code uint64 code_id = 1 [ (gogoproto.customname) = "CodeID" ]; // Creator address who initially instantiated the contract - string creator = 2; + string creator = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // Admin is an optional address that can execute migrations - string admin = 3; + string admin = 3 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // Label is optional metadata to be stored with a contract instance. string label = 4; // Created Tx position when the contract was instantiated. @@ -125,7 +124,10 @@ message ContractCodeHistoryEntry { uint64 code_id = 2 [ (gogoproto.customname) = "CodeID" ]; // Updated Tx position when the operation was executed. AbsoluteTxPosition updated = 3; - bytes msg = 4 [ (gogoproto.casttype) = "RawContractMessage" ]; + bytes msg = 4 [ + (gogoproto.casttype) = "RawContractMessage", + (amino.encoding) = "inline_json" + ]; } // AbsoluteTxPosition is a unique transaction position that allows for global diff --git a/proto/ibc/applications/fee/v1/ack.proto b/proto/ibc/applications/fee/v1/ack.proto deleted file mode 100644 index ec1342b..0000000 --- a/proto/ibc/applications/fee/v1/ack.proto +++ /dev/null @@ -1,17 +0,0 @@ -syntax = "proto3"; - -package ibc.applications.fee.v1; - -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types"; - -import "gogoproto/gogo.proto"; - -// IncentivizedAcknowledgement is the acknowledgement format to be used by applications wrapped in the fee middleware -message IncentivizedAcknowledgement { - // the underlying app acknowledgement bytes - bytes app_acknowledgement = 1 [(gogoproto.moretags) = "yaml:\"app_acknowledgement\""]; - // the relayer address which submits the recv packet message - string forward_relayer_address = 2 [(gogoproto.moretags) = "yaml:\"forward_relayer_address\""]; - // success flag of the base application callback - bool underlying_app_success = 3 [(gogoproto.moretags) = "yaml:\"underlying_app_successl\""]; -} diff --git a/proto/ibc/applications/fee/v1/fee.proto b/proto/ibc/applications/fee/v1/fee.proto deleted file mode 100644 index 1a025dd..0000000 --- a/proto/ibc/applications/fee/v1/fee.proto +++ /dev/null @@ -1,56 +0,0 @@ -syntax = "proto3"; - -package ibc.applications.fee.v1; - -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types"; - -import "cosmos/base/v1beta1/coin.proto"; -import "gogoproto/gogo.proto"; -import "ibc/core/channel/v1/channel.proto"; - -// Fee defines the ICS29 receive, acknowledgement and timeout fees -message Fee { - // the packet receive fee - repeated cosmos.base.v1beta1.Coin recv_fee = 1 [ - (gogoproto.moretags) = "yaml:\"recv_fee\"", - (gogoproto.nullable) = false, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" - ]; - // the packet acknowledgement fee - repeated cosmos.base.v1beta1.Coin ack_fee = 2 [ - (gogoproto.moretags) = "yaml:\"ack_fee\"", - (gogoproto.nullable) = false, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" - ]; - // the packet timeout fee - repeated cosmos.base.v1beta1.Coin timeout_fee = 3 [ - (gogoproto.moretags) = "yaml:\"timeout_fee\"", - (gogoproto.nullable) = false, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" - ]; -} - -// PacketFee contains ICS29 relayer fees, refund address and optional list of permitted relayers -message PacketFee { - // fee encapsulates the recv, ack and timeout fees associated with an IBC packet - Fee fee = 1 [(gogoproto.nullable) = false]; - // the refund address for unspent fees - string refund_address = 2 [(gogoproto.moretags) = "yaml:\"refund_address\""]; - // optional list of relayers permitted to receive fees - repeated string relayers = 3; -} - -// PacketFees contains a list of type PacketFee -message PacketFees { - // list of packet fees - repeated PacketFee packet_fees = 1 [(gogoproto.moretags) = "yaml:\"packet_fees\"", (gogoproto.nullable) = false]; -} - -// IdentifiedPacketFees contains a list of type PacketFee and associated PacketId -message IdentifiedPacketFees { - // unique packet identifier comprised of the channel ID, port ID and sequence - ibc.core.channel.v1.PacketId packet_id = 1 - [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"packet_id\""]; - // list of packet fees - repeated PacketFee packet_fees = 2 [(gogoproto.moretags) = "yaml:\"packet_fees\"", (gogoproto.nullable) = false]; -} diff --git a/proto/ibc/applications/fee/v1/genesis.proto b/proto/ibc/applications/fee/v1/genesis.proto deleted file mode 100644 index 6bba6cf..0000000 --- a/proto/ibc/applications/fee/v1/genesis.proto +++ /dev/null @@ -1,66 +0,0 @@ -syntax = "proto3"; - -package ibc.applications.fee.v1; - -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types"; - -import "gogoproto/gogo.proto"; -import "ibc/applications/fee/v1/fee.proto"; -import "ibc/core/channel/v1/channel.proto"; - -// GenesisState defines the ICS29 fee middleware genesis state -message GenesisState { - // list of identified packet fees - repeated IdentifiedPacketFees identified_fees = 1 - [(gogoproto.moretags) = "yaml:\"identified_fees\"", (gogoproto.nullable) = false]; - // list of fee enabled channels - repeated FeeEnabledChannel fee_enabled_channels = 2 - [(gogoproto.moretags) = "yaml:\"fee_enabled_channels\"", (gogoproto.nullable) = false]; - // list of registered payees - repeated RegisteredPayee registered_payees = 3 - [(gogoproto.moretags) = "yaml:\"registered_payees\"", (gogoproto.nullable) = false]; - // list of registered counterparty payees - repeated RegisteredCounterpartyPayee registered_counterparty_payees = 4 - [(gogoproto.moretags) = "yaml:\"registered_counterparty_payees\"", (gogoproto.nullable) = false]; - // list of forward relayer addresses - repeated ForwardRelayerAddress forward_relayers = 5 - [(gogoproto.moretags) = "yaml:\"forward_relayers\"", (gogoproto.nullable) = false]; -} - -// FeeEnabledChannel contains the PortID & ChannelID for a fee enabled channel -message FeeEnabledChannel { - // unique port identifier - string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""]; - // unique channel identifier - string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""]; -} - -// RegisteredPayee contains the relayer address and payee address for a specific channel -message RegisteredPayee { - // unique channel identifier - string channel_id = 1 [(gogoproto.moretags) = "yaml:\"channel_id\""]; - // the relayer address - string relayer = 2; - // the payee address - string payee = 3; -} - -// RegisteredCounterpartyPayee contains the relayer address and counterparty payee address for a specific channel (used -// for recv fee distribution) -message RegisteredCounterpartyPayee { - // unique channel identifier - string channel_id = 1 [(gogoproto.moretags) = "yaml:\"channel_id\""]; - // the relayer address - string relayer = 2; - // the counterparty payee address - string counterparty_payee = 3 [(gogoproto.moretags) = "yaml:\"counterparty_payee\""]; -} - -// ForwardRelayerAddress contains the forward relayer address and PacketId used for async acknowledgements -message ForwardRelayerAddress { - // the forward relayer address - string address = 1; - // unique packet identifer comprised of the channel ID, port ID and sequence - ibc.core.channel.v1.PacketId packet_id = 2 - [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"packet_id\""]; -} diff --git a/proto/ibc/applications/fee/v1/metadata.proto b/proto/ibc/applications/fee/v1/metadata.proto deleted file mode 100644 index 0c0a72c..0000000 --- a/proto/ibc/applications/fee/v1/metadata.proto +++ /dev/null @@ -1,16 +0,0 @@ -syntax = "proto3"; - -package ibc.applications.fee.v1; - -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types"; - -import "gogoproto/gogo.proto"; - -// Metadata defines the ICS29 channel specific metadata encoded into the channel version bytestring -// See ICS004: https://github.com/cosmos/ibc/tree/master/spec/core/ics-004-channel-and-packet-semantics#Versioning -message Metadata { - // fee_version defines the ICS29 fee version - string fee_version = 1 [(gogoproto.moretags) = "yaml:\"fee_version\""]; - // app_version defines the underlying application version, which may or may not be a JSON encoded bytestring - string app_version = 2 [(gogoproto.moretags) = "yaml:\"app_version\""]; -} diff --git a/proto/ibc/applications/fee/v1/query.proto b/proto/ibc/applications/fee/v1/query.proto deleted file mode 100644 index 871cfda..0000000 --- a/proto/ibc/applications/fee/v1/query.proto +++ /dev/null @@ -1,222 +0,0 @@ -syntax = "proto3"; - -package ibc.applications.fee.v1; - -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types"; - -import "gogoproto/gogo.proto"; -import "google/api/annotations.proto"; -import "cosmos/base/v1beta1/coin.proto"; -import "cosmos/base/query/v1beta1/pagination.proto"; -import "ibc/applications/fee/v1/fee.proto"; -import "ibc/applications/fee/v1/genesis.proto"; -import "ibc/core/channel/v1/channel.proto"; - -// Query defines the ICS29 gRPC querier service. -service Query { - // IncentivizedPackets returns all incentivized packets and their associated fees - rpc IncentivizedPackets(QueryIncentivizedPacketsRequest) returns (QueryIncentivizedPacketsResponse) { - option (google.api.http).get = "/ibc/apps/fee/v1/incentivized_packets"; - } - - // IncentivizedPacket returns all packet fees for a packet given its identifier - rpc IncentivizedPacket(QueryIncentivizedPacketRequest) returns (QueryIncentivizedPacketResponse) { - option (google.api.http).get = - "/ibc/apps/fee/v1/channels/{packet_id.channel_id}/ports/{packet_id.port_id}/sequences/" - "{packet_id.sequence}/incentivized_packet"; - } - - // Gets all incentivized packets for a specific channel - rpc IncentivizedPacketsForChannel(QueryIncentivizedPacketsForChannelRequest) - returns (QueryIncentivizedPacketsForChannelResponse) { - option (google.api.http).get = "/ibc/apps/fee/v1/channels/{channel_id}/ports/{port_id}/incentivized_packets"; - } - - // TotalRecvFees returns the total receive fees for a packet given its identifier - rpc TotalRecvFees(QueryTotalRecvFeesRequest) returns (QueryTotalRecvFeesResponse) { - option (google.api.http).get = "/ibc/apps/fee/v1/channels/{packet_id.channel_id}/ports/{packet_id.port_id}/" - "sequences/{packet_id.sequence}/total_recv_fees"; - } - - // TotalAckFees returns the total acknowledgement fees for a packet given its identifier - rpc TotalAckFees(QueryTotalAckFeesRequest) returns (QueryTotalAckFeesResponse) { - option (google.api.http).get = "/ibc/apps/fee/v1/channels/{packet_id.channel_id}/ports/{packet_id.port_id}/" - "sequences/{packet_id.sequence}/total_ack_fees"; - } - - // TotalTimeoutFees returns the total timeout fees for a packet given its identifier - rpc TotalTimeoutFees(QueryTotalTimeoutFeesRequest) returns (QueryTotalTimeoutFeesResponse) { - option (google.api.http).get = "/ibc/apps/fee/v1/channels/{packet_id.channel_id}/ports/{packet_id.port_id}/" - "sequences/{packet_id.sequence}/total_timeout_fees"; - } - - // Payee returns the registered payee address for a specific channel given the relayer address - rpc Payee(QueryPayeeRequest) returns (QueryPayeeResponse) { - option (google.api.http).get = "/ibc/apps/fee/v1/channels/{channel_id}/relayers/{relayer}/payee"; - } - - // CounterpartyPayee returns the registered counterparty payee for forward relaying - rpc CounterpartyPayee(QueryCounterpartyPayeeRequest) returns (QueryCounterpartyPayeeResponse) { - option (google.api.http).get = "/ibc/apps/fee/v1/channels/{channel_id}/relayers/{relayer}/counterparty_payee"; - } - - // FeeEnabledChannels returns a list of all fee enabled channels - rpc FeeEnabledChannels(QueryFeeEnabledChannelsRequest) returns (QueryFeeEnabledChannelsResponse) { - option (google.api.http).get = "/ibc/apps/fee/v1/fee_enabled"; - } - - // FeeEnabledChannel returns true if the provided port and channel identifiers belong to a fee enabled channel - rpc FeeEnabledChannel(QueryFeeEnabledChannelRequest) returns (QueryFeeEnabledChannelResponse) { - option (google.api.http).get = "/ibc/apps/fee/v1/channels/{channel_id}/ports/{port_id}/fee_enabled"; - } -} - -// QueryIncentivizedPacketsRequest defines the request type for the IncentivizedPackets rpc -message QueryIncentivizedPacketsRequest { - // pagination defines an optional pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 1; - // block height at which to query - uint64 query_height = 2; -} - -// QueryIncentivizedPacketsResponse defines the response type for the IncentivizedPackets rpc -message QueryIncentivizedPacketsResponse { - // list of identified fees for incentivized packets - repeated ibc.applications.fee.v1.IdentifiedPacketFees incentivized_packets = 1 [(gogoproto.nullable) = false]; -} - -// QueryIncentivizedPacketRequest defines the request type for the IncentivizedPacket rpc -message QueryIncentivizedPacketRequest { - // unique packet identifier comprised of channel ID, port ID and sequence - ibc.core.channel.v1.PacketId packet_id = 1 [(gogoproto.nullable) = false]; - // block height at which to query - uint64 query_height = 2; -} - -// QueryIncentivizedPacketsResponse defines the response type for the IncentivizedPacket rpc -message QueryIncentivizedPacketResponse { - // the identified fees for the incentivized packet - ibc.applications.fee.v1.IdentifiedPacketFees incentivized_packet = 1 [(gogoproto.nullable) = false]; -} - -// QueryIncentivizedPacketsForChannelRequest defines the request type for querying for all incentivized packets -// for a specific channel -message QueryIncentivizedPacketsForChannelRequest { - // pagination defines an optional pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 1; - string port_id = 2; - string channel_id = 3; - // Height to query at - uint64 query_height = 4; -} - -// QueryIncentivizedPacketsResponse defines the response type for the incentivized packets RPC -message QueryIncentivizedPacketsForChannelResponse { - // Map of all incentivized_packets - repeated ibc.applications.fee.v1.IdentifiedPacketFees incentivized_packets = 1; -} - -// QueryTotalRecvFeesRequest defines the request type for the TotalRecvFees rpc -message QueryTotalRecvFeesRequest { - // the packet identifier for the associated fees - ibc.core.channel.v1.PacketId packet_id = 1 [(gogoproto.nullable) = false]; -} - -// QueryTotalRecvFeesResponse defines the response type for the TotalRecvFees rpc -message QueryTotalRecvFeesResponse { - // the total packet receive fees - repeated cosmos.base.v1beta1.Coin recv_fees = 1 [ - (gogoproto.moretags) = "yaml:\"recv_fees\"", - (gogoproto.nullable) = false, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" - ]; -} - -// QueryTotalAckFeesRequest defines the request type for the TotalAckFees rpc -message QueryTotalAckFeesRequest { - // the packet identifier for the associated fees - ibc.core.channel.v1.PacketId packet_id = 1 [(gogoproto.nullable) = false]; -} - -// QueryTotalAckFeesResponse defines the response type for the TotalAckFees rpc -message QueryTotalAckFeesResponse { - // the total packet acknowledgement fees - repeated cosmos.base.v1beta1.Coin ack_fees = 1 [ - (gogoproto.moretags) = "yaml:\"ack_fees\"", - (gogoproto.nullable) = false, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" - ]; -} - -// QueryTotalTimeoutFeesRequest defines the request type for the TotalTimeoutFees rpc -message QueryTotalTimeoutFeesRequest { - // the packet identifier for the associated fees - ibc.core.channel.v1.PacketId packet_id = 1 [(gogoproto.nullable) = false]; -} - -// QueryTotalTimeoutFeesResponse defines the response type for the TotalTimeoutFees rpc -message QueryTotalTimeoutFeesResponse { - // the total packet timeout fees - repeated cosmos.base.v1beta1.Coin timeout_fees = 1 [ - (gogoproto.moretags) = "yaml:\"timeout_fees\"", - (gogoproto.nullable) = false, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" - ]; -} - -// QueryPayeeRequest defines the request type for the Payee rpc -message QueryPayeeRequest { - // unique channel identifier - string channel_id = 1 [(gogoproto.moretags) = "yaml:\"channel_id\""]; - // the relayer address to which the distribution address is registered - string relayer = 2; -} - -// QueryPayeeResponse defines the response type for the Payee rpc -message QueryPayeeResponse { - // the payee address to which packet fees are paid out - string payee_address = 1 [(gogoproto.moretags) = "yaml:\"payee_address\""]; -} - -// QueryCounterpartyPayeeRequest defines the request type for the CounterpartyPayee rpc -message QueryCounterpartyPayeeRequest { - // unique channel identifier - string channel_id = 1 [(gogoproto.moretags) = "yaml:\"channel_id\""]; - // the relayer address to which the counterparty is registered - string relayer = 2; -} - -// QueryCounterpartyPayeeResponse defines the response type for the CounterpartyPayee rpc -message QueryCounterpartyPayeeResponse { - // the counterparty payee address used to compensate forward relaying - string counterparty_payee = 1 [(gogoproto.moretags) = "yaml:\"counterparty_payee\""]; -} - -// QueryFeeEnabledChannelsRequest defines the request type for the FeeEnabledChannels rpc -message QueryFeeEnabledChannelsRequest { - // pagination defines an optional pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 1; - // block height at which to query - uint64 query_height = 2; -} - -// QueryFeeEnabledChannelsResponse defines the response type for the FeeEnabledChannels rpc -message QueryFeeEnabledChannelsResponse { - // list of fee enabled channels - repeated ibc.applications.fee.v1.FeeEnabledChannel fee_enabled_channels = 1 - [(gogoproto.moretags) = "yaml:\"fee_enabled_channels\"", (gogoproto.nullable) = false]; -} - -// QueryFeeEnabledChannelRequest defines the request type for the FeeEnabledChannel rpc -message QueryFeeEnabledChannelRequest { - // unique port identifier - string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""]; - // unique channel identifier - string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""]; -} - -// QueryFeeEnabledChannelResponse defines the response type for the FeeEnabledChannel rpc -message QueryFeeEnabledChannelResponse { - // boolean flag representing the fee enabled channel status - bool fee_enabled = 1 [(gogoproto.moretags) = "yaml:\"fee_enabled\""]; -} diff --git a/proto/ibc/applications/fee/v1/tx.proto b/proto/ibc/applications/fee/v1/tx.proto deleted file mode 100644 index 3a46de7..0000000 --- a/proto/ibc/applications/fee/v1/tx.proto +++ /dev/null @@ -1,112 +0,0 @@ -syntax = "proto3"; - -package ibc.applications.fee.v1; - -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types"; - -import "gogoproto/gogo.proto"; -import "ibc/applications/fee/v1/fee.proto"; -import "ibc/core/channel/v1/channel.proto"; - -// Msg defines the ICS29 Msg service. -service Msg { - // RegisterPayee defines a rpc handler method for MsgRegisterPayee - // RegisterPayee is called by the relayer on each channelEnd and allows them to set an optional - // payee to which reverse and timeout relayer packet fees will be paid out. The payee should be registered on - // the source chain from which packets originate as this is where fee distribution takes place. This function may be - // called more than once by a relayer, in which case, the latest payee is always used. - rpc RegisterPayee(MsgRegisterPayee) returns (MsgRegisterPayeeResponse); - - // RegisterCounterpartyPayee defines a rpc handler method for MsgRegisterCounterpartyPayee - // RegisterCounterpartyPayee is called by the relayer on each channelEnd and allows them to specify the counterparty - // payee address before relaying. This ensures they will be properly compensated for forward relaying since - // the destination chain must include the registered counterparty payee address in the acknowledgement. This function - // may be called more than once by a relayer, in which case, the latest counterparty payee address is always used. - rpc RegisterCounterpartyPayee(MsgRegisterCounterpartyPayee) returns (MsgRegisterCounterpartyPayeeResponse); - - // PayPacketFee defines a rpc handler method for MsgPayPacketFee - // PayPacketFee is an open callback that may be called by any module/user that wishes to escrow funds in order to - // incentivize the relaying of the packet at the next sequence - // NOTE: This method is intended to be used within a multi msg transaction, where the subsequent msg that follows - // initiates the lifecycle of the incentivized packet - rpc PayPacketFee(MsgPayPacketFee) returns (MsgPayPacketFeeResponse); - - // PayPacketFeeAsync defines a rpc handler method for MsgPayPacketFeeAsync - // PayPacketFeeAsync is an open callback that may be called by any module/user that wishes to escrow funds in order to - // incentivize the relaying of a known packet (i.e. at a particular sequence) - rpc PayPacketFeeAsync(MsgPayPacketFeeAsync) returns (MsgPayPacketFeeAsyncResponse); -} - -// MsgRegisterPayee defines the request type for the RegisterPayee rpc -message MsgRegisterPayee { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - // unique port identifier - string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""]; - // unique channel identifier - string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""]; - // the relayer address - string relayer = 3; - // the payee address - string payee = 4; -} - -// MsgRegisterPayeeResponse defines the response type for the RegisterPayee rpc -message MsgRegisterPayeeResponse {} - -// MsgRegisterCounterpartyPayee defines the request type for the RegisterCounterpartyPayee rpc -message MsgRegisterCounterpartyPayee { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - // unique port identifier - string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""]; - // unique channel identifier - string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""]; - // the relayer address - string relayer = 3; - // the counterparty payee address - string counterparty_payee = 4 [(gogoproto.moretags) = "yaml:\"counterparty_payee\""]; -} - -// MsgRegisterCounterpartyPayeeResponse defines the response type for the RegisterCounterpartyPayee rpc -message MsgRegisterCounterpartyPayeeResponse {} - -// MsgPayPacketFee defines the request type for the PayPacketFee rpc -// This Msg can be used to pay for a packet at the next sequence send & should be combined with the Msg that will be -// paid for -message MsgPayPacketFee { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - // fee encapsulates the recv, ack and timeout fees associated with an IBC packet - ibc.applications.fee.v1.Fee fee = 1 [(gogoproto.nullable) = false]; - // the source port unique identifier - string source_port_id = 2 [(gogoproto.moretags) = "yaml:\"source_port_id\""]; - // the source channel unique identifer - string source_channel_id = 3 [(gogoproto.moretags) = "yaml:\"source_channel_id\""]; - // account address to refund fee if necessary - string signer = 4; - // optional list of relayers permitted to the receive packet fees - repeated string relayers = 5; -} - -// MsgPayPacketFeeResponse defines the response type for the PayPacketFee rpc -message MsgPayPacketFeeResponse {} - -// MsgPayPacketFeeAsync defines the request type for the PayPacketFeeAsync rpc -// This Msg can be used to pay for a packet at a specified sequence (instead of the next sequence send) -message MsgPayPacketFeeAsync { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - // unique packet identifier comprised of the channel ID, port ID and sequence - ibc.core.channel.v1.PacketId packet_id = 1 - [(gogoproto.moretags) = "yaml:\"packet_id\"", (gogoproto.nullable) = false]; - // the packet fee associated with a particular IBC packet - PacketFee packet_fee = 2 [(gogoproto.moretags) = "yaml:\"packet_fee\"", (gogoproto.nullable) = false]; -} - -// MsgPayPacketFeeAsyncResponse defines the response type for the PayPacketFeeAsync rpc -message MsgPayPacketFeeAsyncResponse {} diff --git a/proto/ibc/applications/interchain_accounts/controller/v1/controller.proto b/proto/ibc/applications/interchain_accounts/controller/v1/controller.proto index a505b46..2cb37ed 100644 --- a/proto/ibc/applications/interchain_accounts/controller/v1/controller.proto +++ b/proto/ibc/applications/interchain_accounts/controller/v1/controller.proto @@ -2,13 +2,11 @@ syntax = "proto3"; package ibc.applications.interchain_accounts.controller.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types"; - -import "gogoproto/gogo.proto"; +option go_package = "github.com/cosmos/ibc-go/v10/modules/apps/27-interchain-accounts/controller/types"; // Params defines the set of on-chain interchain accounts parameters. // The following parameters may be used to disable the controller submodule. message Params { // controller_enabled enables or disables the controller submodule. - bool controller_enabled = 1 [(gogoproto.moretags) = "yaml:\"controller_enabled\""]; + bool controller_enabled = 1; } diff --git a/proto/ibc/applications/interchain_accounts/controller/v1/query.proto b/proto/ibc/applications/interchain_accounts/controller/v1/query.proto index 8c237a1..ecee046 100644 --- a/proto/ibc/applications/interchain_accounts/controller/v1/query.proto +++ b/proto/ibc/applications/interchain_accounts/controller/v1/query.proto @@ -2,10 +2,9 @@ syntax = "proto3"; package ibc.applications.interchain_accounts.controller.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types"; +option go_package = "github.com/cosmos/ibc-go/v10/modules/apps/27-interchain-accounts/controller/types"; import "ibc/applications/interchain_accounts/controller/v1/controller.proto"; -import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; // Query provides defines the gRPC querier service. @@ -25,7 +24,7 @@ service Query { // QueryInterchainAccountRequest is the request type for the Query/InterchainAccount RPC method. message QueryInterchainAccountRequest { string owner = 1; - string connection_id = 2 [(gogoproto.moretags) = "yaml:\"connection_id\""]; + string connection_id = 2; } // QueryInterchainAccountResponse the response type for the Query/InterchainAccount RPC method. diff --git a/proto/ibc/applications/interchain_accounts/controller/v1/tx.proto b/proto/ibc/applications/interchain_accounts/controller/v1/tx.proto index 284ffe7..8416a36 100644 --- a/proto/ibc/applications/interchain_accounts/controller/v1/tx.proto +++ b/proto/ibc/applications/interchain_accounts/controller/v1/tx.proto @@ -2,50 +2,81 @@ syntax = "proto3"; package ibc.applications.interchain_accounts.controller.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types"; +option go_package = "github.com/cosmos/ibc-go/v10/modules/apps/27-interchain-accounts/controller/types"; import "gogoproto/gogo.proto"; import "ibc/applications/interchain_accounts/v1/packet.proto"; +import "ibc/applications/interchain_accounts/controller/v1/controller.proto"; +import "cosmos/msg/v1/msg.proto"; +import "ibc/core/channel/v1/channel.proto"; // Msg defines the 27-interchain-accounts/controller Msg service. service Msg { + option (cosmos.msg.v1.service) = true; + // RegisterInterchainAccount defines a rpc handler for MsgRegisterInterchainAccount. rpc RegisterInterchainAccount(MsgRegisterInterchainAccount) returns (MsgRegisterInterchainAccountResponse); // SendTx defines a rpc handler for MsgSendTx. rpc SendTx(MsgSendTx) returns (MsgSendTxResponse); + // UpdateParams defines a rpc handler for MsgUpdateParams. + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); } // MsgRegisterInterchainAccount defines the payload for Msg/RegisterAccount message MsgRegisterInterchainAccount { - option (gogoproto.equal) = false; + option (cosmos.msg.v1.signer) = "owner"; + option (gogoproto.goproto_getters) = false; - string owner = 1; - string connection_id = 2 [(gogoproto.moretags) = "yaml:\"connection_id\""]; - string version = 3; + string owner = 1; + string connection_id = 2; + string version = 3; + ibc.core.channel.v1.Order ordering = 4; } // MsgRegisterInterchainAccountResponse defines the response for Msg/RegisterAccount message MsgRegisterInterchainAccountResponse { - string channel_id = 1 [(gogoproto.moretags) = "yaml:\"channel_id\""]; - string port_id = 2 [(gogoproto.moretags) = "yaml:\"port_id\""]; + option (gogoproto.goproto_getters) = false; + + string channel_id = 1; + string port_id = 2; } // MsgSendTx defines the payload for Msg/SendTx message MsgSendTx { - option (gogoproto.equal) = false; + option (cosmos.msg.v1.signer) = "owner"; + option (gogoproto.goproto_getters) = false; - string owner = 1; - string connection_id = 2 [(gogoproto.moretags) = "yaml:\"connection_id\""]; - ibc.applications.interchain_accounts.v1.InterchainAccountPacketData packet_data = 3 - [(gogoproto.moretags) = "yaml:\"packet_data\"", (gogoproto.nullable) = false]; + string owner = 1; + string connection_id = 2; + ibc.applications.interchain_accounts.v1.InterchainAccountPacketData packet_data = 3 [(gogoproto.nullable) = false]; // Relative timeout timestamp provided will be added to the current block time during transaction execution. // The timeout timestamp must be non-zero. - uint64 relative_timeout = 4 [(gogoproto.moretags) = "yaml:\"relative_timeout\""]; + uint64 relative_timeout = 4; } // MsgSendTxResponse defines the response for MsgSendTx message MsgSendTxResponse { + option (gogoproto.goproto_getters) = false; + uint64 sequence = 1; } + +// MsgUpdateParams defines the payload for Msg/UpdateParams +message MsgUpdateParams { + option (cosmos.msg.v1.signer) = "signer"; + + option (gogoproto.goproto_getters) = false; + + // signer address + string signer = 1; + + // params defines the 27-interchain-accounts/controller parameters to update. + // + // NOTE: All parameters must be supplied. + Params params = 2 [(gogoproto.nullable) = false]; +} + +// MsgUpdateParamsResponse defines the response for Msg/UpdateParams +message MsgUpdateParamsResponse {} diff --git a/proto/ibc/applications/interchain_accounts/genesis/v1/genesis.proto b/proto/ibc/applications/interchain_accounts/genesis/v1/genesis.proto index 2fed376..c4cd785 100644 --- a/proto/ibc/applications/interchain_accounts/genesis/v1/genesis.proto +++ b/proto/ibc/applications/interchain_accounts/genesis/v1/genesis.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.applications.interchain_accounts.genesis.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/genesis/types"; +option go_package = "github.com/cosmos/ibc-go/v10/modules/apps/27-interchain-accounts/genesis/types"; import "gogoproto/gogo.proto"; import "ibc/applications/interchain_accounts/controller/v1/controller.proto"; @@ -10,44 +10,38 @@ import "ibc/applications/interchain_accounts/host/v1/host.proto"; // GenesisState defines the interchain accounts genesis state message GenesisState { - ControllerGenesisState controller_genesis_state = 1 - [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"controller_genesis_state\""]; - HostGenesisState host_genesis_state = 2 - [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"host_genesis_state\""]; + ControllerGenesisState controller_genesis_state = 1 [(gogoproto.nullable) = false]; + HostGenesisState host_genesis_state = 2 [(gogoproto.nullable) = false]; } // ControllerGenesisState defines the interchain accounts controller genesis state message ControllerGenesisState { - repeated ActiveChannel active_channels = 1 - [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"active_channels\""]; - repeated RegisteredInterchainAccount interchain_accounts = 2 - [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"interchain_accounts\""]; - repeated string ports = 3; - ibc.applications.interchain_accounts.controller.v1.Params params = 4 [(gogoproto.nullable) = false]; + repeated ActiveChannel active_channels = 1 [(gogoproto.nullable) = false]; + repeated RegisteredInterchainAccount interchain_accounts = 2 [(gogoproto.nullable) = false]; + repeated string ports = 3; + ibc.applications.interchain_accounts.controller.v1.Params params = 4 [(gogoproto.nullable) = false]; } // HostGenesisState defines the interchain accounts host genesis state message HostGenesisState { - repeated ActiveChannel active_channels = 1 - [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"active_channels\""]; - repeated RegisteredInterchainAccount interchain_accounts = 2 - [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"interchain_accounts\""]; - string port = 3; - ibc.applications.interchain_accounts.host.v1.Params params = 4 [(gogoproto.nullable) = false]; + repeated ActiveChannel active_channels = 1 [(gogoproto.nullable) = false]; + repeated RegisteredInterchainAccount interchain_accounts = 2 [(gogoproto.nullable) = false]; + string port = 3; + ibc.applications.interchain_accounts.host.v1.Params params = 4 [(gogoproto.nullable) = false]; } // ActiveChannel contains a connection ID, port ID and associated active channel ID, as well as a boolean flag to // indicate if the channel is middleware enabled message ActiveChannel { - string connection_id = 1 [(gogoproto.moretags) = "yaml:\"connection_id\""]; - string port_id = 2 [(gogoproto.moretags) = "yaml:\"port_id\""]; - string channel_id = 3 [(gogoproto.moretags) = "yaml:\"channel_id\""]; - bool is_middleware_enabled = 4 [(gogoproto.moretags) = "yaml:\"is_middleware_enabled\""]; + string connection_id = 1; + string port_id = 2; + string channel_id = 3; + bool is_middleware_enabled = 4; } // RegisteredInterchainAccount contains a connection ID, port ID and associated interchain account address message RegisteredInterchainAccount { - string connection_id = 1 [(gogoproto.moretags) = "yaml:\"connection_id\""]; - string port_id = 2 [(gogoproto.moretags) = "yaml:\"port_id\""]; - string account_address = 3 [(gogoproto.moretags) = "yaml:\"account_address\""]; -} \ No newline at end of file + string connection_id = 1; + string port_id = 2; + string account_address = 3; +} diff --git a/proto/ibc/applications/interchain_accounts/host/v1/host.proto b/proto/ibc/applications/interchain_accounts/host/v1/host.proto index 18cc1d1..580d88e 100644 --- a/proto/ibc/applications/interchain_accounts/host/v1/host.proto +++ b/proto/ibc/applications/interchain_accounts/host/v1/host.proto @@ -2,15 +2,24 @@ syntax = "proto3"; package ibc.applications.interchain_accounts.host.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types"; - -import "gogoproto/gogo.proto"; +option go_package = "github.com/cosmos/ibc-go/v10/modules/apps/27-interchain-accounts/host/types"; // Params defines the set of on-chain interchain accounts parameters. // The following parameters may be used to disable the host submodule. message Params { // host_enabled enables or disables the host submodule. - bool host_enabled = 1 [(gogoproto.moretags) = "yaml:\"host_enabled\""]; + bool host_enabled = 1; // allow_messages defines a list of sdk message typeURLs allowed to be executed on a host chain. - repeated string allow_messages = 2 [(gogoproto.moretags) = "yaml:\"allow_messages\""]; + repeated string allow_messages = 2; +} + +// QueryRequest defines the parameters for a particular query request +// by an interchain account. +message QueryRequest { + // path defines the path of the query request as defined by ADR-021. + // https://github.com/cosmos/cosmos-sdk/blob/main/docs/architecture/adr-021-protobuf-query-encoding.md#custom-query-registration-and-routing + string path = 1; + // data defines the payload of the query request as defined by ADR-021. + // https://github.com/cosmos/cosmos-sdk/blob/main/docs/architecture/adr-021-protobuf-query-encoding.md#custom-query-registration-and-routing + bytes data = 2; } diff --git a/proto/ibc/applications/interchain_accounts/host/v1/query.proto b/proto/ibc/applications/interchain_accounts/host/v1/query.proto index b89ed8e..346288c 100644 --- a/proto/ibc/applications/interchain_accounts/host/v1/query.proto +++ b/proto/ibc/applications/interchain_accounts/host/v1/query.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.applications.interchain_accounts.host.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types"; +option go_package = "github.com/cosmos/ibc-go/v10/modules/apps/27-interchain-accounts/host/types"; import "google/api/annotations.proto"; import "ibc/applications/interchain_accounts/host/v1/host.proto"; diff --git a/proto/ibc/applications/interchain_accounts/host/v1/tx.proto b/proto/ibc/applications/interchain_accounts/host/v1/tx.proto new file mode 100644 index 0000000..29eea2e --- /dev/null +++ b/proto/ibc/applications/interchain_accounts/host/v1/tx.proto @@ -0,0 +1,60 @@ +syntax = "proto3"; + +package ibc.applications.interchain_accounts.host.v1; + +option go_package = "github.com/cosmos/ibc-go/v10/modules/apps/27-interchain-accounts/host/types"; + +import "gogoproto/gogo.proto"; +import "cosmos/msg/v1/msg.proto"; +import "ibc/applications/interchain_accounts/host/v1/host.proto"; + +// Msg defines the 27-interchain-accounts/host Msg service. +service Msg { + option (cosmos.msg.v1.service) = true; + + // UpdateParams defines a rpc handler for MsgUpdateParams. + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); + + // ModuleQuerySafe defines a rpc handler for MsgModuleQuerySafe. + rpc ModuleQuerySafe(MsgModuleQuerySafe) returns (MsgModuleQuerySafeResponse); +} + +// MsgUpdateParams defines the payload for Msg/UpdateParams +message MsgUpdateParams { + option (cosmos.msg.v1.signer) = "signer"; + + option (gogoproto.goproto_getters) = false; + + // signer address + string signer = 1; + + // params defines the 27-interchain-accounts/host parameters to update. + // + // NOTE: All parameters must be supplied. + Params params = 2 [(gogoproto.nullable) = false]; +} + +// MsgUpdateParamsResponse defines the response for Msg/UpdateParams +message MsgUpdateParamsResponse {} + +// MsgModuleQuerySafe defines the payload for Msg/ModuleQuerySafe +message MsgModuleQuerySafe { + option (cosmos.msg.v1.signer) = "signer"; + + option (gogoproto.goproto_getters) = false; + + // signer address + string signer = 1; + + // requests defines the module safe queries to execute. + repeated QueryRequest requests = 2 [(gogoproto.nullable) = false]; +} + +// MsgModuleQuerySafeResponse defines the response for Msg/ModuleQuerySafe +message MsgModuleQuerySafeResponse { + // height at which the responses were queried + uint64 height = 1; + + // protobuf encoded responses for each query + repeated bytes responses = 2; +} diff --git a/proto/ibc/applications/interchain_accounts/v1/account.proto b/proto/ibc/applications/interchain_accounts/v1/account.proto index d60c27a..7ef67a1 100644 --- a/proto/ibc/applications/interchain_accounts/v1/account.proto +++ b/proto/ibc/applications/interchain_accounts/v1/account.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.applications.interchain_accounts.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types"; +option go_package = "github.com/cosmos/ibc-go/v10/modules/apps/27-interchain-accounts/types"; import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; @@ -14,7 +14,6 @@ message InterchainAccount { option (gogoproto.goproto_stringer) = false; option (cosmos_proto.implements_interface) = "ibc.applications.interchain_accounts.v1.InterchainAccountI"; - cosmos.auth.v1beta1.BaseAccount base_account = 1 - [(gogoproto.embed) = true, (gogoproto.moretags) = "yaml:\"base_account\""]; - string account_owner = 2 [(gogoproto.moretags) = "yaml:\"account_owner\""]; + cosmos.auth.v1beta1.BaseAccount base_account = 1 [(gogoproto.embed) = true]; + string account_owner = 2; } diff --git a/proto/ibc/applications/interchain_accounts/v1/metadata.proto b/proto/ibc/applications/interchain_accounts/v1/metadata.proto index 9ea7eec..38b9de8 100644 --- a/proto/ibc/applications/interchain_accounts/v1/metadata.proto +++ b/proto/ibc/applications/interchain_accounts/v1/metadata.proto @@ -2,9 +2,7 @@ syntax = "proto3"; package ibc.applications.interchain_accounts.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types"; - -import "gogoproto/gogo.proto"; +option go_package = "github.com/cosmos/ibc-go/v10/modules/apps/27-interchain-accounts/types"; // Metadata defines a set of protocol specific data encoded into the ICS27 channel version bytestring // See ICS004: https://github.com/cosmos/ibc/tree/master/spec/core/ics-004-channel-and-packet-semantics#Versioning @@ -12,9 +10,9 @@ message Metadata { // version defines the ICS27 protocol version string version = 1; // controller_connection_id is the connection identifier associated with the controller chain - string controller_connection_id = 2 [(gogoproto.moretags) = "yaml:\"controller_connection_id\""]; + string controller_connection_id = 2; // host_connection_id is the connection identifier associated with the host chain - string host_connection_id = 3 [(gogoproto.moretags) = "yaml:\"host_connection_id\""]; + string host_connection_id = 3; // address defines the interchain account address to be fulfilled upon the OnChanOpenTry handshake step // NOTE: the address field is empty on the OnChanOpenInit handshake step string address = 4; diff --git a/proto/ibc/applications/interchain_accounts/v1/packet.proto b/proto/ibc/applications/interchain_accounts/v1/packet.proto index d2dcf51..4da358d 100644 --- a/proto/ibc/applications/interchain_accounts/v1/packet.proto +++ b/proto/ibc/applications/interchain_accounts/v1/packet.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.applications.interchain_accounts.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types"; +option go_package = "github.com/cosmos/ibc-go/v10/modules/apps/27-interchain-accounts/types"; import "google/protobuf/any.proto"; import "gogoproto/gogo.proto"; diff --git a/proto/ibc/applications/transfer/v1/authz.proto b/proto/ibc/applications/transfer/v1/authz.proto index 8b27ac9..4ffa268 100644 --- a/proto/ibc/applications/transfer/v1/authz.proto +++ b/proto/ibc/applications/transfer/v1/authz.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.applications.transfer.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types"; +option go_package = "github.com/cosmos/ibc-go/v10/modules/apps/transfer/types"; import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; @@ -11,14 +11,17 @@ import "cosmos/base/v1beta1/coin.proto"; // Allocation defines the spend limit for a particular port and channel message Allocation { // the port on which the packet will be sent - string source_port = 1 [(gogoproto.moretags) = "yaml:\"source_port\""]; + string source_port = 1; // the channel by which the packet will be sent - string source_channel = 2 [(gogoproto.moretags) = "yaml:\"source_channel\""]; + string source_channel = 2; // spend limitation on the channel repeated cosmos.base.v1beta1.Coin spend_limit = 3 [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; // allow list of receivers, an empty allow list permits any receiver address repeated string allow_list = 4; + // allow list of memo strings, an empty list prohibits all memo strings; + // a list only with "*" permits any memo string + repeated string allowed_packet_data = 5; } // TransferAuthorization allows the grantee to spend up to spend_limit coins from diff --git a/proto/ibc/applications/transfer/v1/denomtrace.proto b/proto/ibc/applications/transfer/v1/denomtrace.proto new file mode 100644 index 0000000..3aef3a8 --- /dev/null +++ b/proto/ibc/applications/transfer/v1/denomtrace.proto @@ -0,0 +1,16 @@ +syntax = "proto3"; + +package ibc.applications.transfer.v1; + +option go_package = "github.com/cosmos/ibc-go/v10/modules/apps/transfer/types"; + +// DenomTrace contains the base denomination for ICS20 fungible tokens and the +// source tracing information path. +message DenomTrace { + option deprecated = true; + // path defines the chain of port/channel identifiers used for tracing the + // source of the fungible token. + string path = 1; + // base denomination of the relayed fungible token. + string base_denom = 2; +} diff --git a/proto/ibc/applications/transfer/v1/genesis.proto b/proto/ibc/applications/transfer/v1/genesis.proto index b3f013e..6d5a5ca 100644 --- a/proto/ibc/applications/transfer/v1/genesis.proto +++ b/proto/ibc/applications/transfer/v1/genesis.proto @@ -2,26 +2,20 @@ syntax = "proto3"; package ibc.applications.transfer.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types"; +option go_package = "github.com/cosmos/ibc-go/v10/modules/apps/transfer/types"; import "ibc/applications/transfer/v1/transfer.proto"; +import "ibc/applications/transfer/v1/token.proto"; import "cosmos/base/v1beta1/coin.proto"; import "gogoproto/gogo.proto"; // GenesisState defines the ibc-transfer genesis state message GenesisState { - string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""]; - repeated DenomTrace denom_traces = 2 [ - (gogoproto.castrepeated) = "Traces", - (gogoproto.nullable) = false, - (gogoproto.moretags) = "yaml:\"denom_traces\"" - ]; - Params params = 3 [(gogoproto.nullable) = false]; + string port_id = 1; + repeated Denom denoms = 2 [(gogoproto.castrepeated) = "Denoms", (gogoproto.nullable) = false]; + ibc.applications.transfer.v1.Params params = 3 [(gogoproto.nullable) = false]; // total_escrowed contains the total amount of tokens escrowed // by the transfer module - repeated cosmos.base.v1beta1.Coin total_escrowed = 4 [ - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", - (gogoproto.nullable) = false, - (gogoproto.moretags) = "yaml:\"total_escrowed\"" - ]; + repeated cosmos.base.v1beta1.Coin total_escrowed = 4 + [(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", (gogoproto.nullable) = false]; } diff --git a/proto/ibc/applications/transfer/v2/packet.proto b/proto/ibc/applications/transfer/v1/packet.proto similarity index 82% rename from proto/ibc/applications/transfer/v2/packet.proto rename to proto/ibc/applications/transfer/v1/packet.proto index 7dc3134..d7ecb32 100644 --- a/proto/ibc/applications/transfer/v2/packet.proto +++ b/proto/ibc/applications/transfer/v1/packet.proto @@ -1,8 +1,8 @@ syntax = "proto3"; -package ibc.applications.transfer.v2; +package ibc.applications.transfer.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types"; +option go_package = "github.com/cosmos/ibc-go/v10/modules/apps/transfer/types"; // FungibleTokenPacketData defines a struct for the packet payload // See FungibleTokenPacketData spec: diff --git a/proto/ibc/applications/transfer/v1/query.proto b/proto/ibc/applications/transfer/v1/query.proto index ff56cc3..0087124 100644 --- a/proto/ibc/applications/transfer/v1/query.proto +++ b/proto/ibc/applications/transfer/v1/query.proto @@ -4,27 +4,28 @@ package ibc.applications.transfer.v1; import "gogoproto/gogo.proto"; import "cosmos/base/v1beta1/coin.proto"; -import "cosmos/base/query/v1beta1/pagination.proto"; import "ibc/applications/transfer/v1/transfer.proto"; +import "ibc/applications/transfer/v1/token.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; import "google/api/annotations.proto"; -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types"; +option go_package = "github.com/cosmos/ibc-go/v10/modules/apps/transfer/types"; // Query provides defines the gRPC querier service. service Query { - // DenomTrace queries a denomination trace information. - rpc DenomTrace(QueryDenomTraceRequest) returns (QueryDenomTraceResponse) { - option (google.api.http).get = "/ibc/apps/transfer/v1/denom_traces/{hash=**}"; + // Params queries all parameters of the ibc-transfer module. + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/ibc/apps/transfer/v1/params"; } - // DenomTraces queries all denomination traces. - rpc DenomTraces(QueryDenomTracesRequest) returns (QueryDenomTracesResponse) { - option (google.api.http).get = "/ibc/apps/transfer/v1/denom_traces"; + // Denoms queries all denominations + rpc Denoms(QueryDenomsRequest) returns (QueryDenomsResponse) { + option (google.api.http).get = "/ibc/apps/transfer/v1/denoms"; } - // Params queries all parameters of the ibc-transfer module. - rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/ibc/apps/transfer/v1/params"; + // Denom queries a denomination + rpc Denom(QueryDenomRequest) returns (QueryDenomResponse) { + option (google.api.http).get = "/ibc/apps/transfer/v1/denoms/{hash=**}"; } // DenomHash queries a denomination hash information. @@ -43,45 +44,45 @@ service Query { } } -// QueryDenomTraceRequest is the request type for the Query/DenomTrace RPC +// QueryParamsRequest is the request type for the Query/Params RPC method. +message QueryParamsRequest {} + +// QueryParamsResponse is the response type for the Query/Params RPC method. +message QueryParamsResponse { + // params defines the parameters of the module. + Params params = 1; +} + +// QueryDenomRequest is the request type for the Query/Denom RPC // method -message QueryDenomTraceRequest { - // hash (in hex format) or denom (full denom with ibc prefix) of the denomination trace information. +message QueryDenomRequest { + // hash (in hex format) or denom (full denom with ibc prefix) of the on chain denomination. string hash = 1; } -// QueryDenomTraceResponse is the response type for the Query/DenomTrace RPC +// QueryDenomResponse is the response type for the Query/Denom RPC // method. -message QueryDenomTraceResponse { - // denom_trace returns the requested denomination trace information. - DenomTrace denom_trace = 1; +message QueryDenomResponse { + // denom returns the requested denomination. + Denom denom = 1; } -// QueryConnectionsRequest is the request type for the Query/DenomTraces RPC +// QueryDenomsRequest is the request type for the Query/Denoms RPC // method -message QueryDenomTracesRequest { +message QueryDenomsRequest { // pagination defines an optional pagination for the request. cosmos.base.query.v1beta1.PageRequest pagination = 1; } -// QueryConnectionsResponse is the response type for the Query/DenomTraces RPC +// QueryDenomsResponse is the response type for the Query/Denoms RPC // method. -message QueryDenomTracesResponse { - // denom_traces returns all denominations trace information. - repeated DenomTrace denom_traces = 1 [(gogoproto.castrepeated) = "Traces", (gogoproto.nullable) = false]; +message QueryDenomsResponse { + // denoms returns all denominations. + repeated Denom denoms = 1 [(gogoproto.castrepeated) = "Denoms", (gogoproto.nullable) = false]; // pagination defines the pagination in the response. cosmos.base.query.v1beta1.PageResponse pagination = 2; } -// QueryParamsRequest is the request type for the Query/Params RPC method. -message QueryParamsRequest {} - -// QueryParamsResponse is the response type for the Query/Params RPC method. -message QueryParamsResponse { - // params defines the parameters of the module. - Params params = 1; -} - // QueryDenomHashRequest is the request type for the Query/DenomHash RPC // method message QueryDenomHashRequest { diff --git a/proto/ibc/applications/transfer/v1/token.proto b/proto/ibc/applications/transfer/v1/token.proto new file mode 100644 index 0000000..1ded9ba --- /dev/null +++ b/proto/ibc/applications/transfer/v1/token.proto @@ -0,0 +1,24 @@ +syntax = "proto3"; + +package ibc.applications.transfer.v1; + +option go_package = "github.com/cosmos/ibc-go/v10/modules/apps/transfer/types"; + +import "ibc/applications/transfer/v1/transfer.proto"; +import "gogoproto/gogo.proto"; + +// Token defines a struct which represents a token to be transferred. +message Token { + // the token denomination + Denom denom = 1 [(gogoproto.nullable) = false]; + // the token amount to be transferred + string amount = 2; +} + +// Denom holds the base denom of a Token and a trace of the chains it was sent through. +message Denom { + // the base token denomination + string base = 1; + // the trace of the token + repeated ibc.applications.transfer.v1.Hop trace = 3 [(gogoproto.nullable) = false]; +} diff --git a/proto/ibc/applications/transfer/v1/transfer.proto b/proto/ibc/applications/transfer/v1/transfer.proto index 2171074..eec1761 100644 --- a/proto/ibc/applications/transfer/v1/transfer.proto +++ b/proto/ibc/applications/transfer/v1/transfer.proto @@ -2,19 +2,9 @@ syntax = "proto3"; package ibc.applications.transfer.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types"; - import "gogoproto/gogo.proto"; -// DenomTrace contains the base denomination for ICS20 fungible tokens and the -// source tracing information path. -message DenomTrace { - // path defines the chain of port/channel identifiers used for tracing the - // source of the fungible token. - string path = 1; - // base denomination of the relayed fungible token. - string base_denom = 2; -} +option go_package = "github.com/cosmos/ibc-go/v10/modules/apps/transfer/types"; // Params defines the set of IBC transfer parameters. // NOTE: To prevent a single token from being transferred, set the @@ -23,8 +13,16 @@ message DenomTrace { message Params { // send_enabled enables or disables all cross-chain token transfers from this // chain. - bool send_enabled = 1 [(gogoproto.moretags) = "yaml:\"send_enabled\""]; + bool send_enabled = 1; // receive_enabled enables or disables all cross-chain token transfers to this // chain. - bool receive_enabled = 2 [(gogoproto.moretags) = "yaml:\"receive_enabled\""]; + bool receive_enabled = 2; +} + +// Hop defines a port ID, channel ID pair specifying where tokens must be forwarded +// next in a multihop transfer. +message Hop { + option (gogoproto.goproto_stringer) = false; + string port_id = 1; + string channel_id = 2; } diff --git a/proto/ibc/applications/transfer/v1/tx.proto b/proto/ibc/applications/transfer/v1/tx.proto index 1c67aaf..e1a6a1f 100644 --- a/proto/ibc/applications/transfer/v1/tx.proto +++ b/proto/ibc/applications/transfer/v1/tx.proto @@ -2,48 +2,82 @@ syntax = "proto3"; package ibc.applications.transfer.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types"; +option go_package = "github.com/cosmos/ibc-go/v10/modules/apps/transfer/types"; +import "amino/amino.proto"; import "gogoproto/gogo.proto"; +import "cosmos/msg/v1/msg.proto"; import "cosmos/base/v1beta1/coin.proto"; import "ibc/core/client/v1/client.proto"; +import "ibc/applications/transfer/v1/transfer.proto"; // Msg defines the ibc/transfer Msg service. service Msg { + option (cosmos.msg.v1.service) = true; + // Transfer defines a rpc handler method for MsgTransfer. rpc Transfer(MsgTransfer) returns (MsgTransferResponse); + + // UpdateParams defines a rpc handler for MsgUpdateParams. + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); } // MsgTransfer defines a msg to transfer fungible tokens (i.e Coins) between // ICS20 enabled chains. See ICS Spec here: // https://github.com/cosmos/ibc/tree/master/spec/app/ics-020-fungible-token-transfer#data-structures message MsgTransfer { - option (gogoproto.equal) = false; + option (amino.name) = "cosmos-sdk/MsgTransfer"; + option (cosmos.msg.v1.signer) = "sender"; + option (gogoproto.goproto_getters) = false; // the port on which the packet will be sent - string source_port = 1 [(gogoproto.moretags) = "yaml:\"source_port\""]; + string source_port = 1; // the channel by which the packet will be sent - string source_channel = 2 [(gogoproto.moretags) = "yaml:\"source_channel\""]; - // the tokens to be transferred - cosmos.base.v1beta1.Coin token = 3 [(gogoproto.nullable) = false]; + string source_channel = 2; + // token to be transferred + cosmos.base.v1beta1.Coin token = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // the sender address string sender = 4; // the recipient address on the destination chain string receiver = 5; // Timeout height relative to the current block height. - // The timeout is disabled when set to 0. - ibc.core.client.v1.Height timeout_height = 6 - [(gogoproto.moretags) = "yaml:\"timeout_height\"", (gogoproto.nullable) = false]; + // If you are sending with IBC v1 protocol, either timeout_height or timeout_timestamp must be set. + // If you are sending with IBC v2 protocol, timeout_timestamp must be set, and timeout_height must be omitted. + ibc.core.client.v1.Height timeout_height = 6 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // Timeout timestamp in absolute nanoseconds since unix epoch. - // The timeout is disabled when set to 0. - uint64 timeout_timestamp = 7 [(gogoproto.moretags) = "yaml:\"timeout_timestamp\""]; + // If you are sending with IBC v1 protocol, either timeout_height or timeout_timestamp must be set. + // If you are sending with IBC v2 protocol, timeout_timestamp must be set. + uint64 timeout_timestamp = 7; // optional memo string memo = 8; + // optional encoding + string encoding = 9; } // MsgTransferResponse defines the Msg/Transfer response type. message MsgTransferResponse { + option (gogoproto.goproto_getters) = false; + // sequence number of the transfer packet sent uint64 sequence = 1; } + +// MsgUpdateParams is the Msg/UpdateParams request type. +message MsgUpdateParams { + option (cosmos.msg.v1.signer) = "signer"; + + option (gogoproto.goproto_getters) = false; + + // signer address + string signer = 1; + + // params defines the transfer parameters to update. + // + // NOTE: All parameters must be supplied. + Params params = 2 [(gogoproto.nullable) = false]; +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +message MsgUpdateParamsResponse {} diff --git a/proto/ibc/core/channel/v1/channel.proto b/proto/ibc/core/channel/v1/channel.proto index 5fbb0d4..b37cf97 100644 --- a/proto/ibc/core/channel/v1/channel.proto +++ b/proto/ibc/core/channel/v1/channel.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.channel.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"; +option go_package = "github.com/cosmos/ibc-go/v10/modules/core/04-channel/types"; import "gogoproto/gogo.proto"; import "ibc/core/client/v1/client.proto"; @@ -21,7 +21,7 @@ message Channel { Counterparty counterparty = 3 [(gogoproto.nullable) = false]; // list of connection identifiers, in order, along which packets sent on // this channel will travel - repeated string connection_hops = 4 [(gogoproto.moretags) = "yaml:\"connection_hops\""]; + repeated string connection_hops = 4; // opaque channel version, which is agreed upon during the handshake string version = 5; } @@ -39,7 +39,7 @@ message IdentifiedChannel { Counterparty counterparty = 3 [(gogoproto.nullable) = false]; // list of connection identifiers, in order, along which packets sent on // this channel will travel - repeated string connection_hops = 4 [(gogoproto.moretags) = "yaml:\"connection_hops\""]; + repeated string connection_hops = 4; // opaque channel version, which is agreed upon during the handshake string version = 5; // port identifier @@ -49,7 +49,7 @@ message IdentifiedChannel { } // State defines if a channel is in one of the following states: -// CLOSED, INIT, TRYOPEN, OPEN or UNINITIALIZED. +// CLOSED, INIT, TRYOPEN, OPEN, or UNINITIALIZED. enum State { option (gogoproto.goproto_enum_prefix) = false; @@ -85,9 +85,9 @@ message Counterparty { option (gogoproto.goproto_getters) = false; // port on the counterparty chain which owns the other end of the channel. - string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""]; + string port_id = 1; // channel end on the counterparty chain - string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""]; + string channel_id = 2; } // Packet defines a type that carries data across different chains through IBC @@ -99,20 +99,19 @@ message Packet { // with a later sequence number. uint64 sequence = 1; // identifies the port on the sending chain. - string source_port = 2 [(gogoproto.moretags) = "yaml:\"source_port\""]; + string source_port = 2; // identifies the channel end on the sending chain. - string source_channel = 3 [(gogoproto.moretags) = "yaml:\"source_channel\""]; + string source_channel = 3; // identifies the port on the receiving chain. - string destination_port = 4 [(gogoproto.moretags) = "yaml:\"destination_port\""]; + string destination_port = 4; // identifies the channel end on the receiving chain. - string destination_channel = 5 [(gogoproto.moretags) = "yaml:\"destination_channel\""]; + string destination_channel = 5; // actual opaque bytes transferred directly to the application module bytes data = 6; // block height after which the packet times out - ibc.core.client.v1.Height timeout_height = 7 - [(gogoproto.moretags) = "yaml:\"timeout_height\"", (gogoproto.nullable) = false]; + ibc.core.client.v1.Height timeout_height = 7 [(gogoproto.nullable) = false]; // block timestamp (in nanoseconds) after which the packet times out - uint64 timeout_timestamp = 8 [(gogoproto.moretags) = "yaml:\"timeout_timestamp\""]; + uint64 timeout_timestamp = 8; } // PacketState defines the generic type necessary to retrieve and store @@ -123,25 +122,25 @@ message PacketState { option (gogoproto.goproto_getters) = false; // channel port identifier. - string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""]; + string port_id = 1; // channel unique identifier. - string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""]; + string channel_id = 2; // packet sequence. uint64 sequence = 3; // embedded data that represents packet state. bytes data = 4; } -// PacketId is an identifer for a unique Packet +// PacketId is an identifier for a unique Packet // Source chains refer to packets by source port/channel // Destination chains refer to packets by destination port/channel message PacketId { option (gogoproto.goproto_getters) = false; // channel port identifier - string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""]; + string port_id = 1; // channel unique identifier - string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""]; + string channel_id = 2; // packet sequence uint64 sequence = 3; } @@ -160,3 +159,13 @@ message Acknowledgement { string error = 22; } } + +// Timeout defines an execution deadline structure for 04-channel handlers. +// This includes packet lifecycle handlers. +// A valid Timeout contains either one or both of a timestamp and block height (sequence). +message Timeout { + // block height after which the packet times out + ibc.core.client.v1.Height height = 1 [(gogoproto.nullable) = false]; + // block timestamp (in nanoseconds) after which the packet times out + uint64 timestamp = 2; +} diff --git a/proto/ibc/core/channel/v1/genesis.proto b/proto/ibc/core/channel/v1/genesis.proto index 65cc928..f03e4db 100644 --- a/proto/ibc/core/channel/v1/genesis.proto +++ b/proto/ibc/core/channel/v1/genesis.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.channel.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"; +option go_package = "github.com/cosmos/ibc-go/v10/modules/core/04-channel/types"; import "gogoproto/gogo.proto"; import "ibc/core/channel/v1/channel.proto"; @@ -13,20 +13,17 @@ message GenesisState { repeated PacketState acknowledgements = 2 [(gogoproto.nullable) = false]; repeated PacketState commitments = 3 [(gogoproto.nullable) = false]; repeated PacketState receipts = 4 [(gogoproto.nullable) = false]; - repeated PacketSequence send_sequences = 5 - [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"send_sequences\""]; - repeated PacketSequence recv_sequences = 6 - [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"recv_sequences\""]; - repeated PacketSequence ack_sequences = 7 - [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"ack_sequences\""]; + repeated PacketSequence send_sequences = 5 [(gogoproto.nullable) = false]; + repeated PacketSequence recv_sequences = 6 [(gogoproto.nullable) = false]; + repeated PacketSequence ack_sequences = 7 [(gogoproto.nullable) = false]; // the sequence for the next generated channel identifier - uint64 next_channel_sequence = 8 [(gogoproto.moretags) = "yaml:\"next_channel_sequence\""]; + uint64 next_channel_sequence = 8; } // PacketSequence defines the genesis type necessary to retrieve and store // next send and receive sequences. message PacketSequence { - string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""]; - string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""]; + string port_id = 1; + string channel_id = 2; uint64 sequence = 3; } diff --git a/proto/ibc/core/channel/v1/query.proto b/proto/ibc/core/channel/v1/query.proto index 2d5bdb2..ca4041b 100644 --- a/proto/ibc/core/channel/v1/query.proto +++ b/proto/ibc/core/channel/v1/query.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.channel.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"; +option go_package = "github.com/cosmos/ibc-go/v10/modules/core/04-channel/types"; import "ibc/core/client/v1/client.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; @@ -98,6 +98,12 @@ service Query { option (google.api.http).get = "/ibc/core/channel/v1/channels/{channel_id}/" "ports/{port_id}/next_sequence"; } + + // NextSequenceSend returns the next send sequence for a given channel. + rpc NextSequenceSend(QueryNextSequenceSendRequest) returns (QueryNextSequenceSendResponse) { + option (google.api.http).get = "/ibc/core/channel/v1/channels/{channel_id}/" + "ports/{port_id}/next_sequence_send"; + } } // QueryChannelRequest is the request type for the Query/Channel RPC method @@ -364,7 +370,7 @@ message QueryNextSequenceReceiveRequest { string channel_id = 2; } -// QuerySequenceResponse is the request type for the +// QuerySequenceResponse is the response type for the // Query/QueryNextSequenceReceiveResponse RPC method message QueryNextSequenceReceiveResponse { // next sequence receive number @@ -374,3 +380,23 @@ message QueryNextSequenceReceiveResponse { // height at which the proof was retrieved ibc.core.client.v1.Height proof_height = 3 [(gogoproto.nullable) = false]; } + +// QueryNextSequenceSendRequest is the request type for the +// Query/QueryNextSequenceSend RPC method +message QueryNextSequenceSendRequest { + // port unique identifier + string port_id = 1; + // channel unique identifier + string channel_id = 2; +} + +// QueryNextSequenceSendResponse is the request type for the +// Query/QueryNextSequenceSend RPC method +message QueryNextSequenceSendResponse { + // next sequence send number + uint64 next_sequence_send = 1; + // merkle proof of existence + bytes proof = 2; + // height at which the proof was retrieved + ibc.core.client.v1.Height proof_height = 3 [(gogoproto.nullable) = false]; +} diff --git a/proto/ibc/core/channel/v1/tx.proto b/proto/ibc/core/channel/v1/tx.proto index a67a375..d1e82e7 100644 --- a/proto/ibc/core/channel/v1/tx.proto +++ b/proto/ibc/core/channel/v1/tx.proto @@ -2,14 +2,17 @@ syntax = "proto3"; package ibc.core.channel.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"; +option go_package = "github.com/cosmos/ibc-go/v10/modules/core/04-channel/types"; import "gogoproto/gogo.proto"; +import "cosmos/msg/v1/msg.proto"; import "ibc/core/client/v1/client.proto"; import "ibc/core/channel/v1/channel.proto"; // Msg defines the ibc/channel Msg service. service Msg { + option (cosmos.msg.v1.service) = true; + // ChannelOpenInit defines a rpc handler method for MsgChannelOpenInit. rpc ChannelOpenInit(MsgChannelOpenInit) returns (MsgChannelOpenInitResponse); @@ -52,22 +55,27 @@ enum ResponseResultType { RESPONSE_RESULT_TYPE_NOOP = 1 [(gogoproto.enumvalue_customname) = "NOOP"]; // The message was executed successfully RESPONSE_RESULT_TYPE_SUCCESS = 2 [(gogoproto.enumvalue_customname) = "SUCCESS"]; + // The message was executed unsuccessfully + RESPONSE_RESULT_TYPE_FAILURE = 3 [(gogoproto.enumvalue_customname) = "FAILURE"]; } // MsgChannelOpenInit defines an sdk.Msg to initialize a channel handshake. It // is called by a relayer on Chain A. message MsgChannelOpenInit { - option (gogoproto.equal) = false; + option (cosmos.msg.v1.signer) = "signer"; + option (gogoproto.goproto_getters) = false; - string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""]; + string port_id = 1; Channel channel = 2 [(gogoproto.nullable) = false]; string signer = 3; } // MsgChannelOpenInitResponse defines the Msg/ChannelOpenInit response type. message MsgChannelOpenInitResponse { - string channel_id = 1 [(gogoproto.moretags) = "yaml:\"channel_id\""]; + option (gogoproto.goproto_getters) = false; + + string channel_id = 1; string version = 2; } @@ -75,41 +83,43 @@ message MsgChannelOpenInitResponse { // on Chain B. The version field within the Channel field has been deprecated. Its // value will be ignored by core IBC. message MsgChannelOpenTry { - option (gogoproto.equal) = false; + option (cosmos.msg.v1.signer) = "signer"; + option (gogoproto.goproto_getters) = false; - string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""]; + string port_id = 1; // Deprecated: this field is unused. Crossing hello's are no longer supported in core IBC. - string previous_channel_id = 2 [deprecated = true, (gogoproto.moretags) = "yaml:\"previous_channel_id\""]; + string previous_channel_id = 2 [deprecated = true]; // NOTE: the version field within the channel has been deprecated. Its value will be ignored by core IBC. Channel channel = 3 [(gogoproto.nullable) = false]; - string counterparty_version = 4 [(gogoproto.moretags) = "yaml:\"counterparty_version\""]; - bytes proof_init = 5 [(gogoproto.moretags) = "yaml:\"proof_init\""]; - ibc.core.client.v1.Height proof_height = 6 - [(gogoproto.moretags) = "yaml:\"proof_height\"", (gogoproto.nullable) = false]; - string signer = 7; + string counterparty_version = 4; + bytes proof_init = 5; + ibc.core.client.v1.Height proof_height = 6 [(gogoproto.nullable) = false]; + string signer = 7; } // MsgChannelOpenTryResponse defines the Msg/ChannelOpenTry response type. message MsgChannelOpenTryResponse { + option (gogoproto.goproto_getters) = false; + string version = 1; - string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""]; + string channel_id = 2; } // MsgChannelOpenAck defines a msg sent by a Relayer to Chain A to acknowledge // the change of channel state to TRYOPEN on Chain B. message MsgChannelOpenAck { - option (gogoproto.equal) = false; + option (cosmos.msg.v1.signer) = "signer"; + option (gogoproto.goproto_getters) = false; - string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""]; - string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""]; - string counterparty_channel_id = 3 [(gogoproto.moretags) = "yaml:\"counterparty_channel_id\""]; - string counterparty_version = 4 [(gogoproto.moretags) = "yaml:\"counterparty_version\""]; - bytes proof_try = 5 [(gogoproto.moretags) = "yaml:\"proof_try\""]; - ibc.core.client.v1.Height proof_height = 6 - [(gogoproto.moretags) = "yaml:\"proof_height\"", (gogoproto.nullable) = false]; - string signer = 7; + string port_id = 1; + string channel_id = 2; + string counterparty_channel_id = 3; + string counterparty_version = 4; + bytes proof_try = 5; + ibc.core.client.v1.Height proof_height = 6 [(gogoproto.nullable) = false]; + string signer = 7; } // MsgChannelOpenAckResponse defines the Msg/ChannelOpenAck response type. @@ -118,15 +128,15 @@ message MsgChannelOpenAckResponse {} // MsgChannelOpenConfirm defines a msg sent by a Relayer to Chain B to // acknowledge the change of channel state to OPEN on Chain A. message MsgChannelOpenConfirm { - option (gogoproto.equal) = false; + option (cosmos.msg.v1.signer) = "signer"; + option (gogoproto.goproto_getters) = false; - string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""]; - string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""]; - bytes proof_ack = 3 [(gogoproto.moretags) = "yaml:\"proof_ack\""]; - ibc.core.client.v1.Height proof_height = 4 - [(gogoproto.moretags) = "yaml:\"proof_height\"", (gogoproto.nullable) = false]; - string signer = 5; + string port_id = 1; + string channel_id = 2; + bytes proof_ack = 3; + ibc.core.client.v1.Height proof_height = 4 [(gogoproto.nullable) = false]; + string signer = 5; } // MsgChannelOpenConfirmResponse defines the Msg/ChannelOpenConfirm response @@ -136,11 +146,12 @@ message MsgChannelOpenConfirmResponse {} // MsgChannelCloseInit defines a msg sent by a Relayer to Chain A // to close a channel with Chain B. message MsgChannelCloseInit { - option (gogoproto.equal) = false; + option (cosmos.msg.v1.signer) = "signer"; + option (gogoproto.goproto_getters) = false; - string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""]; - string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""]; + string port_id = 1; + string channel_id = 2; string signer = 3; } @@ -150,15 +161,15 @@ message MsgChannelCloseInitResponse {} // MsgChannelCloseConfirm defines a msg sent by a Relayer to Chain B // to acknowledge the change of channel state to CLOSED on Chain A. message MsgChannelCloseConfirm { - option (gogoproto.equal) = false; + option (cosmos.msg.v1.signer) = "signer"; + option (gogoproto.goproto_getters) = false; - string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""]; - string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""]; - bytes proof_init = 3 [(gogoproto.moretags) = "yaml:\"proof_init\""]; - ibc.core.client.v1.Height proof_height = 4 - [(gogoproto.moretags) = "yaml:\"proof_height\"", (gogoproto.nullable) = false]; - string signer = 5; + string port_id = 1; + string channel_id = 2; + bytes proof_init = 3; + ibc.core.client.v1.Height proof_height = 4 [(gogoproto.nullable) = false]; + string signer = 5; } // MsgChannelCloseConfirmResponse defines the Msg/ChannelCloseConfirm response @@ -167,14 +178,14 @@ message MsgChannelCloseConfirmResponse {} // MsgRecvPacket receives incoming IBC packet message MsgRecvPacket { - option (gogoproto.equal) = false; + option (cosmos.msg.v1.signer) = "signer"; + option (gogoproto.goproto_getters) = false; Packet packet = 1 [(gogoproto.nullable) = false]; - bytes proof_commitment = 2 [(gogoproto.moretags) = "yaml:\"proof_commitment\""]; - ibc.core.client.v1.Height proof_height = 3 - [(gogoproto.moretags) = "yaml:\"proof_height\"", (gogoproto.nullable) = false]; - string signer = 4; + bytes proof_commitment = 2; + ibc.core.client.v1.Height proof_height = 3 [(gogoproto.nullable) = false]; + string signer = 4; } // MsgRecvPacketResponse defines the Msg/RecvPacket response type. @@ -186,15 +197,15 @@ message MsgRecvPacketResponse { // MsgTimeout receives timed-out packet message MsgTimeout { - option (gogoproto.equal) = false; + option (cosmos.msg.v1.signer) = "signer"; + option (gogoproto.goproto_getters) = false; - Packet packet = 1 [(gogoproto.nullable) = false]; - bytes proof_unreceived = 2 [(gogoproto.moretags) = "yaml:\"proof_unreceived\""]; - ibc.core.client.v1.Height proof_height = 3 - [(gogoproto.moretags) = "yaml:\"proof_height\"", (gogoproto.nullable) = false]; - uint64 next_sequence_recv = 4 [(gogoproto.moretags) = "yaml:\"next_sequence_recv\""]; - string signer = 5; + Packet packet = 1 [(gogoproto.nullable) = false]; + bytes proof_unreceived = 2; + ibc.core.client.v1.Height proof_height = 3 [(gogoproto.nullable) = false]; + uint64 next_sequence_recv = 4; + string signer = 5; } // MsgTimeoutResponse defines the Msg/Timeout response type. @@ -206,16 +217,16 @@ message MsgTimeoutResponse { // MsgTimeoutOnClose timed-out packet upon counterparty channel closure. message MsgTimeoutOnClose { - option (gogoproto.equal) = false; + option (cosmos.msg.v1.signer) = "signer"; + option (gogoproto.goproto_getters) = false; - Packet packet = 1 [(gogoproto.nullable) = false]; - bytes proof_unreceived = 2 [(gogoproto.moretags) = "yaml:\"proof_unreceived\""]; - bytes proof_close = 3 [(gogoproto.moretags) = "yaml:\"proof_close\""]; - ibc.core.client.v1.Height proof_height = 4 - [(gogoproto.moretags) = "yaml:\"proof_height\"", (gogoproto.nullable) = false]; - uint64 next_sequence_recv = 5 [(gogoproto.moretags) = "yaml:\"next_sequence_recv\""]; - string signer = 6; + Packet packet = 1 [(gogoproto.nullable) = false]; + bytes proof_unreceived = 2; + bytes proof_close = 3; + ibc.core.client.v1.Height proof_height = 4 [(gogoproto.nullable) = false]; + uint64 next_sequence_recv = 5; + string signer = 6; } // MsgTimeoutOnCloseResponse defines the Msg/TimeoutOnClose response type. @@ -227,15 +238,15 @@ message MsgTimeoutOnCloseResponse { // MsgAcknowledgement receives incoming IBC acknowledgement message MsgAcknowledgement { - option (gogoproto.equal) = false; + option (cosmos.msg.v1.signer) = "signer"; + option (gogoproto.goproto_getters) = false; Packet packet = 1 [(gogoproto.nullable) = false]; bytes acknowledgement = 2; - bytes proof_acked = 3 [(gogoproto.moretags) = "yaml:\"proof_acked\""]; - ibc.core.client.v1.Height proof_height = 4 - [(gogoproto.moretags) = "yaml:\"proof_height\"", (gogoproto.nullable) = false]; - string signer = 5; + bytes proof_acked = 3; + ibc.core.client.v1.Height proof_height = 4 [(gogoproto.nullable) = false]; + string signer = 5; } // MsgAcknowledgementResponse defines the Msg/Acknowledgement response type. diff --git a/proto/ibc/core/channel/v2/genesis.proto b/proto/ibc/core/channel/v2/genesis.proto new file mode 100644 index 0000000..5208044 --- /dev/null +++ b/proto/ibc/core/channel/v2/genesis.proto @@ -0,0 +1,39 @@ +syntax = "proto3"; + +package ibc.core.channel.v2; + +option go_package = "github.com/cosmos/ibc-go/v10/modules/core/04-channel/v2/types"; + +import "gogoproto/gogo.proto"; + +// GenesisState defines the ibc channel/v2 submodule's genesis state. +message GenesisState { + repeated PacketState acknowledgements = 2 [(gogoproto.nullable) = false]; + repeated PacketState commitments = 3 [(gogoproto.nullable) = false]; + repeated PacketState receipts = 4 [(gogoproto.nullable) = false]; + repeated PacketState async_packets = 5 [(gogoproto.nullable) = false]; + repeated PacketSequence send_sequences = 6 [(gogoproto.nullable) = false]; +} + +// PacketState defines the generic type necessary to retrieve and store +// packet commitments, acknowledgements, and receipts. +// Caller is responsible for knowing the context necessary to interpret this +// state as a commitment, acknowledgement, or a receipt. +message PacketState { + option (gogoproto.goproto_getters) = false; + + // client unique identifier. + string client_id = 1; + // packet sequence. + uint64 sequence = 2; + // embedded data that represents packet state. + bytes data = 3; +} + +// PacketSequence defines the genesis type necessary to retrieve and store next send sequences. +message PacketSequence { + // client unique identifier. + string client_id = 1; + // packet sequence + uint64 sequence = 2; +} diff --git a/proto/ibc/core/channel/v2/packet.proto b/proto/ibc/core/channel/v2/packet.proto new file mode 100644 index 0000000..c7683f6 --- /dev/null +++ b/proto/ibc/core/channel/v2/packet.proto @@ -0,0 +1,68 @@ + +syntax = "proto3"; + +package ibc.core.channel.v2; + +option go_package = "github.com/cosmos/ibc-go/v10/modules/core/04-channel/v2/types"; + +import "gogoproto/gogo.proto"; + +// Packet defines a type that carries data across different chains through IBC +message Packet { + // number corresponds to the order of sends and receives, where a Packet + // with an earlier sequence number must be sent and received before a Packet + // with a later sequence number. + uint64 sequence = 1; + // identifies the sending client on the sending chain. + string source_client = 2; + // identifies the receiving client on the receiving chain. + string destination_client = 3; + // timeout timestamp in seconds after which the packet times out. + uint64 timeout_timestamp = 4; + // a list of payloads, each one for a specific application. + repeated Payload payloads = 5 [(gogoproto.nullable) = false]; +} + +// Payload contains the source and destination ports and payload for the application (version, encoding, raw bytes) +message Payload { + // specifies the source port of the packet. + string source_port = 1; + // specifies the destination port of the packet. + string destination_port = 2; + // version of the specified application. + string version = 3; + // the encoding used for the provided value. + string encoding = 4; + // the raw bytes for the payload. + bytes value = 5; +} + +// Acknowledgement contains a list of all ack results associated with a single packet. +// In the case of a successful receive, the acknowledgement will contain an app acknowledgement +// for each application that received a payload in the same order that the payloads were sent +// in the packet. +// If the receive is not successful, the acknowledgement will contain a single app acknowledgment +// which will be a constant error acknowledgment as defined by the IBC v2 protocol. +message Acknowledgement { + repeated bytes app_acknowledgements = 1; +} + +// PacketStatus specifies the status of a RecvPacketResult. +enum PacketStatus { + // PACKET_STATUS_UNSPECIFIED indicates an unknown packet status. + PACKET_STATUS_UNSPECIFIED = 0 [(gogoproto.enumvalue_customname) = "NONE"]; + // PACKET_STATUS_SUCCESS indicates a successful packet receipt. + PACKET_STATUS_SUCCESS = 1 [(gogoproto.enumvalue_customname) = "Success"]; + // PACKET_STATUS_FAILURE indicates a failed packet receipt. + PACKET_STATUS_FAILURE = 2 [(gogoproto.enumvalue_customname) = "Failure"]; + // PACKET_STATUS_ASYNC indicates an async packet receipt. + PACKET_STATUS_ASYNC = 3 [(gogoproto.enumvalue_customname) = "Async"]; +} + +// RecvPacketResult speecifies the status of a packet as well as the acknowledgement bytes. +message RecvPacketResult { + // status of the packet + PacketStatus status = 1; + // acknowledgement of the packet + bytes acknowledgement = 2; +} diff --git a/proto/ibc/core/channel/v2/query.proto b/proto/ibc/core/channel/v2/query.proto new file mode 100644 index 0000000..2a19de8 --- /dev/null +++ b/proto/ibc/core/channel/v2/query.proto @@ -0,0 +1,199 @@ +syntax = "proto3"; + +package ibc.core.channel.v2; + +option go_package = "github.com/cosmos/ibc-go/v10/modules/core/04-channel/v2/types"; + +import "cosmos/base/query/v1beta1/pagination.proto"; +import "ibc/core/channel/v2/genesis.proto"; +import "ibc/core/client/v1/client.proto"; +import "google/api/annotations.proto"; +import "gogoproto/gogo.proto"; + +// Query provides defines the gRPC querier service +service Query { + // NextSequenceSend returns the next send sequence for a given channel. + rpc NextSequenceSend(QueryNextSequenceSendRequest) returns (QueryNextSequenceSendResponse) { + option (google.api.http).get = "/ibc/core/channel/v2/clients/{client_id}/next_sequence_send"; + } + + // PacketCommitment queries a stored packet commitment hash. + rpc PacketCommitment(QueryPacketCommitmentRequest) returns (QueryPacketCommitmentResponse) { + option (google.api.http).get = "/ibc/core/channel/v2/clients/{client_id}/packet_commitments/{sequence}"; + } + + // PacketCommitments queries a stored packet commitment hash. + rpc PacketCommitments(QueryPacketCommitmentsRequest) returns (QueryPacketCommitmentsResponse) { + option (google.api.http).get = "/ibc/core/channel/v2/clients/{client_id}/packet_commitments"; + } + + // PacketAcknowledgement queries a stored acknowledgement commitment hash. + rpc PacketAcknowledgement(QueryPacketAcknowledgementRequest) returns (QueryPacketAcknowledgementResponse) { + option (google.api.http).get = "/ibc/core/channel/v2/clients/{client_id}/packet_acks/{sequence}"; + } + + // PacketAcknowledgements returns all packet acknowledgements associated with a channel. + rpc PacketAcknowledgements(QueryPacketAcknowledgementsRequest) returns (QueryPacketAcknowledgementsResponse) { + option (google.api.http).get = "/ibc/core/channel/v2/clients/{client_id}/packet_acknowledgements"; + } + + // PacketReceipt queries a stored packet receipt. + rpc PacketReceipt(QueryPacketReceiptRequest) returns (QueryPacketReceiptResponse) { + option (google.api.http).get = "/ibc/core/channel/v2/clients/{client_id}/packet_receipts/{sequence}"; + } + + // UnreceivedPackets returns all the unreceived IBC packets associated with a channel and sequences. + rpc UnreceivedPackets(QueryUnreceivedPacketsRequest) returns (QueryUnreceivedPacketsResponse) { + option (google.api.http).get = "/ibc/core/channel/v2/clients/{client_id}/packet_commitments/" + "{sequences}/unreceived_packets"; + } + + // UnreceivedAcks returns all the unreceived IBC acknowledgements associated with a channel and sequences. + rpc UnreceivedAcks(QueryUnreceivedAcksRequest) returns (QueryUnreceivedAcksResponse) { + option (google.api.http).get = + "/ibc/core/channel/v2/clients/{client_id}/packet_commitments/{packet_ack_sequences}/unreceived_acks"; + } +} + +// QueryNextSequenceSendRequest is the request type for the Query/QueryNextSequenceSend RPC method +message QueryNextSequenceSendRequest { + // client unique identifier + string client_id = 1; +} + +// QueryNextSequenceSendResponse is the response type for the Query/QueryNextSequenceSend RPC method +message QueryNextSequenceSendResponse { + // next sequence send number + uint64 next_sequence_send = 1; + // merkle proof of existence + bytes proof = 2; + // height at which the proof was retrieved + ibc.core.client.v1.Height proof_height = 3 [(gogoproto.nullable) = false]; +} + +// QueryPacketCommitmentRequest is the request type for the Query/PacketCommitment RPC method. +message QueryPacketCommitmentRequest { + // client unique identifier + string client_id = 1; + // packet sequence + uint64 sequence = 2; +} + +// QueryPacketCommitmentResponse is the response type for the Query/PacketCommitment RPC method. +message QueryPacketCommitmentResponse { + // packet associated with the request fields + bytes commitment = 1; + // merkle proof of existence + bytes proof = 2; + // height at which the proof was retrieved + ibc.core.client.v1.Height proof_height = 3 [(gogoproto.nullable) = false]; +} + +// QueryPacketCommitmentsRequest is the request type for the Query/PacketCommitments RPC method. +message QueryPacketCommitmentsRequest { + // client unique identifier + string client_id = 1; + // pagination request + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// QueryPacketCommitmentResponse is the response type for the Query/PacketCommitment RPC method. +message QueryPacketCommitmentsResponse { + // collection of packet commitments for the requested channel identifier. + repeated ibc.core.channel.v2.PacketState commitments = 1; + // pagination response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; + // query block height. + ibc.core.client.v1.Height height = 3 [(gogoproto.nullable) = false]; +} + +// QueryPacketAcknowledgementRequest is the request type for the Query/PacketAcknowledgement RPC method. +message QueryPacketAcknowledgementRequest { + // client unique identifier + string client_id = 1; + // packet sequence + uint64 sequence = 2; +} + +// QueryPacketAcknowledgementResponse is the response type for the Query/PacketAcknowledgement RPC method. +message QueryPacketAcknowledgementResponse { + // acknowledgement associated with the request fields + bytes acknowledgement = 1; + // merkle proof of existence + bytes proof = 2; + // height at which the proof was retrieved + ibc.core.client.v1.Height proof_height = 3 [(gogoproto.nullable) = false]; +} + +// QueryPacketAcknowledgementsRequest is the request type for the +// Query/QueryPacketCommitments RPC method +message QueryPacketAcknowledgementsRequest { + // client unique identifier + string client_id = 1; + // pagination request + cosmos.base.query.v1beta1.PageRequest pagination = 2; + // list of packet sequences + repeated uint64 packet_commitment_sequences = 3; +} + +// QueryPacketAcknowledgemetsResponse is the request type for the +// Query/QueryPacketAcknowledgements RPC method +message QueryPacketAcknowledgementsResponse { + repeated ibc.core.channel.v2.PacketState acknowledgements = 1; + // pagination response + cosmos.base.query.v1beta1.PageResponse pagination = 2; + // query block height + ibc.core.client.v1.Height height = 3 [(gogoproto.nullable) = false]; +} + +// QueryPacketReceiptRequest is the request type for the Query/PacketReceipt RPC method. +message QueryPacketReceiptRequest { + // client unique identifier + string client_id = 1; + // packet sequence + uint64 sequence = 2; +} + +// QueryPacketReceiptResponse is the response type for the Query/PacketReceipt RPC method. +message QueryPacketReceiptResponse { + // success flag for if receipt exists + bool received = 2; + // merkle proof of existence or absence + bytes proof = 3; + // height at which the proof was retrieved + ibc.core.client.v1.Height proof_height = 4 [(gogoproto.nullable) = false]; +} + +// QueryUnreceivedPacketsRequest is the request type for the Query/UnreceivedPackets RPC method +message QueryUnreceivedPacketsRequest { + // client unique identifier + string client_id = 1; + // list of packet sequences + repeated uint64 sequences = 2; +} + +// QueryUnreceivedPacketsResponse is the response type for the Query/UnreceivedPacketCommitments RPC method +message QueryUnreceivedPacketsResponse { + // list of unreceived packet sequences + repeated uint64 sequences = 1; + // query block height + ibc.core.client.v1.Height height = 2 [(gogoproto.nullable) = false]; +} + +// QueryUnreceivedAcks is the request type for the +// Query/UnreceivedAcks RPC method +message QueryUnreceivedAcksRequest { + // client unique identifier + string client_id = 1; + // list of acknowledgement sequences + repeated uint64 packet_ack_sequences = 2; +} + +// QueryUnreceivedAcksResponse is the response type for the +// Query/UnreceivedAcks RPC method +message QueryUnreceivedAcksResponse { + // list of unreceived acknowledgement sequences + repeated uint64 sequences = 1; + // query block height + ibc.core.client.v1.Height height = 2 [(gogoproto.nullable) = false]; +} diff --git a/proto/ibc/core/channel/v2/tx.proto b/proto/ibc/core/channel/v2/tx.proto new file mode 100644 index 0000000..534c8dd --- /dev/null +++ b/proto/ibc/core/channel/v2/tx.proto @@ -0,0 +1,117 @@ +syntax = "proto3"; + +package ibc.core.channel.v2; + +option go_package = "github.com/cosmos/ibc-go/v10/modules/core/04-channel/v2/types"; + +import "gogoproto/gogo.proto"; +import "cosmos/msg/v1/msg.proto"; +import "ibc/core/channel/v2/packet.proto"; +import "ibc/core/client/v1/client.proto"; + +// Msg defines the ibc/channel/v2 Msg service. +service Msg { + option (cosmos.msg.v1.service) = true; + + // SendPacket defines a rpc handler method for MsgSendPacket. + rpc SendPacket(MsgSendPacket) returns (MsgSendPacketResponse); + + // RecvPacket defines a rpc handler method for MsgRecvPacket. + rpc RecvPacket(MsgRecvPacket) returns (MsgRecvPacketResponse); + + // Timeout defines a rpc handler method for MsgTimeout. + rpc Timeout(MsgTimeout) returns (MsgTimeoutResponse); + + // Acknowledgement defines a rpc handler method for MsgAcknowledgement. + rpc Acknowledgement(MsgAcknowledgement) returns (MsgAcknowledgementResponse); +} + +// MsgSendPacket sends an outgoing IBC packet. +message MsgSendPacket { + option (cosmos.msg.v1.signer) = "signer"; + option (gogoproto.goproto_getters) = false; + + string source_client = 1; + uint64 timeout_timestamp = 2; + repeated Payload payloads = 3 [(gogoproto.nullable) = false]; + string signer = 4; +} + +// MsgSendPacketResponse defines the Msg/SendPacket response type. +message MsgSendPacketResponse { + option (gogoproto.goproto_getters) = false; + + uint64 sequence = 1; +} + +// MsgRecvPacket receives an incoming IBC packet. +message MsgRecvPacket { + option (cosmos.msg.v1.signer) = "signer"; + + option (gogoproto.goproto_getters) = false; + + Packet packet = 1 [(gogoproto.nullable) = false]; + bytes proof_commitment = 2; + ibc.core.client.v1.Height proof_height = 3 [(gogoproto.nullable) = false]; + string signer = 4; +} + +// ResponseResultType defines the possible outcomes of the execution of a message +enum ResponseResultType { + option (gogoproto.goproto_enum_prefix) = false; + + // Default zero value enumeration + RESPONSE_RESULT_TYPE_UNSPECIFIED = 0 [(gogoproto.enumvalue_customname) = "UNSPECIFIED"]; + // The message did not call the IBC application callbacks (because, for example, the packet had already been relayed) + RESPONSE_RESULT_TYPE_NOOP = 1 [(gogoproto.enumvalue_customname) = "NOOP"]; + // The message was executed successfully + RESPONSE_RESULT_TYPE_SUCCESS = 2 [(gogoproto.enumvalue_customname) = "SUCCESS"]; + // The message was executed unsuccessfully + RESPONSE_RESULT_TYPE_FAILURE = 3 [(gogoproto.enumvalue_customname) = "FAILURE"]; +} + +// MsgRecvPacketResponse defines the Msg/RecvPacket response type. +message MsgRecvPacketResponse { + option (gogoproto.goproto_getters) = false; + + ResponseResultType result = 1; +} + +// MsgTimeout receives timed-out packet +message MsgTimeout { + option (cosmos.msg.v1.signer) = "signer"; + + option (gogoproto.goproto_getters) = false; + + Packet packet = 1 [(gogoproto.nullable) = false]; + bytes proof_unreceived = 2; + ibc.core.client.v1.Height proof_height = 3 [(gogoproto.nullable) = false]; + string signer = 5; +} + +// MsgTimeoutResponse defines the Msg/Timeout response type. +message MsgTimeoutResponse { + option (gogoproto.goproto_getters) = false; + + ResponseResultType result = 1; +} + +// MsgAcknowledgement receives incoming IBC acknowledgement. +message MsgAcknowledgement { + option (cosmos.msg.v1.signer) = "signer"; + + option (gogoproto.goproto_getters) = false; + + Packet packet = 1 [(gogoproto.nullable) = false]; + Acknowledgement acknowledgement = 2 [(gogoproto.nullable) = false]; + bytes proof_acked = 3; + ibc.core.client.v1.Height proof_height = 4 [(gogoproto.nullable) = false]; + string signer = 5; +} + +// MsgAcknowledgementResponse defines the Msg/Acknowledgement response type. +message MsgAcknowledgementResponse { + option (gogoproto.goproto_getters) = false; + + ResponseResultType result = 1; +} diff --git a/proto/ibc/core/client/v1/client.proto b/proto/ibc/core/client/v1/client.proto index 15b47e5..f22a7b5 100644 --- a/proto/ibc/core/client/v1/client.proto +++ b/proto/ibc/core/client/v1/client.proto @@ -2,20 +2,18 @@ syntax = "proto3"; package ibc.core.client.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"; +option go_package = "github.com/cosmos/ibc-go/v10/modules/core/02-client/types"; import "gogoproto/gogo.proto"; import "google/protobuf/any.proto"; -import "cosmos/upgrade/v1beta1/upgrade.proto"; -import "cosmos_proto/cosmos.proto"; // IdentifiedClientState defines a client state with an additional client // identifier field. message IdentifiedClientState { // client identifier - string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""]; + string client_id = 1; // client state - google.protobuf.Any client_state = 2 [(gogoproto.moretags) = "yaml:\"client_state\""]; + google.protobuf.Any client_state = 2; } // ConsensusStateWithHeight defines a consensus state with an additional height @@ -24,56 +22,16 @@ message ConsensusStateWithHeight { // consensus state height Height height = 1 [(gogoproto.nullable) = false]; // consensus state - google.protobuf.Any consensus_state = 2 [(gogoproto.moretags) = "yaml:\"consensus_state\""]; + google.protobuf.Any consensus_state = 2; } // ClientConsensusStates defines all the stored consensus states for a given // client. message ClientConsensusStates { // client identifier - string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""]; + string client_id = 1; // consensus states and their heights associated with the client - repeated ConsensusStateWithHeight consensus_states = 2 - [(gogoproto.moretags) = "yaml:\"consensus_states\"", (gogoproto.nullable) = false]; -} - -// ClientUpdateProposal is a governance proposal. If it passes, the substitute -// client's latest consensus state is copied over to the subject client. The proposal -// handler may fail if the subject and the substitute do not match in client and -// chain parameters (with exception to latest height, frozen height, and chain-id). -message ClientUpdateProposal { - option (gogoproto.goproto_getters) = false; - option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content"; - // the title of the update proposal - string title = 1; - // the description of the proposal - string description = 2; - // the client identifier for the client to be updated if the proposal passes - string subject_client_id = 3 [(gogoproto.moretags) = "yaml:\"subject_client_id\""]; - // the substitute client identifier for the client standing in for the subject - // client - string substitute_client_id = 4 [(gogoproto.moretags) = "yaml:\"substitute_client_id\""]; -} - -// UpgradeProposal is a gov Content type for initiating an IBC breaking -// upgrade. -message UpgradeProposal { - option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = false; - option (gogoproto.equal) = true; - option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content"; - - string title = 1; - string description = 2; - cosmos.upgrade.v1beta1.Plan plan = 3 [(gogoproto.nullable) = false]; - - // An UpgradedClientState must be provided to perform an IBC breaking upgrade. - // This will make the chain commit to the correct upgraded (self) client state - // before the upgrade occurs, so that connecting chains can verify that the - // new upgraded client is valid by verifying a proof on the previous version - // of the chain. This will allow IBC connections to persist smoothly across - // planned chain upgrades - google.protobuf.Any upgraded_client_state = 4 [(gogoproto.moretags) = "yaml:\"upgraded_client_state\""]; + repeated ConsensusStateWithHeight consensus_states = 2 [(gogoproto.nullable) = false]; } // Height is a monotonically increasing data type @@ -86,14 +44,17 @@ message UpgradeProposal { // breaking changes In these cases, the RevisionNumber is incremented so that // height continues to be monitonically increasing even as the RevisionHeight // gets reset +// +// Please note that json tags for generated Go code are overridden to explicitly exclude the omitempty jsontag. +// This enforces the Go json marshaller to always emit zero values for both revision_number and revision_height. message Height { option (gogoproto.goproto_getters) = false; option (gogoproto.goproto_stringer) = false; // the revision that the client is currently on - uint64 revision_number = 1 [(gogoproto.moretags) = "yaml:\"revision_number\""]; + uint64 revision_number = 1 [(gogoproto.jsontag) = "revision_number"]; // the height within the given revision - uint64 revision_height = 2 [(gogoproto.moretags) = "yaml:\"revision_height\""]; + uint64 revision_height = 2 [(gogoproto.jsontag) = "revision_height"]; } // Params defines the set of IBC light client parameters. @@ -101,5 +62,5 @@ message Params { // allowed_clients defines the list of allowed client state types which can be created // and interacted with. If a client type is removed from the allowed clients list, usage // of this client will be disabled until it is added again to the list. - repeated string allowed_clients = 1 [(gogoproto.moretags) = "yaml:\"allowed_clients\""]; + repeated string allowed_clients = 1; } diff --git a/proto/ibc/core/client/v1/genesis.proto b/proto/ibc/core/client/v1/genesis.proto index 7882124..ba58828 100644 --- a/proto/ibc/core/client/v1/genesis.proto +++ b/proto/ibc/core/client/v1/genesis.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.client.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"; +option go_package = "github.com/cosmos/ibc-go/v10/modules/core/02-client/types"; import "ibc/core/client/v1/client.proto"; import "gogoproto/gogo.proto"; @@ -13,23 +13,20 @@ message GenesisState { repeated IdentifiedClientState clients = 1 [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "IdentifiedClientStates"]; // consensus states from each client - repeated ClientConsensusStates clients_consensus = 2 [ - (gogoproto.nullable) = false, - (gogoproto.castrepeated) = "ClientsConsensusStates", - (gogoproto.moretags) = "yaml:\"clients_consensus\"" - ]; + repeated ClientConsensusStates clients_consensus = 2 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "ClientsConsensusStates"]; // metadata from each client - repeated IdentifiedGenesisMetadata clients_metadata = 3 - [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"clients_metadata\""]; - Params params = 4 [(gogoproto.nullable) = false]; - // create localhost on initialization - bool create_localhost = 5 [(gogoproto.moretags) = "yaml:\"create_localhost\""]; + repeated IdentifiedGenesisMetadata clients_metadata = 3 [(gogoproto.nullable) = false]; + Params params = 4 [(gogoproto.nullable) = false]; + // Deprecated: create_localhost has been deprecated. + // The localhost client is automatically created at genesis. + bool create_localhost = 5 [deprecated = true]; // the sequence for the next generated client identifier - uint64 next_client_sequence = 6 [(gogoproto.moretags) = "yaml:\"next_client_sequence\""]; + uint64 next_client_sequence = 6; } -// GenesisMetadata defines the genesis type for metadata that clients may return -// with ExportMetadata +// GenesisMetadata defines the genesis type for metadata that will be used +// to export all client store keys that are not client or consensus states. message GenesisMetadata { option (gogoproto.goproto_getters) = false; @@ -42,7 +39,6 @@ message GenesisMetadata { // IdentifiedGenesisMetadata has the client metadata with the corresponding // client id. message IdentifiedGenesisMetadata { - string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""]; - repeated GenesisMetadata client_metadata = 2 - [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"client_metadata\""]; + string client_id = 1; + repeated GenesisMetadata client_metadata = 2 [(gogoproto.nullable) = false]; } diff --git a/proto/ibc/core/client/v1/query.proto b/proto/ibc/core/client/v1/query.proto index 0d26cf6..0c436d5 100644 --- a/proto/ibc/core/client/v1/query.proto +++ b/proto/ibc/core/client/v1/query.proto @@ -2,10 +2,12 @@ syntax = "proto3"; package ibc.core.client.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"; +option go_package = "github.com/cosmos/ibc-go/v10/modules/core/02-client/types"; import "cosmos/base/query/v1beta1/pagination.proto"; +import "cosmos/query/v1/query.proto"; import "ibc/core/client/v1/client.proto"; +import "ibc/core/commitment/v2/commitment.proto"; import "google/protobuf/any.proto"; import "google/api/annotations.proto"; import "gogoproto/gogo.proto"; @@ -51,6 +53,11 @@ service Query { option (google.api.http).get = "/ibc/core/client/v1/params"; } + // ClientCreator queries the creator of a given client. + rpc ClientCreator(QueryClientCreatorRequest) returns (QueryClientCreatorResponse) { + option (google.api.http).get = "/ibc/core/client/v1/client_creator/{client_id}"; + } + // UpgradedClientState queries an Upgraded IBC light client. rpc UpgradedClientState(QueryUpgradedClientStateRequest) returns (QueryUpgradedClientStateResponse) { option (google.api.http).get = "/ibc/core/client/v1/upgraded_client_states"; @@ -60,6 +67,15 @@ service Query { rpc UpgradedConsensusState(QueryUpgradedConsensusStateRequest) returns (QueryUpgradedConsensusStateResponse) { option (google.api.http).get = "/ibc/core/client/v1/upgraded_consensus_states"; } + + // VerifyMembership queries an IBC light client for proof verification of a value at a given key path. + rpc VerifyMembership(QueryVerifyMembershipRequest) returns (QueryVerifyMembershipResponse) { + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http) = { + post: "/ibc/core/client/v1/verify_membership" + body: "*" + }; + } } // QueryClientStateRequest is the request type for the Query/ClientState RPC @@ -108,7 +124,7 @@ message QueryConsensusStateRequest { uint64 revision_number = 2; // consensus state revision height uint64 revision_height = 3; - // latest_height overrrides the height field and queries the latest stored + // latest_height overrides the height field and queries the latest stored // ConsensusState bool latest_height = 4; } @@ -184,6 +200,20 @@ message QueryClientParamsResponse { Params params = 1; } +// QueryClientCreatorRequest is the request type for the Query/ClientCreator RPC +// method. +message QueryClientCreatorRequest { + // client unique identifier + string client_id = 1; +} + +// QueryClientCreatorResponse is the response type for the Query/ClientCreator RPC +// method. +message QueryClientCreatorResponse { + // creator of the client + string creator = 1; +} + // QueryUpgradedClientStateRequest is the request type for the // Query/UpgradedClientState RPC method message QueryUpgradedClientStateRequest {} @@ -205,3 +235,29 @@ message QueryUpgradedConsensusStateResponse { // Consensus state associated with the request identifier google.protobuf.Any upgraded_consensus_state = 1; } + +// QueryVerifyMembershipRequest is the request type for the Query/VerifyMembership RPC method +message QueryVerifyMembershipRequest { + // client unique identifier. + string client_id = 1; + // the proof to be verified by the client. + bytes proof = 2; + // the height of the commitment root at which the proof is verified. + ibc.core.client.v1.Height proof_height = 3 [(gogoproto.nullable) = false]; + // reserved: deprecated field. + reserved 4; + // the value which is proven. + bytes value = 5; + // optional time delay + uint64 time_delay = 6; + // optional block delay + uint64 block_delay = 7; + // the commitment key path. + ibc.core.commitment.v2.MerklePath merkle_path = 8 [(gogoproto.nullable) = false]; +} + +// QueryVerifyMembershipResponse is the response type for the Query/VerifyMembership RPC method +message QueryVerifyMembershipResponse { + // boolean indicating success or failure of proof verification. + bool success = 1; +} diff --git a/proto/ibc/core/client/v1/tx.proto b/proto/ibc/core/client/v1/tx.proto index 23302d5..45e4feb 100644 --- a/proto/ibc/core/client/v1/tx.proto +++ b/proto/ibc/core/client/v1/tx.proto @@ -2,13 +2,18 @@ syntax = "proto3"; package ibc.core.client.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"; +option go_package = "github.com/cosmos/ibc-go/v10/modules/core/02-client/types"; +import "cosmos/msg/v1/msg.proto"; +import "cosmos/upgrade/v1beta1/upgrade.proto"; import "gogoproto/gogo.proto"; import "google/protobuf/any.proto"; +import "ibc/core/client/v1/client.proto"; // Msg defines the ibc/client Msg service. service Msg { + option (cosmos.msg.v1.service) = true; + // CreateClient defines a rpc handler method for MsgCreateClient. rpc CreateClient(MsgCreateClient) returns (MsgCreateClientResponse); @@ -20,33 +25,51 @@ service Msg { // SubmitMisbehaviour defines a rpc handler method for MsgSubmitMisbehaviour. rpc SubmitMisbehaviour(MsgSubmitMisbehaviour) returns (MsgSubmitMisbehaviourResponse); + + // RecoverClient defines a rpc handler method for MsgRecoverClient. + rpc RecoverClient(MsgRecoverClient) returns (MsgRecoverClientResponse); + + // IBCSoftwareUpgrade defines a rpc handler method for MsgIBCSoftwareUpgrade. + rpc IBCSoftwareUpgrade(MsgIBCSoftwareUpgrade) returns (MsgIBCSoftwareUpgradeResponse); + + // UpdateClientParams defines a rpc handler method for MsgUpdateParams. + rpc UpdateClientParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); + + // DeleteClientCreator defines a rpc handler method for MsgDeleteClientCreator. + rpc DeleteClientCreator(MsgDeleteClientCreator) returns (MsgDeleteClientCreatorResponse); } // MsgCreateClient defines a message to create an IBC client message MsgCreateClient { - option (gogoproto.equal) = false; + option (cosmos.msg.v1.signer) = "signer"; + option (gogoproto.goproto_getters) = false; // light client state - google.protobuf.Any client_state = 1 [(gogoproto.moretags) = "yaml:\"client_state\""]; + google.protobuf.Any client_state = 1; // consensus state associated with the client that corresponds to a given // height. - google.protobuf.Any consensus_state = 2 [(gogoproto.moretags) = "yaml:\"consensus_state\""]; + google.protobuf.Any consensus_state = 2; // signer address string signer = 3; } // MsgCreateClientResponse defines the Msg/CreateClient response type. -message MsgCreateClientResponse {} +message MsgCreateClientResponse { + option (gogoproto.goproto_getters) = false; + + string client_id = 1; +} // MsgUpdateClient defines an sdk.Msg to update a IBC client state using // the given client message. message MsgUpdateClient { - option (gogoproto.equal) = false; + option (cosmos.msg.v1.signer) = "signer"; + option (gogoproto.goproto_getters) = false; // client unique identifier - string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""]; + string client_id = 1; // client message to update the light client google.protobuf.Any client_message = 2; // signer address @@ -59,20 +82,21 @@ message MsgUpdateClientResponse {} // MsgUpgradeClient defines an sdk.Msg to upgrade an IBC client to a new client // state message MsgUpgradeClient { - option (gogoproto.equal) = false; + option (cosmos.msg.v1.signer) = "signer"; + option (gogoproto.goproto_getters) = false; // client unique identifier - string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""]; + string client_id = 1; // upgraded client state - google.protobuf.Any client_state = 2 [(gogoproto.moretags) = "yaml:\"client_state\""]; + google.protobuf.Any client_state = 2; // upgraded consensus state, only contains enough information to serve as a // basis of trust in update logic - google.protobuf.Any consensus_state = 3 [(gogoproto.moretags) = "yaml:\"consensus_state\""]; + google.protobuf.Any consensus_state = 3; // proof that old chain committed to new client - bytes proof_upgrade_client = 4 [(gogoproto.moretags) = "yaml:\"proof_upgrade_client\""]; + bytes proof_upgrade_client = 4; // proof that old chain committed to new consensus state - bytes proof_upgrade_consensus_state = 5 [(gogoproto.moretags) = "yaml:\"proof_upgrade_consensus_state\""]; + bytes proof_upgrade_consensus_state = 5; // signer address string signer = 6; } @@ -82,19 +106,93 @@ message MsgUpgradeClientResponse {} // MsgSubmitMisbehaviour defines an sdk.Msg type that submits Evidence for // light client misbehaviour. -// Warning: DEPRECATED +// This message has been deprecated. Use MsgUpdateClient instead. message MsgSubmitMisbehaviour { - option (gogoproto.equal) = false; + option deprecated = true; + option (cosmos.msg.v1.signer) = "signer"; + option (gogoproto.goproto_getters) = false; // client unique identifier - string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\"", deprecated = true]; + string client_id = 1; // misbehaviour used for freezing the light client - google.protobuf.Any misbehaviour = 2 [deprecated = true]; + google.protobuf.Any misbehaviour = 2; // signer address - string signer = 3 [deprecated = true]; + string signer = 3; } // MsgSubmitMisbehaviourResponse defines the Msg/SubmitMisbehaviour response // type. message MsgSubmitMisbehaviourResponse {} + +// MsgRecoverClient defines the message used to recover a frozen or expired client. +message MsgRecoverClient { + option (gogoproto.goproto_getters) = false; + option (cosmos.msg.v1.signer) = "signer"; + + // the client identifier for the client to be updated if the proposal passes + string subject_client_id = 1; + // the substitute client identifier for the client which will replace the subject + // client + string substitute_client_id = 2; + + // signer address + string signer = 3; +} + +// MsgRecoverClientResponse defines the Msg/RecoverClient response type. +message MsgRecoverClientResponse {} + +// MsgIBCSoftwareUpgrade defines the message used to schedule an upgrade of an IBC client using a v1 governance proposal +message MsgIBCSoftwareUpgrade { + option (cosmos.msg.v1.signer) = "signer"; + cosmos.upgrade.v1beta1.Plan plan = 1 [(gogoproto.nullable) = false]; + // An UpgradedClientState must be provided to perform an IBC breaking upgrade. + // This will make the chain commit to the correct upgraded (self) client state + // before the upgrade occurs, so that connecting chains can verify that the + // new upgraded client is valid by verifying a proof on the previous version + // of the chain. This will allow IBC connections to persist smoothly across + // planned chain upgrades. Correspondingly, the UpgradedClientState field has been + // deprecated in the Cosmos SDK to allow for this logic to exist solely in + // the 02-client module. + google.protobuf.Any upgraded_client_state = 2; + // signer address + string signer = 3; +} + +// MsgIBCSoftwareUpgradeResponse defines the Msg/IBCSoftwareUpgrade response type. +message MsgIBCSoftwareUpgradeResponse {} + +// MsgUpdateParams defines the sdk.Msg type to update the client parameters. +message MsgUpdateParams { + option (cosmos.msg.v1.signer) = "signer"; + + option (gogoproto.goproto_getters) = false; + + // signer address + string signer = 1; + + // params defines the client parameters to update. + // + // NOTE: All parameters must be supplied. + Params params = 2 [(gogoproto.nullable) = false]; +} + +// MsgUpdateParamsResponse defines the MsgUpdateParams response type. +message MsgUpdateParamsResponse {} + +// MsgDeleteClientCreator defines a message to delete the client creator of a client +message MsgDeleteClientCreator { + option (cosmos.msg.v1.signer) = "signer"; + + option (gogoproto.goproto_getters) = false; + + // client identifier + string client_id = 1; + // signer address + string signer = 2; +} + +// MsgDeleteClientCreatorResponse defines the Msg/DeleteClientCreator response type. +message MsgDeleteClientCreatorResponse {} + diff --git a/proto/ibc/core/client/v2/config.proto b/proto/ibc/core/client/v2/config.proto new file mode 100644 index 0000000..8f1c527 --- /dev/null +++ b/proto/ibc/core/client/v2/config.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; + +package ibc.core.client.v2; + +option go_package = "github.com/cosmos/ibc-go/v10/modules/core/02-client/v2/types"; + +// Config is a **per-client** configuration struct that sets which relayers are allowed to relay v2 IBC messages +// for a given client. +// If it is set, then only relayers in the allow list can send v2 messages +// If it is not set, then the client allows permissionless relaying of v2 messages +message Config { + // allowed_relayers defines the set of allowed relayers for IBC V2 protocol for the given client + repeated string allowed_relayers = 1; +} \ No newline at end of file diff --git a/proto/ibc/core/client/v2/counterparty.proto b/proto/ibc/core/client/v2/counterparty.proto new file mode 100644 index 0000000..494ac0b --- /dev/null +++ b/proto/ibc/core/client/v2/counterparty.proto @@ -0,0 +1,13 @@ +syntax = "proto3"; + +package ibc.core.client.v2; + +option go_package = "github.com/cosmos/ibc-go/v10/modules/core/02-client/v2/types"; + +// CounterpartyInfo defines the key that the counterparty will use to message our client +message CounterpartyInfo { + // merkle prefix key is the prefix that ics provable keys are stored under + repeated bytes merkle_prefix = 1; + // client identifier is the identifier used to send packet messages to our client + string client_id = 2; +} diff --git a/proto/ibc/core/client/v2/genesis.proto b/proto/ibc/core/client/v2/genesis.proto new file mode 100644 index 0000000..b2b0e3d --- /dev/null +++ b/proto/ibc/core/client/v2/genesis.proto @@ -0,0 +1,23 @@ +syntax = "proto3"; + +package ibc.core.client.v2; + +option go_package = "github.com/cosmos/ibc-go/v10/modules/core/02-client/v2/types"; + +import "ibc/core/client/v2/counterparty.proto"; +import "gogoproto/gogo.proto"; + +// GenesisCounterpartyInfo defines the state associating a client with a counterparty. +message GenesisCounterpartyInfo { + // ClientId is the ID of the given client. + string client_id = 1; + + // CounterpartyInfo is the counterparty info of the given client. + CounterpartyInfo counterparty_info = 2 [(gogoproto.nullable) = false]; +} + +// GenesisState defines the ibc client v2 submodule's genesis state. +message GenesisState { + // counterparty info for each client + repeated GenesisCounterpartyInfo counterparty_infos = 1 [(gogoproto.nullable) = false]; +} diff --git a/proto/ibc/core/client/v2/query.proto b/proto/ibc/core/client/v2/query.proto new file mode 100644 index 0000000..6e3b509 --- /dev/null +++ b/proto/ibc/core/client/v2/query.proto @@ -0,0 +1,46 @@ +syntax = "proto3"; + +package ibc.core.client.v2; + +option go_package = "github.com/cosmos/ibc-go/v10/modules/core/02-client/v2/types"; + +import "ibc/core/client/v2/counterparty.proto"; +import "ibc/core/client/v2/config.proto"; +import "google/api/annotations.proto"; + +// Query provides defines the gRPC querier service +service Query { + // CounterpartyInfo queries an IBC light counter party info. + rpc CounterpartyInfo(QueryCounterpartyInfoRequest) returns (QueryCounterpartyInfoResponse) { + option (google.api.http).get = "/ibc/core/client/v2/counterparty_info/{client_id}"; + } + + // Config queries the IBC client v2 configuration for a given client. + rpc Config(QueryConfigRequest) returns (QueryConfigResponse) { + option (google.api.http).get = "/ibc/core/client/v2/config/{client_id}"; + } +} + +// QueryCounterpartyInfoRequest is the request type for the Query/CounterpartyInfo RPC +// method +message QueryCounterpartyInfoRequest { + // client state unique identifier + string client_id = 1; +} + +// QueryCounterpartyInfoResponse is the response type for the +// Query/CounterpartyInfo RPC method. +message QueryCounterpartyInfoResponse { + CounterpartyInfo counterparty_info = 1; +} + +// QueryConfigRequest is the request type for the Query/Config RPC method +message QueryConfigRequest { + // client state unique identifier + string client_id = 1; +} + +// QueryConfigResponse is the response type for the Query/Config RPC method +message QueryConfigResponse { + Config config = 1; +} diff --git a/proto/ibc/core/client/v2/tx.proto b/proto/ibc/core/client/v2/tx.proto new file mode 100644 index 0000000..ae39c0a --- /dev/null +++ b/proto/ibc/core/client/v2/tx.proto @@ -0,0 +1,58 @@ +syntax = "proto3"; + +package ibc.core.client.v2; + +option go_package = "github.com/cosmos/ibc-go/v10/modules/core/02-client/v2/types"; + +import "cosmos/msg/v1/msg.proto"; +import "gogoproto/gogo.proto"; +import "ibc/core/client/v2/config.proto"; + +// Msg defines the ibc/client/v2 Msg service. +service Msg { + option (cosmos.msg.v1.service) = true; + + // RegisterCounterparty defines a rpc handler method for MsgRegisterCounterparty. + rpc RegisterCounterparty(MsgRegisterCounterparty) returns (MsgRegisterCounterpartyResponse); + + // UpdateClientConfig defines a rpc handler method for MsgUpdateClientConfig. + rpc UpdateClientConfig(MsgUpdateClientConfig) returns (MsgUpdateClientConfigResponse); +} + +// MsgRegisterCounterparty defines a message to register a counterparty on a client +message MsgRegisterCounterparty { + option (cosmos.msg.v1.signer) = "signer"; + + option (gogoproto.goproto_getters) = false; + + // client identifier + string client_id = 1; + // counterparty merkle prefix + repeated bytes counterparty_merkle_prefix = 2; + // counterparty client identifier + string counterparty_client_id = 3; + // signer address + string signer = 4; +} + +// MsgRegisterCounterpartyResponse defines the Msg/RegisterCounterparty response type. +message MsgRegisterCounterpartyResponse {} + +// MsgUpdateClientConfig defines the sdk.Msg type to update the configuration for a given client +message MsgUpdateClientConfig { + option (cosmos.msg.v1.signer) = "signer"; + + option (gogoproto.goproto_getters) = false; + + // client identifier + string client_id = 1; + // allowed relayers + // + // NOTE: All fields in the config must be supplied. + Config config = 2 [(gogoproto.nullable) = false]; + // signer address + string signer = 3; +} + +// MsgUpdateClientConfigResponse defines the MsgUpdateClientConfig response type. +message MsgUpdateClientConfigResponse {} diff --git a/proto/ibc/core/commitment/v1/commitment.proto b/proto/ibc/core/commitment/v1/commitment.proto index 4840ff3..07b143b 100644 --- a/proto/ibc/core/commitment/v1/commitment.proto +++ b/proto/ibc/core/commitment/v1/commitment.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.commitment.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/core/23-commitment/types"; +option go_package = "github.com/cosmos/ibc-go/v10/modules/core/23-commitment/types"; import "gogoproto/gogo.proto"; import "cosmos/ics23/v1/proofs.proto"; @@ -19,16 +19,7 @@ message MerkleRoot { // The constructed key from the Path and the key will be append(Path.KeyPath, // append(Path.KeyPrefix, key...)) message MerklePrefix { - bytes key_prefix = 1 [(gogoproto.moretags) = "yaml:\"key_prefix\""]; -} - -// MerklePath is the path used to verify commitment proofs, which can be an -// arbitrary structured object (defined by a commitment type). -// MerklePath is represented from root-to-leaf -message MerklePath { - option (gogoproto.goproto_stringer) = false; - - repeated string key_path = 1 [(gogoproto.moretags) = "yaml:\"key_path\""]; + bytes key_prefix = 1; } // MerkleProof is a wrapper type over a chain of CommitmentProofs. diff --git a/proto/ibc/core/commitment/v2/commitment.proto b/proto/ibc/core/commitment/v2/commitment.proto new file mode 100644 index 0000000..5401867 --- /dev/null +++ b/proto/ibc/core/commitment/v2/commitment.proto @@ -0,0 +1,40 @@ +syntax = "proto3"; + +package ibc.core.commitment.v2; + +option go_package = "github.com/cosmos/ibc-go/v10/modules/core/23-commitment/types/v2"; + +// MerklePath is the path used to verify commitment proofs, which can be an +// arbitrary structured object (defined by a commitment type). +// ICS-23 verification supports membership proofs for nested merkle trees. +// The ICS-24 standard provable keys MUST be stored in the lowest level tree with an optional prefix. +// The IC24 provable tree may then be stored in a higher level tree(s) that hash up to the root hash +// stored in the consensus state of the client. +// Each element of the path represents the key of a merkle tree from the root to the leaf. +// The elements of the path before the final element must be the path to the tree that contains +// the ICS24 provable store. Thus, it should remain constant for all ICS24 proofs. +// The final element of the path is the key of the leaf in the ICS24 provable store, +// Thus IBC core will append the ICS24 path to the final element of the MerklePath +// stored in the counterparty to create the full path to the leaf for proof verification. +// Examples: +// Cosmos SDK: +// The Cosmos SDK commits to a multi-tree where each store is an IAVL tree and all store hashes +// are hashed in a simple merkle tree to get the final root hash. Thus, the MerklePath in the counterparty +// MerklePrefix has the following structure: ["ibc", ""] +// The core IBC handler will append the ICS24 path to the final element of the MerklePath +// like so: ["ibc", "{packetCommitmentPath}"] which will then be used for final verification. +// Ethereum: +// The Ethereum client commits to a single Patricia merkle trie. The ICS24 provable store is managed +// by the smart contract state. Each smart contract has a specific prefix reserved within the global trie. +// Thus the MerklePath in the counterparty is the prefix to the smart contract state in the global trie. +// Since there is only one tree in the commitment structure of ethereum the MerklePath in the counterparty +// MerklePrefix has the following structure: ["IBCCoreContractAddressStoragePrefix"] +// The core IBC handler will append the ICS24 path to the final element of the MerklePath +// like so: ["IBCCoreContractAddressStoragePrefix{packetCommitmentPath}"] which will then be used for final +// verification. Thus the MerklePath in the counterparty MerklePrefix is the nested key path from the root hash of the +// consensus state down to the ICS24 provable store. The IBC handler retrieves the counterparty key path to the ICS24 +// provable store from the MerklePath and appends the ICS24 path to get the final key path to the value being verified +// by the client against the root hash in the client's consensus state. +message MerklePath { + repeated bytes key_path = 1; +} diff --git a/proto/ibc/core/connection/v1/connection.proto b/proto/ibc/core/connection/v1/connection.proto index ba367c1..5ef0098 100644 --- a/proto/ibc/core/connection/v1/connection.proto +++ b/proto/ibc/core/connection/v1/connection.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.connection.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types"; +option go_package = "github.com/cosmos/ibc-go/v10/modules/core/03-connection/types"; import "gogoproto/gogo.proto"; import "ibc/core/commitment/v1/commitment.proto"; @@ -17,7 +17,7 @@ import "ibc/core/commitment/v1/commitment.proto"; message ConnectionEnd { option (gogoproto.goproto_getters) = false; // client associated with this connection. - string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""]; + string client_id = 1; // IBC version which can be utilised to determine encodings or protocols for // channels or packets utilising this connection. repeated Version versions = 2; @@ -28,7 +28,7 @@ message ConnectionEnd { // delay period that must pass before a consensus state can be used for // packet-verification NOTE: delay period logic is only implemented by some // clients. - uint64 delay_period = 5 [(gogoproto.moretags) = "yaml:\"delay_period\""]; + uint64 delay_period = 5; } // IdentifiedConnection defines a connection with additional connection @@ -36,9 +36,9 @@ message ConnectionEnd { message IdentifiedConnection { option (gogoproto.goproto_getters) = false; // connection identifier. - string id = 1 [(gogoproto.moretags) = "yaml:\"id\""]; + string id = 1; // client associated with this connection. - string client_id = 2 [(gogoproto.moretags) = "yaml:\"client_id\""]; + string client_id = 2; // IBC version which can be utilised to determine encodings or protocols for // channels or packets utilising this connection repeated Version versions = 3; @@ -47,7 +47,7 @@ message IdentifiedConnection { // counterparty chain associated with this connection. Counterparty counterparty = 5 [(gogoproto.nullable) = false]; // delay period associated with this connection. - uint64 delay_period = 6 [(gogoproto.moretags) = "yaml:\"delay_period\""]; + uint64 delay_period = 6; } // State defines if a connection is in one of the following states: @@ -72,10 +72,10 @@ message Counterparty { // identifies the client on the counterparty chain associated with a given // connection. - string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""]; + string client_id = 1; // identifies the connection end on the counterparty chain associated with a // given connection. - string connection_id = 2 [(gogoproto.moretags) = "yaml:\"connection_id\""]; + string connection_id = 2; // commitment merkle prefix of the counterparty chain. ibc.core.commitment.v1.MerklePrefix prefix = 3 [(gogoproto.nullable) = false]; } @@ -89,12 +89,12 @@ message ClientPaths { // ConnectionPaths define all the connection paths for a given client state. message ConnectionPaths { // client state unique identifier - string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""]; + string client_id = 1; // list of connection paths repeated string paths = 2; } -// Version defines the versioning scheme used to negotiate the IBC verison in +// Version defines the versioning scheme used to negotiate the IBC version in // the connection handshake. message Version { option (gogoproto.goproto_getters) = false; @@ -110,5 +110,5 @@ message Params { // maximum expected time per block (in nanoseconds), used to enforce block delay. This parameter should reflect the // largest amount of time that the chain might reasonably take to produce the next block under normal operating // conditions. A safe choice is 3-5x the expected time per block. - uint64 max_expected_time_per_block = 1 [(gogoproto.moretags) = "yaml:\"max_expected_time_per_block\""]; + uint64 max_expected_time_per_block = 1; } diff --git a/proto/ibc/core/connection/v1/genesis.proto b/proto/ibc/core/connection/v1/genesis.proto index 122c5a4..b845637 100644 --- a/proto/ibc/core/connection/v1/genesis.proto +++ b/proto/ibc/core/connection/v1/genesis.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.connection.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types"; +option go_package = "github.com/cosmos/ibc-go/v10/modules/core/03-connection/types"; import "gogoproto/gogo.proto"; import "ibc/core/connection/v1/connection.proto"; @@ -10,9 +10,8 @@ import "ibc/core/connection/v1/connection.proto"; // GenesisState defines the ibc connection submodule's genesis state. message GenesisState { repeated IdentifiedConnection connections = 1 [(gogoproto.nullable) = false]; - repeated ConnectionPaths client_connection_paths = 2 - [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"client_connection_paths\""]; + repeated ConnectionPaths client_connection_paths = 2 [(gogoproto.nullable) = false]; // the sequence for the next generated connection identifier - uint64 next_connection_sequence = 3 [(gogoproto.moretags) = "yaml:\"next_connection_sequence\""]; + uint64 next_connection_sequence = 3; Params params = 4 [(gogoproto.nullable) = false]; } diff --git a/proto/ibc/core/connection/v1/query.proto b/proto/ibc/core/connection/v1/query.proto index 3c76b23..090dcc6 100644 --- a/proto/ibc/core/connection/v1/query.proto +++ b/proto/ibc/core/connection/v1/query.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.connection.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types"; +option go_package = "github.com/cosmos/ibc-go/v10/modules/core/03-connection/types"; import "gogoproto/gogo.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; @@ -106,7 +106,7 @@ message QueryClientConnectionsResponse { // Query/ConnectionClientState RPC method message QueryConnectionClientStateRequest { // connection identifier - string connection_id = 1 [(gogoproto.moretags) = "yaml:\"connection_id\""]; + string connection_id = 1; } // QueryConnectionClientStateResponse is the response type for the @@ -124,7 +124,7 @@ message QueryConnectionClientStateResponse { // Query/ConnectionConsensusState RPC method message QueryConnectionConsensusStateRequest { // connection identifier - string connection_id = 1 [(gogoproto.moretags) = "yaml:\"connection_id\""]; + string connection_id = 1; uint64 revision_number = 2; uint64 revision_height = 3; } @@ -149,4 +149,4 @@ message QueryConnectionParamsRequest {} message QueryConnectionParamsResponse { // params defines the parameters of the module. Params params = 1; -} \ No newline at end of file +} diff --git a/proto/ibc/core/connection/v1/tx.proto b/proto/ibc/core/connection/v1/tx.proto index af8f505..ac45fdd 100644 --- a/proto/ibc/core/connection/v1/tx.proto +++ b/proto/ibc/core/connection/v1/tx.proto @@ -2,15 +2,18 @@ syntax = "proto3"; package ibc.core.connection.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types"; +option go_package = "github.com/cosmos/ibc-go/v10/modules/core/03-connection/types"; import "gogoproto/gogo.proto"; +import "cosmos/msg/v1/msg.proto"; import "google/protobuf/any.proto"; import "ibc/core/client/v1/client.proto"; import "ibc/core/connection/v1/connection.proto"; // Msg defines the ibc/connection Msg service. service Msg { + option (cosmos.msg.v1.service) = true; + // ConnectionOpenInit defines a rpc handler method for MsgConnectionOpenInit. rpc ConnectionOpenInit(MsgConnectionOpenInit) returns (MsgConnectionOpenInitResponse); @@ -23,18 +26,23 @@ service Msg { // ConnectionOpenConfirm defines a rpc handler method for // MsgConnectionOpenConfirm. rpc ConnectionOpenConfirm(MsgConnectionOpenConfirm) returns (MsgConnectionOpenConfirmResponse); + + // UpdateConnectionParams defines a rpc handler method for + // MsgUpdateParams. + rpc UpdateConnectionParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); } // MsgConnectionOpenInit defines the msg sent by an account on Chain A to // initialize a connection with Chain B. message MsgConnectionOpenInit { - option (gogoproto.equal) = false; + option (cosmos.msg.v1.signer) = "signer"; + option (gogoproto.goproto_getters) = false; - string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""]; + string client_id = 1; Counterparty counterparty = 2 [(gogoproto.nullable) = false]; Version version = 3; - uint64 delay_period = 4 [(gogoproto.moretags) = "yaml:\"delay_period\""]; + uint64 delay_period = 4; string signer = 5; } @@ -45,30 +53,31 @@ message MsgConnectionOpenInitResponse {} // MsgConnectionOpenTry defines a msg sent by a Relayer to try to open a // connection on Chain B. message MsgConnectionOpenTry { - option (gogoproto.equal) = false; + option (cosmos.msg.v1.signer) = "signer"; + option (gogoproto.goproto_getters) = false; - string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""]; + string client_id = 1; // Deprecated: this field is unused. Crossing hellos are no longer supported in core IBC. - string previous_connection_id = 2 [deprecated = true, (gogoproto.moretags) = "yaml:\"previous_connection_id\""]; - google.protobuf.Any client_state = 3 [(gogoproto.moretags) = "yaml:\"client_state\""]; + string previous_connection_id = 2 [deprecated = true]; + // Deprecated: this field is unused. + google.protobuf.Any client_state = 3 [deprecated = true]; Counterparty counterparty = 4 [(gogoproto.nullable) = false]; - uint64 delay_period = 5 [(gogoproto.moretags) = "yaml:\"delay_period\""]; - repeated Version counterparty_versions = 6 [(gogoproto.moretags) = "yaml:\"counterparty_versions\""]; - ibc.core.client.v1.Height proof_height = 7 - [(gogoproto.moretags) = "yaml:\"proof_height\"", (gogoproto.nullable) = false]; - // proof of the initialization the connection on Chain A: `UNITIALIZED -> + uint64 delay_period = 5; + repeated Version counterparty_versions = 6; + ibc.core.client.v1.Height proof_height = 7 [(gogoproto.nullable) = false]; + // proof of the initialization the connection on Chain A: `UNINITIALIZED -> // INIT` - bytes proof_init = 8 [(gogoproto.moretags) = "yaml:\"proof_init\""]; - // proof of client state included in message - bytes proof_client = 9 [(gogoproto.moretags) = "yaml:\"proof_client\""]; - // proof of client consensus state - bytes proof_consensus = 10 [(gogoproto.moretags) = "yaml:\"proof_consensus\""]; - ibc.core.client.v1.Height consensus_height = 11 - [(gogoproto.moretags) = "yaml:\"consensus_height\"", (gogoproto.nullable) = false]; - string signer = 12; - // optional proof data for host state machines that are unable to introspect their own consensus state - bytes host_consensus_state_proof = 13; + bytes proof_init = 8; + // Deprecated: this field is unused. + bytes proof_client = 9 [deprecated = true]; + // Deprecated: this field is unused. + bytes proof_consensus = 10 [deprecated = true]; + // Deprecated: this field is unused. + ibc.core.client.v1.Height consensus_height = 11 [deprecated = true, (gogoproto.nullable) = false]; + string signer = 12; + // Deprecated: this field is unused. + bytes host_consensus_state_proof = 13 [deprecated = true]; } // MsgConnectionOpenTryResponse defines the Msg/ConnectionOpenTry response type. @@ -77,27 +86,28 @@ message MsgConnectionOpenTryResponse {} // MsgConnectionOpenAck defines a msg sent by a Relayer to Chain A to // acknowledge the change of connection state to TRYOPEN on Chain B. message MsgConnectionOpenAck { - option (gogoproto.equal) = false; + option (cosmos.msg.v1.signer) = "signer"; + option (gogoproto.goproto_getters) = false; - string connection_id = 1 [(gogoproto.moretags) = "yaml:\"connection_id\""]; - string counterparty_connection_id = 2 [(gogoproto.moretags) = "yaml:\"counterparty_connection_id\""]; - Version version = 3; - google.protobuf.Any client_state = 4 [(gogoproto.moretags) = "yaml:\"client_state\""]; - ibc.core.client.v1.Height proof_height = 5 - [(gogoproto.moretags) = "yaml:\"proof_height\"", (gogoproto.nullable) = false]; - // proof of the initialization the connection on Chain B: `UNITIALIZED -> + string connection_id = 1; + string counterparty_connection_id = 2; + Version version = 3; + // Deprecated: this field is unused. + google.protobuf.Any client_state = 4 [deprecated = true]; + ibc.core.client.v1.Height proof_height = 5 [(gogoproto.nullable) = false]; + // proof of the initialization the connection on Chain B: `UNINITIALIZED -> // TRYOPEN` - bytes proof_try = 6 [(gogoproto.moretags) = "yaml:\"proof_try\""]; - // proof of client state included in message - bytes proof_client = 7 [(gogoproto.moretags) = "yaml:\"proof_client\""]; - // proof of client consensus state - bytes proof_consensus = 8 [(gogoproto.moretags) = "yaml:\"proof_consensus\""]; - ibc.core.client.v1.Height consensus_height = 9 - [(gogoproto.moretags) = "yaml:\"consensus_height\"", (gogoproto.nullable) = false]; - string signer = 10; - // optional proof data for host state machines that are unable to introspect their own consensus state - bytes host_consensus_state_proof = 11; + bytes proof_try = 6; + // Deprecated: this field is unused. + bytes proof_client = 7 [deprecated = true]; + // Deprecated: this field is unused. + bytes proof_consensus = 8 [deprecated = true]; + // Deprecated: this field is unused. + ibc.core.client.v1.Height consensus_height = 9 [deprecated = true, (gogoproto.nullable) = false]; + string signer = 10; + // Deprecated: this field is unused. + bytes host_consensus_state_proof = 11 [deprecated = true]; } // MsgConnectionOpenAckResponse defines the Msg/ConnectionOpenAck response type. @@ -106,17 +116,35 @@ message MsgConnectionOpenAckResponse {} // MsgConnectionOpenConfirm defines a msg sent by a Relayer to Chain B to // acknowledge the change of connection state to OPEN on Chain A. message MsgConnectionOpenConfirm { - option (gogoproto.equal) = false; + option (cosmos.msg.v1.signer) = "signer"; + option (gogoproto.goproto_getters) = false; - string connection_id = 1 [(gogoproto.moretags) = "yaml:\"connection_id\""]; + string connection_id = 1; // proof for the change of the connection state on Chain A: `INIT -> OPEN` - bytes proof_ack = 2 [(gogoproto.moretags) = "yaml:\"proof_ack\""]; - ibc.core.client.v1.Height proof_height = 3 - [(gogoproto.moretags) = "yaml:\"proof_height\"", (gogoproto.nullable) = false]; - string signer = 4; + bytes proof_ack = 2; + ibc.core.client.v1.Height proof_height = 3 [(gogoproto.nullable) = false]; + string signer = 4; } // MsgConnectionOpenConfirmResponse defines the Msg/ConnectionOpenConfirm // response type. message MsgConnectionOpenConfirmResponse {} + +// MsgUpdateParams defines the sdk.Msg type to update the connection parameters. +message MsgUpdateParams { + option (cosmos.msg.v1.signer) = "signer"; + + option (gogoproto.goproto_getters) = false; + + // signer address + string signer = 1; + + // params defines the connection parameters to update. + // + // NOTE: All parameters must be supplied. + Params params = 2 [(gogoproto.nullable) = false]; +} + +// MsgUpdateParamsResponse defines the MsgUpdateParams response type. +message MsgUpdateParamsResponse {} diff --git a/proto/ibc/core/types/v1/genesis.proto b/proto/ibc/core/types/v1/genesis.proto index 4e07551..bbf5524 100644 --- a/proto/ibc/core/types/v1/genesis.proto +++ b/proto/ibc/core/types/v1/genesis.proto @@ -2,22 +2,25 @@ syntax = "proto3"; package ibc.core.types.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/core/types"; +option go_package = "github.com/cosmos/ibc-go/v10/modules/core/types"; import "gogoproto/gogo.proto"; import "ibc/core/client/v1/genesis.proto"; +import "ibc/core/client/v2/genesis.proto"; import "ibc/core/connection/v1/genesis.proto"; import "ibc/core/channel/v1/genesis.proto"; +import "ibc/core/channel/v2/genesis.proto"; // GenesisState defines the ibc module's genesis state. message GenesisState { // ICS002 - Clients genesis state - ibc.core.client.v1.GenesisState client_genesis = 1 - [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"client_genesis\""]; + ibc.core.client.v1.GenesisState client_genesis = 1 [(gogoproto.nullable) = false]; // ICS003 - Connections genesis state - ibc.core.connection.v1.GenesisState connection_genesis = 2 - [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"connection_genesis\""]; + ibc.core.connection.v1.GenesisState connection_genesis = 2 [(gogoproto.nullable) = false]; // ICS004 - Channel genesis state - ibc.core.channel.v1.GenesisState channel_genesis = 3 - [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"channel_genesis\""]; + ibc.core.channel.v1.GenesisState channel_genesis = 3 [(gogoproto.nullable) = false]; + // ICS002 - Clients/v2 genesis state + ibc.core.client.v2.GenesisState client_v2_genesis = 4 [(gogoproto.nullable) = false]; + // ICS004 - Channel/v2 genesis state + ibc.core.channel.v2.GenesisState channel_v2_genesis = 5 [(gogoproto.nullable) = false]; } diff --git a/proto/ibc/lightclients/localhost/v2/localhost.proto b/proto/ibc/lightclients/localhost/v2/localhost.proto deleted file mode 100644 index ec970eb..0000000 --- a/proto/ibc/lightclients/localhost/v2/localhost.proto +++ /dev/null @@ -1,16 +0,0 @@ -syntax = "proto3"; - -package ibc.lightclients.localhost.v2; - -option go_package = "github.com/cosmos/ibc-go/v7/modules/light-clients/09-localhost;localhost"; - -import "ibc/core/client/v1/client.proto"; -import "gogoproto/gogo.proto"; - -// ClientState defines the 09-localhost client state -message ClientState { - option (gogoproto.goproto_getters) = false; - - // the latest block height - ibc.core.client.v1.Height latest_height = 1 [(gogoproto.nullable) = false]; -} diff --git a/proto/ibc/lightclients/solomachine/v2/solomachine.proto b/proto/ibc/lightclients/solomachine/v2/solomachine.proto index 2503133..3a43e20 100644 --- a/proto/ibc/lightclients/solomachine/v2/solomachine.proto +++ b/proto/ibc/lightclients/solomachine/v2/solomachine.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.lightclients.solomachine.v2; -option go_package = "github.com/cosmos/ibc-go/v7/modules/core/02-client/migrations/v7"; +option go_package = "github.com/cosmos/ibc-go/v10/modules/core/02-client/migrations/v7"; import "ibc/core/connection/v1/connection.proto"; import "ibc/core/channel/v1/channel.proto"; @@ -16,11 +16,11 @@ message ClientState { // latest sequence of the client state uint64 sequence = 1; // frozen sequence of the solo machine - bool is_frozen = 2 [(gogoproto.moretags) = "yaml:\"is_frozen\""]; - ConsensusState consensus_state = 3 [(gogoproto.moretags) = "yaml:\"consensus_state\""]; + bool is_frozen = 2; + ConsensusState consensus_state = 3; // when set to true, will allow governance to update a solo machine client. // The client will be unfrozen if it is frozen. - bool allow_update_after_proposal = 4 [(gogoproto.moretags) = "yaml:\"allow_update_after_proposal\""]; + bool allow_update_after_proposal = 4; } // ConsensusState defines a solo machine consensus state. The sequence of a @@ -29,8 +29,8 @@ message ClientState { message ConsensusState { option (gogoproto.goproto_getters) = false; // public key of the solo machine - google.protobuf.Any public_key = 1 [(gogoproto.moretags) = "yaml:\"public_key\""]; - // diversifier allows the same public key to be re-used across different solo + google.protobuf.Any public_key = 1; + // diversifier allows the same public key to be reused across different solo // machine clients (potentially on different chains) without being considered // misbehaviour. string diversifier = 2; @@ -44,18 +44,18 @@ message Header { uint64 sequence = 1; uint64 timestamp = 2; bytes signature = 3; - google.protobuf.Any new_public_key = 4 [(gogoproto.moretags) = "yaml:\"new_public_key\""]; - string new_diversifier = 5 [(gogoproto.moretags) = "yaml:\"new_diversifier\""]; + google.protobuf.Any new_public_key = 4; + string new_diversifier = 5; } // Misbehaviour defines misbehaviour for a solo machine which consists // of a sequence and two signatures over different messages at that sequence. message Misbehaviour { option (gogoproto.goproto_getters) = false; - string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""]; + string client_id = 1; uint64 sequence = 2; - SignatureAndData signature_one = 3 [(gogoproto.moretags) = "yaml:\"signature_one\""]; - SignatureAndData signature_two = 4 [(gogoproto.moretags) = "yaml:\"signature_two\""]; + SignatureAndData signature_one = 3; + SignatureAndData signature_two = 4; } // SignatureAndData contains a signature and the data signed over to create that @@ -63,7 +63,7 @@ message Misbehaviour { message SignatureAndData { option (gogoproto.goproto_getters) = false; bytes signature = 1; - DataType data_type = 2 [(gogoproto.moretags) = "yaml:\"data_type\""]; + DataType data_type = 2; bytes data = 3; uint64 timestamp = 4; } @@ -72,7 +72,7 @@ message SignatureAndData { // signature. message TimestampedSignatureData { option (gogoproto.goproto_getters) = false; - bytes signature_data = 1 [(gogoproto.moretags) = "yaml:\"signature_data\""]; + bytes signature_data = 1; uint64 timestamp = 2; } @@ -84,7 +84,7 @@ message SignBytes { uint64 timestamp = 2; string diversifier = 3; // type of the data used - DataType data_type = 4 [(gogoproto.moretags) = "yaml:\"data_type\""]; + DataType data_type = 4; // marshaled data bytes data = 5; } @@ -121,9 +121,9 @@ message HeaderData { option (gogoproto.goproto_getters) = false; // header public key - google.protobuf.Any new_pub_key = 1 [(gogoproto.moretags) = "yaml:\"new_pub_key\""]; + google.protobuf.Any new_pub_key = 1; // header diversifier - string new_diversifier = 2 [(gogoproto.moretags) = "yaml:\"new_diversifier\""]; + string new_diversifier = 2; } // ClientStateData returns the SignBytes data for client state verification. @@ -131,7 +131,7 @@ message ClientStateData { option (gogoproto.goproto_getters) = false; bytes path = 1; - google.protobuf.Any client_state = 2 [(gogoproto.moretags) = "yaml:\"client_state\""]; + google.protobuf.Any client_state = 2; } // ConsensusStateData returns the SignBytes data for consensus state @@ -140,7 +140,7 @@ message ConsensusStateData { option (gogoproto.goproto_getters) = false; bytes path = 1; - google.protobuf.Any consensus_state = 2 [(gogoproto.moretags) = "yaml:\"consensus_state\""]; + google.protobuf.Any consensus_state = 2; } // ConnectionStateData returns the SignBytes data for connection state @@ -185,5 +185,5 @@ message PacketReceiptAbsenceData { // sequence to be received. message NextSequenceRecvData { bytes path = 1; - uint64 next_seq_recv = 2 [(gogoproto.moretags) = "yaml:\"next_seq_recv\""]; + uint64 next_seq_recv = 2; } diff --git a/proto/ibc/lightclients/solomachine/v3/solomachine.proto b/proto/ibc/lightclients/solomachine/v3/solomachine.proto index 40e76b7..d8e0adc 100644 --- a/proto/ibc/lightclients/solomachine/v3/solomachine.proto +++ b/proto/ibc/lightclients/solomachine/v3/solomachine.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.lightclients.solomachine.v3; -option go_package = "github.com/cosmos/ibc-go/v7/modules/light-clients/06-solomachine;solomachine"; +option go_package = "github.com/cosmos/ibc-go/v10/modules/light-clients/06-solomachine;solomachine"; import "gogoproto/gogo.proto"; import "google/protobuf/any.proto"; @@ -14,8 +14,8 @@ message ClientState { // latest sequence of the client state uint64 sequence = 1; // frozen sequence of the solo machine - bool is_frozen = 2 [(gogoproto.moretags) = "yaml:\"is_frozen\""]; - ConsensusState consensus_state = 3 [(gogoproto.moretags) = "yaml:\"consensus_state\""]; + bool is_frozen = 2; + ConsensusState consensus_state = 3; } // ConsensusState defines a solo machine consensus state. The sequence of a @@ -24,8 +24,8 @@ message ClientState { message ConsensusState { option (gogoproto.goproto_getters) = false; // public key of the solo machine - google.protobuf.Any public_key = 1 [(gogoproto.moretags) = "yaml:\"public_key\""]; - // diversifier allows the same public key to be re-used across different solo + google.protobuf.Any public_key = 1; + // diversifier allows the same public key to be reused across different solo // machine clients (potentially on different chains) without being considered // misbehaviour. string diversifier = 2; @@ -38,8 +38,8 @@ message Header { uint64 timestamp = 1; bytes signature = 2; - google.protobuf.Any new_public_key = 3 [(gogoproto.moretags) = "yaml:\"new_public_key\""]; - string new_diversifier = 4 [(gogoproto.moretags) = "yaml:\"new_diversifier\""]; + google.protobuf.Any new_public_key = 3; + string new_diversifier = 4; } // Misbehaviour defines misbehaviour for a solo machine which consists @@ -48,8 +48,8 @@ message Misbehaviour { option (gogoproto.goproto_getters) = false; uint64 sequence = 1; - SignatureAndData signature_one = 2 [(gogoproto.moretags) = "yaml:\"signature_one\""]; - SignatureAndData signature_two = 3 [(gogoproto.moretags) = "yaml:\"signature_two\""]; + SignatureAndData signature_one = 2; + SignatureAndData signature_two = 3; } // SignatureAndData contains a signature and the data signed over to create that @@ -68,7 +68,7 @@ message SignatureAndData { message TimestampedSignatureData { option (gogoproto.goproto_getters) = false; - bytes signature_data = 1 [(gogoproto.moretags) = "yaml:\"signature_data\""]; + bytes signature_data = 1; uint64 timestamp = 2; } @@ -93,7 +93,7 @@ message HeaderData { option (gogoproto.goproto_getters) = false; // header public key - google.protobuf.Any new_pub_key = 1 [(gogoproto.moretags) = "yaml:\"new_pub_key\""]; + google.protobuf.Any new_pub_key = 1; // header diversifier - string new_diversifier = 2 [(gogoproto.moretags) = "yaml:\"new_diversifier\""]; + string new_diversifier = 2; } diff --git a/proto/ibc/lightclients/tendermint/v1/tendermint.proto b/proto/ibc/lightclients/tendermint/v1/tendermint.proto index 83fa59c..89c9f88 100644 --- a/proto/ibc/lightclients/tendermint/v1/tendermint.proto +++ b/proto/ibc/lightclients/tendermint/v1/tendermint.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.lightclients.tendermint.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint;tendermint"; +option go_package = "github.com/cosmos/ibc-go/v10/modules/light-clients/07-tendermint;tendermint"; import "tendermint/types/validator.proto"; import "tendermint/types/types.proto"; @@ -19,29 +19,21 @@ message ClientState { option (gogoproto.goproto_getters) = false; string chain_id = 1; - Fraction trust_level = 2 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"trust_level\""]; - // duration of the period since the LastestTimestamp during which the + Fraction trust_level = 2 [(gogoproto.nullable) = false]; + // duration of the period since the LatestTimestamp during which the // submitted headers are valid for upgrade - google.protobuf.Duration trusting_period = 3 - [(gogoproto.nullable) = false, (gogoproto.stdduration) = true, (gogoproto.moretags) = "yaml:\"trusting_period\""]; + google.protobuf.Duration trusting_period = 3 [(gogoproto.nullable) = false, (gogoproto.stdduration) = true]; // duration of the staking unbonding period - google.protobuf.Duration unbonding_period = 4 [ - (gogoproto.nullable) = false, - (gogoproto.stdduration) = true, - (gogoproto.moretags) = "yaml:\"unbonding_period\"" - ]; + google.protobuf.Duration unbonding_period = 4 [(gogoproto.nullable) = false, (gogoproto.stdduration) = true]; // defines how much new (untrusted) header's Time can drift into the future. - google.protobuf.Duration max_clock_drift = 5 - [(gogoproto.nullable) = false, (gogoproto.stdduration) = true, (gogoproto.moretags) = "yaml:\"max_clock_drift\""]; + google.protobuf.Duration max_clock_drift = 5 [(gogoproto.nullable) = false, (gogoproto.stdduration) = true]; // Block height when the client was frozen due to a misbehaviour - ibc.core.client.v1.Height frozen_height = 6 - [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"frozen_height\""]; + ibc.core.client.v1.Height frozen_height = 6 [(gogoproto.nullable) = false]; // Latest height the client was updated to - ibc.core.client.v1.Height latest_height = 7 - [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"latest_height\""]; + ibc.core.client.v1.Height latest_height = 7 [(gogoproto.nullable) = false]; // Proof specifications used in verifying counterparty state - repeated cosmos.ics23.v1.ProofSpec proof_specs = 8 [(gogoproto.moretags) = "yaml:\"proof_specs\""]; + repeated cosmos.ics23.v1.ProofSpec proof_specs = 8; // Path at which next upgraded client will be committed. // Each element corresponds to the key for a single CommitmentProof in the @@ -50,13 +42,12 @@ message ClientState { // under `{upgradepath}/{upgradeHeight}/consensusState` For SDK chains using // the default upgrade module, upgrade_path should be []string{"upgrade", // "upgradedIBCState"}` - repeated string upgrade_path = 9 [(gogoproto.moretags) = "yaml:\"upgrade_path\""]; + repeated string upgrade_path = 9; // allow_update_after_expiry is deprecated - bool allow_update_after_expiry = 10 [deprecated = true, (gogoproto.moretags) = "yaml:\"allow_update_after_expiry\""]; + bool allow_update_after_expiry = 10 [deprecated = true]; // allow_update_after_misbehaviour is deprecated - bool allow_update_after_misbehaviour = 11 - [deprecated = true, (gogoproto.moretags) = "yaml:\"allow_update_after_misbehaviour\""]; + bool allow_update_after_misbehaviour = 11 [deprecated = true]; } // ConsensusState defines the consensus state from Tendermint. @@ -67,11 +58,8 @@ message ConsensusState { // was stored. google.protobuf.Timestamp timestamp = 1 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; // commitment root (i.e app hash) - ibc.core.commitment.v1.MerkleRoot root = 2 [(gogoproto.nullable) = false]; - bytes next_validators_hash = 3 [ - (gogoproto.casttype) = "github.com/cometbft/cometbft/libs/bytes.HexBytes", - (gogoproto.moretags) = "yaml:\"next_validators_hash\"" - ]; + ibc.core.commitment.v1.MerkleRoot root = 2 [(gogoproto.nullable) = false]; + bytes next_validators_hash = 3 [(gogoproto.casttype) = "github.com/cometbft/cometbft/libs/bytes.HexBytes"]; } // Misbehaviour is a wrapper over two conflicting Headers @@ -80,9 +68,9 @@ message Misbehaviour { option (gogoproto.goproto_getters) = false; // ClientID is deprecated - string client_id = 1 [deprecated = true, (gogoproto.moretags) = "yaml:\"client_id\""]; - Header header_1 = 2 [(gogoproto.customname) = "Header1", (gogoproto.moretags) = "yaml:\"header_1\""]; - Header header_2 = 3 [(gogoproto.customname) = "Header2", (gogoproto.moretags) = "yaml:\"header_2\""]; + string client_id = 1 [deprecated = true]; + Header header_1 = 2 [(gogoproto.customname) = "Header1"]; + Header header_2 = 3 [(gogoproto.customname) = "Header2"]; } // Header defines the Tendermint client consensus Header. @@ -98,13 +86,11 @@ message Misbehaviour { // hash to TrustedConsensusState.NextValidatorsHash since that is the last // trusted validator set at the TrustedHeight. message Header { - .tendermint.types.SignedHeader signed_header = 1 - [(gogoproto.embed) = true, (gogoproto.moretags) = "yaml:\"signed_header\""]; + .tendermint.types.SignedHeader signed_header = 1 [(gogoproto.embed) = true]; - .tendermint.types.ValidatorSet validator_set = 2 [(gogoproto.moretags) = "yaml:\"validator_set\""]; - ibc.core.client.v1.Height trusted_height = 3 - [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"trusted_height\""]; - .tendermint.types.ValidatorSet trusted_validators = 4 [(gogoproto.moretags) = "yaml:\"trusted_validators\""]; + .tendermint.types.ValidatorSet validator_set = 2; + ibc.core.client.v1.Height trusted_height = 3 [(gogoproto.nullable) = false]; + .tendermint.types.ValidatorSet trusted_validators = 4; } // Fraction defines the protobuf message type for tmmath.Fraction that only diff --git a/proto/ibc/lightclients/wasm/v1/genesis.proto b/proto/ibc/lightclients/wasm/v1/genesis.proto new file mode 100644 index 0000000..127b5d3 --- /dev/null +++ b/proto/ibc/lightclients/wasm/v1/genesis.proto @@ -0,0 +1,20 @@ + +syntax = "proto3"; +package ibc.lightclients.wasm.v1; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/v10/types"; + +// GenesisState defines 08-wasm's keeper genesis state +message GenesisState { + // uploaded light client wasm contracts + repeated Contract contracts = 1 [(gogoproto.nullable) = false]; +} + +// Contract stores contract code +message Contract { + option (gogoproto.goproto_getters) = false; + // contract byte code + bytes code_bytes = 1; +} diff --git a/proto/ibc/lightclients/wasm/v1/query.proto b/proto/ibc/lightclients/wasm/v1/query.proto new file mode 100644 index 0000000..7308137 --- /dev/null +++ b/proto/ibc/lightclients/wasm/v1/query.proto @@ -0,0 +1,46 @@ +syntax = "proto3"; +package ibc.lightclients.wasm.v1; + +import "google/api/annotations.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; + +option go_package = "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/v10/types"; + +// Query service for wasm module +service Query { + // Get all Wasm checksums + rpc Checksums(QueryChecksumsRequest) returns (QueryChecksumsResponse) { + option (google.api.http).get = "/ibc/lightclients/wasm/v1/checksums"; + } + + // Get Wasm code for given checksum + rpc Code(QueryCodeRequest) returns (QueryCodeResponse) { + option (google.api.http).get = "/ibc/lightclients/wasm/v1/checksums/{checksum}/code"; + } +} + +// QueryChecksumsRequest is the request type for the Query/Checksums RPC method. +message QueryChecksumsRequest { + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +// QueryChecksumsResponse is the response type for the Query/Checksums RPC method. +message QueryChecksumsResponse { + // checksums is a list of the hex encoded checksums of all wasm codes stored. + repeated string checksums = 1; + + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryCodeRequest is the request type for the Query/Code RPC method. +message QueryCodeRequest { + // checksum is a hex encoded string of the code stored. + string checksum = 1; +} + +// QueryCodeResponse is the response type for the Query/Code RPC method. +message QueryCodeResponse { + bytes data = 1; +} diff --git a/proto/ibc/lightclients/wasm/v1/tx.proto b/proto/ibc/lightclients/wasm/v1/tx.proto new file mode 100644 index 0000000..0ff5c69 --- /dev/null +++ b/proto/ibc/lightclients/wasm/v1/tx.proto @@ -0,0 +1,66 @@ +syntax = "proto3"; +package ibc.lightclients.wasm.v1; + +option go_package = "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/v10/types"; + +import "cosmos/msg/v1/msg.proto"; + +// Msg defines the ibc/08-wasm Msg service. +service Msg { + option (cosmos.msg.v1.service) = true; + + // StoreCode defines a rpc handler method for MsgStoreCode. + rpc StoreCode(MsgStoreCode) returns (MsgStoreCodeResponse); + + // RemoveChecksum defines a rpc handler method for MsgRemoveChecksum. + rpc RemoveChecksum(MsgRemoveChecksum) returns (MsgRemoveChecksumResponse); + + // MigrateContract defines a rpc handler method for MsgMigrateContract. + rpc MigrateContract(MsgMigrateContract) returns (MsgMigrateContractResponse); +} + +// MsgStoreCode defines the request type for the StoreCode rpc. +message MsgStoreCode { + option (cosmos.msg.v1.signer) = "signer"; + + // signer address + string signer = 1; + // wasm byte code of light client contract. It can be raw or gzip compressed + bytes wasm_byte_code = 2; +} + +// MsgStoreCodeResponse defines the response type for the StoreCode rpc +message MsgStoreCodeResponse { + // checksum is the sha256 hash of the stored code + bytes checksum = 1; +} + +// MsgRemoveChecksum defines the request type for the MsgRemoveChecksum rpc. +message MsgRemoveChecksum { + option (cosmos.msg.v1.signer) = "signer"; + + // signer address + string signer = 1; + // checksum is the sha256 hash to be removed from the store + bytes checksum = 2; +} + +// MsgStoreChecksumResponse defines the response type for the StoreCode rpc +message MsgRemoveChecksumResponse {} + +// MsgMigrateContract defines the request type for the MigrateContract rpc. +message MsgMigrateContract { + option (cosmos.msg.v1.signer) = "signer"; + + // signer address + string signer = 1; + // the client id of the contract + string client_id = 2; + // checksum is the sha256 hash of the new wasm byte code for the contract + bytes checksum = 3; + // the json encoded message to be passed to the contract on migration + bytes msg = 4; +} + +// MsgMigrateContractResponse defines the response type for the MigrateContract rpc +message MsgMigrateContractResponse {} diff --git a/proto/ibc/lightclients/wasm/v1/wasm.proto b/proto/ibc/lightclients/wasm/v1/wasm.proto new file mode 100644 index 0000000..da7071f --- /dev/null +++ b/proto/ibc/lightclients/wasm/v1/wasm.proto @@ -0,0 +1,43 @@ + +syntax = "proto3"; +package ibc.lightclients.wasm.v1; + +import "gogoproto/gogo.proto"; +import "ibc/core/client/v1/client.proto"; + +option go_package = "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/v10/types"; + +// Wasm light client's Client state +message ClientState { + option (gogoproto.goproto_getters) = false; + // bytes encoding the client state of the underlying light client + // implemented as a Wasm contract. + bytes data = 1; + bytes checksum = 2; + ibc.core.client.v1.Height latest_height = 3 [(gogoproto.nullable) = false]; +} + +// Wasm light client's ConsensusState +message ConsensusState { + option (gogoproto.goproto_getters) = false; + // bytes encoding the consensus state of the underlying light client + // implemented as a Wasm contract. + bytes data = 1; +} + +// Wasm light client message (either header(s) or misbehaviour) +message ClientMessage { + option (gogoproto.goproto_getters) = false; + + bytes data = 1; +} + +// Checksums defines a list of all checksums that are stored +// +// Deprecated: This message is deprecated in favor of storing the checksums +// using a Collections.KeySet. +message Checksums { + option deprecated = true; + + repeated bytes checksums = 1; +} diff --git a/scripts/update-protos.sh b/scripts/update-protos.sh index 13d86f2..0d1c56a 100755 --- a/scripts/update-protos.sh +++ b/scripts/update-protos.sh @@ -9,7 +9,7 @@ cosmos_tag=v0.50.14-lsm-disabled ics23_git=https://github.com/cosmos/ics23.git ics23_tag=v0.10.0 -ibc_git=https://github.com/persistenceOne/ibc-go.git +ibc_git=https://github.com/cosmos/ibc-go.git ibc_tag=v10.1.1 pstake_git=https://github.com/persistenceOne/pstake-native.git @@ -18,7 +18,7 @@ pstake_tag=v5.0.0-rc1 persistence_sdk_git=https://github.com/persistenceOne/persistence-sdk.git persistence_sdk_tag=v5.0.0-rc1 -wasmd_git=https://github.com/persistenceOne/wasmd.git +wasmd_git=https://github.com/cosmwasm/wasmd.git wasmd_tag=v0.55.1 gaia_git=https://github.com/persistenceOne/gaia.git diff --git a/src/cosmwasm/wasm/v1/authz.ts b/src/cosmwasm/wasm/v1/authz.ts index 0d14b28..8f7fa93 100644 --- a/src/cosmwasm/wasm/v1/authz.ts +++ b/src/cosmwasm/wasm/v1/authz.ts @@ -1,9 +1,18 @@ /* eslint-disable */ +import { AccessConfig } from "./types"; import { Any } from "../../../google/protobuf/any"; import { Coin } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, bytesFromBase64, base64FromBytes } from "../../../helpers"; export const protobufPackage = "cosmwasm.wasm.v1"; +/** + * StoreCodeAuthorization defines authorization for wasm code upload. + * Since: wasmd 0.42 + */ +export interface StoreCodeAuthorization { + /** Grants for code upload */ + grants: CodeGrant[]; +} /** * ContractExecutionAuthorization defines authorization for wasm execute. * Since: wasmd 0.30 @@ -20,6 +29,20 @@ export interface ContractMigrationAuthorization { /** Grants for contract migrations */ grants: ContractGrant[]; } +/** CodeGrant a granted permission for a single code */ +export interface CodeGrant { + /** + * CodeHash is the unique identifier created by wasmvm + * Wildcard "*" is used to specify any kind of grant. + */ + codeHash: Uint8Array; + /** + * InstantiatePermission is the superset access control to apply + * on contract creation. + * Optional + */ + instantiatePermission: AccessConfig; +} /** * ContractGrant a granted permission for a single contract * Since: wasmd 0.30 @@ -90,6 +113,55 @@ export interface AcceptedMessagesFilter { /** Messages is the list of raw contract messages */ messages: Uint8Array[]; } +function createBaseStoreCodeAuthorization(): StoreCodeAuthorization { + return { + grants: [], + }; +} +export const StoreCodeAuthorization = { + encode(message: StoreCodeAuthorization, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.grants) { + CodeGrant.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): StoreCodeAuthorization { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStoreCodeAuthorization(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.grants.push(CodeGrant.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): StoreCodeAuthorization { + const obj = createBaseStoreCodeAuthorization(); + if (Array.isArray(object?.grants)) obj.grants = object.grants.map((e: any) => CodeGrant.fromJSON(e)); + return obj; + }, + toJSON(message: StoreCodeAuthorization): unknown { + const obj: any = {}; + if (message.grants) { + obj.grants = message.grants.map((e) => (e ? CodeGrant.toJSON(e) : undefined)); + } else { + obj.grants = []; + } + return obj; + }, + fromPartial(object: Partial): StoreCodeAuthorization { + const message = createBaseStoreCodeAuthorization(); + message.grants = object.grants?.map((e) => CodeGrant.fromPartial(e)) || []; + return message; + }, +}; function createBaseContractExecutionAuthorization(): ContractExecutionAuthorization { return { grants: [], @@ -194,6 +266,68 @@ export const ContractMigrationAuthorization = { return message; }, }; +function createBaseCodeGrant(): CodeGrant { + return { + codeHash: new Uint8Array(), + instantiatePermission: AccessConfig.fromPartial({}), + }; +} +export const CodeGrant = { + encode(message: CodeGrant, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.codeHash.length !== 0) { + writer.uint32(10).bytes(message.codeHash); + } + if (message.instantiatePermission !== undefined) { + AccessConfig.encode(message.instantiatePermission, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): CodeGrant { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCodeGrant(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.codeHash = reader.bytes(); + break; + case 2: + message.instantiatePermission = AccessConfig.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): CodeGrant { + const obj = createBaseCodeGrant(); + if (isSet(object.codeHash)) obj.codeHash = bytesFromBase64(object.codeHash); + if (isSet(object.instantiatePermission)) + obj.instantiatePermission = AccessConfig.fromJSON(object.instantiatePermission); + return obj; + }, + toJSON(message: CodeGrant): unknown { + const obj: any = {}; + message.codeHash !== undefined && + (obj.codeHash = base64FromBytes(message.codeHash !== undefined ? message.codeHash : new Uint8Array())); + message.instantiatePermission !== undefined && + (obj.instantiatePermission = message.instantiatePermission + ? AccessConfig.toJSON(message.instantiatePermission) + : undefined); + return obj; + }, + fromPartial(object: Partial): CodeGrant { + const message = createBaseCodeGrant(); + message.codeHash = object.codeHash ?? new Uint8Array(); + if (object.instantiatePermission !== undefined && object.instantiatePermission !== null) { + message.instantiatePermission = AccessConfig.fromPartial(object.instantiatePermission); + } + return message; + }, +}; function createBaseContractGrant(): ContractGrant { return { contract: "", diff --git a/src/cosmwasm/wasm/v1/ibc.ts b/src/cosmwasm/wasm/v1/ibc.ts index 09f95c3..d60971c 100644 --- a/src/cosmwasm/wasm/v1/ibc.ts +++ b/src/cosmwasm/wasm/v1/ibc.ts @@ -27,6 +27,8 @@ export interface MsgIBCSendResponse { /** Sequence number of the IBC packet sent */ sequence: bigint; } +/** MsgIBCWriteAcknowledgementResponse */ +export interface MsgIBCWriteAcknowledgementResponse {} /** MsgIBCCloseChannel port and channel need to be owned by the contract */ export interface MsgIBCCloseChannel { channel: string; @@ -160,6 +162,40 @@ export const MsgIBCSendResponse = { return message; }, }; +function createBaseMsgIBCWriteAcknowledgementResponse(): MsgIBCWriteAcknowledgementResponse { + return {}; +} +export const MsgIBCWriteAcknowledgementResponse = { + encode(_: MsgIBCWriteAcknowledgementResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgIBCWriteAcknowledgementResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgIBCWriteAcknowledgementResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): MsgIBCWriteAcknowledgementResponse { + const obj = createBaseMsgIBCWriteAcknowledgementResponse(); + return obj; + }, + toJSON(_: MsgIBCWriteAcknowledgementResponse): unknown { + const obj: any = {}; + return obj; + }, + fromPartial(_: Partial): MsgIBCWriteAcknowledgementResponse { + const message = createBaseMsgIBCWriteAcknowledgementResponse(); + return message; + }, +}; function createBaseMsgIBCCloseChannel(): MsgIBCCloseChannel { return { channel: "", diff --git a/src/cosmwasm/wasm/v1/proposal.ts b/src/cosmwasm/wasm/v1/proposal_legacy.ts similarity index 99% rename from src/cosmwasm/wasm/v1/proposal.ts rename to src/cosmwasm/wasm/v1/proposal_legacy.ts index 84963ee..103efe8 100644 --- a/src/cosmwasm/wasm/v1/proposal.ts +++ b/src/cosmwasm/wasm/v1/proposal_legacy.ts @@ -55,7 +55,7 @@ export interface InstantiateContractProposal { admin: string; /** CodeID is the reference to the stored WASM code */ codeId: bigint; - /** Label is optional metadata to be stored with a constract instance. */ + /** Label is optional metadata to be stored with a contract instance. */ label: string; /** Msg json encoded message to be passed to the contract on instantiation */ msg: Uint8Array; @@ -74,13 +74,13 @@ export interface InstantiateContract2Proposal { title: string; /** Description is a human readable text */ description: string; - /** RunAs is the address that is passed to the contract's enviroment as sender */ + /** RunAs is the address that is passed to the contract's environment as sender */ runAs: string; /** Admin is an optional address that can execute migrations */ admin: string; /** CodeID is the reference to the stored WASM code */ codeId: bigint; - /** Label is optional metadata to be stored with a constract instance. */ + /** Label is optional metadata to be stored with a contract instance. */ label: string; /** Msg json encode message to be passed to the contract on instantiation */ msg: Uint8Array; @@ -263,7 +263,7 @@ export interface StoreAndInstantiateContractProposal { unpinCode: boolean; /** Admin is an optional address that can execute migrations */ admin: string; - /** Label is optional metadata to be stored with a constract instance. */ + /** Label is optional metadata to be stored with a contract instance. */ label: string; /** Msg json encoded message to be passed to the contract on instantiation */ msg: Uint8Array; diff --git a/src/cosmwasm/wasm/v1/query.ts b/src/cosmwasm/wasm/v1/query.ts index 38f95bd..6da925d 100644 --- a/src/cosmwasm/wasm/v1/query.ts +++ b/src/cosmwasm/wasm/v1/query.ts @@ -46,7 +46,7 @@ export interface QueryContractHistoryResponse { */ export interface QueryContractsByCodeRequest { /** - * grpc-gateway_out does not support Go style CodID + * grpc-gateway_out does not support Go style CodeID * pagination defines an optional pagination for the request. */ codeId: bigint; @@ -118,9 +118,21 @@ export interface QuerySmartContractStateResponse { } /** QueryCodeRequest is the request type for the Query/Code RPC method */ export interface QueryCodeRequest { - /** grpc-gateway_out does not support Go style CodID */ + /** grpc-gateway_out does not support Go style CodeID */ codeId: bigint; } +/** QueryCodeInfoRequest is the request type for the Query/CodeInfo RPC method */ +export interface QueryCodeInfoRequest { + /** grpc-gateway_out does not support Go style CodeID */ + codeId: bigint; +} +/** QueryCodeInfoResponse is the response type for the Query/CodeInfo RPC method */ +export interface QueryCodeInfoResponse { + codeId: bigint; + creator: string; + checksum: Uint8Array; + instantiatePermission: AccessConfig; +} /** CodeInfoResponse contains code meta data from CodeInfo */ export interface CodeInfoResponse { codeId: bigint; @@ -188,6 +200,49 @@ export interface QueryContractsByCreatorResponse { /** Pagination defines the pagination in the response. */ pagination: PageResponse; } +/** + * QueryWasmLimitsConfigRequest is the request type for the + * Query/WasmLimitsConfig RPC method. + */ +export interface QueryWasmLimitsConfigRequest {} +/** + * QueryWasmLimitsConfigResponse is the response type for the + * Query/WasmLimitsConfig RPC method. It contains the JSON encoded limits for + * static validation of Wasm files. + */ +export interface QueryWasmLimitsConfigResponse { + /** + * QueryWasmLimitsConfigResponse is the response type for the + * Query/WasmLimitsConfig RPC method. It contains the JSON encoded limits for + * static validation of Wasm files. + */ + config: string; +} +/** + * QueryBuildAddressRequest is the request type for the Query/BuildAddress RPC + * method. + */ +export interface QueryBuildAddressRequest { + /** CodeHash is the hash of the code */ + codeHash: string; + /** CreatorAddress is the address of the contract instantiator */ + creatorAddress: string; + /** Salt is a hex encoded salt */ + salt: string; + /** + * InitArgs are optional json encoded init args to be used in contract address + * building if provided + */ + initArgs: Uint8Array; +} +/** + * QueryBuildAddressResponse is the response type for the Query/BuildAddress RPC + * method. + */ +export interface QueryBuildAddressResponse { + /** Address is the contract address */ + address: string; +} function createBaseQueryContractInfoRequest(): QueryContractInfoRequest { return { address: "", @@ -915,6 +970,137 @@ export const QueryCodeRequest = { return message; }, }; +function createBaseQueryCodeInfoRequest(): QueryCodeInfoRequest { + return { + codeId: BigInt(0), + }; +} +export const QueryCodeInfoRequest = { + encode(message: QueryCodeInfoRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.codeId !== BigInt(0)) { + writer.uint32(8).uint64(message.codeId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryCodeInfoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCodeInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.codeId = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryCodeInfoRequest { + const obj = createBaseQueryCodeInfoRequest(); + if (isSet(object.codeId)) obj.codeId = BigInt(object.codeId.toString()); + return obj; + }, + toJSON(message: QueryCodeInfoRequest): unknown { + const obj: any = {}; + message.codeId !== undefined && (obj.codeId = (message.codeId || BigInt(0)).toString()); + return obj; + }, + fromPartial(object: Partial): QueryCodeInfoRequest { + const message = createBaseQueryCodeInfoRequest(); + if (object.codeId !== undefined && object.codeId !== null) { + message.codeId = BigInt(object.codeId.toString()); + } + return message; + }, +}; +function createBaseQueryCodeInfoResponse(): QueryCodeInfoResponse { + return { + codeId: BigInt(0), + creator: "", + checksum: new Uint8Array(), + instantiatePermission: AccessConfig.fromPartial({}), + }; +} +export const QueryCodeInfoResponse = { + encode(message: QueryCodeInfoResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.codeId !== BigInt(0)) { + writer.uint32(8).uint64(message.codeId); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.checksum.length !== 0) { + writer.uint32(26).bytes(message.checksum); + } + if (message.instantiatePermission !== undefined) { + AccessConfig.encode(message.instantiatePermission, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryCodeInfoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCodeInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.codeId = reader.uint64(); + break; + case 2: + message.creator = reader.string(); + break; + case 3: + message.checksum = reader.bytes(); + break; + case 4: + message.instantiatePermission = AccessConfig.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryCodeInfoResponse { + const obj = createBaseQueryCodeInfoResponse(); + if (isSet(object.codeId)) obj.codeId = BigInt(object.codeId.toString()); + if (isSet(object.creator)) obj.creator = String(object.creator); + if (isSet(object.checksum)) obj.checksum = bytesFromBase64(object.checksum); + if (isSet(object.instantiatePermission)) + obj.instantiatePermission = AccessConfig.fromJSON(object.instantiatePermission); + return obj; + }, + toJSON(message: QueryCodeInfoResponse): unknown { + const obj: any = {}; + message.codeId !== undefined && (obj.codeId = (message.codeId || BigInt(0)).toString()); + message.creator !== undefined && (obj.creator = message.creator); + message.checksum !== undefined && + (obj.checksum = base64FromBytes(message.checksum !== undefined ? message.checksum : new Uint8Array())); + message.instantiatePermission !== undefined && + (obj.instantiatePermission = message.instantiatePermission + ? AccessConfig.toJSON(message.instantiatePermission) + : undefined); + return obj; + }, + fromPartial(object: Partial): QueryCodeInfoResponse { + const message = createBaseQueryCodeInfoResponse(); + if (object.codeId !== undefined && object.codeId !== null) { + message.codeId = BigInt(object.codeId.toString()); + } + message.creator = object.creator ?? ""; + message.checksum = object.checksum ?? new Uint8Array(); + if (object.instantiatePermission !== undefined && object.instantiatePermission !== null) { + message.instantiatePermission = AccessConfig.fromPartial(object.instantiatePermission); + } + return message; + }, +}; function createBaseCodeInfoResponse(): CodeInfoResponse { return { codeId: BigInt(0), @@ -1496,6 +1682,206 @@ export const QueryContractsByCreatorResponse = { return message; }, }; +function createBaseQueryWasmLimitsConfigRequest(): QueryWasmLimitsConfigRequest { + return {}; +} +export const QueryWasmLimitsConfigRequest = { + encode(_: QueryWasmLimitsConfigRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryWasmLimitsConfigRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryWasmLimitsConfigRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): QueryWasmLimitsConfigRequest { + const obj = createBaseQueryWasmLimitsConfigRequest(); + return obj; + }, + toJSON(_: QueryWasmLimitsConfigRequest): unknown { + const obj: any = {}; + return obj; + }, + fromPartial(_: Partial): QueryWasmLimitsConfigRequest { + const message = createBaseQueryWasmLimitsConfigRequest(); + return message; + }, +}; +function createBaseQueryWasmLimitsConfigResponse(): QueryWasmLimitsConfigResponse { + return { + config: "", + }; +} +export const QueryWasmLimitsConfigResponse = { + encode(message: QueryWasmLimitsConfigResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.config !== "") { + writer.uint32(10).string(message.config); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryWasmLimitsConfigResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryWasmLimitsConfigResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.config = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryWasmLimitsConfigResponse { + const obj = createBaseQueryWasmLimitsConfigResponse(); + if (isSet(object.config)) obj.config = String(object.config); + return obj; + }, + toJSON(message: QueryWasmLimitsConfigResponse): unknown { + const obj: any = {}; + message.config !== undefined && (obj.config = message.config); + return obj; + }, + fromPartial(object: Partial): QueryWasmLimitsConfigResponse { + const message = createBaseQueryWasmLimitsConfigResponse(); + message.config = object.config ?? ""; + return message; + }, +}; +function createBaseQueryBuildAddressRequest(): QueryBuildAddressRequest { + return { + codeHash: "", + creatorAddress: "", + salt: "", + initArgs: new Uint8Array(), + }; +} +export const QueryBuildAddressRequest = { + encode(message: QueryBuildAddressRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.codeHash !== "") { + writer.uint32(10).string(message.codeHash); + } + if (message.creatorAddress !== "") { + writer.uint32(18).string(message.creatorAddress); + } + if (message.salt !== "") { + writer.uint32(26).string(message.salt); + } + if (message.initArgs.length !== 0) { + writer.uint32(34).bytes(message.initArgs); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryBuildAddressRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryBuildAddressRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.codeHash = reader.string(); + break; + case 2: + message.creatorAddress = reader.string(); + break; + case 3: + message.salt = reader.string(); + break; + case 4: + message.initArgs = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryBuildAddressRequest { + const obj = createBaseQueryBuildAddressRequest(); + if (isSet(object.codeHash)) obj.codeHash = String(object.codeHash); + if (isSet(object.creatorAddress)) obj.creatorAddress = String(object.creatorAddress); + if (isSet(object.salt)) obj.salt = String(object.salt); + if (isSet(object.initArgs)) obj.initArgs = bytesFromBase64(object.initArgs); + return obj; + }, + toJSON(message: QueryBuildAddressRequest): unknown { + const obj: any = {}; + message.codeHash !== undefined && (obj.codeHash = message.codeHash); + message.creatorAddress !== undefined && (obj.creatorAddress = message.creatorAddress); + message.salt !== undefined && (obj.salt = message.salt); + message.initArgs !== undefined && + (obj.initArgs = base64FromBytes(message.initArgs !== undefined ? message.initArgs : new Uint8Array())); + return obj; + }, + fromPartial(object: Partial): QueryBuildAddressRequest { + const message = createBaseQueryBuildAddressRequest(); + message.codeHash = object.codeHash ?? ""; + message.creatorAddress = object.creatorAddress ?? ""; + message.salt = object.salt ?? ""; + message.initArgs = object.initArgs ?? new Uint8Array(); + return message; + }, +}; +function createBaseQueryBuildAddressResponse(): QueryBuildAddressResponse { + return { + address: "", + }; +} +export const QueryBuildAddressResponse = { + encode(message: QueryBuildAddressResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryBuildAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryBuildAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryBuildAddressResponse { + const obj = createBaseQueryBuildAddressResponse(); + if (isSet(object.address)) obj.address = String(object.address); + return obj; + }, + toJSON(message: QueryBuildAddressResponse): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + return obj; + }, + fromPartial(object: Partial): QueryBuildAddressResponse { + const message = createBaseQueryBuildAddressResponse(); + message.address = object.address ?? ""; + return message; + }, +}; /** Query provides defines the gRPC querier service */ export interface Query { /** ContractInfo gets the contract meta data */ @@ -1510,16 +1896,25 @@ export interface Query { RawContractState(request: QueryRawContractStateRequest): Promise; /** SmartContractState get smart query result from the contract */ SmartContractState(request: QuerySmartContractStateRequest): Promise; - /** Code gets the binary code and metadata for a singe wasm code */ + /** Code gets the binary code and metadata for a single wasm code */ Code(request: QueryCodeRequest): Promise; /** Codes gets the metadata for all stored wasm codes */ Codes(request?: QueryCodesRequest): Promise; + /** CodeInfo gets the metadata for a single wasm code */ + CodeInfo(request: QueryCodeInfoRequest): Promise; /** PinnedCodes gets the pinned code ids */ PinnedCodes(request?: QueryPinnedCodesRequest): Promise; /** Params gets the module params */ Params(request?: QueryParamsRequest): Promise; /** ContractsByCreator gets the contracts by creator */ ContractsByCreator(request: QueryContractsByCreatorRequest): Promise; + /** + * WasmLimitsConfig gets the configured limits for static validation of Wasm + * files, encoded in JSON. + */ + WasmLimitsConfig(request?: QueryWasmLimitsConfigRequest): Promise; + /** BuildAddress builds a contract address */ + BuildAddress(request: QueryBuildAddressRequest): Promise; } export class QueryClientImpl implements Query { private readonly rpc: Rpc; @@ -1533,9 +1928,12 @@ export class QueryClientImpl implements Query { this.SmartContractState = this.SmartContractState.bind(this); this.Code = this.Code.bind(this); this.Codes = this.Codes.bind(this); + this.CodeInfo = this.CodeInfo.bind(this); this.PinnedCodes = this.PinnedCodes.bind(this); this.Params = this.Params.bind(this); this.ContractsByCreator = this.ContractsByCreator.bind(this); + this.WasmLimitsConfig = this.WasmLimitsConfig.bind(this); + this.BuildAddress = this.BuildAddress.bind(this); } ContractInfo(request: QueryContractInfoRequest): Promise { const data = QueryContractInfoRequest.encode(request).finish(); @@ -1581,6 +1979,11 @@ export class QueryClientImpl implements Query { const promise = this.rpc.request("cosmwasm.wasm.v1.Query", "Codes", data); return promise.then((data) => QueryCodesResponse.decode(new BinaryReader(data))); } + CodeInfo(request: QueryCodeInfoRequest): Promise { + const data = QueryCodeInfoRequest.encode(request).finish(); + const promise = this.rpc.request("cosmwasm.wasm.v1.Query", "CodeInfo", data); + return promise.then((data) => QueryCodeInfoResponse.decode(new BinaryReader(data))); + } PinnedCodes( request: QueryPinnedCodesRequest = { pagination: PageRequest.fromPartial({}), @@ -1600,4 +2003,14 @@ export class QueryClientImpl implements Query { const promise = this.rpc.request("cosmwasm.wasm.v1.Query", "ContractsByCreator", data); return promise.then((data) => QueryContractsByCreatorResponse.decode(new BinaryReader(data))); } + WasmLimitsConfig(request: QueryWasmLimitsConfigRequest = {}): Promise { + const data = QueryWasmLimitsConfigRequest.encode(request).finish(); + const promise = this.rpc.request("cosmwasm.wasm.v1.Query", "WasmLimitsConfig", data); + return promise.then((data) => QueryWasmLimitsConfigResponse.decode(new BinaryReader(data))); + } + BuildAddress(request: QueryBuildAddressRequest): Promise { + const data = QueryBuildAddressRequest.encode(request).finish(); + const promise = this.rpc.request("cosmwasm.wasm.v1.Query", "BuildAddress", data); + return promise.then((data) => QueryBuildAddressResponse.decode(new BinaryReader(data))); + } } diff --git a/src/cosmwasm/wasm/v1/tx.amino.ts b/src/cosmwasm/wasm/v1/tx.amino.ts index a0d627b..80f0bcf 100644 --- a/src/cosmwasm/wasm/v1/tx.amino.ts +++ b/src/cosmwasm/wasm/v1/tx.amino.ts @@ -16,6 +16,10 @@ import { MsgPinCodes, MsgUnpinCodes, MsgStoreAndInstantiateContract, + MsgRemoveCodeUploadParamsAddresses, + MsgAddCodeUploadParamsAddresses, + MsgStoreAndMigrateContract, + MsgUpdateContractLabel, } from "./tx"; export interface MsgStoreCodeAminoType extends AminoMsg { type: "wasm/MsgStoreCode"; @@ -24,7 +28,6 @@ export interface MsgStoreCodeAminoType extends AminoMsg { wasm_byte_code: string; instantiate_permission: { permission: number; - address: string; addresses: string[]; }; }; @@ -102,7 +105,6 @@ export interface MsgUpdateInstantiateConfigAminoType extends AminoMsg { code_id: string; new_instantiate_permission: { permission: number; - address: string; addresses: string[]; }; }; @@ -114,7 +116,6 @@ export interface MsgUpdateParamsAminoType extends AminoMsg { params: { code_upload_access: { permission: number; - address: string; addresses: string[]; }; instantiate_default_permission: number; @@ -150,7 +151,6 @@ export interface MsgStoreAndInstantiateContractAminoType extends AminoMsg { wasm_byte_code: string; instantiate_permission: { permission: number; - address: string; addresses: string[]; }; unpin_code: boolean; @@ -166,6 +166,41 @@ export interface MsgStoreAndInstantiateContractAminoType extends AminoMsg { code_hash: Uint8Array; }; } +export interface MsgRemoveCodeUploadParamsAddressesAminoType extends AminoMsg { + type: "wasm/MsgRemoveCodeUploadParamsAddresses"; + value: { + authority: string; + addresses: string[]; + }; +} +export interface MsgAddCodeUploadParamsAddressesAminoType extends AminoMsg { + type: "wasm/MsgAddCodeUploadParamsAddresses"; + value: { + authority: string; + addresses: string[]; + }; +} +export interface MsgStoreAndMigrateContractAminoType extends AminoMsg { + type: "wasm/MsgStoreAndMigrateContract"; + value: { + authority: string; + wasm_byte_code: string; + instantiate_permission: { + permission: number; + addresses: string[]; + }; + contract: string; + msg: Uint8Array; + }; +} +export interface MsgUpdateContractLabelAminoType extends AminoMsg { + type: "wasm/MsgUpdateContractLabel"; + value: { + sender: string; + new_label: string; + contract: string; + }; +} export const AminoConverter = { "/cosmwasm.wasm.v1.MsgStoreCode": { aminoType: "wasm/MsgStoreCode", @@ -179,7 +214,6 @@ export const AminoConverter = { wasm_byte_code: toBase64(wasmByteCode), instantiate_permission: { permission: instantiatePermission.permission, - address: instantiatePermission.address, addresses: instantiatePermission.addresses, }, }; @@ -194,7 +228,6 @@ export const AminoConverter = { wasmByteCode: fromBase64(wasm_byte_code), instantiatePermission: { permission: accessTypeFromJSON(instantiate_permission.permission), - address: instantiate_permission.address, addresses: instantiate_permission.addresses, }, }; @@ -397,7 +430,6 @@ export const AminoConverter = { code_id: codeId.toString(), new_instantiate_permission: { permission: newInstantiatePermission.permission, - address: newInstantiatePermission.address, addresses: newInstantiatePermission.addresses, }, }; @@ -412,7 +444,6 @@ export const AminoConverter = { codeId: BigInt(code_id), newInstantiatePermission: { permission: accessTypeFromJSON(new_instantiate_permission.permission), - address: new_instantiate_permission.address, addresses: new_instantiate_permission.addresses, }, }; @@ -426,7 +457,6 @@ export const AminoConverter = { params: { code_upload_access: { permission: params.codeUploadAccess.permission, - address: params.codeUploadAccess.address, addresses: params.codeUploadAccess.addresses, }, instantiate_default_permission: params.instantiateDefaultPermission, @@ -439,7 +469,6 @@ export const AminoConverter = { params: { codeUploadAccess: { permission: accessTypeFromJSON(params.code_upload_access.permission), - address: params.code_upload_access.address, addresses: params.code_upload_access.addresses, }, instantiateDefaultPermission: accessTypeFromJSON(params.instantiate_default_permission), @@ -514,7 +543,6 @@ export const AminoConverter = { wasm_byte_code: toBase64(wasmByteCode), instantiate_permission: { permission: instantiatePermission.permission, - address: instantiatePermission.address, addresses: instantiatePermission.addresses, }, unpin_code: unpinCode, @@ -548,7 +576,6 @@ export const AminoConverter = { wasmByteCode: fromBase64(wasm_byte_code), instantiatePermission: { permission: accessTypeFromJSON(instantiate_permission.permission), - address: instantiate_permission.address, addresses: instantiate_permission.addresses, }, unpinCode: unpin_code, @@ -565,4 +592,110 @@ export const AminoConverter = { }; }, }, + "/cosmwasm.wasm.v1.MsgRemoveCodeUploadParamsAddresses": { + aminoType: "wasm/MsgRemoveCodeUploadParamsAddresses", + toAmino: ({ + authority, + addresses, + }: MsgRemoveCodeUploadParamsAddresses): MsgRemoveCodeUploadParamsAddressesAminoType["value"] => { + return { + authority, + addresses, + }; + }, + fromAmino: ({ + authority, + addresses, + }: MsgRemoveCodeUploadParamsAddressesAminoType["value"]): MsgRemoveCodeUploadParamsAddresses => { + return { + authority, + addresses, + }; + }, + }, + "/cosmwasm.wasm.v1.MsgAddCodeUploadParamsAddresses": { + aminoType: "wasm/MsgAddCodeUploadParamsAddresses", + toAmino: ({ + authority, + addresses, + }: MsgAddCodeUploadParamsAddresses): MsgAddCodeUploadParamsAddressesAminoType["value"] => { + return { + authority, + addresses, + }; + }, + fromAmino: ({ + authority, + addresses, + }: MsgAddCodeUploadParamsAddressesAminoType["value"]): MsgAddCodeUploadParamsAddresses => { + return { + authority, + addresses, + }; + }, + }, + "/cosmwasm.wasm.v1.MsgStoreAndMigrateContract": { + aminoType: "wasm/MsgStoreAndMigrateContract", + toAmino: ({ + authority, + wasmByteCode, + instantiatePermission, + contract, + msg, + }: MsgStoreAndMigrateContract): MsgStoreAndMigrateContractAminoType["value"] => { + return { + authority, + wasm_byte_code: toBase64(wasmByteCode), + instantiate_permission: { + permission: instantiatePermission.permission, + addresses: instantiatePermission.addresses, + }, + contract, + msg: JSON.parse(fromUtf8(msg)), + }; + }, + fromAmino: ({ + authority, + wasm_byte_code, + instantiate_permission, + contract, + msg, + }: MsgStoreAndMigrateContractAminoType["value"]): MsgStoreAndMigrateContract => { + return { + authority, + wasmByteCode: fromBase64(wasm_byte_code), + instantiatePermission: { + permission: accessTypeFromJSON(instantiate_permission.permission), + addresses: instantiate_permission.addresses, + }, + contract, + msg: toUtf8(JSON.stringify(msg)), + }; + }, + }, + "/cosmwasm.wasm.v1.MsgUpdateContractLabel": { + aminoType: "wasm/MsgUpdateContractLabel", + toAmino: ({ + sender, + newLabel, + contract, + }: MsgUpdateContractLabel): MsgUpdateContractLabelAminoType["value"] => { + return { + sender, + new_label: newLabel, + contract, + }; + }, + fromAmino: ({ + sender, + new_label, + contract, + }: MsgUpdateContractLabelAminoType["value"]): MsgUpdateContractLabel => { + return { + sender, + newLabel: new_label, + contract, + }; + }, + }, }; diff --git a/src/cosmwasm/wasm/v1/tx.registry.ts b/src/cosmwasm/wasm/v1/tx.registry.ts index a84c7a0..b5633a7 100644 --- a/src/cosmwasm/wasm/v1/tx.registry.ts +++ b/src/cosmwasm/wasm/v1/tx.registry.ts @@ -15,6 +15,10 @@ import { MsgPinCodes, MsgUnpinCodes, MsgStoreAndInstantiateContract, + MsgRemoveCodeUploadParamsAddresses, + MsgAddCodeUploadParamsAddresses, + MsgStoreAndMigrateContract, + MsgUpdateContractLabel, } from "./tx"; export const registry: ReadonlyArray<[string, GeneratedType]> = [ ["/cosmwasm.wasm.v1.MsgStoreCode", MsgStoreCode], @@ -30,6 +34,10 @@ export const registry: ReadonlyArray<[string, GeneratedType]> = [ ["/cosmwasm.wasm.v1.MsgPinCodes", MsgPinCodes], ["/cosmwasm.wasm.v1.MsgUnpinCodes", MsgUnpinCodes], ["/cosmwasm.wasm.v1.MsgStoreAndInstantiateContract", MsgStoreAndInstantiateContract], + ["/cosmwasm.wasm.v1.MsgRemoveCodeUploadParamsAddresses", MsgRemoveCodeUploadParamsAddresses], + ["/cosmwasm.wasm.v1.MsgAddCodeUploadParamsAddresses", MsgAddCodeUploadParamsAddresses], + ["/cosmwasm.wasm.v1.MsgStoreAndMigrateContract", MsgStoreAndMigrateContract], + ["/cosmwasm.wasm.v1.MsgUpdateContractLabel", MsgUpdateContractLabel], ]; export const load = (protoRegistry: Registry) => { registry.forEach(([typeUrl, mod]) => { @@ -116,6 +124,30 @@ export const MessageComposer = { value: MsgStoreAndInstantiateContract.encode(value).finish(), }; }, + removeCodeUploadParamsAddresses(value: MsgRemoveCodeUploadParamsAddresses) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgRemoveCodeUploadParamsAddresses", + value: MsgRemoveCodeUploadParamsAddresses.encode(value).finish(), + }; + }, + addCodeUploadParamsAddresses(value: MsgAddCodeUploadParamsAddresses) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgAddCodeUploadParamsAddresses", + value: MsgAddCodeUploadParamsAddresses.encode(value).finish(), + }; + }, + storeAndMigrateContract(value: MsgStoreAndMigrateContract) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgStoreAndMigrateContract", + value: MsgStoreAndMigrateContract.encode(value).finish(), + }; + }, + updateContractLabel(value: MsgUpdateContractLabel) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateContractLabel", + value: MsgUpdateContractLabel.encode(value).finish(), + }; + }, }, withTypeUrl: { storeCode(value: MsgStoreCode) { @@ -196,6 +228,30 @@ export const MessageComposer = { value, }; }, + removeCodeUploadParamsAddresses(value: MsgRemoveCodeUploadParamsAddresses) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgRemoveCodeUploadParamsAddresses", + value, + }; + }, + addCodeUploadParamsAddresses(value: MsgAddCodeUploadParamsAddresses) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgAddCodeUploadParamsAddresses", + value, + }; + }, + storeAndMigrateContract(value: MsgStoreAndMigrateContract) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgStoreAndMigrateContract", + value, + }; + }, + updateContractLabel(value: MsgUpdateContractLabel) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateContractLabel", + value, + }; + }, }, toJSON: { storeCode(value: MsgStoreCode) { @@ -276,6 +332,30 @@ export const MessageComposer = { value: MsgStoreAndInstantiateContract.toJSON(value), }; }, + removeCodeUploadParamsAddresses(value: MsgRemoveCodeUploadParamsAddresses) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgRemoveCodeUploadParamsAddresses", + value: MsgRemoveCodeUploadParamsAddresses.toJSON(value), + }; + }, + addCodeUploadParamsAddresses(value: MsgAddCodeUploadParamsAddresses) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgAddCodeUploadParamsAddresses", + value: MsgAddCodeUploadParamsAddresses.toJSON(value), + }; + }, + storeAndMigrateContract(value: MsgStoreAndMigrateContract) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgStoreAndMigrateContract", + value: MsgStoreAndMigrateContract.toJSON(value), + }; + }, + updateContractLabel(value: MsgUpdateContractLabel) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateContractLabel", + value: MsgUpdateContractLabel.toJSON(value), + }; + }, }, fromJSON: { storeCode(value: any) { @@ -356,6 +436,30 @@ export const MessageComposer = { value: MsgStoreAndInstantiateContract.fromJSON(value), }; }, + removeCodeUploadParamsAddresses(value: any) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgRemoveCodeUploadParamsAddresses", + value: MsgRemoveCodeUploadParamsAddresses.fromJSON(value), + }; + }, + addCodeUploadParamsAddresses(value: any) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgAddCodeUploadParamsAddresses", + value: MsgAddCodeUploadParamsAddresses.fromJSON(value), + }; + }, + storeAndMigrateContract(value: any) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgStoreAndMigrateContract", + value: MsgStoreAndMigrateContract.fromJSON(value), + }; + }, + updateContractLabel(value: any) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateContractLabel", + value: MsgUpdateContractLabel.fromJSON(value), + }; + }, }, fromPartial: { storeCode(value: MsgStoreCode) { @@ -436,5 +540,29 @@ export const MessageComposer = { value: MsgStoreAndInstantiateContract.fromPartial(value), }; }, + removeCodeUploadParamsAddresses(value: MsgRemoveCodeUploadParamsAddresses) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgRemoveCodeUploadParamsAddresses", + value: MsgRemoveCodeUploadParamsAddresses.fromPartial(value), + }; + }, + addCodeUploadParamsAddresses(value: MsgAddCodeUploadParamsAddresses) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgAddCodeUploadParamsAddresses", + value: MsgAddCodeUploadParamsAddresses.fromPartial(value), + }; + }, + storeAndMigrateContract(value: MsgStoreAndMigrateContract) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgStoreAndMigrateContract", + value: MsgStoreAndMigrateContract.fromPartial(value), + }; + }, + updateContractLabel(value: MsgUpdateContractLabel) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateContractLabel", + value: MsgUpdateContractLabel.fromPartial(value), + }; + }, }, }; diff --git a/src/cosmwasm/wasm/v1/tx.ts b/src/cosmwasm/wasm/v1/tx.ts index c3074f5..1527987 100644 --- a/src/cosmwasm/wasm/v1/tx.ts +++ b/src/cosmwasm/wasm/v1/tx.ts @@ -50,7 +50,7 @@ export interface MsgInstantiateContractResponse { } /** * MsgInstantiateContract2 create a new smart contract instance for the given - * code id with a predicable address. + * code id with a predictable address. */ export interface MsgInstantiateContract2 { /** Sender is the that actor that signed the messages */ @@ -247,7 +247,7 @@ export interface MsgStoreAndInstantiateContract { unpinCode: boolean; /** Admin is an optional address that can execute migrations */ admin: string; - /** Label is optional metadata to be stored with a constract instance. */ + /** Label is optional metadata to be stored with a contract instance. */ label: string; /** Msg json encoded message to be passed to the contract on instantiation */ msg: Uint8Array; @@ -281,6 +281,77 @@ export interface MsgStoreAndInstantiateContractResponse { /** Data contains bytes to returned from the contract */ data: Uint8Array; } +/** + * MsgAddCodeUploadParamsAddresses is the + * MsgAddCodeUploadParamsAddresses request type. + */ +export interface MsgAddCodeUploadParamsAddresses { + /** Authority is the address of the governance account. */ + authority: string; + addresses: string[]; +} +/** + * MsgAddCodeUploadParamsAddressesResponse defines the response + * structure for executing a MsgAddCodeUploadParamsAddresses message. + */ +export interface MsgAddCodeUploadParamsAddressesResponse {} +/** + * MsgRemoveCodeUploadParamsAddresses is the + * MsgRemoveCodeUploadParamsAddresses request type. + */ +export interface MsgRemoveCodeUploadParamsAddresses { + /** Authority is the address of the governance account. */ + authority: string; + addresses: string[]; +} +/** + * MsgRemoveCodeUploadParamsAddressesResponse defines the response + * structure for executing a MsgRemoveCodeUploadParamsAddresses message. + */ +export interface MsgRemoveCodeUploadParamsAddressesResponse {} +/** + * MsgStoreAndMigrateContract is the MsgStoreAndMigrateContract + * request type. + * + * Since: 0.42 + */ +export interface MsgStoreAndMigrateContract { + /** Authority is the address of the governance account. */ + authority: string; + /** WASMByteCode can be raw or gzip compressed */ + wasmByteCode: Uint8Array; + /** InstantiatePermission to apply on contract creation, optional */ + instantiatePermission: AccessConfig; + /** Contract is the address of the smart contract */ + contract: string; + /** Msg json encoded message to be passed to the contract on migration */ + msg: Uint8Array; +} +/** + * MsgStoreAndMigrateContractResponse defines the response structure + * for executing a MsgStoreAndMigrateContract message. + * + * Since: 0.42 + */ +export interface MsgStoreAndMigrateContractResponse { + /** CodeID is the reference to the stored WASM code */ + codeId: bigint; + /** Checksum is the sha256 hash of the stored code */ + checksum: Uint8Array; + /** Data contains bytes to returned from the contract */ + data: Uint8Array; +} +/** MsgUpdateContractLabel sets a new label for a smart contract */ +export interface MsgUpdateContractLabel { + /** Sender is the that actor that signed the messages */ + sender: string; + /** NewLabel string to be set */ + newLabel: string; + /** Contract is the address of the smart contract */ + contract: string; +} +/** MsgUpdateContractLabelResponse returns empty data */ +export interface MsgUpdateContractLabelResponse {} function createBaseMsgStoreCode(): MsgStoreCode { return { sender: "", @@ -1932,6 +2003,472 @@ export const MsgStoreAndInstantiateContractResponse = { return message; }, }; +function createBaseMsgAddCodeUploadParamsAddresses(): MsgAddCodeUploadParamsAddresses { + return { + authority: "", + addresses: [], + }; +} +export const MsgAddCodeUploadParamsAddresses = { + encode( + message: MsgAddCodeUploadParamsAddresses, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + for (const v of message.addresses) { + writer.uint32(18).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgAddCodeUploadParamsAddresses { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgAddCodeUploadParamsAddresses(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.addresses.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgAddCodeUploadParamsAddresses { + const obj = createBaseMsgAddCodeUploadParamsAddresses(); + if (isSet(object.authority)) obj.authority = String(object.authority); + if (Array.isArray(object?.addresses)) obj.addresses = object.addresses.map((e: any) => String(e)); + return obj; + }, + toJSON(message: MsgAddCodeUploadParamsAddresses): unknown { + const obj: any = {}; + message.authority !== undefined && (obj.authority = message.authority); + if (message.addresses) { + obj.addresses = message.addresses.map((e) => e); + } else { + obj.addresses = []; + } + return obj; + }, + fromPartial(object: Partial): MsgAddCodeUploadParamsAddresses { + const message = createBaseMsgAddCodeUploadParamsAddresses(); + message.authority = object.authority ?? ""; + message.addresses = object.addresses?.map((e) => e) || []; + return message; + }, +}; +function createBaseMsgAddCodeUploadParamsAddressesResponse(): MsgAddCodeUploadParamsAddressesResponse { + return {}; +} +export const MsgAddCodeUploadParamsAddressesResponse = { + encode( + _: MsgAddCodeUploadParamsAddressesResponse, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgAddCodeUploadParamsAddressesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgAddCodeUploadParamsAddressesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): MsgAddCodeUploadParamsAddressesResponse { + const obj = createBaseMsgAddCodeUploadParamsAddressesResponse(); + return obj; + }, + toJSON(_: MsgAddCodeUploadParamsAddressesResponse): unknown { + const obj: any = {}; + return obj; + }, + fromPartial(_: Partial): MsgAddCodeUploadParamsAddressesResponse { + const message = createBaseMsgAddCodeUploadParamsAddressesResponse(); + return message; + }, +}; +function createBaseMsgRemoveCodeUploadParamsAddresses(): MsgRemoveCodeUploadParamsAddresses { + return { + authority: "", + addresses: [], + }; +} +export const MsgRemoveCodeUploadParamsAddresses = { + encode( + message: MsgRemoveCodeUploadParamsAddresses, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + for (const v of message.addresses) { + writer.uint32(18).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgRemoveCodeUploadParamsAddresses { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRemoveCodeUploadParamsAddresses(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.addresses.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgRemoveCodeUploadParamsAddresses { + const obj = createBaseMsgRemoveCodeUploadParamsAddresses(); + if (isSet(object.authority)) obj.authority = String(object.authority); + if (Array.isArray(object?.addresses)) obj.addresses = object.addresses.map((e: any) => String(e)); + return obj; + }, + toJSON(message: MsgRemoveCodeUploadParamsAddresses): unknown { + const obj: any = {}; + message.authority !== undefined && (obj.authority = message.authority); + if (message.addresses) { + obj.addresses = message.addresses.map((e) => e); + } else { + obj.addresses = []; + } + return obj; + }, + fromPartial(object: Partial): MsgRemoveCodeUploadParamsAddresses { + const message = createBaseMsgRemoveCodeUploadParamsAddresses(); + message.authority = object.authority ?? ""; + message.addresses = object.addresses?.map((e) => e) || []; + return message; + }, +}; +function createBaseMsgRemoveCodeUploadParamsAddressesResponse(): MsgRemoveCodeUploadParamsAddressesResponse { + return {}; +} +export const MsgRemoveCodeUploadParamsAddressesResponse = { + encode( + _: MsgRemoveCodeUploadParamsAddressesResponse, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgRemoveCodeUploadParamsAddressesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRemoveCodeUploadParamsAddressesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): MsgRemoveCodeUploadParamsAddressesResponse { + const obj = createBaseMsgRemoveCodeUploadParamsAddressesResponse(); + return obj; + }, + toJSON(_: MsgRemoveCodeUploadParamsAddressesResponse): unknown { + const obj: any = {}; + return obj; + }, + fromPartial( + _: Partial, + ): MsgRemoveCodeUploadParamsAddressesResponse { + const message = createBaseMsgRemoveCodeUploadParamsAddressesResponse(); + return message; + }, +}; +function createBaseMsgStoreAndMigrateContract(): MsgStoreAndMigrateContract { + return { + authority: "", + wasmByteCode: new Uint8Array(), + instantiatePermission: AccessConfig.fromPartial({}), + contract: "", + msg: new Uint8Array(), + }; +} +export const MsgStoreAndMigrateContract = { + encode(message: MsgStoreAndMigrateContract, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.wasmByteCode.length !== 0) { + writer.uint32(18).bytes(message.wasmByteCode); + } + if (message.instantiatePermission !== undefined) { + AccessConfig.encode(message.instantiatePermission, writer.uint32(26).fork()).ldelim(); + } + if (message.contract !== "") { + writer.uint32(34).string(message.contract); + } + if (message.msg.length !== 0) { + writer.uint32(42).bytes(message.msg); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgStoreAndMigrateContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgStoreAndMigrateContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.wasmByteCode = reader.bytes(); + break; + case 3: + message.instantiatePermission = AccessConfig.decode(reader, reader.uint32()); + break; + case 4: + message.contract = reader.string(); + break; + case 5: + message.msg = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgStoreAndMigrateContract { + const obj = createBaseMsgStoreAndMigrateContract(); + if (isSet(object.authority)) obj.authority = String(object.authority); + if (isSet(object.wasmByteCode)) obj.wasmByteCode = bytesFromBase64(object.wasmByteCode); + if (isSet(object.instantiatePermission)) + obj.instantiatePermission = AccessConfig.fromJSON(object.instantiatePermission); + if (isSet(object.contract)) obj.contract = String(object.contract); + if (isSet(object.msg)) obj.msg = bytesFromBase64(object.msg); + return obj; + }, + toJSON(message: MsgStoreAndMigrateContract): unknown { + const obj: any = {}; + message.authority !== undefined && (obj.authority = message.authority); + message.wasmByteCode !== undefined && + (obj.wasmByteCode = base64FromBytes( + message.wasmByteCode !== undefined ? message.wasmByteCode : new Uint8Array(), + )); + message.instantiatePermission !== undefined && + (obj.instantiatePermission = message.instantiatePermission + ? AccessConfig.toJSON(message.instantiatePermission) + : undefined); + message.contract !== undefined && (obj.contract = message.contract); + message.msg !== undefined && + (obj.msg = base64FromBytes(message.msg !== undefined ? message.msg : new Uint8Array())); + return obj; + }, + fromPartial(object: Partial): MsgStoreAndMigrateContract { + const message = createBaseMsgStoreAndMigrateContract(); + message.authority = object.authority ?? ""; + message.wasmByteCode = object.wasmByteCode ?? new Uint8Array(); + if (object.instantiatePermission !== undefined && object.instantiatePermission !== null) { + message.instantiatePermission = AccessConfig.fromPartial(object.instantiatePermission); + } + message.contract = object.contract ?? ""; + message.msg = object.msg ?? new Uint8Array(); + return message; + }, +}; +function createBaseMsgStoreAndMigrateContractResponse(): MsgStoreAndMigrateContractResponse { + return { + codeId: BigInt(0), + checksum: new Uint8Array(), + data: new Uint8Array(), + }; +} +export const MsgStoreAndMigrateContractResponse = { + encode( + message: MsgStoreAndMigrateContractResponse, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.codeId !== BigInt(0)) { + writer.uint32(8).uint64(message.codeId); + } + if (message.checksum.length !== 0) { + writer.uint32(18).bytes(message.checksum); + } + if (message.data.length !== 0) { + writer.uint32(26).bytes(message.data); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgStoreAndMigrateContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgStoreAndMigrateContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.codeId = reader.uint64(); + break; + case 2: + message.checksum = reader.bytes(); + break; + case 3: + message.data = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgStoreAndMigrateContractResponse { + const obj = createBaseMsgStoreAndMigrateContractResponse(); + if (isSet(object.codeId)) obj.codeId = BigInt(object.codeId.toString()); + if (isSet(object.checksum)) obj.checksum = bytesFromBase64(object.checksum); + if (isSet(object.data)) obj.data = bytesFromBase64(object.data); + return obj; + }, + toJSON(message: MsgStoreAndMigrateContractResponse): unknown { + const obj: any = {}; + message.codeId !== undefined && (obj.codeId = (message.codeId || BigInt(0)).toString()); + message.checksum !== undefined && + (obj.checksum = base64FromBytes(message.checksum !== undefined ? message.checksum : new Uint8Array())); + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); + return obj; + }, + fromPartial(object: Partial): MsgStoreAndMigrateContractResponse { + const message = createBaseMsgStoreAndMigrateContractResponse(); + if (object.codeId !== undefined && object.codeId !== null) { + message.codeId = BigInt(object.codeId.toString()); + } + message.checksum = object.checksum ?? new Uint8Array(); + message.data = object.data ?? new Uint8Array(); + return message; + }, +}; +function createBaseMsgUpdateContractLabel(): MsgUpdateContractLabel { + return { + sender: "", + newLabel: "", + contract: "", + }; +} +export const MsgUpdateContractLabel = { + encode(message: MsgUpdateContractLabel, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.newLabel !== "") { + writer.uint32(18).string(message.newLabel); + } + if (message.contract !== "") { + writer.uint32(26).string(message.contract); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateContractLabel { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateContractLabel(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sender = reader.string(); + break; + case 2: + message.newLabel = reader.string(); + break; + case 3: + message.contract = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgUpdateContractLabel { + const obj = createBaseMsgUpdateContractLabel(); + if (isSet(object.sender)) obj.sender = String(object.sender); + if (isSet(object.newLabel)) obj.newLabel = String(object.newLabel); + if (isSet(object.contract)) obj.contract = String(object.contract); + return obj; + }, + toJSON(message: MsgUpdateContractLabel): unknown { + const obj: any = {}; + message.sender !== undefined && (obj.sender = message.sender); + message.newLabel !== undefined && (obj.newLabel = message.newLabel); + message.contract !== undefined && (obj.contract = message.contract); + return obj; + }, + fromPartial(object: Partial): MsgUpdateContractLabel { + const message = createBaseMsgUpdateContractLabel(); + message.sender = object.sender ?? ""; + message.newLabel = object.newLabel ?? ""; + message.contract = object.contract ?? ""; + return message; + }, +}; +function createBaseMsgUpdateContractLabelResponse(): MsgUpdateContractLabelResponse { + return {}; +} +export const MsgUpdateContractLabelResponse = { + encode(_: MsgUpdateContractLabelResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateContractLabelResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateContractLabelResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): MsgUpdateContractLabelResponse { + const obj = createBaseMsgUpdateContractLabelResponse(); + return obj; + }, + toJSON(_: MsgUpdateContractLabelResponse): unknown { + const obj: any = {}; + return obj; + }, + fromPartial(_: Partial): MsgUpdateContractLabelResponse { + const message = createBaseMsgUpdateContractLabelResponse(); + return message; + }, +}; /** Msg defines the wasm Msg service. */ export interface Msg { /** StoreCode to submit Wasm code to the system */ @@ -1950,7 +2487,7 @@ export interface Msg { ExecuteContract(request: MsgExecuteContract): Promise; /** Migrate runs a code upgrade/ downgrade for a smart contract */ MigrateContract(request: MsgMigrateContract): Promise; - /** UpdateAdmin sets a new admin for a smart contract */ + /** UpdateAdmin sets a new admin for a smart contract */ UpdateAdmin(request: MsgUpdateAdmin): Promise; /** ClearAdmin removes any admin stored for a smart contract */ ClearAdmin(request: MsgClearAdmin): Promise; @@ -1993,6 +2530,35 @@ export interface Msg { StoreAndInstantiateContract( request: MsgStoreAndInstantiateContract, ): Promise; + /** + * RemoveCodeUploadParamsAddresses defines a governance operation for + * removing addresses from code upload params. + * The authority is defined in the keeper. + */ + RemoveCodeUploadParamsAddresses( + request: MsgRemoveCodeUploadParamsAddresses, + ): Promise; + /** + * AddCodeUploadParamsAddresses defines a governance operation for + * adding addresses to code upload params. + * The authority is defined in the keeper. + */ + AddCodeUploadParamsAddresses( + request: MsgAddCodeUploadParamsAddresses, + ): Promise; + /** + * StoreAndMigrateContract defines a governance operation for storing + * and migrating the contract. The authority is defined in the keeper. + * + * Since: 0.42 + */ + StoreAndMigrateContract(request: MsgStoreAndMigrateContract): Promise; + /** + * UpdateContractLabel sets a new label for a smart contract + * + * Since: 0.43 + */ + UpdateContractLabel(request: MsgUpdateContractLabel): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: Rpc; @@ -2011,6 +2577,10 @@ export class MsgClientImpl implements Msg { this.PinCodes = this.PinCodes.bind(this); this.UnpinCodes = this.UnpinCodes.bind(this); this.StoreAndInstantiateContract = this.StoreAndInstantiateContract.bind(this); + this.RemoveCodeUploadParamsAddresses = this.RemoveCodeUploadParamsAddresses.bind(this); + this.AddCodeUploadParamsAddresses = this.AddCodeUploadParamsAddresses.bind(this); + this.StoreAndMigrateContract = this.StoreAndMigrateContract.bind(this); + this.UpdateContractLabel = this.UpdateContractLabel.bind(this); } StoreCode(request: MsgStoreCode): Promise { const data = MsgStoreCode.encode(request).finish(); @@ -2079,4 +2649,28 @@ export class MsgClientImpl implements Msg { const promise = this.rpc.request("cosmwasm.wasm.v1.Msg", "StoreAndInstantiateContract", data); return promise.then((data) => MsgStoreAndInstantiateContractResponse.decode(new BinaryReader(data))); } + RemoveCodeUploadParamsAddresses( + request: MsgRemoveCodeUploadParamsAddresses, + ): Promise { + const data = MsgRemoveCodeUploadParamsAddresses.encode(request).finish(); + const promise = this.rpc.request("cosmwasm.wasm.v1.Msg", "RemoveCodeUploadParamsAddresses", data); + return promise.then((data) => MsgRemoveCodeUploadParamsAddressesResponse.decode(new BinaryReader(data))); + } + AddCodeUploadParamsAddresses( + request: MsgAddCodeUploadParamsAddresses, + ): Promise { + const data = MsgAddCodeUploadParamsAddresses.encode(request).finish(); + const promise = this.rpc.request("cosmwasm.wasm.v1.Msg", "AddCodeUploadParamsAddresses", data); + return promise.then((data) => MsgAddCodeUploadParamsAddressesResponse.decode(new BinaryReader(data))); + } + StoreAndMigrateContract(request: MsgStoreAndMigrateContract): Promise { + const data = MsgStoreAndMigrateContract.encode(request).finish(); + const promise = this.rpc.request("cosmwasm.wasm.v1.Msg", "StoreAndMigrateContract", data); + return promise.then((data) => MsgStoreAndMigrateContractResponse.decode(new BinaryReader(data))); + } + UpdateContractLabel(request: MsgUpdateContractLabel): Promise { + const data = MsgUpdateContractLabel.encode(request).finish(); + const promise = this.rpc.request("cosmwasm.wasm.v1.Msg", "UpdateContractLabel", data); + return promise.then((data) => MsgUpdateContractLabelResponse.decode(new BinaryReader(data))); + } } diff --git a/src/cosmwasm/wasm/v1/types.ts b/src/cosmwasm/wasm/v1/types.ts index 3dddb1c..3aa7e0f 100644 --- a/src/cosmwasm/wasm/v1/types.ts +++ b/src/cosmwasm/wasm/v1/types.ts @@ -9,11 +9,6 @@ export enum AccessType { ACCESS_TYPE_UNSPECIFIED = 0, /** ACCESS_TYPE_NOBODY - AccessTypeNobody forbidden */ ACCESS_TYPE_NOBODY = 1, - /** - * ACCESS_TYPE_ONLY_ADDRESS - AccessTypeOnlyAddress restricted to a single address - * Deprecated: use AccessTypeAnyOfAddresses instead - */ - ACCESS_TYPE_ONLY_ADDRESS = 2, /** ACCESS_TYPE_EVERYBODY - AccessTypeEverybody unrestricted */ ACCESS_TYPE_EVERYBODY = 3, /** ACCESS_TYPE_ANY_OF_ADDRESSES - AccessTypeAnyOfAddresses allow any of the addresses */ @@ -28,9 +23,6 @@ export function accessTypeFromJSON(object: any): AccessType { case 1: case "ACCESS_TYPE_NOBODY": return AccessType.ACCESS_TYPE_NOBODY; - case 2: - case "ACCESS_TYPE_ONLY_ADDRESS": - return AccessType.ACCESS_TYPE_ONLY_ADDRESS; case 3: case "ACCESS_TYPE_EVERYBODY": return AccessType.ACCESS_TYPE_EVERYBODY; @@ -49,8 +41,6 @@ export function accessTypeToJSON(object: AccessType): string { return "ACCESS_TYPE_UNSPECIFIED"; case AccessType.ACCESS_TYPE_NOBODY: return "ACCESS_TYPE_NOBODY"; - case AccessType.ACCESS_TYPE_ONLY_ADDRESS: - return "ACCESS_TYPE_ONLY_ADDRESS"; case AccessType.ACCESS_TYPE_EVERYBODY: return "ACCESS_TYPE_EVERYBODY"; case AccessType.ACCESS_TYPE_ANY_OF_ADDRESSES: @@ -114,11 +104,6 @@ export interface AccessTypeParam { /** AccessConfig access control type. */ export interface AccessConfig { permission: AccessType; - /** - * Address - * Deprecated: replaced by addresses - */ - address: string; addresses: string[]; } /** Params defines the set of wasm parameters. */ @@ -231,7 +216,6 @@ export const AccessTypeParam = { function createBaseAccessConfig(): AccessConfig { return { permission: 0, - address: "", addresses: [], }; } @@ -240,9 +224,6 @@ export const AccessConfig = { if (message.permission !== 0) { writer.uint32(8).int32(message.permission); } - if (message.address !== "") { - writer.uint32(18).string(message.address); - } for (const v of message.addresses) { writer.uint32(26).string(v!); } @@ -258,9 +239,6 @@ export const AccessConfig = { case 1: message.permission = reader.int32() as any; break; - case 2: - message.address = reader.string(); - break; case 3: message.addresses.push(reader.string()); break; @@ -274,14 +252,12 @@ export const AccessConfig = { fromJSON(object: any): AccessConfig { const obj = createBaseAccessConfig(); if (isSet(object.permission)) obj.permission = accessTypeFromJSON(object.permission); - if (isSet(object.address)) obj.address = String(object.address); if (Array.isArray(object?.addresses)) obj.addresses = object.addresses.map((e: any) => String(e)); return obj; }, toJSON(message: AccessConfig): unknown { const obj: any = {}; message.permission !== undefined && (obj.permission = accessTypeToJSON(message.permission)); - message.address !== undefined && (obj.address = message.address); if (message.addresses) { obj.addresses = message.addresses.map((e) => e); } else { @@ -292,7 +268,6 @@ export const AccessConfig = { fromPartial(object: Partial): AccessConfig { const message = createBaseAccessConfig(); message.permission = object.permission ?? 0; - message.address = object.address ?? ""; message.addresses = object.addresses?.map((e) => e) || []; return message; }, diff --git a/src/ibc/applications/fee/v1/ack.ts b/src/ibc/applications/fee/v1/ack.ts deleted file mode 100644 index 61bbff8..0000000 --- a/src/ibc/applications/fee/v1/ack.ts +++ /dev/null @@ -1,82 +0,0 @@ -/* eslint-disable */ -import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes } from "../../../../helpers"; -export const protobufPackage = "ibc.applications.fee.v1"; -/** IncentivizedAcknowledgement is the acknowledgement format to be used by applications wrapped in the fee middleware */ -export interface IncentivizedAcknowledgement { - /** the underlying app acknowledgement bytes */ - appAcknowledgement: Uint8Array; - /** the relayer address which submits the recv packet message */ - forwardRelayerAddress: string; - /** success flag of the base application callback */ - underlyingAppSuccess: boolean; -} -function createBaseIncentivizedAcknowledgement(): IncentivizedAcknowledgement { - return { - appAcknowledgement: new Uint8Array(), - forwardRelayerAddress: "", - underlyingAppSuccess: false, - }; -} -export const IncentivizedAcknowledgement = { - encode(message: IncentivizedAcknowledgement, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.appAcknowledgement.length !== 0) { - writer.uint32(10).bytes(message.appAcknowledgement); - } - if (message.forwardRelayerAddress !== "") { - writer.uint32(18).string(message.forwardRelayerAddress); - } - if (message.underlyingAppSuccess === true) { - writer.uint32(24).bool(message.underlyingAppSuccess); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): IncentivizedAcknowledgement { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseIncentivizedAcknowledgement(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.appAcknowledgement = reader.bytes(); - break; - case 2: - message.forwardRelayerAddress = reader.string(); - break; - case 3: - message.underlyingAppSuccess = reader.bool(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): IncentivizedAcknowledgement { - const obj = createBaseIncentivizedAcknowledgement(); - if (isSet(object.appAcknowledgement)) obj.appAcknowledgement = bytesFromBase64(object.appAcknowledgement); - if (isSet(object.forwardRelayerAddress)) obj.forwardRelayerAddress = String(object.forwardRelayerAddress); - if (isSet(object.underlyingAppSuccess)) obj.underlyingAppSuccess = Boolean(object.underlyingAppSuccess); - return obj; - }, - toJSON(message: IncentivizedAcknowledgement): unknown { - const obj: any = {}; - message.appAcknowledgement !== undefined && - (obj.appAcknowledgement = base64FromBytes( - message.appAcknowledgement !== undefined ? message.appAcknowledgement : new Uint8Array(), - )); - message.forwardRelayerAddress !== undefined && - (obj.forwardRelayerAddress = message.forwardRelayerAddress); - message.underlyingAppSuccess !== undefined && (obj.underlyingAppSuccess = message.underlyingAppSuccess); - return obj; - }, - fromPartial(object: Partial): IncentivizedAcknowledgement { - const message = createBaseIncentivizedAcknowledgement(); - message.appAcknowledgement = object.appAcknowledgement ?? new Uint8Array(); - message.forwardRelayerAddress = object.forwardRelayerAddress ?? ""; - message.underlyingAppSuccess = object.underlyingAppSuccess ?? false; - return message; - }, -}; diff --git a/src/ibc/applications/fee/v1/fee.ts b/src/ibc/applications/fee/v1/fee.ts deleted file mode 100644 index 4255177..0000000 --- a/src/ibc/applications/fee/v1/fee.ts +++ /dev/null @@ -1,298 +0,0 @@ -/* eslint-disable */ -import { Coin } from "../../../../cosmos/base/v1beta1/coin"; -import { PacketId } from "../../../core/channel/v1/channel"; -import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet } from "../../../../helpers"; -export const protobufPackage = "ibc.applications.fee.v1"; -/** Fee defines the ICS29 receive, acknowledgement and timeout fees */ -export interface Fee { - /** the packet receive fee */ - recvFee: Coin[]; - /** the packet acknowledgement fee */ - ackFee: Coin[]; - /** the packet timeout fee */ - timeoutFee: Coin[]; -} -/** PacketFee contains ICS29 relayer fees, refund address and optional list of permitted relayers */ -export interface PacketFee { - /** fee encapsulates the recv, ack and timeout fees associated with an IBC packet */ - fee: Fee; - /** the refund address for unspent fees */ - refundAddress: string; - /** optional list of relayers permitted to receive fees */ - relayers: string[]; -} -/** PacketFees contains a list of type PacketFee */ -export interface PacketFees { - /** list of packet fees */ - packetFees: PacketFee[]; -} -/** IdentifiedPacketFees contains a list of type PacketFee and associated PacketId */ -export interface IdentifiedPacketFees { - /** unique packet identifier comprised of the channel ID, port ID and sequence */ - packetId: PacketId; - /** list of packet fees */ - packetFees: PacketFee[]; -} -function createBaseFee(): Fee { - return { - recvFee: [], - ackFee: [], - timeoutFee: [], - }; -} -export const Fee = { - encode(message: Fee, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - for (const v of message.recvFee) { - Coin.encode(v!, writer.uint32(10).fork()).ldelim(); - } - for (const v of message.ackFee) { - Coin.encode(v!, writer.uint32(18).fork()).ldelim(); - } - for (const v of message.timeoutFee) { - Coin.encode(v!, writer.uint32(26).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): Fee { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseFee(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.recvFee.push(Coin.decode(reader, reader.uint32())); - break; - case 2: - message.ackFee.push(Coin.decode(reader, reader.uint32())); - break; - case 3: - message.timeoutFee.push(Coin.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): Fee { - const obj = createBaseFee(); - if (Array.isArray(object?.recvFee)) obj.recvFee = object.recvFee.map((e: any) => Coin.fromJSON(e)); - if (Array.isArray(object?.ackFee)) obj.ackFee = object.ackFee.map((e: any) => Coin.fromJSON(e)); - if (Array.isArray(object?.timeoutFee)) - obj.timeoutFee = object.timeoutFee.map((e: any) => Coin.fromJSON(e)); - return obj; - }, - toJSON(message: Fee): unknown { - const obj: any = {}; - if (message.recvFee) { - obj.recvFee = message.recvFee.map((e) => (e ? Coin.toJSON(e) : undefined)); - } else { - obj.recvFee = []; - } - if (message.ackFee) { - obj.ackFee = message.ackFee.map((e) => (e ? Coin.toJSON(e) : undefined)); - } else { - obj.ackFee = []; - } - if (message.timeoutFee) { - obj.timeoutFee = message.timeoutFee.map((e) => (e ? Coin.toJSON(e) : undefined)); - } else { - obj.timeoutFee = []; - } - return obj; - }, - fromPartial(object: Partial): Fee { - const message = createBaseFee(); - message.recvFee = object.recvFee?.map((e) => Coin.fromPartial(e)) || []; - message.ackFee = object.ackFee?.map((e) => Coin.fromPartial(e)) || []; - message.timeoutFee = object.timeoutFee?.map((e) => Coin.fromPartial(e)) || []; - return message; - }, -}; -function createBasePacketFee(): PacketFee { - return { - fee: Fee.fromPartial({}), - refundAddress: "", - relayers: [], - }; -} -export const PacketFee = { - encode(message: PacketFee, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.fee !== undefined) { - Fee.encode(message.fee, writer.uint32(10).fork()).ldelim(); - } - if (message.refundAddress !== "") { - writer.uint32(18).string(message.refundAddress); - } - for (const v of message.relayers) { - writer.uint32(26).string(v!); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): PacketFee { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBasePacketFee(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.fee = Fee.decode(reader, reader.uint32()); - break; - case 2: - message.refundAddress = reader.string(); - break; - case 3: - message.relayers.push(reader.string()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): PacketFee { - const obj = createBasePacketFee(); - if (isSet(object.fee)) obj.fee = Fee.fromJSON(object.fee); - if (isSet(object.refundAddress)) obj.refundAddress = String(object.refundAddress); - if (Array.isArray(object?.relayers)) obj.relayers = object.relayers.map((e: any) => String(e)); - return obj; - }, - toJSON(message: PacketFee): unknown { - const obj: any = {}; - message.fee !== undefined && (obj.fee = message.fee ? Fee.toJSON(message.fee) : undefined); - message.refundAddress !== undefined && (obj.refundAddress = message.refundAddress); - if (message.relayers) { - obj.relayers = message.relayers.map((e) => e); - } else { - obj.relayers = []; - } - return obj; - }, - fromPartial(object: Partial): PacketFee { - const message = createBasePacketFee(); - if (object.fee !== undefined && object.fee !== null) { - message.fee = Fee.fromPartial(object.fee); - } - message.refundAddress = object.refundAddress ?? ""; - message.relayers = object.relayers?.map((e) => e) || []; - return message; - }, -}; -function createBasePacketFees(): PacketFees { - return { - packetFees: [], - }; -} -export const PacketFees = { - encode(message: PacketFees, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - for (const v of message.packetFees) { - PacketFee.encode(v!, writer.uint32(10).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): PacketFees { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBasePacketFees(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.packetFees.push(PacketFee.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): PacketFees { - const obj = createBasePacketFees(); - if (Array.isArray(object?.packetFees)) - obj.packetFees = object.packetFees.map((e: any) => PacketFee.fromJSON(e)); - return obj; - }, - toJSON(message: PacketFees): unknown { - const obj: any = {}; - if (message.packetFees) { - obj.packetFees = message.packetFees.map((e) => (e ? PacketFee.toJSON(e) : undefined)); - } else { - obj.packetFees = []; - } - return obj; - }, - fromPartial(object: Partial): PacketFees { - const message = createBasePacketFees(); - message.packetFees = object.packetFees?.map((e) => PacketFee.fromPartial(e)) || []; - return message; - }, -}; -function createBaseIdentifiedPacketFees(): IdentifiedPacketFees { - return { - packetId: PacketId.fromPartial({}), - packetFees: [], - }; -} -export const IdentifiedPacketFees = { - encode(message: IdentifiedPacketFees, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.packetId !== undefined) { - PacketId.encode(message.packetId, writer.uint32(10).fork()).ldelim(); - } - for (const v of message.packetFees) { - PacketFee.encode(v!, writer.uint32(18).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): IdentifiedPacketFees { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseIdentifiedPacketFees(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.packetId = PacketId.decode(reader, reader.uint32()); - break; - case 2: - message.packetFees.push(PacketFee.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): IdentifiedPacketFees { - const obj = createBaseIdentifiedPacketFees(); - if (isSet(object.packetId)) obj.packetId = PacketId.fromJSON(object.packetId); - if (Array.isArray(object?.packetFees)) - obj.packetFees = object.packetFees.map((e: any) => PacketFee.fromJSON(e)); - return obj; - }, - toJSON(message: IdentifiedPacketFees): unknown { - const obj: any = {}; - message.packetId !== undefined && - (obj.packetId = message.packetId ? PacketId.toJSON(message.packetId) : undefined); - if (message.packetFees) { - obj.packetFees = message.packetFees.map((e) => (e ? PacketFee.toJSON(e) : undefined)); - } else { - obj.packetFees = []; - } - return obj; - }, - fromPartial(object: Partial): IdentifiedPacketFees { - const message = createBaseIdentifiedPacketFees(); - if (object.packetId !== undefined && object.packetId !== null) { - message.packetId = PacketId.fromPartial(object.packetId); - } - message.packetFees = object.packetFees?.map((e) => PacketFee.fromPartial(e)) || []; - return message; - }, -}; diff --git a/src/ibc/applications/fee/v1/genesis.ts b/src/ibc/applications/fee/v1/genesis.ts deleted file mode 100644 index 215cf86..0000000 --- a/src/ibc/applications/fee/v1/genesis.ts +++ /dev/null @@ -1,421 +0,0 @@ -/* eslint-disable */ -import { IdentifiedPacketFees } from "./fee"; -import { PacketId } from "../../../core/channel/v1/channel"; -import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet } from "../../../../helpers"; -export const protobufPackage = "ibc.applications.fee.v1"; -/** GenesisState defines the ICS29 fee middleware genesis state */ -export interface GenesisState { - /** list of identified packet fees */ - identifiedFees: IdentifiedPacketFees[]; - /** list of fee enabled channels */ - feeEnabledChannels: FeeEnabledChannel[]; - /** list of registered payees */ - registeredPayees: RegisteredPayee[]; - /** list of registered counterparty payees */ - registeredCounterpartyPayees: RegisteredCounterpartyPayee[]; - /** list of forward relayer addresses */ - forwardRelayers: ForwardRelayerAddress[]; -} -/** FeeEnabledChannel contains the PortID & ChannelID for a fee enabled channel */ -export interface FeeEnabledChannel { - /** unique port identifier */ - portId: string; - /** unique channel identifier */ - channelId: string; -} -/** RegisteredPayee contains the relayer address and payee address for a specific channel */ -export interface RegisteredPayee { - /** unique channel identifier */ - channelId: string; - /** the relayer address */ - relayer: string; - /** the payee address */ - payee: string; -} -/** - * RegisteredCounterpartyPayee contains the relayer address and counterparty payee address for a specific channel (used - * for recv fee distribution) - */ -export interface RegisteredCounterpartyPayee { - /** unique channel identifier */ - channelId: string; - /** the relayer address */ - relayer: string; - /** the counterparty payee address */ - counterpartyPayee: string; -} -/** ForwardRelayerAddress contains the forward relayer address and PacketId used for async acknowledgements */ -export interface ForwardRelayerAddress { - /** the forward relayer address */ - address: string; - /** unique packet identifer comprised of the channel ID, port ID and sequence */ - packetId: PacketId; -} -function createBaseGenesisState(): GenesisState { - return { - identifiedFees: [], - feeEnabledChannels: [], - registeredPayees: [], - registeredCounterpartyPayees: [], - forwardRelayers: [], - }; -} -export const GenesisState = { - encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - for (const v of message.identifiedFees) { - IdentifiedPacketFees.encode(v!, writer.uint32(10).fork()).ldelim(); - } - for (const v of message.feeEnabledChannels) { - FeeEnabledChannel.encode(v!, writer.uint32(18).fork()).ldelim(); - } - for (const v of message.registeredPayees) { - RegisteredPayee.encode(v!, writer.uint32(26).fork()).ldelim(); - } - for (const v of message.registeredCounterpartyPayees) { - RegisteredCounterpartyPayee.encode(v!, writer.uint32(34).fork()).ldelim(); - } - for (const v of message.forwardRelayers) { - ForwardRelayerAddress.encode(v!, writer.uint32(42).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenesisState(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.identifiedFees.push(IdentifiedPacketFees.decode(reader, reader.uint32())); - break; - case 2: - message.feeEnabledChannels.push(FeeEnabledChannel.decode(reader, reader.uint32())); - break; - case 3: - message.registeredPayees.push(RegisteredPayee.decode(reader, reader.uint32())); - break; - case 4: - message.registeredCounterpartyPayees.push( - RegisteredCounterpartyPayee.decode(reader, reader.uint32()), - ); - break; - case 5: - message.forwardRelayers.push(ForwardRelayerAddress.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): GenesisState { - const obj = createBaseGenesisState(); - if (Array.isArray(object?.identifiedFees)) - obj.identifiedFees = object.identifiedFees.map((e: any) => IdentifiedPacketFees.fromJSON(e)); - if (Array.isArray(object?.feeEnabledChannels)) - obj.feeEnabledChannels = object.feeEnabledChannels.map((e: any) => FeeEnabledChannel.fromJSON(e)); - if (Array.isArray(object?.registeredPayees)) - obj.registeredPayees = object.registeredPayees.map((e: any) => RegisteredPayee.fromJSON(e)); - if (Array.isArray(object?.registeredCounterpartyPayees)) - obj.registeredCounterpartyPayees = object.registeredCounterpartyPayees.map((e: any) => - RegisteredCounterpartyPayee.fromJSON(e), - ); - if (Array.isArray(object?.forwardRelayers)) - obj.forwardRelayers = object.forwardRelayers.map((e: any) => ForwardRelayerAddress.fromJSON(e)); - return obj; - }, - toJSON(message: GenesisState): unknown { - const obj: any = {}; - if (message.identifiedFees) { - obj.identifiedFees = message.identifiedFees.map((e) => - e ? IdentifiedPacketFees.toJSON(e) : undefined, - ); - } else { - obj.identifiedFees = []; - } - if (message.feeEnabledChannels) { - obj.feeEnabledChannels = message.feeEnabledChannels.map((e) => - e ? FeeEnabledChannel.toJSON(e) : undefined, - ); - } else { - obj.feeEnabledChannels = []; - } - if (message.registeredPayees) { - obj.registeredPayees = message.registeredPayees.map((e) => (e ? RegisteredPayee.toJSON(e) : undefined)); - } else { - obj.registeredPayees = []; - } - if (message.registeredCounterpartyPayees) { - obj.registeredCounterpartyPayees = message.registeredCounterpartyPayees.map((e) => - e ? RegisteredCounterpartyPayee.toJSON(e) : undefined, - ); - } else { - obj.registeredCounterpartyPayees = []; - } - if (message.forwardRelayers) { - obj.forwardRelayers = message.forwardRelayers.map((e) => - e ? ForwardRelayerAddress.toJSON(e) : undefined, - ); - } else { - obj.forwardRelayers = []; - } - return obj; - }, - fromPartial(object: Partial): GenesisState { - const message = createBaseGenesisState(); - message.identifiedFees = object.identifiedFees?.map((e) => IdentifiedPacketFees.fromPartial(e)) || []; - message.feeEnabledChannels = - object.feeEnabledChannels?.map((e) => FeeEnabledChannel.fromPartial(e)) || []; - message.registeredPayees = object.registeredPayees?.map((e) => RegisteredPayee.fromPartial(e)) || []; - message.registeredCounterpartyPayees = - object.registeredCounterpartyPayees?.map((e) => RegisteredCounterpartyPayee.fromPartial(e)) || []; - message.forwardRelayers = object.forwardRelayers?.map((e) => ForwardRelayerAddress.fromPartial(e)) || []; - return message; - }, -}; -function createBaseFeeEnabledChannel(): FeeEnabledChannel { - return { - portId: "", - channelId: "", - }; -} -export const FeeEnabledChannel = { - encode(message: FeeEnabledChannel, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.portId !== "") { - writer.uint32(10).string(message.portId); - } - if (message.channelId !== "") { - writer.uint32(18).string(message.channelId); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): FeeEnabledChannel { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseFeeEnabledChannel(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.portId = reader.string(); - break; - case 2: - message.channelId = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): FeeEnabledChannel { - const obj = createBaseFeeEnabledChannel(); - if (isSet(object.portId)) obj.portId = String(object.portId); - if (isSet(object.channelId)) obj.channelId = String(object.channelId); - return obj; - }, - toJSON(message: FeeEnabledChannel): unknown { - const obj: any = {}; - message.portId !== undefined && (obj.portId = message.portId); - message.channelId !== undefined && (obj.channelId = message.channelId); - return obj; - }, - fromPartial(object: Partial): FeeEnabledChannel { - const message = createBaseFeeEnabledChannel(); - message.portId = object.portId ?? ""; - message.channelId = object.channelId ?? ""; - return message; - }, -}; -function createBaseRegisteredPayee(): RegisteredPayee { - return { - channelId: "", - relayer: "", - payee: "", - }; -} -export const RegisteredPayee = { - encode(message: RegisteredPayee, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.channelId !== "") { - writer.uint32(10).string(message.channelId); - } - if (message.relayer !== "") { - writer.uint32(18).string(message.relayer); - } - if (message.payee !== "") { - writer.uint32(26).string(message.payee); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): RegisteredPayee { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseRegisteredPayee(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.channelId = reader.string(); - break; - case 2: - message.relayer = reader.string(); - break; - case 3: - message.payee = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): RegisteredPayee { - const obj = createBaseRegisteredPayee(); - if (isSet(object.channelId)) obj.channelId = String(object.channelId); - if (isSet(object.relayer)) obj.relayer = String(object.relayer); - if (isSet(object.payee)) obj.payee = String(object.payee); - return obj; - }, - toJSON(message: RegisteredPayee): unknown { - const obj: any = {}; - message.channelId !== undefined && (obj.channelId = message.channelId); - message.relayer !== undefined && (obj.relayer = message.relayer); - message.payee !== undefined && (obj.payee = message.payee); - return obj; - }, - fromPartial(object: Partial): RegisteredPayee { - const message = createBaseRegisteredPayee(); - message.channelId = object.channelId ?? ""; - message.relayer = object.relayer ?? ""; - message.payee = object.payee ?? ""; - return message; - }, -}; -function createBaseRegisteredCounterpartyPayee(): RegisteredCounterpartyPayee { - return { - channelId: "", - relayer: "", - counterpartyPayee: "", - }; -} -export const RegisteredCounterpartyPayee = { - encode(message: RegisteredCounterpartyPayee, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.channelId !== "") { - writer.uint32(10).string(message.channelId); - } - if (message.relayer !== "") { - writer.uint32(18).string(message.relayer); - } - if (message.counterpartyPayee !== "") { - writer.uint32(26).string(message.counterpartyPayee); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): RegisteredCounterpartyPayee { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseRegisteredCounterpartyPayee(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.channelId = reader.string(); - break; - case 2: - message.relayer = reader.string(); - break; - case 3: - message.counterpartyPayee = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): RegisteredCounterpartyPayee { - const obj = createBaseRegisteredCounterpartyPayee(); - if (isSet(object.channelId)) obj.channelId = String(object.channelId); - if (isSet(object.relayer)) obj.relayer = String(object.relayer); - if (isSet(object.counterpartyPayee)) obj.counterpartyPayee = String(object.counterpartyPayee); - return obj; - }, - toJSON(message: RegisteredCounterpartyPayee): unknown { - const obj: any = {}; - message.channelId !== undefined && (obj.channelId = message.channelId); - message.relayer !== undefined && (obj.relayer = message.relayer); - message.counterpartyPayee !== undefined && (obj.counterpartyPayee = message.counterpartyPayee); - return obj; - }, - fromPartial(object: Partial): RegisteredCounterpartyPayee { - const message = createBaseRegisteredCounterpartyPayee(); - message.channelId = object.channelId ?? ""; - message.relayer = object.relayer ?? ""; - message.counterpartyPayee = object.counterpartyPayee ?? ""; - return message; - }, -}; -function createBaseForwardRelayerAddress(): ForwardRelayerAddress { - return { - address: "", - packetId: PacketId.fromPartial({}), - }; -} -export const ForwardRelayerAddress = { - encode(message: ForwardRelayerAddress, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.address !== "") { - writer.uint32(10).string(message.address); - } - if (message.packetId !== undefined) { - PacketId.encode(message.packetId, writer.uint32(18).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): ForwardRelayerAddress { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseForwardRelayerAddress(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.address = reader.string(); - break; - case 2: - message.packetId = PacketId.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): ForwardRelayerAddress { - const obj = createBaseForwardRelayerAddress(); - if (isSet(object.address)) obj.address = String(object.address); - if (isSet(object.packetId)) obj.packetId = PacketId.fromJSON(object.packetId); - return obj; - }, - toJSON(message: ForwardRelayerAddress): unknown { - const obj: any = {}; - message.address !== undefined && (obj.address = message.address); - message.packetId !== undefined && - (obj.packetId = message.packetId ? PacketId.toJSON(message.packetId) : undefined); - return obj; - }, - fromPartial(object: Partial): ForwardRelayerAddress { - const message = createBaseForwardRelayerAddress(); - message.address = object.address ?? ""; - if (object.packetId !== undefined && object.packetId !== null) { - message.packetId = PacketId.fromPartial(object.packetId); - } - return message; - }, -}; diff --git a/src/ibc/applications/fee/v1/metadata.ts b/src/ibc/applications/fee/v1/metadata.ts deleted file mode 100644 index ee38326..0000000 --- a/src/ibc/applications/fee/v1/metadata.ts +++ /dev/null @@ -1,69 +0,0 @@ -/* eslint-disable */ -import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet } from "../../../../helpers"; -export const protobufPackage = "ibc.applications.fee.v1"; -/** - * Metadata defines the ICS29 channel specific metadata encoded into the channel version bytestring - * See ICS004: https://github.com/cosmos/ibc/tree/master/spec/core/ics-004-channel-and-packet-semantics#Versioning - */ -export interface Metadata { - /** fee_version defines the ICS29 fee version */ - feeVersion: string; - /** app_version defines the underlying application version, which may or may not be a JSON encoded bytestring */ - appVersion: string; -} -function createBaseMetadata(): Metadata { - return { - feeVersion: "", - appVersion: "", - }; -} -export const Metadata = { - encode(message: Metadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.feeVersion !== "") { - writer.uint32(10).string(message.feeVersion); - } - if (message.appVersion !== "") { - writer.uint32(18).string(message.appVersion); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): Metadata { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMetadata(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.feeVersion = reader.string(); - break; - case 2: - message.appVersion = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): Metadata { - const obj = createBaseMetadata(); - if (isSet(object.feeVersion)) obj.feeVersion = String(object.feeVersion); - if (isSet(object.appVersion)) obj.appVersion = String(object.appVersion); - return obj; - }, - toJSON(message: Metadata): unknown { - const obj: any = {}; - message.feeVersion !== undefined && (obj.feeVersion = message.feeVersion); - message.appVersion !== undefined && (obj.appVersion = message.appVersion); - return obj; - }, - fromPartial(object: Partial): Metadata { - const message = createBaseMetadata(); - message.feeVersion = object.feeVersion ?? ""; - message.appVersion = object.appVersion ?? ""; - return message; - }, -}; diff --git a/src/ibc/applications/fee/v1/query.ts b/src/ibc/applications/fee/v1/query.ts deleted file mode 100644 index 0830be5..0000000 --- a/src/ibc/applications/fee/v1/query.ts +++ /dev/null @@ -1,1317 +0,0 @@ -/* eslint-disable */ -import { PageRequest } from "../../../../cosmos/base/query/v1beta1/pagination"; -import { PacketId } from "../../../core/channel/v1/channel"; -import { IdentifiedPacketFees } from "./fee"; -import { Coin } from "../../../../cosmos/base/v1beta1/coin"; -import { FeeEnabledChannel } from "./genesis"; -import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, Rpc } from "../../../../helpers"; -export const protobufPackage = "ibc.applications.fee.v1"; -/** QueryIncentivizedPacketsRequest defines the request type for the IncentivizedPackets rpc */ -export interface QueryIncentivizedPacketsRequest { - /** pagination defines an optional pagination for the request. */ - pagination: PageRequest; - /** block height at which to query */ - queryHeight: bigint; -} -/** QueryIncentivizedPacketsResponse defines the response type for the IncentivizedPackets rpc */ -export interface QueryIncentivizedPacketsResponse { - /** list of identified fees for incentivized packets */ - incentivizedPackets: IdentifiedPacketFees[]; -} -/** QueryIncentivizedPacketRequest defines the request type for the IncentivizedPacket rpc */ -export interface QueryIncentivizedPacketRequest { - /** unique packet identifier comprised of channel ID, port ID and sequence */ - packetId: PacketId; - /** block height at which to query */ - queryHeight: bigint; -} -/** QueryIncentivizedPacketsResponse defines the response type for the IncentivizedPacket rpc */ -export interface QueryIncentivizedPacketResponse { - /** the identified fees for the incentivized packet */ - incentivizedPacket: IdentifiedPacketFees; -} -/** - * QueryIncentivizedPacketsForChannelRequest defines the request type for querying for all incentivized packets - * for a specific channel - */ -export interface QueryIncentivizedPacketsForChannelRequest { - /** pagination defines an optional pagination for the request. */ - pagination: PageRequest; - portId: string; - channelId: string; - /** Height to query at */ - queryHeight: bigint; -} -/** QueryIncentivizedPacketsResponse defines the response type for the incentivized packets RPC */ -export interface QueryIncentivizedPacketsForChannelResponse { - /** Map of all incentivized_packets */ - incentivizedPackets: IdentifiedPacketFees[]; -} -/** QueryTotalRecvFeesRequest defines the request type for the TotalRecvFees rpc */ -export interface QueryTotalRecvFeesRequest { - /** the packet identifier for the associated fees */ - packetId: PacketId; -} -/** QueryTotalRecvFeesResponse defines the response type for the TotalRecvFees rpc */ -export interface QueryTotalRecvFeesResponse { - /** the total packet receive fees */ - recvFees: Coin[]; -} -/** QueryTotalAckFeesRequest defines the request type for the TotalAckFees rpc */ -export interface QueryTotalAckFeesRequest { - /** the packet identifier for the associated fees */ - packetId: PacketId; -} -/** QueryTotalAckFeesResponse defines the response type for the TotalAckFees rpc */ -export interface QueryTotalAckFeesResponse { - /** the total packet acknowledgement fees */ - ackFees: Coin[]; -} -/** QueryTotalTimeoutFeesRequest defines the request type for the TotalTimeoutFees rpc */ -export interface QueryTotalTimeoutFeesRequest { - /** the packet identifier for the associated fees */ - packetId: PacketId; -} -/** QueryTotalTimeoutFeesResponse defines the response type for the TotalTimeoutFees rpc */ -export interface QueryTotalTimeoutFeesResponse { - /** the total packet timeout fees */ - timeoutFees: Coin[]; -} -/** QueryPayeeRequest defines the request type for the Payee rpc */ -export interface QueryPayeeRequest { - /** unique channel identifier */ - channelId: string; - /** the relayer address to which the distribution address is registered */ - relayer: string; -} -/** QueryPayeeResponse defines the response type for the Payee rpc */ -export interface QueryPayeeResponse { - /** the payee address to which packet fees are paid out */ - payeeAddress: string; -} -/** QueryCounterpartyPayeeRequest defines the request type for the CounterpartyPayee rpc */ -export interface QueryCounterpartyPayeeRequest { - /** unique channel identifier */ - channelId: string; - /** the relayer address to which the counterparty is registered */ - relayer: string; -} -/** QueryCounterpartyPayeeResponse defines the response type for the CounterpartyPayee rpc */ -export interface QueryCounterpartyPayeeResponse { - /** the counterparty payee address used to compensate forward relaying */ - counterpartyPayee: string; -} -/** QueryFeeEnabledChannelsRequest defines the request type for the FeeEnabledChannels rpc */ -export interface QueryFeeEnabledChannelsRequest { - /** pagination defines an optional pagination for the request. */ - pagination: PageRequest; - /** block height at which to query */ - queryHeight: bigint; -} -/** QueryFeeEnabledChannelsResponse defines the response type for the FeeEnabledChannels rpc */ -export interface QueryFeeEnabledChannelsResponse { - /** list of fee enabled channels */ - feeEnabledChannels: FeeEnabledChannel[]; -} -/** QueryFeeEnabledChannelRequest defines the request type for the FeeEnabledChannel rpc */ -export interface QueryFeeEnabledChannelRequest { - /** unique port identifier */ - portId: string; - /** unique channel identifier */ - channelId: string; -} -/** QueryFeeEnabledChannelResponse defines the response type for the FeeEnabledChannel rpc */ -export interface QueryFeeEnabledChannelResponse { - /** boolean flag representing the fee enabled channel status */ - feeEnabled: boolean; -} -function createBaseQueryIncentivizedPacketsRequest(): QueryIncentivizedPacketsRequest { - return { - pagination: PageRequest.fromPartial({}), - queryHeight: BigInt(0), - }; -} -export const QueryIncentivizedPacketsRequest = { - encode( - message: QueryIncentivizedPacketsRequest, - writer: BinaryWriter = BinaryWriter.create(), - ): BinaryWriter { - if (message.pagination !== undefined) { - PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); - } - if (message.queryHeight !== BigInt(0)) { - writer.uint32(16).uint64(message.queryHeight); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): QueryIncentivizedPacketsRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryIncentivizedPacketsRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.pagination = PageRequest.decode(reader, reader.uint32()); - break; - case 2: - message.queryHeight = reader.uint64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): QueryIncentivizedPacketsRequest { - const obj = createBaseQueryIncentivizedPacketsRequest(); - if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); - if (isSet(object.queryHeight)) obj.queryHeight = BigInt(object.queryHeight.toString()); - return obj; - }, - toJSON(message: QueryIncentivizedPacketsRequest): unknown { - const obj: any = {}; - message.pagination !== undefined && - (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); - message.queryHeight !== undefined && (obj.queryHeight = (message.queryHeight || BigInt(0)).toString()); - return obj; - }, - fromPartial(object: Partial): QueryIncentivizedPacketsRequest { - const message = createBaseQueryIncentivizedPacketsRequest(); - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageRequest.fromPartial(object.pagination); - } - if (object.queryHeight !== undefined && object.queryHeight !== null) { - message.queryHeight = BigInt(object.queryHeight.toString()); - } - return message; - }, -}; -function createBaseQueryIncentivizedPacketsResponse(): QueryIncentivizedPacketsResponse { - return { - incentivizedPackets: [], - }; -} -export const QueryIncentivizedPacketsResponse = { - encode( - message: QueryIncentivizedPacketsResponse, - writer: BinaryWriter = BinaryWriter.create(), - ): BinaryWriter { - for (const v of message.incentivizedPackets) { - IdentifiedPacketFees.encode(v!, writer.uint32(10).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): QueryIncentivizedPacketsResponse { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryIncentivizedPacketsResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.incentivizedPackets.push(IdentifiedPacketFees.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): QueryIncentivizedPacketsResponse { - const obj = createBaseQueryIncentivizedPacketsResponse(); - if (Array.isArray(object?.incentivizedPackets)) - obj.incentivizedPackets = object.incentivizedPackets.map((e: any) => IdentifiedPacketFees.fromJSON(e)); - return obj; - }, - toJSON(message: QueryIncentivizedPacketsResponse): unknown { - const obj: any = {}; - if (message.incentivizedPackets) { - obj.incentivizedPackets = message.incentivizedPackets.map((e) => - e ? IdentifiedPacketFees.toJSON(e) : undefined, - ); - } else { - obj.incentivizedPackets = []; - } - return obj; - }, - fromPartial(object: Partial): QueryIncentivizedPacketsResponse { - const message = createBaseQueryIncentivizedPacketsResponse(); - message.incentivizedPackets = - object.incentivizedPackets?.map((e) => IdentifiedPacketFees.fromPartial(e)) || []; - return message; - }, -}; -function createBaseQueryIncentivizedPacketRequest(): QueryIncentivizedPacketRequest { - return { - packetId: PacketId.fromPartial({}), - queryHeight: BigInt(0), - }; -} -export const QueryIncentivizedPacketRequest = { - encode( - message: QueryIncentivizedPacketRequest, - writer: BinaryWriter = BinaryWriter.create(), - ): BinaryWriter { - if (message.packetId !== undefined) { - PacketId.encode(message.packetId, writer.uint32(10).fork()).ldelim(); - } - if (message.queryHeight !== BigInt(0)) { - writer.uint32(16).uint64(message.queryHeight); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): QueryIncentivizedPacketRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryIncentivizedPacketRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.packetId = PacketId.decode(reader, reader.uint32()); - break; - case 2: - message.queryHeight = reader.uint64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): QueryIncentivizedPacketRequest { - const obj = createBaseQueryIncentivizedPacketRequest(); - if (isSet(object.packetId)) obj.packetId = PacketId.fromJSON(object.packetId); - if (isSet(object.queryHeight)) obj.queryHeight = BigInt(object.queryHeight.toString()); - return obj; - }, - toJSON(message: QueryIncentivizedPacketRequest): unknown { - const obj: any = {}; - message.packetId !== undefined && - (obj.packetId = message.packetId ? PacketId.toJSON(message.packetId) : undefined); - message.queryHeight !== undefined && (obj.queryHeight = (message.queryHeight || BigInt(0)).toString()); - return obj; - }, - fromPartial(object: Partial): QueryIncentivizedPacketRequest { - const message = createBaseQueryIncentivizedPacketRequest(); - if (object.packetId !== undefined && object.packetId !== null) { - message.packetId = PacketId.fromPartial(object.packetId); - } - if (object.queryHeight !== undefined && object.queryHeight !== null) { - message.queryHeight = BigInt(object.queryHeight.toString()); - } - return message; - }, -}; -function createBaseQueryIncentivizedPacketResponse(): QueryIncentivizedPacketResponse { - return { - incentivizedPacket: IdentifiedPacketFees.fromPartial({}), - }; -} -export const QueryIncentivizedPacketResponse = { - encode( - message: QueryIncentivizedPacketResponse, - writer: BinaryWriter = BinaryWriter.create(), - ): BinaryWriter { - if (message.incentivizedPacket !== undefined) { - IdentifiedPacketFees.encode(message.incentivizedPacket, writer.uint32(10).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): QueryIncentivizedPacketResponse { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryIncentivizedPacketResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.incentivizedPacket = IdentifiedPacketFees.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): QueryIncentivizedPacketResponse { - const obj = createBaseQueryIncentivizedPacketResponse(); - if (isSet(object.incentivizedPacket)) - obj.incentivizedPacket = IdentifiedPacketFees.fromJSON(object.incentivizedPacket); - return obj; - }, - toJSON(message: QueryIncentivizedPacketResponse): unknown { - const obj: any = {}; - message.incentivizedPacket !== undefined && - (obj.incentivizedPacket = message.incentivizedPacket - ? IdentifiedPacketFees.toJSON(message.incentivizedPacket) - : undefined); - return obj; - }, - fromPartial(object: Partial): QueryIncentivizedPacketResponse { - const message = createBaseQueryIncentivizedPacketResponse(); - if (object.incentivizedPacket !== undefined && object.incentivizedPacket !== null) { - message.incentivizedPacket = IdentifiedPacketFees.fromPartial(object.incentivizedPacket); - } - return message; - }, -}; -function createBaseQueryIncentivizedPacketsForChannelRequest(): QueryIncentivizedPacketsForChannelRequest { - return { - pagination: PageRequest.fromPartial({}), - portId: "", - channelId: "", - queryHeight: BigInt(0), - }; -} -export const QueryIncentivizedPacketsForChannelRequest = { - encode( - message: QueryIncentivizedPacketsForChannelRequest, - writer: BinaryWriter = BinaryWriter.create(), - ): BinaryWriter { - if (message.pagination !== undefined) { - PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); - } - if (message.portId !== "") { - writer.uint32(18).string(message.portId); - } - if (message.channelId !== "") { - writer.uint32(26).string(message.channelId); - } - if (message.queryHeight !== BigInt(0)) { - writer.uint32(32).uint64(message.queryHeight); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): QueryIncentivizedPacketsForChannelRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryIncentivizedPacketsForChannelRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.pagination = PageRequest.decode(reader, reader.uint32()); - break; - case 2: - message.portId = reader.string(); - break; - case 3: - message.channelId = reader.string(); - break; - case 4: - message.queryHeight = reader.uint64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): QueryIncentivizedPacketsForChannelRequest { - const obj = createBaseQueryIncentivizedPacketsForChannelRequest(); - if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); - if (isSet(object.portId)) obj.portId = String(object.portId); - if (isSet(object.channelId)) obj.channelId = String(object.channelId); - if (isSet(object.queryHeight)) obj.queryHeight = BigInt(object.queryHeight.toString()); - return obj; - }, - toJSON(message: QueryIncentivizedPacketsForChannelRequest): unknown { - const obj: any = {}; - message.pagination !== undefined && - (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); - message.portId !== undefined && (obj.portId = message.portId); - message.channelId !== undefined && (obj.channelId = message.channelId); - message.queryHeight !== undefined && (obj.queryHeight = (message.queryHeight || BigInt(0)).toString()); - return obj; - }, - fromPartial( - object: Partial, - ): QueryIncentivizedPacketsForChannelRequest { - const message = createBaseQueryIncentivizedPacketsForChannelRequest(); - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageRequest.fromPartial(object.pagination); - } - message.portId = object.portId ?? ""; - message.channelId = object.channelId ?? ""; - if (object.queryHeight !== undefined && object.queryHeight !== null) { - message.queryHeight = BigInt(object.queryHeight.toString()); - } - return message; - }, -}; -function createBaseQueryIncentivizedPacketsForChannelResponse(): QueryIncentivizedPacketsForChannelResponse { - return { - incentivizedPackets: [], - }; -} -export const QueryIncentivizedPacketsForChannelResponse = { - encode( - message: QueryIncentivizedPacketsForChannelResponse, - writer: BinaryWriter = BinaryWriter.create(), - ): BinaryWriter { - for (const v of message.incentivizedPackets) { - IdentifiedPacketFees.encode(v!, writer.uint32(10).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): QueryIncentivizedPacketsForChannelResponse { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryIncentivizedPacketsForChannelResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.incentivizedPackets.push(IdentifiedPacketFees.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): QueryIncentivizedPacketsForChannelResponse { - const obj = createBaseQueryIncentivizedPacketsForChannelResponse(); - if (Array.isArray(object?.incentivizedPackets)) - obj.incentivizedPackets = object.incentivizedPackets.map((e: any) => IdentifiedPacketFees.fromJSON(e)); - return obj; - }, - toJSON(message: QueryIncentivizedPacketsForChannelResponse): unknown { - const obj: any = {}; - if (message.incentivizedPackets) { - obj.incentivizedPackets = message.incentivizedPackets.map((e) => - e ? IdentifiedPacketFees.toJSON(e) : undefined, - ); - } else { - obj.incentivizedPackets = []; - } - return obj; - }, - fromPartial( - object: Partial, - ): QueryIncentivizedPacketsForChannelResponse { - const message = createBaseQueryIncentivizedPacketsForChannelResponse(); - message.incentivizedPackets = - object.incentivizedPackets?.map((e) => IdentifiedPacketFees.fromPartial(e)) || []; - return message; - }, -}; -function createBaseQueryTotalRecvFeesRequest(): QueryTotalRecvFeesRequest { - return { - packetId: PacketId.fromPartial({}), - }; -} -export const QueryTotalRecvFeesRequest = { - encode(message: QueryTotalRecvFeesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.packetId !== undefined) { - PacketId.encode(message.packetId, writer.uint32(10).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): QueryTotalRecvFeesRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryTotalRecvFeesRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.packetId = PacketId.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): QueryTotalRecvFeesRequest { - const obj = createBaseQueryTotalRecvFeesRequest(); - if (isSet(object.packetId)) obj.packetId = PacketId.fromJSON(object.packetId); - return obj; - }, - toJSON(message: QueryTotalRecvFeesRequest): unknown { - const obj: any = {}; - message.packetId !== undefined && - (obj.packetId = message.packetId ? PacketId.toJSON(message.packetId) : undefined); - return obj; - }, - fromPartial(object: Partial): QueryTotalRecvFeesRequest { - const message = createBaseQueryTotalRecvFeesRequest(); - if (object.packetId !== undefined && object.packetId !== null) { - message.packetId = PacketId.fromPartial(object.packetId); - } - return message; - }, -}; -function createBaseQueryTotalRecvFeesResponse(): QueryTotalRecvFeesResponse { - return { - recvFees: [], - }; -} -export const QueryTotalRecvFeesResponse = { - encode(message: QueryTotalRecvFeesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - for (const v of message.recvFees) { - Coin.encode(v!, writer.uint32(10).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): QueryTotalRecvFeesResponse { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryTotalRecvFeesResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.recvFees.push(Coin.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): QueryTotalRecvFeesResponse { - const obj = createBaseQueryTotalRecvFeesResponse(); - if (Array.isArray(object?.recvFees)) obj.recvFees = object.recvFees.map((e: any) => Coin.fromJSON(e)); - return obj; - }, - toJSON(message: QueryTotalRecvFeesResponse): unknown { - const obj: any = {}; - if (message.recvFees) { - obj.recvFees = message.recvFees.map((e) => (e ? Coin.toJSON(e) : undefined)); - } else { - obj.recvFees = []; - } - return obj; - }, - fromPartial(object: Partial): QueryTotalRecvFeesResponse { - const message = createBaseQueryTotalRecvFeesResponse(); - message.recvFees = object.recvFees?.map((e) => Coin.fromPartial(e)) || []; - return message; - }, -}; -function createBaseQueryTotalAckFeesRequest(): QueryTotalAckFeesRequest { - return { - packetId: PacketId.fromPartial({}), - }; -} -export const QueryTotalAckFeesRequest = { - encode(message: QueryTotalAckFeesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.packetId !== undefined) { - PacketId.encode(message.packetId, writer.uint32(10).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): QueryTotalAckFeesRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryTotalAckFeesRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.packetId = PacketId.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): QueryTotalAckFeesRequest { - const obj = createBaseQueryTotalAckFeesRequest(); - if (isSet(object.packetId)) obj.packetId = PacketId.fromJSON(object.packetId); - return obj; - }, - toJSON(message: QueryTotalAckFeesRequest): unknown { - const obj: any = {}; - message.packetId !== undefined && - (obj.packetId = message.packetId ? PacketId.toJSON(message.packetId) : undefined); - return obj; - }, - fromPartial(object: Partial): QueryTotalAckFeesRequest { - const message = createBaseQueryTotalAckFeesRequest(); - if (object.packetId !== undefined && object.packetId !== null) { - message.packetId = PacketId.fromPartial(object.packetId); - } - return message; - }, -}; -function createBaseQueryTotalAckFeesResponse(): QueryTotalAckFeesResponse { - return { - ackFees: [], - }; -} -export const QueryTotalAckFeesResponse = { - encode(message: QueryTotalAckFeesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - for (const v of message.ackFees) { - Coin.encode(v!, writer.uint32(10).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): QueryTotalAckFeesResponse { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryTotalAckFeesResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.ackFees.push(Coin.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): QueryTotalAckFeesResponse { - const obj = createBaseQueryTotalAckFeesResponse(); - if (Array.isArray(object?.ackFees)) obj.ackFees = object.ackFees.map((e: any) => Coin.fromJSON(e)); - return obj; - }, - toJSON(message: QueryTotalAckFeesResponse): unknown { - const obj: any = {}; - if (message.ackFees) { - obj.ackFees = message.ackFees.map((e) => (e ? Coin.toJSON(e) : undefined)); - } else { - obj.ackFees = []; - } - return obj; - }, - fromPartial(object: Partial): QueryTotalAckFeesResponse { - const message = createBaseQueryTotalAckFeesResponse(); - message.ackFees = object.ackFees?.map((e) => Coin.fromPartial(e)) || []; - return message; - }, -}; -function createBaseQueryTotalTimeoutFeesRequest(): QueryTotalTimeoutFeesRequest { - return { - packetId: PacketId.fromPartial({}), - }; -} -export const QueryTotalTimeoutFeesRequest = { - encode(message: QueryTotalTimeoutFeesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.packetId !== undefined) { - PacketId.encode(message.packetId, writer.uint32(10).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): QueryTotalTimeoutFeesRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryTotalTimeoutFeesRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.packetId = PacketId.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): QueryTotalTimeoutFeesRequest { - const obj = createBaseQueryTotalTimeoutFeesRequest(); - if (isSet(object.packetId)) obj.packetId = PacketId.fromJSON(object.packetId); - return obj; - }, - toJSON(message: QueryTotalTimeoutFeesRequest): unknown { - const obj: any = {}; - message.packetId !== undefined && - (obj.packetId = message.packetId ? PacketId.toJSON(message.packetId) : undefined); - return obj; - }, - fromPartial(object: Partial): QueryTotalTimeoutFeesRequest { - const message = createBaseQueryTotalTimeoutFeesRequest(); - if (object.packetId !== undefined && object.packetId !== null) { - message.packetId = PacketId.fromPartial(object.packetId); - } - return message; - }, -}; -function createBaseQueryTotalTimeoutFeesResponse(): QueryTotalTimeoutFeesResponse { - return { - timeoutFees: [], - }; -} -export const QueryTotalTimeoutFeesResponse = { - encode(message: QueryTotalTimeoutFeesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - for (const v of message.timeoutFees) { - Coin.encode(v!, writer.uint32(10).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): QueryTotalTimeoutFeesResponse { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryTotalTimeoutFeesResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.timeoutFees.push(Coin.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): QueryTotalTimeoutFeesResponse { - const obj = createBaseQueryTotalTimeoutFeesResponse(); - if (Array.isArray(object?.timeoutFees)) - obj.timeoutFees = object.timeoutFees.map((e: any) => Coin.fromJSON(e)); - return obj; - }, - toJSON(message: QueryTotalTimeoutFeesResponse): unknown { - const obj: any = {}; - if (message.timeoutFees) { - obj.timeoutFees = message.timeoutFees.map((e) => (e ? Coin.toJSON(e) : undefined)); - } else { - obj.timeoutFees = []; - } - return obj; - }, - fromPartial(object: Partial): QueryTotalTimeoutFeesResponse { - const message = createBaseQueryTotalTimeoutFeesResponse(); - message.timeoutFees = object.timeoutFees?.map((e) => Coin.fromPartial(e)) || []; - return message; - }, -}; -function createBaseQueryPayeeRequest(): QueryPayeeRequest { - return { - channelId: "", - relayer: "", - }; -} -export const QueryPayeeRequest = { - encode(message: QueryPayeeRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.channelId !== "") { - writer.uint32(10).string(message.channelId); - } - if (message.relayer !== "") { - writer.uint32(18).string(message.relayer); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): QueryPayeeRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryPayeeRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.channelId = reader.string(); - break; - case 2: - message.relayer = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): QueryPayeeRequest { - const obj = createBaseQueryPayeeRequest(); - if (isSet(object.channelId)) obj.channelId = String(object.channelId); - if (isSet(object.relayer)) obj.relayer = String(object.relayer); - return obj; - }, - toJSON(message: QueryPayeeRequest): unknown { - const obj: any = {}; - message.channelId !== undefined && (obj.channelId = message.channelId); - message.relayer !== undefined && (obj.relayer = message.relayer); - return obj; - }, - fromPartial(object: Partial): QueryPayeeRequest { - const message = createBaseQueryPayeeRequest(); - message.channelId = object.channelId ?? ""; - message.relayer = object.relayer ?? ""; - return message; - }, -}; -function createBaseQueryPayeeResponse(): QueryPayeeResponse { - return { - payeeAddress: "", - }; -} -export const QueryPayeeResponse = { - encode(message: QueryPayeeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.payeeAddress !== "") { - writer.uint32(10).string(message.payeeAddress); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): QueryPayeeResponse { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryPayeeResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.payeeAddress = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): QueryPayeeResponse { - const obj = createBaseQueryPayeeResponse(); - if (isSet(object.payeeAddress)) obj.payeeAddress = String(object.payeeAddress); - return obj; - }, - toJSON(message: QueryPayeeResponse): unknown { - const obj: any = {}; - message.payeeAddress !== undefined && (obj.payeeAddress = message.payeeAddress); - return obj; - }, - fromPartial(object: Partial): QueryPayeeResponse { - const message = createBaseQueryPayeeResponse(); - message.payeeAddress = object.payeeAddress ?? ""; - return message; - }, -}; -function createBaseQueryCounterpartyPayeeRequest(): QueryCounterpartyPayeeRequest { - return { - channelId: "", - relayer: "", - }; -} -export const QueryCounterpartyPayeeRequest = { - encode(message: QueryCounterpartyPayeeRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.channelId !== "") { - writer.uint32(10).string(message.channelId); - } - if (message.relayer !== "") { - writer.uint32(18).string(message.relayer); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): QueryCounterpartyPayeeRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryCounterpartyPayeeRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.channelId = reader.string(); - break; - case 2: - message.relayer = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): QueryCounterpartyPayeeRequest { - const obj = createBaseQueryCounterpartyPayeeRequest(); - if (isSet(object.channelId)) obj.channelId = String(object.channelId); - if (isSet(object.relayer)) obj.relayer = String(object.relayer); - return obj; - }, - toJSON(message: QueryCounterpartyPayeeRequest): unknown { - const obj: any = {}; - message.channelId !== undefined && (obj.channelId = message.channelId); - message.relayer !== undefined && (obj.relayer = message.relayer); - return obj; - }, - fromPartial(object: Partial): QueryCounterpartyPayeeRequest { - const message = createBaseQueryCounterpartyPayeeRequest(); - message.channelId = object.channelId ?? ""; - message.relayer = object.relayer ?? ""; - return message; - }, -}; -function createBaseQueryCounterpartyPayeeResponse(): QueryCounterpartyPayeeResponse { - return { - counterpartyPayee: "", - }; -} -export const QueryCounterpartyPayeeResponse = { - encode( - message: QueryCounterpartyPayeeResponse, - writer: BinaryWriter = BinaryWriter.create(), - ): BinaryWriter { - if (message.counterpartyPayee !== "") { - writer.uint32(10).string(message.counterpartyPayee); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): QueryCounterpartyPayeeResponse { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryCounterpartyPayeeResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.counterpartyPayee = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): QueryCounterpartyPayeeResponse { - const obj = createBaseQueryCounterpartyPayeeResponse(); - if (isSet(object.counterpartyPayee)) obj.counterpartyPayee = String(object.counterpartyPayee); - return obj; - }, - toJSON(message: QueryCounterpartyPayeeResponse): unknown { - const obj: any = {}; - message.counterpartyPayee !== undefined && (obj.counterpartyPayee = message.counterpartyPayee); - return obj; - }, - fromPartial(object: Partial): QueryCounterpartyPayeeResponse { - const message = createBaseQueryCounterpartyPayeeResponse(); - message.counterpartyPayee = object.counterpartyPayee ?? ""; - return message; - }, -}; -function createBaseQueryFeeEnabledChannelsRequest(): QueryFeeEnabledChannelsRequest { - return { - pagination: PageRequest.fromPartial({}), - queryHeight: BigInt(0), - }; -} -export const QueryFeeEnabledChannelsRequest = { - encode( - message: QueryFeeEnabledChannelsRequest, - writer: BinaryWriter = BinaryWriter.create(), - ): BinaryWriter { - if (message.pagination !== undefined) { - PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); - } - if (message.queryHeight !== BigInt(0)) { - writer.uint32(16).uint64(message.queryHeight); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): QueryFeeEnabledChannelsRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryFeeEnabledChannelsRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.pagination = PageRequest.decode(reader, reader.uint32()); - break; - case 2: - message.queryHeight = reader.uint64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): QueryFeeEnabledChannelsRequest { - const obj = createBaseQueryFeeEnabledChannelsRequest(); - if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); - if (isSet(object.queryHeight)) obj.queryHeight = BigInt(object.queryHeight.toString()); - return obj; - }, - toJSON(message: QueryFeeEnabledChannelsRequest): unknown { - const obj: any = {}; - message.pagination !== undefined && - (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); - message.queryHeight !== undefined && (obj.queryHeight = (message.queryHeight || BigInt(0)).toString()); - return obj; - }, - fromPartial(object: Partial): QueryFeeEnabledChannelsRequest { - const message = createBaseQueryFeeEnabledChannelsRequest(); - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageRequest.fromPartial(object.pagination); - } - if (object.queryHeight !== undefined && object.queryHeight !== null) { - message.queryHeight = BigInt(object.queryHeight.toString()); - } - return message; - }, -}; -function createBaseQueryFeeEnabledChannelsResponse(): QueryFeeEnabledChannelsResponse { - return { - feeEnabledChannels: [], - }; -} -export const QueryFeeEnabledChannelsResponse = { - encode( - message: QueryFeeEnabledChannelsResponse, - writer: BinaryWriter = BinaryWriter.create(), - ): BinaryWriter { - for (const v of message.feeEnabledChannels) { - FeeEnabledChannel.encode(v!, writer.uint32(10).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): QueryFeeEnabledChannelsResponse { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryFeeEnabledChannelsResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.feeEnabledChannels.push(FeeEnabledChannel.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): QueryFeeEnabledChannelsResponse { - const obj = createBaseQueryFeeEnabledChannelsResponse(); - if (Array.isArray(object?.feeEnabledChannels)) - obj.feeEnabledChannels = object.feeEnabledChannels.map((e: any) => FeeEnabledChannel.fromJSON(e)); - return obj; - }, - toJSON(message: QueryFeeEnabledChannelsResponse): unknown { - const obj: any = {}; - if (message.feeEnabledChannels) { - obj.feeEnabledChannels = message.feeEnabledChannels.map((e) => - e ? FeeEnabledChannel.toJSON(e) : undefined, - ); - } else { - obj.feeEnabledChannels = []; - } - return obj; - }, - fromPartial(object: Partial): QueryFeeEnabledChannelsResponse { - const message = createBaseQueryFeeEnabledChannelsResponse(); - message.feeEnabledChannels = - object.feeEnabledChannels?.map((e) => FeeEnabledChannel.fromPartial(e)) || []; - return message; - }, -}; -function createBaseQueryFeeEnabledChannelRequest(): QueryFeeEnabledChannelRequest { - return { - portId: "", - channelId: "", - }; -} -export const QueryFeeEnabledChannelRequest = { - encode(message: QueryFeeEnabledChannelRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.portId !== "") { - writer.uint32(10).string(message.portId); - } - if (message.channelId !== "") { - writer.uint32(18).string(message.channelId); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): QueryFeeEnabledChannelRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryFeeEnabledChannelRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.portId = reader.string(); - break; - case 2: - message.channelId = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): QueryFeeEnabledChannelRequest { - const obj = createBaseQueryFeeEnabledChannelRequest(); - if (isSet(object.portId)) obj.portId = String(object.portId); - if (isSet(object.channelId)) obj.channelId = String(object.channelId); - return obj; - }, - toJSON(message: QueryFeeEnabledChannelRequest): unknown { - const obj: any = {}; - message.portId !== undefined && (obj.portId = message.portId); - message.channelId !== undefined && (obj.channelId = message.channelId); - return obj; - }, - fromPartial(object: Partial): QueryFeeEnabledChannelRequest { - const message = createBaseQueryFeeEnabledChannelRequest(); - message.portId = object.portId ?? ""; - message.channelId = object.channelId ?? ""; - return message; - }, -}; -function createBaseQueryFeeEnabledChannelResponse(): QueryFeeEnabledChannelResponse { - return { - feeEnabled: false, - }; -} -export const QueryFeeEnabledChannelResponse = { - encode( - message: QueryFeeEnabledChannelResponse, - writer: BinaryWriter = BinaryWriter.create(), - ): BinaryWriter { - if (message.feeEnabled === true) { - writer.uint32(8).bool(message.feeEnabled); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): QueryFeeEnabledChannelResponse { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryFeeEnabledChannelResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.feeEnabled = reader.bool(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): QueryFeeEnabledChannelResponse { - const obj = createBaseQueryFeeEnabledChannelResponse(); - if (isSet(object.feeEnabled)) obj.feeEnabled = Boolean(object.feeEnabled); - return obj; - }, - toJSON(message: QueryFeeEnabledChannelResponse): unknown { - const obj: any = {}; - message.feeEnabled !== undefined && (obj.feeEnabled = message.feeEnabled); - return obj; - }, - fromPartial(object: Partial): QueryFeeEnabledChannelResponse { - const message = createBaseQueryFeeEnabledChannelResponse(); - message.feeEnabled = object.feeEnabled ?? false; - return message; - }, -}; -/** Query defines the ICS29 gRPC querier service. */ -export interface Query { - /** IncentivizedPackets returns all incentivized packets and their associated fees */ - IncentivizedPackets(request: QueryIncentivizedPacketsRequest): Promise; - /** IncentivizedPacket returns all packet fees for a packet given its identifier */ - IncentivizedPacket(request: QueryIncentivizedPacketRequest): Promise; - /** Gets all incentivized packets for a specific channel */ - IncentivizedPacketsForChannel( - request: QueryIncentivizedPacketsForChannelRequest, - ): Promise; - /** TotalRecvFees returns the total receive fees for a packet given its identifier */ - TotalRecvFees(request: QueryTotalRecvFeesRequest): Promise; - /** TotalAckFees returns the total acknowledgement fees for a packet given its identifier */ - TotalAckFees(request: QueryTotalAckFeesRequest): Promise; - /** TotalTimeoutFees returns the total timeout fees for a packet given its identifier */ - TotalTimeoutFees(request: QueryTotalTimeoutFeesRequest): Promise; - /** Payee returns the registered payee address for a specific channel given the relayer address */ - Payee(request: QueryPayeeRequest): Promise; - /** CounterpartyPayee returns the registered counterparty payee for forward relaying */ - CounterpartyPayee(request: QueryCounterpartyPayeeRequest): Promise; - /** FeeEnabledChannels returns a list of all fee enabled channels */ - FeeEnabledChannels(request: QueryFeeEnabledChannelsRequest): Promise; - /** FeeEnabledChannel returns true if the provided port and channel identifiers belong to a fee enabled channel */ - FeeEnabledChannel(request: QueryFeeEnabledChannelRequest): Promise; -} -export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { - this.rpc = rpc; - this.IncentivizedPackets = this.IncentivizedPackets.bind(this); - this.IncentivizedPacket = this.IncentivizedPacket.bind(this); - this.IncentivizedPacketsForChannel = this.IncentivizedPacketsForChannel.bind(this); - this.TotalRecvFees = this.TotalRecvFees.bind(this); - this.TotalAckFees = this.TotalAckFees.bind(this); - this.TotalTimeoutFees = this.TotalTimeoutFees.bind(this); - this.Payee = this.Payee.bind(this); - this.CounterpartyPayee = this.CounterpartyPayee.bind(this); - this.FeeEnabledChannels = this.FeeEnabledChannels.bind(this); - this.FeeEnabledChannel = this.FeeEnabledChannel.bind(this); - } - IncentivizedPackets(request: QueryIncentivizedPacketsRequest): Promise { - const data = QueryIncentivizedPacketsRequest.encode(request).finish(); - const promise = this.rpc.request("ibc.applications.fee.v1.Query", "IncentivizedPackets", data); - return promise.then((data) => QueryIncentivizedPacketsResponse.decode(new BinaryReader(data))); - } - IncentivizedPacket(request: QueryIncentivizedPacketRequest): Promise { - const data = QueryIncentivizedPacketRequest.encode(request).finish(); - const promise = this.rpc.request("ibc.applications.fee.v1.Query", "IncentivizedPacket", data); - return promise.then((data) => QueryIncentivizedPacketResponse.decode(new BinaryReader(data))); - } - IncentivizedPacketsForChannel( - request: QueryIncentivizedPacketsForChannelRequest, - ): Promise { - const data = QueryIncentivizedPacketsForChannelRequest.encode(request).finish(); - const promise = this.rpc.request("ibc.applications.fee.v1.Query", "IncentivizedPacketsForChannel", data); - return promise.then((data) => QueryIncentivizedPacketsForChannelResponse.decode(new BinaryReader(data))); - } - TotalRecvFees(request: QueryTotalRecvFeesRequest): Promise { - const data = QueryTotalRecvFeesRequest.encode(request).finish(); - const promise = this.rpc.request("ibc.applications.fee.v1.Query", "TotalRecvFees", data); - return promise.then((data) => QueryTotalRecvFeesResponse.decode(new BinaryReader(data))); - } - TotalAckFees(request: QueryTotalAckFeesRequest): Promise { - const data = QueryTotalAckFeesRequest.encode(request).finish(); - const promise = this.rpc.request("ibc.applications.fee.v1.Query", "TotalAckFees", data); - return promise.then((data) => QueryTotalAckFeesResponse.decode(new BinaryReader(data))); - } - TotalTimeoutFees(request: QueryTotalTimeoutFeesRequest): Promise { - const data = QueryTotalTimeoutFeesRequest.encode(request).finish(); - const promise = this.rpc.request("ibc.applications.fee.v1.Query", "TotalTimeoutFees", data); - return promise.then((data) => QueryTotalTimeoutFeesResponse.decode(new BinaryReader(data))); - } - Payee(request: QueryPayeeRequest): Promise { - const data = QueryPayeeRequest.encode(request).finish(); - const promise = this.rpc.request("ibc.applications.fee.v1.Query", "Payee", data); - return promise.then((data) => QueryPayeeResponse.decode(new BinaryReader(data))); - } - CounterpartyPayee(request: QueryCounterpartyPayeeRequest): Promise { - const data = QueryCounterpartyPayeeRequest.encode(request).finish(); - const promise = this.rpc.request("ibc.applications.fee.v1.Query", "CounterpartyPayee", data); - return promise.then((data) => QueryCounterpartyPayeeResponse.decode(new BinaryReader(data))); - } - FeeEnabledChannels(request: QueryFeeEnabledChannelsRequest): Promise { - const data = QueryFeeEnabledChannelsRequest.encode(request).finish(); - const promise = this.rpc.request("ibc.applications.fee.v1.Query", "FeeEnabledChannels", data); - return promise.then((data) => QueryFeeEnabledChannelsResponse.decode(new BinaryReader(data))); - } - FeeEnabledChannel(request: QueryFeeEnabledChannelRequest): Promise { - const data = QueryFeeEnabledChannelRequest.encode(request).finish(); - const promise = this.rpc.request("ibc.applications.fee.v1.Query", "FeeEnabledChannel", data); - return promise.then((data) => QueryFeeEnabledChannelResponse.decode(new BinaryReader(data))); - } -} diff --git a/src/ibc/applications/fee/v1/tx.amino.ts b/src/ibc/applications/fee/v1/tx.amino.ts deleted file mode 100644 index 743df63..0000000 --- a/src/ibc/applications/fee/v1/tx.amino.ts +++ /dev/null @@ -1,248 +0,0 @@ -/* eslint-disable */ -import { AminoMsg } from "@cosmjs/amino"; -import { MsgRegisterPayee, MsgRegisterCounterpartyPayee, MsgPayPacketFee, MsgPayPacketFeeAsync } from "./tx"; -export interface MsgRegisterPayeeAminoType extends AminoMsg { - type: "cosmos-sdk/MsgRegisterPayee"; - value: { - port_id: string; - channel_id: string; - relayer: string; - payee: string; - }; -} -export interface MsgRegisterCounterpartyPayeeAminoType extends AminoMsg { - type: "cosmos-sdk/MsgRegisterCounterpartyPayee"; - value: { - port_id: string; - channel_id: string; - relayer: string; - counterparty_payee: string; - }; -} -export interface MsgPayPacketFeeAminoType extends AminoMsg { - type: "cosmos-sdk/MsgPayPacketFee"; - value: { - fee: { - recv_fee: { - denom: string; - amount: string; - }[]; - ack_fee: { - denom: string; - amount: string; - }[]; - timeout_fee: { - denom: string; - amount: string; - }[]; - }; - source_port_id: string; - source_channel_id: string; - signer: string; - relayers: string[]; - }; -} -export interface MsgPayPacketFeeAsyncAminoType extends AminoMsg { - type: "cosmos-sdk/MsgPayPacketFeeAsync"; - value: { - packet_id: { - port_id: string; - channel_id: string; - sequence: string; - }; - packet_fee: { - fee: { - recv_fee: { - denom: string; - amount: string; - }[]; - ack_fee: { - denom: string; - amount: string; - }[]; - timeout_fee: { - denom: string; - amount: string; - }[]; - }; - refund_address: string; - relayers: string[]; - }; - }; -} -export const AminoConverter = { - "/ibc.applications.fee.v1.MsgRegisterPayee": { - aminoType: "cosmos-sdk/MsgRegisterPayee", - toAmino: ({ - portId, - channelId, - relayer, - payee, - }: MsgRegisterPayee): MsgRegisterPayeeAminoType["value"] => { - return { - port_id: portId, - channel_id: channelId, - relayer, - payee, - }; - }, - fromAmino: ({ - port_id, - channel_id, - relayer, - payee, - }: MsgRegisterPayeeAminoType["value"]): MsgRegisterPayee => { - return { - portId: port_id, - channelId: channel_id, - relayer, - payee, - }; - }, - }, - "/ibc.applications.fee.v1.MsgRegisterCounterpartyPayee": { - aminoType: "cosmos-sdk/MsgRegisterCounterpartyPayee", - toAmino: ({ - portId, - channelId, - relayer, - counterpartyPayee, - }: MsgRegisterCounterpartyPayee): MsgRegisterCounterpartyPayeeAminoType["value"] => { - return { - port_id: portId, - channel_id: channelId, - relayer, - counterparty_payee: counterpartyPayee, - }; - }, - fromAmino: ({ - port_id, - channel_id, - relayer, - counterparty_payee, - }: MsgRegisterCounterpartyPayeeAminoType["value"]): MsgRegisterCounterpartyPayee => { - return { - portId: port_id, - channelId: channel_id, - relayer, - counterpartyPayee: counterparty_payee, - }; - }, - }, - "/ibc.applications.fee.v1.MsgPayPacketFee": { - aminoType: "cosmos-sdk/MsgPayPacketFee", - toAmino: ({ - fee, - sourcePortId, - sourceChannelId, - signer, - relayers, - }: MsgPayPacketFee): MsgPayPacketFeeAminoType["value"] => { - return { - fee: { - recv_fee: fee.recvFee.map((el0) => ({ - denom: el0.denom, - amount: el0.amount, - })), - ack_fee: fee.ackFee.map((el0) => ({ - denom: el0.denom, - amount: el0.amount, - })), - timeout_fee: fee.timeoutFee.map((el0) => ({ - denom: el0.denom, - amount: el0.amount, - })), - }, - source_port_id: sourcePortId, - source_channel_id: sourceChannelId, - signer, - relayers, - }; - }, - fromAmino: ({ - fee, - source_port_id, - source_channel_id, - signer, - relayers, - }: MsgPayPacketFeeAminoType["value"]): MsgPayPacketFee => { - return { - fee: { - recvFee: fee.recv_fee.map((el1) => ({ - denom: el1.denom, - amount: el1.amount, - })), - ackFee: fee.ack_fee.map((el1) => ({ - denom: el1.denom, - amount: el1.amount, - })), - timeoutFee: fee.timeout_fee.map((el1) => ({ - denom: el1.denom, - amount: el1.amount, - })), - }, - sourcePortId: source_port_id, - sourceChannelId: source_channel_id, - signer, - relayers, - }; - }, - }, - "/ibc.applications.fee.v1.MsgPayPacketFeeAsync": { - aminoType: "cosmos-sdk/MsgPayPacketFeeAsync", - toAmino: ({ packetId, packetFee }: MsgPayPacketFeeAsync): MsgPayPacketFeeAsyncAminoType["value"] => { - return { - packet_id: { - port_id: packetId.portId, - channel_id: packetId.channelId, - sequence: packetId.sequence.toString(), - }, - packet_fee: { - fee: { - recv_fee: packetFee.fee.recvFee.map((el0) => ({ - denom: el0.denom, - amount: el0.amount, - })), - ack_fee: packetFee.fee.ackFee.map((el0) => ({ - denom: el0.denom, - amount: el0.amount, - })), - timeout_fee: packetFee.fee.timeoutFee.map((el0) => ({ - denom: el0.denom, - amount: el0.amount, - })), - }, - refund_address: packetFee.refundAddress, - relayers: packetFee.relayers, - }, - }; - }, - fromAmino: ({ packet_id, packet_fee }: MsgPayPacketFeeAsyncAminoType["value"]): MsgPayPacketFeeAsync => { - return { - packetId: { - portId: packet_id.port_id, - channelId: packet_id.channel_id, - sequence: BigInt(packet_id.sequence), - }, - packetFee: { - fee: { - recvFee: packet_fee.fee.recv_fee.map((el2) => ({ - denom: el2.denom, - amount: el2.amount, - })), - ackFee: packet_fee.fee.ack_fee.map((el2) => ({ - denom: el2.denom, - amount: el2.amount, - })), - timeoutFee: packet_fee.fee.timeout_fee.map((el2) => ({ - denom: el2.denom, - amount: el2.amount, - })), - }, - refundAddress: packet_fee.refund_address, - relayers: packet_fee.relayers, - }, - }; - }, - }, -}; diff --git a/src/ibc/applications/fee/v1/tx.registry.ts b/src/ibc/applications/fee/v1/tx.registry.ts deleted file mode 100644 index 421704f..0000000 --- a/src/ibc/applications/fee/v1/tx.registry.ts +++ /dev/null @@ -1,147 +0,0 @@ -//@ts-nocheck -/* eslint-disable */ -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; -import { MsgRegisterPayee, MsgRegisterCounterpartyPayee, MsgPayPacketFee, MsgPayPacketFeeAsync } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [ - ["/ibc.applications.fee.v1.MsgRegisterPayee", MsgRegisterPayee], - ["/ibc.applications.fee.v1.MsgRegisterCounterpartyPayee", MsgRegisterCounterpartyPayee], - ["/ibc.applications.fee.v1.MsgPayPacketFee", MsgPayPacketFee], - ["/ibc.applications.fee.v1.MsgPayPacketFeeAsync", MsgPayPacketFeeAsync], -]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; -export const MessageComposer = { - encoded: { - registerPayee(value: MsgRegisterPayee) { - return { - typeUrl: "/ibc.applications.fee.v1.MsgRegisterPayee", - value: MsgRegisterPayee.encode(value).finish(), - }; - }, - registerCounterpartyPayee(value: MsgRegisterCounterpartyPayee) { - return { - typeUrl: "/ibc.applications.fee.v1.MsgRegisterCounterpartyPayee", - value: MsgRegisterCounterpartyPayee.encode(value).finish(), - }; - }, - payPacketFee(value: MsgPayPacketFee) { - return { - typeUrl: "/ibc.applications.fee.v1.MsgPayPacketFee", - value: MsgPayPacketFee.encode(value).finish(), - }; - }, - payPacketFeeAsync(value: MsgPayPacketFeeAsync) { - return { - typeUrl: "/ibc.applications.fee.v1.MsgPayPacketFeeAsync", - value: MsgPayPacketFeeAsync.encode(value).finish(), - }; - }, - }, - withTypeUrl: { - registerPayee(value: MsgRegisterPayee) { - return { - typeUrl: "/ibc.applications.fee.v1.MsgRegisterPayee", - value, - }; - }, - registerCounterpartyPayee(value: MsgRegisterCounterpartyPayee) { - return { - typeUrl: "/ibc.applications.fee.v1.MsgRegisterCounterpartyPayee", - value, - }; - }, - payPacketFee(value: MsgPayPacketFee) { - return { - typeUrl: "/ibc.applications.fee.v1.MsgPayPacketFee", - value, - }; - }, - payPacketFeeAsync(value: MsgPayPacketFeeAsync) { - return { - typeUrl: "/ibc.applications.fee.v1.MsgPayPacketFeeAsync", - value, - }; - }, - }, - toJSON: { - registerPayee(value: MsgRegisterPayee) { - return { - typeUrl: "/ibc.applications.fee.v1.MsgRegisterPayee", - value: MsgRegisterPayee.toJSON(value), - }; - }, - registerCounterpartyPayee(value: MsgRegisterCounterpartyPayee) { - return { - typeUrl: "/ibc.applications.fee.v1.MsgRegisterCounterpartyPayee", - value: MsgRegisterCounterpartyPayee.toJSON(value), - }; - }, - payPacketFee(value: MsgPayPacketFee) { - return { - typeUrl: "/ibc.applications.fee.v1.MsgPayPacketFee", - value: MsgPayPacketFee.toJSON(value), - }; - }, - payPacketFeeAsync(value: MsgPayPacketFeeAsync) { - return { - typeUrl: "/ibc.applications.fee.v1.MsgPayPacketFeeAsync", - value: MsgPayPacketFeeAsync.toJSON(value), - }; - }, - }, - fromJSON: { - registerPayee(value: any) { - return { - typeUrl: "/ibc.applications.fee.v1.MsgRegisterPayee", - value: MsgRegisterPayee.fromJSON(value), - }; - }, - registerCounterpartyPayee(value: any) { - return { - typeUrl: "/ibc.applications.fee.v1.MsgRegisterCounterpartyPayee", - value: MsgRegisterCounterpartyPayee.fromJSON(value), - }; - }, - payPacketFee(value: any) { - return { - typeUrl: "/ibc.applications.fee.v1.MsgPayPacketFee", - value: MsgPayPacketFee.fromJSON(value), - }; - }, - payPacketFeeAsync(value: any) { - return { - typeUrl: "/ibc.applications.fee.v1.MsgPayPacketFeeAsync", - value: MsgPayPacketFeeAsync.fromJSON(value), - }; - }, - }, - fromPartial: { - registerPayee(value: MsgRegisterPayee) { - return { - typeUrl: "/ibc.applications.fee.v1.MsgRegisterPayee", - value: MsgRegisterPayee.fromPartial(value), - }; - }, - registerCounterpartyPayee(value: MsgRegisterCounterpartyPayee) { - return { - typeUrl: "/ibc.applications.fee.v1.MsgRegisterCounterpartyPayee", - value: MsgRegisterCounterpartyPayee.fromPartial(value), - }; - }, - payPacketFee(value: MsgPayPacketFee) { - return { - typeUrl: "/ibc.applications.fee.v1.MsgPayPacketFee", - value: MsgPayPacketFee.fromPartial(value), - }; - }, - payPacketFeeAsync(value: MsgPayPacketFeeAsync) { - return { - typeUrl: "/ibc.applications.fee.v1.MsgPayPacketFeeAsync", - value: MsgPayPacketFeeAsync.fromPartial(value), - }; - }, - }, -}; diff --git a/src/ibc/applications/fee/v1/tx.ts b/src/ibc/applications/fee/v1/tx.ts deleted file mode 100644 index f088651..0000000 --- a/src/ibc/applications/fee/v1/tx.ts +++ /dev/null @@ -1,571 +0,0 @@ -/* eslint-disable */ -import { Fee, PacketFee } from "./fee"; -import { PacketId } from "../../../core/channel/v1/channel"; -import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, Rpc } from "../../../../helpers"; -export const protobufPackage = "ibc.applications.fee.v1"; -/** MsgRegisterPayee defines the request type for the RegisterPayee rpc */ -export interface MsgRegisterPayee { - /** unique port identifier */ - portId: string; - /** unique channel identifier */ - channelId: string; - /** the relayer address */ - relayer: string; - /** the payee address */ - payee: string; -} -/** MsgRegisterPayeeResponse defines the response type for the RegisterPayee rpc */ -export interface MsgRegisterPayeeResponse {} -/** MsgRegisterCounterpartyPayee defines the request type for the RegisterCounterpartyPayee rpc */ -export interface MsgRegisterCounterpartyPayee { - /** unique port identifier */ - portId: string; - /** unique channel identifier */ - channelId: string; - /** the relayer address */ - relayer: string; - /** the counterparty payee address */ - counterpartyPayee: string; -} -/** MsgRegisterCounterpartyPayeeResponse defines the response type for the RegisterCounterpartyPayee rpc */ -export interface MsgRegisterCounterpartyPayeeResponse {} -/** - * MsgPayPacketFee defines the request type for the PayPacketFee rpc - * This Msg can be used to pay for a packet at the next sequence send & should be combined with the Msg that will be - * paid for - */ -export interface MsgPayPacketFee { - /** fee encapsulates the recv, ack and timeout fees associated with an IBC packet */ - fee: Fee; - /** the source port unique identifier */ - sourcePortId: string; - /** the source channel unique identifer */ - sourceChannelId: string; - /** account address to refund fee if necessary */ - signer: string; - /** optional list of relayers permitted to the receive packet fees */ - relayers: string[]; -} -/** MsgPayPacketFeeResponse defines the response type for the PayPacketFee rpc */ -export interface MsgPayPacketFeeResponse {} -/** - * MsgPayPacketFeeAsync defines the request type for the PayPacketFeeAsync rpc - * This Msg can be used to pay for a packet at a specified sequence (instead of the next sequence send) - */ -export interface MsgPayPacketFeeAsync { - /** unique packet identifier comprised of the channel ID, port ID and sequence */ - packetId: PacketId; - /** the packet fee associated with a particular IBC packet */ - packetFee: PacketFee; -} -/** MsgPayPacketFeeAsyncResponse defines the response type for the PayPacketFeeAsync rpc */ -export interface MsgPayPacketFeeAsyncResponse {} -function createBaseMsgRegisterPayee(): MsgRegisterPayee { - return { - portId: "", - channelId: "", - relayer: "", - payee: "", - }; -} -export const MsgRegisterPayee = { - encode(message: MsgRegisterPayee, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.portId !== "") { - writer.uint32(10).string(message.portId); - } - if (message.channelId !== "") { - writer.uint32(18).string(message.channelId); - } - if (message.relayer !== "") { - writer.uint32(26).string(message.relayer); - } - if (message.payee !== "") { - writer.uint32(34).string(message.payee); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterPayee { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMsgRegisterPayee(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.portId = reader.string(); - break; - case 2: - message.channelId = reader.string(); - break; - case 3: - message.relayer = reader.string(); - break; - case 4: - message.payee = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): MsgRegisterPayee { - const obj = createBaseMsgRegisterPayee(); - if (isSet(object.portId)) obj.portId = String(object.portId); - if (isSet(object.channelId)) obj.channelId = String(object.channelId); - if (isSet(object.relayer)) obj.relayer = String(object.relayer); - if (isSet(object.payee)) obj.payee = String(object.payee); - return obj; - }, - toJSON(message: MsgRegisterPayee): unknown { - const obj: any = {}; - message.portId !== undefined && (obj.portId = message.portId); - message.channelId !== undefined && (obj.channelId = message.channelId); - message.relayer !== undefined && (obj.relayer = message.relayer); - message.payee !== undefined && (obj.payee = message.payee); - return obj; - }, - fromPartial(object: Partial): MsgRegisterPayee { - const message = createBaseMsgRegisterPayee(); - message.portId = object.portId ?? ""; - message.channelId = object.channelId ?? ""; - message.relayer = object.relayer ?? ""; - message.payee = object.payee ?? ""; - return message; - }, -}; -function createBaseMsgRegisterPayeeResponse(): MsgRegisterPayeeResponse { - return {}; -} -export const MsgRegisterPayeeResponse = { - encode(_: MsgRegisterPayeeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterPayeeResponse { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMsgRegisterPayeeResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(_: any): MsgRegisterPayeeResponse { - const obj = createBaseMsgRegisterPayeeResponse(); - return obj; - }, - toJSON(_: MsgRegisterPayeeResponse): unknown { - const obj: any = {}; - return obj; - }, - fromPartial(_: Partial): MsgRegisterPayeeResponse { - const message = createBaseMsgRegisterPayeeResponse(); - return message; - }, -}; -function createBaseMsgRegisterCounterpartyPayee(): MsgRegisterCounterpartyPayee { - return { - portId: "", - channelId: "", - relayer: "", - counterpartyPayee: "", - }; -} -export const MsgRegisterCounterpartyPayee = { - encode(message: MsgRegisterCounterpartyPayee, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.portId !== "") { - writer.uint32(10).string(message.portId); - } - if (message.channelId !== "") { - writer.uint32(18).string(message.channelId); - } - if (message.relayer !== "") { - writer.uint32(26).string(message.relayer); - } - if (message.counterpartyPayee !== "") { - writer.uint32(34).string(message.counterpartyPayee); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterCounterpartyPayee { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMsgRegisterCounterpartyPayee(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.portId = reader.string(); - break; - case 2: - message.channelId = reader.string(); - break; - case 3: - message.relayer = reader.string(); - break; - case 4: - message.counterpartyPayee = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): MsgRegisterCounterpartyPayee { - const obj = createBaseMsgRegisterCounterpartyPayee(); - if (isSet(object.portId)) obj.portId = String(object.portId); - if (isSet(object.channelId)) obj.channelId = String(object.channelId); - if (isSet(object.relayer)) obj.relayer = String(object.relayer); - if (isSet(object.counterpartyPayee)) obj.counterpartyPayee = String(object.counterpartyPayee); - return obj; - }, - toJSON(message: MsgRegisterCounterpartyPayee): unknown { - const obj: any = {}; - message.portId !== undefined && (obj.portId = message.portId); - message.channelId !== undefined && (obj.channelId = message.channelId); - message.relayer !== undefined && (obj.relayer = message.relayer); - message.counterpartyPayee !== undefined && (obj.counterpartyPayee = message.counterpartyPayee); - return obj; - }, - fromPartial(object: Partial): MsgRegisterCounterpartyPayee { - const message = createBaseMsgRegisterCounterpartyPayee(); - message.portId = object.portId ?? ""; - message.channelId = object.channelId ?? ""; - message.relayer = object.relayer ?? ""; - message.counterpartyPayee = object.counterpartyPayee ?? ""; - return message; - }, -}; -function createBaseMsgRegisterCounterpartyPayeeResponse(): MsgRegisterCounterpartyPayeeResponse { - return {}; -} -export const MsgRegisterCounterpartyPayeeResponse = { - encode( - _: MsgRegisterCounterpartyPayeeResponse, - writer: BinaryWriter = BinaryWriter.create(), - ): BinaryWriter { - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterCounterpartyPayeeResponse { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMsgRegisterCounterpartyPayeeResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(_: any): MsgRegisterCounterpartyPayeeResponse { - const obj = createBaseMsgRegisterCounterpartyPayeeResponse(); - return obj; - }, - toJSON(_: MsgRegisterCounterpartyPayeeResponse): unknown { - const obj: any = {}; - return obj; - }, - fromPartial(_: Partial): MsgRegisterCounterpartyPayeeResponse { - const message = createBaseMsgRegisterCounterpartyPayeeResponse(); - return message; - }, -}; -function createBaseMsgPayPacketFee(): MsgPayPacketFee { - return { - fee: Fee.fromPartial({}), - sourcePortId: "", - sourceChannelId: "", - signer: "", - relayers: [], - }; -} -export const MsgPayPacketFee = { - encode(message: MsgPayPacketFee, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.fee !== undefined) { - Fee.encode(message.fee, writer.uint32(10).fork()).ldelim(); - } - if (message.sourcePortId !== "") { - writer.uint32(18).string(message.sourcePortId); - } - if (message.sourceChannelId !== "") { - writer.uint32(26).string(message.sourceChannelId); - } - if (message.signer !== "") { - writer.uint32(34).string(message.signer); - } - for (const v of message.relayers) { - writer.uint32(42).string(v!); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): MsgPayPacketFee { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMsgPayPacketFee(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.fee = Fee.decode(reader, reader.uint32()); - break; - case 2: - message.sourcePortId = reader.string(); - break; - case 3: - message.sourceChannelId = reader.string(); - break; - case 4: - message.signer = reader.string(); - break; - case 5: - message.relayers.push(reader.string()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): MsgPayPacketFee { - const obj = createBaseMsgPayPacketFee(); - if (isSet(object.fee)) obj.fee = Fee.fromJSON(object.fee); - if (isSet(object.sourcePortId)) obj.sourcePortId = String(object.sourcePortId); - if (isSet(object.sourceChannelId)) obj.sourceChannelId = String(object.sourceChannelId); - if (isSet(object.signer)) obj.signer = String(object.signer); - if (Array.isArray(object?.relayers)) obj.relayers = object.relayers.map((e: any) => String(e)); - return obj; - }, - toJSON(message: MsgPayPacketFee): unknown { - const obj: any = {}; - message.fee !== undefined && (obj.fee = message.fee ? Fee.toJSON(message.fee) : undefined); - message.sourcePortId !== undefined && (obj.sourcePortId = message.sourcePortId); - message.sourceChannelId !== undefined && (obj.sourceChannelId = message.sourceChannelId); - message.signer !== undefined && (obj.signer = message.signer); - if (message.relayers) { - obj.relayers = message.relayers.map((e) => e); - } else { - obj.relayers = []; - } - return obj; - }, - fromPartial(object: Partial): MsgPayPacketFee { - const message = createBaseMsgPayPacketFee(); - if (object.fee !== undefined && object.fee !== null) { - message.fee = Fee.fromPartial(object.fee); - } - message.sourcePortId = object.sourcePortId ?? ""; - message.sourceChannelId = object.sourceChannelId ?? ""; - message.signer = object.signer ?? ""; - message.relayers = object.relayers?.map((e) => e) || []; - return message; - }, -}; -function createBaseMsgPayPacketFeeResponse(): MsgPayPacketFeeResponse { - return {}; -} -export const MsgPayPacketFeeResponse = { - encode(_: MsgPayPacketFeeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): MsgPayPacketFeeResponse { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMsgPayPacketFeeResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(_: any): MsgPayPacketFeeResponse { - const obj = createBaseMsgPayPacketFeeResponse(); - return obj; - }, - toJSON(_: MsgPayPacketFeeResponse): unknown { - const obj: any = {}; - return obj; - }, - fromPartial(_: Partial): MsgPayPacketFeeResponse { - const message = createBaseMsgPayPacketFeeResponse(); - return message; - }, -}; -function createBaseMsgPayPacketFeeAsync(): MsgPayPacketFeeAsync { - return { - packetId: PacketId.fromPartial({}), - packetFee: PacketFee.fromPartial({}), - }; -} -export const MsgPayPacketFeeAsync = { - encode(message: MsgPayPacketFeeAsync, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.packetId !== undefined) { - PacketId.encode(message.packetId, writer.uint32(10).fork()).ldelim(); - } - if (message.packetFee !== undefined) { - PacketFee.encode(message.packetFee, writer.uint32(18).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): MsgPayPacketFeeAsync { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMsgPayPacketFeeAsync(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.packetId = PacketId.decode(reader, reader.uint32()); - break; - case 2: - message.packetFee = PacketFee.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): MsgPayPacketFeeAsync { - const obj = createBaseMsgPayPacketFeeAsync(); - if (isSet(object.packetId)) obj.packetId = PacketId.fromJSON(object.packetId); - if (isSet(object.packetFee)) obj.packetFee = PacketFee.fromJSON(object.packetFee); - return obj; - }, - toJSON(message: MsgPayPacketFeeAsync): unknown { - const obj: any = {}; - message.packetId !== undefined && - (obj.packetId = message.packetId ? PacketId.toJSON(message.packetId) : undefined); - message.packetFee !== undefined && - (obj.packetFee = message.packetFee ? PacketFee.toJSON(message.packetFee) : undefined); - return obj; - }, - fromPartial(object: Partial): MsgPayPacketFeeAsync { - const message = createBaseMsgPayPacketFeeAsync(); - if (object.packetId !== undefined && object.packetId !== null) { - message.packetId = PacketId.fromPartial(object.packetId); - } - if (object.packetFee !== undefined && object.packetFee !== null) { - message.packetFee = PacketFee.fromPartial(object.packetFee); - } - return message; - }, -}; -function createBaseMsgPayPacketFeeAsyncResponse(): MsgPayPacketFeeAsyncResponse { - return {}; -} -export const MsgPayPacketFeeAsyncResponse = { - encode(_: MsgPayPacketFeeAsyncResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): MsgPayPacketFeeAsyncResponse { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMsgPayPacketFeeAsyncResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(_: any): MsgPayPacketFeeAsyncResponse { - const obj = createBaseMsgPayPacketFeeAsyncResponse(); - return obj; - }, - toJSON(_: MsgPayPacketFeeAsyncResponse): unknown { - const obj: any = {}; - return obj; - }, - fromPartial(_: Partial): MsgPayPacketFeeAsyncResponse { - const message = createBaseMsgPayPacketFeeAsyncResponse(); - return message; - }, -}; -/** Msg defines the ICS29 Msg service. */ -export interface Msg { - /** - * RegisterPayee defines a rpc handler method for MsgRegisterPayee - * RegisterPayee is called by the relayer on each channelEnd and allows them to set an optional - * payee to which reverse and timeout relayer packet fees will be paid out. The payee should be registered on - * the source chain from which packets originate as this is where fee distribution takes place. This function may be - * called more than once by a relayer, in which case, the latest payee is always used. - */ - RegisterPayee(request: MsgRegisterPayee): Promise; - /** - * RegisterCounterpartyPayee defines a rpc handler method for MsgRegisterCounterpartyPayee - * RegisterCounterpartyPayee is called by the relayer on each channelEnd and allows them to specify the counterparty - * payee address before relaying. This ensures they will be properly compensated for forward relaying since - * the destination chain must include the registered counterparty payee address in the acknowledgement. This function - * may be called more than once by a relayer, in which case, the latest counterparty payee address is always used. - */ - RegisterCounterpartyPayee( - request: MsgRegisterCounterpartyPayee, - ): Promise; - /** - * PayPacketFee defines a rpc handler method for MsgPayPacketFee - * PayPacketFee is an open callback that may be called by any module/user that wishes to escrow funds in order to - * incentivize the relaying of the packet at the next sequence - * NOTE: This method is intended to be used within a multi msg transaction, where the subsequent msg that follows - * initiates the lifecycle of the incentivized packet - */ - PayPacketFee(request: MsgPayPacketFee): Promise; - /** - * PayPacketFeeAsync defines a rpc handler method for MsgPayPacketFeeAsync - * PayPacketFeeAsync is an open callback that may be called by any module/user that wishes to escrow funds in order to - * incentivize the relaying of a known packet (i.e. at a particular sequence) - */ - PayPacketFeeAsync(request: MsgPayPacketFeeAsync): Promise; -} -export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { - this.rpc = rpc; - this.RegisterPayee = this.RegisterPayee.bind(this); - this.RegisterCounterpartyPayee = this.RegisterCounterpartyPayee.bind(this); - this.PayPacketFee = this.PayPacketFee.bind(this); - this.PayPacketFeeAsync = this.PayPacketFeeAsync.bind(this); - } - RegisterPayee(request: MsgRegisterPayee): Promise { - const data = MsgRegisterPayee.encode(request).finish(); - const promise = this.rpc.request("ibc.applications.fee.v1.Msg", "RegisterPayee", data); - return promise.then((data) => MsgRegisterPayeeResponse.decode(new BinaryReader(data))); - } - RegisterCounterpartyPayee( - request: MsgRegisterCounterpartyPayee, - ): Promise { - const data = MsgRegisterCounterpartyPayee.encode(request).finish(); - const promise = this.rpc.request("ibc.applications.fee.v1.Msg", "RegisterCounterpartyPayee", data); - return promise.then((data) => MsgRegisterCounterpartyPayeeResponse.decode(new BinaryReader(data))); - } - PayPacketFee(request: MsgPayPacketFee): Promise { - const data = MsgPayPacketFee.encode(request).finish(); - const promise = this.rpc.request("ibc.applications.fee.v1.Msg", "PayPacketFee", data); - return promise.then((data) => MsgPayPacketFeeResponse.decode(new BinaryReader(data))); - } - PayPacketFeeAsync(request: MsgPayPacketFeeAsync): Promise { - const data = MsgPayPacketFeeAsync.encode(request).finish(); - const promise = this.rpc.request("ibc.applications.fee.v1.Msg", "PayPacketFeeAsync", data); - return promise.then((data) => MsgPayPacketFeeAsyncResponse.decode(new BinaryReader(data))); - } -} diff --git a/src/ibc/applications/interchain_accounts/controller/v1/tx.amino.ts b/src/ibc/applications/interchain_accounts/controller/v1/tx.amino.ts index 62c60ca..a6be5e0 100644 --- a/src/ibc/applications/interchain_accounts/controller/v1/tx.amino.ts +++ b/src/ibc/applications/interchain_accounts/controller/v1/tx.amino.ts @@ -1,13 +1,15 @@ /* eslint-disable */ +import { orderFromJSON } from "../../../../core/channel/v1/channel"; import { typeFromJSON } from "../../v1/packet"; import { AminoMsg } from "@cosmjs/amino"; -import { MsgRegisterInterchainAccount, MsgSendTx } from "./tx"; +import { MsgRegisterInterchainAccount, MsgSendTx, MsgUpdateParams } from "./tx"; export interface MsgRegisterInterchainAccountAminoType extends AminoMsg { type: "cosmos-sdk/MsgRegisterInterchainAccount"; value: { owner: string; connection_id: string; version: string; + ordering: number; }; } export interface MsgSendTxAminoType extends AminoMsg { @@ -23,6 +25,15 @@ export interface MsgSendTxAminoType extends AminoMsg { relative_timeout: string; }; } +export interface MsgUpdateParamsAminoType extends AminoMsg { + type: "cosmos-sdk/MsgUpdateParams"; + value: { + signer: string; + params: { + controller_enabled: boolean; + }; + }; +} export const AminoConverter = { "/ibc.applications.interchain_accounts.controller.v1.MsgRegisterInterchainAccount": { aminoType: "cosmos-sdk/MsgRegisterInterchainAccount", @@ -30,22 +41,26 @@ export const AminoConverter = { owner, connectionId, version, + ordering, }: MsgRegisterInterchainAccount): MsgRegisterInterchainAccountAminoType["value"] => { return { owner, connection_id: connectionId, version, + ordering, }; }, fromAmino: ({ owner, connection_id, version, + ordering, }: MsgRegisterInterchainAccountAminoType["value"]): MsgRegisterInterchainAccount => { return { owner, connectionId: connection_id, version, + ordering: orderFromJSON(ordering), }; }, }, @@ -86,4 +101,23 @@ export const AminoConverter = { }; }, }, + "/ibc.applications.interchain_accounts.controller.v1.MsgUpdateParams": { + aminoType: "cosmos-sdk/MsgUpdateParams", + toAmino: ({ signer, params }: MsgUpdateParams): MsgUpdateParamsAminoType["value"] => { + return { + signer, + params: { + controller_enabled: params.controllerEnabled, + }, + }; + }, + fromAmino: ({ signer, params }: MsgUpdateParamsAminoType["value"]): MsgUpdateParams => { + return { + signer, + params: { + controllerEnabled: params.controller_enabled, + }, + }; + }, + }, }; diff --git a/src/ibc/applications/interchain_accounts/controller/v1/tx.registry.ts b/src/ibc/applications/interchain_accounts/controller/v1/tx.registry.ts index 9320555..fd62e8a 100644 --- a/src/ibc/applications/interchain_accounts/controller/v1/tx.registry.ts +++ b/src/ibc/applications/interchain_accounts/controller/v1/tx.registry.ts @@ -1,13 +1,14 @@ //@ts-nocheck /* eslint-disable */ import { GeneratedType, Registry } from "@cosmjs/proto-signing"; -import { MsgRegisterInterchainAccount, MsgSendTx } from "./tx"; +import { MsgRegisterInterchainAccount, MsgSendTx, MsgUpdateParams } from "./tx"; export const registry: ReadonlyArray<[string, GeneratedType]> = [ [ "/ibc.applications.interchain_accounts.controller.v1.MsgRegisterInterchainAccount", MsgRegisterInterchainAccount, ], ["/ibc.applications.interchain_accounts.controller.v1.MsgSendTx", MsgSendTx], + ["/ibc.applications.interchain_accounts.controller.v1.MsgUpdateParams", MsgUpdateParams], ]; export const load = (protoRegistry: Registry) => { registry.forEach(([typeUrl, mod]) => { @@ -28,6 +29,12 @@ export const MessageComposer = { value: MsgSendTx.encode(value).finish(), }; }, + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/ibc.applications.interchain_accounts.controller.v1.MsgUpdateParams", + value: MsgUpdateParams.encode(value).finish(), + }; + }, }, withTypeUrl: { registerInterchainAccount(value: MsgRegisterInterchainAccount) { @@ -42,6 +49,12 @@ export const MessageComposer = { value, }; }, + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/ibc.applications.interchain_accounts.controller.v1.MsgUpdateParams", + value, + }; + }, }, toJSON: { registerInterchainAccount(value: MsgRegisterInterchainAccount) { @@ -56,6 +69,12 @@ export const MessageComposer = { value: MsgSendTx.toJSON(value), }; }, + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/ibc.applications.interchain_accounts.controller.v1.MsgUpdateParams", + value: MsgUpdateParams.toJSON(value), + }; + }, }, fromJSON: { registerInterchainAccount(value: any) { @@ -70,6 +89,12 @@ export const MessageComposer = { value: MsgSendTx.fromJSON(value), }; }, + updateParams(value: any) { + return { + typeUrl: "/ibc.applications.interchain_accounts.controller.v1.MsgUpdateParams", + value: MsgUpdateParams.fromJSON(value), + }; + }, }, fromPartial: { registerInterchainAccount(value: MsgRegisterInterchainAccount) { @@ -84,5 +109,11 @@ export const MessageComposer = { value: MsgSendTx.fromPartial(value), }; }, + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/ibc.applications.interchain_accounts.controller.v1.MsgUpdateParams", + value: MsgUpdateParams.fromPartial(value), + }; + }, }, }; diff --git a/src/ibc/applications/interchain_accounts/controller/v1/tx.ts b/src/ibc/applications/interchain_accounts/controller/v1/tx.ts index 4209e8c..d7a73dd 100644 --- a/src/ibc/applications/interchain_accounts/controller/v1/tx.ts +++ b/src/ibc/applications/interchain_accounts/controller/v1/tx.ts @@ -1,5 +1,7 @@ /* eslint-disable */ +import { Order, orderFromJSON, orderToJSON } from "../../../../core/channel/v1/channel"; import { InterchainAccountPacketData } from "../../v1/packet"; +import { Params } from "./controller"; import { BinaryReader, BinaryWriter } from "../../../../../binary"; import { isSet, Rpc } from "../../../../../helpers"; export const protobufPackage = "ibc.applications.interchain_accounts.controller.v1"; @@ -8,6 +10,7 @@ export interface MsgRegisterInterchainAccount { owner: string; connectionId: string; version: string; + ordering: Order; } /** MsgRegisterInterchainAccountResponse defines the response for Msg/RegisterAccount */ export interface MsgRegisterInterchainAccountResponse { @@ -29,11 +32,25 @@ export interface MsgSendTx { export interface MsgSendTxResponse { sequence: bigint; } +/** MsgUpdateParams defines the payload for Msg/UpdateParams */ +export interface MsgUpdateParams { + /** signer address */ + signer: string; + /** + * params defines the 27-interchain-accounts/controller parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params; +} +/** MsgUpdateParamsResponse defines the response for Msg/UpdateParams */ +export interface MsgUpdateParamsResponse {} function createBaseMsgRegisterInterchainAccount(): MsgRegisterInterchainAccount { return { owner: "", connectionId: "", version: "", + ordering: 0, }; } export const MsgRegisterInterchainAccount = { @@ -47,6 +64,9 @@ export const MsgRegisterInterchainAccount = { if (message.version !== "") { writer.uint32(26).string(message.version); } + if (message.ordering !== 0) { + writer.uint32(32).int32(message.ordering); + } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterInterchainAccount { @@ -65,6 +85,9 @@ export const MsgRegisterInterchainAccount = { case 3: message.version = reader.string(); break; + case 4: + message.ordering = reader.int32() as any; + break; default: reader.skipType(tag & 7); break; @@ -77,6 +100,7 @@ export const MsgRegisterInterchainAccount = { if (isSet(object.owner)) obj.owner = String(object.owner); if (isSet(object.connectionId)) obj.connectionId = String(object.connectionId); if (isSet(object.version)) obj.version = String(object.version); + if (isSet(object.ordering)) obj.ordering = orderFromJSON(object.ordering); return obj; }, toJSON(message: MsgRegisterInterchainAccount): unknown { @@ -84,6 +108,7 @@ export const MsgRegisterInterchainAccount = { message.owner !== undefined && (obj.owner = message.owner); message.connectionId !== undefined && (obj.connectionId = message.connectionId); message.version !== undefined && (obj.version = message.version); + message.ordering !== undefined && (obj.ordering = orderToJSON(message.ordering)); return obj; }, fromPartial(object: Partial): MsgRegisterInterchainAccount { @@ -91,6 +116,7 @@ export const MsgRegisterInterchainAccount = { message.owner = object.owner ?? ""; message.connectionId = object.connectionId ?? ""; message.version = object.version ?? ""; + message.ordering = object.ordering ?? 0; return message; }, }; @@ -282,6 +308,97 @@ export const MsgSendTxResponse = { return message; }, }; +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { + signer: "", + params: Params.fromPartial({}), + }; +} +export const MsgUpdateParams = { + encode(message: MsgUpdateParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.signer !== "") { + writer.uint32(10).string(message.signer); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.signer = reader.string(); + break; + case 2: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgUpdateParams { + const obj = createBaseMsgUpdateParams(); + if (isSet(object.signer)) obj.signer = String(object.signer); + if (isSet(object.params)) obj.params = Params.fromJSON(object.params); + return obj; + }, + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + message.signer !== undefined && (obj.signer = message.signer); + message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + return obj; + }, + fromPartial(object: Partial): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + message.signer = object.signer ?? ""; + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromPartial(object.params); + } + return message; + }, +}; +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} +export const MsgUpdateParamsResponse = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): MsgUpdateParamsResponse { + const obj = createBaseMsgUpdateParamsResponse(); + return obj; + }, + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + fromPartial(_: Partial): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; /** Msg defines the 27-interchain-accounts/controller Msg service. */ export interface Msg { /** RegisterInterchainAccount defines a rpc handler for MsgRegisterInterchainAccount. */ @@ -290,6 +407,8 @@ export interface Msg { ): Promise; /** SendTx defines a rpc handler for MsgSendTx. */ SendTx(request: MsgSendTx): Promise; + /** UpdateParams defines a rpc handler for MsgUpdateParams. */ + UpdateParams(request: MsgUpdateParams): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: Rpc; @@ -297,6 +416,7 @@ export class MsgClientImpl implements Msg { this.rpc = rpc; this.RegisterInterchainAccount = this.RegisterInterchainAccount.bind(this); this.SendTx = this.SendTx.bind(this); + this.UpdateParams = this.UpdateParams.bind(this); } RegisterInterchainAccount( request: MsgRegisterInterchainAccount, @@ -318,4 +438,13 @@ export class MsgClientImpl implements Msg { ); return promise.then((data) => MsgSendTxResponse.decode(new BinaryReader(data))); } + UpdateParams(request: MsgUpdateParams): Promise { + const data = MsgUpdateParams.encode(request).finish(); + const promise = this.rpc.request( + "ibc.applications.interchain_accounts.controller.v1.Msg", + "UpdateParams", + data, + ); + return promise.then((data) => MsgUpdateParamsResponse.decode(new BinaryReader(data))); + } } diff --git a/src/ibc/applications/interchain_accounts/host/v1/host.ts b/src/ibc/applications/interchain_accounts/host/v1/host.ts index 4517aab..071f766 100644 --- a/src/ibc/applications/interchain_accounts/host/v1/host.ts +++ b/src/ibc/applications/interchain_accounts/host/v1/host.ts @@ -1,6 +1,6 @@ /* eslint-disable */ import { BinaryReader, BinaryWriter } from "../../../../../binary"; -import { isSet } from "../../../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes } from "../../../../../helpers"; export const protobufPackage = "ibc.applications.interchain_accounts.host.v1"; /** * Params defines the set of on-chain interchain accounts parameters. @@ -12,6 +12,22 @@ export interface Params { /** allow_messages defines a list of sdk message typeURLs allowed to be executed on a host chain. */ allowMessages: string[]; } +/** + * QueryRequest defines the parameters for a particular query request + * by an interchain account. + */ +export interface QueryRequest { + /** + * path defines the path of the query request as defined by ADR-021. + * https://github.com/cosmos/cosmos-sdk/blob/main/docs/architecture/adr-021-protobuf-query-encoding.md#custom-query-registration-and-routing + */ + path: string; + /** + * data defines the payload of the query request as defined by ADR-021. + * https://github.com/cosmos/cosmos-sdk/blob/main/docs/architecture/adr-021-protobuf-query-encoding.md#custom-query-registration-and-routing + */ + data: Uint8Array; +} function createBaseParams(): Params { return { hostEnabled: false, @@ -72,3 +88,59 @@ export const Params = { return message; }, }; +function createBaseQueryRequest(): QueryRequest { + return { + path: "", + data: new Uint8Array(), + }; +} +export const QueryRequest = { + encode(message: QueryRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.path !== "") { + writer.uint32(10).string(message.path); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.path = reader.string(); + break; + case 2: + message.data = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryRequest { + const obj = createBaseQueryRequest(); + if (isSet(object.path)) obj.path = String(object.path); + if (isSet(object.data)) obj.data = bytesFromBase64(object.data); + return obj; + }, + toJSON(message: QueryRequest): unknown { + const obj: any = {}; + message.path !== undefined && (obj.path = message.path); + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); + return obj; + }, + fromPartial(object: Partial): QueryRequest { + const message = createBaseQueryRequest(); + message.path = object.path ?? ""; + message.data = object.data ?? new Uint8Array(); + return message; + }, +}; diff --git a/src/ibc/applications/interchain_accounts/host/v1/tx.amino.ts b/src/ibc/applications/interchain_accounts/host/v1/tx.amino.ts new file mode 100644 index 0000000..c5d1457 --- /dev/null +++ b/src/ibc/applications/interchain_accounts/host/v1/tx.amino.ts @@ -0,0 +1,67 @@ +/* eslint-disable */ +import { AminoMsg } from "@cosmjs/amino"; +import { MsgUpdateParams, MsgModuleQuerySafe } from "./tx"; +export interface MsgUpdateParamsAminoType extends AminoMsg { + type: "cosmos-sdk/MsgUpdateParams"; + value: { + signer: string; + params: { + host_enabled: boolean; + allow_messages: string[]; + }; + }; +} +export interface MsgModuleQuerySafeAminoType extends AminoMsg { + type: "cosmos-sdk/MsgModuleQuerySafe"; + value: { + signer: string; + requests: { + path: string; + data: Uint8Array; + }[]; + }; +} +export const AminoConverter = { + "/ibc.applications.interchain_accounts.host.v1.MsgUpdateParams": { + aminoType: "cosmos-sdk/MsgUpdateParams", + toAmino: ({ signer, params }: MsgUpdateParams): MsgUpdateParamsAminoType["value"] => { + return { + signer, + params: { + host_enabled: params.hostEnabled, + allow_messages: params.allowMessages, + }, + }; + }, + fromAmino: ({ signer, params }: MsgUpdateParamsAminoType["value"]): MsgUpdateParams => { + return { + signer, + params: { + hostEnabled: params.host_enabled, + allowMessages: params.allow_messages, + }, + }; + }, + }, + "/ibc.applications.interchain_accounts.host.v1.MsgModuleQuerySafe": { + aminoType: "cosmos-sdk/MsgModuleQuerySafe", + toAmino: ({ signer, requests }: MsgModuleQuerySafe): MsgModuleQuerySafeAminoType["value"] => { + return { + signer, + requests: requests.map((el0) => ({ + path: el0.path, + data: el0.data, + })), + }; + }, + fromAmino: ({ signer, requests }: MsgModuleQuerySafeAminoType["value"]): MsgModuleQuerySafe => { + return { + signer, + requests: requests.map((el0) => ({ + path: el0.path, + data: el0.data, + })), + }; + }, + }, +}; diff --git a/src/ibc/applications/interchain_accounts/host/v1/tx.registry.ts b/src/ibc/applications/interchain_accounts/host/v1/tx.registry.ts new file mode 100644 index 0000000..e64b4d1 --- /dev/null +++ b/src/ibc/applications/interchain_accounts/host/v1/tx.registry.ts @@ -0,0 +1,85 @@ +//@ts-nocheck +/* eslint-disable */ +import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { MsgUpdateParams, MsgModuleQuerySafe } from "./tx"; +export const registry: ReadonlyArray<[string, GeneratedType]> = [ + ["/ibc.applications.interchain_accounts.host.v1.MsgUpdateParams", MsgUpdateParams], + ["/ibc.applications.interchain_accounts.host.v1.MsgModuleQuerySafe", MsgModuleQuerySafe], +]; +export const load = (protoRegistry: Registry) => { + registry.forEach(([typeUrl, mod]) => { + protoRegistry.register(typeUrl, mod); + }); +}; +export const MessageComposer = { + encoded: { + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/ibc.applications.interchain_accounts.host.v1.MsgUpdateParams", + value: MsgUpdateParams.encode(value).finish(), + }; + }, + moduleQuerySafe(value: MsgModuleQuerySafe) { + return { + typeUrl: "/ibc.applications.interchain_accounts.host.v1.MsgModuleQuerySafe", + value: MsgModuleQuerySafe.encode(value).finish(), + }; + }, + }, + withTypeUrl: { + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/ibc.applications.interchain_accounts.host.v1.MsgUpdateParams", + value, + }; + }, + moduleQuerySafe(value: MsgModuleQuerySafe) { + return { + typeUrl: "/ibc.applications.interchain_accounts.host.v1.MsgModuleQuerySafe", + value, + }; + }, + }, + toJSON: { + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/ibc.applications.interchain_accounts.host.v1.MsgUpdateParams", + value: MsgUpdateParams.toJSON(value), + }; + }, + moduleQuerySafe(value: MsgModuleQuerySafe) { + return { + typeUrl: "/ibc.applications.interchain_accounts.host.v1.MsgModuleQuerySafe", + value: MsgModuleQuerySafe.toJSON(value), + }; + }, + }, + fromJSON: { + updateParams(value: any) { + return { + typeUrl: "/ibc.applications.interchain_accounts.host.v1.MsgUpdateParams", + value: MsgUpdateParams.fromJSON(value), + }; + }, + moduleQuerySafe(value: any) { + return { + typeUrl: "/ibc.applications.interchain_accounts.host.v1.MsgModuleQuerySafe", + value: MsgModuleQuerySafe.fromJSON(value), + }; + }, + }, + fromPartial: { + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/ibc.applications.interchain_accounts.host.v1.MsgUpdateParams", + value: MsgUpdateParams.fromPartial(value), + }; + }, + moduleQuerySafe(value: MsgModuleQuerySafe) { + return { + typeUrl: "/ibc.applications.interchain_accounts.host.v1.MsgModuleQuerySafe", + value: MsgModuleQuerySafe.fromPartial(value), + }; + }, + }, +}; diff --git a/src/ibc/applications/interchain_accounts/host/v1/tx.ts b/src/ibc/applications/interchain_accounts/host/v1/tx.ts new file mode 100644 index 0000000..579da35 --- /dev/null +++ b/src/ibc/applications/interchain_accounts/host/v1/tx.ts @@ -0,0 +1,278 @@ +/* eslint-disable */ +import { Params, QueryRequest } from "./host"; +import { BinaryReader, BinaryWriter } from "../../../../../binary"; +import { isSet, bytesFromBase64, base64FromBytes, Rpc } from "../../../../../helpers"; +export const protobufPackage = "ibc.applications.interchain_accounts.host.v1"; +/** MsgUpdateParams defines the payload for Msg/UpdateParams */ +export interface MsgUpdateParams { + /** signer address */ + signer: string; + /** + * params defines the 27-interchain-accounts/host parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params; +} +/** MsgUpdateParamsResponse defines the response for Msg/UpdateParams */ +export interface MsgUpdateParamsResponse {} +/** MsgModuleQuerySafe defines the payload for Msg/ModuleQuerySafe */ +export interface MsgModuleQuerySafe { + /** signer address */ + signer: string; + /** requests defines the module safe queries to execute. */ + requests: QueryRequest[]; +} +/** MsgModuleQuerySafeResponse defines the response for Msg/ModuleQuerySafe */ +export interface MsgModuleQuerySafeResponse { + /** height at which the responses were queried */ + height: bigint; + /** protobuf encoded responses for each query */ + responses: Uint8Array[]; +} +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { + signer: "", + params: Params.fromPartial({}), + }; +} +export const MsgUpdateParams = { + encode(message: MsgUpdateParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.signer !== "") { + writer.uint32(10).string(message.signer); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.signer = reader.string(); + break; + case 2: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgUpdateParams { + const obj = createBaseMsgUpdateParams(); + if (isSet(object.signer)) obj.signer = String(object.signer); + if (isSet(object.params)) obj.params = Params.fromJSON(object.params); + return obj; + }, + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + message.signer !== undefined && (obj.signer = message.signer); + message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + return obj; + }, + fromPartial(object: Partial): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + message.signer = object.signer ?? ""; + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromPartial(object.params); + } + return message; + }, +}; +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} +export const MsgUpdateParamsResponse = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): MsgUpdateParamsResponse { + const obj = createBaseMsgUpdateParamsResponse(); + return obj; + }, + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + fromPartial(_: Partial): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; +function createBaseMsgModuleQuerySafe(): MsgModuleQuerySafe { + return { + signer: "", + requests: [], + }; +} +export const MsgModuleQuerySafe = { + encode(message: MsgModuleQuerySafe, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.signer !== "") { + writer.uint32(10).string(message.signer); + } + for (const v of message.requests) { + QueryRequest.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgModuleQuerySafe { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgModuleQuerySafe(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.signer = reader.string(); + break; + case 2: + message.requests.push(QueryRequest.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgModuleQuerySafe { + const obj = createBaseMsgModuleQuerySafe(); + if (isSet(object.signer)) obj.signer = String(object.signer); + if (Array.isArray(object?.requests)) + obj.requests = object.requests.map((e: any) => QueryRequest.fromJSON(e)); + return obj; + }, + toJSON(message: MsgModuleQuerySafe): unknown { + const obj: any = {}; + message.signer !== undefined && (obj.signer = message.signer); + if (message.requests) { + obj.requests = message.requests.map((e) => (e ? QueryRequest.toJSON(e) : undefined)); + } else { + obj.requests = []; + } + return obj; + }, + fromPartial(object: Partial): MsgModuleQuerySafe { + const message = createBaseMsgModuleQuerySafe(); + message.signer = object.signer ?? ""; + message.requests = object.requests?.map((e) => QueryRequest.fromPartial(e)) || []; + return message; + }, +}; +function createBaseMsgModuleQuerySafeResponse(): MsgModuleQuerySafeResponse { + return { + height: BigInt(0), + responses: [], + }; +} +export const MsgModuleQuerySafeResponse = { + encode(message: MsgModuleQuerySafeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.height !== BigInt(0)) { + writer.uint32(8).uint64(message.height); + } + for (const v of message.responses) { + writer.uint32(18).bytes(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgModuleQuerySafeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgModuleQuerySafeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = reader.uint64(); + break; + case 2: + message.responses.push(reader.bytes()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgModuleQuerySafeResponse { + const obj = createBaseMsgModuleQuerySafeResponse(); + if (isSet(object.height)) obj.height = BigInt(object.height.toString()); + if (Array.isArray(object?.responses)) + obj.responses = object.responses.map((e: any) => bytesFromBase64(e)); + return obj; + }, + toJSON(message: MsgModuleQuerySafeResponse): unknown { + const obj: any = {}; + message.height !== undefined && (obj.height = (message.height || BigInt(0)).toString()); + if (message.responses) { + obj.responses = message.responses.map((e) => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.responses = []; + } + return obj; + }, + fromPartial(object: Partial): MsgModuleQuerySafeResponse { + const message = createBaseMsgModuleQuerySafeResponse(); + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height.toString()); + } + message.responses = object.responses?.map((e) => e) || []; + return message; + }, +}; +/** Msg defines the 27-interchain-accounts/host Msg service. */ +export interface Msg { + /** UpdateParams defines a rpc handler for MsgUpdateParams. */ + UpdateParams(request: MsgUpdateParams): Promise; + /** ModuleQuerySafe defines a rpc handler for MsgModuleQuerySafe. */ + ModuleQuerySafe(request: MsgModuleQuerySafe): Promise; +} +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + this.UpdateParams = this.UpdateParams.bind(this); + this.ModuleQuerySafe = this.ModuleQuerySafe.bind(this); + } + UpdateParams(request: MsgUpdateParams): Promise { + const data = MsgUpdateParams.encode(request).finish(); + const promise = this.rpc.request( + "ibc.applications.interchain_accounts.host.v1.Msg", + "UpdateParams", + data, + ); + return promise.then((data) => MsgUpdateParamsResponse.decode(new BinaryReader(data))); + } + ModuleQuerySafe(request: MsgModuleQuerySafe): Promise { + const data = MsgModuleQuerySafe.encode(request).finish(); + const promise = this.rpc.request( + "ibc.applications.interchain_accounts.host.v1.Msg", + "ModuleQuerySafe", + data, + ); + return promise.then((data) => MsgModuleQuerySafeResponse.decode(new BinaryReader(data))); + } +} diff --git a/src/ibc/applications/transfer/v1/authz.ts b/src/ibc/applications/transfer/v1/authz.ts index 0900e4d..6b85523 100644 --- a/src/ibc/applications/transfer/v1/authz.ts +++ b/src/ibc/applications/transfer/v1/authz.ts @@ -13,6 +13,11 @@ export interface Allocation { spendLimit: Coin[]; /** allow list of receivers, an empty allow list permits any receiver address */ allowList: string[]; + /** + * allow list of memo strings, an empty list prohibits all memo strings; + * a list only with "*" permits any memo string + */ + allowedPacketData: string[]; } /** * TransferAuthorization allows the grantee to spend up to spend_limit coins from @@ -28,6 +33,7 @@ function createBaseAllocation(): Allocation { sourceChannel: "", spendLimit: [], allowList: [], + allowedPacketData: [], }; } export const Allocation = { @@ -44,6 +50,9 @@ export const Allocation = { for (const v of message.allowList) { writer.uint32(34).string(v!); } + for (const v of message.allowedPacketData) { + writer.uint32(42).string(v!); + } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): Allocation { @@ -65,6 +74,9 @@ export const Allocation = { case 4: message.allowList.push(reader.string()); break; + case 5: + message.allowedPacketData.push(reader.string()); + break; default: reader.skipType(tag & 7); break; @@ -79,6 +91,8 @@ export const Allocation = { if (Array.isArray(object?.spendLimit)) obj.spendLimit = object.spendLimit.map((e: any) => Coin.fromJSON(e)); if (Array.isArray(object?.allowList)) obj.allowList = object.allowList.map((e: any) => String(e)); + if (Array.isArray(object?.allowedPacketData)) + obj.allowedPacketData = object.allowedPacketData.map((e: any) => String(e)); return obj; }, toJSON(message: Allocation): unknown { @@ -95,6 +109,11 @@ export const Allocation = { } else { obj.allowList = []; } + if (message.allowedPacketData) { + obj.allowedPacketData = message.allowedPacketData.map((e) => e); + } else { + obj.allowedPacketData = []; + } return obj; }, fromPartial(object: Partial): Allocation { @@ -103,6 +122,7 @@ export const Allocation = { message.sourceChannel = object.sourceChannel ?? ""; message.spendLimit = object.spendLimit?.map((e) => Coin.fromPartial(e)) || []; message.allowList = object.allowList?.map((e) => e) || []; + message.allowedPacketData = object.allowedPacketData?.map((e) => e) || []; return message; }, }; diff --git a/src/ibc/applications/transfer/v1/denomtrace.ts b/src/ibc/applications/transfer/v1/denomtrace.ts new file mode 100644 index 0000000..dfd59c7 --- /dev/null +++ b/src/ibc/applications/transfer/v1/denomtrace.ts @@ -0,0 +1,73 @@ +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { isSet } from "../../../../helpers"; +export const protobufPackage = "ibc.applications.transfer.v1"; +/** + * DenomTrace contains the base denomination for ICS20 fungible tokens and the + * source tracing information path. + */ +/** @deprecated */ +export interface DenomTrace { + /** + * path defines the chain of port/channel identifiers used for tracing the + * source of the fungible token. + */ + path: string; + /** base denomination of the relayed fungible token. */ + baseDenom: string; +} +function createBaseDenomTrace(): DenomTrace { + return { + path: "", + baseDenom: "", + }; +} +export const DenomTrace = { + encode(message: DenomTrace, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.path !== "") { + writer.uint32(10).string(message.path); + } + if (message.baseDenom !== "") { + writer.uint32(18).string(message.baseDenom); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): DenomTrace { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDenomTrace(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.path = reader.string(); + break; + case 2: + message.baseDenom = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): DenomTrace { + const obj = createBaseDenomTrace(); + if (isSet(object.path)) obj.path = String(object.path); + if (isSet(object.baseDenom)) obj.baseDenom = String(object.baseDenom); + return obj; + }, + toJSON(message: DenomTrace): unknown { + const obj: any = {}; + message.path !== undefined && (obj.path = message.path); + message.baseDenom !== undefined && (obj.baseDenom = message.baseDenom); + return obj; + }, + fromPartial(object: Partial): DenomTrace { + const message = createBaseDenomTrace(); + message.path = object.path ?? ""; + message.baseDenom = object.baseDenom ?? ""; + return message; + }, +}; diff --git a/src/ibc/applications/transfer/v1/genesis.ts b/src/ibc/applications/transfer/v1/genesis.ts index bb8d087..deb2798 100644 --- a/src/ibc/applications/transfer/v1/genesis.ts +++ b/src/ibc/applications/transfer/v1/genesis.ts @@ -1,5 +1,6 @@ /* eslint-disable */ -import { DenomTrace, Params } from "./transfer"; +import { Denom } from "./token"; +import { Params } from "./transfer"; import { Coin } from "../../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../../binary"; import { isSet } from "../../../../helpers"; @@ -7,7 +8,7 @@ export const protobufPackage = "ibc.applications.transfer.v1"; /** GenesisState defines the ibc-transfer genesis state */ export interface GenesisState { portId: string; - denomTraces: DenomTrace[]; + denoms: Denom[]; params: Params; /** * total_escrowed contains the total amount of tokens escrowed @@ -18,7 +19,7 @@ export interface GenesisState { function createBaseGenesisState(): GenesisState { return { portId: "", - denomTraces: [], + denoms: [], params: Params.fromPartial({}), totalEscrowed: [], }; @@ -28,8 +29,8 @@ export const GenesisState = { if (message.portId !== "") { writer.uint32(10).string(message.portId); } - for (const v of message.denomTraces) { - DenomTrace.encode(v!, writer.uint32(18).fork()).ldelim(); + for (const v of message.denoms) { + Denom.encode(v!, writer.uint32(18).fork()).ldelim(); } if (message.params !== undefined) { Params.encode(message.params, writer.uint32(26).fork()).ldelim(); @@ -50,7 +51,7 @@ export const GenesisState = { message.portId = reader.string(); break; case 2: - message.denomTraces.push(DenomTrace.decode(reader, reader.uint32())); + message.denoms.push(Denom.decode(reader, reader.uint32())); break; case 3: message.params = Params.decode(reader, reader.uint32()); @@ -68,8 +69,7 @@ export const GenesisState = { fromJSON(object: any): GenesisState { const obj = createBaseGenesisState(); if (isSet(object.portId)) obj.portId = String(object.portId); - if (Array.isArray(object?.denomTraces)) - obj.denomTraces = object.denomTraces.map((e: any) => DenomTrace.fromJSON(e)); + if (Array.isArray(object?.denoms)) obj.denoms = object.denoms.map((e: any) => Denom.fromJSON(e)); if (isSet(object.params)) obj.params = Params.fromJSON(object.params); if (Array.isArray(object?.totalEscrowed)) obj.totalEscrowed = object.totalEscrowed.map((e: any) => Coin.fromJSON(e)); @@ -78,10 +78,10 @@ export const GenesisState = { toJSON(message: GenesisState): unknown { const obj: any = {}; message.portId !== undefined && (obj.portId = message.portId); - if (message.denomTraces) { - obj.denomTraces = message.denomTraces.map((e) => (e ? DenomTrace.toJSON(e) : undefined)); + if (message.denoms) { + obj.denoms = message.denoms.map((e) => (e ? Denom.toJSON(e) : undefined)); } else { - obj.denomTraces = []; + obj.denoms = []; } message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); if (message.totalEscrowed) { @@ -94,7 +94,7 @@ export const GenesisState = { fromPartial(object: Partial): GenesisState { const message = createBaseGenesisState(); message.portId = object.portId ?? ""; - message.denomTraces = object.denomTraces?.map((e) => DenomTrace.fromPartial(e)) || []; + message.denoms = object.denoms?.map((e) => Denom.fromPartial(e)) || []; if (object.params !== undefined && object.params !== null) { message.params = Params.fromPartial(object.params); } diff --git a/src/ibc/applications/transfer/v2/packet.ts b/src/ibc/applications/transfer/v1/packet.ts similarity index 98% rename from src/ibc/applications/transfer/v2/packet.ts rename to src/ibc/applications/transfer/v1/packet.ts index 04a0802..daa4910 100644 --- a/src/ibc/applications/transfer/v2/packet.ts +++ b/src/ibc/applications/transfer/v1/packet.ts @@ -1,7 +1,7 @@ /* eslint-disable */ import { BinaryReader, BinaryWriter } from "../../../../binary"; import { isSet } from "../../../../helpers"; -export const protobufPackage = "ibc.applications.transfer.v2"; +export const protobufPackage = "ibc.applications.transfer.v1"; /** * FungibleTokenPacketData defines a struct for the packet payload * See FungibleTokenPacketData spec: diff --git a/src/ibc/applications/transfer/v1/query.ts b/src/ibc/applications/transfer/v1/query.ts index cde9c08..38e3103 100644 --- a/src/ibc/applications/transfer/v1/query.ts +++ b/src/ibc/applications/transfer/v1/query.ts @@ -1,51 +1,52 @@ /* eslint-disable */ import { PageRequest, PageResponse } from "../../../../cosmos/base/query/v1beta1/pagination"; -import { DenomTrace, Params } from "./transfer"; +import { Params } from "./transfer"; +import { Denom } from "./token"; import { Coin } from "../../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../../binary"; import { isSet, Rpc } from "../../../../helpers"; export const protobufPackage = "ibc.applications.transfer.v1"; +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequest {} +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponse { + /** params defines the parameters of the module. */ + params: Params; +} /** - * QueryDenomTraceRequest is the request type for the Query/DenomTrace RPC + * QueryDenomRequest is the request type for the Query/Denom RPC * method */ -export interface QueryDenomTraceRequest { - /** hash (in hex format) or denom (full denom with ibc prefix) of the denomination trace information. */ +export interface QueryDenomRequest { + /** hash (in hex format) or denom (full denom with ibc prefix) of the on chain denomination. */ hash: string; } /** - * QueryDenomTraceResponse is the response type for the Query/DenomTrace RPC + * QueryDenomResponse is the response type for the Query/Denom RPC * method. */ -export interface QueryDenomTraceResponse { - /** denom_trace returns the requested denomination trace information. */ - denomTrace: DenomTrace; +export interface QueryDenomResponse { + /** denom returns the requested denomination. */ + denom: Denom; } /** - * QueryConnectionsRequest is the request type for the Query/DenomTraces RPC + * QueryDenomsRequest is the request type for the Query/Denoms RPC * method */ -export interface QueryDenomTracesRequest { +export interface QueryDenomsRequest { /** pagination defines an optional pagination for the request. */ pagination: PageRequest; } /** - * QueryConnectionsResponse is the response type for the Query/DenomTraces RPC + * QueryDenomsResponse is the response type for the Query/Denoms RPC * method. */ -export interface QueryDenomTracesResponse { - /** denom_traces returns all denominations trace information. */ - denomTraces: DenomTrace[]; +export interface QueryDenomsResponse { + /** denoms returns all denominations. */ + denoms: Denom[]; /** pagination defines the pagination in the response. */ pagination: PageResponse; } -/** QueryParamsRequest is the request type for the Query/Params RPC method. */ -export interface QueryParamsRequest {} -/** QueryParamsResponse is the response type for the Query/Params RPC method. */ -export interface QueryParamsResponse { - /** params defines the parameters of the module. */ - params: Params; -} /** * QueryDenomHashRequest is the request type for the Query/DenomHash RPC * method @@ -82,28 +83,20 @@ export interface QueryTotalEscrowForDenomRequest { export interface QueryTotalEscrowForDenomResponse { amount: Coin; } -function createBaseQueryDenomTraceRequest(): QueryDenomTraceRequest { - return { - hash: "", - }; +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; } -export const QueryDenomTraceRequest = { - encode(message: QueryDenomTraceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.hash !== "") { - writer.uint32(10).string(message.hash); - } +export const QueryParamsRequest = { + encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomTraceRequest { + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryDenomTraceRequest(); + const message = createBaseQueryParamsRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.hash = reader.string(); - break; default: reader.skipType(tag & 7); break; @@ -111,43 +104,40 @@ export const QueryDenomTraceRequest = { } return message; }, - fromJSON(object: any): QueryDenomTraceRequest { - const obj = createBaseQueryDenomTraceRequest(); - if (isSet(object.hash)) obj.hash = String(object.hash); + fromJSON(_: any): QueryParamsRequest { + const obj = createBaseQueryParamsRequest(); return obj; }, - toJSON(message: QueryDenomTraceRequest): unknown { + toJSON(_: QueryParamsRequest): unknown { const obj: any = {}; - message.hash !== undefined && (obj.hash = message.hash); return obj; }, - fromPartial(object: Partial): QueryDenomTraceRequest { - const message = createBaseQueryDenomTraceRequest(); - message.hash = object.hash ?? ""; + fromPartial(_: Partial): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); return message; }, }; -function createBaseQueryDenomTraceResponse(): QueryDenomTraceResponse { +function createBaseQueryParamsResponse(): QueryParamsResponse { return { - denomTrace: DenomTrace.fromPartial({}), + params: Params.fromPartial({}), }; } -export const QueryDenomTraceResponse = { - encode(message: QueryDenomTraceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.denomTrace !== undefined) { - DenomTrace.encode(message.denomTrace, writer.uint32(10).fork()).ldelim(); +export const QueryParamsResponse = { + encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); } return writer; }, - decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomTraceResponse { + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryDenomTraceResponse(); + const message = createBaseQueryParamsResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.denomTrace = DenomTrace.decode(reader, reader.uint32()); + message.params = Params.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -156,46 +146,45 @@ export const QueryDenomTraceResponse = { } return message; }, - fromJSON(object: any): QueryDenomTraceResponse { - const obj = createBaseQueryDenomTraceResponse(); - if (isSet(object.denomTrace)) obj.denomTrace = DenomTrace.fromJSON(object.denomTrace); + fromJSON(object: any): QueryParamsResponse { + const obj = createBaseQueryParamsResponse(); + if (isSet(object.params)) obj.params = Params.fromJSON(object.params); return obj; }, - toJSON(message: QueryDenomTraceResponse): unknown { + toJSON(message: QueryParamsResponse): unknown { const obj: any = {}; - message.denomTrace !== undefined && - (obj.denomTrace = message.denomTrace ? DenomTrace.toJSON(message.denomTrace) : undefined); + message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); return obj; }, - fromPartial(object: Partial): QueryDenomTraceResponse { - const message = createBaseQueryDenomTraceResponse(); - if (object.denomTrace !== undefined && object.denomTrace !== null) { - message.denomTrace = DenomTrace.fromPartial(object.denomTrace); + fromPartial(object: Partial): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromPartial(object.params); } return message; }, }; -function createBaseQueryDenomTracesRequest(): QueryDenomTracesRequest { +function createBaseQueryDenomRequest(): QueryDenomRequest { return { - pagination: PageRequest.fromPartial({}), + hash: "", }; } -export const QueryDenomTracesRequest = { - encode(message: QueryDenomTracesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.pagination !== undefined) { - PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); +export const QueryDenomRequest = { + encode(message: QueryDenomRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.hash !== "") { + writer.uint32(10).string(message.hash); } return writer; }, - decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomTracesRequest { + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomRequest { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryDenomTracesRequest(); + const message = createBaseQueryDenomRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.pagination = PageRequest.decode(reader, reader.uint32()); + message.hash = reader.string(); break; default: reader.skipType(tag & 7); @@ -204,53 +193,43 @@ export const QueryDenomTracesRequest = { } return message; }, - fromJSON(object: any): QueryDenomTracesRequest { - const obj = createBaseQueryDenomTracesRequest(); - if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); + fromJSON(object: any): QueryDenomRequest { + const obj = createBaseQueryDenomRequest(); + if (isSet(object.hash)) obj.hash = String(object.hash); return obj; }, - toJSON(message: QueryDenomTracesRequest): unknown { + toJSON(message: QueryDenomRequest): unknown { const obj: any = {}; - message.pagination !== undefined && - (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + message.hash !== undefined && (obj.hash = message.hash); return obj; }, - fromPartial(object: Partial): QueryDenomTracesRequest { - const message = createBaseQueryDenomTracesRequest(); - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageRequest.fromPartial(object.pagination); - } + fromPartial(object: Partial): QueryDenomRequest { + const message = createBaseQueryDenomRequest(); + message.hash = object.hash ?? ""; return message; }, }; -function createBaseQueryDenomTracesResponse(): QueryDenomTracesResponse { +function createBaseQueryDenomResponse(): QueryDenomResponse { return { - denomTraces: [], - pagination: PageResponse.fromPartial({}), + denom: Denom.fromPartial({}), }; } -export const QueryDenomTracesResponse = { - encode(message: QueryDenomTracesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - for (const v of message.denomTraces) { - DenomTrace.encode(v!, writer.uint32(10).fork()).ldelim(); - } - if (message.pagination !== undefined) { - PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); +export const QueryDenomResponse = { + encode(message: QueryDenomResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.denom !== undefined) { + Denom.encode(message.denom, writer.uint32(10).fork()).ldelim(); } return writer; }, - decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomTracesResponse { + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomResponse { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryDenomTracesResponse(); + const message = createBaseQueryDenomResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.denomTraces.push(DenomTrace.decode(reader, reader.uint32())); - break; - case 2: - message.pagination = PageResponse.decode(reader, reader.uint32()); + message.denom = Denom.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -259,47 +238,46 @@ export const QueryDenomTracesResponse = { } return message; }, - fromJSON(object: any): QueryDenomTracesResponse { - const obj = createBaseQueryDenomTracesResponse(); - if (Array.isArray(object?.denomTraces)) - obj.denomTraces = object.denomTraces.map((e: any) => DenomTrace.fromJSON(e)); - if (isSet(object.pagination)) obj.pagination = PageResponse.fromJSON(object.pagination); + fromJSON(object: any): QueryDenomResponse { + const obj = createBaseQueryDenomResponse(); + if (isSet(object.denom)) obj.denom = Denom.fromJSON(object.denom); return obj; }, - toJSON(message: QueryDenomTracesResponse): unknown { + toJSON(message: QueryDenomResponse): unknown { const obj: any = {}; - if (message.denomTraces) { - obj.denomTraces = message.denomTraces.map((e) => (e ? DenomTrace.toJSON(e) : undefined)); - } else { - obj.denomTraces = []; - } - message.pagination !== undefined && - (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + message.denom !== undefined && (obj.denom = message.denom ? Denom.toJSON(message.denom) : undefined); return obj; }, - fromPartial(object: Partial): QueryDenomTracesResponse { - const message = createBaseQueryDenomTracesResponse(); - message.denomTraces = object.denomTraces?.map((e) => DenomTrace.fromPartial(e)) || []; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageResponse.fromPartial(object.pagination); + fromPartial(object: Partial): QueryDenomResponse { + const message = createBaseQueryDenomResponse(); + if (object.denom !== undefined && object.denom !== null) { + message.denom = Denom.fromPartial(object.denom); } return message; }, }; -function createBaseQueryParamsRequest(): QueryParamsRequest { - return {}; +function createBaseQueryDenomsRequest(): QueryDenomsRequest { + return { + pagination: PageRequest.fromPartial({}), + }; } -export const QueryParamsRequest = { - encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { +export const QueryDenomsRequest = { + encode(message: QueryDenomsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } return writer; }, - decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomsRequest { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryParamsRequest(); + const message = createBaseQueryDenomsRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 1: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; default: reader.skipType(tag & 7); break; @@ -307,40 +285,53 @@ export const QueryParamsRequest = { } return message; }, - fromJSON(_: any): QueryParamsRequest { - const obj = createBaseQueryParamsRequest(); + fromJSON(object: any): QueryDenomsRequest { + const obj = createBaseQueryDenomsRequest(); + if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); return obj; }, - toJSON(_: QueryParamsRequest): unknown { + toJSON(message: QueryDenomsRequest): unknown { const obj: any = {}; + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); return obj; }, - fromPartial(_: Partial): QueryParamsRequest { - const message = createBaseQueryParamsRequest(); + fromPartial(object: Partial): QueryDenomsRequest { + const message = createBaseQueryDenomsRequest(); + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromPartial(object.pagination); + } return message; }, }; -function createBaseQueryParamsResponse(): QueryParamsResponse { +function createBaseQueryDenomsResponse(): QueryDenomsResponse { return { - params: Params.fromPartial({}), + denoms: [], + pagination: PageResponse.fromPartial({}), }; } -export const QueryParamsResponse = { - encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.params !== undefined) { - Params.encode(message.params, writer.uint32(10).fork()).ldelim(); +export const QueryDenomsResponse = { + encode(message: QueryDenomsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.denoms) { + Denom.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } return writer; }, - decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomsResponse { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryParamsResponse(); + const message = createBaseQueryDenomsResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.params = Params.decode(reader, reader.uint32()); + message.denoms.push(Denom.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -349,20 +340,28 @@ export const QueryParamsResponse = { } return message; }, - fromJSON(object: any): QueryParamsResponse { - const obj = createBaseQueryParamsResponse(); - if (isSet(object.params)) obj.params = Params.fromJSON(object.params); + fromJSON(object: any): QueryDenomsResponse { + const obj = createBaseQueryDenomsResponse(); + if (Array.isArray(object?.denoms)) obj.denoms = object.denoms.map((e: any) => Denom.fromJSON(e)); + if (isSet(object.pagination)) obj.pagination = PageResponse.fromJSON(object.pagination); return obj; }, - toJSON(message: QueryParamsResponse): unknown { + toJSON(message: QueryDenomsResponse): unknown { const obj: any = {}; - message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + if (message.denoms) { + obj.denoms = message.denoms.map((e) => (e ? Denom.toJSON(e) : undefined)); + } else { + obj.denoms = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); return obj; }, - fromPartial(object: Partial): QueryParamsResponse { - const message = createBaseQueryParamsResponse(); - if (object.params !== undefined && object.params !== null) { - message.params = Params.fromPartial(object.params); + fromPartial(object: Partial): QueryDenomsResponse { + const message = createBaseQueryDenomsResponse(); + message.denoms = object.denoms?.map((e) => Denom.fromPartial(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromPartial(object.pagination); } return message; }, @@ -657,12 +656,12 @@ export const QueryTotalEscrowForDenomResponse = { }; /** Query provides defines the gRPC querier service. */ export interface Query { - /** DenomTrace queries a denomination trace information. */ - DenomTrace(request: QueryDenomTraceRequest): Promise; - /** DenomTraces queries all denomination traces. */ - DenomTraces(request?: QueryDenomTracesRequest): Promise; /** Params queries all parameters of the ibc-transfer module. */ Params(request?: QueryParamsRequest): Promise; + /** Denoms queries all denominations */ + Denoms(request?: QueryDenomsRequest): Promise; + /** Denom queries a denomination */ + Denom(request: QueryDenomRequest): Promise; /** DenomHash queries a denomination hash information. */ DenomHash(request: QueryDenomHashRequest): Promise; /** EscrowAddress returns the escrow address for a particular port and channel id. */ @@ -674,32 +673,32 @@ export class QueryClientImpl implements Query { private readonly rpc: Rpc; constructor(rpc: Rpc) { this.rpc = rpc; - this.DenomTrace = this.DenomTrace.bind(this); - this.DenomTraces = this.DenomTraces.bind(this); this.Params = this.Params.bind(this); + this.Denoms = this.Denoms.bind(this); + this.Denom = this.Denom.bind(this); this.DenomHash = this.DenomHash.bind(this); this.EscrowAddress = this.EscrowAddress.bind(this); this.TotalEscrowForDenom = this.TotalEscrowForDenom.bind(this); } - DenomTrace(request: QueryDenomTraceRequest): Promise { - const data = QueryDenomTraceRequest.encode(request).finish(); - const promise = this.rpc.request("ibc.applications.transfer.v1.Query", "DenomTrace", data); - return promise.then((data) => QueryDenomTraceResponse.decode(new BinaryReader(data))); - } - DenomTraces( - request: QueryDenomTracesRequest = { - pagination: PageRequest.fromPartial({}), - }, - ): Promise { - const data = QueryDenomTracesRequest.encode(request).finish(); - const promise = this.rpc.request("ibc.applications.transfer.v1.Query", "DenomTraces", data); - return promise.then((data) => QueryDenomTracesResponse.decode(new BinaryReader(data))); - } Params(request: QueryParamsRequest = {}): Promise { const data = QueryParamsRequest.encode(request).finish(); const promise = this.rpc.request("ibc.applications.transfer.v1.Query", "Params", data); return promise.then((data) => QueryParamsResponse.decode(new BinaryReader(data))); } + Denoms( + request: QueryDenomsRequest = { + pagination: PageRequest.fromPartial({}), + }, + ): Promise { + const data = QueryDenomsRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.applications.transfer.v1.Query", "Denoms", data); + return promise.then((data) => QueryDenomsResponse.decode(new BinaryReader(data))); + } + Denom(request: QueryDenomRequest): Promise { + const data = QueryDenomRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.applications.transfer.v1.Query", "Denom", data); + return promise.then((data) => QueryDenomResponse.decode(new BinaryReader(data))); + } DenomHash(request: QueryDenomHashRequest): Promise { const data = QueryDenomHashRequest.encode(request).finish(); const promise = this.rpc.request("ibc.applications.transfer.v1.Query", "DenomHash", data); diff --git a/src/ibc/applications/transfer/v1/token.ts b/src/ibc/applications/transfer/v1/token.ts new file mode 100644 index 0000000..a433709 --- /dev/null +++ b/src/ibc/applications/transfer/v1/token.ts @@ -0,0 +1,135 @@ +/* eslint-disable */ +import { Hop } from "./transfer"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { isSet } from "../../../../helpers"; +export const protobufPackage = "ibc.applications.transfer.v1"; +/** Token defines a struct which represents a token to be transferred. */ +export interface Token { + /** the token denomination */ + denom: Denom; + /** the token amount to be transferred */ + amount: string; +} +/** Denom holds the base denom of a Token and a trace of the chains it was sent through. */ +export interface Denom { + /** the base token denomination */ + base: string; + /** the trace of the token */ + trace: Hop[]; +} +function createBaseToken(): Token { + return { + denom: Denom.fromPartial({}), + amount: "", + }; +} +export const Token = { + encode(message: Token, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.denom !== undefined) { + Denom.encode(message.denom, writer.uint32(10).fork()).ldelim(); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Token { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseToken(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.denom = Denom.decode(reader, reader.uint32()); + break; + case 2: + message.amount = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): Token { + const obj = createBaseToken(); + if (isSet(object.denom)) obj.denom = Denom.fromJSON(object.denom); + if (isSet(object.amount)) obj.amount = String(object.amount); + return obj; + }, + toJSON(message: Token): unknown { + const obj: any = {}; + message.denom !== undefined && (obj.denom = message.denom ? Denom.toJSON(message.denom) : undefined); + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + fromPartial(object: Partial): Token { + const message = createBaseToken(); + if (object.denom !== undefined && object.denom !== null) { + message.denom = Denom.fromPartial(object.denom); + } + message.amount = object.amount ?? ""; + return message; + }, +}; +function createBaseDenom(): Denom { + return { + base: "", + trace: [], + }; +} +export const Denom = { + encode(message: Denom, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.base !== "") { + writer.uint32(10).string(message.base); + } + for (const v of message.trace) { + Hop.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Denom { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDenom(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.base = reader.string(); + break; + case 3: + message.trace.push(Hop.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): Denom { + const obj = createBaseDenom(); + if (isSet(object.base)) obj.base = String(object.base); + if (Array.isArray(object?.trace)) obj.trace = object.trace.map((e: any) => Hop.fromJSON(e)); + return obj; + }, + toJSON(message: Denom): unknown { + const obj: any = {}; + message.base !== undefined && (obj.base = message.base); + if (message.trace) { + obj.trace = message.trace.map((e) => (e ? Hop.toJSON(e) : undefined)); + } else { + obj.trace = []; + } + return obj; + }, + fromPartial(object: Partial): Denom { + const message = createBaseDenom(); + message.base = object.base ?? ""; + message.trace = object.trace?.map((e) => Hop.fromPartial(e)) || []; + return message; + }, +}; diff --git a/src/ibc/applications/transfer/v1/transfer.ts b/src/ibc/applications/transfer/v1/transfer.ts index 42646bb..8abae71 100644 --- a/src/ibc/applications/transfer/v1/transfer.ts +++ b/src/ibc/applications/transfer/v1/transfer.ts @@ -2,19 +2,6 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; import { isSet } from "../../../../helpers"; export const protobufPackage = "ibc.applications.transfer.v1"; -/** - * DenomTrace contains the base denomination for ICS20 fungible tokens and the - * source tracing information path. - */ -export interface DenomTrace { - /** - * path defines the chain of port/channel identifiers used for tracing the - * source of the fungible token. - */ - path: string; - /** base denomination of the relayed fungible token. */ - baseDenom: string; -} /** * Params defines the set of IBC transfer parameters. * NOTE: To prevent a single token from being transferred, set the @@ -33,34 +20,42 @@ export interface Params { */ receiveEnabled: boolean; } -function createBaseDenomTrace(): DenomTrace { +/** + * Hop defines a port ID, channel ID pair specifying where tokens must be forwarded + * next in a multihop transfer. + */ +export interface Hop { + portId: string; + channelId: string; +} +function createBaseParams(): Params { return { - path: "", - baseDenom: "", + sendEnabled: false, + receiveEnabled: false, }; } -export const DenomTrace = { - encode(message: DenomTrace, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.path !== "") { - writer.uint32(10).string(message.path); +export const Params = { + encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.sendEnabled === true) { + writer.uint32(8).bool(message.sendEnabled); } - if (message.baseDenom !== "") { - writer.uint32(18).string(message.baseDenom); + if (message.receiveEnabled === true) { + writer.uint32(16).bool(message.receiveEnabled); } return writer; }, - decode(input: BinaryReader | Uint8Array, length?: number): DenomTrace { + decode(input: BinaryReader | Uint8Array, length?: number): Params { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseDenomTrace(); + const message = createBaseParams(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.path = reader.string(); + message.sendEnabled = reader.bool(); break; case 2: - message.baseDenom = reader.string(); + message.receiveEnabled = reader.bool(); break; default: reader.skipType(tag & 7); @@ -69,53 +64,53 @@ export const DenomTrace = { } return message; }, - fromJSON(object: any): DenomTrace { - const obj = createBaseDenomTrace(); - if (isSet(object.path)) obj.path = String(object.path); - if (isSet(object.baseDenom)) obj.baseDenom = String(object.baseDenom); + fromJSON(object: any): Params { + const obj = createBaseParams(); + if (isSet(object.sendEnabled)) obj.sendEnabled = Boolean(object.sendEnabled); + if (isSet(object.receiveEnabled)) obj.receiveEnabled = Boolean(object.receiveEnabled); return obj; }, - toJSON(message: DenomTrace): unknown { + toJSON(message: Params): unknown { const obj: any = {}; - message.path !== undefined && (obj.path = message.path); - message.baseDenom !== undefined && (obj.baseDenom = message.baseDenom); + message.sendEnabled !== undefined && (obj.sendEnabled = message.sendEnabled); + message.receiveEnabled !== undefined && (obj.receiveEnabled = message.receiveEnabled); return obj; }, - fromPartial(object: Partial): DenomTrace { - const message = createBaseDenomTrace(); - message.path = object.path ?? ""; - message.baseDenom = object.baseDenom ?? ""; + fromPartial(object: Partial): Params { + const message = createBaseParams(); + message.sendEnabled = object.sendEnabled ?? false; + message.receiveEnabled = object.receiveEnabled ?? false; return message; }, }; -function createBaseParams(): Params { +function createBaseHop(): Hop { return { - sendEnabled: false, - receiveEnabled: false, + portId: "", + channelId: "", }; } -export const Params = { - encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.sendEnabled === true) { - writer.uint32(8).bool(message.sendEnabled); +export const Hop = { + encode(message: Hop, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); } - if (message.receiveEnabled === true) { - writer.uint32(16).bool(message.receiveEnabled); + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); } return writer; }, - decode(input: BinaryReader | Uint8Array, length?: number): Params { + decode(input: BinaryReader | Uint8Array, length?: number): Hop { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseParams(); + const message = createBaseHop(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.sendEnabled = reader.bool(); + message.portId = reader.string(); break; case 2: - message.receiveEnabled = reader.bool(); + message.channelId = reader.string(); break; default: reader.skipType(tag & 7); @@ -124,22 +119,22 @@ export const Params = { } return message; }, - fromJSON(object: any): Params { - const obj = createBaseParams(); - if (isSet(object.sendEnabled)) obj.sendEnabled = Boolean(object.sendEnabled); - if (isSet(object.receiveEnabled)) obj.receiveEnabled = Boolean(object.receiveEnabled); + fromJSON(object: any): Hop { + const obj = createBaseHop(); + if (isSet(object.portId)) obj.portId = String(object.portId); + if (isSet(object.channelId)) obj.channelId = String(object.channelId); return obj; }, - toJSON(message: Params): unknown { + toJSON(message: Hop): unknown { const obj: any = {}; - message.sendEnabled !== undefined && (obj.sendEnabled = message.sendEnabled); - message.receiveEnabled !== undefined && (obj.receiveEnabled = message.receiveEnabled); + message.portId !== undefined && (obj.portId = message.portId); + message.channelId !== undefined && (obj.channelId = message.channelId); return obj; }, - fromPartial(object: Partial): Params { - const message = createBaseParams(); - message.sendEnabled = object.sendEnabled ?? false; - message.receiveEnabled = object.receiveEnabled ?? false; + fromPartial(object: Partial): Hop { + const message = createBaseHop(); + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; return message; }, }; diff --git a/src/ibc/applications/transfer/v1/tx.amino.ts b/src/ibc/applications/transfer/v1/tx.amino.ts index 0d62c76..1111bfc 100644 --- a/src/ibc/applications/transfer/v1/tx.amino.ts +++ b/src/ibc/applications/transfer/v1/tx.amino.ts @@ -1,7 +1,7 @@ /* eslint-disable */ import { AminoMsg } from "@cosmjs/amino"; import { AminoHeight, omitDefault } from "../../../../helpers"; -import { MsgTransfer } from "./tx"; +import { MsgTransfer, MsgUpdateParams } from "./tx"; export interface MsgTransferAminoType extends AminoMsg { type: "cosmos-sdk/MsgTransfer"; value: { @@ -16,6 +16,16 @@ export interface MsgTransferAminoType extends AminoMsg { timeout_height: AminoHeight; timeout_timestamp: string; memo: string; + encoding: string; + }; +} +export interface MsgUpdateParamsAminoType extends AminoMsg { + type: "cosmos-sdk/MsgUpdateParams"; + value: { + signer: string; + params: { + allowed_clients: string[]; + }; }; } export const AminoConverter = { @@ -30,6 +40,7 @@ export const AminoConverter = { timeoutHeight, timeoutTimestamp, memo, + encoding, }: MsgTransfer): MsgTransferAminoType["value"] => { return { source_port: sourcePort, @@ -48,6 +59,7 @@ export const AminoConverter = { : {}, timeout_timestamp: timeoutTimestamp.toString(), memo, + encoding, }; }, fromAmino: ({ @@ -59,6 +71,7 @@ export const AminoConverter = { timeout_height, timeout_timestamp, memo, + encoding, }: MsgTransferAminoType["value"]): MsgTransfer => { return { sourcePort: source_port, @@ -77,6 +90,26 @@ export const AminoConverter = { : undefined, timeoutTimestamp: BigInt(timeout_timestamp), memo, + encoding, + }; + }, + }, + "/ibc.applications.transfer.v1.MsgUpdateParams": { + aminoType: "cosmos-sdk/MsgUpdateParams", + toAmino: ({ signer, params }: MsgUpdateParams): MsgUpdateParamsAminoType["value"] => { + return { + signer, + params: { + allowed_clients: params.allowedClients, + }, + }; + }, + fromAmino: ({ signer, params }: MsgUpdateParamsAminoType["value"]): MsgUpdateParams => { + return { + signer, + params: { + allowedClients: params.allowed_clients, + }, }; }, }, diff --git a/src/ibc/applications/transfer/v1/tx.registry.ts b/src/ibc/applications/transfer/v1/tx.registry.ts index 1b7b41b..6620958 100644 --- a/src/ibc/applications/transfer/v1/tx.registry.ts +++ b/src/ibc/applications/transfer/v1/tx.registry.ts @@ -1,9 +1,10 @@ //@ts-nocheck /* eslint-disable */ import { GeneratedType, Registry } from "@cosmjs/proto-signing"; -import { MsgTransfer } from "./tx"; +import { MsgTransfer, MsgUpdateParams } from "./tx"; export const registry: ReadonlyArray<[string, GeneratedType]> = [ ["/ibc.applications.transfer.v1.MsgTransfer", MsgTransfer], + ["/ibc.applications.transfer.v1.MsgUpdateParams", MsgUpdateParams], ]; export const load = (protoRegistry: Registry) => { registry.forEach(([typeUrl, mod]) => { @@ -18,6 +19,12 @@ export const MessageComposer = { value: MsgTransfer.encode(value).finish(), }; }, + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/ibc.applications.transfer.v1.MsgUpdateParams", + value: MsgUpdateParams.encode(value).finish(), + }; + }, }, withTypeUrl: { transfer(value: MsgTransfer) { @@ -26,6 +33,12 @@ export const MessageComposer = { value, }; }, + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/ibc.applications.transfer.v1.MsgUpdateParams", + value, + }; + }, }, toJSON: { transfer(value: MsgTransfer) { @@ -34,6 +47,12 @@ export const MessageComposer = { value: MsgTransfer.toJSON(value), }; }, + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/ibc.applications.transfer.v1.MsgUpdateParams", + value: MsgUpdateParams.toJSON(value), + }; + }, }, fromJSON: { transfer(value: any) { @@ -42,6 +61,12 @@ export const MessageComposer = { value: MsgTransfer.fromJSON(value), }; }, + updateParams(value: any) { + return { + typeUrl: "/ibc.applications.transfer.v1.MsgUpdateParams", + value: MsgUpdateParams.fromJSON(value), + }; + }, }, fromPartial: { transfer(value: MsgTransfer) { @@ -50,5 +75,11 @@ export const MessageComposer = { value: MsgTransfer.fromPartial(value), }; }, + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/ibc.applications.transfer.v1.MsgUpdateParams", + value: MsgUpdateParams.fromPartial(value), + }; + }, }, }; diff --git a/src/ibc/applications/transfer/v1/tx.ts b/src/ibc/applications/transfer/v1/tx.ts index 08e8421..cc65897 100644 --- a/src/ibc/applications/transfer/v1/tx.ts +++ b/src/ibc/applications/transfer/v1/tx.ts @@ -1,6 +1,6 @@ /* eslint-disable */ import { Coin } from "../../../../cosmos/base/v1beta1/coin"; -import { Height } from "../../../core/client/v1/client"; +import { Height, Params } from "../../../core/client/v1/client"; import { BinaryReader, BinaryWriter } from "../../../../binary"; import { isSet, Rpc } from "../../../../helpers"; export const protobufPackage = "ibc.applications.transfer.v1"; @@ -14,7 +14,7 @@ export interface MsgTransfer { sourcePort: string; /** the channel by which the packet will be sent */ sourceChannel: string; - /** the tokens to be transferred */ + /** token to be transferred */ token: Coin; /** the sender address */ sender: string; @@ -22,22 +22,42 @@ export interface MsgTransfer { receiver: string; /** * Timeout height relative to the current block height. - * The timeout is disabled when set to 0. + * If you are sending with IBC v1 protocol, either timeout_height or timeout_timestamp must be set. + * If you are sending with IBC v2 protocol, timeout_timestamp must be set, and timeout_height must be omitted. */ timeoutHeight: Height; /** * Timeout timestamp in absolute nanoseconds since unix epoch. - * The timeout is disabled when set to 0. + * If you are sending with IBC v1 protocol, either timeout_height or timeout_timestamp must be set. + * If you are sending with IBC v2 protocol, timeout_timestamp must be set. */ timeoutTimestamp: bigint; /** optional memo */ memo: string; + /** optional encoding */ + encoding: string; } /** MsgTransferResponse defines the Msg/Transfer response type. */ export interface MsgTransferResponse { /** sequence number of the transfer packet sent */ sequence: bigint; } +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** signer address */ + signer: string; + /** + * params defines the transfer parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponse {} function createBaseMsgTransfer(): MsgTransfer { return { sourcePort: "", @@ -48,6 +68,7 @@ function createBaseMsgTransfer(): MsgTransfer { timeoutHeight: Height.fromPartial({}), timeoutTimestamp: BigInt(0), memo: "", + encoding: "", }; } export const MsgTransfer = { @@ -76,6 +97,9 @@ export const MsgTransfer = { if (message.memo !== "") { writer.uint32(66).string(message.memo); } + if (message.encoding !== "") { + writer.uint32(74).string(message.encoding); + } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): MsgTransfer { @@ -109,6 +133,9 @@ export const MsgTransfer = { case 8: message.memo = reader.string(); break; + case 9: + message.encoding = reader.string(); + break; default: reader.skipType(tag & 7); break; @@ -126,6 +153,7 @@ export const MsgTransfer = { if (isSet(object.timeoutHeight)) obj.timeoutHeight = Height.fromJSON(object.timeoutHeight); if (isSet(object.timeoutTimestamp)) obj.timeoutTimestamp = BigInt(object.timeoutTimestamp.toString()); if (isSet(object.memo)) obj.memo = String(object.memo); + if (isSet(object.encoding)) obj.encoding = String(object.encoding); return obj; }, toJSON(message: MsgTransfer): unknown { @@ -140,6 +168,7 @@ export const MsgTransfer = { message.timeoutTimestamp !== undefined && (obj.timeoutTimestamp = (message.timeoutTimestamp || BigInt(0)).toString()); message.memo !== undefined && (obj.memo = message.memo); + message.encoding !== undefined && (obj.encoding = message.encoding); return obj; }, fromPartial(object: Partial): MsgTransfer { @@ -158,6 +187,7 @@ export const MsgTransfer = { message.timeoutTimestamp = BigInt(object.timeoutTimestamp.toString()); } message.memo = object.memo ?? ""; + message.encoding = object.encoding ?? ""; return message; }, }; @@ -208,20 +238,119 @@ export const MsgTransferResponse = { return message; }, }; +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { + signer: "", + params: Params.fromPartial({}), + }; +} +export const MsgUpdateParams = { + encode(message: MsgUpdateParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.signer !== "") { + writer.uint32(10).string(message.signer); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.signer = reader.string(); + break; + case 2: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgUpdateParams { + const obj = createBaseMsgUpdateParams(); + if (isSet(object.signer)) obj.signer = String(object.signer); + if (isSet(object.params)) obj.params = Params.fromJSON(object.params); + return obj; + }, + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + message.signer !== undefined && (obj.signer = message.signer); + message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + return obj; + }, + fromPartial(object: Partial): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + message.signer = object.signer ?? ""; + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromPartial(object.params); + } + return message; + }, +}; +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} +export const MsgUpdateParamsResponse = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): MsgUpdateParamsResponse { + const obj = createBaseMsgUpdateParamsResponse(); + return obj; + }, + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + fromPartial(_: Partial): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; /** Msg defines the ibc/transfer Msg service. */ export interface Msg { /** Transfer defines a rpc handler method for MsgTransfer. */ Transfer(request: MsgTransfer): Promise; + /** UpdateParams defines a rpc handler for MsgUpdateParams. */ + UpdateParams(request: MsgUpdateParams): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: Rpc; constructor(rpc: Rpc) { this.rpc = rpc; this.Transfer = this.Transfer.bind(this); + this.UpdateParams = this.UpdateParams.bind(this); } Transfer(request: MsgTransfer): Promise { const data = MsgTransfer.encode(request).finish(); const promise = this.rpc.request("ibc.applications.transfer.v1.Msg", "Transfer", data); return promise.then((data) => MsgTransferResponse.decode(new BinaryReader(data))); } + UpdateParams(request: MsgUpdateParams): Promise { + const data = MsgUpdateParams.encode(request).finish(); + const promise = this.rpc.request("ibc.applications.transfer.v1.Msg", "UpdateParams", data); + return promise.then((data) => MsgUpdateParamsResponse.decode(new BinaryReader(data))); + } } diff --git a/src/ibc/client.ts b/src/ibc/client.ts index 7074afd..7ff3c4c 100644 --- a/src/ibc/client.ts +++ b/src/ibc/client.ts @@ -2,33 +2,45 @@ import { GeneratedType, Registry, OfflineSigner } from "@cosmjs/proto-signing"; import { AminoTypes, SigningStargateClient } from "@cosmjs/stargate"; import { HttpEndpoint } from "@cosmjs/tendermint-rpc"; -import * as ibcApplicationsFeeV1TxRegistry from "./applications/fee/v1/tx.registry"; import * as ibcApplicationsInterchainAccountsControllerV1TxRegistry from "./applications/interchain_accounts/controller/v1/tx.registry"; +import * as ibcApplicationsInterchainAccountsHostV1TxRegistry from "./applications/interchain_accounts/host/v1/tx.registry"; import * as ibcApplicationsTransferV1TxRegistry from "./applications/transfer/v1/tx.registry"; import * as ibcCoreChannelV1TxRegistry from "./core/channel/v1/tx.registry"; +import * as ibcCoreChannelV2TxRegistry from "./core/channel/v2/tx.registry"; import * as ibcCoreClientV1TxRegistry from "./core/client/v1/tx.registry"; +import * as ibcCoreClientV2TxRegistry from "./core/client/v2/tx.registry"; import * as ibcCoreConnectionV1TxRegistry from "./core/connection/v1/tx.registry"; -import * as ibcApplicationsFeeV1TxAmino from "./applications/fee/v1/tx.amino"; +import * as ibcLightclientsWasmV1TxRegistry from "./lightclients/wasm/v1/tx.registry"; import * as ibcApplicationsInterchainAccountsControllerV1TxAmino from "./applications/interchain_accounts/controller/v1/tx.amino"; +import * as ibcApplicationsInterchainAccountsHostV1TxAmino from "./applications/interchain_accounts/host/v1/tx.amino"; import * as ibcApplicationsTransferV1TxAmino from "./applications/transfer/v1/tx.amino"; import * as ibcCoreChannelV1TxAmino from "./core/channel/v1/tx.amino"; +import * as ibcCoreChannelV2TxAmino from "./core/channel/v2/tx.amino"; import * as ibcCoreClientV1TxAmino from "./core/client/v1/tx.amino"; +import * as ibcCoreClientV2TxAmino from "./core/client/v2/tx.amino"; import * as ibcCoreConnectionV1TxAmino from "./core/connection/v1/tx.amino"; +import * as ibcLightclientsWasmV1TxAmino from "./lightclients/wasm/v1/tx.amino"; export const ibcAminoConverters = { - ...ibcApplicationsFeeV1TxAmino.AminoConverter, ...ibcApplicationsInterchainAccountsControllerV1TxAmino.AminoConverter, + ...ibcApplicationsInterchainAccountsHostV1TxAmino.AminoConverter, ...ibcApplicationsTransferV1TxAmino.AminoConverter, ...ibcCoreChannelV1TxAmino.AminoConverter, + ...ibcCoreChannelV2TxAmino.AminoConverter, ...ibcCoreClientV1TxAmino.AminoConverter, + ...ibcCoreClientV2TxAmino.AminoConverter, ...ibcCoreConnectionV1TxAmino.AminoConverter, + ...ibcLightclientsWasmV1TxAmino.AminoConverter, }; export const ibcProtoRegistry: ReadonlyArray<[string, GeneratedType]> = [ - ...ibcApplicationsFeeV1TxRegistry.registry, ...ibcApplicationsInterchainAccountsControllerV1TxRegistry.registry, + ...ibcApplicationsInterchainAccountsHostV1TxRegistry.registry, ...ibcApplicationsTransferV1TxRegistry.registry, ...ibcCoreChannelV1TxRegistry.registry, + ...ibcCoreChannelV2TxRegistry.registry, ...ibcCoreClientV1TxRegistry.registry, + ...ibcCoreClientV2TxRegistry.registry, ...ibcCoreConnectionV1TxRegistry.registry, + ...ibcLightclientsWasmV1TxRegistry.registry, ]; export const getSigningIbcClientOptions = (): { registry: Registry; diff --git a/src/ibc/core/channel/v1/channel.ts b/src/ibc/core/channel/v1/channel.ts index 944396c..deff623 100644 --- a/src/ibc/core/channel/v1/channel.ts +++ b/src/ibc/core/channel/v1/channel.ts @@ -5,7 +5,7 @@ import { isSet, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "ibc.core.channel.v1"; /** * State defines if a channel is in one of the following states: - * CLOSED, INIT, TRYOPEN, OPEN or UNINITIALIZED. + * CLOSED, INIT, TRYOPEN, OPEN, or UNINITIALIZED. */ export enum State { /** STATE_UNINITIALIZED_UNSPECIFIED - Default State */ @@ -199,7 +199,7 @@ export interface PacketState { data: Uint8Array; } /** - * PacketId is an identifer for a unique Packet + * PacketId is an identifier for a unique Packet * Source chains refer to packets by source port/channel * Destination chains refer to packets by destination port/channel */ @@ -224,6 +224,17 @@ export interface Acknowledgement { result?: Uint8Array; error?: string; } +/** + * Timeout defines an execution deadline structure for 04-channel handlers. + * This includes packet lifecycle handlers. + * A valid Timeout contains either one or both of a timestamp and block height (sequence). + */ +export interface Timeout { + /** block height after which the packet times out */ + height: Height; + /** block timestamp (in nanoseconds) after which the packet times out */ + timestamp: bigint; +} function createBaseChannel(): Channel { return { state: 0, @@ -810,3 +821,62 @@ export const Acknowledgement = { return message; }, }; +function createBaseTimeout(): Timeout { + return { + height: Height.fromPartial({}), + timestamp: BigInt(0), + }; +} +export const Timeout = { + encode(message: Timeout, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.height !== undefined) { + Height.encode(message.height, writer.uint32(10).fork()).ldelim(); + } + if (message.timestamp !== BigInt(0)) { + writer.uint32(16).uint64(message.timestamp); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Timeout { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTimeout(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = Height.decode(reader, reader.uint32()); + break; + case 2: + message.timestamp = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): Timeout { + const obj = createBaseTimeout(); + if (isSet(object.height)) obj.height = Height.fromJSON(object.height); + if (isSet(object.timestamp)) obj.timestamp = BigInt(object.timestamp.toString()); + return obj; + }, + toJSON(message: Timeout): unknown { + const obj: any = {}; + message.height !== undefined && (obj.height = message.height ? Height.toJSON(message.height) : undefined); + message.timestamp !== undefined && (obj.timestamp = (message.timestamp || BigInt(0)).toString()); + return obj; + }, + fromPartial(object: Partial): Timeout { + const message = createBaseTimeout(); + if (object.height !== undefined && object.height !== null) { + message.height = Height.fromPartial(object.height); + } + if (object.timestamp !== undefined && object.timestamp !== null) { + message.timestamp = BigInt(object.timestamp.toString()); + } + return message; + }, +}; diff --git a/src/ibc/core/channel/v1/query.ts b/src/ibc/core/channel/v1/query.ts index 7883189..f5327f6 100644 --- a/src/ibc/core/channel/v1/query.ts +++ b/src/ibc/core/channel/v1/query.ts @@ -290,7 +290,7 @@ export interface QueryNextSequenceReceiveRequest { channelId: string; } /** - * QuerySequenceResponse is the request type for the + * QuerySequenceResponse is the response type for the * Query/QueryNextSequenceReceiveResponse RPC method */ export interface QueryNextSequenceReceiveResponse { @@ -301,6 +301,28 @@ export interface QueryNextSequenceReceiveResponse { /** height at which the proof was retrieved */ proofHeight: Height; } +/** + * QueryNextSequenceSendRequest is the request type for the + * Query/QueryNextSequenceSend RPC method + */ +export interface QueryNextSequenceSendRequest { + /** port unique identifier */ + portId: string; + /** channel unique identifier */ + channelId: string; +} +/** + * QueryNextSequenceSendResponse is the request type for the + * Query/QueryNextSequenceSend RPC method + */ +export interface QueryNextSequenceSendResponse { + /** next sequence send number */ + nextSequenceSend: bigint; + /** merkle proof of existence */ + proof: Uint8Array; + /** height at which the proof was retrieved */ + proofHeight: Height; +} function createBaseQueryChannelRequest(): QueryChannelRequest { return { portId: "", @@ -2177,6 +2199,133 @@ export const QueryNextSequenceReceiveResponse = { return message; }, }; +function createBaseQueryNextSequenceSendRequest(): QueryNextSequenceSendRequest { + return { + portId: "", + channelId: "", + }; +} +export const QueryNextSequenceSendRequest = { + encode(message: QueryNextSequenceSendRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryNextSequenceSendRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryNextSequenceSendRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryNextSequenceSendRequest { + const obj = createBaseQueryNextSequenceSendRequest(); + if (isSet(object.portId)) obj.portId = String(object.portId); + if (isSet(object.channelId)) obj.channelId = String(object.channelId); + return obj; + }, + toJSON(message: QueryNextSequenceSendRequest): unknown { + const obj: any = {}; + message.portId !== undefined && (obj.portId = message.portId); + message.channelId !== undefined && (obj.channelId = message.channelId); + return obj; + }, + fromPartial(object: Partial): QueryNextSequenceSendRequest { + const message = createBaseQueryNextSequenceSendRequest(); + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + return message; + }, +}; +function createBaseQueryNextSequenceSendResponse(): QueryNextSequenceSendResponse { + return { + nextSequenceSend: BigInt(0), + proof: new Uint8Array(), + proofHeight: Height.fromPartial({}), + }; +} +export const QueryNextSequenceSendResponse = { + encode(message: QueryNextSequenceSendResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.nextSequenceSend !== BigInt(0)) { + writer.uint32(8).uint64(message.nextSequenceSend); + } + if (message.proof.length !== 0) { + writer.uint32(18).bytes(message.proof); + } + if (message.proofHeight !== undefined) { + Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryNextSequenceSendResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryNextSequenceSendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.nextSequenceSend = reader.uint64(); + break; + case 2: + message.proof = reader.bytes(); + break; + case 3: + message.proofHeight = Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryNextSequenceSendResponse { + const obj = createBaseQueryNextSequenceSendResponse(); + if (isSet(object.nextSequenceSend)) obj.nextSequenceSend = BigInt(object.nextSequenceSend.toString()); + if (isSet(object.proof)) obj.proof = bytesFromBase64(object.proof); + if (isSet(object.proofHeight)) obj.proofHeight = Height.fromJSON(object.proofHeight); + return obj; + }, + toJSON(message: QueryNextSequenceSendResponse): unknown { + const obj: any = {}; + message.nextSequenceSend !== undefined && + (obj.nextSequenceSend = (message.nextSequenceSend || BigInt(0)).toString()); + message.proof !== undefined && + (obj.proof = base64FromBytes(message.proof !== undefined ? message.proof : new Uint8Array())); + message.proofHeight !== undefined && + (obj.proofHeight = message.proofHeight ? Height.toJSON(message.proofHeight) : undefined); + return obj; + }, + fromPartial(object: Partial): QueryNextSequenceSendResponse { + const message = createBaseQueryNextSequenceSendResponse(); + if (object.nextSequenceSend !== undefined && object.nextSequenceSend !== null) { + message.nextSequenceSend = BigInt(object.nextSequenceSend.toString()); + } + message.proof = object.proof ?? new Uint8Array(); + if (object.proofHeight !== undefined && object.proofHeight !== null) { + message.proofHeight = Height.fromPartial(object.proofHeight); + } + return message; + }, +}; /** Query provides defines the gRPC querier service */ export interface Query { /** Channel queries an IBC Channel. */ @@ -2235,6 +2384,8 @@ export interface Query { UnreceivedAcks(request: QueryUnreceivedAcksRequest): Promise; /** NextSequenceReceive returns the next receive sequence for a given channel. */ NextSequenceReceive(request: QueryNextSequenceReceiveRequest): Promise; + /** NextSequenceSend returns the next send sequence for a given channel. */ + NextSequenceSend(request: QueryNextSequenceSendRequest): Promise; } export class QueryClientImpl implements Query { private readonly rpc: Rpc; @@ -2253,6 +2404,7 @@ export class QueryClientImpl implements Query { this.UnreceivedPackets = this.UnreceivedPackets.bind(this); this.UnreceivedAcks = this.UnreceivedAcks.bind(this); this.NextSequenceReceive = this.NextSequenceReceive.bind(this); + this.NextSequenceSend = this.NextSequenceSend.bind(this); } Channel(request: QueryChannelRequest): Promise { const data = QueryChannelRequest.encode(request).finish(); @@ -2329,4 +2481,9 @@ export class QueryClientImpl implements Query { const promise = this.rpc.request("ibc.core.channel.v1.Query", "NextSequenceReceive", data); return promise.then((data) => QueryNextSequenceReceiveResponse.decode(new BinaryReader(data))); } + NextSequenceSend(request: QueryNextSequenceSendRequest): Promise { + const data = QueryNextSequenceSendRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.channel.v1.Query", "NextSequenceSend", data); + return promise.then((data) => QueryNextSequenceSendResponse.decode(new BinaryReader(data))); + } } diff --git a/src/ibc/core/channel/v1/tx.ts b/src/ibc/core/channel/v1/tx.ts index 10c49aa..261b5f7 100644 --- a/src/ibc/core/channel/v1/tx.ts +++ b/src/ibc/core/channel/v1/tx.ts @@ -12,6 +12,8 @@ export enum ResponseResultType { RESPONSE_RESULT_TYPE_NOOP = 1, /** RESPONSE_RESULT_TYPE_SUCCESS - The message was executed successfully */ RESPONSE_RESULT_TYPE_SUCCESS = 2, + /** RESPONSE_RESULT_TYPE_FAILURE - The message was executed unsuccessfully */ + RESPONSE_RESULT_TYPE_FAILURE = 3, UNRECOGNIZED = -1, } export function responseResultTypeFromJSON(object: any): ResponseResultType { @@ -25,6 +27,9 @@ export function responseResultTypeFromJSON(object: any): ResponseResultType { case 2: case "RESPONSE_RESULT_TYPE_SUCCESS": return ResponseResultType.RESPONSE_RESULT_TYPE_SUCCESS; + case 3: + case "RESPONSE_RESULT_TYPE_FAILURE": + return ResponseResultType.RESPONSE_RESULT_TYPE_FAILURE; case -1: case "UNRECOGNIZED": default: @@ -39,6 +44,8 @@ export function responseResultTypeToJSON(object: ResponseResultType): string { return "RESPONSE_RESULT_TYPE_NOOP"; case ResponseResultType.RESPONSE_RESULT_TYPE_SUCCESS: return "RESPONSE_RESULT_TYPE_SUCCESS"; + case ResponseResultType.RESPONSE_RESULT_TYPE_FAILURE: + return "RESPONSE_RESULT_TYPE_FAILURE"; case ResponseResultType.UNRECOGNIZED: default: return "UNRECOGNIZED"; diff --git a/src/ibc/core/channel/v2/genesis.ts b/src/ibc/core/channel/v2/genesis.ts new file mode 100644 index 0000000..6bc65fc --- /dev/null +++ b/src/ibc/core/channel/v2/genesis.ts @@ -0,0 +1,268 @@ +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { isSet, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +export const protobufPackage = "ibc.core.channel.v2"; +/** GenesisState defines the ibc channel/v2 submodule's genesis state. */ +export interface GenesisState { + acknowledgements: PacketState[]; + commitments: PacketState[]; + receipts: PacketState[]; + asyncPackets: PacketState[]; + sendSequences: PacketSequence[]; +} +/** + * PacketState defines the generic type necessary to retrieve and store + * packet commitments, acknowledgements, and receipts. + * Caller is responsible for knowing the context necessary to interpret this + * state as a commitment, acknowledgement, or a receipt. + */ +export interface PacketState { + /** client unique identifier. */ + clientId: string; + /** packet sequence. */ + sequence: bigint; + /** embedded data that represents packet state. */ + data: Uint8Array; +} +/** PacketSequence defines the genesis type necessary to retrieve and store next send sequences. */ +export interface PacketSequence { + /** client unique identifier. */ + clientId: string; + /** packet sequence */ + sequence: bigint; +} +function createBaseGenesisState(): GenesisState { + return { + acknowledgements: [], + commitments: [], + receipts: [], + asyncPackets: [], + sendSequences: [], + }; +} +export const GenesisState = { + encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.acknowledgements) { + PacketState.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.commitments) { + PacketState.encode(v!, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.receipts) { + PacketState.encode(v!, writer.uint32(34).fork()).ldelim(); + } + for (const v of message.asyncPackets) { + PacketState.encode(v!, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.sendSequences) { + PacketSequence.encode(v!, writer.uint32(50).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + message.acknowledgements.push(PacketState.decode(reader, reader.uint32())); + break; + case 3: + message.commitments.push(PacketState.decode(reader, reader.uint32())); + break; + case 4: + message.receipts.push(PacketState.decode(reader, reader.uint32())); + break; + case 5: + message.asyncPackets.push(PacketState.decode(reader, reader.uint32())); + break; + case 6: + message.sendSequences.push(PacketSequence.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): GenesisState { + const obj = createBaseGenesisState(); + if (Array.isArray(object?.acknowledgements)) + obj.acknowledgements = object.acknowledgements.map((e: any) => PacketState.fromJSON(e)); + if (Array.isArray(object?.commitments)) + obj.commitments = object.commitments.map((e: any) => PacketState.fromJSON(e)); + if (Array.isArray(object?.receipts)) + obj.receipts = object.receipts.map((e: any) => PacketState.fromJSON(e)); + if (Array.isArray(object?.asyncPackets)) + obj.asyncPackets = object.asyncPackets.map((e: any) => PacketState.fromJSON(e)); + if (Array.isArray(object?.sendSequences)) + obj.sendSequences = object.sendSequences.map((e: any) => PacketSequence.fromJSON(e)); + return obj; + }, + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.acknowledgements) { + obj.acknowledgements = message.acknowledgements.map((e) => (e ? PacketState.toJSON(e) : undefined)); + } else { + obj.acknowledgements = []; + } + if (message.commitments) { + obj.commitments = message.commitments.map((e) => (e ? PacketState.toJSON(e) : undefined)); + } else { + obj.commitments = []; + } + if (message.receipts) { + obj.receipts = message.receipts.map((e) => (e ? PacketState.toJSON(e) : undefined)); + } else { + obj.receipts = []; + } + if (message.asyncPackets) { + obj.asyncPackets = message.asyncPackets.map((e) => (e ? PacketState.toJSON(e) : undefined)); + } else { + obj.asyncPackets = []; + } + if (message.sendSequences) { + obj.sendSequences = message.sendSequences.map((e) => (e ? PacketSequence.toJSON(e) : undefined)); + } else { + obj.sendSequences = []; + } + return obj; + }, + fromPartial(object: Partial): GenesisState { + const message = createBaseGenesisState(); + message.acknowledgements = object.acknowledgements?.map((e) => PacketState.fromPartial(e)) || []; + message.commitments = object.commitments?.map((e) => PacketState.fromPartial(e)) || []; + message.receipts = object.receipts?.map((e) => PacketState.fromPartial(e)) || []; + message.asyncPackets = object.asyncPackets?.map((e) => PacketState.fromPartial(e)) || []; + message.sendSequences = object.sendSequences?.map((e) => PacketSequence.fromPartial(e)) || []; + return message; + }, +}; +function createBasePacketState(): PacketState { + return { + clientId: "", + sequence: BigInt(0), + data: new Uint8Array(), + }; +} +export const PacketState = { + encode(message: PacketState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.sequence !== BigInt(0)) { + writer.uint32(16).uint64(message.sequence); + } + if (message.data.length !== 0) { + writer.uint32(26).bytes(message.data); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): PacketState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePacketState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.sequence = reader.uint64(); + break; + case 3: + message.data = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): PacketState { + const obj = createBasePacketState(); + if (isSet(object.clientId)) obj.clientId = String(object.clientId); + if (isSet(object.sequence)) obj.sequence = BigInt(object.sequence.toString()); + if (isSet(object.data)) obj.data = bytesFromBase64(object.data); + return obj; + }, + toJSON(message: PacketState): unknown { + const obj: any = {}; + message.clientId !== undefined && (obj.clientId = message.clientId); + message.sequence !== undefined && (obj.sequence = (message.sequence || BigInt(0)).toString()); + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); + return obj; + }, + fromPartial(object: Partial): PacketState { + const message = createBasePacketState(); + message.clientId = object.clientId ?? ""; + if (object.sequence !== undefined && object.sequence !== null) { + message.sequence = BigInt(object.sequence.toString()); + } + message.data = object.data ?? new Uint8Array(); + return message; + }, +}; +function createBasePacketSequence(): PacketSequence { + return { + clientId: "", + sequence: BigInt(0), + }; +} +export const PacketSequence = { + encode(message: PacketSequence, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.sequence !== BigInt(0)) { + writer.uint32(16).uint64(message.sequence); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): PacketSequence { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePacketSequence(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.sequence = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): PacketSequence { + const obj = createBasePacketSequence(); + if (isSet(object.clientId)) obj.clientId = String(object.clientId); + if (isSet(object.sequence)) obj.sequence = BigInt(object.sequence.toString()); + return obj; + }, + toJSON(message: PacketSequence): unknown { + const obj: any = {}; + message.clientId !== undefined && (obj.clientId = message.clientId); + message.sequence !== undefined && (obj.sequence = (message.sequence || BigInt(0)).toString()); + return obj; + }, + fromPartial(object: Partial): PacketSequence { + const message = createBasePacketSequence(); + message.clientId = object.clientId ?? ""; + if (object.sequence !== undefined && object.sequence !== null) { + message.sequence = BigInt(object.sequence.toString()); + } + return message; + }, +}; diff --git a/src/ibc/core/channel/v2/packet.ts b/src/ibc/core/channel/v2/packet.ts new file mode 100644 index 0000000..a9e3d05 --- /dev/null +++ b/src/ibc/core/channel/v2/packet.ts @@ -0,0 +1,389 @@ +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { isSet, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +export const protobufPackage = "ibc.core.channel.v2"; +/** PacketStatus specifies the status of a RecvPacketResult. */ +export enum PacketStatus { + /** PACKET_STATUS_UNSPECIFIED - PACKET_STATUS_UNSPECIFIED indicates an unknown packet status. */ + PACKET_STATUS_UNSPECIFIED = 0, + /** PACKET_STATUS_SUCCESS - PACKET_STATUS_SUCCESS indicates a successful packet receipt. */ + PACKET_STATUS_SUCCESS = 1, + /** PACKET_STATUS_FAILURE - PACKET_STATUS_FAILURE indicates a failed packet receipt. */ + PACKET_STATUS_FAILURE = 2, + /** PACKET_STATUS_ASYNC - PACKET_STATUS_ASYNC indicates an async packet receipt. */ + PACKET_STATUS_ASYNC = 3, + UNRECOGNIZED = -1, +} +export function packetStatusFromJSON(object: any): PacketStatus { + switch (object) { + case 0: + case "PACKET_STATUS_UNSPECIFIED": + return PacketStatus.PACKET_STATUS_UNSPECIFIED; + case 1: + case "PACKET_STATUS_SUCCESS": + return PacketStatus.PACKET_STATUS_SUCCESS; + case 2: + case "PACKET_STATUS_FAILURE": + return PacketStatus.PACKET_STATUS_FAILURE; + case 3: + case "PACKET_STATUS_ASYNC": + return PacketStatus.PACKET_STATUS_ASYNC; + case -1: + case "UNRECOGNIZED": + default: + return PacketStatus.UNRECOGNIZED; + } +} +export function packetStatusToJSON(object: PacketStatus): string { + switch (object) { + case PacketStatus.PACKET_STATUS_UNSPECIFIED: + return "PACKET_STATUS_UNSPECIFIED"; + case PacketStatus.PACKET_STATUS_SUCCESS: + return "PACKET_STATUS_SUCCESS"; + case PacketStatus.PACKET_STATUS_FAILURE: + return "PACKET_STATUS_FAILURE"; + case PacketStatus.PACKET_STATUS_ASYNC: + return "PACKET_STATUS_ASYNC"; + case PacketStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** Packet defines a type that carries data across different chains through IBC */ +export interface Packet { + /** + * number corresponds to the order of sends and receives, where a Packet + * with an earlier sequence number must be sent and received before a Packet + * with a later sequence number. + */ + sequence: bigint; + /** identifies the sending client on the sending chain. */ + sourceClient: string; + /** identifies the receiving client on the receiving chain. */ + destinationClient: string; + /** timeout timestamp in seconds after which the packet times out. */ + timeoutTimestamp: bigint; + /** a list of payloads, each one for a specific application. */ + payloads: Payload[]; +} +/** Payload contains the source and destination ports and payload for the application (version, encoding, raw bytes) */ +export interface Payload { + /** specifies the source port of the packet. */ + sourcePort: string; + /** specifies the destination port of the packet. */ + destinationPort: string; + /** version of the specified application. */ + version: string; + /** the encoding used for the provided value. */ + encoding: string; + /** the raw bytes for the payload. */ + value: Uint8Array; +} +/** + * Acknowledgement contains a list of all ack results associated with a single packet. + * In the case of a successful receive, the acknowledgement will contain an app acknowledgement + * for each application that received a payload in the same order that the payloads were sent + * in the packet. + * If the receive is not successful, the acknowledgement will contain a single app acknowledgment + * which will be a constant error acknowledgment as defined by the IBC v2 protocol. + */ +export interface Acknowledgement { + appAcknowledgements: Uint8Array[]; +} +/** RecvPacketResult speecifies the status of a packet as well as the acknowledgement bytes. */ +export interface RecvPacketResult { + /** status of the packet */ + status: PacketStatus; + /** acknowledgement of the packet */ + acknowledgement: Uint8Array; +} +function createBasePacket(): Packet { + return { + sequence: BigInt(0), + sourceClient: "", + destinationClient: "", + timeoutTimestamp: BigInt(0), + payloads: [], + }; +} +export const Packet = { + encode(message: Packet, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.sequence !== BigInt(0)) { + writer.uint32(8).uint64(message.sequence); + } + if (message.sourceClient !== "") { + writer.uint32(18).string(message.sourceClient); + } + if (message.destinationClient !== "") { + writer.uint32(26).string(message.destinationClient); + } + if (message.timeoutTimestamp !== BigInt(0)) { + writer.uint32(32).uint64(message.timeoutTimestamp); + } + for (const v of message.payloads) { + Payload.encode(v!, writer.uint32(42).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Packet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePacket(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sequence = reader.uint64(); + break; + case 2: + message.sourceClient = reader.string(); + break; + case 3: + message.destinationClient = reader.string(); + break; + case 4: + message.timeoutTimestamp = reader.uint64(); + break; + case 5: + message.payloads.push(Payload.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): Packet { + const obj = createBasePacket(); + if (isSet(object.sequence)) obj.sequence = BigInt(object.sequence.toString()); + if (isSet(object.sourceClient)) obj.sourceClient = String(object.sourceClient); + if (isSet(object.destinationClient)) obj.destinationClient = String(object.destinationClient); + if (isSet(object.timeoutTimestamp)) obj.timeoutTimestamp = BigInt(object.timeoutTimestamp.toString()); + if (Array.isArray(object?.payloads)) obj.payloads = object.payloads.map((e: any) => Payload.fromJSON(e)); + return obj; + }, + toJSON(message: Packet): unknown { + const obj: any = {}; + message.sequence !== undefined && (obj.sequence = (message.sequence || BigInt(0)).toString()); + message.sourceClient !== undefined && (obj.sourceClient = message.sourceClient); + message.destinationClient !== undefined && (obj.destinationClient = message.destinationClient); + message.timeoutTimestamp !== undefined && + (obj.timeoutTimestamp = (message.timeoutTimestamp || BigInt(0)).toString()); + if (message.payloads) { + obj.payloads = message.payloads.map((e) => (e ? Payload.toJSON(e) : undefined)); + } else { + obj.payloads = []; + } + return obj; + }, + fromPartial(object: Partial): Packet { + const message = createBasePacket(); + if (object.sequence !== undefined && object.sequence !== null) { + message.sequence = BigInt(object.sequence.toString()); + } + message.sourceClient = object.sourceClient ?? ""; + message.destinationClient = object.destinationClient ?? ""; + if (object.timeoutTimestamp !== undefined && object.timeoutTimestamp !== null) { + message.timeoutTimestamp = BigInt(object.timeoutTimestamp.toString()); + } + message.payloads = object.payloads?.map((e) => Payload.fromPartial(e)) || []; + return message; + }, +}; +function createBasePayload(): Payload { + return { + sourcePort: "", + destinationPort: "", + version: "", + encoding: "", + value: new Uint8Array(), + }; +} +export const Payload = { + encode(message: Payload, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.sourcePort !== "") { + writer.uint32(10).string(message.sourcePort); + } + if (message.destinationPort !== "") { + writer.uint32(18).string(message.destinationPort); + } + if (message.version !== "") { + writer.uint32(26).string(message.version); + } + if (message.encoding !== "") { + writer.uint32(34).string(message.encoding); + } + if (message.value.length !== 0) { + writer.uint32(42).bytes(message.value); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Payload { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePayload(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sourcePort = reader.string(); + break; + case 2: + message.destinationPort = reader.string(); + break; + case 3: + message.version = reader.string(); + break; + case 4: + message.encoding = reader.string(); + break; + case 5: + message.value = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): Payload { + const obj = createBasePayload(); + if (isSet(object.sourcePort)) obj.sourcePort = String(object.sourcePort); + if (isSet(object.destinationPort)) obj.destinationPort = String(object.destinationPort); + if (isSet(object.version)) obj.version = String(object.version); + if (isSet(object.encoding)) obj.encoding = String(object.encoding); + if (isSet(object.value)) obj.value = bytesFromBase64(object.value); + return obj; + }, + toJSON(message: Payload): unknown { + const obj: any = {}; + message.sourcePort !== undefined && (obj.sourcePort = message.sourcePort); + message.destinationPort !== undefined && (obj.destinationPort = message.destinationPort); + message.version !== undefined && (obj.version = message.version); + message.encoding !== undefined && (obj.encoding = message.encoding); + message.value !== undefined && + (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); + return obj; + }, + fromPartial(object: Partial): Payload { + const message = createBasePayload(); + message.sourcePort = object.sourcePort ?? ""; + message.destinationPort = object.destinationPort ?? ""; + message.version = object.version ?? ""; + message.encoding = object.encoding ?? ""; + message.value = object.value ?? new Uint8Array(); + return message; + }, +}; +function createBaseAcknowledgement(): Acknowledgement { + return { + appAcknowledgements: [], + }; +} +export const Acknowledgement = { + encode(message: Acknowledgement, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.appAcknowledgements) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Acknowledgement { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAcknowledgement(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.appAcknowledgements.push(reader.bytes()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): Acknowledgement { + const obj = createBaseAcknowledgement(); + if (Array.isArray(object?.appAcknowledgements)) + obj.appAcknowledgements = object.appAcknowledgements.map((e: any) => bytesFromBase64(e)); + return obj; + }, + toJSON(message: Acknowledgement): unknown { + const obj: any = {}; + if (message.appAcknowledgements) { + obj.appAcknowledgements = message.appAcknowledgements.map((e) => + base64FromBytes(e !== undefined ? e : new Uint8Array()), + ); + } else { + obj.appAcknowledgements = []; + } + return obj; + }, + fromPartial(object: Partial): Acknowledgement { + const message = createBaseAcknowledgement(); + message.appAcknowledgements = object.appAcknowledgements?.map((e) => e) || []; + return message; + }, +}; +function createBaseRecvPacketResult(): RecvPacketResult { + return { + status: 0, + acknowledgement: new Uint8Array(), + }; +} +export const RecvPacketResult = { + encode(message: RecvPacketResult, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.status !== 0) { + writer.uint32(8).int32(message.status); + } + if (message.acknowledgement.length !== 0) { + writer.uint32(18).bytes(message.acknowledgement); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): RecvPacketResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRecvPacketResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.status = reader.int32() as any; + break; + case 2: + message.acknowledgement = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): RecvPacketResult { + const obj = createBaseRecvPacketResult(); + if (isSet(object.status)) obj.status = packetStatusFromJSON(object.status); + if (isSet(object.acknowledgement)) obj.acknowledgement = bytesFromBase64(object.acknowledgement); + return obj; + }, + toJSON(message: RecvPacketResult): unknown { + const obj: any = {}; + message.status !== undefined && (obj.status = packetStatusToJSON(message.status)); + message.acknowledgement !== undefined && + (obj.acknowledgement = base64FromBytes( + message.acknowledgement !== undefined ? message.acknowledgement : new Uint8Array(), + )); + return obj; + }, + fromPartial(object: Partial): RecvPacketResult { + const message = createBaseRecvPacketResult(); + message.status = object.status ?? 0; + message.acknowledgement = object.acknowledgement ?? new Uint8Array(); + return message; + }, +}; diff --git a/src/ibc/core/channel/v2/query.ts b/src/ibc/core/channel/v2/query.ts new file mode 100644 index 0000000..24216d9 --- /dev/null +++ b/src/ibc/core/channel/v2/query.ts @@ -0,0 +1,1315 @@ +/* eslint-disable */ +import { PageRequest, PageResponse } from "../../../../cosmos/base/query/v1beta1/pagination"; +import { Height } from "../../client/v1/client"; +import { PacketState } from "./genesis"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { isSet, bytesFromBase64, base64FromBytes, Rpc } from "../../../../helpers"; +export const protobufPackage = "ibc.core.channel.v2"; +/** QueryNextSequenceSendRequest is the request type for the Query/QueryNextSequenceSend RPC method */ +export interface QueryNextSequenceSendRequest { + /** client unique identifier */ + clientId: string; +} +/** QueryNextSequenceSendResponse is the response type for the Query/QueryNextSequenceSend RPC method */ +export interface QueryNextSequenceSendResponse { + /** next sequence send number */ + nextSequenceSend: bigint; + /** merkle proof of existence */ + proof: Uint8Array; + /** height at which the proof was retrieved */ + proofHeight: Height; +} +/** QueryPacketCommitmentRequest is the request type for the Query/PacketCommitment RPC method. */ +export interface QueryPacketCommitmentRequest { + /** client unique identifier */ + clientId: string; + /** packet sequence */ + sequence: bigint; +} +/** QueryPacketCommitmentResponse is the response type for the Query/PacketCommitment RPC method. */ +export interface QueryPacketCommitmentResponse { + /** packet associated with the request fields */ + commitment: Uint8Array; + /** merkle proof of existence */ + proof: Uint8Array; + /** height at which the proof was retrieved */ + proofHeight: Height; +} +/** QueryPacketCommitmentsRequest is the request type for the Query/PacketCommitments RPC method. */ +export interface QueryPacketCommitmentsRequest { + /** client unique identifier */ + clientId: string; + /** pagination request */ + pagination: PageRequest; +} +/** QueryPacketCommitmentResponse is the response type for the Query/PacketCommitment RPC method. */ +export interface QueryPacketCommitmentsResponse { + /** collection of packet commitments for the requested channel identifier. */ + commitments: PacketState[]; + /** pagination response. */ + pagination: PageResponse; + /** query block height. */ + height: Height; +} +/** QueryPacketAcknowledgementRequest is the request type for the Query/PacketAcknowledgement RPC method. */ +export interface QueryPacketAcknowledgementRequest { + /** client unique identifier */ + clientId: string; + /** packet sequence */ + sequence: bigint; +} +/** QueryPacketAcknowledgementResponse is the response type for the Query/PacketAcknowledgement RPC method. */ +export interface QueryPacketAcknowledgementResponse { + /** acknowledgement associated with the request fields */ + acknowledgement: Uint8Array; + /** merkle proof of existence */ + proof: Uint8Array; + /** height at which the proof was retrieved */ + proofHeight: Height; +} +/** + * QueryPacketAcknowledgementsRequest is the request type for the + * Query/QueryPacketCommitments RPC method + */ +export interface QueryPacketAcknowledgementsRequest { + /** client unique identifier */ + clientId: string; + /** pagination request */ + pagination: PageRequest; + /** list of packet sequences */ + packetCommitmentSequences: bigint[]; +} +/** + * QueryPacketAcknowledgemetsResponse is the request type for the + * Query/QueryPacketAcknowledgements RPC method + */ +export interface QueryPacketAcknowledgementsResponse { + acknowledgements: PacketState[]; + /** pagination response */ + pagination: PageResponse; + /** query block height */ + height: Height; +} +/** QueryPacketReceiptRequest is the request type for the Query/PacketReceipt RPC method. */ +export interface QueryPacketReceiptRequest { + /** client unique identifier */ + clientId: string; + /** packet sequence */ + sequence: bigint; +} +/** QueryPacketReceiptResponse is the response type for the Query/PacketReceipt RPC method. */ +export interface QueryPacketReceiptResponse { + /** success flag for if receipt exists */ + received: boolean; + /** merkle proof of existence or absence */ + proof: Uint8Array; + /** height at which the proof was retrieved */ + proofHeight: Height; +} +/** QueryUnreceivedPacketsRequest is the request type for the Query/UnreceivedPackets RPC method */ +export interface QueryUnreceivedPacketsRequest { + /** client unique identifier */ + clientId: string; + /** list of packet sequences */ + sequences: bigint[]; +} +/** QueryUnreceivedPacketsResponse is the response type for the Query/UnreceivedPacketCommitments RPC method */ +export interface QueryUnreceivedPacketsResponse { + /** list of unreceived packet sequences */ + sequences: bigint[]; + /** query block height */ + height: Height; +} +/** + * QueryUnreceivedAcks is the request type for the + * Query/UnreceivedAcks RPC method + */ +export interface QueryUnreceivedAcksRequest { + /** client unique identifier */ + clientId: string; + /** list of acknowledgement sequences */ + packetAckSequences: bigint[]; +} +/** + * QueryUnreceivedAcksResponse is the response type for the + * Query/UnreceivedAcks RPC method + */ +export interface QueryUnreceivedAcksResponse { + /** list of unreceived acknowledgement sequences */ + sequences: bigint[]; + /** query block height */ + height: Height; +} +function createBaseQueryNextSequenceSendRequest(): QueryNextSequenceSendRequest { + return { + clientId: "", + }; +} +export const QueryNextSequenceSendRequest = { + encode(message: QueryNextSequenceSendRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryNextSequenceSendRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryNextSequenceSendRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryNextSequenceSendRequest { + const obj = createBaseQueryNextSequenceSendRequest(); + if (isSet(object.clientId)) obj.clientId = String(object.clientId); + return obj; + }, + toJSON(message: QueryNextSequenceSendRequest): unknown { + const obj: any = {}; + message.clientId !== undefined && (obj.clientId = message.clientId); + return obj; + }, + fromPartial(object: Partial): QueryNextSequenceSendRequest { + const message = createBaseQueryNextSequenceSendRequest(); + message.clientId = object.clientId ?? ""; + return message; + }, +}; +function createBaseQueryNextSequenceSendResponse(): QueryNextSequenceSendResponse { + return { + nextSequenceSend: BigInt(0), + proof: new Uint8Array(), + proofHeight: Height.fromPartial({}), + }; +} +export const QueryNextSequenceSendResponse = { + encode(message: QueryNextSequenceSendResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.nextSequenceSend !== BigInt(0)) { + writer.uint32(8).uint64(message.nextSequenceSend); + } + if (message.proof.length !== 0) { + writer.uint32(18).bytes(message.proof); + } + if (message.proofHeight !== undefined) { + Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryNextSequenceSendResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryNextSequenceSendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.nextSequenceSend = reader.uint64(); + break; + case 2: + message.proof = reader.bytes(); + break; + case 3: + message.proofHeight = Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryNextSequenceSendResponse { + const obj = createBaseQueryNextSequenceSendResponse(); + if (isSet(object.nextSequenceSend)) obj.nextSequenceSend = BigInt(object.nextSequenceSend.toString()); + if (isSet(object.proof)) obj.proof = bytesFromBase64(object.proof); + if (isSet(object.proofHeight)) obj.proofHeight = Height.fromJSON(object.proofHeight); + return obj; + }, + toJSON(message: QueryNextSequenceSendResponse): unknown { + const obj: any = {}; + message.nextSequenceSend !== undefined && + (obj.nextSequenceSend = (message.nextSequenceSend || BigInt(0)).toString()); + message.proof !== undefined && + (obj.proof = base64FromBytes(message.proof !== undefined ? message.proof : new Uint8Array())); + message.proofHeight !== undefined && + (obj.proofHeight = message.proofHeight ? Height.toJSON(message.proofHeight) : undefined); + return obj; + }, + fromPartial(object: Partial): QueryNextSequenceSendResponse { + const message = createBaseQueryNextSequenceSendResponse(); + if (object.nextSequenceSend !== undefined && object.nextSequenceSend !== null) { + message.nextSequenceSend = BigInt(object.nextSequenceSend.toString()); + } + message.proof = object.proof ?? new Uint8Array(); + if (object.proofHeight !== undefined && object.proofHeight !== null) { + message.proofHeight = Height.fromPartial(object.proofHeight); + } + return message; + }, +}; +function createBaseQueryPacketCommitmentRequest(): QueryPacketCommitmentRequest { + return { + clientId: "", + sequence: BigInt(0), + }; +} +export const QueryPacketCommitmentRequest = { + encode(message: QueryPacketCommitmentRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.sequence !== BigInt(0)) { + writer.uint32(16).uint64(message.sequence); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryPacketCommitmentRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPacketCommitmentRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.sequence = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryPacketCommitmentRequest { + const obj = createBaseQueryPacketCommitmentRequest(); + if (isSet(object.clientId)) obj.clientId = String(object.clientId); + if (isSet(object.sequence)) obj.sequence = BigInt(object.sequence.toString()); + return obj; + }, + toJSON(message: QueryPacketCommitmentRequest): unknown { + const obj: any = {}; + message.clientId !== undefined && (obj.clientId = message.clientId); + message.sequence !== undefined && (obj.sequence = (message.sequence || BigInt(0)).toString()); + return obj; + }, + fromPartial(object: Partial): QueryPacketCommitmentRequest { + const message = createBaseQueryPacketCommitmentRequest(); + message.clientId = object.clientId ?? ""; + if (object.sequence !== undefined && object.sequence !== null) { + message.sequence = BigInt(object.sequence.toString()); + } + return message; + }, +}; +function createBaseQueryPacketCommitmentResponse(): QueryPacketCommitmentResponse { + return { + commitment: new Uint8Array(), + proof: new Uint8Array(), + proofHeight: Height.fromPartial({}), + }; +} +export const QueryPacketCommitmentResponse = { + encode(message: QueryPacketCommitmentResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.commitment.length !== 0) { + writer.uint32(10).bytes(message.commitment); + } + if (message.proof.length !== 0) { + writer.uint32(18).bytes(message.proof); + } + if (message.proofHeight !== undefined) { + Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryPacketCommitmentResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPacketCommitmentResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.commitment = reader.bytes(); + break; + case 2: + message.proof = reader.bytes(); + break; + case 3: + message.proofHeight = Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryPacketCommitmentResponse { + const obj = createBaseQueryPacketCommitmentResponse(); + if (isSet(object.commitment)) obj.commitment = bytesFromBase64(object.commitment); + if (isSet(object.proof)) obj.proof = bytesFromBase64(object.proof); + if (isSet(object.proofHeight)) obj.proofHeight = Height.fromJSON(object.proofHeight); + return obj; + }, + toJSON(message: QueryPacketCommitmentResponse): unknown { + const obj: any = {}; + message.commitment !== undefined && + (obj.commitment = base64FromBytes( + message.commitment !== undefined ? message.commitment : new Uint8Array(), + )); + message.proof !== undefined && + (obj.proof = base64FromBytes(message.proof !== undefined ? message.proof : new Uint8Array())); + message.proofHeight !== undefined && + (obj.proofHeight = message.proofHeight ? Height.toJSON(message.proofHeight) : undefined); + return obj; + }, + fromPartial(object: Partial): QueryPacketCommitmentResponse { + const message = createBaseQueryPacketCommitmentResponse(); + message.commitment = object.commitment ?? new Uint8Array(); + message.proof = object.proof ?? new Uint8Array(); + if (object.proofHeight !== undefined && object.proofHeight !== null) { + message.proofHeight = Height.fromPartial(object.proofHeight); + } + return message; + }, +}; +function createBaseQueryPacketCommitmentsRequest(): QueryPacketCommitmentsRequest { + return { + clientId: "", + pagination: PageRequest.fromPartial({}), + }; +} +export const QueryPacketCommitmentsRequest = { + encode(message: QueryPacketCommitmentsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryPacketCommitmentsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPacketCommitmentsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryPacketCommitmentsRequest { + const obj = createBaseQueryPacketCommitmentsRequest(); + if (isSet(object.clientId)) obj.clientId = String(object.clientId); + if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); + return obj; + }, + toJSON(message: QueryPacketCommitmentsRequest): unknown { + const obj: any = {}; + message.clientId !== undefined && (obj.clientId = message.clientId); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object: Partial): QueryPacketCommitmentsRequest { + const message = createBaseQueryPacketCommitmentsRequest(); + message.clientId = object.clientId ?? ""; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromPartial(object.pagination); + } + return message; + }, +}; +function createBaseQueryPacketCommitmentsResponse(): QueryPacketCommitmentsResponse { + return { + commitments: [], + pagination: PageResponse.fromPartial({}), + height: Height.fromPartial({}), + }; +} +export const QueryPacketCommitmentsResponse = { + encode( + message: QueryPacketCommitmentsResponse, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + for (const v of message.commitments) { + PacketState.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + if (message.height !== undefined) { + Height.encode(message.height, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryPacketCommitmentsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPacketCommitmentsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.commitments.push(PacketState.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + case 3: + message.height = Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryPacketCommitmentsResponse { + const obj = createBaseQueryPacketCommitmentsResponse(); + if (Array.isArray(object?.commitments)) + obj.commitments = object.commitments.map((e: any) => PacketState.fromJSON(e)); + if (isSet(object.pagination)) obj.pagination = PageResponse.fromJSON(object.pagination); + if (isSet(object.height)) obj.height = Height.fromJSON(object.height); + return obj; + }, + toJSON(message: QueryPacketCommitmentsResponse): unknown { + const obj: any = {}; + if (message.commitments) { + obj.commitments = message.commitments.map((e) => (e ? PacketState.toJSON(e) : undefined)); + } else { + obj.commitments = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + message.height !== undefined && (obj.height = message.height ? Height.toJSON(message.height) : undefined); + return obj; + }, + fromPartial(object: Partial): QueryPacketCommitmentsResponse { + const message = createBaseQueryPacketCommitmentsResponse(); + message.commitments = object.commitments?.map((e) => PacketState.fromPartial(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromPartial(object.pagination); + } + if (object.height !== undefined && object.height !== null) { + message.height = Height.fromPartial(object.height); + } + return message; + }, +}; +function createBaseQueryPacketAcknowledgementRequest(): QueryPacketAcknowledgementRequest { + return { + clientId: "", + sequence: BigInt(0), + }; +} +export const QueryPacketAcknowledgementRequest = { + encode( + message: QueryPacketAcknowledgementRequest, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.sequence !== BigInt(0)) { + writer.uint32(16).uint64(message.sequence); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryPacketAcknowledgementRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPacketAcknowledgementRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.sequence = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryPacketAcknowledgementRequest { + const obj = createBaseQueryPacketAcknowledgementRequest(); + if (isSet(object.clientId)) obj.clientId = String(object.clientId); + if (isSet(object.sequence)) obj.sequence = BigInt(object.sequence.toString()); + return obj; + }, + toJSON(message: QueryPacketAcknowledgementRequest): unknown { + const obj: any = {}; + message.clientId !== undefined && (obj.clientId = message.clientId); + message.sequence !== undefined && (obj.sequence = (message.sequence || BigInt(0)).toString()); + return obj; + }, + fromPartial(object: Partial): QueryPacketAcknowledgementRequest { + const message = createBaseQueryPacketAcknowledgementRequest(); + message.clientId = object.clientId ?? ""; + if (object.sequence !== undefined && object.sequence !== null) { + message.sequence = BigInt(object.sequence.toString()); + } + return message; + }, +}; +function createBaseQueryPacketAcknowledgementResponse(): QueryPacketAcknowledgementResponse { + return { + acknowledgement: new Uint8Array(), + proof: new Uint8Array(), + proofHeight: Height.fromPartial({}), + }; +} +export const QueryPacketAcknowledgementResponse = { + encode( + message: QueryPacketAcknowledgementResponse, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.acknowledgement.length !== 0) { + writer.uint32(10).bytes(message.acknowledgement); + } + if (message.proof.length !== 0) { + writer.uint32(18).bytes(message.proof); + } + if (message.proofHeight !== undefined) { + Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryPacketAcknowledgementResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPacketAcknowledgementResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.acknowledgement = reader.bytes(); + break; + case 2: + message.proof = reader.bytes(); + break; + case 3: + message.proofHeight = Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryPacketAcknowledgementResponse { + const obj = createBaseQueryPacketAcknowledgementResponse(); + if (isSet(object.acknowledgement)) obj.acknowledgement = bytesFromBase64(object.acknowledgement); + if (isSet(object.proof)) obj.proof = bytesFromBase64(object.proof); + if (isSet(object.proofHeight)) obj.proofHeight = Height.fromJSON(object.proofHeight); + return obj; + }, + toJSON(message: QueryPacketAcknowledgementResponse): unknown { + const obj: any = {}; + message.acknowledgement !== undefined && + (obj.acknowledgement = base64FromBytes( + message.acknowledgement !== undefined ? message.acknowledgement : new Uint8Array(), + )); + message.proof !== undefined && + (obj.proof = base64FromBytes(message.proof !== undefined ? message.proof : new Uint8Array())); + message.proofHeight !== undefined && + (obj.proofHeight = message.proofHeight ? Height.toJSON(message.proofHeight) : undefined); + return obj; + }, + fromPartial(object: Partial): QueryPacketAcknowledgementResponse { + const message = createBaseQueryPacketAcknowledgementResponse(); + message.acknowledgement = object.acknowledgement ?? new Uint8Array(); + message.proof = object.proof ?? new Uint8Array(); + if (object.proofHeight !== undefined && object.proofHeight !== null) { + message.proofHeight = Height.fromPartial(object.proofHeight); + } + return message; + }, +}; +function createBaseQueryPacketAcknowledgementsRequest(): QueryPacketAcknowledgementsRequest { + return { + clientId: "", + pagination: PageRequest.fromPartial({}), + packetCommitmentSequences: [], + }; +} +export const QueryPacketAcknowledgementsRequest = { + encode( + message: QueryPacketAcknowledgementsRequest, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + writer.uint32(26).fork(); + for (const v of message.packetCommitmentSequences) { + writer.uint64(v); + } + writer.ldelim(); + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryPacketAcknowledgementsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPacketAcknowledgementsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + case 3: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.packetCommitmentSequences.push(reader.uint64()); + } + } else { + message.packetCommitmentSequences.push(reader.uint64()); + } + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryPacketAcknowledgementsRequest { + const obj = createBaseQueryPacketAcknowledgementsRequest(); + if (isSet(object.clientId)) obj.clientId = String(object.clientId); + if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); + if (Array.isArray(object?.packetCommitmentSequences)) + obj.packetCommitmentSequences = object.packetCommitmentSequences.map((e: any) => BigInt(e.toString())); + return obj; + }, + toJSON(message: QueryPacketAcknowledgementsRequest): unknown { + const obj: any = {}; + message.clientId !== undefined && (obj.clientId = message.clientId); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + if (message.packetCommitmentSequences) { + obj.packetCommitmentSequences = message.packetCommitmentSequences.map((e) => + (e || BigInt(0)).toString(), + ); + } else { + obj.packetCommitmentSequences = []; + } + return obj; + }, + fromPartial(object: Partial): QueryPacketAcknowledgementsRequest { + const message = createBaseQueryPacketAcknowledgementsRequest(); + message.clientId = object.clientId ?? ""; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromPartial(object.pagination); + } + message.packetCommitmentSequences = + object.packetCommitmentSequences?.map((e) => BigInt(e.toString())) || []; + return message; + }, +}; +function createBaseQueryPacketAcknowledgementsResponse(): QueryPacketAcknowledgementsResponse { + return { + acknowledgements: [], + pagination: PageResponse.fromPartial({}), + height: Height.fromPartial({}), + }; +} +export const QueryPacketAcknowledgementsResponse = { + encode( + message: QueryPacketAcknowledgementsResponse, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + for (const v of message.acknowledgements) { + PacketState.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + if (message.height !== undefined) { + Height.encode(message.height, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryPacketAcknowledgementsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPacketAcknowledgementsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.acknowledgements.push(PacketState.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + case 3: + message.height = Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryPacketAcknowledgementsResponse { + const obj = createBaseQueryPacketAcknowledgementsResponse(); + if (Array.isArray(object?.acknowledgements)) + obj.acknowledgements = object.acknowledgements.map((e: any) => PacketState.fromJSON(e)); + if (isSet(object.pagination)) obj.pagination = PageResponse.fromJSON(object.pagination); + if (isSet(object.height)) obj.height = Height.fromJSON(object.height); + return obj; + }, + toJSON(message: QueryPacketAcknowledgementsResponse): unknown { + const obj: any = {}; + if (message.acknowledgements) { + obj.acknowledgements = message.acknowledgements.map((e) => (e ? PacketState.toJSON(e) : undefined)); + } else { + obj.acknowledgements = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + message.height !== undefined && (obj.height = message.height ? Height.toJSON(message.height) : undefined); + return obj; + }, + fromPartial(object: Partial): QueryPacketAcknowledgementsResponse { + const message = createBaseQueryPacketAcknowledgementsResponse(); + message.acknowledgements = object.acknowledgements?.map((e) => PacketState.fromPartial(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromPartial(object.pagination); + } + if (object.height !== undefined && object.height !== null) { + message.height = Height.fromPartial(object.height); + } + return message; + }, +}; +function createBaseQueryPacketReceiptRequest(): QueryPacketReceiptRequest { + return { + clientId: "", + sequence: BigInt(0), + }; +} +export const QueryPacketReceiptRequest = { + encode(message: QueryPacketReceiptRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.sequence !== BigInt(0)) { + writer.uint32(16).uint64(message.sequence); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryPacketReceiptRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPacketReceiptRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.sequence = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryPacketReceiptRequest { + const obj = createBaseQueryPacketReceiptRequest(); + if (isSet(object.clientId)) obj.clientId = String(object.clientId); + if (isSet(object.sequence)) obj.sequence = BigInt(object.sequence.toString()); + return obj; + }, + toJSON(message: QueryPacketReceiptRequest): unknown { + const obj: any = {}; + message.clientId !== undefined && (obj.clientId = message.clientId); + message.sequence !== undefined && (obj.sequence = (message.sequence || BigInt(0)).toString()); + return obj; + }, + fromPartial(object: Partial): QueryPacketReceiptRequest { + const message = createBaseQueryPacketReceiptRequest(); + message.clientId = object.clientId ?? ""; + if (object.sequence !== undefined && object.sequence !== null) { + message.sequence = BigInt(object.sequence.toString()); + } + return message; + }, +}; +function createBaseQueryPacketReceiptResponse(): QueryPacketReceiptResponse { + return { + received: false, + proof: new Uint8Array(), + proofHeight: Height.fromPartial({}), + }; +} +export const QueryPacketReceiptResponse = { + encode(message: QueryPacketReceiptResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.received === true) { + writer.uint32(16).bool(message.received); + } + if (message.proof.length !== 0) { + writer.uint32(26).bytes(message.proof); + } + if (message.proofHeight !== undefined) { + Height.encode(message.proofHeight, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryPacketReceiptResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPacketReceiptResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + message.received = reader.bool(); + break; + case 3: + message.proof = reader.bytes(); + break; + case 4: + message.proofHeight = Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryPacketReceiptResponse { + const obj = createBaseQueryPacketReceiptResponse(); + if (isSet(object.received)) obj.received = Boolean(object.received); + if (isSet(object.proof)) obj.proof = bytesFromBase64(object.proof); + if (isSet(object.proofHeight)) obj.proofHeight = Height.fromJSON(object.proofHeight); + return obj; + }, + toJSON(message: QueryPacketReceiptResponse): unknown { + const obj: any = {}; + message.received !== undefined && (obj.received = message.received); + message.proof !== undefined && + (obj.proof = base64FromBytes(message.proof !== undefined ? message.proof : new Uint8Array())); + message.proofHeight !== undefined && + (obj.proofHeight = message.proofHeight ? Height.toJSON(message.proofHeight) : undefined); + return obj; + }, + fromPartial(object: Partial): QueryPacketReceiptResponse { + const message = createBaseQueryPacketReceiptResponse(); + message.received = object.received ?? false; + message.proof = object.proof ?? new Uint8Array(); + if (object.proofHeight !== undefined && object.proofHeight !== null) { + message.proofHeight = Height.fromPartial(object.proofHeight); + } + return message; + }, +}; +function createBaseQueryUnreceivedPacketsRequest(): QueryUnreceivedPacketsRequest { + return { + clientId: "", + sequences: [], + }; +} +export const QueryUnreceivedPacketsRequest = { + encode(message: QueryUnreceivedPacketsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + writer.uint32(18).fork(); + for (const v of message.sequences) { + writer.uint64(v); + } + writer.ldelim(); + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryUnreceivedPacketsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryUnreceivedPacketsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.sequences.push(reader.uint64()); + } + } else { + message.sequences.push(reader.uint64()); + } + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryUnreceivedPacketsRequest { + const obj = createBaseQueryUnreceivedPacketsRequest(); + if (isSet(object.clientId)) obj.clientId = String(object.clientId); + if (Array.isArray(object?.sequences)) + obj.sequences = object.sequences.map((e: any) => BigInt(e.toString())); + return obj; + }, + toJSON(message: QueryUnreceivedPacketsRequest): unknown { + const obj: any = {}; + message.clientId !== undefined && (obj.clientId = message.clientId); + if (message.sequences) { + obj.sequences = message.sequences.map((e) => (e || BigInt(0)).toString()); + } else { + obj.sequences = []; + } + return obj; + }, + fromPartial(object: Partial): QueryUnreceivedPacketsRequest { + const message = createBaseQueryUnreceivedPacketsRequest(); + message.clientId = object.clientId ?? ""; + message.sequences = object.sequences?.map((e) => BigInt(e.toString())) || []; + return message; + }, +}; +function createBaseQueryUnreceivedPacketsResponse(): QueryUnreceivedPacketsResponse { + return { + sequences: [], + height: Height.fromPartial({}), + }; +} +export const QueryUnreceivedPacketsResponse = { + encode( + message: QueryUnreceivedPacketsResponse, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + writer.uint32(10).fork(); + for (const v of message.sequences) { + writer.uint64(v); + } + writer.ldelim(); + if (message.height !== undefined) { + Height.encode(message.height, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryUnreceivedPacketsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryUnreceivedPacketsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.sequences.push(reader.uint64()); + } + } else { + message.sequences.push(reader.uint64()); + } + break; + case 2: + message.height = Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryUnreceivedPacketsResponse { + const obj = createBaseQueryUnreceivedPacketsResponse(); + if (Array.isArray(object?.sequences)) + obj.sequences = object.sequences.map((e: any) => BigInt(e.toString())); + if (isSet(object.height)) obj.height = Height.fromJSON(object.height); + return obj; + }, + toJSON(message: QueryUnreceivedPacketsResponse): unknown { + const obj: any = {}; + if (message.sequences) { + obj.sequences = message.sequences.map((e) => (e || BigInt(0)).toString()); + } else { + obj.sequences = []; + } + message.height !== undefined && (obj.height = message.height ? Height.toJSON(message.height) : undefined); + return obj; + }, + fromPartial(object: Partial): QueryUnreceivedPacketsResponse { + const message = createBaseQueryUnreceivedPacketsResponse(); + message.sequences = object.sequences?.map((e) => BigInt(e.toString())) || []; + if (object.height !== undefined && object.height !== null) { + message.height = Height.fromPartial(object.height); + } + return message; + }, +}; +function createBaseQueryUnreceivedAcksRequest(): QueryUnreceivedAcksRequest { + return { + clientId: "", + packetAckSequences: [], + }; +} +export const QueryUnreceivedAcksRequest = { + encode(message: QueryUnreceivedAcksRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + writer.uint32(18).fork(); + for (const v of message.packetAckSequences) { + writer.uint64(v); + } + writer.ldelim(); + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryUnreceivedAcksRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryUnreceivedAcksRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.packetAckSequences.push(reader.uint64()); + } + } else { + message.packetAckSequences.push(reader.uint64()); + } + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryUnreceivedAcksRequest { + const obj = createBaseQueryUnreceivedAcksRequest(); + if (isSet(object.clientId)) obj.clientId = String(object.clientId); + if (Array.isArray(object?.packetAckSequences)) + obj.packetAckSequences = object.packetAckSequences.map((e: any) => BigInt(e.toString())); + return obj; + }, + toJSON(message: QueryUnreceivedAcksRequest): unknown { + const obj: any = {}; + message.clientId !== undefined && (obj.clientId = message.clientId); + if (message.packetAckSequences) { + obj.packetAckSequences = message.packetAckSequences.map((e) => (e || BigInt(0)).toString()); + } else { + obj.packetAckSequences = []; + } + return obj; + }, + fromPartial(object: Partial): QueryUnreceivedAcksRequest { + const message = createBaseQueryUnreceivedAcksRequest(); + message.clientId = object.clientId ?? ""; + message.packetAckSequences = object.packetAckSequences?.map((e) => BigInt(e.toString())) || []; + return message; + }, +}; +function createBaseQueryUnreceivedAcksResponse(): QueryUnreceivedAcksResponse { + return { + sequences: [], + height: Height.fromPartial({}), + }; +} +export const QueryUnreceivedAcksResponse = { + encode(message: QueryUnreceivedAcksResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + writer.uint32(10).fork(); + for (const v of message.sequences) { + writer.uint64(v); + } + writer.ldelim(); + if (message.height !== undefined) { + Height.encode(message.height, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryUnreceivedAcksResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryUnreceivedAcksResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.sequences.push(reader.uint64()); + } + } else { + message.sequences.push(reader.uint64()); + } + break; + case 2: + message.height = Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryUnreceivedAcksResponse { + const obj = createBaseQueryUnreceivedAcksResponse(); + if (Array.isArray(object?.sequences)) + obj.sequences = object.sequences.map((e: any) => BigInt(e.toString())); + if (isSet(object.height)) obj.height = Height.fromJSON(object.height); + return obj; + }, + toJSON(message: QueryUnreceivedAcksResponse): unknown { + const obj: any = {}; + if (message.sequences) { + obj.sequences = message.sequences.map((e) => (e || BigInt(0)).toString()); + } else { + obj.sequences = []; + } + message.height !== undefined && (obj.height = message.height ? Height.toJSON(message.height) : undefined); + return obj; + }, + fromPartial(object: Partial): QueryUnreceivedAcksResponse { + const message = createBaseQueryUnreceivedAcksResponse(); + message.sequences = object.sequences?.map((e) => BigInt(e.toString())) || []; + if (object.height !== undefined && object.height !== null) { + message.height = Height.fromPartial(object.height); + } + return message; + }, +}; +/** Query provides defines the gRPC querier service */ +export interface Query { + /** NextSequenceSend returns the next send sequence for a given channel. */ + NextSequenceSend(request: QueryNextSequenceSendRequest): Promise; + /** PacketCommitment queries a stored packet commitment hash. */ + PacketCommitment(request: QueryPacketCommitmentRequest): Promise; + /** PacketCommitments queries a stored packet commitment hash. */ + PacketCommitments(request: QueryPacketCommitmentsRequest): Promise; + /** PacketAcknowledgement queries a stored acknowledgement commitment hash. */ + PacketAcknowledgement( + request: QueryPacketAcknowledgementRequest, + ): Promise; + /** PacketAcknowledgements returns all packet acknowledgements associated with a channel. */ + PacketAcknowledgements( + request: QueryPacketAcknowledgementsRequest, + ): Promise; + /** PacketReceipt queries a stored packet receipt. */ + PacketReceipt(request: QueryPacketReceiptRequest): Promise; + /** UnreceivedPackets returns all the unreceived IBC packets associated with a channel and sequences. */ + UnreceivedPackets(request: QueryUnreceivedPacketsRequest): Promise; + /** UnreceivedAcks returns all the unreceived IBC acknowledgements associated with a channel and sequences. */ + UnreceivedAcks(request: QueryUnreceivedAcksRequest): Promise; +} +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + this.NextSequenceSend = this.NextSequenceSend.bind(this); + this.PacketCommitment = this.PacketCommitment.bind(this); + this.PacketCommitments = this.PacketCommitments.bind(this); + this.PacketAcknowledgement = this.PacketAcknowledgement.bind(this); + this.PacketAcknowledgements = this.PacketAcknowledgements.bind(this); + this.PacketReceipt = this.PacketReceipt.bind(this); + this.UnreceivedPackets = this.UnreceivedPackets.bind(this); + this.UnreceivedAcks = this.UnreceivedAcks.bind(this); + } + NextSequenceSend(request: QueryNextSequenceSendRequest): Promise { + const data = QueryNextSequenceSendRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.channel.v2.Query", "NextSequenceSend", data); + return promise.then((data) => QueryNextSequenceSendResponse.decode(new BinaryReader(data))); + } + PacketCommitment(request: QueryPacketCommitmentRequest): Promise { + const data = QueryPacketCommitmentRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.channel.v2.Query", "PacketCommitment", data); + return promise.then((data) => QueryPacketCommitmentResponse.decode(new BinaryReader(data))); + } + PacketCommitments(request: QueryPacketCommitmentsRequest): Promise { + const data = QueryPacketCommitmentsRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.channel.v2.Query", "PacketCommitments", data); + return promise.then((data) => QueryPacketCommitmentsResponse.decode(new BinaryReader(data))); + } + PacketAcknowledgement( + request: QueryPacketAcknowledgementRequest, + ): Promise { + const data = QueryPacketAcknowledgementRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.channel.v2.Query", "PacketAcknowledgement", data); + return promise.then((data) => QueryPacketAcknowledgementResponse.decode(new BinaryReader(data))); + } + PacketAcknowledgements( + request: QueryPacketAcknowledgementsRequest, + ): Promise { + const data = QueryPacketAcknowledgementsRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.channel.v2.Query", "PacketAcknowledgements", data); + return promise.then((data) => QueryPacketAcknowledgementsResponse.decode(new BinaryReader(data))); + } + PacketReceipt(request: QueryPacketReceiptRequest): Promise { + const data = QueryPacketReceiptRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.channel.v2.Query", "PacketReceipt", data); + return promise.then((data) => QueryPacketReceiptResponse.decode(new BinaryReader(data))); + } + UnreceivedPackets(request: QueryUnreceivedPacketsRequest): Promise { + const data = QueryUnreceivedPacketsRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.channel.v2.Query", "UnreceivedPackets", data); + return promise.then((data) => QueryUnreceivedPacketsResponse.decode(new BinaryReader(data))); + } + UnreceivedAcks(request: QueryUnreceivedAcksRequest): Promise { + const data = QueryUnreceivedAcksRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.channel.v2.Query", "UnreceivedAcks", data); + return promise.then((data) => QueryUnreceivedAcksResponse.decode(new BinaryReader(data))); + } +} diff --git a/src/ibc/core/channel/v2/tx.amino.ts b/src/ibc/core/channel/v2/tx.amino.ts new file mode 100644 index 0000000..08ece2e --- /dev/null +++ b/src/ibc/core/channel/v2/tx.amino.ts @@ -0,0 +1,320 @@ +/* eslint-disable */ +import { AminoMsg } from "@cosmjs/amino"; +import { AminoHeight, omitDefault } from "../../../../helpers"; +import { MsgSendPacket, MsgRecvPacket, MsgTimeout, MsgAcknowledgement } from "./tx"; +export interface MsgSendPacketAminoType extends AminoMsg { + type: "cosmos-sdk/MsgSendPacket"; + value: { + source_client: string; + timeout_timestamp: string; + payloads: { + source_port: string; + destination_port: string; + version: string; + encoding: string; + value: Uint8Array; + }[]; + signer: string; + }; +} +export interface MsgRecvPacketAminoType extends AminoMsg { + type: "cosmos-sdk/MsgRecvPacket"; + value: { + packet: { + sequence: string; + source_client: string; + destination_client: string; + timeout_timestamp: string; + payloads: { + source_port: string; + destination_port: string; + version: string; + encoding: string; + value: Uint8Array; + }[]; + }; + proof_commitment: Uint8Array; + proof_height: AminoHeight; + signer: string; + }; +} +export interface MsgTimeoutAminoType extends AminoMsg { + type: "cosmos-sdk/MsgTimeout"; + value: { + packet: { + sequence: string; + source_client: string; + destination_client: string; + timeout_timestamp: string; + payloads: { + source_port: string; + destination_port: string; + version: string; + encoding: string; + value: Uint8Array; + }[]; + }; + proof_unreceived: Uint8Array; + proof_height: AminoHeight; + signer: string; + }; +} +export interface MsgAcknowledgementAminoType extends AminoMsg { + type: "cosmos-sdk/MsgAcknowledgement"; + value: { + packet: { + sequence: string; + source_client: string; + destination_client: string; + timeout_timestamp: string; + payloads: { + source_port: string; + destination_port: string; + version: string; + encoding: string; + value: Uint8Array; + }[]; + }; + acknowledgement: { + app_acknowledgements: Uint8Array[]; + }; + proof_acked: Uint8Array; + proof_height: AminoHeight; + signer: string; + }; +} +export const AminoConverter = { + "/ibc.core.channel.v2.MsgSendPacket": { + aminoType: "cosmos-sdk/MsgSendPacket", + toAmino: ({ + sourceClient, + timeoutTimestamp, + payloads, + signer, + }: MsgSendPacket): MsgSendPacketAminoType["value"] => { + return { + source_client: sourceClient, + timeout_timestamp: timeoutTimestamp.toString(), + payloads: payloads.map((el0) => ({ + source_port: el0.sourcePort, + destination_port: el0.destinationPort, + version: el0.version, + encoding: el0.encoding, + value: el0.value, + })), + signer, + }; + }, + fromAmino: ({ + source_client, + timeout_timestamp, + payloads, + signer, + }: MsgSendPacketAminoType["value"]): MsgSendPacket => { + return { + sourceClient: source_client, + timeoutTimestamp: BigInt(timeout_timestamp), + payloads: payloads.map((el0) => ({ + sourcePort: el0.source_port, + destinationPort: el0.destination_port, + version: el0.version, + encoding: el0.encoding, + value: el0.value, + })), + signer, + }; + }, + }, + "/ibc.core.channel.v2.MsgRecvPacket": { + aminoType: "cosmos-sdk/MsgRecvPacket", + toAmino: ({ + packet, + proofCommitment, + proofHeight, + signer, + }: MsgRecvPacket): MsgRecvPacketAminoType["value"] => { + return { + packet: { + sequence: packet.sequence.toString(), + source_client: packet.sourceClient, + destination_client: packet.destinationClient, + timeout_timestamp: packet.timeoutTimestamp.toString(), + payloads: packet.payloads.map((el0) => ({ + source_port: el0.sourcePort, + destination_port: el0.destinationPort, + version: el0.version, + encoding: el0.encoding, + value: el0.value, + })), + }, + proof_commitment: proofCommitment, + proof_height: proofHeight + ? { + revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), + revision_number: omitDefault(proofHeight.revisionNumber)?.toString(), + } + : {}, + signer, + }; + }, + fromAmino: ({ + packet, + proof_commitment, + proof_height, + signer, + }: MsgRecvPacketAminoType["value"]): MsgRecvPacket => { + return { + packet: { + sequence: BigInt(packet.sequence), + sourceClient: packet.source_client, + destinationClient: packet.destination_client, + timeoutTimestamp: BigInt(packet.timeout_timestamp), + payloads: packet.payloads.map((el1) => ({ + sourcePort: el1.source_port, + destinationPort: el1.destination_port, + version: el1.version, + encoding: el1.encoding, + value: el1.value, + })), + }, + proofCommitment: proof_commitment, + proofHeight: proof_height + ? { + revisionHeight: BigInt(proof_height.revision_height || "0"), + revisionNumber: BigInt(proof_height.revision_number || "0"), + } + : undefined, + signer, + }; + }, + }, + "/ibc.core.channel.v2.MsgTimeout": { + aminoType: "cosmos-sdk/MsgTimeout", + toAmino: ({ packet, proofUnreceived, proofHeight, signer }: MsgTimeout): MsgTimeoutAminoType["value"] => { + return { + packet: { + sequence: packet.sequence.toString(), + source_client: packet.sourceClient, + destination_client: packet.destinationClient, + timeout_timestamp: packet.timeoutTimestamp.toString(), + payloads: packet.payloads.map((el0) => ({ + source_port: el0.sourcePort, + destination_port: el0.destinationPort, + version: el0.version, + encoding: el0.encoding, + value: el0.value, + })), + }, + proof_unreceived: proofUnreceived, + proof_height: proofHeight + ? { + revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), + revision_number: omitDefault(proofHeight.revisionNumber)?.toString(), + } + : {}, + signer, + }; + }, + fromAmino: ({ + packet, + proof_unreceived, + proof_height, + signer, + }: MsgTimeoutAminoType["value"]): MsgTimeout => { + return { + packet: { + sequence: BigInt(packet.sequence), + sourceClient: packet.source_client, + destinationClient: packet.destination_client, + timeoutTimestamp: BigInt(packet.timeout_timestamp), + payloads: packet.payloads.map((el1) => ({ + sourcePort: el1.source_port, + destinationPort: el1.destination_port, + version: el1.version, + encoding: el1.encoding, + value: el1.value, + })), + }, + proofUnreceived: proof_unreceived, + proofHeight: proof_height + ? { + revisionHeight: BigInt(proof_height.revision_height || "0"), + revisionNumber: BigInt(proof_height.revision_number || "0"), + } + : undefined, + signer, + }; + }, + }, + "/ibc.core.channel.v2.MsgAcknowledgement": { + aminoType: "cosmos-sdk/MsgAcknowledgement", + toAmino: ({ + packet, + acknowledgement, + proofAcked, + proofHeight, + signer, + }: MsgAcknowledgement): MsgAcknowledgementAminoType["value"] => { + return { + packet: { + sequence: packet.sequence.toString(), + source_client: packet.sourceClient, + destination_client: packet.destinationClient, + timeout_timestamp: packet.timeoutTimestamp.toString(), + payloads: packet.payloads.map((el0) => ({ + source_port: el0.sourcePort, + destination_port: el0.destinationPort, + version: el0.version, + encoding: el0.encoding, + value: el0.value, + })), + }, + acknowledgement: { + app_acknowledgements: acknowledgement.appAcknowledgements, + }, + proof_acked: proofAcked, + proof_height: proofHeight + ? { + revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), + revision_number: omitDefault(proofHeight.revisionNumber)?.toString(), + } + : {}, + signer, + }; + }, + fromAmino: ({ + packet, + acknowledgement, + proof_acked, + proof_height, + signer, + }: MsgAcknowledgementAminoType["value"]): MsgAcknowledgement => { + return { + packet: { + sequence: BigInt(packet.sequence), + sourceClient: packet.source_client, + destinationClient: packet.destination_client, + timeoutTimestamp: BigInt(packet.timeout_timestamp), + payloads: packet.payloads.map((el1) => ({ + sourcePort: el1.source_port, + destinationPort: el1.destination_port, + version: el1.version, + encoding: el1.encoding, + value: el1.value, + })), + }, + acknowledgement: { + appAcknowledgements: acknowledgement.app_acknowledgements, + }, + proofAcked: proof_acked, + proofHeight: proof_height + ? { + revisionHeight: BigInt(proof_height.revision_height || "0"), + revisionNumber: BigInt(proof_height.revision_number || "0"), + } + : undefined, + signer, + }; + }, + }, +}; diff --git a/src/ibc/core/channel/v2/tx.registry.ts b/src/ibc/core/channel/v2/tx.registry.ts new file mode 100644 index 0000000..897b19e --- /dev/null +++ b/src/ibc/core/channel/v2/tx.registry.ts @@ -0,0 +1,147 @@ +//@ts-nocheck +/* eslint-disable */ +import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { MsgSendPacket, MsgRecvPacket, MsgTimeout, MsgAcknowledgement } from "./tx"; +export const registry: ReadonlyArray<[string, GeneratedType]> = [ + ["/ibc.core.channel.v2.MsgSendPacket", MsgSendPacket], + ["/ibc.core.channel.v2.MsgRecvPacket", MsgRecvPacket], + ["/ibc.core.channel.v2.MsgTimeout", MsgTimeout], + ["/ibc.core.channel.v2.MsgAcknowledgement", MsgAcknowledgement], +]; +export const load = (protoRegistry: Registry) => { + registry.forEach(([typeUrl, mod]) => { + protoRegistry.register(typeUrl, mod); + }); +}; +export const MessageComposer = { + encoded: { + sendPacket(value: MsgSendPacket) { + return { + typeUrl: "/ibc.core.channel.v2.MsgSendPacket", + value: MsgSendPacket.encode(value).finish(), + }; + }, + recvPacket(value: MsgRecvPacket) { + return { + typeUrl: "/ibc.core.channel.v2.MsgRecvPacket", + value: MsgRecvPacket.encode(value).finish(), + }; + }, + timeout(value: MsgTimeout) { + return { + typeUrl: "/ibc.core.channel.v2.MsgTimeout", + value: MsgTimeout.encode(value).finish(), + }; + }, + acknowledgement(value: MsgAcknowledgement) { + return { + typeUrl: "/ibc.core.channel.v2.MsgAcknowledgement", + value: MsgAcknowledgement.encode(value).finish(), + }; + }, + }, + withTypeUrl: { + sendPacket(value: MsgSendPacket) { + return { + typeUrl: "/ibc.core.channel.v2.MsgSendPacket", + value, + }; + }, + recvPacket(value: MsgRecvPacket) { + return { + typeUrl: "/ibc.core.channel.v2.MsgRecvPacket", + value, + }; + }, + timeout(value: MsgTimeout) { + return { + typeUrl: "/ibc.core.channel.v2.MsgTimeout", + value, + }; + }, + acknowledgement(value: MsgAcknowledgement) { + return { + typeUrl: "/ibc.core.channel.v2.MsgAcknowledgement", + value, + }; + }, + }, + toJSON: { + sendPacket(value: MsgSendPacket) { + return { + typeUrl: "/ibc.core.channel.v2.MsgSendPacket", + value: MsgSendPacket.toJSON(value), + }; + }, + recvPacket(value: MsgRecvPacket) { + return { + typeUrl: "/ibc.core.channel.v2.MsgRecvPacket", + value: MsgRecvPacket.toJSON(value), + }; + }, + timeout(value: MsgTimeout) { + return { + typeUrl: "/ibc.core.channel.v2.MsgTimeout", + value: MsgTimeout.toJSON(value), + }; + }, + acknowledgement(value: MsgAcknowledgement) { + return { + typeUrl: "/ibc.core.channel.v2.MsgAcknowledgement", + value: MsgAcknowledgement.toJSON(value), + }; + }, + }, + fromJSON: { + sendPacket(value: any) { + return { + typeUrl: "/ibc.core.channel.v2.MsgSendPacket", + value: MsgSendPacket.fromJSON(value), + }; + }, + recvPacket(value: any) { + return { + typeUrl: "/ibc.core.channel.v2.MsgRecvPacket", + value: MsgRecvPacket.fromJSON(value), + }; + }, + timeout(value: any) { + return { + typeUrl: "/ibc.core.channel.v2.MsgTimeout", + value: MsgTimeout.fromJSON(value), + }; + }, + acknowledgement(value: any) { + return { + typeUrl: "/ibc.core.channel.v2.MsgAcknowledgement", + value: MsgAcknowledgement.fromJSON(value), + }; + }, + }, + fromPartial: { + sendPacket(value: MsgSendPacket) { + return { + typeUrl: "/ibc.core.channel.v2.MsgSendPacket", + value: MsgSendPacket.fromPartial(value), + }; + }, + recvPacket(value: MsgRecvPacket) { + return { + typeUrl: "/ibc.core.channel.v2.MsgRecvPacket", + value: MsgRecvPacket.fromPartial(value), + }; + }, + timeout(value: MsgTimeout) { + return { + typeUrl: "/ibc.core.channel.v2.MsgTimeout", + value: MsgTimeout.fromPartial(value), + }; + }, + acknowledgement(value: MsgAcknowledgement) { + return { + typeUrl: "/ibc.core.channel.v2.MsgAcknowledgement", + value: MsgAcknowledgement.fromPartial(value), + }; + }, + }, +}; diff --git a/src/ibc/core/channel/v2/tx.ts b/src/ibc/core/channel/v2/tx.ts new file mode 100644 index 0000000..2c89351 --- /dev/null +++ b/src/ibc/core/channel/v2/tx.ts @@ -0,0 +1,667 @@ +/* eslint-disable */ +import { Payload, Packet, Acknowledgement } from "./packet"; +import { Height } from "../../client/v1/client"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { isSet, bytesFromBase64, base64FromBytes, Rpc } from "../../../../helpers"; +export const protobufPackage = "ibc.core.channel.v2"; +/** ResponseResultType defines the possible outcomes of the execution of a message */ +export enum ResponseResultType { + /** RESPONSE_RESULT_TYPE_UNSPECIFIED - Default zero value enumeration */ + RESPONSE_RESULT_TYPE_UNSPECIFIED = 0, + /** RESPONSE_RESULT_TYPE_NOOP - The message did not call the IBC application callbacks (because, for example, the packet had already been relayed) */ + RESPONSE_RESULT_TYPE_NOOP = 1, + /** RESPONSE_RESULT_TYPE_SUCCESS - The message was executed successfully */ + RESPONSE_RESULT_TYPE_SUCCESS = 2, + /** RESPONSE_RESULT_TYPE_FAILURE - The message was executed unsuccessfully */ + RESPONSE_RESULT_TYPE_FAILURE = 3, + UNRECOGNIZED = -1, +} +export function responseResultTypeFromJSON(object: any): ResponseResultType { + switch (object) { + case 0: + case "RESPONSE_RESULT_TYPE_UNSPECIFIED": + return ResponseResultType.RESPONSE_RESULT_TYPE_UNSPECIFIED; + case 1: + case "RESPONSE_RESULT_TYPE_NOOP": + return ResponseResultType.RESPONSE_RESULT_TYPE_NOOP; + case 2: + case "RESPONSE_RESULT_TYPE_SUCCESS": + return ResponseResultType.RESPONSE_RESULT_TYPE_SUCCESS; + case 3: + case "RESPONSE_RESULT_TYPE_FAILURE": + return ResponseResultType.RESPONSE_RESULT_TYPE_FAILURE; + case -1: + case "UNRECOGNIZED": + default: + return ResponseResultType.UNRECOGNIZED; + } +} +export function responseResultTypeToJSON(object: ResponseResultType): string { + switch (object) { + case ResponseResultType.RESPONSE_RESULT_TYPE_UNSPECIFIED: + return "RESPONSE_RESULT_TYPE_UNSPECIFIED"; + case ResponseResultType.RESPONSE_RESULT_TYPE_NOOP: + return "RESPONSE_RESULT_TYPE_NOOP"; + case ResponseResultType.RESPONSE_RESULT_TYPE_SUCCESS: + return "RESPONSE_RESULT_TYPE_SUCCESS"; + case ResponseResultType.RESPONSE_RESULT_TYPE_FAILURE: + return "RESPONSE_RESULT_TYPE_FAILURE"; + case ResponseResultType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** MsgSendPacket sends an outgoing IBC packet. */ +export interface MsgSendPacket { + sourceClient: string; + timeoutTimestamp: bigint; + payloads: Payload[]; + signer: string; +} +/** MsgSendPacketResponse defines the Msg/SendPacket response type. */ +export interface MsgSendPacketResponse { + sequence: bigint; +} +/** MsgRecvPacket receives an incoming IBC packet. */ +export interface MsgRecvPacket { + packet: Packet; + proofCommitment: Uint8Array; + proofHeight: Height; + signer: string; +} +/** MsgRecvPacketResponse defines the Msg/RecvPacket response type. */ +export interface MsgRecvPacketResponse { + result: ResponseResultType; +} +/** MsgTimeout receives timed-out packet */ +export interface MsgTimeout { + packet: Packet; + proofUnreceived: Uint8Array; + proofHeight: Height; + signer: string; +} +/** MsgTimeoutResponse defines the Msg/Timeout response type. */ +export interface MsgTimeoutResponse { + result: ResponseResultType; +} +/** MsgAcknowledgement receives incoming IBC acknowledgement. */ +export interface MsgAcknowledgement { + packet: Packet; + acknowledgement: Acknowledgement; + proofAcked: Uint8Array; + proofHeight: Height; + signer: string; +} +/** MsgAcknowledgementResponse defines the Msg/Acknowledgement response type. */ +export interface MsgAcknowledgementResponse { + result: ResponseResultType; +} +function createBaseMsgSendPacket(): MsgSendPacket { + return { + sourceClient: "", + timeoutTimestamp: BigInt(0), + payloads: [], + signer: "", + }; +} +export const MsgSendPacket = { + encode(message: MsgSendPacket, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.sourceClient !== "") { + writer.uint32(10).string(message.sourceClient); + } + if (message.timeoutTimestamp !== BigInt(0)) { + writer.uint32(16).uint64(message.timeoutTimestamp); + } + for (const v of message.payloads) { + Payload.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.signer !== "") { + writer.uint32(34).string(message.signer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendPacket { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendPacket(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sourceClient = reader.string(); + break; + case 2: + message.timeoutTimestamp = reader.uint64(); + break; + case 3: + message.payloads.push(Payload.decode(reader, reader.uint32())); + break; + case 4: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgSendPacket { + const obj = createBaseMsgSendPacket(); + if (isSet(object.sourceClient)) obj.sourceClient = String(object.sourceClient); + if (isSet(object.timeoutTimestamp)) obj.timeoutTimestamp = BigInt(object.timeoutTimestamp.toString()); + if (Array.isArray(object?.payloads)) obj.payloads = object.payloads.map((e: any) => Payload.fromJSON(e)); + if (isSet(object.signer)) obj.signer = String(object.signer); + return obj; + }, + toJSON(message: MsgSendPacket): unknown { + const obj: any = {}; + message.sourceClient !== undefined && (obj.sourceClient = message.sourceClient); + message.timeoutTimestamp !== undefined && + (obj.timeoutTimestamp = (message.timeoutTimestamp || BigInt(0)).toString()); + if (message.payloads) { + obj.payloads = message.payloads.map((e) => (e ? Payload.toJSON(e) : undefined)); + } else { + obj.payloads = []; + } + message.signer !== undefined && (obj.signer = message.signer); + return obj; + }, + fromPartial(object: Partial): MsgSendPacket { + const message = createBaseMsgSendPacket(); + message.sourceClient = object.sourceClient ?? ""; + if (object.timeoutTimestamp !== undefined && object.timeoutTimestamp !== null) { + message.timeoutTimestamp = BigInt(object.timeoutTimestamp.toString()); + } + message.payloads = object.payloads?.map((e) => Payload.fromPartial(e)) || []; + message.signer = object.signer ?? ""; + return message; + }, +}; +function createBaseMsgSendPacketResponse(): MsgSendPacketResponse { + return { + sequence: BigInt(0), + }; +} +export const MsgSendPacketResponse = { + encode(message: MsgSendPacketResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.sequence !== BigInt(0)) { + writer.uint32(8).uint64(message.sequence); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendPacketResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendPacketResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sequence = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgSendPacketResponse { + const obj = createBaseMsgSendPacketResponse(); + if (isSet(object.sequence)) obj.sequence = BigInt(object.sequence.toString()); + return obj; + }, + toJSON(message: MsgSendPacketResponse): unknown { + const obj: any = {}; + message.sequence !== undefined && (obj.sequence = (message.sequence || BigInt(0)).toString()); + return obj; + }, + fromPartial(object: Partial): MsgSendPacketResponse { + const message = createBaseMsgSendPacketResponse(); + if (object.sequence !== undefined && object.sequence !== null) { + message.sequence = BigInt(object.sequence.toString()); + } + return message; + }, +}; +function createBaseMsgRecvPacket(): MsgRecvPacket { + return { + packet: Packet.fromPartial({}), + proofCommitment: new Uint8Array(), + proofHeight: Height.fromPartial({}), + signer: "", + }; +} +export const MsgRecvPacket = { + encode(message: MsgRecvPacket, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.packet !== undefined) { + Packet.encode(message.packet, writer.uint32(10).fork()).ldelim(); + } + if (message.proofCommitment.length !== 0) { + writer.uint32(18).bytes(message.proofCommitment); + } + if (message.proofHeight !== undefined) { + Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); + } + if (message.signer !== "") { + writer.uint32(34).string(message.signer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgRecvPacket { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRecvPacket(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.packet = Packet.decode(reader, reader.uint32()); + break; + case 2: + message.proofCommitment = reader.bytes(); + break; + case 3: + message.proofHeight = Height.decode(reader, reader.uint32()); + break; + case 4: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgRecvPacket { + const obj = createBaseMsgRecvPacket(); + if (isSet(object.packet)) obj.packet = Packet.fromJSON(object.packet); + if (isSet(object.proofCommitment)) obj.proofCommitment = bytesFromBase64(object.proofCommitment); + if (isSet(object.proofHeight)) obj.proofHeight = Height.fromJSON(object.proofHeight); + if (isSet(object.signer)) obj.signer = String(object.signer); + return obj; + }, + toJSON(message: MsgRecvPacket): unknown { + const obj: any = {}; + message.packet !== undefined && (obj.packet = message.packet ? Packet.toJSON(message.packet) : undefined); + message.proofCommitment !== undefined && + (obj.proofCommitment = base64FromBytes( + message.proofCommitment !== undefined ? message.proofCommitment : new Uint8Array(), + )); + message.proofHeight !== undefined && + (obj.proofHeight = message.proofHeight ? Height.toJSON(message.proofHeight) : undefined); + message.signer !== undefined && (obj.signer = message.signer); + return obj; + }, + fromPartial(object: Partial): MsgRecvPacket { + const message = createBaseMsgRecvPacket(); + if (object.packet !== undefined && object.packet !== null) { + message.packet = Packet.fromPartial(object.packet); + } + message.proofCommitment = object.proofCommitment ?? new Uint8Array(); + if (object.proofHeight !== undefined && object.proofHeight !== null) { + message.proofHeight = Height.fromPartial(object.proofHeight); + } + message.signer = object.signer ?? ""; + return message; + }, +}; +function createBaseMsgRecvPacketResponse(): MsgRecvPacketResponse { + return { + result: 0, + }; +} +export const MsgRecvPacketResponse = { + encode(message: MsgRecvPacketResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.result !== 0) { + writer.uint32(8).int32(message.result); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgRecvPacketResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRecvPacketResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.result = reader.int32() as any; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgRecvPacketResponse { + const obj = createBaseMsgRecvPacketResponse(); + if (isSet(object.result)) obj.result = responseResultTypeFromJSON(object.result); + return obj; + }, + toJSON(message: MsgRecvPacketResponse): unknown { + const obj: any = {}; + message.result !== undefined && (obj.result = responseResultTypeToJSON(message.result)); + return obj; + }, + fromPartial(object: Partial): MsgRecvPacketResponse { + const message = createBaseMsgRecvPacketResponse(); + message.result = object.result ?? 0; + return message; + }, +}; +function createBaseMsgTimeout(): MsgTimeout { + return { + packet: Packet.fromPartial({}), + proofUnreceived: new Uint8Array(), + proofHeight: Height.fromPartial({}), + signer: "", + }; +} +export const MsgTimeout = { + encode(message: MsgTimeout, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.packet !== undefined) { + Packet.encode(message.packet, writer.uint32(10).fork()).ldelim(); + } + if (message.proofUnreceived.length !== 0) { + writer.uint32(18).bytes(message.proofUnreceived); + } + if (message.proofHeight !== undefined) { + Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); + } + if (message.signer !== "") { + writer.uint32(42).string(message.signer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgTimeout { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgTimeout(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.packet = Packet.decode(reader, reader.uint32()); + break; + case 2: + message.proofUnreceived = reader.bytes(); + break; + case 3: + message.proofHeight = Height.decode(reader, reader.uint32()); + break; + case 5: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgTimeout { + const obj = createBaseMsgTimeout(); + if (isSet(object.packet)) obj.packet = Packet.fromJSON(object.packet); + if (isSet(object.proofUnreceived)) obj.proofUnreceived = bytesFromBase64(object.proofUnreceived); + if (isSet(object.proofHeight)) obj.proofHeight = Height.fromJSON(object.proofHeight); + if (isSet(object.signer)) obj.signer = String(object.signer); + return obj; + }, + toJSON(message: MsgTimeout): unknown { + const obj: any = {}; + message.packet !== undefined && (obj.packet = message.packet ? Packet.toJSON(message.packet) : undefined); + message.proofUnreceived !== undefined && + (obj.proofUnreceived = base64FromBytes( + message.proofUnreceived !== undefined ? message.proofUnreceived : new Uint8Array(), + )); + message.proofHeight !== undefined && + (obj.proofHeight = message.proofHeight ? Height.toJSON(message.proofHeight) : undefined); + message.signer !== undefined && (obj.signer = message.signer); + return obj; + }, + fromPartial(object: Partial): MsgTimeout { + const message = createBaseMsgTimeout(); + if (object.packet !== undefined && object.packet !== null) { + message.packet = Packet.fromPartial(object.packet); + } + message.proofUnreceived = object.proofUnreceived ?? new Uint8Array(); + if (object.proofHeight !== undefined && object.proofHeight !== null) { + message.proofHeight = Height.fromPartial(object.proofHeight); + } + message.signer = object.signer ?? ""; + return message; + }, +}; +function createBaseMsgTimeoutResponse(): MsgTimeoutResponse { + return { + result: 0, + }; +} +export const MsgTimeoutResponse = { + encode(message: MsgTimeoutResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.result !== 0) { + writer.uint32(8).int32(message.result); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgTimeoutResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgTimeoutResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.result = reader.int32() as any; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgTimeoutResponse { + const obj = createBaseMsgTimeoutResponse(); + if (isSet(object.result)) obj.result = responseResultTypeFromJSON(object.result); + return obj; + }, + toJSON(message: MsgTimeoutResponse): unknown { + const obj: any = {}; + message.result !== undefined && (obj.result = responseResultTypeToJSON(message.result)); + return obj; + }, + fromPartial(object: Partial): MsgTimeoutResponse { + const message = createBaseMsgTimeoutResponse(); + message.result = object.result ?? 0; + return message; + }, +}; +function createBaseMsgAcknowledgement(): MsgAcknowledgement { + return { + packet: Packet.fromPartial({}), + acknowledgement: Acknowledgement.fromPartial({}), + proofAcked: new Uint8Array(), + proofHeight: Height.fromPartial({}), + signer: "", + }; +} +export const MsgAcknowledgement = { + encode(message: MsgAcknowledgement, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.packet !== undefined) { + Packet.encode(message.packet, writer.uint32(10).fork()).ldelim(); + } + if (message.acknowledgement !== undefined) { + Acknowledgement.encode(message.acknowledgement, writer.uint32(18).fork()).ldelim(); + } + if (message.proofAcked.length !== 0) { + writer.uint32(26).bytes(message.proofAcked); + } + if (message.proofHeight !== undefined) { + Height.encode(message.proofHeight, writer.uint32(34).fork()).ldelim(); + } + if (message.signer !== "") { + writer.uint32(42).string(message.signer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgAcknowledgement { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgAcknowledgement(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.packet = Packet.decode(reader, reader.uint32()); + break; + case 2: + message.acknowledgement = Acknowledgement.decode(reader, reader.uint32()); + break; + case 3: + message.proofAcked = reader.bytes(); + break; + case 4: + message.proofHeight = Height.decode(reader, reader.uint32()); + break; + case 5: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgAcknowledgement { + const obj = createBaseMsgAcknowledgement(); + if (isSet(object.packet)) obj.packet = Packet.fromJSON(object.packet); + if (isSet(object.acknowledgement)) obj.acknowledgement = Acknowledgement.fromJSON(object.acknowledgement); + if (isSet(object.proofAcked)) obj.proofAcked = bytesFromBase64(object.proofAcked); + if (isSet(object.proofHeight)) obj.proofHeight = Height.fromJSON(object.proofHeight); + if (isSet(object.signer)) obj.signer = String(object.signer); + return obj; + }, + toJSON(message: MsgAcknowledgement): unknown { + const obj: any = {}; + message.packet !== undefined && (obj.packet = message.packet ? Packet.toJSON(message.packet) : undefined); + message.acknowledgement !== undefined && + (obj.acknowledgement = message.acknowledgement + ? Acknowledgement.toJSON(message.acknowledgement) + : undefined); + message.proofAcked !== undefined && + (obj.proofAcked = base64FromBytes( + message.proofAcked !== undefined ? message.proofAcked : new Uint8Array(), + )); + message.proofHeight !== undefined && + (obj.proofHeight = message.proofHeight ? Height.toJSON(message.proofHeight) : undefined); + message.signer !== undefined && (obj.signer = message.signer); + return obj; + }, + fromPartial(object: Partial): MsgAcknowledgement { + const message = createBaseMsgAcknowledgement(); + if (object.packet !== undefined && object.packet !== null) { + message.packet = Packet.fromPartial(object.packet); + } + if (object.acknowledgement !== undefined && object.acknowledgement !== null) { + message.acknowledgement = Acknowledgement.fromPartial(object.acknowledgement); + } + message.proofAcked = object.proofAcked ?? new Uint8Array(); + if (object.proofHeight !== undefined && object.proofHeight !== null) { + message.proofHeight = Height.fromPartial(object.proofHeight); + } + message.signer = object.signer ?? ""; + return message; + }, +}; +function createBaseMsgAcknowledgementResponse(): MsgAcknowledgementResponse { + return { + result: 0, + }; +} +export const MsgAcknowledgementResponse = { + encode(message: MsgAcknowledgementResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.result !== 0) { + writer.uint32(8).int32(message.result); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgAcknowledgementResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgAcknowledgementResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.result = reader.int32() as any; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgAcknowledgementResponse { + const obj = createBaseMsgAcknowledgementResponse(); + if (isSet(object.result)) obj.result = responseResultTypeFromJSON(object.result); + return obj; + }, + toJSON(message: MsgAcknowledgementResponse): unknown { + const obj: any = {}; + message.result !== undefined && (obj.result = responseResultTypeToJSON(message.result)); + return obj; + }, + fromPartial(object: Partial): MsgAcknowledgementResponse { + const message = createBaseMsgAcknowledgementResponse(); + message.result = object.result ?? 0; + return message; + }, +}; +/** Msg defines the ibc/channel/v2 Msg service. */ +export interface Msg { + /** SendPacket defines a rpc handler method for MsgSendPacket. */ + SendPacket(request: MsgSendPacket): Promise; + /** RecvPacket defines a rpc handler method for MsgRecvPacket. */ + RecvPacket(request: MsgRecvPacket): Promise; + /** Timeout defines a rpc handler method for MsgTimeout. */ + Timeout(request: MsgTimeout): Promise; + /** Acknowledgement defines a rpc handler method for MsgAcknowledgement. */ + Acknowledgement(request: MsgAcknowledgement): Promise; +} +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + this.SendPacket = this.SendPacket.bind(this); + this.RecvPacket = this.RecvPacket.bind(this); + this.Timeout = this.Timeout.bind(this); + this.Acknowledgement = this.Acknowledgement.bind(this); + } + SendPacket(request: MsgSendPacket): Promise { + const data = MsgSendPacket.encode(request).finish(); + const promise = this.rpc.request("ibc.core.channel.v2.Msg", "SendPacket", data); + return promise.then((data) => MsgSendPacketResponse.decode(new BinaryReader(data))); + } + RecvPacket(request: MsgRecvPacket): Promise { + const data = MsgRecvPacket.encode(request).finish(); + const promise = this.rpc.request("ibc.core.channel.v2.Msg", "RecvPacket", data); + return promise.then((data) => MsgRecvPacketResponse.decode(new BinaryReader(data))); + } + Timeout(request: MsgTimeout): Promise { + const data = MsgTimeout.encode(request).finish(); + const promise = this.rpc.request("ibc.core.channel.v2.Msg", "Timeout", data); + return promise.then((data) => MsgTimeoutResponse.decode(new BinaryReader(data))); + } + Acknowledgement(request: MsgAcknowledgement): Promise { + const data = MsgAcknowledgement.encode(request).finish(); + const promise = this.rpc.request("ibc.core.channel.v2.Msg", "Acknowledgement", data); + return promise.then((data) => MsgAcknowledgementResponse.decode(new BinaryReader(data))); + } +} diff --git a/src/ibc/core/client/v1/client.ts b/src/ibc/core/client/v1/client.ts index 1dfadbf..0a9b4ba 100644 --- a/src/ibc/core/client/v1/client.ts +++ b/src/ibc/core/client/v1/client.ts @@ -1,6 +1,5 @@ /* eslint-disable */ import { Any } from "../../../../google/protobuf/any"; -import { Plan } from "../../../../cosmos/upgrade/v1beta1/upgrade"; import { BinaryReader, BinaryWriter } from "../../../../binary"; import { isSet } from "../../../../helpers"; export const protobufPackage = "ibc.core.client.v1"; @@ -34,43 +33,6 @@ export interface ClientConsensusStates { /** consensus states and their heights associated with the client */ consensusStates: ConsensusStateWithHeight[]; } -/** - * ClientUpdateProposal is a governance proposal. If it passes, the substitute - * client's latest consensus state is copied over to the subject client. The proposal - * handler may fail if the subject and the substitute do not match in client and - * chain parameters (with exception to latest height, frozen height, and chain-id). - */ -export interface ClientUpdateProposal { - /** the title of the update proposal */ - title: string; - /** the description of the proposal */ - description: string; - /** the client identifier for the client to be updated if the proposal passes */ - subjectClientId: string; - /** - * the substitute client identifier for the client standing in for the subject - * client - */ - substituteClientId: string; -} -/** - * UpgradeProposal is a gov Content type for initiating an IBC breaking - * upgrade. - */ -export interface UpgradeProposal { - title: string; - description: string; - plan: Plan; - /** - * An UpgradedClientState must be provided to perform an IBC breaking upgrade. - * This will make the chain commit to the correct upgraded (self) client state - * before the upgrade occurs, so that connecting chains can verify that the - * new upgraded client is valid by verifying a proof on the previous version - * of the chain. This will allow IBC connections to persist smoothly across - * planned chain upgrades - */ - upgradedClientState: Any; -} /** * Height is a monotonically increasing data type * that can be compared against another Height for the purposes of updating and @@ -82,6 +44,9 @@ export interface UpgradeProposal { * breaking changes In these cases, the RevisionNumber is incremented so that * height continues to be monitonically increasing even as the RevisionHeight * gets reset + * + * Please note that json tags for generated Go code are overridden to explicitly exclude the omitempty jsontag. + * This enforces the Go json marshaller to always emit zero values for both revision_number and revision_height. */ export interface Height { /** the revision that the client is currently on */ @@ -279,163 +244,6 @@ export const ClientConsensusStates = { return message; }, }; -function createBaseClientUpdateProposal(): ClientUpdateProposal { - return { - title: "", - description: "", - subjectClientId: "", - substituteClientId: "", - }; -} -export const ClientUpdateProposal = { - encode(message: ClientUpdateProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.title !== "") { - writer.uint32(10).string(message.title); - } - if (message.description !== "") { - writer.uint32(18).string(message.description); - } - if (message.subjectClientId !== "") { - writer.uint32(26).string(message.subjectClientId); - } - if (message.substituteClientId !== "") { - writer.uint32(34).string(message.substituteClientId); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): ClientUpdateProposal { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseClientUpdateProposal(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.title = reader.string(); - break; - case 2: - message.description = reader.string(); - break; - case 3: - message.subjectClientId = reader.string(); - break; - case 4: - message.substituteClientId = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): ClientUpdateProposal { - const obj = createBaseClientUpdateProposal(); - if (isSet(object.title)) obj.title = String(object.title); - if (isSet(object.description)) obj.description = String(object.description); - if (isSet(object.subjectClientId)) obj.subjectClientId = String(object.subjectClientId); - if (isSet(object.substituteClientId)) obj.substituteClientId = String(object.substituteClientId); - return obj; - }, - toJSON(message: ClientUpdateProposal): unknown { - const obj: any = {}; - message.title !== undefined && (obj.title = message.title); - message.description !== undefined && (obj.description = message.description); - message.subjectClientId !== undefined && (obj.subjectClientId = message.subjectClientId); - message.substituteClientId !== undefined && (obj.substituteClientId = message.substituteClientId); - return obj; - }, - fromPartial(object: Partial): ClientUpdateProposal { - const message = createBaseClientUpdateProposal(); - message.title = object.title ?? ""; - message.description = object.description ?? ""; - message.subjectClientId = object.subjectClientId ?? ""; - message.substituteClientId = object.substituteClientId ?? ""; - return message; - }, -}; -function createBaseUpgradeProposal(): UpgradeProposal { - return { - title: "", - description: "", - plan: Plan.fromPartial({}), - upgradedClientState: Any.fromPartial({}), - }; -} -export const UpgradeProposal = { - encode(message: UpgradeProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.title !== "") { - writer.uint32(10).string(message.title); - } - if (message.description !== "") { - writer.uint32(18).string(message.description); - } - if (message.plan !== undefined) { - Plan.encode(message.plan, writer.uint32(26).fork()).ldelim(); - } - if (message.upgradedClientState !== undefined) { - Any.encode(message.upgradedClientState, writer.uint32(34).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): UpgradeProposal { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseUpgradeProposal(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.title = reader.string(); - break; - case 2: - message.description = reader.string(); - break; - case 3: - message.plan = Plan.decode(reader, reader.uint32()); - break; - case 4: - message.upgradedClientState = Any.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): UpgradeProposal { - const obj = createBaseUpgradeProposal(); - if (isSet(object.title)) obj.title = String(object.title); - if (isSet(object.description)) obj.description = String(object.description); - if (isSet(object.plan)) obj.plan = Plan.fromJSON(object.plan); - if (isSet(object.upgradedClientState)) obj.upgradedClientState = Any.fromJSON(object.upgradedClientState); - return obj; - }, - toJSON(message: UpgradeProposal): unknown { - const obj: any = {}; - message.title !== undefined && (obj.title = message.title); - message.description !== undefined && (obj.description = message.description); - message.plan !== undefined && (obj.plan = message.plan ? Plan.toJSON(message.plan) : undefined); - message.upgradedClientState !== undefined && - (obj.upgradedClientState = message.upgradedClientState - ? Any.toJSON(message.upgradedClientState) - : undefined); - return obj; - }, - fromPartial(object: Partial): UpgradeProposal { - const message = createBaseUpgradeProposal(); - message.title = object.title ?? ""; - message.description = object.description ?? ""; - if (object.plan !== undefined && object.plan !== null) { - message.plan = Plan.fromPartial(object.plan); - } - if (object.upgradedClientState !== undefined && object.upgradedClientState !== null) { - message.upgradedClientState = Any.fromPartial(object.upgradedClientState); - } - return message; - }, -}; function createBaseHeight(): Height { return { revisionNumber: BigInt(0), diff --git a/src/ibc/core/client/v1/genesis.ts b/src/ibc/core/client/v1/genesis.ts index 2cb2270..3691d78 100644 --- a/src/ibc/core/client/v1/genesis.ts +++ b/src/ibc/core/client/v1/genesis.ts @@ -12,14 +12,18 @@ export interface GenesisState { /** metadata from each client */ clientsMetadata: IdentifiedGenesisMetadata[]; params: Params; - /** create localhost on initialization */ + /** + * Deprecated: create_localhost has been deprecated. + * The localhost client is automatically created at genesis. + */ + /** @deprecated */ createLocalhost: boolean; /** the sequence for the next generated client identifier */ nextClientSequence: bigint; } /** - * GenesisMetadata defines the genesis type for metadata that clients may return - * with ExportMetadata + * GenesisMetadata defines the genesis type for metadata that will be used + * to export all client store keys that are not client or consensus states. */ export interface GenesisMetadata { /** store key of metadata without clientID-prefix */ diff --git a/src/ibc/core/client/v1/query.ts b/src/ibc/core/client/v1/query.ts index 5637a13..e43430f 100644 --- a/src/ibc/core/client/v1/query.ts +++ b/src/ibc/core/client/v1/query.ts @@ -1,7 +1,8 @@ /* eslint-disable */ import { PageRequest, PageResponse } from "../../../../cosmos/base/query/v1beta1/pagination"; -import { Any } from "../../../../google/protobuf/any"; import { Height, IdentifiedClientState, ConsensusStateWithHeight, Params } from "./client"; +import { MerklePath } from "../../commitment/v2/commitment"; +import { Any } from "../../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../../binary"; import { isSet, bytesFromBase64, base64FromBytes, Rpc } from "../../../../helpers"; export const protobufPackage = "ibc.core.client.v1"; @@ -57,7 +58,7 @@ export interface QueryConsensusStateRequest { /** consensus state revision height */ revisionHeight: bigint; /** - * latest_height overrrides the height field and queries the latest stored + * latest_height overrides the height field and queries the latest stored * ConsensusState */ latestHeight: boolean; @@ -142,6 +143,22 @@ export interface QueryClientParamsResponse { /** params defines the parameters of the module. */ params: Params; } +/** + * QueryClientCreatorRequest is the request type for the Query/ClientCreator RPC + * method. + */ +export interface QueryClientCreatorRequest { + /** client unique identifier */ + clientId: string; +} +/** + * QueryClientCreatorResponse is the response type for the Query/ClientCreator RPC + * method. + */ +export interface QueryClientCreatorResponse { + /** creator of the client */ + creator: string; +} /** * QueryUpgradedClientStateRequest is the request type for the * Query/UpgradedClientState RPC method @@ -168,6 +185,28 @@ export interface QueryUpgradedConsensusStateResponse { /** Consensus state associated with the request identifier */ upgradedConsensusState: Any; } +/** QueryVerifyMembershipRequest is the request type for the Query/VerifyMembership RPC method */ +export interface QueryVerifyMembershipRequest { + /** client unique identifier. */ + clientId: string; + /** the proof to be verified by the client. */ + proof: Uint8Array; + /** the height of the commitment root at which the proof is verified. */ + proofHeight: Height; + /** the value which is proven. */ + value: Uint8Array; + /** optional time delay */ + timeDelay: bigint; + /** optional block delay */ + blockDelay: bigint; + /** the commitment key path. */ + merklePath: MerklePath; +} +/** QueryVerifyMembershipResponse is the response type for the Query/VerifyMembership RPC method */ +export interface QueryVerifyMembershipResponse { + /** boolean indicating success or failure of proof verification. */ + success: boolean; +} function createBaseQueryClientStateRequest(): QueryClientStateRequest { return { clientId: "", @@ -973,6 +1012,96 @@ export const QueryClientParamsResponse = { return message; }, }; +function createBaseQueryClientCreatorRequest(): QueryClientCreatorRequest { + return { + clientId: "", + }; +} +export const QueryClientCreatorRequest = { + encode(message: QueryClientCreatorRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryClientCreatorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClientCreatorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryClientCreatorRequest { + const obj = createBaseQueryClientCreatorRequest(); + if (isSet(object.clientId)) obj.clientId = String(object.clientId); + return obj; + }, + toJSON(message: QueryClientCreatorRequest): unknown { + const obj: any = {}; + message.clientId !== undefined && (obj.clientId = message.clientId); + return obj; + }, + fromPartial(object: Partial): QueryClientCreatorRequest { + const message = createBaseQueryClientCreatorRequest(); + message.clientId = object.clientId ?? ""; + return message; + }, +}; +function createBaseQueryClientCreatorResponse(): QueryClientCreatorResponse { + return { + creator: "", + }; +} +export const QueryClientCreatorResponse = { + encode(message: QueryClientCreatorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryClientCreatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClientCreatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.creator = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryClientCreatorResponse { + const obj = createBaseQueryClientCreatorResponse(); + if (isSet(object.creator)) obj.creator = String(object.creator); + return obj; + }, + toJSON(message: QueryClientCreatorResponse): unknown { + const obj: any = {}; + message.creator !== undefined && (obj.creator = message.creator); + return obj; + }, + fromPartial(object: Partial): QueryClientCreatorResponse { + const message = createBaseQueryClientCreatorResponse(); + message.creator = object.creator ?? ""; + return message; + }, +}; function createBaseQueryUpgradedClientStateRequest(): QueryUpgradedClientStateRequest { return {}; } @@ -1148,6 +1277,168 @@ export const QueryUpgradedConsensusStateResponse = { return message; }, }; +function createBaseQueryVerifyMembershipRequest(): QueryVerifyMembershipRequest { + return { + clientId: "", + proof: new Uint8Array(), + proofHeight: Height.fromPartial({}), + value: new Uint8Array(), + timeDelay: BigInt(0), + blockDelay: BigInt(0), + merklePath: MerklePath.fromPartial({}), + }; +} +export const QueryVerifyMembershipRequest = { + encode(message: QueryVerifyMembershipRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.proof.length !== 0) { + writer.uint32(18).bytes(message.proof); + } + if (message.proofHeight !== undefined) { + Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); + } + if (message.value.length !== 0) { + writer.uint32(42).bytes(message.value); + } + if (message.timeDelay !== BigInt(0)) { + writer.uint32(48).uint64(message.timeDelay); + } + if (message.blockDelay !== BigInt(0)) { + writer.uint32(56).uint64(message.blockDelay); + } + if (message.merklePath !== undefined) { + MerklePath.encode(message.merklePath, writer.uint32(66).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryVerifyMembershipRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVerifyMembershipRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.proof = reader.bytes(); + break; + case 3: + message.proofHeight = Height.decode(reader, reader.uint32()); + break; + case 5: + message.value = reader.bytes(); + break; + case 6: + message.timeDelay = reader.uint64(); + break; + case 7: + message.blockDelay = reader.uint64(); + break; + case 8: + message.merklePath = MerklePath.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryVerifyMembershipRequest { + const obj = createBaseQueryVerifyMembershipRequest(); + if (isSet(object.clientId)) obj.clientId = String(object.clientId); + if (isSet(object.proof)) obj.proof = bytesFromBase64(object.proof); + if (isSet(object.proofHeight)) obj.proofHeight = Height.fromJSON(object.proofHeight); + if (isSet(object.value)) obj.value = bytesFromBase64(object.value); + if (isSet(object.timeDelay)) obj.timeDelay = BigInt(object.timeDelay.toString()); + if (isSet(object.blockDelay)) obj.blockDelay = BigInt(object.blockDelay.toString()); + if (isSet(object.merklePath)) obj.merklePath = MerklePath.fromJSON(object.merklePath); + return obj; + }, + toJSON(message: QueryVerifyMembershipRequest): unknown { + const obj: any = {}; + message.clientId !== undefined && (obj.clientId = message.clientId); + message.proof !== undefined && + (obj.proof = base64FromBytes(message.proof !== undefined ? message.proof : new Uint8Array())); + message.proofHeight !== undefined && + (obj.proofHeight = message.proofHeight ? Height.toJSON(message.proofHeight) : undefined); + message.value !== undefined && + (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); + message.timeDelay !== undefined && (obj.timeDelay = (message.timeDelay || BigInt(0)).toString()); + message.blockDelay !== undefined && (obj.blockDelay = (message.blockDelay || BigInt(0)).toString()); + message.merklePath !== undefined && + (obj.merklePath = message.merklePath ? MerklePath.toJSON(message.merklePath) : undefined); + return obj; + }, + fromPartial(object: Partial): QueryVerifyMembershipRequest { + const message = createBaseQueryVerifyMembershipRequest(); + message.clientId = object.clientId ?? ""; + message.proof = object.proof ?? new Uint8Array(); + if (object.proofHeight !== undefined && object.proofHeight !== null) { + message.proofHeight = Height.fromPartial(object.proofHeight); + } + message.value = object.value ?? new Uint8Array(); + if (object.timeDelay !== undefined && object.timeDelay !== null) { + message.timeDelay = BigInt(object.timeDelay.toString()); + } + if (object.blockDelay !== undefined && object.blockDelay !== null) { + message.blockDelay = BigInt(object.blockDelay.toString()); + } + if (object.merklePath !== undefined && object.merklePath !== null) { + message.merklePath = MerklePath.fromPartial(object.merklePath); + } + return message; + }, +}; +function createBaseQueryVerifyMembershipResponse(): QueryVerifyMembershipResponse { + return { + success: false, + }; +} +export const QueryVerifyMembershipResponse = { + encode(message: QueryVerifyMembershipResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.success === true) { + writer.uint32(8).bool(message.success); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryVerifyMembershipResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVerifyMembershipResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.success = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryVerifyMembershipResponse { + const obj = createBaseQueryVerifyMembershipResponse(); + if (isSet(object.success)) obj.success = Boolean(object.success); + return obj; + }, + toJSON(message: QueryVerifyMembershipResponse): unknown { + const obj: any = {}; + message.success !== undefined && (obj.success = message.success); + return obj; + }, + fromPartial(object: Partial): QueryVerifyMembershipResponse { + const message = createBaseQueryVerifyMembershipResponse(); + message.success = object.success ?? false; + return message; + }, +}; /** Query provides defines the gRPC querier service */ export interface Query { /** ClientState queries an IBC light client. */ @@ -1172,12 +1463,16 @@ export interface Query { ClientStatus(request: QueryClientStatusRequest): Promise; /** ClientParams queries all parameters of the ibc client submodule. */ ClientParams(request?: QueryClientParamsRequest): Promise; + /** ClientCreator queries the creator of a given client. */ + ClientCreator(request: QueryClientCreatorRequest): Promise; /** UpgradedClientState queries an Upgraded IBC light client. */ UpgradedClientState(request?: QueryUpgradedClientStateRequest): Promise; /** UpgradedConsensusState queries an Upgraded IBC consensus state. */ UpgradedConsensusState( request?: QueryUpgradedConsensusStateRequest, ): Promise; + /** VerifyMembership queries an IBC light client for proof verification of a value at a given key path. */ + VerifyMembership(request: QueryVerifyMembershipRequest): Promise; } export class QueryClientImpl implements Query { private readonly rpc: Rpc; @@ -1190,8 +1485,10 @@ export class QueryClientImpl implements Query { this.ConsensusStateHeights = this.ConsensusStateHeights.bind(this); this.ClientStatus = this.ClientStatus.bind(this); this.ClientParams = this.ClientParams.bind(this); + this.ClientCreator = this.ClientCreator.bind(this); this.UpgradedClientState = this.UpgradedClientState.bind(this); this.UpgradedConsensusState = this.UpgradedConsensusState.bind(this); + this.VerifyMembership = this.VerifyMembership.bind(this); } ClientState(request: QueryClientStateRequest): Promise { const data = QueryClientStateRequest.encode(request).finish(); @@ -1234,6 +1531,11 @@ export class QueryClientImpl implements Query { const promise = this.rpc.request("ibc.core.client.v1.Query", "ClientParams", data); return promise.then((data) => QueryClientParamsResponse.decode(new BinaryReader(data))); } + ClientCreator(request: QueryClientCreatorRequest): Promise { + const data = QueryClientCreatorRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.client.v1.Query", "ClientCreator", data); + return promise.then((data) => QueryClientCreatorResponse.decode(new BinaryReader(data))); + } UpgradedClientState( request: QueryUpgradedClientStateRequest = {}, ): Promise { @@ -1248,4 +1550,9 @@ export class QueryClientImpl implements Query { const promise = this.rpc.request("ibc.core.client.v1.Query", "UpgradedConsensusState", data); return promise.then((data) => QueryUpgradedConsensusStateResponse.decode(new BinaryReader(data))); } + VerifyMembership(request: QueryVerifyMembershipRequest): Promise { + const data = QueryVerifyMembershipRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.client.v1.Query", "VerifyMembership", data); + return promise.then((data) => QueryVerifyMembershipResponse.decode(new BinaryReader(data))); + } } diff --git a/src/ibc/core/client/v1/tx.amino.ts b/src/ibc/core/client/v1/tx.amino.ts index f29353b..ee398aa 100644 --- a/src/ibc/core/client/v1/tx.amino.ts +++ b/src/ibc/core/client/v1/tx.amino.ts @@ -1,6 +1,15 @@ /* eslint-disable */ import { AminoMsg } from "@cosmjs/amino"; -import { MsgCreateClient, MsgUpdateClient, MsgUpgradeClient, MsgSubmitMisbehaviour } from "./tx"; +import { + MsgCreateClient, + MsgUpdateClient, + MsgUpgradeClient, + MsgSubmitMisbehaviour, + MsgRecoverClient, + MsgIBCSoftwareUpgrade, + MsgUpdateParams, + MsgDeleteClientCreator, +} from "./tx"; export interface MsgCreateClientAminoType extends AminoMsg { type: "cosmos-sdk/MsgCreateClient"; value: { @@ -54,6 +63,53 @@ export interface MsgSubmitMisbehaviourAminoType extends AminoMsg { signer: string; }; } +export interface MsgRecoverClientAminoType extends AminoMsg { + type: "cosmos-sdk/MsgRecoverClient"; + value: { + subject_client_id: string; + substitute_client_id: string; + signer: string; + }; +} +export interface MsgIBCSoftwareUpgradeAminoType extends AminoMsg { + type: "cosmos-sdk/MsgIBCSoftwareUpgrade"; + value: { + plan: { + name: string; + time: { + seconds: string; + nanos: number; + }; + height: string; + info: string; + upgraded_client_state: { + type_url: string; + value: Uint8Array; + }; + }; + upgraded_client_state: { + type_url: string; + value: Uint8Array; + }; + signer: string; + }; +} +export interface MsgUpdateParamsAminoType extends AminoMsg { + type: "cosmos-sdk/MsgUpdateParams"; + value: { + signer: string; + params: { + allowed_clients: string[]; + }; + }; +} +export interface MsgDeleteClientCreatorAminoType extends AminoMsg { + type: "cosmos-sdk/MsgDeleteClientCreator"; + value: { + client_id: string; + signer: string; + }; +} export const AminoConverter = { "/ibc.core.client.v1.MsgCreateClient": { aminoType: "cosmos-sdk/MsgCreateClient", @@ -199,4 +255,112 @@ export const AminoConverter = { }; }, }, + "/ibc.core.client.v1.MsgRecoverClient": { + aminoType: "cosmos-sdk/MsgRecoverClient", + toAmino: ({ + subjectClientId, + substituteClientId, + signer, + }: MsgRecoverClient): MsgRecoverClientAminoType["value"] => { + return { + subject_client_id: subjectClientId, + substitute_client_id: substituteClientId, + signer, + }; + }, + fromAmino: ({ + subject_client_id, + substitute_client_id, + signer, + }: MsgRecoverClientAminoType["value"]): MsgRecoverClient => { + return { + subjectClientId: subject_client_id, + substituteClientId: substitute_client_id, + signer, + }; + }, + }, + "/ibc.core.client.v1.MsgIBCSoftwareUpgrade": { + aminoType: "cosmos-sdk/MsgIBCSoftwareUpgrade", + toAmino: ({ + plan, + upgradedClientState, + signer, + }: MsgIBCSoftwareUpgrade): MsgIBCSoftwareUpgradeAminoType["value"] => { + return { + plan: { + name: plan.name, + time: plan.time, + height: plan.height.toString(), + info: plan.info, + upgraded_client_state: { + type_url: plan.upgradedClientState.typeUrl, + value: plan.upgradedClientState.value, + }, + }, + upgraded_client_state: { + type_url: upgradedClientState.typeUrl, + value: upgradedClientState.value, + }, + signer, + }; + }, + fromAmino: ({ + plan, + upgraded_client_state, + signer, + }: MsgIBCSoftwareUpgradeAminoType["value"]): MsgIBCSoftwareUpgrade => { + return { + plan: { + name: plan.name, + time: plan.time, + height: BigInt(plan.height), + info: plan.info, + upgradedClientState: { + typeUrl: plan.upgraded_client_state.type_url, + value: plan.upgraded_client_state.value, + }, + }, + upgradedClientState: { + typeUrl: upgraded_client_state.type_url, + value: upgraded_client_state.value, + }, + signer, + }; + }, + }, + "/ibc.core.client.v1.MsgUpdateParams": { + aminoType: "cosmos-sdk/MsgUpdateParams", + toAmino: ({ signer, params }: MsgUpdateParams): MsgUpdateParamsAminoType["value"] => { + return { + signer, + params: { + allowed_clients: params.allowedClients, + }, + }; + }, + fromAmino: ({ signer, params }: MsgUpdateParamsAminoType["value"]): MsgUpdateParams => { + return { + signer, + params: { + allowedClients: params.allowed_clients, + }, + }; + }, + }, + "/ibc.core.client.v1.MsgDeleteClientCreator": { + aminoType: "cosmos-sdk/MsgDeleteClientCreator", + toAmino: ({ clientId, signer }: MsgDeleteClientCreator): MsgDeleteClientCreatorAminoType["value"] => { + return { + client_id: clientId, + signer, + }; + }, + fromAmino: ({ client_id, signer }: MsgDeleteClientCreatorAminoType["value"]): MsgDeleteClientCreator => { + return { + clientId: client_id, + signer, + }; + }, + }, }; diff --git a/src/ibc/core/client/v1/tx.registry.ts b/src/ibc/core/client/v1/tx.registry.ts index 85d03e1..d93ba30 100644 --- a/src/ibc/core/client/v1/tx.registry.ts +++ b/src/ibc/core/client/v1/tx.registry.ts @@ -1,12 +1,25 @@ //@ts-nocheck /* eslint-disable */ import { GeneratedType, Registry } from "@cosmjs/proto-signing"; -import { MsgCreateClient, MsgUpdateClient, MsgUpgradeClient, MsgSubmitMisbehaviour } from "./tx"; +import { + MsgCreateClient, + MsgUpdateClient, + MsgUpgradeClient, + MsgSubmitMisbehaviour, + MsgRecoverClient, + MsgIBCSoftwareUpgrade, + MsgUpdateParams, + MsgDeleteClientCreator, +} from "./tx"; export const registry: ReadonlyArray<[string, GeneratedType]> = [ ["/ibc.core.client.v1.MsgCreateClient", MsgCreateClient], ["/ibc.core.client.v1.MsgUpdateClient", MsgUpdateClient], ["/ibc.core.client.v1.MsgUpgradeClient", MsgUpgradeClient], ["/ibc.core.client.v1.MsgSubmitMisbehaviour", MsgSubmitMisbehaviour], + ["/ibc.core.client.v1.MsgRecoverClient", MsgRecoverClient], + ["/ibc.core.client.v1.MsgIBCSoftwareUpgrade", MsgIBCSoftwareUpgrade], + ["/ibc.core.client.v1.MsgUpdateParams", MsgUpdateParams], + ["/ibc.core.client.v1.MsgDeleteClientCreator", MsgDeleteClientCreator], ]; export const load = (protoRegistry: Registry) => { registry.forEach(([typeUrl, mod]) => { @@ -39,6 +52,30 @@ export const MessageComposer = { value: MsgSubmitMisbehaviour.encode(value).finish(), }; }, + recoverClient(value: MsgRecoverClient) { + return { + typeUrl: "/ibc.core.client.v1.MsgRecoverClient", + value: MsgRecoverClient.encode(value).finish(), + }; + }, + iBCSoftwareUpgrade(value: MsgIBCSoftwareUpgrade) { + return { + typeUrl: "/ibc.core.client.v1.MsgIBCSoftwareUpgrade", + value: MsgIBCSoftwareUpgrade.encode(value).finish(), + }; + }, + updateClientParams(value: MsgUpdateParams) { + return { + typeUrl: "/ibc.core.client.v1.MsgUpdateParams", + value: MsgUpdateParams.encode(value).finish(), + }; + }, + deleteClientCreator(value: MsgDeleteClientCreator) { + return { + typeUrl: "/ibc.core.client.v1.MsgDeleteClientCreator", + value: MsgDeleteClientCreator.encode(value).finish(), + }; + }, }, withTypeUrl: { createClient(value: MsgCreateClient) { @@ -65,6 +102,30 @@ export const MessageComposer = { value, }; }, + recoverClient(value: MsgRecoverClient) { + return { + typeUrl: "/ibc.core.client.v1.MsgRecoverClient", + value, + }; + }, + iBCSoftwareUpgrade(value: MsgIBCSoftwareUpgrade) { + return { + typeUrl: "/ibc.core.client.v1.MsgIBCSoftwareUpgrade", + value, + }; + }, + updateClientParams(value: MsgUpdateParams) { + return { + typeUrl: "/ibc.core.client.v1.MsgUpdateParams", + value, + }; + }, + deleteClientCreator(value: MsgDeleteClientCreator) { + return { + typeUrl: "/ibc.core.client.v1.MsgDeleteClientCreator", + value, + }; + }, }, toJSON: { createClient(value: MsgCreateClient) { @@ -91,6 +152,30 @@ export const MessageComposer = { value: MsgSubmitMisbehaviour.toJSON(value), }; }, + recoverClient(value: MsgRecoverClient) { + return { + typeUrl: "/ibc.core.client.v1.MsgRecoverClient", + value: MsgRecoverClient.toJSON(value), + }; + }, + iBCSoftwareUpgrade(value: MsgIBCSoftwareUpgrade) { + return { + typeUrl: "/ibc.core.client.v1.MsgIBCSoftwareUpgrade", + value: MsgIBCSoftwareUpgrade.toJSON(value), + }; + }, + updateClientParams(value: MsgUpdateParams) { + return { + typeUrl: "/ibc.core.client.v1.MsgUpdateParams", + value: MsgUpdateParams.toJSON(value), + }; + }, + deleteClientCreator(value: MsgDeleteClientCreator) { + return { + typeUrl: "/ibc.core.client.v1.MsgDeleteClientCreator", + value: MsgDeleteClientCreator.toJSON(value), + }; + }, }, fromJSON: { createClient(value: any) { @@ -117,6 +202,30 @@ export const MessageComposer = { value: MsgSubmitMisbehaviour.fromJSON(value), }; }, + recoverClient(value: any) { + return { + typeUrl: "/ibc.core.client.v1.MsgRecoverClient", + value: MsgRecoverClient.fromJSON(value), + }; + }, + iBCSoftwareUpgrade(value: any) { + return { + typeUrl: "/ibc.core.client.v1.MsgIBCSoftwareUpgrade", + value: MsgIBCSoftwareUpgrade.fromJSON(value), + }; + }, + updateClientParams(value: any) { + return { + typeUrl: "/ibc.core.client.v1.MsgUpdateParams", + value: MsgUpdateParams.fromJSON(value), + }; + }, + deleteClientCreator(value: any) { + return { + typeUrl: "/ibc.core.client.v1.MsgDeleteClientCreator", + value: MsgDeleteClientCreator.fromJSON(value), + }; + }, }, fromPartial: { createClient(value: MsgCreateClient) { @@ -143,5 +252,29 @@ export const MessageComposer = { value: MsgSubmitMisbehaviour.fromPartial(value), }; }, + recoverClient(value: MsgRecoverClient) { + return { + typeUrl: "/ibc.core.client.v1.MsgRecoverClient", + value: MsgRecoverClient.fromPartial(value), + }; + }, + iBCSoftwareUpgrade(value: MsgIBCSoftwareUpgrade) { + return { + typeUrl: "/ibc.core.client.v1.MsgIBCSoftwareUpgrade", + value: MsgIBCSoftwareUpgrade.fromPartial(value), + }; + }, + updateClientParams(value: MsgUpdateParams) { + return { + typeUrl: "/ibc.core.client.v1.MsgUpdateParams", + value: MsgUpdateParams.fromPartial(value), + }; + }, + deleteClientCreator(value: MsgDeleteClientCreator) { + return { + typeUrl: "/ibc.core.client.v1.MsgDeleteClientCreator", + value: MsgDeleteClientCreator.fromPartial(value), + }; + }, }, }; diff --git a/src/ibc/core/client/v1/tx.ts b/src/ibc/core/client/v1/tx.ts index 19e682b..b2c71da 100644 --- a/src/ibc/core/client/v1/tx.ts +++ b/src/ibc/core/client/v1/tx.ts @@ -1,5 +1,7 @@ /* eslint-disable */ import { Any } from "../../../../google/protobuf/any"; +import { Plan } from "../../../../cosmos/upgrade/v1beta1/upgrade"; +import { Params } from "./client"; import { BinaryReader, BinaryWriter } from "../../../../binary"; import { isSet, bytesFromBase64, base64FromBytes, Rpc } from "../../../../helpers"; export const protobufPackage = "ibc.core.client.v1"; @@ -16,7 +18,9 @@ export interface MsgCreateClient { signer: string; } /** MsgCreateClientResponse defines the Msg/CreateClient response type. */ -export interface MsgCreateClientResponse {} +export interface MsgCreateClientResponse { + clientId: string; +} /** * MsgUpdateClient defines an sdk.Msg to update a IBC client state using * the given client message. @@ -57,17 +61,15 @@ export interface MsgUpgradeClientResponse {} /** * MsgSubmitMisbehaviour defines an sdk.Msg type that submits Evidence for * light client misbehaviour. - * Warning: DEPRECATED + * This message has been deprecated. Use MsgUpdateClient instead. */ +/** @deprecated */ export interface MsgSubmitMisbehaviour { /** client unique identifier */ - /** @deprecated */ clientId: string; /** misbehaviour used for freezing the light client */ - /** @deprecated */ misbehaviour: Any; /** signer address */ - /** @deprecated */ signer: string; } /** @@ -75,6 +77,61 @@ export interface MsgSubmitMisbehaviour { * type. */ export interface MsgSubmitMisbehaviourResponse {} +/** MsgRecoverClient defines the message used to recover a frozen or expired client. */ +export interface MsgRecoverClient { + /** the client identifier for the client to be updated if the proposal passes */ + subjectClientId: string; + /** + * the substitute client identifier for the client which will replace the subject + * client + */ + substituteClientId: string; + /** signer address */ + signer: string; +} +/** MsgRecoverClientResponse defines the Msg/RecoverClient response type. */ +export interface MsgRecoverClientResponse {} +/** MsgIBCSoftwareUpgrade defines the message used to schedule an upgrade of an IBC client using a v1 governance proposal */ +export interface MsgIBCSoftwareUpgrade { + plan: Plan; + /** + * An UpgradedClientState must be provided to perform an IBC breaking upgrade. + * This will make the chain commit to the correct upgraded (self) client state + * before the upgrade occurs, so that connecting chains can verify that the + * new upgraded client is valid by verifying a proof on the previous version + * of the chain. This will allow IBC connections to persist smoothly across + * planned chain upgrades. Correspondingly, the UpgradedClientState field has been + * deprecated in the Cosmos SDK to allow for this logic to exist solely in + * the 02-client module. + */ + upgradedClientState: Any; + /** signer address */ + signer: string; +} +/** MsgIBCSoftwareUpgradeResponse defines the Msg/IBCSoftwareUpgrade response type. */ +export interface MsgIBCSoftwareUpgradeResponse {} +/** MsgUpdateParams defines the sdk.Msg type to update the client parameters. */ +export interface MsgUpdateParams { + /** signer address */ + signer: string; + /** + * params defines the client parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params; +} +/** MsgUpdateParamsResponse defines the MsgUpdateParams response type. */ +export interface MsgUpdateParamsResponse {} +/** MsgDeleteClientCreator defines a message to delete the client creator of a client */ +export interface MsgDeleteClientCreator { + /** client identifier */ + clientId: string; + /** signer address */ + signer: string; +} +/** MsgDeleteClientCreatorResponse defines the Msg/DeleteClientCreator response type. */ +export interface MsgDeleteClientCreatorResponse {} function createBaseMsgCreateClient(): MsgCreateClient { return { clientState: Any.fromPartial({}), @@ -147,10 +204,15 @@ export const MsgCreateClient = { }, }; function createBaseMsgCreateClientResponse(): MsgCreateClientResponse { - return {}; + return { + clientId: "", + }; } export const MsgCreateClientResponse = { - encode(_: MsgCreateClientResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + encode(message: MsgCreateClientResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateClientResponse { @@ -160,6 +222,9 @@ export const MsgCreateClientResponse = { while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; default: reader.skipType(tag & 7); break; @@ -167,16 +232,19 @@ export const MsgCreateClientResponse = { } return message; }, - fromJSON(_: any): MsgCreateClientResponse { + fromJSON(object: any): MsgCreateClientResponse { const obj = createBaseMsgCreateClientResponse(); + if (isSet(object.clientId)) obj.clientId = String(object.clientId); return obj; }, - toJSON(_: MsgCreateClientResponse): unknown { + toJSON(message: MsgCreateClientResponse): unknown { const obj: any = {}; + message.clientId !== undefined && (obj.clientId = message.clientId); return obj; }, - fromPartial(_: Partial): MsgCreateClientResponse { + fromPartial(object: Partial): MsgCreateClientResponse { const message = createBaseMsgCreateClientResponse(); + message.clientId = object.clientId ?? ""; return message; }, }; @@ -528,6 +596,391 @@ export const MsgSubmitMisbehaviourResponse = { return message; }, }; +function createBaseMsgRecoverClient(): MsgRecoverClient { + return { + subjectClientId: "", + substituteClientId: "", + signer: "", + }; +} +export const MsgRecoverClient = { + encode(message: MsgRecoverClient, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.subjectClientId !== "") { + writer.uint32(10).string(message.subjectClientId); + } + if (message.substituteClientId !== "") { + writer.uint32(18).string(message.substituteClientId); + } + if (message.signer !== "") { + writer.uint32(26).string(message.signer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgRecoverClient { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRecoverClient(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.subjectClientId = reader.string(); + break; + case 2: + message.substituteClientId = reader.string(); + break; + case 3: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgRecoverClient { + const obj = createBaseMsgRecoverClient(); + if (isSet(object.subjectClientId)) obj.subjectClientId = String(object.subjectClientId); + if (isSet(object.substituteClientId)) obj.substituteClientId = String(object.substituteClientId); + if (isSet(object.signer)) obj.signer = String(object.signer); + return obj; + }, + toJSON(message: MsgRecoverClient): unknown { + const obj: any = {}; + message.subjectClientId !== undefined && (obj.subjectClientId = message.subjectClientId); + message.substituteClientId !== undefined && (obj.substituteClientId = message.substituteClientId); + message.signer !== undefined && (obj.signer = message.signer); + return obj; + }, + fromPartial(object: Partial): MsgRecoverClient { + const message = createBaseMsgRecoverClient(); + message.subjectClientId = object.subjectClientId ?? ""; + message.substituteClientId = object.substituteClientId ?? ""; + message.signer = object.signer ?? ""; + return message; + }, +}; +function createBaseMsgRecoverClientResponse(): MsgRecoverClientResponse { + return {}; +} +export const MsgRecoverClientResponse = { + encode(_: MsgRecoverClientResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgRecoverClientResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRecoverClientResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): MsgRecoverClientResponse { + const obj = createBaseMsgRecoverClientResponse(); + return obj; + }, + toJSON(_: MsgRecoverClientResponse): unknown { + const obj: any = {}; + return obj; + }, + fromPartial(_: Partial): MsgRecoverClientResponse { + const message = createBaseMsgRecoverClientResponse(); + return message; + }, +}; +function createBaseMsgIBCSoftwareUpgrade(): MsgIBCSoftwareUpgrade { + return { + plan: Plan.fromPartial({}), + upgradedClientState: Any.fromPartial({}), + signer: "", + }; +} +export const MsgIBCSoftwareUpgrade = { + encode(message: MsgIBCSoftwareUpgrade, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.plan !== undefined) { + Plan.encode(message.plan, writer.uint32(10).fork()).ldelim(); + } + if (message.upgradedClientState !== undefined) { + Any.encode(message.upgradedClientState, writer.uint32(18).fork()).ldelim(); + } + if (message.signer !== "") { + writer.uint32(26).string(message.signer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgIBCSoftwareUpgrade { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgIBCSoftwareUpgrade(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.plan = Plan.decode(reader, reader.uint32()); + break; + case 2: + message.upgradedClientState = Any.decode(reader, reader.uint32()); + break; + case 3: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgIBCSoftwareUpgrade { + const obj = createBaseMsgIBCSoftwareUpgrade(); + if (isSet(object.plan)) obj.plan = Plan.fromJSON(object.plan); + if (isSet(object.upgradedClientState)) obj.upgradedClientState = Any.fromJSON(object.upgradedClientState); + if (isSet(object.signer)) obj.signer = String(object.signer); + return obj; + }, + toJSON(message: MsgIBCSoftwareUpgrade): unknown { + const obj: any = {}; + message.plan !== undefined && (obj.plan = message.plan ? Plan.toJSON(message.plan) : undefined); + message.upgradedClientState !== undefined && + (obj.upgradedClientState = message.upgradedClientState + ? Any.toJSON(message.upgradedClientState) + : undefined); + message.signer !== undefined && (obj.signer = message.signer); + return obj; + }, + fromPartial(object: Partial): MsgIBCSoftwareUpgrade { + const message = createBaseMsgIBCSoftwareUpgrade(); + if (object.plan !== undefined && object.plan !== null) { + message.plan = Plan.fromPartial(object.plan); + } + if (object.upgradedClientState !== undefined && object.upgradedClientState !== null) { + message.upgradedClientState = Any.fromPartial(object.upgradedClientState); + } + message.signer = object.signer ?? ""; + return message; + }, +}; +function createBaseMsgIBCSoftwareUpgradeResponse(): MsgIBCSoftwareUpgradeResponse { + return {}; +} +export const MsgIBCSoftwareUpgradeResponse = { + encode(_: MsgIBCSoftwareUpgradeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgIBCSoftwareUpgradeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgIBCSoftwareUpgradeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): MsgIBCSoftwareUpgradeResponse { + const obj = createBaseMsgIBCSoftwareUpgradeResponse(); + return obj; + }, + toJSON(_: MsgIBCSoftwareUpgradeResponse): unknown { + const obj: any = {}; + return obj; + }, + fromPartial(_: Partial): MsgIBCSoftwareUpgradeResponse { + const message = createBaseMsgIBCSoftwareUpgradeResponse(); + return message; + }, +}; +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { + signer: "", + params: Params.fromPartial({}), + }; +} +export const MsgUpdateParams = { + encode(message: MsgUpdateParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.signer !== "") { + writer.uint32(10).string(message.signer); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.signer = reader.string(); + break; + case 2: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgUpdateParams { + const obj = createBaseMsgUpdateParams(); + if (isSet(object.signer)) obj.signer = String(object.signer); + if (isSet(object.params)) obj.params = Params.fromJSON(object.params); + return obj; + }, + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + message.signer !== undefined && (obj.signer = message.signer); + message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + return obj; + }, + fromPartial(object: Partial): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + message.signer = object.signer ?? ""; + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromPartial(object.params); + } + return message; + }, +}; +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} +export const MsgUpdateParamsResponse = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): MsgUpdateParamsResponse { + const obj = createBaseMsgUpdateParamsResponse(); + return obj; + }, + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + fromPartial(_: Partial): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; +function createBaseMsgDeleteClientCreator(): MsgDeleteClientCreator { + return { + clientId: "", + signer: "", + }; +} +export const MsgDeleteClientCreator = { + encode(message: MsgDeleteClientCreator, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.signer !== "") { + writer.uint32(18).string(message.signer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeleteClientCreator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeleteClientCreator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgDeleteClientCreator { + const obj = createBaseMsgDeleteClientCreator(); + if (isSet(object.clientId)) obj.clientId = String(object.clientId); + if (isSet(object.signer)) obj.signer = String(object.signer); + return obj; + }, + toJSON(message: MsgDeleteClientCreator): unknown { + const obj: any = {}; + message.clientId !== undefined && (obj.clientId = message.clientId); + message.signer !== undefined && (obj.signer = message.signer); + return obj; + }, + fromPartial(object: Partial): MsgDeleteClientCreator { + const message = createBaseMsgDeleteClientCreator(); + message.clientId = object.clientId ?? ""; + message.signer = object.signer ?? ""; + return message; + }, +}; +function createBaseMsgDeleteClientCreatorResponse(): MsgDeleteClientCreatorResponse { + return {}; +} +export const MsgDeleteClientCreatorResponse = { + encode(_: MsgDeleteClientCreatorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeleteClientCreatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeleteClientCreatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): MsgDeleteClientCreatorResponse { + const obj = createBaseMsgDeleteClientCreatorResponse(); + return obj; + }, + toJSON(_: MsgDeleteClientCreatorResponse): unknown { + const obj: any = {}; + return obj; + }, + fromPartial(_: Partial): MsgDeleteClientCreatorResponse { + const message = createBaseMsgDeleteClientCreatorResponse(); + return message; + }, +}; /** Msg defines the ibc/client Msg service. */ export interface Msg { /** CreateClient defines a rpc handler method for MsgCreateClient. */ @@ -538,6 +991,14 @@ export interface Msg { UpgradeClient(request: MsgUpgradeClient): Promise; /** SubmitMisbehaviour defines a rpc handler method for MsgSubmitMisbehaviour. */ SubmitMisbehaviour(request: MsgSubmitMisbehaviour): Promise; + /** RecoverClient defines a rpc handler method for MsgRecoverClient. */ + RecoverClient(request: MsgRecoverClient): Promise; + /** IBCSoftwareUpgrade defines a rpc handler method for MsgIBCSoftwareUpgrade. */ + IBCSoftwareUpgrade(request: MsgIBCSoftwareUpgrade): Promise; + /** UpdateClientParams defines a rpc handler method for MsgUpdateParams. */ + UpdateClientParams(request: MsgUpdateParams): Promise; + /** DeleteClientCreator defines a rpc handler method for MsgDeleteClientCreator. */ + DeleteClientCreator(request: MsgDeleteClientCreator): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: Rpc; @@ -547,6 +1008,10 @@ export class MsgClientImpl implements Msg { this.UpdateClient = this.UpdateClient.bind(this); this.UpgradeClient = this.UpgradeClient.bind(this); this.SubmitMisbehaviour = this.SubmitMisbehaviour.bind(this); + this.RecoverClient = this.RecoverClient.bind(this); + this.IBCSoftwareUpgrade = this.IBCSoftwareUpgrade.bind(this); + this.UpdateClientParams = this.UpdateClientParams.bind(this); + this.DeleteClientCreator = this.DeleteClientCreator.bind(this); } CreateClient(request: MsgCreateClient): Promise { const data = MsgCreateClient.encode(request).finish(); @@ -568,4 +1033,24 @@ export class MsgClientImpl implements Msg { const promise = this.rpc.request("ibc.core.client.v1.Msg", "SubmitMisbehaviour", data); return promise.then((data) => MsgSubmitMisbehaviourResponse.decode(new BinaryReader(data))); } + RecoverClient(request: MsgRecoverClient): Promise { + const data = MsgRecoverClient.encode(request).finish(); + const promise = this.rpc.request("ibc.core.client.v1.Msg", "RecoverClient", data); + return promise.then((data) => MsgRecoverClientResponse.decode(new BinaryReader(data))); + } + IBCSoftwareUpgrade(request: MsgIBCSoftwareUpgrade): Promise { + const data = MsgIBCSoftwareUpgrade.encode(request).finish(); + const promise = this.rpc.request("ibc.core.client.v1.Msg", "IBCSoftwareUpgrade", data); + return promise.then((data) => MsgIBCSoftwareUpgradeResponse.decode(new BinaryReader(data))); + } + UpdateClientParams(request: MsgUpdateParams): Promise { + const data = MsgUpdateParams.encode(request).finish(); + const promise = this.rpc.request("ibc.core.client.v1.Msg", "UpdateClientParams", data); + return promise.then((data) => MsgUpdateParamsResponse.decode(new BinaryReader(data))); + } + DeleteClientCreator(request: MsgDeleteClientCreator): Promise { + const data = MsgDeleteClientCreator.encode(request).finish(); + const promise = this.rpc.request("ibc.core.client.v1.Msg", "DeleteClientCreator", data); + return promise.then((data) => MsgDeleteClientCreatorResponse.decode(new BinaryReader(data))); + } } diff --git a/src/ibc/core/client/v2/config.ts b/src/ibc/core/client/v2/config.ts new file mode 100644 index 0000000..3d6d853 --- /dev/null +++ b/src/ibc/core/client/v2/config.ts @@ -0,0 +1,63 @@ +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "../../../../binary"; +export const protobufPackage = "ibc.core.client.v2"; +/** + * Config is a **per-client** configuration struct that sets which relayers are allowed to relay v2 IBC messages + * for a given client. + * If it is set, then only relayers in the allow list can send v2 messages + * If it is not set, then the client allows permissionless relaying of v2 messages + */ +export interface Config { + /** allowed_relayers defines the set of allowed relayers for IBC V2 protocol for the given client */ + allowedRelayers: string[]; +} +function createBaseConfig(): Config { + return { + allowedRelayers: [], + }; +} +export const Config = { + encode(message: Config, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.allowedRelayers) { + writer.uint32(10).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Config { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConfig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.allowedRelayers.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): Config { + const obj = createBaseConfig(); + if (Array.isArray(object?.allowedRelayers)) + obj.allowedRelayers = object.allowedRelayers.map((e: any) => String(e)); + return obj; + }, + toJSON(message: Config): unknown { + const obj: any = {}; + if (message.allowedRelayers) { + obj.allowedRelayers = message.allowedRelayers.map((e) => e); + } else { + obj.allowedRelayers = []; + } + return obj; + }, + fromPartial(object: Partial): Config { + const message = createBaseConfig(); + message.allowedRelayers = object.allowedRelayers?.map((e) => e) || []; + return message; + }, +}; diff --git a/src/ibc/core/client/v2/counterparty.ts b/src/ibc/core/client/v2/counterparty.ts new file mode 100644 index 0000000..f2f1938 --- /dev/null +++ b/src/ibc/core/client/v2/counterparty.ts @@ -0,0 +1,73 @@ +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { bytesFromBase64, isSet, base64FromBytes } from "../../../../helpers"; +export const protobufPackage = "ibc.core.client.v2"; +/** CounterpartyInfo defines the key that the counterparty will use to message our client */ +export interface CounterpartyInfo { + /** merkle prefix key is the prefix that ics provable keys are stored under */ + merklePrefix: Uint8Array[]; + /** client identifier is the identifier used to send packet messages to our client */ + clientId: string; +} +function createBaseCounterpartyInfo(): CounterpartyInfo { + return { + merklePrefix: [], + clientId: "", + }; +} +export const CounterpartyInfo = { + encode(message: CounterpartyInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.merklePrefix) { + writer.uint32(10).bytes(v!); + } + if (message.clientId !== "") { + writer.uint32(18).string(message.clientId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): CounterpartyInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCounterpartyInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.merklePrefix.push(reader.bytes()); + break; + case 2: + message.clientId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): CounterpartyInfo { + const obj = createBaseCounterpartyInfo(); + if (Array.isArray(object?.merklePrefix)) + obj.merklePrefix = object.merklePrefix.map((e: any) => bytesFromBase64(e)); + if (isSet(object.clientId)) obj.clientId = String(object.clientId); + return obj; + }, + toJSON(message: CounterpartyInfo): unknown { + const obj: any = {}; + if (message.merklePrefix) { + obj.merklePrefix = message.merklePrefix.map((e) => + base64FromBytes(e !== undefined ? e : new Uint8Array()), + ); + } else { + obj.merklePrefix = []; + } + message.clientId !== undefined && (obj.clientId = message.clientId); + return obj; + }, + fromPartial(object: Partial): CounterpartyInfo { + const message = createBaseCounterpartyInfo(); + message.merklePrefix = object.merklePrefix?.map((e) => e) || []; + message.clientId = object.clientId ?? ""; + return message; + }, +}; diff --git a/src/ibc/core/client/v2/genesis.ts b/src/ibc/core/client/v2/genesis.ts new file mode 100644 index 0000000..c93f976 --- /dev/null +++ b/src/ibc/core/client/v2/genesis.ts @@ -0,0 +1,131 @@ +/* eslint-disable */ +import { CounterpartyInfo } from "./counterparty"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { isSet } from "../../../../helpers"; +export const protobufPackage = "ibc.core.client.v2"; +/** GenesisCounterpartyInfo defines the state associating a client with a counterparty. */ +export interface GenesisCounterpartyInfo { + /** ClientId is the ID of the given client. */ + clientId: string; + /** CounterpartyInfo is the counterparty info of the given client. */ + counterpartyInfo: CounterpartyInfo; +} +/** GenesisState defines the ibc client v2 submodule's genesis state. */ +export interface GenesisState { + /** counterparty info for each client */ + counterpartyInfos: GenesisCounterpartyInfo[]; +} +function createBaseGenesisCounterpartyInfo(): GenesisCounterpartyInfo { + return { + clientId: "", + counterpartyInfo: CounterpartyInfo.fromPartial({}), + }; +} +export const GenesisCounterpartyInfo = { + encode(message: GenesisCounterpartyInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.counterpartyInfo !== undefined) { + CounterpartyInfo.encode(message.counterpartyInfo, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GenesisCounterpartyInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisCounterpartyInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.counterpartyInfo = CounterpartyInfo.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): GenesisCounterpartyInfo { + const obj = createBaseGenesisCounterpartyInfo(); + if (isSet(object.clientId)) obj.clientId = String(object.clientId); + if (isSet(object.counterpartyInfo)) + obj.counterpartyInfo = CounterpartyInfo.fromJSON(object.counterpartyInfo); + return obj; + }, + toJSON(message: GenesisCounterpartyInfo): unknown { + const obj: any = {}; + message.clientId !== undefined && (obj.clientId = message.clientId); + message.counterpartyInfo !== undefined && + (obj.counterpartyInfo = message.counterpartyInfo + ? CounterpartyInfo.toJSON(message.counterpartyInfo) + : undefined); + return obj; + }, + fromPartial(object: Partial): GenesisCounterpartyInfo { + const message = createBaseGenesisCounterpartyInfo(); + message.clientId = object.clientId ?? ""; + if (object.counterpartyInfo !== undefined && object.counterpartyInfo !== null) { + message.counterpartyInfo = CounterpartyInfo.fromPartial(object.counterpartyInfo); + } + return message; + }, +}; +function createBaseGenesisState(): GenesisState { + return { + counterpartyInfos: [], + }; +} +export const GenesisState = { + encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.counterpartyInfos) { + GenesisCounterpartyInfo.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.counterpartyInfos.push(GenesisCounterpartyInfo.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): GenesisState { + const obj = createBaseGenesisState(); + if (Array.isArray(object?.counterpartyInfos)) + obj.counterpartyInfos = object.counterpartyInfos.map((e: any) => GenesisCounterpartyInfo.fromJSON(e)); + return obj; + }, + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.counterpartyInfos) { + obj.counterpartyInfos = message.counterpartyInfos.map((e) => + e ? GenesisCounterpartyInfo.toJSON(e) : undefined, + ); + } else { + obj.counterpartyInfos = []; + } + return obj; + }, + fromPartial(object: Partial): GenesisState { + const message = createBaseGenesisState(); + message.counterpartyInfos = + object.counterpartyInfos?.map((e) => GenesisCounterpartyInfo.fromPartial(e)) || []; + return message; + }, +}; diff --git a/src/ibc/core/client/v2/query.ts b/src/ibc/core/client/v2/query.ts new file mode 100644 index 0000000..0be86f3 --- /dev/null +++ b/src/ibc/core/client/v2/query.ts @@ -0,0 +1,243 @@ +/* eslint-disable */ +import { CounterpartyInfo } from "./counterparty"; +import { Config } from "./config"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { isSet, Rpc } from "../../../../helpers"; +export const protobufPackage = "ibc.core.client.v2"; +/** + * QueryCounterpartyInfoRequest is the request type for the Query/CounterpartyInfo RPC + * method + */ +export interface QueryCounterpartyInfoRequest { + /** client state unique identifier */ + clientId: string; +} +/** + * QueryCounterpartyInfoResponse is the response type for the + * Query/CounterpartyInfo RPC method. + */ +export interface QueryCounterpartyInfoResponse { + counterpartyInfo: CounterpartyInfo; +} +/** QueryConfigRequest is the request type for the Query/Config RPC method */ +export interface QueryConfigRequest { + /** client state unique identifier */ + clientId: string; +} +/** QueryConfigResponse is the response type for the Query/Config RPC method */ +export interface QueryConfigResponse { + config: Config; +} +function createBaseQueryCounterpartyInfoRequest(): QueryCounterpartyInfoRequest { + return { + clientId: "", + }; +} +export const QueryCounterpartyInfoRequest = { + encode(message: QueryCounterpartyInfoRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryCounterpartyInfoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCounterpartyInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryCounterpartyInfoRequest { + const obj = createBaseQueryCounterpartyInfoRequest(); + if (isSet(object.clientId)) obj.clientId = String(object.clientId); + return obj; + }, + toJSON(message: QueryCounterpartyInfoRequest): unknown { + const obj: any = {}; + message.clientId !== undefined && (obj.clientId = message.clientId); + return obj; + }, + fromPartial(object: Partial): QueryCounterpartyInfoRequest { + const message = createBaseQueryCounterpartyInfoRequest(); + message.clientId = object.clientId ?? ""; + return message; + }, +}; +function createBaseQueryCounterpartyInfoResponse(): QueryCounterpartyInfoResponse { + return { + counterpartyInfo: CounterpartyInfo.fromPartial({}), + }; +} +export const QueryCounterpartyInfoResponse = { + encode(message: QueryCounterpartyInfoResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.counterpartyInfo !== undefined) { + CounterpartyInfo.encode(message.counterpartyInfo, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryCounterpartyInfoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCounterpartyInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.counterpartyInfo = CounterpartyInfo.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryCounterpartyInfoResponse { + const obj = createBaseQueryCounterpartyInfoResponse(); + if (isSet(object.counterpartyInfo)) + obj.counterpartyInfo = CounterpartyInfo.fromJSON(object.counterpartyInfo); + return obj; + }, + toJSON(message: QueryCounterpartyInfoResponse): unknown { + const obj: any = {}; + message.counterpartyInfo !== undefined && + (obj.counterpartyInfo = message.counterpartyInfo + ? CounterpartyInfo.toJSON(message.counterpartyInfo) + : undefined); + return obj; + }, + fromPartial(object: Partial): QueryCounterpartyInfoResponse { + const message = createBaseQueryCounterpartyInfoResponse(); + if (object.counterpartyInfo !== undefined && object.counterpartyInfo !== null) { + message.counterpartyInfo = CounterpartyInfo.fromPartial(object.counterpartyInfo); + } + return message; + }, +}; +function createBaseQueryConfigRequest(): QueryConfigRequest { + return { + clientId: "", + }; +} +export const QueryConfigRequest = { + encode(message: QueryConfigRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryConfigRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConfigRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryConfigRequest { + const obj = createBaseQueryConfigRequest(); + if (isSet(object.clientId)) obj.clientId = String(object.clientId); + return obj; + }, + toJSON(message: QueryConfigRequest): unknown { + const obj: any = {}; + message.clientId !== undefined && (obj.clientId = message.clientId); + return obj; + }, + fromPartial(object: Partial): QueryConfigRequest { + const message = createBaseQueryConfigRequest(); + message.clientId = object.clientId ?? ""; + return message; + }, +}; +function createBaseQueryConfigResponse(): QueryConfigResponse { + return { + config: Config.fromPartial({}), + }; +} +export const QueryConfigResponse = { + encode(message: QueryConfigResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.config !== undefined) { + Config.encode(message.config, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryConfigResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConfigResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.config = Config.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryConfigResponse { + const obj = createBaseQueryConfigResponse(); + if (isSet(object.config)) obj.config = Config.fromJSON(object.config); + return obj; + }, + toJSON(message: QueryConfigResponse): unknown { + const obj: any = {}; + message.config !== undefined && (obj.config = message.config ? Config.toJSON(message.config) : undefined); + return obj; + }, + fromPartial(object: Partial): QueryConfigResponse { + const message = createBaseQueryConfigResponse(); + if (object.config !== undefined && object.config !== null) { + message.config = Config.fromPartial(object.config); + } + return message; + }, +}; +/** Query provides defines the gRPC querier service */ +export interface Query { + /** CounterpartyInfo queries an IBC light counter party info. */ + CounterpartyInfo(request: QueryCounterpartyInfoRequest): Promise; + /** Config queries the IBC client v2 configuration for a given client. */ + Config(request: QueryConfigRequest): Promise; +} +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + this.CounterpartyInfo = this.CounterpartyInfo.bind(this); + this.Config = this.Config.bind(this); + } + CounterpartyInfo(request: QueryCounterpartyInfoRequest): Promise { + const data = QueryCounterpartyInfoRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.client.v2.Query", "CounterpartyInfo", data); + return promise.then((data) => QueryCounterpartyInfoResponse.decode(new BinaryReader(data))); + } + Config(request: QueryConfigRequest): Promise { + const data = QueryConfigRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.client.v2.Query", "Config", data); + return promise.then((data) => QueryConfigResponse.decode(new BinaryReader(data))); + } +} diff --git a/src/ibc/core/client/v2/tx.amino.ts b/src/ibc/core/client/v2/tx.amino.ts new file mode 100644 index 0000000..209cc13 --- /dev/null +++ b/src/ibc/core/client/v2/tx.amino.ts @@ -0,0 +1,82 @@ +/* eslint-disable */ +import { AminoMsg } from "@cosmjs/amino"; +import { MsgRegisterCounterparty, MsgUpdateClientConfig } from "./tx"; +export interface MsgRegisterCounterpartyAminoType extends AminoMsg { + type: "cosmos-sdk/MsgRegisterCounterparty"; + value: { + client_id: string; + counterparty_merkle_prefix: Uint8Array[]; + counterparty_client_id: string; + signer: string; + }; +} +export interface MsgUpdateClientConfigAminoType extends AminoMsg { + type: "cosmos-sdk/MsgUpdateClientConfig"; + value: { + client_id: string; + config: { + allowed_relayers: string[]; + }; + signer: string; + }; +} +export const AminoConverter = { + "/ibc.core.client.v2.MsgRegisterCounterparty": { + aminoType: "cosmos-sdk/MsgRegisterCounterparty", + toAmino: ({ + clientId, + counterpartyMerklePrefix, + counterpartyClientId, + signer, + }: MsgRegisterCounterparty): MsgRegisterCounterpartyAminoType["value"] => { + return { + client_id: clientId, + counterparty_merkle_prefix: counterpartyMerklePrefix, + counterparty_client_id: counterpartyClientId, + signer, + }; + }, + fromAmino: ({ + client_id, + counterparty_merkle_prefix, + counterparty_client_id, + signer, + }: MsgRegisterCounterpartyAminoType["value"]): MsgRegisterCounterparty => { + return { + clientId: client_id, + counterpartyMerklePrefix: counterparty_merkle_prefix, + counterpartyClientId: counterparty_client_id, + signer, + }; + }, + }, + "/ibc.core.client.v2.MsgUpdateClientConfig": { + aminoType: "cosmos-sdk/MsgUpdateClientConfig", + toAmino: ({ + clientId, + config, + signer, + }: MsgUpdateClientConfig): MsgUpdateClientConfigAminoType["value"] => { + return { + client_id: clientId, + config: { + allowed_relayers: config.allowedRelayers, + }, + signer, + }; + }, + fromAmino: ({ + client_id, + config, + signer, + }: MsgUpdateClientConfigAminoType["value"]): MsgUpdateClientConfig => { + return { + clientId: client_id, + config: { + allowedRelayers: config.allowed_relayers, + }, + signer, + }; + }, + }, +}; diff --git a/src/ibc/core/client/v2/tx.registry.ts b/src/ibc/core/client/v2/tx.registry.ts new file mode 100644 index 0000000..5ff55f4 --- /dev/null +++ b/src/ibc/core/client/v2/tx.registry.ts @@ -0,0 +1,85 @@ +//@ts-nocheck +/* eslint-disable */ +import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { MsgRegisterCounterparty, MsgUpdateClientConfig } from "./tx"; +export const registry: ReadonlyArray<[string, GeneratedType]> = [ + ["/ibc.core.client.v2.MsgRegisterCounterparty", MsgRegisterCounterparty], + ["/ibc.core.client.v2.MsgUpdateClientConfig", MsgUpdateClientConfig], +]; +export const load = (protoRegistry: Registry) => { + registry.forEach(([typeUrl, mod]) => { + protoRegistry.register(typeUrl, mod); + }); +}; +export const MessageComposer = { + encoded: { + registerCounterparty(value: MsgRegisterCounterparty) { + return { + typeUrl: "/ibc.core.client.v2.MsgRegisterCounterparty", + value: MsgRegisterCounterparty.encode(value).finish(), + }; + }, + updateClientConfig(value: MsgUpdateClientConfig) { + return { + typeUrl: "/ibc.core.client.v2.MsgUpdateClientConfig", + value: MsgUpdateClientConfig.encode(value).finish(), + }; + }, + }, + withTypeUrl: { + registerCounterparty(value: MsgRegisterCounterparty) { + return { + typeUrl: "/ibc.core.client.v2.MsgRegisterCounterparty", + value, + }; + }, + updateClientConfig(value: MsgUpdateClientConfig) { + return { + typeUrl: "/ibc.core.client.v2.MsgUpdateClientConfig", + value, + }; + }, + }, + toJSON: { + registerCounterparty(value: MsgRegisterCounterparty) { + return { + typeUrl: "/ibc.core.client.v2.MsgRegisterCounterparty", + value: MsgRegisterCounterparty.toJSON(value), + }; + }, + updateClientConfig(value: MsgUpdateClientConfig) { + return { + typeUrl: "/ibc.core.client.v2.MsgUpdateClientConfig", + value: MsgUpdateClientConfig.toJSON(value), + }; + }, + }, + fromJSON: { + registerCounterparty(value: any) { + return { + typeUrl: "/ibc.core.client.v2.MsgRegisterCounterparty", + value: MsgRegisterCounterparty.fromJSON(value), + }; + }, + updateClientConfig(value: any) { + return { + typeUrl: "/ibc.core.client.v2.MsgUpdateClientConfig", + value: MsgUpdateClientConfig.fromJSON(value), + }; + }, + }, + fromPartial: { + registerCounterparty(value: MsgRegisterCounterparty) { + return { + typeUrl: "/ibc.core.client.v2.MsgRegisterCounterparty", + value: MsgRegisterCounterparty.fromPartial(value), + }; + }, + updateClientConfig(value: MsgUpdateClientConfig) { + return { + typeUrl: "/ibc.core.client.v2.MsgUpdateClientConfig", + value: MsgUpdateClientConfig.fromPartial(value), + }; + }, + }, +}; diff --git a/src/ibc/core/client/v2/tx.ts b/src/ibc/core/client/v2/tx.ts new file mode 100644 index 0000000..70a5d8b --- /dev/null +++ b/src/ibc/core/client/v2/tx.ts @@ -0,0 +1,275 @@ +/* eslint-disable */ +import { Config } from "./config"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { isSet, bytesFromBase64, base64FromBytes, Rpc } from "../../../../helpers"; +export const protobufPackage = "ibc.core.client.v2"; +/** MsgRegisterCounterparty defines a message to register a counterparty on a client */ +export interface MsgRegisterCounterparty { + /** client identifier */ + clientId: string; + /** counterparty merkle prefix */ + counterpartyMerklePrefix: Uint8Array[]; + /** counterparty client identifier */ + counterpartyClientId: string; + /** signer address */ + signer: string; +} +/** MsgRegisterCounterpartyResponse defines the Msg/RegisterCounterparty response type. */ +export interface MsgRegisterCounterpartyResponse {} +/** MsgUpdateClientConfig defines the sdk.Msg type to update the configuration for a given client */ +export interface MsgUpdateClientConfig { + /** client identifier */ + clientId: string; + /** + * allowed relayers + * + * NOTE: All fields in the config must be supplied. + */ + config: Config; + /** signer address */ + signer: string; +} +/** MsgUpdateClientConfigResponse defines the MsgUpdateClientConfig response type. */ +export interface MsgUpdateClientConfigResponse {} +function createBaseMsgRegisterCounterparty(): MsgRegisterCounterparty { + return { + clientId: "", + counterpartyMerklePrefix: [], + counterpartyClientId: "", + signer: "", + }; +} +export const MsgRegisterCounterparty = { + encode(message: MsgRegisterCounterparty, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + for (const v of message.counterpartyMerklePrefix) { + writer.uint32(18).bytes(v!); + } + if (message.counterpartyClientId !== "") { + writer.uint32(26).string(message.counterpartyClientId); + } + if (message.signer !== "") { + writer.uint32(34).string(message.signer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterCounterparty { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterCounterparty(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.counterpartyMerklePrefix.push(reader.bytes()); + break; + case 3: + message.counterpartyClientId = reader.string(); + break; + case 4: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgRegisterCounterparty { + const obj = createBaseMsgRegisterCounterparty(); + if (isSet(object.clientId)) obj.clientId = String(object.clientId); + if (Array.isArray(object?.counterpartyMerklePrefix)) + obj.counterpartyMerklePrefix = object.counterpartyMerklePrefix.map((e: any) => bytesFromBase64(e)); + if (isSet(object.counterpartyClientId)) obj.counterpartyClientId = String(object.counterpartyClientId); + if (isSet(object.signer)) obj.signer = String(object.signer); + return obj; + }, + toJSON(message: MsgRegisterCounterparty): unknown { + const obj: any = {}; + message.clientId !== undefined && (obj.clientId = message.clientId); + if (message.counterpartyMerklePrefix) { + obj.counterpartyMerklePrefix = message.counterpartyMerklePrefix.map((e) => + base64FromBytes(e !== undefined ? e : new Uint8Array()), + ); + } else { + obj.counterpartyMerklePrefix = []; + } + message.counterpartyClientId !== undefined && (obj.counterpartyClientId = message.counterpartyClientId); + message.signer !== undefined && (obj.signer = message.signer); + return obj; + }, + fromPartial(object: Partial): MsgRegisterCounterparty { + const message = createBaseMsgRegisterCounterparty(); + message.clientId = object.clientId ?? ""; + message.counterpartyMerklePrefix = object.counterpartyMerklePrefix?.map((e) => e) || []; + message.counterpartyClientId = object.counterpartyClientId ?? ""; + message.signer = object.signer ?? ""; + return message; + }, +}; +function createBaseMsgRegisterCounterpartyResponse(): MsgRegisterCounterpartyResponse { + return {}; +} +export const MsgRegisterCounterpartyResponse = { + encode(_: MsgRegisterCounterpartyResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterCounterpartyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterCounterpartyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): MsgRegisterCounterpartyResponse { + const obj = createBaseMsgRegisterCounterpartyResponse(); + return obj; + }, + toJSON(_: MsgRegisterCounterpartyResponse): unknown { + const obj: any = {}; + return obj; + }, + fromPartial(_: Partial): MsgRegisterCounterpartyResponse { + const message = createBaseMsgRegisterCounterpartyResponse(); + return message; + }, +}; +function createBaseMsgUpdateClientConfig(): MsgUpdateClientConfig { + return { + clientId: "", + config: Config.fromPartial({}), + signer: "", + }; +} +export const MsgUpdateClientConfig = { + encode(message: MsgUpdateClientConfig, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.config !== undefined) { + Config.encode(message.config, writer.uint32(18).fork()).ldelim(); + } + if (message.signer !== "") { + writer.uint32(26).string(message.signer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateClientConfig { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateClientConfig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.config = Config.decode(reader, reader.uint32()); + break; + case 3: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgUpdateClientConfig { + const obj = createBaseMsgUpdateClientConfig(); + if (isSet(object.clientId)) obj.clientId = String(object.clientId); + if (isSet(object.config)) obj.config = Config.fromJSON(object.config); + if (isSet(object.signer)) obj.signer = String(object.signer); + return obj; + }, + toJSON(message: MsgUpdateClientConfig): unknown { + const obj: any = {}; + message.clientId !== undefined && (obj.clientId = message.clientId); + message.config !== undefined && (obj.config = message.config ? Config.toJSON(message.config) : undefined); + message.signer !== undefined && (obj.signer = message.signer); + return obj; + }, + fromPartial(object: Partial): MsgUpdateClientConfig { + const message = createBaseMsgUpdateClientConfig(); + message.clientId = object.clientId ?? ""; + if (object.config !== undefined && object.config !== null) { + message.config = Config.fromPartial(object.config); + } + message.signer = object.signer ?? ""; + return message; + }, +}; +function createBaseMsgUpdateClientConfigResponse(): MsgUpdateClientConfigResponse { + return {}; +} +export const MsgUpdateClientConfigResponse = { + encode(_: MsgUpdateClientConfigResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateClientConfigResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateClientConfigResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): MsgUpdateClientConfigResponse { + const obj = createBaseMsgUpdateClientConfigResponse(); + return obj; + }, + toJSON(_: MsgUpdateClientConfigResponse): unknown { + const obj: any = {}; + return obj; + }, + fromPartial(_: Partial): MsgUpdateClientConfigResponse { + const message = createBaseMsgUpdateClientConfigResponse(); + return message; + }, +}; +/** Msg defines the ibc/client/v2 Msg service. */ +export interface Msg { + /** RegisterCounterparty defines a rpc handler method for MsgRegisterCounterparty. */ + RegisterCounterparty(request: MsgRegisterCounterparty): Promise; + /** UpdateClientConfig defines a rpc handler method for MsgUpdateClientConfig. */ + UpdateClientConfig(request: MsgUpdateClientConfig): Promise; +} +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + this.RegisterCounterparty = this.RegisterCounterparty.bind(this); + this.UpdateClientConfig = this.UpdateClientConfig.bind(this); + } + RegisterCounterparty(request: MsgRegisterCounterparty): Promise { + const data = MsgRegisterCounterparty.encode(request).finish(); + const promise = this.rpc.request("ibc.core.client.v2.Msg", "RegisterCounterparty", data); + return promise.then((data) => MsgRegisterCounterpartyResponse.decode(new BinaryReader(data))); + } + UpdateClientConfig(request: MsgUpdateClientConfig): Promise { + const data = MsgUpdateClientConfig.encode(request).finish(); + const promise = this.rpc.request("ibc.core.client.v2.Msg", "UpdateClientConfig", data); + return promise.then((data) => MsgUpdateClientConfigResponse.decode(new BinaryReader(data))); + } +} diff --git a/src/ibc/core/commitment/v1/commitment.ts b/src/ibc/core/commitment/v1/commitment.ts index b994fe8..3ebf952 100644 --- a/src/ibc/core/commitment/v1/commitment.ts +++ b/src/ibc/core/commitment/v1/commitment.ts @@ -18,14 +18,6 @@ export interface MerkleRoot { export interface MerklePrefix { keyPrefix: Uint8Array; } -/** - * MerklePath is the path used to verify commitment proofs, which can be an - * arbitrary structured object (defined by a commitment type). - * MerklePath is represented from root-to-leaf - */ -export interface MerklePath { - keyPath: string[]; -} /** * MerkleProof is a wrapper type over a chain of CommitmentProofs. * It demonstrates membership or non-membership for an element or set of @@ -130,55 +122,6 @@ export const MerklePrefix = { return message; }, }; -function createBaseMerklePath(): MerklePath { - return { - keyPath: [], - }; -} -export const MerklePath = { - encode(message: MerklePath, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - for (const v of message.keyPath) { - writer.uint32(10).string(v!); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): MerklePath { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMerklePath(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.keyPath.push(reader.string()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): MerklePath { - const obj = createBaseMerklePath(); - if (Array.isArray(object?.keyPath)) obj.keyPath = object.keyPath.map((e: any) => String(e)); - return obj; - }, - toJSON(message: MerklePath): unknown { - const obj: any = {}; - if (message.keyPath) { - obj.keyPath = message.keyPath.map((e) => e); - } else { - obj.keyPath = []; - } - return obj; - }, - fromPartial(object: Partial): MerklePath { - const message = createBaseMerklePath(); - message.keyPath = object.keyPath?.map((e) => e) || []; - return message; - }, -}; function createBaseMerkleProof(): MerkleProof { return { proofs: [], diff --git a/src/ibc/core/commitment/v2/commitment.ts b/src/ibc/core/commitment/v2/commitment.ts new file mode 100644 index 0000000..e9045cb --- /dev/null +++ b/src/ibc/core/commitment/v2/commitment.ts @@ -0,0 +1,89 @@ +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { bytesFromBase64, base64FromBytes } from "../../../../helpers"; +export const protobufPackage = "ibc.core.commitment.v2"; +/** + * MerklePath is the path used to verify commitment proofs, which can be an + * arbitrary structured object (defined by a commitment type). + * ICS-23 verification supports membership proofs for nested merkle trees. + * The ICS-24 standard provable keys MUST be stored in the lowest level tree with an optional prefix. + * The IC24 provable tree may then be stored in a higher level tree(s) that hash up to the root hash + * stored in the consensus state of the client. + * Each element of the path represents the key of a merkle tree from the root to the leaf. + * The elements of the path before the final element must be the path to the tree that contains + * the ICS24 provable store. Thus, it should remain constant for all ICS24 proofs. + * The final element of the path is the key of the leaf in the ICS24 provable store, + * Thus IBC core will append the ICS24 path to the final element of the MerklePath + * stored in the counterparty to create the full path to the leaf for proof verification. + * Examples: + * Cosmos SDK: + * The Cosmos SDK commits to a multi-tree where each store is an IAVL tree and all store hashes + * are hashed in a simple merkle tree to get the final root hash. Thus, the MerklePath in the counterparty + * MerklePrefix has the following structure: ["ibc", ""] + * The core IBC handler will append the ICS24 path to the final element of the MerklePath + * like so: ["ibc", "{packetCommitmentPath}"] which will then be used for final verification. + * Ethereum: + * The Ethereum client commits to a single Patricia merkle trie. The ICS24 provable store is managed + * by the smart contract state. Each smart contract has a specific prefix reserved within the global trie. + * Thus the MerklePath in the counterparty is the prefix to the smart contract state in the global trie. + * Since there is only one tree in the commitment structure of ethereum the MerklePath in the counterparty + * MerklePrefix has the following structure: ["IBCCoreContractAddressStoragePrefix"] + * The core IBC handler will append the ICS24 path to the final element of the MerklePath + * like so: ["IBCCoreContractAddressStoragePrefix{packetCommitmentPath}"] which will then be used for final + * verification. Thus the MerklePath in the counterparty MerklePrefix is the nested key path from the root hash of the + * consensus state down to the ICS24 provable store. The IBC handler retrieves the counterparty key path to the ICS24 + * provable store from the MerklePath and appends the ICS24 path to get the final key path to the value being verified + * by the client against the root hash in the client's consensus state. + */ +export interface MerklePath { + keyPath: Uint8Array[]; +} +function createBaseMerklePath(): MerklePath { + return { + keyPath: [], + }; +} +export const MerklePath = { + encode(message: MerklePath, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.keyPath) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MerklePath { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMerklePath(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.keyPath.push(reader.bytes()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MerklePath { + const obj = createBaseMerklePath(); + if (Array.isArray(object?.keyPath)) obj.keyPath = object.keyPath.map((e: any) => bytesFromBase64(e)); + return obj; + }, + toJSON(message: MerklePath): unknown { + const obj: any = {}; + if (message.keyPath) { + obj.keyPath = message.keyPath.map((e) => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.keyPath = []; + } + return obj; + }, + fromPartial(object: Partial): MerklePath { + const message = createBaseMerklePath(); + message.keyPath = object.keyPath?.map((e) => e) || []; + return message; + }, +}; diff --git a/src/ibc/core/connection/v1/connection.ts b/src/ibc/core/connection/v1/connection.ts index d38cf85..7e72ac3 100644 --- a/src/ibc/core/connection/v1/connection.ts +++ b/src/ibc/core/connection/v1/connection.ts @@ -130,7 +130,7 @@ export interface ConnectionPaths { paths: string[]; } /** - * Version defines the versioning scheme used to negotiate the IBC verison in + * Version defines the versioning scheme used to negotiate the IBC version in * the connection handshake. */ export interface Version { diff --git a/src/ibc/core/connection/v1/tx.amino.ts b/src/ibc/core/connection/v1/tx.amino.ts index ff83873..64ccc63 100644 --- a/src/ibc/core/connection/v1/tx.amino.ts +++ b/src/ibc/core/connection/v1/tx.amino.ts @@ -6,6 +6,7 @@ import { MsgConnectionOpenTry, MsgConnectionOpenAck, MsgConnectionOpenConfirm, + MsgUpdateParams, } from "./tx"; export interface MsgConnectionOpenInitAminoType extends AminoMsg { type: "cosmos-sdk/MsgConnectionOpenInit"; @@ -87,6 +88,15 @@ export interface MsgConnectionOpenConfirmAminoType extends AminoMsg { signer: string; }; } +export interface MsgUpdateParamsAminoType extends AminoMsg { + type: "cosmos-sdk/MsgUpdateParams"; + value: { + signer: string; + params: { + allowed_clients: string[]; + }; + }; +} export const AminoConverter = { "/ibc.core.connection.v1.MsgConnectionOpenInit": { aminoType: "cosmos-sdk/MsgConnectionOpenInit", @@ -376,4 +386,23 @@ export const AminoConverter = { }; }, }, + "/ibc.core.connection.v1.MsgUpdateParams": { + aminoType: "cosmos-sdk/MsgUpdateParams", + toAmino: ({ signer, params }: MsgUpdateParams): MsgUpdateParamsAminoType["value"] => { + return { + signer, + params: { + allowed_clients: params.allowedClients, + }, + }; + }, + fromAmino: ({ signer, params }: MsgUpdateParamsAminoType["value"]): MsgUpdateParams => { + return { + signer, + params: { + allowedClients: params.allowed_clients, + }, + }; + }, + }, }; diff --git a/src/ibc/core/connection/v1/tx.registry.ts b/src/ibc/core/connection/v1/tx.registry.ts index cfee3db..cdec368 100644 --- a/src/ibc/core/connection/v1/tx.registry.ts +++ b/src/ibc/core/connection/v1/tx.registry.ts @@ -6,12 +6,14 @@ import { MsgConnectionOpenTry, MsgConnectionOpenAck, MsgConnectionOpenConfirm, + MsgUpdateParams, } from "./tx"; export const registry: ReadonlyArray<[string, GeneratedType]> = [ ["/ibc.core.connection.v1.MsgConnectionOpenInit", MsgConnectionOpenInit], ["/ibc.core.connection.v1.MsgConnectionOpenTry", MsgConnectionOpenTry], ["/ibc.core.connection.v1.MsgConnectionOpenAck", MsgConnectionOpenAck], ["/ibc.core.connection.v1.MsgConnectionOpenConfirm", MsgConnectionOpenConfirm], + ["/ibc.core.connection.v1.MsgUpdateParams", MsgUpdateParams], ]; export const load = (protoRegistry: Registry) => { registry.forEach(([typeUrl, mod]) => { @@ -44,6 +46,12 @@ export const MessageComposer = { value: MsgConnectionOpenConfirm.encode(value).finish(), }; }, + updateConnectionParams(value: MsgUpdateParams) { + return { + typeUrl: "/ibc.core.connection.v1.MsgUpdateParams", + value: MsgUpdateParams.encode(value).finish(), + }; + }, }, withTypeUrl: { connectionOpenInit(value: MsgConnectionOpenInit) { @@ -70,6 +78,12 @@ export const MessageComposer = { value, }; }, + updateConnectionParams(value: MsgUpdateParams) { + return { + typeUrl: "/ibc.core.connection.v1.MsgUpdateParams", + value, + }; + }, }, toJSON: { connectionOpenInit(value: MsgConnectionOpenInit) { @@ -96,6 +110,12 @@ export const MessageComposer = { value: MsgConnectionOpenConfirm.toJSON(value), }; }, + updateConnectionParams(value: MsgUpdateParams) { + return { + typeUrl: "/ibc.core.connection.v1.MsgUpdateParams", + value: MsgUpdateParams.toJSON(value), + }; + }, }, fromJSON: { connectionOpenInit(value: any) { @@ -122,6 +142,12 @@ export const MessageComposer = { value: MsgConnectionOpenConfirm.fromJSON(value), }; }, + updateConnectionParams(value: any) { + return { + typeUrl: "/ibc.core.connection.v1.MsgUpdateParams", + value: MsgUpdateParams.fromJSON(value), + }; + }, }, fromPartial: { connectionOpenInit(value: MsgConnectionOpenInit) { @@ -148,5 +174,11 @@ export const MessageComposer = { value: MsgConnectionOpenConfirm.fromPartial(value), }; }, + updateConnectionParams(value: MsgUpdateParams) { + return { + typeUrl: "/ibc.core.connection.v1.MsgUpdateParams", + value: MsgUpdateParams.fromPartial(value), + }; + }, }, }; diff --git a/src/ibc/core/connection/v1/tx.ts b/src/ibc/core/connection/v1/tx.ts index eca2f00..d9c7a22 100644 --- a/src/ibc/core/connection/v1/tx.ts +++ b/src/ibc/core/connection/v1/tx.ts @@ -1,7 +1,7 @@ /* eslint-disable */ import { Counterparty, Version } from "./connection"; import { Any } from "../../../../google/protobuf/any"; -import { Height } from "../../client/v1/client"; +import { Height, Params } from "../../client/v1/client"; import { BinaryReader, BinaryWriter } from "../../../../binary"; import { isSet, bytesFromBase64, base64FromBytes, Rpc } from "../../../../helpers"; export const protobufPackage = "ibc.core.connection.v1"; @@ -30,23 +30,30 @@ export interface MsgConnectionOpenTry { /** Deprecated: this field is unused. Crossing hellos are no longer supported in core IBC. */ /** @deprecated */ previousConnectionId: string; + /** Deprecated: this field is unused. */ + /** @deprecated */ clientState: Any; counterparty: Counterparty; delayPeriod: bigint; counterpartyVersions: Version[]; proofHeight: Height; /** - * proof of the initialization the connection on Chain A: `UNITIALIZED -> + * proof of the initialization the connection on Chain A: `UNINITIALIZED -> * INIT` */ proofInit: Uint8Array; - /** proof of client state included in message */ + /** Deprecated: this field is unused. */ + /** @deprecated */ proofClient: Uint8Array; - /** proof of client consensus state */ + /** Deprecated: this field is unused. */ + /** @deprecated */ proofConsensus: Uint8Array; + /** Deprecated: this field is unused. */ + /** @deprecated */ consensusHeight: Height; signer: string; - /** optional proof data for host state machines that are unable to introspect their own consensus state */ + /** Deprecated: this field is unused. */ + /** @deprecated */ hostConsensusStateProof: Uint8Array; } /** MsgConnectionOpenTryResponse defines the Msg/ConnectionOpenTry response type. */ @@ -59,20 +66,27 @@ export interface MsgConnectionOpenAck { connectionId: string; counterpartyConnectionId: string; version: Version; + /** Deprecated: this field is unused. */ + /** @deprecated */ clientState: Any; proofHeight: Height; /** - * proof of the initialization the connection on Chain B: `UNITIALIZED -> + * proof of the initialization the connection on Chain B: `UNINITIALIZED -> * TRYOPEN` */ proofTry: Uint8Array; - /** proof of client state included in message */ + /** Deprecated: this field is unused. */ + /** @deprecated */ proofClient: Uint8Array; - /** proof of client consensus state */ + /** Deprecated: this field is unused. */ + /** @deprecated */ proofConsensus: Uint8Array; + /** Deprecated: this field is unused. */ + /** @deprecated */ consensusHeight: Height; signer: string; - /** optional proof data for host state machines that are unable to introspect their own consensus state */ + /** Deprecated: this field is unused. */ + /** @deprecated */ hostConsensusStateProof: Uint8Array; } /** MsgConnectionOpenAckResponse defines the Msg/ConnectionOpenAck response type. */ @@ -93,6 +107,19 @@ export interface MsgConnectionOpenConfirm { * response type. */ export interface MsgConnectionOpenConfirmResponse {} +/** MsgUpdateParams defines the sdk.Msg type to update the connection parameters. */ +export interface MsgUpdateParams { + /** signer address */ + signer: string; + /** + * params defines the connection parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params; +} +/** MsgUpdateParamsResponse defines the MsgUpdateParams response type. */ +export interface MsgUpdateParamsResponse {} function createBaseMsgConnectionOpenInit(): MsgConnectionOpenInit { return { clientId: "", @@ -768,6 +795,97 @@ export const MsgConnectionOpenConfirmResponse = { return message; }, }; +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { + signer: "", + params: Params.fromPartial({}), + }; +} +export const MsgUpdateParams = { + encode(message: MsgUpdateParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.signer !== "") { + writer.uint32(10).string(message.signer); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.signer = reader.string(); + break; + case 2: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgUpdateParams { + const obj = createBaseMsgUpdateParams(); + if (isSet(object.signer)) obj.signer = String(object.signer); + if (isSet(object.params)) obj.params = Params.fromJSON(object.params); + return obj; + }, + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + message.signer !== undefined && (obj.signer = message.signer); + message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + return obj; + }, + fromPartial(object: Partial): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + message.signer = object.signer ?? ""; + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromPartial(object.params); + } + return message; + }, +}; +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} +export const MsgUpdateParamsResponse = { + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): MsgUpdateParamsResponse { + const obj = createBaseMsgUpdateParamsResponse(); + return obj; + }, + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + fromPartial(_: Partial): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; /** Msg defines the ibc/connection Msg service. */ export interface Msg { /** ConnectionOpenInit defines a rpc handler method for MsgConnectionOpenInit. */ @@ -781,6 +899,11 @@ export interface Msg { * MsgConnectionOpenConfirm. */ ConnectionOpenConfirm(request: MsgConnectionOpenConfirm): Promise; + /** + * UpdateConnectionParams defines a rpc handler method for + * MsgUpdateParams. + */ + UpdateConnectionParams(request: MsgUpdateParams): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: Rpc; @@ -790,6 +913,7 @@ export class MsgClientImpl implements Msg { this.ConnectionOpenTry = this.ConnectionOpenTry.bind(this); this.ConnectionOpenAck = this.ConnectionOpenAck.bind(this); this.ConnectionOpenConfirm = this.ConnectionOpenConfirm.bind(this); + this.UpdateConnectionParams = this.UpdateConnectionParams.bind(this); } ConnectionOpenInit(request: MsgConnectionOpenInit): Promise { const data = MsgConnectionOpenInit.encode(request).finish(); @@ -811,4 +935,9 @@ export class MsgClientImpl implements Msg { const promise = this.rpc.request("ibc.core.connection.v1.Msg", "ConnectionOpenConfirm", data); return promise.then((data) => MsgConnectionOpenConfirmResponse.decode(new BinaryReader(data))); } + UpdateConnectionParams(request: MsgUpdateParams): Promise { + const data = MsgUpdateParams.encode(request).finish(); + const promise = this.rpc.request("ibc.core.connection.v1.Msg", "UpdateConnectionParams", data); + return promise.then((data) => MsgUpdateParamsResponse.decode(new BinaryReader(data))); + } } diff --git a/src/ibc/core/types/v1/genesis.ts b/src/ibc/core/types/v1/genesis.ts index 2ac7873..1c4beb6 100644 --- a/src/ibc/core/types/v1/genesis.ts +++ b/src/ibc/core/types/v1/genesis.ts @@ -3,6 +3,8 @@ import { GenesisState as GenesisState1 } from "../../client/v1/genesis"; import { GenesisState as GenesisState2 } from "../../connection/v1/genesis"; import { GenesisState as GenesisState3 } from "../../channel/v1/genesis"; +import { GenesisState as GenesisState4 } from "../../client/v2/genesis"; +import { GenesisState as GenesisState5 } from "../../channel/v2/genesis"; import { BinaryReader, BinaryWriter } from "../../../../binary"; import { isSet } from "../../../../helpers"; export const protobufPackage = "ibc.core.types.v1"; @@ -14,12 +16,18 @@ export interface GenesisState { connectionGenesis: GenesisState2; /** ICS004 - Channel genesis state */ channelGenesis: GenesisState3; + /** ICS002 - Clients/v2 genesis state */ + clientV2Genesis: GenesisState4; + /** ICS004 - Channel/v2 genesis state */ + channelV2Genesis: GenesisState5; } function createBaseGenesisState(): GenesisState { return { clientGenesis: GenesisState1.fromPartial({}), connectionGenesis: GenesisState2.fromPartial({}), channelGenesis: GenesisState3.fromPartial({}), + clientV2Genesis: GenesisState4.fromPartial({}), + channelV2Genesis: GenesisState5.fromPartial({}), }; } export const GenesisState = { @@ -33,6 +41,12 @@ export const GenesisState = { if (message.channelGenesis !== undefined) { GenesisState3.encode(message.channelGenesis, writer.uint32(26).fork()).ldelim(); } + if (message.clientV2Genesis !== undefined) { + GenesisState4.encode(message.clientV2Genesis, writer.uint32(34).fork()).ldelim(); + } + if (message.channelV2Genesis !== undefined) { + GenesisState5.encode(message.channelV2Genesis, writer.uint32(42).fork()).ldelim(); + } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { @@ -51,6 +65,12 @@ export const GenesisState = { case 3: message.channelGenesis = GenesisState3.decode(reader, reader.uint32()); break; + case 4: + message.clientV2Genesis = GenesisState4.decode(reader, reader.uint32()); + break; + case 5: + message.channelV2Genesis = GenesisState5.decode(reader, reader.uint32()); + break; default: reader.skipType(tag & 7); break; @@ -64,6 +84,9 @@ export const GenesisState = { if (isSet(object.connectionGenesis)) obj.connectionGenesis = GenesisState2.fromJSON(object.connectionGenesis); if (isSet(object.channelGenesis)) obj.channelGenesis = GenesisState3.fromJSON(object.channelGenesis); + if (isSet(object.clientV2Genesis)) obj.clientV2Genesis = GenesisState4.fromJSON(object.clientV2Genesis); + if (isSet(object.channelV2Genesis)) + obj.channelV2Genesis = GenesisState5.fromJSON(object.channelV2Genesis); return obj; }, toJSON(message: GenesisState): unknown { @@ -78,6 +101,14 @@ export const GenesisState = { (obj.channelGenesis = message.channelGenesis ? GenesisState3.toJSON(message.channelGenesis) : undefined); + message.clientV2Genesis !== undefined && + (obj.clientV2Genesis = message.clientV2Genesis + ? GenesisState4.toJSON(message.clientV2Genesis) + : undefined); + message.channelV2Genesis !== undefined && + (obj.channelV2Genesis = message.channelV2Genesis + ? GenesisState5.toJSON(message.channelV2Genesis) + : undefined); return obj; }, fromPartial(object: Partial): GenesisState { @@ -91,6 +122,12 @@ export const GenesisState = { if (object.channelGenesis !== undefined && object.channelGenesis !== null) { message.channelGenesis = GenesisState3.fromPartial(object.channelGenesis); } + if (object.clientV2Genesis !== undefined && object.clientV2Genesis !== null) { + message.clientV2Genesis = GenesisState4.fromPartial(object.clientV2Genesis); + } + if (object.channelV2Genesis !== undefined && object.channelV2Genesis !== null) { + message.channelV2Genesis = GenesisState5.fromPartial(object.channelV2Genesis); + } return message; }, }; diff --git a/src/ibc/lightclients/localhost/v2/localhost.ts b/src/ibc/lightclients/localhost/v2/localhost.ts deleted file mode 100644 index b3b3ff1..0000000 --- a/src/ibc/lightclients/localhost/v2/localhost.ts +++ /dev/null @@ -1,58 +0,0 @@ -/* eslint-disable */ -import { Height } from "../../../core/client/v1/client"; -import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet } from "../../../../helpers"; -export const protobufPackage = "ibc.lightclients.localhost.v2"; -/** ClientState defines the 09-localhost client state */ -export interface ClientState { - /** the latest block height */ - latestHeight: Height; -} -function createBaseClientState(): ClientState { - return { - latestHeight: Height.fromPartial({}), - }; -} -export const ClientState = { - encode(message: ClientState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.latestHeight !== undefined) { - Height.encode(message.latestHeight, writer.uint32(10).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): ClientState { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseClientState(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.latestHeight = Height.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): ClientState { - const obj = createBaseClientState(); - if (isSet(object.latestHeight)) obj.latestHeight = Height.fromJSON(object.latestHeight); - return obj; - }, - toJSON(message: ClientState): unknown { - const obj: any = {}; - message.latestHeight !== undefined && - (obj.latestHeight = message.latestHeight ? Height.toJSON(message.latestHeight) : undefined); - return obj; - }, - fromPartial(object: Partial): ClientState { - const message = createBaseClientState(); - if (object.latestHeight !== undefined && object.latestHeight !== null) { - message.latestHeight = Height.fromPartial(object.latestHeight); - } - return message; - }, -}; diff --git a/src/ibc/lightclients/solomachine/v3/solomachine.ts b/src/ibc/lightclients/solomachine/v3/solomachine.ts index 37eb79c..68084ec 100644 --- a/src/ibc/lightclients/solomachine/v3/solomachine.ts +++ b/src/ibc/lightclients/solomachine/v3/solomachine.ts @@ -23,7 +23,7 @@ export interface ConsensusState { /** public key of the solo machine */ publicKey: Any; /** - * diversifier allows the same public key to be re-used across different solo + * diversifier allows the same public key to be reused across different solo * machine clients (potentially on different chains) without being considered * misbehaviour. */ diff --git a/src/ibc/lightclients/tendermint/v1/tendermint.ts b/src/ibc/lightclients/tendermint/v1/tendermint.ts index 942147d..f09699d 100644 --- a/src/ibc/lightclients/tendermint/v1/tendermint.ts +++ b/src/ibc/lightclients/tendermint/v1/tendermint.ts @@ -23,7 +23,7 @@ export interface ClientState { chainId: string; trustLevel: Fraction; /** - * duration of the period since the LastestTimestamp during which the + * duration of the period since the LatestTimestamp during which the * submitted headers are valid for upgrade */ trustingPeriod: Duration; diff --git a/src/ibc/lightclients/wasm/v1/genesis.ts b/src/ibc/lightclients/wasm/v1/genesis.ts new file mode 100644 index 0000000..6b1c113 --- /dev/null +++ b/src/ibc/lightclients/wasm/v1/genesis.ts @@ -0,0 +1,112 @@ +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { isSet, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +export const protobufPackage = "ibc.lightclients.wasm.v1"; +/** GenesisState defines 08-wasm's keeper genesis state */ +export interface GenesisState { + /** uploaded light client wasm contracts */ + contracts: Contract[]; +} +/** Contract stores contract code */ +export interface Contract { + /** contract byte code */ + codeBytes: Uint8Array; +} +function createBaseGenesisState(): GenesisState { + return { + contracts: [], + }; +} +export const GenesisState = { + encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.contracts) { + Contract.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.contracts.push(Contract.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): GenesisState { + const obj = createBaseGenesisState(); + if (Array.isArray(object?.contracts)) + obj.contracts = object.contracts.map((e: any) => Contract.fromJSON(e)); + return obj; + }, + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.contracts) { + obj.contracts = message.contracts.map((e) => (e ? Contract.toJSON(e) : undefined)); + } else { + obj.contracts = []; + } + return obj; + }, + fromPartial(object: Partial): GenesisState { + const message = createBaseGenesisState(); + message.contracts = object.contracts?.map((e) => Contract.fromPartial(e)) || []; + return message; + }, +}; +function createBaseContract(): Contract { + return { + codeBytes: new Uint8Array(), + }; +} +export const Contract = { + encode(message: Contract, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.codeBytes.length !== 0) { + writer.uint32(10).bytes(message.codeBytes); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Contract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.codeBytes = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): Contract { + const obj = createBaseContract(); + if (isSet(object.codeBytes)) obj.codeBytes = bytesFromBase64(object.codeBytes); + return obj; + }, + toJSON(message: Contract): unknown { + const obj: any = {}; + message.codeBytes !== undefined && + (obj.codeBytes = base64FromBytes( + message.codeBytes !== undefined ? message.codeBytes : new Uint8Array(), + )); + return obj; + }, + fromPartial(object: Partial): Contract { + const message = createBaseContract(); + message.codeBytes = object.codeBytes ?? new Uint8Array(); + return message; + }, +}; diff --git a/src/ibc/lightclients/wasm/v1/query.ts b/src/ibc/lightclients/wasm/v1/query.ts new file mode 100644 index 0000000..4fe83bb --- /dev/null +++ b/src/ibc/lightclients/wasm/v1/query.ts @@ -0,0 +1,256 @@ +/* eslint-disable */ +import { PageRequest, PageResponse } from "../../../../cosmos/base/query/v1beta1/pagination"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { isSet, bytesFromBase64, base64FromBytes, Rpc } from "../../../../helpers"; +export const protobufPackage = "ibc.lightclients.wasm.v1"; +/** QueryChecksumsRequest is the request type for the Query/Checksums RPC method. */ +export interface QueryChecksumsRequest { + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest; +} +/** QueryChecksumsResponse is the response type for the Query/Checksums RPC method. */ +export interface QueryChecksumsResponse { + /** checksums is a list of the hex encoded checksums of all wasm codes stored. */ + checksums: string[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse; +} +/** QueryCodeRequest is the request type for the Query/Code RPC method. */ +export interface QueryCodeRequest { + /** checksum is a hex encoded string of the code stored. */ + checksum: string; +} +/** QueryCodeResponse is the response type for the Query/Code RPC method. */ +export interface QueryCodeResponse { + data: Uint8Array; +} +function createBaseQueryChecksumsRequest(): QueryChecksumsRequest { + return { + pagination: PageRequest.fromPartial({}), + }; +} +export const QueryChecksumsRequest = { + encode(message: QueryChecksumsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryChecksumsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryChecksumsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryChecksumsRequest { + const obj = createBaseQueryChecksumsRequest(); + if (isSet(object.pagination)) obj.pagination = PageRequest.fromJSON(object.pagination); + return obj; + }, + toJSON(message: QueryChecksumsRequest): unknown { + const obj: any = {}; + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object: Partial): QueryChecksumsRequest { + const message = createBaseQueryChecksumsRequest(); + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromPartial(object.pagination); + } + return message; + }, +}; +function createBaseQueryChecksumsResponse(): QueryChecksumsResponse { + return { + checksums: [], + pagination: PageResponse.fromPartial({}), + }; +} +export const QueryChecksumsResponse = { + encode(message: QueryChecksumsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.checksums) { + writer.uint32(10).string(v!); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryChecksumsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryChecksumsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.checksums.push(reader.string()); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryChecksumsResponse { + const obj = createBaseQueryChecksumsResponse(); + if (Array.isArray(object?.checksums)) obj.checksums = object.checksums.map((e: any) => String(e)); + if (isSet(object.pagination)) obj.pagination = PageResponse.fromJSON(object.pagination); + return obj; + }, + toJSON(message: QueryChecksumsResponse): unknown { + const obj: any = {}; + if (message.checksums) { + obj.checksums = message.checksums.map((e) => e); + } else { + obj.checksums = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object: Partial): QueryChecksumsResponse { + const message = createBaseQueryChecksumsResponse(); + message.checksums = object.checksums?.map((e) => e) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromPartial(object.pagination); + } + return message; + }, +}; +function createBaseQueryCodeRequest(): QueryCodeRequest { + return { + checksum: "", + }; +} +export const QueryCodeRequest = { + encode(message: QueryCodeRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.checksum !== "") { + writer.uint32(10).string(message.checksum); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryCodeRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCodeRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.checksum = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryCodeRequest { + const obj = createBaseQueryCodeRequest(); + if (isSet(object.checksum)) obj.checksum = String(object.checksum); + return obj; + }, + toJSON(message: QueryCodeRequest): unknown { + const obj: any = {}; + message.checksum !== undefined && (obj.checksum = message.checksum); + return obj; + }, + fromPartial(object: Partial): QueryCodeRequest { + const message = createBaseQueryCodeRequest(); + message.checksum = object.checksum ?? ""; + return message; + }, +}; +function createBaseQueryCodeResponse(): QueryCodeResponse { + return { + data: new Uint8Array(), + }; +} +export const QueryCodeResponse = { + encode(message: QueryCodeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.data.length !== 0) { + writer.uint32(10).bytes(message.data); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryCodeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCodeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.data = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryCodeResponse { + const obj = createBaseQueryCodeResponse(); + if (isSet(object.data)) obj.data = bytesFromBase64(object.data); + return obj; + }, + toJSON(message: QueryCodeResponse): unknown { + const obj: any = {}; + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); + return obj; + }, + fromPartial(object: Partial): QueryCodeResponse { + const message = createBaseQueryCodeResponse(); + message.data = object.data ?? new Uint8Array(); + return message; + }, +}; +/** Query service for wasm module */ +export interface Query { + /** Get all Wasm checksums */ + Checksums(request?: QueryChecksumsRequest): Promise; + /** Get Wasm code for given checksum */ + Code(request: QueryCodeRequest): Promise; +} +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + this.Checksums = this.Checksums.bind(this); + this.Code = this.Code.bind(this); + } + Checksums( + request: QueryChecksumsRequest = { + pagination: PageRequest.fromPartial({}), + }, + ): Promise { + const data = QueryChecksumsRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.lightclients.wasm.v1.Query", "Checksums", data); + return promise.then((data) => QueryChecksumsResponse.decode(new BinaryReader(data))); + } + Code(request: QueryCodeRequest): Promise { + const data = QueryCodeRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.lightclients.wasm.v1.Query", "Code", data); + return promise.then((data) => QueryCodeResponse.decode(new BinaryReader(data))); + } +} diff --git a/src/ibc/lightclients/wasm/v1/tx.amino.ts b/src/ibc/lightclients/wasm/v1/tx.amino.ts new file mode 100644 index 0000000..8d87add --- /dev/null +++ b/src/ibc/lightclients/wasm/v1/tx.amino.ts @@ -0,0 +1,87 @@ +/* eslint-disable */ +import { AminoMsg } from "@cosmjs/amino"; +import { MsgStoreCode, MsgRemoveChecksum, MsgMigrateContract } from "./tx"; +export interface MsgStoreCodeAminoType extends AminoMsg { + type: "cosmos-sdk/MsgStoreCode"; + value: { + signer: string; + wasm_byte_code: Uint8Array; + }; +} +export interface MsgRemoveChecksumAminoType extends AminoMsg { + type: "cosmos-sdk/MsgRemoveChecksum"; + value: { + signer: string; + checksum: Uint8Array; + }; +} +export interface MsgMigrateContractAminoType extends AminoMsg { + type: "cosmos-sdk/MsgMigrateContract"; + value: { + signer: string; + client_id: string; + checksum: Uint8Array; + msg: Uint8Array; + }; +} +export const AminoConverter = { + "/ibc.lightclients.wasm.v1.MsgStoreCode": { + aminoType: "cosmos-sdk/MsgStoreCode", + toAmino: ({ signer, wasmByteCode }: MsgStoreCode): MsgStoreCodeAminoType["value"] => { + return { + signer, + wasm_byte_code: wasmByteCode, + }; + }, + fromAmino: ({ signer, wasm_byte_code }: MsgStoreCodeAminoType["value"]): MsgStoreCode => { + return { + signer, + wasmByteCode: wasm_byte_code, + }; + }, + }, + "/ibc.lightclients.wasm.v1.MsgRemoveChecksum": { + aminoType: "cosmos-sdk/MsgRemoveChecksum", + toAmino: ({ signer, checksum }: MsgRemoveChecksum): MsgRemoveChecksumAminoType["value"] => { + return { + signer, + checksum, + }; + }, + fromAmino: ({ signer, checksum }: MsgRemoveChecksumAminoType["value"]): MsgRemoveChecksum => { + return { + signer, + checksum, + }; + }, + }, + "/ibc.lightclients.wasm.v1.MsgMigrateContract": { + aminoType: "cosmos-sdk/MsgMigrateContract", + toAmino: ({ + signer, + clientId, + checksum, + msg, + }: MsgMigrateContract): MsgMigrateContractAminoType["value"] => { + return { + signer, + client_id: clientId, + checksum, + msg, + }; + }, + fromAmino: ({ + signer, + client_id, + checksum, + msg, + }: MsgMigrateContractAminoType["value"]): MsgMigrateContract => { + return { + signer, + clientId: client_id, + checksum, + msg, + }; + }, + }, +}; diff --git a/src/ibc/lightclients/wasm/v1/tx.registry.ts b/src/ibc/lightclients/wasm/v1/tx.registry.ts new file mode 100644 index 0000000..450670d --- /dev/null +++ b/src/ibc/lightclients/wasm/v1/tx.registry.ts @@ -0,0 +1,116 @@ +//@ts-nocheck +/* eslint-disable */ +import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { MsgStoreCode, MsgRemoveChecksum, MsgMigrateContract } from "./tx"; +export const registry: ReadonlyArray<[string, GeneratedType]> = [ + ["/ibc.lightclients.wasm.v1.MsgStoreCode", MsgStoreCode], + ["/ibc.lightclients.wasm.v1.MsgRemoveChecksum", MsgRemoveChecksum], + ["/ibc.lightclients.wasm.v1.MsgMigrateContract", MsgMigrateContract], +]; +export const load = (protoRegistry: Registry) => { + registry.forEach(([typeUrl, mod]) => { + protoRegistry.register(typeUrl, mod); + }); +}; +export const MessageComposer = { + encoded: { + storeCode(value: MsgStoreCode) { + return { + typeUrl: "/ibc.lightclients.wasm.v1.MsgStoreCode", + value: MsgStoreCode.encode(value).finish(), + }; + }, + removeChecksum(value: MsgRemoveChecksum) { + return { + typeUrl: "/ibc.lightclients.wasm.v1.MsgRemoveChecksum", + value: MsgRemoveChecksum.encode(value).finish(), + }; + }, + migrateContract(value: MsgMigrateContract) { + return { + typeUrl: "/ibc.lightclients.wasm.v1.MsgMigrateContract", + value: MsgMigrateContract.encode(value).finish(), + }; + }, + }, + withTypeUrl: { + storeCode(value: MsgStoreCode) { + return { + typeUrl: "/ibc.lightclients.wasm.v1.MsgStoreCode", + value, + }; + }, + removeChecksum(value: MsgRemoveChecksum) { + return { + typeUrl: "/ibc.lightclients.wasm.v1.MsgRemoveChecksum", + value, + }; + }, + migrateContract(value: MsgMigrateContract) { + return { + typeUrl: "/ibc.lightclients.wasm.v1.MsgMigrateContract", + value, + }; + }, + }, + toJSON: { + storeCode(value: MsgStoreCode) { + return { + typeUrl: "/ibc.lightclients.wasm.v1.MsgStoreCode", + value: MsgStoreCode.toJSON(value), + }; + }, + removeChecksum(value: MsgRemoveChecksum) { + return { + typeUrl: "/ibc.lightclients.wasm.v1.MsgRemoveChecksum", + value: MsgRemoveChecksum.toJSON(value), + }; + }, + migrateContract(value: MsgMigrateContract) { + return { + typeUrl: "/ibc.lightclients.wasm.v1.MsgMigrateContract", + value: MsgMigrateContract.toJSON(value), + }; + }, + }, + fromJSON: { + storeCode(value: any) { + return { + typeUrl: "/ibc.lightclients.wasm.v1.MsgStoreCode", + value: MsgStoreCode.fromJSON(value), + }; + }, + removeChecksum(value: any) { + return { + typeUrl: "/ibc.lightclients.wasm.v1.MsgRemoveChecksum", + value: MsgRemoveChecksum.fromJSON(value), + }; + }, + migrateContract(value: any) { + return { + typeUrl: "/ibc.lightclients.wasm.v1.MsgMigrateContract", + value: MsgMigrateContract.fromJSON(value), + }; + }, + }, + fromPartial: { + storeCode(value: MsgStoreCode) { + return { + typeUrl: "/ibc.lightclients.wasm.v1.MsgStoreCode", + value: MsgStoreCode.fromPartial(value), + }; + }, + removeChecksum(value: MsgRemoveChecksum) { + return { + typeUrl: "/ibc.lightclients.wasm.v1.MsgRemoveChecksum", + value: MsgRemoveChecksum.fromPartial(value), + }; + }, + migrateContract(value: MsgMigrateContract) { + return { + typeUrl: "/ibc.lightclients.wasm.v1.MsgMigrateContract", + value: MsgMigrateContract.fromPartial(value), + }; + }, + }, +}; diff --git a/src/ibc/lightclients/wasm/v1/tx.ts b/src/ibc/lightclients/wasm/v1/tx.ts new file mode 100644 index 0000000..7b210b5 --- /dev/null +++ b/src/ibc/lightclients/wasm/v1/tx.ts @@ -0,0 +1,376 @@ +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { isSet, bytesFromBase64, base64FromBytes, Rpc } from "../../../../helpers"; +export const protobufPackage = "ibc.lightclients.wasm.v1"; +/** MsgStoreCode defines the request type for the StoreCode rpc. */ +export interface MsgStoreCode { + /** signer address */ + signer: string; + /** wasm byte code of light client contract. It can be raw or gzip compressed */ + wasmByteCode: Uint8Array; +} +/** MsgStoreCodeResponse defines the response type for the StoreCode rpc */ +export interface MsgStoreCodeResponse { + /** checksum is the sha256 hash of the stored code */ + checksum: Uint8Array; +} +/** MsgRemoveChecksum defines the request type for the MsgRemoveChecksum rpc. */ +export interface MsgRemoveChecksum { + /** signer address */ + signer: string; + /** checksum is the sha256 hash to be removed from the store */ + checksum: Uint8Array; +} +/** MsgStoreChecksumResponse defines the response type for the StoreCode rpc */ +export interface MsgRemoveChecksumResponse {} +/** MsgMigrateContract defines the request type for the MigrateContract rpc. */ +export interface MsgMigrateContract { + /** signer address */ + signer: string; + /** the client id of the contract */ + clientId: string; + /** checksum is the sha256 hash of the new wasm byte code for the contract */ + checksum: Uint8Array; + /** the json encoded message to be passed to the contract on migration */ + msg: Uint8Array; +} +/** MsgMigrateContractResponse defines the response type for the MigrateContract rpc */ +export interface MsgMigrateContractResponse {} +function createBaseMsgStoreCode(): MsgStoreCode { + return { + signer: "", + wasmByteCode: new Uint8Array(), + }; +} +export const MsgStoreCode = { + encode(message: MsgStoreCode, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.signer !== "") { + writer.uint32(10).string(message.signer); + } + if (message.wasmByteCode.length !== 0) { + writer.uint32(18).bytes(message.wasmByteCode); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgStoreCode { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgStoreCode(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.signer = reader.string(); + break; + case 2: + message.wasmByteCode = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgStoreCode { + const obj = createBaseMsgStoreCode(); + if (isSet(object.signer)) obj.signer = String(object.signer); + if (isSet(object.wasmByteCode)) obj.wasmByteCode = bytesFromBase64(object.wasmByteCode); + return obj; + }, + toJSON(message: MsgStoreCode): unknown { + const obj: any = {}; + message.signer !== undefined && (obj.signer = message.signer); + message.wasmByteCode !== undefined && + (obj.wasmByteCode = base64FromBytes( + message.wasmByteCode !== undefined ? message.wasmByteCode : new Uint8Array(), + )); + return obj; + }, + fromPartial(object: Partial): MsgStoreCode { + const message = createBaseMsgStoreCode(); + message.signer = object.signer ?? ""; + message.wasmByteCode = object.wasmByteCode ?? new Uint8Array(); + return message; + }, +}; +function createBaseMsgStoreCodeResponse(): MsgStoreCodeResponse { + return { + checksum: new Uint8Array(), + }; +} +export const MsgStoreCodeResponse = { + encode(message: MsgStoreCodeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.checksum.length !== 0) { + writer.uint32(10).bytes(message.checksum); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgStoreCodeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgStoreCodeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.checksum = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgStoreCodeResponse { + const obj = createBaseMsgStoreCodeResponse(); + if (isSet(object.checksum)) obj.checksum = bytesFromBase64(object.checksum); + return obj; + }, + toJSON(message: MsgStoreCodeResponse): unknown { + const obj: any = {}; + message.checksum !== undefined && + (obj.checksum = base64FromBytes(message.checksum !== undefined ? message.checksum : new Uint8Array())); + return obj; + }, + fromPartial(object: Partial): MsgStoreCodeResponse { + const message = createBaseMsgStoreCodeResponse(); + message.checksum = object.checksum ?? new Uint8Array(); + return message; + }, +}; +function createBaseMsgRemoveChecksum(): MsgRemoveChecksum { + return { + signer: "", + checksum: new Uint8Array(), + }; +} +export const MsgRemoveChecksum = { + encode(message: MsgRemoveChecksum, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.signer !== "") { + writer.uint32(10).string(message.signer); + } + if (message.checksum.length !== 0) { + writer.uint32(18).bytes(message.checksum); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgRemoveChecksum { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRemoveChecksum(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.signer = reader.string(); + break; + case 2: + message.checksum = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgRemoveChecksum { + const obj = createBaseMsgRemoveChecksum(); + if (isSet(object.signer)) obj.signer = String(object.signer); + if (isSet(object.checksum)) obj.checksum = bytesFromBase64(object.checksum); + return obj; + }, + toJSON(message: MsgRemoveChecksum): unknown { + const obj: any = {}; + message.signer !== undefined && (obj.signer = message.signer); + message.checksum !== undefined && + (obj.checksum = base64FromBytes(message.checksum !== undefined ? message.checksum : new Uint8Array())); + return obj; + }, + fromPartial(object: Partial): MsgRemoveChecksum { + const message = createBaseMsgRemoveChecksum(); + message.signer = object.signer ?? ""; + message.checksum = object.checksum ?? new Uint8Array(); + return message; + }, +}; +function createBaseMsgRemoveChecksumResponse(): MsgRemoveChecksumResponse { + return {}; +} +export const MsgRemoveChecksumResponse = { + encode(_: MsgRemoveChecksumResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgRemoveChecksumResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRemoveChecksumResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): MsgRemoveChecksumResponse { + const obj = createBaseMsgRemoveChecksumResponse(); + return obj; + }, + toJSON(_: MsgRemoveChecksumResponse): unknown { + const obj: any = {}; + return obj; + }, + fromPartial(_: Partial): MsgRemoveChecksumResponse { + const message = createBaseMsgRemoveChecksumResponse(); + return message; + }, +}; +function createBaseMsgMigrateContract(): MsgMigrateContract { + return { + signer: "", + clientId: "", + checksum: new Uint8Array(), + msg: new Uint8Array(), + }; +} +export const MsgMigrateContract = { + encode(message: MsgMigrateContract, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.signer !== "") { + writer.uint32(10).string(message.signer); + } + if (message.clientId !== "") { + writer.uint32(18).string(message.clientId); + } + if (message.checksum.length !== 0) { + writer.uint32(26).bytes(message.checksum); + } + if (message.msg.length !== 0) { + writer.uint32(34).bytes(message.msg); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgMigrateContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgMigrateContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.signer = reader.string(); + break; + case 2: + message.clientId = reader.string(); + break; + case 3: + message.checksum = reader.bytes(); + break; + case 4: + message.msg = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgMigrateContract { + const obj = createBaseMsgMigrateContract(); + if (isSet(object.signer)) obj.signer = String(object.signer); + if (isSet(object.clientId)) obj.clientId = String(object.clientId); + if (isSet(object.checksum)) obj.checksum = bytesFromBase64(object.checksum); + if (isSet(object.msg)) obj.msg = bytesFromBase64(object.msg); + return obj; + }, + toJSON(message: MsgMigrateContract): unknown { + const obj: any = {}; + message.signer !== undefined && (obj.signer = message.signer); + message.clientId !== undefined && (obj.clientId = message.clientId); + message.checksum !== undefined && + (obj.checksum = base64FromBytes(message.checksum !== undefined ? message.checksum : new Uint8Array())); + message.msg !== undefined && + (obj.msg = base64FromBytes(message.msg !== undefined ? message.msg : new Uint8Array())); + return obj; + }, + fromPartial(object: Partial): MsgMigrateContract { + const message = createBaseMsgMigrateContract(); + message.signer = object.signer ?? ""; + message.clientId = object.clientId ?? ""; + message.checksum = object.checksum ?? new Uint8Array(); + message.msg = object.msg ?? new Uint8Array(); + return message; + }, +}; +function createBaseMsgMigrateContractResponse(): MsgMigrateContractResponse { + return {}; +} +export const MsgMigrateContractResponse = { + encode(_: MsgMigrateContractResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgMigrateContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgMigrateContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): MsgMigrateContractResponse { + const obj = createBaseMsgMigrateContractResponse(); + return obj; + }, + toJSON(_: MsgMigrateContractResponse): unknown { + const obj: any = {}; + return obj; + }, + fromPartial(_: Partial): MsgMigrateContractResponse { + const message = createBaseMsgMigrateContractResponse(); + return message; + }, +}; +/** Msg defines the ibc/08-wasm Msg service. */ +export interface Msg { + /** StoreCode defines a rpc handler method for MsgStoreCode. */ + StoreCode(request: MsgStoreCode): Promise; + /** RemoveChecksum defines a rpc handler method for MsgRemoveChecksum. */ + RemoveChecksum(request: MsgRemoveChecksum): Promise; + /** MigrateContract defines a rpc handler method for MsgMigrateContract. */ + MigrateContract(request: MsgMigrateContract): Promise; +} +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + this.StoreCode = this.StoreCode.bind(this); + this.RemoveChecksum = this.RemoveChecksum.bind(this); + this.MigrateContract = this.MigrateContract.bind(this); + } + StoreCode(request: MsgStoreCode): Promise { + const data = MsgStoreCode.encode(request).finish(); + const promise = this.rpc.request("ibc.lightclients.wasm.v1.Msg", "StoreCode", data); + return promise.then((data) => MsgStoreCodeResponse.decode(new BinaryReader(data))); + } + RemoveChecksum(request: MsgRemoveChecksum): Promise { + const data = MsgRemoveChecksum.encode(request).finish(); + const promise = this.rpc.request("ibc.lightclients.wasm.v1.Msg", "RemoveChecksum", data); + return promise.then((data) => MsgRemoveChecksumResponse.decode(new BinaryReader(data))); + } + MigrateContract(request: MsgMigrateContract): Promise { + const data = MsgMigrateContract.encode(request).finish(); + const promise = this.rpc.request("ibc.lightclients.wasm.v1.Msg", "MigrateContract", data); + return promise.then((data) => MsgMigrateContractResponse.decode(new BinaryReader(data))); + } +} diff --git a/src/ibc/lightclients/wasm/v1/wasm.ts b/src/ibc/lightclients/wasm/v1/wasm.ts new file mode 100644 index 0000000..042dfdf --- /dev/null +++ b/src/ibc/lightclients/wasm/v1/wasm.ts @@ -0,0 +1,249 @@ +/* eslint-disable */ +import { Height } from "../../../core/client/v1/client"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { isSet, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +export const protobufPackage = "ibc.lightclients.wasm.v1"; +/** Wasm light client's Client state */ +export interface ClientState { + /** + * bytes encoding the client state of the underlying light client + * implemented as a Wasm contract. + */ + data: Uint8Array; + checksum: Uint8Array; + latestHeight: Height; +} +/** Wasm light client's ConsensusState */ +export interface ConsensusState { + /** + * bytes encoding the consensus state of the underlying light client + * implemented as a Wasm contract. + */ + data: Uint8Array; +} +/** Wasm light client message (either header(s) or misbehaviour) */ +export interface ClientMessage { + data: Uint8Array; +} +/** + * Checksums defines a list of all checksums that are stored + * + * Deprecated: This message is deprecated in favor of storing the checksums + * using a Collections.KeySet. + */ +/** @deprecated */ +export interface Checksums { + checksums: Uint8Array[]; +} +function createBaseClientState(): ClientState { + return { + data: new Uint8Array(), + checksum: new Uint8Array(), + latestHeight: Height.fromPartial({}), + }; +} +export const ClientState = { + encode(message: ClientState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.data.length !== 0) { + writer.uint32(10).bytes(message.data); + } + if (message.checksum.length !== 0) { + writer.uint32(18).bytes(message.checksum); + } + if (message.latestHeight !== undefined) { + Height.encode(message.latestHeight, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ClientState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClientState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.data = reader.bytes(); + break; + case 2: + message.checksum = reader.bytes(); + break; + case 3: + message.latestHeight = Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): ClientState { + const obj = createBaseClientState(); + if (isSet(object.data)) obj.data = bytesFromBase64(object.data); + if (isSet(object.checksum)) obj.checksum = bytesFromBase64(object.checksum); + if (isSet(object.latestHeight)) obj.latestHeight = Height.fromJSON(object.latestHeight); + return obj; + }, + toJSON(message: ClientState): unknown { + const obj: any = {}; + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); + message.checksum !== undefined && + (obj.checksum = base64FromBytes(message.checksum !== undefined ? message.checksum : new Uint8Array())); + message.latestHeight !== undefined && + (obj.latestHeight = message.latestHeight ? Height.toJSON(message.latestHeight) : undefined); + return obj; + }, + fromPartial(object: Partial): ClientState { + const message = createBaseClientState(); + message.data = object.data ?? new Uint8Array(); + message.checksum = object.checksum ?? new Uint8Array(); + if (object.latestHeight !== undefined && object.latestHeight !== null) { + message.latestHeight = Height.fromPartial(object.latestHeight); + } + return message; + }, +}; +function createBaseConsensusState(): ConsensusState { + return { + data: new Uint8Array(), + }; +} +export const ConsensusState = { + encode(message: ConsensusState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.data.length !== 0) { + writer.uint32(10).bytes(message.data); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ConsensusState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConsensusState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.data = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): ConsensusState { + const obj = createBaseConsensusState(); + if (isSet(object.data)) obj.data = bytesFromBase64(object.data); + return obj; + }, + toJSON(message: ConsensusState): unknown { + const obj: any = {}; + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); + return obj; + }, + fromPartial(object: Partial): ConsensusState { + const message = createBaseConsensusState(); + message.data = object.data ?? new Uint8Array(); + return message; + }, +}; +function createBaseClientMessage(): ClientMessage { + return { + data: new Uint8Array(), + }; +} +export const ClientMessage = { + encode(message: ClientMessage, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.data.length !== 0) { + writer.uint32(10).bytes(message.data); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ClientMessage { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClientMessage(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.data = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): ClientMessage { + const obj = createBaseClientMessage(); + if (isSet(object.data)) obj.data = bytesFromBase64(object.data); + return obj; + }, + toJSON(message: ClientMessage): unknown { + const obj: any = {}; + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); + return obj; + }, + fromPartial(object: Partial): ClientMessage { + const message = createBaseClientMessage(); + message.data = object.data ?? new Uint8Array(); + return message; + }, +}; +function createBaseChecksums(): Checksums { + return { + checksums: [], + }; +} +export const Checksums = { + encode(message: Checksums, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.checksums) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Checksums { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseChecksums(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.checksums.push(reader.bytes()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): Checksums { + const obj = createBaseChecksums(); + if (Array.isArray(object?.checksums)) + obj.checksums = object.checksums.map((e: any) => bytesFromBase64(e)); + return obj; + }, + toJSON(message: Checksums): unknown { + const obj: any = {}; + if (message.checksums) { + obj.checksums = message.checksums.map((e) => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.checksums = []; + } + return obj; + }, + fromPartial(object: Partial): Checksums { + const message = createBaseChecksums(); + message.checksums = object.checksums?.map((e) => e) || []; + return message; + }, +}; From 9fbff5e0cec944df96283bb6ed4806b9f5a72849 Mon Sep 17 00:00:00 2001 From: puneetmahajan Date: Sat, 4 Oct 2025 21:16:41 +0400 Subject: [PATCH 2/2] update ibc-go and wasm, remove fork, use correct versions --- scripts/telescope.ts | 2 ++ src/cosmos/upgrade/v1beta1/upgrade.ts | 1 + src/ibc/core/client/v1/tx.amino.ts | 1 + 3 files changed, 4 insertions(+) diff --git a/scripts/telescope.ts b/scripts/telescope.ts index de0f4cf..74f9c3f 100644 --- a/scripts/telescope.ts +++ b/scripts/telescope.ts @@ -15,6 +15,7 @@ telescope({ patterns: ["**/tx.registry.ts", "**/msgs.registry.ts"], files: [ "ibc/core/types/v1/genesis.ts", + "ibc/core/client/v1/tx.amino.ts", "ibc/applications/interchain_accounts/genesis/v1/genesis.ts", "cosmos/tx/signing/v1beta1/signing.ts", "cosmos/staking/v1beta1/tx.ts", @@ -24,6 +25,7 @@ telescope({ "cosmos/staking/v1beta1/tx.amino.ts", "cosmos/slashing/v1beta1/tx.amino.ts", "cosmos/upgrade/v1beta1/tx.amino.ts", + "cosmos/upgrade/v1beta1/upgrade.ts", "cosmos/consensus/v1/tx.amino.ts", "cosmos/gov/v1/tx.amino.ts" diff --git a/src/cosmos/upgrade/v1beta1/upgrade.ts b/src/cosmos/upgrade/v1beta1/upgrade.ts index 5f9b999..9f65601 100644 --- a/src/cosmos/upgrade/v1beta1/upgrade.ts +++ b/src/cosmos/upgrade/v1beta1/upgrade.ts @@ -1,3 +1,4 @@ +//@ts-nocheck /* eslint-disable */ import { Timestamp } from "../../../google/protobuf/timestamp"; import { Any } from "../../../google/protobuf/any"; diff --git a/src/ibc/core/client/v1/tx.amino.ts b/src/ibc/core/client/v1/tx.amino.ts index ee398aa..53052aa 100644 --- a/src/ibc/core/client/v1/tx.amino.ts +++ b/src/ibc/core/client/v1/tx.amino.ts @@ -1,3 +1,4 @@ +//@ts-nocheck /* eslint-disable */ import { AminoMsg } from "@cosmjs/amino"; import {