diff --git a/packages/cosmic-proto/package.json b/packages/cosmic-proto/package.json index 26f90f21d2c..9e2db1fea14 100644 --- a/packages/cosmic-proto/package.json +++ b/packages/cosmic-proto/package.json @@ -32,6 +32,10 @@ "types": "./dist/codegen/cosmos/staking/v1beta1/tx.d.ts", "default": "./dist/codegen/cosmos/staking/v1beta1/tx.js" }, + "./ibc/applications/transfer/v1/tx.js": { + "types": "./dist/codegen/ibc/applications/transfer/v1/tx.d.ts", + "default": "./dist/codegen/ibc/applications/transfer/v1/tx.js" + }, "./google/protobuf/any": { "types": "./dist/codegen/google/protobuf/any.d.ts", "default": "./dist/codegen/google/protobuf/any.js" diff --git a/packages/cosmic-proto/proto/ibc/applications/fee/v1/ack.proto b/packages/cosmic-proto/proto/ibc/applications/fee/v1/ack.proto new file mode 100644 index 00000000000..be0d74a4016 --- /dev/null +++ b/packages/cosmic-proto/proto/ibc/applications/fee/v1/ack.proto @@ -0,0 +1,17 @@ +syntax = "proto3"; + +package ibc.applications.fee.v1; + +option go_package = "github.com/cosmos/ibc-go/v6/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/packages/cosmic-proto/proto/ibc/applications/fee/v1/fee.proto b/packages/cosmic-proto/proto/ibc/applications/fee/v1/fee.proto new file mode 100644 index 00000000000..b38ae9d6e59 --- /dev/null +++ b/packages/cosmic-proto/proto/ibc/applications/fee/v1/fee.proto @@ -0,0 +1,56 @@ +syntax = "proto3"; + +package ibc.applications.fee.v1; + +option go_package = "github.com/cosmos/ibc-go/v6/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/packages/cosmic-proto/proto/ibc/applications/fee/v1/genesis.proto b/packages/cosmic-proto/proto/ibc/applications/fee/v1/genesis.proto new file mode 100644 index 00000000000..8f52be195a1 --- /dev/null +++ b/packages/cosmic-proto/proto/ibc/applications/fee/v1/genesis.proto @@ -0,0 +1,66 @@ +syntax = "proto3"; + +package ibc.applications.fee.v1; + +option go_package = "github.com/cosmos/ibc-go/v6/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/packages/cosmic-proto/proto/ibc/applications/fee/v1/metadata.proto b/packages/cosmic-proto/proto/ibc/applications/fee/v1/metadata.proto new file mode 100644 index 00000000000..3afdba164cb --- /dev/null +++ b/packages/cosmic-proto/proto/ibc/applications/fee/v1/metadata.proto @@ -0,0 +1,16 @@ +syntax = "proto3"; + +package ibc.applications.fee.v1; + +option go_package = "github.com/cosmos/ibc-go/v6/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/packages/cosmic-proto/proto/ibc/applications/fee/v1/query.proto b/packages/cosmic-proto/proto/ibc/applications/fee/v1/query.proto new file mode 100644 index 00000000000..3153051c8fd --- /dev/null +++ b/packages/cosmic-proto/proto/ibc/applications/fee/v1/query.proto @@ -0,0 +1,222 @@ +syntax = "proto3"; + +package ibc.applications.fee.v1; + +option go_package = "github.com/cosmos/ibc-go/v6/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/packages/cosmic-proto/proto/ibc/applications/fee/v1/tx.proto b/packages/cosmic-proto/proto/ibc/applications/fee/v1/tx.proto new file mode 100644 index 00000000000..b099b5eedfd --- /dev/null +++ b/packages/cosmic-proto/proto/ibc/applications/fee/v1/tx.proto @@ -0,0 +1,112 @@ +syntax = "proto3"; + +package ibc.applications.fee.v1; + +option go_package = "github.com/cosmos/ibc-go/v6/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/packages/cosmic-proto/proto/ibc/applications/interchain_accounts/controller/v1/controller.proto b/packages/cosmic-proto/proto/ibc/applications/interchain_accounts/controller/v1/controller.proto new file mode 100644 index 00000000000..072d2617c2f --- /dev/null +++ b/packages/cosmic-proto/proto/ibc/applications/interchain_accounts/controller/v1/controller.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; + +package ibc.applications.interchain_accounts.controller.v1; + +option go_package = "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts/controller/types"; + +import "gogoproto/gogo.proto"; + +// 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\""]; +} diff --git a/packages/cosmic-proto/proto/ibc/applications/interchain_accounts/controller/v1/query.proto b/packages/cosmic-proto/proto/ibc/applications/interchain_accounts/controller/v1/query.proto new file mode 100644 index 00000000000..db7e888bf03 --- /dev/null +++ b/packages/cosmic-proto/proto/ibc/applications/interchain_accounts/controller/v1/query.proto @@ -0,0 +1,43 @@ +syntax = "proto3"; + +package ibc.applications.interchain_accounts.controller.v1; + +option go_package = "github.com/cosmos/ibc-go/v6/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. +service Query { + // InterchainAccount returns the interchain account address for a given owner address on a given connection + rpc InterchainAccount(QueryInterchainAccountRequest) returns (QueryInterchainAccountResponse) { + option (google.api.http).get = + "/ibc/apps/interchain_accounts/controller/v1/owners/{owner}/connections/{connection_id}"; + } + + // Params queries all parameters of the ICA controller submodule. + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/ibc/apps/interchain_accounts/controller/v1/params"; + } +} + +// 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\""]; +} + +// QueryInterchainAccountResponse the response type for the Query/InterchainAccount RPC method. +message QueryInterchainAccountResponse { + string address = 1; +} + +// 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; +} diff --git a/packages/cosmic-proto/proto/ibc/applications/interchain_accounts/controller/v1/tx.proto b/packages/cosmic-proto/proto/ibc/applications/interchain_accounts/controller/v1/tx.proto new file mode 100644 index 00000000000..31de5e7e82d --- /dev/null +++ b/packages/cosmic-proto/proto/ibc/applications/interchain_accounts/controller/v1/tx.proto @@ -0,0 +1,50 @@ +syntax = "proto3"; + +package ibc.applications.interchain_accounts.controller.v1; + +option go_package = "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts/controller/types"; + +import "gogoproto/gogo.proto"; +import "ibc/applications/interchain_accounts/v1/packet.proto"; + +// Msg defines the 27-interchain-accounts/controller Msg service. +service Msg { + // RegisterInterchainAccount defines a rpc handler for MsgRegisterInterchainAccount. + rpc RegisterInterchainAccount(MsgRegisterInterchainAccount) returns (MsgRegisterInterchainAccountResponse); + // SendTx defines a rpc handler for MsgSendTx. + rpc SendTx(MsgSendTx) returns (MsgSendTxResponse); +} + +// MsgRegisterInterchainAccount defines the payload for Msg/MsgRegisterInterchainAccount +message MsgRegisterInterchainAccount { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string owner = 1; + string connection_id = 2 [(gogoproto.moretags) = "yaml:\"connection_id\""]; + string version = 3; +} + +// MsgRegisterInterchainAccountResponse defines the response for Msg/MsgRegisterInterchainAccountResponse +message MsgRegisterInterchainAccountResponse { + string channel_id = 1 [(gogoproto.moretags) = "yaml:\"channel_id\""]; +} + +// MsgSendTx defines the payload for Msg/SendTx +message MsgSendTx { + option (gogoproto.equal) = false; + 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]; + // 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\""]; +} + +// MsgSendTxResponse defines the response for MsgSendTx +message MsgSendTxResponse { + uint64 sequence = 1; +} diff --git a/packages/cosmic-proto/proto/ibc/applications/interchain_accounts/genesis/v1/genesis.proto b/packages/cosmic-proto/proto/ibc/applications/interchain_accounts/genesis/v1/genesis.proto new file mode 100644 index 00000000000..c52bab73246 --- /dev/null +++ b/packages/cosmic-proto/proto/ibc/applications/interchain_accounts/genesis/v1/genesis.proto @@ -0,0 +1,53 @@ +syntax = "proto3"; + +package ibc.applications.interchain_accounts.genesis.v1; + +option go_package = "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts/genesis/types"; + +import "gogoproto/gogo.proto"; +import "ibc/applications/interchain_accounts/controller/v1/controller.proto"; +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 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]; +} + +// 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]; +} + +// 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\""]; +} + +// 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 diff --git a/packages/cosmic-proto/proto/ibc/applications/interchain_accounts/host/v1/host.proto b/packages/cosmic-proto/proto/ibc/applications/interchain_accounts/host/v1/host.proto new file mode 100644 index 00000000000..e5baae5d66f --- /dev/null +++ b/packages/cosmic-proto/proto/ibc/applications/interchain_accounts/host/v1/host.proto @@ -0,0 +1,16 @@ +syntax = "proto3"; + +package ibc.applications.interchain_accounts.host.v1; + +option go_package = "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts/host/types"; + +import "gogoproto/gogo.proto"; + +// 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\""]; + // 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\""]; +} diff --git a/packages/cosmic-proto/proto/ibc/applications/interchain_accounts/host/v1/query.proto b/packages/cosmic-proto/proto/ibc/applications/interchain_accounts/host/v1/query.proto new file mode 100644 index 00000000000..4b773917378 --- /dev/null +++ b/packages/cosmic-proto/proto/ibc/applications/interchain_accounts/host/v1/query.proto @@ -0,0 +1,25 @@ +syntax = "proto3"; + +package ibc.applications.interchain_accounts.host.v1; + +option go_package = "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts/host/types"; + +import "google/api/annotations.proto"; +import "ibc/applications/interchain_accounts/host/v1/host.proto"; + +// Query provides defines the gRPC querier service. +service Query { + // Params queries all parameters of the ICA host submodule. + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/ibc/apps/interchain_accounts/host/v1/params"; + } +} + +// 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; +} diff --git a/packages/cosmic-proto/proto/ibc/applications/interchain_accounts/v1/account.proto b/packages/cosmic-proto/proto/ibc/applications/interchain_accounts/v1/account.proto new file mode 100644 index 00000000000..56ea941e7a5 --- /dev/null +++ b/packages/cosmic-proto/proto/ibc/applications/interchain_accounts/v1/account.proto @@ -0,0 +1,20 @@ +syntax = "proto3"; + +package ibc.applications.interchain_accounts.v1; + +option go_package = "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts/types"; + +import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; +import "cosmos/auth/v1beta1/auth.proto"; + +// An InterchainAccount is defined as a BaseAccount & the address of the account owner on the controller chain +message InterchainAccount { + option (gogoproto.goproto_getters) = false; + option (gogoproto.goproto_stringer) = false; + option (cosmos_proto.implements_interface) = "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\""]; +} diff --git a/packages/cosmic-proto/proto/ibc/applications/interchain_accounts/v1/metadata.proto b/packages/cosmic-proto/proto/ibc/applications/interchain_accounts/v1/metadata.proto new file mode 100644 index 00000000000..eba844f95ad --- /dev/null +++ b/packages/cosmic-proto/proto/ibc/applications/interchain_accounts/v1/metadata.proto @@ -0,0 +1,25 @@ +syntax = "proto3"; + +package ibc.applications.interchain_accounts.v1; + +option go_package = "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts/types"; + +import "gogoproto/gogo.proto"; + +// 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 +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\""]; + // host_connection_id is the connection identifier associated with the host chain + string host_connection_id = 3 [(gogoproto.moretags) = "yaml:\"host_connection_id\""]; + // 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; + // encoding defines the supported codec format + string encoding = 5; + // tx_type defines the type of transactions the interchain account can execute + string tx_type = 6; +} diff --git a/packages/cosmic-proto/proto/ibc/applications/interchain_accounts/v1/packet.proto b/packages/cosmic-proto/proto/ibc/applications/interchain_accounts/v1/packet.proto new file mode 100644 index 00000000000..ac337fd5914 --- /dev/null +++ b/packages/cosmic-proto/proto/ibc/applications/interchain_accounts/v1/packet.proto @@ -0,0 +1,31 @@ +syntax = "proto3"; + +package ibc.applications.interchain_accounts.v1; + +option go_package = "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts/types"; + +import "google/protobuf/any.proto"; +import "gogoproto/gogo.proto"; + +// Type defines a classification of message issued from a controller chain to its associated interchain accounts +// host +enum Type { + option (gogoproto.goproto_enum_prefix) = false; + + // Default zero value enumeration + TYPE_UNSPECIFIED = 0 [(gogoproto.enumvalue_customname) = "UNSPECIFIED"]; + // Execute a transaction on an interchain accounts host chain + TYPE_EXECUTE_TX = 1 [(gogoproto.enumvalue_customname) = "EXECUTE_TX"]; +} + +// InterchainAccountPacketData is comprised of a raw transaction, type of transaction and optional memo field. +message InterchainAccountPacketData { + Type type = 1; + bytes data = 2; + string memo = 3; +} + +// CosmosTx contains a list of sdk.Msg's. It should be used when sending transactions to an SDK host chain. +message CosmosTx { + repeated google.protobuf.Any messages = 1; +} diff --git a/packages/cosmic-proto/proto/ibc/applications/transfer/v1/authz.proto b/packages/cosmic-proto/proto/ibc/applications/transfer/v1/authz.proto new file mode 100644 index 00000000000..db3e0bb7636 --- /dev/null +++ b/packages/cosmic-proto/proto/ibc/applications/transfer/v1/authz.proto @@ -0,0 +1,31 @@ +syntax = "proto3"; + +package ibc.applications.transfer.v1; + +option go_package = "github.com/cosmos/ibc-go/v6/modules/apps/transfer/types"; + +import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; +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\""]; + // the channel by which the packet will be sent + string source_channel = 2 [(gogoproto.moretags) = "yaml:\"source_channel\""]; + // 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; +} + +// TransferAuthorization allows the grantee to spend up to spend_limit coins from +// the granter's account for ibc transfer on a specific channel +message TransferAuthorization { + option (cosmos_proto.implements_interface) = "Authorization"; + + // port and channel amounts + repeated Allocation allocations = 1 [(gogoproto.nullable) = false]; +} diff --git a/packages/cosmic-proto/proto/ibc/applications/transfer/v1/genesis.proto b/packages/cosmic-proto/proto/ibc/applications/transfer/v1/genesis.proto new file mode 100644 index 00000000000..71d3f383c5a --- /dev/null +++ b/packages/cosmic-proto/proto/ibc/applications/transfer/v1/genesis.proto @@ -0,0 +1,19 @@ +syntax = "proto3"; + +package ibc.applications.transfer.v1; + +option go_package = "github.com/cosmos/ibc-go/v6/modules/apps/transfer/types"; + +import "ibc/applications/transfer/v1/transfer.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]; +} diff --git a/packages/cosmic-proto/proto/ibc/applications/transfer/v1/query.proto b/packages/cosmic-proto/proto/ibc/applications/transfer/v1/query.proto new file mode 100644 index 00000000000..470a7f4c5f3 --- /dev/null +++ b/packages/cosmic-proto/proto/ibc/applications/transfer/v1/query.proto @@ -0,0 +1,105 @@ +syntax = "proto3"; + +package ibc.applications.transfer.v1; + +import "gogoproto/gogo.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; +import "ibc/applications/transfer/v1/transfer.proto"; +import "google/api/annotations.proto"; + +option go_package = "github.com/cosmos/ibc-go/v6/modules/apps/transfer/types"; + +// Query provides defines the gRPC querier service. +service Query { + // DenomTraces queries all denomination traces. + rpc DenomTraces(QueryDenomTracesRequest) returns (QueryDenomTracesResponse) { + option (google.api.http).get = "/ibc/apps/transfer/v1/denom_traces"; + } + + // 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"; + } + + // DenomHash queries a denomination hash information. + rpc DenomHash(QueryDenomHashRequest) returns (QueryDenomHashResponse) { + option (google.api.http).get = "/ibc/apps/transfer/v1/denom_hashes/{trace=**}"; + } + + // EscrowAddress returns the escrow address for a particular port and channel id. + rpc EscrowAddress(QueryEscrowAddressRequest) returns (QueryEscrowAddressResponse) { + option (google.api.http).get = "/ibc/apps/transfer/v1/channels/{channel_id}/ports/{port_id}/escrow_address"; + } +} + +// QueryDenomTraceRequest is the request type for the Query/DenomTrace RPC +// method +message QueryDenomTraceRequest { + // hash (in hex format) or denom (full denom with ibc prefix) of the denomination trace information. + string hash = 1; +} + +// QueryDenomTraceResponse is the response type for the Query/DenomTrace RPC +// method. +message QueryDenomTraceResponse { + // denom_trace returns the requested denomination trace information. + DenomTrace denom_trace = 1; +} + +// QueryConnectionsRequest is the request type for the Query/DenomTraces RPC +// method +message QueryDenomTracesRequest { + // 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 +// method. +message QueryDenomTracesResponse { + // denom_traces returns all denominations trace information. + repeated DenomTrace denom_traces = 1 [(gogoproto.castrepeated) = "Traces", (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 { + // The denomination trace ([port_id]/[channel_id])+/[denom] + string trace = 1; +} + +// QueryDenomHashResponse is the response type for the Query/DenomHash RPC +// method. +message QueryDenomHashResponse { + // hash (in hex format) of the denomination trace information. + string hash = 1; +} + +// QueryEscrowAddressRequest is the request type for the EscrowAddress RPC method. +message QueryEscrowAddressRequest { + // unique port identifier + string port_id = 1; + // unique channel identifier + string channel_id = 2; +} + +// QueryEscrowAddressResponse is the response type of the EscrowAddress RPC method. +message QueryEscrowAddressResponse { + // the escrow account address + string escrow_address = 1; +} \ No newline at end of file diff --git a/packages/cosmic-proto/proto/ibc/applications/transfer/v1/transfer.proto b/packages/cosmic-proto/proto/ibc/applications/transfer/v1/transfer.proto new file mode 100644 index 00000000000..9c60ad65dbd --- /dev/null +++ b/packages/cosmic-proto/proto/ibc/applications/transfer/v1/transfer.proto @@ -0,0 +1,30 @@ +syntax = "proto3"; + +package ibc.applications.transfer.v1; + +option go_package = "github.com/cosmos/ibc-go/v6/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; +} + +// Params defines the set of IBC transfer parameters. +// NOTE: To prevent a single token from being transferred, set the +// TransfersEnabled parameter to true and then set the bank module's SendEnabled +// parameter for the denomination to false. +message Params { + // send_enabled enables or disables all cross-chain token transfers from this + // chain. + bool send_enabled = 1 [(gogoproto.moretags) = "yaml:\"send_enabled\""]; + // receive_enabled enables or disables all cross-chain token transfers to this + // chain. + bool receive_enabled = 2 [(gogoproto.moretags) = "yaml:\"receive_enabled\""]; +} diff --git a/packages/cosmic-proto/proto/ibc/applications/transfer/v1/tx.proto b/packages/cosmic-proto/proto/ibc/applications/transfer/v1/tx.proto new file mode 100644 index 00000000000..7504a905a71 --- /dev/null +++ b/packages/cosmic-proto/proto/ibc/applications/transfer/v1/tx.proto @@ -0,0 +1,49 @@ +syntax = "proto3"; + +package ibc.applications.transfer.v1; + +option go_package = "github.com/cosmos/ibc-go/v6/modules/apps/transfer/types"; + +import "gogoproto/gogo.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "ibc/core/client/v1/client.proto"; + +// Msg defines the ibc/transfer Msg service. +service Msg { + // Transfer defines a rpc handler method for MsgTransfer. + rpc Transfer(MsgTransfer) returns (MsgTransferResponse); +} + +// 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 (gogoproto.goproto_getters) = false; + + // the port on which the packet will be sent + string source_port = 1 [(gogoproto.moretags) = "yaml:\"source_port\""]; + // 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]; + // 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]; + // 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\""]; + // optional memo + string memo = 8; +} + +// MsgTransferResponse defines the Msg/Transfer response type. +message MsgTransferResponse { + // sequence number of the transfer packet sent + uint64 sequence = 1; +} diff --git a/packages/cosmic-proto/proto/ibc/applications/transfer/v2/packet.proto b/packages/cosmic-proto/proto/ibc/applications/transfer/v2/packet.proto new file mode 100644 index 00000000000..5b3b004c6e8 --- /dev/null +++ b/packages/cosmic-proto/proto/ibc/applications/transfer/v2/packet.proto @@ -0,0 +1,21 @@ +syntax = "proto3"; + +package ibc.applications.transfer.v2; + +option go_package = "github.com/cosmos/ibc-go/v6/modules/apps/transfer/types"; + +// FungibleTokenPacketData defines a struct for the packet payload +// See FungibleTokenPacketData spec: +// https://github.com/cosmos/ibc/tree/master/spec/app/ics-020-fungible-token-transfer#data-structures +message FungibleTokenPacketData { + // the token denomination to be transferred + string denom = 1; + // the token amount to be transferred + string amount = 2; + // the sender address + string sender = 3; + // the recipient address on the destination chain + string receiver = 4; + // optional memo + string memo = 5; +} diff --git a/packages/cosmic-proto/proto/ibc/core/channel/v1/genesis.proto b/packages/cosmic-proto/proto/ibc/core/channel/v1/genesis.proto new file mode 100644 index 00000000000..ef0e514827a --- /dev/null +++ b/packages/cosmic-proto/proto/ibc/core/channel/v1/genesis.proto @@ -0,0 +1,32 @@ +syntax = "proto3"; + +package ibc.core.channel.v1; + +option go_package = "github.com/cosmos/ibc-go/v6/modules/core/04-channel/types"; + +import "gogoproto/gogo.proto"; +import "ibc/core/channel/v1/channel.proto"; + +// GenesisState defines the ibc channel submodule's genesis state. +message GenesisState { + repeated IdentifiedChannel channels = 1 [(gogoproto.casttype) = "IdentifiedChannel", (gogoproto.nullable) = false]; + 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\""]; + // the sequence for the next generated channel identifier + uint64 next_channel_sequence = 8 [(gogoproto.moretags) = "yaml:\"next_channel_sequence\""]; +} + +// 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\""]; + uint64 sequence = 3; +} diff --git a/packages/cosmic-proto/proto/ibc/core/channel/v1/query.proto b/packages/cosmic-proto/proto/ibc/core/channel/v1/query.proto new file mode 100644 index 00000000000..f22a3753efd --- /dev/null +++ b/packages/cosmic-proto/proto/ibc/core/channel/v1/query.proto @@ -0,0 +1,376 @@ +syntax = "proto3"; + +package ibc.core.channel.v1; + +option go_package = "github.com/cosmos/ibc-go/v6/modules/core/04-channel/types"; + +import "ibc/core/client/v1/client.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; +import "ibc/core/channel/v1/channel.proto"; +import "google/api/annotations.proto"; +import "google/protobuf/any.proto"; +import "gogoproto/gogo.proto"; + +// Query provides defines the gRPC querier service +service Query { + // Channel queries an IBC Channel. + rpc Channel(QueryChannelRequest) returns (QueryChannelResponse) { + option (google.api.http).get = "/ibc/core/channel/v1/channels/{channel_id}/ports/{port_id}"; + } + + // Channels queries all the IBC channels of a chain. + rpc Channels(QueryChannelsRequest) returns (QueryChannelsResponse) { + option (google.api.http).get = "/ibc/core/channel/v1/channels"; + } + + // ConnectionChannels queries all the channels associated with a connection + // end. + rpc ConnectionChannels(QueryConnectionChannelsRequest) returns (QueryConnectionChannelsResponse) { + option (google.api.http).get = "/ibc/core/channel/v1/connections/{connection}/channels"; + } + + // ChannelClientState queries for the client state for the channel associated + // with the provided channel identifiers. + rpc ChannelClientState(QueryChannelClientStateRequest) returns (QueryChannelClientStateResponse) { + option (google.api.http).get = "/ibc/core/channel/v1/channels/{channel_id}/" + "ports/{port_id}/client_state"; + } + + // ChannelConsensusState queries for the consensus state for the channel + // associated with the provided channel identifiers. + rpc ChannelConsensusState(QueryChannelConsensusStateRequest) returns (QueryChannelConsensusStateResponse) { + option (google.api.http).get = "/ibc/core/channel/v1/channels/{channel_id}/" + "ports/{port_id}/consensus_state/revision/" + "{revision_number}/height/{revision_height}"; + } + + // PacketCommitment queries a stored packet commitment hash. + rpc PacketCommitment(QueryPacketCommitmentRequest) returns (QueryPacketCommitmentResponse) { + option (google.api.http).get = "/ibc/core/channel/v1/channels/{channel_id}/ports/{port_id}/" + "packet_commitments/{sequence}"; + } + + // PacketCommitments returns all the packet commitments hashes associated + // with a channel. + rpc PacketCommitments(QueryPacketCommitmentsRequest) returns (QueryPacketCommitmentsResponse) { + option (google.api.http).get = "/ibc/core/channel/v1/channels/{channel_id}/" + "ports/{port_id}/packet_commitments"; + } + + // PacketReceipt queries if a given packet sequence has been received on the + // queried chain + rpc PacketReceipt(QueryPacketReceiptRequest) returns (QueryPacketReceiptResponse) { + option (google.api.http).get = "/ibc/core/channel/v1/channels/{channel_id}/" + "ports/{port_id}/packet_receipts/{sequence}"; + } + + // PacketAcknowledgement queries a stored packet acknowledgement hash. + rpc PacketAcknowledgement(QueryPacketAcknowledgementRequest) returns (QueryPacketAcknowledgementResponse) { + option (google.api.http).get = "/ibc/core/channel/v1/channels/{channel_id}/" + "ports/{port_id}/packet_acks/{sequence}"; + } + + // PacketAcknowledgements returns all the packet acknowledgements associated + // with a channel. + rpc PacketAcknowledgements(QueryPacketAcknowledgementsRequest) returns (QueryPacketAcknowledgementsResponse) { + option (google.api.http).get = "/ibc/core/channel/v1/channels/{channel_id}/" + "ports/{port_id}/packet_acknowledgements"; + } + + // 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/v1/channels/{channel_id}/ports/{port_id}/" + "packet_commitments/" + "{packet_commitment_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/v1/channels/{channel_id}/" + "ports/{port_id}/packet_commitments/" + "{packet_ack_sequences}/unreceived_acks"; + } + + // NextSequenceReceive returns the next receive sequence for a given channel. + rpc NextSequenceReceive(QueryNextSequenceReceiveRequest) returns (QueryNextSequenceReceiveResponse) { + option (google.api.http).get = "/ibc/core/channel/v1/channels/{channel_id}/" + "ports/{port_id}/next_sequence"; + } +} + +// QueryChannelRequest is the request type for the Query/Channel RPC method +message QueryChannelRequest { + // port unique identifier + string port_id = 1; + // channel unique identifier + string channel_id = 2; +} + +// QueryChannelResponse is the response type for the Query/Channel RPC method. +// Besides the Channel end, it includes a proof and the height from which the +// proof was retrieved. +message QueryChannelResponse { + // channel associated with the request identifiers + ibc.core.channel.v1.Channel channel = 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]; +} + +// QueryChannelsRequest is the request type for the Query/Channels RPC method +message QueryChannelsRequest { + // pagination request + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +// QueryChannelsResponse is the response type for the Query/Channels RPC method. +message QueryChannelsResponse { + // list of stored channels of the chain. + repeated ibc.core.channel.v1.IdentifiedChannel channels = 1; + // pagination response + cosmos.base.query.v1beta1.PageResponse pagination = 2; + // query block height + ibc.core.client.v1.Height height = 3 [(gogoproto.nullable) = false]; +} + +// QueryConnectionChannelsRequest is the request type for the +// Query/QueryConnectionChannels RPC method +message QueryConnectionChannelsRequest { + // connection unique identifier + string connection = 1; + // pagination request + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// QueryConnectionChannelsResponse is the Response type for the +// Query/QueryConnectionChannels RPC method +message QueryConnectionChannelsResponse { + // list of channels associated with a connection. + repeated ibc.core.channel.v1.IdentifiedChannel channels = 1; + // pagination response + cosmos.base.query.v1beta1.PageResponse pagination = 2; + // query block height + ibc.core.client.v1.Height height = 3 [(gogoproto.nullable) = false]; +} + +// QueryChannelClientStateRequest is the request type for the Query/ClientState +// RPC method +message QueryChannelClientStateRequest { + // port unique identifier + string port_id = 1; + // channel unique identifier + string channel_id = 2; +} + +// QueryChannelClientStateResponse is the Response type for the +// Query/QueryChannelClientState RPC method +message QueryChannelClientStateResponse { + // client state associated with the channel + ibc.core.client.v1.IdentifiedClientState identified_client_state = 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]; +} + +// QueryChannelConsensusStateRequest is the request type for the +// Query/ConsensusState RPC method +message QueryChannelConsensusStateRequest { + // port unique identifier + string port_id = 1; + // channel unique identifier + string channel_id = 2; + // revision number of the consensus state + uint64 revision_number = 3; + // revision height of the consensus state + uint64 revision_height = 4; +} + +// QueryChannelClientStateResponse is the Response type for the +// Query/QueryChannelClientState RPC method +message QueryChannelConsensusStateResponse { + // consensus state associated with the channel + google.protobuf.Any consensus_state = 1; + // client ID associated with the consensus state + string client_id = 2; + // merkle proof of existence + bytes proof = 3; + // height at which the proof was retrieved + ibc.core.client.v1.Height proof_height = 4 [(gogoproto.nullable) = false]; +} + +// QueryPacketCommitmentRequest is the request type for the +// Query/PacketCommitment RPC method +message QueryPacketCommitmentRequest { + // port unique identifier + string port_id = 1; + // channel unique identifier + string channel_id = 2; + // packet sequence + uint64 sequence = 3; +} + +// QueryPacketCommitmentResponse defines the client query response for a packet +// which also includes a proof and the height from which the proof was +// retrieved +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/QueryPacketCommitments RPC method +message QueryPacketCommitmentsRequest { + // port unique identifier + string port_id = 1; + // channel unique identifier + string channel_id = 2; + // pagination request + cosmos.base.query.v1beta1.PageRequest pagination = 3; +} + +// QueryPacketCommitmentsResponse is the request type for the +// Query/QueryPacketCommitments RPC method +message QueryPacketCommitmentsResponse { + repeated ibc.core.channel.v1.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]; +} + +// QueryPacketReceiptRequest is the request type for the +// Query/PacketReceipt RPC method +message QueryPacketReceiptRequest { + // port unique identifier + string port_id = 1; + // channel unique identifier + string channel_id = 2; + // packet sequence + uint64 sequence = 3; +} + +// QueryPacketReceiptResponse defines the client query response for a packet +// receipt which also includes a proof, and the height from which the proof was +// retrieved +message QueryPacketReceiptResponse { + // success flag for if receipt exists + bool received = 2; + // merkle proof of existence + bytes proof = 3; + // height at which the proof was retrieved + ibc.core.client.v1.Height proof_height = 4 [(gogoproto.nullable) = false]; +} + +// QueryPacketAcknowledgementRequest is the request type for the +// Query/PacketAcknowledgement RPC method +message QueryPacketAcknowledgementRequest { + // port unique identifier + string port_id = 1; + // channel unique identifier + string channel_id = 2; + // packet sequence + uint64 sequence = 3; +} + +// QueryPacketAcknowledgementResponse defines the client query response for a +// packet which also includes a proof and the height from which the +// proof was retrieved +message QueryPacketAcknowledgementResponse { + // packet 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 { + // port unique identifier + string port_id = 1; + // channel unique identifier + string channel_id = 2; + // pagination request + cosmos.base.query.v1beta1.PageRequest pagination = 3; + // list of packet sequences + repeated uint64 packet_commitment_sequences = 4; +} + +// QueryPacketAcknowledgemetsResponse is the request type for the +// Query/QueryPacketAcknowledgements RPC method +message QueryPacketAcknowledgementsResponse { + repeated ibc.core.channel.v1.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]; +} + +// QueryUnreceivedPacketsRequest is the request type for the +// Query/UnreceivedPackets RPC method +message QueryUnreceivedPacketsRequest { + // port unique identifier + string port_id = 1; + // channel unique identifier + string channel_id = 2; + // list of packet sequences + repeated uint64 packet_commitment_sequences = 3; +} + +// 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 { + // port unique identifier + string port_id = 1; + // channel unique identifier + string channel_id = 2; + // list of acknowledgement sequences + repeated uint64 packet_ack_sequences = 3; +} + +// 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]; +} + +// QueryNextSequenceReceiveRequest is the request type for the +// Query/QueryNextSequenceReceiveRequest RPC method +message QueryNextSequenceReceiveRequest { + // port unique identifier + string port_id = 1; + // channel unique identifier + string channel_id = 2; +} + +// QuerySequenceResponse is the request type for the +// Query/QueryNextSequenceReceiveResponse RPC method +message QueryNextSequenceReceiveResponse { + // next sequence receive number + uint64 next_sequence_receive = 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/packages/cosmic-proto/proto/ibc/core/channel/v1/tx.proto b/packages/cosmic-proto/proto/ibc/core/channel/v1/tx.proto new file mode 100644 index 00000000000..eba65f1ebbf --- /dev/null +++ b/packages/cosmic-proto/proto/ibc/core/channel/v1/tx.proto @@ -0,0 +1,245 @@ +syntax = "proto3"; + +package ibc.core.channel.v1; + +option go_package = "github.com/cosmos/ibc-go/v6/modules/core/04-channel/types"; + +import "gogoproto/gogo.proto"; +import "ibc/core/client/v1/client.proto"; +import "ibc/core/channel/v1/channel.proto"; + +// Msg defines the ibc/channel Msg service. +service Msg { + // ChannelOpenInit defines a rpc handler method for MsgChannelOpenInit. + rpc ChannelOpenInit(MsgChannelOpenInit) returns (MsgChannelOpenInitResponse); + + // ChannelOpenTry defines a rpc handler method for MsgChannelOpenTry. + rpc ChannelOpenTry(MsgChannelOpenTry) returns (MsgChannelOpenTryResponse); + + // ChannelOpenAck defines a rpc handler method for MsgChannelOpenAck. + rpc ChannelOpenAck(MsgChannelOpenAck) returns (MsgChannelOpenAckResponse); + + // ChannelOpenConfirm defines a rpc handler method for MsgChannelOpenConfirm. + rpc ChannelOpenConfirm(MsgChannelOpenConfirm) returns (MsgChannelOpenConfirmResponse); + + // ChannelCloseInit defines a rpc handler method for MsgChannelCloseInit. + rpc ChannelCloseInit(MsgChannelCloseInit) returns (MsgChannelCloseInitResponse); + + // ChannelCloseConfirm defines a rpc handler method for + // MsgChannelCloseConfirm. + rpc ChannelCloseConfirm(MsgChannelCloseConfirm) returns (MsgChannelCloseConfirmResponse); + + // 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); + + // TimeoutOnClose defines a rpc handler method for MsgTimeoutOnClose. + rpc TimeoutOnClose(MsgTimeoutOnClose) returns (MsgTimeoutOnCloseResponse); + + // Acknowledgement defines a rpc handler method for MsgAcknowledgement. + rpc Acknowledgement(MsgAcknowledgement) returns (MsgAcknowledgementResponse); +} + +// 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"]; +} + +// 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 (gogoproto.goproto_getters) = false; + + string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""]; + 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\""]; + string version = 2; +} + +// MsgChannelOpenInit defines a msg sent by a Relayer to try to open a channel +// 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 (gogoproto.goproto_getters) = false; + + string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""]; + // 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\""]; + // 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; +} + +// MsgChannelOpenTryResponse defines the Msg/ChannelOpenTry response type. +message MsgChannelOpenTryResponse { + string version = 1; +} + +// 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 (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; +} + +// MsgChannelOpenAckResponse defines the Msg/ChannelOpenAck response type. +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 (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; +} + +// MsgChannelOpenConfirmResponse defines the Msg/ChannelOpenConfirm response +// type. +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 (gogoproto.goproto_getters) = false; + + string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""]; + string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""]; + string signer = 3; +} + +// MsgChannelCloseInitResponse defines the Msg/ChannelCloseInit response type. +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 (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; +} + +// MsgChannelCloseConfirmResponse defines the Msg/ChannelCloseConfirm response +// type. +message MsgChannelCloseConfirmResponse {} + +// MsgRecvPacket receives incoming IBC packet +message MsgRecvPacket { + option (gogoproto.equal) = false; + 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; +} + +// 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 (gogoproto.equal) = false; + 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; +} + +// MsgTimeoutResponse defines the Msg/Timeout response type. +message MsgTimeoutResponse { + option (gogoproto.goproto_getters) = false; + + ResponseResultType result = 1; +} + +// MsgTimeoutOnClose timed-out packet upon counterparty channel closure. +message MsgTimeoutOnClose { + option (gogoproto.equal) = false; + 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; +} + +// MsgTimeoutOnCloseResponse defines the Msg/TimeoutOnClose response type. +message MsgTimeoutOnCloseResponse { + option (gogoproto.goproto_getters) = false; + + ResponseResultType result = 1; +} + +// MsgAcknowledgement receives incoming IBC acknowledgement +message MsgAcknowledgement { + option (gogoproto.equal) = false; + 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; +} + +// MsgAcknowledgementResponse defines the Msg/Acknowledgement response type. +message MsgAcknowledgementResponse { + option (gogoproto.goproto_getters) = false; + + ResponseResultType result = 1; +} diff --git a/packages/cosmic-proto/proto/ibc/core/client/v1/genesis.proto b/packages/cosmic-proto/proto/ibc/core/client/v1/genesis.proto new file mode 100644 index 00000000000..02bafd81351 --- /dev/null +++ b/packages/cosmic-proto/proto/ibc/core/client/v1/genesis.proto @@ -0,0 +1,48 @@ +syntax = "proto3"; + +package ibc.core.client.v1; + +option go_package = "github.com/cosmos/ibc-go/v6/modules/core/02-client/types"; + +import "ibc/core/client/v1/client.proto"; +import "gogoproto/gogo.proto"; + +// GenesisState defines the ibc client submodule's genesis state. +message GenesisState { + // client states with their corresponding identifiers + 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\"" + ]; + // 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\""]; + // the sequence for the next generated client identifier + uint64 next_client_sequence = 6 [(gogoproto.moretags) = "yaml:\"next_client_sequence\""]; +} + +// GenesisMetadata defines the genesis type for metadata that clients may return +// with ExportMetadata +message GenesisMetadata { + option (gogoproto.goproto_getters) = false; + + // store key of metadata without clientID-prefix + bytes key = 1; + // metadata value + bytes value = 2; +} + +// 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\""]; +} diff --git a/packages/cosmic-proto/proto/ibc/core/client/v1/query.proto b/packages/cosmic-proto/proto/ibc/core/client/v1/query.proto new file mode 100644 index 00000000000..de16d917515 --- /dev/null +++ b/packages/cosmic-proto/proto/ibc/core/client/v1/query.proto @@ -0,0 +1,207 @@ +syntax = "proto3"; + +package ibc.core.client.v1; + +option go_package = "github.com/cosmos/ibc-go/v6/modules/core/02-client/types"; + +import "cosmos/base/query/v1beta1/pagination.proto"; +import "ibc/core/client/v1/client.proto"; +import "google/protobuf/any.proto"; +import "google/api/annotations.proto"; +import "gogoproto/gogo.proto"; + +// Query provides defines the gRPC querier service +service Query { + // ClientState queries an IBC light client. + rpc ClientState(QueryClientStateRequest) returns (QueryClientStateResponse) { + option (google.api.http).get = "/ibc/core/client/v1/client_states/{client_id}"; + } + + // ClientStates queries all the IBC light clients of a chain. + rpc ClientStates(QueryClientStatesRequest) returns (QueryClientStatesResponse) { + option (google.api.http).get = "/ibc/core/client/v1/client_states"; + } + + // ConsensusState queries a consensus state associated with a client state at + // a given height. + rpc ConsensusState(QueryConsensusStateRequest) returns (QueryConsensusStateResponse) { + option (google.api.http).get = "/ibc/core/client/v1/consensus_states/" + "{client_id}/revision/{revision_number}/" + "height/{revision_height}"; + } + + // ConsensusStates queries all the consensus state associated with a given + // client. + rpc ConsensusStates(QueryConsensusStatesRequest) returns (QueryConsensusStatesResponse) { + option (google.api.http).get = "/ibc/core/client/v1/consensus_states/{client_id}"; + } + + // ConsensusStateHeights queries the height of every consensus states associated with a given client. + rpc ConsensusStateHeights(QueryConsensusStateHeightsRequest) returns (QueryConsensusStateHeightsResponse) { + option (google.api.http).get = "/ibc/core/client/v1/consensus_states/{client_id}/heights"; + } + + // Status queries the status of an IBC client. + rpc ClientStatus(QueryClientStatusRequest) returns (QueryClientStatusResponse) { + option (google.api.http).get = "/ibc/core/client/v1/client_status/{client_id}"; + } + + // ClientParams queries all parameters of the ibc client submodule. + rpc ClientParams(QueryClientParamsRequest) returns (QueryClientParamsResponse) { + option (google.api.http).get = "/ibc/core/client/v1/params"; + } + + // UpgradedClientState queries an Upgraded IBC light client. + rpc UpgradedClientState(QueryUpgradedClientStateRequest) returns (QueryUpgradedClientStateResponse) { + option (google.api.http).get = "/ibc/core/client/v1/upgraded_client_states"; + } + + // UpgradedConsensusState queries an Upgraded IBC consensus state. + rpc UpgradedConsensusState(QueryUpgradedConsensusStateRequest) returns (QueryUpgradedConsensusStateResponse) { + option (google.api.http).get = "/ibc/core/client/v1/upgraded_consensus_states"; + } +} + +// QueryClientStateRequest is the request type for the Query/ClientState RPC +// method +message QueryClientStateRequest { + // client state unique identifier + string client_id = 1; +} + +// QueryClientStateResponse is the response type for the Query/ClientState RPC +// method. Besides the client state, it includes a proof and the height from +// which the proof was retrieved. +message QueryClientStateResponse { + // client state associated with the request identifier + google.protobuf.Any client_state = 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]; +} + +// QueryClientStatesRequest is the request type for the Query/ClientStates RPC +// method +message QueryClientStatesRequest { + // pagination request + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +// QueryClientStatesResponse is the response type for the Query/ClientStates RPC +// method. +message QueryClientStatesResponse { + // list of stored ClientStates of the chain. + repeated IdentifiedClientState client_states = 1 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "IdentifiedClientStates"]; + // pagination response + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryConsensusStateRequest is the request type for the Query/ConsensusState +// RPC method. Besides the consensus state, it includes a proof and the height +// from which the proof was retrieved. +message QueryConsensusStateRequest { + // client identifier + string client_id = 1; + // consensus state revision number + uint64 revision_number = 2; + // consensus state revision height + uint64 revision_height = 3; + // latest_height overrrides the height field and queries the latest stored + // ConsensusState + bool latest_height = 4; +} + +// QueryConsensusStateResponse is the response type for the Query/ConsensusState +// RPC method +message QueryConsensusStateResponse { + // consensus state associated with the client identifier at the given height + google.protobuf.Any consensus_state = 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]; +} + +// QueryConsensusStatesRequest is the request type for the Query/ConsensusStates +// RPC method. +message QueryConsensusStatesRequest { + // client identifier + string client_id = 1; + // pagination request + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// QueryConsensusStatesResponse is the response type for the +// Query/ConsensusStates RPC method +message QueryConsensusStatesResponse { + // consensus states associated with the identifier + repeated ConsensusStateWithHeight consensus_states = 1 [(gogoproto.nullable) = false]; + // pagination response + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryConsensusStateHeightsRequest is the request type for Query/ConsensusStateHeights +// RPC method. +message QueryConsensusStateHeightsRequest { + // client identifier + string client_id = 1; + // pagination request + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// QueryConsensusStateHeightsResponse is the response type for the +// Query/ConsensusStateHeights RPC method +message QueryConsensusStateHeightsResponse { + // consensus state heights + repeated Height consensus_state_heights = 1 [(gogoproto.nullable) = false]; + // pagination response + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryClientStatusRequest is the request type for the Query/ClientStatus RPC +// method +message QueryClientStatusRequest { + // client unique identifier + string client_id = 1; +} + +// QueryClientStatusResponse is the response type for the Query/ClientStatus RPC +// method. It returns the current status of the IBC client. +message QueryClientStatusResponse { + string status = 1; +} + +// QueryClientParamsRequest is the request type for the Query/ClientParams RPC +// method. +message QueryClientParamsRequest {} + +// QueryClientParamsResponse is the response type for the Query/ClientParams RPC +// method. +message QueryClientParamsResponse { + // params defines the parameters of the module. + Params params = 1; +} + +// QueryUpgradedClientStateRequest is the request type for the +// Query/UpgradedClientState RPC method +message QueryUpgradedClientStateRequest {} + +// QueryUpgradedClientStateResponse is the response type for the +// Query/UpgradedClientState RPC method. +message QueryUpgradedClientStateResponse { + // client state associated with the request identifier + google.protobuf.Any upgraded_client_state = 1; +} + +// QueryUpgradedConsensusStateRequest is the request type for the +// Query/UpgradedConsensusState RPC method +message QueryUpgradedConsensusStateRequest {} + +// QueryUpgradedConsensusStateResponse is the response type for the +// Query/UpgradedConsensusState RPC method. +message QueryUpgradedConsensusStateResponse { + // Consensus state associated with the request identifier + google.protobuf.Any upgraded_consensus_state = 1; +} diff --git a/packages/cosmic-proto/proto/ibc/core/client/v1/tx.proto b/packages/cosmic-proto/proto/ibc/core/client/v1/tx.proto new file mode 100644 index 00000000000..74ad6d9d7c3 --- /dev/null +++ b/packages/cosmic-proto/proto/ibc/core/client/v1/tx.proto @@ -0,0 +1,99 @@ +syntax = "proto3"; + +package ibc.core.client.v1; + +option go_package = "github.com/cosmos/ibc-go/v6/modules/core/02-client/types"; + +import "gogoproto/gogo.proto"; +import "google/protobuf/any.proto"; + +// Msg defines the ibc/client Msg service. +service Msg { + // CreateClient defines a rpc handler method for MsgCreateClient. + rpc CreateClient(MsgCreateClient) returns (MsgCreateClientResponse); + + // UpdateClient defines a rpc handler method for MsgUpdateClient. + rpc UpdateClient(MsgUpdateClient) returns (MsgUpdateClientResponse); + + // UpgradeClient defines a rpc handler method for MsgUpgradeClient. + rpc UpgradeClient(MsgUpgradeClient) returns (MsgUpgradeClientResponse); + + // SubmitMisbehaviour defines a rpc handler method for MsgSubmitMisbehaviour. + rpc SubmitMisbehaviour(MsgSubmitMisbehaviour) returns (MsgSubmitMisbehaviourResponse); +} + +// MsgCreateClient defines a message to create an IBC client +message MsgCreateClient { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // light client state + google.protobuf.Any client_state = 1 [(gogoproto.moretags) = "yaml:\"client_state\""]; + // consensus state associated with the client that corresponds to a given + // height. + google.protobuf.Any consensus_state = 2 [(gogoproto.moretags) = "yaml:\"consensus_state\""]; + // signer address + string signer = 3; +} + +// MsgCreateClientResponse defines the Msg/CreateClient response type. +message MsgCreateClientResponse {} + +// MsgUpdateClient defines an sdk.Msg to update a IBC client state using +// the given header. +message MsgUpdateClient { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // client unique identifier + string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""]; + // header to update the light client + google.protobuf.Any header = 2; + // signer address + string signer = 3; +} + +// MsgUpdateClientResponse defines the Msg/UpdateClient response type. +message MsgUpdateClientResponse {} + +// MsgUpgradeClient defines an sdk.Msg to upgrade an IBC client to a new client +// state +message MsgUpgradeClient { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // client unique identifier + string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""]; + // upgraded client state + google.protobuf.Any client_state = 2 [(gogoproto.moretags) = "yaml:\"client_state\""]; + // 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\""]; + // proof that old chain committed to new client + bytes proof_upgrade_client = 4 [(gogoproto.moretags) = "yaml:\"proof_upgrade_client\""]; + // proof that old chain committed to new consensus state + bytes proof_upgrade_consensus_state = 5 [(gogoproto.moretags) = "yaml:\"proof_upgrade_consensus_state\""]; + // signer address + string signer = 6; +} + +// MsgUpgradeClientResponse defines the Msg/UpgradeClient response type. +message MsgUpgradeClientResponse {} + +// MsgSubmitMisbehaviour defines an sdk.Msg type that submits Evidence for +// light client misbehaviour. +message MsgSubmitMisbehaviour { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // client unique identifier + string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""]; + // misbehaviour used for freezing the light client + google.protobuf.Any misbehaviour = 2; + // signer address + string signer = 3; +} + +// MsgSubmitMisbehaviourResponse defines the Msg/SubmitMisbehaviour response +// type. +message MsgSubmitMisbehaviourResponse {} diff --git a/packages/cosmic-proto/proto/ibc/core/commitment/v1/commitment.proto b/packages/cosmic-proto/proto/ibc/core/commitment/v1/commitment.proto new file mode 100644 index 00000000000..3852662453f --- /dev/null +++ b/packages/cosmic-proto/proto/ibc/core/commitment/v1/commitment.proto @@ -0,0 +1,41 @@ +syntax = "proto3"; + +package ibc.core.commitment.v1; + +option go_package = "github.com/cosmos/ibc-go/v6/modules/core/23-commitment/types"; + +import "gogoproto/gogo.proto"; +import "proofs.proto"; + +// MerkleRoot defines a merkle root hash. +// In the Cosmos SDK, the AppHash of a block header becomes the root. +message MerkleRoot { + option (gogoproto.goproto_getters) = false; + + bytes hash = 1; +} + +// MerklePrefix is merkle path prefixed to the key. +// 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\""]; +} + +// MerkleProof is a wrapper type over a chain of CommitmentProofs. +// It demonstrates membership or non-membership for an element or set of +// elements, verifiable in conjunction with a known commitment root. Proofs +// should be succinct. +// MerkleProofs are ordered from leaf-to-root +message MerkleProof { + repeated ics23.CommitmentProof proofs = 1; +} diff --git a/packages/cosmic-proto/proto/ibc/core/connection/v1/connection.proto b/packages/cosmic-proto/proto/ibc/core/connection/v1/connection.proto new file mode 100644 index 00000000000..8ec7a00a1dd --- /dev/null +++ b/packages/cosmic-proto/proto/ibc/core/connection/v1/connection.proto @@ -0,0 +1,114 @@ +syntax = "proto3"; + +package ibc.core.connection.v1; + +option go_package = "github.com/cosmos/ibc-go/v6/modules/core/03-connection/types"; + +import "gogoproto/gogo.proto"; +import "ibc/core/commitment/v1/commitment.proto"; + +// ICS03 - Connection Data Structures as defined in +// https://github.com/cosmos/ibc/blob/master/spec/core/ics-003-connection-semantics#data-structures + +// ConnectionEnd defines a stateful object on a chain connected to another +// separate one. +// NOTE: there must only be 2 defined ConnectionEnds to establish +// a connection between two chains. +message ConnectionEnd { + option (gogoproto.goproto_getters) = false; + // client associated with this connection. + string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""]; + // IBC version which can be utilised to determine encodings or protocols for + // channels or packets utilising this connection. + repeated Version versions = 2; + // current state of the connection end. + State state = 3; + // counterparty chain associated with this connection. + Counterparty counterparty = 4 [(gogoproto.nullable) = false]; + // 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\""]; +} + +// IdentifiedConnection defines a connection with additional connection +// identifier field. +message IdentifiedConnection { + option (gogoproto.goproto_getters) = false; + // connection identifier. + string id = 1 [(gogoproto.moretags) = "yaml:\"id\""]; + // client associated with this connection. + string client_id = 2 [(gogoproto.moretags) = "yaml:\"client_id\""]; + // IBC version which can be utilised to determine encodings or protocols for + // channels or packets utilising this connection + repeated Version versions = 3; + // current state of the connection end. + State state = 4; + // 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\""]; +} + +// State defines if a connection is in one of the following states: +// INIT, TRYOPEN, OPEN or UNINITIALIZED. +enum State { + option (gogoproto.goproto_enum_prefix) = false; + + // Default State + STATE_UNINITIALIZED_UNSPECIFIED = 0 [(gogoproto.enumvalue_customname) = "UNINITIALIZED"]; + // A connection end has just started the opening handshake. + STATE_INIT = 1 [(gogoproto.enumvalue_customname) = "INIT"]; + // A connection end has acknowledged the handshake step on the counterparty + // chain. + STATE_TRYOPEN = 2 [(gogoproto.enumvalue_customname) = "TRYOPEN"]; + // A connection end has completed the handshake. + STATE_OPEN = 3 [(gogoproto.enumvalue_customname) = "OPEN"]; +} + +// Counterparty defines the counterparty chain associated with a connection end. +message Counterparty { + option (gogoproto.goproto_getters) = false; + + // identifies the client on the counterparty chain associated with a given + // connection. + string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""]; + // identifies the connection end on the counterparty chain associated with a + // given connection. + string connection_id = 2 [(gogoproto.moretags) = "yaml:\"connection_id\""]; + // commitment merkle prefix of the counterparty chain. + ibc.core.commitment.v1.MerklePrefix prefix = 3 [(gogoproto.nullable) = false]; +} + +// ClientPaths define all the connection paths for a client state. +message ClientPaths { + // list of connection paths + repeated string paths = 1; +} + +// 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\""]; + // list of connection paths + repeated string paths = 2; +} + +// Version defines the versioning scheme used to negotiate the IBC verison in +// the connection handshake. +message Version { + option (gogoproto.goproto_getters) = false; + + // unique version identifier + string identifier = 1; + // list of features compatible with the specified identifier + repeated string features = 2; +} + +// Params defines the set of Connection parameters. +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\""]; +} diff --git a/packages/cosmic-proto/proto/ibc/core/connection/v1/genesis.proto b/packages/cosmic-proto/proto/ibc/core/connection/v1/genesis.proto new file mode 100644 index 00000000000..c9d46081494 --- /dev/null +++ b/packages/cosmic-proto/proto/ibc/core/connection/v1/genesis.proto @@ -0,0 +1,18 @@ +syntax = "proto3"; + +package ibc.core.connection.v1; + +option go_package = "github.com/cosmos/ibc-go/v6/modules/core/03-connection/types"; + +import "gogoproto/gogo.proto"; +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\""]; + // the sequence for the next generated connection identifier + uint64 next_connection_sequence = 3 [(gogoproto.moretags) = "yaml:\"next_connection_sequence\""]; + Params params = 4 [(gogoproto.nullable) = false]; +} diff --git a/packages/cosmic-proto/proto/ibc/core/connection/v1/query.proto b/packages/cosmic-proto/proto/ibc/core/connection/v1/query.proto new file mode 100644 index 00000000000..04d7c3ea71f --- /dev/null +++ b/packages/cosmic-proto/proto/ibc/core/connection/v1/query.proto @@ -0,0 +1,152 @@ +syntax = "proto3"; + +package ibc.core.connection.v1; + +option go_package = "github.com/cosmos/ibc-go/v6/modules/core/03-connection/types"; + +import "gogoproto/gogo.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; +import "ibc/core/client/v1/client.proto"; +import "ibc/core/connection/v1/connection.proto"; +import "google/api/annotations.proto"; +import "google/protobuf/any.proto"; + +// Query provides defines the gRPC querier service +service Query { + // Connection queries an IBC connection end. + rpc Connection(QueryConnectionRequest) returns (QueryConnectionResponse) { + option (google.api.http).get = "/ibc/core/connection/v1/connections/{connection_id}"; + } + + // Connections queries all the IBC connections of a chain. + rpc Connections(QueryConnectionsRequest) returns (QueryConnectionsResponse) { + option (google.api.http).get = "/ibc/core/connection/v1/connections"; + } + + // ClientConnections queries the connection paths associated with a client + // state. + rpc ClientConnections(QueryClientConnectionsRequest) returns (QueryClientConnectionsResponse) { + option (google.api.http).get = "/ibc/core/connection/v1/client_connections/{client_id}"; + } + + // ConnectionClientState queries the client state associated with the + // connection. + rpc ConnectionClientState(QueryConnectionClientStateRequest) returns (QueryConnectionClientStateResponse) { + option (google.api.http).get = "/ibc/core/connection/v1/connections/{connection_id}/client_state"; + } + + // ConnectionConsensusState queries the consensus state associated with the + // connection. + rpc ConnectionConsensusState(QueryConnectionConsensusStateRequest) returns (QueryConnectionConsensusStateResponse) { + option (google.api.http).get = "/ibc/core/connection/v1/connections/{connection_id}/consensus_state/" + "revision/{revision_number}/height/{revision_height}"; + } + + // ConnectionParams queries all parameters of the ibc connection submodule. + rpc ConnectionParams(QueryConnectionParamsRequest) returns (QueryConnectionParamsResponse) { + option (google.api.http).get = "/ibc/core/connection/v1/params"; + } +} + +// QueryConnectionRequest is the request type for the Query/Connection RPC +// method +message QueryConnectionRequest { + // connection unique identifier + string connection_id = 1; +} + +// QueryConnectionResponse is the response type for the Query/Connection RPC +// method. Besides the connection end, it includes a proof and the height from +// which the proof was retrieved. +message QueryConnectionResponse { + // connection associated with the request identifier + ibc.core.connection.v1.ConnectionEnd connection = 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]; +} + +// QueryConnectionsRequest is the request type for the Query/Connections RPC +// method +message QueryConnectionsRequest { + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +// QueryConnectionsResponse is the response type for the Query/Connections RPC +// method. +message QueryConnectionsResponse { + // list of stored connections of the chain. + repeated ibc.core.connection.v1.IdentifiedConnection connections = 1; + // pagination response + cosmos.base.query.v1beta1.PageResponse pagination = 2; + // query block height + ibc.core.client.v1.Height height = 3 [(gogoproto.nullable) = false]; +} + +// QueryClientConnectionsRequest is the request type for the +// Query/ClientConnections RPC method +message QueryClientConnectionsRequest { + // client identifier associated with a connection + string client_id = 1; +} + +// QueryClientConnectionsResponse is the response type for the +// Query/ClientConnections RPC method +message QueryClientConnectionsResponse { + // slice of all the connection paths associated with a client. + repeated string connection_paths = 1; + // merkle proof of existence + bytes proof = 2; + // height at which the proof was generated + ibc.core.client.v1.Height proof_height = 3 [(gogoproto.nullable) = false]; +} + +// QueryConnectionClientStateRequest is the request type for the +// Query/ConnectionClientState RPC method +message QueryConnectionClientStateRequest { + // connection identifier + string connection_id = 1 [(gogoproto.moretags) = "yaml:\"connection_id\""]; +} + +// QueryConnectionClientStateResponse is the response type for the +// Query/ConnectionClientState RPC method +message QueryConnectionClientStateResponse { + // client state associated with the channel + ibc.core.client.v1.IdentifiedClientState identified_client_state = 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]; +} + +// QueryConnectionConsensusStateRequest is the request type for the +// Query/ConnectionConsensusState RPC method +message QueryConnectionConsensusStateRequest { + // connection identifier + string connection_id = 1 [(gogoproto.moretags) = "yaml:\"connection_id\""]; + uint64 revision_number = 2; + uint64 revision_height = 3; +} + +// QueryConnectionConsensusStateResponse is the response type for the +// Query/ConnectionConsensusState RPC method +message QueryConnectionConsensusStateResponse { + // consensus state associated with the channel + google.protobuf.Any consensus_state = 1; + // client ID associated with the consensus state + string client_id = 2; + // merkle proof of existence + bytes proof = 3; + // height at which the proof was retrieved + ibc.core.client.v1.Height proof_height = 4 [(gogoproto.nullable) = false]; +} + +// QueryConnectionParamsRequest is the request type for the Query/ConnectionParams RPC method. +message QueryConnectionParamsRequest {} + +// QueryConnectionParamsResponse is the response type for the Query/ConnectionParams RPC method. +message QueryConnectionParamsResponse { + // params defines the parameters of the module. + Params params = 1; +} \ No newline at end of file diff --git a/packages/cosmic-proto/proto/ibc/core/connection/v1/tx.proto b/packages/cosmic-proto/proto/ibc/core/connection/v1/tx.proto new file mode 100644 index 00000000000..94d676bbc38 --- /dev/null +++ b/packages/cosmic-proto/proto/ibc/core/connection/v1/tx.proto @@ -0,0 +1,118 @@ +syntax = "proto3"; + +package ibc.core.connection.v1; + +option go_package = "github.com/cosmos/ibc-go/v6/modules/core/03-connection/types"; + +import "gogoproto/gogo.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 { + // ConnectionOpenInit defines a rpc handler method for MsgConnectionOpenInit. + rpc ConnectionOpenInit(MsgConnectionOpenInit) returns (MsgConnectionOpenInitResponse); + + // ConnectionOpenTry defines a rpc handler method for MsgConnectionOpenTry. + rpc ConnectionOpenTry(MsgConnectionOpenTry) returns (MsgConnectionOpenTryResponse); + + // ConnectionOpenAck defines a rpc handler method for MsgConnectionOpenAck. + rpc ConnectionOpenAck(MsgConnectionOpenAck) returns (MsgConnectionOpenAckResponse); + + // ConnectionOpenConfirm defines a rpc handler method for + // MsgConnectionOpenConfirm. + rpc ConnectionOpenConfirm(MsgConnectionOpenConfirm) returns (MsgConnectionOpenConfirmResponse); +} + +// 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 (gogoproto.goproto_getters) = false; + + string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""]; + Counterparty counterparty = 2 [(gogoproto.nullable) = false]; + Version version = 3; + uint64 delay_period = 4 [(gogoproto.moretags) = "yaml:\"delay_period\""]; + string signer = 5; +} + +// MsgConnectionOpenInitResponse defines the Msg/ConnectionOpenInit response +// type. +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 (gogoproto.goproto_getters) = false; + + string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""]; + // 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\""]; + 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 -> + // 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; +} + +// MsgConnectionOpenTryResponse defines the Msg/ConnectionOpenTry response type. +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 (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 -> + // 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; +} + +// MsgConnectionOpenAckResponse defines the Msg/ConnectionOpenAck response type. +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 (gogoproto.goproto_getters) = false; + + string connection_id = 1 [(gogoproto.moretags) = "yaml:\"connection_id\""]; + // 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; +} + +// MsgConnectionOpenConfirmResponse defines the Msg/ConnectionOpenConfirm +// response type. +message MsgConnectionOpenConfirmResponse {} diff --git a/packages/cosmic-proto/proto/ibc/core/types/v1/genesis.proto b/packages/cosmic-proto/proto/ibc/core/types/v1/genesis.proto new file mode 100644 index 00000000000..dd389d412ea --- /dev/null +++ b/packages/cosmic-proto/proto/ibc/core/types/v1/genesis.proto @@ -0,0 +1,23 @@ +syntax = "proto3"; + +package ibc.core.types.v1; + +option go_package = "github.com/cosmos/ibc-go/v6/modules/core/types"; + +import "gogoproto/gogo.proto"; +import "ibc/core/client/v1/genesis.proto"; +import "ibc/core/connection/v1/genesis.proto"; +import "ibc/core/channel/v1/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\""]; + // ICS003 - Connections genesis state + ibc.core.connection.v1.GenesisState connection_genesis = 2 + [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"connection_genesis\""]; + // ICS004 - Channel genesis state + ibc.core.channel.v1.GenesisState channel_genesis = 3 + [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"channel_genesis\""]; +} diff --git a/packages/cosmic-proto/proto/ibc/lightclients/localhost/v1/localhost.proto b/packages/cosmic-proto/proto/ibc/lightclients/localhost/v1/localhost.proto new file mode 100644 index 00000000000..ad0141afb32 --- /dev/null +++ b/packages/cosmic-proto/proto/ibc/lightclients/localhost/v1/localhost.proto @@ -0,0 +1,18 @@ +syntax = "proto3"; + +package ibc.lightclients.localhost.v1; + +option go_package = "github.com/cosmos/ibc-go/v6/modules/light-clients/09-localhost/types"; + +import "gogoproto/gogo.proto"; +import "ibc/core/client/v1/client.proto"; + +// ClientState defines a loopback (localhost) client. It requires (read-only) +// access to keys outside the client prefix. +message ClientState { + option (gogoproto.goproto_getters) = false; + // self chain ID + string chain_id = 1 [(gogoproto.moretags) = "yaml:\"chain_id\""]; + // self latest block height + ibc.core.client.v1.Height height = 2 [(gogoproto.nullable) = false]; +} diff --git a/packages/cosmic-proto/proto/ibc/lightclients/solomachine/v1/solomachine.proto b/packages/cosmic-proto/proto/ibc/lightclients/solomachine/v1/solomachine.proto new file mode 100644 index 00000000000..46d102bbb6c --- /dev/null +++ b/packages/cosmic-proto/proto/ibc/lightclients/solomachine/v1/solomachine.proto @@ -0,0 +1,189 @@ +syntax = "proto3"; + +package ibc.lightclients.solomachine.v1; + +option go_package = "github.com/cosmos/ibc-go/v6/modules/core/02-client/legacy/v100"; + +import "ibc/core/connection/v1/connection.proto"; +import "ibc/core/channel/v1/channel.proto"; +import "gogoproto/gogo.proto"; +import "google/protobuf/any.proto"; + +// ClientState defines a solo machine client that tracks the current consensus +// state and if the client is frozen. +message ClientState { + option (gogoproto.goproto_getters) = false; + // latest sequence of the client state + uint64 sequence = 1; + // frozen sequence of the solo machine + uint64 frozen_sequence = 2 [(gogoproto.moretags) = "yaml:\"frozen_sequence\""]; + ConsensusState consensus_state = 3 [(gogoproto.moretags) = "yaml:\"consensus_state\""]; + // 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\""]; +} + +// ConsensusState defines a solo machine consensus state. The sequence of a +// consensus state is contained in the "height" key used in storing the +// consensus state. +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 + // machine clients (potentially on different chains) without being considered + // misbehaviour. + string diversifier = 2; + uint64 timestamp = 3; +} + +// Header defines a solo machine consensus header +message Header { + option (gogoproto.goproto_getters) = false; + // sequence to update solo machine public key at + 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\""]; +} + +// 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\""]; + uint64 sequence = 2; + SignatureAndData signature_one = 3 [(gogoproto.moretags) = "yaml:\"signature_one\""]; + SignatureAndData signature_two = 4 [(gogoproto.moretags) = "yaml:\"signature_two\""]; +} + +// SignatureAndData contains a signature and the data signed over to create that +// signature. +message SignatureAndData { + option (gogoproto.goproto_getters) = false; + bytes signature = 1; + DataType data_type = 2 [(gogoproto.moretags) = "yaml:\"data_type\""]; + bytes data = 3; + uint64 timestamp = 4; +} + +// TimestampedSignatureData contains the signature data and the timestamp of the +// signature. +message TimestampedSignatureData { + option (gogoproto.goproto_getters) = false; + bytes signature_data = 1 [(gogoproto.moretags) = "yaml:\"signature_data\""]; + uint64 timestamp = 2; +} + +// SignBytes defines the signed bytes used for signature verification. +message SignBytes { + option (gogoproto.goproto_getters) = false; + + uint64 sequence = 1; + uint64 timestamp = 2; + string diversifier = 3; + // type of the data used + DataType data_type = 4 [(gogoproto.moretags) = "yaml:\"data_type\""]; + // marshaled data + bytes data = 5; +} + +// DataType defines the type of solo machine proof being created. This is done +// to preserve uniqueness of different data sign byte encodings. +enum DataType { + option (gogoproto.goproto_enum_prefix) = false; + + // Default State + DATA_TYPE_UNINITIALIZED_UNSPECIFIED = 0 [(gogoproto.enumvalue_customname) = "UNSPECIFIED"]; + // Data type for client state verification + DATA_TYPE_CLIENT_STATE = 1 [(gogoproto.enumvalue_customname) = "CLIENT"]; + // Data type for consensus state verification + DATA_TYPE_CONSENSUS_STATE = 2 [(gogoproto.enumvalue_customname) = "CONSENSUS"]; + // Data type for connection state verification + DATA_TYPE_CONNECTION_STATE = 3 [(gogoproto.enumvalue_customname) = "CONNECTION"]; + // Data type for channel state verification + DATA_TYPE_CHANNEL_STATE = 4 [(gogoproto.enumvalue_customname) = "CHANNEL"]; + // Data type for packet commitment verification + DATA_TYPE_PACKET_COMMITMENT = 5 [(gogoproto.enumvalue_customname) = "PACKETCOMMITMENT"]; + // Data type for packet acknowledgement verification + DATA_TYPE_PACKET_ACKNOWLEDGEMENT = 6 [(gogoproto.enumvalue_customname) = "PACKETACKNOWLEDGEMENT"]; + // Data type for packet receipt absence verification + DATA_TYPE_PACKET_RECEIPT_ABSENCE = 7 [(gogoproto.enumvalue_customname) = "PACKETRECEIPTABSENCE"]; + // Data type for next sequence recv verification + DATA_TYPE_NEXT_SEQUENCE_RECV = 8 [(gogoproto.enumvalue_customname) = "NEXTSEQUENCERECV"]; + // Data type for header verification + DATA_TYPE_HEADER = 9 [(gogoproto.enumvalue_customname) = "HEADER"]; +} + +// HeaderData returns the SignBytes data for update verification. +message HeaderData { + option (gogoproto.goproto_getters) = false; + + // header public key + google.protobuf.Any new_pub_key = 1 [(gogoproto.moretags) = "yaml:\"new_pub_key\""]; + // header diversifier + string new_diversifier = 2 [(gogoproto.moretags) = "yaml:\"new_diversifier\""]; +} + +// ClientStateData returns the SignBytes data for client state verification. +message ClientStateData { + option (gogoproto.goproto_getters) = false; + + bytes path = 1; + google.protobuf.Any client_state = 2 [(gogoproto.moretags) = "yaml:\"client_state\""]; +} + +// ConsensusStateData returns the SignBytes data for consensus state +// verification. +message ConsensusStateData { + option (gogoproto.goproto_getters) = false; + + bytes path = 1; + google.protobuf.Any consensus_state = 2 [(gogoproto.moretags) = "yaml:\"consensus_state\""]; +} + +// ConnectionStateData returns the SignBytes data for connection state +// verification. +message ConnectionStateData { + option (gogoproto.goproto_getters) = false; + + bytes path = 1; + ibc.core.connection.v1.ConnectionEnd connection = 2; +} + +// ChannelStateData returns the SignBytes data for channel state +// verification. +message ChannelStateData { + option (gogoproto.goproto_getters) = false; + + bytes path = 1; + ibc.core.channel.v1.Channel channel = 2; +} + +// PacketCommitmentData returns the SignBytes data for packet commitment +// verification. +message PacketCommitmentData { + bytes path = 1; + bytes commitment = 2; +} + +// PacketAcknowledgementData returns the SignBytes data for acknowledgement +// verification. +message PacketAcknowledgementData { + bytes path = 1; + bytes acknowledgement = 2; +} + +// PacketReceiptAbsenceData returns the SignBytes data for +// packet receipt absence verification. +message PacketReceiptAbsenceData { + bytes path = 1; +} + +// NextSequenceRecvData returns the SignBytes data for verification of the next +// sequence to be received. +message NextSequenceRecvData { + bytes path = 1; + uint64 next_seq_recv = 2 [(gogoproto.moretags) = "yaml:\"next_seq_recv\""]; +} diff --git a/packages/cosmic-proto/proto/ibc/lightclients/solomachine/v2/solomachine.proto b/packages/cosmic-proto/proto/ibc/lightclients/solomachine/v2/solomachine.proto new file mode 100644 index 00000000000..ea5cb89d8d4 --- /dev/null +++ b/packages/cosmic-proto/proto/ibc/lightclients/solomachine/v2/solomachine.proto @@ -0,0 +1,189 @@ +syntax = "proto3"; + +package ibc.lightclients.solomachine.v2; + +option go_package = "github.com/cosmos/ibc-go/v6/modules/light-clients/06-solomachine/types"; + +import "ibc/core/connection/v1/connection.proto"; +import "ibc/core/channel/v1/channel.proto"; +import "gogoproto/gogo.proto"; +import "google/protobuf/any.proto"; + +// ClientState defines a solo machine client that tracks the current consensus +// state and if the client is frozen. +message ClientState { + option (gogoproto.goproto_getters) = false; + // 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\""]; + // 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\""]; +} + +// ConsensusState defines a solo machine consensus state. The sequence of a +// consensus state is contained in the "height" key used in storing the +// consensus state. +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 + // machine clients (potentially on different chains) without being considered + // misbehaviour. + string diversifier = 2; + uint64 timestamp = 3; +} + +// Header defines a solo machine consensus header +message Header { + option (gogoproto.goproto_getters) = false; + // sequence to update solo machine public key at + 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\""]; +} + +// 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\""]; + uint64 sequence = 2; + SignatureAndData signature_one = 3 [(gogoproto.moretags) = "yaml:\"signature_one\""]; + SignatureAndData signature_two = 4 [(gogoproto.moretags) = "yaml:\"signature_two\""]; +} + +// SignatureAndData contains a signature and the data signed over to create that +// signature. +message SignatureAndData { + option (gogoproto.goproto_getters) = false; + bytes signature = 1; + DataType data_type = 2 [(gogoproto.moretags) = "yaml:\"data_type\""]; + bytes data = 3; + uint64 timestamp = 4; +} + +// TimestampedSignatureData contains the signature data and the timestamp of the +// signature. +message TimestampedSignatureData { + option (gogoproto.goproto_getters) = false; + bytes signature_data = 1 [(gogoproto.moretags) = "yaml:\"signature_data\""]; + uint64 timestamp = 2; +} + +// SignBytes defines the signed bytes used for signature verification. +message SignBytes { + option (gogoproto.goproto_getters) = false; + + uint64 sequence = 1; + uint64 timestamp = 2; + string diversifier = 3; + // type of the data used + DataType data_type = 4 [(gogoproto.moretags) = "yaml:\"data_type\""]; + // marshaled data + bytes data = 5; +} + +// DataType defines the type of solo machine proof being created. This is done +// to preserve uniqueness of different data sign byte encodings. +enum DataType { + option (gogoproto.goproto_enum_prefix) = false; + + // Default State + DATA_TYPE_UNINITIALIZED_UNSPECIFIED = 0 [(gogoproto.enumvalue_customname) = "UNSPECIFIED"]; + // Data type for client state verification + DATA_TYPE_CLIENT_STATE = 1 [(gogoproto.enumvalue_customname) = "CLIENT"]; + // Data type for consensus state verification + DATA_TYPE_CONSENSUS_STATE = 2 [(gogoproto.enumvalue_customname) = "CONSENSUS"]; + // Data type for connection state verification + DATA_TYPE_CONNECTION_STATE = 3 [(gogoproto.enumvalue_customname) = "CONNECTION"]; + // Data type for channel state verification + DATA_TYPE_CHANNEL_STATE = 4 [(gogoproto.enumvalue_customname) = "CHANNEL"]; + // Data type for packet commitment verification + DATA_TYPE_PACKET_COMMITMENT = 5 [(gogoproto.enumvalue_customname) = "PACKETCOMMITMENT"]; + // Data type for packet acknowledgement verification + DATA_TYPE_PACKET_ACKNOWLEDGEMENT = 6 [(gogoproto.enumvalue_customname) = "PACKETACKNOWLEDGEMENT"]; + // Data type for packet receipt absence verification + DATA_TYPE_PACKET_RECEIPT_ABSENCE = 7 [(gogoproto.enumvalue_customname) = "PACKETRECEIPTABSENCE"]; + // Data type for next sequence recv verification + DATA_TYPE_NEXT_SEQUENCE_RECV = 8 [(gogoproto.enumvalue_customname) = "NEXTSEQUENCERECV"]; + // Data type for header verification + DATA_TYPE_HEADER = 9 [(gogoproto.enumvalue_customname) = "HEADER"]; +} + +// HeaderData returns the SignBytes data for update verification. +message HeaderData { + option (gogoproto.goproto_getters) = false; + + // header public key + google.protobuf.Any new_pub_key = 1 [(gogoproto.moretags) = "yaml:\"new_pub_key\""]; + // header diversifier + string new_diversifier = 2 [(gogoproto.moretags) = "yaml:\"new_diversifier\""]; +} + +// ClientStateData returns the SignBytes data for client state verification. +message ClientStateData { + option (gogoproto.goproto_getters) = false; + + bytes path = 1; + google.protobuf.Any client_state = 2 [(gogoproto.moretags) = "yaml:\"client_state\""]; +} + +// ConsensusStateData returns the SignBytes data for consensus state +// verification. +message ConsensusStateData { + option (gogoproto.goproto_getters) = false; + + bytes path = 1; + google.protobuf.Any consensus_state = 2 [(gogoproto.moretags) = "yaml:\"consensus_state\""]; +} + +// ConnectionStateData returns the SignBytes data for connection state +// verification. +message ConnectionStateData { + option (gogoproto.goproto_getters) = false; + + bytes path = 1; + ibc.core.connection.v1.ConnectionEnd connection = 2; +} + +// ChannelStateData returns the SignBytes data for channel state +// verification. +message ChannelStateData { + option (gogoproto.goproto_getters) = false; + + bytes path = 1; + ibc.core.channel.v1.Channel channel = 2; +} + +// PacketCommitmentData returns the SignBytes data for packet commitment +// verification. +message PacketCommitmentData { + bytes path = 1; + bytes commitment = 2; +} + +// PacketAcknowledgementData returns the SignBytes data for acknowledgement +// verification. +message PacketAcknowledgementData { + bytes path = 1; + bytes acknowledgement = 2; +} + +// PacketReceiptAbsenceData returns the SignBytes data for +// packet receipt absence verification. +message PacketReceiptAbsenceData { + bytes path = 1; +} + +// NextSequenceRecvData returns the SignBytes data for verification of the next +// sequence to be received. +message NextSequenceRecvData { + bytes path = 1; + uint64 next_seq_recv = 2 [(gogoproto.moretags) = "yaml:\"next_seq_recv\""]; +} diff --git a/packages/cosmic-proto/proto/ibc/lightclients/tendermint/v1/tendermint.proto b/packages/cosmic-proto/proto/ibc/lightclients/tendermint/v1/tendermint.proto new file mode 100644 index 00000000000..cb0544b580f --- /dev/null +++ b/packages/cosmic-proto/proto/ibc/lightclients/tendermint/v1/tendermint.proto @@ -0,0 +1,114 @@ +syntax = "proto3"; + +package ibc.lightclients.tendermint.v1; + +option go_package = "github.com/cosmos/ibc-go/v6/modules/light-clients/07-tendermint/types"; + +import "tendermint/types/validator.proto"; +import "tendermint/types/types.proto"; +import "proofs.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; +import "ibc/core/client/v1/client.proto"; +import "ibc/core/commitment/v1/commitment.proto"; +import "gogoproto/gogo.proto"; + +// ClientState from Tendermint tracks the current validator set, latest height, +// and a possible frozen height. +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 + // submitted headers are valid for upgrade + google.protobuf.Duration trusting_period = 3 + [(gogoproto.nullable) = false, (gogoproto.stdduration) = true, (gogoproto.moretags) = "yaml:\"trusting_period\""]; + // duration of the staking unbonding period + google.protobuf.Duration unbonding_period = 4 [ + (gogoproto.nullable) = false, + (gogoproto.stdduration) = true, + (gogoproto.moretags) = "yaml:\"unbonding_period\"" + ]; + // 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\""]; + // 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\""]; + // Latest height the client was updated to + ibc.core.client.v1.Height latest_height = 7 + [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"latest_height\""]; + + // Proof specifications used in verifying counterparty state + repeated ics23.ProofSpec proof_specs = 8 [(gogoproto.moretags) = "yaml:\"proof_specs\""]; + + // Path at which next upgraded client will be committed. + // Each element corresponds to the key for a single CommitmentProof in the + // chained proof. NOTE: ClientState must stored under + // `{upgradePath}/{upgradeHeight}/clientState` ConsensusState must be stored + // 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\""]; + + // allow_update_after_expiry is deprecated + bool allow_update_after_expiry = 10 [deprecated = true, (gogoproto.moretags) = "yaml:\"allow_update_after_expiry\""]; + // allow_update_after_misbehaviour is deprecated + bool allow_update_after_misbehaviour = 11 + [deprecated = true, (gogoproto.moretags) = "yaml:\"allow_update_after_misbehaviour\""]; +} + +// ConsensusState defines the consensus state from Tendermint. +message ConsensusState { + option (gogoproto.goproto_getters) = false; + + // timestamp that corresponds to the block height in which the 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/tendermint/tendermint/libs/bytes.HexBytes", + (gogoproto.moretags) = "yaml:\"next_validators_hash\"" + ]; +} + +// Misbehaviour is a wrapper over two conflicting Headers +// that implements Misbehaviour interface expected by ICS-02 +message Misbehaviour { + option (gogoproto.goproto_getters) = false; + + string client_id = 1 [(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\""]; +} + +// Header defines the Tendermint client consensus Header. +// It encapsulates all the information necessary to update from a trusted +// Tendermint ConsensusState. The inclusion of TrustedHeight and +// TrustedValidators allows this update to process correctly, so long as the +// ConsensusState for the TrustedHeight exists, this removes race conditions +// among relayers The SignedHeader and ValidatorSet are the new untrusted update +// fields for the client. The TrustedHeight is the height of a stored +// ConsensusState on the client that will be used to verify the new untrusted +// header. The Trusted ConsensusState must be within the unbonding period of +// current time in order to correctly verify, and the TrustedValidators must +// 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.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\""]; +} + +// Fraction defines the protobuf message type for tmmath.Fraction that only +// supports positive values. +message Fraction { + uint64 numerator = 1; + uint64 denominator = 2; +} diff --git a/packages/cosmic-proto/proto/proofs.proto b/packages/cosmic-proto/proto/proofs.proto new file mode 100644 index 00000000000..a1397dff5fb --- /dev/null +++ b/packages/cosmic-proto/proto/proofs.proto @@ -0,0 +1,235 @@ +syntax = "proto3"; + +package ics23; +option go_package = "github.com/confio/ics23/go"; + +enum HashOp { + // NO_HASH is the default if no data passed. Note this is an illegal argument some places. + NO_HASH = 0; + SHA256 = 1; + SHA512 = 2; + KECCAK = 3; + RIPEMD160 = 4; + BITCOIN = 5; // ripemd160(sha256(x)) + SHA512_256 = 6; +} + +/** +LengthOp defines how to process the key and value of the LeafOp +to include length information. After encoding the length with the given +algorithm, the length will be prepended to the key and value bytes. +(Each one with it's own encoded length) +*/ +enum LengthOp { + // NO_PREFIX don't include any length info + NO_PREFIX = 0; + // VAR_PROTO uses protobuf (and go-amino) varint encoding of the length + VAR_PROTO = 1; + // VAR_RLP uses rlp int encoding of the length + VAR_RLP = 2; + // FIXED32_BIG uses big-endian encoding of the length as a 32 bit integer + FIXED32_BIG = 3; + // FIXED32_LITTLE uses little-endian encoding of the length as a 32 bit integer + FIXED32_LITTLE = 4; + // FIXED64_BIG uses big-endian encoding of the length as a 64 bit integer + FIXED64_BIG = 5; + // FIXED64_LITTLE uses little-endian encoding of the length as a 64 bit integer + FIXED64_LITTLE = 6; + // REQUIRE_32_BYTES is like NONE, but will fail if the input is not exactly 32 bytes (sha256 output) + REQUIRE_32_BYTES = 7; + // REQUIRE_64_BYTES is like NONE, but will fail if the input is not exactly 64 bytes (sha512 output) + REQUIRE_64_BYTES = 8; +} + +/** +ExistenceProof takes a key and a value and a set of steps to perform on it. +The result of peforming all these steps will provide a "root hash", which can +be compared to the value in a header. + +Since it is computationally infeasible to produce a hash collission for any of the used +cryptographic hash functions, if someone can provide a series of operations to transform +a given key and value into a root hash that matches some trusted root, these key and values +must be in the referenced merkle tree. + +The only possible issue is maliablity in LeafOp, such as providing extra prefix data, +which should be controlled by a spec. Eg. with lengthOp as NONE, + prefix = FOO, key = BAR, value = CHOICE +and + prefix = F, key = OOBAR, value = CHOICE +would produce the same value. + +With LengthOp this is tricker but not impossible. Which is why the "leafPrefixEqual" field +in the ProofSpec is valuable to prevent this mutability. And why all trees should +length-prefix the data before hashing it. +*/ +message ExistenceProof { + bytes key = 1; + bytes value = 2; + LeafOp leaf = 3; + repeated InnerOp path = 4; +} + +/* +NonExistenceProof takes a proof of two neighbors, one left of the desired key, +one right of the desired key. If both proofs are valid AND they are neighbors, +then there is no valid proof for the given key. +*/ +message NonExistenceProof { + bytes key = 1; // TODO: remove this as unnecessary??? we prove a range + ExistenceProof left = 2; + ExistenceProof right = 3; +} + +/* +CommitmentProof is either an ExistenceProof or a NonExistenceProof, or a Batch of such messages +*/ +message CommitmentProof { + oneof proof { + ExistenceProof exist = 1; + NonExistenceProof nonexist = 2; + BatchProof batch = 3; + CompressedBatchProof compressed = 4; + } +} + +/** +LeafOp represents the raw key-value data we wish to prove, and +must be flexible to represent the internal transformation from +the original key-value pairs into the basis hash, for many existing +merkle trees. + +key and value are passed in. So that the signature of this operation is: + leafOp(key, value) -> output + +To process this, first prehash the keys and values if needed (ANY means no hash in this case): + hkey = prehashKey(key) + hvalue = prehashValue(value) + +Then combine the bytes, and hash it + output = hash(prefix || length(hkey) || hkey || length(hvalue) || hvalue) +*/ +message LeafOp { + HashOp hash = 1; + HashOp prehash_key = 2; + HashOp prehash_value = 3; + LengthOp length = 4; + // prefix is a fixed bytes that may optionally be included at the beginning to differentiate + // a leaf node from an inner node. + bytes prefix = 5; +} + +/** +InnerOp represents a merkle-proof step that is not a leaf. +It represents concatenating two children and hashing them to provide the next result. + +The result of the previous step is passed in, so the signature of this op is: + innerOp(child) -> output + +The result of applying InnerOp should be: + output = op.hash(op.prefix || child || op.suffix) + + where the || operator is concatenation of binary data, +and child is the result of hashing all the tree below this step. + +Any special data, like prepending child with the length, or prepending the entire operation with +some value to differentiate from leaf nodes, should be included in prefix and suffix. +If either of prefix or suffix is empty, we just treat it as an empty string +*/ +message InnerOp { + HashOp hash = 1; + bytes prefix = 2; + bytes suffix = 3; +} + + +/** +ProofSpec defines what the expected parameters are for a given proof type. +This can be stored in the client and used to validate any incoming proofs. + + verify(ProofSpec, Proof) -> Proof | Error + +As demonstrated in tests, if we don't fix the algorithm used to calculate the +LeafHash for a given tree, there are many possible key-value pairs that can +generate a given hash (by interpretting the preimage differently). +We need this for proper security, requires client knows a priori what +tree format server uses. But not in code, rather a configuration object. +*/ +message ProofSpec { + // any field in the ExistenceProof must be the same as in this spec. + // except Prefix, which is just the first bytes of prefix (spec can be longer) + LeafOp leaf_spec = 1; + InnerSpec inner_spec = 2; + // max_depth (if > 0) is the maximum number of InnerOps allowed (mainly for fixed-depth tries) + int32 max_depth = 3; + // min_depth (if > 0) is the minimum number of InnerOps allowed (mainly for fixed-depth tries) + int32 min_depth = 4; +} + +/* +InnerSpec contains all store-specific structure info to determine if two proofs from a +given store are neighbors. + +This enables: + + isLeftMost(spec: InnerSpec, op: InnerOp) + isRightMost(spec: InnerSpec, op: InnerOp) + isLeftNeighbor(spec: InnerSpec, left: InnerOp, right: InnerOp) +*/ +message InnerSpec { + // Child order is the ordering of the children node, must count from 0 + // iavl tree is [0, 1] (left then right) + // merk is [0, 2, 1] (left, right, here) + repeated int32 child_order = 1; + int32 child_size = 2; + int32 min_prefix_length = 3; + int32 max_prefix_length = 4; + // empty child is the prehash image that is used when one child is nil (eg. 20 bytes of 0) + bytes empty_child = 5; + // hash is the algorithm that must be used for each InnerOp + HashOp hash = 6; +} + +/* +BatchProof is a group of multiple proof types than can be compressed +*/ +message BatchProof { + repeated BatchEntry entries = 1; +} + +// Use BatchEntry not CommitmentProof, to avoid recursion +message BatchEntry { + oneof proof { + ExistenceProof exist = 1; + NonExistenceProof nonexist = 2; + } +} + + +/****** all items here are compressed forms *******/ + +message CompressedBatchProof { + repeated CompressedBatchEntry entries = 1; + repeated InnerOp lookup_inners = 2; +} + +// Use BatchEntry not CommitmentProof, to avoid recursion +message CompressedBatchEntry { + oneof proof { + CompressedExistenceProof exist = 1; + CompressedNonExistenceProof nonexist = 2; + } +} + +message CompressedExistenceProof { + bytes key = 1; + bytes value = 2; + LeafOp leaf = 3; + // these are indexes into the lookup_inners table in CompressedBatchProof + repeated int32 path = 4; +} + +message CompressedNonExistenceProof { + bytes key = 1; // TODO: remove this as unnecessary??? we prove a range + CompressedExistenceProof left = 2; + CompressedExistenceProof right = 3; +} diff --git a/packages/cosmic-proto/src/codegen/cosmos/authz/v1beta1/authz.ts b/packages/cosmic-proto/src/codegen/cosmos/authz/v1beta1/authz.ts index edd0f19a161..c2e3a1e0d34 100644 --- a/packages/cosmic-proto/src/codegen/cosmos/authz/v1beta1/authz.ts +++ b/packages/cosmic-proto/src/codegen/cosmos/authz/v1beta1/authz.ts @@ -9,6 +9,10 @@ import { StakeAuthorization, StakeAuthorizationSDKType, } from '../../staking/v1beta1/authz.js'; +import { + TransferAuthorization, + TransferAuthorizationSDKType, +} from '../../../ibc/applications/transfer/v1/authz.js'; import { BinaryReader, BinaryWriter } from '../../../binary.js'; import { isSet, @@ -43,7 +47,11 @@ export interface GenericAuthorizationSDKType { */ export interface Grant { authorization?: - | (GenericAuthorization & SendAuthorization & StakeAuthorization & Any) + | (GenericAuthorization & + SendAuthorization & + StakeAuthorization & + TransferAuthorization & + Any) | undefined; /** * time when the grant will expire and will be pruned. If null, then the grant @@ -65,6 +73,7 @@ export interface GrantSDKType { | GenericAuthorizationSDKType | SendAuthorizationSDKType | StakeAuthorizationSDKType + | TransferAuthorizationSDKType | AnySDKType | undefined; expiration?: Date; @@ -77,7 +86,11 @@ export interface GrantAuthorization { granter: string; grantee: string; authorization?: - | (GenericAuthorization & SendAuthorization & StakeAuthorization & Any) + | (GenericAuthorization & + SendAuthorization & + StakeAuthorization & + TransferAuthorization & + Any) | undefined; expiration?: Date; } @@ -96,6 +109,7 @@ export interface GrantAuthorizationSDKType { | GenericAuthorizationSDKType | SendAuthorizationSDKType | StakeAuthorizationSDKType + | TransferAuthorizationSDKType | AnySDKType | undefined; expiration?: Date; @@ -454,7 +468,12 @@ export const GrantQueueItem = { }; export const Authorization_InterfaceDecoder = ( input: BinaryReader | Uint8Array, -): GenericAuthorization | SendAuthorization | StakeAuthorization | Any => { +): + | GenericAuthorization + | SendAuthorization + | StakeAuthorization + | TransferAuthorization + | Any => { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const data = Any.decode(reader, reader.uint32()); @@ -465,6 +484,8 @@ export const Authorization_InterfaceDecoder = ( return SendAuthorization.decode(data.value); case '/cosmos.staking.v1beta1.StakeAuthorization': return StakeAuthorization.decode(data.value); + case '/ibc.applications.transfer.v1.TransferAuthorization': + return TransferAuthorization.decode(data.value); default: return data; } diff --git a/packages/cosmic-proto/src/codegen/ibc/applications/interchain_accounts/controller/v1/controller.ts b/packages/cosmic-proto/src/codegen/ibc/applications/interchain_accounts/controller/v1/controller.ts new file mode 100644 index 00000000000..502927fac83 --- /dev/null +++ b/packages/cosmic-proto/src/codegen/ibc/applications/interchain_accounts/controller/v1/controller.ts @@ -0,0 +1,87 @@ +//@ts-nocheck +import { BinaryReader, BinaryWriter } from '../../../../../binary.js'; +import { isSet } from '../../../../../helpers.js'; +/** + * Params defines the set of on-chain interchain accounts parameters. + * The following parameters may be used to disable the controller submodule. + */ +export interface Params { + /** controller_enabled enables or disables the controller submodule. */ + controllerEnabled: boolean; +} +export interface ParamsProtoMsg { + typeUrl: '/ibc.applications.interchain_accounts.controller.v1.Params'; + value: Uint8Array; +} +/** + * Params defines the set of on-chain interchain accounts parameters. + * The following parameters may be used to disable the controller submodule. + */ +export interface ParamsSDKType { + controller_enabled: boolean; +} +function createBaseParams(): Params { + return { + controllerEnabled: false, + }; +} +export const Params = { + typeUrl: '/ibc.applications.interchain_accounts.controller.v1.Params', + encode( + message: Params, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.controllerEnabled === true) { + writer.uint32(8).bool(message.controllerEnabled); + } + return writer; + }, + 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 = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.controllerEnabled = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): Params { + return { + controllerEnabled: isSet(object.controllerEnabled) + ? Boolean(object.controllerEnabled) + : false, + }; + }, + toJSON(message: Params): unknown { + const obj: any = {}; + message.controllerEnabled !== undefined && + (obj.controllerEnabled = message.controllerEnabled); + return obj; + }, + fromPartial(object: Partial): Params { + const message = createBaseParams(); + message.controllerEnabled = object.controllerEnabled ?? false; + return message; + }, + fromProtoMsg(message: ParamsProtoMsg): Params { + return Params.decode(message.value); + }, + toProto(message: Params): Uint8Array { + return Params.encode(message).finish(); + }, + toProtoMsg(message: Params): ParamsProtoMsg { + return { + typeUrl: '/ibc.applications.interchain_accounts.controller.v1.Params', + value: Params.encode(message).finish(), + }; + }, +}; diff --git a/packages/cosmic-proto/src/codegen/ibc/applications/interchain_accounts/controller/v1/query.ts b/packages/cosmic-proto/src/codegen/ibc/applications/interchain_accounts/controller/v1/query.ts new file mode 100644 index 00000000000..3a073d47015 --- /dev/null +++ b/packages/cosmic-proto/src/codegen/ibc/applications/interchain_accounts/controller/v1/query.ts @@ -0,0 +1,336 @@ +//@ts-nocheck +import { Params, ParamsSDKType } from './controller.js'; +import { BinaryReader, BinaryWriter } from '../../../../../binary.js'; +import { isSet } from '../../../../../helpers.js'; +/** QueryInterchainAccountRequest is the request type for the Query/InterchainAccount RPC method. */ +export interface QueryInterchainAccountRequest { + owner: string; + connectionId: string; +} +export interface QueryInterchainAccountRequestProtoMsg { + typeUrl: '/ibc.applications.interchain_accounts.controller.v1.QueryInterchainAccountRequest'; + value: Uint8Array; +} +/** QueryInterchainAccountRequest is the request type for the Query/InterchainAccount RPC method. */ +export interface QueryInterchainAccountRequestSDKType { + owner: string; + connection_id: string; +} +/** QueryInterchainAccountResponse the response type for the Query/InterchainAccount RPC method. */ +export interface QueryInterchainAccountResponse { + address: string; +} +export interface QueryInterchainAccountResponseProtoMsg { + typeUrl: '/ibc.applications.interchain_accounts.controller.v1.QueryInterchainAccountResponse'; + value: Uint8Array; +} +/** QueryInterchainAccountResponse the response type for the Query/InterchainAccount RPC method. */ +export interface QueryInterchainAccountResponseSDKType { + address: string; +} +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequest {} +export interface QueryParamsRequestProtoMsg { + typeUrl: '/ibc.applications.interchain_accounts.controller.v1.QueryParamsRequest'; + value: Uint8Array; +} +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequestSDKType {} +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponse { + /** params defines the parameters of the module. */ + params?: Params; +} +export interface QueryParamsResponseProtoMsg { + typeUrl: '/ibc.applications.interchain_accounts.controller.v1.QueryParamsResponse'; + value: Uint8Array; +} +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponseSDKType { + params?: ParamsSDKType; +} +function createBaseQueryInterchainAccountRequest(): QueryInterchainAccountRequest { + return { + owner: '', + connectionId: '', + }; +} +export const QueryInterchainAccountRequest = { + typeUrl: + '/ibc.applications.interchain_accounts.controller.v1.QueryInterchainAccountRequest', + encode( + message: QueryInterchainAccountRequest, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.owner !== '') { + writer.uint32(10).string(message.owner); + } + if (message.connectionId !== '') { + writer.uint32(18).string(message.connectionId); + } + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): QueryInterchainAccountRequest { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryInterchainAccountRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.owner = reader.string(); + break; + case 2: + message.connectionId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryInterchainAccountRequest { + return { + owner: isSet(object.owner) ? String(object.owner) : '', + connectionId: isSet(object.connectionId) + ? String(object.connectionId) + : '', + }; + }, + toJSON(message: QueryInterchainAccountRequest): unknown { + const obj: any = {}; + message.owner !== undefined && (obj.owner = message.owner); + message.connectionId !== undefined && + (obj.connectionId = message.connectionId); + return obj; + }, + fromPartial( + object: Partial, + ): QueryInterchainAccountRequest { + const message = createBaseQueryInterchainAccountRequest(); + message.owner = object.owner ?? ''; + message.connectionId = object.connectionId ?? ''; + return message; + }, + fromProtoMsg( + message: QueryInterchainAccountRequestProtoMsg, + ): QueryInterchainAccountRequest { + return QueryInterchainAccountRequest.decode(message.value); + }, + toProto(message: QueryInterchainAccountRequest): Uint8Array { + return QueryInterchainAccountRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryInterchainAccountRequest, + ): QueryInterchainAccountRequestProtoMsg { + return { + typeUrl: + '/ibc.applications.interchain_accounts.controller.v1.QueryInterchainAccountRequest', + value: QueryInterchainAccountRequest.encode(message).finish(), + }; + }, +}; +function createBaseQueryInterchainAccountResponse(): QueryInterchainAccountResponse { + return { + address: '', + }; +} +export const QueryInterchainAccountResponse = { + typeUrl: + '/ibc.applications.interchain_accounts.controller.v1.QueryInterchainAccountResponse', + encode( + message: QueryInterchainAccountResponse, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.address !== '') { + writer.uint32(10).string(message.address); + } + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): QueryInterchainAccountResponse { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryInterchainAccountResponse(); + 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): QueryInterchainAccountResponse { + return { + address: isSet(object.address) ? String(object.address) : '', + }; + }, + toJSON(message: QueryInterchainAccountResponse): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + return obj; + }, + fromPartial( + object: Partial, + ): QueryInterchainAccountResponse { + const message = createBaseQueryInterchainAccountResponse(); + message.address = object.address ?? ''; + return message; + }, + fromProtoMsg( + message: QueryInterchainAccountResponseProtoMsg, + ): QueryInterchainAccountResponse { + return QueryInterchainAccountResponse.decode(message.value); + }, + toProto(message: QueryInterchainAccountResponse): Uint8Array { + return QueryInterchainAccountResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryInterchainAccountResponse, + ): QueryInterchainAccountResponseProtoMsg { + return { + typeUrl: + '/ibc.applications.interchain_accounts.controller.v1.QueryInterchainAccountResponse', + value: QueryInterchainAccountResponse.encode(message).finish(), + }; + }, +}; +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} +export const QueryParamsRequest = { + typeUrl: + '/ibc.applications.interchain_accounts.controller.v1.QueryParamsRequest', + encode( + _: QueryParamsRequest, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + return writer; + }, + 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 = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + fromPartial(_: Partial): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, + fromProtoMsg(message: QueryParamsRequestProtoMsg): QueryParamsRequest { + return QueryParamsRequest.decode(message.value); + }, + toProto(message: QueryParamsRequest): Uint8Array { + return QueryParamsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsRequest): QueryParamsRequestProtoMsg { + return { + typeUrl: + '/ibc.applications.interchain_accounts.controller.v1.QueryParamsRequest', + value: QueryParamsRequest.encode(message).finish(), + }; + }, +}; +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { + params: undefined, + }; +} +export const QueryParamsResponse = { + typeUrl: + '/ibc.applications.interchain_accounts.controller.v1.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, + ): QueryParamsResponse { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryParamsResponse { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + message.params !== undefined && + (obj.params = message.params ? Params.toJSON(message.params) : undefined); + return obj; + }, + fromPartial(object: Partial): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = + object.params !== undefined && object.params !== null + ? Params.fromPartial(object.params) + : undefined; + return message; + }, + fromProtoMsg(message: QueryParamsResponseProtoMsg): QueryParamsResponse { + return QueryParamsResponse.decode(message.value); + }, + toProto(message: QueryParamsResponse): Uint8Array { + return QueryParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsResponse): QueryParamsResponseProtoMsg { + return { + typeUrl: + '/ibc.applications.interchain_accounts.controller.v1.QueryParamsResponse', + value: QueryParamsResponse.encode(message).finish(), + }; + }, +}; diff --git a/packages/cosmic-proto/src/codegen/ibc/applications/interchain_accounts/controller/v1/tx.ts b/packages/cosmic-proto/src/codegen/ibc/applications/interchain_accounts/controller/v1/tx.ts new file mode 100644 index 00000000000..4f3a28a2413 --- /dev/null +++ b/packages/cosmic-proto/src/codegen/ibc/applications/interchain_accounts/controller/v1/tx.ts @@ -0,0 +1,423 @@ +//@ts-nocheck +import { + InterchainAccountPacketData, + InterchainAccountPacketDataSDKType, +} from '../../v1/packet.js'; +import { BinaryReader, BinaryWriter } from '../../../../../binary.js'; +import { isSet } from '../../../../../helpers.js'; +/** MsgRegisterInterchainAccount defines the payload for Msg/MsgRegisterInterchainAccount */ +export interface MsgRegisterInterchainAccount { + owner: string; + connectionId: string; + version: string; +} +export interface MsgRegisterInterchainAccountProtoMsg { + typeUrl: '/ibc.applications.interchain_accounts.controller.v1.MsgRegisterInterchainAccount'; + value: Uint8Array; +} +/** MsgRegisterInterchainAccount defines the payload for Msg/MsgRegisterInterchainAccount */ +export interface MsgRegisterInterchainAccountSDKType { + owner: string; + connection_id: string; + version: string; +} +/** MsgRegisterInterchainAccountResponse defines the response for Msg/MsgRegisterInterchainAccountResponse */ +export interface MsgRegisterInterchainAccountResponse { + channelId: string; +} +export interface MsgRegisterInterchainAccountResponseProtoMsg { + typeUrl: '/ibc.applications.interchain_accounts.controller.v1.MsgRegisterInterchainAccountResponse'; + value: Uint8Array; +} +/** MsgRegisterInterchainAccountResponse defines the response for Msg/MsgRegisterInterchainAccountResponse */ +export interface MsgRegisterInterchainAccountResponseSDKType { + channel_id: string; +} +/** MsgSendTx defines the payload for Msg/SendTx */ +export interface MsgSendTx { + owner: string; + connectionId: string; + packetData: InterchainAccountPacketData; + /** + * Relative timeout timestamp provided will be added to the current block time during transaction execution. + * The timeout timestamp must be non-zero. + */ + relativeTimeout: bigint; +} +export interface MsgSendTxProtoMsg { + typeUrl: '/ibc.applications.interchain_accounts.controller.v1.MsgSendTx'; + value: Uint8Array; +} +/** MsgSendTx defines the payload for Msg/SendTx */ +export interface MsgSendTxSDKType { + owner: string; + connection_id: string; + packet_data: InterchainAccountPacketDataSDKType; + relative_timeout: bigint; +} +/** MsgSendTxResponse defines the response for MsgSendTx */ +export interface MsgSendTxResponse { + sequence: bigint; +} +export interface MsgSendTxResponseProtoMsg { + typeUrl: '/ibc.applications.interchain_accounts.controller.v1.MsgSendTxResponse'; + value: Uint8Array; +} +/** MsgSendTxResponse defines the response for MsgSendTx */ +export interface MsgSendTxResponseSDKType { + sequence: bigint; +} +function createBaseMsgRegisterInterchainAccount(): MsgRegisterInterchainAccount { + return { + owner: '', + connectionId: '', + version: '', + }; +} +export const MsgRegisterInterchainAccount = { + typeUrl: + '/ibc.applications.interchain_accounts.controller.v1.MsgRegisterInterchainAccount', + encode( + message: MsgRegisterInterchainAccount, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.owner !== '') { + writer.uint32(10).string(message.owner); + } + if (message.connectionId !== '') { + writer.uint32(18).string(message.connectionId); + } + if (message.version !== '') { + writer.uint32(26).string(message.version); + } + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): MsgRegisterInterchainAccount { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterInterchainAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.owner = reader.string(); + break; + case 2: + message.connectionId = reader.string(); + break; + case 3: + message.version = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgRegisterInterchainAccount { + return { + owner: isSet(object.owner) ? String(object.owner) : '', + connectionId: isSet(object.connectionId) + ? String(object.connectionId) + : '', + version: isSet(object.version) ? String(object.version) : '', + }; + }, + toJSON(message: MsgRegisterInterchainAccount): unknown { + const obj: any = {}; + message.owner !== undefined && (obj.owner = message.owner); + message.connectionId !== undefined && + (obj.connectionId = message.connectionId); + message.version !== undefined && (obj.version = message.version); + return obj; + }, + fromPartial( + object: Partial, + ): MsgRegisterInterchainAccount { + const message = createBaseMsgRegisterInterchainAccount(); + message.owner = object.owner ?? ''; + message.connectionId = object.connectionId ?? ''; + message.version = object.version ?? ''; + return message; + }, + fromProtoMsg( + message: MsgRegisterInterchainAccountProtoMsg, + ): MsgRegisterInterchainAccount { + return MsgRegisterInterchainAccount.decode(message.value); + }, + toProto(message: MsgRegisterInterchainAccount): Uint8Array { + return MsgRegisterInterchainAccount.encode(message).finish(); + }, + toProtoMsg( + message: MsgRegisterInterchainAccount, + ): MsgRegisterInterchainAccountProtoMsg { + return { + typeUrl: + '/ibc.applications.interchain_accounts.controller.v1.MsgRegisterInterchainAccount', + value: MsgRegisterInterchainAccount.encode(message).finish(), + }; + }, +}; +function createBaseMsgRegisterInterchainAccountResponse(): MsgRegisterInterchainAccountResponse { + return { + channelId: '', + }; +} +export const MsgRegisterInterchainAccountResponse = { + typeUrl: + '/ibc.applications.interchain_accounts.controller.v1.MsgRegisterInterchainAccountResponse', + encode( + message: MsgRegisterInterchainAccountResponse, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.channelId !== '') { + writer.uint32(10).string(message.channelId); + } + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): MsgRegisterInterchainAccountResponse { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterInterchainAccountResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.channelId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgRegisterInterchainAccountResponse { + return { + channelId: isSet(object.channelId) ? String(object.channelId) : '', + }; + }, + toJSON(message: MsgRegisterInterchainAccountResponse): unknown { + const obj: any = {}; + message.channelId !== undefined && (obj.channelId = message.channelId); + return obj; + }, + fromPartial( + object: Partial, + ): MsgRegisterInterchainAccountResponse { + const message = createBaseMsgRegisterInterchainAccountResponse(); + message.channelId = object.channelId ?? ''; + return message; + }, + fromProtoMsg( + message: MsgRegisterInterchainAccountResponseProtoMsg, + ): MsgRegisterInterchainAccountResponse { + return MsgRegisterInterchainAccountResponse.decode(message.value); + }, + toProto(message: MsgRegisterInterchainAccountResponse): Uint8Array { + return MsgRegisterInterchainAccountResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgRegisterInterchainAccountResponse, + ): MsgRegisterInterchainAccountResponseProtoMsg { + return { + typeUrl: + '/ibc.applications.interchain_accounts.controller.v1.MsgRegisterInterchainAccountResponse', + value: MsgRegisterInterchainAccountResponse.encode(message).finish(), + }; + }, +}; +function createBaseMsgSendTx(): MsgSendTx { + return { + owner: '', + connectionId: '', + packetData: InterchainAccountPacketData.fromPartial({}), + relativeTimeout: BigInt(0), + }; +} +export const MsgSendTx = { + typeUrl: '/ibc.applications.interchain_accounts.controller.v1.MsgSendTx', + encode( + message: MsgSendTx, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.owner !== '') { + writer.uint32(10).string(message.owner); + } + if (message.connectionId !== '') { + writer.uint32(18).string(message.connectionId); + } + if (message.packetData !== undefined) { + InterchainAccountPacketData.encode( + message.packetData, + writer.uint32(26).fork(), + ).ldelim(); + } + if (message.relativeTimeout !== BigInt(0)) { + writer.uint32(32).uint64(message.relativeTimeout); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendTx { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.owner = reader.string(); + break; + case 2: + message.connectionId = reader.string(); + break; + case 3: + message.packetData = InterchainAccountPacketData.decode( + reader, + reader.uint32(), + ); + break; + case 4: + message.relativeTimeout = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgSendTx { + return { + owner: isSet(object.owner) ? String(object.owner) : '', + connectionId: isSet(object.connectionId) + ? String(object.connectionId) + : '', + packetData: isSet(object.packetData) + ? InterchainAccountPacketData.fromJSON(object.packetData) + : undefined, + relativeTimeout: isSet(object.relativeTimeout) + ? BigInt(object.relativeTimeout.toString()) + : BigInt(0), + }; + }, + toJSON(message: MsgSendTx): unknown { + const obj: any = {}; + message.owner !== undefined && (obj.owner = message.owner); + message.connectionId !== undefined && + (obj.connectionId = message.connectionId); + message.packetData !== undefined && + (obj.packetData = message.packetData + ? InterchainAccountPacketData.toJSON(message.packetData) + : undefined); + message.relativeTimeout !== undefined && + (obj.relativeTimeout = (message.relativeTimeout || BigInt(0)).toString()); + return obj; + }, + fromPartial(object: Partial): MsgSendTx { + const message = createBaseMsgSendTx(); + message.owner = object.owner ?? ''; + message.connectionId = object.connectionId ?? ''; + message.packetData = + object.packetData !== undefined && object.packetData !== null + ? InterchainAccountPacketData.fromPartial(object.packetData) + : undefined; + message.relativeTimeout = + object.relativeTimeout !== undefined && object.relativeTimeout !== null + ? BigInt(object.relativeTimeout.toString()) + : BigInt(0); + return message; + }, + fromProtoMsg(message: MsgSendTxProtoMsg): MsgSendTx { + return MsgSendTx.decode(message.value); + }, + toProto(message: MsgSendTx): Uint8Array { + return MsgSendTx.encode(message).finish(); + }, + toProtoMsg(message: MsgSendTx): MsgSendTxProtoMsg { + return { + typeUrl: '/ibc.applications.interchain_accounts.controller.v1.MsgSendTx', + value: MsgSendTx.encode(message).finish(), + }; + }, +}; +function createBaseMsgSendTxResponse(): MsgSendTxResponse { + return { + sequence: BigInt(0), + }; +} +export const MsgSendTxResponse = { + typeUrl: + '/ibc.applications.interchain_accounts.controller.v1.MsgSendTxResponse', + encode( + message: MsgSendTxResponse, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.sequence !== BigInt(0)) { + writer.uint32(8).uint64(message.sequence); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendTxResponse { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendTxResponse(); + 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): MsgSendTxResponse { + return { + sequence: isSet(object.sequence) + ? BigInt(object.sequence.toString()) + : BigInt(0), + }; + }, + toJSON(message: MsgSendTxResponse): unknown { + const obj: any = {}; + message.sequence !== undefined && + (obj.sequence = (message.sequence || BigInt(0)).toString()); + return obj; + }, + fromPartial(object: Partial): MsgSendTxResponse { + const message = createBaseMsgSendTxResponse(); + message.sequence = + object.sequence !== undefined && object.sequence !== null + ? BigInt(object.sequence.toString()) + : BigInt(0); + return message; + }, + fromProtoMsg(message: MsgSendTxResponseProtoMsg): MsgSendTxResponse { + return MsgSendTxResponse.decode(message.value); + }, + toProto(message: MsgSendTxResponse): Uint8Array { + return MsgSendTxResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgSendTxResponse): MsgSendTxResponseProtoMsg { + return { + typeUrl: + '/ibc.applications.interchain_accounts.controller.v1.MsgSendTxResponse', + value: MsgSendTxResponse.encode(message).finish(), + }; + }, +}; diff --git a/packages/cosmic-proto/src/codegen/ibc/applications/interchain_accounts/genesis/v1/genesis.ts b/packages/cosmic-proto/src/codegen/ibc/applications/interchain_accounts/genesis/v1/genesis.ts new file mode 100644 index 00000000000..bedfda490cf --- /dev/null +++ b/packages/cosmic-proto/src/codegen/ibc/applications/interchain_accounts/genesis/v1/genesis.ts @@ -0,0 +1,661 @@ +//@ts-nocheck +import { Params as Params1 } from '../../controller/v1/controller.js'; +import { ParamsSDKType as Params1SDKType } from '../../controller/v1/controller.js'; +import { Params as Params2 } from '../../host/v1/host.js'; +import { ParamsSDKType as Params2SDKType } from '../../host/v1/host.js'; +import { BinaryReader, BinaryWriter } from '../../../../../binary.js'; +import { isSet } from '../../../../../helpers.js'; +/** GenesisState defines the interchain accounts genesis state */ +export interface GenesisState { + controllerGenesisState: ControllerGenesisState; + hostGenesisState: HostGenesisState; +} +export interface GenesisStateProtoMsg { + typeUrl: '/ibc.applications.interchain_accounts.genesis.v1.GenesisState'; + value: Uint8Array; +} +/** GenesisState defines the interchain accounts genesis state */ +export interface GenesisStateSDKType { + controller_genesis_state: ControllerGenesisStateSDKType; + host_genesis_state: HostGenesisStateSDKType; +} +/** ControllerGenesisState defines the interchain accounts controller genesis state */ +export interface ControllerGenesisState { + activeChannels: ActiveChannel[]; + interchainAccounts: RegisteredInterchainAccount[]; + ports: string[]; + params: Params1; +} +export interface ControllerGenesisStateProtoMsg { + typeUrl: '/ibc.applications.interchain_accounts.genesis.v1.ControllerGenesisState'; + value: Uint8Array; +} +/** ControllerGenesisState defines the interchain accounts controller genesis state */ +export interface ControllerGenesisStateSDKType { + active_channels: ActiveChannelSDKType[]; + interchain_accounts: RegisteredInterchainAccountSDKType[]; + ports: string[]; + params: Params1SDKType; +} +/** HostGenesisState defines the interchain accounts host genesis state */ +export interface HostGenesisState { + activeChannels: ActiveChannel[]; + interchainAccounts: RegisteredInterchainAccount[]; + port: string; + params: Params2; +} +export interface HostGenesisStateProtoMsg { + typeUrl: '/ibc.applications.interchain_accounts.genesis.v1.HostGenesisState'; + value: Uint8Array; +} +/** HostGenesisState defines the interchain accounts host genesis state */ +export interface HostGenesisStateSDKType { + active_channels: ActiveChannelSDKType[]; + interchain_accounts: RegisteredInterchainAccountSDKType[]; + port: string; + params: Params2SDKType; +} +/** + * 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 + */ +export interface ActiveChannel { + connectionId: string; + portId: string; + channelId: string; + isMiddlewareEnabled: boolean; +} +export interface ActiveChannelProtoMsg { + typeUrl: '/ibc.applications.interchain_accounts.genesis.v1.ActiveChannel'; + value: Uint8Array; +} +/** + * 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 + */ +export interface ActiveChannelSDKType { + connection_id: string; + port_id: string; + channel_id: string; + is_middleware_enabled: boolean; +} +/** RegisteredInterchainAccount contains a connection ID, port ID and associated interchain account address */ +export interface RegisteredInterchainAccount { + connectionId: string; + portId: string; + accountAddress: string; +} +export interface RegisteredInterchainAccountProtoMsg { + typeUrl: '/ibc.applications.interchain_accounts.genesis.v1.RegisteredInterchainAccount'; + value: Uint8Array; +} +/** RegisteredInterchainAccount contains a connection ID, port ID and associated interchain account address */ +export interface RegisteredInterchainAccountSDKType { + connection_id: string; + port_id: string; + account_address: string; +} +function createBaseGenesisState(): GenesisState { + return { + controllerGenesisState: ControllerGenesisState.fromPartial({}), + hostGenesisState: HostGenesisState.fromPartial({}), + }; +} +export const GenesisState = { + typeUrl: '/ibc.applications.interchain_accounts.genesis.v1.GenesisState', + encode( + message: GenesisState, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.controllerGenesisState !== undefined) { + ControllerGenesisState.encode( + message.controllerGenesisState, + writer.uint32(10).fork(), + ).ldelim(); + } + if (message.hostGenesisState !== undefined) { + HostGenesisState.encode( + message.hostGenesisState, + writer.uint32(18).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.controllerGenesisState = ControllerGenesisState.decode( + reader, + reader.uint32(), + ); + break; + case 2: + message.hostGenesisState = HostGenesisState.decode( + reader, + reader.uint32(), + ); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): GenesisState { + return { + controllerGenesisState: isSet(object.controllerGenesisState) + ? ControllerGenesisState.fromJSON(object.controllerGenesisState) + : undefined, + hostGenesisState: isSet(object.hostGenesisState) + ? HostGenesisState.fromJSON(object.hostGenesisState) + : undefined, + }; + }, + toJSON(message: GenesisState): unknown { + const obj: any = {}; + message.controllerGenesisState !== undefined && + (obj.controllerGenesisState = message.controllerGenesisState + ? ControllerGenesisState.toJSON(message.controllerGenesisState) + : undefined); + message.hostGenesisState !== undefined && + (obj.hostGenesisState = message.hostGenesisState + ? HostGenesisState.toJSON(message.hostGenesisState) + : undefined); + return obj; + }, + fromPartial(object: Partial): GenesisState { + const message = createBaseGenesisState(); + message.controllerGenesisState = + object.controllerGenesisState !== undefined && + object.controllerGenesisState !== null + ? ControllerGenesisState.fromPartial(object.controllerGenesisState) + : undefined; + message.hostGenesisState = + object.hostGenesisState !== undefined && object.hostGenesisState !== null + ? HostGenesisState.fromPartial(object.hostGenesisState) + : undefined; + return message; + }, + fromProtoMsg(message: GenesisStateProtoMsg): GenesisState { + return GenesisState.decode(message.value); + }, + toProto(message: GenesisState): Uint8Array { + return GenesisState.encode(message).finish(); + }, + toProtoMsg(message: GenesisState): GenesisStateProtoMsg { + return { + typeUrl: '/ibc.applications.interchain_accounts.genesis.v1.GenesisState', + value: GenesisState.encode(message).finish(), + }; + }, +}; +function createBaseControllerGenesisState(): ControllerGenesisState { + return { + activeChannels: [], + interchainAccounts: [], + ports: [], + params: Params1.fromPartial({}), + }; +} +export const ControllerGenesisState = { + typeUrl: + '/ibc.applications.interchain_accounts.genesis.v1.ControllerGenesisState', + encode( + message: ControllerGenesisState, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + for (const v of message.activeChannels) { + ActiveChannel.encode(v!, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.interchainAccounts) { + RegisteredInterchainAccount.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.ports) { + writer.uint32(26).string(v!); + } + if (message.params !== undefined) { + Params1.encode(message.params, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): ControllerGenesisState { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseControllerGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.activeChannels.push( + ActiveChannel.decode(reader, reader.uint32()), + ); + break; + case 2: + message.interchainAccounts.push( + RegisteredInterchainAccount.decode(reader, reader.uint32()), + ); + break; + case 3: + message.ports.push(reader.string()); + break; + case 4: + message.params = Params1.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): ControllerGenesisState { + return { + activeChannels: Array.isArray(object?.activeChannels) + ? object.activeChannels.map((e: any) => ActiveChannel.fromJSON(e)) + : [], + interchainAccounts: Array.isArray(object?.interchainAccounts) + ? object.interchainAccounts.map((e: any) => + RegisteredInterchainAccount.fromJSON(e), + ) + : [], + ports: Array.isArray(object?.ports) + ? object.ports.map((e: any) => String(e)) + : [], + params: isSet(object.params) + ? Params1.fromJSON(object.params) + : undefined, + }; + }, + toJSON(message: ControllerGenesisState): unknown { + const obj: any = {}; + if (message.activeChannels) { + obj.activeChannels = message.activeChannels.map(e => + e ? ActiveChannel.toJSON(e) : undefined, + ); + } else { + obj.activeChannels = []; + } + if (message.interchainAccounts) { + obj.interchainAccounts = message.interchainAccounts.map(e => + e ? RegisteredInterchainAccount.toJSON(e) : undefined, + ); + } else { + obj.interchainAccounts = []; + } + if (message.ports) { + obj.ports = message.ports.map(e => e); + } else { + obj.ports = []; + } + message.params !== undefined && + (obj.params = message.params + ? Params1.toJSON(message.params) + : undefined); + return obj; + }, + fromPartial(object: Partial): ControllerGenesisState { + const message = createBaseControllerGenesisState(); + message.activeChannels = + object.activeChannels?.map(e => ActiveChannel.fromPartial(e)) || []; + message.interchainAccounts = + object.interchainAccounts?.map(e => + RegisteredInterchainAccount.fromPartial(e), + ) || []; + message.ports = object.ports?.map(e => e) || []; + message.params = + object.params !== undefined && object.params !== null + ? Params1.fromPartial(object.params) + : undefined; + return message; + }, + fromProtoMsg( + message: ControllerGenesisStateProtoMsg, + ): ControllerGenesisState { + return ControllerGenesisState.decode(message.value); + }, + toProto(message: ControllerGenesisState): Uint8Array { + return ControllerGenesisState.encode(message).finish(); + }, + toProtoMsg(message: ControllerGenesisState): ControllerGenesisStateProtoMsg { + return { + typeUrl: + '/ibc.applications.interchain_accounts.genesis.v1.ControllerGenesisState', + value: ControllerGenesisState.encode(message).finish(), + }; + }, +}; +function createBaseHostGenesisState(): HostGenesisState { + return { + activeChannels: [], + interchainAccounts: [], + port: '', + params: Params2.fromPartial({}), + }; +} +export const HostGenesisState = { + typeUrl: '/ibc.applications.interchain_accounts.genesis.v1.HostGenesisState', + encode( + message: HostGenesisState, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + for (const v of message.activeChannels) { + ActiveChannel.encode(v!, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.interchainAccounts) { + RegisteredInterchainAccount.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.port !== '') { + writer.uint32(26).string(message.port); + } + if (message.params !== undefined) { + Params2.encode(message.params, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): HostGenesisState { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHostGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.activeChannels.push( + ActiveChannel.decode(reader, reader.uint32()), + ); + break; + case 2: + message.interchainAccounts.push( + RegisteredInterchainAccount.decode(reader, reader.uint32()), + ); + break; + case 3: + message.port = reader.string(); + break; + case 4: + message.params = Params2.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): HostGenesisState { + return { + activeChannels: Array.isArray(object?.activeChannels) + ? object.activeChannels.map((e: any) => ActiveChannel.fromJSON(e)) + : [], + interchainAccounts: Array.isArray(object?.interchainAccounts) + ? object.interchainAccounts.map((e: any) => + RegisteredInterchainAccount.fromJSON(e), + ) + : [], + port: isSet(object.port) ? String(object.port) : '', + params: isSet(object.params) + ? Params2.fromJSON(object.params) + : undefined, + }; + }, + toJSON(message: HostGenesisState): unknown { + const obj: any = {}; + if (message.activeChannels) { + obj.activeChannels = message.activeChannels.map(e => + e ? ActiveChannel.toJSON(e) : undefined, + ); + } else { + obj.activeChannels = []; + } + if (message.interchainAccounts) { + obj.interchainAccounts = message.interchainAccounts.map(e => + e ? RegisteredInterchainAccount.toJSON(e) : undefined, + ); + } else { + obj.interchainAccounts = []; + } + message.port !== undefined && (obj.port = message.port); + message.params !== undefined && + (obj.params = message.params + ? Params2.toJSON(message.params) + : undefined); + return obj; + }, + fromPartial(object: Partial): HostGenesisState { + const message = createBaseHostGenesisState(); + message.activeChannels = + object.activeChannels?.map(e => ActiveChannel.fromPartial(e)) || []; + message.interchainAccounts = + object.interchainAccounts?.map(e => + RegisteredInterchainAccount.fromPartial(e), + ) || []; + message.port = object.port ?? ''; + message.params = + object.params !== undefined && object.params !== null + ? Params2.fromPartial(object.params) + : undefined; + return message; + }, + fromProtoMsg(message: HostGenesisStateProtoMsg): HostGenesisState { + return HostGenesisState.decode(message.value); + }, + toProto(message: HostGenesisState): Uint8Array { + return HostGenesisState.encode(message).finish(); + }, + toProtoMsg(message: HostGenesisState): HostGenesisStateProtoMsg { + return { + typeUrl: + '/ibc.applications.interchain_accounts.genesis.v1.HostGenesisState', + value: HostGenesisState.encode(message).finish(), + }; + }, +}; +function createBaseActiveChannel(): ActiveChannel { + return { + connectionId: '', + portId: '', + channelId: '', + isMiddlewareEnabled: false, + }; +} +export const ActiveChannel = { + typeUrl: '/ibc.applications.interchain_accounts.genesis.v1.ActiveChannel', + encode( + message: ActiveChannel, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.connectionId !== '') { + writer.uint32(10).string(message.connectionId); + } + if (message.portId !== '') { + writer.uint32(18).string(message.portId); + } + if (message.channelId !== '') { + writer.uint32(26).string(message.channelId); + } + if (message.isMiddlewareEnabled === true) { + writer.uint32(32).bool(message.isMiddlewareEnabled); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ActiveChannel { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActiveChannel(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.connectionId = reader.string(); + break; + case 2: + message.portId = reader.string(); + break; + case 3: + message.channelId = reader.string(); + break; + case 4: + message.isMiddlewareEnabled = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): ActiveChannel { + return { + connectionId: isSet(object.connectionId) + ? String(object.connectionId) + : '', + portId: isSet(object.portId) ? String(object.portId) : '', + channelId: isSet(object.channelId) ? String(object.channelId) : '', + isMiddlewareEnabled: isSet(object.isMiddlewareEnabled) + ? Boolean(object.isMiddlewareEnabled) + : false, + }; + }, + toJSON(message: ActiveChannel): unknown { + const obj: any = {}; + message.connectionId !== undefined && + (obj.connectionId = message.connectionId); + message.portId !== undefined && (obj.portId = message.portId); + message.channelId !== undefined && (obj.channelId = message.channelId); + message.isMiddlewareEnabled !== undefined && + (obj.isMiddlewareEnabled = message.isMiddlewareEnabled); + return obj; + }, + fromPartial(object: Partial): ActiveChannel { + const message = createBaseActiveChannel(); + message.connectionId = object.connectionId ?? ''; + message.portId = object.portId ?? ''; + message.channelId = object.channelId ?? ''; + message.isMiddlewareEnabled = object.isMiddlewareEnabled ?? false; + return message; + }, + fromProtoMsg(message: ActiveChannelProtoMsg): ActiveChannel { + return ActiveChannel.decode(message.value); + }, + toProto(message: ActiveChannel): Uint8Array { + return ActiveChannel.encode(message).finish(); + }, + toProtoMsg(message: ActiveChannel): ActiveChannelProtoMsg { + return { + typeUrl: '/ibc.applications.interchain_accounts.genesis.v1.ActiveChannel', + value: ActiveChannel.encode(message).finish(), + }; + }, +}; +function createBaseRegisteredInterchainAccount(): RegisteredInterchainAccount { + return { + connectionId: '', + portId: '', + accountAddress: '', + }; +} +export const RegisteredInterchainAccount = { + typeUrl: + '/ibc.applications.interchain_accounts.genesis.v1.RegisteredInterchainAccount', + encode( + message: RegisteredInterchainAccount, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.connectionId !== '') { + writer.uint32(10).string(message.connectionId); + } + if (message.portId !== '') { + writer.uint32(18).string(message.portId); + } + if (message.accountAddress !== '') { + writer.uint32(26).string(message.accountAddress); + } + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): RegisteredInterchainAccount { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRegisteredInterchainAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.connectionId = reader.string(); + break; + case 2: + message.portId = reader.string(); + break; + case 3: + message.accountAddress = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): RegisteredInterchainAccount { + return { + connectionId: isSet(object.connectionId) + ? String(object.connectionId) + : '', + portId: isSet(object.portId) ? String(object.portId) : '', + accountAddress: isSet(object.accountAddress) + ? String(object.accountAddress) + : '', + }; + }, + toJSON(message: RegisteredInterchainAccount): unknown { + const obj: any = {}; + message.connectionId !== undefined && + (obj.connectionId = message.connectionId); + message.portId !== undefined && (obj.portId = message.portId); + message.accountAddress !== undefined && + (obj.accountAddress = message.accountAddress); + return obj; + }, + fromPartial( + object: Partial, + ): RegisteredInterchainAccount { + const message = createBaseRegisteredInterchainAccount(); + message.connectionId = object.connectionId ?? ''; + message.portId = object.portId ?? ''; + message.accountAddress = object.accountAddress ?? ''; + return message; + }, + fromProtoMsg( + message: RegisteredInterchainAccountProtoMsg, + ): RegisteredInterchainAccount { + return RegisteredInterchainAccount.decode(message.value); + }, + toProto(message: RegisteredInterchainAccount): Uint8Array { + return RegisteredInterchainAccount.encode(message).finish(); + }, + toProtoMsg( + message: RegisteredInterchainAccount, + ): RegisteredInterchainAccountProtoMsg { + return { + typeUrl: + '/ibc.applications.interchain_accounts.genesis.v1.RegisteredInterchainAccount', + value: RegisteredInterchainAccount.encode(message).finish(), + }; + }, +}; diff --git a/packages/cosmic-proto/src/codegen/ibc/applications/interchain_accounts/host/v1/host.ts b/packages/cosmic-proto/src/codegen/ibc/applications/interchain_accounts/host/v1/host.ts new file mode 100644 index 00000000000..f401b9a68bd --- /dev/null +++ b/packages/cosmic-proto/src/codegen/ibc/applications/interchain_accounts/host/v1/host.ts @@ -0,0 +1,106 @@ +//@ts-nocheck +import { BinaryReader, BinaryWriter } from '../../../../../binary.js'; +import { isSet } from '../../../../../helpers.js'; +/** + * Params defines the set of on-chain interchain accounts parameters. + * The following parameters may be used to disable the host submodule. + */ +export interface Params { + /** host_enabled enables or disables the host submodule. */ + hostEnabled: boolean; + /** allow_messages defines a list of sdk message typeURLs allowed to be executed on a host chain. */ + allowMessages: string[]; +} +export interface ParamsProtoMsg { + typeUrl: '/ibc.applications.interchain_accounts.host.v1.Params'; + value: Uint8Array; +} +/** + * Params defines the set of on-chain interchain accounts parameters. + * The following parameters may be used to disable the host submodule. + */ +export interface ParamsSDKType { + host_enabled: boolean; + allow_messages: string[]; +} +function createBaseParams(): Params { + return { + hostEnabled: false, + allowMessages: [], + }; +} +export const Params = { + typeUrl: '/ibc.applications.interchain_accounts.host.v1.Params', + encode( + message: Params, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.hostEnabled === true) { + writer.uint32(8).bool(message.hostEnabled); + } + for (const v of message.allowMessages) { + writer.uint32(18).string(v!); + } + return writer; + }, + 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 = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.hostEnabled = reader.bool(); + break; + case 2: + message.allowMessages.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): Params { + return { + hostEnabled: isSet(object.hostEnabled) + ? Boolean(object.hostEnabled) + : false, + allowMessages: Array.isArray(object?.allowMessages) + ? object.allowMessages.map((e: any) => String(e)) + : [], + }; + }, + toJSON(message: Params): unknown { + const obj: any = {}; + message.hostEnabled !== undefined && + (obj.hostEnabled = message.hostEnabled); + if (message.allowMessages) { + obj.allowMessages = message.allowMessages.map(e => e); + } else { + obj.allowMessages = []; + } + return obj; + }, + fromPartial(object: Partial): Params { + const message = createBaseParams(); + message.hostEnabled = object.hostEnabled ?? false; + message.allowMessages = object.allowMessages?.map(e => e) || []; + return message; + }, + fromProtoMsg(message: ParamsProtoMsg): Params { + return Params.decode(message.value); + }, + toProto(message: Params): Uint8Array { + return Params.encode(message).finish(); + }, + toProtoMsg(message: Params): ParamsProtoMsg { + return { + typeUrl: '/ibc.applications.interchain_accounts.host.v1.Params', + value: Params.encode(message).finish(), + }; + }, +}; diff --git a/packages/cosmic-proto/src/codegen/ibc/applications/interchain_accounts/host/v1/query.ts b/packages/cosmic-proto/src/codegen/ibc/applications/interchain_accounts/host/v1/query.ts new file mode 100644 index 00000000000..5491b9bc80d --- /dev/null +++ b/packages/cosmic-proto/src/codegen/ibc/applications/interchain_accounts/host/v1/query.ts @@ -0,0 +1,149 @@ +//@ts-nocheck +import { Params, ParamsSDKType } from './host.js'; +import { BinaryReader, BinaryWriter } from '../../../../../binary.js'; +import { isSet } from '../../../../../helpers.js'; +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequest {} +export interface QueryParamsRequestProtoMsg { + typeUrl: '/ibc.applications.interchain_accounts.host.v1.QueryParamsRequest'; + value: Uint8Array; +} +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequestSDKType {} +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponse { + /** params defines the parameters of the module. */ + params?: Params; +} +export interface QueryParamsResponseProtoMsg { + typeUrl: '/ibc.applications.interchain_accounts.host.v1.QueryParamsResponse'; + value: Uint8Array; +} +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponseSDKType { + params?: ParamsSDKType; +} +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} +export const QueryParamsRequest = { + typeUrl: '/ibc.applications.interchain_accounts.host.v1.QueryParamsRequest', + encode( + _: QueryParamsRequest, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + return writer; + }, + 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 = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + fromPartial(_: Partial): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, + fromProtoMsg(message: QueryParamsRequestProtoMsg): QueryParamsRequest { + return QueryParamsRequest.decode(message.value); + }, + toProto(message: QueryParamsRequest): Uint8Array { + return QueryParamsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsRequest): QueryParamsRequestProtoMsg { + return { + typeUrl: + '/ibc.applications.interchain_accounts.host.v1.QueryParamsRequest', + value: QueryParamsRequest.encode(message).finish(), + }; + }, +}; +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { + params: undefined, + }; +} +export const QueryParamsResponse = { + typeUrl: '/ibc.applications.interchain_accounts.host.v1.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, + ): QueryParamsResponse { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryParamsResponse { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + message.params !== undefined && + (obj.params = message.params ? Params.toJSON(message.params) : undefined); + return obj; + }, + fromPartial(object: Partial): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = + object.params !== undefined && object.params !== null + ? Params.fromPartial(object.params) + : undefined; + return message; + }, + fromProtoMsg(message: QueryParamsResponseProtoMsg): QueryParamsResponse { + return QueryParamsResponse.decode(message.value); + }, + toProto(message: QueryParamsResponse): Uint8Array { + return QueryParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsResponse): QueryParamsResponseProtoMsg { + return { + typeUrl: + '/ibc.applications.interchain_accounts.host.v1.QueryParamsResponse', + value: QueryParamsResponse.encode(message).finish(), + }; + }, +}; diff --git a/packages/cosmic-proto/src/codegen/ibc/applications/interchain_accounts/v1/account.ts b/packages/cosmic-proto/src/codegen/ibc/applications/interchain_accounts/v1/account.ts new file mode 100644 index 00000000000..e81d087977b --- /dev/null +++ b/packages/cosmic-proto/src/codegen/ibc/applications/interchain_accounts/v1/account.ts @@ -0,0 +1,110 @@ +//@ts-nocheck +import { + BaseAccount, + BaseAccountSDKType, +} from '../../../../cosmos/auth/v1beta1/auth.js'; +import { BinaryReader, BinaryWriter } from '../../../../binary.js'; +import { isSet } from '../../../../helpers.js'; +/** An InterchainAccount is defined as a BaseAccount & the address of the account owner on the controller chain */ +export interface InterchainAccount { + $typeUrl?: '/ibc.applications.interchain_accounts.v1.InterchainAccount'; + baseAccount?: BaseAccount; + accountOwner: string; +} +export interface InterchainAccountProtoMsg { + typeUrl: '/ibc.applications.interchain_accounts.v1.InterchainAccount'; + value: Uint8Array; +} +/** An InterchainAccount is defined as a BaseAccount & the address of the account owner on the controller chain */ +export interface InterchainAccountSDKType { + $typeUrl?: '/ibc.applications.interchain_accounts.v1.InterchainAccount'; + base_account?: BaseAccountSDKType; + account_owner: string; +} +function createBaseInterchainAccount(): InterchainAccount { + return { + $typeUrl: '/ibc.applications.interchain_accounts.v1.InterchainAccount', + baseAccount: undefined, + accountOwner: '', + }; +} +export const InterchainAccount = { + typeUrl: '/ibc.applications.interchain_accounts.v1.InterchainAccount', + encode( + message: InterchainAccount, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.baseAccount !== undefined) { + BaseAccount.encode( + message.baseAccount, + writer.uint32(10).fork(), + ).ldelim(); + } + if (message.accountOwner !== '') { + writer.uint32(18).string(message.accountOwner); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): InterchainAccount { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInterchainAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.baseAccount = BaseAccount.decode(reader, reader.uint32()); + break; + case 2: + message.accountOwner = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): InterchainAccount { + return { + baseAccount: isSet(object.baseAccount) + ? BaseAccount.fromJSON(object.baseAccount) + : undefined, + accountOwner: isSet(object.accountOwner) + ? String(object.accountOwner) + : '', + }; + }, + toJSON(message: InterchainAccount): unknown { + const obj: any = {}; + message.baseAccount !== undefined && + (obj.baseAccount = message.baseAccount + ? BaseAccount.toJSON(message.baseAccount) + : undefined); + message.accountOwner !== undefined && + (obj.accountOwner = message.accountOwner); + return obj; + }, + fromPartial(object: Partial): InterchainAccount { + const message = createBaseInterchainAccount(); + message.baseAccount = + object.baseAccount !== undefined && object.baseAccount !== null + ? BaseAccount.fromPartial(object.baseAccount) + : undefined; + message.accountOwner = object.accountOwner ?? ''; + return message; + }, + fromProtoMsg(message: InterchainAccountProtoMsg): InterchainAccount { + return InterchainAccount.decode(message.value); + }, + toProto(message: InterchainAccount): Uint8Array { + return InterchainAccount.encode(message).finish(); + }, + toProtoMsg(message: InterchainAccount): InterchainAccountProtoMsg { + return { + typeUrl: '/ibc.applications.interchain_accounts.v1.InterchainAccount', + value: InterchainAccount.encode(message).finish(), + }; + }, +}; diff --git a/packages/cosmic-proto/src/codegen/ibc/applications/interchain_accounts/v1/metadata.ts b/packages/cosmic-proto/src/codegen/ibc/applications/interchain_accounts/v1/metadata.ts new file mode 100644 index 00000000000..68d0a3f15ca --- /dev/null +++ b/packages/cosmic-proto/src/codegen/ibc/applications/interchain_accounts/v1/metadata.ts @@ -0,0 +1,158 @@ +//@ts-nocheck +import { BinaryReader, BinaryWriter } from '../../../../binary.js'; +import { isSet } from '../../../../helpers.js'; +/** + * 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 + */ +export interface Metadata { + /** version defines the ICS27 protocol version */ + version: string; + /** controller_connection_id is the connection identifier associated with the controller chain */ + controllerConnectionId: string; + /** host_connection_id is the connection identifier associated with the host chain */ + hostConnectionId: string; + /** + * 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 + */ + address: string; + /** encoding defines the supported codec format */ + encoding: string; + /** tx_type defines the type of transactions the interchain account can execute */ + txType: string; +} +export interface MetadataProtoMsg { + typeUrl: '/ibc.applications.interchain_accounts.v1.Metadata'; + value: Uint8Array; +} +/** + * 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 + */ +export interface MetadataSDKType { + version: string; + controller_connection_id: string; + host_connection_id: string; + address: string; + encoding: string; + tx_type: string; +} +function createBaseMetadata(): Metadata { + return { + version: '', + controllerConnectionId: '', + hostConnectionId: '', + address: '', + encoding: '', + txType: '', + }; +} +export const Metadata = { + typeUrl: '/ibc.applications.interchain_accounts.v1.Metadata', + encode( + message: Metadata, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.version !== '') { + writer.uint32(10).string(message.version); + } + if (message.controllerConnectionId !== '') { + writer.uint32(18).string(message.controllerConnectionId); + } + if (message.hostConnectionId !== '') { + writer.uint32(26).string(message.hostConnectionId); + } + if (message.address !== '') { + writer.uint32(34).string(message.address); + } + if (message.encoding !== '') { + writer.uint32(42).string(message.encoding); + } + if (message.txType !== '') { + writer.uint32(50).string(message.txType); + } + 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.version = reader.string(); + break; + case 2: + message.controllerConnectionId = reader.string(); + break; + case 3: + message.hostConnectionId = reader.string(); + break; + case 4: + message.address = reader.string(); + break; + case 5: + message.encoding = reader.string(); + break; + case 6: + message.txType = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): Metadata { + return { + version: isSet(object.version) ? String(object.version) : '', + controllerConnectionId: isSet(object.controllerConnectionId) + ? String(object.controllerConnectionId) + : '', + hostConnectionId: isSet(object.hostConnectionId) + ? String(object.hostConnectionId) + : '', + address: isSet(object.address) ? String(object.address) : '', + encoding: isSet(object.encoding) ? String(object.encoding) : '', + txType: isSet(object.txType) ? String(object.txType) : '', + }; + }, + toJSON(message: Metadata): unknown { + const obj: any = {}; + message.version !== undefined && (obj.version = message.version); + message.controllerConnectionId !== undefined && + (obj.controllerConnectionId = message.controllerConnectionId); + message.hostConnectionId !== undefined && + (obj.hostConnectionId = message.hostConnectionId); + message.address !== undefined && (obj.address = message.address); + message.encoding !== undefined && (obj.encoding = message.encoding); + message.txType !== undefined && (obj.txType = message.txType); + return obj; + }, + fromPartial(object: Partial): Metadata { + const message = createBaseMetadata(); + message.version = object.version ?? ''; + message.controllerConnectionId = object.controllerConnectionId ?? ''; + message.hostConnectionId = object.hostConnectionId ?? ''; + message.address = object.address ?? ''; + message.encoding = object.encoding ?? ''; + message.txType = object.txType ?? ''; + return message; + }, + fromProtoMsg(message: MetadataProtoMsg): Metadata { + return Metadata.decode(message.value); + }, + toProto(message: Metadata): Uint8Array { + return Metadata.encode(message).finish(); + }, + toProtoMsg(message: Metadata): MetadataProtoMsg { + return { + typeUrl: '/ibc.applications.interchain_accounts.v1.Metadata', + value: Metadata.encode(message).finish(), + }; + }, +}; diff --git a/packages/cosmic-proto/src/codegen/ibc/applications/interchain_accounts/v1/packet.ts b/packages/cosmic-proto/src/codegen/ibc/applications/interchain_accounts/v1/packet.ts new file mode 100644 index 00000000000..64853d70887 --- /dev/null +++ b/packages/cosmic-proto/src/codegen/ibc/applications/interchain_accounts/v1/packet.ts @@ -0,0 +1,239 @@ +//@ts-nocheck +import { Any, AnySDKType } from '../../../../google/protobuf/any.js'; +import { BinaryReader, BinaryWriter } from '../../../../binary.js'; +import { + isSet, + bytesFromBase64, + base64FromBytes, +} from '../../../../helpers.js'; +/** + * Type defines a classification of message issued from a controller chain to its associated interchain accounts + * host + */ +export enum Type { + /** TYPE_UNSPECIFIED - Default zero value enumeration */ + TYPE_UNSPECIFIED = 0, + /** TYPE_EXECUTE_TX - Execute a transaction on an interchain accounts host chain */ + TYPE_EXECUTE_TX = 1, + UNRECOGNIZED = -1, +} +export const TypeSDKType = Type; +export function typeFromJSON(object: any): Type { + switch (object) { + case 0: + case 'TYPE_UNSPECIFIED': + return Type.TYPE_UNSPECIFIED; + case 1: + case 'TYPE_EXECUTE_TX': + return Type.TYPE_EXECUTE_TX; + case -1: + case 'UNRECOGNIZED': + default: + return Type.UNRECOGNIZED; + } +} +export function typeToJSON(object: Type): string { + switch (object) { + case Type.TYPE_UNSPECIFIED: + return 'TYPE_UNSPECIFIED'; + case Type.TYPE_EXECUTE_TX: + return 'TYPE_EXECUTE_TX'; + case Type.UNRECOGNIZED: + default: + return 'UNRECOGNIZED'; + } +} +/** InterchainAccountPacketData is comprised of a raw transaction, type of transaction and optional memo field. */ +export interface InterchainAccountPacketData { + type: Type; + data: Uint8Array; + memo: string; +} +export interface InterchainAccountPacketDataProtoMsg { + typeUrl: '/ibc.applications.interchain_accounts.v1.InterchainAccountPacketData'; + value: Uint8Array; +} +/** InterchainAccountPacketData is comprised of a raw transaction, type of transaction and optional memo field. */ +export interface InterchainAccountPacketDataSDKType { + type: Type; + data: Uint8Array; + memo: string; +} +/** CosmosTx contains a list of sdk.Msg's. It should be used when sending transactions to an SDK host chain. */ +export interface CosmosTx { + messages: Any[]; +} +export interface CosmosTxProtoMsg { + typeUrl: '/ibc.applications.interchain_accounts.v1.CosmosTx'; + value: Uint8Array; +} +/** CosmosTx contains a list of sdk.Msg's. It should be used when sending transactions to an SDK host chain. */ +export interface CosmosTxSDKType { + messages: AnySDKType[]; +} +function createBaseInterchainAccountPacketData(): InterchainAccountPacketData { + return { + type: 0, + data: new Uint8Array(), + memo: '', + }; +} +export const InterchainAccountPacketData = { + typeUrl: + '/ibc.applications.interchain_accounts.v1.InterchainAccountPacketData', + encode( + message: InterchainAccountPacketData, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.type !== 0) { + writer.uint32(8).int32(message.type); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + if (message.memo !== '') { + writer.uint32(26).string(message.memo); + } + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): InterchainAccountPacketData { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInterchainAccountPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.type = reader.int32() as any; + break; + case 2: + message.data = reader.bytes(); + break; + case 3: + message.memo = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): InterchainAccountPacketData { + return { + type: isSet(object.type) ? typeFromJSON(object.type) : -1, + data: isSet(object.data) + ? bytesFromBase64(object.data) + : new Uint8Array(), + memo: isSet(object.memo) ? String(object.memo) : '', + }; + }, + toJSON(message: InterchainAccountPacketData): unknown { + const obj: any = {}; + message.type !== undefined && (obj.type = typeToJSON(message.type)); + message.data !== undefined && + (obj.data = base64FromBytes( + message.data !== undefined ? message.data : new Uint8Array(), + )); + message.memo !== undefined && (obj.memo = message.memo); + return obj; + }, + fromPartial( + object: Partial, + ): InterchainAccountPacketData { + const message = createBaseInterchainAccountPacketData(); + message.type = object.type ?? 0; + message.data = object.data ?? new Uint8Array(); + message.memo = object.memo ?? ''; + return message; + }, + fromProtoMsg( + message: InterchainAccountPacketDataProtoMsg, + ): InterchainAccountPacketData { + return InterchainAccountPacketData.decode(message.value); + }, + toProto(message: InterchainAccountPacketData): Uint8Array { + return InterchainAccountPacketData.encode(message).finish(); + }, + toProtoMsg( + message: InterchainAccountPacketData, + ): InterchainAccountPacketDataProtoMsg { + return { + typeUrl: + '/ibc.applications.interchain_accounts.v1.InterchainAccountPacketData', + value: InterchainAccountPacketData.encode(message).finish(), + }; + }, +}; +function createBaseCosmosTx(): CosmosTx { + return { + messages: [], + }; +} +export const CosmosTx = { + typeUrl: '/ibc.applications.interchain_accounts.v1.CosmosTx', + encode( + message: CosmosTx, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + for (const v of message.messages) { + Any.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): CosmosTx { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCosmosTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.messages.push(Any.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): CosmosTx { + return { + messages: Array.isArray(object?.messages) + ? object.messages.map((e: any) => Any.fromJSON(e)) + : [], + }; + }, + toJSON(message: CosmosTx): unknown { + const obj: any = {}; + if (message.messages) { + obj.messages = message.messages.map(e => (e ? Any.toJSON(e) : undefined)); + } else { + obj.messages = []; + } + return obj; + }, + fromPartial(object: Partial): CosmosTx { + const message = createBaseCosmosTx(); + message.messages = object.messages?.map(e => Any.fromPartial(e)) || []; + return message; + }, + fromProtoMsg(message: CosmosTxProtoMsg): CosmosTx { + return CosmosTx.decode(message.value); + }, + toProto(message: CosmosTx): Uint8Array { + return CosmosTx.encode(message).finish(); + }, + toProtoMsg(message: CosmosTx): CosmosTxProtoMsg { + return { + typeUrl: '/ibc.applications.interchain_accounts.v1.CosmosTx', + value: CosmosTx.encode(message).finish(), + }; + }, +}; diff --git a/packages/cosmic-proto/src/codegen/ibc/applications/transfer/v1/authz.ts b/packages/cosmic-proto/src/codegen/ibc/applications/transfer/v1/authz.ts new file mode 100644 index 00000000000..6203fa5c53d --- /dev/null +++ b/packages/cosmic-proto/src/codegen/ibc/applications/transfer/v1/authz.ts @@ -0,0 +1,231 @@ +//@ts-nocheck +import { Coin, CoinSDKType } from '../../../../cosmos/base/v1beta1/coin.js'; +import { BinaryReader, BinaryWriter } from '../../../../binary.js'; +import { isSet } from '../../../../helpers.js'; +/** Allocation defines the spend limit for a particular port and channel */ +export interface Allocation { + /** the port on which the packet will be sent */ + sourcePort: string; + /** the channel by which the packet will be sent */ + sourceChannel: string; + /** spend limitation on the channel */ + spendLimit: Coin[]; + /** allow list of receivers, an empty allow list permits any receiver address */ + allowList: string[]; +} +export interface AllocationProtoMsg { + typeUrl: '/ibc.applications.transfer.v1.Allocation'; + value: Uint8Array; +} +/** Allocation defines the spend limit for a particular port and channel */ +export interface AllocationSDKType { + source_port: string; + source_channel: string; + spend_limit: CoinSDKType[]; + allow_list: string[]; +} +/** + * TransferAuthorization allows the grantee to spend up to spend_limit coins from + * the granter's account for ibc transfer on a specific channel + */ +export interface TransferAuthorization { + $typeUrl?: '/ibc.applications.transfer.v1.TransferAuthorization'; + /** port and channel amounts */ + allocations: Allocation[]; +} +export interface TransferAuthorizationProtoMsg { + typeUrl: '/ibc.applications.transfer.v1.TransferAuthorization'; + value: Uint8Array; +} +/** + * TransferAuthorization allows the grantee to spend up to spend_limit coins from + * the granter's account for ibc transfer on a specific channel + */ +export interface TransferAuthorizationSDKType { + $typeUrl?: '/ibc.applications.transfer.v1.TransferAuthorization'; + allocations: AllocationSDKType[]; +} +function createBaseAllocation(): Allocation { + return { + sourcePort: '', + sourceChannel: '', + spendLimit: [], + allowList: [], + }; +} +export const Allocation = { + typeUrl: '/ibc.applications.transfer.v1.Allocation', + encode( + message: Allocation, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.sourcePort !== '') { + writer.uint32(10).string(message.sourcePort); + } + if (message.sourceChannel !== '') { + writer.uint32(18).string(message.sourceChannel); + } + for (const v of message.spendLimit) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.allowList) { + writer.uint32(34).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Allocation { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAllocation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sourcePort = reader.string(); + break; + case 2: + message.sourceChannel = reader.string(); + break; + case 3: + message.spendLimit.push(Coin.decode(reader, reader.uint32())); + break; + case 4: + message.allowList.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): Allocation { + return { + sourcePort: isSet(object.sourcePort) ? String(object.sourcePort) : '', + sourceChannel: isSet(object.sourceChannel) + ? String(object.sourceChannel) + : '', + spendLimit: Array.isArray(object?.spendLimit) + ? object.spendLimit.map((e: any) => Coin.fromJSON(e)) + : [], + allowList: Array.isArray(object?.allowList) + ? object.allowList.map((e: any) => String(e)) + : [], + }; + }, + toJSON(message: Allocation): unknown { + const obj: any = {}; + message.sourcePort !== undefined && (obj.sourcePort = message.sourcePort); + message.sourceChannel !== undefined && + (obj.sourceChannel = message.sourceChannel); + if (message.spendLimit) { + obj.spendLimit = message.spendLimit.map(e => + e ? Coin.toJSON(e) : undefined, + ); + } else { + obj.spendLimit = []; + } + if (message.allowList) { + obj.allowList = message.allowList.map(e => e); + } else { + obj.allowList = []; + } + return obj; + }, + fromPartial(object: Partial): Allocation { + const message = createBaseAllocation(); + message.sourcePort = object.sourcePort ?? ''; + message.sourceChannel = object.sourceChannel ?? ''; + message.spendLimit = object.spendLimit?.map(e => Coin.fromPartial(e)) || []; + message.allowList = object.allowList?.map(e => e) || []; + return message; + }, + fromProtoMsg(message: AllocationProtoMsg): Allocation { + return Allocation.decode(message.value); + }, + toProto(message: Allocation): Uint8Array { + return Allocation.encode(message).finish(); + }, + toProtoMsg(message: Allocation): AllocationProtoMsg { + return { + typeUrl: '/ibc.applications.transfer.v1.Allocation', + value: Allocation.encode(message).finish(), + }; + }, +}; +function createBaseTransferAuthorization(): TransferAuthorization { + return { + $typeUrl: '/ibc.applications.transfer.v1.TransferAuthorization', + allocations: [], + }; +} +export const TransferAuthorization = { + typeUrl: '/ibc.applications.transfer.v1.TransferAuthorization', + encode( + message: TransferAuthorization, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + for (const v of message.allocations) { + Allocation.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): TransferAuthorization { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTransferAuthorization(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.allocations.push(Allocation.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): TransferAuthorization { + return { + allocations: Array.isArray(object?.allocations) + ? object.allocations.map((e: any) => Allocation.fromJSON(e)) + : [], + }; + }, + toJSON(message: TransferAuthorization): unknown { + const obj: any = {}; + if (message.allocations) { + obj.allocations = message.allocations.map(e => + e ? Allocation.toJSON(e) : undefined, + ); + } else { + obj.allocations = []; + } + return obj; + }, + fromPartial(object: Partial): TransferAuthorization { + const message = createBaseTransferAuthorization(); + message.allocations = + object.allocations?.map(e => Allocation.fromPartial(e)) || []; + return message; + }, + fromProtoMsg(message: TransferAuthorizationProtoMsg): TransferAuthorization { + return TransferAuthorization.decode(message.value); + }, + toProto(message: TransferAuthorization): Uint8Array { + return TransferAuthorization.encode(message).finish(); + }, + toProtoMsg(message: TransferAuthorization): TransferAuthorizationProtoMsg { + return { + typeUrl: '/ibc.applications.transfer.v1.TransferAuthorization', + value: TransferAuthorization.encode(message).finish(), + }; + }, +}; diff --git a/packages/cosmic-proto/src/codegen/ibc/applications/transfer/v1/genesis.ts b/packages/cosmic-proto/src/codegen/ibc/applications/transfer/v1/genesis.ts new file mode 100644 index 00000000000..27c743e0c99 --- /dev/null +++ b/packages/cosmic-proto/src/codegen/ibc/applications/transfer/v1/genesis.ts @@ -0,0 +1,120 @@ +//@ts-nocheck +import { + DenomTrace, + DenomTraceSDKType, + Params, + ParamsSDKType, +} from './transfer.js'; +import { BinaryReader, BinaryWriter } from '../../../../binary.js'; +import { isSet } from '../../../../helpers.js'; +/** GenesisState defines the ibc-transfer genesis state */ +export interface GenesisState { + portId: string; + denomTraces: DenomTrace[]; + params: Params; +} +export interface GenesisStateProtoMsg { + typeUrl: '/ibc.applications.transfer.v1.GenesisState'; + value: Uint8Array; +} +/** GenesisState defines the ibc-transfer genesis state */ +export interface GenesisStateSDKType { + port_id: string; + denom_traces: DenomTraceSDKType[]; + params: ParamsSDKType; +} +function createBaseGenesisState(): GenesisState { + return { + portId: '', + denomTraces: [], + params: Params.fromPartial({}), + }; +} +export const GenesisState = { + typeUrl: '/ibc.applications.transfer.v1.GenesisState', + encode( + message: GenesisState, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.portId !== '') { + writer.uint32(10).string(message.portId); + } + for (const v of message.denomTraces) { + DenomTrace.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(26).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.portId = reader.string(); + break; + case 2: + message.denomTraces.push(DenomTrace.decode(reader, reader.uint32())); + break; + case 3: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): GenesisState { + return { + portId: isSet(object.portId) ? String(object.portId) : '', + denomTraces: Array.isArray(object?.denomTraces) + ? object.denomTraces.map((e: any) => DenomTrace.fromJSON(e)) + : [], + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + 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, + ); + } else { + obj.denomTraces = []; + } + message.params !== undefined && + (obj.params = message.params ? Params.toJSON(message.params) : undefined); + return obj; + }, + fromPartial(object: Partial): GenesisState { + const message = createBaseGenesisState(); + message.portId = object.portId ?? ''; + message.denomTraces = + object.denomTraces?.map(e => DenomTrace.fromPartial(e)) || []; + message.params = + object.params !== undefined && object.params !== null + ? Params.fromPartial(object.params) + : undefined; + return message; + }, + fromProtoMsg(message: GenesisStateProtoMsg): GenesisState { + return GenesisState.decode(message.value); + }, + toProto(message: GenesisState): Uint8Array { + return GenesisState.encode(message).finish(); + }, + toProtoMsg(message: GenesisState): GenesisStateProtoMsg { + return { + typeUrl: '/ibc.applications.transfer.v1.GenesisState', + value: GenesisState.encode(message).finish(), + }; + }, +}; diff --git a/packages/cosmic-proto/src/codegen/ibc/applications/transfer/v1/query.ts b/packages/cosmic-proto/src/codegen/ibc/applications/transfer/v1/query.ts new file mode 100644 index 00000000000..af13e428f59 --- /dev/null +++ b/packages/cosmic-proto/src/codegen/ibc/applications/transfer/v1/query.ts @@ -0,0 +1,917 @@ +//@ts-nocheck +import { + PageRequest, + PageRequestSDKType, + PageResponse, + PageResponseSDKType, +} from '../../../../cosmos/base/query/v1beta1/pagination.js'; +import { + DenomTrace, + DenomTraceSDKType, + Params, + ParamsSDKType, +} from './transfer.js'; +import { BinaryReader, BinaryWriter } from '../../../../binary.js'; +import { isSet } from '../../../../helpers.js'; +/** + * QueryDenomTraceRequest is the request type for the Query/DenomTrace RPC + * method + */ +export interface QueryDenomTraceRequest { + /** hash (in hex format) or denom (full denom with ibc prefix) of the denomination trace information. */ + hash: string; +} +export interface QueryDenomTraceRequestProtoMsg { + typeUrl: '/ibc.applications.transfer.v1.QueryDenomTraceRequest'; + value: Uint8Array; +} +/** + * QueryDenomTraceRequest is the request type for the Query/DenomTrace RPC + * method + */ +export interface QueryDenomTraceRequestSDKType { + hash: string; +} +/** + * QueryDenomTraceResponse is the response type for the Query/DenomTrace RPC + * method. + */ +export interface QueryDenomTraceResponse { + /** denom_trace returns the requested denomination trace information. */ + denomTrace?: DenomTrace; +} +export interface QueryDenomTraceResponseProtoMsg { + typeUrl: '/ibc.applications.transfer.v1.QueryDenomTraceResponse'; + value: Uint8Array; +} +/** + * QueryDenomTraceResponse is the response type for the Query/DenomTrace RPC + * method. + */ +export interface QueryDenomTraceResponseSDKType { + denom_trace?: DenomTraceSDKType; +} +/** + * QueryConnectionsRequest is the request type for the Query/DenomTraces RPC + * method + */ +export interface QueryDenomTracesRequest { + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryDenomTracesRequestProtoMsg { + typeUrl: '/ibc.applications.transfer.v1.QueryDenomTracesRequest'; + value: Uint8Array; +} +/** + * QueryConnectionsRequest is the request type for the Query/DenomTraces RPC + * method + */ +export interface QueryDenomTracesRequestSDKType { + pagination?: PageRequestSDKType; +} +/** + * QueryConnectionsResponse is the response type for the Query/DenomTraces RPC + * method. + */ +export interface QueryDenomTracesResponse { + /** denom_traces returns all denominations trace information. */ + denomTraces: DenomTrace[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryDenomTracesResponseProtoMsg { + typeUrl: '/ibc.applications.transfer.v1.QueryDenomTracesResponse'; + value: Uint8Array; +} +/** + * QueryConnectionsResponse is the response type for the Query/DenomTraces RPC + * method. + */ +export interface QueryDenomTracesResponseSDKType { + denom_traces: DenomTraceSDKType[]; + pagination?: PageResponseSDKType; +} +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequest {} +export interface QueryParamsRequestProtoMsg { + typeUrl: '/ibc.applications.transfer.v1.QueryParamsRequest'; + value: Uint8Array; +} +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequestSDKType {} +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponse { + /** params defines the parameters of the module. */ + params?: Params; +} +export interface QueryParamsResponseProtoMsg { + typeUrl: '/ibc.applications.transfer.v1.QueryParamsResponse'; + value: Uint8Array; +} +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponseSDKType { + params?: ParamsSDKType; +} +/** + * QueryDenomHashRequest is the request type for the Query/DenomHash RPC + * method + */ +export interface QueryDenomHashRequest { + /** The denomination trace ([port_id]/[channel_id])+/[denom] */ + trace: string; +} +export interface QueryDenomHashRequestProtoMsg { + typeUrl: '/ibc.applications.transfer.v1.QueryDenomHashRequest'; + value: Uint8Array; +} +/** + * QueryDenomHashRequest is the request type for the Query/DenomHash RPC + * method + */ +export interface QueryDenomHashRequestSDKType { + trace: string; +} +/** + * QueryDenomHashResponse is the response type for the Query/DenomHash RPC + * method. + */ +export interface QueryDenomHashResponse { + /** hash (in hex format) of the denomination trace information. */ + hash: string; +} +export interface QueryDenomHashResponseProtoMsg { + typeUrl: '/ibc.applications.transfer.v1.QueryDenomHashResponse'; + value: Uint8Array; +} +/** + * QueryDenomHashResponse is the response type for the Query/DenomHash RPC + * method. + */ +export interface QueryDenomHashResponseSDKType { + hash: string; +} +/** QueryEscrowAddressRequest is the request type for the EscrowAddress RPC method. */ +export interface QueryEscrowAddressRequest { + /** unique port identifier */ + portId: string; + /** unique channel identifier */ + channelId: string; +} +export interface QueryEscrowAddressRequestProtoMsg { + typeUrl: '/ibc.applications.transfer.v1.QueryEscrowAddressRequest'; + value: Uint8Array; +} +/** QueryEscrowAddressRequest is the request type for the EscrowAddress RPC method. */ +export interface QueryEscrowAddressRequestSDKType { + port_id: string; + channel_id: string; +} +/** QueryEscrowAddressResponse is the response type of the EscrowAddress RPC method. */ +export interface QueryEscrowAddressResponse { + /** the escrow account address */ + escrowAddress: string; +} +export interface QueryEscrowAddressResponseProtoMsg { + typeUrl: '/ibc.applications.transfer.v1.QueryEscrowAddressResponse'; + value: Uint8Array; +} +/** QueryEscrowAddressResponse is the response type of the EscrowAddress RPC method. */ +export interface QueryEscrowAddressResponseSDKType { + escrow_address: string; +} +function createBaseQueryDenomTraceRequest(): QueryDenomTraceRequest { + return { + hash: '', + }; +} +export const QueryDenomTraceRequest = { + typeUrl: '/ibc.applications.transfer.v1.QueryDenomTraceRequest', + encode( + message: QueryDenomTraceRequest, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.hash !== '') { + writer.uint32(10).string(message.hash); + } + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): QueryDenomTraceRequest { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomTraceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.hash = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryDenomTraceRequest { + return { + hash: isSet(object.hash) ? String(object.hash) : '', + }; + }, + toJSON(message: QueryDenomTraceRequest): unknown { + const obj: any = {}; + message.hash !== undefined && (obj.hash = message.hash); + return obj; + }, + fromPartial(object: Partial): QueryDenomTraceRequest { + const message = createBaseQueryDenomTraceRequest(); + message.hash = object.hash ?? ''; + return message; + }, + fromProtoMsg( + message: QueryDenomTraceRequestProtoMsg, + ): QueryDenomTraceRequest { + return QueryDenomTraceRequest.decode(message.value); + }, + toProto(message: QueryDenomTraceRequest): Uint8Array { + return QueryDenomTraceRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryDenomTraceRequest): QueryDenomTraceRequestProtoMsg { + return { + typeUrl: '/ibc.applications.transfer.v1.QueryDenomTraceRequest', + value: QueryDenomTraceRequest.encode(message).finish(), + }; + }, +}; +function createBaseQueryDenomTraceResponse(): QueryDenomTraceResponse { + return { + denomTrace: undefined, + }; +} +export const QueryDenomTraceResponse = { + typeUrl: '/ibc.applications.transfer.v1.QueryDenomTraceResponse', + encode( + message: QueryDenomTraceResponse, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.denomTrace !== undefined) { + DenomTrace.encode(message.denomTrace, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): QueryDenomTraceResponse { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomTraceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.denomTrace = DenomTrace.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryDenomTraceResponse { + return { + denomTrace: isSet(object.denomTrace) + ? DenomTrace.fromJSON(object.denomTrace) + : undefined, + }; + }, + toJSON(message: QueryDenomTraceResponse): unknown { + const obj: any = {}; + message.denomTrace !== undefined && + (obj.denomTrace = message.denomTrace + ? DenomTrace.toJSON(message.denomTrace) + : undefined); + return obj; + }, + fromPartial( + object: Partial, + ): QueryDenomTraceResponse { + const message = createBaseQueryDenomTraceResponse(); + message.denomTrace = + object.denomTrace !== undefined && object.denomTrace !== null + ? DenomTrace.fromPartial(object.denomTrace) + : undefined; + return message; + }, + fromProtoMsg( + message: QueryDenomTraceResponseProtoMsg, + ): QueryDenomTraceResponse { + return QueryDenomTraceResponse.decode(message.value); + }, + toProto(message: QueryDenomTraceResponse): Uint8Array { + return QueryDenomTraceResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryDenomTraceResponse, + ): QueryDenomTraceResponseProtoMsg { + return { + typeUrl: '/ibc.applications.transfer.v1.QueryDenomTraceResponse', + value: QueryDenomTraceResponse.encode(message).finish(), + }; + }, +}; +function createBaseQueryDenomTracesRequest(): QueryDenomTracesRequest { + return { + pagination: undefined, + }; +} +export const QueryDenomTracesRequest = { + typeUrl: '/ibc.applications.transfer.v1.QueryDenomTracesRequest', + encode( + message: QueryDenomTracesRequest, + 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, + ): QueryDenomTracesRequest { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomTracesRequest(); + 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): QueryDenomTracesRequest { + return { + pagination: isSet(object.pagination) + ? PageRequest.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message: QueryDenomTracesRequest): unknown { + const obj: any = {}; + message.pagination !== undefined && + (obj.pagination = message.pagination + ? PageRequest.toJSON(message.pagination) + : undefined); + return obj; + }, + fromPartial( + object: Partial, + ): QueryDenomTracesRequest { + const message = createBaseQueryDenomTracesRequest(); + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, + fromProtoMsg( + message: QueryDenomTracesRequestProtoMsg, + ): QueryDenomTracesRequest { + return QueryDenomTracesRequest.decode(message.value); + }, + toProto(message: QueryDenomTracesRequest): Uint8Array { + return QueryDenomTracesRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryDenomTracesRequest, + ): QueryDenomTracesRequestProtoMsg { + return { + typeUrl: '/ibc.applications.transfer.v1.QueryDenomTracesRequest', + value: QueryDenomTracesRequest.encode(message).finish(), + }; + }, +}; +function createBaseQueryDenomTracesResponse(): QueryDenomTracesResponse { + return { + denomTraces: [], + pagination: undefined, + }; +} +export const QueryDenomTracesResponse = { + typeUrl: '/ibc.applications.transfer.v1.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(); + } + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): QueryDenomTracesResponse { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomTracesResponse(); + 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()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryDenomTracesResponse { + return { + denomTraces: Array.isArray(object?.denomTraces) + ? object.denomTraces.map((e: any) => DenomTrace.fromJSON(e)) + : [], + pagination: isSet(object.pagination) + ? PageResponse.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message: QueryDenomTracesResponse): 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); + return obj; + }, + fromPartial( + object: Partial, + ): QueryDenomTracesResponse { + const message = createBaseQueryDenomTracesResponse(); + message.denomTraces = + object.denomTraces?.map(e => DenomTrace.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, + fromProtoMsg( + message: QueryDenomTracesResponseProtoMsg, + ): QueryDenomTracesResponse { + return QueryDenomTracesResponse.decode(message.value); + }, + toProto(message: QueryDenomTracesResponse): Uint8Array { + return QueryDenomTracesResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryDenomTracesResponse, + ): QueryDenomTracesResponseProtoMsg { + return { + typeUrl: '/ibc.applications.transfer.v1.QueryDenomTracesResponse', + value: QueryDenomTracesResponse.encode(message).finish(), + }; + }, +}; +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} +export const QueryParamsRequest = { + typeUrl: '/ibc.applications.transfer.v1.QueryParamsRequest', + encode( + _: QueryParamsRequest, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + return writer; + }, + 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 = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + fromPartial(_: Partial): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, + fromProtoMsg(message: QueryParamsRequestProtoMsg): QueryParamsRequest { + return QueryParamsRequest.decode(message.value); + }, + toProto(message: QueryParamsRequest): Uint8Array { + return QueryParamsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsRequest): QueryParamsRequestProtoMsg { + return { + typeUrl: '/ibc.applications.transfer.v1.QueryParamsRequest', + value: QueryParamsRequest.encode(message).finish(), + }; + }, +}; +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { + params: undefined, + }; +} +export const QueryParamsResponse = { + typeUrl: '/ibc.applications.transfer.v1.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, + ): QueryParamsResponse { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryParamsResponse { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + message.params !== undefined && + (obj.params = message.params ? Params.toJSON(message.params) : undefined); + return obj; + }, + fromPartial(object: Partial): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = + object.params !== undefined && object.params !== null + ? Params.fromPartial(object.params) + : undefined; + return message; + }, + fromProtoMsg(message: QueryParamsResponseProtoMsg): QueryParamsResponse { + return QueryParamsResponse.decode(message.value); + }, + toProto(message: QueryParamsResponse): Uint8Array { + return QueryParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsResponse): QueryParamsResponseProtoMsg { + return { + typeUrl: '/ibc.applications.transfer.v1.QueryParamsResponse', + value: QueryParamsResponse.encode(message).finish(), + }; + }, +}; +function createBaseQueryDenomHashRequest(): QueryDenomHashRequest { + return { + trace: '', + }; +} +export const QueryDenomHashRequest = { + typeUrl: '/ibc.applications.transfer.v1.QueryDenomHashRequest', + encode( + message: QueryDenomHashRequest, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.trace !== '') { + writer.uint32(10).string(message.trace); + } + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): QueryDenomHashRequest { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomHashRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.trace = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryDenomHashRequest { + return { + trace: isSet(object.trace) ? String(object.trace) : '', + }; + }, + toJSON(message: QueryDenomHashRequest): unknown { + const obj: any = {}; + message.trace !== undefined && (obj.trace = message.trace); + return obj; + }, + fromPartial(object: Partial): QueryDenomHashRequest { + const message = createBaseQueryDenomHashRequest(); + message.trace = object.trace ?? ''; + return message; + }, + fromProtoMsg(message: QueryDenomHashRequestProtoMsg): QueryDenomHashRequest { + return QueryDenomHashRequest.decode(message.value); + }, + toProto(message: QueryDenomHashRequest): Uint8Array { + return QueryDenomHashRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryDenomHashRequest): QueryDenomHashRequestProtoMsg { + return { + typeUrl: '/ibc.applications.transfer.v1.QueryDenomHashRequest', + value: QueryDenomHashRequest.encode(message).finish(), + }; + }, +}; +function createBaseQueryDenomHashResponse(): QueryDenomHashResponse { + return { + hash: '', + }; +} +export const QueryDenomHashResponse = { + typeUrl: '/ibc.applications.transfer.v1.QueryDenomHashResponse', + encode( + message: QueryDenomHashResponse, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.hash !== '') { + writer.uint32(10).string(message.hash); + } + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): QueryDenomHashResponse { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomHashResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.hash = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryDenomHashResponse { + return { + hash: isSet(object.hash) ? String(object.hash) : '', + }; + }, + toJSON(message: QueryDenomHashResponse): unknown { + const obj: any = {}; + message.hash !== undefined && (obj.hash = message.hash); + return obj; + }, + fromPartial(object: Partial): QueryDenomHashResponse { + const message = createBaseQueryDenomHashResponse(); + message.hash = object.hash ?? ''; + return message; + }, + fromProtoMsg( + message: QueryDenomHashResponseProtoMsg, + ): QueryDenomHashResponse { + return QueryDenomHashResponse.decode(message.value); + }, + toProto(message: QueryDenomHashResponse): Uint8Array { + return QueryDenomHashResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryDenomHashResponse): QueryDenomHashResponseProtoMsg { + return { + typeUrl: '/ibc.applications.transfer.v1.QueryDenomHashResponse', + value: QueryDenomHashResponse.encode(message).finish(), + }; + }, +}; +function createBaseQueryEscrowAddressRequest(): QueryEscrowAddressRequest { + return { + portId: '', + channelId: '', + }; +} +export const QueryEscrowAddressRequest = { + typeUrl: '/ibc.applications.transfer.v1.QueryEscrowAddressRequest', + encode( + message: QueryEscrowAddressRequest, + 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, + ): QueryEscrowAddressRequest { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEscrowAddressRequest(); + 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): QueryEscrowAddressRequest { + return { + portId: isSet(object.portId) ? String(object.portId) : '', + channelId: isSet(object.channelId) ? String(object.channelId) : '', + }; + }, + toJSON(message: QueryEscrowAddressRequest): unknown { + const obj: any = {}; + message.portId !== undefined && (obj.portId = message.portId); + message.channelId !== undefined && (obj.channelId = message.channelId); + return obj; + }, + fromPartial( + object: Partial, + ): QueryEscrowAddressRequest { + const message = createBaseQueryEscrowAddressRequest(); + message.portId = object.portId ?? ''; + message.channelId = object.channelId ?? ''; + return message; + }, + fromProtoMsg( + message: QueryEscrowAddressRequestProtoMsg, + ): QueryEscrowAddressRequest { + return QueryEscrowAddressRequest.decode(message.value); + }, + toProto(message: QueryEscrowAddressRequest): Uint8Array { + return QueryEscrowAddressRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryEscrowAddressRequest, + ): QueryEscrowAddressRequestProtoMsg { + return { + typeUrl: '/ibc.applications.transfer.v1.QueryEscrowAddressRequest', + value: QueryEscrowAddressRequest.encode(message).finish(), + }; + }, +}; +function createBaseQueryEscrowAddressResponse(): QueryEscrowAddressResponse { + return { + escrowAddress: '', + }; +} +export const QueryEscrowAddressResponse = { + typeUrl: '/ibc.applications.transfer.v1.QueryEscrowAddressResponse', + encode( + message: QueryEscrowAddressResponse, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.escrowAddress !== '') { + writer.uint32(10).string(message.escrowAddress); + } + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): QueryEscrowAddressResponse { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEscrowAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.escrowAddress = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryEscrowAddressResponse { + return { + escrowAddress: isSet(object.escrowAddress) + ? String(object.escrowAddress) + : '', + }; + }, + toJSON(message: QueryEscrowAddressResponse): unknown { + const obj: any = {}; + message.escrowAddress !== undefined && + (obj.escrowAddress = message.escrowAddress); + return obj; + }, + fromPartial( + object: Partial, + ): QueryEscrowAddressResponse { + const message = createBaseQueryEscrowAddressResponse(); + message.escrowAddress = object.escrowAddress ?? ''; + return message; + }, + fromProtoMsg( + message: QueryEscrowAddressResponseProtoMsg, + ): QueryEscrowAddressResponse { + return QueryEscrowAddressResponse.decode(message.value); + }, + toProto(message: QueryEscrowAddressResponse): Uint8Array { + return QueryEscrowAddressResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryEscrowAddressResponse, + ): QueryEscrowAddressResponseProtoMsg { + return { + typeUrl: '/ibc.applications.transfer.v1.QueryEscrowAddressResponse', + value: QueryEscrowAddressResponse.encode(message).finish(), + }; + }, +}; diff --git a/packages/cosmic-proto/src/codegen/ibc/applications/transfer/v1/transfer.ts b/packages/cosmic-proto/src/codegen/ibc/applications/transfer/v1/transfer.ts new file mode 100644 index 00000000000..beb0d1814f4 --- /dev/null +++ b/packages/cosmic-proto/src/codegen/ibc/applications/transfer/v1/transfer.ts @@ -0,0 +1,210 @@ +//@ts-nocheck +import { BinaryReader, BinaryWriter } from '../../../../binary.js'; +import { isSet } from '../../../../helpers.js'; +/** + * 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; +} +export interface DenomTraceProtoMsg { + typeUrl: '/ibc.applications.transfer.v1.DenomTrace'; + value: Uint8Array; +} +/** + * DenomTrace contains the base denomination for ICS20 fungible tokens and the + * source tracing information path. + */ +export interface DenomTraceSDKType { + path: string; + base_denom: string; +} +/** + * Params defines the set of IBC transfer parameters. + * NOTE: To prevent a single token from being transferred, set the + * TransfersEnabled parameter to true and then set the bank module's SendEnabled + * parameter for the denomination to false. + */ +export interface Params { + /** + * send_enabled enables or disables all cross-chain token transfers from this + * chain. + */ + sendEnabled: boolean; + /** + * receive_enabled enables or disables all cross-chain token transfers to this + * chain. + */ + receiveEnabled: boolean; +} +export interface ParamsProtoMsg { + typeUrl: '/ibc.applications.transfer.v1.Params'; + value: Uint8Array; +} +/** + * Params defines the set of IBC transfer parameters. + * NOTE: To prevent a single token from being transferred, set the + * TransfersEnabled parameter to true and then set the bank module's SendEnabled + * parameter for the denomination to false. + */ +export interface ParamsSDKType { + send_enabled: boolean; + receive_enabled: boolean; +} +function createBaseDenomTrace(): DenomTrace { + return { + path: '', + baseDenom: '', + }; +} +export const DenomTrace = { + typeUrl: '/ibc.applications.transfer.v1.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 { + return { + path: isSet(object.path) ? String(object.path) : '', + baseDenom: isSet(object.baseDenom) ? String(object.baseDenom) : '', + }; + }, + 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; + }, + fromProtoMsg(message: DenomTraceProtoMsg): DenomTrace { + return DenomTrace.decode(message.value); + }, + toProto(message: DenomTrace): Uint8Array { + return DenomTrace.encode(message).finish(); + }, + toProtoMsg(message: DenomTrace): DenomTraceProtoMsg { + return { + typeUrl: '/ibc.applications.transfer.v1.DenomTrace', + value: DenomTrace.encode(message).finish(), + }; + }, +}; +function createBaseParams(): Params { + return { + sendEnabled: false, + receiveEnabled: false, + }; +} +export const Params = { + typeUrl: '/ibc.applications.transfer.v1.Params', + encode( + message: Params, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.sendEnabled === true) { + writer.uint32(8).bool(message.sendEnabled); + } + if (message.receiveEnabled === true) { + writer.uint32(16).bool(message.receiveEnabled); + } + return writer; + }, + 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 = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sendEnabled = reader.bool(); + break; + case 2: + message.receiveEnabled = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): Params { + return { + sendEnabled: isSet(object.sendEnabled) + ? Boolean(object.sendEnabled) + : false, + receiveEnabled: isSet(object.receiveEnabled) + ? Boolean(object.receiveEnabled) + : false, + }; + }, + toJSON(message: Params): unknown { + const obj: any = {}; + message.sendEnabled !== undefined && + (obj.sendEnabled = message.sendEnabled); + message.receiveEnabled !== undefined && + (obj.receiveEnabled = message.receiveEnabled); + return obj; + }, + fromPartial(object: Partial): Params { + const message = createBaseParams(); + message.sendEnabled = object.sendEnabled ?? false; + message.receiveEnabled = object.receiveEnabled ?? false; + return message; + }, + fromProtoMsg(message: ParamsProtoMsg): Params { + return Params.decode(message.value); + }, + toProto(message: Params): Uint8Array { + return Params.encode(message).finish(); + }, + toProtoMsg(message: Params): ParamsProtoMsg { + return { + typeUrl: '/ibc.applications.transfer.v1.Params', + value: Params.encode(message).finish(), + }; + }, +}; diff --git a/packages/cosmic-proto/src/codegen/ibc/applications/transfer/v1/tx.ts b/packages/cosmic-proto/src/codegen/ibc/applications/transfer/v1/tx.ts new file mode 100644 index 00000000000..8f7f52f3ab2 --- /dev/null +++ b/packages/cosmic-proto/src/codegen/ibc/applications/transfer/v1/tx.ts @@ -0,0 +1,292 @@ +//@ts-nocheck +import { Coin, CoinSDKType } from '../../../../cosmos/base/v1beta1/coin.js'; +import { Height, HeightSDKType } from '../../../core/client/v1/client.js'; +import { BinaryReader, BinaryWriter } from '../../../../binary.js'; +import { isSet } from '../../../../helpers.js'; +/** + * 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 + */ +export interface MsgTransfer { + /** the port on which the packet will be sent */ + sourcePort: string; + /** the channel by which the packet will be sent */ + sourceChannel: string; + /** the tokens to be transferred */ + token: Coin; + /** the sender address */ + sender: string; + /** the recipient address on the destination chain */ + receiver: string; + /** + * Timeout height relative to the current block height. + * The timeout is disabled when set to 0. + */ + timeoutHeight: Height; + /** + * Timeout timestamp in absolute nanoseconds since unix epoch. + * The timeout is disabled when set to 0. + */ + timeoutTimestamp: bigint; + /** optional memo */ + memo: string; +} +export interface MsgTransferProtoMsg { + typeUrl: '/ibc.applications.transfer.v1.MsgTransfer'; + value: Uint8Array; +} +/** + * 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 + */ +export interface MsgTransferSDKType { + source_port: string; + source_channel: string; + token: CoinSDKType; + sender: string; + receiver: string; + timeout_height: HeightSDKType; + timeout_timestamp: bigint; + memo: string; +} +/** MsgTransferResponse defines the Msg/Transfer response type. */ +export interface MsgTransferResponse { + /** sequence number of the transfer packet sent */ + sequence: bigint; +} +export interface MsgTransferResponseProtoMsg { + typeUrl: '/ibc.applications.transfer.v1.MsgTransferResponse'; + value: Uint8Array; +} +/** MsgTransferResponse defines the Msg/Transfer response type. */ +export interface MsgTransferResponseSDKType { + sequence: bigint; +} +function createBaseMsgTransfer(): MsgTransfer { + return { + sourcePort: '', + sourceChannel: '', + token: Coin.fromPartial({}), + sender: '', + receiver: '', + timeoutHeight: Height.fromPartial({}), + timeoutTimestamp: BigInt(0), + memo: '', + }; +} +export const MsgTransfer = { + typeUrl: '/ibc.applications.transfer.v1.MsgTransfer', + encode( + message: MsgTransfer, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.sourcePort !== '') { + writer.uint32(10).string(message.sourcePort); + } + if (message.sourceChannel !== '') { + writer.uint32(18).string(message.sourceChannel); + } + if (message.token !== undefined) { + Coin.encode(message.token, writer.uint32(26).fork()).ldelim(); + } + if (message.sender !== '') { + writer.uint32(34).string(message.sender); + } + if (message.receiver !== '') { + writer.uint32(42).string(message.receiver); + } + if (message.timeoutHeight !== undefined) { + Height.encode(message.timeoutHeight, writer.uint32(50).fork()).ldelim(); + } + if (message.timeoutTimestamp !== BigInt(0)) { + writer.uint32(56).uint64(message.timeoutTimestamp); + } + if (message.memo !== '') { + writer.uint32(66).string(message.memo); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgTransfer { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgTransfer(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sourcePort = reader.string(); + break; + case 2: + message.sourceChannel = reader.string(); + break; + case 3: + message.token = Coin.decode(reader, reader.uint32()); + break; + case 4: + message.sender = reader.string(); + break; + case 5: + message.receiver = reader.string(); + break; + case 6: + message.timeoutHeight = Height.decode(reader, reader.uint32()); + break; + case 7: + message.timeoutTimestamp = reader.uint64(); + break; + case 8: + message.memo = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgTransfer { + return { + sourcePort: isSet(object.sourcePort) ? String(object.sourcePort) : '', + sourceChannel: isSet(object.sourceChannel) + ? String(object.sourceChannel) + : '', + token: isSet(object.token) ? Coin.fromJSON(object.token) : undefined, + sender: isSet(object.sender) ? String(object.sender) : '', + receiver: isSet(object.receiver) ? String(object.receiver) : '', + timeoutHeight: isSet(object.timeoutHeight) + ? Height.fromJSON(object.timeoutHeight) + : undefined, + timeoutTimestamp: isSet(object.timeoutTimestamp) + ? BigInt(object.timeoutTimestamp.toString()) + : BigInt(0), + memo: isSet(object.memo) ? String(object.memo) : '', + }; + }, + toJSON(message: MsgTransfer): unknown { + const obj: any = {}; + message.sourcePort !== undefined && (obj.sourcePort = message.sourcePort); + message.sourceChannel !== undefined && + (obj.sourceChannel = message.sourceChannel); + message.token !== undefined && + (obj.token = message.token ? Coin.toJSON(message.token) : undefined); + message.sender !== undefined && (obj.sender = message.sender); + message.receiver !== undefined && (obj.receiver = message.receiver); + message.timeoutHeight !== undefined && + (obj.timeoutHeight = message.timeoutHeight + ? Height.toJSON(message.timeoutHeight) + : undefined); + message.timeoutTimestamp !== undefined && + (obj.timeoutTimestamp = ( + message.timeoutTimestamp || BigInt(0) + ).toString()); + message.memo !== undefined && (obj.memo = message.memo); + return obj; + }, + fromPartial(object: Partial): MsgTransfer { + const message = createBaseMsgTransfer(); + message.sourcePort = object.sourcePort ?? ''; + message.sourceChannel = object.sourceChannel ?? ''; + message.token = + object.token !== undefined && object.token !== null + ? Coin.fromPartial(object.token) + : undefined; + message.sender = object.sender ?? ''; + message.receiver = object.receiver ?? ''; + message.timeoutHeight = + object.timeoutHeight !== undefined && object.timeoutHeight !== null + ? Height.fromPartial(object.timeoutHeight) + : undefined; + message.timeoutTimestamp = + object.timeoutTimestamp !== undefined && object.timeoutTimestamp !== null + ? BigInt(object.timeoutTimestamp.toString()) + : BigInt(0); + message.memo = object.memo ?? ''; + return message; + }, + fromProtoMsg(message: MsgTransferProtoMsg): MsgTransfer { + return MsgTransfer.decode(message.value); + }, + toProto(message: MsgTransfer): Uint8Array { + return MsgTransfer.encode(message).finish(); + }, + toProtoMsg(message: MsgTransfer): MsgTransferProtoMsg { + return { + typeUrl: '/ibc.applications.transfer.v1.MsgTransfer', + value: MsgTransfer.encode(message).finish(), + }; + }, +}; +function createBaseMsgTransferResponse(): MsgTransferResponse { + return { + sequence: BigInt(0), + }; +} +export const MsgTransferResponse = { + typeUrl: '/ibc.applications.transfer.v1.MsgTransferResponse', + encode( + message: MsgTransferResponse, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.sequence !== BigInt(0)) { + writer.uint32(8).uint64(message.sequence); + } + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): MsgTransferResponse { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgTransferResponse(); + 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): MsgTransferResponse { + return { + sequence: isSet(object.sequence) + ? BigInt(object.sequence.toString()) + : BigInt(0), + }; + }, + toJSON(message: MsgTransferResponse): unknown { + const obj: any = {}; + message.sequence !== undefined && + (obj.sequence = (message.sequence || BigInt(0)).toString()); + return obj; + }, + fromPartial(object: Partial): MsgTransferResponse { + const message = createBaseMsgTransferResponse(); + message.sequence = + object.sequence !== undefined && object.sequence !== null + ? BigInt(object.sequence.toString()) + : BigInt(0); + return message; + }, + fromProtoMsg(message: MsgTransferResponseProtoMsg): MsgTransferResponse { + return MsgTransferResponse.decode(message.value); + }, + toProto(message: MsgTransferResponse): Uint8Array { + return MsgTransferResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgTransferResponse): MsgTransferResponseProtoMsg { + return { + typeUrl: '/ibc.applications.transfer.v1.MsgTransferResponse', + value: MsgTransferResponse.encode(message).finish(), + }; + }, +}; diff --git a/packages/cosmic-proto/src/codegen/ibc/applications/transfer/v2/packet.ts b/packages/cosmic-proto/src/codegen/ibc/applications/transfer/v2/packet.ts new file mode 100644 index 00000000000..5b35b6665d4 --- /dev/null +++ b/packages/cosmic-proto/src/codegen/ibc/applications/transfer/v2/packet.ts @@ -0,0 +1,147 @@ +//@ts-nocheck +import { BinaryReader, BinaryWriter } from '../../../../binary.js'; +import { isSet } from '../../../../helpers.js'; +/** + * FungibleTokenPacketData defines a struct for the packet payload + * See FungibleTokenPacketData spec: + * https://github.com/cosmos/ibc/tree/master/spec/app/ics-020-fungible-token-transfer#data-structures + */ +export interface FungibleTokenPacketData { + /** the token denomination to be transferred */ + denom: string; + /** the token amount to be transferred */ + amount: string; + /** the sender address */ + sender: string; + /** the recipient address on the destination chain */ + receiver: string; + /** optional memo */ + memo: string; +} +export interface FungibleTokenPacketDataProtoMsg { + typeUrl: '/ibc.applications.transfer.v2.FungibleTokenPacketData'; + value: Uint8Array; +} +/** + * FungibleTokenPacketData defines a struct for the packet payload + * See FungibleTokenPacketData spec: + * https://github.com/cosmos/ibc/tree/master/spec/app/ics-020-fungible-token-transfer#data-structures + */ +export interface FungibleTokenPacketDataSDKType { + denom: string; + amount: string; + sender: string; + receiver: string; + memo: string; +} +function createBaseFungibleTokenPacketData(): FungibleTokenPacketData { + return { + denom: '', + amount: '', + sender: '', + receiver: '', + memo: '', + }; +} +export const FungibleTokenPacketData = { + typeUrl: '/ibc.applications.transfer.v2.FungibleTokenPacketData', + encode( + message: FungibleTokenPacketData, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.denom !== '') { + writer.uint32(10).string(message.denom); + } + if (message.amount !== '') { + writer.uint32(18).string(message.amount); + } + if (message.sender !== '') { + writer.uint32(26).string(message.sender); + } + if (message.receiver !== '') { + writer.uint32(34).string(message.receiver); + } + if (message.memo !== '') { + writer.uint32(42).string(message.memo); + } + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): FungibleTokenPacketData { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFungibleTokenPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.denom = reader.string(); + break; + case 2: + message.amount = reader.string(); + break; + case 3: + message.sender = reader.string(); + break; + case 4: + message.receiver = reader.string(); + break; + case 5: + message.memo = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): FungibleTokenPacketData { + return { + denom: isSet(object.denom) ? String(object.denom) : '', + amount: isSet(object.amount) ? String(object.amount) : '', + sender: isSet(object.sender) ? String(object.sender) : '', + receiver: isSet(object.receiver) ? String(object.receiver) : '', + memo: isSet(object.memo) ? String(object.memo) : '', + }; + }, + toJSON(message: FungibleTokenPacketData): unknown { + const obj: any = {}; + message.denom !== undefined && (obj.denom = message.denom); + message.amount !== undefined && (obj.amount = message.amount); + message.sender !== undefined && (obj.sender = message.sender); + message.receiver !== undefined && (obj.receiver = message.receiver); + message.memo !== undefined && (obj.memo = message.memo); + return obj; + }, + fromPartial( + object: Partial, + ): FungibleTokenPacketData { + const message = createBaseFungibleTokenPacketData(); + message.denom = object.denom ?? ''; + message.amount = object.amount ?? ''; + message.sender = object.sender ?? ''; + message.receiver = object.receiver ?? ''; + message.memo = object.memo ?? ''; + return message; + }, + fromProtoMsg( + message: FungibleTokenPacketDataProtoMsg, + ): FungibleTokenPacketData { + return FungibleTokenPacketData.decode(message.value); + }, + toProto(message: FungibleTokenPacketData): Uint8Array { + return FungibleTokenPacketData.encode(message).finish(); + }, + toProtoMsg( + message: FungibleTokenPacketData, + ): FungibleTokenPacketDataProtoMsg { + return { + typeUrl: '/ibc.applications.transfer.v2.FungibleTokenPacketData', + value: FungibleTokenPacketData.encode(message).finish(), + }; + }, +}; diff --git a/packages/cosmic-proto/src/codegen/ibc/bundle.ts b/packages/cosmic-proto/src/codegen/ibc/bundle.ts index c2871e3274f..d16a1b7a5be 100644 --- a/packages/cosmic-proto/src/codegen/ibc/bundle.ts +++ b/packages/cosmic-proto/src/codegen/ibc/bundle.ts @@ -1,16 +1,124 @@ //@ts-nocheck -import * as _86 from './core/channel/v1/channel.js'; -import * as _87 from './core/client/v1/client.js'; +import * as _86 from './applications/interchain_accounts/controller/v1/controller.js'; +import * as _87 from './applications/interchain_accounts/controller/v1/query.js'; +import * as _88 from './applications/interchain_accounts/controller/v1/tx.js'; +import * as _89 from './applications/interchain_accounts/genesis/v1/genesis.js'; +import * as _90 from './applications/interchain_accounts/host/v1/host.js'; +import * as _91 from './applications/interchain_accounts/host/v1/query.js'; +import * as _92 from './applications/interchain_accounts/v1/account.js'; +import * as _93 from './applications/interchain_accounts/v1/metadata.js'; +import * as _94 from './applications/interchain_accounts/v1/packet.js'; +import * as _95 from './applications/transfer/v1/authz.js'; +import * as _96 from './applications/transfer/v1/genesis.js'; +import * as _97 from './applications/transfer/v1/query.js'; +import * as _98 from './applications/transfer/v1/transfer.js'; +import * as _99 from './applications/transfer/v1/tx.js'; +import * as _100 from './applications/transfer/v2/packet.js'; +import * as _101 from './core/channel/v1/channel.js'; +import * as _102 from './core/channel/v1/genesis.js'; +import * as _103 from './core/channel/v1/query.js'; +import * as _104 from './core/channel/v1/tx.js'; +import * as _105 from './core/client/v1/client.js'; +import * as _106 from './core/client/v1/genesis.js'; +import * as _107 from './core/client/v1/query.js'; +import * as _108 from './core/client/v1/tx.js'; +import * as _109 from './core/commitment/v1/commitment.js'; +import * as _110 from './core/connection/v1/connection.js'; +import * as _111 from './core/connection/v1/genesis.js'; +import * as _112 from './core/connection/v1/query.js'; +import * as _113 from './core/connection/v1/tx.js'; +import * as _114 from './lightclients/localhost/v1/localhost.js'; +import * as _115 from './lightclients/solomachine/v1/solomachine.js'; +import * as _116 from './lightclients/solomachine/v2/solomachine.js'; +import * as _117 from './lightclients/tendermint/v1/tendermint.js'; export namespace ibc { + export namespace applications { + export namespace interchain_accounts { + export namespace controller { + export const v1 = { + ..._86, + ..._87, + ..._88, + }; + } + export namespace genesis { + export const v1 = { + ..._89, + }; + } + export namespace host { + export const v1 = { + ..._90, + ..._91, + }; + } + export const v1 = { + ..._92, + ..._93, + ..._94, + }; + } + export namespace transfer { + export const v1 = { + ..._95, + ..._96, + ..._97, + ..._98, + ..._99, + }; + export const v2 = { + ..._100, + }; + } + } export namespace core { export namespace channel { export const v1 = { - ..._86, + ..._101, + ..._102, + ..._103, + ..._104, }; } export namespace client { export const v1 = { - ..._87, + ..._105, + ..._106, + ..._107, + ..._108, + }; + } + export namespace commitment { + export const v1 = { + ..._109, + }; + } + export namespace connection { + export const v1 = { + ..._110, + ..._111, + ..._112, + ..._113, + }; + } + } + export namespace lightclients { + export namespace localhost { + export const v1 = { + ..._114, + }; + } + export namespace solomachine { + export const v1 = { + ..._115, + }; + export const v2 = { + ..._116, + }; + } + export namespace tendermint { + export const v1 = { + ..._117, }; } } diff --git a/packages/cosmic-proto/src/codegen/ibc/core/channel/v1/genesis.ts b/packages/cosmic-proto/src/codegen/ibc/core/channel/v1/genesis.ts new file mode 100644 index 00000000000..926884670e5 --- /dev/null +++ b/packages/cosmic-proto/src/codegen/ibc/core/channel/v1/genesis.ts @@ -0,0 +1,360 @@ +//@ts-nocheck +import { + IdentifiedChannel, + IdentifiedChannelSDKType, + PacketState, + PacketStateSDKType, +} from './channel.js'; +import { BinaryReader, BinaryWriter } from '../../../../binary.js'; +import { isSet } from '../../../../helpers.js'; +/** GenesisState defines the ibc channel submodule's genesis state. */ +export interface GenesisState { + channels: IdentifiedChannel[]; + acknowledgements: PacketState[]; + commitments: PacketState[]; + receipts: PacketState[]; + sendSequences: PacketSequence[]; + recvSequences: PacketSequence[]; + ackSequences: PacketSequence[]; + /** the sequence for the next generated channel identifier */ + nextChannelSequence: bigint; +} +export interface GenesisStateProtoMsg { + typeUrl: '/ibc.core.channel.v1.GenesisState'; + value: Uint8Array; +} +/** GenesisState defines the ibc channel submodule's genesis state. */ +export interface GenesisStateSDKType { + channels: IdentifiedChannelSDKType[]; + acknowledgements: PacketStateSDKType[]; + commitments: PacketStateSDKType[]; + receipts: PacketStateSDKType[]; + send_sequences: PacketSequenceSDKType[]; + recv_sequences: PacketSequenceSDKType[]; + ack_sequences: PacketSequenceSDKType[]; + next_channel_sequence: bigint; +} +/** + * PacketSequence defines the genesis type necessary to retrieve and store + * next send and receive sequences. + */ +export interface PacketSequence { + portId: string; + channelId: string; + sequence: bigint; +} +export interface PacketSequenceProtoMsg { + typeUrl: '/ibc.core.channel.v1.PacketSequence'; + value: Uint8Array; +} +/** + * PacketSequence defines the genesis type necessary to retrieve and store + * next send and receive sequences. + */ +export interface PacketSequenceSDKType { + port_id: string; + channel_id: string; + sequence: bigint; +} +function createBaseGenesisState(): GenesisState { + return { + channels: [], + acknowledgements: [], + commitments: [], + receipts: [], + sendSequences: [], + recvSequences: [], + ackSequences: [], + nextChannelSequence: BigInt(0), + }; +} +export const GenesisState = { + typeUrl: '/ibc.core.channel.v1.GenesisState', + encode( + message: GenesisState, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + for (const v of message.channels) { + IdentifiedChannel.encode(v!, writer.uint32(10).fork()).ldelim(); + } + 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.sendSequences) { + PacketSequence.encode(v!, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.recvSequences) { + PacketSequence.encode(v!, writer.uint32(50).fork()).ldelim(); + } + for (const v of message.ackSequences) { + PacketSequence.encode(v!, writer.uint32(58).fork()).ldelim(); + } + if (message.nextChannelSequence !== BigInt(0)) { + writer.uint32(64).uint64(message.nextChannelSequence); + } + 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.channels.push( + IdentifiedChannel.decode(reader, reader.uint32()), + ); + break; + 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.sendSequences.push( + PacketSequence.decode(reader, reader.uint32()), + ); + break; + case 6: + message.recvSequences.push( + PacketSequence.decode(reader, reader.uint32()), + ); + break; + case 7: + message.ackSequences.push( + PacketSequence.decode(reader, reader.uint32()), + ); + break; + case 8: + message.nextChannelSequence = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): GenesisState { + return { + channels: Array.isArray(object?.channels) + ? object.channels.map((e: any) => IdentifiedChannel.fromJSON(e)) + : [], + acknowledgements: Array.isArray(object?.acknowledgements) + ? object.acknowledgements.map((e: any) => PacketState.fromJSON(e)) + : [], + commitments: Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => PacketState.fromJSON(e)) + : [], + receipts: Array.isArray(object?.receipts) + ? object.receipts.map((e: any) => PacketState.fromJSON(e)) + : [], + sendSequences: Array.isArray(object?.sendSequences) + ? object.sendSequences.map((e: any) => PacketSequence.fromJSON(e)) + : [], + recvSequences: Array.isArray(object?.recvSequences) + ? object.recvSequences.map((e: any) => PacketSequence.fromJSON(e)) + : [], + ackSequences: Array.isArray(object?.ackSequences) + ? object.ackSequences.map((e: any) => PacketSequence.fromJSON(e)) + : [], + nextChannelSequence: isSet(object.nextChannelSequence) + ? BigInt(object.nextChannelSequence.toString()) + : BigInt(0), + }; + }, + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.channels) { + obj.channels = message.channels.map(e => + e ? IdentifiedChannel.toJSON(e) : undefined, + ); + } else { + obj.channels = []; + } + 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.sendSequences) { + obj.sendSequences = message.sendSequences.map(e => + e ? PacketSequence.toJSON(e) : undefined, + ); + } else { + obj.sendSequences = []; + } + if (message.recvSequences) { + obj.recvSequences = message.recvSequences.map(e => + e ? PacketSequence.toJSON(e) : undefined, + ); + } else { + obj.recvSequences = []; + } + if (message.ackSequences) { + obj.ackSequences = message.ackSequences.map(e => + e ? PacketSequence.toJSON(e) : undefined, + ); + } else { + obj.ackSequences = []; + } + message.nextChannelSequence !== undefined && + (obj.nextChannelSequence = ( + message.nextChannelSequence || BigInt(0) + ).toString()); + return obj; + }, + fromPartial(object: Partial): GenesisState { + const message = createBaseGenesisState(); + message.channels = + object.channels?.map(e => IdentifiedChannel.fromPartial(e)) || []; + 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.sendSequences = + object.sendSequences?.map(e => PacketSequence.fromPartial(e)) || []; + message.recvSequences = + object.recvSequences?.map(e => PacketSequence.fromPartial(e)) || []; + message.ackSequences = + object.ackSequences?.map(e => PacketSequence.fromPartial(e)) || []; + message.nextChannelSequence = + object.nextChannelSequence !== undefined && + object.nextChannelSequence !== null + ? BigInt(object.nextChannelSequence.toString()) + : BigInt(0); + return message; + }, + fromProtoMsg(message: GenesisStateProtoMsg): GenesisState { + return GenesisState.decode(message.value); + }, + toProto(message: GenesisState): Uint8Array { + return GenesisState.encode(message).finish(); + }, + toProtoMsg(message: GenesisState): GenesisStateProtoMsg { + return { + typeUrl: '/ibc.core.channel.v1.GenesisState', + value: GenesisState.encode(message).finish(), + }; + }, +}; +function createBasePacketSequence(): PacketSequence { + return { + portId: '', + channelId: '', + sequence: BigInt(0), + }; +} +export const PacketSequence = { + typeUrl: '/ibc.core.channel.v1.PacketSequence', + encode( + message: PacketSequence, + 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.sequence !== BigInt(0)) { + writer.uint32(24).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.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + case 3: + message.sequence = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): PacketSequence { + return { + portId: isSet(object.portId) ? String(object.portId) : '', + channelId: isSet(object.channelId) ? String(object.channelId) : '', + sequence: isSet(object.sequence) + ? BigInt(object.sequence.toString()) + : BigInt(0), + }; + }, + toJSON(message: PacketSequence): unknown { + const obj: any = {}; + message.portId !== undefined && (obj.portId = message.portId); + message.channelId !== undefined && (obj.channelId = message.channelId); + message.sequence !== undefined && + (obj.sequence = (message.sequence || BigInt(0)).toString()); + return obj; + }, + fromPartial(object: Partial): PacketSequence { + const message = createBasePacketSequence(); + message.portId = object.portId ?? ''; + message.channelId = object.channelId ?? ''; + message.sequence = + object.sequence !== undefined && object.sequence !== null + ? BigInt(object.sequence.toString()) + : BigInt(0); + return message; + }, + fromProtoMsg(message: PacketSequenceProtoMsg): PacketSequence { + return PacketSequence.decode(message.value); + }, + toProto(message: PacketSequence): Uint8Array { + return PacketSequence.encode(message).finish(); + }, + toProtoMsg(message: PacketSequence): PacketSequenceProtoMsg { + return { + typeUrl: '/ibc.core.channel.v1.PacketSequence', + value: PacketSequence.encode(message).finish(), + }; + }, +}; diff --git a/packages/cosmic-proto/src/codegen/ibc/core/channel/v1/query.ts b/packages/cosmic-proto/src/codegen/ibc/core/channel/v1/query.ts new file mode 100644 index 00000000000..0c257aa3999 --- /dev/null +++ b/packages/cosmic-proto/src/codegen/ibc/core/channel/v1/query.ts @@ -0,0 +1,3348 @@ +//@ts-nocheck +import { + PageRequest, + PageRequestSDKType, + PageResponse, + PageResponseSDKType, +} from '../../../../cosmos/base/query/v1beta1/pagination.js'; +import { + Channel, + ChannelSDKType, + IdentifiedChannel, + IdentifiedChannelSDKType, + PacketState, + PacketStateSDKType, +} from './channel.js'; +import { + Height, + HeightSDKType, + IdentifiedClientState, + IdentifiedClientStateSDKType, +} from '../../client/v1/client.js'; +import { Any, AnySDKType } from '../../../../google/protobuf/any.js'; +import { BinaryReader, BinaryWriter } from '../../../../binary.js'; +import { + isSet, + bytesFromBase64, + base64FromBytes, +} from '../../../../helpers.js'; +/** QueryChannelRequest is the request type for the Query/Channel RPC method */ +export interface QueryChannelRequest { + /** port unique identifier */ + portId: string; + /** channel unique identifier */ + channelId: string; +} +export interface QueryChannelRequestProtoMsg { + typeUrl: '/ibc.core.channel.v1.QueryChannelRequest'; + value: Uint8Array; +} +/** QueryChannelRequest is the request type for the Query/Channel RPC method */ +export interface QueryChannelRequestSDKType { + port_id: string; + channel_id: string; +} +/** + * QueryChannelResponse is the response type for the Query/Channel RPC method. + * Besides the Channel end, it includes a proof and the height from which the + * proof was retrieved. + */ +export interface QueryChannelResponse { + /** channel associated with the request identifiers */ + channel?: Channel; + /** merkle proof of existence */ + proof: Uint8Array; + /** height at which the proof was retrieved */ + proofHeight: Height; +} +export interface QueryChannelResponseProtoMsg { + typeUrl: '/ibc.core.channel.v1.QueryChannelResponse'; + value: Uint8Array; +} +/** + * QueryChannelResponse is the response type for the Query/Channel RPC method. + * Besides the Channel end, it includes a proof and the height from which the + * proof was retrieved. + */ +export interface QueryChannelResponseSDKType { + channel?: ChannelSDKType; + proof: Uint8Array; + proof_height: HeightSDKType; +} +/** QueryChannelsRequest is the request type for the Query/Channels RPC method */ +export interface QueryChannelsRequest { + /** pagination request */ + pagination?: PageRequest; +} +export interface QueryChannelsRequestProtoMsg { + typeUrl: '/ibc.core.channel.v1.QueryChannelsRequest'; + value: Uint8Array; +} +/** QueryChannelsRequest is the request type for the Query/Channels RPC method */ +export interface QueryChannelsRequestSDKType { + pagination?: PageRequestSDKType; +} +/** QueryChannelsResponse is the response type for the Query/Channels RPC method. */ +export interface QueryChannelsResponse { + /** list of stored channels of the chain. */ + channels: IdentifiedChannel[]; + /** pagination response */ + pagination?: PageResponse; + /** query block height */ + height: Height; +} +export interface QueryChannelsResponseProtoMsg { + typeUrl: '/ibc.core.channel.v1.QueryChannelsResponse'; + value: Uint8Array; +} +/** QueryChannelsResponse is the response type for the Query/Channels RPC method. */ +export interface QueryChannelsResponseSDKType { + channels: IdentifiedChannelSDKType[]; + pagination?: PageResponseSDKType; + height: HeightSDKType; +} +/** + * QueryConnectionChannelsRequest is the request type for the + * Query/QueryConnectionChannels RPC method + */ +export interface QueryConnectionChannelsRequest { + /** connection unique identifier */ + connection: string; + /** pagination request */ + pagination?: PageRequest; +} +export interface QueryConnectionChannelsRequestProtoMsg { + typeUrl: '/ibc.core.channel.v1.QueryConnectionChannelsRequest'; + value: Uint8Array; +} +/** + * QueryConnectionChannelsRequest is the request type for the + * Query/QueryConnectionChannels RPC method + */ +export interface QueryConnectionChannelsRequestSDKType { + connection: string; + pagination?: PageRequestSDKType; +} +/** + * QueryConnectionChannelsResponse is the Response type for the + * Query/QueryConnectionChannels RPC method + */ +export interface QueryConnectionChannelsResponse { + /** list of channels associated with a connection. */ + channels: IdentifiedChannel[]; + /** pagination response */ + pagination?: PageResponse; + /** query block height */ + height: Height; +} +export interface QueryConnectionChannelsResponseProtoMsg { + typeUrl: '/ibc.core.channel.v1.QueryConnectionChannelsResponse'; + value: Uint8Array; +} +/** + * QueryConnectionChannelsResponse is the Response type for the + * Query/QueryConnectionChannels RPC method + */ +export interface QueryConnectionChannelsResponseSDKType { + channels: IdentifiedChannelSDKType[]; + pagination?: PageResponseSDKType; + height: HeightSDKType; +} +/** + * QueryChannelClientStateRequest is the request type for the Query/ClientState + * RPC method + */ +export interface QueryChannelClientStateRequest { + /** port unique identifier */ + portId: string; + /** channel unique identifier */ + channelId: string; +} +export interface QueryChannelClientStateRequestProtoMsg { + typeUrl: '/ibc.core.channel.v1.QueryChannelClientStateRequest'; + value: Uint8Array; +} +/** + * QueryChannelClientStateRequest is the request type for the Query/ClientState + * RPC method + */ +export interface QueryChannelClientStateRequestSDKType { + port_id: string; + channel_id: string; +} +/** + * QueryChannelClientStateResponse is the Response type for the + * Query/QueryChannelClientState RPC method + */ +export interface QueryChannelClientStateResponse { + /** client state associated with the channel */ + identifiedClientState?: IdentifiedClientState; + /** merkle proof of existence */ + proof: Uint8Array; + /** height at which the proof was retrieved */ + proofHeight: Height; +} +export interface QueryChannelClientStateResponseProtoMsg { + typeUrl: '/ibc.core.channel.v1.QueryChannelClientStateResponse'; + value: Uint8Array; +} +/** + * QueryChannelClientStateResponse is the Response type for the + * Query/QueryChannelClientState RPC method + */ +export interface QueryChannelClientStateResponseSDKType { + identified_client_state?: IdentifiedClientStateSDKType; + proof: Uint8Array; + proof_height: HeightSDKType; +} +/** + * QueryChannelConsensusStateRequest is the request type for the + * Query/ConsensusState RPC method + */ +export interface QueryChannelConsensusStateRequest { + /** port unique identifier */ + portId: string; + /** channel unique identifier */ + channelId: string; + /** revision number of the consensus state */ + revisionNumber: bigint; + /** revision height of the consensus state */ + revisionHeight: bigint; +} +export interface QueryChannelConsensusStateRequestProtoMsg { + typeUrl: '/ibc.core.channel.v1.QueryChannelConsensusStateRequest'; + value: Uint8Array; +} +/** + * QueryChannelConsensusStateRequest is the request type for the + * Query/ConsensusState RPC method + */ +export interface QueryChannelConsensusStateRequestSDKType { + port_id: string; + channel_id: string; + revision_number: bigint; + revision_height: bigint; +} +/** + * QueryChannelClientStateResponse is the Response type for the + * Query/QueryChannelClientState RPC method + */ +export interface QueryChannelConsensusStateResponse { + /** consensus state associated with the channel */ + consensusState?: Any; + /** client ID associated with the consensus state */ + clientId: string; + /** merkle proof of existence */ + proof: Uint8Array; + /** height at which the proof was retrieved */ + proofHeight: Height; +} +export interface QueryChannelConsensusStateResponseProtoMsg { + typeUrl: '/ibc.core.channel.v1.QueryChannelConsensusStateResponse'; + value: Uint8Array; +} +/** + * QueryChannelClientStateResponse is the Response type for the + * Query/QueryChannelClientState RPC method + */ +export interface QueryChannelConsensusStateResponseSDKType { + consensus_state?: AnySDKType; + client_id: string; + proof: Uint8Array; + proof_height: HeightSDKType; +} +/** + * QueryPacketCommitmentRequest is the request type for the + * Query/PacketCommitment RPC method + */ +export interface QueryPacketCommitmentRequest { + /** port unique identifier */ + portId: string; + /** channel unique identifier */ + channelId: string; + /** packet sequence */ + sequence: bigint; +} +export interface QueryPacketCommitmentRequestProtoMsg { + typeUrl: '/ibc.core.channel.v1.QueryPacketCommitmentRequest'; + value: Uint8Array; +} +/** + * QueryPacketCommitmentRequest is the request type for the + * Query/PacketCommitment RPC method + */ +export interface QueryPacketCommitmentRequestSDKType { + port_id: string; + channel_id: string; + sequence: bigint; +} +/** + * QueryPacketCommitmentResponse defines the client query response for a packet + * which also includes a proof and the height from which the proof was + * retrieved + */ +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; +} +export interface QueryPacketCommitmentResponseProtoMsg { + typeUrl: '/ibc.core.channel.v1.QueryPacketCommitmentResponse'; + value: Uint8Array; +} +/** + * QueryPacketCommitmentResponse defines the client query response for a packet + * which also includes a proof and the height from which the proof was + * retrieved + */ +export interface QueryPacketCommitmentResponseSDKType { + commitment: Uint8Array; + proof: Uint8Array; + proof_height: HeightSDKType; +} +/** + * QueryPacketCommitmentsRequest is the request type for the + * Query/QueryPacketCommitments RPC method + */ +export interface QueryPacketCommitmentsRequest { + /** port unique identifier */ + portId: string; + /** channel unique identifier */ + channelId: string; + /** pagination request */ + pagination?: PageRequest; +} +export interface QueryPacketCommitmentsRequestProtoMsg { + typeUrl: '/ibc.core.channel.v1.QueryPacketCommitmentsRequest'; + value: Uint8Array; +} +/** + * QueryPacketCommitmentsRequest is the request type for the + * Query/QueryPacketCommitments RPC method + */ +export interface QueryPacketCommitmentsRequestSDKType { + port_id: string; + channel_id: string; + pagination?: PageRequestSDKType; +} +/** + * QueryPacketCommitmentsResponse is the request type for the + * Query/QueryPacketCommitments RPC method + */ +export interface QueryPacketCommitmentsResponse { + commitments: PacketState[]; + /** pagination response */ + pagination?: PageResponse; + /** query block height */ + height: Height; +} +export interface QueryPacketCommitmentsResponseProtoMsg { + typeUrl: '/ibc.core.channel.v1.QueryPacketCommitmentsResponse'; + value: Uint8Array; +} +/** + * QueryPacketCommitmentsResponse is the request type for the + * Query/QueryPacketCommitments RPC method + */ +export interface QueryPacketCommitmentsResponseSDKType { + commitments: PacketStateSDKType[]; + pagination?: PageResponseSDKType; + height: HeightSDKType; +} +/** + * QueryPacketReceiptRequest is the request type for the + * Query/PacketReceipt RPC method + */ +export interface QueryPacketReceiptRequest { + /** port unique identifier */ + portId: string; + /** channel unique identifier */ + channelId: string; + /** packet sequence */ + sequence: bigint; +} +export interface QueryPacketReceiptRequestProtoMsg { + typeUrl: '/ibc.core.channel.v1.QueryPacketReceiptRequest'; + value: Uint8Array; +} +/** + * QueryPacketReceiptRequest is the request type for the + * Query/PacketReceipt RPC method + */ +export interface QueryPacketReceiptRequestSDKType { + port_id: string; + channel_id: string; + sequence: bigint; +} +/** + * QueryPacketReceiptResponse defines the client query response for a packet + * receipt which also includes a proof, and the height from which the proof was + * retrieved + */ +export interface QueryPacketReceiptResponse { + /** success flag for if receipt exists */ + received: boolean; + /** merkle proof of existence */ + proof: Uint8Array; + /** height at which the proof was retrieved */ + proofHeight: Height; +} +export interface QueryPacketReceiptResponseProtoMsg { + typeUrl: '/ibc.core.channel.v1.QueryPacketReceiptResponse'; + value: Uint8Array; +} +/** + * QueryPacketReceiptResponse defines the client query response for a packet + * receipt which also includes a proof, and the height from which the proof was + * retrieved + */ +export interface QueryPacketReceiptResponseSDKType { + received: boolean; + proof: Uint8Array; + proof_height: HeightSDKType; +} +/** + * QueryPacketAcknowledgementRequest is the request type for the + * Query/PacketAcknowledgement RPC method + */ +export interface QueryPacketAcknowledgementRequest { + /** port unique identifier */ + portId: string; + /** channel unique identifier */ + channelId: string; + /** packet sequence */ + sequence: bigint; +} +export interface QueryPacketAcknowledgementRequestProtoMsg { + typeUrl: '/ibc.core.channel.v1.QueryPacketAcknowledgementRequest'; + value: Uint8Array; +} +/** + * QueryPacketAcknowledgementRequest is the request type for the + * Query/PacketAcknowledgement RPC method + */ +export interface QueryPacketAcknowledgementRequestSDKType { + port_id: string; + channel_id: string; + sequence: bigint; +} +/** + * QueryPacketAcknowledgementResponse defines the client query response for a + * packet which also includes a proof and the height from which the + * proof was retrieved + */ +export interface QueryPacketAcknowledgementResponse { + /** packet associated with the request fields */ + acknowledgement: Uint8Array; + /** merkle proof of existence */ + proof: Uint8Array; + /** height at which the proof was retrieved */ + proofHeight: Height; +} +export interface QueryPacketAcknowledgementResponseProtoMsg { + typeUrl: '/ibc.core.channel.v1.QueryPacketAcknowledgementResponse'; + value: Uint8Array; +} +/** + * QueryPacketAcknowledgementResponse defines the client query response for a + * packet which also includes a proof and the height from which the + * proof was retrieved + */ +export interface QueryPacketAcknowledgementResponseSDKType { + acknowledgement: Uint8Array; + proof: Uint8Array; + proof_height: HeightSDKType; +} +/** + * QueryPacketAcknowledgementsRequest is the request type for the + * Query/QueryPacketCommitments RPC method + */ +export interface QueryPacketAcknowledgementsRequest { + /** port unique identifier */ + portId: string; + /** channel unique identifier */ + channelId: string; + /** pagination request */ + pagination?: PageRequest; + /** list of packet sequences */ + packetCommitmentSequences: bigint[]; +} +export interface QueryPacketAcknowledgementsRequestProtoMsg { + typeUrl: '/ibc.core.channel.v1.QueryPacketAcknowledgementsRequest'; + value: Uint8Array; +} +/** + * QueryPacketAcknowledgementsRequest is the request type for the + * Query/QueryPacketCommitments RPC method + */ +export interface QueryPacketAcknowledgementsRequestSDKType { + port_id: string; + channel_id: string; + pagination?: PageRequestSDKType; + packet_commitment_sequences: 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; +} +export interface QueryPacketAcknowledgementsResponseProtoMsg { + typeUrl: '/ibc.core.channel.v1.QueryPacketAcknowledgementsResponse'; + value: Uint8Array; +} +/** + * QueryPacketAcknowledgemetsResponse is the request type for the + * Query/QueryPacketAcknowledgements RPC method + */ +export interface QueryPacketAcknowledgementsResponseSDKType { + acknowledgements: PacketStateSDKType[]; + pagination?: PageResponseSDKType; + height: HeightSDKType; +} +/** + * QueryUnreceivedPacketsRequest is the request type for the + * Query/UnreceivedPackets RPC method + */ +export interface QueryUnreceivedPacketsRequest { + /** port unique identifier */ + portId: string; + /** channel unique identifier */ + channelId: string; + /** list of packet sequences */ + packetCommitmentSequences: bigint[]; +} +export interface QueryUnreceivedPacketsRequestProtoMsg { + typeUrl: '/ibc.core.channel.v1.QueryUnreceivedPacketsRequest'; + value: Uint8Array; +} +/** + * QueryUnreceivedPacketsRequest is the request type for the + * Query/UnreceivedPackets RPC method + */ +export interface QueryUnreceivedPacketsRequestSDKType { + port_id: string; + channel_id: string; + packet_commitment_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; +} +export interface QueryUnreceivedPacketsResponseProtoMsg { + typeUrl: '/ibc.core.channel.v1.QueryUnreceivedPacketsResponse'; + value: Uint8Array; +} +/** + * QueryUnreceivedPacketsResponse is the response type for the + * Query/UnreceivedPacketCommitments RPC method + */ +export interface QueryUnreceivedPacketsResponseSDKType { + sequences: bigint[]; + height: HeightSDKType; +} +/** + * QueryUnreceivedAcks is the request type for the + * Query/UnreceivedAcks RPC method + */ +export interface QueryUnreceivedAcksRequest { + /** port unique identifier */ + portId: string; + /** channel unique identifier */ + channelId: string; + /** list of acknowledgement sequences */ + packetAckSequences: bigint[]; +} +export interface QueryUnreceivedAcksRequestProtoMsg { + typeUrl: '/ibc.core.channel.v1.QueryUnreceivedAcksRequest'; + value: Uint8Array; +} +/** + * QueryUnreceivedAcks is the request type for the + * Query/UnreceivedAcks RPC method + */ +export interface QueryUnreceivedAcksRequestSDKType { + port_id: string; + channel_id: string; + packet_ack_sequences: 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; +} +export interface QueryUnreceivedAcksResponseProtoMsg { + typeUrl: '/ibc.core.channel.v1.QueryUnreceivedAcksResponse'; + value: Uint8Array; +} +/** + * QueryUnreceivedAcksResponse is the response type for the + * Query/UnreceivedAcks RPC method + */ +export interface QueryUnreceivedAcksResponseSDKType { + sequences: bigint[]; + height: HeightSDKType; +} +/** + * QueryNextSequenceReceiveRequest is the request type for the + * Query/QueryNextSequenceReceiveRequest RPC method + */ +export interface QueryNextSequenceReceiveRequest { + /** port unique identifier */ + portId: string; + /** channel unique identifier */ + channelId: string; +} +export interface QueryNextSequenceReceiveRequestProtoMsg { + typeUrl: '/ibc.core.channel.v1.QueryNextSequenceReceiveRequest'; + value: Uint8Array; +} +/** + * QueryNextSequenceReceiveRequest is the request type for the + * Query/QueryNextSequenceReceiveRequest RPC method + */ +export interface QueryNextSequenceReceiveRequestSDKType { + port_id: string; + channel_id: string; +} +/** + * QuerySequenceResponse is the request type for the + * Query/QueryNextSequenceReceiveResponse RPC method + */ +export interface QueryNextSequenceReceiveResponse { + /** next sequence receive number */ + nextSequenceReceive: bigint; + /** merkle proof of existence */ + proof: Uint8Array; + /** height at which the proof was retrieved */ + proofHeight: Height; +} +export interface QueryNextSequenceReceiveResponseProtoMsg { + typeUrl: '/ibc.core.channel.v1.QueryNextSequenceReceiveResponse'; + value: Uint8Array; +} +/** + * QuerySequenceResponse is the request type for the + * Query/QueryNextSequenceReceiveResponse RPC method + */ +export interface QueryNextSequenceReceiveResponseSDKType { + next_sequence_receive: bigint; + proof: Uint8Array; + proof_height: HeightSDKType; +} +function createBaseQueryChannelRequest(): QueryChannelRequest { + return { + portId: '', + channelId: '', + }; +} +export const QueryChannelRequest = { + typeUrl: '/ibc.core.channel.v1.QueryChannelRequest', + encode( + message: QueryChannelRequest, + 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, + ): QueryChannelRequest { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryChannelRequest(); + 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): QueryChannelRequest { + return { + portId: isSet(object.portId) ? String(object.portId) : '', + channelId: isSet(object.channelId) ? String(object.channelId) : '', + }; + }, + toJSON(message: QueryChannelRequest): unknown { + const obj: any = {}; + message.portId !== undefined && (obj.portId = message.portId); + message.channelId !== undefined && (obj.channelId = message.channelId); + return obj; + }, + fromPartial(object: Partial): QueryChannelRequest { + const message = createBaseQueryChannelRequest(); + message.portId = object.portId ?? ''; + message.channelId = object.channelId ?? ''; + return message; + }, + fromProtoMsg(message: QueryChannelRequestProtoMsg): QueryChannelRequest { + return QueryChannelRequest.decode(message.value); + }, + toProto(message: QueryChannelRequest): Uint8Array { + return QueryChannelRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryChannelRequest): QueryChannelRequestProtoMsg { + return { + typeUrl: '/ibc.core.channel.v1.QueryChannelRequest', + value: QueryChannelRequest.encode(message).finish(), + }; + }, +}; +function createBaseQueryChannelResponse(): QueryChannelResponse { + return { + channel: undefined, + proof: new Uint8Array(), + proofHeight: Height.fromPartial({}), + }; +} +export const QueryChannelResponse = { + typeUrl: '/ibc.core.channel.v1.QueryChannelResponse', + encode( + message: QueryChannelResponse, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.channel !== undefined) { + Channel.encode(message.channel, writer.uint32(10).fork()).ldelim(); + } + 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, + ): QueryChannelResponse { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryChannelResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.channel = Channel.decode(reader, reader.uint32()); + 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): QueryChannelResponse { + return { + channel: isSet(object.channel) + ? Channel.fromJSON(object.channel) + : undefined, + proof: isSet(object.proof) + ? bytesFromBase64(object.proof) + : new Uint8Array(), + proofHeight: isSet(object.proofHeight) + ? Height.fromJSON(object.proofHeight) + : undefined, + }; + }, + toJSON(message: QueryChannelResponse): unknown { + const obj: any = {}; + message.channel !== undefined && + (obj.channel = message.channel + ? Channel.toJSON(message.channel) + : undefined); + 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): QueryChannelResponse { + const message = createBaseQueryChannelResponse(); + message.channel = + object.channel !== undefined && object.channel !== null + ? Channel.fromPartial(object.channel) + : undefined; + message.proof = object.proof ?? new Uint8Array(); + message.proofHeight = + object.proofHeight !== undefined && object.proofHeight !== null + ? Height.fromPartial(object.proofHeight) + : undefined; + return message; + }, + fromProtoMsg(message: QueryChannelResponseProtoMsg): QueryChannelResponse { + return QueryChannelResponse.decode(message.value); + }, + toProto(message: QueryChannelResponse): Uint8Array { + return QueryChannelResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryChannelResponse): QueryChannelResponseProtoMsg { + return { + typeUrl: '/ibc.core.channel.v1.QueryChannelResponse', + value: QueryChannelResponse.encode(message).finish(), + }; + }, +}; +function createBaseQueryChannelsRequest(): QueryChannelsRequest { + return { + pagination: undefined, + }; +} +export const QueryChannelsRequest = { + typeUrl: '/ibc.core.channel.v1.QueryChannelsRequest', + encode( + message: QueryChannelsRequest, + 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, + ): QueryChannelsRequest { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryChannelsRequest(); + 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): QueryChannelsRequest { + return { + pagination: isSet(object.pagination) + ? PageRequest.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message: QueryChannelsRequest): unknown { + const obj: any = {}; + message.pagination !== undefined && + (obj.pagination = message.pagination + ? PageRequest.toJSON(message.pagination) + : undefined); + return obj; + }, + fromPartial(object: Partial): QueryChannelsRequest { + const message = createBaseQueryChannelsRequest(); + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, + fromProtoMsg(message: QueryChannelsRequestProtoMsg): QueryChannelsRequest { + return QueryChannelsRequest.decode(message.value); + }, + toProto(message: QueryChannelsRequest): Uint8Array { + return QueryChannelsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryChannelsRequest): QueryChannelsRequestProtoMsg { + return { + typeUrl: '/ibc.core.channel.v1.QueryChannelsRequest', + value: QueryChannelsRequest.encode(message).finish(), + }; + }, +}; +function createBaseQueryChannelsResponse(): QueryChannelsResponse { + return { + channels: [], + pagination: undefined, + height: Height.fromPartial({}), + }; +} +export const QueryChannelsResponse = { + typeUrl: '/ibc.core.channel.v1.QueryChannelsResponse', + encode( + message: QueryChannelsResponse, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + for (const v of message.channels) { + IdentifiedChannel.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, + ): QueryChannelsResponse { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryChannelsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.channels.push( + IdentifiedChannel.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): QueryChannelsResponse { + return { + channels: Array.isArray(object?.channels) + ? object.channels.map((e: any) => IdentifiedChannel.fromJSON(e)) + : [], + pagination: isSet(object.pagination) + ? PageResponse.fromJSON(object.pagination) + : undefined, + height: isSet(object.height) ? Height.fromJSON(object.height) : undefined, + }; + }, + toJSON(message: QueryChannelsResponse): unknown { + const obj: any = {}; + if (message.channels) { + obj.channels = message.channels.map(e => + e ? IdentifiedChannel.toJSON(e) : undefined, + ); + } else { + obj.channels = []; + } + 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): QueryChannelsResponse { + const message = createBaseQueryChannelsResponse(); + message.channels = + object.channels?.map(e => IdentifiedChannel.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageResponse.fromPartial(object.pagination) + : undefined; + message.height = + object.height !== undefined && object.height !== null + ? Height.fromPartial(object.height) + : undefined; + return message; + }, + fromProtoMsg(message: QueryChannelsResponseProtoMsg): QueryChannelsResponse { + return QueryChannelsResponse.decode(message.value); + }, + toProto(message: QueryChannelsResponse): Uint8Array { + return QueryChannelsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryChannelsResponse): QueryChannelsResponseProtoMsg { + return { + typeUrl: '/ibc.core.channel.v1.QueryChannelsResponse', + value: QueryChannelsResponse.encode(message).finish(), + }; + }, +}; +function createBaseQueryConnectionChannelsRequest(): QueryConnectionChannelsRequest { + return { + connection: '', + pagination: undefined, + }; +} +export const QueryConnectionChannelsRequest = { + typeUrl: '/ibc.core.channel.v1.QueryConnectionChannelsRequest', + encode( + message: QueryConnectionChannelsRequest, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.connection !== '') { + writer.uint32(10).string(message.connection); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): QueryConnectionChannelsRequest { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConnectionChannelsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.connection = reader.string(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryConnectionChannelsRequest { + return { + connection: isSet(object.connection) ? String(object.connection) : '', + pagination: isSet(object.pagination) + ? PageRequest.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message: QueryConnectionChannelsRequest): unknown { + const obj: any = {}; + message.connection !== undefined && (obj.connection = message.connection); + message.pagination !== undefined && + (obj.pagination = message.pagination + ? PageRequest.toJSON(message.pagination) + : undefined); + return obj; + }, + fromPartial( + object: Partial, + ): QueryConnectionChannelsRequest { + const message = createBaseQueryConnectionChannelsRequest(); + message.connection = object.connection ?? ''; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, + fromProtoMsg( + message: QueryConnectionChannelsRequestProtoMsg, + ): QueryConnectionChannelsRequest { + return QueryConnectionChannelsRequest.decode(message.value); + }, + toProto(message: QueryConnectionChannelsRequest): Uint8Array { + return QueryConnectionChannelsRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryConnectionChannelsRequest, + ): QueryConnectionChannelsRequestProtoMsg { + return { + typeUrl: '/ibc.core.channel.v1.QueryConnectionChannelsRequest', + value: QueryConnectionChannelsRequest.encode(message).finish(), + }; + }, +}; +function createBaseQueryConnectionChannelsResponse(): QueryConnectionChannelsResponse { + return { + channels: [], + pagination: undefined, + height: Height.fromPartial({}), + }; +} +export const QueryConnectionChannelsResponse = { + typeUrl: '/ibc.core.channel.v1.QueryConnectionChannelsResponse', + encode( + message: QueryConnectionChannelsResponse, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + for (const v of message.channels) { + IdentifiedChannel.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, + ): QueryConnectionChannelsResponse { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConnectionChannelsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.channels.push( + IdentifiedChannel.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): QueryConnectionChannelsResponse { + return { + channels: Array.isArray(object?.channels) + ? object.channels.map((e: any) => IdentifiedChannel.fromJSON(e)) + : [], + pagination: isSet(object.pagination) + ? PageResponse.fromJSON(object.pagination) + : undefined, + height: isSet(object.height) ? Height.fromJSON(object.height) : undefined, + }; + }, + toJSON(message: QueryConnectionChannelsResponse): unknown { + const obj: any = {}; + if (message.channels) { + obj.channels = message.channels.map(e => + e ? IdentifiedChannel.toJSON(e) : undefined, + ); + } else { + obj.channels = []; + } + 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, + ): QueryConnectionChannelsResponse { + const message = createBaseQueryConnectionChannelsResponse(); + message.channels = + object.channels?.map(e => IdentifiedChannel.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageResponse.fromPartial(object.pagination) + : undefined; + message.height = + object.height !== undefined && object.height !== null + ? Height.fromPartial(object.height) + : undefined; + return message; + }, + fromProtoMsg( + message: QueryConnectionChannelsResponseProtoMsg, + ): QueryConnectionChannelsResponse { + return QueryConnectionChannelsResponse.decode(message.value); + }, + toProto(message: QueryConnectionChannelsResponse): Uint8Array { + return QueryConnectionChannelsResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryConnectionChannelsResponse, + ): QueryConnectionChannelsResponseProtoMsg { + return { + typeUrl: '/ibc.core.channel.v1.QueryConnectionChannelsResponse', + value: QueryConnectionChannelsResponse.encode(message).finish(), + }; + }, +}; +function createBaseQueryChannelClientStateRequest(): QueryChannelClientStateRequest { + return { + portId: '', + channelId: '', + }; +} +export const QueryChannelClientStateRequest = { + typeUrl: '/ibc.core.channel.v1.QueryChannelClientStateRequest', + encode( + message: QueryChannelClientStateRequest, + 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, + ): QueryChannelClientStateRequest { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryChannelClientStateRequest(); + 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): QueryChannelClientStateRequest { + return { + portId: isSet(object.portId) ? String(object.portId) : '', + channelId: isSet(object.channelId) ? String(object.channelId) : '', + }; + }, + toJSON(message: QueryChannelClientStateRequest): unknown { + const obj: any = {}; + message.portId !== undefined && (obj.portId = message.portId); + message.channelId !== undefined && (obj.channelId = message.channelId); + return obj; + }, + fromPartial( + object: Partial, + ): QueryChannelClientStateRequest { + const message = createBaseQueryChannelClientStateRequest(); + message.portId = object.portId ?? ''; + message.channelId = object.channelId ?? ''; + return message; + }, + fromProtoMsg( + message: QueryChannelClientStateRequestProtoMsg, + ): QueryChannelClientStateRequest { + return QueryChannelClientStateRequest.decode(message.value); + }, + toProto(message: QueryChannelClientStateRequest): Uint8Array { + return QueryChannelClientStateRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryChannelClientStateRequest, + ): QueryChannelClientStateRequestProtoMsg { + return { + typeUrl: '/ibc.core.channel.v1.QueryChannelClientStateRequest', + value: QueryChannelClientStateRequest.encode(message).finish(), + }; + }, +}; +function createBaseQueryChannelClientStateResponse(): QueryChannelClientStateResponse { + return { + identifiedClientState: undefined, + proof: new Uint8Array(), + proofHeight: Height.fromPartial({}), + }; +} +export const QueryChannelClientStateResponse = { + typeUrl: '/ibc.core.channel.v1.QueryChannelClientStateResponse', + encode( + message: QueryChannelClientStateResponse, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.identifiedClientState !== undefined) { + IdentifiedClientState.encode( + message.identifiedClientState, + writer.uint32(10).fork(), + ).ldelim(); + } + 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, + ): QueryChannelClientStateResponse { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryChannelClientStateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.identifiedClientState = IdentifiedClientState.decode( + reader, + reader.uint32(), + ); + 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): QueryChannelClientStateResponse { + return { + identifiedClientState: isSet(object.identifiedClientState) + ? IdentifiedClientState.fromJSON(object.identifiedClientState) + : undefined, + proof: isSet(object.proof) + ? bytesFromBase64(object.proof) + : new Uint8Array(), + proofHeight: isSet(object.proofHeight) + ? Height.fromJSON(object.proofHeight) + : undefined, + }; + }, + toJSON(message: QueryChannelClientStateResponse): unknown { + const obj: any = {}; + message.identifiedClientState !== undefined && + (obj.identifiedClientState = message.identifiedClientState + ? IdentifiedClientState.toJSON(message.identifiedClientState) + : undefined); + 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, + ): QueryChannelClientStateResponse { + const message = createBaseQueryChannelClientStateResponse(); + message.identifiedClientState = + object.identifiedClientState !== undefined && + object.identifiedClientState !== null + ? IdentifiedClientState.fromPartial(object.identifiedClientState) + : undefined; + message.proof = object.proof ?? new Uint8Array(); + message.proofHeight = + object.proofHeight !== undefined && object.proofHeight !== null + ? Height.fromPartial(object.proofHeight) + : undefined; + return message; + }, + fromProtoMsg( + message: QueryChannelClientStateResponseProtoMsg, + ): QueryChannelClientStateResponse { + return QueryChannelClientStateResponse.decode(message.value); + }, + toProto(message: QueryChannelClientStateResponse): Uint8Array { + return QueryChannelClientStateResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryChannelClientStateResponse, + ): QueryChannelClientStateResponseProtoMsg { + return { + typeUrl: '/ibc.core.channel.v1.QueryChannelClientStateResponse', + value: QueryChannelClientStateResponse.encode(message).finish(), + }; + }, +}; +function createBaseQueryChannelConsensusStateRequest(): QueryChannelConsensusStateRequest { + return { + portId: '', + channelId: '', + revisionNumber: BigInt(0), + revisionHeight: BigInt(0), + }; +} +export const QueryChannelConsensusStateRequest = { + typeUrl: '/ibc.core.channel.v1.QueryChannelConsensusStateRequest', + encode( + message: QueryChannelConsensusStateRequest, + 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.revisionNumber !== BigInt(0)) { + writer.uint32(24).uint64(message.revisionNumber); + } + if (message.revisionHeight !== BigInt(0)) { + writer.uint32(32).uint64(message.revisionHeight); + } + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): QueryChannelConsensusStateRequest { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryChannelConsensusStateRequest(); + 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.revisionNumber = reader.uint64(); + break; + case 4: + message.revisionHeight = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryChannelConsensusStateRequest { + return { + portId: isSet(object.portId) ? String(object.portId) : '', + channelId: isSet(object.channelId) ? String(object.channelId) : '', + revisionNumber: isSet(object.revisionNumber) + ? BigInt(object.revisionNumber.toString()) + : BigInt(0), + revisionHeight: isSet(object.revisionHeight) + ? BigInt(object.revisionHeight.toString()) + : BigInt(0), + }; + }, + toJSON(message: QueryChannelConsensusStateRequest): unknown { + const obj: any = {}; + message.portId !== undefined && (obj.portId = message.portId); + message.channelId !== undefined && (obj.channelId = message.channelId); + message.revisionNumber !== undefined && + (obj.revisionNumber = (message.revisionNumber || BigInt(0)).toString()); + message.revisionHeight !== undefined && + (obj.revisionHeight = (message.revisionHeight || BigInt(0)).toString()); + return obj; + }, + fromPartial( + object: Partial, + ): QueryChannelConsensusStateRequest { + const message = createBaseQueryChannelConsensusStateRequest(); + message.portId = object.portId ?? ''; + message.channelId = object.channelId ?? ''; + message.revisionNumber = + object.revisionNumber !== undefined && object.revisionNumber !== null + ? BigInt(object.revisionNumber.toString()) + : BigInt(0); + message.revisionHeight = + object.revisionHeight !== undefined && object.revisionHeight !== null + ? BigInt(object.revisionHeight.toString()) + : BigInt(0); + return message; + }, + fromProtoMsg( + message: QueryChannelConsensusStateRequestProtoMsg, + ): QueryChannelConsensusStateRequest { + return QueryChannelConsensusStateRequest.decode(message.value); + }, + toProto(message: QueryChannelConsensusStateRequest): Uint8Array { + return QueryChannelConsensusStateRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryChannelConsensusStateRequest, + ): QueryChannelConsensusStateRequestProtoMsg { + return { + typeUrl: '/ibc.core.channel.v1.QueryChannelConsensusStateRequest', + value: QueryChannelConsensusStateRequest.encode(message).finish(), + }; + }, +}; +function createBaseQueryChannelConsensusStateResponse(): QueryChannelConsensusStateResponse { + return { + consensusState: undefined, + clientId: '', + proof: new Uint8Array(), + proofHeight: Height.fromPartial({}), + }; +} +export const QueryChannelConsensusStateResponse = { + typeUrl: '/ibc.core.channel.v1.QueryChannelConsensusStateResponse', + encode( + message: QueryChannelConsensusStateResponse, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.consensusState !== undefined) { + Any.encode(message.consensusState, writer.uint32(10).fork()).ldelim(); + } + if (message.clientId !== '') { + writer.uint32(18).string(message.clientId); + } + 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, + ): QueryChannelConsensusStateResponse { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryChannelConsensusStateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.consensusState = Any.decode(reader, reader.uint32()); + break; + case 2: + message.clientId = reader.string(); + 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): QueryChannelConsensusStateResponse { + return { + consensusState: isSet(object.consensusState) + ? Any.fromJSON(object.consensusState) + : undefined, + clientId: isSet(object.clientId) ? String(object.clientId) : '', + proof: isSet(object.proof) + ? bytesFromBase64(object.proof) + : new Uint8Array(), + proofHeight: isSet(object.proofHeight) + ? Height.fromJSON(object.proofHeight) + : undefined, + }; + }, + toJSON(message: QueryChannelConsensusStateResponse): unknown { + const obj: any = {}; + message.consensusState !== undefined && + (obj.consensusState = message.consensusState + ? Any.toJSON(message.consensusState) + : undefined); + 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); + return obj; + }, + fromPartial( + object: Partial, + ): QueryChannelConsensusStateResponse { + const message = createBaseQueryChannelConsensusStateResponse(); + message.consensusState = + object.consensusState !== undefined && object.consensusState !== null + ? Any.fromPartial(object.consensusState) + : undefined; + message.clientId = object.clientId ?? ''; + message.proof = object.proof ?? new Uint8Array(); + message.proofHeight = + object.proofHeight !== undefined && object.proofHeight !== null + ? Height.fromPartial(object.proofHeight) + : undefined; + return message; + }, + fromProtoMsg( + message: QueryChannelConsensusStateResponseProtoMsg, + ): QueryChannelConsensusStateResponse { + return QueryChannelConsensusStateResponse.decode(message.value); + }, + toProto(message: QueryChannelConsensusStateResponse): Uint8Array { + return QueryChannelConsensusStateResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryChannelConsensusStateResponse, + ): QueryChannelConsensusStateResponseProtoMsg { + return { + typeUrl: '/ibc.core.channel.v1.QueryChannelConsensusStateResponse', + value: QueryChannelConsensusStateResponse.encode(message).finish(), + }; + }, +}; +function createBaseQueryPacketCommitmentRequest(): QueryPacketCommitmentRequest { + return { + portId: '', + channelId: '', + sequence: BigInt(0), + }; +} +export const QueryPacketCommitmentRequest = { + typeUrl: '/ibc.core.channel.v1.QueryPacketCommitmentRequest', + encode( + message: QueryPacketCommitmentRequest, + 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.sequence !== BigInt(0)) { + writer.uint32(24).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.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + case 3: + message.sequence = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryPacketCommitmentRequest { + return { + portId: isSet(object.portId) ? String(object.portId) : '', + channelId: isSet(object.channelId) ? String(object.channelId) : '', + sequence: isSet(object.sequence) + ? BigInt(object.sequence.toString()) + : BigInt(0), + }; + }, + toJSON(message: QueryPacketCommitmentRequest): unknown { + const obj: any = {}; + message.portId !== undefined && (obj.portId = message.portId); + message.channelId !== undefined && (obj.channelId = message.channelId); + message.sequence !== undefined && + (obj.sequence = (message.sequence || BigInt(0)).toString()); + return obj; + }, + fromPartial( + object: Partial, + ): QueryPacketCommitmentRequest { + const message = createBaseQueryPacketCommitmentRequest(); + message.portId = object.portId ?? ''; + message.channelId = object.channelId ?? ''; + message.sequence = + object.sequence !== undefined && object.sequence !== null + ? BigInt(object.sequence.toString()) + : BigInt(0); + return message; + }, + fromProtoMsg( + message: QueryPacketCommitmentRequestProtoMsg, + ): QueryPacketCommitmentRequest { + return QueryPacketCommitmentRequest.decode(message.value); + }, + toProto(message: QueryPacketCommitmentRequest): Uint8Array { + return QueryPacketCommitmentRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryPacketCommitmentRequest, + ): QueryPacketCommitmentRequestProtoMsg { + return { + typeUrl: '/ibc.core.channel.v1.QueryPacketCommitmentRequest', + value: QueryPacketCommitmentRequest.encode(message).finish(), + }; + }, +}; +function createBaseQueryPacketCommitmentResponse(): QueryPacketCommitmentResponse { + return { + commitment: new Uint8Array(), + proof: new Uint8Array(), + proofHeight: Height.fromPartial({}), + }; +} +export const QueryPacketCommitmentResponse = { + typeUrl: '/ibc.core.channel.v1.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 { + return { + commitment: isSet(object.commitment) + ? bytesFromBase64(object.commitment) + : new Uint8Array(), + proof: isSet(object.proof) + ? bytesFromBase64(object.proof) + : new Uint8Array(), + proofHeight: isSet(object.proofHeight) + ? Height.fromJSON(object.proofHeight) + : undefined, + }; + }, + 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(); + message.proofHeight = + object.proofHeight !== undefined && object.proofHeight !== null + ? Height.fromPartial(object.proofHeight) + : undefined; + return message; + }, + fromProtoMsg( + message: QueryPacketCommitmentResponseProtoMsg, + ): QueryPacketCommitmentResponse { + return QueryPacketCommitmentResponse.decode(message.value); + }, + toProto(message: QueryPacketCommitmentResponse): Uint8Array { + return QueryPacketCommitmentResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryPacketCommitmentResponse, + ): QueryPacketCommitmentResponseProtoMsg { + return { + typeUrl: '/ibc.core.channel.v1.QueryPacketCommitmentResponse', + value: QueryPacketCommitmentResponse.encode(message).finish(), + }; + }, +}; +function createBaseQueryPacketCommitmentsRequest(): QueryPacketCommitmentsRequest { + return { + portId: '', + channelId: '', + pagination: undefined, + }; +} +export const QueryPacketCommitmentsRequest = { + typeUrl: '/ibc.core.channel.v1.QueryPacketCommitmentsRequest', + encode( + message: QueryPacketCommitmentsRequest, + 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.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(26).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.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + case 3: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryPacketCommitmentsRequest { + return { + portId: isSet(object.portId) ? String(object.portId) : '', + channelId: isSet(object.channelId) ? String(object.channelId) : '', + pagination: isSet(object.pagination) + ? PageRequest.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message: QueryPacketCommitmentsRequest): unknown { + const obj: any = {}; + message.portId !== undefined && (obj.portId = message.portId); + message.channelId !== undefined && (obj.channelId = message.channelId); + message.pagination !== undefined && + (obj.pagination = message.pagination + ? PageRequest.toJSON(message.pagination) + : undefined); + return obj; + }, + fromPartial( + object: Partial, + ): QueryPacketCommitmentsRequest { + const message = createBaseQueryPacketCommitmentsRequest(); + message.portId = object.portId ?? ''; + message.channelId = object.channelId ?? ''; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, + fromProtoMsg( + message: QueryPacketCommitmentsRequestProtoMsg, + ): QueryPacketCommitmentsRequest { + return QueryPacketCommitmentsRequest.decode(message.value); + }, + toProto(message: QueryPacketCommitmentsRequest): Uint8Array { + return QueryPacketCommitmentsRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryPacketCommitmentsRequest, + ): QueryPacketCommitmentsRequestProtoMsg { + return { + typeUrl: '/ibc.core.channel.v1.QueryPacketCommitmentsRequest', + value: QueryPacketCommitmentsRequest.encode(message).finish(), + }; + }, +}; +function createBaseQueryPacketCommitmentsResponse(): QueryPacketCommitmentsResponse { + return { + commitments: [], + pagination: undefined, + height: Height.fromPartial({}), + }; +} +export const QueryPacketCommitmentsResponse = { + typeUrl: '/ibc.core.channel.v1.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 { + return { + commitments: Array.isArray(object?.commitments) + ? object.commitments.map((e: any) => PacketState.fromJSON(e)) + : [], + pagination: isSet(object.pagination) + ? PageResponse.fromJSON(object.pagination) + : undefined, + height: isSet(object.height) ? Height.fromJSON(object.height) : undefined, + }; + }, + 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)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageResponse.fromPartial(object.pagination) + : undefined; + message.height = + object.height !== undefined && object.height !== null + ? Height.fromPartial(object.height) + : undefined; + return message; + }, + fromProtoMsg( + message: QueryPacketCommitmentsResponseProtoMsg, + ): QueryPacketCommitmentsResponse { + return QueryPacketCommitmentsResponse.decode(message.value); + }, + toProto(message: QueryPacketCommitmentsResponse): Uint8Array { + return QueryPacketCommitmentsResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryPacketCommitmentsResponse, + ): QueryPacketCommitmentsResponseProtoMsg { + return { + typeUrl: '/ibc.core.channel.v1.QueryPacketCommitmentsResponse', + value: QueryPacketCommitmentsResponse.encode(message).finish(), + }; + }, +}; +function createBaseQueryPacketReceiptRequest(): QueryPacketReceiptRequest { + return { + portId: '', + channelId: '', + sequence: BigInt(0), + }; +} +export const QueryPacketReceiptRequest = { + typeUrl: '/ibc.core.channel.v1.QueryPacketReceiptRequest', + encode( + message: QueryPacketReceiptRequest, + 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.sequence !== BigInt(0)) { + writer.uint32(24).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.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + case 3: + message.sequence = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryPacketReceiptRequest { + return { + portId: isSet(object.portId) ? String(object.portId) : '', + channelId: isSet(object.channelId) ? String(object.channelId) : '', + sequence: isSet(object.sequence) + ? BigInt(object.sequence.toString()) + : BigInt(0), + }; + }, + toJSON(message: QueryPacketReceiptRequest): unknown { + const obj: any = {}; + message.portId !== undefined && (obj.portId = message.portId); + message.channelId !== undefined && (obj.channelId = message.channelId); + message.sequence !== undefined && + (obj.sequence = (message.sequence || BigInt(0)).toString()); + return obj; + }, + fromPartial( + object: Partial, + ): QueryPacketReceiptRequest { + const message = createBaseQueryPacketReceiptRequest(); + message.portId = object.portId ?? ''; + message.channelId = object.channelId ?? ''; + message.sequence = + object.sequence !== undefined && object.sequence !== null + ? BigInt(object.sequence.toString()) + : BigInt(0); + return message; + }, + fromProtoMsg( + message: QueryPacketReceiptRequestProtoMsg, + ): QueryPacketReceiptRequest { + return QueryPacketReceiptRequest.decode(message.value); + }, + toProto(message: QueryPacketReceiptRequest): Uint8Array { + return QueryPacketReceiptRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryPacketReceiptRequest, + ): QueryPacketReceiptRequestProtoMsg { + return { + typeUrl: '/ibc.core.channel.v1.QueryPacketReceiptRequest', + value: QueryPacketReceiptRequest.encode(message).finish(), + }; + }, +}; +function createBaseQueryPacketReceiptResponse(): QueryPacketReceiptResponse { + return { + received: false, + proof: new Uint8Array(), + proofHeight: Height.fromPartial({}), + }; +} +export const QueryPacketReceiptResponse = { + typeUrl: '/ibc.core.channel.v1.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 { + return { + received: isSet(object.received) ? Boolean(object.received) : false, + proof: isSet(object.proof) + ? bytesFromBase64(object.proof) + : new Uint8Array(), + proofHeight: isSet(object.proofHeight) + ? Height.fromJSON(object.proofHeight) + : undefined, + }; + }, + 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(); + message.proofHeight = + object.proofHeight !== undefined && object.proofHeight !== null + ? Height.fromPartial(object.proofHeight) + : undefined; + return message; + }, + fromProtoMsg( + message: QueryPacketReceiptResponseProtoMsg, + ): QueryPacketReceiptResponse { + return QueryPacketReceiptResponse.decode(message.value); + }, + toProto(message: QueryPacketReceiptResponse): Uint8Array { + return QueryPacketReceiptResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryPacketReceiptResponse, + ): QueryPacketReceiptResponseProtoMsg { + return { + typeUrl: '/ibc.core.channel.v1.QueryPacketReceiptResponse', + value: QueryPacketReceiptResponse.encode(message).finish(), + }; + }, +}; +function createBaseQueryPacketAcknowledgementRequest(): QueryPacketAcknowledgementRequest { + return { + portId: '', + channelId: '', + sequence: BigInt(0), + }; +} +export const QueryPacketAcknowledgementRequest = { + typeUrl: '/ibc.core.channel.v1.QueryPacketAcknowledgementRequest', + encode( + message: QueryPacketAcknowledgementRequest, + 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.sequence !== BigInt(0)) { + writer.uint32(24).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.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + case 3: + message.sequence = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryPacketAcknowledgementRequest { + return { + portId: isSet(object.portId) ? String(object.portId) : '', + channelId: isSet(object.channelId) ? String(object.channelId) : '', + sequence: isSet(object.sequence) + ? BigInt(object.sequence.toString()) + : BigInt(0), + }; + }, + toJSON(message: QueryPacketAcknowledgementRequest): unknown { + const obj: any = {}; + message.portId !== undefined && (obj.portId = message.portId); + message.channelId !== undefined && (obj.channelId = message.channelId); + message.sequence !== undefined && + (obj.sequence = (message.sequence || BigInt(0)).toString()); + return obj; + }, + fromPartial( + object: Partial, + ): QueryPacketAcknowledgementRequest { + const message = createBaseQueryPacketAcknowledgementRequest(); + message.portId = object.portId ?? ''; + message.channelId = object.channelId ?? ''; + message.sequence = + object.sequence !== undefined && object.sequence !== null + ? BigInt(object.sequence.toString()) + : BigInt(0); + return message; + }, + fromProtoMsg( + message: QueryPacketAcknowledgementRequestProtoMsg, + ): QueryPacketAcknowledgementRequest { + return QueryPacketAcknowledgementRequest.decode(message.value); + }, + toProto(message: QueryPacketAcknowledgementRequest): Uint8Array { + return QueryPacketAcknowledgementRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryPacketAcknowledgementRequest, + ): QueryPacketAcknowledgementRequestProtoMsg { + return { + typeUrl: '/ibc.core.channel.v1.QueryPacketAcknowledgementRequest', + value: QueryPacketAcknowledgementRequest.encode(message).finish(), + }; + }, +}; +function createBaseQueryPacketAcknowledgementResponse(): QueryPacketAcknowledgementResponse { + return { + acknowledgement: new Uint8Array(), + proof: new Uint8Array(), + proofHeight: Height.fromPartial({}), + }; +} +export const QueryPacketAcknowledgementResponse = { + typeUrl: '/ibc.core.channel.v1.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 { + return { + acknowledgement: isSet(object.acknowledgement) + ? bytesFromBase64(object.acknowledgement) + : new Uint8Array(), + proof: isSet(object.proof) + ? bytesFromBase64(object.proof) + : new Uint8Array(), + proofHeight: isSet(object.proofHeight) + ? Height.fromJSON(object.proofHeight) + : undefined, + }; + }, + 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(); + message.proofHeight = + object.proofHeight !== undefined && object.proofHeight !== null + ? Height.fromPartial(object.proofHeight) + : undefined; + return message; + }, + fromProtoMsg( + message: QueryPacketAcknowledgementResponseProtoMsg, + ): QueryPacketAcknowledgementResponse { + return QueryPacketAcknowledgementResponse.decode(message.value); + }, + toProto(message: QueryPacketAcknowledgementResponse): Uint8Array { + return QueryPacketAcknowledgementResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryPacketAcknowledgementResponse, + ): QueryPacketAcknowledgementResponseProtoMsg { + return { + typeUrl: '/ibc.core.channel.v1.QueryPacketAcknowledgementResponse', + value: QueryPacketAcknowledgementResponse.encode(message).finish(), + }; + }, +}; +function createBaseQueryPacketAcknowledgementsRequest(): QueryPacketAcknowledgementsRequest { + return { + portId: '', + channelId: '', + pagination: undefined, + packetCommitmentSequences: [], + }; +} +export const QueryPacketAcknowledgementsRequest = { + typeUrl: '/ibc.core.channel.v1.QueryPacketAcknowledgementsRequest', + encode( + message: QueryPacketAcknowledgementsRequest, + 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.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(26).fork()).ldelim(); + } + writer.uint32(34).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.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + case 3: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + case 4: + 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 { + return { + portId: isSet(object.portId) ? String(object.portId) : '', + channelId: isSet(object.channelId) ? String(object.channelId) : '', + pagination: isSet(object.pagination) + ? PageRequest.fromJSON(object.pagination) + : undefined, + packetCommitmentSequences: Array.isArray( + object?.packetCommitmentSequences, + ) + ? object.packetCommitmentSequences.map((e: any) => BigInt(e.toString())) + : [], + }; + }, + toJSON(message: QueryPacketAcknowledgementsRequest): unknown { + const obj: any = {}; + message.portId !== undefined && (obj.portId = message.portId); + message.channelId !== undefined && (obj.channelId = message.channelId); + 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.portId = object.portId ?? ''; + message.channelId = object.channelId ?? ''; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageRequest.fromPartial(object.pagination) + : undefined; + message.packetCommitmentSequences = + object.packetCommitmentSequences?.map(e => BigInt(e.toString())) || []; + return message; + }, + fromProtoMsg( + message: QueryPacketAcknowledgementsRequestProtoMsg, + ): QueryPacketAcknowledgementsRequest { + return QueryPacketAcknowledgementsRequest.decode(message.value); + }, + toProto(message: QueryPacketAcknowledgementsRequest): Uint8Array { + return QueryPacketAcknowledgementsRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryPacketAcknowledgementsRequest, + ): QueryPacketAcknowledgementsRequestProtoMsg { + return { + typeUrl: '/ibc.core.channel.v1.QueryPacketAcknowledgementsRequest', + value: QueryPacketAcknowledgementsRequest.encode(message).finish(), + }; + }, +}; +function createBaseQueryPacketAcknowledgementsResponse(): QueryPacketAcknowledgementsResponse { + return { + acknowledgements: [], + pagination: undefined, + height: Height.fromPartial({}), + }; +} +export const QueryPacketAcknowledgementsResponse = { + typeUrl: '/ibc.core.channel.v1.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 { + return { + acknowledgements: Array.isArray(object?.acknowledgements) + ? object.acknowledgements.map((e: any) => PacketState.fromJSON(e)) + : [], + pagination: isSet(object.pagination) + ? PageResponse.fromJSON(object.pagination) + : undefined, + height: isSet(object.height) ? Height.fromJSON(object.height) : undefined, + }; + }, + 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)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageResponse.fromPartial(object.pagination) + : undefined; + message.height = + object.height !== undefined && object.height !== null + ? Height.fromPartial(object.height) + : undefined; + return message; + }, + fromProtoMsg( + message: QueryPacketAcknowledgementsResponseProtoMsg, + ): QueryPacketAcknowledgementsResponse { + return QueryPacketAcknowledgementsResponse.decode(message.value); + }, + toProto(message: QueryPacketAcknowledgementsResponse): Uint8Array { + return QueryPacketAcknowledgementsResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryPacketAcknowledgementsResponse, + ): QueryPacketAcknowledgementsResponseProtoMsg { + return { + typeUrl: '/ibc.core.channel.v1.QueryPacketAcknowledgementsResponse', + value: QueryPacketAcknowledgementsResponse.encode(message).finish(), + }; + }, +}; +function createBaseQueryUnreceivedPacketsRequest(): QueryUnreceivedPacketsRequest { + return { + portId: '', + channelId: '', + packetCommitmentSequences: [], + }; +} +export const QueryUnreceivedPacketsRequest = { + typeUrl: '/ibc.core.channel.v1.QueryUnreceivedPacketsRequest', + encode( + message: QueryUnreceivedPacketsRequest, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.portId !== '') { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== '') { + writer.uint32(18).string(message.channelId); + } + writer.uint32(26).fork(); + for (const v of message.packetCommitmentSequences) { + 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.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + 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): QueryUnreceivedPacketsRequest { + return { + portId: isSet(object.portId) ? String(object.portId) : '', + channelId: isSet(object.channelId) ? String(object.channelId) : '', + packetCommitmentSequences: Array.isArray( + object?.packetCommitmentSequences, + ) + ? object.packetCommitmentSequences.map((e: any) => BigInt(e.toString())) + : [], + }; + }, + toJSON(message: QueryUnreceivedPacketsRequest): unknown { + const obj: any = {}; + message.portId !== undefined && (obj.portId = message.portId); + message.channelId !== undefined && (obj.channelId = message.channelId); + if (message.packetCommitmentSequences) { + obj.packetCommitmentSequences = message.packetCommitmentSequences.map(e => + (e || BigInt(0)).toString(), + ); + } else { + obj.packetCommitmentSequences = []; + } + return obj; + }, + fromPartial( + object: Partial, + ): QueryUnreceivedPacketsRequest { + const message = createBaseQueryUnreceivedPacketsRequest(); + message.portId = object.portId ?? ''; + message.channelId = object.channelId ?? ''; + message.packetCommitmentSequences = + object.packetCommitmentSequences?.map(e => BigInt(e.toString())) || []; + return message; + }, + fromProtoMsg( + message: QueryUnreceivedPacketsRequestProtoMsg, + ): QueryUnreceivedPacketsRequest { + return QueryUnreceivedPacketsRequest.decode(message.value); + }, + toProto(message: QueryUnreceivedPacketsRequest): Uint8Array { + return QueryUnreceivedPacketsRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryUnreceivedPacketsRequest, + ): QueryUnreceivedPacketsRequestProtoMsg { + return { + typeUrl: '/ibc.core.channel.v1.QueryUnreceivedPacketsRequest', + value: QueryUnreceivedPacketsRequest.encode(message).finish(), + }; + }, +}; +function createBaseQueryUnreceivedPacketsResponse(): QueryUnreceivedPacketsResponse { + return { + sequences: [], + height: Height.fromPartial({}), + }; +} +export const QueryUnreceivedPacketsResponse = { + typeUrl: '/ibc.core.channel.v1.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 { + return { + sequences: Array.isArray(object?.sequences) + ? object.sequences.map((e: any) => BigInt(e.toString())) + : [], + height: isSet(object.height) ? Height.fromJSON(object.height) : undefined, + }; + }, + 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())) || []; + message.height = + object.height !== undefined && object.height !== null + ? Height.fromPartial(object.height) + : undefined; + return message; + }, + fromProtoMsg( + message: QueryUnreceivedPacketsResponseProtoMsg, + ): QueryUnreceivedPacketsResponse { + return QueryUnreceivedPacketsResponse.decode(message.value); + }, + toProto(message: QueryUnreceivedPacketsResponse): Uint8Array { + return QueryUnreceivedPacketsResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryUnreceivedPacketsResponse, + ): QueryUnreceivedPacketsResponseProtoMsg { + return { + typeUrl: '/ibc.core.channel.v1.QueryUnreceivedPacketsResponse', + value: QueryUnreceivedPacketsResponse.encode(message).finish(), + }; + }, +}; +function createBaseQueryUnreceivedAcksRequest(): QueryUnreceivedAcksRequest { + return { + portId: '', + channelId: '', + packetAckSequences: [], + }; +} +export const QueryUnreceivedAcksRequest = { + typeUrl: '/ibc.core.channel.v1.QueryUnreceivedAcksRequest', + encode( + message: QueryUnreceivedAcksRequest, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.portId !== '') { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== '') { + writer.uint32(18).string(message.channelId); + } + writer.uint32(26).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.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + case 3: + 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 { + return { + portId: isSet(object.portId) ? String(object.portId) : '', + channelId: isSet(object.channelId) ? String(object.channelId) : '', + packetAckSequences: Array.isArray(object?.packetAckSequences) + ? object.packetAckSequences.map((e: any) => BigInt(e.toString())) + : [], + }; + }, + toJSON(message: QueryUnreceivedAcksRequest): unknown { + const obj: any = {}; + message.portId !== undefined && (obj.portId = message.portId); + message.channelId !== undefined && (obj.channelId = message.channelId); + 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.portId = object.portId ?? ''; + message.channelId = object.channelId ?? ''; + message.packetAckSequences = + object.packetAckSequences?.map(e => BigInt(e.toString())) || []; + return message; + }, + fromProtoMsg( + message: QueryUnreceivedAcksRequestProtoMsg, + ): QueryUnreceivedAcksRequest { + return QueryUnreceivedAcksRequest.decode(message.value); + }, + toProto(message: QueryUnreceivedAcksRequest): Uint8Array { + return QueryUnreceivedAcksRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryUnreceivedAcksRequest, + ): QueryUnreceivedAcksRequestProtoMsg { + return { + typeUrl: '/ibc.core.channel.v1.QueryUnreceivedAcksRequest', + value: QueryUnreceivedAcksRequest.encode(message).finish(), + }; + }, +}; +function createBaseQueryUnreceivedAcksResponse(): QueryUnreceivedAcksResponse { + return { + sequences: [], + height: Height.fromPartial({}), + }; +} +export const QueryUnreceivedAcksResponse = { + typeUrl: '/ibc.core.channel.v1.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 { + return { + sequences: Array.isArray(object?.sequences) + ? object.sequences.map((e: any) => BigInt(e.toString())) + : [], + height: isSet(object.height) ? Height.fromJSON(object.height) : undefined, + }; + }, + 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())) || []; + message.height = + object.height !== undefined && object.height !== null + ? Height.fromPartial(object.height) + : undefined; + return message; + }, + fromProtoMsg( + message: QueryUnreceivedAcksResponseProtoMsg, + ): QueryUnreceivedAcksResponse { + return QueryUnreceivedAcksResponse.decode(message.value); + }, + toProto(message: QueryUnreceivedAcksResponse): Uint8Array { + return QueryUnreceivedAcksResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryUnreceivedAcksResponse, + ): QueryUnreceivedAcksResponseProtoMsg { + return { + typeUrl: '/ibc.core.channel.v1.QueryUnreceivedAcksResponse', + value: QueryUnreceivedAcksResponse.encode(message).finish(), + }; + }, +}; +function createBaseQueryNextSequenceReceiveRequest(): QueryNextSequenceReceiveRequest { + return { + portId: '', + channelId: '', + }; +} +export const QueryNextSequenceReceiveRequest = { + typeUrl: '/ibc.core.channel.v1.QueryNextSequenceReceiveRequest', + encode( + message: QueryNextSequenceReceiveRequest, + 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, + ): QueryNextSequenceReceiveRequest { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryNextSequenceReceiveRequest(); + 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): QueryNextSequenceReceiveRequest { + return { + portId: isSet(object.portId) ? String(object.portId) : '', + channelId: isSet(object.channelId) ? String(object.channelId) : '', + }; + }, + toJSON(message: QueryNextSequenceReceiveRequest): unknown { + const obj: any = {}; + message.portId !== undefined && (obj.portId = message.portId); + message.channelId !== undefined && (obj.channelId = message.channelId); + return obj; + }, + fromPartial( + object: Partial, + ): QueryNextSequenceReceiveRequest { + const message = createBaseQueryNextSequenceReceiveRequest(); + message.portId = object.portId ?? ''; + message.channelId = object.channelId ?? ''; + return message; + }, + fromProtoMsg( + message: QueryNextSequenceReceiveRequestProtoMsg, + ): QueryNextSequenceReceiveRequest { + return QueryNextSequenceReceiveRequest.decode(message.value); + }, + toProto(message: QueryNextSequenceReceiveRequest): Uint8Array { + return QueryNextSequenceReceiveRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryNextSequenceReceiveRequest, + ): QueryNextSequenceReceiveRequestProtoMsg { + return { + typeUrl: '/ibc.core.channel.v1.QueryNextSequenceReceiveRequest', + value: QueryNextSequenceReceiveRequest.encode(message).finish(), + }; + }, +}; +function createBaseQueryNextSequenceReceiveResponse(): QueryNextSequenceReceiveResponse { + return { + nextSequenceReceive: BigInt(0), + proof: new Uint8Array(), + proofHeight: Height.fromPartial({}), + }; +} +export const QueryNextSequenceReceiveResponse = { + typeUrl: '/ibc.core.channel.v1.QueryNextSequenceReceiveResponse', + encode( + message: QueryNextSequenceReceiveResponse, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.nextSequenceReceive !== BigInt(0)) { + writer.uint32(8).uint64(message.nextSequenceReceive); + } + 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, + ): QueryNextSequenceReceiveResponse { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryNextSequenceReceiveResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.nextSequenceReceive = 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): QueryNextSequenceReceiveResponse { + return { + nextSequenceReceive: isSet(object.nextSequenceReceive) + ? BigInt(object.nextSequenceReceive.toString()) + : BigInt(0), + proof: isSet(object.proof) + ? bytesFromBase64(object.proof) + : new Uint8Array(), + proofHeight: isSet(object.proofHeight) + ? Height.fromJSON(object.proofHeight) + : undefined, + }; + }, + toJSON(message: QueryNextSequenceReceiveResponse): unknown { + const obj: any = {}; + message.nextSequenceReceive !== undefined && + (obj.nextSequenceReceive = ( + message.nextSequenceReceive || 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, + ): QueryNextSequenceReceiveResponse { + const message = createBaseQueryNextSequenceReceiveResponse(); + message.nextSequenceReceive = + object.nextSequenceReceive !== undefined && + object.nextSequenceReceive !== null + ? BigInt(object.nextSequenceReceive.toString()) + : BigInt(0); + message.proof = object.proof ?? new Uint8Array(); + message.proofHeight = + object.proofHeight !== undefined && object.proofHeight !== null + ? Height.fromPartial(object.proofHeight) + : undefined; + return message; + }, + fromProtoMsg( + message: QueryNextSequenceReceiveResponseProtoMsg, + ): QueryNextSequenceReceiveResponse { + return QueryNextSequenceReceiveResponse.decode(message.value); + }, + toProto(message: QueryNextSequenceReceiveResponse): Uint8Array { + return QueryNextSequenceReceiveResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryNextSequenceReceiveResponse, + ): QueryNextSequenceReceiveResponseProtoMsg { + return { + typeUrl: '/ibc.core.channel.v1.QueryNextSequenceReceiveResponse', + value: QueryNextSequenceReceiveResponse.encode(message).finish(), + }; + }, +}; diff --git a/packages/cosmic-proto/src/codegen/ibc/core/channel/v1/tx.ts b/packages/cosmic-proto/src/codegen/ibc/core/channel/v1/tx.ts new file mode 100644 index 00000000000..0c180c960e1 --- /dev/null +++ b/packages/cosmic-proto/src/codegen/ibc/core/channel/v1/tx.ts @@ -0,0 +1,2305 @@ +//@ts-nocheck +import { Channel, ChannelSDKType, Packet, PacketSDKType } from './channel.js'; +import { Height, HeightSDKType } from '../../client/v1/client.js'; +import { BinaryReader, BinaryWriter } from '../../../../binary.js'; +import { + isSet, + bytesFromBase64, + base64FromBytes, +} from '../../../../helpers.js'; +/** 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, + UNRECOGNIZED = -1, +} +export const ResponseResultTypeSDKType = ResponseResultType; +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 -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.UNRECOGNIZED: + default: + return 'UNRECOGNIZED'; + } +} +/** + * MsgChannelOpenInit defines an sdk.Msg to initialize a channel handshake. It + * is called by a relayer on Chain A. + */ +export interface MsgChannelOpenInit { + portId: string; + channel: Channel; + signer: string; +} +export interface MsgChannelOpenInitProtoMsg { + typeUrl: '/ibc.core.channel.v1.MsgChannelOpenInit'; + value: Uint8Array; +} +/** + * MsgChannelOpenInit defines an sdk.Msg to initialize a channel handshake. It + * is called by a relayer on Chain A. + */ +export interface MsgChannelOpenInitSDKType { + port_id: string; + channel: ChannelSDKType; + signer: string; +} +/** MsgChannelOpenInitResponse defines the Msg/ChannelOpenInit response type. */ +export interface MsgChannelOpenInitResponse { + channelId: string; + version: string; +} +export interface MsgChannelOpenInitResponseProtoMsg { + typeUrl: '/ibc.core.channel.v1.MsgChannelOpenInitResponse'; + value: Uint8Array; +} +/** MsgChannelOpenInitResponse defines the Msg/ChannelOpenInit response type. */ +export interface MsgChannelOpenInitResponseSDKType { + channel_id: string; + version: string; +} +/** + * MsgChannelOpenInit defines a msg sent by a Relayer to try to open a channel + * on Chain B. The version field within the Channel field has been deprecated. Its + * value will be ignored by core IBC. + */ +export interface MsgChannelOpenTry { + portId: string; + /** Deprecated: this field is unused. Crossing hello's are no longer supported in core IBC. */ + /** @deprecated */ + previousChannelId: string; + /** NOTE: the version field within the channel has been deprecated. Its value will be ignored by core IBC. */ + channel: Channel; + counterpartyVersion: string; + proofInit: Uint8Array; + proofHeight: Height; + signer: string; +} +export interface MsgChannelOpenTryProtoMsg { + typeUrl: '/ibc.core.channel.v1.MsgChannelOpenTry'; + value: Uint8Array; +} +/** + * MsgChannelOpenInit defines a msg sent by a Relayer to try to open a channel + * on Chain B. The version field within the Channel field has been deprecated. Its + * value will be ignored by core IBC. + */ +export interface MsgChannelOpenTrySDKType { + port_id: string; + /** @deprecated */ + previous_channel_id: string; + channel: ChannelSDKType; + counterparty_version: string; + proof_init: Uint8Array; + proof_height: HeightSDKType; + signer: string; +} +/** MsgChannelOpenTryResponse defines the Msg/ChannelOpenTry response type. */ +export interface MsgChannelOpenTryResponse { + version: string; +} +export interface MsgChannelOpenTryResponseProtoMsg { + typeUrl: '/ibc.core.channel.v1.MsgChannelOpenTryResponse'; + value: Uint8Array; +} +/** MsgChannelOpenTryResponse defines the Msg/ChannelOpenTry response type. */ +export interface MsgChannelOpenTryResponseSDKType { + version: string; +} +/** + * MsgChannelOpenAck defines a msg sent by a Relayer to Chain A to acknowledge + * the change of channel state to TRYOPEN on Chain B. + */ +export interface MsgChannelOpenAck { + portId: string; + channelId: string; + counterpartyChannelId: string; + counterpartyVersion: string; + proofTry: Uint8Array; + proofHeight: Height; + signer: string; +} +export interface MsgChannelOpenAckProtoMsg { + typeUrl: '/ibc.core.channel.v1.MsgChannelOpenAck'; + value: Uint8Array; +} +/** + * MsgChannelOpenAck defines a msg sent by a Relayer to Chain A to acknowledge + * the change of channel state to TRYOPEN on Chain B. + */ +export interface MsgChannelOpenAckSDKType { + port_id: string; + channel_id: string; + counterparty_channel_id: string; + counterparty_version: string; + proof_try: Uint8Array; + proof_height: HeightSDKType; + signer: string; +} +/** MsgChannelOpenAckResponse defines the Msg/ChannelOpenAck response type. */ +export interface MsgChannelOpenAckResponse {} +export interface MsgChannelOpenAckResponseProtoMsg { + typeUrl: '/ibc.core.channel.v1.MsgChannelOpenAckResponse'; + value: Uint8Array; +} +/** MsgChannelOpenAckResponse defines the Msg/ChannelOpenAck response type. */ +export interface MsgChannelOpenAckResponseSDKType {} +/** + * MsgChannelOpenConfirm defines a msg sent by a Relayer to Chain B to + * acknowledge the change of channel state to OPEN on Chain A. + */ +export interface MsgChannelOpenConfirm { + portId: string; + channelId: string; + proofAck: Uint8Array; + proofHeight: Height; + signer: string; +} +export interface MsgChannelOpenConfirmProtoMsg { + typeUrl: '/ibc.core.channel.v1.MsgChannelOpenConfirm'; + value: Uint8Array; +} +/** + * MsgChannelOpenConfirm defines a msg sent by a Relayer to Chain B to + * acknowledge the change of channel state to OPEN on Chain A. + */ +export interface MsgChannelOpenConfirmSDKType { + port_id: string; + channel_id: string; + proof_ack: Uint8Array; + proof_height: HeightSDKType; + signer: string; +} +/** + * MsgChannelOpenConfirmResponse defines the Msg/ChannelOpenConfirm response + * type. + */ +export interface MsgChannelOpenConfirmResponse {} +export interface MsgChannelOpenConfirmResponseProtoMsg { + typeUrl: '/ibc.core.channel.v1.MsgChannelOpenConfirmResponse'; + value: Uint8Array; +} +/** + * MsgChannelOpenConfirmResponse defines the Msg/ChannelOpenConfirm response + * type. + */ +export interface MsgChannelOpenConfirmResponseSDKType {} +/** + * MsgChannelCloseInit defines a msg sent by a Relayer to Chain A + * to close a channel with Chain B. + */ +export interface MsgChannelCloseInit { + portId: string; + channelId: string; + signer: string; +} +export interface MsgChannelCloseInitProtoMsg { + typeUrl: '/ibc.core.channel.v1.MsgChannelCloseInit'; + value: Uint8Array; +} +/** + * MsgChannelCloseInit defines a msg sent by a Relayer to Chain A + * to close a channel with Chain B. + */ +export interface MsgChannelCloseInitSDKType { + port_id: string; + channel_id: string; + signer: string; +} +/** MsgChannelCloseInitResponse defines the Msg/ChannelCloseInit response type. */ +export interface MsgChannelCloseInitResponse {} +export interface MsgChannelCloseInitResponseProtoMsg { + typeUrl: '/ibc.core.channel.v1.MsgChannelCloseInitResponse'; + value: Uint8Array; +} +/** MsgChannelCloseInitResponse defines the Msg/ChannelCloseInit response type. */ +export interface MsgChannelCloseInitResponseSDKType {} +/** + * MsgChannelCloseConfirm defines a msg sent by a Relayer to Chain B + * to acknowledge the change of channel state to CLOSED on Chain A. + */ +export interface MsgChannelCloseConfirm { + portId: string; + channelId: string; + proofInit: Uint8Array; + proofHeight: Height; + signer: string; +} +export interface MsgChannelCloseConfirmProtoMsg { + typeUrl: '/ibc.core.channel.v1.MsgChannelCloseConfirm'; + value: Uint8Array; +} +/** + * MsgChannelCloseConfirm defines a msg sent by a Relayer to Chain B + * to acknowledge the change of channel state to CLOSED on Chain A. + */ +export interface MsgChannelCloseConfirmSDKType { + port_id: string; + channel_id: string; + proof_init: Uint8Array; + proof_height: HeightSDKType; + signer: string; +} +/** + * MsgChannelCloseConfirmResponse defines the Msg/ChannelCloseConfirm response + * type. + */ +export interface MsgChannelCloseConfirmResponse {} +export interface MsgChannelCloseConfirmResponseProtoMsg { + typeUrl: '/ibc.core.channel.v1.MsgChannelCloseConfirmResponse'; + value: Uint8Array; +} +/** + * MsgChannelCloseConfirmResponse defines the Msg/ChannelCloseConfirm response + * type. + */ +export interface MsgChannelCloseConfirmResponseSDKType {} +/** MsgRecvPacket receives incoming IBC packet */ +export interface MsgRecvPacket { + packet: Packet; + proofCommitment: Uint8Array; + proofHeight: Height; + signer: string; +} +export interface MsgRecvPacketProtoMsg { + typeUrl: '/ibc.core.channel.v1.MsgRecvPacket'; + value: Uint8Array; +} +/** MsgRecvPacket receives incoming IBC packet */ +export interface MsgRecvPacketSDKType { + packet: PacketSDKType; + proof_commitment: Uint8Array; + proof_height: HeightSDKType; + signer: string; +} +/** MsgRecvPacketResponse defines the Msg/RecvPacket response type. */ +export interface MsgRecvPacketResponse { + result: ResponseResultType; +} +export interface MsgRecvPacketResponseProtoMsg { + typeUrl: '/ibc.core.channel.v1.MsgRecvPacketResponse'; + value: Uint8Array; +} +/** MsgRecvPacketResponse defines the Msg/RecvPacket response type. */ +export interface MsgRecvPacketResponseSDKType { + result: ResponseResultType; +} +/** MsgTimeout receives timed-out packet */ +export interface MsgTimeout { + packet: Packet; + proofUnreceived: Uint8Array; + proofHeight: Height; + nextSequenceRecv: bigint; + signer: string; +} +export interface MsgTimeoutProtoMsg { + typeUrl: '/ibc.core.channel.v1.MsgTimeout'; + value: Uint8Array; +} +/** MsgTimeout receives timed-out packet */ +export interface MsgTimeoutSDKType { + packet: PacketSDKType; + proof_unreceived: Uint8Array; + proof_height: HeightSDKType; + next_sequence_recv: bigint; + signer: string; +} +/** MsgTimeoutResponse defines the Msg/Timeout response type. */ +export interface MsgTimeoutResponse { + result: ResponseResultType; +} +export interface MsgTimeoutResponseProtoMsg { + typeUrl: '/ibc.core.channel.v1.MsgTimeoutResponse'; + value: Uint8Array; +} +/** MsgTimeoutResponse defines the Msg/Timeout response type. */ +export interface MsgTimeoutResponseSDKType { + result: ResponseResultType; +} +/** MsgTimeoutOnClose timed-out packet upon counterparty channel closure. */ +export interface MsgTimeoutOnClose { + packet: Packet; + proofUnreceived: Uint8Array; + proofClose: Uint8Array; + proofHeight: Height; + nextSequenceRecv: bigint; + signer: string; +} +export interface MsgTimeoutOnCloseProtoMsg { + typeUrl: '/ibc.core.channel.v1.MsgTimeoutOnClose'; + value: Uint8Array; +} +/** MsgTimeoutOnClose timed-out packet upon counterparty channel closure. */ +export interface MsgTimeoutOnCloseSDKType { + packet: PacketSDKType; + proof_unreceived: Uint8Array; + proof_close: Uint8Array; + proof_height: HeightSDKType; + next_sequence_recv: bigint; + signer: string; +} +/** MsgTimeoutOnCloseResponse defines the Msg/TimeoutOnClose response type. */ +export interface MsgTimeoutOnCloseResponse { + result: ResponseResultType; +} +export interface MsgTimeoutOnCloseResponseProtoMsg { + typeUrl: '/ibc.core.channel.v1.MsgTimeoutOnCloseResponse'; + value: Uint8Array; +} +/** MsgTimeoutOnCloseResponse defines the Msg/TimeoutOnClose response type. */ +export interface MsgTimeoutOnCloseResponseSDKType { + result: ResponseResultType; +} +/** MsgAcknowledgement receives incoming IBC acknowledgement */ +export interface MsgAcknowledgement { + packet: Packet; + acknowledgement: Uint8Array; + proofAcked: Uint8Array; + proofHeight: Height; + signer: string; +} +export interface MsgAcknowledgementProtoMsg { + typeUrl: '/ibc.core.channel.v1.MsgAcknowledgement'; + value: Uint8Array; +} +/** MsgAcknowledgement receives incoming IBC acknowledgement */ +export interface MsgAcknowledgementSDKType { + packet: PacketSDKType; + acknowledgement: Uint8Array; + proof_acked: Uint8Array; + proof_height: HeightSDKType; + signer: string; +} +/** MsgAcknowledgementResponse defines the Msg/Acknowledgement response type. */ +export interface MsgAcknowledgementResponse { + result: ResponseResultType; +} +export interface MsgAcknowledgementResponseProtoMsg { + typeUrl: '/ibc.core.channel.v1.MsgAcknowledgementResponse'; + value: Uint8Array; +} +/** MsgAcknowledgementResponse defines the Msg/Acknowledgement response type. */ +export interface MsgAcknowledgementResponseSDKType { + result: ResponseResultType; +} +function createBaseMsgChannelOpenInit(): MsgChannelOpenInit { + return { + portId: '', + channel: Channel.fromPartial({}), + signer: '', + }; +} +export const MsgChannelOpenInit = { + typeUrl: '/ibc.core.channel.v1.MsgChannelOpenInit', + encode( + message: MsgChannelOpenInit, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.portId !== '') { + writer.uint32(10).string(message.portId); + } + if (message.channel !== undefined) { + Channel.encode(message.channel, writer.uint32(18).fork()).ldelim(); + } + if (message.signer !== '') { + writer.uint32(26).string(message.signer); + } + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): MsgChannelOpenInit { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelOpenInit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.channel = Channel.decode(reader, reader.uint32()); + break; + case 3: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgChannelOpenInit { + return { + portId: isSet(object.portId) ? String(object.portId) : '', + channel: isSet(object.channel) + ? Channel.fromJSON(object.channel) + : undefined, + signer: isSet(object.signer) ? String(object.signer) : '', + }; + }, + toJSON(message: MsgChannelOpenInit): unknown { + const obj: any = {}; + message.portId !== undefined && (obj.portId = message.portId); + message.channel !== undefined && + (obj.channel = message.channel + ? Channel.toJSON(message.channel) + : undefined); + message.signer !== undefined && (obj.signer = message.signer); + return obj; + }, + fromPartial(object: Partial): MsgChannelOpenInit { + const message = createBaseMsgChannelOpenInit(); + message.portId = object.portId ?? ''; + message.channel = + object.channel !== undefined && object.channel !== null + ? Channel.fromPartial(object.channel) + : undefined; + message.signer = object.signer ?? ''; + return message; + }, + fromProtoMsg(message: MsgChannelOpenInitProtoMsg): MsgChannelOpenInit { + return MsgChannelOpenInit.decode(message.value); + }, + toProto(message: MsgChannelOpenInit): Uint8Array { + return MsgChannelOpenInit.encode(message).finish(); + }, + toProtoMsg(message: MsgChannelOpenInit): MsgChannelOpenInitProtoMsg { + return { + typeUrl: '/ibc.core.channel.v1.MsgChannelOpenInit', + value: MsgChannelOpenInit.encode(message).finish(), + }; + }, +}; +function createBaseMsgChannelOpenInitResponse(): MsgChannelOpenInitResponse { + return { + channelId: '', + version: '', + }; +} +export const MsgChannelOpenInitResponse = { + typeUrl: '/ibc.core.channel.v1.MsgChannelOpenInitResponse', + encode( + message: MsgChannelOpenInitResponse, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.channelId !== '') { + writer.uint32(10).string(message.channelId); + } + if (message.version !== '') { + writer.uint32(18).string(message.version); + } + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): MsgChannelOpenInitResponse { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelOpenInitResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.channelId = reader.string(); + break; + case 2: + message.version = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgChannelOpenInitResponse { + return { + channelId: isSet(object.channelId) ? String(object.channelId) : '', + version: isSet(object.version) ? String(object.version) : '', + }; + }, + toJSON(message: MsgChannelOpenInitResponse): unknown { + const obj: any = {}; + message.channelId !== undefined && (obj.channelId = message.channelId); + message.version !== undefined && (obj.version = message.version); + return obj; + }, + fromPartial( + object: Partial, + ): MsgChannelOpenInitResponse { + const message = createBaseMsgChannelOpenInitResponse(); + message.channelId = object.channelId ?? ''; + message.version = object.version ?? ''; + return message; + }, + fromProtoMsg( + message: MsgChannelOpenInitResponseProtoMsg, + ): MsgChannelOpenInitResponse { + return MsgChannelOpenInitResponse.decode(message.value); + }, + toProto(message: MsgChannelOpenInitResponse): Uint8Array { + return MsgChannelOpenInitResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgChannelOpenInitResponse, + ): MsgChannelOpenInitResponseProtoMsg { + return { + typeUrl: '/ibc.core.channel.v1.MsgChannelOpenInitResponse', + value: MsgChannelOpenInitResponse.encode(message).finish(), + }; + }, +}; +function createBaseMsgChannelOpenTry(): MsgChannelOpenTry { + return { + portId: '', + previousChannelId: '', + channel: Channel.fromPartial({}), + counterpartyVersion: '', + proofInit: new Uint8Array(), + proofHeight: Height.fromPartial({}), + signer: '', + }; +} +export const MsgChannelOpenTry = { + typeUrl: '/ibc.core.channel.v1.MsgChannelOpenTry', + encode( + message: MsgChannelOpenTry, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.portId !== '') { + writer.uint32(10).string(message.portId); + } + if (message.previousChannelId !== '') { + writer.uint32(18).string(message.previousChannelId); + } + if (message.channel !== undefined) { + Channel.encode(message.channel, writer.uint32(26).fork()).ldelim(); + } + if (message.counterpartyVersion !== '') { + writer.uint32(34).string(message.counterpartyVersion); + } + if (message.proofInit.length !== 0) { + writer.uint32(42).bytes(message.proofInit); + } + if (message.proofHeight !== undefined) { + Height.encode(message.proofHeight, writer.uint32(50).fork()).ldelim(); + } + if (message.signer !== '') { + writer.uint32(58).string(message.signer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgChannelOpenTry { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelOpenTry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.previousChannelId = reader.string(); + break; + case 3: + message.channel = Channel.decode(reader, reader.uint32()); + break; + case 4: + message.counterpartyVersion = reader.string(); + break; + case 5: + message.proofInit = reader.bytes(); + break; + case 6: + message.proofHeight = Height.decode(reader, reader.uint32()); + break; + case 7: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgChannelOpenTry { + return { + portId: isSet(object.portId) ? String(object.portId) : '', + previousChannelId: isSet(object.previousChannelId) + ? String(object.previousChannelId) + : '', + channel: isSet(object.channel) + ? Channel.fromJSON(object.channel) + : undefined, + counterpartyVersion: isSet(object.counterpartyVersion) + ? String(object.counterpartyVersion) + : '', + proofInit: isSet(object.proofInit) + ? bytesFromBase64(object.proofInit) + : new Uint8Array(), + proofHeight: isSet(object.proofHeight) + ? Height.fromJSON(object.proofHeight) + : undefined, + signer: isSet(object.signer) ? String(object.signer) : '', + }; + }, + toJSON(message: MsgChannelOpenTry): unknown { + const obj: any = {}; + message.portId !== undefined && (obj.portId = message.portId); + message.previousChannelId !== undefined && + (obj.previousChannelId = message.previousChannelId); + message.channel !== undefined && + (obj.channel = message.channel + ? Channel.toJSON(message.channel) + : undefined); + message.counterpartyVersion !== undefined && + (obj.counterpartyVersion = message.counterpartyVersion); + message.proofInit !== undefined && + (obj.proofInit = base64FromBytes( + message.proofInit !== undefined ? message.proofInit : 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): MsgChannelOpenTry { + const message = createBaseMsgChannelOpenTry(); + message.portId = object.portId ?? ''; + message.previousChannelId = object.previousChannelId ?? ''; + message.channel = + object.channel !== undefined && object.channel !== null + ? Channel.fromPartial(object.channel) + : undefined; + message.counterpartyVersion = object.counterpartyVersion ?? ''; + message.proofInit = object.proofInit ?? new Uint8Array(); + message.proofHeight = + object.proofHeight !== undefined && object.proofHeight !== null + ? Height.fromPartial(object.proofHeight) + : undefined; + message.signer = object.signer ?? ''; + return message; + }, + fromProtoMsg(message: MsgChannelOpenTryProtoMsg): MsgChannelOpenTry { + return MsgChannelOpenTry.decode(message.value); + }, + toProto(message: MsgChannelOpenTry): Uint8Array { + return MsgChannelOpenTry.encode(message).finish(); + }, + toProtoMsg(message: MsgChannelOpenTry): MsgChannelOpenTryProtoMsg { + return { + typeUrl: '/ibc.core.channel.v1.MsgChannelOpenTry', + value: MsgChannelOpenTry.encode(message).finish(), + }; + }, +}; +function createBaseMsgChannelOpenTryResponse(): MsgChannelOpenTryResponse { + return { + version: '', + }; +} +export const MsgChannelOpenTryResponse = { + typeUrl: '/ibc.core.channel.v1.MsgChannelOpenTryResponse', + encode( + message: MsgChannelOpenTryResponse, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.version !== '') { + writer.uint32(10).string(message.version); + } + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): MsgChannelOpenTryResponse { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelOpenTryResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.version = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgChannelOpenTryResponse { + return { + version: isSet(object.version) ? String(object.version) : '', + }; + }, + toJSON(message: MsgChannelOpenTryResponse): unknown { + const obj: any = {}; + message.version !== undefined && (obj.version = message.version); + return obj; + }, + fromPartial( + object: Partial, + ): MsgChannelOpenTryResponse { + const message = createBaseMsgChannelOpenTryResponse(); + message.version = object.version ?? ''; + return message; + }, + fromProtoMsg( + message: MsgChannelOpenTryResponseProtoMsg, + ): MsgChannelOpenTryResponse { + return MsgChannelOpenTryResponse.decode(message.value); + }, + toProto(message: MsgChannelOpenTryResponse): Uint8Array { + return MsgChannelOpenTryResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgChannelOpenTryResponse, + ): MsgChannelOpenTryResponseProtoMsg { + return { + typeUrl: '/ibc.core.channel.v1.MsgChannelOpenTryResponse', + value: MsgChannelOpenTryResponse.encode(message).finish(), + }; + }, +}; +function createBaseMsgChannelOpenAck(): MsgChannelOpenAck { + return { + portId: '', + channelId: '', + counterpartyChannelId: '', + counterpartyVersion: '', + proofTry: new Uint8Array(), + proofHeight: Height.fromPartial({}), + signer: '', + }; +} +export const MsgChannelOpenAck = { + typeUrl: '/ibc.core.channel.v1.MsgChannelOpenAck', + encode( + message: MsgChannelOpenAck, + 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.counterpartyChannelId !== '') { + writer.uint32(26).string(message.counterpartyChannelId); + } + if (message.counterpartyVersion !== '') { + writer.uint32(34).string(message.counterpartyVersion); + } + if (message.proofTry.length !== 0) { + writer.uint32(42).bytes(message.proofTry); + } + if (message.proofHeight !== undefined) { + Height.encode(message.proofHeight, writer.uint32(50).fork()).ldelim(); + } + if (message.signer !== '') { + writer.uint32(58).string(message.signer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgChannelOpenAck { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelOpenAck(); + 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.counterpartyChannelId = reader.string(); + break; + case 4: + message.counterpartyVersion = reader.string(); + break; + case 5: + message.proofTry = reader.bytes(); + break; + case 6: + message.proofHeight = Height.decode(reader, reader.uint32()); + break; + case 7: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgChannelOpenAck { + return { + portId: isSet(object.portId) ? String(object.portId) : '', + channelId: isSet(object.channelId) ? String(object.channelId) : '', + counterpartyChannelId: isSet(object.counterpartyChannelId) + ? String(object.counterpartyChannelId) + : '', + counterpartyVersion: isSet(object.counterpartyVersion) + ? String(object.counterpartyVersion) + : '', + proofTry: isSet(object.proofTry) + ? bytesFromBase64(object.proofTry) + : new Uint8Array(), + proofHeight: isSet(object.proofHeight) + ? Height.fromJSON(object.proofHeight) + : undefined, + signer: isSet(object.signer) ? String(object.signer) : '', + }; + }, + toJSON(message: MsgChannelOpenAck): unknown { + const obj: any = {}; + message.portId !== undefined && (obj.portId = message.portId); + message.channelId !== undefined && (obj.channelId = message.channelId); + message.counterpartyChannelId !== undefined && + (obj.counterpartyChannelId = message.counterpartyChannelId); + message.counterpartyVersion !== undefined && + (obj.counterpartyVersion = message.counterpartyVersion); + message.proofTry !== undefined && + (obj.proofTry = base64FromBytes( + message.proofTry !== undefined ? message.proofTry : 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): MsgChannelOpenAck { + const message = createBaseMsgChannelOpenAck(); + message.portId = object.portId ?? ''; + message.channelId = object.channelId ?? ''; + message.counterpartyChannelId = object.counterpartyChannelId ?? ''; + message.counterpartyVersion = object.counterpartyVersion ?? ''; + message.proofTry = object.proofTry ?? new Uint8Array(); + message.proofHeight = + object.proofHeight !== undefined && object.proofHeight !== null + ? Height.fromPartial(object.proofHeight) + : undefined; + message.signer = object.signer ?? ''; + return message; + }, + fromProtoMsg(message: MsgChannelOpenAckProtoMsg): MsgChannelOpenAck { + return MsgChannelOpenAck.decode(message.value); + }, + toProto(message: MsgChannelOpenAck): Uint8Array { + return MsgChannelOpenAck.encode(message).finish(); + }, + toProtoMsg(message: MsgChannelOpenAck): MsgChannelOpenAckProtoMsg { + return { + typeUrl: '/ibc.core.channel.v1.MsgChannelOpenAck', + value: MsgChannelOpenAck.encode(message).finish(), + }; + }, +}; +function createBaseMsgChannelOpenAckResponse(): MsgChannelOpenAckResponse { + return {}; +} +export const MsgChannelOpenAckResponse = { + typeUrl: '/ibc.core.channel.v1.MsgChannelOpenAckResponse', + encode( + _: MsgChannelOpenAckResponse, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): MsgChannelOpenAckResponse { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelOpenAckResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): MsgChannelOpenAckResponse { + return {}; + }, + toJSON(_: MsgChannelOpenAckResponse): unknown { + const obj: any = {}; + return obj; + }, + fromPartial( + _: Partial, + ): MsgChannelOpenAckResponse { + const message = createBaseMsgChannelOpenAckResponse(); + return message; + }, + fromProtoMsg( + message: MsgChannelOpenAckResponseProtoMsg, + ): MsgChannelOpenAckResponse { + return MsgChannelOpenAckResponse.decode(message.value); + }, + toProto(message: MsgChannelOpenAckResponse): Uint8Array { + return MsgChannelOpenAckResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgChannelOpenAckResponse, + ): MsgChannelOpenAckResponseProtoMsg { + return { + typeUrl: '/ibc.core.channel.v1.MsgChannelOpenAckResponse', + value: MsgChannelOpenAckResponse.encode(message).finish(), + }; + }, +}; +function createBaseMsgChannelOpenConfirm(): MsgChannelOpenConfirm { + return { + portId: '', + channelId: '', + proofAck: new Uint8Array(), + proofHeight: Height.fromPartial({}), + signer: '', + }; +} +export const MsgChannelOpenConfirm = { + typeUrl: '/ibc.core.channel.v1.MsgChannelOpenConfirm', + encode( + message: MsgChannelOpenConfirm, + 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.proofAck.length !== 0) { + writer.uint32(26).bytes(message.proofAck); + } + 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, + ): MsgChannelOpenConfirm { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelOpenConfirm(); + 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.proofAck = 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): MsgChannelOpenConfirm { + return { + portId: isSet(object.portId) ? String(object.portId) : '', + channelId: isSet(object.channelId) ? String(object.channelId) : '', + proofAck: isSet(object.proofAck) + ? bytesFromBase64(object.proofAck) + : new Uint8Array(), + proofHeight: isSet(object.proofHeight) + ? Height.fromJSON(object.proofHeight) + : undefined, + signer: isSet(object.signer) ? String(object.signer) : '', + }; + }, + toJSON(message: MsgChannelOpenConfirm): unknown { + const obj: any = {}; + message.portId !== undefined && (obj.portId = message.portId); + message.channelId !== undefined && (obj.channelId = message.channelId); + message.proofAck !== undefined && + (obj.proofAck = base64FromBytes( + message.proofAck !== undefined ? message.proofAck : 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): MsgChannelOpenConfirm { + const message = createBaseMsgChannelOpenConfirm(); + message.portId = object.portId ?? ''; + message.channelId = object.channelId ?? ''; + message.proofAck = object.proofAck ?? new Uint8Array(); + message.proofHeight = + object.proofHeight !== undefined && object.proofHeight !== null + ? Height.fromPartial(object.proofHeight) + : undefined; + message.signer = object.signer ?? ''; + return message; + }, + fromProtoMsg(message: MsgChannelOpenConfirmProtoMsg): MsgChannelOpenConfirm { + return MsgChannelOpenConfirm.decode(message.value); + }, + toProto(message: MsgChannelOpenConfirm): Uint8Array { + return MsgChannelOpenConfirm.encode(message).finish(); + }, + toProtoMsg(message: MsgChannelOpenConfirm): MsgChannelOpenConfirmProtoMsg { + return { + typeUrl: '/ibc.core.channel.v1.MsgChannelOpenConfirm', + value: MsgChannelOpenConfirm.encode(message).finish(), + }; + }, +}; +function createBaseMsgChannelOpenConfirmResponse(): MsgChannelOpenConfirmResponse { + return {}; +} +export const MsgChannelOpenConfirmResponse = { + typeUrl: '/ibc.core.channel.v1.MsgChannelOpenConfirmResponse', + encode( + _: MsgChannelOpenConfirmResponse, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): MsgChannelOpenConfirmResponse { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelOpenConfirmResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): MsgChannelOpenConfirmResponse { + return {}; + }, + toJSON(_: MsgChannelOpenConfirmResponse): unknown { + const obj: any = {}; + return obj; + }, + fromPartial( + _: Partial, + ): MsgChannelOpenConfirmResponse { + const message = createBaseMsgChannelOpenConfirmResponse(); + return message; + }, + fromProtoMsg( + message: MsgChannelOpenConfirmResponseProtoMsg, + ): MsgChannelOpenConfirmResponse { + return MsgChannelOpenConfirmResponse.decode(message.value); + }, + toProto(message: MsgChannelOpenConfirmResponse): Uint8Array { + return MsgChannelOpenConfirmResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgChannelOpenConfirmResponse, + ): MsgChannelOpenConfirmResponseProtoMsg { + return { + typeUrl: '/ibc.core.channel.v1.MsgChannelOpenConfirmResponse', + value: MsgChannelOpenConfirmResponse.encode(message).finish(), + }; + }, +}; +function createBaseMsgChannelCloseInit(): MsgChannelCloseInit { + return { + portId: '', + channelId: '', + signer: '', + }; +} +export const MsgChannelCloseInit = { + typeUrl: '/ibc.core.channel.v1.MsgChannelCloseInit', + encode( + message: MsgChannelCloseInit, + 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.signer !== '') { + writer.uint32(26).string(message.signer); + } + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): MsgChannelCloseInit { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelCloseInit(); + 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.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgChannelCloseInit { + return { + portId: isSet(object.portId) ? String(object.portId) : '', + channelId: isSet(object.channelId) ? String(object.channelId) : '', + signer: isSet(object.signer) ? String(object.signer) : '', + }; + }, + toJSON(message: MsgChannelCloseInit): unknown { + const obj: any = {}; + message.portId !== undefined && (obj.portId = message.portId); + message.channelId !== undefined && (obj.channelId = message.channelId); + message.signer !== undefined && (obj.signer = message.signer); + return obj; + }, + fromPartial(object: Partial): MsgChannelCloseInit { + const message = createBaseMsgChannelCloseInit(); + message.portId = object.portId ?? ''; + message.channelId = object.channelId ?? ''; + message.signer = object.signer ?? ''; + return message; + }, + fromProtoMsg(message: MsgChannelCloseInitProtoMsg): MsgChannelCloseInit { + return MsgChannelCloseInit.decode(message.value); + }, + toProto(message: MsgChannelCloseInit): Uint8Array { + return MsgChannelCloseInit.encode(message).finish(); + }, + toProtoMsg(message: MsgChannelCloseInit): MsgChannelCloseInitProtoMsg { + return { + typeUrl: '/ibc.core.channel.v1.MsgChannelCloseInit', + value: MsgChannelCloseInit.encode(message).finish(), + }; + }, +}; +function createBaseMsgChannelCloseInitResponse(): MsgChannelCloseInitResponse { + return {}; +} +export const MsgChannelCloseInitResponse = { + typeUrl: '/ibc.core.channel.v1.MsgChannelCloseInitResponse', + encode( + _: MsgChannelCloseInitResponse, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): MsgChannelCloseInitResponse { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelCloseInitResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): MsgChannelCloseInitResponse { + return {}; + }, + toJSON(_: MsgChannelCloseInitResponse): unknown { + const obj: any = {}; + return obj; + }, + fromPartial( + _: Partial, + ): MsgChannelCloseInitResponse { + const message = createBaseMsgChannelCloseInitResponse(); + return message; + }, + fromProtoMsg( + message: MsgChannelCloseInitResponseProtoMsg, + ): MsgChannelCloseInitResponse { + return MsgChannelCloseInitResponse.decode(message.value); + }, + toProto(message: MsgChannelCloseInitResponse): Uint8Array { + return MsgChannelCloseInitResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgChannelCloseInitResponse, + ): MsgChannelCloseInitResponseProtoMsg { + return { + typeUrl: '/ibc.core.channel.v1.MsgChannelCloseInitResponse', + value: MsgChannelCloseInitResponse.encode(message).finish(), + }; + }, +}; +function createBaseMsgChannelCloseConfirm(): MsgChannelCloseConfirm { + return { + portId: '', + channelId: '', + proofInit: new Uint8Array(), + proofHeight: Height.fromPartial({}), + signer: '', + }; +} +export const MsgChannelCloseConfirm = { + typeUrl: '/ibc.core.channel.v1.MsgChannelCloseConfirm', + encode( + message: MsgChannelCloseConfirm, + 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.proofInit.length !== 0) { + writer.uint32(26).bytes(message.proofInit); + } + 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, + ): MsgChannelCloseConfirm { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelCloseConfirm(); + 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.proofInit = 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): MsgChannelCloseConfirm { + return { + portId: isSet(object.portId) ? String(object.portId) : '', + channelId: isSet(object.channelId) ? String(object.channelId) : '', + proofInit: isSet(object.proofInit) + ? bytesFromBase64(object.proofInit) + : new Uint8Array(), + proofHeight: isSet(object.proofHeight) + ? Height.fromJSON(object.proofHeight) + : undefined, + signer: isSet(object.signer) ? String(object.signer) : '', + }; + }, + toJSON(message: MsgChannelCloseConfirm): unknown { + const obj: any = {}; + message.portId !== undefined && (obj.portId = message.portId); + message.channelId !== undefined && (obj.channelId = message.channelId); + message.proofInit !== undefined && + (obj.proofInit = base64FromBytes( + message.proofInit !== undefined ? message.proofInit : 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): MsgChannelCloseConfirm { + const message = createBaseMsgChannelCloseConfirm(); + message.portId = object.portId ?? ''; + message.channelId = object.channelId ?? ''; + message.proofInit = object.proofInit ?? new Uint8Array(); + message.proofHeight = + object.proofHeight !== undefined && object.proofHeight !== null + ? Height.fromPartial(object.proofHeight) + : undefined; + message.signer = object.signer ?? ''; + return message; + }, + fromProtoMsg( + message: MsgChannelCloseConfirmProtoMsg, + ): MsgChannelCloseConfirm { + return MsgChannelCloseConfirm.decode(message.value); + }, + toProto(message: MsgChannelCloseConfirm): Uint8Array { + return MsgChannelCloseConfirm.encode(message).finish(); + }, + toProtoMsg(message: MsgChannelCloseConfirm): MsgChannelCloseConfirmProtoMsg { + return { + typeUrl: '/ibc.core.channel.v1.MsgChannelCloseConfirm', + value: MsgChannelCloseConfirm.encode(message).finish(), + }; + }, +}; +function createBaseMsgChannelCloseConfirmResponse(): MsgChannelCloseConfirmResponse { + return {}; +} +export const MsgChannelCloseConfirmResponse = { + typeUrl: '/ibc.core.channel.v1.MsgChannelCloseConfirmResponse', + encode( + _: MsgChannelCloseConfirmResponse, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): MsgChannelCloseConfirmResponse { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelCloseConfirmResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): MsgChannelCloseConfirmResponse { + return {}; + }, + toJSON(_: MsgChannelCloseConfirmResponse): unknown { + const obj: any = {}; + return obj; + }, + fromPartial( + _: Partial, + ): MsgChannelCloseConfirmResponse { + const message = createBaseMsgChannelCloseConfirmResponse(); + return message; + }, + fromProtoMsg( + message: MsgChannelCloseConfirmResponseProtoMsg, + ): MsgChannelCloseConfirmResponse { + return MsgChannelCloseConfirmResponse.decode(message.value); + }, + toProto(message: MsgChannelCloseConfirmResponse): Uint8Array { + return MsgChannelCloseConfirmResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgChannelCloseConfirmResponse, + ): MsgChannelCloseConfirmResponseProtoMsg { + return { + typeUrl: '/ibc.core.channel.v1.MsgChannelCloseConfirmResponse', + value: MsgChannelCloseConfirmResponse.encode(message).finish(), + }; + }, +}; +function createBaseMsgRecvPacket(): MsgRecvPacket { + return { + packet: Packet.fromPartial({}), + proofCommitment: new Uint8Array(), + proofHeight: Height.fromPartial({}), + signer: '', + }; +} +export const MsgRecvPacket = { + typeUrl: '/ibc.core.channel.v1.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 { + return { + packet: isSet(object.packet) ? Packet.fromJSON(object.packet) : undefined, + proofCommitment: isSet(object.proofCommitment) + ? bytesFromBase64(object.proofCommitment) + : new Uint8Array(), + proofHeight: isSet(object.proofHeight) + ? Height.fromJSON(object.proofHeight) + : undefined, + signer: isSet(object.signer) ? String(object.signer) : '', + }; + }, + 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(); + message.packet = + object.packet !== undefined && object.packet !== null + ? Packet.fromPartial(object.packet) + : undefined; + message.proofCommitment = object.proofCommitment ?? new Uint8Array(); + message.proofHeight = + object.proofHeight !== undefined && object.proofHeight !== null + ? Height.fromPartial(object.proofHeight) + : undefined; + message.signer = object.signer ?? ''; + return message; + }, + fromProtoMsg(message: MsgRecvPacketProtoMsg): MsgRecvPacket { + return MsgRecvPacket.decode(message.value); + }, + toProto(message: MsgRecvPacket): Uint8Array { + return MsgRecvPacket.encode(message).finish(); + }, + toProtoMsg(message: MsgRecvPacket): MsgRecvPacketProtoMsg { + return { + typeUrl: '/ibc.core.channel.v1.MsgRecvPacket', + value: MsgRecvPacket.encode(message).finish(), + }; + }, +}; +function createBaseMsgRecvPacketResponse(): MsgRecvPacketResponse { + return { + result: 0, + }; +} +export const MsgRecvPacketResponse = { + typeUrl: '/ibc.core.channel.v1.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 { + return { + result: isSet(object.result) + ? responseResultTypeFromJSON(object.result) + : -1, + }; + }, + 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; + }, + fromProtoMsg(message: MsgRecvPacketResponseProtoMsg): MsgRecvPacketResponse { + return MsgRecvPacketResponse.decode(message.value); + }, + toProto(message: MsgRecvPacketResponse): Uint8Array { + return MsgRecvPacketResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgRecvPacketResponse): MsgRecvPacketResponseProtoMsg { + return { + typeUrl: '/ibc.core.channel.v1.MsgRecvPacketResponse', + value: MsgRecvPacketResponse.encode(message).finish(), + }; + }, +}; +function createBaseMsgTimeout(): MsgTimeout { + return { + packet: Packet.fromPartial({}), + proofUnreceived: new Uint8Array(), + proofHeight: Height.fromPartial({}), + nextSequenceRecv: BigInt(0), + signer: '', + }; +} +export const MsgTimeout = { + typeUrl: '/ibc.core.channel.v1.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.nextSequenceRecv !== BigInt(0)) { + writer.uint32(32).uint64(message.nextSequenceRecv); + } + 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 4: + message.nextSequenceRecv = reader.uint64(); + break; + case 5: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgTimeout { + return { + packet: isSet(object.packet) ? Packet.fromJSON(object.packet) : undefined, + proofUnreceived: isSet(object.proofUnreceived) + ? bytesFromBase64(object.proofUnreceived) + : new Uint8Array(), + proofHeight: isSet(object.proofHeight) + ? Height.fromJSON(object.proofHeight) + : undefined, + nextSequenceRecv: isSet(object.nextSequenceRecv) + ? BigInt(object.nextSequenceRecv.toString()) + : BigInt(0), + signer: isSet(object.signer) ? String(object.signer) : '', + }; + }, + 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.nextSequenceRecv !== undefined && + (obj.nextSequenceRecv = ( + message.nextSequenceRecv || BigInt(0) + ).toString()); + message.signer !== undefined && (obj.signer = message.signer); + return obj; + }, + fromPartial(object: Partial): MsgTimeout { + const message = createBaseMsgTimeout(); + message.packet = + object.packet !== undefined && object.packet !== null + ? Packet.fromPartial(object.packet) + : undefined; + message.proofUnreceived = object.proofUnreceived ?? new Uint8Array(); + message.proofHeight = + object.proofHeight !== undefined && object.proofHeight !== null + ? Height.fromPartial(object.proofHeight) + : undefined; + message.nextSequenceRecv = + object.nextSequenceRecv !== undefined && object.nextSequenceRecv !== null + ? BigInt(object.nextSequenceRecv.toString()) + : BigInt(0); + message.signer = object.signer ?? ''; + return message; + }, + fromProtoMsg(message: MsgTimeoutProtoMsg): MsgTimeout { + return MsgTimeout.decode(message.value); + }, + toProto(message: MsgTimeout): Uint8Array { + return MsgTimeout.encode(message).finish(); + }, + toProtoMsg(message: MsgTimeout): MsgTimeoutProtoMsg { + return { + typeUrl: '/ibc.core.channel.v1.MsgTimeout', + value: MsgTimeout.encode(message).finish(), + }; + }, +}; +function createBaseMsgTimeoutResponse(): MsgTimeoutResponse { + return { + result: 0, + }; +} +export const MsgTimeoutResponse = { + typeUrl: '/ibc.core.channel.v1.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 { + return { + result: isSet(object.result) + ? responseResultTypeFromJSON(object.result) + : -1, + }; + }, + 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; + }, + fromProtoMsg(message: MsgTimeoutResponseProtoMsg): MsgTimeoutResponse { + return MsgTimeoutResponse.decode(message.value); + }, + toProto(message: MsgTimeoutResponse): Uint8Array { + return MsgTimeoutResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgTimeoutResponse): MsgTimeoutResponseProtoMsg { + return { + typeUrl: '/ibc.core.channel.v1.MsgTimeoutResponse', + value: MsgTimeoutResponse.encode(message).finish(), + }; + }, +}; +function createBaseMsgTimeoutOnClose(): MsgTimeoutOnClose { + return { + packet: Packet.fromPartial({}), + proofUnreceived: new Uint8Array(), + proofClose: new Uint8Array(), + proofHeight: Height.fromPartial({}), + nextSequenceRecv: BigInt(0), + signer: '', + }; +} +export const MsgTimeoutOnClose = { + typeUrl: '/ibc.core.channel.v1.MsgTimeoutOnClose', + encode( + message: MsgTimeoutOnClose, + 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.proofClose.length !== 0) { + writer.uint32(26).bytes(message.proofClose); + } + if (message.proofHeight !== undefined) { + Height.encode(message.proofHeight, writer.uint32(34).fork()).ldelim(); + } + if (message.nextSequenceRecv !== BigInt(0)) { + writer.uint32(40).uint64(message.nextSequenceRecv); + } + if (message.signer !== '') { + writer.uint32(50).string(message.signer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgTimeoutOnClose { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgTimeoutOnClose(); + 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.proofClose = reader.bytes(); + break; + case 4: + message.proofHeight = Height.decode(reader, reader.uint32()); + break; + case 5: + message.nextSequenceRecv = reader.uint64(); + break; + case 6: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgTimeoutOnClose { + return { + packet: isSet(object.packet) ? Packet.fromJSON(object.packet) : undefined, + proofUnreceived: isSet(object.proofUnreceived) + ? bytesFromBase64(object.proofUnreceived) + : new Uint8Array(), + proofClose: isSet(object.proofClose) + ? bytesFromBase64(object.proofClose) + : new Uint8Array(), + proofHeight: isSet(object.proofHeight) + ? Height.fromJSON(object.proofHeight) + : undefined, + nextSequenceRecv: isSet(object.nextSequenceRecv) + ? BigInt(object.nextSequenceRecv.toString()) + : BigInt(0), + signer: isSet(object.signer) ? String(object.signer) : '', + }; + }, + toJSON(message: MsgTimeoutOnClose): 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.proofClose !== undefined && + (obj.proofClose = base64FromBytes( + message.proofClose !== undefined + ? message.proofClose + : new Uint8Array(), + )); + message.proofHeight !== undefined && + (obj.proofHeight = message.proofHeight + ? Height.toJSON(message.proofHeight) + : undefined); + message.nextSequenceRecv !== undefined && + (obj.nextSequenceRecv = ( + message.nextSequenceRecv || BigInt(0) + ).toString()); + message.signer !== undefined && (obj.signer = message.signer); + return obj; + }, + fromPartial(object: Partial): MsgTimeoutOnClose { + const message = createBaseMsgTimeoutOnClose(); + message.packet = + object.packet !== undefined && object.packet !== null + ? Packet.fromPartial(object.packet) + : undefined; + message.proofUnreceived = object.proofUnreceived ?? new Uint8Array(); + message.proofClose = object.proofClose ?? new Uint8Array(); + message.proofHeight = + object.proofHeight !== undefined && object.proofHeight !== null + ? Height.fromPartial(object.proofHeight) + : undefined; + message.nextSequenceRecv = + object.nextSequenceRecv !== undefined && object.nextSequenceRecv !== null + ? BigInt(object.nextSequenceRecv.toString()) + : BigInt(0); + message.signer = object.signer ?? ''; + return message; + }, + fromProtoMsg(message: MsgTimeoutOnCloseProtoMsg): MsgTimeoutOnClose { + return MsgTimeoutOnClose.decode(message.value); + }, + toProto(message: MsgTimeoutOnClose): Uint8Array { + return MsgTimeoutOnClose.encode(message).finish(); + }, + toProtoMsg(message: MsgTimeoutOnClose): MsgTimeoutOnCloseProtoMsg { + return { + typeUrl: '/ibc.core.channel.v1.MsgTimeoutOnClose', + value: MsgTimeoutOnClose.encode(message).finish(), + }; + }, +}; +function createBaseMsgTimeoutOnCloseResponse(): MsgTimeoutOnCloseResponse { + return { + result: 0, + }; +} +export const MsgTimeoutOnCloseResponse = { + typeUrl: '/ibc.core.channel.v1.MsgTimeoutOnCloseResponse', + encode( + message: MsgTimeoutOnCloseResponse, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.result !== 0) { + writer.uint32(8).int32(message.result); + } + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): MsgTimeoutOnCloseResponse { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgTimeoutOnCloseResponse(); + 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): MsgTimeoutOnCloseResponse { + return { + result: isSet(object.result) + ? responseResultTypeFromJSON(object.result) + : -1, + }; + }, + toJSON(message: MsgTimeoutOnCloseResponse): unknown { + const obj: any = {}; + message.result !== undefined && + (obj.result = responseResultTypeToJSON(message.result)); + return obj; + }, + fromPartial( + object: Partial, + ): MsgTimeoutOnCloseResponse { + const message = createBaseMsgTimeoutOnCloseResponse(); + message.result = object.result ?? 0; + return message; + }, + fromProtoMsg( + message: MsgTimeoutOnCloseResponseProtoMsg, + ): MsgTimeoutOnCloseResponse { + return MsgTimeoutOnCloseResponse.decode(message.value); + }, + toProto(message: MsgTimeoutOnCloseResponse): Uint8Array { + return MsgTimeoutOnCloseResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgTimeoutOnCloseResponse, + ): MsgTimeoutOnCloseResponseProtoMsg { + return { + typeUrl: '/ibc.core.channel.v1.MsgTimeoutOnCloseResponse', + value: MsgTimeoutOnCloseResponse.encode(message).finish(), + }; + }, +}; +function createBaseMsgAcknowledgement(): MsgAcknowledgement { + return { + packet: Packet.fromPartial({}), + acknowledgement: new Uint8Array(), + proofAcked: new Uint8Array(), + proofHeight: Height.fromPartial({}), + signer: '', + }; +} +export const MsgAcknowledgement = { + typeUrl: '/ibc.core.channel.v1.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.length !== 0) { + writer.uint32(18).bytes(message.acknowledgement); + } + 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 = reader.bytes(); + 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 { + return { + packet: isSet(object.packet) ? Packet.fromJSON(object.packet) : undefined, + acknowledgement: isSet(object.acknowledgement) + ? bytesFromBase64(object.acknowledgement) + : new Uint8Array(), + proofAcked: isSet(object.proofAcked) + ? bytesFromBase64(object.proofAcked) + : new Uint8Array(), + proofHeight: isSet(object.proofHeight) + ? Height.fromJSON(object.proofHeight) + : undefined, + signer: isSet(object.signer) ? String(object.signer) : '', + }; + }, + toJSON(message: MsgAcknowledgement): unknown { + const obj: any = {}; + message.packet !== undefined && + (obj.packet = message.packet ? Packet.toJSON(message.packet) : undefined); + message.acknowledgement !== undefined && + (obj.acknowledgement = base64FromBytes( + message.acknowledgement !== undefined + ? message.acknowledgement + : new Uint8Array(), + )); + 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(); + message.packet = + object.packet !== undefined && object.packet !== null + ? Packet.fromPartial(object.packet) + : undefined; + message.acknowledgement = object.acknowledgement ?? new Uint8Array(); + message.proofAcked = object.proofAcked ?? new Uint8Array(); + message.proofHeight = + object.proofHeight !== undefined && object.proofHeight !== null + ? Height.fromPartial(object.proofHeight) + : undefined; + message.signer = object.signer ?? ''; + return message; + }, + fromProtoMsg(message: MsgAcknowledgementProtoMsg): MsgAcknowledgement { + return MsgAcknowledgement.decode(message.value); + }, + toProto(message: MsgAcknowledgement): Uint8Array { + return MsgAcknowledgement.encode(message).finish(); + }, + toProtoMsg(message: MsgAcknowledgement): MsgAcknowledgementProtoMsg { + return { + typeUrl: '/ibc.core.channel.v1.MsgAcknowledgement', + value: MsgAcknowledgement.encode(message).finish(), + }; + }, +}; +function createBaseMsgAcknowledgementResponse(): MsgAcknowledgementResponse { + return { + result: 0, + }; +} +export const MsgAcknowledgementResponse = { + typeUrl: '/ibc.core.channel.v1.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 { + return { + result: isSet(object.result) + ? responseResultTypeFromJSON(object.result) + : -1, + }; + }, + 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; + }, + fromProtoMsg( + message: MsgAcknowledgementResponseProtoMsg, + ): MsgAcknowledgementResponse { + return MsgAcknowledgementResponse.decode(message.value); + }, + toProto(message: MsgAcknowledgementResponse): Uint8Array { + return MsgAcknowledgementResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgAcknowledgementResponse, + ): MsgAcknowledgementResponseProtoMsg { + return { + typeUrl: '/ibc.core.channel.v1.MsgAcknowledgementResponse', + value: MsgAcknowledgementResponse.encode(message).finish(), + }; + }, +}; diff --git a/packages/cosmic-proto/src/codegen/ibc/core/client/v1/genesis.ts b/packages/cosmic-proto/src/codegen/ibc/core/client/v1/genesis.ts new file mode 100644 index 00000000000..f7fafce89f0 --- /dev/null +++ b/packages/cosmic-proto/src/codegen/ibc/core/client/v1/genesis.ts @@ -0,0 +1,424 @@ +//@ts-nocheck +import { + IdentifiedClientState, + IdentifiedClientStateSDKType, + ClientConsensusStates, + ClientConsensusStatesSDKType, + Params, + ParamsSDKType, +} from './client.js'; +import { BinaryReader, BinaryWriter } from '../../../../binary.js'; +import { + isSet, + bytesFromBase64, + base64FromBytes, +} from '../../../../helpers.js'; +/** GenesisState defines the ibc client submodule's genesis state. */ +export interface GenesisState { + /** client states with their corresponding identifiers */ + clients: IdentifiedClientState[]; + /** consensus states from each client */ + clientsConsensus: ClientConsensusStates[]; + /** metadata from each client */ + clientsMetadata: IdentifiedGenesisMetadata[]; + params: Params; + /** create localhost on initialization */ + createLocalhost: boolean; + /** the sequence for the next generated client identifier */ + nextClientSequence: bigint; +} +export interface GenesisStateProtoMsg { + typeUrl: '/ibc.core.client.v1.GenesisState'; + value: Uint8Array; +} +/** GenesisState defines the ibc client submodule's genesis state. */ +export interface GenesisStateSDKType { + clients: IdentifiedClientStateSDKType[]; + clients_consensus: ClientConsensusStatesSDKType[]; + clients_metadata: IdentifiedGenesisMetadataSDKType[]; + params: ParamsSDKType; + create_localhost: boolean; + next_client_sequence: bigint; +} +/** + * GenesisMetadata defines the genesis type for metadata that clients may return + * with ExportMetadata + */ +export interface GenesisMetadata { + /** store key of metadata without clientID-prefix */ + key: Uint8Array; + /** metadata value */ + value: Uint8Array; +} +export interface GenesisMetadataProtoMsg { + typeUrl: '/ibc.core.client.v1.GenesisMetadata'; + value: Uint8Array; +} +/** + * GenesisMetadata defines the genesis type for metadata that clients may return + * with ExportMetadata + */ +export interface GenesisMetadataSDKType { + key: Uint8Array; + value: Uint8Array; +} +/** + * IdentifiedGenesisMetadata has the client metadata with the corresponding + * client id. + */ +export interface IdentifiedGenesisMetadata { + clientId: string; + clientMetadata: GenesisMetadata[]; +} +export interface IdentifiedGenesisMetadataProtoMsg { + typeUrl: '/ibc.core.client.v1.IdentifiedGenesisMetadata'; + value: Uint8Array; +} +/** + * IdentifiedGenesisMetadata has the client metadata with the corresponding + * client id. + */ +export interface IdentifiedGenesisMetadataSDKType { + client_id: string; + client_metadata: GenesisMetadataSDKType[]; +} +function createBaseGenesisState(): GenesisState { + return { + clients: [], + clientsConsensus: [], + clientsMetadata: [], + params: Params.fromPartial({}), + createLocalhost: false, + nextClientSequence: BigInt(0), + }; +} +export const GenesisState = { + typeUrl: '/ibc.core.client.v1.GenesisState', + encode( + message: GenesisState, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + for (const v of message.clients) { + IdentifiedClientState.encode(v!, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.clientsConsensus) { + ClientConsensusStates.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.clientsMetadata) { + IdentifiedGenesisMetadata.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(34).fork()).ldelim(); + } + if (message.createLocalhost === true) { + writer.uint32(40).bool(message.createLocalhost); + } + if (message.nextClientSequence !== BigInt(0)) { + writer.uint32(48).uint64(message.nextClientSequence); + } + 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.clients.push( + IdentifiedClientState.decode(reader, reader.uint32()), + ); + break; + case 2: + message.clientsConsensus.push( + ClientConsensusStates.decode(reader, reader.uint32()), + ); + break; + case 3: + message.clientsMetadata.push( + IdentifiedGenesisMetadata.decode(reader, reader.uint32()), + ); + break; + case 4: + message.params = Params.decode(reader, reader.uint32()); + break; + case 5: + message.createLocalhost = reader.bool(); + break; + case 6: + message.nextClientSequence = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): GenesisState { + return { + clients: Array.isArray(object?.clients) + ? object.clients.map((e: any) => IdentifiedClientState.fromJSON(e)) + : [], + clientsConsensus: Array.isArray(object?.clientsConsensus) + ? object.clientsConsensus.map((e: any) => + ClientConsensusStates.fromJSON(e), + ) + : [], + clientsMetadata: Array.isArray(object?.clientsMetadata) + ? object.clientsMetadata.map((e: any) => + IdentifiedGenesisMetadata.fromJSON(e), + ) + : [], + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + createLocalhost: isSet(object.createLocalhost) + ? Boolean(object.createLocalhost) + : false, + nextClientSequence: isSet(object.nextClientSequence) + ? BigInt(object.nextClientSequence.toString()) + : BigInt(0), + }; + }, + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.clients) { + obj.clients = message.clients.map(e => + e ? IdentifiedClientState.toJSON(e) : undefined, + ); + } else { + obj.clients = []; + } + if (message.clientsConsensus) { + obj.clientsConsensus = message.clientsConsensus.map(e => + e ? ClientConsensusStates.toJSON(e) : undefined, + ); + } else { + obj.clientsConsensus = []; + } + if (message.clientsMetadata) { + obj.clientsMetadata = message.clientsMetadata.map(e => + e ? IdentifiedGenesisMetadata.toJSON(e) : undefined, + ); + } else { + obj.clientsMetadata = []; + } + message.params !== undefined && + (obj.params = message.params ? Params.toJSON(message.params) : undefined); + message.createLocalhost !== undefined && + (obj.createLocalhost = message.createLocalhost); + message.nextClientSequence !== undefined && + (obj.nextClientSequence = ( + message.nextClientSequence || BigInt(0) + ).toString()); + return obj; + }, + fromPartial(object: Partial): GenesisState { + const message = createBaseGenesisState(); + message.clients = + object.clients?.map(e => IdentifiedClientState.fromPartial(e)) || []; + message.clientsConsensus = + object.clientsConsensus?.map(e => ClientConsensusStates.fromPartial(e)) || + []; + message.clientsMetadata = + object.clientsMetadata?.map(e => + IdentifiedGenesisMetadata.fromPartial(e), + ) || []; + message.params = + object.params !== undefined && object.params !== null + ? Params.fromPartial(object.params) + : undefined; + message.createLocalhost = object.createLocalhost ?? false; + message.nextClientSequence = + object.nextClientSequence !== undefined && + object.nextClientSequence !== null + ? BigInt(object.nextClientSequence.toString()) + : BigInt(0); + return message; + }, + fromProtoMsg(message: GenesisStateProtoMsg): GenesisState { + return GenesisState.decode(message.value); + }, + toProto(message: GenesisState): Uint8Array { + return GenesisState.encode(message).finish(); + }, + toProtoMsg(message: GenesisState): GenesisStateProtoMsg { + return { + typeUrl: '/ibc.core.client.v1.GenesisState', + value: GenesisState.encode(message).finish(), + }; + }, +}; +function createBaseGenesisMetadata(): GenesisMetadata { + return { + key: new Uint8Array(), + value: new Uint8Array(), + }; +} +export const GenesisMetadata = { + typeUrl: '/ibc.core.client.v1.GenesisMetadata', + encode( + message: GenesisMetadata, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GenesisMetadata { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.bytes(); + break; + case 2: + message.value = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): GenesisMetadata { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(), + value: isSet(object.value) + ? bytesFromBase64(object.value) + : new Uint8Array(), + }; + }, + toJSON(message: GenesisMetadata): unknown { + const obj: any = {}; + message.key !== undefined && + (obj.key = base64FromBytes( + message.key !== undefined ? message.key : new Uint8Array(), + )); + message.value !== undefined && + (obj.value = base64FromBytes( + message.value !== undefined ? message.value : new Uint8Array(), + )); + return obj; + }, + fromPartial(object: Partial): GenesisMetadata { + const message = createBaseGenesisMetadata(); + message.key = object.key ?? new Uint8Array(); + message.value = object.value ?? new Uint8Array(); + return message; + }, + fromProtoMsg(message: GenesisMetadataProtoMsg): GenesisMetadata { + return GenesisMetadata.decode(message.value); + }, + toProto(message: GenesisMetadata): Uint8Array { + return GenesisMetadata.encode(message).finish(); + }, + toProtoMsg(message: GenesisMetadata): GenesisMetadataProtoMsg { + return { + typeUrl: '/ibc.core.client.v1.GenesisMetadata', + value: GenesisMetadata.encode(message).finish(), + }; + }, +}; +function createBaseIdentifiedGenesisMetadata(): IdentifiedGenesisMetadata { + return { + clientId: '', + clientMetadata: [], + }; +} +export const IdentifiedGenesisMetadata = { + typeUrl: '/ibc.core.client.v1.IdentifiedGenesisMetadata', + encode( + message: IdentifiedGenesisMetadata, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.clientId !== '') { + writer.uint32(10).string(message.clientId); + } + for (const v of message.clientMetadata) { + GenesisMetadata.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): IdentifiedGenesisMetadata { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIdentifiedGenesisMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.clientMetadata.push( + GenesisMetadata.decode(reader, reader.uint32()), + ); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): IdentifiedGenesisMetadata { + return { + clientId: isSet(object.clientId) ? String(object.clientId) : '', + clientMetadata: Array.isArray(object?.clientMetadata) + ? object.clientMetadata.map((e: any) => GenesisMetadata.fromJSON(e)) + : [], + }; + }, + toJSON(message: IdentifiedGenesisMetadata): unknown { + const obj: any = {}; + message.clientId !== undefined && (obj.clientId = message.clientId); + if (message.clientMetadata) { + obj.clientMetadata = message.clientMetadata.map(e => + e ? GenesisMetadata.toJSON(e) : undefined, + ); + } else { + obj.clientMetadata = []; + } + return obj; + }, + fromPartial( + object: Partial, + ): IdentifiedGenesisMetadata { + const message = createBaseIdentifiedGenesisMetadata(); + message.clientId = object.clientId ?? ''; + message.clientMetadata = + object.clientMetadata?.map(e => GenesisMetadata.fromPartial(e)) || []; + return message; + }, + fromProtoMsg( + message: IdentifiedGenesisMetadataProtoMsg, + ): IdentifiedGenesisMetadata { + return IdentifiedGenesisMetadata.decode(message.value); + }, + toProto(message: IdentifiedGenesisMetadata): Uint8Array { + return IdentifiedGenesisMetadata.encode(message).finish(); + }, + toProtoMsg( + message: IdentifiedGenesisMetadata, + ): IdentifiedGenesisMetadataProtoMsg { + return { + typeUrl: '/ibc.core.client.v1.IdentifiedGenesisMetadata', + value: IdentifiedGenesisMetadata.encode(message).finish(), + }; + }, +}; diff --git a/packages/cosmic-proto/src/codegen/ibc/core/client/v1/query.ts b/packages/cosmic-proto/src/codegen/ibc/core/client/v1/query.ts new file mode 100644 index 00000000000..8939be5e4bd --- /dev/null +++ b/packages/cosmic-proto/src/codegen/ibc/core/client/v1/query.ts @@ -0,0 +1,1932 @@ +//@ts-nocheck +import { + PageRequest, + PageRequestSDKType, + PageResponse, + PageResponseSDKType, +} from '../../../../cosmos/base/query/v1beta1/pagination.js'; +import { Any, AnySDKType } from '../../../../google/protobuf/any.js'; +import { + Height, + HeightSDKType, + IdentifiedClientState, + IdentifiedClientStateSDKType, + ConsensusStateWithHeight, + ConsensusStateWithHeightSDKType, + Params, + ParamsSDKType, +} from './client.js'; +import { BinaryReader, BinaryWriter } from '../../../../binary.js'; +import { + isSet, + bytesFromBase64, + base64FromBytes, +} from '../../../../helpers.js'; +/** + * QueryClientStateRequest is the request type for the Query/ClientState RPC + * method + */ +export interface QueryClientStateRequest { + /** client state unique identifier */ + clientId: string; +} +export interface QueryClientStateRequestProtoMsg { + typeUrl: '/ibc.core.client.v1.QueryClientStateRequest'; + value: Uint8Array; +} +/** + * QueryClientStateRequest is the request type for the Query/ClientState RPC + * method + */ +export interface QueryClientStateRequestSDKType { + client_id: string; +} +/** + * QueryClientStateResponse is the response type for the Query/ClientState RPC + * method. Besides the client state, it includes a proof and the height from + * which the proof was retrieved. + */ +export interface QueryClientStateResponse { + /** client state associated with the request identifier */ + clientState?: Any; + /** merkle proof of existence */ + proof: Uint8Array; + /** height at which the proof was retrieved */ + proofHeight: Height; +} +export interface QueryClientStateResponseProtoMsg { + typeUrl: '/ibc.core.client.v1.QueryClientStateResponse'; + value: Uint8Array; +} +/** + * QueryClientStateResponse is the response type for the Query/ClientState RPC + * method. Besides the client state, it includes a proof and the height from + * which the proof was retrieved. + */ +export interface QueryClientStateResponseSDKType { + client_state?: AnySDKType; + proof: Uint8Array; + proof_height: HeightSDKType; +} +/** + * QueryClientStatesRequest is the request type for the Query/ClientStates RPC + * method + */ +export interface QueryClientStatesRequest { + /** pagination request */ + pagination?: PageRequest; +} +export interface QueryClientStatesRequestProtoMsg { + typeUrl: '/ibc.core.client.v1.QueryClientStatesRequest'; + value: Uint8Array; +} +/** + * QueryClientStatesRequest is the request type for the Query/ClientStates RPC + * method + */ +export interface QueryClientStatesRequestSDKType { + pagination?: PageRequestSDKType; +} +/** + * QueryClientStatesResponse is the response type for the Query/ClientStates RPC + * method. + */ +export interface QueryClientStatesResponse { + /** list of stored ClientStates of the chain. */ + clientStates: IdentifiedClientState[]; + /** pagination response */ + pagination?: PageResponse; +} +export interface QueryClientStatesResponseProtoMsg { + typeUrl: '/ibc.core.client.v1.QueryClientStatesResponse'; + value: Uint8Array; +} +/** + * QueryClientStatesResponse is the response type for the Query/ClientStates RPC + * method. + */ +export interface QueryClientStatesResponseSDKType { + client_states: IdentifiedClientStateSDKType[]; + pagination?: PageResponseSDKType; +} +/** + * QueryConsensusStateRequest is the request type for the Query/ConsensusState + * RPC method. Besides the consensus state, it includes a proof and the height + * from which the proof was retrieved. + */ +export interface QueryConsensusStateRequest { + /** client identifier */ + clientId: string; + /** consensus state revision number */ + revisionNumber: bigint; + /** consensus state revision height */ + revisionHeight: bigint; + /** + * latest_height overrrides the height field and queries the latest stored + * ConsensusState + */ + latestHeight: boolean; +} +export interface QueryConsensusStateRequestProtoMsg { + typeUrl: '/ibc.core.client.v1.QueryConsensusStateRequest'; + value: Uint8Array; +} +/** + * QueryConsensusStateRequest is the request type for the Query/ConsensusState + * RPC method. Besides the consensus state, it includes a proof and the height + * from which the proof was retrieved. + */ +export interface QueryConsensusStateRequestSDKType { + client_id: string; + revision_number: bigint; + revision_height: bigint; + latest_height: boolean; +} +/** + * QueryConsensusStateResponse is the response type for the Query/ConsensusState + * RPC method + */ +export interface QueryConsensusStateResponse { + /** consensus state associated with the client identifier at the given height */ + consensusState?: Any; + /** merkle proof of existence */ + proof: Uint8Array; + /** height at which the proof was retrieved */ + proofHeight: Height; +} +export interface QueryConsensusStateResponseProtoMsg { + typeUrl: '/ibc.core.client.v1.QueryConsensusStateResponse'; + value: Uint8Array; +} +/** + * QueryConsensusStateResponse is the response type for the Query/ConsensusState + * RPC method + */ +export interface QueryConsensusStateResponseSDKType { + consensus_state?: AnySDKType; + proof: Uint8Array; + proof_height: HeightSDKType; +} +/** + * QueryConsensusStatesRequest is the request type for the Query/ConsensusStates + * RPC method. + */ +export interface QueryConsensusStatesRequest { + /** client identifier */ + clientId: string; + /** pagination request */ + pagination?: PageRequest; +} +export interface QueryConsensusStatesRequestProtoMsg { + typeUrl: '/ibc.core.client.v1.QueryConsensusStatesRequest'; + value: Uint8Array; +} +/** + * QueryConsensusStatesRequest is the request type for the Query/ConsensusStates + * RPC method. + */ +export interface QueryConsensusStatesRequestSDKType { + client_id: string; + pagination?: PageRequestSDKType; +} +/** + * QueryConsensusStatesResponse is the response type for the + * Query/ConsensusStates RPC method + */ +export interface QueryConsensusStatesResponse { + /** consensus states associated with the identifier */ + consensusStates: ConsensusStateWithHeight[]; + /** pagination response */ + pagination?: PageResponse; +} +export interface QueryConsensusStatesResponseProtoMsg { + typeUrl: '/ibc.core.client.v1.QueryConsensusStatesResponse'; + value: Uint8Array; +} +/** + * QueryConsensusStatesResponse is the response type for the + * Query/ConsensusStates RPC method + */ +export interface QueryConsensusStatesResponseSDKType { + consensus_states: ConsensusStateWithHeightSDKType[]; + pagination?: PageResponseSDKType; +} +/** + * QueryConsensusStateHeightsRequest is the request type for Query/ConsensusStateHeights + * RPC method. + */ +export interface QueryConsensusStateHeightsRequest { + /** client identifier */ + clientId: string; + /** pagination request */ + pagination?: PageRequest; +} +export interface QueryConsensusStateHeightsRequestProtoMsg { + typeUrl: '/ibc.core.client.v1.QueryConsensusStateHeightsRequest'; + value: Uint8Array; +} +/** + * QueryConsensusStateHeightsRequest is the request type for Query/ConsensusStateHeights + * RPC method. + */ +export interface QueryConsensusStateHeightsRequestSDKType { + client_id: string; + pagination?: PageRequestSDKType; +} +/** + * QueryConsensusStateHeightsResponse is the response type for the + * Query/ConsensusStateHeights RPC method + */ +export interface QueryConsensusStateHeightsResponse { + /** consensus state heights */ + consensusStateHeights: Height[]; + /** pagination response */ + pagination?: PageResponse; +} +export interface QueryConsensusStateHeightsResponseProtoMsg { + typeUrl: '/ibc.core.client.v1.QueryConsensusStateHeightsResponse'; + value: Uint8Array; +} +/** + * QueryConsensusStateHeightsResponse is the response type for the + * Query/ConsensusStateHeights RPC method + */ +export interface QueryConsensusStateHeightsResponseSDKType { + consensus_state_heights: HeightSDKType[]; + pagination?: PageResponseSDKType; +} +/** + * QueryClientStatusRequest is the request type for the Query/ClientStatus RPC + * method + */ +export interface QueryClientStatusRequest { + /** client unique identifier */ + clientId: string; +} +export interface QueryClientStatusRequestProtoMsg { + typeUrl: '/ibc.core.client.v1.QueryClientStatusRequest'; + value: Uint8Array; +} +/** + * QueryClientStatusRequest is the request type for the Query/ClientStatus RPC + * method + */ +export interface QueryClientStatusRequestSDKType { + client_id: string; +} +/** + * QueryClientStatusResponse is the response type for the Query/ClientStatus RPC + * method. It returns the current status of the IBC client. + */ +export interface QueryClientStatusResponse { + status: string; +} +export interface QueryClientStatusResponseProtoMsg { + typeUrl: '/ibc.core.client.v1.QueryClientStatusResponse'; + value: Uint8Array; +} +/** + * QueryClientStatusResponse is the response type for the Query/ClientStatus RPC + * method. It returns the current status of the IBC client. + */ +export interface QueryClientStatusResponseSDKType { + status: string; +} +/** + * QueryClientParamsRequest is the request type for the Query/ClientParams RPC + * method. + */ +export interface QueryClientParamsRequest {} +export interface QueryClientParamsRequestProtoMsg { + typeUrl: '/ibc.core.client.v1.QueryClientParamsRequest'; + value: Uint8Array; +} +/** + * QueryClientParamsRequest is the request type for the Query/ClientParams RPC + * method. + */ +export interface QueryClientParamsRequestSDKType {} +/** + * QueryClientParamsResponse is the response type for the Query/ClientParams RPC + * method. + */ +export interface QueryClientParamsResponse { + /** params defines the parameters of the module. */ + params?: Params; +} +export interface QueryClientParamsResponseProtoMsg { + typeUrl: '/ibc.core.client.v1.QueryClientParamsResponse'; + value: Uint8Array; +} +/** + * QueryClientParamsResponse is the response type for the Query/ClientParams RPC + * method. + */ +export interface QueryClientParamsResponseSDKType { + params?: ParamsSDKType; +} +/** + * QueryUpgradedClientStateRequest is the request type for the + * Query/UpgradedClientState RPC method + */ +export interface QueryUpgradedClientStateRequest {} +export interface QueryUpgradedClientStateRequestProtoMsg { + typeUrl: '/ibc.core.client.v1.QueryUpgradedClientStateRequest'; + value: Uint8Array; +} +/** + * QueryUpgradedClientStateRequest is the request type for the + * Query/UpgradedClientState RPC method + */ +export interface QueryUpgradedClientStateRequestSDKType {} +/** + * QueryUpgradedClientStateResponse is the response type for the + * Query/UpgradedClientState RPC method. + */ +export interface QueryUpgradedClientStateResponse { + /** client state associated with the request identifier */ + upgradedClientState?: Any; +} +export interface QueryUpgradedClientStateResponseProtoMsg { + typeUrl: '/ibc.core.client.v1.QueryUpgradedClientStateResponse'; + value: Uint8Array; +} +/** + * QueryUpgradedClientStateResponse is the response type for the + * Query/UpgradedClientState RPC method. + */ +export interface QueryUpgradedClientStateResponseSDKType { + upgraded_client_state?: AnySDKType; +} +/** + * QueryUpgradedConsensusStateRequest is the request type for the + * Query/UpgradedConsensusState RPC method + */ +export interface QueryUpgradedConsensusStateRequest {} +export interface QueryUpgradedConsensusStateRequestProtoMsg { + typeUrl: '/ibc.core.client.v1.QueryUpgradedConsensusStateRequest'; + value: Uint8Array; +} +/** + * QueryUpgradedConsensusStateRequest is the request type for the + * Query/UpgradedConsensusState RPC method + */ +export interface QueryUpgradedConsensusStateRequestSDKType {} +/** + * QueryUpgradedConsensusStateResponse is the response type for the + * Query/UpgradedConsensusState RPC method. + */ +export interface QueryUpgradedConsensusStateResponse { + /** Consensus state associated with the request identifier */ + upgradedConsensusState?: Any; +} +export interface QueryUpgradedConsensusStateResponseProtoMsg { + typeUrl: '/ibc.core.client.v1.QueryUpgradedConsensusStateResponse'; + value: Uint8Array; +} +/** + * QueryUpgradedConsensusStateResponse is the response type for the + * Query/UpgradedConsensusState RPC method. + */ +export interface QueryUpgradedConsensusStateResponseSDKType { + upgraded_consensus_state?: AnySDKType; +} +function createBaseQueryClientStateRequest(): QueryClientStateRequest { + return { + clientId: '', + }; +} +export const QueryClientStateRequest = { + typeUrl: '/ibc.core.client.v1.QueryClientStateRequest', + encode( + message: QueryClientStateRequest, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.clientId !== '') { + writer.uint32(10).string(message.clientId); + } + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): QueryClientStateRequest { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClientStateRequest(); + 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): QueryClientStateRequest { + return { + clientId: isSet(object.clientId) ? String(object.clientId) : '', + }; + }, + toJSON(message: QueryClientStateRequest): unknown { + const obj: any = {}; + message.clientId !== undefined && (obj.clientId = message.clientId); + return obj; + }, + fromPartial( + object: Partial, + ): QueryClientStateRequest { + const message = createBaseQueryClientStateRequest(); + message.clientId = object.clientId ?? ''; + return message; + }, + fromProtoMsg( + message: QueryClientStateRequestProtoMsg, + ): QueryClientStateRequest { + return QueryClientStateRequest.decode(message.value); + }, + toProto(message: QueryClientStateRequest): Uint8Array { + return QueryClientStateRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryClientStateRequest, + ): QueryClientStateRequestProtoMsg { + return { + typeUrl: '/ibc.core.client.v1.QueryClientStateRequest', + value: QueryClientStateRequest.encode(message).finish(), + }; + }, +}; +function createBaseQueryClientStateResponse(): QueryClientStateResponse { + return { + clientState: undefined, + proof: new Uint8Array(), + proofHeight: Height.fromPartial({}), + }; +} +export const QueryClientStateResponse = { + typeUrl: '/ibc.core.client.v1.QueryClientStateResponse', + encode( + message: QueryClientStateResponse, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.clientState !== undefined) { + Any.encode(message.clientState, writer.uint32(10).fork()).ldelim(); + } + 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, + ): QueryClientStateResponse { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClientStateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientState = Any.decode(reader, reader.uint32()); + 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): QueryClientStateResponse { + return { + clientState: isSet(object.clientState) + ? Any.fromJSON(object.clientState) + : undefined, + proof: isSet(object.proof) + ? bytesFromBase64(object.proof) + : new Uint8Array(), + proofHeight: isSet(object.proofHeight) + ? Height.fromJSON(object.proofHeight) + : undefined, + }; + }, + toJSON(message: QueryClientStateResponse): unknown { + const obj: any = {}; + message.clientState !== undefined && + (obj.clientState = message.clientState + ? Any.toJSON(message.clientState) + : undefined); + 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, + ): QueryClientStateResponse { + const message = createBaseQueryClientStateResponse(); + message.clientState = + object.clientState !== undefined && object.clientState !== null + ? Any.fromPartial(object.clientState) + : undefined; + message.proof = object.proof ?? new Uint8Array(); + message.proofHeight = + object.proofHeight !== undefined && object.proofHeight !== null + ? Height.fromPartial(object.proofHeight) + : undefined; + return message; + }, + fromProtoMsg( + message: QueryClientStateResponseProtoMsg, + ): QueryClientStateResponse { + return QueryClientStateResponse.decode(message.value); + }, + toProto(message: QueryClientStateResponse): Uint8Array { + return QueryClientStateResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryClientStateResponse, + ): QueryClientStateResponseProtoMsg { + return { + typeUrl: '/ibc.core.client.v1.QueryClientStateResponse', + value: QueryClientStateResponse.encode(message).finish(), + }; + }, +}; +function createBaseQueryClientStatesRequest(): QueryClientStatesRequest { + return { + pagination: undefined, + }; +} +export const QueryClientStatesRequest = { + typeUrl: '/ibc.core.client.v1.QueryClientStatesRequest', + encode( + message: QueryClientStatesRequest, + 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, + ): QueryClientStatesRequest { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClientStatesRequest(); + 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): QueryClientStatesRequest { + return { + pagination: isSet(object.pagination) + ? PageRequest.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message: QueryClientStatesRequest): unknown { + const obj: any = {}; + message.pagination !== undefined && + (obj.pagination = message.pagination + ? PageRequest.toJSON(message.pagination) + : undefined); + return obj; + }, + fromPartial( + object: Partial, + ): QueryClientStatesRequest { + const message = createBaseQueryClientStatesRequest(); + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, + fromProtoMsg( + message: QueryClientStatesRequestProtoMsg, + ): QueryClientStatesRequest { + return QueryClientStatesRequest.decode(message.value); + }, + toProto(message: QueryClientStatesRequest): Uint8Array { + return QueryClientStatesRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryClientStatesRequest, + ): QueryClientStatesRequestProtoMsg { + return { + typeUrl: '/ibc.core.client.v1.QueryClientStatesRequest', + value: QueryClientStatesRequest.encode(message).finish(), + }; + }, +}; +function createBaseQueryClientStatesResponse(): QueryClientStatesResponse { + return { + clientStates: [], + pagination: undefined, + }; +} +export const QueryClientStatesResponse = { + typeUrl: '/ibc.core.client.v1.QueryClientStatesResponse', + encode( + message: QueryClientStatesResponse, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + for (const v of message.clientStates) { + IdentifiedClientState.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, + ): QueryClientStatesResponse { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClientStatesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientStates.push( + IdentifiedClientState.decode(reader, reader.uint32()), + ); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryClientStatesResponse { + return { + clientStates: Array.isArray(object?.clientStates) + ? object.clientStates.map((e: any) => IdentifiedClientState.fromJSON(e)) + : [], + pagination: isSet(object.pagination) + ? PageResponse.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message: QueryClientStatesResponse): unknown { + const obj: any = {}; + if (message.clientStates) { + obj.clientStates = message.clientStates.map(e => + e ? IdentifiedClientState.toJSON(e) : undefined, + ); + } else { + obj.clientStates = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination + ? PageResponse.toJSON(message.pagination) + : undefined); + return obj; + }, + fromPartial( + object: Partial, + ): QueryClientStatesResponse { + const message = createBaseQueryClientStatesResponse(); + message.clientStates = + object.clientStates?.map(e => IdentifiedClientState.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, + fromProtoMsg( + message: QueryClientStatesResponseProtoMsg, + ): QueryClientStatesResponse { + return QueryClientStatesResponse.decode(message.value); + }, + toProto(message: QueryClientStatesResponse): Uint8Array { + return QueryClientStatesResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryClientStatesResponse, + ): QueryClientStatesResponseProtoMsg { + return { + typeUrl: '/ibc.core.client.v1.QueryClientStatesResponse', + value: QueryClientStatesResponse.encode(message).finish(), + }; + }, +}; +function createBaseQueryConsensusStateRequest(): QueryConsensusStateRequest { + return { + clientId: '', + revisionNumber: BigInt(0), + revisionHeight: BigInt(0), + latestHeight: false, + }; +} +export const QueryConsensusStateRequest = { + typeUrl: '/ibc.core.client.v1.QueryConsensusStateRequest', + encode( + message: QueryConsensusStateRequest, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.clientId !== '') { + writer.uint32(10).string(message.clientId); + } + if (message.revisionNumber !== BigInt(0)) { + writer.uint32(16).uint64(message.revisionNumber); + } + if (message.revisionHeight !== BigInt(0)) { + writer.uint32(24).uint64(message.revisionHeight); + } + if (message.latestHeight === true) { + writer.uint32(32).bool(message.latestHeight); + } + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): QueryConsensusStateRequest { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConsensusStateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.revisionNumber = reader.uint64(); + break; + case 3: + message.revisionHeight = reader.uint64(); + break; + case 4: + message.latestHeight = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryConsensusStateRequest { + return { + clientId: isSet(object.clientId) ? String(object.clientId) : '', + revisionNumber: isSet(object.revisionNumber) + ? BigInt(object.revisionNumber.toString()) + : BigInt(0), + revisionHeight: isSet(object.revisionHeight) + ? BigInt(object.revisionHeight.toString()) + : BigInt(0), + latestHeight: isSet(object.latestHeight) + ? Boolean(object.latestHeight) + : false, + }; + }, + toJSON(message: QueryConsensusStateRequest): unknown { + const obj: any = {}; + message.clientId !== undefined && (obj.clientId = message.clientId); + message.revisionNumber !== undefined && + (obj.revisionNumber = (message.revisionNumber || BigInt(0)).toString()); + message.revisionHeight !== undefined && + (obj.revisionHeight = (message.revisionHeight || BigInt(0)).toString()); + message.latestHeight !== undefined && + (obj.latestHeight = message.latestHeight); + return obj; + }, + fromPartial( + object: Partial, + ): QueryConsensusStateRequest { + const message = createBaseQueryConsensusStateRequest(); + message.clientId = object.clientId ?? ''; + message.revisionNumber = + object.revisionNumber !== undefined && object.revisionNumber !== null + ? BigInt(object.revisionNumber.toString()) + : BigInt(0); + message.revisionHeight = + object.revisionHeight !== undefined && object.revisionHeight !== null + ? BigInt(object.revisionHeight.toString()) + : BigInt(0); + message.latestHeight = object.latestHeight ?? false; + return message; + }, + fromProtoMsg( + message: QueryConsensusStateRequestProtoMsg, + ): QueryConsensusStateRequest { + return QueryConsensusStateRequest.decode(message.value); + }, + toProto(message: QueryConsensusStateRequest): Uint8Array { + return QueryConsensusStateRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryConsensusStateRequest, + ): QueryConsensusStateRequestProtoMsg { + return { + typeUrl: '/ibc.core.client.v1.QueryConsensusStateRequest', + value: QueryConsensusStateRequest.encode(message).finish(), + }; + }, +}; +function createBaseQueryConsensusStateResponse(): QueryConsensusStateResponse { + return { + consensusState: undefined, + proof: new Uint8Array(), + proofHeight: Height.fromPartial({}), + }; +} +export const QueryConsensusStateResponse = { + typeUrl: '/ibc.core.client.v1.QueryConsensusStateResponse', + encode( + message: QueryConsensusStateResponse, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.consensusState !== undefined) { + Any.encode(message.consensusState, writer.uint32(10).fork()).ldelim(); + } + 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, + ): QueryConsensusStateResponse { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConsensusStateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.consensusState = Any.decode(reader, reader.uint32()); + 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): QueryConsensusStateResponse { + return { + consensusState: isSet(object.consensusState) + ? Any.fromJSON(object.consensusState) + : undefined, + proof: isSet(object.proof) + ? bytesFromBase64(object.proof) + : new Uint8Array(), + proofHeight: isSet(object.proofHeight) + ? Height.fromJSON(object.proofHeight) + : undefined, + }; + }, + toJSON(message: QueryConsensusStateResponse): unknown { + const obj: any = {}; + message.consensusState !== undefined && + (obj.consensusState = message.consensusState + ? Any.toJSON(message.consensusState) + : undefined); + 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, + ): QueryConsensusStateResponse { + const message = createBaseQueryConsensusStateResponse(); + message.consensusState = + object.consensusState !== undefined && object.consensusState !== null + ? Any.fromPartial(object.consensusState) + : undefined; + message.proof = object.proof ?? new Uint8Array(); + message.proofHeight = + object.proofHeight !== undefined && object.proofHeight !== null + ? Height.fromPartial(object.proofHeight) + : undefined; + return message; + }, + fromProtoMsg( + message: QueryConsensusStateResponseProtoMsg, + ): QueryConsensusStateResponse { + return QueryConsensusStateResponse.decode(message.value); + }, + toProto(message: QueryConsensusStateResponse): Uint8Array { + return QueryConsensusStateResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryConsensusStateResponse, + ): QueryConsensusStateResponseProtoMsg { + return { + typeUrl: '/ibc.core.client.v1.QueryConsensusStateResponse', + value: QueryConsensusStateResponse.encode(message).finish(), + }; + }, +}; +function createBaseQueryConsensusStatesRequest(): QueryConsensusStatesRequest { + return { + clientId: '', + pagination: undefined, + }; +} +export const QueryConsensusStatesRequest = { + typeUrl: '/ibc.core.client.v1.QueryConsensusStatesRequest', + encode( + message: QueryConsensusStatesRequest, + 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, + ): QueryConsensusStatesRequest { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConsensusStatesRequest(); + 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): QueryConsensusStatesRequest { + return { + clientId: isSet(object.clientId) ? String(object.clientId) : '', + pagination: isSet(object.pagination) + ? PageRequest.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message: QueryConsensusStatesRequest): 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, + ): QueryConsensusStatesRequest { + const message = createBaseQueryConsensusStatesRequest(); + message.clientId = object.clientId ?? ''; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, + fromProtoMsg( + message: QueryConsensusStatesRequestProtoMsg, + ): QueryConsensusStatesRequest { + return QueryConsensusStatesRequest.decode(message.value); + }, + toProto(message: QueryConsensusStatesRequest): Uint8Array { + return QueryConsensusStatesRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryConsensusStatesRequest, + ): QueryConsensusStatesRequestProtoMsg { + return { + typeUrl: '/ibc.core.client.v1.QueryConsensusStatesRequest', + value: QueryConsensusStatesRequest.encode(message).finish(), + }; + }, +}; +function createBaseQueryConsensusStatesResponse(): QueryConsensusStatesResponse { + return { + consensusStates: [], + pagination: undefined, + }; +} +export const QueryConsensusStatesResponse = { + typeUrl: '/ibc.core.client.v1.QueryConsensusStatesResponse', + encode( + message: QueryConsensusStatesResponse, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + for (const v of message.consensusStates) { + ConsensusStateWithHeight.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, + ): QueryConsensusStatesResponse { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConsensusStatesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.consensusStates.push( + ConsensusStateWithHeight.decode(reader, reader.uint32()), + ); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryConsensusStatesResponse { + return { + consensusStates: Array.isArray(object?.consensusStates) + ? object.consensusStates.map((e: any) => + ConsensusStateWithHeight.fromJSON(e), + ) + : [], + pagination: isSet(object.pagination) + ? PageResponse.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message: QueryConsensusStatesResponse): unknown { + const obj: any = {}; + if (message.consensusStates) { + obj.consensusStates = message.consensusStates.map(e => + e ? ConsensusStateWithHeight.toJSON(e) : undefined, + ); + } else { + obj.consensusStates = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination + ? PageResponse.toJSON(message.pagination) + : undefined); + return obj; + }, + fromPartial( + object: Partial, + ): QueryConsensusStatesResponse { + const message = createBaseQueryConsensusStatesResponse(); + message.consensusStates = + object.consensusStates?.map(e => + ConsensusStateWithHeight.fromPartial(e), + ) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, + fromProtoMsg( + message: QueryConsensusStatesResponseProtoMsg, + ): QueryConsensusStatesResponse { + return QueryConsensusStatesResponse.decode(message.value); + }, + toProto(message: QueryConsensusStatesResponse): Uint8Array { + return QueryConsensusStatesResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryConsensusStatesResponse, + ): QueryConsensusStatesResponseProtoMsg { + return { + typeUrl: '/ibc.core.client.v1.QueryConsensusStatesResponse', + value: QueryConsensusStatesResponse.encode(message).finish(), + }; + }, +}; +function createBaseQueryConsensusStateHeightsRequest(): QueryConsensusStateHeightsRequest { + return { + clientId: '', + pagination: undefined, + }; +} +export const QueryConsensusStateHeightsRequest = { + typeUrl: '/ibc.core.client.v1.QueryConsensusStateHeightsRequest', + encode( + message: QueryConsensusStateHeightsRequest, + 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, + ): QueryConsensusStateHeightsRequest { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConsensusStateHeightsRequest(); + 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): QueryConsensusStateHeightsRequest { + return { + clientId: isSet(object.clientId) ? String(object.clientId) : '', + pagination: isSet(object.pagination) + ? PageRequest.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message: QueryConsensusStateHeightsRequest): 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, + ): QueryConsensusStateHeightsRequest { + const message = createBaseQueryConsensusStateHeightsRequest(); + message.clientId = object.clientId ?? ''; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, + fromProtoMsg( + message: QueryConsensusStateHeightsRequestProtoMsg, + ): QueryConsensusStateHeightsRequest { + return QueryConsensusStateHeightsRequest.decode(message.value); + }, + toProto(message: QueryConsensusStateHeightsRequest): Uint8Array { + return QueryConsensusStateHeightsRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryConsensusStateHeightsRequest, + ): QueryConsensusStateHeightsRequestProtoMsg { + return { + typeUrl: '/ibc.core.client.v1.QueryConsensusStateHeightsRequest', + value: QueryConsensusStateHeightsRequest.encode(message).finish(), + }; + }, +}; +function createBaseQueryConsensusStateHeightsResponse(): QueryConsensusStateHeightsResponse { + return { + consensusStateHeights: [], + pagination: undefined, + }; +} +export const QueryConsensusStateHeightsResponse = { + typeUrl: '/ibc.core.client.v1.QueryConsensusStateHeightsResponse', + encode( + message: QueryConsensusStateHeightsResponse, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + for (const v of message.consensusStateHeights) { + Height.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, + ): QueryConsensusStateHeightsResponse { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConsensusStateHeightsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.consensusStateHeights.push( + Height.decode(reader, reader.uint32()), + ); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryConsensusStateHeightsResponse { + return { + consensusStateHeights: Array.isArray(object?.consensusStateHeights) + ? object.consensusStateHeights.map((e: any) => Height.fromJSON(e)) + : [], + pagination: isSet(object.pagination) + ? PageResponse.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message: QueryConsensusStateHeightsResponse): unknown { + const obj: any = {}; + if (message.consensusStateHeights) { + obj.consensusStateHeights = message.consensusStateHeights.map(e => + e ? Height.toJSON(e) : undefined, + ); + } else { + obj.consensusStateHeights = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination + ? PageResponse.toJSON(message.pagination) + : undefined); + return obj; + }, + fromPartial( + object: Partial, + ): QueryConsensusStateHeightsResponse { + const message = createBaseQueryConsensusStateHeightsResponse(); + message.consensusStateHeights = + object.consensusStateHeights?.map(e => Height.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, + fromProtoMsg( + message: QueryConsensusStateHeightsResponseProtoMsg, + ): QueryConsensusStateHeightsResponse { + return QueryConsensusStateHeightsResponse.decode(message.value); + }, + toProto(message: QueryConsensusStateHeightsResponse): Uint8Array { + return QueryConsensusStateHeightsResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryConsensusStateHeightsResponse, + ): QueryConsensusStateHeightsResponseProtoMsg { + return { + typeUrl: '/ibc.core.client.v1.QueryConsensusStateHeightsResponse', + value: QueryConsensusStateHeightsResponse.encode(message).finish(), + }; + }, +}; +function createBaseQueryClientStatusRequest(): QueryClientStatusRequest { + return { + clientId: '', + }; +} +export const QueryClientStatusRequest = { + typeUrl: '/ibc.core.client.v1.QueryClientStatusRequest', + encode( + message: QueryClientStatusRequest, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.clientId !== '') { + writer.uint32(10).string(message.clientId); + } + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): QueryClientStatusRequest { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClientStatusRequest(); + 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): QueryClientStatusRequest { + return { + clientId: isSet(object.clientId) ? String(object.clientId) : '', + }; + }, + toJSON(message: QueryClientStatusRequest): unknown { + const obj: any = {}; + message.clientId !== undefined && (obj.clientId = message.clientId); + return obj; + }, + fromPartial( + object: Partial, + ): QueryClientStatusRequest { + const message = createBaseQueryClientStatusRequest(); + message.clientId = object.clientId ?? ''; + return message; + }, + fromProtoMsg( + message: QueryClientStatusRequestProtoMsg, + ): QueryClientStatusRequest { + return QueryClientStatusRequest.decode(message.value); + }, + toProto(message: QueryClientStatusRequest): Uint8Array { + return QueryClientStatusRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryClientStatusRequest, + ): QueryClientStatusRequestProtoMsg { + return { + typeUrl: '/ibc.core.client.v1.QueryClientStatusRequest', + value: QueryClientStatusRequest.encode(message).finish(), + }; + }, +}; +function createBaseQueryClientStatusResponse(): QueryClientStatusResponse { + return { + status: '', + }; +} +export const QueryClientStatusResponse = { + typeUrl: '/ibc.core.client.v1.QueryClientStatusResponse', + encode( + message: QueryClientStatusResponse, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.status !== '') { + writer.uint32(10).string(message.status); + } + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): QueryClientStatusResponse { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClientStatusResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.status = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryClientStatusResponse { + return { + status: isSet(object.status) ? String(object.status) : '', + }; + }, + toJSON(message: QueryClientStatusResponse): unknown { + const obj: any = {}; + message.status !== undefined && (obj.status = message.status); + return obj; + }, + fromPartial( + object: Partial, + ): QueryClientStatusResponse { + const message = createBaseQueryClientStatusResponse(); + message.status = object.status ?? ''; + return message; + }, + fromProtoMsg( + message: QueryClientStatusResponseProtoMsg, + ): QueryClientStatusResponse { + return QueryClientStatusResponse.decode(message.value); + }, + toProto(message: QueryClientStatusResponse): Uint8Array { + return QueryClientStatusResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryClientStatusResponse, + ): QueryClientStatusResponseProtoMsg { + return { + typeUrl: '/ibc.core.client.v1.QueryClientStatusResponse', + value: QueryClientStatusResponse.encode(message).finish(), + }; + }, +}; +function createBaseQueryClientParamsRequest(): QueryClientParamsRequest { + return {}; +} +export const QueryClientParamsRequest = { + typeUrl: '/ibc.core.client.v1.QueryClientParamsRequest', + encode( + _: QueryClientParamsRequest, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): QueryClientParamsRequest { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClientParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): QueryClientParamsRequest { + return {}; + }, + toJSON(_: QueryClientParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + fromPartial(_: Partial): QueryClientParamsRequest { + const message = createBaseQueryClientParamsRequest(); + return message; + }, + fromProtoMsg( + message: QueryClientParamsRequestProtoMsg, + ): QueryClientParamsRequest { + return QueryClientParamsRequest.decode(message.value); + }, + toProto(message: QueryClientParamsRequest): Uint8Array { + return QueryClientParamsRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryClientParamsRequest, + ): QueryClientParamsRequestProtoMsg { + return { + typeUrl: '/ibc.core.client.v1.QueryClientParamsRequest', + value: QueryClientParamsRequest.encode(message).finish(), + }; + }, +}; +function createBaseQueryClientParamsResponse(): QueryClientParamsResponse { + return { + params: undefined, + }; +} +export const QueryClientParamsResponse = { + typeUrl: '/ibc.core.client.v1.QueryClientParamsResponse', + encode( + message: QueryClientParamsResponse, + 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, + ): QueryClientParamsResponse { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClientParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryClientParamsResponse { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + toJSON(message: QueryClientParamsResponse): unknown { + const obj: any = {}; + message.params !== undefined && + (obj.params = message.params ? Params.toJSON(message.params) : undefined); + return obj; + }, + fromPartial( + object: Partial, + ): QueryClientParamsResponse { + const message = createBaseQueryClientParamsResponse(); + message.params = + object.params !== undefined && object.params !== null + ? Params.fromPartial(object.params) + : undefined; + return message; + }, + fromProtoMsg( + message: QueryClientParamsResponseProtoMsg, + ): QueryClientParamsResponse { + return QueryClientParamsResponse.decode(message.value); + }, + toProto(message: QueryClientParamsResponse): Uint8Array { + return QueryClientParamsResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryClientParamsResponse, + ): QueryClientParamsResponseProtoMsg { + return { + typeUrl: '/ibc.core.client.v1.QueryClientParamsResponse', + value: QueryClientParamsResponse.encode(message).finish(), + }; + }, +}; +function createBaseQueryUpgradedClientStateRequest(): QueryUpgradedClientStateRequest { + return {}; +} +export const QueryUpgradedClientStateRequest = { + typeUrl: '/ibc.core.client.v1.QueryUpgradedClientStateRequest', + encode( + _: QueryUpgradedClientStateRequest, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): QueryUpgradedClientStateRequest { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryUpgradedClientStateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): QueryUpgradedClientStateRequest { + return {}; + }, + toJSON(_: QueryUpgradedClientStateRequest): unknown { + const obj: any = {}; + return obj; + }, + fromPartial( + _: Partial, + ): QueryUpgradedClientStateRequest { + const message = createBaseQueryUpgradedClientStateRequest(); + return message; + }, + fromProtoMsg( + message: QueryUpgradedClientStateRequestProtoMsg, + ): QueryUpgradedClientStateRequest { + return QueryUpgradedClientStateRequest.decode(message.value); + }, + toProto(message: QueryUpgradedClientStateRequest): Uint8Array { + return QueryUpgradedClientStateRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryUpgradedClientStateRequest, + ): QueryUpgradedClientStateRequestProtoMsg { + return { + typeUrl: '/ibc.core.client.v1.QueryUpgradedClientStateRequest', + value: QueryUpgradedClientStateRequest.encode(message).finish(), + }; + }, +}; +function createBaseQueryUpgradedClientStateResponse(): QueryUpgradedClientStateResponse { + return { + upgradedClientState: undefined, + }; +} +export const QueryUpgradedClientStateResponse = { + typeUrl: '/ibc.core.client.v1.QueryUpgradedClientStateResponse', + encode( + message: QueryUpgradedClientStateResponse, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.upgradedClientState !== undefined) { + Any.encode( + message.upgradedClientState, + writer.uint32(10).fork(), + ).ldelim(); + } + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): QueryUpgradedClientStateResponse { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryUpgradedClientStateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.upgradedClientState = Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryUpgradedClientStateResponse { + return { + upgradedClientState: isSet(object.upgradedClientState) + ? Any.fromJSON(object.upgradedClientState) + : undefined, + }; + }, + toJSON(message: QueryUpgradedClientStateResponse): unknown { + const obj: any = {}; + message.upgradedClientState !== undefined && + (obj.upgradedClientState = message.upgradedClientState + ? Any.toJSON(message.upgradedClientState) + : undefined); + return obj; + }, + fromPartial( + object: Partial, + ): QueryUpgradedClientStateResponse { + const message = createBaseQueryUpgradedClientStateResponse(); + message.upgradedClientState = + object.upgradedClientState !== undefined && + object.upgradedClientState !== null + ? Any.fromPartial(object.upgradedClientState) + : undefined; + return message; + }, + fromProtoMsg( + message: QueryUpgradedClientStateResponseProtoMsg, + ): QueryUpgradedClientStateResponse { + return QueryUpgradedClientStateResponse.decode(message.value); + }, + toProto(message: QueryUpgradedClientStateResponse): Uint8Array { + return QueryUpgradedClientStateResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryUpgradedClientStateResponse, + ): QueryUpgradedClientStateResponseProtoMsg { + return { + typeUrl: '/ibc.core.client.v1.QueryUpgradedClientStateResponse', + value: QueryUpgradedClientStateResponse.encode(message).finish(), + }; + }, +}; +function createBaseQueryUpgradedConsensusStateRequest(): QueryUpgradedConsensusStateRequest { + return {}; +} +export const QueryUpgradedConsensusStateRequest = { + typeUrl: '/ibc.core.client.v1.QueryUpgradedConsensusStateRequest', + encode( + _: QueryUpgradedConsensusStateRequest, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): QueryUpgradedConsensusStateRequest { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryUpgradedConsensusStateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): QueryUpgradedConsensusStateRequest { + return {}; + }, + toJSON(_: QueryUpgradedConsensusStateRequest): unknown { + const obj: any = {}; + return obj; + }, + fromPartial( + _: Partial, + ): QueryUpgradedConsensusStateRequest { + const message = createBaseQueryUpgradedConsensusStateRequest(); + return message; + }, + fromProtoMsg( + message: QueryUpgradedConsensusStateRequestProtoMsg, + ): QueryUpgradedConsensusStateRequest { + return QueryUpgradedConsensusStateRequest.decode(message.value); + }, + toProto(message: QueryUpgradedConsensusStateRequest): Uint8Array { + return QueryUpgradedConsensusStateRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryUpgradedConsensusStateRequest, + ): QueryUpgradedConsensusStateRequestProtoMsg { + return { + typeUrl: '/ibc.core.client.v1.QueryUpgradedConsensusStateRequest', + value: QueryUpgradedConsensusStateRequest.encode(message).finish(), + }; + }, +}; +function createBaseQueryUpgradedConsensusStateResponse(): QueryUpgradedConsensusStateResponse { + return { + upgradedConsensusState: undefined, + }; +} +export const QueryUpgradedConsensusStateResponse = { + typeUrl: '/ibc.core.client.v1.QueryUpgradedConsensusStateResponse', + encode( + message: QueryUpgradedConsensusStateResponse, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.upgradedConsensusState !== undefined) { + Any.encode( + message.upgradedConsensusState, + writer.uint32(10).fork(), + ).ldelim(); + } + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): QueryUpgradedConsensusStateResponse { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryUpgradedConsensusStateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.upgradedConsensusState = Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryUpgradedConsensusStateResponse { + return { + upgradedConsensusState: isSet(object.upgradedConsensusState) + ? Any.fromJSON(object.upgradedConsensusState) + : undefined, + }; + }, + toJSON(message: QueryUpgradedConsensusStateResponse): unknown { + const obj: any = {}; + message.upgradedConsensusState !== undefined && + (obj.upgradedConsensusState = message.upgradedConsensusState + ? Any.toJSON(message.upgradedConsensusState) + : undefined); + return obj; + }, + fromPartial( + object: Partial, + ): QueryUpgradedConsensusStateResponse { + const message = createBaseQueryUpgradedConsensusStateResponse(); + message.upgradedConsensusState = + object.upgradedConsensusState !== undefined && + object.upgradedConsensusState !== null + ? Any.fromPartial(object.upgradedConsensusState) + : undefined; + return message; + }, + fromProtoMsg( + message: QueryUpgradedConsensusStateResponseProtoMsg, + ): QueryUpgradedConsensusStateResponse { + return QueryUpgradedConsensusStateResponse.decode(message.value); + }, + toProto(message: QueryUpgradedConsensusStateResponse): Uint8Array { + return QueryUpgradedConsensusStateResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryUpgradedConsensusStateResponse, + ): QueryUpgradedConsensusStateResponseProtoMsg { + return { + typeUrl: '/ibc.core.client.v1.QueryUpgradedConsensusStateResponse', + value: QueryUpgradedConsensusStateResponse.encode(message).finish(), + }; + }, +}; diff --git a/packages/cosmic-proto/src/codegen/ibc/core/client/v1/tx.ts b/packages/cosmic-proto/src/codegen/ibc/core/client/v1/tx.ts new file mode 100644 index 00000000000..768108822fb --- /dev/null +++ b/packages/cosmic-proto/src/codegen/ibc/core/client/v1/tx.ts @@ -0,0 +1,805 @@ +//@ts-nocheck +import { Any, AnySDKType } from '../../../../google/protobuf/any.js'; +import { BinaryReader, BinaryWriter } from '../../../../binary.js'; +import { + isSet, + bytesFromBase64, + base64FromBytes, +} from '../../../../helpers.js'; +/** MsgCreateClient defines a message to create an IBC client */ +export interface MsgCreateClient { + /** light client state */ + clientState?: Any; + /** + * consensus state associated with the client that corresponds to a given + * height. + */ + consensusState?: Any; + /** signer address */ + signer: string; +} +export interface MsgCreateClientProtoMsg { + typeUrl: '/ibc.core.client.v1.MsgCreateClient'; + value: Uint8Array; +} +/** MsgCreateClient defines a message to create an IBC client */ +export interface MsgCreateClientSDKType { + client_state?: AnySDKType; + consensus_state?: AnySDKType; + signer: string; +} +/** MsgCreateClientResponse defines the Msg/CreateClient response type. */ +export interface MsgCreateClientResponse {} +export interface MsgCreateClientResponseProtoMsg { + typeUrl: '/ibc.core.client.v1.MsgCreateClientResponse'; + value: Uint8Array; +} +/** MsgCreateClientResponse defines the Msg/CreateClient response type. */ +export interface MsgCreateClientResponseSDKType {} +/** + * MsgUpdateClient defines an sdk.Msg to update a IBC client state using + * the given header. + */ +export interface MsgUpdateClient { + /** client unique identifier */ + clientId: string; + /** header to update the light client */ + header?: Any; + /** signer address */ + signer: string; +} +export interface MsgUpdateClientProtoMsg { + typeUrl: '/ibc.core.client.v1.MsgUpdateClient'; + value: Uint8Array; +} +/** + * MsgUpdateClient defines an sdk.Msg to update a IBC client state using + * the given header. + */ +export interface MsgUpdateClientSDKType { + client_id: string; + header?: AnySDKType; + signer: string; +} +/** MsgUpdateClientResponse defines the Msg/UpdateClient response type. */ +export interface MsgUpdateClientResponse {} +export interface MsgUpdateClientResponseProtoMsg { + typeUrl: '/ibc.core.client.v1.MsgUpdateClientResponse'; + value: Uint8Array; +} +/** MsgUpdateClientResponse defines the Msg/UpdateClient response type. */ +export interface MsgUpdateClientResponseSDKType {} +/** + * MsgUpgradeClient defines an sdk.Msg to upgrade an IBC client to a new client + * state + */ +export interface MsgUpgradeClient { + /** client unique identifier */ + clientId: string; + /** upgraded client state */ + clientState?: Any; + /** + * upgraded consensus state, only contains enough information to serve as a + * basis of trust in update logic + */ + consensusState?: Any; + /** proof that old chain committed to new client */ + proofUpgradeClient: Uint8Array; + /** proof that old chain committed to new consensus state */ + proofUpgradeConsensusState: Uint8Array; + /** signer address */ + signer: string; +} +export interface MsgUpgradeClientProtoMsg { + typeUrl: '/ibc.core.client.v1.MsgUpgradeClient'; + value: Uint8Array; +} +/** + * MsgUpgradeClient defines an sdk.Msg to upgrade an IBC client to a new client + * state + */ +export interface MsgUpgradeClientSDKType { + client_id: string; + client_state?: AnySDKType; + consensus_state?: AnySDKType; + proof_upgrade_client: Uint8Array; + proof_upgrade_consensus_state: Uint8Array; + signer: string; +} +/** MsgUpgradeClientResponse defines the Msg/UpgradeClient response type. */ +export interface MsgUpgradeClientResponse {} +export interface MsgUpgradeClientResponseProtoMsg { + typeUrl: '/ibc.core.client.v1.MsgUpgradeClientResponse'; + value: Uint8Array; +} +/** MsgUpgradeClientResponse defines the Msg/UpgradeClient response type. */ +export interface MsgUpgradeClientResponseSDKType {} +/** + * MsgSubmitMisbehaviour defines an sdk.Msg type that submits Evidence for + * light client misbehaviour. + */ +export interface MsgSubmitMisbehaviour { + /** client unique identifier */ + clientId: string; + /** misbehaviour used for freezing the light client */ + misbehaviour?: Any; + /** signer address */ + signer: string; +} +export interface MsgSubmitMisbehaviourProtoMsg { + typeUrl: '/ibc.core.client.v1.MsgSubmitMisbehaviour'; + value: Uint8Array; +} +/** + * MsgSubmitMisbehaviour defines an sdk.Msg type that submits Evidence for + * light client misbehaviour. + */ +export interface MsgSubmitMisbehaviourSDKType { + client_id: string; + misbehaviour?: AnySDKType; + signer: string; +} +/** + * MsgSubmitMisbehaviourResponse defines the Msg/SubmitMisbehaviour response + * type. + */ +export interface MsgSubmitMisbehaviourResponse {} +export interface MsgSubmitMisbehaviourResponseProtoMsg { + typeUrl: '/ibc.core.client.v1.MsgSubmitMisbehaviourResponse'; + value: Uint8Array; +} +/** + * MsgSubmitMisbehaviourResponse defines the Msg/SubmitMisbehaviour response + * type. + */ +export interface MsgSubmitMisbehaviourResponseSDKType {} +function createBaseMsgCreateClient(): MsgCreateClient { + return { + clientState: undefined, + consensusState: undefined, + signer: '', + }; +} +export const MsgCreateClient = { + typeUrl: '/ibc.core.client.v1.MsgCreateClient', + encode( + message: MsgCreateClient, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.clientState !== undefined) { + Any.encode(message.clientState, writer.uint32(10).fork()).ldelim(); + } + if (message.consensusState !== undefined) { + Any.encode(message.consensusState, writer.uint32(18).fork()).ldelim(); + } + if (message.signer !== '') { + writer.uint32(26).string(message.signer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateClient { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateClient(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientState = Any.decode(reader, reader.uint32()); + break; + case 2: + message.consensusState = Any.decode(reader, reader.uint32()); + break; + case 3: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgCreateClient { + return { + clientState: isSet(object.clientState) + ? Any.fromJSON(object.clientState) + : undefined, + consensusState: isSet(object.consensusState) + ? Any.fromJSON(object.consensusState) + : undefined, + signer: isSet(object.signer) ? String(object.signer) : '', + }; + }, + toJSON(message: MsgCreateClient): unknown { + const obj: any = {}; + message.clientState !== undefined && + (obj.clientState = message.clientState + ? Any.toJSON(message.clientState) + : undefined); + message.consensusState !== undefined && + (obj.consensusState = message.consensusState + ? Any.toJSON(message.consensusState) + : undefined); + message.signer !== undefined && (obj.signer = message.signer); + return obj; + }, + fromPartial(object: Partial): MsgCreateClient { + const message = createBaseMsgCreateClient(); + message.clientState = + object.clientState !== undefined && object.clientState !== null + ? Any.fromPartial(object.clientState) + : undefined; + message.consensusState = + object.consensusState !== undefined && object.consensusState !== null + ? Any.fromPartial(object.consensusState) + : undefined; + message.signer = object.signer ?? ''; + return message; + }, + fromProtoMsg(message: MsgCreateClientProtoMsg): MsgCreateClient { + return MsgCreateClient.decode(message.value); + }, + toProto(message: MsgCreateClient): Uint8Array { + return MsgCreateClient.encode(message).finish(); + }, + toProtoMsg(message: MsgCreateClient): MsgCreateClientProtoMsg { + return { + typeUrl: '/ibc.core.client.v1.MsgCreateClient', + value: MsgCreateClient.encode(message).finish(), + }; + }, +}; +function createBaseMsgCreateClientResponse(): MsgCreateClientResponse { + return {}; +} +export const MsgCreateClientResponse = { + typeUrl: '/ibc.core.client.v1.MsgCreateClientResponse', + encode( + _: MsgCreateClientResponse, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): MsgCreateClientResponse { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateClientResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): MsgCreateClientResponse { + return {}; + }, + toJSON(_: MsgCreateClientResponse): unknown { + const obj: any = {}; + return obj; + }, + fromPartial(_: Partial): MsgCreateClientResponse { + const message = createBaseMsgCreateClientResponse(); + return message; + }, + fromProtoMsg( + message: MsgCreateClientResponseProtoMsg, + ): MsgCreateClientResponse { + return MsgCreateClientResponse.decode(message.value); + }, + toProto(message: MsgCreateClientResponse): Uint8Array { + return MsgCreateClientResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgCreateClientResponse, + ): MsgCreateClientResponseProtoMsg { + return { + typeUrl: '/ibc.core.client.v1.MsgCreateClientResponse', + value: MsgCreateClientResponse.encode(message).finish(), + }; + }, +}; +function createBaseMsgUpdateClient(): MsgUpdateClient { + return { + clientId: '', + header: undefined, + signer: '', + }; +} +export const MsgUpdateClient = { + typeUrl: '/ibc.core.client.v1.MsgUpdateClient', + encode( + message: MsgUpdateClient, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.clientId !== '') { + writer.uint32(10).string(message.clientId); + } + if (message.header !== undefined) { + Any.encode(message.header, writer.uint32(18).fork()).ldelim(); + } + if (message.signer !== '') { + writer.uint32(26).string(message.signer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateClient { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateClient(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.header = Any.decode(reader, reader.uint32()); + break; + case 3: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgUpdateClient { + return { + clientId: isSet(object.clientId) ? String(object.clientId) : '', + header: isSet(object.header) ? Any.fromJSON(object.header) : undefined, + signer: isSet(object.signer) ? String(object.signer) : '', + }; + }, + toJSON(message: MsgUpdateClient): unknown { + const obj: any = {}; + message.clientId !== undefined && (obj.clientId = message.clientId); + message.header !== undefined && + (obj.header = message.header ? Any.toJSON(message.header) : undefined); + message.signer !== undefined && (obj.signer = message.signer); + return obj; + }, + fromPartial(object: Partial): MsgUpdateClient { + const message = createBaseMsgUpdateClient(); + message.clientId = object.clientId ?? ''; + message.header = + object.header !== undefined && object.header !== null + ? Any.fromPartial(object.header) + : undefined; + message.signer = object.signer ?? ''; + return message; + }, + fromProtoMsg(message: MsgUpdateClientProtoMsg): MsgUpdateClient { + return MsgUpdateClient.decode(message.value); + }, + toProto(message: MsgUpdateClient): Uint8Array { + return MsgUpdateClient.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateClient): MsgUpdateClientProtoMsg { + return { + typeUrl: '/ibc.core.client.v1.MsgUpdateClient', + value: MsgUpdateClient.encode(message).finish(), + }; + }, +}; +function createBaseMsgUpdateClientResponse(): MsgUpdateClientResponse { + return {}; +} +export const MsgUpdateClientResponse = { + typeUrl: '/ibc.core.client.v1.MsgUpdateClientResponse', + encode( + _: MsgUpdateClientResponse, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): MsgUpdateClientResponse { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateClientResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): MsgUpdateClientResponse { + return {}; + }, + toJSON(_: MsgUpdateClientResponse): unknown { + const obj: any = {}; + return obj; + }, + fromPartial(_: Partial): MsgUpdateClientResponse { + const message = createBaseMsgUpdateClientResponse(); + return message; + }, + fromProtoMsg( + message: MsgUpdateClientResponseProtoMsg, + ): MsgUpdateClientResponse { + return MsgUpdateClientResponse.decode(message.value); + }, + toProto(message: MsgUpdateClientResponse): Uint8Array { + return MsgUpdateClientResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgUpdateClientResponse, + ): MsgUpdateClientResponseProtoMsg { + return { + typeUrl: '/ibc.core.client.v1.MsgUpdateClientResponse', + value: MsgUpdateClientResponse.encode(message).finish(), + }; + }, +}; +function createBaseMsgUpgradeClient(): MsgUpgradeClient { + return { + clientId: '', + clientState: undefined, + consensusState: undefined, + proofUpgradeClient: new Uint8Array(), + proofUpgradeConsensusState: new Uint8Array(), + signer: '', + }; +} +export const MsgUpgradeClient = { + typeUrl: '/ibc.core.client.v1.MsgUpgradeClient', + encode( + message: MsgUpgradeClient, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.clientId !== '') { + writer.uint32(10).string(message.clientId); + } + if (message.clientState !== undefined) { + Any.encode(message.clientState, writer.uint32(18).fork()).ldelim(); + } + if (message.consensusState !== undefined) { + Any.encode(message.consensusState, writer.uint32(26).fork()).ldelim(); + } + if (message.proofUpgradeClient.length !== 0) { + writer.uint32(34).bytes(message.proofUpgradeClient); + } + if (message.proofUpgradeConsensusState.length !== 0) { + writer.uint32(42).bytes(message.proofUpgradeConsensusState); + } + if (message.signer !== '') { + writer.uint32(50).string(message.signer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpgradeClient { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpgradeClient(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.clientState = Any.decode(reader, reader.uint32()); + break; + case 3: + message.consensusState = Any.decode(reader, reader.uint32()); + break; + case 4: + message.proofUpgradeClient = reader.bytes(); + break; + case 5: + message.proofUpgradeConsensusState = reader.bytes(); + break; + case 6: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgUpgradeClient { + return { + clientId: isSet(object.clientId) ? String(object.clientId) : '', + clientState: isSet(object.clientState) + ? Any.fromJSON(object.clientState) + : undefined, + consensusState: isSet(object.consensusState) + ? Any.fromJSON(object.consensusState) + : undefined, + proofUpgradeClient: isSet(object.proofUpgradeClient) + ? bytesFromBase64(object.proofUpgradeClient) + : new Uint8Array(), + proofUpgradeConsensusState: isSet(object.proofUpgradeConsensusState) + ? bytesFromBase64(object.proofUpgradeConsensusState) + : new Uint8Array(), + signer: isSet(object.signer) ? String(object.signer) : '', + }; + }, + toJSON(message: MsgUpgradeClient): unknown { + const obj: any = {}; + message.clientId !== undefined && (obj.clientId = message.clientId); + message.clientState !== undefined && + (obj.clientState = message.clientState + ? Any.toJSON(message.clientState) + : undefined); + message.consensusState !== undefined && + (obj.consensusState = message.consensusState + ? Any.toJSON(message.consensusState) + : undefined); + message.proofUpgradeClient !== undefined && + (obj.proofUpgradeClient = base64FromBytes( + message.proofUpgradeClient !== undefined + ? message.proofUpgradeClient + : new Uint8Array(), + )); + message.proofUpgradeConsensusState !== undefined && + (obj.proofUpgradeConsensusState = base64FromBytes( + message.proofUpgradeConsensusState !== undefined + ? message.proofUpgradeConsensusState + : new Uint8Array(), + )); + message.signer !== undefined && (obj.signer = message.signer); + return obj; + }, + fromPartial(object: Partial): MsgUpgradeClient { + const message = createBaseMsgUpgradeClient(); + message.clientId = object.clientId ?? ''; + message.clientState = + object.clientState !== undefined && object.clientState !== null + ? Any.fromPartial(object.clientState) + : undefined; + message.consensusState = + object.consensusState !== undefined && object.consensusState !== null + ? Any.fromPartial(object.consensusState) + : undefined; + message.proofUpgradeClient = object.proofUpgradeClient ?? new Uint8Array(); + message.proofUpgradeConsensusState = + object.proofUpgradeConsensusState ?? new Uint8Array(); + message.signer = object.signer ?? ''; + return message; + }, + fromProtoMsg(message: MsgUpgradeClientProtoMsg): MsgUpgradeClient { + return MsgUpgradeClient.decode(message.value); + }, + toProto(message: MsgUpgradeClient): Uint8Array { + return MsgUpgradeClient.encode(message).finish(); + }, + toProtoMsg(message: MsgUpgradeClient): MsgUpgradeClientProtoMsg { + return { + typeUrl: '/ibc.core.client.v1.MsgUpgradeClient', + value: MsgUpgradeClient.encode(message).finish(), + }; + }, +}; +function createBaseMsgUpgradeClientResponse(): MsgUpgradeClientResponse { + return {}; +} +export const MsgUpgradeClientResponse = { + typeUrl: '/ibc.core.client.v1.MsgUpgradeClientResponse', + encode( + _: MsgUpgradeClientResponse, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): MsgUpgradeClientResponse { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpgradeClientResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): MsgUpgradeClientResponse { + return {}; + }, + toJSON(_: MsgUpgradeClientResponse): unknown { + const obj: any = {}; + return obj; + }, + fromPartial(_: Partial): MsgUpgradeClientResponse { + const message = createBaseMsgUpgradeClientResponse(); + return message; + }, + fromProtoMsg( + message: MsgUpgradeClientResponseProtoMsg, + ): MsgUpgradeClientResponse { + return MsgUpgradeClientResponse.decode(message.value); + }, + toProto(message: MsgUpgradeClientResponse): Uint8Array { + return MsgUpgradeClientResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgUpgradeClientResponse, + ): MsgUpgradeClientResponseProtoMsg { + return { + typeUrl: '/ibc.core.client.v1.MsgUpgradeClientResponse', + value: MsgUpgradeClientResponse.encode(message).finish(), + }; + }, +}; +function createBaseMsgSubmitMisbehaviour(): MsgSubmitMisbehaviour { + return { + clientId: '', + misbehaviour: undefined, + signer: '', + }; +} +export const MsgSubmitMisbehaviour = { + typeUrl: '/ibc.core.client.v1.MsgSubmitMisbehaviour', + encode( + message: MsgSubmitMisbehaviour, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.clientId !== '') { + writer.uint32(10).string(message.clientId); + } + if (message.misbehaviour !== undefined) { + Any.encode(message.misbehaviour, writer.uint32(18).fork()).ldelim(); + } + if (message.signer !== '') { + writer.uint32(26).string(message.signer); + } + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): MsgSubmitMisbehaviour { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitMisbehaviour(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.misbehaviour = Any.decode(reader, reader.uint32()); + break; + case 3: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgSubmitMisbehaviour { + return { + clientId: isSet(object.clientId) ? String(object.clientId) : '', + misbehaviour: isSet(object.misbehaviour) + ? Any.fromJSON(object.misbehaviour) + : undefined, + signer: isSet(object.signer) ? String(object.signer) : '', + }; + }, + toJSON(message: MsgSubmitMisbehaviour): unknown { + const obj: any = {}; + message.clientId !== undefined && (obj.clientId = message.clientId); + message.misbehaviour !== undefined && + (obj.misbehaviour = message.misbehaviour + ? Any.toJSON(message.misbehaviour) + : undefined); + message.signer !== undefined && (obj.signer = message.signer); + return obj; + }, + fromPartial(object: Partial): MsgSubmitMisbehaviour { + const message = createBaseMsgSubmitMisbehaviour(); + message.clientId = object.clientId ?? ''; + message.misbehaviour = + object.misbehaviour !== undefined && object.misbehaviour !== null + ? Any.fromPartial(object.misbehaviour) + : undefined; + message.signer = object.signer ?? ''; + return message; + }, + fromProtoMsg(message: MsgSubmitMisbehaviourProtoMsg): MsgSubmitMisbehaviour { + return MsgSubmitMisbehaviour.decode(message.value); + }, + toProto(message: MsgSubmitMisbehaviour): Uint8Array { + return MsgSubmitMisbehaviour.encode(message).finish(); + }, + toProtoMsg(message: MsgSubmitMisbehaviour): MsgSubmitMisbehaviourProtoMsg { + return { + typeUrl: '/ibc.core.client.v1.MsgSubmitMisbehaviour', + value: MsgSubmitMisbehaviour.encode(message).finish(), + }; + }, +}; +function createBaseMsgSubmitMisbehaviourResponse(): MsgSubmitMisbehaviourResponse { + return {}; +} +export const MsgSubmitMisbehaviourResponse = { + typeUrl: '/ibc.core.client.v1.MsgSubmitMisbehaviourResponse', + encode( + _: MsgSubmitMisbehaviourResponse, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): MsgSubmitMisbehaviourResponse { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitMisbehaviourResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): MsgSubmitMisbehaviourResponse { + return {}; + }, + toJSON(_: MsgSubmitMisbehaviourResponse): unknown { + const obj: any = {}; + return obj; + }, + fromPartial( + _: Partial, + ): MsgSubmitMisbehaviourResponse { + const message = createBaseMsgSubmitMisbehaviourResponse(); + return message; + }, + fromProtoMsg( + message: MsgSubmitMisbehaviourResponseProtoMsg, + ): MsgSubmitMisbehaviourResponse { + return MsgSubmitMisbehaviourResponse.decode(message.value); + }, + toProto(message: MsgSubmitMisbehaviourResponse): Uint8Array { + return MsgSubmitMisbehaviourResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgSubmitMisbehaviourResponse, + ): MsgSubmitMisbehaviourResponseProtoMsg { + return { + typeUrl: '/ibc.core.client.v1.MsgSubmitMisbehaviourResponse', + value: MsgSubmitMisbehaviourResponse.encode(message).finish(), + }; + }, +}; diff --git a/packages/cosmic-proto/src/codegen/ibc/core/commitment/v1/commitment.ts b/packages/cosmic-proto/src/codegen/ibc/core/commitment/v1/commitment.ts new file mode 100644 index 00000000000..1647b82e599 --- /dev/null +++ b/packages/cosmic-proto/src/codegen/ibc/core/commitment/v1/commitment.ts @@ -0,0 +1,363 @@ +//@ts-nocheck +import { CommitmentProof, CommitmentProofSDKType } from '../../../../proofs.js'; +import { BinaryReader, BinaryWriter } from '../../../../binary.js'; +import { + isSet, + bytesFromBase64, + base64FromBytes, +} from '../../../../helpers.js'; +/** + * MerkleRoot defines a merkle root hash. + * In the Cosmos SDK, the AppHash of a block header becomes the root. + */ +export interface MerkleRoot { + hash: Uint8Array; +} +export interface MerkleRootProtoMsg { + typeUrl: '/ibc.core.commitment.v1.MerkleRoot'; + value: Uint8Array; +} +/** + * MerkleRoot defines a merkle root hash. + * In the Cosmos SDK, the AppHash of a block header becomes the root. + */ +export interface MerkleRootSDKType { + hash: Uint8Array; +} +/** + * MerklePrefix is merkle path prefixed to the key. + * The constructed key from the Path and the key will be append(Path.KeyPath, + * append(Path.KeyPrefix, key...)) + */ +export interface MerklePrefix { + keyPrefix: Uint8Array; +} +export interface MerklePrefixProtoMsg { + typeUrl: '/ibc.core.commitment.v1.MerklePrefix'; + value: Uint8Array; +} +/** + * MerklePrefix is merkle path prefixed to the key. + * The constructed key from the Path and the key will be append(Path.KeyPath, + * append(Path.KeyPrefix, key...)) + */ +export interface MerklePrefixSDKType { + key_prefix: 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[]; +} +export interface MerklePathProtoMsg { + typeUrl: '/ibc.core.commitment.v1.MerklePath'; + value: 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 MerklePathSDKType { + key_path: string[]; +} +/** + * MerkleProof is a wrapper type over a chain of CommitmentProofs. + * It demonstrates membership or non-membership for an element or set of + * elements, verifiable in conjunction with a known commitment root. Proofs + * should be succinct. + * MerkleProofs are ordered from leaf-to-root + */ +export interface MerkleProof { + proofs: CommitmentProof[]; +} +export interface MerkleProofProtoMsg { + typeUrl: '/ibc.core.commitment.v1.MerkleProof'; + value: Uint8Array; +} +/** + * MerkleProof is a wrapper type over a chain of CommitmentProofs. + * It demonstrates membership or non-membership for an element or set of + * elements, verifiable in conjunction with a known commitment root. Proofs + * should be succinct. + * MerkleProofs are ordered from leaf-to-root + */ +export interface MerkleProofSDKType { + proofs: CommitmentProofSDKType[]; +} +function createBaseMerkleRoot(): MerkleRoot { + return { + hash: new Uint8Array(), + }; +} +export const MerkleRoot = { + typeUrl: '/ibc.core.commitment.v1.MerkleRoot', + encode( + message: MerkleRoot, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.hash.length !== 0) { + writer.uint32(10).bytes(message.hash); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MerkleRoot { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMerkleRoot(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.hash = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MerkleRoot { + return { + hash: isSet(object.hash) + ? bytesFromBase64(object.hash) + : new Uint8Array(), + }; + }, + toJSON(message: MerkleRoot): unknown { + const obj: any = {}; + message.hash !== undefined && + (obj.hash = base64FromBytes( + message.hash !== undefined ? message.hash : new Uint8Array(), + )); + return obj; + }, + fromPartial(object: Partial): MerkleRoot { + const message = createBaseMerkleRoot(); + message.hash = object.hash ?? new Uint8Array(); + return message; + }, + fromProtoMsg(message: MerkleRootProtoMsg): MerkleRoot { + return MerkleRoot.decode(message.value); + }, + toProto(message: MerkleRoot): Uint8Array { + return MerkleRoot.encode(message).finish(); + }, + toProtoMsg(message: MerkleRoot): MerkleRootProtoMsg { + return { + typeUrl: '/ibc.core.commitment.v1.MerkleRoot', + value: MerkleRoot.encode(message).finish(), + }; + }, +}; +function createBaseMerklePrefix(): MerklePrefix { + return { + keyPrefix: new Uint8Array(), + }; +} +export const MerklePrefix = { + typeUrl: '/ibc.core.commitment.v1.MerklePrefix', + encode( + message: MerklePrefix, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.keyPrefix.length !== 0) { + writer.uint32(10).bytes(message.keyPrefix); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MerklePrefix { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMerklePrefix(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.keyPrefix = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MerklePrefix { + return { + keyPrefix: isSet(object.keyPrefix) + ? bytesFromBase64(object.keyPrefix) + : new Uint8Array(), + }; + }, + toJSON(message: MerklePrefix): unknown { + const obj: any = {}; + message.keyPrefix !== undefined && + (obj.keyPrefix = base64FromBytes( + message.keyPrefix !== undefined ? message.keyPrefix : new Uint8Array(), + )); + return obj; + }, + fromPartial(object: Partial): MerklePrefix { + const message = createBaseMerklePrefix(); + message.keyPrefix = object.keyPrefix ?? new Uint8Array(); + return message; + }, + fromProtoMsg(message: MerklePrefixProtoMsg): MerklePrefix { + return MerklePrefix.decode(message.value); + }, + toProto(message: MerklePrefix): Uint8Array { + return MerklePrefix.encode(message).finish(); + }, + toProtoMsg(message: MerklePrefix): MerklePrefixProtoMsg { + return { + typeUrl: '/ibc.core.commitment.v1.MerklePrefix', + value: MerklePrefix.encode(message).finish(), + }; + }, +}; +function createBaseMerklePath(): MerklePath { + return { + keyPath: [], + }; +} +export const MerklePath = { + typeUrl: '/ibc.core.commitment.v1.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 { + return { + keyPath: Array.isArray(object?.keyPath) + ? object.keyPath.map((e: any) => String(e)) + : [], + }; + }, + 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; + }, + fromProtoMsg(message: MerklePathProtoMsg): MerklePath { + return MerklePath.decode(message.value); + }, + toProto(message: MerklePath): Uint8Array { + return MerklePath.encode(message).finish(); + }, + toProtoMsg(message: MerklePath): MerklePathProtoMsg { + return { + typeUrl: '/ibc.core.commitment.v1.MerklePath', + value: MerklePath.encode(message).finish(), + }; + }, +}; +function createBaseMerkleProof(): MerkleProof { + return { + proofs: [], + }; +} +export const MerkleProof = { + typeUrl: '/ibc.core.commitment.v1.MerkleProof', + encode( + message: MerkleProof, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + for (const v of message.proofs) { + CommitmentProof.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MerkleProof { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMerkleProof(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proofs.push(CommitmentProof.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MerkleProof { + return { + proofs: Array.isArray(object?.proofs) + ? object.proofs.map((e: any) => CommitmentProof.fromJSON(e)) + : [], + }; + }, + toJSON(message: MerkleProof): unknown { + const obj: any = {}; + if (message.proofs) { + obj.proofs = message.proofs.map(e => + e ? CommitmentProof.toJSON(e) : undefined, + ); + } else { + obj.proofs = []; + } + return obj; + }, + fromPartial(object: Partial): MerkleProof { + const message = createBaseMerkleProof(); + message.proofs = + object.proofs?.map(e => CommitmentProof.fromPartial(e)) || []; + return message; + }, + fromProtoMsg(message: MerkleProofProtoMsg): MerkleProof { + return MerkleProof.decode(message.value); + }, + toProto(message: MerkleProof): Uint8Array { + return MerkleProof.encode(message).finish(); + }, + toProtoMsg(message: MerkleProof): MerkleProofProtoMsg { + return { + typeUrl: '/ibc.core.commitment.v1.MerkleProof', + value: MerkleProof.encode(message).finish(), + }; + }, +}; diff --git a/packages/cosmic-proto/src/codegen/ibc/core/connection/v1/connection.ts b/packages/cosmic-proto/src/codegen/ibc/core/connection/v1/connection.ts new file mode 100644 index 00000000000..7fd116e79d7 --- /dev/null +++ b/packages/cosmic-proto/src/codegen/ibc/core/connection/v1/connection.ts @@ -0,0 +1,888 @@ +//@ts-nocheck +import { + MerklePrefix, + MerklePrefixSDKType, +} from '../../commitment/v1/commitment.js'; +import { BinaryReader, BinaryWriter } from '../../../../binary.js'; +import { isSet } from '../../../../helpers.js'; +/** + * State defines if a connection is in one of the following states: + * INIT, TRYOPEN, OPEN or UNINITIALIZED. + */ +export enum State { + /** STATE_UNINITIALIZED_UNSPECIFIED - Default State */ + STATE_UNINITIALIZED_UNSPECIFIED = 0, + /** STATE_INIT - A connection end has just started the opening handshake. */ + STATE_INIT = 1, + /** + * STATE_TRYOPEN - A connection end has acknowledged the handshake step on the counterparty + * chain. + */ + STATE_TRYOPEN = 2, + /** STATE_OPEN - A connection end has completed the handshake. */ + STATE_OPEN = 3, + UNRECOGNIZED = -1, +} +export const StateSDKType = State; +export function stateFromJSON(object: any): State { + switch (object) { + case 0: + case 'STATE_UNINITIALIZED_UNSPECIFIED': + return State.STATE_UNINITIALIZED_UNSPECIFIED; + case 1: + case 'STATE_INIT': + return State.STATE_INIT; + case 2: + case 'STATE_TRYOPEN': + return State.STATE_TRYOPEN; + case 3: + case 'STATE_OPEN': + return State.STATE_OPEN; + case -1: + case 'UNRECOGNIZED': + default: + return State.UNRECOGNIZED; + } +} +export function stateToJSON(object: State): string { + switch (object) { + case State.STATE_UNINITIALIZED_UNSPECIFIED: + return 'STATE_UNINITIALIZED_UNSPECIFIED'; + case State.STATE_INIT: + return 'STATE_INIT'; + case State.STATE_TRYOPEN: + return 'STATE_TRYOPEN'; + case State.STATE_OPEN: + return 'STATE_OPEN'; + case State.UNRECOGNIZED: + default: + return 'UNRECOGNIZED'; + } +} +/** + * ConnectionEnd defines a stateful object on a chain connected to another + * separate one. + * NOTE: there must only be 2 defined ConnectionEnds to establish + * a connection between two chains. + */ +export interface ConnectionEnd { + /** client associated with this connection. */ + clientId: string; + /** + * IBC version which can be utilised to determine encodings or protocols for + * channels or packets utilising this connection. + */ + versions: Version[]; + /** current state of the connection end. */ + state: State; + /** counterparty chain associated with this connection. */ + counterparty: Counterparty; + /** + * 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. + */ + delayPeriod: bigint; +} +export interface ConnectionEndProtoMsg { + typeUrl: '/ibc.core.connection.v1.ConnectionEnd'; + value: Uint8Array; +} +/** + * ConnectionEnd defines a stateful object on a chain connected to another + * separate one. + * NOTE: there must only be 2 defined ConnectionEnds to establish + * a connection between two chains. + */ +export interface ConnectionEndSDKType { + client_id: string; + versions: VersionSDKType[]; + state: State; + counterparty: CounterpartySDKType; + delay_period: bigint; +} +/** + * IdentifiedConnection defines a connection with additional connection + * identifier field. + */ +export interface IdentifiedConnection { + /** connection identifier. */ + id: string; + /** client associated with this connection. */ + clientId: string; + /** + * IBC version which can be utilised to determine encodings or protocols for + * channels or packets utilising this connection + */ + versions: Version[]; + /** current state of the connection end. */ + state: State; + /** counterparty chain associated with this connection. */ + counterparty: Counterparty; + /** delay period associated with this connection. */ + delayPeriod: bigint; +} +export interface IdentifiedConnectionProtoMsg { + typeUrl: '/ibc.core.connection.v1.IdentifiedConnection'; + value: Uint8Array; +} +/** + * IdentifiedConnection defines a connection with additional connection + * identifier field. + */ +export interface IdentifiedConnectionSDKType { + id: string; + client_id: string; + versions: VersionSDKType[]; + state: State; + counterparty: CounterpartySDKType; + delay_period: bigint; +} +/** Counterparty defines the counterparty chain associated with a connection end. */ +export interface Counterparty { + /** + * identifies the client on the counterparty chain associated with a given + * connection. + */ + clientId: string; + /** + * identifies the connection end on the counterparty chain associated with a + * given connection. + */ + connectionId: string; + /** commitment merkle prefix of the counterparty chain. */ + prefix: MerklePrefix; +} +export interface CounterpartyProtoMsg { + typeUrl: '/ibc.core.connection.v1.Counterparty'; + value: Uint8Array; +} +/** Counterparty defines the counterparty chain associated with a connection end. */ +export interface CounterpartySDKType { + client_id: string; + connection_id: string; + prefix: MerklePrefixSDKType; +} +/** ClientPaths define all the connection paths for a client state. */ +export interface ClientPaths { + /** list of connection paths */ + paths: string[]; +} +export interface ClientPathsProtoMsg { + typeUrl: '/ibc.core.connection.v1.ClientPaths'; + value: Uint8Array; +} +/** ClientPaths define all the connection paths for a client state. */ +export interface ClientPathsSDKType { + paths: string[]; +} +/** ConnectionPaths define all the connection paths for a given client state. */ +export interface ConnectionPaths { + /** client state unique identifier */ + clientId: string; + /** list of connection paths */ + paths: string[]; +} +export interface ConnectionPathsProtoMsg { + typeUrl: '/ibc.core.connection.v1.ConnectionPaths'; + value: Uint8Array; +} +/** ConnectionPaths define all the connection paths for a given client state. */ +export interface ConnectionPathsSDKType { + client_id: string; + paths: string[]; +} +/** + * Version defines the versioning scheme used to negotiate the IBC verison in + * the connection handshake. + */ +export interface Version { + /** unique version identifier */ + identifier: string; + /** list of features compatible with the specified identifier */ + features: string[]; +} +export interface VersionProtoMsg { + typeUrl: '/ibc.core.connection.v1.Version'; + value: Uint8Array; +} +/** + * Version defines the versioning scheme used to negotiate the IBC verison in + * the connection handshake. + */ +export interface VersionSDKType { + identifier: string; + features: string[]; +} +/** Params defines the set of Connection parameters. */ +export interface 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. + */ + maxExpectedTimePerBlock: bigint; +} +export interface ParamsProtoMsg { + typeUrl: '/ibc.core.connection.v1.Params'; + value: Uint8Array; +} +/** Params defines the set of Connection parameters. */ +export interface ParamsSDKType { + max_expected_time_per_block: bigint; +} +function createBaseConnectionEnd(): ConnectionEnd { + return { + clientId: '', + versions: [], + state: 0, + counterparty: Counterparty.fromPartial({}), + delayPeriod: BigInt(0), + }; +} +export const ConnectionEnd = { + typeUrl: '/ibc.core.connection.v1.ConnectionEnd', + encode( + message: ConnectionEnd, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.clientId !== '') { + writer.uint32(10).string(message.clientId); + } + for (const v of message.versions) { + Version.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.state !== 0) { + writer.uint32(24).int32(message.state); + } + if (message.counterparty !== undefined) { + Counterparty.encode( + message.counterparty, + writer.uint32(34).fork(), + ).ldelim(); + } + if (message.delayPeriod !== BigInt(0)) { + writer.uint32(40).uint64(message.delayPeriod); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ConnectionEnd { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConnectionEnd(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.versions.push(Version.decode(reader, reader.uint32())); + break; + case 3: + message.state = reader.int32() as any; + break; + case 4: + message.counterparty = Counterparty.decode(reader, reader.uint32()); + break; + case 5: + message.delayPeriod = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): ConnectionEnd { + return { + clientId: isSet(object.clientId) ? String(object.clientId) : '', + versions: Array.isArray(object?.versions) + ? object.versions.map((e: any) => Version.fromJSON(e)) + : [], + state: isSet(object.state) ? stateFromJSON(object.state) : -1, + counterparty: isSet(object.counterparty) + ? Counterparty.fromJSON(object.counterparty) + : undefined, + delayPeriod: isSet(object.delayPeriod) + ? BigInt(object.delayPeriod.toString()) + : BigInt(0), + }; + }, + toJSON(message: ConnectionEnd): unknown { + const obj: any = {}; + message.clientId !== undefined && (obj.clientId = message.clientId); + if (message.versions) { + obj.versions = message.versions.map(e => + e ? Version.toJSON(e) : undefined, + ); + } else { + obj.versions = []; + } + message.state !== undefined && (obj.state = stateToJSON(message.state)); + message.counterparty !== undefined && + (obj.counterparty = message.counterparty + ? Counterparty.toJSON(message.counterparty) + : undefined); + message.delayPeriod !== undefined && + (obj.delayPeriod = (message.delayPeriod || BigInt(0)).toString()); + return obj; + }, + fromPartial(object: Partial): ConnectionEnd { + const message = createBaseConnectionEnd(); + message.clientId = object.clientId ?? ''; + message.versions = object.versions?.map(e => Version.fromPartial(e)) || []; + message.state = object.state ?? 0; + message.counterparty = + object.counterparty !== undefined && object.counterparty !== null + ? Counterparty.fromPartial(object.counterparty) + : undefined; + message.delayPeriod = + object.delayPeriod !== undefined && object.delayPeriod !== null + ? BigInt(object.delayPeriod.toString()) + : BigInt(0); + return message; + }, + fromProtoMsg(message: ConnectionEndProtoMsg): ConnectionEnd { + return ConnectionEnd.decode(message.value); + }, + toProto(message: ConnectionEnd): Uint8Array { + return ConnectionEnd.encode(message).finish(); + }, + toProtoMsg(message: ConnectionEnd): ConnectionEndProtoMsg { + return { + typeUrl: '/ibc.core.connection.v1.ConnectionEnd', + value: ConnectionEnd.encode(message).finish(), + }; + }, +}; +function createBaseIdentifiedConnection(): IdentifiedConnection { + return { + id: '', + clientId: '', + versions: [], + state: 0, + counterparty: Counterparty.fromPartial({}), + delayPeriod: BigInt(0), + }; +} +export const IdentifiedConnection = { + typeUrl: '/ibc.core.connection.v1.IdentifiedConnection', + encode( + message: IdentifiedConnection, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.id !== '') { + writer.uint32(10).string(message.id); + } + if (message.clientId !== '') { + writer.uint32(18).string(message.clientId); + } + for (const v of message.versions) { + Version.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.state !== 0) { + writer.uint32(32).int32(message.state); + } + if (message.counterparty !== undefined) { + Counterparty.encode( + message.counterparty, + writer.uint32(42).fork(), + ).ldelim(); + } + if (message.delayPeriod !== BigInt(0)) { + writer.uint32(48).uint64(message.delayPeriod); + } + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): IdentifiedConnection { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIdentifiedConnection(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.string(); + break; + case 2: + message.clientId = reader.string(); + break; + case 3: + message.versions.push(Version.decode(reader, reader.uint32())); + break; + case 4: + message.state = reader.int32() as any; + break; + case 5: + message.counterparty = Counterparty.decode(reader, reader.uint32()); + break; + case 6: + message.delayPeriod = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): IdentifiedConnection { + return { + id: isSet(object.id) ? String(object.id) : '', + clientId: isSet(object.clientId) ? String(object.clientId) : '', + versions: Array.isArray(object?.versions) + ? object.versions.map((e: any) => Version.fromJSON(e)) + : [], + state: isSet(object.state) ? stateFromJSON(object.state) : -1, + counterparty: isSet(object.counterparty) + ? Counterparty.fromJSON(object.counterparty) + : undefined, + delayPeriod: isSet(object.delayPeriod) + ? BigInt(object.delayPeriod.toString()) + : BigInt(0), + }; + }, + toJSON(message: IdentifiedConnection): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = message.id); + message.clientId !== undefined && (obj.clientId = message.clientId); + if (message.versions) { + obj.versions = message.versions.map(e => + e ? Version.toJSON(e) : undefined, + ); + } else { + obj.versions = []; + } + message.state !== undefined && (obj.state = stateToJSON(message.state)); + message.counterparty !== undefined && + (obj.counterparty = message.counterparty + ? Counterparty.toJSON(message.counterparty) + : undefined); + message.delayPeriod !== undefined && + (obj.delayPeriod = (message.delayPeriod || BigInt(0)).toString()); + return obj; + }, + fromPartial(object: Partial): IdentifiedConnection { + const message = createBaseIdentifiedConnection(); + message.id = object.id ?? ''; + message.clientId = object.clientId ?? ''; + message.versions = object.versions?.map(e => Version.fromPartial(e)) || []; + message.state = object.state ?? 0; + message.counterparty = + object.counterparty !== undefined && object.counterparty !== null + ? Counterparty.fromPartial(object.counterparty) + : undefined; + message.delayPeriod = + object.delayPeriod !== undefined && object.delayPeriod !== null + ? BigInt(object.delayPeriod.toString()) + : BigInt(0); + return message; + }, + fromProtoMsg(message: IdentifiedConnectionProtoMsg): IdentifiedConnection { + return IdentifiedConnection.decode(message.value); + }, + toProto(message: IdentifiedConnection): Uint8Array { + return IdentifiedConnection.encode(message).finish(); + }, + toProtoMsg(message: IdentifiedConnection): IdentifiedConnectionProtoMsg { + return { + typeUrl: '/ibc.core.connection.v1.IdentifiedConnection', + value: IdentifiedConnection.encode(message).finish(), + }; + }, +}; +function createBaseCounterparty(): Counterparty { + return { + clientId: '', + connectionId: '', + prefix: MerklePrefix.fromPartial({}), + }; +} +export const Counterparty = { + typeUrl: '/ibc.core.connection.v1.Counterparty', + encode( + message: Counterparty, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.clientId !== '') { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== '') { + writer.uint32(18).string(message.connectionId); + } + if (message.prefix !== undefined) { + MerklePrefix.encode(message.prefix, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Counterparty { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCounterparty(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.connectionId = reader.string(); + break; + case 3: + message.prefix = MerklePrefix.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): Counterparty { + return { + clientId: isSet(object.clientId) ? String(object.clientId) : '', + connectionId: isSet(object.connectionId) + ? String(object.connectionId) + : '', + prefix: isSet(object.prefix) + ? MerklePrefix.fromJSON(object.prefix) + : undefined, + }; + }, + toJSON(message: Counterparty): unknown { + const obj: any = {}; + message.clientId !== undefined && (obj.clientId = message.clientId); + message.connectionId !== undefined && + (obj.connectionId = message.connectionId); + message.prefix !== undefined && + (obj.prefix = message.prefix + ? MerklePrefix.toJSON(message.prefix) + : undefined); + return obj; + }, + fromPartial(object: Partial): Counterparty { + const message = createBaseCounterparty(); + message.clientId = object.clientId ?? ''; + message.connectionId = object.connectionId ?? ''; + message.prefix = + object.prefix !== undefined && object.prefix !== null + ? MerklePrefix.fromPartial(object.prefix) + : undefined; + return message; + }, + fromProtoMsg(message: CounterpartyProtoMsg): Counterparty { + return Counterparty.decode(message.value); + }, + toProto(message: Counterparty): Uint8Array { + return Counterparty.encode(message).finish(); + }, + toProtoMsg(message: Counterparty): CounterpartyProtoMsg { + return { + typeUrl: '/ibc.core.connection.v1.Counterparty', + value: Counterparty.encode(message).finish(), + }; + }, +}; +function createBaseClientPaths(): ClientPaths { + return { + paths: [], + }; +} +export const ClientPaths = { + typeUrl: '/ibc.core.connection.v1.ClientPaths', + encode( + message: ClientPaths, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + for (const v of message.paths) { + writer.uint32(10).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ClientPaths { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClientPaths(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.paths.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): ClientPaths { + return { + paths: Array.isArray(object?.paths) + ? object.paths.map((e: any) => String(e)) + : [], + }; + }, + toJSON(message: ClientPaths): unknown { + const obj: any = {}; + if (message.paths) { + obj.paths = message.paths.map(e => e); + } else { + obj.paths = []; + } + return obj; + }, + fromPartial(object: Partial): ClientPaths { + const message = createBaseClientPaths(); + message.paths = object.paths?.map(e => e) || []; + return message; + }, + fromProtoMsg(message: ClientPathsProtoMsg): ClientPaths { + return ClientPaths.decode(message.value); + }, + toProto(message: ClientPaths): Uint8Array { + return ClientPaths.encode(message).finish(); + }, + toProtoMsg(message: ClientPaths): ClientPathsProtoMsg { + return { + typeUrl: '/ibc.core.connection.v1.ClientPaths', + value: ClientPaths.encode(message).finish(), + }; + }, +}; +function createBaseConnectionPaths(): ConnectionPaths { + return { + clientId: '', + paths: [], + }; +} +export const ConnectionPaths = { + typeUrl: '/ibc.core.connection.v1.ConnectionPaths', + encode( + message: ConnectionPaths, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.clientId !== '') { + writer.uint32(10).string(message.clientId); + } + for (const v of message.paths) { + writer.uint32(18).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ConnectionPaths { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConnectionPaths(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.paths.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): ConnectionPaths { + return { + clientId: isSet(object.clientId) ? String(object.clientId) : '', + paths: Array.isArray(object?.paths) + ? object.paths.map((e: any) => String(e)) + : [], + }; + }, + toJSON(message: ConnectionPaths): unknown { + const obj: any = {}; + message.clientId !== undefined && (obj.clientId = message.clientId); + if (message.paths) { + obj.paths = message.paths.map(e => e); + } else { + obj.paths = []; + } + return obj; + }, + fromPartial(object: Partial): ConnectionPaths { + const message = createBaseConnectionPaths(); + message.clientId = object.clientId ?? ''; + message.paths = object.paths?.map(e => e) || []; + return message; + }, + fromProtoMsg(message: ConnectionPathsProtoMsg): ConnectionPaths { + return ConnectionPaths.decode(message.value); + }, + toProto(message: ConnectionPaths): Uint8Array { + return ConnectionPaths.encode(message).finish(); + }, + toProtoMsg(message: ConnectionPaths): ConnectionPathsProtoMsg { + return { + typeUrl: '/ibc.core.connection.v1.ConnectionPaths', + value: ConnectionPaths.encode(message).finish(), + }; + }, +}; +function createBaseVersion(): Version { + return { + identifier: '', + features: [], + }; +} +export const Version = { + typeUrl: '/ibc.core.connection.v1.Version', + encode( + message: Version, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.identifier !== '') { + writer.uint32(10).string(message.identifier); + } + for (const v of message.features) { + writer.uint32(18).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Version { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVersion(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.identifier = reader.string(); + break; + case 2: + message.features.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): Version { + return { + identifier: isSet(object.identifier) ? String(object.identifier) : '', + features: Array.isArray(object?.features) + ? object.features.map((e: any) => String(e)) + : [], + }; + }, + toJSON(message: Version): unknown { + const obj: any = {}; + message.identifier !== undefined && (obj.identifier = message.identifier); + if (message.features) { + obj.features = message.features.map(e => e); + } else { + obj.features = []; + } + return obj; + }, + fromPartial(object: Partial): Version { + const message = createBaseVersion(); + message.identifier = object.identifier ?? ''; + message.features = object.features?.map(e => e) || []; + return message; + }, + fromProtoMsg(message: VersionProtoMsg): Version { + return Version.decode(message.value); + }, + toProto(message: Version): Uint8Array { + return Version.encode(message).finish(); + }, + toProtoMsg(message: Version): VersionProtoMsg { + return { + typeUrl: '/ibc.core.connection.v1.Version', + value: Version.encode(message).finish(), + }; + }, +}; +function createBaseParams(): Params { + return { + maxExpectedTimePerBlock: BigInt(0), + }; +} +export const Params = { + typeUrl: '/ibc.core.connection.v1.Params', + encode( + message: Params, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.maxExpectedTimePerBlock !== BigInt(0)) { + writer.uint32(8).uint64(message.maxExpectedTimePerBlock); + } + return writer; + }, + 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 = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.maxExpectedTimePerBlock = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): Params { + return { + maxExpectedTimePerBlock: isSet(object.maxExpectedTimePerBlock) + ? BigInt(object.maxExpectedTimePerBlock.toString()) + : BigInt(0), + }; + }, + toJSON(message: Params): unknown { + const obj: any = {}; + message.maxExpectedTimePerBlock !== undefined && + (obj.maxExpectedTimePerBlock = ( + message.maxExpectedTimePerBlock || BigInt(0) + ).toString()); + return obj; + }, + fromPartial(object: Partial): Params { + const message = createBaseParams(); + message.maxExpectedTimePerBlock = + object.maxExpectedTimePerBlock !== undefined && + object.maxExpectedTimePerBlock !== null + ? BigInt(object.maxExpectedTimePerBlock.toString()) + : BigInt(0); + return message; + }, + fromProtoMsg(message: ParamsProtoMsg): Params { + return Params.decode(message.value); + }, + toProto(message: Params): Uint8Array { + return Params.encode(message).finish(); + }, + toProtoMsg(message: Params): ParamsProtoMsg { + return { + typeUrl: '/ibc.core.connection.v1.Params', + value: Params.encode(message).finish(), + }; + }, +}; diff --git a/packages/cosmic-proto/src/codegen/ibc/core/connection/v1/genesis.ts b/packages/cosmic-proto/src/codegen/ibc/core/connection/v1/genesis.ts new file mode 100644 index 00000000000..f8c460df6da --- /dev/null +++ b/packages/cosmic-proto/src/codegen/ibc/core/connection/v1/genesis.ts @@ -0,0 +1,160 @@ +//@ts-nocheck +import { + IdentifiedConnection, + IdentifiedConnectionSDKType, + ConnectionPaths, + ConnectionPathsSDKType, + Params, + ParamsSDKType, +} from './connection.js'; +import { BinaryReader, BinaryWriter } from '../../../../binary.js'; +import { isSet } from '../../../../helpers.js'; +/** GenesisState defines the ibc connection submodule's genesis state. */ +export interface GenesisState { + connections: IdentifiedConnection[]; + clientConnectionPaths: ConnectionPaths[]; + /** the sequence for the next generated connection identifier */ + nextConnectionSequence: bigint; + params: Params; +} +export interface GenesisStateProtoMsg { + typeUrl: '/ibc.core.connection.v1.GenesisState'; + value: Uint8Array; +} +/** GenesisState defines the ibc connection submodule's genesis state. */ +export interface GenesisStateSDKType { + connections: IdentifiedConnectionSDKType[]; + client_connection_paths: ConnectionPathsSDKType[]; + next_connection_sequence: bigint; + params: ParamsSDKType; +} +function createBaseGenesisState(): GenesisState { + return { + connections: [], + clientConnectionPaths: [], + nextConnectionSequence: BigInt(0), + params: Params.fromPartial({}), + }; +} +export const GenesisState = { + typeUrl: '/ibc.core.connection.v1.GenesisState', + encode( + message: GenesisState, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + for (const v of message.connections) { + IdentifiedConnection.encode(v!, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.clientConnectionPaths) { + ConnectionPaths.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.nextConnectionSequence !== BigInt(0)) { + writer.uint32(24).uint64(message.nextConnectionSequence); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(34).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.connections.push( + IdentifiedConnection.decode(reader, reader.uint32()), + ); + break; + case 2: + message.clientConnectionPaths.push( + ConnectionPaths.decode(reader, reader.uint32()), + ); + break; + case 3: + message.nextConnectionSequence = reader.uint64(); + break; + case 4: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): GenesisState { + return { + connections: Array.isArray(object?.connections) + ? object.connections.map((e: any) => IdentifiedConnection.fromJSON(e)) + : [], + clientConnectionPaths: Array.isArray(object?.clientConnectionPaths) + ? object.clientConnectionPaths.map((e: any) => + ConnectionPaths.fromJSON(e), + ) + : [], + nextConnectionSequence: isSet(object.nextConnectionSequence) + ? BigInt(object.nextConnectionSequence.toString()) + : BigInt(0), + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.connections) { + obj.connections = message.connections.map(e => + e ? IdentifiedConnection.toJSON(e) : undefined, + ); + } else { + obj.connections = []; + } + if (message.clientConnectionPaths) { + obj.clientConnectionPaths = message.clientConnectionPaths.map(e => + e ? ConnectionPaths.toJSON(e) : undefined, + ); + } else { + obj.clientConnectionPaths = []; + } + message.nextConnectionSequence !== undefined && + (obj.nextConnectionSequence = ( + message.nextConnectionSequence || BigInt(0) + ).toString()); + message.params !== undefined && + (obj.params = message.params ? Params.toJSON(message.params) : undefined); + return obj; + }, + fromPartial(object: Partial): GenesisState { + const message = createBaseGenesisState(); + message.connections = + object.connections?.map(e => IdentifiedConnection.fromPartial(e)) || []; + message.clientConnectionPaths = + object.clientConnectionPaths?.map(e => ConnectionPaths.fromPartial(e)) || + []; + message.nextConnectionSequence = + object.nextConnectionSequence !== undefined && + object.nextConnectionSequence !== null + ? BigInt(object.nextConnectionSequence.toString()) + : BigInt(0); + message.params = + object.params !== undefined && object.params !== null + ? Params.fromPartial(object.params) + : undefined; + return message; + }, + fromProtoMsg(message: GenesisStateProtoMsg): GenesisState { + return GenesisState.decode(message.value); + }, + toProto(message: GenesisState): Uint8Array { + return GenesisState.encode(message).finish(); + }, + toProtoMsg(message: GenesisState): GenesisStateProtoMsg { + return { + typeUrl: '/ibc.core.connection.v1.GenesisState', + value: GenesisState.encode(message).finish(), + }; + }, +}; diff --git a/packages/cosmic-proto/src/codegen/ibc/core/connection/v1/query.ts b/packages/cosmic-proto/src/codegen/ibc/core/connection/v1/query.ts new file mode 100644 index 00000000000..e61a6548265 --- /dev/null +++ b/packages/cosmic-proto/src/codegen/ibc/core/connection/v1/query.ts @@ -0,0 +1,1394 @@ +//@ts-nocheck +import { + PageRequest, + PageRequestSDKType, + PageResponse, + PageResponseSDKType, +} from '../../../../cosmos/base/query/v1beta1/pagination.js'; +import { + ConnectionEnd, + ConnectionEndSDKType, + IdentifiedConnection, + IdentifiedConnectionSDKType, +} from './connection.js'; +import { + Height, + HeightSDKType, + IdentifiedClientState, + IdentifiedClientStateSDKType, + Params, + ParamsSDKType, +} from '../../client/v1/client.js'; +import { Any, AnySDKType } from '../../../../google/protobuf/any.js'; +import { BinaryReader, BinaryWriter } from '../../../../binary.js'; +import { + isSet, + bytesFromBase64, + base64FromBytes, +} from '../../../../helpers.js'; +/** + * QueryConnectionRequest is the request type for the Query/Connection RPC + * method + */ +export interface QueryConnectionRequest { + /** connection unique identifier */ + connectionId: string; +} +export interface QueryConnectionRequestProtoMsg { + typeUrl: '/ibc.core.connection.v1.QueryConnectionRequest'; + value: Uint8Array; +} +/** + * QueryConnectionRequest is the request type for the Query/Connection RPC + * method + */ +export interface QueryConnectionRequestSDKType { + connection_id: string; +} +/** + * QueryConnectionResponse is the response type for the Query/Connection RPC + * method. Besides the connection end, it includes a proof and the height from + * which the proof was retrieved. + */ +export interface QueryConnectionResponse { + /** connection associated with the request identifier */ + connection?: ConnectionEnd; + /** merkle proof of existence */ + proof: Uint8Array; + /** height at which the proof was retrieved */ + proofHeight: Height; +} +export interface QueryConnectionResponseProtoMsg { + typeUrl: '/ibc.core.connection.v1.QueryConnectionResponse'; + value: Uint8Array; +} +/** + * QueryConnectionResponse is the response type for the Query/Connection RPC + * method. Besides the connection end, it includes a proof and the height from + * which the proof was retrieved. + */ +export interface QueryConnectionResponseSDKType { + connection?: ConnectionEndSDKType; + proof: Uint8Array; + proof_height: HeightSDKType; +} +/** + * QueryConnectionsRequest is the request type for the Query/Connections RPC + * method + */ +export interface QueryConnectionsRequest { + pagination?: PageRequest; +} +export interface QueryConnectionsRequestProtoMsg { + typeUrl: '/ibc.core.connection.v1.QueryConnectionsRequest'; + value: Uint8Array; +} +/** + * QueryConnectionsRequest is the request type for the Query/Connections RPC + * method + */ +export interface QueryConnectionsRequestSDKType { + pagination?: PageRequestSDKType; +} +/** + * QueryConnectionsResponse is the response type for the Query/Connections RPC + * method. + */ +export interface QueryConnectionsResponse { + /** list of stored connections of the chain. */ + connections: IdentifiedConnection[]; + /** pagination response */ + pagination?: PageResponse; + /** query block height */ + height: Height; +} +export interface QueryConnectionsResponseProtoMsg { + typeUrl: '/ibc.core.connection.v1.QueryConnectionsResponse'; + value: Uint8Array; +} +/** + * QueryConnectionsResponse is the response type for the Query/Connections RPC + * method. + */ +export interface QueryConnectionsResponseSDKType { + connections: IdentifiedConnectionSDKType[]; + pagination?: PageResponseSDKType; + height: HeightSDKType; +} +/** + * QueryClientConnectionsRequest is the request type for the + * Query/ClientConnections RPC method + */ +export interface QueryClientConnectionsRequest { + /** client identifier associated with a connection */ + clientId: string; +} +export interface QueryClientConnectionsRequestProtoMsg { + typeUrl: '/ibc.core.connection.v1.QueryClientConnectionsRequest'; + value: Uint8Array; +} +/** + * QueryClientConnectionsRequest is the request type for the + * Query/ClientConnections RPC method + */ +export interface QueryClientConnectionsRequestSDKType { + client_id: string; +} +/** + * QueryClientConnectionsResponse is the response type for the + * Query/ClientConnections RPC method + */ +export interface QueryClientConnectionsResponse { + /** slice of all the connection paths associated with a client. */ + connectionPaths: string[]; + /** merkle proof of existence */ + proof: Uint8Array; + /** height at which the proof was generated */ + proofHeight: Height; +} +export interface QueryClientConnectionsResponseProtoMsg { + typeUrl: '/ibc.core.connection.v1.QueryClientConnectionsResponse'; + value: Uint8Array; +} +/** + * QueryClientConnectionsResponse is the response type for the + * Query/ClientConnections RPC method + */ +export interface QueryClientConnectionsResponseSDKType { + connection_paths: string[]; + proof: Uint8Array; + proof_height: HeightSDKType; +} +/** + * QueryConnectionClientStateRequest is the request type for the + * Query/ConnectionClientState RPC method + */ +export interface QueryConnectionClientStateRequest { + /** connection identifier */ + connectionId: string; +} +export interface QueryConnectionClientStateRequestProtoMsg { + typeUrl: '/ibc.core.connection.v1.QueryConnectionClientStateRequest'; + value: Uint8Array; +} +/** + * QueryConnectionClientStateRequest is the request type for the + * Query/ConnectionClientState RPC method + */ +export interface QueryConnectionClientStateRequestSDKType { + connection_id: string; +} +/** + * QueryConnectionClientStateResponse is the response type for the + * Query/ConnectionClientState RPC method + */ +export interface QueryConnectionClientStateResponse { + /** client state associated with the channel */ + identifiedClientState?: IdentifiedClientState; + /** merkle proof of existence */ + proof: Uint8Array; + /** height at which the proof was retrieved */ + proofHeight: Height; +} +export interface QueryConnectionClientStateResponseProtoMsg { + typeUrl: '/ibc.core.connection.v1.QueryConnectionClientStateResponse'; + value: Uint8Array; +} +/** + * QueryConnectionClientStateResponse is the response type for the + * Query/ConnectionClientState RPC method + */ +export interface QueryConnectionClientStateResponseSDKType { + identified_client_state?: IdentifiedClientStateSDKType; + proof: Uint8Array; + proof_height: HeightSDKType; +} +/** + * QueryConnectionConsensusStateRequest is the request type for the + * Query/ConnectionConsensusState RPC method + */ +export interface QueryConnectionConsensusStateRequest { + /** connection identifier */ + connectionId: string; + revisionNumber: bigint; + revisionHeight: bigint; +} +export interface QueryConnectionConsensusStateRequestProtoMsg { + typeUrl: '/ibc.core.connection.v1.QueryConnectionConsensusStateRequest'; + value: Uint8Array; +} +/** + * QueryConnectionConsensusStateRequest is the request type for the + * Query/ConnectionConsensusState RPC method + */ +export interface QueryConnectionConsensusStateRequestSDKType { + connection_id: string; + revision_number: bigint; + revision_height: bigint; +} +/** + * QueryConnectionConsensusStateResponse is the response type for the + * Query/ConnectionConsensusState RPC method + */ +export interface QueryConnectionConsensusStateResponse { + /** consensus state associated with the channel */ + consensusState?: Any; + /** client ID associated with the consensus state */ + clientId: string; + /** merkle proof of existence */ + proof: Uint8Array; + /** height at which the proof was retrieved */ + proofHeight: Height; +} +export interface QueryConnectionConsensusStateResponseProtoMsg { + typeUrl: '/ibc.core.connection.v1.QueryConnectionConsensusStateResponse'; + value: Uint8Array; +} +/** + * QueryConnectionConsensusStateResponse is the response type for the + * Query/ConnectionConsensusState RPC method + */ +export interface QueryConnectionConsensusStateResponseSDKType { + consensus_state?: AnySDKType; + client_id: string; + proof: Uint8Array; + proof_height: HeightSDKType; +} +/** QueryConnectionParamsRequest is the request type for the Query/ConnectionParams RPC method. */ +export interface QueryConnectionParamsRequest {} +export interface QueryConnectionParamsRequestProtoMsg { + typeUrl: '/ibc.core.connection.v1.QueryConnectionParamsRequest'; + value: Uint8Array; +} +/** QueryConnectionParamsRequest is the request type for the Query/ConnectionParams RPC method. */ +export interface QueryConnectionParamsRequestSDKType {} +/** QueryConnectionParamsResponse is the response type for the Query/ConnectionParams RPC method. */ +export interface QueryConnectionParamsResponse { + /** params defines the parameters of the module. */ + params?: Params; +} +export interface QueryConnectionParamsResponseProtoMsg { + typeUrl: '/ibc.core.connection.v1.QueryConnectionParamsResponse'; + value: Uint8Array; +} +/** QueryConnectionParamsResponse is the response type for the Query/ConnectionParams RPC method. */ +export interface QueryConnectionParamsResponseSDKType { + params?: ParamsSDKType; +} +function createBaseQueryConnectionRequest(): QueryConnectionRequest { + return { + connectionId: '', + }; +} +export const QueryConnectionRequest = { + typeUrl: '/ibc.core.connection.v1.QueryConnectionRequest', + encode( + message: QueryConnectionRequest, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.connectionId !== '') { + writer.uint32(10).string(message.connectionId); + } + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): QueryConnectionRequest { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConnectionRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.connectionId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryConnectionRequest { + return { + connectionId: isSet(object.connectionId) + ? String(object.connectionId) + : '', + }; + }, + toJSON(message: QueryConnectionRequest): unknown { + const obj: any = {}; + message.connectionId !== undefined && + (obj.connectionId = message.connectionId); + return obj; + }, + fromPartial(object: Partial): QueryConnectionRequest { + const message = createBaseQueryConnectionRequest(); + message.connectionId = object.connectionId ?? ''; + return message; + }, + fromProtoMsg( + message: QueryConnectionRequestProtoMsg, + ): QueryConnectionRequest { + return QueryConnectionRequest.decode(message.value); + }, + toProto(message: QueryConnectionRequest): Uint8Array { + return QueryConnectionRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryConnectionRequest): QueryConnectionRequestProtoMsg { + return { + typeUrl: '/ibc.core.connection.v1.QueryConnectionRequest', + value: QueryConnectionRequest.encode(message).finish(), + }; + }, +}; +function createBaseQueryConnectionResponse(): QueryConnectionResponse { + return { + connection: undefined, + proof: new Uint8Array(), + proofHeight: Height.fromPartial({}), + }; +} +export const QueryConnectionResponse = { + typeUrl: '/ibc.core.connection.v1.QueryConnectionResponse', + encode( + message: QueryConnectionResponse, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.connection !== undefined) { + ConnectionEnd.encode( + message.connection, + writer.uint32(10).fork(), + ).ldelim(); + } + 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, + ): QueryConnectionResponse { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConnectionResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.connection = ConnectionEnd.decode(reader, reader.uint32()); + 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): QueryConnectionResponse { + return { + connection: isSet(object.connection) + ? ConnectionEnd.fromJSON(object.connection) + : undefined, + proof: isSet(object.proof) + ? bytesFromBase64(object.proof) + : new Uint8Array(), + proofHeight: isSet(object.proofHeight) + ? Height.fromJSON(object.proofHeight) + : undefined, + }; + }, + toJSON(message: QueryConnectionResponse): unknown { + const obj: any = {}; + message.connection !== undefined && + (obj.connection = message.connection + ? ConnectionEnd.toJSON(message.connection) + : undefined); + 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, + ): QueryConnectionResponse { + const message = createBaseQueryConnectionResponse(); + message.connection = + object.connection !== undefined && object.connection !== null + ? ConnectionEnd.fromPartial(object.connection) + : undefined; + message.proof = object.proof ?? new Uint8Array(); + message.proofHeight = + object.proofHeight !== undefined && object.proofHeight !== null + ? Height.fromPartial(object.proofHeight) + : undefined; + return message; + }, + fromProtoMsg( + message: QueryConnectionResponseProtoMsg, + ): QueryConnectionResponse { + return QueryConnectionResponse.decode(message.value); + }, + toProto(message: QueryConnectionResponse): Uint8Array { + return QueryConnectionResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryConnectionResponse, + ): QueryConnectionResponseProtoMsg { + return { + typeUrl: '/ibc.core.connection.v1.QueryConnectionResponse', + value: QueryConnectionResponse.encode(message).finish(), + }; + }, +}; +function createBaseQueryConnectionsRequest(): QueryConnectionsRequest { + return { + pagination: undefined, + }; +} +export const QueryConnectionsRequest = { + typeUrl: '/ibc.core.connection.v1.QueryConnectionsRequest', + encode( + message: QueryConnectionsRequest, + 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, + ): QueryConnectionsRequest { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConnectionsRequest(); + 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): QueryConnectionsRequest { + return { + pagination: isSet(object.pagination) + ? PageRequest.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message: QueryConnectionsRequest): unknown { + const obj: any = {}; + message.pagination !== undefined && + (obj.pagination = message.pagination + ? PageRequest.toJSON(message.pagination) + : undefined); + return obj; + }, + fromPartial( + object: Partial, + ): QueryConnectionsRequest { + const message = createBaseQueryConnectionsRequest(); + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, + fromProtoMsg( + message: QueryConnectionsRequestProtoMsg, + ): QueryConnectionsRequest { + return QueryConnectionsRequest.decode(message.value); + }, + toProto(message: QueryConnectionsRequest): Uint8Array { + return QueryConnectionsRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryConnectionsRequest, + ): QueryConnectionsRequestProtoMsg { + return { + typeUrl: '/ibc.core.connection.v1.QueryConnectionsRequest', + value: QueryConnectionsRequest.encode(message).finish(), + }; + }, +}; +function createBaseQueryConnectionsResponse(): QueryConnectionsResponse { + return { + connections: [], + pagination: undefined, + height: Height.fromPartial({}), + }; +} +export const QueryConnectionsResponse = { + typeUrl: '/ibc.core.connection.v1.QueryConnectionsResponse', + encode( + message: QueryConnectionsResponse, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + for (const v of message.connections) { + IdentifiedConnection.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, + ): QueryConnectionsResponse { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConnectionsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.connections.push( + IdentifiedConnection.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): QueryConnectionsResponse { + return { + connections: Array.isArray(object?.connections) + ? object.connections.map((e: any) => IdentifiedConnection.fromJSON(e)) + : [], + pagination: isSet(object.pagination) + ? PageResponse.fromJSON(object.pagination) + : undefined, + height: isSet(object.height) ? Height.fromJSON(object.height) : undefined, + }; + }, + toJSON(message: QueryConnectionsResponse): unknown { + const obj: any = {}; + if (message.connections) { + obj.connections = message.connections.map(e => + e ? IdentifiedConnection.toJSON(e) : undefined, + ); + } else { + obj.connections = []; + } + 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, + ): QueryConnectionsResponse { + const message = createBaseQueryConnectionsResponse(); + message.connections = + object.connections?.map(e => IdentifiedConnection.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageResponse.fromPartial(object.pagination) + : undefined; + message.height = + object.height !== undefined && object.height !== null + ? Height.fromPartial(object.height) + : undefined; + return message; + }, + fromProtoMsg( + message: QueryConnectionsResponseProtoMsg, + ): QueryConnectionsResponse { + return QueryConnectionsResponse.decode(message.value); + }, + toProto(message: QueryConnectionsResponse): Uint8Array { + return QueryConnectionsResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryConnectionsResponse, + ): QueryConnectionsResponseProtoMsg { + return { + typeUrl: '/ibc.core.connection.v1.QueryConnectionsResponse', + value: QueryConnectionsResponse.encode(message).finish(), + }; + }, +}; +function createBaseQueryClientConnectionsRequest(): QueryClientConnectionsRequest { + return { + clientId: '', + }; +} +export const QueryClientConnectionsRequest = { + typeUrl: '/ibc.core.connection.v1.QueryClientConnectionsRequest', + encode( + message: QueryClientConnectionsRequest, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.clientId !== '') { + writer.uint32(10).string(message.clientId); + } + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): QueryClientConnectionsRequest { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClientConnectionsRequest(); + 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): QueryClientConnectionsRequest { + return { + clientId: isSet(object.clientId) ? String(object.clientId) : '', + }; + }, + toJSON(message: QueryClientConnectionsRequest): unknown { + const obj: any = {}; + message.clientId !== undefined && (obj.clientId = message.clientId); + return obj; + }, + fromPartial( + object: Partial, + ): QueryClientConnectionsRequest { + const message = createBaseQueryClientConnectionsRequest(); + message.clientId = object.clientId ?? ''; + return message; + }, + fromProtoMsg( + message: QueryClientConnectionsRequestProtoMsg, + ): QueryClientConnectionsRequest { + return QueryClientConnectionsRequest.decode(message.value); + }, + toProto(message: QueryClientConnectionsRequest): Uint8Array { + return QueryClientConnectionsRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryClientConnectionsRequest, + ): QueryClientConnectionsRequestProtoMsg { + return { + typeUrl: '/ibc.core.connection.v1.QueryClientConnectionsRequest', + value: QueryClientConnectionsRequest.encode(message).finish(), + }; + }, +}; +function createBaseQueryClientConnectionsResponse(): QueryClientConnectionsResponse { + return { + connectionPaths: [], + proof: new Uint8Array(), + proofHeight: Height.fromPartial({}), + }; +} +export const QueryClientConnectionsResponse = { + typeUrl: '/ibc.core.connection.v1.QueryClientConnectionsResponse', + encode( + message: QueryClientConnectionsResponse, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + for (const v of message.connectionPaths) { + writer.uint32(10).string(v!); + } + 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, + ): QueryClientConnectionsResponse { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClientConnectionsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.connectionPaths.push(reader.string()); + 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): QueryClientConnectionsResponse { + return { + connectionPaths: Array.isArray(object?.connectionPaths) + ? object.connectionPaths.map((e: any) => String(e)) + : [], + proof: isSet(object.proof) + ? bytesFromBase64(object.proof) + : new Uint8Array(), + proofHeight: isSet(object.proofHeight) + ? Height.fromJSON(object.proofHeight) + : undefined, + }; + }, + toJSON(message: QueryClientConnectionsResponse): unknown { + const obj: any = {}; + if (message.connectionPaths) { + obj.connectionPaths = message.connectionPaths.map(e => e); + } else { + obj.connectionPaths = []; + } + 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, + ): QueryClientConnectionsResponse { + const message = createBaseQueryClientConnectionsResponse(); + message.connectionPaths = object.connectionPaths?.map(e => e) || []; + message.proof = object.proof ?? new Uint8Array(); + message.proofHeight = + object.proofHeight !== undefined && object.proofHeight !== null + ? Height.fromPartial(object.proofHeight) + : undefined; + return message; + }, + fromProtoMsg( + message: QueryClientConnectionsResponseProtoMsg, + ): QueryClientConnectionsResponse { + return QueryClientConnectionsResponse.decode(message.value); + }, + toProto(message: QueryClientConnectionsResponse): Uint8Array { + return QueryClientConnectionsResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryClientConnectionsResponse, + ): QueryClientConnectionsResponseProtoMsg { + return { + typeUrl: '/ibc.core.connection.v1.QueryClientConnectionsResponse', + value: QueryClientConnectionsResponse.encode(message).finish(), + }; + }, +}; +function createBaseQueryConnectionClientStateRequest(): QueryConnectionClientStateRequest { + return { + connectionId: '', + }; +} +export const QueryConnectionClientStateRequest = { + typeUrl: '/ibc.core.connection.v1.QueryConnectionClientStateRequest', + encode( + message: QueryConnectionClientStateRequest, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.connectionId !== '') { + writer.uint32(10).string(message.connectionId); + } + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): QueryConnectionClientStateRequest { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConnectionClientStateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.connectionId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryConnectionClientStateRequest { + return { + connectionId: isSet(object.connectionId) + ? String(object.connectionId) + : '', + }; + }, + toJSON(message: QueryConnectionClientStateRequest): unknown { + const obj: any = {}; + message.connectionId !== undefined && + (obj.connectionId = message.connectionId); + return obj; + }, + fromPartial( + object: Partial, + ): QueryConnectionClientStateRequest { + const message = createBaseQueryConnectionClientStateRequest(); + message.connectionId = object.connectionId ?? ''; + return message; + }, + fromProtoMsg( + message: QueryConnectionClientStateRequestProtoMsg, + ): QueryConnectionClientStateRequest { + return QueryConnectionClientStateRequest.decode(message.value); + }, + toProto(message: QueryConnectionClientStateRequest): Uint8Array { + return QueryConnectionClientStateRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryConnectionClientStateRequest, + ): QueryConnectionClientStateRequestProtoMsg { + return { + typeUrl: '/ibc.core.connection.v1.QueryConnectionClientStateRequest', + value: QueryConnectionClientStateRequest.encode(message).finish(), + }; + }, +}; +function createBaseQueryConnectionClientStateResponse(): QueryConnectionClientStateResponse { + return { + identifiedClientState: undefined, + proof: new Uint8Array(), + proofHeight: Height.fromPartial({}), + }; +} +export const QueryConnectionClientStateResponse = { + typeUrl: '/ibc.core.connection.v1.QueryConnectionClientStateResponse', + encode( + message: QueryConnectionClientStateResponse, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.identifiedClientState !== undefined) { + IdentifiedClientState.encode( + message.identifiedClientState, + writer.uint32(10).fork(), + ).ldelim(); + } + 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, + ): QueryConnectionClientStateResponse { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConnectionClientStateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.identifiedClientState = IdentifiedClientState.decode( + reader, + reader.uint32(), + ); + 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): QueryConnectionClientStateResponse { + return { + identifiedClientState: isSet(object.identifiedClientState) + ? IdentifiedClientState.fromJSON(object.identifiedClientState) + : undefined, + proof: isSet(object.proof) + ? bytesFromBase64(object.proof) + : new Uint8Array(), + proofHeight: isSet(object.proofHeight) + ? Height.fromJSON(object.proofHeight) + : undefined, + }; + }, + toJSON(message: QueryConnectionClientStateResponse): unknown { + const obj: any = {}; + message.identifiedClientState !== undefined && + (obj.identifiedClientState = message.identifiedClientState + ? IdentifiedClientState.toJSON(message.identifiedClientState) + : undefined); + 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, + ): QueryConnectionClientStateResponse { + const message = createBaseQueryConnectionClientStateResponse(); + message.identifiedClientState = + object.identifiedClientState !== undefined && + object.identifiedClientState !== null + ? IdentifiedClientState.fromPartial(object.identifiedClientState) + : undefined; + message.proof = object.proof ?? new Uint8Array(); + message.proofHeight = + object.proofHeight !== undefined && object.proofHeight !== null + ? Height.fromPartial(object.proofHeight) + : undefined; + return message; + }, + fromProtoMsg( + message: QueryConnectionClientStateResponseProtoMsg, + ): QueryConnectionClientStateResponse { + return QueryConnectionClientStateResponse.decode(message.value); + }, + toProto(message: QueryConnectionClientStateResponse): Uint8Array { + return QueryConnectionClientStateResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryConnectionClientStateResponse, + ): QueryConnectionClientStateResponseProtoMsg { + return { + typeUrl: '/ibc.core.connection.v1.QueryConnectionClientStateResponse', + value: QueryConnectionClientStateResponse.encode(message).finish(), + }; + }, +}; +function createBaseQueryConnectionConsensusStateRequest(): QueryConnectionConsensusStateRequest { + return { + connectionId: '', + revisionNumber: BigInt(0), + revisionHeight: BigInt(0), + }; +} +export const QueryConnectionConsensusStateRequest = { + typeUrl: '/ibc.core.connection.v1.QueryConnectionConsensusStateRequest', + encode( + message: QueryConnectionConsensusStateRequest, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.connectionId !== '') { + writer.uint32(10).string(message.connectionId); + } + if (message.revisionNumber !== BigInt(0)) { + writer.uint32(16).uint64(message.revisionNumber); + } + if (message.revisionHeight !== BigInt(0)) { + writer.uint32(24).uint64(message.revisionHeight); + } + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): QueryConnectionConsensusStateRequest { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConnectionConsensusStateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.connectionId = reader.string(); + break; + case 2: + message.revisionNumber = reader.uint64(); + break; + case 3: + message.revisionHeight = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryConnectionConsensusStateRequest { + return { + connectionId: isSet(object.connectionId) + ? String(object.connectionId) + : '', + revisionNumber: isSet(object.revisionNumber) + ? BigInt(object.revisionNumber.toString()) + : BigInt(0), + revisionHeight: isSet(object.revisionHeight) + ? BigInt(object.revisionHeight.toString()) + : BigInt(0), + }; + }, + toJSON(message: QueryConnectionConsensusStateRequest): unknown { + const obj: any = {}; + message.connectionId !== undefined && + (obj.connectionId = message.connectionId); + message.revisionNumber !== undefined && + (obj.revisionNumber = (message.revisionNumber || BigInt(0)).toString()); + message.revisionHeight !== undefined && + (obj.revisionHeight = (message.revisionHeight || BigInt(0)).toString()); + return obj; + }, + fromPartial( + object: Partial, + ): QueryConnectionConsensusStateRequest { + const message = createBaseQueryConnectionConsensusStateRequest(); + message.connectionId = object.connectionId ?? ''; + message.revisionNumber = + object.revisionNumber !== undefined && object.revisionNumber !== null + ? BigInt(object.revisionNumber.toString()) + : BigInt(0); + message.revisionHeight = + object.revisionHeight !== undefined && object.revisionHeight !== null + ? BigInt(object.revisionHeight.toString()) + : BigInt(0); + return message; + }, + fromProtoMsg( + message: QueryConnectionConsensusStateRequestProtoMsg, + ): QueryConnectionConsensusStateRequest { + return QueryConnectionConsensusStateRequest.decode(message.value); + }, + toProto(message: QueryConnectionConsensusStateRequest): Uint8Array { + return QueryConnectionConsensusStateRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryConnectionConsensusStateRequest, + ): QueryConnectionConsensusStateRequestProtoMsg { + return { + typeUrl: '/ibc.core.connection.v1.QueryConnectionConsensusStateRequest', + value: QueryConnectionConsensusStateRequest.encode(message).finish(), + }; + }, +}; +function createBaseQueryConnectionConsensusStateResponse(): QueryConnectionConsensusStateResponse { + return { + consensusState: undefined, + clientId: '', + proof: new Uint8Array(), + proofHeight: Height.fromPartial({}), + }; +} +export const QueryConnectionConsensusStateResponse = { + typeUrl: '/ibc.core.connection.v1.QueryConnectionConsensusStateResponse', + encode( + message: QueryConnectionConsensusStateResponse, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.consensusState !== undefined) { + Any.encode(message.consensusState, writer.uint32(10).fork()).ldelim(); + } + if (message.clientId !== '') { + writer.uint32(18).string(message.clientId); + } + 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, + ): QueryConnectionConsensusStateResponse { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConnectionConsensusStateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.consensusState = Any.decode(reader, reader.uint32()); + break; + case 2: + message.clientId = reader.string(); + 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): QueryConnectionConsensusStateResponse { + return { + consensusState: isSet(object.consensusState) + ? Any.fromJSON(object.consensusState) + : undefined, + clientId: isSet(object.clientId) ? String(object.clientId) : '', + proof: isSet(object.proof) + ? bytesFromBase64(object.proof) + : new Uint8Array(), + proofHeight: isSet(object.proofHeight) + ? Height.fromJSON(object.proofHeight) + : undefined, + }; + }, + toJSON(message: QueryConnectionConsensusStateResponse): unknown { + const obj: any = {}; + message.consensusState !== undefined && + (obj.consensusState = message.consensusState + ? Any.toJSON(message.consensusState) + : undefined); + 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); + return obj; + }, + fromPartial( + object: Partial, + ): QueryConnectionConsensusStateResponse { + const message = createBaseQueryConnectionConsensusStateResponse(); + message.consensusState = + object.consensusState !== undefined && object.consensusState !== null + ? Any.fromPartial(object.consensusState) + : undefined; + message.clientId = object.clientId ?? ''; + message.proof = object.proof ?? new Uint8Array(); + message.proofHeight = + object.proofHeight !== undefined && object.proofHeight !== null + ? Height.fromPartial(object.proofHeight) + : undefined; + return message; + }, + fromProtoMsg( + message: QueryConnectionConsensusStateResponseProtoMsg, + ): QueryConnectionConsensusStateResponse { + return QueryConnectionConsensusStateResponse.decode(message.value); + }, + toProto(message: QueryConnectionConsensusStateResponse): Uint8Array { + return QueryConnectionConsensusStateResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryConnectionConsensusStateResponse, + ): QueryConnectionConsensusStateResponseProtoMsg { + return { + typeUrl: '/ibc.core.connection.v1.QueryConnectionConsensusStateResponse', + value: QueryConnectionConsensusStateResponse.encode(message).finish(), + }; + }, +}; +function createBaseQueryConnectionParamsRequest(): QueryConnectionParamsRequest { + return {}; +} +export const QueryConnectionParamsRequest = { + typeUrl: '/ibc.core.connection.v1.QueryConnectionParamsRequest', + encode( + _: QueryConnectionParamsRequest, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): QueryConnectionParamsRequest { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConnectionParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): QueryConnectionParamsRequest { + return {}; + }, + toJSON(_: QueryConnectionParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + fromPartial( + _: Partial, + ): QueryConnectionParamsRequest { + const message = createBaseQueryConnectionParamsRequest(); + return message; + }, + fromProtoMsg( + message: QueryConnectionParamsRequestProtoMsg, + ): QueryConnectionParamsRequest { + return QueryConnectionParamsRequest.decode(message.value); + }, + toProto(message: QueryConnectionParamsRequest): Uint8Array { + return QueryConnectionParamsRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryConnectionParamsRequest, + ): QueryConnectionParamsRequestProtoMsg { + return { + typeUrl: '/ibc.core.connection.v1.QueryConnectionParamsRequest', + value: QueryConnectionParamsRequest.encode(message).finish(), + }; + }, +}; +function createBaseQueryConnectionParamsResponse(): QueryConnectionParamsResponse { + return { + params: undefined, + }; +} +export const QueryConnectionParamsResponse = { + typeUrl: '/ibc.core.connection.v1.QueryConnectionParamsResponse', + encode( + message: QueryConnectionParamsResponse, + 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, + ): QueryConnectionParamsResponse { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConnectionParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryConnectionParamsResponse { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + toJSON(message: QueryConnectionParamsResponse): unknown { + const obj: any = {}; + message.params !== undefined && + (obj.params = message.params ? Params.toJSON(message.params) : undefined); + return obj; + }, + fromPartial( + object: Partial, + ): QueryConnectionParamsResponse { + const message = createBaseQueryConnectionParamsResponse(); + message.params = + object.params !== undefined && object.params !== null + ? Params.fromPartial(object.params) + : undefined; + return message; + }, + fromProtoMsg( + message: QueryConnectionParamsResponseProtoMsg, + ): QueryConnectionParamsResponse { + return QueryConnectionParamsResponse.decode(message.value); + }, + toProto(message: QueryConnectionParamsResponse): Uint8Array { + return QueryConnectionParamsResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryConnectionParamsResponse, + ): QueryConnectionParamsResponseProtoMsg { + return { + typeUrl: '/ibc.core.connection.v1.QueryConnectionParamsResponse', + value: QueryConnectionParamsResponse.encode(message).finish(), + }; + }, +}; diff --git a/packages/cosmic-proto/src/codegen/ibc/core/connection/v1/tx.ts b/packages/cosmic-proto/src/codegen/ibc/core/connection/v1/tx.ts new file mode 100644 index 00000000000..f555b105109 --- /dev/null +++ b/packages/cosmic-proto/src/codegen/ibc/core/connection/v1/tx.ts @@ -0,0 +1,1145 @@ +//@ts-nocheck +import { + Counterparty, + CounterpartySDKType, + Version, + VersionSDKType, +} from './connection.js'; +import { Any, AnySDKType } from '../../../../google/protobuf/any.js'; +import { Height, HeightSDKType } from '../../client/v1/client.js'; +import { BinaryReader, BinaryWriter } from '../../../../binary.js'; +import { + isSet, + bytesFromBase64, + base64FromBytes, +} from '../../../../helpers.js'; +/** + * MsgConnectionOpenInit defines the msg sent by an account on Chain A to + * initialize a connection with Chain B. + */ +export interface MsgConnectionOpenInit { + clientId: string; + counterparty: Counterparty; + version?: Version; + delayPeriod: bigint; + signer: string; +} +export interface MsgConnectionOpenInitProtoMsg { + typeUrl: '/ibc.core.connection.v1.MsgConnectionOpenInit'; + value: Uint8Array; +} +/** + * MsgConnectionOpenInit defines the msg sent by an account on Chain A to + * initialize a connection with Chain B. + */ +export interface MsgConnectionOpenInitSDKType { + client_id: string; + counterparty: CounterpartySDKType; + version?: VersionSDKType; + delay_period: bigint; + signer: string; +} +/** + * MsgConnectionOpenInitResponse defines the Msg/ConnectionOpenInit response + * type. + */ +export interface MsgConnectionOpenInitResponse {} +export interface MsgConnectionOpenInitResponseProtoMsg { + typeUrl: '/ibc.core.connection.v1.MsgConnectionOpenInitResponse'; + value: Uint8Array; +} +/** + * MsgConnectionOpenInitResponse defines the Msg/ConnectionOpenInit response + * type. + */ +export interface MsgConnectionOpenInitResponseSDKType {} +/** + * MsgConnectionOpenTry defines a msg sent by a Relayer to try to open a + * connection on Chain B. + */ +export interface MsgConnectionOpenTry { + clientId: string; + /** Deprecated: this field is unused. Crossing hellos are no longer supported in core IBC. */ + /** @deprecated */ + previousConnectionId: string; + clientState?: Any; + counterparty: Counterparty; + delayPeriod: bigint; + counterpartyVersions: Version[]; + proofHeight: Height; + /** + * proof of the initialization the connection on Chain A: `UNITIALIZED -> + * INIT` + */ + proofInit: Uint8Array; + /** proof of client state included in message */ + proofClient: Uint8Array; + /** proof of client consensus state */ + proofConsensus: Uint8Array; + consensusHeight: Height; + signer: string; +} +export interface MsgConnectionOpenTryProtoMsg { + typeUrl: '/ibc.core.connection.v1.MsgConnectionOpenTry'; + value: Uint8Array; +} +/** + * MsgConnectionOpenTry defines a msg sent by a Relayer to try to open a + * connection on Chain B. + */ +export interface MsgConnectionOpenTrySDKType { + client_id: string; + /** @deprecated */ + previous_connection_id: string; + client_state?: AnySDKType; + counterparty: CounterpartySDKType; + delay_period: bigint; + counterparty_versions: VersionSDKType[]; + proof_height: HeightSDKType; + proof_init: Uint8Array; + proof_client: Uint8Array; + proof_consensus: Uint8Array; + consensus_height: HeightSDKType; + signer: string; +} +/** MsgConnectionOpenTryResponse defines the Msg/ConnectionOpenTry response type. */ +export interface MsgConnectionOpenTryResponse {} +export interface MsgConnectionOpenTryResponseProtoMsg { + typeUrl: '/ibc.core.connection.v1.MsgConnectionOpenTryResponse'; + value: Uint8Array; +} +/** MsgConnectionOpenTryResponse defines the Msg/ConnectionOpenTry response type. */ +export interface MsgConnectionOpenTryResponseSDKType {} +/** + * MsgConnectionOpenAck defines a msg sent by a Relayer to Chain A to + * acknowledge the change of connection state to TRYOPEN on Chain B. + */ +export interface MsgConnectionOpenAck { + connectionId: string; + counterpartyConnectionId: string; + version?: Version; + clientState?: Any; + proofHeight: Height; + /** + * proof of the initialization the connection on Chain B: `UNITIALIZED -> + * TRYOPEN` + */ + proofTry: Uint8Array; + /** proof of client state included in message */ + proofClient: Uint8Array; + /** proof of client consensus state */ + proofConsensus: Uint8Array; + consensusHeight: Height; + signer: string; +} +export interface MsgConnectionOpenAckProtoMsg { + typeUrl: '/ibc.core.connection.v1.MsgConnectionOpenAck'; + value: Uint8Array; +} +/** + * MsgConnectionOpenAck defines a msg sent by a Relayer to Chain A to + * acknowledge the change of connection state to TRYOPEN on Chain B. + */ +export interface MsgConnectionOpenAckSDKType { + connection_id: string; + counterparty_connection_id: string; + version?: VersionSDKType; + client_state?: AnySDKType; + proof_height: HeightSDKType; + proof_try: Uint8Array; + proof_client: Uint8Array; + proof_consensus: Uint8Array; + consensus_height: HeightSDKType; + signer: string; +} +/** MsgConnectionOpenAckResponse defines the Msg/ConnectionOpenAck response type. */ +export interface MsgConnectionOpenAckResponse {} +export interface MsgConnectionOpenAckResponseProtoMsg { + typeUrl: '/ibc.core.connection.v1.MsgConnectionOpenAckResponse'; + value: Uint8Array; +} +/** MsgConnectionOpenAckResponse defines the Msg/ConnectionOpenAck response type. */ +export interface MsgConnectionOpenAckResponseSDKType {} +/** + * MsgConnectionOpenConfirm defines a msg sent by a Relayer to Chain B to + * acknowledge the change of connection state to OPEN on Chain A. + */ +export interface MsgConnectionOpenConfirm { + connectionId: string; + /** proof for the change of the connection state on Chain A: `INIT -> OPEN` */ + proofAck: Uint8Array; + proofHeight: Height; + signer: string; +} +export interface MsgConnectionOpenConfirmProtoMsg { + typeUrl: '/ibc.core.connection.v1.MsgConnectionOpenConfirm'; + value: Uint8Array; +} +/** + * MsgConnectionOpenConfirm defines a msg sent by a Relayer to Chain B to + * acknowledge the change of connection state to OPEN on Chain A. + */ +export interface MsgConnectionOpenConfirmSDKType { + connection_id: string; + proof_ack: Uint8Array; + proof_height: HeightSDKType; + signer: string; +} +/** + * MsgConnectionOpenConfirmResponse defines the Msg/ConnectionOpenConfirm + * response type. + */ +export interface MsgConnectionOpenConfirmResponse {} +export interface MsgConnectionOpenConfirmResponseProtoMsg { + typeUrl: '/ibc.core.connection.v1.MsgConnectionOpenConfirmResponse'; + value: Uint8Array; +} +/** + * MsgConnectionOpenConfirmResponse defines the Msg/ConnectionOpenConfirm + * response type. + */ +export interface MsgConnectionOpenConfirmResponseSDKType {} +function createBaseMsgConnectionOpenInit(): MsgConnectionOpenInit { + return { + clientId: '', + counterparty: Counterparty.fromPartial({}), + version: undefined, + delayPeriod: BigInt(0), + signer: '', + }; +} +export const MsgConnectionOpenInit = { + typeUrl: '/ibc.core.connection.v1.MsgConnectionOpenInit', + encode( + message: MsgConnectionOpenInit, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.clientId !== '') { + writer.uint32(10).string(message.clientId); + } + if (message.counterparty !== undefined) { + Counterparty.encode( + message.counterparty, + writer.uint32(18).fork(), + ).ldelim(); + } + if (message.version !== undefined) { + Version.encode(message.version, writer.uint32(26).fork()).ldelim(); + } + if (message.delayPeriod !== BigInt(0)) { + writer.uint32(32).uint64(message.delayPeriod); + } + if (message.signer !== '') { + writer.uint32(42).string(message.signer); + } + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): MsgConnectionOpenInit { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgConnectionOpenInit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.counterparty = Counterparty.decode(reader, reader.uint32()); + break; + case 3: + message.version = Version.decode(reader, reader.uint32()); + break; + case 4: + message.delayPeriod = reader.uint64(); + break; + case 5: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgConnectionOpenInit { + return { + clientId: isSet(object.clientId) ? String(object.clientId) : '', + counterparty: isSet(object.counterparty) + ? Counterparty.fromJSON(object.counterparty) + : undefined, + version: isSet(object.version) + ? Version.fromJSON(object.version) + : undefined, + delayPeriod: isSet(object.delayPeriod) + ? BigInt(object.delayPeriod.toString()) + : BigInt(0), + signer: isSet(object.signer) ? String(object.signer) : '', + }; + }, + toJSON(message: MsgConnectionOpenInit): unknown { + const obj: any = {}; + message.clientId !== undefined && (obj.clientId = message.clientId); + message.counterparty !== undefined && + (obj.counterparty = message.counterparty + ? Counterparty.toJSON(message.counterparty) + : undefined); + message.version !== undefined && + (obj.version = message.version + ? Version.toJSON(message.version) + : undefined); + message.delayPeriod !== undefined && + (obj.delayPeriod = (message.delayPeriod || BigInt(0)).toString()); + message.signer !== undefined && (obj.signer = message.signer); + return obj; + }, + fromPartial(object: Partial): MsgConnectionOpenInit { + const message = createBaseMsgConnectionOpenInit(); + message.clientId = object.clientId ?? ''; + message.counterparty = + object.counterparty !== undefined && object.counterparty !== null + ? Counterparty.fromPartial(object.counterparty) + : undefined; + message.version = + object.version !== undefined && object.version !== null + ? Version.fromPartial(object.version) + : undefined; + message.delayPeriod = + object.delayPeriod !== undefined && object.delayPeriod !== null + ? BigInt(object.delayPeriod.toString()) + : BigInt(0); + message.signer = object.signer ?? ''; + return message; + }, + fromProtoMsg(message: MsgConnectionOpenInitProtoMsg): MsgConnectionOpenInit { + return MsgConnectionOpenInit.decode(message.value); + }, + toProto(message: MsgConnectionOpenInit): Uint8Array { + return MsgConnectionOpenInit.encode(message).finish(); + }, + toProtoMsg(message: MsgConnectionOpenInit): MsgConnectionOpenInitProtoMsg { + return { + typeUrl: '/ibc.core.connection.v1.MsgConnectionOpenInit', + value: MsgConnectionOpenInit.encode(message).finish(), + }; + }, +}; +function createBaseMsgConnectionOpenInitResponse(): MsgConnectionOpenInitResponse { + return {}; +} +export const MsgConnectionOpenInitResponse = { + typeUrl: '/ibc.core.connection.v1.MsgConnectionOpenInitResponse', + encode( + _: MsgConnectionOpenInitResponse, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): MsgConnectionOpenInitResponse { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgConnectionOpenInitResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): MsgConnectionOpenInitResponse { + return {}; + }, + toJSON(_: MsgConnectionOpenInitResponse): unknown { + const obj: any = {}; + return obj; + }, + fromPartial( + _: Partial, + ): MsgConnectionOpenInitResponse { + const message = createBaseMsgConnectionOpenInitResponse(); + return message; + }, + fromProtoMsg( + message: MsgConnectionOpenInitResponseProtoMsg, + ): MsgConnectionOpenInitResponse { + return MsgConnectionOpenInitResponse.decode(message.value); + }, + toProto(message: MsgConnectionOpenInitResponse): Uint8Array { + return MsgConnectionOpenInitResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgConnectionOpenInitResponse, + ): MsgConnectionOpenInitResponseProtoMsg { + return { + typeUrl: '/ibc.core.connection.v1.MsgConnectionOpenInitResponse', + value: MsgConnectionOpenInitResponse.encode(message).finish(), + }; + }, +}; +function createBaseMsgConnectionOpenTry(): MsgConnectionOpenTry { + return { + clientId: '', + previousConnectionId: '', + clientState: undefined, + counterparty: Counterparty.fromPartial({}), + delayPeriod: BigInt(0), + counterpartyVersions: [], + proofHeight: Height.fromPartial({}), + proofInit: new Uint8Array(), + proofClient: new Uint8Array(), + proofConsensus: new Uint8Array(), + consensusHeight: Height.fromPartial({}), + signer: '', + }; +} +export const MsgConnectionOpenTry = { + typeUrl: '/ibc.core.connection.v1.MsgConnectionOpenTry', + encode( + message: MsgConnectionOpenTry, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.clientId !== '') { + writer.uint32(10).string(message.clientId); + } + if (message.previousConnectionId !== '') { + writer.uint32(18).string(message.previousConnectionId); + } + if (message.clientState !== undefined) { + Any.encode(message.clientState, writer.uint32(26).fork()).ldelim(); + } + if (message.counterparty !== undefined) { + Counterparty.encode( + message.counterparty, + writer.uint32(34).fork(), + ).ldelim(); + } + if (message.delayPeriod !== BigInt(0)) { + writer.uint32(40).uint64(message.delayPeriod); + } + for (const v of message.counterpartyVersions) { + Version.encode(v!, writer.uint32(50).fork()).ldelim(); + } + if (message.proofHeight !== undefined) { + Height.encode(message.proofHeight, writer.uint32(58).fork()).ldelim(); + } + if (message.proofInit.length !== 0) { + writer.uint32(66).bytes(message.proofInit); + } + if (message.proofClient.length !== 0) { + writer.uint32(74).bytes(message.proofClient); + } + if (message.proofConsensus.length !== 0) { + writer.uint32(82).bytes(message.proofConsensus); + } + if (message.consensusHeight !== undefined) { + Height.encode(message.consensusHeight, writer.uint32(90).fork()).ldelim(); + } + if (message.signer !== '') { + writer.uint32(98).string(message.signer); + } + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): MsgConnectionOpenTry { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgConnectionOpenTry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.previousConnectionId = reader.string(); + break; + case 3: + message.clientState = Any.decode(reader, reader.uint32()); + break; + case 4: + message.counterparty = Counterparty.decode(reader, reader.uint32()); + break; + case 5: + message.delayPeriod = reader.uint64(); + break; + case 6: + message.counterpartyVersions.push( + Version.decode(reader, reader.uint32()), + ); + break; + case 7: + message.proofHeight = Height.decode(reader, reader.uint32()); + break; + case 8: + message.proofInit = reader.bytes(); + break; + case 9: + message.proofClient = reader.bytes(); + break; + case 10: + message.proofConsensus = reader.bytes(); + break; + case 11: + message.consensusHeight = Height.decode(reader, reader.uint32()); + break; + case 12: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgConnectionOpenTry { + return { + clientId: isSet(object.clientId) ? String(object.clientId) : '', + previousConnectionId: isSet(object.previousConnectionId) + ? String(object.previousConnectionId) + : '', + clientState: isSet(object.clientState) + ? Any.fromJSON(object.clientState) + : undefined, + counterparty: isSet(object.counterparty) + ? Counterparty.fromJSON(object.counterparty) + : undefined, + delayPeriod: isSet(object.delayPeriod) + ? BigInt(object.delayPeriod.toString()) + : BigInt(0), + counterpartyVersions: Array.isArray(object?.counterpartyVersions) + ? object.counterpartyVersions.map((e: any) => Version.fromJSON(e)) + : [], + proofHeight: isSet(object.proofHeight) + ? Height.fromJSON(object.proofHeight) + : undefined, + proofInit: isSet(object.proofInit) + ? bytesFromBase64(object.proofInit) + : new Uint8Array(), + proofClient: isSet(object.proofClient) + ? bytesFromBase64(object.proofClient) + : new Uint8Array(), + proofConsensus: isSet(object.proofConsensus) + ? bytesFromBase64(object.proofConsensus) + : new Uint8Array(), + consensusHeight: isSet(object.consensusHeight) + ? Height.fromJSON(object.consensusHeight) + : undefined, + signer: isSet(object.signer) ? String(object.signer) : '', + }; + }, + toJSON(message: MsgConnectionOpenTry): unknown { + const obj: any = {}; + message.clientId !== undefined && (obj.clientId = message.clientId); + message.previousConnectionId !== undefined && + (obj.previousConnectionId = message.previousConnectionId); + message.clientState !== undefined && + (obj.clientState = message.clientState + ? Any.toJSON(message.clientState) + : undefined); + message.counterparty !== undefined && + (obj.counterparty = message.counterparty + ? Counterparty.toJSON(message.counterparty) + : undefined); + message.delayPeriod !== undefined && + (obj.delayPeriod = (message.delayPeriod || BigInt(0)).toString()); + if (message.counterpartyVersions) { + obj.counterpartyVersions = message.counterpartyVersions.map(e => + e ? Version.toJSON(e) : undefined, + ); + } else { + obj.counterpartyVersions = []; + } + message.proofHeight !== undefined && + (obj.proofHeight = message.proofHeight + ? Height.toJSON(message.proofHeight) + : undefined); + message.proofInit !== undefined && + (obj.proofInit = base64FromBytes( + message.proofInit !== undefined ? message.proofInit : new Uint8Array(), + )); + message.proofClient !== undefined && + (obj.proofClient = base64FromBytes( + message.proofClient !== undefined + ? message.proofClient + : new Uint8Array(), + )); + message.proofConsensus !== undefined && + (obj.proofConsensus = base64FromBytes( + message.proofConsensus !== undefined + ? message.proofConsensus + : new Uint8Array(), + )); + message.consensusHeight !== undefined && + (obj.consensusHeight = message.consensusHeight + ? Height.toJSON(message.consensusHeight) + : undefined); + message.signer !== undefined && (obj.signer = message.signer); + return obj; + }, + fromPartial(object: Partial): MsgConnectionOpenTry { + const message = createBaseMsgConnectionOpenTry(); + message.clientId = object.clientId ?? ''; + message.previousConnectionId = object.previousConnectionId ?? ''; + message.clientState = + object.clientState !== undefined && object.clientState !== null + ? Any.fromPartial(object.clientState) + : undefined; + message.counterparty = + object.counterparty !== undefined && object.counterparty !== null + ? Counterparty.fromPartial(object.counterparty) + : undefined; + message.delayPeriod = + object.delayPeriod !== undefined && object.delayPeriod !== null + ? BigInt(object.delayPeriod.toString()) + : BigInt(0); + message.counterpartyVersions = + object.counterpartyVersions?.map(e => Version.fromPartial(e)) || []; + message.proofHeight = + object.proofHeight !== undefined && object.proofHeight !== null + ? Height.fromPartial(object.proofHeight) + : undefined; + message.proofInit = object.proofInit ?? new Uint8Array(); + message.proofClient = object.proofClient ?? new Uint8Array(); + message.proofConsensus = object.proofConsensus ?? new Uint8Array(); + message.consensusHeight = + object.consensusHeight !== undefined && object.consensusHeight !== null + ? Height.fromPartial(object.consensusHeight) + : undefined; + message.signer = object.signer ?? ''; + return message; + }, + fromProtoMsg(message: MsgConnectionOpenTryProtoMsg): MsgConnectionOpenTry { + return MsgConnectionOpenTry.decode(message.value); + }, + toProto(message: MsgConnectionOpenTry): Uint8Array { + return MsgConnectionOpenTry.encode(message).finish(); + }, + toProtoMsg(message: MsgConnectionOpenTry): MsgConnectionOpenTryProtoMsg { + return { + typeUrl: '/ibc.core.connection.v1.MsgConnectionOpenTry', + value: MsgConnectionOpenTry.encode(message).finish(), + }; + }, +}; +function createBaseMsgConnectionOpenTryResponse(): MsgConnectionOpenTryResponse { + return {}; +} +export const MsgConnectionOpenTryResponse = { + typeUrl: '/ibc.core.connection.v1.MsgConnectionOpenTryResponse', + encode( + _: MsgConnectionOpenTryResponse, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): MsgConnectionOpenTryResponse { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgConnectionOpenTryResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): MsgConnectionOpenTryResponse { + return {}; + }, + toJSON(_: MsgConnectionOpenTryResponse): unknown { + const obj: any = {}; + return obj; + }, + fromPartial( + _: Partial, + ): MsgConnectionOpenTryResponse { + const message = createBaseMsgConnectionOpenTryResponse(); + return message; + }, + fromProtoMsg( + message: MsgConnectionOpenTryResponseProtoMsg, + ): MsgConnectionOpenTryResponse { + return MsgConnectionOpenTryResponse.decode(message.value); + }, + toProto(message: MsgConnectionOpenTryResponse): Uint8Array { + return MsgConnectionOpenTryResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgConnectionOpenTryResponse, + ): MsgConnectionOpenTryResponseProtoMsg { + return { + typeUrl: '/ibc.core.connection.v1.MsgConnectionOpenTryResponse', + value: MsgConnectionOpenTryResponse.encode(message).finish(), + }; + }, +}; +function createBaseMsgConnectionOpenAck(): MsgConnectionOpenAck { + return { + connectionId: '', + counterpartyConnectionId: '', + version: undefined, + clientState: undefined, + proofHeight: Height.fromPartial({}), + proofTry: new Uint8Array(), + proofClient: new Uint8Array(), + proofConsensus: new Uint8Array(), + consensusHeight: Height.fromPartial({}), + signer: '', + }; +} +export const MsgConnectionOpenAck = { + typeUrl: '/ibc.core.connection.v1.MsgConnectionOpenAck', + encode( + message: MsgConnectionOpenAck, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.connectionId !== '') { + writer.uint32(10).string(message.connectionId); + } + if (message.counterpartyConnectionId !== '') { + writer.uint32(18).string(message.counterpartyConnectionId); + } + if (message.version !== undefined) { + Version.encode(message.version, writer.uint32(26).fork()).ldelim(); + } + if (message.clientState !== undefined) { + Any.encode(message.clientState, writer.uint32(34).fork()).ldelim(); + } + if (message.proofHeight !== undefined) { + Height.encode(message.proofHeight, writer.uint32(42).fork()).ldelim(); + } + if (message.proofTry.length !== 0) { + writer.uint32(50).bytes(message.proofTry); + } + if (message.proofClient.length !== 0) { + writer.uint32(58).bytes(message.proofClient); + } + if (message.proofConsensus.length !== 0) { + writer.uint32(66).bytes(message.proofConsensus); + } + if (message.consensusHeight !== undefined) { + Height.encode(message.consensusHeight, writer.uint32(74).fork()).ldelim(); + } + if (message.signer !== '') { + writer.uint32(82).string(message.signer); + } + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): MsgConnectionOpenAck { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgConnectionOpenAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.connectionId = reader.string(); + break; + case 2: + message.counterpartyConnectionId = reader.string(); + break; + case 3: + message.version = Version.decode(reader, reader.uint32()); + break; + case 4: + message.clientState = Any.decode(reader, reader.uint32()); + break; + case 5: + message.proofHeight = Height.decode(reader, reader.uint32()); + break; + case 6: + message.proofTry = reader.bytes(); + break; + case 7: + message.proofClient = reader.bytes(); + break; + case 8: + message.proofConsensus = reader.bytes(); + break; + case 9: + message.consensusHeight = Height.decode(reader, reader.uint32()); + break; + case 10: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgConnectionOpenAck { + return { + connectionId: isSet(object.connectionId) + ? String(object.connectionId) + : '', + counterpartyConnectionId: isSet(object.counterpartyConnectionId) + ? String(object.counterpartyConnectionId) + : '', + version: isSet(object.version) + ? Version.fromJSON(object.version) + : undefined, + clientState: isSet(object.clientState) + ? Any.fromJSON(object.clientState) + : undefined, + proofHeight: isSet(object.proofHeight) + ? Height.fromJSON(object.proofHeight) + : undefined, + proofTry: isSet(object.proofTry) + ? bytesFromBase64(object.proofTry) + : new Uint8Array(), + proofClient: isSet(object.proofClient) + ? bytesFromBase64(object.proofClient) + : new Uint8Array(), + proofConsensus: isSet(object.proofConsensus) + ? bytesFromBase64(object.proofConsensus) + : new Uint8Array(), + consensusHeight: isSet(object.consensusHeight) + ? Height.fromJSON(object.consensusHeight) + : undefined, + signer: isSet(object.signer) ? String(object.signer) : '', + }; + }, + toJSON(message: MsgConnectionOpenAck): unknown { + const obj: any = {}; + message.connectionId !== undefined && + (obj.connectionId = message.connectionId); + message.counterpartyConnectionId !== undefined && + (obj.counterpartyConnectionId = message.counterpartyConnectionId); + message.version !== undefined && + (obj.version = message.version + ? Version.toJSON(message.version) + : undefined); + message.clientState !== undefined && + (obj.clientState = message.clientState + ? Any.toJSON(message.clientState) + : undefined); + message.proofHeight !== undefined && + (obj.proofHeight = message.proofHeight + ? Height.toJSON(message.proofHeight) + : undefined); + message.proofTry !== undefined && + (obj.proofTry = base64FromBytes( + message.proofTry !== undefined ? message.proofTry : new Uint8Array(), + )); + message.proofClient !== undefined && + (obj.proofClient = base64FromBytes( + message.proofClient !== undefined + ? message.proofClient + : new Uint8Array(), + )); + message.proofConsensus !== undefined && + (obj.proofConsensus = base64FromBytes( + message.proofConsensus !== undefined + ? message.proofConsensus + : new Uint8Array(), + )); + message.consensusHeight !== undefined && + (obj.consensusHeight = message.consensusHeight + ? Height.toJSON(message.consensusHeight) + : undefined); + message.signer !== undefined && (obj.signer = message.signer); + return obj; + }, + fromPartial(object: Partial): MsgConnectionOpenAck { + const message = createBaseMsgConnectionOpenAck(); + message.connectionId = object.connectionId ?? ''; + message.counterpartyConnectionId = object.counterpartyConnectionId ?? ''; + message.version = + object.version !== undefined && object.version !== null + ? Version.fromPartial(object.version) + : undefined; + message.clientState = + object.clientState !== undefined && object.clientState !== null + ? Any.fromPartial(object.clientState) + : undefined; + message.proofHeight = + object.proofHeight !== undefined && object.proofHeight !== null + ? Height.fromPartial(object.proofHeight) + : undefined; + message.proofTry = object.proofTry ?? new Uint8Array(); + message.proofClient = object.proofClient ?? new Uint8Array(); + message.proofConsensus = object.proofConsensus ?? new Uint8Array(); + message.consensusHeight = + object.consensusHeight !== undefined && object.consensusHeight !== null + ? Height.fromPartial(object.consensusHeight) + : undefined; + message.signer = object.signer ?? ''; + return message; + }, + fromProtoMsg(message: MsgConnectionOpenAckProtoMsg): MsgConnectionOpenAck { + return MsgConnectionOpenAck.decode(message.value); + }, + toProto(message: MsgConnectionOpenAck): Uint8Array { + return MsgConnectionOpenAck.encode(message).finish(); + }, + toProtoMsg(message: MsgConnectionOpenAck): MsgConnectionOpenAckProtoMsg { + return { + typeUrl: '/ibc.core.connection.v1.MsgConnectionOpenAck', + value: MsgConnectionOpenAck.encode(message).finish(), + }; + }, +}; +function createBaseMsgConnectionOpenAckResponse(): MsgConnectionOpenAckResponse { + return {}; +} +export const MsgConnectionOpenAckResponse = { + typeUrl: '/ibc.core.connection.v1.MsgConnectionOpenAckResponse', + encode( + _: MsgConnectionOpenAckResponse, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): MsgConnectionOpenAckResponse { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgConnectionOpenAckResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): MsgConnectionOpenAckResponse { + return {}; + }, + toJSON(_: MsgConnectionOpenAckResponse): unknown { + const obj: any = {}; + return obj; + }, + fromPartial( + _: Partial, + ): MsgConnectionOpenAckResponse { + const message = createBaseMsgConnectionOpenAckResponse(); + return message; + }, + fromProtoMsg( + message: MsgConnectionOpenAckResponseProtoMsg, + ): MsgConnectionOpenAckResponse { + return MsgConnectionOpenAckResponse.decode(message.value); + }, + toProto(message: MsgConnectionOpenAckResponse): Uint8Array { + return MsgConnectionOpenAckResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgConnectionOpenAckResponse, + ): MsgConnectionOpenAckResponseProtoMsg { + return { + typeUrl: '/ibc.core.connection.v1.MsgConnectionOpenAckResponse', + value: MsgConnectionOpenAckResponse.encode(message).finish(), + }; + }, +}; +function createBaseMsgConnectionOpenConfirm(): MsgConnectionOpenConfirm { + return { + connectionId: '', + proofAck: new Uint8Array(), + proofHeight: Height.fromPartial({}), + signer: '', + }; +} +export const MsgConnectionOpenConfirm = { + typeUrl: '/ibc.core.connection.v1.MsgConnectionOpenConfirm', + encode( + message: MsgConnectionOpenConfirm, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.connectionId !== '') { + writer.uint32(10).string(message.connectionId); + } + if (message.proofAck.length !== 0) { + writer.uint32(18).bytes(message.proofAck); + } + 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, + ): MsgConnectionOpenConfirm { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgConnectionOpenConfirm(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.connectionId = reader.string(); + break; + case 2: + message.proofAck = 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): MsgConnectionOpenConfirm { + return { + connectionId: isSet(object.connectionId) + ? String(object.connectionId) + : '', + proofAck: isSet(object.proofAck) + ? bytesFromBase64(object.proofAck) + : new Uint8Array(), + proofHeight: isSet(object.proofHeight) + ? Height.fromJSON(object.proofHeight) + : undefined, + signer: isSet(object.signer) ? String(object.signer) : '', + }; + }, + toJSON(message: MsgConnectionOpenConfirm): unknown { + const obj: any = {}; + message.connectionId !== undefined && + (obj.connectionId = message.connectionId); + message.proofAck !== undefined && + (obj.proofAck = base64FromBytes( + message.proofAck !== undefined ? message.proofAck : 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, + ): MsgConnectionOpenConfirm { + const message = createBaseMsgConnectionOpenConfirm(); + message.connectionId = object.connectionId ?? ''; + message.proofAck = object.proofAck ?? new Uint8Array(); + message.proofHeight = + object.proofHeight !== undefined && object.proofHeight !== null + ? Height.fromPartial(object.proofHeight) + : undefined; + message.signer = object.signer ?? ''; + return message; + }, + fromProtoMsg( + message: MsgConnectionOpenConfirmProtoMsg, + ): MsgConnectionOpenConfirm { + return MsgConnectionOpenConfirm.decode(message.value); + }, + toProto(message: MsgConnectionOpenConfirm): Uint8Array { + return MsgConnectionOpenConfirm.encode(message).finish(); + }, + toProtoMsg( + message: MsgConnectionOpenConfirm, + ): MsgConnectionOpenConfirmProtoMsg { + return { + typeUrl: '/ibc.core.connection.v1.MsgConnectionOpenConfirm', + value: MsgConnectionOpenConfirm.encode(message).finish(), + }; + }, +}; +function createBaseMsgConnectionOpenConfirmResponse(): MsgConnectionOpenConfirmResponse { + return {}; +} +export const MsgConnectionOpenConfirmResponse = { + typeUrl: '/ibc.core.connection.v1.MsgConnectionOpenConfirmResponse', + encode( + _: MsgConnectionOpenConfirmResponse, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): MsgConnectionOpenConfirmResponse { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgConnectionOpenConfirmResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): MsgConnectionOpenConfirmResponse { + return {}; + }, + toJSON(_: MsgConnectionOpenConfirmResponse): unknown { + const obj: any = {}; + return obj; + }, + fromPartial( + _: Partial, + ): MsgConnectionOpenConfirmResponse { + const message = createBaseMsgConnectionOpenConfirmResponse(); + return message; + }, + fromProtoMsg( + message: MsgConnectionOpenConfirmResponseProtoMsg, + ): MsgConnectionOpenConfirmResponse { + return MsgConnectionOpenConfirmResponse.decode(message.value); + }, + toProto(message: MsgConnectionOpenConfirmResponse): Uint8Array { + return MsgConnectionOpenConfirmResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgConnectionOpenConfirmResponse, + ): MsgConnectionOpenConfirmResponseProtoMsg { + return { + typeUrl: '/ibc.core.connection.v1.MsgConnectionOpenConfirmResponse', + value: MsgConnectionOpenConfirmResponse.encode(message).finish(), + }; + }, +}; diff --git a/packages/cosmic-proto/src/codegen/ibc/lightclients/localhost/v1/localhost.ts b/packages/cosmic-proto/src/codegen/ibc/lightclients/localhost/v1/localhost.ts new file mode 100644 index 00000000000..547316a6fac --- /dev/null +++ b/packages/cosmic-proto/src/codegen/ibc/lightclients/localhost/v1/localhost.ts @@ -0,0 +1,102 @@ +//@ts-nocheck +import { Height, HeightSDKType } from '../../../core/client/v1/client.js'; +import { BinaryReader, BinaryWriter } from '../../../../binary.js'; +import { isSet } from '../../../../helpers.js'; +/** + * ClientState defines a loopback (localhost) client. It requires (read-only) + * access to keys outside the client prefix. + */ +export interface ClientState { + /** self chain ID */ + chainId: string; + /** self latest block height */ + height: Height; +} +export interface ClientStateProtoMsg { + typeUrl: '/ibc.lightclients.localhost.v1.ClientState'; + value: Uint8Array; +} +/** + * ClientState defines a loopback (localhost) client. It requires (read-only) + * access to keys outside the client prefix. + */ +export interface ClientStateSDKType { + chain_id: string; + height: HeightSDKType; +} +function createBaseClientState(): ClientState { + return { + chainId: '', + height: Height.fromPartial({}), + }; +} +export const ClientState = { + typeUrl: '/ibc.lightclients.localhost.v1.ClientState', + encode( + message: ClientState, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.chainId !== '') { + writer.uint32(10).string(message.chainId); + } + if (message.height !== undefined) { + Height.encode(message.height, writer.uint32(18).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.chainId = reader.string(); + break; + case 2: + message.height = Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): ClientState { + return { + chainId: isSet(object.chainId) ? String(object.chainId) : '', + height: isSet(object.height) ? Height.fromJSON(object.height) : undefined, + }; + }, + toJSON(message: ClientState): unknown { + const obj: any = {}; + message.chainId !== undefined && (obj.chainId = message.chainId); + message.height !== undefined && + (obj.height = message.height ? Height.toJSON(message.height) : undefined); + return obj; + }, + fromPartial(object: Partial): ClientState { + const message = createBaseClientState(); + message.chainId = object.chainId ?? ''; + message.height = + object.height !== undefined && object.height !== null + ? Height.fromPartial(object.height) + : undefined; + return message; + }, + fromProtoMsg(message: ClientStateProtoMsg): ClientState { + return ClientState.decode(message.value); + }, + toProto(message: ClientState): Uint8Array { + return ClientState.encode(message).finish(); + }, + toProtoMsg(message: ClientState): ClientStateProtoMsg { + return { + typeUrl: '/ibc.lightclients.localhost.v1.ClientState', + value: ClientState.encode(message).finish(), + }; + }, +}; diff --git a/packages/cosmic-proto/src/codegen/ibc/lightclients/solomachine/v1/solomachine.ts b/packages/cosmic-proto/src/codegen/ibc/lightclients/solomachine/v1/solomachine.ts new file mode 100644 index 00000000000..73ed678be08 --- /dev/null +++ b/packages/cosmic-proto/src/codegen/ibc/lightclients/solomachine/v1/solomachine.ts @@ -0,0 +1,2017 @@ +//@ts-nocheck +import { Any, AnySDKType } from '../../../../google/protobuf/any.js'; +import { + ConnectionEnd, + ConnectionEndSDKType, +} from '../../../core/connection/v1/connection.js'; +import { Channel, ChannelSDKType } from '../../../core/channel/v1/channel.js'; +import { BinaryReader, BinaryWriter } from '../../../../binary.js'; +import { + isSet, + bytesFromBase64, + base64FromBytes, +} from '../../../../helpers.js'; +/** + * DataType defines the type of solo machine proof being created. This is done + * to preserve uniqueness of different data sign byte encodings. + */ +export enum DataType { + /** DATA_TYPE_UNINITIALIZED_UNSPECIFIED - Default State */ + DATA_TYPE_UNINITIALIZED_UNSPECIFIED = 0, + /** DATA_TYPE_CLIENT_STATE - Data type for client state verification */ + DATA_TYPE_CLIENT_STATE = 1, + /** DATA_TYPE_CONSENSUS_STATE - Data type for consensus state verification */ + DATA_TYPE_CONSENSUS_STATE = 2, + /** DATA_TYPE_CONNECTION_STATE - Data type for connection state verification */ + DATA_TYPE_CONNECTION_STATE = 3, + /** DATA_TYPE_CHANNEL_STATE - Data type for channel state verification */ + DATA_TYPE_CHANNEL_STATE = 4, + /** DATA_TYPE_PACKET_COMMITMENT - Data type for packet commitment verification */ + DATA_TYPE_PACKET_COMMITMENT = 5, + /** DATA_TYPE_PACKET_ACKNOWLEDGEMENT - Data type for packet acknowledgement verification */ + DATA_TYPE_PACKET_ACKNOWLEDGEMENT = 6, + /** DATA_TYPE_PACKET_RECEIPT_ABSENCE - Data type for packet receipt absence verification */ + DATA_TYPE_PACKET_RECEIPT_ABSENCE = 7, + /** DATA_TYPE_NEXT_SEQUENCE_RECV - Data type for next sequence recv verification */ + DATA_TYPE_NEXT_SEQUENCE_RECV = 8, + /** DATA_TYPE_HEADER - Data type for header verification */ + DATA_TYPE_HEADER = 9, + UNRECOGNIZED = -1, +} +export const DataTypeSDKType = DataType; +export function dataTypeFromJSON(object: any): DataType { + switch (object) { + case 0: + case 'DATA_TYPE_UNINITIALIZED_UNSPECIFIED': + return DataType.DATA_TYPE_UNINITIALIZED_UNSPECIFIED; + case 1: + case 'DATA_TYPE_CLIENT_STATE': + return DataType.DATA_TYPE_CLIENT_STATE; + case 2: + case 'DATA_TYPE_CONSENSUS_STATE': + return DataType.DATA_TYPE_CONSENSUS_STATE; + case 3: + case 'DATA_TYPE_CONNECTION_STATE': + return DataType.DATA_TYPE_CONNECTION_STATE; + case 4: + case 'DATA_TYPE_CHANNEL_STATE': + return DataType.DATA_TYPE_CHANNEL_STATE; + case 5: + case 'DATA_TYPE_PACKET_COMMITMENT': + return DataType.DATA_TYPE_PACKET_COMMITMENT; + case 6: + case 'DATA_TYPE_PACKET_ACKNOWLEDGEMENT': + return DataType.DATA_TYPE_PACKET_ACKNOWLEDGEMENT; + case 7: + case 'DATA_TYPE_PACKET_RECEIPT_ABSENCE': + return DataType.DATA_TYPE_PACKET_RECEIPT_ABSENCE; + case 8: + case 'DATA_TYPE_NEXT_SEQUENCE_RECV': + return DataType.DATA_TYPE_NEXT_SEQUENCE_RECV; + case 9: + case 'DATA_TYPE_HEADER': + return DataType.DATA_TYPE_HEADER; + case -1: + case 'UNRECOGNIZED': + default: + return DataType.UNRECOGNIZED; + } +} +export function dataTypeToJSON(object: DataType): string { + switch (object) { + case DataType.DATA_TYPE_UNINITIALIZED_UNSPECIFIED: + return 'DATA_TYPE_UNINITIALIZED_UNSPECIFIED'; + case DataType.DATA_TYPE_CLIENT_STATE: + return 'DATA_TYPE_CLIENT_STATE'; + case DataType.DATA_TYPE_CONSENSUS_STATE: + return 'DATA_TYPE_CONSENSUS_STATE'; + case DataType.DATA_TYPE_CONNECTION_STATE: + return 'DATA_TYPE_CONNECTION_STATE'; + case DataType.DATA_TYPE_CHANNEL_STATE: + return 'DATA_TYPE_CHANNEL_STATE'; + case DataType.DATA_TYPE_PACKET_COMMITMENT: + return 'DATA_TYPE_PACKET_COMMITMENT'; + case DataType.DATA_TYPE_PACKET_ACKNOWLEDGEMENT: + return 'DATA_TYPE_PACKET_ACKNOWLEDGEMENT'; + case DataType.DATA_TYPE_PACKET_RECEIPT_ABSENCE: + return 'DATA_TYPE_PACKET_RECEIPT_ABSENCE'; + case DataType.DATA_TYPE_NEXT_SEQUENCE_RECV: + return 'DATA_TYPE_NEXT_SEQUENCE_RECV'; + case DataType.DATA_TYPE_HEADER: + return 'DATA_TYPE_HEADER'; + case DataType.UNRECOGNIZED: + default: + return 'UNRECOGNIZED'; + } +} +/** + * ClientState defines a solo machine client that tracks the current consensus + * state and if the client is frozen. + */ +export interface ClientState { + /** latest sequence of the client state */ + sequence: bigint; + /** frozen sequence of the solo machine */ + frozenSequence: bigint; + consensusState?: ConsensusState; + /** + * when set to true, will allow governance to update a solo machine client. + * The client will be unfrozen if it is frozen. + */ + allowUpdateAfterProposal: boolean; +} +export interface ClientStateProtoMsg { + typeUrl: '/ibc.lightclients.solomachine.v1.ClientState'; + value: Uint8Array; +} +/** + * ClientState defines a solo machine client that tracks the current consensus + * state and if the client is frozen. + */ +export interface ClientStateSDKType { + sequence: bigint; + frozen_sequence: bigint; + consensus_state?: ConsensusStateSDKType; + allow_update_after_proposal: boolean; +} +/** + * ConsensusState defines a solo machine consensus state. The sequence of a + * consensus state is contained in the "height" key used in storing the + * consensus state. + */ +export interface ConsensusState { + /** public key of the solo machine */ + publicKey?: Any; + /** + * diversifier allows the same public key to be re-used across different solo + * machine clients (potentially on different chains) without being considered + * misbehaviour. + */ + diversifier: string; + timestamp: bigint; +} +export interface ConsensusStateProtoMsg { + typeUrl: '/ibc.lightclients.solomachine.v1.ConsensusState'; + value: Uint8Array; +} +/** + * ConsensusState defines a solo machine consensus state. The sequence of a + * consensus state is contained in the "height" key used in storing the + * consensus state. + */ +export interface ConsensusStateSDKType { + public_key?: AnySDKType; + diversifier: string; + timestamp: bigint; +} +/** Header defines a solo machine consensus header */ +export interface Header { + /** sequence to update solo machine public key at */ + sequence: bigint; + timestamp: bigint; + signature: Uint8Array; + newPublicKey?: Any; + newDiversifier: string; +} +export interface HeaderProtoMsg { + typeUrl: '/ibc.lightclients.solomachine.v1.Header'; + value: Uint8Array; +} +/** Header defines a solo machine consensus header */ +export interface HeaderSDKType { + sequence: bigint; + timestamp: bigint; + signature: Uint8Array; + new_public_key?: AnySDKType; + new_diversifier: string; +} +/** + * Misbehaviour defines misbehaviour for a solo machine which consists + * of a sequence and two signatures over different messages at that sequence. + */ +export interface Misbehaviour { + clientId: string; + sequence: bigint; + signatureOne?: SignatureAndData; + signatureTwo?: SignatureAndData; +} +export interface MisbehaviourProtoMsg { + typeUrl: '/ibc.lightclients.solomachine.v1.Misbehaviour'; + value: Uint8Array; +} +/** + * Misbehaviour defines misbehaviour for a solo machine which consists + * of a sequence and two signatures over different messages at that sequence. + */ +export interface MisbehaviourSDKType { + client_id: string; + sequence: bigint; + signature_one?: SignatureAndDataSDKType; + signature_two?: SignatureAndDataSDKType; +} +/** + * SignatureAndData contains a signature and the data signed over to create that + * signature. + */ +export interface SignatureAndData { + signature: Uint8Array; + dataType: DataType; + data: Uint8Array; + timestamp: bigint; +} +export interface SignatureAndDataProtoMsg { + typeUrl: '/ibc.lightclients.solomachine.v1.SignatureAndData'; + value: Uint8Array; +} +/** + * SignatureAndData contains a signature and the data signed over to create that + * signature. + */ +export interface SignatureAndDataSDKType { + signature: Uint8Array; + data_type: DataType; + data: Uint8Array; + timestamp: bigint; +} +/** + * TimestampedSignatureData contains the signature data and the timestamp of the + * signature. + */ +export interface TimestampedSignatureData { + signatureData: Uint8Array; + timestamp: bigint; +} +export interface TimestampedSignatureDataProtoMsg { + typeUrl: '/ibc.lightclients.solomachine.v1.TimestampedSignatureData'; + value: Uint8Array; +} +/** + * TimestampedSignatureData contains the signature data and the timestamp of the + * signature. + */ +export interface TimestampedSignatureDataSDKType { + signature_data: Uint8Array; + timestamp: bigint; +} +/** SignBytes defines the signed bytes used for signature verification. */ +export interface SignBytes { + sequence: bigint; + timestamp: bigint; + diversifier: string; + /** type of the data used */ + dataType: DataType; + /** marshaled data */ + data: Uint8Array; +} +export interface SignBytesProtoMsg { + typeUrl: '/ibc.lightclients.solomachine.v1.SignBytes'; + value: Uint8Array; +} +/** SignBytes defines the signed bytes used for signature verification. */ +export interface SignBytesSDKType { + sequence: bigint; + timestamp: bigint; + diversifier: string; + data_type: DataType; + data: Uint8Array; +} +/** HeaderData returns the SignBytes data for update verification. */ +export interface HeaderData { + /** header public key */ + newPubKey?: Any; + /** header diversifier */ + newDiversifier: string; +} +export interface HeaderDataProtoMsg { + typeUrl: '/ibc.lightclients.solomachine.v1.HeaderData'; + value: Uint8Array; +} +/** HeaderData returns the SignBytes data for update verification. */ +export interface HeaderDataSDKType { + new_pub_key?: AnySDKType; + new_diversifier: string; +} +/** ClientStateData returns the SignBytes data for client state verification. */ +export interface ClientStateData { + path: Uint8Array; + clientState?: Any; +} +export interface ClientStateDataProtoMsg { + typeUrl: '/ibc.lightclients.solomachine.v1.ClientStateData'; + value: Uint8Array; +} +/** ClientStateData returns the SignBytes data for client state verification. */ +export interface ClientStateDataSDKType { + path: Uint8Array; + client_state?: AnySDKType; +} +/** + * ConsensusStateData returns the SignBytes data for consensus state + * verification. + */ +export interface ConsensusStateData { + path: Uint8Array; + consensusState?: Any; +} +export interface ConsensusStateDataProtoMsg { + typeUrl: '/ibc.lightclients.solomachine.v1.ConsensusStateData'; + value: Uint8Array; +} +/** + * ConsensusStateData returns the SignBytes data for consensus state + * verification. + */ +export interface ConsensusStateDataSDKType { + path: Uint8Array; + consensus_state?: AnySDKType; +} +/** + * ConnectionStateData returns the SignBytes data for connection state + * verification. + */ +export interface ConnectionStateData { + path: Uint8Array; + connection?: ConnectionEnd; +} +export interface ConnectionStateDataProtoMsg { + typeUrl: '/ibc.lightclients.solomachine.v1.ConnectionStateData'; + value: Uint8Array; +} +/** + * ConnectionStateData returns the SignBytes data for connection state + * verification. + */ +export interface ConnectionStateDataSDKType { + path: Uint8Array; + connection?: ConnectionEndSDKType; +} +/** + * ChannelStateData returns the SignBytes data for channel state + * verification. + */ +export interface ChannelStateData { + path: Uint8Array; + channel?: Channel; +} +export interface ChannelStateDataProtoMsg { + typeUrl: '/ibc.lightclients.solomachine.v1.ChannelStateData'; + value: Uint8Array; +} +/** + * ChannelStateData returns the SignBytes data for channel state + * verification. + */ +export interface ChannelStateDataSDKType { + path: Uint8Array; + channel?: ChannelSDKType; +} +/** + * PacketCommitmentData returns the SignBytes data for packet commitment + * verification. + */ +export interface PacketCommitmentData { + path: Uint8Array; + commitment: Uint8Array; +} +export interface PacketCommitmentDataProtoMsg { + typeUrl: '/ibc.lightclients.solomachine.v1.PacketCommitmentData'; + value: Uint8Array; +} +/** + * PacketCommitmentData returns the SignBytes data for packet commitment + * verification. + */ +export interface PacketCommitmentDataSDKType { + path: Uint8Array; + commitment: Uint8Array; +} +/** + * PacketAcknowledgementData returns the SignBytes data for acknowledgement + * verification. + */ +export interface PacketAcknowledgementData { + path: Uint8Array; + acknowledgement: Uint8Array; +} +export interface PacketAcknowledgementDataProtoMsg { + typeUrl: '/ibc.lightclients.solomachine.v1.PacketAcknowledgementData'; + value: Uint8Array; +} +/** + * PacketAcknowledgementData returns the SignBytes data for acknowledgement + * verification. + */ +export interface PacketAcknowledgementDataSDKType { + path: Uint8Array; + acknowledgement: Uint8Array; +} +/** + * PacketReceiptAbsenceData returns the SignBytes data for + * packet receipt absence verification. + */ +export interface PacketReceiptAbsenceData { + path: Uint8Array; +} +export interface PacketReceiptAbsenceDataProtoMsg { + typeUrl: '/ibc.lightclients.solomachine.v1.PacketReceiptAbsenceData'; + value: Uint8Array; +} +/** + * PacketReceiptAbsenceData returns the SignBytes data for + * packet receipt absence verification. + */ +export interface PacketReceiptAbsenceDataSDKType { + path: Uint8Array; +} +/** + * NextSequenceRecvData returns the SignBytes data for verification of the next + * sequence to be received. + */ +export interface NextSequenceRecvData { + path: Uint8Array; + nextSeqRecv: bigint; +} +export interface NextSequenceRecvDataProtoMsg { + typeUrl: '/ibc.lightclients.solomachine.v1.NextSequenceRecvData'; + value: Uint8Array; +} +/** + * NextSequenceRecvData returns the SignBytes data for verification of the next + * sequence to be received. + */ +export interface NextSequenceRecvDataSDKType { + path: Uint8Array; + next_seq_recv: bigint; +} +function createBaseClientState(): ClientState { + return { + sequence: BigInt(0), + frozenSequence: BigInt(0), + consensusState: undefined, + allowUpdateAfterProposal: false, + }; +} +export const ClientState = { + typeUrl: '/ibc.lightclients.solomachine.v1.ClientState', + encode( + message: ClientState, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.sequence !== BigInt(0)) { + writer.uint32(8).uint64(message.sequence); + } + if (message.frozenSequence !== BigInt(0)) { + writer.uint32(16).uint64(message.frozenSequence); + } + if (message.consensusState !== undefined) { + ConsensusState.encode( + message.consensusState, + writer.uint32(26).fork(), + ).ldelim(); + } + if (message.allowUpdateAfterProposal === true) { + writer.uint32(32).bool(message.allowUpdateAfterProposal); + } + 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.sequence = reader.uint64(); + break; + case 2: + message.frozenSequence = reader.uint64(); + break; + case 3: + message.consensusState = ConsensusState.decode( + reader, + reader.uint32(), + ); + break; + case 4: + message.allowUpdateAfterProposal = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): ClientState { + return { + sequence: isSet(object.sequence) + ? BigInt(object.sequence.toString()) + : BigInt(0), + frozenSequence: isSet(object.frozenSequence) + ? BigInt(object.frozenSequence.toString()) + : BigInt(0), + consensusState: isSet(object.consensusState) + ? ConsensusState.fromJSON(object.consensusState) + : undefined, + allowUpdateAfterProposal: isSet(object.allowUpdateAfterProposal) + ? Boolean(object.allowUpdateAfterProposal) + : false, + }; + }, + toJSON(message: ClientState): unknown { + const obj: any = {}; + message.sequence !== undefined && + (obj.sequence = (message.sequence || BigInt(0)).toString()); + message.frozenSequence !== undefined && + (obj.frozenSequence = (message.frozenSequence || BigInt(0)).toString()); + message.consensusState !== undefined && + (obj.consensusState = message.consensusState + ? ConsensusState.toJSON(message.consensusState) + : undefined); + message.allowUpdateAfterProposal !== undefined && + (obj.allowUpdateAfterProposal = message.allowUpdateAfterProposal); + return obj; + }, + fromPartial(object: Partial): ClientState { + const message = createBaseClientState(); + message.sequence = + object.sequence !== undefined && object.sequence !== null + ? BigInt(object.sequence.toString()) + : BigInt(0); + message.frozenSequence = + object.frozenSequence !== undefined && object.frozenSequence !== null + ? BigInt(object.frozenSequence.toString()) + : BigInt(0); + message.consensusState = + object.consensusState !== undefined && object.consensusState !== null + ? ConsensusState.fromPartial(object.consensusState) + : undefined; + message.allowUpdateAfterProposal = object.allowUpdateAfterProposal ?? false; + return message; + }, + fromProtoMsg(message: ClientStateProtoMsg): ClientState { + return ClientState.decode(message.value); + }, + toProto(message: ClientState): Uint8Array { + return ClientState.encode(message).finish(); + }, + toProtoMsg(message: ClientState): ClientStateProtoMsg { + return { + typeUrl: '/ibc.lightclients.solomachine.v1.ClientState', + value: ClientState.encode(message).finish(), + }; + }, +}; +function createBaseConsensusState(): ConsensusState { + return { + publicKey: undefined, + diversifier: '', + timestamp: BigInt(0), + }; +} +export const ConsensusState = { + typeUrl: '/ibc.lightclients.solomachine.v1.ConsensusState', + encode( + message: ConsensusState, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.publicKey !== undefined) { + Any.encode(message.publicKey, writer.uint32(10).fork()).ldelim(); + } + if (message.diversifier !== '') { + writer.uint32(18).string(message.diversifier); + } + if (message.timestamp !== BigInt(0)) { + writer.uint32(24).uint64(message.timestamp); + } + 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.publicKey = Any.decode(reader, reader.uint32()); + break; + case 2: + message.diversifier = reader.string(); + break; + case 3: + message.timestamp = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): ConsensusState { + return { + publicKey: isSet(object.publicKey) + ? Any.fromJSON(object.publicKey) + : undefined, + diversifier: isSet(object.diversifier) ? String(object.diversifier) : '', + timestamp: isSet(object.timestamp) + ? BigInt(object.timestamp.toString()) + : BigInt(0), + }; + }, + toJSON(message: ConsensusState): unknown { + const obj: any = {}; + message.publicKey !== undefined && + (obj.publicKey = message.publicKey + ? Any.toJSON(message.publicKey) + : undefined); + message.diversifier !== undefined && + (obj.diversifier = message.diversifier); + message.timestamp !== undefined && + (obj.timestamp = (message.timestamp || BigInt(0)).toString()); + return obj; + }, + fromPartial(object: Partial): ConsensusState { + const message = createBaseConsensusState(); + message.publicKey = + object.publicKey !== undefined && object.publicKey !== null + ? Any.fromPartial(object.publicKey) + : undefined; + message.diversifier = object.diversifier ?? ''; + message.timestamp = + object.timestamp !== undefined && object.timestamp !== null + ? BigInt(object.timestamp.toString()) + : BigInt(0); + return message; + }, + fromProtoMsg(message: ConsensusStateProtoMsg): ConsensusState { + return ConsensusState.decode(message.value); + }, + toProto(message: ConsensusState): Uint8Array { + return ConsensusState.encode(message).finish(); + }, + toProtoMsg(message: ConsensusState): ConsensusStateProtoMsg { + return { + typeUrl: '/ibc.lightclients.solomachine.v1.ConsensusState', + value: ConsensusState.encode(message).finish(), + }; + }, +}; +function createBaseHeader(): Header { + return { + sequence: BigInt(0), + timestamp: BigInt(0), + signature: new Uint8Array(), + newPublicKey: undefined, + newDiversifier: '', + }; +} +export const Header = { + typeUrl: '/ibc.lightclients.solomachine.v1.Header', + encode( + message: Header, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.sequence !== BigInt(0)) { + writer.uint32(8).uint64(message.sequence); + } + if (message.timestamp !== BigInt(0)) { + writer.uint32(16).uint64(message.timestamp); + } + if (message.signature.length !== 0) { + writer.uint32(26).bytes(message.signature); + } + if (message.newPublicKey !== undefined) { + Any.encode(message.newPublicKey, writer.uint32(34).fork()).ldelim(); + } + if (message.newDiversifier !== '') { + writer.uint32(42).string(message.newDiversifier); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Header { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHeader(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sequence = reader.uint64(); + break; + case 2: + message.timestamp = reader.uint64(); + break; + case 3: + message.signature = reader.bytes(); + break; + case 4: + message.newPublicKey = Any.decode(reader, reader.uint32()); + break; + case 5: + message.newDiversifier = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): Header { + return { + sequence: isSet(object.sequence) + ? BigInt(object.sequence.toString()) + : BigInt(0), + timestamp: isSet(object.timestamp) + ? BigInt(object.timestamp.toString()) + : BigInt(0), + signature: isSet(object.signature) + ? bytesFromBase64(object.signature) + : new Uint8Array(), + newPublicKey: isSet(object.newPublicKey) + ? Any.fromJSON(object.newPublicKey) + : undefined, + newDiversifier: isSet(object.newDiversifier) + ? String(object.newDiversifier) + : '', + }; + }, + toJSON(message: Header): unknown { + const obj: any = {}; + message.sequence !== undefined && + (obj.sequence = (message.sequence || BigInt(0)).toString()); + message.timestamp !== undefined && + (obj.timestamp = (message.timestamp || BigInt(0)).toString()); + message.signature !== undefined && + (obj.signature = base64FromBytes( + message.signature !== undefined ? message.signature : new Uint8Array(), + )); + message.newPublicKey !== undefined && + (obj.newPublicKey = message.newPublicKey + ? Any.toJSON(message.newPublicKey) + : undefined); + message.newDiversifier !== undefined && + (obj.newDiversifier = message.newDiversifier); + return obj; + }, + fromPartial(object: Partial
): Header { + const message = createBaseHeader(); + message.sequence = + object.sequence !== undefined && object.sequence !== null + ? BigInt(object.sequence.toString()) + : BigInt(0); + message.timestamp = + object.timestamp !== undefined && object.timestamp !== null + ? BigInt(object.timestamp.toString()) + : BigInt(0); + message.signature = object.signature ?? new Uint8Array(); + message.newPublicKey = + object.newPublicKey !== undefined && object.newPublicKey !== null + ? Any.fromPartial(object.newPublicKey) + : undefined; + message.newDiversifier = object.newDiversifier ?? ''; + return message; + }, + fromProtoMsg(message: HeaderProtoMsg): Header { + return Header.decode(message.value); + }, + toProto(message: Header): Uint8Array { + return Header.encode(message).finish(); + }, + toProtoMsg(message: Header): HeaderProtoMsg { + return { + typeUrl: '/ibc.lightclients.solomachine.v1.Header', + value: Header.encode(message).finish(), + }; + }, +}; +function createBaseMisbehaviour(): Misbehaviour { + return { + clientId: '', + sequence: BigInt(0), + signatureOne: undefined, + signatureTwo: undefined, + }; +} +export const Misbehaviour = { + typeUrl: '/ibc.lightclients.solomachine.v1.Misbehaviour', + encode( + message: Misbehaviour, + 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.signatureOne !== undefined) { + SignatureAndData.encode( + message.signatureOne, + writer.uint32(26).fork(), + ).ldelim(); + } + if (message.signatureTwo !== undefined) { + SignatureAndData.encode( + message.signatureTwo, + writer.uint32(34).fork(), + ).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Misbehaviour { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMisbehaviour(); + 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.signatureOne = SignatureAndData.decode( + reader, + reader.uint32(), + ); + break; + case 4: + message.signatureTwo = SignatureAndData.decode( + reader, + reader.uint32(), + ); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): Misbehaviour { + return { + clientId: isSet(object.clientId) ? String(object.clientId) : '', + sequence: isSet(object.sequence) + ? BigInt(object.sequence.toString()) + : BigInt(0), + signatureOne: isSet(object.signatureOne) + ? SignatureAndData.fromJSON(object.signatureOne) + : undefined, + signatureTwo: isSet(object.signatureTwo) + ? SignatureAndData.fromJSON(object.signatureTwo) + : undefined, + }; + }, + toJSON(message: Misbehaviour): unknown { + const obj: any = {}; + message.clientId !== undefined && (obj.clientId = message.clientId); + message.sequence !== undefined && + (obj.sequence = (message.sequence || BigInt(0)).toString()); + message.signatureOne !== undefined && + (obj.signatureOne = message.signatureOne + ? SignatureAndData.toJSON(message.signatureOne) + : undefined); + message.signatureTwo !== undefined && + (obj.signatureTwo = message.signatureTwo + ? SignatureAndData.toJSON(message.signatureTwo) + : undefined); + return obj; + }, + fromPartial(object: Partial): Misbehaviour { + const message = createBaseMisbehaviour(); + message.clientId = object.clientId ?? ''; + message.sequence = + object.sequence !== undefined && object.sequence !== null + ? BigInt(object.sequence.toString()) + : BigInt(0); + message.signatureOne = + object.signatureOne !== undefined && object.signatureOne !== null + ? SignatureAndData.fromPartial(object.signatureOne) + : undefined; + message.signatureTwo = + object.signatureTwo !== undefined && object.signatureTwo !== null + ? SignatureAndData.fromPartial(object.signatureTwo) + : undefined; + return message; + }, + fromProtoMsg(message: MisbehaviourProtoMsg): Misbehaviour { + return Misbehaviour.decode(message.value); + }, + toProto(message: Misbehaviour): Uint8Array { + return Misbehaviour.encode(message).finish(); + }, + toProtoMsg(message: Misbehaviour): MisbehaviourProtoMsg { + return { + typeUrl: '/ibc.lightclients.solomachine.v1.Misbehaviour', + value: Misbehaviour.encode(message).finish(), + }; + }, +}; +function createBaseSignatureAndData(): SignatureAndData { + return { + signature: new Uint8Array(), + dataType: 0, + data: new Uint8Array(), + timestamp: BigInt(0), + }; +} +export const SignatureAndData = { + typeUrl: '/ibc.lightclients.solomachine.v1.SignatureAndData', + encode( + message: SignatureAndData, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.signature.length !== 0) { + writer.uint32(10).bytes(message.signature); + } + if (message.dataType !== 0) { + writer.uint32(16).int32(message.dataType); + } + if (message.data.length !== 0) { + writer.uint32(26).bytes(message.data); + } + if (message.timestamp !== BigInt(0)) { + writer.uint32(32).uint64(message.timestamp); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SignatureAndData { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignatureAndData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.signature = reader.bytes(); + break; + case 2: + message.dataType = reader.int32() as any; + break; + case 3: + message.data = reader.bytes(); + break; + case 4: + message.timestamp = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): SignatureAndData { + return { + signature: isSet(object.signature) + ? bytesFromBase64(object.signature) + : new Uint8Array(), + dataType: isSet(object.dataType) ? dataTypeFromJSON(object.dataType) : -1, + data: isSet(object.data) + ? bytesFromBase64(object.data) + : new Uint8Array(), + timestamp: isSet(object.timestamp) + ? BigInt(object.timestamp.toString()) + : BigInt(0), + }; + }, + toJSON(message: SignatureAndData): unknown { + const obj: any = {}; + message.signature !== undefined && + (obj.signature = base64FromBytes( + message.signature !== undefined ? message.signature : new Uint8Array(), + )); + message.dataType !== undefined && + (obj.dataType = dataTypeToJSON(message.dataType)); + message.data !== undefined && + (obj.data = base64FromBytes( + message.data !== undefined ? message.data : new Uint8Array(), + )); + message.timestamp !== undefined && + (obj.timestamp = (message.timestamp || BigInt(0)).toString()); + return obj; + }, + fromPartial(object: Partial): SignatureAndData { + const message = createBaseSignatureAndData(); + message.signature = object.signature ?? new Uint8Array(); + message.dataType = object.dataType ?? 0; + message.data = object.data ?? new Uint8Array(); + message.timestamp = + object.timestamp !== undefined && object.timestamp !== null + ? BigInt(object.timestamp.toString()) + : BigInt(0); + return message; + }, + fromProtoMsg(message: SignatureAndDataProtoMsg): SignatureAndData { + return SignatureAndData.decode(message.value); + }, + toProto(message: SignatureAndData): Uint8Array { + return SignatureAndData.encode(message).finish(); + }, + toProtoMsg(message: SignatureAndData): SignatureAndDataProtoMsg { + return { + typeUrl: '/ibc.lightclients.solomachine.v1.SignatureAndData', + value: SignatureAndData.encode(message).finish(), + }; + }, +}; +function createBaseTimestampedSignatureData(): TimestampedSignatureData { + return { + signatureData: new Uint8Array(), + timestamp: BigInt(0), + }; +} +export const TimestampedSignatureData = { + typeUrl: '/ibc.lightclients.solomachine.v1.TimestampedSignatureData', + encode( + message: TimestampedSignatureData, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.signatureData.length !== 0) { + writer.uint32(10).bytes(message.signatureData); + } + if (message.timestamp !== BigInt(0)) { + writer.uint32(16).uint64(message.timestamp); + } + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): TimestampedSignatureData { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTimestampedSignatureData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.signatureData = reader.bytes(); + break; + case 2: + message.timestamp = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): TimestampedSignatureData { + return { + signatureData: isSet(object.signatureData) + ? bytesFromBase64(object.signatureData) + : new Uint8Array(), + timestamp: isSet(object.timestamp) + ? BigInt(object.timestamp.toString()) + : BigInt(0), + }; + }, + toJSON(message: TimestampedSignatureData): unknown { + const obj: any = {}; + message.signatureData !== undefined && + (obj.signatureData = base64FromBytes( + message.signatureData !== undefined + ? message.signatureData + : new Uint8Array(), + )); + message.timestamp !== undefined && + (obj.timestamp = (message.timestamp || BigInt(0)).toString()); + return obj; + }, + fromPartial( + object: Partial, + ): TimestampedSignatureData { + const message = createBaseTimestampedSignatureData(); + message.signatureData = object.signatureData ?? new Uint8Array(); + message.timestamp = + object.timestamp !== undefined && object.timestamp !== null + ? BigInt(object.timestamp.toString()) + : BigInt(0); + return message; + }, + fromProtoMsg( + message: TimestampedSignatureDataProtoMsg, + ): TimestampedSignatureData { + return TimestampedSignatureData.decode(message.value); + }, + toProto(message: TimestampedSignatureData): Uint8Array { + return TimestampedSignatureData.encode(message).finish(); + }, + toProtoMsg( + message: TimestampedSignatureData, + ): TimestampedSignatureDataProtoMsg { + return { + typeUrl: '/ibc.lightclients.solomachine.v1.TimestampedSignatureData', + value: TimestampedSignatureData.encode(message).finish(), + }; + }, +}; +function createBaseSignBytes(): SignBytes { + return { + sequence: BigInt(0), + timestamp: BigInt(0), + diversifier: '', + dataType: 0, + data: new Uint8Array(), + }; +} +export const SignBytes = { + typeUrl: '/ibc.lightclients.solomachine.v1.SignBytes', + encode( + message: SignBytes, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.sequence !== BigInt(0)) { + writer.uint32(8).uint64(message.sequence); + } + if (message.timestamp !== BigInt(0)) { + writer.uint32(16).uint64(message.timestamp); + } + if (message.diversifier !== '') { + writer.uint32(26).string(message.diversifier); + } + if (message.dataType !== 0) { + writer.uint32(32).int32(message.dataType); + } + if (message.data.length !== 0) { + writer.uint32(42).bytes(message.data); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SignBytes { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignBytes(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sequence = reader.uint64(); + break; + case 2: + message.timestamp = reader.uint64(); + break; + case 3: + message.diversifier = reader.string(); + break; + case 4: + message.dataType = reader.int32() as any; + break; + case 5: + message.data = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): SignBytes { + return { + sequence: isSet(object.sequence) + ? BigInt(object.sequence.toString()) + : BigInt(0), + timestamp: isSet(object.timestamp) + ? BigInt(object.timestamp.toString()) + : BigInt(0), + diversifier: isSet(object.diversifier) ? String(object.diversifier) : '', + dataType: isSet(object.dataType) ? dataTypeFromJSON(object.dataType) : -1, + data: isSet(object.data) + ? bytesFromBase64(object.data) + : new Uint8Array(), + }; + }, + toJSON(message: SignBytes): unknown { + const obj: any = {}; + message.sequence !== undefined && + (obj.sequence = (message.sequence || BigInt(0)).toString()); + message.timestamp !== undefined && + (obj.timestamp = (message.timestamp || BigInt(0)).toString()); + message.diversifier !== undefined && + (obj.diversifier = message.diversifier); + message.dataType !== undefined && + (obj.dataType = dataTypeToJSON(message.dataType)); + message.data !== undefined && + (obj.data = base64FromBytes( + message.data !== undefined ? message.data : new Uint8Array(), + )); + return obj; + }, + fromPartial(object: Partial): SignBytes { + const message = createBaseSignBytes(); + message.sequence = + object.sequence !== undefined && object.sequence !== null + ? BigInt(object.sequence.toString()) + : BigInt(0); + message.timestamp = + object.timestamp !== undefined && object.timestamp !== null + ? BigInt(object.timestamp.toString()) + : BigInt(0); + message.diversifier = object.diversifier ?? ''; + message.dataType = object.dataType ?? 0; + message.data = object.data ?? new Uint8Array(); + return message; + }, + fromProtoMsg(message: SignBytesProtoMsg): SignBytes { + return SignBytes.decode(message.value); + }, + toProto(message: SignBytes): Uint8Array { + return SignBytes.encode(message).finish(); + }, + toProtoMsg(message: SignBytes): SignBytesProtoMsg { + return { + typeUrl: '/ibc.lightclients.solomachine.v1.SignBytes', + value: SignBytes.encode(message).finish(), + }; + }, +}; +function createBaseHeaderData(): HeaderData { + return { + newPubKey: undefined, + newDiversifier: '', + }; +} +export const HeaderData = { + typeUrl: '/ibc.lightclients.solomachine.v1.HeaderData', + encode( + message: HeaderData, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.newPubKey !== undefined) { + Any.encode(message.newPubKey, writer.uint32(10).fork()).ldelim(); + } + if (message.newDiversifier !== '') { + writer.uint32(18).string(message.newDiversifier); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): HeaderData { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHeaderData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.newPubKey = Any.decode(reader, reader.uint32()); + break; + case 2: + message.newDiversifier = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): HeaderData { + return { + newPubKey: isSet(object.newPubKey) + ? Any.fromJSON(object.newPubKey) + : undefined, + newDiversifier: isSet(object.newDiversifier) + ? String(object.newDiversifier) + : '', + }; + }, + toJSON(message: HeaderData): unknown { + const obj: any = {}; + message.newPubKey !== undefined && + (obj.newPubKey = message.newPubKey + ? Any.toJSON(message.newPubKey) + : undefined); + message.newDiversifier !== undefined && + (obj.newDiversifier = message.newDiversifier); + return obj; + }, + fromPartial(object: Partial): HeaderData { + const message = createBaseHeaderData(); + message.newPubKey = + object.newPubKey !== undefined && object.newPubKey !== null + ? Any.fromPartial(object.newPubKey) + : undefined; + message.newDiversifier = object.newDiversifier ?? ''; + return message; + }, + fromProtoMsg(message: HeaderDataProtoMsg): HeaderData { + return HeaderData.decode(message.value); + }, + toProto(message: HeaderData): Uint8Array { + return HeaderData.encode(message).finish(); + }, + toProtoMsg(message: HeaderData): HeaderDataProtoMsg { + return { + typeUrl: '/ibc.lightclients.solomachine.v1.HeaderData', + value: HeaderData.encode(message).finish(), + }; + }, +}; +function createBaseClientStateData(): ClientStateData { + return { + path: new Uint8Array(), + clientState: undefined, + }; +} +export const ClientStateData = { + typeUrl: '/ibc.lightclients.solomachine.v1.ClientStateData', + encode( + message: ClientStateData, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.path.length !== 0) { + writer.uint32(10).bytes(message.path); + } + if (message.clientState !== undefined) { + Any.encode(message.clientState, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ClientStateData { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClientStateData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.path = reader.bytes(); + break; + case 2: + message.clientState = Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): ClientStateData { + return { + path: isSet(object.path) + ? bytesFromBase64(object.path) + : new Uint8Array(), + clientState: isSet(object.clientState) + ? Any.fromJSON(object.clientState) + : undefined, + }; + }, + toJSON(message: ClientStateData): unknown { + const obj: any = {}; + message.path !== undefined && + (obj.path = base64FromBytes( + message.path !== undefined ? message.path : new Uint8Array(), + )); + message.clientState !== undefined && + (obj.clientState = message.clientState + ? Any.toJSON(message.clientState) + : undefined); + return obj; + }, + fromPartial(object: Partial): ClientStateData { + const message = createBaseClientStateData(); + message.path = object.path ?? new Uint8Array(); + message.clientState = + object.clientState !== undefined && object.clientState !== null + ? Any.fromPartial(object.clientState) + : undefined; + return message; + }, + fromProtoMsg(message: ClientStateDataProtoMsg): ClientStateData { + return ClientStateData.decode(message.value); + }, + toProto(message: ClientStateData): Uint8Array { + return ClientStateData.encode(message).finish(); + }, + toProtoMsg(message: ClientStateData): ClientStateDataProtoMsg { + return { + typeUrl: '/ibc.lightclients.solomachine.v1.ClientStateData', + value: ClientStateData.encode(message).finish(), + }; + }, +}; +function createBaseConsensusStateData(): ConsensusStateData { + return { + path: new Uint8Array(), + consensusState: undefined, + }; +} +export const ConsensusStateData = { + typeUrl: '/ibc.lightclients.solomachine.v1.ConsensusStateData', + encode( + message: ConsensusStateData, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.path.length !== 0) { + writer.uint32(10).bytes(message.path); + } + if (message.consensusState !== undefined) { + Any.encode(message.consensusState, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): ConsensusStateData { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConsensusStateData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.path = reader.bytes(); + break; + case 2: + message.consensusState = Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): ConsensusStateData { + return { + path: isSet(object.path) + ? bytesFromBase64(object.path) + : new Uint8Array(), + consensusState: isSet(object.consensusState) + ? Any.fromJSON(object.consensusState) + : undefined, + }; + }, + toJSON(message: ConsensusStateData): unknown { + const obj: any = {}; + message.path !== undefined && + (obj.path = base64FromBytes( + message.path !== undefined ? message.path : new Uint8Array(), + )); + message.consensusState !== undefined && + (obj.consensusState = message.consensusState + ? Any.toJSON(message.consensusState) + : undefined); + return obj; + }, + fromPartial(object: Partial): ConsensusStateData { + const message = createBaseConsensusStateData(); + message.path = object.path ?? new Uint8Array(); + message.consensusState = + object.consensusState !== undefined && object.consensusState !== null + ? Any.fromPartial(object.consensusState) + : undefined; + return message; + }, + fromProtoMsg(message: ConsensusStateDataProtoMsg): ConsensusStateData { + return ConsensusStateData.decode(message.value); + }, + toProto(message: ConsensusStateData): Uint8Array { + return ConsensusStateData.encode(message).finish(); + }, + toProtoMsg(message: ConsensusStateData): ConsensusStateDataProtoMsg { + return { + typeUrl: '/ibc.lightclients.solomachine.v1.ConsensusStateData', + value: ConsensusStateData.encode(message).finish(), + }; + }, +}; +function createBaseConnectionStateData(): ConnectionStateData { + return { + path: new Uint8Array(), + connection: undefined, + }; +} +export const ConnectionStateData = { + typeUrl: '/ibc.lightclients.solomachine.v1.ConnectionStateData', + encode( + message: ConnectionStateData, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.path.length !== 0) { + writer.uint32(10).bytes(message.path); + } + if (message.connection !== undefined) { + ConnectionEnd.encode( + message.connection, + writer.uint32(18).fork(), + ).ldelim(); + } + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): ConnectionStateData { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConnectionStateData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.path = reader.bytes(); + break; + case 2: + message.connection = ConnectionEnd.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): ConnectionStateData { + return { + path: isSet(object.path) + ? bytesFromBase64(object.path) + : new Uint8Array(), + connection: isSet(object.connection) + ? ConnectionEnd.fromJSON(object.connection) + : undefined, + }; + }, + toJSON(message: ConnectionStateData): unknown { + const obj: any = {}; + message.path !== undefined && + (obj.path = base64FromBytes( + message.path !== undefined ? message.path : new Uint8Array(), + )); + message.connection !== undefined && + (obj.connection = message.connection + ? ConnectionEnd.toJSON(message.connection) + : undefined); + return obj; + }, + fromPartial(object: Partial): ConnectionStateData { + const message = createBaseConnectionStateData(); + message.path = object.path ?? new Uint8Array(); + message.connection = + object.connection !== undefined && object.connection !== null + ? ConnectionEnd.fromPartial(object.connection) + : undefined; + return message; + }, + fromProtoMsg(message: ConnectionStateDataProtoMsg): ConnectionStateData { + return ConnectionStateData.decode(message.value); + }, + toProto(message: ConnectionStateData): Uint8Array { + return ConnectionStateData.encode(message).finish(); + }, + toProtoMsg(message: ConnectionStateData): ConnectionStateDataProtoMsg { + return { + typeUrl: '/ibc.lightclients.solomachine.v1.ConnectionStateData', + value: ConnectionStateData.encode(message).finish(), + }; + }, +}; +function createBaseChannelStateData(): ChannelStateData { + return { + path: new Uint8Array(), + channel: undefined, + }; +} +export const ChannelStateData = { + typeUrl: '/ibc.lightclients.solomachine.v1.ChannelStateData', + encode( + message: ChannelStateData, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.path.length !== 0) { + writer.uint32(10).bytes(message.path); + } + if (message.channel !== undefined) { + Channel.encode(message.channel, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ChannelStateData { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseChannelStateData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.path = reader.bytes(); + break; + case 2: + message.channel = Channel.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): ChannelStateData { + return { + path: isSet(object.path) + ? bytesFromBase64(object.path) + : new Uint8Array(), + channel: isSet(object.channel) + ? Channel.fromJSON(object.channel) + : undefined, + }; + }, + toJSON(message: ChannelStateData): unknown { + const obj: any = {}; + message.path !== undefined && + (obj.path = base64FromBytes( + message.path !== undefined ? message.path : new Uint8Array(), + )); + message.channel !== undefined && + (obj.channel = message.channel + ? Channel.toJSON(message.channel) + : undefined); + return obj; + }, + fromPartial(object: Partial): ChannelStateData { + const message = createBaseChannelStateData(); + message.path = object.path ?? new Uint8Array(); + message.channel = + object.channel !== undefined && object.channel !== null + ? Channel.fromPartial(object.channel) + : undefined; + return message; + }, + fromProtoMsg(message: ChannelStateDataProtoMsg): ChannelStateData { + return ChannelStateData.decode(message.value); + }, + toProto(message: ChannelStateData): Uint8Array { + return ChannelStateData.encode(message).finish(); + }, + toProtoMsg(message: ChannelStateData): ChannelStateDataProtoMsg { + return { + typeUrl: '/ibc.lightclients.solomachine.v1.ChannelStateData', + value: ChannelStateData.encode(message).finish(), + }; + }, +}; +function createBasePacketCommitmentData(): PacketCommitmentData { + return { + path: new Uint8Array(), + commitment: new Uint8Array(), + }; +} +export const PacketCommitmentData = { + typeUrl: '/ibc.lightclients.solomachine.v1.PacketCommitmentData', + encode( + message: PacketCommitmentData, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.path.length !== 0) { + writer.uint32(10).bytes(message.path); + } + if (message.commitment.length !== 0) { + writer.uint32(18).bytes(message.commitment); + } + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): PacketCommitmentData { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePacketCommitmentData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.path = reader.bytes(); + break; + case 2: + message.commitment = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): PacketCommitmentData { + return { + path: isSet(object.path) + ? bytesFromBase64(object.path) + : new Uint8Array(), + commitment: isSet(object.commitment) + ? bytesFromBase64(object.commitment) + : new Uint8Array(), + }; + }, + toJSON(message: PacketCommitmentData): unknown { + const obj: any = {}; + message.path !== undefined && + (obj.path = base64FromBytes( + message.path !== undefined ? message.path : new Uint8Array(), + )); + message.commitment !== undefined && + (obj.commitment = base64FromBytes( + message.commitment !== undefined + ? message.commitment + : new Uint8Array(), + )); + return obj; + }, + fromPartial(object: Partial): PacketCommitmentData { + const message = createBasePacketCommitmentData(); + message.path = object.path ?? new Uint8Array(); + message.commitment = object.commitment ?? new Uint8Array(); + return message; + }, + fromProtoMsg(message: PacketCommitmentDataProtoMsg): PacketCommitmentData { + return PacketCommitmentData.decode(message.value); + }, + toProto(message: PacketCommitmentData): Uint8Array { + return PacketCommitmentData.encode(message).finish(); + }, + toProtoMsg(message: PacketCommitmentData): PacketCommitmentDataProtoMsg { + return { + typeUrl: '/ibc.lightclients.solomachine.v1.PacketCommitmentData', + value: PacketCommitmentData.encode(message).finish(), + }; + }, +}; +function createBasePacketAcknowledgementData(): PacketAcknowledgementData { + return { + path: new Uint8Array(), + acknowledgement: new Uint8Array(), + }; +} +export const PacketAcknowledgementData = { + typeUrl: '/ibc.lightclients.solomachine.v1.PacketAcknowledgementData', + encode( + message: PacketAcknowledgementData, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.path.length !== 0) { + writer.uint32(10).bytes(message.path); + } + if (message.acknowledgement.length !== 0) { + writer.uint32(18).bytes(message.acknowledgement); + } + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): PacketAcknowledgementData { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePacketAcknowledgementData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.path = reader.bytes(); + break; + case 2: + message.acknowledgement = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): PacketAcknowledgementData { + return { + path: isSet(object.path) + ? bytesFromBase64(object.path) + : new Uint8Array(), + acknowledgement: isSet(object.acknowledgement) + ? bytesFromBase64(object.acknowledgement) + : new Uint8Array(), + }; + }, + toJSON(message: PacketAcknowledgementData): unknown { + const obj: any = {}; + message.path !== undefined && + (obj.path = base64FromBytes( + message.path !== undefined ? message.path : new Uint8Array(), + )); + message.acknowledgement !== undefined && + (obj.acknowledgement = base64FromBytes( + message.acknowledgement !== undefined + ? message.acknowledgement + : new Uint8Array(), + )); + return obj; + }, + fromPartial( + object: Partial, + ): PacketAcknowledgementData { + const message = createBasePacketAcknowledgementData(); + message.path = object.path ?? new Uint8Array(); + message.acknowledgement = object.acknowledgement ?? new Uint8Array(); + return message; + }, + fromProtoMsg( + message: PacketAcknowledgementDataProtoMsg, + ): PacketAcknowledgementData { + return PacketAcknowledgementData.decode(message.value); + }, + toProto(message: PacketAcknowledgementData): Uint8Array { + return PacketAcknowledgementData.encode(message).finish(); + }, + toProtoMsg( + message: PacketAcknowledgementData, + ): PacketAcknowledgementDataProtoMsg { + return { + typeUrl: '/ibc.lightclients.solomachine.v1.PacketAcknowledgementData', + value: PacketAcknowledgementData.encode(message).finish(), + }; + }, +}; +function createBasePacketReceiptAbsenceData(): PacketReceiptAbsenceData { + return { + path: new Uint8Array(), + }; +} +export const PacketReceiptAbsenceData = { + typeUrl: '/ibc.lightclients.solomachine.v1.PacketReceiptAbsenceData', + encode( + message: PacketReceiptAbsenceData, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.path.length !== 0) { + writer.uint32(10).bytes(message.path); + } + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): PacketReceiptAbsenceData { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePacketReceiptAbsenceData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.path = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): PacketReceiptAbsenceData { + return { + path: isSet(object.path) + ? bytesFromBase64(object.path) + : new Uint8Array(), + }; + }, + toJSON(message: PacketReceiptAbsenceData): unknown { + const obj: any = {}; + message.path !== undefined && + (obj.path = base64FromBytes( + message.path !== undefined ? message.path : new Uint8Array(), + )); + return obj; + }, + fromPartial( + object: Partial, + ): PacketReceiptAbsenceData { + const message = createBasePacketReceiptAbsenceData(); + message.path = object.path ?? new Uint8Array(); + return message; + }, + fromProtoMsg( + message: PacketReceiptAbsenceDataProtoMsg, + ): PacketReceiptAbsenceData { + return PacketReceiptAbsenceData.decode(message.value); + }, + toProto(message: PacketReceiptAbsenceData): Uint8Array { + return PacketReceiptAbsenceData.encode(message).finish(); + }, + toProtoMsg( + message: PacketReceiptAbsenceData, + ): PacketReceiptAbsenceDataProtoMsg { + return { + typeUrl: '/ibc.lightclients.solomachine.v1.PacketReceiptAbsenceData', + value: PacketReceiptAbsenceData.encode(message).finish(), + }; + }, +}; +function createBaseNextSequenceRecvData(): NextSequenceRecvData { + return { + path: new Uint8Array(), + nextSeqRecv: BigInt(0), + }; +} +export const NextSequenceRecvData = { + typeUrl: '/ibc.lightclients.solomachine.v1.NextSequenceRecvData', + encode( + message: NextSequenceRecvData, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.path.length !== 0) { + writer.uint32(10).bytes(message.path); + } + if (message.nextSeqRecv !== BigInt(0)) { + writer.uint32(16).uint64(message.nextSeqRecv); + } + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): NextSequenceRecvData { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNextSequenceRecvData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.path = reader.bytes(); + break; + case 2: + message.nextSeqRecv = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): NextSequenceRecvData { + return { + path: isSet(object.path) + ? bytesFromBase64(object.path) + : new Uint8Array(), + nextSeqRecv: isSet(object.nextSeqRecv) + ? BigInt(object.nextSeqRecv.toString()) + : BigInt(0), + }; + }, + toJSON(message: NextSequenceRecvData): unknown { + const obj: any = {}; + message.path !== undefined && + (obj.path = base64FromBytes( + message.path !== undefined ? message.path : new Uint8Array(), + )); + message.nextSeqRecv !== undefined && + (obj.nextSeqRecv = (message.nextSeqRecv || BigInt(0)).toString()); + return obj; + }, + fromPartial(object: Partial): NextSequenceRecvData { + const message = createBaseNextSequenceRecvData(); + message.path = object.path ?? new Uint8Array(); + message.nextSeqRecv = + object.nextSeqRecv !== undefined && object.nextSeqRecv !== null + ? BigInt(object.nextSeqRecv.toString()) + : BigInt(0); + return message; + }, + fromProtoMsg(message: NextSequenceRecvDataProtoMsg): NextSequenceRecvData { + return NextSequenceRecvData.decode(message.value); + }, + toProto(message: NextSequenceRecvData): Uint8Array { + return NextSequenceRecvData.encode(message).finish(); + }, + toProtoMsg(message: NextSequenceRecvData): NextSequenceRecvDataProtoMsg { + return { + typeUrl: '/ibc.lightclients.solomachine.v1.NextSequenceRecvData', + value: NextSequenceRecvData.encode(message).finish(), + }; + }, +}; diff --git a/packages/cosmic-proto/src/codegen/ibc/lightclients/solomachine/v2/solomachine.ts b/packages/cosmic-proto/src/codegen/ibc/lightclients/solomachine/v2/solomachine.ts new file mode 100644 index 00000000000..da66ebe1b48 --- /dev/null +++ b/packages/cosmic-proto/src/codegen/ibc/lightclients/solomachine/v2/solomachine.ts @@ -0,0 +1,2011 @@ +//@ts-nocheck +import { Any, AnySDKType } from '../../../../google/protobuf/any.js'; +import { + ConnectionEnd, + ConnectionEndSDKType, +} from '../../../core/connection/v1/connection.js'; +import { Channel, ChannelSDKType } from '../../../core/channel/v1/channel.js'; +import { BinaryReader, BinaryWriter } from '../../../../binary.js'; +import { + isSet, + bytesFromBase64, + base64FromBytes, +} from '../../../../helpers.js'; +/** + * DataType defines the type of solo machine proof being created. This is done + * to preserve uniqueness of different data sign byte encodings. + */ +export enum DataType { + /** DATA_TYPE_UNINITIALIZED_UNSPECIFIED - Default State */ + DATA_TYPE_UNINITIALIZED_UNSPECIFIED = 0, + /** DATA_TYPE_CLIENT_STATE - Data type for client state verification */ + DATA_TYPE_CLIENT_STATE = 1, + /** DATA_TYPE_CONSENSUS_STATE - Data type for consensus state verification */ + DATA_TYPE_CONSENSUS_STATE = 2, + /** DATA_TYPE_CONNECTION_STATE - Data type for connection state verification */ + DATA_TYPE_CONNECTION_STATE = 3, + /** DATA_TYPE_CHANNEL_STATE - Data type for channel state verification */ + DATA_TYPE_CHANNEL_STATE = 4, + /** DATA_TYPE_PACKET_COMMITMENT - Data type for packet commitment verification */ + DATA_TYPE_PACKET_COMMITMENT = 5, + /** DATA_TYPE_PACKET_ACKNOWLEDGEMENT - Data type for packet acknowledgement verification */ + DATA_TYPE_PACKET_ACKNOWLEDGEMENT = 6, + /** DATA_TYPE_PACKET_RECEIPT_ABSENCE - Data type for packet receipt absence verification */ + DATA_TYPE_PACKET_RECEIPT_ABSENCE = 7, + /** DATA_TYPE_NEXT_SEQUENCE_RECV - Data type for next sequence recv verification */ + DATA_TYPE_NEXT_SEQUENCE_RECV = 8, + /** DATA_TYPE_HEADER - Data type for header verification */ + DATA_TYPE_HEADER = 9, + UNRECOGNIZED = -1, +} +export const DataTypeSDKType = DataType; +export function dataTypeFromJSON(object: any): DataType { + switch (object) { + case 0: + case 'DATA_TYPE_UNINITIALIZED_UNSPECIFIED': + return DataType.DATA_TYPE_UNINITIALIZED_UNSPECIFIED; + case 1: + case 'DATA_TYPE_CLIENT_STATE': + return DataType.DATA_TYPE_CLIENT_STATE; + case 2: + case 'DATA_TYPE_CONSENSUS_STATE': + return DataType.DATA_TYPE_CONSENSUS_STATE; + case 3: + case 'DATA_TYPE_CONNECTION_STATE': + return DataType.DATA_TYPE_CONNECTION_STATE; + case 4: + case 'DATA_TYPE_CHANNEL_STATE': + return DataType.DATA_TYPE_CHANNEL_STATE; + case 5: + case 'DATA_TYPE_PACKET_COMMITMENT': + return DataType.DATA_TYPE_PACKET_COMMITMENT; + case 6: + case 'DATA_TYPE_PACKET_ACKNOWLEDGEMENT': + return DataType.DATA_TYPE_PACKET_ACKNOWLEDGEMENT; + case 7: + case 'DATA_TYPE_PACKET_RECEIPT_ABSENCE': + return DataType.DATA_TYPE_PACKET_RECEIPT_ABSENCE; + case 8: + case 'DATA_TYPE_NEXT_SEQUENCE_RECV': + return DataType.DATA_TYPE_NEXT_SEQUENCE_RECV; + case 9: + case 'DATA_TYPE_HEADER': + return DataType.DATA_TYPE_HEADER; + case -1: + case 'UNRECOGNIZED': + default: + return DataType.UNRECOGNIZED; + } +} +export function dataTypeToJSON(object: DataType): string { + switch (object) { + case DataType.DATA_TYPE_UNINITIALIZED_UNSPECIFIED: + return 'DATA_TYPE_UNINITIALIZED_UNSPECIFIED'; + case DataType.DATA_TYPE_CLIENT_STATE: + return 'DATA_TYPE_CLIENT_STATE'; + case DataType.DATA_TYPE_CONSENSUS_STATE: + return 'DATA_TYPE_CONSENSUS_STATE'; + case DataType.DATA_TYPE_CONNECTION_STATE: + return 'DATA_TYPE_CONNECTION_STATE'; + case DataType.DATA_TYPE_CHANNEL_STATE: + return 'DATA_TYPE_CHANNEL_STATE'; + case DataType.DATA_TYPE_PACKET_COMMITMENT: + return 'DATA_TYPE_PACKET_COMMITMENT'; + case DataType.DATA_TYPE_PACKET_ACKNOWLEDGEMENT: + return 'DATA_TYPE_PACKET_ACKNOWLEDGEMENT'; + case DataType.DATA_TYPE_PACKET_RECEIPT_ABSENCE: + return 'DATA_TYPE_PACKET_RECEIPT_ABSENCE'; + case DataType.DATA_TYPE_NEXT_SEQUENCE_RECV: + return 'DATA_TYPE_NEXT_SEQUENCE_RECV'; + case DataType.DATA_TYPE_HEADER: + return 'DATA_TYPE_HEADER'; + case DataType.UNRECOGNIZED: + default: + return 'UNRECOGNIZED'; + } +} +/** + * ClientState defines a solo machine client that tracks the current consensus + * state and if the client is frozen. + */ +export interface ClientState { + /** latest sequence of the client state */ + sequence: bigint; + /** frozen sequence of the solo machine */ + isFrozen: boolean; + consensusState?: ConsensusState; + /** + * when set to true, will allow governance to update a solo machine client. + * The client will be unfrozen if it is frozen. + */ + allowUpdateAfterProposal: boolean; +} +export interface ClientStateProtoMsg { + typeUrl: '/ibc.lightclients.solomachine.v2.ClientState'; + value: Uint8Array; +} +/** + * ClientState defines a solo machine client that tracks the current consensus + * state and if the client is frozen. + */ +export interface ClientStateSDKType { + sequence: bigint; + is_frozen: boolean; + consensus_state?: ConsensusStateSDKType; + allow_update_after_proposal: boolean; +} +/** + * ConsensusState defines a solo machine consensus state. The sequence of a + * consensus state is contained in the "height" key used in storing the + * consensus state. + */ +export interface ConsensusState { + /** public key of the solo machine */ + publicKey?: Any; + /** + * diversifier allows the same public key to be re-used across different solo + * machine clients (potentially on different chains) without being considered + * misbehaviour. + */ + diversifier: string; + timestamp: bigint; +} +export interface ConsensusStateProtoMsg { + typeUrl: '/ibc.lightclients.solomachine.v2.ConsensusState'; + value: Uint8Array; +} +/** + * ConsensusState defines a solo machine consensus state. The sequence of a + * consensus state is contained in the "height" key used in storing the + * consensus state. + */ +export interface ConsensusStateSDKType { + public_key?: AnySDKType; + diversifier: string; + timestamp: bigint; +} +/** Header defines a solo machine consensus header */ +export interface Header { + /** sequence to update solo machine public key at */ + sequence: bigint; + timestamp: bigint; + signature: Uint8Array; + newPublicKey?: Any; + newDiversifier: string; +} +export interface HeaderProtoMsg { + typeUrl: '/ibc.lightclients.solomachine.v2.Header'; + value: Uint8Array; +} +/** Header defines a solo machine consensus header */ +export interface HeaderSDKType { + sequence: bigint; + timestamp: bigint; + signature: Uint8Array; + new_public_key?: AnySDKType; + new_diversifier: string; +} +/** + * Misbehaviour defines misbehaviour for a solo machine which consists + * of a sequence and two signatures over different messages at that sequence. + */ +export interface Misbehaviour { + clientId: string; + sequence: bigint; + signatureOne?: SignatureAndData; + signatureTwo?: SignatureAndData; +} +export interface MisbehaviourProtoMsg { + typeUrl: '/ibc.lightclients.solomachine.v2.Misbehaviour'; + value: Uint8Array; +} +/** + * Misbehaviour defines misbehaviour for a solo machine which consists + * of a sequence and two signatures over different messages at that sequence. + */ +export interface MisbehaviourSDKType { + client_id: string; + sequence: bigint; + signature_one?: SignatureAndDataSDKType; + signature_two?: SignatureAndDataSDKType; +} +/** + * SignatureAndData contains a signature and the data signed over to create that + * signature. + */ +export interface SignatureAndData { + signature: Uint8Array; + dataType: DataType; + data: Uint8Array; + timestamp: bigint; +} +export interface SignatureAndDataProtoMsg { + typeUrl: '/ibc.lightclients.solomachine.v2.SignatureAndData'; + value: Uint8Array; +} +/** + * SignatureAndData contains a signature and the data signed over to create that + * signature. + */ +export interface SignatureAndDataSDKType { + signature: Uint8Array; + data_type: DataType; + data: Uint8Array; + timestamp: bigint; +} +/** + * TimestampedSignatureData contains the signature data and the timestamp of the + * signature. + */ +export interface TimestampedSignatureData { + signatureData: Uint8Array; + timestamp: bigint; +} +export interface TimestampedSignatureDataProtoMsg { + typeUrl: '/ibc.lightclients.solomachine.v2.TimestampedSignatureData'; + value: Uint8Array; +} +/** + * TimestampedSignatureData contains the signature data and the timestamp of the + * signature. + */ +export interface TimestampedSignatureDataSDKType { + signature_data: Uint8Array; + timestamp: bigint; +} +/** SignBytes defines the signed bytes used for signature verification. */ +export interface SignBytes { + sequence: bigint; + timestamp: bigint; + diversifier: string; + /** type of the data used */ + dataType: DataType; + /** marshaled data */ + data: Uint8Array; +} +export interface SignBytesProtoMsg { + typeUrl: '/ibc.lightclients.solomachine.v2.SignBytes'; + value: Uint8Array; +} +/** SignBytes defines the signed bytes used for signature verification. */ +export interface SignBytesSDKType { + sequence: bigint; + timestamp: bigint; + diversifier: string; + data_type: DataType; + data: Uint8Array; +} +/** HeaderData returns the SignBytes data for update verification. */ +export interface HeaderData { + /** header public key */ + newPubKey?: Any; + /** header diversifier */ + newDiversifier: string; +} +export interface HeaderDataProtoMsg { + typeUrl: '/ibc.lightclients.solomachine.v2.HeaderData'; + value: Uint8Array; +} +/** HeaderData returns the SignBytes data for update verification. */ +export interface HeaderDataSDKType { + new_pub_key?: AnySDKType; + new_diversifier: string; +} +/** ClientStateData returns the SignBytes data for client state verification. */ +export interface ClientStateData { + path: Uint8Array; + clientState?: Any; +} +export interface ClientStateDataProtoMsg { + typeUrl: '/ibc.lightclients.solomachine.v2.ClientStateData'; + value: Uint8Array; +} +/** ClientStateData returns the SignBytes data for client state verification. */ +export interface ClientStateDataSDKType { + path: Uint8Array; + client_state?: AnySDKType; +} +/** + * ConsensusStateData returns the SignBytes data for consensus state + * verification. + */ +export interface ConsensusStateData { + path: Uint8Array; + consensusState?: Any; +} +export interface ConsensusStateDataProtoMsg { + typeUrl: '/ibc.lightclients.solomachine.v2.ConsensusStateData'; + value: Uint8Array; +} +/** + * ConsensusStateData returns the SignBytes data for consensus state + * verification. + */ +export interface ConsensusStateDataSDKType { + path: Uint8Array; + consensus_state?: AnySDKType; +} +/** + * ConnectionStateData returns the SignBytes data for connection state + * verification. + */ +export interface ConnectionStateData { + path: Uint8Array; + connection?: ConnectionEnd; +} +export interface ConnectionStateDataProtoMsg { + typeUrl: '/ibc.lightclients.solomachine.v2.ConnectionStateData'; + value: Uint8Array; +} +/** + * ConnectionStateData returns the SignBytes data for connection state + * verification. + */ +export interface ConnectionStateDataSDKType { + path: Uint8Array; + connection?: ConnectionEndSDKType; +} +/** + * ChannelStateData returns the SignBytes data for channel state + * verification. + */ +export interface ChannelStateData { + path: Uint8Array; + channel?: Channel; +} +export interface ChannelStateDataProtoMsg { + typeUrl: '/ibc.lightclients.solomachine.v2.ChannelStateData'; + value: Uint8Array; +} +/** + * ChannelStateData returns the SignBytes data for channel state + * verification. + */ +export interface ChannelStateDataSDKType { + path: Uint8Array; + channel?: ChannelSDKType; +} +/** + * PacketCommitmentData returns the SignBytes data for packet commitment + * verification. + */ +export interface PacketCommitmentData { + path: Uint8Array; + commitment: Uint8Array; +} +export interface PacketCommitmentDataProtoMsg { + typeUrl: '/ibc.lightclients.solomachine.v2.PacketCommitmentData'; + value: Uint8Array; +} +/** + * PacketCommitmentData returns the SignBytes data for packet commitment + * verification. + */ +export interface PacketCommitmentDataSDKType { + path: Uint8Array; + commitment: Uint8Array; +} +/** + * PacketAcknowledgementData returns the SignBytes data for acknowledgement + * verification. + */ +export interface PacketAcknowledgementData { + path: Uint8Array; + acknowledgement: Uint8Array; +} +export interface PacketAcknowledgementDataProtoMsg { + typeUrl: '/ibc.lightclients.solomachine.v2.PacketAcknowledgementData'; + value: Uint8Array; +} +/** + * PacketAcknowledgementData returns the SignBytes data for acknowledgement + * verification. + */ +export interface PacketAcknowledgementDataSDKType { + path: Uint8Array; + acknowledgement: Uint8Array; +} +/** + * PacketReceiptAbsenceData returns the SignBytes data for + * packet receipt absence verification. + */ +export interface PacketReceiptAbsenceData { + path: Uint8Array; +} +export interface PacketReceiptAbsenceDataProtoMsg { + typeUrl: '/ibc.lightclients.solomachine.v2.PacketReceiptAbsenceData'; + value: Uint8Array; +} +/** + * PacketReceiptAbsenceData returns the SignBytes data for + * packet receipt absence verification. + */ +export interface PacketReceiptAbsenceDataSDKType { + path: Uint8Array; +} +/** + * NextSequenceRecvData returns the SignBytes data for verification of the next + * sequence to be received. + */ +export interface NextSequenceRecvData { + path: Uint8Array; + nextSeqRecv: bigint; +} +export interface NextSequenceRecvDataProtoMsg { + typeUrl: '/ibc.lightclients.solomachine.v2.NextSequenceRecvData'; + value: Uint8Array; +} +/** + * NextSequenceRecvData returns the SignBytes data for verification of the next + * sequence to be received. + */ +export interface NextSequenceRecvDataSDKType { + path: Uint8Array; + next_seq_recv: bigint; +} +function createBaseClientState(): ClientState { + return { + sequence: BigInt(0), + isFrozen: false, + consensusState: undefined, + allowUpdateAfterProposal: false, + }; +} +export const ClientState = { + typeUrl: '/ibc.lightclients.solomachine.v2.ClientState', + encode( + message: ClientState, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.sequence !== BigInt(0)) { + writer.uint32(8).uint64(message.sequence); + } + if (message.isFrozen === true) { + writer.uint32(16).bool(message.isFrozen); + } + if (message.consensusState !== undefined) { + ConsensusState.encode( + message.consensusState, + writer.uint32(26).fork(), + ).ldelim(); + } + if (message.allowUpdateAfterProposal === true) { + writer.uint32(32).bool(message.allowUpdateAfterProposal); + } + 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.sequence = reader.uint64(); + break; + case 2: + message.isFrozen = reader.bool(); + break; + case 3: + message.consensusState = ConsensusState.decode( + reader, + reader.uint32(), + ); + break; + case 4: + message.allowUpdateAfterProposal = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): ClientState { + return { + sequence: isSet(object.sequence) + ? BigInt(object.sequence.toString()) + : BigInt(0), + isFrozen: isSet(object.isFrozen) ? Boolean(object.isFrozen) : false, + consensusState: isSet(object.consensusState) + ? ConsensusState.fromJSON(object.consensusState) + : undefined, + allowUpdateAfterProposal: isSet(object.allowUpdateAfterProposal) + ? Boolean(object.allowUpdateAfterProposal) + : false, + }; + }, + toJSON(message: ClientState): unknown { + const obj: any = {}; + message.sequence !== undefined && + (obj.sequence = (message.sequence || BigInt(0)).toString()); + message.isFrozen !== undefined && (obj.isFrozen = message.isFrozen); + message.consensusState !== undefined && + (obj.consensusState = message.consensusState + ? ConsensusState.toJSON(message.consensusState) + : undefined); + message.allowUpdateAfterProposal !== undefined && + (obj.allowUpdateAfterProposal = message.allowUpdateAfterProposal); + return obj; + }, + fromPartial(object: Partial): ClientState { + const message = createBaseClientState(); + message.sequence = + object.sequence !== undefined && object.sequence !== null + ? BigInt(object.sequence.toString()) + : BigInt(0); + message.isFrozen = object.isFrozen ?? false; + message.consensusState = + object.consensusState !== undefined && object.consensusState !== null + ? ConsensusState.fromPartial(object.consensusState) + : undefined; + message.allowUpdateAfterProposal = object.allowUpdateAfterProposal ?? false; + return message; + }, + fromProtoMsg(message: ClientStateProtoMsg): ClientState { + return ClientState.decode(message.value); + }, + toProto(message: ClientState): Uint8Array { + return ClientState.encode(message).finish(); + }, + toProtoMsg(message: ClientState): ClientStateProtoMsg { + return { + typeUrl: '/ibc.lightclients.solomachine.v2.ClientState', + value: ClientState.encode(message).finish(), + }; + }, +}; +function createBaseConsensusState(): ConsensusState { + return { + publicKey: undefined, + diversifier: '', + timestamp: BigInt(0), + }; +} +export const ConsensusState = { + typeUrl: '/ibc.lightclients.solomachine.v2.ConsensusState', + encode( + message: ConsensusState, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.publicKey !== undefined) { + Any.encode(message.publicKey, writer.uint32(10).fork()).ldelim(); + } + if (message.diversifier !== '') { + writer.uint32(18).string(message.diversifier); + } + if (message.timestamp !== BigInt(0)) { + writer.uint32(24).uint64(message.timestamp); + } + 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.publicKey = Any.decode(reader, reader.uint32()); + break; + case 2: + message.diversifier = reader.string(); + break; + case 3: + message.timestamp = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): ConsensusState { + return { + publicKey: isSet(object.publicKey) + ? Any.fromJSON(object.publicKey) + : undefined, + diversifier: isSet(object.diversifier) ? String(object.diversifier) : '', + timestamp: isSet(object.timestamp) + ? BigInt(object.timestamp.toString()) + : BigInt(0), + }; + }, + toJSON(message: ConsensusState): unknown { + const obj: any = {}; + message.publicKey !== undefined && + (obj.publicKey = message.publicKey + ? Any.toJSON(message.publicKey) + : undefined); + message.diversifier !== undefined && + (obj.diversifier = message.diversifier); + message.timestamp !== undefined && + (obj.timestamp = (message.timestamp || BigInt(0)).toString()); + return obj; + }, + fromPartial(object: Partial): ConsensusState { + const message = createBaseConsensusState(); + message.publicKey = + object.publicKey !== undefined && object.publicKey !== null + ? Any.fromPartial(object.publicKey) + : undefined; + message.diversifier = object.diversifier ?? ''; + message.timestamp = + object.timestamp !== undefined && object.timestamp !== null + ? BigInt(object.timestamp.toString()) + : BigInt(0); + return message; + }, + fromProtoMsg(message: ConsensusStateProtoMsg): ConsensusState { + return ConsensusState.decode(message.value); + }, + toProto(message: ConsensusState): Uint8Array { + return ConsensusState.encode(message).finish(); + }, + toProtoMsg(message: ConsensusState): ConsensusStateProtoMsg { + return { + typeUrl: '/ibc.lightclients.solomachine.v2.ConsensusState', + value: ConsensusState.encode(message).finish(), + }; + }, +}; +function createBaseHeader(): Header { + return { + sequence: BigInt(0), + timestamp: BigInt(0), + signature: new Uint8Array(), + newPublicKey: undefined, + newDiversifier: '', + }; +} +export const Header = { + typeUrl: '/ibc.lightclients.solomachine.v2.Header', + encode( + message: Header, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.sequence !== BigInt(0)) { + writer.uint32(8).uint64(message.sequence); + } + if (message.timestamp !== BigInt(0)) { + writer.uint32(16).uint64(message.timestamp); + } + if (message.signature.length !== 0) { + writer.uint32(26).bytes(message.signature); + } + if (message.newPublicKey !== undefined) { + Any.encode(message.newPublicKey, writer.uint32(34).fork()).ldelim(); + } + if (message.newDiversifier !== '') { + writer.uint32(42).string(message.newDiversifier); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Header { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHeader(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sequence = reader.uint64(); + break; + case 2: + message.timestamp = reader.uint64(); + break; + case 3: + message.signature = reader.bytes(); + break; + case 4: + message.newPublicKey = Any.decode(reader, reader.uint32()); + break; + case 5: + message.newDiversifier = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): Header { + return { + sequence: isSet(object.sequence) + ? BigInt(object.sequence.toString()) + : BigInt(0), + timestamp: isSet(object.timestamp) + ? BigInt(object.timestamp.toString()) + : BigInt(0), + signature: isSet(object.signature) + ? bytesFromBase64(object.signature) + : new Uint8Array(), + newPublicKey: isSet(object.newPublicKey) + ? Any.fromJSON(object.newPublicKey) + : undefined, + newDiversifier: isSet(object.newDiversifier) + ? String(object.newDiversifier) + : '', + }; + }, + toJSON(message: Header): unknown { + const obj: any = {}; + message.sequence !== undefined && + (obj.sequence = (message.sequence || BigInt(0)).toString()); + message.timestamp !== undefined && + (obj.timestamp = (message.timestamp || BigInt(0)).toString()); + message.signature !== undefined && + (obj.signature = base64FromBytes( + message.signature !== undefined ? message.signature : new Uint8Array(), + )); + message.newPublicKey !== undefined && + (obj.newPublicKey = message.newPublicKey + ? Any.toJSON(message.newPublicKey) + : undefined); + message.newDiversifier !== undefined && + (obj.newDiversifier = message.newDiversifier); + return obj; + }, + fromPartial(object: Partial
): Header { + const message = createBaseHeader(); + message.sequence = + object.sequence !== undefined && object.sequence !== null + ? BigInt(object.sequence.toString()) + : BigInt(0); + message.timestamp = + object.timestamp !== undefined && object.timestamp !== null + ? BigInt(object.timestamp.toString()) + : BigInt(0); + message.signature = object.signature ?? new Uint8Array(); + message.newPublicKey = + object.newPublicKey !== undefined && object.newPublicKey !== null + ? Any.fromPartial(object.newPublicKey) + : undefined; + message.newDiversifier = object.newDiversifier ?? ''; + return message; + }, + fromProtoMsg(message: HeaderProtoMsg): Header { + return Header.decode(message.value); + }, + toProto(message: Header): Uint8Array { + return Header.encode(message).finish(); + }, + toProtoMsg(message: Header): HeaderProtoMsg { + return { + typeUrl: '/ibc.lightclients.solomachine.v2.Header', + value: Header.encode(message).finish(), + }; + }, +}; +function createBaseMisbehaviour(): Misbehaviour { + return { + clientId: '', + sequence: BigInt(0), + signatureOne: undefined, + signatureTwo: undefined, + }; +} +export const Misbehaviour = { + typeUrl: '/ibc.lightclients.solomachine.v2.Misbehaviour', + encode( + message: Misbehaviour, + 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.signatureOne !== undefined) { + SignatureAndData.encode( + message.signatureOne, + writer.uint32(26).fork(), + ).ldelim(); + } + if (message.signatureTwo !== undefined) { + SignatureAndData.encode( + message.signatureTwo, + writer.uint32(34).fork(), + ).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Misbehaviour { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMisbehaviour(); + 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.signatureOne = SignatureAndData.decode( + reader, + reader.uint32(), + ); + break; + case 4: + message.signatureTwo = SignatureAndData.decode( + reader, + reader.uint32(), + ); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): Misbehaviour { + return { + clientId: isSet(object.clientId) ? String(object.clientId) : '', + sequence: isSet(object.sequence) + ? BigInt(object.sequence.toString()) + : BigInt(0), + signatureOne: isSet(object.signatureOne) + ? SignatureAndData.fromJSON(object.signatureOne) + : undefined, + signatureTwo: isSet(object.signatureTwo) + ? SignatureAndData.fromJSON(object.signatureTwo) + : undefined, + }; + }, + toJSON(message: Misbehaviour): unknown { + const obj: any = {}; + message.clientId !== undefined && (obj.clientId = message.clientId); + message.sequence !== undefined && + (obj.sequence = (message.sequence || BigInt(0)).toString()); + message.signatureOne !== undefined && + (obj.signatureOne = message.signatureOne + ? SignatureAndData.toJSON(message.signatureOne) + : undefined); + message.signatureTwo !== undefined && + (obj.signatureTwo = message.signatureTwo + ? SignatureAndData.toJSON(message.signatureTwo) + : undefined); + return obj; + }, + fromPartial(object: Partial): Misbehaviour { + const message = createBaseMisbehaviour(); + message.clientId = object.clientId ?? ''; + message.sequence = + object.sequence !== undefined && object.sequence !== null + ? BigInt(object.sequence.toString()) + : BigInt(0); + message.signatureOne = + object.signatureOne !== undefined && object.signatureOne !== null + ? SignatureAndData.fromPartial(object.signatureOne) + : undefined; + message.signatureTwo = + object.signatureTwo !== undefined && object.signatureTwo !== null + ? SignatureAndData.fromPartial(object.signatureTwo) + : undefined; + return message; + }, + fromProtoMsg(message: MisbehaviourProtoMsg): Misbehaviour { + return Misbehaviour.decode(message.value); + }, + toProto(message: Misbehaviour): Uint8Array { + return Misbehaviour.encode(message).finish(); + }, + toProtoMsg(message: Misbehaviour): MisbehaviourProtoMsg { + return { + typeUrl: '/ibc.lightclients.solomachine.v2.Misbehaviour', + value: Misbehaviour.encode(message).finish(), + }; + }, +}; +function createBaseSignatureAndData(): SignatureAndData { + return { + signature: new Uint8Array(), + dataType: 0, + data: new Uint8Array(), + timestamp: BigInt(0), + }; +} +export const SignatureAndData = { + typeUrl: '/ibc.lightclients.solomachine.v2.SignatureAndData', + encode( + message: SignatureAndData, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.signature.length !== 0) { + writer.uint32(10).bytes(message.signature); + } + if (message.dataType !== 0) { + writer.uint32(16).int32(message.dataType); + } + if (message.data.length !== 0) { + writer.uint32(26).bytes(message.data); + } + if (message.timestamp !== BigInt(0)) { + writer.uint32(32).uint64(message.timestamp); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SignatureAndData { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignatureAndData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.signature = reader.bytes(); + break; + case 2: + message.dataType = reader.int32() as any; + break; + case 3: + message.data = reader.bytes(); + break; + case 4: + message.timestamp = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): SignatureAndData { + return { + signature: isSet(object.signature) + ? bytesFromBase64(object.signature) + : new Uint8Array(), + dataType: isSet(object.dataType) ? dataTypeFromJSON(object.dataType) : -1, + data: isSet(object.data) + ? bytesFromBase64(object.data) + : new Uint8Array(), + timestamp: isSet(object.timestamp) + ? BigInt(object.timestamp.toString()) + : BigInt(0), + }; + }, + toJSON(message: SignatureAndData): unknown { + const obj: any = {}; + message.signature !== undefined && + (obj.signature = base64FromBytes( + message.signature !== undefined ? message.signature : new Uint8Array(), + )); + message.dataType !== undefined && + (obj.dataType = dataTypeToJSON(message.dataType)); + message.data !== undefined && + (obj.data = base64FromBytes( + message.data !== undefined ? message.data : new Uint8Array(), + )); + message.timestamp !== undefined && + (obj.timestamp = (message.timestamp || BigInt(0)).toString()); + return obj; + }, + fromPartial(object: Partial): SignatureAndData { + const message = createBaseSignatureAndData(); + message.signature = object.signature ?? new Uint8Array(); + message.dataType = object.dataType ?? 0; + message.data = object.data ?? new Uint8Array(); + message.timestamp = + object.timestamp !== undefined && object.timestamp !== null + ? BigInt(object.timestamp.toString()) + : BigInt(0); + return message; + }, + fromProtoMsg(message: SignatureAndDataProtoMsg): SignatureAndData { + return SignatureAndData.decode(message.value); + }, + toProto(message: SignatureAndData): Uint8Array { + return SignatureAndData.encode(message).finish(); + }, + toProtoMsg(message: SignatureAndData): SignatureAndDataProtoMsg { + return { + typeUrl: '/ibc.lightclients.solomachine.v2.SignatureAndData', + value: SignatureAndData.encode(message).finish(), + }; + }, +}; +function createBaseTimestampedSignatureData(): TimestampedSignatureData { + return { + signatureData: new Uint8Array(), + timestamp: BigInt(0), + }; +} +export const TimestampedSignatureData = { + typeUrl: '/ibc.lightclients.solomachine.v2.TimestampedSignatureData', + encode( + message: TimestampedSignatureData, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.signatureData.length !== 0) { + writer.uint32(10).bytes(message.signatureData); + } + if (message.timestamp !== BigInt(0)) { + writer.uint32(16).uint64(message.timestamp); + } + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): TimestampedSignatureData { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTimestampedSignatureData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.signatureData = reader.bytes(); + break; + case 2: + message.timestamp = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): TimestampedSignatureData { + return { + signatureData: isSet(object.signatureData) + ? bytesFromBase64(object.signatureData) + : new Uint8Array(), + timestamp: isSet(object.timestamp) + ? BigInt(object.timestamp.toString()) + : BigInt(0), + }; + }, + toJSON(message: TimestampedSignatureData): unknown { + const obj: any = {}; + message.signatureData !== undefined && + (obj.signatureData = base64FromBytes( + message.signatureData !== undefined + ? message.signatureData + : new Uint8Array(), + )); + message.timestamp !== undefined && + (obj.timestamp = (message.timestamp || BigInt(0)).toString()); + return obj; + }, + fromPartial( + object: Partial, + ): TimestampedSignatureData { + const message = createBaseTimestampedSignatureData(); + message.signatureData = object.signatureData ?? new Uint8Array(); + message.timestamp = + object.timestamp !== undefined && object.timestamp !== null + ? BigInt(object.timestamp.toString()) + : BigInt(0); + return message; + }, + fromProtoMsg( + message: TimestampedSignatureDataProtoMsg, + ): TimestampedSignatureData { + return TimestampedSignatureData.decode(message.value); + }, + toProto(message: TimestampedSignatureData): Uint8Array { + return TimestampedSignatureData.encode(message).finish(); + }, + toProtoMsg( + message: TimestampedSignatureData, + ): TimestampedSignatureDataProtoMsg { + return { + typeUrl: '/ibc.lightclients.solomachine.v2.TimestampedSignatureData', + value: TimestampedSignatureData.encode(message).finish(), + }; + }, +}; +function createBaseSignBytes(): SignBytes { + return { + sequence: BigInt(0), + timestamp: BigInt(0), + diversifier: '', + dataType: 0, + data: new Uint8Array(), + }; +} +export const SignBytes = { + typeUrl: '/ibc.lightclients.solomachine.v2.SignBytes', + encode( + message: SignBytes, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.sequence !== BigInt(0)) { + writer.uint32(8).uint64(message.sequence); + } + if (message.timestamp !== BigInt(0)) { + writer.uint32(16).uint64(message.timestamp); + } + if (message.diversifier !== '') { + writer.uint32(26).string(message.diversifier); + } + if (message.dataType !== 0) { + writer.uint32(32).int32(message.dataType); + } + if (message.data.length !== 0) { + writer.uint32(42).bytes(message.data); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SignBytes { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignBytes(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sequence = reader.uint64(); + break; + case 2: + message.timestamp = reader.uint64(); + break; + case 3: + message.diversifier = reader.string(); + break; + case 4: + message.dataType = reader.int32() as any; + break; + case 5: + message.data = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): SignBytes { + return { + sequence: isSet(object.sequence) + ? BigInt(object.sequence.toString()) + : BigInt(0), + timestamp: isSet(object.timestamp) + ? BigInt(object.timestamp.toString()) + : BigInt(0), + diversifier: isSet(object.diversifier) ? String(object.diversifier) : '', + dataType: isSet(object.dataType) ? dataTypeFromJSON(object.dataType) : -1, + data: isSet(object.data) + ? bytesFromBase64(object.data) + : new Uint8Array(), + }; + }, + toJSON(message: SignBytes): unknown { + const obj: any = {}; + message.sequence !== undefined && + (obj.sequence = (message.sequence || BigInt(0)).toString()); + message.timestamp !== undefined && + (obj.timestamp = (message.timestamp || BigInt(0)).toString()); + message.diversifier !== undefined && + (obj.diversifier = message.diversifier); + message.dataType !== undefined && + (obj.dataType = dataTypeToJSON(message.dataType)); + message.data !== undefined && + (obj.data = base64FromBytes( + message.data !== undefined ? message.data : new Uint8Array(), + )); + return obj; + }, + fromPartial(object: Partial): SignBytes { + const message = createBaseSignBytes(); + message.sequence = + object.sequence !== undefined && object.sequence !== null + ? BigInt(object.sequence.toString()) + : BigInt(0); + message.timestamp = + object.timestamp !== undefined && object.timestamp !== null + ? BigInt(object.timestamp.toString()) + : BigInt(0); + message.diversifier = object.diversifier ?? ''; + message.dataType = object.dataType ?? 0; + message.data = object.data ?? new Uint8Array(); + return message; + }, + fromProtoMsg(message: SignBytesProtoMsg): SignBytes { + return SignBytes.decode(message.value); + }, + toProto(message: SignBytes): Uint8Array { + return SignBytes.encode(message).finish(); + }, + toProtoMsg(message: SignBytes): SignBytesProtoMsg { + return { + typeUrl: '/ibc.lightclients.solomachine.v2.SignBytes', + value: SignBytes.encode(message).finish(), + }; + }, +}; +function createBaseHeaderData(): HeaderData { + return { + newPubKey: undefined, + newDiversifier: '', + }; +} +export const HeaderData = { + typeUrl: '/ibc.lightclients.solomachine.v2.HeaderData', + encode( + message: HeaderData, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.newPubKey !== undefined) { + Any.encode(message.newPubKey, writer.uint32(10).fork()).ldelim(); + } + if (message.newDiversifier !== '') { + writer.uint32(18).string(message.newDiversifier); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): HeaderData { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHeaderData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.newPubKey = Any.decode(reader, reader.uint32()); + break; + case 2: + message.newDiversifier = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): HeaderData { + return { + newPubKey: isSet(object.newPubKey) + ? Any.fromJSON(object.newPubKey) + : undefined, + newDiversifier: isSet(object.newDiversifier) + ? String(object.newDiversifier) + : '', + }; + }, + toJSON(message: HeaderData): unknown { + const obj: any = {}; + message.newPubKey !== undefined && + (obj.newPubKey = message.newPubKey + ? Any.toJSON(message.newPubKey) + : undefined); + message.newDiversifier !== undefined && + (obj.newDiversifier = message.newDiversifier); + return obj; + }, + fromPartial(object: Partial): HeaderData { + const message = createBaseHeaderData(); + message.newPubKey = + object.newPubKey !== undefined && object.newPubKey !== null + ? Any.fromPartial(object.newPubKey) + : undefined; + message.newDiversifier = object.newDiversifier ?? ''; + return message; + }, + fromProtoMsg(message: HeaderDataProtoMsg): HeaderData { + return HeaderData.decode(message.value); + }, + toProto(message: HeaderData): Uint8Array { + return HeaderData.encode(message).finish(); + }, + toProtoMsg(message: HeaderData): HeaderDataProtoMsg { + return { + typeUrl: '/ibc.lightclients.solomachine.v2.HeaderData', + value: HeaderData.encode(message).finish(), + }; + }, +}; +function createBaseClientStateData(): ClientStateData { + return { + path: new Uint8Array(), + clientState: undefined, + }; +} +export const ClientStateData = { + typeUrl: '/ibc.lightclients.solomachine.v2.ClientStateData', + encode( + message: ClientStateData, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.path.length !== 0) { + writer.uint32(10).bytes(message.path); + } + if (message.clientState !== undefined) { + Any.encode(message.clientState, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ClientStateData { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClientStateData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.path = reader.bytes(); + break; + case 2: + message.clientState = Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): ClientStateData { + return { + path: isSet(object.path) + ? bytesFromBase64(object.path) + : new Uint8Array(), + clientState: isSet(object.clientState) + ? Any.fromJSON(object.clientState) + : undefined, + }; + }, + toJSON(message: ClientStateData): unknown { + const obj: any = {}; + message.path !== undefined && + (obj.path = base64FromBytes( + message.path !== undefined ? message.path : new Uint8Array(), + )); + message.clientState !== undefined && + (obj.clientState = message.clientState + ? Any.toJSON(message.clientState) + : undefined); + return obj; + }, + fromPartial(object: Partial): ClientStateData { + const message = createBaseClientStateData(); + message.path = object.path ?? new Uint8Array(); + message.clientState = + object.clientState !== undefined && object.clientState !== null + ? Any.fromPartial(object.clientState) + : undefined; + return message; + }, + fromProtoMsg(message: ClientStateDataProtoMsg): ClientStateData { + return ClientStateData.decode(message.value); + }, + toProto(message: ClientStateData): Uint8Array { + return ClientStateData.encode(message).finish(); + }, + toProtoMsg(message: ClientStateData): ClientStateDataProtoMsg { + return { + typeUrl: '/ibc.lightclients.solomachine.v2.ClientStateData', + value: ClientStateData.encode(message).finish(), + }; + }, +}; +function createBaseConsensusStateData(): ConsensusStateData { + return { + path: new Uint8Array(), + consensusState: undefined, + }; +} +export const ConsensusStateData = { + typeUrl: '/ibc.lightclients.solomachine.v2.ConsensusStateData', + encode( + message: ConsensusStateData, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.path.length !== 0) { + writer.uint32(10).bytes(message.path); + } + if (message.consensusState !== undefined) { + Any.encode(message.consensusState, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): ConsensusStateData { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConsensusStateData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.path = reader.bytes(); + break; + case 2: + message.consensusState = Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): ConsensusStateData { + return { + path: isSet(object.path) + ? bytesFromBase64(object.path) + : new Uint8Array(), + consensusState: isSet(object.consensusState) + ? Any.fromJSON(object.consensusState) + : undefined, + }; + }, + toJSON(message: ConsensusStateData): unknown { + const obj: any = {}; + message.path !== undefined && + (obj.path = base64FromBytes( + message.path !== undefined ? message.path : new Uint8Array(), + )); + message.consensusState !== undefined && + (obj.consensusState = message.consensusState + ? Any.toJSON(message.consensusState) + : undefined); + return obj; + }, + fromPartial(object: Partial): ConsensusStateData { + const message = createBaseConsensusStateData(); + message.path = object.path ?? new Uint8Array(); + message.consensusState = + object.consensusState !== undefined && object.consensusState !== null + ? Any.fromPartial(object.consensusState) + : undefined; + return message; + }, + fromProtoMsg(message: ConsensusStateDataProtoMsg): ConsensusStateData { + return ConsensusStateData.decode(message.value); + }, + toProto(message: ConsensusStateData): Uint8Array { + return ConsensusStateData.encode(message).finish(); + }, + toProtoMsg(message: ConsensusStateData): ConsensusStateDataProtoMsg { + return { + typeUrl: '/ibc.lightclients.solomachine.v2.ConsensusStateData', + value: ConsensusStateData.encode(message).finish(), + }; + }, +}; +function createBaseConnectionStateData(): ConnectionStateData { + return { + path: new Uint8Array(), + connection: undefined, + }; +} +export const ConnectionStateData = { + typeUrl: '/ibc.lightclients.solomachine.v2.ConnectionStateData', + encode( + message: ConnectionStateData, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.path.length !== 0) { + writer.uint32(10).bytes(message.path); + } + if (message.connection !== undefined) { + ConnectionEnd.encode( + message.connection, + writer.uint32(18).fork(), + ).ldelim(); + } + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): ConnectionStateData { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConnectionStateData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.path = reader.bytes(); + break; + case 2: + message.connection = ConnectionEnd.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): ConnectionStateData { + return { + path: isSet(object.path) + ? bytesFromBase64(object.path) + : new Uint8Array(), + connection: isSet(object.connection) + ? ConnectionEnd.fromJSON(object.connection) + : undefined, + }; + }, + toJSON(message: ConnectionStateData): unknown { + const obj: any = {}; + message.path !== undefined && + (obj.path = base64FromBytes( + message.path !== undefined ? message.path : new Uint8Array(), + )); + message.connection !== undefined && + (obj.connection = message.connection + ? ConnectionEnd.toJSON(message.connection) + : undefined); + return obj; + }, + fromPartial(object: Partial): ConnectionStateData { + const message = createBaseConnectionStateData(); + message.path = object.path ?? new Uint8Array(); + message.connection = + object.connection !== undefined && object.connection !== null + ? ConnectionEnd.fromPartial(object.connection) + : undefined; + return message; + }, + fromProtoMsg(message: ConnectionStateDataProtoMsg): ConnectionStateData { + return ConnectionStateData.decode(message.value); + }, + toProto(message: ConnectionStateData): Uint8Array { + return ConnectionStateData.encode(message).finish(); + }, + toProtoMsg(message: ConnectionStateData): ConnectionStateDataProtoMsg { + return { + typeUrl: '/ibc.lightclients.solomachine.v2.ConnectionStateData', + value: ConnectionStateData.encode(message).finish(), + }; + }, +}; +function createBaseChannelStateData(): ChannelStateData { + return { + path: new Uint8Array(), + channel: undefined, + }; +} +export const ChannelStateData = { + typeUrl: '/ibc.lightclients.solomachine.v2.ChannelStateData', + encode( + message: ChannelStateData, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.path.length !== 0) { + writer.uint32(10).bytes(message.path); + } + if (message.channel !== undefined) { + Channel.encode(message.channel, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ChannelStateData { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseChannelStateData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.path = reader.bytes(); + break; + case 2: + message.channel = Channel.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): ChannelStateData { + return { + path: isSet(object.path) + ? bytesFromBase64(object.path) + : new Uint8Array(), + channel: isSet(object.channel) + ? Channel.fromJSON(object.channel) + : undefined, + }; + }, + toJSON(message: ChannelStateData): unknown { + const obj: any = {}; + message.path !== undefined && + (obj.path = base64FromBytes( + message.path !== undefined ? message.path : new Uint8Array(), + )); + message.channel !== undefined && + (obj.channel = message.channel + ? Channel.toJSON(message.channel) + : undefined); + return obj; + }, + fromPartial(object: Partial): ChannelStateData { + const message = createBaseChannelStateData(); + message.path = object.path ?? new Uint8Array(); + message.channel = + object.channel !== undefined && object.channel !== null + ? Channel.fromPartial(object.channel) + : undefined; + return message; + }, + fromProtoMsg(message: ChannelStateDataProtoMsg): ChannelStateData { + return ChannelStateData.decode(message.value); + }, + toProto(message: ChannelStateData): Uint8Array { + return ChannelStateData.encode(message).finish(); + }, + toProtoMsg(message: ChannelStateData): ChannelStateDataProtoMsg { + return { + typeUrl: '/ibc.lightclients.solomachine.v2.ChannelStateData', + value: ChannelStateData.encode(message).finish(), + }; + }, +}; +function createBasePacketCommitmentData(): PacketCommitmentData { + return { + path: new Uint8Array(), + commitment: new Uint8Array(), + }; +} +export const PacketCommitmentData = { + typeUrl: '/ibc.lightclients.solomachine.v2.PacketCommitmentData', + encode( + message: PacketCommitmentData, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.path.length !== 0) { + writer.uint32(10).bytes(message.path); + } + if (message.commitment.length !== 0) { + writer.uint32(18).bytes(message.commitment); + } + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): PacketCommitmentData { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePacketCommitmentData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.path = reader.bytes(); + break; + case 2: + message.commitment = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): PacketCommitmentData { + return { + path: isSet(object.path) + ? bytesFromBase64(object.path) + : new Uint8Array(), + commitment: isSet(object.commitment) + ? bytesFromBase64(object.commitment) + : new Uint8Array(), + }; + }, + toJSON(message: PacketCommitmentData): unknown { + const obj: any = {}; + message.path !== undefined && + (obj.path = base64FromBytes( + message.path !== undefined ? message.path : new Uint8Array(), + )); + message.commitment !== undefined && + (obj.commitment = base64FromBytes( + message.commitment !== undefined + ? message.commitment + : new Uint8Array(), + )); + return obj; + }, + fromPartial(object: Partial): PacketCommitmentData { + const message = createBasePacketCommitmentData(); + message.path = object.path ?? new Uint8Array(); + message.commitment = object.commitment ?? new Uint8Array(); + return message; + }, + fromProtoMsg(message: PacketCommitmentDataProtoMsg): PacketCommitmentData { + return PacketCommitmentData.decode(message.value); + }, + toProto(message: PacketCommitmentData): Uint8Array { + return PacketCommitmentData.encode(message).finish(); + }, + toProtoMsg(message: PacketCommitmentData): PacketCommitmentDataProtoMsg { + return { + typeUrl: '/ibc.lightclients.solomachine.v2.PacketCommitmentData', + value: PacketCommitmentData.encode(message).finish(), + }; + }, +}; +function createBasePacketAcknowledgementData(): PacketAcknowledgementData { + return { + path: new Uint8Array(), + acknowledgement: new Uint8Array(), + }; +} +export const PacketAcknowledgementData = { + typeUrl: '/ibc.lightclients.solomachine.v2.PacketAcknowledgementData', + encode( + message: PacketAcknowledgementData, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.path.length !== 0) { + writer.uint32(10).bytes(message.path); + } + if (message.acknowledgement.length !== 0) { + writer.uint32(18).bytes(message.acknowledgement); + } + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): PacketAcknowledgementData { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePacketAcknowledgementData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.path = reader.bytes(); + break; + case 2: + message.acknowledgement = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): PacketAcknowledgementData { + return { + path: isSet(object.path) + ? bytesFromBase64(object.path) + : new Uint8Array(), + acknowledgement: isSet(object.acknowledgement) + ? bytesFromBase64(object.acknowledgement) + : new Uint8Array(), + }; + }, + toJSON(message: PacketAcknowledgementData): unknown { + const obj: any = {}; + message.path !== undefined && + (obj.path = base64FromBytes( + message.path !== undefined ? message.path : new Uint8Array(), + )); + message.acknowledgement !== undefined && + (obj.acknowledgement = base64FromBytes( + message.acknowledgement !== undefined + ? message.acknowledgement + : new Uint8Array(), + )); + return obj; + }, + fromPartial( + object: Partial, + ): PacketAcknowledgementData { + const message = createBasePacketAcknowledgementData(); + message.path = object.path ?? new Uint8Array(); + message.acknowledgement = object.acknowledgement ?? new Uint8Array(); + return message; + }, + fromProtoMsg( + message: PacketAcknowledgementDataProtoMsg, + ): PacketAcknowledgementData { + return PacketAcknowledgementData.decode(message.value); + }, + toProto(message: PacketAcknowledgementData): Uint8Array { + return PacketAcknowledgementData.encode(message).finish(); + }, + toProtoMsg( + message: PacketAcknowledgementData, + ): PacketAcknowledgementDataProtoMsg { + return { + typeUrl: '/ibc.lightclients.solomachine.v2.PacketAcknowledgementData', + value: PacketAcknowledgementData.encode(message).finish(), + }; + }, +}; +function createBasePacketReceiptAbsenceData(): PacketReceiptAbsenceData { + return { + path: new Uint8Array(), + }; +} +export const PacketReceiptAbsenceData = { + typeUrl: '/ibc.lightclients.solomachine.v2.PacketReceiptAbsenceData', + encode( + message: PacketReceiptAbsenceData, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.path.length !== 0) { + writer.uint32(10).bytes(message.path); + } + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): PacketReceiptAbsenceData { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePacketReceiptAbsenceData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.path = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): PacketReceiptAbsenceData { + return { + path: isSet(object.path) + ? bytesFromBase64(object.path) + : new Uint8Array(), + }; + }, + toJSON(message: PacketReceiptAbsenceData): unknown { + const obj: any = {}; + message.path !== undefined && + (obj.path = base64FromBytes( + message.path !== undefined ? message.path : new Uint8Array(), + )); + return obj; + }, + fromPartial( + object: Partial, + ): PacketReceiptAbsenceData { + const message = createBasePacketReceiptAbsenceData(); + message.path = object.path ?? new Uint8Array(); + return message; + }, + fromProtoMsg( + message: PacketReceiptAbsenceDataProtoMsg, + ): PacketReceiptAbsenceData { + return PacketReceiptAbsenceData.decode(message.value); + }, + toProto(message: PacketReceiptAbsenceData): Uint8Array { + return PacketReceiptAbsenceData.encode(message).finish(); + }, + toProtoMsg( + message: PacketReceiptAbsenceData, + ): PacketReceiptAbsenceDataProtoMsg { + return { + typeUrl: '/ibc.lightclients.solomachine.v2.PacketReceiptAbsenceData', + value: PacketReceiptAbsenceData.encode(message).finish(), + }; + }, +}; +function createBaseNextSequenceRecvData(): NextSequenceRecvData { + return { + path: new Uint8Array(), + nextSeqRecv: BigInt(0), + }; +} +export const NextSequenceRecvData = { + typeUrl: '/ibc.lightclients.solomachine.v2.NextSequenceRecvData', + encode( + message: NextSequenceRecvData, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.path.length !== 0) { + writer.uint32(10).bytes(message.path); + } + if (message.nextSeqRecv !== BigInt(0)) { + writer.uint32(16).uint64(message.nextSeqRecv); + } + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): NextSequenceRecvData { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNextSequenceRecvData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.path = reader.bytes(); + break; + case 2: + message.nextSeqRecv = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): NextSequenceRecvData { + return { + path: isSet(object.path) + ? bytesFromBase64(object.path) + : new Uint8Array(), + nextSeqRecv: isSet(object.nextSeqRecv) + ? BigInt(object.nextSeqRecv.toString()) + : BigInt(0), + }; + }, + toJSON(message: NextSequenceRecvData): unknown { + const obj: any = {}; + message.path !== undefined && + (obj.path = base64FromBytes( + message.path !== undefined ? message.path : new Uint8Array(), + )); + message.nextSeqRecv !== undefined && + (obj.nextSeqRecv = (message.nextSeqRecv || BigInt(0)).toString()); + return obj; + }, + fromPartial(object: Partial): NextSequenceRecvData { + const message = createBaseNextSequenceRecvData(); + message.path = object.path ?? new Uint8Array(); + message.nextSeqRecv = + object.nextSeqRecv !== undefined && object.nextSeqRecv !== null + ? BigInt(object.nextSeqRecv.toString()) + : BigInt(0); + return message; + }, + fromProtoMsg(message: NextSequenceRecvDataProtoMsg): NextSequenceRecvData { + return NextSequenceRecvData.decode(message.value); + }, + toProto(message: NextSequenceRecvData): Uint8Array { + return NextSequenceRecvData.encode(message).finish(); + }, + toProtoMsg(message: NextSequenceRecvData): NextSequenceRecvDataProtoMsg { + return { + typeUrl: '/ibc.lightclients.solomachine.v2.NextSequenceRecvData', + value: NextSequenceRecvData.encode(message).finish(), + }; + }, +}; diff --git a/packages/cosmic-proto/src/codegen/ibc/lightclients/tendermint/v1/tendermint.ts b/packages/cosmic-proto/src/codegen/ibc/lightclients/tendermint/v1/tendermint.ts new file mode 100644 index 00000000000..8c33ae345b6 --- /dev/null +++ b/packages/cosmic-proto/src/codegen/ibc/lightclients/tendermint/v1/tendermint.ts @@ -0,0 +1,856 @@ +//@ts-nocheck +import { + Duration, + DurationSDKType, +} from '../../../../google/protobuf/duration.js'; +import { Height, HeightSDKType } from '../../../core/client/v1/client.js'; +import { ProofSpec, ProofSpecSDKType } from '../../../../proofs.js'; +import { Timestamp } from '../../../../google/protobuf/timestamp.js'; +import { + MerkleRoot, + MerkleRootSDKType, +} from '../../../core/commitment/v1/commitment.js'; +import { + SignedHeader, + SignedHeaderSDKType, +} from '../../../../tendermint/types/types.js'; +import { + ValidatorSet, + ValidatorSetSDKType, +} from '../../../../tendermint/types/validator.js'; +import { BinaryReader, BinaryWriter } from '../../../../binary.js'; +import { + isSet, + toTimestamp, + fromTimestamp, + fromJsonTimestamp, + bytesFromBase64, + base64FromBytes, +} from '../../../../helpers.js'; +/** + * ClientState from Tendermint tracks the current validator set, latest height, + * and a possible frozen height. + */ +export interface ClientState { + chainId: string; + trustLevel: Fraction; + /** + * duration of the period since the LastestTimestamp during which the + * submitted headers are valid for upgrade + */ + trustingPeriod: Duration; + /** duration of the staking unbonding period */ + unbondingPeriod: Duration; + /** defines how much new (untrusted) header's Time can drift into the future. */ + maxClockDrift: Duration; + /** Block height when the client was frozen due to a misbehaviour */ + frozenHeight: Height; + /** Latest height the client was updated to */ + latestHeight: Height; + /** Proof specifications used in verifying counterparty state */ + proofSpecs: ProofSpec[]; + /** + * Path at which next upgraded client will be committed. + * Each element corresponds to the key for a single CommitmentProof in the + * chained proof. NOTE: ClientState must stored under + * `{upgradePath}/{upgradeHeight}/clientState` ConsensusState must be stored + * under `{upgradepath}/{upgradeHeight}/consensusState` For SDK chains using + * the default upgrade module, upgrade_path should be []string{"upgrade", + * "upgradedIBCState"}` + */ + upgradePath: string[]; + /** allow_update_after_expiry is deprecated */ + /** @deprecated */ + allowUpdateAfterExpiry: boolean; + /** allow_update_after_misbehaviour is deprecated */ + /** @deprecated */ + allowUpdateAfterMisbehaviour: boolean; +} +export interface ClientStateProtoMsg { + typeUrl: '/ibc.lightclients.tendermint.v1.ClientState'; + value: Uint8Array; +} +/** + * ClientState from Tendermint tracks the current validator set, latest height, + * and a possible frozen height. + */ +export interface ClientStateSDKType { + chain_id: string; + trust_level: FractionSDKType; + trusting_period: DurationSDKType; + unbonding_period: DurationSDKType; + max_clock_drift: DurationSDKType; + frozen_height: HeightSDKType; + latest_height: HeightSDKType; + proof_specs: ProofSpecSDKType[]; + upgrade_path: string[]; + /** @deprecated */ + allow_update_after_expiry: boolean; + /** @deprecated */ + allow_update_after_misbehaviour: boolean; +} +/** ConsensusState defines the consensus state from Tendermint. */ +export interface ConsensusState { + /** + * timestamp that corresponds to the block height in which the ConsensusState + * was stored. + */ + timestamp: Date; + /** commitment root (i.e app hash) */ + root: MerkleRoot; + nextValidatorsHash: Uint8Array; +} +export interface ConsensusStateProtoMsg { + typeUrl: '/ibc.lightclients.tendermint.v1.ConsensusState'; + value: Uint8Array; +} +/** ConsensusState defines the consensus state from Tendermint. */ +export interface ConsensusStateSDKType { + timestamp: Date; + root: MerkleRootSDKType; + next_validators_hash: Uint8Array; +} +/** + * Misbehaviour is a wrapper over two conflicting Headers + * that implements Misbehaviour interface expected by ICS-02 + */ +export interface Misbehaviour { + clientId: string; + header1?: Header; + header2?: Header; +} +export interface MisbehaviourProtoMsg { + typeUrl: '/ibc.lightclients.tendermint.v1.Misbehaviour'; + value: Uint8Array; +} +/** + * Misbehaviour is a wrapper over two conflicting Headers + * that implements Misbehaviour interface expected by ICS-02 + */ +export interface MisbehaviourSDKType { + client_id: string; + header_1?: HeaderSDKType; + header_2?: HeaderSDKType; +} +/** + * Header defines the Tendermint client consensus Header. + * It encapsulates all the information necessary to update from a trusted + * Tendermint ConsensusState. The inclusion of TrustedHeight and + * TrustedValidators allows this update to process correctly, so long as the + * ConsensusState for the TrustedHeight exists, this removes race conditions + * among relayers The SignedHeader and ValidatorSet are the new untrusted update + * fields for the client. The TrustedHeight is the height of a stored + * ConsensusState on the client that will be used to verify the new untrusted + * header. The Trusted ConsensusState must be within the unbonding period of + * current time in order to correctly verify, and the TrustedValidators must + * hash to TrustedConsensusState.NextValidatorsHash since that is the last + * trusted validator set at the TrustedHeight. + */ +export interface Header { + signedHeader?: SignedHeader; + validatorSet?: ValidatorSet; + trustedHeight: Height; + trustedValidators?: ValidatorSet; +} +export interface HeaderProtoMsg { + typeUrl: '/ibc.lightclients.tendermint.v1.Header'; + value: Uint8Array; +} +/** + * Header defines the Tendermint client consensus Header. + * It encapsulates all the information necessary to update from a trusted + * Tendermint ConsensusState. The inclusion of TrustedHeight and + * TrustedValidators allows this update to process correctly, so long as the + * ConsensusState for the TrustedHeight exists, this removes race conditions + * among relayers The SignedHeader and ValidatorSet are the new untrusted update + * fields for the client. The TrustedHeight is the height of a stored + * ConsensusState on the client that will be used to verify the new untrusted + * header. The Trusted ConsensusState must be within the unbonding period of + * current time in order to correctly verify, and the TrustedValidators must + * hash to TrustedConsensusState.NextValidatorsHash since that is the last + * trusted validator set at the TrustedHeight. + */ +export interface HeaderSDKType { + signed_header?: SignedHeaderSDKType; + validator_set?: ValidatorSetSDKType; + trusted_height: HeightSDKType; + trusted_validators?: ValidatorSetSDKType; +} +/** + * Fraction defines the protobuf message type for tmmath.Fraction that only + * supports positive values. + */ +export interface Fraction { + numerator: bigint; + denominator: bigint; +} +export interface FractionProtoMsg { + typeUrl: '/ibc.lightclients.tendermint.v1.Fraction'; + value: Uint8Array; +} +/** + * Fraction defines the protobuf message type for tmmath.Fraction that only + * supports positive values. + */ +export interface FractionSDKType { + numerator: bigint; + denominator: bigint; +} +function createBaseClientState(): ClientState { + return { + chainId: '', + trustLevel: Fraction.fromPartial({}), + trustingPeriod: Duration.fromPartial({}), + unbondingPeriod: Duration.fromPartial({}), + maxClockDrift: Duration.fromPartial({}), + frozenHeight: Height.fromPartial({}), + latestHeight: Height.fromPartial({}), + proofSpecs: [], + upgradePath: [], + allowUpdateAfterExpiry: false, + allowUpdateAfterMisbehaviour: false, + }; +} +export const ClientState = { + typeUrl: '/ibc.lightclients.tendermint.v1.ClientState', + encode( + message: ClientState, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.chainId !== '') { + writer.uint32(10).string(message.chainId); + } + if (message.trustLevel !== undefined) { + Fraction.encode(message.trustLevel, writer.uint32(18).fork()).ldelim(); + } + if (message.trustingPeriod !== undefined) { + Duration.encode( + message.trustingPeriod, + writer.uint32(26).fork(), + ).ldelim(); + } + if (message.unbondingPeriod !== undefined) { + Duration.encode( + message.unbondingPeriod, + writer.uint32(34).fork(), + ).ldelim(); + } + if (message.maxClockDrift !== undefined) { + Duration.encode(message.maxClockDrift, writer.uint32(42).fork()).ldelim(); + } + if (message.frozenHeight !== undefined) { + Height.encode(message.frozenHeight, writer.uint32(50).fork()).ldelim(); + } + if (message.latestHeight !== undefined) { + Height.encode(message.latestHeight, writer.uint32(58).fork()).ldelim(); + } + for (const v of message.proofSpecs) { + ProofSpec.encode(v!, writer.uint32(66).fork()).ldelim(); + } + for (const v of message.upgradePath) { + writer.uint32(74).string(v!); + } + if (message.allowUpdateAfterExpiry === true) { + writer.uint32(80).bool(message.allowUpdateAfterExpiry); + } + if (message.allowUpdateAfterMisbehaviour === true) { + writer.uint32(88).bool(message.allowUpdateAfterMisbehaviour); + } + 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.chainId = reader.string(); + break; + case 2: + message.trustLevel = Fraction.decode(reader, reader.uint32()); + break; + case 3: + message.trustingPeriod = Duration.decode(reader, reader.uint32()); + break; + case 4: + message.unbondingPeriod = Duration.decode(reader, reader.uint32()); + break; + case 5: + message.maxClockDrift = Duration.decode(reader, reader.uint32()); + break; + case 6: + message.frozenHeight = Height.decode(reader, reader.uint32()); + break; + case 7: + message.latestHeight = Height.decode(reader, reader.uint32()); + break; + case 8: + message.proofSpecs.push(ProofSpec.decode(reader, reader.uint32())); + break; + case 9: + message.upgradePath.push(reader.string()); + break; + case 10: + message.allowUpdateAfterExpiry = reader.bool(); + break; + case 11: + message.allowUpdateAfterMisbehaviour = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): ClientState { + return { + chainId: isSet(object.chainId) ? String(object.chainId) : '', + trustLevel: isSet(object.trustLevel) + ? Fraction.fromJSON(object.trustLevel) + : undefined, + trustingPeriod: isSet(object.trustingPeriod) + ? Duration.fromJSON(object.trustingPeriod) + : undefined, + unbondingPeriod: isSet(object.unbondingPeriod) + ? Duration.fromJSON(object.unbondingPeriod) + : undefined, + maxClockDrift: isSet(object.maxClockDrift) + ? Duration.fromJSON(object.maxClockDrift) + : undefined, + frozenHeight: isSet(object.frozenHeight) + ? Height.fromJSON(object.frozenHeight) + : undefined, + latestHeight: isSet(object.latestHeight) + ? Height.fromJSON(object.latestHeight) + : undefined, + proofSpecs: Array.isArray(object?.proofSpecs) + ? object.proofSpecs.map((e: any) => ProofSpec.fromJSON(e)) + : [], + upgradePath: Array.isArray(object?.upgradePath) + ? object.upgradePath.map((e: any) => String(e)) + : [], + allowUpdateAfterExpiry: isSet(object.allowUpdateAfterExpiry) + ? Boolean(object.allowUpdateAfterExpiry) + : false, + allowUpdateAfterMisbehaviour: isSet(object.allowUpdateAfterMisbehaviour) + ? Boolean(object.allowUpdateAfterMisbehaviour) + : false, + }; + }, + toJSON(message: ClientState): unknown { + const obj: any = {}; + message.chainId !== undefined && (obj.chainId = message.chainId); + message.trustLevel !== undefined && + (obj.trustLevel = message.trustLevel + ? Fraction.toJSON(message.trustLevel) + : undefined); + message.trustingPeriod !== undefined && + (obj.trustingPeriod = message.trustingPeriod + ? Duration.toJSON(message.trustingPeriod) + : undefined); + message.unbondingPeriod !== undefined && + (obj.unbondingPeriod = message.unbondingPeriod + ? Duration.toJSON(message.unbondingPeriod) + : undefined); + message.maxClockDrift !== undefined && + (obj.maxClockDrift = message.maxClockDrift + ? Duration.toJSON(message.maxClockDrift) + : undefined); + message.frozenHeight !== undefined && + (obj.frozenHeight = message.frozenHeight + ? Height.toJSON(message.frozenHeight) + : undefined); + message.latestHeight !== undefined && + (obj.latestHeight = message.latestHeight + ? Height.toJSON(message.latestHeight) + : undefined); + if (message.proofSpecs) { + obj.proofSpecs = message.proofSpecs.map(e => + e ? ProofSpec.toJSON(e) : undefined, + ); + } else { + obj.proofSpecs = []; + } + if (message.upgradePath) { + obj.upgradePath = message.upgradePath.map(e => e); + } else { + obj.upgradePath = []; + } + message.allowUpdateAfterExpiry !== undefined && + (obj.allowUpdateAfterExpiry = message.allowUpdateAfterExpiry); + message.allowUpdateAfterMisbehaviour !== undefined && + (obj.allowUpdateAfterMisbehaviour = message.allowUpdateAfterMisbehaviour); + return obj; + }, + fromPartial(object: Partial): ClientState { + const message = createBaseClientState(); + message.chainId = object.chainId ?? ''; + message.trustLevel = + object.trustLevel !== undefined && object.trustLevel !== null + ? Fraction.fromPartial(object.trustLevel) + : undefined; + message.trustingPeriod = + object.trustingPeriod !== undefined && object.trustingPeriod !== null + ? Duration.fromPartial(object.trustingPeriod) + : undefined; + message.unbondingPeriod = + object.unbondingPeriod !== undefined && object.unbondingPeriod !== null + ? Duration.fromPartial(object.unbondingPeriod) + : undefined; + message.maxClockDrift = + object.maxClockDrift !== undefined && object.maxClockDrift !== null + ? Duration.fromPartial(object.maxClockDrift) + : undefined; + message.frozenHeight = + object.frozenHeight !== undefined && object.frozenHeight !== null + ? Height.fromPartial(object.frozenHeight) + : undefined; + message.latestHeight = + object.latestHeight !== undefined && object.latestHeight !== null + ? Height.fromPartial(object.latestHeight) + : undefined; + message.proofSpecs = + object.proofSpecs?.map(e => ProofSpec.fromPartial(e)) || []; + message.upgradePath = object.upgradePath?.map(e => e) || []; + message.allowUpdateAfterExpiry = object.allowUpdateAfterExpiry ?? false; + message.allowUpdateAfterMisbehaviour = + object.allowUpdateAfterMisbehaviour ?? false; + return message; + }, + fromProtoMsg(message: ClientStateProtoMsg): ClientState { + return ClientState.decode(message.value); + }, + toProto(message: ClientState): Uint8Array { + return ClientState.encode(message).finish(); + }, + toProtoMsg(message: ClientState): ClientStateProtoMsg { + return { + typeUrl: '/ibc.lightclients.tendermint.v1.ClientState', + value: ClientState.encode(message).finish(), + }; + }, +}; +function createBaseConsensusState(): ConsensusState { + return { + timestamp: new Date(), + root: MerkleRoot.fromPartial({}), + nextValidatorsHash: new Uint8Array(), + }; +} +export const ConsensusState = { + typeUrl: '/ibc.lightclients.tendermint.v1.ConsensusState', + encode( + message: ConsensusState, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.timestamp !== undefined) { + Timestamp.encode( + toTimestamp(message.timestamp), + writer.uint32(10).fork(), + ).ldelim(); + } + if (message.root !== undefined) { + MerkleRoot.encode(message.root, writer.uint32(18).fork()).ldelim(); + } + if (message.nextValidatorsHash.length !== 0) { + writer.uint32(26).bytes(message.nextValidatorsHash); + } + 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.timestamp = fromTimestamp( + Timestamp.decode(reader, reader.uint32()), + ); + break; + case 2: + message.root = MerkleRoot.decode(reader, reader.uint32()); + break; + case 3: + message.nextValidatorsHash = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): ConsensusState { + return { + timestamp: isSet(object.timestamp) + ? fromJsonTimestamp(object.timestamp) + : undefined, + root: isSet(object.root) ? MerkleRoot.fromJSON(object.root) : undefined, + nextValidatorsHash: isSet(object.nextValidatorsHash) + ? bytesFromBase64(object.nextValidatorsHash) + : new Uint8Array(), + }; + }, + toJSON(message: ConsensusState): unknown { + const obj: any = {}; + message.timestamp !== undefined && + (obj.timestamp = message.timestamp.toISOString()); + message.root !== undefined && + (obj.root = message.root ? MerkleRoot.toJSON(message.root) : undefined); + message.nextValidatorsHash !== undefined && + (obj.nextValidatorsHash = base64FromBytes( + message.nextValidatorsHash !== undefined + ? message.nextValidatorsHash + : new Uint8Array(), + )); + return obj; + }, + fromPartial(object: Partial): ConsensusState { + const message = createBaseConsensusState(); + message.timestamp = object.timestamp ?? undefined; + message.root = + object.root !== undefined && object.root !== null + ? MerkleRoot.fromPartial(object.root) + : undefined; + message.nextValidatorsHash = object.nextValidatorsHash ?? new Uint8Array(); + return message; + }, + fromProtoMsg(message: ConsensusStateProtoMsg): ConsensusState { + return ConsensusState.decode(message.value); + }, + toProto(message: ConsensusState): Uint8Array { + return ConsensusState.encode(message).finish(); + }, + toProtoMsg(message: ConsensusState): ConsensusStateProtoMsg { + return { + typeUrl: '/ibc.lightclients.tendermint.v1.ConsensusState', + value: ConsensusState.encode(message).finish(), + }; + }, +}; +function createBaseMisbehaviour(): Misbehaviour { + return { + clientId: '', + header1: undefined, + header2: undefined, + }; +} +export const Misbehaviour = { + typeUrl: '/ibc.lightclients.tendermint.v1.Misbehaviour', + encode( + message: Misbehaviour, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.clientId !== '') { + writer.uint32(10).string(message.clientId); + } + if (message.header1 !== undefined) { + Header.encode(message.header1, writer.uint32(18).fork()).ldelim(); + } + if (message.header2 !== undefined) { + Header.encode(message.header2, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Misbehaviour { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMisbehaviour(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.header1 = Header.decode(reader, reader.uint32()); + break; + case 3: + message.header2 = Header.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): Misbehaviour { + return { + clientId: isSet(object.clientId) ? String(object.clientId) : '', + header1: isSet(object.header1) + ? Header.fromJSON(object.header1) + : undefined, + header2: isSet(object.header2) + ? Header.fromJSON(object.header2) + : undefined, + }; + }, + toJSON(message: Misbehaviour): unknown { + const obj: any = {}; + message.clientId !== undefined && (obj.clientId = message.clientId); + message.header1 !== undefined && + (obj.header1 = message.header1 + ? Header.toJSON(message.header1) + : undefined); + message.header2 !== undefined && + (obj.header2 = message.header2 + ? Header.toJSON(message.header2) + : undefined); + return obj; + }, + fromPartial(object: Partial): Misbehaviour { + const message = createBaseMisbehaviour(); + message.clientId = object.clientId ?? ''; + message.header1 = + object.header1 !== undefined && object.header1 !== null + ? Header.fromPartial(object.header1) + : undefined; + message.header2 = + object.header2 !== undefined && object.header2 !== null + ? Header.fromPartial(object.header2) + : undefined; + return message; + }, + fromProtoMsg(message: MisbehaviourProtoMsg): Misbehaviour { + return Misbehaviour.decode(message.value); + }, + toProto(message: Misbehaviour): Uint8Array { + return Misbehaviour.encode(message).finish(); + }, + toProtoMsg(message: Misbehaviour): MisbehaviourProtoMsg { + return { + typeUrl: '/ibc.lightclients.tendermint.v1.Misbehaviour', + value: Misbehaviour.encode(message).finish(), + }; + }, +}; +function createBaseHeader(): Header { + return { + signedHeader: undefined, + validatorSet: undefined, + trustedHeight: Height.fromPartial({}), + trustedValidators: undefined, + }; +} +export const Header = { + typeUrl: '/ibc.lightclients.tendermint.v1.Header', + encode( + message: Header, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.signedHeader !== undefined) { + SignedHeader.encode( + message.signedHeader, + writer.uint32(10).fork(), + ).ldelim(); + } + if (message.validatorSet !== undefined) { + ValidatorSet.encode( + message.validatorSet, + writer.uint32(18).fork(), + ).ldelim(); + } + if (message.trustedHeight !== undefined) { + Height.encode(message.trustedHeight, writer.uint32(26).fork()).ldelim(); + } + if (message.trustedValidators !== undefined) { + ValidatorSet.encode( + message.trustedValidators, + writer.uint32(34).fork(), + ).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Header { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHeader(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.signedHeader = SignedHeader.decode(reader, reader.uint32()); + break; + case 2: + message.validatorSet = ValidatorSet.decode(reader, reader.uint32()); + break; + case 3: + message.trustedHeight = Height.decode(reader, reader.uint32()); + break; + case 4: + message.trustedValidators = ValidatorSet.decode( + reader, + reader.uint32(), + ); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): Header { + return { + signedHeader: isSet(object.signedHeader) + ? SignedHeader.fromJSON(object.signedHeader) + : undefined, + validatorSet: isSet(object.validatorSet) + ? ValidatorSet.fromJSON(object.validatorSet) + : undefined, + trustedHeight: isSet(object.trustedHeight) + ? Height.fromJSON(object.trustedHeight) + : undefined, + trustedValidators: isSet(object.trustedValidators) + ? ValidatorSet.fromJSON(object.trustedValidators) + : undefined, + }; + }, + toJSON(message: Header): unknown { + const obj: any = {}; + message.signedHeader !== undefined && + (obj.signedHeader = message.signedHeader + ? SignedHeader.toJSON(message.signedHeader) + : undefined); + message.validatorSet !== undefined && + (obj.validatorSet = message.validatorSet + ? ValidatorSet.toJSON(message.validatorSet) + : undefined); + message.trustedHeight !== undefined && + (obj.trustedHeight = message.trustedHeight + ? Height.toJSON(message.trustedHeight) + : undefined); + message.trustedValidators !== undefined && + (obj.trustedValidators = message.trustedValidators + ? ValidatorSet.toJSON(message.trustedValidators) + : undefined); + return obj; + }, + fromPartial(object: Partial
): Header { + const message = createBaseHeader(); + message.signedHeader = + object.signedHeader !== undefined && object.signedHeader !== null + ? SignedHeader.fromPartial(object.signedHeader) + : undefined; + message.validatorSet = + object.validatorSet !== undefined && object.validatorSet !== null + ? ValidatorSet.fromPartial(object.validatorSet) + : undefined; + message.trustedHeight = + object.trustedHeight !== undefined && object.trustedHeight !== null + ? Height.fromPartial(object.trustedHeight) + : undefined; + message.trustedValidators = + object.trustedValidators !== undefined && + object.trustedValidators !== null + ? ValidatorSet.fromPartial(object.trustedValidators) + : undefined; + return message; + }, + fromProtoMsg(message: HeaderProtoMsg): Header { + return Header.decode(message.value); + }, + toProto(message: Header): Uint8Array { + return Header.encode(message).finish(); + }, + toProtoMsg(message: Header): HeaderProtoMsg { + return { + typeUrl: '/ibc.lightclients.tendermint.v1.Header', + value: Header.encode(message).finish(), + }; + }, +}; +function createBaseFraction(): Fraction { + return { + numerator: BigInt(0), + denominator: BigInt(0), + }; +} +export const Fraction = { + typeUrl: '/ibc.lightclients.tendermint.v1.Fraction', + encode( + message: Fraction, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.numerator !== BigInt(0)) { + writer.uint32(8).uint64(message.numerator); + } + if (message.denominator !== BigInt(0)) { + writer.uint32(16).uint64(message.denominator); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Fraction { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFraction(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.numerator = reader.uint64(); + break; + case 2: + message.denominator = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): Fraction { + return { + numerator: isSet(object.numerator) + ? BigInt(object.numerator.toString()) + : BigInt(0), + denominator: isSet(object.denominator) + ? BigInt(object.denominator.toString()) + : BigInt(0), + }; + }, + toJSON(message: Fraction): unknown { + const obj: any = {}; + message.numerator !== undefined && + (obj.numerator = (message.numerator || BigInt(0)).toString()); + message.denominator !== undefined && + (obj.denominator = (message.denominator || BigInt(0)).toString()); + return obj; + }, + fromPartial(object: Partial): Fraction { + const message = createBaseFraction(); + message.numerator = + object.numerator !== undefined && object.numerator !== null + ? BigInt(object.numerator.toString()) + : BigInt(0); + message.denominator = + object.denominator !== undefined && object.denominator !== null + ? BigInt(object.denominator.toString()) + : BigInt(0); + return message; + }, + fromProtoMsg(message: FractionProtoMsg): Fraction { + return Fraction.decode(message.value); + }, + toProto(message: Fraction): Uint8Array { + return Fraction.encode(message).finish(); + }, + toProtoMsg(message: Fraction): FractionProtoMsg { + return { + typeUrl: '/ibc.lightclients.tendermint.v1.Fraction', + value: Fraction.encode(message).finish(), + }; + }, +}; diff --git a/packages/cosmic-proto/src/codegen/ics23/bundle.ts b/packages/cosmic-proto/src/codegen/ics23/bundle.ts new file mode 100644 index 00000000000..a9aec6d102c --- /dev/null +++ b/packages/cosmic-proto/src/codegen/ics23/bundle.ts @@ -0,0 +1,5 @@ +//@ts-nocheck +import * as _118 from '../proofs.js'; +export const ics23 = { + ..._118, +}; diff --git a/packages/cosmic-proto/src/codegen/index.ts b/packages/cosmic-proto/src/codegen/index.ts index 77fea02d995..0efa1d1d8d9 100644 --- a/packages/cosmic-proto/src/codegen/index.ts +++ b/packages/cosmic-proto/src/codegen/index.ts @@ -12,6 +12,7 @@ export * from './cosmos/bundle.js'; export * from './gogoproto/bundle.js'; export * from './google/bundle.js'; export * from './ibc/bundle.js'; +export * from './ics23/bundle.js'; export * from './tendermint/bundle.js'; export * from './varint.js'; export * from './utf8.js'; diff --git a/packages/cosmic-proto/src/codegen/proofs.ts b/packages/cosmic-proto/src/codegen/proofs.ts new file mode 100644 index 00000000000..493639bfb80 --- /dev/null +++ b/packages/cosmic-proto/src/codegen/proofs.ts @@ -0,0 +1,1944 @@ +//@ts-nocheck +import { BinaryReader, BinaryWriter } from './binary.js'; +import { isSet, bytesFromBase64, base64FromBytes } from './helpers.js'; +export enum HashOp { + /** NO_HASH - NO_HASH is the default if no data passed. Note this is an illegal argument some places. */ + NO_HASH = 0, + SHA256 = 1, + SHA512 = 2, + KECCAK = 3, + RIPEMD160 = 4, + /** BITCOIN - ripemd160(sha256(x)) */ + BITCOIN = 5, + SHA512_256 = 6, + UNRECOGNIZED = -1, +} +export const HashOpSDKType = HashOp; +export function hashOpFromJSON(object: any): HashOp { + switch (object) { + case 0: + case 'NO_HASH': + return HashOp.NO_HASH; + case 1: + case 'SHA256': + return HashOp.SHA256; + case 2: + case 'SHA512': + return HashOp.SHA512; + case 3: + case 'KECCAK': + return HashOp.KECCAK; + case 4: + case 'RIPEMD160': + return HashOp.RIPEMD160; + case 5: + case 'BITCOIN': + return HashOp.BITCOIN; + case 6: + case 'SHA512_256': + return HashOp.SHA512_256; + case -1: + case 'UNRECOGNIZED': + default: + return HashOp.UNRECOGNIZED; + } +} +export function hashOpToJSON(object: HashOp): string { + switch (object) { + case HashOp.NO_HASH: + return 'NO_HASH'; + case HashOp.SHA256: + return 'SHA256'; + case HashOp.SHA512: + return 'SHA512'; + case HashOp.KECCAK: + return 'KECCAK'; + case HashOp.RIPEMD160: + return 'RIPEMD160'; + case HashOp.BITCOIN: + return 'BITCOIN'; + case HashOp.SHA512_256: + return 'SHA512_256'; + case HashOp.UNRECOGNIZED: + default: + return 'UNRECOGNIZED'; + } +} +/** + * LengthOp defines how to process the key and value of the LeafOp + * to include length information. After encoding the length with the given + * algorithm, the length will be prepended to the key and value bytes. + * (Each one with it's own encoded length) + */ +export enum LengthOp { + /** NO_PREFIX - NO_PREFIX don't include any length info */ + NO_PREFIX = 0, + /** VAR_PROTO - VAR_PROTO uses protobuf (and go-amino) varint encoding of the length */ + VAR_PROTO = 1, + /** VAR_RLP - VAR_RLP uses rlp int encoding of the length */ + VAR_RLP = 2, + /** FIXED32_BIG - FIXED32_BIG uses big-endian encoding of the length as a 32 bit integer */ + FIXED32_BIG = 3, + /** FIXED32_LITTLE - FIXED32_LITTLE uses little-endian encoding of the length as a 32 bit integer */ + FIXED32_LITTLE = 4, + /** FIXED64_BIG - FIXED64_BIG uses big-endian encoding of the length as a 64 bit integer */ + FIXED64_BIG = 5, + /** FIXED64_LITTLE - FIXED64_LITTLE uses little-endian encoding of the length as a 64 bit integer */ + FIXED64_LITTLE = 6, + /** REQUIRE_32_BYTES - REQUIRE_32_BYTES is like NONE, but will fail if the input is not exactly 32 bytes (sha256 output) */ + REQUIRE_32_BYTES = 7, + /** REQUIRE_64_BYTES - REQUIRE_64_BYTES is like NONE, but will fail if the input is not exactly 64 bytes (sha512 output) */ + REQUIRE_64_BYTES = 8, + UNRECOGNIZED = -1, +} +export const LengthOpSDKType = LengthOp; +export function lengthOpFromJSON(object: any): LengthOp { + switch (object) { + case 0: + case 'NO_PREFIX': + return LengthOp.NO_PREFIX; + case 1: + case 'VAR_PROTO': + return LengthOp.VAR_PROTO; + case 2: + case 'VAR_RLP': + return LengthOp.VAR_RLP; + case 3: + case 'FIXED32_BIG': + return LengthOp.FIXED32_BIG; + case 4: + case 'FIXED32_LITTLE': + return LengthOp.FIXED32_LITTLE; + case 5: + case 'FIXED64_BIG': + return LengthOp.FIXED64_BIG; + case 6: + case 'FIXED64_LITTLE': + return LengthOp.FIXED64_LITTLE; + case 7: + case 'REQUIRE_32_BYTES': + return LengthOp.REQUIRE_32_BYTES; + case 8: + case 'REQUIRE_64_BYTES': + return LengthOp.REQUIRE_64_BYTES; + case -1: + case 'UNRECOGNIZED': + default: + return LengthOp.UNRECOGNIZED; + } +} +export function lengthOpToJSON(object: LengthOp): string { + switch (object) { + case LengthOp.NO_PREFIX: + return 'NO_PREFIX'; + case LengthOp.VAR_PROTO: + return 'VAR_PROTO'; + case LengthOp.VAR_RLP: + return 'VAR_RLP'; + case LengthOp.FIXED32_BIG: + return 'FIXED32_BIG'; + case LengthOp.FIXED32_LITTLE: + return 'FIXED32_LITTLE'; + case LengthOp.FIXED64_BIG: + return 'FIXED64_BIG'; + case LengthOp.FIXED64_LITTLE: + return 'FIXED64_LITTLE'; + case LengthOp.REQUIRE_32_BYTES: + return 'REQUIRE_32_BYTES'; + case LengthOp.REQUIRE_64_BYTES: + return 'REQUIRE_64_BYTES'; + case LengthOp.UNRECOGNIZED: + default: + return 'UNRECOGNIZED'; + } +} +/** + * ExistenceProof takes a key and a value and a set of steps to perform on it. + * The result of peforming all these steps will provide a "root hash", which can + * be compared to the value in a header. + * + * Since it is computationally infeasible to produce a hash collission for any of the used + * cryptographic hash functions, if someone can provide a series of operations to transform + * a given key and value into a root hash that matches some trusted root, these key and values + * must be in the referenced merkle tree. + * + * The only possible issue is maliablity in LeafOp, such as providing extra prefix data, + * which should be controlled by a spec. Eg. with lengthOp as NONE, + * prefix = FOO, key = BAR, value = CHOICE + * and + * prefix = F, key = OOBAR, value = CHOICE + * would produce the same value. + * + * With LengthOp this is tricker but not impossible. Which is why the "leafPrefixEqual" field + * in the ProofSpec is valuable to prevent this mutability. And why all trees should + * length-prefix the data before hashing it. + */ +export interface ExistenceProof { + key: Uint8Array; + value: Uint8Array; + leaf?: LeafOp; + path: InnerOp[]; +} +export interface ExistenceProofProtoMsg { + typeUrl: '/ics23.ExistenceProof'; + value: Uint8Array; +} +/** + * ExistenceProof takes a key and a value and a set of steps to perform on it. + * The result of peforming all these steps will provide a "root hash", which can + * be compared to the value in a header. + * + * Since it is computationally infeasible to produce a hash collission for any of the used + * cryptographic hash functions, if someone can provide a series of operations to transform + * a given key and value into a root hash that matches some trusted root, these key and values + * must be in the referenced merkle tree. + * + * The only possible issue is maliablity in LeafOp, such as providing extra prefix data, + * which should be controlled by a spec. Eg. with lengthOp as NONE, + * prefix = FOO, key = BAR, value = CHOICE + * and + * prefix = F, key = OOBAR, value = CHOICE + * would produce the same value. + * + * With LengthOp this is tricker but not impossible. Which is why the "leafPrefixEqual" field + * in the ProofSpec is valuable to prevent this mutability. And why all trees should + * length-prefix the data before hashing it. + */ +export interface ExistenceProofSDKType { + key: Uint8Array; + value: Uint8Array; + leaf?: LeafOpSDKType; + path: InnerOpSDKType[]; +} +/** + * NonExistenceProof takes a proof of two neighbors, one left of the desired key, + * one right of the desired key. If both proofs are valid AND they are neighbors, + * then there is no valid proof for the given key. + */ +export interface NonExistenceProof { + /** TODO: remove this as unnecessary??? we prove a range */ + key: Uint8Array; + left?: ExistenceProof; + right?: ExistenceProof; +} +export interface NonExistenceProofProtoMsg { + typeUrl: '/ics23.NonExistenceProof'; + value: Uint8Array; +} +/** + * NonExistenceProof takes a proof of two neighbors, one left of the desired key, + * one right of the desired key. If both proofs are valid AND they are neighbors, + * then there is no valid proof for the given key. + */ +export interface NonExistenceProofSDKType { + key: Uint8Array; + left?: ExistenceProofSDKType; + right?: ExistenceProofSDKType; +} +/** CommitmentProof is either an ExistenceProof or a NonExistenceProof, or a Batch of such messages */ +export interface CommitmentProof { + exist?: ExistenceProof; + nonexist?: NonExistenceProof; + batch?: BatchProof; + compressed?: CompressedBatchProof; +} +export interface CommitmentProofProtoMsg { + typeUrl: '/ics23.CommitmentProof'; + value: Uint8Array; +} +/** CommitmentProof is either an ExistenceProof or a NonExistenceProof, or a Batch of such messages */ +export interface CommitmentProofSDKType { + exist?: ExistenceProofSDKType; + nonexist?: NonExistenceProofSDKType; + batch?: BatchProofSDKType; + compressed?: CompressedBatchProofSDKType; +} +/** + * LeafOp represents the raw key-value data we wish to prove, and + * must be flexible to represent the internal transformation from + * the original key-value pairs into the basis hash, for many existing + * merkle trees. + * + * key and value are passed in. So that the signature of this operation is: + * leafOp(key, value) -> output + * + * To process this, first prehash the keys and values if needed (ANY means no hash in this case): + * hkey = prehashKey(key) + * hvalue = prehashValue(value) + * + * Then combine the bytes, and hash it + * output = hash(prefix || length(hkey) || hkey || length(hvalue) || hvalue) + */ +export interface LeafOp { + hash: HashOp; + prehashKey: HashOp; + prehashValue: HashOp; + length: LengthOp; + /** + * prefix is a fixed bytes that may optionally be included at the beginning to differentiate + * a leaf node from an inner node. + */ + prefix: Uint8Array; +} +export interface LeafOpProtoMsg { + typeUrl: '/ics23.LeafOp'; + value: Uint8Array; +} +/** + * LeafOp represents the raw key-value data we wish to prove, and + * must be flexible to represent the internal transformation from + * the original key-value pairs into the basis hash, for many existing + * merkle trees. + * + * key and value are passed in. So that the signature of this operation is: + * leafOp(key, value) -> output + * + * To process this, first prehash the keys and values if needed (ANY means no hash in this case): + * hkey = prehashKey(key) + * hvalue = prehashValue(value) + * + * Then combine the bytes, and hash it + * output = hash(prefix || length(hkey) || hkey || length(hvalue) || hvalue) + */ +export interface LeafOpSDKType { + hash: HashOp; + prehash_key: HashOp; + prehash_value: HashOp; + length: LengthOp; + prefix: Uint8Array; +} +/** + * InnerOp represents a merkle-proof step that is not a leaf. + * It represents concatenating two children and hashing them to provide the next result. + * + * The result of the previous step is passed in, so the signature of this op is: + * innerOp(child) -> output + * + * The result of applying InnerOp should be: + * output = op.hash(op.prefix || child || op.suffix) + * + * where the || operator is concatenation of binary data, + * and child is the result of hashing all the tree below this step. + * + * Any special data, like prepending child with the length, or prepending the entire operation with + * some value to differentiate from leaf nodes, should be included in prefix and suffix. + * If either of prefix or suffix is empty, we just treat it as an empty string + */ +export interface InnerOp { + hash: HashOp; + prefix: Uint8Array; + suffix: Uint8Array; +} +export interface InnerOpProtoMsg { + typeUrl: '/ics23.InnerOp'; + value: Uint8Array; +} +/** + * InnerOp represents a merkle-proof step that is not a leaf. + * It represents concatenating two children and hashing them to provide the next result. + * + * The result of the previous step is passed in, so the signature of this op is: + * innerOp(child) -> output + * + * The result of applying InnerOp should be: + * output = op.hash(op.prefix || child || op.suffix) + * + * where the || operator is concatenation of binary data, + * and child is the result of hashing all the tree below this step. + * + * Any special data, like prepending child with the length, or prepending the entire operation with + * some value to differentiate from leaf nodes, should be included in prefix and suffix. + * If either of prefix or suffix is empty, we just treat it as an empty string + */ +export interface InnerOpSDKType { + hash: HashOp; + prefix: Uint8Array; + suffix: Uint8Array; +} +/** + * ProofSpec defines what the expected parameters are for a given proof type. + * This can be stored in the client and used to validate any incoming proofs. + * + * verify(ProofSpec, Proof) -> Proof | Error + * + * As demonstrated in tests, if we don't fix the algorithm used to calculate the + * LeafHash for a given tree, there are many possible key-value pairs that can + * generate a given hash (by interpretting the preimage differently). + * We need this for proper security, requires client knows a priori what + * tree format server uses. But not in code, rather a configuration object. + */ +export interface ProofSpec { + /** + * any field in the ExistenceProof must be the same as in this spec. + * except Prefix, which is just the first bytes of prefix (spec can be longer) + */ + leafSpec?: LeafOp; + innerSpec?: InnerSpec; + /** max_depth (if > 0) is the maximum number of InnerOps allowed (mainly for fixed-depth tries) */ + maxDepth: number; + /** min_depth (if > 0) is the minimum number of InnerOps allowed (mainly for fixed-depth tries) */ + minDepth: number; +} +export interface ProofSpecProtoMsg { + typeUrl: '/ics23.ProofSpec'; + value: Uint8Array; +} +/** + * ProofSpec defines what the expected parameters are for a given proof type. + * This can be stored in the client and used to validate any incoming proofs. + * + * verify(ProofSpec, Proof) -> Proof | Error + * + * As demonstrated in tests, if we don't fix the algorithm used to calculate the + * LeafHash for a given tree, there are many possible key-value pairs that can + * generate a given hash (by interpretting the preimage differently). + * We need this for proper security, requires client knows a priori what + * tree format server uses. But not in code, rather a configuration object. + */ +export interface ProofSpecSDKType { + leaf_spec?: LeafOpSDKType; + inner_spec?: InnerSpecSDKType; + max_depth: number; + min_depth: number; +} +/** + * InnerSpec contains all store-specific structure info to determine if two proofs from a + * given store are neighbors. + * + * This enables: + * + * isLeftMost(spec: InnerSpec, op: InnerOp) + * isRightMost(spec: InnerSpec, op: InnerOp) + * isLeftNeighbor(spec: InnerSpec, left: InnerOp, right: InnerOp) + */ +export interface InnerSpec { + /** + * Child order is the ordering of the children node, must count from 0 + * iavl tree is [0, 1] (left then right) + * merk is [0, 2, 1] (left, right, here) + */ + childOrder: number[]; + childSize: number; + minPrefixLength: number; + maxPrefixLength: number; + /** empty child is the prehash image that is used when one child is nil (eg. 20 bytes of 0) */ + emptyChild: Uint8Array; + /** hash is the algorithm that must be used for each InnerOp */ + hash: HashOp; +} +export interface InnerSpecProtoMsg { + typeUrl: '/ics23.InnerSpec'; + value: Uint8Array; +} +/** + * InnerSpec contains all store-specific structure info to determine if two proofs from a + * given store are neighbors. + * + * This enables: + * + * isLeftMost(spec: InnerSpec, op: InnerOp) + * isRightMost(spec: InnerSpec, op: InnerOp) + * isLeftNeighbor(spec: InnerSpec, left: InnerOp, right: InnerOp) + */ +export interface InnerSpecSDKType { + child_order: number[]; + child_size: number; + min_prefix_length: number; + max_prefix_length: number; + empty_child: Uint8Array; + hash: HashOp; +} +/** BatchProof is a group of multiple proof types than can be compressed */ +export interface BatchProof { + entries: BatchEntry[]; +} +export interface BatchProofProtoMsg { + typeUrl: '/ics23.BatchProof'; + value: Uint8Array; +} +/** BatchProof is a group of multiple proof types than can be compressed */ +export interface BatchProofSDKType { + entries: BatchEntrySDKType[]; +} +/** Use BatchEntry not CommitmentProof, to avoid recursion */ +export interface BatchEntry { + exist?: ExistenceProof; + nonexist?: NonExistenceProof; +} +export interface BatchEntryProtoMsg { + typeUrl: '/ics23.BatchEntry'; + value: Uint8Array; +} +/** Use BatchEntry not CommitmentProof, to avoid recursion */ +export interface BatchEntrySDKType { + exist?: ExistenceProofSDKType; + nonexist?: NonExistenceProofSDKType; +} +export interface CompressedBatchProof { + entries: CompressedBatchEntry[]; + lookupInners: InnerOp[]; +} +export interface CompressedBatchProofProtoMsg { + typeUrl: '/ics23.CompressedBatchProof'; + value: Uint8Array; +} +export interface CompressedBatchProofSDKType { + entries: CompressedBatchEntrySDKType[]; + lookup_inners: InnerOpSDKType[]; +} +/** Use BatchEntry not CommitmentProof, to avoid recursion */ +export interface CompressedBatchEntry { + exist?: CompressedExistenceProof; + nonexist?: CompressedNonExistenceProof; +} +export interface CompressedBatchEntryProtoMsg { + typeUrl: '/ics23.CompressedBatchEntry'; + value: Uint8Array; +} +/** Use BatchEntry not CommitmentProof, to avoid recursion */ +export interface CompressedBatchEntrySDKType { + exist?: CompressedExistenceProofSDKType; + nonexist?: CompressedNonExistenceProofSDKType; +} +export interface CompressedExistenceProof { + key: Uint8Array; + value: Uint8Array; + leaf?: LeafOp; + /** these are indexes into the lookup_inners table in CompressedBatchProof */ + path: number[]; +} +export interface CompressedExistenceProofProtoMsg { + typeUrl: '/ics23.CompressedExistenceProof'; + value: Uint8Array; +} +export interface CompressedExistenceProofSDKType { + key: Uint8Array; + value: Uint8Array; + leaf?: LeafOpSDKType; + path: number[]; +} +export interface CompressedNonExistenceProof { + /** TODO: remove this as unnecessary??? we prove a range */ + key: Uint8Array; + left?: CompressedExistenceProof; + right?: CompressedExistenceProof; +} +export interface CompressedNonExistenceProofProtoMsg { + typeUrl: '/ics23.CompressedNonExistenceProof'; + value: Uint8Array; +} +export interface CompressedNonExistenceProofSDKType { + key: Uint8Array; + left?: CompressedExistenceProofSDKType; + right?: CompressedExistenceProofSDKType; +} +function createBaseExistenceProof(): ExistenceProof { + return { + key: new Uint8Array(), + value: new Uint8Array(), + leaf: undefined, + path: [], + }; +} +export const ExistenceProof = { + typeUrl: '/ics23.ExistenceProof', + encode( + message: ExistenceProof, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } + if (message.leaf !== undefined) { + LeafOp.encode(message.leaf, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.path) { + InnerOp.encode(v!, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ExistenceProof { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExistenceProof(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.bytes(); + break; + case 2: + message.value = reader.bytes(); + break; + case 3: + message.leaf = LeafOp.decode(reader, reader.uint32()); + break; + case 4: + message.path.push(InnerOp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): ExistenceProof { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(), + value: isSet(object.value) + ? bytesFromBase64(object.value) + : new Uint8Array(), + leaf: isSet(object.leaf) ? LeafOp.fromJSON(object.leaf) : undefined, + path: Array.isArray(object?.path) + ? object.path.map((e: any) => InnerOp.fromJSON(e)) + : [], + }; + }, + toJSON(message: ExistenceProof): unknown { + const obj: any = {}; + message.key !== undefined && + (obj.key = base64FromBytes( + message.key !== undefined ? message.key : new Uint8Array(), + )); + message.value !== undefined && + (obj.value = base64FromBytes( + message.value !== undefined ? message.value : new Uint8Array(), + )); + message.leaf !== undefined && + (obj.leaf = message.leaf ? LeafOp.toJSON(message.leaf) : undefined); + if (message.path) { + obj.path = message.path.map(e => (e ? InnerOp.toJSON(e) : undefined)); + } else { + obj.path = []; + } + return obj; + }, + fromPartial(object: Partial): ExistenceProof { + const message = createBaseExistenceProof(); + message.key = object.key ?? new Uint8Array(); + message.value = object.value ?? new Uint8Array(); + message.leaf = + object.leaf !== undefined && object.leaf !== null + ? LeafOp.fromPartial(object.leaf) + : undefined; + message.path = object.path?.map(e => InnerOp.fromPartial(e)) || []; + return message; + }, + fromProtoMsg(message: ExistenceProofProtoMsg): ExistenceProof { + return ExistenceProof.decode(message.value); + }, + toProto(message: ExistenceProof): Uint8Array { + return ExistenceProof.encode(message).finish(); + }, + toProtoMsg(message: ExistenceProof): ExistenceProofProtoMsg { + return { + typeUrl: '/ics23.ExistenceProof', + value: ExistenceProof.encode(message).finish(), + }; + }, +}; +function createBaseNonExistenceProof(): NonExistenceProof { + return { + key: new Uint8Array(), + left: undefined, + right: undefined, + }; +} +export const NonExistenceProof = { + typeUrl: '/ics23.NonExistenceProof', + encode( + message: NonExistenceProof, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.left !== undefined) { + ExistenceProof.encode(message.left, writer.uint32(18).fork()).ldelim(); + } + if (message.right !== undefined) { + ExistenceProof.encode(message.right, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): NonExistenceProof { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNonExistenceProof(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.bytes(); + break; + case 2: + message.left = ExistenceProof.decode(reader, reader.uint32()); + break; + case 3: + message.right = ExistenceProof.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): NonExistenceProof { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(), + left: isSet(object.left) + ? ExistenceProof.fromJSON(object.left) + : undefined, + right: isSet(object.right) + ? ExistenceProof.fromJSON(object.right) + : undefined, + }; + }, + toJSON(message: NonExistenceProof): unknown { + const obj: any = {}; + message.key !== undefined && + (obj.key = base64FromBytes( + message.key !== undefined ? message.key : new Uint8Array(), + )); + message.left !== undefined && + (obj.left = message.left + ? ExistenceProof.toJSON(message.left) + : undefined); + message.right !== undefined && + (obj.right = message.right + ? ExistenceProof.toJSON(message.right) + : undefined); + return obj; + }, + fromPartial(object: Partial): NonExistenceProof { + const message = createBaseNonExistenceProof(); + message.key = object.key ?? new Uint8Array(); + message.left = + object.left !== undefined && object.left !== null + ? ExistenceProof.fromPartial(object.left) + : undefined; + message.right = + object.right !== undefined && object.right !== null + ? ExistenceProof.fromPartial(object.right) + : undefined; + return message; + }, + fromProtoMsg(message: NonExistenceProofProtoMsg): NonExistenceProof { + return NonExistenceProof.decode(message.value); + }, + toProto(message: NonExistenceProof): Uint8Array { + return NonExistenceProof.encode(message).finish(); + }, + toProtoMsg(message: NonExistenceProof): NonExistenceProofProtoMsg { + return { + typeUrl: '/ics23.NonExistenceProof', + value: NonExistenceProof.encode(message).finish(), + }; + }, +}; +function createBaseCommitmentProof(): CommitmentProof { + return { + exist: undefined, + nonexist: undefined, + batch: undefined, + compressed: undefined, + }; +} +export const CommitmentProof = { + typeUrl: '/ics23.CommitmentProof', + encode( + message: CommitmentProof, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.exist !== undefined) { + ExistenceProof.encode(message.exist, writer.uint32(10).fork()).ldelim(); + } + if (message.nonexist !== undefined) { + NonExistenceProof.encode( + message.nonexist, + writer.uint32(18).fork(), + ).ldelim(); + } + if (message.batch !== undefined) { + BatchProof.encode(message.batch, writer.uint32(26).fork()).ldelim(); + } + if (message.compressed !== undefined) { + CompressedBatchProof.encode( + message.compressed, + writer.uint32(34).fork(), + ).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): CommitmentProof { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitmentProof(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.exist = ExistenceProof.decode(reader, reader.uint32()); + break; + case 2: + message.nonexist = NonExistenceProof.decode(reader, reader.uint32()); + break; + case 3: + message.batch = BatchProof.decode(reader, reader.uint32()); + break; + case 4: + message.compressed = CompressedBatchProof.decode( + reader, + reader.uint32(), + ); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): CommitmentProof { + return { + exist: isSet(object.exist) + ? ExistenceProof.fromJSON(object.exist) + : undefined, + nonexist: isSet(object.nonexist) + ? NonExistenceProof.fromJSON(object.nonexist) + : undefined, + batch: isSet(object.batch) + ? BatchProof.fromJSON(object.batch) + : undefined, + compressed: isSet(object.compressed) + ? CompressedBatchProof.fromJSON(object.compressed) + : undefined, + }; + }, + toJSON(message: CommitmentProof): unknown { + const obj: any = {}; + message.exist !== undefined && + (obj.exist = message.exist + ? ExistenceProof.toJSON(message.exist) + : undefined); + message.nonexist !== undefined && + (obj.nonexist = message.nonexist + ? NonExistenceProof.toJSON(message.nonexist) + : undefined); + message.batch !== undefined && + (obj.batch = message.batch + ? BatchProof.toJSON(message.batch) + : undefined); + message.compressed !== undefined && + (obj.compressed = message.compressed + ? CompressedBatchProof.toJSON(message.compressed) + : undefined); + return obj; + }, + fromPartial(object: Partial): CommitmentProof { + const message = createBaseCommitmentProof(); + message.exist = + object.exist !== undefined && object.exist !== null + ? ExistenceProof.fromPartial(object.exist) + : undefined; + message.nonexist = + object.nonexist !== undefined && object.nonexist !== null + ? NonExistenceProof.fromPartial(object.nonexist) + : undefined; + message.batch = + object.batch !== undefined && object.batch !== null + ? BatchProof.fromPartial(object.batch) + : undefined; + message.compressed = + object.compressed !== undefined && object.compressed !== null + ? CompressedBatchProof.fromPartial(object.compressed) + : undefined; + return message; + }, + fromProtoMsg(message: CommitmentProofProtoMsg): CommitmentProof { + return CommitmentProof.decode(message.value); + }, + toProto(message: CommitmentProof): Uint8Array { + return CommitmentProof.encode(message).finish(); + }, + toProtoMsg(message: CommitmentProof): CommitmentProofProtoMsg { + return { + typeUrl: '/ics23.CommitmentProof', + value: CommitmentProof.encode(message).finish(), + }; + }, +}; +function createBaseLeafOp(): LeafOp { + return { + hash: 0, + prehashKey: 0, + prehashValue: 0, + length: 0, + prefix: new Uint8Array(), + }; +} +export const LeafOp = { + typeUrl: '/ics23.LeafOp', + encode( + message: LeafOp, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.hash !== 0) { + writer.uint32(8).int32(message.hash); + } + if (message.prehashKey !== 0) { + writer.uint32(16).int32(message.prehashKey); + } + if (message.prehashValue !== 0) { + writer.uint32(24).int32(message.prehashValue); + } + if (message.length !== 0) { + writer.uint32(32).int32(message.length); + } + if (message.prefix.length !== 0) { + writer.uint32(42).bytes(message.prefix); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): LeafOp { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLeafOp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.hash = reader.int32() as any; + break; + case 2: + message.prehashKey = reader.int32() as any; + break; + case 3: + message.prehashValue = reader.int32() as any; + break; + case 4: + message.length = reader.int32() as any; + break; + case 5: + message.prefix = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): LeafOp { + return { + hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : -1, + prehashKey: isSet(object.prehashKey) + ? hashOpFromJSON(object.prehashKey) + : -1, + prehashValue: isSet(object.prehashValue) + ? hashOpFromJSON(object.prehashValue) + : -1, + length: isSet(object.length) ? lengthOpFromJSON(object.length) : -1, + prefix: isSet(object.prefix) + ? bytesFromBase64(object.prefix) + : new Uint8Array(), + }; + }, + toJSON(message: LeafOp): unknown { + const obj: any = {}; + message.hash !== undefined && (obj.hash = hashOpToJSON(message.hash)); + message.prehashKey !== undefined && + (obj.prehashKey = hashOpToJSON(message.prehashKey)); + message.prehashValue !== undefined && + (obj.prehashValue = hashOpToJSON(message.prehashValue)); + message.length !== undefined && + (obj.length = lengthOpToJSON(message.length)); + message.prefix !== undefined && + (obj.prefix = base64FromBytes( + message.prefix !== undefined ? message.prefix : new Uint8Array(), + )); + return obj; + }, + fromPartial(object: Partial): LeafOp { + const message = createBaseLeafOp(); + message.hash = object.hash ?? 0; + message.prehashKey = object.prehashKey ?? 0; + message.prehashValue = object.prehashValue ?? 0; + message.length = object.length ?? 0; + message.prefix = object.prefix ?? new Uint8Array(); + return message; + }, + fromProtoMsg(message: LeafOpProtoMsg): LeafOp { + return LeafOp.decode(message.value); + }, + toProto(message: LeafOp): Uint8Array { + return LeafOp.encode(message).finish(); + }, + toProtoMsg(message: LeafOp): LeafOpProtoMsg { + return { + typeUrl: '/ics23.LeafOp', + value: LeafOp.encode(message).finish(), + }; + }, +}; +function createBaseInnerOp(): InnerOp { + return { + hash: 0, + prefix: new Uint8Array(), + suffix: new Uint8Array(), + }; +} +export const InnerOp = { + typeUrl: '/ics23.InnerOp', + encode( + message: InnerOp, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.hash !== 0) { + writer.uint32(8).int32(message.hash); + } + if (message.prefix.length !== 0) { + writer.uint32(18).bytes(message.prefix); + } + if (message.suffix.length !== 0) { + writer.uint32(26).bytes(message.suffix); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): InnerOp { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInnerOp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.hash = reader.int32() as any; + break; + case 2: + message.prefix = reader.bytes(); + break; + case 3: + message.suffix = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): InnerOp { + return { + hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : -1, + prefix: isSet(object.prefix) + ? bytesFromBase64(object.prefix) + : new Uint8Array(), + suffix: isSet(object.suffix) + ? bytesFromBase64(object.suffix) + : new Uint8Array(), + }; + }, + toJSON(message: InnerOp): unknown { + const obj: any = {}; + message.hash !== undefined && (obj.hash = hashOpToJSON(message.hash)); + message.prefix !== undefined && + (obj.prefix = base64FromBytes( + message.prefix !== undefined ? message.prefix : new Uint8Array(), + )); + message.suffix !== undefined && + (obj.suffix = base64FromBytes( + message.suffix !== undefined ? message.suffix : new Uint8Array(), + )); + return obj; + }, + fromPartial(object: Partial): InnerOp { + const message = createBaseInnerOp(); + message.hash = object.hash ?? 0; + message.prefix = object.prefix ?? new Uint8Array(); + message.suffix = object.suffix ?? new Uint8Array(); + return message; + }, + fromProtoMsg(message: InnerOpProtoMsg): InnerOp { + return InnerOp.decode(message.value); + }, + toProto(message: InnerOp): Uint8Array { + return InnerOp.encode(message).finish(); + }, + toProtoMsg(message: InnerOp): InnerOpProtoMsg { + return { + typeUrl: '/ics23.InnerOp', + value: InnerOp.encode(message).finish(), + }; + }, +}; +function createBaseProofSpec(): ProofSpec { + return { + leafSpec: undefined, + innerSpec: undefined, + maxDepth: 0, + minDepth: 0, + }; +} +export const ProofSpec = { + typeUrl: '/ics23.ProofSpec', + encode( + message: ProofSpec, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.leafSpec !== undefined) { + LeafOp.encode(message.leafSpec, writer.uint32(10).fork()).ldelim(); + } + if (message.innerSpec !== undefined) { + InnerSpec.encode(message.innerSpec, writer.uint32(18).fork()).ldelim(); + } + if (message.maxDepth !== 0) { + writer.uint32(24).int32(message.maxDepth); + } + if (message.minDepth !== 0) { + writer.uint32(32).int32(message.minDepth); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ProofSpec { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProofSpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.leafSpec = LeafOp.decode(reader, reader.uint32()); + break; + case 2: + message.innerSpec = InnerSpec.decode(reader, reader.uint32()); + break; + case 3: + message.maxDepth = reader.int32(); + break; + case 4: + message.minDepth = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): ProofSpec { + return { + leafSpec: isSet(object.leafSpec) + ? LeafOp.fromJSON(object.leafSpec) + : undefined, + innerSpec: isSet(object.innerSpec) + ? InnerSpec.fromJSON(object.innerSpec) + : undefined, + maxDepth: isSet(object.maxDepth) ? Number(object.maxDepth) : 0, + minDepth: isSet(object.minDepth) ? Number(object.minDepth) : 0, + }; + }, + toJSON(message: ProofSpec): unknown { + const obj: any = {}; + message.leafSpec !== undefined && + (obj.leafSpec = message.leafSpec + ? LeafOp.toJSON(message.leafSpec) + : undefined); + message.innerSpec !== undefined && + (obj.innerSpec = message.innerSpec + ? InnerSpec.toJSON(message.innerSpec) + : undefined); + message.maxDepth !== undefined && + (obj.maxDepth = Math.round(message.maxDepth)); + message.minDepth !== undefined && + (obj.minDepth = Math.round(message.minDepth)); + return obj; + }, + fromPartial(object: Partial): ProofSpec { + const message = createBaseProofSpec(); + message.leafSpec = + object.leafSpec !== undefined && object.leafSpec !== null + ? LeafOp.fromPartial(object.leafSpec) + : undefined; + message.innerSpec = + object.innerSpec !== undefined && object.innerSpec !== null + ? InnerSpec.fromPartial(object.innerSpec) + : undefined; + message.maxDepth = object.maxDepth ?? 0; + message.minDepth = object.minDepth ?? 0; + return message; + }, + fromProtoMsg(message: ProofSpecProtoMsg): ProofSpec { + return ProofSpec.decode(message.value); + }, + toProto(message: ProofSpec): Uint8Array { + return ProofSpec.encode(message).finish(); + }, + toProtoMsg(message: ProofSpec): ProofSpecProtoMsg { + return { + typeUrl: '/ics23.ProofSpec', + value: ProofSpec.encode(message).finish(), + }; + }, +}; +function createBaseInnerSpec(): InnerSpec { + return { + childOrder: [], + childSize: 0, + minPrefixLength: 0, + maxPrefixLength: 0, + emptyChild: new Uint8Array(), + hash: 0, + }; +} +export const InnerSpec = { + typeUrl: '/ics23.InnerSpec', + encode( + message: InnerSpec, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + writer.uint32(10).fork(); + for (const v of message.childOrder) { + writer.int32(v); + } + writer.ldelim(); + if (message.childSize !== 0) { + writer.uint32(16).int32(message.childSize); + } + if (message.minPrefixLength !== 0) { + writer.uint32(24).int32(message.minPrefixLength); + } + if (message.maxPrefixLength !== 0) { + writer.uint32(32).int32(message.maxPrefixLength); + } + if (message.emptyChild.length !== 0) { + writer.uint32(42).bytes(message.emptyChild); + } + if (message.hash !== 0) { + writer.uint32(48).int32(message.hash); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): InnerSpec { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInnerSpec(); + 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.childOrder.push(reader.int32()); + } + } else { + message.childOrder.push(reader.int32()); + } + break; + case 2: + message.childSize = reader.int32(); + break; + case 3: + message.minPrefixLength = reader.int32(); + break; + case 4: + message.maxPrefixLength = reader.int32(); + break; + case 5: + message.emptyChild = reader.bytes(); + break; + case 6: + message.hash = reader.int32() as any; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): InnerSpec { + return { + childOrder: Array.isArray(object?.childOrder) + ? object.childOrder.map((e: any) => Number(e)) + : [], + childSize: isSet(object.childSize) ? Number(object.childSize) : 0, + minPrefixLength: isSet(object.minPrefixLength) + ? Number(object.minPrefixLength) + : 0, + maxPrefixLength: isSet(object.maxPrefixLength) + ? Number(object.maxPrefixLength) + : 0, + emptyChild: isSet(object.emptyChild) + ? bytesFromBase64(object.emptyChild) + : new Uint8Array(), + hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : -1, + }; + }, + toJSON(message: InnerSpec): unknown { + const obj: any = {}; + if (message.childOrder) { + obj.childOrder = message.childOrder.map(e => Math.round(e)); + } else { + obj.childOrder = []; + } + message.childSize !== undefined && + (obj.childSize = Math.round(message.childSize)); + message.minPrefixLength !== undefined && + (obj.minPrefixLength = Math.round(message.minPrefixLength)); + message.maxPrefixLength !== undefined && + (obj.maxPrefixLength = Math.round(message.maxPrefixLength)); + message.emptyChild !== undefined && + (obj.emptyChild = base64FromBytes( + message.emptyChild !== undefined + ? message.emptyChild + : new Uint8Array(), + )); + message.hash !== undefined && (obj.hash = hashOpToJSON(message.hash)); + return obj; + }, + fromPartial(object: Partial): InnerSpec { + const message = createBaseInnerSpec(); + message.childOrder = object.childOrder?.map(e => e) || []; + message.childSize = object.childSize ?? 0; + message.minPrefixLength = object.minPrefixLength ?? 0; + message.maxPrefixLength = object.maxPrefixLength ?? 0; + message.emptyChild = object.emptyChild ?? new Uint8Array(); + message.hash = object.hash ?? 0; + return message; + }, + fromProtoMsg(message: InnerSpecProtoMsg): InnerSpec { + return InnerSpec.decode(message.value); + }, + toProto(message: InnerSpec): Uint8Array { + return InnerSpec.encode(message).finish(); + }, + toProtoMsg(message: InnerSpec): InnerSpecProtoMsg { + return { + typeUrl: '/ics23.InnerSpec', + value: InnerSpec.encode(message).finish(), + }; + }, +}; +function createBaseBatchProof(): BatchProof { + return { + entries: [], + }; +} +export const BatchProof = { + typeUrl: '/ics23.BatchProof', + encode( + message: BatchProof, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + for (const v of message.entries) { + BatchEntry.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): BatchProof { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBatchProof(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.entries.push(BatchEntry.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): BatchProof { + return { + entries: Array.isArray(object?.entries) + ? object.entries.map((e: any) => BatchEntry.fromJSON(e)) + : [], + }; + }, + toJSON(message: BatchProof): unknown { + const obj: any = {}; + if (message.entries) { + obj.entries = message.entries.map(e => + e ? BatchEntry.toJSON(e) : undefined, + ); + } else { + obj.entries = []; + } + return obj; + }, + fromPartial(object: Partial): BatchProof { + const message = createBaseBatchProof(); + message.entries = object.entries?.map(e => BatchEntry.fromPartial(e)) || []; + return message; + }, + fromProtoMsg(message: BatchProofProtoMsg): BatchProof { + return BatchProof.decode(message.value); + }, + toProto(message: BatchProof): Uint8Array { + return BatchProof.encode(message).finish(); + }, + toProtoMsg(message: BatchProof): BatchProofProtoMsg { + return { + typeUrl: '/ics23.BatchProof', + value: BatchProof.encode(message).finish(), + }; + }, +}; +function createBaseBatchEntry(): BatchEntry { + return { + exist: undefined, + nonexist: undefined, + }; +} +export const BatchEntry = { + typeUrl: '/ics23.BatchEntry', + encode( + message: BatchEntry, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.exist !== undefined) { + ExistenceProof.encode(message.exist, writer.uint32(10).fork()).ldelim(); + } + if (message.nonexist !== undefined) { + NonExistenceProof.encode( + message.nonexist, + writer.uint32(18).fork(), + ).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): BatchEntry { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBatchEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.exist = ExistenceProof.decode(reader, reader.uint32()); + break; + case 2: + message.nonexist = NonExistenceProof.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): BatchEntry { + return { + exist: isSet(object.exist) + ? ExistenceProof.fromJSON(object.exist) + : undefined, + nonexist: isSet(object.nonexist) + ? NonExistenceProof.fromJSON(object.nonexist) + : undefined, + }; + }, + toJSON(message: BatchEntry): unknown { + const obj: any = {}; + message.exist !== undefined && + (obj.exist = message.exist + ? ExistenceProof.toJSON(message.exist) + : undefined); + message.nonexist !== undefined && + (obj.nonexist = message.nonexist + ? NonExistenceProof.toJSON(message.nonexist) + : undefined); + return obj; + }, + fromPartial(object: Partial): BatchEntry { + const message = createBaseBatchEntry(); + message.exist = + object.exist !== undefined && object.exist !== null + ? ExistenceProof.fromPartial(object.exist) + : undefined; + message.nonexist = + object.nonexist !== undefined && object.nonexist !== null + ? NonExistenceProof.fromPartial(object.nonexist) + : undefined; + return message; + }, + fromProtoMsg(message: BatchEntryProtoMsg): BatchEntry { + return BatchEntry.decode(message.value); + }, + toProto(message: BatchEntry): Uint8Array { + return BatchEntry.encode(message).finish(); + }, + toProtoMsg(message: BatchEntry): BatchEntryProtoMsg { + return { + typeUrl: '/ics23.BatchEntry', + value: BatchEntry.encode(message).finish(), + }; + }, +}; +function createBaseCompressedBatchProof(): CompressedBatchProof { + return { + entries: [], + lookupInners: [], + }; +} +export const CompressedBatchProof = { + typeUrl: '/ics23.CompressedBatchProof', + encode( + message: CompressedBatchProof, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + for (const v of message.entries) { + CompressedBatchEntry.encode(v!, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.lookupInners) { + InnerOp.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): CompressedBatchProof { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCompressedBatchProof(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.entries.push( + CompressedBatchEntry.decode(reader, reader.uint32()), + ); + break; + case 2: + message.lookupInners.push(InnerOp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): CompressedBatchProof { + return { + entries: Array.isArray(object?.entries) + ? object.entries.map((e: any) => CompressedBatchEntry.fromJSON(e)) + : [], + lookupInners: Array.isArray(object?.lookupInners) + ? object.lookupInners.map((e: any) => InnerOp.fromJSON(e)) + : [], + }; + }, + toJSON(message: CompressedBatchProof): unknown { + const obj: any = {}; + if (message.entries) { + obj.entries = message.entries.map(e => + e ? CompressedBatchEntry.toJSON(e) : undefined, + ); + } else { + obj.entries = []; + } + if (message.lookupInners) { + obj.lookupInners = message.lookupInners.map(e => + e ? InnerOp.toJSON(e) : undefined, + ); + } else { + obj.lookupInners = []; + } + return obj; + }, + fromPartial(object: Partial): CompressedBatchProof { + const message = createBaseCompressedBatchProof(); + message.entries = + object.entries?.map(e => CompressedBatchEntry.fromPartial(e)) || []; + message.lookupInners = + object.lookupInners?.map(e => InnerOp.fromPartial(e)) || []; + return message; + }, + fromProtoMsg(message: CompressedBatchProofProtoMsg): CompressedBatchProof { + return CompressedBatchProof.decode(message.value); + }, + toProto(message: CompressedBatchProof): Uint8Array { + return CompressedBatchProof.encode(message).finish(); + }, + toProtoMsg(message: CompressedBatchProof): CompressedBatchProofProtoMsg { + return { + typeUrl: '/ics23.CompressedBatchProof', + value: CompressedBatchProof.encode(message).finish(), + }; + }, +}; +function createBaseCompressedBatchEntry(): CompressedBatchEntry { + return { + exist: undefined, + nonexist: undefined, + }; +} +export const CompressedBatchEntry = { + typeUrl: '/ics23.CompressedBatchEntry', + encode( + message: CompressedBatchEntry, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.exist !== undefined) { + CompressedExistenceProof.encode( + message.exist, + writer.uint32(10).fork(), + ).ldelim(); + } + if (message.nonexist !== undefined) { + CompressedNonExistenceProof.encode( + message.nonexist, + writer.uint32(18).fork(), + ).ldelim(); + } + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): CompressedBatchEntry { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCompressedBatchEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.exist = CompressedExistenceProof.decode( + reader, + reader.uint32(), + ); + break; + case 2: + message.nonexist = CompressedNonExistenceProof.decode( + reader, + reader.uint32(), + ); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): CompressedBatchEntry { + return { + exist: isSet(object.exist) + ? CompressedExistenceProof.fromJSON(object.exist) + : undefined, + nonexist: isSet(object.nonexist) + ? CompressedNonExistenceProof.fromJSON(object.nonexist) + : undefined, + }; + }, + toJSON(message: CompressedBatchEntry): unknown { + const obj: any = {}; + message.exist !== undefined && + (obj.exist = message.exist + ? CompressedExistenceProof.toJSON(message.exist) + : undefined); + message.nonexist !== undefined && + (obj.nonexist = message.nonexist + ? CompressedNonExistenceProof.toJSON(message.nonexist) + : undefined); + return obj; + }, + fromPartial(object: Partial): CompressedBatchEntry { + const message = createBaseCompressedBatchEntry(); + message.exist = + object.exist !== undefined && object.exist !== null + ? CompressedExistenceProof.fromPartial(object.exist) + : undefined; + message.nonexist = + object.nonexist !== undefined && object.nonexist !== null + ? CompressedNonExistenceProof.fromPartial(object.nonexist) + : undefined; + return message; + }, + fromProtoMsg(message: CompressedBatchEntryProtoMsg): CompressedBatchEntry { + return CompressedBatchEntry.decode(message.value); + }, + toProto(message: CompressedBatchEntry): Uint8Array { + return CompressedBatchEntry.encode(message).finish(); + }, + toProtoMsg(message: CompressedBatchEntry): CompressedBatchEntryProtoMsg { + return { + typeUrl: '/ics23.CompressedBatchEntry', + value: CompressedBatchEntry.encode(message).finish(), + }; + }, +}; +function createBaseCompressedExistenceProof(): CompressedExistenceProof { + return { + key: new Uint8Array(), + value: new Uint8Array(), + leaf: undefined, + path: [], + }; +} +export const CompressedExistenceProof = { + typeUrl: '/ics23.CompressedExistenceProof', + encode( + message: CompressedExistenceProof, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } + if (message.leaf !== undefined) { + LeafOp.encode(message.leaf, writer.uint32(26).fork()).ldelim(); + } + writer.uint32(34).fork(); + for (const v of message.path) { + writer.int32(v); + } + writer.ldelim(); + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): CompressedExistenceProof { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCompressedExistenceProof(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.bytes(); + break; + case 2: + message.value = reader.bytes(); + break; + case 3: + message.leaf = LeafOp.decode(reader, reader.uint32()); + break; + case 4: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.path.push(reader.int32()); + } + } else { + message.path.push(reader.int32()); + } + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): CompressedExistenceProof { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(), + value: isSet(object.value) + ? bytesFromBase64(object.value) + : new Uint8Array(), + leaf: isSet(object.leaf) ? LeafOp.fromJSON(object.leaf) : undefined, + path: Array.isArray(object?.path) + ? object.path.map((e: any) => Number(e)) + : [], + }; + }, + toJSON(message: CompressedExistenceProof): unknown { + const obj: any = {}; + message.key !== undefined && + (obj.key = base64FromBytes( + message.key !== undefined ? message.key : new Uint8Array(), + )); + message.value !== undefined && + (obj.value = base64FromBytes( + message.value !== undefined ? message.value : new Uint8Array(), + )); + message.leaf !== undefined && + (obj.leaf = message.leaf ? LeafOp.toJSON(message.leaf) : undefined); + if (message.path) { + obj.path = message.path.map(e => Math.round(e)); + } else { + obj.path = []; + } + return obj; + }, + fromPartial( + object: Partial, + ): CompressedExistenceProof { + const message = createBaseCompressedExistenceProof(); + message.key = object.key ?? new Uint8Array(); + message.value = object.value ?? new Uint8Array(); + message.leaf = + object.leaf !== undefined && object.leaf !== null + ? LeafOp.fromPartial(object.leaf) + : undefined; + message.path = object.path?.map(e => e) || []; + return message; + }, + fromProtoMsg( + message: CompressedExistenceProofProtoMsg, + ): CompressedExistenceProof { + return CompressedExistenceProof.decode(message.value); + }, + toProto(message: CompressedExistenceProof): Uint8Array { + return CompressedExistenceProof.encode(message).finish(); + }, + toProtoMsg( + message: CompressedExistenceProof, + ): CompressedExistenceProofProtoMsg { + return { + typeUrl: '/ics23.CompressedExistenceProof', + value: CompressedExistenceProof.encode(message).finish(), + }; + }, +}; +function createBaseCompressedNonExistenceProof(): CompressedNonExistenceProof { + return { + key: new Uint8Array(), + left: undefined, + right: undefined, + }; +} +export const CompressedNonExistenceProof = { + typeUrl: '/ics23.CompressedNonExistenceProof', + encode( + message: CompressedNonExistenceProof, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.left !== undefined) { + CompressedExistenceProof.encode( + message.left, + writer.uint32(18).fork(), + ).ldelim(); + } + if (message.right !== undefined) { + CompressedExistenceProof.encode( + message.right, + writer.uint32(26).fork(), + ).ldelim(); + } + return writer; + }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): CompressedNonExistenceProof { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCompressedNonExistenceProof(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.bytes(); + break; + case 2: + message.left = CompressedExistenceProof.decode( + reader, + reader.uint32(), + ); + break; + case 3: + message.right = CompressedExistenceProof.decode( + reader, + reader.uint32(), + ); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): CompressedNonExistenceProof { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(), + left: isSet(object.left) + ? CompressedExistenceProof.fromJSON(object.left) + : undefined, + right: isSet(object.right) + ? CompressedExistenceProof.fromJSON(object.right) + : undefined, + }; + }, + toJSON(message: CompressedNonExistenceProof): unknown { + const obj: any = {}; + message.key !== undefined && + (obj.key = base64FromBytes( + message.key !== undefined ? message.key : new Uint8Array(), + )); + message.left !== undefined && + (obj.left = message.left + ? CompressedExistenceProof.toJSON(message.left) + : undefined); + message.right !== undefined && + (obj.right = message.right + ? CompressedExistenceProof.toJSON(message.right) + : undefined); + return obj; + }, + fromPartial( + object: Partial, + ): CompressedNonExistenceProof { + const message = createBaseCompressedNonExistenceProof(); + message.key = object.key ?? new Uint8Array(); + message.left = + object.left !== undefined && object.left !== null + ? CompressedExistenceProof.fromPartial(object.left) + : undefined; + message.right = + object.right !== undefined && object.right !== null + ? CompressedExistenceProof.fromPartial(object.right) + : undefined; + return message; + }, + fromProtoMsg( + message: CompressedNonExistenceProofProtoMsg, + ): CompressedNonExistenceProof { + return CompressedNonExistenceProof.decode(message.value); + }, + toProto(message: CompressedNonExistenceProof): Uint8Array { + return CompressedNonExistenceProof.encode(message).finish(); + }, + toProtoMsg( + message: CompressedNonExistenceProof, + ): CompressedNonExistenceProofProtoMsg { + return { + typeUrl: '/ics23.CompressedNonExistenceProof', + value: CompressedNonExistenceProof.encode(message).finish(), + }; + }, +}; diff --git a/packages/cosmic-proto/src/codegen/tendermint/bundle.ts b/packages/cosmic-proto/src/codegen/tendermint/bundle.ts index 296c848c91d..e5033961e08 100644 --- a/packages/cosmic-proto/src/codegen/tendermint/bundle.ts +++ b/packages/cosmic-proto/src/codegen/tendermint/bundle.ts @@ -1,39 +1,39 @@ //@ts-nocheck -import * as _88 from './abci/types.js'; -import * as _89 from './crypto/keys.js'; -import * as _90 from './crypto/proof.js'; -import * as _91 from './libs/bits/types.js'; -import * as _92 from './p2p/types.js'; -import * as _93 from './types/block.js'; -import * as _94 from './types/evidence.js'; -import * as _95 from './types/params.js'; -import * as _96 from './types/types.js'; -import * as _97 from './types/validator.js'; -import * as _98 from './version/types.js'; +import * as _119 from './abci/types.js'; +import * as _120 from './crypto/keys.js'; +import * as _121 from './crypto/proof.js'; +import * as _122 from './libs/bits/types.js'; +import * as _123 from './p2p/types.js'; +import * as _124 from './types/block.js'; +import * as _125 from './types/evidence.js'; +import * as _126 from './types/params.js'; +import * as _127 from './types/types.js'; +import * as _128 from './types/validator.js'; +import * as _129 from './version/types.js'; export namespace tendermint { export const abci = { - ..._88, + ..._119, }; export const crypto = { - ..._89, - ..._90, + ..._120, + ..._121, }; export namespace libs { export const bits = { - ..._91, + ..._122, }; } export const p2p = { - ..._92, + ..._123, }; export const types = { - ..._93, - ..._94, - ..._95, - ..._96, - ..._97, + ..._124, + ..._125, + ..._126, + ..._127, + ..._128, }; export const version = { - ..._98, + ..._129, }; } diff --git a/packages/cosmic-proto/test/snapshots/test-exports.js.md b/packages/cosmic-proto/test/snapshots/test-exports.js.md index 11890826051..33dcdb4d395 100644 --- a/packages/cosmic-proto/test/snapshots/test-exports.js.md +++ b/packages/cosmic-proto/test/snapshots/test-exports.js.md @@ -19,6 +19,7 @@ Generated by [AVA](https://avajs.dev). 'gogoproto', 'google', 'ibc', + 'ics23', 'int64FromString', 'int64Length', 'int64ToString', @@ -119,3 +120,13 @@ Generated by [AVA](https://avajs.dev). 'upgrade', 'vesting', ] + +## ibc + +> Snapshot 1 + + [ + 'applications', + 'core', + 'lightclients', + ] diff --git a/packages/cosmic-proto/test/snapshots/test-exports.js.snap b/packages/cosmic-proto/test/snapshots/test-exports.js.snap index 26e36c8403f..36cef32851d 100644 Binary files a/packages/cosmic-proto/test/snapshots/test-exports.js.snap and b/packages/cosmic-proto/test/snapshots/test-exports.js.snap differ diff --git a/packages/cosmic-proto/test/test-exports.js b/packages/cosmic-proto/test/test-exports.js index a4f9908ba7c..88f31c13f05 100644 --- a/packages/cosmic-proto/test/test-exports.js +++ b/packages/cosmic-proto/test/test-exports.js @@ -32,3 +32,7 @@ test('agoric', t => { test('cosmos', t => { t.snapshot(Object.keys(index.cosmos).sort()); }); + +test('ibc', t => { + t.snapshot(Object.keys(index.ibc).sort()); +}); diff --git a/packages/cosmic-proto/update-protos.sh b/packages/cosmic-proto/update-protos.sh index e5b0e7065ad..03aadb226bd 100755 --- a/packages/cosmic-proto/update-protos.sh +++ b/packages/cosmic-proto/update-protos.sh @@ -9,12 +9,15 @@ AG_SDK=$(readlink -f "$(dirname -- "$(readlink -f -- "$0")")/../..") cd "$AG_SDK"/golang/cosmos make all COSMOS_SDK=$(go list -m -f '{{ .Dir }}' github.com/cosmos/cosmos-sdk) +IBC_GO=$(go list -m -f '{{ .Dir }}' github.com/cosmos/ibc-go/v6) cd - # update proto files in this package cp -rf "$COSMOS_SDK"/proto/cosmos proto cp -rf "$AG_SDK"/golang/cosmos/third_party/proto . cp -rf "$AG_SDK"/golang/cosmos/proto/agoric proto +cp -rf "$IBC_GO"/proto/ibc proto +cp -rf "$IBC_GO"/third_party/proto/proofs.proto proto # clean up what we don't need chmod -R u+w proto