diff --git a/packages/api-demo/package.json b/packages/api-demo/package.json index 80bdc997..61437109 100644 --- a/packages/api-demo/package.json +++ b/packages/api-demo/package.json @@ -1,6 +1,6 @@ { "name": "@regen-network/api-demo", - "version": "v1.0.0-alpha7", + "version": "v1.0.0-alpha8", "author": "admin@regen.network", "description": "Demo application using @regen-network/api", "license": "Apache-2.0", @@ -8,7 +8,7 @@ "repository": "https://github.com/regen-network/regen-js", "dependencies": { "@keplr-wallet/types": "^0.12.15", - "@regen-network/api": "^1.0.0-alpha7", + "@regen-network/api": "^1.0.0-alpha8", "@testing-library/jest-dom": "^5.16.5", "@testing-library/react": "^14.0.0", "@testing-library/user-event": "^14.4.3", diff --git a/packages/api-demo/src/examples/LCDCosmos.tsx b/packages/api-demo/src/examples/LCDCosmos.tsx index 8ffd2e05..e79a7896 100644 --- a/packages/api-demo/src/examples/LCDCosmos.tsx +++ b/packages/api-demo/src/examples/LCDCosmos.tsx @@ -22,6 +22,7 @@ export function LCDCosmos(): React.ReactElement { .allBalances({ address: 'regen1df675r9vnf7pdedn4sf26svdsem3ugavgxmy46', pagination: { countTotal: true } as PageRequest, + resolveDenom: true, }) .then(setResult) .catch(setError); diff --git a/packages/api-demo/src/examples/RPCCosmos.tsx b/packages/api-demo/src/examples/RPCCosmos.tsx index d82bc857..63547271 100644 --- a/packages/api-demo/src/examples/RPCCosmos.tsx +++ b/packages/api-demo/src/examples/RPCCosmos.tsx @@ -26,6 +26,7 @@ export function RPCCosmos(): React.ReactElement { limit: BigInt(0), offset: BigInt(0), } as PageRequest, + resolveDenom: true, }) .then(setResult) .catch(setError); diff --git a/packages/api/README.md b/packages/api/README.md index f7b9a552..7c1ce2a7 100644 --- a/packages/api/README.md +++ b/packages/api/README.md @@ -52,7 +52,7 @@ const client = await createRPCQueryClient({ rpcEndpoint: RPC_ENDPOINT }); // now you can query the cosmos modules const balance = await client.cosmos.bank.v1beta1 - .allBalances({ address: 'regen1addresshere' }); + .allBalances({ address: 'regen1addresshere', resolveDenom: true }); // you can also query the regen modules const balances = await client.regen.exchange.v1beta1 diff --git a/packages/api/package.json b/packages/api/package.json index a8b1d80a..2ff338da 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -1,6 +1,6 @@ { "name": "@regen-network/api", - "version": "v1.0.0-alpha7", + "version": "v1.0.0-alpha8", "author": "admin@regen.network", "description": "Javascript API for Regen Ledger", "main": "index.js", diff --git a/packages/api/proto/cosmos/app/module/v1alpha1/module.proto b/packages/api/proto/cosmos/app/module/v1alpha1/module.proto deleted file mode 100644 index 487e195c..00000000 --- a/packages/api/proto/cosmos/app/module/v1alpha1/module.proto +++ /dev/null @@ -1,13 +0,0 @@ -syntax = "proto3"; - -package cosmos.app.module.v1alpha1; - -import "cosmos/app/v1alpha1/module.proto"; - -// Module is the module config object for the cosmos.app v1 app module. -message Module { - option (cosmos.app.v1alpha1.module) = { - go_import: "github.com/cosmos/cosmos-sdk/app" - use_package: {name: "cosmos.app.v1alpha1"} - }; -} diff --git a/packages/api/proto/cosmos/app/runtime/v1alpha1/module.proto b/packages/api/proto/cosmos/app/runtime/v1alpha1/module.proto new file mode 100644 index 00000000..826376db --- /dev/null +++ b/packages/api/proto/cosmos/app/runtime/v1alpha1/module.proto @@ -0,0 +1,75 @@ +syntax = "proto3"; + +package cosmos.app.runtime.v1alpha1; + +import "cosmos/app/v1alpha1/module.proto"; + +// Module is the config object for the runtime module. +message Module { + option (cosmos.app.v1alpha1.module) = { + go_import: "github.com/cosmos/cosmos-sdk/runtime" + use_package: {name: "cosmos.app.v1alpha1"} + }; + + // app_name is the name of the app. + string app_name = 1; + + // begin_blockers specifies the module names of begin blockers + // to call in the order in which they should be called. If this is left empty + // no begin blocker will be registered. + repeated string begin_blockers = 2; + + // end_blockers specifies the module names of the end blockers + // to call in the order in which they should be called. If this is left empty + // no end blocker will be registered. + repeated string end_blockers = 3; + + // init_genesis specifies the module names of init genesis functions + // to call in the order in which they should be called. If this is left empty + // no init genesis function will be registered. + repeated string init_genesis = 4; + + // export_genesis specifies the order in which to export module genesis data. + // If this is left empty, the init_genesis order will be used for export genesis + // if it is specified. + repeated string export_genesis = 5; + + // override_store_keys is an optional list of overrides for the module store keys + // to be used in keeper construction. + repeated StoreKeyConfig override_store_keys = 6; + + // skip_store_keys is an optional list of store keys to skip when constructing the + // module's keeper. This is useful when a module does not have a store key. + // NOTE: the provided environment variable will have a fake store service. + repeated string skip_store_keys = 11; + + // order_migrations defines the order in which module migrations are performed. + // If this is left empty, it uses the default migration order. + // https://pkg.go.dev/github.com/cosmos/cosmos-sdk/types/module#DefaultMigrationsOrder + repeated string order_migrations = 7; + + // precommiters specifies the module names of the precommiters + // to call in the order in which they should be called. If this is left empty + // no precommit function will be registered. + repeated string precommiters = 8; + + // prepare_check_staters specifies the module names of the prepare_check_staters + // to call in the order in which they should be called. If this is left empty + // no preparecheckstate function will be registered. + repeated string prepare_check_staters = 9; + + // pre_blockers specifies the module names of pre blockers + // to call in the order in which they should be called. If this is left empty + // no pre blocker will be registered. + repeated string pre_blockers = 10; +} + +// StoreKeyConfig may be supplied to override the default module store key, which +// is the module name. +message StoreKeyConfig { + // name of the module to override the store key of + string module_name = 1; + + // the kv store key to use instead of the module name. + string kv_store_key = 2; +} diff --git a/packages/api/proto/cosmos/app/v1alpha1/config.proto b/packages/api/proto/cosmos/app/v1alpha1/config.proto index ed775006..1aac4b43 100644 --- a/packages/api/proto/cosmos/app/v1alpha1/config.proto +++ b/packages/api/proto/cosmos/app/v1alpha1/config.proto @@ -4,6 +4,8 @@ package cosmos.app.v1alpha1; import "google/protobuf/any.proto"; +option go_package = "cosmossdk.io/depinject/appconfig/v1alpha1"; + // Config represents the configuration for a Cosmos SDK ABCI app. // It is intended that all state machine logic including the version of // baseapp and tx handlers (and possibly even Tendermint) that an app needs @@ -14,6 +16,11 @@ import "google/protobuf/any.proto"; message Config { // modules are the module configurations for the app. repeated ModuleConfig modules = 1; + + // golang_bindings specifies explicit interface to implementation type bindings which + // depinject uses to resolve interface inputs to provider functions. The scope of this + // field's configuration is global (not module specific). + repeated GolangBinding golang_bindings = 2; } // ModuleConfig is a module configuration for an app. @@ -33,4 +40,18 @@ message ModuleConfig { // config is the config object for the module. Module config messages should // define a ModuleDescriptor using the cosmos.app.v1alpha1.is_module extension. google.protobuf.Any config = 2; + + // golang_bindings specifies explicit interface to implementation type bindings which + // depinject uses to resolve interface inputs to provider functions. The scope of this + // field's configuration is module specific. + repeated GolangBinding golang_bindings = 3; } + +// GolangBinding is an explicit interface type to implementing type binding for dependency injection. +message GolangBinding { + // interface_type is the interface type which will be bound to a specific implementation type + string interface_type = 1; + + // implementation is the implementing type which will be supplied when an input of type interface is requested + string implementation = 2; +} \ No newline at end of file diff --git a/packages/api/proto/cosmos/app/v1alpha1/module.proto b/packages/api/proto/cosmos/app/v1alpha1/module.proto index 99085717..ea475f35 100644 --- a/packages/api/proto/cosmos/app/v1alpha1/module.proto +++ b/packages/api/proto/cosmos/app/v1alpha1/module.proto @@ -4,6 +4,8 @@ package cosmos.app.v1alpha1; import "google/protobuf/descriptor.proto"; +option go_package = "cosmossdk.io/depinject/appconfig/v1alpha1"; + extend google.protobuf.MessageOptions { // module indicates that this proto type is a config object for an app module // and optionally provides other descriptive information about the module. @@ -57,7 +59,7 @@ message PackageReference { // // When a new version of a module is released and items are added to existing // .proto files, these definitions should contain comments of the form - // "Since Revision N" where N is an integer revision. + // "Since: Revision N" where N is an integer revision. // // When the module runtime starts up, it will check the pinned proto // image and panic if there are runtime protobuf definitions that are not diff --git a/packages/api/proto/cosmos/app/v1alpha1/query.proto b/packages/api/proto/cosmos/app/v1alpha1/query.proto index efec9c81..a51aea69 100644 --- a/packages/api/proto/cosmos/app/v1alpha1/query.proto +++ b/packages/api/proto/cosmos/app/v1alpha1/query.proto @@ -4,17 +4,21 @@ package cosmos.app.v1alpha1; import "cosmos/app/v1alpha1/config.proto"; +option go_package = "cosmossdk.io/depinject/appconfig/v1alpha1"; + // Query is the app module query service. service Query { // Config returns the current app config. - rpc Config(QueryConfigRequest) returns (QueryConfigResponse) {} + rpc Config(QueryConfigRequest) returns (QueryConfigResponse) { + option deprecated = true; + } } // QueryConfigRequest is the Query/Config request type. message QueryConfigRequest {} -// QueryConfigRequest is the Query/Config response type. +// QueryConfigResponse is the Query/Config response type. message QueryConfigResponse { // config is the current app config. diff --git a/packages/api/proto/cosmos/auth/module/v1/module.proto b/packages/api/proto/cosmos/auth/module/v1/module.proto new file mode 100644 index 00000000..69b4fad6 --- /dev/null +++ b/packages/api/proto/cosmos/auth/module/v1/module.proto @@ -0,0 +1,36 @@ +syntax = "proto3"; + +package cosmos.auth.module.v1; + +import "cosmos/app/v1alpha1/module.proto"; + +// Module is the config object for the auth module. +message Module { + option (cosmos.app.v1alpha1.module) = { + go_import: "github.com/cosmos/cosmos-sdk/x/auth" + }; + + // bech32_prefix is the bech32 account prefix for the app. + string bech32_prefix = 1; + + // module_account_permissions are module account permissions. + repeated ModuleAccountPermission module_account_permissions = 2; + + // authority defines the custom module authority. If not set, defaults to the governance module. + string authority = 3; + + // enable_unordered_transactions determines whether unordered transactions should be supported or not. + // When true, unordered transactions will be validated and processed. + // When false, unordered transactions will be rejected. + bool enable_unordered_transactions = 4; +} + +// ModuleAccountPermission represents permissions for a module account. +message ModuleAccountPermission { + // account is the name of the module. + string account = 1; + + // permissions are the permissions this module has. Currently recognized + // values are minter, burner and staking. + repeated string permissions = 2; +} diff --git a/packages/api/proto/cosmos/auth/v1beta1/auth.proto b/packages/api/proto/cosmos/auth/v1beta1/auth.proto index 963c6f15..e044af7c 100644 --- a/packages/api/proto/cosmos/auth/v1beta1/auth.proto +++ b/packages/api/proto/cosmos/auth/v1beta1/auth.proto @@ -1,6 +1,7 @@ syntax = "proto3"; package cosmos.auth.v1beta1; +import "amino/amino.proto"; import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; import "google/protobuf/any.proto"; @@ -11,33 +12,47 @@ option go_package = "github.com/cosmos/cosmos-sdk/x/auth/types"; // for basic account functionality. Any custom account type should extend this // type for additional functionality (e.g. vesting). message BaseAccount { - option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = false; - option (gogoproto.equal) = false; + option (amino.name) = "cosmos-sdk/BaseAccount"; + option (gogoproto.goproto_getters) = false; + option (gogoproto.equal) = false; - option (cosmos_proto.implements_interface) = "AccountI"; + option (cosmos_proto.implements_interface) = "cosmos.auth.v1beta1.AccountI"; - string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - google.protobuf.Any pub_key = 2 [(gogoproto.jsontag) = "public_key,omitempty"]; - uint64 account_number = 3; - uint64 sequence = 4; + string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + google.protobuf.Any pub_key = 2 [(gogoproto.jsontag) = "public_key,omitempty", (amino.field_name) = "public_key"]; + + uint64 account_number = 3; + uint64 sequence = 4; } // ModuleAccount defines an account for modules that holds coins on a pool. message ModuleAccount { + option (amino.name) = "cosmos-sdk/ModuleAccount"; + option (amino.message_encoding) = "module_account"; option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = false; - option (cosmos_proto.implements_interface) = "ModuleAccountI"; + option (cosmos_proto.implements_interface) = "cosmos.auth.v1beta1.ModuleAccountI"; BaseAccount base_account = 1 [(gogoproto.embed) = true]; string name = 2; repeated string permissions = 3; } +// ModuleCredential represents a unclaimable pubkey for base accounts controlled by modules. +message ModuleCredential { + option (amino.name) = "cosmos-sdk/GroupAccountCredential"; + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.47"; + // module_name is the name of the module used for address derivation (passed into address.Module). + string module_name = 1; + // derivation_keys is for deriving a module account address (passed into address.Module) + // adding more keys creates sub-account addresses (passed into address.Derive) + repeated bytes derivation_keys = 2; +} + // Params defines the parameters for the auth module. message Params { - option (gogoproto.equal) = true; - option (gogoproto.goproto_stringer) = false; + option (amino.name) = "cosmos-sdk/x/auth/Params"; + option (gogoproto.equal) = true; uint64 max_memo_characters = 1; uint64 tx_sig_limit = 2; diff --git a/packages/api/proto/cosmos/auth/v1beta1/genesis.proto b/packages/api/proto/cosmos/auth/v1beta1/genesis.proto index c88b94ee..d1aa66e4 100644 --- a/packages/api/proto/cosmos/auth/v1beta1/genesis.proto +++ b/packages/api/proto/cosmos/auth/v1beta1/genesis.proto @@ -4,13 +4,14 @@ package cosmos.auth.v1beta1; import "google/protobuf/any.proto"; import "gogoproto/gogo.proto"; import "cosmos/auth/v1beta1/auth.proto"; +import "amino/amino.proto"; option go_package = "github.com/cosmos/cosmos-sdk/x/auth/types"; // GenesisState defines the auth module's genesis state. message GenesisState { - // params defines all the paramaters of the module. - Params params = 1 [(gogoproto.nullable) = false]; + // params defines all the parameters of the module. + Params params = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // accounts are the accounts present at genesis. repeated google.protobuf.Any accounts = 2; diff --git a/packages/api/proto/cosmos/auth/v1beta1/query.proto b/packages/api/proto/cosmos/auth/v1beta1/query.proto index 1775f128..e05312dd 100644 --- a/packages/api/proto/cosmos/auth/v1beta1/query.proto +++ b/packages/api/proto/cosmos/auth/v1beta1/query.proto @@ -7,83 +7,92 @@ import "google/protobuf/any.proto"; import "google/api/annotations.proto"; import "cosmos/auth/v1beta1/auth.proto"; import "cosmos_proto/cosmos.proto"; +import "cosmos/query/v1/query.proto"; option go_package = "github.com/cosmos/cosmos-sdk/x/auth/types"; // Query defines the gRPC querier service. service Query { - // Accounts returns all the existing accounts + // Accounts returns all the existing accounts. // - // Since: cosmos-sdk 0.43 + // When called from another module, this query might consume a high amount of + // gas if the pagination field is incorrectly set. rpc Accounts(QueryAccountsRequest) returns (QueryAccountsResponse) { - option (google.api.http).get = "/cosmos/auth/v1beta1/accounts"; + option (cosmos_proto.method_added_in) = "cosmos-sdk 0.43"; + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = "/cosmos/auth/v1beta1/accounts"; } // Account returns account details based on address. rpc Account(QueryAccountRequest) returns (QueryAccountResponse) { - option (google.api.http).get = "/cosmos/auth/v1beta1/accounts/{address}"; + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = "/cosmos/auth/v1beta1/accounts/{address}"; } // AccountAddressByID returns account address based on account number. - // - // Since: cosmos-sdk 0.46.2 rpc AccountAddressByID(QueryAccountAddressByIDRequest) returns (QueryAccountAddressByIDResponse) { - option (google.api.http).get = "/cosmos/auth/v1beta1/address_by_id/{id}"; + option (cosmos_proto.method_added_in) = "cosmos-sdk 0.46.2"; + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = "/cosmos/auth/v1beta1/address_by_id/{id}"; } // Params queries all parameters. rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/cosmos/auth/v1beta1/params"; + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = "/cosmos/auth/v1beta1/params"; } // ModuleAccounts returns all the existing module accounts. - // - // Since: cosmos-sdk 0.46 rpc ModuleAccounts(QueryModuleAccountsRequest) returns (QueryModuleAccountsResponse) { - option (google.api.http).get = "/cosmos/auth/v1beta1/module_accounts"; + option (cosmos_proto.method_added_in) = "cosmos-sdk 0.46"; + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = "/cosmos/auth/v1beta1/module_accounts"; } // ModuleAccountByName returns the module account info by module name rpc ModuleAccountByName(QueryModuleAccountByNameRequest) returns (QueryModuleAccountByNameResponse) { - option (google.api.http).get = "/cosmos/auth/v1beta1/module_accounts/{name}"; + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = "/cosmos/auth/v1beta1/module_accounts/{name}"; } // Bech32Prefix queries bech32Prefix - // - // Since: cosmos-sdk 0.46 rpc Bech32Prefix(Bech32PrefixRequest) returns (Bech32PrefixResponse) { - option (google.api.http).get = "/cosmos/auth/v1beta1/bech32"; + option (cosmos_proto.method_added_in) = "cosmos-sdk 0.46"; + option (google.api.http).get = "/cosmos/auth/v1beta1/bech32"; } // AddressBytesToString converts Account Address bytes to string - // - // Since: cosmos-sdk 0.46 rpc AddressBytesToString(AddressBytesToStringRequest) returns (AddressBytesToStringResponse) { - option (google.api.http).get = "/cosmos/auth/v1beta1/bech32/{address_bytes}"; + option (cosmos_proto.method_added_in) = "cosmos-sdk 0.46"; + option (google.api.http).get = "/cosmos/auth/v1beta1/bech32/{address_bytes}"; } // AddressStringToBytes converts Address string to bytes - // - // Since: cosmos-sdk 0.46 rpc AddressStringToBytes(AddressStringToBytesRequest) returns (AddressStringToBytesResponse) { - option (google.api.http).get = "/cosmos/auth/v1beta1/bech32/{address_string}"; + option (cosmos_proto.method_added_in) = "cosmos-sdk 0.46"; + option (google.api.http).get = "/cosmos/auth/v1beta1/bech32/{address_string}"; + } + + // AccountInfo queries account info which is common to all account types. + rpc AccountInfo(QueryAccountInfoRequest) returns (QueryAccountInfoResponse) { + option (cosmos.query.v1.module_query_safe) = true; + option (cosmos_proto.method_added_in) = "cosmos-sdk 0.47"; + option (google.api.http).get = "/cosmos/auth/v1beta1/account_info/{address}"; } } // QueryAccountsRequest is the request type for the Query/Accounts RPC method. -// -// Since: cosmos-sdk 0.43 message QueryAccountsRequest { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.43"; // pagination defines an optional pagination for the request. cosmos.base.query.v1beta1.PageRequest pagination = 1; } // QueryAccountsResponse is the response type for the Query/Accounts RPC method. -// -// Since: cosmos-sdk 0.43 message QueryAccountsResponse { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.43"; // accounts are the existing accounts - repeated google.protobuf.Any accounts = 1 [(cosmos_proto.accepts_interface) = "AccountI"]; + repeated google.protobuf.Any accounts = 1 [(cosmos_proto.accepts_interface) = "cosmos.auth.v1beta1.AccountI"]; // pagination defines the pagination in the response. cosmos.base.query.v1beta1.PageResponse pagination = 2; @@ -101,7 +110,7 @@ message QueryAccountRequest { // QueryAccountResponse is the response type for the Query/Account RPC method. message QueryAccountResponse { // account defines the account of the corresponding address. - google.protobuf.Any account = 1 [(cosmos_proto.accepts_interface) = "AccountI"]; + google.protobuf.Any account = 1 [(cosmos_proto.accepts_interface) = "cosmos.auth.v1beta1.AccountI"]; } // QueryParamsRequest is the request type for the Query/Params RPC method. @@ -114,15 +123,14 @@ message QueryParamsResponse { } // QueryModuleAccountsRequest is the request type for the Query/ModuleAccounts RPC method. -// -// Since: cosmos-sdk 0.46 -message QueryModuleAccountsRequest {} +message QueryModuleAccountsRequest { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.46"; +} // QueryModuleAccountsResponse is the response type for the Query/ModuleAccounts RPC method. -// -// Since: cosmos-sdk 0.46 message QueryModuleAccountsResponse { - repeated google.protobuf.Any accounts = 1 [(cosmos_proto.accepts_interface) = "ModuleAccountI"]; + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.46"; + repeated google.protobuf.Any accounts = 1 [(cosmos_proto.accepts_interface) = "cosmos.auth.v1beta1.ModuleAccountI"]; } // QueryModuleAccountByNameRequest is the request type for the Query/ModuleAccountByName RPC method. @@ -132,62 +140,74 @@ message QueryModuleAccountByNameRequest { // QueryModuleAccountByNameResponse is the response type for the Query/ModuleAccountByName RPC method. message QueryModuleAccountByNameResponse { - google.protobuf.Any account = 1 [(cosmos_proto.accepts_interface) = "ModuleAccountI"]; + google.protobuf.Any account = 1 [(cosmos_proto.accepts_interface) = "cosmos.auth.v1beta1.ModuleAccountI"]; } // Bech32PrefixRequest is the request type for Bech32Prefix rpc method. -// -// Since: cosmos-sdk 0.46 -message Bech32PrefixRequest {} +message Bech32PrefixRequest { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.46"; +} // Bech32PrefixResponse is the response type for Bech32Prefix rpc method. -// -// Since: cosmos-sdk 0.46 message Bech32PrefixResponse { - string bech32_prefix = 1; + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.46"; + string bech32_prefix = 1; } // AddressBytesToStringRequest is the request type for AddressString rpc method. -// -// Since: cosmos-sdk 0.46 message AddressBytesToStringRequest { - bytes address_bytes = 1; + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.46"; + bytes address_bytes = 1; } // AddressBytesToStringResponse is the response type for AddressString rpc method. -// -// Since: cosmos-sdk 0.46 message AddressBytesToStringResponse { - string address_string = 1; + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.46"; + string address_string = 1; } // AddressStringToBytesRequest is the request type for AccountBytes rpc method. -// -// Since: cosmos-sdk 0.46 message AddressStringToBytesRequest { - string address_string = 1; + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.46"; + string address_string = 1; } // AddressStringToBytesResponse is the response type for AddressBytes rpc method. -// -// Since: cosmos-sdk 0.46 message AddressStringToBytesResponse { - bytes address_bytes = 1; + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.46"; + bytes address_bytes = 1; } // QueryAccountAddressByIDRequest is the request type for AccountAddressByID rpc method -// -// Since: cosmos-sdk 0.46.2 message QueryAccountAddressByIDRequest { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.46.2"; + // Deprecated, use account_id instead + // // id is the account number of the address to be queried. This field // should have been an uint64 (like all account numbers), and will be // updated to uint64 in a future version of the auth query. - int64 id = 1; + int64 id = 1 [deprecated = true]; + + // account_id is the account number of the address to be queried. + uint64 account_id = 2 [(cosmos_proto.field_added_in) = "cosmos-sdk 0.47"]; } // QueryAccountAddressByIDResponse is the response type for AccountAddressByID rpc method -// -// Since: cosmos-sdk 0.46.2 message QueryAccountAddressByIDResponse { - string account_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.46.2"; + string account_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; +} + +// QueryAccountInfoRequest is the Query/AccountInfo request type. +message QueryAccountInfoRequest { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.47"; + // address is the account address string. + string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; +} + +// QueryAccountInfoResponse is the Query/AccountInfo response type. +message QueryAccountInfoResponse { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.47"; + // info is the account info which is represented by BaseAccount. + BaseAccount info = 1; } diff --git a/packages/api/proto/cosmos/auth/v1beta1/tx.proto b/packages/api/proto/cosmos/auth/v1beta1/tx.proto new file mode 100644 index 00000000..804b0ae0 --- /dev/null +++ b/packages/api/proto/cosmos/auth/v1beta1/tx.proto @@ -0,0 +1,42 @@ +syntax = "proto3"; +package cosmos.auth.v1beta1; + +import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; +import "cosmos/msg/v1/msg.proto"; +import "amino/amino.proto"; +import "cosmos/auth/v1beta1/auth.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/x/auth/types"; + +// Msg defines the x/auth Msg service. +service Msg { + option (cosmos.msg.v1.service) = true; + + // UpdateParams defines a (governance) operation for updating the x/auth module + // parameters. The authority defaults to the x/gov module account. + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse) { + option (cosmos_proto.method_added_in) = "cosmos-sdk 0.47"; + }; +} + +// MsgUpdateParams is the Msg/UpdateParams request type. +message MsgUpdateParams { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.47"; + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "cosmos-sdk/x/auth/MsgUpdateParams"; + + // authority is the address that controls the module (defaults to x/gov unless overwritten). + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // params defines the x/auth parameters to update. + // + // NOTE: All parameters must be supplied. + Params params = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +message MsgUpdateParamsResponse { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.47"; +} diff --git a/packages/api/proto/cosmos/authz/module/v1/module.proto b/packages/api/proto/cosmos/authz/module/v1/module.proto new file mode 100644 index 00000000..80058668 --- /dev/null +++ b/packages/api/proto/cosmos/authz/module/v1/module.proto @@ -0,0 +1,12 @@ +syntax = "proto3"; + +package cosmos.authz.module.v1; + +import "cosmos/app/v1alpha1/module.proto"; + +// Module is the config object of the authz module. +message Module { + option (cosmos.app.v1alpha1.module) = { + go_import: "github.com/cosmos/cosmos-sdk/x/authz" + }; +} diff --git a/packages/api/proto/cosmos/authz/v1beta1/authz.proto b/packages/api/proto/cosmos/authz/v1beta1/authz.proto index 06ce288a..ea728f10 100644 --- a/packages/api/proto/cosmos/authz/v1beta1/authz.proto +++ b/packages/api/proto/cosmos/authz/v1beta1/authz.proto @@ -1,7 +1,7 @@ -// Since: cosmos-sdk 0.43 syntax = "proto3"; package cosmos.authz.v1beta1; +import "amino/amino.proto"; import "cosmos_proto/cosmos.proto"; import "google/protobuf/timestamp.proto"; import "gogoproto/gogo.proto"; @@ -13,7 +13,8 @@ option (gogoproto.goproto_getters_all) = false; // GenericAuthorization gives the grantee unrestricted permissions to execute // the provided method on behalf of the granter's account. message GenericAuthorization { - option (cosmos_proto.implements_interface) = "Authorization"; + option (amino.name) = "cosmos-sdk/GenericAuthorization"; + option (cosmos_proto.implements_interface) = "cosmos.authz.v1beta1.Authorization"; // Msg, identified by it's type URL, to grant unrestricted permissions to execute string msg = 1; @@ -22,7 +23,7 @@ message GenericAuthorization { // Grant gives permissions to execute // the provide method with expiration time. message Grant { - google.protobuf.Any authorization = 1 [(cosmos_proto.accepts_interface) = "Authorization"]; + google.protobuf.Any authorization = 1 [(cosmos_proto.accepts_interface) = "cosmos.authz.v1beta1.Authorization"]; // time when the grant will expire and will be pruned. If null, then the grant // doesn't have a time expiration (other conditions in `authorization` // may apply to invalidate the grant) @@ -35,7 +36,7 @@ message GrantAuthorization { string granter = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; string grantee = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - google.protobuf.Any authorization = 3 [(cosmos_proto.accepts_interface) = "Authorization"]; + google.protobuf.Any authorization = 3 [(cosmos_proto.accepts_interface) = "cosmos.authz.v1beta1.Authorization"]; google.protobuf.Timestamp expiration = 4 [(gogoproto.stdtime) = true]; } diff --git a/packages/api/proto/cosmos/authz/v1beta1/event.proto b/packages/api/proto/cosmos/authz/v1beta1/event.proto index 0476649a..f763854b 100644 --- a/packages/api/proto/cosmos/authz/v1beta1/event.proto +++ b/packages/api/proto/cosmos/authz/v1beta1/event.proto @@ -1,4 +1,3 @@ -// Since: cosmos-sdk 0.43 syntax = "proto3"; package cosmos.authz.v1beta1; diff --git a/packages/api/proto/cosmos/authz/v1beta1/genesis.proto b/packages/api/proto/cosmos/authz/v1beta1/genesis.proto index 310f6265..e5391224 100644 --- a/packages/api/proto/cosmos/authz/v1beta1/genesis.proto +++ b/packages/api/proto/cosmos/authz/v1beta1/genesis.proto @@ -1,13 +1,13 @@ -// Since: cosmos-sdk 0.43 syntax = "proto3"; package cosmos.authz.v1beta1; import "gogoproto/gogo.proto"; import "cosmos/authz/v1beta1/authz.proto"; +import "amino/amino.proto"; option go_package = "github.com/cosmos/cosmos-sdk/x/authz"; // GenesisState defines the authz module's genesis state. message GenesisState { - repeated GrantAuthorization authorization = 1 [(gogoproto.nullable) = false]; + repeated GrantAuthorization authorization = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } diff --git a/packages/api/proto/cosmos/authz/v1beta1/query.proto b/packages/api/proto/cosmos/authz/v1beta1/query.proto index 62154ac1..f8cff448 100644 --- a/packages/api/proto/cosmos/authz/v1beta1/query.proto +++ b/packages/api/proto/cosmos/authz/v1beta1/query.proto @@ -1,4 +1,3 @@ -// Since: cosmos-sdk 0.43 syntax = "proto3"; package cosmos.authz.v1beta1; @@ -17,17 +16,15 @@ service Query { } // GranterGrants returns list of `GrantAuthorization`, granted by granter. - // - // Since: cosmos-sdk 0.46 rpc GranterGrants(QueryGranterGrantsRequest) returns (QueryGranterGrantsResponse) { - option (google.api.http).get = "/cosmos/authz/v1beta1/grants/granter/{granter}"; + option (cosmos_proto.method_added_in) = "cosmos-sdk 0.46"; + option (google.api.http).get = "/cosmos/authz/v1beta1/grants/granter/{granter}"; } // GranteeGrants returns a list of `GrantAuthorization` by grantee. - // - // Since: cosmos-sdk 0.46 rpc GranteeGrants(QueryGranteeGrantsRequest) returns (QueryGranteeGrantsResponse) { - option (google.api.http).get = "/cosmos/authz/v1beta1/grants/grantee/{grantee}"; + option (cosmos_proto.method_added_in) = "cosmos-sdk 0.46"; + option (google.api.http).get = "/cosmos/authz/v1beta1/grants/grantee/{grantee}"; } } @@ -65,7 +62,7 @@ message QueryGranterGrantsResponse { cosmos.base.query.v1beta1.PageResponse pagination = 2; } -// QueryGranteeGrantsRequest is the request type for the Query/IssuedGrants RPC method. +// QueryGranteeGrantsRequest is the request type for the Query/GranteeGrants RPC method. message QueryGranteeGrantsRequest { string grantee = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; diff --git a/packages/api/proto/cosmos/authz/v1beta1/tx.proto b/packages/api/proto/cosmos/authz/v1beta1/tx.proto index 068218ff..17a0b325 100644 --- a/packages/api/proto/cosmos/authz/v1beta1/tx.proto +++ b/packages/api/proto/cosmos/authz/v1beta1/tx.proto @@ -1,4 +1,3 @@ -// Since: cosmos-sdk 0.43 syntax = "proto3"; package cosmos.authz.v1beta1; @@ -7,12 +6,15 @@ import "gogoproto/gogo.proto"; import "google/protobuf/any.proto"; import "cosmos/authz/v1beta1/authz.proto"; import "cosmos/msg/v1/msg.proto"; +import "amino/amino.proto"; option go_package = "github.com/cosmos/cosmos-sdk/x/authz"; option (gogoproto.goproto_getters_all) = false; // Msg defines the authz Msg service. service Msg { + option (cosmos.msg.v1.service) = true; + // Grant grants the provided authorization to the grantee on the granter's // account with the provided expiration time. If there is already a grant // for the given (granter, grantee, Authorization) triple, then the grant @@ -33,38 +35,41 @@ service Msg { // on behalf of the granter with the provided expiration time. message MsgGrant { option (cosmos.msg.v1.signer) = "granter"; + option (amino.name) = "cosmos-sdk/MsgGrant"; string granter = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; string grantee = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - cosmos.authz.v1beta1.Grant grant = 3 [(gogoproto.nullable) = false]; + cosmos.authz.v1beta1.Grant grant = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } -// MsgExecResponse defines the Msg/MsgExecResponse response type. -message MsgExecResponse { - repeated bytes results = 1; -} +// MsgGrantResponse defines the Msg/MsgGrant response type. +message MsgGrantResponse {} // MsgExec attempts to execute the provided messages using // authorizations granted to the grantee. Each message should have only // one signer corresponding to the granter of the authorization. message MsgExec { option (cosmos.msg.v1.signer) = "grantee"; + option (amino.name) = "cosmos-sdk/MsgExec"; string grantee = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - // Authorization Msg requests to execute. Each msg must implement Authorization interface + // Execute Msg. // The x/authz will try to find a grant matching (msg.signers[0], grantee, MsgTypeURL(msg)) // triple and validate it. - repeated google.protobuf.Any msgs = 2 [(cosmos_proto.accepts_interface) = "sdk.Msg, authz.Authorization"]; + repeated google.protobuf.Any msgs = 2 [(cosmos_proto.accepts_interface) = "cosmos.base.v1beta1.Msg"]; } -// MsgGrantResponse defines the Msg/MsgGrant response type. -message MsgGrantResponse {} +// MsgExecResponse defines the Msg/MsgExecResponse response type. +message MsgExecResponse { + repeated bytes results = 1; +} // MsgRevoke revokes any authorization with the provided sdk.Msg type on the // granter's account with that has been granted to the grantee. message MsgRevoke { option (cosmos.msg.v1.signer) = "granter"; + option (amino.name) = "cosmos-sdk/MsgRevoke"; string granter = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; string grantee = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; diff --git a/packages/api/proto/cosmos/autocli/v1/options.proto b/packages/api/proto/cosmos/autocli/v1/options.proto new file mode 100644 index 00000000..af9783a9 --- /dev/null +++ b/packages/api/proto/cosmos/autocli/v1/options.proto @@ -0,0 +1,142 @@ +syntax = "proto3"; + +package cosmos.autocli.v1; + +import "cosmos_proto/cosmos.proto"; + +option go_package = "cosmossdk.io/api/cosmos/base/cli/v1;cliv1"; + +// ModuleOptions describes the CLI options for a Cosmos SDK module. +message ModuleOptions { + // tx describes the tx commands for the module. + ServiceCommandDescriptor tx = 1; + + // query describes the queries commands for the module. + ServiceCommandDescriptor query = 2; +} + +// ServiceCommandDescriptor describes a CLI command based on a protobuf service. +message ServiceCommandDescriptor { + // service is the fully qualified name of the protobuf service to build + // the command from. It can be left empty if sub_commands are used instead + // which may be the case if a module provides multiple tx and/or query services. + string service = 1; + + // rpc_command_options are options for commands generated from rpc methods. + // If no options are specified for a given rpc method on the service, a + // command will be generated for that method with the default options. + repeated RpcCommandOptions rpc_command_options = 2; + + // sub_commands is a map of optional sub-commands for this command based on + // different protobuf services. The map key is used as the name of the + // sub-command. + map sub_commands = 3; + + // enhance_custom_commands specifies whether to skip the service when generating commands, if a custom command already + // exists, or enhance the existing command. If set to true, the custom command will be enhanced with the services from + // gRPC. otherwise when a custom command exists, no commands will be generated for the service. + bool enhance_custom_command = 4; + + // short is an optional parameter used to override the short description of the auto generated command. + string short = 5; +} + +// RpcCommandOptions specifies options for commands generated from protobuf +// rpc methods. +message RpcCommandOptions { + // rpc_method is short name of the protobuf rpc method that this command is + // generated from. + string rpc_method = 1; + + // use is the one-line usage method. It also allows specifying an alternate + // name for the command as the first word of the usage text. + // + // By default the name of an rpc command is the kebab-case short name of the + // rpc method. + string use = 2; + + // long is the long message shown in the 'help ' output. + string long = 3; + + // short is the short description shown in the 'help' output. + string short = 4; + + // example is examples of how to use the command. + string example = 5; + + // alias is an array of aliases that can be used instead of the first word in Use. + repeated string alias = 6; + + // suggest_for is an array of command names for which this command will be suggested - + // similar to aliases but only suggests. + repeated string suggest_for = 7; + + // deprecated defines, if this command is deprecated and should print this string when used. + string deprecated = 8; + + // version defines the version for this command. If this value is non-empty and the command does not + // define a "version" flag, a "version" boolean flag will be added to the command and, if specified, + // will print content of the "Version" variable. A shorthand "v" flag will also be added if the + // command does not define one. + string version = 9; + + // flag_options are options for flags generated from rpc request fields. + // By default all request fields are configured as flags. They can + // also be configured as positional args instead using positional_args. + map flag_options = 10; + + // positional_args specifies positional arguments for the command. + repeated PositionalArgDescriptor positional_args = 11; + + // skip specifies whether to skip this rpc method when generating commands. + bool skip = 12; + + // gov_proposal specifies whether autocli should generate a gov proposal transaction for this rpc method. + // Normally autocli generates a transaction containing the message and broadcast it. + // However, when true, autocli generates a proposal transaction containing the message and broadcast it. + // This option is ineffective for query commands. + bool gov_proposal = 13 [(cosmos_proto.field_added_in) = "client/v2 v2.0.0-beta.2"]; +} + +// FlagOptions are options for flags generated from rpc request fields. +// By default, all request fields are configured as flags based on the +// kebab-case name of the field. Fields can be turned into positional arguments +// instead by using RpcCommandOptions.positional_args. +message FlagOptions { + // name is an alternate name to use for the field flag. + string name = 1; + + // shorthand is a one-letter abbreviated flag. + string shorthand = 2; + + // usage is the help message. + string usage = 3; + + // default_value is the default value as text. + string default_value = 4; + + // deprecated is the usage text to show if this flag is deprecated. + string deprecated = 6; + + // shorthand_deprecated is the usage text to show if the shorthand of this flag is deprecated. + string shorthand_deprecated = 7; + + // hidden hides the flag from help/usage text + bool hidden = 8; +} + +// PositionalArgDescriptor describes a positional argument. +message PositionalArgDescriptor { + // proto_field specifies the proto field to use as the positional arg. Any + // fields used as positional args will not have a flag generated. + string proto_field = 1; + + // varargs makes a positional parameter a varargs parameter. This can only be + // applied to last positional parameter and the proto_field must a repeated + // field. Note: It is mutually exclusive with optional. + bool varargs = 2; + + // optional makes the last positional parameter optional. + // Note: It is mutually exclusive with varargs. + bool optional = 3; +} diff --git a/packages/api/proto/cosmos/autocli/v1/query.proto b/packages/api/proto/cosmos/autocli/v1/query.proto new file mode 100644 index 00000000..a998978e --- /dev/null +++ b/packages/api/proto/cosmos/autocli/v1/query.proto @@ -0,0 +1,28 @@ +syntax = "proto3"; + +package cosmos.autocli.v1; + +import "cosmos/autocli/v1/options.proto"; +import "cosmos/query/v1/query.proto"; + +option go_package = "cosmossdk.io/api/cosmos/base/cli/v1;cliv1"; + +// RemoteInfoService provides clients with the information they need +// to build dynamically CLI clients for remote chains. +service Query { + // AppOptions returns the autocli options for all of the modules in an app. + rpc AppOptions(AppOptionsRequest) returns (AppOptionsResponse) { + // NOTE: autocli options SHOULD NOT be part of consensus and module_query_safe + // should be kept as false. + option (cosmos.query.v1.module_query_safe) = false; + } +} + +// AppOptionsRequest is the RemoteInfoService/AppOptions request type. +message AppOptionsRequest {} + +// AppOptionsResponse is the RemoteInfoService/AppOptions response type. +message AppOptionsResponse { + // module_options is a map of module name to autocli module options. + map module_options = 1; +} diff --git a/packages/api/proto/cosmos/bank/module/v1/module.proto b/packages/api/proto/cosmos/bank/module/v1/module.proto new file mode 100644 index 00000000..d7d4a7fa --- /dev/null +++ b/packages/api/proto/cosmos/bank/module/v1/module.proto @@ -0,0 +1,26 @@ +syntax = "proto3"; + +package cosmos.bank.module.v1; + +import "cosmos/app/v1alpha1/module.proto"; + +// Module is the config object of the bank module. +message Module { + option (cosmos.app.v1alpha1.module) = { + go_import: "github.com/cosmos/cosmos-sdk/x/bank" + }; + + // blocked_module_accounts_override configures exceptional module accounts which should be blocked from receiving + // funds. If left empty it defaults to the list of account names supplied in the auth module configuration as + // module_account_permissions + repeated string blocked_module_accounts_override = 1; + + // authority defines the custom module authority. If not set, defaults to the governance module. + string authority = 2; + + // restrictions_order specifies the order of send restrictions and should be + // a list of module names which provide a send restriction instance. If no + // order is provided, then restrictions will be applied in alphabetical order + // of module names. + repeated string restrictions_order = 3; +} diff --git a/packages/api/proto/cosmos/bank/v1beta1/authz.proto b/packages/api/proto/cosmos/bank/v1beta1/authz.proto index 4f58b15e..77d76227 100644 --- a/packages/api/proto/cosmos/bank/v1beta1/authz.proto +++ b/packages/api/proto/cosmos/bank/v1beta1/authz.proto @@ -1,6 +1,7 @@ syntax = "proto3"; package cosmos.bank.v1beta1; +import "amino/amino.proto"; import "gogoproto/gogo.proto"; import "cosmos_proto/cosmos.proto"; import "cosmos/base/v1beta1/coin.proto"; @@ -9,11 +10,20 @@ option go_package = "github.com/cosmos/cosmos-sdk/x/bank/types"; // SendAuthorization allows the grantee to spend up to spend_limit coins from // the granter's account. -// -// Since: cosmos-sdk 0.43 message SendAuthorization { - option (cosmos_proto.implements_interface) = "Authorization"; + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.43"; + option (cosmos_proto.implements_interface) = "cosmos.authz.v1beta1.Authorization"; + option (amino.name) = "cosmos-sdk/SendAuthorization"; - repeated cosmos.base.v1beta1.Coin spend_limit = 1 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; + repeated cosmos.base.v1beta1.Coin spend_limit = 1 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true, + (amino.encoding) = "legacy_coins", + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; + + // allow_list specifies an optional list of addresses to whom the grantee can send tokens on behalf of the + // granter. If omitted, any recipient is allowed. + repeated string allow_list = 2 + [(cosmos_proto.scalar) = "cosmos.AddressString", (cosmos_proto.field_added_in) = "cosmos-sdk 0.47"]; } diff --git a/packages/api/proto/cosmos/bank/v1beta1/bank.proto b/packages/api/proto/cosmos/bank/v1beta1/bank.proto index 7bc9819d..52843610 100644 --- a/packages/api/proto/cosmos/bank/v1beta1/bank.proto +++ b/packages/api/proto/cosmos/bank/v1beta1/bank.proto @@ -5,23 +5,28 @@ import "gogoproto/gogo.proto"; import "cosmos_proto/cosmos.proto"; import "cosmos/base/v1beta1/coin.proto"; import "cosmos/msg/v1/msg.proto"; +import "amino/amino.proto"; option go_package = "github.com/cosmos/cosmos-sdk/x/bank/types"; // Params defines the parameters for the bank module. message Params { - option (gogoproto.goproto_stringer) = false; - repeated SendEnabled send_enabled = 1; + option (amino.name) = "cosmos-sdk/x/bank/Params"; + // Deprecated: Use of SendEnabled in params is deprecated. + // For genesis, use the newly added send_enabled field in the genesis object. + // Storage, lookup, and manipulation of this information is now in the keeper. + // + // As of cosmos-sdk 0.47, this only exists for backwards compatibility of genesis files. + repeated SendEnabled send_enabled = 1 [deprecated = true]; bool default_send_enabled = 2; } // SendEnabled maps coin denom to a send_enabled status (whether a denom is // sendable). message SendEnabled { - option (gogoproto.equal) = true; - option (gogoproto.goproto_stringer) = false; - string denom = 1; - bool enabled = 2; + option (gogoproto.equal) = true; + string denom = 1; + bool enabled = 2; } // Input models transaction input. @@ -32,8 +37,12 @@ message Input { option (gogoproto.goproto_getters) = false; string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - repeated cosmos.base.v1beta1.Coin coins = 2 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; + repeated cosmos.base.v1beta1.Coin coins = 2 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true, + (amino.encoding) = "legacy_coins", + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; } // Output models transaction outputs. @@ -42,8 +51,12 @@ message Output { option (gogoproto.goproto_getters) = false; string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - repeated cosmos.base.v1beta1.Coin coins = 2 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; + repeated cosmos.base.v1beta1.Coin coins = 2 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true, + (amino.encoding) = "legacy_coins", + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; } // Supply represents a struct that passively keeps track of the total supply @@ -55,10 +68,14 @@ message Supply { option (gogoproto.equal) = true; option (gogoproto.goproto_getters) = false; - option (cosmos_proto.implements_interface) = "*github.com/cosmos/cosmos-sdk/x/bank/migrations/v040.SupplyI"; + option (cosmos_proto.implements_interface) = "cosmos.bank.v1beta1.SupplyI"; - repeated cosmos.base.v1beta1.Coin total = 1 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; + repeated cosmos.base.v1beta1.Coin total = 1 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true, + (amino.encoding) = "legacy_coins", + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; } // DenomUnit represents a struct that describes a given @@ -88,21 +105,13 @@ message Metadata { // displayed in clients. string display = 4; // name defines the name of the token (eg: Cosmos Atom) - // - // Since: cosmos-sdk 0.43 - string name = 5; + string name = 5 [(cosmos_proto.field_added_in) = "cosmos-sdk 0.43"]; // symbol is the token symbol usually shown on exchanges (eg: ATOM). This can // be the same as the display. - // - // Since: cosmos-sdk 0.43 - string symbol = 6; + string symbol = 6 [(cosmos_proto.field_added_in) = "cosmos-sdk 0.43"]; // URI to a document (on or off-chain) that contains additional information. Optional. - // - // Since: cosmos-sdk 0.46 - string uri = 7 [(gogoproto.customname) = "URI"]; + string uri = 7 [(gogoproto.customname) = "URI", (cosmos_proto.field_added_in) = "cosmos-sdk 0.46"]; // URIHash is a sha256 hash of a document pointed by URI. It's used to verify that // the document didn't change. Optional. - // - // Since: cosmos-sdk 0.46 - string uri_hash = 8 [(gogoproto.customname) = "URIHash"]; + string uri_hash = 8 [(gogoproto.customname) = "URIHash", (cosmos_proto.field_added_in) = "cosmos-sdk 0.46"]; } diff --git a/packages/api/proto/cosmos/bank/v1beta1/genesis.proto b/packages/api/proto/cosmos/bank/v1beta1/genesis.proto index aa35790b..9fe16568 100644 --- a/packages/api/proto/cosmos/bank/v1beta1/genesis.proto +++ b/packages/api/proto/cosmos/bank/v1beta1/genesis.proto @@ -5,24 +5,33 @@ import "gogoproto/gogo.proto"; import "cosmos/base/v1beta1/coin.proto"; import "cosmos/bank/v1beta1/bank.proto"; import "cosmos_proto/cosmos.proto"; +import "amino/amino.proto"; option go_package = "github.com/cosmos/cosmos-sdk/x/bank/types"; // GenesisState defines the bank module's genesis state. message GenesisState { - // params defines all the paramaters of the module. - Params params = 1 [(gogoproto.nullable) = false]; + // params defines all the parameters of the module. + Params params = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // balances is an array containing the balances of all the accounts. - repeated Balance balances = 2 [(gogoproto.nullable) = false]; + repeated Balance balances = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // supply represents the total supply. If it is left empty, then supply will be calculated based on the provided // balances. Otherwise, it will be used to validate that the sum of the balances equals this amount. - repeated cosmos.base.v1beta1.Coin supply = 3 - [(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", (gogoproto.nullable) = false]; - - // denom_metadata defines the metadata of the differents coins. - repeated Metadata denom_metadata = 4 [(gogoproto.nullable) = false]; + repeated cosmos.base.v1beta1.Coin supply = 3 [ + (amino.encoding) = "legacy_coins", + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; + + // denom_metadata defines the metadata of the different coins. + repeated Metadata denom_metadata = 4 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + + // send_enabled defines the denoms where send is enabled or disabled. + repeated SendEnabled send_enabled = 5 + [(gogoproto.nullable) = false, (amino.dont_omitempty) = true, (cosmos_proto.field_added_in) = "cosmos-sdk 0.47"]; } // Balance defines an account address and balance pair used in the bank module's @@ -35,6 +44,10 @@ message Balance { string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // coins defines the different coins this balance holds. - repeated cosmos.base.v1beta1.Coin coins = 2 - [(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", (gogoproto.nullable) = false]; + repeated cosmos.base.v1beta1.Coin coins = 2 [ + (amino.encoding) = "legacy_coins", + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; } diff --git a/packages/api/proto/cosmos/bank/v1beta1/query.proto b/packages/api/proto/cosmos/bank/v1beta1/query.proto index 635471c4..4f6492b1 100644 --- a/packages/api/proto/cosmos/bank/v1beta1/query.proto +++ b/packages/api/proto/cosmos/bank/v1beta1/query.proto @@ -7,6 +7,8 @@ import "google/api/annotations.proto"; import "cosmos/base/v1beta1/coin.proto"; import "cosmos/bank/v1beta1/bank.proto"; import "cosmos_proto/cosmos.proto"; +import "cosmos/query/v1/query.proto"; +import "amino/amino.proto"; option go_package = "github.com/cosmos/cosmos-sdk/x/bank/types"; @@ -14,54 +16,113 @@ option go_package = "github.com/cosmos/cosmos-sdk/x/bank/types"; service Query { // Balance queries the balance of a single coin for a single account. rpc Balance(QueryBalanceRequest) returns (QueryBalanceResponse) { - option (google.api.http).get = "/cosmos/bank/v1beta1/balances/{address}/by_denom"; + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = "/cosmos/bank/v1beta1/balances/{address}/by_denom"; } // AllBalances queries the balance of all coins for a single account. + // + // When called from another module, this query might consume a high amount of + // gas if the pagination field is incorrectly set. rpc AllBalances(QueryAllBalancesRequest) returns (QueryAllBalancesResponse) { - option (google.api.http).get = "/cosmos/bank/v1beta1/balances/{address}"; + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = "/cosmos/bank/v1beta1/balances/{address}"; } - // SpendableBalances queries the spenable balance of all coins for a single + // SpendableBalances queries the spendable balance of all coins for a single // account. // - // Since: cosmos-sdk 0.46 + // When called from another module, this query might consume a high amount of + // gas if the pagination field is incorrectly set. rpc SpendableBalances(QuerySpendableBalancesRequest) returns (QuerySpendableBalancesResponse) { - option (google.api.http).get = "/cosmos/bank/v1beta1/spendable_balances/{address}"; + option (cosmos_proto.method_added_in) = "cosmos-sdk 0.46"; + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = "/cosmos/bank/v1beta1/spendable_balances/{address}"; + } + + // SpendableBalanceByDenom queries the spendable balance of a single denom for + // a single account. + // + // When called from another module, this query might consume a high amount of + // gas if the pagination field is incorrectly set. + rpc SpendableBalanceByDenom(QuerySpendableBalanceByDenomRequest) returns (QuerySpendableBalanceByDenomResponse) { + option (cosmos_proto.method_added_in) = "cosmos-sdk 0.47"; + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = "/cosmos/bank/v1beta1/spendable_balances/{address}/by_denom"; } // TotalSupply queries the total supply of all coins. + // + // When called from another module, this query might consume a high amount of + // gas if the pagination field is incorrectly set. rpc TotalSupply(QueryTotalSupplyRequest) returns (QueryTotalSupplyResponse) { - option (google.api.http).get = "/cosmos/bank/v1beta1/supply"; + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = "/cosmos/bank/v1beta1/supply"; } // SupplyOf queries the supply of a single coin. + // + // When called from another module, this query might consume a high amount of + // gas if the pagination field is incorrectly set. rpc SupplyOf(QuerySupplyOfRequest) returns (QuerySupplyOfResponse) { - option (google.api.http).get = "/cosmos/bank/v1beta1/supply/by_denom"; + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = "/cosmos/bank/v1beta1/supply/by_denom"; } // Params queries the parameters of x/bank module. rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/cosmos/bank/v1beta1/params"; - } - - // DenomsMetadata queries the client metadata of a given coin denomination. - rpc DenomMetadata(QueryDenomMetadataRequest) returns (QueryDenomMetadataResponse) { - option (google.api.http).get = "/cosmos/bank/v1beta1/denoms_metadata/{denom}"; + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = "/cosmos/bank/v1beta1/params"; } // DenomsMetadata queries the client metadata for all registered coin // denominations. rpc DenomsMetadata(QueryDenomsMetadataRequest) returns (QueryDenomsMetadataResponse) { - option (google.api.http).get = "/cosmos/bank/v1beta1/denoms_metadata"; + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = "/cosmos/bank/v1beta1/denoms_metadata"; + } + + // DenomMetadata queries the client metadata of a given coin denomination. + rpc DenomMetadata(QueryDenomMetadataRequest) returns (QueryDenomMetadataResponse) { + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = "/cosmos/bank/v1beta1/denoms_metadata/{denom=**}"; + } + + // DenomMetadataByQueryString queries the client metadata of a given coin denomination. + rpc DenomMetadataByQueryString(QueryDenomMetadataByQueryStringRequest) + returns (QueryDenomMetadataByQueryStringResponse) { + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = "/cosmos/bank/v1beta1/denoms_metadata_by_query_string"; } // DenomOwners queries for all account addresses that own a particular token // denomination. // - // Since: cosmos-sdk 0.46 + // When called from another module, this query might consume a high amount of + // gas if the pagination field is incorrectly set. rpc DenomOwners(QueryDenomOwnersRequest) returns (QueryDenomOwnersResponse) { - option (google.api.http).get = "/cosmos/bank/v1beta1/denom_owners/{denom}"; + option (cosmos_proto.method_added_in) = "cosmos-sdk 0.46"; + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = "/cosmos/bank/v1beta1/denom_owners/{denom=**}"; + } + + // DenomOwnersByQuery queries for all account addresses that own a particular token + // denomination. + rpc DenomOwnersByQuery(QueryDenomOwnersByQueryRequest) returns (QueryDenomOwnersByQueryResponse) { + option (cosmos_proto.method_added_in) = "cosmos-sdk 0.50.3"; + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = "/cosmos/bank/v1beta1/denom_owners_by_query"; + } + + // SendEnabled queries for SendEnabled entries. + // + // This query only returns denominations that have specific SendEnabled settings. + // Any denomination that does not have a specific setting will use the default + // params.default_send_enabled, and will not be returned by this query. + rpc SendEnabled(QuerySendEnabledRequest) returns (QuerySendEnabledResponse) { + option (cosmos_proto.method_added_in) = "cosmos-sdk 0.47"; + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = "/cosmos/bank/v1beta1/send_enabled"; } } @@ -93,14 +154,21 @@ message QueryAllBalancesRequest { // pagination defines an optional pagination for the request. cosmos.base.query.v1beta1.PageRequest pagination = 2; + + // resolve_denom is the flag to resolve the denom into a human-readable form from the metadata. + bool resolve_denom = 3 [(cosmos_proto.field_added_in) = "cosmos-sdk 0.50.0"]; } // QueryAllBalancesResponse is the response type for the Query/AllBalances RPC // method. message QueryAllBalancesResponse { // balances is the balances of all the coins. - repeated cosmos.base.v1beta1.Coin balances = 1 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; + repeated cosmos.base.v1beta1.Coin balances = 1 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true, + (amino.encoding) = "legacy_coins", + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; // pagination defines the pagination in the response. cosmos.base.query.v1beta1.PageResponse pagination = 2; @@ -108,11 +176,10 @@ message QueryAllBalancesResponse { // QuerySpendableBalancesRequest defines the gRPC request structure for querying // an account's spendable balances. -// -// Since: cosmos-sdk 0.46 message QuerySpendableBalancesRequest { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.46"; + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; // address is the address to query spendable balances for. string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; @@ -123,17 +190,42 @@ message QuerySpendableBalancesRequest { // QuerySpendableBalancesResponse defines the gRPC response structure for querying // an account's spendable balances. -// -// Since: cosmos-sdk 0.46 message QuerySpendableBalancesResponse { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.46"; // balances is the spendable balances of all the coins. - repeated cosmos.base.v1beta1.Coin balances = 1 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; + repeated cosmos.base.v1beta1.Coin balances = 1 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true, + (amino.encoding) = "legacy_coins", + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; // pagination defines the pagination in the response. cosmos.base.query.v1beta1.PageResponse pagination = 2; } +// QuerySpendableBalanceByDenomRequest defines the gRPC request structure for +// querying an account's spendable balance for a specific denom. +message QuerySpendableBalanceByDenomRequest { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.47"; + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // address is the address to query balances for. + string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // denom is the coin denom to query balances for. + string denom = 2; +} + +// QuerySpendableBalanceByDenomResponse defines the gRPC response structure for +// querying an account's spendable balance for a specific denom. +message QuerySpendableBalanceByDenomResponse { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.47"; + // balance is the balance of the coin. + cosmos.base.v1beta1.Coin balance = 1; +} + // QueryTotalSupplyRequest is the request type for the Query/TotalSupply RPC // method. message QueryTotalSupplyRequest { @@ -141,22 +233,22 @@ message QueryTotalSupplyRequest { option (gogoproto.goproto_getters) = false; // pagination defines an optional pagination for the request. - // - // Since: cosmos-sdk 0.43 - cosmos.base.query.v1beta1.PageRequest pagination = 1; + cosmos.base.query.v1beta1.PageRequest pagination = 1 [(cosmos_proto.field_added_in) = "cosmos-sdk 0.43"]; } // QueryTotalSupplyResponse is the response type for the Query/TotalSupply RPC // method message QueryTotalSupplyResponse { // supply is the supply of the coins - repeated cosmos.base.v1beta1.Coin supply = 1 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; + repeated cosmos.base.v1beta1.Coin supply = 1 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true, + (amino.encoding) = "legacy_coins", + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; // pagination defines the pagination in the response. - // - // Since: cosmos-sdk 0.43 - cosmos.base.query.v1beta1.PageResponse pagination = 2; + cosmos.base.query.v1beta1.PageResponse pagination = 2 [(cosmos_proto.field_added_in) = "cosmos-sdk 0.43"]; } // QuerySupplyOfRequest is the request type for the Query/SupplyOf RPC method. @@ -168,7 +260,7 @@ message QuerySupplyOfRequest { // QuerySupplyOfResponse is the response type for the Query/SupplyOf RPC method. message QuerySupplyOfResponse { // amount is the supply of the coin. - cosmos.base.v1beta1.Coin amount = 1 [(gogoproto.nullable) = false]; + cosmos.base.v1beta1.Coin amount = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // QueryParamsRequest defines the request type for querying x/bank parameters. @@ -176,7 +268,8 @@ message QueryParamsRequest {} // QueryParamsResponse defines the response type for querying x/bank parameters. message QueryParamsResponse { - Params params = 1 [(gogoproto.nullable) = false]; + // params provides the parameters of the bank module. + Params params = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // QueryDenomsMetadataRequest is the request type for the Query/DenomsMetadata RPC method. @@ -189,7 +282,7 @@ message QueryDenomsMetadataRequest { // method. message QueryDenomsMetadataResponse { // metadata provides the client information for all the registered tokens. - repeated Metadata metadatas = 1 [(gogoproto.nullable) = false]; + repeated Metadata metadatas = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // pagination defines the pagination in the response. cosmos.base.query.v1beta1.PageResponse pagination = 2; @@ -205,7 +298,21 @@ message QueryDenomMetadataRequest { // method. message QueryDenomMetadataResponse { // metadata describes and provides all the client information for the requested token. - Metadata metadata = 1 [(gogoproto.nullable) = false]; + Metadata metadata = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; +} + +// QueryDenomMetadataByQueryStringRequest is the request type for the Query/DenomMetadata RPC method. +// Identical with QueryDenomMetadataRequest but receives denom as query string. +message QueryDenomMetadataByQueryStringRequest { + // denom is the coin denom to query the metadata for. + string denom = 1; +} + +// QueryDenomMetadataByQueryStringResponse is the response type for the Query/DenomMetadata RPC +// method. Identical with QueryDenomMetadataResponse but receives denom as query string in request. +message QueryDenomMetadataByQueryStringResponse { + // metadata describes and provides all the client information for the requested token. + Metadata metadata = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // QueryDenomOwnersRequest defines the request type for the DenomOwners RPC query, @@ -222,22 +329,60 @@ message QueryDenomOwnersRequest { // DenomOwner defines structure representing an account that owns or holds a // particular denominated token. It contains the account address and account // balance of the denominated token. -// -// Since: cosmos-sdk 0.46 message DenomOwner { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.46"; // address defines the address that owns a particular denomination. string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // balance is the balance of the denominated coin for an account. - cosmos.base.v1beta1.Coin balance = 2 [(gogoproto.nullable) = false]; + cosmos.base.v1beta1.Coin balance = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // QueryDenomOwnersResponse defines the RPC response of a DenomOwners RPC query. -// -// Since: cosmos-sdk 0.46 message QueryDenomOwnersResponse { - repeated DenomOwner denom_owners = 1; + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.46"; + repeated DenomOwner denom_owners = 1; + + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryDenomOwnersByQueryRequest defines the request type for the DenomOwnersByQuery RPC query, +// which queries for a paginated set of all account holders of a particular +// denomination. +message QueryDenomOwnersByQueryRequest { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.50.3"; + // denom defines the coin denomination to query all account holders for. + string denom = 1; + + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// QueryDenomOwnersByQueryResponse defines the RPC response of a DenomOwnersByQuery RPC query. +message QueryDenomOwnersByQueryResponse { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.50.3"; + repeated DenomOwner denom_owners = 1; // pagination defines the pagination in the response. cosmos.base.query.v1beta1.PageResponse pagination = 2; } + +// QuerySendEnabledRequest defines the RPC request for looking up SendEnabled entries. +message QuerySendEnabledRequest { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.47"; + // denoms is the specific denoms you want look up. Leave empty to get all entries. + repeated string denoms = 1; + // pagination defines an optional pagination for the request. This field is + // only read if the denoms field is empty. + cosmos.base.query.v1beta1.PageRequest pagination = 99; +} + +// QuerySendEnabledResponse defines the RPC response of a SendEnable query. +message QuerySendEnabledResponse { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.47"; + repeated SendEnabled send_enabled = 1; + // pagination defines the pagination in the response. This field is only + // populated if the denoms field in the request is empty. + cosmos.base.query.v1beta1.PageResponse pagination = 99; +} diff --git a/packages/api/proto/cosmos/bank/v1beta1/tx.proto b/packages/api/proto/cosmos/bank/v1beta1/tx.proto index 22e62cbf..d4779aab 100644 --- a/packages/api/proto/cosmos/bank/v1beta1/tx.proto +++ b/packages/api/proto/cosmos/bank/v1beta1/tx.proto @@ -6,29 +6,51 @@ import "cosmos/base/v1beta1/coin.proto"; import "cosmos/bank/v1beta1/bank.proto"; import "cosmos_proto/cosmos.proto"; import "cosmos/msg/v1/msg.proto"; +import "amino/amino.proto"; option go_package = "github.com/cosmos/cosmos-sdk/x/bank/types"; // Msg defines the bank Msg service. service Msg { + option (cosmos.msg.v1.service) = true; + // Send defines a method for sending coins from one account to another account. rpc Send(MsgSend) returns (MsgSendResponse); // MultiSend defines a method for sending coins from some accounts to other accounts. rpc MultiSend(MsgMultiSend) returns (MsgMultiSendResponse); + + // UpdateParams defines a governance operation for updating the x/bank module parameters. + // The authority is defined in the keeper. + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse) { + option (cosmos_proto.method_added_in) = "cosmos-sdk 0.47"; + }; + + // SetSendEnabled is a governance operation for setting the SendEnabled flag + // on any number of Denoms. Only the entries to add or update should be + // included. Entries that already exist in the store, but that aren't + // included in this message, will be left unchanged. + rpc SetSendEnabled(MsgSetSendEnabled) returns (MsgSetSendEnabledResponse) { + option (cosmos_proto.method_added_in) = "cosmos-sdk 0.47"; + }; } // MsgSend represents a message to send coins from one account to another. message MsgSend { option (cosmos.msg.v1.signer) = "from_address"; + option (amino.name) = "cosmos-sdk/MsgSend"; option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; string from_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; string to_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - repeated cosmos.base.v1beta1.Coin amount = 3 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; + repeated cosmos.base.v1beta1.Coin amount = 3 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true, + (amino.encoding) = "legacy_coins", + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; } // MsgSendResponse defines the Msg/Send response type. @@ -37,12 +59,64 @@ message MsgSendResponse {} // MsgMultiSend represents an arbitrary multi-in, multi-out send message. message MsgMultiSend { option (cosmos.msg.v1.signer) = "inputs"; + option (amino.name) = "cosmos-sdk/MsgMultiSend"; option (gogoproto.equal) = false; - repeated Input inputs = 1 [(gogoproto.nullable) = false]; - repeated Output outputs = 2 [(gogoproto.nullable) = false]; + // Inputs, despite being `repeated`, only allows one sender input. This is + // checked in MsgMultiSend's ValidateBasic. + repeated Input inputs = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + repeated Output outputs = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // MsgMultiSendResponse defines the Msg/MultiSend response type. message MsgMultiSendResponse {} + +// MsgUpdateParams is the Msg/UpdateParams request type. +message MsgUpdateParams { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.47"; + option (cosmos.msg.v1.signer) = "authority"; + + // authority is the address that controls the module (defaults to x/gov unless overwritten). + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + option (amino.name) = "cosmos-sdk/x/bank/MsgUpdateParams"; + + // params defines the x/bank parameters to update. + // + // NOTE: All parameters must be supplied. + Params params = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +message MsgUpdateParamsResponse { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.47"; +} + +// MsgSetSendEnabled is the Msg/SetSendEnabled request type. +// +// Only entries to add/update/delete need to be included. +// Existing SendEnabled entries that are not included in this +// message are left unchanged. +message MsgSetSendEnabled { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.47"; + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "cosmos-sdk/MsgSetSendEnabled"; + + // authority is the address that controls the module. + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // send_enabled is the list of entries to add or update. + repeated SendEnabled send_enabled = 2; + + // use_default_for is a list of denoms that should use the params.default_send_enabled value. + // Denoms listed here will have their SendEnabled entries deleted. + // If a denom is included that doesn't have a SendEnabled entry, + // it will be ignored. + repeated string use_default_for = 3; +} + +// MsgSetSendEnabledResponse defines the Msg/SetSendEnabled response type. +message MsgSetSendEnabledResponse { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.47"; +} diff --git a/packages/api/proto/cosmos/base/abci/v1beta1/abci.proto b/packages/api/proto/cosmos/base/abci/v1beta1/abci.proto index ddaa6356..93eff810 100644 --- a/packages/api/proto/cosmos/base/abci/v1beta1/abci.proto +++ b/packages/api/proto/cosmos/base/abci/v1beta1/abci.proto @@ -3,7 +3,9 @@ package cosmos.base.abci.v1beta1; import "gogoproto/gogo.proto"; import "tendermint/abci/types.proto"; +import "tendermint/types/block.proto"; import "google/protobuf/any.proto"; +import "cosmos_proto/cosmos.proto"; option go_package = "github.com/cosmos/cosmos-sdk/types"; option (gogoproto.goproto_stringer_all) = false; @@ -43,9 +45,8 @@ message TxResponse { // these events include those emitted by processing all the messages and those // emitted from the ante. Whereas Logs contains the events, with // additional metadata, emitted only by processing the messages. - // - // Since: cosmos-sdk 0.42.11, 0.44.5, 0.45 - repeated tendermint.abci.Event events = 13 [(gogoproto.nullable) = false]; + repeated tendermint.abci.Event events = 13 + [(gogoproto.nullable) = false, (cosmos_proto.field_added_in) = "cosmos-sdk 0.45"]; } // ABCIMessageLog defines a structure containing an indexed tx ABCI message log. @@ -103,9 +104,7 @@ message Result { repeated tendermint.abci.Event events = 3 [(gogoproto.nullable) = false]; // msg_responses contains the Msg handler responses type packed in Anys. - // - // Since: cosmos-sdk 0.46 - repeated google.protobuf.Any msg_responses = 4; + repeated google.protobuf.Any msg_responses = 4 [(cosmos_proto.field_added_in) = "cosmos-sdk 0.46"]; } // SimulationResponse defines the response generated when a transaction is @@ -134,9 +133,7 @@ message TxMsgData { repeated MsgData data = 1 [deprecated = true]; // msg_responses contains the Msg handler responses packed into Anys. - // - // Since: cosmos-sdk 0.46 - repeated google.protobuf.Any msg_responses = 2; + repeated google.protobuf.Any msg_responses = 2 [(cosmos_proto.field_added_in) = "cosmos-sdk 0.46"]; } // SearchTxsResult defines a structure for querying txs pageable @@ -156,3 +153,21 @@ message SearchTxsResult { // List of txs in current page repeated TxResponse txs = 6; } + +// SearchBlocksResult defines a structure for querying blocks pageable +message SearchBlocksResult { + option (gogoproto.stringer) = true; + + // Count of all blocks + int64 total_count = 1; + // Count of blocks in current page + int64 count = 2; + // Index of current page, start from 1 + int64 page_number = 3; + // Count of total pages + int64 page_total = 4; + // Max count blocks per page + int64 limit = 5; + // List of blocks in current page + repeated tendermint.types.Block blocks = 6; +} diff --git a/packages/api/proto/cosmos/base/node/v1beta1/query.proto b/packages/api/proto/cosmos/base/node/v1beta1/query.proto index 8070f7b9..95df568f 100644 --- a/packages/api/proto/cosmos/base/node/v1beta1/query.proto +++ b/packages/api/proto/cosmos/base/node/v1beta1/query.proto @@ -2,6 +2,8 @@ syntax = "proto3"; package cosmos.base.node.v1beta1; import "google/api/annotations.proto"; +import "google/protobuf/timestamp.proto"; +import "gogoproto/gogo.proto"; option go_package = "github.com/cosmos/cosmos-sdk/client/grpc/node"; @@ -11,6 +13,10 @@ service Service { rpc Config(ConfigRequest) returns (ConfigResponse) { option (google.api.http).get = "/cosmos/base/node/v1beta1/config"; } + // Status queries for the node status. + rpc Status(StatusRequest) returns (StatusResponse) { + option (google.api.http).get = "/cosmos/base/node/v1beta1/status"; + } } // ConfigRequest defines the request structure for the Config gRPC query. @@ -18,5 +24,20 @@ message ConfigRequest {} // ConfigResponse defines the response structure for the Config gRPC query. message ConfigResponse { - string minimum_gas_price = 1; + string minimum_gas_price = 1; + string pruning_keep_recent = 2; + string pruning_interval = 3; + uint64 halt_height = 4; +} + +// StateRequest defines the request structure for the status of a node. +message StatusRequest {} + +// StateResponse defines the response structure for the status of a node. +message StatusResponse { + uint64 earliest_store_height = 1; // earliest block height available in the store + uint64 height = 2; // current block height + google.protobuf.Timestamp timestamp = 3 [(gogoproto.stdtime) = true]; // block height timestamp + bytes app_hash = 4; // app hash of the current block + bytes validator_hash = 5; // validator hash provided by the consensus header } diff --git a/packages/api/proto/cosmos/base/query/v1beta1/pagination.proto b/packages/api/proto/cosmos/base/query/v1beta1/pagination.proto index 0a368144..e58f1eec 100644 --- a/packages/api/proto/cosmos/base/query/v1beta1/pagination.proto +++ b/packages/api/proto/cosmos/base/query/v1beta1/pagination.proto @@ -2,6 +2,7 @@ syntax = "proto3"; package cosmos.base.query.v1beta1; option go_package = "github.com/cosmos/cosmos-sdk/types/query"; +import "cosmos_proto/cosmos.proto"; // PageRequest is to be embedded in gRPC request messages for efficient // pagination. Ex: @@ -32,9 +33,7 @@ message PageRequest { bool count_total = 4; // reverse is set to true if results are to be returned in the descending order. - // - // Since: cosmos-sdk 0.43 - bool reverse = 5; + bool reverse = 5 [(cosmos_proto.field_added_in) = "cosmos-sdk 0.43"]; } // PageResponse is to be embedded in gRPC response messages where the diff --git a/packages/api/proto/cosmos/base/reflection/v2alpha1/reflection.proto b/packages/api/proto/cosmos/base/reflection/v2alpha1/reflection.proto index d5b04855..3e8e9404 100644 --- a/packages/api/proto/cosmos/base/reflection/v2alpha1/reflection.proto +++ b/packages/api/proto/cosmos/base/reflection/v2alpha1/reflection.proto @@ -1,4 +1,3 @@ -// Since: cosmos-sdk 0.43 syntax = "proto3"; package cosmos.base.reflection.v2alpha1; diff --git a/packages/api/proto/cosmos/base/store/v1beta1/listening.proto b/packages/api/proto/cosmos/base/store/v1beta1/listening.proto deleted file mode 100644 index 753f7c16..00000000 --- a/packages/api/proto/cosmos/base/store/v1beta1/listening.proto +++ /dev/null @@ -1,34 +0,0 @@ -syntax = "proto3"; -package cosmos.base.store.v1beta1; - -import "tendermint/abci/types.proto"; - -option go_package = "github.com/cosmos/cosmos-sdk/store/types"; - -// StoreKVPair is a KVStore KVPair used for listening to state changes (Sets and Deletes) -// It optionally includes the StoreKey for the originating KVStore and a Boolean flag to distinguish between Sets and -// Deletes -// -// Since: cosmos-sdk 0.43 -message StoreKVPair { - string store_key = 1; // the store key for the KVStore this pair originates from - bool delete = 2; // true indicates a delete operation, false indicates a set operation - bytes key = 3; - bytes value = 4; -} - -// BlockMetadata contains all the abci event data of a block -// the file streamer dump them into files together with the state changes. -message BlockMetadata { - // DeliverTx encapulate deliver tx request and response. - message DeliverTx { - tendermint.abci.RequestDeliverTx request = 1; - tendermint.abci.ResponseDeliverTx response = 2; - } - tendermint.abci.RequestBeginBlock request_begin_block = 1; - tendermint.abci.ResponseBeginBlock response_begin_block = 2; - repeated DeliverTx deliver_txs = 3; - tendermint.abci.RequestEndBlock request_end_block = 4; - tendermint.abci.ResponseEndBlock response_end_block = 5; - tendermint.abci.ResponseCommit response_commit = 6; -} diff --git a/packages/api/proto/cosmos/base/tendermint/v1beta1/query.proto b/packages/api/proto/cosmos/base/tendermint/v1beta1/query.proto index 2d516901..2ec60178 100644 --- a/packages/api/proto/cosmos/base/tendermint/v1beta1/query.proto +++ b/packages/api/proto/cosmos/base/tendermint/v1beta1/query.proto @@ -10,8 +10,9 @@ import "cosmos/base/query/v1beta1/pagination.proto"; import "cosmos/base/tendermint/v1beta1/types.proto"; import "cosmos_proto/cosmos.proto"; import "tendermint/types/block.proto"; +import "amino/amino.proto"; -option go_package = "github.com/cosmos/cosmos-sdk/client/grpc/tmservice"; +option go_package = "github.com/cosmos/cosmos-sdk/client/grpc/cmtservice"; // Service defines the gRPC querier service for tendermint queries. service Service { @@ -45,26 +46,23 @@ service Service { option (google.api.http).get = "/cosmos/base/tendermint/v1beta1/validatorsets/{height}"; } - // ABCIQuery defines a query handler that supports ABCI queries directly to - // the application, bypassing Tendermint completely. The ABCI query must - // contain a valid and supported path, including app, custom, p2p, and store. - // - // Since: cosmos-sdk 0.46 + // ABCIQuery defines a query handler that supports ABCI queries directly to the + // application, bypassing Tendermint completely. The ABCI query must contain + // a valid and supported path, including app, custom, p2p, and store. rpc ABCIQuery(ABCIQueryRequest) returns (ABCIQueryResponse) { - option (google.api.http).get = "/cosmos/base/tendermint/v1beta1/abci_query"; + option (cosmos_proto.method_added_in) = "cosmos-sdk 0.46"; + option (google.api.http).get = "/cosmos/base/tendermint/v1beta1/abci_query"; } } -// GetValidatorSetByHeightRequest is the request type for the -// Query/GetValidatorSetByHeight RPC method. +// GetValidatorSetByHeightRequest is the request type for the Query/GetValidatorSetByHeight RPC method. message GetValidatorSetByHeightRequest { int64 height = 1; // pagination defines an pagination for the request. cosmos.base.query.v1beta1.PageRequest pagination = 2; } -// GetValidatorSetByHeightResponse is the response type for the -// Query/GetValidatorSetByHeight RPC method. +// GetValidatorSetByHeightResponse is the response type for the Query/GetValidatorSetByHeight RPC method. message GetValidatorSetByHeightResponse { int64 block_height = 1; repeated Validator validators = 2; @@ -72,15 +70,13 @@ message GetValidatorSetByHeightResponse { cosmos.base.query.v1beta1.PageResponse pagination = 3; } -// GetLatestValidatorSetRequest is the request type for the -// Query/GetValidatorSetByHeight RPC method. +// GetLatestValidatorSetRequest is the request type for the Query/GetValidatorSetByHeight RPC method. message GetLatestValidatorSetRequest { // pagination defines an pagination for the request. cosmos.base.query.v1beta1.PageRequest pagination = 1; } -// GetLatestValidatorSetResponse is the response type for the -// Query/GetValidatorSetByHeight RPC method. +// GetLatestValidatorSetResponse is the response type for the Query/GetValidatorSetByHeight RPC method. message GetLatestValidatorSetResponse { int64 block_height = 1; repeated Validator validators = 2; @@ -96,38 +92,32 @@ message Validator { int64 proposer_priority = 4; } -// GetBlockByHeightRequest is the request type for the Query/GetBlockByHeight -// RPC method. +// GetBlockByHeightRequest is the request type for the Query/GetBlockByHeight RPC method. message GetBlockByHeightRequest { int64 height = 1; } -// GetBlockByHeightResponse is the response type for the Query/GetBlockByHeight -// RPC method. +// GetBlockByHeightResponse is the response type for the Query/GetBlockByHeight RPC method. message GetBlockByHeightResponse { .tendermint.types.BlockID block_id = 1; // Deprecated: please use `sdk_block` instead .tendermint.types.Block block = 2; - // Since: cosmos-sdk 0.47 - Block sdk_block = 3; + Block sdk_block = 3 [(cosmos_proto.field_added_in) = "cosmos-sdk 0.47"]; } -// GetLatestBlockRequest is the request type for the Query/GetLatestBlock RPC -// method. +// GetLatestBlockRequest is the request type for the Query/GetLatestBlock RPC method. message GetLatestBlockRequest {} -// GetLatestBlockResponse is the response type for the Query/GetLatestBlock RPC -// method. +// GetLatestBlockResponse is the response type for the Query/GetLatestBlock RPC method. message GetLatestBlockResponse { .tendermint.types.BlockID block_id = 1; // Deprecated: please use `sdk_block` instead .tendermint.types.Block block = 2; - // Since: cosmos-sdk 0.47 - Block sdk_block = 3; + Block sdk_block = 3 [(cosmos_proto.field_added_in) = "cosmos-sdk 0.47"]; } // GetSyncingRequest is the request type for the Query/GetSyncing RPC method. @@ -141,8 +131,7 @@ message GetSyncingResponse { // GetNodeInfoRequest is the request type for the Query/GetNodeInfo RPC method. message GetNodeInfoRequest {} -// GetNodeInfoResponse is the response type for the Query/GetNodeInfo RPC -// method. +// GetNodeInfoResponse is the response type for the Query/GetNodeInfo RPC method. message GetNodeInfoResponse { .tendermint.p2p.DefaultNodeInfo default_node_info = 1; VersionInfo application_version = 2; @@ -150,15 +139,14 @@ message GetNodeInfoResponse { // VersionInfo is the type for the GetNodeInfoResponse message. message VersionInfo { - string name = 1; - string app_name = 2; - string version = 3; - string git_commit = 4; - string build_tags = 5; - string go_version = 6; - repeated Module build_deps = 7; - // Since: cosmos-sdk 0.43 - string cosmos_sdk_version = 8; + string name = 1; + string app_name = 2; + string version = 3; + string git_commit = 4; + string build_tags = 5; + string go_version = 6; + repeated Module build_deps = 7; + string cosmos_sdk_version = 8 [(cosmos_proto.field_added_in) = "cosmos-sdk 0.43"]; } // Module is the type for VersionInfo @@ -179,8 +167,7 @@ message ABCIQueryRequest { bool prove = 4; } -// ABCIQueryResponse defines the response structure for the ABCIQuery gRPC -// query. +// ABCIQueryResponse defines the response structure for the ABCIQuery gRPC query. // // Note: This type is a duplicate of the ResponseQuery proto type defined in // Tendermint. @@ -199,11 +186,10 @@ message ABCIQueryResponse { } // ProofOp defines an operation used for calculating Merkle root. The data could -// be arbitrary format, providing nessecary data for example neighbouring node +// be arbitrary format, providing necessary data for example neighbouring node // hash. // -// Note: This type is a duplicate of the ProofOp proto type defined in -// Tendermint. +// Note: This type is a duplicate of the ProofOp proto type defined in Tendermint. message ProofOp { string type = 1; bytes key = 2; @@ -212,8 +198,7 @@ message ProofOp { // ProofOps is Merkle proof defined by the list of ProofOps. // -// Note: This type is a duplicate of the ProofOps proto type defined in -// Tendermint. +// Note: This type is a duplicate of the ProofOps proto type defined in Tendermint. message ProofOps { - repeated ProofOp ops = 1 [(gogoproto.nullable) = false]; + repeated ProofOp ops = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } diff --git a/packages/api/proto/cosmos/base/tendermint/v1beta1/types.proto b/packages/api/proto/cosmos/base/tendermint/v1beta1/types.proto index 3d6c04c2..624ff414 100644 --- a/packages/api/proto/cosmos/base/tendermint/v1beta1/types.proto +++ b/packages/api/proto/cosmos/base/tendermint/v1beta1/types.proto @@ -6,28 +6,30 @@ import "tendermint/types/types.proto"; import "tendermint/types/evidence.proto"; import "tendermint/version/types.proto"; import "google/protobuf/timestamp.proto"; +import "amino/amino.proto"; -option go_package = "github.com/cosmos/cosmos-sdk/client/grpc/tmservice"; +option go_package = "github.com/cosmos/cosmos-sdk/client/grpc/cmtservice"; // Block is tendermint type Block, with the Header proposer address // field converted to bech32 string. message Block { - Header header = 1 [(gogoproto.nullable) = false]; - .tendermint.types.Data data = 2 [(gogoproto.nullable) = false]; - .tendermint.types.EvidenceList evidence = 3 [(gogoproto.nullable) = false]; + Header header = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + .tendermint.types.Data data = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + .tendermint.types.EvidenceList evidence = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; .tendermint.types.Commit last_commit = 4; } // Header defines the structure of a Tendermint block header. message Header { // basic block info - .tendermint.version.Consensus version = 1 [(gogoproto.nullable) = false]; + .tendermint.version.Consensus version = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; string chain_id = 2 [(gogoproto.customname) = "ChainID"]; int64 height = 3; - google.protobuf.Timestamp time = 4 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + google.protobuf.Timestamp time = 4 + [(gogoproto.nullable) = false, (amino.dont_omitempty) = true, (gogoproto.stdtime) = true]; // prev block info - .tendermint.types.BlockID last_block_id = 5 [(gogoproto.nullable) = false]; + .tendermint.types.BlockID last_block_id = 5 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // hashes of block data bytes last_commit_hash = 6; // commit from validators from the last block diff --git a/packages/api/proto/cosmos/base/v1beta1/coin.proto b/packages/api/proto/cosmos/base/v1beta1/coin.proto index 69e67e09..1447d642 100644 --- a/packages/api/proto/cosmos/base/v1beta1/coin.proto +++ b/packages/api/proto/cosmos/base/v1beta1/coin.proto @@ -3,6 +3,7 @@ package cosmos.base.v1beta1; import "gogoproto/gogo.proto"; import "cosmos_proto/cosmos.proto"; +import "amino/amino.proto"; option go_package = "github.com/cosmos/cosmos-sdk/types"; option (gogoproto.goproto_stringer_all) = false; @@ -16,8 +17,12 @@ message Coin { option (gogoproto.equal) = true; string denom = 1; - string amount = 2 - [(cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "Int", (gogoproto.nullable) = false]; + string amount = 2 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; } // DecCoin defines a token with a denomination and a decimal amount. @@ -28,16 +33,29 @@ message DecCoin { option (gogoproto.equal) = true; string denom = 1; - string amount = 2 - [(cosmos_proto.scalar) = "cosmos.Dec", (gogoproto.customtype) = "Dec", (gogoproto.nullable) = false]; + string amount = 2 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; } // IntProto defines a Protobuf wrapper around an Int object. +// Deprecated: Prefer to use math.Int directly. It supports binary Marshal and Unmarshal. message IntProto { - string int = 1 [(cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "Int", (gogoproto.nullable) = false]; + string int = 1 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false + ]; } // DecProto defines a Protobuf wrapper around a Dec object. +// Deprecated: Prefer to use math.LegacyDec directly. It supports binary Marshal and Unmarshal. message DecProto { - string dec = 1 [(cosmos_proto.scalar) = "cosmos.Dec", (gogoproto.customtype) = "Dec", (gogoproto.nullable) = false]; + string dec = 1 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; } diff --git a/packages/api/proto/cosmos/benchmark/module/v1/module.proto b/packages/api/proto/cosmos/benchmark/module/v1/module.proto new file mode 100644 index 00000000..480bbf5f --- /dev/null +++ b/packages/api/proto/cosmos/benchmark/module/v1/module.proto @@ -0,0 +1,43 @@ +syntax = "proto3"; + +package cosmos.benchmark.module.v1; + +import "cosmos/app/v1alpha1/module.proto"; + +// Module is the config object of the benchmark module. +message Module { + option (cosmos.app.v1alpha1.module) = { + go_import: "cosmossdk.io/tools/benchmark" + }; + + GeneratorParams genesis_params = 1; +} + +// GenesisParams defines the genesis parameters for the benchmark module. +message GeneratorParams { + // seed is the seed for the random number generator. + uint64 seed = 1; + // bucket_count is the number of store keys to uniformly distribute genesis_count keys across. + uint64 bucket_count = 2; + + // key_mean is the mean size (in normal distribution) of keys in each bucket. + uint64 key_mean = 3; + // key_std_dev is the standard deviation of key sizes in each bucket. + uint64 key_std_dev = 4; + // value_mean is the mean size (in normal distribution) of values in each bucket. + uint64 value_mean = 6; + // value_std_dev is the standard deviation of value sizes in each bucket. + uint64 value_std_dev = 7; + + // genesis_count is the number of keys to insert in the store, distributed across all buckets. + uint64 genesis_count = 8; + + // insert_weight is the weight of insert operations. + float insert_weight = 9; + // update_weight is the weight of update operations. + float update_weight = 10; + // get_weight is the weight of get operations. + float get_weight = 12; + // delete_weight is the weight of delete operations. + float delete_weight = 11; +} \ No newline at end of file diff --git a/packages/api/proto/cosmos/benchmark/v1/benchmark.proto b/packages/api/proto/cosmos/benchmark/v1/benchmark.proto new file mode 100644 index 00000000..db77c229 --- /dev/null +++ b/packages/api/proto/cosmos/benchmark/v1/benchmark.proto @@ -0,0 +1,17 @@ +syntax = "proto3"; + +package cosmos.benchmark.v1; + +option go_package = "cosmossdk.io/tools/benchmark"; + +// Op is a message describing a benchmark operation. +message Op { + uint64 seed = 1; + string actor = 2; + + uint64 key_length = 3; + uint64 value_length = 4; + uint32 iterations = 5; + bool delete = 6; + bool exists = 7; +} \ No newline at end of file diff --git a/packages/api/proto/cosmos/benchmark/v1/tx.proto b/packages/api/proto/cosmos/benchmark/v1/tx.proto new file mode 100644 index 00000000..50c2cb1a --- /dev/null +++ b/packages/api/proto/cosmos/benchmark/v1/tx.proto @@ -0,0 +1,33 @@ +syntax = "proto3"; + +package cosmos.benchmark.v1; + +import "cosmos/benchmark/v1/benchmark.proto"; +import "cosmos/msg/v1/msg.proto"; +import "amino/amino.proto"; + +option go_package = "cosmossdk.io/tools/benchmark"; + +// MsgLoadTestOps defines a message containing a sequence of load test operations. +message MsgLoadTest { + option (cosmos.msg.v1.signer) = "caller"; + option (amino.name) = "cosmos-sdk/tools/benchmark/v1/MsgLoadTest"; + + bytes caller = 1; + + repeated Op ops = 2; +} + +// MsgLoadTestResponse defines a message containing the results of a load test operation. +message MsgLoadTestResponse { + uint64 total_time = 1; + uint64 total_errors = 2; +} + +// Msg defines the benchmark Msg service. +service Msg { + option (cosmos.msg.v1.service) = true; + + // LoadTest defines a method for executing a sequence of load test operations. + rpc LoadTest(MsgLoadTest) returns (MsgLoadTestResponse); +} diff --git a/packages/api/proto/cosmos/capability/v1beta1/capability.proto b/packages/api/proto/cosmos/capability/v1beta1/capability.proto deleted file mode 100644 index c433566d..00000000 --- a/packages/api/proto/cosmos/capability/v1beta1/capability.proto +++ /dev/null @@ -1,30 +0,0 @@ -syntax = "proto3"; -package cosmos.capability.v1beta1; - -option go_package = "github.com/cosmos/cosmos-sdk/x/capability/types"; - -import "gogoproto/gogo.proto"; - -// Capability defines an implementation of an object capability. The index -// provided to a Capability must be globally unique. -message Capability { - option (gogoproto.goproto_stringer) = false; - - uint64 index = 1; -} - -// Owner defines a single capability owner. An owner is defined by the name of -// capability and the module name. -message Owner { - option (gogoproto.goproto_stringer) = false; - option (gogoproto.goproto_getters) = false; - - string module = 1; - string name = 2; -} - -// CapabilityOwners defines a set of owners of a single Capability. The set of -// owners must be unique. -message CapabilityOwners { - repeated Owner owners = 1 [(gogoproto.nullable) = false]; -} diff --git a/packages/api/proto/cosmos/capability/v1beta1/genesis.proto b/packages/api/proto/cosmos/capability/v1beta1/genesis.proto deleted file mode 100644 index b5482439..00000000 --- a/packages/api/proto/cosmos/capability/v1beta1/genesis.proto +++ /dev/null @@ -1,26 +0,0 @@ -syntax = "proto3"; -package cosmos.capability.v1beta1; - -import "gogoproto/gogo.proto"; -import "cosmos/capability/v1beta1/capability.proto"; - -option go_package = "github.com/cosmos/cosmos-sdk/x/capability/types"; - -// GenesisOwners defines the capability owners with their corresponding index. -message GenesisOwners { - // index is the index of the capability owner. - uint64 index = 1; - - // index_owners are the owners at the given index. - CapabilityOwners index_owners = 2 [(gogoproto.nullable) = false]; -} - -// GenesisState defines the capability module's genesis state. -message GenesisState { - // index is the capability global index. - uint64 index = 1; - - // owners represents a map from index to owners of the capability index - // index key is string to allow amino marshalling. - repeated GenesisOwners owners = 2 [(gogoproto.nullable) = false]; -} diff --git a/packages/api/proto/cosmos/circuit/module/v1/module.proto b/packages/api/proto/cosmos/circuit/module/v1/module.proto new file mode 100644 index 00000000..7104bad4 --- /dev/null +++ b/packages/api/proto/cosmos/circuit/module/v1/module.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; + +package cosmos.circuit.module.v1; + +import "cosmos/app/v1alpha1/module.proto"; + +// Module is the config object of the circuit module. +message Module { + option (cosmos.app.v1alpha1.module) = { + go_import: "cosmossdk.io/x/circuit" + }; + + // authority defines the custom module authority. If not set, defaults to the governance module. + string authority = 1; +} diff --git a/packages/api/proto/cosmos/circuit/v1/query.proto b/packages/api/proto/cosmos/circuit/v1/query.proto new file mode 100644 index 00000000..0115d335 --- /dev/null +++ b/packages/api/proto/cosmos/circuit/v1/query.proto @@ -0,0 +1,61 @@ +syntax = "proto3"; +package cosmos.circuit.v1; + +option go_package = "cosmossdk.io/x/circuit/types"; + +import "cosmos/base/query/v1beta1/pagination.proto"; +import "cosmos/circuit/v1/types.proto"; +import "google/api/annotations.proto"; +import "cosmos/query/v1/query.proto"; + +// Query defines the circuit gRPC querier service. +service Query { + // Account returns account permissions. + rpc Account(QueryAccountRequest) returns (AccountResponse) { + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = "/cosmos/circuit/v1/accounts/{address}"; + } + + // Account returns account permissions. + rpc Accounts(QueryAccountsRequest) returns (AccountsResponse) { + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = "/cosmos/circuit/v1/accounts"; + } + + // DisabledList returns a list of disabled message urls + rpc DisabledList(QueryDisabledListRequest) returns (DisabledListResponse) { + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = "/cosmos/circuit/v1/disable_list"; + } +} + +// QueryAccountRequest is the request type for the Query/Account RPC method. +message QueryAccountRequest { + string address = 1; +} + +// AccountResponse is the response type for the Query/Account RPC method. +message AccountResponse { + Permissions permission = 1; +} + +// QueryAccountsRequest is the request type for the Query/Accounts RPC method. +message QueryAccountsRequest { + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +// AccountsResponse is the response type for the Query/Accounts RPC method. +message AccountsResponse { + repeated GenesisAccountPermissions accounts = 1; + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryDisableListRequest is the request type for the Query/DisabledList RPC method. +message QueryDisabledListRequest {} + +// DisabledListResponse is the response type for the Query/DisabledList RPC method. +message DisabledListResponse { + repeated string disabled_list = 1; +} diff --git a/packages/api/proto/cosmos/circuit/v1/tx.proto b/packages/api/proto/cosmos/circuit/v1/tx.proto new file mode 100644 index 00000000..71f708bb --- /dev/null +++ b/packages/api/proto/cosmos/circuit/v1/tx.proto @@ -0,0 +1,83 @@ +syntax = "proto3"; +package cosmos.circuit.v1; + +option go_package = "cosmossdk.io/x/circuit/types"; + +import "cosmos/msg/v1/msg.proto"; +import "cosmos/circuit/v1/types.proto"; + +// Msg defines the circuit Msg service. +service Msg { + option (cosmos.msg.v1.service) = true; + + // AuthorizeCircuitBreaker allows a super-admin to grant (or revoke) another + // account's circuit breaker permissions. + rpc AuthorizeCircuitBreaker(MsgAuthorizeCircuitBreaker) returns (MsgAuthorizeCircuitBreakerResponse); + + // TripCircuitBreaker pauses processing of Msg's in the state machine. + rpc TripCircuitBreaker(MsgTripCircuitBreaker) returns (MsgTripCircuitBreakerResponse); + + // ResetCircuitBreaker resumes processing of Msg's in the state machine that + // have been been paused using TripCircuitBreaker. + rpc ResetCircuitBreaker(MsgResetCircuitBreaker) returns (MsgResetCircuitBreakerResponse); +} + +// MsgAuthorizeCircuitBreaker defines the Msg/AuthorizeCircuitBreaker request type. +message MsgAuthorizeCircuitBreaker { + option (cosmos.msg.v1.signer) = "granter"; + + // granter is the granter of the circuit breaker permissions and must have + // LEVEL_SUPER_ADMIN. + string granter = 1; + + // grantee is the account authorized with the provided permissions. + string grantee = 2; + + // permissions are the circuit breaker permissions that the grantee receives. + // These will overwrite any existing permissions. LEVEL_NONE_UNSPECIFIED can + // be specified to revoke all permissions. + Permissions permissions = 3; +} + +// MsgAuthorizeCircuitBreakerResponse defines the Msg/AuthorizeCircuitBreaker response type. +message MsgAuthorizeCircuitBreakerResponse { + bool success = 1; +} + +// MsgTripCircuitBreaker defines the Msg/TripCircuitBreaker request type. +message MsgTripCircuitBreaker { + option (cosmos.msg.v1.signer) = "authority"; + + // authority is the account authorized to trip the circuit breaker. + string authority = 1; + + // msg_type_urls specifies a list of type URLs to immediately stop processing. + // IF IT IS LEFT EMPTY, ALL MSG PROCESSING WILL STOP IMMEDIATELY. + // This value is validated against the authority's permissions and if the + // authority does not have permissions to trip the specified msg type URLs + // (or all URLs), the operation will fail. + repeated string msg_type_urls = 2; +} + +// MsgTripCircuitBreakerResponse defines the Msg/TripCircuitBreaker response type. +message MsgTripCircuitBreakerResponse { + bool success = 1; +} + +// MsgResetCircuitBreaker defines the Msg/ResetCircuitBreaker request type. +message MsgResetCircuitBreaker { + option (cosmos.msg.v1.signer) = "authority"; + + // authority is the account authorized to trip or reset the circuit breaker. + string authority = 1; + + // msg_type_urls specifies a list of Msg type URLs to resume processing. If + // it is left empty all Msg processing for type URLs that the account is + // authorized to trip will resume. + repeated string msg_type_urls = 3; +} + +// MsgResetCircuitBreakerResponse defines the Msg/ResetCircuitBreaker response type. +message MsgResetCircuitBreakerResponse { + bool success = 1; +} diff --git a/packages/api/proto/cosmos/circuit/v1/types.proto b/packages/api/proto/cosmos/circuit/v1/types.proto new file mode 100644 index 00000000..1bd8d9d4 --- /dev/null +++ b/packages/api/proto/cosmos/circuit/v1/types.proto @@ -0,0 +1,49 @@ +syntax = "proto3"; +package cosmos.circuit.v1; + +option go_package = "cosmossdk.io/x/circuit/types"; + +// Permissions are the permissions that an account has to trip +// or reset the circuit breaker. +message Permissions { + // level is the level of permissions granted to this account. + Level level = 1; + + // limit_type_urls is used with LEVEL_SOME_MSGS to limit the lists of Msg type + // URLs that the account can trip. It is an error to use limit_type_urls with + // a level other than LEVEL_SOME_MSGS. + repeated string limit_type_urls = 2; + + // Level is the permission level. + enum Level { + // LEVEL_NONE_UNSPECIFIED indicates that the account will have no circuit + // breaker permissions. + LEVEL_NONE_UNSPECIFIED = 0; + + // LEVEL_SOME_MSGS indicates that the account will have permission to + // trip or reset the circuit breaker for some Msg type URLs. If this level + // is chosen, a non-empty list of Msg type URLs must be provided in + // limit_type_urls. + LEVEL_SOME_MSGS = 1; + + // LEVEL_ALL_MSGS indicates that the account can trip or reset the circuit + // breaker for Msg's of all type URLs. + LEVEL_ALL_MSGS = 2; + + // LEVEL_SUPER_ADMIN indicates that the account can take all circuit breaker + // actions and can grant permissions to other accounts. + LEVEL_SUPER_ADMIN = 3; + } +} + +// GenesisAccountPermissions is the account permissions for the circuit breaker in genesis +message GenesisAccountPermissions { + string address = 1; + Permissions permissions = 2; +} + +// GenesisState is the state that must be provided at genesis. +message GenesisState { + repeated GenesisAccountPermissions account_permissions = 1; + repeated string disabled_type_urls = 2; +} diff --git a/packages/api/proto/cosmos/consensus/module/v1/module.proto b/packages/api/proto/cosmos/consensus/module/v1/module.proto new file mode 100644 index 00000000..8e188cc7 --- /dev/null +++ b/packages/api/proto/cosmos/consensus/module/v1/module.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; + +package cosmos.consensus.module.v1; + +import "cosmos/app/v1alpha1/module.proto"; + +// Module is the config object of the consensus module. +message Module { + option (cosmos.app.v1alpha1.module) = { + go_import: "github.com/cosmos/cosmos-sdk/x/consensus" + }; + + // authority defines the custom module authority. If not set, defaults to the governance module. + string authority = 1; +} diff --git a/packages/api/proto/cosmos/consensus/v1/query.proto b/packages/api/proto/cosmos/consensus/v1/query.proto new file mode 100644 index 00000000..ba9f821f --- /dev/null +++ b/packages/api/proto/cosmos/consensus/v1/query.proto @@ -0,0 +1,28 @@ +syntax = "proto3"; +package cosmos.consensus.v1; + +import "google/api/annotations.proto"; +import "tendermint/types/params.proto"; +import "cosmos_proto/cosmos.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/x/consensus/types"; + +// Query defines the gRPC querier service. +service Query { + // Params queries the parameters of x/consensus module. + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/cosmos/consensus/v1/params"; + option (cosmos_proto.method_added_in) = "cosmos-sdk 0.47"; + } +} + +// QueryParamsRequest defines the request type for querying x/consensus parameters. +message QueryParamsRequest {} + +// QueryParamsResponse defines the response type for querying x/consensus parameters. +message QueryParamsResponse { + // params are the tendermint consensus params stored in the consensus module. + // Please note that `params.version` is not populated in this response, it is + // tracked separately in the x/upgrade module. + tendermint.types.ConsensusParams params = 1; +} diff --git a/packages/api/proto/cosmos/consensus/v1/tx.proto b/packages/api/proto/cosmos/consensus/v1/tx.proto new file mode 100644 index 00000000..1ede7ead --- /dev/null +++ b/packages/api/proto/cosmos/consensus/v1/tx.proto @@ -0,0 +1,44 @@ +syntax = "proto3"; +package cosmos.consensus.v1; + +import "amino/amino.proto"; +import "cosmos_proto/cosmos.proto"; +import "cosmos/msg/v1/msg.proto"; +import "tendermint/types/params.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/x/consensus/types"; + +// Msg defines the consensus Msg service. +service Msg { + option (cosmos.msg.v1.service) = true; + + // UpdateParams defines a governance operation for updating the x/consensus module parameters. + // The authority is defined in the keeper. + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse) { + option (cosmos_proto.method_added_in) = "cosmos-sdk 0.47"; + }; +} + +// MsgUpdateParams is the Msg/UpdateParams request type. +message MsgUpdateParams { + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "cosmos-sdk/x/consensus/MsgUpdateParams"; + + // authority is the address that controls the module (defaults to x/gov unless overwritten). + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // params defines the x/consensus parameters to update. + // VersionsParams is not included in this Msg because it is tracked + // separarately in x/upgrade. + // + // NOTE: All parameters must be supplied. + tendermint.types.BlockParams block = 2; + tendermint.types.EvidenceParams evidence = 3; + tendermint.types.ValidatorParams validator = 4; + + tendermint.types.ABCIParams abci = 5 [(cosmos_proto.field_added_in) = "cosmos-sdk 0.50"]; +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +message MsgUpdateParamsResponse {} diff --git a/packages/api/proto/cosmos/counter/module/v1/module.proto b/packages/api/proto/cosmos/counter/module/v1/module.proto new file mode 100644 index 00000000..7c0fa405 --- /dev/null +++ b/packages/api/proto/cosmos/counter/module/v1/module.proto @@ -0,0 +1,17 @@ +syntax = "proto3"; + +package cosmos.counter.module.v1; + +import "cosmos/app/v1alpha1/module.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/testutil/x/counter/types"; + +// Module is the config object of the counter module. +message Module { + option (cosmos.app.v1alpha1.module) = { + go_import: "github.com/cosmos/cosmos-sdk/testutil/x/counter" + }; + + // authority defines the custom module authority. If not set, defaults to the governance module. + string authority = 1; +} diff --git a/packages/api/proto/cosmos/counter/v1/query.proto b/packages/api/proto/cosmos/counter/v1/query.proto new file mode 100644 index 00000000..d8151da0 --- /dev/null +++ b/packages/api/proto/cosmos/counter/v1/query.proto @@ -0,0 +1,18 @@ +syntax = "proto3"; +package cosmos.counter.v1; + +option go_package = "github.com/cosmos/cosmos-sdk/testutil/x/counter/types"; + +// Query defines the gRPC querier service. +service Query { + // GetCount queries the parameters of x/Counter module. + rpc GetCount(QueryGetCountRequest) returns (QueryGetCountResponse); +} + +// QueryGetCountRequest defines the request type for querying x/mock count. +message QueryGetCountRequest {} + +// QueryGetCountResponse defines the response type for querying x/mock count. +message QueryGetCountResponse { + int64 total_count = 1; +} diff --git a/packages/api/proto/cosmos/counter/v1/tx.proto b/packages/api/proto/cosmos/counter/v1/tx.proto new file mode 100644 index 00000000..771d683c --- /dev/null +++ b/packages/api/proto/cosmos/counter/v1/tx.proto @@ -0,0 +1,35 @@ + +syntax = "proto3"; +package cosmos.counter.v1; + +import "cosmos_proto/cosmos.proto"; +import "cosmos/msg/v1/msg.proto"; +import "amino/amino.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/testutil/x/counter/types"; + +// Msg defines the counter Msg service. +service Msg { + option (cosmos.msg.v1.service) = true; + + // IncreaseCount increments the counter by the specified amount. + rpc IncreaseCount(MsgIncreaseCounter) returns (MsgIncreaseCountResponse); +} + +// MsgIncreaseCounter defines a count Msg service counter. +message MsgIncreaseCounter { + option (amino.name) = "cosmos-sdk/increase_counter"; // TODO: remove amino + option (cosmos.msg.v1.signer) = "signer"; + + // signer is the address that controls the module (defaults to x/gov unless overwritten). + string signer = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // count is the number of times to increment the counter. + int64 count = 2; +} + +// MsgIncreaseCountResponse is the Msg/Counter response type. +message MsgIncreaseCountResponse { + // new_count is the number of times the counter was incremented. + int64 new_count = 1; +} diff --git a/packages/api/proto/cosmos/crisis/module/v1/module.proto b/packages/api/proto/cosmos/crisis/module/v1/module.proto new file mode 100644 index 00000000..fe924962 --- /dev/null +++ b/packages/api/proto/cosmos/crisis/module/v1/module.proto @@ -0,0 +1,18 @@ +syntax = "proto3"; + +package cosmos.crisis.module.v1; + +import "cosmos/app/v1alpha1/module.proto"; + +// Module is the config object of the crisis module. +message Module { + option (cosmos.app.v1alpha1.module) = { + go_import: "github.com/cosmos/cosmos-sdk/x/crisis" + }; + + // fee_collector_name is the name of the FeeCollector ModuleAccount. + string fee_collector_name = 1; + + // authority defines the custom module authority. If not set, defaults to the governance module. + string authority = 2; +} \ No newline at end of file diff --git a/packages/api/proto/cosmos/crisis/v1beta1/genesis.proto b/packages/api/proto/cosmos/crisis/v1beta1/genesis.proto index 5c291604..b0ddb9b6 100644 --- a/packages/api/proto/cosmos/crisis/v1beta1/genesis.proto +++ b/packages/api/proto/cosmos/crisis/v1beta1/genesis.proto @@ -5,10 +5,11 @@ option go_package = "github.com/cosmos/cosmos-sdk/x/crisis/types"; import "gogoproto/gogo.proto"; import "cosmos/base/v1beta1/coin.proto"; +import "amino/amino.proto"; // GenesisState defines the crisis module's genesis state. message GenesisState { // constant_fee is the fee used to verify the invariant in the crisis // module. - cosmos.base.v1beta1.Coin constant_fee = 3 [(gogoproto.nullable) = false]; + cosmos.base.v1beta1.Coin constant_fee = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } diff --git a/packages/api/proto/cosmos/crisis/v1beta1/tx.proto b/packages/api/proto/cosmos/crisis/v1beta1/tx.proto index fea9059f..df6c973b 100644 --- a/packages/api/proto/cosmos/crisis/v1beta1/tx.proto +++ b/packages/api/proto/cosmos/crisis/v1beta1/tx.proto @@ -6,24 +6,59 @@ option go_package = "github.com/cosmos/cosmos-sdk/x/crisis/types"; import "gogoproto/gogo.proto"; import "cosmos_proto/cosmos.proto"; import "cosmos/msg/v1/msg.proto"; +import "amino/amino.proto"; +import "cosmos/base/v1beta1/coin.proto"; // Msg defines the bank Msg service. service Msg { - // VerifyInvariant defines a method to verify a particular invariance. + option (cosmos.msg.v1.service) = true; + + // VerifyInvariant defines a method to verify a particular invariant. rpc VerifyInvariant(MsgVerifyInvariant) returns (MsgVerifyInvariantResponse); + + // UpdateParams defines a governance operation for updating the x/crisis module + // parameters. The authority is defined in the keeper. + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse) { + option (cosmos_proto.method_added_in) = "cosmos-sdk 0.47"; + }; } // MsgVerifyInvariant represents a message to verify a particular invariance. message MsgVerifyInvariant { option (cosmos.msg.v1.signer) = "sender"; + option (amino.name) = "cosmos-sdk/MsgVerifyInvariant"; option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; - string sender = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // sender is the account address of private key to send coins to fee collector account. + string sender = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // name of the invariant module. string invariant_module_name = 2; - string invariant_route = 3; + + // invariant_route is the msg's invariant route. + string invariant_route = 3; } // MsgVerifyInvariantResponse defines the Msg/VerifyInvariant response type. message MsgVerifyInvariantResponse {} + +// MsgUpdateParams is the Msg/UpdateParams request type. +message MsgUpdateParams { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.47"; + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "cosmos-sdk/x/crisis/MsgUpdateParams"; + + // authority is the address that controls the module (defaults to x/gov unless overwritten). + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // constant_fee defines the x/crisis parameter. + cosmos.base.v1beta1.Coin constant_fee = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +message MsgUpdateParamsResponse { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.47"; +} diff --git a/packages/api/proto/cosmos/crypto/ed25519/keys.proto b/packages/api/proto/cosmos/crypto/ed25519/keys.proto index 6ffec344..31768075 100644 --- a/packages/api/proto/cosmos/crypto/ed25519/keys.proto +++ b/packages/api/proto/cosmos/crypto/ed25519/keys.proto @@ -1,6 +1,7 @@ syntax = "proto3"; package cosmos.crypto.ed25519; +import "amino/amino.proto"; import "gogoproto/gogo.proto"; option go_package = "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"; @@ -11,13 +12,28 @@ option go_package = "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"; // ADR-28. Nevertheless, you will like to use ed25519 in app user level // then you must create a new proto message and follow ADR-28 for Address construction. message PubKey { + option (amino.name) = "tendermint/PubKeyEd25519"; + // The Amino encoding is simply the inner bytes field, and not the Amino + // encoding of the whole PubKey struct. + // + // Example (JSON): + // s := PubKey{Key: []byte{0x01}} + // out := AminoJSONEncoder(s) + // + // Then we have: + // out == `"MQ=="` + // out != `{"key":"MQ=="}` + option (amino.message_encoding) = "key_field"; option (gogoproto.goproto_stringer) = false; bytes key = 1 [(gogoproto.casttype) = "crypto/ed25519.PublicKey"]; } -// Deprecated: PrivKey defines a ed25519 private key. +// PrivKey defines a ed25519 private key. // NOTE: ed25519 keys must not be used in SDK apps except in a tendermint validator context. message PrivKey { + option (amino.name) = "tendermint/PrivKeyEd25519"; + option (amino.message_encoding) = "key_field"; + bytes key = 1 [(gogoproto.casttype) = "crypto/ed25519.PrivateKey"]; } diff --git a/packages/api/proto/cosmos/crypto/hd/v1/hd.proto b/packages/api/proto/cosmos/crypto/hd/v1/hd.proto index bb079ce6..70e08613 100644 --- a/packages/api/proto/cosmos/crypto/hd/v1/hd.proto +++ b/packages/api/proto/cosmos/crypto/hd/v1/hd.proto @@ -1,7 +1,7 @@ -// Since: cosmos-sdk 0.46 syntax = "proto3"; package cosmos.crypto.hd.v1; +import "amino/amino.proto"; import "gogoproto/gogo.proto"; option go_package = "github.com/cosmos/cosmos-sdk/crypto/hd"; @@ -9,6 +9,8 @@ option (gogoproto.goproto_getters_all) = false; // BIP44Params is used as path field in ledger item in Record. message BIP44Params { + option (amino.name) = "crypto/keys/hd/BIP44Params"; + option (gogoproto.goproto_stringer) = false; // purpose is a constant set to 44' (or 0x8000002C) following the BIP43 recommendation uint32 purpose = 1; diff --git a/packages/api/proto/cosmos/crypto/keyring/v1/record.proto b/packages/api/proto/cosmos/crypto/keyring/v1/record.proto index 14c6da63..d246731e 100644 --- a/packages/api/proto/cosmos/crypto/keyring/v1/record.proto +++ b/packages/api/proto/cosmos/crypto/keyring/v1/record.proto @@ -1,4 +1,3 @@ -// Since: cosmos-sdk 0.46 syntax = "proto3"; package cosmos.crypto.keyring.v1; @@ -8,6 +7,7 @@ import "cosmos/crypto/hd/v1/hd.proto"; option go_package = "github.com/cosmos/cosmos-sdk/crypto/keyring"; option (gogoproto.goproto_getters_all) = false; +option (gogoproto.gogoproto_import) = false; // Record is used for representing a key in the keyring. message Record { diff --git a/packages/api/proto/cosmos/crypto/multisig/keys.proto b/packages/api/proto/cosmos/crypto/multisig/keys.proto index 7a11fe33..fa0dec57 100644 --- a/packages/api/proto/cosmos/crypto/multisig/keys.proto +++ b/packages/api/proto/cosmos/crypto/multisig/keys.proto @@ -3,6 +3,7 @@ package cosmos.crypto.multisig; import "gogoproto/gogo.proto"; import "google/protobuf/any.proto"; +import "amino/amino.proto"; option go_package = "github.com/cosmos/cosmos-sdk/crypto/keys/multisig"; @@ -10,8 +11,20 @@ option go_package = "github.com/cosmos/cosmos-sdk/crypto/keys/multisig"; // which nests multiple public keys and a threshold, // it uses legacy amino address rules. message LegacyAminoPubKey { + option (amino.name) = "tendermint/PubKeyMultisigThreshold"; + // The Amino encoding of a LegacyAminoPubkey is the legacy amino + // encoding of the `PubKeyMultisigThreshold` struct defined below: + // https://github.com/tendermint/tendermint/blob/v0.33.9/crypto/multisig/threshold_pubkey.go + // + // There are 2 differences with what a "normal" Amino encoding + // would output: + // 1. The `threshold` field is always a string (whereas Amino would + // by default marshal uint32 as a number). + // 2. The `public_keys` field is renamed to `pubkeys`, which is also + // reflected in the `amino.field_name` annotation. + option (amino.message_encoding) = "threshold_string"; option (gogoproto.goproto_getters) = false; uint32 threshold = 1; - repeated google.protobuf.Any public_keys = 2 [(gogoproto.customname) = "PubKeys"]; + repeated google.protobuf.Any public_keys = 2 [(gogoproto.customname) = "PubKeys", (amino.field_name) = "pubkeys"]; } diff --git a/packages/api/proto/cosmos/crypto/secp256k1/keys.proto b/packages/api/proto/cosmos/crypto/secp256k1/keys.proto index a2272571..e2358d6d 100644 --- a/packages/api/proto/cosmos/crypto/secp256k1/keys.proto +++ b/packages/api/proto/cosmos/crypto/secp256k1/keys.proto @@ -1,6 +1,7 @@ syntax = "proto3"; package cosmos.crypto.secp256k1; +import "amino/amino.proto"; import "gogoproto/gogo.proto"; option go_package = "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"; @@ -11,6 +12,18 @@ option go_package = "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"; // the x-coordinate. Otherwise the first byte is a 0x03. // This prefix is followed with the x-coordinate. message PubKey { + option (amino.name) = "tendermint/PubKeySecp256k1"; + // The Amino encoding is simply the inner bytes field, and not the Amino + // encoding of the whole PubKey struct. + // + // Example (JSON): + // s := PubKey{Key: []byte{0x01}} + // out := AminoJSONEncoder(s) + // + // Then we have: + // out == `"MQ=="` + // out != `{"key":"MQ=="}` + option (amino.message_encoding) = "key_field"; option (gogoproto.goproto_stringer) = false; bytes key = 1; @@ -18,5 +31,8 @@ message PubKey { // PrivKey defines a secp256k1 private key. message PrivKey { + option (amino.name) = "tendermint/PrivKeySecp256k1"; + option (amino.message_encoding) = "key_field"; + bytes key = 1; } diff --git a/packages/api/proto/cosmos/crypto/secp256r1/keys.proto b/packages/api/proto/cosmos/crypto/secp256r1/keys.proto index 2e96c6e3..b0aad99d 100644 --- a/packages/api/proto/cosmos/crypto/secp256r1/keys.proto +++ b/packages/api/proto/cosmos/crypto/secp256r1/keys.proto @@ -1,4 +1,3 @@ -// Since: cosmos-sdk 0.43 syntax = "proto3"; package cosmos.crypto.secp256r1; diff --git a/packages/api/proto/cosmos/distribution/module/v1/module.proto b/packages/api/proto/cosmos/distribution/module/v1/module.proto new file mode 100644 index 00000000..89be0c0a --- /dev/null +++ b/packages/api/proto/cosmos/distribution/module/v1/module.proto @@ -0,0 +1,17 @@ +syntax = "proto3"; + +package cosmos.distribution.module.v1; + +import "cosmos/app/v1alpha1/module.proto"; + +// Module is the config object of the distribution module. +message Module { + option (cosmos.app.v1alpha1.module) = { + go_import: "github.com/cosmos/cosmos-sdk/x/distribution" + }; + + string fee_collector_name = 1; + + // authority defines the custom module authority. If not set, defaults to the governance module. + string authority = 2; +} diff --git a/packages/api/proto/cosmos/distribution/v1beta1/distribution.proto b/packages/api/proto/cosmos/distribution/v1beta1/distribution.proto index 73174303..0c20286f 100644 --- a/packages/api/proto/cosmos/distribution/v1beta1/distribution.proto +++ b/packages/api/proto/cosmos/distribution/v1beta1/distribution.proto @@ -7,25 +7,39 @@ option (gogoproto.equal_all) = true; import "gogoproto/gogo.proto"; import "cosmos/base/v1beta1/coin.proto"; import "cosmos_proto/cosmos.proto"; +import "amino/amino.proto"; // Params defines the set of params for the distribution module. message Params { - option (gogoproto.goproto_stringer) = false; - string community_tax = 1 [ + option (amino.name) = "cosmos-sdk/x/distribution/Params"; + + string community_tax = 1 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (amino.dont_omitempty) = true, (gogoproto.nullable) = false ]; + + // Deprecated: The base_proposer_reward field is deprecated and is no longer used + // in the x/distribution module's reward mechanism. string base_proposer_reward = 2 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true, + deprecated = true ]; + + // Deprecated: The bonus_proposer_reward field is deprecated and is no longer used + // in the x/distribution module's reward mechanism. string bonus_proposer_reward = 3 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true, + deprecated = true ]; + bool withdraw_addr_enabled = 4; } @@ -42,8 +56,11 @@ message Params { // read that record) // + one per validator for the zeroeth period, set on initialization message ValidatorHistoricalRewards { - repeated cosmos.base.v1beta1.DecCoin cumulative_reward_ratio = 1 - [(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", (gogoproto.nullable) = false]; + repeated cosmos.base.v1beta1.DecCoin cumulative_reward_ratio = 1 [ + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; uint32 reference_count = 2; } @@ -51,23 +68,32 @@ message ValidatorHistoricalRewards { // period for a validator kept as a running counter and incremented // each block as long as the validator's tokens remain constant. message ValidatorCurrentRewards { - repeated cosmos.base.v1beta1.DecCoin rewards = 1 - [(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", (gogoproto.nullable) = false]; + repeated cosmos.base.v1beta1.DecCoin rewards = 1 [ + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; uint64 period = 2; } // ValidatorAccumulatedCommission represents accumulated commission // for a validator kept as a running counter, can be withdrawn at any time. message ValidatorAccumulatedCommission { - repeated cosmos.base.v1beta1.DecCoin commission = 1 - [(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", (gogoproto.nullable) = false]; + repeated cosmos.base.v1beta1.DecCoin commission = 1 [ + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; } // ValidatorOutstandingRewards represents outstanding (un-withdrawn) rewards // for a validator inexpensive to track, allows simple sanity checks. message ValidatorOutstandingRewards { - repeated cosmos.base.v1beta1.DecCoin rewards = 1 - [(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", (gogoproto.nullable) = false]; + repeated cosmos.base.v1beta1.DecCoin rewards = 1 [ + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; } // ValidatorSlashEvent represents a validator slash event. @@ -78,37 +104,48 @@ message ValidatorSlashEvent { uint64 validator_period = 1; string fraction = 2 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; } // ValidatorSlashEvents is a collection of ValidatorSlashEvent messages. message ValidatorSlashEvents { - option (gogoproto.goproto_stringer) = false; - repeated ValidatorSlashEvent validator_slash_events = 1 [(gogoproto.nullable) = false]; + repeated ValidatorSlashEvent validator_slash_events = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // FeePool is the global fee pool for distribution. message FeePool { - repeated cosmos.base.v1beta1.DecCoin community_pool = 1 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins"]; + repeated cosmos.base.v1beta1.DecCoin community_pool = 1 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins" + ]; } // CommunityPoolSpendProposal details a proposal for use of community funds, // together with how many coins are proposed to be spent, and to which // recipient account. +// +// Deprecated: Do not use. As of the Cosmos SDK release v0.47.x, there is no +// longer a need for an explicit CommunityPoolSpendProposal. To spend community +// pool funds, a simple MsgCommunityPoolSpend can be invoked from the x/gov +// module via a v1 governance proposal. message CommunityPoolSpendProposal { + option deprecated = true; option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = false; option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content"; string title = 1; string description = 2; string recipient = 3; - repeated cosmos.base.v1beta1.Coin amount = 4 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; + repeated cosmos.base.v1beta1.Coin amount = 4 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true, + (amino.encoding) = "legacy_coins", + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; } // DelegatorStartingInfo represents the starting info for a delegator reward @@ -121,29 +158,32 @@ message DelegatorStartingInfo { uint64 previous_period = 1; string stake = 2 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true ]; - uint64 height = 3 [(gogoproto.jsontag) = "creation_height"]; + uint64 height = 3 + [(gogoproto.jsontag) = "creation_height", (amino.field_name) = "creation_height", (amino.dont_omitempty) = true]; } // DelegationDelegatorReward represents the properties // of a delegator's delegation reward. message DelegationDelegatorReward { - option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = true; + option (gogoproto.goproto_getters) = false; - string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; - repeated cosmos.base.v1beta1.DecCoin reward = 2 - [(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", (gogoproto.nullable) = false]; + repeated cosmos.base.v1beta1.DecCoin reward = 2 [ + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; } // CommunityPoolSpendProposalWithDeposit defines a CommunityPoolSpendProposal // with a deposit message CommunityPoolSpendProposalWithDeposit { option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = true; option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content"; string title = 1; diff --git a/packages/api/proto/cosmos/distribution/v1beta1/genesis.proto b/packages/api/proto/cosmos/distribution/v1beta1/genesis.proto index 4662e8df..5608bfb9 100644 --- a/packages/api/proto/cosmos/distribution/v1beta1/genesis.proto +++ b/packages/api/proto/cosmos/distribution/v1beta1/genesis.proto @@ -8,6 +8,7 @@ import "gogoproto/gogo.proto"; import "cosmos/base/v1beta1/coin.proto"; import "cosmos/distribution/v1beta1/distribution.proto"; import "cosmos_proto/cosmos.proto"; +import "amino/amino.proto"; // DelegatorWithdrawInfo is the address for where distributions rewards are // withdrawn to by default this struct is only used at genesis to feed in @@ -29,11 +30,14 @@ message ValidatorOutstandingRewardsRecord { option (gogoproto.goproto_getters) = false; // validator_address is the address of the validator. - string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - // outstanding_rewards represents the oustanding rewards of a validator. - repeated cosmos.base.v1beta1.DecCoin outstanding_rewards = 2 - [(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", (gogoproto.nullable) = false]; + string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; + + // outstanding_rewards represents the outstanding rewards of a validator. + repeated cosmos.base.v1beta1.DecCoin outstanding_rewards = 2 [ + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; } // ValidatorAccumulatedCommissionRecord is used for import / export via genesis @@ -43,10 +47,10 @@ message ValidatorAccumulatedCommissionRecord { option (gogoproto.goproto_getters) = false; // validator_address is the address of the validator. - string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; // accumulated is the accumulated commission of a validator. - ValidatorAccumulatedCommission accumulated = 2 [(gogoproto.nullable) = false]; + ValidatorAccumulatedCommission accumulated = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // ValidatorHistoricalRewardsRecord is used for import / export via genesis @@ -56,13 +60,13 @@ message ValidatorHistoricalRewardsRecord { option (gogoproto.goproto_getters) = false; // validator_address is the address of the validator. - string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; // period defines the period the historical rewards apply to. uint64 period = 2; // rewards defines the historical rewards of a validator. - ValidatorHistoricalRewards rewards = 3 [(gogoproto.nullable) = false]; + ValidatorHistoricalRewards rewards = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // ValidatorCurrentRewardsRecord is used for import / export via genesis json. @@ -71,10 +75,10 @@ message ValidatorCurrentRewardsRecord { option (gogoproto.goproto_getters) = false; // validator_address is the address of the validator. - string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; // rewards defines the current rewards of a validator. - ValidatorCurrentRewards rewards = 2 [(gogoproto.nullable) = false]; + ValidatorCurrentRewards rewards = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // DelegatorStartingInfoRecord used for import / export via genesis json. @@ -86,10 +90,10 @@ message DelegatorStartingInfoRecord { string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // validator_address is the address of the validator. - string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; // starting_info defines the starting info of a delegator. - DelegatorStartingInfo starting_info = 3 [(gogoproto.nullable) = false]; + DelegatorStartingInfo starting_info = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // ValidatorSlashEventRecord is used for import / export via genesis json. @@ -98,13 +102,13 @@ message ValidatorSlashEventRecord { option (gogoproto.goproto_getters) = false; // validator_address is the address of the validator. - string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - // height defines the block height at which the slash event occured. + string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; + // height defines the block height at which the slash event occurred. uint64 height = 2; // period is the period of the slash event. uint64 period = 3; // validator_slash_event describes the slash event. - ValidatorSlashEvent validator_slash_event = 4 [(gogoproto.nullable) = false]; + ValidatorSlashEvent validator_slash_event = 4 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // GenesisState defines the distribution module's genesis state. @@ -112,33 +116,40 @@ message GenesisState { option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; - // params defines all the paramaters of the module. - Params params = 1 [(gogoproto.nullable) = false]; + // params defines all the parameters of the module. + Params params = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // fee_pool defines the fee pool at genesis. - FeePool fee_pool = 2 [(gogoproto.nullable) = false]; + FeePool fee_pool = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // fee_pool defines the delegator withdraw infos at genesis. - repeated DelegatorWithdrawInfo delegator_withdraw_infos = 3 [(gogoproto.nullable) = false]; + repeated DelegatorWithdrawInfo delegator_withdraw_infos = 3 + [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // fee_pool defines the previous proposer at genesis. string previous_proposer = 4 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // fee_pool defines the outstanding rewards of all validators at genesis. - repeated ValidatorOutstandingRewardsRecord outstanding_rewards = 5 [(gogoproto.nullable) = false]; + repeated ValidatorOutstandingRewardsRecord outstanding_rewards = 5 + [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; - // fee_pool defines the accumulated commisions of all validators at genesis. - repeated ValidatorAccumulatedCommissionRecord validator_accumulated_commissions = 6 [(gogoproto.nullable) = false]; + // fee_pool defines the accumulated commissions of all validators at genesis. + repeated ValidatorAccumulatedCommissionRecord validator_accumulated_commissions = 6 + [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // fee_pool defines the historical rewards of all validators at genesis. - repeated ValidatorHistoricalRewardsRecord validator_historical_rewards = 7 [(gogoproto.nullable) = false]; + repeated ValidatorHistoricalRewardsRecord validator_historical_rewards = 7 + [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // fee_pool defines the current rewards of all validators at genesis. - repeated ValidatorCurrentRewardsRecord validator_current_rewards = 8 [(gogoproto.nullable) = false]; + repeated ValidatorCurrentRewardsRecord validator_current_rewards = 8 + [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // fee_pool defines the delegator starting infos at genesis. - repeated DelegatorStartingInfoRecord delegator_starting_infos = 9 [(gogoproto.nullable) = false]; + repeated DelegatorStartingInfoRecord delegator_starting_infos = 9 + [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // fee_pool defines the validator slash events at genesis. - repeated ValidatorSlashEventRecord validator_slash_events = 10 [(gogoproto.nullable) = false]; + repeated ValidatorSlashEventRecord validator_slash_events = 10 + [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } diff --git a/packages/api/proto/cosmos/distribution/v1beta1/query.proto b/packages/api/proto/cosmos/distribution/v1beta1/query.proto index a09413fc..6d7aad86 100644 --- a/packages/api/proto/cosmos/distribution/v1beta1/query.proto +++ b/packages/api/proto/cosmos/distribution/v1beta1/query.proto @@ -7,6 +7,7 @@ import "google/api/annotations.proto"; import "cosmos/base/v1beta1/coin.proto"; import "cosmos/distribution/v1beta1/distribution.proto"; import "cosmos_proto/cosmos.proto"; +import "amino/amino.proto"; option go_package = "github.com/cosmos/cosmos-sdk/x/distribution/types"; @@ -17,6 +18,12 @@ service Query { option (google.api.http).get = "/cosmos/distribution/v1beta1/params"; } + // ValidatorDistributionInfo queries validator commission and self-delegation rewards for validator + rpc ValidatorDistributionInfo(QueryValidatorDistributionInfoRequest) + returns (QueryValidatorDistributionInfoResponse) { + option (google.api.http).get = "/cosmos/distribution/v1beta1/validators/{validator_address}"; + } + // ValidatorOutstandingRewards queries rewards of a validator address. rpc ValidatorOutstandingRewards(QueryValidatorOutstandingRewardsRequest) returns (QueryValidatorOutstandingRewardsResponse) { @@ -41,7 +48,7 @@ service Query { "{validator_address}"; } - // DelegationTotalRewards queries the total rewards accrued by a each + // DelegationTotalRewards queries the total rewards accrued by each // validator. rpc DelegationTotalRewards(QueryDelegationTotalRewardsRequest) returns (QueryDelegationTotalRewardsResponse) { option (google.api.http).get = "/cosmos/distribution/v1beta1/delegators/{delegator_address}/rewards"; @@ -60,6 +67,8 @@ service Query { } // CommunityPool queries the community pool coins. + // + // WARNING: This query will fail if an external community pool is used. rpc CommunityPool(QueryCommunityPoolRequest) returns (QueryCommunityPoolResponse) { option (google.api.http).get = "/cosmos/distribution/v1beta1/community_pool"; } @@ -71,44 +80,64 @@ 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 [(gogoproto.nullable) = false]; + Params params = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; +} + +// QueryValidatorDistributionInfoRequest is the request type for the Query/ValidatorDistributionInfo RPC method. +message QueryValidatorDistributionInfoRequest { + // validator_address defines the validator address to query for. + string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; +} + +// QueryValidatorDistributionInfoResponse is the response type for the Query/ValidatorDistributionInfo RPC method. +message QueryValidatorDistributionInfoResponse { + // operator_address defines the validator operator address. + string operator_address = 1 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; + // self_bond_rewards defines the self delegations rewards. + repeated cosmos.base.v1beta1.DecCoin self_bond_rewards = 2 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins" + ]; + // commission defines the commission the validator received. + repeated cosmos.base.v1beta1.DecCoin commission = 3 + [(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", (gogoproto.nullable) = false]; } // QueryValidatorOutstandingRewardsRequest is the request type for the // Query/ValidatorOutstandingRewards RPC method. message QueryValidatorOutstandingRewardsRequest { // validator_address defines the validator address to query for. - string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; } // QueryValidatorOutstandingRewardsResponse is the response type for the // Query/ValidatorOutstandingRewards RPC method. message QueryValidatorOutstandingRewardsResponse { - ValidatorOutstandingRewards rewards = 1 [(gogoproto.nullable) = false]; + ValidatorOutstandingRewards rewards = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // QueryValidatorCommissionRequest is the request type for the // Query/ValidatorCommission RPC method message QueryValidatorCommissionRequest { // validator_address defines the validator address to query for. - string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; } // QueryValidatorCommissionResponse is the response type for the // Query/ValidatorCommission RPC method message QueryValidatorCommissionResponse { - // commission defines the commision the validator received. - ValidatorAccumulatedCommission commission = 1 [(gogoproto.nullable) = false]; + // commission defines the commission the validator received. + ValidatorAccumulatedCommission commission = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // QueryValidatorSlashesRequest is the request type for the // Query/ValidatorSlashes RPC method message QueryValidatorSlashesRequest { - option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = true; + option (gogoproto.goproto_getters) = false; // validator_address defines the validator address to query for. - string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; // starting_height defines the optional starting height to query the slashes. uint64 starting_height = 2; // starting_height defines the optional ending height to query the slashes. @@ -121,7 +150,7 @@ message QueryValidatorSlashesRequest { // Query/ValidatorSlashes RPC method. message QueryValidatorSlashesResponse { // slashes defines the slashes the validator received. - repeated ValidatorSlashEvent slashes = 1 [(gogoproto.nullable) = false]; + repeated ValidatorSlashEvent slashes = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // pagination defines the pagination in the response. cosmos.base.query.v1beta1.PageResponse pagination = 2; @@ -136,15 +165,18 @@ message QueryDelegationRewardsRequest { // delegator_address defines the delegator address to query for. string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // validator_address defines the validator address to query for. - string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; } // QueryDelegationRewardsResponse is the response type for the // Query/DelegationRewards RPC method. message QueryDelegationRewardsResponse { // rewards defines the rewards accrued by a delegation. - repeated cosmos.base.v1beta1.DecCoin rewards = 1 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins"]; + repeated cosmos.base.v1beta1.DecCoin rewards = 1 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins" + ]; } // QueryDelegationTotalRewardsRequest is the request type for the @@ -160,10 +192,13 @@ message QueryDelegationTotalRewardsRequest { // Query/DelegationTotalRewards RPC method. message QueryDelegationTotalRewardsResponse { // rewards defines all the rewards accrued by a delegator. - repeated DelegationDelegatorReward rewards = 1 [(gogoproto.nullable) = false]; + repeated DelegationDelegatorReward rewards = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // total defines the sum of all the rewards. - repeated cosmos.base.v1beta1.DecCoin total = 2 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins"]; + repeated cosmos.base.v1beta1.DecCoin total = 2 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins" + ]; } // QueryDelegatorValidatorsRequest is the request type for the @@ -214,6 +249,9 @@ message QueryCommunityPoolRequest {} // RPC method. message QueryCommunityPoolResponse { // pool defines community pool's coins. - repeated cosmos.base.v1beta1.DecCoin pool = 1 - [(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", (gogoproto.nullable) = false]; + repeated cosmos.base.v1beta1.DecCoin pool = 1 [ + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; } diff --git a/packages/api/proto/cosmos/distribution/v1beta1/tx.proto b/packages/api/proto/cosmos/distribution/v1beta1/tx.proto index 68fea0c2..e2f556bd 100644 --- a/packages/api/proto/cosmos/distribution/v1beta1/tx.proto +++ b/packages/api/proto/cosmos/distribution/v1beta1/tx.proto @@ -8,9 +8,13 @@ import "gogoproto/gogo.proto"; import "cosmos/base/v1beta1/coin.proto"; import "cosmos_proto/cosmos.proto"; import "cosmos/msg/v1/msg.proto"; +import "amino/amino.proto"; +import "cosmos/distribution/v1beta1/distribution.proto"; // Msg defines the distribution Msg service. service Msg { + option (cosmos.msg.v1.service) = true; + // SetWithdrawAddress defines a method to change the withdraw address // for a delegator (or validator self-delegation). rpc SetWithdrawAddress(MsgSetWithdrawAddress) returns (MsgSetWithdrawAddressResponse); @@ -25,13 +29,38 @@ service Msg { // FundCommunityPool defines a method to allow an account to directly // fund the community pool. + // + // WARNING: This method will fail if an external community pool is used. rpc FundCommunityPool(MsgFundCommunityPool) returns (MsgFundCommunityPoolResponse); + + // UpdateParams defines a governance operation for updating the x/distribution + // module parameters. The authority is defined in the keeper. + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse) { + option (cosmos_proto.method_added_in) = "cosmos-sdk 0.47"; + }; + + // CommunityPoolSpend defines a governance operation for sending tokens from + // the community pool in the x/distribution module to another account, which + // could be the governance module itself. The authority is defined in the + // keeper. + // + // WARNING: This method will fail if an external community pool is used. + rpc CommunityPoolSpend(MsgCommunityPoolSpend) returns (MsgCommunityPoolSpendResponse) { + option (cosmos_proto.method_added_in) = "cosmos-sdk 0.47"; + }; + + // DepositValidatorRewardsPool defines a method to provide additional rewards + // to delegators to a specific validator. + rpc DepositValidatorRewardsPool(MsgDepositValidatorRewardsPool) returns (MsgDepositValidatorRewardsPoolResponse) { + option (cosmos_proto.method_added_in) = "cosmos-sdk 0.50"; + }; } // MsgSetWithdrawAddress sets the withdraw address for // a delegator (or validator self-delegation). message MsgSetWithdrawAddress { option (cosmos.msg.v1.signer) = "delegator_address"; + option (amino.name) = "cosmos-sdk/MsgModifyWithdrawAddress"; option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; @@ -40,58 +69,148 @@ message MsgSetWithdrawAddress { string withdraw_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } -// MsgSetWithdrawAddressResponse defines the Msg/SetWithdrawAddress response type. +// MsgSetWithdrawAddressResponse defines the Msg/SetWithdrawAddress response +// type. message MsgSetWithdrawAddressResponse {} // MsgWithdrawDelegatorReward represents delegation withdrawal to a delegator // from a single validator. message MsgWithdrawDelegatorReward { option (cosmos.msg.v1.signer) = "delegator_address"; + option (amino.name) = "cosmos-sdk/MsgWithdrawDelegationReward"; option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; } -// MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward response type. +// MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward +// response type. message MsgWithdrawDelegatorRewardResponse { - // Since: cosmos-sdk 0.46 - repeated cosmos.base.v1beta1.Coin amount = 1 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.46"; + repeated cosmos.base.v1beta1.Coin amount = 1 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true, + (amino.encoding) = "legacy_coins", + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; } // MsgWithdrawValidatorCommission withdraws the full commission to the validator // address. message MsgWithdrawValidatorCommission { option (cosmos.msg.v1.signer) = "validator_address"; + option (amino.name) = "cosmos-sdk/MsgWithdrawValCommission"; option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; - string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; } -// MsgWithdrawValidatorCommissionResponse defines the Msg/WithdrawValidatorCommission response type. +// MsgWithdrawValidatorCommissionResponse defines the +// Msg/WithdrawValidatorCommission response type. message MsgWithdrawValidatorCommissionResponse { - // Since: cosmos-sdk 0.46 - repeated cosmos.base.v1beta1.Coin amount = 1 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; + repeated cosmos.base.v1beta1.Coin amount = 1 [ + (cosmos_proto.field_added_in) = "cosmos-sdk 0.46", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true, + (amino.encoding) = "legacy_coins", + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; } // MsgFundCommunityPool allows an account to directly // fund the community pool. message MsgFundCommunityPool { option (cosmos.msg.v1.signer) = "depositor"; + option (amino.name) = "cosmos-sdk/MsgFundCommunityPool"; option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; - repeated cosmos.base.v1beta1.Coin amount = 1 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; + repeated cosmos.base.v1beta1.Coin amount = 1 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true, + (amino.encoding) = "legacy_coins", + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; string depositor = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } // MsgFundCommunityPoolResponse defines the Msg/FundCommunityPool response type. message MsgFundCommunityPoolResponse {} + +// MsgUpdateParams is the Msg/UpdateParams request type. +message MsgUpdateParams { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.47"; + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "cosmos-sdk/distribution/MsgUpdateParams"; + + // authority is the address that controls the module (defaults to x/gov unless overwritten). + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // params defines the x/distribution parameters to update. + // + // NOTE: All parameters must be supplied. + Params params = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +message MsgUpdateParamsResponse { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.47"; +} + +// MsgCommunityPoolSpend defines a message for sending tokens from the community +// pool to another account. This message is typically executed via a governance +// proposal with the governance module being the executing authority. +message MsgCommunityPoolSpend { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.47"; + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "cosmos-sdk/distr/MsgCommunityPoolSpend"; + + // authority is the address that controls the module (defaults to x/gov unless overwritten). + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string recipient = 2; + repeated cosmos.base.v1beta1.Coin amount = 3 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true, + (amino.encoding) = "legacy_coins", + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; +} + +// MsgCommunityPoolSpendResponse defines the response to executing a +// MsgCommunityPoolSpend message. +message MsgCommunityPoolSpendResponse { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.47"; +} + +// DepositValidatorRewardsPool defines the request structure to provide +// additional rewards to delegators from a specific validator. +message MsgDepositValidatorRewardsPool { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.50"; + option (amino.name) = "cosmos-sdk/distr/MsgDepositValRewards"; + option (cosmos.msg.v1.signer) = "depositor"; + + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string depositor = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; + repeated cosmos.base.v1beta1.Coin amount = 3 [ + (gogoproto.nullable) = false, + (amino.encoding) = "legacy_coins", + (amino.dont_omitempty) = true, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; +} + +// MsgDepositValidatorRewardsPoolResponse defines the response to executing a +// MsgDepositValidatorRewardsPool message. +message MsgDepositValidatorRewardsPoolResponse { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.50"; +} diff --git a/packages/api/proto/cosmos/epochs/module/v1/module.proto b/packages/api/proto/cosmos/epochs/module/v1/module.proto new file mode 100644 index 00000000..6f220087 --- /dev/null +++ b/packages/api/proto/cosmos/epochs/module/v1/module.proto @@ -0,0 +1,12 @@ +syntax = "proto3"; + +package cosmos.epochs.module.v1; + +import "cosmos/app/v1alpha1/module.proto"; + +// Module is the config object of the epochs module. +message Module { + option (cosmos.app.v1alpha1.module) = { + go_import: "github.com/cosmos/cosmos-sdk/x/epochs" + }; +} \ No newline at end of file diff --git a/packages/api/proto/cosmos/epochs/v1beta1/events.proto b/packages/api/proto/cosmos/epochs/v1beta1/events.proto new file mode 100644 index 00000000..dab14100 --- /dev/null +++ b/packages/api/proto/cosmos/epochs/v1beta1/events.proto @@ -0,0 +1,16 @@ +syntax = "proto3"; + +package cosmos.epochs.v1beta1; + +option go_package = "github.com/cosmos/cosmos-sdk/x/epochs/types"; + +// EventEpochEnd is an event emitted when an epoch end. +message EventEpochEnd { + int64 epoch_number = 1; +} + +// EventEpochStart is an event emitted when an epoch start. +message EventEpochStart { + int64 epoch_number = 1; + int64 epoch_start_time = 2; +} diff --git a/packages/api/proto/cosmos/epochs/v1beta1/genesis.proto b/packages/api/proto/cosmos/epochs/v1beta1/genesis.proto new file mode 100644 index 00000000..1707a2df --- /dev/null +++ b/packages/api/proto/cosmos/epochs/v1beta1/genesis.proto @@ -0,0 +1,60 @@ +syntax = "proto3"; +package cosmos.epochs.v1beta1; + +import "gogoproto/gogo.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/x/epochs/types"; + +// EpochInfo is a struct that describes the data going into +// a timer defined by the x/epochs module. +message EpochInfo { + // identifier is a unique reference to this particular timer. + string identifier = 1; + // start_time is the time at which the timer first ever ticks. + // If start_time is in the future, the epoch will not begin until the start + // time. + google.protobuf.Timestamp start_time = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; + // duration is the time in between epoch ticks. + // In order for intended behavior to be met, duration should + // be greater than the chains expected block time. + // Duration must be non-zero. + google.protobuf.Duration duration = 3 + [(gogoproto.nullable) = false, (gogoproto.stdduration) = true, (gogoproto.jsontag) = "duration,omitempty"]; + // current_epoch is the current epoch number, or in other words, + // how many times has the timer 'ticked'. + // The first tick (current_epoch=1) is defined as + // the first block whose blocktime is greater than the EpochInfo start_time. + int64 current_epoch = 4; + // current_epoch_start_time describes the start time of the current timer + // interval. The interval is (current_epoch_start_time, + // current_epoch_start_time + duration] When the timer ticks, this is set to + // current_epoch_start_time = last_epoch_start_time + duration only one timer + // tick for a given identifier can occur per block. + // + // NOTE! The current_epoch_start_time may diverge significantly from the + // wall-clock time the epoch began at. Wall-clock time of epoch start may be + // >> current_epoch_start_time. Suppose current_epoch_start_time = 10, + // duration = 5. Suppose the chain goes offline at t=14, and comes back online + // at t=30, and produces blocks at every successive time. (t=31, 32, etc.) + // * The t=30 block will start the epoch for (10, 15] + // * The t=31 block will start the epoch for (15, 20] + // * The t=32 block will start the epoch for (20, 25] + // * The t=33 block will start the epoch for (25, 30] + // * The t=34 block will start the epoch for (30, 35] + // * The **t=36** block will start the epoch for (35, 40] + google.protobuf.Timestamp current_epoch_start_time = 5 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; + // epoch_counting_started is a boolean, that indicates whether this + // epoch timer has began yet. + bool epoch_counting_started = 6; + reserved 7; + // current_epoch_start_height is the block height at which the current epoch + // started. (The block height at which the timer last ticked) + int64 current_epoch_start_height = 8; +} + +// GenesisState defines the epochs module's genesis state. +message GenesisState { + repeated EpochInfo epochs = 1 [(gogoproto.nullable) = false]; +} diff --git a/packages/api/proto/cosmos/epochs/v1beta1/query.proto b/packages/api/proto/cosmos/epochs/v1beta1/query.proto new file mode 100644 index 00000000..a70dffd3 --- /dev/null +++ b/packages/api/proto/cosmos/epochs/v1beta1/query.proto @@ -0,0 +1,45 @@ +syntax = "proto3"; +package cosmos.epochs.v1beta1; + +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "cosmos/epochs/v1beta1/genesis.proto"; +import "cosmos_proto/cosmos.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/x/epochs/types"; + +// Query defines the gRPC querier service. +service Query { + // EpochInfos provide running epochInfos + rpc EpochInfos(QueryEpochInfosRequest) returns (QueryEpochInfosResponse) { + option (google.api.http).get = "/cosmos/epochs/v1beta1/epochs"; + option (cosmos_proto.method_added_in) = "cosmos-sdk 0.53"; + } + // CurrentEpoch provide current epoch of specified identifier + rpc CurrentEpoch(QueryCurrentEpochRequest) returns (QueryCurrentEpochResponse) { + option (google.api.http).get = "/cosmos/epochs/v1beta1/current_epoch"; + option (cosmos_proto.method_added_in) = "cosmos-sdk 0.53"; + } +} + +// QueryEpochInfosRequest defines the gRPC request structure for +// querying all epoch info. +message QueryEpochInfosRequest {} + +// QueryEpochInfosRequest defines the gRPC response structure for +// querying all epoch info. +message QueryEpochInfosResponse { + repeated EpochInfo epochs = 1 [(gogoproto.nullable) = false]; +} + +// QueryCurrentEpochRequest defines the gRPC request structure for +// querying an epoch by its identifier. +message QueryCurrentEpochRequest { + string identifier = 1; +} + +// QueryCurrentEpochResponse defines the gRPC response structure for +// querying an epoch by its identifier. +message QueryCurrentEpochResponse { + int64 current_epoch = 1; +} \ No newline at end of file diff --git a/packages/api/proto/cosmos/evidence/module/v1/module.proto b/packages/api/proto/cosmos/evidence/module/v1/module.proto new file mode 100644 index 00000000..5b2ede65 --- /dev/null +++ b/packages/api/proto/cosmos/evidence/module/v1/module.proto @@ -0,0 +1,12 @@ +syntax = "proto3"; + +package cosmos.evidence.module.v1; + +import "cosmos/app/v1alpha1/module.proto"; + +// Module is the config object of the evidence module. +message Module { + option (cosmos.app.v1alpha1.module) = { + go_import: "cosmossdk.io/x/evidence" + }; +} \ No newline at end of file diff --git a/packages/api/proto/cosmos/evidence/v1beta1/evidence.proto b/packages/api/proto/cosmos/evidence/v1beta1/evidence.proto index 83f9ec3d..21b2c5d8 100644 --- a/packages/api/proto/cosmos/evidence/v1beta1/evidence.proto +++ b/packages/api/proto/cosmos/evidence/v1beta1/evidence.proto @@ -1,9 +1,10 @@ syntax = "proto3"; package cosmos.evidence.v1beta1; -option go_package = "github.com/cosmos/cosmos-sdk/x/evidence/types"; +option go_package = "cosmossdk.io/x/evidence/types"; option (gogoproto.equal_all) = true; +import "amino/amino.proto"; import "gogoproto/gogo.proto"; import "google/protobuf/timestamp.proto"; import "cosmos_proto/cosmos.proto"; @@ -11,12 +12,20 @@ import "cosmos_proto/cosmos.proto"; // Equivocation implements the Evidence interface and defines evidence of double // signing misbehavior. message Equivocation { - option (gogoproto.goproto_stringer) = false; - option (gogoproto.goproto_getters) = false; - option (gogoproto.equal) = false; + option (amino.name) = "cosmos-sdk/Equivocation"; + option (gogoproto.goproto_getters) = false; + option (gogoproto.equal) = false; - int64 height = 1; - google.protobuf.Timestamp time = 2 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; - int64 power = 3; - string consensus_address = 4 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // height is the equivocation height. + int64 height = 1; + + // time is the equivocation time. + google.protobuf.Timestamp time = 2 + [(gogoproto.nullable) = false, (amino.dont_omitempty) = true, (gogoproto.stdtime) = true]; + + // power is the equivocation validator power. + int64 power = 3; + + // consensus_address is the equivocation validator consensus address. + string consensus_address = 4 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } \ No newline at end of file diff --git a/packages/api/proto/cosmos/evidence/v1beta1/genesis.proto b/packages/api/proto/cosmos/evidence/v1beta1/genesis.proto index 199f446f..33b354e2 100644 --- a/packages/api/proto/cosmos/evidence/v1beta1/genesis.proto +++ b/packages/api/proto/cosmos/evidence/v1beta1/genesis.proto @@ -1,7 +1,7 @@ syntax = "proto3"; package cosmos.evidence.v1beta1; -option go_package = "github.com/cosmos/cosmos-sdk/x/evidence/types"; +option go_package = "cosmossdk.io/x/evidence/types"; import "google/protobuf/any.proto"; diff --git a/packages/api/proto/cosmos/evidence/v1beta1/query.proto b/packages/api/proto/cosmos/evidence/v1beta1/query.proto index eda00544..1ef0fa09 100644 --- a/packages/api/proto/cosmos/evidence/v1beta1/query.proto +++ b/packages/api/proto/cosmos/evidence/v1beta1/query.proto @@ -2,17 +2,17 @@ syntax = "proto3"; package cosmos.evidence.v1beta1; import "cosmos/base/query/v1beta1/pagination.proto"; -import "gogoproto/gogo.proto"; import "google/protobuf/any.proto"; import "google/api/annotations.proto"; +import "cosmos_proto/cosmos.proto"; -option go_package = "github.com/cosmos/cosmos-sdk/x/evidence/types"; +option go_package = "cosmossdk.io/x/evidence/types"; // Query defines the gRPC querier service. service Query { // Evidence queries evidence based on evidence hash. rpc Evidence(QueryEvidenceRequest) returns (QueryEvidenceResponse) { - option (google.api.http).get = "/cosmos/evidence/v1beta1/evidence/{evidence_hash}"; + option (google.api.http).get = "/cosmos/evidence/v1beta1/evidence/{hash}"; } // AllEvidence queries all evidence. @@ -24,7 +24,11 @@ service Query { // QueryEvidenceRequest is the request type for the Query/Evidence RPC method. message QueryEvidenceRequest { // evidence_hash defines the hash of the requested evidence. - bytes evidence_hash = 1 [(gogoproto.casttype) = "github.com/tendermint/tendermint/libs/bytes.HexBytes"]; + // Deprecated: Use hash, a HEX encoded string, instead. + bytes evidence_hash = 1 [deprecated = true]; + + // hash defines the evidence hash of the requested evidence. + string hash = 2 [(cosmos_proto.field_added_in) = "cosmos-sdk 0.47"]; } // QueryEvidenceResponse is the response type for the Query/Evidence RPC method. diff --git a/packages/api/proto/cosmos/evidence/v1beta1/tx.proto b/packages/api/proto/cosmos/evidence/v1beta1/tx.proto index 223f7e11..5eeaa6e9 100644 --- a/packages/api/proto/cosmos/evidence/v1beta1/tx.proto +++ b/packages/api/proto/cosmos/evidence/v1beta1/tx.proto @@ -1,16 +1,19 @@ syntax = "proto3"; package cosmos.evidence.v1beta1; -option go_package = "github.com/cosmos/cosmos-sdk/x/evidence/types"; +option go_package = "cosmossdk.io/x/evidence/types"; option (gogoproto.equal_all) = true; import "gogoproto/gogo.proto"; import "google/protobuf/any.proto"; import "cosmos_proto/cosmos.proto"; import "cosmos/msg/v1/msg.proto"; +import "amino/amino.proto"; // Msg defines the evidence Msg service. service Msg { + option (cosmos.msg.v1.service) = true; + // SubmitEvidence submits an arbitrary Evidence of misbehavior such as equivocation or // counterfactual signing. rpc SubmitEvidence(MsgSubmitEvidence) returns (MsgSubmitEvidenceResponse); @@ -20,12 +23,16 @@ service Msg { // Evidence of misbehavior such as equivocation or counterfactual signing. message MsgSubmitEvidence { option (cosmos.msg.v1.signer) = "submitter"; + option (amino.name) = "cosmos-sdk/MsgSubmitEvidence"; option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; - string submitter = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - google.protobuf.Any evidence = 2 [(cosmos_proto.accepts_interface) = "Evidence"]; + // submitter is the signer account address of evidence. + string submitter = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // evidence defines the evidence of misbehavior. + google.protobuf.Any evidence = 2 [(cosmos_proto.accepts_interface) = "cosmos.evidence.v1beta1.Evidence"]; } // MsgSubmitEvidenceResponse defines the Msg/SubmitEvidence response type. diff --git a/packages/api/proto/cosmos/feegrant/module/v1/module.proto b/packages/api/proto/cosmos/feegrant/module/v1/module.proto new file mode 100644 index 00000000..c5d6c24e --- /dev/null +++ b/packages/api/proto/cosmos/feegrant/module/v1/module.proto @@ -0,0 +1,12 @@ +syntax = "proto3"; + +package cosmos.feegrant.module.v1; + +import "cosmos/app/v1alpha1/module.proto"; + +// Module is the config object of the feegrant module. +message Module { + option (cosmos.app.v1alpha1.module) = { + go_import: "cosmossdk.io/x/feegrant" + }; +} \ No newline at end of file diff --git a/packages/api/proto/cosmos/feegrant/v1beta1/feegrant.proto b/packages/api/proto/cosmos/feegrant/v1beta1/feegrant.proto index ec4e7a1e..8004400b 100644 --- a/packages/api/proto/cosmos/feegrant/v1beta1/feegrant.proto +++ b/packages/api/proto/cosmos/feegrant/v1beta1/feegrant.proto @@ -1,4 +1,3 @@ -// Since: cosmos-sdk 0.43 syntax = "proto3"; package cosmos.feegrant.v1beta1; @@ -6,21 +5,27 @@ import "gogoproto/gogo.proto"; import "google/protobuf/any.proto"; import "cosmos_proto/cosmos.proto"; import "cosmos/base/v1beta1/coin.proto"; +import "amino/amino.proto"; import "google/protobuf/timestamp.proto"; import "google/protobuf/duration.proto"; -option go_package = "github.com/cosmos/cosmos-sdk/x/feegrant"; +option go_package = "cosmossdk.io/x/feegrant"; // BasicAllowance implements Allowance with a one-time grant of coins // that optionally expires. The grantee can use up to SpendLimit to cover fees. message BasicAllowance { - option (cosmos_proto.implements_interface) = "FeeAllowanceI"; + option (cosmos_proto.implements_interface) = "cosmos.feegrant.v1beta1.FeeAllowanceI"; + option (amino.name) = "cosmos-sdk/BasicAllowance"; // spend_limit specifies the maximum amount of coins that can be spent // by this allowance and will be updated as coins are spent. If it is // empty, there is no spend limit and any amount of coins can be spent. - repeated cosmos.base.v1beta1.Coin spend_limit = 1 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; + repeated cosmos.base.v1beta1.Coin spend_limit = 1 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true, + (amino.encoding) = "legacy_coins", + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; // expiration specifies an optional time when this allowance expires google.protobuf.Timestamp expiration = 2 [(gogoproto.stdtime) = true]; @@ -29,37 +34,49 @@ message BasicAllowance { // PeriodicAllowance extends Allowance to allow for both a maximum cap, // as well as a limit per time period. message PeriodicAllowance { - option (cosmos_proto.implements_interface) = "FeeAllowanceI"; + option (cosmos_proto.implements_interface) = "cosmos.feegrant.v1beta1.FeeAllowanceI"; + option (amino.name) = "cosmos-sdk/PeriodicAllowance"; // basic specifies a struct of `BasicAllowance` - BasicAllowance basic = 1 [(gogoproto.nullable) = false]; + BasicAllowance basic = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // period specifies the time duration in which period_spend_limit coins can // be spent before that allowance is reset - google.protobuf.Duration period = 2 [(gogoproto.stdduration) = true, (gogoproto.nullable) = false]; + google.protobuf.Duration period = 2 + [(gogoproto.stdduration) = true, (gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // period_spend_limit specifies the maximum number of coins that can be spent // in the period - repeated cosmos.base.v1beta1.Coin period_spend_limit = 3 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; + repeated cosmos.base.v1beta1.Coin period_spend_limit = 3 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true, + (amino.encoding) = "legacy_coins", + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; // period_can_spend is the number of coins left to be spent before the period_reset time - repeated cosmos.base.v1beta1.Coin period_can_spend = 4 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; + repeated cosmos.base.v1beta1.Coin period_can_spend = 4 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true, + (amino.encoding) = "legacy_coins", + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; // period_reset is the time at which this period resets and a new one begins, // it is calculated from the start time of the first transaction after the // last period ended - google.protobuf.Timestamp period_reset = 5 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; + google.protobuf.Timestamp period_reset = 5 + [(gogoproto.stdtime) = true, (gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // AllowedMsgAllowance creates allowance only for specified message types. message AllowedMsgAllowance { option (gogoproto.goproto_getters) = false; - option (cosmos_proto.implements_interface) = "FeeAllowanceI"; + option (cosmos_proto.implements_interface) = "cosmos.feegrant.v1beta1.FeeAllowanceI"; + option (amino.name) = "cosmos-sdk/AllowedMsgAllowance"; // allowance can be any of basic and periodic fee allowance. - google.protobuf.Any allowance = 1 [(cosmos_proto.accepts_interface) = "FeeAllowanceI"]; + google.protobuf.Any allowance = 1 [(cosmos_proto.accepts_interface) = "cosmos.feegrant.v1beta1.FeeAllowanceI"]; // allowed_messages are the messages for which the grantee has the access. repeated string allowed_messages = 2; @@ -74,5 +91,5 @@ message Grant { string grantee = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // allowance can be any of basic, periodic, allowed fee allowance. - google.protobuf.Any allowance = 3 [(cosmos_proto.accepts_interface) = "FeeAllowanceI"]; + google.protobuf.Any allowance = 3 [(cosmos_proto.accepts_interface) = "cosmos.feegrant.v1beta1.FeeAllowanceI"]; } diff --git a/packages/api/proto/cosmos/feegrant/v1beta1/genesis.proto b/packages/api/proto/cosmos/feegrant/v1beta1/genesis.proto index 5b1ac4ca..3e8a9cae 100644 --- a/packages/api/proto/cosmos/feegrant/v1beta1/genesis.proto +++ b/packages/api/proto/cosmos/feegrant/v1beta1/genesis.proto @@ -1,13 +1,13 @@ -// Since: cosmos-sdk 0.43 syntax = "proto3"; package cosmos.feegrant.v1beta1; import "gogoproto/gogo.proto"; import "cosmos/feegrant/v1beta1/feegrant.proto"; +import "amino/amino.proto"; -option go_package = "github.com/cosmos/cosmos-sdk/x/feegrant"; +option go_package = "cosmossdk.io/x/feegrant"; // GenesisState contains a set of fee allowances, persisted from the store message GenesisState { - repeated Grant allowances = 1 [(gogoproto.nullable) = false]; + repeated Grant allowances = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } diff --git a/packages/api/proto/cosmos/feegrant/v1beta1/query.proto b/packages/api/proto/cosmos/feegrant/v1beta1/query.proto index baef7770..c3caf61e 100644 --- a/packages/api/proto/cosmos/feegrant/v1beta1/query.proto +++ b/packages/api/proto/cosmos/feegrant/v1beta1/query.proto @@ -1,4 +1,3 @@ -// Since: cosmos-sdk 0.43 syntax = "proto3"; package cosmos.feegrant.v1beta1; @@ -7,26 +6,25 @@ import "cosmos/base/query/v1beta1/pagination.proto"; import "google/api/annotations.proto"; import "cosmos_proto/cosmos.proto"; -option go_package = "github.com/cosmos/cosmos-sdk/x/feegrant"; +option go_package = "cosmossdk.io/x/feegrant"; // Query defines the gRPC querier service. service Query { - // Allowance returns fee granted to the grantee by the granter. + // Allowance returns granted allwance to the grantee by the granter. rpc Allowance(QueryAllowanceRequest) returns (QueryAllowanceResponse) { option (google.api.http).get = "/cosmos/feegrant/v1beta1/allowance/{granter}/{grantee}"; } - // Allowances returns all the grants for address. + // Allowances returns all the grants for the given grantee address. rpc Allowances(QueryAllowancesRequest) returns (QueryAllowancesResponse) { option (google.api.http).get = "/cosmos/feegrant/v1beta1/allowances/{grantee}"; } // AllowancesByGranter returns all the grants given by an address - // - // Since: cosmos-sdk 0.46 rpc AllowancesByGranter(QueryAllowancesByGranterRequest) returns (QueryAllowancesByGranterResponse) { - option (google.api.http).get = "/cosmos/feegrant/v1beta1/issued/{granter}"; + option (google.api.http).get = "/cosmos/feegrant/v1beta1/issued/{granter}"; + option (cosmos_proto.method_added_in) = "cosmos-sdk 0.46"; } } @@ -63,19 +61,17 @@ message QueryAllowancesResponse { } // QueryAllowancesByGranterRequest is the request type for the Query/AllowancesByGranter RPC method. -// -// Since: cosmos-sdk 0.46 message QueryAllowancesByGranterRequest { - string granter = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.46"; + string granter = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // pagination defines an pagination for the request. cosmos.base.query.v1beta1.PageRequest pagination = 2; } // QueryAllowancesByGranterResponse is the response type for the Query/AllowancesByGranter RPC method. -// -// Since: cosmos-sdk 0.46 message QueryAllowancesByGranterResponse { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.46"; // allowances that have been issued by the granter. repeated cosmos.feegrant.v1beta1.Grant allowances = 1; diff --git a/packages/api/proto/cosmos/feegrant/v1beta1/tx.proto b/packages/api/proto/cosmos/feegrant/v1beta1/tx.proto index a12d9aaa..c409b6df 100644 --- a/packages/api/proto/cosmos/feegrant/v1beta1/tx.proto +++ b/packages/api/proto/cosmos/feegrant/v1beta1/tx.proto @@ -1,15 +1,16 @@ -// Since: cosmos-sdk 0.43 syntax = "proto3"; package cosmos.feegrant.v1beta1; import "google/protobuf/any.proto"; import "cosmos_proto/cosmos.proto"; import "cosmos/msg/v1/msg.proto"; +import "amino/amino.proto"; -option go_package = "github.com/cosmos/cosmos-sdk/x/feegrant"; +option go_package = "cosmossdk.io/x/feegrant"; // Msg defines the feegrant msg service. service Msg { + option (cosmos.msg.v1.service) = true; // GrantAllowance grants fee allowance to the grantee on the granter's // account with the provided expiration time. @@ -18,12 +19,18 @@ service Msg { // RevokeAllowance revokes any fee allowance of granter's account that // has been granted to the grantee. rpc RevokeAllowance(MsgRevokeAllowance) returns (MsgRevokeAllowanceResponse); + + // PruneAllowances prunes expired fee allowances, currently up to 75 at a time. + rpc PruneAllowances(MsgPruneAllowances) returns (MsgPruneAllowancesResponse) { + option (cosmos_proto.method_added_in) = "cosmos-sdk v0.50.0"; + }; } // MsgGrantAllowance adds permission for Grantee to spend up to Allowance // of fees from the account of Granter. message MsgGrantAllowance { option (cosmos.msg.v1.signer) = "granter"; + option (amino.name) = "cosmos-sdk/MsgGrantAllowance"; // granter is the address of the user granting an allowance of their funds. string granter = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; @@ -32,7 +39,7 @@ message MsgGrantAllowance { string grantee = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // allowance can be any of basic, periodic, allowed fee allowance. - google.protobuf.Any allowance = 3 [(cosmos_proto.accepts_interface) = "FeeAllowanceI"]; + google.protobuf.Any allowance = 3 [(cosmos_proto.accepts_interface) = "cosmos.feegrant.v1beta1.FeeAllowanceI"]; } // MsgGrantAllowanceResponse defines the Msg/GrantAllowanceResponse response type. @@ -41,6 +48,7 @@ message MsgGrantAllowanceResponse {} // MsgRevokeAllowance removes any existing Allowance from Granter to Grantee. message MsgRevokeAllowance { option (cosmos.msg.v1.signer) = "granter"; + option (amino.name) = "cosmos-sdk/MsgRevokeAllowance"; // granter is the address of the user granting an allowance of their funds. string granter = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; @@ -51,3 +59,17 @@ message MsgRevokeAllowance { // MsgRevokeAllowanceResponse defines the Msg/RevokeAllowanceResponse response type. message MsgRevokeAllowanceResponse {} + +// MsgPruneAllowances prunes expired fee allowances. +message MsgPruneAllowances { + option (cosmos.msg.v1.signer) = "pruner"; + option (cosmos_proto.message_added_in) = "cosmos-sdk v0.50"; + + // pruner is the address of the user pruning expired allowances. + string pruner = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; +} + +// MsgPruneAllowancesResponse defines the Msg/PruneAllowancesResponse response type. +message MsgPruneAllowancesResponse { + option (cosmos_proto.message_added_in) = "cosmos-sdk v0.50"; +} \ No newline at end of file diff --git a/packages/api/proto/cosmos/genutil/module/v1/module.proto b/packages/api/proto/cosmos/genutil/module/v1/module.proto new file mode 100644 index 00000000..86e6f576 --- /dev/null +++ b/packages/api/proto/cosmos/genutil/module/v1/module.proto @@ -0,0 +1,12 @@ +syntax = "proto3"; + +package cosmos.genutil.module.v1; + +import "cosmos/app/v1alpha1/module.proto"; + +// Module is the config object for the genutil module. +message Module { + option (cosmos.app.v1alpha1.module) = { + go_import: "github.com/cosmos/cosmos-sdk/x/genutil" + }; +} \ No newline at end of file diff --git a/packages/api/proto/cosmos/genutil/v1beta1/genesis.proto b/packages/api/proto/cosmos/genutil/v1beta1/genesis.proto index 958d15fe..dfd34943 100644 --- a/packages/api/proto/cosmos/genutil/v1beta1/genesis.proto +++ b/packages/api/proto/cosmos/genutil/v1beta1/genesis.proto @@ -2,11 +2,17 @@ syntax = "proto3"; package cosmos.genutil.v1beta1; import "gogoproto/gogo.proto"; +import "amino/amino.proto"; option go_package = "github.com/cosmos/cosmos-sdk/x/genutil/types"; // GenesisState defines the raw genesis transaction in JSON. message GenesisState { // gen_txs defines the genesis transactions. - repeated bytes gen_txs = 1 [(gogoproto.casttype) = "encoding/json.RawMessage", (gogoproto.jsontag) = "gentxs"]; -} + repeated bytes gen_txs = 1 [ + (gogoproto.casttype) = "encoding/json.RawMessage", + (gogoproto.jsontag) = "gentxs", + (amino.field_name) = "gentxs", + (amino.dont_omitempty) = true + ]; +} \ No newline at end of file diff --git a/packages/api/proto/cosmos/gov/module/v1/module.proto b/packages/api/proto/cosmos/gov/module/v1/module.proto new file mode 100644 index 00000000..9cade9af --- /dev/null +++ b/packages/api/proto/cosmos/gov/module/v1/module.proto @@ -0,0 +1,19 @@ +syntax = "proto3"; + +package cosmos.gov.module.v1; + +import "cosmos/app/v1alpha1/module.proto"; + +// Module is the config object of the gov module. +message Module { + option (cosmos.app.v1alpha1.module) = { + go_import: "github.com/cosmos/cosmos-sdk/x/gov" + }; + + // max_metadata_len defines the maximum proposal metadata length. + // Defaults to 255 if not explicitly set. + uint64 max_metadata_len = 1; + + // authority defines the custom module authority. If not set, defaults to the governance module. + string authority = 2; +} \ No newline at end of file diff --git a/packages/api/proto/cosmos/gov/v1/genesis.proto b/packages/api/proto/cosmos/gov/v1/genesis.proto index cb44a7f3..b45898d1 100644 --- a/packages/api/proto/cosmos/gov/v1/genesis.proto +++ b/packages/api/proto/cosmos/gov/v1/genesis.proto @@ -1,9 +1,9 @@ -// Since: cosmos-sdk 0.46 syntax = "proto3"; package cosmos.gov.v1; import "cosmos/gov/v1/gov.proto"; +import "cosmos_proto/cosmos.proto"; option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types/v1"; @@ -17,10 +17,20 @@ message GenesisState { repeated Vote votes = 3; // proposals defines all the proposals present at genesis. repeated Proposal proposals = 4; - // params defines all the paramaters of related to deposit. - DepositParams deposit_params = 5; - // params defines all the paramaters of related to voting. - VotingParams voting_params = 6; - // params defines all the paramaters of related to tally. - TallyParams tally_params = 7; + // Deprecated: Prefer to use `params` instead. + // deposit_params defines all the paramaters of related to deposit. + DepositParams deposit_params = 5 [deprecated = true]; + // Deprecated: Prefer to use `params` instead. + // voting_params defines all the paramaters of related to voting. + VotingParams voting_params = 6 [deprecated = true]; + // Deprecated: Prefer to use `params` instead. + // tally_params defines all the paramaters of related to tally. + TallyParams tally_params = 7 [deprecated = true]; + // params defines all the paramaters of x/gov module. + Params params = 8 [(cosmos_proto.field_added_in) = "cosmos-sdk 0.47"]; + // The constitution allows builders to lay a foundation and define purpose. + // This is an immutable string set in genesis. + // There are no amendments, to go outside of scope, just fork. + // constitution is an immutable string in genesis for a chain builder to lay out their vision, ideas and ideals. + string constitution = 9 [(cosmos_proto.field_added_in) = "cosmos-sdk 0.50"]; } diff --git a/packages/api/proto/cosmos/gov/v1/gov.proto b/packages/api/proto/cosmos/gov/v1/gov.proto index 8a857233..ca9b9eeb 100644 --- a/packages/api/proto/cosmos/gov/v1/gov.proto +++ b/packages/api/proto/cosmos/gov/v1/gov.proto @@ -1,4 +1,3 @@ -// Since: cosmos-sdk 0.46 syntax = "proto3"; package cosmos.gov.v1; @@ -8,6 +7,7 @@ import "google/protobuf/timestamp.proto"; import "google/protobuf/any.proto"; import "google/protobuf/duration.proto"; import "cosmos_proto/cosmos.proto"; +import "amino/amino.proto"; option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types/v1"; @@ -27,35 +27,77 @@ enum VoteOption { // WeightedVoteOption defines a unit of vote for vote split. message WeightedVoteOption { + // option defines the valid vote options, it must not contain duplicate vote options. VoteOption option = 1; - string weight = 2 [(cosmos_proto.scalar) = "cosmos.Dec"]; + + // weight is the vote weight associated with the vote option. + string weight = 2 [(cosmos_proto.scalar) = "cosmos.Dec"]; } // Deposit defines an amount deposited by an account address to an active // proposal. message Deposit { - uint64 proposal_id = 1; - string depositor = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - repeated cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false]; + // proposal_id defines the unique id of the proposal. + uint64 proposal_id = 1; + + // depositor defines the deposit addresses from the proposals. + string depositor = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // amount to be deposited by depositor. + repeated cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // Proposal defines the core field members of a governance proposal. message Proposal { - uint64 id = 1; + // id defines the unique id of the proposal. + uint64 id = 1; + + // messages are the arbitrary messages to be executed if the proposal passes. repeated google.protobuf.Any messages = 2; - ProposalStatus status = 3; + + // status defines the proposal status. + ProposalStatus status = 3; + // final_tally_result is the final tally result of the proposal. When // querying a proposal via gRPC, this field is not populated until the // proposal's voting period has ended. - TallyResult final_tally_result = 4; - google.protobuf.Timestamp submit_time = 5 [(gogoproto.stdtime) = true]; - google.protobuf.Timestamp deposit_end_time = 6 [(gogoproto.stdtime) = true]; - repeated cosmos.base.v1beta1.Coin total_deposit = 7 [(gogoproto.nullable) = false]; - google.protobuf.Timestamp voting_start_time = 8 [(gogoproto.stdtime) = true]; - google.protobuf.Timestamp voting_end_time = 9 [(gogoproto.stdtime) = true]; + TallyResult final_tally_result = 4; + + // submit_time is the time of proposal submission. + google.protobuf.Timestamp submit_time = 5 [(gogoproto.stdtime) = true]; + + // deposit_end_time is the end time for deposition. + google.protobuf.Timestamp deposit_end_time = 6 [(gogoproto.stdtime) = true]; + + // total_deposit is the total deposit on the proposal. + repeated cosmos.base.v1beta1.Coin total_deposit = 7 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + + // voting_start_time is the starting time to vote on a proposal. + google.protobuf.Timestamp voting_start_time = 8 [(gogoproto.stdtime) = true]; + + // voting_end_time is the end time of voting on a proposal. + google.protobuf.Timestamp voting_end_time = 9 [(gogoproto.stdtime) = true]; // metadata is any arbitrary metadata attached to the proposal. + // the recommended format of the metadata is to be found here: + // https://docs.cosmos.network/v0.47/modules/gov#proposal-3 string metadata = 10; + + // title is the title of the proposal + string title = 11 [(cosmos_proto.field_added_in) = "cosmos-sdk 0.47"]; + + // summary is a short summary of the proposal + string summary = 12 [(cosmos_proto.field_added_in) = "cosmos-sdk 0.47"]; + + // proposer is the address of the proposal sumbitter + string proposer = 13 + [(cosmos_proto.scalar) = "cosmos.AddressString", (cosmos_proto.field_added_in) = "cosmos-sdk 0.47"]; + + // expedited defines if the proposal is expedited + bool expedited = 14 [(cosmos_proto.field_added_in) = "cosmos-sdk 0.50"]; + + // failed_reason defines the reason why the proposal failed + string failed_reason = 15 [(cosmos_proto.field_added_in) = "cosmos-sdk 0.50"]; } // ProposalStatus enumerates the valid statuses of a proposal. @@ -81,52 +123,133 @@ enum ProposalStatus { // TallyResult defines a standard tally for a governance proposal. message TallyResult { - string yes_count = 1 [(cosmos_proto.scalar) = "cosmos.Int"]; - string abstain_count = 2 [(cosmos_proto.scalar) = "cosmos.Int"]; - string no_count = 3 [(cosmos_proto.scalar) = "cosmos.Int"]; + // yes_count is the number of yes votes on a proposal. + string yes_count = 1 [(cosmos_proto.scalar) = "cosmos.Int"]; + // abstain_count is the number of abstain votes on a proposal. + string abstain_count = 2 [(cosmos_proto.scalar) = "cosmos.Int"]; + // no_count is the number of no votes on a proposal. + string no_count = 3 [(cosmos_proto.scalar) = "cosmos.Int"]; + // no_with_veto_count is the number of no with veto votes on a proposal. string no_with_veto_count = 4 [(cosmos_proto.scalar) = "cosmos.Int"]; } // Vote defines a vote on a governance proposal. // A Vote consists of a proposal ID, the voter, and the vote option. message Vote { + // proposal_id defines the unique id of the proposal. uint64 proposal_id = 1; - string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // voter is the voter address of the proposal. + string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + reserved 3; + + // options is the weighted vote options. repeated WeightedVoteOption options = 4; - // metadata is any arbitrary metadata to attached to the vote. + // metadata is any arbitrary metadata attached to the vote. + // the recommended format of the metadata is to be found here: https://docs.cosmos.network/v0.47/modules/gov#vote-5 string metadata = 5; } // DepositParams defines the params for deposits on governance proposals. message DepositParams { - // Minimum deposit for a proposal to enter voting period. + option deprecated = true; + + // Minimum deposit for a proposal to enter voting period. repeated cosmos.base.v1beta1.Coin min_deposit = 1 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "min_deposit,omitempty"]; - // Maximum period for Atom holders to deposit on a proposal. Initial value: 2 - // months. + // Maximum period for Atom holders to deposit on a proposal. Initial value: 2 + // months. google.protobuf.Duration max_deposit_period = 2 [(gogoproto.stdduration) = true, (gogoproto.jsontag) = "max_deposit_period,omitempty"]; } // VotingParams defines the params for voting on governance proposals. message VotingParams { - // Length of the voting period. + option deprecated = true; + + // Duration of the voting period. google.protobuf.Duration voting_period = 1 [(gogoproto.stdduration) = true]; } // TallyParams defines the params for tallying votes on governance proposals. message TallyParams { + option deprecated = true; + + // Minimum percentage of total stake needed to vote for a result to be + // considered valid. + string quorum = 1 [(cosmos_proto.scalar) = "cosmos.Dec"]; + + // Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. + string threshold = 2 [(cosmos_proto.scalar) = "cosmos.Dec"]; + + // Minimum value of Veto votes to Total votes ratio for proposal to be + // vetoed. Default value: 1/3. + string veto_threshold = 3 [(cosmos_proto.scalar) = "cosmos.Dec"]; +} + +// Params defines the parameters for the x/gov module. +message Params { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.47"; + // Minimum deposit for a proposal to enter voting period. + repeated cosmos.base.v1beta1.Coin min_deposit = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + + // Maximum period for Atom holders to deposit on a proposal. Initial value: 2 + // months. + google.protobuf.Duration max_deposit_period = 2 [(gogoproto.stdduration) = true]; + + // Duration of the voting period. + google.protobuf.Duration voting_period = 3 [(gogoproto.stdduration) = true]; + // Minimum percentage of total stake needed to vote for a result to be // considered valid. - string quorum = 1 [(cosmos_proto.scalar) = "cosmos.Dec", (gogoproto.jsontag) = "quorum,omitempty"]; + string quorum = 4 [(cosmos_proto.scalar) = "cosmos.Dec"]; // Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. - string threshold = 2 [(cosmos_proto.scalar) = "cosmos.Dec", (gogoproto.jsontag) = "threshold,omitempty"]; + string threshold = 5 [(cosmos_proto.scalar) = "cosmos.Dec"]; // Minimum value of Veto votes to Total votes ratio for proposal to be // vetoed. Default value: 1/3. - string veto_threshold = 3 [(cosmos_proto.scalar) = "cosmos.Dec", (gogoproto.jsontag) = "veto_threshold,omitempty"]; + string veto_threshold = 6 [(cosmos_proto.scalar) = "cosmos.Dec"]; + + // The ratio representing the proportion of the deposit value that must be paid at proposal submission. + string min_initial_deposit_ratio = 7 [(cosmos_proto.scalar) = "cosmos.Dec"]; + + // The cancel ratio which will not be returned back to the depositors when a proposal is cancelled. + string proposal_cancel_ratio = 8 + [(cosmos_proto.scalar) = "cosmos.Dec", (cosmos_proto.field_added_in) = "cosmos-sdk 0.50"]; + + // The address which will receive (proposal_cancel_ratio * deposit) proposal deposits. + // If empty, the (proposal_cancel_ratio * deposit) proposal deposits will be burned. + string proposal_cancel_dest = 9 + [(cosmos_proto.scalar) = "cosmos.AddressString", (cosmos_proto.field_added_in) = "cosmos-sdk 0.50"]; + + // Duration of the voting period of an expedited proposal. + google.protobuf.Duration expedited_voting_period = 10 + [(gogoproto.stdduration) = true, (cosmos_proto.field_added_in) = "cosmos-sdk 0.50"]; + + // Minimum proportion of Yes votes for proposal to pass. Default value: 0.67. + string expedited_threshold = 11 + [(cosmos_proto.scalar) = "cosmos.Dec", (cosmos_proto.field_added_in) = "cosmos-sdk 0.50"]; + + // Minimum expedited deposit for a proposal to enter voting period. + repeated cosmos.base.v1beta1.Coin expedited_min_deposit = 12 + [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + + // burn deposits if a proposal does not meet quorum + bool burn_vote_quorum = 13; + + // burn deposits if the proposal does not enter voting period + bool burn_proposal_deposit_prevote = 14; + + // burn deposits if quorum with vote type no_veto is met + bool burn_vote_veto = 15; + + // The ratio representing the proportion of the deposit value minimum that must be met when making a deposit. + // Default value: 0.01. Meaning that for a chain with a min_deposit of 100stake, a deposit of 1stake would be + // required. + string min_deposit_ratio = 16 + [(cosmos_proto.scalar) = "cosmos.Dec", (cosmos_proto.field_added_in) = "cosmos-sdk 0.50"]; } diff --git a/packages/api/proto/cosmos/gov/v1/query.proto b/packages/api/proto/cosmos/gov/v1/query.proto index b9d59145..d484aa10 100644 --- a/packages/api/proto/cosmos/gov/v1/query.proto +++ b/packages/api/proto/cosmos/gov/v1/query.proto @@ -1,5 +1,3 @@ - -// Since: cosmos-sdk 0.46 syntax = "proto3"; package cosmos.gov.v1; @@ -12,6 +10,11 @@ option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types/v1"; // Query defines the gRPC querier service for gov module service Query { + // Constitution queries the chain's constitution. + rpc Constitution(QueryConstitutionRequest) returns (QueryConstitutionResponse) { + option (google.api.http).get = "/cosmos/gov/v1/constitution"; + } + // Proposal queries proposal details based on ProposalID. rpc Proposal(QueryProposalRequest) returns (QueryProposalResponse) { option (google.api.http).get = "/cosmos/gov/v1/proposals/{proposal_id}"; @@ -37,7 +40,7 @@ service Query { option (google.api.http).get = "/cosmos/gov/v1/params/{params_type}"; } - // Deposit queries single deposit information based proposalID, depositAddr. + // Deposit queries single deposit information based on proposalID, depositAddr. rpc Deposit(QueryDepositRequest) returns (QueryDepositResponse) { option (google.api.http).get = "/cosmos/gov/v1/proposals/{proposal_id}/deposits/{depositor}"; } @@ -53,6 +56,14 @@ service Query { } } +// QueryConstitutionRequest is the request type for the Query/Constitution RPC method +message QueryConstitutionRequest {} + +// QueryConstitutionResponse is the response type for the Query/Constitution RPC method +message QueryConstitutionResponse { + string constitution = 1; +} + // QueryProposalRequest is the request type for the Query/Proposal RPC method. message QueryProposalRequest { // proposal_id defines the unique id of the proposal. @@ -61,6 +72,7 @@ message QueryProposalRequest { // QueryProposalResponse is the response type for the Query/Proposal RPC method. message QueryProposalResponse { + // proposal is the requested governance proposal. Proposal proposal = 1; } @@ -82,6 +94,7 @@ message QueryProposalsRequest { // QueryProposalsResponse is the response type for the Query/Proposals RPC // method. message QueryProposalsResponse { + // proposals defines all the requested governance proposals. repeated Proposal proposals = 1; // pagination defines the pagination in the response. @@ -99,7 +112,7 @@ message QueryVoteRequest { // QueryVoteResponse is the response type for the Query/Vote RPC method. message QueryVoteResponse { - // vote defined the queried vote. + // vote defines the queried vote. Vote vote = 1; } @@ -114,7 +127,7 @@ message QueryVotesRequest { // QueryVotesResponse is the response type for the Query/Votes RPC method. message QueryVotesResponse { - // votes defined the queried votes. + // votes defines the queried votes. repeated Vote votes = 1; // pagination defines the pagination in the response. @@ -130,12 +143,17 @@ message QueryParamsRequest { // QueryParamsResponse is the response type for the Query/Params RPC method. message QueryParamsResponse { + // Deprecated: Prefer to use `params` instead. // voting_params defines the parameters related to voting. - VotingParams voting_params = 1; + VotingParams voting_params = 1 [deprecated = true]; + // Deprecated: Prefer to use `params` instead. // deposit_params defines the parameters related to deposit. - DepositParams deposit_params = 2; + DepositParams deposit_params = 2 [deprecated = true]; + // Deprecated: Prefer to use `params` instead. // tally_params defines the parameters related to tally. - TallyParams tally_params = 3; + TallyParams tally_params = 3 [deprecated = true]; + // params defines all the paramaters of x/gov module. + Params params = 4 [(cosmos_proto.field_added_in) = "cosmos-sdk 0.47"]; } // QueryDepositRequest is the request type for the Query/Deposit RPC method. @@ -164,6 +182,7 @@ message QueryDepositsRequest { // QueryDepositsResponse is the response type for the Query/Deposits RPC method. message QueryDepositsResponse { + // deposits defines the requested deposits. repeated Deposit deposits = 1; // pagination defines the pagination in the response. diff --git a/packages/api/proto/cosmos/gov/v1/tx.proto b/packages/api/proto/cosmos/gov/v1/tx.proto index 9306c51e..8b2abd62 100644 --- a/packages/api/proto/cosmos/gov/v1/tx.proto +++ b/packages/api/proto/cosmos/gov/v1/tx.proto @@ -1,4 +1,3 @@ -// Since: cosmos-sdk 0.46 syntax = "proto3"; package cosmos.gov.v1; @@ -8,42 +7,89 @@ import "gogoproto/gogo.proto"; import "cosmos_proto/cosmos.proto"; import "google/protobuf/any.proto"; import "cosmos/msg/v1/msg.proto"; +import "amino/amino.proto"; +import "google/protobuf/timestamp.proto"; option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types/v1"; // Msg defines the gov Msg service. service Msg { - // SubmitProposal defines a method to create new proposal given a content. - rpc SubmitProposal(MsgSubmitProposal) returns (MsgSubmitProposalResponse); + option (cosmos.msg.v1.service) = true; + + // SubmitProposal defines a method to create new proposal given the messages. + rpc SubmitProposal(MsgSubmitProposal) returns (MsgSubmitProposalResponse) { + option (cosmos_proto.method_added_in) = "cosmos-sdk 0.46"; + }; // ExecLegacyContent defines a Msg to be in included in a MsgSubmitProposal // to execute a legacy content-based proposal. - rpc ExecLegacyContent(MsgExecLegacyContent) returns (MsgExecLegacyContentResponse); + rpc ExecLegacyContent(MsgExecLegacyContent) returns (MsgExecLegacyContentResponse) { + option (cosmos_proto.method_added_in) = "cosmos-sdk 0.46"; + }; // Vote defines a method to add a vote on a specific proposal. - rpc Vote(MsgVote) returns (MsgVoteResponse); + rpc Vote(MsgVote) returns (MsgVoteResponse) { + option (cosmos_proto.method_added_in) = "cosmos-sdk 0.46"; + }; // VoteWeighted defines a method to add a weighted vote on a specific proposal. - rpc VoteWeighted(MsgVoteWeighted) returns (MsgVoteWeightedResponse); + rpc VoteWeighted(MsgVoteWeighted) returns (MsgVoteWeightedResponse) { + option (cosmos_proto.method_added_in) = "cosmos-sdk 0.46"; + }; // Deposit defines a method to add deposit on a specific proposal. - rpc Deposit(MsgDeposit) returns (MsgDepositResponse); + rpc Deposit(MsgDeposit) returns (MsgDepositResponse) { + option (cosmos_proto.method_added_in) = "cosmos-sdk 0.46"; + }; + + // UpdateParams defines a governance operation for updating the x/gov module + // parameters. The authority is defined in the keeper. + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse) { + option (cosmos_proto.method_added_in) = "cosmos-sdk 0.47"; + }; + + // CancelProposal defines a method to cancel governance proposal + rpc CancelProposal(MsgCancelProposal) returns (MsgCancelProposalResponse) { + option (cosmos_proto.method_added_in) = "cosmos-sdk 0.50"; + }; } // MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary // proposal Content. message MsgSubmitProposal { option (cosmos.msg.v1.signer) = "proposer"; + option (amino.name) = "cosmos-sdk/v1/MsgSubmitProposal"; + + // messages are the arbitrary messages to be executed if proposal passes. + repeated google.protobuf.Any messages = 1; + + // initial_deposit is the deposit value that must be paid at proposal submission. + repeated cosmos.base.v1beta1.Coin initial_deposit = 2 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (amino.dont_omitempty) = true, + (amino.encoding) = "legacy_coins" + ]; + + // proposer is the account address of the proposer. + string proposer = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - repeated google.protobuf.Any messages = 1; - repeated cosmos.base.v1beta1.Coin initial_deposit = 2 [(gogoproto.nullable) = false]; - string proposer = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // metadata is any arbitrary metadata attached to the proposal. string metadata = 4; + + // title is the title of the proposal. + string title = 5 [(cosmos_proto.field_added_in) = "cosmos-sdk 0.47"]; + + // summary is the summary of the proposal + string summary = 6 [(cosmos_proto.field_added_in) = "cosmos-sdk 0.47"]; + + // expedited defines if the proposal is expedited or not + bool expedited = 7 [(cosmos_proto.field_added_in) = "cosmos-sdk 0.50"]; } // MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. message MsgSubmitProposalResponse { + // proposal_id defines the unique id of the proposal. uint64 proposal_id = 1; } @@ -51,9 +97,10 @@ message MsgSubmitProposalResponse { // This ensures backwards compatibility with v1beta1.MsgSubmitProposal. message MsgExecLegacyContent { option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "cosmos-sdk/v1/MsgExecLegacyContent"; // content is the proposal's content. - google.protobuf.Any content = 1 [(cosmos_proto.accepts_interface) = "Content"]; + google.protobuf.Any content = 1 [(cosmos_proto.accepts_interface) = "cosmos.gov.v1beta1.Content"]; // authority must be the gov module address. string authority = 2; } @@ -64,11 +111,19 @@ message MsgExecLegacyContentResponse {} // MsgVote defines a message to cast a vote. message MsgVote { option (cosmos.msg.v1.signer) = "voter"; + option (amino.name) = "cosmos-sdk/v1/MsgVote"; - uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id"]; - string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - VoteOption option = 3; - string metadata = 4; + // proposal_id defines the unique id of the proposal. + uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id", (amino.dont_omitempty) = true]; + + // voter is the voter address for the proposal. + string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // option defines the vote option. + VoteOption option = 3; + + // metadata is any arbitrary metadata attached to the Vote. + string metadata = 4; } // MsgVoteResponse defines the Msg/Vote response type. @@ -77,11 +132,19 @@ message MsgVoteResponse {} // MsgVoteWeighted defines a message to cast a vote. message MsgVoteWeighted { option (cosmos.msg.v1.signer) = "voter"; + option (amino.name) = "cosmos-sdk/v1/MsgVoteWeighted"; + + // proposal_id defines the unique id of the proposal. + uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id", (amino.dont_omitempty) = true]; + + // voter is the voter address for the proposal. + string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // options defines the weighted vote options. + repeated WeightedVoteOption options = 3; - uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id"]; - string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - repeated WeightedVoteOption options = 3; - string metadata = 4; + // metadata is any arbitrary metadata attached to the VoteWeighted. + string metadata = 4; } // MsgVoteWeightedResponse defines the Msg/VoteWeighted response type. @@ -90,11 +153,61 @@ message MsgVoteWeightedResponse {} // MsgDeposit defines a message to submit a deposit to an existing proposal. message MsgDeposit { option (cosmos.msg.v1.signer) = "depositor"; + option (amino.name) = "cosmos-sdk/v1/MsgDeposit"; + + // proposal_id defines the unique id of the proposal. + uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id", (amino.dont_omitempty) = true]; - uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id"]; - string depositor = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - repeated cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false]; + // depositor defines the deposit addresses from the proposals. + string depositor = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // amount to be deposited by depositor. + repeated cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // MsgDepositResponse defines the Msg/Deposit response type. message MsgDepositResponse {} + +// MsgUpdateParams is the Msg/UpdateParams request type. +message MsgUpdateParams { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.47"; + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "cosmos-sdk/x/gov/v1/MsgUpdateParams"; + + // authority is the address that controls the module (defaults to x/gov unless overwritten). + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // params defines the x/gov parameters to update. + // + // NOTE: All parameters must be supplied. + Params params = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +message MsgUpdateParamsResponse { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.47"; +} + +// MsgCancelProposal is the Msg/CancelProposal request type. +message MsgCancelProposal { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.50"; + option (cosmos.msg.v1.signer) = "proposer"; + + // proposal_id defines the unique id of the proposal. + uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id"]; + // proposer is the account address of the proposer. + string proposer = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; +} + +// MsgCancelProposalResponse defines the response structure for executing a +// MsgCancelProposal message. +message MsgCancelProposalResponse { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.50"; + // proposal_id defines the unique id of the proposal. + uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id"]; + // canceled_time is the time when proposal is canceled. + google.protobuf.Timestamp canceled_time = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; + // canceled_height defines the block height at which the proposal is canceled. + uint64 canceled_height = 3; +} diff --git a/packages/api/proto/cosmos/gov/v1beta1/genesis.proto b/packages/api/proto/cosmos/gov/v1beta1/genesis.proto index be9b07e4..f0c679a3 100644 --- a/packages/api/proto/cosmos/gov/v1beta1/genesis.proto +++ b/packages/api/proto/cosmos/gov/v1beta1/genesis.proto @@ -4,6 +4,7 @@ package cosmos.gov.v1beta1; import "gogoproto/gogo.proto"; import "cosmos/gov/v1beta1/gov.proto"; +import "amino/amino.proto"; option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"; @@ -12,15 +13,18 @@ message GenesisState { // starting_proposal_id is the ID of the starting proposal. uint64 starting_proposal_id = 1; // deposits defines all the deposits present at genesis. - repeated Deposit deposits = 2 [(gogoproto.castrepeated) = "Deposits", (gogoproto.nullable) = false]; + repeated Deposit deposits = 2 + [(gogoproto.castrepeated) = "Deposits", (gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // votes defines all the votes present at genesis. - repeated Vote votes = 3 [(gogoproto.castrepeated) = "Votes", (gogoproto.nullable) = false]; + repeated Vote votes = 3 + [(gogoproto.castrepeated) = "Votes", (gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // proposals defines all the proposals present at genesis. - repeated Proposal proposals = 4 [(gogoproto.castrepeated) = "Proposals", (gogoproto.nullable) = false]; - // params defines all the paramaters of related to deposit. - DepositParams deposit_params = 5 [(gogoproto.nullable) = false]; - // params defines all the paramaters of related to voting. - VotingParams voting_params = 6 [(gogoproto.nullable) = false]; - // params defines all the paramaters of related to tally. - TallyParams tally_params = 7 [(gogoproto.nullable) = false]; + repeated Proposal proposals = 4 + [(gogoproto.castrepeated) = "Proposals", (gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + // deposit_params defines all the parameters related to deposit. + DepositParams deposit_params = 5 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + // voting_params defines all the parameters related to voting. + VotingParams voting_params = 6 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + // tally_params defines all the parameters related to tally. + TallyParams tally_params = 7 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } diff --git a/packages/api/proto/cosmos/gov/v1beta1/gov.proto b/packages/api/proto/cosmos/gov/v1beta1/gov.proto index 0e65d65b..23206c27 100644 --- a/packages/api/proto/cosmos/gov/v1beta1/gov.proto +++ b/packages/api/proto/cosmos/gov/v1beta1/gov.proto @@ -7,12 +7,11 @@ import "google/protobuf/timestamp.proto"; import "google/protobuf/any.proto"; import "google/protobuf/duration.proto"; import "cosmos_proto/cosmos.proto"; +import "amino/amino.proto"; option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"; -option (gogoproto.goproto_stringer_all) = false; -option (gogoproto.stringer_all) = false; -option (gogoproto.goproto_getters_all) = false; +option (gogoproto.goproto_getters_all) = false; // VoteOption enumerates the valid vote options for a given governance proposal. enum VoteOption { @@ -31,13 +30,16 @@ enum VoteOption { } // WeightedVoteOption defines a unit of vote for vote split. -// -// Since: cosmos-sdk 0.43 message WeightedVoteOption { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.43"; + // option defines the valid vote options, it must not contain duplicate vote options. VoteOption option = 1; - string weight = 2 [ + + // weight is the vote weight associated with the vote option. + string weight = 2 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (amino.dont_omitempty) = true, (gogoproto.nullable) = false ]; } @@ -45,11 +47,15 @@ message WeightedVoteOption { // TextProposal defines a standard text proposal whose changes need to be // manually updated in case of approval. message TextProposal { - option (cosmos_proto.implements_interface) = "Content"; + option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content"; + option (amino.name) = "cosmos-sdk/TextProposal"; option (gogoproto.equal) = true; - string title = 1; + // title of the proposal. + string title = 1; + + // description associated with the proposal. string description = 2; } @@ -59,29 +65,60 @@ message Deposit { option (gogoproto.goproto_getters) = false; option (gogoproto.equal) = false; - uint64 proposal_id = 1; - string depositor = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - repeated cosmos.base.v1beta1.Coin amount = 3 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; + // proposal_id defines the unique id of the proposal. + uint64 proposal_id = 1; + + // depositor defines the deposit addresses from the proposals. + string depositor = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // amount to be deposited by depositor. + repeated cosmos.base.v1beta1.Coin amount = 3 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; } // Proposal defines the core field members of a governance proposal. message Proposal { option (gogoproto.equal) = true; - uint64 proposal_id = 1; - google.protobuf.Any content = 2 [(cosmos_proto.accepts_interface) = "Content"]; - ProposalStatus status = 3; + // proposal_id defines the unique id of the proposal. + uint64 proposal_id = 1; + + // content is the proposal's content. + google.protobuf.Any content = 2 [(cosmos_proto.accepts_interface) = "cosmos.gov.v1beta1.Content"]; + + // status defines the proposal status. + ProposalStatus status = 3; + // final_tally_result is the final tally result of the proposal. When // querying a proposal via gRPC, this field is not populated until the // proposal's voting period has ended. - TallyResult final_tally_result = 4 [(gogoproto.nullable) = false]; - google.protobuf.Timestamp submit_time = 5 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; - google.protobuf.Timestamp deposit_end_time = 6 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; - repeated cosmos.base.v1beta1.Coin total_deposit = 7 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; - google.protobuf.Timestamp voting_start_time = 8 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; - google.protobuf.Timestamp voting_end_time = 9 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; + TallyResult final_tally_result = 4 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + + // submit_time is the time of proposal submission. + google.protobuf.Timestamp submit_time = 5 + [(gogoproto.stdtime) = true, (gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + + // deposit_end_time is the end time for deposition. + google.protobuf.Timestamp deposit_end_time = 6 + [(gogoproto.stdtime) = true, (gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + + // total_deposit is the total deposit on the proposal. + repeated cosmos.base.v1beta1.Coin total_deposit = 7 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; + + // voting_start_time is the starting time to vote on a proposal. + google.protobuf.Timestamp voting_start_time = 8 + [(gogoproto.stdtime) = true, (gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + + // voting_end_time is the end time of voting on a proposal. + google.protobuf.Timestamp voting_end_time = 9 + [(gogoproto.stdtime) = true, (gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // ProposalStatus enumerates the valid statuses of a proposal. @@ -111,24 +148,31 @@ enum ProposalStatus { message TallyResult { option (gogoproto.equal) = true; + // yes is the number of yes votes on a proposal. string yes = 1 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; + + // abstain is the number of abstain votes on a proposal. string abstain = 2 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; + + // no is the number of no votes on a proposal. string no = 3 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; + + // no_with_veto is the number of no with veto votes on a proposal. string no_with_veto = 4 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; } @@ -136,30 +180,34 @@ message TallyResult { // Vote defines a vote on a governance proposal. // A Vote consists of a proposal ID, the voter, and the vote option. message Vote { - option (gogoproto.goproto_stringer) = false; - option (gogoproto.equal) = false; + option (gogoproto.equal) = false; + + // proposal_id defines the unique id of the proposal. + uint64 proposal_id = 1 [(gogoproto.jsontag) = "id", (amino.field_name) = "id", (amino.dont_omitempty) = true]; - uint64 proposal_id = 1 [(gogoproto.jsontag) = "id"]; - string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // voter is the voter address of the proposal. + string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // Deprecated: Prefer to use `options` instead. This field is set in queries // if and only if `len(options) == 1` and that option has weight 1. In all // other cases, this field will default to VOTE_OPTION_UNSPECIFIED. VoteOption option = 3 [deprecated = true]; - // Since: cosmos-sdk 0.43 - repeated WeightedVoteOption options = 4 [(gogoproto.nullable) = false]; + + // options is the weighted vote options. + repeated WeightedVoteOption options = 4 + [(gogoproto.nullable) = false, (amino.dont_omitempty) = true, (cosmos_proto.field_added_in) = "cosmos-sdk 0.43"]; } // DepositParams defines the params for deposits on governance proposals. message DepositParams { - // Minimum deposit for a proposal to enter voting period. + // Minimum deposit for a proposal to enter voting period. repeated cosmos.base.v1beta1.Coin min_deposit = 1 [ (gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", (gogoproto.jsontag) = "min_deposit,omitempty" ]; - // Maximum period for Atom holders to deposit on a proposal. Initial value: 2 - // months. + // Maximum period for Atom holders to deposit on a proposal. Initial value: 2 + // months. google.protobuf.Duration max_deposit_period = 2 [ (gogoproto.nullable) = false, (gogoproto.stdduration) = true, @@ -169,32 +217,35 @@ message DepositParams { // VotingParams defines the params for voting on governance proposals. message VotingParams { - // Length of the voting period. + // Duration of the voting period. google.protobuf.Duration voting_period = 1 [(gogoproto.nullable) = false, (gogoproto.stdduration) = true, (gogoproto.jsontag) = "voting_period,omitempty"]; } // TallyParams defines the params for tallying votes on governance proposals. message TallyParams { - // Minimum percentage of total stake needed to vote for a result to be - // considered valid. + // Minimum percentage of total stake needed to vote for a result to be + // considered valid. bytes quorum = 1 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false, (gogoproto.jsontag) = "quorum,omitempty" ]; - // Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. + // Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. bytes threshold = 2 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false, (gogoproto.jsontag) = "threshold,omitempty" ]; - // Minimum value of Veto votes to Total votes ratio for proposal to be - // vetoed. Default value: 1/3. + // Minimum value of Veto votes to Total votes ratio for proposal to be + // vetoed. Default value: 1/3. bytes veto_threshold = 3 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false, (gogoproto.jsontag) = "veto_threshold,omitempty" ]; diff --git a/packages/api/proto/cosmos/gov/v1beta1/query.proto b/packages/api/proto/cosmos/gov/v1beta1/query.proto index 168e1f5e..28352ed4 100644 --- a/packages/api/proto/cosmos/gov/v1beta1/query.proto +++ b/packages/api/proto/cosmos/gov/v1beta1/query.proto @@ -6,6 +6,7 @@ import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; import "cosmos/gov/v1beta1/gov.proto"; import "cosmos_proto/cosmos.proto"; +import "amino/amino.proto"; option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"; @@ -36,7 +37,7 @@ service Query { option (google.api.http).get = "/cosmos/gov/v1beta1/params/{params_type}"; } - // Deposit queries single deposit information based proposalID, depositAddr. + // Deposit queries single deposit information based on proposalID, depositor address. rpc Deposit(QueryDepositRequest) returns (QueryDepositResponse) { option (google.api.http).get = "/cosmos/gov/v1beta1/proposals/{proposal_id}/deposits/{depositor}"; } @@ -60,7 +61,7 @@ message QueryProposalRequest { // QueryProposalResponse is the response type for the Query/Proposal RPC method. message QueryProposalResponse { - Proposal proposal = 1 [(gogoproto.nullable) = false]; + Proposal proposal = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // QueryProposalsRequest is the request type for the Query/Proposals RPC method. @@ -84,7 +85,8 @@ message QueryProposalsRequest { // QueryProposalsResponse is the response type for the Query/Proposals RPC // method. message QueryProposalsResponse { - repeated Proposal proposals = 1 [(gogoproto.nullable) = false]; + // proposals defines all the requested governance proposals. + repeated Proposal proposals = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // pagination defines the pagination in the response. cosmos.base.query.v1beta1.PageResponse pagination = 2; @@ -104,8 +106,8 @@ message QueryVoteRequest { // QueryVoteResponse is the response type for the Query/Vote RPC method. message QueryVoteResponse { - // vote defined the queried vote. - Vote vote = 1 [(gogoproto.nullable) = false]; + // vote defines the queried vote. + Vote vote = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // QueryVotesRequest is the request type for the Query/Votes RPC method. @@ -119,8 +121,8 @@ message QueryVotesRequest { // QueryVotesResponse is the response type for the Query/Votes RPC method. message QueryVotesResponse { - // votes defined the queried votes. - repeated Vote votes = 1 [(gogoproto.nullable) = false]; + // votes defines the queried votes. + repeated Vote votes = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // pagination defines the pagination in the response. cosmos.base.query.v1beta1.PageResponse pagination = 2; @@ -136,11 +138,11 @@ message QueryParamsRequest { // QueryParamsResponse is the response type for the Query/Params RPC method. message QueryParamsResponse { // voting_params defines the parameters related to voting. - VotingParams voting_params = 1 [(gogoproto.nullable) = false]; + VotingParams voting_params = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // deposit_params defines the parameters related to deposit. - DepositParams deposit_params = 2 [(gogoproto.nullable) = false]; + DepositParams deposit_params = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // tally_params defines the parameters related to tally. - TallyParams tally_params = 3 [(gogoproto.nullable) = false]; + TallyParams tally_params = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // QueryDepositRequest is the request type for the Query/Deposit RPC method. @@ -158,7 +160,7 @@ message QueryDepositRequest { // QueryDepositResponse is the response type for the Query/Deposit RPC method. message QueryDepositResponse { // deposit defines the requested deposit. - Deposit deposit = 1 [(gogoproto.nullable) = false]; + Deposit deposit = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // QueryDepositsRequest is the request type for the Query/Deposits RPC method. @@ -172,7 +174,8 @@ message QueryDepositsRequest { // QueryDepositsResponse is the response type for the Query/Deposits RPC method. message QueryDepositsResponse { - repeated Deposit deposits = 1 [(gogoproto.nullable) = false]; + // deposits defines the requested deposits. + repeated Deposit deposits = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // pagination defines the pagination in the response. cosmos.base.query.v1beta1.PageResponse pagination = 2; @@ -187,5 +190,5 @@ message QueryTallyResultRequest { // QueryTallyResultResponse is the response type for the Query/Tally RPC method. message QueryTallyResultResponse { // tally defines the requested tally. - TallyResult tally = 1 [(gogoproto.nullable) = false]; + TallyResult tally = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } diff --git a/packages/api/proto/cosmos/gov/v1beta1/tx.proto b/packages/api/proto/cosmos/gov/v1beta1/tx.proto index 00ce2253..cf7bc9f1 100644 --- a/packages/api/proto/cosmos/gov/v1beta1/tx.proto +++ b/packages/api/proto/cosmos/gov/v1beta1/tx.proto @@ -6,13 +6,15 @@ import "cosmos/gov/v1beta1/gov.proto"; import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; import "google/protobuf/any.proto"; - import "cosmos/msg/v1/msg.proto"; +import "amino/amino.proto"; option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"; -// Msg defines the bank Msg service. +// Msg defines the gov Msg service. service Msg { + option (cosmos.msg.v1.service) = true; + // SubmitProposal defines a method to create new proposal given a content. rpc SubmitProposal(MsgSubmitProposal) returns (MsgSubmitProposalResponse); @@ -20,9 +22,9 @@ service Msg { rpc Vote(MsgVote) returns (MsgVoteResponse); // VoteWeighted defines a method to add a weighted vote on a specific proposal. - // - // Since: cosmos-sdk 0.43 - rpc VoteWeighted(MsgVoteWeighted) returns (MsgVoteWeightedResponse); + rpc VoteWeighted(MsgVoteWeighted) returns (MsgVoteWeightedResponse) { + option (cosmos_proto.method_added_in) = "cosmos-sdk 0.43"; + }; // Deposit defines a method to add deposit on a specific proposal. rpc Deposit(MsgDeposit) returns (MsgDepositResponse); @@ -32,74 +34,99 @@ service Msg { // proposal Content. message MsgSubmitProposal { option (cosmos.msg.v1.signer) = "proposer"; + option (amino.name) = "cosmos-sdk/MsgSubmitProposal"; + + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; - option (gogoproto.equal) = false; - option (gogoproto.goproto_stringer) = false; - option (gogoproto.stringer) = false; - option (gogoproto.goproto_getters) = false; + // content is the proposal's content. + google.protobuf.Any content = 1 [(cosmos_proto.accepts_interface) = "cosmos.gov.v1beta1.Content"]; - google.protobuf.Any content = 1 [(cosmos_proto.accepts_interface) = "Content"]; - repeated cosmos.base.v1beta1.Coin initial_deposit = 2 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; + // initial_deposit is the deposit value that must be paid at proposal submission. + repeated cosmos.base.v1beta1.Coin initial_deposit = 2 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true, + (amino.encoding) = "legacy_coins", + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; + + // proposer is the account address of the proposer. string proposer = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } // MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. message MsgSubmitProposalResponse { - uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id"]; + // proposal_id defines the unique id of the proposal. + uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id", (amino.dont_omitempty) = true]; } // MsgVote defines a message to cast a vote. message MsgVote { option (cosmos.msg.v1.signer) = "voter"; + option (amino.name) = "cosmos-sdk/MsgVote"; + + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // proposal_id defines the unique id of the proposal. + uint64 proposal_id = 1; - option (gogoproto.equal) = false; - option (gogoproto.goproto_stringer) = false; - option (gogoproto.stringer) = false; - option (gogoproto.goproto_getters) = false; + // voter is the voter address for the proposal. + string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - uint64 proposal_id = 1; - string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - VoteOption option = 3; + // option defines the vote option. + VoteOption option = 3; } // MsgVoteResponse defines the Msg/Vote response type. message MsgVoteResponse {} // MsgVoteWeighted defines a message to cast a vote. -// -// Since: cosmos-sdk 0.43 message MsgVoteWeighted { - option (cosmos.msg.v1.signer) = "voter"; + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.43"; + option (cosmos.msg.v1.signer) = "voter"; + option (amino.name) = "cosmos-sdk/MsgVoteWeighted"; + + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // proposal_id defines the unique id of the proposal. + uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id", (amino.dont_omitempty) = true]; - option (gogoproto.equal) = false; - option (gogoproto.goproto_stringer) = false; - option (gogoproto.stringer) = false; - option (gogoproto.goproto_getters) = false; + // voter is the voter address for the proposal. + string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id"]; - string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - repeated WeightedVoteOption options = 3 [(gogoproto.nullable) = false]; + // options defines the weighted vote options. + repeated WeightedVoteOption options = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // MsgVoteWeightedResponse defines the Msg/VoteWeighted response type. -// -// Since: cosmos-sdk 0.43 -message MsgVoteWeightedResponse {} +message MsgVoteWeightedResponse { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.43"; +} // MsgDeposit defines a message to submit a deposit to an existing proposal. message MsgDeposit { option (cosmos.msg.v1.signer) = "depositor"; + option (amino.name) = "cosmos-sdk/MsgDeposit"; + + option (gogoproto.equal) = false; + option (gogoproto.stringer) = false; + option (gogoproto.goproto_getters) = false; + + // proposal_id defines the unique id of the proposal. + uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id", (amino.dont_omitempty) = true]; - option (gogoproto.equal) = false; - option (gogoproto.goproto_stringer) = false; - option (gogoproto.stringer) = false; - option (gogoproto.goproto_getters) = false; + // depositor defines the deposit addresses from the proposals. + string depositor = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id"]; - string depositor = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - repeated cosmos.base.v1beta1.Coin amount = 3 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; + // amount to be deposited by depositor. + repeated cosmos.base.v1beta1.Coin amount = 3 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true, + (amino.encoding) = "legacy_coins", + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; } // MsgDepositResponse defines the Msg/Deposit response type. diff --git a/packages/api/proto/cosmos/group/module/v1/module.proto b/packages/api/proto/cosmos/group/module/v1/module.proto new file mode 100644 index 00000000..d1e7ffb2 --- /dev/null +++ b/packages/api/proto/cosmos/group/module/v1/module.proto @@ -0,0 +1,24 @@ +syntax = "proto3"; + +package cosmos.group.module.v1; + +import "cosmos/app/v1alpha1/module.proto"; +import "gogoproto/gogo.proto"; +import "google/protobuf/duration.proto"; +import "amino/amino.proto"; + +// Module is the config object of the group module. +message Module { + option (cosmos.app.v1alpha1.module) = { + go_import: "github.com/cosmos/cosmos-sdk/x/group" + }; + + // max_execution_period defines the max duration after a proposal's voting period ends that members can send a MsgExec + // to execute the proposal. + google.protobuf.Duration max_execution_period = 1 + [(gogoproto.stdduration) = true, (gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + + // max_metadata_len defines the max length of the metadata bytes field for various entities within the group module. + // Defaults to 255 if not explicitly set. + uint64 max_metadata_len = 2; +} diff --git a/packages/api/proto/cosmos/group/v1/events.proto b/packages/api/proto/cosmos/group/v1/events.proto index c2cfe872..ccec9139 100644 --- a/packages/api/proto/cosmos/group/v1/events.proto +++ b/packages/api/proto/cosmos/group/v1/events.proto @@ -1,4 +1,3 @@ -// Since: cosmos-sdk 0.46 syntax = "proto3"; package cosmos.group.v1; @@ -79,3 +78,26 @@ message EventLeaveGroup { // address is the account address of the group member. string address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } + +// EventProposalPruned is an event emitted when a proposal is pruned. +message EventProposalPruned { + + // proposal_id is the unique ID of the proposal. + uint64 proposal_id = 1; + + // status is the proposal status (UNSPECIFIED, SUBMITTED, ACCEPTED, REJECTED, ABORTED, WITHDRAWN). + ProposalStatus status = 2; + + // tally_result is the proposal tally result (when applicable). + TallyResult tally_result = 3; +} + +// EventTallyError is an event emitted when a proposal tally failed with an error. +message EventTallyError { + + // proposal_id is the unique ID of the proposal. + uint64 proposal_id = 1; + + // error_message is the raw error output + string error_message = 2; +} diff --git a/packages/api/proto/cosmos/group/v1/genesis.proto b/packages/api/proto/cosmos/group/v1/genesis.proto index e4c895e9..49655ad2 100644 --- a/packages/api/proto/cosmos/group/v1/genesis.proto +++ b/packages/api/proto/cosmos/group/v1/genesis.proto @@ -1,4 +1,3 @@ -// Since: cosmos-sdk 0.46 syntax = "proto3"; package cosmos.group.v1; diff --git a/packages/api/proto/cosmos/group/v1/query.proto b/packages/api/proto/cosmos/group/v1/query.proto index 51a011a9..9d8d7a2e 100644 --- a/packages/api/proto/cosmos/group/v1/query.proto +++ b/packages/api/proto/cosmos/group/v1/query.proto @@ -1,4 +1,3 @@ -// Since: cosmos-sdk 0.46 syntax = "proto3"; package cosmos.group.v1; @@ -8,6 +7,7 @@ import "google/api/annotations.proto"; import "cosmos/group/v1/types.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; import "cosmos_proto/cosmos.proto"; +import "amino/amino.proto"; option go_package = "github.com/cosmos/cosmos-sdk/x/group"; @@ -24,7 +24,7 @@ service Query { option (google.api.http).get = "/cosmos/group/v1/group_policy_info/{address}"; }; - // GroupMembers queries members of a group + // GroupMembers queries members of a group by group id. rpc GroupMembers(QueryGroupMembersRequest) returns (QueryGroupMembersResponse) { option (google.api.http).get = "/cosmos/group/v1/group_members/{group_id}"; }; @@ -39,7 +39,7 @@ service Query { option (google.api.http).get = "/cosmos/group/v1/group_policies_by_group/{group_id}"; }; - // GroupsByAdmin queries group policies by admin address. + // GroupPoliciesByAdmin queries group policies by admin address. rpc GroupPoliciesByAdmin(QueryGroupPoliciesByAdminRequest) returns (QueryGroupPoliciesByAdminResponse) { option (google.api.http).get = "/cosmos/group/v1/group_policies_by_admin/{admin}"; }; @@ -59,7 +59,7 @@ service Query { option (google.api.http).get = "/cosmos/group/v1/vote_by_proposal_voter/{proposal_id}/{voter}"; }; - // VotesByProposal queries a vote by proposal. + // VotesByProposal queries a vote by proposal id. rpc VotesByProposal(QueryVotesByProposalRequest) returns (QueryVotesByProposalResponse) { option (google.api.http).get = "/cosmos/group/v1/votes_by_proposal/{proposal_id}"; }; @@ -82,39 +82,40 @@ service Query { rpc TallyResult(QueryTallyResultRequest) returns (QueryTallyResultResponse) { option (google.api.http).get = "/cosmos/group/v1/proposals/{proposal_id}/tally"; }; + + // Groups queries all groups in state. + rpc Groups(QueryGroupsRequest) returns (QueryGroupsResponse) { + option (cosmos_proto.method_added_in) = "cosmos-sdk 0.47.1"; + option (google.api.http).get = "/cosmos/group/v1/groups"; + }; } // QueryGroupInfoRequest is the Query/GroupInfo request type. message QueryGroupInfoRequest { - // group_id is the unique ID of the group. uint64 group_id = 1; } // QueryGroupInfoResponse is the Query/GroupInfo response type. message QueryGroupInfoResponse { - - // info is the GroupInfo for the group. + // info is the GroupInfo of the group. GroupInfo info = 1; } // QueryGroupPolicyInfoRequest is the Query/GroupPolicyInfo request type. message QueryGroupPolicyInfoRequest { - // address is the account address of the group policy. string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } // QueryGroupPolicyInfoResponse is the Query/GroupPolicyInfo response type. message QueryGroupPolicyInfoResponse { - - // info is the GroupPolicyInfo for the group policy. + // info is the GroupPolicyInfo of the group policy. GroupPolicyInfo info = 1; } // QueryGroupMembersRequest is the Query/GroupMembers request type. message QueryGroupMembersRequest { - // group_id is the unique ID of the group. uint64 group_id = 1; @@ -124,7 +125,6 @@ message QueryGroupMembersRequest { // QueryGroupMembersResponse is the Query/GroupMembersResponse response type. message QueryGroupMembersResponse { - // members are the members of the group with given group_id. repeated GroupMember members = 1; @@ -134,7 +134,6 @@ message QueryGroupMembersResponse { // QueryGroupsByAdminRequest is the Query/GroupsByAdmin request type. message QueryGroupsByAdminRequest { - // admin is the account address of a group's admin. string admin = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; @@ -144,7 +143,6 @@ message QueryGroupsByAdminRequest { // QueryGroupsByAdminResponse is the Query/GroupsByAdminResponse response type. message QueryGroupsByAdminResponse { - // groups are the groups info with the provided admin. repeated GroupInfo groups = 1; @@ -154,7 +152,6 @@ message QueryGroupsByAdminResponse { // QueryGroupPoliciesByGroupRequest is the Query/GroupPoliciesByGroup request type. message QueryGroupPoliciesByGroupRequest { - // group_id is the unique ID of the group policy's group. uint64 group_id = 1; @@ -164,7 +161,6 @@ message QueryGroupPoliciesByGroupRequest { // QueryGroupPoliciesByGroupResponse is the Query/GroupPoliciesByGroup response type. message QueryGroupPoliciesByGroupResponse { - // group_policies are the group policies info associated with the provided group. repeated GroupPolicyInfo group_policies = 1; @@ -174,7 +170,6 @@ message QueryGroupPoliciesByGroupResponse { // QueryGroupPoliciesByAdminRequest is the Query/GroupPoliciesByAdmin request type. message QueryGroupPoliciesByAdminRequest { - // admin is the admin address of the group policy. string admin = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; @@ -184,7 +179,6 @@ message QueryGroupPoliciesByAdminRequest { // QueryGroupPoliciesByAdminResponse is the Query/GroupPoliciesByAdmin response type. message QueryGroupPoliciesByAdminResponse { - // group_policies are the group policies info with provided admin. repeated GroupPolicyInfo group_policies = 1; @@ -194,21 +188,18 @@ message QueryGroupPoliciesByAdminResponse { // QueryProposalRequest is the Query/Proposal request type. message QueryProposalRequest { - // proposal_id is the unique ID of a proposal. uint64 proposal_id = 1; } // QueryProposalResponse is the Query/Proposal response type. message QueryProposalResponse { - // proposal is the proposal info. Proposal proposal = 1; } // QueryProposalsByGroupPolicyRequest is the Query/ProposalByGroupPolicy request type. message QueryProposalsByGroupPolicyRequest { - // address is the account address of the group policy related to proposals. string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; @@ -218,7 +209,6 @@ message QueryProposalsByGroupPolicyRequest { // QueryProposalsByGroupPolicyResponse is the Query/ProposalByGroupPolicy response type. message QueryProposalsByGroupPolicyResponse { - // proposals are the proposals with given group policy. repeated Proposal proposals = 1; @@ -228,7 +218,6 @@ message QueryProposalsByGroupPolicyResponse { // QueryVoteByProposalVoterRequest is the Query/VoteByProposalVoter request type. message QueryVoteByProposalVoterRequest { - // proposal_id is the unique ID of a proposal. uint64 proposal_id = 1; @@ -238,14 +227,12 @@ message QueryVoteByProposalVoterRequest { // QueryVoteByProposalVoterResponse is the Query/VoteByProposalVoter response type. message QueryVoteByProposalVoterResponse { - // vote is the vote with given proposal_id and voter. Vote vote = 1; } // QueryVotesByProposalRequest is the Query/VotesByProposal request type. message QueryVotesByProposalRequest { - // proposal_id is the unique ID of a proposal. uint64 proposal_id = 1; @@ -255,7 +242,6 @@ message QueryVotesByProposalRequest { // QueryVotesByProposalResponse is the Query/VotesByProposal response type. message QueryVotesByProposalResponse { - // votes are the list of votes for given proposal_id. repeated Vote votes = 1; @@ -274,7 +260,6 @@ message QueryVotesByVoterRequest { // QueryVotesByVoterResponse is the Query/VotesByVoter response type. message QueryVotesByVoterResponse { - // votes are the list of votes by given voter. repeated Vote votes = 1; @@ -309,5 +294,22 @@ message QueryTallyResultRequest { // QueryTallyResultResponse is the Query/TallyResult response type. message QueryTallyResultResponse { // tally defines the requested tally. - TallyResult tally = 1 [(gogoproto.nullable) = false]; + TallyResult tally = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; +} + +// QueryGroupsRequest is the Query/Groups request type. +message QueryGroupsRequest { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.47.1"; + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// QueryGroupsResponse is the Query/Groups response type. +message QueryGroupsResponse { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.47.1"; + // `groups` is all the groups present in state. + repeated GroupInfo groups = 1; + + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; } diff --git a/packages/api/proto/cosmos/group/v1/tx.proto b/packages/api/proto/cosmos/group/v1/tx.proto index ea89a1fa..b651c0ac 100644 --- a/packages/api/proto/cosmos/group/v1/tx.proto +++ b/packages/api/proto/cosmos/group/v1/tx.proto @@ -1,4 +1,3 @@ -// Since: cosmos-sdk 0.46 syntax = "proto3"; package cosmos.group.v1; @@ -81,7 +80,6 @@ message MsgCreateGroup { // MsgCreateGroupResponse is the Msg/CreateGroup response type. message MsgCreateGroupResponse { - // group_id is the unique ID of the newly created group. uint64 group_id = 1; } @@ -162,12 +160,11 @@ message MsgCreateGroupPolicy { string metadata = 3; // decision_policy specifies the group policy's decision policy. - google.protobuf.Any decision_policy = 4 [(cosmos_proto.accepts_interface) = "DecisionPolicy"]; + google.protobuf.Any decision_policy = 4 [(cosmos_proto.accepts_interface) = "cosmos.group.v1.DecisionPolicy"]; } // MsgCreateGroupPolicyResponse is the Msg/CreateGroupPolicy response type. message MsgCreateGroupPolicyResponse { - // address is the account address of the newly created group policy. string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } @@ -213,12 +210,11 @@ message MsgCreateGroupWithPolicy { bool group_policy_as_admin = 5; // decision_policy specifies the group policy's decision policy. - google.protobuf.Any decision_policy = 6 [(cosmos_proto.accepts_interface) = "DecisionPolicy"]; + google.protobuf.Any decision_policy = 6 [(cosmos_proto.accepts_interface) = "cosmos.group.v1.DecisionPolicy"]; } // MsgCreateGroupWithPolicyResponse is the Msg/CreateGroupWithPolicy response type. message MsgCreateGroupWithPolicyResponse { - // group_id is the unique ID of the newly created group with policy. uint64 group_id = 1; @@ -240,7 +236,7 @@ message MsgUpdateGroupPolicyDecisionPolicy { string group_policy_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // decision_policy is the updated group policy's decision policy. - google.protobuf.Any decision_policy = 3 [(cosmos_proto.accepts_interface) = "DecisionPolicy"]; + google.protobuf.Any decision_policy = 3 [(cosmos_proto.accepts_interface) = "cosmos.group.v1.DecisionPolicy"]; } // MsgUpdateGroupPolicyDecisionPolicyResponse is the Msg/UpdateGroupPolicyDecisionPolicy response type. @@ -257,7 +253,7 @@ message MsgUpdateGroupPolicyMetadata { // group_policy_address is the account address of group policy. string group_policy_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - // metadata is the updated group policy metadata. + // metadata is the group policy metadata to be updated. string metadata = 3; } @@ -270,7 +266,6 @@ message MsgUpdateGroupPolicyMetadataResponse {} // Exec defines modes of execution of a proposal on creation or on new vote. enum Exec { - // An empty value means that there should be a separate // MsgExec request for the proposal to execute. EXEC_UNSPECIFIED = 0; @@ -296,7 +291,7 @@ message MsgSubmitProposal { // Proposers signatures will be counted as yes votes. repeated string proposers = 2; - // metadata is any arbitrary metadata to attached to the proposal. + // metadata is any arbitrary metadata attached to the proposal. string metadata = 3; // messages is a list of `sdk.Msg`s that will be executed if the proposal passes. @@ -306,11 +301,16 @@ message MsgSubmitProposal { // whether it should be executed immediately on creation or not. // If so, proposers signatures are considered as Yes votes. Exec exec = 5; + + // title is the title of the proposal. + string title = 6 [(cosmos_proto.field_added_in) = "cosmos-sdk 0.47"]; + + // summary is the summary of the proposal. + string summary = 7 [(cosmos_proto.field_added_in) = "cosmos-sdk 0.47"]; } // MsgSubmitProposalResponse is the Msg/SubmitProposal response type. message MsgSubmitProposalResponse { - // proposal is the unique ID of the proposal. uint64 proposal_id = 1; } @@ -337,13 +337,14 @@ message MsgVote { // proposal is the unique ID of the proposal. uint64 proposal_id = 1; + // voter is the voter account address. string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // option is the voter's choice on the proposal. VoteOption option = 3; - // metadata is any arbitrary metadata to attached to the vote. + // metadata is any arbitrary metadata attached to the vote. string metadata = 4; // exec defines whether the proposal should be executed @@ -356,7 +357,7 @@ message MsgVoteResponse {} // MsgExec is the Msg/Exec request type. message MsgExec { - option (cosmos.msg.v1.signer) = "signer"; + option (cosmos.msg.v1.signer) = "executor"; option (amino.name) = "cosmos-sdk/group/MsgExec"; // proposal is the unique ID of the proposal. diff --git a/packages/api/proto/cosmos/group/v1/types.proto b/packages/api/proto/cosmos/group/v1/types.proto index 42630dc8..3c1a74ca 100644 --- a/packages/api/proto/cosmos/group/v1/types.proto +++ b/packages/api/proto/cosmos/group/v1/types.proto @@ -1,4 +1,3 @@ -// Since: cosmos-sdk 0.46 syntax = "proto3"; package cosmos.group.v1; @@ -10,11 +9,11 @@ import "google/protobuf/duration.proto"; import "google/protobuf/timestamp.proto"; import "cosmos_proto/cosmos.proto"; import "google/protobuf/any.proto"; +import "amino/amino.proto"; // Member represents a group member with an account address, // non-zero weight, metadata and added_at timestamp. message Member { - // address is the member's account address. string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; @@ -25,14 +24,14 @@ message Member { string metadata = 3; // added_at is a timestamp specifying when a member was added. - google.protobuf.Timestamp added_at = 4 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + google.protobuf.Timestamp added_at = 4 + [(gogoproto.nullable) = false, (amino.dont_omitempty) = true, (gogoproto.stdtime) = true]; } // MemberRequest represents a group member to be used in Msg server requests. // Contrary to `Member`, it doesn't have any `added_at` field // since this field cannot be set as part of requests. message MemberRequest { - // address is the member's account address. string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; @@ -45,12 +44,13 @@ message MemberRequest { // ThresholdDecisionPolicy is a decision policy where a proposal passes when it // satisfies the two following conditions: -// 1. The sum of all `YES` voters' weights is greater or equal than the defined +// 1. The sum of all `YES` voter's weights is greater or equal than the defined // `threshold`. // 2. The voting and execution periods of the proposal respect the parameters // given by `windows`. message ThresholdDecisionPolicy { - option (cosmos_proto.implements_interface) = "DecisionPolicy"; + option (cosmos_proto.implements_interface) = "cosmos.group.v1.DecisionPolicy"; + option (amino.name) = "cosmos-sdk/ThresholdDecisionPolicy"; // threshold is the minimum weighted sum of `YES` votes that must be met or // exceeded for a proposal to succeed. @@ -67,9 +67,10 @@ message ThresholdDecisionPolicy { // 2. The voting and execution periods of the proposal respect the parameters // given by `windows`. message PercentageDecisionPolicy { - option (cosmos_proto.implements_interface) = "DecisionPolicy"; + option (cosmos_proto.implements_interface) = "cosmos.group.v1.DecisionPolicy"; + option (amino.name) = "cosmos-sdk/PercentageDecisionPolicy"; - // percentage is the minimum percentage the weighted sum of `YES` votes must + // percentage is the minimum percentage of the weighted sum of `YES` votes must // meet for a proposal to succeed. string percentage = 1; @@ -81,7 +82,8 @@ message PercentageDecisionPolicy { message DecisionPolicyWindows { // voting_period is the duration from submission of a proposal to the end of voting period // Within this times votes can be submitted with MsgVote. - google.protobuf.Duration voting_period = 1 [(gogoproto.stdduration) = true, (gogoproto.nullable) = false]; + google.protobuf.Duration voting_period = 1 + [(gogoproto.stdduration) = true, (gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // min_execution_period is the minimum duration after the proposal submission // where members can start sending MsgExec. This means that the window for @@ -94,7 +96,8 @@ message DecisionPolicyWindows { // `voting_period + max_execution_period`, or else the above execution window // is empty, meaning that all proposals created with this decision policy // won't be able to be executed. - google.protobuf.Duration min_execution_period = 2 [(gogoproto.stdduration) = true, (gogoproto.nullable) = false]; + google.protobuf.Duration min_execution_period = 2 + [(gogoproto.stdduration) = true, (gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // VoteOption enumerates the valid vote options for a given proposal. @@ -120,7 +123,6 @@ enum VoteOption { // GroupInfo represents the high-level on-chain information for a group. message GroupInfo { - // id is the unique ID of the group. uint64 id = 1; @@ -128,6 +130,7 @@ message GroupInfo { string admin = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // metadata is any arbitrary metadata to attached to the group. + // the recommended format of the metadata is to be found here: https://docs.cosmos.network/v0.47/modules/group#group-1 string metadata = 3; // version is used to track changes to a group's membership structure that @@ -140,12 +143,12 @@ message GroupInfo { string total_weight = 5; // created_at is a timestamp specifying when a group was created. - google.protobuf.Timestamp created_at = 6 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + google.protobuf.Timestamp created_at = 6 + [(gogoproto.nullable) = false, (amino.dont_omitempty) = true, (gogoproto.stdtime) = true]; } // GroupMember represents the relationship between a group and a member. message GroupMember { - // group_id is the unique ID of the group. uint64 group_id = 1; @@ -167,7 +170,9 @@ message GroupPolicyInfo { // admin is the account address of the group admin. string admin = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - // metadata is any arbitrary metadata to attached to the group policy. + // metadata is any arbitrary metadata attached to the group policy. + // the recommended format of the metadata is to be found here: + // https://docs.cosmos.network/v0.47/modules/group#decision-policy-1 string metadata = 4; // version is used to track changes to a group's GroupPolicyInfo structure that @@ -175,10 +180,11 @@ message GroupPolicyInfo { uint64 version = 5; // decision_policy specifies the group policy's decision policy. - google.protobuf.Any decision_policy = 6 [(cosmos_proto.accepts_interface) = "DecisionPolicy"]; + google.protobuf.Any decision_policy = 6 [(cosmos_proto.accepts_interface) = "cosmos.group.v1.DecisionPolicy"]; // created_at is a timestamp specifying when a group policy was created. - google.protobuf.Timestamp created_at = 7 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + google.protobuf.Timestamp created_at = 7 + [(gogoproto.nullable) = false, (amino.dont_omitempty) = true, (gogoproto.stdtime) = true]; } // Proposal defines a group proposal. Any member of a group can submit a proposal @@ -194,14 +200,17 @@ message Proposal { // group_policy_address is the account address of group policy. string group_policy_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - // metadata is any arbitrary metadata to attached to the proposal. + // metadata is any arbitrary metadata attached to the proposal. + // the recommended format of the metadata is to be found here: + // https://docs.cosmos.network/v0.47/modules/group#proposal-4 string metadata = 3; // proposers are the account addresses of the proposers. repeated string proposers = 4 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // submit_time is a timestamp specifying when a proposal was submitted. - google.protobuf.Timestamp submit_time = 5 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + google.protobuf.Timestamp submit_time = 5 + [(gogoproto.nullable) = false, (amino.dont_omitempty) = true, (gogoproto.stdtime) = true]; // group_version tracks the version of the group at proposal submission. // This field is here for informational purposes only. @@ -220,20 +229,27 @@ message Proposal { // proposal for each vote option. It is empty at submission, and only // populated after tallying, at voting period end or at proposal execution, // whichever happens first. - TallyResult final_tally_result = 9 [(gogoproto.nullable) = false]; + TallyResult final_tally_result = 9 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // voting_period_end is the timestamp before which voting must be done. - // Unless a successfull MsgExec is called before (to execute a proposal whose + // Unless a successful MsgExec is called before (to execute a proposal whose // tally is successful before the voting period ends), tallying will be done // at this point, and the `final_tally_result`and `status` fields will be // accordingly updated. - google.protobuf.Timestamp voting_period_end = 10 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + google.protobuf.Timestamp voting_period_end = 10 + [(gogoproto.nullable) = false, (amino.dont_omitempty) = true, (gogoproto.stdtime) = true]; // executor_result is the final result of the proposal execution. Initial value is NotRun. ProposalExecutorResult executor_result = 11; // messages is a list of `sdk.Msg`s that will be executed if the proposal passes. repeated google.protobuf.Any messages = 12; + + // title is the title of the proposal + string title = 13 [(cosmos_proto.field_added_in) = "cosmos-sdk 0.47"]; + + // summary is a short summary of the proposal + string summary = 14 [(cosmos_proto.field_added_in) = "cosmos-sdk 0.47"]; } // ProposalStatus defines proposal statuses. @@ -297,9 +313,8 @@ message TallyResult { string no_with_veto_count = 4; } -// Vote represents a vote for a proposal. +// Vote represents a vote for a proposal.string metadata message Vote { - // proposal is the unique ID of the proposal. uint64 proposal_id = 1; @@ -309,9 +324,11 @@ message Vote { // option is the voter's choice on the proposal. VoteOption option = 3; - // metadata is any arbitrary metadata to attached to the vote. + // metadata is any arbitrary metadata attached to the vote. + // the recommended format of the metadata is to be found here: https://docs.cosmos.network/v0.47/modules/group#vote-2 string metadata = 4; // submit_time is the timestamp when the vote was submitted. - google.protobuf.Timestamp submit_time = 5 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + google.protobuf.Timestamp submit_time = 5 + [(gogoproto.nullable) = false, (amino.dont_omitempty) = true, (gogoproto.stdtime) = true]; } diff --git a/packages/api/proto/cosmos/mint/module/v1/module.proto b/packages/api/proto/cosmos/mint/module/v1/module.proto new file mode 100644 index 00000000..2ea1ef3d --- /dev/null +++ b/packages/api/proto/cosmos/mint/module/v1/module.proto @@ -0,0 +1,17 @@ +syntax = "proto3"; + +package cosmos.mint.module.v1; + +import "cosmos/app/v1alpha1/module.proto"; + +// Module is the config object of the mint module. +message Module { + option (cosmos.app.v1alpha1.module) = { + go_import: "github.com/cosmos/cosmos-sdk/x/mint" + }; + + string fee_collector_name = 1; + + // authority defines the custom module authority. If not set, defaults to the governance module. + string authority = 2; +} \ No newline at end of file diff --git a/packages/api/proto/cosmos/mint/v1beta1/genesis.proto b/packages/api/proto/cosmos/mint/v1beta1/genesis.proto index 4e783fb5..b6cc1504 100644 --- a/packages/api/proto/cosmos/mint/v1beta1/genesis.proto +++ b/packages/api/proto/cosmos/mint/v1beta1/genesis.proto @@ -3,14 +3,15 @@ package cosmos.mint.v1beta1; import "gogoproto/gogo.proto"; import "cosmos/mint/v1beta1/mint.proto"; +import "amino/amino.proto"; option go_package = "github.com/cosmos/cosmos-sdk/x/mint/types"; // GenesisState defines the mint module's genesis state. message GenesisState { // minter is a space for holding current inflation information. - Minter minter = 1 [(gogoproto.nullable) = false]; + Minter minter = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; - // params defines all the paramaters of the module. - Params params = 2 [(gogoproto.nullable) = false]; + // params defines all the parameters of the module. + Params params = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } diff --git a/packages/api/proto/cosmos/mint/v1beta1/mint.proto b/packages/api/proto/cosmos/mint/v1beta1/mint.proto index 9cfe2b76..440a392d 100644 --- a/packages/api/proto/cosmos/mint/v1beta1/mint.proto +++ b/packages/api/proto/cosmos/mint/v1beta1/mint.proto @@ -5,52 +5,57 @@ option go_package = "github.com/cosmos/cosmos-sdk/x/mint/types"; import "gogoproto/gogo.proto"; import "cosmos_proto/cosmos.proto"; +import "amino/amino.proto"; // Minter represents the minting state. message Minter { // current annual inflation rate string inflation = 1 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; // current annual expected provisions string annual_provisions = 2 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; } -// Params holds parameters for the mint module. +// Params defines the parameters for the x/mint module. message Params { - option (gogoproto.goproto_stringer) = false; + option (amino.name) = "cosmos-sdk/x/mint/Params"; // type of coin to mint string mint_denom = 1; // maximum annual change in inflation rate string inflation_rate_change = 2 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true ]; // maximum inflation rate string inflation_max = 3 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true ]; // minimum inflation rate string inflation_min = 4 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true ]; // goal of percent bonded atoms string goal_bonded = 5 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true ]; // expected blocks per year uint64 blocks_per_year = 6; diff --git a/packages/api/proto/cosmos/mint/v1beta1/query.proto b/packages/api/proto/cosmos/mint/v1beta1/query.proto index acd341d7..db5c90fb 100644 --- a/packages/api/proto/cosmos/mint/v1beta1/query.proto +++ b/packages/api/proto/cosmos/mint/v1beta1/query.proto @@ -4,6 +4,8 @@ package cosmos.mint.v1beta1; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; import "cosmos/mint/v1beta1/mint.proto"; +import "amino/amino.proto"; +import "cosmos_proto/cosmos.proto"; option go_package = "github.com/cosmos/cosmos-sdk/x/mint/types"; @@ -31,7 +33,7 @@ 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 [(gogoproto.nullable) = false]; + Params params = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // QueryInflationRequest is the request type for the Query/Inflation RPC method. @@ -41,7 +43,12 @@ message QueryInflationRequest {} // method. message QueryInflationResponse { // inflation is the current minting inflation value. - bytes inflation = 1 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; + bytes inflation = 1 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; } // QueryAnnualProvisionsRequest is the request type for the @@ -52,6 +59,10 @@ message QueryAnnualProvisionsRequest {} // Query/AnnualProvisions RPC method. message QueryAnnualProvisionsResponse { // annual_provisions is the current minting annual provisions value. - bytes annual_provisions = 1 - [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; + bytes annual_provisions = 1 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; } diff --git a/packages/api/proto/cosmos/mint/v1beta1/tx.proto b/packages/api/proto/cosmos/mint/v1beta1/tx.proto new file mode 100644 index 00000000..dc7b280f --- /dev/null +++ b/packages/api/proto/cosmos/mint/v1beta1/tx.proto @@ -0,0 +1,42 @@ +syntax = "proto3"; +package cosmos.mint.v1beta1; + +option go_package = "github.com/cosmos/cosmos-sdk/x/mint/types"; + +import "cosmos/msg/v1/msg.proto"; +import "amino/amino.proto"; +import "cosmos/mint/v1beta1/mint.proto"; +import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; + +// Msg defines the x/mint Msg service. +service Msg { + option (cosmos.msg.v1.service) = true; + + // UpdateParams defines a governance operation for updating the x/mint module + // parameters. The authority is defaults to the x/gov module account. + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse) { + option (cosmos_proto.method_added_in) = "cosmos-sdk 0.47"; + }; +} + +// MsgUpdateParams is the Msg/UpdateParams request type. +message MsgUpdateParams { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.47"; + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "cosmos-sdk/x/mint/MsgUpdateParams"; + + // authority is the address that controls the module (defaults to x/gov unless overwritten). + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // params defines the x/mint parameters to update. + // + // NOTE: All parameters must be supplied. + Params params = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +message MsgUpdateParamsResponse { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.47"; +} diff --git a/packages/api/proto/cosmos/msg/textual/v1/textual.proto b/packages/api/proto/cosmos/msg/textual/v1/textual.proto new file mode 100644 index 00000000..4f8cd141 --- /dev/null +++ b/packages/api/proto/cosmos/msg/textual/v1/textual.proto @@ -0,0 +1,18 @@ +syntax = "proto3"; + +package cosmos.msg.textual.v1; + +import "google/protobuf/descriptor.proto"; + +extend google.protobuf.MessageOptions { + // expert_custom_renderer is an informative identifier to reference the + // algorithm used to generate the custom textual representation of the + // protobuf message where this annotation is applied. We recommend to use a + // short, versioned name as this identifier, e.g. "replace_with_username_v1". + // We also recommand providing a human-readable description as protobuf + // comments on this annotation, for example a short specification or a link + // to the relevant documentation. + // + // Also see the section on Custom Message Renderers in ADR-050. + string expert_custom_renderer = 11110009; +} diff --git a/packages/api/proto/cosmos/msg/v1/msg.proto b/packages/api/proto/cosmos/msg/v1/msg.proto index 89bdf312..853efa1f 100644 --- a/packages/api/proto/cosmos/msg/v1/msg.proto +++ b/packages/api/proto/cosmos/msg/v1/msg.proto @@ -8,6 +8,14 @@ import "google/protobuf/descriptor.proto"; // We need this right now because gogoproto codegen needs to import the extension. option go_package = "github.com/cosmos/cosmos-sdk/types/msgservice"; +extend google.protobuf.ServiceOptions { + // service indicates that the service is a Msg service and that requests + // must be transported via blockchain transactions rather than gRPC. + // Tooling can use this annotation to distinguish between Msg services and + // other types of services via reflection. + bool service = 11110000; +} + extend google.protobuf.MessageOptions { // signer must be used in cosmos messages in order // to signal to external clients which fields in a @@ -19,4 +27,4 @@ extend google.protobuf.MessageOptions { // kind in case the signer information is contained within // a message inside the cosmos message. repeated string signer = 11110000; -} \ No newline at end of file +} diff --git a/packages/api/proto/cosmos/nft/module/v1/module.proto b/packages/api/proto/cosmos/nft/module/v1/module.proto new file mode 100644 index 00000000..a5c2c634 --- /dev/null +++ b/packages/api/proto/cosmos/nft/module/v1/module.proto @@ -0,0 +1,12 @@ +syntax = "proto3"; + +package cosmos.nft.module.v1; + +import "cosmos/app/v1alpha1/module.proto"; + +// Module is the config object of the nft module. +message Module { + option (cosmos.app.v1alpha1.module) = { + go_import: "cosmossdk.io/x/nft" + }; +} \ No newline at end of file diff --git a/packages/api/proto/cosmos/nft/v1beta1/event.proto b/packages/api/proto/cosmos/nft/v1beta1/event.proto index 96964f08..d2cb29d2 100644 --- a/packages/api/proto/cosmos/nft/v1beta1/event.proto +++ b/packages/api/proto/cosmos/nft/v1beta1/event.proto @@ -1,26 +1,43 @@ syntax = "proto3"; package cosmos.nft.v1beta1; -option go_package = "github.com/cosmos/cosmos-sdk/x/nft"; +option go_package = "cosmossdk.io/x/nft"; // EventSend is emitted on Msg/Send message EventSend { + // class_id associated with the nft string class_id = 1; - string id = 2; - string sender = 3; + + // id is a unique identifier of the nft + string id = 2; + + // sender is the address of the owner of nft + string sender = 3; + + // receiver is the receiver address of nft string receiver = 4; } // EventMint is emitted on Mint message EventMint { + // class_id associated with the nft string class_id = 1; - string id = 2; - string owner = 3; + + // id is a unique identifier of the nft + string id = 2; + + // owner is the owner address of the nft + string owner = 3; } // EventBurn is emitted on Burn message EventBurn { + // class_id associated with the nft string class_id = 1; - string id = 2; - string owner = 3; + + // id is a unique identifier of the nft + string id = 2; + + // owner is the owner address of the nft + string owner = 3; } diff --git a/packages/api/proto/cosmos/nft/v1beta1/genesis.proto b/packages/api/proto/cosmos/nft/v1beta1/genesis.proto index 6f36ed34..441b48b1 100644 --- a/packages/api/proto/cosmos/nft/v1beta1/genesis.proto +++ b/packages/api/proto/cosmos/nft/v1beta1/genesis.proto @@ -3,13 +3,15 @@ package cosmos.nft.v1beta1; import "cosmos/nft/v1beta1/nft.proto"; -option go_package = "github.com/cosmos/cosmos-sdk/x/nft"; +option go_package = "cosmossdk.io/x/nft"; // GenesisState defines the nft module's genesis state. message GenesisState { // class defines the class of the nft type. repeated cosmos.nft.v1beta1.Class classes = 1; - repeated Entry entries = 2; + + // entry defines all nft owned by a person. + repeated Entry entries = 2; } // Entry Defines all nft owned by a person diff --git a/packages/api/proto/cosmos/nft/v1beta1/nft.proto b/packages/api/proto/cosmos/nft/v1beta1/nft.proto index b1241260..4234bd42 100644 --- a/packages/api/proto/cosmos/nft/v1beta1/nft.proto +++ b/packages/api/proto/cosmos/nft/v1beta1/nft.proto @@ -3,7 +3,7 @@ package cosmos.nft.v1beta1; import "google/protobuf/any.proto"; -option go_package = "github.com/cosmos/cosmos-sdk/x/nft"; +option go_package = "cosmossdk.io/x/nft"; // Class defines the class of the nft type. message Class { diff --git a/packages/api/proto/cosmos/nft/v1beta1/query.proto b/packages/api/proto/cosmos/nft/v1beta1/query.proto index c1d8070f..bdc794ff 100644 --- a/packages/api/proto/cosmos/nft/v1beta1/query.proto +++ b/packages/api/proto/cosmos/nft/v1beta1/query.proto @@ -5,7 +5,7 @@ import "cosmos/base/query/v1beta1/pagination.proto"; import "google/api/annotations.proto"; import "cosmos/nft/v1beta1/nft.proto"; -option go_package = "github.com/cosmos/cosmos-sdk/x/nft"; +option go_package = "cosmossdk.io/x/nft"; // Query defines the gRPC querier service. service Query { @@ -48,67 +48,91 @@ service Query { // QueryBalanceRequest is the request type for the Query/Balance RPC method message QueryBalanceRequest { + // class_id associated with the nft string class_id = 1; - string owner = 2; + + // owner is the owner address of the nft + string owner = 2; } // QueryBalanceResponse is the response type for the Query/Balance RPC method message QueryBalanceResponse { + // amount is the number of all NFTs of a given class owned by the owner uint64 amount = 1; } // QueryOwnerRequest is the request type for the Query/Owner RPC method message QueryOwnerRequest { + // class_id associated with the nft string class_id = 1; - string id = 2; + + // id is a unique identifier of the NFT + string id = 2; } // QueryOwnerResponse is the response type for the Query/Owner RPC method message QueryOwnerResponse { + // owner is the owner address of the nft string owner = 1; } // QuerySupplyRequest is the request type for the Query/Supply RPC method message QuerySupplyRequest { + // class_id associated with the nft string class_id = 1; } // QuerySupplyResponse is the response type for the Query/Supply RPC method message QuerySupplyResponse { + // amount is the number of all NFTs from the given class uint64 amount = 1; } // QueryNFTstRequest is the request type for the Query/NFTs RPC method message QueryNFTsRequest { - string class_id = 1; - string owner = 2; + // class_id associated with the nft + string class_id = 1; + + // owner is the owner address of the nft + string owner = 2; + + // pagination defines an optional pagination for the request. cosmos.base.query.v1beta1.PageRequest pagination = 3; } // QueryNFTsResponse is the response type for the Query/NFTs RPC methods message QueryNFTsResponse { - repeated cosmos.nft.v1beta1.NFT nfts = 1; + // NFT defines the NFT + repeated cosmos.nft.v1beta1.NFT nfts = 1; + + // pagination defines the pagination in the response. cosmos.base.query.v1beta1.PageResponse pagination = 2; } // QueryNFTRequest is the request type for the Query/NFT RPC method message QueryNFTRequest { + // class_id associated with the nft string class_id = 1; - string id = 2; + + // id is a unique identifier of the NFT + string id = 2; } // QueryNFTResponse is the response type for the Query/NFT RPC method message QueryNFTResponse { + // owner is the owner address of the nft cosmos.nft.v1beta1.NFT nft = 1; } // QueryClassRequest is the request type for the Query/Class RPC method message QueryClassRequest { + // class_id associated with the nft string class_id = 1; } // QueryClassResponse is the response type for the Query/Class RPC method message QueryClassResponse { + // class defines the class of the nft type. cosmos.nft.v1beta1.Class class = 1; } @@ -120,6 +144,9 @@ message QueryClassesRequest { // QueryClassesResponse is the response type for the Query/Classes RPC method message QueryClassesResponse { - repeated cosmos.nft.v1beta1.Class classes = 1; + // class defines the class of the nft type. + repeated cosmos.nft.v1beta1.Class classes = 1; + + // pagination defines the pagination in the response. cosmos.base.query.v1beta1.PageResponse pagination = 2; } diff --git a/packages/api/proto/cosmos/nft/v1beta1/tx.proto b/packages/api/proto/cosmos/nft/v1beta1/tx.proto index 95b402ce..9eecfdd2 100644 --- a/packages/api/proto/cosmos/nft/v1beta1/tx.proto +++ b/packages/api/proto/cosmos/nft/v1beta1/tx.proto @@ -1,15 +1,19 @@ syntax = "proto3"; package cosmos.nft.v1beta1; -option go_package = "github.com/cosmos/cosmos-sdk/x/nft"; +option go_package = "cosmossdk.io/x/nft"; +import "cosmos_proto/cosmos.proto"; import "cosmos/msg/v1/msg.proto"; // Msg defines the nft Msg service. service Msg { + option (cosmos.msg.v1.service) = true; + // Send defines a method to send a nft from one account to another account. rpc Send(MsgSend) returns (MsgSendResponse); } + // MsgSend represents a message to send a nft from one account to another account. message MsgSend { option (cosmos.msg.v1.signer) = "sender"; @@ -21,10 +25,10 @@ message MsgSend { string id = 2; // sender is the address of the owner of nft - string sender = 3; + string sender = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // receiver is the receiver address of nft - string receiver = 4; + string receiver = 4 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } // MsgSendResponse defines the Msg/Send response type. message MsgSendResponse {} \ No newline at end of file diff --git a/packages/api/proto/cosmos/params/module/v1/module.proto b/packages/api/proto/cosmos/params/module/v1/module.proto new file mode 100644 index 00000000..75e7f995 --- /dev/null +++ b/packages/api/proto/cosmos/params/module/v1/module.proto @@ -0,0 +1,12 @@ +syntax = "proto3"; + +package cosmos.params.module.v1; + +import "cosmos/app/v1alpha1/module.proto"; + +// Module is the config object of the params module. +message Module { + option (cosmos.app.v1alpha1.module) = { + go_import: "github.com/cosmos/cosmos-sdk/x/params" + }; +} diff --git a/packages/api/proto/cosmos/params/v1beta1/params.proto b/packages/api/proto/cosmos/params/v1beta1/params.proto index da23e1a9..c8efa131 100644 --- a/packages/api/proto/cosmos/params/v1beta1/params.proto +++ b/packages/api/proto/cosmos/params/v1beta1/params.proto @@ -6,23 +6,22 @@ option (gogoproto.equal_all) = true; import "gogoproto/gogo.proto"; import "cosmos_proto/cosmos.proto"; +import "amino/amino.proto"; // ParameterChangeProposal defines a proposal to change one or more parameters. message ParameterChangeProposal { option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = false; option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content"; + option (amino.name) = "cosmos-sdk/ParameterChangeProposal"; string title = 1; string description = 2; - repeated ParamChange changes = 3 [(gogoproto.nullable) = false]; + repeated ParamChange changes = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // ParamChange defines an individual parameter change, for use in // ParameterChangeProposal. message ParamChange { - option (gogoproto.goproto_stringer) = false; - string subspace = 1; string key = 2; string value = 3; diff --git a/packages/api/proto/cosmos/params/v1beta1/query.proto b/packages/api/proto/cosmos/params/v1beta1/query.proto index 97d0a71d..e8f3bf15 100644 --- a/packages/api/proto/cosmos/params/v1beta1/query.proto +++ b/packages/api/proto/cosmos/params/v1beta1/query.proto @@ -4,6 +4,8 @@ package cosmos.params.v1beta1; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; import "cosmos/params/v1beta1/params.proto"; +import "amino/amino.proto"; +import "cosmos_proto/cosmos.proto"; option go_package = "github.com/cosmos/cosmos-sdk/x/params/types/proposal"; @@ -16,10 +18,9 @@ service Query { } // Subspaces queries for all registered subspaces and all keys for a subspace. - // - // Since: cosmos-sdk 0.46 rpc Subspaces(QuerySubspacesRequest) returns (QuerySubspacesResponse) { - option (google.api.http).get = "/cosmos/params/v1beta1/subspaces"; + option (cosmos_proto.method_added_in) = "cosmos-sdk 0.46"; + option (google.api.http).get = "/cosmos/params/v1beta1/subspaces"; } } @@ -35,28 +36,26 @@ message QueryParamsRequest { // QueryParamsResponse is response type for the Query/Params RPC method. message QueryParamsResponse { // param defines the queried parameter. - ParamChange param = 1 [(gogoproto.nullable) = false]; + ParamChange param = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // QuerySubspacesRequest defines a request type for querying for all registered // subspaces and all keys for a subspace. -// -// Since: cosmos-sdk 0.46 -message QuerySubspacesRequest {} +message QuerySubspacesRequest { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.46"; +} // QuerySubspacesResponse defines the response types for querying for all // registered subspaces and all keys for a subspace. -// -// Since: cosmos-sdk 0.46 message QuerySubspacesResponse { - repeated Subspace subspaces = 1; + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.46"; + repeated Subspace subspaces = 1; } // Subspace defines a parameter subspace name and all the keys that exist for // the subspace. -// -// Since: cosmos-sdk 0.46 message Subspace { - string subspace = 1; - repeated string keys = 2; + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.46"; + string subspace = 1; + repeated string keys = 2; } diff --git a/packages/api/proto/cosmos/protocolpool/module/v1/module.proto b/packages/api/proto/cosmos/protocolpool/module/v1/module.proto new file mode 100644 index 00000000..5e3053c5 --- /dev/null +++ b/packages/api/proto/cosmos/protocolpool/module/v1/module.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; + +package cosmos.protocolpool.module.v1; + +import "cosmos/app/v1alpha1/module.proto"; + +// Module is the config object of the consensus module. +message Module { + option (cosmos.app.v1alpha1.module) = { + go_import: "github.com/cosmos/cosmos-sdk/x/protocolpool" + }; + + // authority defines the custom module authority. If not set, defaults to the governance module. + string authority = 1; +} \ No newline at end of file diff --git a/packages/api/proto/cosmos/protocolpool/v1/genesis.proto b/packages/api/proto/cosmos/protocolpool/v1/genesis.proto new file mode 100644 index 00000000..232fba67 --- /dev/null +++ b/packages/api/proto/cosmos/protocolpool/v1/genesis.proto @@ -0,0 +1,17 @@ +syntax = "proto3"; +package cosmos.protocolpool.v1; + +option go_package = "github.com/cosmos/cosmos-sdk/x/protocolpool/types"; + +import "cosmos/protocolpool/v1/types.proto"; +import "gogoproto/gogo.proto"; + +// GenesisState defines the protocolpool module's genesis state. +message GenesisState { + // ContinuousFunds defines the continuous funds at genesis. + repeated ContinuousFund continuous_funds = 1 [(gogoproto.nullable) = false]; + + // Params defines the parameters of this module, currently only contains the + // denoms that will be used for continuous fund distributions. + Params params = 2 [(gogoproto.nullable) = false]; +} diff --git a/packages/api/proto/cosmos/protocolpool/v1/query.proto b/packages/api/proto/cosmos/protocolpool/v1/query.proto new file mode 100644 index 00000000..6605697c --- /dev/null +++ b/packages/api/proto/cosmos/protocolpool/v1/query.proto @@ -0,0 +1,78 @@ +syntax = "proto3"; +package cosmos.protocolpool.v1; + +option go_package = "github.com/cosmos/cosmos-sdk/x/protocolpool/types"; + +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "cosmos_proto/cosmos.proto"; +import "cosmos/protocolpool/v1/types.proto"; + +// Query defines the gRPC querier service for community pool module. +service Query { + // CommunityPool queries the community pool coins. + rpc CommunityPool(QueryCommunityPoolRequest) returns (QueryCommunityPoolResponse) { + option (google.api.http).get = "/cosmos/protocolpool/v1/community_pool"; + } + + // ContinuousFund queries a continuous fund by the recipient is is associated with. + rpc ContinuousFund(QueryContinuousFundRequest) returns (QueryContinuousFundResponse) { + option (google.api.http).get = "/cosmos/protocolpool/v1/continuous_funds/{recipient}"; + } + + // ContinuousFunds queries all continuous funds in the store. + rpc ContinuousFunds(QueryContinuousFundsRequest) returns (QueryContinuousFundsResponse) { + option (google.api.http).get = "/cosmos/protocolpool/v1/continuous_funds"; + } + + // Params returns the total set of x/protocolpool parameters. + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/cosmos/protocolpool/v1/params"; + } +} + +// QueryCommunityPoolRequest is the request type for the Query/CommunityPool RPC +// method. +message QueryCommunityPoolRequest {} + +// QueryCommunityPoolResponse is the response type for the Query/CommunityPool +// RPC method. +message QueryCommunityPoolResponse { + // pool defines community pool's coins. + repeated cosmos.base.v1beta1.Coin pool = 1 + [(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", (gogoproto.nullable) = false]; +} + +// QueryContinuousFundRequest is the request type for the Query/ContinuousFund +// RPC method. +message QueryContinuousFundRequest { + // recipient is the recipient address to query unclaimed budget amount for. + string recipient = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; +} + +// QueryUnclaimedBudgetResponse is the response type for the Query/ContinuousFund +// RPC method. +message QueryContinuousFundResponse { + // ContinuousFunds is the given continuous fund returned in the query. + ContinuousFund continuous_fund = 1 [(gogoproto.nullable) = false]; +} + +// QueryContinuousFundRequest is the request type for the Query/ContinuousFunds +// RPC method. +message QueryContinuousFundsRequest {} + +// QueryUnclaimedBudgetResponse is the response type for the Query/ContinuousFunds +// RPC method. +message QueryContinuousFundsResponse { + // ContinuousFunds defines all continuous funds in state. + repeated ContinuousFund continuous_funds = 1 [(gogoproto.nullable) = false]; +} + +// QueryParamsRequest is the response type for the Query/Params RPC method. +message QueryParamsRequest {} + +// QueryParamsResponse is the response type for the Query/Params RPC method. +message QueryParamsResponse { + Params params = 1 [(gogoproto.nullable) = false]; +} \ No newline at end of file diff --git a/packages/api/proto/cosmos/protocolpool/v1/tx.proto b/packages/api/proto/cosmos/protocolpool/v1/tx.proto new file mode 100644 index 00000000..a344de74 --- /dev/null +++ b/packages/api/proto/cosmos/protocolpool/v1/tx.proto @@ -0,0 +1,132 @@ +syntax = "proto3"; +package cosmos.protocolpool.v1; + +option go_package = "github.com/cosmos/cosmos-sdk/x/protocolpool/types"; + +import "cosmos/protocolpool/v1/types.proto"; +import "gogoproto/gogo.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "cosmos_proto/cosmos.proto"; +import "cosmos/msg/v1/msg.proto"; +import "google/protobuf/timestamp.proto"; + +// Msg defines the pool Msg service. +service Msg { + option (cosmos.msg.v1.service) = true; + + // FundCommunityPool defines a method to allow an account to directly + // fund the community pool. + rpc FundCommunityPool(MsgFundCommunityPool) returns (MsgFundCommunityPoolResponse); + + // CommunityPoolSpend defines a governance operation for sending tokens from + // the community pool in the x/protocolpool module to another account, which + // could be the governance module itself. The authority is defined in the + // keeper. + rpc CommunityPoolSpend(MsgCommunityPoolSpend) returns (MsgCommunityPoolSpendResponse); + + // CreateContinuousFund defines a method to distribute a percentage of funds to an address continuously. + // This ContinuousFund can be indefinite or run until a given expiry time. + // Funds come from validator block rewards from x/distribution, but may also come from + // any user who funds the ProtocolPoolEscrow module account directly through x/bank. + rpc CreateContinuousFund(MsgCreateContinuousFund) returns (MsgCreateContinuousFundResponse); + + // CancelContinuousFund defines a method for cancelling continuous fund. + rpc CancelContinuousFund(MsgCancelContinuousFund) returns (MsgCancelContinuousFundResponse); + + // UpdateParams defines a governance operation for updating the x/protocolpool module parameters. + // The authority is defined in the keeper. + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); +} + +// MsgFundCommunityPool allows an account to directly +// fund the community pool. +message MsgFundCommunityPool { + option (cosmos.msg.v1.signer) = "depositor"; + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string depositor = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + repeated cosmos.base.v1beta1.Coin amount = 2 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; +} + +// MsgFundCommunityPoolResponse defines the Msg/FundCommunityPool response type. +message MsgFundCommunityPoolResponse {} + +// MsgCommunityPoolSpend defines a message for sending tokens from the community +// pool to another account. This message is typically executed via a governance +// proposal with the governance module being the executing authority. +message MsgCommunityPoolSpend { + option (cosmos.msg.v1.signer) = "authority"; + + // Authority is the address that controls the module (defaults to x/gov unless overwritten). + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string recipient = 2; + repeated cosmos.base.v1beta1.Coin amount = 3 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; +} + +// MsgCommunityPoolSpendResponse defines the response to executing a +// MsgCommunityPoolSpend message. +message MsgCommunityPoolSpendResponse {} + +// MsgCreateContinuousFund defines a message for adding continuous funds. +message MsgCreateContinuousFund { + option (cosmos.msg.v1.signer) = "authority"; + + // Authority is the address that controls the module (defaults to x/gov unless overwritten). + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // Recipient address of the account receiving funds. + string recipient = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // Percentage is the percentage of funds to be allocated from Community pool. + string percentage = 3 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; + // Optional, if expiry is set, removes the state object when expired. + google.protobuf.Timestamp expiry = 4 [(gogoproto.stdtime) = true]; +} + +// MsgCreateContinuousFundResponse defines the response to executing a +// MsgCreateContinuousFund message. +message MsgCreateContinuousFundResponse {} + +// MsgCancelContinuousFund defines a message to cancel continuous funds for a specific recipient. +message MsgCancelContinuousFund { + option (cosmos.msg.v1.signer) = "authority"; + + // Authority is the account address of authority. + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // Recipient is the account address string of the recipient whose funds are to be cancelled. + string recipient = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; +} + +// MsgCancelContinuousFundResponse defines the response to executing a +// MsgCancelContinuousFund message. +message MsgCancelContinuousFundResponse { + // CanceledTime is the canceled time. + google.protobuf.Timestamp canceled_time = 1 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; + // CanceledHeight defines the canceled block height. + uint64 canceled_height = 2; + // Recipient is the account address string of the recipient whose funds are cancelled. + string recipient = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; +} + +// MsgUpdateParams is the Msg/UpdateParams request type. +message MsgUpdateParams { + option (cosmos.msg.v1.signer) = "authority"; + + // authority is the address that controls the module (defaults to x/gov unless overwritten). + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // params defines the x/protocolpool parameters to update. + // + // NOTE: All parameters must be supplied. + Params params = 2 [(gogoproto.nullable) = false]; +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +message MsgUpdateParamsResponse {} \ No newline at end of file diff --git a/packages/api/proto/cosmos/protocolpool/v1/types.proto b/packages/api/proto/cosmos/protocolpool/v1/types.proto new file mode 100644 index 00000000..0f40ead5 --- /dev/null +++ b/packages/api/proto/cosmos/protocolpool/v1/types.proto @@ -0,0 +1,33 @@ +syntax = "proto3"; +package cosmos.protocolpool.v1; + +option go_package = "github.com/cosmos/cosmos-sdk/x/protocolpool/types"; + +import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; +import "google/protobuf/timestamp.proto"; + +// ContinuousFund defines the fields of continuous fund proposal. +message ContinuousFund { + // Recipient is the address string of the account receiving funds. + string recipient = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // Percentage is the percentage of funds to be allocated from Community pool. + string percentage = 2 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; + // Optional, if expiry is set, removes the state object when expired. + google.protobuf.Timestamp expiry = 3 [(gogoproto.stdtime) = true]; +} + +// Params defines the parameters for the protocolpool module. +message Params { + // EnabledDistributionDenoms lists the denoms that are allowed to be distributed. + // This is to avoid spending time distributing undesired tokens to continuous funds and budgets. + repeated string enabled_distribution_denoms = 1; + + // DistributionFrequency is the frequency (in terms of blocks) that funds are distributed out from the + // x/protocolpool module. + uint64 distribution_frequency = 2; +} diff --git a/packages/api/proto/cosmos/query/v1/query.proto b/packages/api/proto/cosmos/query/v1/query.proto new file mode 100644 index 00000000..e42e73d7 --- /dev/null +++ b/packages/api/proto/cosmos/query/v1/query.proto @@ -0,0 +1,35 @@ +syntax = "proto3"; + +package cosmos.query.v1; + +import "google/protobuf/descriptor.proto"; + +// TODO: once we fully migrate to protov2 the go_package needs to be updated. +// We need this right now because gogoproto codegen needs to import the extension. +option go_package = "github.com/cosmos/cosmos-sdk/types/query"; + +extend google.protobuf.MethodOptions { + // module_query_safe is set to true when the query is safe to be called from + // within the state machine, for example from another module's Keeper, via + // ADR-033 calls or from CosmWasm contracts. + // Concretely, it means that the query is: + // 1. deterministic: given a block height, returns the exact same response + // upon multiple calls; and doesn't introduce any state-machine-breaking + // changes across SDK patch version. + // 2. consumes gas correctly. + // + // If you are a module developer and want to add this annotation to one of + // your own queries, please make sure that the corresponding query: + // 1. is deterministic and won't introduce state-machine-breaking changes + // without a coordinated upgrade path, + // 2. has its gas tracked, to avoid the attack vector where no gas is + // accounted for on potentially high-computation queries. + // + // For queries that potentially consume a large amount of gas (for example + // those with pagination, if the pagination field is incorrectly set), we + // also recommend adding Protobuf comments to warn module developers + // consuming these queries. + // + // When set to true, the query can safely be called + bool module_query_safe = 11110001; +} \ No newline at end of file diff --git a/packages/api/proto/cosmos/reflection/v1/reflection.proto b/packages/api/proto/cosmos/reflection/v1/reflection.proto new file mode 100644 index 00000000..1f575b83 --- /dev/null +++ b/packages/api/proto/cosmos/reflection/v1/reflection.proto @@ -0,0 +1,27 @@ +syntax = "proto3"; + +package cosmos.reflection.v1; + +import "google/protobuf/descriptor.proto"; +import "cosmos/query/v1/query.proto"; + +// Package cosmos.reflection.v1 provides support for inspecting protobuf +// file descriptors. +service ReflectionService { + // FileDescriptors queries all the file descriptors in the app in order + // to enable easier generation of dynamic clients. + rpc FileDescriptors(FileDescriptorsRequest) returns (FileDescriptorsResponse) { + // NOTE: file descriptors SHOULD NOT be part of consensus because they + // include changes to doc commands and module_query_safe should be kept as false. + option (cosmos.query.v1.module_query_safe) = false; + } +} + +// FileDescriptorsRequest is the Query/FileDescriptors request type. +message FileDescriptorsRequest {} + +// FileDescriptorsResponse is the Query/FileDescriptors response type. +message FileDescriptorsResponse { + // files is the file descriptors. + repeated google.protobuf.FileDescriptorProto files = 1; +} diff --git a/packages/api/proto/cosmos/slashing/module/v1/module.proto b/packages/api/proto/cosmos/slashing/module/v1/module.proto new file mode 100644 index 00000000..52433075 --- /dev/null +++ b/packages/api/proto/cosmos/slashing/module/v1/module.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; + +package cosmos.slashing.module.v1; + +import "cosmos/app/v1alpha1/module.proto"; + +// Module is the config object of the slashing module. +message Module { + option (cosmos.app.v1alpha1.module) = { + go_import: "github.com/cosmos/cosmos-sdk/x/slashing" + }; + + // authority defines the custom module authority. If not set, defaults to the governance module. + string authority = 1; +} diff --git a/packages/api/proto/cosmos/slashing/v1beta1/genesis.proto b/packages/api/proto/cosmos/slashing/v1beta1/genesis.proto index 312d56aa..a2f516bb 100644 --- a/packages/api/proto/cosmos/slashing/v1beta1/genesis.proto +++ b/packages/api/proto/cosmos/slashing/v1beta1/genesis.proto @@ -6,36 +6,37 @@ option go_package = "github.com/cosmos/cosmos-sdk/x/slashing/types"; import "gogoproto/gogo.proto"; import "cosmos/slashing/v1beta1/slashing.proto"; import "cosmos_proto/cosmos.proto"; +import "amino/amino.proto"; // GenesisState defines the slashing module's genesis state. message GenesisState { - // params defines all the paramaters of related to deposit. - Params params = 1 [(gogoproto.nullable) = false]; + // params defines all the parameters of the module. + Params params = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // signing_infos represents a map between validator addresses and their // signing infos. - repeated SigningInfo signing_infos = 2 [(gogoproto.nullable) = false]; + repeated SigningInfo signing_infos = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // missed_blocks represents a map between validator addresses and their // missed blocks. - repeated ValidatorMissedBlocks missed_blocks = 3 [(gogoproto.nullable) = false]; + repeated ValidatorMissedBlocks missed_blocks = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // SigningInfo stores validator signing info of corresponding address. message SigningInfo { // address is the validator address. - string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string address = 1 [(cosmos_proto.scalar) = "cosmos.ConsensusAddressString"]; // validator_signing_info represents the signing info of this validator. - ValidatorSigningInfo validator_signing_info = 2 [(gogoproto.nullable) = false]; + ValidatorSigningInfo validator_signing_info = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // ValidatorMissedBlocks contains array of missed blocks of corresponding // address. message ValidatorMissedBlocks { // address is the validator address. - string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string address = 1 [(cosmos_proto.scalar) = "cosmos.ConsensusAddressString"]; // missed_blocks is an array of missed blocks by the validator. - repeated MissedBlock missed_blocks = 2 [(gogoproto.nullable) = false]; + repeated MissedBlock missed_blocks = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // MissedBlock contains height and missed status as boolean. diff --git a/packages/api/proto/cosmos/slashing/v1beta1/query.proto b/packages/api/proto/cosmos/slashing/v1beta1/query.proto index f742c1f8..e7279709 100644 --- a/packages/api/proto/cosmos/slashing/v1beta1/query.proto +++ b/packages/api/proto/cosmos/slashing/v1beta1/query.proto @@ -6,6 +6,7 @@ import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; import "cosmos/slashing/v1beta1/slashing.proto"; import "cosmos_proto/cosmos.proto"; +import "amino/amino.proto"; option go_package = "github.com/cosmos/cosmos-sdk/x/slashing/types"; @@ -32,21 +33,21 @@ message QueryParamsRequest {} // QueryParamsResponse is the response type for the Query/Params RPC method message QueryParamsResponse { - Params params = 1 [(gogoproto.nullable) = false]; + Params params = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // QuerySigningInfoRequest is the request type for the Query/SigningInfo RPC // method message QuerySigningInfoRequest { // cons_address is the address to query signing info of - string cons_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string cons_address = 1 [(cosmos_proto.scalar) = "cosmos.ConsensusAddressString"]; } // QuerySigningInfoResponse is the response type for the Query/SigningInfo RPC // method message QuerySigningInfoResponse { // val_signing_info is the signing info of requested val cons address - ValidatorSigningInfo val_signing_info = 1 [(gogoproto.nullable) = false]; + ValidatorSigningInfo val_signing_info = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // QuerySigningInfosRequest is the request type for the Query/SigningInfos RPC @@ -59,6 +60,7 @@ message QuerySigningInfosRequest { // method message QuerySigningInfosResponse { // info is the signing info of all validators - repeated cosmos.slashing.v1beta1.ValidatorSigningInfo info = 1 [(gogoproto.nullable) = false]; - cosmos.base.query.v1beta1.PageResponse pagination = 2; + repeated cosmos.slashing.v1beta1.ValidatorSigningInfo info = 1 + [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; } diff --git a/packages/api/proto/cosmos/slashing/v1beta1/slashing.proto b/packages/api/proto/cosmos/slashing/v1beta1/slashing.proto index 0aa9f61f..2347f349 100644 --- a/packages/api/proto/cosmos/slashing/v1beta1/slashing.proto +++ b/packages/api/proto/cosmos/slashing/v1beta1/slashing.proto @@ -8,38 +8,55 @@ import "gogoproto/gogo.proto"; import "google/protobuf/duration.proto"; import "google/protobuf/timestamp.proto"; import "cosmos_proto/cosmos.proto"; +import "amino/amino.proto"; // ValidatorSigningInfo defines a validator's signing info for monitoring their // liveness activity. message ValidatorSigningInfo { - option (gogoproto.equal) = true; - option (gogoproto.goproto_stringer) = false; + option (gogoproto.equal) = true; - string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - // Height at which validator was first a candidate OR was unjailed + string address = 1 [(cosmos_proto.scalar) = "cosmos.ConsensusAddressString"]; + // Height at which validator was first a candidate OR was un-jailed int64 start_height = 2; - // Index which is incremented each time the validator was a bonded - // in a block and may have signed a precommit or not. This in conjunction with the - // `SignedBlocksWindow` param determines the index in the `MissedBlocksBitArray`. + // Index which is incremented every time a validator is bonded in a block and + // _may_ have signed a pre-commit or not. This in conjunction with the + // signed_blocks_window param determines the index in the missed block bitmap. int64 index_offset = 3; // Timestamp until which the validator is jailed due to liveness downtime. - google.protobuf.Timestamp jailed_until = 4 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; - // Whether or not a validator has been tombstoned (killed out of validator set). It is set - // once the validator commits an equivocation or for any other configured misbehiavor. + google.protobuf.Timestamp jailed_until = 4 + [(gogoproto.stdtime) = true, (gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + // Whether or not a validator has been tombstoned (killed out of validator + // set). It is set once the validator commits an equivocation or for any other + // configured misbehavior. bool tombstoned = 5; - // A counter kept to avoid unnecessary array reads. - // Note that `Sum(MissedBlocksBitArray)` always equals `MissedBlocksCounter`. + // A counter of missed (unsigned) blocks. It is used to avoid unnecessary + // reads in the missed block bitmap. int64 missed_blocks_counter = 6; } // Params represents the parameters used for by the slashing module. message Params { + option (amino.name) = "cosmos-sdk/x/slashing/Params"; + int64 signed_blocks_window = 1; - bytes min_signed_per_window = 2 - [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; - google.protobuf.Duration downtime_jail_duration = 3 [(gogoproto.nullable) = false, (gogoproto.stdduration) = true]; - bytes slash_fraction_double_sign = 4 - [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; - bytes slash_fraction_downtime = 5 - [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; + bytes min_signed_per_window = 2 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; + google.protobuf.Duration downtime_jail_duration = 3 + [(gogoproto.nullable) = false, (amino.dont_omitempty) = true, (gogoproto.stdduration) = true]; + bytes slash_fraction_double_sign = 4 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; + bytes slash_fraction_downtime = 5 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; } diff --git a/packages/api/proto/cosmos/slashing/v1beta1/tx.proto b/packages/api/proto/cosmos/slashing/v1beta1/tx.proto index 7c90304b..4b978887 100644 --- a/packages/api/proto/cosmos/slashing/v1beta1/tx.proto +++ b/packages/api/proto/cosmos/slashing/v1beta1/tx.proto @@ -5,26 +5,62 @@ option go_package = "github.com/cosmos/cosmos-sdk/x/slashing/types"; option (gogoproto.equal_all) = true; import "gogoproto/gogo.proto"; +import "cosmos/slashing/v1beta1/slashing.proto"; import "cosmos_proto/cosmos.proto"; import "cosmos/msg/v1/msg.proto"; +import "amino/amino.proto"; // Msg defines the slashing Msg service. service Msg { + option (cosmos.msg.v1.service) = true; + // Unjail defines a method for unjailing a jailed validator, thus returning // them into the bonded validator set, so they can begin receiving provisions // and rewards again. rpc Unjail(MsgUnjail) returns (MsgUnjailResponse); + + // UpdateParams defines a governance operation for updating the x/slashing module + // parameters. The authority defaults to the x/gov module account. + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse) { + option (cosmos_proto.method_added_in) = "cosmos-sdk 0.47"; + }; } // MsgUnjail defines the Msg/Unjail request type message MsgUnjail { option (cosmos.msg.v1.signer) = "validator_addr"; + option (amino.name) = "cosmos-sdk/MsgUnjail"; - option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = true; + option (gogoproto.goproto_getters) = false; - string validator_addr = 1 [(cosmos_proto.scalar) = "cosmos.AddressString", (gogoproto.jsontag) = "address"]; + string validator_addr = 1 [ + (cosmos_proto.scalar) = "cosmos.ValidatorAddressString", + (gogoproto.jsontag) = "address", + (amino.field_name) = "address", + (amino.dont_omitempty) = true + ]; } // MsgUnjailResponse defines the Msg/Unjail response type message MsgUnjailResponse {} + +// MsgUpdateParams is the Msg/UpdateParams request type. +message MsgUpdateParams { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.47"; + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "cosmos-sdk/x/slashing/MsgUpdateParams"; + + // authority is the address that controls the module (defaults to x/gov unless overwritten). + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // params defines the x/slashing parameters to update. + // + // NOTE: All parameters must be supplied. + Params params = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +message MsgUpdateParamsResponse { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.47"; +} diff --git a/packages/api/proto/cosmos/staking/module/v1/module.proto b/packages/api/proto/cosmos/staking/module/v1/module.proto new file mode 100644 index 00000000..fd92a548 --- /dev/null +++ b/packages/api/proto/cosmos/staking/module/v1/module.proto @@ -0,0 +1,26 @@ +syntax = "proto3"; + +package cosmos.staking.module.v1; + +import "cosmos/app/v1alpha1/module.proto"; + +// Module is the config object of the staking module. +message Module { + option (cosmos.app.v1alpha1.module) = { + go_import: "github.com/cosmos/cosmos-sdk/x/staking" + }; + + // hooks_order specifies the order of staking hooks and should be a list + // of module names which provide a staking hooks instance. If no order is + // provided, then hooks will be applied in alphabetical order of module names. + repeated string hooks_order = 1; + + // authority defines the custom module authority. If not set, defaults to the governance module. + string authority = 2; + + // bech32_prefix_validator is the bech32 validator prefix for the app. + string bech32_prefix_validator = 3; + + // bech32_prefix_consensus is the bech32 consensus node prefix for the app. + string bech32_prefix_consensus = 4; +} diff --git a/packages/api/proto/cosmos/staking/v1beta1/authz.proto b/packages/api/proto/cosmos/staking/v1beta1/authz.proto index 677edaad..379392c4 100644 --- a/packages/api/proto/cosmos/staking/v1beta1/authz.proto +++ b/packages/api/proto/cosmos/staking/v1beta1/authz.proto @@ -4,14 +4,15 @@ package cosmos.staking.v1beta1; import "gogoproto/gogo.proto"; import "cosmos_proto/cosmos.proto"; import "cosmos/base/v1beta1/coin.proto"; +import "amino/amino.proto"; option go_package = "github.com/cosmos/cosmos-sdk/x/staking/types"; // StakeAuthorization defines authorization for delegate/undelegate/redelegate. -// -// Since: cosmos-sdk 0.43 message StakeAuthorization { - option (cosmos_proto.implements_interface) = "Authorization"; + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.43"; + option (cosmos_proto.implements_interface) = "cosmos.authz.v1beta1.Authorization"; + option (amino.name) = "cosmos-sdk/StakeAuthorization"; // max_tokens specifies the maximum amount of tokens can be delegate to a validator. If it is // empty, there is no spend limit and any amount of coins can be delegated. @@ -20,9 +21,9 @@ message StakeAuthorization { oneof validators { // allow_list specifies list of validator addresses to whom grantee can delegate tokens on behalf of granter's // account. - Validators allow_list = 2; + Validators allow_list = 2 [(amino.oneof_name) = "cosmos-sdk/StakeAuthorization/AllowList"]; // deny_list specifies list of validator addresses to whom grantee can not delegate tokens. - Validators deny_list = 3; + Validators deny_list = 3 [(amino.oneof_name) = "cosmos-sdk/StakeAuthorization/DenyList"]; } // Validators defines list of validator addresses. message Validators { @@ -33,8 +34,6 @@ message StakeAuthorization { } // AuthorizationType defines the type of staking module authorization type -// -// Since: cosmos-sdk 0.43 enum AuthorizationType { // AUTHORIZATION_TYPE_UNSPECIFIED specifies an unknown authorization type AUTHORIZATION_TYPE_UNSPECIFIED = 0; @@ -44,4 +43,6 @@ enum AuthorizationType { AUTHORIZATION_TYPE_UNDELEGATE = 2; // AUTHORIZATION_TYPE_REDELEGATE defines an authorization type for Msg/BeginRedelegate AUTHORIZATION_TYPE_REDELEGATE = 3; + // AUTHORIZATION_TYPE_CANCEL_UNBONDING_DELEGATION defines an authorization type for Msg/MsgCancelUnbondingDelegation + AUTHORIZATION_TYPE_CANCEL_UNBONDING_DELEGATION = 4; } diff --git a/packages/api/proto/cosmos/staking/v1beta1/genesis.proto b/packages/api/proto/cosmos/staking/v1beta1/genesis.proto index bf3c298e..c3f1ce5d 100644 --- a/packages/api/proto/cosmos/staking/v1beta1/genesis.proto +++ b/packages/api/proto/cosmos/staking/v1beta1/genesis.proto @@ -6,33 +6,39 @@ option go_package = "github.com/cosmos/cosmos-sdk/x/staking/types"; import "gogoproto/gogo.proto"; import "cosmos/staking/v1beta1/staking.proto"; import "cosmos_proto/cosmos.proto"; +import "amino/amino.proto"; // GenesisState defines the staking module's genesis state. message GenesisState { - // params defines all the paramaters of related to deposit. - Params params = 1 [(gogoproto.nullable) = false]; + // params defines all the parameters of related to deposit. + Params params = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // last_total_power tracks the total amounts of bonded tokens recorded during // the previous end block. - bytes last_total_power = 2 - [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false]; + bytes last_total_power = 2 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; // last_validator_powers is a special index that provides a historical list // of the last-block's bonded validators. - repeated LastValidatorPower last_validator_powers = 3 [(gogoproto.nullable) = false]; + repeated LastValidatorPower last_validator_powers = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; - // delegations defines the validator set at genesis. - repeated Validator validators = 4 [(gogoproto.nullable) = false]; + // validators defines the validator set at genesis. + repeated Validator validators = 4 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // delegations defines the delegations active at genesis. - repeated Delegation delegations = 5 [(gogoproto.nullable) = false]; + repeated Delegation delegations = 5 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // unbonding_delegations defines the unbonding delegations active at genesis. - repeated UnbondingDelegation unbonding_delegations = 6 [(gogoproto.nullable) = false]; + repeated UnbondingDelegation unbonding_delegations = 6 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // redelegations defines the redelegations active at genesis. - repeated Redelegation redelegations = 7 [(gogoproto.nullable) = false]; + repeated Redelegation redelegations = 7 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + // exported defines a bool to identify whether the chain dealing with exported or initialized genesis. bool exported = 8; } diff --git a/packages/api/proto/cosmos/staking/v1beta1/query.proto b/packages/api/proto/cosmos/staking/v1beta1/query.proto index 2cbb750b..9b981223 100644 --- a/packages/api/proto/cosmos/staking/v1beta1/query.proto +++ b/packages/api/proto/cosmos/staking/v1beta1/query.proto @@ -6,90 +6,127 @@ import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; import "cosmos/staking/v1beta1/staking.proto"; import "cosmos_proto/cosmos.proto"; +import "cosmos/query/v1/query.proto"; +import "amino/amino.proto"; option go_package = "github.com/cosmos/cosmos-sdk/x/staking/types"; // Query defines the gRPC querier service. service Query { // Validators queries all validators that match the given status. + // + // When called from another module, this query might consume a high amount of + // gas if the pagination field is incorrectly set. rpc Validators(QueryValidatorsRequest) returns (QueryValidatorsResponse) { - option (google.api.http).get = "/cosmos/staking/v1beta1/validators"; + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = "/cosmos/staking/v1beta1/validators"; } // Validator queries validator info for given validator address. rpc Validator(QueryValidatorRequest) returns (QueryValidatorResponse) { - option (google.api.http).get = "/cosmos/staking/v1beta1/validators/{validator_addr}"; + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = "/cosmos/staking/v1beta1/validators/{validator_addr}"; } // ValidatorDelegations queries delegate info for given validator. + // + // When called from another module, this query might consume a high amount of + // gas if the pagination field is incorrectly set. rpc ValidatorDelegations(QueryValidatorDelegationsRequest) returns (QueryValidatorDelegationsResponse) { - option (google.api.http).get = "/cosmos/staking/v1beta1/validators/{validator_addr}/delegations"; + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = "/cosmos/staking/v1beta1/validators/{validator_addr}/delegations"; } // ValidatorUnbondingDelegations queries unbonding delegations of a validator. + // + // When called from another module, this query might consume a high amount of + // gas if the pagination field is incorrectly set. rpc ValidatorUnbondingDelegations(QueryValidatorUnbondingDelegationsRequest) returns (QueryValidatorUnbondingDelegationsResponse) { - option (google.api.http).get = "/cosmos/staking/v1beta1/validators/" - "{validator_addr}/unbonding_delegations"; + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = "/cosmos/staking/v1beta1/validators/" + "{validator_addr}/unbonding_delegations"; } // Delegation queries delegate info for given validator delegator pair. rpc Delegation(QueryDelegationRequest) returns (QueryDelegationResponse) { - option (google.api.http).get = "/cosmos/staking/v1beta1/validators/{validator_addr}/delegations/" - "{delegator_addr}"; + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = "/cosmos/staking/v1beta1/validators/{validator_addr}/delegations/" + "{delegator_addr}"; } // UnbondingDelegation queries unbonding info for given validator delegator // pair. rpc UnbondingDelegation(QueryUnbondingDelegationRequest) returns (QueryUnbondingDelegationResponse) { - option (google.api.http).get = "/cosmos/staking/v1beta1/validators/{validator_addr}/delegations/" - "{delegator_addr}/unbonding_delegation"; + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = "/cosmos/staking/v1beta1/validators/{validator_addr}/delegations/" + "{delegator_addr}/unbonding_delegation"; } // DelegatorDelegations queries all delegations of a given delegator address. + // + // When called from another module, this query might consume a high amount of + // gas if the pagination field is incorrectly set. rpc DelegatorDelegations(QueryDelegatorDelegationsRequest) returns (QueryDelegatorDelegationsResponse) { - option (google.api.http).get = "/cosmos/staking/v1beta1/delegations/{delegator_addr}"; + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = "/cosmos/staking/v1beta1/delegations/{delegator_addr}"; } // DelegatorUnbondingDelegations queries all unbonding delegations of a given // delegator address. + // + // When called from another module, this query might consume a high amount of + // gas if the pagination field is incorrectly set. rpc DelegatorUnbondingDelegations(QueryDelegatorUnbondingDelegationsRequest) returns (QueryDelegatorUnbondingDelegationsResponse) { - option (google.api.http).get = "/cosmos/staking/v1beta1/delegators/" - "{delegator_addr}/unbonding_delegations"; + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = "/cosmos/staking/v1beta1/delegators/" + "{delegator_addr}/unbonding_delegations"; } // Redelegations queries redelegations of given address. + // + // When called from another module, this query might consume a high amount of + // gas if the pagination field is incorrectly set. rpc Redelegations(QueryRedelegationsRequest) returns (QueryRedelegationsResponse) { - option (google.api.http).get = "/cosmos/staking/v1beta1/delegators/{delegator_addr}/redelegations"; + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = "/cosmos/staking/v1beta1/delegators/{delegator_addr}/redelegations"; } // DelegatorValidators queries all validators info for given delegator // address. + // + // When called from another module, this query might consume a high amount of + // gas if the pagination field is incorrectly set. rpc DelegatorValidators(QueryDelegatorValidatorsRequest) returns (QueryDelegatorValidatorsResponse) { - option (google.api.http).get = "/cosmos/staking/v1beta1/delegators/{delegator_addr}/validators"; + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = "/cosmos/staking/v1beta1/delegators/{delegator_addr}/validators"; } // DelegatorValidator queries validator info for given delegator validator // pair. rpc DelegatorValidator(QueryDelegatorValidatorRequest) returns (QueryDelegatorValidatorResponse) { - option (google.api.http).get = "/cosmos/staking/v1beta1/delegators/{delegator_addr}/validators/" - "{validator_addr}"; + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = "/cosmos/staking/v1beta1/delegators/{delegator_addr}/validators/" + "{validator_addr}"; } // HistoricalInfo queries the historical info for given height. rpc HistoricalInfo(QueryHistoricalInfoRequest) returns (QueryHistoricalInfoResponse) { - option (google.api.http).get = "/cosmos/staking/v1beta1/historical_info/{height}"; + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = "/cosmos/staking/v1beta1/historical_info/{height}"; } // Pool queries the pool info. rpc Pool(QueryPoolRequest) returns (QueryPoolResponse) { - option (google.api.http).get = "/cosmos/staking/v1beta1/pool"; + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = "/cosmos/staking/v1beta1/pool"; } // Parameters queries the staking parameters. rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/cosmos/staking/v1beta1/params"; + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = "/cosmos/staking/v1beta1/params"; } } @@ -105,7 +142,7 @@ message QueryValidatorsRequest { // QueryValidatorsResponse is response type for the Query/Validators RPC method message QueryValidatorsResponse { // validators contains all the queried validators. - repeated Validator validators = 1 [(gogoproto.nullable) = false]; + repeated Validator validators = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // pagination defines the pagination in the response. cosmos.base.query.v1beta1.PageResponse pagination = 2; @@ -114,20 +151,20 @@ message QueryValidatorsResponse { // QueryValidatorRequest is response type for the Query/Validator RPC method message QueryValidatorRequest { // validator_addr defines the validator address to query for. - string validator_addr = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_addr = 1 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; } // QueryValidatorResponse is response type for the Query/Validator RPC method message QueryValidatorResponse { // validator defines the validator info. - Validator validator = 1 [(gogoproto.nullable) = false]; + Validator validator = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // QueryValidatorDelegationsRequest is request type for the // Query/ValidatorDelegations RPC method message QueryValidatorDelegationsRequest { // validator_addr defines the validator address to query for. - string validator_addr = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_addr = 1 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; // pagination defines an optional pagination for the request. cosmos.base.query.v1beta1.PageRequest pagination = 2; @@ -137,7 +174,7 @@ message QueryValidatorDelegationsRequest { // Query/ValidatorDelegations RPC method message QueryValidatorDelegationsResponse { repeated DelegationResponse delegation_responses = 1 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "DelegationResponses"]; + [(gogoproto.nullable) = false, (amino.dont_omitempty) = true, (gogoproto.castrepeated) = "DelegationResponses"]; // pagination defines the pagination in the response. cosmos.base.query.v1beta1.PageResponse pagination = 2; @@ -147,7 +184,7 @@ message QueryValidatorDelegationsResponse { // Query/ValidatorUnbondingDelegations RPC method message QueryValidatorUnbondingDelegationsRequest { // validator_addr defines the validator address to query for. - string validator_addr = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_addr = 1 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; // pagination defines an optional pagination for the request. cosmos.base.query.v1beta1.PageRequest pagination = 2; @@ -156,7 +193,7 @@ message QueryValidatorUnbondingDelegationsRequest { // QueryValidatorUnbondingDelegationsResponse is response type for the // Query/ValidatorUnbondingDelegations RPC method. message QueryValidatorUnbondingDelegationsResponse { - repeated UnbondingDelegation unbonding_responses = 1 [(gogoproto.nullable) = false]; + repeated UnbondingDelegation unbonding_responses = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // pagination defines the pagination in the response. cosmos.base.query.v1beta1.PageResponse pagination = 2; @@ -171,7 +208,7 @@ message QueryDelegationRequest { string delegator_addr = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // validator_addr defines the validator address to query for. - string validator_addr = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_addr = 2 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; } // QueryDelegationResponse is response type for the Query/Delegation RPC method. @@ -190,14 +227,14 @@ message QueryUnbondingDelegationRequest { string delegator_addr = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // validator_addr defines the validator address to query for. - string validator_addr = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_addr = 2 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; } // QueryDelegationResponse is response type for the Query/UnbondingDelegation // RPC method. message QueryUnbondingDelegationResponse { // unbond defines the unbonding information of a delegation. - UnbondingDelegation unbond = 1 [(gogoproto.nullable) = false]; + UnbondingDelegation unbond = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // QueryDelegatorDelegationsRequest is request type for the @@ -217,7 +254,7 @@ message QueryDelegatorDelegationsRequest { // Query/DelegatorDelegations RPC method. message QueryDelegatorDelegationsResponse { // delegation_responses defines all the delegations' info of a delegator. - repeated DelegationResponse delegation_responses = 1 [(gogoproto.nullable) = false]; + repeated DelegationResponse delegation_responses = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // pagination defines the pagination in the response. cosmos.base.query.v1beta1.PageResponse pagination = 2; @@ -239,7 +276,7 @@ message QueryDelegatorUnbondingDelegationsRequest { // QueryUnbondingDelegatorDelegationsResponse is response type for the // Query/UnbondingDelegatorDelegations RPC method. message QueryDelegatorUnbondingDelegationsResponse { - repeated UnbondingDelegation unbonding_responses = 1 [(gogoproto.nullable) = false]; + repeated UnbondingDelegation unbonding_responses = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // pagination defines the pagination in the response. cosmos.base.query.v1beta1.PageResponse pagination = 2; @@ -255,10 +292,10 @@ message QueryRedelegationsRequest { string delegator_addr = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // src_validator_addr defines the validator address to redelegate from. - string src_validator_addr = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string src_validator_addr = 2 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; // dst_validator_addr defines the validator address to redelegate to. - string dst_validator_addr = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string dst_validator_addr = 3 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; // pagination defines an optional pagination for the request. cosmos.base.query.v1beta1.PageRequest pagination = 4; @@ -267,7 +304,8 @@ message QueryRedelegationsRequest { // QueryRedelegationsResponse is response type for the Query/Redelegations RPC // method. message QueryRedelegationsResponse { - repeated RedelegationResponse redelegation_responses = 1 [(gogoproto.nullable) = false]; + repeated RedelegationResponse redelegation_responses = 1 + [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // pagination defines the pagination in the response. cosmos.base.query.v1beta1.PageResponse pagination = 2; @@ -290,7 +328,7 @@ message QueryDelegatorValidatorsRequest { // Query/DelegatorValidators RPC method. message QueryDelegatorValidatorsResponse { // validators defines the validators' info of a delegator. - repeated Validator validators = 1 [(gogoproto.nullable) = false]; + repeated Validator validators = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // pagination defines the pagination in the response. cosmos.base.query.v1beta1.PageResponse pagination = 2; @@ -306,14 +344,14 @@ message QueryDelegatorValidatorRequest { string delegator_addr = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // validator_addr defines the validator address to query for. - string validator_addr = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_addr = 2 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; } // QueryDelegatorValidatorResponse response type for the // Query/DelegatorValidator RPC method. message QueryDelegatorValidatorResponse { // validator defines the validator info. - Validator validator = 1 [(gogoproto.nullable) = false]; + Validator validator = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // QueryHistoricalInfoRequest is request type for the Query/HistoricalInfo RPC @@ -336,7 +374,7 @@ message QueryPoolRequest {} // QueryPoolResponse is response type for the Query/Pool RPC method. message QueryPoolResponse { // pool defines the pool info. - Pool pool = 1 [(gogoproto.nullable) = false]; + Pool pool = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // QueryParamsRequest is request type for the Query/Params RPC method. @@ -345,5 +383,5 @@ message QueryParamsRequest {} // QueryParamsResponse is response type for the Query/Params RPC method. message QueryParamsResponse { // params holds all the parameters of this module. - Params params = 1 [(gogoproto.nullable) = false]; + Params params = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } diff --git a/packages/api/proto/cosmos/staking/v1beta1/staking.proto b/packages/api/proto/cosmos/staking/v1beta1/staking.proto index 6dc965fe..c8ed16f8 100644 --- a/packages/api/proto/cosmos/staking/v1beta1/staking.proto +++ b/packages/api/proto/cosmos/staking/v1beta1/staking.proto @@ -8,7 +8,9 @@ import "google/protobuf/timestamp.proto"; import "cosmos_proto/cosmos.proto"; import "cosmos/base/v1beta1/coin.proto"; +import "amino/amino.proto"; import "tendermint/types/types.proto"; +import "tendermint/abci/types.proto"; option go_package = "github.com/cosmos/cosmos-sdk/x/staking/types"; @@ -17,51 +19,53 @@ option go_package = "github.com/cosmos/cosmos-sdk/x/staking/types"; // recent HistoricalInfo // (`n` is set by the staking module's `historical_entries` parameter). message HistoricalInfo { - tendermint.types.Header header = 1 [(gogoproto.nullable) = false]; - repeated Validator valset = 2 [(gogoproto.nullable) = false]; + tendermint.types.Header header = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + repeated Validator valset = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // CommissionRates defines the initial commission rates to be used for creating // a validator. message CommissionRates { - option (gogoproto.equal) = true; - option (gogoproto.goproto_stringer) = false; + option (gogoproto.equal) = true; // rate is the commission rate charged to delegators, as a fraction. string rate = 1 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true ]; // max_rate defines the maximum commission rate which validator can ever charge, as a fraction. string max_rate = 2 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true ]; // max_change_rate defines the maximum daily increase of the validator commission, as a fraction. string max_change_rate = 3 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true ]; } // Commission defines commission parameters for a given validator. message Commission { - option (gogoproto.equal) = true; - option (gogoproto.goproto_stringer) = false; + option (gogoproto.equal) = true; // commission_rates defines the initial commission rates to be used for creating a validator. - CommissionRates commission_rates = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + CommissionRates commission_rates = 1 + [(gogoproto.embed) = true, (gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // update_time is the last time the commission rate was changed. - google.protobuf.Timestamp update_time = 2 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + google.protobuf.Timestamp update_time = 2 + [(gogoproto.nullable) = false, (amino.dont_omitempty) = true, (gogoproto.stdtime) = true]; } // Description defines a validator description. message Description { - option (gogoproto.equal) = true; - option (gogoproto.goproto_stringer) = false; + option (gogoproto.equal) = true; // moniker defines a human-readable name for the validator. string moniker = 1; @@ -84,9 +88,8 @@ message Description { // exchange rate. Voting power can be calculated as total bonded shares // multiplied by exchange rate. message Validator { - option (gogoproto.equal) = false; - option (gogoproto.goproto_stringer) = false; - option (gogoproto.goproto_getters) = false; + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; // operator_address defines the address of the validator's operator; bech encoded in JSON. string operator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; @@ -99,31 +102,37 @@ message Validator { // tokens define the delegated tokens (incl. self-delegation). string tokens = 5 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; // delegator_shares defines total shares issued to a validator's delegators. string delegator_shares = 6 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; // description defines the description terms for the validator. - Description description = 7 [(gogoproto.nullable) = false]; + Description description = 7 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // unbonding_height defines, if unbonding, the height at which this validator has begun unbonding. int64 unbonding_height = 8; // unbonding_time defines, if unbonding, the min time for the validator to complete unbonding. - google.protobuf.Timestamp unbonding_time = 9 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + google.protobuf.Timestamp unbonding_time = 9 + [(gogoproto.nullable) = false, (amino.dont_omitempty) = true, (gogoproto.stdtime) = true]; // commission defines the commission parameters. - Commission commission = 10 [(gogoproto.nullable) = false]; + Commission commission = 10 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // min_self_delegation is the validator's self declared minimum self delegation. - // - // Since: cosmos-sdk 0.46 string min_self_delegation = 11 [ - (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", - (gogoproto.nullable) = false + (cosmos_proto.field_added_in) = "cosmos-sdk 0.46", + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false ]; + + // strictly positive if this validator's unbonding has been stopped by external modules + int64 unbonding_on_hold_ref_count = 12; + + // list of unbonding ids, each uniquely identifing an unbonding of this validator + repeated uint64 unbonding_ids = 13; } // BondStatus is the status of a validator. @@ -142,9 +151,6 @@ enum BondStatus { // ValAddresses defines a repeated set of validator addresses. message ValAddresses { - option (gogoproto.goproto_stringer) = false; - option (gogoproto.stringer) = true; - repeated string addresses = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } @@ -152,17 +158,16 @@ message ValAddresses { // It is intended to be used as a marshalable pointer. For example, a DVPair can // be used to construct the key to getting an UnbondingDelegation from state. message DVPair { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = false; + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; } // DVPairs defines an array of DVPair objects. message DVPairs { - repeated DVPair pairs = 1 [(gogoproto.nullable) = false]; + repeated DVPair pairs = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // DVVTriplet is struct that just has a delegator-validator-validator triplet @@ -170,36 +175,34 @@ message DVPairs { // example, a DVVTriplet can be used to construct the key to getting a // Redelegation from state. message DVVTriplet { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = false; + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - string validator_src_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - string validator_dst_address = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_src_address = 2 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; + string validator_dst_address = 3 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; } // DVVTriplets defines an array of DVVTriplet objects. message DVVTriplets { - repeated DVVTriplet triplets = 1 [(gogoproto.nullable) = false]; + repeated DVVTriplet triplets = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // Delegation represents the bond with tokens held by an account. It is // owned by one delegator, and is associated with the voting power of one // validator. message Delegation { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = false; + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; - // delegator_address is the bech32-encoded address of the delegator. + // delegator_address is the encoded address of the delegator. string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - // validator_address is the bech32-encoded address of the validator. - string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // validator_address is the encoded address of the validator. + string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; // shares define the delegation shares received. string shares = 3 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; } @@ -207,88 +210,99 @@ message Delegation { // UnbondingDelegation stores all of a single delegator's unbonding bonds // for a single validator in an time-ordered list. message UnbondingDelegation { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = false; + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; - // delegator_address is the bech32-encoded address of the delegator. + // delegator_address is the encoded address of the delegator. string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - // validator_address is the bech32-encoded address of the validator. - string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // validator_address is the encoded address of the validator. + string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; // entries are the unbonding delegation entries. - repeated UnbondingDelegationEntry entries = 3 [(gogoproto.nullable) = false]; // unbonding delegation entries + repeated UnbondingDelegationEntry entries = 3 + [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // unbonding delegation entries } // UnbondingDelegationEntry defines an unbonding object with relevant metadata. message UnbondingDelegationEntry { - option (gogoproto.equal) = true; - option (gogoproto.goproto_stringer) = false; + option (gogoproto.equal) = true; // creation_height is the height which the unbonding took place. int64 creation_height = 1; // completion_time is the unix time for unbonding completion. - google.protobuf.Timestamp completion_time = 2 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + google.protobuf.Timestamp completion_time = 2 + [(gogoproto.nullable) = false, (amino.dont_omitempty) = true, (gogoproto.stdtime) = true]; // initial_balance defines the tokens initially scheduled to receive at completion. string initial_balance = 3 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; // balance defines the tokens to receive at completion. string balance = 4 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; + // Incrementing id that uniquely identifies this entry + uint64 unbonding_id = 5; + + // Strictly positive if this entry's unbonding has been stopped by external modules + int64 unbonding_on_hold_ref_count = 6; } // RedelegationEntry defines a redelegation object with relevant metadata. message RedelegationEntry { - option (gogoproto.equal) = true; - option (gogoproto.goproto_stringer) = false; + option (gogoproto.equal) = true; // creation_height defines the height which the redelegation took place. int64 creation_height = 1; // completion_time defines the unix time for redelegation completion. - google.protobuf.Timestamp completion_time = 2 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + google.protobuf.Timestamp completion_time = 2 + [(gogoproto.nullable) = false, (amino.dont_omitempty) = true, (gogoproto.stdtime) = true]; // initial_balance defines the initial balance when redelegation started. string initial_balance = 3 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; // shares_dst is the amount of destination-validator shares created by redelegation. string shares_dst = 4 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; + // Incrementing id that uniquely identifies this entry + uint64 unbonding_id = 5; + + // Strictly positive if this entry's unbonding has been stopped by external modules + int64 unbonding_on_hold_ref_count = 6; } // Redelegation contains the list of a particular delegator's redelegating bonds // from a particular source validator to a particular destination validator. message Redelegation { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = false; + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; // delegator_address is the bech32-encoded address of the delegator. string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // validator_src_address is the validator redelegation source operator address. - string validator_src_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_src_address = 2 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; // validator_dst_address is the validator redelegation destination operator address. - string validator_dst_address = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_dst_address = 3 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; // entries are the redelegation entries. - repeated RedelegationEntry entries = 4 [(gogoproto.nullable) = false]; // redelegation entries + repeated RedelegationEntry entries = 4 + [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // redelegation entries } -// Params defines the parameters for the staking module. +// Params defines the parameters for the x/staking module. message Params { - option (gogoproto.equal) = true; - option (gogoproto.goproto_stringer) = false; + option (amino.name) = "cosmos-sdk/x/staking/Params"; + option (gogoproto.equal) = true; // unbonding_time is the time duration of unbonding. - google.protobuf.Duration unbonding_time = 1 [(gogoproto.nullable) = false, (gogoproto.stdduration) = true]; + google.protobuf.Duration unbonding_time = 1 + [(gogoproto.nullable) = false, (amino.dont_omitempty) = true, (gogoproto.stdduration) = true]; // max_validators is the maximum number of validators. uint32 max_validators = 2; // max_entries is the max entries for either unbonding delegation or redelegation (per pair/trio). @@ -300,20 +314,21 @@ message Params { // min_commission_rate is the chain-wide minimum commission rate that a validator can charge their delegators string min_commission_rate = 6 [ (gogoproto.moretags) = "yaml:\"min_commission_rate\"", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true, + (cosmos_proto.scalar) = "cosmos.Dec" ]; } // DelegationResponse is equivalent to Delegation except that it contains a // balance in addition to shares which is more suitable for client responses. message DelegationResponse { - option (gogoproto.equal) = false; - option (gogoproto.goproto_stringer) = false; + option (gogoproto.equal) = false; - Delegation delegation = 1 [(gogoproto.nullable) = false]; + Delegation delegation = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; - cosmos.base.v1beta1.Coin balance = 2 [(gogoproto.nullable) = false]; + cosmos.base.v1beta1.Coin balance = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // RedelegationEntryResponse is equivalent to a RedelegationEntry except that it @@ -322,10 +337,10 @@ message DelegationResponse { message RedelegationEntryResponse { option (gogoproto.equal) = true; - RedelegationEntry redelegation_entry = 1 [(gogoproto.nullable) = false]; + RedelegationEntry redelegation_entry = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; string balance = 4 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; } @@ -336,8 +351,8 @@ message RedelegationEntryResponse { message RedelegationResponse { option (gogoproto.equal) = false; - Redelegation redelegation = 1 [(gogoproto.nullable) = false]; - repeated RedelegationEntryResponse entries = 2 [(gogoproto.nullable) = false]; + Redelegation redelegation = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + repeated RedelegationEntryResponse entries = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // Pool is used for tracking bonded and not-bonded token supply of the bond @@ -347,14 +362,32 @@ message Pool { option (gogoproto.equal) = true; string not_bonded_tokens = 1 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false, - (gogoproto.jsontag) = "not_bonded_tokens" + (gogoproto.jsontag) = "not_bonded_tokens", + (amino.dont_omitempty) = true ]; string bonded_tokens = 2 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false, - (gogoproto.jsontag) = "bonded_tokens" + (gogoproto.jsontag) = "bonded_tokens", + (amino.dont_omitempty) = true ]; } + +// Infraction indicates the infraction a validator commited. +enum Infraction { + // UNSPECIFIED defines an empty infraction. + INFRACTION_UNSPECIFIED = 0; + // DOUBLE_SIGN defines a validator that double-signs a block. + INFRACTION_DOUBLE_SIGN = 1; + // DOWNTIME defines a validator that missed signing too many blocks. + INFRACTION_DOWNTIME = 2; +} + +// ValidatorUpdates defines an array of abci.ValidatorUpdate objects. +// TODO: explore moving this to proto/cosmos/base to separate modules from tendermint dependence +message ValidatorUpdates { + repeated tendermint.abci.ValidatorUpdate updates = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; +} diff --git a/packages/api/proto/cosmos/staking/v1beta1/tx.proto b/packages/api/proto/cosmos/staking/v1beta1/tx.proto index b4866d36..d2d29ed4 100644 --- a/packages/api/proto/cosmos/staking/v1beta1/tx.proto +++ b/packages/api/proto/cosmos/staking/v1beta1/tx.proto @@ -8,13 +8,15 @@ import "gogoproto/gogo.proto"; import "cosmos_proto/cosmos.proto"; import "cosmos/base/v1beta1/coin.proto"; import "cosmos/staking/v1beta1/staking.proto"; - import "cosmos/msg/v1/msg.proto"; +import "amino/amino.proto"; option go_package = "github.com/cosmos/cosmos-sdk/x/staking/types"; // Msg defines the staking Msg service. service Msg { + option (cosmos.msg.v1.service) = true; + // CreateValidator defines a method for creating a new validator. rpc CreateValidator(MsgCreateValidator) returns (MsgCreateValidatorResponse); @@ -35,33 +37,40 @@ service Msg { // CancelUnbondingDelegation defines a method for performing canceling the unbonding delegation // and delegate back to previous validator. - // - // Since: cosmos-sdk 0.46 - rpc CancelUnbondingDelegation(MsgCancelUnbondingDelegation) returns (MsgCancelUnbondingDelegationResponse); + rpc CancelUnbondingDelegation(MsgCancelUnbondingDelegation) returns (MsgCancelUnbondingDelegationResponse) { + option (cosmos_proto.method_added_in) = "cosmos-sdk 0.46"; + }; + + // UpdateParams defines an operation for updating the x/staking module + // parameters. + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse) { + option (cosmos_proto.method_added_in) = "cosmos-sdk 0.47"; + }; } // MsgCreateValidator defines a SDK message for creating a new validator. message MsgCreateValidator { - // NOTE(fdymylja): this is a particular case in which - // if validator_address == delegator_address then only one - // is expected to sign, otherwise both are. - option (cosmos.msg.v1.signer) = "delegator_address"; option (cosmos.msg.v1.signer) = "validator_address"; + option (amino.name) = "cosmos-sdk/MsgCreateValidator"; option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; - Description description = 1 [(gogoproto.nullable) = false]; - CommissionRates commission = 2 [(gogoproto.nullable) = false]; + Description description = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + CommissionRates commission = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; string min_self_delegation = 3 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", - (gogoproto.nullable) = false + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true ]; - string delegator_address = 4 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - string validator_address = 5 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // Deprecated: Use of Delegator Address in MsgCreateValidator is deprecated. + // The validator address bytes and delegator address bytes refer to the same account while creating validator (defer + // only in bech32 notation). + string delegator_address = 4 [(cosmos_proto.scalar) = "cosmos.AddressString", deprecated = true]; + string validator_address = 5 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; google.protobuf.Any pubkey = 6 [(cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey"]; - cosmos.base.v1beta1.Coin value = 7 [(gogoproto.nullable) = false]; + cosmos.base.v1beta1.Coin value = 7 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // MsgCreateValidatorResponse defines the Msg/CreateValidator response type. @@ -70,21 +79,22 @@ message MsgCreateValidatorResponse {} // MsgEditValidator defines a SDK message for editing an existing validator. message MsgEditValidator { option (cosmos.msg.v1.signer) = "validator_address"; + option (amino.name) = "cosmos-sdk/MsgEditValidator"; option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; - Description description = 1 [(gogoproto.nullable) = false]; - string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + Description description = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; // We pass a reference to the new commission rate and min self delegation as // it's not mandatory to update. If not updated, the deserialized rate will be // zero with no way to distinguish if an update was intended. // REF: #2373 string commission_rate = 3 - [(cosmos_proto.scalar) = "cosmos.Dec", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec"]; + [(cosmos_proto.scalar) = "cosmos.Dec", (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec"]; string min_self_delegation = 4 - [(cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int"]; + [(cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "cosmossdk.io/math.Int"]; } // MsgEditValidatorResponse defines the Msg/EditValidator response type. @@ -94,12 +104,14 @@ message MsgEditValidatorResponse {} // from a delegator to a validator. message MsgDelegate { option (cosmos.msg.v1.signer) = "delegator_address"; + option (amino.name) = "cosmos-sdk/MsgDelegate"; - option (gogoproto.equal) = false; + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false]; + string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; + cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // MsgDelegateResponse defines the Msg/Delegate response type. @@ -109,53 +121,84 @@ message MsgDelegateResponse {} // of coins from a delegator and source validator to a destination validator. message MsgBeginRedelegate { option (cosmos.msg.v1.signer) = "delegator_address"; + option (amino.name) = "cosmos-sdk/MsgBeginRedelegate"; - option (gogoproto.equal) = false; + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - string validator_src_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - string validator_dst_address = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - cosmos.base.v1beta1.Coin amount = 4 [(gogoproto.nullable) = false]; + string validator_src_address = 2 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; + string validator_dst_address = 3 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; + cosmos.base.v1beta1.Coin amount = 4 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // MsgBeginRedelegateResponse defines the Msg/BeginRedelegate response type. message MsgBeginRedelegateResponse { - google.protobuf.Timestamp completion_time = 1 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + google.protobuf.Timestamp completion_time = 1 + [(gogoproto.nullable) = false, (amino.dont_omitempty) = true, (gogoproto.stdtime) = true]; } // MsgUndelegate defines a SDK message for performing an undelegation from a // delegate and a validator. message MsgUndelegate { option (cosmos.msg.v1.signer) = "delegator_address"; + option (amino.name) = "cosmos-sdk/MsgUndelegate"; - option (gogoproto.equal) = false; + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false]; + string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; + cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // MsgUndelegateResponse defines the Msg/Undelegate response type. message MsgUndelegateResponse { - google.protobuf.Timestamp completion_time = 1 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + google.protobuf.Timestamp completion_time = 1 + [(gogoproto.nullable) = false, (amino.dont_omitempty) = true, (gogoproto.stdtime) = true]; + + // amount returns the amount of undelegated coins + cosmos.base.v1beta1.Coin amount = 2 + [(gogoproto.nullable) = false, (amino.dont_omitempty) = true, (cosmos_proto.field_added_in) = "cosmos-sdk 0.50"]; } // MsgCancelUnbondingDelegation defines the SDK message for performing a cancel unbonding delegation for delegator -// -// Since: cosmos-sdk 0.46 message MsgCancelUnbondingDelegation { - option (cosmos.msg.v1.signer) = "delegator_address"; - option (gogoproto.equal) = false; + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.46"; + option (cosmos.msg.v1.signer) = "delegator_address"; + option (amino.name) = "cosmos-sdk/MsgCancelUnbondingDelegation"; + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; // amount is always less than or equal to unbonding delegation entry balance - cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false]; + cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // creation_height is the height which the unbonding took place. int64 creation_height = 4; } // MsgCancelUnbondingDelegationResponse -// -// Since: cosmos-sdk 0.46 -message MsgCancelUnbondingDelegationResponse {} +message MsgCancelUnbondingDelegationResponse { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.46"; +} + +// MsgUpdateParams is the Msg/UpdateParams request type. +message MsgUpdateParams { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.47"; + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "cosmos-sdk/x/staking/MsgUpdateParams"; + + // authority is the address that controls the module (defaults to x/gov unless overwritten). + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // params defines the x/staking parameters to update. + // + // NOTE: All parameters must be supplied. + Params params = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; +}; + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +message MsgUpdateParamsResponse { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.47"; +}; diff --git a/packages/api/proto/cosmos/base/kv/v1beta1/kv.proto b/packages/api/proto/cosmos/store/internal/kv/v1beta1/kv.proto similarity index 58% rename from packages/api/proto/cosmos/base/kv/v1beta1/kv.proto rename to packages/api/proto/cosmos/store/internal/kv/v1beta1/kv.proto index 4e9b8d28..4243444a 100644 --- a/packages/api/proto/cosmos/base/kv/v1beta1/kv.proto +++ b/packages/api/proto/cosmos/store/internal/kv/v1beta1/kv.proto @@ -1,9 +1,11 @@ syntax = "proto3"; -package cosmos.base.kv.v1beta1; +package cosmos.store.internal.kv.v1beta1; import "gogoproto/gogo.proto"; -option go_package = "github.com/cosmos/cosmos-sdk/types/kv"; +option go_package = "cosmossdk.io/store/internal/kv"; + +// This is duplicated from the base kv directory to avoid a circular dependency with the cosmos-sdk // Pairs defines a repeated slice of Pair objects. message Pairs { diff --git a/packages/api/proto/cosmos/base/snapshots/v1beta1/snapshot.proto b/packages/api/proto/cosmos/store/snapshots/v1/snapshot.proto similarity index 63% rename from packages/api/proto/cosmos/base/snapshots/v1beta1/snapshot.proto rename to packages/api/proto/cosmos/store/snapshots/v1/snapshot.proto index 5dba369f..10885c12 100644 --- a/packages/api/proto/cosmos/base/snapshots/v1beta1/snapshot.proto +++ b/packages/api/proto/cosmos/store/snapshots/v1/snapshot.proto @@ -1,9 +1,10 @@ syntax = "proto3"; -package cosmos.base.snapshots.v1beta1; +package cosmos.store.snapshots.v1; import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; -option go_package = "github.com/cosmos/cosmos-sdk/snapshots/types"; +option go_package = "cosmossdk.io/store/snapshots/types"; // Snapshot contains Tendermint state sync snapshot info. message Snapshot { @@ -20,8 +21,6 @@ message Metadata { } // SnapshotItem is an item contained in a rootmulti.Store snapshot. -// -// Since: cosmos-sdk 0.46 message SnapshotItem { // item is the specific type of snapshot item. oneof item { @@ -29,56 +28,36 @@ message SnapshotItem { SnapshotIAVLItem iavl = 2 [(gogoproto.customname) = "IAVL"]; SnapshotExtensionMeta extension = 3; SnapshotExtensionPayload extension_payload = 4; - SnapshotKVItem kv = 5 [(gogoproto.customname) = "KV"]; - SnapshotSchema schema = 6; } + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.46"; } // SnapshotStoreItem contains metadata about a snapshotted store. -// -// Since: cosmos-sdk 0.46 message SnapshotStoreItem { - string name = 1; + string name = 1; + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.46"; } // SnapshotIAVLItem is an exported IAVL node. -// -// Since: cosmos-sdk 0.46 message SnapshotIAVLItem { bytes key = 1; bytes value = 2; // version is block height int64 version = 3; // height is depth of the tree. - int32 height = 4; + int32 height = 4; + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.46"; } // SnapshotExtensionMeta contains metadata about an external snapshotter. -// -// Since: cosmos-sdk 0.46 message SnapshotExtensionMeta { - string name = 1; - uint32 format = 2; + string name = 1; + uint32 format = 2; + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.46"; } // SnapshotExtensionPayload contains payloads of an external snapshotter. -// -// Since: cosmos-sdk 0.46 message SnapshotExtensionPayload { - bytes payload = 1; -} - -// SnapshotKVItem is an exported Key/Value Pair -// -// Since: cosmos-sdk 0.46 -message SnapshotKVItem { - bytes key = 1; - bytes value = 2; -} - -// SnapshotSchema is an exported schema of smt store -// -// Since: cosmos-sdk 0.46 -message SnapshotSchema { - repeated bytes keys = 1; -} + bytes payload = 1; + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.46"; +} \ No newline at end of file diff --git a/packages/api/proto/cosmos/store/streaming/abci/grpc.proto b/packages/api/proto/cosmos/store/streaming/abci/grpc.proto new file mode 100644 index 00000000..25366cdb --- /dev/null +++ b/packages/api/proto/cosmos/store/streaming/abci/grpc.proto @@ -0,0 +1,36 @@ +syntax = "proto3"; + +package cosmos.store.streaming.abci; + +import "tendermint/abci/types.proto"; +import "cosmos/store/v1beta1/listening.proto"; + +option go_package = "cosmossdk.io/store/streaming/abci"; + +// ListenEndBlockRequest is the request type for the ListenEndBlock RPC method +message ListenFinalizeBlockRequest { + tendermint.abci.RequestFinalizeBlock req = 1; + tendermint.abci.ResponseFinalizeBlock res = 2; +} + +// ListenEndBlockResponse is the response type for the ListenEndBlock RPC method +message ListenFinalizeBlockResponse {} + +// ListenCommitRequest is the request type for the ListenCommit RPC method +message ListenCommitRequest { + // explicitly pass in block height as ResponseCommit does not contain this info + int64 block_height = 1; + tendermint.abci.ResponseCommit res = 2; + repeated cosmos.store.v1beta1.StoreKVPair change_set = 3; +} + +// ListenCommitResponse is the response type for the ListenCommit RPC method +message ListenCommitResponse {} + +// ABCIListenerService is the service for the BaseApp ABCIListener interface +service ABCIListenerService { + // ListenFinalizeBlock is the corresponding endpoint for ABCIListener.ListenEndBlock + rpc ListenFinalizeBlock(ListenFinalizeBlockRequest) returns (ListenFinalizeBlockResponse); + // ListenCommit is the corresponding endpoint for ABCIListener.ListenCommit + rpc ListenCommit(ListenCommitRequest) returns (ListenCommitResponse); +} diff --git a/packages/api/proto/cosmos/base/store/v1beta1/commit_info.proto b/packages/api/proto/cosmos/store/v1beta1/commit_info.proto similarity index 56% rename from packages/api/proto/cosmos/base/store/v1beta1/commit_info.proto rename to packages/api/proto/cosmos/store/v1beta1/commit_info.proto index 98a33d30..37459a0d 100644 --- a/packages/api/proto/cosmos/base/store/v1beta1/commit_info.proto +++ b/packages/api/proto/cosmos/store/v1beta1/commit_info.proto @@ -1,15 +1,17 @@ syntax = "proto3"; -package cosmos.base.store.v1beta1; +package cosmos.store.v1beta1; import "gogoproto/gogo.proto"; +import "google/protobuf/timestamp.proto"; -option go_package = "github.com/cosmos/cosmos-sdk/store/types"; +option go_package = "cosmossdk.io/store/types"; // CommitInfo defines commit information used by the multi-store when committing // a version/height. message CommitInfo { - int64 version = 1; - repeated StoreInfo store_infos = 2 [(gogoproto.nullable) = false]; + int64 version = 1; + repeated StoreInfo store_infos = 2 [(gogoproto.nullable) = false]; + google.protobuf.Timestamp timestamp = 3 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; } // StoreInfo defines store-specific commit information. It contains a reference @@ -19,7 +21,7 @@ message StoreInfo { CommitID commit_id = 2 [(gogoproto.nullable) = false]; } -// CommitID defines the committment information when a specific store is +// CommitID defines the commitment information when a specific store is // committed. message CommitID { option (gogoproto.goproto_stringer) = false; diff --git a/packages/api/proto/cosmos/store/v1beta1/listening.proto b/packages/api/proto/cosmos/store/v1beta1/listening.proto new file mode 100644 index 00000000..0d892555 --- /dev/null +++ b/packages/api/proto/cosmos/store/v1beta1/listening.proto @@ -0,0 +1,28 @@ +syntax = "proto3"; +package cosmos.store.v1beta1; + +import "tendermint/abci/types.proto"; +import "cosmos_proto/cosmos.proto"; + +option go_package = "cosmossdk.io/store/types"; + +// StoreKVPair is a KVStore KVPair used for listening to state changes (Sets and Deletes) +// It optionally includes the StoreKey for the originating KVStore and a Boolean flag to distinguish between Sets and +// Deletes +message StoreKVPair { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.43"; + string store_key = 1; // the store key for the KVStore this pair originates from + bool delete = 2; // true indicates a delete operation, false indicates a set operation + bytes key = 3; + bytes value = 4; +} + +// BlockMetadata contains all the abci event data of a block +// the file streamer dump them into files together with the state changes. +message BlockMetadata { + tendermint.abci.ResponseCommit response_commit = 6; + tendermint.abci.RequestFinalizeBlock request_finalize_block = 7; + tendermint.abci.ResponseFinalizeBlock response_finalize_block = 8; // TODO: should we renumber this? + + reserved 1, 2, 3, 4, 5; // reserved for from previous use in comet <= 0.37 +} diff --git a/packages/api/proto/cosmos/tx/config/v1/config.proto b/packages/api/proto/cosmos/tx/config/v1/config.proto new file mode 100644 index 00000000..15553a28 --- /dev/null +++ b/packages/api/proto/cosmos/tx/config/v1/config.proto @@ -0,0 +1,20 @@ +syntax = "proto3"; + +package cosmos.tx.config.v1; + +import "cosmos/app/v1alpha1/module.proto"; + +// Config is the config object of the x/auth/tx package. +message Config { + option (cosmos.app.v1alpha1.module) = { + go_import: "github.com/cosmos/cosmos-sdk/x/auth/tx" + }; + + // skip_ante_handler defines whether the ante handler registration should be skipped in case an app wants to override + // this functionality. + bool skip_ante_handler = 1; + + // skip_post_handler defines whether the post handler registration should be skipped in case an app wants to override + // this functionality. + bool skip_post_handler = 2; +} \ No newline at end of file diff --git a/packages/api/proto/cosmos/tx/signing/v1beta1/signing.proto b/packages/api/proto/cosmos/tx/signing/v1beta1/signing.proto index 12d5868b..584eff4e 100644 --- a/packages/api/proto/cosmos/tx/signing/v1beta1/signing.proto +++ b/packages/api/proto/cosmos/tx/signing/v1beta1/signing.proto @@ -25,13 +25,14 @@ enum SignMode { // SIGN_MODE_TEXTUAL is a future signing mode that will verify some // human-readable textual representation on top of the binary representation - // from SIGN_MODE_DIRECT. It is currently not supported. + // from SIGN_MODE_DIRECT. + // + // Since: cosmos-sdk 0.50 SIGN_MODE_TEXTUAL = 2; // SIGN_MODE_DIRECT_AUX specifies a signing mode which uses // SignDocDirectAux. As opposed to SIGN_MODE_DIRECT, this sign mode does not - // require signers signing over other signers' `signer_info`. It also allows - // for adding Tips in transactions. + // require signers signing over other signers' `signer_info`. // // Since: cosmos-sdk 0.46 SIGN_MODE_DIRECT_AUX = 3; diff --git a/packages/api/proto/cosmos/tx/v1beta1/service.proto b/packages/api/proto/cosmos/tx/v1beta1/service.proto index f6c39d52..066b2e27 100644 --- a/packages/api/proto/cosmos/tx/v1beta1/service.proto +++ b/packages/api/proto/cosmos/tx/v1beta1/service.proto @@ -7,6 +7,7 @@ import "cosmos/tx/v1beta1/tx.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; import "tendermint/types/block.proto"; import "tendermint/types/types.proto"; +import "cosmos_proto/cosmos.proto"; option go_package = "github.com/cosmos/cosmos-sdk/types/tx"; @@ -35,10 +36,41 @@ service Service { option (google.api.http).get = "/cosmos/tx/v1beta1/txs"; } // GetBlockWithTxs fetches a block with decoded txs. - // - // Since: cosmos-sdk 0.45.2 rpc GetBlockWithTxs(GetBlockWithTxsRequest) returns (GetBlockWithTxsResponse) { - option (google.api.http).get = "/cosmos/tx/v1beta1/txs/block/{height}"; + option (cosmos_proto.method_added_in) = "cosmos-sdk 0.45.2"; + option (google.api.http).get = "/cosmos/tx/v1beta1/txs/block/{height}"; + } + // TxDecode decodes the transaction. + rpc TxDecode(TxDecodeRequest) returns (TxDecodeResponse) { + option (google.api.http) = { + post: "/cosmos/tx/v1beta1/decode" + body: "*" + }; + option (cosmos_proto.method_added_in) = "cosmos-sdk 0.47"; + } + // TxEncode encodes the transaction. + rpc TxEncode(TxEncodeRequest) returns (TxEncodeResponse) { + option (google.api.http) = { + post: "/cosmos/tx/v1beta1/encode" + body: "*" + }; + option (cosmos_proto.method_added_in) = "cosmos-sdk 0.47"; + } + // TxEncodeAmino encodes an Amino transaction from JSON to encoded bytes. + rpc TxEncodeAmino(TxEncodeAminoRequest) returns (TxEncodeAminoResponse) { + option (google.api.http) = { + post: "/cosmos/tx/v1beta1/encode/amino" + body: "*" + }; + option (cosmos_proto.method_added_in) = "cosmos-sdk 0.47"; + } + // TxDecodeAmino decodes an Amino transaction from encoded bytes to JSON. + rpc TxDecodeAmino(TxDecodeAminoRequest) returns (TxDecodeAminoResponse) { + option (google.api.http) = { + post: "/cosmos/tx/v1beta1/decode/amino" + body: "*" + }; + option (cosmos_proto.method_added_in) = "cosmos-sdk 0.47"; } } @@ -46,22 +78,33 @@ service Service { // RPC method. message GetTxsEventRequest { // events is the list of transaction event type. - repeated string events = 1; + // Deprecated post v0.47.x: use query instead, which should contain a valid + // events query. + repeated string events = 1 [deprecated = true]; + // pagination defines a pagination for the request. // Deprecated post v0.46.x: use page and limit instead. cosmos.base.query.v1beta1.PageRequest pagination = 2 [deprecated = true]; OrderBy order_by = 3; - // page is the page number to query, starts at 1. If not provided, will default to first page. + + // page is the page number to query, starts at 1. If not provided, will + // default to first page. uint64 page = 4; + // limit is the total number of results to be returned in the result page. // If left empty it will default to a value to be set by each app. uint64 limit = 5; + + // query defines the transaction event query that is proxied to Tendermint's + // TxSearch RPC method. The query must be valid. + string query = 6 [(cosmos_proto.field_added_in) = "cosmos-sdk 0.50"]; } // OrderBy defines the sorting order enum OrderBy { - // ORDER_BY_UNSPECIFIED specifies an unknown sorting order. OrderBy defaults to ASC in this case. + // ORDER_BY_UNSPECIFIED specifies an unknown sorting order. OrderBy defaults + // to ASC in this case. ORDER_BY_UNSPECIFIED = 0; // ORDER_BY_ASC defines ascending order ORDER_BY_ASC = 1; @@ -91,18 +134,19 @@ message BroadcastTxRequest { BroadcastMode mode = 2; } -// BroadcastMode specifies the broadcast mode for the TxService.Broadcast RPC method. +// BroadcastMode specifies the broadcast mode for the TxService.Broadcast RPC +// method. enum BroadcastMode { // zero-value for mode ordering BROADCAST_MODE_UNSPECIFIED = 0; - // BROADCAST_MODE_BLOCK defines a tx broadcasting mode where the client waits for - // the tx to be committed in a block. - BROADCAST_MODE_BLOCK = 1; - // BROADCAST_MODE_SYNC defines a tx broadcasting mode where the client waits for - // a CheckTx execution response only. + // DEPRECATED: use BROADCAST_MODE_SYNC instead, + // BROADCAST_MODE_BLOCK is not supported by the SDK from v0.47.x onwards. + BROADCAST_MODE_BLOCK = 1 [deprecated = true]; + // BROADCAST_MODE_SYNC defines a tx broadcasting mode where the client waits + // for a CheckTx execution response only. BROADCAST_MODE_SYNC = 2; - // BROADCAST_MODE_ASYNC defines a tx broadcasting mode where the client returns - // immediately. + // BROADCAST_MODE_ASYNC defines a tx broadcasting mode where the client + // returns immediately. BROADCAST_MODE_ASYNC = 3; } @@ -120,9 +164,7 @@ message SimulateRequest { // Deprecated. Send raw tx bytes instead. cosmos.tx.v1beta1.Tx tx = 1 [deprecated = true]; // tx_bytes is the raw transaction. - // - // Since: cosmos-sdk 0.43 - bytes tx_bytes = 2; + bytes tx_bytes = 2 [(cosmos_proto.field_added_in) = "cosmos-sdk 0.43"]; } // SimulateResponse is the response type for the @@ -151,23 +193,82 @@ message GetTxResponse { // GetBlockWithTxsRequest is the request type for the Service.GetBlockWithTxs // RPC method. -// -// Since: cosmos-sdk 0.45.2 message GetBlockWithTxsRequest { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.45.2"; // height is the height of the block to query. int64 height = 1; // pagination defines a pagination for the request. cosmos.base.query.v1beta1.PageRequest pagination = 2; } -// GetBlockWithTxsResponse is the response type for the Service.GetBlockWithTxs method. -// -// Since: cosmos-sdk 0.45.2 +// GetBlockWithTxsResponse is the response type for the Service.GetBlockWithTxs +// method. message GetBlockWithTxsResponse { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.45.2"; // txs are the transactions in the block. repeated cosmos.tx.v1beta1.Tx txs = 1; .tendermint.types.BlockID block_id = 2; .tendermint.types.Block block = 3; // pagination defines a pagination for the response. cosmos.base.query.v1beta1.PageResponse pagination = 4; -} \ No newline at end of file +} + +// TxDecodeRequest is the request type for the Service.TxDecode +// RPC method. +message TxDecodeRequest { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.47"; + // tx_bytes is the raw transaction. + bytes tx_bytes = 1; +} + +// TxDecodeResponse is the response type for the +// Service.TxDecode method. +message TxDecodeResponse { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.47"; + // tx is the decoded transaction. + cosmos.tx.v1beta1.Tx tx = 1; +} + +// TxEncodeRequest is the request type for the Service.TxEncode +// RPC method. +message TxEncodeRequest { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.47"; + // tx is the transaction to encode. + cosmos.tx.v1beta1.Tx tx = 1; +} + +// TxEncodeResponse is the response type for the +// Service.TxEncode method. +message TxEncodeResponse { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.47"; + // tx_bytes is the encoded transaction bytes. + bytes tx_bytes = 1; +} + +// TxEncodeAminoRequest is the request type for the Service.TxEncodeAmino +// RPC method. +message TxEncodeAminoRequest { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.47"; + string amino_json = 1; +} + +// TxEncodeAminoResponse is the response type for the Service.TxEncodeAmino +// RPC method. +message TxEncodeAminoResponse { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.47"; + bytes amino_binary = 1; +} + +// TxDecodeAminoRequest is the request type for the Service.TxDecodeAmino +// RPC method. +message TxDecodeAminoRequest { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.47"; + bytes amino_binary = 1; +} + +// TxDecodeAminoResponse is the response type for the Service.TxDecodeAmino +// RPC method. +message TxDecodeAminoResponse { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.47"; + string amino_json = 1; +} diff --git a/packages/api/proto/cosmos/tx/v1beta1/tx.proto b/packages/api/proto/cosmos/tx/v1beta1/tx.proto index a71a3e11..64dcf02b 100644 --- a/packages/api/proto/cosmos/tx/v1beta1/tx.proto +++ b/packages/api/proto/cosmos/tx/v1beta1/tx.proto @@ -1,12 +1,14 @@ syntax = "proto3"; package cosmos.tx.v1beta1; +import "amino/amino.proto"; import "gogoproto/gogo.proto"; import "cosmos/crypto/multisig/v1beta1/multisig.proto"; import "cosmos/base/v1beta1/coin.proto"; import "cosmos/tx/signing/v1beta1/signing.proto"; import "google/protobuf/any.proto"; import "cosmos_proto/cosmos.proto"; +import "google/protobuf/timestamp.proto"; option go_package = "github.com/cosmos/cosmos-sdk/types/tx"; @@ -66,9 +68,8 @@ message SignDoc { // SignDocDirectAux is the type used for generating sign bytes for // SIGN_MODE_DIRECT_AUX. -// -// Since: cosmos-sdk 0.46 message SignDocDirectAux { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.46"; // body_bytes is protobuf serialization of a TxBody that matches the // representation in TxRaw. bytes body_bytes = 1; @@ -87,13 +88,8 @@ message SignDocDirectAux { // sequence is the sequence number of the signing account. uint64 sequence = 5; - // Tip is the optional tip used for transactions fees paid in another denom. - // It should be left empty if the signer is not the tipper for this - // transaction. - // - // This field is ignored if the chain didn't enable tips, i.e. didn't add the - // `TipDecorator` in its posthandler. - Tip tip = 6; + // tips have been depreacted and should not be used + Tip tip = 6 [deprecated = true]; } // TxBody is the body of a transaction that all signers sign over. @@ -109,13 +105,38 @@ message TxBody { // memo is any arbitrary note/comment to be added to the transaction. // WARNING: in clients, any publicly exposed text should not be called memo, - // but should be called `note` instead (see https://github.com/cosmos/cosmos-sdk/issues/9122). + // but should be called `note` instead (see + // https://github.com/cosmos/cosmos-sdk/issues/9122). string memo = 2; - // timeout is the block height after which this transaction will not - // be processed by the chain + // timeout_height is the block height after which this transaction will not + // be processed by the chain. uint64 timeout_height = 3; + // unordered, when set to true, indicates that the transaction signer(s) + // intend for the transaction to be evaluated and executed in an un-ordered + // fashion. Specifically, the account's nonce will NOT be checked or + // incremented, which allows for fire-and-forget as well as concurrent + // transaction execution. + // + // Note, when set to true, the existing 'timeout_timestamp' value must + // be set and will be used to correspond to a timestamp in which the transaction is deemed + // valid. + // + // When true, the sequence value MUST be 0, and any transaction with unordered=true and a non-zero sequence value will + // be rejected. + // External services that make assumptions about sequence values may need to be updated because of this. + bool unordered = 4 [(cosmos_proto.field_added_in) = "cosmos-sdk 0.53"]; + + // timeout_timestamp is the block time after which this transaction will not + // be processed by the chain. + // + // Note, if unordered=true this value MUST be set + // and will act as a short-lived TTL in which the transaction is deemed valid + // and kept in memory to prevent duplicates. + google.protobuf.Timestamp timeout_timestamp = 5 + [(gogoproto.nullable) = true, (gogoproto.stdtime) = true, (cosmos_proto.field_added_in) = "cosmos-sdk 0.53"]; + // extension_options are arbitrary options that can be added by chains // when the default options are not sufficient. If any of these are present // and can't be handled, the transaction will be rejected @@ -141,14 +162,11 @@ message AuthInfo { // based on the cost of evaluating the body and doing signature verification // of the signers. This can be estimated via simulation. Fee fee = 2; - // Tip is the optional tip used for transactions fees paid in another denom. // // This field is ignored if the chain didn't enable tips, i.e. didn't add the // `TipDecorator` in its posthandler. - // - // Since: cosmos-sdk 0.46 - Tip tip = 3; + Tip tip = 3 [deprecated = true, (cosmos_proto.field_added_in) = "cosmos-sdk 0.46"]; } // SignerInfo describes the public key and signing mode of a single top-level @@ -205,31 +223,41 @@ message ModeInfo { // which must be above some miminum to be accepted into the mempool. message Fee { // amount is the amount of coins to be paid as a fee - repeated cosmos.base.v1beta1.Coin amount = 1 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; + repeated cosmos.base.v1beta1.Coin amount = 1 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (amino.dont_omitempty) = true, + (amino.encoding) = "legacy_coins" + ]; // gas_limit is the maximum gas that can be used in transaction processing // before an out of gas error occurs uint64 gas_limit = 2; - // if unset, the first signer is responsible for paying the fees. If set, the specified account must pay the fees. - // the payer must be a tx signer (and thus have signed this field in AuthInfo). - // setting this field does *not* change the ordering of required signers for the transaction. + // if unset, the first signer is responsible for paying the fees. If set, the + // specified account must pay the fees. the payer must be a tx signer (and + // thus have signed this field in AuthInfo). setting this field does *not* + // change the ordering of required signers for the transaction. string payer = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - // if set, the fee payer (either the first signer or the value of the payer field) requests that a fee grant be used - // to pay fees instead of the fee payer's own balance. If an appropriate fee grant does not exist or the chain does - // not support fee grants, this will fail + // if set, the fee payer (either the first signer or the value of the payer + // field) requests that a fee grant be used to pay fees instead of the fee + // payer's own balance. If an appropriate fee grant does not exist or the + // chain does not support fee grants, this will fail string granter = 4 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } // Tip is the tip used for meta-transactions. -// -// Since: cosmos-sdk 0.46 message Tip { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.46"; + option deprecated = true; // amount is the amount of the tip - repeated cosmos.base.v1beta1.Coin amount = 1 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; + repeated cosmos.base.v1beta1.Coin amount = 1 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (amino.dont_omitempty) = true, + (amino.encoding) = "legacy_coins" + ]; // tipper is the address of the account paying for the tip string tipper = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } @@ -238,9 +266,8 @@ message Tip { // tipper) builds and sends to the fee payer (who will build and broadcast the // actual tx). AuxSignerData is not a valid tx in itself, and will be rejected // by the node if sent directly as-is. -// -// Since: cosmos-sdk 0.46 message AuxSignerData { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.46"; // address is the bech32-encoded address of the auxiliary signer. If using // AuxSignerData across different chains, the bech32 prefix of the target // chain (where the final transaction is broadcasted) should be used. diff --git a/packages/api/proto/cosmos/upgrade/module/v1/module.proto b/packages/api/proto/cosmos/upgrade/module/v1/module.proto new file mode 100644 index 00000000..6493f5c7 --- /dev/null +++ b/packages/api/proto/cosmos/upgrade/module/v1/module.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; + +package cosmos.upgrade.module.v1; + +import "cosmos/app/v1alpha1/module.proto"; + +// Module is the config object of the upgrade module. +message Module { + option (cosmos.app.v1alpha1.module) = { + go_import: "cosmossdk.io/x/upgrade" + }; + + // authority defines the custom module authority. If not set, defaults to the governance module. + string authority = 1; +} \ No newline at end of file diff --git a/packages/api/proto/cosmos/upgrade/v1beta1/query.proto b/packages/api/proto/cosmos/upgrade/v1beta1/query.proto index 870cf9ee..a2818a26 100644 --- a/packages/api/proto/cosmos/upgrade/v1beta1/query.proto +++ b/packages/api/proto/cosmos/upgrade/v1beta1/query.proto @@ -3,8 +3,9 @@ package cosmos.upgrade.v1beta1; import "google/api/annotations.proto"; import "cosmos/upgrade/v1beta1/upgrade.proto"; +import "cosmos_proto/cosmos.proto"; -option go_package = "github.com/cosmos/cosmos-sdk/x/upgrade/types"; +option go_package = "cosmossdk.io/x/upgrade/types"; // Query defines the gRPC upgrade querier service. service Query { @@ -30,17 +31,15 @@ service Query { } // ModuleVersions queries the list of module versions from state. - // - // Since: cosmos-sdk 0.43 rpc ModuleVersions(QueryModuleVersionsRequest) returns (QueryModuleVersionsResponse) { - option (google.api.http).get = "/cosmos/upgrade/v1beta1/module_versions"; + option (cosmos_proto.method_added_in) = "cosmos-sdk 0.43"; + option (google.api.http).get = "/cosmos/upgrade/v1beta1/module_versions"; } // Returns the account with authority to conduct upgrades - // - // Since: cosmos-sdk 0.46 rpc Authority(QueryAuthorityRequest) returns (QueryAuthorityResponse) { - option (google.api.http).get = "/cosmos/upgrade/v1beta1/authority"; + option (google.api.http).get = "/cosmos/upgrade/v1beta1/authority"; + option (cosmos_proto.method_added_in) = "cosmos-sdk 0.46"; } } @@ -85,15 +84,13 @@ message QueryUpgradedConsensusStateResponse { option deprecated = true; reserved 1; - // Since: cosmos-sdk 0.43 - bytes upgraded_consensus_state = 2; + bytes upgraded_consensus_state = 2 [(cosmos_proto.field_added_in) = "cosmos-sdk 0.43"]; } // QueryModuleVersionsRequest is the request type for the Query/ModuleVersions // RPC method. -// -// Since: cosmos-sdk 0.43 message QueryModuleVersionsRequest { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.43"; // module_name is a field to query a specific module // consensus version from state. Leaving this empty will // fetch the full list of module versions from state @@ -102,21 +99,19 @@ message QueryModuleVersionsRequest { // QueryModuleVersionsResponse is the response type for the Query/ModuleVersions // RPC method. -// -// Since: cosmos-sdk 0.43 message QueryModuleVersionsResponse { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.43"; // module_versions is a list of module names with their consensus versions. repeated ModuleVersion module_versions = 1; } // QueryAuthorityRequest is the request type for Query/Authority -// -// Since: cosmos-sdk 0.46 -message QueryAuthorityRequest {} +message QueryAuthorityRequest { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.46"; +} // QueryAuthorityResponse is the response type for Query/Authority -// -// Since: cosmos-sdk 0.46 message QueryAuthorityResponse { - string address = 1; + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.46"; + string address = 1; } \ No newline at end of file diff --git a/packages/api/proto/cosmos/upgrade/v1beta1/tx.proto b/packages/api/proto/cosmos/upgrade/v1beta1/tx.proto index 7a2931da..5d3c6271 100644 --- a/packages/api/proto/cosmos/upgrade/v1beta1/tx.proto +++ b/packages/api/proto/cosmos/upgrade/v1beta1/tx.proto @@ -1,4 +1,3 @@ -// Since: cosmos-sdk 0.46 syntax = "proto3"; package cosmos.upgrade.v1beta1; @@ -6,51 +5,55 @@ import "gogoproto/gogo.proto"; import "cosmos_proto/cosmos.proto"; import "cosmos/upgrade/v1beta1/upgrade.proto"; import "cosmos/msg/v1/msg.proto"; +import "amino/amino.proto"; -option go_package = "github.com/cosmos/cosmos-sdk/x/upgrade/types"; +option go_package = "cosmossdk.io/x/upgrade/types"; // Msg defines the upgrade Msg service. service Msg { + option (cosmos.msg.v1.service) = true; + // SoftwareUpgrade is a governance operation for initiating a software upgrade. - // - // Since: cosmos-sdk 0.46 - rpc SoftwareUpgrade(MsgSoftwareUpgrade) returns (MsgSoftwareUpgradeResponse); + rpc SoftwareUpgrade(MsgSoftwareUpgrade) returns (MsgSoftwareUpgradeResponse) { + option (cosmos_proto.method_added_in) = "cosmos-sdk 0.46"; + }; + // CancelUpgrade is a governance operation for cancelling a previously - // approvid software upgrade. - // - // Since: cosmos-sdk 0.46 - rpc CancelUpgrade(MsgCancelUpgrade) returns (MsgCancelUpgradeResponse); + // approved software upgrade. + rpc CancelUpgrade(MsgCancelUpgrade) returns (MsgCancelUpgradeResponse) { + option (cosmos_proto.method_added_in) = "cosmos-sdk 0.46"; + }; } // MsgSoftwareUpgrade is the Msg/SoftwareUpgrade request type. -// -// Since: cosmos-sdk 0.46 message MsgSoftwareUpgrade { - option (cosmos.msg.v1.signer) = "authority"; + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.46"; + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "cosmos-sdk/MsgSoftwareUpgrade"; - // authority is the address of the governance account. + // authority is the address that controls the module (defaults to x/gov unless overwritten). string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // plan is the upgrade plan. - Plan plan = 2 [(gogoproto.nullable) = false]; + Plan plan = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // MsgSoftwareUpgradeResponse is the Msg/SoftwareUpgrade response type. -// -// Since: cosmos-sdk 0.46 -message MsgSoftwareUpgradeResponse {} +message MsgSoftwareUpgradeResponse { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.46"; +} // MsgCancelUpgrade is the Msg/CancelUpgrade request type. -// -// Since: cosmos-sdk 0.46 message MsgCancelUpgrade { - option (cosmos.msg.v1.signer) = "authority"; + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.46"; + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "cosmos-sdk/MsgCancelUpgrade"; - // authority is the address of the governance account. + // authority is the address that controls the module (defaults to x/gov unless overwritten). string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } // MsgCancelUpgradeResponse is the Msg/CancelUpgrade response type. -// -// Since: cosmos-sdk 0.46 -message MsgCancelUpgradeResponse {} +message MsgCancelUpgradeResponse { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.46"; +} diff --git a/packages/api/proto/cosmos/upgrade/v1beta1/upgrade.proto b/packages/api/proto/cosmos/upgrade/v1beta1/upgrade.proto index 4d19a299..9ee19354 100644 --- a/packages/api/proto/cosmos/upgrade/v1beta1/upgrade.proto +++ b/packages/api/proto/cosmos/upgrade/v1beta1/upgrade.proto @@ -5,14 +5,15 @@ import "google/protobuf/any.proto"; import "gogoproto/gogo.proto"; import "google/protobuf/timestamp.proto"; import "cosmos_proto/cosmos.proto"; +import "amino/amino.proto"; -option go_package = "github.com/cosmos/cosmos-sdk/x/upgrade/types"; +option go_package = "cosmossdk.io/x/upgrade/types"; option (gogoproto.goproto_getters_all) = false; // Plan specifies information about a planned upgrade and when it should occur. message Plan { - option (gogoproto.equal) = true; - option (gogoproto.goproto_stringer) = false; + option (amino.name) = "cosmos-sdk/Plan"; + option (gogoproto.equal) = true; // Sets the name for the upgrade. This name will be used by the upgraded // version of the software to apply any special "on-upgrade" commands during @@ -26,10 +27,10 @@ message Plan { // Deprecated: Time based upgrades have been deprecated. Time based upgrade logic // has been removed from the SDK. // If this field is not empty, an error will be thrown. - google.protobuf.Timestamp time = 2 [deprecated = true, (gogoproto.stdtime) = true, (gogoproto.nullable) = false]; + google.protobuf.Timestamp time = 2 + [deprecated = true, (gogoproto.stdtime) = true, (gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // The height at which the upgrade must be performed. - // Only used if Time is not set. int64 height = 3; // Any application specific upgrade info to be included on-chain @@ -49,12 +50,17 @@ message Plan { message SoftwareUpgradeProposal { option deprecated = true; option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content"; + option (amino.name) = "cosmos-sdk/SoftwareUpgradeProposal"; option (gogoproto.equal) = true; - option (gogoproto.goproto_stringer) = false; - string title = 1; + // title of the proposal + string title = 1; + + // description of the proposal string description = 2; - Plan plan = 3 [(gogoproto.nullable) = false]; + + // plan of the proposal + Plan plan = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // CancelSoftwareUpgradeProposal is a gov Content type for cancelling a software @@ -64,19 +70,20 @@ message SoftwareUpgradeProposal { message CancelSoftwareUpgradeProposal { option deprecated = true; option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content"; + option (amino.name) = "cosmos-sdk/CancelSoftwareUpgradeProposal"; option (gogoproto.equal) = true; - option (gogoproto.goproto_stringer) = false; - string title = 1; + // title of the proposal + string title = 1; + + // description of the proposal string description = 2; } // ModuleVersion specifies a module and its consensus version. -// -// Since: cosmos-sdk 0.43 message ModuleVersion { - option (gogoproto.equal) = true; - option (gogoproto.goproto_stringer) = true; + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.43"; + option (gogoproto.equal) = true; // name of the app module string name = 1; diff --git a/packages/api/proto/cosmos/vesting/module/v1/module.proto b/packages/api/proto/cosmos/vesting/module/v1/module.proto new file mode 100644 index 00000000..88bb89c1 --- /dev/null +++ b/packages/api/proto/cosmos/vesting/module/v1/module.proto @@ -0,0 +1,12 @@ +syntax = "proto3"; + +package cosmos.vesting.module.v1; + +import "cosmos/app/v1alpha1/module.proto"; + +// Module is the config object of the vesting module. +message Module { + option (cosmos.app.v1alpha1.module) = { + go_import: "github.com/cosmos/cosmos-sdk/x/auth/vesting" + }; +} \ No newline at end of file diff --git a/packages/api/proto/cosmos/vesting/v1beta1/tx.proto b/packages/api/proto/cosmos/vesting/v1beta1/tx.proto index 27511ba8..db8fe52d 100644 --- a/packages/api/proto/cosmos/vesting/v1beta1/tx.proto +++ b/packages/api/proto/cosmos/vesting/v1beta1/tx.proto @@ -5,40 +5,48 @@ import "gogoproto/gogo.proto"; import "cosmos/base/v1beta1/coin.proto"; import "cosmos_proto/cosmos.proto"; import "cosmos/vesting/v1beta1/vesting.proto"; - import "cosmos/msg/v1/msg.proto"; +import "amino/amino.proto"; option go_package = "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"; // Msg defines the bank Msg service. service Msg { + option (cosmos.msg.v1.service) = true; + // CreateVestingAccount defines a method that enables creating a vesting // account. rpc CreateVestingAccount(MsgCreateVestingAccount) returns (MsgCreateVestingAccountResponse); // CreatePermanentLockedAccount defines a method that enables creating a permanent // locked account. - // - // Since: cosmos-sdk 0.46 - rpc CreatePermanentLockedAccount(MsgCreatePermanentLockedAccount) returns (MsgCreatePermanentLockedAccountResponse); + rpc CreatePermanentLockedAccount(MsgCreatePermanentLockedAccount) returns (MsgCreatePermanentLockedAccountResponse) { + option (cosmos_proto.method_added_in) = "cosmos-sdk 0.46"; + }; // CreatePeriodicVestingAccount defines a method that enables creating a // periodic vesting account. - // - // Since: cosmos-sdk 0.46 - rpc CreatePeriodicVestingAccount(MsgCreatePeriodicVestingAccount) returns (MsgCreatePeriodicVestingAccountResponse); + rpc CreatePeriodicVestingAccount(MsgCreatePeriodicVestingAccount) returns (MsgCreatePeriodicVestingAccountResponse) { + option (cosmos_proto.method_added_in) = "cosmos-sdk 0.46"; + }; } // MsgCreateVestingAccount defines a message that enables creating a vesting // account. message MsgCreateVestingAccount { option (cosmos.msg.v1.signer) = "from_address"; + option (amino.name) = "cosmos-sdk/MsgCreateVestingAccount"; option (gogoproto.equal) = true; string from_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; string to_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - repeated cosmos.base.v1beta1.Coin amount = 3 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; - + repeated cosmos.base.v1beta1.Coin amount = 3 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true, + (amino.encoding) = "legacy_coins", + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; + + // end of vesting as unix time (in seconds). int64 end_time = 4; bool delayed = 5; } @@ -48,39 +56,45 @@ message MsgCreateVestingAccountResponse {} // MsgCreatePermanentLockedAccount defines a message that enables creating a permanent // locked account. -// -// Since: cosmos-sdk 0.46 message MsgCreatePermanentLockedAccount { - option (gogoproto.equal) = true; + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.46"; + option (cosmos.msg.v1.signer) = "from_address"; + option (amino.name) = "cosmos-sdk/MsgCreatePermLockedAccount"; + option (gogoproto.equal) = true; string from_address = 1 [(gogoproto.moretags) = "yaml:\"from_address\""]; string to_address = 2 [(gogoproto.moretags) = "yaml:\"to_address\""]; - repeated cosmos.base.v1beta1.Coin amount = 3 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; + repeated cosmos.base.v1beta1.Coin amount = 3 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true, + (amino.encoding) = "legacy_coins", + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; } // MsgCreatePermanentLockedAccountResponse defines the Msg/CreatePermanentLockedAccount response type. -// -// Since: cosmos-sdk 0.46 -message MsgCreatePermanentLockedAccountResponse {} +message MsgCreatePermanentLockedAccountResponse { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.46"; +} // MsgCreateVestingAccount defines a message that enables creating a vesting // account. -// -// Since: cosmos-sdk 0.46 message MsgCreatePeriodicVestingAccount { - option (cosmos.msg.v1.signer) = "from_address"; + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.46"; + option (cosmos.msg.v1.signer) = "from_address"; + option (amino.name) = "cosmos-sdk/MsgCreatePeriodVestAccount"; option (gogoproto.equal) = false; - string from_address = 1; - string to_address = 2; + string from_address = 1; + string to_address = 2; + // start of vesting as unix time (in seconds). int64 start_time = 3; - repeated Period vesting_periods = 4 [(gogoproto.nullable) = false]; + repeated Period vesting_periods = 4 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // MsgCreateVestingAccountResponse defines the Msg/CreatePeriodicVestingAccount // response type. -// -// Since: cosmos-sdk 0.46 -message MsgCreatePeriodicVestingAccountResponse {} +message MsgCreatePeriodicVestingAccountResponse { + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.46"; +} diff --git a/packages/api/proto/cosmos/vesting/v1beta1/vesting.proto b/packages/api/proto/cosmos/vesting/v1beta1/vesting.proto index 824cc30d..a766fd98 100644 --- a/packages/api/proto/cosmos/vesting/v1beta1/vesting.proto +++ b/packages/api/proto/cosmos/vesting/v1beta1/vesting.proto @@ -1,8 +1,10 @@ syntax = "proto3"; package cosmos.vesting.v1beta1; +import "amino/amino.proto"; import "gogoproto/gogo.proto"; import "cosmos/base/v1beta1/coin.proto"; +import "cosmos_proto/cosmos.proto"; import "cosmos/auth/v1beta1/auth.proto"; option go_package = "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"; @@ -10,67 +12,83 @@ option go_package = "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"; // BaseVestingAccount implements the VestingAccount interface. It contains all // the necessary fields needed for any vesting account implementation. message BaseVestingAccount { - option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = false; + option (amino.name) = "cosmos-sdk/BaseVestingAccount"; + option (gogoproto.goproto_getters) = false; cosmos.auth.v1beta1.BaseAccount base_account = 1 [(gogoproto.embed) = true]; - repeated cosmos.base.v1beta1.Coin original_vesting = 2 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; - repeated cosmos.base.v1beta1.Coin delegated_free = 3 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; - repeated cosmos.base.v1beta1.Coin delegated_vesting = 4 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; + repeated cosmos.base.v1beta1.Coin original_vesting = 2 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true, + (amino.encoding) = "legacy_coins", + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; + repeated cosmos.base.v1beta1.Coin delegated_free = 3 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true, + (amino.encoding) = "legacy_coins", + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; + repeated cosmos.base.v1beta1.Coin delegated_vesting = 4 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true, + (amino.encoding) = "legacy_coins", + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; + // Vesting end time, as unix timestamp (in seconds). int64 end_time = 5; } // ContinuousVestingAccount implements the VestingAccount interface. It // continuously vests by unlocking coins linearly with respect to time. message ContinuousVestingAccount { - option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = false; + option (amino.name) = "cosmos-sdk/ContinuousVestingAccount"; + option (gogoproto.goproto_getters) = false; BaseVestingAccount base_vesting_account = 1 [(gogoproto.embed) = true]; - int64 start_time = 2; + // Vesting start time, as unix timestamp (in seconds). + int64 start_time = 2; } // DelayedVestingAccount implements the VestingAccount interface. It vests all // coins after a specific time, but non prior. In other words, it keeps them // locked until a specified time. message DelayedVestingAccount { - option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = false; + option (amino.name) = "cosmos-sdk/DelayedVestingAccount"; + option (gogoproto.goproto_getters) = false; BaseVestingAccount base_vesting_account = 1 [(gogoproto.embed) = true]; } // Period defines a length of time and amount of coins that will vest. message Period { - option (gogoproto.goproto_stringer) = false; - + // Period duration in seconds. int64 length = 1; - repeated cosmos.base.v1beta1.Coin amount = 2 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; + repeated cosmos.base.v1beta1.Coin amount = 2 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true, + (amino.encoding) = "legacy_coins", + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; } // PeriodicVestingAccount implements the VestingAccount interface. It // periodically vests by unlocking coins during each specified period. message PeriodicVestingAccount { - option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = false; + option (amino.name) = "cosmos-sdk/PeriodicVestingAccount"; + option (gogoproto.goproto_getters) = false; BaseVestingAccount base_vesting_account = 1 [(gogoproto.embed) = true]; int64 start_time = 2; - repeated Period vesting_periods = 3 [(gogoproto.nullable) = false]; + repeated Period vesting_periods = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // PermanentLockedAccount implements the VestingAccount interface. It does // not ever release coins, locking them indefinitely. Coins in this account can // still be used for delegating and for governance votes even while locked. -// -// Since: cosmos-sdk 0.43 message PermanentLockedAccount { - option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = false; + option (cosmos_proto.message_added_in) = "cosmos-sdk 0.43"; + option (amino.name) = "cosmos-sdk/PermanentLockedAccount"; + option (gogoproto.goproto_getters) = false; BaseVestingAccount base_vesting_account = 1 [(gogoproto.embed) = true]; } diff --git a/packages/api/proto/ibc/applications/transfer/v1/authz.proto b/packages/api/proto/ibc/applications/transfer/v1/authz.proto new file mode 100644 index 00000000..278ac07a --- /dev/null +++ b/packages/api/proto/ibc/applications/transfer/v1/authz.proto @@ -0,0 +1,34 @@ +syntax = "proto3"; + +package ibc.applications.transfer.v1; + +option go_package = "github.com/cosmos/ibc-go/v10/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; + // the channel by which the packet will be sent + string source_channel = 2; + // spend limitation on the channel + repeated cosmos.base.v1beta1.Coin spend_limit = 3 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; + // allow list of receivers, an empty allow list permits any receiver address + repeated string allow_list = 4; + // allow list of memo strings, an empty list prohibits all memo strings; + // a list only with "*" permits any memo string + repeated string allowed_packet_data = 5; +} + +// TransferAuthorization allows the grantee to spend up to spend_limit coins from +// the granter's account for ibc transfer on a specific channel +message TransferAuthorization { + option (cosmos_proto.implements_interface) = "cosmos.authz.v1beta1.Authorization"; + + // port and channel amounts + repeated Allocation allocations = 1 [(gogoproto.nullable) = false]; +} \ No newline at end of file diff --git a/packages/api/proto/ibc/applications/transfer/v1/denomtrace.proto b/packages/api/proto/ibc/applications/transfer/v1/denomtrace.proto new file mode 100644 index 00000000..7396e106 --- /dev/null +++ b/packages/api/proto/ibc/applications/transfer/v1/denomtrace.proto @@ -0,0 +1,16 @@ +syntax = "proto3"; + +package ibc.applications.transfer.v1; + +option go_package = "github.com/cosmos/ibc-go/v10/modules/apps/transfer/types"; + +// DenomTrace contains the base denomination for ICS20 fungible tokens and the +// source tracing information path. +message DenomTrace { + option deprecated = true; + // path defines the chain of port/channel identifiers used for tracing the + // source of the fungible token. + string path = 1; + // base denomination of the relayed fungible token. + string base_denom = 2; +} \ No newline at end of file diff --git a/packages/api/proto/ibc/applications/transfer/v1/genesis.proto b/packages/api/proto/ibc/applications/transfer/v1/genesis.proto index c42ebc0a..d0a99e1a 100644 --- a/packages/api/proto/ibc/applications/transfer/v1/genesis.proto +++ b/packages/api/proto/ibc/applications/transfer/v1/genesis.proto @@ -2,18 +2,20 @@ syntax = "proto3"; package ibc.applications.transfer.v1; -option go_package = "github.com/cosmos/ibc-go/v5/modules/apps/transfer/types"; +option go_package = "github.com/cosmos/ibc-go/v10/modules/apps/transfer/types"; import "ibc/applications/transfer/v1/transfer.proto"; +import "ibc/applications/transfer/v1/token.proto"; +import "cosmos/base/v1beta1/coin.proto"; import "gogoproto/gogo.proto"; // GenesisState defines the ibc-transfer genesis state message GenesisState { - string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""]; - repeated DenomTrace denom_traces = 2 [ - (gogoproto.castrepeated) = "Traces", - (gogoproto.nullable) = false, - (gogoproto.moretags) = "yaml:\"denom_traces\"" - ]; - Params params = 3 [(gogoproto.nullable) = false]; + string port_id = 1; + repeated Denom denoms = 2 [(gogoproto.castrepeated) = "Denoms", (gogoproto.nullable) = false]; + ibc.applications.transfer.v1.Params params = 3 [(gogoproto.nullable) = false]; + // total_escrowed contains the total amount of tokens escrowed + // by the transfer module + repeated cosmos.base.v1beta1.Coin total_escrowed = 4 + [(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", (gogoproto.nullable) = false]; } \ No newline at end of file diff --git a/packages/api/proto/ibc/applications/transfer/v1/packet.proto b/packages/api/proto/ibc/applications/transfer/v1/packet.proto new file mode 100644 index 00000000..d12e3df7 --- /dev/null +++ b/packages/api/proto/ibc/applications/transfer/v1/packet.proto @@ -0,0 +1,21 @@ +syntax = "proto3"; + +package ibc.applications.transfer.v1; + +option go_package = "github.com/cosmos/ibc-go/v10/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; +} \ No newline at end of file diff --git a/packages/api/proto/ibc/applications/transfer/v1/query.proto b/packages/api/proto/ibc/applications/transfer/v1/query.proto index 5b877832..56736df8 100644 --- a/packages/api/proto/ibc/applications/transfer/v1/query.proto +++ b/packages/api/proto/ibc/applications/transfer/v1/query.proto @@ -3,79 +3,86 @@ syntax = "proto3"; package ibc.applications.transfer.v1; import "gogoproto/gogo.proto"; -import "cosmos/base/query/v1beta1/pagination.proto"; +import "cosmos/base/v1beta1/coin.proto"; import "ibc/applications/transfer/v1/transfer.proto"; +import "ibc/applications/transfer/v1/token.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; import "google/api/annotations.proto"; -option go_package = "github.com/cosmos/ibc-go/v5/modules/apps/transfer/types"; +option go_package = "github.com/cosmos/ibc-go/v10/modules/apps/transfer/types"; // Query provides defines the gRPC querier service. service Query { - // DenomTrace queries a denomination trace information. - rpc DenomTrace(QueryDenomTraceRequest) returns (QueryDenomTraceResponse) { - option (google.api.http).get = "/ibc/apps/transfer/v1/denom_traces/{hash}"; + // Params queries all parameters of the ibc-transfer module. + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/ibc/apps/transfer/v1/params"; } - // DenomTraces queries all denomination traces. - rpc DenomTraces(QueryDenomTracesRequest) returns (QueryDenomTracesResponse) { - option (google.api.http).get = "/ibc/apps/transfer/v1/denom_traces"; + // Denoms queries all denominations + rpc Denoms(QueryDenomsRequest) returns (QueryDenomsResponse) { + option (google.api.http).get = "/ibc/apps/transfer/v1/denoms"; } - // Params queries all parameters of the ibc-transfer module. - rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/ibc/apps/transfer/v1/params"; + // Denom queries a denomination + rpc Denom(QueryDenomRequest) returns (QueryDenomResponse) { + option (google.api.http).get = "/ibc/apps/transfer/v1/denoms/{hash=**}"; } // DenomHash queries a denomination hash information. rpc DenomHash(QueryDenomHashRequest) returns (QueryDenomHashResponse) { - option (google.api.http).get = "/ibc/apps/transfer/v1/denom_hashes/{trace}"; + 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"; } + + // TotalEscrowForDenom returns the total amount of tokens in escrow based on the denom. + rpc TotalEscrowForDenom(QueryTotalEscrowForDenomRequest) returns (QueryTotalEscrowForDenomResponse) { + option (google.api.http).get = "/ibc/apps/transfer/v1/total_escrow/{denom=**}"; + } +} + +// 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; } -// QueryDenomTraceRequest is the request type for the Query/DenomTrace RPC +// QueryDenomRequest is the request type for the Query/Denom RPC // method -message QueryDenomTraceRequest { - // hash (in hex format) or denom (full denom with ibc prefix) of the denomination trace information. +message QueryDenomRequest { + // hash (in hex format) or denom (full denom with ibc prefix) of the on chain denomination. string hash = 1; } -// QueryDenomTraceResponse is the response type for the Query/DenomTrace RPC +// QueryDenomResponse is the response type for the Query/Denom RPC // method. -message QueryDenomTraceResponse { - // denom_trace returns the requested denomination trace information. - DenomTrace denom_trace = 1; +message QueryDenomResponse { + // denom returns the requested denomination. + Denom denom = 1; } -// QueryConnectionsRequest is the request type for the Query/DenomTraces RPC +// QueryDenomsRequest is the request type for the Query/Denoms RPC // method -message QueryDenomTracesRequest { +message QueryDenomsRequest { // pagination defines an optional pagination for the request. cosmos.base.query.v1beta1.PageRequest pagination = 1; } -// QueryConnectionsResponse is the response type for the Query/DenomTraces RPC +// QueryDenomsResponse is the response type for the Query/Denoms RPC // method. -message QueryDenomTracesResponse { - // denom_traces returns all denominations trace information. - repeated DenomTrace denom_traces = 1 [(gogoproto.castrepeated) = "Traces", (gogoproto.nullable) = false]; +message QueryDenomsResponse { + // denoms returns all denominations. + repeated Denom denoms = 1 [(gogoproto.castrepeated) = "Denoms", (gogoproto.nullable) = false]; // pagination defines the pagination in the response. cosmos.base.query.v1beta1.PageResponse pagination = 2; } -// QueryParamsRequest is the request type for the Query/Params RPC method. -message QueryParamsRequest {} - -// QueryParamsResponse is the response type for the Query/Params RPC method. -message QueryParamsResponse { - // params defines the parameters of the module. - Params params = 1; -} - // QueryDenomHashRequest is the request type for the Query/DenomHash RPC // method message QueryDenomHashRequest { @@ -102,4 +109,14 @@ message QueryEscrowAddressRequest { message QueryEscrowAddressResponse { // the escrow account address string escrow_address = 1; +} + +// QueryTotalEscrowForDenomRequest is the request type for TotalEscrowForDenom RPC method. +message QueryTotalEscrowForDenomRequest { + string denom = 1; +} + +// QueryTotalEscrowForDenomResponse is the response type for TotalEscrowForDenom RPC method. +message QueryTotalEscrowForDenomResponse { + cosmos.base.v1beta1.Coin amount = 1 [(gogoproto.nullable) = false]; } \ No newline at end of file diff --git a/packages/api/proto/ibc/applications/transfer/v1/token.proto b/packages/api/proto/ibc/applications/transfer/v1/token.proto new file mode 100644 index 00000000..96b502c1 --- /dev/null +++ b/packages/api/proto/ibc/applications/transfer/v1/token.proto @@ -0,0 +1,30 @@ +syntax = "proto3"; + +package ibc.applications.transfer.v1; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/cosmos/ibc-go/v10/modules/apps/transfer/types"; + +// Token defines a struct which represents a token to be transferred. +message Token { + // the token denomination + Denom denom = 1 [(gogoproto.nullable) = false]; + // the token amount to be transferred + string amount = 2; +} + +// Denom holds the base denom of a Token and a trace of the chains it was sent through. +message Denom { + // the base token denomination + string base = 1; + // the trace of the token + repeated Hop trace = 3 [(gogoproto.nullable) = false]; +} + +// Hop defines a port ID, channel ID pair specifying a unique "hop" in a trace +message Hop { + option (gogoproto.goproto_stringer) = false; + string port_id = 1; + string channel_id = 2; +} \ No newline at end of file diff --git a/packages/api/proto/ibc/applications/transfer/v1/transfer.proto b/packages/api/proto/ibc/applications/transfer/v1/transfer.proto index 17b2b7ff..93758645 100644 --- a/packages/api/proto/ibc/applications/transfer/v1/transfer.proto +++ b/packages/api/proto/ibc/applications/transfer/v1/transfer.proto @@ -2,19 +2,7 @@ syntax = "proto3"; package ibc.applications.transfer.v1; -option go_package = "github.com/cosmos/ibc-go/v5/modules/apps/transfer/types"; - -import "gogoproto/gogo.proto"; - -// DenomTrace contains the base denomination for ICS20 fungible tokens and the -// source tracing information path. -message DenomTrace { - // path defines the chain of port/channel identifiers used for tracing the - // source of the fungible token. - string path = 1; - // base denomination of the relayed fungible token. - string base_denom = 2; -} +option go_package = "github.com/cosmos/ibc-go/v10/modules/apps/transfer/types"; // Params defines the set of IBC transfer parameters. // NOTE: To prevent a single token from being transferred, set the @@ -23,8 +11,8 @@ message DenomTrace { message Params { // send_enabled enables or disables all cross-chain token transfers from this // chain. - bool send_enabled = 1 [(gogoproto.moretags) = "yaml:\"send_enabled\""]; + bool send_enabled = 1; // receive_enabled enables or disables all cross-chain token transfers to this // chain. - bool receive_enabled = 2 [(gogoproto.moretags) = "yaml:\"receive_enabled\""]; + bool receive_enabled = 2; } \ No newline at end of file diff --git a/packages/api/proto/ibc/applications/transfer/v1/tx.proto b/packages/api/proto/ibc/applications/transfer/v1/tx.proto index 19f1d8a8..7f7e6f2c 100644 --- a/packages/api/proto/ibc/applications/transfer/v1/tx.proto +++ b/packages/api/proto/ibc/applications/transfer/v1/tx.proto @@ -2,43 +2,89 @@ syntax = "proto3"; package ibc.applications.transfer.v1; -option go_package = "github.com/cosmos/ibc-go/v5/modules/apps/transfer/types"; +option go_package = "github.com/cosmos/ibc-go/v10/modules/apps/transfer/types"; +import "amino/amino.proto"; import "gogoproto/gogo.proto"; +import "cosmos/msg/v1/msg.proto"; import "cosmos/base/v1beta1/coin.proto"; import "ibc/core/client/v1/client.proto"; +import "ibc/applications/transfer/v1/transfer.proto"; // Msg defines the ibc/transfer Msg service. service Msg { + option (cosmos.msg.v1.service) = true; + // Transfer defines a rpc handler method for MsgTransfer. rpc Transfer(MsgTransfer) returns (MsgTransferResponse); + + // UpdateParams defines a rpc handler for MsgUpdateParams. + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); } // MsgTransfer defines a msg to transfer fungible tokens (i.e Coins) between // ICS20 enabled chains. See ICS Spec here: // https://github.com/cosmos/ibc/tree/master/spec/app/ics-020-fungible-token-transfer#data-structures message MsgTransfer { - option (gogoproto.equal) = false; + option (amino.name) = "cosmos-sdk/MsgTransfer"; + option (cosmos.msg.v1.signer) = "sender"; + option (gogoproto.goproto_getters) = false; // the port on which the packet will be sent - string source_port = 1 [(gogoproto.moretags) = "yaml:\"source_port\""]; + string source_port = 1; // the channel by which the packet will be sent - string source_channel = 2 [(gogoproto.moretags) = "yaml:\"source_channel\""]; - // the tokens to be transferred - cosmos.base.v1beta1.Coin token = 3 [(gogoproto.nullable) = false]; + string source_channel = 2; + // token to be transferred + cosmos.base.v1beta1.Coin token = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // the sender address string sender = 4; // the recipient address on the destination chain string receiver = 5; // Timeout height relative to the current block height. - // The timeout is disabled when set to 0. - ibc.core.client.v1.Height timeout_height = 6 - [(gogoproto.moretags) = "yaml:\"timeout_height\"", (gogoproto.nullable) = false]; + // If you are sending with IBC v1 protocol, either timeout_height or timeout_timestamp must be set. + // If you are sending with IBC v2 protocol, timeout_timestamp must be set, and timeout_height must be omitted. + ibc.core.client.v1.Height timeout_height = 6 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // Timeout timestamp in absolute nanoseconds since unix epoch. - // The timeout is disabled when set to 0. - uint64 timeout_timestamp = 7 [(gogoproto.moretags) = "yaml:\"timeout_timestamp\""]; + // If you are sending with IBC v1 protocol, either timeout_height or timeout_timestamp must be set. + // If you are sending with IBC v2 protocol, timeout_timestamp must be set. + uint64 timeout_timestamp = 7; + // optional memo + string memo = 8; + // optional encoding + string encoding = 9; + // boolean flag to indicate if the transfer message + // is sent with the IBC v2 protocol but uses v1 channel identifiers. + // In this case, the v1 channel identifiers function as aliases to the + // underlying client ids. + // This only needs to be set if the channel IDs + // are V1 channel identifiers. + bool use_aliasing = 10 [(amino.dont_omitempty) = true]; } // MsgTransferResponse defines the Msg/Transfer response type. -message MsgTransferResponse {} \ No newline at end of file +message MsgTransferResponse { + option (gogoproto.goproto_getters) = false; + + // sequence number of the transfer packet sent + uint64 sequence = 1; +} + +// MsgUpdateParams is the Msg/UpdateParams request type. +message MsgUpdateParams { + option (cosmos.msg.v1.signer) = "signer"; + + option (gogoproto.goproto_getters) = false; + + // signer address + string signer = 1; + + // params defines the transfer parameters to update. + // + // NOTE: All parameters must be supplied. + Params params = 2 [(gogoproto.nullable) = false]; +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +message MsgUpdateParamsResponse {} \ No newline at end of file diff --git a/packages/api/proto/ibc/core/client/v1/client.proto b/packages/api/proto/ibc/core/client/v1/client.proto index d443fd0f..7014e058 100644 --- a/packages/api/proto/ibc/core/client/v1/client.proto +++ b/packages/api/proto/ibc/core/client/v1/client.proto @@ -2,20 +2,18 @@ syntax = "proto3"; package ibc.core.client.v1; -option go_package = "github.com/cosmos/ibc-go/v5/modules/core/02-client/types"; +option go_package = "github.com/cosmos/ibc-go/v10/modules/core/02-client/types"; import "gogoproto/gogo.proto"; import "google/protobuf/any.proto"; -import "cosmos/upgrade/v1beta1/upgrade.proto"; -import "cosmos_proto/cosmos.proto"; // IdentifiedClientState defines a client state with an additional client // identifier field. message IdentifiedClientState { // client identifier - string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""]; + string client_id = 1; // client state - google.protobuf.Any client_state = 2 [(gogoproto.moretags) = "yaml:\"client_state\""]; + google.protobuf.Any client_state = 2; } // ConsensusStateWithHeight defines a consensus state with an additional height @@ -24,56 +22,16 @@ message ConsensusStateWithHeight { // consensus state height Height height = 1 [(gogoproto.nullable) = false]; // consensus state - google.protobuf.Any consensus_state = 2 [(gogoproto.moretags) = "yaml:\"consensus_state\""]; + google.protobuf.Any consensus_state = 2; } // ClientConsensusStates defines all the stored consensus states for a given // client. message ClientConsensusStates { // client identifier - string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""]; + string client_id = 1; // consensus states and their heights associated with the client - repeated ConsensusStateWithHeight consensus_states = 2 - [(gogoproto.moretags) = "yaml:\"consensus_states\"", (gogoproto.nullable) = false]; -} - -// ClientUpdateProposal is a governance proposal. If it passes, the substitute -// client's latest consensus state is copied over to the subject client. The proposal -// handler may fail if the subject and the substitute do not match in client and -// chain parameters (with exception to latest height, frozen height, and chain-id). -message ClientUpdateProposal { - option (gogoproto.goproto_getters) = false; - option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content"; - // the title of the update proposal - string title = 1; - // the description of the proposal - string description = 2; - // the client identifier for the client to be updated if the proposal passes - string subject_client_id = 3 [(gogoproto.moretags) = "yaml:\"subject_client_id\""]; - // the substitute client identifier for the client standing in for the subject - // client - string substitute_client_id = 4 [(gogoproto.moretags) = "yaml:\"substitute_client_id\""]; -} - -// UpgradeProposal is a gov Content type for initiating an IBC breaking -// upgrade. -message UpgradeProposal { - option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = false; - option (gogoproto.equal) = true; - option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content"; - - string title = 1; - string description = 2; - cosmos.upgrade.v1beta1.Plan plan = 3 [(gogoproto.nullable) = false]; - - // An UpgradedClientState must be provided to perform an IBC breaking upgrade. - // This will make the chain commit to the correct upgraded (self) client state - // before the upgrade occurs, so that connecting chains can verify that the - // new upgraded client is valid by verifying a proof on the previous version - // of the chain. This will allow IBC connections to persist smoothly across - // planned chain upgrades - google.protobuf.Any upgraded_client_state = 4 [(gogoproto.moretags) = "yaml:\"upgraded_client_state\""]; + repeated ConsensusStateWithHeight consensus_states = 2 [(gogoproto.nullable) = false]; } // Height is a monotonically increasing data type @@ -86,18 +44,23 @@ message UpgradeProposal { // breaking changes In these cases, the RevisionNumber is incremented so that // height continues to be monitonically increasing even as the RevisionHeight // gets reset +// +// Please note that json tags for generated Go code are overridden to explicitly exclude the omitempty jsontag. +// This enforces the Go json marshaller to always emit zero values for both revision_number and revision_height. message Height { option (gogoproto.goproto_getters) = false; option (gogoproto.goproto_stringer) = false; // the revision that the client is currently on - uint64 revision_number = 1 [(gogoproto.moretags) = "yaml:\"revision_number\""]; + uint64 revision_number = 1 [(gogoproto.jsontag) = "revision_number"]; // the height within the given revision - uint64 revision_height = 2 [(gogoproto.moretags) = "yaml:\"revision_height\""]; + uint64 revision_height = 2 [(gogoproto.jsontag) = "revision_height"]; } // Params defines the set of IBC light client parameters. message Params { - // allowed_clients defines the list of allowed client state types. - repeated string allowed_clients = 1 [(gogoproto.moretags) = "yaml:\"allowed_clients\""]; + // allowed_clients defines the list of allowed client state types which can be created + // and interacted with. If a client type is removed from the allowed clients list, usage + // of this client will be disabled until it is added again to the list. + repeated string allowed_clients = 1; } \ No newline at end of file diff --git a/packages/api/proto/ibc/core/client/v1/genesis.proto b/packages/api/proto/ibc/core/client/v1/genesis.proto index 437d2050..1e9ddc22 100644 --- a/packages/api/proto/ibc/core/client/v1/genesis.proto +++ b/packages/api/proto/ibc/core/client/v1/genesis.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.client.v1; -option go_package = "github.com/cosmos/ibc-go/v5/modules/core/02-client/types"; +option go_package = "github.com/cosmos/ibc-go/v10/modules/core/02-client/types"; import "ibc/core/client/v1/client.proto"; import "gogoproto/gogo.proto"; @@ -13,23 +13,20 @@ message GenesisState { repeated IdentifiedClientState clients = 1 [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "IdentifiedClientStates"]; // consensus states from each client - repeated ClientConsensusStates clients_consensus = 2 [ - (gogoproto.nullable) = false, - (gogoproto.castrepeated) = "ClientsConsensusStates", - (gogoproto.moretags) = "yaml:\"clients_consensus\"" - ]; + repeated ClientConsensusStates clients_consensus = 2 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "ClientsConsensusStates"]; // metadata from each client - repeated IdentifiedGenesisMetadata clients_metadata = 3 - [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"clients_metadata\""]; - Params params = 4 [(gogoproto.nullable) = false]; - // create localhost on initialization - bool create_localhost = 5 [(gogoproto.moretags) = "yaml:\"create_localhost\""]; + repeated IdentifiedGenesisMetadata clients_metadata = 3 [(gogoproto.nullable) = false]; + Params params = 4 [(gogoproto.nullable) = false]; + // Deprecated: create_localhost has been deprecated. + // The localhost client is automatically created at genesis. + bool create_localhost = 5 [deprecated = true]; // the sequence for the next generated client identifier - uint64 next_client_sequence = 6 [(gogoproto.moretags) = "yaml:\"next_client_sequence\""]; + uint64 next_client_sequence = 6; } -// GenesisMetadata defines the genesis type for metadata that clients may return -// with ExportMetadata +// GenesisMetadata defines the genesis type for metadata that will be used +// to export all client store keys that are not client or consensus states. message GenesisMetadata { option (gogoproto.goproto_getters) = false; @@ -42,7 +39,6 @@ message GenesisMetadata { // IdentifiedGenesisMetadata has the client metadata with the corresponding // client id. message IdentifiedGenesisMetadata { - string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""]; - repeated GenesisMetadata client_metadata = 2 - [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"client_metadata\""]; + string client_id = 1; + repeated GenesisMetadata client_metadata = 2 [(gogoproto.nullable) = false]; } \ No newline at end of file diff --git a/packages/api/proto/ibc/core/client/v1/query.proto b/packages/api/proto/ibc/core/client/v1/query.proto index 10ea9487..a568486a 100644 --- a/packages/api/proto/ibc/core/client/v1/query.proto +++ b/packages/api/proto/ibc/core/client/v1/query.proto @@ -2,10 +2,12 @@ syntax = "proto3"; package ibc.core.client.v1; -option go_package = "github.com/cosmos/ibc-go/v5/modules/core/02-client/types"; +option go_package = "github.com/cosmos/ibc-go/v10/modules/core/02-client/types"; import "cosmos/base/query/v1beta1/pagination.proto"; +import "cosmos/query/v1/query.proto"; import "ibc/core/client/v1/client.proto"; +import "ibc/core/commitment/v2/commitment.proto"; import "google/protobuf/any.proto"; import "google/api/annotations.proto"; import "gogoproto/gogo.proto"; @@ -46,9 +48,14 @@ service Query { option (google.api.http).get = "/ibc/core/client/v1/client_status/{client_id}"; } - // ClientParams queries all parameters of the ibc client. + // ClientParams queries all parameters of the ibc client submodule. rpc ClientParams(QueryClientParamsRequest) returns (QueryClientParamsResponse) { - option (google.api.http).get = "/ibc/client/v1/params"; + option (google.api.http).get = "/ibc/core/client/v1/params"; + } + + // ClientCreator queries the creator of a given client. + rpc ClientCreator(QueryClientCreatorRequest) returns (QueryClientCreatorResponse) { + option (google.api.http).get = "/ibc/core/client/v1/client_creator/{client_id}"; } // UpgradedClientState queries an Upgraded IBC light client. @@ -60,6 +67,15 @@ service Query { rpc UpgradedConsensusState(QueryUpgradedConsensusStateRequest) returns (QueryUpgradedConsensusStateResponse) { option (google.api.http).get = "/ibc/core/client/v1/upgraded_consensus_states"; } + + // VerifyMembership queries an IBC light client for proof verification of a value at a given key path. + rpc VerifyMembership(QueryVerifyMembershipRequest) returns (QueryVerifyMembershipResponse) { + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http) = { + post: "/ibc/core/client/v1/verify_membership" + body: "*" + }; + } } // QueryClientStateRequest is the request type for the Query/ClientState RPC @@ -108,7 +124,7 @@ message QueryConsensusStateRequest { uint64 revision_number = 2; // consensus state revision height uint64 revision_height = 3; - // latest_height overrrides the height field and queries the latest stored + // latest_height overrides the height field and queries the latest stored // ConsensusState bool latest_height = 4; } @@ -184,6 +200,20 @@ message QueryClientParamsResponse { Params params = 1; } +// QueryClientCreatorRequest is the request type for the Query/ClientCreator RPC +// method. +message QueryClientCreatorRequest { + // client unique identifier + string client_id = 1; +} + +// QueryClientCreatorResponse is the response type for the Query/ClientCreator RPC +// method. +message QueryClientCreatorResponse { + // creator of the client + string creator = 1; +} + // QueryUpgradedClientStateRequest is the request type for the // Query/UpgradedClientState RPC method message QueryUpgradedClientStateRequest {} @@ -204,4 +234,30 @@ message QueryUpgradedConsensusStateRequest {} message QueryUpgradedConsensusStateResponse { // Consensus state associated with the request identifier google.protobuf.Any upgraded_consensus_state = 1; +} + +// QueryVerifyMembershipRequest is the request type for the Query/VerifyMembership RPC method +message QueryVerifyMembershipRequest { + // client unique identifier. + string client_id = 1; + // the proof to be verified by the client. + bytes proof = 2; + // the height of the commitment root at which the proof is verified. + ibc.core.client.v1.Height proof_height = 3 [(gogoproto.nullable) = false]; + // reserved: deprecated field. + reserved 4; + // the value which is proven. + bytes value = 5; + // optional time delay + uint64 time_delay = 6; + // optional block delay + uint64 block_delay = 7; + // the commitment key path. + ibc.core.commitment.v2.MerklePath merkle_path = 8 [(gogoproto.nullable) = false]; +} + +// QueryVerifyMembershipResponse is the response type for the Query/VerifyMembership RPC method +message QueryVerifyMembershipResponse { + // boolean indicating success or failure of proof verification. + bool success = 1; } \ No newline at end of file diff --git a/packages/api/proto/ibc/core/client/v1/tx.proto b/packages/api/proto/ibc/core/client/v1/tx.proto index ae225f43..d714ec31 100644 --- a/packages/api/proto/ibc/core/client/v1/tx.proto +++ b/packages/api/proto/ibc/core/client/v1/tx.proto @@ -2,13 +2,19 @@ syntax = "proto3"; package ibc.core.client.v1; -option go_package = "github.com/cosmos/ibc-go/v5/modules/core/02-client/types"; +option go_package = "github.com/cosmos/ibc-go/v10/modules/core/02-client/types"; +import "amino/amino.proto"; +import "cosmos/msg/v1/msg.proto"; +import "cosmos/upgrade/v1beta1/upgrade.proto"; import "gogoproto/gogo.proto"; import "google/protobuf/any.proto"; +import "ibc/core/client/v1/client.proto"; // Msg defines the ibc/client Msg service. service Msg { + option (cosmos.msg.v1.service) = true; + // CreateClient defines a rpc handler method for MsgCreateClient. rpc CreateClient(MsgCreateClient) returns (MsgCreateClientResponse); @@ -18,35 +24,50 @@ service Msg { // 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); + // RecoverClient defines a rpc handler method for MsgRecoverClient. + rpc RecoverClient(MsgRecoverClient) returns (MsgRecoverClientResponse); + + // IBCSoftwareUpgrade defines a rpc handler method for MsgIBCSoftwareUpgrade. + rpc IBCSoftwareUpgrade(MsgIBCSoftwareUpgrade) returns (MsgIBCSoftwareUpgradeResponse); + + // UpdateClientParams defines a rpc handler method for MsgUpdateParams. + rpc UpdateClientParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); + + // DeleteClientCreator defines a rpc handler method for MsgDeleteClientCreator. + rpc DeleteClientCreator(MsgDeleteClientCreator) returns (MsgDeleteClientCreatorResponse); } // MsgCreateClient defines a message to create an IBC client message MsgCreateClient { - option (gogoproto.equal) = false; + option (cosmos.msg.v1.signer) = "signer"; + option (gogoproto.goproto_getters) = false; // light client state - google.protobuf.Any client_state = 1 [(gogoproto.moretags) = "yaml:\"client_state\""]; + google.protobuf.Any client_state = 1; // consensus state associated with the client that corresponds to a given // height. - google.protobuf.Any consensus_state = 2 [(gogoproto.moretags) = "yaml:\"consensus_state\""]; + google.protobuf.Any consensus_state = 2; // signer address string signer = 3; } // MsgCreateClientResponse defines the Msg/CreateClient response type. -message MsgCreateClientResponse {} +message MsgCreateClientResponse { + option (gogoproto.goproto_getters) = false; + + string client_id = 1; +} // MsgUpdateClient defines an sdk.Msg to update a IBC client state using // the given client message. message MsgUpdateClient { - option (gogoproto.equal) = false; + option (cosmos.msg.v1.signer) = "signer"; + option (gogoproto.goproto_getters) = false; // client unique identifier - string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""]; + string client_id = 1; // client message to update the light client google.protobuf.Any client_message = 2; // signer address @@ -59,20 +80,21 @@ message MsgUpdateClientResponse {} // MsgUpgradeClient defines an sdk.Msg to upgrade an IBC client to a new client // state message MsgUpgradeClient { - option (gogoproto.equal) = false; + option (cosmos.msg.v1.signer) = "signer"; + option (gogoproto.goproto_getters) = false; // client unique identifier - string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""]; + string client_id = 1; // upgraded client state - google.protobuf.Any client_state = 2 [(gogoproto.moretags) = "yaml:\"client_state\""]; + google.protobuf.Any client_state = 2; // upgraded consensus state, only contains enough information to serve as a // basis of trust in update logic - google.protobuf.Any consensus_state = 3 [(gogoproto.moretags) = "yaml:\"consensus_state\""]; + google.protobuf.Any consensus_state = 3; // proof that old chain committed to new client - bytes proof_upgrade_client = 4 [(gogoproto.moretags) = "yaml:\"proof_upgrade_client\""]; + bytes proof_upgrade_client = 4; // proof that old chain committed to new consensus state - bytes proof_upgrade_consensus_state = 5 [(gogoproto.moretags) = "yaml:\"proof_upgrade_consensus_state\""]; + bytes proof_upgrade_consensus_state = 5; // signer address string signer = 6; } @@ -80,21 +102,74 @@ message MsgUpgradeClient { // MsgUpgradeClientResponse defines the Msg/UpgradeClient response type. message MsgUpgradeClientResponse {} -// MsgSubmitMisbehaviour defines an sdk.Msg type that submits Evidence for -// light client misbehaviour. -// Warning: DEPRECATED -message MsgSubmitMisbehaviour { - option (gogoproto.equal) = false; +// MsgRecoverClient defines the message used to recover a frozen or expired client. +message MsgRecoverClient { + option (amino.name) = "cosmos-sdk/MsgRecoverClient"; option (gogoproto.goproto_getters) = false; + option (cosmos.msg.v1.signer) = "signer"; - // client unique identifier - string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\"", deprecated = true]; - // misbehaviour used for freezing the light client - google.protobuf.Any misbehaviour = 2 [deprecated = true]; + // the client identifier for the client to be updated if the proposal passes + string subject_client_id = 1; + // the substitute client identifier for the client which will replace the subject + // client + string substitute_client_id = 2; + + // signer address + string signer = 3; +} + +// MsgRecoverClientResponse defines the Msg/RecoverClient response type. +message MsgRecoverClientResponse {} + +// MsgIBCSoftwareUpgrade defines the message used to schedule an upgrade of an IBC client using a v1 governance proposal +message MsgIBCSoftwareUpgrade { + option (cosmos.msg.v1.signer) = "signer"; + cosmos.upgrade.v1beta1.Plan plan = 1 [(gogoproto.nullable) = false]; + // An UpgradedClientState must be provided to perform an IBC breaking upgrade. + // This will make the chain commit to the correct upgraded (self) client state + // before the upgrade occurs, so that connecting chains can verify that the + // new upgraded client is valid by verifying a proof on the previous version + // of the chain. This will allow IBC connections to persist smoothly across + // planned chain upgrades. Correspondingly, the UpgradedClientState field has been + // deprecated in the Cosmos SDK to allow for this logic to exist solely in + // the 02-client module. + google.protobuf.Any upgraded_client_state = 2; + // signer address + string signer = 3; +} + +// MsgIBCSoftwareUpgradeResponse defines the Msg/IBCSoftwareUpgrade response type. +message MsgIBCSoftwareUpgradeResponse {} + +// MsgUpdateParams defines the sdk.Msg type to update the client parameters. +message MsgUpdateParams { + option (cosmos.msg.v1.signer) = "signer"; + + option (gogoproto.goproto_getters) = false; + + // signer address + string signer = 1; + + // params defines the client parameters to update. + // + // NOTE: All parameters must be supplied. + Params params = 2 [(gogoproto.nullable) = false]; +} + +// MsgUpdateParamsResponse defines the MsgUpdateParams response type. +message MsgUpdateParamsResponse {} + +// MsgDeleteClientCreator defines a message to delete the client creator of a client +message MsgDeleteClientCreator { + option (cosmos.msg.v1.signer) = "signer"; + + option (gogoproto.goproto_getters) = false; + + // client identifier + string client_id = 1; // signer address - string signer = 3 [deprecated = true]; + string signer = 2; } -// MsgSubmitMisbehaviourResponse defines the Msg/SubmitMisbehaviour response -// type. -message MsgSubmitMisbehaviourResponse {} \ No newline at end of file +// MsgDeleteClientCreatorResponse defines the Msg/DeleteClientCreator response type. +message MsgDeleteClientCreatorResponse {} \ No newline at end of file diff --git a/packages/api/proto/ibc/core/commitment/v2/commitment.proto b/packages/api/proto/ibc/core/commitment/v2/commitment.proto new file mode 100644 index 00000000..24735586 --- /dev/null +++ b/packages/api/proto/ibc/core/commitment/v2/commitment.proto @@ -0,0 +1,40 @@ +syntax = "proto3"; + +package ibc.core.commitment.v2; + +option go_package = "github.com/cosmos/ibc-go/v10/modules/core/23-commitment/types/v2"; + +// MerklePath is the path used to verify commitment proofs, which can be an +// arbitrary structured object (defined by a commitment type). +// ICS-23 verification supports membership proofs for nested merkle trees. +// The ICS-24 standard provable keys MUST be stored in the lowest level tree with an optional prefix. +// The IC24 provable tree may then be stored in a higher level tree(s) that hash up to the root hash +// stored in the consensus state of the client. +// Each element of the path represents the key of a merkle tree from the root to the leaf. +// The elements of the path before the final element must be the path to the tree that contains +// the ICS24 provable store. Thus, it should remain constant for all ICS24 proofs. +// The final element of the path is the key of the leaf in the ICS24 provable store, +// Thus IBC core will append the ICS24 path to the final element of the MerklePath +// stored in the counterparty to create the full path to the leaf for proof verification. +// Examples: +// Cosmos SDK: +// The Cosmos SDK commits to a multi-tree where each store is an IAVL tree and all store hashes +// are hashed in a simple merkle tree to get the final root hash. Thus, the MerklePath in the counterparty +// MerklePrefix has the following structure: ["ibc", ""] +// The core IBC handler will append the ICS24 path to the final element of the MerklePath +// like so: ["ibc", "{packetCommitmentPath}"] which will then be used for final verification. +// Ethereum: +// The Ethereum client commits to a single Patricia merkle trie. The ICS24 provable store is managed +// by the smart contract state. Each smart contract has a specific prefix reserved within the global trie. +// Thus the MerklePath in the counterparty is the prefix to the smart contract state in the global trie. +// Since there is only one tree in the commitment structure of ethereum the MerklePath in the counterparty +// MerklePrefix has the following structure: ["IBCCoreContractAddressStoragePrefix"] +// The core IBC handler will append the ICS24 path to the final element of the MerklePath +// like so: ["IBCCoreContractAddressStoragePrefix{packetCommitmentPath}"] which will then be used for final +// verification. Thus the MerklePath in the counterparty MerklePrefix is the nested key path from the root hash of the +// consensus state down to the ICS24 provable store. The IBC handler retrieves the counterparty key path to the ICS24 +// provable store from the MerklePath and appends the ICS24 path to get the final key path to the value being verified +// by the client against the root hash in the client's consensus state. +message MerklePath { + repeated bytes key_path = 1; +} \ No newline at end of file diff --git a/packages/api/proto/regen/app/v1alpha1/module.proto b/packages/api/proto/regen/app/v1alpha1/module.proto new file mode 100644 index 00000000..45a22791 --- /dev/null +++ b/packages/api/proto/regen/app/v1alpha1/module.proto @@ -0,0 +1,92 @@ +syntax = "proto3"; + +package regen.app.v1alpha1; + +import "google/protobuf/descriptor.proto"; + +extend google.protobuf.MessageOptions { + // module indicates that this proto type is a config object for an app module + // and optionally provides other descriptive information about the module. + // It is recommended that a new module config object and go module is versioned + // for every state machine breaking version of a module. The recommended + // pattern for doing this is to put module config objects in a separate proto + // package from the API they expose. Ex: the cosmos.group.v1 API would be + // exposed by module configs cosmos.group.module.v1, cosmos.group.module.v2, etc. + ModuleDescriptor module = 57193479; +} + +// ModuleDescriptor describes an app module. +message ModuleDescriptor { + // go_import names the package that should be imported by an app to load the + // module in the runtime module registry. Either go_import must be defined here + // or the go_package option must be defined at the file level to indicate + // to users where to location the module implementation. go_import takes + // precedence over go_package when both are defined. + string go_import = 1; + + // use_package refers to a protobuf package that this module + // uses and exposes to the world. In an app, only one module should "use" + // or own a single protobuf package. It is assumed that the module uses + // all of the .proto files in a single package. + repeated PackageReference use_package = 2; + + // can_migrate_from defines which module versions this module can migrate + // state from. The framework will check that one module version is able to + // migrate from a previous module version before attempting to update its + // config. It is assumed that modules can transitively migrate from earlier + // versions. For instance if v3 declares it can migrate from v2, and v2 + // declares it can migrate from v1, the framework knows how to migrate + // from v1 to v3, assuming all 3 module versions are registered at runtime. + repeated MigrateFromInfo can_migrate_from = 3; +} + +// PackageReference is a reference to a protobuf package used by a module. +message PackageReference { + // name is the fully-qualified name of the package. + string name = 1; + + // revision is the optional revision of the package that is being used. + // Protobuf packages used in Cosmos should generally have a major version + // as the last part of the package name, ex. foo.bar.baz.v1. + // The revision of a package can be thought of as the minor version of a + // package which has additional backwards compatible definitions that weren't + // present in a previous version. + // + // A package should indicate its revision with a source code comment + // above the package declaration in one of its files containing the + // text "Revision N" where N is an integer revision. All packages start + // at revision 0 the first time they are released in a module. + // + // When a new version of a module is released and items are added to existing + // .proto files, these definitions should contain comments of the form + // "Since Revision N" where N is an integer revision. + // + // When the module runtime starts up, it will check the pinned proto + // image and panic if there are runtime protobuf definitions that are not + // in the pinned descriptor which do not have + // a "Since Revision N" comment or have a "Since Revision N" comment where + // N is <= to the revision specified here. This indicates that the protobuf + // files have been updated, but the pinned file descriptor hasn't. + // + // If there are items in the pinned file descriptor with a revision + // greater than the value indicated here, this will also cause a panic + // as it may mean that the pinned descriptor for a legacy module has been + // improperly updated or that there is some other versioning discrepancy. + // Runtime protobuf definitions will also be checked for compatibility + // with pinned file descriptors to make sure there are no incompatible changes. + // + // This behavior ensures that: + // * pinned proto images are up-to-date + // * protobuf files are carefully annotated with revision comments which + // are important good client UX + // * protobuf files are changed in backwards and forwards compatible ways + uint32 revision = 2; +} + +// MigrateFromInfo is information on a module version that a newer module +// can migrate from. +message MigrateFromInfo { + // module is the fully-qualified protobuf name of the module config object + // for the previous module version, ex: "cosmos.group.module.v1.Module". + string module = 1; +} diff --git a/packages/api/proto/regen/data/v1/query.proto b/packages/api/proto/regen/data/v1/query.proto index 0ab9343c..133033a8 100644 --- a/packages/api/proto/regen/data/v1/query.proto +++ b/packages/api/proto/regen/data/v1/query.proto @@ -14,7 +14,6 @@ service Query { rpc AnchorByIRI(QueryAnchorByIRIRequest) returns (QueryAnchorByIRIResponse) { option (google.api.http) = { get : "/regen/data/v1/anchor-by-iri/{iri}" - // additional_bindings : [ {get : "/regen/data/v1/anchors/iri/{iri}"} ] }; } @@ -24,9 +23,6 @@ service Query { option (google.api.http) = { post : "/regen/data/v1/anchor-by-hash" body : "*" - // additional_bindings : [ - // {post : "/regen/data/v1/anchors/hash" body : "*"} - // ] }; } @@ -35,9 +31,6 @@ service Query { returns (QueryAttestationsByAttestorResponse) { option (google.api.http) = { get : "/regen/data/v1/attestations-by-attestor/{attestor}" - // additional_bindings : [ - // {get : "/regen/data/v1/attestations/attestor/{attestor}"} - // ] }; } @@ -46,7 +39,6 @@ service Query { returns (QueryAttestationsByIRIResponse) { option (google.api.http) = { get : "/regen/data/v1/attestations-by-iri/{iri}" - // additional_bindings : [ {get : "/regen/data/v1/attestations/iri/{iri}"} ] }; } @@ -57,9 +49,6 @@ service Query { option (google.api.http) = { post : "/regen/data/v1/attestations-by-hash" body : "*" - // additional_bindings : [ - // {post : "/regen/data/v1/attestations/hash" body : "*"} - // ] }; } @@ -67,7 +56,6 @@ service Query { rpc Resolver(QueryResolverRequest) returns (QueryResolverResponse) { option (google.api.http) = { get : "/regen/data/v1/resolver/{id}" - // additional_bindings : [ {get : "/regen/data/v1/resolvers/{id}"} ] }; } @@ -77,7 +65,6 @@ service Query { returns (QueryResolversByIRIResponse) { option (google.api.http) = { get : "/regen/data/v1/resolvers-by-iri/{iri}" - // additional_bindings : [ {get : "/regen/data/v1/resolvers/iri/{iri}"} ] }; } @@ -88,9 +75,6 @@ service Query { option (google.api.http) = { post : "/regen/data/v1/resolvers-by-hash" body : "*" - // additional_bindings : [ - // {post : "/regen/data/v1/resolvers/hash" body : "*"} - // ] }; } @@ -100,9 +84,6 @@ service Query { option (google.api.http) = { post : "/regen/data/v1/resolvers-by-url" body : "*" - // additional_bindings : [ - // {post : "/regen/data/v1/resolvers/url" body : "*"} - // ] }; } diff --git a/packages/api/proto/regen/data/v1/state.proto b/packages/api/proto/regen/data/v1/state.proto index 1501866d..d58bbb5a 100644 --- a/packages/api/proto/regen/data/v1/state.proto +++ b/packages/api/proto/regen/data/v1/state.proto @@ -2,15 +2,19 @@ syntax = "proto3"; package regen.data.v1; -import "cosmos/orm/v1/orm.proto"; import "google/protobuf/timestamp.proto"; +import "regen/orm/v1/orm.proto"; // DataID stores a compact data ID and its full IRI. message DataID { - option (cosmos.orm.v1.table) = { - id : 1 - primary_key : {fields : "id"} - index : {id : 1, fields : "iri", unique : true} + option (regen.orm.v1.table) = { + id: 1 + primary_key: {fields: "id"} + index: { + id: 1 + fields: "iri" + unique: true + } }; // id is the compact automatically-generated data ID. @@ -22,9 +26,9 @@ message DataID { // DataAnchor stores the anchor timestamp for a data object. message DataAnchor { - option (cosmos.orm.v1.table) = { - id : 2 - primary_key : {fields : "id"} + option (regen.orm.v1.table) = { + id: 2 + primary_key: {fields: "id"} }; // id is the compact data ID. @@ -37,10 +41,13 @@ message DataAnchor { // DataAttestor is a join table for associating data IDs and attestors. message DataAttestor { - option (cosmos.orm.v1.table) = { - id : 3 - primary_key : {fields : "id,attestor"} - index : {id : 1, fields : "attestor"} + option (regen.orm.v1.table) = { + id: 3 + primary_key: {fields: "id,attestor"} + index: { + id: 1 + fields: "attestor" + } }; // id is the compact data ID. @@ -55,11 +62,21 @@ message DataAttestor { // Resolver describes a data resolver. message Resolver { - option (cosmos.orm.v1.table) = { - id : 4 - primary_key : {fields : "id", auto_increment : true} - index : {id : 1, fields : "url"} - index : {id : 2, fields : "url,manager", unique : true} + option (regen.orm.v1.table) = { + id: 4 + primary_key: { + fields: "id" + auto_increment: true + } + index: { + id: 1 + fields: "url" + } + index: { + id: 2 + fields: "url,manager" + unique: true + } }; // id is the ID of the resolver. @@ -76,9 +93,9 @@ message Resolver { // DataResolver is a join table between data objects and resolvers and indicates // that a resolver claims to be able to resolve this data object. message DataResolver { - option (cosmos.orm.v1.table) = { - id : 5 - primary_key : {fields : "id,resolver_id"} + option (regen.orm.v1.table) = { + id: 5 + primary_key: {fields: "id,resolver_id"} }; // id is the compact data ID. diff --git a/packages/api/proto/regen/data/v1/tx.proto b/packages/api/proto/regen/data/v1/tx.proto index 6ca096ae..9ac78ae9 100644 --- a/packages/api/proto/regen/data/v1/tx.proto +++ b/packages/api/proto/regen/data/v1/tx.proto @@ -8,6 +8,7 @@ import "regen/data/v1/types.proto"; // Msg is the regen.data.v1 Msg service service Msg { + option (cosmos.msg.v1.service) = true; // Anchor "anchors" a piece of data to the blockchain based on its secure // hash, effectively providing a tamper resistant timestamp. diff --git a/packages/api/proto/regen/data/v2/query.proto b/packages/api/proto/regen/data/v2/query.proto index baec70d9..ee73fb9f 100644 --- a/packages/api/proto/regen/data/v2/query.proto +++ b/packages/api/proto/regen/data/v2/query.proto @@ -16,7 +16,6 @@ service Query { rpc AnchorByIRI(QueryAnchorByIRIRequest) returns (QueryAnchorByIRIResponse) { option (google.api.http) = { get : "/regen/data/v2/anchor-by-iri/{iri}" - // additional_bindings : [ {get : "/regen/data/v2/anchors/iri/{iri}"} ] }; } @@ -26,9 +25,6 @@ service Query { option (google.api.http) = { post : "/regen/data/v2/anchor-by-hash" body : "*" - // additional_bindings : [ - // {post : "/regen/data/v2/anchors/hash" body : "*"} - // ] }; } @@ -37,9 +33,6 @@ service Query { returns (QueryAttestationsByAttestorResponse) { option (google.api.http) = { get : "/regen/data/v2/attestations-by-attestor/{attestor}" - // additional_bindings : [ - // {get : "/regen/data/v2/attestations/attestor/{attestor}"} - // ] }; } @@ -48,7 +41,6 @@ service Query { returns (QueryAttestationsByIRIResponse) { option (google.api.http) = { get : "/regen/data/v2/attestations-by-iri/{iri}" - // additional_bindings : [ {get : "/regen/data/v2/attestations/iri/{iri}"} ] }; } @@ -59,9 +51,6 @@ service Query { option (google.api.http) = { post : "/regen/data/v2/attestations-by-hash" body : "*" - // additional_bindings : [ - // {post : "/regen/data/v2/attestations/hash" body : "*"} - // ] }; } @@ -69,7 +58,6 @@ service Query { rpc Resolver(QueryResolverRequest) returns (QueryResolverResponse) { option (google.api.http) = { get : "/regen/data/v2/resolver/{id}" - // additional_bindings : [ {get : "/regen/data/v2/resolvers/{id}"} ] }; } @@ -79,7 +67,6 @@ service Query { returns (QueryResolversByIRIResponse) { option (google.api.http) = { get : "/regen/data/v2/resolvers-by-iri/{iri}" - // additional_bindings : [ {get : "/regen/data/v2/resolvers/iri/{iri}"} ] }; } @@ -90,9 +77,6 @@ service Query { option (google.api.http) = { post : "/regen/data/v2/resolvers-by-hash" body : "*" - // additional_bindings : [ - // {post : "/regen/data/v2/resolvers/hash" body : "*"} - // ] }; } @@ -102,9 +86,6 @@ service Query { option (google.api.http) = { post : "/regen/data/v2/resolvers-by-url" body : "*" - // additional_bindings : [ - // {post : "/regen/data/v2/resolvers/url" body : "*"} - // ] }; } diff --git a/packages/api/proto/regen/data/v2/state.proto b/packages/api/proto/regen/data/v2/state.proto index d0fc45a1..9ae7f0d7 100644 --- a/packages/api/proto/regen/data/v2/state.proto +++ b/packages/api/proto/regen/data/v2/state.proto @@ -2,17 +2,21 @@ syntax = "proto3"; package regen.data.v2; -import "cosmos/orm/v1/orm.proto"; import "google/protobuf/timestamp.proto"; +import "regen/orm/v1/orm.proto"; option go_package = "github.com/regen-network/regen-ledger/x/data"; // DataID stores a compact data ID and its full IRI. message DataID { - option (cosmos.orm.v1.table) = { - id : 1 - primary_key : {fields : "id"} - index : {id : 1, fields : "iri", unique : true} + option (regen.orm.v1.table) = { + id: 1 + primary_key: {fields: "id"} + index: { + id: 1 + fields: "iri" + unique: true + } }; // id is the compact automatically-generated data ID. @@ -24,9 +28,9 @@ message DataID { // DataAnchor stores the anchor timestamp for a data object. message DataAnchor { - option (cosmos.orm.v1.table) = { - id : 2 - primary_key : {fields : "id"} + option (regen.orm.v1.table) = { + id: 2 + primary_key: {fields: "id"} }; // id is the compact data ID. @@ -39,10 +43,13 @@ message DataAnchor { // DataAttestor is a join table for associating data IDs and attestors. message DataAttestor { - option (cosmos.orm.v1.table) = { - id : 3 - primary_key : {fields : "id,attestor"} - index : {id : 1, fields : "attestor"} + option (regen.orm.v1.table) = { + id: 3 + primary_key: {fields: "id,attestor"} + index: { + id: 1 + fields: "attestor" + } }; // id is the compact data ID. @@ -57,11 +64,21 @@ message DataAttestor { // Resolver describes a data resolver. message Resolver { - option (cosmos.orm.v1.table) = { - id : 4 - primary_key : {fields : "id", auto_increment : true} - index : {id : 1, fields : "url"} - index : {id : 2, fields : "url,manager", unique : true} + option (regen.orm.v1.table) = { + id: 4 + primary_key: { + fields: "id" + auto_increment: true + } + index: { + id: 1 + fields: "url" + } + index: { + id: 2 + fields: "url,manager" + unique: true + } }; // id is the ID of the resolver. @@ -78,9 +95,9 @@ message Resolver { // DataResolver is a join table between data objects and resolvers and indicates // that a resolver claims to be able to resolve this data object. message DataResolver { - option (cosmos.orm.v1.table) = { - id : 5 - primary_key : {fields : "id,resolver_id"} + option (regen.orm.v1.table) = { + id: 5 + primary_key: {fields: "id,resolver_id"} }; // id is the compact data ID. diff --git a/packages/api/proto/regen/data/v2/tx.proto b/packages/api/proto/regen/data/v2/tx.proto index de50ecb9..78b1226a 100644 --- a/packages/api/proto/regen/data/v2/tx.proto +++ b/packages/api/proto/regen/data/v2/tx.proto @@ -10,6 +10,8 @@ option go_package = "github.com/regen-network/regen-ledger/x/data"; // Msg is the regen.data.v1 Msg service service Msg { + option (cosmos.msg.v1.service) = true; + // Anchor "anchors" a piece of data to the blockchain based on its secure // hash, effectively providing a tamper resistant timestamp. diff --git a/packages/api/proto/regen/ecocredit/basket/v1/query.proto b/packages/api/proto/regen/ecocredit/basket/v1/query.proto index 21ccde18..c89a38a5 100644 --- a/packages/api/proto/regen/ecocredit/basket/v1/query.proto +++ b/packages/api/proto/regen/ecocredit/basket/v1/query.proto @@ -17,9 +17,6 @@ service Query { rpc Basket(QueryBasketRequest) returns (QueryBasketResponse) { option (google.api.http) = { get : "/regen/ecocredit/basket/v1/basket/{basket_denom}" - // additional_bindings : [ - // {get : "/regen/ecocredit/basket/v1/baskets/{basket_denom}"} - // ] }; } @@ -33,9 +30,6 @@ service Query { returns (QueryBasketBalancesResponse) { option (google.api.http) = { get : "/regen/ecocredit/basket/v1/basket-balances/{basket_denom}" - // additional_bindings : [ - // {get : "/regen/ecocredit/basket/v1/baskets/{basket_denom}/balances"} - // ] }; } @@ -45,10 +39,6 @@ service Query { option (google.api.http) = { get : "/regen/ecocredit/basket/v1/basket-balance/{basket_denom}/" "{batch_denom}" - // additional_bindings : [ { - // get : "/regen/ecocredit/basket/v1/baskets/{basket_denom}/balances/" - // "{batch_denom}" - // } ] }; } diff --git a/packages/api/proto/regen/ecocredit/basket/v1/state.proto b/packages/api/proto/regen/ecocredit/basket/v1/state.proto index 7c5a7da6..3d699511 100644 --- a/packages/api/proto/regen/ecocredit/basket/v1/state.proto +++ b/packages/api/proto/regen/ecocredit/basket/v1/state.proto @@ -3,19 +3,30 @@ syntax = "proto3"; package regen.ecocredit.basket.v1; import "cosmos/base/v1beta1/coin.proto"; -import "cosmos/orm/v1/orm.proto"; import "google/protobuf/timestamp.proto"; import "regen/ecocredit/basket/v1/types.proto"; +import "regen/orm/v1/orm.proto"; option go_package = "github.com/regen-network/regen-ledger/x/ecocredit/basket/types/v1"; // Basket represents a basket in state. message Basket { - option (cosmos.orm.v1.table) = { - id : 1, - primary_key : {fields : "id", auto_increment : true} - index : {id : 1, fields : "basket_denom", unique : true} - index : {id : 2, fields : "name", unique : true} + option (regen.orm.v1.table) = { + id: 1 + primary_key: { + fields: "id" + auto_increment: true + } + index: { + id: 1 + fields: "basket_denom" + unique: true + } + index: { + id: 2 + fields: "name" + unique: true + } }; // id is the uint64 ID of the basket. It is used internally for reducing @@ -59,7 +70,7 @@ message Basket { // removed in the next version. The value of credit type precision is always // used as the exponent when converting credits to/from basket tokens. This // field will be set to the value of credit type precision until removed. - uint32 exponent = 7 [ deprecated = true ]; + uint32 exponent = 7 [deprecated = true]; // curator is the address of the basket curator who is able to change certain // basket settings. @@ -70,9 +81,9 @@ message Basket { // BasketClass describes a credit class that can be deposited in a basket. message BasketClass { - option (cosmos.orm.v1.table) = { - id : 2, - primary_key : {fields : "basket_id,class_id"} + option (regen.orm.v1.table) = { + id: 2 + primary_key: {fields: "basket_id,class_id"} }; // basket_id is the ID of the basket @@ -85,10 +96,13 @@ message BasketClass { // BasketBalance stores the amount of credits from a batch in a basket message BasketBalance { - option (cosmos.orm.v1.table) = { - id : 3, - primary_key : {fields : "basket_id,batch_denom"} - index : {id : 1, fields : "basket_id,batch_start_date"} + option (regen.orm.v1.table) = { + id: 3 + primary_key: {fields: "basket_id,batch_denom"} + index: { + id: 1 + fields: "basket_id,batch_start_date" + } }; // basket_id is the ID of the basket @@ -110,9 +124,7 @@ message BasketBalance { // // Since Revision 2 message BasketFee { - option (cosmos.orm.v1.singleton) = { - id : 4 - }; + option (regen.orm.v1.singleton) = {id: 4}; // fee is the basket creation fee. If not set, a basket creation fee is not // required. diff --git a/packages/api/proto/regen/ecocredit/basket/v1/tx.proto b/packages/api/proto/regen/ecocredit/basket/v1/tx.proto index cb700a17..8be49db9 100644 --- a/packages/api/proto/regen/ecocredit/basket/v1/tx.proto +++ b/packages/api/proto/regen/ecocredit/basket/v1/tx.proto @@ -11,6 +11,8 @@ option go_package = "github.com/regen-network/regen-ledger/x/ecocredit/basket/ty // Msg is the regen.ecocredit.basket.v1 Msg service. service Msg { + option (cosmos.msg.v1.service) = true; + // Create creates a basket that can hold different types of ecocredits that // meet the basket's criteria. Upon depositing ecocredits into the basket, // basket tokens are minted and sent to depositor using the Cosmos SDK Bank diff --git a/packages/api/proto/regen/ecocredit/marketplace/v1/query.proto b/packages/api/proto/regen/ecocredit/marketplace/v1/query.proto index 5f9cc19d..b131409a 100644 --- a/packages/api/proto/regen/ecocredit/marketplace/v1/query.proto +++ b/packages/api/proto/regen/ecocredit/marketplace/v1/query.proto @@ -16,9 +16,6 @@ service Query { rpc SellOrder(QuerySellOrderRequest) returns (QuerySellOrderResponse) { option (google.api.http) = { get : "/regen/ecocredit/marketplace/v1/sell-order/{sell_order_id}" - // additional_bindings : [ - // {get : "/regen/ecocredit/marketplace/v1/sell-orders/{sell_order_id}"} - // ] }; } @@ -34,9 +31,6 @@ service Query { returns (QuerySellOrdersByBatchResponse) { option (google.api.http) = { get : "/regen/ecocredit/marketplace/v1/sell-orders-by-batch/{batch_denom}" - // additional_bindings : [ { - // get : "/regen/ecocredit/marketplace/v1/sell-orders/batch/{batch_denom}" - // } ] }; } @@ -46,9 +40,6 @@ service Query { returns (QuerySellOrdersBySellerResponse) { option (google.api.http) = { get : "/regen/ecocredit/marketplace/v1/sell-orders-by-seller/{seller}" - // additional_bindings : [ - // {get : "/regen/ecocredit/marketplace/v1/sell-orders/seller/{seller}"} - // ] }; } diff --git a/packages/api/proto/regen/ecocredit/marketplace/v1/state.proto b/packages/api/proto/regen/ecocredit/marketplace/v1/state.proto index 2654282e..ffd3f7ac 100644 --- a/packages/api/proto/regen/ecocredit/marketplace/v1/state.proto +++ b/packages/api/proto/regen/ecocredit/marketplace/v1/state.proto @@ -2,19 +2,31 @@ syntax = "proto3"; package regen.ecocredit.marketplace.v1; -import "cosmos/orm/v1/orm.proto"; import "google/protobuf/timestamp.proto"; +import "regen/orm/v1/orm.proto"; option go_package = "github.com/regen-network/regen-ledger/x/ecocredit/marketplace/types/v1"; // SellOrder represents the information for a sell order. message SellOrder { - option (cosmos.orm.v1.table) = { - id : 1, - primary_key : {fields : "id", auto_increment : true} - index : {id : 1 fields : "batch_key"} - index : {id : 2 fields : "seller"} - index : {id : 3 fields : "expiration"} + option (regen.orm.v1.table) = { + id: 1 + primary_key: { + fields: "id" + auto_increment: true + } + index: { + id: 1 + fields: "batch_key" + } + index: { + id: 2 + fields: "seller" + } + index: { + id: 3 + fields: "expiration" + } }; // id is the unique ID of sell order. @@ -56,10 +68,14 @@ message SellOrder { // AllowedDenom represents the information for an allowed ask/bid denom. message AllowedDenom { - option (cosmos.orm.v1.table) = { - id : 3 - primary_key : {fields : "bank_denom"} - index : {id : 1 fields : "display_denom", unique : true} + option (regen.orm.v1.table) = { + id: 3 + primary_key: {fields: "bank_denom"} + index: { + id: 1 + fields: "display_denom" + unique: true + } }; // denom is the bank denom to allow (ex. ibc/GLKHDSG423SGS) @@ -85,10 +101,17 @@ message AllowedDenom { // less liquidity and longer settlement times. Such decisions should be taken // with care. message Market { - option (cosmos.orm.v1.table) = { - id : 4 - primary_key : {fields : "id", auto_increment : true} - index : {id : 1 fields : "credit_type_abbrev,bank_denom", unique : true} + option (regen.orm.v1.table) = { + id: 4 + primary_key: { + fields: "id" + auto_increment: true + } + index: { + id: 1 + fields: "credit_type_abbrev,bank_denom" + unique: true + } }; // id is the unique ID of the market. @@ -134,9 +157,7 @@ message Market { // burned. Fees in the fee pool are expected to burned by governance in a manual // process unless governance agrees to a different approach. message FeeParams { - option (cosmos.orm.v1.singleton) = { - id : 5 - }; + option (regen.orm.v1.singleton) = {id: 5}; // buyer_percentage_fee is the decimal percentage fee charged to the buyer. // The string 0.03 means a 3.0% fee. diff --git a/packages/api/proto/regen/ecocredit/marketplace/v1/tx.proto b/packages/api/proto/regen/ecocredit/marketplace/v1/tx.proto index d809f8b8..1eaa4bac 100644 --- a/packages/api/proto/regen/ecocredit/marketplace/v1/tx.proto +++ b/packages/api/proto/regen/ecocredit/marketplace/v1/tx.proto @@ -12,13 +12,13 @@ option go_package = "github.com/regen-network/regen-ledger/x/ecocredit/marketpla // Msg is the regen.ecocredit.marketplace.v1 Msg service. service Msg { + option (cosmos.msg.v1.service) = true; // Sell creates new sell orders. rpc Sell(MsgSell) returns (MsgSellResponse); // UpdateSellOrders updates existing sell orders. - rpc UpdateSellOrders(MsgUpdateSellOrders) - returns (MsgUpdateSellOrdersResponse); + rpc UpdateSellOrders(MsgUpdateSellOrders) returns (MsgUpdateSellOrdersResponse); // CancelSellOrder cancels a sell order and returns the credits from escrow. rpc CancelSellOrder(MsgCancelSellOrder) returns (MsgCancelSellOrderResponse); @@ -35,22 +35,18 @@ service Msg { // RemoveAllowedDenom is a governance method that removes allowed denom. // // Since Revision 1 - rpc RemoveAllowedDenom(MsgRemoveAllowedDenom) - returns (MsgRemoveAllowedDenomResponse); + rpc RemoveAllowedDenom(MsgRemoveAllowedDenom) returns (MsgRemoveAllowedDenomResponse); // SetFeeParams is a governance method that sets the marketplace fees. // // Since Revision 3 - rpc GovSetFeeParams(MsgGovSetFeeParams) - returns (MsgGovSetFeeParamsResponse); + rpc GovSetFeeParams(MsgGovSetFeeParams) returns (MsgGovSetFeeParamsResponse); // GovSendFromFeePool is a governance method that allows the sending of the // marketplace fees. // // Since Revision 3 - rpc GovSendFromFeePool(MsgGovSendFromFeePool) - returns (MsgGovSendFromFeePoolResponse); - + rpc GovSendFromFeePool(MsgGovSendFromFeePool) returns (MsgGovSendFromFeePoolResponse); } // MsgSell is the Msg/Sell request type. @@ -65,7 +61,6 @@ message MsgSell { // Order is the content of a new sell order. message Order { - // batch_denom is the credit batch being sold. string batch_denom = 1; @@ -88,13 +83,12 @@ message MsgSell { // expiration is an optional timestamp when the sell order expires. When the // expiration time is reached, the sell order is removed from state. - google.protobuf.Timestamp expiration = 5 [ (gogoproto.stdtime) = true ]; + google.protobuf.Timestamp expiration = 5 [(gogoproto.stdtime) = true]; } } // MsgSellResponse is the Msg/Sell response type. message MsgSellResponse { - // sell_order_ids are the sell order IDs of the newly created sell orders. repeated uint64 sell_order_ids = 1; } @@ -111,7 +105,6 @@ message MsgUpdateSellOrders { // Update is an update to an existing sell order. message Update { - // sell_order_id is the ID of an existing sell order. uint64 sell_order_id = 1; @@ -127,7 +120,7 @@ message MsgUpdateSellOrders { // new_expiration is an optional timestamp when the sell order expires. When // the expiration time is reached, the sell order is removed from state. - google.protobuf.Timestamp new_expiration = 5 [ (gogoproto.stdtime) = true ]; + google.protobuf.Timestamp new_expiration = 5 [(gogoproto.stdtime) = true]; } } @@ -161,7 +154,6 @@ message MsgBuyDirect { // Order contains the information needed to purchase an ecocredit. message Order { - // sell_order_id is the sell order ID against which the buyer is trying // to buy. uint64 sell_order_id = 2; @@ -233,6 +225,7 @@ message MsgAddAllowedDenomResponse {} // // Since Revision 1 message MsgRemoveAllowedDenom { + option (cosmos.msg.v1.signer) = "authority"; // authority is the address of the governance account. string authority = 1; @@ -272,10 +265,10 @@ message MsgGovSendFromFeePool { // coins is the amount of coins to send from the fee pool. repeated cosmos.base.v1beta1.Coin coins = 3 [ - (gogoproto.nullable) = false, + (gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; } // MsgSendFromFeePoolResponse is the Msg/SendFromFeePool response type. -message MsgGovSendFromFeePoolResponse {} \ No newline at end of file +message MsgGovSendFromFeePoolResponse {} diff --git a/packages/api/proto/regen/ecocredit/marketplace/v1/types.proto b/packages/api/proto/regen/ecocredit/marketplace/v1/types.proto index 5f12d503..647b851f 100644 --- a/packages/api/proto/regen/ecocredit/marketplace/v1/types.proto +++ b/packages/api/proto/regen/ecocredit/marketplace/v1/types.proto @@ -2,7 +2,6 @@ syntax = "proto3"; package regen.ecocredit.marketplace.v1; -import "gogoproto/gogo.proto"; import "regen/ecocredit/marketplace/v1/state.proto"; option go_package = "github.com/regen-network/regen-ledger/x/ecocredit/marketplace/types/v1"; @@ -13,8 +12,6 @@ option go_package = "github.com/regen-network/regen-ledger/x/ecocredit/marketpla // Deprecated (Since Revision 1): This message is no longer used and will be // removed in the next version. See MsgAddAllowedDenom. message AllowDenomProposal { - option (gogoproto.goproto_stringer) = false; - // title is the title of the proposal. string title = 1; diff --git a/packages/api/proto/regen/ecocredit/orderbook/v1alpha1/memory.proto b/packages/api/proto/regen/ecocredit/orderbook/v1alpha1/memory.proto index c3c0352c..2600dd54 100644 --- a/packages/api/proto/regen/ecocredit/orderbook/v1alpha1/memory.proto +++ b/packages/api/proto/regen/ecocredit/orderbook/v1alpha1/memory.proto @@ -2,20 +2,20 @@ syntax = "proto3"; package regen.ecocredit.orderbook.v1alpha1; -import "cosmos/orm/v1/orm.proto"; import "google/protobuf/timestamp.proto"; +import "regen/orm/v1/orm.proto"; option go_package = "github.com/regen-network/regen-ledger/x/ecocredit/orderbook"; // BuyOrderSellOrderMatch defines the data the FIFO/price-time-priority matching // algorithm used to actually match buy and sell orders. message BuyOrderSellOrderMatch { - option (cosmos.orm.v1.table) = { - id : 1 + option (regen.orm.v1.table) = { + id: 1 // the primary key of the table is simply the buy_order_id,sell_order_id // pair as these pairs are unique - primary_key : {fields : "buy_order_id,sell_order_id"} + primary_key: {fields: "buy_order_id,sell_order_id"} // Algorithm details: // this index is what does the magic - it basically sorts our orders for us @@ -28,14 +28,18 @@ message BuyOrderSellOrderMatch { // bids and lowest asks get filled first. If the ask price is the same, then // earlier sell orders get filled first (again we get this from the sell // order ID which is assigned incrementally). - index : { - id : 1, - fields : "market_id,bid_price_complement,buy_order_id,ask_price,sell_" - "order_id" + index: { + id: 1 + fields: + "market_id,bid_price_complement,buy_order_id,ask_price,sell_" + "order_id" } // this index is used to delete matches once sell orders are filled - index : {id : 2, fields : "sell_order_id"} + index: { + id: 2 + fields: "sell_order_id" + } }; // market_id defines the market within which this match exists. @@ -60,10 +64,13 @@ message BuyOrderSellOrderMatch { // BuyOrderClassSelector indexes a buy order with class selector. message BuyOrderClassSelector { - option (cosmos.orm.v1.table) = { - id : 2 - primary_key : {fields : "buy_order_id,class_id"} - index : {id : 1, fields : "class_id"} + option (regen.orm.v1.table) = { + id: 2 + primary_key: {fields: "buy_order_id,class_id"} + index: { + id: 1 + fields: "class_id" + } }; // buy_order_id is the buy order ID. @@ -84,10 +91,13 @@ message BuyOrderClassSelector { // BuyOrderProjectSelector indexes a buy order with project selector. message BuyOrderProjectSelector { - option (cosmos.orm.v1.table) = { - id : 3 - primary_key : {fields : "buy_order_id,project_id"} - index : {id : 1, fields : "project_id"} + option (regen.orm.v1.table) = { + id: 3 + primary_key: {fields: "buy_order_id,project_id"} + index: { + id: 1 + fields: "project_id" + } }; // buy_order_id is the buy order ID. @@ -105,10 +115,13 @@ message BuyOrderProjectSelector { // BuyOrderBatchSelector indexes a buy order with batch selector. message BuyOrderBatchSelector { - option (cosmos.orm.v1.table) = { - id : 4 - primary_key : {fields : "buy_order_id,batch_id"} - index : {id : 1, fields : "batch_id"} + option (regen.orm.v1.table) = { + id: 4 + primary_key: {fields: "buy_order_id,batch_id"} + index: { + id: 1 + fields: "batch_id" + } }; // buy_order_id is the buy order ID. diff --git a/packages/api/proto/regen/ecocredit/v1/query.proto b/packages/api/proto/regen/ecocredit/v1/query.proto index f728a4a9..e98a3d25 100644 --- a/packages/api/proto/regen/ecocredit/v1/query.proto +++ b/packages/api/proto/regen/ecocredit/v1/query.proto @@ -25,9 +25,6 @@ service Query { returns (QueryClassesByAdminResponse) { option (google.api.http) = { get : "/regen/ecocredit/v1/classes-by-admin/{admin}" - // additional_bindings : [ - // {get : "/regen/ecocredit/v1/classes/admin/{admin}"} - // ] }; } @@ -35,7 +32,6 @@ service Query { rpc Class(QueryClassRequest) returns (QueryClassResponse) { option (google.api.http) = { get : "/regen/ecocredit/v1/class/{class_id}" - // additional_bindings : [ {get : "/regen/ecocredit/v1/classes/{class_id}"} ] }; } @@ -44,9 +40,6 @@ service Query { returns (QueryClassIssuersResponse) { option (google.api.http) = { get : "/regen/ecocredit/v1/class-issuers/{class_id}" - // additional_bindings : [ - // {get : "/regen/ecocredit/v1/classes/{class_id}/issuers"} - // ] }; } @@ -60,10 +53,6 @@ service Query { returns (QueryProjectsByClassResponse) { option (google.api.http) = { get : "/regen/ecocredit/v1/projects-by-class/{class_id}" - // additional_bindings : [ - // {get : "/regen/ecocredit/v1/projects/class/{class_id}"}, - // {get : "/regen/ecocredit/v1/classes/{class_id}/projects"} - // ] }; } @@ -73,9 +62,6 @@ service Query { returns (QueryProjectsByReferenceIdResponse) { option (google.api.http) = { get : "/regen/ecocredit/v1/projects-by-reference-id/{reference_id}" - // additional_bindings : [ - // {get : "/regen/ecocredit/v1/projects/reference-id/{reference_id}"} - // ] }; } @@ -85,9 +71,6 @@ service Query { returns (QueryProjectsByAdminResponse) { option (google.api.http) = { get : "/regen/ecocredit/v1/projects-by-admin/{admin}" - // additional_bindings : [ - // {get : "/regen/ecocredit/v1/projects/admin/{admin}"} - // ] }; } @@ -95,9 +78,6 @@ service Query { rpc Project(QueryProjectRequest) returns (QueryProjectResponse) { option (google.api.http) = { get : "/regen/ecocredit/v1/project/{project_id}" - // additional_bindings : [ - // {get : "/regen/ecocredit/v1/projects/{project_id}"} - // ] }; } @@ -111,9 +91,6 @@ service Query { returns (QueryBatchesByIssuerResponse) { option (google.api.http) = { get : "/regen/ecocredit/v1/batches-by-issuer/{issuer}" - // additional_bindings : [ - // {get : "/regen/ecocredit/v1/batches/issuer/{issuer}"} - // ] }; } @@ -122,9 +99,6 @@ service Query { returns (QueryBatchesByClassResponse) { option (google.api.http) = { get : "/regen/ecocredit/v1/batches-by-class/{class_id}" - // additional_bindings : [ - // {get : "/regen/ecocredit/v1/batches/class/{class_id}"} - // ] }; } @@ -134,9 +108,6 @@ service Query { returns (QueryBatchesByProjectResponse) { option (google.api.http) = { get : "/regen/ecocredit/v1/batches-by-project/{project_id}" - // additional_bindings : [ - // {get : "/regen/ecocredit/v1/batches/project/{project_id}"} - // ] }; } @@ -144,9 +115,6 @@ service Query { rpc Batch(QueryBatchRequest) returns (QueryBatchResponse) { option (google.api.http) = { get : "/regen/ecocredit/v1/batch/{batch_denom}" - // additional_bindings : [ - // {get : "/regen/ecocredit/v1/batches/{batch_denom}"} - // ] }; } @@ -155,10 +123,6 @@ service Query { rpc Balance(QueryBalanceRequest) returns (QueryBalanceResponse) { option (google.api.http) = { get : "/regen/ecocredit/v1/balance/{batch_denom}/{address}" - // additional_bindings : [ - // {get : "/regen/ecocredit/v1/batches/{batch_denom}/balance/{address}"}, - // {get : "/regen/ecocredit/v1/balances/{address}/batch/{batch_denom}"} - // ] }; } @@ -174,9 +138,6 @@ service Query { returns (QueryBalancesByBatchResponse) { option (google.api.http) = { get : "/regen/ecocredit/v1/balances-by-batch/{batch_denom}" - // additional_bindings : [ - // {get : "/regen/ecocredit/v1/batches/{batch_denom}/balances"} - // ] }; } @@ -186,7 +147,6 @@ service Query { rpc AllBalances(QueryAllBalancesRequest) returns (QueryAllBalancesResponse) { option (google.api.http) = { get : "/regen/ecocredit/v1/all-balances" - // additional_bindings : [ {get : "/regen/ecocredit/v1/balances"} ] }; } @@ -194,9 +154,6 @@ service Query { rpc Supply(QuerySupplyRequest) returns (QuerySupplyResponse) { option (google.api.http) = { get : "/regen/ecocredit/v1/supply/{batch_denom}" - // additional_bindings : [ - // {get : "/regen/ecocredit/v1/batches/{batch_denom}/supply"} - // ] }; } @@ -219,9 +176,6 @@ service Query { rpc CreditType(QueryCreditTypeRequest) returns (QueryCreditTypeResponse) { option (google.api.http) = { get : "/regen/ecocredit/v1/credit-type/{abbreviation}" - // additional_bindings : [ - // {get : "/regen/ecocredit/v1/credit-types/{abbreviation}"} - // ] }; } diff --git a/packages/api/proto/regen/ecocredit/v1/state.proto b/packages/api/proto/regen/ecocredit/v1/state.proto index 10e485ee..6014cdcc 100644 --- a/packages/api/proto/regen/ecocredit/v1/state.proto +++ b/packages/api/proto/regen/ecocredit/v1/state.proto @@ -3,18 +3,22 @@ syntax = "proto3"; package regen.ecocredit.v1; import "cosmos/base/v1beta1/coin.proto"; -import "cosmos/orm/v1/orm.proto"; import "google/protobuf/timestamp.proto"; +import "regen/orm/v1/orm.proto"; option go_package = "github.com/regen-network/regen-ledger/x/ecocredit/base/types/v1"; // CreditType defines the measurement unit/precision of a certain credit type // (e.g. carbon, biodiversity...) message CreditType { - option (cosmos.orm.v1.table) = { - id : 1, - primary_key : {fields : "abbreviation"} - index : {id : 1, fields : "name", unique : true} + option (regen.orm.v1.table) = { + id: 1 + primary_key: {fields: "abbreviation"} + index: { + id: 1 + fields: "name" + unique: true + } }; // abbreviation is a 1-3 character uppercase abbreviation of the CreditType @@ -33,12 +37,25 @@ message CreditType { // Class represents the high-level on-chain information for a credit class. message Class { - option (cosmos.orm.v1.table) = { - id : 2, - primary_key : {fields : "key", auto_increment : true} - index : {id : 1 fields : "id", unique : true} - index : {id : 2 fields : "admin"} - index : {id : 3 fields : "credit_type_abbrev"} + option (regen.orm.v1.table) = { + id: 2 + primary_key: { + fields: "key" + auto_increment: true + } + index: { + id: 1 + fields: "id" + unique: true + } + index: { + id: 2 + fields: "admin" + } + index: { + id: 3 + fields: "credit_type_abbrev" + } }; // key is the table row identifier of the credit class used internally for @@ -62,9 +79,9 @@ message Class { // ClassIssuers is a JOIN table for Class Info that stores the credit class // issuers message ClassIssuer { - option (cosmos.orm.v1.table) = { - id : 3, - primary_key : {fields : "class_key,issuer"} + option (regen.orm.v1.table) = { + id: 3 + primary_key: {fields: "class_key,issuer"} }; // class_key is the table row identifier of the credit class used internally @@ -77,14 +94,34 @@ message ClassIssuer { // Project represents the high-level on-chain information for a project. message Project { - option (cosmos.orm.v1.table) = { - id : 4, - primary_key : {fields : "key", auto_increment : true} - index : {id : 1, fields : "id", unique : true} - index : {id : 2, fields : "class_key,id", unique : true} - index : {id : 3, fields : "admin"} - index : {id : 4, fields : "reference_id"} - index : {id : 5, fields : "class_key,reference_id"} + option (regen.orm.v1.table) = { + id: 4 + primary_key: { + fields: "key" + auto_increment: true + } + index: { + id: 1 + fields: "id" + unique: true + } + index: { + id: 2 + fields: "class_key,id" + unique: true + } + index: { + id: 3 + fields: "admin" + } + index: { + id: 4 + fields: "reference_id" + } + index: { + id: 5 + fields: "class_key,reference_id" + } }; // key is the table row identifier of the project used internally for @@ -115,14 +152,33 @@ message Project { // Batch represents the high-level on-chain information for a credit batch. message Batch { - option (cosmos.orm.v1.table) = { - id : 5, - primary_key : {fields : "key", auto_increment : true} - index : {id : 1 fields : "denom", unique : true} - index : {id : 2 fields : "project_key"} - index : {id : 3 fields : "start_date"} - index : {id : 4 fields : "issuer"} - index : {id: 5 fields : "class_key"} + option (regen.orm.v1.table) = { + id: 5 + primary_key: { + fields: "key" + auto_increment: true + } + index: { + id: 1 + fields: "denom" + unique: true + } + index: { + id: 2 + fields: "project_key" + } + index: { + id: 3 + fields: "start_date" + } + index: { + id: 4 + fields: "issuer" + } + index: { + id: 5 + fields: "class_key" + } }; // key is the table row identifier of the credit batch used internally for @@ -169,9 +225,9 @@ message Batch { // ClassSequence stores and increments the sequence number for credit classes // within a credit type. message ClassSequence { - option (cosmos.orm.v1.table) = { - id : 6, - primary_key : {fields : "credit_type_abbrev"} + option (regen.orm.v1.table) = { + id: 6 + primary_key: {fields: "credit_type_abbrev"} }; // credit_type_abbrev is the credit type abbreviation. This links a class @@ -186,9 +242,9 @@ message ClassSequence { // ProjectSequence stores and increments the sequence number for projects within // a credit class. message ProjectSequence { - option (cosmos.orm.v1.table) = { - id : 7, - primary_key : {fields : "class_key"} + option (regen.orm.v1.table) = { + id: 7 + primary_key: {fields: "class_key"} }; // class_key is the table row identifier of the credit class used internally @@ -203,9 +259,9 @@ message ProjectSequence { // BatchSequence stores and increments the sequence number for credit batches // within a project. message BatchSequence { - option (cosmos.orm.v1.table) = { - id : 8, - primary_key : {fields : "project_key"} + option (regen.orm.v1.table) = { + id: 8 + primary_key: {fields: "project_key"} }; // project_key is the table row identifier of the project used internally for @@ -219,10 +275,13 @@ message BatchSequence { // BatchBalance stores each accounts credit balance. message BatchBalance { - option (cosmos.orm.v1.table) = { - id : 9, - primary_key : {fields : "address,batch_key"} - index : {id : 1, fields : "batch_key,address"} + option (regen.orm.v1.table) = { + id: 9 + primary_key: {fields: "address,batch_key"} + index: { + id: 1 + fields: "batch_key,address" + } }; // batch_key is the table row identifier of the credit batch used internally @@ -247,9 +306,9 @@ message BatchBalance { // BatchSupply stores the supply of credits for a credit batch. message BatchSupply { - option (cosmos.orm.v1.table) = { - id : 10, - primary_key : {fields : "batch_key"} + option (regen.orm.v1.table) = { + id: 10 + primary_key: {fields: "batch_key"} }; // batch_key is the table row identifier of the credit batch used internally @@ -282,9 +341,9 @@ message BatchSupply { // class_key) to prevent malicious credit class issuers from blocking any // bridge operations taking place within another credit class. message OriginTxIndex { - option (cosmos.orm.v1.table) = { - id : 11, - primary_key : {fields : "class_key,id,source"} + option (regen.orm.v1.table) = { + id: 11 + primary_key: {fields: "class_key,id,source"} }; // class_key is the table row identifier of the credit class within which the @@ -307,10 +366,14 @@ message OriginTxIndex { // that each credit batch corresponds to a single contract and credits that // have been bridged will always be bridged back to the original contract. message BatchContract { - option (cosmos.orm.v1.table) = { - id : 12, - primary_key : {fields : "batch_key"} - index : {id : 1, fields : "class_key,contract", unique : true} + option (regen.orm.v1.table) = { + id: 12 + primary_key: {fields: "batch_key"} + index: { + id: 1 + fields: "class_key,contract" + unique: true + } }; // batch_key is the table row identifier of the credit batch used internally @@ -336,9 +399,7 @@ message BatchContract { // // Since Revision 2 message ClassCreatorAllowlist { - option (cosmos.orm.v1.singleton) = { - id : 13 - }; + option (regen.orm.v1.singleton) = {id: 13}; // enabled is whether or not the allow list is enabled. bool enabled = 1; @@ -349,9 +410,9 @@ message ClassCreatorAllowlist { // // Since Revision 2 message AllowedClassCreator { - option (cosmos.orm.v1.table) = { - id : 14, - primary_key : {fields : "address"} + option (regen.orm.v1.table) = { + id: 14 + primary_key: {fields: "address"} }; // address is the address that is allowed to create credit classes @@ -363,9 +424,7 @@ message AllowedClassCreator { // // Since Revision 2 message ClassFee { - option (cosmos.orm.v1.singleton) = { - id : 15 - }; + option (regen.orm.v1.singleton) = {id: 15}; // fee is the credit class creation fee. If not set, a credit class creation // fee is not required. @@ -379,9 +438,9 @@ message ClassFee { // // Since Revision 2 message AllowedBridgeChain { - option (cosmos.orm.v1.table) = { - id : 16, - primary_key : {fields : "chain_name"} + option (regen.orm.v1.table) = { + id: 16 + primary_key: {fields: "chain_name"} }; // chain_name is the name of the chain allowed to bridge ecocredits to. @@ -390,10 +449,13 @@ message AllowedBridgeChain { // ProjectEnrollment stores the data a project's enrollment in a credit class. message ProjectEnrollment { - option (cosmos.orm.v1.table) = { - id : 17 - primary_key : {fields : "project_key,class_key"} - index: {id: 1, fields: "class_key"} + option (regen.orm.v1.table) = { + id: 17 + primary_key: {fields: "project_key,class_key"} + index: { + id: 1 + fields: "class_key" + } }; // project_key is the table row identifier of the project used internally for @@ -450,9 +512,7 @@ enum ProjectEnrollmentStatus { // // Since Revision 3 message ProjectFee { - option (cosmos.orm.v1.singleton) = { - id : 18 - }; + option (regen.orm.v1.singleton) = {id: 18}; // fee is the project creation fee. If not set, a project creation fee is not // required. diff --git a/packages/api/proto/regen/ecocredit/v1/tx.proto b/packages/api/proto/regen/ecocredit/v1/tx.proto index 84ea41c7..43c80cfe 100644 --- a/packages/api/proto/regen/ecocredit/v1/tx.proto +++ b/packages/api/proto/regen/ecocredit/v1/tx.proto @@ -13,6 +13,7 @@ option go_package = "github.com/regen-network/regen-ledger/x/ecocredit/base/type // Msg is the regen.ecocredit.v1 Msg service. service Msg { + option (cosmos.msg.v1.service) = true; // CreateClass creates a new credit class under the given credit type with an // approved list of issuers and optional metadata. If the class fee parameter diff --git a/packages/api/proto/regen/ecocredit/v1/types.proto b/packages/api/proto/regen/ecocredit/v1/types.proto index 61cfbb1f..18bbf847 100644 --- a/packages/api/proto/regen/ecocredit/v1/types.proto +++ b/packages/api/proto/regen/ecocredit/v1/types.proto @@ -124,8 +124,6 @@ message OriginTx { // Deprecated (Since Revision 2): This message is no longer used and will be // removed in the next version. See MsgAddCreditType. message CreditTypeProposal { - option (gogoproto.goproto_stringer) = false; - // title is the title of the proposal. string title = 1; diff --git a/packages/api/proto/regen/ecocredit/v1alpha1/tx.proto b/packages/api/proto/regen/ecocredit/v1alpha1/tx.proto index a18ac982..c493c904 100644 --- a/packages/api/proto/regen/ecocredit/v1alpha1/tx.proto +++ b/packages/api/proto/regen/ecocredit/v1alpha1/tx.proto @@ -2,6 +2,7 @@ syntax = "proto3"; package regen.ecocredit.v1alpha1; +import "cosmos/msg/v1/msg.proto"; import "gogoproto/gogo.proto"; import "google/protobuf/timestamp.proto"; @@ -9,6 +10,7 @@ option go_package = "github.com/regen-network/regen-ledger/x/ecocredit/base/type // Msg is the regen.ecocredit.v1alpha1 Msg service. service Msg { + option (cosmos.msg.v1.service) = true; // CreateClass creates a new credit class with an approved list of issuers and // optional metadata. @@ -32,21 +34,17 @@ service Msg { rpc Cancel(MsgCancel) returns (MsgCancelResponse); // UpdateClassAdmin updates the credit class admin - rpc UpdateClassAdmin(MsgUpdateClassAdmin) - returns (MsgUpdateClassAdminResponse); + rpc UpdateClassAdmin(MsgUpdateClassAdmin) returns (MsgUpdateClassAdminResponse); // UpdateClassIssuers updates the credit class issuer list - rpc UpdateClassIssuers(MsgUpdateClassIssuers) - returns (MsgUpdateClassIssuersResponse); + rpc UpdateClassIssuers(MsgUpdateClassIssuers) returns (MsgUpdateClassIssuersResponse); // UpdateClassMetadata updates the credit class metadata - rpc UpdateClassMetadata(MsgUpdateClassMetadata) - returns (MsgUpdateClassMetadataResponse); + rpc UpdateClassMetadata(MsgUpdateClassMetadata) returns (MsgUpdateClassMetadataResponse); } // MsgCreateClass is the Msg/CreateClass request type. message MsgCreateClass { - // admin is the address of the account that created the credit class. string admin = 1; @@ -63,14 +61,12 @@ message MsgCreateClass { // MsgCreateClassResponse is the Msg/CreateClass response type. message MsgCreateClassResponse { - // class_id is the unique ID of the newly created credit class. string class_id = 1; } // MsgCreateBatch is the Msg/CreateBatch request type. message MsgCreateBatch { - // issuer is the address of the batch issuer. string issuer = 1; @@ -85,11 +81,11 @@ message MsgCreateBatch { // start_date is the beginning of the period during which this credit batch // was quantified and verified. - google.protobuf.Timestamp start_date = 5 [ (gogoproto.stdtime) = true ]; + google.protobuf.Timestamp start_date = 5 [(gogoproto.stdtime) = true]; // end_date is the end of the period during which this credit batch was // quantified and verified. - google.protobuf.Timestamp end_date = 6 [ (gogoproto.stdtime) = true ]; + google.protobuf.Timestamp end_date = 6 [(gogoproto.stdtime) = true]; // project_location is the location of the project backing the credits in this // batch. It is a string of the form @@ -102,7 +98,6 @@ message MsgCreateBatch { // BatchIssuance represents the issuance of some credits in a batch to a // single recipient. message BatchIssuance { - // recipient is the account of the recipient. string recipient = 1; @@ -127,14 +122,12 @@ message MsgCreateBatch { // MsgCreateBatchResponse is the Msg/CreateBatch response type. message MsgCreateBatchResponse { - // batch_denom is the unique denomination ID of the newly created batch. string batch_denom = 1; } // MsgSend is the Msg/Send request type. message MsgSend { - // sender is the address of the account sending credits. string sender = 1; @@ -148,7 +141,6 @@ message MsgSend { // This is split into tradable credits, which will remain tradable on receipt, // and retired credits, which will be retired on receipt. message SendCredits { - // batch_denom is the unique ID of the credit batch. string batch_denom = 1; @@ -177,7 +169,6 @@ message MsgSendResponse {} // MsgRetire is the Msg/Retire request type. message MsgRetire { - // holder is the credit holder address. string holder = 1; @@ -186,7 +177,6 @@ message MsgRetire { // RetireCredits specifies a batch and the number of credits being retired. message RetireCredits { - // batch_denom is the unique ID of the credit batch. string batch_denom = 1; @@ -209,7 +199,6 @@ message MsgRetireResponse {} // MsgCancel is the Msg/Cancel request type. message MsgCancel { - // holder is the credit holder address. string holder = 1; @@ -218,7 +207,6 @@ message MsgCancel { // CancelCredits specifies a batch and the number of credits being cancelled. message CancelCredits { - // batch_denom is the unique ID of the credit batch. string batch_denom = 1; @@ -234,7 +222,6 @@ message MsgCancelResponse {} // MsgUpdateClassAdmin is the Msg/UpdateClassAdmin request type. message MsgUpdateClassAdmin { - // admin is the address of the account that is the admin of the credit class. string admin = 1; @@ -250,7 +237,6 @@ message MsgUpdateClassAdminResponse {} // MsgUpdateClassIssuers is the Msg/UpdateClassIssuers request type. message MsgUpdateClassIssuers { - // admin is the address of the account that is the admin of the credit class. string admin = 1; @@ -266,7 +252,6 @@ message MsgUpdateClassIssuersResponse {} // MsgUpdateClassMetadata is the Msg/UpdateClassMetadata request type. message MsgUpdateClassMetadata { - // admin is the address of the account that is the admin of the credit class. string admin = 1; diff --git a/packages/api/proto/regen/intertx/v1/query.proto b/packages/api/proto/regen/intertx/v1/query.proto deleted file mode 100644 index 8652a9da..00000000 --- a/packages/api/proto/regen/intertx/v1/query.proto +++ /dev/null @@ -1,38 +0,0 @@ -syntax = "proto3"; - -package regen.intertx.v1; - -import "google/api/annotations.proto"; - -option go_package = "github.com/regen-network/regen-ledger/x/intertx/types/v1"; - -// Query defines the gRPC querier service. -service Query { - - // QueryInterchainAccount returns the interchain account for given owner - // address on a given connection pair - rpc InterchainAccount(QueryInterchainAccountRequest) - returns (QueryInterchainAccountResponse) { - option (google.api.http).get = - "/regen/intertx/v1/interchain-account/{owner}/{connection_id}"; - } -} - -// QueryInterchainAccountRequest is the request type for the -// Query/InterchainAccountAddress RPC -message QueryInterchainAccountRequest { - - // owner is the address of the account that owns the ICA. - string owner = 1; - - // connection_id is the connection the ICA claimed. - string connection_id = 2; -} - -// QueryInterchainAccountResponse the response type for the -// Query/InterchainAccountAddress RPC -message QueryInterchainAccountResponse { - - // interchain_account_address is the address of the ICA. - string interchain_account_address = 1; -} \ No newline at end of file diff --git a/packages/api/proto/regen/intertx/v1/tx.proto b/packages/api/proto/regen/intertx/v1/tx.proto deleted file mode 100644 index a744e0f8..00000000 --- a/packages/api/proto/regen/intertx/v1/tx.proto +++ /dev/null @@ -1,52 +0,0 @@ -syntax = "proto3"; - -package regen.intertx.v1; - -import "cosmos/msg/v1/msg.proto"; -import "google/protobuf/any.proto"; - -option go_package = "github.com/regen-network/regen-ledger/x/intertx/types/v1"; - -// Msg defines the intertx Msg service. -service Msg { - // Register defines a rpc handler for MsgRegisterAccount - rpc RegisterAccount(MsgRegisterAccount) returns (MsgRegisterAccountResponse); - // SubmitTx defines a rpc handler for MsgSubmitTx - rpc SubmitTx(MsgSubmitTx) returns (MsgSubmitTxResponse); -} - -// MsgRegisterAccount defines the payload for Msg/RegisterAccount -message MsgRegisterAccount { - option (cosmos.msg.v1.signer) = "owner"; - - // owner is the address of the interchain account owner. - string owner = 1; - - // connection_id is the connection id string (i.e. channel-5). - string connection_id = 2; - - // version is the application version string. For example, this could be an - // ICS27 encoded metadata type or an ICS29 encoded metadata type with a nested - // application version. - string version = 3; -} - -// MsgRegisterAccountResponse defines the response for Msg/RegisterAccount -message MsgRegisterAccountResponse {} - -// MsgSubmitTx defines the payload for Msg/SubmitTx -message MsgSubmitTx { - option (cosmos.msg.v1.signer) = "owner"; - - // owner is the owner address of the interchain account. - string owner = 1; - - // connection_id is the id of the connection. - string connection_id = 2; - - // msg is the bytes of the transaction msg to send. - google.protobuf.Any msg = 3; -} - -// MsgSubmitTxResponse defines the response for Msg/SubmitTx -message MsgSubmitTxResponse {} \ No newline at end of file diff --git a/packages/api/proto/cosmos/orm/module/v1alpha1/module.proto b/packages/api/proto/regen/orm/module/v1alpha1/module.proto similarity index 55% rename from packages/api/proto/cosmos/orm/module/v1alpha1/module.proto rename to packages/api/proto/regen/orm/module/v1alpha1/module.proto index cb7bbbee..dfec48f7 100644 --- a/packages/api/proto/cosmos/orm/module/v1alpha1/module.proto +++ b/packages/api/proto/regen/orm/module/v1alpha1/module.proto @@ -1,14 +1,12 @@ syntax = "proto3"; -package cosmos.orm.module.v1alpha1; +package regen.orm.module.v1alpha1; -import "cosmos/app/v1alpha1/module.proto"; +import "regen/app/v1alpha1/module.proto"; // Module defines the ORM module which adds providers to the app container for // module-scoped DB's. In the future it may provide gRPC services for interacting // with ORM data. message Module { - option (cosmos.app.v1alpha1.module) = { - go_import: "github.com/cosmos/cosmos-sdk/orm" - }; + option (regen.app.v1alpha1.module) = {go_import: "github.com/regen-network/regen-ledger/orm"}; } diff --git a/packages/api/proto/cosmos/orm/v1/orm.proto b/packages/api/proto/regen/orm/v1/orm.proto similarity index 97% rename from packages/api/proto/cosmos/orm/v1/orm.proto rename to packages/api/proto/regen/orm/v1/orm.proto index 389babd1..cd7ca197 100644 --- a/packages/api/proto/cosmos/orm/v1/orm.proto +++ b/packages/api/proto/regen/orm/v1/orm.proto @@ -1,11 +1,10 @@ syntax = "proto3"; -package cosmos.orm.v1; +package regen.orm.v1; import "google/protobuf/descriptor.proto"; extend google.protobuf.MessageOptions { - // table specifies that this message will be used as an ORM table. It cannot // be used together with the singleton option. TableDescriptor table = 104503790; @@ -17,7 +16,6 @@ extend google.protobuf.MessageOptions { // TableDescriptor describes an ORM table. message TableDescriptor { - // primary_key defines the primary key for the table. PrimaryKeyDescriptor primary_key = 1; @@ -32,7 +30,6 @@ message TableDescriptor { // PrimaryKeyDescriptor describes a table primary key. message PrimaryKeyDescriptor { - // fields is a comma-separated list of fields in the primary key. Spaces are // not allowed. Supported field types, their encodings, and any applicable constraints // are described below. @@ -73,13 +70,12 @@ message PrimaryKeyDescriptor { // PrimaryKeyDescriptor describes a table secondary index. message SecondaryIndexDescriptor { - // fields is a comma-separated list of fields in the index. The supported // field types are the same as those for PrimaryKeyDescriptor.fields. // Index keys are prefixed by the varint encoded table id and the varint // encoded index id plus any additional prefix specified by the schema. // - // In addition the field segments, non-unique index keys are suffixed with + // In addition the the field segments, non-unique index keys are suffixed with // any additional primary key fields not present in the index fields so that the // primary key can be reconstructed. Unique indexes instead of being suffixed // store the remaining primary key fields in the value.. @@ -96,9 +92,8 @@ message SecondaryIndexDescriptor { // TableDescriptor describes an ORM singleton table which has at most one instance. message SingletonDescriptor { - // id is a non-zero integer ID that must be unique within the // tables and singletons in this file. It may be deprecated in the future when this // can be auto-generated. uint32 id = 1; -} \ No newline at end of file +} diff --git a/packages/api/proto/cosmos/orm/v1alpha1/schema.proto b/packages/api/proto/regen/orm/v1alpha1/schema.proto similarity index 98% rename from packages/api/proto/cosmos/orm/v1alpha1/schema.proto rename to packages/api/proto/regen/orm/v1alpha1/schema.proto index ab713340..7a374042 100644 --- a/packages/api/proto/cosmos/orm/v1alpha1/schema.proto +++ b/packages/api/proto/regen/orm/v1alpha1/schema.proto @@ -1,6 +1,6 @@ syntax = "proto3"; -package cosmos.orm.v1alpha1; +package regen.orm.v1alpha1; import "google/protobuf/descriptor.proto"; @@ -14,6 +14,7 @@ extend google.protobuf.MessageOptions { // ModuleSchemaDescriptor describe's a module's ORM schema. message ModuleSchemaDescriptor { + // schema_file repeated FileEntry schema_file = 1; // FileEntry describes an ORM file used in a module. diff --git a/packages/api/proto/tendermint/abci/types.proto b/packages/api/proto/tendermint/abci/types.proto index cf9927d7..78eecceb 100644 --- a/packages/api/proto/tendermint/abci/types.proto +++ b/packages/api/proto/tendermint/abci/types.proto @@ -6,39 +6,57 @@ option go_package = "github.com/cometbft/cometbft/abci/types"; // For more information on gogo.proto, see: // https://github.com/cosmos/gogoproto/blob/master/extensions.md import "tendermint/crypto/proof.proto"; -import "tendermint/types/types.proto"; import "tendermint/crypto/keys.proto"; import "tendermint/types/params.proto"; +import "tendermint/types/validator.proto"; import "google/protobuf/timestamp.proto"; import "gogoproto/gogo.proto"; -// This file is copied from http://github.com/tendermint/abci // NOTE: When using custom types, mind the warnings. // https://github.com/cosmos/gogoproto/blob/master/custom_types.md#warnings-and-issues +service ABCI { + rpc Echo(RequestEcho) returns (ResponseEcho); + rpc Flush(RequestFlush) returns (ResponseFlush); + rpc Info(RequestInfo) returns (ResponseInfo); + rpc CheckTx(RequestCheckTx) returns (ResponseCheckTx); + rpc Query(RequestQuery) returns (ResponseQuery); + rpc Commit(RequestCommit) returns (ResponseCommit); + rpc InitChain(RequestInitChain) returns (ResponseInitChain); + rpc ListSnapshots(RequestListSnapshots) returns (ResponseListSnapshots); + rpc OfferSnapshot(RequestOfferSnapshot) returns (ResponseOfferSnapshot); + rpc LoadSnapshotChunk(RequestLoadSnapshotChunk) returns (ResponseLoadSnapshotChunk); + rpc ApplySnapshotChunk(RequestApplySnapshotChunk) returns (ResponseApplySnapshotChunk); + rpc PrepareProposal(RequestPrepareProposal) returns (ResponsePrepareProposal); + rpc ProcessProposal(RequestProcessProposal) returns (ResponseProcessProposal); + rpc ExtendVote(RequestExtendVote) returns (ResponseExtendVote); + rpc VerifyVoteExtension(RequestVerifyVoteExtension) returns (ResponseVerifyVoteExtension); + rpc FinalizeBlock(RequestFinalizeBlock) returns (ResponseFinalizeBlock); +} + //---------------------------------------- // Request types message Request { oneof value { - RequestEcho echo = 1; - RequestFlush flush = 2; - RequestInfo info = 3; - RequestInitChain init_chain = 5; - RequestQuery query = 6; - RequestBeginBlock begin_block = 7; - RequestCheckTx check_tx = 8; - RequestDeliverTx deliver_tx = 9; - RequestEndBlock end_block = 10; - RequestCommit commit = 11; - RequestListSnapshots list_snapshots = 12; - RequestOfferSnapshot offer_snapshot = 13; - RequestLoadSnapshotChunk load_snapshot_chunk = 14; - RequestApplySnapshotChunk apply_snapshot_chunk = 15; - RequestPrepareProposal prepare_proposal = 16; - RequestProcessProposal process_proposal = 17; + RequestEcho echo = 1; + RequestFlush flush = 2; + RequestInfo info = 3; + RequestInitChain init_chain = 5; + RequestQuery query = 6; + RequestCheckTx check_tx = 8; + RequestCommit commit = 11; + RequestListSnapshots list_snapshots = 12; + RequestOfferSnapshot offer_snapshot = 13; + RequestLoadSnapshotChunk load_snapshot_chunk = 14; + RequestApplySnapshotChunk apply_snapshot_chunk = 15; + RequestPrepareProposal prepare_proposal = 16; + RequestProcessProposal process_proposal = 17; + RequestExtendVote extend_vote = 18; + RequestVerifyVoteExtension verify_vote_extension = 19; + RequestFinalizeBlock finalize_block = 20; } - reserved 4; + reserved 4, 7, 9, 10; // SetOption, BeginBlock, DeliverTx, EndBlock } message RequestEcho { @@ -55,8 +73,7 @@ message RequestInfo { } message RequestInitChain { - google.protobuf.Timestamp time = 1 - [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + google.protobuf.Timestamp time = 1 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; string chain_id = 2; tendermint.types.ConsensusParams consensus_params = 3; repeated ValidatorUpdate validators = 4 [(gogoproto.nullable) = false]; @@ -71,13 +88,6 @@ message RequestQuery { bool prove = 4; } -message RequestBeginBlock { - bytes hash = 1; - tendermint.types.Header header = 2 [(gogoproto.nullable) = false]; - CommitInfo last_commit_info = 3 [(gogoproto.nullable) = false]; - repeated Misbehavior byzantine_validators = 4 [(gogoproto.nullable) = false]; -} - enum CheckTxType { NEW = 0 [(gogoproto.enumvalue_customname) = "New"]; RECHECK = 1 [(gogoproto.enumvalue_customname) = "Recheck"]; @@ -88,14 +98,6 @@ message RequestCheckTx { CheckTxType type = 2; } -message RequestDeliverTx { - bytes tx = 1; -} - -message RequestEndBlock { - int64 height = 1; -} - message RequestCommit {} // lists available snapshots @@ -103,8 +105,8 @@ message RequestListSnapshots {} // offers a snapshot to the application message RequestOfferSnapshot { - Snapshot snapshot = 1; // snapshot offered by peers - bytes app_hash = 2; // light client-verified app hash for snapshot height + Snapshot snapshot = 1; // snapshot offered by peers + bytes app_hash = 2; // light client-verified app hash for snapshot height } // loads a snapshot chunk @@ -149,30 +151,69 @@ message RequestProcessProposal { bytes proposer_address = 8; } +// Extends a vote with application-injected data +message RequestExtendVote { + // the hash of the block that this vote may be referring to + bytes hash = 1; + // the height of the extended vote + int64 height = 2; + // info of the block that this vote may be referring to + google.protobuf.Timestamp time = 3 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + repeated bytes txs = 4; + CommitInfo proposed_last_commit = 5 [(gogoproto.nullable) = false]; + repeated Misbehavior misbehavior = 6 [(gogoproto.nullable) = false]; + bytes next_validators_hash = 7; + // address of the public key of the original proposer of the block. + bytes proposer_address = 8; +} + +// Verify the vote extension +message RequestVerifyVoteExtension { + // the hash of the block that this received vote corresponds to + bytes hash = 1; + // the validator that signed the vote extension + bytes validator_address = 2; + int64 height = 3; + bytes vote_extension = 4; +} + +message RequestFinalizeBlock { + repeated bytes txs = 1; + CommitInfo decided_last_commit = 2 [(gogoproto.nullable) = false]; + repeated Misbehavior misbehavior = 3 [(gogoproto.nullable) = false]; + // hash is the merkle root hash of the fields of the decided block. + bytes hash = 4; + int64 height = 5; + google.protobuf.Timestamp time = 6 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + bytes next_validators_hash = 7; + // proposer_address is the address of the public key of the original proposer of the block. + bytes proposer_address = 8; +} + //---------------------------------------- // Response types message Response { oneof value { - ResponseException exception = 1; - ResponseEcho echo = 2; - ResponseFlush flush = 3; - ResponseInfo info = 4; - ResponseInitChain init_chain = 6; - ResponseQuery query = 7; - ResponseBeginBlock begin_block = 8; - ResponseCheckTx check_tx = 9; - ResponseDeliverTx deliver_tx = 10; - ResponseEndBlock end_block = 11; - ResponseCommit commit = 12; - ResponseListSnapshots list_snapshots = 13; - ResponseOfferSnapshot offer_snapshot = 14; - ResponseLoadSnapshotChunk load_snapshot_chunk = 15; - ResponseApplySnapshotChunk apply_snapshot_chunk = 16; - ResponsePrepareProposal prepare_proposal = 17; - ResponseProcessProposal process_proposal = 18; + ResponseException exception = 1; + ResponseEcho echo = 2; + ResponseFlush flush = 3; + ResponseInfo info = 4; + ResponseInitChain init_chain = 6; + ResponseQuery query = 7; + ResponseCheckTx check_tx = 9; + ResponseCommit commit = 12; + ResponseListSnapshots list_snapshots = 13; + ResponseOfferSnapshot offer_snapshot = 14; + ResponseLoadSnapshotChunk load_snapshot_chunk = 15; + ResponseApplySnapshotChunk apply_snapshot_chunk = 16; + ResponsePrepareProposal prepare_proposal = 17; + ResponseProcessProposal process_proposal = 18; + ResponseExtendVote extend_vote = 19; + ResponseVerifyVoteExtension verify_vote_extension = 20; + ResponseFinalizeBlock finalize_block = 21; } - reserved 5; + reserved 5, 8, 10, 11; // SetOption, BeginBlock, DeliverTx, EndBlock } // nondeterministic @@ -205,8 +246,8 @@ message ResponseInitChain { message ResponseQuery { uint32 code = 1; // bytes data = 2; // use "value" instead. - string log = 3; // nondeterministic - string info = 4; // nondeterministic + string log = 3; // nondeterministic + string info = 4; // nondeterministic int64 index = 5; bytes key = 6; bytes value = 7; @@ -215,53 +256,24 @@ message ResponseQuery { string codespace = 10; } -message ResponseBeginBlock { - repeated Event events = 1 - [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; -} - message ResponseCheckTx { uint32 code = 1; bytes data = 2; - string log = 3; // nondeterministic - string info = 4; // nondeterministic - int64 gas_wanted = 5 [json_name = "gas_wanted"]; - int64 gas_used = 6 [json_name = "gas_used"]; - repeated Event events = 7 - [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; - string codespace = 8; - string sender = 9; - int64 priority = 10; - - // mempool_error is set by CometBFT. - // ABCI applictions creating a ResponseCheckTX should not set mempool_error. - string mempool_error = 11; -} - -message ResponseDeliverTx { - uint32 code = 1; - bytes data = 2; - string log = 3; // nondeterministic - string info = 4; // nondeterministic + string log = 3; // nondeterministic + string info = 4; // nondeterministic int64 gas_wanted = 5 [json_name = "gas_wanted"]; int64 gas_used = 6 [json_name = "gas_used"]; - repeated Event events = 7 [ - (gogoproto.nullable) = false, - (gogoproto.jsontag) = "events,omitempty" - ]; // nondeterministic - string codespace = 8; -} + repeated Event events = 7 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; + string codespace = 8; -message ResponseEndBlock { - repeated ValidatorUpdate validator_updates = 1 [(gogoproto.nullable) = false]; - tendermint.types.ConsensusParams consensus_param_updates = 2; - repeated Event events = 3 - [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; + // These reserved fields were used until v0.37 by the priority mempool (now + // removed). + reserved 9 to 11; + reserved "sender", "priority", "mempool_error"; } message ResponseCommit { - // reserve 1 - bytes data = 2; + reserved 1, 2; // data was previously returned here int64 retain_height = 3; } @@ -273,12 +285,12 @@ message ResponseOfferSnapshot { Result result = 1; enum Result { - UNKNOWN = 0; // Unknown result, abort all snapshot restoration - ACCEPT = 1; // Snapshot accepted, apply chunks - ABORT = 2; // Abort all snapshot restoration - REJECT = 3; // Reject this specific snapshot, try others - REJECT_FORMAT = 4; // Reject all snapshots of this format, try others - REJECT_SENDER = 5; // Reject all snapshots from the sender(s), try others + UNKNOWN = 0; // Unknown result, abort all snapshot restoration + ACCEPT = 1; // Snapshot accepted, apply chunks + ABORT = 2; // Abort all snapshot restoration + REJECT = 3; // Reject this specific snapshot, try others + REJECT_FORMAT = 4; // Reject all snapshots of this format, try others + REJECT_SENDER = 5; // Reject all snapshots from the sender(s), try others } } @@ -288,16 +300,16 @@ message ResponseLoadSnapshotChunk { message ResponseApplySnapshotChunk { Result result = 1; - repeated uint32 refetch_chunks = 2; // Chunks to refetch and reapply - repeated string reject_senders = 3; // Chunk senders to reject and ban + repeated uint32 refetch_chunks = 2; // Chunks to refetch and reapply + repeated string reject_senders = 3; // Chunk senders to reject and ban enum Result { - UNKNOWN = 0; // Unknown result, abort all snapshot restoration - ACCEPT = 1; // Chunk successfully accepted - ABORT = 2; // Abort all snapshot restoration - RETRY = 3; // Retry chunk (combine with refetch and reject) - RETRY_SNAPSHOT = 4; // Retry snapshot (combine with refetch and reject) - REJECT_SNAPSHOT = 5; // Reject this snapshot, try others + UNKNOWN = 0; // Unknown result, abort all snapshot restoration + ACCEPT = 1; // Chunk successfully accepted + ABORT = 2; // Abort all snapshot restoration + RETRY = 3; // Retry chunk (combine with refetch and reject) + RETRY_SNAPSHOT = 4; // Retry snapshot (combine with refetch and reject) + REJECT_SNAPSHOT = 5; // Reject this snapshot, try others } } @@ -315,6 +327,40 @@ message ResponseProcessProposal { } } +message ResponseExtendVote { + bytes vote_extension = 1; +} + +message ResponseVerifyVoteExtension { + VerifyStatus status = 1; + + enum VerifyStatus { + UNKNOWN = 0; + ACCEPT = 1; + // Rejecting the vote extension will reject the entire precommit by the sender. + // Incorrectly implementing this thus has liveness implications as it may affect + // CometBFT's ability to receive 2/3+ valid votes to finalize the block. + // Honest nodes should never be rejected. + REJECT = 2; + } +} + +message ResponseFinalizeBlock { + // set of block events emmitted as part of executing the block + repeated Event events = 1 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; + // the result of executing each transaction including the events + // the particular transction emitted. This should match the order + // of the transactions delivered in the block itself + repeated ExecTxResult tx_results = 2; + // a list of updates to the validator set. These will reflect the validator set at current height + 2. + repeated ValidatorUpdate validator_updates = 3 [(gogoproto.nullable) = false]; + // updates to the consensus params, if any. + tendermint.types.ConsensusParams consensus_param_updates = 4; + // app_hash is the hash of the applications' state which is used to confirm that execution of the transactions was + // deterministic. It is up to the application to decide which algorithm to use. + bytes app_hash = 5; +} + //---------------------------------------- // Misc. @@ -323,6 +369,9 @@ message CommitInfo { repeated VoteInfo votes = 2 [(gogoproto.nullable) = false]; } +// ExtendedCommitInfo is similar to CommitInfo except that it is only used in +// the PrepareProposal request such that CometBFT can provide vote extensions +// to the application. message ExtendedCommitInfo { // The round at which the block proposer decided in the previous height. int32 round = 1; @@ -332,59 +381,77 @@ message ExtendedCommitInfo { } // Event allows application developers to attach additional information to -// ResponseBeginBlock, ResponseEndBlock, ResponseCheckTx and ResponseDeliverTx. +// ResponseFinalizeBlock and ResponseCheckTx. // Later, transactions may be queried using these events. message Event { string type = 1; - repeated EventAttribute attributes = 2 [ - (gogoproto.nullable) = false, - (gogoproto.jsontag) = "attributes,omitempty" - ]; + repeated EventAttribute attributes = 2 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "attributes,omitempty"]; } // EventAttribute is a single key-value pair, associated with an event. message EventAttribute { string key = 1; string value = 2; - bool index = 3; // nondeterministic + bool index = 3; // nondeterministic +} + +// ExecTxResult contains results of executing one individual transaction. +// +// * Its structure is equivalent to #ResponseDeliverTx which will be deprecated/deleted +message ExecTxResult { + uint32 code = 1; + bytes data = 2; + string log = 3; // nondeterministic + string info = 4; // nondeterministic + int64 gas_wanted = 5 [json_name = "gas_wanted"]; + int64 gas_used = 6 [json_name = "gas_used"]; + repeated Event events = 7 + [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; // nondeterministic + string codespace = 8; } // TxResult contains results of executing the transaction. // // One usage is indexing transaction results. message TxResult { - int64 height = 1; - uint32 index = 2; - bytes tx = 3; - ResponseDeliverTx result = 4 [(gogoproto.nullable) = false]; + int64 height = 1; + uint32 index = 2; + bytes tx = 3; + ExecTxResult result = 4 [(gogoproto.nullable) = false]; } //---------------------------------------- // Blockchain Types -// Validator message Validator { - bytes address = 1; // The first 20 bytes of SHA256(public key) + bytes address = 1; // The first 20 bytes of SHA256(public key) // PubKey pub_key = 2 [(gogoproto.nullable)=false]; - int64 power = 3; // The voting power + int64 power = 3; // The voting power } -// ValidatorUpdate message ValidatorUpdate { tendermint.crypto.PublicKey pub_key = 1 [(gogoproto.nullable) = false]; int64 power = 2; } -// VoteInfo message VoteInfo { - Validator validator = 1 [(gogoproto.nullable) = false]; - bool signed_last_block = 2; + Validator validator = 1 [(gogoproto.nullable) = false]; + tendermint.types.BlockIDFlag block_id_flag = 3; + + reserved 2; // signed_last_block } message ExtendedVoteInfo { - Validator validator = 1 [(gogoproto.nullable) = false]; - bool signed_last_block = 2; - bytes vote_extension = 3; // Reserved for future use + // The validator that sent the vote. + Validator validator = 1 [(gogoproto.nullable) = false]; + // Non-deterministic extension provided by the sending validator's application. + bytes vote_extension = 3; + // Vote extension signature created by CometBFT + bytes extension_signature = 4; + // block_id_flag indicates whether the validator voted for a block, nil, or did not vote at all + tendermint.types.BlockIDFlag block_id_flag = 5; + + reserved 2; // signed_last_block } enum MisbehaviorType { @@ -400,8 +467,7 @@ message Misbehavior { // The height when the offense occurred int64 height = 3; // The corresponding time where the offense occurred - google.protobuf.Timestamp time = 4 - [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + google.protobuf.Timestamp time = 4 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; // Total voting power of the validator set in case the ABCI application does // not store historical validators. // https://github.com/tendermint/tendermint/issues/4581 @@ -412,33 +478,9 @@ message Misbehavior { // State Sync Types message Snapshot { - uint64 height = 1; // The height at which the snapshot was taken - uint32 format = 2; // The application-specific snapshot format - uint32 chunks = 3; // Number of chunks in the snapshot - bytes hash = 4; // Arbitrary snapshot hash, equal only if identical - bytes metadata = 5; // Arbitrary application metadata -} - -//---------------------------------------- -// Service Definition - -service ABCIApplication { - rpc Echo(RequestEcho) returns (ResponseEcho); - rpc Flush(RequestFlush) returns (ResponseFlush); - rpc Info(RequestInfo) returns (ResponseInfo); - rpc DeliverTx(RequestDeliverTx) returns (ResponseDeliverTx); - rpc CheckTx(RequestCheckTx) returns (ResponseCheckTx); - rpc Query(RequestQuery) returns (ResponseQuery); - rpc Commit(RequestCommit) returns (ResponseCommit); - rpc InitChain(RequestInitChain) returns (ResponseInitChain); - rpc BeginBlock(RequestBeginBlock) returns (ResponseBeginBlock); - rpc EndBlock(RequestEndBlock) returns (ResponseEndBlock); - rpc ListSnapshots(RequestListSnapshots) returns (ResponseListSnapshots); - rpc OfferSnapshot(RequestOfferSnapshot) returns (ResponseOfferSnapshot); - rpc LoadSnapshotChunk(RequestLoadSnapshotChunk) - returns (ResponseLoadSnapshotChunk); - rpc ApplySnapshotChunk(RequestApplySnapshotChunk) - returns (ResponseApplySnapshotChunk); - rpc PrepareProposal(RequestPrepareProposal) returns (ResponsePrepareProposal); - rpc ProcessProposal(RequestProcessProposal) returns (ResponseProcessProposal); + uint64 height = 1; // The height at which the snapshot was taken + uint32 format = 2; // The application-specific snapshot format + uint32 chunks = 3; // Number of chunks in the snapshot + bytes hash = 4; // Arbitrary snapshot hash, equal only if identical + bytes metadata = 5; // Arbitrary application metadata } diff --git a/packages/api/proto/tendermint/types/evidence.proto b/packages/api/proto/tendermint/types/evidence.proto index 1f35049b..06f30ec2 100644 --- a/packages/api/proto/tendermint/types/evidence.proto +++ b/packages/api/proto/tendermint/types/evidence.proto @@ -30,7 +30,7 @@ message LightClientAttackEvidence { int64 common_height = 2; repeated tendermint.types.Validator byzantine_validators = 3; int64 total_voting_power = 4; - google.protobuf.Timestamp timestamp = 5 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + google.protobuf.Timestamp timestamp = 5 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; } message EvidenceList { diff --git a/packages/api/proto/tendermint/types/params.proto b/packages/api/proto/tendermint/types/params.proto index 66963eec..6a42d5ef 100644 --- a/packages/api/proto/tendermint/types/params.proto +++ b/packages/api/proto/tendermint/types/params.proto @@ -15,6 +15,7 @@ message ConsensusParams { EvidenceParams evidence = 2; ValidatorParams validator = 3; VersionParams version = 4; + ABCIParams abci = 5; } // BlockParams contains limits on the block size. @@ -26,7 +27,7 @@ message BlockParams { // Note: must be greater or equal to -1 int64 max_gas = 2; - reserved 3; // was TimeIotaMs see https://github.com/cometbft/cometbft/pull/5792 + reserved 3; // was TimeIotaMs see https://github.com/tendermint/tendermint/pull/5792 } // EvidenceParams determine how we handle evidence of malfeasance. @@ -42,8 +43,7 @@ message EvidenceParams { // It should correspond with an app's "unbonding period" or other similar // mechanism for handling [Nothing-At-Stake // attacks](https://github.com/ethereum/wiki/wiki/Proof-of-Stake-FAQ#what-is-the-nothing-at-stake-problem-and-how-can-it-be-fixed). - google.protobuf.Duration max_age_duration = 2 - [(gogoproto.nullable) = false, (gogoproto.stdduration) = true]; + google.protobuf.Duration max_age_duration = 2 [(gogoproto.nullable) = false, (gogoproto.stdduration) = true]; // This sets the maximum size of total evidence in bytes that can be committed in a single block. // and should fall comfortably under the max block bytes. @@ -75,3 +75,17 @@ message HashedParams { int64 block_max_bytes = 1; int64 block_max_gas = 2; } + +// ABCIParams configure functionality specific to the Application Blockchain Interface. +message ABCIParams { + // vote_extensions_enable_height configures the first height during which + // vote extensions will be enabled. During this specified height, and for all + // subsequent heights, precommit messages that do not contain valid extension data + // will be considered invalid. Prior to this height, vote extensions will not + // be used or accepted by validators on the network. + // + // Once enabled, vote extensions will be created by the application in ExtendVote, + // passed to the application for validation in VerifyVoteExtension and given + // to the application to use when proposing a block during PrepareProposal. + int64 vote_extensions_enable_height = 1; +} diff --git a/packages/api/proto/tendermint/types/types.proto b/packages/api/proto/tendermint/types/types.proto index 425f041d..a0d545ad 100644 --- a/packages/api/proto/tendermint/types/types.proto +++ b/packages/api/proto/tendermint/types/types.proto @@ -9,17 +9,6 @@ import "tendermint/crypto/proof.proto"; import "tendermint/version/types.proto"; import "tendermint/types/validator.proto"; -// BlockIdFlag indicates which BlcokID the signature is for -enum BlockIDFlag { - option (gogoproto.goproto_enum_stringer) = true; - option (gogoproto.goproto_enum_prefix) = false; - - BLOCK_ID_FLAG_UNKNOWN = 0 [(gogoproto.enumvalue_customname) = "BlockIDFlagUnknown"]; - BLOCK_ID_FLAG_ABSENT = 1 [(gogoproto.enumvalue_customname) = "BlockIDFlagAbsent"]; - BLOCK_ID_FLAG_COMMIT = 2 [(gogoproto.enumvalue_customname) = "BlockIDFlagCommit"]; - BLOCK_ID_FLAG_NIL = 3 [(gogoproto.enumvalue_customname) = "BlockIDFlagNil"]; -} - // SignedMsgType is a type of signed message in the consensus. enum SignedMsgType { option (gogoproto.goproto_enum_stringer) = true; @@ -66,19 +55,19 @@ message Header { BlockID last_block_id = 5 [(gogoproto.nullable) = false]; // hashes of block data - bytes last_commit_hash = 6; // commit from validators from the last block - bytes data_hash = 7; // transactions + bytes last_commit_hash = 6; // commit from validators from the last block + bytes data_hash = 7; // transactions // hashes from the app output from the prev block - bytes validators_hash = 8; // validators for the current block - bytes next_validators_hash = 9; // validators for the next block - bytes consensus_hash = 10; // consensus params for current block - bytes app_hash = 11; // state after txs from the previous block - bytes last_results_hash = 12; // root hash of all results from the txs from the previous block + bytes validators_hash = 8; // validators for the current block + bytes next_validators_hash = 9; // validators for the next block + bytes consensus_hash = 10; // consensus params for current block + bytes app_hash = 11; // state after txs from the previous block + bytes last_results_hash = 12; // root hash of all results from the txs from the previous block // consensus info - bytes evidence_hash = 13; // evidence included in the block - bytes proposer_address = 14; // original proposer of the block + bytes evidence_hash = 13; // evidence included in the block + bytes proposer_address = 14; // original proposer of the block } // Data contains the set of transactions included in the block @@ -89,19 +78,26 @@ message Data { repeated bytes txs = 1; } -// Vote represents a prevote, precommit, or commit vote from validators for +// Vote represents a prevote or precommit vote from validators for // consensus. message Vote { SignedMsgType type = 1; int64 height = 2; int32 round = 3; - BlockID block_id = 4 - [(gogoproto.nullable) = false, (gogoproto.customname) = "BlockID"]; // zero if vote is nil. - google.protobuf.Timestamp timestamp = 5 - [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; - bytes validator_address = 6; - int32 validator_index = 7; - bytes signature = 8; + BlockID block_id = 4 [(gogoproto.nullable) = false, (gogoproto.customname) = "BlockID"]; // zero if vote is nil. + google.protobuf.Timestamp timestamp = 5 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + bytes validator_address = 6; + int32 validator_index = 7; + // Vote signature by the validator if they participated in consensus for the + // associated block. + bytes signature = 8; + // Vote extension provided by the application. Only valid for precommit + // messages. + bytes extension = 9; + // Vote extension signature by the validator if they participated in + // consensus for the associated block. + // Only valid for precommit messages. + bytes extension_signature = 10; } // Commit contains the evidence that a block was committed by a set of validators. @@ -114,11 +110,31 @@ message Commit { // CommitSig is a part of the Vote included in a Commit. message CommitSig { - BlockIDFlag block_id_flag = 1; - bytes validator_address = 2; - google.protobuf.Timestamp timestamp = 3 - [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; - bytes signature = 4; + tendermint.types.BlockIDFlag block_id_flag = 1; + bytes validator_address = 2; + google.protobuf.Timestamp timestamp = 3 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + bytes signature = 4; +} + +message ExtendedCommit { + int64 height = 1; + int32 round = 2; + BlockID block_id = 3 [(gogoproto.nullable) = false, (gogoproto.customname) = "BlockID"]; + repeated ExtendedCommitSig extended_signatures = 4 [(gogoproto.nullable) = false]; +} + +// ExtendedCommitSig retains all the same fields as CommitSig but adds vote +// extension-related fields. We use two signatures to ensure backwards compatibility. +// That is the digest of the original signature is still the same in prior versions +message ExtendedCommitSig { + tendermint.types.BlockIDFlag block_id_flag = 1; + bytes validator_address = 2; + google.protobuf.Timestamp timestamp = 3 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + bytes signature = 4; + // Vote extension data + bytes extension = 5; + // Vote extension signature + bytes extension_signature = 6; } message Proposal { @@ -127,9 +143,8 @@ message Proposal { int32 round = 3; int32 pol_round = 4; BlockID block_id = 5 [(gogoproto.customname) = "BlockID", (gogoproto.nullable) = false]; - google.protobuf.Timestamp timestamp = 6 - [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; - bytes signature = 7; + google.protobuf.Timestamp timestamp = 6 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + bytes signature = 7; } message SignedHeader { diff --git a/packages/api/proto/tendermint/types/validator.proto b/packages/api/proto/tendermint/types/validator.proto index 3e170262..cd5105fa 100644 --- a/packages/api/proto/tendermint/types/validator.proto +++ b/packages/api/proto/tendermint/types/validator.proto @@ -6,6 +6,18 @@ option go_package = "github.com/cometbft/cometbft/proto/tendermint/types"; import "gogoproto/gogo.proto"; import "tendermint/crypto/keys.proto"; +// BlockIdFlag indicates which BlockID the signature is for +enum BlockIDFlag { + option (gogoproto.goproto_enum_stringer) = true; + option (gogoproto.goproto_enum_prefix) = false; + + BLOCK_ID_FLAG_UNKNOWN = 0 [(gogoproto.enumvalue_customname) = "BlockIDFlagUnknown"]; // indicates an error condition + BLOCK_ID_FLAG_ABSENT = 1 [(gogoproto.enumvalue_customname) = "BlockIDFlagAbsent"]; // the vote was not received + BLOCK_ID_FLAG_COMMIT = 2 + [(gogoproto.enumvalue_customname) = "BlockIDFlagCommit"]; // voted for the block that received the majority + BLOCK_ID_FLAG_NIL = 3 [(gogoproto.enumvalue_customname) = "BlockIDFlagNil"]; // voted for nil +} + message ValidatorSet { repeated Validator validators = 1; Validator proposer = 2; diff --git a/packages/api/src/cosmos/app/runtime/v1alpha1/module.ts b/packages/api/src/cosmos/app/runtime/v1alpha1/module.ts new file mode 100644 index 00000000..5e4dc0ef --- /dev/null +++ b/packages/api/src/cosmos/app/runtime/v1alpha1/module.ts @@ -0,0 +1,478 @@ +//@ts-nocheck +import { BinaryReader, BinaryWriter } from "../../../../binary"; +/** Module is the config object for the runtime module. */ +export interface Module { + /** app_name is the name of the app. */ + appName: string; + /** + * begin_blockers specifies the module names of begin blockers + * to call in the order in which they should be called. If this is left empty + * no begin blocker will be registered. + */ + beginBlockers: string[]; + /** + * end_blockers specifies the module names of the end blockers + * to call in the order in which they should be called. If this is left empty + * no end blocker will be registered. + */ + endBlockers: string[]; + /** + * init_genesis specifies the module names of init genesis functions + * to call in the order in which they should be called. If this is left empty + * no init genesis function will be registered. + */ + initGenesis: string[]; + /** + * export_genesis specifies the order in which to export module genesis data. + * If this is left empty, the init_genesis order will be used for export genesis + * if it is specified. + */ + exportGenesis: string[]; + /** + * override_store_keys is an optional list of overrides for the module store keys + * to be used in keeper construction. + */ + overrideStoreKeys: StoreKeyConfig[]; + /** + * skip_store_keys is an optional list of store keys to skip when constructing the + * module's keeper. This is useful when a module does not have a store key. + * NOTE: the provided environment variable will have a fake store service. + */ + skipStoreKeys: string[]; + /** + * order_migrations defines the order in which module migrations are performed. + * If this is left empty, it uses the default migration order. + * https://pkg.go.dev/github.com/cosmos/cosmos-sdk/types/module#DefaultMigrationsOrder + */ + orderMigrations: string[]; + /** + * precommiters specifies the module names of the precommiters + * to call in the order in which they should be called. If this is left empty + * no precommit function will be registered. + */ + precommiters: string[]; + /** + * prepare_check_staters specifies the module names of the prepare_check_staters + * to call in the order in which they should be called. If this is left empty + * no preparecheckstate function will be registered. + */ + prepareCheckStaters: string[]; + /** + * pre_blockers specifies the module names of pre blockers + * to call in the order in which they should be called. If this is left empty + * no pre blocker will be registered. + */ + preBlockers: string[]; +} +export interface ModuleProtoMsg { + typeUrl: "/cosmos.app.runtime.v1alpha1.Module"; + value: Uint8Array; +} +/** Module is the config object for the runtime module. */ +export interface ModuleAmino { + /** app_name is the name of the app. */ + app_name?: string; + /** + * begin_blockers specifies the module names of begin blockers + * to call in the order in which they should be called. If this is left empty + * no begin blocker will be registered. + */ + begin_blockers?: string[]; + /** + * end_blockers specifies the module names of the end blockers + * to call in the order in which they should be called. If this is left empty + * no end blocker will be registered. + */ + end_blockers?: string[]; + /** + * init_genesis specifies the module names of init genesis functions + * to call in the order in which they should be called. If this is left empty + * no init genesis function will be registered. + */ + init_genesis?: string[]; + /** + * export_genesis specifies the order in which to export module genesis data. + * If this is left empty, the init_genesis order will be used for export genesis + * if it is specified. + */ + export_genesis?: string[]; + /** + * override_store_keys is an optional list of overrides for the module store keys + * to be used in keeper construction. + */ + override_store_keys?: StoreKeyConfigAmino[]; + /** + * skip_store_keys is an optional list of store keys to skip when constructing the + * module's keeper. This is useful when a module does not have a store key. + * NOTE: the provided environment variable will have a fake store service. + */ + skip_store_keys?: string[]; + /** + * order_migrations defines the order in which module migrations are performed. + * If this is left empty, it uses the default migration order. + * https://pkg.go.dev/github.com/cosmos/cosmos-sdk/types/module#DefaultMigrationsOrder + */ + order_migrations?: string[]; + /** + * precommiters specifies the module names of the precommiters + * to call in the order in which they should be called. If this is left empty + * no precommit function will be registered. + */ + precommiters?: string[]; + /** + * prepare_check_staters specifies the module names of the prepare_check_staters + * to call in the order in which they should be called. If this is left empty + * no preparecheckstate function will be registered. + */ + prepare_check_staters?: string[]; + /** + * pre_blockers specifies the module names of pre blockers + * to call in the order in which they should be called. If this is left empty + * no pre blocker will be registered. + */ + pre_blockers?: string[]; +} +export interface ModuleAminoMsg { + type: "cosmos-sdk/Module"; + value: ModuleAmino; +} +/** Module is the config object for the runtime module. */ +export interface ModuleSDKType { + app_name: string; + begin_blockers: string[]; + end_blockers: string[]; + init_genesis: string[]; + export_genesis: string[]; + override_store_keys: StoreKeyConfigSDKType[]; + skip_store_keys: string[]; + order_migrations: string[]; + precommiters: string[]; + prepare_check_staters: string[]; + pre_blockers: string[]; +} +/** + * StoreKeyConfig may be supplied to override the default module store key, which + * is the module name. + */ +export interface StoreKeyConfig { + /** name of the module to override the store key of */ + moduleName: string; + /** the kv store key to use instead of the module name. */ + kvStoreKey: string; +} +export interface StoreKeyConfigProtoMsg { + typeUrl: "/cosmos.app.runtime.v1alpha1.StoreKeyConfig"; + value: Uint8Array; +} +/** + * StoreKeyConfig may be supplied to override the default module store key, which + * is the module name. + */ +export interface StoreKeyConfigAmino { + /** name of the module to override the store key of */ + module_name?: string; + /** the kv store key to use instead of the module name. */ + kv_store_key?: string; +} +export interface StoreKeyConfigAminoMsg { + type: "cosmos-sdk/StoreKeyConfig"; + value: StoreKeyConfigAmino; +} +/** + * StoreKeyConfig may be supplied to override the default module store key, which + * is the module name. + */ +export interface StoreKeyConfigSDKType { + module_name: string; + kv_store_key: string; +} +function createBaseModule(): Module { + return { + appName: "", + beginBlockers: [], + endBlockers: [], + initGenesis: [], + exportGenesis: [], + overrideStoreKeys: [], + skipStoreKeys: [], + orderMigrations: [], + precommiters: [], + prepareCheckStaters: [], + preBlockers: [] + }; +} +export const Module = { + typeUrl: "/cosmos.app.runtime.v1alpha1.Module", + encode(message: Module, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.appName !== "") { + writer.uint32(10).string(message.appName); + } + for (const v of message.beginBlockers) { + writer.uint32(18).string(v!); + } + for (const v of message.endBlockers) { + writer.uint32(26).string(v!); + } + for (const v of message.initGenesis) { + writer.uint32(34).string(v!); + } + for (const v of message.exportGenesis) { + writer.uint32(42).string(v!); + } + for (const v of message.overrideStoreKeys) { + StoreKeyConfig.encode(v!, writer.uint32(50).fork()).ldelim(); + } + for (const v of message.skipStoreKeys) { + writer.uint32(90).string(v!); + } + for (const v of message.orderMigrations) { + writer.uint32(58).string(v!); + } + for (const v of message.precommiters) { + writer.uint32(66).string(v!); + } + for (const v of message.prepareCheckStaters) { + writer.uint32(74).string(v!); + } + for (const v of message.preBlockers) { + writer.uint32(82).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.appName = reader.string(); + break; + case 2: + message.beginBlockers.push(reader.string()); + break; + case 3: + message.endBlockers.push(reader.string()); + break; + case 4: + message.initGenesis.push(reader.string()); + break; + case 5: + message.exportGenesis.push(reader.string()); + break; + case 6: + message.overrideStoreKeys.push(StoreKeyConfig.decode(reader, reader.uint32())); + break; + case 11: + message.skipStoreKeys.push(reader.string()); + break; + case 7: + message.orderMigrations.push(reader.string()); + break; + case 8: + message.precommiters.push(reader.string()); + break; + case 9: + message.prepareCheckStaters.push(reader.string()); + break; + case 10: + message.preBlockers.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): Module { + const message = createBaseModule(); + message.appName = object.appName ?? ""; + message.beginBlockers = object.beginBlockers?.map(e => e) || []; + message.endBlockers = object.endBlockers?.map(e => e) || []; + message.initGenesis = object.initGenesis?.map(e => e) || []; + message.exportGenesis = object.exportGenesis?.map(e => e) || []; + message.overrideStoreKeys = object.overrideStoreKeys?.map(e => StoreKeyConfig.fromPartial(e)) || []; + message.skipStoreKeys = object.skipStoreKeys?.map(e => e) || []; + message.orderMigrations = object.orderMigrations?.map(e => e) || []; + message.precommiters = object.precommiters?.map(e => e) || []; + message.prepareCheckStaters = object.prepareCheckStaters?.map(e => e) || []; + message.preBlockers = object.preBlockers?.map(e => e) || []; + return message; + }, + fromAmino(object: ModuleAmino): Module { + const message = createBaseModule(); + if (object.app_name !== undefined && object.app_name !== null) { + message.appName = object.app_name; + } + message.beginBlockers = object.begin_blockers?.map(e => e) || []; + message.endBlockers = object.end_blockers?.map(e => e) || []; + message.initGenesis = object.init_genesis?.map(e => e) || []; + message.exportGenesis = object.export_genesis?.map(e => e) || []; + message.overrideStoreKeys = object.override_store_keys?.map(e => StoreKeyConfig.fromAmino(e)) || []; + message.skipStoreKeys = object.skip_store_keys?.map(e => e) || []; + message.orderMigrations = object.order_migrations?.map(e => e) || []; + message.precommiters = object.precommiters?.map(e => e) || []; + message.prepareCheckStaters = object.prepare_check_staters?.map(e => e) || []; + message.preBlockers = object.pre_blockers?.map(e => e) || []; + return message; + }, + toAmino(message: Module): ModuleAmino { + const obj: any = {}; + obj.app_name = message.appName === "" ? undefined : message.appName; + if (message.beginBlockers) { + obj.begin_blockers = message.beginBlockers.map(e => e); + } else { + obj.begin_blockers = message.beginBlockers; + } + if (message.endBlockers) { + obj.end_blockers = message.endBlockers.map(e => e); + } else { + obj.end_blockers = message.endBlockers; + } + if (message.initGenesis) { + obj.init_genesis = message.initGenesis.map(e => e); + } else { + obj.init_genesis = message.initGenesis; + } + if (message.exportGenesis) { + obj.export_genesis = message.exportGenesis.map(e => e); + } else { + obj.export_genesis = message.exportGenesis; + } + if (message.overrideStoreKeys) { + obj.override_store_keys = message.overrideStoreKeys.map(e => e ? StoreKeyConfig.toAmino(e) : undefined); + } else { + obj.override_store_keys = message.overrideStoreKeys; + } + if (message.skipStoreKeys) { + obj.skip_store_keys = message.skipStoreKeys.map(e => e); + } else { + obj.skip_store_keys = message.skipStoreKeys; + } + if (message.orderMigrations) { + obj.order_migrations = message.orderMigrations.map(e => e); + } else { + obj.order_migrations = message.orderMigrations; + } + if (message.precommiters) { + obj.precommiters = message.precommiters.map(e => e); + } else { + obj.precommiters = message.precommiters; + } + if (message.prepareCheckStaters) { + obj.prepare_check_staters = message.prepareCheckStaters.map(e => e); + } else { + obj.prepare_check_staters = message.prepareCheckStaters; + } + if (message.preBlockers) { + obj.pre_blockers = message.preBlockers.map(e => e); + } else { + obj.pre_blockers = message.preBlockers; + } + return obj; + }, + fromAminoMsg(object: ModuleAminoMsg): Module { + return Module.fromAmino(object.value); + }, + toAminoMsg(message: Module): ModuleAminoMsg { + return { + type: "cosmos-sdk/Module", + value: Module.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleProtoMsg): Module { + return Module.decode(message.value); + }, + toProto(message: Module): Uint8Array { + return Module.encode(message).finish(); + }, + toProtoMsg(message: Module): ModuleProtoMsg { + return { + typeUrl: "/cosmos.app.runtime.v1alpha1.Module", + value: Module.encode(message).finish() + }; + } +}; +function createBaseStoreKeyConfig(): StoreKeyConfig { + return { + moduleName: "", + kvStoreKey: "" + }; +} +export const StoreKeyConfig = { + typeUrl: "/cosmos.app.runtime.v1alpha1.StoreKeyConfig", + encode(message: StoreKeyConfig, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.moduleName !== "") { + writer.uint32(10).string(message.moduleName); + } + if (message.kvStoreKey !== "") { + writer.uint32(18).string(message.kvStoreKey); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): StoreKeyConfig { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStoreKeyConfig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.moduleName = reader.string(); + break; + case 2: + message.kvStoreKey = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): StoreKeyConfig { + const message = createBaseStoreKeyConfig(); + message.moduleName = object.moduleName ?? ""; + message.kvStoreKey = object.kvStoreKey ?? ""; + return message; + }, + fromAmino(object: StoreKeyConfigAmino): StoreKeyConfig { + const message = createBaseStoreKeyConfig(); + if (object.module_name !== undefined && object.module_name !== null) { + message.moduleName = object.module_name; + } + if (object.kv_store_key !== undefined && object.kv_store_key !== null) { + message.kvStoreKey = object.kv_store_key; + } + return message; + }, + toAmino(message: StoreKeyConfig): StoreKeyConfigAmino { + const obj: any = {}; + obj.module_name = message.moduleName === "" ? undefined : message.moduleName; + obj.kv_store_key = message.kvStoreKey === "" ? undefined : message.kvStoreKey; + return obj; + }, + fromAminoMsg(object: StoreKeyConfigAminoMsg): StoreKeyConfig { + return StoreKeyConfig.fromAmino(object.value); + }, + toAminoMsg(message: StoreKeyConfig): StoreKeyConfigAminoMsg { + return { + type: "cosmos-sdk/StoreKeyConfig", + value: StoreKeyConfig.toAmino(message) + }; + }, + fromProtoMsg(message: StoreKeyConfigProtoMsg): StoreKeyConfig { + return StoreKeyConfig.decode(message.value); + }, + toProto(message: StoreKeyConfig): Uint8Array { + return StoreKeyConfig.encode(message).finish(); + }, + toProtoMsg(message: StoreKeyConfig): StoreKeyConfigProtoMsg { + return { + typeUrl: "/cosmos.app.runtime.v1alpha1.StoreKeyConfig", + value: StoreKeyConfig.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/app/v1alpha1/module.ts b/packages/api/src/cosmos/app/v1alpha1/module.ts index 42f36950..86d370a9 100644 --- a/packages/api/src/cosmos/app/v1alpha1/module.ts +++ b/packages/api/src/cosmos/app/v1alpha1/module.ts @@ -85,7 +85,7 @@ export interface PackageReference { * * When a new version of a module is released and items are added to existing * .proto files, these definitions should contain comments of the form - * "Since Revision N" where N is an integer revision. + * "Since: Revision N" where N is an integer revision. * * When the module runtime starts up, it will check the pinned proto * image and panic if there are runtime protobuf definitions that are not @@ -132,7 +132,7 @@ export interface PackageReferenceAmino { * * When a new version of a module is released and items are added to existing * .proto files, these definitions should contain comments of the form - * "Since Revision N" where N is an integer revision. + * "Since: Revision N" where N is an integer revision. * * When the module runtime starts up, it will check the pinned proto * image and panic if there are runtime protobuf definitions that are not diff --git a/packages/api/src/cosmos/auth/module/v1/module.ts b/packages/api/src/cosmos/auth/module/v1/module.ts new file mode 100644 index 00000000..abf89c18 --- /dev/null +++ b/packages/api/src/cosmos/auth/module/v1/module.ts @@ -0,0 +1,270 @@ +//@ts-nocheck +import { BinaryReader, BinaryWriter } from "../../../../binary"; +/** Module is the config object for the auth module. */ +export interface Module { + /** bech32_prefix is the bech32 account prefix for the app. */ + bech32Prefix: string; + /** module_account_permissions are module account permissions. */ + moduleAccountPermissions: ModuleAccountPermission[]; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; + /** + * enable_unordered_transactions determines whether unordered transactions should be supported or not. + * When true, unordered transactions will be validated and processed. + * When false, unordered transactions will be rejected. + */ + enableUnorderedTransactions: boolean; +} +export interface ModuleProtoMsg { + typeUrl: "/cosmos.auth.module.v1.Module"; + value: Uint8Array; +} +/** Module is the config object for the auth module. */ +export interface ModuleAmino { + /** bech32_prefix is the bech32 account prefix for the app. */ + bech32_prefix?: string; + /** module_account_permissions are module account permissions. */ + module_account_permissions?: ModuleAccountPermissionAmino[]; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority?: string; + /** + * enable_unordered_transactions determines whether unordered transactions should be supported or not. + * When true, unordered transactions will be validated and processed. + * When false, unordered transactions will be rejected. + */ + enable_unordered_transactions?: boolean; +} +export interface ModuleAminoMsg { + type: "cosmos-sdk/Module"; + value: ModuleAmino; +} +/** Module is the config object for the auth module. */ +export interface ModuleSDKType { + bech32_prefix: string; + module_account_permissions: ModuleAccountPermissionSDKType[]; + authority: string; + enable_unordered_transactions: boolean; +} +/** ModuleAccountPermission represents permissions for a module account. */ +export interface ModuleAccountPermission { + /** account is the name of the module. */ + account: string; + /** + * permissions are the permissions this module has. Currently recognized + * values are minter, burner and staking. + */ + permissions: string[]; +} +export interface ModuleAccountPermissionProtoMsg { + typeUrl: "/cosmos.auth.module.v1.ModuleAccountPermission"; + value: Uint8Array; +} +/** ModuleAccountPermission represents permissions for a module account. */ +export interface ModuleAccountPermissionAmino { + /** account is the name of the module. */ + account?: string; + /** + * permissions are the permissions this module has. Currently recognized + * values are minter, burner and staking. + */ + permissions?: string[]; +} +export interface ModuleAccountPermissionAminoMsg { + type: "cosmos-sdk/ModuleAccountPermission"; + value: ModuleAccountPermissionAmino; +} +/** ModuleAccountPermission represents permissions for a module account. */ +export interface ModuleAccountPermissionSDKType { + account: string; + permissions: string[]; +} +function createBaseModule(): Module { + return { + bech32Prefix: "", + moduleAccountPermissions: [], + authority: "", + enableUnorderedTransactions: false + }; +} +export const Module = { + typeUrl: "/cosmos.auth.module.v1.Module", + encode(message: Module, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.bech32Prefix !== "") { + writer.uint32(10).string(message.bech32Prefix); + } + for (const v of message.moduleAccountPermissions) { + ModuleAccountPermission.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.authority !== "") { + writer.uint32(26).string(message.authority); + } + if (message.enableUnorderedTransactions === true) { + writer.uint32(32).bool(message.enableUnorderedTransactions); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.bech32Prefix = reader.string(); + break; + case 2: + message.moduleAccountPermissions.push(ModuleAccountPermission.decode(reader, reader.uint32())); + break; + case 3: + message.authority = reader.string(); + break; + case 4: + message.enableUnorderedTransactions = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): Module { + const message = createBaseModule(); + message.bech32Prefix = object.bech32Prefix ?? ""; + message.moduleAccountPermissions = object.moduleAccountPermissions?.map(e => ModuleAccountPermission.fromPartial(e)) || []; + message.authority = object.authority ?? ""; + message.enableUnorderedTransactions = object.enableUnorderedTransactions ?? false; + return message; + }, + fromAmino(object: ModuleAmino): Module { + const message = createBaseModule(); + if (object.bech32_prefix !== undefined && object.bech32_prefix !== null) { + message.bech32Prefix = object.bech32_prefix; + } + message.moduleAccountPermissions = object.module_account_permissions?.map(e => ModuleAccountPermission.fromAmino(e)) || []; + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + if (object.enable_unordered_transactions !== undefined && object.enable_unordered_transactions !== null) { + message.enableUnorderedTransactions = object.enable_unordered_transactions; + } + return message; + }, + toAmino(message: Module): ModuleAmino { + const obj: any = {}; + obj.bech32_prefix = message.bech32Prefix === "" ? undefined : message.bech32Prefix; + if (message.moduleAccountPermissions) { + obj.module_account_permissions = message.moduleAccountPermissions.map(e => e ? ModuleAccountPermission.toAmino(e) : undefined); + } else { + obj.module_account_permissions = message.moduleAccountPermissions; + } + obj.authority = message.authority === "" ? undefined : message.authority; + obj.enable_unordered_transactions = message.enableUnorderedTransactions === false ? undefined : message.enableUnorderedTransactions; + return obj; + }, + fromAminoMsg(object: ModuleAminoMsg): Module { + return Module.fromAmino(object.value); + }, + toAminoMsg(message: Module): ModuleAminoMsg { + return { + type: "cosmos-sdk/Module", + value: Module.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleProtoMsg): Module { + return Module.decode(message.value); + }, + toProto(message: Module): Uint8Array { + return Module.encode(message).finish(); + }, + toProtoMsg(message: Module): ModuleProtoMsg { + return { + typeUrl: "/cosmos.auth.module.v1.Module", + value: Module.encode(message).finish() + }; + } +}; +function createBaseModuleAccountPermission(): ModuleAccountPermission { + return { + account: "", + permissions: [] + }; +} +export const ModuleAccountPermission = { + typeUrl: "/cosmos.auth.module.v1.ModuleAccountPermission", + encode(message: ModuleAccountPermission, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.account !== "") { + writer.uint32(10).string(message.account); + } + for (const v of message.permissions) { + writer.uint32(18).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ModuleAccountPermission { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModuleAccountPermission(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.account = reader.string(); + break; + case 2: + message.permissions.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): ModuleAccountPermission { + const message = createBaseModuleAccountPermission(); + message.account = object.account ?? ""; + message.permissions = object.permissions?.map(e => e) || []; + return message; + }, + fromAmino(object: ModuleAccountPermissionAmino): ModuleAccountPermission { + const message = createBaseModuleAccountPermission(); + if (object.account !== undefined && object.account !== null) { + message.account = object.account; + } + message.permissions = object.permissions?.map(e => e) || []; + return message; + }, + toAmino(message: ModuleAccountPermission): ModuleAccountPermissionAmino { + const obj: any = {}; + obj.account = message.account === "" ? undefined : message.account; + if (message.permissions) { + obj.permissions = message.permissions.map(e => e); + } else { + obj.permissions = message.permissions; + } + return obj; + }, + fromAminoMsg(object: ModuleAccountPermissionAminoMsg): ModuleAccountPermission { + return ModuleAccountPermission.fromAmino(object.value); + }, + toAminoMsg(message: ModuleAccountPermission): ModuleAccountPermissionAminoMsg { + return { + type: "cosmos-sdk/ModuleAccountPermission", + value: ModuleAccountPermission.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleAccountPermissionProtoMsg): ModuleAccountPermission { + return ModuleAccountPermission.decode(message.value); + }, + toProto(message: ModuleAccountPermission): Uint8Array { + return ModuleAccountPermission.encode(message).finish(); + }, + toProtoMsg(message: ModuleAccountPermission): ModuleAccountPermissionProtoMsg { + return { + typeUrl: "/cosmos.auth.module.v1.ModuleAccountPermission", + value: ModuleAccountPermission.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/auth/v1beta1/auth.ts b/packages/api/src/cosmos/auth/v1beta1/auth.ts index 493dcf77..a002fd01 100644 --- a/packages/api/src/cosmos/auth/v1beta1/auth.ts +++ b/packages/api/src/cosmos/auth/v1beta1/auth.ts @@ -1,6 +1,7 @@ //@ts-nocheck import { Any, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { bytesFromBase64, base64FromBytes } from "../../../helpers"; /** * BaseAccount defines a base account type. It contains all the necessary fields * for basic account functionality. Any custom account type should extend this @@ -72,6 +73,39 @@ export interface ModuleAccountSDKType { name: string; permissions: string[]; } +/** ModuleCredential represents a unclaimable pubkey for base accounts controlled by modules. */ +export interface ModuleCredential { + /** module_name is the name of the module used for address derivation (passed into address.Module). */ + moduleName: string; + /** + * derivation_keys is for deriving a module account address (passed into address.Module) + * adding more keys creates sub-account addresses (passed into address.Derive) + */ + derivationKeys: Uint8Array[]; +} +export interface ModuleCredentialProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.ModuleCredential"; + value: Uint8Array; +} +/** ModuleCredential represents a unclaimable pubkey for base accounts controlled by modules. */ +export interface ModuleCredentialAmino { + /** module_name is the name of the module used for address derivation (passed into address.Module). */ + module_name?: string; + /** + * derivation_keys is for deriving a module account address (passed into address.Module) + * adding more keys creates sub-account addresses (passed into address.Derive) + */ + derivation_keys?: string[]; +} +export interface ModuleCredentialAminoMsg { + type: "cosmos-sdk/GroupAccountCredential"; + value: ModuleCredentialAmino; +} +/** ModuleCredential represents a unclaimable pubkey for base accounts controlled by modules. */ +export interface ModuleCredentialSDKType { + module_name: string; + derivation_keys: Uint8Array[]; +} /** Params defines the parameters for the auth module. */ export interface Params { maxMemoCharacters: bigint; @@ -93,7 +127,7 @@ export interface ParamsAmino { sig_verify_cost_secp256k1?: string; } export interface ParamsAminoMsg { - type: "cosmos-sdk/Params"; + type: "cosmos-sdk/x/auth/Params"; value: ParamsAmino; } /** Params defines the parameters for the auth module. */ @@ -306,6 +340,89 @@ export const ModuleAccount = { }; } }; +function createBaseModuleCredential(): ModuleCredential { + return { + moduleName: "", + derivationKeys: [] + }; +} +export const ModuleCredential = { + typeUrl: "/cosmos.auth.v1beta1.ModuleCredential", + encode(message: ModuleCredential, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.moduleName !== "") { + writer.uint32(10).string(message.moduleName); + } + for (const v of message.derivationKeys) { + writer.uint32(18).bytes(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ModuleCredential { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModuleCredential(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.moduleName = reader.string(); + break; + case 2: + message.derivationKeys.push(reader.bytes()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): ModuleCredential { + const message = createBaseModuleCredential(); + message.moduleName = object.moduleName ?? ""; + message.derivationKeys = object.derivationKeys?.map(e => e) || []; + return message; + }, + fromAmino(object: ModuleCredentialAmino): ModuleCredential { + const message = createBaseModuleCredential(); + if (object.module_name !== undefined && object.module_name !== null) { + message.moduleName = object.module_name; + } + message.derivationKeys = object.derivation_keys?.map(e => bytesFromBase64(e)) || []; + return message; + }, + toAmino(message: ModuleCredential): ModuleCredentialAmino { + const obj: any = {}; + obj.module_name = message.moduleName === "" ? undefined : message.moduleName; + if (message.derivationKeys) { + obj.derivation_keys = message.derivationKeys.map(e => base64FromBytes(e)); + } else { + obj.derivation_keys = message.derivationKeys; + } + return obj; + }, + fromAminoMsg(object: ModuleCredentialAminoMsg): ModuleCredential { + return ModuleCredential.fromAmino(object.value); + }, + toAminoMsg(message: ModuleCredential): ModuleCredentialAminoMsg { + return { + type: "cosmos-sdk/GroupAccountCredential", + value: ModuleCredential.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleCredentialProtoMsg): ModuleCredential { + return ModuleCredential.decode(message.value); + }, + toProto(message: ModuleCredential): Uint8Array { + return ModuleCredential.encode(message).finish(); + }, + toProtoMsg(message: ModuleCredential): ModuleCredentialProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.ModuleCredential", + value: ModuleCredential.encode(message).finish() + }; + } +}; function createBaseParams(): Params { return { maxMemoCharacters: BigInt(0), @@ -406,7 +523,7 @@ export const Params = { }, toAminoMsg(message: Params): ParamsAminoMsg { return { - type: "cosmos-sdk/Params", + type: "cosmos-sdk/x/auth/Params", value: Params.toAmino(message) }; }, diff --git a/packages/api/src/cosmos/auth/v1beta1/genesis.ts b/packages/api/src/cosmos/auth/v1beta1/genesis.ts index ac99436c..4dd761ce 100644 --- a/packages/api/src/cosmos/auth/v1beta1/genesis.ts +++ b/packages/api/src/cosmos/auth/v1beta1/genesis.ts @@ -4,7 +4,7 @@ import { Any, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; /** GenesisState defines the auth module's genesis state. */ export interface GenesisState { - /** params defines all the paramaters of the module. */ + /** params defines all the parameters of the module. */ params: Params; /** accounts are the accounts present at genesis. */ accounts: Any[]; @@ -15,8 +15,8 @@ export interface GenesisStateProtoMsg { } /** GenesisState defines the auth module's genesis state. */ export interface GenesisStateAmino { - /** params defines all the paramaters of the module. */ - params?: ParamsAmino; + /** params defines all the parameters of the module. */ + params: ParamsAmino; /** accounts are the accounts present at genesis. */ accounts?: AnyAmino[]; } @@ -82,7 +82,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.params = message.params ? Params.toAmino(message.params) : undefined; + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); if (message.accounts) { obj.accounts = message.accounts.map(e => e ? Any.toAmino(e) : undefined); } else { diff --git a/packages/api/src/cosmos/auth/v1beta1/query.lcd.ts b/packages/api/src/cosmos/auth/v1beta1/query.lcd.ts index 0e3b96b6..38a5d6d3 100644 --- a/packages/api/src/cosmos/auth/v1beta1/query.lcd.ts +++ b/packages/api/src/cosmos/auth/v1beta1/query.lcd.ts @@ -1,7 +1,7 @@ //@ts-nocheck import { setPaginationParams } from "../../../helpers"; import { LCDClient } from "@cosmology/lcd"; -import { QueryAccountsRequest, QueryAccountsResponseSDKType, QueryAccountRequest, QueryAccountResponseSDKType, QueryAccountAddressByIDRequest, QueryAccountAddressByIDResponseSDKType, QueryParamsRequest, QueryParamsResponseSDKType, QueryModuleAccountsRequest, QueryModuleAccountsResponseSDKType, QueryModuleAccountByNameRequest, QueryModuleAccountByNameResponseSDKType, Bech32PrefixRequest, Bech32PrefixResponseSDKType, AddressBytesToStringRequest, AddressBytesToStringResponseSDKType, AddressStringToBytesRequest, AddressStringToBytesResponseSDKType } from "./query"; +import { QueryAccountsRequest, QueryAccountsResponseSDKType, QueryAccountRequest, QueryAccountResponseSDKType, QueryAccountAddressByIDRequest, QueryAccountAddressByIDResponseSDKType, QueryParamsRequest, QueryParamsResponseSDKType, QueryModuleAccountsRequest, QueryModuleAccountsResponseSDKType, QueryModuleAccountByNameRequest, QueryModuleAccountByNameResponseSDKType, Bech32PrefixRequest, Bech32PrefixResponseSDKType, AddressBytesToStringRequest, AddressBytesToStringResponseSDKType, AddressStringToBytesRequest, AddressStringToBytesResponseSDKType, QueryAccountInfoRequest, QueryAccountInfoResponseSDKType } from "./query"; export class LCDQueryClient { req: LCDClient; constructor({ @@ -19,10 +19,12 @@ export class LCDQueryClient { this.bech32Prefix = this.bech32Prefix.bind(this); this.addressBytesToString = this.addressBytesToString.bind(this); this.addressStringToBytes = this.addressStringToBytes.bind(this); + this.accountInfo = this.accountInfo.bind(this); } - /* Accounts returns all the existing accounts + /* Accounts returns all the existing accounts. - Since: cosmos-sdk 0.43 */ + When called from another module, this query might consume a high amount of + gas if the pagination field is incorrectly set. */ async accounts(params: QueryAccountsRequest = { pagination: undefined }): Promise { @@ -40,21 +42,23 @@ export class LCDQueryClient { const endpoint = `cosmos/auth/v1beta1/accounts/${params.address}`; return await this.req.get(endpoint); } - /* AccountAddressByID returns account address based on account number. - - Since: cosmos-sdk 0.46.2 */ + /* AccountAddressByID returns account address based on account number. */ async accountAddressByID(params: QueryAccountAddressByIDRequest): Promise { + const options: any = { + params: {} + }; + if (typeof params?.accountId !== "undefined") { + options.params.account_id = params.accountId; + } const endpoint = `cosmos/auth/v1beta1/address_by_id/${params.id}`; - return await this.req.get(endpoint); + return await this.req.get(endpoint, options); } /* Params queries all parameters. */ async params(_params: QueryParamsRequest = {}): Promise { const endpoint = `cosmos/auth/v1beta1/params`; return await this.req.get(endpoint); } - /* ModuleAccounts returns all the existing module accounts. - - Since: cosmos-sdk 0.46 */ + /* ModuleAccounts returns all the existing module accounts. */ async moduleAccounts(_params: QueryModuleAccountsRequest = {}): Promise { const endpoint = `cosmos/auth/v1beta1/module_accounts`; return await this.req.get(endpoint); @@ -64,25 +68,24 @@ export class LCDQueryClient { const endpoint = `cosmos/auth/v1beta1/module_accounts/${params.name}`; return await this.req.get(endpoint); } - /* Bech32Prefix queries bech32Prefix - - Since: cosmos-sdk 0.46 */ + /* Bech32Prefix queries bech32Prefix */ async bech32Prefix(_params: Bech32PrefixRequest = {}): Promise { const endpoint = `cosmos/auth/v1beta1/bech32`; return await this.req.get(endpoint); } - /* AddressBytesToString converts Account Address bytes to string - - Since: cosmos-sdk 0.46 */ + /* AddressBytesToString converts Account Address bytes to string */ async addressBytesToString(params: AddressBytesToStringRequest): Promise { const endpoint = `cosmos/auth/v1beta1/bech32/${params.addressBytes}`; return await this.req.get(endpoint); } - /* AddressStringToBytes converts Address string to bytes - - Since: cosmos-sdk 0.46 */ + /* AddressStringToBytes converts Address string to bytes */ async addressStringToBytes(params: AddressStringToBytesRequest): Promise { const endpoint = `cosmos/auth/v1beta1/bech32/${params.addressString}`; return await this.req.get(endpoint); } + /* AccountInfo queries account info which is common to all account types. */ + async accountInfo(params: QueryAccountInfoRequest): Promise { + const endpoint = `cosmos/auth/v1beta1/account_info/${params.address}`; + return await this.req.get(endpoint); + } } \ No newline at end of file diff --git a/packages/api/src/cosmos/auth/v1beta1/query.rpc.Query.ts b/packages/api/src/cosmos/auth/v1beta1/query.rpc.Query.ts index 7e8b1d2c..f6e45af9 100644 --- a/packages/api/src/cosmos/auth/v1beta1/query.rpc.Query.ts +++ b/packages/api/src/cosmos/auth/v1beta1/query.rpc.Query.ts @@ -2,51 +2,34 @@ import { Rpc } from "../../../helpers"; import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryAccountsRequest, QueryAccountsResponse, QueryAccountRequest, QueryAccountResponse, QueryAccountAddressByIDRequest, QueryAccountAddressByIDResponse, QueryParamsRequest, QueryParamsResponse, QueryModuleAccountsRequest, QueryModuleAccountsResponse, QueryModuleAccountByNameRequest, QueryModuleAccountByNameResponse, Bech32PrefixRequest, Bech32PrefixResponse, AddressBytesToStringRequest, AddressBytesToStringResponse, AddressStringToBytesRequest, AddressStringToBytesResponse } from "./query"; +import { QueryAccountsRequest, QueryAccountsResponse, QueryAccountRequest, QueryAccountResponse, QueryAccountAddressByIDRequest, QueryAccountAddressByIDResponse, QueryParamsRequest, QueryParamsResponse, QueryModuleAccountsRequest, QueryModuleAccountsResponse, QueryModuleAccountByNameRequest, QueryModuleAccountByNameResponse, Bech32PrefixRequest, Bech32PrefixResponse, AddressBytesToStringRequest, AddressBytesToStringResponse, AddressStringToBytesRequest, AddressStringToBytesResponse, QueryAccountInfoRequest, QueryAccountInfoResponse } from "./query"; /** Query defines the gRPC querier service. */ export interface Query { /** - * Accounts returns all the existing accounts + * Accounts returns all the existing accounts. * - * Since: cosmos-sdk 0.43 + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. */ accounts(request?: QueryAccountsRequest): Promise; /** Account returns account details based on address. */ account(request: QueryAccountRequest): Promise; - /** - * AccountAddressByID returns account address based on account number. - * - * Since: cosmos-sdk 0.46.2 - */ + /** AccountAddressByID returns account address based on account number. */ accountAddressByID(request: QueryAccountAddressByIDRequest): Promise; /** Params queries all parameters. */ params(request?: QueryParamsRequest): Promise; - /** - * ModuleAccounts returns all the existing module accounts. - * - * Since: cosmos-sdk 0.46 - */ + /** ModuleAccounts returns all the existing module accounts. */ moduleAccounts(request?: QueryModuleAccountsRequest): Promise; /** ModuleAccountByName returns the module account info by module name */ moduleAccountByName(request: QueryModuleAccountByNameRequest): Promise; - /** - * Bech32Prefix queries bech32Prefix - * - * Since: cosmos-sdk 0.46 - */ + /** Bech32Prefix queries bech32Prefix */ bech32Prefix(request?: Bech32PrefixRequest): Promise; - /** - * AddressBytesToString converts Account Address bytes to string - * - * Since: cosmos-sdk 0.46 - */ + /** AddressBytesToString converts Account Address bytes to string */ addressBytesToString(request: AddressBytesToStringRequest): Promise; - /** - * AddressStringToBytes converts Address string to bytes - * - * Since: cosmos-sdk 0.46 - */ + /** AddressStringToBytes converts Address string to bytes */ addressStringToBytes(request: AddressStringToBytesRequest): Promise; + /** AccountInfo queries account info which is common to all account types. */ + accountInfo(request: QueryAccountInfoRequest): Promise; } export class QueryClientImpl implements Query { private readonly rpc: Rpc; @@ -61,6 +44,7 @@ export class QueryClientImpl implements Query { this.bech32Prefix = this.bech32Prefix.bind(this); this.addressBytesToString = this.addressBytesToString.bind(this); this.addressStringToBytes = this.addressStringToBytes.bind(this); + this.accountInfo = this.accountInfo.bind(this); } accounts(request: QueryAccountsRequest = { pagination: undefined @@ -109,6 +93,11 @@ export class QueryClientImpl implements Query { const promise = this.rpc.request("cosmos.auth.v1beta1.Query", "AddressStringToBytes", data); return promise.then(data => AddressStringToBytesResponse.decode(new BinaryReader(data))); } + accountInfo(request: QueryAccountInfoRequest): Promise { + const data = QueryAccountInfoRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.auth.v1beta1.Query", "AccountInfo", data); + return promise.then(data => QueryAccountInfoResponse.decode(new BinaryReader(data))); + } } export const createRpcQueryExtension = (base: QueryClient) => { const rpc = createProtobufRpcClient(base); @@ -140,6 +129,9 @@ export const createRpcQueryExtension = (base: QueryClient) => { }, addressStringToBytes(request: AddressStringToBytesRequest): Promise { return queryService.addressStringToBytes(request); + }, + accountInfo(request: QueryAccountInfoRequest): Promise { + return queryService.accountInfo(request); } }; }; \ No newline at end of file diff --git a/packages/api/src/cosmos/auth/v1beta1/query.ts b/packages/api/src/cosmos/auth/v1beta1/query.ts index c33a10c0..00fe55cc 100644 --- a/packages/api/src/cosmos/auth/v1beta1/query.ts +++ b/packages/api/src/cosmos/auth/v1beta1/query.ts @@ -1,14 +1,10 @@ //@ts-nocheck import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; -import { Params, ParamsAmino, ParamsSDKType, BaseAccount, BaseAccountProtoMsg, BaseAccountSDKType, ModuleAccount, ModuleAccountProtoMsg, ModuleAccountSDKType } from "./auth"; +import { Params, ParamsAmino, ParamsSDKType, BaseAccount, BaseAccountProtoMsg, BaseAccountAmino, BaseAccountSDKType, ModuleAccount, ModuleAccountProtoMsg, ModuleAccountSDKType } from "./auth"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { bytesFromBase64, base64FromBytes } from "../../../helpers"; -/** - * QueryAccountsRequest is the request type for the Query/Accounts RPC method. - * - * Since: cosmos-sdk 0.43 - */ +/** QueryAccountsRequest is the request type for the Query/Accounts RPC method. */ export interface QueryAccountsRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; @@ -17,11 +13,7 @@ export interface QueryAccountsRequestProtoMsg { typeUrl: "/cosmos.auth.v1beta1.QueryAccountsRequest"; value: Uint8Array; } -/** - * QueryAccountsRequest is the request type for the Query/Accounts RPC method. - * - * Since: cosmos-sdk 0.43 - */ +/** QueryAccountsRequest is the request type for the Query/Accounts RPC method. */ export interface QueryAccountsRequestAmino { /** pagination defines an optional pagination for the request. */ pagination?: PageRequestAmino; @@ -30,19 +22,11 @@ export interface QueryAccountsRequestAminoMsg { type: "cosmos-sdk/QueryAccountsRequest"; value: QueryAccountsRequestAmino; } -/** - * QueryAccountsRequest is the request type for the Query/Accounts RPC method. - * - * Since: cosmos-sdk 0.43 - */ +/** QueryAccountsRequest is the request type for the Query/Accounts RPC method. */ export interface QueryAccountsRequestSDKType { pagination?: PageRequestSDKType; } -/** - * QueryAccountsResponse is the response type for the Query/Accounts RPC method. - * - * Since: cosmos-sdk 0.43 - */ +/** QueryAccountsResponse is the response type for the Query/Accounts RPC method. */ export interface QueryAccountsResponse { /** accounts are the existing accounts */ accounts: (BaseAccount | Any)[] | Any[]; @@ -56,11 +40,7 @@ export interface QueryAccountsResponseProtoMsg { export type QueryAccountsResponseEncoded = Omit & { /** accounts are the existing accounts */accounts: (BaseAccountProtoMsg | AnyProtoMsg)[]; }; -/** - * QueryAccountsResponse is the response type for the Query/Accounts RPC method. - * - * Since: cosmos-sdk 0.43 - */ +/** QueryAccountsResponse is the response type for the Query/Accounts RPC method. */ export interface QueryAccountsResponseAmino { /** accounts are the existing accounts */ accounts?: AnyAmino[]; @@ -71,11 +51,7 @@ export interface QueryAccountsResponseAminoMsg { type: "cosmos-sdk/QueryAccountsResponse"; value: QueryAccountsResponseAmino; } -/** - * QueryAccountsResponse is the response type for the Query/Accounts RPC method. - * - * Since: cosmos-sdk 0.43 - */ +/** QueryAccountsResponse is the response type for the Query/Accounts RPC method. */ export interface QueryAccountsResponseSDKType { accounts: (BaseAccountSDKType | AnySDKType)[]; pagination?: PageResponseSDKType; @@ -163,37 +139,21 @@ export interface QueryParamsResponseAminoMsg { export interface QueryParamsResponseSDKType { params: ParamsSDKType; } -/** - * QueryModuleAccountsRequest is the request type for the Query/ModuleAccounts RPC method. - * - * Since: cosmos-sdk 0.46 - */ +/** QueryModuleAccountsRequest is the request type for the Query/ModuleAccounts RPC method. */ export interface QueryModuleAccountsRequest {} export interface QueryModuleAccountsRequestProtoMsg { typeUrl: "/cosmos.auth.v1beta1.QueryModuleAccountsRequest"; value: Uint8Array; } -/** - * QueryModuleAccountsRequest is the request type for the Query/ModuleAccounts RPC method. - * - * Since: cosmos-sdk 0.46 - */ +/** QueryModuleAccountsRequest is the request type for the Query/ModuleAccounts RPC method. */ export interface QueryModuleAccountsRequestAmino {} export interface QueryModuleAccountsRequestAminoMsg { type: "cosmos-sdk/QueryModuleAccountsRequest"; value: QueryModuleAccountsRequestAmino; } -/** - * QueryModuleAccountsRequest is the request type for the Query/ModuleAccounts RPC method. - * - * Since: cosmos-sdk 0.46 - */ +/** QueryModuleAccountsRequest is the request type for the Query/ModuleAccounts RPC method. */ export interface QueryModuleAccountsRequestSDKType {} -/** - * QueryModuleAccountsResponse is the response type for the Query/ModuleAccounts RPC method. - * - * Since: cosmos-sdk 0.46 - */ +/** QueryModuleAccountsResponse is the response type for the Query/ModuleAccounts RPC method. */ export interface QueryModuleAccountsResponse { accounts: (ModuleAccount | Any)[] | Any[]; } @@ -204,11 +164,7 @@ export interface QueryModuleAccountsResponseProtoMsg { export type QueryModuleAccountsResponseEncoded = Omit & { accounts: (ModuleAccountProtoMsg | AnyProtoMsg)[]; }; -/** - * QueryModuleAccountsResponse is the response type for the Query/ModuleAccounts RPC method. - * - * Since: cosmos-sdk 0.46 - */ +/** QueryModuleAccountsResponse is the response type for the Query/ModuleAccounts RPC method. */ export interface QueryModuleAccountsResponseAmino { accounts?: AnyAmino[]; } @@ -216,11 +172,7 @@ export interface QueryModuleAccountsResponseAminoMsg { type: "cosmos-sdk/QueryModuleAccountsResponse"; value: QueryModuleAccountsResponseAmino; } -/** - * QueryModuleAccountsResponse is the response type for the Query/ModuleAccounts RPC method. - * - * Since: cosmos-sdk 0.46 - */ +/** QueryModuleAccountsResponse is the response type for the Query/ModuleAccounts RPC method. */ export interface QueryModuleAccountsResponseSDKType { accounts: (ModuleAccountSDKType | AnySDKType)[]; } @@ -267,37 +219,21 @@ export interface QueryModuleAccountByNameResponseAminoMsg { export interface QueryModuleAccountByNameResponseSDKType { account?: ModuleAccountSDKType | AnySDKType | undefined; } -/** - * Bech32PrefixRequest is the request type for Bech32Prefix rpc method. - * - * Since: cosmos-sdk 0.46 - */ +/** Bech32PrefixRequest is the request type for Bech32Prefix rpc method. */ export interface Bech32PrefixRequest {} export interface Bech32PrefixRequestProtoMsg { typeUrl: "/cosmos.auth.v1beta1.Bech32PrefixRequest"; value: Uint8Array; } -/** - * Bech32PrefixRequest is the request type for Bech32Prefix rpc method. - * - * Since: cosmos-sdk 0.46 - */ +/** Bech32PrefixRequest is the request type for Bech32Prefix rpc method. */ export interface Bech32PrefixRequestAmino {} export interface Bech32PrefixRequestAminoMsg { type: "cosmos-sdk/Bech32PrefixRequest"; value: Bech32PrefixRequestAmino; } -/** - * Bech32PrefixRequest is the request type for Bech32Prefix rpc method. - * - * Since: cosmos-sdk 0.46 - */ +/** Bech32PrefixRequest is the request type for Bech32Prefix rpc method. */ export interface Bech32PrefixRequestSDKType {} -/** - * Bech32PrefixResponse is the response type for Bech32Prefix rpc method. - * - * Since: cosmos-sdk 0.46 - */ +/** Bech32PrefixResponse is the response type for Bech32Prefix rpc method. */ export interface Bech32PrefixResponse { bech32Prefix: string; } @@ -305,11 +241,7 @@ export interface Bech32PrefixResponseProtoMsg { typeUrl: "/cosmos.auth.v1beta1.Bech32PrefixResponse"; value: Uint8Array; } -/** - * Bech32PrefixResponse is the response type for Bech32Prefix rpc method. - * - * Since: cosmos-sdk 0.46 - */ +/** Bech32PrefixResponse is the response type for Bech32Prefix rpc method. */ export interface Bech32PrefixResponseAmino { bech32_prefix?: string; } @@ -317,19 +249,11 @@ export interface Bech32PrefixResponseAminoMsg { type: "cosmos-sdk/Bech32PrefixResponse"; value: Bech32PrefixResponseAmino; } -/** - * Bech32PrefixResponse is the response type for Bech32Prefix rpc method. - * - * Since: cosmos-sdk 0.46 - */ +/** Bech32PrefixResponse is the response type for Bech32Prefix rpc method. */ export interface Bech32PrefixResponseSDKType { bech32_prefix: string; } -/** - * AddressBytesToStringRequest is the request type for AddressString rpc method. - * - * Since: cosmos-sdk 0.46 - */ +/** AddressBytesToStringRequest is the request type for AddressString rpc method. */ export interface AddressBytesToStringRequest { addressBytes: Uint8Array; } @@ -337,11 +261,7 @@ export interface AddressBytesToStringRequestProtoMsg { typeUrl: "/cosmos.auth.v1beta1.AddressBytesToStringRequest"; value: Uint8Array; } -/** - * AddressBytesToStringRequest is the request type for AddressString rpc method. - * - * Since: cosmos-sdk 0.46 - */ +/** AddressBytesToStringRequest is the request type for AddressString rpc method. */ export interface AddressBytesToStringRequestAmino { address_bytes?: string; } @@ -349,19 +269,11 @@ export interface AddressBytesToStringRequestAminoMsg { type: "cosmos-sdk/AddressBytesToStringRequest"; value: AddressBytesToStringRequestAmino; } -/** - * AddressBytesToStringRequest is the request type for AddressString rpc method. - * - * Since: cosmos-sdk 0.46 - */ +/** AddressBytesToStringRequest is the request type for AddressString rpc method. */ export interface AddressBytesToStringRequestSDKType { address_bytes: Uint8Array; } -/** - * AddressBytesToStringResponse is the response type for AddressString rpc method. - * - * Since: cosmos-sdk 0.46 - */ +/** AddressBytesToStringResponse is the response type for AddressString rpc method. */ export interface AddressBytesToStringResponse { addressString: string; } @@ -369,11 +281,7 @@ export interface AddressBytesToStringResponseProtoMsg { typeUrl: "/cosmos.auth.v1beta1.AddressBytesToStringResponse"; value: Uint8Array; } -/** - * AddressBytesToStringResponse is the response type for AddressString rpc method. - * - * Since: cosmos-sdk 0.46 - */ +/** AddressBytesToStringResponse is the response type for AddressString rpc method. */ export interface AddressBytesToStringResponseAmino { address_string?: string; } @@ -381,19 +289,11 @@ export interface AddressBytesToStringResponseAminoMsg { type: "cosmos-sdk/AddressBytesToStringResponse"; value: AddressBytesToStringResponseAmino; } -/** - * AddressBytesToStringResponse is the response type for AddressString rpc method. - * - * Since: cosmos-sdk 0.46 - */ +/** AddressBytesToStringResponse is the response type for AddressString rpc method. */ export interface AddressBytesToStringResponseSDKType { address_string: string; } -/** - * AddressStringToBytesRequest is the request type for AccountBytes rpc method. - * - * Since: cosmos-sdk 0.46 - */ +/** AddressStringToBytesRequest is the request type for AccountBytes rpc method. */ export interface AddressStringToBytesRequest { addressString: string; } @@ -401,11 +301,7 @@ export interface AddressStringToBytesRequestProtoMsg { typeUrl: "/cosmos.auth.v1beta1.AddressStringToBytesRequest"; value: Uint8Array; } -/** - * AddressStringToBytesRequest is the request type for AccountBytes rpc method. - * - * Since: cosmos-sdk 0.46 - */ +/** AddressStringToBytesRequest is the request type for AccountBytes rpc method. */ export interface AddressStringToBytesRequestAmino { address_string?: string; } @@ -413,19 +309,11 @@ export interface AddressStringToBytesRequestAminoMsg { type: "cosmos-sdk/AddressStringToBytesRequest"; value: AddressStringToBytesRequestAmino; } -/** - * AddressStringToBytesRequest is the request type for AccountBytes rpc method. - * - * Since: cosmos-sdk 0.46 - */ +/** AddressStringToBytesRequest is the request type for AccountBytes rpc method. */ export interface AddressStringToBytesRequestSDKType { address_string: string; } -/** - * AddressStringToBytesResponse is the response type for AddressBytes rpc method. - * - * Since: cosmos-sdk 0.46 - */ +/** AddressStringToBytesResponse is the response type for AddressBytes rpc method. */ export interface AddressStringToBytesResponse { addressBytes: Uint8Array; } @@ -433,11 +321,7 @@ export interface AddressStringToBytesResponseProtoMsg { typeUrl: "/cosmos.auth.v1beta1.AddressStringToBytesResponse"; value: Uint8Array; } -/** - * AddressStringToBytesResponse is the response type for AddressBytes rpc method. - * - * Since: cosmos-sdk 0.46 - */ +/** AddressStringToBytesResponse is the response type for AddressBytes rpc method. */ export interface AddressStringToBytesResponseAmino { address_bytes?: string; } @@ -445,61 +329,53 @@ export interface AddressStringToBytesResponseAminoMsg { type: "cosmos-sdk/AddressStringToBytesResponse"; value: AddressStringToBytesResponseAmino; } -/** - * AddressStringToBytesResponse is the response type for AddressBytes rpc method. - * - * Since: cosmos-sdk 0.46 - */ +/** AddressStringToBytesResponse is the response type for AddressBytes rpc method. */ export interface AddressStringToBytesResponseSDKType { address_bytes: Uint8Array; } -/** - * QueryAccountAddressByIDRequest is the request type for AccountAddressByID rpc method - * - * Since: cosmos-sdk 0.46.2 - */ +/** QueryAccountAddressByIDRequest is the request type for AccountAddressByID rpc method */ export interface QueryAccountAddressByIDRequest { /** + * Deprecated, use account_id instead + * * id is the account number of the address to be queried. This field * should have been an uint64 (like all account numbers), and will be * updated to uint64 in a future version of the auth query. */ + /** @deprecated */ id: bigint; + /** account_id is the account number of the address to be queried. */ + accountId: bigint; } export interface QueryAccountAddressByIDRequestProtoMsg { typeUrl: "/cosmos.auth.v1beta1.QueryAccountAddressByIDRequest"; value: Uint8Array; } -/** - * QueryAccountAddressByIDRequest is the request type for AccountAddressByID rpc method - * - * Since: cosmos-sdk 0.46.2 - */ +/** QueryAccountAddressByIDRequest is the request type for AccountAddressByID rpc method */ export interface QueryAccountAddressByIDRequestAmino { /** + * Deprecated, use account_id instead + * * id is the account number of the address to be queried. This field * should have been an uint64 (like all account numbers), and will be * updated to uint64 in a future version of the auth query. */ + /** @deprecated */ id?: string; + /** account_id is the account number of the address to be queried. */ + account_id?: string; } export interface QueryAccountAddressByIDRequestAminoMsg { type: "cosmos-sdk/QueryAccountAddressByIDRequest"; value: QueryAccountAddressByIDRequestAmino; } -/** - * QueryAccountAddressByIDRequest is the request type for AccountAddressByID rpc method - * - * Since: cosmos-sdk 0.46.2 - */ +/** QueryAccountAddressByIDRequest is the request type for AccountAddressByID rpc method */ export interface QueryAccountAddressByIDRequestSDKType { + /** @deprecated */ id: bigint; + account_id: bigint; } -/** - * QueryAccountAddressByIDResponse is the response type for AccountAddressByID rpc method - * - * Since: cosmos-sdk 0.46.2 - */ +/** QueryAccountAddressByIDResponse is the response type for AccountAddressByID rpc method */ export interface QueryAccountAddressByIDResponse { accountAddress: string; } @@ -507,11 +383,7 @@ export interface QueryAccountAddressByIDResponseProtoMsg { typeUrl: "/cosmos.auth.v1beta1.QueryAccountAddressByIDResponse"; value: Uint8Array; } -/** - * QueryAccountAddressByIDResponse is the response type for AccountAddressByID rpc method - * - * Since: cosmos-sdk 0.46.2 - */ +/** QueryAccountAddressByIDResponse is the response type for AccountAddressByID rpc method */ export interface QueryAccountAddressByIDResponseAmino { account_address?: string; } @@ -519,14 +391,54 @@ export interface QueryAccountAddressByIDResponseAminoMsg { type: "cosmos-sdk/QueryAccountAddressByIDResponse"; value: QueryAccountAddressByIDResponseAmino; } -/** - * QueryAccountAddressByIDResponse is the response type for AccountAddressByID rpc method - * - * Since: cosmos-sdk 0.46.2 - */ +/** QueryAccountAddressByIDResponse is the response type for AccountAddressByID rpc method */ export interface QueryAccountAddressByIDResponseSDKType { account_address: string; } +/** QueryAccountInfoRequest is the Query/AccountInfo request type. */ +export interface QueryAccountInfoRequest { + /** address is the account address string. */ + address: string; +} +export interface QueryAccountInfoRequestProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountInfoRequest"; + value: Uint8Array; +} +/** QueryAccountInfoRequest is the Query/AccountInfo request type. */ +export interface QueryAccountInfoRequestAmino { + /** address is the account address string. */ + address?: string; +} +export interface QueryAccountInfoRequestAminoMsg { + type: "cosmos-sdk/QueryAccountInfoRequest"; + value: QueryAccountInfoRequestAmino; +} +/** QueryAccountInfoRequest is the Query/AccountInfo request type. */ +export interface QueryAccountInfoRequestSDKType { + address: string; +} +/** QueryAccountInfoResponse is the Query/AccountInfo response type. */ +export interface QueryAccountInfoResponse { + /** info is the account info which is represented by BaseAccount. */ + info?: BaseAccount; +} +export interface QueryAccountInfoResponseProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountInfoResponse"; + value: Uint8Array; +} +/** QueryAccountInfoResponse is the Query/AccountInfo response type. */ +export interface QueryAccountInfoResponseAmino { + /** info is the account info which is represented by BaseAccount. */ + info?: BaseAccountAmino; +} +export interface QueryAccountInfoResponseAminoMsg { + type: "cosmos-sdk/QueryAccountInfoResponse"; + value: QueryAccountInfoResponseAmino; +} +/** QueryAccountInfoResponse is the Query/AccountInfo response type. */ +export interface QueryAccountInfoResponseSDKType { + info?: BaseAccountSDKType; +} function createBaseQueryAccountsRequest(): QueryAccountsRequest { return { pagination: undefined @@ -641,7 +553,7 @@ export const QueryAccountsResponse = { }, fromAmino(object: QueryAccountsResponseAmino): QueryAccountsResponse { const message = createBaseQueryAccountsResponse(); - message.accounts = object.accounts?.map(e => AccountI_FromAmino(e)) || []; + message.accounts = object.accounts?.map(e => Cosmos_authv1beta1AccountI_FromAmino(e)) || []; if (object.pagination !== undefined && object.pagination !== null) { message.pagination = PageResponse.fromAmino(object.pagination); } @@ -650,7 +562,7 @@ export const QueryAccountsResponse = { toAmino(message: QueryAccountsResponse): QueryAccountsResponseAmino { const obj: any = {}; if (message.accounts) { - obj.accounts = message.accounts.map(e => e ? AccountI_ToAmino((e as Any)) : undefined); + obj.accounts = message.accounts.map(e => e ? Cosmos_authv1beta1AccountI_ToAmino((e as Any)) : undefined); } else { obj.accounts = message.accounts; } @@ -769,7 +681,7 @@ export const QueryAccountResponse = { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.account = (AccountI_InterfaceDecoder(reader) as Any); + message.account = (Cosmos_authv1beta1AccountI_InterfaceDecoder(reader) as Any); break; default: reader.skipType(tag & 7); @@ -786,13 +698,13 @@ export const QueryAccountResponse = { fromAmino(object: QueryAccountResponseAmino): QueryAccountResponse { const message = createBaseQueryAccountResponse(); if (object.account !== undefined && object.account !== null) { - message.account = AccountI_FromAmino(object.account); + message.account = Cosmos_authv1beta1AccountI_FromAmino(object.account); } return message; }, toAmino(message: QueryAccountResponse): QueryAccountResponseAmino { const obj: any = {}; - obj.account = message.account ? AccountI_ToAmino((message.account as Any)) : undefined; + obj.account = message.account ? Cosmos_authv1beta1AccountI_ToAmino((message.account as Any)) : undefined; return obj; }, fromAminoMsg(object: QueryAccountResponseAminoMsg): QueryAccountResponse { @@ -1035,13 +947,13 @@ export const QueryModuleAccountsResponse = { }, fromAmino(object: QueryModuleAccountsResponseAmino): QueryModuleAccountsResponse { const message = createBaseQueryModuleAccountsResponse(); - message.accounts = object.accounts?.map(e => ModuleAccountI_FromAmino(e)) || []; + message.accounts = object.accounts?.map(e => Cosmos_authv1beta1ModuleAccountI_FromAmino(e)) || []; return message; }, toAmino(message: QueryModuleAccountsResponse): QueryModuleAccountsResponseAmino { const obj: any = {}; if (message.accounts) { - obj.accounts = message.accounts.map(e => e ? ModuleAccountI_ToAmino((e as Any)) : undefined); + obj.accounts = message.accounts.map(e => e ? Cosmos_authv1beta1ModuleAccountI_ToAmino((e as Any)) : undefined); } else { obj.accounts = message.accounts; } @@ -1159,7 +1071,7 @@ export const QueryModuleAccountByNameResponse = { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.account = (ModuleAccountI_InterfaceDecoder(reader) as Any); + message.account = (Cosmos_authv1beta1ModuleAccountI_InterfaceDecoder(reader) as Any); break; default: reader.skipType(tag & 7); @@ -1176,13 +1088,13 @@ export const QueryModuleAccountByNameResponse = { fromAmino(object: QueryModuleAccountByNameResponseAmino): QueryModuleAccountByNameResponse { const message = createBaseQueryModuleAccountByNameResponse(); if (object.account !== undefined && object.account !== null) { - message.account = ModuleAccountI_FromAmino(object.account); + message.account = Cosmos_authv1beta1ModuleAccountI_FromAmino(object.account); } return message; }, toAmino(message: QueryModuleAccountByNameResponse): QueryModuleAccountByNameResponseAmino { const obj: any = {}; - obj.account = message.account ? ModuleAccountI_ToAmino((message.account as Any)) : undefined; + obj.account = message.account ? Cosmos_authv1beta1ModuleAccountI_ToAmino((message.account as Any)) : undefined; return obj; }, fromAminoMsg(object: QueryModuleAccountByNameResponseAminoMsg): QueryModuleAccountByNameResponse { @@ -1610,7 +1522,8 @@ export const AddressStringToBytesResponse = { }; function createBaseQueryAccountAddressByIDRequest(): QueryAccountAddressByIDRequest { return { - id: BigInt(0) + id: BigInt(0), + accountId: BigInt(0) }; } export const QueryAccountAddressByIDRequest = { @@ -1619,6 +1532,9 @@ export const QueryAccountAddressByIDRequest = { if (message.id !== BigInt(0)) { writer.uint32(8).int64(message.id); } + if (message.accountId !== BigInt(0)) { + writer.uint32(16).uint64(message.accountId); + } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountAddressByIDRequest { @@ -1631,6 +1547,9 @@ export const QueryAccountAddressByIDRequest = { case 1: message.id = reader.int64(); break; + case 2: + message.accountId = reader.uint64(); + break; default: reader.skipType(tag & 7); break; @@ -1641,6 +1560,7 @@ export const QueryAccountAddressByIDRequest = { fromPartial(object: Partial): QueryAccountAddressByIDRequest { const message = createBaseQueryAccountAddressByIDRequest(); message.id = object.id !== undefined && object.id !== null ? BigInt(object.id.toString()) : BigInt(0); + message.accountId = object.accountId !== undefined && object.accountId !== null ? BigInt(object.accountId.toString()) : BigInt(0); return message; }, fromAmino(object: QueryAccountAddressByIDRequestAmino): QueryAccountAddressByIDRequest { @@ -1648,11 +1568,15 @@ export const QueryAccountAddressByIDRequest = { if (object.id !== undefined && object.id !== null) { message.id = BigInt(object.id); } + if (object.account_id !== undefined && object.account_id !== null) { + message.accountId = BigInt(object.account_id); + } return message; }, toAmino(message: QueryAccountAddressByIDRequest): QueryAccountAddressByIDRequestAmino { const obj: any = {}; obj.id = message.id !== BigInt(0) ? message.id?.toString() : undefined; + obj.account_id = message.accountId !== BigInt(0) ? message.accountId?.toString() : undefined; return obj; }, fromAminoMsg(object: QueryAccountAddressByIDRequestAminoMsg): QueryAccountAddressByIDRequest { @@ -1746,7 +1670,145 @@ export const QueryAccountAddressByIDResponse = { }; } }; -export const AccountI_InterfaceDecoder = (input: BinaryReader | Uint8Array): BaseAccount | Any => { +function createBaseQueryAccountInfoRequest(): QueryAccountInfoRequest { + return { + address: "" + }; +} +export const QueryAccountInfoRequest = { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountInfoRequest", + encode(message: QueryAccountInfoRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountInfoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountInfoRequest(); + 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; + }, + fromPartial(object: Partial): QueryAccountInfoRequest { + const message = createBaseQueryAccountInfoRequest(); + message.address = object.address ?? ""; + return message; + }, + fromAmino(object: QueryAccountInfoRequestAmino): QueryAccountInfoRequest { + const message = createBaseQueryAccountInfoRequest(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + return message; + }, + toAmino(message: QueryAccountInfoRequest): QueryAccountInfoRequestAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + return obj; + }, + fromAminoMsg(object: QueryAccountInfoRequestAminoMsg): QueryAccountInfoRequest { + return QueryAccountInfoRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryAccountInfoRequest): QueryAccountInfoRequestAminoMsg { + return { + type: "cosmos-sdk/QueryAccountInfoRequest", + value: QueryAccountInfoRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAccountInfoRequestProtoMsg): QueryAccountInfoRequest { + return QueryAccountInfoRequest.decode(message.value); + }, + toProto(message: QueryAccountInfoRequest): Uint8Array { + return QueryAccountInfoRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryAccountInfoRequest): QueryAccountInfoRequestProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountInfoRequest", + value: QueryAccountInfoRequest.encode(message).finish() + }; + } +}; +function createBaseQueryAccountInfoResponse(): QueryAccountInfoResponse { + return { + info: undefined + }; +} +export const QueryAccountInfoResponse = { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountInfoResponse", + encode(message: QueryAccountInfoResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.info !== undefined) { + BaseAccount.encode(message.info, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountInfoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.info = BaseAccount.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryAccountInfoResponse { + const message = createBaseQueryAccountInfoResponse(); + message.info = object.info !== undefined && object.info !== null ? BaseAccount.fromPartial(object.info) : undefined; + return message; + }, + fromAmino(object: QueryAccountInfoResponseAmino): QueryAccountInfoResponse { + const message = createBaseQueryAccountInfoResponse(); + if (object.info !== undefined && object.info !== null) { + message.info = BaseAccount.fromAmino(object.info); + } + return message; + }, + toAmino(message: QueryAccountInfoResponse): QueryAccountInfoResponseAmino { + const obj: any = {}; + obj.info = message.info ? BaseAccount.toAmino(message.info) : undefined; + return obj; + }, + fromAminoMsg(object: QueryAccountInfoResponseAminoMsg): QueryAccountInfoResponse { + return QueryAccountInfoResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryAccountInfoResponse): QueryAccountInfoResponseAminoMsg { + return { + type: "cosmos-sdk/QueryAccountInfoResponse", + value: QueryAccountInfoResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAccountInfoResponseProtoMsg): QueryAccountInfoResponse { + return QueryAccountInfoResponse.decode(message.value); + }, + toProto(message: QueryAccountInfoResponse): Uint8Array { + return QueryAccountInfoResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryAccountInfoResponse): QueryAccountInfoResponseProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountInfoResponse", + value: QueryAccountInfoResponse.encode(message).finish() + }; + } +}; +export const Cosmos_authv1beta1AccountI_InterfaceDecoder = (input: BinaryReader | Uint8Array): BaseAccount | Any => { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const data = Any.decode(reader, reader.uint32()); switch (data.typeUrl) { @@ -1756,7 +1818,7 @@ export const AccountI_InterfaceDecoder = (input: BinaryReader | Uint8Array): Bas return data; } }; -export const AccountI_FromAmino = (content: AnyAmino): Any => { +export const Cosmos_authv1beta1AccountI_FromAmino = (content: AnyAmino): Any => { switch (content.type) { case "cosmos-sdk/BaseAccount": return Any.fromPartial({ @@ -1767,7 +1829,7 @@ export const AccountI_FromAmino = (content: AnyAmino): Any => { return Any.fromAmino(content); } }; -export const AccountI_ToAmino = (content: Any) => { +export const Cosmos_authv1beta1AccountI_ToAmino = (content: Any) => { switch (content.typeUrl) { case "/cosmos.auth.v1beta1.BaseAccount": return { @@ -1778,7 +1840,7 @@ export const AccountI_ToAmino = (content: Any) => { return Any.toAmino(content); } }; -export const ModuleAccountI_InterfaceDecoder = (input: BinaryReader | Uint8Array): ModuleAccount | Any => { +export const Cosmos_authv1beta1ModuleAccountI_InterfaceDecoder = (input: BinaryReader | Uint8Array): ModuleAccount | Any => { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const data = Any.decode(reader, reader.uint32()); switch (data.typeUrl) { @@ -1788,7 +1850,7 @@ export const ModuleAccountI_InterfaceDecoder = (input: BinaryReader | Uint8Array return data; } }; -export const ModuleAccountI_FromAmino = (content: AnyAmino): Any => { +export const Cosmos_authv1beta1ModuleAccountI_FromAmino = (content: AnyAmino): Any => { switch (content.type) { case "cosmos-sdk/ModuleAccount": return Any.fromPartial({ @@ -1799,7 +1861,7 @@ export const ModuleAccountI_FromAmino = (content: AnyAmino): Any => { return Any.fromAmino(content); } }; -export const ModuleAccountI_ToAmino = (content: Any) => { +export const Cosmos_authv1beta1ModuleAccountI_ToAmino = (content: Any) => { switch (content.typeUrl) { case "/cosmos.auth.v1beta1.ModuleAccount": return { diff --git a/packages/api/src/cosmos/auth/v1beta1/tx.amino.ts b/packages/api/src/cosmos/auth/v1beta1/tx.amino.ts new file mode 100644 index 00000000..54570c3b --- /dev/null +++ b/packages/api/src/cosmos/auth/v1beta1/tx.amino.ts @@ -0,0 +1,9 @@ +//@ts-nocheck +import { MsgUpdateParams } from "./tx"; +export const AminoConverter = { + "/cosmos.auth.v1beta1.MsgUpdateParams": { + aminoType: "cosmos-sdk/x/auth/MsgUpdateParams", + toAmino: MsgUpdateParams.toAmino, + fromAmino: MsgUpdateParams.fromAmino + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/auth/v1beta1/tx.registry.ts b/packages/api/src/cosmos/auth/v1beta1/tx.registry.ts new file mode 100644 index 00000000..2070e3ea --- /dev/null +++ b/packages/api/src/cosmos/auth/v1beta1/tx.registry.ts @@ -0,0 +1,35 @@ +//@ts-nocheck +import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { MsgUpdateParams } from "./tx"; +export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.auth.v1beta1.MsgUpdateParams", MsgUpdateParams]]; +export const load = (protoRegistry: Registry) => { + registry.forEach(([typeUrl, mod]) => { + protoRegistry.register(typeUrl, mod); + }); +}; +export const MessageComposer = { + encoded: { + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/cosmos.auth.v1beta1.MsgUpdateParams", + value: MsgUpdateParams.encode(value).finish() + }; + } + }, + withTypeUrl: { + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/cosmos.auth.v1beta1.MsgUpdateParams", + value + }; + } + }, + fromPartial: { + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/cosmos.auth.v1beta1.MsgUpdateParams", + value: MsgUpdateParams.fromPartial(value) + }; + } + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/auth/v1beta1/tx.rpc.msg.ts b/packages/api/src/cosmos/auth/v1beta1/tx.rpc.msg.ts new file mode 100644 index 00000000..3837fd73 --- /dev/null +++ b/packages/api/src/cosmos/auth/v1beta1/tx.rpc.msg.ts @@ -0,0 +1,24 @@ +//@ts-nocheck +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; +import { MsgUpdateParams, MsgUpdateParamsResponse } from "./tx"; +/** Msg defines the x/auth Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the x/auth module + * parameters. The authority defaults to the x/gov module account. + */ + updateParams(request: MsgUpdateParams): Promise; +} +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + this.updateParams = this.updateParams.bind(this); + } + updateParams(request: MsgUpdateParams): Promise { + const data = MsgUpdateParams.encode(request).finish(); + const promise = this.rpc.request("cosmos.auth.v1beta1.Msg", "UpdateParams", data); + return promise.then(data => MsgUpdateParamsResponse.decode(new BinaryReader(data))); + } +} \ No newline at end of file diff --git a/packages/api/src/cosmos/auth/v1beta1/tx.ts b/packages/api/src/cosmos/auth/v1beta1/tx.ts new file mode 100644 index 00000000..e4b60f3f --- /dev/null +++ b/packages/api/src/cosmos/auth/v1beta1/tx.ts @@ -0,0 +1,198 @@ +//@ts-nocheck +import { Params, ParamsAmino, ParamsSDKType } from "./auth"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/auth parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params; +} +export interface MsgUpdateParamsProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.MsgUpdateParams"; + value: Uint8Array; +} +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParamsAmino { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority?: string; + /** + * params defines the x/auth parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: ParamsAmino; +} +export interface MsgUpdateParamsAminoMsg { + type: "cosmos-sdk/x/auth/MsgUpdateParams"; + value: MsgUpdateParamsAmino; +} +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParamsSDKType { + authority: string; + params: ParamsSDKType; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponse {} +export interface MsgUpdateParamsResponseProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.MsgUpdateParamsResponse"; + value: Uint8Array; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponseAmino {} +export interface MsgUpdateParamsResponseAminoMsg { + type: "cosmos-sdk/MsgUpdateParamsResponse"; + value: MsgUpdateParamsResponseAmino; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponseSDKType {} +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { + authority: "", + params: Params.fromPartial({}) + }; +} +export const MsgUpdateParams = { + typeUrl: "/cosmos.auth.v1beta1.MsgUpdateParams", + encode(message: MsgUpdateParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + message.authority = object.authority ?? ""; + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, + fromAmino(object: MsgUpdateParamsAmino): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: MsgUpdateParams): MsgUpdateParamsAmino { + const obj: any = {}; + obj.authority = message.authority === "" ? undefined : message.authority; + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); + return obj; + }, + fromAminoMsg(object: MsgUpdateParamsAminoMsg): MsgUpdateParams { + return MsgUpdateParams.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateParams): MsgUpdateParamsAminoMsg { + return { + type: "cosmos-sdk/x/auth/MsgUpdateParams", + value: MsgUpdateParams.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateParamsProtoMsg): MsgUpdateParams { + return MsgUpdateParams.decode(message.value); + }, + toProto(message: MsgUpdateParams): Uint8Array { + return MsgUpdateParams.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateParams): MsgUpdateParamsProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.MsgUpdateParams", + value: MsgUpdateParams.encode(message).finish() + }; + } +}; +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} +export const MsgUpdateParamsResponse = { + typeUrl: "/cosmos.auth.v1beta1.MsgUpdateParamsResponse", + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, + fromAmino(_: MsgUpdateParamsResponseAmino): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, + toAmino(_: MsgUpdateParamsResponse): MsgUpdateParamsResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUpdateParamsResponseAminoMsg): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateParamsResponse): MsgUpdateParamsResponseAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateParamsResponse", + value: MsgUpdateParamsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateParamsResponseProtoMsg): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.decode(message.value); + }, + toProto(message: MsgUpdateParamsResponse): Uint8Array { + return MsgUpdateParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateParamsResponse): MsgUpdateParamsResponseProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.MsgUpdateParamsResponse", + value: MsgUpdateParamsResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/app/module/v1alpha1/module.ts b/packages/api/src/cosmos/authz/module/v1/module.ts similarity index 82% rename from packages/api/src/cosmos/app/module/v1alpha1/module.ts rename to packages/api/src/cosmos/authz/module/v1/module.ts index 3141e41c..24d3f03a 100644 --- a/packages/api/src/cosmos/app/module/v1alpha1/module.ts +++ b/packages/api/src/cosmos/authz/module/v1/module.ts @@ -1,24 +1,24 @@ //@ts-nocheck import { BinaryReader, BinaryWriter } from "../../../../binary"; -/** Module is the module config object for the cosmos.app v1 app module. */ +/** Module is the config object of the authz module. */ export interface Module {} export interface ModuleProtoMsg { - typeUrl: "/cosmos.app.module.v1alpha1.Module"; + typeUrl: "/cosmos.authz.module.v1.Module"; value: Uint8Array; } -/** Module is the module config object for the cosmos.app v1 app module. */ +/** Module is the config object of the authz module. */ export interface ModuleAmino {} export interface ModuleAminoMsg { type: "cosmos-sdk/Module"; value: ModuleAmino; } -/** Module is the module config object for the cosmos.app v1 app module. */ +/** Module is the config object of the authz module. */ export interface ModuleSDKType {} function createBaseModule(): Module { return {}; } export const Module = { - typeUrl: "/cosmos.app.module.v1alpha1.Module", + typeUrl: "/cosmos.authz.module.v1.Module", encode(_: Module, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -65,7 +65,7 @@ export const Module = { }, toProtoMsg(message: Module): ModuleProtoMsg { return { - typeUrl: "/cosmos.app.module.v1alpha1.Module", + typeUrl: "/cosmos.authz.module.v1.Module", value: Module.encode(message).finish() }; } diff --git a/packages/api/src/cosmos/authz/v1beta1/authz.ts b/packages/api/src/cosmos/authz/v1beta1/authz.ts index 0cb8113d..d6581b1f 100644 --- a/packages/api/src/cosmos/authz/v1beta1/authz.ts +++ b/packages/api/src/cosmos/authz/v1beta1/authz.ts @@ -3,6 +3,7 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf import { Timestamp } from "../../../google/protobuf/timestamp"; import { SendAuthorization, SendAuthorizationProtoMsg, SendAuthorizationSDKType } from "../../bank/v1beta1/authz"; import { StakeAuthorization, StakeAuthorizationProtoMsg, StakeAuthorizationSDKType } from "../../staking/v1beta1/authz"; +import { TransferAuthorization, TransferAuthorizationProtoMsg, TransferAuthorizationSDKType } from "../../../ibc/applications/transfer/v1/authz"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { toTimestamp, fromTimestamp } from "../../../helpers"; /** @@ -43,7 +44,7 @@ export interface GenericAuthorizationSDKType { * the provide method with expiration time. */ export interface Grant { - authorization?: GenericAuthorization | SendAuthorization | StakeAuthorization | Any | undefined; + authorization?: GenericAuthorization | SendAuthorization | StakeAuthorization | TransferAuthorization | Any | undefined; /** * time when the grant will expire and will be pruned. If null, then the grant * doesn't have a time expiration (other conditions in `authorization` @@ -56,7 +57,7 @@ export interface GrantProtoMsg { value: Uint8Array; } export type GrantEncoded = Omit & { - authorization?: GenericAuthorizationProtoMsg | SendAuthorizationProtoMsg | StakeAuthorizationProtoMsg | AnyProtoMsg | undefined; + authorization?: GenericAuthorizationProtoMsg | SendAuthorizationProtoMsg | StakeAuthorizationProtoMsg | TransferAuthorizationProtoMsg | AnyProtoMsg | undefined; }; /** * Grant gives permissions to execute @@ -80,7 +81,7 @@ export interface GrantAminoMsg { * the provide method with expiration time. */ export interface GrantSDKType { - authorization?: GenericAuthorizationSDKType | SendAuthorizationSDKType | StakeAuthorizationSDKType | AnySDKType | undefined; + authorization?: GenericAuthorizationSDKType | SendAuthorizationSDKType | StakeAuthorizationSDKType | TransferAuthorizationSDKType | AnySDKType | undefined; expiration?: Date; } /** @@ -90,7 +91,7 @@ export interface GrantSDKType { export interface GrantAuthorization { granter: string; grantee: string; - authorization?: GenericAuthorization | SendAuthorization | StakeAuthorization | Any | undefined; + authorization?: GenericAuthorization | SendAuthorization | StakeAuthorization | TransferAuthorization | Any | undefined; expiration?: Date; } export interface GrantAuthorizationProtoMsg { @@ -98,7 +99,7 @@ export interface GrantAuthorizationProtoMsg { value: Uint8Array; } export type GrantAuthorizationEncoded = Omit & { - authorization?: GenericAuthorizationProtoMsg | SendAuthorizationProtoMsg | StakeAuthorizationProtoMsg | AnyProtoMsg | undefined; + authorization?: GenericAuthorizationProtoMsg | SendAuthorizationProtoMsg | StakeAuthorizationProtoMsg | TransferAuthorizationProtoMsg | AnyProtoMsg | undefined; }; /** * GrantAuthorization extends a grant with both the addresses of the grantee and granter. @@ -121,7 +122,7 @@ export interface GrantAuthorizationAminoMsg { export interface GrantAuthorizationSDKType { granter: string; grantee: string; - authorization?: GenericAuthorizationSDKType | SendAuthorizationSDKType | StakeAuthorizationSDKType | AnySDKType | undefined; + authorization?: GenericAuthorizationSDKType | SendAuthorizationSDKType | StakeAuthorizationSDKType | TransferAuthorizationSDKType | AnySDKType | undefined; expiration?: Date; } /** GrantQueueItem contains the list of TypeURL of a sdk.Msg. */ @@ -241,7 +242,7 @@ export const Grant = { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.authorization = (Authorization_InterfaceDecoder(reader) as Any); + message.authorization = (Cosmos_authzv1beta1Authorization_InterfaceDecoder(reader) as Any); break; case 2: message.expiration = fromTimestamp(Timestamp.decode(reader, reader.uint32())); @@ -262,7 +263,7 @@ export const Grant = { fromAmino(object: GrantAmino): Grant { const message = createBaseGrant(); if (object.authorization !== undefined && object.authorization !== null) { - message.authorization = Authorization_FromAmino(object.authorization); + message.authorization = Cosmos_authzv1beta1Authorization_FromAmino(object.authorization); } if (object.expiration !== undefined && object.expiration !== null) { message.expiration = fromTimestamp(Timestamp.fromAmino(object.expiration)); @@ -271,7 +272,7 @@ export const Grant = { }, toAmino(message: Grant): GrantAmino { const obj: any = {}; - obj.authorization = message.authorization ? Authorization_ToAmino((message.authorization as Any)) : undefined; + obj.authorization = message.authorization ? Cosmos_authzv1beta1Authorization_ToAmino((message.authorization as Any)) : undefined; obj.expiration = message.expiration ? Timestamp.toAmino(toTimestamp(message.expiration)) : undefined; return obj; }, @@ -336,7 +337,7 @@ export const GrantAuthorization = { message.grantee = reader.string(); break; case 3: - message.authorization = (Authorization_InterfaceDecoder(reader) as Any); + message.authorization = (Cosmos_authzv1beta1Authorization_InterfaceDecoder(reader) as Any); break; case 4: message.expiration = fromTimestamp(Timestamp.decode(reader, reader.uint32())); @@ -365,7 +366,7 @@ export const GrantAuthorization = { message.grantee = object.grantee; } if (object.authorization !== undefined && object.authorization !== null) { - message.authorization = Authorization_FromAmino(object.authorization); + message.authorization = Cosmos_authzv1beta1Authorization_FromAmino(object.authorization); } if (object.expiration !== undefined && object.expiration !== null) { message.expiration = fromTimestamp(Timestamp.fromAmino(object.expiration)); @@ -376,7 +377,7 @@ export const GrantAuthorization = { const obj: any = {}; obj.granter = message.granter === "" ? undefined : message.granter; obj.grantee = message.grantee === "" ? undefined : message.grantee; - obj.authorization = message.authorization ? Authorization_ToAmino((message.authorization as Any)) : undefined; + obj.authorization = message.authorization ? Cosmos_authzv1beta1Authorization_ToAmino((message.authorization as Any)) : undefined; obj.expiration = message.expiration ? Timestamp.toAmino(toTimestamp(message.expiration)) : undefined; return obj; }, @@ -473,7 +474,7 @@ export const GrantQueueItem = { }; } }; -export const Authorization_InterfaceDecoder = (input: BinaryReader | Uint8Array): GenericAuthorization | SendAuthorization | StakeAuthorization | Any => { +export const Cosmos_authzv1beta1Authorization_InterfaceDecoder = (input: BinaryReader | Uint8Array): GenericAuthorization | SendAuthorization | StakeAuthorization | TransferAuthorization | Any => { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const data = Any.decode(reader, reader.uint32()); switch (data.typeUrl) { @@ -483,11 +484,13 @@ export const Authorization_InterfaceDecoder = (input: BinaryReader | Uint8Array) 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; } }; -export const Authorization_FromAmino = (content: AnyAmino): Any => { +export const Cosmos_authzv1beta1Authorization_FromAmino = (content: AnyAmino): Any => { switch (content.type) { case "cosmos-sdk/GenericAuthorization": return Any.fromPartial({ @@ -504,11 +507,16 @@ export const Authorization_FromAmino = (content: AnyAmino): Any => { typeUrl: "/cosmos.staking.v1beta1.StakeAuthorization", value: StakeAuthorization.encode(StakeAuthorization.fromPartial(StakeAuthorization.fromAmino(content.value))).finish() }); + case "cosmos-sdk/TransferAuthorization": + return Any.fromPartial({ + typeUrl: "/ibc.applications.transfer.v1.TransferAuthorization", + value: TransferAuthorization.encode(TransferAuthorization.fromPartial(TransferAuthorization.fromAmino(content.value))).finish() + }); default: return Any.fromAmino(content); } }; -export const Authorization_ToAmino = (content: Any) => { +export const Cosmos_authzv1beta1Authorization_ToAmino = (content: Any) => { switch (content.typeUrl) { case "/cosmos.authz.v1beta1.GenericAuthorization": return { @@ -525,6 +533,11 @@ export const Authorization_ToAmino = (content: Any) => { type: "cosmos-sdk/StakeAuthorization", value: StakeAuthorization.toAmino(StakeAuthorization.decode(content.value, undefined)) }; + case "/ibc.applications.transfer.v1.TransferAuthorization": + return { + type: "cosmos-sdk/TransferAuthorization", + value: TransferAuthorization.toAmino(TransferAuthorization.decode(content.value, undefined)) + }; default: return Any.toAmino(content); } diff --git a/packages/api/src/cosmos/authz/v1beta1/genesis.ts b/packages/api/src/cosmos/authz/v1beta1/genesis.ts index f5ca9e5e..63fa63b3 100644 --- a/packages/api/src/cosmos/authz/v1beta1/genesis.ts +++ b/packages/api/src/cosmos/authz/v1beta1/genesis.ts @@ -11,7 +11,7 @@ export interface GenesisStateProtoMsg { } /** GenesisState defines the authz module's genesis state. */ export interface GenesisStateAmino { - authorization?: GrantAuthorizationAmino[]; + authorization: GrantAuthorizationAmino[]; } export interface GenesisStateAminoMsg { type: "cosmos-sdk/GenesisState"; diff --git a/packages/api/src/cosmos/authz/v1beta1/query.lcd.ts b/packages/api/src/cosmos/authz/v1beta1/query.lcd.ts index 4359f0d3..92c66c8f 100644 --- a/packages/api/src/cosmos/authz/v1beta1/query.lcd.ts +++ b/packages/api/src/cosmos/authz/v1beta1/query.lcd.ts @@ -34,9 +34,7 @@ export class LCDQueryClient { const endpoint = `cosmos/authz/v1beta1/grants`; return await this.req.get(endpoint, options); } - /* GranterGrants returns list of `GrantAuthorization`, granted by granter. - - Since: cosmos-sdk 0.46 */ + /* GranterGrants returns list of `GrantAuthorization`, granted by granter. */ async granterGrants(params: QueryGranterGrantsRequest): Promise { const options: any = { params: {} @@ -47,9 +45,7 @@ export class LCDQueryClient { const endpoint = `cosmos/authz/v1beta1/grants/granter/${params.granter}`; return await this.req.get(endpoint, options); } - /* GranteeGrants returns a list of `GrantAuthorization` by grantee. - - Since: cosmos-sdk 0.46 */ + /* GranteeGrants returns a list of `GrantAuthorization` by grantee. */ async granteeGrants(params: QueryGranteeGrantsRequest): Promise { const options: any = { params: {} diff --git a/packages/api/src/cosmos/authz/v1beta1/query.rpc.Query.ts b/packages/api/src/cosmos/authz/v1beta1/query.rpc.Query.ts index 30d70e94..49265edc 100644 --- a/packages/api/src/cosmos/authz/v1beta1/query.rpc.Query.ts +++ b/packages/api/src/cosmos/authz/v1beta1/query.rpc.Query.ts @@ -7,17 +7,9 @@ import { QueryGrantsRequest, QueryGrantsResponse, QueryGranterGrantsRequest, Que export interface Query { /** Returns list of `Authorization`, granted to the grantee by the granter. */ grants(request: QueryGrantsRequest): Promise; - /** - * GranterGrants returns list of `GrantAuthorization`, granted by granter. - * - * Since: cosmos-sdk 0.46 - */ + /** GranterGrants returns list of `GrantAuthorization`, granted by granter. */ granterGrants(request: QueryGranterGrantsRequest): Promise; - /** - * GranteeGrants returns a list of `GrantAuthorization` by grantee. - * - * Since: cosmos-sdk 0.46 - */ + /** GranteeGrants returns a list of `GrantAuthorization` by grantee. */ granteeGrants(request: QueryGranteeGrantsRequest): Promise; } export class QueryClientImpl implements Query { diff --git a/packages/api/src/cosmos/authz/v1beta1/query.ts b/packages/api/src/cosmos/authz/v1beta1/query.ts index f1459d3f..42d6c9b8 100644 --- a/packages/api/src/cosmos/authz/v1beta1/query.ts +++ b/packages/api/src/cosmos/authz/v1beta1/query.ts @@ -114,7 +114,7 @@ export interface QueryGranterGrantsResponseSDKType { grants: GrantAuthorizationSDKType[]; pagination?: PageResponseSDKType; } -/** QueryGranteeGrantsRequest is the request type for the Query/IssuedGrants RPC method. */ +/** QueryGranteeGrantsRequest is the request type for the Query/GranteeGrants RPC method. */ export interface QueryGranteeGrantsRequest { grantee: string; /** pagination defines an pagination for the request. */ @@ -124,7 +124,7 @@ export interface QueryGranteeGrantsRequestProtoMsg { typeUrl: "/cosmos.authz.v1beta1.QueryGranteeGrantsRequest"; value: Uint8Array; } -/** QueryGranteeGrantsRequest is the request type for the Query/IssuedGrants RPC method. */ +/** QueryGranteeGrantsRequest is the request type for the Query/GranteeGrants RPC method. */ export interface QueryGranteeGrantsRequestAmino { grantee?: string; /** pagination defines an pagination for the request. */ @@ -134,7 +134,7 @@ export interface QueryGranteeGrantsRequestAminoMsg { type: "cosmos-sdk/QueryGranteeGrantsRequest"; value: QueryGranteeGrantsRequestAmino; } -/** QueryGranteeGrantsRequest is the request type for the Query/IssuedGrants RPC method. */ +/** QueryGranteeGrantsRequest is the request type for the Query/GranteeGrants RPC method. */ export interface QueryGranteeGrantsRequestSDKType { grantee: string; pagination?: PageRequestSDKType; diff --git a/packages/api/src/cosmos/authz/v1beta1/tx.ts b/packages/api/src/cosmos/authz/v1beta1/tx.ts index c241db1b..ad824e5d 100644 --- a/packages/api/src/cosmos/authz/v1beta1/tx.ts +++ b/packages/api/src/cosmos/authz/v1beta1/tx.ts @@ -23,7 +23,7 @@ export interface MsgGrantProtoMsg { export interface MsgGrantAmino { granter?: string; grantee?: string; - grant?: GrantAmino; + grant: GrantAmino; } export interface MsgGrantAminoMsg { type: "cosmos-sdk/MsgGrant"; @@ -38,26 +38,20 @@ export interface MsgGrantSDKType { grantee: string; grant: GrantSDKType; } -/** MsgExecResponse defines the Msg/MsgExecResponse response type. */ -export interface MsgExecResponse { - results: Uint8Array[]; -} -export interface MsgExecResponseProtoMsg { - typeUrl: "/cosmos.authz.v1beta1.MsgExecResponse"; +/** MsgGrantResponse defines the Msg/MsgGrant response type. */ +export interface MsgGrantResponse {} +export interface MsgGrantResponseProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.MsgGrantResponse"; value: Uint8Array; } -/** MsgExecResponse defines the Msg/MsgExecResponse response type. */ -export interface MsgExecResponseAmino { - results?: string[]; -} -export interface MsgExecResponseAminoMsg { - type: "cosmos-sdk/MsgExecResponse"; - value: MsgExecResponseAmino; -} -/** MsgExecResponse defines the Msg/MsgExecResponse response type. */ -export interface MsgExecResponseSDKType { - results: Uint8Array[]; +/** MsgGrantResponse defines the Msg/MsgGrant response type. */ +export interface MsgGrantResponseAmino {} +export interface MsgGrantResponseAminoMsg { + type: "cosmos-sdk/MsgGrantResponse"; + value: MsgGrantResponseAmino; } +/** MsgGrantResponse defines the Msg/MsgGrant response type. */ +export interface MsgGrantResponseSDKType {} /** * MsgExec attempts to execute the provided messages using * authorizations granted to the grantee. Each message should have only @@ -66,7 +60,7 @@ export interface MsgExecResponseSDKType { export interface MsgExec { grantee: string; /** - * Authorization Msg requests to execute. Each msg must implement Authorization interface + * Execute Msg. * The x/authz will try to find a grant matching (msg.signers[0], grantee, MsgTypeURL(msg)) * triple and validate it. */ @@ -78,7 +72,7 @@ export interface MsgExecProtoMsg { } export type MsgExecEncoded = Omit & { /** - * Authorization Msg requests to execute. Each msg must implement Authorization interface + * Execute Msg. * The x/authz will try to find a grant matching (msg.signers[0], grantee, MsgTypeURL(msg)) * triple and validate it. */ @@ -92,7 +86,7 @@ export type MsgExecEncoded = Omit & { export interface MsgExecAmino { grantee?: string; /** - * Authorization Msg requests to execute. Each msg must implement Authorization interface + * Execute Msg. * The x/authz will try to find a grant matching (msg.signers[0], grantee, MsgTypeURL(msg)) * triple and validate it. */ @@ -111,20 +105,26 @@ export interface MsgExecSDKType { grantee: string; msgs: (AnySDKType)[]; } -/** MsgGrantResponse defines the Msg/MsgGrant response type. */ -export interface MsgGrantResponse {} -export interface MsgGrantResponseProtoMsg { - typeUrl: "/cosmos.authz.v1beta1.MsgGrantResponse"; +/** MsgExecResponse defines the Msg/MsgExecResponse response type. */ +export interface MsgExecResponse { + results: Uint8Array[]; +} +export interface MsgExecResponseProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.MsgExecResponse"; value: Uint8Array; } -/** MsgGrantResponse defines the Msg/MsgGrant response type. */ -export interface MsgGrantResponseAmino {} -export interface MsgGrantResponseAminoMsg { - type: "cosmos-sdk/MsgGrantResponse"; - value: MsgGrantResponseAmino; +/** MsgExecResponse defines the Msg/MsgExecResponse response type. */ +export interface MsgExecResponseAmino { + results?: string[]; +} +export interface MsgExecResponseAminoMsg { + type: "cosmos-sdk/MsgExecResponse"; + value: MsgExecResponseAmino; +} +/** MsgExecResponse defines the Msg/MsgExecResponse response type. */ +export interface MsgExecResponseSDKType { + results: Uint8Array[]; } -/** MsgGrantResponse defines the Msg/MsgGrant response type. */ -export interface MsgGrantResponseSDKType {} /** * MsgRevoke revokes any authorization with the provided sdk.Msg type on the * granter's account with that has been granted to the grantee. @@ -242,7 +242,7 @@ export const MsgGrant = { const obj: any = {}; obj.granter = message.granter === "" ? undefined : message.granter; obj.grantee = message.grantee === "" ? undefined : message.grantee; - obj.grant = message.grant ? Grant.toAmino(message.grant) : undefined; + obj.grant = message.grant ? Grant.toAmino(message.grant) : Grant.toAmino(Grant.fromPartial({})); return obj; }, fromAminoMsg(object: MsgGrantAminoMsg): MsgGrant { @@ -267,29 +267,21 @@ export const MsgGrant = { }; } }; -function createBaseMsgExecResponse(): MsgExecResponse { - return { - results: [] - }; +function createBaseMsgGrantResponse(): MsgGrantResponse { + return {}; } -export const MsgExecResponse = { - typeUrl: "/cosmos.authz.v1beta1.MsgExecResponse", - encode(message: MsgExecResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - for (const v of message.results) { - writer.uint32(10).bytes(v!); - } +export const MsgGrantResponse = { + typeUrl: "/cosmos.authz.v1beta1.MsgGrantResponse", + encode(_: MsgGrantResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - decode(input: BinaryReader | Uint8Array, length?: number): MsgExecResponse { + decode(input: BinaryReader | Uint8Array, length?: number): MsgGrantResponse { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMsgExecResponse(); + const message = createBaseMsgGrantResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.results.push(reader.bytes()); - break; default: reader.skipType(tag & 7); break; @@ -297,44 +289,37 @@ export const MsgExecResponse = { } return message; }, - fromPartial(object: Partial): MsgExecResponse { - const message = createBaseMsgExecResponse(); - message.results = object.results?.map(e => e) || []; + fromPartial(_: Partial): MsgGrantResponse { + const message = createBaseMsgGrantResponse(); return message; }, - fromAmino(object: MsgExecResponseAmino): MsgExecResponse { - const message = createBaseMsgExecResponse(); - message.results = object.results?.map(e => bytesFromBase64(e)) || []; + fromAmino(_: MsgGrantResponseAmino): MsgGrantResponse { + const message = createBaseMsgGrantResponse(); return message; }, - toAmino(message: MsgExecResponse): MsgExecResponseAmino { + toAmino(_: MsgGrantResponse): MsgGrantResponseAmino { const obj: any = {}; - if (message.results) { - obj.results = message.results.map(e => base64FromBytes(e)); - } else { - obj.results = message.results; - } return obj; }, - fromAminoMsg(object: MsgExecResponseAminoMsg): MsgExecResponse { - return MsgExecResponse.fromAmino(object.value); + fromAminoMsg(object: MsgGrantResponseAminoMsg): MsgGrantResponse { + return MsgGrantResponse.fromAmino(object.value); }, - toAminoMsg(message: MsgExecResponse): MsgExecResponseAminoMsg { + toAminoMsg(message: MsgGrantResponse): MsgGrantResponseAminoMsg { return { - type: "cosmos-sdk/MsgExecResponse", - value: MsgExecResponse.toAmino(message) + type: "cosmos-sdk/MsgGrantResponse", + value: MsgGrantResponse.toAmino(message) }; }, - fromProtoMsg(message: MsgExecResponseProtoMsg): MsgExecResponse { - return MsgExecResponse.decode(message.value); + fromProtoMsg(message: MsgGrantResponseProtoMsg): MsgGrantResponse { + return MsgGrantResponse.decode(message.value); }, - toProto(message: MsgExecResponse): Uint8Array { - return MsgExecResponse.encode(message).finish(); + toProto(message: MsgGrantResponse): Uint8Array { + return MsgGrantResponse.encode(message).finish(); }, - toProtoMsg(message: MsgExecResponse): MsgExecResponseProtoMsg { + toProtoMsg(message: MsgGrantResponse): MsgGrantResponseProtoMsg { return { - typeUrl: "/cosmos.authz.v1beta1.MsgExecResponse", - value: MsgExecResponse.encode(message).finish() + typeUrl: "/cosmos.authz.v1beta1.MsgGrantResponse", + value: MsgGrantResponse.encode(message).finish() }; } }; @@ -386,14 +371,14 @@ export const MsgExec = { if (object.grantee !== undefined && object.grantee !== null) { message.grantee = object.grantee; } - message.msgs = object.msgs?.map(e => Sdk_Msg_FromAmino(e)) || []; + message.msgs = object.msgs?.map(e => Cosmos_basev1beta1Msg_FromAmino(e)) || []; return message; }, toAmino(message: MsgExec): MsgExecAmino { const obj: any = {}; obj.grantee = message.grantee === "" ? undefined : message.grantee; if (message.msgs) { - obj.msgs = message.msgs.map(e => e ? Sdk_Msg_ToAmino((e as Any)) : undefined); + obj.msgs = message.msgs.map(e => e ? Cosmos_basev1beta1Msg_ToAmino((e as Any)) : undefined); } else { obj.msgs = message.msgs; } @@ -421,21 +406,29 @@ export const MsgExec = { }; } }; -function createBaseMsgGrantResponse(): MsgGrantResponse { - return {}; +function createBaseMsgExecResponse(): MsgExecResponse { + return { + results: [] + }; } -export const MsgGrantResponse = { - typeUrl: "/cosmos.authz.v1beta1.MsgGrantResponse", - encode(_: MsgGrantResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { +export const MsgExecResponse = { + typeUrl: "/cosmos.authz.v1beta1.MsgExecResponse", + encode(message: MsgExecResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.results) { + writer.uint32(10).bytes(v!); + } return writer; }, - decode(input: BinaryReader | Uint8Array, length?: number): MsgGrantResponse { + decode(input: BinaryReader | Uint8Array, length?: number): MsgExecResponse { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMsgGrantResponse(); + const message = createBaseMsgExecResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 1: + message.results.push(reader.bytes()); + break; default: reader.skipType(tag & 7); break; @@ -443,37 +436,44 @@ export const MsgGrantResponse = { } return message; }, - fromPartial(_: Partial): MsgGrantResponse { - const message = createBaseMsgGrantResponse(); + fromPartial(object: Partial): MsgExecResponse { + const message = createBaseMsgExecResponse(); + message.results = object.results?.map(e => e) || []; return message; }, - fromAmino(_: MsgGrantResponseAmino): MsgGrantResponse { - const message = createBaseMsgGrantResponse(); + fromAmino(object: MsgExecResponseAmino): MsgExecResponse { + const message = createBaseMsgExecResponse(); + message.results = object.results?.map(e => bytesFromBase64(e)) || []; return message; }, - toAmino(_: MsgGrantResponse): MsgGrantResponseAmino { + toAmino(message: MsgExecResponse): MsgExecResponseAmino { const obj: any = {}; + if (message.results) { + obj.results = message.results.map(e => base64FromBytes(e)); + } else { + obj.results = message.results; + } return obj; }, - fromAminoMsg(object: MsgGrantResponseAminoMsg): MsgGrantResponse { - return MsgGrantResponse.fromAmino(object.value); + fromAminoMsg(object: MsgExecResponseAminoMsg): MsgExecResponse { + return MsgExecResponse.fromAmino(object.value); }, - toAminoMsg(message: MsgGrantResponse): MsgGrantResponseAminoMsg { + toAminoMsg(message: MsgExecResponse): MsgExecResponseAminoMsg { return { - type: "cosmos-sdk/MsgGrantResponse", - value: MsgGrantResponse.toAmino(message) + type: "cosmos-sdk/MsgExecResponse", + value: MsgExecResponse.toAmino(message) }; }, - fromProtoMsg(message: MsgGrantResponseProtoMsg): MsgGrantResponse { - return MsgGrantResponse.decode(message.value); + fromProtoMsg(message: MsgExecResponseProtoMsg): MsgExecResponse { + return MsgExecResponse.decode(message.value); }, - toProto(message: MsgGrantResponse): Uint8Array { - return MsgGrantResponse.encode(message).finish(); + toProto(message: MsgExecResponse): Uint8Array { + return MsgExecResponse.encode(message).finish(); }, - toProtoMsg(message: MsgGrantResponse): MsgGrantResponseProtoMsg { + toProtoMsg(message: MsgExecResponse): MsgExecResponseProtoMsg { return { - typeUrl: "/cosmos.authz.v1beta1.MsgGrantResponse", - value: MsgGrantResponse.encode(message).finish() + typeUrl: "/cosmos.authz.v1beta1.MsgExecResponse", + value: MsgExecResponse.encode(message).finish() }; } }; @@ -626,21 +626,7 @@ export const MsgRevokeResponse = { }; } }; -export const Sdk_Msg_InterfaceDecoder = (input: BinaryReader | Uint8Array): Any => { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - const data = Any.decode(reader, reader.uint32()); - switch (data.typeUrl) { - default: - return data; - } -}; -export const Sdk_Msg_FromAmino = (content: AnyAmino): Any => { - return Any.fromAmino(content); -}; -export const Sdk_Msg_ToAmino = (content: Any) => { - return Any.toAmino(content); -}; -export const Authz_Authorization_InterfaceDecoder = (input: BinaryReader | Uint8Array): Any => { +export const Cosmos_basev1beta1Msg_InterfaceDecoder = (input: BinaryReader | Uint8Array): Any => { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const data = Any.decode(reader, reader.uint32()); switch (data.typeUrl) { @@ -648,9 +634,9 @@ export const Authz_Authorization_InterfaceDecoder = (input: BinaryReader | Uint8 return data; } }; -export const Authz_Authorization_FromAmino = (content: AnyAmino): Any => { +export const Cosmos_basev1beta1Msg_FromAmino = (content: AnyAmino): Any => { return Any.fromAmino(content); }; -export const Authz_Authorization_ToAmino = (content: Any) => { +export const Cosmos_basev1beta1Msg_ToAmino = (content: Any) => { return Any.toAmino(content); }; \ No newline at end of file diff --git a/packages/api/src/cosmos/bank/module/v1/module.ts b/packages/api/src/cosmos/bank/module/v1/module.ts new file mode 100644 index 00000000..a6b4c6e8 --- /dev/null +++ b/packages/api/src/cosmos/bank/module/v1/module.ts @@ -0,0 +1,149 @@ +//@ts-nocheck +import { BinaryReader, BinaryWriter } from "../../../../binary"; +/** Module is the config object of the bank module. */ +export interface Module { + /** + * blocked_module_accounts_override configures exceptional module accounts which should be blocked from receiving + * funds. If left empty it defaults to the list of account names supplied in the auth module configuration as + * module_account_permissions + */ + blockedModuleAccountsOverride: string[]; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; + /** + * restrictions_order specifies the order of send restrictions and should be + * a list of module names which provide a send restriction instance. If no + * order is provided, then restrictions will be applied in alphabetical order + * of module names. + */ + restrictionsOrder: string[]; +} +export interface ModuleProtoMsg { + typeUrl: "/cosmos.bank.module.v1.Module"; + value: Uint8Array; +} +/** Module is the config object of the bank module. */ +export interface ModuleAmino { + /** + * blocked_module_accounts_override configures exceptional module accounts which should be blocked from receiving + * funds. If left empty it defaults to the list of account names supplied in the auth module configuration as + * module_account_permissions + */ + blocked_module_accounts_override?: string[]; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority?: string; + /** + * restrictions_order specifies the order of send restrictions and should be + * a list of module names which provide a send restriction instance. If no + * order is provided, then restrictions will be applied in alphabetical order + * of module names. + */ + restrictions_order?: string[]; +} +export interface ModuleAminoMsg { + type: "cosmos-sdk/Module"; + value: ModuleAmino; +} +/** Module is the config object of the bank module. */ +export interface ModuleSDKType { + blocked_module_accounts_override: string[]; + authority: string; + restrictions_order: string[]; +} +function createBaseModule(): Module { + return { + blockedModuleAccountsOverride: [], + authority: "", + restrictionsOrder: [] + }; +} +export const Module = { + typeUrl: "/cosmos.bank.module.v1.Module", + encode(message: Module, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.blockedModuleAccountsOverride) { + writer.uint32(10).string(v!); + } + if (message.authority !== "") { + writer.uint32(18).string(message.authority); + } + for (const v of message.restrictionsOrder) { + writer.uint32(26).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.blockedModuleAccountsOverride.push(reader.string()); + break; + case 2: + message.authority = reader.string(); + break; + case 3: + message.restrictionsOrder.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): Module { + const message = createBaseModule(); + message.blockedModuleAccountsOverride = object.blockedModuleAccountsOverride?.map(e => e) || []; + message.authority = object.authority ?? ""; + message.restrictionsOrder = object.restrictionsOrder?.map(e => e) || []; + return message; + }, + fromAmino(object: ModuleAmino): Module { + const message = createBaseModule(); + message.blockedModuleAccountsOverride = object.blocked_module_accounts_override?.map(e => e) || []; + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + message.restrictionsOrder = object.restrictions_order?.map(e => e) || []; + return message; + }, + toAmino(message: Module): ModuleAmino { + const obj: any = {}; + if (message.blockedModuleAccountsOverride) { + obj.blocked_module_accounts_override = message.blockedModuleAccountsOverride.map(e => e); + } else { + obj.blocked_module_accounts_override = message.blockedModuleAccountsOverride; + } + obj.authority = message.authority === "" ? undefined : message.authority; + if (message.restrictionsOrder) { + obj.restrictions_order = message.restrictionsOrder.map(e => e); + } else { + obj.restrictions_order = message.restrictionsOrder; + } + return obj; + }, + fromAminoMsg(object: ModuleAminoMsg): Module { + return Module.fromAmino(object.value); + }, + toAminoMsg(message: Module): ModuleAminoMsg { + return { + type: "cosmos-sdk/Module", + value: Module.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleProtoMsg): Module { + return Module.decode(message.value); + }, + toProto(message: Module): Uint8Array { + return Module.encode(message).finish(); + }, + toProtoMsg(message: Module): ModuleProtoMsg { + return { + typeUrl: "/cosmos.bank.module.v1.Module", + value: Module.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/bank/v1beta1/authz.ts b/packages/api/src/cosmos/bank/v1beta1/authz.ts index 2ec7fcb5..3f1c33f7 100644 --- a/packages/api/src/cosmos/bank/v1beta1/authz.ts +++ b/packages/api/src/cosmos/bank/v1beta1/authz.ts @@ -4,12 +4,15 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; /** * SendAuthorization allows the grantee to spend up to spend_limit coins from * the granter's account. - * - * Since: cosmos-sdk 0.43 */ export interface SendAuthorization { $typeUrl?: "/cosmos.bank.v1beta1.SendAuthorization"; spendLimit: Coin[]; + /** + * allow_list specifies an optional list of addresses to whom the grantee can send tokens on behalf of the + * granter. If omitted, any recipient is allowed. + */ + allowList: string[]; } export interface SendAuthorizationProtoMsg { typeUrl: "/cosmos.bank.v1beta1.SendAuthorization"; @@ -18,11 +21,14 @@ export interface SendAuthorizationProtoMsg { /** * SendAuthorization allows the grantee to spend up to spend_limit coins from * the granter's account. - * - * Since: cosmos-sdk 0.43 */ export interface SendAuthorizationAmino { - spend_limit?: CoinAmino[]; + spend_limit: CoinAmino[]; + /** + * allow_list specifies an optional list of addresses to whom the grantee can send tokens on behalf of the + * granter. If omitted, any recipient is allowed. + */ + allow_list?: string[]; } export interface SendAuthorizationAminoMsg { type: "cosmos-sdk/SendAuthorization"; @@ -31,17 +37,17 @@ export interface SendAuthorizationAminoMsg { /** * SendAuthorization allows the grantee to spend up to spend_limit coins from * the granter's account. - * - * Since: cosmos-sdk 0.43 */ export interface SendAuthorizationSDKType { $typeUrl?: "/cosmos.bank.v1beta1.SendAuthorization"; spend_limit: CoinSDKType[]; + allow_list: string[]; } function createBaseSendAuthorization(): SendAuthorization { return { $typeUrl: "/cosmos.bank.v1beta1.SendAuthorization", - spendLimit: [] + spendLimit: [], + allowList: [] }; } export const SendAuthorization = { @@ -50,6 +56,9 @@ export const SendAuthorization = { for (const v of message.spendLimit) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); } + for (const v of message.allowList) { + writer.uint32(18).string(v!); + } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): SendAuthorization { @@ -62,6 +71,9 @@ export const SendAuthorization = { case 1: message.spendLimit.push(Coin.decode(reader, reader.uint32())); break; + case 2: + message.allowList.push(reader.string()); + break; default: reader.skipType(tag & 7); break; @@ -72,11 +84,13 @@ export const SendAuthorization = { fromPartial(object: Partial): SendAuthorization { const message = createBaseSendAuthorization(); message.spendLimit = object.spendLimit?.map(e => Coin.fromPartial(e)) || []; + message.allowList = object.allowList?.map(e => e) || []; return message; }, fromAmino(object: SendAuthorizationAmino): SendAuthorization { const message = createBaseSendAuthorization(); message.spendLimit = object.spend_limit?.map(e => Coin.fromAmino(e)) || []; + message.allowList = object.allow_list?.map(e => e) || []; return message; }, toAmino(message: SendAuthorization): SendAuthorizationAmino { @@ -86,6 +100,11 @@ export const SendAuthorization = { } else { obj.spend_limit = message.spendLimit; } + if (message.allowList) { + obj.allow_list = message.allowList.map(e => e); + } else { + obj.allow_list = message.allowList; + } return obj; }, fromAminoMsg(object: SendAuthorizationAminoMsg): SendAuthorization { diff --git a/packages/api/src/cosmos/bank/v1beta1/bank.ts b/packages/api/src/cosmos/bank/v1beta1/bank.ts index da93ef76..2cd240cf 100644 --- a/packages/api/src/cosmos/bank/v1beta1/bank.ts +++ b/packages/api/src/cosmos/bank/v1beta1/bank.ts @@ -3,6 +3,14 @@ import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; /** Params defines the parameters for the bank module. */ export interface Params { + /** + * Deprecated: Use of SendEnabled in params is deprecated. + * For genesis, use the newly added send_enabled field in the genesis object. + * Storage, lookup, and manipulation of this information is now in the keeper. + * + * As of cosmos-sdk 0.47, this only exists for backwards compatibility of genesis files. + */ + /** @deprecated */ sendEnabled: SendEnabled[]; defaultSendEnabled: boolean; } @@ -12,15 +20,24 @@ export interface ParamsProtoMsg { } /** Params defines the parameters for the bank module. */ export interface ParamsAmino { + /** + * Deprecated: Use of SendEnabled in params is deprecated. + * For genesis, use the newly added send_enabled field in the genesis object. + * Storage, lookup, and manipulation of this information is now in the keeper. + * + * As of cosmos-sdk 0.47, this only exists for backwards compatibility of genesis files. + */ + /** @deprecated */ send_enabled?: SendEnabledAmino[]; default_send_enabled?: boolean; } export interface ParamsAminoMsg { - type: "cosmos-sdk/Params"; + type: "cosmos-sdk/x/bank/Params"; value: ParamsAmino; } /** Params defines the parameters for the bank module. */ export interface ParamsSDKType { + /** @deprecated */ send_enabled: SendEnabledSDKType[]; default_send_enabled: boolean; } @@ -68,7 +85,7 @@ export interface InputProtoMsg { /** Input models transaction input. */ export interface InputAmino { address?: string; - coins?: CoinAmino[]; + coins: CoinAmino[]; } export interface InputAminoMsg { type: "cosmos-sdk/Input"; @@ -91,7 +108,7 @@ export interface OutputProtoMsg { /** Output models transaction outputs. */ export interface OutputAmino { address?: string; - coins?: CoinAmino[]; + coins: CoinAmino[]; } export interface OutputAminoMsg { type: "cosmos-sdk/Output"; @@ -123,7 +140,7 @@ export interface SupplyProtoMsg { */ /** @deprecated */ export interface SupplyAmino { - total?: CoinAmino[]; + total: CoinAmino[]; } export interface SupplyAminoMsg { type: "cosmos-sdk/Supply"; @@ -207,30 +224,18 @@ export interface Metadata { * displayed in clients. */ display: string; - /** - * name defines the name of the token (eg: Cosmos Atom) - * - * Since: cosmos-sdk 0.43 - */ + /** name defines the name of the token (eg: Cosmos Atom) */ name: string; /** * symbol is the token symbol usually shown on exchanges (eg: ATOM). This can * be the same as the display. - * - * Since: cosmos-sdk 0.43 */ symbol: string; - /** - * URI to a document (on or off-chain) that contains additional information. Optional. - * - * Since: cosmos-sdk 0.46 - */ + /** URI to a document (on or off-chain) that contains additional information. Optional. */ uri: string; /** * URIHash is a sha256 hash of a document pointed by URI. It's used to verify that * the document didn't change. Optional. - * - * Since: cosmos-sdk 0.46 */ uriHash: string; } @@ -253,30 +258,18 @@ export interface MetadataAmino { * displayed in clients. */ display?: string; - /** - * name defines the name of the token (eg: Cosmos Atom) - * - * Since: cosmos-sdk 0.43 - */ + /** name defines the name of the token (eg: Cosmos Atom) */ name?: string; /** * symbol is the token symbol usually shown on exchanges (eg: ATOM). This can * be the same as the display. - * - * Since: cosmos-sdk 0.43 */ symbol?: string; - /** - * URI to a document (on or off-chain) that contains additional information. Optional. - * - * Since: cosmos-sdk 0.46 - */ + /** URI to a document (on or off-chain) that contains additional information. Optional. */ uri?: string; /** * URIHash is a sha256 hash of a document pointed by URI. It's used to verify that * the document didn't change. Optional. - * - * Since: cosmos-sdk 0.46 */ uri_hash?: string; } @@ -364,7 +357,7 @@ export const Params = { }, toAminoMsg(message: Params): ParamsAminoMsg { return { - type: "cosmos-sdk/Params", + type: "cosmos-sdk/x/bank/Params", value: Params.toAmino(message) }; }, diff --git a/packages/api/src/cosmos/bank/v1beta1/genesis.ts b/packages/api/src/cosmos/bank/v1beta1/genesis.ts index dfdcd06f..a4356f92 100644 --- a/packages/api/src/cosmos/bank/v1beta1/genesis.ts +++ b/packages/api/src/cosmos/bank/v1beta1/genesis.ts @@ -1,10 +1,10 @@ //@ts-nocheck -import { Params, ParamsAmino, ParamsSDKType, Metadata, MetadataAmino, MetadataSDKType } from "./bank"; +import { Params, ParamsAmino, ParamsSDKType, Metadata, MetadataAmino, MetadataSDKType, SendEnabled, SendEnabledAmino, SendEnabledSDKType } from "./bank"; import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; /** GenesisState defines the bank module's genesis state. */ export interface GenesisState { - /** params defines all the paramaters of the module. */ + /** params defines all the parameters of the module. */ params: Params; /** balances is an array containing the balances of all the accounts. */ balances: Balance[]; @@ -13,8 +13,10 @@ export interface GenesisState { * balances. Otherwise, it will be used to validate that the sum of the balances equals this amount. */ supply: Coin[]; - /** denom_metadata defines the metadata of the differents coins. */ + /** denom_metadata defines the metadata of the different coins. */ denomMetadata: Metadata[]; + /** send_enabled defines the denoms where send is enabled or disabled. */ + sendEnabled: SendEnabled[]; } export interface GenesisStateProtoMsg { typeUrl: "/cosmos.bank.v1beta1.GenesisState"; @@ -22,17 +24,19 @@ export interface GenesisStateProtoMsg { } /** GenesisState defines the bank module's genesis state. */ export interface GenesisStateAmino { - /** params defines all the paramaters of the module. */ - params?: ParamsAmino; + /** params defines all the parameters of the module. */ + params: ParamsAmino; /** balances is an array containing the balances of all the accounts. */ - balances?: BalanceAmino[]; + balances: BalanceAmino[]; /** * supply represents the total supply. If it is left empty, then supply will be calculated based on the provided * balances. Otherwise, it will be used to validate that the sum of the balances equals this amount. */ - supply?: CoinAmino[]; - /** denom_metadata defines the metadata of the differents coins. */ - denom_metadata?: MetadataAmino[]; + supply: CoinAmino[]; + /** denom_metadata defines the metadata of the different coins. */ + denom_metadata: MetadataAmino[]; + /** send_enabled defines the denoms where send is enabled or disabled. */ + send_enabled: SendEnabledAmino[]; } export interface GenesisStateAminoMsg { type: "cosmos-sdk/GenesisState"; @@ -44,6 +48,7 @@ export interface GenesisStateSDKType { balances: BalanceSDKType[]; supply: CoinSDKType[]; denom_metadata: MetadataSDKType[]; + send_enabled: SendEnabledSDKType[]; } /** * Balance defines an account address and balance pair used in the bank module's @@ -67,7 +72,7 @@ export interface BalanceAmino { /** address is the address of the balance holder. */ address?: string; /** coins defines the different coins this balance holds. */ - coins?: CoinAmino[]; + coins: CoinAmino[]; } export interface BalanceAminoMsg { type: "cosmos-sdk/Balance"; @@ -86,7 +91,8 @@ function createBaseGenesisState(): GenesisState { params: Params.fromPartial({}), balances: [], supply: [], - denomMetadata: [] + denomMetadata: [], + sendEnabled: [] }; } export const GenesisState = { @@ -104,6 +110,9 @@ export const GenesisState = { for (const v of message.denomMetadata) { Metadata.encode(v!, writer.uint32(34).fork()).ldelim(); } + for (const v of message.sendEnabled) { + SendEnabled.encode(v!, writer.uint32(42).fork()).ldelim(); + } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { @@ -125,6 +134,9 @@ export const GenesisState = { case 4: message.denomMetadata.push(Metadata.decode(reader, reader.uint32())); break; + case 5: + message.sendEnabled.push(SendEnabled.decode(reader, reader.uint32())); + break; default: reader.skipType(tag & 7); break; @@ -138,6 +150,7 @@ export const GenesisState = { message.balances = object.balances?.map(e => Balance.fromPartial(e)) || []; message.supply = object.supply?.map(e => Coin.fromPartial(e)) || []; message.denomMetadata = object.denomMetadata?.map(e => Metadata.fromPartial(e)) || []; + message.sendEnabled = object.sendEnabled?.map(e => SendEnabled.fromPartial(e)) || []; return message; }, fromAmino(object: GenesisStateAmino): GenesisState { @@ -148,11 +161,12 @@ export const GenesisState = { message.balances = object.balances?.map(e => Balance.fromAmino(e)) || []; message.supply = object.supply?.map(e => Coin.fromAmino(e)) || []; message.denomMetadata = object.denom_metadata?.map(e => Metadata.fromAmino(e)) || []; + message.sendEnabled = object.send_enabled?.map(e => SendEnabled.fromAmino(e)) || []; return message; }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.params = message.params ? Params.toAmino(message.params) : undefined; + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); if (message.balances) { obj.balances = message.balances.map(e => e ? Balance.toAmino(e) : undefined); } else { @@ -168,6 +182,11 @@ export const GenesisState = { } else { obj.denom_metadata = message.denomMetadata; } + if (message.sendEnabled) { + obj.send_enabled = message.sendEnabled.map(e => e ? SendEnabled.toAmino(e) : undefined); + } else { + obj.send_enabled = message.sendEnabled; + } return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/packages/api/src/cosmos/bank/v1beta1/query.lcd.ts b/packages/api/src/cosmos/bank/v1beta1/query.lcd.ts index 7a74cb83..b213385a 100644 --- a/packages/api/src/cosmos/bank/v1beta1/query.lcd.ts +++ b/packages/api/src/cosmos/bank/v1beta1/query.lcd.ts @@ -1,7 +1,7 @@ //@ts-nocheck import { setPaginationParams } from "../../../helpers"; import { LCDClient } from "@cosmology/lcd"; -import { QueryBalanceRequest, QueryBalanceResponseSDKType, QueryAllBalancesRequest, QueryAllBalancesResponseSDKType, QuerySpendableBalancesRequest, QuerySpendableBalancesResponseSDKType, QueryTotalSupplyRequest, QueryTotalSupplyResponseSDKType, QuerySupplyOfRequest, QuerySupplyOfResponseSDKType, QueryParamsRequest, QueryParamsResponseSDKType, QueryDenomMetadataRequest, QueryDenomMetadataResponseSDKType, QueryDenomsMetadataRequest, QueryDenomsMetadataResponseSDKType, QueryDenomOwnersRequest, QueryDenomOwnersResponseSDKType } from "./query"; +import { QueryBalanceRequest, QueryBalanceResponseSDKType, QueryAllBalancesRequest, QueryAllBalancesResponseSDKType, QuerySpendableBalancesRequest, QuerySpendableBalancesResponseSDKType, QuerySpendableBalanceByDenomRequest, QuerySpendableBalanceByDenomResponseSDKType, QueryTotalSupplyRequest, QueryTotalSupplyResponseSDKType, QuerySupplyOfRequest, QuerySupplyOfResponseSDKType, QueryParamsRequest, QueryParamsResponseSDKType, QueryDenomsMetadataRequest, QueryDenomsMetadataResponseSDKType, QueryDenomMetadataRequest, QueryDenomMetadataResponseSDKType, QueryDenomMetadataByQueryStringRequest, QueryDenomMetadataByQueryStringResponseSDKType, QueryDenomOwnersRequest, QueryDenomOwnersResponseSDKType, QueryDenomOwnersByQueryRequest, QueryDenomOwnersByQueryResponseSDKType, QuerySendEnabledRequest, QuerySendEnabledResponseSDKType } from "./query"; export class LCDQueryClient { req: LCDClient; constructor({ @@ -13,12 +13,16 @@ export class LCDQueryClient { this.balance = this.balance.bind(this); this.allBalances = this.allBalances.bind(this); this.spendableBalances = this.spendableBalances.bind(this); + this.spendableBalanceByDenom = this.spendableBalanceByDenom.bind(this); this.totalSupply = this.totalSupply.bind(this); this.supplyOf = this.supplyOf.bind(this); this.params = this.params.bind(this); - this.denomMetadata = this.denomMetadata.bind(this); this.denomsMetadata = this.denomsMetadata.bind(this); + this.denomMetadata = this.denomMetadata.bind(this); + this.denomMetadataByQueryString = this.denomMetadataByQueryString.bind(this); this.denomOwners = this.denomOwners.bind(this); + this.denomOwnersByQuery = this.denomOwnersByQuery.bind(this); + this.sendEnabled = this.sendEnabled.bind(this); } /* Balance queries the balance of a single coin for a single account. */ async balance(params: QueryBalanceRequest): Promise { @@ -31,7 +35,10 @@ export class LCDQueryClient { const endpoint = `cosmos/bank/v1beta1/balances/${params.address}/by_denom`; return await this.req.get(endpoint, options); } - /* AllBalances queries the balance of all coins for a single account. */ + /* AllBalances queries the balance of all coins for a single account. + + When called from another module, this query might consume a high amount of + gas if the pagination field is incorrectly set. */ async allBalances(params: QueryAllBalancesRequest): Promise { const options: any = { params: {} @@ -39,13 +46,17 @@ export class LCDQueryClient { if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } + if (typeof params?.resolveDenom !== "undefined") { + options.params.resolve_denom = params.resolveDenom; + } const endpoint = `cosmos/bank/v1beta1/balances/${params.address}`; return await this.req.get(endpoint, options); } - /* SpendableBalances queries the spenable balance of all coins for a single + /* SpendableBalances queries the spendable balance of all coins for a single account. - Since: cosmos-sdk 0.46 */ + When called from another module, this query might consume a high amount of + gas if the pagination field is incorrectly set. */ async spendableBalances(params: QuerySpendableBalancesRequest): Promise { const options: any = { params: {} @@ -56,7 +67,25 @@ export class LCDQueryClient { const endpoint = `cosmos/bank/v1beta1/spendable_balances/${params.address}`; return await this.req.get(endpoint, options); } - /* TotalSupply queries the total supply of all coins. */ + /* SpendableBalanceByDenom queries the spendable balance of a single denom for + a single account. + + When called from another module, this query might consume a high amount of + gas if the pagination field is incorrectly set. */ + async spendableBalanceByDenom(params: QuerySpendableBalanceByDenomRequest): Promise { + const options: any = { + params: {} + }; + if (typeof params?.denom !== "undefined") { + options.params.denom = params.denom; + } + const endpoint = `cosmos/bank/v1beta1/spendable_balances/${params.address}/by_denom`; + return await this.req.get(endpoint, options); + } + /* TotalSupply queries the total supply of all coins. + + When called from another module, this query might consume a high amount of + gas if the pagination field is incorrectly set. */ async totalSupply(params: QueryTotalSupplyRequest = { pagination: undefined }): Promise { @@ -69,7 +98,10 @@ export class LCDQueryClient { const endpoint = `cosmos/bank/v1beta1/supply`; return await this.req.get(endpoint, options); } - /* SupplyOf queries the supply of a single coin. */ + /* SupplyOf queries the supply of a single coin. + + When called from another module, this query might consume a high amount of + gas if the pagination field is incorrectly set. */ async supplyOf(params: QuerySupplyOfRequest): Promise { const options: any = { params: {} @@ -85,11 +117,6 @@ export class LCDQueryClient { const endpoint = `cosmos/bank/v1beta1/params`; return await this.req.get(endpoint); } - /* DenomsMetadata queries the client metadata of a given coin denomination. */ - async denomMetadata(params: QueryDenomMetadataRequest): Promise { - const endpoint = `cosmos/bank/v1beta1/denoms_metadata/${params.denom}`; - return await this.req.get(endpoint); - } /* DenomsMetadata queries the client metadata for all registered coin denominations. */ async denomsMetadata(params: QueryDenomsMetadataRequest = { @@ -104,18 +131,77 @@ export class LCDQueryClient { const endpoint = `cosmos/bank/v1beta1/denoms_metadata`; return await this.req.get(endpoint, options); } + /* DenomMetadata queries the client metadata of a given coin denomination. */ + async denomMetadata(params: QueryDenomMetadataRequest): Promise { + const options: any = { + params: {} + }; + if (typeof params?.denom !== "undefined") { + options.params.denom = params.denom; + } + const endpoint = `cosmos/bank/v1beta1/denoms_metadata/${params.denom}`; + return await this.req.get(endpoint, options); + } + /* DenomMetadataByQueryString queries the client metadata of a given coin denomination. */ + async denomMetadataByQueryString(params: QueryDenomMetadataByQueryStringRequest): Promise { + const options: any = { + params: {} + }; + if (typeof params?.denom !== "undefined") { + options.params.denom = params.denom; + } + const endpoint = `cosmos/bank/v1beta1/denoms_metadata_by_query_string`; + return await this.req.get(endpoint, options); + } /* DenomOwners queries for all account addresses that own a particular token denomination. - Since: cosmos-sdk 0.46 */ + When called from another module, this query might consume a high amount of + gas if the pagination field is incorrectly set. */ async denomOwners(params: QueryDenomOwnersRequest): Promise { const options: any = { params: {} }; + if (typeof params?.denom !== "undefined") { + options.params.denom = params.denom; + } if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } const endpoint = `cosmos/bank/v1beta1/denom_owners/${params.denom}`; return await this.req.get(endpoint, options); } + /* DenomOwnersByQuery queries for all account addresses that own a particular token + denomination. */ + async denomOwnersByQuery(params: QueryDenomOwnersByQueryRequest): Promise { + const options: any = { + params: {} + }; + if (typeof params?.denom !== "undefined") { + options.params.denom = params.denom; + } + if (typeof params?.pagination !== "undefined") { + setPaginationParams(options, params.pagination); + } + const endpoint = `cosmos/bank/v1beta1/denom_owners_by_query`; + return await this.req.get(endpoint, options); + } + /* SendEnabled queries for SendEnabled entries. + + This query only returns denominations that have specific SendEnabled settings. + Any denomination that does not have a specific setting will use the default + params.default_send_enabled, and will not be returned by this query. */ + async sendEnabled(params: QuerySendEnabledRequest): Promise { + const options: any = { + params: {} + }; + if (typeof params?.denoms !== "undefined") { + options.params.denoms = params.denoms; + } + if (typeof params?.pagination !== "undefined") { + setPaginationParams(options, params.pagination); + } + const endpoint = `cosmos/bank/v1beta1/send_enabled`; + return await this.req.get(endpoint, options); + } } \ No newline at end of file diff --git a/packages/api/src/cosmos/bank/v1beta1/query.rpc.Query.ts b/packages/api/src/cosmos/bank/v1beta1/query.rpc.Query.ts index c1841757..2d99e84b 100644 --- a/packages/api/src/cosmos/bank/v1beta1/query.rpc.Query.ts +++ b/packages/api/src/cosmos/bank/v1beta1/query.rpc.Query.ts @@ -2,40 +2,80 @@ import { Rpc } from "../../../helpers"; import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryBalanceRequest, QueryBalanceResponse, QueryAllBalancesRequest, QueryAllBalancesResponse, QuerySpendableBalancesRequest, QuerySpendableBalancesResponse, QueryTotalSupplyRequest, QueryTotalSupplyResponse, QuerySupplyOfRequest, QuerySupplyOfResponse, QueryParamsRequest, QueryParamsResponse, QueryDenomMetadataRequest, QueryDenomMetadataResponse, QueryDenomsMetadataRequest, QueryDenomsMetadataResponse, QueryDenomOwnersRequest, QueryDenomOwnersResponse } from "./query"; +import { QueryBalanceRequest, QueryBalanceResponse, QueryAllBalancesRequest, QueryAllBalancesResponse, QuerySpendableBalancesRequest, QuerySpendableBalancesResponse, QuerySpendableBalanceByDenomRequest, QuerySpendableBalanceByDenomResponse, QueryTotalSupplyRequest, QueryTotalSupplyResponse, QuerySupplyOfRequest, QuerySupplyOfResponse, QueryParamsRequest, QueryParamsResponse, QueryDenomsMetadataRequest, QueryDenomsMetadataResponse, QueryDenomMetadataRequest, QueryDenomMetadataResponse, QueryDenomMetadataByQueryStringRequest, QueryDenomMetadataByQueryStringResponse, QueryDenomOwnersRequest, QueryDenomOwnersResponse, QueryDenomOwnersByQueryRequest, QueryDenomOwnersByQueryResponse, QuerySendEnabledRequest, QuerySendEnabledResponse } from "./query"; /** Query defines the gRPC querier service. */ export interface Query { /** Balance queries the balance of a single coin for a single account. */ balance(request: QueryBalanceRequest): Promise; - /** AllBalances queries the balance of all coins for a single account. */ + /** + * AllBalances queries the balance of all coins for a single account. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ allBalances(request: QueryAllBalancesRequest): Promise; /** - * SpendableBalances queries the spenable balance of all coins for a single + * SpendableBalances queries the spendable balance of all coins for a single * account. * - * Since: cosmos-sdk 0.46 + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. */ spendableBalances(request: QuerySpendableBalancesRequest): Promise; - /** TotalSupply queries the total supply of all coins. */ + /** + * SpendableBalanceByDenom queries the spendable balance of a single denom for + * a single account. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + spendableBalanceByDenom(request: QuerySpendableBalanceByDenomRequest): Promise; + /** + * TotalSupply queries the total supply of all coins. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ totalSupply(request?: QueryTotalSupplyRequest): Promise; - /** SupplyOf queries the supply of a single coin. */ + /** + * SupplyOf queries the supply of a single coin. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ supplyOf(request: QuerySupplyOfRequest): Promise; /** Params queries the parameters of x/bank module. */ params(request?: QueryParamsRequest): Promise; - /** DenomsMetadata queries the client metadata of a given coin denomination. */ - denomMetadata(request: QueryDenomMetadataRequest): Promise; /** * DenomsMetadata queries the client metadata for all registered coin * denominations. */ denomsMetadata(request?: QueryDenomsMetadataRequest): Promise; + /** DenomMetadata queries the client metadata of a given coin denomination. */ + denomMetadata(request: QueryDenomMetadataRequest): Promise; + /** DenomMetadataByQueryString queries the client metadata of a given coin denomination. */ + denomMetadataByQueryString(request: QueryDenomMetadataByQueryStringRequest): Promise; /** * DenomOwners queries for all account addresses that own a particular token * denomination. * - * Since: cosmos-sdk 0.46 + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. */ denomOwners(request: QueryDenomOwnersRequest): Promise; + /** + * DenomOwnersByQuery queries for all account addresses that own a particular token + * denomination. + */ + denomOwnersByQuery(request: QueryDenomOwnersByQueryRequest): Promise; + /** + * SendEnabled queries for SendEnabled entries. + * + * This query only returns denominations that have specific SendEnabled settings. + * Any denomination that does not have a specific setting will use the default + * params.default_send_enabled, and will not be returned by this query. + */ + sendEnabled(request: QuerySendEnabledRequest): Promise; } export class QueryClientImpl implements Query { private readonly rpc: Rpc; @@ -44,12 +84,16 @@ export class QueryClientImpl implements Query { this.balance = this.balance.bind(this); this.allBalances = this.allBalances.bind(this); this.spendableBalances = this.spendableBalances.bind(this); + this.spendableBalanceByDenom = this.spendableBalanceByDenom.bind(this); this.totalSupply = this.totalSupply.bind(this); this.supplyOf = this.supplyOf.bind(this); this.params = this.params.bind(this); - this.denomMetadata = this.denomMetadata.bind(this); this.denomsMetadata = this.denomsMetadata.bind(this); + this.denomMetadata = this.denomMetadata.bind(this); + this.denomMetadataByQueryString = this.denomMetadataByQueryString.bind(this); this.denomOwners = this.denomOwners.bind(this); + this.denomOwnersByQuery = this.denomOwnersByQuery.bind(this); + this.sendEnabled = this.sendEnabled.bind(this); } balance(request: QueryBalanceRequest): Promise { const data = QueryBalanceRequest.encode(request).finish(); @@ -66,6 +110,11 @@ export class QueryClientImpl implements Query { const promise = this.rpc.request("cosmos.bank.v1beta1.Query", "SpendableBalances", data); return promise.then(data => QuerySpendableBalancesResponse.decode(new BinaryReader(data))); } + spendableBalanceByDenom(request: QuerySpendableBalanceByDenomRequest): Promise { + const data = QuerySpendableBalanceByDenomRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.bank.v1beta1.Query", "SpendableBalanceByDenom", data); + return promise.then(data => QuerySpendableBalanceByDenomResponse.decode(new BinaryReader(data))); + } totalSupply(request: QueryTotalSupplyRequest = { pagination: undefined }): Promise { @@ -83,11 +132,6 @@ export class QueryClientImpl implements Query { const promise = this.rpc.request("cosmos.bank.v1beta1.Query", "Params", data); return promise.then(data => QueryParamsResponse.decode(new BinaryReader(data))); } - denomMetadata(request: QueryDenomMetadataRequest): Promise { - const data = QueryDenomMetadataRequest.encode(request).finish(); - const promise = this.rpc.request("cosmos.bank.v1beta1.Query", "DenomMetadata", data); - return promise.then(data => QueryDenomMetadataResponse.decode(new BinaryReader(data))); - } denomsMetadata(request: QueryDenomsMetadataRequest = { pagination: undefined }): Promise { @@ -95,11 +139,31 @@ export class QueryClientImpl implements Query { const promise = this.rpc.request("cosmos.bank.v1beta1.Query", "DenomsMetadata", data); return promise.then(data => QueryDenomsMetadataResponse.decode(new BinaryReader(data))); } + denomMetadata(request: QueryDenomMetadataRequest): Promise { + const data = QueryDenomMetadataRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.bank.v1beta1.Query", "DenomMetadata", data); + return promise.then(data => QueryDenomMetadataResponse.decode(new BinaryReader(data))); + } + denomMetadataByQueryString(request: QueryDenomMetadataByQueryStringRequest): Promise { + const data = QueryDenomMetadataByQueryStringRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.bank.v1beta1.Query", "DenomMetadataByQueryString", data); + return promise.then(data => QueryDenomMetadataByQueryStringResponse.decode(new BinaryReader(data))); + } denomOwners(request: QueryDenomOwnersRequest): Promise { const data = QueryDenomOwnersRequest.encode(request).finish(); const promise = this.rpc.request("cosmos.bank.v1beta1.Query", "DenomOwners", data); return promise.then(data => QueryDenomOwnersResponse.decode(new BinaryReader(data))); } + denomOwnersByQuery(request: QueryDenomOwnersByQueryRequest): Promise { + const data = QueryDenomOwnersByQueryRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.bank.v1beta1.Query", "DenomOwnersByQuery", data); + return promise.then(data => QueryDenomOwnersByQueryResponse.decode(new BinaryReader(data))); + } + sendEnabled(request: QuerySendEnabledRequest): Promise { + const data = QuerySendEnabledRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.bank.v1beta1.Query", "SendEnabled", data); + return promise.then(data => QuerySendEnabledResponse.decode(new BinaryReader(data))); + } } export const createRpcQueryExtension = (base: QueryClient) => { const rpc = createProtobufRpcClient(base); @@ -114,6 +178,9 @@ export const createRpcQueryExtension = (base: QueryClient) => { spendableBalances(request: QuerySpendableBalancesRequest): Promise { return queryService.spendableBalances(request); }, + spendableBalanceByDenom(request: QuerySpendableBalanceByDenomRequest): Promise { + return queryService.spendableBalanceByDenom(request); + }, totalSupply(request?: QueryTotalSupplyRequest): Promise { return queryService.totalSupply(request); }, @@ -123,14 +190,23 @@ export const createRpcQueryExtension = (base: QueryClient) => { params(request?: QueryParamsRequest): Promise { return queryService.params(request); }, + denomsMetadata(request?: QueryDenomsMetadataRequest): Promise { + return queryService.denomsMetadata(request); + }, denomMetadata(request: QueryDenomMetadataRequest): Promise { return queryService.denomMetadata(request); }, - denomsMetadata(request?: QueryDenomsMetadataRequest): Promise { - return queryService.denomsMetadata(request); + denomMetadataByQueryString(request: QueryDenomMetadataByQueryStringRequest): Promise { + return queryService.denomMetadataByQueryString(request); }, denomOwners(request: QueryDenomOwnersRequest): Promise { return queryService.denomOwners(request); + }, + denomOwnersByQuery(request: QueryDenomOwnersByQueryRequest): Promise { + return queryService.denomOwnersByQuery(request); + }, + sendEnabled(request: QuerySendEnabledRequest): Promise { + return queryService.sendEnabled(request); } }; }; \ No newline at end of file diff --git a/packages/api/src/cosmos/bank/v1beta1/query.ts b/packages/api/src/cosmos/bank/v1beta1/query.ts index 448ec842..982cf9aa 100644 --- a/packages/api/src/cosmos/bank/v1beta1/query.ts +++ b/packages/api/src/cosmos/bank/v1beta1/query.ts @@ -1,7 +1,7 @@ //@ts-nocheck import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; -import { Params, ParamsAmino, ParamsSDKType, Metadata, MetadataAmino, MetadataSDKType } from "./bank"; +import { Params, ParamsAmino, ParamsSDKType, Metadata, MetadataAmino, MetadataSDKType, SendEnabled, SendEnabledAmino, SendEnabledSDKType } from "./bank"; import { BinaryReader, BinaryWriter } from "../../../binary"; /** QueryBalanceRequest is the request type for the Query/Balance RPC method. */ export interface QueryBalanceRequest { @@ -58,6 +58,8 @@ export interface QueryAllBalancesRequest { address: string; /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; + /** resolve_denom is the flag to resolve the denom into a human-readable form from the metadata. */ + resolveDenom: boolean; } export interface QueryAllBalancesRequestProtoMsg { typeUrl: "/cosmos.bank.v1beta1.QueryAllBalancesRequest"; @@ -69,6 +71,8 @@ export interface QueryAllBalancesRequestAmino { address?: string; /** pagination defines an optional pagination for the request. */ pagination?: PageRequestAmino; + /** resolve_denom is the flag to resolve the denom into a human-readable form from the metadata. */ + resolve_denom?: boolean; } export interface QueryAllBalancesRequestAminoMsg { type: "cosmos-sdk/QueryAllBalancesRequest"; @@ -78,6 +82,7 @@ export interface QueryAllBalancesRequestAminoMsg { export interface QueryAllBalancesRequestSDKType { address: string; pagination?: PageRequestSDKType; + resolve_denom: boolean; } /** * QueryAllBalancesResponse is the response type for the Query/AllBalances RPC @@ -99,7 +104,7 @@ export interface QueryAllBalancesResponseProtoMsg { */ export interface QueryAllBalancesResponseAmino { /** balances is the balances of all the coins. */ - balances?: CoinAmino[]; + balances: CoinAmino[]; /** pagination defines the pagination in the response. */ pagination?: PageResponseAmino; } @@ -118,8 +123,6 @@ export interface QueryAllBalancesResponseSDKType { /** * QuerySpendableBalancesRequest defines the gRPC request structure for querying * an account's spendable balances. - * - * Since: cosmos-sdk 0.46 */ export interface QuerySpendableBalancesRequest { /** address is the address to query spendable balances for. */ @@ -134,8 +137,6 @@ export interface QuerySpendableBalancesRequestProtoMsg { /** * QuerySpendableBalancesRequest defines the gRPC request structure for querying * an account's spendable balances. - * - * Since: cosmos-sdk 0.46 */ export interface QuerySpendableBalancesRequestAmino { /** address is the address to query spendable balances for. */ @@ -150,8 +151,6 @@ export interface QuerySpendableBalancesRequestAminoMsg { /** * QuerySpendableBalancesRequest defines the gRPC request structure for querying * an account's spendable balances. - * - * Since: cosmos-sdk 0.46 */ export interface QuerySpendableBalancesRequestSDKType { address: string; @@ -160,8 +159,6 @@ export interface QuerySpendableBalancesRequestSDKType { /** * QuerySpendableBalancesResponse defines the gRPC response structure for querying * an account's spendable balances. - * - * Since: cosmos-sdk 0.46 */ export interface QuerySpendableBalancesResponse { /** balances is the spendable balances of all the coins. */ @@ -176,12 +173,10 @@ export interface QuerySpendableBalancesResponseProtoMsg { /** * QuerySpendableBalancesResponse defines the gRPC response structure for querying * an account's spendable balances. - * - * Since: cosmos-sdk 0.46 */ export interface QuerySpendableBalancesResponseAmino { /** balances is the spendable balances of all the coins. */ - balances?: CoinAmino[]; + balances: CoinAmino[]; /** pagination defines the pagination in the response. */ pagination?: PageResponseAmino; } @@ -192,23 +187,84 @@ export interface QuerySpendableBalancesResponseAminoMsg { /** * QuerySpendableBalancesResponse defines the gRPC response structure for querying * an account's spendable balances. - * - * Since: cosmos-sdk 0.46 */ export interface QuerySpendableBalancesResponseSDKType { balances: CoinSDKType[]; pagination?: PageResponseSDKType; } +/** + * QuerySpendableBalanceByDenomRequest defines the gRPC request structure for + * querying an account's spendable balance for a specific denom. + */ +export interface QuerySpendableBalanceByDenomRequest { + /** address is the address to query balances for. */ + address: string; + /** denom is the coin denom to query balances for. */ + denom: string; +} +export interface QuerySpendableBalanceByDenomRequestProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QuerySpendableBalanceByDenomRequest"; + value: Uint8Array; +} +/** + * QuerySpendableBalanceByDenomRequest defines the gRPC request structure for + * querying an account's spendable balance for a specific denom. + */ +export interface QuerySpendableBalanceByDenomRequestAmino { + /** address is the address to query balances for. */ + address?: string; + /** denom is the coin denom to query balances for. */ + denom?: string; +} +export interface QuerySpendableBalanceByDenomRequestAminoMsg { + type: "cosmos-sdk/QuerySpendableBalanceByDenomRequest"; + value: QuerySpendableBalanceByDenomRequestAmino; +} +/** + * QuerySpendableBalanceByDenomRequest defines the gRPC request structure for + * querying an account's spendable balance for a specific denom. + */ +export interface QuerySpendableBalanceByDenomRequestSDKType { + address: string; + denom: string; +} +/** + * QuerySpendableBalanceByDenomResponse defines the gRPC response structure for + * querying an account's spendable balance for a specific denom. + */ +export interface QuerySpendableBalanceByDenomResponse { + /** balance is the balance of the coin. */ + balance?: Coin; +} +export interface QuerySpendableBalanceByDenomResponseProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QuerySpendableBalanceByDenomResponse"; + value: Uint8Array; +} +/** + * QuerySpendableBalanceByDenomResponse defines the gRPC response structure for + * querying an account's spendable balance for a specific denom. + */ +export interface QuerySpendableBalanceByDenomResponseAmino { + /** balance is the balance of the coin. */ + balance?: CoinAmino; +} +export interface QuerySpendableBalanceByDenomResponseAminoMsg { + type: "cosmos-sdk/QuerySpendableBalanceByDenomResponse"; + value: QuerySpendableBalanceByDenomResponseAmino; +} +/** + * QuerySpendableBalanceByDenomResponse defines the gRPC response structure for + * querying an account's spendable balance for a specific denom. + */ +export interface QuerySpendableBalanceByDenomResponseSDKType { + balance?: CoinSDKType; +} /** * QueryTotalSupplyRequest is the request type for the Query/TotalSupply RPC * method. */ export interface QueryTotalSupplyRequest { - /** - * pagination defines an optional pagination for the request. - * - * Since: cosmos-sdk 0.43 - */ + /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } export interface QueryTotalSupplyRequestProtoMsg { @@ -220,11 +276,7 @@ export interface QueryTotalSupplyRequestProtoMsg { * method. */ export interface QueryTotalSupplyRequestAmino { - /** - * pagination defines an optional pagination for the request. - * - * Since: cosmos-sdk 0.43 - */ + /** pagination defines an optional pagination for the request. */ pagination?: PageRequestAmino; } export interface QueryTotalSupplyRequestAminoMsg { @@ -245,11 +297,7 @@ export interface QueryTotalSupplyRequestSDKType { export interface QueryTotalSupplyResponse { /** supply is the supply of the coins */ supply: Coin[]; - /** - * pagination defines the pagination in the response. - * - * Since: cosmos-sdk 0.43 - */ + /** pagination defines the pagination in the response. */ pagination?: PageResponse; } export interface QueryTotalSupplyResponseProtoMsg { @@ -262,12 +310,8 @@ export interface QueryTotalSupplyResponseProtoMsg { */ export interface QueryTotalSupplyResponseAmino { /** supply is the supply of the coins */ - supply?: CoinAmino[]; - /** - * pagination defines the pagination in the response. - * - * Since: cosmos-sdk 0.43 - */ + supply: CoinAmino[]; + /** pagination defines the pagination in the response. */ pagination?: PageResponseAmino; } export interface QueryTotalSupplyResponseAminoMsg { @@ -316,7 +360,7 @@ export interface QuerySupplyOfResponseProtoMsg { /** QuerySupplyOfResponse is the response type for the Query/SupplyOf RPC method. */ export interface QuerySupplyOfResponseAmino { /** amount is the supply of the coin. */ - amount?: CoinAmino; + amount: CoinAmino; } export interface QuerySupplyOfResponseAminoMsg { type: "cosmos-sdk/QuerySupplyOfResponse"; @@ -342,6 +386,7 @@ export interface QueryParamsRequestAminoMsg { export interface QueryParamsRequestSDKType {} /** QueryParamsResponse defines the response type for querying x/bank parameters. */ export interface QueryParamsResponse { + /** params provides the parameters of the bank module. */ params: Params; } export interface QueryParamsResponseProtoMsg { @@ -350,7 +395,8 @@ export interface QueryParamsResponseProtoMsg { } /** QueryParamsResponse defines the response type for querying x/bank parameters. */ export interface QueryParamsResponseAmino { - params?: ParamsAmino; + /** params provides the parameters of the bank module. */ + params: ParamsAmino; } export interface QueryParamsResponseAminoMsg { type: "cosmos-sdk/QueryParamsResponse"; @@ -402,7 +448,7 @@ export interface QueryDenomsMetadataResponseProtoMsg { */ export interface QueryDenomsMetadataResponseAmino { /** metadata provides the client information for all the registered tokens. */ - metadatas?: MetadataAmino[]; + metadatas: MetadataAmino[]; /** pagination defines the pagination in the response. */ pagination?: PageResponseAmino; } @@ -458,7 +504,7 @@ export interface QueryDenomMetadataResponseProtoMsg { */ export interface QueryDenomMetadataResponseAmino { /** metadata describes and provides all the client information for the requested token. */ - metadata?: MetadataAmino; + metadata: MetadataAmino; } export interface QueryDenomMetadataResponseAminoMsg { type: "cosmos-sdk/QueryDenomMetadataResponse"; @@ -471,6 +517,68 @@ export interface QueryDenomMetadataResponseAminoMsg { export interface QueryDenomMetadataResponseSDKType { metadata: MetadataSDKType; } +/** + * QueryDenomMetadataByQueryStringRequest is the request type for the Query/DenomMetadata RPC method. + * Identical with QueryDenomMetadataRequest but receives denom as query string. + */ +export interface QueryDenomMetadataByQueryStringRequest { + /** denom is the coin denom to query the metadata for. */ + denom: string; +} +export interface QueryDenomMetadataByQueryStringRequestProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomMetadataByQueryStringRequest"; + value: Uint8Array; +} +/** + * QueryDenomMetadataByQueryStringRequest is the request type for the Query/DenomMetadata RPC method. + * Identical with QueryDenomMetadataRequest but receives denom as query string. + */ +export interface QueryDenomMetadataByQueryStringRequestAmino { + /** denom is the coin denom to query the metadata for. */ + denom?: string; +} +export interface QueryDenomMetadataByQueryStringRequestAminoMsg { + type: "cosmos-sdk/QueryDenomMetadataByQueryStringRequest"; + value: QueryDenomMetadataByQueryStringRequestAmino; +} +/** + * QueryDenomMetadataByQueryStringRequest is the request type for the Query/DenomMetadata RPC method. + * Identical with QueryDenomMetadataRequest but receives denom as query string. + */ +export interface QueryDenomMetadataByQueryStringRequestSDKType { + denom: string; +} +/** + * QueryDenomMetadataByQueryStringResponse is the response type for the Query/DenomMetadata RPC + * method. Identical with QueryDenomMetadataResponse but receives denom as query string in request. + */ +export interface QueryDenomMetadataByQueryStringResponse { + /** metadata describes and provides all the client information for the requested token. */ + metadata: Metadata; +} +export interface QueryDenomMetadataByQueryStringResponseProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomMetadataByQueryStringResponse"; + value: Uint8Array; +} +/** + * QueryDenomMetadataByQueryStringResponse is the response type for the Query/DenomMetadata RPC + * method. Identical with QueryDenomMetadataResponse but receives denom as query string in request. + */ +export interface QueryDenomMetadataByQueryStringResponseAmino { + /** metadata describes and provides all the client information for the requested token. */ + metadata: MetadataAmino; +} +export interface QueryDenomMetadataByQueryStringResponseAminoMsg { + type: "cosmos-sdk/QueryDenomMetadataByQueryStringResponse"; + value: QueryDenomMetadataByQueryStringResponseAmino; +} +/** + * QueryDenomMetadataByQueryStringResponse is the response type for the Query/DenomMetadata RPC + * method. Identical with QueryDenomMetadataResponse but receives denom as query string in request. + */ +export interface QueryDenomMetadataByQueryStringResponseSDKType { + metadata: MetadataSDKType; +} /** * QueryDenomOwnersRequest defines the request type for the DenomOwners RPC query, * which queries for a paginated set of all account holders of a particular @@ -514,8 +622,6 @@ export interface QueryDenomOwnersRequestSDKType { * DenomOwner defines structure representing an account that owns or holds a * particular denominated token. It contains the account address and account * balance of the denominated token. - * - * Since: cosmos-sdk 0.46 */ export interface DenomOwner { /** address defines the address that owns a particular denomination. */ @@ -531,14 +637,12 @@ export interface DenomOwnerProtoMsg { * DenomOwner defines structure representing an account that owns or holds a * particular denominated token. It contains the account address and account * balance of the denominated token. - * - * Since: cosmos-sdk 0.46 */ export interface DenomOwnerAmino { /** address defines the address that owns a particular denomination. */ address?: string; /** balance is the balance of the denominated coin for an account. */ - balance?: CoinAmino; + balance: CoinAmino; } export interface DenomOwnerAminoMsg { type: "cosmos-sdk/DenomOwner"; @@ -548,18 +652,12 @@ export interface DenomOwnerAminoMsg { * DenomOwner defines structure representing an account that owns or holds a * particular denominated token. It contains the account address and account * balance of the denominated token. - * - * Since: cosmos-sdk 0.46 */ export interface DenomOwnerSDKType { address: string; balance: CoinSDKType; } -/** - * QueryDenomOwnersResponse defines the RPC response of a DenomOwners RPC query. - * - * Since: cosmos-sdk 0.46 - */ +/** QueryDenomOwnersResponse defines the RPC response of a DenomOwners RPC query. */ export interface QueryDenomOwnersResponse { denomOwners: DenomOwner[]; /** pagination defines the pagination in the response. */ @@ -569,11 +667,7 @@ export interface QueryDenomOwnersResponseProtoMsg { typeUrl: "/cosmos.bank.v1beta1.QueryDenomOwnersResponse"; value: Uint8Array; } -/** - * QueryDenomOwnersResponse defines the RPC response of a DenomOwners RPC query. - * - * Since: cosmos-sdk 0.46 - */ +/** QueryDenomOwnersResponse defines the RPC response of a DenomOwners RPC query. */ export interface QueryDenomOwnersResponseAmino { denom_owners?: DenomOwnerAmino[]; /** pagination defines the pagination in the response. */ @@ -583,15 +677,139 @@ export interface QueryDenomOwnersResponseAminoMsg { type: "cosmos-sdk/QueryDenomOwnersResponse"; value: QueryDenomOwnersResponseAmino; } +/** QueryDenomOwnersResponse defines the RPC response of a DenomOwners RPC query. */ +export interface QueryDenomOwnersResponseSDKType { + denom_owners: DenomOwnerSDKType[]; + pagination?: PageResponseSDKType; +} /** - * QueryDenomOwnersResponse defines the RPC response of a DenomOwners RPC query. - * - * Since: cosmos-sdk 0.46 + * QueryDenomOwnersByQueryRequest defines the request type for the DenomOwnersByQuery RPC query, + * which queries for a paginated set of all account holders of a particular + * denomination. */ -export interface QueryDenomOwnersResponseSDKType { +export interface QueryDenomOwnersByQueryRequest { + /** denom defines the coin denomination to query all account holders for. */ + denom: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryDenomOwnersByQueryRequestProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomOwnersByQueryRequest"; + value: Uint8Array; +} +/** + * QueryDenomOwnersByQueryRequest defines the request type for the DenomOwnersByQuery RPC query, + * which queries for a paginated set of all account holders of a particular + * denomination. + */ +export interface QueryDenomOwnersByQueryRequestAmino { + /** denom defines the coin denomination to query all account holders for. */ + denom?: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryDenomOwnersByQueryRequestAminoMsg { + type: "cosmos-sdk/QueryDenomOwnersByQueryRequest"; + value: QueryDenomOwnersByQueryRequestAmino; +} +/** + * QueryDenomOwnersByQueryRequest defines the request type for the DenomOwnersByQuery RPC query, + * which queries for a paginated set of all account holders of a particular + * denomination. + */ +export interface QueryDenomOwnersByQueryRequestSDKType { + denom: string; + pagination?: PageRequestSDKType; +} +/** QueryDenomOwnersByQueryResponse defines the RPC response of a DenomOwnersByQuery RPC query. */ +export interface QueryDenomOwnersByQueryResponse { + denomOwners: DenomOwner[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryDenomOwnersByQueryResponseProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomOwnersByQueryResponse"; + value: Uint8Array; +} +/** QueryDenomOwnersByQueryResponse defines the RPC response of a DenomOwnersByQuery RPC query. */ +export interface QueryDenomOwnersByQueryResponseAmino { + denom_owners?: DenomOwnerAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryDenomOwnersByQueryResponseAminoMsg { + type: "cosmos-sdk/QueryDenomOwnersByQueryResponse"; + value: QueryDenomOwnersByQueryResponseAmino; +} +/** QueryDenomOwnersByQueryResponse defines the RPC response of a DenomOwnersByQuery RPC query. */ +export interface QueryDenomOwnersByQueryResponseSDKType { denom_owners: DenomOwnerSDKType[]; pagination?: PageResponseSDKType; } +/** QuerySendEnabledRequest defines the RPC request for looking up SendEnabled entries. */ +export interface QuerySendEnabledRequest { + /** denoms is the specific denoms you want look up. Leave empty to get all entries. */ + denoms: string[]; + /** + * pagination defines an optional pagination for the request. This field is + * only read if the denoms field is empty. + */ + pagination?: PageRequest; +} +export interface QuerySendEnabledRequestProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QuerySendEnabledRequest"; + value: Uint8Array; +} +/** QuerySendEnabledRequest defines the RPC request for looking up SendEnabled entries. */ +export interface QuerySendEnabledRequestAmino { + /** denoms is the specific denoms you want look up. Leave empty to get all entries. */ + denoms?: string[]; + /** + * pagination defines an optional pagination for the request. This field is + * only read if the denoms field is empty. + */ + pagination?: PageRequestAmino; +} +export interface QuerySendEnabledRequestAminoMsg { + type: "cosmos-sdk/QuerySendEnabledRequest"; + value: QuerySendEnabledRequestAmino; +} +/** QuerySendEnabledRequest defines the RPC request for looking up SendEnabled entries. */ +export interface QuerySendEnabledRequestSDKType { + denoms: string[]; + pagination?: PageRequestSDKType; +} +/** QuerySendEnabledResponse defines the RPC response of a SendEnable query. */ +export interface QuerySendEnabledResponse { + sendEnabled: SendEnabled[]; + /** + * pagination defines the pagination in the response. This field is only + * populated if the denoms field in the request is empty. + */ + pagination?: PageResponse; +} +export interface QuerySendEnabledResponseProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QuerySendEnabledResponse"; + value: Uint8Array; +} +/** QuerySendEnabledResponse defines the RPC response of a SendEnable query. */ +export interface QuerySendEnabledResponseAmino { + send_enabled?: SendEnabledAmino[]; + /** + * pagination defines the pagination in the response. This field is only + * populated if the denoms field in the request is empty. + */ + pagination?: PageResponseAmino; +} +export interface QuerySendEnabledResponseAminoMsg { + type: "cosmos-sdk/QuerySendEnabledResponse"; + value: QuerySendEnabledResponseAmino; +} +/** QuerySendEnabledResponse defines the RPC response of a SendEnable query. */ +export interface QuerySendEnabledResponseSDKType { + send_enabled: SendEnabledSDKType[]; + pagination?: PageResponseSDKType; +} function createBaseQueryBalanceRequest(): QueryBalanceRequest { return { address: "", @@ -745,7 +963,8 @@ export const QueryBalanceResponse = { function createBaseQueryAllBalancesRequest(): QueryAllBalancesRequest { return { address: "", - pagination: undefined + pagination: undefined, + resolveDenom: false }; } export const QueryAllBalancesRequest = { @@ -757,6 +976,9 @@ export const QueryAllBalancesRequest = { if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } + if (message.resolveDenom === true) { + writer.uint32(24).bool(message.resolveDenom); + } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): QueryAllBalancesRequest { @@ -772,6 +994,9 @@ export const QueryAllBalancesRequest = { case 2: message.pagination = PageRequest.decode(reader, reader.uint32()); break; + case 3: + message.resolveDenom = reader.bool(); + break; default: reader.skipType(tag & 7); break; @@ -783,6 +1008,7 @@ export const QueryAllBalancesRequest = { const message = createBaseQueryAllBalancesRequest(); message.address = object.address ?? ""; message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + message.resolveDenom = object.resolveDenom ?? false; return message; }, fromAmino(object: QueryAllBalancesRequestAmino): QueryAllBalancesRequest { @@ -793,12 +1019,16 @@ export const QueryAllBalancesRequest = { if (object.pagination !== undefined && object.pagination !== null) { message.pagination = PageRequest.fromAmino(object.pagination); } + if (object.resolve_denom !== undefined && object.resolve_denom !== null) { + message.resolveDenom = object.resolve_denom; + } return message; }, toAmino(message: QueryAllBalancesRequest): QueryAllBalancesRequestAmino { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + obj.resolve_denom = message.resolveDenom === false ? undefined : message.resolveDenom; return obj; }, fromAminoMsg(object: QueryAllBalancesRequestAminoMsg): QueryAllBalancesRequest { @@ -1070,28 +1300,35 @@ export const QuerySpendableBalancesResponse = { }; } }; -function createBaseQueryTotalSupplyRequest(): QueryTotalSupplyRequest { +function createBaseQuerySpendableBalanceByDenomRequest(): QuerySpendableBalanceByDenomRequest { return { - pagination: undefined + address: "", + denom: "" }; } -export const QueryTotalSupplyRequest = { - typeUrl: "/cosmos.bank.v1beta1.QueryTotalSupplyRequest", - encode(message: QueryTotalSupplyRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.pagination !== undefined) { - PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); +export const QuerySpendableBalanceByDenomRequest = { + typeUrl: "/cosmos.bank.v1beta1.QuerySpendableBalanceByDenomRequest", + encode(message: QuerySpendableBalanceByDenomRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.denom !== "") { + writer.uint32(18).string(message.denom); } return writer; }, - decode(input: BinaryReader | Uint8Array, length?: number): QueryTotalSupplyRequest { + decode(input: BinaryReader | Uint8Array, length?: number): QuerySpendableBalanceByDenomRequest { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryTotalSupplyRequest(); + const message = createBaseQuerySpendableBalanceByDenomRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.pagination = PageRequest.decode(reader, reader.uint32()); + message.address = reader.string(); + break; + case 2: + message.denom = reader.string(); break; default: reader.skipType(tag & 7); @@ -1100,74 +1337,72 @@ export const QueryTotalSupplyRequest = { } return message; }, - fromPartial(object: Partial): QueryTotalSupplyRequest { - const message = createBaseQueryTotalSupplyRequest(); - message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + fromPartial(object: Partial): QuerySpendableBalanceByDenomRequest { + const message = createBaseQuerySpendableBalanceByDenomRequest(); + message.address = object.address ?? ""; + message.denom = object.denom ?? ""; return message; }, - fromAmino(object: QueryTotalSupplyRequestAmino): QueryTotalSupplyRequest { - const message = createBaseQueryTotalSupplyRequest(); - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageRequest.fromAmino(object.pagination); + fromAmino(object: QuerySpendableBalanceByDenomRequestAmino): QuerySpendableBalanceByDenomRequest { + const message = createBaseQuerySpendableBalanceByDenomRequest(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; } return message; }, - toAmino(message: QueryTotalSupplyRequest): QueryTotalSupplyRequestAmino { + toAmino(message: QuerySpendableBalanceByDenomRequest): QuerySpendableBalanceByDenomRequestAmino { const obj: any = {}; - obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + obj.address = message.address === "" ? undefined : message.address; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, - fromAminoMsg(object: QueryTotalSupplyRequestAminoMsg): QueryTotalSupplyRequest { - return QueryTotalSupplyRequest.fromAmino(object.value); + fromAminoMsg(object: QuerySpendableBalanceByDenomRequestAminoMsg): QuerySpendableBalanceByDenomRequest { + return QuerySpendableBalanceByDenomRequest.fromAmino(object.value); }, - toAminoMsg(message: QueryTotalSupplyRequest): QueryTotalSupplyRequestAminoMsg { + toAminoMsg(message: QuerySpendableBalanceByDenomRequest): QuerySpendableBalanceByDenomRequestAminoMsg { return { - type: "cosmos-sdk/QueryTotalSupplyRequest", - value: QueryTotalSupplyRequest.toAmino(message) + type: "cosmos-sdk/QuerySpendableBalanceByDenomRequest", + value: QuerySpendableBalanceByDenomRequest.toAmino(message) }; }, - fromProtoMsg(message: QueryTotalSupplyRequestProtoMsg): QueryTotalSupplyRequest { - return QueryTotalSupplyRequest.decode(message.value); + fromProtoMsg(message: QuerySpendableBalanceByDenomRequestProtoMsg): QuerySpendableBalanceByDenomRequest { + return QuerySpendableBalanceByDenomRequest.decode(message.value); }, - toProto(message: QueryTotalSupplyRequest): Uint8Array { - return QueryTotalSupplyRequest.encode(message).finish(); + toProto(message: QuerySpendableBalanceByDenomRequest): Uint8Array { + return QuerySpendableBalanceByDenomRequest.encode(message).finish(); }, - toProtoMsg(message: QueryTotalSupplyRequest): QueryTotalSupplyRequestProtoMsg { + toProtoMsg(message: QuerySpendableBalanceByDenomRequest): QuerySpendableBalanceByDenomRequestProtoMsg { return { - typeUrl: "/cosmos.bank.v1beta1.QueryTotalSupplyRequest", - value: QueryTotalSupplyRequest.encode(message).finish() + typeUrl: "/cosmos.bank.v1beta1.QuerySpendableBalanceByDenomRequest", + value: QuerySpendableBalanceByDenomRequest.encode(message).finish() }; } }; -function createBaseQueryTotalSupplyResponse(): QueryTotalSupplyResponse { +function createBaseQuerySpendableBalanceByDenomResponse(): QuerySpendableBalanceByDenomResponse { return { - supply: [], - pagination: undefined + balance: undefined }; } -export const QueryTotalSupplyResponse = { - typeUrl: "/cosmos.bank.v1beta1.QueryTotalSupplyResponse", - encode(message: QueryTotalSupplyResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - for (const v of message.supply) { - Coin.encode(v!, writer.uint32(10).fork()).ldelim(); - } - if (message.pagination !== undefined) { - PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); +export const QuerySpendableBalanceByDenomResponse = { + typeUrl: "/cosmos.bank.v1beta1.QuerySpendableBalanceByDenomResponse", + encode(message: QuerySpendableBalanceByDenomResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.balance !== undefined) { + Coin.encode(message.balance, writer.uint32(10).fork()).ldelim(); } return writer; }, - decode(input: BinaryReader | Uint8Array, length?: number): QueryTotalSupplyResponse { + decode(input: BinaryReader | Uint8Array, length?: number): QuerySpendableBalanceByDenomResponse { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryTotalSupplyResponse(); + const message = createBaseQuerySpendableBalanceByDenomResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.supply.push(Coin.decode(reader, reader.uint32())); - break; - case 2: - message.pagination = PageResponse.decode(reader, reader.uint32()); + message.balance = Coin.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -1176,34 +1411,179 @@ export const QueryTotalSupplyResponse = { } return message; }, - fromPartial(object: Partial): QueryTotalSupplyResponse { - const message = createBaseQueryTotalSupplyResponse(); - message.supply = object.supply?.map(e => Coin.fromPartial(e)) || []; - message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + fromPartial(object: Partial): QuerySpendableBalanceByDenomResponse { + const message = createBaseQuerySpendableBalanceByDenomResponse(); + message.balance = object.balance !== undefined && object.balance !== null ? Coin.fromPartial(object.balance) : undefined; return message; }, - fromAmino(object: QueryTotalSupplyResponseAmino): QueryTotalSupplyResponse { - const message = createBaseQueryTotalSupplyResponse(); - message.supply = object.supply?.map(e => Coin.fromAmino(e)) || []; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageResponse.fromAmino(object.pagination); + fromAmino(object: QuerySpendableBalanceByDenomResponseAmino): QuerySpendableBalanceByDenomResponse { + const message = createBaseQuerySpendableBalanceByDenomResponse(); + if (object.balance !== undefined && object.balance !== null) { + message.balance = Coin.fromAmino(object.balance); } return message; }, - toAmino(message: QueryTotalSupplyResponse): QueryTotalSupplyResponseAmino { + toAmino(message: QuerySpendableBalanceByDenomResponse): QuerySpendableBalanceByDenomResponseAmino { const obj: any = {}; - if (message.supply) { - obj.supply = message.supply.map(e => e ? Coin.toAmino(e) : undefined); - } else { - obj.supply = message.supply; - } - obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + obj.balance = message.balance ? Coin.toAmino(message.balance) : undefined; return obj; }, - fromAminoMsg(object: QueryTotalSupplyResponseAminoMsg): QueryTotalSupplyResponse { - return QueryTotalSupplyResponse.fromAmino(object.value); + fromAminoMsg(object: QuerySpendableBalanceByDenomResponseAminoMsg): QuerySpendableBalanceByDenomResponse { + return QuerySpendableBalanceByDenomResponse.fromAmino(object.value); }, - toAminoMsg(message: QueryTotalSupplyResponse): QueryTotalSupplyResponseAminoMsg { + toAminoMsg(message: QuerySpendableBalanceByDenomResponse): QuerySpendableBalanceByDenomResponseAminoMsg { + return { + type: "cosmos-sdk/QuerySpendableBalanceByDenomResponse", + value: QuerySpendableBalanceByDenomResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QuerySpendableBalanceByDenomResponseProtoMsg): QuerySpendableBalanceByDenomResponse { + return QuerySpendableBalanceByDenomResponse.decode(message.value); + }, + toProto(message: QuerySpendableBalanceByDenomResponse): Uint8Array { + return QuerySpendableBalanceByDenomResponse.encode(message).finish(); + }, + toProtoMsg(message: QuerySpendableBalanceByDenomResponse): QuerySpendableBalanceByDenomResponseProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QuerySpendableBalanceByDenomResponse", + value: QuerySpendableBalanceByDenomResponse.encode(message).finish() + }; + } +}; +function createBaseQueryTotalSupplyRequest(): QueryTotalSupplyRequest { + return { + pagination: undefined + }; +} +export const QueryTotalSupplyRequest = { + typeUrl: "/cosmos.bank.v1beta1.QueryTotalSupplyRequest", + encode(message: QueryTotalSupplyRequest, 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): QueryTotalSupplyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTotalSupplyRequest(); + 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; + }, + fromPartial(object: Partial): QueryTotalSupplyRequest { + const message = createBaseQueryTotalSupplyRequest(); + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryTotalSupplyRequestAmino): QueryTotalSupplyRequest { + const message = createBaseQueryTotalSupplyRequest(); + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryTotalSupplyRequest): QueryTotalSupplyRequestAmino { + const obj: any = {}; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryTotalSupplyRequestAminoMsg): QueryTotalSupplyRequest { + return QueryTotalSupplyRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryTotalSupplyRequest): QueryTotalSupplyRequestAminoMsg { + return { + type: "cosmos-sdk/QueryTotalSupplyRequest", + value: QueryTotalSupplyRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryTotalSupplyRequestProtoMsg): QueryTotalSupplyRequest { + return QueryTotalSupplyRequest.decode(message.value); + }, + toProto(message: QueryTotalSupplyRequest): Uint8Array { + return QueryTotalSupplyRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryTotalSupplyRequest): QueryTotalSupplyRequestProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QueryTotalSupplyRequest", + value: QueryTotalSupplyRequest.encode(message).finish() + }; + } +}; +function createBaseQueryTotalSupplyResponse(): QueryTotalSupplyResponse { + return { + supply: [], + pagination: undefined + }; +} +export const QueryTotalSupplyResponse = { + typeUrl: "/cosmos.bank.v1beta1.QueryTotalSupplyResponse", + encode(message: QueryTotalSupplyResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.supply) { + Coin.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): QueryTotalSupplyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTotalSupplyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.supply.push(Coin.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryTotalSupplyResponse { + const message = createBaseQueryTotalSupplyResponse(); + message.supply = object.supply?.map(e => Coin.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryTotalSupplyResponseAmino): QueryTotalSupplyResponse { + const message = createBaseQueryTotalSupplyResponse(); + message.supply = object.supply?.map(e => Coin.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryTotalSupplyResponse): QueryTotalSupplyResponseAmino { + const obj: any = {}; + if (message.supply) { + obj.supply = message.supply.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.supply = message.supply; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryTotalSupplyResponseAminoMsg): QueryTotalSupplyResponse { + return QueryTotalSupplyResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryTotalSupplyResponse): QueryTotalSupplyResponseAminoMsg { return { type: "cosmos-sdk/QueryTotalSupplyResponse", value: QueryTotalSupplyResponse.toAmino(message) @@ -1335,7 +1715,7 @@ export const QuerySupplyOfResponse = { }, toAmino(message: QuerySupplyOfResponse): QuerySupplyOfResponseAmino { const obj: any = {}; - obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; + obj.amount = message.amount ? Coin.toAmino(message.amount) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromAminoMsg(object: QuerySupplyOfResponseAminoMsg): QuerySupplyOfResponse { @@ -1460,7 +1840,7 @@ export const QueryParamsResponse = { }, toAmino(message: QueryParamsResponse): QueryParamsResponseAmino { const obj: any = {}; - obj.params = message.params ? Params.toAmino(message.params) : undefined; + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); return obj; }, fromAminoMsg(object: QueryParamsResponseAminoMsg): QueryParamsResponse { @@ -1750,7 +2130,7 @@ export const QueryDenomMetadataResponse = { }, toAmino(message: QueryDenomMetadataResponse): QueryDenomMetadataResponseAmino { const obj: any = {}; - obj.metadata = message.metadata ? Metadata.toAmino(message.metadata) : undefined; + obj.metadata = message.metadata ? Metadata.toAmino(message.metadata) : Metadata.toAmino(Metadata.fromPartial({})); return obj; }, fromAminoMsg(object: QueryDenomMetadataResponseAminoMsg): QueryDenomMetadataResponse { @@ -1775,6 +2155,144 @@ export const QueryDenomMetadataResponse = { }; } }; +function createBaseQueryDenomMetadataByQueryStringRequest(): QueryDenomMetadataByQueryStringRequest { + return { + denom: "" + }; +} +export const QueryDenomMetadataByQueryStringRequest = { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomMetadataByQueryStringRequest", + encode(message: QueryDenomMetadataByQueryStringRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomMetadataByQueryStringRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomMetadataByQueryStringRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.denom = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryDenomMetadataByQueryStringRequest { + const message = createBaseQueryDenomMetadataByQueryStringRequest(); + message.denom = object.denom ?? ""; + return message; + }, + fromAmino(object: QueryDenomMetadataByQueryStringRequestAmino): QueryDenomMetadataByQueryStringRequest { + const message = createBaseQueryDenomMetadataByQueryStringRequest(); + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } + return message; + }, + toAmino(message: QueryDenomMetadataByQueryStringRequest): QueryDenomMetadataByQueryStringRequestAmino { + const obj: any = {}; + obj.denom = message.denom === "" ? undefined : message.denom; + return obj; + }, + fromAminoMsg(object: QueryDenomMetadataByQueryStringRequestAminoMsg): QueryDenomMetadataByQueryStringRequest { + return QueryDenomMetadataByQueryStringRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryDenomMetadataByQueryStringRequest): QueryDenomMetadataByQueryStringRequestAminoMsg { + return { + type: "cosmos-sdk/QueryDenomMetadataByQueryStringRequest", + value: QueryDenomMetadataByQueryStringRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDenomMetadataByQueryStringRequestProtoMsg): QueryDenomMetadataByQueryStringRequest { + return QueryDenomMetadataByQueryStringRequest.decode(message.value); + }, + toProto(message: QueryDenomMetadataByQueryStringRequest): Uint8Array { + return QueryDenomMetadataByQueryStringRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryDenomMetadataByQueryStringRequest): QueryDenomMetadataByQueryStringRequestProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomMetadataByQueryStringRequest", + value: QueryDenomMetadataByQueryStringRequest.encode(message).finish() + }; + } +}; +function createBaseQueryDenomMetadataByQueryStringResponse(): QueryDenomMetadataByQueryStringResponse { + return { + metadata: Metadata.fromPartial({}) + }; +} +export const QueryDenomMetadataByQueryStringResponse = { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomMetadataByQueryStringResponse", + encode(message: QueryDenomMetadataByQueryStringResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.metadata !== undefined) { + Metadata.encode(message.metadata, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomMetadataByQueryStringResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomMetadataByQueryStringResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.metadata = Metadata.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryDenomMetadataByQueryStringResponse { + const message = createBaseQueryDenomMetadataByQueryStringResponse(); + message.metadata = object.metadata !== undefined && object.metadata !== null ? Metadata.fromPartial(object.metadata) : undefined; + return message; + }, + fromAmino(object: QueryDenomMetadataByQueryStringResponseAmino): QueryDenomMetadataByQueryStringResponse { + const message = createBaseQueryDenomMetadataByQueryStringResponse(); + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = Metadata.fromAmino(object.metadata); + } + return message; + }, + toAmino(message: QueryDenomMetadataByQueryStringResponse): QueryDenomMetadataByQueryStringResponseAmino { + const obj: any = {}; + obj.metadata = message.metadata ? Metadata.toAmino(message.metadata) : Metadata.toAmino(Metadata.fromPartial({})); + return obj; + }, + fromAminoMsg(object: QueryDenomMetadataByQueryStringResponseAminoMsg): QueryDenomMetadataByQueryStringResponse { + return QueryDenomMetadataByQueryStringResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryDenomMetadataByQueryStringResponse): QueryDenomMetadataByQueryStringResponseAminoMsg { + return { + type: "cosmos-sdk/QueryDenomMetadataByQueryStringResponse", + value: QueryDenomMetadataByQueryStringResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDenomMetadataByQueryStringResponseProtoMsg): QueryDenomMetadataByQueryStringResponse { + return QueryDenomMetadataByQueryStringResponse.decode(message.value); + }, + toProto(message: QueryDenomMetadataByQueryStringResponse): Uint8Array { + return QueryDenomMetadataByQueryStringResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryDenomMetadataByQueryStringResponse): QueryDenomMetadataByQueryStringResponseProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomMetadataByQueryStringResponse", + value: QueryDenomMetadataByQueryStringResponse.encode(message).finish() + }; + } +}; function createBaseQueryDenomOwnersRequest(): QueryDenomOwnersRequest { return { denom: "", @@ -1912,7 +2430,7 @@ export const DenomOwner = { toAmino(message: DenomOwner): DenomOwnerAmino { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; - obj.balance = message.balance ? Coin.toAmino(message.balance) : undefined; + obj.balance = message.balance ? Coin.toAmino(message.balance) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromAminoMsg(object: DenomOwnerAminoMsg): DenomOwner { @@ -2019,4 +2537,334 @@ export const QueryDenomOwnersResponse = { value: QueryDenomOwnersResponse.encode(message).finish() }; } +}; +function createBaseQueryDenomOwnersByQueryRequest(): QueryDenomOwnersByQueryRequest { + return { + denom: "", + pagination: undefined + }; +} +export const QueryDenomOwnersByQueryRequest = { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomOwnersByQueryRequest", + encode(message: QueryDenomOwnersByQueryRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomOwnersByQueryRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomOwnersByQueryRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.denom = reader.string(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryDenomOwnersByQueryRequest { + const message = createBaseQueryDenomOwnersByQueryRequest(); + message.denom = object.denom ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryDenomOwnersByQueryRequestAmino): QueryDenomOwnersByQueryRequest { + const message = createBaseQueryDenomOwnersByQueryRequest(); + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryDenomOwnersByQueryRequest): QueryDenomOwnersByQueryRequestAmino { + const obj: any = {}; + obj.denom = message.denom === "" ? undefined : message.denom; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryDenomOwnersByQueryRequestAminoMsg): QueryDenomOwnersByQueryRequest { + return QueryDenomOwnersByQueryRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryDenomOwnersByQueryRequest): QueryDenomOwnersByQueryRequestAminoMsg { + return { + type: "cosmos-sdk/QueryDenomOwnersByQueryRequest", + value: QueryDenomOwnersByQueryRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDenomOwnersByQueryRequestProtoMsg): QueryDenomOwnersByQueryRequest { + return QueryDenomOwnersByQueryRequest.decode(message.value); + }, + toProto(message: QueryDenomOwnersByQueryRequest): Uint8Array { + return QueryDenomOwnersByQueryRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryDenomOwnersByQueryRequest): QueryDenomOwnersByQueryRequestProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomOwnersByQueryRequest", + value: QueryDenomOwnersByQueryRequest.encode(message).finish() + }; + } +}; +function createBaseQueryDenomOwnersByQueryResponse(): QueryDenomOwnersByQueryResponse { + return { + denomOwners: [], + pagination: undefined + }; +} +export const QueryDenomOwnersByQueryResponse = { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomOwnersByQueryResponse", + encode(message: QueryDenomOwnersByQueryResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.denomOwners) { + DenomOwner.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): QueryDenomOwnersByQueryResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomOwnersByQueryResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.denomOwners.push(DenomOwner.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryDenomOwnersByQueryResponse { + const message = createBaseQueryDenomOwnersByQueryResponse(); + message.denomOwners = object.denomOwners?.map(e => DenomOwner.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryDenomOwnersByQueryResponseAmino): QueryDenomOwnersByQueryResponse { + const message = createBaseQueryDenomOwnersByQueryResponse(); + message.denomOwners = object.denom_owners?.map(e => DenomOwner.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryDenomOwnersByQueryResponse): QueryDenomOwnersByQueryResponseAmino { + const obj: any = {}; + if (message.denomOwners) { + obj.denom_owners = message.denomOwners.map(e => e ? DenomOwner.toAmino(e) : undefined); + } else { + obj.denom_owners = message.denomOwners; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryDenomOwnersByQueryResponseAminoMsg): QueryDenomOwnersByQueryResponse { + return QueryDenomOwnersByQueryResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryDenomOwnersByQueryResponse): QueryDenomOwnersByQueryResponseAminoMsg { + return { + type: "cosmos-sdk/QueryDenomOwnersByQueryResponse", + value: QueryDenomOwnersByQueryResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDenomOwnersByQueryResponseProtoMsg): QueryDenomOwnersByQueryResponse { + return QueryDenomOwnersByQueryResponse.decode(message.value); + }, + toProto(message: QueryDenomOwnersByQueryResponse): Uint8Array { + return QueryDenomOwnersByQueryResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryDenomOwnersByQueryResponse): QueryDenomOwnersByQueryResponseProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomOwnersByQueryResponse", + value: QueryDenomOwnersByQueryResponse.encode(message).finish() + }; + } +}; +function createBaseQuerySendEnabledRequest(): QuerySendEnabledRequest { + return { + denoms: [], + pagination: undefined + }; +} +export const QuerySendEnabledRequest = { + typeUrl: "/cosmos.bank.v1beta1.QuerySendEnabledRequest", + encode(message: QuerySendEnabledRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.denoms) { + writer.uint32(10).string(v!); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(794).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QuerySendEnabledRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySendEnabledRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.denoms.push(reader.string()); + break; + case 99: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QuerySendEnabledRequest { + const message = createBaseQuerySendEnabledRequest(); + message.denoms = object.denoms?.map(e => e) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QuerySendEnabledRequestAmino): QuerySendEnabledRequest { + const message = createBaseQuerySendEnabledRequest(); + message.denoms = object.denoms?.map(e => e) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QuerySendEnabledRequest): QuerySendEnabledRequestAmino { + const obj: any = {}; + if (message.denoms) { + obj.denoms = message.denoms.map(e => e); + } else { + obj.denoms = message.denoms; + } + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QuerySendEnabledRequestAminoMsg): QuerySendEnabledRequest { + return QuerySendEnabledRequest.fromAmino(object.value); + }, + toAminoMsg(message: QuerySendEnabledRequest): QuerySendEnabledRequestAminoMsg { + return { + type: "cosmos-sdk/QuerySendEnabledRequest", + value: QuerySendEnabledRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QuerySendEnabledRequestProtoMsg): QuerySendEnabledRequest { + return QuerySendEnabledRequest.decode(message.value); + }, + toProto(message: QuerySendEnabledRequest): Uint8Array { + return QuerySendEnabledRequest.encode(message).finish(); + }, + toProtoMsg(message: QuerySendEnabledRequest): QuerySendEnabledRequestProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QuerySendEnabledRequest", + value: QuerySendEnabledRequest.encode(message).finish() + }; + } +}; +function createBaseQuerySendEnabledResponse(): QuerySendEnabledResponse { + return { + sendEnabled: [], + pagination: undefined + }; +} +export const QuerySendEnabledResponse = { + typeUrl: "/cosmos.bank.v1beta1.QuerySendEnabledResponse", + encode(message: QuerySendEnabledResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.sendEnabled) { + SendEnabled.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(794).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QuerySendEnabledResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySendEnabledResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sendEnabled.push(SendEnabled.decode(reader, reader.uint32())); + break; + case 99: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QuerySendEnabledResponse { + const message = createBaseQuerySendEnabledResponse(); + message.sendEnabled = object.sendEnabled?.map(e => SendEnabled.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QuerySendEnabledResponseAmino): QuerySendEnabledResponse { + const message = createBaseQuerySendEnabledResponse(); + message.sendEnabled = object.send_enabled?.map(e => SendEnabled.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QuerySendEnabledResponse): QuerySendEnabledResponseAmino { + const obj: any = {}; + if (message.sendEnabled) { + obj.send_enabled = message.sendEnabled.map(e => e ? SendEnabled.toAmino(e) : undefined); + } else { + obj.send_enabled = message.sendEnabled; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QuerySendEnabledResponseAminoMsg): QuerySendEnabledResponse { + return QuerySendEnabledResponse.fromAmino(object.value); + }, + toAminoMsg(message: QuerySendEnabledResponse): QuerySendEnabledResponseAminoMsg { + return { + type: "cosmos-sdk/QuerySendEnabledResponse", + value: QuerySendEnabledResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QuerySendEnabledResponseProtoMsg): QuerySendEnabledResponse { + return QuerySendEnabledResponse.decode(message.value); + }, + toProto(message: QuerySendEnabledResponse): Uint8Array { + return QuerySendEnabledResponse.encode(message).finish(); + }, + toProtoMsg(message: QuerySendEnabledResponse): QuerySendEnabledResponseProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QuerySendEnabledResponse", + value: QuerySendEnabledResponse.encode(message).finish() + }; + } }; \ No newline at end of file diff --git a/packages/api/src/cosmos/bank/v1beta1/tx.amino.ts b/packages/api/src/cosmos/bank/v1beta1/tx.amino.ts index 340a07fc..e1b950a7 100644 --- a/packages/api/src/cosmos/bank/v1beta1/tx.amino.ts +++ b/packages/api/src/cosmos/bank/v1beta1/tx.amino.ts @@ -1,5 +1,5 @@ //@ts-nocheck -import { MsgSend, MsgMultiSend } from "./tx"; +import { MsgSend, MsgMultiSend, MsgUpdateParams, MsgSetSendEnabled } from "./tx"; export const AminoConverter = { "/cosmos.bank.v1beta1.MsgSend": { aminoType: "cosmos-sdk/MsgSend", @@ -10,5 +10,15 @@ export const AminoConverter = { aminoType: "cosmos-sdk/MsgMultiSend", toAmino: MsgMultiSend.toAmino, fromAmino: MsgMultiSend.fromAmino + }, + "/cosmos.bank.v1beta1.MsgUpdateParams": { + aminoType: "cosmos-sdk/x/bank/MsgUpdateParams", + toAmino: MsgUpdateParams.toAmino, + fromAmino: MsgUpdateParams.fromAmino + }, + "/cosmos.bank.v1beta1.MsgSetSendEnabled": { + aminoType: "cosmos-sdk/MsgSetSendEnabled", + toAmino: MsgSetSendEnabled.toAmino, + fromAmino: MsgSetSendEnabled.fromAmino } }; \ No newline at end of file diff --git a/packages/api/src/cosmos/bank/v1beta1/tx.registry.ts b/packages/api/src/cosmos/bank/v1beta1/tx.registry.ts index 716f9d0d..33b6bb81 100644 --- a/packages/api/src/cosmos/bank/v1beta1/tx.registry.ts +++ b/packages/api/src/cosmos/bank/v1beta1/tx.registry.ts @@ -1,7 +1,7 @@ //@ts-nocheck import { GeneratedType, Registry } from "@cosmjs/proto-signing"; -import { MsgSend, MsgMultiSend } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.bank.v1beta1.MsgSend", MsgSend], ["/cosmos.bank.v1beta1.MsgMultiSend", MsgMultiSend]]; +import { MsgSend, MsgMultiSend, MsgUpdateParams, MsgSetSendEnabled } from "./tx"; +export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.bank.v1beta1.MsgSend", MsgSend], ["/cosmos.bank.v1beta1.MsgMultiSend", MsgMultiSend], ["/cosmos.bank.v1beta1.MsgUpdateParams", MsgUpdateParams], ["/cosmos.bank.v1beta1.MsgSetSendEnabled", MsgSetSendEnabled]]; export const load = (protoRegistry: Registry) => { registry.forEach(([typeUrl, mod]) => { protoRegistry.register(typeUrl, mod); @@ -20,6 +20,18 @@ export const MessageComposer = { typeUrl: "/cosmos.bank.v1beta1.MsgMultiSend", value: MsgMultiSend.encode(value).finish() }; + }, + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/cosmos.bank.v1beta1.MsgUpdateParams", + value: MsgUpdateParams.encode(value).finish() + }; + }, + setSendEnabled(value: MsgSetSendEnabled) { + return { + typeUrl: "/cosmos.bank.v1beta1.MsgSetSendEnabled", + value: MsgSetSendEnabled.encode(value).finish() + }; } }, withTypeUrl: { @@ -34,6 +46,18 @@ export const MessageComposer = { typeUrl: "/cosmos.bank.v1beta1.MsgMultiSend", value }; + }, + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/cosmos.bank.v1beta1.MsgUpdateParams", + value + }; + }, + setSendEnabled(value: MsgSetSendEnabled) { + return { + typeUrl: "/cosmos.bank.v1beta1.MsgSetSendEnabled", + value + }; } }, fromPartial: { @@ -48,6 +72,18 @@ export const MessageComposer = { typeUrl: "/cosmos.bank.v1beta1.MsgMultiSend", value: MsgMultiSend.fromPartial(value) }; + }, + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/cosmos.bank.v1beta1.MsgUpdateParams", + value: MsgUpdateParams.fromPartial(value) + }; + }, + setSendEnabled(value: MsgSetSendEnabled) { + return { + typeUrl: "/cosmos.bank.v1beta1.MsgSetSendEnabled", + value: MsgSetSendEnabled.fromPartial(value) + }; } } }; \ No newline at end of file diff --git a/packages/api/src/cosmos/bank/v1beta1/tx.rpc.msg.ts b/packages/api/src/cosmos/bank/v1beta1/tx.rpc.msg.ts index 31fc997d..69b5974e 100644 --- a/packages/api/src/cosmos/bank/v1beta1/tx.rpc.msg.ts +++ b/packages/api/src/cosmos/bank/v1beta1/tx.rpc.msg.ts @@ -1,13 +1,25 @@ //@ts-nocheck import { Rpc } from "../../../helpers"; import { BinaryReader } from "../../../binary"; -import { MsgSend, MsgSendResponse, MsgMultiSend, MsgMultiSendResponse } from "./tx"; +import { MsgSend, MsgSendResponse, MsgMultiSend, MsgMultiSendResponse, MsgUpdateParams, MsgUpdateParamsResponse, MsgSetSendEnabled, MsgSetSendEnabledResponse } from "./tx"; /** Msg defines the bank Msg service. */ export interface Msg { /** Send defines a method for sending coins from one account to another account. */ send(request: MsgSend): Promise; /** MultiSend defines a method for sending coins from some accounts to other accounts. */ multiSend(request: MsgMultiSend): Promise; + /** + * UpdateParams defines a governance operation for updating the x/bank module parameters. + * The authority is defined in the keeper. + */ + updateParams(request: MsgUpdateParams): Promise; + /** + * SetSendEnabled is a governance operation for setting the SendEnabled flag + * on any number of Denoms. Only the entries to add or update should be + * included. Entries that already exist in the store, but that aren't + * included in this message, will be left unchanged. + */ + setSendEnabled(request: MsgSetSendEnabled): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: Rpc; @@ -15,6 +27,8 @@ export class MsgClientImpl implements Msg { this.rpc = rpc; this.send = this.send.bind(this); this.multiSend = this.multiSend.bind(this); + this.updateParams = this.updateParams.bind(this); + this.setSendEnabled = this.setSendEnabled.bind(this); } send(request: MsgSend): Promise { const data = MsgSend.encode(request).finish(); @@ -26,4 +40,14 @@ export class MsgClientImpl implements Msg { const promise = this.rpc.request("cosmos.bank.v1beta1.Msg", "MultiSend", data); return promise.then(data => MsgMultiSendResponse.decode(new BinaryReader(data))); } + updateParams(request: MsgUpdateParams): Promise { + const data = MsgUpdateParams.encode(request).finish(); + const promise = this.rpc.request("cosmos.bank.v1beta1.Msg", "UpdateParams", data); + return promise.then(data => MsgUpdateParamsResponse.decode(new BinaryReader(data))); + } + setSendEnabled(request: MsgSetSendEnabled): Promise { + const data = MsgSetSendEnabled.encode(request).finish(); + const promise = this.rpc.request("cosmos.bank.v1beta1.Msg", "SetSendEnabled", data); + return promise.then(data => MsgSetSendEnabledResponse.decode(new BinaryReader(data))); + } } \ No newline at end of file diff --git a/packages/api/src/cosmos/bank/v1beta1/tx.ts b/packages/api/src/cosmos/bank/v1beta1/tx.ts index 6349f1de..21ef8e93 100644 --- a/packages/api/src/cosmos/bank/v1beta1/tx.ts +++ b/packages/api/src/cosmos/bank/v1beta1/tx.ts @@ -1,6 +1,6 @@ //@ts-nocheck import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; -import { Input, InputAmino, InputSDKType, Output, OutputAmino, OutputSDKType } from "./bank"; +import { Input, InputAmino, InputSDKType, Output, OutputAmino, OutputSDKType, Params, ParamsAmino, ParamsSDKType, SendEnabled, SendEnabledAmino, SendEnabledSDKType } from "./bank"; import { BinaryReader, BinaryWriter } from "../../../binary"; /** MsgSend represents a message to send coins from one account to another. */ export interface MsgSend { @@ -16,7 +16,7 @@ export interface MsgSendProtoMsg { export interface MsgSendAmino { from_address?: string; to_address?: string; - amount?: CoinAmino[]; + amount: CoinAmino[]; } export interface MsgSendAminoMsg { type: "cosmos-sdk/MsgSend"; @@ -44,6 +44,10 @@ export interface MsgSendResponseAminoMsg { export interface MsgSendResponseSDKType {} /** MsgMultiSend represents an arbitrary multi-in, multi-out send message. */ export interface MsgMultiSend { + /** + * Inputs, despite being `repeated`, only allows one sender input. This is + * checked in MsgMultiSend's ValidateBasic. + */ inputs: Input[]; outputs: Output[]; } @@ -53,8 +57,12 @@ export interface MsgMultiSendProtoMsg { } /** MsgMultiSend represents an arbitrary multi-in, multi-out send message. */ export interface MsgMultiSendAmino { - inputs?: InputAmino[]; - outputs?: OutputAmino[]; + /** + * Inputs, despite being `repeated`, only allows one sender input. This is + * checked in MsgMultiSend's ValidateBasic. + */ + inputs: InputAmino[]; + outputs: OutputAmino[]; } export interface MsgMultiSendAminoMsg { type: "cosmos-sdk/MsgMultiSend"; @@ -79,6 +87,138 @@ export interface MsgMultiSendResponseAminoMsg { } /** MsgMultiSendResponse defines the Msg/MultiSend response type. */ export interface MsgMultiSendResponseSDKType {} +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/bank parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params; +} +export interface MsgUpdateParamsProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.MsgUpdateParams"; + value: Uint8Array; +} +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParamsAmino { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority?: string; + /** + * params defines the x/bank parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: ParamsAmino; +} +export interface MsgUpdateParamsAminoMsg { + type: "cosmos-sdk/x/bank/MsgUpdateParams"; + value: MsgUpdateParamsAmino; +} +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParamsSDKType { + authority: string; + params: ParamsSDKType; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponse {} +export interface MsgUpdateParamsResponseProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.MsgUpdateParamsResponse"; + value: Uint8Array; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponseAmino {} +export interface MsgUpdateParamsResponseAminoMsg { + type: "cosmos-sdk/MsgUpdateParamsResponse"; + value: MsgUpdateParamsResponseAmino; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponseSDKType {} +/** + * MsgSetSendEnabled is the Msg/SetSendEnabled request type. + * + * Only entries to add/update/delete need to be included. + * Existing SendEnabled entries that are not included in this + * message are left unchanged. + */ +export interface MsgSetSendEnabled { + /** authority is the address that controls the module. */ + authority: string; + /** send_enabled is the list of entries to add or update. */ + sendEnabled: SendEnabled[]; + /** + * use_default_for is a list of denoms that should use the params.default_send_enabled value. + * Denoms listed here will have their SendEnabled entries deleted. + * If a denom is included that doesn't have a SendEnabled entry, + * it will be ignored. + */ + useDefaultFor: string[]; +} +export interface MsgSetSendEnabledProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.MsgSetSendEnabled"; + value: Uint8Array; +} +/** + * MsgSetSendEnabled is the Msg/SetSendEnabled request type. + * + * Only entries to add/update/delete need to be included. + * Existing SendEnabled entries that are not included in this + * message are left unchanged. + */ +export interface MsgSetSendEnabledAmino { + /** authority is the address that controls the module. */ + authority?: string; + /** send_enabled is the list of entries to add or update. */ + send_enabled?: SendEnabledAmino[]; + /** + * use_default_for is a list of denoms that should use the params.default_send_enabled value. + * Denoms listed here will have their SendEnabled entries deleted. + * If a denom is included that doesn't have a SendEnabled entry, + * it will be ignored. + */ + use_default_for?: string[]; +} +export interface MsgSetSendEnabledAminoMsg { + type: "cosmos-sdk/MsgSetSendEnabled"; + value: MsgSetSendEnabledAmino; +} +/** + * MsgSetSendEnabled is the Msg/SetSendEnabled request type. + * + * Only entries to add/update/delete need to be included. + * Existing SendEnabled entries that are not included in this + * message are left unchanged. + */ +export interface MsgSetSendEnabledSDKType { + authority: string; + send_enabled: SendEnabledSDKType[]; + use_default_for: string[]; +} +/** MsgSetSendEnabledResponse defines the Msg/SetSendEnabled response type. */ +export interface MsgSetSendEnabledResponse {} +export interface MsgSetSendEnabledResponseProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.MsgSetSendEnabledResponse"; + value: Uint8Array; +} +/** MsgSetSendEnabledResponse defines the Msg/SetSendEnabled response type. */ +export interface MsgSetSendEnabledResponseAmino {} +export interface MsgSetSendEnabledResponseAminoMsg { + type: "cosmos-sdk/MsgSetSendEnabledResponse"; + value: MsgSetSendEnabledResponseAmino; +} +/** MsgSetSendEnabledResponse defines the Msg/SetSendEnabled response type. */ +export interface MsgSetSendEnabledResponseSDKType {} function createBaseMsgSend(): MsgSend { return { fromAddress: "", @@ -370,4 +510,294 @@ export const MsgMultiSendResponse = { value: MsgMultiSendResponse.encode(message).finish() }; } +}; +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { + authority: "", + params: Params.fromPartial({}) + }; +} +export const MsgUpdateParams = { + typeUrl: "/cosmos.bank.v1beta1.MsgUpdateParams", + encode(message: MsgUpdateParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + message.authority = object.authority ?? ""; + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, + fromAmino(object: MsgUpdateParamsAmino): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: MsgUpdateParams): MsgUpdateParamsAmino { + const obj: any = {}; + obj.authority = message.authority === "" ? undefined : message.authority; + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); + return obj; + }, + fromAminoMsg(object: MsgUpdateParamsAminoMsg): MsgUpdateParams { + return MsgUpdateParams.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateParams): MsgUpdateParamsAminoMsg { + return { + type: "cosmos-sdk/x/bank/MsgUpdateParams", + value: MsgUpdateParams.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateParamsProtoMsg): MsgUpdateParams { + return MsgUpdateParams.decode(message.value); + }, + toProto(message: MsgUpdateParams): Uint8Array { + return MsgUpdateParams.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateParams): MsgUpdateParamsProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.MsgUpdateParams", + value: MsgUpdateParams.encode(message).finish() + }; + } +}; +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} +export const MsgUpdateParamsResponse = { + typeUrl: "/cosmos.bank.v1beta1.MsgUpdateParamsResponse", + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, + fromAmino(_: MsgUpdateParamsResponseAmino): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, + toAmino(_: MsgUpdateParamsResponse): MsgUpdateParamsResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUpdateParamsResponseAminoMsg): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateParamsResponse): MsgUpdateParamsResponseAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateParamsResponse", + value: MsgUpdateParamsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateParamsResponseProtoMsg): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.decode(message.value); + }, + toProto(message: MsgUpdateParamsResponse): Uint8Array { + return MsgUpdateParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateParamsResponse): MsgUpdateParamsResponseProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.MsgUpdateParamsResponse", + value: MsgUpdateParamsResponse.encode(message).finish() + }; + } +}; +function createBaseMsgSetSendEnabled(): MsgSetSendEnabled { + return { + authority: "", + sendEnabled: [], + useDefaultFor: [] + }; +} +export const MsgSetSendEnabled = { + typeUrl: "/cosmos.bank.v1beta1.MsgSetSendEnabled", + encode(message: MsgSetSendEnabled, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + for (const v of message.sendEnabled) { + SendEnabled.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.useDefaultFor) { + writer.uint32(26).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgSetSendEnabled { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetSendEnabled(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.sendEnabled.push(SendEnabled.decode(reader, reader.uint32())); + break; + case 3: + message.useDefaultFor.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgSetSendEnabled { + const message = createBaseMsgSetSendEnabled(); + message.authority = object.authority ?? ""; + message.sendEnabled = object.sendEnabled?.map(e => SendEnabled.fromPartial(e)) || []; + message.useDefaultFor = object.useDefaultFor?.map(e => e) || []; + return message; + }, + fromAmino(object: MsgSetSendEnabledAmino): MsgSetSendEnabled { + const message = createBaseMsgSetSendEnabled(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + message.sendEnabled = object.send_enabled?.map(e => SendEnabled.fromAmino(e)) || []; + message.useDefaultFor = object.use_default_for?.map(e => e) || []; + return message; + }, + toAmino(message: MsgSetSendEnabled): MsgSetSendEnabledAmino { + const obj: any = {}; + obj.authority = message.authority === "" ? undefined : message.authority; + if (message.sendEnabled) { + obj.send_enabled = message.sendEnabled.map(e => e ? SendEnabled.toAmino(e) : undefined); + } else { + obj.send_enabled = message.sendEnabled; + } + if (message.useDefaultFor) { + obj.use_default_for = message.useDefaultFor.map(e => e); + } else { + obj.use_default_for = message.useDefaultFor; + } + return obj; + }, + fromAminoMsg(object: MsgSetSendEnabledAminoMsg): MsgSetSendEnabled { + return MsgSetSendEnabled.fromAmino(object.value); + }, + toAminoMsg(message: MsgSetSendEnabled): MsgSetSendEnabledAminoMsg { + return { + type: "cosmos-sdk/MsgSetSendEnabled", + value: MsgSetSendEnabled.toAmino(message) + }; + }, + fromProtoMsg(message: MsgSetSendEnabledProtoMsg): MsgSetSendEnabled { + return MsgSetSendEnabled.decode(message.value); + }, + toProto(message: MsgSetSendEnabled): Uint8Array { + return MsgSetSendEnabled.encode(message).finish(); + }, + toProtoMsg(message: MsgSetSendEnabled): MsgSetSendEnabledProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.MsgSetSendEnabled", + value: MsgSetSendEnabled.encode(message).finish() + }; + } +}; +function createBaseMsgSetSendEnabledResponse(): MsgSetSendEnabledResponse { + return {}; +} +export const MsgSetSendEnabledResponse = { + typeUrl: "/cosmos.bank.v1beta1.MsgSetSendEnabledResponse", + encode(_: MsgSetSendEnabledResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgSetSendEnabledResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetSendEnabledResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): MsgSetSendEnabledResponse { + const message = createBaseMsgSetSendEnabledResponse(); + return message; + }, + fromAmino(_: MsgSetSendEnabledResponseAmino): MsgSetSendEnabledResponse { + const message = createBaseMsgSetSendEnabledResponse(); + return message; + }, + toAmino(_: MsgSetSendEnabledResponse): MsgSetSendEnabledResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgSetSendEnabledResponseAminoMsg): MsgSetSendEnabledResponse { + return MsgSetSendEnabledResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgSetSendEnabledResponse): MsgSetSendEnabledResponseAminoMsg { + return { + type: "cosmos-sdk/MsgSetSendEnabledResponse", + value: MsgSetSendEnabledResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgSetSendEnabledResponseProtoMsg): MsgSetSendEnabledResponse { + return MsgSetSendEnabledResponse.decode(message.value); + }, + toProto(message: MsgSetSendEnabledResponse): Uint8Array { + return MsgSetSendEnabledResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgSetSendEnabledResponse): MsgSetSendEnabledResponseProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.MsgSetSendEnabledResponse", + value: MsgSetSendEnabledResponse.encode(message).finish() + }; + } }; \ No newline at end of file diff --git a/packages/api/src/cosmos/base/abci/v1beta1/abci.ts b/packages/api/src/cosmos/base/abci/v1beta1/abci.ts index 49a0076c..3acc6936 100644 --- a/packages/api/src/cosmos/base/abci/v1beta1/abci.ts +++ b/packages/api/src/cosmos/base/abci/v1beta1/abci.ts @@ -1,6 +1,7 @@ //@ts-nocheck import { Any, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; import { Event, EventAmino, EventSDKType } from "../../../../tendermint/abci/types"; +import { Block, BlockAmino, BlockSDKType } from "../../../../tendermint/types/block"; import { BinaryReader, BinaryWriter } from "../../../../binary"; import { bytesFromBase64, base64FromBytes } from "../../../../helpers"; /** @@ -44,8 +45,6 @@ export interface TxResponse { * these events include those emitted by processing all the messages and those * emitted from the ante. Whereas Logs contains the events, with * additional metadata, emitted only by processing the messages. - * - * Since: cosmos-sdk 0.42.11, 0.44.5, 0.45 */ events: Event[]; } @@ -94,8 +93,6 @@ export interface TxResponseAmino { * these events include those emitted by processing all the messages and those * emitted from the ante. Whereas Logs contains the events, with * additional metadata, emitted only by processing the messages. - * - * Since: cosmos-sdk 0.42.11, 0.44.5, 0.45 */ events?: EventAmino[]; } @@ -264,11 +261,7 @@ export interface Result { * or handler execution. */ events: Event[]; - /** - * msg_responses contains the Msg handler responses type packed in Anys. - * - * Since: cosmos-sdk 0.46 - */ + /** msg_responses contains the Msg handler responses type packed in Anys. */ msgResponses: Any[]; } export interface ResultProtoMsg { @@ -292,11 +285,7 @@ export interface ResultAmino { * or handler execution. */ events?: EventAmino[]; - /** - * msg_responses contains the Msg handler responses type packed in Anys. - * - * Since: cosmos-sdk 0.46 - */ + /** msg_responses contains the Msg handler responses type packed in Anys. */ msg_responses?: AnyAmino[]; } export interface ResultAminoMsg { @@ -386,11 +375,7 @@ export interface TxMsgData { /** data field is deprecated and not populated. */ /** @deprecated */ data: MsgData[]; - /** - * msg_responses contains the Msg handler responses packed into Anys. - * - * Since: cosmos-sdk 0.46 - */ + /** msg_responses contains the Msg handler responses packed into Anys. */ msgResponses: Any[]; } export interface TxMsgDataProtoMsg { @@ -405,11 +390,7 @@ export interface TxMsgDataAmino { /** data field is deprecated and not populated. */ /** @deprecated */ data?: MsgDataAmino[]; - /** - * msg_responses contains the Msg handler responses packed into Anys. - * - * Since: cosmos-sdk 0.46 - */ + /** msg_responses contains the Msg handler responses packed into Anys. */ msg_responses?: AnyAmino[]; } export interface TxMsgDataAminoMsg { @@ -472,6 +453,53 @@ export interface SearchTxsResultSDKType { limit: bigint; txs: TxResponseSDKType[]; } +/** SearchBlocksResult defines a structure for querying blocks pageable */ +export interface SearchBlocksResult { + /** Count of all blocks */ + totalCount: bigint; + /** Count of blocks in current page */ + count: bigint; + /** Index of current page, start from 1 */ + pageNumber: bigint; + /** Count of total pages */ + pageTotal: bigint; + /** Max count blocks per page */ + limit: bigint; + /** List of blocks in current page */ + blocks: Block[]; +} +export interface SearchBlocksResultProtoMsg { + typeUrl: "/cosmos.base.abci.v1beta1.SearchBlocksResult"; + value: Uint8Array; +} +/** SearchBlocksResult defines a structure for querying blocks pageable */ +export interface SearchBlocksResultAmino { + /** Count of all blocks */ + total_count?: string; + /** Count of blocks in current page */ + count?: string; + /** Index of current page, start from 1 */ + page_number?: string; + /** Count of total pages */ + page_total?: string; + /** Max count blocks per page */ + limit?: string; + /** List of blocks in current page */ + blocks?: BlockAmino[]; +} +export interface SearchBlocksResultAminoMsg { + type: "cosmos-sdk/SearchBlocksResult"; + value: SearchBlocksResultAmino; +} +/** SearchBlocksResult defines a structure for querying blocks pageable */ +export interface SearchBlocksResultSDKType { + total_count: bigint; + count: bigint; + page_number: bigint; + page_total: bigint; + limit: bigint; + blocks: BlockSDKType[]; +} function createBaseTxResponse(): TxResponse { return { height: BigInt(0), @@ -1515,4 +1543,135 @@ export const SearchTxsResult = { value: SearchTxsResult.encode(message).finish() }; } +}; +function createBaseSearchBlocksResult(): SearchBlocksResult { + return { + totalCount: BigInt(0), + count: BigInt(0), + pageNumber: BigInt(0), + pageTotal: BigInt(0), + limit: BigInt(0), + blocks: [] + }; +} +export const SearchBlocksResult = { + typeUrl: "/cosmos.base.abci.v1beta1.SearchBlocksResult", + encode(message: SearchBlocksResult, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.totalCount !== BigInt(0)) { + writer.uint32(8).int64(message.totalCount); + } + if (message.count !== BigInt(0)) { + writer.uint32(16).int64(message.count); + } + if (message.pageNumber !== BigInt(0)) { + writer.uint32(24).int64(message.pageNumber); + } + if (message.pageTotal !== BigInt(0)) { + writer.uint32(32).int64(message.pageTotal); + } + if (message.limit !== BigInt(0)) { + writer.uint32(40).int64(message.limit); + } + for (const v of message.blocks) { + Block.encode(v!, writer.uint32(50).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SearchBlocksResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSearchBlocksResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.totalCount = reader.int64(); + break; + case 2: + message.count = reader.int64(); + break; + case 3: + message.pageNumber = reader.int64(); + break; + case 4: + message.pageTotal = reader.int64(); + break; + case 5: + message.limit = reader.int64(); + break; + case 6: + message.blocks.push(Block.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): SearchBlocksResult { + const message = createBaseSearchBlocksResult(); + message.totalCount = object.totalCount !== undefined && object.totalCount !== null ? BigInt(object.totalCount.toString()) : BigInt(0); + message.count = object.count !== undefined && object.count !== null ? BigInt(object.count.toString()) : BigInt(0); + message.pageNumber = object.pageNumber !== undefined && object.pageNumber !== null ? BigInt(object.pageNumber.toString()) : BigInt(0); + message.pageTotal = object.pageTotal !== undefined && object.pageTotal !== null ? BigInt(object.pageTotal.toString()) : BigInt(0); + message.limit = object.limit !== undefined && object.limit !== null ? BigInt(object.limit.toString()) : BigInt(0); + message.blocks = object.blocks?.map(e => Block.fromPartial(e)) || []; + return message; + }, + fromAmino(object: SearchBlocksResultAmino): SearchBlocksResult { + const message = createBaseSearchBlocksResult(); + if (object.total_count !== undefined && object.total_count !== null) { + message.totalCount = BigInt(object.total_count); + } + if (object.count !== undefined && object.count !== null) { + message.count = BigInt(object.count); + } + if (object.page_number !== undefined && object.page_number !== null) { + message.pageNumber = BigInt(object.page_number); + } + if (object.page_total !== undefined && object.page_total !== null) { + message.pageTotal = BigInt(object.page_total); + } + if (object.limit !== undefined && object.limit !== null) { + message.limit = BigInt(object.limit); + } + message.blocks = object.blocks?.map(e => Block.fromAmino(e)) || []; + return message; + }, + toAmino(message: SearchBlocksResult): SearchBlocksResultAmino { + const obj: any = {}; + obj.total_count = message.totalCount !== BigInt(0) ? message.totalCount?.toString() : undefined; + obj.count = message.count !== BigInt(0) ? message.count?.toString() : undefined; + obj.page_number = message.pageNumber !== BigInt(0) ? message.pageNumber?.toString() : undefined; + obj.page_total = message.pageTotal !== BigInt(0) ? message.pageTotal?.toString() : undefined; + obj.limit = message.limit !== BigInt(0) ? message.limit?.toString() : undefined; + if (message.blocks) { + obj.blocks = message.blocks.map(e => e ? Block.toAmino(e) : undefined); + } else { + obj.blocks = message.blocks; + } + return obj; + }, + fromAminoMsg(object: SearchBlocksResultAminoMsg): SearchBlocksResult { + return SearchBlocksResult.fromAmino(object.value); + }, + toAminoMsg(message: SearchBlocksResult): SearchBlocksResultAminoMsg { + return { + type: "cosmos-sdk/SearchBlocksResult", + value: SearchBlocksResult.toAmino(message) + }; + }, + fromProtoMsg(message: SearchBlocksResultProtoMsg): SearchBlocksResult { + return SearchBlocksResult.decode(message.value); + }, + toProto(message: SearchBlocksResult): Uint8Array { + return SearchBlocksResult.encode(message).finish(); + }, + toProtoMsg(message: SearchBlocksResult): SearchBlocksResultProtoMsg { + return { + typeUrl: "/cosmos.base.abci.v1beta1.SearchBlocksResult", + value: SearchBlocksResult.encode(message).finish() + }; + } }; \ No newline at end of file diff --git a/packages/api/src/cosmos/base/node/v1beta1/query.lcd.ts b/packages/api/src/cosmos/base/node/v1beta1/query.lcd.ts index 3e7b6a5f..475b976e 100644 --- a/packages/api/src/cosmos/base/node/v1beta1/query.lcd.ts +++ b/packages/api/src/cosmos/base/node/v1beta1/query.lcd.ts @@ -1,6 +1,6 @@ //@ts-nocheck import { LCDClient } from "@cosmology/lcd"; -import { ConfigRequest, ConfigResponseSDKType } from "./query"; +import { ConfigRequest, ConfigResponseSDKType, StatusRequest, StatusResponseSDKType } from "./query"; export class LCDQueryClient { req: LCDClient; constructor({ @@ -10,10 +10,16 @@ export class LCDQueryClient { }) { this.req = requestClient; this.config = this.config.bind(this); + this.status = this.status.bind(this); } /* Config queries for the operator configuration. */ async config(_params: ConfigRequest = {}): Promise { const endpoint = `cosmos/base/node/v1beta1/config`; return await this.req.get(endpoint); } + /* Status queries for the node status. */ + async status(_params: StatusRequest = {}): Promise { + const endpoint = `cosmos/base/node/v1beta1/status`; + return await this.req.get(endpoint); + } } \ No newline at end of file diff --git a/packages/api/src/cosmos/base/node/v1beta1/query.rpc.Service.ts b/packages/api/src/cosmos/base/node/v1beta1/query.rpc.Service.ts index db6c9533..78dd0657 100644 --- a/packages/api/src/cosmos/base/node/v1beta1/query.rpc.Service.ts +++ b/packages/api/src/cosmos/base/node/v1beta1/query.rpc.Service.ts @@ -2,23 +2,31 @@ import { Rpc } from "../../../../helpers"; import { BinaryReader } from "../../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { ConfigRequest, ConfigResponse } from "./query"; +import { ConfigRequest, ConfigResponse, StatusRequest, StatusResponse } from "./query"; /** Service defines the gRPC querier service for node related queries. */ export interface Service { /** Config queries for the operator configuration. */ config(request?: ConfigRequest): Promise; + /** Status queries for the node status. */ + status(request?: StatusRequest): Promise; } export class ServiceClientImpl implements Service { private readonly rpc: Rpc; constructor(rpc: Rpc) { this.rpc = rpc; this.config = this.config.bind(this); + this.status = this.status.bind(this); } config(request: ConfigRequest = {}): Promise { const data = ConfigRequest.encode(request).finish(); const promise = this.rpc.request("cosmos.base.node.v1beta1.Service", "Config", data); return promise.then(data => ConfigResponse.decode(new BinaryReader(data))); } + status(request: StatusRequest = {}): Promise { + const data = StatusRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.base.node.v1beta1.Service", "Status", data); + return promise.then(data => StatusResponse.decode(new BinaryReader(data))); + } } export const createRpcQueryExtension = (base: QueryClient) => { const rpc = createProtobufRpcClient(base); @@ -26,6 +34,9 @@ export const createRpcQueryExtension = (base: QueryClient) => { return { config(request?: ConfigRequest): Promise { return queryService.config(request); + }, + status(request?: StatusRequest): Promise { + return queryService.status(request); } }; }; \ No newline at end of file diff --git a/packages/api/src/cosmos/base/node/v1beta1/query.ts b/packages/api/src/cosmos/base/node/v1beta1/query.ts index 31aafa61..40409085 100644 --- a/packages/api/src/cosmos/base/node/v1beta1/query.ts +++ b/packages/api/src/cosmos/base/node/v1beta1/query.ts @@ -1,5 +1,7 @@ //@ts-nocheck +import { Timestamp } from "../../../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../../../helpers"; /** ConfigRequest defines the request structure for the Config gRPC query. */ export interface ConfigRequest {} export interface ConfigRequestProtoMsg { @@ -17,6 +19,9 @@ export interface ConfigRequestSDKType {} /** ConfigResponse defines the response structure for the Config gRPC query. */ export interface ConfigResponse { minimumGasPrice: string; + pruningKeepRecent: string; + pruningInterval: string; + haltHeight: bigint; } export interface ConfigResponseProtoMsg { typeUrl: "/cosmos.base.node.v1beta1.ConfigResponse"; @@ -25,6 +30,9 @@ export interface ConfigResponseProtoMsg { /** ConfigResponse defines the response structure for the Config gRPC query. */ export interface ConfigResponseAmino { minimum_gas_price?: string; + pruning_keep_recent?: string; + pruning_interval?: string; + halt_height?: string; } export interface ConfigResponseAminoMsg { type: "cosmos-sdk/ConfigResponse"; @@ -33,6 +41,65 @@ export interface ConfigResponseAminoMsg { /** ConfigResponse defines the response structure for the Config gRPC query. */ export interface ConfigResponseSDKType { minimum_gas_price: string; + pruning_keep_recent: string; + pruning_interval: string; + halt_height: bigint; +} +/** StateRequest defines the request structure for the status of a node. */ +export interface StatusRequest {} +export interface StatusRequestProtoMsg { + typeUrl: "/cosmos.base.node.v1beta1.StatusRequest"; + value: Uint8Array; +} +/** StateRequest defines the request structure for the status of a node. */ +export interface StatusRequestAmino {} +export interface StatusRequestAminoMsg { + type: "cosmos-sdk/StatusRequest"; + value: StatusRequestAmino; +} +/** StateRequest defines the request structure for the status of a node. */ +export interface StatusRequestSDKType {} +/** StateResponse defines the response structure for the status of a node. */ +export interface StatusResponse { + /** earliest block height available in the store */ + earliestStoreHeight: bigint; + /** current block height */ + height: bigint; + /** block height timestamp */ + timestamp?: Date; + /** app hash of the current block */ + appHash: Uint8Array; + /** validator hash provided by the consensus header */ + validatorHash: Uint8Array; +} +export interface StatusResponseProtoMsg { + typeUrl: "/cosmos.base.node.v1beta1.StatusResponse"; + value: Uint8Array; +} +/** StateResponse defines the response structure for the status of a node. */ +export interface StatusResponseAmino { + /** earliest block height available in the store */ + earliest_store_height?: string; + /** current block height */ + height?: string; + /** block height timestamp */ + timestamp?: string; + /** app hash of the current block */ + app_hash?: string; + /** validator hash provided by the consensus header */ + validator_hash?: string; +} +export interface StatusResponseAminoMsg { + type: "cosmos-sdk/StatusResponse"; + value: StatusResponseAmino; +} +/** StateResponse defines the response structure for the status of a node. */ +export interface StatusResponseSDKType { + earliest_store_height: bigint; + height: bigint; + timestamp?: Date; + app_hash: Uint8Array; + validator_hash: Uint8Array; } function createBaseConfigRequest(): ConfigRequest { return {}; @@ -92,7 +159,10 @@ export const ConfigRequest = { }; function createBaseConfigResponse(): ConfigResponse { return { - minimumGasPrice: "" + minimumGasPrice: "", + pruningKeepRecent: "", + pruningInterval: "", + haltHeight: BigInt(0) }; } export const ConfigResponse = { @@ -101,6 +171,15 @@ export const ConfigResponse = { if (message.minimumGasPrice !== "") { writer.uint32(10).string(message.minimumGasPrice); } + if (message.pruningKeepRecent !== "") { + writer.uint32(18).string(message.pruningKeepRecent); + } + if (message.pruningInterval !== "") { + writer.uint32(26).string(message.pruningInterval); + } + if (message.haltHeight !== BigInt(0)) { + writer.uint32(32).uint64(message.haltHeight); + } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): ConfigResponse { @@ -113,6 +192,15 @@ export const ConfigResponse = { case 1: message.minimumGasPrice = reader.string(); break; + case 2: + message.pruningKeepRecent = reader.string(); + break; + case 3: + message.pruningInterval = reader.string(); + break; + case 4: + message.haltHeight = reader.uint64(); + break; default: reader.skipType(tag & 7); break; @@ -123,6 +211,9 @@ export const ConfigResponse = { fromPartial(object: Partial): ConfigResponse { const message = createBaseConfigResponse(); message.minimumGasPrice = object.minimumGasPrice ?? ""; + message.pruningKeepRecent = object.pruningKeepRecent ?? ""; + message.pruningInterval = object.pruningInterval ?? ""; + message.haltHeight = object.haltHeight !== undefined && object.haltHeight !== null ? BigInt(object.haltHeight.toString()) : BigInt(0); return message; }, fromAmino(object: ConfigResponseAmino): ConfigResponse { @@ -130,11 +221,23 @@ export const ConfigResponse = { if (object.minimum_gas_price !== undefined && object.minimum_gas_price !== null) { message.minimumGasPrice = object.minimum_gas_price; } + if (object.pruning_keep_recent !== undefined && object.pruning_keep_recent !== null) { + message.pruningKeepRecent = object.pruning_keep_recent; + } + if (object.pruning_interval !== undefined && object.pruning_interval !== null) { + message.pruningInterval = object.pruning_interval; + } + if (object.halt_height !== undefined && object.halt_height !== null) { + message.haltHeight = BigInt(object.halt_height); + } return message; }, toAmino(message: ConfigResponse): ConfigResponseAmino { const obj: any = {}; obj.minimum_gas_price = message.minimumGasPrice === "" ? undefined : message.minimumGasPrice; + obj.pruning_keep_recent = message.pruningKeepRecent === "" ? undefined : message.pruningKeepRecent; + obj.pruning_interval = message.pruningInterval === "" ? undefined : message.pruningInterval; + obj.halt_height = message.haltHeight !== BigInt(0) ? message.haltHeight?.toString() : undefined; return obj; }, fromAminoMsg(object: ConfigResponseAminoMsg): ConfigResponse { @@ -158,4 +261,177 @@ export const ConfigResponse = { value: ConfigResponse.encode(message).finish() }; } +}; +function createBaseStatusRequest(): StatusRequest { + return {}; +} +export const StatusRequest = { + typeUrl: "/cosmos.base.node.v1beta1.StatusRequest", + encode(_: StatusRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): StatusRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStatusRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): StatusRequest { + const message = createBaseStatusRequest(); + return message; + }, + fromAmino(_: StatusRequestAmino): StatusRequest { + const message = createBaseStatusRequest(); + return message; + }, + toAmino(_: StatusRequest): StatusRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: StatusRequestAminoMsg): StatusRequest { + return StatusRequest.fromAmino(object.value); + }, + toAminoMsg(message: StatusRequest): StatusRequestAminoMsg { + return { + type: "cosmos-sdk/StatusRequest", + value: StatusRequest.toAmino(message) + }; + }, + fromProtoMsg(message: StatusRequestProtoMsg): StatusRequest { + return StatusRequest.decode(message.value); + }, + toProto(message: StatusRequest): Uint8Array { + return StatusRequest.encode(message).finish(); + }, + toProtoMsg(message: StatusRequest): StatusRequestProtoMsg { + return { + typeUrl: "/cosmos.base.node.v1beta1.StatusRequest", + value: StatusRequest.encode(message).finish() + }; + } +}; +function createBaseStatusResponse(): StatusResponse { + return { + earliestStoreHeight: BigInt(0), + height: BigInt(0), + timestamp: undefined, + appHash: new Uint8Array(), + validatorHash: new Uint8Array() + }; +} +export const StatusResponse = { + typeUrl: "/cosmos.base.node.v1beta1.StatusResponse", + encode(message: StatusResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.earliestStoreHeight !== BigInt(0)) { + writer.uint32(8).uint64(message.earliestStoreHeight); + } + if (message.height !== BigInt(0)) { + writer.uint32(16).uint64(message.height); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(26).fork()).ldelim(); + } + if (message.appHash.length !== 0) { + writer.uint32(34).bytes(message.appHash); + } + if (message.validatorHash.length !== 0) { + writer.uint32(42).bytes(message.validatorHash); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): StatusResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStatusResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.earliestStoreHeight = reader.uint64(); + break; + case 2: + message.height = reader.uint64(); + break; + case 3: + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 4: + message.appHash = reader.bytes(); + break; + case 5: + message.validatorHash = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): StatusResponse { + const message = createBaseStatusResponse(); + message.earliestStoreHeight = object.earliestStoreHeight !== undefined && object.earliestStoreHeight !== null ? BigInt(object.earliestStoreHeight.toString()) : BigInt(0); + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + message.timestamp = object.timestamp ?? undefined; + message.appHash = object.appHash ?? new Uint8Array(); + message.validatorHash = object.validatorHash ?? new Uint8Array(); + return message; + }, + fromAmino(object: StatusResponseAmino): StatusResponse { + const message = createBaseStatusResponse(); + if (object.earliest_store_height !== undefined && object.earliest_store_height !== null) { + message.earliestStoreHeight = BigInt(object.earliest_store_height); + } + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.timestamp !== undefined && object.timestamp !== null) { + message.timestamp = fromTimestamp(Timestamp.fromAmino(object.timestamp)); + } + if (object.app_hash !== undefined && object.app_hash !== null) { + message.appHash = bytesFromBase64(object.app_hash); + } + if (object.validator_hash !== undefined && object.validator_hash !== null) { + message.validatorHash = bytesFromBase64(object.validator_hash); + } + return message; + }, + toAmino(message: StatusResponse): StatusResponseAmino { + const obj: any = {}; + obj.earliest_store_height = message.earliestStoreHeight !== BigInt(0) ? message.earliestStoreHeight?.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height?.toString() : undefined; + obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; + obj.app_hash = message.appHash ? base64FromBytes(message.appHash) : undefined; + obj.validator_hash = message.validatorHash ? base64FromBytes(message.validatorHash) : undefined; + return obj; + }, + fromAminoMsg(object: StatusResponseAminoMsg): StatusResponse { + return StatusResponse.fromAmino(object.value); + }, + toAminoMsg(message: StatusResponse): StatusResponseAminoMsg { + return { + type: "cosmos-sdk/StatusResponse", + value: StatusResponse.toAmino(message) + }; + }, + fromProtoMsg(message: StatusResponseProtoMsg): StatusResponse { + return StatusResponse.decode(message.value); + }, + toProto(message: StatusResponse): Uint8Array { + return StatusResponse.encode(message).finish(); + }, + toProtoMsg(message: StatusResponse): StatusResponseProtoMsg { + return { + typeUrl: "/cosmos.base.node.v1beta1.StatusResponse", + value: StatusResponse.encode(message).finish() + }; + } }; \ No newline at end of file diff --git a/packages/api/src/cosmos/base/query/v1beta1/pagination.ts b/packages/api/src/cosmos/base/query/v1beta1/pagination.ts index 48ad234e..97fce21e 100644 --- a/packages/api/src/cosmos/base/query/v1beta1/pagination.ts +++ b/packages/api/src/cosmos/base/query/v1beta1/pagination.ts @@ -35,11 +35,7 @@ export interface PageRequest { * is set. */ countTotal: boolean; - /** - * reverse is set to true if results are to be returned in the descending order. - * - * Since: cosmos-sdk 0.43 - */ + /** reverse is set to true if results are to be returned in the descending order. */ reverse: boolean; } export interface PageRequestProtoMsg { @@ -80,11 +76,7 @@ export interface PageRequestAmino { * is set. */ count_total?: boolean; - /** - * reverse is set to true if results are to be returned in the descending order. - * - * Since: cosmos-sdk 0.43 - */ + /** reverse is set to true if results are to be returned in the descending order. */ reverse?: boolean; } export interface PageRequestAminoMsg { diff --git a/packages/api/src/cosmos/base/v1beta1/coin.ts b/packages/api/src/cosmos/base/v1beta1/coin.ts index 60a45d97..1bd7f9c6 100644 --- a/packages/api/src/cosmos/base/v1beta1/coin.ts +++ b/packages/api/src/cosmos/base/v1beta1/coin.ts @@ -1,5 +1,6 @@ //@ts-nocheck import { BinaryReader, BinaryWriter } from "../../../binary"; +import { Decimal } from "@cosmjs/math"; /** * Coin defines a token with a denomination and an amount. * @@ -22,7 +23,7 @@ export interface CoinProtoMsg { */ export interface CoinAmino { denom?: string; - amount?: string; + amount: string; } export interface CoinAminoMsg { type: "cosmos-sdk/Coin"; @@ -76,7 +77,10 @@ export interface DecCoinSDKType { denom: string; amount: string; } -/** IntProto defines a Protobuf wrapper around an Int object. */ +/** + * IntProto defines a Protobuf wrapper around an Int object. + * Deprecated: Prefer to use math.Int directly. It supports binary Marshal and Unmarshal. + */ export interface IntProto { int: string; } @@ -84,7 +88,10 @@ export interface IntProtoProtoMsg { typeUrl: "/cosmos.base.v1beta1.IntProto"; value: Uint8Array; } -/** IntProto defines a Protobuf wrapper around an Int object. */ +/** + * IntProto defines a Protobuf wrapper around an Int object. + * Deprecated: Prefer to use math.Int directly. It supports binary Marshal and Unmarshal. + */ export interface IntProtoAmino { int?: string; } @@ -92,11 +99,17 @@ export interface IntProtoAminoMsg { type: "cosmos-sdk/IntProto"; value: IntProtoAmino; } -/** IntProto defines a Protobuf wrapper around an Int object. */ +/** + * IntProto defines a Protobuf wrapper around an Int object. + * Deprecated: Prefer to use math.Int directly. It supports binary Marshal and Unmarshal. + */ export interface IntProtoSDKType { int: string; } -/** DecProto defines a Protobuf wrapper around a Dec object. */ +/** + * DecProto defines a Protobuf wrapper around a Dec object. + * Deprecated: Prefer to use math.LegacyDec directly. It supports binary Marshal and Unmarshal. + */ export interface DecProto { dec: string; } @@ -104,7 +117,10 @@ export interface DecProtoProtoMsg { typeUrl: "/cosmos.base.v1beta1.DecProto"; value: Uint8Array; } -/** DecProto defines a Protobuf wrapper around a Dec object. */ +/** + * DecProto defines a Protobuf wrapper around a Dec object. + * Deprecated: Prefer to use math.LegacyDec directly. It supports binary Marshal and Unmarshal. + */ export interface DecProtoAmino { dec?: string; } @@ -112,7 +128,10 @@ export interface DecProtoAminoMsg { type: "cosmos-sdk/DecProto"; value: DecProtoAmino; } -/** DecProto defines a Protobuf wrapper around a Dec object. */ +/** + * DecProto defines a Protobuf wrapper around a Dec object. + * Deprecated: Prefer to use math.LegacyDec directly. It supports binary Marshal and Unmarshal. + */ export interface DecProtoSDKType { dec: string; } @@ -172,7 +191,7 @@ export const Coin = { toAmino(message: Coin): CoinAmino { const obj: any = {}; obj.denom = message.denom === "" ? undefined : message.denom; - obj.amount = message.amount === "" ? undefined : message.amount; + obj.amount = message.amount ?? ""; return obj; }, fromAminoMsg(object: CoinAminoMsg): Coin { @@ -210,7 +229,7 @@ export const DecCoin = { writer.uint32(10).string(message.denom); } if (message.amount !== "") { - writer.uint32(18).string(message.amount); + writer.uint32(18).string(Decimal.fromUserInput(message.amount, 18).atomics); } return writer; }, @@ -225,7 +244,7 @@ export const DecCoin = { message.denom = reader.string(); break; case 2: - message.amount = reader.string(); + message.amount = Decimal.fromAtomics(reader.string(), 18).toString(); break; default: reader.skipType(tag & 7); @@ -356,7 +375,7 @@ export const DecProto = { typeUrl: "/cosmos.base.v1beta1.DecProto", encode(message: DecProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.dec !== "") { - writer.uint32(10).string(message.dec); + writer.uint32(10).string(Decimal.fromUserInput(message.dec, 18).atomics); } return writer; }, @@ -368,7 +387,7 @@ export const DecProto = { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.dec = reader.string(); + message.dec = Decimal.fromAtomics(reader.string(), 18).toString(); break; default: reader.skipType(tag & 7); diff --git a/packages/api/src/cosmos/benchmark/module/v1/module.ts b/packages/api/src/cosmos/benchmark/module/v1/module.ts new file mode 100644 index 00000000..c437e341 --- /dev/null +++ b/packages/api/src/cosmos/benchmark/module/v1/module.ts @@ -0,0 +1,352 @@ +//@ts-nocheck +import { BinaryReader, BinaryWriter } from "../../../../binary"; +/** Module is the config object of the benchmark module. */ +export interface Module { + genesisParams?: GeneratorParams; +} +export interface ModuleProtoMsg { + typeUrl: "/cosmos.benchmark.module.v1.Module"; + value: Uint8Array; +} +/** Module is the config object of the benchmark module. */ +export interface ModuleAmino { + genesis_params?: GeneratorParamsAmino; +} +export interface ModuleAminoMsg { + type: "cosmos-sdk/Module"; + value: ModuleAmino; +} +/** Module is the config object of the benchmark module. */ +export interface ModuleSDKType { + genesis_params?: GeneratorParamsSDKType; +} +/** GenesisParams defines the genesis parameters for the benchmark module. */ +export interface GeneratorParams { + /** seed is the seed for the random number generator. */ + seed: bigint; + /** bucket_count is the number of store keys to uniformly distribute genesis_count keys across. */ + bucketCount: bigint; + /** key_mean is the mean size (in normal distribution) of keys in each bucket. */ + keyMean: bigint; + /** key_std_dev is the standard deviation of key sizes in each bucket. */ + keyStdDev: bigint; + /** value_mean is the mean size (in normal distribution) of values in each bucket. */ + valueMean: bigint; + /** value_std_dev is the standard deviation of value sizes in each bucket. */ + valueStdDev: bigint; + /** genesis_count is the number of keys to insert in the store, distributed across all buckets. */ + genesisCount: bigint; + /** insert_weight is the weight of insert operations. */ + insertWeight: number; + /** update_weight is the weight of update operations. */ + updateWeight: number; + /** get_weight is the weight of get operations. */ + getWeight: number; + /** delete_weight is the weight of delete operations. */ + deleteWeight: number; +} +export interface GeneratorParamsProtoMsg { + typeUrl: "/cosmos.benchmark.module.v1.GeneratorParams"; + value: Uint8Array; +} +/** GenesisParams defines the genesis parameters for the benchmark module. */ +export interface GeneratorParamsAmino { + /** seed is the seed for the random number generator. */ + seed?: string; + /** bucket_count is the number of store keys to uniformly distribute genesis_count keys across. */ + bucket_count?: string; + /** key_mean is the mean size (in normal distribution) of keys in each bucket. */ + key_mean?: string; + /** key_std_dev is the standard deviation of key sizes in each bucket. */ + key_std_dev?: string; + /** value_mean is the mean size (in normal distribution) of values in each bucket. */ + value_mean?: string; + /** value_std_dev is the standard deviation of value sizes in each bucket. */ + value_std_dev?: string; + /** genesis_count is the number of keys to insert in the store, distributed across all buckets. */ + genesis_count?: string; + /** insert_weight is the weight of insert operations. */ + insert_weight?: number; + /** update_weight is the weight of update operations. */ + update_weight?: number; + /** get_weight is the weight of get operations. */ + get_weight?: number; + /** delete_weight is the weight of delete operations. */ + delete_weight?: number; +} +export interface GeneratorParamsAminoMsg { + type: "cosmos-sdk/GeneratorParams"; + value: GeneratorParamsAmino; +} +/** GenesisParams defines the genesis parameters for the benchmark module. */ +export interface GeneratorParamsSDKType { + seed: bigint; + bucket_count: bigint; + key_mean: bigint; + key_std_dev: bigint; + value_mean: bigint; + value_std_dev: bigint; + genesis_count: bigint; + insert_weight: number; + update_weight: number; + get_weight: number; + delete_weight: number; +} +function createBaseModule(): Module { + return { + genesisParams: undefined + }; +} +export const Module = { + typeUrl: "/cosmos.benchmark.module.v1.Module", + encode(message: Module, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.genesisParams !== undefined) { + GeneratorParams.encode(message.genesisParams, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.genesisParams = GeneratorParams.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): Module { + const message = createBaseModule(); + message.genesisParams = object.genesisParams !== undefined && object.genesisParams !== null ? GeneratorParams.fromPartial(object.genesisParams) : undefined; + return message; + }, + fromAmino(object: ModuleAmino): Module { + const message = createBaseModule(); + if (object.genesis_params !== undefined && object.genesis_params !== null) { + message.genesisParams = GeneratorParams.fromAmino(object.genesis_params); + } + return message; + }, + toAmino(message: Module): ModuleAmino { + const obj: any = {}; + obj.genesis_params = message.genesisParams ? GeneratorParams.toAmino(message.genesisParams) : undefined; + return obj; + }, + fromAminoMsg(object: ModuleAminoMsg): Module { + return Module.fromAmino(object.value); + }, + toAminoMsg(message: Module): ModuleAminoMsg { + return { + type: "cosmos-sdk/Module", + value: Module.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleProtoMsg): Module { + return Module.decode(message.value); + }, + toProto(message: Module): Uint8Array { + return Module.encode(message).finish(); + }, + toProtoMsg(message: Module): ModuleProtoMsg { + return { + typeUrl: "/cosmos.benchmark.module.v1.Module", + value: Module.encode(message).finish() + }; + } +}; +function createBaseGeneratorParams(): GeneratorParams { + return { + seed: BigInt(0), + bucketCount: BigInt(0), + keyMean: BigInt(0), + keyStdDev: BigInt(0), + valueMean: BigInt(0), + valueStdDev: BigInt(0), + genesisCount: BigInt(0), + insertWeight: 0, + updateWeight: 0, + getWeight: 0, + deleteWeight: 0 + }; +} +export const GeneratorParams = { + typeUrl: "/cosmos.benchmark.module.v1.GeneratorParams", + encode(message: GeneratorParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.seed !== BigInt(0)) { + writer.uint32(8).uint64(message.seed); + } + if (message.bucketCount !== BigInt(0)) { + writer.uint32(16).uint64(message.bucketCount); + } + if (message.keyMean !== BigInt(0)) { + writer.uint32(24).uint64(message.keyMean); + } + if (message.keyStdDev !== BigInt(0)) { + writer.uint32(32).uint64(message.keyStdDev); + } + if (message.valueMean !== BigInt(0)) { + writer.uint32(48).uint64(message.valueMean); + } + if (message.valueStdDev !== BigInt(0)) { + writer.uint32(56).uint64(message.valueStdDev); + } + if (message.genesisCount !== BigInt(0)) { + writer.uint32(64).uint64(message.genesisCount); + } + if (message.insertWeight !== 0) { + writer.uint32(77).float(message.insertWeight); + } + if (message.updateWeight !== 0) { + writer.uint32(85).float(message.updateWeight); + } + if (message.getWeight !== 0) { + writer.uint32(101).float(message.getWeight); + } + if (message.deleteWeight !== 0) { + writer.uint32(93).float(message.deleteWeight); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GeneratorParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneratorParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.seed = reader.uint64(); + break; + case 2: + message.bucketCount = reader.uint64(); + break; + case 3: + message.keyMean = reader.uint64(); + break; + case 4: + message.keyStdDev = reader.uint64(); + break; + case 6: + message.valueMean = reader.uint64(); + break; + case 7: + message.valueStdDev = reader.uint64(); + break; + case 8: + message.genesisCount = reader.uint64(); + break; + case 9: + message.insertWeight = reader.float(); + break; + case 10: + message.updateWeight = reader.float(); + break; + case 12: + message.getWeight = reader.float(); + break; + case 11: + message.deleteWeight = reader.float(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): GeneratorParams { + const message = createBaseGeneratorParams(); + message.seed = object.seed !== undefined && object.seed !== null ? BigInt(object.seed.toString()) : BigInt(0); + message.bucketCount = object.bucketCount !== undefined && object.bucketCount !== null ? BigInt(object.bucketCount.toString()) : BigInt(0); + message.keyMean = object.keyMean !== undefined && object.keyMean !== null ? BigInt(object.keyMean.toString()) : BigInt(0); + message.keyStdDev = object.keyStdDev !== undefined && object.keyStdDev !== null ? BigInt(object.keyStdDev.toString()) : BigInt(0); + message.valueMean = object.valueMean !== undefined && object.valueMean !== null ? BigInt(object.valueMean.toString()) : BigInt(0); + message.valueStdDev = object.valueStdDev !== undefined && object.valueStdDev !== null ? BigInt(object.valueStdDev.toString()) : BigInt(0); + message.genesisCount = object.genesisCount !== undefined && object.genesisCount !== null ? BigInt(object.genesisCount.toString()) : BigInt(0); + message.insertWeight = object.insertWeight ?? 0; + message.updateWeight = object.updateWeight ?? 0; + message.getWeight = object.getWeight ?? 0; + message.deleteWeight = object.deleteWeight ?? 0; + return message; + }, + fromAmino(object: GeneratorParamsAmino): GeneratorParams { + const message = createBaseGeneratorParams(); + if (object.seed !== undefined && object.seed !== null) { + message.seed = BigInt(object.seed); + } + if (object.bucket_count !== undefined && object.bucket_count !== null) { + message.bucketCount = BigInt(object.bucket_count); + } + if (object.key_mean !== undefined && object.key_mean !== null) { + message.keyMean = BigInt(object.key_mean); + } + if (object.key_std_dev !== undefined && object.key_std_dev !== null) { + message.keyStdDev = BigInt(object.key_std_dev); + } + if (object.value_mean !== undefined && object.value_mean !== null) { + message.valueMean = BigInt(object.value_mean); + } + if (object.value_std_dev !== undefined && object.value_std_dev !== null) { + message.valueStdDev = BigInt(object.value_std_dev); + } + if (object.genesis_count !== undefined && object.genesis_count !== null) { + message.genesisCount = BigInt(object.genesis_count); + } + if (object.insert_weight !== undefined && object.insert_weight !== null) { + message.insertWeight = object.insert_weight; + } + if (object.update_weight !== undefined && object.update_weight !== null) { + message.updateWeight = object.update_weight; + } + if (object.get_weight !== undefined && object.get_weight !== null) { + message.getWeight = object.get_weight; + } + if (object.delete_weight !== undefined && object.delete_weight !== null) { + message.deleteWeight = object.delete_weight; + } + return message; + }, + toAmino(message: GeneratorParams): GeneratorParamsAmino { + const obj: any = {}; + obj.seed = message.seed !== BigInt(0) ? message.seed?.toString() : undefined; + obj.bucket_count = message.bucketCount !== BigInt(0) ? message.bucketCount?.toString() : undefined; + obj.key_mean = message.keyMean !== BigInt(0) ? message.keyMean?.toString() : undefined; + obj.key_std_dev = message.keyStdDev !== BigInt(0) ? message.keyStdDev?.toString() : undefined; + obj.value_mean = message.valueMean !== BigInt(0) ? message.valueMean?.toString() : undefined; + obj.value_std_dev = message.valueStdDev !== BigInt(0) ? message.valueStdDev?.toString() : undefined; + obj.genesis_count = message.genesisCount !== BigInt(0) ? message.genesisCount?.toString() : undefined; + obj.insert_weight = message.insertWeight === 0 ? undefined : message.insertWeight; + obj.update_weight = message.updateWeight === 0 ? undefined : message.updateWeight; + obj.get_weight = message.getWeight === 0 ? undefined : message.getWeight; + obj.delete_weight = message.deleteWeight === 0 ? undefined : message.deleteWeight; + return obj; + }, + fromAminoMsg(object: GeneratorParamsAminoMsg): GeneratorParams { + return GeneratorParams.fromAmino(object.value); + }, + toAminoMsg(message: GeneratorParams): GeneratorParamsAminoMsg { + return { + type: "cosmos-sdk/GeneratorParams", + value: GeneratorParams.toAmino(message) + }; + }, + fromProtoMsg(message: GeneratorParamsProtoMsg): GeneratorParams { + return GeneratorParams.decode(message.value); + }, + toProto(message: GeneratorParams): Uint8Array { + return GeneratorParams.encode(message).finish(); + }, + toProtoMsg(message: GeneratorParams): GeneratorParamsProtoMsg { + return { + typeUrl: "/cosmos.benchmark.module.v1.GeneratorParams", + value: GeneratorParams.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/benchmark/v1/benchmark.ts b/packages/api/src/cosmos/benchmark/v1/benchmark.ts new file mode 100644 index 00000000..c60c8723 --- /dev/null +++ b/packages/api/src/cosmos/benchmark/v1/benchmark.ts @@ -0,0 +1,181 @@ +//@ts-nocheck +import { BinaryReader, BinaryWriter } from "../../../binary"; +/** Op is a message describing a benchmark operation. */ +export interface Op { + seed: bigint; + actor: string; + keyLength: bigint; + valueLength: bigint; + iterations: number; + delete: boolean; + exists: boolean; +} +export interface OpProtoMsg { + typeUrl: "/cosmos.benchmark.v1.Op"; + value: Uint8Array; +} +/** Op is a message describing a benchmark operation. */ +export interface OpAmino { + seed?: string; + actor?: string; + key_length?: string; + value_length?: string; + iterations?: number; + delete?: boolean; + exists?: boolean; +} +export interface OpAminoMsg { + type: "cosmos-sdk/Op"; + value: OpAmino; +} +/** Op is a message describing a benchmark operation. */ +export interface OpSDKType { + seed: bigint; + actor: string; + key_length: bigint; + value_length: bigint; + iterations: number; + delete: boolean; + exists: boolean; +} +function createBaseOp(): Op { + return { + seed: BigInt(0), + actor: "", + keyLength: BigInt(0), + valueLength: BigInt(0), + iterations: 0, + delete: false, + exists: false + }; +} +export const Op = { + typeUrl: "/cosmos.benchmark.v1.Op", + encode(message: Op, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.seed !== BigInt(0)) { + writer.uint32(8).uint64(message.seed); + } + if (message.actor !== "") { + writer.uint32(18).string(message.actor); + } + if (message.keyLength !== BigInt(0)) { + writer.uint32(24).uint64(message.keyLength); + } + if (message.valueLength !== BigInt(0)) { + writer.uint32(32).uint64(message.valueLength); + } + if (message.iterations !== 0) { + writer.uint32(40).uint32(message.iterations); + } + if (message.delete === true) { + writer.uint32(48).bool(message.delete); + } + if (message.exists === true) { + writer.uint32(56).bool(message.exists); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Op { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.seed = reader.uint64(); + break; + case 2: + message.actor = reader.string(); + break; + case 3: + message.keyLength = reader.uint64(); + break; + case 4: + message.valueLength = reader.uint64(); + break; + case 5: + message.iterations = reader.uint32(); + break; + case 6: + message.delete = reader.bool(); + break; + case 7: + message.exists = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): Op { + const message = createBaseOp(); + message.seed = object.seed !== undefined && object.seed !== null ? BigInt(object.seed.toString()) : BigInt(0); + message.actor = object.actor ?? ""; + message.keyLength = object.keyLength !== undefined && object.keyLength !== null ? BigInt(object.keyLength.toString()) : BigInt(0); + message.valueLength = object.valueLength !== undefined && object.valueLength !== null ? BigInt(object.valueLength.toString()) : BigInt(0); + message.iterations = object.iterations ?? 0; + message.delete = object.delete ?? false; + message.exists = object.exists ?? false; + return message; + }, + fromAmino(object: OpAmino): Op { + const message = createBaseOp(); + if (object.seed !== undefined && object.seed !== null) { + message.seed = BigInt(object.seed); + } + if (object.actor !== undefined && object.actor !== null) { + message.actor = object.actor; + } + if (object.key_length !== undefined && object.key_length !== null) { + message.keyLength = BigInt(object.key_length); + } + if (object.value_length !== undefined && object.value_length !== null) { + message.valueLength = BigInt(object.value_length); + } + if (object.iterations !== undefined && object.iterations !== null) { + message.iterations = object.iterations; + } + if (object.delete !== undefined && object.delete !== null) { + message.delete = object.delete; + } + if (object.exists !== undefined && object.exists !== null) { + message.exists = object.exists; + } + return message; + }, + toAmino(message: Op): OpAmino { + const obj: any = {}; + obj.seed = message.seed !== BigInt(0) ? message.seed?.toString() : undefined; + obj.actor = message.actor === "" ? undefined : message.actor; + obj.key_length = message.keyLength !== BigInt(0) ? message.keyLength?.toString() : undefined; + obj.value_length = message.valueLength !== BigInt(0) ? message.valueLength?.toString() : undefined; + obj.iterations = message.iterations === 0 ? undefined : message.iterations; + obj.delete = message.delete === false ? undefined : message.delete; + obj.exists = message.exists === false ? undefined : message.exists; + return obj; + }, + fromAminoMsg(object: OpAminoMsg): Op { + return Op.fromAmino(object.value); + }, + toAminoMsg(message: Op): OpAminoMsg { + return { + type: "cosmos-sdk/Op", + value: Op.toAmino(message) + }; + }, + fromProtoMsg(message: OpProtoMsg): Op { + return Op.decode(message.value); + }, + toProto(message: Op): Uint8Array { + return Op.encode(message).finish(); + }, + toProtoMsg(message: Op): OpProtoMsg { + return { + typeUrl: "/cosmos.benchmark.v1.Op", + value: Op.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/benchmark/v1/tx.amino.ts b/packages/api/src/cosmos/benchmark/v1/tx.amino.ts new file mode 100644 index 00000000..55922007 --- /dev/null +++ b/packages/api/src/cosmos/benchmark/v1/tx.amino.ts @@ -0,0 +1,9 @@ +//@ts-nocheck +import { MsgLoadTest } from "./tx"; +export const AminoConverter = { + "/cosmos.benchmark.v1.MsgLoadTest": { + aminoType: "cosmos-sdk/tools/benchmark/v1/MsgLoadTest", + toAmino: MsgLoadTest.toAmino, + fromAmino: MsgLoadTest.fromAmino + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/benchmark/v1/tx.registry.ts b/packages/api/src/cosmos/benchmark/v1/tx.registry.ts new file mode 100644 index 00000000..d807476b --- /dev/null +++ b/packages/api/src/cosmos/benchmark/v1/tx.registry.ts @@ -0,0 +1,35 @@ +//@ts-nocheck +import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { MsgLoadTest } from "./tx"; +export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.benchmark.v1.MsgLoadTest", MsgLoadTest]]; +export const load = (protoRegistry: Registry) => { + registry.forEach(([typeUrl, mod]) => { + protoRegistry.register(typeUrl, mod); + }); +}; +export const MessageComposer = { + encoded: { + loadTest(value: MsgLoadTest) { + return { + typeUrl: "/cosmos.benchmark.v1.MsgLoadTest", + value: MsgLoadTest.encode(value).finish() + }; + } + }, + withTypeUrl: { + loadTest(value: MsgLoadTest) { + return { + typeUrl: "/cosmos.benchmark.v1.MsgLoadTest", + value + }; + } + }, + fromPartial: { + loadTest(value: MsgLoadTest) { + return { + typeUrl: "/cosmos.benchmark.v1.MsgLoadTest", + value: MsgLoadTest.fromPartial(value) + }; + } + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/benchmark/v1/tx.rpc.msg.ts b/packages/api/src/cosmos/benchmark/v1/tx.rpc.msg.ts new file mode 100644 index 00000000..d4f8408a --- /dev/null +++ b/packages/api/src/cosmos/benchmark/v1/tx.rpc.msg.ts @@ -0,0 +1,21 @@ +//@ts-nocheck +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; +import { MsgLoadTest, MsgLoadTestResponse } from "./tx"; +/** Msg defines the benchmark Msg service. */ +export interface Msg { + /** LoadTest defines a method for executing a sequence of load test operations. */ + loadTest(request: MsgLoadTest): Promise; +} +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + this.loadTest = this.loadTest.bind(this); + } + loadTest(request: MsgLoadTest): Promise { + const data = MsgLoadTest.encode(request).finish(); + const promise = this.rpc.request("cosmos.benchmark.v1.Msg", "LoadTest", data); + return promise.then(data => MsgLoadTestResponse.decode(new BinaryReader(data))); + } +} \ No newline at end of file diff --git a/packages/api/src/cosmos/benchmark/v1/tx.ts b/packages/api/src/cosmos/benchmark/v1/tx.ts new file mode 100644 index 00000000..6865357d --- /dev/null +++ b/packages/api/src/cosmos/benchmark/v1/tx.ts @@ -0,0 +1,214 @@ +//@ts-nocheck +import { Op, OpAmino, OpSDKType } from "./benchmark"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { bytesFromBase64, base64FromBytes } from "../../../helpers"; +/** MsgLoadTestOps defines a message containing a sequence of load test operations. */ +export interface MsgLoadTest { + caller: Uint8Array; + ops: Op[]; +} +export interface MsgLoadTestProtoMsg { + typeUrl: "/cosmos.benchmark.v1.MsgLoadTest"; + value: Uint8Array; +} +/** MsgLoadTestOps defines a message containing a sequence of load test operations. */ +export interface MsgLoadTestAmino { + caller?: string; + ops?: OpAmino[]; +} +export interface MsgLoadTestAminoMsg { + type: "cosmos-sdk/tools/benchmark/v1/MsgLoadTest"; + value: MsgLoadTestAmino; +} +/** MsgLoadTestOps defines a message containing a sequence of load test operations. */ +export interface MsgLoadTestSDKType { + caller: Uint8Array; + ops: OpSDKType[]; +} +/** MsgLoadTestResponse defines a message containing the results of a load test operation. */ +export interface MsgLoadTestResponse { + totalTime: bigint; + totalErrors: bigint; +} +export interface MsgLoadTestResponseProtoMsg { + typeUrl: "/cosmos.benchmark.v1.MsgLoadTestResponse"; + value: Uint8Array; +} +/** MsgLoadTestResponse defines a message containing the results of a load test operation. */ +export interface MsgLoadTestResponseAmino { + total_time?: string; + total_errors?: string; +} +export interface MsgLoadTestResponseAminoMsg { + type: "cosmos-sdk/MsgLoadTestResponse"; + value: MsgLoadTestResponseAmino; +} +/** MsgLoadTestResponse defines a message containing the results of a load test operation. */ +export interface MsgLoadTestResponseSDKType { + total_time: bigint; + total_errors: bigint; +} +function createBaseMsgLoadTest(): MsgLoadTest { + return { + caller: new Uint8Array(), + ops: [] + }; +} +export const MsgLoadTest = { + typeUrl: "/cosmos.benchmark.v1.MsgLoadTest", + encode(message: MsgLoadTest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.caller.length !== 0) { + writer.uint32(10).bytes(message.caller); + } + for (const v of message.ops) { + Op.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgLoadTest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgLoadTest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.caller = reader.bytes(); + break; + case 2: + message.ops.push(Op.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgLoadTest { + const message = createBaseMsgLoadTest(); + message.caller = object.caller ?? new Uint8Array(); + message.ops = object.ops?.map(e => Op.fromPartial(e)) || []; + return message; + }, + fromAmino(object: MsgLoadTestAmino): MsgLoadTest { + const message = createBaseMsgLoadTest(); + if (object.caller !== undefined && object.caller !== null) { + message.caller = bytesFromBase64(object.caller); + } + message.ops = object.ops?.map(e => Op.fromAmino(e)) || []; + return message; + }, + toAmino(message: MsgLoadTest): MsgLoadTestAmino { + const obj: any = {}; + obj.caller = message.caller ? base64FromBytes(message.caller) : undefined; + if (message.ops) { + obj.ops = message.ops.map(e => e ? Op.toAmino(e) : undefined); + } else { + obj.ops = message.ops; + } + return obj; + }, + fromAminoMsg(object: MsgLoadTestAminoMsg): MsgLoadTest { + return MsgLoadTest.fromAmino(object.value); + }, + toAminoMsg(message: MsgLoadTest): MsgLoadTestAminoMsg { + return { + type: "cosmos-sdk/tools/benchmark/v1/MsgLoadTest", + value: MsgLoadTest.toAmino(message) + }; + }, + fromProtoMsg(message: MsgLoadTestProtoMsg): MsgLoadTest { + return MsgLoadTest.decode(message.value); + }, + toProto(message: MsgLoadTest): Uint8Array { + return MsgLoadTest.encode(message).finish(); + }, + toProtoMsg(message: MsgLoadTest): MsgLoadTestProtoMsg { + return { + typeUrl: "/cosmos.benchmark.v1.MsgLoadTest", + value: MsgLoadTest.encode(message).finish() + }; + } +}; +function createBaseMsgLoadTestResponse(): MsgLoadTestResponse { + return { + totalTime: BigInt(0), + totalErrors: BigInt(0) + }; +} +export const MsgLoadTestResponse = { + typeUrl: "/cosmos.benchmark.v1.MsgLoadTestResponse", + encode(message: MsgLoadTestResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.totalTime !== BigInt(0)) { + writer.uint32(8).uint64(message.totalTime); + } + if (message.totalErrors !== BigInt(0)) { + writer.uint32(16).uint64(message.totalErrors); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgLoadTestResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgLoadTestResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.totalTime = reader.uint64(); + break; + case 2: + message.totalErrors = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgLoadTestResponse { + const message = createBaseMsgLoadTestResponse(); + message.totalTime = object.totalTime !== undefined && object.totalTime !== null ? BigInt(object.totalTime.toString()) : BigInt(0); + message.totalErrors = object.totalErrors !== undefined && object.totalErrors !== null ? BigInt(object.totalErrors.toString()) : BigInt(0); + return message; + }, + fromAmino(object: MsgLoadTestResponseAmino): MsgLoadTestResponse { + const message = createBaseMsgLoadTestResponse(); + if (object.total_time !== undefined && object.total_time !== null) { + message.totalTime = BigInt(object.total_time); + } + if (object.total_errors !== undefined && object.total_errors !== null) { + message.totalErrors = BigInt(object.total_errors); + } + return message; + }, + toAmino(message: MsgLoadTestResponse): MsgLoadTestResponseAmino { + const obj: any = {}; + obj.total_time = message.totalTime !== BigInt(0) ? message.totalTime?.toString() : undefined; + obj.total_errors = message.totalErrors !== BigInt(0) ? message.totalErrors?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: MsgLoadTestResponseAminoMsg): MsgLoadTestResponse { + return MsgLoadTestResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgLoadTestResponse): MsgLoadTestResponseAminoMsg { + return { + type: "cosmos-sdk/MsgLoadTestResponse", + value: MsgLoadTestResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgLoadTestResponseProtoMsg): MsgLoadTestResponse { + return MsgLoadTestResponse.decode(message.value); + }, + toProto(message: MsgLoadTestResponse): Uint8Array { + return MsgLoadTestResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgLoadTestResponse): MsgLoadTestResponseProtoMsg { + return { + typeUrl: "/cosmos.benchmark.v1.MsgLoadTestResponse", + value: MsgLoadTestResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/bundle.ts b/packages/api/src/cosmos/bundle.ts index 7e671d23..b321dc74 100644 --- a/packages/api/src/cosmos/bundle.ts +++ b/packages/api/src/cosmos/bundle.ts @@ -1,365 +1,679 @@ //@ts-nocheck -import * as _2 from "./app/module/v1alpha1/module"; -import * as _3 from "./auth/v1beta1/auth"; -import * as _4 from "./auth/v1beta1/genesis"; -import * as _5 from "./auth/v1beta1/query"; -import * as _6 from "./authz/v1beta1/authz"; -import * as _7 from "./authz/v1beta1/event"; -import * as _8 from "./authz/v1beta1/genesis"; -import * as _9 from "./authz/v1beta1/query"; -import * as _10 from "./authz/v1beta1/tx"; -import * as _11 from "./bank/v1beta1/authz"; -import * as _12 from "./bank/v1beta1/bank"; -import * as _13 from "./bank/v1beta1/genesis"; -import * as _14 from "./bank/v1beta1/query"; -import * as _15 from "./bank/v1beta1/tx"; -import * as _16 from "./base/abci/v1beta1/abci"; -import * as _17 from "./base/node/v1beta1/query"; -import * as _18 from "./base/query/v1beta1/pagination"; -import * as _19 from "./base/reflection/v2alpha1/reflection"; -import * as _20 from "./base/v1beta1/coin"; -import * as _21 from "./crypto/ed25519/keys"; -import * as _22 from "./crypto/hd/v1/hd"; -import * as _23 from "./crypto/keyring/v1/record"; -import * as _24 from "./crypto/multisig/keys"; -import * as _25 from "./crypto/secp256k1/keys"; -import * as _26 from "./crypto/secp256r1/keys"; -import * as _27 from "./distribution/v1beta1/distribution"; -import * as _28 from "./distribution/v1beta1/genesis"; -import * as _29 from "./distribution/v1beta1/query"; -import * as _30 from "./distribution/v1beta1/tx"; -import * as _31 from "./feegrant/v1beta1/feegrant"; -import * as _32 from "./feegrant/v1beta1/genesis"; -import * as _33 from "./feegrant/v1beta1/query"; -import * as _34 from "./feegrant/v1beta1/tx"; -import * as _35 from "./gov/v1/genesis"; -import * as _36 from "./gov/v1/gov"; -import * as _37 from "./gov/v1/query"; -import * as _38 from "./gov/v1/tx"; -import * as _39 from "./gov/v1beta1/genesis"; -import * as _40 from "./gov/v1beta1/gov"; -import * as _41 from "./gov/v1beta1/query"; -import * as _42 from "./gov/v1beta1/tx"; -import * as _43 from "./group/v1/events"; -import * as _44 from "./group/v1/genesis"; -import * as _45 from "./group/v1/query"; -import * as _46 from "./group/v1/tx"; -import * as _47 from "./group/v1/types"; -import * as _48 from "./mint/v1beta1/genesis"; -import * as _49 from "./mint/v1beta1/mint"; -import * as _50 from "./mint/v1beta1/query"; -import * as _51 from "./orm/module/v1alpha1/module"; -import * as _52 from "./params/v1beta1/params"; -import * as _53 from "./params/v1beta1/query"; -import * as _54 from "./staking/v1beta1/authz"; -import * as _55 from "./staking/v1beta1/genesis"; -import * as _56 from "./staking/v1beta1/query"; -import * as _57 from "./staking/v1beta1/staking"; -import * as _58 from "./staking/v1beta1/tx"; -import * as _59 from "./tx/signing/v1beta1/signing"; -import * as _60 from "./tx/v1beta1/service"; -import * as _61 from "./tx/v1beta1/tx"; -import * as _62 from "./upgrade/v1beta1/query"; -import * as _63 from "./upgrade/v1beta1/tx"; -import * as _64 from "./upgrade/v1beta1/upgrade"; -import * as _65 from "./vesting/v1beta1/tx"; -import * as _66 from "./vesting/v1beta1/vesting"; -import * as _124 from "./authz/v1beta1/tx.amino"; -import * as _125 from "./bank/v1beta1/tx.amino"; -import * as _126 from "./distribution/v1beta1/tx.amino"; -import * as _127 from "./feegrant/v1beta1/tx.amino"; -import * as _128 from "./gov/v1/tx.amino"; -import * as _129 from "./gov/v1beta1/tx.amino"; -import * as _130 from "./group/v1/tx.amino"; -import * as _131 from "./staking/v1beta1/tx.amino"; -import * as _132 from "./upgrade/v1beta1/tx.amino"; -import * as _133 from "./vesting/v1beta1/tx.amino"; -import * as _134 from "./authz/v1beta1/tx.registry"; -import * as _135 from "./bank/v1beta1/tx.registry"; -import * as _136 from "./distribution/v1beta1/tx.registry"; -import * as _137 from "./feegrant/v1beta1/tx.registry"; -import * as _138 from "./gov/v1/tx.registry"; -import * as _139 from "./gov/v1beta1/tx.registry"; -import * as _140 from "./group/v1/tx.registry"; -import * as _141 from "./staking/v1beta1/tx.registry"; -import * as _142 from "./upgrade/v1beta1/tx.registry"; -import * as _143 from "./vesting/v1beta1/tx.registry"; -import * as _144 from "./auth/v1beta1/query.lcd"; -import * as _145 from "./authz/v1beta1/query.lcd"; -import * as _146 from "./bank/v1beta1/query.lcd"; -import * as _147 from "./base/node/v1beta1/query.lcd"; -import * as _148 from "./distribution/v1beta1/query.lcd"; -import * as _149 from "./feegrant/v1beta1/query.lcd"; -import * as _150 from "./gov/v1/query.lcd"; -import * as _151 from "./gov/v1beta1/query.lcd"; -import * as _152 from "./group/v1/query.lcd"; -import * as _153 from "./mint/v1beta1/query.lcd"; -import * as _154 from "./params/v1beta1/query.lcd"; -import * as _155 from "./staking/v1beta1/query.lcd"; -import * as _156 from "./tx/v1beta1/service.lcd"; -import * as _157 from "./upgrade/v1beta1/query.lcd"; -import * as _158 from "./auth/v1beta1/query.rpc.Query"; -import * as _159 from "./authz/v1beta1/query.rpc.Query"; -import * as _160 from "./bank/v1beta1/query.rpc.Query"; -import * as _161 from "./base/node/v1beta1/query.rpc.Service"; -import * as _162 from "./distribution/v1beta1/query.rpc.Query"; -import * as _163 from "./feegrant/v1beta1/query.rpc.Query"; -import * as _164 from "./gov/v1/query.rpc.Query"; -import * as _165 from "./gov/v1beta1/query.rpc.Query"; -import * as _166 from "./group/v1/query.rpc.Query"; -import * as _167 from "./mint/v1beta1/query.rpc.Query"; -import * as _168 from "./params/v1beta1/query.rpc.Query"; -import * as _169 from "./staking/v1beta1/query.rpc.Query"; -import * as _170 from "./tx/v1beta1/service.rpc.Service"; -import * as _171 from "./upgrade/v1beta1/query.rpc.Query"; -import * as _172 from "./authz/v1beta1/tx.rpc.msg"; -import * as _173 from "./bank/v1beta1/tx.rpc.msg"; -import * as _174 from "./distribution/v1beta1/tx.rpc.msg"; -import * as _175 from "./feegrant/v1beta1/tx.rpc.msg"; -import * as _176 from "./gov/v1/tx.rpc.msg"; -import * as _177 from "./gov/v1beta1/tx.rpc.msg"; -import * as _178 from "./group/v1/tx.rpc.msg"; -import * as _179 from "./staking/v1beta1/tx.rpc.msg"; -import * as _180 from "./upgrade/v1beta1/tx.rpc.msg"; -import * as _181 from "./vesting/v1beta1/tx.rpc.msg"; -import * as _227 from "./lcd"; -import * as _228 from "./rpc.query"; -import * as _229 from "./rpc.tx"; +import * as _2 from "./app/runtime/v1alpha1/module"; +import * as _3 from "./auth/module/v1/module"; +import * as _4 from "./auth/v1beta1/auth"; +import * as _5 from "./auth/v1beta1/genesis"; +import * as _6 from "./auth/v1beta1/query"; +import * as _7 from "./auth/v1beta1/tx"; +import * as _8 from "./authz/module/v1/module"; +import * as _9 from "./authz/v1beta1/authz"; +import * as _10 from "./authz/v1beta1/event"; +import * as _11 from "./authz/v1beta1/genesis"; +import * as _12 from "./authz/v1beta1/query"; +import * as _13 from "./authz/v1beta1/tx"; +import * as _14 from "./bank/module/v1/module"; +import * as _15 from "./bank/v1beta1/authz"; +import * as _16 from "./bank/v1beta1/bank"; +import * as _17 from "./bank/v1beta1/genesis"; +import * as _18 from "./bank/v1beta1/query"; +import * as _19 from "./bank/v1beta1/tx"; +import * as _20 from "./base/abci/v1beta1/abci"; +import * as _21 from "./base/node/v1beta1/query"; +import * as _22 from "./base/query/v1beta1/pagination"; +import * as _23 from "./base/reflection/v2alpha1/reflection"; +import * as _24 from "./base/v1beta1/coin"; +import * as _25 from "./benchmark/module/v1/module"; +import * as _26 from "./benchmark/v1/benchmark"; +import * as _27 from "./benchmark/v1/tx"; +import * as _28 from "./circuit/module/v1/module"; +import * as _29 from "./circuit/v1/query"; +import * as _30 from "./circuit/v1/tx"; +import * as _31 from "./circuit/v1/types"; +import * as _32 from "./consensus/module/v1/module"; +import * as _33 from "./consensus/v1/query"; +import * as _34 from "./consensus/v1/tx"; +import * as _35 from "./counter/module/v1/module"; +import * as _36 from "./counter/v1/query"; +import * as _37 from "./counter/v1/tx"; +import * as _38 from "./crisis/module/v1/module"; +import * as _39 from "./crypto/ed25519/keys"; +import * as _40 from "./crypto/hd/v1/hd"; +import * as _41 from "./crypto/keyring/v1/record"; +import * as _42 from "./crypto/multisig/keys"; +import * as _43 from "./crypto/secp256k1/keys"; +import * as _44 from "./crypto/secp256r1/keys"; +import * as _45 from "./distribution/module/v1/module"; +import * as _46 from "./distribution/v1beta1/distribution"; +import * as _47 from "./distribution/v1beta1/genesis"; +import * as _48 from "./distribution/v1beta1/query"; +import * as _49 from "./distribution/v1beta1/tx"; +import * as _50 from "./epochs/module/v1/module"; +import * as _51 from "./epochs/v1beta1/events"; +import * as _52 from "./epochs/v1beta1/genesis"; +import * as _53 from "./epochs/v1beta1/query"; +import * as _54 from "./evidence/module/v1/module"; +import * as _55 from "./feegrant/module/v1/module"; +import * as _56 from "./feegrant/v1beta1/feegrant"; +import * as _57 from "./feegrant/v1beta1/genesis"; +import * as _58 from "./feegrant/v1beta1/query"; +import * as _59 from "./feegrant/v1beta1/tx"; +import * as _60 from "./genutil/module/v1/module"; +import * as _61 from "./gov/module/v1/module"; +import * as _62 from "./gov/v1/genesis"; +import * as _63 from "./gov/v1/gov"; +import * as _64 from "./gov/v1/query"; +import * as _65 from "./gov/v1/tx"; +import * as _66 from "./gov/v1beta1/genesis"; +import * as _67 from "./gov/v1beta1/gov"; +import * as _68 from "./gov/v1beta1/query"; +import * as _69 from "./gov/v1beta1/tx"; +import * as _70 from "./group/module/v1/module"; +import * as _71 from "./group/v1/events"; +import * as _72 from "./group/v1/genesis"; +import * as _73 from "./group/v1/query"; +import * as _74 from "./group/v1/tx"; +import * as _75 from "./group/v1/types"; +import * as _76 from "./mint/module/v1/module"; +import * as _77 from "./mint/v1beta1/genesis"; +import * as _78 from "./mint/v1beta1/mint"; +import * as _79 from "./mint/v1beta1/query"; +import * as _80 from "./mint/v1beta1/tx"; +import * as _81 from "./msg/textual/v1/textual"; +import * as _82 from "./nft/module/v1/module"; +import * as _83 from "./params/module/v1/module"; +import * as _84 from "./params/v1beta1/params"; +import * as _85 from "./params/v1beta1/query"; +import * as _86 from "./protocolpool/module/v1/module"; +import * as _87 from "./protocolpool/v1/genesis"; +import * as _88 from "./protocolpool/v1/query"; +import * as _89 from "./protocolpool/v1/tx"; +import * as _90 from "./protocolpool/v1/types"; +import * as _91 from "./query/v1/query"; +import * as _92 from "./reflection/v1/reflection"; +import * as _93 from "./slashing/module/v1/module"; +import * as _94 from "./staking/module/v1/module"; +import * as _95 from "./staking/v1beta1/authz"; +import * as _96 from "./staking/v1beta1/genesis"; +import * as _97 from "./staking/v1beta1/query"; +import * as _98 from "./staking/v1beta1/staking"; +import * as _99 from "./staking/v1beta1/tx"; +import * as _100 from "./store/internal/kv/v1beta1/kv"; +import * as _101 from "./store/snapshots/v1/snapshot"; +import * as _102 from "./store/streaming/abci/grpc"; +import * as _103 from "./store/v1beta1/commit_info"; +import * as _104 from "./store/v1beta1/listening"; +import * as _105 from "./tx/config/v1/config"; +import * as _106 from "./tx/signing/v1beta1/signing"; +import * as _107 from "./tx/v1beta1/service"; +import * as _108 from "./tx/v1beta1/tx"; +import * as _109 from "./upgrade/module/v1/module"; +import * as _110 from "./upgrade/v1beta1/query"; +import * as _111 from "./upgrade/v1beta1/tx"; +import * as _112 from "./upgrade/v1beta1/upgrade"; +import * as _113 from "./vesting/module/v1/module"; +import * as _114 from "./vesting/v1beta1/tx"; +import * as _115 from "./vesting/v1beta1/vesting"; +import * as _180 from "./auth/v1beta1/tx.amino"; +import * as _181 from "./authz/v1beta1/tx.amino"; +import * as _182 from "./bank/v1beta1/tx.amino"; +import * as _183 from "./benchmark/v1/tx.amino"; +import * as _184 from "./circuit/v1/tx.amino"; +import * as _185 from "./consensus/v1/tx.amino"; +import * as _186 from "./counter/v1/tx.amino"; +import * as _187 from "./distribution/v1beta1/tx.amino"; +import * as _188 from "./feegrant/v1beta1/tx.amino"; +import * as _189 from "./gov/v1/tx.amino"; +import * as _190 from "./gov/v1beta1/tx.amino"; +import * as _191 from "./group/v1/tx.amino"; +import * as _192 from "./mint/v1beta1/tx.amino"; +import * as _193 from "./protocolpool/v1/tx.amino"; +import * as _194 from "./staking/v1beta1/tx.amino"; +import * as _195 from "./upgrade/v1beta1/tx.amino"; +import * as _196 from "./vesting/v1beta1/tx.amino"; +import * as _197 from "./auth/v1beta1/tx.registry"; +import * as _198 from "./authz/v1beta1/tx.registry"; +import * as _199 from "./bank/v1beta1/tx.registry"; +import * as _200 from "./benchmark/v1/tx.registry"; +import * as _201 from "./circuit/v1/tx.registry"; +import * as _202 from "./consensus/v1/tx.registry"; +import * as _203 from "./counter/v1/tx.registry"; +import * as _204 from "./distribution/v1beta1/tx.registry"; +import * as _205 from "./feegrant/v1beta1/tx.registry"; +import * as _206 from "./gov/v1/tx.registry"; +import * as _207 from "./gov/v1beta1/tx.registry"; +import * as _208 from "./group/v1/tx.registry"; +import * as _209 from "./mint/v1beta1/tx.registry"; +import * as _210 from "./protocolpool/v1/tx.registry"; +import * as _211 from "./staking/v1beta1/tx.registry"; +import * as _212 from "./upgrade/v1beta1/tx.registry"; +import * as _213 from "./vesting/v1beta1/tx.registry"; +import * as _214 from "./auth/v1beta1/query.lcd"; +import * as _215 from "./authz/v1beta1/query.lcd"; +import * as _216 from "./bank/v1beta1/query.lcd"; +import * as _217 from "./base/node/v1beta1/query.lcd"; +import * as _218 from "./circuit/v1/query.lcd"; +import * as _219 from "./consensus/v1/query.lcd"; +import * as _220 from "./distribution/v1beta1/query.lcd"; +import * as _221 from "./epochs/v1beta1/query.lcd"; +import * as _222 from "./feegrant/v1beta1/query.lcd"; +import * as _223 from "./gov/v1/query.lcd"; +import * as _224 from "./gov/v1beta1/query.lcd"; +import * as _225 from "./group/v1/query.lcd"; +import * as _226 from "./mint/v1beta1/query.lcd"; +import * as _227 from "./params/v1beta1/query.lcd"; +import * as _228 from "./protocolpool/v1/query.lcd"; +import * as _229 from "./staking/v1beta1/query.lcd"; +import * as _230 from "./tx/v1beta1/service.lcd"; +import * as _231 from "./upgrade/v1beta1/query.lcd"; +import * as _232 from "./auth/v1beta1/query.rpc.Query"; +import * as _233 from "./authz/v1beta1/query.rpc.Query"; +import * as _234 from "./bank/v1beta1/query.rpc.Query"; +import * as _235 from "./base/node/v1beta1/query.rpc.Service"; +import * as _236 from "./circuit/v1/query.rpc.Query"; +import * as _237 from "./consensus/v1/query.rpc.Query"; +import * as _238 from "./counter/v1/query.rpc.Query"; +import * as _239 from "./distribution/v1beta1/query.rpc.Query"; +import * as _240 from "./epochs/v1beta1/query.rpc.Query"; +import * as _241 from "./feegrant/v1beta1/query.rpc.Query"; +import * as _242 from "./gov/v1/query.rpc.Query"; +import * as _243 from "./gov/v1beta1/query.rpc.Query"; +import * as _244 from "./group/v1/query.rpc.Query"; +import * as _245 from "./mint/v1beta1/query.rpc.Query"; +import * as _246 from "./params/v1beta1/query.rpc.Query"; +import * as _247 from "./protocolpool/v1/query.rpc.Query"; +import * as _248 from "./staking/v1beta1/query.rpc.Query"; +import * as _249 from "./tx/v1beta1/service.rpc.Service"; +import * as _250 from "./upgrade/v1beta1/query.rpc.Query"; +import * as _251 from "./auth/v1beta1/tx.rpc.msg"; +import * as _252 from "./authz/v1beta1/tx.rpc.msg"; +import * as _253 from "./bank/v1beta1/tx.rpc.msg"; +import * as _254 from "./benchmark/v1/tx.rpc.msg"; +import * as _255 from "./circuit/v1/tx.rpc.msg"; +import * as _256 from "./consensus/v1/tx.rpc.msg"; +import * as _257 from "./counter/v1/tx.rpc.msg"; +import * as _258 from "./distribution/v1beta1/tx.rpc.msg"; +import * as _259 from "./feegrant/v1beta1/tx.rpc.msg"; +import * as _260 from "./gov/v1/tx.rpc.msg"; +import * as _261 from "./gov/v1beta1/tx.rpc.msg"; +import * as _262 from "./group/v1/tx.rpc.msg"; +import * as _263 from "./mint/v1beta1/tx.rpc.msg"; +import * as _264 from "./protocolpool/v1/tx.rpc.msg"; +import * as _265 from "./staking/v1beta1/tx.rpc.msg"; +import * as _266 from "./upgrade/v1beta1/tx.rpc.msg"; +import * as _267 from "./vesting/v1beta1/tx.rpc.msg"; +import * as _308 from "./lcd"; +import * as _309 from "./rpc.query"; +import * as _310 from "./rpc.tx"; export namespace cosmos { export namespace app { - export namespace module { + export namespace runtime { export const v1alpha1 = { ..._2 }; } } export namespace auth { + export namespace module { + export const v1 = { + ..._3 + }; + } export const v1beta1 = { - ..._3, ..._4, ..._5, - ..._144, - ..._158 + ..._6, + ..._7, + ..._180, + ..._197, + ..._214, + ..._232, + ..._251 }; } export namespace authz { + export namespace module { + export const v1 = { + ..._8 + }; + } export const v1beta1 = { - ..._6, - ..._7, - ..._8, ..._9, ..._10, - ..._124, - ..._134, - ..._145, - ..._159, - ..._172 + ..._11, + ..._12, + ..._13, + ..._181, + ..._198, + ..._215, + ..._233, + ..._252 }; } export namespace bank { + export namespace module { + export const v1 = { + ..._14 + }; + } export const v1beta1 = { - ..._11, - ..._12, - ..._13, - ..._14, ..._15, - ..._125, - ..._135, - ..._146, - ..._160, - ..._173 + ..._16, + ..._17, + ..._18, + ..._19, + ..._182, + ..._199, + ..._216, + ..._234, + ..._253 }; } export namespace base { export namespace abci { export const v1beta1 = { - ..._16 + ..._20 }; } export namespace node { export const v1beta1 = { - ..._17, - ..._147, - ..._161 + ..._21, + ..._217, + ..._235 }; } export namespace query { export const v1beta1 = { - ..._18 + ..._22 }; } export namespace reflection { export const v2alpha1 = { - ..._19 + ..._23 }; } export const v1beta1 = { - ..._20 + ..._24 + }; + } + export namespace benchmark { + export namespace module { + export const v1 = { + ..._25 + }; + } + export const v1 = { + ..._26, + ..._27, + ..._183, + ..._200, + ..._254 + }; + } + export namespace circuit { + export namespace module { + export const v1 = { + ..._28 + }; + } + export const v1 = { + ..._29, + ..._30, + ..._31, + ..._184, + ..._201, + ..._218, + ..._236, + ..._255 + }; + } + export namespace consensus { + export namespace module { + export const v1 = { + ..._32 + }; + } + export const v1 = { + ..._33, + ..._34, + ..._185, + ..._202, + ..._219, + ..._237, + ..._256 + }; + } + export namespace counter { + export namespace module { + export const v1 = { + ..._35 + }; + } + export const v1 = { + ..._36, + ..._37, + ..._186, + ..._203, + ..._238, + ..._257 }; } + export namespace crisis { + export namespace module { + export const v1 = { + ..._38 + }; + } + } export namespace crypto { export const ed25519 = { - ..._21 + ..._39 }; export namespace hd { export const v1 = { - ..._22 + ..._40 }; } export namespace keyring { export const v1 = { - ..._23 + ..._41 }; } export const multisig = { - ..._24 + ..._42 }; export const secp256k1 = { - ..._25 + ..._43 }; export const secp256r1 = { - ..._26 + ..._44 }; } export namespace distribution { + export namespace module { + export const v1 = { + ..._45 + }; + } export const v1beta1 = { - ..._27, - ..._28, - ..._29, - ..._30, - ..._126, - ..._136, - ..._148, - ..._162, - ..._174 + ..._46, + ..._47, + ..._48, + ..._49, + ..._187, + ..._204, + ..._220, + ..._239, + ..._258 + }; + } + export namespace epochs { + export namespace module { + export const v1 = { + ..._50 + }; + } + export const v1beta1 = { + ..._51, + ..._52, + ..._53, + ..._221, + ..._240 }; } + export namespace evidence { + export namespace module { + export const v1 = { + ..._54 + }; + } + } export namespace feegrant { + export namespace module { + export const v1 = { + ..._55 + }; + } export const v1beta1 = { - ..._31, - ..._32, - ..._33, - ..._34, - ..._127, - ..._137, - ..._149, - ..._163, - ..._175 + ..._56, + ..._57, + ..._58, + ..._59, + ..._188, + ..._205, + ..._222, + ..._241, + ..._259 }; } + export namespace genutil { + export namespace module { + export const v1 = { + ..._60 + }; + } + } export namespace gov { + export namespace module { + export const v1 = { + ..._61 + }; + } export const v1 = { - ..._35, - ..._36, - ..._37, - ..._38, - ..._128, - ..._138, - ..._150, - ..._164, - ..._176 + ..._62, + ..._63, + ..._64, + ..._65, + ..._189, + ..._206, + ..._223, + ..._242, + ..._260 }; export const v1beta1 = { - ..._39, - ..._40, - ..._41, - ..._42, - ..._129, - ..._139, - ..._151, - ..._165, - ..._177 + ..._66, + ..._67, + ..._68, + ..._69, + ..._190, + ..._207, + ..._224, + ..._243, + ..._261 }; } export namespace group { + export namespace module { + export const v1 = { + ..._70 + }; + } export const v1 = { - ..._43, - ..._44, - ..._45, - ..._46, - ..._47, - ..._130, - ..._140, - ..._152, - ..._166, - ..._178 + ..._71, + ..._72, + ..._73, + ..._74, + ..._75, + ..._191, + ..._208, + ..._225, + ..._244, + ..._262 }; } export namespace mint { + export namespace module { + export const v1 = { + ..._76 + }; + } export const v1beta1 = { - ..._48, - ..._49, - ..._50, - ..._153, - ..._167 + ..._77, + ..._78, + ..._79, + ..._80, + ..._192, + ..._209, + ..._226, + ..._245, + ..._263 }; } - export namespace orm { + export namespace msg { + export namespace textual { + export const v1 = { + ..._81 + }; + } + } + export namespace nft { export namespace module { - export const v1alpha1 = { - ..._51 + export const v1 = { + ..._82 }; } } export namespace params { + export namespace module { + export const v1 = { + ..._83 + }; + } export const v1beta1 = { - ..._52, - ..._53, - ..._154, - ..._168 + ..._84, + ..._85, + ..._227, + ..._246 }; } + export namespace protocolpool { + export namespace module { + export const v1 = { + ..._86 + }; + } + export const v1 = { + ..._87, + ..._88, + ..._89, + ..._90, + ..._193, + ..._210, + ..._228, + ..._247, + ..._264 + }; + } + export namespace query { + export const v1 = { + ..._91 + }; + } + export namespace reflection { + export const v1 = { + ..._92 + }; + } + export namespace slashing { + export namespace module { + export const v1 = { + ..._93 + }; + } + } export namespace staking { + export namespace module { + export const v1 = { + ..._94 + }; + } export const v1beta1 = { - ..._54, - ..._55, - ..._56, - ..._57, - ..._58, - ..._131, - ..._141, - ..._155, - ..._169, - ..._179 + ..._95, + ..._96, + ..._97, + ..._98, + ..._99, + ..._194, + ..._211, + ..._229, + ..._248, + ..._265 + }; + } + export namespace store { + export namespace internal { + export namespace kv { + export const v1beta1 = { + ..._100 + }; + } + } + export namespace snapshots { + export const v1 = { + ..._101 + }; + } + export namespace streaming { + export const abci = { + ..._102 + }; + } + export const v1beta1 = { + ..._103, + ..._104 }; } export namespace tx { + export namespace config { + export const v1 = { + ..._105 + }; + } export namespace signing { export const v1beta1 = { - ..._59 + ..._106 }; } export const v1beta1 = { - ..._60, - ..._61, - ..._156, - ..._170 + ..._107, + ..._108, + ..._230, + ..._249 }; } export namespace upgrade { + export namespace module { + export const v1 = { + ..._109 + }; + } export const v1beta1 = { - ..._62, - ..._63, - ..._64, - ..._132, - ..._142, - ..._157, - ..._171, - ..._180 + ..._110, + ..._111, + ..._112, + ..._195, + ..._212, + ..._231, + ..._250, + ..._266 }; } export namespace vesting { + export namespace module { + export const v1 = { + ..._113 + }; + } export const v1beta1 = { - ..._65, - ..._66, - ..._133, - ..._143, - ..._181 + ..._114, + ..._115, + ..._196, + ..._213, + ..._267 }; } export const ClientFactory = { - ..._227, - ..._228, - ..._229 + ..._308, + ..._309, + ..._310 }; } \ No newline at end of file diff --git a/packages/api/src/cosmos/circuit/module/v1/module.ts b/packages/api/src/cosmos/circuit/module/v1/module.ts new file mode 100644 index 00000000..a7b5b2fa --- /dev/null +++ b/packages/api/src/cosmos/circuit/module/v1/module.ts @@ -0,0 +1,93 @@ +//@ts-nocheck +import { BinaryReader, BinaryWriter } from "../../../../binary"; +/** Module is the config object of the circuit module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} +export interface ModuleProtoMsg { + typeUrl: "/cosmos.circuit.module.v1.Module"; + value: Uint8Array; +} +/** Module is the config object of the circuit module. */ +export interface ModuleAmino { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority?: string; +} +export interface ModuleAminoMsg { + type: "cosmos-sdk/Module"; + value: ModuleAmino; +} +/** Module is the config object of the circuit module. */ +export interface ModuleSDKType { + authority: string; +} +function createBaseModule(): Module { + return { + authority: "" + }; +} +export const Module = { + typeUrl: "/cosmos.circuit.module.v1.Module", + encode(message: Module, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, + fromAmino(object: ModuleAmino): Module { + const message = createBaseModule(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + return message; + }, + toAmino(message: Module): ModuleAmino { + const obj: any = {}; + obj.authority = message.authority === "" ? undefined : message.authority; + return obj; + }, + fromAminoMsg(object: ModuleAminoMsg): Module { + return Module.fromAmino(object.value); + }, + toAminoMsg(message: Module): ModuleAminoMsg { + return { + type: "cosmos-sdk/Module", + value: Module.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleProtoMsg): Module { + return Module.decode(message.value); + }, + toProto(message: Module): Uint8Array { + return Module.encode(message).finish(); + }, + toProtoMsg(message: Module): ModuleProtoMsg { + return { + typeUrl: "/cosmos.circuit.module.v1.Module", + value: Module.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/circuit/v1/query.lcd.ts b/packages/api/src/cosmos/circuit/v1/query.lcd.ts new file mode 100644 index 00000000..3430b737 --- /dev/null +++ b/packages/api/src/cosmos/circuit/v1/query.lcd.ts @@ -0,0 +1,40 @@ +//@ts-nocheck +import { setPaginationParams } from "../../../helpers"; +import { LCDClient } from "@cosmology/lcd"; +import { QueryAccountRequest, AccountResponseSDKType, QueryAccountsRequest, AccountsResponseSDKType, QueryDisabledListRequest, DisabledListResponseSDKType } from "./query"; +export class LCDQueryClient { + req: LCDClient; + constructor({ + requestClient + }: { + requestClient: LCDClient; + }) { + this.req = requestClient; + this.account = this.account.bind(this); + this.accounts = this.accounts.bind(this); + this.disabledList = this.disabledList.bind(this); + } + /* Account returns account permissions. */ + async account(params: QueryAccountRequest): Promise { + const endpoint = `cosmos/circuit/v1/accounts/${params.address}`; + return await this.req.get(endpoint); + } + /* Account returns account permissions. */ + async accounts(params: QueryAccountsRequest = { + pagination: undefined + }): Promise { + const options: any = { + params: {} + }; + if (typeof params?.pagination !== "undefined") { + setPaginationParams(options, params.pagination); + } + const endpoint = `cosmos/circuit/v1/accounts`; + return await this.req.get(endpoint, options); + } + /* DisabledList returns a list of disabled message urls */ + async disabledList(_params: QueryDisabledListRequest = {}): Promise { + const endpoint = `cosmos/circuit/v1/disable_list`; + return await this.req.get(endpoint); + } +} \ No newline at end of file diff --git a/packages/api/src/cosmos/circuit/v1/query.rpc.Query.ts b/packages/api/src/cosmos/circuit/v1/query.rpc.Query.ts new file mode 100644 index 00000000..677b7d97 --- /dev/null +++ b/packages/api/src/cosmos/circuit/v1/query.rpc.Query.ts @@ -0,0 +1,55 @@ +//@ts-nocheck +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; +import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; +import { QueryAccountRequest, AccountResponse, QueryAccountsRequest, AccountsResponse, QueryDisabledListRequest, DisabledListResponse } from "./query"; +/** Query defines the circuit gRPC querier service. */ +export interface Query { + /** Account returns account permissions. */ + account(request: QueryAccountRequest): Promise; + /** Account returns account permissions. */ + accounts(request?: QueryAccountsRequest): Promise; + /** DisabledList returns a list of disabled message urls */ + disabledList(request?: QueryDisabledListRequest): Promise; +} +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + this.account = this.account.bind(this); + this.accounts = this.accounts.bind(this); + this.disabledList = this.disabledList.bind(this); + } + account(request: QueryAccountRequest): Promise { + const data = QueryAccountRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.circuit.v1.Query", "Account", data); + return promise.then(data => AccountResponse.decode(new BinaryReader(data))); + } + accounts(request: QueryAccountsRequest = { + pagination: undefined + }): Promise { + const data = QueryAccountsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.circuit.v1.Query", "Accounts", data); + return promise.then(data => AccountsResponse.decode(new BinaryReader(data))); + } + disabledList(request: QueryDisabledListRequest = {}): Promise { + const data = QueryDisabledListRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.circuit.v1.Query", "DisabledList", data); + return promise.then(data => DisabledListResponse.decode(new BinaryReader(data))); + } +} +export const createRpcQueryExtension = (base: QueryClient) => { + const rpc = createProtobufRpcClient(base); + const queryService = new QueryClientImpl(rpc); + return { + account(request: QueryAccountRequest): Promise { + return queryService.account(request); + }, + accounts(request?: QueryAccountsRequest): Promise { + return queryService.accounts(request); + }, + disabledList(request?: QueryDisabledListRequest): Promise { + return queryService.disabledList(request); + } + }; +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/circuit/v1/query.ts b/packages/api/src/cosmos/circuit/v1/query.ts new file mode 100644 index 00000000..7bfe825f --- /dev/null +++ b/packages/api/src/cosmos/circuit/v1/query.ts @@ -0,0 +1,542 @@ +//@ts-nocheck +import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { Permissions, PermissionsAmino, PermissionsSDKType, GenesisAccountPermissions, GenesisAccountPermissionsAmino, GenesisAccountPermissionsSDKType } from "./types"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +/** QueryAccountRequest is the request type for the Query/Account RPC method. */ +export interface QueryAccountRequest { + address: string; +} +export interface QueryAccountRequestProtoMsg { + typeUrl: "/cosmos.circuit.v1.QueryAccountRequest"; + value: Uint8Array; +} +/** QueryAccountRequest is the request type for the Query/Account RPC method. */ +export interface QueryAccountRequestAmino { + address?: string; +} +export interface QueryAccountRequestAminoMsg { + type: "cosmos-sdk/QueryAccountRequest"; + value: QueryAccountRequestAmino; +} +/** QueryAccountRequest is the request type for the Query/Account RPC method. */ +export interface QueryAccountRequestSDKType { + address: string; +} +/** AccountResponse is the response type for the Query/Account RPC method. */ +export interface AccountResponse { + permission?: Permissions; +} +export interface AccountResponseProtoMsg { + typeUrl: "/cosmos.circuit.v1.AccountResponse"; + value: Uint8Array; +} +/** AccountResponse is the response type for the Query/Account RPC method. */ +export interface AccountResponseAmino { + permission?: PermissionsAmino; +} +export interface AccountResponseAminoMsg { + type: "cosmos-sdk/AccountResponse"; + value: AccountResponseAmino; +} +/** AccountResponse is the response type for the Query/Account RPC method. */ +export interface AccountResponseSDKType { + permission?: PermissionsSDKType; +} +/** QueryAccountsRequest is the request type for the Query/Accounts RPC method. */ +export interface QueryAccountsRequest { + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryAccountsRequestProtoMsg { + typeUrl: "/cosmos.circuit.v1.QueryAccountsRequest"; + value: Uint8Array; +} +/** QueryAccountsRequest is the request type for the Query/Accounts RPC method. */ +export interface QueryAccountsRequestAmino { + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryAccountsRequestAminoMsg { + type: "cosmos-sdk/QueryAccountsRequest"; + value: QueryAccountsRequestAmino; +} +/** QueryAccountsRequest is the request type for the Query/Accounts RPC method. */ +export interface QueryAccountsRequestSDKType { + pagination?: PageRequestSDKType; +} +/** AccountsResponse is the response type for the Query/Accounts RPC method. */ +export interface AccountsResponse { + accounts: GenesisAccountPermissions[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface AccountsResponseProtoMsg { + typeUrl: "/cosmos.circuit.v1.AccountsResponse"; + value: Uint8Array; +} +/** AccountsResponse is the response type for the Query/Accounts RPC method. */ +export interface AccountsResponseAmino { + accounts?: GenesisAccountPermissionsAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface AccountsResponseAminoMsg { + type: "cosmos-sdk/AccountsResponse"; + value: AccountsResponseAmino; +} +/** AccountsResponse is the response type for the Query/Accounts RPC method. */ +export interface AccountsResponseSDKType { + accounts: GenesisAccountPermissionsSDKType[]; + pagination?: PageResponseSDKType; +} +/** QueryDisableListRequest is the request type for the Query/DisabledList RPC method. */ +export interface QueryDisabledListRequest {} +export interface QueryDisabledListRequestProtoMsg { + typeUrl: "/cosmos.circuit.v1.QueryDisabledListRequest"; + value: Uint8Array; +} +/** QueryDisableListRequest is the request type for the Query/DisabledList RPC method. */ +export interface QueryDisabledListRequestAmino {} +export interface QueryDisabledListRequestAminoMsg { + type: "cosmos-sdk/QueryDisabledListRequest"; + value: QueryDisabledListRequestAmino; +} +/** QueryDisableListRequest is the request type for the Query/DisabledList RPC method. */ +export interface QueryDisabledListRequestSDKType {} +/** DisabledListResponse is the response type for the Query/DisabledList RPC method. */ +export interface DisabledListResponse { + disabledList: string[]; +} +export interface DisabledListResponseProtoMsg { + typeUrl: "/cosmos.circuit.v1.DisabledListResponse"; + value: Uint8Array; +} +/** DisabledListResponse is the response type for the Query/DisabledList RPC method. */ +export interface DisabledListResponseAmino { + disabled_list?: string[]; +} +export interface DisabledListResponseAminoMsg { + type: "cosmos-sdk/DisabledListResponse"; + value: DisabledListResponseAmino; +} +/** DisabledListResponse is the response type for the Query/DisabledList RPC method. */ +export interface DisabledListResponseSDKType { + disabled_list: string[]; +} +function createBaseQueryAccountRequest(): QueryAccountRequest { + return { + address: "" + }; +} +export const QueryAccountRequest = { + typeUrl: "/cosmos.circuit.v1.QueryAccountRequest", + encode(message: QueryAccountRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountRequest(); + 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; + }, + fromPartial(object: Partial): QueryAccountRequest { + const message = createBaseQueryAccountRequest(); + message.address = object.address ?? ""; + return message; + }, + fromAmino(object: QueryAccountRequestAmino): QueryAccountRequest { + const message = createBaseQueryAccountRequest(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + return message; + }, + toAmino(message: QueryAccountRequest): QueryAccountRequestAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + return obj; + }, + fromAminoMsg(object: QueryAccountRequestAminoMsg): QueryAccountRequest { + return QueryAccountRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryAccountRequest): QueryAccountRequestAminoMsg { + return { + type: "cosmos-sdk/QueryAccountRequest", + value: QueryAccountRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAccountRequestProtoMsg): QueryAccountRequest { + return QueryAccountRequest.decode(message.value); + }, + toProto(message: QueryAccountRequest): Uint8Array { + return QueryAccountRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryAccountRequest): QueryAccountRequestProtoMsg { + return { + typeUrl: "/cosmos.circuit.v1.QueryAccountRequest", + value: QueryAccountRequest.encode(message).finish() + }; + } +}; +function createBaseAccountResponse(): AccountResponse { + return { + permission: undefined + }; +} +export const AccountResponse = { + typeUrl: "/cosmos.circuit.v1.AccountResponse", + encode(message: AccountResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.permission !== undefined) { + Permissions.encode(message.permission, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): AccountResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAccountResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.permission = Permissions.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): AccountResponse { + const message = createBaseAccountResponse(); + message.permission = object.permission !== undefined && object.permission !== null ? Permissions.fromPartial(object.permission) : undefined; + return message; + }, + fromAmino(object: AccountResponseAmino): AccountResponse { + const message = createBaseAccountResponse(); + if (object.permission !== undefined && object.permission !== null) { + message.permission = Permissions.fromAmino(object.permission); + } + return message; + }, + toAmino(message: AccountResponse): AccountResponseAmino { + const obj: any = {}; + obj.permission = message.permission ? Permissions.toAmino(message.permission) : undefined; + return obj; + }, + fromAminoMsg(object: AccountResponseAminoMsg): AccountResponse { + return AccountResponse.fromAmino(object.value); + }, + toAminoMsg(message: AccountResponse): AccountResponseAminoMsg { + return { + type: "cosmos-sdk/AccountResponse", + value: AccountResponse.toAmino(message) + }; + }, + fromProtoMsg(message: AccountResponseProtoMsg): AccountResponse { + return AccountResponse.decode(message.value); + }, + toProto(message: AccountResponse): Uint8Array { + return AccountResponse.encode(message).finish(); + }, + toProtoMsg(message: AccountResponse): AccountResponseProtoMsg { + return { + typeUrl: "/cosmos.circuit.v1.AccountResponse", + value: AccountResponse.encode(message).finish() + }; + } +}; +function createBaseQueryAccountsRequest(): QueryAccountsRequest { + return { + pagination: undefined + }; +} +export const QueryAccountsRequest = { + typeUrl: "/cosmos.circuit.v1.QueryAccountsRequest", + encode(message: QueryAccountsRequest, 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): QueryAccountsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountsRequest(); + 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; + }, + fromPartial(object: Partial): QueryAccountsRequest { + const message = createBaseQueryAccountsRequest(); + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryAccountsRequestAmino): QueryAccountsRequest { + const message = createBaseQueryAccountsRequest(); + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryAccountsRequest): QueryAccountsRequestAmino { + const obj: any = {}; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryAccountsRequestAminoMsg): QueryAccountsRequest { + return QueryAccountsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryAccountsRequest): QueryAccountsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryAccountsRequest", + value: QueryAccountsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAccountsRequestProtoMsg): QueryAccountsRequest { + return QueryAccountsRequest.decode(message.value); + }, + toProto(message: QueryAccountsRequest): Uint8Array { + return QueryAccountsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryAccountsRequest): QueryAccountsRequestProtoMsg { + return { + typeUrl: "/cosmos.circuit.v1.QueryAccountsRequest", + value: QueryAccountsRequest.encode(message).finish() + }; + } +}; +function createBaseAccountsResponse(): AccountsResponse { + return { + accounts: [], + pagination: undefined + }; +} +export const AccountsResponse = { + typeUrl: "/cosmos.circuit.v1.AccountsResponse", + encode(message: AccountsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.accounts) { + GenesisAccountPermissions.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): AccountsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAccountsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.accounts.push(GenesisAccountPermissions.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): AccountsResponse { + const message = createBaseAccountsResponse(); + message.accounts = object.accounts?.map(e => GenesisAccountPermissions.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: AccountsResponseAmino): AccountsResponse { + const message = createBaseAccountsResponse(); + message.accounts = object.accounts?.map(e => GenesisAccountPermissions.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: AccountsResponse): AccountsResponseAmino { + const obj: any = {}; + if (message.accounts) { + obj.accounts = message.accounts.map(e => e ? GenesisAccountPermissions.toAmino(e) : undefined); + } else { + obj.accounts = message.accounts; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: AccountsResponseAminoMsg): AccountsResponse { + return AccountsResponse.fromAmino(object.value); + }, + toAminoMsg(message: AccountsResponse): AccountsResponseAminoMsg { + return { + type: "cosmos-sdk/AccountsResponse", + value: AccountsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: AccountsResponseProtoMsg): AccountsResponse { + return AccountsResponse.decode(message.value); + }, + toProto(message: AccountsResponse): Uint8Array { + return AccountsResponse.encode(message).finish(); + }, + toProtoMsg(message: AccountsResponse): AccountsResponseProtoMsg { + return { + typeUrl: "/cosmos.circuit.v1.AccountsResponse", + value: AccountsResponse.encode(message).finish() + }; + } +}; +function createBaseQueryDisabledListRequest(): QueryDisabledListRequest { + return {}; +} +export const QueryDisabledListRequest = { + typeUrl: "/cosmos.circuit.v1.QueryDisabledListRequest", + encode(_: QueryDisabledListRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDisabledListRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDisabledListRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): QueryDisabledListRequest { + const message = createBaseQueryDisabledListRequest(); + return message; + }, + fromAmino(_: QueryDisabledListRequestAmino): QueryDisabledListRequest { + const message = createBaseQueryDisabledListRequest(); + return message; + }, + toAmino(_: QueryDisabledListRequest): QueryDisabledListRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryDisabledListRequestAminoMsg): QueryDisabledListRequest { + return QueryDisabledListRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryDisabledListRequest): QueryDisabledListRequestAminoMsg { + return { + type: "cosmos-sdk/QueryDisabledListRequest", + value: QueryDisabledListRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDisabledListRequestProtoMsg): QueryDisabledListRequest { + return QueryDisabledListRequest.decode(message.value); + }, + toProto(message: QueryDisabledListRequest): Uint8Array { + return QueryDisabledListRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryDisabledListRequest): QueryDisabledListRequestProtoMsg { + return { + typeUrl: "/cosmos.circuit.v1.QueryDisabledListRequest", + value: QueryDisabledListRequest.encode(message).finish() + }; + } +}; +function createBaseDisabledListResponse(): DisabledListResponse { + return { + disabledList: [] + }; +} +export const DisabledListResponse = { + typeUrl: "/cosmos.circuit.v1.DisabledListResponse", + encode(message: DisabledListResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.disabledList) { + writer.uint32(10).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): DisabledListResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDisabledListResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.disabledList.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): DisabledListResponse { + const message = createBaseDisabledListResponse(); + message.disabledList = object.disabledList?.map(e => e) || []; + return message; + }, + fromAmino(object: DisabledListResponseAmino): DisabledListResponse { + const message = createBaseDisabledListResponse(); + message.disabledList = object.disabled_list?.map(e => e) || []; + return message; + }, + toAmino(message: DisabledListResponse): DisabledListResponseAmino { + const obj: any = {}; + if (message.disabledList) { + obj.disabled_list = message.disabledList.map(e => e); + } else { + obj.disabled_list = message.disabledList; + } + return obj; + }, + fromAminoMsg(object: DisabledListResponseAminoMsg): DisabledListResponse { + return DisabledListResponse.fromAmino(object.value); + }, + toAminoMsg(message: DisabledListResponse): DisabledListResponseAminoMsg { + return { + type: "cosmos-sdk/DisabledListResponse", + value: DisabledListResponse.toAmino(message) + }; + }, + fromProtoMsg(message: DisabledListResponseProtoMsg): DisabledListResponse { + return DisabledListResponse.decode(message.value); + }, + toProto(message: DisabledListResponse): Uint8Array { + return DisabledListResponse.encode(message).finish(); + }, + toProtoMsg(message: DisabledListResponse): DisabledListResponseProtoMsg { + return { + typeUrl: "/cosmos.circuit.v1.DisabledListResponse", + value: DisabledListResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/circuit/v1/tx.amino.ts b/packages/api/src/cosmos/circuit/v1/tx.amino.ts new file mode 100644 index 00000000..ebaf6c9d --- /dev/null +++ b/packages/api/src/cosmos/circuit/v1/tx.amino.ts @@ -0,0 +1,19 @@ +//@ts-nocheck +import { MsgAuthorizeCircuitBreaker, MsgTripCircuitBreaker, MsgResetCircuitBreaker } from "./tx"; +export const AminoConverter = { + "/cosmos.circuit.v1.MsgAuthorizeCircuitBreaker": { + aminoType: "cosmos-sdk/MsgAuthorizeCircuitBreaker", + toAmino: MsgAuthorizeCircuitBreaker.toAmino, + fromAmino: MsgAuthorizeCircuitBreaker.fromAmino + }, + "/cosmos.circuit.v1.MsgTripCircuitBreaker": { + aminoType: "cosmos-sdk/MsgTripCircuitBreaker", + toAmino: MsgTripCircuitBreaker.toAmino, + fromAmino: MsgTripCircuitBreaker.fromAmino + }, + "/cosmos.circuit.v1.MsgResetCircuitBreaker": { + aminoType: "cosmos-sdk/MsgResetCircuitBreaker", + toAmino: MsgResetCircuitBreaker.toAmino, + fromAmino: MsgResetCircuitBreaker.fromAmino + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/circuit/v1/tx.registry.ts b/packages/api/src/cosmos/circuit/v1/tx.registry.ts new file mode 100644 index 00000000..067239da --- /dev/null +++ b/packages/api/src/cosmos/circuit/v1/tx.registry.ts @@ -0,0 +1,71 @@ +//@ts-nocheck +import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { MsgAuthorizeCircuitBreaker, MsgTripCircuitBreaker, MsgResetCircuitBreaker } from "./tx"; +export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.circuit.v1.MsgAuthorizeCircuitBreaker", MsgAuthorizeCircuitBreaker], ["/cosmos.circuit.v1.MsgTripCircuitBreaker", MsgTripCircuitBreaker], ["/cosmos.circuit.v1.MsgResetCircuitBreaker", MsgResetCircuitBreaker]]; +export const load = (protoRegistry: Registry) => { + registry.forEach(([typeUrl, mod]) => { + protoRegistry.register(typeUrl, mod); + }); +}; +export const MessageComposer = { + encoded: { + authorizeCircuitBreaker(value: MsgAuthorizeCircuitBreaker) { + return { + typeUrl: "/cosmos.circuit.v1.MsgAuthorizeCircuitBreaker", + value: MsgAuthorizeCircuitBreaker.encode(value).finish() + }; + }, + tripCircuitBreaker(value: MsgTripCircuitBreaker) { + return { + typeUrl: "/cosmos.circuit.v1.MsgTripCircuitBreaker", + value: MsgTripCircuitBreaker.encode(value).finish() + }; + }, + resetCircuitBreaker(value: MsgResetCircuitBreaker) { + return { + typeUrl: "/cosmos.circuit.v1.MsgResetCircuitBreaker", + value: MsgResetCircuitBreaker.encode(value).finish() + }; + } + }, + withTypeUrl: { + authorizeCircuitBreaker(value: MsgAuthorizeCircuitBreaker) { + return { + typeUrl: "/cosmos.circuit.v1.MsgAuthorizeCircuitBreaker", + value + }; + }, + tripCircuitBreaker(value: MsgTripCircuitBreaker) { + return { + typeUrl: "/cosmos.circuit.v1.MsgTripCircuitBreaker", + value + }; + }, + resetCircuitBreaker(value: MsgResetCircuitBreaker) { + return { + typeUrl: "/cosmos.circuit.v1.MsgResetCircuitBreaker", + value + }; + } + }, + fromPartial: { + authorizeCircuitBreaker(value: MsgAuthorizeCircuitBreaker) { + return { + typeUrl: "/cosmos.circuit.v1.MsgAuthorizeCircuitBreaker", + value: MsgAuthorizeCircuitBreaker.fromPartial(value) + }; + }, + tripCircuitBreaker(value: MsgTripCircuitBreaker) { + return { + typeUrl: "/cosmos.circuit.v1.MsgTripCircuitBreaker", + value: MsgTripCircuitBreaker.fromPartial(value) + }; + }, + resetCircuitBreaker(value: MsgResetCircuitBreaker) { + return { + typeUrl: "/cosmos.circuit.v1.MsgResetCircuitBreaker", + value: MsgResetCircuitBreaker.fromPartial(value) + }; + } + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/circuit/v1/tx.rpc.msg.ts b/packages/api/src/cosmos/circuit/v1/tx.rpc.msg.ts new file mode 100644 index 00000000..51d19052 --- /dev/null +++ b/packages/api/src/cosmos/circuit/v1/tx.rpc.msg.ts @@ -0,0 +1,43 @@ +//@ts-nocheck +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; +import { MsgAuthorizeCircuitBreaker, MsgAuthorizeCircuitBreakerResponse, MsgTripCircuitBreaker, MsgTripCircuitBreakerResponse, MsgResetCircuitBreaker, MsgResetCircuitBreakerResponse } from "./tx"; +/** Msg defines the circuit Msg service. */ +export interface Msg { + /** + * AuthorizeCircuitBreaker allows a super-admin to grant (or revoke) another + * account's circuit breaker permissions. + */ + authorizeCircuitBreaker(request: MsgAuthorizeCircuitBreaker): Promise; + /** TripCircuitBreaker pauses processing of Msg's in the state machine. */ + tripCircuitBreaker(request: MsgTripCircuitBreaker): Promise; + /** + * ResetCircuitBreaker resumes processing of Msg's in the state machine that + * have been been paused using TripCircuitBreaker. + */ + resetCircuitBreaker(request: MsgResetCircuitBreaker): Promise; +} +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + this.authorizeCircuitBreaker = this.authorizeCircuitBreaker.bind(this); + this.tripCircuitBreaker = this.tripCircuitBreaker.bind(this); + this.resetCircuitBreaker = this.resetCircuitBreaker.bind(this); + } + authorizeCircuitBreaker(request: MsgAuthorizeCircuitBreaker): Promise { + const data = MsgAuthorizeCircuitBreaker.encode(request).finish(); + const promise = this.rpc.request("cosmos.circuit.v1.Msg", "AuthorizeCircuitBreaker", data); + return promise.then(data => MsgAuthorizeCircuitBreakerResponse.decode(new BinaryReader(data))); + } + tripCircuitBreaker(request: MsgTripCircuitBreaker): Promise { + const data = MsgTripCircuitBreaker.encode(request).finish(); + const promise = this.rpc.request("cosmos.circuit.v1.Msg", "TripCircuitBreaker", data); + return promise.then(data => MsgTripCircuitBreakerResponse.decode(new BinaryReader(data))); + } + resetCircuitBreaker(request: MsgResetCircuitBreaker): Promise { + const data = MsgResetCircuitBreaker.encode(request).finish(); + const promise = this.rpc.request("cosmos.circuit.v1.Msg", "ResetCircuitBreaker", data); + return promise.then(data => MsgResetCircuitBreakerResponse.decode(new BinaryReader(data))); + } +} \ No newline at end of file diff --git a/packages/api/src/cosmos/circuit/v1/tx.ts b/packages/api/src/cosmos/circuit/v1/tx.ts new file mode 100644 index 00000000..924804d3 --- /dev/null +++ b/packages/api/src/cosmos/circuit/v1/tx.ts @@ -0,0 +1,649 @@ +//@ts-nocheck +import { Permissions, PermissionsAmino, PermissionsSDKType } from "./types"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +/** MsgAuthorizeCircuitBreaker defines the Msg/AuthorizeCircuitBreaker request type. */ +export interface MsgAuthorizeCircuitBreaker { + /** + * granter is the granter of the circuit breaker permissions and must have + * LEVEL_SUPER_ADMIN. + */ + granter: string; + /** grantee is the account authorized with the provided permissions. */ + grantee: string; + /** + * permissions are the circuit breaker permissions that the grantee receives. + * These will overwrite any existing permissions. LEVEL_NONE_UNSPECIFIED can + * be specified to revoke all permissions. + */ + permissions?: Permissions; +} +export interface MsgAuthorizeCircuitBreakerProtoMsg { + typeUrl: "/cosmos.circuit.v1.MsgAuthorizeCircuitBreaker"; + value: Uint8Array; +} +/** MsgAuthorizeCircuitBreaker defines the Msg/AuthorizeCircuitBreaker request type. */ +export interface MsgAuthorizeCircuitBreakerAmino { + /** + * granter is the granter of the circuit breaker permissions and must have + * LEVEL_SUPER_ADMIN. + */ + granter?: string; + /** grantee is the account authorized with the provided permissions. */ + grantee?: string; + /** + * permissions are the circuit breaker permissions that the grantee receives. + * These will overwrite any existing permissions. LEVEL_NONE_UNSPECIFIED can + * be specified to revoke all permissions. + */ + permissions?: PermissionsAmino; +} +export interface MsgAuthorizeCircuitBreakerAminoMsg { + type: "cosmos-sdk/MsgAuthorizeCircuitBreaker"; + value: MsgAuthorizeCircuitBreakerAmino; +} +/** MsgAuthorizeCircuitBreaker defines the Msg/AuthorizeCircuitBreaker request type. */ +export interface MsgAuthorizeCircuitBreakerSDKType { + granter: string; + grantee: string; + permissions?: PermissionsSDKType; +} +/** MsgAuthorizeCircuitBreakerResponse defines the Msg/AuthorizeCircuitBreaker response type. */ +export interface MsgAuthorizeCircuitBreakerResponse { + success: boolean; +} +export interface MsgAuthorizeCircuitBreakerResponseProtoMsg { + typeUrl: "/cosmos.circuit.v1.MsgAuthorizeCircuitBreakerResponse"; + value: Uint8Array; +} +/** MsgAuthorizeCircuitBreakerResponse defines the Msg/AuthorizeCircuitBreaker response type. */ +export interface MsgAuthorizeCircuitBreakerResponseAmino { + success?: boolean; +} +export interface MsgAuthorizeCircuitBreakerResponseAminoMsg { + type: "cosmos-sdk/MsgAuthorizeCircuitBreakerResponse"; + value: MsgAuthorizeCircuitBreakerResponseAmino; +} +/** MsgAuthorizeCircuitBreakerResponse defines the Msg/AuthorizeCircuitBreaker response type. */ +export interface MsgAuthorizeCircuitBreakerResponseSDKType { + success: boolean; +} +/** MsgTripCircuitBreaker defines the Msg/TripCircuitBreaker request type. */ +export interface MsgTripCircuitBreaker { + /** authority is the account authorized to trip the circuit breaker. */ + authority: string; + /** + * msg_type_urls specifies a list of type URLs to immediately stop processing. + * IF IT IS LEFT EMPTY, ALL MSG PROCESSING WILL STOP IMMEDIATELY. + * This value is validated against the authority's permissions and if the + * authority does not have permissions to trip the specified msg type URLs + * (or all URLs), the operation will fail. + */ + msgTypeUrls: string[]; +} +export interface MsgTripCircuitBreakerProtoMsg { + typeUrl: "/cosmos.circuit.v1.MsgTripCircuitBreaker"; + value: Uint8Array; +} +/** MsgTripCircuitBreaker defines the Msg/TripCircuitBreaker request type. */ +export interface MsgTripCircuitBreakerAmino { + /** authority is the account authorized to trip the circuit breaker. */ + authority?: string; + /** + * msg_type_urls specifies a list of type URLs to immediately stop processing. + * IF IT IS LEFT EMPTY, ALL MSG PROCESSING WILL STOP IMMEDIATELY. + * This value is validated against the authority's permissions and if the + * authority does not have permissions to trip the specified msg type URLs + * (or all URLs), the operation will fail. + */ + msg_type_urls?: string[]; +} +export interface MsgTripCircuitBreakerAminoMsg { + type: "cosmos-sdk/MsgTripCircuitBreaker"; + value: MsgTripCircuitBreakerAmino; +} +/** MsgTripCircuitBreaker defines the Msg/TripCircuitBreaker request type. */ +export interface MsgTripCircuitBreakerSDKType { + authority: string; + msg_type_urls: string[]; +} +/** MsgTripCircuitBreakerResponse defines the Msg/TripCircuitBreaker response type. */ +export interface MsgTripCircuitBreakerResponse { + success: boolean; +} +export interface MsgTripCircuitBreakerResponseProtoMsg { + typeUrl: "/cosmos.circuit.v1.MsgTripCircuitBreakerResponse"; + value: Uint8Array; +} +/** MsgTripCircuitBreakerResponse defines the Msg/TripCircuitBreaker response type. */ +export interface MsgTripCircuitBreakerResponseAmino { + success?: boolean; +} +export interface MsgTripCircuitBreakerResponseAminoMsg { + type: "cosmos-sdk/MsgTripCircuitBreakerResponse"; + value: MsgTripCircuitBreakerResponseAmino; +} +/** MsgTripCircuitBreakerResponse defines the Msg/TripCircuitBreaker response type. */ +export interface MsgTripCircuitBreakerResponseSDKType { + success: boolean; +} +/** MsgResetCircuitBreaker defines the Msg/ResetCircuitBreaker request type. */ +export interface MsgResetCircuitBreaker { + /** authority is the account authorized to trip or reset the circuit breaker. */ + authority: string; + /** + * msg_type_urls specifies a list of Msg type URLs to resume processing. If + * it is left empty all Msg processing for type URLs that the account is + * authorized to trip will resume. + */ + msgTypeUrls: string[]; +} +export interface MsgResetCircuitBreakerProtoMsg { + typeUrl: "/cosmos.circuit.v1.MsgResetCircuitBreaker"; + value: Uint8Array; +} +/** MsgResetCircuitBreaker defines the Msg/ResetCircuitBreaker request type. */ +export interface MsgResetCircuitBreakerAmino { + /** authority is the account authorized to trip or reset the circuit breaker. */ + authority?: string; + /** + * msg_type_urls specifies a list of Msg type URLs to resume processing. If + * it is left empty all Msg processing for type URLs that the account is + * authorized to trip will resume. + */ + msg_type_urls?: string[]; +} +export interface MsgResetCircuitBreakerAminoMsg { + type: "cosmos-sdk/MsgResetCircuitBreaker"; + value: MsgResetCircuitBreakerAmino; +} +/** MsgResetCircuitBreaker defines the Msg/ResetCircuitBreaker request type. */ +export interface MsgResetCircuitBreakerSDKType { + authority: string; + msg_type_urls: string[]; +} +/** MsgResetCircuitBreakerResponse defines the Msg/ResetCircuitBreaker response type. */ +export interface MsgResetCircuitBreakerResponse { + success: boolean; +} +export interface MsgResetCircuitBreakerResponseProtoMsg { + typeUrl: "/cosmos.circuit.v1.MsgResetCircuitBreakerResponse"; + value: Uint8Array; +} +/** MsgResetCircuitBreakerResponse defines the Msg/ResetCircuitBreaker response type. */ +export interface MsgResetCircuitBreakerResponseAmino { + success?: boolean; +} +export interface MsgResetCircuitBreakerResponseAminoMsg { + type: "cosmos-sdk/MsgResetCircuitBreakerResponse"; + value: MsgResetCircuitBreakerResponseAmino; +} +/** MsgResetCircuitBreakerResponse defines the Msg/ResetCircuitBreaker response type. */ +export interface MsgResetCircuitBreakerResponseSDKType { + success: boolean; +} +function createBaseMsgAuthorizeCircuitBreaker(): MsgAuthorizeCircuitBreaker { + return { + granter: "", + grantee: "", + permissions: undefined + }; +} +export const MsgAuthorizeCircuitBreaker = { + typeUrl: "/cosmos.circuit.v1.MsgAuthorizeCircuitBreaker", + encode(message: MsgAuthorizeCircuitBreaker, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.permissions !== undefined) { + Permissions.encode(message.permissions, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgAuthorizeCircuitBreaker { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgAuthorizeCircuitBreaker(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.granter = reader.string(); + break; + case 2: + message.grantee = reader.string(); + break; + case 3: + message.permissions = Permissions.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgAuthorizeCircuitBreaker { + const message = createBaseMsgAuthorizeCircuitBreaker(); + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + message.permissions = object.permissions !== undefined && object.permissions !== null ? Permissions.fromPartial(object.permissions) : undefined; + return message; + }, + fromAmino(object: MsgAuthorizeCircuitBreakerAmino): MsgAuthorizeCircuitBreaker { + const message = createBaseMsgAuthorizeCircuitBreaker(); + if (object.granter !== undefined && object.granter !== null) { + message.granter = object.granter; + } + if (object.grantee !== undefined && object.grantee !== null) { + message.grantee = object.grantee; + } + if (object.permissions !== undefined && object.permissions !== null) { + message.permissions = Permissions.fromAmino(object.permissions); + } + return message; + }, + toAmino(message: MsgAuthorizeCircuitBreaker): MsgAuthorizeCircuitBreakerAmino { + const obj: any = {}; + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; + obj.permissions = message.permissions ? Permissions.toAmino(message.permissions) : undefined; + return obj; + }, + fromAminoMsg(object: MsgAuthorizeCircuitBreakerAminoMsg): MsgAuthorizeCircuitBreaker { + return MsgAuthorizeCircuitBreaker.fromAmino(object.value); + }, + toAminoMsg(message: MsgAuthorizeCircuitBreaker): MsgAuthorizeCircuitBreakerAminoMsg { + return { + type: "cosmos-sdk/MsgAuthorizeCircuitBreaker", + value: MsgAuthorizeCircuitBreaker.toAmino(message) + }; + }, + fromProtoMsg(message: MsgAuthorizeCircuitBreakerProtoMsg): MsgAuthorizeCircuitBreaker { + return MsgAuthorizeCircuitBreaker.decode(message.value); + }, + toProto(message: MsgAuthorizeCircuitBreaker): Uint8Array { + return MsgAuthorizeCircuitBreaker.encode(message).finish(); + }, + toProtoMsg(message: MsgAuthorizeCircuitBreaker): MsgAuthorizeCircuitBreakerProtoMsg { + return { + typeUrl: "/cosmos.circuit.v1.MsgAuthorizeCircuitBreaker", + value: MsgAuthorizeCircuitBreaker.encode(message).finish() + }; + } +}; +function createBaseMsgAuthorizeCircuitBreakerResponse(): MsgAuthorizeCircuitBreakerResponse { + return { + success: false + }; +} +export const MsgAuthorizeCircuitBreakerResponse = { + typeUrl: "/cosmos.circuit.v1.MsgAuthorizeCircuitBreakerResponse", + encode(message: MsgAuthorizeCircuitBreakerResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.success === true) { + writer.uint32(8).bool(message.success); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgAuthorizeCircuitBreakerResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgAuthorizeCircuitBreakerResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.success = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgAuthorizeCircuitBreakerResponse { + const message = createBaseMsgAuthorizeCircuitBreakerResponse(); + message.success = object.success ?? false; + return message; + }, + fromAmino(object: MsgAuthorizeCircuitBreakerResponseAmino): MsgAuthorizeCircuitBreakerResponse { + const message = createBaseMsgAuthorizeCircuitBreakerResponse(); + if (object.success !== undefined && object.success !== null) { + message.success = object.success; + } + return message; + }, + toAmino(message: MsgAuthorizeCircuitBreakerResponse): MsgAuthorizeCircuitBreakerResponseAmino { + const obj: any = {}; + obj.success = message.success === false ? undefined : message.success; + return obj; + }, + fromAminoMsg(object: MsgAuthorizeCircuitBreakerResponseAminoMsg): MsgAuthorizeCircuitBreakerResponse { + return MsgAuthorizeCircuitBreakerResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgAuthorizeCircuitBreakerResponse): MsgAuthorizeCircuitBreakerResponseAminoMsg { + return { + type: "cosmos-sdk/MsgAuthorizeCircuitBreakerResponse", + value: MsgAuthorizeCircuitBreakerResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgAuthorizeCircuitBreakerResponseProtoMsg): MsgAuthorizeCircuitBreakerResponse { + return MsgAuthorizeCircuitBreakerResponse.decode(message.value); + }, + toProto(message: MsgAuthorizeCircuitBreakerResponse): Uint8Array { + return MsgAuthorizeCircuitBreakerResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgAuthorizeCircuitBreakerResponse): MsgAuthorizeCircuitBreakerResponseProtoMsg { + return { + typeUrl: "/cosmos.circuit.v1.MsgAuthorizeCircuitBreakerResponse", + value: MsgAuthorizeCircuitBreakerResponse.encode(message).finish() + }; + } +}; +function createBaseMsgTripCircuitBreaker(): MsgTripCircuitBreaker { + return { + authority: "", + msgTypeUrls: [] + }; +} +export const MsgTripCircuitBreaker = { + typeUrl: "/cosmos.circuit.v1.MsgTripCircuitBreaker", + encode(message: MsgTripCircuitBreaker, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + for (const v of message.msgTypeUrls) { + writer.uint32(18).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgTripCircuitBreaker { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgTripCircuitBreaker(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.msgTypeUrls.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgTripCircuitBreaker { + const message = createBaseMsgTripCircuitBreaker(); + message.authority = object.authority ?? ""; + message.msgTypeUrls = object.msgTypeUrls?.map(e => e) || []; + return message; + }, + fromAmino(object: MsgTripCircuitBreakerAmino): MsgTripCircuitBreaker { + const message = createBaseMsgTripCircuitBreaker(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + message.msgTypeUrls = object.msg_type_urls?.map(e => e) || []; + return message; + }, + toAmino(message: MsgTripCircuitBreaker): MsgTripCircuitBreakerAmino { + const obj: any = {}; + obj.authority = message.authority === "" ? undefined : message.authority; + if (message.msgTypeUrls) { + obj.msg_type_urls = message.msgTypeUrls.map(e => e); + } else { + obj.msg_type_urls = message.msgTypeUrls; + } + return obj; + }, + fromAminoMsg(object: MsgTripCircuitBreakerAminoMsg): MsgTripCircuitBreaker { + return MsgTripCircuitBreaker.fromAmino(object.value); + }, + toAminoMsg(message: MsgTripCircuitBreaker): MsgTripCircuitBreakerAminoMsg { + return { + type: "cosmos-sdk/MsgTripCircuitBreaker", + value: MsgTripCircuitBreaker.toAmino(message) + }; + }, + fromProtoMsg(message: MsgTripCircuitBreakerProtoMsg): MsgTripCircuitBreaker { + return MsgTripCircuitBreaker.decode(message.value); + }, + toProto(message: MsgTripCircuitBreaker): Uint8Array { + return MsgTripCircuitBreaker.encode(message).finish(); + }, + toProtoMsg(message: MsgTripCircuitBreaker): MsgTripCircuitBreakerProtoMsg { + return { + typeUrl: "/cosmos.circuit.v1.MsgTripCircuitBreaker", + value: MsgTripCircuitBreaker.encode(message).finish() + }; + } +}; +function createBaseMsgTripCircuitBreakerResponse(): MsgTripCircuitBreakerResponse { + return { + success: false + }; +} +export const MsgTripCircuitBreakerResponse = { + typeUrl: "/cosmos.circuit.v1.MsgTripCircuitBreakerResponse", + encode(message: MsgTripCircuitBreakerResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.success === true) { + writer.uint32(8).bool(message.success); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgTripCircuitBreakerResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgTripCircuitBreakerResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.success = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgTripCircuitBreakerResponse { + const message = createBaseMsgTripCircuitBreakerResponse(); + message.success = object.success ?? false; + return message; + }, + fromAmino(object: MsgTripCircuitBreakerResponseAmino): MsgTripCircuitBreakerResponse { + const message = createBaseMsgTripCircuitBreakerResponse(); + if (object.success !== undefined && object.success !== null) { + message.success = object.success; + } + return message; + }, + toAmino(message: MsgTripCircuitBreakerResponse): MsgTripCircuitBreakerResponseAmino { + const obj: any = {}; + obj.success = message.success === false ? undefined : message.success; + return obj; + }, + fromAminoMsg(object: MsgTripCircuitBreakerResponseAminoMsg): MsgTripCircuitBreakerResponse { + return MsgTripCircuitBreakerResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgTripCircuitBreakerResponse): MsgTripCircuitBreakerResponseAminoMsg { + return { + type: "cosmos-sdk/MsgTripCircuitBreakerResponse", + value: MsgTripCircuitBreakerResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgTripCircuitBreakerResponseProtoMsg): MsgTripCircuitBreakerResponse { + return MsgTripCircuitBreakerResponse.decode(message.value); + }, + toProto(message: MsgTripCircuitBreakerResponse): Uint8Array { + return MsgTripCircuitBreakerResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgTripCircuitBreakerResponse): MsgTripCircuitBreakerResponseProtoMsg { + return { + typeUrl: "/cosmos.circuit.v1.MsgTripCircuitBreakerResponse", + value: MsgTripCircuitBreakerResponse.encode(message).finish() + }; + } +}; +function createBaseMsgResetCircuitBreaker(): MsgResetCircuitBreaker { + return { + authority: "", + msgTypeUrls: [] + }; +} +export const MsgResetCircuitBreaker = { + typeUrl: "/cosmos.circuit.v1.MsgResetCircuitBreaker", + encode(message: MsgResetCircuitBreaker, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + for (const v of message.msgTypeUrls) { + writer.uint32(26).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgResetCircuitBreaker { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgResetCircuitBreaker(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 3: + message.msgTypeUrls.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgResetCircuitBreaker { + const message = createBaseMsgResetCircuitBreaker(); + message.authority = object.authority ?? ""; + message.msgTypeUrls = object.msgTypeUrls?.map(e => e) || []; + return message; + }, + fromAmino(object: MsgResetCircuitBreakerAmino): MsgResetCircuitBreaker { + const message = createBaseMsgResetCircuitBreaker(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + message.msgTypeUrls = object.msg_type_urls?.map(e => e) || []; + return message; + }, + toAmino(message: MsgResetCircuitBreaker): MsgResetCircuitBreakerAmino { + const obj: any = {}; + obj.authority = message.authority === "" ? undefined : message.authority; + if (message.msgTypeUrls) { + obj.msg_type_urls = message.msgTypeUrls.map(e => e); + } else { + obj.msg_type_urls = message.msgTypeUrls; + } + return obj; + }, + fromAminoMsg(object: MsgResetCircuitBreakerAminoMsg): MsgResetCircuitBreaker { + return MsgResetCircuitBreaker.fromAmino(object.value); + }, + toAminoMsg(message: MsgResetCircuitBreaker): MsgResetCircuitBreakerAminoMsg { + return { + type: "cosmos-sdk/MsgResetCircuitBreaker", + value: MsgResetCircuitBreaker.toAmino(message) + }; + }, + fromProtoMsg(message: MsgResetCircuitBreakerProtoMsg): MsgResetCircuitBreaker { + return MsgResetCircuitBreaker.decode(message.value); + }, + toProto(message: MsgResetCircuitBreaker): Uint8Array { + return MsgResetCircuitBreaker.encode(message).finish(); + }, + toProtoMsg(message: MsgResetCircuitBreaker): MsgResetCircuitBreakerProtoMsg { + return { + typeUrl: "/cosmos.circuit.v1.MsgResetCircuitBreaker", + value: MsgResetCircuitBreaker.encode(message).finish() + }; + } +}; +function createBaseMsgResetCircuitBreakerResponse(): MsgResetCircuitBreakerResponse { + return { + success: false + }; +} +export const MsgResetCircuitBreakerResponse = { + typeUrl: "/cosmos.circuit.v1.MsgResetCircuitBreakerResponse", + encode(message: MsgResetCircuitBreakerResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.success === true) { + writer.uint32(8).bool(message.success); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgResetCircuitBreakerResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgResetCircuitBreakerResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.success = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgResetCircuitBreakerResponse { + const message = createBaseMsgResetCircuitBreakerResponse(); + message.success = object.success ?? false; + return message; + }, + fromAmino(object: MsgResetCircuitBreakerResponseAmino): MsgResetCircuitBreakerResponse { + const message = createBaseMsgResetCircuitBreakerResponse(); + if (object.success !== undefined && object.success !== null) { + message.success = object.success; + } + return message; + }, + toAmino(message: MsgResetCircuitBreakerResponse): MsgResetCircuitBreakerResponseAmino { + const obj: any = {}; + obj.success = message.success === false ? undefined : message.success; + return obj; + }, + fromAminoMsg(object: MsgResetCircuitBreakerResponseAminoMsg): MsgResetCircuitBreakerResponse { + return MsgResetCircuitBreakerResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgResetCircuitBreakerResponse): MsgResetCircuitBreakerResponseAminoMsg { + return { + type: "cosmos-sdk/MsgResetCircuitBreakerResponse", + value: MsgResetCircuitBreakerResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgResetCircuitBreakerResponseProtoMsg): MsgResetCircuitBreakerResponse { + return MsgResetCircuitBreakerResponse.decode(message.value); + }, + toProto(message: MsgResetCircuitBreakerResponse): Uint8Array { + return MsgResetCircuitBreakerResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgResetCircuitBreakerResponse): MsgResetCircuitBreakerResponseProtoMsg { + return { + typeUrl: "/cosmos.circuit.v1.MsgResetCircuitBreakerResponse", + value: MsgResetCircuitBreakerResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/circuit/v1/types.ts b/packages/api/src/cosmos/circuit/v1/types.ts new file mode 100644 index 00000000..3c6f899d --- /dev/null +++ b/packages/api/src/cosmos/circuit/v1/types.ts @@ -0,0 +1,404 @@ +//@ts-nocheck +import { BinaryReader, BinaryWriter } from "../../../binary"; +/** Level is the permission level. */ +export enum Permissions_Level { + /** + * LEVEL_NONE_UNSPECIFIED - LEVEL_NONE_UNSPECIFIED indicates that the account will have no circuit + * breaker permissions. + */ + LEVEL_NONE_UNSPECIFIED = 0, + /** + * LEVEL_SOME_MSGS - LEVEL_SOME_MSGS indicates that the account will have permission to + * trip or reset the circuit breaker for some Msg type URLs. If this level + * is chosen, a non-empty list of Msg type URLs must be provided in + * limit_type_urls. + */ + LEVEL_SOME_MSGS = 1, + /** + * LEVEL_ALL_MSGS - LEVEL_ALL_MSGS indicates that the account can trip or reset the circuit + * breaker for Msg's of all type URLs. + */ + LEVEL_ALL_MSGS = 2, + /** + * LEVEL_SUPER_ADMIN - LEVEL_SUPER_ADMIN indicates that the account can take all circuit breaker + * actions and can grant permissions to other accounts. + */ + LEVEL_SUPER_ADMIN = 3, + UNRECOGNIZED = -1, +} +export const Permissions_LevelSDKType = Permissions_Level; +export const Permissions_LevelAmino = Permissions_Level; +export function permissions_LevelFromJSON(object: any): Permissions_Level { + switch (object) { + case 0: + case "LEVEL_NONE_UNSPECIFIED": + return Permissions_Level.LEVEL_NONE_UNSPECIFIED; + case 1: + case "LEVEL_SOME_MSGS": + return Permissions_Level.LEVEL_SOME_MSGS; + case 2: + case "LEVEL_ALL_MSGS": + return Permissions_Level.LEVEL_ALL_MSGS; + case 3: + case "LEVEL_SUPER_ADMIN": + return Permissions_Level.LEVEL_SUPER_ADMIN; + case -1: + case "UNRECOGNIZED": + default: + return Permissions_Level.UNRECOGNIZED; + } +} +export function permissions_LevelToJSON(object: Permissions_Level): string { + switch (object) { + case Permissions_Level.LEVEL_NONE_UNSPECIFIED: + return "LEVEL_NONE_UNSPECIFIED"; + case Permissions_Level.LEVEL_SOME_MSGS: + return "LEVEL_SOME_MSGS"; + case Permissions_Level.LEVEL_ALL_MSGS: + return "LEVEL_ALL_MSGS"; + case Permissions_Level.LEVEL_SUPER_ADMIN: + return "LEVEL_SUPER_ADMIN"; + case Permissions_Level.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** + * Permissions are the permissions that an account has to trip + * or reset the circuit breaker. + */ +export interface Permissions { + /** level is the level of permissions granted to this account. */ + level: Permissions_Level; + /** + * limit_type_urls is used with LEVEL_SOME_MSGS to limit the lists of Msg type + * URLs that the account can trip. It is an error to use limit_type_urls with + * a level other than LEVEL_SOME_MSGS. + */ + limitTypeUrls: string[]; +} +export interface PermissionsProtoMsg { + typeUrl: "/cosmos.circuit.v1.Permissions"; + value: Uint8Array; +} +/** + * Permissions are the permissions that an account has to trip + * or reset the circuit breaker. + */ +export interface PermissionsAmino { + /** level is the level of permissions granted to this account. */ + level?: Permissions_Level; + /** + * limit_type_urls is used with LEVEL_SOME_MSGS to limit the lists of Msg type + * URLs that the account can trip. It is an error to use limit_type_urls with + * a level other than LEVEL_SOME_MSGS. + */ + limit_type_urls?: string[]; +} +export interface PermissionsAminoMsg { + type: "cosmos-sdk/Permissions"; + value: PermissionsAmino; +} +/** + * Permissions are the permissions that an account has to trip + * or reset the circuit breaker. + */ +export interface PermissionsSDKType { + level: Permissions_Level; + limit_type_urls: string[]; +} +/** GenesisAccountPermissions is the account permissions for the circuit breaker in genesis */ +export interface GenesisAccountPermissions { + address: string; + permissions?: Permissions; +} +export interface GenesisAccountPermissionsProtoMsg { + typeUrl: "/cosmos.circuit.v1.GenesisAccountPermissions"; + value: Uint8Array; +} +/** GenesisAccountPermissions is the account permissions for the circuit breaker in genesis */ +export interface GenesisAccountPermissionsAmino { + address?: string; + permissions?: PermissionsAmino; +} +export interface GenesisAccountPermissionsAminoMsg { + type: "cosmos-sdk/GenesisAccountPermissions"; + value: GenesisAccountPermissionsAmino; +} +/** GenesisAccountPermissions is the account permissions for the circuit breaker in genesis */ +export interface GenesisAccountPermissionsSDKType { + address: string; + permissions?: PermissionsSDKType; +} +/** GenesisState is the state that must be provided at genesis. */ +export interface GenesisState { + accountPermissions: GenesisAccountPermissions[]; + disabledTypeUrls: string[]; +} +export interface GenesisStateProtoMsg { + typeUrl: "/cosmos.circuit.v1.GenesisState"; + value: Uint8Array; +} +/** GenesisState is the state that must be provided at genesis. */ +export interface GenesisStateAmino { + account_permissions?: GenesisAccountPermissionsAmino[]; + disabled_type_urls?: string[]; +} +export interface GenesisStateAminoMsg { + type: "cosmos-sdk/GenesisState"; + value: GenesisStateAmino; +} +/** GenesisState is the state that must be provided at genesis. */ +export interface GenesisStateSDKType { + account_permissions: GenesisAccountPermissionsSDKType[]; + disabled_type_urls: string[]; +} +function createBasePermissions(): Permissions { + return { + level: 0, + limitTypeUrls: [] + }; +} +export const Permissions = { + typeUrl: "/cosmos.circuit.v1.Permissions", + encode(message: Permissions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.level !== 0) { + writer.uint32(8).int32(message.level); + } + for (const v of message.limitTypeUrls) { + writer.uint32(18).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Permissions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePermissions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.level = (reader.int32() as any); + break; + case 2: + message.limitTypeUrls.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): Permissions { + const message = createBasePermissions(); + message.level = object.level ?? 0; + message.limitTypeUrls = object.limitTypeUrls?.map(e => e) || []; + return message; + }, + fromAmino(object: PermissionsAmino): Permissions { + const message = createBasePermissions(); + if (object.level !== undefined && object.level !== null) { + message.level = object.level; + } + message.limitTypeUrls = object.limit_type_urls?.map(e => e) || []; + return message; + }, + toAmino(message: Permissions): PermissionsAmino { + const obj: any = {}; + obj.level = message.level === 0 ? undefined : message.level; + if (message.limitTypeUrls) { + obj.limit_type_urls = message.limitTypeUrls.map(e => e); + } else { + obj.limit_type_urls = message.limitTypeUrls; + } + return obj; + }, + fromAminoMsg(object: PermissionsAminoMsg): Permissions { + return Permissions.fromAmino(object.value); + }, + toAminoMsg(message: Permissions): PermissionsAminoMsg { + return { + type: "cosmos-sdk/Permissions", + value: Permissions.toAmino(message) + }; + }, + fromProtoMsg(message: PermissionsProtoMsg): Permissions { + return Permissions.decode(message.value); + }, + toProto(message: Permissions): Uint8Array { + return Permissions.encode(message).finish(); + }, + toProtoMsg(message: Permissions): PermissionsProtoMsg { + return { + typeUrl: "/cosmos.circuit.v1.Permissions", + value: Permissions.encode(message).finish() + }; + } +}; +function createBaseGenesisAccountPermissions(): GenesisAccountPermissions { + return { + address: "", + permissions: undefined + }; +} +export const GenesisAccountPermissions = { + typeUrl: "/cosmos.circuit.v1.GenesisAccountPermissions", + encode(message: GenesisAccountPermissions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.permissions !== undefined) { + Permissions.encode(message.permissions, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GenesisAccountPermissions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisAccountPermissions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.permissions = Permissions.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): GenesisAccountPermissions { + const message = createBaseGenesisAccountPermissions(); + message.address = object.address ?? ""; + message.permissions = object.permissions !== undefined && object.permissions !== null ? Permissions.fromPartial(object.permissions) : undefined; + return message; + }, + fromAmino(object: GenesisAccountPermissionsAmino): GenesisAccountPermissions { + const message = createBaseGenesisAccountPermissions(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.permissions !== undefined && object.permissions !== null) { + message.permissions = Permissions.fromAmino(object.permissions); + } + return message; + }, + toAmino(message: GenesisAccountPermissions): GenesisAccountPermissionsAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + obj.permissions = message.permissions ? Permissions.toAmino(message.permissions) : undefined; + return obj; + }, + fromAminoMsg(object: GenesisAccountPermissionsAminoMsg): GenesisAccountPermissions { + return GenesisAccountPermissions.fromAmino(object.value); + }, + toAminoMsg(message: GenesisAccountPermissions): GenesisAccountPermissionsAminoMsg { + return { + type: "cosmos-sdk/GenesisAccountPermissions", + value: GenesisAccountPermissions.toAmino(message) + }; + }, + fromProtoMsg(message: GenesisAccountPermissionsProtoMsg): GenesisAccountPermissions { + return GenesisAccountPermissions.decode(message.value); + }, + toProto(message: GenesisAccountPermissions): Uint8Array { + return GenesisAccountPermissions.encode(message).finish(); + }, + toProtoMsg(message: GenesisAccountPermissions): GenesisAccountPermissionsProtoMsg { + return { + typeUrl: "/cosmos.circuit.v1.GenesisAccountPermissions", + value: GenesisAccountPermissions.encode(message).finish() + }; + } +}; +function createBaseGenesisState(): GenesisState { + return { + accountPermissions: [], + disabledTypeUrls: [] + }; +} +export const GenesisState = { + typeUrl: "/cosmos.circuit.v1.GenesisState", + encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.accountPermissions) { + GenesisAccountPermissions.encode(v!, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.disabledTypeUrls) { + writer.uint32(18).string(v!); + } + 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.accountPermissions.push(GenesisAccountPermissions.decode(reader, reader.uint32())); + break; + case 2: + message.disabledTypeUrls.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): GenesisState { + const message = createBaseGenesisState(); + message.accountPermissions = object.accountPermissions?.map(e => GenesisAccountPermissions.fromPartial(e)) || []; + message.disabledTypeUrls = object.disabledTypeUrls?.map(e => e) || []; + return message; + }, + fromAmino(object: GenesisStateAmino): GenesisState { + const message = createBaseGenesisState(); + message.accountPermissions = object.account_permissions?.map(e => GenesisAccountPermissions.fromAmino(e)) || []; + message.disabledTypeUrls = object.disabled_type_urls?.map(e => e) || []; + return message; + }, + toAmino(message: GenesisState): GenesisStateAmino { + const obj: any = {}; + if (message.accountPermissions) { + obj.account_permissions = message.accountPermissions.map(e => e ? GenesisAccountPermissions.toAmino(e) : undefined); + } else { + obj.account_permissions = message.accountPermissions; + } + if (message.disabledTypeUrls) { + obj.disabled_type_urls = message.disabledTypeUrls.map(e => e); + } else { + obj.disabled_type_urls = message.disabledTypeUrls; + } + return obj; + }, + fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { + return GenesisState.fromAmino(object.value); + }, + toAminoMsg(message: GenesisState): GenesisStateAminoMsg { + return { + type: "cosmos-sdk/GenesisState", + value: GenesisState.toAmino(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: "/cosmos.circuit.v1.GenesisState", + value: GenesisState.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/client.ts b/packages/api/src/cosmos/client.ts index b146730d..50e4d332 100644 --- a/packages/api/src/cosmos/client.ts +++ b/packages/api/src/cosmos/client.ts @@ -2,39 +2,60 @@ import { GeneratedType, Registry, OfflineSigner } from "@cosmjs/proto-signing"; import { AminoTypes, SigningStargateClient } from "@cosmjs/stargate"; import { HttpEndpoint } from "@cosmjs/tendermint-rpc"; +import * as cosmosAuthV1beta1TxRegistry from "./auth/v1beta1/tx.registry"; import * as cosmosAuthzV1beta1TxRegistry from "./authz/v1beta1/tx.registry"; import * as cosmosBankV1beta1TxRegistry from "./bank/v1beta1/tx.registry"; +import * as cosmosBenchmarkV1TxRegistry from "./benchmark/v1/tx.registry"; +import * as cosmosCircuitV1TxRegistry from "./circuit/v1/tx.registry"; +import * as cosmosConsensusV1TxRegistry from "./consensus/v1/tx.registry"; +import * as cosmosCounterV1TxRegistry from "./counter/v1/tx.registry"; import * as cosmosDistributionV1beta1TxRegistry from "./distribution/v1beta1/tx.registry"; import * as cosmosFeegrantV1beta1TxRegistry from "./feegrant/v1beta1/tx.registry"; import * as cosmosGovV1TxRegistry from "./gov/v1/tx.registry"; import * as cosmosGovV1beta1TxRegistry from "./gov/v1beta1/tx.registry"; import * as cosmosGroupV1TxRegistry from "./group/v1/tx.registry"; +import * as cosmosMintV1beta1TxRegistry from "./mint/v1beta1/tx.registry"; +import * as cosmosProtocolpoolV1TxRegistry from "./protocolpool/v1/tx.registry"; import * as cosmosStakingV1beta1TxRegistry from "./staking/v1beta1/tx.registry"; import * as cosmosUpgradeV1beta1TxRegistry from "./upgrade/v1beta1/tx.registry"; import * as cosmosVestingV1beta1TxRegistry from "./vesting/v1beta1/tx.registry"; +import * as cosmosAuthV1beta1TxAmino from "./auth/v1beta1/tx.amino"; import * as cosmosAuthzV1beta1TxAmino from "./authz/v1beta1/tx.amino"; import * as cosmosBankV1beta1TxAmino from "./bank/v1beta1/tx.amino"; +import * as cosmosBenchmarkV1TxAmino from "./benchmark/v1/tx.amino"; +import * as cosmosCircuitV1TxAmino from "./circuit/v1/tx.amino"; +import * as cosmosConsensusV1TxAmino from "./consensus/v1/tx.amino"; +import * as cosmosCounterV1TxAmino from "./counter/v1/tx.amino"; import * as cosmosDistributionV1beta1TxAmino from "./distribution/v1beta1/tx.amino"; import * as cosmosFeegrantV1beta1TxAmino from "./feegrant/v1beta1/tx.amino"; import * as cosmosGovV1TxAmino from "./gov/v1/tx.amino"; import * as cosmosGovV1beta1TxAmino from "./gov/v1beta1/tx.amino"; import * as cosmosGroupV1TxAmino from "./group/v1/tx.amino"; +import * as cosmosMintV1beta1TxAmino from "./mint/v1beta1/tx.amino"; +import * as cosmosProtocolpoolV1TxAmino from "./protocolpool/v1/tx.amino"; import * as cosmosStakingV1beta1TxAmino from "./staking/v1beta1/tx.amino"; import * as cosmosUpgradeV1beta1TxAmino from "./upgrade/v1beta1/tx.amino"; import * as cosmosVestingV1beta1TxAmino from "./vesting/v1beta1/tx.amino"; export const cosmosAminoConverters = { + ...cosmosAuthV1beta1TxAmino.AminoConverter, ...cosmosAuthzV1beta1TxAmino.AminoConverter, ...cosmosBankV1beta1TxAmino.AminoConverter, + ...cosmosBenchmarkV1TxAmino.AminoConverter, + ...cosmosCircuitV1TxAmino.AminoConverter, + ...cosmosConsensusV1TxAmino.AminoConverter, + ...cosmosCounterV1TxAmino.AminoConverter, ...cosmosDistributionV1beta1TxAmino.AminoConverter, ...cosmosFeegrantV1beta1TxAmino.AminoConverter, ...cosmosGovV1TxAmino.AminoConverter, ...cosmosGovV1beta1TxAmino.AminoConverter, ...cosmosGroupV1TxAmino.AminoConverter, + ...cosmosMintV1beta1TxAmino.AminoConverter, + ...cosmosProtocolpoolV1TxAmino.AminoConverter, ...cosmosStakingV1beta1TxAmino.AminoConverter, ...cosmosUpgradeV1beta1TxAmino.AminoConverter, ...cosmosVestingV1beta1TxAmino.AminoConverter }; -export const cosmosProtoRegistry: ReadonlyArray<[string, GeneratedType]> = [...cosmosAuthzV1beta1TxRegistry.registry, ...cosmosBankV1beta1TxRegistry.registry, ...cosmosDistributionV1beta1TxRegistry.registry, ...cosmosFeegrantV1beta1TxRegistry.registry, ...cosmosGovV1TxRegistry.registry, ...cosmosGovV1beta1TxRegistry.registry, ...cosmosGroupV1TxRegistry.registry, ...cosmosStakingV1beta1TxRegistry.registry, ...cosmosUpgradeV1beta1TxRegistry.registry, ...cosmosVestingV1beta1TxRegistry.registry]; +export const cosmosProtoRegistry: ReadonlyArray<[string, GeneratedType]> = [...cosmosAuthV1beta1TxRegistry.registry, ...cosmosAuthzV1beta1TxRegistry.registry, ...cosmosBankV1beta1TxRegistry.registry, ...cosmosBenchmarkV1TxRegistry.registry, ...cosmosCircuitV1TxRegistry.registry, ...cosmosConsensusV1TxRegistry.registry, ...cosmosCounterV1TxRegistry.registry, ...cosmosDistributionV1beta1TxRegistry.registry, ...cosmosFeegrantV1beta1TxRegistry.registry, ...cosmosGovV1TxRegistry.registry, ...cosmosGovV1beta1TxRegistry.registry, ...cosmosGroupV1TxRegistry.registry, ...cosmosMintV1beta1TxRegistry.registry, ...cosmosProtocolpoolV1TxRegistry.registry, ...cosmosStakingV1beta1TxRegistry.registry, ...cosmosUpgradeV1beta1TxRegistry.registry, ...cosmosVestingV1beta1TxRegistry.registry]; export const getSigningCosmosClientOptions = (): { registry: Registry; aminoTypes: AminoTypes; diff --git a/packages/api/src/cosmos/consensus/module/v1/module.ts b/packages/api/src/cosmos/consensus/module/v1/module.ts new file mode 100644 index 00000000..b630a2a8 --- /dev/null +++ b/packages/api/src/cosmos/consensus/module/v1/module.ts @@ -0,0 +1,93 @@ +//@ts-nocheck +import { BinaryReader, BinaryWriter } from "../../../../binary"; +/** Module is the config object of the consensus module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} +export interface ModuleProtoMsg { + typeUrl: "/cosmos.consensus.module.v1.Module"; + value: Uint8Array; +} +/** Module is the config object of the consensus module. */ +export interface ModuleAmino { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority?: string; +} +export interface ModuleAminoMsg { + type: "cosmos-sdk/Module"; + value: ModuleAmino; +} +/** Module is the config object of the consensus module. */ +export interface ModuleSDKType { + authority: string; +} +function createBaseModule(): Module { + return { + authority: "" + }; +} +export const Module = { + typeUrl: "/cosmos.consensus.module.v1.Module", + encode(message: Module, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, + fromAmino(object: ModuleAmino): Module { + const message = createBaseModule(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + return message; + }, + toAmino(message: Module): ModuleAmino { + const obj: any = {}; + obj.authority = message.authority === "" ? undefined : message.authority; + return obj; + }, + fromAminoMsg(object: ModuleAminoMsg): Module { + return Module.fromAmino(object.value); + }, + toAminoMsg(message: Module): ModuleAminoMsg { + return { + type: "cosmos-sdk/Module", + value: Module.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleProtoMsg): Module { + return Module.decode(message.value); + }, + toProto(message: Module): Uint8Array { + return Module.encode(message).finish(); + }, + toProtoMsg(message: Module): ModuleProtoMsg { + return { + typeUrl: "/cosmos.consensus.module.v1.Module", + value: Module.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/consensus/v1/query.lcd.ts b/packages/api/src/cosmos/consensus/v1/query.lcd.ts new file mode 100644 index 00000000..f5761a1d --- /dev/null +++ b/packages/api/src/cosmos/consensus/v1/query.lcd.ts @@ -0,0 +1,19 @@ +//@ts-nocheck +import { LCDClient } from "@cosmology/lcd"; +import { QueryParamsRequest, QueryParamsResponseSDKType } from "./query"; +export class LCDQueryClient { + req: LCDClient; + constructor({ + requestClient + }: { + requestClient: LCDClient; + }) { + this.req = requestClient; + this.params = this.params.bind(this); + } + /* Params queries the parameters of x/consensus module. */ + async params(_params: QueryParamsRequest = {}): Promise { + const endpoint = `cosmos/consensus/v1/params`; + return await this.req.get(endpoint); + } +} \ No newline at end of file diff --git a/packages/api/src/cosmos/consensus/v1/query.rpc.Query.ts b/packages/api/src/cosmos/consensus/v1/query.rpc.Query.ts new file mode 100644 index 00000000..3bd1f27a --- /dev/null +++ b/packages/api/src/cosmos/consensus/v1/query.rpc.Query.ts @@ -0,0 +1,31 @@ +//@ts-nocheck +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; +import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; +import { QueryParamsRequest, QueryParamsResponse } from "./query"; +/** Query defines the gRPC querier service. */ +export interface Query { + /** Params queries the parameters of x/consensus module. */ + params(request?: QueryParamsRequest): Promise; +} +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + this.params = this.params.bind(this); + } + params(request: QueryParamsRequest = {}): Promise { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.consensus.v1.Query", "Params", data); + return promise.then(data => QueryParamsResponse.decode(new BinaryReader(data))); + } +} +export const createRpcQueryExtension = (base: QueryClient) => { + const rpc = createProtobufRpcClient(base); + const queryService = new QueryClientImpl(rpc); + return { + params(request?: QueryParamsRequest): Promise { + return queryService.params(request); + } + }; +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/consensus/v1/query.ts b/packages/api/src/cosmos/consensus/v1/query.ts new file mode 100644 index 00000000..56563fd9 --- /dev/null +++ b/packages/api/src/cosmos/consensus/v1/query.ts @@ -0,0 +1,172 @@ +//@ts-nocheck +import { ConsensusParams, ConsensusParamsAmino, ConsensusParamsSDKType } from "../../../tendermint/types/params"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +/** QueryParamsRequest defines the request type for querying x/consensus parameters. */ +export interface QueryParamsRequest {} +export interface QueryParamsRequestProtoMsg { + typeUrl: "/cosmos.consensus.v1.QueryParamsRequest"; + value: Uint8Array; +} +/** QueryParamsRequest defines the request type for querying x/consensus parameters. */ +export interface QueryParamsRequestAmino {} +export interface QueryParamsRequestAminoMsg { + type: "cosmos-sdk/QueryParamsRequest"; + value: QueryParamsRequestAmino; +} +/** QueryParamsRequest defines the request type for querying x/consensus parameters. */ +export interface QueryParamsRequestSDKType {} +/** QueryParamsResponse defines the response type for querying x/consensus parameters. */ +export interface QueryParamsResponse { + /** + * params are the tendermint consensus params stored in the consensus module. + * Please note that `params.version` is not populated in this response, it is + * tracked separately in the x/upgrade module. + */ + params?: ConsensusParams; +} +export interface QueryParamsResponseProtoMsg { + typeUrl: "/cosmos.consensus.v1.QueryParamsResponse"; + value: Uint8Array; +} +/** QueryParamsResponse defines the response type for querying x/consensus parameters. */ +export interface QueryParamsResponseAmino { + /** + * params are the tendermint consensus params stored in the consensus module. + * Please note that `params.version` is not populated in this response, it is + * tracked separately in the x/upgrade module. + */ + params?: ConsensusParamsAmino; +} +export interface QueryParamsResponseAminoMsg { + type: "cosmos-sdk/QueryParamsResponse"; + value: QueryParamsResponseAmino; +} +/** QueryParamsResponse defines the response type for querying x/consensus parameters. */ +export interface QueryParamsResponseSDKType { + params?: ConsensusParamsSDKType; +} +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} +export const QueryParamsRequest = { + typeUrl: "/cosmos.consensus.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; + }, + fromPartial(_: Partial): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, + fromAmino(_: QueryParamsRequestAmino): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, + toAmino(_: QueryParamsRequest): QueryParamsRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { + return QueryParamsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsRequest): QueryParamsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryParamsRequest", + value: QueryParamsRequest.toAmino(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: "/cosmos.consensus.v1.QueryParamsRequest", + value: QueryParamsRequest.encode(message).finish() + }; + } +}; +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { + params: undefined + }; +} +export const QueryParamsResponse = { + typeUrl: "/cosmos.consensus.v1.QueryParamsResponse", + encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.params !== undefined) { + ConsensusParams.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 = ConsensusParams.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = object.params !== undefined && object.params !== null ? ConsensusParams.fromPartial(object.params) : undefined; + return message; + }, + fromAmino(object: QueryParamsResponseAmino): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + if (object.params !== undefined && object.params !== null) { + message.params = ConsensusParams.fromAmino(object.params); + } + return message; + }, + toAmino(message: QueryParamsResponse): QueryParamsResponseAmino { + const obj: any = {}; + obj.params = message.params ? ConsensusParams.toAmino(message.params) : undefined; + return obj; + }, + fromAminoMsg(object: QueryParamsResponseAminoMsg): QueryParamsResponse { + return QueryParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsResponse): QueryParamsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryParamsResponse", + value: QueryParamsResponse.toAmino(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: "/cosmos.consensus.v1.QueryParamsResponse", + value: QueryParamsResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/consensus/v1/tx.amino.ts b/packages/api/src/cosmos/consensus/v1/tx.amino.ts new file mode 100644 index 00000000..4d00cbb2 --- /dev/null +++ b/packages/api/src/cosmos/consensus/v1/tx.amino.ts @@ -0,0 +1,9 @@ +//@ts-nocheck +import { MsgUpdateParams } from "./tx"; +export const AminoConverter = { + "/cosmos.consensus.v1.MsgUpdateParams": { + aminoType: "cosmos-sdk/x/consensus/MsgUpdateParams", + toAmino: MsgUpdateParams.toAmino, + fromAmino: MsgUpdateParams.fromAmino + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/consensus/v1/tx.registry.ts b/packages/api/src/cosmos/consensus/v1/tx.registry.ts new file mode 100644 index 00000000..5dd24e11 --- /dev/null +++ b/packages/api/src/cosmos/consensus/v1/tx.registry.ts @@ -0,0 +1,35 @@ +//@ts-nocheck +import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { MsgUpdateParams } from "./tx"; +export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.consensus.v1.MsgUpdateParams", MsgUpdateParams]]; +export const load = (protoRegistry: Registry) => { + registry.forEach(([typeUrl, mod]) => { + protoRegistry.register(typeUrl, mod); + }); +}; +export const MessageComposer = { + encoded: { + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/cosmos.consensus.v1.MsgUpdateParams", + value: MsgUpdateParams.encode(value).finish() + }; + } + }, + withTypeUrl: { + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/cosmos.consensus.v1.MsgUpdateParams", + value + }; + } + }, + fromPartial: { + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/cosmos.consensus.v1.MsgUpdateParams", + value: MsgUpdateParams.fromPartial(value) + }; + } + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/consensus/v1/tx.rpc.msg.ts b/packages/api/src/cosmos/consensus/v1/tx.rpc.msg.ts new file mode 100644 index 00000000..a81bbcb8 --- /dev/null +++ b/packages/api/src/cosmos/consensus/v1/tx.rpc.msg.ts @@ -0,0 +1,24 @@ +//@ts-nocheck +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; +import { MsgUpdateParams, MsgUpdateParamsResponse } from "./tx"; +/** Msg defines the consensus Msg service. */ +export interface Msg { + /** + * UpdateParams defines a governance operation for updating the x/consensus module parameters. + * The authority is defined in the keeper. + */ + updateParams(request: MsgUpdateParams): Promise; +} +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + this.updateParams = this.updateParams.bind(this); + } + updateParams(request: MsgUpdateParams): Promise { + const data = MsgUpdateParams.encode(request).finish(); + const promise = this.rpc.request("cosmos.consensus.v1.Msg", "UpdateParams", data); + return promise.then(data => MsgUpdateParamsResponse.decode(new BinaryReader(data))); + } +} \ No newline at end of file diff --git a/packages/api/src/cosmos/consensus/v1/tx.ts b/packages/api/src/cosmos/consensus/v1/tx.ts new file mode 100644 index 00000000..3e11416b --- /dev/null +++ b/packages/api/src/cosmos/consensus/v1/tx.ts @@ -0,0 +1,247 @@ +//@ts-nocheck +import { BlockParams, BlockParamsAmino, BlockParamsSDKType, EvidenceParams, EvidenceParamsAmino, EvidenceParamsSDKType, ValidatorParams, ValidatorParamsAmino, ValidatorParamsSDKType, ABCIParams, ABCIParamsAmino, ABCIParamsSDKType } from "../../../tendermint/types/params"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/consensus parameters to update. + * VersionsParams is not included in this Msg because it is tracked + * separarately in x/upgrade. + * + * NOTE: All parameters must be supplied. + */ + block?: BlockParams; + evidence?: EvidenceParams; + validator?: ValidatorParams; + abci?: ABCIParams; +} +export interface MsgUpdateParamsProtoMsg { + typeUrl: "/cosmos.consensus.v1.MsgUpdateParams"; + value: Uint8Array; +} +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParamsAmino { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority?: string; + /** + * params defines the x/consensus parameters to update. + * VersionsParams is not included in this Msg because it is tracked + * separarately in x/upgrade. + * + * NOTE: All parameters must be supplied. + */ + block?: BlockParamsAmino; + evidence?: EvidenceParamsAmino; + validator?: ValidatorParamsAmino; + abci?: ABCIParamsAmino; +} +export interface MsgUpdateParamsAminoMsg { + type: "cosmos-sdk/x/consensus/MsgUpdateParams"; + value: MsgUpdateParamsAmino; +} +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParamsSDKType { + authority: string; + block?: BlockParamsSDKType; + evidence?: EvidenceParamsSDKType; + validator?: ValidatorParamsSDKType; + abci?: ABCIParamsSDKType; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponse {} +export interface MsgUpdateParamsResponseProtoMsg { + typeUrl: "/cosmos.consensus.v1.MsgUpdateParamsResponse"; + value: Uint8Array; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponseAmino {} +export interface MsgUpdateParamsResponseAminoMsg { + type: "cosmos-sdk/MsgUpdateParamsResponse"; + value: MsgUpdateParamsResponseAmino; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponseSDKType {} +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { + authority: "", + block: undefined, + evidence: undefined, + validator: undefined, + abci: undefined + }; +} +export const MsgUpdateParams = { + typeUrl: "/cosmos.consensus.v1.MsgUpdateParams", + encode(message: MsgUpdateParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.block !== undefined) { + BlockParams.encode(message.block, writer.uint32(18).fork()).ldelim(); + } + if (message.evidence !== undefined) { + EvidenceParams.encode(message.evidence, writer.uint32(26).fork()).ldelim(); + } + if (message.validator !== undefined) { + ValidatorParams.encode(message.validator, writer.uint32(34).fork()).ldelim(); + } + if (message.abci !== undefined) { + ABCIParams.encode(message.abci, writer.uint32(42).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.block = BlockParams.decode(reader, reader.uint32()); + break; + case 3: + message.evidence = EvidenceParams.decode(reader, reader.uint32()); + break; + case 4: + message.validator = ValidatorParams.decode(reader, reader.uint32()); + break; + case 5: + message.abci = ABCIParams.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + message.authority = object.authority ?? ""; + message.block = object.block !== undefined && object.block !== null ? BlockParams.fromPartial(object.block) : undefined; + message.evidence = object.evidence !== undefined && object.evidence !== null ? EvidenceParams.fromPartial(object.evidence) : undefined; + message.validator = object.validator !== undefined && object.validator !== null ? ValidatorParams.fromPartial(object.validator) : undefined; + message.abci = object.abci !== undefined && object.abci !== null ? ABCIParams.fromPartial(object.abci) : undefined; + return message; + }, + fromAmino(object: MsgUpdateParamsAmino): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + if (object.block !== undefined && object.block !== null) { + message.block = BlockParams.fromAmino(object.block); + } + if (object.evidence !== undefined && object.evidence !== null) { + message.evidence = EvidenceParams.fromAmino(object.evidence); + } + if (object.validator !== undefined && object.validator !== null) { + message.validator = ValidatorParams.fromAmino(object.validator); + } + if (object.abci !== undefined && object.abci !== null) { + message.abci = ABCIParams.fromAmino(object.abci); + } + return message; + }, + toAmino(message: MsgUpdateParams): MsgUpdateParamsAmino { + const obj: any = {}; + obj.authority = message.authority === "" ? undefined : message.authority; + obj.block = message.block ? BlockParams.toAmino(message.block) : undefined; + obj.evidence = message.evidence ? EvidenceParams.toAmino(message.evidence) : undefined; + obj.validator = message.validator ? ValidatorParams.toAmino(message.validator) : undefined; + obj.abci = message.abci ? ABCIParams.toAmino(message.abci) : undefined; + return obj; + }, + fromAminoMsg(object: MsgUpdateParamsAminoMsg): MsgUpdateParams { + return MsgUpdateParams.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateParams): MsgUpdateParamsAminoMsg { + return { + type: "cosmos-sdk/x/consensus/MsgUpdateParams", + value: MsgUpdateParams.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateParamsProtoMsg): MsgUpdateParams { + return MsgUpdateParams.decode(message.value); + }, + toProto(message: MsgUpdateParams): Uint8Array { + return MsgUpdateParams.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateParams): MsgUpdateParamsProtoMsg { + return { + typeUrl: "/cosmos.consensus.v1.MsgUpdateParams", + value: MsgUpdateParams.encode(message).finish() + }; + } +}; +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} +export const MsgUpdateParamsResponse = { + typeUrl: "/cosmos.consensus.v1.MsgUpdateParamsResponse", + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, + fromAmino(_: MsgUpdateParamsResponseAmino): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, + toAmino(_: MsgUpdateParamsResponse): MsgUpdateParamsResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUpdateParamsResponseAminoMsg): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateParamsResponse): MsgUpdateParamsResponseAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateParamsResponse", + value: MsgUpdateParamsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateParamsResponseProtoMsg): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.decode(message.value); + }, + toProto(message: MsgUpdateParamsResponse): Uint8Array { + return MsgUpdateParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateParamsResponse): MsgUpdateParamsResponseProtoMsg { + return { + typeUrl: "/cosmos.consensus.v1.MsgUpdateParamsResponse", + value: MsgUpdateParamsResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/counter/module/v1/module.ts b/packages/api/src/cosmos/counter/module/v1/module.ts new file mode 100644 index 00000000..4b094570 --- /dev/null +++ b/packages/api/src/cosmos/counter/module/v1/module.ts @@ -0,0 +1,93 @@ +//@ts-nocheck +import { BinaryReader, BinaryWriter } from "../../../../binary"; +/** Module is the config object of the counter module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} +export interface ModuleProtoMsg { + typeUrl: "/cosmos.counter.module.v1.Module"; + value: Uint8Array; +} +/** Module is the config object of the counter module. */ +export interface ModuleAmino { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority?: string; +} +export interface ModuleAminoMsg { + type: "cosmos-sdk/Module"; + value: ModuleAmino; +} +/** Module is the config object of the counter module. */ +export interface ModuleSDKType { + authority: string; +} +function createBaseModule(): Module { + return { + authority: "" + }; +} +export const Module = { + typeUrl: "/cosmos.counter.module.v1.Module", + encode(message: Module, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, + fromAmino(object: ModuleAmino): Module { + const message = createBaseModule(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + return message; + }, + toAmino(message: Module): ModuleAmino { + const obj: any = {}; + obj.authority = message.authority === "" ? undefined : message.authority; + return obj; + }, + fromAminoMsg(object: ModuleAminoMsg): Module { + return Module.fromAmino(object.value); + }, + toAminoMsg(message: Module): ModuleAminoMsg { + return { + type: "cosmos-sdk/Module", + value: Module.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleProtoMsg): Module { + return Module.decode(message.value); + }, + toProto(message: Module): Uint8Array { + return Module.encode(message).finish(); + }, + toProtoMsg(message: Module): ModuleProtoMsg { + return { + typeUrl: "/cosmos.counter.module.v1.Module", + value: Module.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/counter/v1/query.rpc.Query.ts b/packages/api/src/cosmos/counter/v1/query.rpc.Query.ts new file mode 100644 index 00000000..166a31f9 --- /dev/null +++ b/packages/api/src/cosmos/counter/v1/query.rpc.Query.ts @@ -0,0 +1,31 @@ +//@ts-nocheck +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; +import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; +import { QueryGetCountRequest, QueryGetCountResponse } from "./query"; +/** Query defines the gRPC querier service. */ +export interface Query { + /** GetCount queries the parameters of x/Counter module. */ + getCount(request?: QueryGetCountRequest): Promise; +} +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + this.getCount = this.getCount.bind(this); + } + getCount(request: QueryGetCountRequest = {}): Promise { + const data = QueryGetCountRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.counter.v1.Query", "GetCount", data); + return promise.then(data => QueryGetCountResponse.decode(new BinaryReader(data))); + } +} +export const createRpcQueryExtension = (base: QueryClient) => { + const rpc = createProtobufRpcClient(base); + const queryService = new QueryClientImpl(rpc); + return { + getCount(request?: QueryGetCountRequest): Promise { + return queryService.getCount(request); + } + }; +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/counter/v1/query.ts b/packages/api/src/cosmos/counter/v1/query.ts new file mode 100644 index 00000000..eb5467b4 --- /dev/null +++ b/packages/api/src/cosmos/counter/v1/query.ts @@ -0,0 +1,161 @@ +//@ts-nocheck +import { BinaryReader, BinaryWriter } from "../../../binary"; +/** QueryGetCountRequest defines the request type for querying x/mock count. */ +export interface QueryGetCountRequest {} +export interface QueryGetCountRequestProtoMsg { + typeUrl: "/cosmos.counter.v1.QueryGetCountRequest"; + value: Uint8Array; +} +/** QueryGetCountRequest defines the request type for querying x/mock count. */ +export interface QueryGetCountRequestAmino {} +export interface QueryGetCountRequestAminoMsg { + type: "cosmos-sdk/QueryGetCountRequest"; + value: QueryGetCountRequestAmino; +} +/** QueryGetCountRequest defines the request type for querying x/mock count. */ +export interface QueryGetCountRequestSDKType {} +/** QueryGetCountResponse defines the response type for querying x/mock count. */ +export interface QueryGetCountResponse { + totalCount: bigint; +} +export interface QueryGetCountResponseProtoMsg { + typeUrl: "/cosmos.counter.v1.QueryGetCountResponse"; + value: Uint8Array; +} +/** QueryGetCountResponse defines the response type for querying x/mock count. */ +export interface QueryGetCountResponseAmino { + total_count?: string; +} +export interface QueryGetCountResponseAminoMsg { + type: "cosmos-sdk/QueryGetCountResponse"; + value: QueryGetCountResponseAmino; +} +/** QueryGetCountResponse defines the response type for querying x/mock count. */ +export interface QueryGetCountResponseSDKType { + total_count: bigint; +} +function createBaseQueryGetCountRequest(): QueryGetCountRequest { + return {}; +} +export const QueryGetCountRequest = { + typeUrl: "/cosmos.counter.v1.QueryGetCountRequest", + encode(_: QueryGetCountRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryGetCountRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGetCountRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): QueryGetCountRequest { + const message = createBaseQueryGetCountRequest(); + return message; + }, + fromAmino(_: QueryGetCountRequestAmino): QueryGetCountRequest { + const message = createBaseQueryGetCountRequest(); + return message; + }, + toAmino(_: QueryGetCountRequest): QueryGetCountRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryGetCountRequestAminoMsg): QueryGetCountRequest { + return QueryGetCountRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryGetCountRequest): QueryGetCountRequestAminoMsg { + return { + type: "cosmos-sdk/QueryGetCountRequest", + value: QueryGetCountRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryGetCountRequestProtoMsg): QueryGetCountRequest { + return QueryGetCountRequest.decode(message.value); + }, + toProto(message: QueryGetCountRequest): Uint8Array { + return QueryGetCountRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryGetCountRequest): QueryGetCountRequestProtoMsg { + return { + typeUrl: "/cosmos.counter.v1.QueryGetCountRequest", + value: QueryGetCountRequest.encode(message).finish() + }; + } +}; +function createBaseQueryGetCountResponse(): QueryGetCountResponse { + return { + totalCount: BigInt(0) + }; +} +export const QueryGetCountResponse = { + typeUrl: "/cosmos.counter.v1.QueryGetCountResponse", + encode(message: QueryGetCountResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.totalCount !== BigInt(0)) { + writer.uint32(8).int64(message.totalCount); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryGetCountResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGetCountResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.totalCount = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryGetCountResponse { + const message = createBaseQueryGetCountResponse(); + message.totalCount = object.totalCount !== undefined && object.totalCount !== null ? BigInt(object.totalCount.toString()) : BigInt(0); + return message; + }, + fromAmino(object: QueryGetCountResponseAmino): QueryGetCountResponse { + const message = createBaseQueryGetCountResponse(); + if (object.total_count !== undefined && object.total_count !== null) { + message.totalCount = BigInt(object.total_count); + } + return message; + }, + toAmino(message: QueryGetCountResponse): QueryGetCountResponseAmino { + const obj: any = {}; + obj.total_count = message.totalCount !== BigInt(0) ? message.totalCount?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: QueryGetCountResponseAminoMsg): QueryGetCountResponse { + return QueryGetCountResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryGetCountResponse): QueryGetCountResponseAminoMsg { + return { + type: "cosmos-sdk/QueryGetCountResponse", + value: QueryGetCountResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryGetCountResponseProtoMsg): QueryGetCountResponse { + return QueryGetCountResponse.decode(message.value); + }, + toProto(message: QueryGetCountResponse): Uint8Array { + return QueryGetCountResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryGetCountResponse): QueryGetCountResponseProtoMsg { + return { + typeUrl: "/cosmos.counter.v1.QueryGetCountResponse", + value: QueryGetCountResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/counter/v1/tx.amino.ts b/packages/api/src/cosmos/counter/v1/tx.amino.ts new file mode 100644 index 00000000..1667a483 --- /dev/null +++ b/packages/api/src/cosmos/counter/v1/tx.amino.ts @@ -0,0 +1,9 @@ +//@ts-nocheck +import { MsgIncreaseCounter } from "./tx"; +export const AminoConverter = { + "/cosmos.counter.v1.MsgIncreaseCounter": { + aminoType: "cosmos-sdk/increase_counter", + toAmino: MsgIncreaseCounter.toAmino, + fromAmino: MsgIncreaseCounter.fromAmino + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/counter/v1/tx.registry.ts b/packages/api/src/cosmos/counter/v1/tx.registry.ts new file mode 100644 index 00000000..4a7058d8 --- /dev/null +++ b/packages/api/src/cosmos/counter/v1/tx.registry.ts @@ -0,0 +1,35 @@ +//@ts-nocheck +import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { MsgIncreaseCounter } from "./tx"; +export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.counter.v1.MsgIncreaseCounter", MsgIncreaseCounter]]; +export const load = (protoRegistry: Registry) => { + registry.forEach(([typeUrl, mod]) => { + protoRegistry.register(typeUrl, mod); + }); +}; +export const MessageComposer = { + encoded: { + increaseCount(value: MsgIncreaseCounter) { + return { + typeUrl: "/cosmos.counter.v1.MsgIncreaseCounter", + value: MsgIncreaseCounter.encode(value).finish() + }; + } + }, + withTypeUrl: { + increaseCount(value: MsgIncreaseCounter) { + return { + typeUrl: "/cosmos.counter.v1.MsgIncreaseCounter", + value + }; + } + }, + fromPartial: { + increaseCount(value: MsgIncreaseCounter) { + return { + typeUrl: "/cosmos.counter.v1.MsgIncreaseCounter", + value: MsgIncreaseCounter.fromPartial(value) + }; + } + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/counter/v1/tx.rpc.msg.ts b/packages/api/src/cosmos/counter/v1/tx.rpc.msg.ts new file mode 100644 index 00000000..6d32ee2c --- /dev/null +++ b/packages/api/src/cosmos/counter/v1/tx.rpc.msg.ts @@ -0,0 +1,21 @@ +//@ts-nocheck +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; +import { MsgIncreaseCounter, MsgIncreaseCountResponse } from "./tx"; +/** Msg defines the counter Msg service. */ +export interface Msg { + /** IncreaseCount increments the counter by the specified amount. */ + increaseCount(request: MsgIncreaseCounter): Promise; +} +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + this.increaseCount = this.increaseCount.bind(this); + } + increaseCount(request: MsgIncreaseCounter): Promise { + const data = MsgIncreaseCounter.encode(request).finish(); + const promise = this.rpc.request("cosmos.counter.v1.Msg", "IncreaseCount", data); + return promise.then(data => MsgIncreaseCountResponse.decode(new BinaryReader(data))); + } +} \ No newline at end of file diff --git a/packages/api/src/cosmos/counter/v1/tx.ts b/packages/api/src/cosmos/counter/v1/tx.ts new file mode 100644 index 00000000..d89bfe18 --- /dev/null +++ b/packages/api/src/cosmos/counter/v1/tx.ts @@ -0,0 +1,201 @@ +//@ts-nocheck +import { BinaryReader, BinaryWriter } from "../../../binary"; +/** MsgIncreaseCounter defines a count Msg service counter. */ +export interface MsgIncreaseCounter { + /** signer is the address that controls the module (defaults to x/gov unless overwritten). */ + signer: string; + /** count is the number of times to increment the counter. */ + count: bigint; +} +export interface MsgIncreaseCounterProtoMsg { + typeUrl: "/cosmos.counter.v1.MsgIncreaseCounter"; + value: Uint8Array; +} +/** MsgIncreaseCounter defines a count Msg service counter. */ +export interface MsgIncreaseCounterAmino { + /** signer is the address that controls the module (defaults to x/gov unless overwritten). */ + signer?: string; + /** count is the number of times to increment the counter. */ + count?: string; +} +export interface MsgIncreaseCounterAminoMsg { + type: "cosmos-sdk/increase_counter"; + value: MsgIncreaseCounterAmino; +} +/** MsgIncreaseCounter defines a count Msg service counter. */ +export interface MsgIncreaseCounterSDKType { + signer: string; + count: bigint; +} +/** MsgIncreaseCountResponse is the Msg/Counter response type. */ +export interface MsgIncreaseCountResponse { + /** new_count is the number of times the counter was incremented. */ + newCount: bigint; +} +export interface MsgIncreaseCountResponseProtoMsg { + typeUrl: "/cosmos.counter.v1.MsgIncreaseCountResponse"; + value: Uint8Array; +} +/** MsgIncreaseCountResponse is the Msg/Counter response type. */ +export interface MsgIncreaseCountResponseAmino { + /** new_count is the number of times the counter was incremented. */ + new_count?: string; +} +export interface MsgIncreaseCountResponseAminoMsg { + type: "cosmos-sdk/MsgIncreaseCountResponse"; + value: MsgIncreaseCountResponseAmino; +} +/** MsgIncreaseCountResponse is the Msg/Counter response type. */ +export interface MsgIncreaseCountResponseSDKType { + new_count: bigint; +} +function createBaseMsgIncreaseCounter(): MsgIncreaseCounter { + return { + signer: "", + count: BigInt(0) + }; +} +export const MsgIncreaseCounter = { + typeUrl: "/cosmos.counter.v1.MsgIncreaseCounter", + encode(message: MsgIncreaseCounter, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.signer !== "") { + writer.uint32(10).string(message.signer); + } + if (message.count !== BigInt(0)) { + writer.uint32(16).int64(message.count); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgIncreaseCounter { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgIncreaseCounter(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.signer = reader.string(); + break; + case 2: + message.count = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgIncreaseCounter { + const message = createBaseMsgIncreaseCounter(); + message.signer = object.signer ?? ""; + message.count = object.count !== undefined && object.count !== null ? BigInt(object.count.toString()) : BigInt(0); + return message; + }, + fromAmino(object: MsgIncreaseCounterAmino): MsgIncreaseCounter { + const message = createBaseMsgIncreaseCounter(); + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + if (object.count !== undefined && object.count !== null) { + message.count = BigInt(object.count); + } + return message; + }, + toAmino(message: MsgIncreaseCounter): MsgIncreaseCounterAmino { + const obj: any = {}; + obj.signer = message.signer === "" ? undefined : message.signer; + obj.count = message.count !== BigInt(0) ? message.count?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: MsgIncreaseCounterAminoMsg): MsgIncreaseCounter { + return MsgIncreaseCounter.fromAmino(object.value); + }, + toAminoMsg(message: MsgIncreaseCounter): MsgIncreaseCounterAminoMsg { + return { + type: "cosmos-sdk/increase_counter", + value: MsgIncreaseCounter.toAmino(message) + }; + }, + fromProtoMsg(message: MsgIncreaseCounterProtoMsg): MsgIncreaseCounter { + return MsgIncreaseCounter.decode(message.value); + }, + toProto(message: MsgIncreaseCounter): Uint8Array { + return MsgIncreaseCounter.encode(message).finish(); + }, + toProtoMsg(message: MsgIncreaseCounter): MsgIncreaseCounterProtoMsg { + return { + typeUrl: "/cosmos.counter.v1.MsgIncreaseCounter", + value: MsgIncreaseCounter.encode(message).finish() + }; + } +}; +function createBaseMsgIncreaseCountResponse(): MsgIncreaseCountResponse { + return { + newCount: BigInt(0) + }; +} +export const MsgIncreaseCountResponse = { + typeUrl: "/cosmos.counter.v1.MsgIncreaseCountResponse", + encode(message: MsgIncreaseCountResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.newCount !== BigInt(0)) { + writer.uint32(8).int64(message.newCount); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgIncreaseCountResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgIncreaseCountResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.newCount = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgIncreaseCountResponse { + const message = createBaseMsgIncreaseCountResponse(); + message.newCount = object.newCount !== undefined && object.newCount !== null ? BigInt(object.newCount.toString()) : BigInt(0); + return message; + }, + fromAmino(object: MsgIncreaseCountResponseAmino): MsgIncreaseCountResponse { + const message = createBaseMsgIncreaseCountResponse(); + if (object.new_count !== undefined && object.new_count !== null) { + message.newCount = BigInt(object.new_count); + } + return message; + }, + toAmino(message: MsgIncreaseCountResponse): MsgIncreaseCountResponseAmino { + const obj: any = {}; + obj.new_count = message.newCount !== BigInt(0) ? message.newCount?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: MsgIncreaseCountResponseAminoMsg): MsgIncreaseCountResponse { + return MsgIncreaseCountResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgIncreaseCountResponse): MsgIncreaseCountResponseAminoMsg { + return { + type: "cosmos-sdk/MsgIncreaseCountResponse", + value: MsgIncreaseCountResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgIncreaseCountResponseProtoMsg): MsgIncreaseCountResponse { + return MsgIncreaseCountResponse.decode(message.value); + }, + toProto(message: MsgIncreaseCountResponse): Uint8Array { + return MsgIncreaseCountResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgIncreaseCountResponse): MsgIncreaseCountResponseProtoMsg { + return { + typeUrl: "/cosmos.counter.v1.MsgIncreaseCountResponse", + value: MsgIncreaseCountResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/crisis/module/v1/module.ts b/packages/api/src/cosmos/crisis/module/v1/module.ts new file mode 100644 index 00000000..7b3bc477 --- /dev/null +++ b/packages/api/src/cosmos/crisis/module/v1/module.ts @@ -0,0 +1,110 @@ +//@ts-nocheck +import { BinaryReader, BinaryWriter } from "../../../../binary"; +/** Module is the config object of the crisis module. */ +export interface Module { + /** fee_collector_name is the name of the FeeCollector ModuleAccount. */ + feeCollectorName: string; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} +export interface ModuleProtoMsg { + typeUrl: "/cosmos.crisis.module.v1.Module"; + value: Uint8Array; +} +/** Module is the config object of the crisis module. */ +export interface ModuleAmino { + /** fee_collector_name is the name of the FeeCollector ModuleAccount. */ + fee_collector_name?: string; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority?: string; +} +export interface ModuleAminoMsg { + type: "cosmos-sdk/Module"; + value: ModuleAmino; +} +/** Module is the config object of the crisis module. */ +export interface ModuleSDKType { + fee_collector_name: string; + authority: string; +} +function createBaseModule(): Module { + return { + feeCollectorName: "", + authority: "" + }; +} +export const Module = { + typeUrl: "/cosmos.crisis.module.v1.Module", + encode(message: Module, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.feeCollectorName !== "") { + writer.uint32(10).string(message.feeCollectorName); + } + if (message.authority !== "") { + writer.uint32(18).string(message.authority); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.feeCollectorName = reader.string(); + break; + case 2: + message.authority = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): Module { + const message = createBaseModule(); + message.feeCollectorName = object.feeCollectorName ?? ""; + message.authority = object.authority ?? ""; + return message; + }, + fromAmino(object: ModuleAmino): Module { + const message = createBaseModule(); + if (object.fee_collector_name !== undefined && object.fee_collector_name !== null) { + message.feeCollectorName = object.fee_collector_name; + } + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + return message; + }, + toAmino(message: Module): ModuleAmino { + const obj: any = {}; + obj.fee_collector_name = message.feeCollectorName === "" ? undefined : message.feeCollectorName; + obj.authority = message.authority === "" ? undefined : message.authority; + return obj; + }, + fromAminoMsg(object: ModuleAminoMsg): Module { + return Module.fromAmino(object.value); + }, + toAminoMsg(message: Module): ModuleAminoMsg { + return { + type: "cosmos-sdk/Module", + value: Module.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleProtoMsg): Module { + return Module.decode(message.value); + }, + toProto(message: Module): Uint8Array { + return Module.encode(message).finish(); + }, + toProtoMsg(message: Module): ModuleProtoMsg { + return { + typeUrl: "/cosmos.crisis.module.v1.Module", + value: Module.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/crypto/ed25519/keys.ts b/packages/api/src/cosmos/crypto/ed25519/keys.ts index 02e83618..b4482828 100644 --- a/packages/api/src/cosmos/crypto/ed25519/keys.ts +++ b/packages/api/src/cosmos/crypto/ed25519/keys.ts @@ -26,7 +26,7 @@ export interface PubKeyAmino { key?: string; } export interface PubKeyAminoMsg { - type: "cosmos-sdk/PubKey"; + type: "tendermint/PubKeyEd25519"; value: PubKeyAmino; } /** @@ -40,7 +40,7 @@ export interface PubKeySDKType { key: Uint8Array; } /** - * Deprecated: PrivKey defines a ed25519 private key. + * PrivKey defines a ed25519 private key. * NOTE: ed25519 keys must not be used in SDK apps except in a tendermint validator context. */ export interface PrivKey { @@ -51,18 +51,18 @@ export interface PrivKeyProtoMsg { value: Uint8Array; } /** - * Deprecated: PrivKey defines a ed25519 private key. + * PrivKey defines a ed25519 private key. * NOTE: ed25519 keys must not be used in SDK apps except in a tendermint validator context. */ export interface PrivKeyAmino { key?: string; } export interface PrivKeyAminoMsg { - type: "cosmos-sdk/PrivKey"; + type: "tendermint/PrivKeyEd25519"; value: PrivKeyAmino; } /** - * Deprecated: PrivKey defines a ed25519 private key. + * PrivKey defines a ed25519 private key. * NOTE: ed25519 keys must not be used in SDK apps except in a tendermint validator context. */ export interface PrivKeySDKType { @@ -120,7 +120,7 @@ export const PubKey = { }, toAminoMsg(message: PubKey): PubKeyAminoMsg { return { - type: "cosmos-sdk/PubKey", + type: "tendermint/PubKeyEd25519", value: PubKey.toAmino(message) }; }, @@ -189,7 +189,7 @@ export const PrivKey = { }, toAminoMsg(message: PrivKey): PrivKeyAminoMsg { return { - type: "cosmos-sdk/PrivKey", + type: "tendermint/PrivKeyEd25519", value: PrivKey.toAmino(message) }; }, diff --git a/packages/api/src/cosmos/crypto/hd/v1/hd.ts b/packages/api/src/cosmos/crypto/hd/v1/hd.ts index e8fccaca..b03a69e1 100644 --- a/packages/api/src/cosmos/crypto/hd/v1/hd.ts +++ b/packages/api/src/cosmos/crypto/hd/v1/hd.ts @@ -37,7 +37,7 @@ export interface BIP44ParamsAmino { address_index?: number; } export interface BIP44ParamsAminoMsg { - type: "cosmos-sdk/BIP44Params"; + type: "crypto/keys/hd/BIP44Params"; value: BIP44ParamsAmino; } /** BIP44Params is used as path field in ledger item in Record. */ @@ -148,7 +148,7 @@ export const BIP44Params = { }, toAminoMsg(message: BIP44Params): BIP44ParamsAminoMsg { return { - type: "cosmos-sdk/BIP44Params", + type: "crypto/keys/hd/BIP44Params", value: BIP44Params.toAmino(message) }; }, diff --git a/packages/api/src/cosmos/crypto/multisig/keys.ts b/packages/api/src/cosmos/crypto/multisig/keys.ts index eddecd00..a19cbe0d 100644 --- a/packages/api/src/cosmos/crypto/multisig/keys.ts +++ b/packages/api/src/cosmos/crypto/multisig/keys.ts @@ -24,7 +24,7 @@ export interface LegacyAminoPubKeyAmino { public_keys?: AnyAmino[]; } export interface LegacyAminoPubKeyAminoMsg { - type: "cosmos-sdk/LegacyAminoPubKey"; + type: "tendermint/PubKeyMultisigThreshold"; value: LegacyAminoPubKeyAmino; } /** @@ -102,7 +102,7 @@ export const LegacyAminoPubKey = { }, toAminoMsg(message: LegacyAminoPubKey): LegacyAminoPubKeyAminoMsg { return { - type: "cosmos-sdk/LegacyAminoPubKey", + type: "tendermint/PubKeyMultisigThreshold", value: LegacyAminoPubKey.toAmino(message) }; }, diff --git a/packages/api/src/cosmos/crypto/secp256k1/keys.ts b/packages/api/src/cosmos/crypto/secp256k1/keys.ts index f5b13ae4..e9210c40 100644 --- a/packages/api/src/cosmos/crypto/secp256k1/keys.ts +++ b/packages/api/src/cosmos/crypto/secp256k1/keys.ts @@ -26,7 +26,7 @@ export interface PubKeyAmino { key?: string; } export interface PubKeyAminoMsg { - type: "cosmos-sdk/PubKey"; + type: "tendermint/PubKeySecp256k1"; value: PubKeyAmino; } /** @@ -52,7 +52,7 @@ export interface PrivKeyAmino { key?: string; } export interface PrivKeyAminoMsg { - type: "cosmos-sdk/PrivKey"; + type: "tendermint/PrivKeySecp256k1"; value: PrivKeyAmino; } /** PrivKey defines a secp256k1 private key. */ @@ -111,7 +111,7 @@ export const PubKey = { }, toAminoMsg(message: PubKey): PubKeyAminoMsg { return { - type: "cosmos-sdk/PubKey", + type: "tendermint/PubKeySecp256k1", value: PubKey.toAmino(message) }; }, @@ -180,7 +180,7 @@ export const PrivKey = { }, toAminoMsg(message: PrivKey): PrivKeyAminoMsg { return { - type: "cosmos-sdk/PrivKey", + type: "tendermint/PrivKeySecp256k1", value: PrivKey.toAmino(message) }; }, diff --git a/packages/api/src/cosmos/distribution/module/v1/module.ts b/packages/api/src/cosmos/distribution/module/v1/module.ts new file mode 100644 index 00000000..793e4e70 --- /dev/null +++ b/packages/api/src/cosmos/distribution/module/v1/module.ts @@ -0,0 +1,108 @@ +//@ts-nocheck +import { BinaryReader, BinaryWriter } from "../../../../binary"; +/** Module is the config object of the distribution module. */ +export interface Module { + feeCollectorName: string; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} +export interface ModuleProtoMsg { + typeUrl: "/cosmos.distribution.module.v1.Module"; + value: Uint8Array; +} +/** Module is the config object of the distribution module. */ +export interface ModuleAmino { + fee_collector_name?: string; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority?: string; +} +export interface ModuleAminoMsg { + type: "cosmos-sdk/Module"; + value: ModuleAmino; +} +/** Module is the config object of the distribution module. */ +export interface ModuleSDKType { + fee_collector_name: string; + authority: string; +} +function createBaseModule(): Module { + return { + feeCollectorName: "", + authority: "" + }; +} +export const Module = { + typeUrl: "/cosmos.distribution.module.v1.Module", + encode(message: Module, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.feeCollectorName !== "") { + writer.uint32(10).string(message.feeCollectorName); + } + if (message.authority !== "") { + writer.uint32(18).string(message.authority); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.feeCollectorName = reader.string(); + break; + case 2: + message.authority = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): Module { + const message = createBaseModule(); + message.feeCollectorName = object.feeCollectorName ?? ""; + message.authority = object.authority ?? ""; + return message; + }, + fromAmino(object: ModuleAmino): Module { + const message = createBaseModule(); + if (object.fee_collector_name !== undefined && object.fee_collector_name !== null) { + message.feeCollectorName = object.fee_collector_name; + } + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + return message; + }, + toAmino(message: Module): ModuleAmino { + const obj: any = {}; + obj.fee_collector_name = message.feeCollectorName === "" ? undefined : message.feeCollectorName; + obj.authority = message.authority === "" ? undefined : message.authority; + return obj; + }, + fromAminoMsg(object: ModuleAminoMsg): Module { + return Module.fromAmino(object.value); + }, + toAminoMsg(message: Module): ModuleAminoMsg { + return { + type: "cosmos-sdk/Module", + value: Module.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleProtoMsg): Module { + return Module.decode(message.value); + }, + toProto(message: Module): Uint8Array { + return Module.encode(message).finish(); + }, + toProtoMsg(message: Module): ModuleProtoMsg { + return { + typeUrl: "/cosmos.distribution.module.v1.Module", + value: Module.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/distribution/v1beta1/distribution.ts b/packages/api/src/cosmos/distribution/v1beta1/distribution.ts index 3485d455..e85af047 100644 --- a/packages/api/src/cosmos/distribution/v1beta1/distribution.ts +++ b/packages/api/src/cosmos/distribution/v1beta1/distribution.ts @@ -5,7 +5,17 @@ import { Decimal } from "@cosmjs/math"; /** Params defines the set of params for the distribution module. */ export interface Params { communityTax: string; + /** + * Deprecated: The base_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + */ + /** @deprecated */ baseProposerReward: string; + /** + * Deprecated: The bonus_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + */ + /** @deprecated */ bonusProposerReward: string; withdrawAddrEnabled: boolean; } @@ -15,19 +25,31 @@ export interface ParamsProtoMsg { } /** Params defines the set of params for the distribution module. */ export interface ParamsAmino { - community_tax?: string; - base_proposer_reward?: string; - bonus_proposer_reward?: string; + community_tax: string; + /** + * Deprecated: The base_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + */ + /** @deprecated */ + base_proposer_reward: string; + /** + * Deprecated: The bonus_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + */ + /** @deprecated */ + bonus_proposer_reward: string; withdraw_addr_enabled?: boolean; } export interface ParamsAminoMsg { - type: "cosmos-sdk/Params"; + type: "cosmos-sdk/x/distribution/Params"; value: ParamsAmino; } /** Params defines the set of params for the distribution module. */ export interface ParamsSDKType { community_tax: string; + /** @deprecated */ base_proposer_reward: string; + /** @deprecated */ bonus_proposer_reward: string; withdraw_addr_enabled: boolean; } @@ -68,7 +90,7 @@ export interface ValidatorHistoricalRewardsProtoMsg { * + one per validator for the zeroeth period, set on initialization */ export interface ValidatorHistoricalRewardsAmino { - cumulative_reward_ratio?: DecCoinAmino[]; + cumulative_reward_ratio: DecCoinAmino[]; reference_count?: number; } export interface ValidatorHistoricalRewardsAminoMsg { @@ -112,7 +134,7 @@ export interface ValidatorCurrentRewardsProtoMsg { * each block as long as the validator's tokens remain constant. */ export interface ValidatorCurrentRewardsAmino { - rewards?: DecCoinAmino[]; + rewards: DecCoinAmino[]; period?: string; } export interface ValidatorCurrentRewardsAminoMsg { @@ -144,7 +166,7 @@ export interface ValidatorAccumulatedCommissionProtoMsg { * for a validator kept as a running counter, can be withdrawn at any time. */ export interface ValidatorAccumulatedCommissionAmino { - commission?: DecCoinAmino[]; + commission: DecCoinAmino[]; } export interface ValidatorAccumulatedCommissionAminoMsg { type: "cosmos-sdk/ValidatorAccumulatedCommission"; @@ -173,7 +195,7 @@ export interface ValidatorOutstandingRewardsProtoMsg { * for a validator inexpensive to track, allows simple sanity checks. */ export interface ValidatorOutstandingRewardsAmino { - rewards?: DecCoinAmino[]; + rewards: DecCoinAmino[]; } export interface ValidatorOutstandingRewardsAminoMsg { type: "cosmos-sdk/ValidatorOutstandingRewards"; @@ -234,7 +256,7 @@ export interface ValidatorSlashEventsProtoMsg { } /** ValidatorSlashEvents is a collection of ValidatorSlashEvent messages. */ export interface ValidatorSlashEventsAmino { - validator_slash_events?: ValidatorSlashEventAmino[]; + validator_slash_events: ValidatorSlashEventAmino[]; } export interface ValidatorSlashEventsAminoMsg { type: "cosmos-sdk/ValidatorSlashEvents"; @@ -254,7 +276,7 @@ export interface FeePoolProtoMsg { } /** FeePool is the global fee pool for distribution. */ export interface FeePoolAmino { - community_pool?: DecCoinAmino[]; + community_pool: DecCoinAmino[]; } export interface FeePoolAminoMsg { type: "cosmos-sdk/FeePool"; @@ -268,7 +290,13 @@ export interface FeePoolSDKType { * CommunityPoolSpendProposal details a proposal for use of community funds, * together with how many coins are proposed to be spent, and to which * recipient account. + * + * Deprecated: Do not use. As of the Cosmos SDK release v0.47.x, there is no + * longer a need for an explicit CommunityPoolSpendProposal. To spend community + * pool funds, a simple MsgCommunityPoolSpend can be invoked from the x/gov + * module via a v1 governance proposal. */ +/** @deprecated */ export interface CommunityPoolSpendProposal { $typeUrl?: "/cosmos.distribution.v1beta1.CommunityPoolSpendProposal"; title: string; @@ -284,12 +312,18 @@ export interface CommunityPoolSpendProposalProtoMsg { * CommunityPoolSpendProposal details a proposal for use of community funds, * together with how many coins are proposed to be spent, and to which * recipient account. + * + * Deprecated: Do not use. As of the Cosmos SDK release v0.47.x, there is no + * longer a need for an explicit CommunityPoolSpendProposal. To spend community + * pool funds, a simple MsgCommunityPoolSpend can be invoked from the x/gov + * module via a v1 governance proposal. */ +/** @deprecated */ export interface CommunityPoolSpendProposalAmino { title?: string; description?: string; recipient?: string; - amount?: CoinAmino[]; + amount: CoinAmino[]; } export interface CommunityPoolSpendProposalAminoMsg { type: "cosmos-sdk/CommunityPoolSpendProposal"; @@ -299,7 +333,13 @@ export interface CommunityPoolSpendProposalAminoMsg { * CommunityPoolSpendProposal details a proposal for use of community funds, * together with how many coins are proposed to be spent, and to which * recipient account. + * + * Deprecated: Do not use. As of the Cosmos SDK release v0.47.x, there is no + * longer a need for an explicit CommunityPoolSpendProposal. To spend community + * pool funds, a simple MsgCommunityPoolSpend can be invoked from the x/gov + * module via a v1 governance proposal. */ +/** @deprecated */ export interface CommunityPoolSpendProposalSDKType { $typeUrl?: "/cosmos.distribution.v1beta1.CommunityPoolSpendProposal"; title: string; @@ -334,7 +374,7 @@ export interface DelegatorStartingInfoProtoMsg { */ export interface DelegatorStartingInfoAmino { previous_period?: string; - stake?: string; + stake: string; height: string; } export interface DelegatorStartingInfoAminoMsg { @@ -372,7 +412,7 @@ export interface DelegationDelegatorRewardProtoMsg { */ export interface DelegationDelegatorRewardAmino { validator_address?: string; - reward?: DecCoinAmino[]; + reward: DecCoinAmino[]; } export interface DelegationDelegatorRewardAminoMsg { type: "cosmos-sdk/DelegationDelegatorReward"; @@ -506,9 +546,9 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.community_tax = message.communityTax === "" ? undefined : message.communityTax; - obj.base_proposer_reward = message.baseProposerReward === "" ? undefined : message.baseProposerReward; - obj.bonus_proposer_reward = message.bonusProposerReward === "" ? undefined : message.bonusProposerReward; + obj.community_tax = message.communityTax ?? ""; + obj.base_proposer_reward = message.baseProposerReward ?? ""; + obj.bonus_proposer_reward = message.bonusProposerReward ?? ""; obj.withdraw_addr_enabled = message.withdrawAddrEnabled === false ? undefined : message.withdrawAddrEnabled; return obj; }, @@ -517,7 +557,7 @@ export const Params = { }, toAminoMsg(message: Params): ParamsAminoMsg { return { - type: "cosmos-sdk/Params", + type: "cosmos-sdk/x/distribution/Params", value: Params.toAmino(message) }; }, @@ -1240,7 +1280,7 @@ export const DelegatorStartingInfo = { toAmino(message: DelegatorStartingInfo): DelegatorStartingInfoAmino { const obj: any = {}; obj.previous_period = message.previousPeriod !== BigInt(0) ? message.previousPeriod?.toString() : undefined; - obj.stake = message.stake === "" ? undefined : message.stake; + obj.stake = message.stake ?? ""; obj.height = message.height ? message.height?.toString() : "0"; return obj; }, diff --git a/packages/api/src/cosmos/distribution/v1beta1/genesis.ts b/packages/api/src/cosmos/distribution/v1beta1/genesis.ts index cfb24fff..547798d0 100644 --- a/packages/api/src/cosmos/distribution/v1beta1/genesis.ts +++ b/packages/api/src/cosmos/distribution/v1beta1/genesis.ts @@ -45,7 +45,7 @@ export interface DelegatorWithdrawInfoSDKType { export interface ValidatorOutstandingRewardsRecord { /** validator_address is the address of the validator. */ validatorAddress: string; - /** outstanding_rewards represents the oustanding rewards of a validator. */ + /** outstanding_rewards represents the outstanding rewards of a validator. */ outstandingRewards: DecCoin[]; } export interface ValidatorOutstandingRewardsRecordProtoMsg { @@ -56,8 +56,8 @@ export interface ValidatorOutstandingRewardsRecordProtoMsg { export interface ValidatorOutstandingRewardsRecordAmino { /** validator_address is the address of the validator. */ validator_address?: string; - /** outstanding_rewards represents the oustanding rewards of a validator. */ - outstanding_rewards?: DecCoinAmino[]; + /** outstanding_rewards represents the outstanding rewards of a validator. */ + outstanding_rewards: DecCoinAmino[]; } export interface ValidatorOutstandingRewardsRecordAminoMsg { type: "cosmos-sdk/ValidatorOutstandingRewardsRecord"; @@ -90,7 +90,7 @@ export interface ValidatorAccumulatedCommissionRecordAmino { /** validator_address is the address of the validator. */ validator_address?: string; /** accumulated is the accumulated commission of a validator. */ - accumulated?: ValidatorAccumulatedCommissionAmino; + accumulated: ValidatorAccumulatedCommissionAmino; } export interface ValidatorAccumulatedCommissionRecordAminoMsg { type: "cosmos-sdk/ValidatorAccumulatedCommissionRecord"; @@ -130,7 +130,7 @@ export interface ValidatorHistoricalRewardsRecordAmino { /** period defines the period the historical rewards apply to. */ period?: string; /** rewards defines the historical rewards of a validator. */ - rewards?: ValidatorHistoricalRewardsAmino; + rewards: ValidatorHistoricalRewardsAmino; } export interface ValidatorHistoricalRewardsRecordAminoMsg { type: "cosmos-sdk/ValidatorHistoricalRewardsRecord"; @@ -161,7 +161,7 @@ export interface ValidatorCurrentRewardsRecordAmino { /** validator_address is the address of the validator. */ validator_address?: string; /** rewards defines the current rewards of a validator. */ - rewards?: ValidatorCurrentRewardsAmino; + rewards: ValidatorCurrentRewardsAmino; } export interface ValidatorCurrentRewardsRecordAminoMsg { type: "cosmos-sdk/ValidatorCurrentRewardsRecord"; @@ -192,7 +192,7 @@ export interface DelegatorStartingInfoRecordAmino { /** validator_address is the address of the validator. */ validator_address?: string; /** starting_info defines the starting info of a delegator. */ - starting_info?: DelegatorStartingInfoAmino; + starting_info: DelegatorStartingInfoAmino; } export interface DelegatorStartingInfoRecordAminoMsg { type: "cosmos-sdk/DelegatorStartingInfoRecord"; @@ -208,7 +208,7 @@ export interface DelegatorStartingInfoRecordSDKType { export interface ValidatorSlashEventRecord { /** validator_address is the address of the validator. */ validatorAddress: string; - /** height defines the block height at which the slash event occured. */ + /** height defines the block height at which the slash event occurred. */ height: bigint; /** period is the period of the slash event. */ period: bigint; @@ -223,12 +223,12 @@ export interface ValidatorSlashEventRecordProtoMsg { export interface ValidatorSlashEventRecordAmino { /** validator_address is the address of the validator. */ validator_address?: string; - /** height defines the block height at which the slash event occured. */ + /** height defines the block height at which the slash event occurred. */ height?: string; /** period is the period of the slash event. */ period?: string; /** validator_slash_event describes the slash event. */ - validator_slash_event?: ValidatorSlashEventAmino; + validator_slash_event: ValidatorSlashEventAmino; } export interface ValidatorSlashEventRecordAminoMsg { type: "cosmos-sdk/ValidatorSlashEventRecord"; @@ -243,7 +243,7 @@ export interface ValidatorSlashEventRecordSDKType { } /** GenesisState defines the distribution module's genesis state. */ export interface GenesisState { - /** params defines all the paramaters of the module. */ + /** params defines all the parameters of the module. */ params: Params; /** fee_pool defines the fee pool at genesis. */ feePool: FeePool; @@ -253,7 +253,7 @@ export interface GenesisState { previousProposer: string; /** fee_pool defines the outstanding rewards of all validators at genesis. */ outstandingRewards: ValidatorOutstandingRewardsRecord[]; - /** fee_pool defines the accumulated commisions of all validators at genesis. */ + /** fee_pool defines the accumulated commissions of all validators at genesis. */ validatorAccumulatedCommissions: ValidatorAccumulatedCommissionRecord[]; /** fee_pool defines the historical rewards of all validators at genesis. */ validatorHistoricalRewards: ValidatorHistoricalRewardsRecord[]; @@ -270,26 +270,26 @@ export interface GenesisStateProtoMsg { } /** GenesisState defines the distribution module's genesis state. */ export interface GenesisStateAmino { - /** params defines all the paramaters of the module. */ - params?: ParamsAmino; + /** params defines all the parameters of the module. */ + params: ParamsAmino; /** fee_pool defines the fee pool at genesis. */ - fee_pool?: FeePoolAmino; + fee_pool: FeePoolAmino; /** fee_pool defines the delegator withdraw infos at genesis. */ - delegator_withdraw_infos?: DelegatorWithdrawInfoAmino[]; + delegator_withdraw_infos: DelegatorWithdrawInfoAmino[]; /** fee_pool defines the previous proposer at genesis. */ previous_proposer?: string; /** fee_pool defines the outstanding rewards of all validators at genesis. */ - outstanding_rewards?: ValidatorOutstandingRewardsRecordAmino[]; - /** fee_pool defines the accumulated commisions of all validators at genesis. */ - validator_accumulated_commissions?: ValidatorAccumulatedCommissionRecordAmino[]; + outstanding_rewards: ValidatorOutstandingRewardsRecordAmino[]; + /** fee_pool defines the accumulated commissions of all validators at genesis. */ + validator_accumulated_commissions: ValidatorAccumulatedCommissionRecordAmino[]; /** fee_pool defines the historical rewards of all validators at genesis. */ - validator_historical_rewards?: ValidatorHistoricalRewardsRecordAmino[]; + validator_historical_rewards: ValidatorHistoricalRewardsRecordAmino[]; /** fee_pool defines the current rewards of all validators at genesis. */ - validator_current_rewards?: ValidatorCurrentRewardsRecordAmino[]; + validator_current_rewards: ValidatorCurrentRewardsRecordAmino[]; /** fee_pool defines the delegator starting infos at genesis. */ - delegator_starting_infos?: DelegatorStartingInfoRecordAmino[]; + delegator_starting_infos: DelegatorStartingInfoRecordAmino[]; /** fee_pool defines the validator slash events at genesis. */ - validator_slash_events?: ValidatorSlashEventRecordAmino[]; + validator_slash_events: ValidatorSlashEventRecordAmino[]; } export interface GenesisStateAminoMsg { type: "cosmos-sdk/GenesisState"; @@ -528,7 +528,7 @@ export const ValidatorAccumulatedCommissionRecord = { toAmino(message: ValidatorAccumulatedCommissionRecord): ValidatorAccumulatedCommissionRecordAmino { const obj: any = {}; obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; - obj.accumulated = message.accumulated ? ValidatorAccumulatedCommission.toAmino(message.accumulated) : undefined; + obj.accumulated = message.accumulated ? ValidatorAccumulatedCommission.toAmino(message.accumulated) : ValidatorAccumulatedCommission.toAmino(ValidatorAccumulatedCommission.fromPartial({})); return obj; }, fromAminoMsg(object: ValidatorAccumulatedCommissionRecordAminoMsg): ValidatorAccumulatedCommissionRecord { @@ -621,7 +621,7 @@ export const ValidatorHistoricalRewardsRecord = { const obj: any = {}; obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; obj.period = message.period !== BigInt(0) ? message.period?.toString() : undefined; - obj.rewards = message.rewards ? ValidatorHistoricalRewards.toAmino(message.rewards) : undefined; + obj.rewards = message.rewards ? ValidatorHistoricalRewards.toAmino(message.rewards) : ValidatorHistoricalRewards.toAmino(ValidatorHistoricalRewards.fromPartial({})); return obj; }, fromAminoMsg(object: ValidatorHistoricalRewardsRecordAminoMsg): ValidatorHistoricalRewardsRecord { @@ -702,7 +702,7 @@ export const ValidatorCurrentRewardsRecord = { toAmino(message: ValidatorCurrentRewardsRecord): ValidatorCurrentRewardsRecordAmino { const obj: any = {}; obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; - obj.rewards = message.rewards ? ValidatorCurrentRewards.toAmino(message.rewards) : undefined; + obj.rewards = message.rewards ? ValidatorCurrentRewards.toAmino(message.rewards) : ValidatorCurrentRewards.toAmino(ValidatorCurrentRewards.fromPartial({})); return obj; }, fromAminoMsg(object: ValidatorCurrentRewardsRecordAminoMsg): ValidatorCurrentRewardsRecord { @@ -795,7 +795,7 @@ export const DelegatorStartingInfoRecord = { const obj: any = {}; obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; - obj.starting_info = message.startingInfo ? DelegatorStartingInfo.toAmino(message.startingInfo) : undefined; + obj.starting_info = message.startingInfo ? DelegatorStartingInfo.toAmino(message.startingInfo) : DelegatorStartingInfo.toAmino(DelegatorStartingInfo.fromPartial({})); return obj; }, fromAminoMsg(object: DelegatorStartingInfoRecordAminoMsg): DelegatorStartingInfoRecord { @@ -900,7 +900,7 @@ export const ValidatorSlashEventRecord = { obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; obj.height = message.height !== BigInt(0) ? message.height?.toString() : undefined; obj.period = message.period !== BigInt(0) ? message.period?.toString() : undefined; - obj.validator_slash_event = message.validatorSlashEvent ? ValidatorSlashEvent.toAmino(message.validatorSlashEvent) : undefined; + obj.validator_slash_event = message.validatorSlashEvent ? ValidatorSlashEvent.toAmino(message.validatorSlashEvent) : ValidatorSlashEvent.toAmino(ValidatorSlashEvent.fromPartial({})); return obj; }, fromAminoMsg(object: ValidatorSlashEventRecordAminoMsg): ValidatorSlashEventRecord { @@ -1054,8 +1054,8 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.params = message.params ? Params.toAmino(message.params) : undefined; - obj.fee_pool = message.feePool ? FeePool.toAmino(message.feePool) : undefined; + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); + obj.fee_pool = message.feePool ? FeePool.toAmino(message.feePool) : FeePool.toAmino(FeePool.fromPartial({})); if (message.delegatorWithdrawInfos) { obj.delegator_withdraw_infos = message.delegatorWithdrawInfos.map(e => e ? DelegatorWithdrawInfo.toAmino(e) : undefined); } else { diff --git a/packages/api/src/cosmos/distribution/v1beta1/query.lcd.ts b/packages/api/src/cosmos/distribution/v1beta1/query.lcd.ts index 49389ca8..2d49281c 100644 --- a/packages/api/src/cosmos/distribution/v1beta1/query.lcd.ts +++ b/packages/api/src/cosmos/distribution/v1beta1/query.lcd.ts @@ -1,7 +1,7 @@ //@ts-nocheck import { setPaginationParams } from "../../../helpers"; import { LCDClient } from "@cosmology/lcd"; -import { QueryParamsRequest, QueryParamsResponseSDKType, QueryValidatorOutstandingRewardsRequest, QueryValidatorOutstandingRewardsResponseSDKType, QueryValidatorCommissionRequest, QueryValidatorCommissionResponseSDKType, QueryValidatorSlashesRequest, QueryValidatorSlashesResponseSDKType, QueryDelegationRewardsRequest, QueryDelegationRewardsResponseSDKType, QueryDelegationTotalRewardsRequest, QueryDelegationTotalRewardsResponseSDKType, QueryDelegatorValidatorsRequest, QueryDelegatorValidatorsResponseSDKType, QueryDelegatorWithdrawAddressRequest, QueryDelegatorWithdrawAddressResponseSDKType, QueryCommunityPoolRequest, QueryCommunityPoolResponseSDKType } from "./query"; +import { QueryParamsRequest, QueryParamsResponseSDKType, QueryValidatorDistributionInfoRequest, QueryValidatorDistributionInfoResponseSDKType, QueryValidatorOutstandingRewardsRequest, QueryValidatorOutstandingRewardsResponseSDKType, QueryValidatorCommissionRequest, QueryValidatorCommissionResponseSDKType, QueryValidatorSlashesRequest, QueryValidatorSlashesResponseSDKType, QueryDelegationRewardsRequest, QueryDelegationRewardsResponseSDKType, QueryDelegationTotalRewardsRequest, QueryDelegationTotalRewardsResponseSDKType, QueryDelegatorValidatorsRequest, QueryDelegatorValidatorsResponseSDKType, QueryDelegatorWithdrawAddressRequest, QueryDelegatorWithdrawAddressResponseSDKType, QueryCommunityPoolRequest, QueryCommunityPoolResponseSDKType } from "./query"; export class LCDQueryClient { req: LCDClient; constructor({ @@ -11,6 +11,7 @@ export class LCDQueryClient { }) { this.req = requestClient; this.params = this.params.bind(this); + this.validatorDistributionInfo = this.validatorDistributionInfo.bind(this); this.validatorOutstandingRewards = this.validatorOutstandingRewards.bind(this); this.validatorCommission = this.validatorCommission.bind(this); this.validatorSlashes = this.validatorSlashes.bind(this); @@ -25,6 +26,11 @@ export class LCDQueryClient { const endpoint = `cosmos/distribution/v1beta1/params`; return await this.req.get(endpoint); } + /* ValidatorDistributionInfo queries validator commission and self-delegation rewards for validator */ + async validatorDistributionInfo(params: QueryValidatorDistributionInfoRequest): Promise { + const endpoint = `cosmos/distribution/v1beta1/validators/${params.validatorAddress}`; + return await this.req.get(endpoint); + } /* ValidatorOutstandingRewards queries rewards of a validator address. */ async validatorOutstandingRewards(params: QueryValidatorOutstandingRewardsRequest): Promise { const endpoint = `cosmos/distribution/v1beta1/validators/${params.validatorAddress}/outstanding_rewards`; @@ -57,7 +63,7 @@ export class LCDQueryClient { const endpoint = `cosmos/distribution/v1beta1/delegators/${params.delegatorAddress}/rewards/${params.validatorAddress}`; return await this.req.get(endpoint); } - /* DelegationTotalRewards queries the total rewards accrued by a each + /* DelegationTotalRewards queries the total rewards accrued by each validator. */ async delegationTotalRewards(params: QueryDelegationTotalRewardsRequest): Promise { const endpoint = `cosmos/distribution/v1beta1/delegators/${params.delegatorAddress}/rewards`; @@ -73,7 +79,9 @@ export class LCDQueryClient { const endpoint = `cosmos/distribution/v1beta1/delegators/${params.delegatorAddress}/withdraw_address`; return await this.req.get(endpoint); } - /* CommunityPool queries the community pool coins. */ + /* CommunityPool queries the community pool coins. + + WARNING: This query will fail if an external community pool is used. */ async communityPool(_params: QueryCommunityPoolRequest = {}): Promise { const endpoint = `cosmos/distribution/v1beta1/community_pool`; return await this.req.get(endpoint); diff --git a/packages/api/src/cosmos/distribution/v1beta1/query.rpc.Query.ts b/packages/api/src/cosmos/distribution/v1beta1/query.rpc.Query.ts index 6ff5c4c2..e7f47a39 100644 --- a/packages/api/src/cosmos/distribution/v1beta1/query.rpc.Query.ts +++ b/packages/api/src/cosmos/distribution/v1beta1/query.rpc.Query.ts @@ -2,11 +2,13 @@ import { Rpc } from "../../../helpers"; import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryParamsRequest, QueryParamsResponse, QueryValidatorOutstandingRewardsRequest, QueryValidatorOutstandingRewardsResponse, QueryValidatorCommissionRequest, QueryValidatorCommissionResponse, QueryValidatorSlashesRequest, QueryValidatorSlashesResponse, QueryDelegationRewardsRequest, QueryDelegationRewardsResponse, QueryDelegationTotalRewardsRequest, QueryDelegationTotalRewardsResponse, QueryDelegatorValidatorsRequest, QueryDelegatorValidatorsResponse, QueryDelegatorWithdrawAddressRequest, QueryDelegatorWithdrawAddressResponse, QueryCommunityPoolRequest, QueryCommunityPoolResponse } from "./query"; +import { QueryParamsRequest, QueryParamsResponse, QueryValidatorDistributionInfoRequest, QueryValidatorDistributionInfoResponse, QueryValidatorOutstandingRewardsRequest, QueryValidatorOutstandingRewardsResponse, QueryValidatorCommissionRequest, QueryValidatorCommissionResponse, QueryValidatorSlashesRequest, QueryValidatorSlashesResponse, QueryDelegationRewardsRequest, QueryDelegationRewardsResponse, QueryDelegationTotalRewardsRequest, QueryDelegationTotalRewardsResponse, QueryDelegatorValidatorsRequest, QueryDelegatorValidatorsResponse, QueryDelegatorWithdrawAddressRequest, QueryDelegatorWithdrawAddressResponse, QueryCommunityPoolRequest, QueryCommunityPoolResponse } from "./query"; /** Query defines the gRPC querier service for distribution module. */ export interface Query { /** Params queries params of the distribution module. */ params(request?: QueryParamsRequest): Promise; + /** ValidatorDistributionInfo queries validator commission and self-delegation rewards for validator */ + validatorDistributionInfo(request: QueryValidatorDistributionInfoRequest): Promise; /** ValidatorOutstandingRewards queries rewards of a validator address. */ validatorOutstandingRewards(request: QueryValidatorOutstandingRewardsRequest): Promise; /** ValidatorCommission queries accumulated commission for a validator. */ @@ -16,7 +18,7 @@ export interface Query { /** DelegationRewards queries the total rewards accrued by a delegation. */ delegationRewards(request: QueryDelegationRewardsRequest): Promise; /** - * DelegationTotalRewards queries the total rewards accrued by a each + * DelegationTotalRewards queries the total rewards accrued by each * validator. */ delegationTotalRewards(request: QueryDelegationTotalRewardsRequest): Promise; @@ -24,7 +26,11 @@ export interface Query { delegatorValidators(request: QueryDelegatorValidatorsRequest): Promise; /** DelegatorWithdrawAddress queries withdraw address of a delegator. */ delegatorWithdrawAddress(request: QueryDelegatorWithdrawAddressRequest): Promise; - /** CommunityPool queries the community pool coins. */ + /** + * CommunityPool queries the community pool coins. + * + * WARNING: This query will fail if an external community pool is used. + */ communityPool(request?: QueryCommunityPoolRequest): Promise; } export class QueryClientImpl implements Query { @@ -32,6 +38,7 @@ export class QueryClientImpl implements Query { constructor(rpc: Rpc) { this.rpc = rpc; this.params = this.params.bind(this); + this.validatorDistributionInfo = this.validatorDistributionInfo.bind(this); this.validatorOutstandingRewards = this.validatorOutstandingRewards.bind(this); this.validatorCommission = this.validatorCommission.bind(this); this.validatorSlashes = this.validatorSlashes.bind(this); @@ -46,6 +53,11 @@ export class QueryClientImpl implements Query { const promise = this.rpc.request("cosmos.distribution.v1beta1.Query", "Params", data); return promise.then(data => QueryParamsResponse.decode(new BinaryReader(data))); } + validatorDistributionInfo(request: QueryValidatorDistributionInfoRequest): Promise { + const data = QueryValidatorDistributionInfoRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.distribution.v1beta1.Query", "ValidatorDistributionInfo", data); + return promise.then(data => QueryValidatorDistributionInfoResponse.decode(new BinaryReader(data))); + } validatorOutstandingRewards(request: QueryValidatorOutstandingRewardsRequest): Promise { const data = QueryValidatorOutstandingRewardsRequest.encode(request).finish(); const promise = this.rpc.request("cosmos.distribution.v1beta1.Query", "ValidatorOutstandingRewards", data); @@ -94,6 +106,9 @@ export const createRpcQueryExtension = (base: QueryClient) => { params(request?: QueryParamsRequest): Promise { return queryService.params(request); }, + validatorDistributionInfo(request: QueryValidatorDistributionInfoRequest): Promise { + return queryService.validatorDistributionInfo(request); + }, validatorOutstandingRewards(request: QueryValidatorOutstandingRewardsRequest): Promise { return queryService.validatorOutstandingRewards(request); }, diff --git a/packages/api/src/cosmos/distribution/v1beta1/query.ts b/packages/api/src/cosmos/distribution/v1beta1/query.ts index 9efe3b0e..9435f562 100644 --- a/packages/api/src/cosmos/distribution/v1beta1/query.ts +++ b/packages/api/src/cosmos/distribution/v1beta1/query.ts @@ -29,7 +29,7 @@ export interface QueryParamsResponseProtoMsg { /** QueryParamsResponse is the response type for the Query/Params RPC method. */ export interface QueryParamsResponseAmino { /** params defines the parameters of the module. */ - params?: ParamsAmino; + params: ParamsAmino; } export interface QueryParamsResponseAminoMsg { type: "cosmos-sdk/QueryParamsResponse"; @@ -39,6 +39,60 @@ export interface QueryParamsResponseAminoMsg { export interface QueryParamsResponseSDKType { params: ParamsSDKType; } +/** QueryValidatorDistributionInfoRequest is the request type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} +export interface QueryValidatorDistributionInfoRequestProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorDistributionInfoRequest"; + value: Uint8Array; +} +/** QueryValidatorDistributionInfoRequest is the request type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoRequestAmino { + /** validator_address defines the validator address to query for. */ + validator_address?: string; +} +export interface QueryValidatorDistributionInfoRequestAminoMsg { + type: "cosmos-sdk/QueryValidatorDistributionInfoRequest"; + value: QueryValidatorDistributionInfoRequestAmino; +} +/** QueryValidatorDistributionInfoRequest is the request type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoRequestSDKType { + validator_address: string; +} +/** QueryValidatorDistributionInfoResponse is the response type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoResponse { + /** operator_address defines the validator operator address. */ + operatorAddress: string; + /** self_bond_rewards defines the self delegations rewards. */ + selfBondRewards: DecCoin[]; + /** commission defines the commission the validator received. */ + commission: DecCoin[]; +} +export interface QueryValidatorDistributionInfoResponseProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorDistributionInfoResponse"; + value: Uint8Array; +} +/** QueryValidatorDistributionInfoResponse is the response type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoResponseAmino { + /** operator_address defines the validator operator address. */ + operator_address?: string; + /** self_bond_rewards defines the self delegations rewards. */ + self_bond_rewards: DecCoinAmino[]; + /** commission defines the commission the validator received. */ + commission?: DecCoinAmino[]; +} +export interface QueryValidatorDistributionInfoResponseAminoMsg { + type: "cosmos-sdk/QueryValidatorDistributionInfoResponse"; + value: QueryValidatorDistributionInfoResponseAmino; +} +/** QueryValidatorDistributionInfoResponse is the response type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoResponseSDKType { + operator_address: string; + self_bond_rewards: DecCoinSDKType[]; + commission: DecCoinSDKType[]; +} /** * QueryValidatorOutstandingRewardsRequest is the request type for the * Query/ValidatorOutstandingRewards RPC method. @@ -86,7 +140,7 @@ export interface QueryValidatorOutstandingRewardsResponseProtoMsg { * Query/ValidatorOutstandingRewards RPC method. */ export interface QueryValidatorOutstandingRewardsResponseAmino { - rewards?: ValidatorOutstandingRewardsAmino; + rewards: ValidatorOutstandingRewardsAmino; } export interface QueryValidatorOutstandingRewardsResponseAminoMsg { type: "cosmos-sdk/QueryValidatorOutstandingRewardsResponse"; @@ -135,7 +189,7 @@ export interface QueryValidatorCommissionRequestSDKType { * Query/ValidatorCommission RPC method */ export interface QueryValidatorCommissionResponse { - /** commission defines the commision the validator received. */ + /** commission defines the commission the validator received. */ commission: ValidatorAccumulatedCommission; } export interface QueryValidatorCommissionResponseProtoMsg { @@ -147,8 +201,8 @@ export interface QueryValidatorCommissionResponseProtoMsg { * Query/ValidatorCommission RPC method */ export interface QueryValidatorCommissionResponseAmino { - /** commission defines the commision the validator received. */ - commission?: ValidatorAccumulatedCommissionAmino; + /** commission defines the commission the validator received. */ + commission: ValidatorAccumulatedCommissionAmino; } export interface QueryValidatorCommissionResponseAminoMsg { type: "cosmos-sdk/QueryValidatorCommissionResponse"; @@ -227,7 +281,7 @@ export interface QueryValidatorSlashesResponseProtoMsg { */ export interface QueryValidatorSlashesResponseAmino { /** slashes defines the slashes the validator received. */ - slashes?: ValidatorSlashEventAmino[]; + slashes: ValidatorSlashEventAmino[]; /** pagination defines the pagination in the response. */ pagination?: PageResponseAmino; } @@ -297,7 +351,7 @@ export interface QueryDelegationRewardsResponseProtoMsg { */ export interface QueryDelegationRewardsResponseAmino { /** rewards defines the rewards accrued by a delegation. */ - rewards?: DecCoinAmino[]; + rewards: DecCoinAmino[]; } export interface QueryDelegationRewardsResponseAminoMsg { type: "cosmos-sdk/QueryDelegationRewardsResponse"; @@ -361,9 +415,9 @@ export interface QueryDelegationTotalRewardsResponseProtoMsg { */ export interface QueryDelegationTotalRewardsResponseAmino { /** rewards defines all the rewards accrued by a delegator. */ - rewards?: DelegationDelegatorRewardAmino[]; + rewards: DelegationDelegatorRewardAmino[]; /** total defines the sum of all the rewards. */ - total?: DecCoinAmino[]; + total: DecCoinAmino[]; } export interface QueryDelegationTotalRewardsResponseAminoMsg { type: "cosmos-sdk/QueryDelegationTotalRewardsResponse"; @@ -542,7 +596,7 @@ export interface QueryCommunityPoolResponseProtoMsg { */ export interface QueryCommunityPoolResponseAmino { /** pool defines community pool's coins. */ - pool?: DecCoinAmino[]; + pool: DecCoinAmino[]; } export interface QueryCommunityPoolResponseAminoMsg { type: "cosmos-sdk/QueryCommunityPoolResponse"; @@ -655,7 +709,7 @@ export const QueryParamsResponse = { }, toAmino(message: QueryParamsResponse): QueryParamsResponseAmino { const obj: any = {}; - obj.params = message.params ? Params.toAmino(message.params) : undefined; + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); return obj; }, fromAminoMsg(object: QueryParamsResponseAminoMsg): QueryParamsResponse { @@ -680,6 +734,172 @@ export const QueryParamsResponse = { }; } }; +function createBaseQueryValidatorDistributionInfoRequest(): QueryValidatorDistributionInfoRequest { + return { + validatorAddress: "" + }; +} +export const QueryValidatorDistributionInfoRequest = { + typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorDistributionInfoRequest", + encode(message: QueryValidatorDistributionInfoRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorDistributionInfoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validatorAddress = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryValidatorDistributionInfoRequest { + const message = createBaseQueryValidatorDistributionInfoRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, + fromAmino(object: QueryValidatorDistributionInfoRequestAmino): QueryValidatorDistributionInfoRequest { + const message = createBaseQueryValidatorDistributionInfoRequest(); + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = object.validator_address; + } + return message; + }, + toAmino(message: QueryValidatorDistributionInfoRequest): QueryValidatorDistributionInfoRequestAmino { + const obj: any = {}; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + return obj; + }, + fromAminoMsg(object: QueryValidatorDistributionInfoRequestAminoMsg): QueryValidatorDistributionInfoRequest { + return QueryValidatorDistributionInfoRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryValidatorDistributionInfoRequest): QueryValidatorDistributionInfoRequestAminoMsg { + return { + type: "cosmos-sdk/QueryValidatorDistributionInfoRequest", + value: QueryValidatorDistributionInfoRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryValidatorDistributionInfoRequestProtoMsg): QueryValidatorDistributionInfoRequest { + return QueryValidatorDistributionInfoRequest.decode(message.value); + }, + toProto(message: QueryValidatorDistributionInfoRequest): Uint8Array { + return QueryValidatorDistributionInfoRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryValidatorDistributionInfoRequest): QueryValidatorDistributionInfoRequestProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorDistributionInfoRequest", + value: QueryValidatorDistributionInfoRequest.encode(message).finish() + }; + } +}; +function createBaseQueryValidatorDistributionInfoResponse(): QueryValidatorDistributionInfoResponse { + return { + operatorAddress: "", + selfBondRewards: [], + commission: [] + }; +} +export const QueryValidatorDistributionInfoResponse = { + typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorDistributionInfoResponse", + encode(message: QueryValidatorDistributionInfoResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.operatorAddress !== "") { + writer.uint32(10).string(message.operatorAddress); + } + for (const v of message.selfBondRewards) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.commission) { + DecCoin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorDistributionInfoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.operatorAddress = reader.string(); + break; + case 2: + message.selfBondRewards.push(DecCoin.decode(reader, reader.uint32())); + break; + case 3: + message.commission.push(DecCoin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryValidatorDistributionInfoResponse { + const message = createBaseQueryValidatorDistributionInfoResponse(); + message.operatorAddress = object.operatorAddress ?? ""; + message.selfBondRewards = object.selfBondRewards?.map(e => DecCoin.fromPartial(e)) || []; + message.commission = object.commission?.map(e => DecCoin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: QueryValidatorDistributionInfoResponseAmino): QueryValidatorDistributionInfoResponse { + const message = createBaseQueryValidatorDistributionInfoResponse(); + if (object.operator_address !== undefined && object.operator_address !== null) { + message.operatorAddress = object.operator_address; + } + message.selfBondRewards = object.self_bond_rewards?.map(e => DecCoin.fromAmino(e)) || []; + message.commission = object.commission?.map(e => DecCoin.fromAmino(e)) || []; + return message; + }, + toAmino(message: QueryValidatorDistributionInfoResponse): QueryValidatorDistributionInfoResponseAmino { + const obj: any = {}; + obj.operator_address = message.operatorAddress === "" ? undefined : message.operatorAddress; + if (message.selfBondRewards) { + obj.self_bond_rewards = message.selfBondRewards.map(e => e ? DecCoin.toAmino(e) : undefined); + } else { + obj.self_bond_rewards = message.selfBondRewards; + } + if (message.commission) { + obj.commission = message.commission.map(e => e ? DecCoin.toAmino(e) : undefined); + } else { + obj.commission = message.commission; + } + return obj; + }, + fromAminoMsg(object: QueryValidatorDistributionInfoResponseAminoMsg): QueryValidatorDistributionInfoResponse { + return QueryValidatorDistributionInfoResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryValidatorDistributionInfoResponse): QueryValidatorDistributionInfoResponseAminoMsg { + return { + type: "cosmos-sdk/QueryValidatorDistributionInfoResponse", + value: QueryValidatorDistributionInfoResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryValidatorDistributionInfoResponseProtoMsg): QueryValidatorDistributionInfoResponse { + return QueryValidatorDistributionInfoResponse.decode(message.value); + }, + toProto(message: QueryValidatorDistributionInfoResponse): Uint8Array { + return QueryValidatorDistributionInfoResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryValidatorDistributionInfoResponse): QueryValidatorDistributionInfoResponseProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorDistributionInfoResponse", + value: QueryValidatorDistributionInfoResponse.encode(message).finish() + }; + } +}; function createBaseQueryValidatorOutstandingRewardsRequest(): QueryValidatorOutstandingRewardsRequest { return { validatorAddress: "" @@ -793,7 +1013,7 @@ export const QueryValidatorOutstandingRewardsResponse = { }, toAmino(message: QueryValidatorOutstandingRewardsResponse): QueryValidatorOutstandingRewardsResponseAmino { const obj: any = {}; - obj.rewards = message.rewards ? ValidatorOutstandingRewards.toAmino(message.rewards) : undefined; + obj.rewards = message.rewards ? ValidatorOutstandingRewards.toAmino(message.rewards) : ValidatorOutstandingRewards.toAmino(ValidatorOutstandingRewards.fromPartial({})); return obj; }, fromAminoMsg(object: QueryValidatorOutstandingRewardsResponseAminoMsg): QueryValidatorOutstandingRewardsResponse { @@ -931,7 +1151,7 @@ export const QueryValidatorCommissionResponse = { }, toAmino(message: QueryValidatorCommissionResponse): QueryValidatorCommissionResponseAmino { const obj: any = {}; - obj.commission = message.commission ? ValidatorAccumulatedCommission.toAmino(message.commission) : undefined; + obj.commission = message.commission ? ValidatorAccumulatedCommission.toAmino(message.commission) : ValidatorAccumulatedCommission.toAmino(ValidatorAccumulatedCommission.fromPartial({})); return obj; }, fromAminoMsg(object: QueryValidatorCommissionResponseAminoMsg): QueryValidatorCommissionResponse { diff --git a/packages/api/src/cosmos/distribution/v1beta1/tx.amino.ts b/packages/api/src/cosmos/distribution/v1beta1/tx.amino.ts index a55f1e3f..9c2cc743 100644 --- a/packages/api/src/cosmos/distribution/v1beta1/tx.amino.ts +++ b/packages/api/src/cosmos/distribution/v1beta1/tx.amino.ts @@ -1,5 +1,5 @@ //@ts-nocheck -import { MsgSetWithdrawAddress, MsgWithdrawDelegatorReward, MsgWithdrawValidatorCommission, MsgFundCommunityPool } from "./tx"; +import { MsgSetWithdrawAddress, MsgWithdrawDelegatorReward, MsgWithdrawValidatorCommission, MsgFundCommunityPool, MsgUpdateParams, MsgCommunityPoolSpend, MsgDepositValidatorRewardsPool } from "./tx"; export const AminoConverter = { "/cosmos.distribution.v1beta1.MsgSetWithdrawAddress": { aminoType: "cosmos-sdk/MsgModifyWithdrawAddress", @@ -20,5 +20,20 @@ export const AminoConverter = { aminoType: "cosmos-sdk/MsgFundCommunityPool", toAmino: MsgFundCommunityPool.toAmino, fromAmino: MsgFundCommunityPool.fromAmino + }, + "/cosmos.distribution.v1beta1.MsgUpdateParams": { + aminoType: "cosmos-sdk/distribution/MsgUpdateParams", + toAmino: MsgUpdateParams.toAmino, + fromAmino: MsgUpdateParams.fromAmino + }, + "/cosmos.distribution.v1beta1.MsgCommunityPoolSpend": { + aminoType: "cosmos-sdk/distr/MsgCommunityPoolSpend", + toAmino: MsgCommunityPoolSpend.toAmino, + fromAmino: MsgCommunityPoolSpend.fromAmino + }, + "/cosmos.distribution.v1beta1.MsgDepositValidatorRewardsPool": { + aminoType: "cosmos-sdk/distr/MsgDepositValRewards", + toAmino: MsgDepositValidatorRewardsPool.toAmino, + fromAmino: MsgDepositValidatorRewardsPool.fromAmino } }; \ No newline at end of file diff --git a/packages/api/src/cosmos/distribution/v1beta1/tx.registry.ts b/packages/api/src/cosmos/distribution/v1beta1/tx.registry.ts index 52151ed5..fa7f6a58 100644 --- a/packages/api/src/cosmos/distribution/v1beta1/tx.registry.ts +++ b/packages/api/src/cosmos/distribution/v1beta1/tx.registry.ts @@ -1,7 +1,7 @@ //@ts-nocheck import { GeneratedType, Registry } from "@cosmjs/proto-signing"; -import { MsgSetWithdrawAddress, MsgWithdrawDelegatorReward, MsgWithdrawValidatorCommission, MsgFundCommunityPool } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", MsgSetWithdrawAddress], ["/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", MsgWithdrawDelegatorReward], ["/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", MsgWithdrawValidatorCommission], ["/cosmos.distribution.v1beta1.MsgFundCommunityPool", MsgFundCommunityPool]]; +import { MsgSetWithdrawAddress, MsgWithdrawDelegatorReward, MsgWithdrawValidatorCommission, MsgFundCommunityPool, MsgUpdateParams, MsgCommunityPoolSpend, MsgDepositValidatorRewardsPool } from "./tx"; +export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", MsgSetWithdrawAddress], ["/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", MsgWithdrawDelegatorReward], ["/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", MsgWithdrawValidatorCommission], ["/cosmos.distribution.v1beta1.MsgFundCommunityPool", MsgFundCommunityPool], ["/cosmos.distribution.v1beta1.MsgUpdateParams", MsgUpdateParams], ["/cosmos.distribution.v1beta1.MsgCommunityPoolSpend", MsgCommunityPoolSpend], ["/cosmos.distribution.v1beta1.MsgDepositValidatorRewardsPool", MsgDepositValidatorRewardsPool]]; export const load = (protoRegistry: Registry) => { registry.forEach(([typeUrl, mod]) => { protoRegistry.register(typeUrl, mod); @@ -32,6 +32,24 @@ export const MessageComposer = { typeUrl: "/cosmos.distribution.v1beta1.MsgFundCommunityPool", value: MsgFundCommunityPool.encode(value).finish() }; + }, + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgUpdateParams", + value: MsgUpdateParams.encode(value).finish() + }; + }, + communityPoolSpend(value: MsgCommunityPoolSpend) { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgCommunityPoolSpend", + value: MsgCommunityPoolSpend.encode(value).finish() + }; + }, + depositValidatorRewardsPool(value: MsgDepositValidatorRewardsPool) { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgDepositValidatorRewardsPool", + value: MsgDepositValidatorRewardsPool.encode(value).finish() + }; } }, withTypeUrl: { @@ -58,6 +76,24 @@ export const MessageComposer = { typeUrl: "/cosmos.distribution.v1beta1.MsgFundCommunityPool", value }; + }, + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgUpdateParams", + value + }; + }, + communityPoolSpend(value: MsgCommunityPoolSpend) { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgCommunityPoolSpend", + value + }; + }, + depositValidatorRewardsPool(value: MsgDepositValidatorRewardsPool) { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgDepositValidatorRewardsPool", + value + }; } }, fromPartial: { @@ -84,6 +120,24 @@ export const MessageComposer = { typeUrl: "/cosmos.distribution.v1beta1.MsgFundCommunityPool", value: MsgFundCommunityPool.fromPartial(value) }; + }, + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgUpdateParams", + value: MsgUpdateParams.fromPartial(value) + }; + }, + communityPoolSpend(value: MsgCommunityPoolSpend) { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgCommunityPoolSpend", + value: MsgCommunityPoolSpend.fromPartial(value) + }; + }, + depositValidatorRewardsPool(value: MsgDepositValidatorRewardsPool) { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgDepositValidatorRewardsPool", + value: MsgDepositValidatorRewardsPool.fromPartial(value) + }; } } }; \ No newline at end of file diff --git a/packages/api/src/cosmos/distribution/v1beta1/tx.rpc.msg.ts b/packages/api/src/cosmos/distribution/v1beta1/tx.rpc.msg.ts index fefe32ff..cc2b0328 100644 --- a/packages/api/src/cosmos/distribution/v1beta1/tx.rpc.msg.ts +++ b/packages/api/src/cosmos/distribution/v1beta1/tx.rpc.msg.ts @@ -1,7 +1,7 @@ //@ts-nocheck import { Rpc } from "../../../helpers"; import { BinaryReader } from "../../../binary"; -import { MsgSetWithdrawAddress, MsgSetWithdrawAddressResponse, MsgWithdrawDelegatorReward, MsgWithdrawDelegatorRewardResponse, MsgWithdrawValidatorCommission, MsgWithdrawValidatorCommissionResponse, MsgFundCommunityPool, MsgFundCommunityPoolResponse } from "./tx"; +import { MsgSetWithdrawAddress, MsgSetWithdrawAddressResponse, MsgWithdrawDelegatorReward, MsgWithdrawDelegatorRewardResponse, MsgWithdrawValidatorCommission, MsgWithdrawValidatorCommissionResponse, MsgFundCommunityPool, MsgFundCommunityPoolResponse, MsgUpdateParams, MsgUpdateParamsResponse, MsgCommunityPoolSpend, MsgCommunityPoolSpendResponse, MsgDepositValidatorRewardsPool, MsgDepositValidatorRewardsPoolResponse } from "./tx"; /** Msg defines the distribution Msg service. */ export interface Msg { /** @@ -22,8 +22,29 @@ export interface Msg { /** * FundCommunityPool defines a method to allow an account to directly * fund the community pool. + * + * WARNING: This method will fail if an external community pool is used. */ fundCommunityPool(request: MsgFundCommunityPool): Promise; + /** + * UpdateParams defines a governance operation for updating the x/distribution + * module parameters. The authority is defined in the keeper. + */ + updateParams(request: MsgUpdateParams): Promise; + /** + * CommunityPoolSpend defines a governance operation for sending tokens from + * the community pool in the x/distribution module to another account, which + * could be the governance module itself. The authority is defined in the + * keeper. + * + * WARNING: This method will fail if an external community pool is used. + */ + communityPoolSpend(request: MsgCommunityPoolSpend): Promise; + /** + * DepositValidatorRewardsPool defines a method to provide additional rewards + * to delegators to a specific validator. + */ + depositValidatorRewardsPool(request: MsgDepositValidatorRewardsPool): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: Rpc; @@ -33,6 +54,9 @@ export class MsgClientImpl implements Msg { this.withdrawDelegatorReward = this.withdrawDelegatorReward.bind(this); this.withdrawValidatorCommission = this.withdrawValidatorCommission.bind(this); this.fundCommunityPool = this.fundCommunityPool.bind(this); + this.updateParams = this.updateParams.bind(this); + this.communityPoolSpend = this.communityPoolSpend.bind(this); + this.depositValidatorRewardsPool = this.depositValidatorRewardsPool.bind(this); } setWithdrawAddress(request: MsgSetWithdrawAddress): Promise { const data = MsgSetWithdrawAddress.encode(request).finish(); @@ -54,4 +78,19 @@ export class MsgClientImpl implements Msg { const promise = this.rpc.request("cosmos.distribution.v1beta1.Msg", "FundCommunityPool", data); return promise.then(data => MsgFundCommunityPoolResponse.decode(new BinaryReader(data))); } + updateParams(request: MsgUpdateParams): Promise { + const data = MsgUpdateParams.encode(request).finish(); + const promise = this.rpc.request("cosmos.distribution.v1beta1.Msg", "UpdateParams", data); + return promise.then(data => MsgUpdateParamsResponse.decode(new BinaryReader(data))); + } + communityPoolSpend(request: MsgCommunityPoolSpend): Promise { + const data = MsgCommunityPoolSpend.encode(request).finish(); + const promise = this.rpc.request("cosmos.distribution.v1beta1.Msg", "CommunityPoolSpend", data); + return promise.then(data => MsgCommunityPoolSpendResponse.decode(new BinaryReader(data))); + } + depositValidatorRewardsPool(request: MsgDepositValidatorRewardsPool): Promise { + const data = MsgDepositValidatorRewardsPool.encode(request).finish(); + const promise = this.rpc.request("cosmos.distribution.v1beta1.Msg", "DepositValidatorRewardsPool", data); + return promise.then(data => MsgDepositValidatorRewardsPoolResponse.decode(new BinaryReader(data))); + } } \ No newline at end of file diff --git a/packages/api/src/cosmos/distribution/v1beta1/tx.ts b/packages/api/src/cosmos/distribution/v1beta1/tx.ts index 37ea746c..cb6383d0 100644 --- a/packages/api/src/cosmos/distribution/v1beta1/tx.ts +++ b/packages/api/src/cosmos/distribution/v1beta1/tx.ts @@ -1,5 +1,6 @@ //@ts-nocheck import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; +import { Params, ParamsAmino, ParamsSDKType } from "./distribution"; import { BinaryReader, BinaryWriter } from "../../../binary"; /** * MsgSetWithdrawAddress sets the withdraw address for @@ -33,19 +34,28 @@ export interface MsgSetWithdrawAddressSDKType { delegator_address: string; withdraw_address: string; } -/** MsgSetWithdrawAddressResponse defines the Msg/SetWithdrawAddress response type. */ +/** + * MsgSetWithdrawAddressResponse defines the Msg/SetWithdrawAddress response + * type. + */ export interface MsgSetWithdrawAddressResponse {} export interface MsgSetWithdrawAddressResponseProtoMsg { typeUrl: "/cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse"; value: Uint8Array; } -/** MsgSetWithdrawAddressResponse defines the Msg/SetWithdrawAddress response type. */ +/** + * MsgSetWithdrawAddressResponse defines the Msg/SetWithdrawAddress response + * type. + */ export interface MsgSetWithdrawAddressResponseAmino {} export interface MsgSetWithdrawAddressResponseAminoMsg { type: "cosmos-sdk/MsgSetWithdrawAddressResponse"; value: MsgSetWithdrawAddressResponseAmino; } -/** MsgSetWithdrawAddressResponse defines the Msg/SetWithdrawAddress response type. */ +/** + * MsgSetWithdrawAddressResponse defines the Msg/SetWithdrawAddress response + * type. + */ export interface MsgSetWithdrawAddressResponseSDKType {} /** * MsgWithdrawDelegatorReward represents delegation withdrawal to a delegator @@ -79,25 +89,32 @@ export interface MsgWithdrawDelegatorRewardSDKType { delegator_address: string; validator_address: string; } -/** MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward response type. */ +/** + * MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward + * response type. + */ export interface MsgWithdrawDelegatorRewardResponse { - /** Since: cosmos-sdk 0.46 */ amount: Coin[]; } export interface MsgWithdrawDelegatorRewardResponseProtoMsg { typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse"; value: Uint8Array; } -/** MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward response type. */ +/** + * MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward + * response type. + */ export interface MsgWithdrawDelegatorRewardResponseAmino { - /** Since: cosmos-sdk 0.46 */ - amount?: CoinAmino[]; + amount: CoinAmino[]; } export interface MsgWithdrawDelegatorRewardResponseAminoMsg { type: "cosmos-sdk/MsgWithdrawDelegatorRewardResponse"; value: MsgWithdrawDelegatorRewardResponseAmino; } -/** MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward response type. */ +/** + * MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward + * response type. + */ export interface MsgWithdrawDelegatorRewardResponseSDKType { amount: CoinSDKType[]; } @@ -130,25 +147,32 @@ export interface MsgWithdrawValidatorCommissionAminoMsg { export interface MsgWithdrawValidatorCommissionSDKType { validator_address: string; } -/** MsgWithdrawValidatorCommissionResponse defines the Msg/WithdrawValidatorCommission response type. */ +/** + * MsgWithdrawValidatorCommissionResponse defines the + * Msg/WithdrawValidatorCommission response type. + */ export interface MsgWithdrawValidatorCommissionResponse { - /** Since: cosmos-sdk 0.46 */ amount: Coin[]; } export interface MsgWithdrawValidatorCommissionResponseProtoMsg { typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse"; value: Uint8Array; } -/** MsgWithdrawValidatorCommissionResponse defines the Msg/WithdrawValidatorCommission response type. */ +/** + * MsgWithdrawValidatorCommissionResponse defines the + * Msg/WithdrawValidatorCommission response type. + */ export interface MsgWithdrawValidatorCommissionResponseAmino { - /** Since: cosmos-sdk 0.46 */ - amount?: CoinAmino[]; + amount: CoinAmino[]; } export interface MsgWithdrawValidatorCommissionResponseAminoMsg { type: "cosmos-sdk/MsgWithdrawValidatorCommissionResponse"; value: MsgWithdrawValidatorCommissionResponseAmino; } -/** MsgWithdrawValidatorCommissionResponse defines the Msg/WithdrawValidatorCommission response type. */ +/** + * MsgWithdrawValidatorCommissionResponse defines the + * Msg/WithdrawValidatorCommission response type. + */ export interface MsgWithdrawValidatorCommissionResponseSDKType { amount: CoinSDKType[]; } @@ -169,7 +193,7 @@ export interface MsgFundCommunityPoolProtoMsg { * fund the community pool. */ export interface MsgFundCommunityPoolAmino { - amount?: CoinAmino[]; + amount: CoinAmino[]; depositor?: string; } export interface MsgFundCommunityPoolAminoMsg { @@ -198,6 +222,185 @@ export interface MsgFundCommunityPoolResponseAminoMsg { } /** MsgFundCommunityPoolResponse defines the Msg/FundCommunityPool response type. */ export interface MsgFundCommunityPoolResponseSDKType {} +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/distribution parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params; +} +export interface MsgUpdateParamsProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.MsgUpdateParams"; + value: Uint8Array; +} +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParamsAmino { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority?: string; + /** + * params defines the x/distribution parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: ParamsAmino; +} +export interface MsgUpdateParamsAminoMsg { + type: "cosmos-sdk/distribution/MsgUpdateParams"; + value: MsgUpdateParamsAmino; +} +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParamsSDKType { + authority: string; + params: ParamsSDKType; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponse {} +export interface MsgUpdateParamsResponseProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.MsgUpdateParamsResponse"; + value: Uint8Array; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponseAmino {} +export interface MsgUpdateParamsResponseAminoMsg { + type: "cosmos-sdk/MsgUpdateParamsResponse"; + value: MsgUpdateParamsResponseAmino; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponseSDKType {} +/** + * MsgCommunityPoolSpend defines a message for sending tokens from the community + * pool to another account. This message is typically executed via a governance + * proposal with the governance module being the executing authority. + */ +export interface MsgCommunityPoolSpend { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + recipient: string; + amount: Coin[]; +} +export interface MsgCommunityPoolSpendProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.MsgCommunityPoolSpend"; + value: Uint8Array; +} +/** + * MsgCommunityPoolSpend defines a message for sending tokens from the community + * pool to another account. This message is typically executed via a governance + * proposal with the governance module being the executing authority. + */ +export interface MsgCommunityPoolSpendAmino { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority?: string; + recipient?: string; + amount: CoinAmino[]; +} +export interface MsgCommunityPoolSpendAminoMsg { + type: "cosmos-sdk/distr/MsgCommunityPoolSpend"; + value: MsgCommunityPoolSpendAmino; +} +/** + * MsgCommunityPoolSpend defines a message for sending tokens from the community + * pool to another account. This message is typically executed via a governance + * proposal with the governance module being the executing authority. + */ +export interface MsgCommunityPoolSpendSDKType { + authority: string; + recipient: string; + amount: CoinSDKType[]; +} +/** + * MsgCommunityPoolSpendResponse defines the response to executing a + * MsgCommunityPoolSpend message. + */ +export interface MsgCommunityPoolSpendResponse {} +export interface MsgCommunityPoolSpendResponseProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.MsgCommunityPoolSpendResponse"; + value: Uint8Array; +} +/** + * MsgCommunityPoolSpendResponse defines the response to executing a + * MsgCommunityPoolSpend message. + */ +export interface MsgCommunityPoolSpendResponseAmino {} +export interface MsgCommunityPoolSpendResponseAminoMsg { + type: "cosmos-sdk/MsgCommunityPoolSpendResponse"; + value: MsgCommunityPoolSpendResponseAmino; +} +/** + * MsgCommunityPoolSpendResponse defines the response to executing a + * MsgCommunityPoolSpend message. + */ +export interface MsgCommunityPoolSpendResponseSDKType {} +/** + * DepositValidatorRewardsPool defines the request structure to provide + * additional rewards to delegators from a specific validator. + */ +export interface MsgDepositValidatorRewardsPool { + depositor: string; + validatorAddress: string; + amount: Coin[]; +} +export interface MsgDepositValidatorRewardsPoolProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.MsgDepositValidatorRewardsPool"; + value: Uint8Array; +} +/** + * DepositValidatorRewardsPool defines the request structure to provide + * additional rewards to delegators from a specific validator. + */ +export interface MsgDepositValidatorRewardsPoolAmino { + depositor?: string; + validator_address?: string; + amount: CoinAmino[]; +} +export interface MsgDepositValidatorRewardsPoolAminoMsg { + type: "cosmos-sdk/distr/MsgDepositValRewards"; + value: MsgDepositValidatorRewardsPoolAmino; +} +/** + * DepositValidatorRewardsPool defines the request structure to provide + * additional rewards to delegators from a specific validator. + */ +export interface MsgDepositValidatorRewardsPoolSDKType { + depositor: string; + validator_address: string; + amount: CoinSDKType[]; +} +/** + * MsgDepositValidatorRewardsPoolResponse defines the response to executing a + * MsgDepositValidatorRewardsPool message. + */ +export interface MsgDepositValidatorRewardsPoolResponse {} +export interface MsgDepositValidatorRewardsPoolResponseProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.MsgDepositValidatorRewardsPoolResponse"; + value: Uint8Array; +} +/** + * MsgDepositValidatorRewardsPoolResponse defines the response to executing a + * MsgDepositValidatorRewardsPool message. + */ +export interface MsgDepositValidatorRewardsPoolResponseAmino {} +export interface MsgDepositValidatorRewardsPoolResponseAminoMsg { + type: "cosmos-sdk/MsgDepositValidatorRewardsPoolResponse"; + value: MsgDepositValidatorRewardsPoolResponseAmino; +} +/** + * MsgDepositValidatorRewardsPoolResponse defines the response to executing a + * MsgDepositValidatorRewardsPool message. + */ +export interface MsgDepositValidatorRewardsPoolResponseSDKType {} function createBaseMsgSetWithdrawAddress(): MsgSetWithdrawAddress { return { delegatorAddress: "", @@ -765,4 +968,443 @@ export const MsgFundCommunityPoolResponse = { value: MsgFundCommunityPoolResponse.encode(message).finish() }; } +}; +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { + authority: "", + params: Params.fromPartial({}) + }; +} +export const MsgUpdateParams = { + typeUrl: "/cosmos.distribution.v1beta1.MsgUpdateParams", + encode(message: MsgUpdateParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + message.authority = object.authority ?? ""; + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, + fromAmino(object: MsgUpdateParamsAmino): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: MsgUpdateParams): MsgUpdateParamsAmino { + const obj: any = {}; + obj.authority = message.authority === "" ? undefined : message.authority; + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); + return obj; + }, + fromAminoMsg(object: MsgUpdateParamsAminoMsg): MsgUpdateParams { + return MsgUpdateParams.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateParams): MsgUpdateParamsAminoMsg { + return { + type: "cosmos-sdk/distribution/MsgUpdateParams", + value: MsgUpdateParams.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateParamsProtoMsg): MsgUpdateParams { + return MsgUpdateParams.decode(message.value); + }, + toProto(message: MsgUpdateParams): Uint8Array { + return MsgUpdateParams.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateParams): MsgUpdateParamsProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgUpdateParams", + value: MsgUpdateParams.encode(message).finish() + }; + } +}; +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} +export const MsgUpdateParamsResponse = { + typeUrl: "/cosmos.distribution.v1beta1.MsgUpdateParamsResponse", + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, + fromAmino(_: MsgUpdateParamsResponseAmino): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, + toAmino(_: MsgUpdateParamsResponse): MsgUpdateParamsResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUpdateParamsResponseAminoMsg): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateParamsResponse): MsgUpdateParamsResponseAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateParamsResponse", + value: MsgUpdateParamsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateParamsResponseProtoMsg): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.decode(message.value); + }, + toProto(message: MsgUpdateParamsResponse): Uint8Array { + return MsgUpdateParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateParamsResponse): MsgUpdateParamsResponseProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgUpdateParamsResponse", + value: MsgUpdateParamsResponse.encode(message).finish() + }; + } +}; +function createBaseMsgCommunityPoolSpend(): MsgCommunityPoolSpend { + return { + authority: "", + recipient: "", + amount: [] + }; +} +export const MsgCommunityPoolSpend = { + typeUrl: "/cosmos.distribution.v1beta1.MsgCommunityPoolSpend", + encode(message: MsgCommunityPoolSpend, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.recipient !== "") { + writer.uint32(18).string(message.recipient); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgCommunityPoolSpend { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.recipient = reader.string(); + break; + case 3: + message.amount.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgCommunityPoolSpend { + const message = createBaseMsgCommunityPoolSpend(); + message.authority = object.authority ?? ""; + message.recipient = object.recipient ?? ""; + message.amount = object.amount?.map(e => Coin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: MsgCommunityPoolSpendAmino): MsgCommunityPoolSpend { + const message = createBaseMsgCommunityPoolSpend(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + if (object.recipient !== undefined && object.recipient !== null) { + message.recipient = object.recipient; + } + message.amount = object.amount?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: MsgCommunityPoolSpend): MsgCommunityPoolSpendAmino { + const obj: any = {}; + obj.authority = message.authority === "" ? undefined : message.authority; + obj.recipient = message.recipient === "" ? undefined : message.recipient; + if (message.amount) { + obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.amount = message.amount; + } + return obj; + }, + fromAminoMsg(object: MsgCommunityPoolSpendAminoMsg): MsgCommunityPoolSpend { + return MsgCommunityPoolSpend.fromAmino(object.value); + }, + toAminoMsg(message: MsgCommunityPoolSpend): MsgCommunityPoolSpendAminoMsg { + return { + type: "cosmos-sdk/distr/MsgCommunityPoolSpend", + value: MsgCommunityPoolSpend.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCommunityPoolSpendProtoMsg): MsgCommunityPoolSpend { + return MsgCommunityPoolSpend.decode(message.value); + }, + toProto(message: MsgCommunityPoolSpend): Uint8Array { + return MsgCommunityPoolSpend.encode(message).finish(); + }, + toProtoMsg(message: MsgCommunityPoolSpend): MsgCommunityPoolSpendProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgCommunityPoolSpend", + value: MsgCommunityPoolSpend.encode(message).finish() + }; + } +}; +function createBaseMsgCommunityPoolSpendResponse(): MsgCommunityPoolSpendResponse { + return {}; +} +export const MsgCommunityPoolSpendResponse = { + typeUrl: "/cosmos.distribution.v1beta1.MsgCommunityPoolSpendResponse", + encode(_: MsgCommunityPoolSpendResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgCommunityPoolSpendResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): MsgCommunityPoolSpendResponse { + const message = createBaseMsgCommunityPoolSpendResponse(); + return message; + }, + fromAmino(_: MsgCommunityPoolSpendResponseAmino): MsgCommunityPoolSpendResponse { + const message = createBaseMsgCommunityPoolSpendResponse(); + return message; + }, + toAmino(_: MsgCommunityPoolSpendResponse): MsgCommunityPoolSpendResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgCommunityPoolSpendResponseAminoMsg): MsgCommunityPoolSpendResponse { + return MsgCommunityPoolSpendResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgCommunityPoolSpendResponse): MsgCommunityPoolSpendResponseAminoMsg { + return { + type: "cosmos-sdk/MsgCommunityPoolSpendResponse", + value: MsgCommunityPoolSpendResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCommunityPoolSpendResponseProtoMsg): MsgCommunityPoolSpendResponse { + return MsgCommunityPoolSpendResponse.decode(message.value); + }, + toProto(message: MsgCommunityPoolSpendResponse): Uint8Array { + return MsgCommunityPoolSpendResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgCommunityPoolSpendResponse): MsgCommunityPoolSpendResponseProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgCommunityPoolSpendResponse", + value: MsgCommunityPoolSpendResponse.encode(message).finish() + }; + } +}; +function createBaseMsgDepositValidatorRewardsPool(): MsgDepositValidatorRewardsPool { + return { + depositor: "", + validatorAddress: "", + amount: [] + }; +} +export const MsgDepositValidatorRewardsPool = { + typeUrl: "/cosmos.distribution.v1beta1.MsgDepositValidatorRewardsPool", + encode(message: MsgDepositValidatorRewardsPool, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.depositor !== "") { + writer.uint32(10).string(message.depositor); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgDepositValidatorRewardsPool { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.depositor = reader.string(); + break; + case 2: + message.validatorAddress = reader.string(); + break; + case 3: + message.amount.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgDepositValidatorRewardsPool { + const message = createBaseMsgDepositValidatorRewardsPool(); + message.depositor = object.depositor ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.amount = object.amount?.map(e => Coin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: MsgDepositValidatorRewardsPoolAmino): MsgDepositValidatorRewardsPool { + const message = createBaseMsgDepositValidatorRewardsPool(); + if (object.depositor !== undefined && object.depositor !== null) { + message.depositor = object.depositor; + } + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = object.validator_address; + } + message.amount = object.amount?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: MsgDepositValidatorRewardsPool): MsgDepositValidatorRewardsPoolAmino { + const obj: any = {}; + obj.depositor = message.depositor === "" ? undefined : message.depositor; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + if (message.amount) { + obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.amount = message.amount; + } + return obj; + }, + fromAminoMsg(object: MsgDepositValidatorRewardsPoolAminoMsg): MsgDepositValidatorRewardsPool { + return MsgDepositValidatorRewardsPool.fromAmino(object.value); + }, + toAminoMsg(message: MsgDepositValidatorRewardsPool): MsgDepositValidatorRewardsPoolAminoMsg { + return { + type: "cosmos-sdk/distr/MsgDepositValRewards", + value: MsgDepositValidatorRewardsPool.toAmino(message) + }; + }, + fromProtoMsg(message: MsgDepositValidatorRewardsPoolProtoMsg): MsgDepositValidatorRewardsPool { + return MsgDepositValidatorRewardsPool.decode(message.value); + }, + toProto(message: MsgDepositValidatorRewardsPool): Uint8Array { + return MsgDepositValidatorRewardsPool.encode(message).finish(); + }, + toProtoMsg(message: MsgDepositValidatorRewardsPool): MsgDepositValidatorRewardsPoolProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgDepositValidatorRewardsPool", + value: MsgDepositValidatorRewardsPool.encode(message).finish() + }; + } +}; +function createBaseMsgDepositValidatorRewardsPoolResponse(): MsgDepositValidatorRewardsPoolResponse { + return {}; +} +export const MsgDepositValidatorRewardsPoolResponse = { + typeUrl: "/cosmos.distribution.v1beta1.MsgDepositValidatorRewardsPoolResponse", + encode(_: MsgDepositValidatorRewardsPoolResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgDepositValidatorRewardsPoolResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): MsgDepositValidatorRewardsPoolResponse { + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + return message; + }, + fromAmino(_: MsgDepositValidatorRewardsPoolResponseAmino): MsgDepositValidatorRewardsPoolResponse { + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + return message; + }, + toAmino(_: MsgDepositValidatorRewardsPoolResponse): MsgDepositValidatorRewardsPoolResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgDepositValidatorRewardsPoolResponseAminoMsg): MsgDepositValidatorRewardsPoolResponse { + return MsgDepositValidatorRewardsPoolResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgDepositValidatorRewardsPoolResponse): MsgDepositValidatorRewardsPoolResponseAminoMsg { + return { + type: "cosmos-sdk/MsgDepositValidatorRewardsPoolResponse", + value: MsgDepositValidatorRewardsPoolResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgDepositValidatorRewardsPoolResponseProtoMsg): MsgDepositValidatorRewardsPoolResponse { + return MsgDepositValidatorRewardsPoolResponse.decode(message.value); + }, + toProto(message: MsgDepositValidatorRewardsPoolResponse): Uint8Array { + return MsgDepositValidatorRewardsPoolResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgDepositValidatorRewardsPoolResponse): MsgDepositValidatorRewardsPoolResponseProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgDepositValidatorRewardsPoolResponse", + value: MsgDepositValidatorRewardsPoolResponse.encode(message).finish() + }; + } }; \ No newline at end of file diff --git a/packages/api/src/cosmos/epochs/module/v1/module.ts b/packages/api/src/cosmos/epochs/module/v1/module.ts new file mode 100644 index 00000000..73801a67 --- /dev/null +++ b/packages/api/src/cosmos/epochs/module/v1/module.ts @@ -0,0 +1,72 @@ +//@ts-nocheck +import { BinaryReader, BinaryWriter } from "../../../../binary"; +/** Module is the config object of the epochs module. */ +export interface Module {} +export interface ModuleProtoMsg { + typeUrl: "/cosmos.epochs.module.v1.Module"; + value: Uint8Array; +} +/** Module is the config object of the epochs module. */ +export interface ModuleAmino {} +export interface ModuleAminoMsg { + type: "cosmos-sdk/Module"; + value: ModuleAmino; +} +/** Module is the config object of the epochs module. */ +export interface ModuleSDKType {} +function createBaseModule(): Module { + return {}; +} +export const Module = { + typeUrl: "/cosmos.epochs.module.v1.Module", + encode(_: Module, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): Module { + const message = createBaseModule(); + return message; + }, + fromAmino(_: ModuleAmino): Module { + const message = createBaseModule(); + return message; + }, + toAmino(_: Module): ModuleAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: ModuleAminoMsg): Module { + return Module.fromAmino(object.value); + }, + toAminoMsg(message: Module): ModuleAminoMsg { + return { + type: "cosmos-sdk/Module", + value: Module.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleProtoMsg): Module { + return Module.decode(message.value); + }, + toProto(message: Module): Uint8Array { + return Module.encode(message).finish(); + }, + toProtoMsg(message: Module): ModuleProtoMsg { + return { + typeUrl: "/cosmos.epochs.module.v1.Module", + value: Module.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/epochs/v1beta1/events.ts b/packages/api/src/cosmos/epochs/v1beta1/events.ts new file mode 100644 index 00000000..6b8ae6db --- /dev/null +++ b/packages/api/src/cosmos/epochs/v1beta1/events.ts @@ -0,0 +1,195 @@ +//@ts-nocheck +import { BinaryReader, BinaryWriter } from "../../../binary"; +/** EventEpochEnd is an event emitted when an epoch end. */ +export interface EventEpochEnd { + epochNumber: bigint; +} +export interface EventEpochEndProtoMsg { + typeUrl: "/cosmos.epochs.v1beta1.EventEpochEnd"; + value: Uint8Array; +} +/** EventEpochEnd is an event emitted when an epoch end. */ +export interface EventEpochEndAmino { + epoch_number?: string; +} +export interface EventEpochEndAminoMsg { + type: "cosmos-sdk/EventEpochEnd"; + value: EventEpochEndAmino; +} +/** EventEpochEnd is an event emitted when an epoch end. */ +export interface EventEpochEndSDKType { + epoch_number: bigint; +} +/** EventEpochStart is an event emitted when an epoch start. */ +export interface EventEpochStart { + epochNumber: bigint; + epochStartTime: bigint; +} +export interface EventEpochStartProtoMsg { + typeUrl: "/cosmos.epochs.v1beta1.EventEpochStart"; + value: Uint8Array; +} +/** EventEpochStart is an event emitted when an epoch start. */ +export interface EventEpochStartAmino { + epoch_number?: string; + epoch_start_time?: string; +} +export interface EventEpochStartAminoMsg { + type: "cosmos-sdk/EventEpochStart"; + value: EventEpochStartAmino; +} +/** EventEpochStart is an event emitted when an epoch start. */ +export interface EventEpochStartSDKType { + epoch_number: bigint; + epoch_start_time: bigint; +} +function createBaseEventEpochEnd(): EventEpochEnd { + return { + epochNumber: BigInt(0) + }; +} +export const EventEpochEnd = { + typeUrl: "/cosmos.epochs.v1beta1.EventEpochEnd", + encode(message: EventEpochEnd, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.epochNumber !== BigInt(0)) { + writer.uint32(8).int64(message.epochNumber); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): EventEpochEnd { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventEpochEnd(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.epochNumber = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): EventEpochEnd { + const message = createBaseEventEpochEnd(); + message.epochNumber = object.epochNumber !== undefined && object.epochNumber !== null ? BigInt(object.epochNumber.toString()) : BigInt(0); + return message; + }, + fromAmino(object: EventEpochEndAmino): EventEpochEnd { + const message = createBaseEventEpochEnd(); + if (object.epoch_number !== undefined && object.epoch_number !== null) { + message.epochNumber = BigInt(object.epoch_number); + } + return message; + }, + toAmino(message: EventEpochEnd): EventEpochEndAmino { + const obj: any = {}; + obj.epoch_number = message.epochNumber !== BigInt(0) ? message.epochNumber?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: EventEpochEndAminoMsg): EventEpochEnd { + return EventEpochEnd.fromAmino(object.value); + }, + toAminoMsg(message: EventEpochEnd): EventEpochEndAminoMsg { + return { + type: "cosmos-sdk/EventEpochEnd", + value: EventEpochEnd.toAmino(message) + }; + }, + fromProtoMsg(message: EventEpochEndProtoMsg): EventEpochEnd { + return EventEpochEnd.decode(message.value); + }, + toProto(message: EventEpochEnd): Uint8Array { + return EventEpochEnd.encode(message).finish(); + }, + toProtoMsg(message: EventEpochEnd): EventEpochEndProtoMsg { + return { + typeUrl: "/cosmos.epochs.v1beta1.EventEpochEnd", + value: EventEpochEnd.encode(message).finish() + }; + } +}; +function createBaseEventEpochStart(): EventEpochStart { + return { + epochNumber: BigInt(0), + epochStartTime: BigInt(0) + }; +} +export const EventEpochStart = { + typeUrl: "/cosmos.epochs.v1beta1.EventEpochStart", + encode(message: EventEpochStart, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.epochNumber !== BigInt(0)) { + writer.uint32(8).int64(message.epochNumber); + } + if (message.epochStartTime !== BigInt(0)) { + writer.uint32(16).int64(message.epochStartTime); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): EventEpochStart { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventEpochStart(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.epochNumber = reader.int64(); + break; + case 2: + message.epochStartTime = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): EventEpochStart { + const message = createBaseEventEpochStart(); + message.epochNumber = object.epochNumber !== undefined && object.epochNumber !== null ? BigInt(object.epochNumber.toString()) : BigInt(0); + message.epochStartTime = object.epochStartTime !== undefined && object.epochStartTime !== null ? BigInt(object.epochStartTime.toString()) : BigInt(0); + return message; + }, + fromAmino(object: EventEpochStartAmino): EventEpochStart { + const message = createBaseEventEpochStart(); + if (object.epoch_number !== undefined && object.epoch_number !== null) { + message.epochNumber = BigInt(object.epoch_number); + } + if (object.epoch_start_time !== undefined && object.epoch_start_time !== null) { + message.epochStartTime = BigInt(object.epoch_start_time); + } + return message; + }, + toAmino(message: EventEpochStart): EventEpochStartAmino { + const obj: any = {}; + obj.epoch_number = message.epochNumber !== BigInt(0) ? message.epochNumber?.toString() : undefined; + obj.epoch_start_time = message.epochStartTime !== BigInt(0) ? message.epochStartTime?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: EventEpochStartAminoMsg): EventEpochStart { + return EventEpochStart.fromAmino(object.value); + }, + toAminoMsg(message: EventEpochStart): EventEpochStartAminoMsg { + return { + type: "cosmos-sdk/EventEpochStart", + value: EventEpochStart.toAmino(message) + }; + }, + fromProtoMsg(message: EventEpochStartProtoMsg): EventEpochStart { + return EventEpochStart.decode(message.value); + }, + toProto(message: EventEpochStart): Uint8Array { + return EventEpochStart.encode(message).finish(); + }, + toProtoMsg(message: EventEpochStart): EventEpochStartProtoMsg { + return { + typeUrl: "/cosmos.epochs.v1beta1.EventEpochStart", + value: EventEpochStart.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/epochs/v1beta1/genesis.ts b/packages/api/src/cosmos/epochs/v1beta1/genesis.ts new file mode 100644 index 00000000..6d416db1 --- /dev/null +++ b/packages/api/src/cosmos/epochs/v1beta1/genesis.ts @@ -0,0 +1,374 @@ +//@ts-nocheck +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { toTimestamp, fromTimestamp } from "../../../helpers"; +/** + * EpochInfo is a struct that describes the data going into + * a timer defined by the x/epochs module. + */ +export interface EpochInfo { + /** identifier is a unique reference to this particular timer. */ + identifier: string; + /** + * start_time is the time at which the timer first ever ticks. + * If start_time is in the future, the epoch will not begin until the start + * time. + */ + startTime: Date; + /** + * duration is the time in between epoch ticks. + * In order for intended behavior to be met, duration should + * be greater than the chains expected block time. + * Duration must be non-zero. + */ + duration: Duration; + /** + * current_epoch is the current epoch number, or in other words, + * how many times has the timer 'ticked'. + * The first tick (current_epoch=1) is defined as + * the first block whose blocktime is greater than the EpochInfo start_time. + */ + currentEpoch: bigint; + /** + * current_epoch_start_time describes the start time of the current timer + * interval. The interval is (current_epoch_start_time, + * current_epoch_start_time + duration] When the timer ticks, this is set to + * current_epoch_start_time = last_epoch_start_time + duration only one timer + * tick for a given identifier can occur per block. + * + * NOTE! The current_epoch_start_time may diverge significantly from the + * wall-clock time the epoch began at. Wall-clock time of epoch start may be + * >> current_epoch_start_time. Suppose current_epoch_start_time = 10, + * duration = 5. Suppose the chain goes offline at t=14, and comes back online + * at t=30, and produces blocks at every successive time. (t=31, 32, etc.) + * * The t=30 block will start the epoch for (10, 15] + * * The t=31 block will start the epoch for (15, 20] + * * The t=32 block will start the epoch for (20, 25] + * * The t=33 block will start the epoch for (25, 30] + * * The t=34 block will start the epoch for (30, 35] + * * The **t=36** block will start the epoch for (35, 40] + */ + currentEpochStartTime: Date; + /** + * epoch_counting_started is a boolean, that indicates whether this + * epoch timer has began yet. + */ + epochCountingStarted: boolean; + /** + * current_epoch_start_height is the block height at which the current epoch + * started. (The block height at which the timer last ticked) + */ + currentEpochStartHeight: bigint; +} +export interface EpochInfoProtoMsg { + typeUrl: "/cosmos.epochs.v1beta1.EpochInfo"; + value: Uint8Array; +} +/** + * EpochInfo is a struct that describes the data going into + * a timer defined by the x/epochs module. + */ +export interface EpochInfoAmino { + /** identifier is a unique reference to this particular timer. */ + identifier?: string; + /** + * start_time is the time at which the timer first ever ticks. + * If start_time is in the future, the epoch will not begin until the start + * time. + */ + start_time?: string; + /** + * duration is the time in between epoch ticks. + * In order for intended behavior to be met, duration should + * be greater than the chains expected block time. + * Duration must be non-zero. + */ + duration?: DurationAmino; + /** + * current_epoch is the current epoch number, or in other words, + * how many times has the timer 'ticked'. + * The first tick (current_epoch=1) is defined as + * the first block whose blocktime is greater than the EpochInfo start_time. + */ + current_epoch?: string; + /** + * current_epoch_start_time describes the start time of the current timer + * interval. The interval is (current_epoch_start_time, + * current_epoch_start_time + duration] When the timer ticks, this is set to + * current_epoch_start_time = last_epoch_start_time + duration only one timer + * tick for a given identifier can occur per block. + * + * NOTE! The current_epoch_start_time may diverge significantly from the + * wall-clock time the epoch began at. Wall-clock time of epoch start may be + * >> current_epoch_start_time. Suppose current_epoch_start_time = 10, + * duration = 5. Suppose the chain goes offline at t=14, and comes back online + * at t=30, and produces blocks at every successive time. (t=31, 32, etc.) + * * The t=30 block will start the epoch for (10, 15] + * * The t=31 block will start the epoch for (15, 20] + * * The t=32 block will start the epoch for (20, 25] + * * The t=33 block will start the epoch for (25, 30] + * * The t=34 block will start the epoch for (30, 35] + * * The **t=36** block will start the epoch for (35, 40] + */ + current_epoch_start_time?: string; + /** + * epoch_counting_started is a boolean, that indicates whether this + * epoch timer has began yet. + */ + epoch_counting_started?: boolean; + /** + * current_epoch_start_height is the block height at which the current epoch + * started. (The block height at which the timer last ticked) + */ + current_epoch_start_height?: string; +} +export interface EpochInfoAminoMsg { + type: "cosmos-sdk/EpochInfo"; + value: EpochInfoAmino; +} +/** + * EpochInfo is a struct that describes the data going into + * a timer defined by the x/epochs module. + */ +export interface EpochInfoSDKType { + identifier: string; + start_time: Date; + duration: DurationSDKType; + current_epoch: bigint; + current_epoch_start_time: Date; + epoch_counting_started: boolean; + current_epoch_start_height: bigint; +} +/** GenesisState defines the epochs module's genesis state. */ +export interface GenesisState { + epochs: EpochInfo[]; +} +export interface GenesisStateProtoMsg { + typeUrl: "/cosmos.epochs.v1beta1.GenesisState"; + value: Uint8Array; +} +/** GenesisState defines the epochs module's genesis state. */ +export interface GenesisStateAmino { + epochs?: EpochInfoAmino[]; +} +export interface GenesisStateAminoMsg { + type: "cosmos-sdk/GenesisState"; + value: GenesisStateAmino; +} +/** GenesisState defines the epochs module's genesis state. */ +export interface GenesisStateSDKType { + epochs: EpochInfoSDKType[]; +} +function createBaseEpochInfo(): EpochInfo { + return { + identifier: "", + startTime: new Date(), + duration: Duration.fromPartial({}), + currentEpoch: BigInt(0), + currentEpochStartTime: new Date(), + epochCountingStarted: false, + currentEpochStartHeight: BigInt(0) + }; +} +export const EpochInfo = { + typeUrl: "/cosmos.epochs.v1beta1.EpochInfo", + encode(message: EpochInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.identifier !== "") { + writer.uint32(10).string(message.identifier); + } + if (message.startTime !== undefined) { + Timestamp.encode(toTimestamp(message.startTime), writer.uint32(18).fork()).ldelim(); + } + if (message.duration !== undefined) { + Duration.encode(message.duration, writer.uint32(26).fork()).ldelim(); + } + if (message.currentEpoch !== BigInt(0)) { + writer.uint32(32).int64(message.currentEpoch); + } + if (message.currentEpochStartTime !== undefined) { + Timestamp.encode(toTimestamp(message.currentEpochStartTime), writer.uint32(42).fork()).ldelim(); + } + if (message.epochCountingStarted === true) { + writer.uint32(48).bool(message.epochCountingStarted); + } + if (message.currentEpochStartHeight !== BigInt(0)) { + writer.uint32(64).int64(message.currentEpochStartHeight); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): EpochInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEpochInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.identifier = reader.string(); + break; + case 2: + message.startTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 3: + message.duration = Duration.decode(reader, reader.uint32()); + break; + case 4: + message.currentEpoch = reader.int64(); + break; + case 5: + message.currentEpochStartTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 6: + message.epochCountingStarted = reader.bool(); + break; + case 8: + message.currentEpochStartHeight = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): EpochInfo { + const message = createBaseEpochInfo(); + message.identifier = object.identifier ?? ""; + message.startTime = object.startTime ?? undefined; + message.duration = object.duration !== undefined && object.duration !== null ? Duration.fromPartial(object.duration) : undefined; + message.currentEpoch = object.currentEpoch !== undefined && object.currentEpoch !== null ? BigInt(object.currentEpoch.toString()) : BigInt(0); + message.currentEpochStartTime = object.currentEpochStartTime ?? undefined; + message.epochCountingStarted = object.epochCountingStarted ?? false; + message.currentEpochStartHeight = object.currentEpochStartHeight !== undefined && object.currentEpochStartHeight !== null ? BigInt(object.currentEpochStartHeight.toString()) : BigInt(0); + return message; + }, + fromAmino(object: EpochInfoAmino): EpochInfo { + const message = createBaseEpochInfo(); + if (object.identifier !== undefined && object.identifier !== null) { + message.identifier = object.identifier; + } + if (object.start_time !== undefined && object.start_time !== null) { + message.startTime = fromTimestamp(Timestamp.fromAmino(object.start_time)); + } + if (object.duration !== undefined && object.duration !== null) { + message.duration = Duration.fromAmino(object.duration); + } + if (object.current_epoch !== undefined && object.current_epoch !== null) { + message.currentEpoch = BigInt(object.current_epoch); + } + if (object.current_epoch_start_time !== undefined && object.current_epoch_start_time !== null) { + message.currentEpochStartTime = fromTimestamp(Timestamp.fromAmino(object.current_epoch_start_time)); + } + if (object.epoch_counting_started !== undefined && object.epoch_counting_started !== null) { + message.epochCountingStarted = object.epoch_counting_started; + } + if (object.current_epoch_start_height !== undefined && object.current_epoch_start_height !== null) { + message.currentEpochStartHeight = BigInt(object.current_epoch_start_height); + } + return message; + }, + toAmino(message: EpochInfo): EpochInfoAmino { + const obj: any = {}; + obj.identifier = message.identifier === "" ? undefined : message.identifier; + obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; + obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; + obj.current_epoch = message.currentEpoch !== BigInt(0) ? message.currentEpoch?.toString() : undefined; + obj.current_epoch_start_time = message.currentEpochStartTime ? Timestamp.toAmino(toTimestamp(message.currentEpochStartTime)) : undefined; + obj.epoch_counting_started = message.epochCountingStarted === false ? undefined : message.epochCountingStarted; + obj.current_epoch_start_height = message.currentEpochStartHeight !== BigInt(0) ? message.currentEpochStartHeight?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: EpochInfoAminoMsg): EpochInfo { + return EpochInfo.fromAmino(object.value); + }, + toAminoMsg(message: EpochInfo): EpochInfoAminoMsg { + return { + type: "cosmos-sdk/EpochInfo", + value: EpochInfo.toAmino(message) + }; + }, + fromProtoMsg(message: EpochInfoProtoMsg): EpochInfo { + return EpochInfo.decode(message.value); + }, + toProto(message: EpochInfo): Uint8Array { + return EpochInfo.encode(message).finish(); + }, + toProtoMsg(message: EpochInfo): EpochInfoProtoMsg { + return { + typeUrl: "/cosmos.epochs.v1beta1.EpochInfo", + value: EpochInfo.encode(message).finish() + }; + } +}; +function createBaseGenesisState(): GenesisState { + return { + epochs: [] + }; +} +export const GenesisState = { + typeUrl: "/cosmos.epochs.v1beta1.GenesisState", + encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.epochs) { + EpochInfo.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.epochs.push(EpochInfo.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): GenesisState { + const message = createBaseGenesisState(); + message.epochs = object.epochs?.map(e => EpochInfo.fromPartial(e)) || []; + return message; + }, + fromAmino(object: GenesisStateAmino): GenesisState { + const message = createBaseGenesisState(); + message.epochs = object.epochs?.map(e => EpochInfo.fromAmino(e)) || []; + return message; + }, + toAmino(message: GenesisState): GenesisStateAmino { + const obj: any = {}; + if (message.epochs) { + obj.epochs = message.epochs.map(e => e ? EpochInfo.toAmino(e) : undefined); + } else { + obj.epochs = message.epochs; + } + return obj; + }, + fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { + return GenesisState.fromAmino(object.value); + }, + toAminoMsg(message: GenesisState): GenesisStateAminoMsg { + return { + type: "cosmos-sdk/GenesisState", + value: GenesisState.toAmino(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: "/cosmos.epochs.v1beta1.GenesisState", + value: GenesisState.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/epochs/v1beta1/query.lcd.ts b/packages/api/src/cosmos/epochs/v1beta1/query.lcd.ts new file mode 100644 index 00000000..95f37679 --- /dev/null +++ b/packages/api/src/cosmos/epochs/v1beta1/query.lcd.ts @@ -0,0 +1,31 @@ +//@ts-nocheck +import { LCDClient } from "@cosmology/lcd"; +import { QueryEpochInfosRequest, QueryEpochInfosResponseSDKType, QueryCurrentEpochRequest, QueryCurrentEpochResponseSDKType } from "./query"; +export class LCDQueryClient { + req: LCDClient; + constructor({ + requestClient + }: { + requestClient: LCDClient; + }) { + this.req = requestClient; + this.epochInfos = this.epochInfos.bind(this); + this.currentEpoch = this.currentEpoch.bind(this); + } + /* EpochInfos provide running epochInfos */ + async epochInfos(_params: QueryEpochInfosRequest = {}): Promise { + const endpoint = `cosmos/epochs/v1beta1/epochs`; + return await this.req.get(endpoint); + } + /* CurrentEpoch provide current epoch of specified identifier */ + async currentEpoch(params: QueryCurrentEpochRequest): Promise { + const options: any = { + params: {} + }; + if (typeof params?.identifier !== "undefined") { + options.params.identifier = params.identifier; + } + const endpoint = `cosmos/epochs/v1beta1/current_epoch`; + return await this.req.get(endpoint, options); + } +} \ No newline at end of file diff --git a/packages/api/src/cosmos/epochs/v1beta1/query.rpc.Query.ts b/packages/api/src/cosmos/epochs/v1beta1/query.rpc.Query.ts new file mode 100644 index 00000000..3066efc0 --- /dev/null +++ b/packages/api/src/cosmos/epochs/v1beta1/query.rpc.Query.ts @@ -0,0 +1,42 @@ +//@ts-nocheck +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; +import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; +import { QueryEpochInfosRequest, QueryEpochInfosResponse, QueryCurrentEpochRequest, QueryCurrentEpochResponse } from "./query"; +/** Query defines the gRPC querier service. */ +export interface Query { + /** EpochInfos provide running epochInfos */ + epochInfos(request?: QueryEpochInfosRequest): Promise; + /** CurrentEpoch provide current epoch of specified identifier */ + currentEpoch(request: QueryCurrentEpochRequest): Promise; +} +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + this.epochInfos = this.epochInfos.bind(this); + this.currentEpoch = this.currentEpoch.bind(this); + } + epochInfos(request: QueryEpochInfosRequest = {}): Promise { + const data = QueryEpochInfosRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.epochs.v1beta1.Query", "EpochInfos", data); + return promise.then(data => QueryEpochInfosResponse.decode(new BinaryReader(data))); + } + currentEpoch(request: QueryCurrentEpochRequest): Promise { + const data = QueryCurrentEpochRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.epochs.v1beta1.Query", "CurrentEpoch", data); + return promise.then(data => QueryCurrentEpochResponse.decode(new BinaryReader(data))); + } +} +export const createRpcQueryExtension = (base: QueryClient) => { + const rpc = createProtobufRpcClient(base); + const queryService = new QueryClientImpl(rpc); + return { + epochInfos(request?: QueryEpochInfosRequest): Promise { + return queryService.epochInfos(request); + }, + currentEpoch(request: QueryCurrentEpochRequest): Promise { + return queryService.currentEpoch(request); + } + }; +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/epochs/v1beta1/query.ts b/packages/api/src/cosmos/epochs/v1beta1/query.ts new file mode 100644 index 00000000..4b317607 --- /dev/null +++ b/packages/api/src/cosmos/epochs/v1beta1/query.ts @@ -0,0 +1,378 @@ +//@ts-nocheck +import { EpochInfo, EpochInfoAmino, EpochInfoSDKType } from "./genesis"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +/** + * QueryEpochInfosRequest defines the gRPC request structure for + * querying all epoch info. + */ +export interface QueryEpochInfosRequest {} +export interface QueryEpochInfosRequestProtoMsg { + typeUrl: "/cosmos.epochs.v1beta1.QueryEpochInfosRequest"; + value: Uint8Array; +} +/** + * QueryEpochInfosRequest defines the gRPC request structure for + * querying all epoch info. + */ +export interface QueryEpochInfosRequestAmino {} +export interface QueryEpochInfosRequestAminoMsg { + type: "cosmos-sdk/QueryEpochInfosRequest"; + value: QueryEpochInfosRequestAmino; +} +/** + * QueryEpochInfosRequest defines the gRPC request structure for + * querying all epoch info. + */ +export interface QueryEpochInfosRequestSDKType {} +/** + * QueryEpochInfosRequest defines the gRPC response structure for + * querying all epoch info. + */ +export interface QueryEpochInfosResponse { + epochs: EpochInfo[]; +} +export interface QueryEpochInfosResponseProtoMsg { + typeUrl: "/cosmos.epochs.v1beta1.QueryEpochInfosResponse"; + value: Uint8Array; +} +/** + * QueryEpochInfosRequest defines the gRPC response structure for + * querying all epoch info. + */ +export interface QueryEpochInfosResponseAmino { + epochs?: EpochInfoAmino[]; +} +export interface QueryEpochInfosResponseAminoMsg { + type: "cosmos-sdk/QueryEpochInfosResponse"; + value: QueryEpochInfosResponseAmino; +} +/** + * QueryEpochInfosRequest defines the gRPC response structure for + * querying all epoch info. + */ +export interface QueryEpochInfosResponseSDKType { + epochs: EpochInfoSDKType[]; +} +/** + * QueryCurrentEpochRequest defines the gRPC request structure for + * querying an epoch by its identifier. + */ +export interface QueryCurrentEpochRequest { + identifier: string; +} +export interface QueryCurrentEpochRequestProtoMsg { + typeUrl: "/cosmos.epochs.v1beta1.QueryCurrentEpochRequest"; + value: Uint8Array; +} +/** + * QueryCurrentEpochRequest defines the gRPC request structure for + * querying an epoch by its identifier. + */ +export interface QueryCurrentEpochRequestAmino { + identifier?: string; +} +export interface QueryCurrentEpochRequestAminoMsg { + type: "cosmos-sdk/QueryCurrentEpochRequest"; + value: QueryCurrentEpochRequestAmino; +} +/** + * QueryCurrentEpochRequest defines the gRPC request structure for + * querying an epoch by its identifier. + */ +export interface QueryCurrentEpochRequestSDKType { + identifier: string; +} +/** + * QueryCurrentEpochResponse defines the gRPC response structure for + * querying an epoch by its identifier. + */ +export interface QueryCurrentEpochResponse { + currentEpoch: bigint; +} +export interface QueryCurrentEpochResponseProtoMsg { + typeUrl: "/cosmos.epochs.v1beta1.QueryCurrentEpochResponse"; + value: Uint8Array; +} +/** + * QueryCurrentEpochResponse defines the gRPC response structure for + * querying an epoch by its identifier. + */ +export interface QueryCurrentEpochResponseAmino { + current_epoch?: string; +} +export interface QueryCurrentEpochResponseAminoMsg { + type: "cosmos-sdk/QueryCurrentEpochResponse"; + value: QueryCurrentEpochResponseAmino; +} +/** + * QueryCurrentEpochResponse defines the gRPC response structure for + * querying an epoch by its identifier. + */ +export interface QueryCurrentEpochResponseSDKType { + current_epoch: bigint; +} +function createBaseQueryEpochInfosRequest(): QueryEpochInfosRequest { + return {}; +} +export const QueryEpochInfosRequest = { + typeUrl: "/cosmos.epochs.v1beta1.QueryEpochInfosRequest", + encode(_: QueryEpochInfosRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryEpochInfosRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEpochInfosRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): QueryEpochInfosRequest { + const message = createBaseQueryEpochInfosRequest(); + return message; + }, + fromAmino(_: QueryEpochInfosRequestAmino): QueryEpochInfosRequest { + const message = createBaseQueryEpochInfosRequest(); + return message; + }, + toAmino(_: QueryEpochInfosRequest): QueryEpochInfosRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryEpochInfosRequestAminoMsg): QueryEpochInfosRequest { + return QueryEpochInfosRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryEpochInfosRequest): QueryEpochInfosRequestAminoMsg { + return { + type: "cosmos-sdk/QueryEpochInfosRequest", + value: QueryEpochInfosRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryEpochInfosRequestProtoMsg): QueryEpochInfosRequest { + return QueryEpochInfosRequest.decode(message.value); + }, + toProto(message: QueryEpochInfosRequest): Uint8Array { + return QueryEpochInfosRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryEpochInfosRequest): QueryEpochInfosRequestProtoMsg { + return { + typeUrl: "/cosmos.epochs.v1beta1.QueryEpochInfosRequest", + value: QueryEpochInfosRequest.encode(message).finish() + }; + } +}; +function createBaseQueryEpochInfosResponse(): QueryEpochInfosResponse { + return { + epochs: [] + }; +} +export const QueryEpochInfosResponse = { + typeUrl: "/cosmos.epochs.v1beta1.QueryEpochInfosResponse", + encode(message: QueryEpochInfosResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.epochs) { + EpochInfo.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryEpochInfosResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEpochInfosResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.epochs.push(EpochInfo.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryEpochInfosResponse { + const message = createBaseQueryEpochInfosResponse(); + message.epochs = object.epochs?.map(e => EpochInfo.fromPartial(e)) || []; + return message; + }, + fromAmino(object: QueryEpochInfosResponseAmino): QueryEpochInfosResponse { + const message = createBaseQueryEpochInfosResponse(); + message.epochs = object.epochs?.map(e => EpochInfo.fromAmino(e)) || []; + return message; + }, + toAmino(message: QueryEpochInfosResponse): QueryEpochInfosResponseAmino { + const obj: any = {}; + if (message.epochs) { + obj.epochs = message.epochs.map(e => e ? EpochInfo.toAmino(e) : undefined); + } else { + obj.epochs = message.epochs; + } + return obj; + }, + fromAminoMsg(object: QueryEpochInfosResponseAminoMsg): QueryEpochInfosResponse { + return QueryEpochInfosResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryEpochInfosResponse): QueryEpochInfosResponseAminoMsg { + return { + type: "cosmos-sdk/QueryEpochInfosResponse", + value: QueryEpochInfosResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryEpochInfosResponseProtoMsg): QueryEpochInfosResponse { + return QueryEpochInfosResponse.decode(message.value); + }, + toProto(message: QueryEpochInfosResponse): Uint8Array { + return QueryEpochInfosResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryEpochInfosResponse): QueryEpochInfosResponseProtoMsg { + return { + typeUrl: "/cosmos.epochs.v1beta1.QueryEpochInfosResponse", + value: QueryEpochInfosResponse.encode(message).finish() + }; + } +}; +function createBaseQueryCurrentEpochRequest(): QueryCurrentEpochRequest { + return { + identifier: "" + }; +} +export const QueryCurrentEpochRequest = { + typeUrl: "/cosmos.epochs.v1beta1.QueryCurrentEpochRequest", + encode(message: QueryCurrentEpochRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.identifier !== "") { + writer.uint32(10).string(message.identifier); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryCurrentEpochRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCurrentEpochRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.identifier = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryCurrentEpochRequest { + const message = createBaseQueryCurrentEpochRequest(); + message.identifier = object.identifier ?? ""; + return message; + }, + fromAmino(object: QueryCurrentEpochRequestAmino): QueryCurrentEpochRequest { + const message = createBaseQueryCurrentEpochRequest(); + if (object.identifier !== undefined && object.identifier !== null) { + message.identifier = object.identifier; + } + return message; + }, + toAmino(message: QueryCurrentEpochRequest): QueryCurrentEpochRequestAmino { + const obj: any = {}; + obj.identifier = message.identifier === "" ? undefined : message.identifier; + return obj; + }, + fromAminoMsg(object: QueryCurrentEpochRequestAminoMsg): QueryCurrentEpochRequest { + return QueryCurrentEpochRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryCurrentEpochRequest): QueryCurrentEpochRequestAminoMsg { + return { + type: "cosmos-sdk/QueryCurrentEpochRequest", + value: QueryCurrentEpochRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryCurrentEpochRequestProtoMsg): QueryCurrentEpochRequest { + return QueryCurrentEpochRequest.decode(message.value); + }, + toProto(message: QueryCurrentEpochRequest): Uint8Array { + return QueryCurrentEpochRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryCurrentEpochRequest): QueryCurrentEpochRequestProtoMsg { + return { + typeUrl: "/cosmos.epochs.v1beta1.QueryCurrentEpochRequest", + value: QueryCurrentEpochRequest.encode(message).finish() + }; + } +}; +function createBaseQueryCurrentEpochResponse(): QueryCurrentEpochResponse { + return { + currentEpoch: BigInt(0) + }; +} +export const QueryCurrentEpochResponse = { + typeUrl: "/cosmos.epochs.v1beta1.QueryCurrentEpochResponse", + encode(message: QueryCurrentEpochResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.currentEpoch !== BigInt(0)) { + writer.uint32(8).int64(message.currentEpoch); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryCurrentEpochResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCurrentEpochResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.currentEpoch = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryCurrentEpochResponse { + const message = createBaseQueryCurrentEpochResponse(); + message.currentEpoch = object.currentEpoch !== undefined && object.currentEpoch !== null ? BigInt(object.currentEpoch.toString()) : BigInt(0); + return message; + }, + fromAmino(object: QueryCurrentEpochResponseAmino): QueryCurrentEpochResponse { + const message = createBaseQueryCurrentEpochResponse(); + if (object.current_epoch !== undefined && object.current_epoch !== null) { + message.currentEpoch = BigInt(object.current_epoch); + } + return message; + }, + toAmino(message: QueryCurrentEpochResponse): QueryCurrentEpochResponseAmino { + const obj: any = {}; + obj.current_epoch = message.currentEpoch !== BigInt(0) ? message.currentEpoch?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: QueryCurrentEpochResponseAminoMsg): QueryCurrentEpochResponse { + return QueryCurrentEpochResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryCurrentEpochResponse): QueryCurrentEpochResponseAminoMsg { + return { + type: "cosmos-sdk/QueryCurrentEpochResponse", + value: QueryCurrentEpochResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryCurrentEpochResponseProtoMsg): QueryCurrentEpochResponse { + return QueryCurrentEpochResponse.decode(message.value); + }, + toProto(message: QueryCurrentEpochResponse): Uint8Array { + return QueryCurrentEpochResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryCurrentEpochResponse): QueryCurrentEpochResponseProtoMsg { + return { + typeUrl: "/cosmos.epochs.v1beta1.QueryCurrentEpochResponse", + value: QueryCurrentEpochResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/evidence/module/v1/module.ts b/packages/api/src/cosmos/evidence/module/v1/module.ts new file mode 100644 index 00000000..64f948c5 --- /dev/null +++ b/packages/api/src/cosmos/evidence/module/v1/module.ts @@ -0,0 +1,72 @@ +//@ts-nocheck +import { BinaryReader, BinaryWriter } from "../../../../binary"; +/** Module is the config object of the evidence module. */ +export interface Module {} +export interface ModuleProtoMsg { + typeUrl: "/cosmos.evidence.module.v1.Module"; + value: Uint8Array; +} +/** Module is the config object of the evidence module. */ +export interface ModuleAmino {} +export interface ModuleAminoMsg { + type: "cosmos-sdk/Module"; + value: ModuleAmino; +} +/** Module is the config object of the evidence module. */ +export interface ModuleSDKType {} +function createBaseModule(): Module { + return {}; +} +export const Module = { + typeUrl: "/cosmos.evidence.module.v1.Module", + encode(_: Module, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): Module { + const message = createBaseModule(); + return message; + }, + fromAmino(_: ModuleAmino): Module { + const message = createBaseModule(); + return message; + }, + toAmino(_: Module): ModuleAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: ModuleAminoMsg): Module { + return Module.fromAmino(object.value); + }, + toAminoMsg(message: Module): ModuleAminoMsg { + return { + type: "cosmos-sdk/Module", + value: Module.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleProtoMsg): Module { + return Module.decode(message.value); + }, + toProto(message: Module): Uint8Array { + return Module.encode(message).finish(); + }, + toProtoMsg(message: Module): ModuleProtoMsg { + return { + typeUrl: "/cosmos.evidence.module.v1.Module", + value: Module.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/feegrant/module/v1/module.ts b/packages/api/src/cosmos/feegrant/module/v1/module.ts new file mode 100644 index 00000000..69cd3f8d --- /dev/null +++ b/packages/api/src/cosmos/feegrant/module/v1/module.ts @@ -0,0 +1,72 @@ +//@ts-nocheck +import { BinaryReader, BinaryWriter } from "../../../../binary"; +/** Module is the config object of the feegrant module. */ +export interface Module {} +export interface ModuleProtoMsg { + typeUrl: "/cosmos.feegrant.module.v1.Module"; + value: Uint8Array; +} +/** Module is the config object of the feegrant module. */ +export interface ModuleAmino {} +export interface ModuleAminoMsg { + type: "cosmos-sdk/Module"; + value: ModuleAmino; +} +/** Module is the config object of the feegrant module. */ +export interface ModuleSDKType {} +function createBaseModule(): Module { + return {}; +} +export const Module = { + typeUrl: "/cosmos.feegrant.module.v1.Module", + encode(_: Module, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): Module { + const message = createBaseModule(); + return message; + }, + fromAmino(_: ModuleAmino): Module { + const message = createBaseModule(); + return message; + }, + toAmino(_: Module): ModuleAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: ModuleAminoMsg): Module { + return Module.fromAmino(object.value); + }, + toAminoMsg(message: Module): ModuleAminoMsg { + return { + type: "cosmos-sdk/Module", + value: Module.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleProtoMsg): Module { + return Module.decode(message.value); + }, + toProto(message: Module): Uint8Array { + return Module.encode(message).finish(); + }, + toProtoMsg(message: Module): ModuleProtoMsg { + return { + typeUrl: "/cosmos.feegrant.module.v1.Module", + value: Module.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/feegrant/v1beta1/feegrant.ts b/packages/api/src/cosmos/feegrant/v1beta1/feegrant.ts index 45b17c84..abdd8e7a 100644 --- a/packages/api/src/cosmos/feegrant/v1beta1/feegrant.ts +++ b/packages/api/src/cosmos/feegrant/v1beta1/feegrant.ts @@ -34,7 +34,7 @@ export interface BasicAllowanceAmino { * by this allowance and will be updated as coins are spent. If it is * empty, there is no spend limit and any amount of coins can be spent. */ - spend_limit?: CoinAmino[]; + spend_limit: CoinAmino[]; /** expiration specifies an optional time when this allowance expires */ expiration?: string; } @@ -88,25 +88,25 @@ export interface PeriodicAllowanceProtoMsg { */ export interface PeriodicAllowanceAmino { /** basic specifies a struct of `BasicAllowance` */ - basic?: BasicAllowanceAmino; + basic: BasicAllowanceAmino; /** * period specifies the time duration in which period_spend_limit coins can * be spent before that allowance is reset */ - period?: DurationAmino; + period: DurationAmino; /** * period_spend_limit specifies the maximum number of coins that can be spent * in the period */ - period_spend_limit?: CoinAmino[]; + period_spend_limit: CoinAmino[]; /** period_can_spend is the number of coins left to be spent before the period_reset time */ - period_can_spend?: CoinAmino[]; + period_can_spend: CoinAmino[]; /** * period_reset is the time at which this period resets and a new one begins, * it is calculated from the start time of the first transaction after the * last period ended */ - period_reset?: string; + period_reset: string; } export interface PeriodicAllowanceAminoMsg { type: "cosmos-sdk/PeriodicAllowance"; @@ -360,8 +360,8 @@ export const PeriodicAllowance = { }, toAmino(message: PeriodicAllowance): PeriodicAllowanceAmino { const obj: any = {}; - obj.basic = message.basic ? BasicAllowance.toAmino(message.basic) : undefined; - obj.period = message.period ? Duration.toAmino(message.period) : undefined; + obj.basic = message.basic ? BasicAllowance.toAmino(message.basic) : BasicAllowance.toAmino(BasicAllowance.fromPartial({})); + obj.period = message.period ? Duration.toAmino(message.period) : Duration.toAmino(Duration.fromPartial({})); if (message.periodSpendLimit) { obj.period_spend_limit = message.periodSpendLimit.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -372,7 +372,7 @@ export const PeriodicAllowance = { } else { obj.period_can_spend = message.periodCanSpend; } - obj.period_reset = message.periodReset ? Timestamp.toAmino(toTimestamp(message.periodReset)) : undefined; + obj.period_reset = message.periodReset ? Timestamp.toAmino(toTimestamp(message.periodReset)) : new Date(); return obj; }, fromAminoMsg(object: PeriodicAllowanceAminoMsg): PeriodicAllowance { @@ -423,7 +423,7 @@ export const AllowedMsgAllowance = { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.allowance = (FeeAllowanceI_InterfaceDecoder(reader) as Any); + message.allowance = (Cosmos_feegrantv1beta1FeeAllowanceI_InterfaceDecoder(reader) as Any); break; case 2: message.allowedMessages.push(reader.string()); @@ -444,14 +444,14 @@ export const AllowedMsgAllowance = { fromAmino(object: AllowedMsgAllowanceAmino): AllowedMsgAllowance { const message = createBaseAllowedMsgAllowance(); if (object.allowance !== undefined && object.allowance !== null) { - message.allowance = FeeAllowanceI_FromAmino(object.allowance); + message.allowance = Cosmos_feegrantv1beta1FeeAllowanceI_FromAmino(object.allowance); } message.allowedMessages = object.allowed_messages?.map(e => e) || []; return message; }, toAmino(message: AllowedMsgAllowance): AllowedMsgAllowanceAmino { const obj: any = {}; - obj.allowance = message.allowance ? FeeAllowanceI_ToAmino((message.allowance as Any)) : undefined; + obj.allowance = message.allowance ? Cosmos_feegrantv1beta1FeeAllowanceI_ToAmino((message.allowance as Any)) : undefined; if (message.allowedMessages) { obj.allowed_messages = message.allowedMessages.map(e => e); } else { @@ -516,7 +516,7 @@ export const Grant = { message.grantee = reader.string(); break; case 3: - message.allowance = (FeeAllowanceI_InterfaceDecoder(reader) as Any); + message.allowance = (Cosmos_feegrantv1beta1FeeAllowanceI_InterfaceDecoder(reader) as Any); break; default: reader.skipType(tag & 7); @@ -541,7 +541,7 @@ export const Grant = { message.grantee = object.grantee; } if (object.allowance !== undefined && object.allowance !== null) { - message.allowance = FeeAllowanceI_FromAmino(object.allowance); + message.allowance = Cosmos_feegrantv1beta1FeeAllowanceI_FromAmino(object.allowance); } return message; }, @@ -549,7 +549,7 @@ export const Grant = { const obj: any = {}; obj.granter = message.granter === "" ? undefined : message.granter; obj.grantee = message.grantee === "" ? undefined : message.grantee; - obj.allowance = message.allowance ? FeeAllowanceI_ToAmino((message.allowance as Any)) : undefined; + obj.allowance = message.allowance ? Cosmos_feegrantv1beta1FeeAllowanceI_ToAmino((message.allowance as Any)) : undefined; return obj; }, fromAminoMsg(object: GrantAminoMsg): Grant { @@ -574,7 +574,7 @@ export const Grant = { }; } }; -export const FeeAllowanceI_InterfaceDecoder = (input: BinaryReader | Uint8Array): BasicAllowance | PeriodicAllowance | AllowedMsgAllowance | Any => { +export const Cosmos_feegrantv1beta1FeeAllowanceI_InterfaceDecoder = (input: BinaryReader | Uint8Array): BasicAllowance | PeriodicAllowance | AllowedMsgAllowance | Any => { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const data = Any.decode(reader, reader.uint32()); switch (data.typeUrl) { @@ -588,7 +588,7 @@ export const FeeAllowanceI_InterfaceDecoder = (input: BinaryReader | Uint8Array) return data; } }; -export const FeeAllowanceI_FromAmino = (content: AnyAmino): Any => { +export const Cosmos_feegrantv1beta1FeeAllowanceI_FromAmino = (content: AnyAmino): Any => { switch (content.type) { case "cosmos-sdk/BasicAllowance": return Any.fromPartial({ @@ -609,7 +609,7 @@ export const FeeAllowanceI_FromAmino = (content: AnyAmino): Any => { return Any.fromAmino(content); } }; -export const FeeAllowanceI_ToAmino = (content: Any) => { +export const Cosmos_feegrantv1beta1FeeAllowanceI_ToAmino = (content: Any) => { switch (content.typeUrl) { case "/cosmos.feegrant.v1beta1.BasicAllowance": return { diff --git a/packages/api/src/cosmos/feegrant/v1beta1/genesis.ts b/packages/api/src/cosmos/feegrant/v1beta1/genesis.ts index 2998b092..6ec109a7 100644 --- a/packages/api/src/cosmos/feegrant/v1beta1/genesis.ts +++ b/packages/api/src/cosmos/feegrant/v1beta1/genesis.ts @@ -11,7 +11,7 @@ export interface GenesisStateProtoMsg { } /** GenesisState contains a set of fee allowances, persisted from the store */ export interface GenesisStateAmino { - allowances?: GrantAmino[]; + allowances: GrantAmino[]; } export interface GenesisStateAminoMsg { type: "cosmos-sdk/GenesisState"; diff --git a/packages/api/src/cosmos/feegrant/v1beta1/query.lcd.ts b/packages/api/src/cosmos/feegrant/v1beta1/query.lcd.ts index 155d35c8..917e06eb 100644 --- a/packages/api/src/cosmos/feegrant/v1beta1/query.lcd.ts +++ b/packages/api/src/cosmos/feegrant/v1beta1/query.lcd.ts @@ -14,12 +14,12 @@ export class LCDQueryClient { this.allowances = this.allowances.bind(this); this.allowancesByGranter = this.allowancesByGranter.bind(this); } - /* Allowance returns fee granted to the grantee by the granter. */ + /* Allowance returns granted allwance to the grantee by the granter. */ async allowance(params: QueryAllowanceRequest): Promise { const endpoint = `cosmos/feegrant/v1beta1/allowance/${params.granter}/${params.grantee}`; return await this.req.get(endpoint); } - /* Allowances returns all the grants for address. */ + /* Allowances returns all the grants for the given grantee address. */ async allowances(params: QueryAllowancesRequest): Promise { const options: any = { params: {} @@ -30,9 +30,7 @@ export class LCDQueryClient { const endpoint = `cosmos/feegrant/v1beta1/allowances/${params.grantee}`; return await this.req.get(endpoint, options); } - /* AllowancesByGranter returns all the grants given by an address - - Since: cosmos-sdk 0.46 */ + /* AllowancesByGranter returns all the grants given by an address */ async allowancesByGranter(params: QueryAllowancesByGranterRequest): Promise { const options: any = { params: {} diff --git a/packages/api/src/cosmos/feegrant/v1beta1/query.rpc.Query.ts b/packages/api/src/cosmos/feegrant/v1beta1/query.rpc.Query.ts index 76667558..a8266774 100644 --- a/packages/api/src/cosmos/feegrant/v1beta1/query.rpc.Query.ts +++ b/packages/api/src/cosmos/feegrant/v1beta1/query.rpc.Query.ts @@ -5,15 +5,11 @@ import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryAllowanceRequest, QueryAllowanceResponse, QueryAllowancesRequest, QueryAllowancesResponse, QueryAllowancesByGranterRequest, QueryAllowancesByGranterResponse } from "./query"; /** Query defines the gRPC querier service. */ export interface Query { - /** Allowance returns fee granted to the grantee by the granter. */ + /** Allowance returns granted allwance to the grantee by the granter. */ allowance(request: QueryAllowanceRequest): Promise; - /** Allowances returns all the grants for address. */ + /** Allowances returns all the grants for the given grantee address. */ allowances(request: QueryAllowancesRequest): Promise; - /** - * AllowancesByGranter returns all the grants given by an address - * - * Since: cosmos-sdk 0.46 - */ + /** AllowancesByGranter returns all the grants given by an address */ allowancesByGranter(request: QueryAllowancesByGranterRequest): Promise; } export class QueryClientImpl implements Query { diff --git a/packages/api/src/cosmos/feegrant/v1beta1/query.ts b/packages/api/src/cosmos/feegrant/v1beta1/query.ts index 37ce48aa..6deb455c 100644 --- a/packages/api/src/cosmos/feegrant/v1beta1/query.ts +++ b/packages/api/src/cosmos/feegrant/v1beta1/query.ts @@ -103,11 +103,7 @@ export interface QueryAllowancesResponseSDKType { allowances: GrantSDKType[]; pagination?: PageResponseSDKType; } -/** - * QueryAllowancesByGranterRequest is the request type for the Query/AllowancesByGranter RPC method. - * - * Since: cosmos-sdk 0.46 - */ +/** QueryAllowancesByGranterRequest is the request type for the Query/AllowancesByGranter RPC method. */ export interface QueryAllowancesByGranterRequest { granter: string; /** pagination defines an pagination for the request. */ @@ -117,11 +113,7 @@ export interface QueryAllowancesByGranterRequestProtoMsg { typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowancesByGranterRequest"; value: Uint8Array; } -/** - * QueryAllowancesByGranterRequest is the request type for the Query/AllowancesByGranter RPC method. - * - * Since: cosmos-sdk 0.46 - */ +/** QueryAllowancesByGranterRequest is the request type for the Query/AllowancesByGranter RPC method. */ export interface QueryAllowancesByGranterRequestAmino { granter?: string; /** pagination defines an pagination for the request. */ @@ -131,20 +123,12 @@ export interface QueryAllowancesByGranterRequestAminoMsg { type: "cosmos-sdk/QueryAllowancesByGranterRequest"; value: QueryAllowancesByGranterRequestAmino; } -/** - * QueryAllowancesByGranterRequest is the request type for the Query/AllowancesByGranter RPC method. - * - * Since: cosmos-sdk 0.46 - */ +/** QueryAllowancesByGranterRequest is the request type for the Query/AllowancesByGranter RPC method. */ export interface QueryAllowancesByGranterRequestSDKType { granter: string; pagination?: PageRequestSDKType; } -/** - * QueryAllowancesByGranterResponse is the response type for the Query/AllowancesByGranter RPC method. - * - * Since: cosmos-sdk 0.46 - */ +/** QueryAllowancesByGranterResponse is the response type for the Query/AllowancesByGranter RPC method. */ export interface QueryAllowancesByGranterResponse { /** allowances that have been issued by the granter. */ allowances: Grant[]; @@ -155,11 +139,7 @@ export interface QueryAllowancesByGranterResponseProtoMsg { typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowancesByGranterResponse"; value: Uint8Array; } -/** - * QueryAllowancesByGranterResponse is the response type for the Query/AllowancesByGranter RPC method. - * - * Since: cosmos-sdk 0.46 - */ +/** QueryAllowancesByGranterResponse is the response type for the Query/AllowancesByGranter RPC method. */ export interface QueryAllowancesByGranterResponseAmino { /** allowances that have been issued by the granter. */ allowances?: GrantAmino[]; @@ -170,11 +150,7 @@ export interface QueryAllowancesByGranterResponseAminoMsg { type: "cosmos-sdk/QueryAllowancesByGranterResponse"; value: QueryAllowancesByGranterResponseAmino; } -/** - * QueryAllowancesByGranterResponse is the response type for the Query/AllowancesByGranter RPC method. - * - * Since: cosmos-sdk 0.46 - */ +/** QueryAllowancesByGranterResponse is the response type for the Query/AllowancesByGranter RPC method. */ export interface QueryAllowancesByGranterResponseSDKType { allowances: GrantSDKType[]; pagination?: PageResponseSDKType; diff --git a/packages/api/src/cosmos/feegrant/v1beta1/tx.amino.ts b/packages/api/src/cosmos/feegrant/v1beta1/tx.amino.ts index 4caf0da6..763c586d 100644 --- a/packages/api/src/cosmos/feegrant/v1beta1/tx.amino.ts +++ b/packages/api/src/cosmos/feegrant/v1beta1/tx.amino.ts @@ -1,5 +1,5 @@ //@ts-nocheck -import { MsgGrantAllowance, MsgRevokeAllowance } from "./tx"; +import { MsgGrantAllowance, MsgRevokeAllowance, MsgPruneAllowances } from "./tx"; export const AminoConverter = { "/cosmos.feegrant.v1beta1.MsgGrantAllowance": { aminoType: "cosmos-sdk/MsgGrantAllowance", @@ -10,5 +10,10 @@ export const AminoConverter = { aminoType: "cosmos-sdk/MsgRevokeAllowance", toAmino: MsgRevokeAllowance.toAmino, fromAmino: MsgRevokeAllowance.fromAmino + }, + "/cosmos.feegrant.v1beta1.MsgPruneAllowances": { + aminoType: "cosmos-sdk/MsgPruneAllowances", + toAmino: MsgPruneAllowances.toAmino, + fromAmino: MsgPruneAllowances.fromAmino } }; \ No newline at end of file diff --git a/packages/api/src/cosmos/feegrant/v1beta1/tx.registry.ts b/packages/api/src/cosmos/feegrant/v1beta1/tx.registry.ts index 0ef6e3bc..a974fd53 100644 --- a/packages/api/src/cosmos/feegrant/v1beta1/tx.registry.ts +++ b/packages/api/src/cosmos/feegrant/v1beta1/tx.registry.ts @@ -1,7 +1,7 @@ //@ts-nocheck import { GeneratedType, Registry } from "@cosmjs/proto-signing"; -import { MsgGrantAllowance, MsgRevokeAllowance } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.feegrant.v1beta1.MsgGrantAllowance", MsgGrantAllowance], ["/cosmos.feegrant.v1beta1.MsgRevokeAllowance", MsgRevokeAllowance]]; +import { MsgGrantAllowance, MsgRevokeAllowance, MsgPruneAllowances } from "./tx"; +export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.feegrant.v1beta1.MsgGrantAllowance", MsgGrantAllowance], ["/cosmos.feegrant.v1beta1.MsgRevokeAllowance", MsgRevokeAllowance], ["/cosmos.feegrant.v1beta1.MsgPruneAllowances", MsgPruneAllowances]]; export const load = (protoRegistry: Registry) => { registry.forEach(([typeUrl, mod]) => { protoRegistry.register(typeUrl, mod); @@ -20,6 +20,12 @@ export const MessageComposer = { typeUrl: "/cosmos.feegrant.v1beta1.MsgRevokeAllowance", value: MsgRevokeAllowance.encode(value).finish() }; + }, + pruneAllowances(value: MsgPruneAllowances) { + return { + typeUrl: "/cosmos.feegrant.v1beta1.MsgPruneAllowances", + value: MsgPruneAllowances.encode(value).finish() + }; } }, withTypeUrl: { @@ -34,6 +40,12 @@ export const MessageComposer = { typeUrl: "/cosmos.feegrant.v1beta1.MsgRevokeAllowance", value }; + }, + pruneAllowances(value: MsgPruneAllowances) { + return { + typeUrl: "/cosmos.feegrant.v1beta1.MsgPruneAllowances", + value + }; } }, fromPartial: { @@ -48,6 +60,12 @@ export const MessageComposer = { typeUrl: "/cosmos.feegrant.v1beta1.MsgRevokeAllowance", value: MsgRevokeAllowance.fromPartial(value) }; + }, + pruneAllowances(value: MsgPruneAllowances) { + return { + typeUrl: "/cosmos.feegrant.v1beta1.MsgPruneAllowances", + value: MsgPruneAllowances.fromPartial(value) + }; } } }; \ No newline at end of file diff --git a/packages/api/src/cosmos/feegrant/v1beta1/tx.rpc.msg.ts b/packages/api/src/cosmos/feegrant/v1beta1/tx.rpc.msg.ts index ab613eab..f5625963 100644 --- a/packages/api/src/cosmos/feegrant/v1beta1/tx.rpc.msg.ts +++ b/packages/api/src/cosmos/feegrant/v1beta1/tx.rpc.msg.ts @@ -1,7 +1,7 @@ //@ts-nocheck import { Rpc } from "../../../helpers"; import { BinaryReader } from "../../../binary"; -import { MsgGrantAllowance, MsgGrantAllowanceResponse, MsgRevokeAllowance, MsgRevokeAllowanceResponse } from "./tx"; +import { MsgGrantAllowance, MsgGrantAllowanceResponse, MsgRevokeAllowance, MsgRevokeAllowanceResponse, MsgPruneAllowances, MsgPruneAllowancesResponse } from "./tx"; /** Msg defines the feegrant msg service. */ export interface Msg { /** @@ -14,6 +14,8 @@ export interface Msg { * has been granted to the grantee. */ revokeAllowance(request: MsgRevokeAllowance): Promise; + /** PruneAllowances prunes expired fee allowances, currently up to 75 at a time. */ + pruneAllowances(request: MsgPruneAllowances): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: Rpc; @@ -21,6 +23,7 @@ export class MsgClientImpl implements Msg { this.rpc = rpc; this.grantAllowance = this.grantAllowance.bind(this); this.revokeAllowance = this.revokeAllowance.bind(this); + this.pruneAllowances = this.pruneAllowances.bind(this); } grantAllowance(request: MsgGrantAllowance): Promise { const data = MsgGrantAllowance.encode(request).finish(); @@ -32,4 +35,9 @@ export class MsgClientImpl implements Msg { const promise = this.rpc.request("cosmos.feegrant.v1beta1.Msg", "RevokeAllowance", data); return promise.then(data => MsgRevokeAllowanceResponse.decode(new BinaryReader(data))); } + pruneAllowances(request: MsgPruneAllowances): Promise { + const data = MsgPruneAllowances.encode(request).finish(); + const promise = this.rpc.request("cosmos.feegrant.v1beta1.Msg", "PruneAllowances", data); + return promise.then(data => MsgPruneAllowancesResponse.decode(new BinaryReader(data))); + } } \ No newline at end of file diff --git a/packages/api/src/cosmos/feegrant/v1beta1/tx.ts b/packages/api/src/cosmos/feegrant/v1beta1/tx.ts index 6e24f86f..cee780cd 100644 --- a/packages/api/src/cosmos/feegrant/v1beta1/tx.ts +++ b/packages/api/src/cosmos/feegrant/v1beta1/tx.ts @@ -101,6 +101,42 @@ export interface MsgRevokeAllowanceResponseAminoMsg { } /** MsgRevokeAllowanceResponse defines the Msg/RevokeAllowanceResponse response type. */ export interface MsgRevokeAllowanceResponseSDKType {} +/** MsgPruneAllowances prunes expired fee allowances. */ +export interface MsgPruneAllowances { + /** pruner is the address of the user pruning expired allowances. */ + pruner: string; +} +export interface MsgPruneAllowancesProtoMsg { + typeUrl: "/cosmos.feegrant.v1beta1.MsgPruneAllowances"; + value: Uint8Array; +} +/** MsgPruneAllowances prunes expired fee allowances. */ +export interface MsgPruneAllowancesAmino { + /** pruner is the address of the user pruning expired allowances. */ + pruner?: string; +} +export interface MsgPruneAllowancesAminoMsg { + type: "cosmos-sdk/MsgPruneAllowances"; + value: MsgPruneAllowancesAmino; +} +/** MsgPruneAllowances prunes expired fee allowances. */ +export interface MsgPruneAllowancesSDKType { + pruner: string; +} +/** MsgPruneAllowancesResponse defines the Msg/PruneAllowancesResponse response type. */ +export interface MsgPruneAllowancesResponse {} +export interface MsgPruneAllowancesResponseProtoMsg { + typeUrl: "/cosmos.feegrant.v1beta1.MsgPruneAllowancesResponse"; + value: Uint8Array; +} +/** MsgPruneAllowancesResponse defines the Msg/PruneAllowancesResponse response type. */ +export interface MsgPruneAllowancesResponseAmino {} +export interface MsgPruneAllowancesResponseAminoMsg { + type: "cosmos-sdk/MsgPruneAllowancesResponse"; + value: MsgPruneAllowancesResponseAmino; +} +/** MsgPruneAllowancesResponse defines the Msg/PruneAllowancesResponse response type. */ +export interface MsgPruneAllowancesResponseSDKType {} function createBaseMsgGrantAllowance(): MsgGrantAllowance { return { granter: "", @@ -136,7 +172,7 @@ export const MsgGrantAllowance = { message.grantee = reader.string(); break; case 3: - message.allowance = (FeeAllowanceI_InterfaceDecoder(reader) as Any); + message.allowance = (Cosmos_feegrantv1beta1FeeAllowanceI_InterfaceDecoder(reader) as Any); break; default: reader.skipType(tag & 7); @@ -161,7 +197,7 @@ export const MsgGrantAllowance = { message.grantee = object.grantee; } if (object.allowance !== undefined && object.allowance !== null) { - message.allowance = FeeAllowanceI_FromAmino(object.allowance); + message.allowance = Cosmos_feegrantv1beta1FeeAllowanceI_FromAmino(object.allowance); } return message; }, @@ -169,7 +205,7 @@ export const MsgGrantAllowance = { const obj: any = {}; obj.granter = message.granter === "" ? undefined : message.granter; obj.grantee = message.grantee === "" ? undefined : message.grantee; - obj.allowance = message.allowance ? FeeAllowanceI_ToAmino((message.allowance as Any)) : undefined; + obj.allowance = message.allowance ? Cosmos_feegrantv1beta1FeeAllowanceI_ToAmino((message.allowance as Any)) : undefined; return obj; }, fromAminoMsg(object: MsgGrantAllowanceAminoMsg): MsgGrantAllowance { @@ -387,7 +423,132 @@ export const MsgRevokeAllowanceResponse = { }; } }; -export const FeeAllowanceI_InterfaceDecoder = (input: BinaryReader | Uint8Array): BasicAllowance | PeriodicAllowance | AllowedMsgAllowance | Any => { +function createBaseMsgPruneAllowances(): MsgPruneAllowances { + return { + pruner: "" + }; +} +export const MsgPruneAllowances = { + typeUrl: "/cosmos.feegrant.v1beta1.MsgPruneAllowances", + encode(message: MsgPruneAllowances, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.pruner !== "") { + writer.uint32(10).string(message.pruner); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgPruneAllowances { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgPruneAllowances(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pruner = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgPruneAllowances { + const message = createBaseMsgPruneAllowances(); + message.pruner = object.pruner ?? ""; + return message; + }, + fromAmino(object: MsgPruneAllowancesAmino): MsgPruneAllowances { + const message = createBaseMsgPruneAllowances(); + if (object.pruner !== undefined && object.pruner !== null) { + message.pruner = object.pruner; + } + return message; + }, + toAmino(message: MsgPruneAllowances): MsgPruneAllowancesAmino { + const obj: any = {}; + obj.pruner = message.pruner === "" ? undefined : message.pruner; + return obj; + }, + fromAminoMsg(object: MsgPruneAllowancesAminoMsg): MsgPruneAllowances { + return MsgPruneAllowances.fromAmino(object.value); + }, + toAminoMsg(message: MsgPruneAllowances): MsgPruneAllowancesAminoMsg { + return { + type: "cosmos-sdk/MsgPruneAllowances", + value: MsgPruneAllowances.toAmino(message) + }; + }, + fromProtoMsg(message: MsgPruneAllowancesProtoMsg): MsgPruneAllowances { + return MsgPruneAllowances.decode(message.value); + }, + toProto(message: MsgPruneAllowances): Uint8Array { + return MsgPruneAllowances.encode(message).finish(); + }, + toProtoMsg(message: MsgPruneAllowances): MsgPruneAllowancesProtoMsg { + return { + typeUrl: "/cosmos.feegrant.v1beta1.MsgPruneAllowances", + value: MsgPruneAllowances.encode(message).finish() + }; + } +}; +function createBaseMsgPruneAllowancesResponse(): MsgPruneAllowancesResponse { + return {}; +} +export const MsgPruneAllowancesResponse = { + typeUrl: "/cosmos.feegrant.v1beta1.MsgPruneAllowancesResponse", + encode(_: MsgPruneAllowancesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgPruneAllowancesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgPruneAllowancesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): MsgPruneAllowancesResponse { + const message = createBaseMsgPruneAllowancesResponse(); + return message; + }, + fromAmino(_: MsgPruneAllowancesResponseAmino): MsgPruneAllowancesResponse { + const message = createBaseMsgPruneAllowancesResponse(); + return message; + }, + toAmino(_: MsgPruneAllowancesResponse): MsgPruneAllowancesResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgPruneAllowancesResponseAminoMsg): MsgPruneAllowancesResponse { + return MsgPruneAllowancesResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgPruneAllowancesResponse): MsgPruneAllowancesResponseAminoMsg { + return { + type: "cosmos-sdk/MsgPruneAllowancesResponse", + value: MsgPruneAllowancesResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgPruneAllowancesResponseProtoMsg): MsgPruneAllowancesResponse { + return MsgPruneAllowancesResponse.decode(message.value); + }, + toProto(message: MsgPruneAllowancesResponse): Uint8Array { + return MsgPruneAllowancesResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgPruneAllowancesResponse): MsgPruneAllowancesResponseProtoMsg { + return { + typeUrl: "/cosmos.feegrant.v1beta1.MsgPruneAllowancesResponse", + value: MsgPruneAllowancesResponse.encode(message).finish() + }; + } +}; +export const Cosmos_feegrantv1beta1FeeAllowanceI_InterfaceDecoder = (input: BinaryReader | Uint8Array): BasicAllowance | PeriodicAllowance | AllowedMsgAllowance | Any => { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const data = Any.decode(reader, reader.uint32()); switch (data.typeUrl) { @@ -401,7 +562,7 @@ export const FeeAllowanceI_InterfaceDecoder = (input: BinaryReader | Uint8Array) return data; } }; -export const FeeAllowanceI_FromAmino = (content: AnyAmino): Any => { +export const Cosmos_feegrantv1beta1FeeAllowanceI_FromAmino = (content: AnyAmino): Any => { switch (content.type) { case "cosmos-sdk/BasicAllowance": return Any.fromPartial({ @@ -422,7 +583,7 @@ export const FeeAllowanceI_FromAmino = (content: AnyAmino): Any => { return Any.fromAmino(content); } }; -export const FeeAllowanceI_ToAmino = (content: Any) => { +export const Cosmos_feegrantv1beta1FeeAllowanceI_ToAmino = (content: Any) => { switch (content.typeUrl) { case "/cosmos.feegrant.v1beta1.BasicAllowance": return { diff --git a/packages/api/src/cosmos/genutil/module/v1/module.ts b/packages/api/src/cosmos/genutil/module/v1/module.ts new file mode 100644 index 00000000..d3b9c14d --- /dev/null +++ b/packages/api/src/cosmos/genutil/module/v1/module.ts @@ -0,0 +1,72 @@ +//@ts-nocheck +import { BinaryReader, BinaryWriter } from "../../../../binary"; +/** Module is the config object for the genutil module. */ +export interface Module {} +export interface ModuleProtoMsg { + typeUrl: "/cosmos.genutil.module.v1.Module"; + value: Uint8Array; +} +/** Module is the config object for the genutil module. */ +export interface ModuleAmino {} +export interface ModuleAminoMsg { + type: "cosmos-sdk/Module"; + value: ModuleAmino; +} +/** Module is the config object for the genutil module. */ +export interface ModuleSDKType {} +function createBaseModule(): Module { + return {}; +} +export const Module = { + typeUrl: "/cosmos.genutil.module.v1.Module", + encode(_: Module, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): Module { + const message = createBaseModule(); + return message; + }, + fromAmino(_: ModuleAmino): Module { + const message = createBaseModule(); + return message; + }, + toAmino(_: Module): ModuleAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: ModuleAminoMsg): Module { + return Module.fromAmino(object.value); + }, + toAminoMsg(message: Module): ModuleAminoMsg { + return { + type: "cosmos-sdk/Module", + value: Module.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleProtoMsg): Module { + return Module.decode(message.value); + }, + toProto(message: Module): Uint8Array { + return Module.encode(message).finish(); + }, + toProtoMsg(message: Module): ModuleProtoMsg { + return { + typeUrl: "/cosmos.genutil.module.v1.Module", + value: Module.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/gov/module/v1/module.ts b/packages/api/src/cosmos/gov/module/v1/module.ts new file mode 100644 index 00000000..0443032f --- /dev/null +++ b/packages/api/src/cosmos/gov/module/v1/module.ts @@ -0,0 +1,116 @@ +//@ts-nocheck +import { BinaryReader, BinaryWriter } from "../../../../binary"; +/** Module is the config object of the gov module. */ +export interface Module { + /** + * max_metadata_len defines the maximum proposal metadata length. + * Defaults to 255 if not explicitly set. + */ + maxMetadataLen: bigint; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} +export interface ModuleProtoMsg { + typeUrl: "/cosmos.gov.module.v1.Module"; + value: Uint8Array; +} +/** Module is the config object of the gov module. */ +export interface ModuleAmino { + /** + * max_metadata_len defines the maximum proposal metadata length. + * Defaults to 255 if not explicitly set. + */ + max_metadata_len?: string; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority?: string; +} +export interface ModuleAminoMsg { + type: "cosmos-sdk/Module"; + value: ModuleAmino; +} +/** Module is the config object of the gov module. */ +export interface ModuleSDKType { + max_metadata_len: bigint; + authority: string; +} +function createBaseModule(): Module { + return { + maxMetadataLen: BigInt(0), + authority: "" + }; +} +export const Module = { + typeUrl: "/cosmos.gov.module.v1.Module", + encode(message: Module, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.maxMetadataLen !== BigInt(0)) { + writer.uint32(8).uint64(message.maxMetadataLen); + } + if (message.authority !== "") { + writer.uint32(18).string(message.authority); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.maxMetadataLen = reader.uint64(); + break; + case 2: + message.authority = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): Module { + const message = createBaseModule(); + message.maxMetadataLen = object.maxMetadataLen !== undefined && object.maxMetadataLen !== null ? BigInt(object.maxMetadataLen.toString()) : BigInt(0); + message.authority = object.authority ?? ""; + return message; + }, + fromAmino(object: ModuleAmino): Module { + const message = createBaseModule(); + if (object.max_metadata_len !== undefined && object.max_metadata_len !== null) { + message.maxMetadataLen = BigInt(object.max_metadata_len); + } + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + return message; + }, + toAmino(message: Module): ModuleAmino { + const obj: any = {}; + obj.max_metadata_len = message.maxMetadataLen !== BigInt(0) ? message.maxMetadataLen?.toString() : undefined; + obj.authority = message.authority === "" ? undefined : message.authority; + return obj; + }, + fromAminoMsg(object: ModuleAminoMsg): Module { + return Module.fromAmino(object.value); + }, + toAminoMsg(message: Module): ModuleAminoMsg { + return { + type: "cosmos-sdk/Module", + value: Module.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleProtoMsg): Module { + return Module.decode(message.value); + }, + toProto(message: Module): Uint8Array { + return Module.encode(message).finish(); + }, + toProtoMsg(message: Module): ModuleProtoMsg { + return { + typeUrl: "/cosmos.gov.module.v1.Module", + value: Module.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/gov/v1/genesis.ts b/packages/api/src/cosmos/gov/v1/genesis.ts index 0d848333..c6d1d17d 100644 --- a/packages/api/src/cosmos/gov/v1/genesis.ts +++ b/packages/api/src/cosmos/gov/v1/genesis.ts @@ -1,5 +1,5 @@ //@ts-nocheck -import { Deposit, DepositAmino, DepositSDKType, Vote, VoteAmino, VoteSDKType, Proposal, ProposalAmino, ProposalSDKType, DepositParams, DepositParamsAmino, DepositParamsSDKType, VotingParams, VotingParamsAmino, VotingParamsSDKType, TallyParams, TallyParamsAmino, TallyParamsSDKType } from "./gov"; +import { Deposit, DepositAmino, DepositSDKType, Vote, VoteAmino, VoteSDKType, Proposal, ProposalAmino, ProposalSDKType, DepositParams, DepositParamsAmino, DepositParamsSDKType, VotingParams, VotingParamsAmino, VotingParamsSDKType, TallyParams, TallyParamsAmino, TallyParamsSDKType, Params, ParamsAmino, ParamsSDKType } from "./gov"; import { BinaryReader, BinaryWriter } from "../../../binary"; /** GenesisState defines the gov module's genesis state. */ export interface GenesisState { @@ -11,12 +11,33 @@ export interface GenesisState { votes: Vote[]; /** proposals defines all the proposals present at genesis. */ proposals: Proposal[]; - /** params defines all the paramaters of related to deposit. */ + /** + * Deprecated: Prefer to use `params` instead. + * deposit_params defines all the paramaters of related to deposit. + */ + /** @deprecated */ depositParams?: DepositParams; - /** params defines all the paramaters of related to voting. */ + /** + * Deprecated: Prefer to use `params` instead. + * voting_params defines all the paramaters of related to voting. + */ + /** @deprecated */ votingParams?: VotingParams; - /** params defines all the paramaters of related to tally. */ + /** + * Deprecated: Prefer to use `params` instead. + * tally_params defines all the paramaters of related to tally. + */ + /** @deprecated */ tallyParams?: TallyParams; + /** params defines all the paramaters of x/gov module. */ + params?: Params; + /** + * The constitution allows builders to lay a foundation and define purpose. + * This is an immutable string set in genesis. + * There are no amendments, to go outside of scope, just fork. + * constitution is an immutable string in genesis for a chain builder to lay out their vision, ideas and ideals. + */ + constitution: string; } export interface GenesisStateProtoMsg { typeUrl: "/cosmos.gov.v1.GenesisState"; @@ -32,12 +53,33 @@ export interface GenesisStateAmino { votes?: VoteAmino[]; /** proposals defines all the proposals present at genesis. */ proposals?: ProposalAmino[]; - /** params defines all the paramaters of related to deposit. */ + /** + * Deprecated: Prefer to use `params` instead. + * deposit_params defines all the paramaters of related to deposit. + */ + /** @deprecated */ deposit_params?: DepositParamsAmino; - /** params defines all the paramaters of related to voting. */ + /** + * Deprecated: Prefer to use `params` instead. + * voting_params defines all the paramaters of related to voting. + */ + /** @deprecated */ voting_params?: VotingParamsAmino; - /** params defines all the paramaters of related to tally. */ + /** + * Deprecated: Prefer to use `params` instead. + * tally_params defines all the paramaters of related to tally. + */ + /** @deprecated */ tally_params?: TallyParamsAmino; + /** params defines all the paramaters of x/gov module. */ + params?: ParamsAmino; + /** + * The constitution allows builders to lay a foundation and define purpose. + * This is an immutable string set in genesis. + * There are no amendments, to go outside of scope, just fork. + * constitution is an immutable string in genesis for a chain builder to lay out their vision, ideas and ideals. + */ + constitution?: string; } export interface GenesisStateAminoMsg { type: "cosmos-sdk/v1/GenesisState"; @@ -49,9 +91,14 @@ export interface GenesisStateSDKType { deposits: DepositSDKType[]; votes: VoteSDKType[]; proposals: ProposalSDKType[]; + /** @deprecated */ deposit_params?: DepositParamsSDKType; + /** @deprecated */ voting_params?: VotingParamsSDKType; + /** @deprecated */ tally_params?: TallyParamsSDKType; + params?: ParamsSDKType; + constitution: string; } function createBaseGenesisState(): GenesisState { return { @@ -61,7 +108,9 @@ function createBaseGenesisState(): GenesisState { proposals: [], depositParams: undefined, votingParams: undefined, - tallyParams: undefined + tallyParams: undefined, + params: undefined, + constitution: "" }; } export const GenesisState = { @@ -88,6 +137,12 @@ export const GenesisState = { if (message.tallyParams !== undefined) { TallyParams.encode(message.tallyParams, writer.uint32(58).fork()).ldelim(); } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(66).fork()).ldelim(); + } + if (message.constitution !== "") { + writer.uint32(74).string(message.constitution); + } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { @@ -118,6 +173,12 @@ export const GenesisState = { case 7: message.tallyParams = TallyParams.decode(reader, reader.uint32()); break; + case 8: + message.params = Params.decode(reader, reader.uint32()); + break; + case 9: + message.constitution = reader.string(); + break; default: reader.skipType(tag & 7); break; @@ -134,6 +195,8 @@ export const GenesisState = { message.depositParams = object.depositParams !== undefined && object.depositParams !== null ? DepositParams.fromPartial(object.depositParams) : undefined; message.votingParams = object.votingParams !== undefined && object.votingParams !== null ? VotingParams.fromPartial(object.votingParams) : undefined; message.tallyParams = object.tallyParams !== undefined && object.tallyParams !== null ? TallyParams.fromPartial(object.tallyParams) : undefined; + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + message.constitution = object.constitution ?? ""; return message; }, fromAmino(object: GenesisStateAmino): GenesisState { @@ -153,6 +216,12 @@ export const GenesisState = { if (object.tally_params !== undefined && object.tally_params !== null) { message.tallyParams = TallyParams.fromAmino(object.tally_params); } + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + if (object.constitution !== undefined && object.constitution !== null) { + message.constitution = object.constitution; + } return message; }, toAmino(message: GenesisState): GenesisStateAmino { @@ -176,6 +245,8 @@ export const GenesisState = { obj.deposit_params = message.depositParams ? DepositParams.toAmino(message.depositParams) : undefined; obj.voting_params = message.votingParams ? VotingParams.toAmino(message.votingParams) : undefined; obj.tally_params = message.tallyParams ? TallyParams.toAmino(message.tallyParams) : undefined; + obj.params = message.params ? Params.toAmino(message.params) : undefined; + obj.constitution = message.constitution === "" ? undefined : message.constitution; return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/packages/api/src/cosmos/gov/v1/gov.ts b/packages/api/src/cosmos/gov/v1/gov.ts index 0cdab084..a56f54cf 100644 --- a/packages/api/src/cosmos/gov/v1/gov.ts +++ b/packages/api/src/cosmos/gov/v1/gov.ts @@ -141,7 +141,9 @@ export function proposalStatusToJSON(object: ProposalStatus): string { } /** WeightedVoteOption defines a unit of vote for vote split. */ export interface WeightedVoteOption { + /** option defines the valid vote options, it must not contain duplicate vote options. */ option: VoteOption; + /** weight is the vote weight associated with the vote option. */ weight: string; } export interface WeightedVoteOptionProtoMsg { @@ -150,7 +152,9 @@ export interface WeightedVoteOptionProtoMsg { } /** WeightedVoteOption defines a unit of vote for vote split. */ export interface WeightedVoteOptionAmino { + /** option defines the valid vote options, it must not contain duplicate vote options. */ option?: VoteOption; + /** weight is the vote weight associated with the vote option. */ weight?: string; } export interface WeightedVoteOptionAminoMsg { @@ -167,8 +171,11 @@ export interface WeightedVoteOptionSDKType { * proposal. */ export interface Deposit { + /** proposal_id defines the unique id of the proposal. */ proposalId: bigint; + /** depositor defines the deposit addresses from the proposals. */ depositor: string; + /** amount to be deposited by depositor. */ amount: Coin[]; } export interface DepositProtoMsg { @@ -180,9 +187,12 @@ export interface DepositProtoMsg { * proposal. */ export interface DepositAmino { + /** proposal_id defines the unique id of the proposal. */ proposal_id?: string; + /** depositor defines the deposit addresses from the proposals. */ depositor?: string; - amount?: CoinAmino[]; + /** amount to be deposited by depositor. */ + amount: CoinAmino[]; } export interface DepositAminoMsg { type: "cosmos-sdk/v1/Deposit"; @@ -199,8 +209,11 @@ export interface DepositSDKType { } /** Proposal defines the core field members of a governance proposal. */ export interface Proposal { + /** id defines the unique id of the proposal. */ id: bigint; + /** messages are the arbitrary messages to be executed if the proposal passes. */ messages: Any[]; + /** status defines the proposal status. */ status: ProposalStatus; /** * final_tally_result is the final tally result of the proposal. When @@ -208,13 +221,32 @@ export interface Proposal { * proposal's voting period has ended. */ finalTallyResult?: TallyResult; + /** submit_time is the time of proposal submission. */ submitTime?: Date; + /** deposit_end_time is the end time for deposition. */ depositEndTime?: Date; + /** total_deposit is the total deposit on the proposal. */ totalDeposit: Coin[]; + /** voting_start_time is the starting time to vote on a proposal. */ votingStartTime?: Date; + /** voting_end_time is the end time of voting on a proposal. */ votingEndTime?: Date; - /** metadata is any arbitrary metadata attached to the proposal. */ + /** + * metadata is any arbitrary metadata attached to the proposal. + * the recommended format of the metadata is to be found here: + * https://docs.cosmos.network/v0.47/modules/gov#proposal-3 + */ metadata: string; + /** title is the title of the proposal */ + title: string; + /** summary is a short summary of the proposal */ + summary: string; + /** proposer is the address of the proposal sumbitter */ + proposer: string; + /** expedited defines if the proposal is expedited */ + expedited: boolean; + /** failed_reason defines the reason why the proposal failed */ + failedReason: string; } export interface ProposalProtoMsg { typeUrl: "/cosmos.gov.v1.Proposal"; @@ -222,8 +254,11 @@ export interface ProposalProtoMsg { } /** Proposal defines the core field members of a governance proposal. */ export interface ProposalAmino { + /** id defines the unique id of the proposal. */ id?: string; + /** messages are the arbitrary messages to be executed if the proposal passes. */ messages?: AnyAmino[]; + /** status defines the proposal status. */ status?: ProposalStatus; /** * final_tally_result is the final tally result of the proposal. When @@ -231,13 +266,32 @@ export interface ProposalAmino { * proposal's voting period has ended. */ final_tally_result?: TallyResultAmino; + /** submit_time is the time of proposal submission. */ submit_time?: string; + /** deposit_end_time is the end time for deposition. */ deposit_end_time?: string; - total_deposit?: CoinAmino[]; + /** total_deposit is the total deposit on the proposal. */ + total_deposit: CoinAmino[]; + /** voting_start_time is the starting time to vote on a proposal. */ voting_start_time?: string; + /** voting_end_time is the end time of voting on a proposal. */ voting_end_time?: string; - /** metadata is any arbitrary metadata attached to the proposal. */ + /** + * metadata is any arbitrary metadata attached to the proposal. + * the recommended format of the metadata is to be found here: + * https://docs.cosmos.network/v0.47/modules/gov#proposal-3 + */ metadata?: string; + /** title is the title of the proposal */ + title?: string; + /** summary is a short summary of the proposal */ + summary?: string; + /** proposer is the address of the proposal sumbitter */ + proposer?: string; + /** expedited defines if the proposal is expedited */ + expedited?: boolean; + /** failed_reason defines the reason why the proposal failed */ + failed_reason?: string; } export interface ProposalAminoMsg { type: "cosmos-sdk/v1/Proposal"; @@ -255,12 +309,21 @@ export interface ProposalSDKType { voting_start_time?: Date; voting_end_time?: Date; metadata: string; + title: string; + summary: string; + proposer: string; + expedited: boolean; + failed_reason: string; } /** TallyResult defines a standard tally for a governance proposal. */ export interface TallyResult { + /** yes_count is the number of yes votes on a proposal. */ yesCount: string; + /** abstain_count is the number of abstain votes on a proposal. */ abstainCount: string; + /** no_count is the number of no votes on a proposal. */ noCount: string; + /** no_with_veto_count is the number of no with veto votes on a proposal. */ noWithVetoCount: string; } export interface TallyResultProtoMsg { @@ -269,9 +332,13 @@ export interface TallyResultProtoMsg { } /** TallyResult defines a standard tally for a governance proposal. */ export interface TallyResultAmino { + /** yes_count is the number of yes votes on a proposal. */ yes_count?: string; + /** abstain_count is the number of abstain votes on a proposal. */ abstain_count?: string; + /** no_count is the number of no votes on a proposal. */ no_count?: string; + /** no_with_veto_count is the number of no with veto votes on a proposal. */ no_with_veto_count?: string; } export interface TallyResultAminoMsg { @@ -290,10 +357,16 @@ export interface TallyResultSDKType { * A Vote consists of a proposal ID, the voter, and the vote option. */ export interface Vote { + /** proposal_id defines the unique id of the proposal. */ proposalId: bigint; + /** voter is the voter address of the proposal. */ voter: string; + /** options is the weighted vote options. */ options: WeightedVoteOption[]; - /** metadata is any arbitrary metadata to attached to the vote. */ + /** + * metadata is any arbitrary metadata attached to the vote. + * the recommended format of the metadata is to be found here: https://docs.cosmos.network/v0.47/modules/gov#vote-5 + */ metadata: string; } export interface VoteProtoMsg { @@ -305,10 +378,16 @@ export interface VoteProtoMsg { * A Vote consists of a proposal ID, the voter, and the vote option. */ export interface VoteAmino { + /** proposal_id defines the unique id of the proposal. */ proposal_id?: string; + /** voter is the voter address of the proposal. */ voter?: string; + /** options is the weighted vote options. */ options?: WeightedVoteOptionAmino[]; - /** metadata is any arbitrary metadata to attached to the vote. */ + /** + * metadata is any arbitrary metadata attached to the vote. + * the recommended format of the metadata is to be found here: https://docs.cosmos.network/v0.47/modules/gov#vote-5 + */ metadata?: string; } export interface VoteAminoMsg { @@ -326,12 +405,13 @@ export interface VoteSDKType { metadata: string; } /** DepositParams defines the params for deposits on governance proposals. */ +/** @deprecated */ export interface DepositParams { /** Minimum deposit for a proposal to enter voting period. */ minDeposit: Coin[]; /** * Maximum period for Atom holders to deposit on a proposal. Initial value: 2 - * months. + * months. */ maxDepositPeriod?: Duration; } @@ -340,12 +420,13 @@ export interface DepositParamsProtoMsg { value: Uint8Array; } /** DepositParams defines the params for deposits on governance proposals. */ +/** @deprecated */ export interface DepositParamsAmino { /** Minimum deposit for a proposal to enter voting period. */ min_deposit?: CoinAmino[]; /** * Maximum period for Atom holders to deposit on a proposal. Initial value: 2 - * months. + * months. */ max_deposit_period?: DurationAmino; } @@ -354,13 +435,15 @@ export interface DepositParamsAminoMsg { value: DepositParamsAmino; } /** DepositParams defines the params for deposits on governance proposals. */ +/** @deprecated */ export interface DepositParamsSDKType { min_deposit: CoinSDKType[]; max_deposit_period?: DurationSDKType; } /** VotingParams defines the params for voting on governance proposals. */ +/** @deprecated */ export interface VotingParams { - /** Length of the voting period. */ + /** Duration of the voting period. */ votingPeriod?: Duration; } export interface VotingParamsProtoMsg { @@ -368,8 +451,9 @@ export interface VotingParamsProtoMsg { value: Uint8Array; } /** VotingParams defines the params for voting on governance proposals. */ +/** @deprecated */ export interface VotingParamsAmino { - /** Length of the voting period. */ + /** Duration of the voting period. */ voting_period?: DurationAmino; } export interface VotingParamsAminoMsg { @@ -377,21 +461,23 @@ export interface VotingParamsAminoMsg { value: VotingParamsAmino; } /** VotingParams defines the params for voting on governance proposals. */ +/** @deprecated */ export interface VotingParamsSDKType { voting_period?: DurationSDKType; } /** TallyParams defines the params for tallying votes on governance proposals. */ +/** @deprecated */ export interface TallyParams { /** * Minimum percentage of total stake needed to vote for a result to be - * considered valid. + * considered valid. */ quorum: string; /** Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. */ threshold: string; /** * Minimum value of Veto votes to Total votes ratio for proposal to be - * vetoed. Default value: 1/3. + * vetoed. Default value: 1/3. */ vetoThreshold: string; } @@ -400,17 +486,18 @@ export interface TallyParamsProtoMsg { value: Uint8Array; } /** TallyParams defines the params for tallying votes on governance proposals. */ +/** @deprecated */ export interface TallyParamsAmino { /** * Minimum percentage of total stake needed to vote for a result to be - * considered valid. + * considered valid. */ quorum?: string; /** Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. */ threshold?: string; /** * Minimum value of Veto votes to Total votes ratio for proposal to be - * vetoed. Default value: 1/3. + * vetoed. Default value: 1/3. */ veto_threshold?: string; } @@ -419,11 +506,141 @@ export interface TallyParamsAminoMsg { value: TallyParamsAmino; } /** TallyParams defines the params for tallying votes on governance proposals. */ +/** @deprecated */ export interface TallyParamsSDKType { quorum: string; threshold: string; veto_threshold: string; } +/** Params defines the parameters for the x/gov module. */ +export interface Params { + /** Minimum deposit for a proposal to enter voting period. */ + minDeposit: Coin[]; + /** + * Maximum period for Atom holders to deposit on a proposal. Initial value: 2 + * months. + */ + maxDepositPeriod?: Duration; + /** Duration of the voting period. */ + votingPeriod?: Duration; + /** + * Minimum percentage of total stake needed to vote for a result to be + * considered valid. + */ + quorum: string; + /** Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. */ + threshold: string; + /** + * Minimum value of Veto votes to Total votes ratio for proposal to be + * vetoed. Default value: 1/3. + */ + vetoThreshold: string; + /** The ratio representing the proportion of the deposit value that must be paid at proposal submission. */ + minInitialDepositRatio: string; + /** The cancel ratio which will not be returned back to the depositors when a proposal is cancelled. */ + proposalCancelRatio: string; + /** + * The address which will receive (proposal_cancel_ratio * deposit) proposal deposits. + * If empty, the (proposal_cancel_ratio * deposit) proposal deposits will be burned. + */ + proposalCancelDest: string; + /** Duration of the voting period of an expedited proposal. */ + expeditedVotingPeriod?: Duration; + /** Minimum proportion of Yes votes for proposal to pass. Default value: 0.67. */ + expeditedThreshold: string; + /** Minimum expedited deposit for a proposal to enter voting period. */ + expeditedMinDeposit: Coin[]; + /** burn deposits if a proposal does not meet quorum */ + burnVoteQuorum: boolean; + /** burn deposits if the proposal does not enter voting period */ + burnProposalDepositPrevote: boolean; + /** burn deposits if quorum with vote type no_veto is met */ + burnVoteVeto: boolean; + /** + * The ratio representing the proportion of the deposit value minimum that must be met when making a deposit. + * Default value: 0.01. Meaning that for a chain with a min_deposit of 100stake, a deposit of 1stake would be + * required. + */ + minDepositRatio: string; +} +export interface ParamsProtoMsg { + typeUrl: "/cosmos.gov.v1.Params"; + value: Uint8Array; +} +/** Params defines the parameters for the x/gov module. */ +export interface ParamsAmino { + /** Minimum deposit for a proposal to enter voting period. */ + min_deposit: CoinAmino[]; + /** + * Maximum period for Atom holders to deposit on a proposal. Initial value: 2 + * months. + */ + max_deposit_period?: DurationAmino; + /** Duration of the voting period. */ + voting_period?: DurationAmino; + /** + * Minimum percentage of total stake needed to vote for a result to be + * considered valid. + */ + quorum?: string; + /** Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. */ + threshold?: string; + /** + * Minimum value of Veto votes to Total votes ratio for proposal to be + * vetoed. Default value: 1/3. + */ + veto_threshold?: string; + /** The ratio representing the proportion of the deposit value that must be paid at proposal submission. */ + min_initial_deposit_ratio?: string; + /** The cancel ratio which will not be returned back to the depositors when a proposal is cancelled. */ + proposal_cancel_ratio?: string; + /** + * The address which will receive (proposal_cancel_ratio * deposit) proposal deposits. + * If empty, the (proposal_cancel_ratio * deposit) proposal deposits will be burned. + */ + proposal_cancel_dest?: string; + /** Duration of the voting period of an expedited proposal. */ + expedited_voting_period?: DurationAmino; + /** Minimum proportion of Yes votes for proposal to pass. Default value: 0.67. */ + expedited_threshold?: string; + /** Minimum expedited deposit for a proposal to enter voting period. */ + expedited_min_deposit: CoinAmino[]; + /** burn deposits if a proposal does not meet quorum */ + burn_vote_quorum?: boolean; + /** burn deposits if the proposal does not enter voting period */ + burn_proposal_deposit_prevote?: boolean; + /** burn deposits if quorum with vote type no_veto is met */ + burn_vote_veto?: boolean; + /** + * The ratio representing the proportion of the deposit value minimum that must be met when making a deposit. + * Default value: 0.01. Meaning that for a chain with a min_deposit of 100stake, a deposit of 1stake would be + * required. + */ + min_deposit_ratio?: string; +} +export interface ParamsAminoMsg { + type: "cosmos-sdk/v1/Params"; + value: ParamsAmino; +} +/** Params defines the parameters for the x/gov module. */ +export interface ParamsSDKType { + min_deposit: CoinSDKType[]; + max_deposit_period?: DurationSDKType; + voting_period?: DurationSDKType; + quorum: string; + threshold: string; + veto_threshold: string; + min_initial_deposit_ratio: string; + proposal_cancel_ratio: string; + proposal_cancel_dest: string; + expedited_voting_period?: DurationSDKType; + expedited_threshold: string; + expedited_min_deposit: CoinSDKType[]; + burn_vote_quorum: boolean; + burn_proposal_deposit_prevote: boolean; + burn_vote_veto: boolean; + min_deposit_ratio: string; +} function createBaseWeightedVoteOption(): WeightedVoteOption { return { option: 0, @@ -611,7 +828,12 @@ function createBaseProposal(): Proposal { totalDeposit: [], votingStartTime: undefined, votingEndTime: undefined, - metadata: "" + metadata: "", + title: "", + summary: "", + proposer: "", + expedited: false, + failedReason: "" }; } export const Proposal = { @@ -647,6 +869,21 @@ export const Proposal = { if (message.metadata !== "") { writer.uint32(82).string(message.metadata); } + if (message.title !== "") { + writer.uint32(90).string(message.title); + } + if (message.summary !== "") { + writer.uint32(98).string(message.summary); + } + if (message.proposer !== "") { + writer.uint32(106).string(message.proposer); + } + if (message.expedited === true) { + writer.uint32(112).bool(message.expedited); + } + if (message.failedReason !== "") { + writer.uint32(122).string(message.failedReason); + } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): Proposal { @@ -686,6 +923,21 @@ export const Proposal = { case 10: message.metadata = reader.string(); break; + case 11: + message.title = reader.string(); + break; + case 12: + message.summary = reader.string(); + break; + case 13: + message.proposer = reader.string(); + break; + case 14: + message.expedited = reader.bool(); + break; + case 15: + message.failedReason = reader.string(); + break; default: reader.skipType(tag & 7); break; @@ -705,6 +957,11 @@ export const Proposal = { message.votingStartTime = object.votingStartTime ?? undefined; message.votingEndTime = object.votingEndTime ?? undefined; message.metadata = object.metadata ?? ""; + message.title = object.title ?? ""; + message.summary = object.summary ?? ""; + message.proposer = object.proposer ?? ""; + message.expedited = object.expedited ?? false; + message.failedReason = object.failedReason ?? ""; return message; }, fromAmino(object: ProposalAmino): Proposal { @@ -735,6 +992,21 @@ export const Proposal = { if (object.metadata !== undefined && object.metadata !== null) { message.metadata = object.metadata; } + if (object.title !== undefined && object.title !== null) { + message.title = object.title; + } + if (object.summary !== undefined && object.summary !== null) { + message.summary = object.summary; + } + if (object.proposer !== undefined && object.proposer !== null) { + message.proposer = object.proposer; + } + if (object.expedited !== undefined && object.expedited !== null) { + message.expedited = object.expedited; + } + if (object.failed_reason !== undefined && object.failed_reason !== null) { + message.failedReason = object.failed_reason; + } return message; }, toAmino(message: Proposal): ProposalAmino { @@ -757,6 +1029,11 @@ export const Proposal = { obj.voting_start_time = message.votingStartTime ? Timestamp.toAmino(toTimestamp(message.votingStartTime)) : undefined; obj.voting_end_time = message.votingEndTime ? Timestamp.toAmino(toTimestamp(message.votingEndTime)) : undefined; obj.metadata = message.metadata === "" ? undefined : message.metadata; + obj.title = message.title === "" ? undefined : message.title; + obj.summary = message.summary === "" ? undefined : message.summary; + obj.proposer = message.proposer === "" ? undefined : message.proposer; + obj.expedited = message.expedited === false ? undefined : message.expedited; + obj.failed_reason = message.failedReason === "" ? undefined : message.failedReason; return obj; }, fromAminoMsg(object: ProposalAminoMsg): Proposal { @@ -1237,4 +1514,257 @@ export const TallyParams = { value: TallyParams.encode(message).finish() }; } +}; +function createBaseParams(): Params { + return { + minDeposit: [], + maxDepositPeriod: undefined, + votingPeriod: undefined, + quorum: "", + threshold: "", + vetoThreshold: "", + minInitialDepositRatio: "", + proposalCancelRatio: "", + proposalCancelDest: "", + expeditedVotingPeriod: undefined, + expeditedThreshold: "", + expeditedMinDeposit: [], + burnVoteQuorum: false, + burnProposalDepositPrevote: false, + burnVoteVeto: false, + minDepositRatio: "" + }; +} +export const Params = { + typeUrl: "/cosmos.gov.v1.Params", + encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.minDeposit) { + Coin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.maxDepositPeriod !== undefined) { + Duration.encode(message.maxDepositPeriod, writer.uint32(18).fork()).ldelim(); + } + if (message.votingPeriod !== undefined) { + Duration.encode(message.votingPeriod, writer.uint32(26).fork()).ldelim(); + } + if (message.quorum !== "") { + writer.uint32(34).string(message.quorum); + } + if (message.threshold !== "") { + writer.uint32(42).string(message.threshold); + } + if (message.vetoThreshold !== "") { + writer.uint32(50).string(message.vetoThreshold); + } + if (message.minInitialDepositRatio !== "") { + writer.uint32(58).string(message.minInitialDepositRatio); + } + if (message.proposalCancelRatio !== "") { + writer.uint32(66).string(message.proposalCancelRatio); + } + if (message.proposalCancelDest !== "") { + writer.uint32(74).string(message.proposalCancelDest); + } + if (message.expeditedVotingPeriod !== undefined) { + Duration.encode(message.expeditedVotingPeriod, writer.uint32(82).fork()).ldelim(); + } + if (message.expeditedThreshold !== "") { + writer.uint32(90).string(message.expeditedThreshold); + } + for (const v of message.expeditedMinDeposit) { + Coin.encode(v!, writer.uint32(98).fork()).ldelim(); + } + if (message.burnVoteQuorum === true) { + writer.uint32(104).bool(message.burnVoteQuorum); + } + if (message.burnProposalDepositPrevote === true) { + writer.uint32(112).bool(message.burnProposalDepositPrevote); + } + if (message.burnVoteVeto === true) { + writer.uint32(120).bool(message.burnVoteVeto); + } + if (message.minDepositRatio !== "") { + writer.uint32(130).string(message.minDepositRatio); + } + 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.minDeposit.push(Coin.decode(reader, reader.uint32())); + break; + case 2: + message.maxDepositPeriod = Duration.decode(reader, reader.uint32()); + break; + case 3: + message.votingPeriod = Duration.decode(reader, reader.uint32()); + break; + case 4: + message.quorum = reader.string(); + break; + case 5: + message.threshold = reader.string(); + break; + case 6: + message.vetoThreshold = reader.string(); + break; + case 7: + message.minInitialDepositRatio = reader.string(); + break; + case 8: + message.proposalCancelRatio = reader.string(); + break; + case 9: + message.proposalCancelDest = reader.string(); + break; + case 10: + message.expeditedVotingPeriod = Duration.decode(reader, reader.uint32()); + break; + case 11: + message.expeditedThreshold = reader.string(); + break; + case 12: + message.expeditedMinDeposit.push(Coin.decode(reader, reader.uint32())); + break; + case 13: + message.burnVoteQuorum = reader.bool(); + break; + case 14: + message.burnProposalDepositPrevote = reader.bool(); + break; + case 15: + message.burnVoteVeto = reader.bool(); + break; + case 16: + message.minDepositRatio = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): Params { + const message = createBaseParams(); + message.minDeposit = object.minDeposit?.map(e => Coin.fromPartial(e)) || []; + message.maxDepositPeriod = object.maxDepositPeriod !== undefined && object.maxDepositPeriod !== null ? Duration.fromPartial(object.maxDepositPeriod) : undefined; + message.votingPeriod = object.votingPeriod !== undefined && object.votingPeriod !== null ? Duration.fromPartial(object.votingPeriod) : undefined; + message.quorum = object.quorum ?? ""; + message.threshold = object.threshold ?? ""; + message.vetoThreshold = object.vetoThreshold ?? ""; + message.minInitialDepositRatio = object.minInitialDepositRatio ?? ""; + message.proposalCancelRatio = object.proposalCancelRatio ?? ""; + message.proposalCancelDest = object.proposalCancelDest ?? ""; + message.expeditedVotingPeriod = object.expeditedVotingPeriod !== undefined && object.expeditedVotingPeriod !== null ? Duration.fromPartial(object.expeditedVotingPeriod) : undefined; + message.expeditedThreshold = object.expeditedThreshold ?? ""; + message.expeditedMinDeposit = object.expeditedMinDeposit?.map(e => Coin.fromPartial(e)) || []; + message.burnVoteQuorum = object.burnVoteQuorum ?? false; + message.burnProposalDepositPrevote = object.burnProposalDepositPrevote ?? false; + message.burnVoteVeto = object.burnVoteVeto ?? false; + message.minDepositRatio = object.minDepositRatio ?? ""; + return message; + }, + fromAmino(object: ParamsAmino): Params { + const message = createBaseParams(); + message.minDeposit = object.min_deposit?.map(e => Coin.fromAmino(e)) || []; + if (object.max_deposit_period !== undefined && object.max_deposit_period !== null) { + message.maxDepositPeriod = Duration.fromAmino(object.max_deposit_period); + } + if (object.voting_period !== undefined && object.voting_period !== null) { + message.votingPeriod = Duration.fromAmino(object.voting_period); + } + if (object.quorum !== undefined && object.quorum !== null) { + message.quorum = object.quorum; + } + if (object.threshold !== undefined && object.threshold !== null) { + message.threshold = object.threshold; + } + if (object.veto_threshold !== undefined && object.veto_threshold !== null) { + message.vetoThreshold = object.veto_threshold; + } + if (object.min_initial_deposit_ratio !== undefined && object.min_initial_deposit_ratio !== null) { + message.minInitialDepositRatio = object.min_initial_deposit_ratio; + } + if (object.proposal_cancel_ratio !== undefined && object.proposal_cancel_ratio !== null) { + message.proposalCancelRatio = object.proposal_cancel_ratio; + } + if (object.proposal_cancel_dest !== undefined && object.proposal_cancel_dest !== null) { + message.proposalCancelDest = object.proposal_cancel_dest; + } + if (object.expedited_voting_period !== undefined && object.expedited_voting_period !== null) { + message.expeditedVotingPeriod = Duration.fromAmino(object.expedited_voting_period); + } + if (object.expedited_threshold !== undefined && object.expedited_threshold !== null) { + message.expeditedThreshold = object.expedited_threshold; + } + message.expeditedMinDeposit = object.expedited_min_deposit?.map(e => Coin.fromAmino(e)) || []; + if (object.burn_vote_quorum !== undefined && object.burn_vote_quorum !== null) { + message.burnVoteQuorum = object.burn_vote_quorum; + } + if (object.burn_proposal_deposit_prevote !== undefined && object.burn_proposal_deposit_prevote !== null) { + message.burnProposalDepositPrevote = object.burn_proposal_deposit_prevote; + } + if (object.burn_vote_veto !== undefined && object.burn_vote_veto !== null) { + message.burnVoteVeto = object.burn_vote_veto; + } + if (object.min_deposit_ratio !== undefined && object.min_deposit_ratio !== null) { + message.minDepositRatio = object.min_deposit_ratio; + } + return message; + }, + toAmino(message: Params): ParamsAmino { + const obj: any = {}; + if (message.minDeposit) { + obj.min_deposit = message.minDeposit.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.min_deposit = message.minDeposit; + } + obj.max_deposit_period = message.maxDepositPeriod ? Duration.toAmino(message.maxDepositPeriod) : undefined; + obj.voting_period = message.votingPeriod ? Duration.toAmino(message.votingPeriod) : undefined; + obj.quorum = message.quorum === "" ? undefined : message.quorum; + obj.threshold = message.threshold === "" ? undefined : message.threshold; + obj.veto_threshold = message.vetoThreshold === "" ? undefined : message.vetoThreshold; + obj.min_initial_deposit_ratio = message.minInitialDepositRatio === "" ? undefined : message.minInitialDepositRatio; + obj.proposal_cancel_ratio = message.proposalCancelRatio === "" ? undefined : message.proposalCancelRatio; + obj.proposal_cancel_dest = message.proposalCancelDest === "" ? undefined : message.proposalCancelDest; + obj.expedited_voting_period = message.expeditedVotingPeriod ? Duration.toAmino(message.expeditedVotingPeriod) : undefined; + obj.expedited_threshold = message.expeditedThreshold === "" ? undefined : message.expeditedThreshold; + if (message.expeditedMinDeposit) { + obj.expedited_min_deposit = message.expeditedMinDeposit.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.expedited_min_deposit = message.expeditedMinDeposit; + } + obj.burn_vote_quorum = message.burnVoteQuorum === false ? undefined : message.burnVoteQuorum; + obj.burn_proposal_deposit_prevote = message.burnProposalDepositPrevote === false ? undefined : message.burnProposalDepositPrevote; + obj.burn_vote_veto = message.burnVoteVeto === false ? undefined : message.burnVoteVeto; + obj.min_deposit_ratio = message.minDepositRatio === "" ? undefined : message.minDepositRatio; + return obj; + }, + fromAminoMsg(object: ParamsAminoMsg): Params { + return Params.fromAmino(object.value); + }, + toAminoMsg(message: Params): ParamsAminoMsg { + return { + type: "cosmos-sdk/v1/Params", + value: Params.toAmino(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: "/cosmos.gov.v1.Params", + value: Params.encode(message).finish() + }; + } }; \ No newline at end of file diff --git a/packages/api/src/cosmos/gov/v1/query.lcd.ts b/packages/api/src/cosmos/gov/v1/query.lcd.ts index d4e813ff..382192bd 100644 --- a/packages/api/src/cosmos/gov/v1/query.lcd.ts +++ b/packages/api/src/cosmos/gov/v1/query.lcd.ts @@ -1,7 +1,7 @@ //@ts-nocheck import { setPaginationParams } from "../../../helpers"; import { LCDClient } from "@cosmology/lcd"; -import { QueryProposalRequest, QueryProposalResponseSDKType, QueryProposalsRequest, QueryProposalsResponseSDKType, QueryVoteRequest, QueryVoteResponseSDKType, QueryVotesRequest, QueryVotesResponseSDKType, QueryParamsRequest, QueryParamsResponseSDKType, QueryDepositRequest, QueryDepositResponseSDKType, QueryDepositsRequest, QueryDepositsResponseSDKType, QueryTallyResultRequest, QueryTallyResultResponseSDKType } from "./query"; +import { QueryConstitutionRequest, QueryConstitutionResponseSDKType, QueryProposalRequest, QueryProposalResponseSDKType, QueryProposalsRequest, QueryProposalsResponseSDKType, QueryVoteRequest, QueryVoteResponseSDKType, QueryVotesRequest, QueryVotesResponseSDKType, QueryParamsRequest, QueryParamsResponseSDKType, QueryDepositRequest, QueryDepositResponseSDKType, QueryDepositsRequest, QueryDepositsResponseSDKType, QueryTallyResultRequest, QueryTallyResultResponseSDKType } from "./query"; export class LCDQueryClient { req: LCDClient; constructor({ @@ -10,6 +10,7 @@ export class LCDQueryClient { requestClient: LCDClient; }) { this.req = requestClient; + this.constitution = this.constitution.bind(this); this.proposal = this.proposal.bind(this); this.proposals = this.proposals.bind(this); this.vote = this.vote.bind(this); @@ -19,6 +20,11 @@ export class LCDQueryClient { this.deposits = this.deposits.bind(this); this.tallyResult = this.tallyResult.bind(this); } + /* Constitution queries the chain's constitution. */ + async constitution(_params: QueryConstitutionRequest = {}): Promise { + const endpoint = `cosmos/gov/v1/constitution`; + return await this.req.get(endpoint); + } /* Proposal queries proposal details based on ProposalID. */ async proposal(params: QueryProposalRequest): Promise { const endpoint = `cosmos/gov/v1/proposals/${params.proposalId}`; @@ -65,7 +71,7 @@ export class LCDQueryClient { const endpoint = `cosmos/gov/v1/params/${params.paramsType}`; return await this.req.get(endpoint); } - /* Deposit queries single deposit information based proposalID, depositAddr. */ + /* Deposit queries single deposit information based on proposalID, depositAddr. */ async deposit(params: QueryDepositRequest): Promise { const endpoint = `cosmos/gov/v1/proposals/${params.proposalId}/deposits/${params.depositor}`; return await this.req.get(endpoint); diff --git a/packages/api/src/cosmos/gov/v1/query.rpc.Query.ts b/packages/api/src/cosmos/gov/v1/query.rpc.Query.ts index 9ed348ce..479bcac0 100644 --- a/packages/api/src/cosmos/gov/v1/query.rpc.Query.ts +++ b/packages/api/src/cosmos/gov/v1/query.rpc.Query.ts @@ -2,9 +2,11 @@ import { Rpc } from "../../../helpers"; import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryProposalRequest, QueryProposalResponse, QueryProposalsRequest, QueryProposalsResponse, QueryVoteRequest, QueryVoteResponse, QueryVotesRequest, QueryVotesResponse, QueryParamsRequest, QueryParamsResponse, QueryDepositRequest, QueryDepositResponse, QueryDepositsRequest, QueryDepositsResponse, QueryTallyResultRequest, QueryTallyResultResponse } from "./query"; +import { QueryConstitutionRequest, QueryConstitutionResponse, QueryProposalRequest, QueryProposalResponse, QueryProposalsRequest, QueryProposalsResponse, QueryVoteRequest, QueryVoteResponse, QueryVotesRequest, QueryVotesResponse, QueryParamsRequest, QueryParamsResponse, QueryDepositRequest, QueryDepositResponse, QueryDepositsRequest, QueryDepositsResponse, QueryTallyResultRequest, QueryTallyResultResponse } from "./query"; /** Query defines the gRPC querier service for gov module */ export interface Query { + /** Constitution queries the chain's constitution. */ + constitution(request?: QueryConstitutionRequest): Promise; /** Proposal queries proposal details based on ProposalID. */ proposal(request: QueryProposalRequest): Promise; /** Proposals queries all proposals based on given status. */ @@ -15,7 +17,7 @@ export interface Query { votes(request: QueryVotesRequest): Promise; /** Params queries all parameters of the gov module. */ params(request: QueryParamsRequest): Promise; - /** Deposit queries single deposit information based proposalID, depositAddr. */ + /** Deposit queries single deposit information based on proposalID, depositAddr. */ deposit(request: QueryDepositRequest): Promise; /** Deposits queries all deposits of a single proposal. */ deposits(request: QueryDepositsRequest): Promise; @@ -26,6 +28,7 @@ export class QueryClientImpl implements Query { private readonly rpc: Rpc; constructor(rpc: Rpc) { this.rpc = rpc; + this.constitution = this.constitution.bind(this); this.proposal = this.proposal.bind(this); this.proposals = this.proposals.bind(this); this.vote = this.vote.bind(this); @@ -35,6 +38,11 @@ export class QueryClientImpl implements Query { this.deposits = this.deposits.bind(this); this.tallyResult = this.tallyResult.bind(this); } + constitution(request: QueryConstitutionRequest = {}): Promise { + const data = QueryConstitutionRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.gov.v1.Query", "Constitution", data); + return promise.then(data => QueryConstitutionResponse.decode(new BinaryReader(data))); + } proposal(request: QueryProposalRequest): Promise { const data = QueryProposalRequest.encode(request).finish(); const promise = this.rpc.request("cosmos.gov.v1.Query", "Proposal", data); @@ -80,6 +88,9 @@ export const createRpcQueryExtension = (base: QueryClient) => { const rpc = createProtobufRpcClient(base); const queryService = new QueryClientImpl(rpc); return { + constitution(request?: QueryConstitutionRequest): Promise { + return queryService.constitution(request); + }, proposal(request: QueryProposalRequest): Promise { return queryService.proposal(request); }, diff --git a/packages/api/src/cosmos/gov/v1/query.ts b/packages/api/src/cosmos/gov/v1/query.ts index 7f0d799c..8766de1d 100644 --- a/packages/api/src/cosmos/gov/v1/query.ts +++ b/packages/api/src/cosmos/gov/v1/query.ts @@ -1,7 +1,41 @@ //@ts-nocheck -import { ProposalStatus, Proposal, ProposalAmino, ProposalSDKType, Vote, VoteAmino, VoteSDKType, VotingParams, VotingParamsAmino, VotingParamsSDKType, DepositParams, DepositParamsAmino, DepositParamsSDKType, TallyParams, TallyParamsAmino, TallyParamsSDKType, Deposit, DepositAmino, DepositSDKType, TallyResult, TallyResultAmino, TallyResultSDKType } from "./gov"; +import { ProposalStatus, Proposal, ProposalAmino, ProposalSDKType, Vote, VoteAmino, VoteSDKType, VotingParams, VotingParamsAmino, VotingParamsSDKType, DepositParams, DepositParamsAmino, DepositParamsSDKType, TallyParams, TallyParamsAmino, TallyParamsSDKType, Params, ParamsAmino, ParamsSDKType, Deposit, DepositAmino, DepositSDKType, TallyResult, TallyResultAmino, TallyResultSDKType } from "./gov"; import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { BinaryReader, BinaryWriter } from "../../../binary"; +/** QueryConstitutionRequest is the request type for the Query/Constitution RPC method */ +export interface QueryConstitutionRequest {} +export interface QueryConstitutionRequestProtoMsg { + typeUrl: "/cosmos.gov.v1.QueryConstitutionRequest"; + value: Uint8Array; +} +/** QueryConstitutionRequest is the request type for the Query/Constitution RPC method */ +export interface QueryConstitutionRequestAmino {} +export interface QueryConstitutionRequestAminoMsg { + type: "cosmos-sdk/v1/QueryConstitutionRequest"; + value: QueryConstitutionRequestAmino; +} +/** QueryConstitutionRequest is the request type for the Query/Constitution RPC method */ +export interface QueryConstitutionRequestSDKType {} +/** QueryConstitutionResponse is the response type for the Query/Constitution RPC method */ +export interface QueryConstitutionResponse { + constitution: string; +} +export interface QueryConstitutionResponseProtoMsg { + typeUrl: "/cosmos.gov.v1.QueryConstitutionResponse"; + value: Uint8Array; +} +/** QueryConstitutionResponse is the response type for the Query/Constitution RPC method */ +export interface QueryConstitutionResponseAmino { + constitution?: string; +} +export interface QueryConstitutionResponseAminoMsg { + type: "cosmos-sdk/v1/QueryConstitutionResponse"; + value: QueryConstitutionResponseAmino; +} +/** QueryConstitutionResponse is the response type for the Query/Constitution RPC method */ +export interface QueryConstitutionResponseSDKType { + constitution: string; +} /** QueryProposalRequest is the request type for the Query/Proposal RPC method. */ export interface QueryProposalRequest { /** proposal_id defines the unique id of the proposal. */ @@ -26,6 +60,7 @@ export interface QueryProposalRequestSDKType { } /** QueryProposalResponse is the response type for the Query/Proposal RPC method. */ export interface QueryProposalResponse { + /** proposal is the requested governance proposal. */ proposal?: Proposal; } export interface QueryProposalResponseProtoMsg { @@ -34,6 +69,7 @@ export interface QueryProposalResponseProtoMsg { } /** QueryProposalResponse is the response type for the Query/Proposal RPC method. */ export interface QueryProposalResponseAmino { + /** proposal is the requested governance proposal. */ proposal?: ProposalAmino; } export interface QueryProposalResponseAminoMsg { @@ -86,6 +122,7 @@ export interface QueryProposalsRequestSDKType { * method. */ export interface QueryProposalsResponse { + /** proposals defines all the requested governance proposals. */ proposals: Proposal[]; /** pagination defines the pagination in the response. */ pagination?: PageResponse; @@ -99,6 +136,7 @@ export interface QueryProposalsResponseProtoMsg { * method. */ export interface QueryProposalsResponseAmino { + /** proposals defines all the requested governance proposals. */ proposals?: ProposalAmino[]; /** pagination defines the pagination in the response. */ pagination?: PageResponseAmino; @@ -144,7 +182,7 @@ export interface QueryVoteRequestSDKType { } /** QueryVoteResponse is the response type for the Query/Vote RPC method. */ export interface QueryVoteResponse { - /** vote defined the queried vote. */ + /** vote defines the queried vote. */ vote?: Vote; } export interface QueryVoteResponseProtoMsg { @@ -153,7 +191,7 @@ export interface QueryVoteResponseProtoMsg { } /** QueryVoteResponse is the response type for the Query/Vote RPC method. */ export interface QueryVoteResponseAmino { - /** vote defined the queried vote. */ + /** vote defines the queried vote. */ vote?: VoteAmino; } export interface QueryVoteResponseAminoMsg { @@ -193,7 +231,7 @@ export interface QueryVotesRequestSDKType { } /** QueryVotesResponse is the response type for the Query/Votes RPC method. */ export interface QueryVotesResponse { - /** votes defined the queried votes. */ + /** votes defines the queried votes. */ votes: Vote[]; /** pagination defines the pagination in the response. */ pagination?: PageResponse; @@ -204,7 +242,7 @@ export interface QueryVotesResponseProtoMsg { } /** QueryVotesResponse is the response type for the Query/Votes RPC method. */ export interface QueryVotesResponseAmino { - /** votes defined the queried votes. */ + /** votes defines the queried votes. */ votes?: VoteAmino[]; /** pagination defines the pagination in the response. */ pagination?: PageResponseAmino; @@ -248,12 +286,26 @@ export interface QueryParamsRequestSDKType { } /** QueryParamsResponse is the response type for the Query/Params RPC method. */ export interface QueryParamsResponse { - /** voting_params defines the parameters related to voting. */ + /** + * Deprecated: Prefer to use `params` instead. + * voting_params defines the parameters related to voting. + */ + /** @deprecated */ votingParams?: VotingParams; - /** deposit_params defines the parameters related to deposit. */ + /** + * Deprecated: Prefer to use `params` instead. + * deposit_params defines the parameters related to deposit. + */ + /** @deprecated */ depositParams?: DepositParams; - /** tally_params defines the parameters related to tally. */ + /** + * Deprecated: Prefer to use `params` instead. + * tally_params defines the parameters related to tally. + */ + /** @deprecated */ tallyParams?: TallyParams; + /** params defines all the paramaters of x/gov module. */ + params?: Params; } export interface QueryParamsResponseProtoMsg { typeUrl: "/cosmos.gov.v1.QueryParamsResponse"; @@ -261,12 +313,26 @@ export interface QueryParamsResponseProtoMsg { } /** QueryParamsResponse is the response type for the Query/Params RPC method. */ export interface QueryParamsResponseAmino { - /** voting_params defines the parameters related to voting. */ + /** + * Deprecated: Prefer to use `params` instead. + * voting_params defines the parameters related to voting. + */ + /** @deprecated */ voting_params?: VotingParamsAmino; - /** deposit_params defines the parameters related to deposit. */ + /** + * Deprecated: Prefer to use `params` instead. + * deposit_params defines the parameters related to deposit. + */ + /** @deprecated */ deposit_params?: DepositParamsAmino; - /** tally_params defines the parameters related to tally. */ + /** + * Deprecated: Prefer to use `params` instead. + * tally_params defines the parameters related to tally. + */ + /** @deprecated */ tally_params?: TallyParamsAmino; + /** params defines all the paramaters of x/gov module. */ + params?: ParamsAmino; } export interface QueryParamsResponseAminoMsg { type: "cosmos-sdk/v1/QueryParamsResponse"; @@ -274,9 +340,13 @@ export interface QueryParamsResponseAminoMsg { } /** QueryParamsResponse is the response type for the Query/Params RPC method. */ export interface QueryParamsResponseSDKType { + /** @deprecated */ voting_params?: VotingParamsSDKType; + /** @deprecated */ deposit_params?: DepositParamsSDKType; + /** @deprecated */ tally_params?: TallyParamsSDKType; + params?: ParamsSDKType; } /** QueryDepositRequest is the request type for the Query/Deposit RPC method. */ export interface QueryDepositRequest { @@ -356,6 +426,7 @@ export interface QueryDepositsRequestSDKType { } /** QueryDepositsResponse is the response type for the Query/Deposits RPC method. */ export interface QueryDepositsResponse { + /** deposits defines the requested deposits. */ deposits: Deposit[]; /** pagination defines the pagination in the response. */ pagination?: PageResponse; @@ -366,6 +437,7 @@ export interface QueryDepositsResponseProtoMsg { } /** QueryDepositsResponse is the response type for the Query/Deposits RPC method. */ export interface QueryDepositsResponseAmino { + /** deposits defines the requested deposits. */ deposits?: DepositAmino[]; /** pagination defines the pagination in the response. */ pagination?: PageResponseAmino; @@ -423,6 +495,131 @@ export interface QueryTallyResultResponseAminoMsg { export interface QueryTallyResultResponseSDKType { tally?: TallyResultSDKType; } +function createBaseQueryConstitutionRequest(): QueryConstitutionRequest { + return {}; +} +export const QueryConstitutionRequest = { + typeUrl: "/cosmos.gov.v1.QueryConstitutionRequest", + encode(_: QueryConstitutionRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryConstitutionRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConstitutionRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): QueryConstitutionRequest { + const message = createBaseQueryConstitutionRequest(); + return message; + }, + fromAmino(_: QueryConstitutionRequestAmino): QueryConstitutionRequest { + const message = createBaseQueryConstitutionRequest(); + return message; + }, + toAmino(_: QueryConstitutionRequest): QueryConstitutionRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryConstitutionRequestAminoMsg): QueryConstitutionRequest { + return QueryConstitutionRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryConstitutionRequest): QueryConstitutionRequestAminoMsg { + return { + type: "cosmos-sdk/v1/QueryConstitutionRequest", + value: QueryConstitutionRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryConstitutionRequestProtoMsg): QueryConstitutionRequest { + return QueryConstitutionRequest.decode(message.value); + }, + toProto(message: QueryConstitutionRequest): Uint8Array { + return QueryConstitutionRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryConstitutionRequest): QueryConstitutionRequestProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.QueryConstitutionRequest", + value: QueryConstitutionRequest.encode(message).finish() + }; + } +}; +function createBaseQueryConstitutionResponse(): QueryConstitutionResponse { + return { + constitution: "" + }; +} +export const QueryConstitutionResponse = { + typeUrl: "/cosmos.gov.v1.QueryConstitutionResponse", + encode(message: QueryConstitutionResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.constitution !== "") { + writer.uint32(10).string(message.constitution); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryConstitutionResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConstitutionResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.constitution = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryConstitutionResponse { + const message = createBaseQueryConstitutionResponse(); + message.constitution = object.constitution ?? ""; + return message; + }, + fromAmino(object: QueryConstitutionResponseAmino): QueryConstitutionResponse { + const message = createBaseQueryConstitutionResponse(); + if (object.constitution !== undefined && object.constitution !== null) { + message.constitution = object.constitution; + } + return message; + }, + toAmino(message: QueryConstitutionResponse): QueryConstitutionResponseAmino { + const obj: any = {}; + obj.constitution = message.constitution === "" ? undefined : message.constitution; + return obj; + }, + fromAminoMsg(object: QueryConstitutionResponseAminoMsg): QueryConstitutionResponse { + return QueryConstitutionResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryConstitutionResponse): QueryConstitutionResponseAminoMsg { + return { + type: "cosmos-sdk/v1/QueryConstitutionResponse", + value: QueryConstitutionResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryConstitutionResponseProtoMsg): QueryConstitutionResponse { + return QueryConstitutionResponse.decode(message.value); + }, + toProto(message: QueryConstitutionResponse): Uint8Array { + return QueryConstitutionResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryConstitutionResponse): QueryConstitutionResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.QueryConstitutionResponse", + value: QueryConstitutionResponse.encode(message).finish() + }; + } +}; function createBaseQueryProposalRequest(): QueryProposalRequest { return { proposalId: BigInt(0) @@ -1136,7 +1333,8 @@ function createBaseQueryParamsResponse(): QueryParamsResponse { return { votingParams: undefined, depositParams: undefined, - tallyParams: undefined + tallyParams: undefined, + params: undefined }; } export const QueryParamsResponse = { @@ -1151,6 +1349,9 @@ export const QueryParamsResponse = { if (message.tallyParams !== undefined) { TallyParams.encode(message.tallyParams, writer.uint32(26).fork()).ldelim(); } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(34).fork()).ldelim(); + } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { @@ -1169,6 +1370,9 @@ export const QueryParamsResponse = { case 3: message.tallyParams = TallyParams.decode(reader, reader.uint32()); break; + case 4: + message.params = Params.decode(reader, reader.uint32()); + break; default: reader.skipType(tag & 7); break; @@ -1181,6 +1385,7 @@ export const QueryParamsResponse = { message.votingParams = object.votingParams !== undefined && object.votingParams !== null ? VotingParams.fromPartial(object.votingParams) : undefined; message.depositParams = object.depositParams !== undefined && object.depositParams !== null ? DepositParams.fromPartial(object.depositParams) : undefined; message.tallyParams = object.tallyParams !== undefined && object.tallyParams !== null ? TallyParams.fromPartial(object.tallyParams) : undefined; + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; return message; }, fromAmino(object: QueryParamsResponseAmino): QueryParamsResponse { @@ -1194,6 +1399,9 @@ export const QueryParamsResponse = { if (object.tally_params !== undefined && object.tally_params !== null) { message.tallyParams = TallyParams.fromAmino(object.tally_params); } + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } return message; }, toAmino(message: QueryParamsResponse): QueryParamsResponseAmino { @@ -1201,6 +1409,7 @@ export const QueryParamsResponse = { obj.voting_params = message.votingParams ? VotingParams.toAmino(message.votingParams) : undefined; obj.deposit_params = message.depositParams ? DepositParams.toAmino(message.depositParams) : undefined; obj.tally_params = message.tallyParams ? TallyParams.toAmino(message.tallyParams) : undefined; + obj.params = message.params ? Params.toAmino(message.params) : undefined; return obj; }, fromAminoMsg(object: QueryParamsResponseAminoMsg): QueryParamsResponse { diff --git a/packages/api/src/cosmos/gov/v1/tx.amino.ts b/packages/api/src/cosmos/gov/v1/tx.amino.ts index a648548e..c6af9f73 100644 --- a/packages/api/src/cosmos/gov/v1/tx.amino.ts +++ b/packages/api/src/cosmos/gov/v1/tx.amino.ts @@ -1,5 +1,5 @@ //@ts-nocheck -import { MsgSubmitProposal, MsgExecLegacyContent, MsgVote, MsgVoteWeighted, MsgDeposit } from "./tx"; +import { MsgSubmitProposal, MsgExecLegacyContent, MsgVote, MsgVoteWeighted, MsgDeposit, MsgUpdateParams, MsgCancelProposal } from "./tx"; export const AminoConverter = { "/cosmos.gov.v1.MsgSubmitProposal": { aminoType: "cosmos-sdk/v1/MsgSubmitProposal", @@ -25,5 +25,15 @@ export const AminoConverter = { aminoType: "cosmos-sdk/v1/MsgDeposit", toAmino: MsgDeposit.toAmino, fromAmino: MsgDeposit.fromAmino + }, + "/cosmos.gov.v1.MsgUpdateParams": { + aminoType: "cosmos-sdk/x/gov/v1/MsgUpdateParams", + toAmino: MsgUpdateParams.toAmino, + fromAmino: MsgUpdateParams.fromAmino + }, + "/cosmos.gov.v1.MsgCancelProposal": { + aminoType: "cosmos-sdk/v1/MsgCancelProposal", + toAmino: MsgCancelProposal.toAmino, + fromAmino: MsgCancelProposal.fromAmino } }; \ No newline at end of file diff --git a/packages/api/src/cosmos/gov/v1/tx.registry.ts b/packages/api/src/cosmos/gov/v1/tx.registry.ts index 1201c07b..0c8b2ae0 100644 --- a/packages/api/src/cosmos/gov/v1/tx.registry.ts +++ b/packages/api/src/cosmos/gov/v1/tx.registry.ts @@ -1,7 +1,7 @@ //@ts-nocheck import { GeneratedType, Registry } from "@cosmjs/proto-signing"; -import { MsgSubmitProposal, MsgExecLegacyContent, MsgVote, MsgVoteWeighted, MsgDeposit } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.gov.v1.MsgSubmitProposal", MsgSubmitProposal], ["/cosmos.gov.v1.MsgExecLegacyContent", MsgExecLegacyContent], ["/cosmos.gov.v1.MsgVote", MsgVote], ["/cosmos.gov.v1.MsgVoteWeighted", MsgVoteWeighted], ["/cosmos.gov.v1.MsgDeposit", MsgDeposit]]; +import { MsgSubmitProposal, MsgExecLegacyContent, MsgVote, MsgVoteWeighted, MsgDeposit, MsgUpdateParams, MsgCancelProposal } from "./tx"; +export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.gov.v1.MsgSubmitProposal", MsgSubmitProposal], ["/cosmos.gov.v1.MsgExecLegacyContent", MsgExecLegacyContent], ["/cosmos.gov.v1.MsgVote", MsgVote], ["/cosmos.gov.v1.MsgVoteWeighted", MsgVoteWeighted], ["/cosmos.gov.v1.MsgDeposit", MsgDeposit], ["/cosmos.gov.v1.MsgUpdateParams", MsgUpdateParams], ["/cosmos.gov.v1.MsgCancelProposal", MsgCancelProposal]]; export const load = (protoRegistry: Registry) => { registry.forEach(([typeUrl, mod]) => { protoRegistry.register(typeUrl, mod); @@ -38,6 +38,18 @@ export const MessageComposer = { typeUrl: "/cosmos.gov.v1.MsgDeposit", value: MsgDeposit.encode(value).finish() }; + }, + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/cosmos.gov.v1.MsgUpdateParams", + value: MsgUpdateParams.encode(value).finish() + }; + }, + cancelProposal(value: MsgCancelProposal) { + return { + typeUrl: "/cosmos.gov.v1.MsgCancelProposal", + value: MsgCancelProposal.encode(value).finish() + }; } }, withTypeUrl: { @@ -70,6 +82,18 @@ export const MessageComposer = { typeUrl: "/cosmos.gov.v1.MsgDeposit", value }; + }, + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/cosmos.gov.v1.MsgUpdateParams", + value + }; + }, + cancelProposal(value: MsgCancelProposal) { + return { + typeUrl: "/cosmos.gov.v1.MsgCancelProposal", + value + }; } }, fromPartial: { @@ -102,6 +126,18 @@ export const MessageComposer = { typeUrl: "/cosmos.gov.v1.MsgDeposit", value: MsgDeposit.fromPartial(value) }; + }, + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/cosmos.gov.v1.MsgUpdateParams", + value: MsgUpdateParams.fromPartial(value) + }; + }, + cancelProposal(value: MsgCancelProposal) { + return { + typeUrl: "/cosmos.gov.v1.MsgCancelProposal", + value: MsgCancelProposal.fromPartial(value) + }; } } }; \ No newline at end of file diff --git a/packages/api/src/cosmos/gov/v1/tx.rpc.msg.ts b/packages/api/src/cosmos/gov/v1/tx.rpc.msg.ts index 7141fdd1..8a10c1e9 100644 --- a/packages/api/src/cosmos/gov/v1/tx.rpc.msg.ts +++ b/packages/api/src/cosmos/gov/v1/tx.rpc.msg.ts @@ -1,10 +1,10 @@ //@ts-nocheck import { Rpc } from "../../../helpers"; import { BinaryReader } from "../../../binary"; -import { MsgSubmitProposal, MsgSubmitProposalResponse, MsgExecLegacyContent, MsgExecLegacyContentResponse, MsgVote, MsgVoteResponse, MsgVoteWeighted, MsgVoteWeightedResponse, MsgDeposit, MsgDepositResponse } from "./tx"; +import { MsgSubmitProposal, MsgSubmitProposalResponse, MsgExecLegacyContent, MsgExecLegacyContentResponse, MsgVote, MsgVoteResponse, MsgVoteWeighted, MsgVoteWeightedResponse, MsgDeposit, MsgDepositResponse, MsgUpdateParams, MsgUpdateParamsResponse, MsgCancelProposal, MsgCancelProposalResponse } from "./tx"; /** Msg defines the gov Msg service. */ export interface Msg { - /** SubmitProposal defines a method to create new proposal given a content. */ + /** SubmitProposal defines a method to create new proposal given the messages. */ submitProposal(request: MsgSubmitProposal): Promise; /** * ExecLegacyContent defines a Msg to be in included in a MsgSubmitProposal @@ -17,6 +17,13 @@ export interface Msg { voteWeighted(request: MsgVoteWeighted): Promise; /** Deposit defines a method to add deposit on a specific proposal. */ deposit(request: MsgDeposit): Promise; + /** + * UpdateParams defines a governance operation for updating the x/gov module + * parameters. The authority is defined in the keeper. + */ + updateParams(request: MsgUpdateParams): Promise; + /** CancelProposal defines a method to cancel governance proposal */ + cancelProposal(request: MsgCancelProposal): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: Rpc; @@ -27,6 +34,8 @@ export class MsgClientImpl implements Msg { this.vote = this.vote.bind(this); this.voteWeighted = this.voteWeighted.bind(this); this.deposit = this.deposit.bind(this); + this.updateParams = this.updateParams.bind(this); + this.cancelProposal = this.cancelProposal.bind(this); } submitProposal(request: MsgSubmitProposal): Promise { const data = MsgSubmitProposal.encode(request).finish(); @@ -53,4 +62,14 @@ export class MsgClientImpl implements Msg { const promise = this.rpc.request("cosmos.gov.v1.Msg", "Deposit", data); return promise.then(data => MsgDepositResponse.decode(new BinaryReader(data))); } + updateParams(request: MsgUpdateParams): Promise { + const data = MsgUpdateParams.encode(request).finish(); + const promise = this.rpc.request("cosmos.gov.v1.Msg", "UpdateParams", data); + return promise.then(data => MsgUpdateParamsResponse.decode(new BinaryReader(data))); + } + cancelProposal(request: MsgCancelProposal): Promise { + const data = MsgCancelProposal.encode(request).finish(); + const promise = this.rpc.request("cosmos.gov.v1.Msg", "CancelProposal", data); + return promise.then(data => MsgCancelProposalResponse.decode(new BinaryReader(data))); + } } \ No newline at end of file diff --git a/packages/api/src/cosmos/gov/v1/tx.ts b/packages/api/src/cosmos/gov/v1/tx.ts index ba443583..e6fdd708 100644 --- a/packages/api/src/cosmos/gov/v1/tx.ts +++ b/packages/api/src/cosmos/gov/v1/tx.ts @@ -1,19 +1,33 @@ //@ts-nocheck import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; -import { VoteOption, WeightedVoteOption, WeightedVoteOptionAmino, WeightedVoteOptionSDKType } from "./gov"; +import { VoteOption, WeightedVoteOption, WeightedVoteOptionAmino, WeightedVoteOptionSDKType, Params, ParamsAmino, ParamsSDKType } from "./gov"; +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { CommunityPoolSpendProposal, CommunityPoolSpendProposalProtoMsg, CommunityPoolSpendProposalSDKType, CommunityPoolSpendProposalWithDeposit, CommunityPoolSpendProposalWithDepositProtoMsg, CommunityPoolSpendProposalWithDepositSDKType } from "../../distribution/v1beta1/distribution"; import { TextProposal, TextProposalProtoMsg, TextProposalSDKType } from "../v1beta1/gov"; +import { ParameterChangeProposal, ParameterChangeProposalProtoMsg, ParameterChangeProposalSDKType } from "../../params/v1beta1/params"; +import { SoftwareUpgradeProposal, SoftwareUpgradeProposalProtoMsg, SoftwareUpgradeProposalSDKType, CancelSoftwareUpgradeProposal, CancelSoftwareUpgradeProposalProtoMsg, CancelSoftwareUpgradeProposalSDKType } from "../../upgrade/v1beta1/upgrade"; import { BinaryReader, BinaryWriter } from "../../../binary"; +import { toTimestamp, fromTimestamp } from "../../../helpers"; /** * MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary * proposal Content. */ export interface MsgSubmitProposal { + /** messages are the arbitrary messages to be executed if proposal passes. */ messages: Any[]; + /** initial_deposit is the deposit value that must be paid at proposal submission. */ initialDeposit: Coin[]; + /** proposer is the account address of the proposer. */ proposer: string; /** metadata is any arbitrary metadata attached to the proposal. */ metadata: string; + /** title is the title of the proposal. */ + title: string; + /** summary is the summary of the proposal */ + summary: string; + /** expedited defines if the proposal is expedited or not */ + expedited: boolean; } export interface MsgSubmitProposalProtoMsg { typeUrl: "/cosmos.gov.v1.MsgSubmitProposal"; @@ -24,11 +38,20 @@ export interface MsgSubmitProposalProtoMsg { * proposal Content. */ export interface MsgSubmitProposalAmino { + /** messages are the arbitrary messages to be executed if proposal passes. */ messages?: AnyAmino[]; - initial_deposit?: CoinAmino[]; + /** initial_deposit is the deposit value that must be paid at proposal submission. */ + initial_deposit: CoinAmino[]; + /** proposer is the account address of the proposer. */ proposer?: string; /** metadata is any arbitrary metadata attached to the proposal. */ metadata?: string; + /** title is the title of the proposal. */ + title?: string; + /** summary is the summary of the proposal */ + summary?: string; + /** expedited defines if the proposal is expedited or not */ + expedited?: boolean; } export interface MsgSubmitProposalAminoMsg { type: "cosmos-sdk/v1/MsgSubmitProposal"; @@ -43,9 +66,13 @@ export interface MsgSubmitProposalSDKType { initial_deposit: CoinSDKType[]; proposer: string; metadata: string; + title: string; + summary: string; + expedited: boolean; } /** MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. */ export interface MsgSubmitProposalResponse { + /** proposal_id defines the unique id of the proposal. */ proposalId: bigint; } export interface MsgSubmitProposalResponseProtoMsg { @@ -54,6 +81,7 @@ export interface MsgSubmitProposalResponseProtoMsg { } /** MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. */ export interface MsgSubmitProposalResponseAmino { + /** proposal_id defines the unique id of the proposal. */ proposal_id?: string; } export interface MsgSubmitProposalResponseAminoMsg { @@ -70,7 +98,7 @@ export interface MsgSubmitProposalResponseSDKType { */ export interface MsgExecLegacyContent { /** content is the proposal's content. */ - content?: TextProposal | Any | undefined; + content?: CommunityPoolSpendProposal | CommunityPoolSpendProposalWithDeposit | TextProposal | ParameterChangeProposal | SoftwareUpgradeProposal | CancelSoftwareUpgradeProposal | Any | undefined; /** authority must be the gov module address. */ authority: string; } @@ -79,7 +107,7 @@ export interface MsgExecLegacyContentProtoMsg { value: Uint8Array; } export type MsgExecLegacyContentEncoded = Omit & { - /** content is the proposal's content. */content?: TextProposalProtoMsg | AnyProtoMsg | undefined; + /** content is the proposal's content. */content?: CommunityPoolSpendProposalProtoMsg | CommunityPoolSpendProposalWithDepositProtoMsg | TextProposalProtoMsg | ParameterChangeProposalProtoMsg | SoftwareUpgradeProposalProtoMsg | CancelSoftwareUpgradeProposalProtoMsg | AnyProtoMsg | undefined; }; /** * MsgExecLegacyContent is used to wrap the legacy content field into a message. @@ -100,7 +128,7 @@ export interface MsgExecLegacyContentAminoMsg { * This ensures backwards compatibility with v1beta1.MsgSubmitProposal. */ export interface MsgExecLegacyContentSDKType { - content?: TextProposalSDKType | AnySDKType | undefined; + content?: CommunityPoolSpendProposalSDKType | CommunityPoolSpendProposalWithDepositSDKType | TextProposalSDKType | ParameterChangeProposalSDKType | SoftwareUpgradeProposalSDKType | CancelSoftwareUpgradeProposalSDKType | AnySDKType | undefined; authority: string; } /** MsgExecLegacyContentResponse defines the Msg/ExecLegacyContent response type. */ @@ -119,9 +147,13 @@ export interface MsgExecLegacyContentResponseAminoMsg { export interface MsgExecLegacyContentResponseSDKType {} /** MsgVote defines a message to cast a vote. */ export interface MsgVote { + /** proposal_id defines the unique id of the proposal. */ proposalId: bigint; + /** voter is the voter address for the proposal. */ voter: string; + /** option defines the vote option. */ option: VoteOption; + /** metadata is any arbitrary metadata attached to the Vote. */ metadata: string; } export interface MsgVoteProtoMsg { @@ -130,9 +162,13 @@ export interface MsgVoteProtoMsg { } /** MsgVote defines a message to cast a vote. */ export interface MsgVoteAmino { + /** proposal_id defines the unique id of the proposal. */ proposal_id: string; + /** voter is the voter address for the proposal. */ voter?: string; + /** option defines the vote option. */ option?: VoteOption; + /** metadata is any arbitrary metadata attached to the Vote. */ metadata?: string; } export interface MsgVoteAminoMsg { @@ -162,9 +198,13 @@ export interface MsgVoteResponseAminoMsg { export interface MsgVoteResponseSDKType {} /** MsgVoteWeighted defines a message to cast a vote. */ export interface MsgVoteWeighted { + /** proposal_id defines the unique id of the proposal. */ proposalId: bigint; + /** voter is the voter address for the proposal. */ voter: string; + /** options defines the weighted vote options. */ options: WeightedVoteOption[]; + /** metadata is any arbitrary metadata attached to the VoteWeighted. */ metadata: string; } export interface MsgVoteWeightedProtoMsg { @@ -173,9 +213,13 @@ export interface MsgVoteWeightedProtoMsg { } /** MsgVoteWeighted defines a message to cast a vote. */ export interface MsgVoteWeightedAmino { + /** proposal_id defines the unique id of the proposal. */ proposal_id: string; + /** voter is the voter address for the proposal. */ voter?: string; + /** options defines the weighted vote options. */ options?: WeightedVoteOptionAmino[]; + /** metadata is any arbitrary metadata attached to the VoteWeighted. */ metadata?: string; } export interface MsgVoteWeightedAminoMsg { @@ -205,8 +249,11 @@ export interface MsgVoteWeightedResponseAminoMsg { export interface MsgVoteWeightedResponseSDKType {} /** MsgDeposit defines a message to submit a deposit to an existing proposal. */ export interface MsgDeposit { + /** proposal_id defines the unique id of the proposal. */ proposalId: bigint; + /** depositor defines the deposit addresses from the proposals. */ depositor: string; + /** amount to be deposited by depositor. */ amount: Coin[]; } export interface MsgDepositProtoMsg { @@ -215,9 +262,12 @@ export interface MsgDepositProtoMsg { } /** MsgDeposit defines a message to submit a deposit to an existing proposal. */ export interface MsgDepositAmino { + /** proposal_id defines the unique id of the proposal. */ proposal_id: string; + /** depositor defines the deposit addresses from the proposals. */ depositor?: string; - amount?: CoinAmino[]; + /** amount to be deposited by depositor. */ + amount: CoinAmino[]; } export interface MsgDepositAminoMsg { type: "cosmos-sdk/v1/MsgDeposit"; @@ -243,12 +293,141 @@ export interface MsgDepositResponseAminoMsg { } /** MsgDepositResponse defines the Msg/Deposit response type. */ export interface MsgDepositResponseSDKType {} +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/gov parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params; +} +export interface MsgUpdateParamsProtoMsg { + typeUrl: "/cosmos.gov.v1.MsgUpdateParams"; + value: Uint8Array; +} +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParamsAmino { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority?: string; + /** + * params defines the x/gov parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: ParamsAmino; +} +export interface MsgUpdateParamsAminoMsg { + type: "cosmos-sdk/x/gov/v1/MsgUpdateParams"; + value: MsgUpdateParamsAmino; +} +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParamsSDKType { + authority: string; + params: ParamsSDKType; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponse {} +export interface MsgUpdateParamsResponseProtoMsg { + typeUrl: "/cosmos.gov.v1.MsgUpdateParamsResponse"; + value: Uint8Array; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponseAmino {} +export interface MsgUpdateParamsResponseAminoMsg { + type: "cosmos-sdk/v1/MsgUpdateParamsResponse"; + value: MsgUpdateParamsResponseAmino; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponseSDKType {} +/** MsgCancelProposal is the Msg/CancelProposal request type. */ +export interface MsgCancelProposal { + /** proposal_id defines the unique id of the proposal. */ + proposalId: bigint; + /** proposer is the account address of the proposer. */ + proposer: string; +} +export interface MsgCancelProposalProtoMsg { + typeUrl: "/cosmos.gov.v1.MsgCancelProposal"; + value: Uint8Array; +} +/** MsgCancelProposal is the Msg/CancelProposal request type. */ +export interface MsgCancelProposalAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** proposer is the account address of the proposer. */ + proposer?: string; +} +export interface MsgCancelProposalAminoMsg { + type: "cosmos-sdk/v1/MsgCancelProposal"; + value: MsgCancelProposalAmino; +} +/** MsgCancelProposal is the Msg/CancelProposal request type. */ +export interface MsgCancelProposalSDKType { + proposal_id: bigint; + proposer: string; +} +/** + * MsgCancelProposalResponse defines the response structure for executing a + * MsgCancelProposal message. + */ +export interface MsgCancelProposalResponse { + /** proposal_id defines the unique id of the proposal. */ + proposalId: bigint; + /** canceled_time is the time when proposal is canceled. */ + canceledTime: Date; + /** canceled_height defines the block height at which the proposal is canceled. */ + canceledHeight: bigint; +} +export interface MsgCancelProposalResponseProtoMsg { + typeUrl: "/cosmos.gov.v1.MsgCancelProposalResponse"; + value: Uint8Array; +} +/** + * MsgCancelProposalResponse defines the response structure for executing a + * MsgCancelProposal message. + */ +export interface MsgCancelProposalResponseAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** canceled_time is the time when proposal is canceled. */ + canceled_time?: string; + /** canceled_height defines the block height at which the proposal is canceled. */ + canceled_height?: string; +} +export interface MsgCancelProposalResponseAminoMsg { + type: "cosmos-sdk/v1/MsgCancelProposalResponse"; + value: MsgCancelProposalResponseAmino; +} +/** + * MsgCancelProposalResponse defines the response structure for executing a + * MsgCancelProposal message. + */ +export interface MsgCancelProposalResponseSDKType { + proposal_id: bigint; + canceled_time: Date; + canceled_height: bigint; +} function createBaseMsgSubmitProposal(): MsgSubmitProposal { return { messages: [], initialDeposit: [], proposer: "", - metadata: "" + metadata: "", + title: "", + summary: "", + expedited: false }; } export const MsgSubmitProposal = { @@ -266,6 +445,15 @@ export const MsgSubmitProposal = { if (message.metadata !== "") { writer.uint32(34).string(message.metadata); } + if (message.title !== "") { + writer.uint32(42).string(message.title); + } + if (message.summary !== "") { + writer.uint32(50).string(message.summary); + } + if (message.expedited === true) { + writer.uint32(56).bool(message.expedited); + } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitProposal { @@ -287,6 +475,15 @@ export const MsgSubmitProposal = { case 4: message.metadata = reader.string(); break; + case 5: + message.title = reader.string(); + break; + case 6: + message.summary = reader.string(); + break; + case 7: + message.expedited = reader.bool(); + break; default: reader.skipType(tag & 7); break; @@ -300,6 +497,9 @@ export const MsgSubmitProposal = { message.initialDeposit = object.initialDeposit?.map(e => Coin.fromPartial(e)) || []; message.proposer = object.proposer ?? ""; message.metadata = object.metadata ?? ""; + message.title = object.title ?? ""; + message.summary = object.summary ?? ""; + message.expedited = object.expedited ?? false; return message; }, fromAmino(object: MsgSubmitProposalAmino): MsgSubmitProposal { @@ -312,6 +512,15 @@ export const MsgSubmitProposal = { if (object.metadata !== undefined && object.metadata !== null) { message.metadata = object.metadata; } + if (object.title !== undefined && object.title !== null) { + message.title = object.title; + } + if (object.summary !== undefined && object.summary !== null) { + message.summary = object.summary; + } + if (object.expedited !== undefined && object.expedited !== null) { + message.expedited = object.expedited; + } return message; }, toAmino(message: MsgSubmitProposal): MsgSubmitProposalAmino { @@ -328,6 +537,9 @@ export const MsgSubmitProposal = { } obj.proposer = message.proposer === "" ? undefined : message.proposer; obj.metadata = message.metadata === "" ? undefined : message.metadata; + obj.title = message.title === "" ? undefined : message.title; + obj.summary = message.summary === "" ? undefined : message.summary; + obj.expedited = message.expedited === false ? undefined : message.expedited; return obj; }, fromAminoMsg(object: MsgSubmitProposalAminoMsg): MsgSubmitProposal { @@ -446,7 +658,7 @@ export const MsgExecLegacyContent = { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.content = (Content_InterfaceDecoder(reader) as Any); + message.content = (Cosmos_govv1beta1Content_InterfaceDecoder(reader) as Any); break; case 2: message.authority = reader.string(); @@ -467,7 +679,7 @@ export const MsgExecLegacyContent = { fromAmino(object: MsgExecLegacyContentAmino): MsgExecLegacyContent { const message = createBaseMsgExecLegacyContent(); if (object.content !== undefined && object.content !== null) { - message.content = Content_FromAmino(object.content); + message.content = Cosmos_govv1beta1Content_FromAmino(object.content); } if (object.authority !== undefined && object.authority !== null) { message.authority = object.authority; @@ -476,7 +688,7 @@ export const MsgExecLegacyContent = { }, toAmino(message: MsgExecLegacyContent): MsgExecLegacyContentAmino { const obj: any = {}; - obj.content = message.content ? Content_ToAmino((message.content as Any)) : undefined; + obj.content = message.content ? Cosmos_govv1beta1Content_ToAmino((message.content as Any)) : undefined; obj.authority = message.authority === "" ? undefined : message.authority; return obj; }, @@ -1033,34 +1245,405 @@ export const MsgDepositResponse = { }; } }; -export const Content_InterfaceDecoder = (input: BinaryReader | Uint8Array): TextProposal | Any => { +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { + authority: "", + params: Params.fromPartial({}) + }; +} +export const MsgUpdateParams = { + typeUrl: "/cosmos.gov.v1.MsgUpdateParams", + encode(message: MsgUpdateParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + message.authority = object.authority ?? ""; + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, + fromAmino(object: MsgUpdateParamsAmino): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: MsgUpdateParams): MsgUpdateParamsAmino { + const obj: any = {}; + obj.authority = message.authority === "" ? undefined : message.authority; + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); + return obj; + }, + fromAminoMsg(object: MsgUpdateParamsAminoMsg): MsgUpdateParams { + return MsgUpdateParams.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateParams): MsgUpdateParamsAminoMsg { + return { + type: "cosmos-sdk/x/gov/v1/MsgUpdateParams", + value: MsgUpdateParams.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateParamsProtoMsg): MsgUpdateParams { + return MsgUpdateParams.decode(message.value); + }, + toProto(message: MsgUpdateParams): Uint8Array { + return MsgUpdateParams.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateParams): MsgUpdateParamsProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.MsgUpdateParams", + value: MsgUpdateParams.encode(message).finish() + }; + } +}; +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} +export const MsgUpdateParamsResponse = { + typeUrl: "/cosmos.gov.v1.MsgUpdateParamsResponse", + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, + fromAmino(_: MsgUpdateParamsResponseAmino): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, + toAmino(_: MsgUpdateParamsResponse): MsgUpdateParamsResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUpdateParamsResponseAminoMsg): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateParamsResponse): MsgUpdateParamsResponseAminoMsg { + return { + type: "cosmos-sdk/v1/MsgUpdateParamsResponse", + value: MsgUpdateParamsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateParamsResponseProtoMsg): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.decode(message.value); + }, + toProto(message: MsgUpdateParamsResponse): Uint8Array { + return MsgUpdateParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateParamsResponse): MsgUpdateParamsResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.MsgUpdateParamsResponse", + value: MsgUpdateParamsResponse.encode(message).finish() + }; + } +}; +function createBaseMsgCancelProposal(): MsgCancelProposal { + return { + proposalId: BigInt(0), + proposer: "" + }; +} +export const MsgCancelProposal = { + typeUrl: "/cosmos.gov.v1.MsgCancelProposal", + encode(message: MsgCancelProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.proposer !== "") { + writer.uint32(18).string(message.proposer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgCancelProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCancelProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.proposer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgCancelProposal { + const message = createBaseMsgCancelProposal(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + message.proposer = object.proposer ?? ""; + return message; + }, + fromAmino(object: MsgCancelProposalAmino): MsgCancelProposal { + const message = createBaseMsgCancelProposal(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.proposer !== undefined && object.proposer !== null) { + message.proposer = object.proposer; + } + return message; + }, + toAmino(message: MsgCancelProposal): MsgCancelProposalAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId ? message.proposalId?.toString() : "0"; + obj.proposer = message.proposer === "" ? undefined : message.proposer; + return obj; + }, + fromAminoMsg(object: MsgCancelProposalAminoMsg): MsgCancelProposal { + return MsgCancelProposal.fromAmino(object.value); + }, + toAminoMsg(message: MsgCancelProposal): MsgCancelProposalAminoMsg { + return { + type: "cosmos-sdk/v1/MsgCancelProposal", + value: MsgCancelProposal.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCancelProposalProtoMsg): MsgCancelProposal { + return MsgCancelProposal.decode(message.value); + }, + toProto(message: MsgCancelProposal): Uint8Array { + return MsgCancelProposal.encode(message).finish(); + }, + toProtoMsg(message: MsgCancelProposal): MsgCancelProposalProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.MsgCancelProposal", + value: MsgCancelProposal.encode(message).finish() + }; + } +}; +function createBaseMsgCancelProposalResponse(): MsgCancelProposalResponse { + return { + proposalId: BigInt(0), + canceledTime: new Date(), + canceledHeight: BigInt(0) + }; +} +export const MsgCancelProposalResponse = { + typeUrl: "/cosmos.gov.v1.MsgCancelProposalResponse", + encode(message: MsgCancelProposalResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.canceledTime !== undefined) { + Timestamp.encode(toTimestamp(message.canceledTime), writer.uint32(18).fork()).ldelim(); + } + if (message.canceledHeight !== BigInt(0)) { + writer.uint32(24).uint64(message.canceledHeight); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgCancelProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCancelProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.canceledTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 3: + message.canceledHeight = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgCancelProposalResponse { + const message = createBaseMsgCancelProposalResponse(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + message.canceledTime = object.canceledTime ?? undefined; + message.canceledHeight = object.canceledHeight !== undefined && object.canceledHeight !== null ? BigInt(object.canceledHeight.toString()) : BigInt(0); + return message; + }, + fromAmino(object: MsgCancelProposalResponseAmino): MsgCancelProposalResponse { + const message = createBaseMsgCancelProposalResponse(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.canceled_time !== undefined && object.canceled_time !== null) { + message.canceledTime = fromTimestamp(Timestamp.fromAmino(object.canceled_time)); + } + if (object.canceled_height !== undefined && object.canceled_height !== null) { + message.canceledHeight = BigInt(object.canceled_height); + } + return message; + }, + toAmino(message: MsgCancelProposalResponse): MsgCancelProposalResponseAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId ? message.proposalId?.toString() : "0"; + obj.canceled_time = message.canceledTime ? Timestamp.toAmino(toTimestamp(message.canceledTime)) : undefined; + obj.canceled_height = message.canceledHeight !== BigInt(0) ? message.canceledHeight?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: MsgCancelProposalResponseAminoMsg): MsgCancelProposalResponse { + return MsgCancelProposalResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgCancelProposalResponse): MsgCancelProposalResponseAminoMsg { + return { + type: "cosmos-sdk/v1/MsgCancelProposalResponse", + value: MsgCancelProposalResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCancelProposalResponseProtoMsg): MsgCancelProposalResponse { + return MsgCancelProposalResponse.decode(message.value); + }, + toProto(message: MsgCancelProposalResponse): Uint8Array { + return MsgCancelProposalResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgCancelProposalResponse): MsgCancelProposalResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.MsgCancelProposalResponse", + value: MsgCancelProposalResponse.encode(message).finish() + }; + } +}; +export const Cosmos_govv1beta1Content_InterfaceDecoder = (input: BinaryReader | Uint8Array): CommunityPoolSpendProposal | CommunityPoolSpendProposalWithDeposit | TextProposal | ParameterChangeProposal | SoftwareUpgradeProposal | CancelSoftwareUpgradeProposal | Any => { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const data = Any.decode(reader, reader.uint32()); switch (data.typeUrl) { + case "/cosmos.distribution.v1beta1.CommunityPoolSpendProposal": + return CommunityPoolSpendProposal.decode(data.value); + case "/cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit": + return CommunityPoolSpendProposalWithDeposit.decode(data.value); case "/cosmos.gov.v1beta1.TextProposal": return TextProposal.decode(data.value); + case "/cosmos.params.v1beta1.ParameterChangeProposal": + return ParameterChangeProposal.decode(data.value); + case "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal": + return SoftwareUpgradeProposal.decode(data.value); + case "/cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal": + return CancelSoftwareUpgradeProposal.decode(data.value); default: return data; } }; -export const Content_FromAmino = (content: AnyAmino): Any => { +export const Cosmos_govv1beta1Content_FromAmino = (content: AnyAmino): Any => { switch (content.type) { - case "cosmos-sdk/v1/TextProposal": + case "cosmos-sdk/v1/CommunityPoolSpendProposal": + return Any.fromPartial({ + typeUrl: "/cosmos.distribution.v1beta1.CommunityPoolSpendProposal", + value: CommunityPoolSpendProposal.encode(CommunityPoolSpendProposal.fromPartial(CommunityPoolSpendProposal.fromAmino(content.value))).finish() + }); + case "cosmos-sdk/v1/CommunityPoolSpendProposalWithDeposit": + return Any.fromPartial({ + typeUrl: "/cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit", + value: CommunityPoolSpendProposalWithDeposit.encode(CommunityPoolSpendProposalWithDeposit.fromPartial(CommunityPoolSpendProposalWithDeposit.fromAmino(content.value))).finish() + }); + case "cosmos-sdk/TextProposal": return Any.fromPartial({ typeUrl: "/cosmos.gov.v1beta1.TextProposal", value: TextProposal.encode(TextProposal.fromPartial(TextProposal.fromAmino(content.value))).finish() }); + case "cosmos-sdk/ParameterChangeProposal": + return Any.fromPartial({ + typeUrl: "/cosmos.params.v1beta1.ParameterChangeProposal", + value: ParameterChangeProposal.encode(ParameterChangeProposal.fromPartial(ParameterChangeProposal.fromAmino(content.value))).finish() + }); + case "cosmos-sdk/SoftwareUpgradeProposal": + return Any.fromPartial({ + typeUrl: "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal", + value: SoftwareUpgradeProposal.encode(SoftwareUpgradeProposal.fromPartial(SoftwareUpgradeProposal.fromAmino(content.value))).finish() + }); + case "cosmos-sdk/CancelSoftwareUpgradeProposal": + return Any.fromPartial({ + typeUrl: "/cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal", + value: CancelSoftwareUpgradeProposal.encode(CancelSoftwareUpgradeProposal.fromPartial(CancelSoftwareUpgradeProposal.fromAmino(content.value))).finish() + }); default: return Any.fromAmino(content); } }; -export const Content_ToAmino = (content: Any) => { +export const Cosmos_govv1beta1Content_ToAmino = (content: Any) => { switch (content.typeUrl) { + case "/cosmos.distribution.v1beta1.CommunityPoolSpendProposal": + return { + type: "cosmos-sdk/v1/CommunityPoolSpendProposal", + value: CommunityPoolSpendProposal.toAmino(CommunityPoolSpendProposal.decode(content.value, undefined)) + }; + case "/cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit": + return { + type: "cosmos-sdk/v1/CommunityPoolSpendProposalWithDeposit", + value: CommunityPoolSpendProposalWithDeposit.toAmino(CommunityPoolSpendProposalWithDeposit.decode(content.value, undefined)) + }; case "/cosmos.gov.v1beta1.TextProposal": return { - type: "cosmos-sdk/v1/TextProposal", + type: "cosmos-sdk/TextProposal", value: TextProposal.toAmino(TextProposal.decode(content.value, undefined)) }; + case "/cosmos.params.v1beta1.ParameterChangeProposal": + return { + type: "cosmos-sdk/ParameterChangeProposal", + value: ParameterChangeProposal.toAmino(ParameterChangeProposal.decode(content.value, undefined)) + }; + case "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal": + return { + type: "cosmos-sdk/SoftwareUpgradeProposal", + value: SoftwareUpgradeProposal.toAmino(SoftwareUpgradeProposal.decode(content.value, undefined)) + }; + case "/cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal": + return { + type: "cosmos-sdk/CancelSoftwareUpgradeProposal", + value: CancelSoftwareUpgradeProposal.toAmino(CancelSoftwareUpgradeProposal.decode(content.value, undefined)) + }; default: return Any.toAmino(content); } diff --git a/packages/api/src/cosmos/gov/v1beta1/genesis.ts b/packages/api/src/cosmos/gov/v1beta1/genesis.ts index 1f70b70a..0e402a7f 100644 --- a/packages/api/src/cosmos/gov/v1beta1/genesis.ts +++ b/packages/api/src/cosmos/gov/v1beta1/genesis.ts @@ -11,11 +11,11 @@ export interface GenesisState { votes: Vote[]; /** proposals defines all the proposals present at genesis. */ proposals: Proposal[]; - /** params defines all the paramaters of related to deposit. */ + /** deposit_params defines all the parameters related to deposit. */ depositParams: DepositParams; - /** params defines all the paramaters of related to voting. */ + /** voting_params defines all the parameters related to voting. */ votingParams: VotingParams; - /** params defines all the paramaters of related to tally. */ + /** tally_params defines all the parameters related to tally. */ tallyParams: TallyParams; } export interface GenesisStateProtoMsg { @@ -27,17 +27,17 @@ export interface GenesisStateAmino { /** starting_proposal_id is the ID of the starting proposal. */ starting_proposal_id?: string; /** deposits defines all the deposits present at genesis. */ - deposits?: DepositAmino[]; + deposits: DepositAmino[]; /** votes defines all the votes present at genesis. */ - votes?: VoteAmino[]; + votes: VoteAmino[]; /** proposals defines all the proposals present at genesis. */ - proposals?: ProposalAmino[]; - /** params defines all the paramaters of related to deposit. */ - deposit_params?: DepositParamsAmino; - /** params defines all the paramaters of related to voting. */ - voting_params?: VotingParamsAmino; - /** params defines all the paramaters of related to tally. */ - tally_params?: TallyParamsAmino; + proposals: ProposalAmino[]; + /** deposit_params defines all the parameters related to deposit. */ + deposit_params: DepositParamsAmino; + /** voting_params defines all the parameters related to voting. */ + voting_params: VotingParamsAmino; + /** tally_params defines all the parameters related to tally. */ + tally_params: TallyParamsAmino; } export interface GenesisStateAminoMsg { type: "cosmos-sdk/GenesisState"; @@ -173,9 +173,9 @@ export const GenesisState = { } else { obj.proposals = message.proposals; } - obj.deposit_params = message.depositParams ? DepositParams.toAmino(message.depositParams) : undefined; - obj.voting_params = message.votingParams ? VotingParams.toAmino(message.votingParams) : undefined; - obj.tally_params = message.tallyParams ? TallyParams.toAmino(message.tallyParams) : undefined; + obj.deposit_params = message.depositParams ? DepositParams.toAmino(message.depositParams) : DepositParams.toAmino(DepositParams.fromPartial({})); + obj.voting_params = message.votingParams ? VotingParams.toAmino(message.votingParams) : VotingParams.toAmino(VotingParams.fromPartial({})); + obj.tally_params = message.tallyParams ? TallyParams.toAmino(message.tallyParams) : TallyParams.toAmino(TallyParams.fromPartial({})); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/packages/api/src/cosmos/gov/v1beta1/gov.ts b/packages/api/src/cosmos/gov/v1beta1/gov.ts index 94ca1a63..ebcb0c06 100644 --- a/packages/api/src/cosmos/gov/v1beta1/gov.ts +++ b/packages/api/src/cosmos/gov/v1beta1/gov.ts @@ -3,6 +3,9 @@ import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { Timestamp } from "../../../google/protobuf/timestamp"; import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; +import { CommunityPoolSpendProposal, CommunityPoolSpendProposalProtoMsg, CommunityPoolSpendProposalSDKType, CommunityPoolSpendProposalWithDeposit, CommunityPoolSpendProposalWithDepositProtoMsg, CommunityPoolSpendProposalWithDepositSDKType } from "../../distribution/v1beta1/distribution"; +import { ParameterChangeProposal, ParameterChangeProposalProtoMsg, ParameterChangeProposalSDKType } from "../../params/v1beta1/params"; +import { SoftwareUpgradeProposal, SoftwareUpgradeProposalProtoMsg, SoftwareUpgradeProposalSDKType, CancelSoftwareUpgradeProposal, CancelSoftwareUpgradeProposalProtoMsg, CancelSoftwareUpgradeProposalSDKType } from "../../upgrade/v1beta1/upgrade"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; import { toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../../helpers"; @@ -140,37 +143,29 @@ export function proposalStatusToJSON(object: ProposalStatus): string { return "UNRECOGNIZED"; } } -/** - * WeightedVoteOption defines a unit of vote for vote split. - * - * Since: cosmos-sdk 0.43 - */ +/** WeightedVoteOption defines a unit of vote for vote split. */ export interface WeightedVoteOption { + /** option defines the valid vote options, it must not contain duplicate vote options. */ option: VoteOption; + /** weight is the vote weight associated with the vote option. */ weight: string; } export interface WeightedVoteOptionProtoMsg { typeUrl: "/cosmos.gov.v1beta1.WeightedVoteOption"; value: Uint8Array; } -/** - * WeightedVoteOption defines a unit of vote for vote split. - * - * Since: cosmos-sdk 0.43 - */ +/** WeightedVoteOption defines a unit of vote for vote split. */ export interface WeightedVoteOptionAmino { + /** option defines the valid vote options, it must not contain duplicate vote options. */ option?: VoteOption; - weight?: string; + /** weight is the vote weight associated with the vote option. */ + weight: string; } export interface WeightedVoteOptionAminoMsg { type: "cosmos-sdk/WeightedVoteOption"; value: WeightedVoteOptionAmino; } -/** - * WeightedVoteOption defines a unit of vote for vote split. - * - * Since: cosmos-sdk 0.43 - */ +/** WeightedVoteOption defines a unit of vote for vote split. */ export interface WeightedVoteOptionSDKType { option: VoteOption; weight: string; @@ -181,7 +176,9 @@ export interface WeightedVoteOptionSDKType { */ export interface TextProposal { $typeUrl?: "/cosmos.gov.v1beta1.TextProposal"; + /** title of the proposal. */ title: string; + /** description associated with the proposal. */ description: string; } export interface TextProposalProtoMsg { @@ -193,7 +190,9 @@ export interface TextProposalProtoMsg { * manually updated in case of approval. */ export interface TextProposalAmino { + /** title of the proposal. */ title?: string; + /** description associated with the proposal. */ description?: string; } export interface TextProposalAminoMsg { @@ -214,8 +213,11 @@ export interface TextProposalSDKType { * proposal. */ export interface Deposit { + /** proposal_id defines the unique id of the proposal. */ proposalId: bigint; + /** depositor defines the deposit addresses from the proposals. */ depositor: string; + /** amount to be deposited by depositor. */ amount: Coin[]; } export interface DepositProtoMsg { @@ -227,9 +229,12 @@ export interface DepositProtoMsg { * proposal. */ export interface DepositAmino { + /** proposal_id defines the unique id of the proposal. */ proposal_id?: string; + /** depositor defines the deposit addresses from the proposals. */ depositor?: string; - amount?: CoinAmino[]; + /** amount to be deposited by depositor. */ + amount: CoinAmino[]; } export interface DepositAminoMsg { type: "cosmos-sdk/Deposit"; @@ -246,8 +251,11 @@ export interface DepositSDKType { } /** Proposal defines the core field members of a governance proposal. */ export interface Proposal { + /** proposal_id defines the unique id of the proposal. */ proposalId: bigint; - content?: TextProposal | Any | undefined; + /** content is the proposal's content. */ + content?: TextProposal | CommunityPoolSpendProposal | CommunityPoolSpendProposalWithDeposit | ParameterChangeProposal | SoftwareUpgradeProposal | CancelSoftwareUpgradeProposal | Any | undefined; + /** status defines the proposal status. */ status: ProposalStatus; /** * final_tally_result is the final tally result of the proposal. When @@ -255,10 +263,15 @@ export interface Proposal { * proposal's voting period has ended. */ finalTallyResult: TallyResult; + /** submit_time is the time of proposal submission. */ submitTime: Date; + /** deposit_end_time is the end time for deposition. */ depositEndTime: Date; + /** total_deposit is the total deposit on the proposal. */ totalDeposit: Coin[]; + /** voting_start_time is the starting time to vote on a proposal. */ votingStartTime: Date; + /** voting_end_time is the end time of voting on a proposal. */ votingEndTime: Date; } export interface ProposalProtoMsg { @@ -266,24 +279,32 @@ export interface ProposalProtoMsg { value: Uint8Array; } export type ProposalEncoded = Omit & { - content?: TextProposalProtoMsg | AnyProtoMsg | undefined; + /** content is the proposal's content. */content?: TextProposalProtoMsg | CommunityPoolSpendProposalProtoMsg | CommunityPoolSpendProposalWithDepositProtoMsg | ParameterChangeProposalProtoMsg | SoftwareUpgradeProposalProtoMsg | CancelSoftwareUpgradeProposalProtoMsg | AnyProtoMsg | undefined; }; /** Proposal defines the core field members of a governance proposal. */ export interface ProposalAmino { + /** proposal_id defines the unique id of the proposal. */ proposal_id?: string; + /** content is the proposal's content. */ content?: AnyAmino; + /** status defines the proposal status. */ status?: ProposalStatus; /** * final_tally_result is the final tally result of the proposal. When * querying a proposal via gRPC, this field is not populated until the * proposal's voting period has ended. */ - final_tally_result?: TallyResultAmino; - submit_time?: string; - deposit_end_time?: string; - total_deposit?: CoinAmino[]; - voting_start_time?: string; - voting_end_time?: string; + final_tally_result: TallyResultAmino; + /** submit_time is the time of proposal submission. */ + submit_time: string; + /** deposit_end_time is the end time for deposition. */ + deposit_end_time: string; + /** total_deposit is the total deposit on the proposal. */ + total_deposit: CoinAmino[]; + /** voting_start_time is the starting time to vote on a proposal. */ + voting_start_time: string; + /** voting_end_time is the end time of voting on a proposal. */ + voting_end_time: string; } export interface ProposalAminoMsg { type: "cosmos-sdk/Proposal"; @@ -292,7 +313,7 @@ export interface ProposalAminoMsg { /** Proposal defines the core field members of a governance proposal. */ export interface ProposalSDKType { proposal_id: bigint; - content?: TextProposalSDKType | AnySDKType | undefined; + content?: TextProposalSDKType | CommunityPoolSpendProposalSDKType | CommunityPoolSpendProposalWithDepositSDKType | ParameterChangeProposalSDKType | SoftwareUpgradeProposalSDKType | CancelSoftwareUpgradeProposalSDKType | AnySDKType | undefined; status: ProposalStatus; final_tally_result: TallyResultSDKType; submit_time: Date; @@ -303,9 +324,13 @@ export interface ProposalSDKType { } /** TallyResult defines a standard tally for a governance proposal. */ export interface TallyResult { + /** yes is the number of yes votes on a proposal. */ yes: string; + /** abstain is the number of abstain votes on a proposal. */ abstain: string; + /** no is the number of no votes on a proposal. */ no: string; + /** no_with_veto is the number of no with veto votes on a proposal. */ noWithVeto: string; } export interface TallyResultProtoMsg { @@ -314,9 +339,13 @@ export interface TallyResultProtoMsg { } /** TallyResult defines a standard tally for a governance proposal. */ export interface TallyResultAmino { + /** yes is the number of yes votes on a proposal. */ yes?: string; + /** abstain is the number of abstain votes on a proposal. */ abstain?: string; + /** no is the number of no votes on a proposal. */ no?: string; + /** no_with_veto is the number of no with veto votes on a proposal. */ no_with_veto?: string; } export interface TallyResultAminoMsg { @@ -335,7 +364,9 @@ export interface TallyResultSDKType { * A Vote consists of a proposal ID, the voter, and the vote option. */ export interface Vote { + /** proposal_id defines the unique id of the proposal. */ proposalId: bigint; + /** voter is the voter address of the proposal. */ voter: string; /** * Deprecated: Prefer to use `options` instead. This field is set in queries @@ -344,7 +375,7 @@ export interface Vote { */ /** @deprecated */ option: VoteOption; - /** Since: cosmos-sdk 0.43 */ + /** options is the weighted vote options. */ options: WeightedVoteOption[]; } export interface VoteProtoMsg { @@ -356,7 +387,9 @@ export interface VoteProtoMsg { * A Vote consists of a proposal ID, the voter, and the vote option. */ export interface VoteAmino { + /** proposal_id defines the unique id of the proposal. */ proposal_id: string; + /** voter is the voter address of the proposal. */ voter?: string; /** * Deprecated: Prefer to use `options` instead. This field is set in queries @@ -365,8 +398,8 @@ export interface VoteAmino { */ /** @deprecated */ option?: VoteOption; - /** Since: cosmos-sdk 0.43 */ - options?: WeightedVoteOptionAmino[]; + /** options is the weighted vote options. */ + options: WeightedVoteOptionAmino[]; } export interface VoteAminoMsg { type: "cosmos-sdk/Vote"; @@ -389,7 +422,7 @@ export interface DepositParams { minDeposit: Coin[]; /** * Maximum period for Atom holders to deposit on a proposal. Initial value: 2 - * months. + * months. */ maxDepositPeriod: Duration; } @@ -403,7 +436,7 @@ export interface DepositParamsAmino { min_deposit?: CoinAmino[]; /** * Maximum period for Atom holders to deposit on a proposal. Initial value: 2 - * months. + * months. */ max_deposit_period?: DurationAmino; } @@ -418,7 +451,7 @@ export interface DepositParamsSDKType { } /** VotingParams defines the params for voting on governance proposals. */ export interface VotingParams { - /** Length of the voting period. */ + /** Duration of the voting period. */ votingPeriod: Duration; } export interface VotingParamsProtoMsg { @@ -427,7 +460,7 @@ export interface VotingParamsProtoMsg { } /** VotingParams defines the params for voting on governance proposals. */ export interface VotingParamsAmino { - /** Length of the voting period. */ + /** Duration of the voting period. */ voting_period?: DurationAmino; } export interface VotingParamsAminoMsg { @@ -442,14 +475,14 @@ export interface VotingParamsSDKType { export interface TallyParams { /** * Minimum percentage of total stake needed to vote for a result to be - * considered valid. + * considered valid. */ quorum: Uint8Array; /** Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. */ threshold: Uint8Array; /** * Minimum value of Veto votes to Total votes ratio for proposal to be - * vetoed. Default value: 1/3. + * vetoed. Default value: 1/3. */ vetoThreshold: Uint8Array; } @@ -461,14 +494,14 @@ export interface TallyParamsProtoMsg { export interface TallyParamsAmino { /** * Minimum percentage of total stake needed to vote for a result to be - * considered valid. + * considered valid. */ quorum?: string; /** Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. */ threshold?: string; /** * Minimum value of Veto votes to Total votes ratio for proposal to be - * vetoed. Default value: 1/3. + * vetoed. Default value: 1/3. */ veto_threshold?: string; } @@ -538,7 +571,7 @@ export const WeightedVoteOption = { toAmino(message: WeightedVoteOption): WeightedVoteOptionAmino { const obj: any = {}; obj.option = message.option === 0 ? undefined : message.option; - obj.weight = message.weight === "" ? undefined : message.weight; + obj.weight = message.weight ?? ""; return obj; }, fromAminoMsg(object: WeightedVoteOptionAminoMsg): WeightedVoteOption { @@ -796,7 +829,7 @@ export const Proposal = { message.proposalId = reader.uint64(); break; case 2: - message.content = (Content_InterfaceDecoder(reader) as Any); + message.content = (Cosmos_govv1beta1Content_InterfaceDecoder(reader) as Any); break; case 3: message.status = (reader.int32() as any); @@ -845,7 +878,7 @@ export const Proposal = { message.proposalId = BigInt(object.proposal_id); } if (object.content !== undefined && object.content !== null) { - message.content = Content_FromAmino(object.content); + message.content = Cosmos_govv1beta1Content_FromAmino(object.content); } if (object.status !== undefined && object.status !== null) { message.status = object.status; @@ -871,18 +904,18 @@ export const Proposal = { toAmino(message: Proposal): ProposalAmino { const obj: any = {}; obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId?.toString() : undefined; - obj.content = message.content ? Content_ToAmino((message.content as Any)) : undefined; + obj.content = message.content ? Cosmos_govv1beta1Content_ToAmino((message.content as Any)) : undefined; obj.status = message.status === 0 ? undefined : message.status; - obj.final_tally_result = message.finalTallyResult ? TallyResult.toAmino(message.finalTallyResult) : undefined; - obj.submit_time = message.submitTime ? Timestamp.toAmino(toTimestamp(message.submitTime)) : undefined; - obj.deposit_end_time = message.depositEndTime ? Timestamp.toAmino(toTimestamp(message.depositEndTime)) : undefined; + obj.final_tally_result = message.finalTallyResult ? TallyResult.toAmino(message.finalTallyResult) : TallyResult.toAmino(TallyResult.fromPartial({})); + obj.submit_time = message.submitTime ? Timestamp.toAmino(toTimestamp(message.submitTime)) : new Date(); + obj.deposit_end_time = message.depositEndTime ? Timestamp.toAmino(toTimestamp(message.depositEndTime)) : new Date(); if (message.totalDeposit) { obj.total_deposit = message.totalDeposit.map(e => e ? Coin.toAmino(e) : undefined); } else { obj.total_deposit = message.totalDeposit; } - obj.voting_start_time = message.votingStartTime ? Timestamp.toAmino(toTimestamp(message.votingStartTime)) : undefined; - obj.voting_end_time = message.votingEndTime ? Timestamp.toAmino(toTimestamp(message.votingEndTime)) : undefined; + obj.voting_start_time = message.votingStartTime ? Timestamp.toAmino(toTimestamp(message.votingStartTime)) : new Date(); + obj.voting_end_time = message.votingEndTime ? Timestamp.toAmino(toTimestamp(message.votingEndTime)) : new Date(); return obj; }, fromAminoMsg(object: ProposalAminoMsg): Proposal { @@ -1364,34 +1397,94 @@ export const TallyParams = { }; } }; -export const Content_InterfaceDecoder = (input: BinaryReader | Uint8Array): TextProposal | Any => { +export const Cosmos_govv1beta1Content_InterfaceDecoder = (input: BinaryReader | Uint8Array): CommunityPoolSpendProposal | CommunityPoolSpendProposalWithDeposit | TextProposal | ParameterChangeProposal | SoftwareUpgradeProposal | CancelSoftwareUpgradeProposal | Any => { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const data = Any.decode(reader, reader.uint32()); switch (data.typeUrl) { + case "/cosmos.distribution.v1beta1.CommunityPoolSpendProposal": + return CommunityPoolSpendProposal.decode(data.value); + case "/cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit": + return CommunityPoolSpendProposalWithDeposit.decode(data.value); case "/cosmos.gov.v1beta1.TextProposal": return TextProposal.decode(data.value); + case "/cosmos.params.v1beta1.ParameterChangeProposal": + return ParameterChangeProposal.decode(data.value); + case "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal": + return SoftwareUpgradeProposal.decode(data.value); + case "/cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal": + return CancelSoftwareUpgradeProposal.decode(data.value); default: return data; } }; -export const Content_FromAmino = (content: AnyAmino): Any => { +export const Cosmos_govv1beta1Content_FromAmino = (content: AnyAmino): Any => { switch (content.type) { + case "cosmos-sdk/CommunityPoolSpendProposal": + return Any.fromPartial({ + typeUrl: "/cosmos.distribution.v1beta1.CommunityPoolSpendProposal", + value: CommunityPoolSpendProposal.encode(CommunityPoolSpendProposal.fromPartial(CommunityPoolSpendProposal.fromAmino(content.value))).finish() + }); + case "cosmos-sdk/CommunityPoolSpendProposalWithDeposit": + return Any.fromPartial({ + typeUrl: "/cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit", + value: CommunityPoolSpendProposalWithDeposit.encode(CommunityPoolSpendProposalWithDeposit.fromPartial(CommunityPoolSpendProposalWithDeposit.fromAmino(content.value))).finish() + }); case "cosmos-sdk/TextProposal": return Any.fromPartial({ typeUrl: "/cosmos.gov.v1beta1.TextProposal", value: TextProposal.encode(TextProposal.fromPartial(TextProposal.fromAmino(content.value))).finish() }); + case "cosmos-sdk/ParameterChangeProposal": + return Any.fromPartial({ + typeUrl: "/cosmos.params.v1beta1.ParameterChangeProposal", + value: ParameterChangeProposal.encode(ParameterChangeProposal.fromPartial(ParameterChangeProposal.fromAmino(content.value))).finish() + }); + case "cosmos-sdk/SoftwareUpgradeProposal": + return Any.fromPartial({ + typeUrl: "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal", + value: SoftwareUpgradeProposal.encode(SoftwareUpgradeProposal.fromPartial(SoftwareUpgradeProposal.fromAmino(content.value))).finish() + }); + case "cosmos-sdk/CancelSoftwareUpgradeProposal": + return Any.fromPartial({ + typeUrl: "/cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal", + value: CancelSoftwareUpgradeProposal.encode(CancelSoftwareUpgradeProposal.fromPartial(CancelSoftwareUpgradeProposal.fromAmino(content.value))).finish() + }); default: return Any.fromAmino(content); } }; -export const Content_ToAmino = (content: Any) => { +export const Cosmos_govv1beta1Content_ToAmino = (content: Any) => { switch (content.typeUrl) { + case "/cosmos.distribution.v1beta1.CommunityPoolSpendProposal": + return { + type: "cosmos-sdk/CommunityPoolSpendProposal", + value: CommunityPoolSpendProposal.toAmino(CommunityPoolSpendProposal.decode(content.value, undefined)) + }; + case "/cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit": + return { + type: "cosmos-sdk/CommunityPoolSpendProposalWithDeposit", + value: CommunityPoolSpendProposalWithDeposit.toAmino(CommunityPoolSpendProposalWithDeposit.decode(content.value, undefined)) + }; case "/cosmos.gov.v1beta1.TextProposal": return { type: "cosmos-sdk/TextProposal", value: TextProposal.toAmino(TextProposal.decode(content.value, undefined)) }; + case "/cosmos.params.v1beta1.ParameterChangeProposal": + return { + type: "cosmos-sdk/ParameterChangeProposal", + value: ParameterChangeProposal.toAmino(ParameterChangeProposal.decode(content.value, undefined)) + }; + case "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal": + return { + type: "cosmos-sdk/SoftwareUpgradeProposal", + value: SoftwareUpgradeProposal.toAmino(SoftwareUpgradeProposal.decode(content.value, undefined)) + }; + case "/cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal": + return { + type: "cosmos-sdk/CancelSoftwareUpgradeProposal", + value: CancelSoftwareUpgradeProposal.toAmino(CancelSoftwareUpgradeProposal.decode(content.value, undefined)) + }; default: return Any.toAmino(content); } diff --git a/packages/api/src/cosmos/gov/v1beta1/query.lcd.ts b/packages/api/src/cosmos/gov/v1beta1/query.lcd.ts index f7fc03c5..eaaf5b49 100644 --- a/packages/api/src/cosmos/gov/v1beta1/query.lcd.ts +++ b/packages/api/src/cosmos/gov/v1beta1/query.lcd.ts @@ -65,7 +65,7 @@ export class LCDQueryClient { const endpoint = `cosmos/gov/v1beta1/params/${params.paramsType}`; return await this.req.get(endpoint); } - /* Deposit queries single deposit information based proposalID, depositAddr. */ + /* Deposit queries single deposit information based on proposalID, depositor address. */ async deposit(params: QueryDepositRequest): Promise { const endpoint = `cosmos/gov/v1beta1/proposals/${params.proposalId}/deposits/${params.depositor}`; return await this.req.get(endpoint); diff --git a/packages/api/src/cosmos/gov/v1beta1/query.rpc.Query.ts b/packages/api/src/cosmos/gov/v1beta1/query.rpc.Query.ts index 17fd7312..b23c27ae 100644 --- a/packages/api/src/cosmos/gov/v1beta1/query.rpc.Query.ts +++ b/packages/api/src/cosmos/gov/v1beta1/query.rpc.Query.ts @@ -15,7 +15,7 @@ export interface Query { votes(request: QueryVotesRequest): Promise; /** Params queries all parameters of the gov module. */ params(request: QueryParamsRequest): Promise; - /** Deposit queries single deposit information based proposalID, depositAddr. */ + /** Deposit queries single deposit information based on proposalID, depositor address. */ deposit(request: QueryDepositRequest): Promise; /** Deposits queries all deposits of a single proposal. */ deposits(request: QueryDepositsRequest): Promise; diff --git a/packages/api/src/cosmos/gov/v1beta1/query.ts b/packages/api/src/cosmos/gov/v1beta1/query.ts index 03054c77..9c82159b 100644 --- a/packages/api/src/cosmos/gov/v1beta1/query.ts +++ b/packages/api/src/cosmos/gov/v1beta1/query.ts @@ -34,7 +34,7 @@ export interface QueryProposalResponseProtoMsg { } /** QueryProposalResponse is the response type for the Query/Proposal RPC method. */ export interface QueryProposalResponseAmino { - proposal?: ProposalAmino; + proposal: ProposalAmino; } export interface QueryProposalResponseAminoMsg { type: "cosmos-sdk/QueryProposalResponse"; @@ -86,6 +86,7 @@ export interface QueryProposalsRequestSDKType { * method. */ export interface QueryProposalsResponse { + /** proposals defines all the requested governance proposals. */ proposals: Proposal[]; /** pagination defines the pagination in the response. */ pagination?: PageResponse; @@ -99,7 +100,8 @@ export interface QueryProposalsResponseProtoMsg { * method. */ export interface QueryProposalsResponseAmino { - proposals?: ProposalAmino[]; + /** proposals defines all the requested governance proposals. */ + proposals: ProposalAmino[]; /** pagination defines the pagination in the response. */ pagination?: PageResponseAmino; } @@ -144,7 +146,7 @@ export interface QueryVoteRequestSDKType { } /** QueryVoteResponse is the response type for the Query/Vote RPC method. */ export interface QueryVoteResponse { - /** vote defined the queried vote. */ + /** vote defines the queried vote. */ vote: Vote; } export interface QueryVoteResponseProtoMsg { @@ -153,8 +155,8 @@ export interface QueryVoteResponseProtoMsg { } /** QueryVoteResponse is the response type for the Query/Vote RPC method. */ export interface QueryVoteResponseAmino { - /** vote defined the queried vote. */ - vote?: VoteAmino; + /** vote defines the queried vote. */ + vote: VoteAmino; } export interface QueryVoteResponseAminoMsg { type: "cosmos-sdk/QueryVoteResponse"; @@ -193,7 +195,7 @@ export interface QueryVotesRequestSDKType { } /** QueryVotesResponse is the response type for the Query/Votes RPC method. */ export interface QueryVotesResponse { - /** votes defined the queried votes. */ + /** votes defines the queried votes. */ votes: Vote[]; /** pagination defines the pagination in the response. */ pagination?: PageResponse; @@ -204,8 +206,8 @@ export interface QueryVotesResponseProtoMsg { } /** QueryVotesResponse is the response type for the Query/Votes RPC method. */ export interface QueryVotesResponseAmino { - /** votes defined the queried votes. */ - votes?: VoteAmino[]; + /** votes defines the queried votes. */ + votes: VoteAmino[]; /** pagination defines the pagination in the response. */ pagination?: PageResponseAmino; } @@ -262,11 +264,11 @@ export interface QueryParamsResponseProtoMsg { /** QueryParamsResponse is the response type for the Query/Params RPC method. */ export interface QueryParamsResponseAmino { /** voting_params defines the parameters related to voting. */ - voting_params?: VotingParamsAmino; + voting_params: VotingParamsAmino; /** deposit_params defines the parameters related to deposit. */ - deposit_params?: DepositParamsAmino; + deposit_params: DepositParamsAmino; /** tally_params defines the parameters related to tally. */ - tally_params?: TallyParamsAmino; + tally_params: TallyParamsAmino; } export interface QueryParamsResponseAminoMsg { type: "cosmos-sdk/QueryParamsResponse"; @@ -317,7 +319,7 @@ export interface QueryDepositResponseProtoMsg { /** QueryDepositResponse is the response type for the Query/Deposit RPC method. */ export interface QueryDepositResponseAmino { /** deposit defines the requested deposit. */ - deposit?: DepositAmino; + deposit: DepositAmino; } export interface QueryDepositResponseAminoMsg { type: "cosmos-sdk/QueryDepositResponse"; @@ -356,6 +358,7 @@ export interface QueryDepositsRequestSDKType { } /** QueryDepositsResponse is the response type for the Query/Deposits RPC method. */ export interface QueryDepositsResponse { + /** deposits defines the requested deposits. */ deposits: Deposit[]; /** pagination defines the pagination in the response. */ pagination?: PageResponse; @@ -366,7 +369,8 @@ export interface QueryDepositsResponseProtoMsg { } /** QueryDepositsResponse is the response type for the Query/Deposits RPC method. */ export interface QueryDepositsResponseAmino { - deposits?: DepositAmino[]; + /** deposits defines the requested deposits. */ + deposits: DepositAmino[]; /** pagination defines the pagination in the response. */ pagination?: PageResponseAmino; } @@ -413,7 +417,7 @@ export interface QueryTallyResultResponseProtoMsg { /** QueryTallyResultResponse is the response type for the Query/Tally RPC method. */ export interface QueryTallyResultResponseAmino { /** tally defines the requested tally. */ - tally?: TallyResultAmino; + tally: TallyResultAmino; } export interface QueryTallyResultResponseAminoMsg { type: "cosmos-sdk/QueryTallyResultResponse"; @@ -536,7 +540,7 @@ export const QueryProposalResponse = { }, toAmino(message: QueryProposalResponse): QueryProposalResponseAmino { const obj: any = {}; - obj.proposal = message.proposal ? Proposal.toAmino(message.proposal) : undefined; + obj.proposal = message.proposal ? Proposal.toAmino(message.proposal) : Proposal.toAmino(Proposal.fromPartial({})); return obj; }, fromAminoMsg(object: QueryProposalResponseAminoMsg): QueryProposalResponse { @@ -874,7 +878,7 @@ export const QueryVoteResponse = { }, toAmino(message: QueryVoteResponse): QueryVoteResponseAmino { const obj: any = {}; - obj.vote = message.vote ? Vote.toAmino(message.vote) : undefined; + obj.vote = message.vote ? Vote.toAmino(message.vote) : Vote.toAmino(Vote.fromPartial({})); return obj; }, fromAminoMsg(object: QueryVoteResponseAminoMsg): QueryVoteResponse { @@ -1198,9 +1202,9 @@ export const QueryParamsResponse = { }, toAmino(message: QueryParamsResponse): QueryParamsResponseAmino { const obj: any = {}; - obj.voting_params = message.votingParams ? VotingParams.toAmino(message.votingParams) : undefined; - obj.deposit_params = message.depositParams ? DepositParams.toAmino(message.depositParams) : undefined; - obj.tally_params = message.tallyParams ? TallyParams.toAmino(message.tallyParams) : undefined; + obj.voting_params = message.votingParams ? VotingParams.toAmino(message.votingParams) : VotingParams.toAmino(VotingParams.fromPartial({})); + obj.deposit_params = message.depositParams ? DepositParams.toAmino(message.depositParams) : DepositParams.toAmino(DepositParams.fromPartial({})); + obj.tally_params = message.tallyParams ? TallyParams.toAmino(message.tallyParams) : TallyParams.toAmino(TallyParams.fromPartial({})); return obj; }, fromAminoMsg(object: QueryParamsResponseAminoMsg): QueryParamsResponse { @@ -1350,7 +1354,7 @@ export const QueryDepositResponse = { }, toAmino(message: QueryDepositResponse): QueryDepositResponseAmino { const obj: any = {}; - obj.deposit = message.deposit ? Deposit.toAmino(message.deposit) : undefined; + obj.deposit = message.deposit ? Deposit.toAmino(message.deposit) : Deposit.toAmino(Deposit.fromPartial({})); return obj; }, fromAminoMsg(object: QueryDepositResponseAminoMsg): QueryDepositResponse { @@ -1652,7 +1656,7 @@ export const QueryTallyResultResponse = { }, toAmino(message: QueryTallyResultResponse): QueryTallyResultResponseAmino { const obj: any = {}; - obj.tally = message.tally ? TallyResult.toAmino(message.tally) : undefined; + obj.tally = message.tally ? TallyResult.toAmino(message.tally) : TallyResult.toAmino(TallyResult.fromPartial({})); return obj; }, fromAminoMsg(object: QueryTallyResultResponseAminoMsg): QueryTallyResultResponse { diff --git a/packages/api/src/cosmos/gov/v1beta1/tx.rpc.msg.ts b/packages/api/src/cosmos/gov/v1beta1/tx.rpc.msg.ts index 92c3feaa..f2b278fb 100644 --- a/packages/api/src/cosmos/gov/v1beta1/tx.rpc.msg.ts +++ b/packages/api/src/cosmos/gov/v1beta1/tx.rpc.msg.ts @@ -2,17 +2,13 @@ import { Rpc } from "../../../helpers"; import { BinaryReader } from "../../../binary"; import { MsgSubmitProposal, MsgSubmitProposalResponse, MsgVote, MsgVoteResponse, MsgVoteWeighted, MsgVoteWeightedResponse, MsgDeposit, MsgDepositResponse } from "./tx"; -/** Msg defines the bank Msg service. */ +/** Msg defines the gov Msg service. */ export interface Msg { /** SubmitProposal defines a method to create new proposal given a content. */ submitProposal(request: MsgSubmitProposal): Promise; /** Vote defines a method to add a vote on a specific proposal. */ vote(request: MsgVote): Promise; - /** - * VoteWeighted defines a method to add a weighted vote on a specific proposal. - * - * Since: cosmos-sdk 0.43 - */ + /** VoteWeighted defines a method to add a weighted vote on a specific proposal. */ voteWeighted(request: MsgVoteWeighted): Promise; /** Deposit defines a method to add deposit on a specific proposal. */ deposit(request: MsgDeposit): Promise; diff --git a/packages/api/src/cosmos/gov/v1beta1/tx.ts b/packages/api/src/cosmos/gov/v1beta1/tx.ts index 11f67ebf..af8e5e79 100644 --- a/packages/api/src/cosmos/gov/v1beta1/tx.ts +++ b/packages/api/src/cosmos/gov/v1beta1/tx.ts @@ -2,14 +2,20 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { VoteOption, WeightedVoteOption, WeightedVoteOptionAmino, WeightedVoteOptionSDKType, TextProposal, TextProposalProtoMsg, TextProposalSDKType } from "./gov"; +import { CommunityPoolSpendProposal, CommunityPoolSpendProposalProtoMsg, CommunityPoolSpendProposalSDKType, CommunityPoolSpendProposalWithDeposit, CommunityPoolSpendProposalWithDepositProtoMsg, CommunityPoolSpendProposalWithDepositSDKType } from "../../distribution/v1beta1/distribution"; +import { ParameterChangeProposal, ParameterChangeProposalProtoMsg, ParameterChangeProposalSDKType } from "../../params/v1beta1/params"; +import { SoftwareUpgradeProposal, SoftwareUpgradeProposalProtoMsg, SoftwareUpgradeProposalSDKType, CancelSoftwareUpgradeProposal, CancelSoftwareUpgradeProposalProtoMsg, CancelSoftwareUpgradeProposalSDKType } from "../../upgrade/v1beta1/upgrade"; import { BinaryReader, BinaryWriter } from "../../../binary"; /** * MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary * proposal Content. */ export interface MsgSubmitProposal { - content?: TextProposal | Any | undefined; + /** content is the proposal's content. */ + content?: CommunityPoolSpendProposal | CommunityPoolSpendProposalWithDeposit | TextProposal | ParameterChangeProposal | SoftwareUpgradeProposal | CancelSoftwareUpgradeProposal | Any | undefined; + /** initial_deposit is the deposit value that must be paid at proposal submission. */ initialDeposit: Coin[]; + /** proposer is the account address of the proposer. */ proposer: string; } export interface MsgSubmitProposalProtoMsg { @@ -17,15 +23,18 @@ export interface MsgSubmitProposalProtoMsg { value: Uint8Array; } export type MsgSubmitProposalEncoded = Omit & { - content?: TextProposalProtoMsg | AnyProtoMsg | undefined; + /** content is the proposal's content. */content?: CommunityPoolSpendProposalProtoMsg | CommunityPoolSpendProposalWithDepositProtoMsg | TextProposalProtoMsg | ParameterChangeProposalProtoMsg | SoftwareUpgradeProposalProtoMsg | CancelSoftwareUpgradeProposalProtoMsg | AnyProtoMsg | undefined; }; /** * MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary * proposal Content. */ export interface MsgSubmitProposalAmino { + /** content is the proposal's content. */ content?: AnyAmino; - initial_deposit?: CoinAmino[]; + /** initial_deposit is the deposit value that must be paid at proposal submission. */ + initial_deposit: CoinAmino[]; + /** proposer is the account address of the proposer. */ proposer?: string; } export interface MsgSubmitProposalAminoMsg { @@ -37,12 +46,13 @@ export interface MsgSubmitProposalAminoMsg { * proposal Content. */ export interface MsgSubmitProposalSDKType { - content?: TextProposalSDKType | AnySDKType | undefined; + content?: CommunityPoolSpendProposalSDKType | CommunityPoolSpendProposalWithDepositSDKType | TextProposalSDKType | ParameterChangeProposalSDKType | SoftwareUpgradeProposalSDKType | CancelSoftwareUpgradeProposalSDKType | AnySDKType | undefined; initial_deposit: CoinSDKType[]; proposer: string; } /** MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. */ export interface MsgSubmitProposalResponse { + /** proposal_id defines the unique id of the proposal. */ proposalId: bigint; } export interface MsgSubmitProposalResponseProtoMsg { @@ -51,6 +61,7 @@ export interface MsgSubmitProposalResponseProtoMsg { } /** MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. */ export interface MsgSubmitProposalResponseAmino { + /** proposal_id defines the unique id of the proposal. */ proposal_id: string; } export interface MsgSubmitProposalResponseAminoMsg { @@ -63,8 +74,11 @@ export interface MsgSubmitProposalResponseSDKType { } /** MsgVote defines a message to cast a vote. */ export interface MsgVote { + /** proposal_id defines the unique id of the proposal. */ proposalId: bigint; + /** voter is the voter address for the proposal. */ voter: string; + /** option defines the vote option. */ option: VoteOption; } export interface MsgVoteProtoMsg { @@ -73,8 +87,11 @@ export interface MsgVoteProtoMsg { } /** MsgVote defines a message to cast a vote. */ export interface MsgVoteAmino { + /** proposal_id defines the unique id of the proposal. */ proposal_id?: string; + /** voter is the voter address for the proposal. */ voter?: string; + /** option defines the vote option. */ option?: VoteOption; } export interface MsgVoteAminoMsg { @@ -101,74 +118,59 @@ export interface MsgVoteResponseAminoMsg { } /** MsgVoteResponse defines the Msg/Vote response type. */ export interface MsgVoteResponseSDKType {} -/** - * MsgVoteWeighted defines a message to cast a vote. - * - * Since: cosmos-sdk 0.43 - */ +/** MsgVoteWeighted defines a message to cast a vote. */ export interface MsgVoteWeighted { + /** proposal_id defines the unique id of the proposal. */ proposalId: bigint; + /** voter is the voter address for the proposal. */ voter: string; + /** options defines the weighted vote options. */ options: WeightedVoteOption[]; } export interface MsgVoteWeightedProtoMsg { typeUrl: "/cosmos.gov.v1beta1.MsgVoteWeighted"; value: Uint8Array; } -/** - * MsgVoteWeighted defines a message to cast a vote. - * - * Since: cosmos-sdk 0.43 - */ +/** MsgVoteWeighted defines a message to cast a vote. */ export interface MsgVoteWeightedAmino { + /** proposal_id defines the unique id of the proposal. */ proposal_id: string; + /** voter is the voter address for the proposal. */ voter?: string; - options?: WeightedVoteOptionAmino[]; + /** options defines the weighted vote options. */ + options: WeightedVoteOptionAmino[]; } export interface MsgVoteWeightedAminoMsg { type: "cosmos-sdk/MsgVoteWeighted"; value: MsgVoteWeightedAmino; } -/** - * MsgVoteWeighted defines a message to cast a vote. - * - * Since: cosmos-sdk 0.43 - */ +/** MsgVoteWeighted defines a message to cast a vote. */ export interface MsgVoteWeightedSDKType { proposal_id: bigint; voter: string; options: WeightedVoteOptionSDKType[]; } -/** - * MsgVoteWeightedResponse defines the Msg/VoteWeighted response type. - * - * Since: cosmos-sdk 0.43 - */ +/** MsgVoteWeightedResponse defines the Msg/VoteWeighted response type. */ export interface MsgVoteWeightedResponse {} export interface MsgVoteWeightedResponseProtoMsg { typeUrl: "/cosmos.gov.v1beta1.MsgVoteWeightedResponse"; value: Uint8Array; } -/** - * MsgVoteWeightedResponse defines the Msg/VoteWeighted response type. - * - * Since: cosmos-sdk 0.43 - */ +/** MsgVoteWeightedResponse defines the Msg/VoteWeighted response type. */ export interface MsgVoteWeightedResponseAmino {} export interface MsgVoteWeightedResponseAminoMsg { type: "cosmos-sdk/MsgVoteWeightedResponse"; value: MsgVoteWeightedResponseAmino; } -/** - * MsgVoteWeightedResponse defines the Msg/VoteWeighted response type. - * - * Since: cosmos-sdk 0.43 - */ +/** MsgVoteWeightedResponse defines the Msg/VoteWeighted response type. */ export interface MsgVoteWeightedResponseSDKType {} /** MsgDeposit defines a message to submit a deposit to an existing proposal. */ export interface MsgDeposit { + /** proposal_id defines the unique id of the proposal. */ proposalId: bigint; + /** depositor defines the deposit addresses from the proposals. */ depositor: string; + /** amount to be deposited by depositor. */ amount: Coin[]; } export interface MsgDepositProtoMsg { @@ -177,9 +179,12 @@ export interface MsgDepositProtoMsg { } /** MsgDeposit defines a message to submit a deposit to an existing proposal. */ export interface MsgDepositAmino { + /** proposal_id defines the unique id of the proposal. */ proposal_id: string; + /** depositor defines the deposit addresses from the proposals. */ depositor?: string; - amount?: CoinAmino[]; + /** amount to be deposited by depositor. */ + amount: CoinAmino[]; } export interface MsgDepositAminoMsg { type: "cosmos-sdk/MsgDeposit"; @@ -234,7 +239,7 @@ export const MsgSubmitProposal = { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.content = (Content_InterfaceDecoder(reader) as Any); + message.content = (Cosmos_govv1beta1Content_InterfaceDecoder(reader) as Any); break; case 2: message.initialDeposit.push(Coin.decode(reader, reader.uint32())); @@ -259,7 +264,7 @@ export const MsgSubmitProposal = { fromAmino(object: MsgSubmitProposalAmino): MsgSubmitProposal { const message = createBaseMsgSubmitProposal(); if (object.content !== undefined && object.content !== null) { - message.content = Content_FromAmino(object.content); + message.content = Cosmos_govv1beta1Content_FromAmino(object.content); } message.initialDeposit = object.initial_deposit?.map(e => Coin.fromAmino(e)) || []; if (object.proposer !== undefined && object.proposer !== null) { @@ -269,7 +274,7 @@ export const MsgSubmitProposal = { }, toAmino(message: MsgSubmitProposal): MsgSubmitProposalAmino { const obj: any = {}; - obj.content = message.content ? Content_ToAmino((message.content as Any)) : undefined; + obj.content = message.content ? Cosmos_govv1beta1Content_ToAmino((message.content as Any)) : undefined; if (message.initialDeposit) { obj.initial_deposit = message.initialDeposit.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -820,34 +825,94 @@ export const MsgDepositResponse = { }; } }; -export const Content_InterfaceDecoder = (input: BinaryReader | Uint8Array): TextProposal | Any => { +export const Cosmos_govv1beta1Content_InterfaceDecoder = (input: BinaryReader | Uint8Array): CommunityPoolSpendProposal | CommunityPoolSpendProposalWithDeposit | TextProposal | ParameterChangeProposal | SoftwareUpgradeProposal | CancelSoftwareUpgradeProposal | Any => { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const data = Any.decode(reader, reader.uint32()); switch (data.typeUrl) { + case "/cosmos.distribution.v1beta1.CommunityPoolSpendProposal": + return CommunityPoolSpendProposal.decode(data.value); + case "/cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit": + return CommunityPoolSpendProposalWithDeposit.decode(data.value); case "/cosmos.gov.v1beta1.TextProposal": return TextProposal.decode(data.value); + case "/cosmos.params.v1beta1.ParameterChangeProposal": + return ParameterChangeProposal.decode(data.value); + case "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal": + return SoftwareUpgradeProposal.decode(data.value); + case "/cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal": + return CancelSoftwareUpgradeProposal.decode(data.value); default: return data; } }; -export const Content_FromAmino = (content: AnyAmino): Any => { +export const Cosmos_govv1beta1Content_FromAmino = (content: AnyAmino): Any => { switch (content.type) { + case "cosmos-sdk/CommunityPoolSpendProposal": + return Any.fromPartial({ + typeUrl: "/cosmos.distribution.v1beta1.CommunityPoolSpendProposal", + value: CommunityPoolSpendProposal.encode(CommunityPoolSpendProposal.fromPartial(CommunityPoolSpendProposal.fromAmino(content.value))).finish() + }); + case "cosmos-sdk/CommunityPoolSpendProposalWithDeposit": + return Any.fromPartial({ + typeUrl: "/cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit", + value: CommunityPoolSpendProposalWithDeposit.encode(CommunityPoolSpendProposalWithDeposit.fromPartial(CommunityPoolSpendProposalWithDeposit.fromAmino(content.value))).finish() + }); case "cosmos-sdk/TextProposal": return Any.fromPartial({ typeUrl: "/cosmos.gov.v1beta1.TextProposal", value: TextProposal.encode(TextProposal.fromPartial(TextProposal.fromAmino(content.value))).finish() }); + case "cosmos-sdk/ParameterChangeProposal": + return Any.fromPartial({ + typeUrl: "/cosmos.params.v1beta1.ParameterChangeProposal", + value: ParameterChangeProposal.encode(ParameterChangeProposal.fromPartial(ParameterChangeProposal.fromAmino(content.value))).finish() + }); + case "cosmos-sdk/SoftwareUpgradeProposal": + return Any.fromPartial({ + typeUrl: "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal", + value: SoftwareUpgradeProposal.encode(SoftwareUpgradeProposal.fromPartial(SoftwareUpgradeProposal.fromAmino(content.value))).finish() + }); + case "cosmos-sdk/CancelSoftwareUpgradeProposal": + return Any.fromPartial({ + typeUrl: "/cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal", + value: CancelSoftwareUpgradeProposal.encode(CancelSoftwareUpgradeProposal.fromPartial(CancelSoftwareUpgradeProposal.fromAmino(content.value))).finish() + }); default: return Any.fromAmino(content); } }; -export const Content_ToAmino = (content: Any) => { +export const Cosmos_govv1beta1Content_ToAmino = (content: Any) => { switch (content.typeUrl) { + case "/cosmos.distribution.v1beta1.CommunityPoolSpendProposal": + return { + type: "cosmos-sdk/CommunityPoolSpendProposal", + value: CommunityPoolSpendProposal.toAmino(CommunityPoolSpendProposal.decode(content.value, undefined)) + }; + case "/cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit": + return { + type: "cosmos-sdk/CommunityPoolSpendProposalWithDeposit", + value: CommunityPoolSpendProposalWithDeposit.toAmino(CommunityPoolSpendProposalWithDeposit.decode(content.value, undefined)) + }; case "/cosmos.gov.v1beta1.TextProposal": return { type: "cosmos-sdk/TextProposal", value: TextProposal.toAmino(TextProposal.decode(content.value, undefined)) }; + case "/cosmos.params.v1beta1.ParameterChangeProposal": + return { + type: "cosmos-sdk/ParameterChangeProposal", + value: ParameterChangeProposal.toAmino(ParameterChangeProposal.decode(content.value, undefined)) + }; + case "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal": + return { + type: "cosmos-sdk/SoftwareUpgradeProposal", + value: SoftwareUpgradeProposal.toAmino(SoftwareUpgradeProposal.decode(content.value, undefined)) + }; + case "/cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal": + return { + type: "cosmos-sdk/CancelSoftwareUpgradeProposal", + value: CancelSoftwareUpgradeProposal.toAmino(CancelSoftwareUpgradeProposal.decode(content.value, undefined)) + }; default: return Any.toAmino(content); } diff --git a/packages/api/src/cosmos/group/module/v1/module.ts b/packages/api/src/cosmos/group/module/v1/module.ts new file mode 100644 index 00000000..1b378604 --- /dev/null +++ b/packages/api/src/cosmos/group/module/v1/module.ts @@ -0,0 +1,123 @@ +//@ts-nocheck +import { Duration, DurationAmino, DurationSDKType } from "../../../../google/protobuf/duration"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +/** Module is the config object of the group module. */ +export interface Module { + /** + * max_execution_period defines the max duration after a proposal's voting period ends that members can send a MsgExec + * to execute the proposal. + */ + maxExecutionPeriod: Duration; + /** + * max_metadata_len defines the max length of the metadata bytes field for various entities within the group module. + * Defaults to 255 if not explicitly set. + */ + maxMetadataLen: bigint; +} +export interface ModuleProtoMsg { + typeUrl: "/cosmos.group.module.v1.Module"; + value: Uint8Array; +} +/** Module is the config object of the group module. */ +export interface ModuleAmino { + /** + * max_execution_period defines the max duration after a proposal's voting period ends that members can send a MsgExec + * to execute the proposal. + */ + max_execution_period: DurationAmino; + /** + * max_metadata_len defines the max length of the metadata bytes field for various entities within the group module. + * Defaults to 255 if not explicitly set. + */ + max_metadata_len?: string; +} +export interface ModuleAminoMsg { + type: "cosmos-sdk/Module"; + value: ModuleAmino; +} +/** Module is the config object of the group module. */ +export interface ModuleSDKType { + max_execution_period: DurationSDKType; + max_metadata_len: bigint; +} +function createBaseModule(): Module { + return { + maxExecutionPeriod: Duration.fromPartial({}), + maxMetadataLen: BigInt(0) + }; +} +export const Module = { + typeUrl: "/cosmos.group.module.v1.Module", + encode(message: Module, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.maxExecutionPeriod !== undefined) { + Duration.encode(message.maxExecutionPeriod, writer.uint32(10).fork()).ldelim(); + } + if (message.maxMetadataLen !== BigInt(0)) { + writer.uint32(16).uint64(message.maxMetadataLen); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.maxExecutionPeriod = Duration.decode(reader, reader.uint32()); + break; + case 2: + message.maxMetadataLen = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): Module { + const message = createBaseModule(); + message.maxExecutionPeriod = object.maxExecutionPeriod !== undefined && object.maxExecutionPeriod !== null ? Duration.fromPartial(object.maxExecutionPeriod) : undefined; + message.maxMetadataLen = object.maxMetadataLen !== undefined && object.maxMetadataLen !== null ? BigInt(object.maxMetadataLen.toString()) : BigInt(0); + return message; + }, + fromAmino(object: ModuleAmino): Module { + const message = createBaseModule(); + if (object.max_execution_period !== undefined && object.max_execution_period !== null) { + message.maxExecutionPeriod = Duration.fromAmino(object.max_execution_period); + } + if (object.max_metadata_len !== undefined && object.max_metadata_len !== null) { + message.maxMetadataLen = BigInt(object.max_metadata_len); + } + return message; + }, + toAmino(message: Module): ModuleAmino { + const obj: any = {}; + obj.max_execution_period = message.maxExecutionPeriod ? Duration.toAmino(message.maxExecutionPeriod) : Duration.toAmino(Duration.fromPartial({})); + obj.max_metadata_len = message.maxMetadataLen !== BigInt(0) ? message.maxMetadataLen?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ModuleAminoMsg): Module { + return Module.fromAmino(object.value); + }, + toAminoMsg(message: Module): ModuleAminoMsg { + return { + type: "cosmos-sdk/Module", + value: Module.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleProtoMsg): Module { + return Module.decode(message.value); + }, + toProto(message: Module): Uint8Array { + return Module.encode(message).finish(); + }, + toProtoMsg(message: Module): ModuleProtoMsg { + return { + typeUrl: "/cosmos.group.module.v1.Module", + value: Module.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/group/v1/events.ts b/packages/api/src/cosmos/group/v1/events.ts index 5c1c7b91..29c268d7 100644 --- a/packages/api/src/cosmos/group/v1/events.ts +++ b/packages/api/src/cosmos/group/v1/events.ts @@ -1,5 +1,5 @@ //@ts-nocheck -import { ProposalExecutorResult } from "./types"; +import { ProposalExecutorResult, ProposalStatus, TallyResult, TallyResultAmino, TallyResultSDKType } from "./types"; import { BinaryReader, BinaryWriter } from "../../../binary"; /** EventCreateGroup is an event emitted when a group is created. */ export interface EventCreateGroup { @@ -214,6 +214,65 @@ export interface EventLeaveGroupSDKType { group_id: bigint; address: string; } +/** EventProposalPruned is an event emitted when a proposal is pruned. */ +export interface EventProposalPruned { + /** proposal_id is the unique ID of the proposal. */ + proposalId: bigint; + /** status is the proposal status (UNSPECIFIED, SUBMITTED, ACCEPTED, REJECTED, ABORTED, WITHDRAWN). */ + status: ProposalStatus; + /** tally_result is the proposal tally result (when applicable). */ + tallyResult?: TallyResult; +} +export interface EventProposalPrunedProtoMsg { + typeUrl: "/cosmos.group.v1.EventProposalPruned"; + value: Uint8Array; +} +/** EventProposalPruned is an event emitted when a proposal is pruned. */ +export interface EventProposalPrunedAmino { + /** proposal_id is the unique ID of the proposal. */ + proposal_id?: string; + /** status is the proposal status (UNSPECIFIED, SUBMITTED, ACCEPTED, REJECTED, ABORTED, WITHDRAWN). */ + status?: ProposalStatus; + /** tally_result is the proposal tally result (when applicable). */ + tally_result?: TallyResultAmino; +} +export interface EventProposalPrunedAminoMsg { + type: "cosmos-sdk/EventProposalPruned"; + value: EventProposalPrunedAmino; +} +/** EventProposalPruned is an event emitted when a proposal is pruned. */ +export interface EventProposalPrunedSDKType { + proposal_id: bigint; + status: ProposalStatus; + tally_result?: TallyResultSDKType; +} +/** EventTallyError is an event emitted when a proposal tally failed with an error. */ +export interface EventTallyError { + /** proposal_id is the unique ID of the proposal. */ + proposalId: bigint; + /** error_message is the raw error output */ + errorMessage: string; +} +export interface EventTallyErrorProtoMsg { + typeUrl: "/cosmos.group.v1.EventTallyError"; + value: Uint8Array; +} +/** EventTallyError is an event emitted when a proposal tally failed with an error. */ +export interface EventTallyErrorAmino { + /** proposal_id is the unique ID of the proposal. */ + proposal_id?: string; + /** error_message is the raw error output */ + error_message?: string; +} +export interface EventTallyErrorAminoMsg { + type: "cosmos-sdk/EventTallyError"; + value: EventTallyErrorAmino; +} +/** EventTallyError is an event emitted when a proposal tally failed with an error. */ +export interface EventTallyErrorSDKType { + proposal_id: bigint; + error_message: string; +} function createBaseEventCreateGroup(): EventCreateGroup { return { groupId: BigInt(0) @@ -870,4 +929,178 @@ export const EventLeaveGroup = { value: EventLeaveGroup.encode(message).finish() }; } +}; +function createBaseEventProposalPruned(): EventProposalPruned { + return { + proposalId: BigInt(0), + status: 0, + tallyResult: undefined + }; +} +export const EventProposalPruned = { + typeUrl: "/cosmos.group.v1.EventProposalPruned", + encode(message: EventProposalPruned, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.status !== 0) { + writer.uint32(16).int32(message.status); + } + if (message.tallyResult !== undefined) { + TallyResult.encode(message.tallyResult, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): EventProposalPruned { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventProposalPruned(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.status = (reader.int32() as any); + break; + case 3: + message.tallyResult = TallyResult.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): EventProposalPruned { + const message = createBaseEventProposalPruned(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + message.status = object.status ?? 0; + message.tallyResult = object.tallyResult !== undefined && object.tallyResult !== null ? TallyResult.fromPartial(object.tallyResult) : undefined; + return message; + }, + fromAmino(object: EventProposalPrunedAmino): EventProposalPruned { + const message = createBaseEventProposalPruned(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.status !== undefined && object.status !== null) { + message.status = object.status; + } + if (object.tally_result !== undefined && object.tally_result !== null) { + message.tallyResult = TallyResult.fromAmino(object.tally_result); + } + return message; + }, + toAmino(message: EventProposalPruned): EventProposalPrunedAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId?.toString() : undefined; + obj.status = message.status === 0 ? undefined : message.status; + obj.tally_result = message.tallyResult ? TallyResult.toAmino(message.tallyResult) : undefined; + return obj; + }, + fromAminoMsg(object: EventProposalPrunedAminoMsg): EventProposalPruned { + return EventProposalPruned.fromAmino(object.value); + }, + toAminoMsg(message: EventProposalPruned): EventProposalPrunedAminoMsg { + return { + type: "cosmos-sdk/EventProposalPruned", + value: EventProposalPruned.toAmino(message) + }; + }, + fromProtoMsg(message: EventProposalPrunedProtoMsg): EventProposalPruned { + return EventProposalPruned.decode(message.value); + }, + toProto(message: EventProposalPruned): Uint8Array { + return EventProposalPruned.encode(message).finish(); + }, + toProtoMsg(message: EventProposalPruned): EventProposalPrunedProtoMsg { + return { + typeUrl: "/cosmos.group.v1.EventProposalPruned", + value: EventProposalPruned.encode(message).finish() + }; + } +}; +function createBaseEventTallyError(): EventTallyError { + return { + proposalId: BigInt(0), + errorMessage: "" + }; +} +export const EventTallyError = { + typeUrl: "/cosmos.group.v1.EventTallyError", + encode(message: EventTallyError, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.errorMessage !== "") { + writer.uint32(18).string(message.errorMessage); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): EventTallyError { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventTallyError(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.errorMessage = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): EventTallyError { + const message = createBaseEventTallyError(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + message.errorMessage = object.errorMessage ?? ""; + return message; + }, + fromAmino(object: EventTallyErrorAmino): EventTallyError { + const message = createBaseEventTallyError(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.error_message !== undefined && object.error_message !== null) { + message.errorMessage = object.error_message; + } + return message; + }, + toAmino(message: EventTallyError): EventTallyErrorAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId?.toString() : undefined; + obj.error_message = message.errorMessage === "" ? undefined : message.errorMessage; + return obj; + }, + fromAminoMsg(object: EventTallyErrorAminoMsg): EventTallyError { + return EventTallyError.fromAmino(object.value); + }, + toAminoMsg(message: EventTallyError): EventTallyErrorAminoMsg { + return { + type: "cosmos-sdk/EventTallyError", + value: EventTallyError.toAmino(message) + }; + }, + fromProtoMsg(message: EventTallyErrorProtoMsg): EventTallyError { + return EventTallyError.decode(message.value); + }, + toProto(message: EventTallyError): Uint8Array { + return EventTallyError.encode(message).finish(); + }, + toProtoMsg(message: EventTallyError): EventTallyErrorProtoMsg { + return { + typeUrl: "/cosmos.group.v1.EventTallyError", + value: EventTallyError.encode(message).finish() + }; + } }; \ No newline at end of file diff --git a/packages/api/src/cosmos/group/v1/query.lcd.ts b/packages/api/src/cosmos/group/v1/query.lcd.ts index 56af4985..808ab1e5 100644 --- a/packages/api/src/cosmos/group/v1/query.lcd.ts +++ b/packages/api/src/cosmos/group/v1/query.lcd.ts @@ -1,7 +1,7 @@ //@ts-nocheck import { setPaginationParams } from "../../../helpers"; import { LCDClient } from "@cosmology/lcd"; -import { QueryGroupInfoRequest, QueryGroupInfoResponseSDKType, QueryGroupPolicyInfoRequest, QueryGroupPolicyInfoResponseSDKType, QueryGroupMembersRequest, QueryGroupMembersResponseSDKType, QueryGroupsByAdminRequest, QueryGroupsByAdminResponseSDKType, QueryGroupPoliciesByGroupRequest, QueryGroupPoliciesByGroupResponseSDKType, QueryGroupPoliciesByAdminRequest, QueryGroupPoliciesByAdminResponseSDKType, QueryProposalRequest, QueryProposalResponseSDKType, QueryProposalsByGroupPolicyRequest, QueryProposalsByGroupPolicyResponseSDKType, QueryVoteByProposalVoterRequest, QueryVoteByProposalVoterResponseSDKType, QueryVotesByProposalRequest, QueryVotesByProposalResponseSDKType, QueryVotesByVoterRequest, QueryVotesByVoterResponseSDKType, QueryGroupsByMemberRequest, QueryGroupsByMemberResponseSDKType, QueryTallyResultRequest, QueryTallyResultResponseSDKType } from "./query"; +import { QueryGroupInfoRequest, QueryGroupInfoResponseSDKType, QueryGroupPolicyInfoRequest, QueryGroupPolicyInfoResponseSDKType, QueryGroupMembersRequest, QueryGroupMembersResponseSDKType, QueryGroupsByAdminRequest, QueryGroupsByAdminResponseSDKType, QueryGroupPoliciesByGroupRequest, QueryGroupPoliciesByGroupResponseSDKType, QueryGroupPoliciesByAdminRequest, QueryGroupPoliciesByAdminResponseSDKType, QueryProposalRequest, QueryProposalResponseSDKType, QueryProposalsByGroupPolicyRequest, QueryProposalsByGroupPolicyResponseSDKType, QueryVoteByProposalVoterRequest, QueryVoteByProposalVoterResponseSDKType, QueryVotesByProposalRequest, QueryVotesByProposalResponseSDKType, QueryVotesByVoterRequest, QueryVotesByVoterResponseSDKType, QueryGroupsByMemberRequest, QueryGroupsByMemberResponseSDKType, QueryTallyResultRequest, QueryTallyResultResponseSDKType, QueryGroupsRequest, QueryGroupsResponseSDKType } from "./query"; export class LCDQueryClient { req: LCDClient; constructor({ @@ -23,6 +23,7 @@ export class LCDQueryClient { this.votesByVoter = this.votesByVoter.bind(this); this.groupsByMember = this.groupsByMember.bind(this); this.tallyResult = this.tallyResult.bind(this); + this.groups = this.groups.bind(this); } /* GroupInfo queries group info based on group id. */ async groupInfo(params: QueryGroupInfoRequest): Promise { @@ -34,7 +35,7 @@ export class LCDQueryClient { const endpoint = `cosmos/group/v1/group_policy_info/${params.address}`; return await this.req.get(endpoint); } - /* GroupMembers queries members of a group */ + /* GroupMembers queries members of a group by group id. */ async groupMembers(params: QueryGroupMembersRequest): Promise { const options: any = { params: {} @@ -67,7 +68,7 @@ export class LCDQueryClient { const endpoint = `cosmos/group/v1/group_policies_by_group/${params.groupId}`; return await this.req.get(endpoint, options); } - /* GroupsByAdmin queries group policies by admin address. */ + /* GroupPoliciesByAdmin queries group policies by admin address. */ async groupPoliciesByAdmin(params: QueryGroupPoliciesByAdminRequest): Promise { const options: any = { params: {} @@ -99,7 +100,7 @@ export class LCDQueryClient { const endpoint = `cosmos/group/v1/vote_by_proposal_voter/${params.proposalId}/${params.voter}`; return await this.req.get(endpoint); } - /* VotesByProposal queries a vote by proposal. */ + /* VotesByProposal queries a vote by proposal id. */ async votesByProposal(params: QueryVotesByProposalRequest): Promise { const options: any = { params: {} @@ -141,4 +142,17 @@ export class LCDQueryClient { const endpoint = `cosmos/group/v1/proposals/${params.proposalId}/tally`; return await this.req.get(endpoint); } + /* Groups queries all groups in state. */ + async groups(params: QueryGroupsRequest = { + pagination: undefined + }): Promise { + const options: any = { + params: {} + }; + if (typeof params?.pagination !== "undefined") { + setPaginationParams(options, params.pagination); + } + const endpoint = `cosmos/group/v1/groups`; + return await this.req.get(endpoint, options); + } } \ No newline at end of file diff --git a/packages/api/src/cosmos/group/v1/query.rpc.Query.ts b/packages/api/src/cosmos/group/v1/query.rpc.Query.ts index 3244771b..b198b1d5 100644 --- a/packages/api/src/cosmos/group/v1/query.rpc.Query.ts +++ b/packages/api/src/cosmos/group/v1/query.rpc.Query.ts @@ -2,20 +2,20 @@ import { Rpc } from "../../../helpers"; import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryGroupInfoRequest, QueryGroupInfoResponse, QueryGroupPolicyInfoRequest, QueryGroupPolicyInfoResponse, QueryGroupMembersRequest, QueryGroupMembersResponse, QueryGroupsByAdminRequest, QueryGroupsByAdminResponse, QueryGroupPoliciesByGroupRequest, QueryGroupPoliciesByGroupResponse, QueryGroupPoliciesByAdminRequest, QueryGroupPoliciesByAdminResponse, QueryProposalRequest, QueryProposalResponse, QueryProposalsByGroupPolicyRequest, QueryProposalsByGroupPolicyResponse, QueryVoteByProposalVoterRequest, QueryVoteByProposalVoterResponse, QueryVotesByProposalRequest, QueryVotesByProposalResponse, QueryVotesByVoterRequest, QueryVotesByVoterResponse, QueryGroupsByMemberRequest, QueryGroupsByMemberResponse, QueryTallyResultRequest, QueryTallyResultResponse } from "./query"; +import { QueryGroupInfoRequest, QueryGroupInfoResponse, QueryGroupPolicyInfoRequest, QueryGroupPolicyInfoResponse, QueryGroupMembersRequest, QueryGroupMembersResponse, QueryGroupsByAdminRequest, QueryGroupsByAdminResponse, QueryGroupPoliciesByGroupRequest, QueryGroupPoliciesByGroupResponse, QueryGroupPoliciesByAdminRequest, QueryGroupPoliciesByAdminResponse, QueryProposalRequest, QueryProposalResponse, QueryProposalsByGroupPolicyRequest, QueryProposalsByGroupPolicyResponse, QueryVoteByProposalVoterRequest, QueryVoteByProposalVoterResponse, QueryVotesByProposalRequest, QueryVotesByProposalResponse, QueryVotesByVoterRequest, QueryVotesByVoterResponse, QueryGroupsByMemberRequest, QueryGroupsByMemberResponse, QueryTallyResultRequest, QueryTallyResultResponse, QueryGroupsRequest, QueryGroupsResponse } from "./query"; /** Query is the cosmos.group.v1 Query service. */ export interface Query { /** GroupInfo queries group info based on group id. */ groupInfo(request: QueryGroupInfoRequest): Promise; /** GroupPolicyInfo queries group policy info based on account address of group policy. */ groupPolicyInfo(request: QueryGroupPolicyInfoRequest): Promise; - /** GroupMembers queries members of a group */ + /** GroupMembers queries members of a group by group id. */ groupMembers(request: QueryGroupMembersRequest): Promise; /** GroupsByAdmin queries groups by admin address. */ groupsByAdmin(request: QueryGroupsByAdminRequest): Promise; /** GroupPoliciesByGroup queries group policies by group id. */ groupPoliciesByGroup(request: QueryGroupPoliciesByGroupRequest): Promise; - /** GroupsByAdmin queries group policies by admin address. */ + /** GroupPoliciesByAdmin queries group policies by admin address. */ groupPoliciesByAdmin(request: QueryGroupPoliciesByAdminRequest): Promise; /** Proposal queries a proposal based on proposal id. */ proposal(request: QueryProposalRequest): Promise; @@ -23,7 +23,7 @@ export interface Query { proposalsByGroupPolicy(request: QueryProposalsByGroupPolicyRequest): Promise; /** VoteByProposalVoter queries a vote by proposal id and voter. */ voteByProposalVoter(request: QueryVoteByProposalVoterRequest): Promise; - /** VotesByProposal queries a vote by proposal. */ + /** VotesByProposal queries a vote by proposal id. */ votesByProposal(request: QueryVotesByProposalRequest): Promise; /** VotesByVoter queries a vote by voter. */ votesByVoter(request: QueryVotesByVoterRequest): Promise; @@ -37,6 +37,8 @@ export interface Query { * proposal itself. */ tallyResult(request: QueryTallyResultRequest): Promise; + /** Groups queries all groups in state. */ + groups(request?: QueryGroupsRequest): Promise; } export class QueryClientImpl implements Query { private readonly rpc: Rpc; @@ -55,6 +57,7 @@ export class QueryClientImpl implements Query { this.votesByVoter = this.votesByVoter.bind(this); this.groupsByMember = this.groupsByMember.bind(this); this.tallyResult = this.tallyResult.bind(this); + this.groups = this.groups.bind(this); } groupInfo(request: QueryGroupInfoRequest): Promise { const data = QueryGroupInfoRequest.encode(request).finish(); @@ -121,6 +124,13 @@ export class QueryClientImpl implements Query { const promise = this.rpc.request("cosmos.group.v1.Query", "TallyResult", data); return promise.then(data => QueryTallyResultResponse.decode(new BinaryReader(data))); } + groups(request: QueryGroupsRequest = { + pagination: undefined + }): Promise { + const data = QueryGroupsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.group.v1.Query", "Groups", data); + return promise.then(data => QueryGroupsResponse.decode(new BinaryReader(data))); + } } export const createRpcQueryExtension = (base: QueryClient) => { const rpc = createProtobufRpcClient(base); @@ -164,6 +174,9 @@ export const createRpcQueryExtension = (base: QueryClient) => { }, tallyResult(request: QueryTallyResultRequest): Promise { return queryService.tallyResult(request); + }, + groups(request?: QueryGroupsRequest): Promise { + return queryService.groups(request); } }; }; \ No newline at end of file diff --git a/packages/api/src/cosmos/group/v1/query.ts b/packages/api/src/cosmos/group/v1/query.ts index f4e4f96d..ebd40d75 100644 --- a/packages/api/src/cosmos/group/v1/query.ts +++ b/packages/api/src/cosmos/group/v1/query.ts @@ -26,7 +26,7 @@ export interface QueryGroupInfoRequestSDKType { } /** QueryGroupInfoResponse is the Query/GroupInfo response type. */ export interface QueryGroupInfoResponse { - /** info is the GroupInfo for the group. */ + /** info is the GroupInfo of the group. */ info?: GroupInfo; } export interface QueryGroupInfoResponseProtoMsg { @@ -35,7 +35,7 @@ export interface QueryGroupInfoResponseProtoMsg { } /** QueryGroupInfoResponse is the Query/GroupInfo response type. */ export interface QueryGroupInfoResponseAmino { - /** info is the GroupInfo for the group. */ + /** info is the GroupInfo of the group. */ info?: GroupInfoAmino; } export interface QueryGroupInfoResponseAminoMsg { @@ -70,7 +70,7 @@ export interface QueryGroupPolicyInfoRequestSDKType { } /** QueryGroupPolicyInfoResponse is the Query/GroupPolicyInfo response type. */ export interface QueryGroupPolicyInfoResponse { - /** info is the GroupPolicyInfo for the group policy. */ + /** info is the GroupPolicyInfo of the group policy. */ info?: GroupPolicyInfo; } export interface QueryGroupPolicyInfoResponseProtoMsg { @@ -79,7 +79,7 @@ export interface QueryGroupPolicyInfoResponseProtoMsg { } /** QueryGroupPolicyInfoResponse is the Query/GroupPolicyInfo response type. */ export interface QueryGroupPolicyInfoResponseAmino { - /** info is the GroupPolicyInfo for the group policy. */ + /** info is the GroupPolicyInfo of the group policy. */ info?: GroupPolicyInfoAmino; } export interface QueryGroupPolicyInfoResponseAminoMsg { @@ -649,7 +649,7 @@ export interface QueryTallyResultResponseProtoMsg { /** QueryTallyResultResponse is the Query/TallyResult response type. */ export interface QueryTallyResultResponseAmino { /** tally defines the requested tally. */ - tally?: TallyResultAmino; + tally: TallyResultAmino; } export interface QueryTallyResultResponseAminoMsg { type: "cosmos-sdk/QueryTallyResultResponse"; @@ -659,6 +659,55 @@ export interface QueryTallyResultResponseAminoMsg { export interface QueryTallyResultResponseSDKType { tally: TallyResultSDKType; } +/** QueryGroupsRequest is the Query/Groups request type. */ +export interface QueryGroupsRequest { + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryGroupsRequestProtoMsg { + typeUrl: "/cosmos.group.v1.QueryGroupsRequest"; + value: Uint8Array; +} +/** QueryGroupsRequest is the Query/Groups request type. */ +export interface QueryGroupsRequestAmino { + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryGroupsRequestAminoMsg { + type: "cosmos-sdk/QueryGroupsRequest"; + value: QueryGroupsRequestAmino; +} +/** QueryGroupsRequest is the Query/Groups request type. */ +export interface QueryGroupsRequestSDKType { + pagination?: PageRequestSDKType; +} +/** QueryGroupsResponse is the Query/Groups response type. */ +export interface QueryGroupsResponse { + /** `groups` is all the groups present in state. */ + groups: GroupInfo[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryGroupsResponseProtoMsg { + typeUrl: "/cosmos.group.v1.QueryGroupsResponse"; + value: Uint8Array; +} +/** QueryGroupsResponse is the Query/Groups response type. */ +export interface QueryGroupsResponseAmino { + /** `groups` is all the groups present in state. */ + groups?: GroupInfoAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryGroupsResponseAminoMsg { + type: "cosmos-sdk/QueryGroupsResponse"; + value: QueryGroupsResponseAmino; +} +/** QueryGroupsResponse is the Query/Groups response type. */ +export interface QueryGroupsResponseSDKType { + groups: GroupInfoSDKType[]; + pagination?: PageResponseSDKType; +} function createBaseQueryGroupInfoRequest(): QueryGroupInfoRequest { return { groupId: BigInt(0) @@ -2648,7 +2697,7 @@ export const QueryTallyResultResponse = { }, toAmino(message: QueryTallyResultResponse): QueryTallyResultResponseAmino { const obj: any = {}; - obj.tally = message.tally ? TallyResult.toAmino(message.tally) : undefined; + obj.tally = message.tally ? TallyResult.toAmino(message.tally) : TallyResult.toAmino(TallyResult.fromPartial({})); return obj; }, fromAminoMsg(object: QueryTallyResultResponseAminoMsg): QueryTallyResultResponse { @@ -2672,4 +2721,156 @@ export const QueryTallyResultResponse = { value: QueryTallyResultResponse.encode(message).finish() }; } +}; +function createBaseQueryGroupsRequest(): QueryGroupsRequest { + return { + pagination: undefined + }; +} +export const QueryGroupsRequest = { + typeUrl: "/cosmos.group.v1.QueryGroupsRequest", + encode(message: QueryGroupsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGroupsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryGroupsRequest { + const message = createBaseQueryGroupsRequest(); + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryGroupsRequestAmino): QueryGroupsRequest { + const message = createBaseQueryGroupsRequest(); + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryGroupsRequest): QueryGroupsRequestAmino { + const obj: any = {}; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryGroupsRequestAminoMsg): QueryGroupsRequest { + return QueryGroupsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryGroupsRequest): QueryGroupsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryGroupsRequest", + value: QueryGroupsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryGroupsRequestProtoMsg): QueryGroupsRequest { + return QueryGroupsRequest.decode(message.value); + }, + toProto(message: QueryGroupsRequest): Uint8Array { + return QueryGroupsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryGroupsRequest): QueryGroupsRequestProtoMsg { + return { + typeUrl: "/cosmos.group.v1.QueryGroupsRequest", + value: QueryGroupsRequest.encode(message).finish() + }; + } +}; +function createBaseQueryGroupsResponse(): QueryGroupsResponse { + return { + groups: [], + pagination: undefined + }; +} +export const QueryGroupsResponse = { + typeUrl: "/cosmos.group.v1.QueryGroupsResponse", + encode(message: QueryGroupsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.groups) { + GroupInfo.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): QueryGroupsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGroupsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.groups.push(GroupInfo.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryGroupsResponse { + const message = createBaseQueryGroupsResponse(); + message.groups = object.groups?.map(e => GroupInfo.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryGroupsResponseAmino): QueryGroupsResponse { + const message = createBaseQueryGroupsResponse(); + message.groups = object.groups?.map(e => GroupInfo.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryGroupsResponse): QueryGroupsResponseAmino { + const obj: any = {}; + if (message.groups) { + obj.groups = message.groups.map(e => e ? GroupInfo.toAmino(e) : undefined); + } else { + obj.groups = message.groups; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryGroupsResponseAminoMsg): QueryGroupsResponse { + return QueryGroupsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryGroupsResponse): QueryGroupsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryGroupsResponse", + value: QueryGroupsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryGroupsResponseProtoMsg): QueryGroupsResponse { + return QueryGroupsResponse.decode(message.value); + }, + toProto(message: QueryGroupsResponse): Uint8Array { + return QueryGroupsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryGroupsResponse): QueryGroupsResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.QueryGroupsResponse", + value: QueryGroupsResponse.encode(message).finish() + }; + } }; \ No newline at end of file diff --git a/packages/api/src/cosmos/group/v1/tx.ts b/packages/api/src/cosmos/group/v1/tx.ts index 22600b12..6b89bcb3 100644 --- a/packages/api/src/cosmos/group/v1/tx.ts +++ b/packages/api/src/cosmos/group/v1/tx.ts @@ -489,7 +489,7 @@ export interface MsgUpdateGroupPolicyMetadata { admin: string; /** group_policy_address is the account address of group policy. */ groupPolicyAddress: string; - /** metadata is the updated group policy metadata. */ + /** metadata is the group policy metadata to be updated. */ metadata: string; } export interface MsgUpdateGroupPolicyMetadataProtoMsg { @@ -502,7 +502,7 @@ export interface MsgUpdateGroupPolicyMetadataAmino { admin?: string; /** group_policy_address is the account address of group policy. */ group_policy_address?: string; - /** metadata is the updated group policy metadata. */ + /** metadata is the group policy metadata to be updated. */ metadata?: string; } export interface MsgUpdateGroupPolicyMetadataAminoMsg { @@ -538,7 +538,7 @@ export interface MsgSubmitProposal { * Proposers signatures will be counted as yes votes. */ proposers: string[]; - /** metadata is any arbitrary metadata to attached to the proposal. */ + /** metadata is any arbitrary metadata attached to the proposal. */ metadata: string; /** messages is a list of `sdk.Msg`s that will be executed if the proposal passes. */ messages: Any[]; @@ -548,6 +548,10 @@ export interface MsgSubmitProposal { * If so, proposers signatures are considered as Yes votes. */ exec: Exec; + /** title is the title of the proposal. */ + title: string; + /** summary is the summary of the proposal. */ + summary: string; } export interface MsgSubmitProposalProtoMsg { typeUrl: "/cosmos.group.v1.MsgSubmitProposal"; @@ -562,7 +566,7 @@ export interface MsgSubmitProposalAmino { * Proposers signatures will be counted as yes votes. */ proposers?: string[]; - /** metadata is any arbitrary metadata to attached to the proposal. */ + /** metadata is any arbitrary metadata attached to the proposal. */ metadata?: string; /** messages is a list of `sdk.Msg`s that will be executed if the proposal passes. */ messages?: AnyAmino[]; @@ -572,6 +576,10 @@ export interface MsgSubmitProposalAmino { * If so, proposers signatures are considered as Yes votes. */ exec?: Exec; + /** title is the title of the proposal. */ + title?: string; + /** summary is the summary of the proposal. */ + summary?: string; } export interface MsgSubmitProposalAminoMsg { type: "cosmos-sdk/group/MsgSubmitProposal"; @@ -584,6 +592,8 @@ export interface MsgSubmitProposalSDKType { metadata: string; messages: AnySDKType[]; exec: Exec; + title: string; + summary: string; } /** MsgSubmitProposalResponse is the Msg/SubmitProposal response type. */ export interface MsgSubmitProposalResponse { @@ -656,7 +666,7 @@ export interface MsgVote { voter: string; /** option is the voter's choice on the proposal. */ option: VoteOption; - /** metadata is any arbitrary metadata to attached to the vote. */ + /** metadata is any arbitrary metadata attached to the vote. */ metadata: string; /** * exec defines whether the proposal should be executed @@ -676,7 +686,7 @@ export interface MsgVoteAmino { voter?: string; /** option is the voter's choice on the proposal. */ option?: VoteOption; - /** metadata is any arbitrary metadata to attached to the vote. */ + /** metadata is any arbitrary metadata attached to the vote. */ metadata?: string; /** * exec defines whether the proposal should be executed @@ -1455,7 +1465,7 @@ export const MsgCreateGroupPolicy = { message.metadata = reader.string(); break; case 4: - message.decisionPolicy = (DecisionPolicy_InterfaceDecoder(reader) as Any); + message.decisionPolicy = (Cosmos_groupv1DecisionPolicy_InterfaceDecoder(reader) as Any); break; default: reader.skipType(tag & 7); @@ -1484,7 +1494,7 @@ export const MsgCreateGroupPolicy = { message.metadata = object.metadata; } if (object.decision_policy !== undefined && object.decision_policy !== null) { - message.decisionPolicy = DecisionPolicy_FromAmino(object.decision_policy); + message.decisionPolicy = Cosmos_groupv1DecisionPolicy_FromAmino(object.decision_policy); } return message; }, @@ -1493,7 +1503,7 @@ export const MsgCreateGroupPolicy = { obj.admin = message.admin === "" ? undefined : message.admin; obj.group_id = message.groupId !== BigInt(0) ? message.groupId?.toString() : undefined; obj.metadata = message.metadata === "" ? undefined : message.metadata; - obj.decision_policy = message.decisionPolicy ? DecisionPolicy_ToAmino((message.decisionPolicy as Any)) : undefined; + obj.decision_policy = message.decisionPolicy ? Cosmos_groupv1DecisionPolicy_ToAmino((message.decisionPolicy as Any)) : undefined; return obj; }, fromAminoMsg(object: MsgCreateGroupPolicyAminoMsg): MsgCreateGroupPolicy { @@ -1792,7 +1802,7 @@ export const MsgCreateGroupWithPolicy = { message.groupPolicyAsAdmin = reader.bool(); break; case 6: - message.decisionPolicy = (DecisionPolicy_InterfaceDecoder(reader) as Any); + message.decisionPolicy = (Cosmos_groupv1DecisionPolicy_InterfaceDecoder(reader) as Any); break; default: reader.skipType(tag & 7); @@ -1827,7 +1837,7 @@ export const MsgCreateGroupWithPolicy = { message.groupPolicyAsAdmin = object.group_policy_as_admin; } if (object.decision_policy !== undefined && object.decision_policy !== null) { - message.decisionPolicy = DecisionPolicy_FromAmino(object.decision_policy); + message.decisionPolicy = Cosmos_groupv1DecisionPolicy_FromAmino(object.decision_policy); } return message; }, @@ -1842,7 +1852,7 @@ export const MsgCreateGroupWithPolicy = { obj.group_metadata = message.groupMetadata === "" ? undefined : message.groupMetadata; obj.group_policy_metadata = message.groupPolicyMetadata === "" ? undefined : message.groupPolicyMetadata; obj.group_policy_as_admin = message.groupPolicyAsAdmin === false ? undefined : message.groupPolicyAsAdmin; - obj.decision_policy = message.decisionPolicy ? DecisionPolicy_ToAmino((message.decisionPolicy as Any)) : undefined; + obj.decision_policy = message.decisionPolicy ? Cosmos_groupv1DecisionPolicy_ToAmino((message.decisionPolicy as Any)) : undefined; return obj; }, fromAminoMsg(object: MsgCreateGroupWithPolicyAminoMsg): MsgCreateGroupWithPolicy { @@ -1983,7 +1993,7 @@ export const MsgUpdateGroupPolicyDecisionPolicy = { message.groupPolicyAddress = reader.string(); break; case 3: - message.decisionPolicy = (DecisionPolicy_InterfaceDecoder(reader) as Any); + message.decisionPolicy = (Cosmos_groupv1DecisionPolicy_InterfaceDecoder(reader) as Any); break; default: reader.skipType(tag & 7); @@ -2008,7 +2018,7 @@ export const MsgUpdateGroupPolicyDecisionPolicy = { message.groupPolicyAddress = object.group_policy_address; } if (object.decision_policy !== undefined && object.decision_policy !== null) { - message.decisionPolicy = DecisionPolicy_FromAmino(object.decision_policy); + message.decisionPolicy = Cosmos_groupv1DecisionPolicy_FromAmino(object.decision_policy); } return message; }, @@ -2016,7 +2026,7 @@ export const MsgUpdateGroupPolicyDecisionPolicy = { const obj: any = {}; obj.admin = message.admin === "" ? undefined : message.admin; obj.group_policy_address = message.groupPolicyAddress === "" ? undefined : message.groupPolicyAddress; - obj.decision_policy = message.decisionPolicy ? DecisionPolicy_ToAmino((message.decisionPolicy as Any)) : undefined; + obj.decision_policy = message.decisionPolicy ? Cosmos_groupv1DecisionPolicy_ToAmino((message.decisionPolicy as Any)) : undefined; return obj; }, fromAminoMsg(object: MsgUpdateGroupPolicyDecisionPolicyAminoMsg): MsgUpdateGroupPolicyDecisionPolicy { @@ -2252,7 +2262,9 @@ function createBaseMsgSubmitProposal(): MsgSubmitProposal { proposers: [], metadata: "", messages: [], - exec: 0 + exec: 0, + title: "", + summary: "" }; } export const MsgSubmitProposal = { @@ -2273,6 +2285,12 @@ export const MsgSubmitProposal = { if (message.exec !== 0) { writer.uint32(40).int32(message.exec); } + if (message.title !== "") { + writer.uint32(50).string(message.title); + } + if (message.summary !== "") { + writer.uint32(58).string(message.summary); + } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitProposal { @@ -2297,6 +2315,12 @@ export const MsgSubmitProposal = { case 5: message.exec = (reader.int32() as any); break; + case 6: + message.title = reader.string(); + break; + case 7: + message.summary = reader.string(); + break; default: reader.skipType(tag & 7); break; @@ -2311,6 +2335,8 @@ export const MsgSubmitProposal = { message.metadata = object.metadata ?? ""; message.messages = object.messages?.map(e => Any.fromPartial(e)) || []; message.exec = object.exec ?? 0; + message.title = object.title ?? ""; + message.summary = object.summary ?? ""; return message; }, fromAmino(object: MsgSubmitProposalAmino): MsgSubmitProposal { @@ -2326,6 +2352,12 @@ export const MsgSubmitProposal = { if (object.exec !== undefined && object.exec !== null) { message.exec = object.exec; } + if (object.title !== undefined && object.title !== null) { + message.title = object.title; + } + if (object.summary !== undefined && object.summary !== null) { + message.summary = object.summary; + } return message; }, toAmino(message: MsgSubmitProposal): MsgSubmitProposalAmino { @@ -2343,6 +2375,8 @@ export const MsgSubmitProposal = { obj.messages = message.messages; } obj.exec = message.exec === 0 ? undefined : message.exec; + obj.title = message.title === "" ? undefined : message.title; + obj.summary = message.summary === "" ? undefined : message.summary; return obj; }, fromAminoMsg(object: MsgSubmitProposalAminoMsg): MsgSubmitProposal { @@ -3033,7 +3067,7 @@ export const MsgLeaveGroupResponse = { }; } }; -export const DecisionPolicy_InterfaceDecoder = (input: BinaryReader | Uint8Array): ThresholdDecisionPolicy | PercentageDecisionPolicy | Any => { +export const Cosmos_groupv1DecisionPolicy_InterfaceDecoder = (input: BinaryReader | Uint8Array): ThresholdDecisionPolicy | PercentageDecisionPolicy | Any => { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const data = Any.decode(reader, reader.uint32()); switch (data.typeUrl) { @@ -3045,7 +3079,7 @@ export const DecisionPolicy_InterfaceDecoder = (input: BinaryReader | Uint8Array return data; } }; -export const DecisionPolicy_FromAmino = (content: AnyAmino): Any => { +export const Cosmos_groupv1DecisionPolicy_FromAmino = (content: AnyAmino): Any => { switch (content.type) { case "cosmos-sdk/ThresholdDecisionPolicy": return Any.fromPartial({ @@ -3061,7 +3095,7 @@ export const DecisionPolicy_FromAmino = (content: AnyAmino): Any => { return Any.fromAmino(content); } }; -export const DecisionPolicy_ToAmino = (content: Any) => { +export const Cosmos_groupv1DecisionPolicy_ToAmino = (content: Any) => { switch (content.typeUrl) { case "/cosmos.group.v1.ThresholdDecisionPolicy": return { diff --git a/packages/api/src/cosmos/group/v1/types.ts b/packages/api/src/cosmos/group/v1/types.ts index ce6daf1f..08c24d59 100644 --- a/packages/api/src/cosmos/group/v1/types.ts +++ b/packages/api/src/cosmos/group/v1/types.ts @@ -217,7 +217,7 @@ export interface MemberAmino { /** metadata is any arbitrary metadata attached to the member. */ metadata?: string; /** added_at is a timestamp specifying when a member was added. */ - added_at?: string; + added_at: string; } export interface MemberAminoMsg { type: "cosmos-sdk/Member"; @@ -280,7 +280,7 @@ export interface MemberRequestSDKType { /** * ThresholdDecisionPolicy is a decision policy where a proposal passes when it * satisfies the two following conditions: - * 1. The sum of all `YES` voters' weights is greater or equal than the defined + * 1. The sum of all `YES` voter's weights is greater or equal than the defined * `threshold`. * 2. The voting and execution periods of the proposal respect the parameters * given by `windows`. @@ -302,7 +302,7 @@ export interface ThresholdDecisionPolicyProtoMsg { /** * ThresholdDecisionPolicy is a decision policy where a proposal passes when it * satisfies the two following conditions: - * 1. The sum of all `YES` voters' weights is greater or equal than the defined + * 1. The sum of all `YES` voter's weights is greater or equal than the defined * `threshold`. * 2. The voting and execution periods of the proposal respect the parameters * given by `windows`. @@ -323,7 +323,7 @@ export interface ThresholdDecisionPolicyAminoMsg { /** * ThresholdDecisionPolicy is a decision policy where a proposal passes when it * satisfies the two following conditions: - * 1. The sum of all `YES` voters' weights is greater or equal than the defined + * 1. The sum of all `YES` voter's weights is greater or equal than the defined * `threshold`. * 2. The voting and execution periods of the proposal respect the parameters * given by `windows`. @@ -344,7 +344,7 @@ export interface ThresholdDecisionPolicySDKType { export interface PercentageDecisionPolicy { $typeUrl?: "/cosmos.group.v1.PercentageDecisionPolicy"; /** - * percentage is the minimum percentage the weighted sum of `YES` votes must + * percentage is the minimum percentage of the weighted sum of `YES` votes must * meet for a proposal to succeed. */ percentage: string; @@ -365,7 +365,7 @@ export interface PercentageDecisionPolicyProtoMsg { */ export interface PercentageDecisionPolicyAmino { /** - * percentage is the minimum percentage the weighted sum of `YES` votes must + * percentage is the minimum percentage of the weighted sum of `YES` votes must * meet for a proposal to succeed. */ percentage?: string; @@ -421,7 +421,7 @@ export interface DecisionPolicyWindowsAmino { * voting_period is the duration from submission of a proposal to the end of voting period * Within this times votes can be submitted with MsgVote. */ - voting_period?: DurationAmino; + voting_period: DurationAmino; /** * min_execution_period is the minimum duration after the proposal submission * where members can start sending MsgExec. This means that the window for @@ -435,7 +435,7 @@ export interface DecisionPolicyWindowsAmino { * is empty, meaning that all proposals created with this decision policy * won't be able to be executed. */ - min_execution_period?: DurationAmino; + min_execution_period: DurationAmino; } export interface DecisionPolicyWindowsAminoMsg { type: "cosmos-sdk/DecisionPolicyWindows"; @@ -452,7 +452,10 @@ export interface GroupInfo { id: bigint; /** admin is the account address of the group's admin. */ admin: string; - /** metadata is any arbitrary metadata to attached to the group. */ + /** + * metadata is any arbitrary metadata to attached to the group. + * the recommended format of the metadata is to be found here: https://docs.cosmos.network/v0.47/modules/group#group-1 + */ metadata: string; /** * version is used to track changes to a group's membership structure that @@ -476,7 +479,10 @@ export interface GroupInfoAmino { id?: string; /** admin is the account address of the group's admin. */ admin?: string; - /** metadata is any arbitrary metadata to attached to the group. */ + /** + * metadata is any arbitrary metadata to attached to the group. + * the recommended format of the metadata is to be found here: https://docs.cosmos.network/v0.47/modules/group#group-1 + */ metadata?: string; /** * version is used to track changes to a group's membership structure that @@ -488,7 +494,7 @@ export interface GroupInfoAmino { /** total_weight is the sum of the group members' weights. */ total_weight?: string; /** created_at is a timestamp specifying when a group was created. */ - created_at?: string; + created_at: string; } export interface GroupInfoAminoMsg { type: "cosmos-sdk/GroupInfo"; @@ -538,7 +544,11 @@ export interface GroupPolicyInfo { groupId: bigint; /** admin is the account address of the group admin. */ admin: string; - /** metadata is any arbitrary metadata to attached to the group policy. */ + /** + * metadata is any arbitrary metadata attached to the group policy. + * the recommended format of the metadata is to be found here: + * https://docs.cosmos.network/v0.47/modules/group#decision-policy-1 + */ metadata: string; /** * version is used to track changes to a group's GroupPolicyInfo structure that @@ -565,7 +575,11 @@ export interface GroupPolicyInfoAmino { group_id?: string; /** admin is the account address of the group admin. */ admin?: string; - /** metadata is any arbitrary metadata to attached to the group policy. */ + /** + * metadata is any arbitrary metadata attached to the group policy. + * the recommended format of the metadata is to be found here: + * https://docs.cosmos.network/v0.47/modules/group#decision-policy-1 + */ metadata?: string; /** * version is used to track changes to a group's GroupPolicyInfo structure that @@ -575,7 +589,7 @@ export interface GroupPolicyInfoAmino { /** decision_policy specifies the group policy's decision policy. */ decision_policy?: AnyAmino; /** created_at is a timestamp specifying when a group policy was created. */ - created_at?: string; + created_at: string; } export interface GroupPolicyInfoAminoMsg { type: "cosmos-sdk/GroupPolicyInfo"; @@ -602,7 +616,11 @@ export interface Proposal { id: bigint; /** group_policy_address is the account address of group policy. */ groupPolicyAddress: string; - /** metadata is any arbitrary metadata to attached to the proposal. */ + /** + * metadata is any arbitrary metadata attached to the proposal. + * the recommended format of the metadata is to be found here: + * https://docs.cosmos.network/v0.47/modules/group#proposal-4 + */ metadata: string; /** proposers are the account addresses of the proposers. */ proposers: string[]; @@ -631,7 +649,7 @@ export interface Proposal { finalTallyResult: TallyResult; /** * voting_period_end is the timestamp before which voting must be done. - * Unless a successfull MsgExec is called before (to execute a proposal whose + * Unless a successful MsgExec is called before (to execute a proposal whose * tally is successful before the voting period ends), tallying will be done * at this point, and the `final_tally_result`and `status` fields will be * accordingly updated. @@ -641,6 +659,10 @@ export interface Proposal { executorResult: ProposalExecutorResult; /** messages is a list of `sdk.Msg`s that will be executed if the proposal passes. */ messages: Any[]; + /** title is the title of the proposal */ + title: string; + /** summary is a short summary of the proposal */ + summary: string; } export interface ProposalProtoMsg { typeUrl: "/cosmos.group.v1.Proposal"; @@ -657,12 +679,16 @@ export interface ProposalAmino { id?: string; /** group_policy_address is the account address of group policy. */ group_policy_address?: string; - /** metadata is any arbitrary metadata to attached to the proposal. */ + /** + * metadata is any arbitrary metadata attached to the proposal. + * the recommended format of the metadata is to be found here: + * https://docs.cosmos.network/v0.47/modules/group#proposal-4 + */ metadata?: string; /** proposers are the account addresses of the proposers. */ proposers?: string[]; /** submit_time is a timestamp specifying when a proposal was submitted. */ - submit_time?: string; + submit_time: string; /** * group_version tracks the version of the group at proposal submission. * This field is here for informational purposes only. @@ -683,19 +709,23 @@ export interface ProposalAmino { * populated after tallying, at voting period end or at proposal execution, * whichever happens first. */ - final_tally_result?: TallyResultAmino; + final_tally_result: TallyResultAmino; /** * voting_period_end is the timestamp before which voting must be done. - * Unless a successfull MsgExec is called before (to execute a proposal whose + * Unless a successful MsgExec is called before (to execute a proposal whose * tally is successful before the voting period ends), tallying will be done * at this point, and the `final_tally_result`and `status` fields will be * accordingly updated. */ - voting_period_end?: string; + voting_period_end: string; /** executor_result is the final result of the proposal execution. Initial value is NotRun. */ executor_result?: ProposalExecutorResult; /** messages is a list of `sdk.Msg`s that will be executed if the proposal passes. */ messages?: AnyAmino[]; + /** title is the title of the proposal */ + title?: string; + /** summary is a short summary of the proposal */ + summary?: string; } export interface ProposalAminoMsg { type: "cosmos-sdk/Proposal"; @@ -720,6 +750,8 @@ export interface ProposalSDKType { voting_period_end: Date; executor_result: ProposalExecutorResult; messages: AnySDKType[]; + title: string; + summary: string; } /** TallyResult represents the sum of weighted votes for each vote option. */ export interface TallyResult { @@ -758,7 +790,7 @@ export interface TallyResultSDKType { no_count: string; no_with_veto_count: string; } -/** Vote represents a vote for a proposal. */ +/** Vote represents a vote for a proposal.string metadata */ export interface Vote { /** proposal is the unique ID of the proposal. */ proposalId: bigint; @@ -766,7 +798,10 @@ export interface Vote { voter: string; /** option is the voter's choice on the proposal. */ option: VoteOption; - /** metadata is any arbitrary metadata to attached to the vote. */ + /** + * metadata is any arbitrary metadata attached to the vote. + * the recommended format of the metadata is to be found here: https://docs.cosmos.network/v0.47/modules/group#vote-2 + */ metadata: string; /** submit_time is the timestamp when the vote was submitted. */ submitTime: Date; @@ -775,7 +810,7 @@ export interface VoteProtoMsg { typeUrl: "/cosmos.group.v1.Vote"; value: Uint8Array; } -/** Vote represents a vote for a proposal. */ +/** Vote represents a vote for a proposal.string metadata */ export interface VoteAmino { /** proposal is the unique ID of the proposal. */ proposal_id?: string; @@ -783,16 +818,19 @@ export interface VoteAmino { voter?: string; /** option is the voter's choice on the proposal. */ option?: VoteOption; - /** metadata is any arbitrary metadata to attached to the vote. */ + /** + * metadata is any arbitrary metadata attached to the vote. + * the recommended format of the metadata is to be found here: https://docs.cosmos.network/v0.47/modules/group#vote-2 + */ metadata?: string; /** submit_time is the timestamp when the vote was submitted. */ - submit_time?: string; + submit_time: string; } export interface VoteAminoMsg { type: "cosmos-sdk/Vote"; value: VoteAmino; } -/** Vote represents a vote for a proposal. */ +/** Vote represents a vote for a proposal.string metadata */ export interface VoteSDKType { proposal_id: bigint; voter: string; @@ -880,7 +918,7 @@ export const Member = { obj.address = message.address === "" ? undefined : message.address; obj.weight = message.weight === "" ? undefined : message.weight; obj.metadata = message.metadata === "" ? undefined : message.metadata; - obj.added_at = message.addedAt ? Timestamp.toAmino(toTimestamp(message.addedAt)) : undefined; + obj.added_at = message.addedAt ? Timestamp.toAmino(toTimestamp(message.addedAt)) : new Date(); return obj; }, fromAminoMsg(object: MemberAminoMsg): Member { @@ -1217,8 +1255,8 @@ export const DecisionPolicyWindows = { }, toAmino(message: DecisionPolicyWindows): DecisionPolicyWindowsAmino { const obj: any = {}; - obj.voting_period = message.votingPeriod ? Duration.toAmino(message.votingPeriod) : undefined; - obj.min_execution_period = message.minExecutionPeriod ? Duration.toAmino(message.minExecutionPeriod) : undefined; + obj.voting_period = message.votingPeriod ? Duration.toAmino(message.votingPeriod) : Duration.toAmino(Duration.fromPartial({})); + obj.min_execution_period = message.minExecutionPeriod ? Duration.toAmino(message.minExecutionPeriod) : Duration.toAmino(Duration.fromPartial({})); return obj; }, fromAminoMsg(object: DecisionPolicyWindowsAminoMsg): DecisionPolicyWindows { @@ -1347,7 +1385,7 @@ export const GroupInfo = { obj.metadata = message.metadata === "" ? undefined : message.metadata; obj.version = message.version !== BigInt(0) ? message.version?.toString() : undefined; obj.total_weight = message.totalWeight === "" ? undefined : message.totalWeight; - obj.created_at = message.createdAt ? Timestamp.toAmino(toTimestamp(message.createdAt)) : undefined; + obj.created_at = message.createdAt ? Timestamp.toAmino(toTimestamp(message.createdAt)) : new Date(); return obj; }, fromAminoMsg(object: GroupInfoAminoMsg): GroupInfo { @@ -1513,7 +1551,7 @@ export const GroupPolicyInfo = { message.version = reader.uint64(); break; case 6: - message.decisionPolicy = (DecisionPolicy_InterfaceDecoder(reader) as Any); + message.decisionPolicy = (Cosmos_groupv1DecisionPolicy_InterfaceDecoder(reader) as Any); break; case 7: message.createdAt = fromTimestamp(Timestamp.decode(reader, reader.uint32())); @@ -1554,7 +1592,7 @@ export const GroupPolicyInfo = { message.version = BigInt(object.version); } if (object.decision_policy !== undefined && object.decision_policy !== null) { - message.decisionPolicy = DecisionPolicy_FromAmino(object.decision_policy); + message.decisionPolicy = Cosmos_groupv1DecisionPolicy_FromAmino(object.decision_policy); } if (object.created_at !== undefined && object.created_at !== null) { message.createdAt = fromTimestamp(Timestamp.fromAmino(object.created_at)); @@ -1568,8 +1606,8 @@ export const GroupPolicyInfo = { obj.admin = message.admin === "" ? undefined : message.admin; obj.metadata = message.metadata === "" ? undefined : message.metadata; obj.version = message.version !== BigInt(0) ? message.version?.toString() : undefined; - obj.decision_policy = message.decisionPolicy ? DecisionPolicy_ToAmino((message.decisionPolicy as Any)) : undefined; - obj.created_at = message.createdAt ? Timestamp.toAmino(toTimestamp(message.createdAt)) : undefined; + obj.decision_policy = message.decisionPolicy ? Cosmos_groupv1DecisionPolicy_ToAmino((message.decisionPolicy as Any)) : undefined; + obj.created_at = message.createdAt ? Timestamp.toAmino(toTimestamp(message.createdAt)) : new Date(); return obj; }, fromAminoMsg(object: GroupPolicyInfoAminoMsg): GroupPolicyInfo { @@ -1607,7 +1645,9 @@ function createBaseProposal(): Proposal { finalTallyResult: TallyResult.fromPartial({}), votingPeriodEnd: new Date(), executorResult: 0, - messages: [] + messages: [], + title: "", + summary: "" }; } export const Proposal = { @@ -1649,6 +1689,12 @@ export const Proposal = { for (const v of message.messages) { Any.encode(v!, writer.uint32(98).fork()).ldelim(); } + if (message.title !== "") { + writer.uint32(106).string(message.title); + } + if (message.summary !== "") { + writer.uint32(114).string(message.summary); + } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): Proposal { @@ -1694,6 +1740,12 @@ export const Proposal = { case 12: message.messages.push(Any.decode(reader, reader.uint32())); break; + case 13: + message.title = reader.string(); + break; + case 14: + message.summary = reader.string(); + break; default: reader.skipType(tag & 7); break; @@ -1715,6 +1767,8 @@ export const Proposal = { message.votingPeriodEnd = object.votingPeriodEnd ?? undefined; message.executorResult = object.executorResult ?? 0; message.messages = object.messages?.map(e => Any.fromPartial(e)) || []; + message.title = object.title ?? ""; + message.summary = object.summary ?? ""; return message; }, fromAmino(object: ProposalAmino): Proposal { @@ -1751,6 +1805,12 @@ export const Proposal = { message.executorResult = object.executor_result; } message.messages = object.messages?.map(e => Any.fromAmino(e)) || []; + if (object.title !== undefined && object.title !== null) { + message.title = object.title; + } + if (object.summary !== undefined && object.summary !== null) { + message.summary = object.summary; + } return message; }, toAmino(message: Proposal): ProposalAmino { @@ -1763,18 +1823,20 @@ export const Proposal = { } else { obj.proposers = message.proposers; } - obj.submit_time = message.submitTime ? Timestamp.toAmino(toTimestamp(message.submitTime)) : undefined; + obj.submit_time = message.submitTime ? Timestamp.toAmino(toTimestamp(message.submitTime)) : new Date(); obj.group_version = message.groupVersion !== BigInt(0) ? message.groupVersion?.toString() : undefined; obj.group_policy_version = message.groupPolicyVersion !== BigInt(0) ? message.groupPolicyVersion?.toString() : undefined; obj.status = message.status === 0 ? undefined : message.status; - obj.final_tally_result = message.finalTallyResult ? TallyResult.toAmino(message.finalTallyResult) : undefined; - obj.voting_period_end = message.votingPeriodEnd ? Timestamp.toAmino(toTimestamp(message.votingPeriodEnd)) : undefined; + obj.final_tally_result = message.finalTallyResult ? TallyResult.toAmino(message.finalTallyResult) : TallyResult.toAmino(TallyResult.fromPartial({})); + obj.voting_period_end = message.votingPeriodEnd ? Timestamp.toAmino(toTimestamp(message.votingPeriodEnd)) : new Date(); obj.executor_result = message.executorResult === 0 ? undefined : message.executorResult; if (message.messages) { obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); } else { obj.messages = message.messages; } + obj.title = message.title === "" ? undefined : message.title; + obj.summary = message.summary === "" ? undefined : message.summary; return obj; }, fromAminoMsg(object: ProposalAminoMsg): Proposal { @@ -1996,7 +2058,7 @@ export const Vote = { obj.voter = message.voter === "" ? undefined : message.voter; obj.option = message.option === 0 ? undefined : message.option; obj.metadata = message.metadata === "" ? undefined : message.metadata; - obj.submit_time = message.submitTime ? Timestamp.toAmino(toTimestamp(message.submitTime)) : undefined; + obj.submit_time = message.submitTime ? Timestamp.toAmino(toTimestamp(message.submitTime)) : new Date(); return obj; }, fromAminoMsg(object: VoteAminoMsg): Vote { @@ -2021,7 +2083,7 @@ export const Vote = { }; } }; -export const DecisionPolicy_InterfaceDecoder = (input: BinaryReader | Uint8Array): ThresholdDecisionPolicy | PercentageDecisionPolicy | Any => { +export const Cosmos_groupv1DecisionPolicy_InterfaceDecoder = (input: BinaryReader | Uint8Array): ThresholdDecisionPolicy | PercentageDecisionPolicy | Any => { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const data = Any.decode(reader, reader.uint32()); switch (data.typeUrl) { @@ -2033,7 +2095,7 @@ export const DecisionPolicy_InterfaceDecoder = (input: BinaryReader | Uint8Array return data; } }; -export const DecisionPolicy_FromAmino = (content: AnyAmino): Any => { +export const Cosmos_groupv1DecisionPolicy_FromAmino = (content: AnyAmino): Any => { switch (content.type) { case "cosmos-sdk/ThresholdDecisionPolicy": return Any.fromPartial({ @@ -2049,7 +2111,7 @@ export const DecisionPolicy_FromAmino = (content: AnyAmino): Any => { return Any.fromAmino(content); } }; -export const DecisionPolicy_ToAmino = (content: Any) => { +export const Cosmos_groupv1DecisionPolicy_ToAmino = (content: Any) => { switch (content.typeUrl) { case "/cosmos.group.v1.ThresholdDecisionPolicy": return { diff --git a/packages/api/src/cosmos/lcd.ts b/packages/api/src/cosmos/lcd.ts index c39cd322..7eaceabc 100644 --- a/packages/api/src/cosmos/lcd.ts +++ b/packages/api/src/cosmos/lcd.ts @@ -32,11 +32,26 @@ export const createLCDClient = async ({ }) } }, + circuit: { + v1: new (await import("./circuit/v1/query.lcd")).LCDQueryClient({ + requestClient + }) + }, + consensus: { + v1: new (await import("./consensus/v1/query.lcd")).LCDQueryClient({ + requestClient + }) + }, distribution: { v1beta1: new (await import("./distribution/v1beta1/query.lcd")).LCDQueryClient({ requestClient }) }, + epochs: { + v1beta1: new (await import("./epochs/v1beta1/query.lcd")).LCDQueryClient({ + requestClient + }) + }, feegrant: { v1beta1: new (await import("./feegrant/v1beta1/query.lcd")).LCDQueryClient({ requestClient @@ -65,6 +80,11 @@ export const createLCDClient = async ({ requestClient }) }, + protocolpool: { + v1: new (await import("./protocolpool/v1/query.lcd")).LCDQueryClient({ + requestClient + }) + }, staking: { v1beta1: new (await import("./staking/v1beta1/query.lcd")).LCDQueryClient({ requestClient diff --git a/packages/api/src/cosmos/mint/module/v1/module.ts b/packages/api/src/cosmos/mint/module/v1/module.ts new file mode 100644 index 00000000..3671fce2 --- /dev/null +++ b/packages/api/src/cosmos/mint/module/v1/module.ts @@ -0,0 +1,108 @@ +//@ts-nocheck +import { BinaryReader, BinaryWriter } from "../../../../binary"; +/** Module is the config object of the mint module. */ +export interface Module { + feeCollectorName: string; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} +export interface ModuleProtoMsg { + typeUrl: "/cosmos.mint.module.v1.Module"; + value: Uint8Array; +} +/** Module is the config object of the mint module. */ +export interface ModuleAmino { + fee_collector_name?: string; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority?: string; +} +export interface ModuleAminoMsg { + type: "cosmos-sdk/Module"; + value: ModuleAmino; +} +/** Module is the config object of the mint module. */ +export interface ModuleSDKType { + fee_collector_name: string; + authority: string; +} +function createBaseModule(): Module { + return { + feeCollectorName: "", + authority: "" + }; +} +export const Module = { + typeUrl: "/cosmos.mint.module.v1.Module", + encode(message: Module, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.feeCollectorName !== "") { + writer.uint32(10).string(message.feeCollectorName); + } + if (message.authority !== "") { + writer.uint32(18).string(message.authority); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.feeCollectorName = reader.string(); + break; + case 2: + message.authority = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): Module { + const message = createBaseModule(); + message.feeCollectorName = object.feeCollectorName ?? ""; + message.authority = object.authority ?? ""; + return message; + }, + fromAmino(object: ModuleAmino): Module { + const message = createBaseModule(); + if (object.fee_collector_name !== undefined && object.fee_collector_name !== null) { + message.feeCollectorName = object.fee_collector_name; + } + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + return message; + }, + toAmino(message: Module): ModuleAmino { + const obj: any = {}; + obj.fee_collector_name = message.feeCollectorName === "" ? undefined : message.feeCollectorName; + obj.authority = message.authority === "" ? undefined : message.authority; + return obj; + }, + fromAminoMsg(object: ModuleAminoMsg): Module { + return Module.fromAmino(object.value); + }, + toAminoMsg(message: Module): ModuleAminoMsg { + return { + type: "cosmos-sdk/Module", + value: Module.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleProtoMsg): Module { + return Module.decode(message.value); + }, + toProto(message: Module): Uint8Array { + return Module.encode(message).finish(); + }, + toProtoMsg(message: Module): ModuleProtoMsg { + return { + typeUrl: "/cosmos.mint.module.v1.Module", + value: Module.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/mint/v1beta1/genesis.ts b/packages/api/src/cosmos/mint/v1beta1/genesis.ts index 1fae0bca..cfee60f1 100644 --- a/packages/api/src/cosmos/mint/v1beta1/genesis.ts +++ b/packages/api/src/cosmos/mint/v1beta1/genesis.ts @@ -5,7 +5,7 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; export interface GenesisState { /** minter is a space for holding current inflation information. */ minter: Minter; - /** params defines all the paramaters of the module. */ + /** params defines all the parameters of the module. */ params: Params; } export interface GenesisStateProtoMsg { @@ -15,9 +15,9 @@ export interface GenesisStateProtoMsg { /** GenesisState defines the mint module's genesis state. */ export interface GenesisStateAmino { /** minter is a space for holding current inflation information. */ - minter?: MinterAmino; - /** params defines all the paramaters of the module. */ - params?: ParamsAmino; + minter: MinterAmino; + /** params defines all the parameters of the module. */ + params: ParamsAmino; } export interface GenesisStateAminoMsg { type: "cosmos-sdk/GenesisState"; @@ -83,8 +83,8 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.minter = message.minter ? Minter.toAmino(message.minter) : undefined; - obj.params = message.params ? Params.toAmino(message.params) : undefined; + obj.minter = message.minter ? Minter.toAmino(message.minter) : Minter.toAmino(Minter.fromPartial({})); + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/packages/api/src/cosmos/mint/v1beta1/mint.ts b/packages/api/src/cosmos/mint/v1beta1/mint.ts index 34150a27..7d22774f 100644 --- a/packages/api/src/cosmos/mint/v1beta1/mint.ts +++ b/packages/api/src/cosmos/mint/v1beta1/mint.ts @@ -28,7 +28,7 @@ export interface MinterSDKType { inflation: string; annual_provisions: string; } -/** Params holds parameters for the mint module. */ +/** Params defines the parameters for the x/mint module. */ export interface Params { /** type of coin to mint */ mintDenom: string; @@ -47,26 +47,26 @@ export interface ParamsProtoMsg { typeUrl: "/cosmos.mint.v1beta1.Params"; value: Uint8Array; } -/** Params holds parameters for the mint module. */ +/** Params defines the parameters for the x/mint module. */ export interface ParamsAmino { /** type of coin to mint */ mint_denom?: string; /** maximum annual change in inflation rate */ - inflation_rate_change?: string; + inflation_rate_change: string; /** maximum inflation rate */ - inflation_max?: string; + inflation_max: string; /** minimum inflation rate */ - inflation_min?: string; + inflation_min: string; /** goal of percent bonded atoms */ - goal_bonded?: string; + goal_bonded: string; /** expected blocks per year */ blocks_per_year?: string; } export interface ParamsAminoMsg { - type: "cosmos-sdk/Params"; + type: "cosmos-sdk/x/mint/Params"; value: ParamsAmino; } -/** Params holds parameters for the mint module. */ +/** Params defines the parameters for the x/mint module. */ export interface ParamsSDKType { mint_denom: string; inflation_rate_change: string; @@ -256,10 +256,10 @@ export const Params = { toAmino(message: Params): ParamsAmino { const obj: any = {}; obj.mint_denom = message.mintDenom === "" ? undefined : message.mintDenom; - obj.inflation_rate_change = message.inflationRateChange === "" ? undefined : message.inflationRateChange; - obj.inflation_max = message.inflationMax === "" ? undefined : message.inflationMax; - obj.inflation_min = message.inflationMin === "" ? undefined : message.inflationMin; - obj.goal_bonded = message.goalBonded === "" ? undefined : message.goalBonded; + obj.inflation_rate_change = message.inflationRateChange ?? ""; + obj.inflation_max = message.inflationMax ?? ""; + obj.inflation_min = message.inflationMin ?? ""; + obj.goal_bonded = message.goalBonded ?? ""; obj.blocks_per_year = message.blocksPerYear !== BigInt(0) ? message.blocksPerYear?.toString() : undefined; return obj; }, @@ -268,7 +268,7 @@ export const Params = { }, toAminoMsg(message: Params): ParamsAminoMsg { return { - type: "cosmos-sdk/Params", + type: "cosmos-sdk/x/mint/Params", value: Params.toAmino(message) }; }, diff --git a/packages/api/src/cosmos/mint/v1beta1/query.ts b/packages/api/src/cosmos/mint/v1beta1/query.ts index 65abe54a..accb3e95 100644 --- a/packages/api/src/cosmos/mint/v1beta1/query.ts +++ b/packages/api/src/cosmos/mint/v1beta1/query.ts @@ -28,7 +28,7 @@ export interface QueryParamsResponseProtoMsg { /** QueryParamsResponse is the response type for the Query/Params RPC method. */ export interface QueryParamsResponseAmino { /** params defines the parameters of the module. */ - params?: ParamsAmino; + params: ParamsAmino; } export interface QueryParamsResponseAminoMsg { type: "cosmos-sdk/QueryParamsResponse"; @@ -70,7 +70,7 @@ export interface QueryInflationResponseProtoMsg { */ export interface QueryInflationResponseAmino { /** inflation is the current minting inflation value. */ - inflation?: string; + inflation: string; } export interface QueryInflationResponseAminoMsg { type: "cosmos-sdk/QueryInflationResponse"; @@ -124,7 +124,7 @@ export interface QueryAnnualProvisionsResponseProtoMsg { */ export interface QueryAnnualProvisionsResponseAmino { /** annual_provisions is the current minting annual provisions value. */ - annual_provisions?: string; + annual_provisions: string; } export interface QueryAnnualProvisionsResponseAminoMsg { type: "cosmos-sdk/QueryAnnualProvisionsResponse"; @@ -237,7 +237,7 @@ export const QueryParamsResponse = { }, toAmino(message: QueryParamsResponse): QueryParamsResponseAmino { const obj: any = {}; - obj.params = message.params ? Params.toAmino(message.params) : undefined; + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); return obj; }, fromAminoMsg(object: QueryParamsResponseAminoMsg): QueryParamsResponse { @@ -362,7 +362,7 @@ export const QueryInflationResponse = { }, toAmino(message: QueryInflationResponse): QueryInflationResponseAmino { const obj: any = {}; - obj.inflation = message.inflation ? base64FromBytes(message.inflation) : undefined; + obj.inflation = message.inflation ? base64FromBytes(message.inflation) : ""; return obj; }, fromAminoMsg(object: QueryInflationResponseAminoMsg): QueryInflationResponse { @@ -487,7 +487,7 @@ export const QueryAnnualProvisionsResponse = { }, toAmino(message: QueryAnnualProvisionsResponse): QueryAnnualProvisionsResponseAmino { const obj: any = {}; - obj.annual_provisions = message.annualProvisions ? base64FromBytes(message.annualProvisions) : undefined; + obj.annual_provisions = message.annualProvisions ? base64FromBytes(message.annualProvisions) : ""; return obj; }, fromAminoMsg(object: QueryAnnualProvisionsResponseAminoMsg): QueryAnnualProvisionsResponse { diff --git a/packages/api/src/cosmos/mint/v1beta1/tx.amino.ts b/packages/api/src/cosmos/mint/v1beta1/tx.amino.ts new file mode 100644 index 00000000..b4ca5337 --- /dev/null +++ b/packages/api/src/cosmos/mint/v1beta1/tx.amino.ts @@ -0,0 +1,9 @@ +//@ts-nocheck +import { MsgUpdateParams } from "./tx"; +export const AminoConverter = { + "/cosmos.mint.v1beta1.MsgUpdateParams": { + aminoType: "cosmos-sdk/x/mint/MsgUpdateParams", + toAmino: MsgUpdateParams.toAmino, + fromAmino: MsgUpdateParams.fromAmino + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/mint/v1beta1/tx.registry.ts b/packages/api/src/cosmos/mint/v1beta1/tx.registry.ts new file mode 100644 index 00000000..d1f7184e --- /dev/null +++ b/packages/api/src/cosmos/mint/v1beta1/tx.registry.ts @@ -0,0 +1,35 @@ +//@ts-nocheck +import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { MsgUpdateParams } from "./tx"; +export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.mint.v1beta1.MsgUpdateParams", MsgUpdateParams]]; +export const load = (protoRegistry: Registry) => { + registry.forEach(([typeUrl, mod]) => { + protoRegistry.register(typeUrl, mod); + }); +}; +export const MessageComposer = { + encoded: { + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/cosmos.mint.v1beta1.MsgUpdateParams", + value: MsgUpdateParams.encode(value).finish() + }; + } + }, + withTypeUrl: { + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/cosmos.mint.v1beta1.MsgUpdateParams", + value + }; + } + }, + fromPartial: { + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/cosmos.mint.v1beta1.MsgUpdateParams", + value: MsgUpdateParams.fromPartial(value) + }; + } + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/mint/v1beta1/tx.rpc.msg.ts b/packages/api/src/cosmos/mint/v1beta1/tx.rpc.msg.ts new file mode 100644 index 00000000..c5b81396 --- /dev/null +++ b/packages/api/src/cosmos/mint/v1beta1/tx.rpc.msg.ts @@ -0,0 +1,24 @@ +//@ts-nocheck +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; +import { MsgUpdateParams, MsgUpdateParamsResponse } from "./tx"; +/** Msg defines the x/mint Msg service. */ +export interface Msg { + /** + * UpdateParams defines a governance operation for updating the x/mint module + * parameters. The authority is defaults to the x/gov module account. + */ + updateParams(request: MsgUpdateParams): Promise; +} +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + this.updateParams = this.updateParams.bind(this); + } + updateParams(request: MsgUpdateParams): Promise { + const data = MsgUpdateParams.encode(request).finish(); + const promise = this.rpc.request("cosmos.mint.v1beta1.Msg", "UpdateParams", data); + return promise.then(data => MsgUpdateParamsResponse.decode(new BinaryReader(data))); + } +} \ No newline at end of file diff --git a/packages/api/src/cosmos/mint/v1beta1/tx.ts b/packages/api/src/cosmos/mint/v1beta1/tx.ts new file mode 100644 index 00000000..355d858a --- /dev/null +++ b/packages/api/src/cosmos/mint/v1beta1/tx.ts @@ -0,0 +1,198 @@ +//@ts-nocheck +import { Params, ParamsAmino, ParamsSDKType } from "./mint"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/mint parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params; +} +export interface MsgUpdateParamsProtoMsg { + typeUrl: "/cosmos.mint.v1beta1.MsgUpdateParams"; + value: Uint8Array; +} +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParamsAmino { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority?: string; + /** + * params defines the x/mint parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: ParamsAmino; +} +export interface MsgUpdateParamsAminoMsg { + type: "cosmos-sdk/x/mint/MsgUpdateParams"; + value: MsgUpdateParamsAmino; +} +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParamsSDKType { + authority: string; + params: ParamsSDKType; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponse {} +export interface MsgUpdateParamsResponseProtoMsg { + typeUrl: "/cosmos.mint.v1beta1.MsgUpdateParamsResponse"; + value: Uint8Array; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponseAmino {} +export interface MsgUpdateParamsResponseAminoMsg { + type: "cosmos-sdk/MsgUpdateParamsResponse"; + value: MsgUpdateParamsResponseAmino; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponseSDKType {} +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { + authority: "", + params: Params.fromPartial({}) + }; +} +export const MsgUpdateParams = { + typeUrl: "/cosmos.mint.v1beta1.MsgUpdateParams", + encode(message: MsgUpdateParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + message.authority = object.authority ?? ""; + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, + fromAmino(object: MsgUpdateParamsAmino): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: MsgUpdateParams): MsgUpdateParamsAmino { + const obj: any = {}; + obj.authority = message.authority === "" ? undefined : message.authority; + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); + return obj; + }, + fromAminoMsg(object: MsgUpdateParamsAminoMsg): MsgUpdateParams { + return MsgUpdateParams.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateParams): MsgUpdateParamsAminoMsg { + return { + type: "cosmos-sdk/x/mint/MsgUpdateParams", + value: MsgUpdateParams.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateParamsProtoMsg): MsgUpdateParams { + return MsgUpdateParams.decode(message.value); + }, + toProto(message: MsgUpdateParams): Uint8Array { + return MsgUpdateParams.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateParams): MsgUpdateParamsProtoMsg { + return { + typeUrl: "/cosmos.mint.v1beta1.MsgUpdateParams", + value: MsgUpdateParams.encode(message).finish() + }; + } +}; +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} +export const MsgUpdateParamsResponse = { + typeUrl: "/cosmos.mint.v1beta1.MsgUpdateParamsResponse", + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, + fromAmino(_: MsgUpdateParamsResponseAmino): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, + toAmino(_: MsgUpdateParamsResponse): MsgUpdateParamsResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUpdateParamsResponseAminoMsg): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateParamsResponse): MsgUpdateParamsResponseAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateParamsResponse", + value: MsgUpdateParamsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateParamsResponseProtoMsg): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.decode(message.value); + }, + toProto(message: MsgUpdateParamsResponse): Uint8Array { + return MsgUpdateParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateParamsResponse): MsgUpdateParamsResponseProtoMsg { + return { + typeUrl: "/cosmos.mint.v1beta1.MsgUpdateParamsResponse", + value: MsgUpdateParamsResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/msg/textual/v1/textual.ts b/packages/api/src/cosmos/msg/textual/v1/textual.ts new file mode 100644 index 00000000..693da49f --- /dev/null +++ b/packages/api/src/cosmos/msg/textual/v1/textual.ts @@ -0,0 +1 @@ +export {} \ No newline at end of file diff --git a/packages/api/src/cosmos/nft/module/v1/module.ts b/packages/api/src/cosmos/nft/module/v1/module.ts new file mode 100644 index 00000000..0d256d2d --- /dev/null +++ b/packages/api/src/cosmos/nft/module/v1/module.ts @@ -0,0 +1,72 @@ +//@ts-nocheck +import { BinaryReader, BinaryWriter } from "../../../../binary"; +/** Module is the config object of the nft module. */ +export interface Module {} +export interface ModuleProtoMsg { + typeUrl: "/cosmos.nft.module.v1.Module"; + value: Uint8Array; +} +/** Module is the config object of the nft module. */ +export interface ModuleAmino {} +export interface ModuleAminoMsg { + type: "cosmos-sdk/Module"; + value: ModuleAmino; +} +/** Module is the config object of the nft module. */ +export interface ModuleSDKType {} +function createBaseModule(): Module { + return {}; +} +export const Module = { + typeUrl: "/cosmos.nft.module.v1.Module", + encode(_: Module, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): Module { + const message = createBaseModule(); + return message; + }, + fromAmino(_: ModuleAmino): Module { + const message = createBaseModule(); + return message; + }, + toAmino(_: Module): ModuleAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: ModuleAminoMsg): Module { + return Module.fromAmino(object.value); + }, + toAminoMsg(message: Module): ModuleAminoMsg { + return { + type: "cosmos-sdk/Module", + value: Module.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleProtoMsg): Module { + return Module.decode(message.value); + }, + toProto(message: Module): Uint8Array { + return Module.encode(message).finish(); + }, + toProtoMsg(message: Module): ModuleProtoMsg { + return { + typeUrl: "/cosmos.nft.module.v1.Module", + value: Module.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/params/module/v1/module.ts b/packages/api/src/cosmos/params/module/v1/module.ts new file mode 100644 index 00000000..4fc1facb --- /dev/null +++ b/packages/api/src/cosmos/params/module/v1/module.ts @@ -0,0 +1,72 @@ +//@ts-nocheck +import { BinaryReader, BinaryWriter } from "../../../../binary"; +/** Module is the config object of the params module. */ +export interface Module {} +export interface ModuleProtoMsg { + typeUrl: "/cosmos.params.module.v1.Module"; + value: Uint8Array; +} +/** Module is the config object of the params module. */ +export interface ModuleAmino {} +export interface ModuleAminoMsg { + type: "cosmos-sdk/Module"; + value: ModuleAmino; +} +/** Module is the config object of the params module. */ +export interface ModuleSDKType {} +function createBaseModule(): Module { + return {}; +} +export const Module = { + typeUrl: "/cosmos.params.module.v1.Module", + encode(_: Module, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): Module { + const message = createBaseModule(); + return message; + }, + fromAmino(_: ModuleAmino): Module { + const message = createBaseModule(); + return message; + }, + toAmino(_: Module): ModuleAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: ModuleAminoMsg): Module { + return Module.fromAmino(object.value); + }, + toAminoMsg(message: Module): ModuleAminoMsg { + return { + type: "cosmos-sdk/Module", + value: Module.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleProtoMsg): Module { + return Module.decode(message.value); + }, + toProto(message: Module): Uint8Array { + return Module.encode(message).finish(); + }, + toProtoMsg(message: Module): ModuleProtoMsg { + return { + typeUrl: "/cosmos.params.module.v1.Module", + value: Module.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/params/v1beta1/params.ts b/packages/api/src/cosmos/params/v1beta1/params.ts index d34859fb..f05d7a67 100644 --- a/packages/api/src/cosmos/params/v1beta1/params.ts +++ b/packages/api/src/cosmos/params/v1beta1/params.ts @@ -15,7 +15,7 @@ export interface ParameterChangeProposalProtoMsg { export interface ParameterChangeProposalAmino { title?: string; description?: string; - changes?: ParamChangeAmino[]; + changes: ParamChangeAmino[]; } export interface ParameterChangeProposalAminoMsg { type: "cosmos-sdk/ParameterChangeProposal"; diff --git a/packages/api/src/cosmos/params/v1beta1/query.lcd.ts b/packages/api/src/cosmos/params/v1beta1/query.lcd.ts index c5c430d9..6212429a 100644 --- a/packages/api/src/cosmos/params/v1beta1/query.lcd.ts +++ b/packages/api/src/cosmos/params/v1beta1/query.lcd.ts @@ -27,9 +27,7 @@ export class LCDQueryClient { const endpoint = `cosmos/params/v1beta1/params`; return await this.req.get(endpoint, options); } - /* Subspaces queries for all registered subspaces and all keys for a subspace. - - Since: cosmos-sdk 0.46 */ + /* Subspaces queries for all registered subspaces and all keys for a subspace. */ async subspaces(_params: QuerySubspacesRequest = {}): Promise { const endpoint = `cosmos/params/v1beta1/subspaces`; return await this.req.get(endpoint); diff --git a/packages/api/src/cosmos/params/v1beta1/query.rpc.Query.ts b/packages/api/src/cosmos/params/v1beta1/query.rpc.Query.ts index 4415b5fe..84052a3a 100644 --- a/packages/api/src/cosmos/params/v1beta1/query.rpc.Query.ts +++ b/packages/api/src/cosmos/params/v1beta1/query.rpc.Query.ts @@ -10,11 +10,7 @@ export interface Query { * key. */ params(request: QueryParamsRequest): Promise; - /** - * Subspaces queries for all registered subspaces and all keys for a subspace. - * - * Since: cosmos-sdk 0.46 - */ + /** Subspaces queries for all registered subspaces and all keys for a subspace. */ subspaces(request?: QuerySubspacesRequest): Promise; } export class QueryClientImpl implements Query { diff --git a/packages/api/src/cosmos/params/v1beta1/query.ts b/packages/api/src/cosmos/params/v1beta1/query.ts index 38bf18dc..57a09c35 100644 --- a/packages/api/src/cosmos/params/v1beta1/query.ts +++ b/packages/api/src/cosmos/params/v1beta1/query.ts @@ -40,7 +40,7 @@ export interface QueryParamsResponseProtoMsg { /** QueryParamsResponse is response type for the Query/Params RPC method. */ export interface QueryParamsResponseAmino { /** param defines the queried parameter. */ - param?: ParamChangeAmino; + param: ParamChangeAmino; } export interface QueryParamsResponseAminoMsg { type: "cosmos-sdk/QueryParamsResponse"; @@ -53,8 +53,6 @@ export interface QueryParamsResponseSDKType { /** * QuerySubspacesRequest defines a request type for querying for all registered * subspaces and all keys for a subspace. - * - * Since: cosmos-sdk 0.46 */ export interface QuerySubspacesRequest {} export interface QuerySubspacesRequestProtoMsg { @@ -64,8 +62,6 @@ export interface QuerySubspacesRequestProtoMsg { /** * QuerySubspacesRequest defines a request type for querying for all registered * subspaces and all keys for a subspace. - * - * Since: cosmos-sdk 0.46 */ export interface QuerySubspacesRequestAmino {} export interface QuerySubspacesRequestAminoMsg { @@ -75,15 +71,11 @@ export interface QuerySubspacesRequestAminoMsg { /** * QuerySubspacesRequest defines a request type for querying for all registered * subspaces and all keys for a subspace. - * - * Since: cosmos-sdk 0.46 */ export interface QuerySubspacesRequestSDKType {} /** * QuerySubspacesResponse defines the response types for querying for all * registered subspaces and all keys for a subspace. - * - * Since: cosmos-sdk 0.46 */ export interface QuerySubspacesResponse { subspaces: Subspace[]; @@ -95,8 +87,6 @@ export interface QuerySubspacesResponseProtoMsg { /** * QuerySubspacesResponse defines the response types for querying for all * registered subspaces and all keys for a subspace. - * - * Since: cosmos-sdk 0.46 */ export interface QuerySubspacesResponseAmino { subspaces?: SubspaceAmino[]; @@ -108,8 +98,6 @@ export interface QuerySubspacesResponseAminoMsg { /** * QuerySubspacesResponse defines the response types for querying for all * registered subspaces and all keys for a subspace. - * - * Since: cosmos-sdk 0.46 */ export interface QuerySubspacesResponseSDKType { subspaces: SubspaceSDKType[]; @@ -117,8 +105,6 @@ export interface QuerySubspacesResponseSDKType { /** * Subspace defines a parameter subspace name and all the keys that exist for * the subspace. - * - * Since: cosmos-sdk 0.46 */ export interface Subspace { subspace: string; @@ -131,8 +117,6 @@ export interface SubspaceProtoMsg { /** * Subspace defines a parameter subspace name and all the keys that exist for * the subspace. - * - * Since: cosmos-sdk 0.46 */ export interface SubspaceAmino { subspace?: string; @@ -145,8 +129,6 @@ export interface SubspaceAminoMsg { /** * Subspace defines a parameter subspace name and all the keys that exist for * the subspace. - * - * Since: cosmos-sdk 0.46 */ export interface SubspaceSDKType { subspace: string; @@ -277,7 +259,7 @@ export const QueryParamsResponse = { }, toAmino(message: QueryParamsResponse): QueryParamsResponseAmino { const obj: any = {}; - obj.param = message.param ? ParamChange.toAmino(message.param) : undefined; + obj.param = message.param ? ParamChange.toAmino(message.param) : ParamChange.toAmino(ParamChange.fromPartial({})); return obj; }, fromAminoMsg(object: QueryParamsResponseAminoMsg): QueryParamsResponse { diff --git a/packages/api/src/cosmos/protocolpool/module/v1/module.ts b/packages/api/src/cosmos/protocolpool/module/v1/module.ts new file mode 100644 index 00000000..fd10938b --- /dev/null +++ b/packages/api/src/cosmos/protocolpool/module/v1/module.ts @@ -0,0 +1,93 @@ +//@ts-nocheck +import { BinaryReader, BinaryWriter } from "../../../../binary"; +/** Module is the config object of the consensus module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} +export interface ModuleProtoMsg { + typeUrl: "/cosmos.protocolpool.module.v1.Module"; + value: Uint8Array; +} +/** Module is the config object of the consensus module. */ +export interface ModuleAmino { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority?: string; +} +export interface ModuleAminoMsg { + type: "cosmos-sdk/Module"; + value: ModuleAmino; +} +/** Module is the config object of the consensus module. */ +export interface ModuleSDKType { + authority: string; +} +function createBaseModule(): Module { + return { + authority: "" + }; +} +export const Module = { + typeUrl: "/cosmos.protocolpool.module.v1.Module", + encode(message: Module, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, + fromAmino(object: ModuleAmino): Module { + const message = createBaseModule(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + return message; + }, + toAmino(message: Module): ModuleAmino { + const obj: any = {}; + obj.authority = message.authority === "" ? undefined : message.authority; + return obj; + }, + fromAminoMsg(object: ModuleAminoMsg): Module { + return Module.fromAmino(object.value); + }, + toAminoMsg(message: Module): ModuleAminoMsg { + return { + type: "cosmos-sdk/Module", + value: Module.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleProtoMsg): Module { + return Module.decode(message.value); + }, + toProto(message: Module): Uint8Array { + return Module.encode(message).finish(); + }, + toProtoMsg(message: Module): ModuleProtoMsg { + return { + typeUrl: "/cosmos.protocolpool.module.v1.Module", + value: Module.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/protocolpool/v1/genesis.ts b/packages/api/src/cosmos/protocolpool/v1/genesis.ts new file mode 100644 index 00000000..a038bcbd --- /dev/null +++ b/packages/api/src/cosmos/protocolpool/v1/genesis.ts @@ -0,0 +1,119 @@ +//@ts-nocheck +import { ContinuousFund, ContinuousFundAmino, ContinuousFundSDKType, Params, ParamsAmino, ParamsSDKType } from "./types"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +/** GenesisState defines the protocolpool module's genesis state. */ +export interface GenesisState { + /** ContinuousFunds defines the continuous funds at genesis. */ + continuousFunds: ContinuousFund[]; + /** + * Params defines the parameters of this module, currently only contains the + * denoms that will be used for continuous fund distributions. + */ + params: Params; +} +export interface GenesisStateProtoMsg { + typeUrl: "/cosmos.protocolpool.v1.GenesisState"; + value: Uint8Array; +} +/** GenesisState defines the protocolpool module's genesis state. */ +export interface GenesisStateAmino { + /** ContinuousFunds defines the continuous funds at genesis. */ + continuous_funds?: ContinuousFundAmino[]; + /** + * Params defines the parameters of this module, currently only contains the + * denoms that will be used for continuous fund distributions. + */ + params?: ParamsAmino; +} +export interface GenesisStateAminoMsg { + type: "cosmos-sdk/GenesisState"; + value: GenesisStateAmino; +} +/** GenesisState defines the protocolpool module's genesis state. */ +export interface GenesisStateSDKType { + continuous_funds: ContinuousFundSDKType[]; + params: ParamsSDKType; +} +function createBaseGenesisState(): GenesisState { + return { + continuousFunds: [], + params: Params.fromPartial({}) + }; +} +export const GenesisState = { + typeUrl: "/cosmos.protocolpool.v1.GenesisState", + encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.continuousFunds) { + ContinuousFund.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.params !== undefined) { + Params.encode(message.params, 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.continuousFunds.push(ContinuousFund.decode(reader, reader.uint32())); + break; + case 2: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): GenesisState { + const message = createBaseGenesisState(); + message.continuousFunds = object.continuousFunds?.map(e => ContinuousFund.fromPartial(e)) || []; + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, + fromAmino(object: GenesisStateAmino): GenesisState { + const message = createBaseGenesisState(); + message.continuousFunds = object.continuous_funds?.map(e => ContinuousFund.fromAmino(e)) || []; + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: GenesisState): GenesisStateAmino { + const obj: any = {}; + if (message.continuousFunds) { + obj.continuous_funds = message.continuousFunds.map(e => e ? ContinuousFund.toAmino(e) : undefined); + } else { + obj.continuous_funds = message.continuousFunds; + } + obj.params = message.params ? Params.toAmino(message.params) : undefined; + return obj; + }, + fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { + return GenesisState.fromAmino(object.value); + }, + toAminoMsg(message: GenesisState): GenesisStateAminoMsg { + return { + type: "cosmos-sdk/GenesisState", + value: GenesisState.toAmino(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: "/cosmos.protocolpool.v1.GenesisState", + value: GenesisState.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/protocolpool/v1/query.lcd.ts b/packages/api/src/cosmos/protocolpool/v1/query.lcd.ts new file mode 100644 index 00000000..ceb75520 --- /dev/null +++ b/packages/api/src/cosmos/protocolpool/v1/query.lcd.ts @@ -0,0 +1,37 @@ +//@ts-nocheck +import { LCDClient } from "@cosmology/lcd"; +import { QueryCommunityPoolRequest, QueryCommunityPoolResponseSDKType, QueryContinuousFundRequest, QueryContinuousFundResponseSDKType, QueryContinuousFundsRequest, QueryContinuousFundsResponseSDKType, QueryParamsRequest, QueryParamsResponseSDKType } from "./query"; +export class LCDQueryClient { + req: LCDClient; + constructor({ + requestClient + }: { + requestClient: LCDClient; + }) { + this.req = requestClient; + this.communityPool = this.communityPool.bind(this); + this.continuousFund = this.continuousFund.bind(this); + this.continuousFunds = this.continuousFunds.bind(this); + this.params = this.params.bind(this); + } + /* CommunityPool queries the community pool coins. */ + async communityPool(_params: QueryCommunityPoolRequest = {}): Promise { + const endpoint = `cosmos/protocolpool/v1/community_pool`; + return await this.req.get(endpoint); + } + /* ContinuousFund queries a continuous fund by the recipient is is associated with. */ + async continuousFund(params: QueryContinuousFundRequest): Promise { + const endpoint = `cosmos/protocolpool/v1/continuous_funds/${params.recipient}`; + return await this.req.get(endpoint); + } + /* ContinuousFunds queries all continuous funds in the store. */ + async continuousFunds(_params: QueryContinuousFundsRequest = {}): Promise { + const endpoint = `cosmos/protocolpool/v1/continuous_funds`; + return await this.req.get(endpoint); + } + /* Params returns the total set of x/protocolpool parameters. */ + async params(_params: QueryParamsRequest = {}): Promise { + const endpoint = `cosmos/protocolpool/v1/params`; + return await this.req.get(endpoint); + } +} \ No newline at end of file diff --git a/packages/api/src/cosmos/protocolpool/v1/query.rpc.Query.ts b/packages/api/src/cosmos/protocolpool/v1/query.rpc.Query.ts new file mode 100644 index 00000000..d5671373 --- /dev/null +++ b/packages/api/src/cosmos/protocolpool/v1/query.rpc.Query.ts @@ -0,0 +1,64 @@ +//@ts-nocheck +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; +import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; +import { QueryCommunityPoolRequest, QueryCommunityPoolResponse, QueryContinuousFundRequest, QueryContinuousFundResponse, QueryContinuousFundsRequest, QueryContinuousFundsResponse, QueryParamsRequest, QueryParamsResponse } from "./query"; +/** Query defines the gRPC querier service for community pool module. */ +export interface Query { + /** CommunityPool queries the community pool coins. */ + communityPool(request?: QueryCommunityPoolRequest): Promise; + /** ContinuousFund queries a continuous fund by the recipient is is associated with. */ + continuousFund(request: QueryContinuousFundRequest): Promise; + /** ContinuousFunds queries all continuous funds in the store. */ + continuousFunds(request?: QueryContinuousFundsRequest): Promise; + /** Params returns the total set of x/protocolpool parameters. */ + params(request?: QueryParamsRequest): Promise; +} +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + this.communityPool = this.communityPool.bind(this); + this.continuousFund = this.continuousFund.bind(this); + this.continuousFunds = this.continuousFunds.bind(this); + this.params = this.params.bind(this); + } + communityPool(request: QueryCommunityPoolRequest = {}): Promise { + const data = QueryCommunityPoolRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.protocolpool.v1.Query", "CommunityPool", data); + return promise.then(data => QueryCommunityPoolResponse.decode(new BinaryReader(data))); + } + continuousFund(request: QueryContinuousFundRequest): Promise { + const data = QueryContinuousFundRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.protocolpool.v1.Query", "ContinuousFund", data); + return promise.then(data => QueryContinuousFundResponse.decode(new BinaryReader(data))); + } + continuousFunds(request: QueryContinuousFundsRequest = {}): Promise { + const data = QueryContinuousFundsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.protocolpool.v1.Query", "ContinuousFunds", data); + return promise.then(data => QueryContinuousFundsResponse.decode(new BinaryReader(data))); + } + params(request: QueryParamsRequest = {}): Promise { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.protocolpool.v1.Query", "Params", data); + return promise.then(data => QueryParamsResponse.decode(new BinaryReader(data))); + } +} +export const createRpcQueryExtension = (base: QueryClient) => { + const rpc = createProtobufRpcClient(base); + const queryService = new QueryClientImpl(rpc); + return { + communityPool(request?: QueryCommunityPoolRequest): Promise { + return queryService.communityPool(request); + }, + continuousFund(request: QueryContinuousFundRequest): Promise { + return queryService.continuousFund(request); + }, + continuousFunds(request?: QueryContinuousFundsRequest): Promise { + return queryService.continuousFunds(request); + }, + params(request?: QueryParamsRequest): Promise { + return queryService.params(request); + } + }; +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/protocolpool/v1/query.ts b/packages/api/src/cosmos/protocolpool/v1/query.ts new file mode 100644 index 00000000..1bdb166a --- /dev/null +++ b/packages/api/src/cosmos/protocolpool/v1/query.ts @@ -0,0 +1,725 @@ +//@ts-nocheck +import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; +import { ContinuousFund, ContinuousFundAmino, ContinuousFundSDKType, Params, ParamsAmino, ParamsSDKType } from "./types"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +/** + * QueryCommunityPoolRequest is the request type for the Query/CommunityPool RPC + * method. + */ +export interface QueryCommunityPoolRequest {} +export interface QueryCommunityPoolRequestProtoMsg { + typeUrl: "/cosmos.protocolpool.v1.QueryCommunityPoolRequest"; + value: Uint8Array; +} +/** + * QueryCommunityPoolRequest is the request type for the Query/CommunityPool RPC + * method. + */ +export interface QueryCommunityPoolRequestAmino {} +export interface QueryCommunityPoolRequestAminoMsg { + type: "cosmos-sdk/QueryCommunityPoolRequest"; + value: QueryCommunityPoolRequestAmino; +} +/** + * QueryCommunityPoolRequest is the request type for the Query/CommunityPool RPC + * method. + */ +export interface QueryCommunityPoolRequestSDKType {} +/** + * QueryCommunityPoolResponse is the response type for the Query/CommunityPool + * RPC method. + */ +export interface QueryCommunityPoolResponse { + /** pool defines community pool's coins. */ + pool: Coin[]; +} +export interface QueryCommunityPoolResponseProtoMsg { + typeUrl: "/cosmos.protocolpool.v1.QueryCommunityPoolResponse"; + value: Uint8Array; +} +/** + * QueryCommunityPoolResponse is the response type for the Query/CommunityPool + * RPC method. + */ +export interface QueryCommunityPoolResponseAmino { + /** pool defines community pool's coins. */ + pool?: CoinAmino[]; +} +export interface QueryCommunityPoolResponseAminoMsg { + type: "cosmos-sdk/QueryCommunityPoolResponse"; + value: QueryCommunityPoolResponseAmino; +} +/** + * QueryCommunityPoolResponse is the response type for the Query/CommunityPool + * RPC method. + */ +export interface QueryCommunityPoolResponseSDKType { + pool: CoinSDKType[]; +} +/** + * QueryContinuousFundRequest is the request type for the Query/ContinuousFund + * RPC method. + */ +export interface QueryContinuousFundRequest { + /** recipient is the recipient address to query unclaimed budget amount for. */ + recipient: string; +} +export interface QueryContinuousFundRequestProtoMsg { + typeUrl: "/cosmos.protocolpool.v1.QueryContinuousFundRequest"; + value: Uint8Array; +} +/** + * QueryContinuousFundRequest is the request type for the Query/ContinuousFund + * RPC method. + */ +export interface QueryContinuousFundRequestAmino { + /** recipient is the recipient address to query unclaimed budget amount for. */ + recipient?: string; +} +export interface QueryContinuousFundRequestAminoMsg { + type: "cosmos-sdk/QueryContinuousFundRequest"; + value: QueryContinuousFundRequestAmino; +} +/** + * QueryContinuousFundRequest is the request type for the Query/ContinuousFund + * RPC method. + */ +export interface QueryContinuousFundRequestSDKType { + recipient: string; +} +/** + * QueryUnclaimedBudgetResponse is the response type for the Query/ContinuousFund + * RPC method. + */ +export interface QueryContinuousFundResponse { + /** ContinuousFunds is the given continuous fund returned in the query. */ + continuousFund: ContinuousFund; +} +export interface QueryContinuousFundResponseProtoMsg { + typeUrl: "/cosmos.protocolpool.v1.QueryContinuousFundResponse"; + value: Uint8Array; +} +/** + * QueryUnclaimedBudgetResponse is the response type for the Query/ContinuousFund + * RPC method. + */ +export interface QueryContinuousFundResponseAmino { + /** ContinuousFunds is the given continuous fund returned in the query. */ + continuous_fund?: ContinuousFundAmino; +} +export interface QueryContinuousFundResponseAminoMsg { + type: "cosmos-sdk/QueryContinuousFundResponse"; + value: QueryContinuousFundResponseAmino; +} +/** + * QueryUnclaimedBudgetResponse is the response type for the Query/ContinuousFund + * RPC method. + */ +export interface QueryContinuousFundResponseSDKType { + continuous_fund: ContinuousFundSDKType; +} +/** + * QueryContinuousFundRequest is the request type for the Query/ContinuousFunds + * RPC method. + */ +export interface QueryContinuousFundsRequest {} +export interface QueryContinuousFundsRequestProtoMsg { + typeUrl: "/cosmos.protocolpool.v1.QueryContinuousFundsRequest"; + value: Uint8Array; +} +/** + * QueryContinuousFundRequest is the request type for the Query/ContinuousFunds + * RPC method. + */ +export interface QueryContinuousFundsRequestAmino {} +export interface QueryContinuousFundsRequestAminoMsg { + type: "cosmos-sdk/QueryContinuousFundsRequest"; + value: QueryContinuousFundsRequestAmino; +} +/** + * QueryContinuousFundRequest is the request type for the Query/ContinuousFunds + * RPC method. + */ +export interface QueryContinuousFundsRequestSDKType {} +/** + * QueryUnclaimedBudgetResponse is the response type for the Query/ContinuousFunds + * RPC method. + */ +export interface QueryContinuousFundsResponse { + /** ContinuousFunds defines all continuous funds in state. */ + continuousFunds: ContinuousFund[]; +} +export interface QueryContinuousFundsResponseProtoMsg { + typeUrl: "/cosmos.protocolpool.v1.QueryContinuousFundsResponse"; + value: Uint8Array; +} +/** + * QueryUnclaimedBudgetResponse is the response type for the Query/ContinuousFunds + * RPC method. + */ +export interface QueryContinuousFundsResponseAmino { + /** ContinuousFunds defines all continuous funds in state. */ + continuous_funds?: ContinuousFundAmino[]; +} +export interface QueryContinuousFundsResponseAminoMsg { + type: "cosmos-sdk/QueryContinuousFundsResponse"; + value: QueryContinuousFundsResponseAmino; +} +/** + * QueryUnclaimedBudgetResponse is the response type for the Query/ContinuousFunds + * RPC method. + */ +export interface QueryContinuousFundsResponseSDKType { + continuous_funds: ContinuousFundSDKType[]; +} +/** QueryParamsRequest is the response type for the Query/Params RPC method. */ +export interface QueryParamsRequest {} +export interface QueryParamsRequestProtoMsg { + typeUrl: "/cosmos.protocolpool.v1.QueryParamsRequest"; + value: Uint8Array; +} +/** QueryParamsRequest is the response type for the Query/Params RPC method. */ +export interface QueryParamsRequestAmino {} +export interface QueryParamsRequestAminoMsg { + type: "cosmos-sdk/QueryParamsRequest"; + value: QueryParamsRequestAmino; +} +/** QueryParamsRequest is the response 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: Params; +} +export interface QueryParamsResponseProtoMsg { + typeUrl: "/cosmos.protocolpool.v1.QueryParamsResponse"; + value: Uint8Array; +} +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponseAmino { + params?: ParamsAmino; +} +export interface QueryParamsResponseAminoMsg { + type: "cosmos-sdk/QueryParamsResponse"; + value: QueryParamsResponseAmino; +} +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponseSDKType { + params: ParamsSDKType; +} +function createBaseQueryCommunityPoolRequest(): QueryCommunityPoolRequest { + return {}; +} +export const QueryCommunityPoolRequest = { + typeUrl: "/cosmos.protocolpool.v1.QueryCommunityPoolRequest", + encode(_: QueryCommunityPoolRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommunityPoolRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommunityPoolRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): QueryCommunityPoolRequest { + const message = createBaseQueryCommunityPoolRequest(); + return message; + }, + fromAmino(_: QueryCommunityPoolRequestAmino): QueryCommunityPoolRequest { + const message = createBaseQueryCommunityPoolRequest(); + return message; + }, + toAmino(_: QueryCommunityPoolRequest): QueryCommunityPoolRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryCommunityPoolRequestAminoMsg): QueryCommunityPoolRequest { + return QueryCommunityPoolRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryCommunityPoolRequest): QueryCommunityPoolRequestAminoMsg { + return { + type: "cosmos-sdk/QueryCommunityPoolRequest", + value: QueryCommunityPoolRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryCommunityPoolRequestProtoMsg): QueryCommunityPoolRequest { + return QueryCommunityPoolRequest.decode(message.value); + }, + toProto(message: QueryCommunityPoolRequest): Uint8Array { + return QueryCommunityPoolRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryCommunityPoolRequest): QueryCommunityPoolRequestProtoMsg { + return { + typeUrl: "/cosmos.protocolpool.v1.QueryCommunityPoolRequest", + value: QueryCommunityPoolRequest.encode(message).finish() + }; + } +}; +function createBaseQueryCommunityPoolResponse(): QueryCommunityPoolResponse { + return { + pool: [] + }; +} +export const QueryCommunityPoolResponse = { + typeUrl: "/cosmos.protocolpool.v1.QueryCommunityPoolResponse", + encode(message: QueryCommunityPoolResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.pool) { + Coin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommunityPoolResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommunityPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pool.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryCommunityPoolResponse { + const message = createBaseQueryCommunityPoolResponse(); + message.pool = object.pool?.map(e => Coin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: QueryCommunityPoolResponseAmino): QueryCommunityPoolResponse { + const message = createBaseQueryCommunityPoolResponse(); + message.pool = object.pool?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: QueryCommunityPoolResponse): QueryCommunityPoolResponseAmino { + const obj: any = {}; + if (message.pool) { + obj.pool = message.pool.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.pool = message.pool; + } + return obj; + }, + fromAminoMsg(object: QueryCommunityPoolResponseAminoMsg): QueryCommunityPoolResponse { + return QueryCommunityPoolResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryCommunityPoolResponse): QueryCommunityPoolResponseAminoMsg { + return { + type: "cosmos-sdk/QueryCommunityPoolResponse", + value: QueryCommunityPoolResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryCommunityPoolResponseProtoMsg): QueryCommunityPoolResponse { + return QueryCommunityPoolResponse.decode(message.value); + }, + toProto(message: QueryCommunityPoolResponse): Uint8Array { + return QueryCommunityPoolResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryCommunityPoolResponse): QueryCommunityPoolResponseProtoMsg { + return { + typeUrl: "/cosmos.protocolpool.v1.QueryCommunityPoolResponse", + value: QueryCommunityPoolResponse.encode(message).finish() + }; + } +}; +function createBaseQueryContinuousFundRequest(): QueryContinuousFundRequest { + return { + recipient: "" + }; +} +export const QueryContinuousFundRequest = { + typeUrl: "/cosmos.protocolpool.v1.QueryContinuousFundRequest", + encode(message: QueryContinuousFundRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.recipient !== "") { + writer.uint32(10).string(message.recipient); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryContinuousFundRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryContinuousFundRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.recipient = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryContinuousFundRequest { + const message = createBaseQueryContinuousFundRequest(); + message.recipient = object.recipient ?? ""; + return message; + }, + fromAmino(object: QueryContinuousFundRequestAmino): QueryContinuousFundRequest { + const message = createBaseQueryContinuousFundRequest(); + if (object.recipient !== undefined && object.recipient !== null) { + message.recipient = object.recipient; + } + return message; + }, + toAmino(message: QueryContinuousFundRequest): QueryContinuousFundRequestAmino { + const obj: any = {}; + obj.recipient = message.recipient === "" ? undefined : message.recipient; + return obj; + }, + fromAminoMsg(object: QueryContinuousFundRequestAminoMsg): QueryContinuousFundRequest { + return QueryContinuousFundRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryContinuousFundRequest): QueryContinuousFundRequestAminoMsg { + return { + type: "cosmos-sdk/QueryContinuousFundRequest", + value: QueryContinuousFundRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryContinuousFundRequestProtoMsg): QueryContinuousFundRequest { + return QueryContinuousFundRequest.decode(message.value); + }, + toProto(message: QueryContinuousFundRequest): Uint8Array { + return QueryContinuousFundRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryContinuousFundRequest): QueryContinuousFundRequestProtoMsg { + return { + typeUrl: "/cosmos.protocolpool.v1.QueryContinuousFundRequest", + value: QueryContinuousFundRequest.encode(message).finish() + }; + } +}; +function createBaseQueryContinuousFundResponse(): QueryContinuousFundResponse { + return { + continuousFund: ContinuousFund.fromPartial({}) + }; +} +export const QueryContinuousFundResponse = { + typeUrl: "/cosmos.protocolpool.v1.QueryContinuousFundResponse", + encode(message: QueryContinuousFundResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.continuousFund !== undefined) { + ContinuousFund.encode(message.continuousFund, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryContinuousFundResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryContinuousFundResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.continuousFund = ContinuousFund.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryContinuousFundResponse { + const message = createBaseQueryContinuousFundResponse(); + message.continuousFund = object.continuousFund !== undefined && object.continuousFund !== null ? ContinuousFund.fromPartial(object.continuousFund) : undefined; + return message; + }, + fromAmino(object: QueryContinuousFundResponseAmino): QueryContinuousFundResponse { + const message = createBaseQueryContinuousFundResponse(); + if (object.continuous_fund !== undefined && object.continuous_fund !== null) { + message.continuousFund = ContinuousFund.fromAmino(object.continuous_fund); + } + return message; + }, + toAmino(message: QueryContinuousFundResponse): QueryContinuousFundResponseAmino { + const obj: any = {}; + obj.continuous_fund = message.continuousFund ? ContinuousFund.toAmino(message.continuousFund) : undefined; + return obj; + }, + fromAminoMsg(object: QueryContinuousFundResponseAminoMsg): QueryContinuousFundResponse { + return QueryContinuousFundResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryContinuousFundResponse): QueryContinuousFundResponseAminoMsg { + return { + type: "cosmos-sdk/QueryContinuousFundResponse", + value: QueryContinuousFundResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryContinuousFundResponseProtoMsg): QueryContinuousFundResponse { + return QueryContinuousFundResponse.decode(message.value); + }, + toProto(message: QueryContinuousFundResponse): Uint8Array { + return QueryContinuousFundResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryContinuousFundResponse): QueryContinuousFundResponseProtoMsg { + return { + typeUrl: "/cosmos.protocolpool.v1.QueryContinuousFundResponse", + value: QueryContinuousFundResponse.encode(message).finish() + }; + } +}; +function createBaseQueryContinuousFundsRequest(): QueryContinuousFundsRequest { + return {}; +} +export const QueryContinuousFundsRequest = { + typeUrl: "/cosmos.protocolpool.v1.QueryContinuousFundsRequest", + encode(_: QueryContinuousFundsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryContinuousFundsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryContinuousFundsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): QueryContinuousFundsRequest { + const message = createBaseQueryContinuousFundsRequest(); + return message; + }, + fromAmino(_: QueryContinuousFundsRequestAmino): QueryContinuousFundsRequest { + const message = createBaseQueryContinuousFundsRequest(); + return message; + }, + toAmino(_: QueryContinuousFundsRequest): QueryContinuousFundsRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryContinuousFundsRequestAminoMsg): QueryContinuousFundsRequest { + return QueryContinuousFundsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryContinuousFundsRequest): QueryContinuousFundsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryContinuousFundsRequest", + value: QueryContinuousFundsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryContinuousFundsRequestProtoMsg): QueryContinuousFundsRequest { + return QueryContinuousFundsRequest.decode(message.value); + }, + toProto(message: QueryContinuousFundsRequest): Uint8Array { + return QueryContinuousFundsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryContinuousFundsRequest): QueryContinuousFundsRequestProtoMsg { + return { + typeUrl: "/cosmos.protocolpool.v1.QueryContinuousFundsRequest", + value: QueryContinuousFundsRequest.encode(message).finish() + }; + } +}; +function createBaseQueryContinuousFundsResponse(): QueryContinuousFundsResponse { + return { + continuousFunds: [] + }; +} +export const QueryContinuousFundsResponse = { + typeUrl: "/cosmos.protocolpool.v1.QueryContinuousFundsResponse", + encode(message: QueryContinuousFundsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.continuousFunds) { + ContinuousFund.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryContinuousFundsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryContinuousFundsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.continuousFunds.push(ContinuousFund.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryContinuousFundsResponse { + const message = createBaseQueryContinuousFundsResponse(); + message.continuousFunds = object.continuousFunds?.map(e => ContinuousFund.fromPartial(e)) || []; + return message; + }, + fromAmino(object: QueryContinuousFundsResponseAmino): QueryContinuousFundsResponse { + const message = createBaseQueryContinuousFundsResponse(); + message.continuousFunds = object.continuous_funds?.map(e => ContinuousFund.fromAmino(e)) || []; + return message; + }, + toAmino(message: QueryContinuousFundsResponse): QueryContinuousFundsResponseAmino { + const obj: any = {}; + if (message.continuousFunds) { + obj.continuous_funds = message.continuousFunds.map(e => e ? ContinuousFund.toAmino(e) : undefined); + } else { + obj.continuous_funds = message.continuousFunds; + } + return obj; + }, + fromAminoMsg(object: QueryContinuousFundsResponseAminoMsg): QueryContinuousFundsResponse { + return QueryContinuousFundsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryContinuousFundsResponse): QueryContinuousFundsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryContinuousFundsResponse", + value: QueryContinuousFundsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryContinuousFundsResponseProtoMsg): QueryContinuousFundsResponse { + return QueryContinuousFundsResponse.decode(message.value); + }, + toProto(message: QueryContinuousFundsResponse): Uint8Array { + return QueryContinuousFundsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryContinuousFundsResponse): QueryContinuousFundsResponseProtoMsg { + return { + typeUrl: "/cosmos.protocolpool.v1.QueryContinuousFundsResponse", + value: QueryContinuousFundsResponse.encode(message).finish() + }; + } +}; +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} +export const QueryParamsRequest = { + typeUrl: "/cosmos.protocolpool.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; + }, + fromPartial(_: Partial): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, + fromAmino(_: QueryParamsRequestAmino): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, + toAmino(_: QueryParamsRequest): QueryParamsRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { + return QueryParamsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsRequest): QueryParamsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryParamsRequest", + value: QueryParamsRequest.toAmino(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: "/cosmos.protocolpool.v1.QueryParamsRequest", + value: QueryParamsRequest.encode(message).finish() + }; + } +}; +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { + params: Params.fromPartial({}) + }; +} +export const QueryParamsResponse = { + typeUrl: "/cosmos.protocolpool.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; + }, + fromPartial(object: Partial): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, + fromAmino(object: QueryParamsResponseAmino): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: QueryParamsResponse): QueryParamsResponseAmino { + const obj: any = {}; + obj.params = message.params ? Params.toAmino(message.params) : undefined; + return obj; + }, + fromAminoMsg(object: QueryParamsResponseAminoMsg): QueryParamsResponse { + return QueryParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsResponse): QueryParamsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryParamsResponse", + value: QueryParamsResponse.toAmino(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: "/cosmos.protocolpool.v1.QueryParamsResponse", + value: QueryParamsResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/protocolpool/v1/tx.amino.ts b/packages/api/src/cosmos/protocolpool/v1/tx.amino.ts new file mode 100644 index 00000000..a663e57d --- /dev/null +++ b/packages/api/src/cosmos/protocolpool/v1/tx.amino.ts @@ -0,0 +1,29 @@ +//@ts-nocheck +import { MsgFundCommunityPool, MsgCommunityPoolSpend, MsgCreateContinuousFund, MsgCancelContinuousFund, MsgUpdateParams } from "./tx"; +export const AminoConverter = { + "/cosmos.protocolpool.v1.MsgFundCommunityPool": { + aminoType: "cosmos-sdk/MsgFundCommunityPool", + toAmino: MsgFundCommunityPool.toAmino, + fromAmino: MsgFundCommunityPool.fromAmino + }, + "/cosmos.protocolpool.v1.MsgCommunityPoolSpend": { + aminoType: "cosmos-sdk/MsgCommunityPoolSpend", + toAmino: MsgCommunityPoolSpend.toAmino, + fromAmino: MsgCommunityPoolSpend.fromAmino + }, + "/cosmos.protocolpool.v1.MsgCreateContinuousFund": { + aminoType: "cosmos-sdk/MsgCreateContinuousFund", + toAmino: MsgCreateContinuousFund.toAmino, + fromAmino: MsgCreateContinuousFund.fromAmino + }, + "/cosmos.protocolpool.v1.MsgCancelContinuousFund": { + aminoType: "cosmos-sdk/MsgCancelContinuousFund", + toAmino: MsgCancelContinuousFund.toAmino, + fromAmino: MsgCancelContinuousFund.fromAmino + }, + "/cosmos.protocolpool.v1.MsgUpdateParams": { + aminoType: "cosmos-sdk/MsgUpdateParams", + toAmino: MsgUpdateParams.toAmino, + fromAmino: MsgUpdateParams.fromAmino + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/protocolpool/v1/tx.registry.ts b/packages/api/src/cosmos/protocolpool/v1/tx.registry.ts new file mode 100644 index 00000000..555dd30f --- /dev/null +++ b/packages/api/src/cosmos/protocolpool/v1/tx.registry.ts @@ -0,0 +1,107 @@ +//@ts-nocheck +import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { MsgFundCommunityPool, MsgCommunityPoolSpend, MsgCreateContinuousFund, MsgCancelContinuousFund, MsgUpdateParams } from "./tx"; +export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.protocolpool.v1.MsgFundCommunityPool", MsgFundCommunityPool], ["/cosmos.protocolpool.v1.MsgCommunityPoolSpend", MsgCommunityPoolSpend], ["/cosmos.protocolpool.v1.MsgCreateContinuousFund", MsgCreateContinuousFund], ["/cosmos.protocolpool.v1.MsgCancelContinuousFund", MsgCancelContinuousFund], ["/cosmos.protocolpool.v1.MsgUpdateParams", MsgUpdateParams]]; +export const load = (protoRegistry: Registry) => { + registry.forEach(([typeUrl, mod]) => { + protoRegistry.register(typeUrl, mod); + }); +}; +export const MessageComposer = { + encoded: { + fundCommunityPool(value: MsgFundCommunityPool) { + return { + typeUrl: "/cosmos.protocolpool.v1.MsgFundCommunityPool", + value: MsgFundCommunityPool.encode(value).finish() + }; + }, + communityPoolSpend(value: MsgCommunityPoolSpend) { + return { + typeUrl: "/cosmos.protocolpool.v1.MsgCommunityPoolSpend", + value: MsgCommunityPoolSpend.encode(value).finish() + }; + }, + createContinuousFund(value: MsgCreateContinuousFund) { + return { + typeUrl: "/cosmos.protocolpool.v1.MsgCreateContinuousFund", + value: MsgCreateContinuousFund.encode(value).finish() + }; + }, + cancelContinuousFund(value: MsgCancelContinuousFund) { + return { + typeUrl: "/cosmos.protocolpool.v1.MsgCancelContinuousFund", + value: MsgCancelContinuousFund.encode(value).finish() + }; + }, + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/cosmos.protocolpool.v1.MsgUpdateParams", + value: MsgUpdateParams.encode(value).finish() + }; + } + }, + withTypeUrl: { + fundCommunityPool(value: MsgFundCommunityPool) { + return { + typeUrl: "/cosmos.protocolpool.v1.MsgFundCommunityPool", + value + }; + }, + communityPoolSpend(value: MsgCommunityPoolSpend) { + return { + typeUrl: "/cosmos.protocolpool.v1.MsgCommunityPoolSpend", + value + }; + }, + createContinuousFund(value: MsgCreateContinuousFund) { + return { + typeUrl: "/cosmos.protocolpool.v1.MsgCreateContinuousFund", + value + }; + }, + cancelContinuousFund(value: MsgCancelContinuousFund) { + return { + typeUrl: "/cosmos.protocolpool.v1.MsgCancelContinuousFund", + value + }; + }, + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/cosmos.protocolpool.v1.MsgUpdateParams", + value + }; + } + }, + fromPartial: { + fundCommunityPool(value: MsgFundCommunityPool) { + return { + typeUrl: "/cosmos.protocolpool.v1.MsgFundCommunityPool", + value: MsgFundCommunityPool.fromPartial(value) + }; + }, + communityPoolSpend(value: MsgCommunityPoolSpend) { + return { + typeUrl: "/cosmos.protocolpool.v1.MsgCommunityPoolSpend", + value: MsgCommunityPoolSpend.fromPartial(value) + }; + }, + createContinuousFund(value: MsgCreateContinuousFund) { + return { + typeUrl: "/cosmos.protocolpool.v1.MsgCreateContinuousFund", + value: MsgCreateContinuousFund.fromPartial(value) + }; + }, + cancelContinuousFund(value: MsgCancelContinuousFund) { + return { + typeUrl: "/cosmos.protocolpool.v1.MsgCancelContinuousFund", + value: MsgCancelContinuousFund.fromPartial(value) + }; + }, + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/cosmos.protocolpool.v1.MsgUpdateParams", + value: MsgUpdateParams.fromPartial(value) + }; + } + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/protocolpool/v1/tx.rpc.msg.ts b/packages/api/src/cosmos/protocolpool/v1/tx.rpc.msg.ts new file mode 100644 index 00000000..044152f2 --- /dev/null +++ b/packages/api/src/cosmos/protocolpool/v1/tx.rpc.msg.ts @@ -0,0 +1,69 @@ +//@ts-nocheck +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; +import { MsgFundCommunityPool, MsgFundCommunityPoolResponse, MsgCommunityPoolSpend, MsgCommunityPoolSpendResponse, MsgCreateContinuousFund, MsgCreateContinuousFundResponse, MsgCancelContinuousFund, MsgCancelContinuousFundResponse, MsgUpdateParams, MsgUpdateParamsResponse } from "./tx"; +/** Msg defines the pool Msg service. */ +export interface Msg { + /** + * FundCommunityPool defines a method to allow an account to directly + * fund the community pool. + */ + fundCommunityPool(request: MsgFundCommunityPool): Promise; + /** + * CommunityPoolSpend defines a governance operation for sending tokens from + * the community pool in the x/protocolpool module to another account, which + * could be the governance module itself. The authority is defined in the + * keeper. + */ + communityPoolSpend(request: MsgCommunityPoolSpend): Promise; + /** + * CreateContinuousFund defines a method to distribute a percentage of funds to an address continuously. + * This ContinuousFund can be indefinite or run until a given expiry time. + * Funds come from validator block rewards from x/distribution, but may also come from + * any user who funds the ProtocolPoolEscrow module account directly through x/bank. + */ + createContinuousFund(request: MsgCreateContinuousFund): Promise; + /** CancelContinuousFund defines a method for cancelling continuous fund. */ + cancelContinuousFund(request: MsgCancelContinuousFund): Promise; + /** + * UpdateParams defines a governance operation for updating the x/protocolpool module parameters. + * The authority is defined in the keeper. + */ + updateParams(request: MsgUpdateParams): Promise; +} +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + this.fundCommunityPool = this.fundCommunityPool.bind(this); + this.communityPoolSpend = this.communityPoolSpend.bind(this); + this.createContinuousFund = this.createContinuousFund.bind(this); + this.cancelContinuousFund = this.cancelContinuousFund.bind(this); + this.updateParams = this.updateParams.bind(this); + } + fundCommunityPool(request: MsgFundCommunityPool): Promise { + const data = MsgFundCommunityPool.encode(request).finish(); + const promise = this.rpc.request("cosmos.protocolpool.v1.Msg", "FundCommunityPool", data); + return promise.then(data => MsgFundCommunityPoolResponse.decode(new BinaryReader(data))); + } + communityPoolSpend(request: MsgCommunityPoolSpend): Promise { + const data = MsgCommunityPoolSpend.encode(request).finish(); + const promise = this.rpc.request("cosmos.protocolpool.v1.Msg", "CommunityPoolSpend", data); + return promise.then(data => MsgCommunityPoolSpendResponse.decode(new BinaryReader(data))); + } + createContinuousFund(request: MsgCreateContinuousFund): Promise { + const data = MsgCreateContinuousFund.encode(request).finish(); + const promise = this.rpc.request("cosmos.protocolpool.v1.Msg", "CreateContinuousFund", data); + return promise.then(data => MsgCreateContinuousFundResponse.decode(new BinaryReader(data))); + } + cancelContinuousFund(request: MsgCancelContinuousFund): Promise { + const data = MsgCancelContinuousFund.encode(request).finish(); + const promise = this.rpc.request("cosmos.protocolpool.v1.Msg", "CancelContinuousFund", data); + return promise.then(data => MsgCancelContinuousFundResponse.decode(new BinaryReader(data))); + } + updateParams(request: MsgUpdateParams): Promise { + const data = MsgUpdateParams.encode(request).finish(); + const promise = this.rpc.request("cosmos.protocolpool.v1.Msg", "UpdateParams", data); + return promise.then(data => MsgUpdateParamsResponse.decode(new BinaryReader(data))); + } +} \ No newline at end of file diff --git a/packages/api/src/cosmos/protocolpool/v1/tx.ts b/packages/api/src/cosmos/protocolpool/v1/tx.ts new file mode 100644 index 00000000..dba071b7 --- /dev/null +++ b/packages/api/src/cosmos/protocolpool/v1/tx.ts @@ -0,0 +1,1064 @@ +//@ts-nocheck +import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { Params, ParamsAmino, ParamsSDKType } from "./types"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { Decimal } from "@cosmjs/math"; +import { toTimestamp, fromTimestamp } from "../../../helpers"; +/** + * MsgFundCommunityPool allows an account to directly + * fund the community pool. + */ +export interface MsgFundCommunityPool { + depositor: string; + amount: Coin[]; +} +export interface MsgFundCommunityPoolProtoMsg { + typeUrl: "/cosmos.protocolpool.v1.MsgFundCommunityPool"; + value: Uint8Array; +} +/** + * MsgFundCommunityPool allows an account to directly + * fund the community pool. + */ +export interface MsgFundCommunityPoolAmino { + depositor?: string; + amount?: CoinAmino[]; +} +export interface MsgFundCommunityPoolAminoMsg { + type: "cosmos-sdk/MsgFundCommunityPool"; + value: MsgFundCommunityPoolAmino; +} +/** + * MsgFundCommunityPool allows an account to directly + * fund the community pool. + */ +export interface MsgFundCommunityPoolSDKType { + depositor: string; + amount: CoinSDKType[]; +} +/** MsgFundCommunityPoolResponse defines the Msg/FundCommunityPool response type. */ +export interface MsgFundCommunityPoolResponse {} +export interface MsgFundCommunityPoolResponseProtoMsg { + typeUrl: "/cosmos.protocolpool.v1.MsgFundCommunityPoolResponse"; + value: Uint8Array; +} +/** MsgFundCommunityPoolResponse defines the Msg/FundCommunityPool response type. */ +export interface MsgFundCommunityPoolResponseAmino {} +export interface MsgFundCommunityPoolResponseAminoMsg { + type: "cosmos-sdk/MsgFundCommunityPoolResponse"; + value: MsgFundCommunityPoolResponseAmino; +} +/** MsgFundCommunityPoolResponse defines the Msg/FundCommunityPool response type. */ +export interface MsgFundCommunityPoolResponseSDKType {} +/** + * MsgCommunityPoolSpend defines a message for sending tokens from the community + * pool to another account. This message is typically executed via a governance + * proposal with the governance module being the executing authority. + */ +export interface MsgCommunityPoolSpend { + /** Authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + recipient: string; + amount: Coin[]; +} +export interface MsgCommunityPoolSpendProtoMsg { + typeUrl: "/cosmos.protocolpool.v1.MsgCommunityPoolSpend"; + value: Uint8Array; +} +/** + * MsgCommunityPoolSpend defines a message for sending tokens from the community + * pool to another account. This message is typically executed via a governance + * proposal with the governance module being the executing authority. + */ +export interface MsgCommunityPoolSpendAmino { + /** Authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority?: string; + recipient?: string; + amount?: CoinAmino[]; +} +export interface MsgCommunityPoolSpendAminoMsg { + type: "cosmos-sdk/MsgCommunityPoolSpend"; + value: MsgCommunityPoolSpendAmino; +} +/** + * MsgCommunityPoolSpend defines a message for sending tokens from the community + * pool to another account. This message is typically executed via a governance + * proposal with the governance module being the executing authority. + */ +export interface MsgCommunityPoolSpendSDKType { + authority: string; + recipient: string; + amount: CoinSDKType[]; +} +/** + * MsgCommunityPoolSpendResponse defines the response to executing a + * MsgCommunityPoolSpend message. + */ +export interface MsgCommunityPoolSpendResponse {} +export interface MsgCommunityPoolSpendResponseProtoMsg { + typeUrl: "/cosmos.protocolpool.v1.MsgCommunityPoolSpendResponse"; + value: Uint8Array; +} +/** + * MsgCommunityPoolSpendResponse defines the response to executing a + * MsgCommunityPoolSpend message. + */ +export interface MsgCommunityPoolSpendResponseAmino {} +export interface MsgCommunityPoolSpendResponseAminoMsg { + type: "cosmos-sdk/MsgCommunityPoolSpendResponse"; + value: MsgCommunityPoolSpendResponseAmino; +} +/** + * MsgCommunityPoolSpendResponse defines the response to executing a + * MsgCommunityPoolSpend message. + */ +export interface MsgCommunityPoolSpendResponseSDKType {} +/** MsgCreateContinuousFund defines a message for adding continuous funds. */ +export interface MsgCreateContinuousFund { + /** Authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** Recipient address of the account receiving funds. */ + recipient: string; + /** Percentage is the percentage of funds to be allocated from Community pool. */ + percentage: string; + /** Optional, if expiry is set, removes the state object when expired. */ + expiry?: Date; +} +export interface MsgCreateContinuousFundProtoMsg { + typeUrl: "/cosmos.protocolpool.v1.MsgCreateContinuousFund"; + value: Uint8Array; +} +/** MsgCreateContinuousFund defines a message for adding continuous funds. */ +export interface MsgCreateContinuousFundAmino { + /** Authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority?: string; + /** Recipient address of the account receiving funds. */ + recipient?: string; + /** Percentage is the percentage of funds to be allocated from Community pool. */ + percentage?: string; + /** Optional, if expiry is set, removes the state object when expired. */ + expiry?: string; +} +export interface MsgCreateContinuousFundAminoMsg { + type: "cosmos-sdk/MsgCreateContinuousFund"; + value: MsgCreateContinuousFundAmino; +} +/** MsgCreateContinuousFund defines a message for adding continuous funds. */ +export interface MsgCreateContinuousFundSDKType { + authority: string; + recipient: string; + percentage: string; + expiry?: Date; +} +/** + * MsgCreateContinuousFundResponse defines the response to executing a + * MsgCreateContinuousFund message. + */ +export interface MsgCreateContinuousFundResponse {} +export interface MsgCreateContinuousFundResponseProtoMsg { + typeUrl: "/cosmos.protocolpool.v1.MsgCreateContinuousFundResponse"; + value: Uint8Array; +} +/** + * MsgCreateContinuousFundResponse defines the response to executing a + * MsgCreateContinuousFund message. + */ +export interface MsgCreateContinuousFundResponseAmino {} +export interface MsgCreateContinuousFundResponseAminoMsg { + type: "cosmos-sdk/MsgCreateContinuousFundResponse"; + value: MsgCreateContinuousFundResponseAmino; +} +/** + * MsgCreateContinuousFundResponse defines the response to executing a + * MsgCreateContinuousFund message. + */ +export interface MsgCreateContinuousFundResponseSDKType {} +/** MsgCancelContinuousFund defines a message to cancel continuous funds for a specific recipient. */ +export interface MsgCancelContinuousFund { + /** Authority is the account address of authority. */ + authority: string; + /** Recipient is the account address string of the recipient whose funds are to be cancelled. */ + recipient: string; +} +export interface MsgCancelContinuousFundProtoMsg { + typeUrl: "/cosmos.protocolpool.v1.MsgCancelContinuousFund"; + value: Uint8Array; +} +/** MsgCancelContinuousFund defines a message to cancel continuous funds for a specific recipient. */ +export interface MsgCancelContinuousFundAmino { + /** Authority is the account address of authority. */ + authority?: string; + /** Recipient is the account address string of the recipient whose funds are to be cancelled. */ + recipient?: string; +} +export interface MsgCancelContinuousFundAminoMsg { + type: "cosmos-sdk/MsgCancelContinuousFund"; + value: MsgCancelContinuousFundAmino; +} +/** MsgCancelContinuousFund defines a message to cancel continuous funds for a specific recipient. */ +export interface MsgCancelContinuousFundSDKType { + authority: string; + recipient: string; +} +/** + * MsgCancelContinuousFundResponse defines the response to executing a + * MsgCancelContinuousFund message. + */ +export interface MsgCancelContinuousFundResponse { + /** CanceledTime is the canceled time. */ + canceledTime: Date; + /** CanceledHeight defines the canceled block height. */ + canceledHeight: bigint; + /** Recipient is the account address string of the recipient whose funds are cancelled. */ + recipient: string; +} +export interface MsgCancelContinuousFundResponseProtoMsg { + typeUrl: "/cosmos.protocolpool.v1.MsgCancelContinuousFundResponse"; + value: Uint8Array; +} +/** + * MsgCancelContinuousFundResponse defines the response to executing a + * MsgCancelContinuousFund message. + */ +export interface MsgCancelContinuousFundResponseAmino { + /** CanceledTime is the canceled time. */ + canceled_time?: string; + /** CanceledHeight defines the canceled block height. */ + canceled_height?: string; + /** Recipient is the account address string of the recipient whose funds are cancelled. */ + recipient?: string; +} +export interface MsgCancelContinuousFundResponseAminoMsg { + type: "cosmos-sdk/MsgCancelContinuousFundResponse"; + value: MsgCancelContinuousFundResponseAmino; +} +/** + * MsgCancelContinuousFundResponse defines the response to executing a + * MsgCancelContinuousFund message. + */ +export interface MsgCancelContinuousFundResponseSDKType { + canceled_time: Date; + canceled_height: bigint; + recipient: string; +} +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/protocolpool parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params; +} +export interface MsgUpdateParamsProtoMsg { + typeUrl: "/cosmos.protocolpool.v1.MsgUpdateParams"; + value: Uint8Array; +} +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParamsAmino { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority?: string; + /** + * params defines the x/protocolpool parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params?: ParamsAmino; +} +export interface MsgUpdateParamsAminoMsg { + type: "cosmos-sdk/MsgUpdateParams"; + value: MsgUpdateParamsAmino; +} +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParamsSDKType { + authority: string; + params: ParamsSDKType; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponse {} +export interface MsgUpdateParamsResponseProtoMsg { + typeUrl: "/cosmos.protocolpool.v1.MsgUpdateParamsResponse"; + value: Uint8Array; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponseAmino {} +export interface MsgUpdateParamsResponseAminoMsg { + type: "cosmos-sdk/MsgUpdateParamsResponse"; + value: MsgUpdateParamsResponseAmino; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponseSDKType {} +function createBaseMsgFundCommunityPool(): MsgFundCommunityPool { + return { + depositor: "", + amount: [] + }; +} +export const MsgFundCommunityPool = { + typeUrl: "/cosmos.protocolpool.v1.MsgFundCommunityPool", + encode(message: MsgFundCommunityPool, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.depositor !== "") { + writer.uint32(10).string(message.depositor); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgFundCommunityPool { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgFundCommunityPool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.depositor = reader.string(); + break; + case 2: + message.amount.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgFundCommunityPool { + const message = createBaseMsgFundCommunityPool(); + message.depositor = object.depositor ?? ""; + message.amount = object.amount?.map(e => Coin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: MsgFundCommunityPoolAmino): MsgFundCommunityPool { + const message = createBaseMsgFundCommunityPool(); + if (object.depositor !== undefined && object.depositor !== null) { + message.depositor = object.depositor; + } + message.amount = object.amount?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: MsgFundCommunityPool): MsgFundCommunityPoolAmino { + const obj: any = {}; + obj.depositor = message.depositor === "" ? undefined : message.depositor; + if (message.amount) { + obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.amount = message.amount; + } + return obj; + }, + fromAminoMsg(object: MsgFundCommunityPoolAminoMsg): MsgFundCommunityPool { + return MsgFundCommunityPool.fromAmino(object.value); + }, + toAminoMsg(message: MsgFundCommunityPool): MsgFundCommunityPoolAminoMsg { + return { + type: "cosmos-sdk/MsgFundCommunityPool", + value: MsgFundCommunityPool.toAmino(message) + }; + }, + fromProtoMsg(message: MsgFundCommunityPoolProtoMsg): MsgFundCommunityPool { + return MsgFundCommunityPool.decode(message.value); + }, + toProto(message: MsgFundCommunityPool): Uint8Array { + return MsgFundCommunityPool.encode(message).finish(); + }, + toProtoMsg(message: MsgFundCommunityPool): MsgFundCommunityPoolProtoMsg { + return { + typeUrl: "/cosmos.protocolpool.v1.MsgFundCommunityPool", + value: MsgFundCommunityPool.encode(message).finish() + }; + } +}; +function createBaseMsgFundCommunityPoolResponse(): MsgFundCommunityPoolResponse { + return {}; +} +export const MsgFundCommunityPoolResponse = { + typeUrl: "/cosmos.protocolpool.v1.MsgFundCommunityPoolResponse", + encode(_: MsgFundCommunityPoolResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgFundCommunityPoolResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgFundCommunityPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): MsgFundCommunityPoolResponse { + const message = createBaseMsgFundCommunityPoolResponse(); + return message; + }, + fromAmino(_: MsgFundCommunityPoolResponseAmino): MsgFundCommunityPoolResponse { + const message = createBaseMsgFundCommunityPoolResponse(); + return message; + }, + toAmino(_: MsgFundCommunityPoolResponse): MsgFundCommunityPoolResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgFundCommunityPoolResponseAminoMsg): MsgFundCommunityPoolResponse { + return MsgFundCommunityPoolResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgFundCommunityPoolResponse): MsgFundCommunityPoolResponseAminoMsg { + return { + type: "cosmos-sdk/MsgFundCommunityPoolResponse", + value: MsgFundCommunityPoolResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgFundCommunityPoolResponseProtoMsg): MsgFundCommunityPoolResponse { + return MsgFundCommunityPoolResponse.decode(message.value); + }, + toProto(message: MsgFundCommunityPoolResponse): Uint8Array { + return MsgFundCommunityPoolResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgFundCommunityPoolResponse): MsgFundCommunityPoolResponseProtoMsg { + return { + typeUrl: "/cosmos.protocolpool.v1.MsgFundCommunityPoolResponse", + value: MsgFundCommunityPoolResponse.encode(message).finish() + }; + } +}; +function createBaseMsgCommunityPoolSpend(): MsgCommunityPoolSpend { + return { + authority: "", + recipient: "", + amount: [] + }; +} +export const MsgCommunityPoolSpend = { + typeUrl: "/cosmos.protocolpool.v1.MsgCommunityPoolSpend", + encode(message: MsgCommunityPoolSpend, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.recipient !== "") { + writer.uint32(18).string(message.recipient); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgCommunityPoolSpend { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.recipient = reader.string(); + break; + case 3: + message.amount.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgCommunityPoolSpend { + const message = createBaseMsgCommunityPoolSpend(); + message.authority = object.authority ?? ""; + message.recipient = object.recipient ?? ""; + message.amount = object.amount?.map(e => Coin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: MsgCommunityPoolSpendAmino): MsgCommunityPoolSpend { + const message = createBaseMsgCommunityPoolSpend(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + if (object.recipient !== undefined && object.recipient !== null) { + message.recipient = object.recipient; + } + message.amount = object.amount?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: MsgCommunityPoolSpend): MsgCommunityPoolSpendAmino { + const obj: any = {}; + obj.authority = message.authority === "" ? undefined : message.authority; + obj.recipient = message.recipient === "" ? undefined : message.recipient; + if (message.amount) { + obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.amount = message.amount; + } + return obj; + }, + fromAminoMsg(object: MsgCommunityPoolSpendAminoMsg): MsgCommunityPoolSpend { + return MsgCommunityPoolSpend.fromAmino(object.value); + }, + toAminoMsg(message: MsgCommunityPoolSpend): MsgCommunityPoolSpendAminoMsg { + return { + type: "cosmos-sdk/MsgCommunityPoolSpend", + value: MsgCommunityPoolSpend.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCommunityPoolSpendProtoMsg): MsgCommunityPoolSpend { + return MsgCommunityPoolSpend.decode(message.value); + }, + toProto(message: MsgCommunityPoolSpend): Uint8Array { + return MsgCommunityPoolSpend.encode(message).finish(); + }, + toProtoMsg(message: MsgCommunityPoolSpend): MsgCommunityPoolSpendProtoMsg { + return { + typeUrl: "/cosmos.protocolpool.v1.MsgCommunityPoolSpend", + value: MsgCommunityPoolSpend.encode(message).finish() + }; + } +}; +function createBaseMsgCommunityPoolSpendResponse(): MsgCommunityPoolSpendResponse { + return {}; +} +export const MsgCommunityPoolSpendResponse = { + typeUrl: "/cosmos.protocolpool.v1.MsgCommunityPoolSpendResponse", + encode(_: MsgCommunityPoolSpendResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgCommunityPoolSpendResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): MsgCommunityPoolSpendResponse { + const message = createBaseMsgCommunityPoolSpendResponse(); + return message; + }, + fromAmino(_: MsgCommunityPoolSpendResponseAmino): MsgCommunityPoolSpendResponse { + const message = createBaseMsgCommunityPoolSpendResponse(); + return message; + }, + toAmino(_: MsgCommunityPoolSpendResponse): MsgCommunityPoolSpendResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgCommunityPoolSpendResponseAminoMsg): MsgCommunityPoolSpendResponse { + return MsgCommunityPoolSpendResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgCommunityPoolSpendResponse): MsgCommunityPoolSpendResponseAminoMsg { + return { + type: "cosmos-sdk/MsgCommunityPoolSpendResponse", + value: MsgCommunityPoolSpendResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCommunityPoolSpendResponseProtoMsg): MsgCommunityPoolSpendResponse { + return MsgCommunityPoolSpendResponse.decode(message.value); + }, + toProto(message: MsgCommunityPoolSpendResponse): Uint8Array { + return MsgCommunityPoolSpendResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgCommunityPoolSpendResponse): MsgCommunityPoolSpendResponseProtoMsg { + return { + typeUrl: "/cosmos.protocolpool.v1.MsgCommunityPoolSpendResponse", + value: MsgCommunityPoolSpendResponse.encode(message).finish() + }; + } +}; +function createBaseMsgCreateContinuousFund(): MsgCreateContinuousFund { + return { + authority: "", + recipient: "", + percentage: "", + expiry: undefined + }; +} +export const MsgCreateContinuousFund = { + typeUrl: "/cosmos.protocolpool.v1.MsgCreateContinuousFund", + encode(message: MsgCreateContinuousFund, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.recipient !== "") { + writer.uint32(18).string(message.recipient); + } + if (message.percentage !== "") { + writer.uint32(26).string(Decimal.fromUserInput(message.percentage, 18).atomics); + } + if (message.expiry !== undefined) { + Timestamp.encode(toTimestamp(message.expiry), writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateContinuousFund { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateContinuousFund(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.recipient = reader.string(); + break; + case 3: + message.percentage = Decimal.fromAtomics(reader.string(), 18).toString(); + break; + case 4: + message.expiry = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgCreateContinuousFund { + const message = createBaseMsgCreateContinuousFund(); + message.authority = object.authority ?? ""; + message.recipient = object.recipient ?? ""; + message.percentage = object.percentage ?? ""; + message.expiry = object.expiry ?? undefined; + return message; + }, + fromAmino(object: MsgCreateContinuousFundAmino): MsgCreateContinuousFund { + const message = createBaseMsgCreateContinuousFund(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + if (object.recipient !== undefined && object.recipient !== null) { + message.recipient = object.recipient; + } + if (object.percentage !== undefined && object.percentage !== null) { + message.percentage = object.percentage; + } + if (object.expiry !== undefined && object.expiry !== null) { + message.expiry = fromTimestamp(Timestamp.fromAmino(object.expiry)); + } + return message; + }, + toAmino(message: MsgCreateContinuousFund): MsgCreateContinuousFundAmino { + const obj: any = {}; + obj.authority = message.authority === "" ? undefined : message.authority; + obj.recipient = message.recipient === "" ? undefined : message.recipient; + obj.percentage = message.percentage === "" ? undefined : message.percentage; + obj.expiry = message.expiry ? Timestamp.toAmino(toTimestamp(message.expiry)) : undefined; + return obj; + }, + fromAminoMsg(object: MsgCreateContinuousFundAminoMsg): MsgCreateContinuousFund { + return MsgCreateContinuousFund.fromAmino(object.value); + }, + toAminoMsg(message: MsgCreateContinuousFund): MsgCreateContinuousFundAminoMsg { + return { + type: "cosmos-sdk/MsgCreateContinuousFund", + value: MsgCreateContinuousFund.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCreateContinuousFundProtoMsg): MsgCreateContinuousFund { + return MsgCreateContinuousFund.decode(message.value); + }, + toProto(message: MsgCreateContinuousFund): Uint8Array { + return MsgCreateContinuousFund.encode(message).finish(); + }, + toProtoMsg(message: MsgCreateContinuousFund): MsgCreateContinuousFundProtoMsg { + return { + typeUrl: "/cosmos.protocolpool.v1.MsgCreateContinuousFund", + value: MsgCreateContinuousFund.encode(message).finish() + }; + } +}; +function createBaseMsgCreateContinuousFundResponse(): MsgCreateContinuousFundResponse { + return {}; +} +export const MsgCreateContinuousFundResponse = { + typeUrl: "/cosmos.protocolpool.v1.MsgCreateContinuousFundResponse", + encode(_: MsgCreateContinuousFundResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateContinuousFundResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateContinuousFundResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): MsgCreateContinuousFundResponse { + const message = createBaseMsgCreateContinuousFundResponse(); + return message; + }, + fromAmino(_: MsgCreateContinuousFundResponseAmino): MsgCreateContinuousFundResponse { + const message = createBaseMsgCreateContinuousFundResponse(); + return message; + }, + toAmino(_: MsgCreateContinuousFundResponse): MsgCreateContinuousFundResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgCreateContinuousFundResponseAminoMsg): MsgCreateContinuousFundResponse { + return MsgCreateContinuousFundResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgCreateContinuousFundResponse): MsgCreateContinuousFundResponseAminoMsg { + return { + type: "cosmos-sdk/MsgCreateContinuousFundResponse", + value: MsgCreateContinuousFundResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCreateContinuousFundResponseProtoMsg): MsgCreateContinuousFundResponse { + return MsgCreateContinuousFundResponse.decode(message.value); + }, + toProto(message: MsgCreateContinuousFundResponse): Uint8Array { + return MsgCreateContinuousFundResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgCreateContinuousFundResponse): MsgCreateContinuousFundResponseProtoMsg { + return { + typeUrl: "/cosmos.protocolpool.v1.MsgCreateContinuousFundResponse", + value: MsgCreateContinuousFundResponse.encode(message).finish() + }; + } +}; +function createBaseMsgCancelContinuousFund(): MsgCancelContinuousFund { + return { + authority: "", + recipient: "" + }; +} +export const MsgCancelContinuousFund = { + typeUrl: "/cosmos.protocolpool.v1.MsgCancelContinuousFund", + encode(message: MsgCancelContinuousFund, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.recipient !== "") { + writer.uint32(18).string(message.recipient); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgCancelContinuousFund { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCancelContinuousFund(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.recipient = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgCancelContinuousFund { + const message = createBaseMsgCancelContinuousFund(); + message.authority = object.authority ?? ""; + message.recipient = object.recipient ?? ""; + return message; + }, + fromAmino(object: MsgCancelContinuousFundAmino): MsgCancelContinuousFund { + const message = createBaseMsgCancelContinuousFund(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + if (object.recipient !== undefined && object.recipient !== null) { + message.recipient = object.recipient; + } + return message; + }, + toAmino(message: MsgCancelContinuousFund): MsgCancelContinuousFundAmino { + const obj: any = {}; + obj.authority = message.authority === "" ? undefined : message.authority; + obj.recipient = message.recipient === "" ? undefined : message.recipient; + return obj; + }, + fromAminoMsg(object: MsgCancelContinuousFundAminoMsg): MsgCancelContinuousFund { + return MsgCancelContinuousFund.fromAmino(object.value); + }, + toAminoMsg(message: MsgCancelContinuousFund): MsgCancelContinuousFundAminoMsg { + return { + type: "cosmos-sdk/MsgCancelContinuousFund", + value: MsgCancelContinuousFund.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCancelContinuousFundProtoMsg): MsgCancelContinuousFund { + return MsgCancelContinuousFund.decode(message.value); + }, + toProto(message: MsgCancelContinuousFund): Uint8Array { + return MsgCancelContinuousFund.encode(message).finish(); + }, + toProtoMsg(message: MsgCancelContinuousFund): MsgCancelContinuousFundProtoMsg { + return { + typeUrl: "/cosmos.protocolpool.v1.MsgCancelContinuousFund", + value: MsgCancelContinuousFund.encode(message).finish() + }; + } +}; +function createBaseMsgCancelContinuousFundResponse(): MsgCancelContinuousFundResponse { + return { + canceledTime: new Date(), + canceledHeight: BigInt(0), + recipient: "" + }; +} +export const MsgCancelContinuousFundResponse = { + typeUrl: "/cosmos.protocolpool.v1.MsgCancelContinuousFundResponse", + encode(message: MsgCancelContinuousFundResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.canceledTime !== undefined) { + Timestamp.encode(toTimestamp(message.canceledTime), writer.uint32(10).fork()).ldelim(); + } + if (message.canceledHeight !== BigInt(0)) { + writer.uint32(16).uint64(message.canceledHeight); + } + if (message.recipient !== "") { + writer.uint32(26).string(message.recipient); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgCancelContinuousFundResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCancelContinuousFundResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.canceledTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 2: + message.canceledHeight = reader.uint64(); + break; + case 3: + message.recipient = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgCancelContinuousFundResponse { + const message = createBaseMsgCancelContinuousFundResponse(); + message.canceledTime = object.canceledTime ?? undefined; + message.canceledHeight = object.canceledHeight !== undefined && object.canceledHeight !== null ? BigInt(object.canceledHeight.toString()) : BigInt(0); + message.recipient = object.recipient ?? ""; + return message; + }, + fromAmino(object: MsgCancelContinuousFundResponseAmino): MsgCancelContinuousFundResponse { + const message = createBaseMsgCancelContinuousFundResponse(); + if (object.canceled_time !== undefined && object.canceled_time !== null) { + message.canceledTime = fromTimestamp(Timestamp.fromAmino(object.canceled_time)); + } + if (object.canceled_height !== undefined && object.canceled_height !== null) { + message.canceledHeight = BigInt(object.canceled_height); + } + if (object.recipient !== undefined && object.recipient !== null) { + message.recipient = object.recipient; + } + return message; + }, + toAmino(message: MsgCancelContinuousFundResponse): MsgCancelContinuousFundResponseAmino { + const obj: any = {}; + obj.canceled_time = message.canceledTime ? Timestamp.toAmino(toTimestamp(message.canceledTime)) : undefined; + obj.canceled_height = message.canceledHeight !== BigInt(0) ? message.canceledHeight?.toString() : undefined; + obj.recipient = message.recipient === "" ? undefined : message.recipient; + return obj; + }, + fromAminoMsg(object: MsgCancelContinuousFundResponseAminoMsg): MsgCancelContinuousFundResponse { + return MsgCancelContinuousFundResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgCancelContinuousFundResponse): MsgCancelContinuousFundResponseAminoMsg { + return { + type: "cosmos-sdk/MsgCancelContinuousFundResponse", + value: MsgCancelContinuousFundResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCancelContinuousFundResponseProtoMsg): MsgCancelContinuousFundResponse { + return MsgCancelContinuousFundResponse.decode(message.value); + }, + toProto(message: MsgCancelContinuousFundResponse): Uint8Array { + return MsgCancelContinuousFundResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgCancelContinuousFundResponse): MsgCancelContinuousFundResponseProtoMsg { + return { + typeUrl: "/cosmos.protocolpool.v1.MsgCancelContinuousFundResponse", + value: MsgCancelContinuousFundResponse.encode(message).finish() + }; + } +}; +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { + authority: "", + params: Params.fromPartial({}) + }; +} +export const MsgUpdateParams = { + typeUrl: "/cosmos.protocolpool.v1.MsgUpdateParams", + encode(message: MsgUpdateParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + message.authority = object.authority ?? ""; + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, + fromAmino(object: MsgUpdateParamsAmino): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: MsgUpdateParams): MsgUpdateParamsAmino { + const obj: any = {}; + obj.authority = message.authority === "" ? undefined : message.authority; + obj.params = message.params ? Params.toAmino(message.params) : undefined; + return obj; + }, + fromAminoMsg(object: MsgUpdateParamsAminoMsg): MsgUpdateParams { + return MsgUpdateParams.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateParams): MsgUpdateParamsAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateParams", + value: MsgUpdateParams.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateParamsProtoMsg): MsgUpdateParams { + return MsgUpdateParams.decode(message.value); + }, + toProto(message: MsgUpdateParams): Uint8Array { + return MsgUpdateParams.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateParams): MsgUpdateParamsProtoMsg { + return { + typeUrl: "/cosmos.protocolpool.v1.MsgUpdateParams", + value: MsgUpdateParams.encode(message).finish() + }; + } +}; +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} +export const MsgUpdateParamsResponse = { + typeUrl: "/cosmos.protocolpool.v1.MsgUpdateParamsResponse", + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, + fromAmino(_: MsgUpdateParamsResponseAmino): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, + toAmino(_: MsgUpdateParamsResponse): MsgUpdateParamsResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUpdateParamsResponseAminoMsg): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateParamsResponse): MsgUpdateParamsResponseAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateParamsResponse", + value: MsgUpdateParamsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateParamsResponseProtoMsg): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.decode(message.value); + }, + toProto(message: MsgUpdateParamsResponse): Uint8Array { + return MsgUpdateParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateParamsResponse): MsgUpdateParamsResponseProtoMsg { + return { + typeUrl: "/cosmos.protocolpool.v1.MsgUpdateParamsResponse", + value: MsgUpdateParamsResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/protocolpool/v1/types.ts b/packages/api/src/cosmos/protocolpool/v1/types.ts new file mode 100644 index 00000000..7d3c27da --- /dev/null +++ b/packages/api/src/cosmos/protocolpool/v1/types.ts @@ -0,0 +1,252 @@ +//@ts-nocheck +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { Decimal } from "@cosmjs/math"; +import { toTimestamp, fromTimestamp } from "../../../helpers"; +/** ContinuousFund defines the fields of continuous fund proposal. */ +export interface ContinuousFund { + /** Recipient is the address string of the account receiving funds. */ + recipient: string; + /** Percentage is the percentage of funds to be allocated from Community pool. */ + percentage: string; + /** Optional, if expiry is set, removes the state object when expired. */ + expiry?: Date; +} +export interface ContinuousFundProtoMsg { + typeUrl: "/cosmos.protocolpool.v1.ContinuousFund"; + value: Uint8Array; +} +/** ContinuousFund defines the fields of continuous fund proposal. */ +export interface ContinuousFundAmino { + /** Recipient is the address string of the account receiving funds. */ + recipient?: string; + /** Percentage is the percentage of funds to be allocated from Community pool. */ + percentage?: string; + /** Optional, if expiry is set, removes the state object when expired. */ + expiry?: string; +} +export interface ContinuousFundAminoMsg { + type: "cosmos-sdk/ContinuousFund"; + value: ContinuousFundAmino; +} +/** ContinuousFund defines the fields of continuous fund proposal. */ +export interface ContinuousFundSDKType { + recipient: string; + percentage: string; + expiry?: Date; +} +/** Params defines the parameters for the protocolpool module. */ +export interface Params { + /** + * EnabledDistributionDenoms lists the denoms that are allowed to be distributed. + * This is to avoid spending time distributing undesired tokens to continuous funds and budgets. + */ + enabledDistributionDenoms: string[]; + /** + * DistributionFrequency is the frequency (in terms of blocks) that funds are distributed out from the + * x/protocolpool module. + */ + distributionFrequency: bigint; +} +export interface ParamsProtoMsg { + typeUrl: "/cosmos.protocolpool.v1.Params"; + value: Uint8Array; +} +/** Params defines the parameters for the protocolpool module. */ +export interface ParamsAmino { + /** + * EnabledDistributionDenoms lists the denoms that are allowed to be distributed. + * This is to avoid spending time distributing undesired tokens to continuous funds and budgets. + */ + enabled_distribution_denoms?: string[]; + /** + * DistributionFrequency is the frequency (in terms of blocks) that funds are distributed out from the + * x/protocolpool module. + */ + distribution_frequency?: string; +} +export interface ParamsAminoMsg { + type: "cosmos-sdk/Params"; + value: ParamsAmino; +} +/** Params defines the parameters for the protocolpool module. */ +export interface ParamsSDKType { + enabled_distribution_denoms: string[]; + distribution_frequency: bigint; +} +function createBaseContinuousFund(): ContinuousFund { + return { + recipient: "", + percentage: "", + expiry: undefined + }; +} +export const ContinuousFund = { + typeUrl: "/cosmos.protocolpool.v1.ContinuousFund", + encode(message: ContinuousFund, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.recipient !== "") { + writer.uint32(10).string(message.recipient); + } + if (message.percentage !== "") { + writer.uint32(18).string(Decimal.fromUserInput(message.percentage, 18).atomics); + } + if (message.expiry !== undefined) { + Timestamp.encode(toTimestamp(message.expiry), writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ContinuousFund { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContinuousFund(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.recipient = reader.string(); + break; + case 2: + message.percentage = Decimal.fromAtomics(reader.string(), 18).toString(); + break; + case 3: + message.expiry = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): ContinuousFund { + const message = createBaseContinuousFund(); + message.recipient = object.recipient ?? ""; + message.percentage = object.percentage ?? ""; + message.expiry = object.expiry ?? undefined; + return message; + }, + fromAmino(object: ContinuousFundAmino): ContinuousFund { + const message = createBaseContinuousFund(); + if (object.recipient !== undefined && object.recipient !== null) { + message.recipient = object.recipient; + } + if (object.percentage !== undefined && object.percentage !== null) { + message.percentage = object.percentage; + } + if (object.expiry !== undefined && object.expiry !== null) { + message.expiry = fromTimestamp(Timestamp.fromAmino(object.expiry)); + } + return message; + }, + toAmino(message: ContinuousFund): ContinuousFundAmino { + const obj: any = {}; + obj.recipient = message.recipient === "" ? undefined : message.recipient; + obj.percentage = message.percentage === "" ? undefined : message.percentage; + obj.expiry = message.expiry ? Timestamp.toAmino(toTimestamp(message.expiry)) : undefined; + return obj; + }, + fromAminoMsg(object: ContinuousFundAminoMsg): ContinuousFund { + return ContinuousFund.fromAmino(object.value); + }, + toAminoMsg(message: ContinuousFund): ContinuousFundAminoMsg { + return { + type: "cosmos-sdk/ContinuousFund", + value: ContinuousFund.toAmino(message) + }; + }, + fromProtoMsg(message: ContinuousFundProtoMsg): ContinuousFund { + return ContinuousFund.decode(message.value); + }, + toProto(message: ContinuousFund): Uint8Array { + return ContinuousFund.encode(message).finish(); + }, + toProtoMsg(message: ContinuousFund): ContinuousFundProtoMsg { + return { + typeUrl: "/cosmos.protocolpool.v1.ContinuousFund", + value: ContinuousFund.encode(message).finish() + }; + } +}; +function createBaseParams(): Params { + return { + enabledDistributionDenoms: [], + distributionFrequency: BigInt(0) + }; +} +export const Params = { + typeUrl: "/cosmos.protocolpool.v1.Params", + encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.enabledDistributionDenoms) { + writer.uint32(10).string(v!); + } + if (message.distributionFrequency !== BigInt(0)) { + writer.uint32(16).uint64(message.distributionFrequency); + } + 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.enabledDistributionDenoms.push(reader.string()); + break; + case 2: + message.distributionFrequency = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): Params { + const message = createBaseParams(); + message.enabledDistributionDenoms = object.enabledDistributionDenoms?.map(e => e) || []; + message.distributionFrequency = object.distributionFrequency !== undefined && object.distributionFrequency !== null ? BigInt(object.distributionFrequency.toString()) : BigInt(0); + return message; + }, + fromAmino(object: ParamsAmino): Params { + const message = createBaseParams(); + message.enabledDistributionDenoms = object.enabled_distribution_denoms?.map(e => e) || []; + if (object.distribution_frequency !== undefined && object.distribution_frequency !== null) { + message.distributionFrequency = BigInt(object.distribution_frequency); + } + return message; + }, + toAmino(message: Params): ParamsAmino { + const obj: any = {}; + if (message.enabledDistributionDenoms) { + obj.enabled_distribution_denoms = message.enabledDistributionDenoms.map(e => e); + } else { + obj.enabled_distribution_denoms = message.enabledDistributionDenoms; + } + obj.distribution_frequency = message.distributionFrequency !== BigInt(0) ? message.distributionFrequency?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ParamsAminoMsg): Params { + return Params.fromAmino(object.value); + }, + toAminoMsg(message: Params): ParamsAminoMsg { + return { + type: "cosmos-sdk/Params", + value: Params.toAmino(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: "/cosmos.protocolpool.v1.Params", + value: Params.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/query/v1/query.ts b/packages/api/src/cosmos/query/v1/query.ts new file mode 100644 index 00000000..693da49f --- /dev/null +++ b/packages/api/src/cosmos/query/v1/query.ts @@ -0,0 +1 @@ +export {} \ No newline at end of file diff --git a/packages/api/src/cosmos/reflection/v1/reflection.ts b/packages/api/src/cosmos/reflection/v1/reflection.ts new file mode 100644 index 00000000..3f049f2c --- /dev/null +++ b/packages/api/src/cosmos/reflection/v1/reflection.ts @@ -0,0 +1,166 @@ +//@ts-nocheck +import { FileDescriptorProto, FileDescriptorProtoAmino, FileDescriptorProtoSDKType } from "../../../google/protobuf/descriptor"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +/** FileDescriptorsRequest is the Query/FileDescriptors request type. */ +export interface FileDescriptorsRequest {} +export interface FileDescriptorsRequestProtoMsg { + typeUrl: "/cosmos.reflection.v1.FileDescriptorsRequest"; + value: Uint8Array; +} +/** FileDescriptorsRequest is the Query/FileDescriptors request type. */ +export interface FileDescriptorsRequestAmino {} +export interface FileDescriptorsRequestAminoMsg { + type: "cosmos-sdk/FileDescriptorsRequest"; + value: FileDescriptorsRequestAmino; +} +/** FileDescriptorsRequest is the Query/FileDescriptors request type. */ +export interface FileDescriptorsRequestSDKType {} +/** FileDescriptorsResponse is the Query/FileDescriptors response type. */ +export interface FileDescriptorsResponse { + /** files is the file descriptors. */ + files: FileDescriptorProto[]; +} +export interface FileDescriptorsResponseProtoMsg { + typeUrl: "/cosmos.reflection.v1.FileDescriptorsResponse"; + value: Uint8Array; +} +/** FileDescriptorsResponse is the Query/FileDescriptors response type. */ +export interface FileDescriptorsResponseAmino { + /** files is the file descriptors. */ + files?: FileDescriptorProtoAmino[]; +} +export interface FileDescriptorsResponseAminoMsg { + type: "cosmos-sdk/FileDescriptorsResponse"; + value: FileDescriptorsResponseAmino; +} +/** FileDescriptorsResponse is the Query/FileDescriptors response type. */ +export interface FileDescriptorsResponseSDKType { + files: FileDescriptorProtoSDKType[]; +} +function createBaseFileDescriptorsRequest(): FileDescriptorsRequest { + return {}; +} +export const FileDescriptorsRequest = { + typeUrl: "/cosmos.reflection.v1.FileDescriptorsRequest", + encode(_: FileDescriptorsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFileDescriptorsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): FileDescriptorsRequest { + const message = createBaseFileDescriptorsRequest(); + return message; + }, + fromAmino(_: FileDescriptorsRequestAmino): FileDescriptorsRequest { + const message = createBaseFileDescriptorsRequest(); + return message; + }, + toAmino(_: FileDescriptorsRequest): FileDescriptorsRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: FileDescriptorsRequestAminoMsg): FileDescriptorsRequest { + return FileDescriptorsRequest.fromAmino(object.value); + }, + toAminoMsg(message: FileDescriptorsRequest): FileDescriptorsRequestAminoMsg { + return { + type: "cosmos-sdk/FileDescriptorsRequest", + value: FileDescriptorsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: FileDescriptorsRequestProtoMsg): FileDescriptorsRequest { + return FileDescriptorsRequest.decode(message.value); + }, + toProto(message: FileDescriptorsRequest): Uint8Array { + return FileDescriptorsRequest.encode(message).finish(); + }, + toProtoMsg(message: FileDescriptorsRequest): FileDescriptorsRequestProtoMsg { + return { + typeUrl: "/cosmos.reflection.v1.FileDescriptorsRequest", + value: FileDescriptorsRequest.encode(message).finish() + }; + } +}; +function createBaseFileDescriptorsResponse(): FileDescriptorsResponse { + return { + files: [] + }; +} +export const FileDescriptorsResponse = { + typeUrl: "/cosmos.reflection.v1.FileDescriptorsResponse", + encode(message: FileDescriptorsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.files) { + FileDescriptorProto.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFileDescriptorsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.files.push(FileDescriptorProto.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): FileDescriptorsResponse { + const message = createBaseFileDescriptorsResponse(); + message.files = object.files?.map(e => FileDescriptorProto.fromPartial(e)) || []; + return message; + }, + fromAmino(object: FileDescriptorsResponseAmino): FileDescriptorsResponse { + const message = createBaseFileDescriptorsResponse(); + message.files = object.files?.map(e => FileDescriptorProto.fromAmino(e)) || []; + return message; + }, + toAmino(message: FileDescriptorsResponse): FileDescriptorsResponseAmino { + const obj: any = {}; + if (message.files) { + obj.files = message.files.map(e => e ? FileDescriptorProto.toAmino(e) : undefined); + } else { + obj.files = message.files; + } + return obj; + }, + fromAminoMsg(object: FileDescriptorsResponseAminoMsg): FileDescriptorsResponse { + return FileDescriptorsResponse.fromAmino(object.value); + }, + toAminoMsg(message: FileDescriptorsResponse): FileDescriptorsResponseAminoMsg { + return { + type: "cosmos-sdk/FileDescriptorsResponse", + value: FileDescriptorsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: FileDescriptorsResponseProtoMsg): FileDescriptorsResponse { + return FileDescriptorsResponse.decode(message.value); + }, + toProto(message: FileDescriptorsResponse): Uint8Array { + return FileDescriptorsResponse.encode(message).finish(); + }, + toProtoMsg(message: FileDescriptorsResponse): FileDescriptorsResponseProtoMsg { + return { + typeUrl: "/cosmos.reflection.v1.FileDescriptorsResponse", + value: FileDescriptorsResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/rpc.query.ts b/packages/api/src/cosmos/rpc.query.ts index db0b00a0..b166c258 100644 --- a/packages/api/src/cosmos/rpc.query.ts +++ b/packages/api/src/cosmos/rpc.query.ts @@ -24,9 +24,21 @@ export const createRPCQueryClient = async ({ v1beta1: (await import("./base/node/v1beta1/query.rpc.Service")).createRpcQueryExtension(client) } }, + circuit: { + v1: (await import("./circuit/v1/query.rpc.Query")).createRpcQueryExtension(client) + }, + consensus: { + v1: (await import("./consensus/v1/query.rpc.Query")).createRpcQueryExtension(client) + }, + counter: { + v1: (await import("./counter/v1/query.rpc.Query")).createRpcQueryExtension(client) + }, distribution: { v1beta1: (await import("./distribution/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, + epochs: { + v1beta1: (await import("./epochs/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + }, feegrant: { v1beta1: (await import("./feegrant/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, @@ -43,6 +55,9 @@ export const createRPCQueryClient = async ({ params: { v1beta1: (await import("./params/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, + protocolpool: { + v1: (await import("./protocolpool/v1/query.rpc.Query")).createRpcQueryExtension(client) + }, staking: { v1beta1: (await import("./staking/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, diff --git a/packages/api/src/cosmos/rpc.tx.ts b/packages/api/src/cosmos/rpc.tx.ts index c87eaf31..95e67d4e 100644 --- a/packages/api/src/cosmos/rpc.tx.ts +++ b/packages/api/src/cosmos/rpc.tx.ts @@ -6,12 +6,27 @@ export const createRPCMsgClient = async ({ rpc: Rpc; }) => ({ cosmos: { + auth: { + v1beta1: new (await import("./auth/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + }, authz: { v1beta1: new (await import("./authz/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, bank: { v1beta1: new (await import("./bank/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, + benchmark: { + v1: new (await import("./benchmark/v1/tx.rpc.msg")).MsgClientImpl(rpc) + }, + circuit: { + v1: new (await import("./circuit/v1/tx.rpc.msg")).MsgClientImpl(rpc) + }, + consensus: { + v1: new (await import("./consensus/v1/tx.rpc.msg")).MsgClientImpl(rpc) + }, + counter: { + v1: new (await import("./counter/v1/tx.rpc.msg")).MsgClientImpl(rpc) + }, distribution: { v1beta1: new (await import("./distribution/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, @@ -25,6 +40,12 @@ export const createRPCMsgClient = async ({ group: { v1: new (await import("./group/v1/tx.rpc.msg")).MsgClientImpl(rpc) }, + mint: { + v1beta1: new (await import("./mint/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + }, + protocolpool: { + v1: new (await import("./protocolpool/v1/tx.rpc.msg")).MsgClientImpl(rpc) + }, staking: { v1beta1: new (await import("./staking/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, diff --git a/packages/api/src/cosmos/slashing/module/v1/module.ts b/packages/api/src/cosmos/slashing/module/v1/module.ts new file mode 100644 index 00000000..b52496b8 --- /dev/null +++ b/packages/api/src/cosmos/slashing/module/v1/module.ts @@ -0,0 +1,93 @@ +//@ts-nocheck +import { BinaryReader, BinaryWriter } from "../../../../binary"; +/** Module is the config object of the slashing module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} +export interface ModuleProtoMsg { + typeUrl: "/cosmos.slashing.module.v1.Module"; + value: Uint8Array; +} +/** Module is the config object of the slashing module. */ +export interface ModuleAmino { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority?: string; +} +export interface ModuleAminoMsg { + type: "cosmos-sdk/Module"; + value: ModuleAmino; +} +/** Module is the config object of the slashing module. */ +export interface ModuleSDKType { + authority: string; +} +function createBaseModule(): Module { + return { + authority: "" + }; +} +export const Module = { + typeUrl: "/cosmos.slashing.module.v1.Module", + encode(message: Module, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, + fromAmino(object: ModuleAmino): Module { + const message = createBaseModule(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + return message; + }, + toAmino(message: Module): ModuleAmino { + const obj: any = {}; + obj.authority = message.authority === "" ? undefined : message.authority; + return obj; + }, + fromAminoMsg(object: ModuleAminoMsg): Module { + return Module.fromAmino(object.value); + }, + toAminoMsg(message: Module): ModuleAminoMsg { + return { + type: "cosmos-sdk/Module", + value: Module.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleProtoMsg): Module { + return Module.decode(message.value); + }, + toProto(message: Module): Uint8Array { + return Module.encode(message).finish(); + }, + toProtoMsg(message: Module): ModuleProtoMsg { + return { + typeUrl: "/cosmos.slashing.module.v1.Module", + value: Module.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/staking/module/v1/module.ts b/packages/api/src/cosmos/staking/module/v1/module.ts new file mode 100644 index 00000000..66e2e496 --- /dev/null +++ b/packages/api/src/cosmos/staking/module/v1/module.ts @@ -0,0 +1,154 @@ +//@ts-nocheck +import { BinaryReader, BinaryWriter } from "../../../../binary"; +/** Module is the config object of the staking module. */ +export interface Module { + /** + * hooks_order specifies the order of staking hooks and should be a list + * of module names which provide a staking hooks instance. If no order is + * provided, then hooks will be applied in alphabetical order of module names. + */ + hooksOrder: string[]; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; + /** bech32_prefix_validator is the bech32 validator prefix for the app. */ + bech32PrefixValidator: string; + /** bech32_prefix_consensus is the bech32 consensus node prefix for the app. */ + bech32PrefixConsensus: string; +} +export interface ModuleProtoMsg { + typeUrl: "/cosmos.staking.module.v1.Module"; + value: Uint8Array; +} +/** Module is the config object of the staking module. */ +export interface ModuleAmino { + /** + * hooks_order specifies the order of staking hooks and should be a list + * of module names which provide a staking hooks instance. If no order is + * provided, then hooks will be applied in alphabetical order of module names. + */ + hooks_order?: string[]; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority?: string; + /** bech32_prefix_validator is the bech32 validator prefix for the app. */ + bech32_prefix_validator?: string; + /** bech32_prefix_consensus is the bech32 consensus node prefix for the app. */ + bech32_prefix_consensus?: string; +} +export interface ModuleAminoMsg { + type: "cosmos-sdk/Module"; + value: ModuleAmino; +} +/** Module is the config object of the staking module. */ +export interface ModuleSDKType { + hooks_order: string[]; + authority: string; + bech32_prefix_validator: string; + bech32_prefix_consensus: string; +} +function createBaseModule(): Module { + return { + hooksOrder: [], + authority: "", + bech32PrefixValidator: "", + bech32PrefixConsensus: "" + }; +} +export const Module = { + typeUrl: "/cosmos.staking.module.v1.Module", + encode(message: Module, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.hooksOrder) { + writer.uint32(10).string(v!); + } + if (message.authority !== "") { + writer.uint32(18).string(message.authority); + } + if (message.bech32PrefixValidator !== "") { + writer.uint32(26).string(message.bech32PrefixValidator); + } + if (message.bech32PrefixConsensus !== "") { + writer.uint32(34).string(message.bech32PrefixConsensus); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.hooksOrder.push(reader.string()); + break; + case 2: + message.authority = reader.string(); + break; + case 3: + message.bech32PrefixValidator = reader.string(); + break; + case 4: + message.bech32PrefixConsensus = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): Module { + const message = createBaseModule(); + message.hooksOrder = object.hooksOrder?.map(e => e) || []; + message.authority = object.authority ?? ""; + message.bech32PrefixValidator = object.bech32PrefixValidator ?? ""; + message.bech32PrefixConsensus = object.bech32PrefixConsensus ?? ""; + return message; + }, + fromAmino(object: ModuleAmino): Module { + const message = createBaseModule(); + message.hooksOrder = object.hooks_order?.map(e => e) || []; + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + if (object.bech32_prefix_validator !== undefined && object.bech32_prefix_validator !== null) { + message.bech32PrefixValidator = object.bech32_prefix_validator; + } + if (object.bech32_prefix_consensus !== undefined && object.bech32_prefix_consensus !== null) { + message.bech32PrefixConsensus = object.bech32_prefix_consensus; + } + return message; + }, + toAmino(message: Module): ModuleAmino { + const obj: any = {}; + if (message.hooksOrder) { + obj.hooks_order = message.hooksOrder.map(e => e); + } else { + obj.hooks_order = message.hooksOrder; + } + obj.authority = message.authority === "" ? undefined : message.authority; + obj.bech32_prefix_validator = message.bech32PrefixValidator === "" ? undefined : message.bech32PrefixValidator; + obj.bech32_prefix_consensus = message.bech32PrefixConsensus === "" ? undefined : message.bech32PrefixConsensus; + return obj; + }, + fromAminoMsg(object: ModuleAminoMsg): Module { + return Module.fromAmino(object.value); + }, + toAminoMsg(message: Module): ModuleAminoMsg { + return { + type: "cosmos-sdk/Module", + value: Module.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleProtoMsg): Module { + return Module.decode(message.value); + }, + toProto(message: Module): Uint8Array { + return Module.encode(message).finish(); + }, + toProtoMsg(message: Module): ModuleProtoMsg { + return { + typeUrl: "/cosmos.staking.module.v1.Module", + value: Module.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/staking/v1beta1/authz.ts b/packages/api/src/cosmos/staking/v1beta1/authz.ts index 7e405db6..022490bc 100644 --- a/packages/api/src/cosmos/staking/v1beta1/authz.ts +++ b/packages/api/src/cosmos/staking/v1beta1/authz.ts @@ -1,11 +1,7 @@ //@ts-nocheck import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -/** - * AuthorizationType defines the type of staking module authorization type - * - * Since: cosmos-sdk 0.43 - */ +/** AuthorizationType defines the type of staking module authorization type */ export enum AuthorizationType { /** AUTHORIZATION_TYPE_UNSPECIFIED - AUTHORIZATION_TYPE_UNSPECIFIED specifies an unknown authorization type */ AUTHORIZATION_TYPE_UNSPECIFIED = 0, @@ -15,6 +11,8 @@ export enum AuthorizationType { AUTHORIZATION_TYPE_UNDELEGATE = 2, /** AUTHORIZATION_TYPE_REDELEGATE - AUTHORIZATION_TYPE_REDELEGATE defines an authorization type for Msg/BeginRedelegate */ AUTHORIZATION_TYPE_REDELEGATE = 3, + /** AUTHORIZATION_TYPE_CANCEL_UNBONDING_DELEGATION - AUTHORIZATION_TYPE_CANCEL_UNBONDING_DELEGATION defines an authorization type for Msg/MsgCancelUnbondingDelegation */ + AUTHORIZATION_TYPE_CANCEL_UNBONDING_DELEGATION = 4, UNRECOGNIZED = -1, } export const AuthorizationTypeSDKType = AuthorizationType; @@ -33,6 +31,9 @@ export function authorizationTypeFromJSON(object: any): AuthorizationType { case 3: case "AUTHORIZATION_TYPE_REDELEGATE": return AuthorizationType.AUTHORIZATION_TYPE_REDELEGATE; + case 4: + case "AUTHORIZATION_TYPE_CANCEL_UNBONDING_DELEGATION": + return AuthorizationType.AUTHORIZATION_TYPE_CANCEL_UNBONDING_DELEGATION; case -1: case "UNRECOGNIZED": default: @@ -49,16 +50,14 @@ export function authorizationTypeToJSON(object: AuthorizationType): string { return "AUTHORIZATION_TYPE_UNDELEGATE"; case AuthorizationType.AUTHORIZATION_TYPE_REDELEGATE: return "AUTHORIZATION_TYPE_REDELEGATE"; + case AuthorizationType.AUTHORIZATION_TYPE_CANCEL_UNBONDING_DELEGATION: + return "AUTHORIZATION_TYPE_CANCEL_UNBONDING_DELEGATION"; case AuthorizationType.UNRECOGNIZED: default: return "UNRECOGNIZED"; } } -/** - * StakeAuthorization defines authorization for delegate/undelegate/redelegate. - * - * Since: cosmos-sdk 0.43 - */ +/** StakeAuthorization defines authorization for delegate/undelegate/redelegate. */ export interface StakeAuthorization { $typeUrl?: "/cosmos.staking.v1beta1.StakeAuthorization"; /** @@ -80,11 +79,7 @@ export interface StakeAuthorizationProtoMsg { typeUrl: "/cosmos.staking.v1beta1.StakeAuthorization"; value: Uint8Array; } -/** - * StakeAuthorization defines authorization for delegate/undelegate/redelegate. - * - * Since: cosmos-sdk 0.43 - */ +/** StakeAuthorization defines authorization for delegate/undelegate/redelegate. */ export interface StakeAuthorizationAmino { /** * max_tokens specifies the maximum amount of tokens can be delegate to a validator. If it is @@ -105,11 +100,7 @@ export interface StakeAuthorizationAminoMsg { type: "cosmos-sdk/StakeAuthorization"; value: StakeAuthorizationAmino; } -/** - * StakeAuthorization defines authorization for delegate/undelegate/redelegate. - * - * Since: cosmos-sdk 0.43 - */ +/** StakeAuthorization defines authorization for delegate/undelegate/redelegate. */ export interface StakeAuthorizationSDKType { $typeUrl?: "/cosmos.staking.v1beta1.StakeAuthorization"; max_tokens?: CoinSDKType; diff --git a/packages/api/src/cosmos/staking/v1beta1/genesis.ts b/packages/api/src/cosmos/staking/v1beta1/genesis.ts index 2da570e1..56a40a77 100644 --- a/packages/api/src/cosmos/staking/v1beta1/genesis.ts +++ b/packages/api/src/cosmos/staking/v1beta1/genesis.ts @@ -4,7 +4,7 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { bytesFromBase64, base64FromBytes } from "../../../helpers"; /** GenesisState defines the staking module's genesis state. */ export interface GenesisState { - /** params defines all the paramaters of related to deposit. */ + /** params defines all the parameters of related to deposit. */ params: Params; /** * last_total_power tracks the total amounts of bonded tokens recorded during @@ -16,7 +16,7 @@ export interface GenesisState { * of the last-block's bonded validators. */ lastValidatorPowers: LastValidatorPower[]; - /** delegations defines the validator set at genesis. */ + /** validators defines the validator set at genesis. */ validators: Validator[]; /** delegations defines the delegations active at genesis. */ delegations: Delegation[]; @@ -24,6 +24,7 @@ export interface GenesisState { unbondingDelegations: UnbondingDelegation[]; /** redelegations defines the redelegations active at genesis. */ redelegations: Redelegation[]; + /** exported defines a bool to identify whether the chain dealing with exported or initialized genesis. */ exported: boolean; } export interface GenesisStateProtoMsg { @@ -32,26 +33,27 @@ export interface GenesisStateProtoMsg { } /** GenesisState defines the staking module's genesis state. */ export interface GenesisStateAmino { - /** params defines all the paramaters of related to deposit. */ - params?: ParamsAmino; + /** params defines all the parameters of related to deposit. */ + params: ParamsAmino; /** * last_total_power tracks the total amounts of bonded tokens recorded during * the previous end block. */ - last_total_power?: string; + last_total_power: string; /** * last_validator_powers is a special index that provides a historical list * of the last-block's bonded validators. */ - last_validator_powers?: LastValidatorPowerAmino[]; - /** delegations defines the validator set at genesis. */ - validators?: ValidatorAmino[]; + last_validator_powers: LastValidatorPowerAmino[]; + /** validators defines the validator set at genesis. */ + validators: ValidatorAmino[]; /** delegations defines the delegations active at genesis. */ - delegations?: DelegationAmino[]; + delegations: DelegationAmino[]; /** unbonding_delegations defines the unbonding delegations active at genesis. */ - unbonding_delegations?: UnbondingDelegationAmino[]; + unbonding_delegations: UnbondingDelegationAmino[]; /** redelegations defines the redelegations active at genesis. */ - redelegations?: RedelegationAmino[]; + redelegations: RedelegationAmino[]; + /** exported defines a bool to identify whether the chain dealing with exported or initialized genesis. */ exported?: boolean; } export interface GenesisStateAminoMsg { @@ -207,8 +209,8 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.params = message.params ? Params.toAmino(message.params) : undefined; - obj.last_total_power = message.lastTotalPower ? base64FromBytes(message.lastTotalPower) : undefined; + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); + obj.last_total_power = message.lastTotalPower ? base64FromBytes(message.lastTotalPower) : ""; if (message.lastValidatorPowers) { obj.last_validator_powers = message.lastValidatorPowers.map(e => e ? LastValidatorPower.toAmino(e) : undefined); } else { diff --git a/packages/api/src/cosmos/staking/v1beta1/query.lcd.ts b/packages/api/src/cosmos/staking/v1beta1/query.lcd.ts index a2ef0fe8..bfa7b4bc 100644 --- a/packages/api/src/cosmos/staking/v1beta1/query.lcd.ts +++ b/packages/api/src/cosmos/staking/v1beta1/query.lcd.ts @@ -25,7 +25,10 @@ export class LCDQueryClient { this.pool = this.pool.bind(this); this.params = this.params.bind(this); } - /* Validators queries all validators that match the given status. */ + /* Validators queries all validators that match the given status. + + When called from another module, this query might consume a high amount of + gas if the pagination field is incorrectly set. */ async validators(params: QueryValidatorsRequest): Promise { const options: any = { params: {} @@ -44,7 +47,10 @@ export class LCDQueryClient { const endpoint = `cosmos/staking/v1beta1/validators/${params.validatorAddr}`; return await this.req.get(endpoint); } - /* ValidatorDelegations queries delegate info for given validator. */ + /* ValidatorDelegations queries delegate info for given validator. + + When called from another module, this query might consume a high amount of + gas if the pagination field is incorrectly set. */ async validatorDelegations(params: QueryValidatorDelegationsRequest): Promise { const options: any = { params: {} @@ -55,7 +61,10 @@ export class LCDQueryClient { const endpoint = `cosmos/staking/v1beta1/validators/${params.validatorAddr}/delegations`; return await this.req.get(endpoint, options); } - /* ValidatorUnbondingDelegations queries unbonding delegations of a validator. */ + /* ValidatorUnbondingDelegations queries unbonding delegations of a validator. + + When called from another module, this query might consume a high amount of + gas if the pagination field is incorrectly set. */ async validatorUnbondingDelegations(params: QueryValidatorUnbondingDelegationsRequest): Promise { const options: any = { params: {} @@ -77,7 +86,10 @@ export class LCDQueryClient { const endpoint = `cosmos/staking/v1beta1/validators/${params.validatorAddr}/delegations/${params.delegatorAddr}/unbonding_delegation`; return await this.req.get(endpoint); } - /* DelegatorDelegations queries all delegations of a given delegator address. */ + /* DelegatorDelegations queries all delegations of a given delegator address. + + When called from another module, this query might consume a high amount of + gas if the pagination field is incorrectly set. */ async delegatorDelegations(params: QueryDelegatorDelegationsRequest): Promise { const options: any = { params: {} @@ -89,7 +101,10 @@ export class LCDQueryClient { return await this.req.get(endpoint, options); } /* DelegatorUnbondingDelegations queries all unbonding delegations of a given - delegator address. */ + delegator address. + + When called from another module, this query might consume a high amount of + gas if the pagination field is incorrectly set. */ async delegatorUnbondingDelegations(params: QueryDelegatorUnbondingDelegationsRequest): Promise { const options: any = { params: {} @@ -100,7 +115,10 @@ export class LCDQueryClient { const endpoint = `cosmos/staking/v1beta1/delegators/${params.delegatorAddr}/unbonding_delegations`; return await this.req.get(endpoint, options); } - /* Redelegations queries redelegations of given address. */ + /* Redelegations queries redelegations of given address. + + When called from another module, this query might consume a high amount of + gas if the pagination field is incorrectly set. */ async redelegations(params: QueryRedelegationsRequest): Promise { const options: any = { params: {} @@ -118,7 +136,10 @@ export class LCDQueryClient { return await this.req.get(endpoint, options); } /* DelegatorValidators queries all validators info for given delegator - address. */ + address. + + When called from another module, this query might consume a high amount of + gas if the pagination field is incorrectly set. */ async delegatorValidators(params: QueryDelegatorValidatorsRequest): Promise { const options: any = { params: {} diff --git a/packages/api/src/cosmos/staking/v1beta1/query.rpc.Query.ts b/packages/api/src/cosmos/staking/v1beta1/query.rpc.Query.ts index dcf1f2d4..9fed99da 100644 --- a/packages/api/src/cosmos/staking/v1beta1/query.rpc.Query.ts +++ b/packages/api/src/cosmos/staking/v1beta1/query.rpc.Query.ts @@ -5,13 +5,28 @@ import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; import { QueryValidatorsRequest, QueryValidatorsResponse, QueryValidatorRequest, QueryValidatorResponse, QueryValidatorDelegationsRequest, QueryValidatorDelegationsResponse, QueryValidatorUnbondingDelegationsRequest, QueryValidatorUnbondingDelegationsResponse, QueryDelegationRequest, QueryDelegationResponse, QueryUnbondingDelegationRequest, QueryUnbondingDelegationResponse, QueryDelegatorDelegationsRequest, QueryDelegatorDelegationsResponse, QueryDelegatorUnbondingDelegationsRequest, QueryDelegatorUnbondingDelegationsResponse, QueryRedelegationsRequest, QueryRedelegationsResponse, QueryDelegatorValidatorsRequest, QueryDelegatorValidatorsResponse, QueryDelegatorValidatorRequest, QueryDelegatorValidatorResponse, QueryHistoricalInfoRequest, QueryHistoricalInfoResponse, QueryPoolRequest, QueryPoolResponse, QueryParamsRequest, QueryParamsResponse } from "./query"; /** Query defines the gRPC querier service. */ export interface Query { - /** Validators queries all validators that match the given status. */ + /** + * Validators queries all validators that match the given status. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ validators(request: QueryValidatorsRequest): Promise; /** Validator queries validator info for given validator address. */ validator(request: QueryValidatorRequest): Promise; - /** ValidatorDelegations queries delegate info for given validator. */ + /** + * ValidatorDelegations queries delegate info for given validator. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ validatorDelegations(request: QueryValidatorDelegationsRequest): Promise; - /** ValidatorUnbondingDelegations queries unbonding delegations of a validator. */ + /** + * ValidatorUnbondingDelegations queries unbonding delegations of a validator. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ validatorUnbondingDelegations(request: QueryValidatorUnbondingDelegationsRequest): Promise; /** Delegation queries delegate info for given validator delegator pair. */ delegation(request: QueryDelegationRequest): Promise; @@ -20,18 +35,34 @@ export interface Query { * pair. */ unbondingDelegation(request: QueryUnbondingDelegationRequest): Promise; - /** DelegatorDelegations queries all delegations of a given delegator address. */ + /** + * DelegatorDelegations queries all delegations of a given delegator address. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ delegatorDelegations(request: QueryDelegatorDelegationsRequest): Promise; /** * DelegatorUnbondingDelegations queries all unbonding delegations of a given * delegator address. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. */ delegatorUnbondingDelegations(request: QueryDelegatorUnbondingDelegationsRequest): Promise; - /** Redelegations queries redelegations of given address. */ + /** + * Redelegations queries redelegations of given address. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ redelegations(request: QueryRedelegationsRequest): Promise; /** * DelegatorValidators queries all validators info for given delegator * address. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. */ delegatorValidators(request: QueryDelegatorValidatorsRequest): Promise; /** diff --git a/packages/api/src/cosmos/staking/v1beta1/query.ts b/packages/api/src/cosmos/staking/v1beta1/query.ts index 85179c87..aa4be8c6 100644 --- a/packages/api/src/cosmos/staking/v1beta1/query.ts +++ b/packages/api/src/cosmos/staking/v1beta1/query.ts @@ -43,7 +43,7 @@ export interface QueryValidatorsResponseProtoMsg { /** QueryValidatorsResponse is response type for the Query/Validators RPC method */ export interface QueryValidatorsResponseAmino { /** validators contains all the queried validators. */ - validators?: ValidatorAmino[]; + validators: ValidatorAmino[]; /** pagination defines the pagination in the response. */ pagination?: PageResponseAmino; } @@ -90,7 +90,7 @@ export interface QueryValidatorResponseProtoMsg { /** QueryValidatorResponse is response type for the Query/Validator RPC method */ export interface QueryValidatorResponseAmino { /** validator defines the validator info. */ - validator?: ValidatorAmino; + validator: ValidatorAmino; } export interface QueryValidatorResponseAminoMsg { type: "cosmos-sdk/QueryValidatorResponse"; @@ -154,7 +154,7 @@ export interface QueryValidatorDelegationsResponseProtoMsg { * Query/ValidatorDelegations RPC method */ export interface QueryValidatorDelegationsResponseAmino { - delegation_responses?: DelegationResponseAmino[]; + delegation_responses: DelegationResponseAmino[]; /** pagination defines the pagination in the response. */ pagination?: PageResponseAmino; } @@ -224,7 +224,7 @@ export interface QueryValidatorUnbondingDelegationsResponseProtoMsg { * Query/ValidatorUnbondingDelegations RPC method. */ export interface QueryValidatorUnbondingDelegationsResponseAmino { - unbonding_responses?: UnbondingDelegationAmino[]; + unbonding_responses: UnbondingDelegationAmino[]; /** pagination defines the pagination in the response. */ pagination?: PageResponseAmino; } @@ -343,7 +343,7 @@ export interface QueryUnbondingDelegationResponseProtoMsg { */ export interface QueryUnbondingDelegationResponseAmino { /** unbond defines the unbonding information of a delegation. */ - unbond?: UnbondingDelegationAmino; + unbond: UnbondingDelegationAmino; } export interface QueryUnbondingDelegationResponseAminoMsg { type: "cosmos-sdk/QueryUnbondingDelegationResponse"; @@ -412,7 +412,7 @@ export interface QueryDelegatorDelegationsResponseProtoMsg { */ export interface QueryDelegatorDelegationsResponseAmino { /** delegation_responses defines all the delegations' info of a delegator. */ - delegation_responses?: DelegationResponseAmino[]; + delegation_responses: DelegationResponseAmino[]; /** pagination defines the pagination in the response. */ pagination?: PageResponseAmino; } @@ -482,7 +482,7 @@ export interface QueryDelegatorUnbondingDelegationsResponseProtoMsg { * Query/UnbondingDelegatorDelegations RPC method. */ export interface QueryDelegatorUnbondingDelegationsResponseAmino { - unbonding_responses?: UnbondingDelegationAmino[]; + unbonding_responses: UnbondingDelegationAmino[]; /** pagination defines the pagination in the response. */ pagination?: PageResponseAmino; } @@ -562,7 +562,7 @@ export interface QueryRedelegationsResponseProtoMsg { * method. */ export interface QueryRedelegationsResponseAmino { - redelegation_responses?: RedelegationResponseAmino[]; + redelegation_responses: RedelegationResponseAmino[]; /** pagination defines the pagination in the response. */ pagination?: PageResponseAmino; } @@ -634,7 +634,7 @@ export interface QueryDelegatorValidatorsResponseProtoMsg { */ export interface QueryDelegatorValidatorsResponseAmino { /** validators defines the validators' info of a delegator. */ - validators?: ValidatorAmino[]; + validators: ValidatorAmino[]; /** pagination defines the pagination in the response. */ pagination?: PageResponseAmino; } @@ -704,7 +704,7 @@ export interface QueryDelegatorValidatorResponseProtoMsg { */ export interface QueryDelegatorValidatorResponseAmino { /** validator defines the validator info. */ - validator?: ValidatorAmino; + validator: ValidatorAmino; } export interface QueryDelegatorValidatorResponseAminoMsg { type: "cosmos-sdk/QueryDelegatorValidatorResponse"; @@ -805,7 +805,7 @@ export interface QueryPoolResponseProtoMsg { /** QueryPoolResponse is response type for the Query/Pool RPC method. */ export interface QueryPoolResponseAmino { /** pool defines the pool info. */ - pool?: PoolAmino; + pool: PoolAmino; } export interface QueryPoolResponseAminoMsg { type: "cosmos-sdk/QueryPoolResponse"; @@ -841,7 +841,7 @@ export interface QueryParamsResponseProtoMsg { /** QueryParamsResponse is response type for the Query/Params RPC method. */ export interface QueryParamsResponseAmino { /** params holds all the parameters of this module. */ - params?: ParamsAmino; + params: ParamsAmino; } export interface QueryParamsResponseAminoMsg { type: "cosmos-sdk/QueryParamsResponse"; @@ -1128,7 +1128,7 @@ export const QueryValidatorResponse = { }, toAmino(message: QueryValidatorResponse): QueryValidatorResponseAmino { const obj: any = {}; - obj.validator = message.validator ? Validator.toAmino(message.validator) : undefined; + obj.validator = message.validator ? Validator.toAmino(message.validator) : Validator.toAmino(Validator.fromPartial({})); return obj; }, fromAminoMsg(object: QueryValidatorResponseAminoMsg): QueryValidatorResponse { @@ -1756,7 +1756,7 @@ export const QueryUnbondingDelegationResponse = { }, toAmino(message: QueryUnbondingDelegationResponse): QueryUnbondingDelegationResponseAmino { const obj: any = {}; - obj.unbond = message.unbond ? UnbondingDelegation.toAmino(message.unbond) : undefined; + obj.unbond = message.unbond ? UnbondingDelegation.toAmino(message.unbond) : UnbondingDelegation.toAmino(UnbondingDelegation.fromPartial({})); return obj; }, fromAminoMsg(object: QueryUnbondingDelegationResponseAminoMsg): QueryUnbondingDelegationResponse { @@ -2586,7 +2586,7 @@ export const QueryDelegatorValidatorResponse = { }, toAmino(message: QueryDelegatorValidatorResponse): QueryDelegatorValidatorResponseAmino { const obj: any = {}; - obj.validator = message.validator ? Validator.toAmino(message.validator) : undefined; + obj.validator = message.validator ? Validator.toAmino(message.validator) : Validator.toAmino(Validator.fromPartial({})); return obj; }, fromAminoMsg(object: QueryDelegatorValidatorResponseAminoMsg): QueryDelegatorValidatorResponse { @@ -2849,7 +2849,7 @@ export const QueryPoolResponse = { }, toAmino(message: QueryPoolResponse): QueryPoolResponseAmino { const obj: any = {}; - obj.pool = message.pool ? Pool.toAmino(message.pool) : undefined; + obj.pool = message.pool ? Pool.toAmino(message.pool) : Pool.toAmino(Pool.fromPartial({})); return obj; }, fromAminoMsg(object: QueryPoolResponseAminoMsg): QueryPoolResponse { @@ -2974,7 +2974,7 @@ export const QueryParamsResponse = { }, toAmino(message: QueryParamsResponse): QueryParamsResponseAmino { const obj: any = {}; - obj.params = message.params ? Params.toAmino(message.params) : undefined; + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); return obj; }, fromAminoMsg(object: QueryParamsResponseAminoMsg): QueryParamsResponse { diff --git a/packages/api/src/cosmos/staking/v1beta1/staking.ts b/packages/api/src/cosmos/staking/v1beta1/staking.ts index eb580102..91682f1e 100644 --- a/packages/api/src/cosmos/staking/v1beta1/staking.ts +++ b/packages/api/src/cosmos/staking/v1beta1/staking.ts @@ -4,6 +4,7 @@ import { Timestamp } from "../../../google/protobuf/timestamp"; import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; +import { ValidatorUpdate, ValidatorUpdateAmino, ValidatorUpdateSDKType } from "../../../tendermint/abci/types"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; import { toTimestamp, fromTimestamp } from "../../../helpers"; @@ -58,6 +59,48 @@ export function bondStatusToJSON(object: BondStatus): string { return "UNRECOGNIZED"; } } +/** Infraction indicates the infraction a validator commited. */ +export enum Infraction { + /** INFRACTION_UNSPECIFIED - UNSPECIFIED defines an empty infraction. */ + INFRACTION_UNSPECIFIED = 0, + /** INFRACTION_DOUBLE_SIGN - DOUBLE_SIGN defines a validator that double-signs a block. */ + INFRACTION_DOUBLE_SIGN = 1, + /** INFRACTION_DOWNTIME - DOWNTIME defines a validator that missed signing too many blocks. */ + INFRACTION_DOWNTIME = 2, + UNRECOGNIZED = -1, +} +export const InfractionSDKType = Infraction; +export const InfractionAmino = Infraction; +export function infractionFromJSON(object: any): Infraction { + switch (object) { + case 0: + case "INFRACTION_UNSPECIFIED": + return Infraction.INFRACTION_UNSPECIFIED; + case 1: + case "INFRACTION_DOUBLE_SIGN": + return Infraction.INFRACTION_DOUBLE_SIGN; + case 2: + case "INFRACTION_DOWNTIME": + return Infraction.INFRACTION_DOWNTIME; + case -1: + case "UNRECOGNIZED": + default: + return Infraction.UNRECOGNIZED; + } +} +export function infractionToJSON(object: Infraction): string { + switch (object) { + case Infraction.INFRACTION_UNSPECIFIED: + return "INFRACTION_UNSPECIFIED"; + case Infraction.INFRACTION_DOUBLE_SIGN: + return "INFRACTION_DOUBLE_SIGN"; + case Infraction.INFRACTION_DOWNTIME: + return "INFRACTION_DOWNTIME"; + case Infraction.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} /** * HistoricalInfo contains header and validator information for a given block. * It is stored as part of staking module's state, which persists the `n` most @@ -79,8 +122,8 @@ export interface HistoricalInfoProtoMsg { * (`n` is set by the staking module's `historical_entries` parameter). */ export interface HistoricalInfoAmino { - header?: HeaderAmino; - valset?: ValidatorAmino[]; + header: HeaderAmino; + valset: ValidatorAmino[]; } export interface HistoricalInfoAminoMsg { type: "cosmos-sdk/HistoricalInfo"; @@ -118,11 +161,11 @@ export interface CommissionRatesProtoMsg { */ export interface CommissionRatesAmino { /** rate is the commission rate charged to delegators, as a fraction. */ - rate?: string; + rate: string; /** max_rate defines the maximum commission rate which validator can ever charge, as a fraction. */ - max_rate?: string; + max_rate: string; /** max_change_rate defines the maximum daily increase of the validator commission, as a fraction. */ - max_change_rate?: string; + max_change_rate: string; } export interface CommissionRatesAminoMsg { type: "cosmos-sdk/CommissionRates"; @@ -151,9 +194,9 @@ export interface CommissionProtoMsg { /** Commission defines commission parameters for a given validator. */ export interface CommissionAmino { /** commission_rates defines the initial commission rates to be used for creating a validator. */ - commission_rates?: CommissionRatesAmino; + commission_rates: CommissionRatesAmino; /** update_time is the last time the commission rate was changed. */ - update_time?: string; + update_time: string; } export interface CommissionAminoMsg { type: "cosmos-sdk/Commission"; @@ -237,12 +280,12 @@ export interface Validator { unbondingTime: Date; /** commission defines the commission parameters. */ commission: Commission; - /** - * min_self_delegation is the validator's self declared minimum self delegation. - * - * Since: cosmos-sdk 0.46 - */ + /** min_self_delegation is the validator's self declared minimum self delegation. */ minSelfDelegation: string; + /** strictly positive if this validator's unbonding has been stopped by external modules */ + unbondingOnHoldRefCount: bigint; + /** list of unbonding ids, each uniquely identifing an unbonding of this validator */ + unbondingIds: bigint[]; } export interface ValidatorProtoMsg { typeUrl: "/cosmos.staking.v1beta1.Validator"; @@ -275,19 +318,19 @@ export interface ValidatorAmino { /** delegator_shares defines total shares issued to a validator's delegators. */ delegator_shares?: string; /** description defines the description terms for the validator. */ - description?: DescriptionAmino; + description: DescriptionAmino; /** unbonding_height defines, if unbonding, the height at which this validator has begun unbonding. */ unbonding_height?: string; /** unbonding_time defines, if unbonding, the min time for the validator to complete unbonding. */ - unbonding_time?: string; + unbonding_time: string; /** commission defines the commission parameters. */ - commission?: CommissionAmino; - /** - * min_self_delegation is the validator's self declared minimum self delegation. - * - * Since: cosmos-sdk 0.46 - */ + commission: CommissionAmino; + /** min_self_delegation is the validator's self declared minimum self delegation. */ min_self_delegation?: string; + /** strictly positive if this validator's unbonding has been stopped by external modules */ + unbonding_on_hold_ref_count?: string; + /** list of unbonding ids, each uniquely identifing an unbonding of this validator */ + unbonding_ids?: string[]; } export interface ValidatorAminoMsg { type: "cosmos-sdk/Validator"; @@ -315,6 +358,8 @@ export interface ValidatorSDKType { unbonding_time: Date; commission: CommissionSDKType; min_self_delegation: string; + unbonding_on_hold_ref_count: bigint; + unbonding_ids: bigint[]; } /** ValAddresses defines a repeated set of validator addresses. */ export interface ValAddresses { @@ -381,7 +426,7 @@ export interface DVPairsProtoMsg { } /** DVPairs defines an array of DVPair objects. */ export interface DVPairsAmino { - pairs?: DVPairAmino[]; + pairs: DVPairAmino[]; } export interface DVPairsAminoMsg { type: "cosmos-sdk/DVPairs"; @@ -442,7 +487,7 @@ export interface DVVTripletsProtoMsg { } /** DVVTriplets defines an array of DVVTriplet objects. */ export interface DVVTripletsAmino { - triplets?: DVVTripletAmino[]; + triplets: DVVTripletAmino[]; } export interface DVVTripletsAminoMsg { type: "cosmos-sdk/DVVTriplets"; @@ -458,9 +503,9 @@ export interface DVVTripletsSDKType { * validator. */ export interface Delegation { - /** delegator_address is the bech32-encoded address of the delegator. */ + /** delegator_address is the encoded address of the delegator. */ delegatorAddress: string; - /** validator_address is the bech32-encoded address of the validator. */ + /** validator_address is the encoded address of the validator. */ validatorAddress: string; /** shares define the delegation shares received. */ shares: string; @@ -475,9 +520,9 @@ export interface DelegationProtoMsg { * validator. */ export interface DelegationAmino { - /** delegator_address is the bech32-encoded address of the delegator. */ + /** delegator_address is the encoded address of the delegator. */ delegator_address?: string; - /** validator_address is the bech32-encoded address of the validator. */ + /** validator_address is the encoded address of the validator. */ validator_address?: string; /** shares define the delegation shares received. */ shares?: string; @@ -501,9 +546,9 @@ export interface DelegationSDKType { * for a single validator in an time-ordered list. */ export interface UnbondingDelegation { - /** delegator_address is the bech32-encoded address of the delegator. */ + /** delegator_address is the encoded address of the delegator. */ delegatorAddress: string; - /** validator_address is the bech32-encoded address of the validator. */ + /** validator_address is the encoded address of the validator. */ validatorAddress: string; /** entries are the unbonding delegation entries. */ entries: UnbondingDelegationEntry[]; @@ -517,12 +562,12 @@ export interface UnbondingDelegationProtoMsg { * for a single validator in an time-ordered list. */ export interface UnbondingDelegationAmino { - /** delegator_address is the bech32-encoded address of the delegator. */ + /** delegator_address is the encoded address of the delegator. */ delegator_address?: string; - /** validator_address is the bech32-encoded address of the validator. */ + /** validator_address is the encoded address of the validator. */ validator_address?: string; /** entries are the unbonding delegation entries. */ - entries?: UnbondingDelegationEntryAmino[]; + entries: UnbondingDelegationEntryAmino[]; } export interface UnbondingDelegationAminoMsg { type: "cosmos-sdk/UnbondingDelegation"; @@ -547,6 +592,10 @@ export interface UnbondingDelegationEntry { initialBalance: string; /** balance defines the tokens to receive at completion. */ balance: string; + /** Incrementing id that uniquely identifies this entry */ + unbondingId: bigint; + /** Strictly positive if this entry's unbonding has been stopped by external modules */ + unbondingOnHoldRefCount: bigint; } export interface UnbondingDelegationEntryProtoMsg { typeUrl: "/cosmos.staking.v1beta1.UnbondingDelegationEntry"; @@ -557,11 +606,15 @@ export interface UnbondingDelegationEntryAmino { /** creation_height is the height which the unbonding took place. */ creation_height?: string; /** completion_time is the unix time for unbonding completion. */ - completion_time?: string; + completion_time: string; /** initial_balance defines the tokens initially scheduled to receive at completion. */ initial_balance?: string; /** balance defines the tokens to receive at completion. */ balance?: string; + /** Incrementing id that uniquely identifies this entry */ + unbonding_id?: string; + /** Strictly positive if this entry's unbonding has been stopped by external modules */ + unbonding_on_hold_ref_count?: string; } export interface UnbondingDelegationEntryAminoMsg { type: "cosmos-sdk/UnbondingDelegationEntry"; @@ -573,6 +626,8 @@ export interface UnbondingDelegationEntrySDKType { completion_time: Date; initial_balance: string; balance: string; + unbonding_id: bigint; + unbonding_on_hold_ref_count: bigint; } /** RedelegationEntry defines a redelegation object with relevant metadata. */ export interface RedelegationEntry { @@ -584,6 +639,10 @@ export interface RedelegationEntry { initialBalance: string; /** shares_dst is the amount of destination-validator shares created by redelegation. */ sharesDst: string; + /** Incrementing id that uniquely identifies this entry */ + unbondingId: bigint; + /** Strictly positive if this entry's unbonding has been stopped by external modules */ + unbondingOnHoldRefCount: bigint; } export interface RedelegationEntryProtoMsg { typeUrl: "/cosmos.staking.v1beta1.RedelegationEntry"; @@ -594,11 +653,15 @@ export interface RedelegationEntryAmino { /** creation_height defines the height which the redelegation took place. */ creation_height?: string; /** completion_time defines the unix time for redelegation completion. */ - completion_time?: string; + completion_time: string; /** initial_balance defines the initial balance when redelegation started. */ initial_balance?: string; /** shares_dst is the amount of destination-validator shares created by redelegation. */ shares_dst?: string; + /** Incrementing id that uniquely identifies this entry */ + unbonding_id?: string; + /** Strictly positive if this entry's unbonding has been stopped by external modules */ + unbonding_on_hold_ref_count?: string; } export interface RedelegationEntryAminoMsg { type: "cosmos-sdk/RedelegationEntry"; @@ -610,6 +673,8 @@ export interface RedelegationEntrySDKType { completion_time: Date; initial_balance: string; shares_dst: string; + unbonding_id: bigint; + unbonding_on_hold_ref_count: bigint; } /** * Redelegation contains the list of a particular delegator's redelegating bonds @@ -641,7 +706,7 @@ export interface RedelegationAmino { /** validator_dst_address is the validator redelegation destination operator address. */ validator_dst_address?: string; /** entries are the redelegation entries. */ - entries?: RedelegationEntryAmino[]; + entries: RedelegationEntryAmino[]; } export interface RedelegationAminoMsg { type: "cosmos-sdk/Redelegation"; @@ -657,7 +722,7 @@ export interface RedelegationSDKType { validator_dst_address: string; entries: RedelegationEntrySDKType[]; } -/** Params defines the parameters for the staking module. */ +/** Params defines the parameters for the x/staking module. */ export interface Params { /** unbonding_time is the time duration of unbonding. */ unbondingTime: Duration; @@ -676,10 +741,10 @@ export interface ParamsProtoMsg { typeUrl: "/cosmos.staking.v1beta1.Params"; value: Uint8Array; } -/** Params defines the parameters for the staking module. */ +/** Params defines the parameters for the x/staking module. */ export interface ParamsAmino { /** unbonding_time is the time duration of unbonding. */ - unbonding_time?: DurationAmino; + unbonding_time: DurationAmino; /** max_validators is the maximum number of validators. */ max_validators?: number; /** max_entries is the max entries for either unbonding delegation or redelegation (per pair/trio). */ @@ -689,13 +754,13 @@ export interface ParamsAmino { /** bond_denom defines the bondable coin denomination. */ bond_denom?: string; /** min_commission_rate is the chain-wide minimum commission rate that a validator can charge their delegators */ - min_commission_rate?: string; + min_commission_rate: string; } export interface ParamsAminoMsg { - type: "cosmos-sdk/Params"; + type: "cosmos-sdk/x/staking/Params"; value: ParamsAmino; } -/** Params defines the parameters for the staking module. */ +/** Params defines the parameters for the x/staking module. */ export interface ParamsSDKType { unbonding_time: DurationSDKType; max_validators: number; @@ -721,8 +786,8 @@ export interface DelegationResponseProtoMsg { * balance in addition to shares which is more suitable for client responses. */ export interface DelegationResponseAmino { - delegation?: DelegationAmino; - balance?: CoinAmino; + delegation: DelegationAmino; + balance: CoinAmino; } export interface DelegationResponseAminoMsg { type: "cosmos-sdk/DelegationResponse"; @@ -755,7 +820,7 @@ export interface RedelegationEntryResponseProtoMsg { * responses. */ export interface RedelegationEntryResponseAmino { - redelegation_entry?: RedelegationEntryAmino; + redelegation_entry: RedelegationEntryAmino; balance?: string; } export interface RedelegationEntryResponseAminoMsg { @@ -790,8 +855,8 @@ export interface RedelegationResponseProtoMsg { * responses. */ export interface RedelegationResponseAmino { - redelegation?: RedelegationAmino; - entries?: RedelegationEntryResponseAmino[]; + redelegation: RedelegationAmino; + entries: RedelegationEntryResponseAmino[]; } export interface RedelegationResponseAminoMsg { type: "cosmos-sdk/RedelegationResponse"; @@ -838,6 +903,35 @@ export interface PoolSDKType { not_bonded_tokens: string; bonded_tokens: string; } +/** + * ValidatorUpdates defines an array of abci.ValidatorUpdate objects. + * TODO: explore moving this to proto/cosmos/base to separate modules from tendermint dependence + */ +export interface ValidatorUpdates { + updates: ValidatorUpdate[]; +} +export interface ValidatorUpdatesProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.ValidatorUpdates"; + value: Uint8Array; +} +/** + * ValidatorUpdates defines an array of abci.ValidatorUpdate objects. + * TODO: explore moving this to proto/cosmos/base to separate modules from tendermint dependence + */ +export interface ValidatorUpdatesAmino { + updates: ValidatorUpdateAmino[]; +} +export interface ValidatorUpdatesAminoMsg { + type: "cosmos-sdk/ValidatorUpdates"; + value: ValidatorUpdatesAmino; +} +/** + * ValidatorUpdates defines an array of abci.ValidatorUpdate objects. + * TODO: explore moving this to proto/cosmos/base to separate modules from tendermint dependence + */ +export interface ValidatorUpdatesSDKType { + updates: ValidatorUpdateSDKType[]; +} function createBaseHistoricalInfo(): HistoricalInfo { return { header: Header.fromPartial({}), @@ -891,7 +985,7 @@ export const HistoricalInfo = { }, toAmino(message: HistoricalInfo): HistoricalInfoAmino { const obj: any = {}; - obj.header = message.header ? Header.toAmino(message.header) : undefined; + obj.header = message.header ? Header.toAmino(message.header) : Header.toAmino(Header.fromPartial({})); if (message.valset) { obj.valset = message.valset.map(e => e ? Validator.toAmino(e) : undefined); } else { @@ -987,9 +1081,9 @@ export const CommissionRates = { }, toAmino(message: CommissionRates): CommissionRatesAmino { const obj: any = {}; - obj.rate = message.rate === "" ? undefined : message.rate; - obj.max_rate = message.maxRate === "" ? undefined : message.maxRate; - obj.max_change_rate = message.maxChangeRate === "" ? undefined : message.maxChangeRate; + obj.rate = message.rate ?? ""; + obj.max_rate = message.maxRate ?? ""; + obj.max_change_rate = message.maxChangeRate ?? ""; return obj; }, fromAminoMsg(object: CommissionRatesAminoMsg): CommissionRates { @@ -1069,8 +1163,8 @@ export const Commission = { }, toAmino(message: Commission): CommissionAmino { const obj: any = {}; - obj.commission_rates = message.commissionRates ? CommissionRates.toAmino(message.commissionRates) : undefined; - obj.update_time = message.updateTime ? Timestamp.toAmino(toTimestamp(message.updateTime)) : undefined; + obj.commission_rates = message.commissionRates ? CommissionRates.toAmino(message.commissionRates) : CommissionRates.toAmino(CommissionRates.fromPartial({})); + obj.update_time = message.updateTime ? Timestamp.toAmino(toTimestamp(message.updateTime)) : new Date(); return obj; }, fromAminoMsg(object: CommissionAminoMsg): Commission { @@ -1224,7 +1318,9 @@ function createBaseValidator(): Validator { unbondingHeight: BigInt(0), unbondingTime: new Date(), commission: Commission.fromPartial({}), - minSelfDelegation: "" + minSelfDelegation: "", + unbondingOnHoldRefCount: BigInt(0), + unbondingIds: [] }; } export const Validator = { @@ -1263,6 +1359,14 @@ export const Validator = { if (message.minSelfDelegation !== "") { writer.uint32(90).string(message.minSelfDelegation); } + if (message.unbondingOnHoldRefCount !== BigInt(0)) { + writer.uint32(96).int64(message.unbondingOnHoldRefCount); + } + writer.uint32(106).fork(); + for (const v of message.unbondingIds) { + writer.uint64(v); + } + writer.ldelim(); return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): Validator { @@ -1305,6 +1409,19 @@ export const Validator = { case 11: message.minSelfDelegation = reader.string(); break; + case 12: + message.unbondingOnHoldRefCount = reader.int64(); + break; + case 13: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.unbondingIds.push(reader.uint64()); + } + } else { + message.unbondingIds.push(reader.uint64()); + } + break; default: reader.skipType(tag & 7); break; @@ -1325,6 +1442,8 @@ export const Validator = { message.unbondingTime = object.unbondingTime ?? undefined; message.commission = object.commission !== undefined && object.commission !== null ? Commission.fromPartial(object.commission) : undefined; message.minSelfDelegation = object.minSelfDelegation ?? ""; + message.unbondingOnHoldRefCount = object.unbondingOnHoldRefCount !== undefined && object.unbondingOnHoldRefCount !== null ? BigInt(object.unbondingOnHoldRefCount.toString()) : BigInt(0); + message.unbondingIds = object.unbondingIds?.map(e => BigInt(e.toString())) || []; return message; }, fromAmino(object: ValidatorAmino): Validator { @@ -1362,6 +1481,10 @@ export const Validator = { if (object.min_self_delegation !== undefined && object.min_self_delegation !== null) { message.minSelfDelegation = object.min_self_delegation; } + if (object.unbonding_on_hold_ref_count !== undefined && object.unbonding_on_hold_ref_count !== null) { + message.unbondingOnHoldRefCount = BigInt(object.unbonding_on_hold_ref_count); + } + message.unbondingIds = object.unbonding_ids?.map(e => BigInt(e)) || []; return message; }, toAmino(message: Validator): ValidatorAmino { @@ -1372,11 +1495,17 @@ export const Validator = { obj.status = message.status === 0 ? undefined : message.status; obj.tokens = message.tokens === "" ? undefined : message.tokens; obj.delegator_shares = message.delegatorShares === "" ? undefined : message.delegatorShares; - obj.description = message.description ? Description.toAmino(message.description) : undefined; + obj.description = message.description ? Description.toAmino(message.description) : Description.toAmino(Description.fromPartial({})); obj.unbonding_height = message.unbondingHeight !== BigInt(0) ? message.unbondingHeight?.toString() : undefined; - obj.unbonding_time = message.unbondingTime ? Timestamp.toAmino(toTimestamp(message.unbondingTime)) : undefined; - obj.commission = message.commission ? Commission.toAmino(message.commission) : undefined; + obj.unbonding_time = message.unbondingTime ? Timestamp.toAmino(toTimestamp(message.unbondingTime)) : new Date(); + obj.commission = message.commission ? Commission.toAmino(message.commission) : Commission.toAmino(Commission.fromPartial({})); obj.min_self_delegation = message.minSelfDelegation === "" ? undefined : message.minSelfDelegation; + obj.unbonding_on_hold_ref_count = message.unbondingOnHoldRefCount !== BigInt(0) ? message.unbondingOnHoldRefCount?.toString() : undefined; + if (message.unbondingIds) { + obj.unbonding_ids = message.unbondingIds.map(e => e.toString()); + } else { + obj.unbonding_ids = message.unbondingIds; + } return obj; }, fromAminoMsg(object: ValidatorAminoMsg): Validator { @@ -1981,7 +2110,9 @@ function createBaseUnbondingDelegationEntry(): UnbondingDelegationEntry { creationHeight: BigInt(0), completionTime: new Date(), initialBalance: "", - balance: "" + balance: "", + unbondingId: BigInt(0), + unbondingOnHoldRefCount: BigInt(0) }; } export const UnbondingDelegationEntry = { @@ -1999,6 +2130,12 @@ export const UnbondingDelegationEntry = { if (message.balance !== "") { writer.uint32(34).string(message.balance); } + if (message.unbondingId !== BigInt(0)) { + writer.uint32(40).uint64(message.unbondingId); + } + if (message.unbondingOnHoldRefCount !== BigInt(0)) { + writer.uint32(48).int64(message.unbondingOnHoldRefCount); + } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): UnbondingDelegationEntry { @@ -2020,6 +2157,12 @@ export const UnbondingDelegationEntry = { case 4: message.balance = reader.string(); break; + case 5: + message.unbondingId = reader.uint64(); + break; + case 6: + message.unbondingOnHoldRefCount = reader.int64(); + break; default: reader.skipType(tag & 7); break; @@ -2033,6 +2176,8 @@ export const UnbondingDelegationEntry = { message.completionTime = object.completionTime ?? undefined; message.initialBalance = object.initialBalance ?? ""; message.balance = object.balance ?? ""; + message.unbondingId = object.unbondingId !== undefined && object.unbondingId !== null ? BigInt(object.unbondingId.toString()) : BigInt(0); + message.unbondingOnHoldRefCount = object.unbondingOnHoldRefCount !== undefined && object.unbondingOnHoldRefCount !== null ? BigInt(object.unbondingOnHoldRefCount.toString()) : BigInt(0); return message; }, fromAmino(object: UnbondingDelegationEntryAmino): UnbondingDelegationEntry { @@ -2049,14 +2194,22 @@ export const UnbondingDelegationEntry = { if (object.balance !== undefined && object.balance !== null) { message.balance = object.balance; } + if (object.unbonding_id !== undefined && object.unbonding_id !== null) { + message.unbondingId = BigInt(object.unbonding_id); + } + if (object.unbonding_on_hold_ref_count !== undefined && object.unbonding_on_hold_ref_count !== null) { + message.unbondingOnHoldRefCount = BigInt(object.unbonding_on_hold_ref_count); + } return message; }, toAmino(message: UnbondingDelegationEntry): UnbondingDelegationEntryAmino { const obj: any = {}; obj.creation_height = message.creationHeight !== BigInt(0) ? message.creationHeight?.toString() : undefined; - obj.completion_time = message.completionTime ? Timestamp.toAmino(toTimestamp(message.completionTime)) : undefined; + obj.completion_time = message.completionTime ? Timestamp.toAmino(toTimestamp(message.completionTime)) : new Date(); obj.initial_balance = message.initialBalance === "" ? undefined : message.initialBalance; obj.balance = message.balance === "" ? undefined : message.balance; + obj.unbonding_id = message.unbondingId !== BigInt(0) ? message.unbondingId?.toString() : undefined; + obj.unbonding_on_hold_ref_count = message.unbondingOnHoldRefCount !== BigInt(0) ? message.unbondingOnHoldRefCount?.toString() : undefined; return obj; }, fromAminoMsg(object: UnbondingDelegationEntryAminoMsg): UnbondingDelegationEntry { @@ -2086,7 +2239,9 @@ function createBaseRedelegationEntry(): RedelegationEntry { creationHeight: BigInt(0), completionTime: new Date(), initialBalance: "", - sharesDst: "" + sharesDst: "", + unbondingId: BigInt(0), + unbondingOnHoldRefCount: BigInt(0) }; } export const RedelegationEntry = { @@ -2104,6 +2259,12 @@ export const RedelegationEntry = { if (message.sharesDst !== "") { writer.uint32(34).string(Decimal.fromUserInput(message.sharesDst, 18).atomics); } + if (message.unbondingId !== BigInt(0)) { + writer.uint32(40).uint64(message.unbondingId); + } + if (message.unbondingOnHoldRefCount !== BigInt(0)) { + writer.uint32(48).int64(message.unbondingOnHoldRefCount); + } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): RedelegationEntry { @@ -2125,6 +2286,12 @@ export const RedelegationEntry = { case 4: message.sharesDst = Decimal.fromAtomics(reader.string(), 18).toString(); break; + case 5: + message.unbondingId = reader.uint64(); + break; + case 6: + message.unbondingOnHoldRefCount = reader.int64(); + break; default: reader.skipType(tag & 7); break; @@ -2138,6 +2305,8 @@ export const RedelegationEntry = { message.completionTime = object.completionTime ?? undefined; message.initialBalance = object.initialBalance ?? ""; message.sharesDst = object.sharesDst ?? ""; + message.unbondingId = object.unbondingId !== undefined && object.unbondingId !== null ? BigInt(object.unbondingId.toString()) : BigInt(0); + message.unbondingOnHoldRefCount = object.unbondingOnHoldRefCount !== undefined && object.unbondingOnHoldRefCount !== null ? BigInt(object.unbondingOnHoldRefCount.toString()) : BigInt(0); return message; }, fromAmino(object: RedelegationEntryAmino): RedelegationEntry { @@ -2154,14 +2323,22 @@ export const RedelegationEntry = { if (object.shares_dst !== undefined && object.shares_dst !== null) { message.sharesDst = object.shares_dst; } + if (object.unbonding_id !== undefined && object.unbonding_id !== null) { + message.unbondingId = BigInt(object.unbonding_id); + } + if (object.unbonding_on_hold_ref_count !== undefined && object.unbonding_on_hold_ref_count !== null) { + message.unbondingOnHoldRefCount = BigInt(object.unbonding_on_hold_ref_count); + } return message; }, toAmino(message: RedelegationEntry): RedelegationEntryAmino { const obj: any = {}; obj.creation_height = message.creationHeight !== BigInt(0) ? message.creationHeight?.toString() : undefined; - obj.completion_time = message.completionTime ? Timestamp.toAmino(toTimestamp(message.completionTime)) : undefined; + obj.completion_time = message.completionTime ? Timestamp.toAmino(toTimestamp(message.completionTime)) : new Date(); obj.initial_balance = message.initialBalance === "" ? undefined : message.initialBalance; obj.shares_dst = message.sharesDst === "" ? undefined : message.sharesDst; + obj.unbonding_id = message.unbondingId !== BigInt(0) ? message.unbondingId?.toString() : undefined; + obj.unbonding_on_hold_ref_count = message.unbondingOnHoldRefCount !== BigInt(0) ? message.unbondingOnHoldRefCount?.toString() : undefined; return obj; }, fromAminoMsg(object: RedelegationEntryAminoMsg): RedelegationEntry { @@ -2392,12 +2569,12 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.unbonding_time = message.unbondingTime ? Duration.toAmino(message.unbondingTime) : undefined; + obj.unbonding_time = message.unbondingTime ? Duration.toAmino(message.unbondingTime) : Duration.toAmino(Duration.fromPartial({})); obj.max_validators = message.maxValidators === 0 ? undefined : message.maxValidators; obj.max_entries = message.maxEntries === 0 ? undefined : message.maxEntries; obj.historical_entries = message.historicalEntries === 0 ? undefined : message.historicalEntries; obj.bond_denom = message.bondDenom === "" ? undefined : message.bondDenom; - obj.min_commission_rate = message.minCommissionRate === "" ? undefined : message.minCommissionRate; + obj.min_commission_rate = message.minCommissionRate ?? ""; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { @@ -2405,7 +2582,7 @@ export const Params = { }, toAminoMsg(message: Params): ParamsAminoMsg { return { - type: "cosmos-sdk/Params", + type: "cosmos-sdk/x/staking/Params", value: Params.toAmino(message) }; }, @@ -2477,8 +2654,8 @@ export const DelegationResponse = { }, toAmino(message: DelegationResponse): DelegationResponseAmino { const obj: any = {}; - obj.delegation = message.delegation ? Delegation.toAmino(message.delegation) : undefined; - obj.balance = message.balance ? Coin.toAmino(message.balance) : undefined; + obj.delegation = message.delegation ? Delegation.toAmino(message.delegation) : Delegation.toAmino(Delegation.fromPartial({})); + obj.balance = message.balance ? Coin.toAmino(message.balance) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromAminoMsg(object: DelegationResponseAminoMsg): DelegationResponse { @@ -2558,7 +2735,7 @@ export const RedelegationEntryResponse = { }, toAmino(message: RedelegationEntryResponse): RedelegationEntryResponseAmino { const obj: any = {}; - obj.redelegation_entry = message.redelegationEntry ? RedelegationEntry.toAmino(message.redelegationEntry) : undefined; + obj.redelegation_entry = message.redelegationEntry ? RedelegationEntry.toAmino(message.redelegationEntry) : RedelegationEntry.toAmino(RedelegationEntry.fromPartial({})); obj.balance = message.balance === "" ? undefined : message.balance; return obj; }, @@ -2637,7 +2814,7 @@ export const RedelegationResponse = { }, toAmino(message: RedelegationResponse): RedelegationResponseAmino { const obj: any = {}; - obj.redelegation = message.redelegation ? Redelegation.toAmino(message.redelegation) : undefined; + obj.redelegation = message.redelegation ? Redelegation.toAmino(message.redelegation) : Redelegation.toAmino(Redelegation.fromPartial({})); if (message.entries) { obj.entries = message.entries.map(e => e ? RedelegationEntryResponse.toAmino(e) : undefined); } else { @@ -2748,6 +2925,77 @@ export const Pool = { }; } }; +function createBaseValidatorUpdates(): ValidatorUpdates { + return { + updates: [] + }; +} +export const ValidatorUpdates = { + typeUrl: "/cosmos.staking.v1beta1.ValidatorUpdates", + encode(message: ValidatorUpdates, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.updates) { + ValidatorUpdate.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorUpdates { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorUpdates(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.updates.push(ValidatorUpdate.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): ValidatorUpdates { + const message = createBaseValidatorUpdates(); + message.updates = object.updates?.map(e => ValidatorUpdate.fromPartial(e)) || []; + return message; + }, + fromAmino(object: ValidatorUpdatesAmino): ValidatorUpdates { + const message = createBaseValidatorUpdates(); + message.updates = object.updates?.map(e => ValidatorUpdate.fromAmino(e)) || []; + return message; + }, + toAmino(message: ValidatorUpdates): ValidatorUpdatesAmino { + const obj: any = {}; + if (message.updates) { + obj.updates = message.updates.map(e => e ? ValidatorUpdate.toAmino(e) : undefined); + } else { + obj.updates = message.updates; + } + return obj; + }, + fromAminoMsg(object: ValidatorUpdatesAminoMsg): ValidatorUpdates { + return ValidatorUpdates.fromAmino(object.value); + }, + toAminoMsg(message: ValidatorUpdates): ValidatorUpdatesAminoMsg { + return { + type: "cosmos-sdk/ValidatorUpdates", + value: ValidatorUpdates.toAmino(message) + }; + }, + fromProtoMsg(message: ValidatorUpdatesProtoMsg): ValidatorUpdates { + return ValidatorUpdates.decode(message.value); + }, + toProto(message: ValidatorUpdates): Uint8Array { + return ValidatorUpdates.encode(message).finish(); + }, + toProtoMsg(message: ValidatorUpdates): ValidatorUpdatesProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.ValidatorUpdates", + value: ValidatorUpdates.encode(message).finish() + }; + } +}; export const Cosmos_cryptoPubKey_InterfaceDecoder = (input: BinaryReader | Uint8Array): Any => { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const data = Any.decode(reader, reader.uint32()); diff --git a/packages/api/src/cosmos/staking/v1beta1/tx.amino.ts b/packages/api/src/cosmos/staking/v1beta1/tx.amino.ts index d1dcf5c2..9d017906 100644 --- a/packages/api/src/cosmos/staking/v1beta1/tx.amino.ts +++ b/packages/api/src/cosmos/staking/v1beta1/tx.amino.ts @@ -1,5 +1,5 @@ //@ts-nocheck -import { MsgCreateValidator, MsgEditValidator, MsgDelegate, MsgBeginRedelegate, MsgUndelegate, MsgCancelUnbondingDelegation } from "./tx"; +import { MsgCreateValidator, MsgEditValidator, MsgDelegate, MsgBeginRedelegate, MsgUndelegate, MsgCancelUnbondingDelegation, MsgUpdateParams } from "./tx"; export const AminoConverter = { "/cosmos.staking.v1beta1.MsgCreateValidator": { aminoType: "cosmos-sdk/MsgCreateValidator", @@ -30,5 +30,10 @@ export const AminoConverter = { aminoType: "cosmos-sdk/MsgCancelUnbondingDelegation", toAmino: MsgCancelUnbondingDelegation.toAmino, fromAmino: MsgCancelUnbondingDelegation.fromAmino + }, + "/cosmos.staking.v1beta1.MsgUpdateParams": { + aminoType: "cosmos-sdk/x/staking/MsgUpdateParams", + toAmino: MsgUpdateParams.toAmino, + fromAmino: MsgUpdateParams.fromAmino } }; \ No newline at end of file diff --git a/packages/api/src/cosmos/staking/v1beta1/tx.registry.ts b/packages/api/src/cosmos/staking/v1beta1/tx.registry.ts index 5b679d0e..813c4faf 100644 --- a/packages/api/src/cosmos/staking/v1beta1/tx.registry.ts +++ b/packages/api/src/cosmos/staking/v1beta1/tx.registry.ts @@ -1,7 +1,7 @@ //@ts-nocheck import { GeneratedType, Registry } from "@cosmjs/proto-signing"; -import { MsgCreateValidator, MsgEditValidator, MsgDelegate, MsgBeginRedelegate, MsgUndelegate, MsgCancelUnbondingDelegation } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.staking.v1beta1.MsgCreateValidator", MsgCreateValidator], ["/cosmos.staking.v1beta1.MsgEditValidator", MsgEditValidator], ["/cosmos.staking.v1beta1.MsgDelegate", MsgDelegate], ["/cosmos.staking.v1beta1.MsgBeginRedelegate", MsgBeginRedelegate], ["/cosmos.staking.v1beta1.MsgUndelegate", MsgUndelegate], ["/cosmos.staking.v1beta1.MsgCancelUnbondingDelegation", MsgCancelUnbondingDelegation]]; +import { MsgCreateValidator, MsgEditValidator, MsgDelegate, MsgBeginRedelegate, MsgUndelegate, MsgCancelUnbondingDelegation, MsgUpdateParams } from "./tx"; +export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.staking.v1beta1.MsgCreateValidator", MsgCreateValidator], ["/cosmos.staking.v1beta1.MsgEditValidator", MsgEditValidator], ["/cosmos.staking.v1beta1.MsgDelegate", MsgDelegate], ["/cosmos.staking.v1beta1.MsgBeginRedelegate", MsgBeginRedelegate], ["/cosmos.staking.v1beta1.MsgUndelegate", MsgUndelegate], ["/cosmos.staking.v1beta1.MsgCancelUnbondingDelegation", MsgCancelUnbondingDelegation], ["/cosmos.staking.v1beta1.MsgUpdateParams", MsgUpdateParams]]; export const load = (protoRegistry: Registry) => { registry.forEach(([typeUrl, mod]) => { protoRegistry.register(typeUrl, mod); @@ -44,6 +44,12 @@ export const MessageComposer = { typeUrl: "/cosmos.staking.v1beta1.MsgCancelUnbondingDelegation", value: MsgCancelUnbondingDelegation.encode(value).finish() }; + }, + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgUpdateParams", + value: MsgUpdateParams.encode(value).finish() + }; } }, withTypeUrl: { @@ -82,6 +88,12 @@ export const MessageComposer = { typeUrl: "/cosmos.staking.v1beta1.MsgCancelUnbondingDelegation", value }; + }, + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgUpdateParams", + value + }; } }, fromPartial: { @@ -120,6 +132,12 @@ export const MessageComposer = { typeUrl: "/cosmos.staking.v1beta1.MsgCancelUnbondingDelegation", value: MsgCancelUnbondingDelegation.fromPartial(value) }; + }, + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgUpdateParams", + value: MsgUpdateParams.fromPartial(value) + }; } } }; \ No newline at end of file diff --git a/packages/api/src/cosmos/staking/v1beta1/tx.rpc.msg.ts b/packages/api/src/cosmos/staking/v1beta1/tx.rpc.msg.ts index 62f494a6..424f47bc 100644 --- a/packages/api/src/cosmos/staking/v1beta1/tx.rpc.msg.ts +++ b/packages/api/src/cosmos/staking/v1beta1/tx.rpc.msg.ts @@ -1,7 +1,7 @@ //@ts-nocheck import { Rpc } from "../../../helpers"; import { BinaryReader } from "../../../binary"; -import { MsgCreateValidator, MsgCreateValidatorResponse, MsgEditValidator, MsgEditValidatorResponse, MsgDelegate, MsgDelegateResponse, MsgBeginRedelegate, MsgBeginRedelegateResponse, MsgUndelegate, MsgUndelegateResponse, MsgCancelUnbondingDelegation, MsgCancelUnbondingDelegationResponse } from "./tx"; +import { MsgCreateValidator, MsgCreateValidatorResponse, MsgEditValidator, MsgEditValidatorResponse, MsgDelegate, MsgDelegateResponse, MsgBeginRedelegate, MsgBeginRedelegateResponse, MsgUndelegate, MsgUndelegateResponse, MsgCancelUnbondingDelegation, MsgCancelUnbondingDelegationResponse, MsgUpdateParams, MsgUpdateParamsResponse } from "./tx"; /** Msg defines the staking Msg service. */ export interface Msg { /** CreateValidator defines a method for creating a new validator. */ @@ -26,10 +26,13 @@ export interface Msg { /** * CancelUnbondingDelegation defines a method for performing canceling the unbonding delegation * and delegate back to previous validator. - * - * Since: cosmos-sdk 0.46 */ cancelUnbondingDelegation(request: MsgCancelUnbondingDelegation): Promise; + /** + * UpdateParams defines an operation for updating the x/staking module + * parameters. + */ + updateParams(request: MsgUpdateParams): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: Rpc; @@ -41,6 +44,7 @@ export class MsgClientImpl implements Msg { this.beginRedelegate = this.beginRedelegate.bind(this); this.undelegate = this.undelegate.bind(this); this.cancelUnbondingDelegation = this.cancelUnbondingDelegation.bind(this); + this.updateParams = this.updateParams.bind(this); } createValidator(request: MsgCreateValidator): Promise { const data = MsgCreateValidator.encode(request).finish(); @@ -72,4 +76,9 @@ export class MsgClientImpl implements Msg { const promise = this.rpc.request("cosmos.staking.v1beta1.Msg", "CancelUnbondingDelegation", data); return promise.then(data => MsgCancelUnbondingDelegationResponse.decode(new BinaryReader(data))); } + updateParams(request: MsgUpdateParams): Promise { + const data = MsgUpdateParams.encode(request).finish(); + const promise = this.rpc.request("cosmos.staking.v1beta1.Msg", "UpdateParams", data); + return promise.then(data => MsgUpdateParamsResponse.decode(new BinaryReader(data))); + } } \ No newline at end of file diff --git a/packages/api/src/cosmos/staking/v1beta1/tx.ts b/packages/api/src/cosmos/staking/v1beta1/tx.ts index 9a817a25..27e0c067 100644 --- a/packages/api/src/cosmos/staking/v1beta1/tx.ts +++ b/packages/api/src/cosmos/staking/v1beta1/tx.ts @@ -1,5 +1,5 @@ //@ts-nocheck -import { Description, DescriptionAmino, DescriptionSDKType, CommissionRates, CommissionRatesAmino, CommissionRatesSDKType } from "./staking"; +import { Description, DescriptionAmino, DescriptionSDKType, CommissionRates, CommissionRatesAmino, CommissionRatesSDKType, Params, ParamsAmino, ParamsSDKType } from "./staking"; import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { Timestamp } from "../../../google/protobuf/timestamp"; @@ -13,6 +13,12 @@ export interface MsgCreateValidator { description: Description; commission: CommissionRates; minSelfDelegation: string; + /** + * Deprecated: Use of Delegator Address in MsgCreateValidator is deprecated. + * The validator address bytes and delegator address bytes refer to the same account while creating validator (defer + * only in bech32 notation). + */ + /** @deprecated */ delegatorAddress: string; validatorAddress: string; pubkey?: Any | undefined; @@ -27,13 +33,19 @@ export type MsgCreateValidatorEncoded = Omit & { }; /** MsgCreateValidator defines a SDK message for creating a new validator. */ export interface MsgCreateValidatorAmino { - description?: DescriptionAmino; - commission?: CommissionRatesAmino; - min_self_delegation?: string; + description: DescriptionAmino; + commission: CommissionRatesAmino; + min_self_delegation: string; + /** + * Deprecated: Use of Delegator Address in MsgCreateValidator is deprecated. + * The validator address bytes and delegator address bytes refer to the same account while creating validator (defer + * only in bech32 notation). + */ + /** @deprecated */ delegator_address?: string; validator_address?: string; pubkey?: AnyAmino; - value?: CoinAmino; + value: CoinAmino; } export interface MsgCreateValidatorAminoMsg { type: "cosmos-sdk/MsgCreateValidator"; @@ -44,6 +56,7 @@ export interface MsgCreateValidatorSDKType { description: DescriptionSDKType; commission: CommissionRatesSDKType; min_self_delegation: string; + /** @deprecated */ delegator_address: string; validator_address: string; pubkey?: AnySDKType | undefined; @@ -82,7 +95,7 @@ export interface MsgEditValidatorProtoMsg { } /** MsgEditValidator defines a SDK message for editing an existing validator. */ export interface MsgEditValidatorAmino { - description?: DescriptionAmino; + description: DescriptionAmino; validator_address?: string; /** * We pass a reference to the new commission rate and min self delegation as @@ -138,7 +151,7 @@ export interface MsgDelegateProtoMsg { export interface MsgDelegateAmino { delegator_address?: string; validator_address?: string; - amount?: CoinAmino; + amount: CoinAmino; } export interface MsgDelegateAminoMsg { type: "cosmos-sdk/MsgDelegate"; @@ -189,7 +202,7 @@ export interface MsgBeginRedelegateAmino { delegator_address?: string; validator_src_address?: string; validator_dst_address?: string; - amount?: CoinAmino; + amount: CoinAmino; } export interface MsgBeginRedelegateAminoMsg { type: "cosmos-sdk/MsgBeginRedelegate"; @@ -215,7 +228,7 @@ export interface MsgBeginRedelegateResponseProtoMsg { } /** MsgBeginRedelegateResponse defines the Msg/BeginRedelegate response type. */ export interface MsgBeginRedelegateResponseAmino { - completion_time?: string; + completion_time: string; } export interface MsgBeginRedelegateResponseAminoMsg { type: "cosmos-sdk/MsgBeginRedelegateResponse"; @@ -245,7 +258,7 @@ export interface MsgUndelegateProtoMsg { export interface MsgUndelegateAmino { delegator_address?: string; validator_address?: string; - amount?: CoinAmino; + amount: CoinAmino; } export interface MsgUndelegateAminoMsg { type: "cosmos-sdk/MsgUndelegate"; @@ -263,6 +276,8 @@ export interface MsgUndelegateSDKType { /** MsgUndelegateResponse defines the Msg/Undelegate response type. */ export interface MsgUndelegateResponse { completionTime: Date; + /** amount returns the amount of undelegated coins */ + amount: Coin; } export interface MsgUndelegateResponseProtoMsg { typeUrl: "/cosmos.staking.v1beta1.MsgUndelegateResponse"; @@ -270,7 +285,9 @@ export interface MsgUndelegateResponseProtoMsg { } /** MsgUndelegateResponse defines the Msg/Undelegate response type. */ export interface MsgUndelegateResponseAmino { - completion_time?: string; + completion_time: string; + /** amount returns the amount of undelegated coins */ + amount: CoinAmino; } export interface MsgUndelegateResponseAminoMsg { type: "cosmos-sdk/MsgUndelegateResponse"; @@ -279,12 +296,9 @@ export interface MsgUndelegateResponseAminoMsg { /** MsgUndelegateResponse defines the Msg/Undelegate response type. */ export interface MsgUndelegateResponseSDKType { completion_time: Date; + amount: CoinSDKType; } -/** - * MsgCancelUnbondingDelegation defines the SDK message for performing a cancel unbonding delegation for delegator - * - * Since: cosmos-sdk 0.46 - */ +/** MsgCancelUnbondingDelegation defines the SDK message for performing a cancel unbonding delegation for delegator */ export interface MsgCancelUnbondingDelegation { delegatorAddress: string; validatorAddress: string; @@ -297,16 +311,12 @@ export interface MsgCancelUnbondingDelegationProtoMsg { typeUrl: "/cosmos.staking.v1beta1.MsgCancelUnbondingDelegation"; value: Uint8Array; } -/** - * MsgCancelUnbondingDelegation defines the SDK message for performing a cancel unbonding delegation for delegator - * - * Since: cosmos-sdk 0.46 - */ +/** MsgCancelUnbondingDelegation defines the SDK message for performing a cancel unbonding delegation for delegator */ export interface MsgCancelUnbondingDelegationAmino { delegator_address?: string; validator_address?: string; /** amount is always less than or equal to unbonding delegation entry balance */ - amount?: CoinAmino; + amount: CoinAmino; /** creation_height is the height which the unbonding took place. */ creation_height?: string; } @@ -314,43 +324,85 @@ export interface MsgCancelUnbondingDelegationAminoMsg { type: "cosmos-sdk/MsgCancelUnbondingDelegation"; value: MsgCancelUnbondingDelegationAmino; } -/** - * MsgCancelUnbondingDelegation defines the SDK message for performing a cancel unbonding delegation for delegator - * - * Since: cosmos-sdk 0.46 - */ +/** MsgCancelUnbondingDelegation defines the SDK message for performing a cancel unbonding delegation for delegator */ export interface MsgCancelUnbondingDelegationSDKType { delegator_address: string; validator_address: string; amount: CoinSDKType; creation_height: bigint; } -/** - * MsgCancelUnbondingDelegationResponse - * - * Since: cosmos-sdk 0.46 - */ +/** MsgCancelUnbondingDelegationResponse */ export interface MsgCancelUnbondingDelegationResponse {} export interface MsgCancelUnbondingDelegationResponseProtoMsg { typeUrl: "/cosmos.staking.v1beta1.MsgCancelUnbondingDelegationResponse"; value: Uint8Array; } -/** - * MsgCancelUnbondingDelegationResponse - * - * Since: cosmos-sdk 0.46 - */ +/** MsgCancelUnbondingDelegationResponse */ export interface MsgCancelUnbondingDelegationResponseAmino {} export interface MsgCancelUnbondingDelegationResponseAminoMsg { type: "cosmos-sdk/MsgCancelUnbondingDelegationResponse"; value: MsgCancelUnbondingDelegationResponseAmino; } +/** MsgCancelUnbondingDelegationResponse */ +export interface MsgCancelUnbondingDelegationResponseSDKType {} +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/staking parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params; +} +export interface MsgUpdateParamsProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.MsgUpdateParams"; + value: Uint8Array; +} +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParamsAmino { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority?: string; + /** + * params defines the x/staking parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: ParamsAmino; +} +export interface MsgUpdateParamsAminoMsg { + type: "cosmos-sdk/x/staking/MsgUpdateParams"; + value: MsgUpdateParamsAmino; +} +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParamsSDKType { + authority: string; + params: ParamsSDKType; +} /** - * MsgCancelUnbondingDelegationResponse - * - * Since: cosmos-sdk 0.46 + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. */ -export interface MsgCancelUnbondingDelegationResponseSDKType {} +export interface MsgUpdateParamsResponse {} +export interface MsgUpdateParamsResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.MsgUpdateParamsResponse"; + value: Uint8Array; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponseAmino {} +export interface MsgUpdateParamsResponseAminoMsg { + type: "cosmos-sdk/MsgUpdateParamsResponse"; + value: MsgUpdateParamsResponseAmino; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponseSDKType {} function createBaseMsgCreateValidator(): MsgCreateValidator { return { description: Description.fromPartial({}), @@ -461,13 +513,13 @@ export const MsgCreateValidator = { }, toAmino(message: MsgCreateValidator): MsgCreateValidatorAmino { const obj: any = {}; - obj.description = message.description ? Description.toAmino(message.description) : undefined; - obj.commission = message.commission ? CommissionRates.toAmino(message.commission) : undefined; - obj.min_self_delegation = message.minSelfDelegation === "" ? undefined : message.minSelfDelegation; + obj.description = message.description ? Description.toAmino(message.description) : Description.toAmino(Description.fromPartial({})); + obj.commission = message.commission ? CommissionRates.toAmino(message.commission) : CommissionRates.toAmino(CommissionRates.fromPartial({})); + obj.min_self_delegation = message.minSelfDelegation ?? ""; obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; - obj.value = message.value ? Coin.toAmino(message.value) : undefined; + obj.value = message.value ? Coin.toAmino(message.value) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromAminoMsg(object: MsgCreateValidatorAminoMsg): MsgCreateValidator { @@ -625,7 +677,7 @@ export const MsgEditValidator = { }, toAmino(message: MsgEditValidator): MsgEditValidatorAmino { const obj: any = {}; - obj.description = message.description ? Description.toAmino(message.description) : undefined; + obj.description = message.description ? Description.toAmino(message.description) : Description.toAmino(Description.fromPartial({})); obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; obj.commission_rate = message.commissionRate === "" ? undefined : message.commissionRate; obj.min_self_delegation = message.minSelfDelegation === "" ? undefined : message.minSelfDelegation; @@ -777,7 +829,7 @@ export const MsgDelegate = { const obj: any = {}; obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; - obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; + obj.amount = message.amount ? Coin.toAmino(message.amount) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromAminoMsg(object: MsgDelegateAminoMsg): MsgDelegate { @@ -938,7 +990,7 @@ export const MsgBeginRedelegate = { obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; obj.validator_src_address = message.validatorSrcAddress === "" ? undefined : message.validatorSrcAddress; obj.validator_dst_address = message.validatorDstAddress === "" ? undefined : message.validatorDstAddress; - obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; + obj.amount = message.amount ? Coin.toAmino(message.amount) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromAminoMsg(object: MsgBeginRedelegateAminoMsg): MsgBeginRedelegate { @@ -1007,7 +1059,7 @@ export const MsgBeginRedelegateResponse = { }, toAmino(message: MsgBeginRedelegateResponse): MsgBeginRedelegateResponseAmino { const obj: any = {}; - obj.completion_time = message.completionTime ? Timestamp.toAmino(toTimestamp(message.completionTime)) : undefined; + obj.completion_time = message.completionTime ? Timestamp.toAmino(toTimestamp(message.completionTime)) : new Date(); return obj; }, fromAminoMsg(object: MsgBeginRedelegateResponseAminoMsg): MsgBeginRedelegateResponse { @@ -1100,7 +1152,7 @@ export const MsgUndelegate = { const obj: any = {}; obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; - obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; + obj.amount = message.amount ? Coin.toAmino(message.amount) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromAminoMsg(object: MsgUndelegateAminoMsg): MsgUndelegate { @@ -1127,7 +1179,8 @@ export const MsgUndelegate = { }; function createBaseMsgUndelegateResponse(): MsgUndelegateResponse { return { - completionTime: new Date() + completionTime: new Date(), + amount: Coin.fromPartial({}) }; } export const MsgUndelegateResponse = { @@ -1136,6 +1189,9 @@ export const MsgUndelegateResponse = { if (message.completionTime !== undefined) { Timestamp.encode(toTimestamp(message.completionTime), writer.uint32(10).fork()).ldelim(); } + if (message.amount !== undefined) { + Coin.encode(message.amount, writer.uint32(18).fork()).ldelim(); + } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): MsgUndelegateResponse { @@ -1148,6 +1204,9 @@ export const MsgUndelegateResponse = { case 1: message.completionTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); break; + case 2: + message.amount = Coin.decode(reader, reader.uint32()); + break; default: reader.skipType(tag & 7); break; @@ -1158,6 +1217,7 @@ export const MsgUndelegateResponse = { fromPartial(object: Partial): MsgUndelegateResponse { const message = createBaseMsgUndelegateResponse(); message.completionTime = object.completionTime ?? undefined; + message.amount = object.amount !== undefined && object.amount !== null ? Coin.fromPartial(object.amount) : undefined; return message; }, fromAmino(object: MsgUndelegateResponseAmino): MsgUndelegateResponse { @@ -1165,11 +1225,15 @@ export const MsgUndelegateResponse = { if (object.completion_time !== undefined && object.completion_time !== null) { message.completionTime = fromTimestamp(Timestamp.fromAmino(object.completion_time)); } + if (object.amount !== undefined && object.amount !== null) { + message.amount = Coin.fromAmino(object.amount); + } return message; }, toAmino(message: MsgUndelegateResponse): MsgUndelegateResponseAmino { const obj: any = {}; - obj.completion_time = message.completionTime ? Timestamp.toAmino(toTimestamp(message.completionTime)) : undefined; + obj.completion_time = message.completionTime ? Timestamp.toAmino(toTimestamp(message.completionTime)) : new Date(); + obj.amount = message.amount ? Coin.toAmino(message.amount) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromAminoMsg(object: MsgUndelegateResponseAminoMsg): MsgUndelegateResponse { @@ -1273,7 +1337,7 @@ export const MsgCancelUnbondingDelegation = { const obj: any = {}; obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; - obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; + obj.amount = message.amount ? Coin.toAmino(message.amount) : Coin.toAmino(Coin.fromPartial({})); obj.creation_height = message.creationHeight !== BigInt(0) ? message.creationHeight?.toString() : undefined; return obj; }, @@ -1355,6 +1419,143 @@ export const MsgCancelUnbondingDelegationResponse = { }; } }; +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { + authority: "", + params: Params.fromPartial({}) + }; +} +export const MsgUpdateParams = { + typeUrl: "/cosmos.staking.v1beta1.MsgUpdateParams", + encode(message: MsgUpdateParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + message.authority = object.authority ?? ""; + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, + fromAmino(object: MsgUpdateParamsAmino): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: MsgUpdateParams): MsgUpdateParamsAmino { + const obj: any = {}; + obj.authority = message.authority === "" ? undefined : message.authority; + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); + return obj; + }, + fromAminoMsg(object: MsgUpdateParamsAminoMsg): MsgUpdateParams { + return MsgUpdateParams.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateParams): MsgUpdateParamsAminoMsg { + return { + type: "cosmos-sdk/x/staking/MsgUpdateParams", + value: MsgUpdateParams.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateParamsProtoMsg): MsgUpdateParams { + return MsgUpdateParams.decode(message.value); + }, + toProto(message: MsgUpdateParams): Uint8Array { + return MsgUpdateParams.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateParams): MsgUpdateParamsProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgUpdateParams", + value: MsgUpdateParams.encode(message).finish() + }; + } +}; +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} +export const MsgUpdateParamsResponse = { + typeUrl: "/cosmos.staking.v1beta1.MsgUpdateParamsResponse", + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, + fromAmino(_: MsgUpdateParamsResponseAmino): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, + toAmino(_: MsgUpdateParamsResponse): MsgUpdateParamsResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUpdateParamsResponseAminoMsg): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateParamsResponse): MsgUpdateParamsResponseAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateParamsResponse", + value: MsgUpdateParamsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateParamsResponseProtoMsg): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.decode(message.value); + }, + toProto(message: MsgUpdateParamsResponse): Uint8Array { + return MsgUpdateParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateParamsResponse): MsgUpdateParamsResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgUpdateParamsResponse", + value: MsgUpdateParamsResponse.encode(message).finish() + }; + } +}; export const Cosmos_cryptoPubKey_InterfaceDecoder = (input: BinaryReader | Uint8Array): Any => { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const data = Any.decode(reader, reader.uint32()); diff --git a/packages/api/src/cosmos/store/internal/kv/v1beta1/kv.ts b/packages/api/src/cosmos/store/internal/kv/v1beta1/kv.ts new file mode 100644 index 00000000..40c4b1b8 --- /dev/null +++ b/packages/api/src/cosmos/store/internal/kv/v1beta1/kv.ts @@ -0,0 +1,198 @@ +//@ts-nocheck +import { BinaryReader, BinaryWriter } from "../../../../../binary"; +import { bytesFromBase64, base64FromBytes } from "../../../../../helpers"; +/** Pairs defines a repeated slice of Pair objects. */ +export interface Pairs { + pairs: Pair[]; +} +export interface PairsProtoMsg { + typeUrl: "/cosmos.store.internal.kv.v1beta1.Pairs"; + value: Uint8Array; +} +/** Pairs defines a repeated slice of Pair objects. */ +export interface PairsAmino { + pairs?: PairAmino[]; +} +export interface PairsAminoMsg { + type: "cosmos-sdk/Pairs"; + value: PairsAmino; +} +/** Pairs defines a repeated slice of Pair objects. */ +export interface PairsSDKType { + pairs: PairSDKType[]; +} +/** Pair defines a key/value bytes tuple. */ +export interface Pair { + key: Uint8Array; + value: Uint8Array; +} +export interface PairProtoMsg { + typeUrl: "/cosmos.store.internal.kv.v1beta1.Pair"; + value: Uint8Array; +} +/** Pair defines a key/value bytes tuple. */ +export interface PairAmino { + key?: string; + value?: string; +} +export interface PairAminoMsg { + type: "cosmos-sdk/Pair"; + value: PairAmino; +} +/** Pair defines a key/value bytes tuple. */ +export interface PairSDKType { + key: Uint8Array; + value: Uint8Array; +} +function createBasePairs(): Pairs { + return { + pairs: [] + }; +} +export const Pairs = { + typeUrl: "/cosmos.store.internal.kv.v1beta1.Pairs", + encode(message: Pairs, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.pairs) { + Pair.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Pairs { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePairs(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pairs.push(Pair.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): Pairs { + const message = createBasePairs(); + message.pairs = object.pairs?.map(e => Pair.fromPartial(e)) || []; + return message; + }, + fromAmino(object: PairsAmino): Pairs { + const message = createBasePairs(); + message.pairs = object.pairs?.map(e => Pair.fromAmino(e)) || []; + return message; + }, + toAmino(message: Pairs): PairsAmino { + const obj: any = {}; + if (message.pairs) { + obj.pairs = message.pairs.map(e => e ? Pair.toAmino(e) : undefined); + } else { + obj.pairs = message.pairs; + } + return obj; + }, + fromAminoMsg(object: PairsAminoMsg): Pairs { + return Pairs.fromAmino(object.value); + }, + toAminoMsg(message: Pairs): PairsAminoMsg { + return { + type: "cosmos-sdk/Pairs", + value: Pairs.toAmino(message) + }; + }, + fromProtoMsg(message: PairsProtoMsg): Pairs { + return Pairs.decode(message.value); + }, + toProto(message: Pairs): Uint8Array { + return Pairs.encode(message).finish(); + }, + toProtoMsg(message: Pairs): PairsProtoMsg { + return { + typeUrl: "/cosmos.store.internal.kv.v1beta1.Pairs", + value: Pairs.encode(message).finish() + }; + } +}; +function createBasePair(): Pair { + return { + key: new Uint8Array(), + value: new Uint8Array() + }; +} +export const Pair = { + typeUrl: "/cosmos.store.internal.kv.v1beta1.Pair", + encode(message: Pair, 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): Pair { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePair(); + 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; + }, + fromPartial(object: Partial): Pair { + const message = createBasePair(); + message.key = object.key ?? new Uint8Array(); + message.value = object.value ?? new Uint8Array(); + return message; + }, + fromAmino(object: PairAmino): Pair { + const message = createBasePair(); + if (object.key !== undefined && object.key !== null) { + message.key = bytesFromBase64(object.key); + } + if (object.value !== undefined && object.value !== null) { + message.value = bytesFromBase64(object.value); + } + return message; + }, + toAmino(message: Pair): PairAmino { + const obj: any = {}; + obj.key = message.key ? base64FromBytes(message.key) : undefined; + obj.value = message.value ? base64FromBytes(message.value) : undefined; + return obj; + }, + fromAminoMsg(object: PairAminoMsg): Pair { + return Pair.fromAmino(object.value); + }, + toAminoMsg(message: Pair): PairAminoMsg { + return { + type: "cosmos-sdk/Pair", + value: Pair.toAmino(message) + }; + }, + fromProtoMsg(message: PairProtoMsg): Pair { + return Pair.decode(message.value); + }, + toProto(message: Pair): Uint8Array { + return Pair.encode(message).finish(); + }, + toProtoMsg(message: Pair): PairProtoMsg { + return { + typeUrl: "/cosmos.store.internal.kv.v1beta1.Pair", + value: Pair.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/store/snapshots/v1/snapshot.ts b/packages/api/src/cosmos/store/snapshots/v1/snapshot.ts new file mode 100644 index 00000000..b39d9dbb --- /dev/null +++ b/packages/api/src/cosmos/store/snapshots/v1/snapshot.ts @@ -0,0 +1,799 @@ +//@ts-nocheck +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { bytesFromBase64, base64FromBytes } from "../../../../helpers"; +/** Snapshot contains Tendermint state sync snapshot info. */ +export interface Snapshot { + height: bigint; + format: number; + chunks: number; + hash: Uint8Array; + metadata: Metadata; +} +export interface SnapshotProtoMsg { + typeUrl: "/cosmos.store.snapshots.v1.Snapshot"; + value: Uint8Array; +} +/** Snapshot contains Tendermint state sync snapshot info. */ +export interface SnapshotAmino { + height?: string; + format?: number; + chunks?: number; + hash?: string; + metadata?: MetadataAmino; +} +export interface SnapshotAminoMsg { + type: "cosmos-sdk/Snapshot"; + value: SnapshotAmino; +} +/** Snapshot contains Tendermint state sync snapshot info. */ +export interface SnapshotSDKType { + height: bigint; + format: number; + chunks: number; + hash: Uint8Array; + metadata: MetadataSDKType; +} +/** Metadata contains SDK-specific snapshot metadata. */ +export interface Metadata { + /** SHA-256 chunk hashes */ + chunkHashes: Uint8Array[]; +} +export interface MetadataProtoMsg { + typeUrl: "/cosmos.store.snapshots.v1.Metadata"; + value: Uint8Array; +} +/** Metadata contains SDK-specific snapshot metadata. */ +export interface MetadataAmino { + /** SHA-256 chunk hashes */ + chunk_hashes?: string[]; +} +export interface MetadataAminoMsg { + type: "cosmos-sdk/Metadata"; + value: MetadataAmino; +} +/** Metadata contains SDK-specific snapshot metadata. */ +export interface MetadataSDKType { + chunk_hashes: Uint8Array[]; +} +/** SnapshotItem is an item contained in a rootmulti.Store snapshot. */ +export interface SnapshotItem { + store?: SnapshotStoreItem; + iavl?: SnapshotIAVLItem; + extension?: SnapshotExtensionMeta; + extensionPayload?: SnapshotExtensionPayload; +} +export interface SnapshotItemProtoMsg { + typeUrl: "/cosmos.store.snapshots.v1.SnapshotItem"; + value: Uint8Array; +} +/** SnapshotItem is an item contained in a rootmulti.Store snapshot. */ +export interface SnapshotItemAmino { + store?: SnapshotStoreItemAmino; + iavl?: SnapshotIAVLItemAmino; + extension?: SnapshotExtensionMetaAmino; + extension_payload?: SnapshotExtensionPayloadAmino; +} +export interface SnapshotItemAminoMsg { + type: "cosmos-sdk/SnapshotItem"; + value: SnapshotItemAmino; +} +/** SnapshotItem is an item contained in a rootmulti.Store snapshot. */ +export interface SnapshotItemSDKType { + store?: SnapshotStoreItemSDKType; + iavl?: SnapshotIAVLItemSDKType; + extension?: SnapshotExtensionMetaSDKType; + extension_payload?: SnapshotExtensionPayloadSDKType; +} +/** SnapshotStoreItem contains metadata about a snapshotted store. */ +export interface SnapshotStoreItem { + name: string; +} +export interface SnapshotStoreItemProtoMsg { + typeUrl: "/cosmos.store.snapshots.v1.SnapshotStoreItem"; + value: Uint8Array; +} +/** SnapshotStoreItem contains metadata about a snapshotted store. */ +export interface SnapshotStoreItemAmino { + name?: string; +} +export interface SnapshotStoreItemAminoMsg { + type: "cosmos-sdk/SnapshotStoreItem"; + value: SnapshotStoreItemAmino; +} +/** SnapshotStoreItem contains metadata about a snapshotted store. */ +export interface SnapshotStoreItemSDKType { + name: string; +} +/** SnapshotIAVLItem is an exported IAVL node. */ +export interface SnapshotIAVLItem { + key: Uint8Array; + value: Uint8Array; + /** version is block height */ + version: bigint; + /** height is depth of the tree. */ + height: number; +} +export interface SnapshotIAVLItemProtoMsg { + typeUrl: "/cosmos.store.snapshots.v1.SnapshotIAVLItem"; + value: Uint8Array; +} +/** SnapshotIAVLItem is an exported IAVL node. */ +export interface SnapshotIAVLItemAmino { + key?: string; + value?: string; + /** version is block height */ + version?: string; + /** height is depth of the tree. */ + height?: number; +} +export interface SnapshotIAVLItemAminoMsg { + type: "cosmos-sdk/SnapshotIAVLItem"; + value: SnapshotIAVLItemAmino; +} +/** SnapshotIAVLItem is an exported IAVL node. */ +export interface SnapshotIAVLItemSDKType { + key: Uint8Array; + value: Uint8Array; + version: bigint; + height: number; +} +/** SnapshotExtensionMeta contains metadata about an external snapshotter. */ +export interface SnapshotExtensionMeta { + name: string; + format: number; +} +export interface SnapshotExtensionMetaProtoMsg { + typeUrl: "/cosmos.store.snapshots.v1.SnapshotExtensionMeta"; + value: Uint8Array; +} +/** SnapshotExtensionMeta contains metadata about an external snapshotter. */ +export interface SnapshotExtensionMetaAmino { + name?: string; + format?: number; +} +export interface SnapshotExtensionMetaAminoMsg { + type: "cosmos-sdk/SnapshotExtensionMeta"; + value: SnapshotExtensionMetaAmino; +} +/** SnapshotExtensionMeta contains metadata about an external snapshotter. */ +export interface SnapshotExtensionMetaSDKType { + name: string; + format: number; +} +/** SnapshotExtensionPayload contains payloads of an external snapshotter. */ +export interface SnapshotExtensionPayload { + payload: Uint8Array; +} +export interface SnapshotExtensionPayloadProtoMsg { + typeUrl: "/cosmos.store.snapshots.v1.SnapshotExtensionPayload"; + value: Uint8Array; +} +/** SnapshotExtensionPayload contains payloads of an external snapshotter. */ +export interface SnapshotExtensionPayloadAmino { + payload?: string; +} +export interface SnapshotExtensionPayloadAminoMsg { + type: "cosmos-sdk/SnapshotExtensionPayload"; + value: SnapshotExtensionPayloadAmino; +} +/** SnapshotExtensionPayload contains payloads of an external snapshotter. */ +export interface SnapshotExtensionPayloadSDKType { + payload: Uint8Array; +} +function createBaseSnapshot(): Snapshot { + return { + height: BigInt(0), + format: 0, + chunks: 0, + hash: new Uint8Array(), + metadata: Metadata.fromPartial({}) + }; +} +export const Snapshot = { + typeUrl: "/cosmos.store.snapshots.v1.Snapshot", + encode(message: Snapshot, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.height !== BigInt(0)) { + writer.uint32(8).uint64(message.height); + } + if (message.format !== 0) { + writer.uint32(16).uint32(message.format); + } + if (message.chunks !== 0) { + writer.uint32(24).uint32(message.chunks); + } + if (message.hash.length !== 0) { + writer.uint32(34).bytes(message.hash); + } + if (message.metadata !== undefined) { + Metadata.encode(message.metadata, writer.uint32(42).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Snapshot { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSnapshot(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = reader.uint64(); + break; + case 2: + message.format = reader.uint32(); + break; + case 3: + message.chunks = reader.uint32(); + break; + case 4: + message.hash = reader.bytes(); + break; + case 5: + message.metadata = Metadata.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): Snapshot { + const message = createBaseSnapshot(); + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + message.format = object.format ?? 0; + message.chunks = object.chunks ?? 0; + message.hash = object.hash ?? new Uint8Array(); + message.metadata = object.metadata !== undefined && object.metadata !== null ? Metadata.fromPartial(object.metadata) : undefined; + return message; + }, + fromAmino(object: SnapshotAmino): Snapshot { + const message = createBaseSnapshot(); + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.format !== undefined && object.format !== null) { + message.format = object.format; + } + if (object.chunks !== undefined && object.chunks !== null) { + message.chunks = object.chunks; + } + if (object.hash !== undefined && object.hash !== null) { + message.hash = bytesFromBase64(object.hash); + } + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = Metadata.fromAmino(object.metadata); + } + return message; + }, + toAmino(message: Snapshot): SnapshotAmino { + const obj: any = {}; + obj.height = message.height !== BigInt(0) ? message.height?.toString() : undefined; + obj.format = message.format === 0 ? undefined : message.format; + obj.chunks = message.chunks === 0 ? undefined : message.chunks; + obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; + obj.metadata = message.metadata ? Metadata.toAmino(message.metadata) : undefined; + return obj; + }, + fromAminoMsg(object: SnapshotAminoMsg): Snapshot { + return Snapshot.fromAmino(object.value); + }, + toAminoMsg(message: Snapshot): SnapshotAminoMsg { + return { + type: "cosmos-sdk/Snapshot", + value: Snapshot.toAmino(message) + }; + }, + fromProtoMsg(message: SnapshotProtoMsg): Snapshot { + return Snapshot.decode(message.value); + }, + toProto(message: Snapshot): Uint8Array { + return Snapshot.encode(message).finish(); + }, + toProtoMsg(message: Snapshot): SnapshotProtoMsg { + return { + typeUrl: "/cosmos.store.snapshots.v1.Snapshot", + value: Snapshot.encode(message).finish() + }; + } +}; +function createBaseMetadata(): Metadata { + return { + chunkHashes: [] + }; +} +export const Metadata = { + typeUrl: "/cosmos.store.snapshots.v1.Metadata", + encode(message: Metadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.chunkHashes) { + writer.uint32(10).bytes(v!); + } + 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.chunkHashes.push(reader.bytes()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): Metadata { + const message = createBaseMetadata(); + message.chunkHashes = object.chunkHashes?.map(e => e) || []; + return message; + }, + fromAmino(object: MetadataAmino): Metadata { + const message = createBaseMetadata(); + message.chunkHashes = object.chunk_hashes?.map(e => bytesFromBase64(e)) || []; + return message; + }, + toAmino(message: Metadata): MetadataAmino { + const obj: any = {}; + if (message.chunkHashes) { + obj.chunk_hashes = message.chunkHashes.map(e => base64FromBytes(e)); + } else { + obj.chunk_hashes = message.chunkHashes; + } + return obj; + }, + fromAminoMsg(object: MetadataAminoMsg): Metadata { + return Metadata.fromAmino(object.value); + }, + toAminoMsg(message: Metadata): MetadataAminoMsg { + return { + type: "cosmos-sdk/Metadata", + value: Metadata.toAmino(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: "/cosmos.store.snapshots.v1.Metadata", + value: Metadata.encode(message).finish() + }; + } +}; +function createBaseSnapshotItem(): SnapshotItem { + return { + store: undefined, + iavl: undefined, + extension: undefined, + extensionPayload: undefined + }; +} +export const SnapshotItem = { + typeUrl: "/cosmos.store.snapshots.v1.SnapshotItem", + encode(message: SnapshotItem, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.store !== undefined) { + SnapshotStoreItem.encode(message.store, writer.uint32(10).fork()).ldelim(); + } + if (message.iavl !== undefined) { + SnapshotIAVLItem.encode(message.iavl, writer.uint32(18).fork()).ldelim(); + } + if (message.extension !== undefined) { + SnapshotExtensionMeta.encode(message.extension, writer.uint32(26).fork()).ldelim(); + } + if (message.extensionPayload !== undefined) { + SnapshotExtensionPayload.encode(message.extensionPayload, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SnapshotItem { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSnapshotItem(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.store = SnapshotStoreItem.decode(reader, reader.uint32()); + break; + case 2: + message.iavl = SnapshotIAVLItem.decode(reader, reader.uint32()); + break; + case 3: + message.extension = SnapshotExtensionMeta.decode(reader, reader.uint32()); + break; + case 4: + message.extensionPayload = SnapshotExtensionPayload.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): SnapshotItem { + const message = createBaseSnapshotItem(); + message.store = object.store !== undefined && object.store !== null ? SnapshotStoreItem.fromPartial(object.store) : undefined; + message.iavl = object.iavl !== undefined && object.iavl !== null ? SnapshotIAVLItem.fromPartial(object.iavl) : undefined; + message.extension = object.extension !== undefined && object.extension !== null ? SnapshotExtensionMeta.fromPartial(object.extension) : undefined; + message.extensionPayload = object.extensionPayload !== undefined && object.extensionPayload !== null ? SnapshotExtensionPayload.fromPartial(object.extensionPayload) : undefined; + return message; + }, + fromAmino(object: SnapshotItemAmino): SnapshotItem { + const message = createBaseSnapshotItem(); + if (object.store !== undefined && object.store !== null) { + message.store = SnapshotStoreItem.fromAmino(object.store); + } + if (object.iavl !== undefined && object.iavl !== null) { + message.iavl = SnapshotIAVLItem.fromAmino(object.iavl); + } + if (object.extension !== undefined && object.extension !== null) { + message.extension = SnapshotExtensionMeta.fromAmino(object.extension); + } + if (object.extension_payload !== undefined && object.extension_payload !== null) { + message.extensionPayload = SnapshotExtensionPayload.fromAmino(object.extension_payload); + } + return message; + }, + toAmino(message: SnapshotItem): SnapshotItemAmino { + const obj: any = {}; + obj.store = message.store ? SnapshotStoreItem.toAmino(message.store) : undefined; + obj.iavl = message.iavl ? SnapshotIAVLItem.toAmino(message.iavl) : undefined; + obj.extension = message.extension ? SnapshotExtensionMeta.toAmino(message.extension) : undefined; + obj.extension_payload = message.extensionPayload ? SnapshotExtensionPayload.toAmino(message.extensionPayload) : undefined; + return obj; + }, + fromAminoMsg(object: SnapshotItemAminoMsg): SnapshotItem { + return SnapshotItem.fromAmino(object.value); + }, + toAminoMsg(message: SnapshotItem): SnapshotItemAminoMsg { + return { + type: "cosmos-sdk/SnapshotItem", + value: SnapshotItem.toAmino(message) + }; + }, + fromProtoMsg(message: SnapshotItemProtoMsg): SnapshotItem { + return SnapshotItem.decode(message.value); + }, + toProto(message: SnapshotItem): Uint8Array { + return SnapshotItem.encode(message).finish(); + }, + toProtoMsg(message: SnapshotItem): SnapshotItemProtoMsg { + return { + typeUrl: "/cosmos.store.snapshots.v1.SnapshotItem", + value: SnapshotItem.encode(message).finish() + }; + } +}; +function createBaseSnapshotStoreItem(): SnapshotStoreItem { + return { + name: "" + }; +} +export const SnapshotStoreItem = { + typeUrl: "/cosmos.store.snapshots.v1.SnapshotStoreItem", + encode(message: SnapshotStoreItem, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SnapshotStoreItem { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSnapshotStoreItem(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): SnapshotStoreItem { + const message = createBaseSnapshotStoreItem(); + message.name = object.name ?? ""; + return message; + }, + fromAmino(object: SnapshotStoreItemAmino): SnapshotStoreItem { + const message = createBaseSnapshotStoreItem(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + return message; + }, + toAmino(message: SnapshotStoreItem): SnapshotStoreItemAmino { + const obj: any = {}; + obj.name = message.name === "" ? undefined : message.name; + return obj; + }, + fromAminoMsg(object: SnapshotStoreItemAminoMsg): SnapshotStoreItem { + return SnapshotStoreItem.fromAmino(object.value); + }, + toAminoMsg(message: SnapshotStoreItem): SnapshotStoreItemAminoMsg { + return { + type: "cosmos-sdk/SnapshotStoreItem", + value: SnapshotStoreItem.toAmino(message) + }; + }, + fromProtoMsg(message: SnapshotStoreItemProtoMsg): SnapshotStoreItem { + return SnapshotStoreItem.decode(message.value); + }, + toProto(message: SnapshotStoreItem): Uint8Array { + return SnapshotStoreItem.encode(message).finish(); + }, + toProtoMsg(message: SnapshotStoreItem): SnapshotStoreItemProtoMsg { + return { + typeUrl: "/cosmos.store.snapshots.v1.SnapshotStoreItem", + value: SnapshotStoreItem.encode(message).finish() + }; + } +}; +function createBaseSnapshotIAVLItem(): SnapshotIAVLItem { + return { + key: new Uint8Array(), + value: new Uint8Array(), + version: BigInt(0), + height: 0 + }; +} +export const SnapshotIAVLItem = { + typeUrl: "/cosmos.store.snapshots.v1.SnapshotIAVLItem", + encode(message: SnapshotIAVLItem, 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.version !== BigInt(0)) { + writer.uint32(24).int64(message.version); + } + if (message.height !== 0) { + writer.uint32(32).int32(message.height); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SnapshotIAVLItem { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSnapshotIAVLItem(); + 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.version = reader.int64(); + break; + case 4: + message.height = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): SnapshotIAVLItem { + const message = createBaseSnapshotIAVLItem(); + message.key = object.key ?? new Uint8Array(); + message.value = object.value ?? new Uint8Array(); + message.version = object.version !== undefined && object.version !== null ? BigInt(object.version.toString()) : BigInt(0); + message.height = object.height ?? 0; + return message; + }, + fromAmino(object: SnapshotIAVLItemAmino): SnapshotIAVLItem { + const message = createBaseSnapshotIAVLItem(); + if (object.key !== undefined && object.key !== null) { + message.key = bytesFromBase64(object.key); + } + if (object.value !== undefined && object.value !== null) { + message.value = bytesFromBase64(object.value); + } + if (object.version !== undefined && object.version !== null) { + message.version = BigInt(object.version); + } + if (object.height !== undefined && object.height !== null) { + message.height = object.height; + } + return message; + }, + toAmino(message: SnapshotIAVLItem): SnapshotIAVLItemAmino { + const obj: any = {}; + obj.key = message.key ? base64FromBytes(message.key) : undefined; + obj.value = message.value ? base64FromBytes(message.value) : undefined; + obj.version = message.version !== BigInt(0) ? message.version?.toString() : undefined; + obj.height = message.height === 0 ? undefined : message.height; + return obj; + }, + fromAminoMsg(object: SnapshotIAVLItemAminoMsg): SnapshotIAVLItem { + return SnapshotIAVLItem.fromAmino(object.value); + }, + toAminoMsg(message: SnapshotIAVLItem): SnapshotIAVLItemAminoMsg { + return { + type: "cosmos-sdk/SnapshotIAVLItem", + value: SnapshotIAVLItem.toAmino(message) + }; + }, + fromProtoMsg(message: SnapshotIAVLItemProtoMsg): SnapshotIAVLItem { + return SnapshotIAVLItem.decode(message.value); + }, + toProto(message: SnapshotIAVLItem): Uint8Array { + return SnapshotIAVLItem.encode(message).finish(); + }, + toProtoMsg(message: SnapshotIAVLItem): SnapshotIAVLItemProtoMsg { + return { + typeUrl: "/cosmos.store.snapshots.v1.SnapshotIAVLItem", + value: SnapshotIAVLItem.encode(message).finish() + }; + } +}; +function createBaseSnapshotExtensionMeta(): SnapshotExtensionMeta { + return { + name: "", + format: 0 + }; +} +export const SnapshotExtensionMeta = { + typeUrl: "/cosmos.store.snapshots.v1.SnapshotExtensionMeta", + encode(message: SnapshotExtensionMeta, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.format !== 0) { + writer.uint32(16).uint32(message.format); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SnapshotExtensionMeta { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSnapshotExtensionMeta(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.format = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): SnapshotExtensionMeta { + const message = createBaseSnapshotExtensionMeta(); + message.name = object.name ?? ""; + message.format = object.format ?? 0; + return message; + }, + fromAmino(object: SnapshotExtensionMetaAmino): SnapshotExtensionMeta { + const message = createBaseSnapshotExtensionMeta(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + if (object.format !== undefined && object.format !== null) { + message.format = object.format; + } + return message; + }, + toAmino(message: SnapshotExtensionMeta): SnapshotExtensionMetaAmino { + const obj: any = {}; + obj.name = message.name === "" ? undefined : message.name; + obj.format = message.format === 0 ? undefined : message.format; + return obj; + }, + fromAminoMsg(object: SnapshotExtensionMetaAminoMsg): SnapshotExtensionMeta { + return SnapshotExtensionMeta.fromAmino(object.value); + }, + toAminoMsg(message: SnapshotExtensionMeta): SnapshotExtensionMetaAminoMsg { + return { + type: "cosmos-sdk/SnapshotExtensionMeta", + value: SnapshotExtensionMeta.toAmino(message) + }; + }, + fromProtoMsg(message: SnapshotExtensionMetaProtoMsg): SnapshotExtensionMeta { + return SnapshotExtensionMeta.decode(message.value); + }, + toProto(message: SnapshotExtensionMeta): Uint8Array { + return SnapshotExtensionMeta.encode(message).finish(); + }, + toProtoMsg(message: SnapshotExtensionMeta): SnapshotExtensionMetaProtoMsg { + return { + typeUrl: "/cosmos.store.snapshots.v1.SnapshotExtensionMeta", + value: SnapshotExtensionMeta.encode(message).finish() + }; + } +}; +function createBaseSnapshotExtensionPayload(): SnapshotExtensionPayload { + return { + payload: new Uint8Array() + }; +} +export const SnapshotExtensionPayload = { + typeUrl: "/cosmos.store.snapshots.v1.SnapshotExtensionPayload", + encode(message: SnapshotExtensionPayload, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.payload.length !== 0) { + writer.uint32(10).bytes(message.payload); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SnapshotExtensionPayload { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSnapshotExtensionPayload(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.payload = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): SnapshotExtensionPayload { + const message = createBaseSnapshotExtensionPayload(); + message.payload = object.payload ?? new Uint8Array(); + return message; + }, + fromAmino(object: SnapshotExtensionPayloadAmino): SnapshotExtensionPayload { + const message = createBaseSnapshotExtensionPayload(); + if (object.payload !== undefined && object.payload !== null) { + message.payload = bytesFromBase64(object.payload); + } + return message; + }, + toAmino(message: SnapshotExtensionPayload): SnapshotExtensionPayloadAmino { + const obj: any = {}; + obj.payload = message.payload ? base64FromBytes(message.payload) : undefined; + return obj; + }, + fromAminoMsg(object: SnapshotExtensionPayloadAminoMsg): SnapshotExtensionPayload { + return SnapshotExtensionPayload.fromAmino(object.value); + }, + toAminoMsg(message: SnapshotExtensionPayload): SnapshotExtensionPayloadAminoMsg { + return { + type: "cosmos-sdk/SnapshotExtensionPayload", + value: SnapshotExtensionPayload.toAmino(message) + }; + }, + fromProtoMsg(message: SnapshotExtensionPayloadProtoMsg): SnapshotExtensionPayload { + return SnapshotExtensionPayload.decode(message.value); + }, + toProto(message: SnapshotExtensionPayload): Uint8Array { + return SnapshotExtensionPayload.encode(message).finish(); + }, + toProtoMsg(message: SnapshotExtensionPayload): SnapshotExtensionPayloadProtoMsg { + return { + typeUrl: "/cosmos.store.snapshots.v1.SnapshotExtensionPayload", + value: SnapshotExtensionPayload.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/store/streaming/abci/grpc.ts b/packages/api/src/cosmos/store/streaming/abci/grpc.ts new file mode 100644 index 00000000..a93d1550 --- /dev/null +++ b/packages/api/src/cosmos/store/streaming/abci/grpc.ts @@ -0,0 +1,371 @@ +//@ts-nocheck +import { RequestFinalizeBlock, RequestFinalizeBlockAmino, RequestFinalizeBlockSDKType, ResponseFinalizeBlock, ResponseFinalizeBlockAmino, ResponseFinalizeBlockSDKType, ResponseCommit, ResponseCommitAmino, ResponseCommitSDKType } from "../../../../tendermint/abci/types"; +import { StoreKVPair, StoreKVPairAmino, StoreKVPairSDKType } from "../../v1beta1/listening"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +/** ListenEndBlockRequest is the request type for the ListenEndBlock RPC method */ +export interface ListenFinalizeBlockRequest { + req?: RequestFinalizeBlock; + res?: ResponseFinalizeBlock; +} +export interface ListenFinalizeBlockRequestProtoMsg { + typeUrl: "/cosmos.store.streaming.abci.ListenFinalizeBlockRequest"; + value: Uint8Array; +} +/** ListenEndBlockRequest is the request type for the ListenEndBlock RPC method */ +export interface ListenFinalizeBlockRequestAmino { + req?: RequestFinalizeBlockAmino; + res?: ResponseFinalizeBlockAmino; +} +export interface ListenFinalizeBlockRequestAminoMsg { + type: "cosmos-sdk/ListenFinalizeBlockRequest"; + value: ListenFinalizeBlockRequestAmino; +} +/** ListenEndBlockRequest is the request type for the ListenEndBlock RPC method */ +export interface ListenFinalizeBlockRequestSDKType { + req?: RequestFinalizeBlockSDKType; + res?: ResponseFinalizeBlockSDKType; +} +/** ListenEndBlockResponse is the response type for the ListenEndBlock RPC method */ +export interface ListenFinalizeBlockResponse {} +export interface ListenFinalizeBlockResponseProtoMsg { + typeUrl: "/cosmos.store.streaming.abci.ListenFinalizeBlockResponse"; + value: Uint8Array; +} +/** ListenEndBlockResponse is the response type for the ListenEndBlock RPC method */ +export interface ListenFinalizeBlockResponseAmino {} +export interface ListenFinalizeBlockResponseAminoMsg { + type: "cosmos-sdk/ListenFinalizeBlockResponse"; + value: ListenFinalizeBlockResponseAmino; +} +/** ListenEndBlockResponse is the response type for the ListenEndBlock RPC method */ +export interface ListenFinalizeBlockResponseSDKType {} +/** ListenCommitRequest is the request type for the ListenCommit RPC method */ +export interface ListenCommitRequest { + /** explicitly pass in block height as ResponseCommit does not contain this info */ + blockHeight: bigint; + res?: ResponseCommit; + changeSet: StoreKVPair[]; +} +export interface ListenCommitRequestProtoMsg { + typeUrl: "/cosmos.store.streaming.abci.ListenCommitRequest"; + value: Uint8Array; +} +/** ListenCommitRequest is the request type for the ListenCommit RPC method */ +export interface ListenCommitRequestAmino { + /** explicitly pass in block height as ResponseCommit does not contain this info */ + block_height?: string; + res?: ResponseCommitAmino; + change_set?: StoreKVPairAmino[]; +} +export interface ListenCommitRequestAminoMsg { + type: "cosmos-sdk/ListenCommitRequest"; + value: ListenCommitRequestAmino; +} +/** ListenCommitRequest is the request type for the ListenCommit RPC method */ +export interface ListenCommitRequestSDKType { + block_height: bigint; + res?: ResponseCommitSDKType; + change_set: StoreKVPairSDKType[]; +} +/** ListenCommitResponse is the response type for the ListenCommit RPC method */ +export interface ListenCommitResponse {} +export interface ListenCommitResponseProtoMsg { + typeUrl: "/cosmos.store.streaming.abci.ListenCommitResponse"; + value: Uint8Array; +} +/** ListenCommitResponse is the response type for the ListenCommit RPC method */ +export interface ListenCommitResponseAmino {} +export interface ListenCommitResponseAminoMsg { + type: "cosmos-sdk/ListenCommitResponse"; + value: ListenCommitResponseAmino; +} +/** ListenCommitResponse is the response type for the ListenCommit RPC method */ +export interface ListenCommitResponseSDKType {} +function createBaseListenFinalizeBlockRequest(): ListenFinalizeBlockRequest { + return { + req: undefined, + res: undefined + }; +} +export const ListenFinalizeBlockRequest = { + typeUrl: "/cosmos.store.streaming.abci.ListenFinalizeBlockRequest", + encode(message: ListenFinalizeBlockRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.req !== undefined) { + RequestFinalizeBlock.encode(message.req, writer.uint32(10).fork()).ldelim(); + } + if (message.res !== undefined) { + ResponseFinalizeBlock.encode(message.res, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ListenFinalizeBlockRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListenFinalizeBlockRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.req = RequestFinalizeBlock.decode(reader, reader.uint32()); + break; + case 2: + message.res = ResponseFinalizeBlock.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): ListenFinalizeBlockRequest { + const message = createBaseListenFinalizeBlockRequest(); + message.req = object.req !== undefined && object.req !== null ? RequestFinalizeBlock.fromPartial(object.req) : undefined; + message.res = object.res !== undefined && object.res !== null ? ResponseFinalizeBlock.fromPartial(object.res) : undefined; + return message; + }, + fromAmino(object: ListenFinalizeBlockRequestAmino): ListenFinalizeBlockRequest { + const message = createBaseListenFinalizeBlockRequest(); + if (object.req !== undefined && object.req !== null) { + message.req = RequestFinalizeBlock.fromAmino(object.req); + } + if (object.res !== undefined && object.res !== null) { + message.res = ResponseFinalizeBlock.fromAmino(object.res); + } + return message; + }, + toAmino(message: ListenFinalizeBlockRequest): ListenFinalizeBlockRequestAmino { + const obj: any = {}; + obj.req = message.req ? RequestFinalizeBlock.toAmino(message.req) : undefined; + obj.res = message.res ? ResponseFinalizeBlock.toAmino(message.res) : undefined; + return obj; + }, + fromAminoMsg(object: ListenFinalizeBlockRequestAminoMsg): ListenFinalizeBlockRequest { + return ListenFinalizeBlockRequest.fromAmino(object.value); + }, + toAminoMsg(message: ListenFinalizeBlockRequest): ListenFinalizeBlockRequestAminoMsg { + return { + type: "cosmos-sdk/ListenFinalizeBlockRequest", + value: ListenFinalizeBlockRequest.toAmino(message) + }; + }, + fromProtoMsg(message: ListenFinalizeBlockRequestProtoMsg): ListenFinalizeBlockRequest { + return ListenFinalizeBlockRequest.decode(message.value); + }, + toProto(message: ListenFinalizeBlockRequest): Uint8Array { + return ListenFinalizeBlockRequest.encode(message).finish(); + }, + toProtoMsg(message: ListenFinalizeBlockRequest): ListenFinalizeBlockRequestProtoMsg { + return { + typeUrl: "/cosmos.store.streaming.abci.ListenFinalizeBlockRequest", + value: ListenFinalizeBlockRequest.encode(message).finish() + }; + } +}; +function createBaseListenFinalizeBlockResponse(): ListenFinalizeBlockResponse { + return {}; +} +export const ListenFinalizeBlockResponse = { + typeUrl: "/cosmos.store.streaming.abci.ListenFinalizeBlockResponse", + encode(_: ListenFinalizeBlockResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ListenFinalizeBlockResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListenFinalizeBlockResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): ListenFinalizeBlockResponse { + const message = createBaseListenFinalizeBlockResponse(); + return message; + }, + fromAmino(_: ListenFinalizeBlockResponseAmino): ListenFinalizeBlockResponse { + const message = createBaseListenFinalizeBlockResponse(); + return message; + }, + toAmino(_: ListenFinalizeBlockResponse): ListenFinalizeBlockResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: ListenFinalizeBlockResponseAminoMsg): ListenFinalizeBlockResponse { + return ListenFinalizeBlockResponse.fromAmino(object.value); + }, + toAminoMsg(message: ListenFinalizeBlockResponse): ListenFinalizeBlockResponseAminoMsg { + return { + type: "cosmos-sdk/ListenFinalizeBlockResponse", + value: ListenFinalizeBlockResponse.toAmino(message) + }; + }, + fromProtoMsg(message: ListenFinalizeBlockResponseProtoMsg): ListenFinalizeBlockResponse { + return ListenFinalizeBlockResponse.decode(message.value); + }, + toProto(message: ListenFinalizeBlockResponse): Uint8Array { + return ListenFinalizeBlockResponse.encode(message).finish(); + }, + toProtoMsg(message: ListenFinalizeBlockResponse): ListenFinalizeBlockResponseProtoMsg { + return { + typeUrl: "/cosmos.store.streaming.abci.ListenFinalizeBlockResponse", + value: ListenFinalizeBlockResponse.encode(message).finish() + }; + } +}; +function createBaseListenCommitRequest(): ListenCommitRequest { + return { + blockHeight: BigInt(0), + res: undefined, + changeSet: [] + }; +} +export const ListenCommitRequest = { + typeUrl: "/cosmos.store.streaming.abci.ListenCommitRequest", + encode(message: ListenCommitRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.blockHeight !== BigInt(0)) { + writer.uint32(8).int64(message.blockHeight); + } + if (message.res !== undefined) { + ResponseCommit.encode(message.res, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.changeSet) { + StoreKVPair.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ListenCommitRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListenCommitRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.blockHeight = reader.int64(); + break; + case 2: + message.res = ResponseCommit.decode(reader, reader.uint32()); + break; + case 3: + message.changeSet.push(StoreKVPair.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): ListenCommitRequest { + const message = createBaseListenCommitRequest(); + message.blockHeight = object.blockHeight !== undefined && object.blockHeight !== null ? BigInt(object.blockHeight.toString()) : BigInt(0); + message.res = object.res !== undefined && object.res !== null ? ResponseCommit.fromPartial(object.res) : undefined; + message.changeSet = object.changeSet?.map(e => StoreKVPair.fromPartial(e)) || []; + return message; + }, + fromAmino(object: ListenCommitRequestAmino): ListenCommitRequest { + const message = createBaseListenCommitRequest(); + if (object.block_height !== undefined && object.block_height !== null) { + message.blockHeight = BigInt(object.block_height); + } + if (object.res !== undefined && object.res !== null) { + message.res = ResponseCommit.fromAmino(object.res); + } + message.changeSet = object.change_set?.map(e => StoreKVPair.fromAmino(e)) || []; + return message; + }, + toAmino(message: ListenCommitRequest): ListenCommitRequestAmino { + const obj: any = {}; + obj.block_height = message.blockHeight !== BigInt(0) ? message.blockHeight?.toString() : undefined; + obj.res = message.res ? ResponseCommit.toAmino(message.res) : undefined; + if (message.changeSet) { + obj.change_set = message.changeSet.map(e => e ? StoreKVPair.toAmino(e) : undefined); + } else { + obj.change_set = message.changeSet; + } + return obj; + }, + fromAminoMsg(object: ListenCommitRequestAminoMsg): ListenCommitRequest { + return ListenCommitRequest.fromAmino(object.value); + }, + toAminoMsg(message: ListenCommitRequest): ListenCommitRequestAminoMsg { + return { + type: "cosmos-sdk/ListenCommitRequest", + value: ListenCommitRequest.toAmino(message) + }; + }, + fromProtoMsg(message: ListenCommitRequestProtoMsg): ListenCommitRequest { + return ListenCommitRequest.decode(message.value); + }, + toProto(message: ListenCommitRequest): Uint8Array { + return ListenCommitRequest.encode(message).finish(); + }, + toProtoMsg(message: ListenCommitRequest): ListenCommitRequestProtoMsg { + return { + typeUrl: "/cosmos.store.streaming.abci.ListenCommitRequest", + value: ListenCommitRequest.encode(message).finish() + }; + } +}; +function createBaseListenCommitResponse(): ListenCommitResponse { + return {}; +} +export const ListenCommitResponse = { + typeUrl: "/cosmos.store.streaming.abci.ListenCommitResponse", + encode(_: ListenCommitResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ListenCommitResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListenCommitResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): ListenCommitResponse { + const message = createBaseListenCommitResponse(); + return message; + }, + fromAmino(_: ListenCommitResponseAmino): ListenCommitResponse { + const message = createBaseListenCommitResponse(); + return message; + }, + toAmino(_: ListenCommitResponse): ListenCommitResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: ListenCommitResponseAminoMsg): ListenCommitResponse { + return ListenCommitResponse.fromAmino(object.value); + }, + toAminoMsg(message: ListenCommitResponse): ListenCommitResponseAminoMsg { + return { + type: "cosmos-sdk/ListenCommitResponse", + value: ListenCommitResponse.toAmino(message) + }; + }, + fromProtoMsg(message: ListenCommitResponseProtoMsg): ListenCommitResponse { + return ListenCommitResponse.decode(message.value); + }, + toProto(message: ListenCommitResponse): Uint8Array { + return ListenCommitResponse.encode(message).finish(); + }, + toProtoMsg(message: ListenCommitResponse): ListenCommitResponseProtoMsg { + return { + typeUrl: "/cosmos.store.streaming.abci.ListenCommitResponse", + value: ListenCommitResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/store/v1beta1/commit_info.ts b/packages/api/src/cosmos/store/v1beta1/commit_info.ts new file mode 100644 index 00000000..c7e171d9 --- /dev/null +++ b/packages/api/src/cosmos/store/v1beta1/commit_info.ts @@ -0,0 +1,360 @@ +//@ts-nocheck +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../../helpers"; +/** + * CommitInfo defines commit information used by the multi-store when committing + * a version/height. + */ +export interface CommitInfo { + version: bigint; + storeInfos: StoreInfo[]; + timestamp: Date; +} +export interface CommitInfoProtoMsg { + typeUrl: "/cosmos.store.v1beta1.CommitInfo"; + value: Uint8Array; +} +/** + * CommitInfo defines commit information used by the multi-store when committing + * a version/height. + */ +export interface CommitInfoAmino { + version?: string; + store_infos?: StoreInfoAmino[]; + timestamp?: string; +} +export interface CommitInfoAminoMsg { + type: "cosmos-sdk/CommitInfo"; + value: CommitInfoAmino; +} +/** + * CommitInfo defines commit information used by the multi-store when committing + * a version/height. + */ +export interface CommitInfoSDKType { + version: bigint; + store_infos: StoreInfoSDKType[]; + timestamp: Date; +} +/** + * StoreInfo defines store-specific commit information. It contains a reference + * between a store name and the commit ID. + */ +export interface StoreInfo { + name: string; + commitId: CommitID; +} +export interface StoreInfoProtoMsg { + typeUrl: "/cosmos.store.v1beta1.StoreInfo"; + value: Uint8Array; +} +/** + * StoreInfo defines store-specific commit information. It contains a reference + * between a store name and the commit ID. + */ +export interface StoreInfoAmino { + name?: string; + commit_id?: CommitIDAmino; +} +export interface StoreInfoAminoMsg { + type: "cosmos-sdk/StoreInfo"; + value: StoreInfoAmino; +} +/** + * StoreInfo defines store-specific commit information. It contains a reference + * between a store name and the commit ID. + */ +export interface StoreInfoSDKType { + name: string; + commit_id: CommitIDSDKType; +} +/** + * CommitID defines the commitment information when a specific store is + * committed. + */ +export interface CommitID { + version: bigint; + hash: Uint8Array; +} +export interface CommitIDProtoMsg { + typeUrl: "/cosmos.store.v1beta1.CommitID"; + value: Uint8Array; +} +/** + * CommitID defines the commitment information when a specific store is + * committed. + */ +export interface CommitIDAmino { + version?: string; + hash?: string; +} +export interface CommitIDAminoMsg { + type: "cosmos-sdk/CommitID"; + value: CommitIDAmino; +} +/** + * CommitID defines the commitment information when a specific store is + * committed. + */ +export interface CommitIDSDKType { + version: bigint; + hash: Uint8Array; +} +function createBaseCommitInfo(): CommitInfo { + return { + version: BigInt(0), + storeInfos: [], + timestamp: new Date() + }; +} +export const CommitInfo = { + typeUrl: "/cosmos.store.v1beta1.CommitInfo", + encode(message: CommitInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.version !== BigInt(0)) { + writer.uint32(8).int64(message.version); + } + for (const v of message.storeInfos) { + StoreInfo.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): CommitInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.version = reader.int64(); + break; + case 2: + message.storeInfos.push(StoreInfo.decode(reader, reader.uint32())); + break; + case 3: + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): CommitInfo { + const message = createBaseCommitInfo(); + message.version = object.version !== undefined && object.version !== null ? BigInt(object.version.toString()) : BigInt(0); + message.storeInfos = object.storeInfos?.map(e => StoreInfo.fromPartial(e)) || []; + message.timestamp = object.timestamp ?? undefined; + return message; + }, + fromAmino(object: CommitInfoAmino): CommitInfo { + const message = createBaseCommitInfo(); + if (object.version !== undefined && object.version !== null) { + message.version = BigInt(object.version); + } + message.storeInfos = object.store_infos?.map(e => StoreInfo.fromAmino(e)) || []; + if (object.timestamp !== undefined && object.timestamp !== null) { + message.timestamp = fromTimestamp(Timestamp.fromAmino(object.timestamp)); + } + return message; + }, + toAmino(message: CommitInfo): CommitInfoAmino { + const obj: any = {}; + obj.version = message.version !== BigInt(0) ? message.version?.toString() : undefined; + if (message.storeInfos) { + obj.store_infos = message.storeInfos.map(e => e ? StoreInfo.toAmino(e) : undefined); + } else { + obj.store_infos = message.storeInfos; + } + obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; + return obj; + }, + fromAminoMsg(object: CommitInfoAminoMsg): CommitInfo { + return CommitInfo.fromAmino(object.value); + }, + toAminoMsg(message: CommitInfo): CommitInfoAminoMsg { + return { + type: "cosmos-sdk/CommitInfo", + value: CommitInfo.toAmino(message) + }; + }, + fromProtoMsg(message: CommitInfoProtoMsg): CommitInfo { + return CommitInfo.decode(message.value); + }, + toProto(message: CommitInfo): Uint8Array { + return CommitInfo.encode(message).finish(); + }, + toProtoMsg(message: CommitInfo): CommitInfoProtoMsg { + return { + typeUrl: "/cosmos.store.v1beta1.CommitInfo", + value: CommitInfo.encode(message).finish() + }; + } +}; +function createBaseStoreInfo(): StoreInfo { + return { + name: "", + commitId: CommitID.fromPartial({}) + }; +} +export const StoreInfo = { + typeUrl: "/cosmos.store.v1beta1.StoreInfo", + encode(message: StoreInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.commitId !== undefined) { + CommitID.encode(message.commitId, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): StoreInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStoreInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.commitId = CommitID.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): StoreInfo { + const message = createBaseStoreInfo(); + message.name = object.name ?? ""; + message.commitId = object.commitId !== undefined && object.commitId !== null ? CommitID.fromPartial(object.commitId) : undefined; + return message; + }, + fromAmino(object: StoreInfoAmino): StoreInfo { + const message = createBaseStoreInfo(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + if (object.commit_id !== undefined && object.commit_id !== null) { + message.commitId = CommitID.fromAmino(object.commit_id); + } + return message; + }, + toAmino(message: StoreInfo): StoreInfoAmino { + const obj: any = {}; + obj.name = message.name === "" ? undefined : message.name; + obj.commit_id = message.commitId ? CommitID.toAmino(message.commitId) : undefined; + return obj; + }, + fromAminoMsg(object: StoreInfoAminoMsg): StoreInfo { + return StoreInfo.fromAmino(object.value); + }, + toAminoMsg(message: StoreInfo): StoreInfoAminoMsg { + return { + type: "cosmos-sdk/StoreInfo", + value: StoreInfo.toAmino(message) + }; + }, + fromProtoMsg(message: StoreInfoProtoMsg): StoreInfo { + return StoreInfo.decode(message.value); + }, + toProto(message: StoreInfo): Uint8Array { + return StoreInfo.encode(message).finish(); + }, + toProtoMsg(message: StoreInfo): StoreInfoProtoMsg { + return { + typeUrl: "/cosmos.store.v1beta1.StoreInfo", + value: StoreInfo.encode(message).finish() + }; + } +}; +function createBaseCommitID(): CommitID { + return { + version: BigInt(0), + hash: new Uint8Array() + }; +} +export const CommitID = { + typeUrl: "/cosmos.store.v1beta1.CommitID", + encode(message: CommitID, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.version !== BigInt(0)) { + writer.uint32(8).int64(message.version); + } + if (message.hash.length !== 0) { + writer.uint32(18).bytes(message.hash); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): CommitID { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitID(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.version = reader.int64(); + break; + case 2: + message.hash = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): CommitID { + const message = createBaseCommitID(); + message.version = object.version !== undefined && object.version !== null ? BigInt(object.version.toString()) : BigInt(0); + message.hash = object.hash ?? new Uint8Array(); + return message; + }, + fromAmino(object: CommitIDAmino): CommitID { + const message = createBaseCommitID(); + if (object.version !== undefined && object.version !== null) { + message.version = BigInt(object.version); + } + if (object.hash !== undefined && object.hash !== null) { + message.hash = bytesFromBase64(object.hash); + } + return message; + }, + toAmino(message: CommitID): CommitIDAmino { + const obj: any = {}; + obj.version = message.version !== BigInt(0) ? message.version?.toString() : undefined; + obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; + return obj; + }, + fromAminoMsg(object: CommitIDAminoMsg): CommitID { + return CommitID.fromAmino(object.value); + }, + toAminoMsg(message: CommitID): CommitIDAminoMsg { + return { + type: "cosmos-sdk/CommitID", + value: CommitID.toAmino(message) + }; + }, + fromProtoMsg(message: CommitIDProtoMsg): CommitID { + return CommitID.decode(message.value); + }, + toProto(message: CommitID): Uint8Array { + return CommitID.encode(message).finish(); + }, + toProtoMsg(message: CommitID): CommitIDProtoMsg { + return { + typeUrl: "/cosmos.store.v1beta1.CommitID", + value: CommitID.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/store/v1beta1/listening.ts b/packages/api/src/cosmos/store/v1beta1/listening.ts new file mode 100644 index 00000000..6020e900 --- /dev/null +++ b/packages/api/src/cosmos/store/v1beta1/listening.ts @@ -0,0 +1,284 @@ +//@ts-nocheck +import { ResponseCommit, ResponseCommitAmino, ResponseCommitSDKType, RequestFinalizeBlock, RequestFinalizeBlockAmino, RequestFinalizeBlockSDKType, ResponseFinalizeBlock, ResponseFinalizeBlockAmino, ResponseFinalizeBlockSDKType } from "../../../tendermint/abci/types"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { bytesFromBase64, base64FromBytes } from "../../../helpers"; +/** + * StoreKVPair is a KVStore KVPair used for listening to state changes (Sets and Deletes) + * It optionally includes the StoreKey for the originating KVStore and a Boolean flag to distinguish between Sets and + * Deletes + */ +export interface StoreKVPair { + /** the store key for the KVStore this pair originates from */ + storeKey: string; + /** true indicates a delete operation, false indicates a set operation */ + delete: boolean; + key: Uint8Array; + value: Uint8Array; +} +export interface StoreKVPairProtoMsg { + typeUrl: "/cosmos.store.v1beta1.StoreKVPair"; + value: Uint8Array; +} +/** + * StoreKVPair is a KVStore KVPair used for listening to state changes (Sets and Deletes) + * It optionally includes the StoreKey for the originating KVStore and a Boolean flag to distinguish between Sets and + * Deletes + */ +export interface StoreKVPairAmino { + /** the store key for the KVStore this pair originates from */ + store_key?: string; + /** true indicates a delete operation, false indicates a set operation */ + delete?: boolean; + key?: string; + value?: string; +} +export interface StoreKVPairAminoMsg { + type: "cosmos-sdk/StoreKVPair"; + value: StoreKVPairAmino; +} +/** + * StoreKVPair is a KVStore KVPair used for listening to state changes (Sets and Deletes) + * It optionally includes the StoreKey for the originating KVStore and a Boolean flag to distinguish between Sets and + * Deletes + */ +export interface StoreKVPairSDKType { + store_key: string; + delete: boolean; + key: Uint8Array; + value: Uint8Array; +} +/** + * BlockMetadata contains all the abci event data of a block + * the file streamer dump them into files together with the state changes. + */ +export interface BlockMetadata { + responseCommit?: ResponseCommit; + requestFinalizeBlock?: RequestFinalizeBlock; + /** TODO: should we renumber this? */ + responseFinalizeBlock?: ResponseFinalizeBlock; +} +export interface BlockMetadataProtoMsg { + typeUrl: "/cosmos.store.v1beta1.BlockMetadata"; + value: Uint8Array; +} +/** + * BlockMetadata contains all the abci event data of a block + * the file streamer dump them into files together with the state changes. + */ +export interface BlockMetadataAmino { + response_commit?: ResponseCommitAmino; + request_finalize_block?: RequestFinalizeBlockAmino; + /** TODO: should we renumber this? */ + response_finalize_block?: ResponseFinalizeBlockAmino; +} +export interface BlockMetadataAminoMsg { + type: "cosmos-sdk/BlockMetadata"; + value: BlockMetadataAmino; +} +/** + * BlockMetadata contains all the abci event data of a block + * the file streamer dump them into files together with the state changes. + */ +export interface BlockMetadataSDKType { + response_commit?: ResponseCommitSDKType; + request_finalize_block?: RequestFinalizeBlockSDKType; + response_finalize_block?: ResponseFinalizeBlockSDKType; +} +function createBaseStoreKVPair(): StoreKVPair { + return { + storeKey: "", + delete: false, + key: new Uint8Array(), + value: new Uint8Array() + }; +} +export const StoreKVPair = { + typeUrl: "/cosmos.store.v1beta1.StoreKVPair", + encode(message: StoreKVPair, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.storeKey !== "") { + writer.uint32(10).string(message.storeKey); + } + if (message.delete === true) { + writer.uint32(16).bool(message.delete); + } + if (message.key.length !== 0) { + writer.uint32(26).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(34).bytes(message.value); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): StoreKVPair { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStoreKVPair(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.storeKey = reader.string(); + break; + case 2: + message.delete = reader.bool(); + break; + case 3: + message.key = reader.bytes(); + break; + case 4: + message.value = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): StoreKVPair { + const message = createBaseStoreKVPair(); + message.storeKey = object.storeKey ?? ""; + message.delete = object.delete ?? false; + message.key = object.key ?? new Uint8Array(); + message.value = object.value ?? new Uint8Array(); + return message; + }, + fromAmino(object: StoreKVPairAmino): StoreKVPair { + const message = createBaseStoreKVPair(); + if (object.store_key !== undefined && object.store_key !== null) { + message.storeKey = object.store_key; + } + if (object.delete !== undefined && object.delete !== null) { + message.delete = object.delete; + } + if (object.key !== undefined && object.key !== null) { + message.key = bytesFromBase64(object.key); + } + if (object.value !== undefined && object.value !== null) { + message.value = bytesFromBase64(object.value); + } + return message; + }, + toAmino(message: StoreKVPair): StoreKVPairAmino { + const obj: any = {}; + obj.store_key = message.storeKey === "" ? undefined : message.storeKey; + obj.delete = message.delete === false ? undefined : message.delete; + obj.key = message.key ? base64FromBytes(message.key) : undefined; + obj.value = message.value ? base64FromBytes(message.value) : undefined; + return obj; + }, + fromAminoMsg(object: StoreKVPairAminoMsg): StoreKVPair { + return StoreKVPair.fromAmino(object.value); + }, + toAminoMsg(message: StoreKVPair): StoreKVPairAminoMsg { + return { + type: "cosmos-sdk/StoreKVPair", + value: StoreKVPair.toAmino(message) + }; + }, + fromProtoMsg(message: StoreKVPairProtoMsg): StoreKVPair { + return StoreKVPair.decode(message.value); + }, + toProto(message: StoreKVPair): Uint8Array { + return StoreKVPair.encode(message).finish(); + }, + toProtoMsg(message: StoreKVPair): StoreKVPairProtoMsg { + return { + typeUrl: "/cosmos.store.v1beta1.StoreKVPair", + value: StoreKVPair.encode(message).finish() + }; + } +}; +function createBaseBlockMetadata(): BlockMetadata { + return { + responseCommit: undefined, + requestFinalizeBlock: undefined, + responseFinalizeBlock: undefined + }; +} +export const BlockMetadata = { + typeUrl: "/cosmos.store.v1beta1.BlockMetadata", + encode(message: BlockMetadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.responseCommit !== undefined) { + ResponseCommit.encode(message.responseCommit, writer.uint32(50).fork()).ldelim(); + } + if (message.requestFinalizeBlock !== undefined) { + RequestFinalizeBlock.encode(message.requestFinalizeBlock, writer.uint32(58).fork()).ldelim(); + } + if (message.responseFinalizeBlock !== undefined) { + ResponseFinalizeBlock.encode(message.responseFinalizeBlock, writer.uint32(66).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): BlockMetadata { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlockMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 6: + message.responseCommit = ResponseCommit.decode(reader, reader.uint32()); + break; + case 7: + message.requestFinalizeBlock = RequestFinalizeBlock.decode(reader, reader.uint32()); + break; + case 8: + message.responseFinalizeBlock = ResponseFinalizeBlock.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): BlockMetadata { + const message = createBaseBlockMetadata(); + message.responseCommit = object.responseCommit !== undefined && object.responseCommit !== null ? ResponseCommit.fromPartial(object.responseCommit) : undefined; + message.requestFinalizeBlock = object.requestFinalizeBlock !== undefined && object.requestFinalizeBlock !== null ? RequestFinalizeBlock.fromPartial(object.requestFinalizeBlock) : undefined; + message.responseFinalizeBlock = object.responseFinalizeBlock !== undefined && object.responseFinalizeBlock !== null ? ResponseFinalizeBlock.fromPartial(object.responseFinalizeBlock) : undefined; + return message; + }, + fromAmino(object: BlockMetadataAmino): BlockMetadata { + const message = createBaseBlockMetadata(); + if (object.response_commit !== undefined && object.response_commit !== null) { + message.responseCommit = ResponseCommit.fromAmino(object.response_commit); + } + if (object.request_finalize_block !== undefined && object.request_finalize_block !== null) { + message.requestFinalizeBlock = RequestFinalizeBlock.fromAmino(object.request_finalize_block); + } + if (object.response_finalize_block !== undefined && object.response_finalize_block !== null) { + message.responseFinalizeBlock = ResponseFinalizeBlock.fromAmino(object.response_finalize_block); + } + return message; + }, + toAmino(message: BlockMetadata): BlockMetadataAmino { + const obj: any = {}; + obj.response_commit = message.responseCommit ? ResponseCommit.toAmino(message.responseCommit) : undefined; + obj.request_finalize_block = message.requestFinalizeBlock ? RequestFinalizeBlock.toAmino(message.requestFinalizeBlock) : undefined; + obj.response_finalize_block = message.responseFinalizeBlock ? ResponseFinalizeBlock.toAmino(message.responseFinalizeBlock) : undefined; + return obj; + }, + fromAminoMsg(object: BlockMetadataAminoMsg): BlockMetadata { + return BlockMetadata.fromAmino(object.value); + }, + toAminoMsg(message: BlockMetadata): BlockMetadataAminoMsg { + return { + type: "cosmos-sdk/BlockMetadata", + value: BlockMetadata.toAmino(message) + }; + }, + fromProtoMsg(message: BlockMetadataProtoMsg): BlockMetadata { + return BlockMetadata.decode(message.value); + }, + toProto(message: BlockMetadata): Uint8Array { + return BlockMetadata.encode(message).finish(); + }, + toProtoMsg(message: BlockMetadata): BlockMetadataProtoMsg { + return { + typeUrl: "/cosmos.store.v1beta1.BlockMetadata", + value: BlockMetadata.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/tx/config/v1/config.ts b/packages/api/src/cosmos/tx/config/v1/config.ts new file mode 100644 index 00000000..19cf17e2 --- /dev/null +++ b/packages/api/src/cosmos/tx/config/v1/config.ts @@ -0,0 +1,122 @@ +//@ts-nocheck +import { BinaryReader, BinaryWriter } from "../../../../binary"; +/** Config is the config object of the x/auth/tx package. */ +export interface Config { + /** + * skip_ante_handler defines whether the ante handler registration should be skipped in case an app wants to override + * this functionality. + */ + skipAnteHandler: boolean; + /** + * skip_post_handler defines whether the post handler registration should be skipped in case an app wants to override + * this functionality. + */ + skipPostHandler: boolean; +} +export interface ConfigProtoMsg { + typeUrl: "/cosmos.tx.config.v1.Config"; + value: Uint8Array; +} +/** Config is the config object of the x/auth/tx package. */ +export interface ConfigAmino { + /** + * skip_ante_handler defines whether the ante handler registration should be skipped in case an app wants to override + * this functionality. + */ + skip_ante_handler?: boolean; + /** + * skip_post_handler defines whether the post handler registration should be skipped in case an app wants to override + * this functionality. + */ + skip_post_handler?: boolean; +} +export interface ConfigAminoMsg { + type: "cosmos-sdk/Config"; + value: ConfigAmino; +} +/** Config is the config object of the x/auth/tx package. */ +export interface ConfigSDKType { + skip_ante_handler: boolean; + skip_post_handler: boolean; +} +function createBaseConfig(): Config { + return { + skipAnteHandler: false, + skipPostHandler: false + }; +} +export const Config = { + typeUrl: "/cosmos.tx.config.v1.Config", + encode(message: Config, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.skipAnteHandler === true) { + writer.uint32(8).bool(message.skipAnteHandler); + } + if (message.skipPostHandler === true) { + writer.uint32(16).bool(message.skipPostHandler); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Config { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConfig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.skipAnteHandler = reader.bool(); + break; + case 2: + message.skipPostHandler = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): Config { + const message = createBaseConfig(); + message.skipAnteHandler = object.skipAnteHandler ?? false; + message.skipPostHandler = object.skipPostHandler ?? false; + return message; + }, + fromAmino(object: ConfigAmino): Config { + const message = createBaseConfig(); + if (object.skip_ante_handler !== undefined && object.skip_ante_handler !== null) { + message.skipAnteHandler = object.skip_ante_handler; + } + if (object.skip_post_handler !== undefined && object.skip_post_handler !== null) { + message.skipPostHandler = object.skip_post_handler; + } + return message; + }, + toAmino(message: Config): ConfigAmino { + const obj: any = {}; + obj.skip_ante_handler = message.skipAnteHandler === false ? undefined : message.skipAnteHandler; + obj.skip_post_handler = message.skipPostHandler === false ? undefined : message.skipPostHandler; + return obj; + }, + fromAminoMsg(object: ConfigAminoMsg): Config { + return Config.fromAmino(object.value); + }, + toAminoMsg(message: Config): ConfigAminoMsg { + return { + type: "cosmos-sdk/Config", + value: Config.toAmino(message) + }; + }, + fromProtoMsg(message: ConfigProtoMsg): Config { + return Config.decode(message.value); + }, + toProto(message: Config): Uint8Array { + return Config.encode(message).finish(); + }, + toProtoMsg(message: Config): ConfigProtoMsg { + return { + typeUrl: "/cosmos.tx.config.v1.Config", + value: Config.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/tx/signing/v1beta1/signing.ts b/packages/api/src/cosmos/tx/signing/v1beta1/signing.ts index 0de7ff6a..c5e809f9 100644 --- a/packages/api/src/cosmos/tx/signing/v1beta1/signing.ts +++ b/packages/api/src/cosmos/tx/signing/v1beta1/signing.ts @@ -27,14 +27,15 @@ export enum SignMode { /** * SIGN_MODE_TEXTUAL - SIGN_MODE_TEXTUAL is a future signing mode that will verify some * human-readable textual representation on top of the binary representation - * from SIGN_MODE_DIRECT. It is currently not supported. + * from SIGN_MODE_DIRECT. + * + * Since: cosmos-sdk 0.50 */ SIGN_MODE_TEXTUAL = 2, /** * SIGN_MODE_DIRECT_AUX - SIGN_MODE_DIRECT_AUX specifies a signing mode which uses * SignDocDirectAux. As opposed to SIGN_MODE_DIRECT, this sign mode does not - * require signers signing over other signers' `signer_info`. It also allows - * for adding Tips in transactions. + * require signers signing over other signers' `signer_info`. * * Since: cosmos-sdk 0.46 */ diff --git a/packages/api/src/cosmos/tx/v1beta1/service.lcd.ts b/packages/api/src/cosmos/tx/v1beta1/service.lcd.ts index aabc5abf..f964150b 100644 --- a/packages/api/src/cosmos/tx/v1beta1/service.lcd.ts +++ b/packages/api/src/cosmos/tx/v1beta1/service.lcd.ts @@ -39,12 +39,13 @@ export class LCDQueryClient { if (typeof params?.limit !== "undefined") { options.params.limit = params.limit; } + if (typeof params?.query !== "undefined") { + options.params.query = params.query; + } const endpoint = `cosmos/tx/v1beta1/txs`; return await this.req.get(endpoint, options); } - /* GetBlockWithTxs fetches a block with decoded txs. - - Since: cosmos-sdk 0.45.2 */ + /* GetBlockWithTxs fetches a block with decoded txs. */ async getBlockWithTxs(params: GetBlockWithTxsRequest): Promise { const options: any = { params: {} diff --git a/packages/api/src/cosmos/tx/v1beta1/service.rpc.Service.ts b/packages/api/src/cosmos/tx/v1beta1/service.rpc.Service.ts index f52a7913..57fa2e15 100644 --- a/packages/api/src/cosmos/tx/v1beta1/service.rpc.Service.ts +++ b/packages/api/src/cosmos/tx/v1beta1/service.rpc.Service.ts @@ -2,7 +2,7 @@ import { Rpc } from "../../../helpers"; import { BinaryReader } from "../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { SimulateRequest, SimulateResponse, GetTxRequest, GetTxResponse, BroadcastTxRequest, BroadcastTxResponse, GetTxsEventRequest, GetTxsEventResponse, GetBlockWithTxsRequest, GetBlockWithTxsResponse } from "./service"; +import { SimulateRequest, SimulateResponse, GetTxRequest, GetTxResponse, BroadcastTxRequest, BroadcastTxResponse, GetTxsEventRequest, GetTxsEventResponse, GetBlockWithTxsRequest, GetBlockWithTxsResponse, TxDecodeRequest, TxDecodeResponse, TxEncodeRequest, TxEncodeResponse, TxEncodeAminoRequest, TxEncodeAminoResponse, TxDecodeAminoRequest, TxDecodeAminoResponse } from "./service"; /** Service defines a gRPC service for interacting with transactions. */ export interface Service { /** Simulate simulates executing a transaction for estimating gas usage. */ @@ -13,12 +13,16 @@ export interface Service { broadcastTx(request: BroadcastTxRequest): Promise; /** GetTxsEvent fetches txs by event. */ getTxsEvent(request: GetTxsEventRequest): Promise; - /** - * GetBlockWithTxs fetches a block with decoded txs. - * - * Since: cosmos-sdk 0.45.2 - */ + /** GetBlockWithTxs fetches a block with decoded txs. */ getBlockWithTxs(request: GetBlockWithTxsRequest): Promise; + /** TxDecode decodes the transaction. */ + txDecode(request: TxDecodeRequest): Promise; + /** TxEncode encodes the transaction. */ + txEncode(request: TxEncodeRequest): Promise; + /** TxEncodeAmino encodes an Amino transaction from JSON to encoded bytes. */ + txEncodeAmino(request: TxEncodeAminoRequest): Promise; + /** TxDecodeAmino decodes an Amino transaction from encoded bytes to JSON. */ + txDecodeAmino(request: TxDecodeAminoRequest): Promise; } export class ServiceClientImpl implements Service { private readonly rpc: Rpc; @@ -29,6 +33,10 @@ export class ServiceClientImpl implements Service { this.broadcastTx = this.broadcastTx.bind(this); this.getTxsEvent = this.getTxsEvent.bind(this); this.getBlockWithTxs = this.getBlockWithTxs.bind(this); + this.txDecode = this.txDecode.bind(this); + this.txEncode = this.txEncode.bind(this); + this.txEncodeAmino = this.txEncodeAmino.bind(this); + this.txDecodeAmino = this.txDecodeAmino.bind(this); } simulate(request: SimulateRequest): Promise { const data = SimulateRequest.encode(request).finish(); @@ -55,6 +63,26 @@ export class ServiceClientImpl implements Service { const promise = this.rpc.request("cosmos.tx.v1beta1.Service", "GetBlockWithTxs", data); return promise.then(data => GetBlockWithTxsResponse.decode(new BinaryReader(data))); } + txDecode(request: TxDecodeRequest): Promise { + const data = TxDecodeRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.tx.v1beta1.Service", "TxDecode", data); + return promise.then(data => TxDecodeResponse.decode(new BinaryReader(data))); + } + txEncode(request: TxEncodeRequest): Promise { + const data = TxEncodeRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.tx.v1beta1.Service", "TxEncode", data); + return promise.then(data => TxEncodeResponse.decode(new BinaryReader(data))); + } + txEncodeAmino(request: TxEncodeAminoRequest): Promise { + const data = TxEncodeAminoRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.tx.v1beta1.Service", "TxEncodeAmino", data); + return promise.then(data => TxEncodeAminoResponse.decode(new BinaryReader(data))); + } + txDecodeAmino(request: TxDecodeAminoRequest): Promise { + const data = TxDecodeAminoRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.tx.v1beta1.Service", "TxDecodeAmino", data); + return promise.then(data => TxDecodeAminoResponse.decode(new BinaryReader(data))); + } } export const createRpcQueryExtension = (base: QueryClient) => { const rpc = createProtobufRpcClient(base); @@ -74,6 +102,18 @@ export const createRpcQueryExtension = (base: QueryClient) => { }, getBlockWithTxs(request: GetBlockWithTxsRequest): Promise { return queryService.getBlockWithTxs(request); + }, + txDecode(request: TxDecodeRequest): Promise { + return queryService.txDecode(request); + }, + txEncode(request: TxEncodeRequest): Promise { + return queryService.txEncode(request); + }, + txEncodeAmino(request: TxEncodeAminoRequest): Promise { + return queryService.txEncodeAmino(request); + }, + txDecodeAmino(request: TxDecodeAminoRequest): Promise { + return queryService.txDecodeAmino(request); } }; }; \ No newline at end of file diff --git a/packages/api/src/cosmos/tx/v1beta1/service.ts b/packages/api/src/cosmos/tx/v1beta1/service.ts index acc98aa3..525d04f2 100644 --- a/packages/api/src/cosmos/tx/v1beta1/service.ts +++ b/packages/api/src/cosmos/tx/v1beta1/service.ts @@ -8,7 +8,10 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { bytesFromBase64, base64FromBytes } from "../../../helpers"; /** OrderBy defines the sorting order */ export enum OrderBy { - /** ORDER_BY_UNSPECIFIED - ORDER_BY_UNSPECIFIED specifies an unknown sorting order. OrderBy defaults to ASC in this case. */ + /** + * ORDER_BY_UNSPECIFIED - ORDER_BY_UNSPECIFIED specifies an unknown sorting order. OrderBy defaults + * to ASC in this case. + */ ORDER_BY_UNSPECIFIED = 0, /** ORDER_BY_ASC - ORDER_BY_ASC defines ascending order */ ORDER_BY_ASC = 1, @@ -48,23 +51,26 @@ export function orderByToJSON(object: OrderBy): string { return "UNRECOGNIZED"; } } -/** BroadcastMode specifies the broadcast mode for the TxService.Broadcast RPC method. */ +/** + * BroadcastMode specifies the broadcast mode for the TxService.Broadcast RPC + * method. + */ export enum BroadcastMode { /** BROADCAST_MODE_UNSPECIFIED - zero-value for mode ordering */ BROADCAST_MODE_UNSPECIFIED = 0, /** - * BROADCAST_MODE_BLOCK - BROADCAST_MODE_BLOCK defines a tx broadcasting mode where the client waits for - * the tx to be committed in a block. + * BROADCAST_MODE_BLOCK - DEPRECATED: use BROADCAST_MODE_SYNC instead, + * BROADCAST_MODE_BLOCK is not supported by the SDK from v0.47.x onwards. */ BROADCAST_MODE_BLOCK = 1, /** - * BROADCAST_MODE_SYNC - BROADCAST_MODE_SYNC defines a tx broadcasting mode where the client waits for - * a CheckTx execution response only. + * BROADCAST_MODE_SYNC - BROADCAST_MODE_SYNC defines a tx broadcasting mode where the client waits + * for a CheckTx execution response only. */ BROADCAST_MODE_SYNC = 2, /** - * BROADCAST_MODE_ASYNC - BROADCAST_MODE_ASYNC defines a tx broadcasting mode where the client returns - * immediately. + * BROADCAST_MODE_ASYNC - BROADCAST_MODE_ASYNC defines a tx broadcasting mode where the client + * returns immediately. */ BROADCAST_MODE_ASYNC = 3, UNRECOGNIZED = -1, @@ -111,7 +117,12 @@ export function broadcastModeToJSON(object: BroadcastMode): string { * RPC method. */ export interface GetTxsEventRequest { - /** events is the list of transaction event type. */ + /** + * events is the list of transaction event type. + * Deprecated post v0.47.x: use query instead, which should contain a valid + * events query. + */ + /** @deprecated */ events: string[]; /** * pagination defines a pagination for the request. @@ -120,13 +131,21 @@ export interface GetTxsEventRequest { /** @deprecated */ pagination?: PageRequest; orderBy: OrderBy; - /** page is the page number to query, starts at 1. If not provided, will default to first page. */ + /** + * page is the page number to query, starts at 1. If not provided, will + * default to first page. + */ page: bigint; /** * limit is the total number of results to be returned in the result page. * If left empty it will default to a value to be set by each app. */ limit: bigint; + /** + * query defines the transaction event query that is proxied to Tendermint's + * TxSearch RPC method. The query must be valid. + */ + query: string; } export interface GetTxsEventRequestProtoMsg { typeUrl: "/cosmos.tx.v1beta1.GetTxsEventRequest"; @@ -137,7 +156,12 @@ export interface GetTxsEventRequestProtoMsg { * RPC method. */ export interface GetTxsEventRequestAmino { - /** events is the list of transaction event type. */ + /** + * events is the list of transaction event type. + * Deprecated post v0.47.x: use query instead, which should contain a valid + * events query. + */ + /** @deprecated */ events?: string[]; /** * pagination defines a pagination for the request. @@ -146,13 +170,21 @@ export interface GetTxsEventRequestAmino { /** @deprecated */ pagination?: PageRequestAmino; order_by?: OrderBy; - /** page is the page number to query, starts at 1. If not provided, will default to first page. */ + /** + * page is the page number to query, starts at 1. If not provided, will + * default to first page. + */ page?: string; /** * limit is the total number of results to be returned in the result page. * If left empty it will default to a value to be set by each app. */ limit?: string; + /** + * query defines the transaction event query that is proxied to Tendermint's + * TxSearch RPC method. The query must be valid. + */ + query?: string; } export interface GetTxsEventRequestAminoMsg { type: "cosmos-sdk/GetTxsEventRequest"; @@ -163,12 +195,14 @@ export interface GetTxsEventRequestAminoMsg { * RPC method. */ export interface GetTxsEventRequestSDKType { + /** @deprecated */ events: string[]; /** @deprecated */ pagination?: PageRequestSDKType; order_by: OrderBy; page: bigint; limit: bigint; + query: string; } /** * GetTxsEventResponse is the response type for the Service.TxsByEvents @@ -301,11 +335,7 @@ export interface SimulateRequest { */ /** @deprecated */ tx?: Tx; - /** - * tx_bytes is the raw transaction. - * - * Since: cosmos-sdk 0.43 - */ + /** tx_bytes is the raw transaction. */ txBytes: Uint8Array; } export interface SimulateRequestProtoMsg { @@ -323,11 +353,7 @@ export interface SimulateRequestAmino { */ /** @deprecated */ tx?: TxAmino; - /** - * tx_bytes is the raw transaction. - * - * Since: cosmos-sdk 0.43 - */ + /** tx_bytes is the raw transaction. */ tx_bytes?: string; } export interface SimulateRequestAminoMsg { @@ -440,8 +466,6 @@ export interface GetTxResponseSDKType { /** * GetBlockWithTxsRequest is the request type for the Service.GetBlockWithTxs * RPC method. - * - * Since: cosmos-sdk 0.45.2 */ export interface GetBlockWithTxsRequest { /** height is the height of the block to query. */ @@ -456,8 +480,6 @@ export interface GetBlockWithTxsRequestProtoMsg { /** * GetBlockWithTxsRequest is the request type for the Service.GetBlockWithTxs * RPC method. - * - * Since: cosmos-sdk 0.45.2 */ export interface GetBlockWithTxsRequestAmino { /** height is the height of the block to query. */ @@ -472,17 +494,14 @@ export interface GetBlockWithTxsRequestAminoMsg { /** * GetBlockWithTxsRequest is the request type for the Service.GetBlockWithTxs * RPC method. - * - * Since: cosmos-sdk 0.45.2 */ export interface GetBlockWithTxsRequestSDKType { height: bigint; pagination?: PageRequestSDKType; } /** - * GetBlockWithTxsResponse is the response type for the Service.GetBlockWithTxs method. - * - * Since: cosmos-sdk 0.45.2 + * GetBlockWithTxsResponse is the response type for the Service.GetBlockWithTxs + * method. */ export interface GetBlockWithTxsResponse { /** txs are the transactions in the block. */ @@ -497,9 +516,8 @@ export interface GetBlockWithTxsResponseProtoMsg { value: Uint8Array; } /** - * GetBlockWithTxsResponse is the response type for the Service.GetBlockWithTxs method. - * - * Since: cosmos-sdk 0.45.2 + * GetBlockWithTxsResponse is the response type for the Service.GetBlockWithTxs + * method. */ export interface GetBlockWithTxsResponseAmino { /** txs are the transactions in the block. */ @@ -514,9 +532,8 @@ export interface GetBlockWithTxsResponseAminoMsg { value: GetBlockWithTxsResponseAmino; } /** - * GetBlockWithTxsResponse is the response type for the Service.GetBlockWithTxs method. - * - * Since: cosmos-sdk 0.45.2 + * GetBlockWithTxsResponse is the response type for the Service.GetBlockWithTxs + * method. */ export interface GetBlockWithTxsResponseSDKType { txs: TxSDKType[]; @@ -524,13 +541,254 @@ export interface GetBlockWithTxsResponseSDKType { block?: BlockSDKType; pagination?: PageResponseSDKType; } +/** + * TxDecodeRequest is the request type for the Service.TxDecode + * RPC method. + */ +export interface TxDecodeRequest { + /** tx_bytes is the raw transaction. */ + txBytes: Uint8Array; +} +export interface TxDecodeRequestProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.TxDecodeRequest"; + value: Uint8Array; +} +/** + * TxDecodeRequest is the request type for the Service.TxDecode + * RPC method. + */ +export interface TxDecodeRequestAmino { + /** tx_bytes is the raw transaction. */ + tx_bytes?: string; +} +export interface TxDecodeRequestAminoMsg { + type: "cosmos-sdk/TxDecodeRequest"; + value: TxDecodeRequestAmino; +} +/** + * TxDecodeRequest is the request type for the Service.TxDecode + * RPC method. + */ +export interface TxDecodeRequestSDKType { + tx_bytes: Uint8Array; +} +/** + * TxDecodeResponse is the response type for the + * Service.TxDecode method. + */ +export interface TxDecodeResponse { + /** tx is the decoded transaction. */ + tx?: Tx; +} +export interface TxDecodeResponseProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.TxDecodeResponse"; + value: Uint8Array; +} +/** + * TxDecodeResponse is the response type for the + * Service.TxDecode method. + */ +export interface TxDecodeResponseAmino { + /** tx is the decoded transaction. */ + tx?: TxAmino; +} +export interface TxDecodeResponseAminoMsg { + type: "cosmos-sdk/TxDecodeResponse"; + value: TxDecodeResponseAmino; +} +/** + * TxDecodeResponse is the response type for the + * Service.TxDecode method. + */ +export interface TxDecodeResponseSDKType { + tx?: TxSDKType; +} +/** + * TxEncodeRequest is the request type for the Service.TxEncode + * RPC method. + */ +export interface TxEncodeRequest { + /** tx is the transaction to encode. */ + tx?: Tx; +} +export interface TxEncodeRequestProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.TxEncodeRequest"; + value: Uint8Array; +} +/** + * TxEncodeRequest is the request type for the Service.TxEncode + * RPC method. + */ +export interface TxEncodeRequestAmino { + /** tx is the transaction to encode. */ + tx?: TxAmino; +} +export interface TxEncodeRequestAminoMsg { + type: "cosmos-sdk/TxEncodeRequest"; + value: TxEncodeRequestAmino; +} +/** + * TxEncodeRequest is the request type for the Service.TxEncode + * RPC method. + */ +export interface TxEncodeRequestSDKType { + tx?: TxSDKType; +} +/** + * TxEncodeResponse is the response type for the + * Service.TxEncode method. + */ +export interface TxEncodeResponse { + /** tx_bytes is the encoded transaction bytes. */ + txBytes: Uint8Array; +} +export interface TxEncodeResponseProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.TxEncodeResponse"; + value: Uint8Array; +} +/** + * TxEncodeResponse is the response type for the + * Service.TxEncode method. + */ +export interface TxEncodeResponseAmino { + /** tx_bytes is the encoded transaction bytes. */ + tx_bytes?: string; +} +export interface TxEncodeResponseAminoMsg { + type: "cosmos-sdk/TxEncodeResponse"; + value: TxEncodeResponseAmino; +} +/** + * TxEncodeResponse is the response type for the + * Service.TxEncode method. + */ +export interface TxEncodeResponseSDKType { + tx_bytes: Uint8Array; +} +/** + * TxEncodeAminoRequest is the request type for the Service.TxEncodeAmino + * RPC method. + */ +export interface TxEncodeAminoRequest { + aminoJson: string; +} +export interface TxEncodeAminoRequestProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.TxEncodeAminoRequest"; + value: Uint8Array; +} +/** + * TxEncodeAminoRequest is the request type for the Service.TxEncodeAmino + * RPC method. + */ +export interface TxEncodeAminoRequestAmino { + amino_json?: string; +} +export interface TxEncodeAminoRequestAminoMsg { + type: "cosmos-sdk/TxEncodeAminoRequest"; + value: TxEncodeAminoRequestAmino; +} +/** + * TxEncodeAminoRequest is the request type for the Service.TxEncodeAmino + * RPC method. + */ +export interface TxEncodeAminoRequestSDKType { + amino_json: string; +} +/** + * TxEncodeAminoResponse is the response type for the Service.TxEncodeAmino + * RPC method. + */ +export interface TxEncodeAminoResponse { + aminoBinary: Uint8Array; +} +export interface TxEncodeAminoResponseProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.TxEncodeAminoResponse"; + value: Uint8Array; +} +/** + * TxEncodeAminoResponse is the response type for the Service.TxEncodeAmino + * RPC method. + */ +export interface TxEncodeAminoResponseAmino { + amino_binary?: string; +} +export interface TxEncodeAminoResponseAminoMsg { + type: "cosmos-sdk/TxEncodeAminoResponse"; + value: TxEncodeAminoResponseAmino; +} +/** + * TxEncodeAminoResponse is the response type for the Service.TxEncodeAmino + * RPC method. + */ +export interface TxEncodeAminoResponseSDKType { + amino_binary: Uint8Array; +} +/** + * TxDecodeAminoRequest is the request type for the Service.TxDecodeAmino + * RPC method. + */ +export interface TxDecodeAminoRequest { + aminoBinary: Uint8Array; +} +export interface TxDecodeAminoRequestProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.TxDecodeAminoRequest"; + value: Uint8Array; +} +/** + * TxDecodeAminoRequest is the request type for the Service.TxDecodeAmino + * RPC method. + */ +export interface TxDecodeAminoRequestAmino { + amino_binary?: string; +} +export interface TxDecodeAminoRequestAminoMsg { + type: "cosmos-sdk/TxDecodeAminoRequest"; + value: TxDecodeAminoRequestAmino; +} +/** + * TxDecodeAminoRequest is the request type for the Service.TxDecodeAmino + * RPC method. + */ +export interface TxDecodeAminoRequestSDKType { + amino_binary: Uint8Array; +} +/** + * TxDecodeAminoResponse is the response type for the Service.TxDecodeAmino + * RPC method. + */ +export interface TxDecodeAminoResponse { + aminoJson: string; +} +export interface TxDecodeAminoResponseProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.TxDecodeAminoResponse"; + value: Uint8Array; +} +/** + * TxDecodeAminoResponse is the response type for the Service.TxDecodeAmino + * RPC method. + */ +export interface TxDecodeAminoResponseAmino { + amino_json?: string; +} +export interface TxDecodeAminoResponseAminoMsg { + type: "cosmos-sdk/TxDecodeAminoResponse"; + value: TxDecodeAminoResponseAmino; +} +/** + * TxDecodeAminoResponse is the response type for the Service.TxDecodeAmino + * RPC method. + */ +export interface TxDecodeAminoResponseSDKType { + amino_json: string; +} function createBaseGetTxsEventRequest(): GetTxsEventRequest { return { events: [], pagination: undefined, orderBy: 0, page: BigInt(0), - limit: BigInt(0) + limit: BigInt(0), + query: "" }; } export const GetTxsEventRequest = { @@ -551,6 +809,9 @@ export const GetTxsEventRequest = { if (message.limit !== BigInt(0)) { writer.uint32(40).uint64(message.limit); } + if (message.query !== "") { + writer.uint32(50).string(message.query); + } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): GetTxsEventRequest { @@ -575,6 +836,9 @@ export const GetTxsEventRequest = { case 5: message.limit = reader.uint64(); break; + case 6: + message.query = reader.string(); + break; default: reader.skipType(tag & 7); break; @@ -589,6 +853,7 @@ export const GetTxsEventRequest = { message.orderBy = object.orderBy ?? 0; message.page = object.page !== undefined && object.page !== null ? BigInt(object.page.toString()) : BigInt(0); message.limit = object.limit !== undefined && object.limit !== null ? BigInt(object.limit.toString()) : BigInt(0); + message.query = object.query ?? ""; return message; }, fromAmino(object: GetTxsEventRequestAmino): GetTxsEventRequest { @@ -606,6 +871,9 @@ export const GetTxsEventRequest = { if (object.limit !== undefined && object.limit !== null) { message.limit = BigInt(object.limit); } + if (object.query !== undefined && object.query !== null) { + message.query = object.query; + } return message; }, toAmino(message: GetTxsEventRequest): GetTxsEventRequestAmino { @@ -619,6 +887,7 @@ export const GetTxsEventRequest = { obj.order_by = message.orderBy === 0 ? undefined : message.orderBy; obj.page = message.page !== BigInt(0) ? message.page?.toString() : undefined; obj.limit = message.limit !== BigInt(0) ? message.limit?.toString() : undefined; + obj.query = message.query === "" ? undefined : message.query; return obj; }, fromAminoMsg(object: GetTxsEventRequestAminoMsg): GetTxsEventRequest { @@ -1401,4 +1670,556 @@ export const GetBlockWithTxsResponse = { value: GetBlockWithTxsResponse.encode(message).finish() }; } +}; +function createBaseTxDecodeRequest(): TxDecodeRequest { + return { + txBytes: new Uint8Array() + }; +} +export const TxDecodeRequest = { + typeUrl: "/cosmos.tx.v1beta1.TxDecodeRequest", + encode(message: TxDecodeRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.txBytes.length !== 0) { + writer.uint32(10).bytes(message.txBytes); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): TxDecodeRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxDecodeRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.txBytes = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): TxDecodeRequest { + const message = createBaseTxDecodeRequest(); + message.txBytes = object.txBytes ?? new Uint8Array(); + return message; + }, + fromAmino(object: TxDecodeRequestAmino): TxDecodeRequest { + const message = createBaseTxDecodeRequest(); + if (object.tx_bytes !== undefined && object.tx_bytes !== null) { + message.txBytes = bytesFromBase64(object.tx_bytes); + } + return message; + }, + toAmino(message: TxDecodeRequest): TxDecodeRequestAmino { + const obj: any = {}; + obj.tx_bytes = message.txBytes ? base64FromBytes(message.txBytes) : undefined; + return obj; + }, + fromAminoMsg(object: TxDecodeRequestAminoMsg): TxDecodeRequest { + return TxDecodeRequest.fromAmino(object.value); + }, + toAminoMsg(message: TxDecodeRequest): TxDecodeRequestAminoMsg { + return { + type: "cosmos-sdk/TxDecodeRequest", + value: TxDecodeRequest.toAmino(message) + }; + }, + fromProtoMsg(message: TxDecodeRequestProtoMsg): TxDecodeRequest { + return TxDecodeRequest.decode(message.value); + }, + toProto(message: TxDecodeRequest): Uint8Array { + return TxDecodeRequest.encode(message).finish(); + }, + toProtoMsg(message: TxDecodeRequest): TxDecodeRequestProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.TxDecodeRequest", + value: TxDecodeRequest.encode(message).finish() + }; + } +}; +function createBaseTxDecodeResponse(): TxDecodeResponse { + return { + tx: undefined + }; +} +export const TxDecodeResponse = { + typeUrl: "/cosmos.tx.v1beta1.TxDecodeResponse", + encode(message: TxDecodeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.tx !== undefined) { + Tx.encode(message.tx, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): TxDecodeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxDecodeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.tx = Tx.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): TxDecodeResponse { + const message = createBaseTxDecodeResponse(); + message.tx = object.tx !== undefined && object.tx !== null ? Tx.fromPartial(object.tx) : undefined; + return message; + }, + fromAmino(object: TxDecodeResponseAmino): TxDecodeResponse { + const message = createBaseTxDecodeResponse(); + if (object.tx !== undefined && object.tx !== null) { + message.tx = Tx.fromAmino(object.tx); + } + return message; + }, + toAmino(message: TxDecodeResponse): TxDecodeResponseAmino { + const obj: any = {}; + obj.tx = message.tx ? Tx.toAmino(message.tx) : undefined; + return obj; + }, + fromAminoMsg(object: TxDecodeResponseAminoMsg): TxDecodeResponse { + return TxDecodeResponse.fromAmino(object.value); + }, + toAminoMsg(message: TxDecodeResponse): TxDecodeResponseAminoMsg { + return { + type: "cosmos-sdk/TxDecodeResponse", + value: TxDecodeResponse.toAmino(message) + }; + }, + fromProtoMsg(message: TxDecodeResponseProtoMsg): TxDecodeResponse { + return TxDecodeResponse.decode(message.value); + }, + toProto(message: TxDecodeResponse): Uint8Array { + return TxDecodeResponse.encode(message).finish(); + }, + toProtoMsg(message: TxDecodeResponse): TxDecodeResponseProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.TxDecodeResponse", + value: TxDecodeResponse.encode(message).finish() + }; + } +}; +function createBaseTxEncodeRequest(): TxEncodeRequest { + return { + tx: undefined + }; +} +export const TxEncodeRequest = { + typeUrl: "/cosmos.tx.v1beta1.TxEncodeRequest", + encode(message: TxEncodeRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.tx !== undefined) { + Tx.encode(message.tx, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): TxEncodeRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxEncodeRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.tx = Tx.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): TxEncodeRequest { + const message = createBaseTxEncodeRequest(); + message.tx = object.tx !== undefined && object.tx !== null ? Tx.fromPartial(object.tx) : undefined; + return message; + }, + fromAmino(object: TxEncodeRequestAmino): TxEncodeRequest { + const message = createBaseTxEncodeRequest(); + if (object.tx !== undefined && object.tx !== null) { + message.tx = Tx.fromAmino(object.tx); + } + return message; + }, + toAmino(message: TxEncodeRequest): TxEncodeRequestAmino { + const obj: any = {}; + obj.tx = message.tx ? Tx.toAmino(message.tx) : undefined; + return obj; + }, + fromAminoMsg(object: TxEncodeRequestAminoMsg): TxEncodeRequest { + return TxEncodeRequest.fromAmino(object.value); + }, + toAminoMsg(message: TxEncodeRequest): TxEncodeRequestAminoMsg { + return { + type: "cosmos-sdk/TxEncodeRequest", + value: TxEncodeRequest.toAmino(message) + }; + }, + fromProtoMsg(message: TxEncodeRequestProtoMsg): TxEncodeRequest { + return TxEncodeRequest.decode(message.value); + }, + toProto(message: TxEncodeRequest): Uint8Array { + return TxEncodeRequest.encode(message).finish(); + }, + toProtoMsg(message: TxEncodeRequest): TxEncodeRequestProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.TxEncodeRequest", + value: TxEncodeRequest.encode(message).finish() + }; + } +}; +function createBaseTxEncodeResponse(): TxEncodeResponse { + return { + txBytes: new Uint8Array() + }; +} +export const TxEncodeResponse = { + typeUrl: "/cosmos.tx.v1beta1.TxEncodeResponse", + encode(message: TxEncodeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.txBytes.length !== 0) { + writer.uint32(10).bytes(message.txBytes); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): TxEncodeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxEncodeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.txBytes = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): TxEncodeResponse { + const message = createBaseTxEncodeResponse(); + message.txBytes = object.txBytes ?? new Uint8Array(); + return message; + }, + fromAmino(object: TxEncodeResponseAmino): TxEncodeResponse { + const message = createBaseTxEncodeResponse(); + if (object.tx_bytes !== undefined && object.tx_bytes !== null) { + message.txBytes = bytesFromBase64(object.tx_bytes); + } + return message; + }, + toAmino(message: TxEncodeResponse): TxEncodeResponseAmino { + const obj: any = {}; + obj.tx_bytes = message.txBytes ? base64FromBytes(message.txBytes) : undefined; + return obj; + }, + fromAminoMsg(object: TxEncodeResponseAminoMsg): TxEncodeResponse { + return TxEncodeResponse.fromAmino(object.value); + }, + toAminoMsg(message: TxEncodeResponse): TxEncodeResponseAminoMsg { + return { + type: "cosmos-sdk/TxEncodeResponse", + value: TxEncodeResponse.toAmino(message) + }; + }, + fromProtoMsg(message: TxEncodeResponseProtoMsg): TxEncodeResponse { + return TxEncodeResponse.decode(message.value); + }, + toProto(message: TxEncodeResponse): Uint8Array { + return TxEncodeResponse.encode(message).finish(); + }, + toProtoMsg(message: TxEncodeResponse): TxEncodeResponseProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.TxEncodeResponse", + value: TxEncodeResponse.encode(message).finish() + }; + } +}; +function createBaseTxEncodeAminoRequest(): TxEncodeAminoRequest { + return { + aminoJson: "" + }; +} +export const TxEncodeAminoRequest = { + typeUrl: "/cosmos.tx.v1beta1.TxEncodeAminoRequest", + encode(message: TxEncodeAminoRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.aminoJson !== "") { + writer.uint32(10).string(message.aminoJson); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): TxEncodeAminoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxEncodeAminoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.aminoJson = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): TxEncodeAminoRequest { + const message = createBaseTxEncodeAminoRequest(); + message.aminoJson = object.aminoJson ?? ""; + return message; + }, + fromAmino(object: TxEncodeAminoRequestAmino): TxEncodeAminoRequest { + const message = createBaseTxEncodeAminoRequest(); + if (object.amino_json !== undefined && object.amino_json !== null) { + message.aminoJson = object.amino_json; + } + return message; + }, + toAmino(message: TxEncodeAminoRequest): TxEncodeAminoRequestAmino { + const obj: any = {}; + obj.amino_json = message.aminoJson === "" ? undefined : message.aminoJson; + return obj; + }, + fromAminoMsg(object: TxEncodeAminoRequestAminoMsg): TxEncodeAminoRequest { + return TxEncodeAminoRequest.fromAmino(object.value); + }, + toAminoMsg(message: TxEncodeAminoRequest): TxEncodeAminoRequestAminoMsg { + return { + type: "cosmos-sdk/TxEncodeAminoRequest", + value: TxEncodeAminoRequest.toAmino(message) + }; + }, + fromProtoMsg(message: TxEncodeAminoRequestProtoMsg): TxEncodeAminoRequest { + return TxEncodeAminoRequest.decode(message.value); + }, + toProto(message: TxEncodeAminoRequest): Uint8Array { + return TxEncodeAminoRequest.encode(message).finish(); + }, + toProtoMsg(message: TxEncodeAminoRequest): TxEncodeAminoRequestProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.TxEncodeAminoRequest", + value: TxEncodeAminoRequest.encode(message).finish() + }; + } +}; +function createBaseTxEncodeAminoResponse(): TxEncodeAminoResponse { + return { + aminoBinary: new Uint8Array() + }; +} +export const TxEncodeAminoResponse = { + typeUrl: "/cosmos.tx.v1beta1.TxEncodeAminoResponse", + encode(message: TxEncodeAminoResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.aminoBinary.length !== 0) { + writer.uint32(10).bytes(message.aminoBinary); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): TxEncodeAminoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxEncodeAminoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.aminoBinary = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): TxEncodeAminoResponse { + const message = createBaseTxEncodeAminoResponse(); + message.aminoBinary = object.aminoBinary ?? new Uint8Array(); + return message; + }, + fromAmino(object: TxEncodeAminoResponseAmino): TxEncodeAminoResponse { + const message = createBaseTxEncodeAminoResponse(); + if (object.amino_binary !== undefined && object.amino_binary !== null) { + message.aminoBinary = bytesFromBase64(object.amino_binary); + } + return message; + }, + toAmino(message: TxEncodeAminoResponse): TxEncodeAminoResponseAmino { + const obj: any = {}; + obj.amino_binary = message.aminoBinary ? base64FromBytes(message.aminoBinary) : undefined; + return obj; + }, + fromAminoMsg(object: TxEncodeAminoResponseAminoMsg): TxEncodeAminoResponse { + return TxEncodeAminoResponse.fromAmino(object.value); + }, + toAminoMsg(message: TxEncodeAminoResponse): TxEncodeAminoResponseAminoMsg { + return { + type: "cosmos-sdk/TxEncodeAminoResponse", + value: TxEncodeAminoResponse.toAmino(message) + }; + }, + fromProtoMsg(message: TxEncodeAminoResponseProtoMsg): TxEncodeAminoResponse { + return TxEncodeAminoResponse.decode(message.value); + }, + toProto(message: TxEncodeAminoResponse): Uint8Array { + return TxEncodeAminoResponse.encode(message).finish(); + }, + toProtoMsg(message: TxEncodeAminoResponse): TxEncodeAminoResponseProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.TxEncodeAminoResponse", + value: TxEncodeAminoResponse.encode(message).finish() + }; + } +}; +function createBaseTxDecodeAminoRequest(): TxDecodeAminoRequest { + return { + aminoBinary: new Uint8Array() + }; +} +export const TxDecodeAminoRequest = { + typeUrl: "/cosmos.tx.v1beta1.TxDecodeAminoRequest", + encode(message: TxDecodeAminoRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.aminoBinary.length !== 0) { + writer.uint32(10).bytes(message.aminoBinary); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): TxDecodeAminoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxDecodeAminoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.aminoBinary = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): TxDecodeAminoRequest { + const message = createBaseTxDecodeAminoRequest(); + message.aminoBinary = object.aminoBinary ?? new Uint8Array(); + return message; + }, + fromAmino(object: TxDecodeAminoRequestAmino): TxDecodeAminoRequest { + const message = createBaseTxDecodeAminoRequest(); + if (object.amino_binary !== undefined && object.amino_binary !== null) { + message.aminoBinary = bytesFromBase64(object.amino_binary); + } + return message; + }, + toAmino(message: TxDecodeAminoRequest): TxDecodeAminoRequestAmino { + const obj: any = {}; + obj.amino_binary = message.aminoBinary ? base64FromBytes(message.aminoBinary) : undefined; + return obj; + }, + fromAminoMsg(object: TxDecodeAminoRequestAminoMsg): TxDecodeAminoRequest { + return TxDecodeAminoRequest.fromAmino(object.value); + }, + toAminoMsg(message: TxDecodeAminoRequest): TxDecodeAminoRequestAminoMsg { + return { + type: "cosmos-sdk/TxDecodeAminoRequest", + value: TxDecodeAminoRequest.toAmino(message) + }; + }, + fromProtoMsg(message: TxDecodeAminoRequestProtoMsg): TxDecodeAminoRequest { + return TxDecodeAminoRequest.decode(message.value); + }, + toProto(message: TxDecodeAminoRequest): Uint8Array { + return TxDecodeAminoRequest.encode(message).finish(); + }, + toProtoMsg(message: TxDecodeAminoRequest): TxDecodeAminoRequestProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.TxDecodeAminoRequest", + value: TxDecodeAminoRequest.encode(message).finish() + }; + } +}; +function createBaseTxDecodeAminoResponse(): TxDecodeAminoResponse { + return { + aminoJson: "" + }; +} +export const TxDecodeAminoResponse = { + typeUrl: "/cosmos.tx.v1beta1.TxDecodeAminoResponse", + encode(message: TxDecodeAminoResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.aminoJson !== "") { + writer.uint32(10).string(message.aminoJson); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): TxDecodeAminoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxDecodeAminoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.aminoJson = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): TxDecodeAminoResponse { + const message = createBaseTxDecodeAminoResponse(); + message.aminoJson = object.aminoJson ?? ""; + return message; + }, + fromAmino(object: TxDecodeAminoResponseAmino): TxDecodeAminoResponse { + const message = createBaseTxDecodeAminoResponse(); + if (object.amino_json !== undefined && object.amino_json !== null) { + message.aminoJson = object.amino_json; + } + return message; + }, + toAmino(message: TxDecodeAminoResponse): TxDecodeAminoResponseAmino { + const obj: any = {}; + obj.amino_json = message.aminoJson === "" ? undefined : message.aminoJson; + return obj; + }, + fromAminoMsg(object: TxDecodeAminoResponseAminoMsg): TxDecodeAminoResponse { + return TxDecodeAminoResponse.fromAmino(object.value); + }, + toAminoMsg(message: TxDecodeAminoResponse): TxDecodeAminoResponseAminoMsg { + return { + type: "cosmos-sdk/TxDecodeAminoResponse", + value: TxDecodeAminoResponse.toAmino(message) + }; + }, + fromProtoMsg(message: TxDecodeAminoResponseProtoMsg): TxDecodeAminoResponse { + return TxDecodeAminoResponse.decode(message.value); + }, + toProto(message: TxDecodeAminoResponse): Uint8Array { + return TxDecodeAminoResponse.encode(message).finish(); + }, + toProtoMsg(message: TxDecodeAminoResponse): TxDecodeAminoResponseProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.TxDecodeAminoResponse", + value: TxDecodeAminoResponse.encode(message).finish() + }; + } }; \ No newline at end of file diff --git a/packages/api/src/cosmos/tx/v1beta1/tx.ts b/packages/api/src/cosmos/tx/v1beta1/tx.ts index df340bd4..108e14c6 100644 --- a/packages/api/src/cosmos/tx/v1beta1/tx.ts +++ b/packages/api/src/cosmos/tx/v1beta1/tx.ts @@ -1,10 +1,11 @@ //@ts-nocheck import { Any, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { Timestamp } from "../../../google/protobuf/timestamp"; import { SignMode } from "../signing/v1beta1/signing"; import { CompactBitArray, CompactBitArrayAmino, CompactBitArraySDKType } from "../../crypto/multisig/v1beta1/multisig"; import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { bytesFromBase64, base64FromBytes, toTimestamp, fromTimestamp } from "../../../helpers"; /** Tx is the standard type used for broadcasting transactions. */ export interface Tx { /** body is the processable content of the transaction */ @@ -181,8 +182,6 @@ export interface SignDocSDKType { /** * SignDocDirectAux is the type used for generating sign bytes for * SIGN_MODE_DIRECT_AUX. - * - * Since: cosmos-sdk 0.46 */ export interface SignDocDirectAux { /** @@ -202,14 +201,8 @@ export interface SignDocDirectAux { accountNumber: bigint; /** sequence is the sequence number of the signing account. */ sequence: bigint; - /** - * Tip is the optional tip used for transactions fees paid in another denom. - * It should be left empty if the signer is not the tipper for this - * transaction. - * - * This field is ignored if the chain didn't enable tips, i.e. didn't add the - * `TipDecorator` in its posthandler. - */ + /** tips have been depreacted and should not be used */ + /** @deprecated */ tip?: Tip; } export interface SignDocDirectAuxProtoMsg { @@ -219,8 +212,6 @@ export interface SignDocDirectAuxProtoMsg { /** * SignDocDirectAux is the type used for generating sign bytes for * SIGN_MODE_DIRECT_AUX. - * - * Since: cosmos-sdk 0.46 */ export interface SignDocDirectAuxAmino { /** @@ -240,14 +231,8 @@ export interface SignDocDirectAuxAmino { account_number?: string; /** sequence is the sequence number of the signing account. */ sequence?: string; - /** - * Tip is the optional tip used for transactions fees paid in another denom. - * It should be left empty if the signer is not the tipper for this - * transaction. - * - * This field is ignored if the chain didn't enable tips, i.e. didn't add the - * `TipDecorator` in its posthandler. - */ + /** tips have been depreacted and should not be used */ + /** @deprecated */ tip?: TipAmino; } export interface SignDocDirectAuxAminoMsg { @@ -257,8 +242,6 @@ export interface SignDocDirectAuxAminoMsg { /** * SignDocDirectAux is the type used for generating sign bytes for * SIGN_MODE_DIRECT_AUX. - * - * Since: cosmos-sdk 0.46 */ export interface SignDocDirectAuxSDKType { body_bytes: Uint8Array; @@ -266,6 +249,7 @@ export interface SignDocDirectAuxSDKType { chain_id: string; account_number: bigint; sequence: bigint; + /** @deprecated */ tip?: TipSDKType; } /** TxBody is the body of a transaction that all signers sign over. */ @@ -283,14 +267,40 @@ export interface TxBody { /** * memo is any arbitrary note/comment to be added to the transaction. * WARNING: in clients, any publicly exposed text should not be called memo, - * but should be called `note` instead (see https://github.com/cosmos/cosmos-sdk/issues/9122). + * but should be called `note` instead (see + * https://github.com/cosmos/cosmos-sdk/issues/9122). */ memo: string; /** - * timeout is the block height after which this transaction will not - * be processed by the chain + * timeout_height is the block height after which this transaction will not + * be processed by the chain. */ timeoutHeight: bigint; + /** + * unordered, when set to true, indicates that the transaction signer(s) + * intend for the transaction to be evaluated and executed in an un-ordered + * fashion. Specifically, the account's nonce will NOT be checked or + * incremented, which allows for fire-and-forget as well as concurrent + * transaction execution. + * + * Note, when set to true, the existing 'timeout_timestamp' value must + * be set and will be used to correspond to a timestamp in which the transaction is deemed + * valid. + * + * When true, the sequence value MUST be 0, and any transaction with unordered=true and a non-zero sequence value will + * be rejected. + * External services that make assumptions about sequence values may need to be updated because of this. + */ + unordered: boolean; + /** + * timeout_timestamp is the block time after which this transaction will not + * be processed by the chain. + * + * Note, if unordered=true this value MUST be set + * and will act as a short-lived TTL in which the transaction is deemed valid + * and kept in memory to prevent duplicates. + */ + timeoutTimestamp?: Date; /** * extension_options are arbitrary options that can be added by chains * when the default options are not sufficient. If any of these are present @@ -323,14 +333,40 @@ export interface TxBodyAmino { /** * memo is any arbitrary note/comment to be added to the transaction. * WARNING: in clients, any publicly exposed text should not be called memo, - * but should be called `note` instead (see https://github.com/cosmos/cosmos-sdk/issues/9122). + * but should be called `note` instead (see + * https://github.com/cosmos/cosmos-sdk/issues/9122). */ memo?: string; /** - * timeout is the block height after which this transaction will not - * be processed by the chain + * timeout_height is the block height after which this transaction will not + * be processed by the chain. */ timeout_height?: string; + /** + * unordered, when set to true, indicates that the transaction signer(s) + * intend for the transaction to be evaluated and executed in an un-ordered + * fashion. Specifically, the account's nonce will NOT be checked or + * incremented, which allows for fire-and-forget as well as concurrent + * transaction execution. + * + * Note, when set to true, the existing 'timeout_timestamp' value must + * be set and will be used to correspond to a timestamp in which the transaction is deemed + * valid. + * + * When true, the sequence value MUST be 0, and any transaction with unordered=true and a non-zero sequence value will + * be rejected. + * External services that make assumptions about sequence values may need to be updated because of this. + */ + unordered?: boolean; + /** + * timeout_timestamp is the block time after which this transaction will not + * be processed by the chain. + * + * Note, if unordered=true this value MUST be set + * and will act as a short-lived TTL in which the transaction is deemed valid + * and kept in memory to prevent duplicates. + */ + timeout_timestamp?: string; /** * extension_options are arbitrary options that can be added by chains * when the default options are not sufficient. If any of these are present @@ -353,6 +389,8 @@ export interface TxBodySDKType { messages: AnySDKType[]; memo: string; timeout_height: bigint; + unordered: boolean; + timeout_timestamp?: Date; extension_options: AnySDKType[]; non_critical_extension_options: AnySDKType[]; } @@ -380,9 +418,8 @@ export interface AuthInfo { * * This field is ignored if the chain didn't enable tips, i.e. didn't add the * `TipDecorator` in its posthandler. - * - * Since: cosmos-sdk 0.46 */ + /** @deprecated */ tip?: Tip; } export interface AuthInfoProtoMsg { @@ -413,9 +450,8 @@ export interface AuthInfoAmino { * * This field is ignored if the chain didn't enable tips, i.e. didn't add the * `TipDecorator` in its posthandler. - * - * Since: cosmos-sdk 0.46 */ + /** @deprecated */ tip?: TipAmino; } export interface AuthInfoAminoMsg { @@ -429,6 +465,7 @@ export interface AuthInfoAminoMsg { export interface AuthInfoSDKType { signer_infos: SignerInfoSDKType[]; fee?: FeeSDKType; + /** @deprecated */ tip?: TipSDKType; } /** @@ -602,15 +639,17 @@ export interface Fee { */ gasLimit: bigint; /** - * if unset, the first signer is responsible for paying the fees. If set, the specified account must pay the fees. - * the payer must be a tx signer (and thus have signed this field in AuthInfo). - * setting this field does *not* change the ordering of required signers for the transaction. + * if unset, the first signer is responsible for paying the fees. If set, the + * specified account must pay the fees. the payer must be a tx signer (and + * thus have signed this field in AuthInfo). setting this field does *not* + * change the ordering of required signers for the transaction. */ payer: string; /** - * if set, the fee payer (either the first signer or the value of the payer field) requests that a fee grant be used - * to pay fees instead of the fee payer's own balance. If an appropriate fee grant does not exist or the chain does - * not support fee grants, this will fail + * if set, the fee payer (either the first signer or the value of the payer + * field) requests that a fee grant be used to pay fees instead of the fee + * payer's own balance. If an appropriate fee grant does not exist or the + * chain does not support fee grants, this will fail */ granter: string; } @@ -625,22 +664,24 @@ export interface FeeProtoMsg { */ export interface FeeAmino { /** amount is the amount of coins to be paid as a fee */ - amount?: CoinAmino[]; + amount: CoinAmino[]; /** * gas_limit is the maximum gas that can be used in transaction processing * before an out of gas error occurs */ gas_limit?: string; /** - * if unset, the first signer is responsible for paying the fees. If set, the specified account must pay the fees. - * the payer must be a tx signer (and thus have signed this field in AuthInfo). - * setting this field does *not* change the ordering of required signers for the transaction. + * if unset, the first signer is responsible for paying the fees. If set, the + * specified account must pay the fees. the payer must be a tx signer (and + * thus have signed this field in AuthInfo). setting this field does *not* + * change the ordering of required signers for the transaction. */ payer?: string; /** - * if set, the fee payer (either the first signer or the value of the payer field) requests that a fee grant be used - * to pay fees instead of the fee payer's own balance. If an appropriate fee grant does not exist or the chain does - * not support fee grants, this will fail + * if set, the fee payer (either the first signer or the value of the payer + * field) requests that a fee grant be used to pay fees instead of the fee + * payer's own balance. If an appropriate fee grant does not exist or the + * chain does not support fee grants, this will fail */ granter?: string; } @@ -659,11 +700,8 @@ export interface FeeSDKType { payer: string; granter: string; } -/** - * Tip is the tip used for meta-transactions. - * - * Since: cosmos-sdk 0.46 - */ +/** Tip is the tip used for meta-transactions. */ +/** @deprecated */ export interface Tip { /** amount is the amount of the tip */ amount: Coin[]; @@ -674,14 +712,11 @@ export interface TipProtoMsg { typeUrl: "/cosmos.tx.v1beta1.Tip"; value: Uint8Array; } -/** - * Tip is the tip used for meta-transactions. - * - * Since: cosmos-sdk 0.46 - */ +/** Tip is the tip used for meta-transactions. */ +/** @deprecated */ export interface TipAmino { /** amount is the amount of the tip */ - amount?: CoinAmino[]; + amount: CoinAmino[]; /** tipper is the address of the account paying for the tip */ tipper?: string; } @@ -689,11 +724,8 @@ export interface TipAminoMsg { type: "cosmos-sdk/Tip"; value: TipAmino; } -/** - * Tip is the tip used for meta-transactions. - * - * Since: cosmos-sdk 0.46 - */ +/** Tip is the tip used for meta-transactions. */ +/** @deprecated */ export interface TipSDKType { amount: CoinSDKType[]; tipper: string; @@ -703,8 +735,6 @@ export interface TipSDKType { * tipper) builds and sends to the fee payer (who will build and broadcast the * actual tx). AuxSignerData is not a valid tx in itself, and will be rejected * by the node if sent directly as-is. - * - * Since: cosmos-sdk 0.46 */ export interface AuxSignerData { /** @@ -733,8 +763,6 @@ export interface AuxSignerDataProtoMsg { * tipper) builds and sends to the fee payer (who will build and broadcast the * actual tx). AuxSignerData is not a valid tx in itself, and will be rejected * by the node if sent directly as-is. - * - * Since: cosmos-sdk 0.46 */ export interface AuxSignerDataAmino { /** @@ -763,8 +791,6 @@ export interface AuxSignerDataAminoMsg { * tipper) builds and sends to the fee payer (who will build and broadcast the * actual tx). AuxSignerData is not a valid tx in itself, and will be rejected * by the node if sent directly as-is. - * - * Since: cosmos-sdk 0.46 */ export interface AuxSignerDataSDKType { address: string; @@ -1201,6 +1227,8 @@ function createBaseTxBody(): TxBody { messages: [], memo: "", timeoutHeight: BigInt(0), + unordered: false, + timeoutTimestamp: undefined, extensionOptions: [], nonCriticalExtensionOptions: [] }; @@ -1217,6 +1245,12 @@ export const TxBody = { if (message.timeoutHeight !== BigInt(0)) { writer.uint32(24).uint64(message.timeoutHeight); } + if (message.unordered === true) { + writer.uint32(32).bool(message.unordered); + } + if (message.timeoutTimestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timeoutTimestamp), writer.uint32(42).fork()).ldelim(); + } for (const v of message.extensionOptions) { Any.encode(v!, writer.uint32(8186).fork()).ldelim(); } @@ -1241,6 +1275,12 @@ export const TxBody = { case 3: message.timeoutHeight = reader.uint64(); break; + case 4: + message.unordered = reader.bool(); + break; + case 5: + message.timeoutTimestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; case 1023: message.extensionOptions.push(Any.decode(reader, reader.uint32())); break; @@ -1259,6 +1299,8 @@ export const TxBody = { message.messages = object.messages?.map(e => Any.fromPartial(e)) || []; message.memo = object.memo ?? ""; message.timeoutHeight = object.timeoutHeight !== undefined && object.timeoutHeight !== null ? BigInt(object.timeoutHeight.toString()) : BigInt(0); + message.unordered = object.unordered ?? false; + message.timeoutTimestamp = object.timeoutTimestamp ?? undefined; message.extensionOptions = object.extensionOptions?.map(e => Any.fromPartial(e)) || []; message.nonCriticalExtensionOptions = object.nonCriticalExtensionOptions?.map(e => Any.fromPartial(e)) || []; return message; @@ -1272,6 +1314,12 @@ export const TxBody = { if (object.timeout_height !== undefined && object.timeout_height !== null) { message.timeoutHeight = BigInt(object.timeout_height); } + if (object.unordered !== undefined && object.unordered !== null) { + message.unordered = object.unordered; + } + if (object.timeout_timestamp !== undefined && object.timeout_timestamp !== null) { + message.timeoutTimestamp = fromTimestamp(Timestamp.fromAmino(object.timeout_timestamp)); + } message.extensionOptions = object.extension_options?.map(e => Any.fromAmino(e)) || []; message.nonCriticalExtensionOptions = object.non_critical_extension_options?.map(e => Any.fromAmino(e)) || []; return message; @@ -1285,6 +1333,8 @@ export const TxBody = { } obj.memo = message.memo === "" ? undefined : message.memo; obj.timeout_height = message.timeoutHeight !== BigInt(0) ? message.timeoutHeight?.toString() : undefined; + obj.unordered = message.unordered === false ? undefined : message.unordered; + obj.timeout_timestamp = message.timeoutTimestamp ? Timestamp.toAmino(toTimestamp(message.timeoutTimestamp)) : undefined; if (message.extensionOptions) { obj.extension_options = message.extensionOptions.map(e => e ? Any.toAmino(e) : undefined); } else { diff --git a/packages/api/src/cosmos/upgrade/module/v1/module.ts b/packages/api/src/cosmos/upgrade/module/v1/module.ts new file mode 100644 index 00000000..dd2bc81e --- /dev/null +++ b/packages/api/src/cosmos/upgrade/module/v1/module.ts @@ -0,0 +1,93 @@ +//@ts-nocheck +import { BinaryReader, BinaryWriter } from "../../../../binary"; +/** Module is the config object of the upgrade module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} +export interface ModuleProtoMsg { + typeUrl: "/cosmos.upgrade.module.v1.Module"; + value: Uint8Array; +} +/** Module is the config object of the upgrade module. */ +export interface ModuleAmino { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority?: string; +} +export interface ModuleAminoMsg { + type: "cosmos-sdk/Module"; + value: ModuleAmino; +} +/** Module is the config object of the upgrade module. */ +export interface ModuleSDKType { + authority: string; +} +function createBaseModule(): Module { + return { + authority: "" + }; +} +export const Module = { + typeUrl: "/cosmos.upgrade.module.v1.Module", + encode(message: Module, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, + fromAmino(object: ModuleAmino): Module { + const message = createBaseModule(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + return message; + }, + toAmino(message: Module): ModuleAmino { + const obj: any = {}; + obj.authority = message.authority === "" ? undefined : message.authority; + return obj; + }, + fromAminoMsg(object: ModuleAminoMsg): Module { + return Module.fromAmino(object.value); + }, + toAminoMsg(message: Module): ModuleAminoMsg { + return { + type: "cosmos-sdk/Module", + value: Module.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleProtoMsg): Module { + return Module.decode(message.value); + }, + toProto(message: Module): Uint8Array { + return Module.encode(message).finish(); + }, + toProtoMsg(message: Module): ModuleProtoMsg { + return { + typeUrl: "/cosmos.upgrade.module.v1.Module", + value: Module.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/upgrade/v1beta1/query.lcd.ts b/packages/api/src/cosmos/upgrade/v1beta1/query.lcd.ts index 5332acf6..1fb16468 100644 --- a/packages/api/src/cosmos/upgrade/v1beta1/query.lcd.ts +++ b/packages/api/src/cosmos/upgrade/v1beta1/query.lcd.ts @@ -35,9 +35,7 @@ export class LCDQueryClient { const endpoint = `cosmos/upgrade/v1beta1/upgraded_consensus_state/${params.lastHeight}`; return await this.req.get(endpoint); } - /* ModuleVersions queries the list of module versions from state. - - Since: cosmos-sdk 0.43 */ + /* ModuleVersions queries the list of module versions from state. */ async moduleVersions(params: QueryModuleVersionsRequest): Promise { const options: any = { params: {} @@ -48,9 +46,7 @@ export class LCDQueryClient { const endpoint = `cosmos/upgrade/v1beta1/module_versions`; return await this.req.get(endpoint, options); } - /* Returns the account with authority to conduct upgrades - - Since: cosmos-sdk 0.46 */ + /* Returns the account with authority to conduct upgrades */ async authority(_params: QueryAuthorityRequest = {}): Promise { const endpoint = `cosmos/upgrade/v1beta1/authority`; return await this.req.get(endpoint); diff --git a/packages/api/src/cosmos/upgrade/v1beta1/query.rpc.Query.ts b/packages/api/src/cosmos/upgrade/v1beta1/query.rpc.Query.ts index e7ab8848..7a44818d 100644 --- a/packages/api/src/cosmos/upgrade/v1beta1/query.rpc.Query.ts +++ b/packages/api/src/cosmos/upgrade/v1beta1/query.rpc.Query.ts @@ -18,17 +18,9 @@ export interface Query { * (https://github.com/cosmos/ibc-go/blob/2c880a22e9f9cc75f62b527ca94aa75ce1106001/proto/ibc/core/client/v1/query.proto#L54) */ upgradedConsensusState(request: QueryUpgradedConsensusStateRequest): Promise; - /** - * ModuleVersions queries the list of module versions from state. - * - * Since: cosmos-sdk 0.43 - */ + /** ModuleVersions queries the list of module versions from state. */ moduleVersions(request: QueryModuleVersionsRequest): Promise; - /** - * Returns the account with authority to conduct upgrades - * - * Since: cosmos-sdk 0.46 - */ + /** Returns the account with authority to conduct upgrades */ authority(request?: QueryAuthorityRequest): Promise; } export class QueryClientImpl implements Query { diff --git a/packages/api/src/cosmos/upgrade/v1beta1/query.ts b/packages/api/src/cosmos/upgrade/v1beta1/query.ts index 126d5bb6..6c91e071 100644 --- a/packages/api/src/cosmos/upgrade/v1beta1/query.ts +++ b/packages/api/src/cosmos/upgrade/v1beta1/query.ts @@ -164,7 +164,6 @@ export interface QueryUpgradedConsensusStateRequestSDKType { */ /** @deprecated */ export interface QueryUpgradedConsensusStateResponse { - /** Since: cosmos-sdk 0.43 */ upgradedConsensusState: Uint8Array; } export interface QueryUpgradedConsensusStateResponseProtoMsg { @@ -177,7 +176,6 @@ export interface QueryUpgradedConsensusStateResponseProtoMsg { */ /** @deprecated */ export interface QueryUpgradedConsensusStateResponseAmino { - /** Since: cosmos-sdk 0.43 */ upgraded_consensus_state?: string; } export interface QueryUpgradedConsensusStateResponseAminoMsg { @@ -195,8 +193,6 @@ export interface QueryUpgradedConsensusStateResponseSDKType { /** * QueryModuleVersionsRequest is the request type for the Query/ModuleVersions * RPC method. - * - * Since: cosmos-sdk 0.43 */ export interface QueryModuleVersionsRequest { /** @@ -213,8 +209,6 @@ export interface QueryModuleVersionsRequestProtoMsg { /** * QueryModuleVersionsRequest is the request type for the Query/ModuleVersions * RPC method. - * - * Since: cosmos-sdk 0.43 */ export interface QueryModuleVersionsRequestAmino { /** @@ -231,8 +225,6 @@ export interface QueryModuleVersionsRequestAminoMsg { /** * QueryModuleVersionsRequest is the request type for the Query/ModuleVersions * RPC method. - * - * Since: cosmos-sdk 0.43 */ export interface QueryModuleVersionsRequestSDKType { module_name: string; @@ -240,8 +232,6 @@ export interface QueryModuleVersionsRequestSDKType { /** * QueryModuleVersionsResponse is the response type for the Query/ModuleVersions * RPC method. - * - * Since: cosmos-sdk 0.43 */ export interface QueryModuleVersionsResponse { /** module_versions is a list of module names with their consensus versions. */ @@ -254,8 +244,6 @@ export interface QueryModuleVersionsResponseProtoMsg { /** * QueryModuleVersionsResponse is the response type for the Query/ModuleVersions * RPC method. - * - * Since: cosmos-sdk 0.43 */ export interface QueryModuleVersionsResponseAmino { /** module_versions is a list of module names with their consensus versions. */ @@ -268,43 +256,25 @@ export interface QueryModuleVersionsResponseAminoMsg { /** * QueryModuleVersionsResponse is the response type for the Query/ModuleVersions * RPC method. - * - * Since: cosmos-sdk 0.43 */ export interface QueryModuleVersionsResponseSDKType { module_versions: ModuleVersionSDKType[]; } -/** - * QueryAuthorityRequest is the request type for Query/Authority - * - * Since: cosmos-sdk 0.46 - */ +/** QueryAuthorityRequest is the request type for Query/Authority */ export interface QueryAuthorityRequest {} export interface QueryAuthorityRequestProtoMsg { typeUrl: "/cosmos.upgrade.v1beta1.QueryAuthorityRequest"; value: Uint8Array; } -/** - * QueryAuthorityRequest is the request type for Query/Authority - * - * Since: cosmos-sdk 0.46 - */ +/** QueryAuthorityRequest is the request type for Query/Authority */ export interface QueryAuthorityRequestAmino {} export interface QueryAuthorityRequestAminoMsg { type: "cosmos-sdk/QueryAuthorityRequest"; value: QueryAuthorityRequestAmino; } -/** - * QueryAuthorityRequest is the request type for Query/Authority - * - * Since: cosmos-sdk 0.46 - */ +/** QueryAuthorityRequest is the request type for Query/Authority */ export interface QueryAuthorityRequestSDKType {} -/** - * QueryAuthorityResponse is the response type for Query/Authority - * - * Since: cosmos-sdk 0.46 - */ +/** QueryAuthorityResponse is the response type for Query/Authority */ export interface QueryAuthorityResponse { address: string; } @@ -312,11 +282,7 @@ export interface QueryAuthorityResponseProtoMsg { typeUrl: "/cosmos.upgrade.v1beta1.QueryAuthorityResponse"; value: Uint8Array; } -/** - * QueryAuthorityResponse is the response type for Query/Authority - * - * Since: cosmos-sdk 0.46 - */ +/** QueryAuthorityResponse is the response type for Query/Authority */ export interface QueryAuthorityResponseAmino { address?: string; } @@ -324,11 +290,7 @@ export interface QueryAuthorityResponseAminoMsg { type: "cosmos-sdk/QueryAuthorityResponse"; value: QueryAuthorityResponseAmino; } -/** - * QueryAuthorityResponse is the response type for Query/Authority - * - * Since: cosmos-sdk 0.46 - */ +/** QueryAuthorityResponse is the response type for Query/Authority */ export interface QueryAuthorityResponseSDKType { address: string; } diff --git a/packages/api/src/cosmos/upgrade/v1beta1/tx.rpc.msg.ts b/packages/api/src/cosmos/upgrade/v1beta1/tx.rpc.msg.ts index a4db6d5c..751b1b30 100644 --- a/packages/api/src/cosmos/upgrade/v1beta1/tx.rpc.msg.ts +++ b/packages/api/src/cosmos/upgrade/v1beta1/tx.rpc.msg.ts @@ -4,17 +4,11 @@ import { BinaryReader } from "../../../binary"; import { MsgSoftwareUpgrade, MsgSoftwareUpgradeResponse, MsgCancelUpgrade, MsgCancelUpgradeResponse } from "./tx"; /** Msg defines the upgrade Msg service. */ export interface Msg { - /** - * SoftwareUpgrade is a governance operation for initiating a software upgrade. - * - * Since: cosmos-sdk 0.46 - */ + /** SoftwareUpgrade is a governance operation for initiating a software upgrade. */ softwareUpgrade(request: MsgSoftwareUpgrade): Promise; /** * CancelUpgrade is a governance operation for cancelling a previously - * approvid software upgrade. - * - * Since: cosmos-sdk 0.46 + * approved software upgrade. */ cancelUpgrade(request: MsgCancelUpgrade): Promise; } diff --git a/packages/api/src/cosmos/upgrade/v1beta1/tx.ts b/packages/api/src/cosmos/upgrade/v1beta1/tx.ts index c84bbdd3..58ec93c8 100644 --- a/packages/api/src/cosmos/upgrade/v1beta1/tx.ts +++ b/packages/api/src/cosmos/upgrade/v1beta1/tx.ts @@ -1,13 +1,9 @@ //@ts-nocheck import { Plan, PlanAmino, PlanSDKType } from "./upgrade"; import { BinaryReader, BinaryWriter } from "../../../binary"; -/** - * MsgSoftwareUpgrade is the Msg/SoftwareUpgrade request type. - * - * Since: cosmos-sdk 0.46 - */ +/** MsgSoftwareUpgrade is the Msg/SoftwareUpgrade request type. */ export interface MsgSoftwareUpgrade { - /** authority is the address of the governance account. */ + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ authority: string; /** plan is the upgrade plan. */ plan: Plan; @@ -16,115 +12,71 @@ export interface MsgSoftwareUpgradeProtoMsg { typeUrl: "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade"; value: Uint8Array; } -/** - * MsgSoftwareUpgrade is the Msg/SoftwareUpgrade request type. - * - * Since: cosmos-sdk 0.46 - */ +/** MsgSoftwareUpgrade is the Msg/SoftwareUpgrade request type. */ export interface MsgSoftwareUpgradeAmino { - /** authority is the address of the governance account. */ + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ authority?: string; /** plan is the upgrade plan. */ - plan?: PlanAmino; + plan: PlanAmino; } export interface MsgSoftwareUpgradeAminoMsg { type: "cosmos-sdk/MsgSoftwareUpgrade"; value: MsgSoftwareUpgradeAmino; } -/** - * MsgSoftwareUpgrade is the Msg/SoftwareUpgrade request type. - * - * Since: cosmos-sdk 0.46 - */ +/** MsgSoftwareUpgrade is the Msg/SoftwareUpgrade request type. */ export interface MsgSoftwareUpgradeSDKType { authority: string; plan: PlanSDKType; } -/** - * MsgSoftwareUpgradeResponse is the Msg/SoftwareUpgrade response type. - * - * Since: cosmos-sdk 0.46 - */ +/** MsgSoftwareUpgradeResponse is the Msg/SoftwareUpgrade response type. */ export interface MsgSoftwareUpgradeResponse {} export interface MsgSoftwareUpgradeResponseProtoMsg { typeUrl: "/cosmos.upgrade.v1beta1.MsgSoftwareUpgradeResponse"; value: Uint8Array; } -/** - * MsgSoftwareUpgradeResponse is the Msg/SoftwareUpgrade response type. - * - * Since: cosmos-sdk 0.46 - */ +/** MsgSoftwareUpgradeResponse is the Msg/SoftwareUpgrade response type. */ export interface MsgSoftwareUpgradeResponseAmino {} export interface MsgSoftwareUpgradeResponseAminoMsg { type: "cosmos-sdk/MsgSoftwareUpgradeResponse"; value: MsgSoftwareUpgradeResponseAmino; } -/** - * MsgSoftwareUpgradeResponse is the Msg/SoftwareUpgrade response type. - * - * Since: cosmos-sdk 0.46 - */ +/** MsgSoftwareUpgradeResponse is the Msg/SoftwareUpgrade response type. */ export interface MsgSoftwareUpgradeResponseSDKType {} -/** - * MsgCancelUpgrade is the Msg/CancelUpgrade request type. - * - * Since: cosmos-sdk 0.46 - */ +/** MsgCancelUpgrade is the Msg/CancelUpgrade request type. */ export interface MsgCancelUpgrade { - /** authority is the address of the governance account. */ + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ authority: string; } export interface MsgCancelUpgradeProtoMsg { typeUrl: "/cosmos.upgrade.v1beta1.MsgCancelUpgrade"; value: Uint8Array; } -/** - * MsgCancelUpgrade is the Msg/CancelUpgrade request type. - * - * Since: cosmos-sdk 0.46 - */ +/** MsgCancelUpgrade is the Msg/CancelUpgrade request type. */ export interface MsgCancelUpgradeAmino { - /** authority is the address of the governance account. */ + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ authority?: string; } export interface MsgCancelUpgradeAminoMsg { type: "cosmos-sdk/MsgCancelUpgrade"; value: MsgCancelUpgradeAmino; } -/** - * MsgCancelUpgrade is the Msg/CancelUpgrade request type. - * - * Since: cosmos-sdk 0.46 - */ +/** MsgCancelUpgrade is the Msg/CancelUpgrade request type. */ export interface MsgCancelUpgradeSDKType { authority: string; } -/** - * MsgCancelUpgradeResponse is the Msg/CancelUpgrade response type. - * - * Since: cosmos-sdk 0.46 - */ +/** MsgCancelUpgradeResponse is the Msg/CancelUpgrade response type. */ export interface MsgCancelUpgradeResponse {} export interface MsgCancelUpgradeResponseProtoMsg { typeUrl: "/cosmos.upgrade.v1beta1.MsgCancelUpgradeResponse"; value: Uint8Array; } -/** - * MsgCancelUpgradeResponse is the Msg/CancelUpgrade response type. - * - * Since: cosmos-sdk 0.46 - */ +/** MsgCancelUpgradeResponse is the Msg/CancelUpgrade response type. */ export interface MsgCancelUpgradeResponseAmino {} export interface MsgCancelUpgradeResponseAminoMsg { type: "cosmos-sdk/MsgCancelUpgradeResponse"; value: MsgCancelUpgradeResponseAmino; } -/** - * MsgCancelUpgradeResponse is the Msg/CancelUpgrade response type. - * - * Since: cosmos-sdk 0.46 - */ +/** MsgCancelUpgradeResponse is the Msg/CancelUpgrade response type. */ export interface MsgCancelUpgradeResponseSDKType {} function createBaseMsgSoftwareUpgrade(): MsgSoftwareUpgrade { return { @@ -182,7 +134,7 @@ export const MsgSoftwareUpgrade = { toAmino(message: MsgSoftwareUpgrade): MsgSoftwareUpgradeAmino { const obj: any = {}; obj.authority = message.authority === "" ? undefined : message.authority; - obj.plan = message.plan ? Plan.toAmino(message.plan) : undefined; + obj.plan = message.plan ? Plan.toAmino(message.plan) : Plan.toAmino(Plan.fromPartial({})); return obj; }, fromAminoMsg(object: MsgSoftwareUpgradeAminoMsg): MsgSoftwareUpgrade { diff --git a/packages/api/src/cosmos/upgrade/v1beta1/upgrade.ts b/packages/api/src/cosmos/upgrade/v1beta1/upgrade.ts index 701ead87..198737bb 100644 --- a/packages/api/src/cosmos/upgrade/v1beta1/upgrade.ts +++ b/packages/api/src/cosmos/upgrade/v1beta1/upgrade.ts @@ -22,10 +22,7 @@ export interface Plan { */ /** @deprecated */ time: Date; - /** - * The height at which the upgrade must be performed. - * Only used if Time is not set. - */ + /** The height at which the upgrade must be performed. */ height: bigint; /** * Any application specific upgrade info to be included on-chain @@ -62,11 +59,8 @@ export interface PlanAmino { * If this field is not empty, an error will be thrown. */ /** @deprecated */ - time?: string; - /** - * The height at which the upgrade must be performed. - * Only used if Time is not set. - */ + time: string; + /** The height at which the upgrade must be performed. */ height?: string; /** * Any application specific upgrade info to be included on-chain @@ -104,8 +98,11 @@ export interface PlanSDKType { /** @deprecated */ export interface SoftwareUpgradeProposal { $typeUrl?: "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal"; + /** title of the proposal */ title: string; + /** description of the proposal */ description: string; + /** plan of the proposal */ plan: Plan; } export interface SoftwareUpgradeProposalProtoMsg { @@ -120,9 +117,12 @@ export interface SoftwareUpgradeProposalProtoMsg { */ /** @deprecated */ export interface SoftwareUpgradeProposalAmino { + /** title of the proposal */ title?: string; + /** description of the proposal */ description?: string; - plan?: PlanAmino; + /** plan of the proposal */ + plan: PlanAmino; } export interface SoftwareUpgradeProposalAminoMsg { type: "cosmos-sdk/SoftwareUpgradeProposal"; @@ -150,7 +150,9 @@ export interface SoftwareUpgradeProposalSDKType { /** @deprecated */ export interface CancelSoftwareUpgradeProposal { $typeUrl?: "/cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal"; + /** title of the proposal */ title: string; + /** description of the proposal */ description: string; } export interface CancelSoftwareUpgradeProposalProtoMsg { @@ -165,7 +167,9 @@ export interface CancelSoftwareUpgradeProposalProtoMsg { */ /** @deprecated */ export interface CancelSoftwareUpgradeProposalAmino { + /** title of the proposal */ title?: string; + /** description of the proposal */ description?: string; } export interface CancelSoftwareUpgradeProposalAminoMsg { @@ -184,11 +188,7 @@ export interface CancelSoftwareUpgradeProposalSDKType { title: string; description: string; } -/** - * ModuleVersion specifies a module and its consensus version. - * - * Since: cosmos-sdk 0.43 - */ +/** ModuleVersion specifies a module and its consensus version. */ export interface ModuleVersion { /** name of the app module */ name: string; @@ -199,11 +199,7 @@ export interface ModuleVersionProtoMsg { typeUrl: "/cosmos.upgrade.v1beta1.ModuleVersion"; value: Uint8Array; } -/** - * ModuleVersion specifies a module and its consensus version. - * - * Since: cosmos-sdk 0.43 - */ +/** ModuleVersion specifies a module and its consensus version. */ export interface ModuleVersionAmino { /** name of the app module */ name?: string; @@ -214,11 +210,7 @@ export interface ModuleVersionAminoMsg { type: "cosmos-sdk/ModuleVersion"; value: ModuleVersionAmino; } -/** - * ModuleVersion specifies a module and its consensus version. - * - * Since: cosmos-sdk 0.43 - */ +/** ModuleVersion specifies a module and its consensus version. */ export interface ModuleVersionSDKType { name: string; version: bigint; @@ -312,7 +304,7 @@ export const Plan = { toAmino(message: Plan): PlanAmino { const obj: any = {}; obj.name = message.name === "" ? undefined : message.name; - obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; + obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : new Date(); obj.height = message.height !== BigInt(0) ? message.height?.toString() : undefined; obj.info = message.info === "" ? undefined : message.info; obj.upgraded_client_state = message.upgradedClientState ? Any.toAmino(message.upgradedClientState) : undefined; @@ -409,7 +401,7 @@ export const SoftwareUpgradeProposal = { const obj: any = {}; obj.title = message.title === "" ? undefined : message.title; obj.description = message.description === "" ? undefined : message.description; - obj.plan = message.plan ? Plan.toAmino(message.plan) : undefined; + obj.plan = message.plan ? Plan.toAmino(message.plan) : Plan.toAmino(Plan.fromPartial({})); return obj; }, fromAminoMsg(object: SoftwareUpgradeProposalAminoMsg): SoftwareUpgradeProposal { diff --git a/packages/api/src/cosmos/vesting/module/v1/module.ts b/packages/api/src/cosmos/vesting/module/v1/module.ts new file mode 100644 index 00000000..44b70365 --- /dev/null +++ b/packages/api/src/cosmos/vesting/module/v1/module.ts @@ -0,0 +1,72 @@ +//@ts-nocheck +import { BinaryReader, BinaryWriter } from "../../../../binary"; +/** Module is the config object of the vesting module. */ +export interface Module {} +export interface ModuleProtoMsg { + typeUrl: "/cosmos.vesting.module.v1.Module"; + value: Uint8Array; +} +/** Module is the config object of the vesting module. */ +export interface ModuleAmino {} +export interface ModuleAminoMsg { + type: "cosmos-sdk/Module"; + value: ModuleAmino; +} +/** Module is the config object of the vesting module. */ +export interface ModuleSDKType {} +function createBaseModule(): Module { + return {}; +} +export const Module = { + typeUrl: "/cosmos.vesting.module.v1.Module", + encode(_: Module, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): Module { + const message = createBaseModule(); + return message; + }, + fromAmino(_: ModuleAmino): Module { + const message = createBaseModule(); + return message; + }, + toAmino(_: Module): ModuleAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: ModuleAminoMsg): Module { + return Module.fromAmino(object.value); + }, + toAminoMsg(message: Module): ModuleAminoMsg { + return { + type: "cosmos-sdk/Module", + value: Module.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleProtoMsg): Module { + return Module.decode(message.value); + }, + toProto(message: Module): Uint8Array { + return Module.encode(message).finish(); + }, + toProtoMsg(message: Module): ModuleProtoMsg { + return { + typeUrl: "/cosmos.vesting.module.v1.Module", + value: Module.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/packages/api/src/cosmos/vesting/v1beta1/tx.amino.ts b/packages/api/src/cosmos/vesting/v1beta1/tx.amino.ts index b918e6d3..77acb32b 100644 --- a/packages/api/src/cosmos/vesting/v1beta1/tx.amino.ts +++ b/packages/api/src/cosmos/vesting/v1beta1/tx.amino.ts @@ -7,12 +7,12 @@ export const AminoConverter = { fromAmino: MsgCreateVestingAccount.fromAmino }, "/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount": { - aminoType: "cosmos-sdk/MsgCreatePermanentLockedAccount", + aminoType: "cosmos-sdk/MsgCreatePermLockedAccount", toAmino: MsgCreatePermanentLockedAccount.toAmino, fromAmino: MsgCreatePermanentLockedAccount.fromAmino }, "/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount": { - aminoType: "cosmos-sdk/MsgCreatePeriodicVestingAccount", + aminoType: "cosmos-sdk/MsgCreatePeriodVestAccount", toAmino: MsgCreatePeriodicVestingAccount.toAmino, fromAmino: MsgCreatePeriodicVestingAccount.fromAmino } diff --git a/packages/api/src/cosmos/vesting/v1beta1/tx.rpc.msg.ts b/packages/api/src/cosmos/vesting/v1beta1/tx.rpc.msg.ts index b4a6a543..8359d9cd 100644 --- a/packages/api/src/cosmos/vesting/v1beta1/tx.rpc.msg.ts +++ b/packages/api/src/cosmos/vesting/v1beta1/tx.rpc.msg.ts @@ -12,15 +12,11 @@ export interface Msg { /** * CreatePermanentLockedAccount defines a method that enables creating a permanent * locked account. - * - * Since: cosmos-sdk 0.46 */ createPermanentLockedAccount(request: MsgCreatePermanentLockedAccount): Promise; /** * CreatePeriodicVestingAccount defines a method that enables creating a * periodic vesting account. - * - * Since: cosmos-sdk 0.46 */ createPeriodicVestingAccount(request: MsgCreatePeriodicVestingAccount): Promise; } diff --git a/packages/api/src/cosmos/vesting/v1beta1/tx.ts b/packages/api/src/cosmos/vesting/v1beta1/tx.ts index d1057ac9..9c5afe85 100644 --- a/packages/api/src/cosmos/vesting/v1beta1/tx.ts +++ b/packages/api/src/cosmos/vesting/v1beta1/tx.ts @@ -10,6 +10,7 @@ export interface MsgCreateVestingAccount { fromAddress: string; toAddress: string; amount: Coin[]; + /** end of vesting as unix time (in seconds). */ endTime: bigint; delayed: boolean; } @@ -24,7 +25,8 @@ export interface MsgCreateVestingAccountProtoMsg { export interface MsgCreateVestingAccountAmino { from_address?: string; to_address?: string; - amount?: CoinAmino[]; + amount: CoinAmino[]; + /** end of vesting as unix time (in seconds). */ end_time?: string; delayed?: boolean; } @@ -60,8 +62,6 @@ export interface MsgCreateVestingAccountResponseSDKType {} /** * MsgCreatePermanentLockedAccount defines a message that enables creating a permanent * locked account. - * - * Since: cosmos-sdk 0.46 */ export interface MsgCreatePermanentLockedAccount { fromAddress: string; @@ -75,64 +75,47 @@ export interface MsgCreatePermanentLockedAccountProtoMsg { /** * MsgCreatePermanentLockedAccount defines a message that enables creating a permanent * locked account. - * - * Since: cosmos-sdk 0.46 */ export interface MsgCreatePermanentLockedAccountAmino { from_address?: string; to_address?: string; - amount?: CoinAmino[]; + amount: CoinAmino[]; } export interface MsgCreatePermanentLockedAccountAminoMsg { - type: "cosmos-sdk/MsgCreatePermanentLockedAccount"; + type: "cosmos-sdk/MsgCreatePermLockedAccount"; value: MsgCreatePermanentLockedAccountAmino; } /** * MsgCreatePermanentLockedAccount defines a message that enables creating a permanent * locked account. - * - * Since: cosmos-sdk 0.46 */ export interface MsgCreatePermanentLockedAccountSDKType { from_address: string; to_address: string; amount: CoinSDKType[]; } -/** - * MsgCreatePermanentLockedAccountResponse defines the Msg/CreatePermanentLockedAccount response type. - * - * Since: cosmos-sdk 0.46 - */ +/** MsgCreatePermanentLockedAccountResponse defines the Msg/CreatePermanentLockedAccount response type. */ export interface MsgCreatePermanentLockedAccountResponse {} export interface MsgCreatePermanentLockedAccountResponseProtoMsg { typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse"; value: Uint8Array; } -/** - * MsgCreatePermanentLockedAccountResponse defines the Msg/CreatePermanentLockedAccount response type. - * - * Since: cosmos-sdk 0.46 - */ +/** MsgCreatePermanentLockedAccountResponse defines the Msg/CreatePermanentLockedAccount response type. */ export interface MsgCreatePermanentLockedAccountResponseAmino {} export interface MsgCreatePermanentLockedAccountResponseAminoMsg { type: "cosmos-sdk/MsgCreatePermanentLockedAccountResponse"; value: MsgCreatePermanentLockedAccountResponseAmino; } -/** - * MsgCreatePermanentLockedAccountResponse defines the Msg/CreatePermanentLockedAccount response type. - * - * Since: cosmos-sdk 0.46 - */ +/** MsgCreatePermanentLockedAccountResponse defines the Msg/CreatePermanentLockedAccount response type. */ export interface MsgCreatePermanentLockedAccountResponseSDKType {} /** * MsgCreateVestingAccount defines a message that enables creating a vesting * account. - * - * Since: cosmos-sdk 0.46 */ export interface MsgCreatePeriodicVestingAccount { fromAddress: string; toAddress: string; + /** start of vesting as unix time (in seconds). */ startTime: bigint; vestingPeriods: Period[]; } @@ -143,24 +126,21 @@ export interface MsgCreatePeriodicVestingAccountProtoMsg { /** * MsgCreateVestingAccount defines a message that enables creating a vesting * account. - * - * Since: cosmos-sdk 0.46 */ export interface MsgCreatePeriodicVestingAccountAmino { from_address?: string; to_address?: string; + /** start of vesting as unix time (in seconds). */ start_time?: string; - vesting_periods?: PeriodAmino[]; + vesting_periods: PeriodAmino[]; } export interface MsgCreatePeriodicVestingAccountAminoMsg { - type: "cosmos-sdk/MsgCreatePeriodicVestingAccount"; + type: "cosmos-sdk/MsgCreatePeriodVestAccount"; value: MsgCreatePeriodicVestingAccountAmino; } /** * MsgCreateVestingAccount defines a message that enables creating a vesting * account. - * - * Since: cosmos-sdk 0.46 */ export interface MsgCreatePeriodicVestingAccountSDKType { from_address: string; @@ -171,8 +151,6 @@ export interface MsgCreatePeriodicVestingAccountSDKType { /** * MsgCreateVestingAccountResponse defines the Msg/CreatePeriodicVestingAccount * response type. - * - * Since: cosmos-sdk 0.46 */ export interface MsgCreatePeriodicVestingAccountResponse {} export interface MsgCreatePeriodicVestingAccountResponseProtoMsg { @@ -182,8 +160,6 @@ export interface MsgCreatePeriodicVestingAccountResponseProtoMsg { /** * MsgCreateVestingAccountResponse defines the Msg/CreatePeriodicVestingAccount * response type. - * - * Since: cosmos-sdk 0.46 */ export interface MsgCreatePeriodicVestingAccountResponseAmino {} export interface MsgCreatePeriodicVestingAccountResponseAminoMsg { @@ -193,8 +169,6 @@ export interface MsgCreatePeriodicVestingAccountResponseAminoMsg { /** * MsgCreateVestingAccountResponse defines the Msg/CreatePeriodicVestingAccount * response type. - * - * Since: cosmos-sdk 0.46 */ export interface MsgCreatePeriodicVestingAccountResponseSDKType {} function createBaseMsgCreateVestingAccount(): MsgCreateVestingAccount { @@ -450,7 +424,7 @@ export const MsgCreatePermanentLockedAccount = { }, toAminoMsg(message: MsgCreatePermanentLockedAccount): MsgCreatePermanentLockedAccountAminoMsg { return { - type: "cosmos-sdk/MsgCreatePermanentLockedAccount", + type: "cosmos-sdk/MsgCreatePermLockedAccount", value: MsgCreatePermanentLockedAccount.toAmino(message) }; }, @@ -613,7 +587,7 @@ export const MsgCreatePeriodicVestingAccount = { }, toAminoMsg(message: MsgCreatePeriodicVestingAccount): MsgCreatePeriodicVestingAccountAminoMsg { return { - type: "cosmos-sdk/MsgCreatePeriodicVestingAccount", + type: "cosmos-sdk/MsgCreatePeriodVestAccount", value: MsgCreatePeriodicVestingAccount.toAmino(message) }; }, diff --git a/packages/api/src/cosmos/vesting/v1beta1/vesting.ts b/packages/api/src/cosmos/vesting/v1beta1/vesting.ts index 559cbe58..8135783d 100644 --- a/packages/api/src/cosmos/vesting/v1beta1/vesting.ts +++ b/packages/api/src/cosmos/vesting/v1beta1/vesting.ts @@ -11,6 +11,7 @@ export interface BaseVestingAccount { originalVesting: Coin[]; delegatedFree: Coin[]; delegatedVesting: Coin[]; + /** Vesting end time, as unix timestamp (in seconds). */ endTime: bigint; } export interface BaseVestingAccountProtoMsg { @@ -23,9 +24,10 @@ export interface BaseVestingAccountProtoMsg { */ export interface BaseVestingAccountAmino { base_account?: BaseAccountAmino; - original_vesting?: CoinAmino[]; - delegated_free?: CoinAmino[]; - delegated_vesting?: CoinAmino[]; + original_vesting: CoinAmino[]; + delegated_free: CoinAmino[]; + delegated_vesting: CoinAmino[]; + /** Vesting end time, as unix timestamp (in seconds). */ end_time?: string; } export interface BaseVestingAccountAminoMsg { @@ -49,6 +51,7 @@ export interface BaseVestingAccountSDKType { */ export interface ContinuousVestingAccount { baseVestingAccount?: BaseVestingAccount; + /** Vesting start time, as unix timestamp (in seconds). */ startTime: bigint; } export interface ContinuousVestingAccountProtoMsg { @@ -61,6 +64,7 @@ export interface ContinuousVestingAccountProtoMsg { */ export interface ContinuousVestingAccountAmino { base_vesting_account?: BaseVestingAccountAmino; + /** Vesting start time, as unix timestamp (in seconds). */ start_time?: string; } export interface ContinuousVestingAccountAminoMsg { @@ -109,6 +113,7 @@ export interface DelayedVestingAccountSDKType { } /** Period defines a length of time and amount of coins that will vest. */ export interface Period { + /** Period duration in seconds. */ length: bigint; amount: Coin[]; } @@ -118,8 +123,9 @@ export interface PeriodProtoMsg { } /** Period defines a length of time and amount of coins that will vest. */ export interface PeriodAmino { + /** Period duration in seconds. */ length?: string; - amount?: CoinAmino[]; + amount: CoinAmino[]; } export interface PeriodAminoMsg { type: "cosmos-sdk/Period"; @@ -150,7 +156,7 @@ export interface PeriodicVestingAccountProtoMsg { export interface PeriodicVestingAccountAmino { base_vesting_account?: BaseVestingAccountAmino; start_time?: string; - vesting_periods?: PeriodAmino[]; + vesting_periods: PeriodAmino[]; } export interface PeriodicVestingAccountAminoMsg { type: "cosmos-sdk/PeriodicVestingAccount"; @@ -169,8 +175,6 @@ export interface PeriodicVestingAccountSDKType { * PermanentLockedAccount implements the VestingAccount interface. It does * not ever release coins, locking them indefinitely. Coins in this account can * still be used for delegating and for governance votes even while locked. - * - * Since: cosmos-sdk 0.43 */ export interface PermanentLockedAccount { baseVestingAccount?: BaseVestingAccount; @@ -183,8 +187,6 @@ export interface PermanentLockedAccountProtoMsg { * PermanentLockedAccount implements the VestingAccount interface. It does * not ever release coins, locking them indefinitely. Coins in this account can * still be used for delegating and for governance votes even while locked. - * - * Since: cosmos-sdk 0.43 */ export interface PermanentLockedAccountAmino { base_vesting_account?: BaseVestingAccountAmino; @@ -197,8 +199,6 @@ export interface PermanentLockedAccountAminoMsg { * PermanentLockedAccount implements the VestingAccount interface. It does * not ever release coins, locking them indefinitely. Coins in this account can * still be used for delegating and for governance votes even while locked. - * - * Since: cosmos-sdk 0.43 */ export interface PermanentLockedAccountSDKType { base_vesting_account?: BaseVestingAccountSDKType; diff --git a/packages/api/src/gogoproto/bundle.ts b/packages/api/src/gogoproto/bundle.ts index 2ad5c4f1..8a0a9b93 100644 --- a/packages/api/src/gogoproto/bundle.ts +++ b/packages/api/src/gogoproto/bundle.ts @@ -1,5 +1,5 @@ //@ts-nocheck -import * as _67 from "./gogo"; +import * as _116 from "./gogo"; export const gogoproto = { - ..._67 + ..._116 }; \ No newline at end of file diff --git a/packages/api/src/google/bundle.ts b/packages/api/src/google/bundle.ts index 38f7522f..dd2eee46 100644 --- a/packages/api/src/google/bundle.ts +++ b/packages/api/src/google/bundle.ts @@ -1,13 +1,13 @@ //@ts-nocheck -import * as _120 from "./protobuf/descriptor"; -import * as _121 from "./protobuf/any"; -import * as _122 from "./protobuf/timestamp"; -import * as _123 from "./protobuf/duration"; +import * as _176 from "./protobuf/descriptor"; +import * as _177 from "./protobuf/any"; +import * as _178 from "./protobuf/timestamp"; +import * as _179 from "./protobuf/duration"; export namespace google { export const protobuf = { - ..._120, - ..._121, - ..._122, - ..._123 + ..._176, + ..._177, + ..._178, + ..._179 }; } \ No newline at end of file diff --git a/packages/api/src/ibc/applications/transfer/v1/authz.ts b/packages/api/src/ibc/applications/transfer/v1/authz.ts new file mode 100644 index 00000000..bea18ef7 --- /dev/null +++ b/packages/api/src/ibc/applications/transfer/v1/authz.ts @@ -0,0 +1,279 @@ +//@ts-nocheck +import { Coin, CoinAmino, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +/** 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[]; + /** + * allow list of memo strings, an empty list prohibits all memo strings; + * a list only with "*" permits any memo string + */ + allowedPacketData: 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 AllocationAmino { + /** the port on which the packet will be sent */ + source_port?: string; + /** the channel by which the packet will be sent */ + source_channel?: string; + /** spend limitation on the channel */ + spend_limit?: CoinAmino[]; + /** allow list of receivers, an empty allow list permits any receiver address */ + allow_list?: string[]; + /** + * allow list of memo strings, an empty list prohibits all memo strings; + * a list only with "*" permits any memo string + */ + allowed_packet_data?: string[]; +} +export interface AllocationAminoMsg { + type: "cosmos-sdk/Allocation"; + value: AllocationAmino; +} +/** 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[]; + allowed_packet_data: 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 TransferAuthorizationAmino { + /** port and channel amounts */ + allocations?: AllocationAmino[]; +} +export interface TransferAuthorizationAminoMsg { + type: "cosmos-sdk/TransferAuthorization"; + value: TransferAuthorizationAmino; +} +/** + * 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: [], + allowedPacketData: [] + }; +} +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!); + } + for (const v of message.allowedPacketData) { + writer.uint32(42).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; + case 5: + message.allowedPacketData.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + 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) || []; + message.allowedPacketData = object.allowedPacketData?.map(e => e) || []; + return message; + }, + fromAmino(object: AllocationAmino): Allocation { + const message = createBaseAllocation(); + if (object.source_port !== undefined && object.source_port !== null) { + message.sourcePort = object.source_port; + } + if (object.source_channel !== undefined && object.source_channel !== null) { + message.sourceChannel = object.source_channel; + } + message.spendLimit = object.spend_limit?.map(e => Coin.fromAmino(e)) || []; + message.allowList = object.allow_list?.map(e => e) || []; + message.allowedPacketData = object.allowed_packet_data?.map(e => e) || []; + return message; + }, + toAmino(message: Allocation): AllocationAmino { + const obj: any = {}; + obj.source_port = message.sourcePort === "" ? undefined : message.sourcePort; + obj.source_channel = message.sourceChannel === "" ? undefined : message.sourceChannel; + if (message.spendLimit) { + obj.spend_limit = message.spendLimit.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.spend_limit = message.spendLimit; + } + if (message.allowList) { + obj.allow_list = message.allowList.map(e => e); + } else { + obj.allow_list = message.allowList; + } + if (message.allowedPacketData) { + obj.allowed_packet_data = message.allowedPacketData.map(e => e); + } else { + obj.allowed_packet_data = message.allowedPacketData; + } + return obj; + }, + fromAminoMsg(object: AllocationAminoMsg): Allocation { + return Allocation.fromAmino(object.value); + }, + toAminoMsg(message: Allocation): AllocationAminoMsg { + return { + type: "cosmos-sdk/Allocation", + value: Allocation.toAmino(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; + }, + fromPartial(object: Partial): TransferAuthorization { + const message = createBaseTransferAuthorization(); + message.allocations = object.allocations?.map(e => Allocation.fromPartial(e)) || []; + return message; + }, + fromAmino(object: TransferAuthorizationAmino): TransferAuthorization { + const message = createBaseTransferAuthorization(); + message.allocations = object.allocations?.map(e => Allocation.fromAmino(e)) || []; + return message; + }, + toAmino(message: TransferAuthorization): TransferAuthorizationAmino { + const obj: any = {}; + if (message.allocations) { + obj.allocations = message.allocations.map(e => e ? Allocation.toAmino(e) : undefined); + } else { + obj.allocations = message.allocations; + } + return obj; + }, + fromAminoMsg(object: TransferAuthorizationAminoMsg): TransferAuthorization { + return TransferAuthorization.fromAmino(object.value); + }, + toAminoMsg(message: TransferAuthorization): TransferAuthorizationAminoMsg { + return { + type: "cosmos-sdk/TransferAuthorization", + value: TransferAuthorization.toAmino(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() + }; + } +}; \ No newline at end of file diff --git a/packages/api/src/ibc/applications/transfer/v1/denomtrace.ts b/packages/api/src/ibc/applications/transfer/v1/denomtrace.ts new file mode 100644 index 00000000..ea86e7cc --- /dev/null +++ b/packages/api/src/ibc/applications/transfer/v1/denomtrace.ts @@ -0,0 +1,128 @@ +//@ts-nocheck +import { BinaryReader, BinaryWriter } from "../../../../binary"; +/** + * DenomTrace contains the base denomination for ICS20 fungible tokens and the + * source tracing information path. + */ +/** @deprecated */ +export interface DenomTrace { + /** + * path defines the chain of port/channel identifiers used for tracing the + * source of the fungible token. + */ + path: string; + /** base denomination of the relayed fungible token. */ + baseDenom: string; +} +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. + */ +/** @deprecated */ +export interface DenomTraceAmino { + /** + * 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. */ + base_denom?: string; +} +export interface DenomTraceAminoMsg { + type: "cosmos-sdk/DenomTrace"; + value: DenomTraceAmino; +} +/** + * DenomTrace contains the base denomination for ICS20 fungible tokens and the + * source tracing information path. + */ +/** @deprecated */ +export interface DenomTraceSDKType { + path: string; + base_denom: string; +} +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; + }, + fromPartial(object: Partial): DenomTrace { + const message = createBaseDenomTrace(); + message.path = object.path ?? ""; + message.baseDenom = object.baseDenom ?? ""; + return message; + }, + fromAmino(object: DenomTraceAmino): DenomTrace { + const message = createBaseDenomTrace(); + if (object.path !== undefined && object.path !== null) { + message.path = object.path; + } + if (object.base_denom !== undefined && object.base_denom !== null) { + message.baseDenom = object.base_denom; + } + return message; + }, + toAmino(message: DenomTrace): DenomTraceAmino { + const obj: any = {}; + obj.path = message.path === "" ? undefined : message.path; + obj.base_denom = message.baseDenom === "" ? undefined : message.baseDenom; + return obj; + }, + fromAminoMsg(object: DenomTraceAminoMsg): DenomTrace { + return DenomTrace.fromAmino(object.value); + }, + toAminoMsg(message: DenomTrace): DenomTraceAminoMsg { + return { + type: "cosmos-sdk/DenomTrace", + value: DenomTrace.toAmino(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() + }; + } +}; \ No newline at end of file diff --git a/packages/api/src/ibc/applications/transfer/v1/genesis.ts b/packages/api/src/ibc/applications/transfer/v1/genesis.ts index 5b97f25a..cb9f900e 100644 --- a/packages/api/src/ibc/applications/transfer/v1/genesis.ts +++ b/packages/api/src/ibc/applications/transfer/v1/genesis.ts @@ -1,11 +1,18 @@ //@ts-nocheck -import { DenomTrace, DenomTraceAmino, DenomTraceSDKType, Params, ParamsAmino, ParamsSDKType } from "./transfer"; +import { Denom, DenomAmino, DenomSDKType } from "./token"; +import { Params, ParamsAmino, ParamsSDKType } from "./transfer"; +import { Coin, CoinAmino, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../../binary"; /** GenesisState defines the ibc-transfer genesis state */ export interface GenesisState { portId: string; - denomTraces: DenomTrace[]; + denoms: Denom[]; params: Params; + /** + * total_escrowed contains the total amount of tokens escrowed + * by the transfer module + */ + totalEscrowed: Coin[]; } export interface GenesisStateProtoMsg { typeUrl: "/ibc.applications.transfer.v1.GenesisState"; @@ -14,8 +21,13 @@ export interface GenesisStateProtoMsg { /** GenesisState defines the ibc-transfer genesis state */ export interface GenesisStateAmino { port_id?: string; - denom_traces?: DenomTraceAmino[]; + denoms?: DenomAmino[]; params?: ParamsAmino; + /** + * total_escrowed contains the total amount of tokens escrowed + * by the transfer module + */ + total_escrowed?: CoinAmino[]; } export interface GenesisStateAminoMsg { type: "cosmos-sdk/GenesisState"; @@ -24,14 +36,16 @@ export interface GenesisStateAminoMsg { /** GenesisState defines the ibc-transfer genesis state */ export interface GenesisStateSDKType { port_id: string; - denom_traces: DenomTraceSDKType[]; + denoms: DenomSDKType[]; params: ParamsSDKType; + total_escrowed: CoinSDKType[]; } function createBaseGenesisState(): GenesisState { return { portId: "", - denomTraces: [], - params: Params.fromPartial({}) + denoms: [], + params: Params.fromPartial({}), + totalEscrowed: [] }; } export const GenesisState = { @@ -40,12 +54,15 @@ export const GenesisState = { if (message.portId !== "") { writer.uint32(10).string(message.portId); } - for (const v of message.denomTraces) { - DenomTrace.encode(v!, writer.uint32(18).fork()).ldelim(); + for (const v of message.denoms) { + Denom.encode(v!, writer.uint32(18).fork()).ldelim(); } if (message.params !== undefined) { Params.encode(message.params, writer.uint32(26).fork()).ldelim(); } + for (const v of message.totalEscrowed) { + Coin.encode(v!, writer.uint32(34).fork()).ldelim(); + } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { @@ -59,11 +76,14 @@ export const GenesisState = { message.portId = reader.string(); break; case 2: - message.denomTraces.push(DenomTrace.decode(reader, reader.uint32())); + message.denoms.push(Denom.decode(reader, reader.uint32())); break; case 3: message.params = Params.decode(reader, reader.uint32()); break; + case 4: + message.totalEscrowed.push(Coin.decode(reader, reader.uint32())); + break; default: reader.skipType(tag & 7); break; @@ -74,8 +94,9 @@ export const GenesisState = { fromPartial(object: Partial): GenesisState { const message = createBaseGenesisState(); message.portId = object.portId ?? ""; - message.denomTraces = object.denomTraces?.map(e => DenomTrace.fromPartial(e)) || []; + message.denoms = object.denoms?.map(e => Denom.fromPartial(e)) || []; message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + message.totalEscrowed = object.totalEscrowed?.map(e => Coin.fromPartial(e)) || []; return message; }, fromAmino(object: GenesisStateAmino): GenesisState { @@ -83,21 +104,27 @@ export const GenesisState = { if (object.port_id !== undefined && object.port_id !== null) { message.portId = object.port_id; } - message.denomTraces = object.denom_traces?.map(e => DenomTrace.fromAmino(e)) || []; + message.denoms = object.denoms?.map(e => Denom.fromAmino(e)) || []; if (object.params !== undefined && object.params !== null) { message.params = Params.fromAmino(object.params); } + message.totalEscrowed = object.total_escrowed?.map(e => Coin.fromAmino(e)) || []; return message; }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; obj.port_id = message.portId === "" ? undefined : message.portId; - if (message.denomTraces) { - obj.denom_traces = message.denomTraces.map(e => e ? DenomTrace.toAmino(e) : undefined); + if (message.denoms) { + obj.denoms = message.denoms.map(e => e ? Denom.toAmino(e) : undefined); } else { - obj.denom_traces = message.denomTraces; + obj.denoms = message.denoms; } obj.params = message.params ? Params.toAmino(message.params) : undefined; + if (message.totalEscrowed) { + obj.total_escrowed = message.totalEscrowed.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.total_escrowed = message.totalEscrowed; + } return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/packages/api/src/ibc/applications/transfer/v1/packet.ts b/packages/api/src/ibc/applications/transfer/v1/packet.ts new file mode 100644 index 00000000..941d29c5 --- /dev/null +++ b/packages/api/src/ibc/applications/transfer/v1/packet.ts @@ -0,0 +1,173 @@ +//@ts-nocheck +import { BinaryReader, BinaryWriter } from "../../../../binary"; +/** + * 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.v1.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 FungibleTokenPacketDataAmino { + /** 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 FungibleTokenPacketDataAminoMsg { + type: "cosmos-sdk/FungibleTokenPacketData"; + value: FungibleTokenPacketDataAmino; +} +/** + * 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.v1.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; + }, + 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; + }, + fromAmino(object: FungibleTokenPacketDataAmino): FungibleTokenPacketData { + const message = createBaseFungibleTokenPacketData(); + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } + if (object.amount !== undefined && object.amount !== null) { + message.amount = object.amount; + } + if (object.sender !== undefined && object.sender !== null) { + message.sender = object.sender; + } + if (object.receiver !== undefined && object.receiver !== null) { + message.receiver = object.receiver; + } + if (object.memo !== undefined && object.memo !== null) { + message.memo = object.memo; + } + return message; + }, + toAmino(message: FungibleTokenPacketData): FungibleTokenPacketDataAmino { + const obj: any = {}; + obj.denom = message.denom === "" ? undefined : message.denom; + obj.amount = message.amount === "" ? undefined : message.amount; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.receiver = message.receiver === "" ? undefined : message.receiver; + obj.memo = message.memo === "" ? undefined : message.memo; + return obj; + }, + fromAminoMsg(object: FungibleTokenPacketDataAminoMsg): FungibleTokenPacketData { + return FungibleTokenPacketData.fromAmino(object.value); + }, + toAminoMsg(message: FungibleTokenPacketData): FungibleTokenPacketDataAminoMsg { + return { + type: "cosmos-sdk/FungibleTokenPacketData", + value: FungibleTokenPacketData.toAmino(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.v1.FungibleTokenPacketData", + value: FungibleTokenPacketData.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/packages/api/src/ibc/applications/transfer/v1/query.lcd.ts b/packages/api/src/ibc/applications/transfer/v1/query.lcd.ts index bbe5f4f1..a0c0882c 100644 --- a/packages/api/src/ibc/applications/transfer/v1/query.lcd.ts +++ b/packages/api/src/ibc/applications/transfer/v1/query.lcd.ts @@ -1,7 +1,7 @@ //@ts-nocheck import { setPaginationParams } from "../../../../helpers"; import { LCDClient } from "@cosmology/lcd"; -import { QueryDenomTraceRequest, QueryDenomTraceResponseSDKType, QueryDenomTracesRequest, QueryDenomTracesResponseSDKType, QueryParamsRequest, QueryParamsResponseSDKType, QueryDenomHashRequest, QueryDenomHashResponseSDKType, QueryEscrowAddressRequest, QueryEscrowAddressResponseSDKType } from "./query"; +import { QueryParamsRequest, QueryParamsResponseSDKType, QueryDenomsRequest, QueryDenomsResponseSDKType, QueryDenomRequest, QueryDenomResponseSDKType, QueryDenomHashRequest, QueryDenomHashResponseSDKType, QueryEscrowAddressRequest, QueryEscrowAddressResponseSDKType, QueryTotalEscrowForDenomRequest, QueryTotalEscrowForDenomResponseSDKType } from "./query"; export class LCDQueryClient { req: LCDClient; constructor({ @@ -10,43 +10,67 @@ export class LCDQueryClient { requestClient: LCDClient; }) { this.req = requestClient; - this.denomTrace = this.denomTrace.bind(this); - this.denomTraces = this.denomTraces.bind(this); this.params = this.params.bind(this); + this.denoms = this.denoms.bind(this); + this.denom = this.denom.bind(this); this.denomHash = this.denomHash.bind(this); this.escrowAddress = this.escrowAddress.bind(this); + this.totalEscrowForDenom = this.totalEscrowForDenom.bind(this); } - /* DenomTrace queries a denomination trace information. */ - async denomTrace(params: QueryDenomTraceRequest): Promise { - const endpoint = `ibc/apps/transfer/v1/denom_traces/${params.hash}`; - return await this.req.get(endpoint); + /* Params queries all parameters of the ibc-transfer module. */ + async params(_params: QueryParamsRequest = {}): Promise { + const endpoint = `ibc/apps/transfer/v1/params`; + return await this.req.get(endpoint); } - /* DenomTraces queries all denomination traces. */ - async denomTraces(params: QueryDenomTracesRequest = { + /* Denoms queries all denominations */ + async denoms(params: QueryDenomsRequest = { pagination: undefined - }): Promise { + }): Promise { const options: any = { params: {} }; if (typeof params?.pagination !== "undefined") { setPaginationParams(options, params.pagination); } - const endpoint = `ibc/apps/transfer/v1/denom_traces`; - return await this.req.get(endpoint, options); + const endpoint = `ibc/apps/transfer/v1/denoms`; + return await this.req.get(endpoint, options); } - /* Params queries all parameters of the ibc-transfer module. */ - async params(_params: QueryParamsRequest = {}): Promise { - const endpoint = `ibc/apps/transfer/v1/params`; - return await this.req.get(endpoint); + /* Denom queries a denomination */ + async denom(params: QueryDenomRequest): Promise { + const options: any = { + params: {} + }; + if (typeof params?.hash !== "undefined") { + options.params.hash = params.hash; + } + const endpoint = `ibc/apps/transfer/v1/denoms/${params.hash}`; + return await this.req.get(endpoint, options); } /* DenomHash queries a denomination hash information. */ async denomHash(params: QueryDenomHashRequest): Promise { + const options: any = { + params: {} + }; + if (typeof params?.trace !== "undefined") { + options.params.trace = params.trace; + } const endpoint = `ibc/apps/transfer/v1/denom_hashes/${params.trace}`; - return await this.req.get(endpoint); + return await this.req.get(endpoint, options); } /* EscrowAddress returns the escrow address for a particular port and channel id. */ async escrowAddress(params: QueryEscrowAddressRequest): Promise { const endpoint = `ibc/apps/transfer/v1/channels/${params.channelId}/ports/${params.portId}/escrow_address`; return await this.req.get(endpoint); } + /* TotalEscrowForDenom returns the total amount of tokens in escrow based on the denom. */ + async totalEscrowForDenom(params: QueryTotalEscrowForDenomRequest): Promise { + const options: any = { + params: {} + }; + if (typeof params?.denom !== "undefined") { + options.params.denom = params.denom; + } + const endpoint = `ibc/apps/transfer/v1/total_escrow/${params.denom}`; + return await this.req.get(endpoint, options); + } } \ No newline at end of file diff --git a/packages/api/src/ibc/applications/transfer/v1/query.rpc.Query.ts b/packages/api/src/ibc/applications/transfer/v1/query.rpc.Query.ts index e7569d62..76cb728c 100644 --- a/packages/api/src/ibc/applications/transfer/v1/query.rpc.Query.ts +++ b/packages/api/src/ibc/applications/transfer/v1/query.rpc.Query.ts @@ -2,47 +2,50 @@ import { Rpc } from "../../../../helpers"; import { BinaryReader } from "../../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryDenomTraceRequest, QueryDenomTraceResponse, QueryDenomTracesRequest, QueryDenomTracesResponse, QueryParamsRequest, QueryParamsResponse, QueryDenomHashRequest, QueryDenomHashResponse, QueryEscrowAddressRequest, QueryEscrowAddressResponse } from "./query"; +import { QueryParamsRequest, QueryParamsResponse, QueryDenomsRequest, QueryDenomsResponse, QueryDenomRequest, QueryDenomResponse, QueryDenomHashRequest, QueryDenomHashResponse, QueryEscrowAddressRequest, QueryEscrowAddressResponse, QueryTotalEscrowForDenomRequest, QueryTotalEscrowForDenomResponse } from "./query"; /** Query provides defines the gRPC querier service. */ export interface Query { - /** DenomTrace queries a denomination trace information. */ - denomTrace(request: QueryDenomTraceRequest): Promise; - /** DenomTraces queries all denomination traces. */ - denomTraces(request?: QueryDenomTracesRequest): Promise; /** Params queries all parameters of the ibc-transfer module. */ params(request?: QueryParamsRequest): Promise; + /** Denoms queries all denominations */ + denoms(request?: QueryDenomsRequest): Promise; + /** Denom queries a denomination */ + denom(request: QueryDenomRequest): Promise; /** DenomHash queries a denomination hash information. */ denomHash(request: QueryDenomHashRequest): Promise; /** EscrowAddress returns the escrow address for a particular port and channel id. */ escrowAddress(request: QueryEscrowAddressRequest): Promise; + /** TotalEscrowForDenom returns the total amount of tokens in escrow based on the denom. */ + totalEscrowForDenom(request: QueryTotalEscrowForDenomRequest): Promise; } export class QueryClientImpl implements Query { private readonly rpc: Rpc; constructor(rpc: Rpc) { this.rpc = rpc; - this.denomTrace = this.denomTrace.bind(this); - this.denomTraces = this.denomTraces.bind(this); this.params = this.params.bind(this); + this.denoms = this.denoms.bind(this); + this.denom = this.denom.bind(this); this.denomHash = this.denomHash.bind(this); this.escrowAddress = this.escrowAddress.bind(this); - } - denomTrace(request: QueryDenomTraceRequest): Promise { - const data = QueryDenomTraceRequest.encode(request).finish(); - const promise = this.rpc.request("ibc.applications.transfer.v1.Query", "DenomTrace", data); - return promise.then(data => QueryDenomTraceResponse.decode(new BinaryReader(data))); - } - denomTraces(request: QueryDenomTracesRequest = { - pagination: undefined - }): Promise { - const data = QueryDenomTracesRequest.encode(request).finish(); - const promise = this.rpc.request("ibc.applications.transfer.v1.Query", "DenomTraces", data); - return promise.then(data => QueryDenomTracesResponse.decode(new BinaryReader(data))); + this.totalEscrowForDenom = this.totalEscrowForDenom.bind(this); } params(request: QueryParamsRequest = {}): Promise { const data = QueryParamsRequest.encode(request).finish(); const promise = this.rpc.request("ibc.applications.transfer.v1.Query", "Params", data); return promise.then(data => QueryParamsResponse.decode(new BinaryReader(data))); } + denoms(request: QueryDenomsRequest = { + pagination: undefined + }): Promise { + const data = QueryDenomsRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.applications.transfer.v1.Query", "Denoms", data); + return promise.then(data => QueryDenomsResponse.decode(new BinaryReader(data))); + } + denom(request: QueryDenomRequest): Promise { + const data = QueryDenomRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.applications.transfer.v1.Query", "Denom", data); + return promise.then(data => QueryDenomResponse.decode(new BinaryReader(data))); + } denomHash(request: QueryDenomHashRequest): Promise { const data = QueryDenomHashRequest.encode(request).finish(); const promise = this.rpc.request("ibc.applications.transfer.v1.Query", "DenomHash", data); @@ -53,25 +56,33 @@ export class QueryClientImpl implements Query { const promise = this.rpc.request("ibc.applications.transfer.v1.Query", "EscrowAddress", data); return promise.then(data => QueryEscrowAddressResponse.decode(new BinaryReader(data))); } + totalEscrowForDenom(request: QueryTotalEscrowForDenomRequest): Promise { + const data = QueryTotalEscrowForDenomRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.applications.transfer.v1.Query", "TotalEscrowForDenom", data); + return promise.then(data => QueryTotalEscrowForDenomResponse.decode(new BinaryReader(data))); + } } export const createRpcQueryExtension = (base: QueryClient) => { const rpc = createProtobufRpcClient(base); const queryService = new QueryClientImpl(rpc); return { - denomTrace(request: QueryDenomTraceRequest): Promise { - return queryService.denomTrace(request); - }, - denomTraces(request?: QueryDenomTracesRequest): Promise { - return queryService.denomTraces(request); - }, params(request?: QueryParamsRequest): Promise { return queryService.params(request); }, + denoms(request?: QueryDenomsRequest): Promise { + return queryService.denoms(request); + }, + denom(request: QueryDenomRequest): Promise { + return queryService.denom(request); + }, denomHash(request: QueryDenomHashRequest): Promise { return queryService.denomHash(request); }, escrowAddress(request: QueryEscrowAddressRequest): Promise { return queryService.escrowAddress(request); + }, + totalEscrowForDenom(request: QueryTotalEscrowForDenomRequest): Promise { + return queryService.totalEscrowForDenom(request); } }; }; \ No newline at end of file diff --git a/packages/api/src/ibc/applications/transfer/v1/query.ts b/packages/api/src/ibc/applications/transfer/v1/query.ts index 24ed2f9a..9f54967c 100644 --- a/packages/api/src/ibc/applications/transfer/v1/query.ts +++ b/packages/api/src/ibc/applications/transfer/v1/query.ts @@ -1,172 +1,174 @@ //@ts-nocheck import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination"; -import { DenomTrace, DenomTraceAmino, DenomTraceSDKType, Params, ParamsAmino, ParamsSDKType } from "./transfer"; +import { Params, ParamsAmino, ParamsSDKType } from "./transfer"; +import { Denom, DenomAmino, DenomSDKType } from "./token"; +import { Coin, CoinAmino, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../../binary"; +/** 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 QueryParamsRequestAmino {} +export interface QueryParamsRequestAminoMsg { + type: "cosmos-sdk/QueryParamsRequest"; + value: QueryParamsRequestAmino; +} +/** 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 QueryParamsResponseAmino { + /** params defines the parameters of the module. */ + params?: ParamsAmino; +} +export interface QueryParamsResponseAminoMsg { + type: "cosmos-sdk/QueryParamsResponse"; + value: QueryParamsResponseAmino; +} +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponseSDKType { + params?: ParamsSDKType; +} /** - * QueryDenomTraceRequest is the request type for the Query/DenomTrace RPC + * QueryDenomRequest is the request type for the Query/Denom RPC * method */ -export interface QueryDenomTraceRequest { - /** hash (in hex format) or denom (full denom with ibc prefix) of the denomination trace information. */ +export interface QueryDenomRequest { + /** hash (in hex format) or denom (full denom with ibc prefix) of the on chain denomination. */ hash: string; } -export interface QueryDenomTraceRequestProtoMsg { - typeUrl: "/ibc.applications.transfer.v1.QueryDenomTraceRequest"; +export interface QueryDenomRequestProtoMsg { + typeUrl: "/ibc.applications.transfer.v1.QueryDenomRequest"; value: Uint8Array; } /** - * QueryDenomTraceRequest is the request type for the Query/DenomTrace RPC + * QueryDenomRequest is the request type for the Query/Denom RPC * method */ -export interface QueryDenomTraceRequestAmino { - /** hash (in hex format) or denom (full denom with ibc prefix) of the denomination trace information. */ +export interface QueryDenomRequestAmino { + /** hash (in hex format) or denom (full denom with ibc prefix) of the on chain denomination. */ hash?: string; } -export interface QueryDenomTraceRequestAminoMsg { - type: "cosmos-sdk/QueryDenomTraceRequest"; - value: QueryDenomTraceRequestAmino; +export interface QueryDenomRequestAminoMsg { + type: "cosmos-sdk/QueryDenomRequest"; + value: QueryDenomRequestAmino; } /** - * QueryDenomTraceRequest is the request type for the Query/DenomTrace RPC + * QueryDenomRequest is the request type for the Query/Denom RPC * method */ -export interface QueryDenomTraceRequestSDKType { +export interface QueryDenomRequestSDKType { hash: string; } /** - * QueryDenomTraceResponse is the response type for the Query/DenomTrace RPC + * QueryDenomResponse is the response type for the Query/Denom RPC * method. */ -export interface QueryDenomTraceResponse { - /** denom_trace returns the requested denomination trace information. */ - denomTrace?: DenomTrace; +export interface QueryDenomResponse { + /** denom returns the requested denomination. */ + denom?: Denom; } -export interface QueryDenomTraceResponseProtoMsg { - typeUrl: "/ibc.applications.transfer.v1.QueryDenomTraceResponse"; +export interface QueryDenomResponseProtoMsg { + typeUrl: "/ibc.applications.transfer.v1.QueryDenomResponse"; value: Uint8Array; } /** - * QueryDenomTraceResponse is the response type for the Query/DenomTrace RPC + * QueryDenomResponse is the response type for the Query/Denom RPC * method. */ -export interface QueryDenomTraceResponseAmino { - /** denom_trace returns the requested denomination trace information. */ - denom_trace?: DenomTraceAmino; +export interface QueryDenomResponseAmino { + /** denom returns the requested denomination. */ + denom?: DenomAmino; } -export interface QueryDenomTraceResponseAminoMsg { - type: "cosmos-sdk/QueryDenomTraceResponse"; - value: QueryDenomTraceResponseAmino; +export interface QueryDenomResponseAminoMsg { + type: "cosmos-sdk/QueryDenomResponse"; + value: QueryDenomResponseAmino; } /** - * QueryDenomTraceResponse is the response type for the Query/DenomTrace RPC + * QueryDenomResponse is the response type for the Query/Denom RPC * method. */ -export interface QueryDenomTraceResponseSDKType { - denom_trace?: DenomTraceSDKType; +export interface QueryDenomResponseSDKType { + denom?: DenomSDKType; } /** - * QueryConnectionsRequest is the request type for the Query/DenomTraces RPC + * QueryDenomsRequest is the request type for the Query/Denoms RPC * method */ -export interface QueryDenomTracesRequest { +export interface QueryDenomsRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } -export interface QueryDenomTracesRequestProtoMsg { - typeUrl: "/ibc.applications.transfer.v1.QueryDenomTracesRequest"; +export interface QueryDenomsRequestProtoMsg { + typeUrl: "/ibc.applications.transfer.v1.QueryDenomsRequest"; value: Uint8Array; } /** - * QueryConnectionsRequest is the request type for the Query/DenomTraces RPC + * QueryDenomsRequest is the request type for the Query/Denoms RPC * method */ -export interface QueryDenomTracesRequestAmino { +export interface QueryDenomsRequestAmino { /** pagination defines an optional pagination for the request. */ pagination?: PageRequestAmino; } -export interface QueryDenomTracesRequestAminoMsg { - type: "cosmos-sdk/QueryDenomTracesRequest"; - value: QueryDenomTracesRequestAmino; +export interface QueryDenomsRequestAminoMsg { + type: "cosmos-sdk/QueryDenomsRequest"; + value: QueryDenomsRequestAmino; } /** - * QueryConnectionsRequest is the request type for the Query/DenomTraces RPC + * QueryDenomsRequest is the request type for the Query/Denoms RPC * method */ -export interface QueryDenomTracesRequestSDKType { +export interface QueryDenomsRequestSDKType { pagination?: PageRequestSDKType; } /** - * QueryConnectionsResponse is the response type for the Query/DenomTraces RPC + * QueryDenomsResponse is the response type for the Query/Denoms RPC * method. */ -export interface QueryDenomTracesResponse { - /** denom_traces returns all denominations trace information. */ - denomTraces: DenomTrace[]; +export interface QueryDenomsResponse { + /** denoms returns all denominations. */ + denoms: Denom[]; /** pagination defines the pagination in the response. */ pagination?: PageResponse; } -export interface QueryDenomTracesResponseProtoMsg { - typeUrl: "/ibc.applications.transfer.v1.QueryDenomTracesResponse"; +export interface QueryDenomsResponseProtoMsg { + typeUrl: "/ibc.applications.transfer.v1.QueryDenomsResponse"; value: Uint8Array; } /** - * QueryConnectionsResponse is the response type for the Query/DenomTraces RPC + * QueryDenomsResponse is the response type for the Query/Denoms RPC * method. */ -export interface QueryDenomTracesResponseAmino { - /** denom_traces returns all denominations trace information. */ - denom_traces?: DenomTraceAmino[]; +export interface QueryDenomsResponseAmino { + /** denoms returns all denominations. */ + denoms?: DenomAmino[]; /** pagination defines the pagination in the response. */ pagination?: PageResponseAmino; } -export interface QueryDenomTracesResponseAminoMsg { - type: "cosmos-sdk/QueryDenomTracesResponse"; - value: QueryDenomTracesResponseAmino; +export interface QueryDenomsResponseAminoMsg { + type: "cosmos-sdk/QueryDenomsResponse"; + value: QueryDenomsResponseAmino; } /** - * QueryConnectionsResponse is the response type for the Query/DenomTraces RPC + * QueryDenomsResponse is the response type for the Query/Denoms RPC * method. */ -export interface QueryDenomTracesResponseSDKType { - denom_traces: DenomTraceSDKType[]; +export interface QueryDenomsResponseSDKType { + denoms: DenomSDKType[]; 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 QueryParamsRequestAmino {} -export interface QueryParamsRequestAminoMsg { - type: "cosmos-sdk/QueryParamsRequest"; - value: QueryParamsRequestAmino; -} -/** 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 QueryParamsResponseAmino { - /** params defines the parameters of the module. */ - params?: ParamsAmino; -} -export interface QueryParamsResponseAminoMsg { - type: "cosmos-sdk/QueryParamsResponse"; - value: QueryParamsResponseAmino; -} -/** 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 @@ -278,29 +280,61 @@ export interface QueryEscrowAddressResponseAminoMsg { export interface QueryEscrowAddressResponseSDKType { escrow_address: string; } -function createBaseQueryDenomTraceRequest(): QueryDenomTraceRequest { - return { - hash: "" - }; +/** QueryTotalEscrowForDenomRequest is the request type for TotalEscrowForDenom RPC method. */ +export interface QueryTotalEscrowForDenomRequest { + denom: string; } -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); - } +export interface QueryTotalEscrowForDenomRequestProtoMsg { + typeUrl: "/ibc.applications.transfer.v1.QueryTotalEscrowForDenomRequest"; + value: Uint8Array; +} +/** QueryTotalEscrowForDenomRequest is the request type for TotalEscrowForDenom RPC method. */ +export interface QueryTotalEscrowForDenomRequestAmino { + denom?: string; +} +export interface QueryTotalEscrowForDenomRequestAminoMsg { + type: "cosmos-sdk/QueryTotalEscrowForDenomRequest"; + value: QueryTotalEscrowForDenomRequestAmino; +} +/** QueryTotalEscrowForDenomRequest is the request type for TotalEscrowForDenom RPC method. */ +export interface QueryTotalEscrowForDenomRequestSDKType { + denom: string; +} +/** QueryTotalEscrowForDenomResponse is the response type for TotalEscrowForDenom RPC method. */ +export interface QueryTotalEscrowForDenomResponse { + amount: Coin; +} +export interface QueryTotalEscrowForDenomResponseProtoMsg { + typeUrl: "/ibc.applications.transfer.v1.QueryTotalEscrowForDenomResponse"; + value: Uint8Array; +} +/** QueryTotalEscrowForDenomResponse is the response type for TotalEscrowForDenom RPC method. */ +export interface QueryTotalEscrowForDenomResponseAmino { + amount?: CoinAmino; +} +export interface QueryTotalEscrowForDenomResponseAminoMsg { + type: "cosmos-sdk/QueryTotalEscrowForDenomResponse"; + value: QueryTotalEscrowForDenomResponseAmino; +} +/** QueryTotalEscrowForDenomResponse is the response type for TotalEscrowForDenom RPC method. */ +export interface QueryTotalEscrowForDenomResponseSDKType { + amount: CoinSDKType; +} +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): QueryDenomTraceRequest { + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryDenomTraceRequest(); + const message = createBaseQueryParamsRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.hash = reader.string(); - break; default: reader.skipType(tag & 7); break; @@ -308,67 +342,62 @@ export const QueryDenomTraceRequest = { } return message; }, - fromPartial(object: Partial): QueryDenomTraceRequest { - const message = createBaseQueryDenomTraceRequest(); - message.hash = object.hash ?? ""; + fromPartial(_: Partial): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); return message; }, - fromAmino(object: QueryDenomTraceRequestAmino): QueryDenomTraceRequest { - const message = createBaseQueryDenomTraceRequest(); - if (object.hash !== undefined && object.hash !== null) { - message.hash = object.hash; - } + fromAmino(_: QueryParamsRequestAmino): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); return message; }, - toAmino(message: QueryDenomTraceRequest): QueryDenomTraceRequestAmino { + toAmino(_: QueryParamsRequest): QueryParamsRequestAmino { const obj: any = {}; - obj.hash = message.hash === "" ? undefined : message.hash; return obj; }, - fromAminoMsg(object: QueryDenomTraceRequestAminoMsg): QueryDenomTraceRequest { - return QueryDenomTraceRequest.fromAmino(object.value); + fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { + return QueryParamsRequest.fromAmino(object.value); }, - toAminoMsg(message: QueryDenomTraceRequest): QueryDenomTraceRequestAminoMsg { + toAminoMsg(message: QueryParamsRequest): QueryParamsRequestAminoMsg { return { - type: "cosmos-sdk/QueryDenomTraceRequest", - value: QueryDenomTraceRequest.toAmino(message) + type: "cosmos-sdk/QueryParamsRequest", + value: QueryParamsRequest.toAmino(message) }; }, - fromProtoMsg(message: QueryDenomTraceRequestProtoMsg): QueryDenomTraceRequest { - return QueryDenomTraceRequest.decode(message.value); + fromProtoMsg(message: QueryParamsRequestProtoMsg): QueryParamsRequest { + return QueryParamsRequest.decode(message.value); }, - toProto(message: QueryDenomTraceRequest): Uint8Array { - return QueryDenomTraceRequest.encode(message).finish(); + toProto(message: QueryParamsRequest): Uint8Array { + return QueryParamsRequest.encode(message).finish(); }, - toProtoMsg(message: QueryDenomTraceRequest): QueryDenomTraceRequestProtoMsg { + toProtoMsg(message: QueryParamsRequest): QueryParamsRequestProtoMsg { return { - typeUrl: "/ibc.applications.transfer.v1.QueryDenomTraceRequest", - value: QueryDenomTraceRequest.encode(message).finish() + typeUrl: "/ibc.applications.transfer.v1.QueryParamsRequest", + value: QueryParamsRequest.encode(message).finish() }; } }; -function createBaseQueryDenomTraceResponse(): QueryDenomTraceResponse { +function createBaseQueryParamsResponse(): QueryParamsResponse { return { - denomTrace: undefined + params: 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(); +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): QueryDenomTraceResponse { + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryDenomTraceResponse(); + const message = createBaseQueryParamsResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.denomTrace = DenomTrace.decode(reader, reader.uint32()); + message.params = Params.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -377,67 +406,67 @@ export const QueryDenomTraceResponse = { } return message; }, - fromPartial(object: Partial): QueryDenomTraceResponse { - const message = createBaseQueryDenomTraceResponse(); - message.denomTrace = object.denomTrace !== undefined && object.denomTrace !== null ? DenomTrace.fromPartial(object.denomTrace) : undefined; + fromPartial(object: Partial): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; return message; }, - fromAmino(object: QueryDenomTraceResponseAmino): QueryDenomTraceResponse { - const message = createBaseQueryDenomTraceResponse(); - if (object.denom_trace !== undefined && object.denom_trace !== null) { - message.denomTrace = DenomTrace.fromAmino(object.denom_trace); + fromAmino(object: QueryParamsResponseAmino): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); } return message; }, - toAmino(message: QueryDenomTraceResponse): QueryDenomTraceResponseAmino { + toAmino(message: QueryParamsResponse): QueryParamsResponseAmino { const obj: any = {}; - obj.denom_trace = message.denomTrace ? DenomTrace.toAmino(message.denomTrace) : undefined; + obj.params = message.params ? Params.toAmino(message.params) : undefined; return obj; }, - fromAminoMsg(object: QueryDenomTraceResponseAminoMsg): QueryDenomTraceResponse { - return QueryDenomTraceResponse.fromAmino(object.value); + fromAminoMsg(object: QueryParamsResponseAminoMsg): QueryParamsResponse { + return QueryParamsResponse.fromAmino(object.value); }, - toAminoMsg(message: QueryDenomTraceResponse): QueryDenomTraceResponseAminoMsg { + toAminoMsg(message: QueryParamsResponse): QueryParamsResponseAminoMsg { return { - type: "cosmos-sdk/QueryDenomTraceResponse", - value: QueryDenomTraceResponse.toAmino(message) + type: "cosmos-sdk/QueryParamsResponse", + value: QueryParamsResponse.toAmino(message) }; }, - fromProtoMsg(message: QueryDenomTraceResponseProtoMsg): QueryDenomTraceResponse { - return QueryDenomTraceResponse.decode(message.value); + fromProtoMsg(message: QueryParamsResponseProtoMsg): QueryParamsResponse { + return QueryParamsResponse.decode(message.value); }, - toProto(message: QueryDenomTraceResponse): Uint8Array { - return QueryDenomTraceResponse.encode(message).finish(); + toProto(message: QueryParamsResponse): Uint8Array { + return QueryParamsResponse.encode(message).finish(); }, - toProtoMsg(message: QueryDenomTraceResponse): QueryDenomTraceResponseProtoMsg { + toProtoMsg(message: QueryParamsResponse): QueryParamsResponseProtoMsg { return { - typeUrl: "/ibc.applications.transfer.v1.QueryDenomTraceResponse", - value: QueryDenomTraceResponse.encode(message).finish() + typeUrl: "/ibc.applications.transfer.v1.QueryParamsResponse", + value: QueryParamsResponse.encode(message).finish() }; } }; -function createBaseQueryDenomTracesRequest(): QueryDenomTracesRequest { +function createBaseQueryDenomRequest(): QueryDenomRequest { return { - pagination: undefined + hash: "" }; } -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(); +export const QueryDenomRequest = { + typeUrl: "/ibc.applications.transfer.v1.QueryDenomRequest", + encode(message: QueryDenomRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.hash !== "") { + writer.uint32(10).string(message.hash); } return writer; }, - decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomTracesRequest { + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomRequest { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryDenomTracesRequest(); + const message = createBaseQueryDenomRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.pagination = PageRequest.decode(reader, reader.uint32()); + message.hash = reader.string(); break; default: reader.skipType(tag & 7); @@ -446,74 +475,67 @@ export const QueryDenomTracesRequest = { } return message; }, - fromPartial(object: Partial): QueryDenomTracesRequest { - const message = createBaseQueryDenomTracesRequest(); - message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + fromPartial(object: Partial): QueryDenomRequest { + const message = createBaseQueryDenomRequest(); + message.hash = object.hash ?? ""; return message; }, - fromAmino(object: QueryDenomTracesRequestAmino): QueryDenomTracesRequest { - const message = createBaseQueryDenomTracesRequest(); - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageRequest.fromAmino(object.pagination); + fromAmino(object: QueryDenomRequestAmino): QueryDenomRequest { + const message = createBaseQueryDenomRequest(); + if (object.hash !== undefined && object.hash !== null) { + message.hash = object.hash; } return message; }, - toAmino(message: QueryDenomTracesRequest): QueryDenomTracesRequestAmino { + toAmino(message: QueryDenomRequest): QueryDenomRequestAmino { const obj: any = {}; - obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + obj.hash = message.hash === "" ? undefined : message.hash; return obj; }, - fromAminoMsg(object: QueryDenomTracesRequestAminoMsg): QueryDenomTracesRequest { - return QueryDenomTracesRequest.fromAmino(object.value); + fromAminoMsg(object: QueryDenomRequestAminoMsg): QueryDenomRequest { + return QueryDenomRequest.fromAmino(object.value); }, - toAminoMsg(message: QueryDenomTracesRequest): QueryDenomTracesRequestAminoMsg { + toAminoMsg(message: QueryDenomRequest): QueryDenomRequestAminoMsg { return { - type: "cosmos-sdk/QueryDenomTracesRequest", - value: QueryDenomTracesRequest.toAmino(message) + type: "cosmos-sdk/QueryDenomRequest", + value: QueryDenomRequest.toAmino(message) }; }, - fromProtoMsg(message: QueryDenomTracesRequestProtoMsg): QueryDenomTracesRequest { - return QueryDenomTracesRequest.decode(message.value); + fromProtoMsg(message: QueryDenomRequestProtoMsg): QueryDenomRequest { + return QueryDenomRequest.decode(message.value); }, - toProto(message: QueryDenomTracesRequest): Uint8Array { - return QueryDenomTracesRequest.encode(message).finish(); + toProto(message: QueryDenomRequest): Uint8Array { + return QueryDenomRequest.encode(message).finish(); }, - toProtoMsg(message: QueryDenomTracesRequest): QueryDenomTracesRequestProtoMsg { + toProtoMsg(message: QueryDenomRequest): QueryDenomRequestProtoMsg { return { - typeUrl: "/ibc.applications.transfer.v1.QueryDenomTracesRequest", - value: QueryDenomTracesRequest.encode(message).finish() + typeUrl: "/ibc.applications.transfer.v1.QueryDenomRequest", + value: QueryDenomRequest.encode(message).finish() }; } }; -function createBaseQueryDenomTracesResponse(): QueryDenomTracesResponse { +function createBaseQueryDenomResponse(): QueryDenomResponse { return { - denomTraces: [], - pagination: undefined + denom: 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(); +export const QueryDenomResponse = { + typeUrl: "/ibc.applications.transfer.v1.QueryDenomResponse", + encode(message: QueryDenomResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.denom !== undefined) { + Denom.encode(message.denom, writer.uint32(10).fork()).ldelim(); } return writer; }, - decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomTracesResponse { + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomResponse { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryDenomTracesResponse(); + const message = createBaseQueryDenomResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.denomTraces.push(DenomTrace.decode(reader, reader.uint32())); - break; - case 2: - message.pagination = PageResponse.decode(reader, reader.uint32()); + message.denom = Denom.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -522,67 +544,68 @@ export const QueryDenomTracesResponse = { } return message; }, - 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; + fromPartial(object: Partial): QueryDenomResponse { + const message = createBaseQueryDenomResponse(); + message.denom = object.denom !== undefined && object.denom !== null ? Denom.fromPartial(object.denom) : undefined; return message; }, - fromAmino(object: QueryDenomTracesResponseAmino): QueryDenomTracesResponse { - const message = createBaseQueryDenomTracesResponse(); - message.denomTraces = object.denom_traces?.map(e => DenomTrace.fromAmino(e)) || []; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageResponse.fromAmino(object.pagination); + fromAmino(object: QueryDenomResponseAmino): QueryDenomResponse { + const message = createBaseQueryDenomResponse(); + if (object.denom !== undefined && object.denom !== null) { + message.denom = Denom.fromAmino(object.denom); } return message; }, - toAmino(message: QueryDenomTracesResponse): QueryDenomTracesResponseAmino { + toAmino(message: QueryDenomResponse): QueryDenomResponseAmino { const obj: any = {}; - if (message.denomTraces) { - obj.denom_traces = message.denomTraces.map(e => e ? DenomTrace.toAmino(e) : undefined); - } else { - obj.denom_traces = message.denomTraces; - } - obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + obj.denom = message.denom ? Denom.toAmino(message.denom) : undefined; return obj; }, - fromAminoMsg(object: QueryDenomTracesResponseAminoMsg): QueryDenomTracesResponse { - return QueryDenomTracesResponse.fromAmino(object.value); + fromAminoMsg(object: QueryDenomResponseAminoMsg): QueryDenomResponse { + return QueryDenomResponse.fromAmino(object.value); }, - toAminoMsg(message: QueryDenomTracesResponse): QueryDenomTracesResponseAminoMsg { + toAminoMsg(message: QueryDenomResponse): QueryDenomResponseAminoMsg { return { - type: "cosmos-sdk/QueryDenomTracesResponse", - value: QueryDenomTracesResponse.toAmino(message) + type: "cosmos-sdk/QueryDenomResponse", + value: QueryDenomResponse.toAmino(message) }; }, - fromProtoMsg(message: QueryDenomTracesResponseProtoMsg): QueryDenomTracesResponse { - return QueryDenomTracesResponse.decode(message.value); + fromProtoMsg(message: QueryDenomResponseProtoMsg): QueryDenomResponse { + return QueryDenomResponse.decode(message.value); }, - toProto(message: QueryDenomTracesResponse): Uint8Array { - return QueryDenomTracesResponse.encode(message).finish(); + toProto(message: QueryDenomResponse): Uint8Array { + return QueryDenomResponse.encode(message).finish(); }, - toProtoMsg(message: QueryDenomTracesResponse): QueryDenomTracesResponseProtoMsg { + toProtoMsg(message: QueryDenomResponse): QueryDenomResponseProtoMsg { return { - typeUrl: "/ibc.applications.transfer.v1.QueryDenomTracesResponse", - value: QueryDenomTracesResponse.encode(message).finish() + typeUrl: "/ibc.applications.transfer.v1.QueryDenomResponse", + value: QueryDenomResponse.encode(message).finish() }; } }; -function createBaseQueryParamsRequest(): QueryParamsRequest { - return {}; +function createBaseQueryDenomsRequest(): QueryDenomsRequest { + return { + pagination: undefined + }; } -export const QueryParamsRequest = { - typeUrl: "/ibc.applications.transfer.v1.QueryParamsRequest", - encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { +export const QueryDenomsRequest = { + typeUrl: "/ibc.applications.transfer.v1.QueryDenomsRequest", + encode(message: QueryDenomsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } return writer; }, - decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomsRequest { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryParamsRequest(); + const message = createBaseQueryDenomsRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 1: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; default: reader.skipType(tag & 7); break; @@ -590,62 +613,74 @@ export const QueryParamsRequest = { } return message; }, - fromPartial(_: Partial): QueryParamsRequest { - const message = createBaseQueryParamsRequest(); + fromPartial(object: Partial): QueryDenomsRequest { + const message = createBaseQueryDenomsRequest(); + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; }, - fromAmino(_: QueryParamsRequestAmino): QueryParamsRequest { - const message = createBaseQueryParamsRequest(); + fromAmino(object: QueryDenomsRequestAmino): QueryDenomsRequest { + const message = createBaseQueryDenomsRequest(); + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } return message; }, - toAmino(_: QueryParamsRequest): QueryParamsRequestAmino { + toAmino(message: QueryDenomsRequest): QueryDenomsRequestAmino { const obj: any = {}; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, - fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { - return QueryParamsRequest.fromAmino(object.value); + fromAminoMsg(object: QueryDenomsRequestAminoMsg): QueryDenomsRequest { + return QueryDenomsRequest.fromAmino(object.value); }, - toAminoMsg(message: QueryParamsRequest): QueryParamsRequestAminoMsg { + toAminoMsg(message: QueryDenomsRequest): QueryDenomsRequestAminoMsg { return { - type: "cosmos-sdk/QueryParamsRequest", - value: QueryParamsRequest.toAmino(message) + type: "cosmos-sdk/QueryDenomsRequest", + value: QueryDenomsRequest.toAmino(message) }; }, - fromProtoMsg(message: QueryParamsRequestProtoMsg): QueryParamsRequest { - return QueryParamsRequest.decode(message.value); + fromProtoMsg(message: QueryDenomsRequestProtoMsg): QueryDenomsRequest { + return QueryDenomsRequest.decode(message.value); }, - toProto(message: QueryParamsRequest): Uint8Array { - return QueryParamsRequest.encode(message).finish(); + toProto(message: QueryDenomsRequest): Uint8Array { + return QueryDenomsRequest.encode(message).finish(); }, - toProtoMsg(message: QueryParamsRequest): QueryParamsRequestProtoMsg { + toProtoMsg(message: QueryDenomsRequest): QueryDenomsRequestProtoMsg { return { - typeUrl: "/ibc.applications.transfer.v1.QueryParamsRequest", - value: QueryParamsRequest.encode(message).finish() + typeUrl: "/ibc.applications.transfer.v1.QueryDenomsRequest", + value: QueryDenomsRequest.encode(message).finish() }; } }; -function createBaseQueryParamsResponse(): QueryParamsResponse { +function createBaseQueryDenomsResponse(): QueryDenomsResponse { return { - params: undefined + denoms: [], + pagination: 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(); +export const QueryDenomsResponse = { + typeUrl: "/ibc.applications.transfer.v1.QueryDenomsResponse", + encode(message: QueryDenomsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.denoms) { + Denom.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } return writer; }, - decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomsResponse { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryParamsResponse(); + const message = createBaseQueryDenomsResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.params = Params.decode(reader, reader.uint32()); + message.denoms.push(Denom.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -654,42 +689,49 @@ export const QueryParamsResponse = { } return message; }, - fromPartial(object: Partial): QueryParamsResponse { - const message = createBaseQueryParamsResponse(); - message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + fromPartial(object: Partial): QueryDenomsResponse { + const message = createBaseQueryDenomsResponse(); + message.denoms = object.denoms?.map(e => Denom.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; return message; }, - fromAmino(object: QueryParamsResponseAmino): QueryParamsResponse { - const message = createBaseQueryParamsResponse(); - if (object.params !== undefined && object.params !== null) { - message.params = Params.fromAmino(object.params); + fromAmino(object: QueryDenomsResponseAmino): QueryDenomsResponse { + const message = createBaseQueryDenomsResponse(); + message.denoms = object.denoms?.map(e => Denom.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); } return message; }, - toAmino(message: QueryParamsResponse): QueryParamsResponseAmino { + toAmino(message: QueryDenomsResponse): QueryDenomsResponseAmino { const obj: any = {}; - obj.params = message.params ? Params.toAmino(message.params) : undefined; + if (message.denoms) { + obj.denoms = message.denoms.map(e => e ? Denom.toAmino(e) : undefined); + } else { + obj.denoms = message.denoms; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; }, - fromAminoMsg(object: QueryParamsResponseAminoMsg): QueryParamsResponse { - return QueryParamsResponse.fromAmino(object.value); + fromAminoMsg(object: QueryDenomsResponseAminoMsg): QueryDenomsResponse { + return QueryDenomsResponse.fromAmino(object.value); }, - toAminoMsg(message: QueryParamsResponse): QueryParamsResponseAminoMsg { + toAminoMsg(message: QueryDenomsResponse): QueryDenomsResponseAminoMsg { return { - type: "cosmos-sdk/QueryParamsResponse", - value: QueryParamsResponse.toAmino(message) + type: "cosmos-sdk/QueryDenomsResponse", + value: QueryDenomsResponse.toAmino(message) }; }, - fromProtoMsg(message: QueryParamsResponseProtoMsg): QueryParamsResponse { - return QueryParamsResponse.decode(message.value); + fromProtoMsg(message: QueryDenomsResponseProtoMsg): QueryDenomsResponse { + return QueryDenomsResponse.decode(message.value); }, - toProto(message: QueryParamsResponse): Uint8Array { - return QueryParamsResponse.encode(message).finish(); + toProto(message: QueryDenomsResponse): Uint8Array { + return QueryDenomsResponse.encode(message).finish(); }, - toProtoMsg(message: QueryParamsResponse): QueryParamsResponseProtoMsg { + toProtoMsg(message: QueryDenomsResponse): QueryDenomsResponseProtoMsg { return { - typeUrl: "/ibc.applications.transfer.v1.QueryParamsResponse", - value: QueryParamsResponse.encode(message).finish() + typeUrl: "/ibc.applications.transfer.v1.QueryDenomsResponse", + value: QueryDenomsResponse.encode(message).finish() }; } }; @@ -980,4 +1022,142 @@ export const QueryEscrowAddressResponse = { value: QueryEscrowAddressResponse.encode(message).finish() }; } +}; +function createBaseQueryTotalEscrowForDenomRequest(): QueryTotalEscrowForDenomRequest { + return { + denom: "" + }; +} +export const QueryTotalEscrowForDenomRequest = { + typeUrl: "/ibc.applications.transfer.v1.QueryTotalEscrowForDenomRequest", + encode(message: QueryTotalEscrowForDenomRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryTotalEscrowForDenomRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTotalEscrowForDenomRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.denom = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryTotalEscrowForDenomRequest { + const message = createBaseQueryTotalEscrowForDenomRequest(); + message.denom = object.denom ?? ""; + return message; + }, + fromAmino(object: QueryTotalEscrowForDenomRequestAmino): QueryTotalEscrowForDenomRequest { + const message = createBaseQueryTotalEscrowForDenomRequest(); + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } + return message; + }, + toAmino(message: QueryTotalEscrowForDenomRequest): QueryTotalEscrowForDenomRequestAmino { + const obj: any = {}; + obj.denom = message.denom === "" ? undefined : message.denom; + return obj; + }, + fromAminoMsg(object: QueryTotalEscrowForDenomRequestAminoMsg): QueryTotalEscrowForDenomRequest { + return QueryTotalEscrowForDenomRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryTotalEscrowForDenomRequest): QueryTotalEscrowForDenomRequestAminoMsg { + return { + type: "cosmos-sdk/QueryTotalEscrowForDenomRequest", + value: QueryTotalEscrowForDenomRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryTotalEscrowForDenomRequestProtoMsg): QueryTotalEscrowForDenomRequest { + return QueryTotalEscrowForDenomRequest.decode(message.value); + }, + toProto(message: QueryTotalEscrowForDenomRequest): Uint8Array { + return QueryTotalEscrowForDenomRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryTotalEscrowForDenomRequest): QueryTotalEscrowForDenomRequestProtoMsg { + return { + typeUrl: "/ibc.applications.transfer.v1.QueryTotalEscrowForDenomRequest", + value: QueryTotalEscrowForDenomRequest.encode(message).finish() + }; + } +}; +function createBaseQueryTotalEscrowForDenomResponse(): QueryTotalEscrowForDenomResponse { + return { + amount: Coin.fromPartial({}) + }; +} +export const QueryTotalEscrowForDenomResponse = { + typeUrl: "/ibc.applications.transfer.v1.QueryTotalEscrowForDenomResponse", + encode(message: QueryTotalEscrowForDenomResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.amount !== undefined) { + Coin.encode(message.amount, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryTotalEscrowForDenomResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTotalEscrowForDenomResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.amount = Coin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryTotalEscrowForDenomResponse { + const message = createBaseQueryTotalEscrowForDenomResponse(); + message.amount = object.amount !== undefined && object.amount !== null ? Coin.fromPartial(object.amount) : undefined; + return message; + }, + fromAmino(object: QueryTotalEscrowForDenomResponseAmino): QueryTotalEscrowForDenomResponse { + const message = createBaseQueryTotalEscrowForDenomResponse(); + if (object.amount !== undefined && object.amount !== null) { + message.amount = Coin.fromAmino(object.amount); + } + return message; + }, + toAmino(message: QueryTotalEscrowForDenomResponse): QueryTotalEscrowForDenomResponseAmino { + const obj: any = {}; + obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; + return obj; + }, + fromAminoMsg(object: QueryTotalEscrowForDenomResponseAminoMsg): QueryTotalEscrowForDenomResponse { + return QueryTotalEscrowForDenomResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryTotalEscrowForDenomResponse): QueryTotalEscrowForDenomResponseAminoMsg { + return { + type: "cosmos-sdk/QueryTotalEscrowForDenomResponse", + value: QueryTotalEscrowForDenomResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryTotalEscrowForDenomResponseProtoMsg): QueryTotalEscrowForDenomResponse { + return QueryTotalEscrowForDenomResponse.decode(message.value); + }, + toProto(message: QueryTotalEscrowForDenomResponse): Uint8Array { + return QueryTotalEscrowForDenomResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryTotalEscrowForDenomResponse): QueryTotalEscrowForDenomResponseProtoMsg { + return { + typeUrl: "/ibc.applications.transfer.v1.QueryTotalEscrowForDenomResponse", + value: QueryTotalEscrowForDenomResponse.encode(message).finish() + }; + } }; \ No newline at end of file diff --git a/packages/api/src/ibc/applications/transfer/v1/token.ts b/packages/api/src/ibc/applications/transfer/v1/token.ts new file mode 100644 index 00000000..efdcc729 --- /dev/null +++ b/packages/api/src/ibc/applications/transfer/v1/token.ts @@ -0,0 +1,324 @@ +//@ts-nocheck +import { BinaryReader, BinaryWriter } from "../../../../binary"; +/** Token defines a struct which represents a token to be transferred. */ +export interface Token { + /** the token denomination */ + denom: Denom; + /** the token amount to be transferred */ + amount: string; +} +export interface TokenProtoMsg { + typeUrl: "/ibc.applications.transfer.v1.Token"; + value: Uint8Array; +} +/** Token defines a struct which represents a token to be transferred. */ +export interface TokenAmino { + /** the token denomination */ + denom?: DenomAmino; + /** the token amount to be transferred */ + amount?: string; +} +export interface TokenAminoMsg { + type: "cosmos-sdk/Token"; + value: TokenAmino; +} +/** Token defines a struct which represents a token to be transferred. */ +export interface TokenSDKType { + denom: DenomSDKType; + amount: string; +} +/** Denom holds the base denom of a Token and a trace of the chains it was sent through. */ +export interface Denom { + /** the base token denomination */ + base: string; + /** the trace of the token */ + trace: Hop[]; +} +export interface DenomProtoMsg { + typeUrl: "/ibc.applications.transfer.v1.Denom"; + value: Uint8Array; +} +/** Denom holds the base denom of a Token and a trace of the chains it was sent through. */ +export interface DenomAmino { + /** the base token denomination */ + base?: string; + /** the trace of the token */ + trace?: HopAmino[]; +} +export interface DenomAminoMsg { + type: "cosmos-sdk/Denom"; + value: DenomAmino; +} +/** Denom holds the base denom of a Token and a trace of the chains it was sent through. */ +export interface DenomSDKType { + base: string; + trace: HopSDKType[]; +} +/** Hop defines a port ID, channel ID pair specifying a unique "hop" in a trace */ +export interface Hop { + portId: string; + channelId: string; +} +export interface HopProtoMsg { + typeUrl: "/ibc.applications.transfer.v1.Hop"; + value: Uint8Array; +} +/** Hop defines a port ID, channel ID pair specifying a unique "hop" in a trace */ +export interface HopAmino { + port_id?: string; + channel_id?: string; +} +export interface HopAminoMsg { + type: "cosmos-sdk/Hop"; + value: HopAmino; +} +/** Hop defines a port ID, channel ID pair specifying a unique "hop" in a trace */ +export interface HopSDKType { + port_id: string; + channel_id: string; +} +function createBaseToken(): Token { + return { + denom: Denom.fromPartial({}), + amount: "" + }; +} +export const Token = { + typeUrl: "/ibc.applications.transfer.v1.Token", + encode(message: Token, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.denom !== undefined) { + Denom.encode(message.denom, writer.uint32(10).fork()).ldelim(); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Token { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseToken(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.denom = Denom.decode(reader, reader.uint32()); + break; + case 2: + message.amount = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): Token { + const message = createBaseToken(); + message.denom = object.denom !== undefined && object.denom !== null ? Denom.fromPartial(object.denom) : undefined; + message.amount = object.amount ?? ""; + return message; + }, + fromAmino(object: TokenAmino): Token { + const message = createBaseToken(); + if (object.denom !== undefined && object.denom !== null) { + message.denom = Denom.fromAmino(object.denom); + } + if (object.amount !== undefined && object.amount !== null) { + message.amount = object.amount; + } + return message; + }, + toAmino(message: Token): TokenAmino { + const obj: any = {}; + obj.denom = message.denom ? Denom.toAmino(message.denom) : undefined; + obj.amount = message.amount === "" ? undefined : message.amount; + return obj; + }, + fromAminoMsg(object: TokenAminoMsg): Token { + return Token.fromAmino(object.value); + }, + toAminoMsg(message: Token): TokenAminoMsg { + return { + type: "cosmos-sdk/Token", + value: Token.toAmino(message) + }; + }, + fromProtoMsg(message: TokenProtoMsg): Token { + return Token.decode(message.value); + }, + toProto(message: Token): Uint8Array { + return Token.encode(message).finish(); + }, + toProtoMsg(message: Token): TokenProtoMsg { + return { + typeUrl: "/ibc.applications.transfer.v1.Token", + value: Token.encode(message).finish() + }; + } +}; +function createBaseDenom(): Denom { + return { + base: "", + trace: [] + }; +} +export const Denom = { + typeUrl: "/ibc.applications.transfer.v1.Denom", + encode(message: Denom, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.base !== "") { + writer.uint32(10).string(message.base); + } + for (const v of message.trace) { + Hop.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Denom { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDenom(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.base = reader.string(); + break; + case 3: + message.trace.push(Hop.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): Denom { + const message = createBaseDenom(); + message.base = object.base ?? ""; + message.trace = object.trace?.map(e => Hop.fromPartial(e)) || []; + return message; + }, + fromAmino(object: DenomAmino): Denom { + const message = createBaseDenom(); + if (object.base !== undefined && object.base !== null) { + message.base = object.base; + } + message.trace = object.trace?.map(e => Hop.fromAmino(e)) || []; + return message; + }, + toAmino(message: Denom): DenomAmino { + const obj: any = {}; + obj.base = message.base === "" ? undefined : message.base; + if (message.trace) { + obj.trace = message.trace.map(e => e ? Hop.toAmino(e) : undefined); + } else { + obj.trace = message.trace; + } + return obj; + }, + fromAminoMsg(object: DenomAminoMsg): Denom { + return Denom.fromAmino(object.value); + }, + toAminoMsg(message: Denom): DenomAminoMsg { + return { + type: "cosmos-sdk/Denom", + value: Denom.toAmino(message) + }; + }, + fromProtoMsg(message: DenomProtoMsg): Denom { + return Denom.decode(message.value); + }, + toProto(message: Denom): Uint8Array { + return Denom.encode(message).finish(); + }, + toProtoMsg(message: Denom): DenomProtoMsg { + return { + typeUrl: "/ibc.applications.transfer.v1.Denom", + value: Denom.encode(message).finish() + }; + } +}; +function createBaseHop(): Hop { + return { + portId: "", + channelId: "" + }; +} +export const Hop = { + typeUrl: "/ibc.applications.transfer.v1.Hop", + encode(message: Hop, 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): Hop { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHop(); + 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; + }, + fromPartial(object: Partial): Hop { + const message = createBaseHop(); + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + return message; + }, + fromAmino(object: HopAmino): Hop { + const message = createBaseHop(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + return message; + }, + toAmino(message: Hop): HopAmino { + const obj: any = {}; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + return obj; + }, + fromAminoMsg(object: HopAminoMsg): Hop { + return Hop.fromAmino(object.value); + }, + toAminoMsg(message: Hop): HopAminoMsg { + return { + type: "cosmos-sdk/Hop", + value: Hop.toAmino(message) + }; + }, + fromProtoMsg(message: HopProtoMsg): Hop { + return Hop.decode(message.value); + }, + toProto(message: Hop): Uint8Array { + return Hop.encode(message).finish(); + }, + toProtoMsg(message: Hop): HopProtoMsg { + return { + typeUrl: "/ibc.applications.transfer.v1.Hop", + value: Hop.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/packages/api/src/ibc/applications/transfer/v1/transfer.ts b/packages/api/src/ibc/applications/transfer/v1/transfer.ts index 17df6cef..10a4f949 100644 --- a/packages/api/src/ibc/applications/transfer/v1/transfer.ts +++ b/packages/api/src/ibc/applications/transfer/v1/transfer.ts @@ -1,47 +1,5 @@ //@ts-nocheck import { BinaryReader, BinaryWriter } from "../../../../binary"; -/** - * 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 DenomTraceAmino { - /** - * 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. */ - base_denom?: string; -} -export interface DenomTraceAminoMsg { - type: "cosmos-sdk/DenomTrace"; - value: DenomTraceAmino; -} -/** - * 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 @@ -96,87 +54,6 @@ 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; - }, - fromPartial(object: Partial): DenomTrace { - const message = createBaseDenomTrace(); - message.path = object.path ?? ""; - message.baseDenom = object.baseDenom ?? ""; - return message; - }, - fromAmino(object: DenomTraceAmino): DenomTrace { - const message = createBaseDenomTrace(); - if (object.path !== undefined && object.path !== null) { - message.path = object.path; - } - if (object.base_denom !== undefined && object.base_denom !== null) { - message.baseDenom = object.base_denom; - } - return message; - }, - toAmino(message: DenomTrace): DenomTraceAmino { - const obj: any = {}; - obj.path = message.path === "" ? undefined : message.path; - obj.base_denom = message.baseDenom === "" ? undefined : message.baseDenom; - return obj; - }, - fromAminoMsg(object: DenomTraceAminoMsg): DenomTrace { - return DenomTrace.fromAmino(object.value); - }, - toAminoMsg(message: DenomTrace): DenomTraceAminoMsg { - return { - type: "cosmos-sdk/DenomTrace", - value: DenomTrace.toAmino(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, diff --git a/packages/api/src/ibc/applications/transfer/v1/tx.amino.ts b/packages/api/src/ibc/applications/transfer/v1/tx.amino.ts index 7295985b..f220cd06 100644 --- a/packages/api/src/ibc/applications/transfer/v1/tx.amino.ts +++ b/packages/api/src/ibc/applications/transfer/v1/tx.amino.ts @@ -1,9 +1,14 @@ //@ts-nocheck -import { MsgTransfer } from "./tx"; +import { MsgTransfer, MsgUpdateParams } from "./tx"; export const AminoConverter = { "/ibc.applications.transfer.v1.MsgTransfer": { aminoType: "cosmos-sdk/MsgTransfer", toAmino: MsgTransfer.toAmino, fromAmino: MsgTransfer.fromAmino + }, + "/ibc.applications.transfer.v1.MsgUpdateParams": { + aminoType: "cosmos-sdk/MsgUpdateParams", + toAmino: MsgUpdateParams.toAmino, + fromAmino: MsgUpdateParams.fromAmino } }; \ No newline at end of file diff --git a/packages/api/src/ibc/applications/transfer/v1/tx.registry.ts b/packages/api/src/ibc/applications/transfer/v1/tx.registry.ts index dae96a3a..3789a3cb 100644 --- a/packages/api/src/ibc/applications/transfer/v1/tx.registry.ts +++ b/packages/api/src/ibc/applications/transfer/v1/tx.registry.ts @@ -1,7 +1,7 @@ //@ts-nocheck import { GeneratedType, Registry } from "@cosmjs/proto-signing"; -import { MsgTransfer } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/ibc.applications.transfer.v1.MsgTransfer", MsgTransfer]]; +import { MsgTransfer, MsgUpdateParams } from "./tx"; +export const registry: ReadonlyArray<[string, GeneratedType]> = [["/ibc.applications.transfer.v1.MsgTransfer", MsgTransfer], ["/ibc.applications.transfer.v1.MsgUpdateParams", MsgUpdateParams]]; export const load = (protoRegistry: Registry) => { registry.forEach(([typeUrl, mod]) => { protoRegistry.register(typeUrl, mod); @@ -14,6 +14,12 @@ export const MessageComposer = { typeUrl: "/ibc.applications.transfer.v1.MsgTransfer", value: MsgTransfer.encode(value).finish() }; + }, + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/ibc.applications.transfer.v1.MsgUpdateParams", + value: MsgUpdateParams.encode(value).finish() + }; } }, withTypeUrl: { @@ -22,6 +28,12 @@ export const MessageComposer = { typeUrl: "/ibc.applications.transfer.v1.MsgTransfer", value }; + }, + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/ibc.applications.transfer.v1.MsgUpdateParams", + value + }; } }, fromPartial: { @@ -30,6 +42,12 @@ export const MessageComposer = { typeUrl: "/ibc.applications.transfer.v1.MsgTransfer", value: MsgTransfer.fromPartial(value) }; + }, + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/ibc.applications.transfer.v1.MsgUpdateParams", + value: MsgUpdateParams.fromPartial(value) + }; } } }; \ No newline at end of file diff --git a/packages/api/src/ibc/applications/transfer/v1/tx.rpc.msg.ts b/packages/api/src/ibc/applications/transfer/v1/tx.rpc.msg.ts index 3bc6a71d..b22f138f 100644 --- a/packages/api/src/ibc/applications/transfer/v1/tx.rpc.msg.ts +++ b/packages/api/src/ibc/applications/transfer/v1/tx.rpc.msg.ts @@ -1,21 +1,29 @@ //@ts-nocheck import { Rpc } from "../../../../helpers"; import { BinaryReader } from "../../../../binary"; -import { MsgTransfer, MsgTransferResponse } from "./tx"; +import { MsgTransfer, MsgTransferResponse, MsgUpdateParams, MsgUpdateParamsResponse } from "./tx"; /** Msg defines the ibc/transfer Msg service. */ export interface Msg { /** Transfer defines a rpc handler method for MsgTransfer. */ transfer(request: MsgTransfer): Promise; + /** UpdateParams defines a rpc handler for MsgUpdateParams. */ + updateParams(request: MsgUpdateParams): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: Rpc; constructor(rpc: Rpc) { this.rpc = rpc; this.transfer = this.transfer.bind(this); + this.updateParams = this.updateParams.bind(this); } transfer(request: MsgTransfer): Promise { const data = MsgTransfer.encode(request).finish(); const promise = this.rpc.request("ibc.applications.transfer.v1.Msg", "Transfer", data); return promise.then(data => MsgTransferResponse.decode(new BinaryReader(data))); } + updateParams(request: MsgUpdateParams): Promise { + const data = MsgUpdateParams.encode(request).finish(); + const promise = this.rpc.request("ibc.applications.transfer.v1.Msg", "UpdateParams", data); + return promise.then(data => MsgUpdateParamsResponse.decode(new BinaryReader(data))); + } } \ No newline at end of file diff --git a/packages/api/src/ibc/applications/transfer/v1/tx.ts b/packages/api/src/ibc/applications/transfer/v1/tx.ts index a9a2e2f6..7dc8883b 100644 --- a/packages/api/src/ibc/applications/transfer/v1/tx.ts +++ b/packages/api/src/ibc/applications/transfer/v1/tx.ts @@ -1,6 +1,6 @@ //@ts-nocheck import { Coin, CoinAmino, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; -import { Height, HeightAmino, HeightSDKType } from "../../../core/client/v1/client"; +import { Height, HeightAmino, HeightSDKType, Params, ParamsAmino, ParamsSDKType } from "../../../core/client/v1/client"; import { BinaryReader, BinaryWriter } from "../../../../binary"; /** * MsgTransfer defines a msg to transfer fungible tokens (i.e Coins) between @@ -12,7 +12,7 @@ export interface MsgTransfer { sourcePort: string; /** the channel by which the packet will be sent */ sourceChannel: string; - /** the tokens to be transferred */ + /** token to be transferred */ token: Coin; /** the sender address */ sender: string; @@ -20,14 +20,29 @@ export interface MsgTransfer { receiver: string; /** * Timeout height relative to the current block height. - * The timeout is disabled when set to 0. + * If you are sending with IBC v1 protocol, either timeout_height or timeout_timestamp must be set. + * If you are sending with IBC v2 protocol, timeout_timestamp must be set, and timeout_height must be omitted. */ timeoutHeight: Height; /** * Timeout timestamp in absolute nanoseconds since unix epoch. - * The timeout is disabled when set to 0. + * If you are sending with IBC v1 protocol, either timeout_height or timeout_timestamp must be set. + * If you are sending with IBC v2 protocol, timeout_timestamp must be set. */ timeoutTimestamp: bigint; + /** optional memo */ + memo: string; + /** optional encoding */ + encoding: string; + /** + * boolean flag to indicate if the transfer message + * is sent with the IBC v2 protocol but uses v1 channel identifiers. + * In this case, the v1 channel identifiers function as aliases to the + * underlying client ids. + * This only needs to be set if the channel IDs + * are V1 channel identifiers. + */ + useAliasing: boolean; } export interface MsgTransferProtoMsg { typeUrl: "/ibc.applications.transfer.v1.MsgTransfer"; @@ -43,22 +58,37 @@ export interface MsgTransferAmino { source_port?: string; /** the channel by which the packet will be sent */ source_channel?: string; - /** the tokens to be transferred */ - token?: CoinAmino; + /** token to be transferred */ + token: CoinAmino; /** 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. + * If you are sending with IBC v1 protocol, either timeout_height or timeout_timestamp must be set. + * If you are sending with IBC v2 protocol, timeout_timestamp must be set, and timeout_height must be omitted. */ - timeout_height?: HeightAmino; + timeout_height: HeightAmino; /** * Timeout timestamp in absolute nanoseconds since unix epoch. - * The timeout is disabled when set to 0. + * If you are sending with IBC v1 protocol, either timeout_height or timeout_timestamp must be set. + * If you are sending with IBC v2 protocol, timeout_timestamp must be set. */ timeout_timestamp?: string; + /** optional memo */ + memo?: string; + /** optional encoding */ + encoding?: string; + /** + * boolean flag to indicate if the transfer message + * is sent with the IBC v2 protocol but uses v1 channel identifiers. + * In this case, the v1 channel identifiers function as aliases to the + * underlying client ids. + * This only needs to be set if the channel IDs + * are V1 channel identifiers. + */ + use_aliasing: boolean; } export interface MsgTransferAminoMsg { type: "cosmos-sdk/MsgTransfer"; @@ -77,21 +107,90 @@ export interface MsgTransferSDKType { receiver: string; timeout_height: HeightSDKType; timeout_timestamp: bigint; + memo: string; + encoding: string; + use_aliasing: boolean; } /** MsgTransferResponse defines the Msg/Transfer response type. */ -export interface MsgTransferResponse {} +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 MsgTransferResponseAmino {} +export interface MsgTransferResponseAmino { + /** sequence number of the transfer packet sent */ + sequence?: string; +} export interface MsgTransferResponseAminoMsg { type: "cosmos-sdk/MsgTransferResponse"; value: MsgTransferResponseAmino; } /** MsgTransferResponse defines the Msg/Transfer response type. */ -export interface MsgTransferResponseSDKType {} +export interface MsgTransferResponseSDKType { + sequence: bigint; +} +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** signer address */ + signer: string; + /** + * params defines the transfer parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params; +} +export interface MsgUpdateParamsProtoMsg { + typeUrl: "/ibc.applications.transfer.v1.MsgUpdateParams"; + value: Uint8Array; +} +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParamsAmino { + /** signer address */ + signer?: string; + /** + * params defines the transfer parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params?: ParamsAmino; +} +export interface MsgUpdateParamsAminoMsg { + type: "cosmos-sdk/MsgUpdateParams"; + value: MsgUpdateParamsAmino; +} +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParamsSDKType { + signer: string; + params: ParamsSDKType; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponse {} +export interface MsgUpdateParamsResponseProtoMsg { + typeUrl: "/ibc.applications.transfer.v1.MsgUpdateParamsResponse"; + value: Uint8Array; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponseAmino {} +export interface MsgUpdateParamsResponseAminoMsg { + type: "cosmos-sdk/MsgUpdateParamsResponse"; + value: MsgUpdateParamsResponseAmino; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponseSDKType {} function createBaseMsgTransfer(): MsgTransfer { return { sourcePort: "", @@ -100,7 +199,10 @@ function createBaseMsgTransfer(): MsgTransfer { sender: "", receiver: "", timeoutHeight: Height.fromPartial({}), - timeoutTimestamp: BigInt(0) + timeoutTimestamp: BigInt(0), + memo: "", + encoding: "", + useAliasing: false }; } export const MsgTransfer = { @@ -127,6 +229,15 @@ export const MsgTransfer = { if (message.timeoutTimestamp !== BigInt(0)) { writer.uint32(56).uint64(message.timeoutTimestamp); } + if (message.memo !== "") { + writer.uint32(66).string(message.memo); + } + if (message.encoding !== "") { + writer.uint32(74).string(message.encoding); + } + if (message.useAliasing === true) { + writer.uint32(80).bool(message.useAliasing); + } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): MsgTransfer { @@ -157,6 +268,15 @@ export const MsgTransfer = { case 7: message.timeoutTimestamp = reader.uint64(); break; + case 8: + message.memo = reader.string(); + break; + case 9: + message.encoding = reader.string(); + break; + case 10: + message.useAliasing = reader.bool(); + break; default: reader.skipType(tag & 7); break; @@ -173,6 +293,9 @@ export const MsgTransfer = { 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 ?? ""; + message.encoding = object.encoding ?? ""; + message.useAliasing = object.useAliasing ?? false; return message; }, fromAmino(object: MsgTransferAmino): MsgTransfer { @@ -198,17 +321,29 @@ export const MsgTransfer = { if (object.timeout_timestamp !== undefined && object.timeout_timestamp !== null) { message.timeoutTimestamp = BigInt(object.timeout_timestamp); } + if (object.memo !== undefined && object.memo !== null) { + message.memo = object.memo; + } + if (object.encoding !== undefined && object.encoding !== null) { + message.encoding = object.encoding; + } + if (object.use_aliasing !== undefined && object.use_aliasing !== null) { + message.useAliasing = object.use_aliasing; + } return message; }, toAmino(message: MsgTransfer): MsgTransferAmino { const obj: any = {}; obj.source_port = message.sourcePort === "" ? undefined : message.sourcePort; obj.source_channel = message.sourceChannel === "" ? undefined : message.sourceChannel; - obj.token = message.token ? Coin.toAmino(message.token) : undefined; + obj.token = message.token ? Coin.toAmino(message.token) : Coin.toAmino(Coin.fromPartial({})); obj.sender = message.sender === "" ? undefined : message.sender; obj.receiver = message.receiver === "" ? undefined : message.receiver; obj.timeout_height = message.timeoutHeight ? Height.toAmino(message.timeoutHeight) : {}; obj.timeout_timestamp = message.timeoutTimestamp !== BigInt(0) ? message.timeoutTimestamp?.toString() : undefined; + obj.memo = message.memo === "" ? undefined : message.memo; + obj.encoding = message.encoding === "" ? undefined : message.encoding; + obj.use_aliasing = message.useAliasing ?? false; return obj; }, fromAminoMsg(object: MsgTransferAminoMsg): MsgTransfer { @@ -234,11 +369,16 @@ export const MsgTransfer = { } }; function createBaseMsgTransferResponse(): MsgTransferResponse { - return {}; + return { + sequence: BigInt(0) + }; } export const MsgTransferResponse = { typeUrl: "/ibc.applications.transfer.v1.MsgTransferResponse", - encode(_: MsgTransferResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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 { @@ -248,6 +388,9 @@ export const MsgTransferResponse = { while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 1: + message.sequence = reader.uint64(); + break; default: reader.skipType(tag & 7); break; @@ -255,16 +398,21 @@ export const MsgTransferResponse = { } return message; }, - fromPartial(_: Partial): MsgTransferResponse { + fromPartial(object: Partial): MsgTransferResponse { const message = createBaseMsgTransferResponse(); + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); return message; }, - fromAmino(_: MsgTransferResponseAmino): MsgTransferResponse { + fromAmino(object: MsgTransferResponseAmino): MsgTransferResponse { const message = createBaseMsgTransferResponse(); + if (object.sequence !== undefined && object.sequence !== null) { + message.sequence = BigInt(object.sequence); + } return message; }, - toAmino(_: MsgTransferResponse): MsgTransferResponseAmino { + toAmino(message: MsgTransferResponse): MsgTransferResponseAmino { const obj: any = {}; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence?.toString() : undefined; return obj; }, fromAminoMsg(object: MsgTransferResponseAminoMsg): MsgTransferResponse { @@ -288,4 +436,141 @@ export const MsgTransferResponse = { value: MsgTransferResponse.encode(message).finish() }; } +}; +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { + signer: "", + params: Params.fromPartial({}) + }; +} +export const MsgUpdateParams = { + typeUrl: "/ibc.applications.transfer.v1.MsgUpdateParams", + encode(message: MsgUpdateParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.signer !== "") { + writer.uint32(10).string(message.signer); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.signer = reader.string(); + break; + case 2: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + message.signer = object.signer ?? ""; + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, + fromAmino(object: MsgUpdateParamsAmino): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: MsgUpdateParams): MsgUpdateParamsAmino { + const obj: any = {}; + obj.signer = message.signer === "" ? undefined : message.signer; + obj.params = message.params ? Params.toAmino(message.params) : undefined; + return obj; + }, + fromAminoMsg(object: MsgUpdateParamsAminoMsg): MsgUpdateParams { + return MsgUpdateParams.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateParams): MsgUpdateParamsAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateParams", + value: MsgUpdateParams.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateParamsProtoMsg): MsgUpdateParams { + return MsgUpdateParams.decode(message.value); + }, + toProto(message: MsgUpdateParams): Uint8Array { + return MsgUpdateParams.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateParams): MsgUpdateParamsProtoMsg { + return { + typeUrl: "/ibc.applications.transfer.v1.MsgUpdateParams", + value: MsgUpdateParams.encode(message).finish() + }; + } +}; +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} +export const MsgUpdateParamsResponse = { + typeUrl: "/ibc.applications.transfer.v1.MsgUpdateParamsResponse", + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, + fromAmino(_: MsgUpdateParamsResponseAmino): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, + toAmino(_: MsgUpdateParamsResponse): MsgUpdateParamsResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUpdateParamsResponseAminoMsg): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateParamsResponse): MsgUpdateParamsResponseAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateParamsResponse", + value: MsgUpdateParamsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateParamsResponseProtoMsg): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.decode(message.value); + }, + toProto(message: MsgUpdateParamsResponse): Uint8Array { + return MsgUpdateParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateParamsResponse): MsgUpdateParamsResponseProtoMsg { + return { + typeUrl: "/ibc.applications.transfer.v1.MsgUpdateParamsResponse", + value: MsgUpdateParamsResponse.encode(message).finish() + }; + } }; \ No newline at end of file diff --git a/packages/api/src/ibc/bundle.ts b/packages/api/src/ibc/bundle.ts index 15837ccc..86b29dcf 100644 --- a/packages/api/src/ibc/bundle.ts +++ b/packages/api/src/ibc/bundle.ts @@ -1,59 +1,73 @@ //@ts-nocheck -import * as _68 from "./applications/transfer/v1/genesis"; -import * as _69 from "./applications/transfer/v1/query"; -import * as _70 from "./applications/transfer/v1/transfer"; -import * as _71 from "./applications/transfer/v1/tx"; -import * as _72 from "./core/client/v1/client"; -import * as _73 from "./core/client/v1/genesis"; -import * as _74 from "./core/client/v1/query"; -import * as _75 from "./core/client/v1/tx"; -import * as _182 from "./applications/transfer/v1/tx.amino"; -import * as _183 from "./core/client/v1/tx.amino"; -import * as _184 from "./applications/transfer/v1/tx.registry"; -import * as _185 from "./core/client/v1/tx.registry"; -import * as _186 from "./applications/transfer/v1/query.lcd"; -import * as _187 from "./core/client/v1/query.lcd"; -import * as _188 from "./applications/transfer/v1/query.rpc.Query"; -import * as _189 from "./core/client/v1/query.rpc.Query"; -import * as _190 from "./applications/transfer/v1/tx.rpc.msg"; -import * as _191 from "./core/client/v1/tx.rpc.msg"; -import * as _230 from "./lcd"; -import * as _231 from "./rpc.query"; -import * as _232 from "./rpc.tx"; +import * as _117 from "./applications/transfer/v1/authz"; +import * as _118 from "./applications/transfer/v1/denomtrace"; +import * as _119 from "./applications/transfer/v1/genesis"; +import * as _120 from "./applications/transfer/v1/packet"; +import * as _121 from "./applications/transfer/v1/query"; +import * as _122 from "./applications/transfer/v1/token"; +import * as _123 from "./applications/transfer/v1/transfer"; +import * as _124 from "./applications/transfer/v1/tx"; +import * as _125 from "./core/client/v1/client"; +import * as _126 from "./core/client/v1/genesis"; +import * as _127 from "./core/client/v1/query"; +import * as _128 from "./core/client/v1/tx"; +import * as _129 from "./core/commitment/v2/commitment"; +import * as _268 from "./applications/transfer/v1/tx.amino"; +import * as _269 from "./core/client/v1/tx.amino"; +import * as _270 from "./applications/transfer/v1/tx.registry"; +import * as _271 from "./core/client/v1/tx.registry"; +import * as _272 from "./applications/transfer/v1/query.lcd"; +import * as _273 from "./core/client/v1/query.lcd"; +import * as _274 from "./applications/transfer/v1/query.rpc.Query"; +import * as _275 from "./core/client/v1/query.rpc.Query"; +import * as _276 from "./applications/transfer/v1/tx.rpc.msg"; +import * as _277 from "./core/client/v1/tx.rpc.msg"; +import * as _311 from "./lcd"; +import * as _312 from "./rpc.query"; +import * as _313 from "./rpc.tx"; export namespace ibc { export namespace applications { export namespace transfer { export const v1 = { - ..._68, - ..._69, - ..._70, - ..._71, - ..._182, - ..._184, - ..._186, - ..._188, - ..._190 + ..._117, + ..._118, + ..._119, + ..._120, + ..._121, + ..._122, + ..._123, + ..._124, + ..._268, + ..._270, + ..._272, + ..._274, + ..._276 }; } } export namespace core { export namespace client { export const v1 = { - ..._72, - ..._73, - ..._74, - ..._75, - ..._183, - ..._185, - ..._187, - ..._189, - ..._191 + ..._125, + ..._126, + ..._127, + ..._128, + ..._269, + ..._271, + ..._273, + ..._275, + ..._277 + }; + } + export namespace commitment { + export const v2 = { + ..._129 }; } } export const ClientFactory = { - ..._230, - ..._231, - ..._232 + ..._311, + ..._312, + ..._313 }; } \ No newline at end of file diff --git a/packages/api/src/ibc/core/client/v1/client.ts b/packages/api/src/ibc/core/client/v1/client.ts index 399a1c7e..b5912c9e 100644 --- a/packages/api/src/ibc/core/client/v1/client.ts +++ b/packages/api/src/ibc/core/client/v1/client.ts @@ -1,6 +1,5 @@ //@ts-nocheck import { Any, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; -import { Plan, PlanAmino, PlanSDKType } from "../../../../cosmos/upgrade/v1beta1/upgrade"; import { BinaryReader, BinaryWriter } from "../../../../binary"; /** * IdentifiedClientState defines a client state with an additional client @@ -110,122 +109,6 @@ export interface ClientConsensusStatesSDKType { client_id: string; consensus_states: ConsensusStateWithHeightSDKType[]; } -/** - * ClientUpdateProposal is a governance proposal. If it passes, the substitute - * client's latest consensus state is copied over to the subject client. The proposal - * handler may fail if the subject and the substitute do not match in client and - * chain parameters (with exception to latest height, frozen height, and chain-id). - */ -export interface ClientUpdateProposal { - $typeUrl?: "/ibc.core.client.v1.ClientUpdateProposal"; - /** the title of the update proposal */ - title: string; - /** the description of the proposal */ - description: string; - /** the client identifier for the client to be updated if the proposal passes */ - subjectClientId: string; - /** - * the substitute client identifier for the client standing in for the subject - * client - */ - substituteClientId: string; -} -export interface ClientUpdateProposalProtoMsg { - typeUrl: "/ibc.core.client.v1.ClientUpdateProposal"; - value: Uint8Array; -} -/** - * ClientUpdateProposal is a governance proposal. If it passes, the substitute - * client's latest consensus state is copied over to the subject client. The proposal - * handler may fail if the subject and the substitute do not match in client and - * chain parameters (with exception to latest height, frozen height, and chain-id). - */ -export interface ClientUpdateProposalAmino { - /** the title of the update proposal */ - title?: string; - /** the description of the proposal */ - description?: string; - /** the client identifier for the client to be updated if the proposal passes */ - subject_client_id?: string; - /** - * the substitute client identifier for the client standing in for the subject - * client - */ - substitute_client_id?: string; -} -export interface ClientUpdateProposalAminoMsg { - type: "cosmos-sdk/ClientUpdateProposal"; - value: ClientUpdateProposalAmino; -} -/** - * ClientUpdateProposal is a governance proposal. If it passes, the substitute - * client's latest consensus state is copied over to the subject client. The proposal - * handler may fail if the subject and the substitute do not match in client and - * chain parameters (with exception to latest height, frozen height, and chain-id). - */ -export interface ClientUpdateProposalSDKType { - $typeUrl?: "/ibc.core.client.v1.ClientUpdateProposal"; - title: string; - description: string; - subject_client_id: string; - substitute_client_id: string; -} -/** - * UpgradeProposal is a gov Content type for initiating an IBC breaking - * upgrade. - */ -export interface UpgradeProposal { - $typeUrl?: "/ibc.core.client.v1.UpgradeProposal"; - title: string; - description: string; - plan: Plan; - /** - * An UpgradedClientState must be provided to perform an IBC breaking upgrade. - * This will make the chain commit to the correct upgraded (self) client state - * before the upgrade occurs, so that connecting chains can verify that the - * new upgraded client is valid by verifying a proof on the previous version - * of the chain. This will allow IBC connections to persist smoothly across - * planned chain upgrades - */ - upgradedClientState?: Any; -} -export interface UpgradeProposalProtoMsg { - typeUrl: "/ibc.core.client.v1.UpgradeProposal"; - value: Uint8Array; -} -/** - * UpgradeProposal is a gov Content type for initiating an IBC breaking - * upgrade. - */ -export interface UpgradeProposalAmino { - title?: string; - description?: string; - plan?: PlanAmino; - /** - * An UpgradedClientState must be provided to perform an IBC breaking upgrade. - * This will make the chain commit to the correct upgraded (self) client state - * before the upgrade occurs, so that connecting chains can verify that the - * new upgraded client is valid by verifying a proof on the previous version - * of the chain. This will allow IBC connections to persist smoothly across - * planned chain upgrades - */ - upgraded_client_state?: AnyAmino; -} -export interface UpgradeProposalAminoMsg { - type: "cosmos-sdk/UpgradeProposal"; - value: UpgradeProposalAmino; -} -/** - * UpgradeProposal is a gov Content type for initiating an IBC breaking - * upgrade. - */ -export interface UpgradeProposalSDKType { - $typeUrl?: "/ibc.core.client.v1.UpgradeProposal"; - title: string; - description: string; - plan: PlanSDKType; - upgraded_client_state?: AnySDKType; -} /** * Height is a monotonically increasing data type * that can be compared against another Height for the purposes of updating and @@ -237,6 +120,9 @@ export interface UpgradeProposalSDKType { * breaking changes In these cases, the RevisionNumber is incremented so that * height continues to be monitonically increasing even as the RevisionHeight * gets reset + * + * Please note that json tags for generated Go code are overridden to explicitly exclude the omitempty jsontag. + * This enforces the Go json marshaller to always emit zero values for both revision_number and revision_height. */ export interface Height { /** the revision that the client is currently on */ @@ -259,12 +145,15 @@ export interface HeightProtoMsg { * breaking changes In these cases, the RevisionNumber is incremented so that * height continues to be monitonically increasing even as the RevisionHeight * gets reset + * + * Please note that json tags for generated Go code are overridden to explicitly exclude the omitempty jsontag. + * This enforces the Go json marshaller to always emit zero values for both revision_number and revision_height. */ export interface HeightAmino { /** the revision that the client is currently on */ - revision_number?: string; + revision_number: string; /** the height within the given revision */ - revision_height?: string; + revision_height: string; } export interface HeightAminoMsg { type: "cosmos-sdk/Height"; @@ -281,6 +170,9 @@ export interface HeightAminoMsg { * breaking changes In these cases, the RevisionNumber is incremented so that * height continues to be monitonically increasing even as the RevisionHeight * gets reset + * + * Please note that json tags for generated Go code are overridden to explicitly exclude the omitempty jsontag. + * This enforces the Go json marshaller to always emit zero values for both revision_number and revision_height. */ export interface HeightSDKType { revision_number: bigint; @@ -288,7 +180,11 @@ export interface HeightSDKType { } /** Params defines the set of IBC light client parameters. */ export interface Params { - /** allowed_clients defines the list of allowed client state types. */ + /** + * allowed_clients defines the list of allowed client state types which can be created + * and interacted with. If a client type is removed from the allowed clients list, usage + * of this client will be disabled until it is added again to the list. + */ allowedClients: string[]; } export interface ParamsProtoMsg { @@ -297,7 +193,11 @@ export interface ParamsProtoMsg { } /** Params defines the set of IBC light client parameters. */ export interface ParamsAmino { - /** allowed_clients defines the list of allowed client state types. */ + /** + * allowed_clients defines the list of allowed client state types which can be created + * and interacted with. If a client type is removed from the allowed clients list, usage + * of this client will be disabled until it is added again to the list. + */ allowed_clients?: string[]; } export interface ParamsAminoMsg { @@ -553,218 +453,6 @@ export const ClientConsensusStates = { }; } }; -function createBaseClientUpdateProposal(): ClientUpdateProposal { - return { - $typeUrl: "/ibc.core.client.v1.ClientUpdateProposal", - title: "", - description: "", - subjectClientId: "", - substituteClientId: "" - }; -} -export const ClientUpdateProposal = { - typeUrl: "/ibc.core.client.v1.ClientUpdateProposal", - encode(message: ClientUpdateProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.title !== "") { - writer.uint32(10).string(message.title); - } - if (message.description !== "") { - writer.uint32(18).string(message.description); - } - if (message.subjectClientId !== "") { - writer.uint32(26).string(message.subjectClientId); - } - if (message.substituteClientId !== "") { - writer.uint32(34).string(message.substituteClientId); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): ClientUpdateProposal { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseClientUpdateProposal(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.title = reader.string(); - break; - case 2: - message.description = reader.string(); - break; - case 3: - message.subjectClientId = reader.string(); - break; - case 4: - message.substituteClientId = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromPartial(object: Partial): ClientUpdateProposal { - const message = createBaseClientUpdateProposal(); - message.title = object.title ?? ""; - message.description = object.description ?? ""; - message.subjectClientId = object.subjectClientId ?? ""; - message.substituteClientId = object.substituteClientId ?? ""; - return message; - }, - fromAmino(object: ClientUpdateProposalAmino): ClientUpdateProposal { - const message = createBaseClientUpdateProposal(); - if (object.title !== undefined && object.title !== null) { - message.title = object.title; - } - if (object.description !== undefined && object.description !== null) { - message.description = object.description; - } - if (object.subject_client_id !== undefined && object.subject_client_id !== null) { - message.subjectClientId = object.subject_client_id; - } - if (object.substitute_client_id !== undefined && object.substitute_client_id !== null) { - message.substituteClientId = object.substitute_client_id; - } - return message; - }, - toAmino(message: ClientUpdateProposal): ClientUpdateProposalAmino { - const obj: any = {}; - obj.title = message.title === "" ? undefined : message.title; - obj.description = message.description === "" ? undefined : message.description; - obj.subject_client_id = message.subjectClientId === "" ? undefined : message.subjectClientId; - obj.substitute_client_id = message.substituteClientId === "" ? undefined : message.substituteClientId; - return obj; - }, - fromAminoMsg(object: ClientUpdateProposalAminoMsg): ClientUpdateProposal { - return ClientUpdateProposal.fromAmino(object.value); - }, - toAminoMsg(message: ClientUpdateProposal): ClientUpdateProposalAminoMsg { - return { - type: "cosmos-sdk/ClientUpdateProposal", - value: ClientUpdateProposal.toAmino(message) - }; - }, - fromProtoMsg(message: ClientUpdateProposalProtoMsg): ClientUpdateProposal { - return ClientUpdateProposal.decode(message.value); - }, - toProto(message: ClientUpdateProposal): Uint8Array { - return ClientUpdateProposal.encode(message).finish(); - }, - toProtoMsg(message: ClientUpdateProposal): ClientUpdateProposalProtoMsg { - return { - typeUrl: "/ibc.core.client.v1.ClientUpdateProposal", - value: ClientUpdateProposal.encode(message).finish() - }; - } -}; -function createBaseUpgradeProposal(): UpgradeProposal { - return { - $typeUrl: "/ibc.core.client.v1.UpgradeProposal", - title: "", - description: "", - plan: Plan.fromPartial({}), - upgradedClientState: undefined - }; -} -export const UpgradeProposal = { - typeUrl: "/ibc.core.client.v1.UpgradeProposal", - encode(message: UpgradeProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.title !== "") { - writer.uint32(10).string(message.title); - } - if (message.description !== "") { - writer.uint32(18).string(message.description); - } - if (message.plan !== undefined) { - Plan.encode(message.plan, writer.uint32(26).fork()).ldelim(); - } - if (message.upgradedClientState !== undefined) { - Any.encode(message.upgradedClientState, writer.uint32(34).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): UpgradeProposal { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseUpgradeProposal(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.title = reader.string(); - break; - case 2: - message.description = reader.string(); - break; - case 3: - message.plan = Plan.decode(reader, reader.uint32()); - break; - case 4: - message.upgradedClientState = Any.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromPartial(object: Partial): UpgradeProposal { - const message = createBaseUpgradeProposal(); - message.title = object.title ?? ""; - message.description = object.description ?? ""; - message.plan = object.plan !== undefined && object.plan !== null ? Plan.fromPartial(object.plan) : undefined; - message.upgradedClientState = object.upgradedClientState !== undefined && object.upgradedClientState !== null ? Any.fromPartial(object.upgradedClientState) : undefined; - return message; - }, - fromAmino(object: UpgradeProposalAmino): UpgradeProposal { - const message = createBaseUpgradeProposal(); - if (object.title !== undefined && object.title !== null) { - message.title = object.title; - } - if (object.description !== undefined && object.description !== null) { - message.description = object.description; - } - if (object.plan !== undefined && object.plan !== null) { - message.plan = Plan.fromAmino(object.plan); - } - if (object.upgraded_client_state !== undefined && object.upgraded_client_state !== null) { - message.upgradedClientState = Any.fromAmino(object.upgraded_client_state); - } - return message; - }, - toAmino(message: UpgradeProposal): UpgradeProposalAmino { - const obj: any = {}; - obj.title = message.title === "" ? undefined : message.title; - obj.description = message.description === "" ? undefined : message.description; - obj.plan = message.plan ? Plan.toAmino(message.plan) : undefined; - obj.upgraded_client_state = message.upgradedClientState ? Any.toAmino(message.upgradedClientState) : undefined; - return obj; - }, - fromAminoMsg(object: UpgradeProposalAminoMsg): UpgradeProposal { - return UpgradeProposal.fromAmino(object.value); - }, - toAminoMsg(message: UpgradeProposal): UpgradeProposalAminoMsg { - return { - type: "cosmos-sdk/UpgradeProposal", - value: UpgradeProposal.toAmino(message) - }; - }, - fromProtoMsg(message: UpgradeProposalProtoMsg): UpgradeProposal { - return UpgradeProposal.decode(message.value); - }, - toProto(message: UpgradeProposal): Uint8Array { - return UpgradeProposal.encode(message).finish(); - }, - toProtoMsg(message: UpgradeProposal): UpgradeProposalProtoMsg { - return { - typeUrl: "/ibc.core.client.v1.UpgradeProposal", - value: UpgradeProposal.encode(message).finish() - }; - } -}; function createBaseHeight(): Height { return { revisionNumber: BigInt(0), @@ -816,8 +504,8 @@ export const Height = { }, toAmino(message: Height): HeightAmino { const obj: any = {}; - obj.revision_number = message.revisionNumber !== BigInt(0) ? message.revisionNumber?.toString() : undefined; - obj.revision_height = message.revisionHeight !== BigInt(0) ? message.revisionHeight?.toString() : undefined; + obj.revision_number = message.revisionNumber ? message.revisionNumber?.toString() : "0"; + obj.revision_height = message.revisionHeight ? message.revisionHeight?.toString() : "0"; return obj; }, fromAminoMsg(object: HeightAminoMsg): Height { diff --git a/packages/api/src/ibc/core/client/v1/genesis.ts b/packages/api/src/ibc/core/client/v1/genesis.ts index 7be1e4d8..bdd19144 100644 --- a/packages/api/src/ibc/core/client/v1/genesis.ts +++ b/packages/api/src/ibc/core/client/v1/genesis.ts @@ -11,7 +11,11 @@ export interface GenesisState { /** metadata from each client */ clientsMetadata: IdentifiedGenesisMetadata[]; params: Params; - /** create localhost on initialization */ + /** + * Deprecated: create_localhost has been deprecated. + * The localhost client is automatically created at genesis. + */ + /** @deprecated */ createLocalhost: boolean; /** the sequence for the next generated client identifier */ nextClientSequence: bigint; @@ -29,7 +33,11 @@ export interface GenesisStateAmino { /** metadata from each client */ clients_metadata?: IdentifiedGenesisMetadataAmino[]; params?: ParamsAmino; - /** create localhost on initialization */ + /** + * Deprecated: create_localhost has been deprecated. + * The localhost client is automatically created at genesis. + */ + /** @deprecated */ create_localhost?: boolean; /** the sequence for the next generated client identifier */ next_client_sequence?: string; @@ -44,12 +52,13 @@ export interface GenesisStateSDKType { clients_consensus: ClientConsensusStatesSDKType[]; clients_metadata: IdentifiedGenesisMetadataSDKType[]; params: ParamsSDKType; + /** @deprecated */ create_localhost: boolean; next_client_sequence: bigint; } /** - * GenesisMetadata defines the genesis type for metadata that clients may return - * with ExportMetadata + * GenesisMetadata defines the genesis type for metadata that will be used + * to export all client store keys that are not client or consensus states. */ export interface GenesisMetadata { /** store key of metadata without clientID-prefix */ @@ -62,8 +71,8 @@ export interface GenesisMetadataProtoMsg { value: Uint8Array; } /** - * GenesisMetadata defines the genesis type for metadata that clients may return - * with ExportMetadata + * GenesisMetadata defines the genesis type for metadata that will be used + * to export all client store keys that are not client or consensus states. */ export interface GenesisMetadataAmino { /** store key of metadata without clientID-prefix */ @@ -76,8 +85,8 @@ export interface GenesisMetadataAminoMsg { value: GenesisMetadataAmino; } /** - * GenesisMetadata defines the genesis type for metadata that clients may return - * with ExportMetadata + * GenesisMetadata defines the genesis type for metadata that will be used + * to export all client store keys that are not client or consensus states. */ export interface GenesisMetadataSDKType { key: Uint8Array; diff --git a/packages/api/src/ibc/core/client/v1/query.lcd.ts b/packages/api/src/ibc/core/client/v1/query.lcd.ts index 3fc23a1c..d837d22a 100644 --- a/packages/api/src/ibc/core/client/v1/query.lcd.ts +++ b/packages/api/src/ibc/core/client/v1/query.lcd.ts @@ -1,7 +1,7 @@ //@ts-nocheck import { setPaginationParams } from "../../../../helpers"; import { LCDClient } from "@cosmology/lcd"; -import { QueryClientStateRequest, QueryClientStateResponseSDKType, QueryClientStatesRequest, QueryClientStatesResponseSDKType, QueryConsensusStateRequest, QueryConsensusStateResponseSDKType, QueryConsensusStatesRequest, QueryConsensusStatesResponseSDKType, QueryConsensusStateHeightsRequest, QueryConsensusStateHeightsResponseSDKType, QueryClientStatusRequest, QueryClientStatusResponseSDKType, QueryClientParamsRequest, QueryClientParamsResponseSDKType, QueryUpgradedClientStateRequest, QueryUpgradedClientStateResponseSDKType, QueryUpgradedConsensusStateRequest, QueryUpgradedConsensusStateResponseSDKType } from "./query"; +import { QueryClientStateRequest, QueryClientStateResponseSDKType, QueryClientStatesRequest, QueryClientStatesResponseSDKType, QueryConsensusStateRequest, QueryConsensusStateResponseSDKType, QueryConsensusStatesRequest, QueryConsensusStatesResponseSDKType, QueryConsensusStateHeightsRequest, QueryConsensusStateHeightsResponseSDKType, QueryClientStatusRequest, QueryClientStatusResponseSDKType, QueryClientParamsRequest, QueryClientParamsResponseSDKType, QueryClientCreatorRequest, QueryClientCreatorResponseSDKType, QueryUpgradedClientStateRequest, QueryUpgradedClientStateResponseSDKType, QueryUpgradedConsensusStateRequest, QueryUpgradedConsensusStateResponseSDKType } from "./query"; export class LCDQueryClient { req: LCDClient; constructor({ @@ -17,6 +17,7 @@ export class LCDQueryClient { this.consensusStateHeights = this.consensusStateHeights.bind(this); this.clientStatus = this.clientStatus.bind(this); this.clientParams = this.clientParams.bind(this); + this.clientCreator = this.clientCreator.bind(this); this.upgradedClientState = this.upgradedClientState.bind(this); this.upgradedConsensusState = this.upgradedConsensusState.bind(this); } @@ -78,11 +79,16 @@ export class LCDQueryClient { const endpoint = `ibc/core/client/v1/client_status/${params.clientId}`; return await this.req.get(endpoint); } - /* ClientParams queries all parameters of the ibc client. */ + /* ClientParams queries all parameters of the ibc client submodule. */ async clientParams(_params: QueryClientParamsRequest = {}): Promise { - const endpoint = `ibc/client/v1/params`; + const endpoint = `ibc/core/client/v1/params`; return await this.req.get(endpoint); } + /* ClientCreator queries the creator of a given client. */ + async clientCreator(params: QueryClientCreatorRequest): Promise { + const endpoint = `ibc/core/client/v1/client_creator/${params.clientId}`; + return await this.req.get(endpoint); + } /* UpgradedClientState queries an Upgraded IBC light client. */ async upgradedClientState(_params: QueryUpgradedClientStateRequest = {}): Promise { const endpoint = `ibc/core/client/v1/upgraded_client_states`; diff --git a/packages/api/src/ibc/core/client/v1/query.rpc.Query.ts b/packages/api/src/ibc/core/client/v1/query.rpc.Query.ts index 34301774..8bef667a 100644 --- a/packages/api/src/ibc/core/client/v1/query.rpc.Query.ts +++ b/packages/api/src/ibc/core/client/v1/query.rpc.Query.ts @@ -2,7 +2,7 @@ import { Rpc } from "../../../../helpers"; import { BinaryReader } from "../../../../binary"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryClientStateRequest, QueryClientStateResponse, QueryClientStatesRequest, QueryClientStatesResponse, QueryConsensusStateRequest, QueryConsensusStateResponse, QueryConsensusStatesRequest, QueryConsensusStatesResponse, QueryConsensusStateHeightsRequest, QueryConsensusStateHeightsResponse, QueryClientStatusRequest, QueryClientStatusResponse, QueryClientParamsRequest, QueryClientParamsResponse, QueryUpgradedClientStateRequest, QueryUpgradedClientStateResponse, QueryUpgradedConsensusStateRequest, QueryUpgradedConsensusStateResponse } from "./query"; +import { QueryClientStateRequest, QueryClientStateResponse, QueryClientStatesRequest, QueryClientStatesResponse, QueryConsensusStateRequest, QueryConsensusStateResponse, QueryConsensusStatesRequest, QueryConsensusStatesResponse, QueryConsensusStateHeightsRequest, QueryConsensusStateHeightsResponse, QueryClientStatusRequest, QueryClientStatusResponse, QueryClientParamsRequest, QueryClientParamsResponse, QueryClientCreatorRequest, QueryClientCreatorResponse, QueryUpgradedClientStateRequest, QueryUpgradedClientStateResponse, QueryUpgradedConsensusStateRequest, QueryUpgradedConsensusStateResponse, QueryVerifyMembershipRequest, QueryVerifyMembershipResponse } from "./query"; /** Query provides defines the gRPC querier service */ export interface Query { /** ClientState queries an IBC light client. */ @@ -23,12 +23,16 @@ export interface Query { consensusStateHeights(request: QueryConsensusStateHeightsRequest): Promise; /** Status queries the status of an IBC client. */ clientStatus(request: QueryClientStatusRequest): Promise; - /** ClientParams queries all parameters of the ibc client. */ + /** ClientParams queries all parameters of the ibc client submodule. */ clientParams(request?: QueryClientParamsRequest): Promise; + /** ClientCreator queries the creator of a given client. */ + clientCreator(request: QueryClientCreatorRequest): Promise; /** UpgradedClientState queries an Upgraded IBC light client. */ upgradedClientState(request?: QueryUpgradedClientStateRequest): Promise; /** UpgradedConsensusState queries an Upgraded IBC consensus state. */ upgradedConsensusState(request?: QueryUpgradedConsensusStateRequest): Promise; + /** VerifyMembership queries an IBC light client for proof verification of a value at a given key path. */ + verifyMembership(request: QueryVerifyMembershipRequest): Promise; } export class QueryClientImpl implements Query { private readonly rpc: Rpc; @@ -41,8 +45,10 @@ export class QueryClientImpl implements Query { this.consensusStateHeights = this.consensusStateHeights.bind(this); this.clientStatus = this.clientStatus.bind(this); this.clientParams = this.clientParams.bind(this); + this.clientCreator = this.clientCreator.bind(this); this.upgradedClientState = this.upgradedClientState.bind(this); this.upgradedConsensusState = this.upgradedConsensusState.bind(this); + this.verifyMembership = this.verifyMembership.bind(this); } clientState(request: QueryClientStateRequest): Promise { const data = QueryClientStateRequest.encode(request).finish(); @@ -81,6 +87,11 @@ export class QueryClientImpl implements Query { const promise = this.rpc.request("ibc.core.client.v1.Query", "ClientParams", data); return promise.then(data => QueryClientParamsResponse.decode(new BinaryReader(data))); } + clientCreator(request: QueryClientCreatorRequest): Promise { + const data = QueryClientCreatorRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.client.v1.Query", "ClientCreator", data); + return promise.then(data => QueryClientCreatorResponse.decode(new BinaryReader(data))); + } upgradedClientState(request: QueryUpgradedClientStateRequest = {}): Promise { const data = QueryUpgradedClientStateRequest.encode(request).finish(); const promise = this.rpc.request("ibc.core.client.v1.Query", "UpgradedClientState", data); @@ -91,6 +102,11 @@ export class QueryClientImpl implements Query { const promise = this.rpc.request("ibc.core.client.v1.Query", "UpgradedConsensusState", data); return promise.then(data => QueryUpgradedConsensusStateResponse.decode(new BinaryReader(data))); } + verifyMembership(request: QueryVerifyMembershipRequest): Promise { + const data = QueryVerifyMembershipRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.client.v1.Query", "VerifyMembership", data); + return promise.then(data => QueryVerifyMembershipResponse.decode(new BinaryReader(data))); + } } export const createRpcQueryExtension = (base: QueryClient) => { const rpc = createProtobufRpcClient(base); @@ -117,11 +133,17 @@ export const createRpcQueryExtension = (base: QueryClient) => { clientParams(request?: QueryClientParamsRequest): Promise { return queryService.clientParams(request); }, + clientCreator(request: QueryClientCreatorRequest): Promise { + return queryService.clientCreator(request); + }, upgradedClientState(request?: QueryUpgradedClientStateRequest): Promise { return queryService.upgradedClientState(request); }, upgradedConsensusState(request?: QueryUpgradedConsensusStateRequest): Promise { return queryService.upgradedConsensusState(request); + }, + verifyMembership(request: QueryVerifyMembershipRequest): Promise { + return queryService.verifyMembership(request); } }; }; \ No newline at end of file diff --git a/packages/api/src/ibc/core/client/v1/query.ts b/packages/api/src/ibc/core/client/v1/query.ts index 47cf8108..fc982cde 100644 --- a/packages/api/src/ibc/core/client/v1/query.ts +++ b/packages/api/src/ibc/core/client/v1/query.ts @@ -1,7 +1,8 @@ //@ts-nocheck import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination"; -import { Any, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; import { Height, HeightAmino, HeightSDKType, IdentifiedClientState, IdentifiedClientStateAmino, IdentifiedClientStateSDKType, ConsensusStateWithHeight, ConsensusStateWithHeightAmino, ConsensusStateWithHeightSDKType, Params, ParamsAmino, ParamsSDKType } from "./client"; +import { MerklePath, MerklePathAmino, MerklePathSDKType } from "../../commitment/v2/commitment"; +import { Any, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../../binary"; import { bytesFromBase64, base64FromBytes } from "../../../../helpers"; /** @@ -159,7 +160,7 @@ export interface QueryConsensusStateRequest { /** consensus state revision height */ revisionHeight: bigint; /** - * latest_height overrrides the height field and queries the latest stored + * latest_height overrides the height field and queries the latest stored * ConsensusState */ latestHeight: boolean; @@ -181,7 +182,7 @@ export interface QueryConsensusStateRequestAmino { /** consensus state revision height */ revision_height?: string; /** - * latest_height overrrides the height field and queries the latest stored + * latest_height overrides the height field and queries the latest stored * ConsensusState */ latest_height?: boolean; @@ -500,6 +501,68 @@ export interface QueryClientParamsResponseAminoMsg { export interface QueryClientParamsResponseSDKType { params?: ParamsSDKType; } +/** + * QueryClientCreatorRequest is the request type for the Query/ClientCreator RPC + * method. + */ +export interface QueryClientCreatorRequest { + /** client unique identifier */ + clientId: string; +} +export interface QueryClientCreatorRequestProtoMsg { + typeUrl: "/ibc.core.client.v1.QueryClientCreatorRequest"; + value: Uint8Array; +} +/** + * QueryClientCreatorRequest is the request type for the Query/ClientCreator RPC + * method. + */ +export interface QueryClientCreatorRequestAmino { + /** client unique identifier */ + client_id?: string; +} +export interface QueryClientCreatorRequestAminoMsg { + type: "cosmos-sdk/QueryClientCreatorRequest"; + value: QueryClientCreatorRequestAmino; +} +/** + * QueryClientCreatorRequest is the request type for the Query/ClientCreator RPC + * method. + */ +export interface QueryClientCreatorRequestSDKType { + client_id: string; +} +/** + * QueryClientCreatorResponse is the response type for the Query/ClientCreator RPC + * method. + */ +export interface QueryClientCreatorResponse { + /** creator of the client */ + creator: string; +} +export interface QueryClientCreatorResponseProtoMsg { + typeUrl: "/ibc.core.client.v1.QueryClientCreatorResponse"; + value: Uint8Array; +} +/** + * QueryClientCreatorResponse is the response type for the Query/ClientCreator RPC + * method. + */ +export interface QueryClientCreatorResponseAmino { + /** creator of the client */ + creator?: string; +} +export interface QueryClientCreatorResponseAminoMsg { + type: "cosmos-sdk/QueryClientCreatorResponse"; + value: QueryClientCreatorResponseAmino; +} +/** + * QueryClientCreatorResponse is the response type for the Query/ClientCreator RPC + * method. + */ +export interface QueryClientCreatorResponseSDKType { + creator: string; +} /** * QueryUpgradedClientStateRequest is the request type for the * Query/UpgradedClientState RPC method @@ -608,6 +671,80 @@ export interface QueryUpgradedConsensusStateResponseAminoMsg { export interface QueryUpgradedConsensusStateResponseSDKType { upgraded_consensus_state?: AnySDKType; } +/** QueryVerifyMembershipRequest is the request type for the Query/VerifyMembership RPC method */ +export interface QueryVerifyMembershipRequest { + /** client unique identifier. */ + clientId: string; + /** the proof to be verified by the client. */ + proof: Uint8Array; + /** the height of the commitment root at which the proof is verified. */ + proofHeight: Height; + /** the value which is proven. */ + value: Uint8Array; + /** optional time delay */ + timeDelay: bigint; + /** optional block delay */ + blockDelay: bigint; + /** the commitment key path. */ + merklePath: MerklePath; +} +export interface QueryVerifyMembershipRequestProtoMsg { + typeUrl: "/ibc.core.client.v1.QueryVerifyMembershipRequest"; + value: Uint8Array; +} +/** QueryVerifyMembershipRequest is the request type for the Query/VerifyMembership RPC method */ +export interface QueryVerifyMembershipRequestAmino { + /** client unique identifier. */ + client_id?: string; + /** the proof to be verified by the client. */ + proof?: string; + /** the height of the commitment root at which the proof is verified. */ + proof_height?: HeightAmino; + /** the value which is proven. */ + value?: string; + /** optional time delay */ + time_delay?: string; + /** optional block delay */ + block_delay?: string; + /** the commitment key path. */ + merkle_path?: MerklePathAmino; +} +export interface QueryVerifyMembershipRequestAminoMsg { + type: "cosmos-sdk/QueryVerifyMembershipRequest"; + value: QueryVerifyMembershipRequestAmino; +} +/** QueryVerifyMembershipRequest is the request type for the Query/VerifyMembership RPC method */ +export interface QueryVerifyMembershipRequestSDKType { + client_id: string; + proof: Uint8Array; + proof_height: HeightSDKType; + value: Uint8Array; + time_delay: bigint; + block_delay: bigint; + merkle_path: MerklePathSDKType; +} +/** QueryVerifyMembershipResponse is the response type for the Query/VerifyMembership RPC method */ +export interface QueryVerifyMembershipResponse { + /** boolean indicating success or failure of proof verification. */ + success: boolean; +} +export interface QueryVerifyMembershipResponseProtoMsg { + typeUrl: "/ibc.core.client.v1.QueryVerifyMembershipResponse"; + value: Uint8Array; +} +/** QueryVerifyMembershipResponse is the response type for the Query/VerifyMembership RPC method */ +export interface QueryVerifyMembershipResponseAmino { + /** boolean indicating success or failure of proof verification. */ + success?: boolean; +} +export interface QueryVerifyMembershipResponseAminoMsg { + type: "cosmos-sdk/QueryVerifyMembershipResponse"; + value: QueryVerifyMembershipResponseAmino; +} +/** QueryVerifyMembershipResponse is the response type for the Query/VerifyMembership RPC method */ +export interface QueryVerifyMembershipResponseSDKType { + success: boolean; +} function createBaseQueryClientStateRequest(): QueryClientStateRequest { return { clientId: "" @@ -1711,6 +1848,144 @@ export const QueryClientParamsResponse = { }; } }; +function createBaseQueryClientCreatorRequest(): QueryClientCreatorRequest { + return { + clientId: "" + }; +} +export const QueryClientCreatorRequest = { + typeUrl: "/ibc.core.client.v1.QueryClientCreatorRequest", + encode(message: QueryClientCreatorRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryClientCreatorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClientCreatorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryClientCreatorRequest { + const message = createBaseQueryClientCreatorRequest(); + message.clientId = object.clientId ?? ""; + return message; + }, + fromAmino(object: QueryClientCreatorRequestAmino): QueryClientCreatorRequest { + const message = createBaseQueryClientCreatorRequest(); + if (object.client_id !== undefined && object.client_id !== null) { + message.clientId = object.client_id; + } + return message; + }, + toAmino(message: QueryClientCreatorRequest): QueryClientCreatorRequestAmino { + const obj: any = {}; + obj.client_id = message.clientId === "" ? undefined : message.clientId; + return obj; + }, + fromAminoMsg(object: QueryClientCreatorRequestAminoMsg): QueryClientCreatorRequest { + return QueryClientCreatorRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryClientCreatorRequest): QueryClientCreatorRequestAminoMsg { + return { + type: "cosmos-sdk/QueryClientCreatorRequest", + value: QueryClientCreatorRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryClientCreatorRequestProtoMsg): QueryClientCreatorRequest { + return QueryClientCreatorRequest.decode(message.value); + }, + toProto(message: QueryClientCreatorRequest): Uint8Array { + return QueryClientCreatorRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryClientCreatorRequest): QueryClientCreatorRequestProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.QueryClientCreatorRequest", + value: QueryClientCreatorRequest.encode(message).finish() + }; + } +}; +function createBaseQueryClientCreatorResponse(): QueryClientCreatorResponse { + return { + creator: "" + }; +} +export const QueryClientCreatorResponse = { + typeUrl: "/ibc.core.client.v1.QueryClientCreatorResponse", + encode(message: QueryClientCreatorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryClientCreatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClientCreatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.creator = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryClientCreatorResponse { + const message = createBaseQueryClientCreatorResponse(); + message.creator = object.creator ?? ""; + return message; + }, + fromAmino(object: QueryClientCreatorResponseAmino): QueryClientCreatorResponse { + const message = createBaseQueryClientCreatorResponse(); + if (object.creator !== undefined && object.creator !== null) { + message.creator = object.creator; + } + return message; + }, + toAmino(message: QueryClientCreatorResponse): QueryClientCreatorResponseAmino { + const obj: any = {}; + obj.creator = message.creator === "" ? undefined : message.creator; + return obj; + }, + fromAminoMsg(object: QueryClientCreatorResponseAminoMsg): QueryClientCreatorResponse { + return QueryClientCreatorResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryClientCreatorResponse): QueryClientCreatorResponseAminoMsg { + return { + type: "cosmos-sdk/QueryClientCreatorResponse", + value: QueryClientCreatorResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryClientCreatorResponseProtoMsg): QueryClientCreatorResponse { + return QueryClientCreatorResponse.decode(message.value); + }, + toProto(message: QueryClientCreatorResponse): Uint8Array { + return QueryClientCreatorResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryClientCreatorResponse): QueryClientCreatorResponseProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.QueryClientCreatorResponse", + value: QueryClientCreatorResponse.encode(message).finish() + }; + } +}; function createBaseQueryUpgradedClientStateRequest(): QueryUpgradedClientStateRequest { return {}; } @@ -1960,4 +2235,214 @@ export const QueryUpgradedConsensusStateResponse = { value: QueryUpgradedConsensusStateResponse.encode(message).finish() }; } +}; +function createBaseQueryVerifyMembershipRequest(): QueryVerifyMembershipRequest { + return { + clientId: "", + proof: new Uint8Array(), + proofHeight: Height.fromPartial({}), + value: new Uint8Array(), + timeDelay: BigInt(0), + blockDelay: BigInt(0), + merklePath: MerklePath.fromPartial({}) + }; +} +export const QueryVerifyMembershipRequest = { + typeUrl: "/ibc.core.client.v1.QueryVerifyMembershipRequest", + encode(message: QueryVerifyMembershipRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.proof.length !== 0) { + writer.uint32(18).bytes(message.proof); + } + if (message.proofHeight !== undefined) { + Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); + } + if (message.value.length !== 0) { + writer.uint32(42).bytes(message.value); + } + if (message.timeDelay !== BigInt(0)) { + writer.uint32(48).uint64(message.timeDelay); + } + if (message.blockDelay !== BigInt(0)) { + writer.uint32(56).uint64(message.blockDelay); + } + if (message.merklePath !== undefined) { + MerklePath.encode(message.merklePath, writer.uint32(66).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryVerifyMembershipRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVerifyMembershipRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.proof = reader.bytes(); + break; + case 3: + message.proofHeight = Height.decode(reader, reader.uint32()); + break; + case 5: + message.value = reader.bytes(); + break; + case 6: + message.timeDelay = reader.uint64(); + break; + case 7: + message.blockDelay = reader.uint64(); + break; + case 8: + message.merklePath = MerklePath.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryVerifyMembershipRequest { + const message = createBaseQueryVerifyMembershipRequest(); + message.clientId = object.clientId ?? ""; + message.proof = object.proof ?? new Uint8Array(); + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; + message.value = object.value ?? new Uint8Array(); + message.timeDelay = object.timeDelay !== undefined && object.timeDelay !== null ? BigInt(object.timeDelay.toString()) : BigInt(0); + message.blockDelay = object.blockDelay !== undefined && object.blockDelay !== null ? BigInt(object.blockDelay.toString()) : BigInt(0); + message.merklePath = object.merklePath !== undefined && object.merklePath !== null ? MerklePath.fromPartial(object.merklePath) : undefined; + return message; + }, + fromAmino(object: QueryVerifyMembershipRequestAmino): QueryVerifyMembershipRequest { + const message = createBaseQueryVerifyMembershipRequest(); + if (object.client_id !== undefined && object.client_id !== null) { + message.clientId = object.client_id; + } + if (object.proof !== undefined && object.proof !== null) { + message.proof = bytesFromBase64(object.proof); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + if (object.value !== undefined && object.value !== null) { + message.value = bytesFromBase64(object.value); + } + if (object.time_delay !== undefined && object.time_delay !== null) { + message.timeDelay = BigInt(object.time_delay); + } + if (object.block_delay !== undefined && object.block_delay !== null) { + message.blockDelay = BigInt(object.block_delay); + } + if (object.merkle_path !== undefined && object.merkle_path !== null) { + message.merklePath = MerklePath.fromAmino(object.merkle_path); + } + return message; + }, + toAmino(message: QueryVerifyMembershipRequest): QueryVerifyMembershipRequestAmino { + const obj: any = {}; + obj.client_id = message.clientId === "" ? undefined : message.clientId; + obj.proof = message.proof ? base64FromBytes(message.proof) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + obj.value = message.value ? base64FromBytes(message.value) : undefined; + obj.time_delay = message.timeDelay !== BigInt(0) ? message.timeDelay?.toString() : undefined; + obj.block_delay = message.blockDelay !== BigInt(0) ? message.blockDelay?.toString() : undefined; + obj.merkle_path = message.merklePath ? MerklePath.toAmino(message.merklePath) : undefined; + return obj; + }, + fromAminoMsg(object: QueryVerifyMembershipRequestAminoMsg): QueryVerifyMembershipRequest { + return QueryVerifyMembershipRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryVerifyMembershipRequest): QueryVerifyMembershipRequestAminoMsg { + return { + type: "cosmos-sdk/QueryVerifyMembershipRequest", + value: QueryVerifyMembershipRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryVerifyMembershipRequestProtoMsg): QueryVerifyMembershipRequest { + return QueryVerifyMembershipRequest.decode(message.value); + }, + toProto(message: QueryVerifyMembershipRequest): Uint8Array { + return QueryVerifyMembershipRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryVerifyMembershipRequest): QueryVerifyMembershipRequestProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.QueryVerifyMembershipRequest", + value: QueryVerifyMembershipRequest.encode(message).finish() + }; + } +}; +function createBaseQueryVerifyMembershipResponse(): QueryVerifyMembershipResponse { + return { + success: false + }; +} +export const QueryVerifyMembershipResponse = { + typeUrl: "/ibc.core.client.v1.QueryVerifyMembershipResponse", + encode(message: QueryVerifyMembershipResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.success === true) { + writer.uint32(8).bool(message.success); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryVerifyMembershipResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVerifyMembershipResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.success = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): QueryVerifyMembershipResponse { + const message = createBaseQueryVerifyMembershipResponse(); + message.success = object.success ?? false; + return message; + }, + fromAmino(object: QueryVerifyMembershipResponseAmino): QueryVerifyMembershipResponse { + const message = createBaseQueryVerifyMembershipResponse(); + if (object.success !== undefined && object.success !== null) { + message.success = object.success; + } + return message; + }, + toAmino(message: QueryVerifyMembershipResponse): QueryVerifyMembershipResponseAmino { + const obj: any = {}; + obj.success = message.success === false ? undefined : message.success; + return obj; + }, + fromAminoMsg(object: QueryVerifyMembershipResponseAminoMsg): QueryVerifyMembershipResponse { + return QueryVerifyMembershipResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryVerifyMembershipResponse): QueryVerifyMembershipResponseAminoMsg { + return { + type: "cosmos-sdk/QueryVerifyMembershipResponse", + value: QueryVerifyMembershipResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryVerifyMembershipResponseProtoMsg): QueryVerifyMembershipResponse { + return QueryVerifyMembershipResponse.decode(message.value); + }, + toProto(message: QueryVerifyMembershipResponse): Uint8Array { + return QueryVerifyMembershipResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryVerifyMembershipResponse): QueryVerifyMembershipResponseProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.QueryVerifyMembershipResponse", + value: QueryVerifyMembershipResponse.encode(message).finish() + }; + } }; \ No newline at end of file diff --git a/packages/api/src/ibc/core/client/v1/tx.amino.ts b/packages/api/src/ibc/core/client/v1/tx.amino.ts index 1e8e1dca..e19fc903 100644 --- a/packages/api/src/ibc/core/client/v1/tx.amino.ts +++ b/packages/api/src/ibc/core/client/v1/tx.amino.ts @@ -1,5 +1,5 @@ //@ts-nocheck -import { MsgCreateClient, MsgUpdateClient, MsgUpgradeClient, MsgSubmitMisbehaviour } from "./tx"; +import { MsgCreateClient, MsgUpdateClient, MsgUpgradeClient, MsgRecoverClient, MsgIBCSoftwareUpgrade, MsgUpdateParams, MsgDeleteClientCreator } from "./tx"; export const AminoConverter = { "/ibc.core.client.v1.MsgCreateClient": { aminoType: "cosmos-sdk/MsgCreateClient", @@ -16,9 +16,24 @@ export const AminoConverter = { toAmino: MsgUpgradeClient.toAmino, fromAmino: MsgUpgradeClient.fromAmino }, - "/ibc.core.client.v1.MsgSubmitMisbehaviour": { - aminoType: "cosmos-sdk/MsgSubmitMisbehaviour", - toAmino: MsgSubmitMisbehaviour.toAmino, - fromAmino: MsgSubmitMisbehaviour.fromAmino + "/ibc.core.client.v1.MsgRecoverClient": { + aminoType: "cosmos-sdk/MsgRecoverClient", + toAmino: MsgRecoverClient.toAmino, + fromAmino: MsgRecoverClient.fromAmino + }, + "/ibc.core.client.v1.MsgIBCSoftwareUpgrade": { + aminoType: "cosmos-sdk/MsgIBCSoftwareUpgrade", + toAmino: MsgIBCSoftwareUpgrade.toAmino, + fromAmino: MsgIBCSoftwareUpgrade.fromAmino + }, + "/ibc.core.client.v1.MsgUpdateParams": { + aminoType: "cosmos-sdk/MsgUpdateParams", + toAmino: MsgUpdateParams.toAmino, + fromAmino: MsgUpdateParams.fromAmino + }, + "/ibc.core.client.v1.MsgDeleteClientCreator": { + aminoType: "cosmos-sdk/MsgDeleteClientCreator", + toAmino: MsgDeleteClientCreator.toAmino, + fromAmino: MsgDeleteClientCreator.fromAmino } }; \ No newline at end of file diff --git a/packages/api/src/ibc/core/client/v1/tx.registry.ts b/packages/api/src/ibc/core/client/v1/tx.registry.ts index fe83153f..d50daaad 100644 --- a/packages/api/src/ibc/core/client/v1/tx.registry.ts +++ b/packages/api/src/ibc/core/client/v1/tx.registry.ts @@ -1,7 +1,7 @@ //@ts-nocheck import { GeneratedType, Registry } from "@cosmjs/proto-signing"; -import { MsgCreateClient, MsgUpdateClient, MsgUpgradeClient, MsgSubmitMisbehaviour } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/ibc.core.client.v1.MsgCreateClient", MsgCreateClient], ["/ibc.core.client.v1.MsgUpdateClient", MsgUpdateClient], ["/ibc.core.client.v1.MsgUpgradeClient", MsgUpgradeClient], ["/ibc.core.client.v1.MsgSubmitMisbehaviour", MsgSubmitMisbehaviour]]; +import { MsgCreateClient, MsgUpdateClient, MsgUpgradeClient, MsgRecoverClient, MsgIBCSoftwareUpgrade, MsgUpdateParams, MsgDeleteClientCreator } from "./tx"; +export const registry: ReadonlyArray<[string, GeneratedType]> = [["/ibc.core.client.v1.MsgCreateClient", MsgCreateClient], ["/ibc.core.client.v1.MsgUpdateClient", MsgUpdateClient], ["/ibc.core.client.v1.MsgUpgradeClient", MsgUpgradeClient], ["/ibc.core.client.v1.MsgRecoverClient", MsgRecoverClient], ["/ibc.core.client.v1.MsgIBCSoftwareUpgrade", MsgIBCSoftwareUpgrade], ["/ibc.core.client.v1.MsgUpdateParams", MsgUpdateParams], ["/ibc.core.client.v1.MsgDeleteClientCreator", MsgDeleteClientCreator]]; export const load = (protoRegistry: Registry) => { registry.forEach(([typeUrl, mod]) => { protoRegistry.register(typeUrl, mod); @@ -27,10 +27,28 @@ export const MessageComposer = { value: MsgUpgradeClient.encode(value).finish() }; }, - submitMisbehaviour(value: MsgSubmitMisbehaviour) { + recoverClient(value: MsgRecoverClient) { return { - typeUrl: "/ibc.core.client.v1.MsgSubmitMisbehaviour", - value: MsgSubmitMisbehaviour.encode(value).finish() + typeUrl: "/ibc.core.client.v1.MsgRecoverClient", + value: MsgRecoverClient.encode(value).finish() + }; + }, + iBCSoftwareUpgrade(value: MsgIBCSoftwareUpgrade) { + return { + typeUrl: "/ibc.core.client.v1.MsgIBCSoftwareUpgrade", + value: MsgIBCSoftwareUpgrade.encode(value).finish() + }; + }, + updateClientParams(value: MsgUpdateParams) { + return { + typeUrl: "/ibc.core.client.v1.MsgUpdateParams", + value: MsgUpdateParams.encode(value).finish() + }; + }, + deleteClientCreator(value: MsgDeleteClientCreator) { + return { + typeUrl: "/ibc.core.client.v1.MsgDeleteClientCreator", + value: MsgDeleteClientCreator.encode(value).finish() }; } }, @@ -53,9 +71,27 @@ export const MessageComposer = { value }; }, - submitMisbehaviour(value: MsgSubmitMisbehaviour) { + recoverClient(value: MsgRecoverClient) { + return { + typeUrl: "/ibc.core.client.v1.MsgRecoverClient", + value + }; + }, + iBCSoftwareUpgrade(value: MsgIBCSoftwareUpgrade) { + return { + typeUrl: "/ibc.core.client.v1.MsgIBCSoftwareUpgrade", + value + }; + }, + updateClientParams(value: MsgUpdateParams) { + return { + typeUrl: "/ibc.core.client.v1.MsgUpdateParams", + value + }; + }, + deleteClientCreator(value: MsgDeleteClientCreator) { return { - typeUrl: "/ibc.core.client.v1.MsgSubmitMisbehaviour", + typeUrl: "/ibc.core.client.v1.MsgDeleteClientCreator", value }; } @@ -79,10 +115,28 @@ export const MessageComposer = { value: MsgUpgradeClient.fromPartial(value) }; }, - submitMisbehaviour(value: MsgSubmitMisbehaviour) { + recoverClient(value: MsgRecoverClient) { + return { + typeUrl: "/ibc.core.client.v1.MsgRecoverClient", + value: MsgRecoverClient.fromPartial(value) + }; + }, + iBCSoftwareUpgrade(value: MsgIBCSoftwareUpgrade) { + return { + typeUrl: "/ibc.core.client.v1.MsgIBCSoftwareUpgrade", + value: MsgIBCSoftwareUpgrade.fromPartial(value) + }; + }, + updateClientParams(value: MsgUpdateParams) { + return { + typeUrl: "/ibc.core.client.v1.MsgUpdateParams", + value: MsgUpdateParams.fromPartial(value) + }; + }, + deleteClientCreator(value: MsgDeleteClientCreator) { return { - typeUrl: "/ibc.core.client.v1.MsgSubmitMisbehaviour", - value: MsgSubmitMisbehaviour.fromPartial(value) + typeUrl: "/ibc.core.client.v1.MsgDeleteClientCreator", + value: MsgDeleteClientCreator.fromPartial(value) }; } } diff --git a/packages/api/src/ibc/core/client/v1/tx.rpc.msg.ts b/packages/api/src/ibc/core/client/v1/tx.rpc.msg.ts index 894e0158..7970b694 100644 --- a/packages/api/src/ibc/core/client/v1/tx.rpc.msg.ts +++ b/packages/api/src/ibc/core/client/v1/tx.rpc.msg.ts @@ -1,7 +1,7 @@ //@ts-nocheck import { Rpc } from "../../../../helpers"; import { BinaryReader } from "../../../../binary"; -import { MsgCreateClient, MsgCreateClientResponse, MsgUpdateClient, MsgUpdateClientResponse, MsgUpgradeClient, MsgUpgradeClientResponse, MsgSubmitMisbehaviour, MsgSubmitMisbehaviourResponse } from "./tx"; +import { MsgCreateClient, MsgCreateClientResponse, MsgUpdateClient, MsgUpdateClientResponse, MsgUpgradeClient, MsgUpgradeClientResponse, MsgRecoverClient, MsgRecoverClientResponse, MsgIBCSoftwareUpgrade, MsgIBCSoftwareUpgradeResponse, MsgUpdateParams, MsgUpdateParamsResponse, MsgDeleteClientCreator, MsgDeleteClientCreatorResponse } from "./tx"; /** Msg defines the ibc/client Msg service. */ export interface Msg { /** CreateClient defines a rpc handler method for MsgCreateClient. */ @@ -10,8 +10,14 @@ export interface Msg { updateClient(request: MsgUpdateClient): Promise; /** UpgradeClient defines a rpc handler method for MsgUpgradeClient. */ upgradeClient(request: MsgUpgradeClient): Promise; - /** SubmitMisbehaviour defines a rpc handler method for MsgSubmitMisbehaviour. */ - submitMisbehaviour(request: MsgSubmitMisbehaviour): Promise; + /** RecoverClient defines a rpc handler method for MsgRecoverClient. */ + recoverClient(request: MsgRecoverClient): Promise; + /** IBCSoftwareUpgrade defines a rpc handler method for MsgIBCSoftwareUpgrade. */ + iBCSoftwareUpgrade(request: MsgIBCSoftwareUpgrade): Promise; + /** UpdateClientParams defines a rpc handler method for MsgUpdateParams. */ + updateClientParams(request: MsgUpdateParams): Promise; + /** DeleteClientCreator defines a rpc handler method for MsgDeleteClientCreator. */ + deleteClientCreator(request: MsgDeleteClientCreator): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: Rpc; @@ -20,7 +26,10 @@ export class MsgClientImpl implements Msg { this.createClient = this.createClient.bind(this); this.updateClient = this.updateClient.bind(this); this.upgradeClient = this.upgradeClient.bind(this); - this.submitMisbehaviour = this.submitMisbehaviour.bind(this); + this.recoverClient = this.recoverClient.bind(this); + this.iBCSoftwareUpgrade = this.iBCSoftwareUpgrade.bind(this); + this.updateClientParams = this.updateClientParams.bind(this); + this.deleteClientCreator = this.deleteClientCreator.bind(this); } createClient(request: MsgCreateClient): Promise { const data = MsgCreateClient.encode(request).finish(); @@ -37,9 +46,24 @@ export class MsgClientImpl implements Msg { const promise = this.rpc.request("ibc.core.client.v1.Msg", "UpgradeClient", data); return promise.then(data => MsgUpgradeClientResponse.decode(new BinaryReader(data))); } - submitMisbehaviour(request: MsgSubmitMisbehaviour): Promise { - const data = MsgSubmitMisbehaviour.encode(request).finish(); - const promise = this.rpc.request("ibc.core.client.v1.Msg", "SubmitMisbehaviour", data); - return promise.then(data => MsgSubmitMisbehaviourResponse.decode(new BinaryReader(data))); + recoverClient(request: MsgRecoverClient): Promise { + const data = MsgRecoverClient.encode(request).finish(); + const promise = this.rpc.request("ibc.core.client.v1.Msg", "RecoverClient", data); + return promise.then(data => MsgRecoverClientResponse.decode(new BinaryReader(data))); + } + iBCSoftwareUpgrade(request: MsgIBCSoftwareUpgrade): Promise { + const data = MsgIBCSoftwareUpgrade.encode(request).finish(); + const promise = this.rpc.request("ibc.core.client.v1.Msg", "IBCSoftwareUpgrade", data); + return promise.then(data => MsgIBCSoftwareUpgradeResponse.decode(new BinaryReader(data))); + } + updateClientParams(request: MsgUpdateParams): Promise { + const data = MsgUpdateParams.encode(request).finish(); + const promise = this.rpc.request("ibc.core.client.v1.Msg", "UpdateClientParams", data); + return promise.then(data => MsgUpdateParamsResponse.decode(new BinaryReader(data))); + } + deleteClientCreator(request: MsgDeleteClientCreator): Promise { + const data = MsgDeleteClientCreator.encode(request).finish(); + const promise = this.rpc.request("ibc.core.client.v1.Msg", "DeleteClientCreator", data); + return promise.then(data => MsgDeleteClientCreatorResponse.decode(new BinaryReader(data))); } } \ No newline at end of file diff --git a/packages/api/src/ibc/core/client/v1/tx.ts b/packages/api/src/ibc/core/client/v1/tx.ts index f3bea595..246328df 100644 --- a/packages/api/src/ibc/core/client/v1/tx.ts +++ b/packages/api/src/ibc/core/client/v1/tx.ts @@ -1,5 +1,7 @@ //@ts-nocheck import { Any, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; +import { Plan, PlanAmino, PlanSDKType } from "../../../../cosmos/upgrade/v1beta1/upgrade"; +import { Params, ParamsAmino, ParamsSDKType } from "./client"; import { BinaryReader, BinaryWriter } from "../../../../binary"; import { bytesFromBase64, base64FromBytes } from "../../../../helpers"; /** MsgCreateClient defines a message to create an IBC client */ @@ -41,19 +43,25 @@ export interface MsgCreateClientSDKType { signer: string; } /** MsgCreateClientResponse defines the Msg/CreateClient response type. */ -export interface MsgCreateClientResponse {} +export interface MsgCreateClientResponse { + clientId: string; +} export interface MsgCreateClientResponseProtoMsg { typeUrl: "/ibc.core.client.v1.MsgCreateClientResponse"; value: Uint8Array; } /** MsgCreateClientResponse defines the Msg/CreateClient response type. */ -export interface MsgCreateClientResponseAmino {} +export interface MsgCreateClientResponseAmino { + client_id?: string; +} export interface MsgCreateClientResponseAminoMsg { type: "cosmos-sdk/MsgCreateClientResponse"; value: MsgCreateClientResponseAmino; } /** MsgCreateClientResponse defines the Msg/CreateClient response type. */ -export interface MsgCreateClientResponseSDKType {} +export interface MsgCreateClientResponseSDKType { + client_id: string; +} /** * MsgUpdateClient defines an sdk.Msg to update a IBC client state using * the given client message. @@ -185,82 +193,210 @@ export interface MsgUpgradeClientResponseAminoMsg { } /** MsgUpgradeClientResponse defines the Msg/UpgradeClient response type. */ export interface MsgUpgradeClientResponseSDKType {} -/** - * MsgSubmitMisbehaviour defines an sdk.Msg type that submits Evidence for - * light client misbehaviour. - * Warning: DEPRECATED - */ -export interface MsgSubmitMisbehaviour { - /** client unique identifier */ - /** @deprecated */ +/** MsgRecoverClient defines the message used to recover a frozen or expired client. */ +export interface MsgRecoverClient { + /** the client identifier for the client to be updated if the proposal passes */ + subjectClientId: string; + /** + * the substitute client identifier for the client which will replace the subject + * client + */ + substituteClientId: string; + /** signer address */ + signer: string; +} +export interface MsgRecoverClientProtoMsg { + typeUrl: "/ibc.core.client.v1.MsgRecoverClient"; + value: Uint8Array; +} +/** MsgRecoverClient defines the message used to recover a frozen or expired client. */ +export interface MsgRecoverClientAmino { + /** the client identifier for the client to be updated if the proposal passes */ + subject_client_id?: string; + /** + * the substitute client identifier for the client which will replace the subject + * client + */ + substitute_client_id?: string; + /** signer address */ + signer?: string; +} +export interface MsgRecoverClientAminoMsg { + type: "cosmos-sdk/MsgRecoverClient"; + value: MsgRecoverClientAmino; +} +/** MsgRecoverClient defines the message used to recover a frozen or expired client. */ +export interface MsgRecoverClientSDKType { + subject_client_id: string; + substitute_client_id: string; + signer: string; +} +/** MsgRecoverClientResponse defines the Msg/RecoverClient response type. */ +export interface MsgRecoverClientResponse {} +export interface MsgRecoverClientResponseProtoMsg { + typeUrl: "/ibc.core.client.v1.MsgRecoverClientResponse"; + value: Uint8Array; +} +/** MsgRecoverClientResponse defines the Msg/RecoverClient response type. */ +export interface MsgRecoverClientResponseAmino {} +export interface MsgRecoverClientResponseAminoMsg { + type: "cosmos-sdk/MsgRecoverClientResponse"; + value: MsgRecoverClientResponseAmino; +} +/** MsgRecoverClientResponse defines the Msg/RecoverClient response type. */ +export interface MsgRecoverClientResponseSDKType {} +/** MsgIBCSoftwareUpgrade defines the message used to schedule an upgrade of an IBC client using a v1 governance proposal */ +export interface MsgIBCSoftwareUpgrade { + plan: Plan; + /** + * An UpgradedClientState must be provided to perform an IBC breaking upgrade. + * This will make the chain commit to the correct upgraded (self) client state + * before the upgrade occurs, so that connecting chains can verify that the + * new upgraded client is valid by verifying a proof on the previous version + * of the chain. This will allow IBC connections to persist smoothly across + * planned chain upgrades. Correspondingly, the UpgradedClientState field has been + * deprecated in the Cosmos SDK to allow for this logic to exist solely in + * the 02-client module. + */ + upgradedClientState?: Any; + /** signer address */ + signer: string; +} +export interface MsgIBCSoftwareUpgradeProtoMsg { + typeUrl: "/ibc.core.client.v1.MsgIBCSoftwareUpgrade"; + value: Uint8Array; +} +/** MsgIBCSoftwareUpgrade defines the message used to schedule an upgrade of an IBC client using a v1 governance proposal */ +export interface MsgIBCSoftwareUpgradeAmino { + plan?: PlanAmino; + /** + * An UpgradedClientState must be provided to perform an IBC breaking upgrade. + * This will make the chain commit to the correct upgraded (self) client state + * before the upgrade occurs, so that connecting chains can verify that the + * new upgraded client is valid by verifying a proof on the previous version + * of the chain. This will allow IBC connections to persist smoothly across + * planned chain upgrades. Correspondingly, the UpgradedClientState field has been + * deprecated in the Cosmos SDK to allow for this logic to exist solely in + * the 02-client module. + */ + upgraded_client_state?: AnyAmino; + /** signer address */ + signer?: string; +} +export interface MsgIBCSoftwareUpgradeAminoMsg { + type: "cosmos-sdk/MsgIBCSoftwareUpgrade"; + value: MsgIBCSoftwareUpgradeAmino; +} +/** MsgIBCSoftwareUpgrade defines the message used to schedule an upgrade of an IBC client using a v1 governance proposal */ +export interface MsgIBCSoftwareUpgradeSDKType { + plan: PlanSDKType; + upgraded_client_state?: AnySDKType; + signer: string; +} +/** MsgIBCSoftwareUpgradeResponse defines the Msg/IBCSoftwareUpgrade response type. */ +export interface MsgIBCSoftwareUpgradeResponse {} +export interface MsgIBCSoftwareUpgradeResponseProtoMsg { + typeUrl: "/ibc.core.client.v1.MsgIBCSoftwareUpgradeResponse"; + value: Uint8Array; +} +/** MsgIBCSoftwareUpgradeResponse defines the Msg/IBCSoftwareUpgrade response type. */ +export interface MsgIBCSoftwareUpgradeResponseAmino {} +export interface MsgIBCSoftwareUpgradeResponseAminoMsg { + type: "cosmos-sdk/MsgIBCSoftwareUpgradeResponse"; + value: MsgIBCSoftwareUpgradeResponseAmino; +} +/** MsgIBCSoftwareUpgradeResponse defines the Msg/IBCSoftwareUpgrade response type. */ +export interface MsgIBCSoftwareUpgradeResponseSDKType {} +/** MsgUpdateParams defines the sdk.Msg type to update the client parameters. */ +export interface MsgUpdateParams { + /** signer address */ + signer: string; + /** + * params defines the client parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params; +} +export interface MsgUpdateParamsProtoMsg { + typeUrl: "/ibc.core.client.v1.MsgUpdateParams"; + value: Uint8Array; +} +/** MsgUpdateParams defines the sdk.Msg type to update the client parameters. */ +export interface MsgUpdateParamsAmino { + /** signer address */ + signer?: string; + /** + * params defines the client parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params?: ParamsAmino; +} +export interface MsgUpdateParamsAminoMsg { + type: "cosmos-sdk/MsgUpdateParams"; + value: MsgUpdateParamsAmino; +} +/** MsgUpdateParams defines the sdk.Msg type to update the client parameters. */ +export interface MsgUpdateParamsSDKType { + signer: string; + params: ParamsSDKType; +} +/** MsgUpdateParamsResponse defines the MsgUpdateParams response type. */ +export interface MsgUpdateParamsResponse {} +export interface MsgUpdateParamsResponseProtoMsg { + typeUrl: "/ibc.core.client.v1.MsgUpdateParamsResponse"; + value: Uint8Array; +} +/** MsgUpdateParamsResponse defines the MsgUpdateParams response type. */ +export interface MsgUpdateParamsResponseAmino {} +export interface MsgUpdateParamsResponseAminoMsg { + type: "cosmos-sdk/MsgUpdateParamsResponse"; + value: MsgUpdateParamsResponseAmino; +} +/** MsgUpdateParamsResponse defines the MsgUpdateParams response type. */ +export interface MsgUpdateParamsResponseSDKType {} +/** MsgDeleteClientCreator defines a message to delete the client creator of a client */ +export interface MsgDeleteClientCreator { + /** client identifier */ clientId: string; - /** misbehaviour used for freezing the light client */ - /** @deprecated */ - misbehaviour?: Any; /** signer address */ - /** @deprecated */ signer: string; } -export interface MsgSubmitMisbehaviourProtoMsg { - typeUrl: "/ibc.core.client.v1.MsgSubmitMisbehaviour"; +export interface MsgDeleteClientCreatorProtoMsg { + typeUrl: "/ibc.core.client.v1.MsgDeleteClientCreator"; value: Uint8Array; } -/** - * MsgSubmitMisbehaviour defines an sdk.Msg type that submits Evidence for - * light client misbehaviour. - * Warning: DEPRECATED - */ -export interface MsgSubmitMisbehaviourAmino { - /** client unique identifier */ - /** @deprecated */ +/** MsgDeleteClientCreator defines a message to delete the client creator of a client */ +export interface MsgDeleteClientCreatorAmino { + /** client identifier */ client_id?: string; - /** misbehaviour used for freezing the light client */ - /** @deprecated */ - misbehaviour?: AnyAmino; /** signer address */ - /** @deprecated */ signer?: string; } -export interface MsgSubmitMisbehaviourAminoMsg { - type: "cosmos-sdk/MsgSubmitMisbehaviour"; - value: MsgSubmitMisbehaviourAmino; +export interface MsgDeleteClientCreatorAminoMsg { + type: "cosmos-sdk/MsgDeleteClientCreator"; + value: MsgDeleteClientCreatorAmino; } -/** - * MsgSubmitMisbehaviour defines an sdk.Msg type that submits Evidence for - * light client misbehaviour. - * Warning: DEPRECATED - */ -export interface MsgSubmitMisbehaviourSDKType { - /** @deprecated */ +/** MsgDeleteClientCreator defines a message to delete the client creator of a client */ +export interface MsgDeleteClientCreatorSDKType { client_id: string; - /** @deprecated */ - misbehaviour?: AnySDKType; - /** @deprecated */ signer: string; } -/** - * MsgSubmitMisbehaviourResponse defines the Msg/SubmitMisbehaviour response - * type. - */ -export interface MsgSubmitMisbehaviourResponse {} -export interface MsgSubmitMisbehaviourResponseProtoMsg { - typeUrl: "/ibc.core.client.v1.MsgSubmitMisbehaviourResponse"; +/** MsgDeleteClientCreatorResponse defines the Msg/DeleteClientCreator response type. */ +export interface MsgDeleteClientCreatorResponse {} +export interface MsgDeleteClientCreatorResponseProtoMsg { + typeUrl: "/ibc.core.client.v1.MsgDeleteClientCreatorResponse"; value: Uint8Array; } -/** - * MsgSubmitMisbehaviourResponse defines the Msg/SubmitMisbehaviour response - * type. - */ -export interface MsgSubmitMisbehaviourResponseAmino {} -export interface MsgSubmitMisbehaviourResponseAminoMsg { - type: "cosmos-sdk/MsgSubmitMisbehaviourResponse"; - value: MsgSubmitMisbehaviourResponseAmino; +/** MsgDeleteClientCreatorResponse defines the Msg/DeleteClientCreator response type. */ +export interface MsgDeleteClientCreatorResponseAmino {} +export interface MsgDeleteClientCreatorResponseAminoMsg { + type: "cosmos-sdk/MsgDeleteClientCreatorResponse"; + value: MsgDeleteClientCreatorResponseAmino; } -/** - * MsgSubmitMisbehaviourResponse defines the Msg/SubmitMisbehaviour response - * type. - */ -export interface MsgSubmitMisbehaviourResponseSDKType {} +/** MsgDeleteClientCreatorResponse defines the Msg/DeleteClientCreator response type. */ +export interface MsgDeleteClientCreatorResponseSDKType {} function createBaseMsgCreateClient(): MsgCreateClient { return { clientState: undefined, @@ -355,11 +491,16 @@ export const MsgCreateClient = { } }; function createBaseMsgCreateClientResponse(): MsgCreateClientResponse { - return {}; + return { + clientId: "" + }; } export const MsgCreateClientResponse = { typeUrl: "/ibc.core.client.v1.MsgCreateClientResponse", - encode(_: MsgCreateClientResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + encode(message: MsgCreateClientResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateClientResponse { @@ -369,6 +510,9 @@ export const MsgCreateClientResponse = { while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; default: reader.skipType(tag & 7); break; @@ -376,16 +520,21 @@ export const MsgCreateClientResponse = { } return message; }, - fromPartial(_: Partial): MsgCreateClientResponse { + fromPartial(object: Partial): MsgCreateClientResponse { const message = createBaseMsgCreateClientResponse(); + message.clientId = object.clientId ?? ""; return message; }, - fromAmino(_: MsgCreateClientResponseAmino): MsgCreateClientResponse { + fromAmino(object: MsgCreateClientResponseAmino): MsgCreateClientResponse { const message = createBaseMsgCreateClientResponse(); + if (object.client_id !== undefined && object.client_id !== null) { + message.clientId = object.client_id; + } return message; }, - toAmino(_: MsgCreateClientResponse): MsgCreateClientResponseAmino { + toAmino(message: MsgCreateClientResponse): MsgCreateClientResponseAmino { const obj: any = {}; + obj.client_id = message.clientId === "" ? undefined : message.clientId; return obj; }, fromAminoMsg(object: MsgCreateClientResponseAminoMsg): MsgCreateClientResponse { @@ -744,39 +893,188 @@ export const MsgUpgradeClientResponse = { }; } }; -function createBaseMsgSubmitMisbehaviour(): MsgSubmitMisbehaviour { +function createBaseMsgRecoverClient(): MsgRecoverClient { return { - clientId: "", - misbehaviour: undefined, + subjectClientId: "", + substituteClientId: "", 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); +export const MsgRecoverClient = { + typeUrl: "/ibc.core.client.v1.MsgRecoverClient", + encode(message: MsgRecoverClient, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.subjectClientId !== "") { + writer.uint32(10).string(message.subjectClientId); } - if (message.misbehaviour !== undefined) { - Any.encode(message.misbehaviour, writer.uint32(18).fork()).ldelim(); + if (message.substituteClientId !== "") { + writer.uint32(18).string(message.substituteClientId); } if (message.signer !== "") { writer.uint32(26).string(message.signer); } return writer; }, - decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitMisbehaviour { + decode(input: BinaryReader | Uint8Array, length?: number): MsgRecoverClient { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMsgSubmitMisbehaviour(); + const message = createBaseMsgRecoverClient(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.clientId = reader.string(); + message.subjectClientId = reader.string(); + break; + case 2: + message.substituteClientId = reader.string(); + break; + case 3: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgRecoverClient { + const message = createBaseMsgRecoverClient(); + message.subjectClientId = object.subjectClientId ?? ""; + message.substituteClientId = object.substituteClientId ?? ""; + message.signer = object.signer ?? ""; + return message; + }, + fromAmino(object: MsgRecoverClientAmino): MsgRecoverClient { + const message = createBaseMsgRecoverClient(); + if (object.subject_client_id !== undefined && object.subject_client_id !== null) { + message.subjectClientId = object.subject_client_id; + } + if (object.substitute_client_id !== undefined && object.substitute_client_id !== null) { + message.substituteClientId = object.substitute_client_id; + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgRecoverClient): MsgRecoverClientAmino { + const obj: any = {}; + obj.subject_client_id = message.subjectClientId === "" ? undefined : message.subjectClientId; + obj.substitute_client_id = message.substituteClientId === "" ? undefined : message.substituteClientId; + obj.signer = message.signer === "" ? undefined : message.signer; + return obj; + }, + fromAminoMsg(object: MsgRecoverClientAminoMsg): MsgRecoverClient { + return MsgRecoverClient.fromAmino(object.value); + }, + toAminoMsg(message: MsgRecoverClient): MsgRecoverClientAminoMsg { + return { + type: "cosmos-sdk/MsgRecoverClient", + value: MsgRecoverClient.toAmino(message) + }; + }, + fromProtoMsg(message: MsgRecoverClientProtoMsg): MsgRecoverClient { + return MsgRecoverClient.decode(message.value); + }, + toProto(message: MsgRecoverClient): Uint8Array { + return MsgRecoverClient.encode(message).finish(); + }, + toProtoMsg(message: MsgRecoverClient): MsgRecoverClientProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.MsgRecoverClient", + value: MsgRecoverClient.encode(message).finish() + }; + } +}; +function createBaseMsgRecoverClientResponse(): MsgRecoverClientResponse { + return {}; +} +export const MsgRecoverClientResponse = { + typeUrl: "/ibc.core.client.v1.MsgRecoverClientResponse", + encode(_: MsgRecoverClientResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgRecoverClientResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRecoverClientResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): MsgRecoverClientResponse { + const message = createBaseMsgRecoverClientResponse(); + return message; + }, + fromAmino(_: MsgRecoverClientResponseAmino): MsgRecoverClientResponse { + const message = createBaseMsgRecoverClientResponse(); + return message; + }, + toAmino(_: MsgRecoverClientResponse): MsgRecoverClientResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgRecoverClientResponseAminoMsg): MsgRecoverClientResponse { + return MsgRecoverClientResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgRecoverClientResponse): MsgRecoverClientResponseAminoMsg { + return { + type: "cosmos-sdk/MsgRecoverClientResponse", + value: MsgRecoverClientResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgRecoverClientResponseProtoMsg): MsgRecoverClientResponse { + return MsgRecoverClientResponse.decode(message.value); + }, + toProto(message: MsgRecoverClientResponse): Uint8Array { + return MsgRecoverClientResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgRecoverClientResponse): MsgRecoverClientResponseProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.MsgRecoverClientResponse", + value: MsgRecoverClientResponse.encode(message).finish() + }; + } +}; +function createBaseMsgIBCSoftwareUpgrade(): MsgIBCSoftwareUpgrade { + return { + plan: Plan.fromPartial({}), + upgradedClientState: undefined, + signer: "" + }; +} +export const MsgIBCSoftwareUpgrade = { + typeUrl: "/ibc.core.client.v1.MsgIBCSoftwareUpgrade", + encode(message: MsgIBCSoftwareUpgrade, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.plan !== undefined) { + Plan.encode(message.plan, writer.uint32(10).fork()).ldelim(); + } + if (message.upgradedClientState !== undefined) { + Any.encode(message.upgradedClientState, writer.uint32(18).fork()).ldelim(); + } + if (message.signer !== "") { + writer.uint32(26).string(message.signer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgIBCSoftwareUpgrade { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgIBCSoftwareUpgrade(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.plan = Plan.decode(reader, reader.uint32()); break; case 2: - message.misbehaviour = Any.decode(reader, reader.uint32()); + message.upgradedClientState = Any.decode(reader, reader.uint32()); break; case 3: message.signer = reader.string(); @@ -788,67 +1086,341 @@ export const MsgSubmitMisbehaviour = { } return message; }, - fromPartial(object: Partial): MsgSubmitMisbehaviour { - const message = createBaseMsgSubmitMisbehaviour(); + fromPartial(object: Partial): MsgIBCSoftwareUpgrade { + const message = createBaseMsgIBCSoftwareUpgrade(); + message.plan = object.plan !== undefined && object.plan !== null ? Plan.fromPartial(object.plan) : undefined; + message.upgradedClientState = object.upgradedClientState !== undefined && object.upgradedClientState !== null ? Any.fromPartial(object.upgradedClientState) : undefined; + message.signer = object.signer ?? ""; + return message; + }, + fromAmino(object: MsgIBCSoftwareUpgradeAmino): MsgIBCSoftwareUpgrade { + const message = createBaseMsgIBCSoftwareUpgrade(); + if (object.plan !== undefined && object.plan !== null) { + message.plan = Plan.fromAmino(object.plan); + } + if (object.upgraded_client_state !== undefined && object.upgraded_client_state !== null) { + message.upgradedClientState = Any.fromAmino(object.upgraded_client_state); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgIBCSoftwareUpgrade): MsgIBCSoftwareUpgradeAmino { + const obj: any = {}; + obj.plan = message.plan ? Plan.toAmino(message.plan) : undefined; + obj.upgraded_client_state = message.upgradedClientState ? Any.toAmino(message.upgradedClientState) : undefined; + obj.signer = message.signer === "" ? undefined : message.signer; + return obj; + }, + fromAminoMsg(object: MsgIBCSoftwareUpgradeAminoMsg): MsgIBCSoftwareUpgrade { + return MsgIBCSoftwareUpgrade.fromAmino(object.value); + }, + toAminoMsg(message: MsgIBCSoftwareUpgrade): MsgIBCSoftwareUpgradeAminoMsg { + return { + type: "cosmos-sdk/MsgIBCSoftwareUpgrade", + value: MsgIBCSoftwareUpgrade.toAmino(message) + }; + }, + fromProtoMsg(message: MsgIBCSoftwareUpgradeProtoMsg): MsgIBCSoftwareUpgrade { + return MsgIBCSoftwareUpgrade.decode(message.value); + }, + toProto(message: MsgIBCSoftwareUpgrade): Uint8Array { + return MsgIBCSoftwareUpgrade.encode(message).finish(); + }, + toProtoMsg(message: MsgIBCSoftwareUpgrade): MsgIBCSoftwareUpgradeProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.MsgIBCSoftwareUpgrade", + value: MsgIBCSoftwareUpgrade.encode(message).finish() + }; + } +}; +function createBaseMsgIBCSoftwareUpgradeResponse(): MsgIBCSoftwareUpgradeResponse { + return {}; +} +export const MsgIBCSoftwareUpgradeResponse = { + typeUrl: "/ibc.core.client.v1.MsgIBCSoftwareUpgradeResponse", + encode(_: MsgIBCSoftwareUpgradeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgIBCSoftwareUpgradeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgIBCSoftwareUpgradeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): MsgIBCSoftwareUpgradeResponse { + const message = createBaseMsgIBCSoftwareUpgradeResponse(); + return message; + }, + fromAmino(_: MsgIBCSoftwareUpgradeResponseAmino): MsgIBCSoftwareUpgradeResponse { + const message = createBaseMsgIBCSoftwareUpgradeResponse(); + return message; + }, + toAmino(_: MsgIBCSoftwareUpgradeResponse): MsgIBCSoftwareUpgradeResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgIBCSoftwareUpgradeResponseAminoMsg): MsgIBCSoftwareUpgradeResponse { + return MsgIBCSoftwareUpgradeResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgIBCSoftwareUpgradeResponse): MsgIBCSoftwareUpgradeResponseAminoMsg { + return { + type: "cosmos-sdk/MsgIBCSoftwareUpgradeResponse", + value: MsgIBCSoftwareUpgradeResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgIBCSoftwareUpgradeResponseProtoMsg): MsgIBCSoftwareUpgradeResponse { + return MsgIBCSoftwareUpgradeResponse.decode(message.value); + }, + toProto(message: MsgIBCSoftwareUpgradeResponse): Uint8Array { + return MsgIBCSoftwareUpgradeResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgIBCSoftwareUpgradeResponse): MsgIBCSoftwareUpgradeResponseProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.MsgIBCSoftwareUpgradeResponse", + value: MsgIBCSoftwareUpgradeResponse.encode(message).finish() + }; + } +}; +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { + signer: "", + params: Params.fromPartial({}) + }; +} +export const MsgUpdateParams = { + typeUrl: "/ibc.core.client.v1.MsgUpdateParams", + encode(message: MsgUpdateParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.signer !== "") { + writer.uint32(10).string(message.signer); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.signer = reader.string(); + break; + case 2: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + message.signer = object.signer ?? ""; + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, + fromAmino(object: MsgUpdateParamsAmino): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: MsgUpdateParams): MsgUpdateParamsAmino { + const obj: any = {}; + obj.signer = message.signer === "" ? undefined : message.signer; + obj.params = message.params ? Params.toAmino(message.params) : undefined; + return obj; + }, + fromAminoMsg(object: MsgUpdateParamsAminoMsg): MsgUpdateParams { + return MsgUpdateParams.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateParams): MsgUpdateParamsAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateParams", + value: MsgUpdateParams.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateParamsProtoMsg): MsgUpdateParams { + return MsgUpdateParams.decode(message.value); + }, + toProto(message: MsgUpdateParams): Uint8Array { + return MsgUpdateParams.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateParams): MsgUpdateParamsProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.MsgUpdateParams", + value: MsgUpdateParams.encode(message).finish() + }; + } +}; +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} +export const MsgUpdateParamsResponse = { + typeUrl: "/ibc.core.client.v1.MsgUpdateParamsResponse", + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: Partial): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, + fromAmino(_: MsgUpdateParamsResponseAmino): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, + toAmino(_: MsgUpdateParamsResponse): MsgUpdateParamsResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUpdateParamsResponseAminoMsg): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateParamsResponse): MsgUpdateParamsResponseAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateParamsResponse", + value: MsgUpdateParamsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateParamsResponseProtoMsg): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.decode(message.value); + }, + toProto(message: MsgUpdateParamsResponse): Uint8Array { + return MsgUpdateParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateParamsResponse): MsgUpdateParamsResponseProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.MsgUpdateParamsResponse", + value: MsgUpdateParamsResponse.encode(message).finish() + }; + } +}; +function createBaseMsgDeleteClientCreator(): MsgDeleteClientCreator { + return { + clientId: "", + signer: "" + }; +} +export const MsgDeleteClientCreator = { + typeUrl: "/ibc.core.client.v1.MsgDeleteClientCreator", + encode(message: MsgDeleteClientCreator, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.signer !== "") { + writer.uint32(18).string(message.signer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeleteClientCreator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeleteClientCreator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MsgDeleteClientCreator { + const message = createBaseMsgDeleteClientCreator(); message.clientId = object.clientId ?? ""; - message.misbehaviour = object.misbehaviour !== undefined && object.misbehaviour !== null ? Any.fromPartial(object.misbehaviour) : undefined; message.signer = object.signer ?? ""; return message; }, - fromAmino(object: MsgSubmitMisbehaviourAmino): MsgSubmitMisbehaviour { - const message = createBaseMsgSubmitMisbehaviour(); + fromAmino(object: MsgDeleteClientCreatorAmino): MsgDeleteClientCreator { + const message = createBaseMsgDeleteClientCreator(); if (object.client_id !== undefined && object.client_id !== null) { message.clientId = object.client_id; } - if (object.misbehaviour !== undefined && object.misbehaviour !== null) { - message.misbehaviour = Any.fromAmino(object.misbehaviour); - } if (object.signer !== undefined && object.signer !== null) { message.signer = object.signer; } return message; }, - toAmino(message: MsgSubmitMisbehaviour): MsgSubmitMisbehaviourAmino { + toAmino(message: MsgDeleteClientCreator): MsgDeleteClientCreatorAmino { const obj: any = {}; obj.client_id = message.clientId === "" ? undefined : message.clientId; - obj.misbehaviour = message.misbehaviour ? Any.toAmino(message.misbehaviour) : undefined; obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, - fromAminoMsg(object: MsgSubmitMisbehaviourAminoMsg): MsgSubmitMisbehaviour { - return MsgSubmitMisbehaviour.fromAmino(object.value); + fromAminoMsg(object: MsgDeleteClientCreatorAminoMsg): MsgDeleteClientCreator { + return MsgDeleteClientCreator.fromAmino(object.value); }, - toAminoMsg(message: MsgSubmitMisbehaviour): MsgSubmitMisbehaviourAminoMsg { + toAminoMsg(message: MsgDeleteClientCreator): MsgDeleteClientCreatorAminoMsg { return { - type: "cosmos-sdk/MsgSubmitMisbehaviour", - value: MsgSubmitMisbehaviour.toAmino(message) + type: "cosmos-sdk/MsgDeleteClientCreator", + value: MsgDeleteClientCreator.toAmino(message) }; }, - fromProtoMsg(message: MsgSubmitMisbehaviourProtoMsg): MsgSubmitMisbehaviour { - return MsgSubmitMisbehaviour.decode(message.value); + fromProtoMsg(message: MsgDeleteClientCreatorProtoMsg): MsgDeleteClientCreator { + return MsgDeleteClientCreator.decode(message.value); }, - toProto(message: MsgSubmitMisbehaviour): Uint8Array { - return MsgSubmitMisbehaviour.encode(message).finish(); + toProto(message: MsgDeleteClientCreator): Uint8Array { + return MsgDeleteClientCreator.encode(message).finish(); }, - toProtoMsg(message: MsgSubmitMisbehaviour): MsgSubmitMisbehaviourProtoMsg { + toProtoMsg(message: MsgDeleteClientCreator): MsgDeleteClientCreatorProtoMsg { return { - typeUrl: "/ibc.core.client.v1.MsgSubmitMisbehaviour", - value: MsgSubmitMisbehaviour.encode(message).finish() + typeUrl: "/ibc.core.client.v1.MsgDeleteClientCreator", + value: MsgDeleteClientCreator.encode(message).finish() }; } }; -function createBaseMsgSubmitMisbehaviourResponse(): MsgSubmitMisbehaviourResponse { +function createBaseMsgDeleteClientCreatorResponse(): MsgDeleteClientCreatorResponse { return {}; } -export const MsgSubmitMisbehaviourResponse = { - typeUrl: "/ibc.core.client.v1.MsgSubmitMisbehaviourResponse", - encode(_: MsgSubmitMisbehaviourResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { +export const MsgDeleteClientCreatorResponse = { + typeUrl: "/ibc.core.client.v1.MsgDeleteClientCreatorResponse", + encode(_: MsgDeleteClientCreatorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, - decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitMisbehaviourResponse { + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeleteClientCreatorResponse { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMsgSubmitMisbehaviourResponse(); + const message = createBaseMsgDeleteClientCreatorResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -859,37 +1431,37 @@ export const MsgSubmitMisbehaviourResponse = { } return message; }, - fromPartial(_: Partial): MsgSubmitMisbehaviourResponse { - const message = createBaseMsgSubmitMisbehaviourResponse(); + fromPartial(_: Partial): MsgDeleteClientCreatorResponse { + const message = createBaseMsgDeleteClientCreatorResponse(); return message; }, - fromAmino(_: MsgSubmitMisbehaviourResponseAmino): MsgSubmitMisbehaviourResponse { - const message = createBaseMsgSubmitMisbehaviourResponse(); + fromAmino(_: MsgDeleteClientCreatorResponseAmino): MsgDeleteClientCreatorResponse { + const message = createBaseMsgDeleteClientCreatorResponse(); return message; }, - toAmino(_: MsgSubmitMisbehaviourResponse): MsgSubmitMisbehaviourResponseAmino { + toAmino(_: MsgDeleteClientCreatorResponse): MsgDeleteClientCreatorResponseAmino { const obj: any = {}; return obj; }, - fromAminoMsg(object: MsgSubmitMisbehaviourResponseAminoMsg): MsgSubmitMisbehaviourResponse { - return MsgSubmitMisbehaviourResponse.fromAmino(object.value); + fromAminoMsg(object: MsgDeleteClientCreatorResponseAminoMsg): MsgDeleteClientCreatorResponse { + return MsgDeleteClientCreatorResponse.fromAmino(object.value); }, - toAminoMsg(message: MsgSubmitMisbehaviourResponse): MsgSubmitMisbehaviourResponseAminoMsg { + toAminoMsg(message: MsgDeleteClientCreatorResponse): MsgDeleteClientCreatorResponseAminoMsg { return { - type: "cosmos-sdk/MsgSubmitMisbehaviourResponse", - value: MsgSubmitMisbehaviourResponse.toAmino(message) + type: "cosmos-sdk/MsgDeleteClientCreatorResponse", + value: MsgDeleteClientCreatorResponse.toAmino(message) }; }, - fromProtoMsg(message: MsgSubmitMisbehaviourResponseProtoMsg): MsgSubmitMisbehaviourResponse { - return MsgSubmitMisbehaviourResponse.decode(message.value); + fromProtoMsg(message: MsgDeleteClientCreatorResponseProtoMsg): MsgDeleteClientCreatorResponse { + return MsgDeleteClientCreatorResponse.decode(message.value); }, - toProto(message: MsgSubmitMisbehaviourResponse): Uint8Array { - return MsgSubmitMisbehaviourResponse.encode(message).finish(); + toProto(message: MsgDeleteClientCreatorResponse): Uint8Array { + return MsgDeleteClientCreatorResponse.encode(message).finish(); }, - toProtoMsg(message: MsgSubmitMisbehaviourResponse): MsgSubmitMisbehaviourResponseProtoMsg { + toProtoMsg(message: MsgDeleteClientCreatorResponse): MsgDeleteClientCreatorResponseProtoMsg { return { - typeUrl: "/ibc.core.client.v1.MsgSubmitMisbehaviourResponse", - value: MsgSubmitMisbehaviourResponse.encode(message).finish() + typeUrl: "/ibc.core.client.v1.MsgDeleteClientCreatorResponse", + value: MsgDeleteClientCreatorResponse.encode(message).finish() }; } }; \ No newline at end of file diff --git a/packages/api/src/ibc/core/commitment/v2/commitment.ts b/packages/api/src/ibc/core/commitment/v2/commitment.ts new file mode 100644 index 00000000..7a011d56 --- /dev/null +++ b/packages/api/src/ibc/core/commitment/v2/commitment.ts @@ -0,0 +1,190 @@ +//@ts-nocheck +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { bytesFromBase64, base64FromBytes } from "../../../../helpers"; +/** + * MerklePath is the path used to verify commitment proofs, which can be an + * arbitrary structured object (defined by a commitment type). + * ICS-23 verification supports membership proofs for nested merkle trees. + * The ICS-24 standard provable keys MUST be stored in the lowest level tree with an optional prefix. + * The IC24 provable tree may then be stored in a higher level tree(s) that hash up to the root hash + * stored in the consensus state of the client. + * Each element of the path represents the key of a merkle tree from the root to the leaf. + * The elements of the path before the final element must be the path to the tree that contains + * the ICS24 provable store. Thus, it should remain constant for all ICS24 proofs. + * The final element of the path is the key of the leaf in the ICS24 provable store, + * Thus IBC core will append the ICS24 path to the final element of the MerklePath + * stored in the counterparty to create the full path to the leaf for proof verification. + * Examples: + * Cosmos SDK: + * The Cosmos SDK commits to a multi-tree where each store is an IAVL tree and all store hashes + * are hashed in a simple merkle tree to get the final root hash. Thus, the MerklePath in the counterparty + * MerklePrefix has the following structure: ["ibc", ""] + * The core IBC handler will append the ICS24 path to the final element of the MerklePath + * like so: ["ibc", "{packetCommitmentPath}"] which will then be used for final verification. + * Ethereum: + * The Ethereum client commits to a single Patricia merkle trie. The ICS24 provable store is managed + * by the smart contract state. Each smart contract has a specific prefix reserved within the global trie. + * Thus the MerklePath in the counterparty is the prefix to the smart contract state in the global trie. + * Since there is only one tree in the commitment structure of ethereum the MerklePath in the counterparty + * MerklePrefix has the following structure: ["IBCCoreContractAddressStoragePrefix"] + * The core IBC handler will append the ICS24 path to the final element of the MerklePath + * like so: ["IBCCoreContractAddressStoragePrefix{packetCommitmentPath}"] which will then be used for final + * verification. Thus the MerklePath in the counterparty MerklePrefix is the nested key path from the root hash of the + * consensus state down to the ICS24 provable store. The IBC handler retrieves the counterparty key path to the ICS24 + * provable store from the MerklePath and appends the ICS24 path to get the final key path to the value being verified + * by the client against the root hash in the client's consensus state. + */ +export interface MerklePath { + keyPath: Uint8Array[]; +} +export interface MerklePathProtoMsg { + typeUrl: "/ibc.core.commitment.v2.MerklePath"; + value: Uint8Array; +} +/** + * MerklePath is the path used to verify commitment proofs, which can be an + * arbitrary structured object (defined by a commitment type). + * ICS-23 verification supports membership proofs for nested merkle trees. + * The ICS-24 standard provable keys MUST be stored in the lowest level tree with an optional prefix. + * The IC24 provable tree may then be stored in a higher level tree(s) that hash up to the root hash + * stored in the consensus state of the client. + * Each element of the path represents the key of a merkle tree from the root to the leaf. + * The elements of the path before the final element must be the path to the tree that contains + * the ICS24 provable store. Thus, it should remain constant for all ICS24 proofs. + * The final element of the path is the key of the leaf in the ICS24 provable store, + * Thus IBC core will append the ICS24 path to the final element of the MerklePath + * stored in the counterparty to create the full path to the leaf for proof verification. + * Examples: + * Cosmos SDK: + * The Cosmos SDK commits to a multi-tree where each store is an IAVL tree and all store hashes + * are hashed in a simple merkle tree to get the final root hash. Thus, the MerklePath in the counterparty + * MerklePrefix has the following structure: ["ibc", ""] + * The core IBC handler will append the ICS24 path to the final element of the MerklePath + * like so: ["ibc", "{packetCommitmentPath}"] which will then be used for final verification. + * Ethereum: + * The Ethereum client commits to a single Patricia merkle trie. The ICS24 provable store is managed + * by the smart contract state. Each smart contract has a specific prefix reserved within the global trie. + * Thus the MerklePath in the counterparty is the prefix to the smart contract state in the global trie. + * Since there is only one tree in the commitment structure of ethereum the MerklePath in the counterparty + * MerklePrefix has the following structure: ["IBCCoreContractAddressStoragePrefix"] + * The core IBC handler will append the ICS24 path to the final element of the MerklePath + * like so: ["IBCCoreContractAddressStoragePrefix{packetCommitmentPath}"] which will then be used for final + * verification. Thus the MerklePath in the counterparty MerklePrefix is the nested key path from the root hash of the + * consensus state down to the ICS24 provable store. The IBC handler retrieves the counterparty key path to the ICS24 + * provable store from the MerklePath and appends the ICS24 path to get the final key path to the value being verified + * by the client against the root hash in the client's consensus state. + */ +export interface MerklePathAmino { + key_path?: string[]; +} +export interface MerklePathAminoMsg { + type: "cosmos-sdk/MerklePath"; + value: MerklePathAmino; +} +/** + * MerklePath is the path used to verify commitment proofs, which can be an + * arbitrary structured object (defined by a commitment type). + * ICS-23 verification supports membership proofs for nested merkle trees. + * The ICS-24 standard provable keys MUST be stored in the lowest level tree with an optional prefix. + * The IC24 provable tree may then be stored in a higher level tree(s) that hash up to the root hash + * stored in the consensus state of the client. + * Each element of the path represents the key of a merkle tree from the root to the leaf. + * The elements of the path before the final element must be the path to the tree that contains + * the ICS24 provable store. Thus, it should remain constant for all ICS24 proofs. + * The final element of the path is the key of the leaf in the ICS24 provable store, + * Thus IBC core will append the ICS24 path to the final element of the MerklePath + * stored in the counterparty to create the full path to the leaf for proof verification. + * Examples: + * Cosmos SDK: + * The Cosmos SDK commits to a multi-tree where each store is an IAVL tree and all store hashes + * are hashed in a simple merkle tree to get the final root hash. Thus, the MerklePath in the counterparty + * MerklePrefix has the following structure: ["ibc", ""] + * The core IBC handler will append the ICS24 path to the final element of the MerklePath + * like so: ["ibc", "{packetCommitmentPath}"] which will then be used for final verification. + * Ethereum: + * The Ethereum client commits to a single Patricia merkle trie. The ICS24 provable store is managed + * by the smart contract state. Each smart contract has a specific prefix reserved within the global trie. + * Thus the MerklePath in the counterparty is the prefix to the smart contract state in the global trie. + * Since there is only one tree in the commitment structure of ethereum the MerklePath in the counterparty + * MerklePrefix has the following structure: ["IBCCoreContractAddressStoragePrefix"] + * The core IBC handler will append the ICS24 path to the final element of the MerklePath + * like so: ["IBCCoreContractAddressStoragePrefix{packetCommitmentPath}"] which will then be used for final + * verification. Thus the MerklePath in the counterparty MerklePrefix is the nested key path from the root hash of the + * consensus state down to the ICS24 provable store. The IBC handler retrieves the counterparty key path to the ICS24 + * provable store from the MerklePath and appends the ICS24 path to get the final key path to the value being verified + * by the client against the root hash in the client's consensus state. + */ +export interface MerklePathSDKType { + key_path: Uint8Array[]; +} +function createBaseMerklePath(): MerklePath { + return { + keyPath: [] + }; +} +export const MerklePath = { + typeUrl: "/ibc.core.commitment.v2.MerklePath", + encode(message: MerklePath, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.keyPath) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MerklePath { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMerklePath(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.keyPath.push(reader.bytes()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MerklePath { + const message = createBaseMerklePath(); + message.keyPath = object.keyPath?.map(e => e) || []; + return message; + }, + fromAmino(object: MerklePathAmino): MerklePath { + const message = createBaseMerklePath(); + message.keyPath = object.key_path?.map(e => bytesFromBase64(e)) || []; + return message; + }, + toAmino(message: MerklePath): MerklePathAmino { + const obj: any = {}; + if (message.keyPath) { + obj.key_path = message.keyPath.map(e => base64FromBytes(e)); + } else { + obj.key_path = message.keyPath; + } + return obj; + }, + fromAminoMsg(object: MerklePathAminoMsg): MerklePath { + return MerklePath.fromAmino(object.value); + }, + toAminoMsg(message: MerklePath): MerklePathAminoMsg { + return { + type: "cosmos-sdk/MerklePath", + value: MerklePath.toAmino(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.v2.MerklePath", + value: MerklePath.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/packages/api/src/ibc/lcd.ts b/packages/api/src/ibc/lcd.ts index 1696e63a..3577dce1 100644 --- a/packages/api/src/ibc/lcd.ts +++ b/packages/api/src/ibc/lcd.ts @@ -32,11 +32,26 @@ export const createLCDClient = async ({ }) } }, + circuit: { + v1: new (await import("../cosmos/circuit/v1/query.lcd")).LCDQueryClient({ + requestClient + }) + }, + consensus: { + v1: new (await import("../cosmos/consensus/v1/query.lcd")).LCDQueryClient({ + requestClient + }) + }, distribution: { v1beta1: new (await import("../cosmos/distribution/v1beta1/query.lcd")).LCDQueryClient({ requestClient }) }, + epochs: { + v1beta1: new (await import("../cosmos/epochs/v1beta1/query.lcd")).LCDQueryClient({ + requestClient + }) + }, feegrant: { v1beta1: new (await import("../cosmos/feegrant/v1beta1/query.lcd")).LCDQueryClient({ requestClient @@ -65,6 +80,11 @@ export const createLCDClient = async ({ requestClient }) }, + protocolpool: { + v1: new (await import("../cosmos/protocolpool/v1/query.lcd")).LCDQueryClient({ + requestClient + }) + }, staking: { v1beta1: new (await import("../cosmos/staking/v1beta1/query.lcd")).LCDQueryClient({ requestClient diff --git a/packages/api/src/ibc/rpc.query.ts b/packages/api/src/ibc/rpc.query.ts index daad1f9a..4d711163 100644 --- a/packages/api/src/ibc/rpc.query.ts +++ b/packages/api/src/ibc/rpc.query.ts @@ -24,9 +24,21 @@ export const createRPCQueryClient = async ({ v1beta1: (await import("../cosmos/base/node/v1beta1/query.rpc.Service")).createRpcQueryExtension(client) } }, + circuit: { + v1: (await import("../cosmos/circuit/v1/query.rpc.Query")).createRpcQueryExtension(client) + }, + consensus: { + v1: (await import("../cosmos/consensus/v1/query.rpc.Query")).createRpcQueryExtension(client) + }, + counter: { + v1: (await import("../cosmos/counter/v1/query.rpc.Query")).createRpcQueryExtension(client) + }, distribution: { v1beta1: (await import("../cosmos/distribution/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, + epochs: { + v1beta1: (await import("../cosmos/epochs/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + }, feegrant: { v1beta1: (await import("../cosmos/feegrant/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, @@ -43,6 +55,9 @@ export const createRPCQueryClient = async ({ params: { v1beta1: (await import("../cosmos/params/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, + protocolpool: { + v1: (await import("../cosmos/protocolpool/v1/query.rpc.Query")).createRpcQueryExtension(client) + }, staking: { v1beta1: (await import("../cosmos/staking/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, diff --git a/packages/api/src/ibc/rpc.tx.ts b/packages/api/src/ibc/rpc.tx.ts index 612e383b..8bc909e0 100644 --- a/packages/api/src/ibc/rpc.tx.ts +++ b/packages/api/src/ibc/rpc.tx.ts @@ -6,12 +6,27 @@ export const createRPCMsgClient = async ({ rpc: Rpc; }) => ({ cosmos: { + auth: { + v1beta1: new (await import("../cosmos/auth/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + }, authz: { v1beta1: new (await import("../cosmos/authz/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, bank: { v1beta1: new (await import("../cosmos/bank/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, + benchmark: { + v1: new (await import("../cosmos/benchmark/v1/tx.rpc.msg")).MsgClientImpl(rpc) + }, + circuit: { + v1: new (await import("../cosmos/circuit/v1/tx.rpc.msg")).MsgClientImpl(rpc) + }, + consensus: { + v1: new (await import("../cosmos/consensus/v1/tx.rpc.msg")).MsgClientImpl(rpc) + }, + counter: { + v1: new (await import("../cosmos/counter/v1/tx.rpc.msg")).MsgClientImpl(rpc) + }, distribution: { v1beta1: new (await import("../cosmos/distribution/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, @@ -25,6 +40,12 @@ export const createRPCMsgClient = async ({ group: { v1: new (await import("../cosmos/group/v1/tx.rpc.msg")).MsgClientImpl(rpc) }, + mint: { + v1beta1: new (await import("../cosmos/mint/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + }, + protocolpool: { + v1: new (await import("../cosmos/protocolpool/v1/tx.rpc.msg")).MsgClientImpl(rpc) + }, staking: { v1beta1: new (await import("../cosmos/staking/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, diff --git a/packages/api/src/regen/app/v1alpha1/module.ts b/packages/api/src/regen/app/v1alpha1/module.ts new file mode 100644 index 00000000..4ca65b6d --- /dev/null +++ b/packages/api/src/regen/app/v1alpha1/module.ts @@ -0,0 +1,437 @@ +//@ts-nocheck +import { BinaryReader, BinaryWriter } from "../../../binary"; +/** ModuleDescriptor describes an app module. */ +export interface ModuleDescriptor { + /** + * go_import names the package that should be imported by an app to load the + * module in the runtime module registry. Either go_import must be defined here + * or the go_package option must be defined at the file level to indicate + * to users where to location the module implementation. go_import takes + * precedence over go_package when both are defined. + */ + goImport: string; + /** + * use_package refers to a protobuf package that this module + * uses and exposes to the world. In an app, only one module should "use" + * or own a single protobuf package. It is assumed that the module uses + * all of the .proto files in a single package. + */ + usePackage: PackageReference[]; + /** + * can_migrate_from defines which module versions this module can migrate + * state from. The framework will check that one module version is able to + * migrate from a previous module version before attempting to update its + * config. It is assumed that modules can transitively migrate from earlier + * versions. For instance if v3 declares it can migrate from v2, and v2 + * declares it can migrate from v1, the framework knows how to migrate + * from v1 to v3, assuming all 3 module versions are registered at runtime. + */ + canMigrateFrom: MigrateFromInfo[]; +} +export interface ModuleDescriptorProtoMsg { + typeUrl: "/regen.app.v1alpha1.ModuleDescriptor"; + value: Uint8Array; +} +/** ModuleDescriptor describes an app module. */ +export interface ModuleDescriptorAmino { + /** + * go_import names the package that should be imported by an app to load the + * module in the runtime module registry. Either go_import must be defined here + * or the go_package option must be defined at the file level to indicate + * to users where to location the module implementation. go_import takes + * precedence over go_package when both are defined. + */ + go_import?: string; + /** + * use_package refers to a protobuf package that this module + * uses and exposes to the world. In an app, only one module should "use" + * or own a single protobuf package. It is assumed that the module uses + * all of the .proto files in a single package. + */ + use_package?: PackageReferenceAmino[]; + /** + * can_migrate_from defines which module versions this module can migrate + * state from. The framework will check that one module version is able to + * migrate from a previous module version before attempting to update its + * config. It is assumed that modules can transitively migrate from earlier + * versions. For instance if v3 declares it can migrate from v2, and v2 + * declares it can migrate from v1, the framework knows how to migrate + * from v1 to v3, assuming all 3 module versions are registered at runtime. + */ + can_migrate_from?: MigrateFromInfoAmino[]; +} +export interface ModuleDescriptorAminoMsg { + type: "/regen.app.v1alpha1.ModuleDescriptor"; + value: ModuleDescriptorAmino; +} +/** ModuleDescriptor describes an app module. */ +export interface ModuleDescriptorSDKType { + go_import: string; + use_package: PackageReferenceSDKType[]; + can_migrate_from: MigrateFromInfoSDKType[]; +} +/** PackageReference is a reference to a protobuf package used by a module. */ +export interface PackageReference { + /** name is the fully-qualified name of the package. */ + name: string; + /** + * revision is the optional revision of the package that is being used. + * Protobuf packages used in Cosmos should generally have a major version + * as the last part of the package name, ex. foo.bar.baz.v1. + * The revision of a package can be thought of as the minor version of a + * package which has additional backwards compatible definitions that weren't + * present in a previous version. + * + * A package should indicate its revision with a source code comment + * above the package declaration in one of its files containing the + * text "Revision N" where N is an integer revision. All packages start + * at revision 0 the first time they are released in a module. + * + * When a new version of a module is released and items are added to existing + * .proto files, these definitions should contain comments of the form + * "Since Revision N" where N is an integer revision. + * + * When the module runtime starts up, it will check the pinned proto + * image and panic if there are runtime protobuf definitions that are not + * in the pinned descriptor which do not have + * a "Since Revision N" comment or have a "Since Revision N" comment where + * N is <= to the revision specified here. This indicates that the protobuf + * files have been updated, but the pinned file descriptor hasn't. + * + * If there are items in the pinned file descriptor with a revision + * greater than the value indicated here, this will also cause a panic + * as it may mean that the pinned descriptor for a legacy module has been + * improperly updated or that there is some other versioning discrepancy. + * Runtime protobuf definitions will also be checked for compatibility + * with pinned file descriptors to make sure there are no incompatible changes. + * + * This behavior ensures that: + * * pinned proto images are up-to-date + * * protobuf files are carefully annotated with revision comments which + * are important good client UX + * * protobuf files are changed in backwards and forwards compatible ways + */ + revision: number; +} +export interface PackageReferenceProtoMsg { + typeUrl: "/regen.app.v1alpha1.PackageReference"; + value: Uint8Array; +} +/** PackageReference is a reference to a protobuf package used by a module. */ +export interface PackageReferenceAmino { + /** name is the fully-qualified name of the package. */ + name?: string; + /** + * revision is the optional revision of the package that is being used. + * Protobuf packages used in Cosmos should generally have a major version + * as the last part of the package name, ex. foo.bar.baz.v1. + * The revision of a package can be thought of as the minor version of a + * package which has additional backwards compatible definitions that weren't + * present in a previous version. + * + * A package should indicate its revision with a source code comment + * above the package declaration in one of its files containing the + * text "Revision N" where N is an integer revision. All packages start + * at revision 0 the first time they are released in a module. + * + * When a new version of a module is released and items are added to existing + * .proto files, these definitions should contain comments of the form + * "Since Revision N" where N is an integer revision. + * + * When the module runtime starts up, it will check the pinned proto + * image and panic if there are runtime protobuf definitions that are not + * in the pinned descriptor which do not have + * a "Since Revision N" comment or have a "Since Revision N" comment where + * N is <= to the revision specified here. This indicates that the protobuf + * files have been updated, but the pinned file descriptor hasn't. + * + * If there are items in the pinned file descriptor with a revision + * greater than the value indicated here, this will also cause a panic + * as it may mean that the pinned descriptor for a legacy module has been + * improperly updated or that there is some other versioning discrepancy. + * Runtime protobuf definitions will also be checked for compatibility + * with pinned file descriptors to make sure there are no incompatible changes. + * + * This behavior ensures that: + * * pinned proto images are up-to-date + * * protobuf files are carefully annotated with revision comments which + * are important good client UX + * * protobuf files are changed in backwards and forwards compatible ways + */ + revision?: number; +} +export interface PackageReferenceAminoMsg { + type: "/regen.app.v1alpha1.PackageReference"; + value: PackageReferenceAmino; +} +/** PackageReference is a reference to a protobuf package used by a module. */ +export interface PackageReferenceSDKType { + name: string; + revision: number; +} +/** + * MigrateFromInfo is information on a module version that a newer module + * can migrate from. + */ +export interface MigrateFromInfo { + /** + * module is the fully-qualified protobuf name of the module config object + * for the previous module version, ex: "cosmos.group.module.v1.Module". + */ + module: string; +} +export interface MigrateFromInfoProtoMsg { + typeUrl: "/regen.app.v1alpha1.MigrateFromInfo"; + value: Uint8Array; +} +/** + * MigrateFromInfo is information on a module version that a newer module + * can migrate from. + */ +export interface MigrateFromInfoAmino { + /** + * module is the fully-qualified protobuf name of the module config object + * for the previous module version, ex: "cosmos.group.module.v1.Module". + */ + module?: string; +} +export interface MigrateFromInfoAminoMsg { + type: "/regen.app.v1alpha1.MigrateFromInfo"; + value: MigrateFromInfoAmino; +} +/** + * MigrateFromInfo is information on a module version that a newer module + * can migrate from. + */ +export interface MigrateFromInfoSDKType { + module: string; +} +function createBaseModuleDescriptor(): ModuleDescriptor { + return { + goImport: "", + usePackage: [], + canMigrateFrom: [] + }; +} +export const ModuleDescriptor = { + typeUrl: "/regen.app.v1alpha1.ModuleDescriptor", + encode(message: ModuleDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.goImport !== "") { + writer.uint32(10).string(message.goImport); + } + for (const v of message.usePackage) { + PackageReference.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.canMigrateFrom) { + MigrateFromInfo.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ModuleDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModuleDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.goImport = reader.string(); + break; + case 2: + message.usePackage.push(PackageReference.decode(reader, reader.uint32())); + break; + case 3: + message.canMigrateFrom.push(MigrateFromInfo.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): ModuleDescriptor { + const message = createBaseModuleDescriptor(); + message.goImport = object.goImport ?? ""; + message.usePackage = object.usePackage?.map(e => PackageReference.fromPartial(e)) || []; + message.canMigrateFrom = object.canMigrateFrom?.map(e => MigrateFromInfo.fromPartial(e)) || []; + return message; + }, + fromAmino(object: ModuleDescriptorAmino): ModuleDescriptor { + const message = createBaseModuleDescriptor(); + if (object.go_import !== undefined && object.go_import !== null) { + message.goImport = object.go_import; + } + message.usePackage = object.use_package?.map(e => PackageReference.fromAmino(e)) || []; + message.canMigrateFrom = object.can_migrate_from?.map(e => MigrateFromInfo.fromAmino(e)) || []; + return message; + }, + toAmino(message: ModuleDescriptor): ModuleDescriptorAmino { + const obj: any = {}; + obj.go_import = message.goImport === "" ? undefined : message.goImport; + if (message.usePackage) { + obj.use_package = message.usePackage.map(e => e ? PackageReference.toAmino(e) : undefined); + } else { + obj.use_package = message.usePackage; + } + if (message.canMigrateFrom) { + obj.can_migrate_from = message.canMigrateFrom.map(e => e ? MigrateFromInfo.toAmino(e) : undefined); + } else { + obj.can_migrate_from = message.canMigrateFrom; + } + return obj; + }, + fromAminoMsg(object: ModuleDescriptorAminoMsg): ModuleDescriptor { + return ModuleDescriptor.fromAmino(object.value); + }, + fromProtoMsg(message: ModuleDescriptorProtoMsg): ModuleDescriptor { + return ModuleDescriptor.decode(message.value); + }, + toProto(message: ModuleDescriptor): Uint8Array { + return ModuleDescriptor.encode(message).finish(); + }, + toProtoMsg(message: ModuleDescriptor): ModuleDescriptorProtoMsg { + return { + typeUrl: "/regen.app.v1alpha1.ModuleDescriptor", + value: ModuleDescriptor.encode(message).finish() + }; + } +}; +function createBasePackageReference(): PackageReference { + return { + name: "", + revision: 0 + }; +} +export const PackageReference = { + typeUrl: "/regen.app.v1alpha1.PackageReference", + encode(message: PackageReference, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.revision !== 0) { + writer.uint32(16).uint32(message.revision); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): PackageReference { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePackageReference(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.revision = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): PackageReference { + const message = createBasePackageReference(); + message.name = object.name ?? ""; + message.revision = object.revision ?? 0; + return message; + }, + fromAmino(object: PackageReferenceAmino): PackageReference { + const message = createBasePackageReference(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + if (object.revision !== undefined && object.revision !== null) { + message.revision = object.revision; + } + return message; + }, + toAmino(message: PackageReference): PackageReferenceAmino { + const obj: any = {}; + obj.name = message.name === "" ? undefined : message.name; + obj.revision = message.revision === 0 ? undefined : message.revision; + return obj; + }, + fromAminoMsg(object: PackageReferenceAminoMsg): PackageReference { + return PackageReference.fromAmino(object.value); + }, + fromProtoMsg(message: PackageReferenceProtoMsg): PackageReference { + return PackageReference.decode(message.value); + }, + toProto(message: PackageReference): Uint8Array { + return PackageReference.encode(message).finish(); + }, + toProtoMsg(message: PackageReference): PackageReferenceProtoMsg { + return { + typeUrl: "/regen.app.v1alpha1.PackageReference", + value: PackageReference.encode(message).finish() + }; + } +}; +function createBaseMigrateFromInfo(): MigrateFromInfo { + return { + module: "" + }; +} +export const MigrateFromInfo = { + typeUrl: "/regen.app.v1alpha1.MigrateFromInfo", + encode(message: MigrateFromInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.module !== "") { + writer.uint32(10).string(message.module); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MigrateFromInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMigrateFromInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.module = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): MigrateFromInfo { + const message = createBaseMigrateFromInfo(); + message.module = object.module ?? ""; + return message; + }, + fromAmino(object: MigrateFromInfoAmino): MigrateFromInfo { + const message = createBaseMigrateFromInfo(); + if (object.module !== undefined && object.module !== null) { + message.module = object.module; + } + return message; + }, + toAmino(message: MigrateFromInfo): MigrateFromInfoAmino { + const obj: any = {}; + obj.module = message.module === "" ? undefined : message.module; + return obj; + }, + fromAminoMsg(object: MigrateFromInfoAminoMsg): MigrateFromInfo { + return MigrateFromInfo.fromAmino(object.value); + }, + fromProtoMsg(message: MigrateFromInfoProtoMsg): MigrateFromInfo { + return MigrateFromInfo.decode(message.value); + }, + toProto(message: MigrateFromInfo): Uint8Array { + return MigrateFromInfo.encode(message).finish(); + }, + toProtoMsg(message: MigrateFromInfo): MigrateFromInfoProtoMsg { + return { + typeUrl: "/regen.app.v1alpha1.MigrateFromInfo", + value: MigrateFromInfo.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/packages/api/src/regen/bundle.ts b/packages/api/src/regen/bundle.ts index 8be80248..db2fd222 100644 --- a/packages/api/src/regen/bundle.ts +++ b/packages/api/src/regen/bundle.ts @@ -1,175 +1,179 @@ //@ts-nocheck -import * as _76 from "./data/v1/events"; -import * as _77 from "./data/v1/query"; -import * as _78 from "./data/v1/state"; -import * as _79 from "./data/v1/tx"; -import * as _80 from "./data/v1/types"; -import * as _81 from "./data/v2/events"; -import * as _82 from "./data/v2/query"; -import * as _83 from "./data/v2/state"; -import * as _84 from "./data/v2/tx"; -import * as _85 from "./data/v2/types"; -import * as _86 from "./ecocredit/basket/v1/events"; -import * as _87 from "./ecocredit/basket/v1/query"; -import * as _88 from "./ecocredit/basket/v1/state"; -import * as _89 from "./ecocredit/basket/v1/tx"; -import * as _90 from "./ecocredit/basket/v1/types"; -import * as _91 from "./ecocredit/marketplace/v1/events"; -import * as _92 from "./ecocredit/marketplace/v1/query"; -import * as _93 from "./ecocredit/marketplace/v1/state"; -import * as _94 from "./ecocredit/marketplace/v1/tx"; -import * as _95 from "./ecocredit/marketplace/v1/types"; -import * as _96 from "./ecocredit/orderbook/v1alpha1/memory"; -import * as _97 from "./ecocredit/v1/events"; -import * as _98 from "./ecocredit/v1/query"; -import * as _99 from "./ecocredit/v1/state"; -import * as _100 from "./ecocredit/v1/tx"; -import * as _101 from "./ecocredit/v1/types"; -import * as _102 from "./ecocredit/v1alpha1/events"; -import * as _103 from "./ecocredit/v1alpha1/genesis"; -import * as _104 from "./ecocredit/v1alpha1/query"; -import * as _105 from "./ecocredit/v1alpha1/tx"; -import * as _106 from "./ecocredit/v1alpha1/types"; -import * as _107 from "./intertx/v1/query"; -import * as _108 from "./intertx/v1/tx"; -import * as _192 from "./data/v1/tx.amino"; -import * as _193 from "./data/v2/tx.amino"; -import * as _194 from "./ecocredit/basket/v1/tx.amino"; -import * as _195 from "./ecocredit/marketplace/v1/tx.amino"; -import * as _196 from "./ecocredit/v1/tx.amino"; -import * as _197 from "./ecocredit/v1alpha1/tx.amino"; -import * as _198 from "./intertx/v1/tx.amino"; -import * as _199 from "./data/v1/tx.registry"; -import * as _200 from "./data/v2/tx.registry"; -import * as _201 from "./ecocredit/basket/v1/tx.registry"; -import * as _202 from "./ecocredit/marketplace/v1/tx.registry"; -import * as _203 from "./ecocredit/v1/tx.registry"; -import * as _204 from "./ecocredit/v1alpha1/tx.registry"; -import * as _205 from "./intertx/v1/tx.registry"; -import * as _206 from "./data/v1/query.lcd"; -import * as _207 from "./data/v2/query.lcd"; -import * as _208 from "./ecocredit/basket/v1/query.lcd"; -import * as _209 from "./ecocredit/marketplace/v1/query.lcd"; -import * as _210 from "./ecocredit/v1/query.lcd"; -import * as _211 from "./ecocredit/v1alpha1/query.lcd"; -import * as _212 from "./intertx/v1/query.lcd"; -import * as _213 from "./data/v1/query.rpc.Query"; -import * as _214 from "./data/v2/query.rpc.Query"; -import * as _215 from "./ecocredit/basket/v1/query.rpc.Query"; -import * as _216 from "./ecocredit/marketplace/v1/query.rpc.Query"; -import * as _217 from "./ecocredit/v1/query.rpc.Query"; -import * as _218 from "./ecocredit/v1alpha1/query.rpc.Query"; -import * as _219 from "./intertx/v1/query.rpc.Query"; -import * as _220 from "./data/v1/tx.rpc.msg"; -import * as _221 from "./data/v2/tx.rpc.msg"; -import * as _222 from "./ecocredit/basket/v1/tx.rpc.msg"; -import * as _223 from "./ecocredit/marketplace/v1/tx.rpc.msg"; -import * as _224 from "./ecocredit/v1/tx.rpc.msg"; -import * as _225 from "./ecocredit/v1alpha1/tx.rpc.msg"; -import * as _226 from "./intertx/v1/tx.rpc.msg"; -import * as _233 from "./lcd"; -import * as _234 from "./rpc.query"; -import * as _235 from "./rpc.tx"; +import * as _130 from "./app/v1alpha1/module"; +import * as _131 from "./data/v1/events"; +import * as _132 from "./data/v1/query"; +import * as _133 from "./data/v1/state"; +import * as _134 from "./data/v1/tx"; +import * as _135 from "./data/v1/types"; +import * as _136 from "./data/v2/events"; +import * as _137 from "./data/v2/query"; +import * as _138 from "./data/v2/state"; +import * as _139 from "./data/v2/tx"; +import * as _140 from "./data/v2/types"; +import * as _141 from "./ecocredit/basket/v1/events"; +import * as _142 from "./ecocredit/basket/v1/query"; +import * as _143 from "./ecocredit/basket/v1/state"; +import * as _144 from "./ecocredit/basket/v1/tx"; +import * as _145 from "./ecocredit/basket/v1/types"; +import * as _146 from "./ecocredit/marketplace/v1/events"; +import * as _147 from "./ecocredit/marketplace/v1/query"; +import * as _148 from "./ecocredit/marketplace/v1/state"; +import * as _149 from "./ecocredit/marketplace/v1/tx"; +import * as _150 from "./ecocredit/marketplace/v1/types"; +import * as _151 from "./ecocredit/orderbook/v1alpha1/memory"; +import * as _152 from "./ecocredit/v1/events"; +import * as _153 from "./ecocredit/v1/query"; +import * as _154 from "./ecocredit/v1/state"; +import * as _155 from "./ecocredit/v1/tx"; +import * as _156 from "./ecocredit/v1/types"; +import * as _157 from "./ecocredit/v1alpha1/events"; +import * as _158 from "./ecocredit/v1alpha1/genesis"; +import * as _159 from "./ecocredit/v1alpha1/query"; +import * as _160 from "./ecocredit/v1alpha1/tx"; +import * as _161 from "./ecocredit/v1alpha1/types"; +import * as _162 from "./orm/module/v1alpha1/module"; +import * as _163 from "./orm/v1/orm"; +import * as _164 from "./orm/v1alpha1/schema"; +import * as _278 from "./data/v1/tx.amino"; +import * as _279 from "./data/v2/tx.amino"; +import * as _280 from "./ecocredit/basket/v1/tx.amino"; +import * as _281 from "./ecocredit/marketplace/v1/tx.amino"; +import * as _282 from "./ecocredit/v1/tx.amino"; +import * as _283 from "./ecocredit/v1alpha1/tx.amino"; +import * as _284 from "./data/v1/tx.registry"; +import * as _285 from "./data/v2/tx.registry"; +import * as _286 from "./ecocredit/basket/v1/tx.registry"; +import * as _287 from "./ecocredit/marketplace/v1/tx.registry"; +import * as _288 from "./ecocredit/v1/tx.registry"; +import * as _289 from "./ecocredit/v1alpha1/tx.registry"; +import * as _290 from "./data/v1/query.lcd"; +import * as _291 from "./data/v2/query.lcd"; +import * as _292 from "./ecocredit/basket/v1/query.lcd"; +import * as _293 from "./ecocredit/marketplace/v1/query.lcd"; +import * as _294 from "./ecocredit/v1/query.lcd"; +import * as _295 from "./ecocredit/v1alpha1/query.lcd"; +import * as _296 from "./data/v1/query.rpc.Query"; +import * as _297 from "./data/v2/query.rpc.Query"; +import * as _298 from "./ecocredit/basket/v1/query.rpc.Query"; +import * as _299 from "./ecocredit/marketplace/v1/query.rpc.Query"; +import * as _300 from "./ecocredit/v1/query.rpc.Query"; +import * as _301 from "./ecocredit/v1alpha1/query.rpc.Query"; +import * as _302 from "./data/v1/tx.rpc.msg"; +import * as _303 from "./data/v2/tx.rpc.msg"; +import * as _304 from "./ecocredit/basket/v1/tx.rpc.msg"; +import * as _305 from "./ecocredit/marketplace/v1/tx.rpc.msg"; +import * as _306 from "./ecocredit/v1/tx.rpc.msg"; +import * as _307 from "./ecocredit/v1alpha1/tx.rpc.msg"; +import * as _314 from "./lcd"; +import * as _315 from "./rpc.query"; +import * as _316 from "./rpc.tx"; export namespace regen { + export namespace app { + export const v1alpha1 = { + ..._130 + }; + } export namespace data { export const v1 = { - ..._76, - ..._77, - ..._78, - ..._79, - ..._80, - ..._192, - ..._199, - ..._206, - ..._213, - ..._220 + ..._131, + ..._132, + ..._133, + ..._134, + ..._135, + ..._278, + ..._284, + ..._290, + ..._296, + ..._302 }; export const v2 = { - ..._81, - ..._82, - ..._83, - ..._84, - ..._85, - ..._193, - ..._200, - ..._207, - ..._214, - ..._221 + ..._136, + ..._137, + ..._138, + ..._139, + ..._140, + ..._279, + ..._285, + ..._291, + ..._297, + ..._303 }; } export namespace ecocredit { export namespace basket { export const v1 = { - ..._86, - ..._87, - ..._88, - ..._89, - ..._90, - ..._194, - ..._201, - ..._208, - ..._215, - ..._222 + ..._141, + ..._142, + ..._143, + ..._144, + ..._145, + ..._280, + ..._286, + ..._292, + ..._298, + ..._304 }; } export namespace marketplace { export const v1 = { - ..._91, - ..._92, - ..._93, - ..._94, - ..._95, - ..._195, - ..._202, - ..._209, - ..._216, - ..._223 + ..._146, + ..._147, + ..._148, + ..._149, + ..._150, + ..._281, + ..._287, + ..._293, + ..._299, + ..._305 }; } export namespace orderbook { export const v1alpha1 = { - ..._96 + ..._151 }; } export const v1 = { - ..._97, - ..._98, - ..._99, - ..._100, - ..._101, - ..._196, - ..._203, - ..._210, - ..._217, - ..._224 + ..._152, + ..._153, + ..._154, + ..._155, + ..._156, + ..._282, + ..._288, + ..._294, + ..._300, + ..._306 }; export const v1alpha1 = { - ..._102, - ..._103, - ..._104, - ..._105, - ..._106, - ..._197, - ..._204, - ..._211, - ..._218, - ..._225 + ..._157, + ..._158, + ..._159, + ..._160, + ..._161, + ..._283, + ..._289, + ..._295, + ..._301, + ..._307 }; } - export namespace intertx { + export namespace orm { + export namespace module { + export const v1alpha1 = { + ..._162 + }; + } export const v1 = { - ..._107, - ..._108, - ..._198, - ..._205, - ..._212, - ..._219, - ..._226 + ..._163 + }; + export const v1alpha1 = { + ..._164 }; } export const ClientFactory = { - ..._233, - ..._234, - ..._235 + ..._314, + ..._315, + ..._316 }; } \ No newline at end of file diff --git a/packages/api/src/regen/client.ts b/packages/api/src/regen/client.ts index 3d2ebfea..03552b51 100644 --- a/packages/api/src/regen/client.ts +++ b/packages/api/src/regen/client.ts @@ -8,24 +8,21 @@ import * as regenEcocreditBasketV1TxRegistry from "./ecocredit/basket/v1/tx.regi import * as regenEcocreditMarketplaceV1TxRegistry from "./ecocredit/marketplace/v1/tx.registry"; import * as regenEcocreditV1TxRegistry from "./ecocredit/v1/tx.registry"; import * as regenEcocreditV1alpha1TxRegistry from "./ecocredit/v1alpha1/tx.registry"; -import * as regenIntertxV1TxRegistry from "./intertx/v1/tx.registry"; import * as regenDataV1TxAmino from "./data/v1/tx.amino"; import * as regenDataV2TxAmino from "./data/v2/tx.amino"; import * as regenEcocreditBasketV1TxAmino from "./ecocredit/basket/v1/tx.amino"; import * as regenEcocreditMarketplaceV1TxAmino from "./ecocredit/marketplace/v1/tx.amino"; import * as regenEcocreditV1TxAmino from "./ecocredit/v1/tx.amino"; import * as regenEcocreditV1alpha1TxAmino from "./ecocredit/v1alpha1/tx.amino"; -import * as regenIntertxV1TxAmino from "./intertx/v1/tx.amino"; export const regenAminoConverters = { ...regenDataV1TxAmino.AminoConverter, ...regenDataV2TxAmino.AminoConverter, ...regenEcocreditBasketV1TxAmino.AminoConverter, ...regenEcocreditMarketplaceV1TxAmino.AminoConverter, ...regenEcocreditV1TxAmino.AminoConverter, - ...regenEcocreditV1alpha1TxAmino.AminoConverter, - ...regenIntertxV1TxAmino.AminoConverter + ...regenEcocreditV1alpha1TxAmino.AminoConverter }; -export const regenProtoRegistry: ReadonlyArray<[string, GeneratedType]> = [...regenDataV1TxRegistry.registry, ...regenDataV2TxRegistry.registry, ...regenEcocreditBasketV1TxRegistry.registry, ...regenEcocreditMarketplaceV1TxRegistry.registry, ...regenEcocreditV1TxRegistry.registry, ...regenEcocreditV1alpha1TxRegistry.registry, ...regenIntertxV1TxRegistry.registry]; +export const regenProtoRegistry: ReadonlyArray<[string, GeneratedType]> = [...regenDataV1TxRegistry.registry, ...regenDataV2TxRegistry.registry, ...regenEcocreditBasketV1TxRegistry.registry, ...regenEcocreditMarketplaceV1TxRegistry.registry, ...regenEcocreditV1TxRegistry.registry, ...regenEcocreditV1alpha1TxRegistry.registry]; export const getSigningRegenClientOptions = ({ defaultTypes = defaultRegistryTypes }: { diff --git a/packages/api/src/regen/intertx/v1/query.lcd.ts b/packages/api/src/regen/intertx/v1/query.lcd.ts deleted file mode 100644 index a559e305..00000000 --- a/packages/api/src/regen/intertx/v1/query.lcd.ts +++ /dev/null @@ -1,20 +0,0 @@ -//@ts-nocheck -import { LCDClient } from "@cosmology/lcd"; -import { QueryInterchainAccountRequest, QueryInterchainAccountResponseSDKType } from "./query"; -export class LCDQueryClient { - req: LCDClient; - constructor({ - requestClient - }: { - requestClient: LCDClient; - }) { - this.req = requestClient; - this.interchainAccount = this.interchainAccount.bind(this); - } - /* QueryInterchainAccount returns the interchain account for given owner - address on a given connection pair */ - async interchainAccount(params: QueryInterchainAccountRequest): Promise { - const endpoint = `regen/intertx/v1/interchain-account/${params.owner}/${params.connectionId}`; - return await this.req.get(endpoint); - } -} \ No newline at end of file diff --git a/packages/api/src/regen/intertx/v1/query.rpc.Query.ts b/packages/api/src/regen/intertx/v1/query.rpc.Query.ts deleted file mode 100644 index 064bdd22..00000000 --- a/packages/api/src/regen/intertx/v1/query.rpc.Query.ts +++ /dev/null @@ -1,34 +0,0 @@ -//@ts-nocheck -import { Rpc } from "../../../helpers"; -import { BinaryReader } from "../../../binary"; -import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryInterchainAccountRequest, QueryInterchainAccountResponse } from "./query"; -/** Query defines the gRPC querier service. */ -export interface Query { - /** - * QueryInterchainAccount returns the interchain account for given owner - * address on a given connection pair - */ - interchainAccount(request: QueryInterchainAccountRequest): Promise; -} -export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { - this.rpc = rpc; - this.interchainAccount = this.interchainAccount.bind(this); - } - interchainAccount(request: QueryInterchainAccountRequest): Promise { - const data = QueryInterchainAccountRequest.encode(request).finish(); - const promise = this.rpc.request("regen.intertx.v1.Query", "InterchainAccount", data); - return promise.then(data => QueryInterchainAccountResponse.decode(new BinaryReader(data))); - } -} -export const createRpcQueryExtension = (base: QueryClient) => { - const rpc = createProtobufRpcClient(base); - const queryService = new QueryClientImpl(rpc); - return { - interchainAccount(request: QueryInterchainAccountRequest): Promise { - return queryService.interchainAccount(request); - } - }; -}; \ No newline at end of file diff --git a/packages/api/src/regen/intertx/v1/query.ts b/packages/api/src/regen/intertx/v1/query.ts deleted file mode 100644 index 9e57096b..00000000 --- a/packages/api/src/regen/intertx/v1/query.ts +++ /dev/null @@ -1,207 +0,0 @@ -//@ts-nocheck -import { BinaryReader, BinaryWriter } from "../../../binary"; -/** - * QueryInterchainAccountRequest is the request type for the - * Query/InterchainAccountAddress RPC - */ -export interface QueryInterchainAccountRequest { - /** owner is the address of the account that owns the ICA. */ - owner: string; - /** connection_id is the connection the ICA claimed. */ - connectionId: string; -} -export interface QueryInterchainAccountRequestProtoMsg { - typeUrl: "/regen.intertx.v1.QueryInterchainAccountRequest"; - value: Uint8Array; -} -/** - * QueryInterchainAccountRequest is the request type for the - * Query/InterchainAccountAddress RPC - */ -export interface QueryInterchainAccountRequestAmino { - /** owner is the address of the account that owns the ICA. */ - owner?: string; - /** connection_id is the connection the ICA claimed. */ - connection_id?: string; -} -export interface QueryInterchainAccountRequestAminoMsg { - type: "/regen.intertx.v1.QueryInterchainAccountRequest"; - value: QueryInterchainAccountRequestAmino; -} -/** - * QueryInterchainAccountRequest is the request type for the - * Query/InterchainAccountAddress RPC - */ -export interface QueryInterchainAccountRequestSDKType { - owner: string; - connection_id: string; -} -/** - * QueryInterchainAccountResponse the response type for the - * Query/InterchainAccountAddress RPC - */ -export interface QueryInterchainAccountResponse { - /** interchain_account_address is the address of the ICA. */ - interchainAccountAddress: string; -} -export interface QueryInterchainAccountResponseProtoMsg { - typeUrl: "/regen.intertx.v1.QueryInterchainAccountResponse"; - value: Uint8Array; -} -/** - * QueryInterchainAccountResponse the response type for the - * Query/InterchainAccountAddress RPC - */ -export interface QueryInterchainAccountResponseAmino { - /** interchain_account_address is the address of the ICA. */ - interchain_account_address?: string; -} -export interface QueryInterchainAccountResponseAminoMsg { - type: "/regen.intertx.v1.QueryInterchainAccountResponse"; - value: QueryInterchainAccountResponseAmino; -} -/** - * QueryInterchainAccountResponse the response type for the - * Query/InterchainAccountAddress RPC - */ -export interface QueryInterchainAccountResponseSDKType { - interchain_account_address: string; -} -function createBaseQueryInterchainAccountRequest(): QueryInterchainAccountRequest { - return { - owner: "", - connectionId: "" - }; -} -export const QueryInterchainAccountRequest = { - typeUrl: "/regen.intertx.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; - }, - fromPartial(object: Partial): QueryInterchainAccountRequest { - const message = createBaseQueryInterchainAccountRequest(); - message.owner = object.owner ?? ""; - message.connectionId = object.connectionId ?? ""; - return message; - }, - fromAmino(object: QueryInterchainAccountRequestAmino): QueryInterchainAccountRequest { - const message = createBaseQueryInterchainAccountRequest(); - if (object.owner !== undefined && object.owner !== null) { - message.owner = object.owner; - } - if (object.connection_id !== undefined && object.connection_id !== null) { - message.connectionId = object.connection_id; - } - return message; - }, - toAmino(message: QueryInterchainAccountRequest): QueryInterchainAccountRequestAmino { - const obj: any = {}; - obj.owner = message.owner === "" ? undefined : message.owner; - obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; - return obj; - }, - fromAminoMsg(object: QueryInterchainAccountRequestAminoMsg): QueryInterchainAccountRequest { - return QueryInterchainAccountRequest.fromAmino(object.value); - }, - fromProtoMsg(message: QueryInterchainAccountRequestProtoMsg): QueryInterchainAccountRequest { - return QueryInterchainAccountRequest.decode(message.value); - }, - toProto(message: QueryInterchainAccountRequest): Uint8Array { - return QueryInterchainAccountRequest.encode(message).finish(); - }, - toProtoMsg(message: QueryInterchainAccountRequest): QueryInterchainAccountRequestProtoMsg { - return { - typeUrl: "/regen.intertx.v1.QueryInterchainAccountRequest", - value: QueryInterchainAccountRequest.encode(message).finish() - }; - } -}; -function createBaseQueryInterchainAccountResponse(): QueryInterchainAccountResponse { - return { - interchainAccountAddress: "" - }; -} -export const QueryInterchainAccountResponse = { - typeUrl: "/regen.intertx.v1.QueryInterchainAccountResponse", - encode(message: QueryInterchainAccountResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.interchainAccountAddress !== "") { - writer.uint32(10).string(message.interchainAccountAddress); - } - 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.interchainAccountAddress = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromPartial(object: Partial): QueryInterchainAccountResponse { - const message = createBaseQueryInterchainAccountResponse(); - message.interchainAccountAddress = object.interchainAccountAddress ?? ""; - return message; - }, - fromAmino(object: QueryInterchainAccountResponseAmino): QueryInterchainAccountResponse { - const message = createBaseQueryInterchainAccountResponse(); - if (object.interchain_account_address !== undefined && object.interchain_account_address !== null) { - message.interchainAccountAddress = object.interchain_account_address; - } - return message; - }, - toAmino(message: QueryInterchainAccountResponse): QueryInterchainAccountResponseAmino { - const obj: any = {}; - obj.interchain_account_address = message.interchainAccountAddress === "" ? undefined : message.interchainAccountAddress; - return obj; - }, - fromAminoMsg(object: QueryInterchainAccountResponseAminoMsg): QueryInterchainAccountResponse { - return QueryInterchainAccountResponse.fromAmino(object.value); - }, - fromProtoMsg(message: QueryInterchainAccountResponseProtoMsg): QueryInterchainAccountResponse { - return QueryInterchainAccountResponse.decode(message.value); - }, - toProto(message: QueryInterchainAccountResponse): Uint8Array { - return QueryInterchainAccountResponse.encode(message).finish(); - }, - toProtoMsg(message: QueryInterchainAccountResponse): QueryInterchainAccountResponseProtoMsg { - return { - typeUrl: "/regen.intertx.v1.QueryInterchainAccountResponse", - value: QueryInterchainAccountResponse.encode(message).finish() - }; - } -}; \ No newline at end of file diff --git a/packages/api/src/regen/intertx/v1/tx.amino.ts b/packages/api/src/regen/intertx/v1/tx.amino.ts deleted file mode 100644 index 2cf4a590..00000000 --- a/packages/api/src/regen/intertx/v1/tx.amino.ts +++ /dev/null @@ -1,14 +0,0 @@ -//@ts-nocheck -import { MsgRegisterAccount, MsgSubmitTx } from "./tx"; -export const AminoConverter = { - "/regen.intertx.v1.MsgRegisterAccount": { - aminoType: "/regen.intertx.v1.MsgRegisterAccount", - toAmino: MsgRegisterAccount.toAmino, - fromAmino: MsgRegisterAccount.fromAmino - }, - "/regen.intertx.v1.MsgSubmitTx": { - aminoType: "/regen.intertx.v1.MsgSubmitTx", - toAmino: MsgSubmitTx.toAmino, - fromAmino: MsgSubmitTx.fromAmino - } -}; \ No newline at end of file diff --git a/packages/api/src/regen/intertx/v1/tx.registry.ts b/packages/api/src/regen/intertx/v1/tx.registry.ts deleted file mode 100644 index 54d191e3..00000000 --- a/packages/api/src/regen/intertx/v1/tx.registry.ts +++ /dev/null @@ -1,53 +0,0 @@ -//@ts-nocheck -import { GeneratedType, Registry } from "@cosmjs/proto-signing"; -import { MsgRegisterAccount, MsgSubmitTx } from "./tx"; -export const registry: ReadonlyArray<[string, GeneratedType]> = [["/regen.intertx.v1.MsgRegisterAccount", MsgRegisterAccount], ["/regen.intertx.v1.MsgSubmitTx", MsgSubmitTx]]; -export const load = (protoRegistry: Registry) => { - registry.forEach(([typeUrl, mod]) => { - protoRegistry.register(typeUrl, mod); - }); -}; -export const MessageComposer = { - encoded: { - registerAccount(value: MsgRegisterAccount) { - return { - typeUrl: "/regen.intertx.v1.MsgRegisterAccount", - value: MsgRegisterAccount.encode(value).finish() - }; - }, - submitTx(value: MsgSubmitTx) { - return { - typeUrl: "/regen.intertx.v1.MsgSubmitTx", - value: MsgSubmitTx.encode(value).finish() - }; - } - }, - withTypeUrl: { - registerAccount(value: MsgRegisterAccount) { - return { - typeUrl: "/regen.intertx.v1.MsgRegisterAccount", - value - }; - }, - submitTx(value: MsgSubmitTx) { - return { - typeUrl: "/regen.intertx.v1.MsgSubmitTx", - value - }; - } - }, - fromPartial: { - registerAccount(value: MsgRegisterAccount) { - return { - typeUrl: "/regen.intertx.v1.MsgRegisterAccount", - value: MsgRegisterAccount.fromPartial(value) - }; - }, - submitTx(value: MsgSubmitTx) { - return { - typeUrl: "/regen.intertx.v1.MsgSubmitTx", - value: MsgSubmitTx.fromPartial(value) - }; - } - } -}; \ No newline at end of file diff --git a/packages/api/src/regen/intertx/v1/tx.rpc.msg.ts b/packages/api/src/regen/intertx/v1/tx.rpc.msg.ts deleted file mode 100644 index 91263098..00000000 --- a/packages/api/src/regen/intertx/v1/tx.rpc.msg.ts +++ /dev/null @@ -1,29 +0,0 @@ -//@ts-nocheck -import { Rpc } from "../../../helpers"; -import { BinaryReader } from "../../../binary"; -import { MsgRegisterAccount, MsgRegisterAccountResponse, MsgSubmitTx, MsgSubmitTxResponse } from "./tx"; -/** Msg defines the intertx Msg service. */ -export interface Msg { - /** Register defines a rpc handler for MsgRegisterAccount */ - registerAccount(request: MsgRegisterAccount): Promise; - /** SubmitTx defines a rpc handler for MsgSubmitTx */ - submitTx(request: MsgSubmitTx): Promise; -} -export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { - this.rpc = rpc; - this.registerAccount = this.registerAccount.bind(this); - this.submitTx = this.submitTx.bind(this); - } - registerAccount(request: MsgRegisterAccount): Promise { - const data = MsgRegisterAccount.encode(request).finish(); - const promise = this.rpc.request("regen.intertx.v1.Msg", "RegisterAccount", data); - return promise.then(data => MsgRegisterAccountResponse.decode(new BinaryReader(data))); - } - submitTx(request: MsgSubmitTx): Promise { - const data = MsgSubmitTx.encode(request).finish(); - const promise = this.rpc.request("regen.intertx.v1.Msg", "SubmitTx", data); - return promise.then(data => MsgSubmitTxResponse.decode(new BinaryReader(data))); - } -} \ No newline at end of file diff --git a/packages/api/src/regen/intertx/v1/tx.ts b/packages/api/src/regen/intertx/v1/tx.ts deleted file mode 100644 index 0e7e1fdd..00000000 --- a/packages/api/src/regen/intertx/v1/tx.ts +++ /dev/null @@ -1,377 +0,0 @@ -//@ts-nocheck -import { Any, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; -import { BinaryReader, BinaryWriter } from "../../../binary"; -/** MsgRegisterAccount defines the payload for Msg/RegisterAccount */ -export interface MsgRegisterAccount { - /** owner is the address of the interchain account owner. */ - owner: string; - /** connection_id is the connection id string (i.e. channel-5). */ - connectionId: string; - /** - * version is the application version string. For example, this could be an - * ICS27 encoded metadata type or an ICS29 encoded metadata type with a nested - * application version. - */ - version: string; -} -export interface MsgRegisterAccountProtoMsg { - typeUrl: "/regen.intertx.v1.MsgRegisterAccount"; - value: Uint8Array; -} -/** MsgRegisterAccount defines the payload for Msg/RegisterAccount */ -export interface MsgRegisterAccountAmino { - /** owner is the address of the interchain account owner. */ - owner?: string; - /** connection_id is the connection id string (i.e. channel-5). */ - connection_id?: string; - /** - * version is the application version string. For example, this could be an - * ICS27 encoded metadata type or an ICS29 encoded metadata type with a nested - * application version. - */ - version?: string; -} -export interface MsgRegisterAccountAminoMsg { - type: "/regen.intertx.v1.MsgRegisterAccount"; - value: MsgRegisterAccountAmino; -} -/** MsgRegisterAccount defines the payload for Msg/RegisterAccount */ -export interface MsgRegisterAccountSDKType { - owner: string; - connection_id: string; - version: string; -} -/** MsgRegisterAccountResponse defines the response for Msg/RegisterAccount */ -export interface MsgRegisterAccountResponse {} -export interface MsgRegisterAccountResponseProtoMsg { - typeUrl: "/regen.intertx.v1.MsgRegisterAccountResponse"; - value: Uint8Array; -} -/** MsgRegisterAccountResponse defines the response for Msg/RegisterAccount */ -export interface MsgRegisterAccountResponseAmino {} -export interface MsgRegisterAccountResponseAminoMsg { - type: "/regen.intertx.v1.MsgRegisterAccountResponse"; - value: MsgRegisterAccountResponseAmino; -} -/** MsgRegisterAccountResponse defines the response for Msg/RegisterAccount */ -export interface MsgRegisterAccountResponseSDKType {} -/** MsgSubmitTx defines the payload for Msg/SubmitTx */ -export interface MsgSubmitTx { - /** owner is the owner address of the interchain account. */ - owner: string; - /** connection_id is the id of the connection. */ - connectionId: string; - /** msg is the bytes of the transaction msg to send. */ - msg?: Any; -} -export interface MsgSubmitTxProtoMsg { - typeUrl: "/regen.intertx.v1.MsgSubmitTx"; - value: Uint8Array; -} -/** MsgSubmitTx defines the payload for Msg/SubmitTx */ -export interface MsgSubmitTxAmino { - /** owner is the owner address of the interchain account. */ - owner?: string; - /** connection_id is the id of the connection. */ - connection_id?: string; - /** msg is the bytes of the transaction msg to send. */ - msg?: AnyAmino; -} -export interface MsgSubmitTxAminoMsg { - type: "/regen.intertx.v1.MsgSubmitTx"; - value: MsgSubmitTxAmino; -} -/** MsgSubmitTx defines the payload for Msg/SubmitTx */ -export interface MsgSubmitTxSDKType { - owner: string; - connection_id: string; - msg?: AnySDKType; -} -/** MsgSubmitTxResponse defines the response for Msg/SubmitTx */ -export interface MsgSubmitTxResponse {} -export interface MsgSubmitTxResponseProtoMsg { - typeUrl: "/regen.intertx.v1.MsgSubmitTxResponse"; - value: Uint8Array; -} -/** MsgSubmitTxResponse defines the response for Msg/SubmitTx */ -export interface MsgSubmitTxResponseAmino {} -export interface MsgSubmitTxResponseAminoMsg { - type: "/regen.intertx.v1.MsgSubmitTxResponse"; - value: MsgSubmitTxResponseAmino; -} -/** MsgSubmitTxResponse defines the response for Msg/SubmitTx */ -export interface MsgSubmitTxResponseSDKType {} -function createBaseMsgRegisterAccount(): MsgRegisterAccount { - return { - owner: "", - connectionId: "", - version: "" - }; -} -export const MsgRegisterAccount = { - typeUrl: "/regen.intertx.v1.MsgRegisterAccount", - encode(message: MsgRegisterAccount, 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): MsgRegisterAccount { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMsgRegisterAccount(); - 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; - }, - fromPartial(object: Partial): MsgRegisterAccount { - const message = createBaseMsgRegisterAccount(); - message.owner = object.owner ?? ""; - message.connectionId = object.connectionId ?? ""; - message.version = object.version ?? ""; - return message; - }, - fromAmino(object: MsgRegisterAccountAmino): MsgRegisterAccount { - const message = createBaseMsgRegisterAccount(); - if (object.owner !== undefined && object.owner !== null) { - message.owner = object.owner; - } - if (object.connection_id !== undefined && object.connection_id !== null) { - message.connectionId = object.connection_id; - } - if (object.version !== undefined && object.version !== null) { - message.version = object.version; - } - return message; - }, - toAmino(message: MsgRegisterAccount): MsgRegisterAccountAmino { - const obj: any = {}; - obj.owner = message.owner === "" ? undefined : message.owner; - obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; - obj.version = message.version === "" ? undefined : message.version; - return obj; - }, - fromAminoMsg(object: MsgRegisterAccountAminoMsg): MsgRegisterAccount { - return MsgRegisterAccount.fromAmino(object.value); - }, - fromProtoMsg(message: MsgRegisterAccountProtoMsg): MsgRegisterAccount { - return MsgRegisterAccount.decode(message.value); - }, - toProto(message: MsgRegisterAccount): Uint8Array { - return MsgRegisterAccount.encode(message).finish(); - }, - toProtoMsg(message: MsgRegisterAccount): MsgRegisterAccountProtoMsg { - return { - typeUrl: "/regen.intertx.v1.MsgRegisterAccount", - value: MsgRegisterAccount.encode(message).finish() - }; - } -}; -function createBaseMsgRegisterAccountResponse(): MsgRegisterAccountResponse { - return {}; -} -export const MsgRegisterAccountResponse = { - typeUrl: "/regen.intertx.v1.MsgRegisterAccountResponse", - encode(_: MsgRegisterAccountResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterAccountResponse { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMsgRegisterAccountResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromPartial(_: Partial): MsgRegisterAccountResponse { - const message = createBaseMsgRegisterAccountResponse(); - return message; - }, - fromAmino(_: MsgRegisterAccountResponseAmino): MsgRegisterAccountResponse { - const message = createBaseMsgRegisterAccountResponse(); - return message; - }, - toAmino(_: MsgRegisterAccountResponse): MsgRegisterAccountResponseAmino { - const obj: any = {}; - return obj; - }, - fromAminoMsg(object: MsgRegisterAccountResponseAminoMsg): MsgRegisterAccountResponse { - return MsgRegisterAccountResponse.fromAmino(object.value); - }, - fromProtoMsg(message: MsgRegisterAccountResponseProtoMsg): MsgRegisterAccountResponse { - return MsgRegisterAccountResponse.decode(message.value); - }, - toProto(message: MsgRegisterAccountResponse): Uint8Array { - return MsgRegisterAccountResponse.encode(message).finish(); - }, - toProtoMsg(message: MsgRegisterAccountResponse): MsgRegisterAccountResponseProtoMsg { - return { - typeUrl: "/regen.intertx.v1.MsgRegisterAccountResponse", - value: MsgRegisterAccountResponse.encode(message).finish() - }; - } -}; -function createBaseMsgSubmitTx(): MsgSubmitTx { - return { - owner: "", - connectionId: "", - msg: undefined - }; -} -export const MsgSubmitTx = { - typeUrl: "/regen.intertx.v1.MsgSubmitTx", - encode(message: MsgSubmitTx, 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.msg !== undefined) { - Any.encode(message.msg, writer.uint32(26).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitTx { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMsgSubmitTx(); - 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.msg = Any.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromPartial(object: Partial): MsgSubmitTx { - const message = createBaseMsgSubmitTx(); - message.owner = object.owner ?? ""; - message.connectionId = object.connectionId ?? ""; - message.msg = object.msg !== undefined && object.msg !== null ? Any.fromPartial(object.msg) : undefined; - return message; - }, - fromAmino(object: MsgSubmitTxAmino): MsgSubmitTx { - const message = createBaseMsgSubmitTx(); - if (object.owner !== undefined && object.owner !== null) { - message.owner = object.owner; - } - if (object.connection_id !== undefined && object.connection_id !== null) { - message.connectionId = object.connection_id; - } - if (object.msg !== undefined && object.msg !== null) { - message.msg = Any.fromAmino(object.msg); - } - return message; - }, - toAmino(message: MsgSubmitTx): MsgSubmitTxAmino { - const obj: any = {}; - obj.owner = message.owner === "" ? undefined : message.owner; - obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; - obj.msg = message.msg ? Any.toAmino(message.msg) : undefined; - return obj; - }, - fromAminoMsg(object: MsgSubmitTxAminoMsg): MsgSubmitTx { - return MsgSubmitTx.fromAmino(object.value); - }, - fromProtoMsg(message: MsgSubmitTxProtoMsg): MsgSubmitTx { - return MsgSubmitTx.decode(message.value); - }, - toProto(message: MsgSubmitTx): Uint8Array { - return MsgSubmitTx.encode(message).finish(); - }, - toProtoMsg(message: MsgSubmitTx): MsgSubmitTxProtoMsg { - return { - typeUrl: "/regen.intertx.v1.MsgSubmitTx", - value: MsgSubmitTx.encode(message).finish() - }; - } -}; -function createBaseMsgSubmitTxResponse(): MsgSubmitTxResponse { - return {}; -} -export const MsgSubmitTxResponse = { - typeUrl: "/regen.intertx.v1.MsgSubmitTxResponse", - encode(_: MsgSubmitTxResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitTxResponse { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMsgSubmitTxResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromPartial(_: Partial): MsgSubmitTxResponse { - const message = createBaseMsgSubmitTxResponse(); - return message; - }, - fromAmino(_: MsgSubmitTxResponseAmino): MsgSubmitTxResponse { - const message = createBaseMsgSubmitTxResponse(); - return message; - }, - toAmino(_: MsgSubmitTxResponse): MsgSubmitTxResponseAmino { - const obj: any = {}; - return obj; - }, - fromAminoMsg(object: MsgSubmitTxResponseAminoMsg): MsgSubmitTxResponse { - return MsgSubmitTxResponse.fromAmino(object.value); - }, - fromProtoMsg(message: MsgSubmitTxResponseProtoMsg): MsgSubmitTxResponse { - return MsgSubmitTxResponse.decode(message.value); - }, - toProto(message: MsgSubmitTxResponse): Uint8Array { - return MsgSubmitTxResponse.encode(message).finish(); - }, - toProtoMsg(message: MsgSubmitTxResponse): MsgSubmitTxResponseProtoMsg { - return { - typeUrl: "/regen.intertx.v1.MsgSubmitTxResponse", - value: MsgSubmitTxResponse.encode(message).finish() - }; - } -}; \ No newline at end of file diff --git a/packages/api/src/regen/lcd.ts b/packages/api/src/regen/lcd.ts index 2ca518b2..f6ce4c8f 100644 --- a/packages/api/src/regen/lcd.ts +++ b/packages/api/src/regen/lcd.ts @@ -32,11 +32,26 @@ export const createLCDClient = async ({ }) } }, + circuit: { + v1: new (await import("../cosmos/circuit/v1/query.lcd")).LCDQueryClient({ + requestClient + }) + }, + consensus: { + v1: new (await import("../cosmos/consensus/v1/query.lcd")).LCDQueryClient({ + requestClient + }) + }, distribution: { v1beta1: new (await import("../cosmos/distribution/v1beta1/query.lcd")).LCDQueryClient({ requestClient }) }, + epochs: { + v1beta1: new (await import("../cosmos/epochs/v1beta1/query.lcd")).LCDQueryClient({ + requestClient + }) + }, feegrant: { v1beta1: new (await import("../cosmos/feegrant/v1beta1/query.lcd")).LCDQueryClient({ requestClient @@ -65,6 +80,11 @@ export const createLCDClient = async ({ requestClient }) }, + protocolpool: { + v1: new (await import("../cosmos/protocolpool/v1/query.lcd")).LCDQueryClient({ + requestClient + }) + }, staking: { v1beta1: new (await import("../cosmos/staking/v1beta1/query.lcd")).LCDQueryClient({ requestClient @@ -107,11 +127,6 @@ export const createLCDClient = async ({ v1alpha1: new (await import("./ecocredit/v1alpha1/query.lcd")).LCDQueryClient({ requestClient }) - }, - intertx: { - v1: new (await import("./intertx/v1/query.lcd")).LCDQueryClient({ - requestClient - }) } } }; diff --git a/packages/api/src/cosmos/orm/module/v1alpha1/module.ts b/packages/api/src/regen/orm/module/v1alpha1/module.ts similarity index 87% rename from packages/api/src/cosmos/orm/module/v1alpha1/module.ts rename to packages/api/src/regen/orm/module/v1alpha1/module.ts index 53ab3170..89c1bd94 100644 --- a/packages/api/src/cosmos/orm/module/v1alpha1/module.ts +++ b/packages/api/src/regen/orm/module/v1alpha1/module.ts @@ -7,7 +7,7 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; */ export interface Module {} export interface ModuleProtoMsg { - typeUrl: "/cosmos.orm.module.v1alpha1.Module"; + typeUrl: "/regen.orm.module.v1alpha1.Module"; value: Uint8Array; } /** @@ -17,7 +17,7 @@ export interface ModuleProtoMsg { */ export interface ModuleAmino {} export interface ModuleAminoMsg { - type: "cosmos-sdk/Module"; + type: "/regen.orm.module.v1alpha1.Module"; value: ModuleAmino; } /** @@ -30,7 +30,7 @@ function createBaseModule(): Module { return {}; } export const Module = { - typeUrl: "/cosmos.orm.module.v1alpha1.Module", + typeUrl: "/regen.orm.module.v1alpha1.Module", encode(_: Module, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -63,12 +63,6 @@ export const Module = { fromAminoMsg(object: ModuleAminoMsg): Module { return Module.fromAmino(object.value); }, - toAminoMsg(message: Module): ModuleAminoMsg { - return { - type: "cosmos-sdk/Module", - value: Module.toAmino(message) - }; - }, fromProtoMsg(message: ModuleProtoMsg): Module { return Module.decode(message.value); }, @@ -77,7 +71,7 @@ export const Module = { }, toProtoMsg(message: Module): ModuleProtoMsg { return { - typeUrl: "/cosmos.orm.module.v1alpha1.Module", + typeUrl: "/regen.orm.module.v1alpha1.Module", value: Module.encode(message).finish() }; } diff --git a/packages/api/src/cosmos/orm/v1/orm.ts b/packages/api/src/regen/orm/v1/orm.ts similarity index 92% rename from packages/api/src/cosmos/orm/v1/orm.ts rename to packages/api/src/regen/orm/v1/orm.ts index 3a12a955..f85f34c3 100644 --- a/packages/api/src/cosmos/orm/v1/orm.ts +++ b/packages/api/src/regen/orm/v1/orm.ts @@ -14,7 +14,7 @@ export interface TableDescriptor { id: number; } export interface TableDescriptorProtoMsg { - typeUrl: "/cosmos.orm.v1.TableDescriptor"; + typeUrl: "/regen.orm.v1.TableDescriptor"; value: Uint8Array; } /** TableDescriptor describes an ORM table. */ @@ -31,7 +31,7 @@ export interface TableDescriptorAmino { id?: number; } export interface TableDescriptorAminoMsg { - type: "cosmos-sdk/TableDescriptor"; + type: "/regen.orm.v1.TableDescriptor"; value: TableDescriptorAmino; } /** TableDescriptor describes an ORM table. */ @@ -83,7 +83,7 @@ export interface PrimaryKeyDescriptor { autoIncrement: boolean; } export interface PrimaryKeyDescriptorProtoMsg { - typeUrl: "/cosmos.orm.v1.PrimaryKeyDescriptor"; + typeUrl: "/regen.orm.v1.PrimaryKeyDescriptor"; value: Uint8Array; } /** PrimaryKeyDescriptor describes a table primary key. */ @@ -129,7 +129,7 @@ export interface PrimaryKeyDescriptorAmino { auto_increment?: boolean; } export interface PrimaryKeyDescriptorAminoMsg { - type: "cosmos-sdk/PrimaryKeyDescriptor"; + type: "/regen.orm.v1.PrimaryKeyDescriptor"; value: PrimaryKeyDescriptorAmino; } /** PrimaryKeyDescriptor describes a table primary key. */ @@ -145,7 +145,7 @@ export interface SecondaryIndexDescriptor { * Index keys are prefixed by the varint encoded table id and the varint * encoded index id plus any additional prefix specified by the schema. * - * In addition the field segments, non-unique index keys are suffixed with + * In addition the the field segments, non-unique index keys are suffixed with * any additional primary key fields not present in the index fields so that the * primary key can be reconstructed. Unique indexes instead of being suffixed * store the remaining primary key fields in the value.. @@ -161,7 +161,7 @@ export interface SecondaryIndexDescriptor { unique: boolean; } export interface SecondaryIndexDescriptorProtoMsg { - typeUrl: "/cosmos.orm.v1.SecondaryIndexDescriptor"; + typeUrl: "/regen.orm.v1.SecondaryIndexDescriptor"; value: Uint8Array; } /** PrimaryKeyDescriptor describes a table secondary index. */ @@ -172,7 +172,7 @@ export interface SecondaryIndexDescriptorAmino { * Index keys are prefixed by the varint encoded table id and the varint * encoded index id plus any additional prefix specified by the schema. * - * In addition the field segments, non-unique index keys are suffixed with + * In addition the the field segments, non-unique index keys are suffixed with * any additional primary key fields not present in the index fields so that the * primary key can be reconstructed. Unique indexes instead of being suffixed * store the remaining primary key fields in the value.. @@ -188,7 +188,7 @@ export interface SecondaryIndexDescriptorAmino { unique?: boolean; } export interface SecondaryIndexDescriptorAminoMsg { - type: "cosmos-sdk/SecondaryIndexDescriptor"; + type: "/regen.orm.v1.SecondaryIndexDescriptor"; value: SecondaryIndexDescriptorAmino; } /** PrimaryKeyDescriptor describes a table secondary index. */ @@ -207,7 +207,7 @@ export interface SingletonDescriptor { id: number; } export interface SingletonDescriptorProtoMsg { - typeUrl: "/cosmos.orm.v1.SingletonDescriptor"; + typeUrl: "/regen.orm.v1.SingletonDescriptor"; value: Uint8Array; } /** TableDescriptor describes an ORM singleton table which has at most one instance. */ @@ -220,7 +220,7 @@ export interface SingletonDescriptorAmino { id?: number; } export interface SingletonDescriptorAminoMsg { - type: "cosmos-sdk/SingletonDescriptor"; + type: "/regen.orm.v1.SingletonDescriptor"; value: SingletonDescriptorAmino; } /** TableDescriptor describes an ORM singleton table which has at most one instance. */ @@ -235,7 +235,7 @@ function createBaseTableDescriptor(): TableDescriptor { }; } export const TableDescriptor = { - typeUrl: "/cosmos.orm.v1.TableDescriptor", + typeUrl: "/regen.orm.v1.TableDescriptor", encode(message: TableDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.primaryKey !== undefined) { PrimaryKeyDescriptor.encode(message.primaryKey, writer.uint32(10).fork()).ldelim(); @@ -303,12 +303,6 @@ export const TableDescriptor = { fromAminoMsg(object: TableDescriptorAminoMsg): TableDescriptor { return TableDescriptor.fromAmino(object.value); }, - toAminoMsg(message: TableDescriptor): TableDescriptorAminoMsg { - return { - type: "cosmos-sdk/TableDescriptor", - value: TableDescriptor.toAmino(message) - }; - }, fromProtoMsg(message: TableDescriptorProtoMsg): TableDescriptor { return TableDescriptor.decode(message.value); }, @@ -317,7 +311,7 @@ export const TableDescriptor = { }, toProtoMsg(message: TableDescriptor): TableDescriptorProtoMsg { return { - typeUrl: "/cosmos.orm.v1.TableDescriptor", + typeUrl: "/regen.orm.v1.TableDescriptor", value: TableDescriptor.encode(message).finish() }; } @@ -329,7 +323,7 @@ function createBasePrimaryKeyDescriptor(): PrimaryKeyDescriptor { }; } export const PrimaryKeyDescriptor = { - typeUrl: "/cosmos.orm.v1.PrimaryKeyDescriptor", + typeUrl: "/regen.orm.v1.PrimaryKeyDescriptor", encode(message: PrimaryKeyDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.fields !== "") { writer.uint32(10).string(message.fields); @@ -384,12 +378,6 @@ export const PrimaryKeyDescriptor = { fromAminoMsg(object: PrimaryKeyDescriptorAminoMsg): PrimaryKeyDescriptor { return PrimaryKeyDescriptor.fromAmino(object.value); }, - toAminoMsg(message: PrimaryKeyDescriptor): PrimaryKeyDescriptorAminoMsg { - return { - type: "cosmos-sdk/PrimaryKeyDescriptor", - value: PrimaryKeyDescriptor.toAmino(message) - }; - }, fromProtoMsg(message: PrimaryKeyDescriptorProtoMsg): PrimaryKeyDescriptor { return PrimaryKeyDescriptor.decode(message.value); }, @@ -398,7 +386,7 @@ export const PrimaryKeyDescriptor = { }, toProtoMsg(message: PrimaryKeyDescriptor): PrimaryKeyDescriptorProtoMsg { return { - typeUrl: "/cosmos.orm.v1.PrimaryKeyDescriptor", + typeUrl: "/regen.orm.v1.PrimaryKeyDescriptor", value: PrimaryKeyDescriptor.encode(message).finish() }; } @@ -411,7 +399,7 @@ function createBaseSecondaryIndexDescriptor(): SecondaryIndexDescriptor { }; } export const SecondaryIndexDescriptor = { - typeUrl: "/cosmos.orm.v1.SecondaryIndexDescriptor", + typeUrl: "/regen.orm.v1.SecondaryIndexDescriptor", encode(message: SecondaryIndexDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.fields !== "") { writer.uint32(10).string(message.fields); @@ -477,12 +465,6 @@ export const SecondaryIndexDescriptor = { fromAminoMsg(object: SecondaryIndexDescriptorAminoMsg): SecondaryIndexDescriptor { return SecondaryIndexDescriptor.fromAmino(object.value); }, - toAminoMsg(message: SecondaryIndexDescriptor): SecondaryIndexDescriptorAminoMsg { - return { - type: "cosmos-sdk/SecondaryIndexDescriptor", - value: SecondaryIndexDescriptor.toAmino(message) - }; - }, fromProtoMsg(message: SecondaryIndexDescriptorProtoMsg): SecondaryIndexDescriptor { return SecondaryIndexDescriptor.decode(message.value); }, @@ -491,7 +473,7 @@ export const SecondaryIndexDescriptor = { }, toProtoMsg(message: SecondaryIndexDescriptor): SecondaryIndexDescriptorProtoMsg { return { - typeUrl: "/cosmos.orm.v1.SecondaryIndexDescriptor", + typeUrl: "/regen.orm.v1.SecondaryIndexDescriptor", value: SecondaryIndexDescriptor.encode(message).finish() }; } @@ -502,7 +484,7 @@ function createBaseSingletonDescriptor(): SingletonDescriptor { }; } export const SingletonDescriptor = { - typeUrl: "/cosmos.orm.v1.SingletonDescriptor", + typeUrl: "/regen.orm.v1.SingletonDescriptor", encode(message: SingletonDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.id !== 0) { writer.uint32(8).uint32(message.id); @@ -546,12 +528,6 @@ export const SingletonDescriptor = { fromAminoMsg(object: SingletonDescriptorAminoMsg): SingletonDescriptor { return SingletonDescriptor.fromAmino(object.value); }, - toAminoMsg(message: SingletonDescriptor): SingletonDescriptorAminoMsg { - return { - type: "cosmos-sdk/SingletonDescriptor", - value: SingletonDescriptor.toAmino(message) - }; - }, fromProtoMsg(message: SingletonDescriptorProtoMsg): SingletonDescriptor { return SingletonDescriptor.decode(message.value); }, @@ -560,7 +536,7 @@ export const SingletonDescriptor = { }, toProtoMsg(message: SingletonDescriptor): SingletonDescriptorProtoMsg { return { - typeUrl: "/cosmos.orm.v1.SingletonDescriptor", + typeUrl: "/regen.orm.v1.SingletonDescriptor", value: SingletonDescriptor.encode(message).finish() }; } diff --git a/packages/api/src/regen/orm/v1alpha1/schema.ts b/packages/api/src/regen/orm/v1alpha1/schema.ts new file mode 100644 index 00000000..069d27ec --- /dev/null +++ b/packages/api/src/regen/orm/v1alpha1/schema.ts @@ -0,0 +1,339 @@ +//@ts-nocheck +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { bytesFromBase64, base64FromBytes } from "../../../helpers"; +/** StorageType */ +export enum StorageType { + /** + * STORAGE_TYPE_DEFAULT_UNSPECIFIED - STORAGE_TYPE_DEFAULT_UNSPECIFIED indicates the persistent + * KV-storage where primary key entries are stored in merkle-tree + * backed commitment storage and indexes and seqs are stored in + * fast index storage. Note that the Cosmos SDK before store/v2alpha1 + * does not support this. + */ + STORAGE_TYPE_DEFAULT_UNSPECIFIED = 0, + /** + * STORAGE_TYPE_MEMORY - STORAGE_TYPE_MEMORY indicates in-memory storage that will be + * reloaded every time an app restarts. Tables with this type of storage + * will by default be ignored when importing and exporting a module's + * state from JSON. + */ + STORAGE_TYPE_MEMORY = 1, + /** + * STORAGE_TYPE_TRANSIENT - STORAGE_TYPE_TRANSIENT indicates transient storage that is reset + * at the end of every block. Tables with this type of storage + * will by default be ignored when importing and exporting a module's + * state from JSON. + */ + STORAGE_TYPE_TRANSIENT = 2, + /** + * STORAGE_TYPE_INDEX - STORAGE_TYPE_INDEX indicates persistent storage which is not backed + * by a merkle-tree and won't affect the app hash. Note that the Cosmos SDK + * before store/v2alpha1 does not support this. + */ + STORAGE_TYPE_INDEX = 3, + /** + * STORAGE_TYPE_COMMITMENT - STORAGE_TYPE_INDEX indicates persistent storage which is backed by + * a merkle-tree. With this type of storage, both primary and index keys + * will affect the app hash and this is generally less efficient + * than using STORAGE_TYPE_DEFAULT_UNSPECIFIED which separates index + * keys into index storage. Note that modules built with the + * Cosmos SDK before store/v2alpha1 must specify STORAGE_TYPE_COMMITMENT + * instead of STORAGE_TYPE_DEFAULT_UNSPECIFIED or STORAGE_TYPE_INDEX + * because this is the only type of persistent storage available. + */ + STORAGE_TYPE_COMMITMENT = 4, + UNRECOGNIZED = -1, +} +export const StorageTypeSDKType = StorageType; +export const StorageTypeAmino = StorageType; +export function storageTypeFromJSON(object: any): StorageType { + switch (object) { + case 0: + case "STORAGE_TYPE_DEFAULT_UNSPECIFIED": + return StorageType.STORAGE_TYPE_DEFAULT_UNSPECIFIED; + case 1: + case "STORAGE_TYPE_MEMORY": + return StorageType.STORAGE_TYPE_MEMORY; + case 2: + case "STORAGE_TYPE_TRANSIENT": + return StorageType.STORAGE_TYPE_TRANSIENT; + case 3: + case "STORAGE_TYPE_INDEX": + return StorageType.STORAGE_TYPE_INDEX; + case 4: + case "STORAGE_TYPE_COMMITMENT": + return StorageType.STORAGE_TYPE_COMMITMENT; + case -1: + case "UNRECOGNIZED": + default: + return StorageType.UNRECOGNIZED; + } +} +export function storageTypeToJSON(object: StorageType): string { + switch (object) { + case StorageType.STORAGE_TYPE_DEFAULT_UNSPECIFIED: + return "STORAGE_TYPE_DEFAULT_UNSPECIFIED"; + case StorageType.STORAGE_TYPE_MEMORY: + return "STORAGE_TYPE_MEMORY"; + case StorageType.STORAGE_TYPE_TRANSIENT: + return "STORAGE_TYPE_TRANSIENT"; + case StorageType.STORAGE_TYPE_INDEX: + return "STORAGE_TYPE_INDEX"; + case StorageType.STORAGE_TYPE_COMMITMENT: + return "STORAGE_TYPE_COMMITMENT"; + case StorageType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** ModuleSchemaDescriptor describe's a module's ORM schema. */ +export interface ModuleSchemaDescriptor { + /** schema_file */ + schemaFile: ModuleSchemaDescriptor_FileEntry[]; + /** + * prefix is an optional prefix that precedes all keys in this module's + * store. + */ + prefix: Uint8Array; +} +export interface ModuleSchemaDescriptorProtoMsg { + typeUrl: "/regen.orm.v1alpha1.ModuleSchemaDescriptor"; + value: Uint8Array; +} +/** ModuleSchemaDescriptor describe's a module's ORM schema. */ +export interface ModuleSchemaDescriptorAmino { + /** schema_file */ + schema_file?: ModuleSchemaDescriptor_FileEntryAmino[]; + /** + * prefix is an optional prefix that precedes all keys in this module's + * store. + */ + prefix?: string; +} +export interface ModuleSchemaDescriptorAminoMsg { + type: "/regen.orm.v1alpha1.ModuleSchemaDescriptor"; + value: ModuleSchemaDescriptorAmino; +} +/** ModuleSchemaDescriptor describe's a module's ORM schema. */ +export interface ModuleSchemaDescriptorSDKType { + schema_file: ModuleSchemaDescriptor_FileEntrySDKType[]; + prefix: Uint8Array; +} +/** FileEntry describes an ORM file used in a module. */ +export interface ModuleSchemaDescriptor_FileEntry { + /** + * id is a prefix that will be varint encoded and prepended to all the + * table keys specified in the file's tables. + */ + id: number; + /** + * proto_file_name is the name of a file .proto in that contains + * table definitions. The .proto file must be in a package that the + * module has referenced using cosmos.app.v1.ModuleDescriptor.use_package. + */ + protoFileName: string; + /** + * storage_type optionally indicates the type of storage this file's + * tables should used. If it is left unspecified, the default KV-storage + * of the app will be used. + */ + storageType: StorageType; +} +export interface ModuleSchemaDescriptor_FileEntryProtoMsg { + typeUrl: "/regen.orm.v1alpha1.FileEntry"; + value: Uint8Array; +} +/** FileEntry describes an ORM file used in a module. */ +export interface ModuleSchemaDescriptor_FileEntryAmino { + /** + * id is a prefix that will be varint encoded and prepended to all the + * table keys specified in the file's tables. + */ + id?: number; + /** + * proto_file_name is the name of a file .proto in that contains + * table definitions. The .proto file must be in a package that the + * module has referenced using cosmos.app.v1.ModuleDescriptor.use_package. + */ + proto_file_name?: string; + /** + * storage_type optionally indicates the type of storage this file's + * tables should used. If it is left unspecified, the default KV-storage + * of the app will be used. + */ + storage_type?: StorageType; +} +export interface ModuleSchemaDescriptor_FileEntryAminoMsg { + type: "/regen.orm.v1alpha1.FileEntry"; + value: ModuleSchemaDescriptor_FileEntryAmino; +} +/** FileEntry describes an ORM file used in a module. */ +export interface ModuleSchemaDescriptor_FileEntrySDKType { + id: number; + proto_file_name: string; + storage_type: StorageType; +} +function createBaseModuleSchemaDescriptor(): ModuleSchemaDescriptor { + return { + schemaFile: [], + prefix: new Uint8Array() + }; +} +export const ModuleSchemaDescriptor = { + typeUrl: "/regen.orm.v1alpha1.ModuleSchemaDescriptor", + encode(message: ModuleSchemaDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.schemaFile) { + ModuleSchemaDescriptor_FileEntry.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.prefix.length !== 0) { + writer.uint32(18).bytes(message.prefix); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ModuleSchemaDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModuleSchemaDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.schemaFile.push(ModuleSchemaDescriptor_FileEntry.decode(reader, reader.uint32())); + break; + case 2: + message.prefix = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): ModuleSchemaDescriptor { + const message = createBaseModuleSchemaDescriptor(); + message.schemaFile = object.schemaFile?.map(e => ModuleSchemaDescriptor_FileEntry.fromPartial(e)) || []; + message.prefix = object.prefix ?? new Uint8Array(); + return message; + }, + fromAmino(object: ModuleSchemaDescriptorAmino): ModuleSchemaDescriptor { + const message = createBaseModuleSchemaDescriptor(); + message.schemaFile = object.schema_file?.map(e => ModuleSchemaDescriptor_FileEntry.fromAmino(e)) || []; + if (object.prefix !== undefined && object.prefix !== null) { + message.prefix = bytesFromBase64(object.prefix); + } + return message; + }, + toAmino(message: ModuleSchemaDescriptor): ModuleSchemaDescriptorAmino { + const obj: any = {}; + if (message.schemaFile) { + obj.schema_file = message.schemaFile.map(e => e ? ModuleSchemaDescriptor_FileEntry.toAmino(e) : undefined); + } else { + obj.schema_file = message.schemaFile; + } + obj.prefix = message.prefix ? base64FromBytes(message.prefix) : undefined; + return obj; + }, + fromAminoMsg(object: ModuleSchemaDescriptorAminoMsg): ModuleSchemaDescriptor { + return ModuleSchemaDescriptor.fromAmino(object.value); + }, + fromProtoMsg(message: ModuleSchemaDescriptorProtoMsg): ModuleSchemaDescriptor { + return ModuleSchemaDescriptor.decode(message.value); + }, + toProto(message: ModuleSchemaDescriptor): Uint8Array { + return ModuleSchemaDescriptor.encode(message).finish(); + }, + toProtoMsg(message: ModuleSchemaDescriptor): ModuleSchemaDescriptorProtoMsg { + return { + typeUrl: "/regen.orm.v1alpha1.ModuleSchemaDescriptor", + value: ModuleSchemaDescriptor.encode(message).finish() + }; + } +}; +function createBaseModuleSchemaDescriptor_FileEntry(): ModuleSchemaDescriptor_FileEntry { + return { + id: 0, + protoFileName: "", + storageType: 0 + }; +} +export const ModuleSchemaDescriptor_FileEntry = { + typeUrl: "/regen.orm.v1alpha1.FileEntry", + encode(message: ModuleSchemaDescriptor_FileEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.id !== 0) { + writer.uint32(8).uint32(message.id); + } + if (message.protoFileName !== "") { + writer.uint32(18).string(message.protoFileName); + } + if (message.storageType !== 0) { + writer.uint32(24).int32(message.storageType); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ModuleSchemaDescriptor_FileEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModuleSchemaDescriptor_FileEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.uint32(); + break; + case 2: + message.protoFileName = reader.string(); + break; + case 3: + message.storageType = (reader.int32() as any); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): ModuleSchemaDescriptor_FileEntry { + const message = createBaseModuleSchemaDescriptor_FileEntry(); + message.id = object.id ?? 0; + message.protoFileName = object.protoFileName ?? ""; + message.storageType = object.storageType ?? 0; + return message; + }, + fromAmino(object: ModuleSchemaDescriptor_FileEntryAmino): ModuleSchemaDescriptor_FileEntry { + const message = createBaseModuleSchemaDescriptor_FileEntry(); + if (object.id !== undefined && object.id !== null) { + message.id = object.id; + } + if (object.proto_file_name !== undefined && object.proto_file_name !== null) { + message.protoFileName = object.proto_file_name; + } + if (object.storage_type !== undefined && object.storage_type !== null) { + message.storageType = object.storage_type; + } + return message; + }, + toAmino(message: ModuleSchemaDescriptor_FileEntry): ModuleSchemaDescriptor_FileEntryAmino { + const obj: any = {}; + obj.id = message.id === 0 ? undefined : message.id; + obj.proto_file_name = message.protoFileName === "" ? undefined : message.protoFileName; + obj.storage_type = message.storageType === 0 ? undefined : message.storageType; + return obj; + }, + fromAminoMsg(object: ModuleSchemaDescriptor_FileEntryAminoMsg): ModuleSchemaDescriptor_FileEntry { + return ModuleSchemaDescriptor_FileEntry.fromAmino(object.value); + }, + fromProtoMsg(message: ModuleSchemaDescriptor_FileEntryProtoMsg): ModuleSchemaDescriptor_FileEntry { + return ModuleSchemaDescriptor_FileEntry.decode(message.value); + }, + toProto(message: ModuleSchemaDescriptor_FileEntry): Uint8Array { + return ModuleSchemaDescriptor_FileEntry.encode(message).finish(); + }, + toProtoMsg(message: ModuleSchemaDescriptor_FileEntry): ModuleSchemaDescriptor_FileEntryProtoMsg { + return { + typeUrl: "/regen.orm.v1alpha1.FileEntry", + value: ModuleSchemaDescriptor_FileEntry.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/packages/api/src/regen/rpc.query.ts b/packages/api/src/regen/rpc.query.ts index c168b982..5ad1b439 100644 --- a/packages/api/src/regen/rpc.query.ts +++ b/packages/api/src/regen/rpc.query.ts @@ -24,9 +24,21 @@ export const createRPCQueryClient = async ({ v1beta1: (await import("../cosmos/base/node/v1beta1/query.rpc.Service")).createRpcQueryExtension(client) } }, + circuit: { + v1: (await import("../cosmos/circuit/v1/query.rpc.Query")).createRpcQueryExtension(client) + }, + consensus: { + v1: (await import("../cosmos/consensus/v1/query.rpc.Query")).createRpcQueryExtension(client) + }, + counter: { + v1: (await import("../cosmos/counter/v1/query.rpc.Query")).createRpcQueryExtension(client) + }, distribution: { v1beta1: (await import("../cosmos/distribution/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, + epochs: { + v1beta1: (await import("../cosmos/epochs/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + }, feegrant: { v1beta1: (await import("../cosmos/feegrant/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, @@ -43,6 +55,9 @@ export const createRPCQueryClient = async ({ params: { v1beta1: (await import("../cosmos/params/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, + protocolpool: { + v1: (await import("../cosmos/protocolpool/v1/query.rpc.Query")).createRpcQueryExtension(client) + }, staking: { v1beta1: (await import("../cosmos/staking/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) }, @@ -67,9 +82,6 @@ export const createRPCQueryClient = async ({ }, v1: (await import("./ecocredit/v1/query.rpc.Query")).createRpcQueryExtension(client), v1alpha1: (await import("./ecocredit/v1alpha1/query.rpc.Query")).createRpcQueryExtension(client) - }, - intertx: { - v1: (await import("./intertx/v1/query.rpc.Query")).createRpcQueryExtension(client) } } }; diff --git a/packages/api/src/regen/rpc.tx.ts b/packages/api/src/regen/rpc.tx.ts index 27b70c75..78b6fa65 100644 --- a/packages/api/src/regen/rpc.tx.ts +++ b/packages/api/src/regen/rpc.tx.ts @@ -6,12 +6,27 @@ export const createRPCMsgClient = async ({ rpc: Rpc; }) => ({ cosmos: { + auth: { + v1beta1: new (await import("../cosmos/auth/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + }, authz: { v1beta1: new (await import("../cosmos/authz/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, bank: { v1beta1: new (await import("../cosmos/bank/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, + benchmark: { + v1: new (await import("../cosmos/benchmark/v1/tx.rpc.msg")).MsgClientImpl(rpc) + }, + circuit: { + v1: new (await import("../cosmos/circuit/v1/tx.rpc.msg")).MsgClientImpl(rpc) + }, + consensus: { + v1: new (await import("../cosmos/consensus/v1/tx.rpc.msg")).MsgClientImpl(rpc) + }, + counter: { + v1: new (await import("../cosmos/counter/v1/tx.rpc.msg")).MsgClientImpl(rpc) + }, distribution: { v1beta1: new (await import("../cosmos/distribution/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, @@ -25,6 +40,12 @@ export const createRPCMsgClient = async ({ group: { v1: new (await import("../cosmos/group/v1/tx.rpc.msg")).MsgClientImpl(rpc) }, + mint: { + v1beta1: new (await import("../cosmos/mint/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + }, + protocolpool: { + v1: new (await import("../cosmos/protocolpool/v1/tx.rpc.msg")).MsgClientImpl(rpc) + }, staking: { v1beta1: new (await import("../cosmos/staking/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) }, @@ -49,9 +70,6 @@ export const createRPCMsgClient = async ({ }, v1: new (await import("./ecocredit/v1/tx.rpc.msg")).MsgClientImpl(rpc), v1alpha1: new (await import("./ecocredit/v1alpha1/tx.rpc.msg")).MsgClientImpl(rpc) - }, - intertx: { - v1: new (await import("./intertx/v1/tx.rpc.msg")).MsgClientImpl(rpc) } } }); \ No newline at end of file diff --git a/packages/api/src/tendermint/abci/types.ts b/packages/api/src/tendermint/abci/types.ts index 19311d03..1facf58c 100644 --- a/packages/api/src/tendermint/abci/types.ts +++ b/packages/api/src/tendermint/abci/types.ts @@ -1,9 +1,9 @@ //@ts-nocheck import { Timestamp } from "../../google/protobuf/timestamp"; import { ConsensusParams, ConsensusParamsAmino, ConsensusParamsSDKType } from "../types/params"; -import { Header, HeaderAmino, HeaderSDKType } from "../types/types"; import { ProofOps, ProofOpsAmino, ProofOpsSDKType } from "../crypto/proof"; import { PublicKey, PublicKeyAmino, PublicKeySDKType } from "../crypto/keys"; +import { BlockIDFlag } from "../types/validator"; import { BinaryReader, BinaryWriter } from "../../binary"; import { toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../helpers"; export enum CheckTxType { @@ -200,6 +200,50 @@ export function responseProcessProposal_ProposalStatusToJSON(object: ResponsePro return "UNRECOGNIZED"; } } +export enum ResponseVerifyVoteExtension_VerifyStatus { + UNKNOWN = 0, + ACCEPT = 1, + /** + * REJECT - Rejecting the vote extension will reject the entire precommit by the sender. + * Incorrectly implementing this thus has liveness implications as it may affect + * CometBFT's ability to receive 2/3+ valid votes to finalize the block. + * Honest nodes should never be rejected. + */ + REJECT = 2, + UNRECOGNIZED = -1, +} +export const ResponseVerifyVoteExtension_VerifyStatusSDKType = ResponseVerifyVoteExtension_VerifyStatus; +export const ResponseVerifyVoteExtension_VerifyStatusAmino = ResponseVerifyVoteExtension_VerifyStatus; +export function responseVerifyVoteExtension_VerifyStatusFromJSON(object: any): ResponseVerifyVoteExtension_VerifyStatus { + switch (object) { + case 0: + case "UNKNOWN": + return ResponseVerifyVoteExtension_VerifyStatus.UNKNOWN; + case 1: + case "ACCEPT": + return ResponseVerifyVoteExtension_VerifyStatus.ACCEPT; + case 2: + case "REJECT": + return ResponseVerifyVoteExtension_VerifyStatus.REJECT; + case -1: + case "UNRECOGNIZED": + default: + return ResponseVerifyVoteExtension_VerifyStatus.UNRECOGNIZED; + } +} +export function responseVerifyVoteExtension_VerifyStatusToJSON(object: ResponseVerifyVoteExtension_VerifyStatus): string { + switch (object) { + case ResponseVerifyVoteExtension_VerifyStatus.UNKNOWN: + return "UNKNOWN"; + case ResponseVerifyVoteExtension_VerifyStatus.ACCEPT: + return "ACCEPT"; + case ResponseVerifyVoteExtension_VerifyStatus.REJECT: + return "REJECT"; + case ResponseVerifyVoteExtension_VerifyStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} export enum MisbehaviorType { UNKNOWN = 0, DUPLICATE_VOTE = 1, @@ -244,10 +288,7 @@ export interface Request { info?: RequestInfo; initChain?: RequestInitChain; query?: RequestQuery; - beginBlock?: RequestBeginBlock; checkTx?: RequestCheckTx; - deliverTx?: RequestDeliverTx; - endBlock?: RequestEndBlock; commit?: RequestCommit; listSnapshots?: RequestListSnapshots; offerSnapshot?: RequestOfferSnapshot; @@ -255,6 +296,9 @@ export interface Request { applySnapshotChunk?: RequestApplySnapshotChunk; prepareProposal?: RequestPrepareProposal; processProposal?: RequestProcessProposal; + extendVote?: RequestExtendVote; + verifyVoteExtension?: RequestVerifyVoteExtension; + finalizeBlock?: RequestFinalizeBlock; } export interface RequestProtoMsg { typeUrl: "/tendermint.abci.Request"; @@ -266,10 +310,7 @@ export interface RequestAmino { info?: RequestInfoAmino; init_chain?: RequestInitChainAmino; query?: RequestQueryAmino; - begin_block?: RequestBeginBlockAmino; check_tx?: RequestCheckTxAmino; - deliver_tx?: RequestDeliverTxAmino; - end_block?: RequestEndBlockAmino; commit?: RequestCommitAmino; list_snapshots?: RequestListSnapshotsAmino; offer_snapshot?: RequestOfferSnapshotAmino; @@ -277,6 +318,9 @@ export interface RequestAmino { apply_snapshot_chunk?: RequestApplySnapshotChunkAmino; prepare_proposal?: RequestPrepareProposalAmino; process_proposal?: RequestProcessProposalAmino; + extend_vote?: RequestExtendVoteAmino; + verify_vote_extension?: RequestVerifyVoteExtensionAmino; + finalize_block?: RequestFinalizeBlockAmino; } export interface RequestAminoMsg { type: "/tendermint.abci.Request"; @@ -288,10 +332,7 @@ export interface RequestSDKType { info?: RequestInfoSDKType; init_chain?: RequestInitChainSDKType; query?: RequestQuerySDKType; - begin_block?: RequestBeginBlockSDKType; check_tx?: RequestCheckTxSDKType; - deliver_tx?: RequestDeliverTxSDKType; - end_block?: RequestEndBlockSDKType; commit?: RequestCommitSDKType; list_snapshots?: RequestListSnapshotsSDKType; offer_snapshot?: RequestOfferSnapshotSDKType; @@ -299,6 +340,9 @@ export interface RequestSDKType { apply_snapshot_chunk?: RequestApplySnapshotChunkSDKType; prepare_proposal?: RequestPrepareProposalSDKType; process_proposal?: RequestProcessProposalSDKType; + extend_vote?: RequestExtendVoteSDKType; + verify_vote_extension?: RequestVerifyVoteExtensionSDKType; + finalize_block?: RequestFinalizeBlockSDKType; } export interface RequestEcho { message: string; @@ -412,32 +456,6 @@ export interface RequestQuerySDKType { height: bigint; prove: boolean; } -export interface RequestBeginBlock { - hash: Uint8Array; - header: Header; - lastCommitInfo: CommitInfo; - byzantineValidators: Misbehavior[]; -} -export interface RequestBeginBlockProtoMsg { - typeUrl: "/tendermint.abci.RequestBeginBlock"; - value: Uint8Array; -} -export interface RequestBeginBlockAmino { - hash?: string; - header?: HeaderAmino; - last_commit_info?: CommitInfoAmino; - byzantine_validators?: MisbehaviorAmino[]; -} -export interface RequestBeginBlockAminoMsg { - type: "/tendermint.abci.RequestBeginBlock"; - value: RequestBeginBlockAmino; -} -export interface RequestBeginBlockSDKType { - hash: Uint8Array; - header: HeaderSDKType; - last_commit_info: CommitInfoSDKType; - byzantine_validators: MisbehaviorSDKType[]; -} export interface RequestCheckTx { tx: Uint8Array; type: CheckTxType; @@ -458,40 +476,6 @@ export interface RequestCheckTxSDKType { tx: Uint8Array; type: CheckTxType; } -export interface RequestDeliverTx { - tx: Uint8Array; -} -export interface RequestDeliverTxProtoMsg { - typeUrl: "/tendermint.abci.RequestDeliverTx"; - value: Uint8Array; -} -export interface RequestDeliverTxAmino { - tx?: string; -} -export interface RequestDeliverTxAminoMsg { - type: "/tendermint.abci.RequestDeliverTx"; - value: RequestDeliverTxAmino; -} -export interface RequestDeliverTxSDKType { - tx: Uint8Array; -} -export interface RequestEndBlock { - height: bigint; -} -export interface RequestEndBlockProtoMsg { - typeUrl: "/tendermint.abci.RequestEndBlock"; - value: Uint8Array; -} -export interface RequestEndBlockAmino { - height?: string; -} -export interface RequestEndBlockAminoMsg { - type: "/tendermint.abci.RequestEndBlock"; - value: RequestEndBlockAmino; -} -export interface RequestEndBlockSDKType { - height: bigint; -} export interface RequestCommit {} export interface RequestCommitProtoMsg { typeUrl: "/tendermint.abci.RequestCommit"; @@ -688,6 +672,130 @@ export interface RequestProcessProposalSDKType { next_validators_hash: Uint8Array; proposer_address: Uint8Array; } +/** Extends a vote with application-injected data */ +export interface RequestExtendVote { + /** the hash of the block that this vote may be referring to */ + hash: Uint8Array; + /** the height of the extended vote */ + height: bigint; + /** info of the block that this vote may be referring to */ + time: Date; + txs: Uint8Array[]; + proposedLastCommit: CommitInfo; + misbehavior: Misbehavior[]; + nextValidatorsHash: Uint8Array; + /** address of the public key of the original proposer of the block. */ + proposerAddress: Uint8Array; +} +export interface RequestExtendVoteProtoMsg { + typeUrl: "/tendermint.abci.RequestExtendVote"; + value: Uint8Array; +} +/** Extends a vote with application-injected data */ +export interface RequestExtendVoteAmino { + /** the hash of the block that this vote may be referring to */ + hash?: string; + /** the height of the extended vote */ + height?: string; + /** info of the block that this vote may be referring to */ + time?: string; + txs?: string[]; + proposed_last_commit?: CommitInfoAmino; + misbehavior?: MisbehaviorAmino[]; + next_validators_hash?: string; + /** address of the public key of the original proposer of the block. */ + proposer_address?: string; +} +export interface RequestExtendVoteAminoMsg { + type: "/tendermint.abci.RequestExtendVote"; + value: RequestExtendVoteAmino; +} +/** Extends a vote with application-injected data */ +export interface RequestExtendVoteSDKType { + hash: Uint8Array; + height: bigint; + time: Date; + txs: Uint8Array[]; + proposed_last_commit: CommitInfoSDKType; + misbehavior: MisbehaviorSDKType[]; + next_validators_hash: Uint8Array; + proposer_address: Uint8Array; +} +/** Verify the vote extension */ +export interface RequestVerifyVoteExtension { + /** the hash of the block that this received vote corresponds to */ + hash: Uint8Array; + /** the validator that signed the vote extension */ + validatorAddress: Uint8Array; + height: bigint; + voteExtension: Uint8Array; +} +export interface RequestVerifyVoteExtensionProtoMsg { + typeUrl: "/tendermint.abci.RequestVerifyVoteExtension"; + value: Uint8Array; +} +/** Verify the vote extension */ +export interface RequestVerifyVoteExtensionAmino { + /** the hash of the block that this received vote corresponds to */ + hash?: string; + /** the validator that signed the vote extension */ + validator_address?: string; + height?: string; + vote_extension?: string; +} +export interface RequestVerifyVoteExtensionAminoMsg { + type: "/tendermint.abci.RequestVerifyVoteExtension"; + value: RequestVerifyVoteExtensionAmino; +} +/** Verify the vote extension */ +export interface RequestVerifyVoteExtensionSDKType { + hash: Uint8Array; + validator_address: Uint8Array; + height: bigint; + vote_extension: Uint8Array; +} +export interface RequestFinalizeBlock { + txs: Uint8Array[]; + decidedLastCommit: CommitInfo; + misbehavior: Misbehavior[]; + /** hash is the merkle root hash of the fields of the decided block. */ + hash: Uint8Array; + height: bigint; + time: Date; + nextValidatorsHash: Uint8Array; + /** proposer_address is the address of the public key of the original proposer of the block. */ + proposerAddress: Uint8Array; +} +export interface RequestFinalizeBlockProtoMsg { + typeUrl: "/tendermint.abci.RequestFinalizeBlock"; + value: Uint8Array; +} +export interface RequestFinalizeBlockAmino { + txs?: string[]; + decided_last_commit?: CommitInfoAmino; + misbehavior?: MisbehaviorAmino[]; + /** hash is the merkle root hash of the fields of the decided block. */ + hash?: string; + height?: string; + time?: string; + next_validators_hash?: string; + /** proposer_address is the address of the public key of the original proposer of the block. */ + proposer_address?: string; +} +export interface RequestFinalizeBlockAminoMsg { + type: "/tendermint.abci.RequestFinalizeBlock"; + value: RequestFinalizeBlockAmino; +} +export interface RequestFinalizeBlockSDKType { + txs: Uint8Array[]; + decided_last_commit: CommitInfoSDKType; + misbehavior: MisbehaviorSDKType[]; + hash: Uint8Array; + height: bigint; + time: Date; + next_validators_hash: Uint8Array; + proposer_address: Uint8Array; +} export interface Response { exception?: ResponseException; echo?: ResponseEcho; @@ -695,10 +803,7 @@ export interface Response { info?: ResponseInfo; initChain?: ResponseInitChain; query?: ResponseQuery; - beginBlock?: ResponseBeginBlock; checkTx?: ResponseCheckTx; - deliverTx?: ResponseDeliverTx; - endBlock?: ResponseEndBlock; commit?: ResponseCommit; listSnapshots?: ResponseListSnapshots; offerSnapshot?: ResponseOfferSnapshot; @@ -706,6 +811,9 @@ export interface Response { applySnapshotChunk?: ResponseApplySnapshotChunk; prepareProposal?: ResponsePrepareProposal; processProposal?: ResponseProcessProposal; + extendVote?: ResponseExtendVote; + verifyVoteExtension?: ResponseVerifyVoteExtension; + finalizeBlock?: ResponseFinalizeBlock; } export interface ResponseProtoMsg { typeUrl: "/tendermint.abci.Response"; @@ -718,10 +826,7 @@ export interface ResponseAmino { info?: ResponseInfoAmino; init_chain?: ResponseInitChainAmino; query?: ResponseQueryAmino; - begin_block?: ResponseBeginBlockAmino; check_tx?: ResponseCheckTxAmino; - deliver_tx?: ResponseDeliverTxAmino; - end_block?: ResponseEndBlockAmino; commit?: ResponseCommitAmino; list_snapshots?: ResponseListSnapshotsAmino; offer_snapshot?: ResponseOfferSnapshotAmino; @@ -729,6 +834,9 @@ export interface ResponseAmino { apply_snapshot_chunk?: ResponseApplySnapshotChunkAmino; prepare_proposal?: ResponsePrepareProposalAmino; process_proposal?: ResponseProcessProposalAmino; + extend_vote?: ResponseExtendVoteAmino; + verify_vote_extension?: ResponseVerifyVoteExtensionAmino; + finalize_block?: ResponseFinalizeBlockAmino; } export interface ResponseAminoMsg { type: "/tendermint.abci.Response"; @@ -741,10 +849,7 @@ export interface ResponseSDKType { info?: ResponseInfoSDKType; init_chain?: ResponseInitChainSDKType; query?: ResponseQuerySDKType; - begin_block?: ResponseBeginBlockSDKType; check_tx?: ResponseCheckTxSDKType; - deliver_tx?: ResponseDeliverTxSDKType; - end_block?: ResponseEndBlockSDKType; commit?: ResponseCommitSDKType; list_snapshots?: ResponseListSnapshotsSDKType; offer_snapshot?: ResponseOfferSnapshotSDKType; @@ -752,6 +857,9 @@ export interface ResponseSDKType { apply_snapshot_chunk?: ResponseApplySnapshotChunkSDKType; prepare_proposal?: ResponsePrepareProposalSDKType; process_proposal?: ResponseProcessProposalSDKType; + extend_vote?: ResponseExtendVoteSDKType; + verify_vote_extension?: ResponseVerifyVoteExtensionSDKType; + finalize_block?: ResponseFinalizeBlockSDKType; } /** nondeterministic */ export interface ResponseException { @@ -898,23 +1006,6 @@ export interface ResponseQuerySDKType { height: bigint; codespace: string; } -export interface ResponseBeginBlock { - events: Event[]; -} -export interface ResponseBeginBlockProtoMsg { - typeUrl: "/tendermint.abci.ResponseBeginBlock"; - value: Uint8Array; -} -export interface ResponseBeginBlockAmino { - events?: EventAmino[]; -} -export interface ResponseBeginBlockAminoMsg { - type: "/tendermint.abci.ResponseBeginBlock"; - value: ResponseBeginBlockAmino; -} -export interface ResponseBeginBlockSDKType { - events: EventSDKType[]; -} export interface ResponseCheckTx { code: number; data: Uint8Array; @@ -926,13 +1017,6 @@ export interface ResponseCheckTx { gasUsed: bigint; events: Event[]; codespace: string; - sender: string; - priority: bigint; - /** - * mempool_error is set by CometBFT. - * ABCI applictions creating a ResponseCheckTX should not set mempool_error. - */ - mempoolError: string; } export interface ResponseCheckTxProtoMsg { typeUrl: "/tendermint.abci.ResponseCheckTx"; @@ -949,13 +1033,6 @@ export interface ResponseCheckTxAmino { gas_used?: string; events?: EventAmino[]; codespace?: string; - sender?: string; - priority?: string; - /** - * mempool_error is set by CometBFT. - * ABCI applictions creating a ResponseCheckTX should not set mempool_error. - */ - mempool_error?: string; } export interface ResponseCheckTxAminoMsg { type: "/tendermint.abci.ResponseCheckTx"; @@ -970,78 +1047,8 @@ export interface ResponseCheckTxSDKType { gas_used: bigint; events: EventSDKType[]; codespace: string; - sender: string; - priority: bigint; - mempool_error: string; -} -export interface ResponseDeliverTx { - code: number; - data: Uint8Array; - /** nondeterministic */ - log: string; - /** nondeterministic */ - info: string; - gasWanted: bigint; - gasUsed: bigint; - events: Event[]; - codespace: string; -} -export interface ResponseDeliverTxProtoMsg { - typeUrl: "/tendermint.abci.ResponseDeliverTx"; - value: Uint8Array; -} -export interface ResponseDeliverTxAmino { - code?: number; - data?: string; - /** nondeterministic */ - log?: string; - /** nondeterministic */ - info?: string; - gas_wanted?: string; - gas_used?: string; - events?: EventAmino[]; - codespace?: string; -} -export interface ResponseDeliverTxAminoMsg { - type: "/tendermint.abci.ResponseDeliverTx"; - value: ResponseDeliverTxAmino; -} -export interface ResponseDeliverTxSDKType { - code: number; - data: Uint8Array; - log: string; - info: string; - gas_wanted: bigint; - gas_used: bigint; - events: EventSDKType[]; - codespace: string; -} -export interface ResponseEndBlock { - validatorUpdates: ValidatorUpdate[]; - consensusParamUpdates?: ConsensusParams; - events: Event[]; -} -export interface ResponseEndBlockProtoMsg { - typeUrl: "/tendermint.abci.ResponseEndBlock"; - value: Uint8Array; -} -export interface ResponseEndBlockAmino { - validator_updates?: ValidatorUpdateAmino[]; - consensus_param_updates?: ConsensusParamsAmino; - events?: EventAmino[]; -} -export interface ResponseEndBlockAminoMsg { - type: "/tendermint.abci.ResponseEndBlock"; - value: ResponseEndBlockAmino; -} -export interface ResponseEndBlockSDKType { - validator_updates: ValidatorUpdateSDKType[]; - consensus_param_updates?: ConsensusParamsSDKType; - events: EventSDKType[]; } export interface ResponseCommit { - /** reserve 1 */ - data: Uint8Array; retainHeight: bigint; } export interface ResponseCommitProtoMsg { @@ -1049,8 +1056,6 @@ export interface ResponseCommitProtoMsg { value: Uint8Array; } export interface ResponseCommitAmino { - /** reserve 1 */ - data?: string; retain_height?: string; } export interface ResponseCommitAminoMsg { @@ -1058,7 +1063,6 @@ export interface ResponseCommitAminoMsg { value: ResponseCommitAmino; } export interface ResponseCommitSDKType { - data: Uint8Array; retain_height: bigint; } export interface ResponseListSnapshots { @@ -1173,6 +1177,93 @@ export interface ResponseProcessProposalAminoMsg { export interface ResponseProcessProposalSDKType { status: ResponseProcessProposal_ProposalStatus; } +export interface ResponseExtendVote { + voteExtension: Uint8Array; +} +export interface ResponseExtendVoteProtoMsg { + typeUrl: "/tendermint.abci.ResponseExtendVote"; + value: Uint8Array; +} +export interface ResponseExtendVoteAmino { + vote_extension?: string; +} +export interface ResponseExtendVoteAminoMsg { + type: "/tendermint.abci.ResponseExtendVote"; + value: ResponseExtendVoteAmino; +} +export interface ResponseExtendVoteSDKType { + vote_extension: Uint8Array; +} +export interface ResponseVerifyVoteExtension { + status: ResponseVerifyVoteExtension_VerifyStatus; +} +export interface ResponseVerifyVoteExtensionProtoMsg { + typeUrl: "/tendermint.abci.ResponseVerifyVoteExtension"; + value: Uint8Array; +} +export interface ResponseVerifyVoteExtensionAmino { + status?: ResponseVerifyVoteExtension_VerifyStatus; +} +export interface ResponseVerifyVoteExtensionAminoMsg { + type: "/tendermint.abci.ResponseVerifyVoteExtension"; + value: ResponseVerifyVoteExtensionAmino; +} +export interface ResponseVerifyVoteExtensionSDKType { + status: ResponseVerifyVoteExtension_VerifyStatus; +} +export interface ResponseFinalizeBlock { + /** set of block events emmitted as part of executing the block */ + events: Event[]; + /** + * the result of executing each transaction including the events + * the particular transction emitted. This should match the order + * of the transactions delivered in the block itself + */ + txResults: ExecTxResult[]; + /** a list of updates to the validator set. These will reflect the validator set at current height + 2. */ + validatorUpdates: ValidatorUpdate[]; + /** updates to the consensus params, if any. */ + consensusParamUpdates?: ConsensusParams; + /** + * app_hash is the hash of the applications' state which is used to confirm that execution of the transactions was + * deterministic. It is up to the application to decide which algorithm to use. + */ + appHash: Uint8Array; +} +export interface ResponseFinalizeBlockProtoMsg { + typeUrl: "/tendermint.abci.ResponseFinalizeBlock"; + value: Uint8Array; +} +export interface ResponseFinalizeBlockAmino { + /** set of block events emmitted as part of executing the block */ + events?: EventAmino[]; + /** + * the result of executing each transaction including the events + * the particular transction emitted. This should match the order + * of the transactions delivered in the block itself + */ + tx_results?: ExecTxResultAmino[]; + /** a list of updates to the validator set. These will reflect the validator set at current height + 2. */ + validator_updates?: ValidatorUpdateAmino[]; + /** updates to the consensus params, if any. */ + consensus_param_updates?: ConsensusParamsAmino; + /** + * app_hash is the hash of the applications' state which is used to confirm that execution of the transactions was + * deterministic. It is up to the application to decide which algorithm to use. + */ + app_hash?: string; +} +export interface ResponseFinalizeBlockAminoMsg { + type: "/tendermint.abci.ResponseFinalizeBlock"; + value: ResponseFinalizeBlockAmino; +} +export interface ResponseFinalizeBlockSDKType { + events: EventSDKType[]; + tx_results: ExecTxResultSDKType[]; + validator_updates: ValidatorUpdateSDKType[]; + consensus_param_updates?: ConsensusParamsSDKType; + app_hash: Uint8Array; +} export interface CommitInfo { round: number; votes: VoteInfo[]; @@ -1193,6 +1284,11 @@ export interface CommitInfoSDKType { round: number; votes: VoteInfoSDKType[]; } +/** + * ExtendedCommitInfo is similar to CommitInfo except that it is only used in + * the PrepareProposal request such that CometBFT can provide vote extensions + * to the application. + */ export interface ExtendedCommitInfo { /** The round at which the block proposer decided in the previous height. */ round: number; @@ -1206,6 +1302,11 @@ export interface ExtendedCommitInfoProtoMsg { typeUrl: "/tendermint.abci.ExtendedCommitInfo"; value: Uint8Array; } +/** + * ExtendedCommitInfo is similar to CommitInfo except that it is only used in + * the PrepareProposal request such that CometBFT can provide vote extensions + * to the application. + */ export interface ExtendedCommitInfoAmino { /** The round at which the block proposer decided in the previous height. */ round?: number; @@ -1219,13 +1320,18 @@ export interface ExtendedCommitInfoAminoMsg { type: "/tendermint.abci.ExtendedCommitInfo"; value: ExtendedCommitInfoAmino; } +/** + * ExtendedCommitInfo is similar to CommitInfo except that it is only used in + * the PrepareProposal request such that CometBFT can provide vote extensions + * to the application. + */ export interface ExtendedCommitInfoSDKType { round: number; votes: ExtendedVoteInfoSDKType[]; } /** * Event allows application developers to attach additional information to - * ResponseBeginBlock, ResponseEndBlock, ResponseCheckTx and ResponseDeliverTx. + * ResponseFinalizeBlock and ResponseCheckTx. * Later, transactions may be queried using these events. */ export interface Event { @@ -1238,7 +1344,7 @@ export interface EventProtoMsg { } /** * Event allows application developers to attach additional information to - * ResponseBeginBlock, ResponseEndBlock, ResponseCheckTx and ResponseDeliverTx. + * ResponseFinalizeBlock and ResponseCheckTx. * Later, transactions may be queried using these events. */ export interface EventAmino { @@ -1251,7 +1357,7 @@ export interface EventAminoMsg { } /** * Event allows application developers to attach additional information to - * ResponseBeginBlock, ResponseEndBlock, ResponseCheckTx and ResponseDeliverTx. + * ResponseFinalizeBlock and ResponseCheckTx. * Later, transactions may be queried using these events. */ export interface EventSDKType { @@ -1287,22 +1393,79 @@ export interface EventAttributeSDKType { index: boolean; } /** - * TxResult contains results of executing the transaction. + * ExecTxResult contains results of executing one individual transaction. * - * One usage is indexing transaction results. + * * Its structure is equivalent to #ResponseDeliverTx which will be deprecated/deleted */ -export interface TxResult { - height: bigint; - index: number; - tx: Uint8Array; - result: ResponseDeliverTx; -} -export interface TxResultProtoMsg { - typeUrl: "/tendermint.abci.TxResult"; - value: Uint8Array; -} -/** - * TxResult contains results of executing the transaction. +export interface ExecTxResult { + code: number; + data: Uint8Array; + /** nondeterministic */ + log: string; + /** nondeterministic */ + info: string; + gasWanted: bigint; + gasUsed: bigint; + events: Event[]; + codespace: string; +} +export interface ExecTxResultProtoMsg { + typeUrl: "/tendermint.abci.ExecTxResult"; + value: Uint8Array; +} +/** + * ExecTxResult contains results of executing one individual transaction. + * + * * Its structure is equivalent to #ResponseDeliverTx which will be deprecated/deleted + */ +export interface ExecTxResultAmino { + code?: number; + data?: string; + /** nondeterministic */ + log?: string; + /** nondeterministic */ + info?: string; + gas_wanted?: string; + gas_used?: string; + events?: EventAmino[]; + codespace?: string; +} +export interface ExecTxResultAminoMsg { + type: "/tendermint.abci.ExecTxResult"; + value: ExecTxResultAmino; +} +/** + * ExecTxResult contains results of executing one individual transaction. + * + * * Its structure is equivalent to #ResponseDeliverTx which will be deprecated/deleted + */ +export interface ExecTxResultSDKType { + code: number; + data: Uint8Array; + log: string; + info: string; + gas_wanted: bigint; + gas_used: bigint; + events: EventSDKType[]; + codespace: string; +} +/** + * TxResult contains results of executing the transaction. + * + * One usage is indexing transaction results. + */ +export interface TxResult { + height: bigint; + index: number; + tx: Uint8Array; + result: ExecTxResult; +} +export interface TxResultProtoMsg { + typeUrl: "/tendermint.abci.TxResult"; + value: Uint8Array; +} +/** + * TxResult contains results of executing the transaction. * * One usage is indexing transaction results. */ @@ -1310,7 +1473,7 @@ export interface TxResultAmino { height?: string; index?: number; tx?: string; - result?: ResponseDeliverTxAmino; + result?: ExecTxResultAmino; } export interface TxResultAminoMsg { type: "/tendermint.abci.TxResult"; @@ -1325,9 +1488,8 @@ export interface TxResultSDKType { height: bigint; index: number; tx: Uint8Array; - result: ResponseDeliverTxSDKType; + result: ExecTxResultSDKType; } -/** Validator */ export interface Validator { /** The first 20 bytes of SHA256(public key) */ address: Uint8Array; @@ -1338,7 +1500,6 @@ export interface ValidatorProtoMsg { typeUrl: "/tendermint.abci.Validator"; value: Uint8Array; } -/** Validator */ export interface ValidatorAmino { /** The first 20 bytes of SHA256(public key) */ address?: string; @@ -1349,12 +1510,10 @@ export interface ValidatorAminoMsg { type: "/tendermint.abci.Validator"; value: ValidatorAmino; } -/** Validator */ export interface ValidatorSDKType { address: Uint8Array; power: bigint; } -/** ValidatorUpdate */ export interface ValidatorUpdate { pubKey: PublicKey; power: bigint; @@ -1363,7 +1522,6 @@ export interface ValidatorUpdateProtoMsg { typeUrl: "/tendermint.abci.ValidatorUpdate"; value: Uint8Array; } -/** ValidatorUpdate */ export interface ValidatorUpdateAmino { pub_key?: PublicKeyAmino; power?: string; @@ -1372,49 +1530,53 @@ export interface ValidatorUpdateAminoMsg { type: "/tendermint.abci.ValidatorUpdate"; value: ValidatorUpdateAmino; } -/** ValidatorUpdate */ export interface ValidatorUpdateSDKType { pub_key: PublicKeySDKType; power: bigint; } -/** VoteInfo */ export interface VoteInfo { validator: Validator; - signedLastBlock: boolean; + blockIdFlag: BlockIDFlag; } export interface VoteInfoProtoMsg { typeUrl: "/tendermint.abci.VoteInfo"; value: Uint8Array; } -/** VoteInfo */ export interface VoteInfoAmino { validator?: ValidatorAmino; - signed_last_block?: boolean; + block_id_flag?: BlockIDFlag; } export interface VoteInfoAminoMsg { type: "/tendermint.abci.VoteInfo"; value: VoteInfoAmino; } -/** VoteInfo */ export interface VoteInfoSDKType { validator: ValidatorSDKType; - signed_last_block: boolean; + block_id_flag: BlockIDFlag; } export interface ExtendedVoteInfo { + /** The validator that sent the vote. */ validator: Validator; - signedLastBlock: boolean; - /** Reserved for future use */ + /** Non-deterministic extension provided by the sending validator's application. */ voteExtension: Uint8Array; + /** Vote extension signature created by CometBFT */ + extensionSignature: Uint8Array; + /** block_id_flag indicates whether the validator voted for a block, nil, or did not vote at all */ + blockIdFlag: BlockIDFlag; } export interface ExtendedVoteInfoProtoMsg { typeUrl: "/tendermint.abci.ExtendedVoteInfo"; value: Uint8Array; } export interface ExtendedVoteInfoAmino { + /** The validator that sent the vote. */ validator?: ValidatorAmino; - signed_last_block?: boolean; - /** Reserved for future use */ + /** Non-deterministic extension provided by the sending validator's application. */ vote_extension?: string; + /** Vote extension signature created by CometBFT */ + extension_signature?: string; + /** block_id_flag indicates whether the validator voted for a block, nil, or did not vote at all */ + block_id_flag?: BlockIDFlag; } export interface ExtendedVoteInfoAminoMsg { type: "/tendermint.abci.ExtendedVoteInfo"; @@ -1422,8 +1584,9 @@ export interface ExtendedVoteInfoAminoMsg { } export interface ExtendedVoteInfoSDKType { validator: ValidatorSDKType; - signed_last_block: boolean; vote_extension: Uint8Array; + extension_signature: Uint8Array; + block_id_flag: BlockIDFlag; } export interface Misbehavior { type: MisbehaviorType; @@ -1516,17 +1679,17 @@ function createBaseRequest(): Request { info: undefined, initChain: undefined, query: undefined, - beginBlock: undefined, checkTx: undefined, - deliverTx: undefined, - endBlock: undefined, commit: undefined, listSnapshots: undefined, offerSnapshot: undefined, loadSnapshotChunk: undefined, applySnapshotChunk: undefined, prepareProposal: undefined, - processProposal: undefined + processProposal: undefined, + extendVote: undefined, + verifyVoteExtension: undefined, + finalizeBlock: undefined }; } export const Request = { @@ -1547,18 +1710,9 @@ export const Request = { if (message.query !== undefined) { RequestQuery.encode(message.query, writer.uint32(50).fork()).ldelim(); } - if (message.beginBlock !== undefined) { - RequestBeginBlock.encode(message.beginBlock, writer.uint32(58).fork()).ldelim(); - } if (message.checkTx !== undefined) { RequestCheckTx.encode(message.checkTx, writer.uint32(66).fork()).ldelim(); } - if (message.deliverTx !== undefined) { - RequestDeliverTx.encode(message.deliverTx, writer.uint32(74).fork()).ldelim(); - } - if (message.endBlock !== undefined) { - RequestEndBlock.encode(message.endBlock, writer.uint32(82).fork()).ldelim(); - } if (message.commit !== undefined) { RequestCommit.encode(message.commit, writer.uint32(90).fork()).ldelim(); } @@ -1580,6 +1734,15 @@ export const Request = { if (message.processProposal !== undefined) { RequestProcessProposal.encode(message.processProposal, writer.uint32(138).fork()).ldelim(); } + if (message.extendVote !== undefined) { + RequestExtendVote.encode(message.extendVote, writer.uint32(146).fork()).ldelim(); + } + if (message.verifyVoteExtension !== undefined) { + RequestVerifyVoteExtension.encode(message.verifyVoteExtension, writer.uint32(154).fork()).ldelim(); + } + if (message.finalizeBlock !== undefined) { + RequestFinalizeBlock.encode(message.finalizeBlock, writer.uint32(162).fork()).ldelim(); + } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): Request { @@ -1604,18 +1767,9 @@ export const Request = { case 6: message.query = RequestQuery.decode(reader, reader.uint32()); break; - case 7: - message.beginBlock = RequestBeginBlock.decode(reader, reader.uint32()); - break; case 8: message.checkTx = RequestCheckTx.decode(reader, reader.uint32()); break; - case 9: - message.deliverTx = RequestDeliverTx.decode(reader, reader.uint32()); - break; - case 10: - message.endBlock = RequestEndBlock.decode(reader, reader.uint32()); - break; case 11: message.commit = RequestCommit.decode(reader, reader.uint32()); break; @@ -1637,6 +1791,15 @@ export const Request = { case 17: message.processProposal = RequestProcessProposal.decode(reader, reader.uint32()); break; + case 18: + message.extendVote = RequestExtendVote.decode(reader, reader.uint32()); + break; + case 19: + message.verifyVoteExtension = RequestVerifyVoteExtension.decode(reader, reader.uint32()); + break; + case 20: + message.finalizeBlock = RequestFinalizeBlock.decode(reader, reader.uint32()); + break; default: reader.skipType(tag & 7); break; @@ -1651,10 +1814,7 @@ export const Request = { message.info = object.info !== undefined && object.info !== null ? RequestInfo.fromPartial(object.info) : undefined; message.initChain = object.initChain !== undefined && object.initChain !== null ? RequestInitChain.fromPartial(object.initChain) : undefined; message.query = object.query !== undefined && object.query !== null ? RequestQuery.fromPartial(object.query) : undefined; - message.beginBlock = object.beginBlock !== undefined && object.beginBlock !== null ? RequestBeginBlock.fromPartial(object.beginBlock) : undefined; message.checkTx = object.checkTx !== undefined && object.checkTx !== null ? RequestCheckTx.fromPartial(object.checkTx) : undefined; - message.deliverTx = object.deliverTx !== undefined && object.deliverTx !== null ? RequestDeliverTx.fromPartial(object.deliverTx) : undefined; - message.endBlock = object.endBlock !== undefined && object.endBlock !== null ? RequestEndBlock.fromPartial(object.endBlock) : undefined; message.commit = object.commit !== undefined && object.commit !== null ? RequestCommit.fromPartial(object.commit) : undefined; message.listSnapshots = object.listSnapshots !== undefined && object.listSnapshots !== null ? RequestListSnapshots.fromPartial(object.listSnapshots) : undefined; message.offerSnapshot = object.offerSnapshot !== undefined && object.offerSnapshot !== null ? RequestOfferSnapshot.fromPartial(object.offerSnapshot) : undefined; @@ -1662,6 +1822,9 @@ export const Request = { message.applySnapshotChunk = object.applySnapshotChunk !== undefined && object.applySnapshotChunk !== null ? RequestApplySnapshotChunk.fromPartial(object.applySnapshotChunk) : undefined; message.prepareProposal = object.prepareProposal !== undefined && object.prepareProposal !== null ? RequestPrepareProposal.fromPartial(object.prepareProposal) : undefined; message.processProposal = object.processProposal !== undefined && object.processProposal !== null ? RequestProcessProposal.fromPartial(object.processProposal) : undefined; + message.extendVote = object.extendVote !== undefined && object.extendVote !== null ? RequestExtendVote.fromPartial(object.extendVote) : undefined; + message.verifyVoteExtension = object.verifyVoteExtension !== undefined && object.verifyVoteExtension !== null ? RequestVerifyVoteExtension.fromPartial(object.verifyVoteExtension) : undefined; + message.finalizeBlock = object.finalizeBlock !== undefined && object.finalizeBlock !== null ? RequestFinalizeBlock.fromPartial(object.finalizeBlock) : undefined; return message; }, fromAmino(object: RequestAmino): Request { @@ -1681,18 +1844,9 @@ export const Request = { if (object.query !== undefined && object.query !== null) { message.query = RequestQuery.fromAmino(object.query); } - if (object.begin_block !== undefined && object.begin_block !== null) { - message.beginBlock = RequestBeginBlock.fromAmino(object.begin_block); - } if (object.check_tx !== undefined && object.check_tx !== null) { message.checkTx = RequestCheckTx.fromAmino(object.check_tx); } - if (object.deliver_tx !== undefined && object.deliver_tx !== null) { - message.deliverTx = RequestDeliverTx.fromAmino(object.deliver_tx); - } - if (object.end_block !== undefined && object.end_block !== null) { - message.endBlock = RequestEndBlock.fromAmino(object.end_block); - } if (object.commit !== undefined && object.commit !== null) { message.commit = RequestCommit.fromAmino(object.commit); } @@ -1714,6 +1868,15 @@ export const Request = { if (object.process_proposal !== undefined && object.process_proposal !== null) { message.processProposal = RequestProcessProposal.fromAmino(object.process_proposal); } + if (object.extend_vote !== undefined && object.extend_vote !== null) { + message.extendVote = RequestExtendVote.fromAmino(object.extend_vote); + } + if (object.verify_vote_extension !== undefined && object.verify_vote_extension !== null) { + message.verifyVoteExtension = RequestVerifyVoteExtension.fromAmino(object.verify_vote_extension); + } + if (object.finalize_block !== undefined && object.finalize_block !== null) { + message.finalizeBlock = RequestFinalizeBlock.fromAmino(object.finalize_block); + } return message; }, toAmino(message: Request): RequestAmino { @@ -1723,10 +1886,7 @@ export const Request = { obj.info = message.info ? RequestInfo.toAmino(message.info) : undefined; obj.init_chain = message.initChain ? RequestInitChain.toAmino(message.initChain) : undefined; obj.query = message.query ? RequestQuery.toAmino(message.query) : undefined; - obj.begin_block = message.beginBlock ? RequestBeginBlock.toAmino(message.beginBlock) : undefined; obj.check_tx = message.checkTx ? RequestCheckTx.toAmino(message.checkTx) : undefined; - obj.deliver_tx = message.deliverTx ? RequestDeliverTx.toAmino(message.deliverTx) : undefined; - obj.end_block = message.endBlock ? RequestEndBlock.toAmino(message.endBlock) : undefined; obj.commit = message.commit ? RequestCommit.toAmino(message.commit) : undefined; obj.list_snapshots = message.listSnapshots ? RequestListSnapshots.toAmino(message.listSnapshots) : undefined; obj.offer_snapshot = message.offerSnapshot ? RequestOfferSnapshot.toAmino(message.offerSnapshot) : undefined; @@ -1734,6 +1894,9 @@ export const Request = { obj.apply_snapshot_chunk = message.applySnapshotChunk ? RequestApplySnapshotChunk.toAmino(message.applySnapshotChunk) : undefined; obj.prepare_proposal = message.prepareProposal ? RequestPrepareProposal.toAmino(message.prepareProposal) : undefined; obj.process_proposal = message.processProposal ? RequestProcessProposal.toAmino(message.processProposal) : undefined; + obj.extend_vote = message.extendVote ? RequestExtendVote.toAmino(message.extendVote) : undefined; + obj.verify_vote_extension = message.verifyVoteExtension ? RequestVerifyVoteExtension.toAmino(message.verifyVoteExtension) : undefined; + obj.finalize_block = message.finalizeBlock ? RequestFinalizeBlock.toAmino(message.finalizeBlock) : undefined; return obj; }, fromAminoMsg(object: RequestAminoMsg): Request { @@ -2188,107 +2351,6 @@ export const RequestQuery = { }; } }; -function createBaseRequestBeginBlock(): RequestBeginBlock { - return { - hash: new Uint8Array(), - header: Header.fromPartial({}), - lastCommitInfo: CommitInfo.fromPartial({}), - byzantineValidators: [] - }; -} -export const RequestBeginBlock = { - typeUrl: "/tendermint.abci.RequestBeginBlock", - encode(message: RequestBeginBlock, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.hash.length !== 0) { - writer.uint32(10).bytes(message.hash); - } - if (message.header !== undefined) { - Header.encode(message.header, writer.uint32(18).fork()).ldelim(); - } - if (message.lastCommitInfo !== undefined) { - CommitInfo.encode(message.lastCommitInfo, writer.uint32(26).fork()).ldelim(); - } - for (const v of message.byzantineValidators) { - Misbehavior.encode(v!, writer.uint32(34).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): RequestBeginBlock { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseRequestBeginBlock(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.hash = reader.bytes(); - break; - case 2: - message.header = Header.decode(reader, reader.uint32()); - break; - case 3: - message.lastCommitInfo = CommitInfo.decode(reader, reader.uint32()); - break; - case 4: - message.byzantineValidators.push(Misbehavior.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromPartial(object: Partial): RequestBeginBlock { - const message = createBaseRequestBeginBlock(); - message.hash = object.hash ?? new Uint8Array(); - message.header = object.header !== undefined && object.header !== null ? Header.fromPartial(object.header) : undefined; - message.lastCommitInfo = object.lastCommitInfo !== undefined && object.lastCommitInfo !== null ? CommitInfo.fromPartial(object.lastCommitInfo) : undefined; - message.byzantineValidators = object.byzantineValidators?.map(e => Misbehavior.fromPartial(e)) || []; - return message; - }, - fromAmino(object: RequestBeginBlockAmino): RequestBeginBlock { - const message = createBaseRequestBeginBlock(); - if (object.hash !== undefined && object.hash !== null) { - message.hash = bytesFromBase64(object.hash); - } - if (object.header !== undefined && object.header !== null) { - message.header = Header.fromAmino(object.header); - } - if (object.last_commit_info !== undefined && object.last_commit_info !== null) { - message.lastCommitInfo = CommitInfo.fromAmino(object.last_commit_info); - } - message.byzantineValidators = object.byzantine_validators?.map(e => Misbehavior.fromAmino(e)) || []; - return message; - }, - toAmino(message: RequestBeginBlock): RequestBeginBlockAmino { - const obj: any = {}; - obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; - obj.header = message.header ? Header.toAmino(message.header) : undefined; - obj.last_commit_info = message.lastCommitInfo ? CommitInfo.toAmino(message.lastCommitInfo) : undefined; - if (message.byzantineValidators) { - obj.byzantine_validators = message.byzantineValidators.map(e => e ? Misbehavior.toAmino(e) : undefined); - } else { - obj.byzantine_validators = message.byzantineValidators; - } - return obj; - }, - fromAminoMsg(object: RequestBeginBlockAminoMsg): RequestBeginBlock { - return RequestBeginBlock.fromAmino(object.value); - }, - fromProtoMsg(message: RequestBeginBlockProtoMsg): RequestBeginBlock { - return RequestBeginBlock.decode(message.value); - }, - toProto(message: RequestBeginBlock): Uint8Array { - return RequestBeginBlock.encode(message).finish(); - }, - toProtoMsg(message: RequestBeginBlock): RequestBeginBlockProtoMsg { - return { - typeUrl: "/tendermint.abci.RequestBeginBlock", - value: RequestBeginBlock.encode(message).finish() - }; - } -}; function createBaseRequestCheckTx(): RequestCheckTx { return { tx: new Uint8Array(), @@ -2364,132 +2426,6 @@ export const RequestCheckTx = { }; } }; -function createBaseRequestDeliverTx(): RequestDeliverTx { - return { - tx: new Uint8Array() - }; -} -export const RequestDeliverTx = { - typeUrl: "/tendermint.abci.RequestDeliverTx", - encode(message: RequestDeliverTx, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.tx.length !== 0) { - writer.uint32(10).bytes(message.tx); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): RequestDeliverTx { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseRequestDeliverTx(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.tx = reader.bytes(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromPartial(object: Partial): RequestDeliverTx { - const message = createBaseRequestDeliverTx(); - message.tx = object.tx ?? new Uint8Array(); - return message; - }, - fromAmino(object: RequestDeliverTxAmino): RequestDeliverTx { - const message = createBaseRequestDeliverTx(); - if (object.tx !== undefined && object.tx !== null) { - message.tx = bytesFromBase64(object.tx); - } - return message; - }, - toAmino(message: RequestDeliverTx): RequestDeliverTxAmino { - const obj: any = {}; - obj.tx = message.tx ? base64FromBytes(message.tx) : undefined; - return obj; - }, - fromAminoMsg(object: RequestDeliverTxAminoMsg): RequestDeliverTx { - return RequestDeliverTx.fromAmino(object.value); - }, - fromProtoMsg(message: RequestDeliverTxProtoMsg): RequestDeliverTx { - return RequestDeliverTx.decode(message.value); - }, - toProto(message: RequestDeliverTx): Uint8Array { - return RequestDeliverTx.encode(message).finish(); - }, - toProtoMsg(message: RequestDeliverTx): RequestDeliverTxProtoMsg { - return { - typeUrl: "/tendermint.abci.RequestDeliverTx", - value: RequestDeliverTx.encode(message).finish() - }; - } -}; -function createBaseRequestEndBlock(): RequestEndBlock { - return { - height: BigInt(0) - }; -} -export const RequestEndBlock = { - typeUrl: "/tendermint.abci.RequestEndBlock", - encode(message: RequestEndBlock, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.height !== BigInt(0)) { - writer.uint32(8).int64(message.height); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): RequestEndBlock { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseRequestEndBlock(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.height = reader.int64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromPartial(object: Partial): RequestEndBlock { - const message = createBaseRequestEndBlock(); - message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); - return message; - }, - fromAmino(object: RequestEndBlockAmino): RequestEndBlock { - const message = createBaseRequestEndBlock(); - if (object.height !== undefined && object.height !== null) { - message.height = BigInt(object.height); - } - return message; - }, - toAmino(message: RequestEndBlock): RequestEndBlockAmino { - const obj: any = {}; - obj.height = message.height !== BigInt(0) ? message.height?.toString() : undefined; - return obj; - }, - fromAminoMsg(object: RequestEndBlockAminoMsg): RequestEndBlock { - return RequestEndBlock.fromAmino(object.value); - }, - fromProtoMsg(message: RequestEndBlockProtoMsg): RequestEndBlock { - return RequestEndBlock.decode(message.value); - }, - toProto(message: RequestEndBlock): Uint8Array { - return RequestEndBlock.encode(message).finish(); - }, - toProtoMsg(message: RequestEndBlock): RequestEndBlockProtoMsg { - return { - typeUrl: "/tendermint.abci.RequestEndBlock", - value: RequestEndBlock.encode(message).finish() - }; - } -}; function createBaseRequestCommit(): RequestCommit { return {}; } @@ -3141,41 +3077,442 @@ export const RequestProcessProposal = { }; } }; -function createBaseResponse(): Response { +function createBaseRequestExtendVote(): RequestExtendVote { return { - exception: undefined, - echo: undefined, - flush: undefined, - info: undefined, - initChain: undefined, - query: undefined, - beginBlock: undefined, - checkTx: undefined, - deliverTx: undefined, - endBlock: undefined, - commit: undefined, - listSnapshots: undefined, - offerSnapshot: undefined, - loadSnapshotChunk: undefined, - applySnapshotChunk: undefined, - prepareProposal: undefined, - processProposal: undefined + hash: new Uint8Array(), + height: BigInt(0), + time: new Date(), + txs: [], + proposedLastCommit: CommitInfo.fromPartial({}), + misbehavior: [], + nextValidatorsHash: new Uint8Array(), + proposerAddress: new Uint8Array() }; } -export const Response = { - typeUrl: "/tendermint.abci.Response", - encode(message: Response, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.exception !== undefined) { - ResponseException.encode(message.exception, writer.uint32(10).fork()).ldelim(); +export const RequestExtendVote = { + typeUrl: "/tendermint.abci.RequestExtendVote", + encode(message: RequestExtendVote, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.hash.length !== 0) { + writer.uint32(10).bytes(message.hash); } - if (message.echo !== undefined) { - ResponseEcho.encode(message.echo, writer.uint32(18).fork()).ldelim(); + if (message.height !== BigInt(0)) { + writer.uint32(16).int64(message.height); } - if (message.flush !== undefined) { - ResponseFlush.encode(message.flush, writer.uint32(26).fork()).ldelim(); + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(26).fork()).ldelim(); } - if (message.info !== undefined) { - ResponseInfo.encode(message.info, writer.uint32(34).fork()).ldelim(); + for (const v of message.txs) { + writer.uint32(34).bytes(v!); + } + if (message.proposedLastCommit !== undefined) { + CommitInfo.encode(message.proposedLastCommit, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.misbehavior) { + Misbehavior.encode(v!, writer.uint32(50).fork()).ldelim(); + } + if (message.nextValidatorsHash.length !== 0) { + writer.uint32(58).bytes(message.nextValidatorsHash); + } + if (message.proposerAddress.length !== 0) { + writer.uint32(66).bytes(message.proposerAddress); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): RequestExtendVote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestExtendVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.hash = reader.bytes(); + break; + case 2: + message.height = reader.int64(); + break; + case 3: + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 4: + message.txs.push(reader.bytes()); + break; + case 5: + message.proposedLastCommit = CommitInfo.decode(reader, reader.uint32()); + break; + case 6: + message.misbehavior.push(Misbehavior.decode(reader, reader.uint32())); + break; + case 7: + message.nextValidatorsHash = reader.bytes(); + break; + case 8: + message.proposerAddress = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): RequestExtendVote { + const message = createBaseRequestExtendVote(); + message.hash = object.hash ?? new Uint8Array(); + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + message.time = object.time ?? undefined; + message.txs = object.txs?.map(e => e) || []; + message.proposedLastCommit = object.proposedLastCommit !== undefined && object.proposedLastCommit !== null ? CommitInfo.fromPartial(object.proposedLastCommit) : undefined; + message.misbehavior = object.misbehavior?.map(e => Misbehavior.fromPartial(e)) || []; + message.nextValidatorsHash = object.nextValidatorsHash ?? new Uint8Array(); + message.proposerAddress = object.proposerAddress ?? new Uint8Array(); + return message; + }, + fromAmino(object: RequestExtendVoteAmino): RequestExtendVote { + const message = createBaseRequestExtendVote(); + if (object.hash !== undefined && object.hash !== null) { + message.hash = bytesFromBase64(object.hash); + } + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.time !== undefined && object.time !== null) { + message.time = fromTimestamp(Timestamp.fromAmino(object.time)); + } + message.txs = object.txs?.map(e => bytesFromBase64(e)) || []; + if (object.proposed_last_commit !== undefined && object.proposed_last_commit !== null) { + message.proposedLastCommit = CommitInfo.fromAmino(object.proposed_last_commit); + } + message.misbehavior = object.misbehavior?.map(e => Misbehavior.fromAmino(e)) || []; + if (object.next_validators_hash !== undefined && object.next_validators_hash !== null) { + message.nextValidatorsHash = bytesFromBase64(object.next_validators_hash); + } + if (object.proposer_address !== undefined && object.proposer_address !== null) { + message.proposerAddress = bytesFromBase64(object.proposer_address); + } + return message; + }, + toAmino(message: RequestExtendVote): RequestExtendVoteAmino { + const obj: any = {}; + obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; + obj.height = message.height !== BigInt(0) ? message.height?.toString() : undefined; + obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; + if (message.txs) { + obj.txs = message.txs.map(e => base64FromBytes(e)); + } else { + obj.txs = message.txs; + } + obj.proposed_last_commit = message.proposedLastCommit ? CommitInfo.toAmino(message.proposedLastCommit) : undefined; + if (message.misbehavior) { + obj.misbehavior = message.misbehavior.map(e => e ? Misbehavior.toAmino(e) : undefined); + } else { + obj.misbehavior = message.misbehavior; + } + obj.next_validators_hash = message.nextValidatorsHash ? base64FromBytes(message.nextValidatorsHash) : undefined; + obj.proposer_address = message.proposerAddress ? base64FromBytes(message.proposerAddress) : undefined; + return obj; + }, + fromAminoMsg(object: RequestExtendVoteAminoMsg): RequestExtendVote { + return RequestExtendVote.fromAmino(object.value); + }, + fromProtoMsg(message: RequestExtendVoteProtoMsg): RequestExtendVote { + return RequestExtendVote.decode(message.value); + }, + toProto(message: RequestExtendVote): Uint8Array { + return RequestExtendVote.encode(message).finish(); + }, + toProtoMsg(message: RequestExtendVote): RequestExtendVoteProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestExtendVote", + value: RequestExtendVote.encode(message).finish() + }; + } +}; +function createBaseRequestVerifyVoteExtension(): RequestVerifyVoteExtension { + return { + hash: new Uint8Array(), + validatorAddress: new Uint8Array(), + height: BigInt(0), + voteExtension: new Uint8Array() + }; +} +export const RequestVerifyVoteExtension = { + typeUrl: "/tendermint.abci.RequestVerifyVoteExtension", + encode(message: RequestVerifyVoteExtension, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.hash.length !== 0) { + writer.uint32(10).bytes(message.hash); + } + if (message.validatorAddress.length !== 0) { + writer.uint32(18).bytes(message.validatorAddress); + } + if (message.height !== BigInt(0)) { + writer.uint32(24).int64(message.height); + } + if (message.voteExtension.length !== 0) { + writer.uint32(34).bytes(message.voteExtension); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): RequestVerifyVoteExtension { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestVerifyVoteExtension(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.hash = reader.bytes(); + break; + case 2: + message.validatorAddress = reader.bytes(); + break; + case 3: + message.height = reader.int64(); + break; + case 4: + message.voteExtension = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): RequestVerifyVoteExtension { + const message = createBaseRequestVerifyVoteExtension(); + message.hash = object.hash ?? new Uint8Array(); + message.validatorAddress = object.validatorAddress ?? new Uint8Array(); + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + message.voteExtension = object.voteExtension ?? new Uint8Array(); + return message; + }, + fromAmino(object: RequestVerifyVoteExtensionAmino): RequestVerifyVoteExtension { + const message = createBaseRequestVerifyVoteExtension(); + if (object.hash !== undefined && object.hash !== null) { + message.hash = bytesFromBase64(object.hash); + } + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = bytesFromBase64(object.validator_address); + } + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.vote_extension !== undefined && object.vote_extension !== null) { + message.voteExtension = bytesFromBase64(object.vote_extension); + } + return message; + }, + toAmino(message: RequestVerifyVoteExtension): RequestVerifyVoteExtensionAmino { + const obj: any = {}; + obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; + obj.validator_address = message.validatorAddress ? base64FromBytes(message.validatorAddress) : undefined; + obj.height = message.height !== BigInt(0) ? message.height?.toString() : undefined; + obj.vote_extension = message.voteExtension ? base64FromBytes(message.voteExtension) : undefined; + return obj; + }, + fromAminoMsg(object: RequestVerifyVoteExtensionAminoMsg): RequestVerifyVoteExtension { + return RequestVerifyVoteExtension.fromAmino(object.value); + }, + fromProtoMsg(message: RequestVerifyVoteExtensionProtoMsg): RequestVerifyVoteExtension { + return RequestVerifyVoteExtension.decode(message.value); + }, + toProto(message: RequestVerifyVoteExtension): Uint8Array { + return RequestVerifyVoteExtension.encode(message).finish(); + }, + toProtoMsg(message: RequestVerifyVoteExtension): RequestVerifyVoteExtensionProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestVerifyVoteExtension", + value: RequestVerifyVoteExtension.encode(message).finish() + }; + } +}; +function createBaseRequestFinalizeBlock(): RequestFinalizeBlock { + return { + txs: [], + decidedLastCommit: CommitInfo.fromPartial({}), + misbehavior: [], + hash: new Uint8Array(), + height: BigInt(0), + time: new Date(), + nextValidatorsHash: new Uint8Array(), + proposerAddress: new Uint8Array() + }; +} +export const RequestFinalizeBlock = { + typeUrl: "/tendermint.abci.RequestFinalizeBlock", + encode(message: RequestFinalizeBlock, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.txs) { + writer.uint32(10).bytes(v!); + } + if (message.decidedLastCommit !== undefined) { + CommitInfo.encode(message.decidedLastCommit, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.misbehavior) { + Misbehavior.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.hash.length !== 0) { + writer.uint32(34).bytes(message.hash); + } + if (message.height !== BigInt(0)) { + writer.uint32(40).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(50).fork()).ldelim(); + } + if (message.nextValidatorsHash.length !== 0) { + writer.uint32(58).bytes(message.nextValidatorsHash); + } + if (message.proposerAddress.length !== 0) { + writer.uint32(66).bytes(message.proposerAddress); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): RequestFinalizeBlock { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestFinalizeBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.txs.push(reader.bytes()); + break; + case 2: + message.decidedLastCommit = CommitInfo.decode(reader, reader.uint32()); + break; + case 3: + message.misbehavior.push(Misbehavior.decode(reader, reader.uint32())); + break; + case 4: + message.hash = reader.bytes(); + break; + case 5: + message.height = reader.int64(); + break; + case 6: + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 7: + message.nextValidatorsHash = reader.bytes(); + break; + case 8: + message.proposerAddress = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): RequestFinalizeBlock { + const message = createBaseRequestFinalizeBlock(); + message.txs = object.txs?.map(e => e) || []; + message.decidedLastCommit = object.decidedLastCommit !== undefined && object.decidedLastCommit !== null ? CommitInfo.fromPartial(object.decidedLastCommit) : undefined; + message.misbehavior = object.misbehavior?.map(e => Misbehavior.fromPartial(e)) || []; + message.hash = object.hash ?? new Uint8Array(); + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + message.time = object.time ?? undefined; + message.nextValidatorsHash = object.nextValidatorsHash ?? new Uint8Array(); + message.proposerAddress = object.proposerAddress ?? new Uint8Array(); + return message; + }, + fromAmino(object: RequestFinalizeBlockAmino): RequestFinalizeBlock { + const message = createBaseRequestFinalizeBlock(); + message.txs = object.txs?.map(e => bytesFromBase64(e)) || []; + if (object.decided_last_commit !== undefined && object.decided_last_commit !== null) { + message.decidedLastCommit = CommitInfo.fromAmino(object.decided_last_commit); + } + message.misbehavior = object.misbehavior?.map(e => Misbehavior.fromAmino(e)) || []; + if (object.hash !== undefined && object.hash !== null) { + message.hash = bytesFromBase64(object.hash); + } + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.time !== undefined && object.time !== null) { + message.time = fromTimestamp(Timestamp.fromAmino(object.time)); + } + if (object.next_validators_hash !== undefined && object.next_validators_hash !== null) { + message.nextValidatorsHash = bytesFromBase64(object.next_validators_hash); + } + if (object.proposer_address !== undefined && object.proposer_address !== null) { + message.proposerAddress = bytesFromBase64(object.proposer_address); + } + return message; + }, + toAmino(message: RequestFinalizeBlock): RequestFinalizeBlockAmino { + const obj: any = {}; + if (message.txs) { + obj.txs = message.txs.map(e => base64FromBytes(e)); + } else { + obj.txs = message.txs; + } + obj.decided_last_commit = message.decidedLastCommit ? CommitInfo.toAmino(message.decidedLastCommit) : undefined; + if (message.misbehavior) { + obj.misbehavior = message.misbehavior.map(e => e ? Misbehavior.toAmino(e) : undefined); + } else { + obj.misbehavior = message.misbehavior; + } + obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; + obj.height = message.height !== BigInt(0) ? message.height?.toString() : undefined; + obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; + obj.next_validators_hash = message.nextValidatorsHash ? base64FromBytes(message.nextValidatorsHash) : undefined; + obj.proposer_address = message.proposerAddress ? base64FromBytes(message.proposerAddress) : undefined; + return obj; + }, + fromAminoMsg(object: RequestFinalizeBlockAminoMsg): RequestFinalizeBlock { + return RequestFinalizeBlock.fromAmino(object.value); + }, + fromProtoMsg(message: RequestFinalizeBlockProtoMsg): RequestFinalizeBlock { + return RequestFinalizeBlock.decode(message.value); + }, + toProto(message: RequestFinalizeBlock): Uint8Array { + return RequestFinalizeBlock.encode(message).finish(); + }, + toProtoMsg(message: RequestFinalizeBlock): RequestFinalizeBlockProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestFinalizeBlock", + value: RequestFinalizeBlock.encode(message).finish() + }; + } +}; +function createBaseResponse(): Response { + return { + exception: undefined, + echo: undefined, + flush: undefined, + info: undefined, + initChain: undefined, + query: undefined, + checkTx: undefined, + commit: undefined, + listSnapshots: undefined, + offerSnapshot: undefined, + loadSnapshotChunk: undefined, + applySnapshotChunk: undefined, + prepareProposal: undefined, + processProposal: undefined, + extendVote: undefined, + verifyVoteExtension: undefined, + finalizeBlock: undefined + }; +} +export const Response = { + typeUrl: "/tendermint.abci.Response", + encode(message: Response, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.exception !== undefined) { + ResponseException.encode(message.exception, writer.uint32(10).fork()).ldelim(); + } + if (message.echo !== undefined) { + ResponseEcho.encode(message.echo, writer.uint32(18).fork()).ldelim(); + } + if (message.flush !== undefined) { + ResponseFlush.encode(message.flush, writer.uint32(26).fork()).ldelim(); + } + if (message.info !== undefined) { + ResponseInfo.encode(message.info, writer.uint32(34).fork()).ldelim(); } if (message.initChain !== undefined) { ResponseInitChain.encode(message.initChain, writer.uint32(50).fork()).ldelim(); @@ -3183,18 +3520,9 @@ export const Response = { if (message.query !== undefined) { ResponseQuery.encode(message.query, writer.uint32(58).fork()).ldelim(); } - if (message.beginBlock !== undefined) { - ResponseBeginBlock.encode(message.beginBlock, writer.uint32(66).fork()).ldelim(); - } if (message.checkTx !== undefined) { ResponseCheckTx.encode(message.checkTx, writer.uint32(74).fork()).ldelim(); } - if (message.deliverTx !== undefined) { - ResponseDeliverTx.encode(message.deliverTx, writer.uint32(82).fork()).ldelim(); - } - if (message.endBlock !== undefined) { - ResponseEndBlock.encode(message.endBlock, writer.uint32(90).fork()).ldelim(); - } if (message.commit !== undefined) { ResponseCommit.encode(message.commit, writer.uint32(98).fork()).ldelim(); } @@ -3216,6 +3544,15 @@ export const Response = { if (message.processProposal !== undefined) { ResponseProcessProposal.encode(message.processProposal, writer.uint32(146).fork()).ldelim(); } + if (message.extendVote !== undefined) { + ResponseExtendVote.encode(message.extendVote, writer.uint32(154).fork()).ldelim(); + } + if (message.verifyVoteExtension !== undefined) { + ResponseVerifyVoteExtension.encode(message.verifyVoteExtension, writer.uint32(162).fork()).ldelim(); + } + if (message.finalizeBlock !== undefined) { + ResponseFinalizeBlock.encode(message.finalizeBlock, writer.uint32(170).fork()).ldelim(); + } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): Response { @@ -3243,18 +3580,9 @@ export const Response = { case 7: message.query = ResponseQuery.decode(reader, reader.uint32()); break; - case 8: - message.beginBlock = ResponseBeginBlock.decode(reader, reader.uint32()); - break; case 9: message.checkTx = ResponseCheckTx.decode(reader, reader.uint32()); break; - case 10: - message.deliverTx = ResponseDeliverTx.decode(reader, reader.uint32()); - break; - case 11: - message.endBlock = ResponseEndBlock.decode(reader, reader.uint32()); - break; case 12: message.commit = ResponseCommit.decode(reader, reader.uint32()); break; @@ -3276,6 +3604,15 @@ export const Response = { case 18: message.processProposal = ResponseProcessProposal.decode(reader, reader.uint32()); break; + case 19: + message.extendVote = ResponseExtendVote.decode(reader, reader.uint32()); + break; + case 20: + message.verifyVoteExtension = ResponseVerifyVoteExtension.decode(reader, reader.uint32()); + break; + case 21: + message.finalizeBlock = ResponseFinalizeBlock.decode(reader, reader.uint32()); + break; default: reader.skipType(tag & 7); break; @@ -3291,10 +3628,7 @@ export const Response = { message.info = object.info !== undefined && object.info !== null ? ResponseInfo.fromPartial(object.info) : undefined; message.initChain = object.initChain !== undefined && object.initChain !== null ? ResponseInitChain.fromPartial(object.initChain) : undefined; message.query = object.query !== undefined && object.query !== null ? ResponseQuery.fromPartial(object.query) : undefined; - message.beginBlock = object.beginBlock !== undefined && object.beginBlock !== null ? ResponseBeginBlock.fromPartial(object.beginBlock) : undefined; message.checkTx = object.checkTx !== undefined && object.checkTx !== null ? ResponseCheckTx.fromPartial(object.checkTx) : undefined; - message.deliverTx = object.deliverTx !== undefined && object.deliverTx !== null ? ResponseDeliverTx.fromPartial(object.deliverTx) : undefined; - message.endBlock = object.endBlock !== undefined && object.endBlock !== null ? ResponseEndBlock.fromPartial(object.endBlock) : undefined; message.commit = object.commit !== undefined && object.commit !== null ? ResponseCommit.fromPartial(object.commit) : undefined; message.listSnapshots = object.listSnapshots !== undefined && object.listSnapshots !== null ? ResponseListSnapshots.fromPartial(object.listSnapshots) : undefined; message.offerSnapshot = object.offerSnapshot !== undefined && object.offerSnapshot !== null ? ResponseOfferSnapshot.fromPartial(object.offerSnapshot) : undefined; @@ -3302,6 +3636,9 @@ export const Response = { message.applySnapshotChunk = object.applySnapshotChunk !== undefined && object.applySnapshotChunk !== null ? ResponseApplySnapshotChunk.fromPartial(object.applySnapshotChunk) : undefined; message.prepareProposal = object.prepareProposal !== undefined && object.prepareProposal !== null ? ResponsePrepareProposal.fromPartial(object.prepareProposal) : undefined; message.processProposal = object.processProposal !== undefined && object.processProposal !== null ? ResponseProcessProposal.fromPartial(object.processProposal) : undefined; + message.extendVote = object.extendVote !== undefined && object.extendVote !== null ? ResponseExtendVote.fromPartial(object.extendVote) : undefined; + message.verifyVoteExtension = object.verifyVoteExtension !== undefined && object.verifyVoteExtension !== null ? ResponseVerifyVoteExtension.fromPartial(object.verifyVoteExtension) : undefined; + message.finalizeBlock = object.finalizeBlock !== undefined && object.finalizeBlock !== null ? ResponseFinalizeBlock.fromPartial(object.finalizeBlock) : undefined; return message; }, fromAmino(object: ResponseAmino): Response { @@ -3324,18 +3661,9 @@ export const Response = { if (object.query !== undefined && object.query !== null) { message.query = ResponseQuery.fromAmino(object.query); } - if (object.begin_block !== undefined && object.begin_block !== null) { - message.beginBlock = ResponseBeginBlock.fromAmino(object.begin_block); - } if (object.check_tx !== undefined && object.check_tx !== null) { message.checkTx = ResponseCheckTx.fromAmino(object.check_tx); } - if (object.deliver_tx !== undefined && object.deliver_tx !== null) { - message.deliverTx = ResponseDeliverTx.fromAmino(object.deliver_tx); - } - if (object.end_block !== undefined && object.end_block !== null) { - message.endBlock = ResponseEndBlock.fromAmino(object.end_block); - } if (object.commit !== undefined && object.commit !== null) { message.commit = ResponseCommit.fromAmino(object.commit); } @@ -3357,6 +3685,15 @@ export const Response = { if (object.process_proposal !== undefined && object.process_proposal !== null) { message.processProposal = ResponseProcessProposal.fromAmino(object.process_proposal); } + if (object.extend_vote !== undefined && object.extend_vote !== null) { + message.extendVote = ResponseExtendVote.fromAmino(object.extend_vote); + } + if (object.verify_vote_extension !== undefined && object.verify_vote_extension !== null) { + message.verifyVoteExtension = ResponseVerifyVoteExtension.fromAmino(object.verify_vote_extension); + } + if (object.finalize_block !== undefined && object.finalize_block !== null) { + message.finalizeBlock = ResponseFinalizeBlock.fromAmino(object.finalize_block); + } return message; }, toAmino(message: Response): ResponseAmino { @@ -3367,10 +3704,7 @@ export const Response = { obj.info = message.info ? ResponseInfo.toAmino(message.info) : undefined; obj.init_chain = message.initChain ? ResponseInitChain.toAmino(message.initChain) : undefined; obj.query = message.query ? ResponseQuery.toAmino(message.query) : undefined; - obj.begin_block = message.beginBlock ? ResponseBeginBlock.toAmino(message.beginBlock) : undefined; obj.check_tx = message.checkTx ? ResponseCheckTx.toAmino(message.checkTx) : undefined; - obj.deliver_tx = message.deliverTx ? ResponseDeliverTx.toAmino(message.deliverTx) : undefined; - obj.end_block = message.endBlock ? ResponseEndBlock.toAmino(message.endBlock) : undefined; obj.commit = message.commit ? ResponseCommit.toAmino(message.commit) : undefined; obj.list_snapshots = message.listSnapshots ? ResponseListSnapshots.toAmino(message.listSnapshots) : undefined; obj.offer_snapshot = message.offerSnapshot ? ResponseOfferSnapshot.toAmino(message.offerSnapshot) : undefined; @@ -3378,6 +3712,9 @@ export const Response = { obj.apply_snapshot_chunk = message.applySnapshotChunk ? ResponseApplySnapshotChunk.toAmino(message.applySnapshotChunk) : undefined; obj.prepare_proposal = message.prepareProposal ? ResponsePrepareProposal.toAmino(message.prepareProposal) : undefined; obj.process_proposal = message.processProposal ? ResponseProcessProposal.toAmino(message.processProposal) : undefined; + obj.extend_vote = message.extendVote ? ResponseExtendVote.toAmino(message.extendVote) : undefined; + obj.verify_vote_extension = message.verifyVoteExtension ? ResponseVerifyVoteExtension.toAmino(message.verifyVoteExtension) : undefined; + obj.finalize_block = message.finalizeBlock ? ResponseFinalizeBlock.toAmino(message.finalizeBlock) : undefined; return obj; }, fromAminoMsg(object: ResponseAminoMsg): Response { @@ -3931,71 +4268,6 @@ export const ResponseQuery = { }; } }; -function createBaseResponseBeginBlock(): ResponseBeginBlock { - return { - events: [] - }; -} -export const ResponseBeginBlock = { - typeUrl: "/tendermint.abci.ResponseBeginBlock", - encode(message: ResponseBeginBlock, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - for (const v of message.events) { - Event.encode(v!, writer.uint32(10).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): ResponseBeginBlock { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseResponseBeginBlock(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.events.push(Event.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromPartial(object: Partial): ResponseBeginBlock { - const message = createBaseResponseBeginBlock(); - message.events = object.events?.map(e => Event.fromPartial(e)) || []; - return message; - }, - fromAmino(object: ResponseBeginBlockAmino): ResponseBeginBlock { - const message = createBaseResponseBeginBlock(); - message.events = object.events?.map(e => Event.fromAmino(e)) || []; - return message; - }, - toAmino(message: ResponseBeginBlock): ResponseBeginBlockAmino { - const obj: any = {}; - if (message.events) { - obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); - } else { - obj.events = message.events; - } - return obj; - }, - fromAminoMsg(object: ResponseBeginBlockAminoMsg): ResponseBeginBlock { - return ResponseBeginBlock.fromAmino(object.value); - }, - fromProtoMsg(message: ResponseBeginBlockProtoMsg): ResponseBeginBlock { - return ResponseBeginBlock.decode(message.value); - }, - toProto(message: ResponseBeginBlock): Uint8Array { - return ResponseBeginBlock.encode(message).finish(); - }, - toProtoMsg(message: ResponseBeginBlock): ResponseBeginBlockProtoMsg { - return { - typeUrl: "/tendermint.abci.ResponseBeginBlock", - value: ResponseBeginBlock.encode(message).finish() - }; - } -}; function createBaseResponseCheckTx(): ResponseCheckTx { return { code: 0, @@ -4005,10 +4277,7 @@ function createBaseResponseCheckTx(): ResponseCheckTx { gasWanted: BigInt(0), gasUsed: BigInt(0), events: [], - codespace: "", - sender: "", - priority: BigInt(0), - mempoolError: "" + codespace: "" }; } export const ResponseCheckTx = { @@ -4038,194 +4307,12 @@ export const ResponseCheckTx = { if (message.codespace !== "") { writer.uint32(66).string(message.codespace); } - if (message.sender !== "") { - writer.uint32(74).string(message.sender); - } - if (message.priority !== BigInt(0)) { - writer.uint32(80).int64(message.priority); - } - if (message.mempoolError !== "") { - writer.uint32(90).string(message.mempoolError); - } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): ResponseCheckTx { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseResponseCheckTx(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.code = reader.uint32(); - break; - case 2: - message.data = reader.bytes(); - break; - case 3: - message.log = reader.string(); - break; - case 4: - message.info = reader.string(); - break; - case 5: - message.gasWanted = reader.int64(); - break; - case 6: - message.gasUsed = reader.int64(); - break; - case 7: - message.events.push(Event.decode(reader, reader.uint32())); - break; - case 8: - message.codespace = reader.string(); - break; - case 9: - message.sender = reader.string(); - break; - case 10: - message.priority = reader.int64(); - break; - case 11: - message.mempoolError = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromPartial(object: Partial): ResponseCheckTx { - const message = createBaseResponseCheckTx(); - message.code = object.code ?? 0; - message.data = object.data ?? new Uint8Array(); - message.log = object.log ?? ""; - message.info = object.info ?? ""; - message.gasWanted = object.gasWanted !== undefined && object.gasWanted !== null ? BigInt(object.gasWanted.toString()) : BigInt(0); - message.gasUsed = object.gasUsed !== undefined && object.gasUsed !== null ? BigInt(object.gasUsed.toString()) : BigInt(0); - message.events = object.events?.map(e => Event.fromPartial(e)) || []; - message.codespace = object.codespace ?? ""; - message.sender = object.sender ?? ""; - message.priority = object.priority !== undefined && object.priority !== null ? BigInt(object.priority.toString()) : BigInt(0); - message.mempoolError = object.mempoolError ?? ""; - return message; - }, - fromAmino(object: ResponseCheckTxAmino): ResponseCheckTx { - const message = createBaseResponseCheckTx(); - if (object.code !== undefined && object.code !== null) { - message.code = object.code; - } - if (object.data !== undefined && object.data !== null) { - message.data = bytesFromBase64(object.data); - } - if (object.log !== undefined && object.log !== null) { - message.log = object.log; - } - if (object.info !== undefined && object.info !== null) { - message.info = object.info; - } - if (object.gas_wanted !== undefined && object.gas_wanted !== null) { - message.gasWanted = BigInt(object.gas_wanted); - } - if (object.gas_used !== undefined && object.gas_used !== null) { - message.gasUsed = BigInt(object.gas_used); - } - message.events = object.events?.map(e => Event.fromAmino(e)) || []; - if (object.codespace !== undefined && object.codespace !== null) { - message.codespace = object.codespace; - } - if (object.sender !== undefined && object.sender !== null) { - message.sender = object.sender; - } - if (object.priority !== undefined && object.priority !== null) { - message.priority = BigInt(object.priority); - } - if (object.mempool_error !== undefined && object.mempool_error !== null) { - message.mempoolError = object.mempool_error; - } - return message; - }, - toAmino(message: ResponseCheckTx): ResponseCheckTxAmino { - const obj: any = {}; - obj.code = message.code === 0 ? undefined : message.code; - obj.data = message.data ? base64FromBytes(message.data) : undefined; - obj.log = message.log === "" ? undefined : message.log; - obj.info = message.info === "" ? undefined : message.info; - obj.gas_wanted = message.gasWanted !== BigInt(0) ? message.gasWanted?.toString() : undefined; - obj.gas_used = message.gasUsed !== BigInt(0) ? message.gasUsed?.toString() : undefined; - if (message.events) { - obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); - } else { - obj.events = message.events; - } - obj.codespace = message.codespace === "" ? undefined : message.codespace; - obj.sender = message.sender === "" ? undefined : message.sender; - obj.priority = message.priority !== BigInt(0) ? message.priority?.toString() : undefined; - obj.mempool_error = message.mempoolError === "" ? undefined : message.mempoolError; - return obj; - }, - fromAminoMsg(object: ResponseCheckTxAminoMsg): ResponseCheckTx { - return ResponseCheckTx.fromAmino(object.value); - }, - fromProtoMsg(message: ResponseCheckTxProtoMsg): ResponseCheckTx { - return ResponseCheckTx.decode(message.value); - }, - toProto(message: ResponseCheckTx): Uint8Array { - return ResponseCheckTx.encode(message).finish(); - }, - toProtoMsg(message: ResponseCheckTx): ResponseCheckTxProtoMsg { - return { - typeUrl: "/tendermint.abci.ResponseCheckTx", - value: ResponseCheckTx.encode(message).finish() - }; - } -}; -function createBaseResponseDeliverTx(): ResponseDeliverTx { - return { - code: 0, - data: new Uint8Array(), - log: "", - info: "", - gasWanted: BigInt(0), - gasUsed: BigInt(0), - events: [], - codespace: "" - }; -} -export const ResponseDeliverTx = { - typeUrl: "/tendermint.abci.ResponseDeliverTx", - encode(message: ResponseDeliverTx, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.code !== 0) { - writer.uint32(8).uint32(message.code); - } - if (message.data.length !== 0) { - writer.uint32(18).bytes(message.data); - } - if (message.log !== "") { - writer.uint32(26).string(message.log); - } - if (message.info !== "") { - writer.uint32(34).string(message.info); - } - if (message.gasWanted !== BigInt(0)) { - writer.uint32(40).int64(message.gasWanted); - } - if (message.gasUsed !== BigInt(0)) { - writer.uint32(48).int64(message.gasUsed); - } - for (const v of message.events) { - Event.encode(v!, writer.uint32(58).fork()).ldelim(); - } - if (message.codespace !== "") { - writer.uint32(66).string(message.codespace); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): ResponseDeliverTx { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseResponseDeliverTx(); + const message = createBaseResponseCheckTx(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -4260,8 +4347,8 @@ export const ResponseDeliverTx = { } return message; }, - fromPartial(object: Partial): ResponseDeliverTx { - const message = createBaseResponseDeliverTx(); + fromPartial(object: Partial): ResponseCheckTx { + const message = createBaseResponseCheckTx(); message.code = object.code ?? 0; message.data = object.data ?? new Uint8Array(); message.log = object.log ?? ""; @@ -4272,8 +4359,8 @@ export const ResponseDeliverTx = { message.codespace = object.codespace ?? ""; return message; }, - fromAmino(object: ResponseDeliverTxAmino): ResponseDeliverTx { - const message = createBaseResponseDeliverTx(); + fromAmino(object: ResponseCheckTxAmino): ResponseCheckTx { + const message = createBaseResponseCheckTx(); if (object.code !== undefined && object.code !== null) { message.code = object.code; } @@ -4298,7 +4385,7 @@ export const ResponseDeliverTx = { } return message; }, - toAmino(message: ResponseDeliverTx): ResponseDeliverTxAmino { + toAmino(message: ResponseCheckTx): ResponseCheckTxAmino { const obj: any = {}; obj.code = message.code === 0 ? undefined : message.code; obj.data = message.data ? base64FromBytes(message.data) : undefined; @@ -4314,125 +4401,30 @@ export const ResponseDeliverTx = { obj.codespace = message.codespace === "" ? undefined : message.codespace; return obj; }, - fromAminoMsg(object: ResponseDeliverTxAminoMsg): ResponseDeliverTx { - return ResponseDeliverTx.fromAmino(object.value); - }, - fromProtoMsg(message: ResponseDeliverTxProtoMsg): ResponseDeliverTx { - return ResponseDeliverTx.decode(message.value); - }, - toProto(message: ResponseDeliverTx): Uint8Array { - return ResponseDeliverTx.encode(message).finish(); - }, - toProtoMsg(message: ResponseDeliverTx): ResponseDeliverTxProtoMsg { - return { - typeUrl: "/tendermint.abci.ResponseDeliverTx", - value: ResponseDeliverTx.encode(message).finish() - }; - } -}; -function createBaseResponseEndBlock(): ResponseEndBlock { - return { - validatorUpdates: [], - consensusParamUpdates: undefined, - events: [] - }; -} -export const ResponseEndBlock = { - typeUrl: "/tendermint.abci.ResponseEndBlock", - encode(message: ResponseEndBlock, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - for (const v of message.validatorUpdates) { - ValidatorUpdate.encode(v!, writer.uint32(10).fork()).ldelim(); - } - if (message.consensusParamUpdates !== undefined) { - ConsensusParams.encode(message.consensusParamUpdates, writer.uint32(18).fork()).ldelim(); - } - for (const v of message.events) { - Event.encode(v!, writer.uint32(26).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): ResponseEndBlock { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseResponseEndBlock(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.validatorUpdates.push(ValidatorUpdate.decode(reader, reader.uint32())); - break; - case 2: - message.consensusParamUpdates = ConsensusParams.decode(reader, reader.uint32()); - break; - case 3: - message.events.push(Event.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromPartial(object: Partial): ResponseEndBlock { - const message = createBaseResponseEndBlock(); - message.validatorUpdates = object.validatorUpdates?.map(e => ValidatorUpdate.fromPartial(e)) || []; - message.consensusParamUpdates = object.consensusParamUpdates !== undefined && object.consensusParamUpdates !== null ? ConsensusParams.fromPartial(object.consensusParamUpdates) : undefined; - message.events = object.events?.map(e => Event.fromPartial(e)) || []; - return message; - }, - fromAmino(object: ResponseEndBlockAmino): ResponseEndBlock { - const message = createBaseResponseEndBlock(); - message.validatorUpdates = object.validator_updates?.map(e => ValidatorUpdate.fromAmino(e)) || []; - if (object.consensus_param_updates !== undefined && object.consensus_param_updates !== null) { - message.consensusParamUpdates = ConsensusParams.fromAmino(object.consensus_param_updates); - } - message.events = object.events?.map(e => Event.fromAmino(e)) || []; - return message; - }, - toAmino(message: ResponseEndBlock): ResponseEndBlockAmino { - const obj: any = {}; - if (message.validatorUpdates) { - obj.validator_updates = message.validatorUpdates.map(e => e ? ValidatorUpdate.toAmino(e) : undefined); - } else { - obj.validator_updates = message.validatorUpdates; - } - obj.consensus_param_updates = message.consensusParamUpdates ? ConsensusParams.toAmino(message.consensusParamUpdates) : undefined; - if (message.events) { - obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); - } else { - obj.events = message.events; - } - return obj; - }, - fromAminoMsg(object: ResponseEndBlockAminoMsg): ResponseEndBlock { - return ResponseEndBlock.fromAmino(object.value); + fromAminoMsg(object: ResponseCheckTxAminoMsg): ResponseCheckTx { + return ResponseCheckTx.fromAmino(object.value); }, - fromProtoMsg(message: ResponseEndBlockProtoMsg): ResponseEndBlock { - return ResponseEndBlock.decode(message.value); + fromProtoMsg(message: ResponseCheckTxProtoMsg): ResponseCheckTx { + return ResponseCheckTx.decode(message.value); }, - toProto(message: ResponseEndBlock): Uint8Array { - return ResponseEndBlock.encode(message).finish(); + toProto(message: ResponseCheckTx): Uint8Array { + return ResponseCheckTx.encode(message).finish(); }, - toProtoMsg(message: ResponseEndBlock): ResponseEndBlockProtoMsg { + toProtoMsg(message: ResponseCheckTx): ResponseCheckTxProtoMsg { return { - typeUrl: "/tendermint.abci.ResponseEndBlock", - value: ResponseEndBlock.encode(message).finish() + typeUrl: "/tendermint.abci.ResponseCheckTx", + value: ResponseCheckTx.encode(message).finish() }; } }; function createBaseResponseCommit(): ResponseCommit { return { - data: new Uint8Array(), retainHeight: BigInt(0) }; } export const ResponseCommit = { typeUrl: "/tendermint.abci.ResponseCommit", encode(message: ResponseCommit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.data.length !== 0) { - writer.uint32(18).bytes(message.data); - } if (message.retainHeight !== BigInt(0)) { writer.uint32(24).int64(message.retainHeight); } @@ -4445,9 +4437,6 @@ export const ResponseCommit = { while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { - case 2: - message.data = reader.bytes(); - break; case 3: message.retainHeight = reader.int64(); break; @@ -4460,15 +4449,11 @@ export const ResponseCommit = { }, fromPartial(object: Partial): ResponseCommit { const message = createBaseResponseCommit(); - message.data = object.data ?? new Uint8Array(); message.retainHeight = object.retainHeight !== undefined && object.retainHeight !== null ? BigInt(object.retainHeight.toString()) : BigInt(0); return message; }, fromAmino(object: ResponseCommitAmino): ResponseCommit { const message = createBaseResponseCommit(); - if (object.data !== undefined && object.data !== null) { - message.data = bytesFromBase64(object.data); - } if (object.retain_height !== undefined && object.retain_height !== null) { message.retainHeight = BigInt(object.retain_height); } @@ -4476,7 +4461,6 @@ export const ResponseCommit = { }, toAmino(message: ResponseCommit): ResponseCommitAmino { const obj: any = {}; - obj.data = message.data ? base64FromBytes(message.data) : undefined; obj.retain_height = message.retainHeight !== BigInt(0) ? message.retainHeight?.toString() : undefined; return obj; }, @@ -4800,15 +4784,206 @@ export const ResponsePrepareProposal = { } return writer; }, - decode(input: BinaryReader | Uint8Array, length?: number): ResponsePrepareProposal { + decode(input: BinaryReader | Uint8Array, length?: number): ResponsePrepareProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponsePrepareProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.txs.push(reader.bytes()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): ResponsePrepareProposal { + const message = createBaseResponsePrepareProposal(); + message.txs = object.txs?.map(e => e) || []; + return message; + }, + fromAmino(object: ResponsePrepareProposalAmino): ResponsePrepareProposal { + const message = createBaseResponsePrepareProposal(); + message.txs = object.txs?.map(e => bytesFromBase64(e)) || []; + return message; + }, + toAmino(message: ResponsePrepareProposal): ResponsePrepareProposalAmino { + const obj: any = {}; + if (message.txs) { + obj.txs = message.txs.map(e => base64FromBytes(e)); + } else { + obj.txs = message.txs; + } + return obj; + }, + fromAminoMsg(object: ResponsePrepareProposalAminoMsg): ResponsePrepareProposal { + return ResponsePrepareProposal.fromAmino(object.value); + }, + fromProtoMsg(message: ResponsePrepareProposalProtoMsg): ResponsePrepareProposal { + return ResponsePrepareProposal.decode(message.value); + }, + toProto(message: ResponsePrepareProposal): Uint8Array { + return ResponsePrepareProposal.encode(message).finish(); + }, + toProtoMsg(message: ResponsePrepareProposal): ResponsePrepareProposalProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponsePrepareProposal", + value: ResponsePrepareProposal.encode(message).finish() + }; + } +}; +function createBaseResponseProcessProposal(): ResponseProcessProposal { + return { + status: 0 + }; +} +export const ResponseProcessProposal = { + typeUrl: "/tendermint.abci.ResponseProcessProposal", + encode(message: ResponseProcessProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.status !== 0) { + writer.uint32(8).int32(message.status); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ResponseProcessProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseProcessProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.status = (reader.int32() as any); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): ResponseProcessProposal { + const message = createBaseResponseProcessProposal(); + message.status = object.status ?? 0; + return message; + }, + fromAmino(object: ResponseProcessProposalAmino): ResponseProcessProposal { + const message = createBaseResponseProcessProposal(); + if (object.status !== undefined && object.status !== null) { + message.status = object.status; + } + return message; + }, + toAmino(message: ResponseProcessProposal): ResponseProcessProposalAmino { + const obj: any = {}; + obj.status = message.status === 0 ? undefined : message.status; + return obj; + }, + fromAminoMsg(object: ResponseProcessProposalAminoMsg): ResponseProcessProposal { + return ResponseProcessProposal.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseProcessProposalProtoMsg): ResponseProcessProposal { + return ResponseProcessProposal.decode(message.value); + }, + toProto(message: ResponseProcessProposal): Uint8Array { + return ResponseProcessProposal.encode(message).finish(); + }, + toProtoMsg(message: ResponseProcessProposal): ResponseProcessProposalProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseProcessProposal", + value: ResponseProcessProposal.encode(message).finish() + }; + } +}; +function createBaseResponseExtendVote(): ResponseExtendVote { + return { + voteExtension: new Uint8Array() + }; +} +export const ResponseExtendVote = { + typeUrl: "/tendermint.abci.ResponseExtendVote", + encode(message: ResponseExtendVote, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.voteExtension.length !== 0) { + writer.uint32(10).bytes(message.voteExtension); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ResponseExtendVote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseExtendVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.voteExtension = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): ResponseExtendVote { + const message = createBaseResponseExtendVote(); + message.voteExtension = object.voteExtension ?? new Uint8Array(); + return message; + }, + fromAmino(object: ResponseExtendVoteAmino): ResponseExtendVote { + const message = createBaseResponseExtendVote(); + if (object.vote_extension !== undefined && object.vote_extension !== null) { + message.voteExtension = bytesFromBase64(object.vote_extension); + } + return message; + }, + toAmino(message: ResponseExtendVote): ResponseExtendVoteAmino { + const obj: any = {}; + obj.vote_extension = message.voteExtension ? base64FromBytes(message.voteExtension) : undefined; + return obj; + }, + fromAminoMsg(object: ResponseExtendVoteAminoMsg): ResponseExtendVote { + return ResponseExtendVote.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseExtendVoteProtoMsg): ResponseExtendVote { + return ResponseExtendVote.decode(message.value); + }, + toProto(message: ResponseExtendVote): Uint8Array { + return ResponseExtendVote.encode(message).finish(); + }, + toProtoMsg(message: ResponseExtendVote): ResponseExtendVoteProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseExtendVote", + value: ResponseExtendVote.encode(message).finish() + }; + } +}; +function createBaseResponseVerifyVoteExtension(): ResponseVerifyVoteExtension { + return { + status: 0 + }; +} +export const ResponseVerifyVoteExtension = { + typeUrl: "/tendermint.abci.ResponseVerifyVoteExtension", + encode(message: ResponseVerifyVoteExtension, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.status !== 0) { + writer.uint32(8).int32(message.status); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ResponseVerifyVoteExtension { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseResponsePrepareProposal(); + const message = createBaseResponseVerifyVoteExtension(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.txs.push(reader.bytes()); + message.status = (reader.int32() as any); break; default: reader.skipType(tag & 7); @@ -4817,63 +4992,89 @@ export const ResponsePrepareProposal = { } return message; }, - fromPartial(object: Partial): ResponsePrepareProposal { - const message = createBaseResponsePrepareProposal(); - message.txs = object.txs?.map(e => e) || []; + fromPartial(object: Partial): ResponseVerifyVoteExtension { + const message = createBaseResponseVerifyVoteExtension(); + message.status = object.status ?? 0; return message; }, - fromAmino(object: ResponsePrepareProposalAmino): ResponsePrepareProposal { - const message = createBaseResponsePrepareProposal(); - message.txs = object.txs?.map(e => bytesFromBase64(e)) || []; + fromAmino(object: ResponseVerifyVoteExtensionAmino): ResponseVerifyVoteExtension { + const message = createBaseResponseVerifyVoteExtension(); + if (object.status !== undefined && object.status !== null) { + message.status = object.status; + } return message; }, - toAmino(message: ResponsePrepareProposal): ResponsePrepareProposalAmino { + toAmino(message: ResponseVerifyVoteExtension): ResponseVerifyVoteExtensionAmino { const obj: any = {}; - if (message.txs) { - obj.txs = message.txs.map(e => base64FromBytes(e)); - } else { - obj.txs = message.txs; - } + obj.status = message.status === 0 ? undefined : message.status; return obj; }, - fromAminoMsg(object: ResponsePrepareProposalAminoMsg): ResponsePrepareProposal { - return ResponsePrepareProposal.fromAmino(object.value); + fromAminoMsg(object: ResponseVerifyVoteExtensionAminoMsg): ResponseVerifyVoteExtension { + return ResponseVerifyVoteExtension.fromAmino(object.value); }, - fromProtoMsg(message: ResponsePrepareProposalProtoMsg): ResponsePrepareProposal { - return ResponsePrepareProposal.decode(message.value); + fromProtoMsg(message: ResponseVerifyVoteExtensionProtoMsg): ResponseVerifyVoteExtension { + return ResponseVerifyVoteExtension.decode(message.value); }, - toProto(message: ResponsePrepareProposal): Uint8Array { - return ResponsePrepareProposal.encode(message).finish(); + toProto(message: ResponseVerifyVoteExtension): Uint8Array { + return ResponseVerifyVoteExtension.encode(message).finish(); }, - toProtoMsg(message: ResponsePrepareProposal): ResponsePrepareProposalProtoMsg { + toProtoMsg(message: ResponseVerifyVoteExtension): ResponseVerifyVoteExtensionProtoMsg { return { - typeUrl: "/tendermint.abci.ResponsePrepareProposal", - value: ResponsePrepareProposal.encode(message).finish() + typeUrl: "/tendermint.abci.ResponseVerifyVoteExtension", + value: ResponseVerifyVoteExtension.encode(message).finish() }; } }; -function createBaseResponseProcessProposal(): ResponseProcessProposal { +function createBaseResponseFinalizeBlock(): ResponseFinalizeBlock { return { - status: 0 + events: [], + txResults: [], + validatorUpdates: [], + consensusParamUpdates: undefined, + appHash: new Uint8Array() }; } -export const ResponseProcessProposal = { - typeUrl: "/tendermint.abci.ResponseProcessProposal", - encode(message: ResponseProcessProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.status !== 0) { - writer.uint32(8).int32(message.status); +export const ResponseFinalizeBlock = { + typeUrl: "/tendermint.abci.ResponseFinalizeBlock", + encode(message: ResponseFinalizeBlock, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.events) { + Event.encode(v!, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.txResults) { + ExecTxResult.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.validatorUpdates) { + ValidatorUpdate.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.consensusParamUpdates !== undefined) { + ConsensusParams.encode(message.consensusParamUpdates, writer.uint32(34).fork()).ldelim(); + } + if (message.appHash.length !== 0) { + writer.uint32(42).bytes(message.appHash); } return writer; }, - decode(input: BinaryReader | Uint8Array, length?: number): ResponseProcessProposal { + decode(input: BinaryReader | Uint8Array, length?: number): ResponseFinalizeBlock { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseResponseProcessProposal(); + const message = createBaseResponseFinalizeBlock(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.status = (reader.int32() as any); + message.events.push(Event.decode(reader, reader.uint32())); + break; + case 2: + message.txResults.push(ExecTxResult.decode(reader, reader.uint32())); + break; + case 3: + message.validatorUpdates.push(ValidatorUpdate.decode(reader, reader.uint32())); + break; + case 4: + message.consensusParamUpdates = ConsensusParams.decode(reader, reader.uint32()); + break; + case 5: + message.appHash = reader.bytes(); break; default: reader.skipType(tag & 7); @@ -4882,36 +5083,62 @@ export const ResponseProcessProposal = { } return message; }, - fromPartial(object: Partial): ResponseProcessProposal { - const message = createBaseResponseProcessProposal(); - message.status = object.status ?? 0; + fromPartial(object: Partial): ResponseFinalizeBlock { + const message = createBaseResponseFinalizeBlock(); + message.events = object.events?.map(e => Event.fromPartial(e)) || []; + message.txResults = object.txResults?.map(e => ExecTxResult.fromPartial(e)) || []; + message.validatorUpdates = object.validatorUpdates?.map(e => ValidatorUpdate.fromPartial(e)) || []; + message.consensusParamUpdates = object.consensusParamUpdates !== undefined && object.consensusParamUpdates !== null ? ConsensusParams.fromPartial(object.consensusParamUpdates) : undefined; + message.appHash = object.appHash ?? new Uint8Array(); return message; }, - fromAmino(object: ResponseProcessProposalAmino): ResponseProcessProposal { - const message = createBaseResponseProcessProposal(); - if (object.status !== undefined && object.status !== null) { - message.status = object.status; + fromAmino(object: ResponseFinalizeBlockAmino): ResponseFinalizeBlock { + const message = createBaseResponseFinalizeBlock(); + message.events = object.events?.map(e => Event.fromAmino(e)) || []; + message.txResults = object.tx_results?.map(e => ExecTxResult.fromAmino(e)) || []; + message.validatorUpdates = object.validator_updates?.map(e => ValidatorUpdate.fromAmino(e)) || []; + if (object.consensus_param_updates !== undefined && object.consensus_param_updates !== null) { + message.consensusParamUpdates = ConsensusParams.fromAmino(object.consensus_param_updates); + } + if (object.app_hash !== undefined && object.app_hash !== null) { + message.appHash = bytesFromBase64(object.app_hash); } return message; }, - toAmino(message: ResponseProcessProposal): ResponseProcessProposalAmino { + toAmino(message: ResponseFinalizeBlock): ResponseFinalizeBlockAmino { const obj: any = {}; - obj.status = message.status === 0 ? undefined : message.status; + if (message.events) { + obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); + } else { + obj.events = message.events; + } + if (message.txResults) { + obj.tx_results = message.txResults.map(e => e ? ExecTxResult.toAmino(e) : undefined); + } else { + obj.tx_results = message.txResults; + } + if (message.validatorUpdates) { + obj.validator_updates = message.validatorUpdates.map(e => e ? ValidatorUpdate.toAmino(e) : undefined); + } else { + obj.validator_updates = message.validatorUpdates; + } + obj.consensus_param_updates = message.consensusParamUpdates ? ConsensusParams.toAmino(message.consensusParamUpdates) : undefined; + obj.app_hash = message.appHash ? base64FromBytes(message.appHash) : undefined; return obj; }, - fromAminoMsg(object: ResponseProcessProposalAminoMsg): ResponseProcessProposal { - return ResponseProcessProposal.fromAmino(object.value); + fromAminoMsg(object: ResponseFinalizeBlockAminoMsg): ResponseFinalizeBlock { + return ResponseFinalizeBlock.fromAmino(object.value); }, - fromProtoMsg(message: ResponseProcessProposalProtoMsg): ResponseProcessProposal { - return ResponseProcessProposal.decode(message.value); + fromProtoMsg(message: ResponseFinalizeBlockProtoMsg): ResponseFinalizeBlock { + return ResponseFinalizeBlock.decode(message.value); }, - toProto(message: ResponseProcessProposal): Uint8Array { - return ResponseProcessProposal.encode(message).finish(); + toProto(message: ResponseFinalizeBlock): Uint8Array { + return ResponseFinalizeBlock.encode(message).finish(); }, - toProtoMsg(message: ResponseProcessProposal): ResponseProcessProposalProtoMsg { + toProtoMsg(message: ResponseFinalizeBlock): ResponseFinalizeBlockProtoMsg { return { - typeUrl: "/tendermint.abci.ResponseProcessProposal", - value: ResponseProcessProposal.encode(message).finish() + typeUrl: "/tendermint.abci.ResponseFinalizeBlock", + value: ResponseFinalizeBlock.encode(message).finish() }; } }; @@ -5233,12 +5460,161 @@ export const EventAttribute = { }; } }; +function createBaseExecTxResult(): ExecTxResult { + return { + code: 0, + data: new Uint8Array(), + log: "", + info: "", + gasWanted: BigInt(0), + gasUsed: BigInt(0), + events: [], + codespace: "" + }; +} +export const ExecTxResult = { + typeUrl: "/tendermint.abci.ExecTxResult", + encode(message: ExecTxResult, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.code !== 0) { + writer.uint32(8).uint32(message.code); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + if (message.log !== "") { + writer.uint32(26).string(message.log); + } + if (message.info !== "") { + writer.uint32(34).string(message.info); + } + if (message.gasWanted !== BigInt(0)) { + writer.uint32(40).int64(message.gasWanted); + } + if (message.gasUsed !== BigInt(0)) { + writer.uint32(48).int64(message.gasUsed); + } + for (const v of message.events) { + Event.encode(v!, writer.uint32(58).fork()).ldelim(); + } + if (message.codespace !== "") { + writer.uint32(66).string(message.codespace); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ExecTxResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExecTxResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.code = reader.uint32(); + break; + case 2: + message.data = reader.bytes(); + break; + case 3: + message.log = reader.string(); + break; + case 4: + message.info = reader.string(); + break; + case 5: + message.gasWanted = reader.int64(); + break; + case 6: + message.gasUsed = reader.int64(); + break; + case 7: + message.events.push(Event.decode(reader, reader.uint32())); + break; + case 8: + message.codespace = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): ExecTxResult { + const message = createBaseExecTxResult(); + message.code = object.code ?? 0; + message.data = object.data ?? new Uint8Array(); + message.log = object.log ?? ""; + message.info = object.info ?? ""; + message.gasWanted = object.gasWanted !== undefined && object.gasWanted !== null ? BigInt(object.gasWanted.toString()) : BigInt(0); + message.gasUsed = object.gasUsed !== undefined && object.gasUsed !== null ? BigInt(object.gasUsed.toString()) : BigInt(0); + message.events = object.events?.map(e => Event.fromPartial(e)) || []; + message.codespace = object.codespace ?? ""; + return message; + }, + fromAmino(object: ExecTxResultAmino): ExecTxResult { + const message = createBaseExecTxResult(); + if (object.code !== undefined && object.code !== null) { + message.code = object.code; + } + if (object.data !== undefined && object.data !== null) { + message.data = bytesFromBase64(object.data); + } + if (object.log !== undefined && object.log !== null) { + message.log = object.log; + } + if (object.info !== undefined && object.info !== null) { + message.info = object.info; + } + if (object.gas_wanted !== undefined && object.gas_wanted !== null) { + message.gasWanted = BigInt(object.gas_wanted); + } + if (object.gas_used !== undefined && object.gas_used !== null) { + message.gasUsed = BigInt(object.gas_used); + } + message.events = object.events?.map(e => Event.fromAmino(e)) || []; + if (object.codespace !== undefined && object.codespace !== null) { + message.codespace = object.codespace; + } + return message; + }, + toAmino(message: ExecTxResult): ExecTxResultAmino { + const obj: any = {}; + obj.code = message.code === 0 ? undefined : message.code; + obj.data = message.data ? base64FromBytes(message.data) : undefined; + obj.log = message.log === "" ? undefined : message.log; + obj.info = message.info === "" ? undefined : message.info; + obj.gas_wanted = message.gasWanted !== BigInt(0) ? message.gasWanted?.toString() : undefined; + obj.gas_used = message.gasUsed !== BigInt(0) ? message.gasUsed?.toString() : undefined; + if (message.events) { + obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); + } else { + obj.events = message.events; + } + obj.codespace = message.codespace === "" ? undefined : message.codespace; + return obj; + }, + fromAminoMsg(object: ExecTxResultAminoMsg): ExecTxResult { + return ExecTxResult.fromAmino(object.value); + }, + fromProtoMsg(message: ExecTxResultProtoMsg): ExecTxResult { + return ExecTxResult.decode(message.value); + }, + toProto(message: ExecTxResult): Uint8Array { + return ExecTxResult.encode(message).finish(); + }, + toProtoMsg(message: ExecTxResult): ExecTxResultProtoMsg { + return { + typeUrl: "/tendermint.abci.ExecTxResult", + value: ExecTxResult.encode(message).finish() + }; + } +}; function createBaseTxResult(): TxResult { return { height: BigInt(0), index: 0, tx: new Uint8Array(), - result: ResponseDeliverTx.fromPartial({}) + result: ExecTxResult.fromPartial({}) }; } export const TxResult = { @@ -5254,7 +5630,7 @@ export const TxResult = { writer.uint32(26).bytes(message.tx); } if (message.result !== undefined) { - ResponseDeliverTx.encode(message.result, writer.uint32(34).fork()).ldelim(); + ExecTxResult.encode(message.result, writer.uint32(34).fork()).ldelim(); } return writer; }, @@ -5275,7 +5651,7 @@ export const TxResult = { message.tx = reader.bytes(); break; case 4: - message.result = ResponseDeliverTx.decode(reader, reader.uint32()); + message.result = ExecTxResult.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -5289,7 +5665,7 @@ export const TxResult = { message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); message.index = object.index ?? 0; message.tx = object.tx ?? new Uint8Array(); - message.result = object.result !== undefined && object.result !== null ? ResponseDeliverTx.fromPartial(object.result) : undefined; + message.result = object.result !== undefined && object.result !== null ? ExecTxResult.fromPartial(object.result) : undefined; return message; }, fromAmino(object: TxResultAmino): TxResult { @@ -5304,7 +5680,7 @@ export const TxResult = { message.tx = bytesFromBase64(object.tx); } if (object.result !== undefined && object.result !== null) { - message.result = ResponseDeliverTx.fromAmino(object.result); + message.result = ExecTxResult.fromAmino(object.result); } return message; }, @@ -5313,7 +5689,7 @@ export const TxResult = { obj.height = message.height !== BigInt(0) ? message.height?.toString() : undefined; obj.index = message.index === 0 ? undefined : message.index; obj.tx = message.tx ? base64FromBytes(message.tx) : undefined; - obj.result = message.result ? ResponseDeliverTx.toAmino(message.result) : undefined; + obj.result = message.result ? ExecTxResult.toAmino(message.result) : undefined; return obj; }, fromAminoMsg(object: TxResultAminoMsg): TxResult { @@ -5485,7 +5861,7 @@ export const ValidatorUpdate = { function createBaseVoteInfo(): VoteInfo { return { validator: Validator.fromPartial({}), - signedLastBlock: false + blockIdFlag: 0 }; } export const VoteInfo = { @@ -5494,8 +5870,8 @@ export const VoteInfo = { if (message.validator !== undefined) { Validator.encode(message.validator, writer.uint32(10).fork()).ldelim(); } - if (message.signedLastBlock === true) { - writer.uint32(16).bool(message.signedLastBlock); + if (message.blockIdFlag !== 0) { + writer.uint32(24).int32(message.blockIdFlag); } return writer; }, @@ -5509,8 +5885,8 @@ export const VoteInfo = { case 1: message.validator = Validator.decode(reader, reader.uint32()); break; - case 2: - message.signedLastBlock = reader.bool(); + case 3: + message.blockIdFlag = (reader.int32() as any); break; default: reader.skipType(tag & 7); @@ -5522,7 +5898,7 @@ export const VoteInfo = { fromPartial(object: Partial): VoteInfo { const message = createBaseVoteInfo(); message.validator = object.validator !== undefined && object.validator !== null ? Validator.fromPartial(object.validator) : undefined; - message.signedLastBlock = object.signedLastBlock ?? false; + message.blockIdFlag = object.blockIdFlag ?? 0; return message; }, fromAmino(object: VoteInfoAmino): VoteInfo { @@ -5530,15 +5906,15 @@ export const VoteInfo = { if (object.validator !== undefined && object.validator !== null) { message.validator = Validator.fromAmino(object.validator); } - if (object.signed_last_block !== undefined && object.signed_last_block !== null) { - message.signedLastBlock = object.signed_last_block; + if (object.block_id_flag !== undefined && object.block_id_flag !== null) { + message.blockIdFlag = object.block_id_flag; } return message; }, toAmino(message: VoteInfo): VoteInfoAmino { const obj: any = {}; obj.validator = message.validator ? Validator.toAmino(message.validator) : undefined; - obj.signed_last_block = message.signedLastBlock === false ? undefined : message.signedLastBlock; + obj.block_id_flag = message.blockIdFlag === 0 ? undefined : message.blockIdFlag; return obj; }, fromAminoMsg(object: VoteInfoAminoMsg): VoteInfo { @@ -5560,8 +5936,9 @@ export const VoteInfo = { function createBaseExtendedVoteInfo(): ExtendedVoteInfo { return { validator: Validator.fromPartial({}), - signedLastBlock: false, - voteExtension: new Uint8Array() + voteExtension: new Uint8Array(), + extensionSignature: new Uint8Array(), + blockIdFlag: 0 }; } export const ExtendedVoteInfo = { @@ -5570,12 +5947,15 @@ export const ExtendedVoteInfo = { if (message.validator !== undefined) { Validator.encode(message.validator, writer.uint32(10).fork()).ldelim(); } - if (message.signedLastBlock === true) { - writer.uint32(16).bool(message.signedLastBlock); - } if (message.voteExtension.length !== 0) { writer.uint32(26).bytes(message.voteExtension); } + if (message.extensionSignature.length !== 0) { + writer.uint32(34).bytes(message.extensionSignature); + } + if (message.blockIdFlag !== 0) { + writer.uint32(40).int32(message.blockIdFlag); + } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): ExtendedVoteInfo { @@ -5588,12 +5968,15 @@ export const ExtendedVoteInfo = { case 1: message.validator = Validator.decode(reader, reader.uint32()); break; - case 2: - message.signedLastBlock = reader.bool(); - break; case 3: message.voteExtension = reader.bytes(); break; + case 4: + message.extensionSignature = reader.bytes(); + break; + case 5: + message.blockIdFlag = (reader.int32() as any); + break; default: reader.skipType(tag & 7); break; @@ -5604,8 +5987,9 @@ export const ExtendedVoteInfo = { fromPartial(object: Partial): ExtendedVoteInfo { const message = createBaseExtendedVoteInfo(); message.validator = object.validator !== undefined && object.validator !== null ? Validator.fromPartial(object.validator) : undefined; - message.signedLastBlock = object.signedLastBlock ?? false; message.voteExtension = object.voteExtension ?? new Uint8Array(); + message.extensionSignature = object.extensionSignature ?? new Uint8Array(); + message.blockIdFlag = object.blockIdFlag ?? 0; return message; }, fromAmino(object: ExtendedVoteInfoAmino): ExtendedVoteInfo { @@ -5613,19 +5997,23 @@ export const ExtendedVoteInfo = { if (object.validator !== undefined && object.validator !== null) { message.validator = Validator.fromAmino(object.validator); } - if (object.signed_last_block !== undefined && object.signed_last_block !== null) { - message.signedLastBlock = object.signed_last_block; - } if (object.vote_extension !== undefined && object.vote_extension !== null) { message.voteExtension = bytesFromBase64(object.vote_extension); } + if (object.extension_signature !== undefined && object.extension_signature !== null) { + message.extensionSignature = bytesFromBase64(object.extension_signature); + } + if (object.block_id_flag !== undefined && object.block_id_flag !== null) { + message.blockIdFlag = object.block_id_flag; + } return message; }, toAmino(message: ExtendedVoteInfo): ExtendedVoteInfoAmino { const obj: any = {}; obj.validator = message.validator ? Validator.toAmino(message.validator) : undefined; - obj.signed_last_block = message.signedLastBlock === false ? undefined : message.signedLastBlock; obj.vote_extension = message.voteExtension ? base64FromBytes(message.voteExtension) : undefined; + obj.extension_signature = message.extensionSignature ? base64FromBytes(message.extensionSignature) : undefined; + obj.block_id_flag = message.blockIdFlag === 0 ? undefined : message.blockIdFlag; return obj; }, fromAminoMsg(object: ExtendedVoteInfoAminoMsg): ExtendedVoteInfo { diff --git a/packages/api/src/tendermint/bundle.ts b/packages/api/src/tendermint/bundle.ts index d1549c62..ac206282 100644 --- a/packages/api/src/tendermint/bundle.ts +++ b/packages/api/src/tendermint/bundle.ts @@ -1,39 +1,39 @@ //@ts-nocheck -import * as _109 from "./abci/types"; -import * as _110 from "./crypto/keys"; -import * as _111 from "./crypto/proof"; -import * as _112 from "./libs/bits/types"; -import * as _113 from "./p2p/types"; -import * as _114 from "./types/block"; -import * as _115 from "./types/evidence"; -import * as _116 from "./types/params"; -import * as _117 from "./types/types"; -import * as _118 from "./types/validator"; -import * as _119 from "./version/types"; +import * as _165 from "./abci/types"; +import * as _166 from "./crypto/keys"; +import * as _167 from "./crypto/proof"; +import * as _168 from "./libs/bits/types"; +import * as _169 from "./p2p/types"; +import * as _170 from "./types/block"; +import * as _171 from "./types/evidence"; +import * as _172 from "./types/params"; +import * as _173 from "./types/types"; +import * as _174 from "./types/validator"; +import * as _175 from "./version/types"; export namespace tendermint { export const abci = { - ..._109 + ..._165 }; export const crypto = { - ..._110, - ..._111 + ..._166, + ..._167 }; export namespace libs { export const bits = { - ..._112 + ..._168 }; } export const p2p = { - ..._113 + ..._169 }; export const types = { - ..._114, - ..._115, - ..._116, - ..._117, - ..._118 + ..._170, + ..._171, + ..._172, + ..._173, + ..._174 }; export const version = { - ..._119 + ..._175 }; } \ No newline at end of file diff --git a/packages/api/src/tendermint/types/params.ts b/packages/api/src/tendermint/types/params.ts index d997fa73..4b5209b2 100644 --- a/packages/api/src/tendermint/types/params.ts +++ b/packages/api/src/tendermint/types/params.ts @@ -10,6 +10,7 @@ export interface ConsensusParams { evidence?: EvidenceParams; validator?: ValidatorParams; version?: VersionParams; + abci?: ABCIParams; } export interface ConsensusParamsProtoMsg { typeUrl: "/tendermint.types.ConsensusParams"; @@ -24,6 +25,7 @@ export interface ConsensusParamsAmino { evidence?: EvidenceParamsAmino; validator?: ValidatorParamsAmino; version?: VersionParamsAmino; + abci?: ABCIParamsAmino; } export interface ConsensusParamsAminoMsg { type: "/tendermint.types.ConsensusParams"; @@ -38,6 +40,7 @@ export interface ConsensusParamsSDKType { evidence?: EvidenceParamsSDKType; validator?: ValidatorParamsSDKType; version?: VersionParamsSDKType; + abci?: ABCIParamsSDKType; } /** BlockParams contains limits on the block size. */ export interface BlockParams { @@ -224,12 +227,55 @@ export interface HashedParamsSDKType { block_max_bytes: bigint; block_max_gas: bigint; } +/** ABCIParams configure functionality specific to the Application Blockchain Interface. */ +export interface ABCIParams { + /** + * vote_extensions_enable_height configures the first height during which + * vote extensions will be enabled. During this specified height, and for all + * subsequent heights, precommit messages that do not contain valid extension data + * will be considered invalid. Prior to this height, vote extensions will not + * be used or accepted by validators on the network. + * + * Once enabled, vote extensions will be created by the application in ExtendVote, + * passed to the application for validation in VerifyVoteExtension and given + * to the application to use when proposing a block during PrepareProposal. + */ + voteExtensionsEnableHeight: bigint; +} +export interface ABCIParamsProtoMsg { + typeUrl: "/tendermint.types.ABCIParams"; + value: Uint8Array; +} +/** ABCIParams configure functionality specific to the Application Blockchain Interface. */ +export interface ABCIParamsAmino { + /** + * vote_extensions_enable_height configures the first height during which + * vote extensions will be enabled. During this specified height, and for all + * subsequent heights, precommit messages that do not contain valid extension data + * will be considered invalid. Prior to this height, vote extensions will not + * be used or accepted by validators on the network. + * + * Once enabled, vote extensions will be created by the application in ExtendVote, + * passed to the application for validation in VerifyVoteExtension and given + * to the application to use when proposing a block during PrepareProposal. + */ + vote_extensions_enable_height?: string; +} +export interface ABCIParamsAminoMsg { + type: "/tendermint.types.ABCIParams"; + value: ABCIParamsAmino; +} +/** ABCIParams configure functionality specific to the Application Blockchain Interface. */ +export interface ABCIParamsSDKType { + vote_extensions_enable_height: bigint; +} function createBaseConsensusParams(): ConsensusParams { return { block: undefined, evidence: undefined, validator: undefined, - version: undefined + version: undefined, + abci: undefined }; } export const ConsensusParams = { @@ -247,6 +293,9 @@ export const ConsensusParams = { if (message.version !== undefined) { VersionParams.encode(message.version, writer.uint32(34).fork()).ldelim(); } + if (message.abci !== undefined) { + ABCIParams.encode(message.abci, writer.uint32(42).fork()).ldelim(); + } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): ConsensusParams { @@ -268,6 +317,9 @@ export const ConsensusParams = { case 4: message.version = VersionParams.decode(reader, reader.uint32()); break; + case 5: + message.abci = ABCIParams.decode(reader, reader.uint32()); + break; default: reader.skipType(tag & 7); break; @@ -281,6 +333,7 @@ export const ConsensusParams = { message.evidence = object.evidence !== undefined && object.evidence !== null ? EvidenceParams.fromPartial(object.evidence) : undefined; message.validator = object.validator !== undefined && object.validator !== null ? ValidatorParams.fromPartial(object.validator) : undefined; message.version = object.version !== undefined && object.version !== null ? VersionParams.fromPartial(object.version) : undefined; + message.abci = object.abci !== undefined && object.abci !== null ? ABCIParams.fromPartial(object.abci) : undefined; return message; }, fromAmino(object: ConsensusParamsAmino): ConsensusParams { @@ -297,6 +350,9 @@ export const ConsensusParams = { if (object.version !== undefined && object.version !== null) { message.version = VersionParams.fromAmino(object.version); } + if (object.abci !== undefined && object.abci !== null) { + message.abci = ABCIParams.fromAmino(object.abci); + } return message; }, toAmino(message: ConsensusParams): ConsensusParamsAmino { @@ -305,6 +361,7 @@ export const ConsensusParams = { obj.evidence = message.evidence ? EvidenceParams.toAmino(message.evidence) : undefined; obj.validator = message.validator ? ValidatorParams.toAmino(message.validator) : undefined; obj.version = message.version ? VersionParams.toAmino(message.version) : undefined; + obj.abci = message.abci ? ABCIParams.toAmino(message.abci) : undefined; return obj; }, fromAminoMsg(object: ConsensusParamsAminoMsg): ConsensusParams { @@ -687,4 +744,67 @@ export const HashedParams = { value: HashedParams.encode(message).finish() }; } +}; +function createBaseABCIParams(): ABCIParams { + return { + voteExtensionsEnableHeight: BigInt(0) + }; +} +export const ABCIParams = { + typeUrl: "/tendermint.types.ABCIParams", + encode(message: ABCIParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.voteExtensionsEnableHeight !== BigInt(0)) { + writer.uint32(8).int64(message.voteExtensionsEnableHeight); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ABCIParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseABCIParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.voteExtensionsEnableHeight = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): ABCIParams { + const message = createBaseABCIParams(); + message.voteExtensionsEnableHeight = object.voteExtensionsEnableHeight !== undefined && object.voteExtensionsEnableHeight !== null ? BigInt(object.voteExtensionsEnableHeight.toString()) : BigInt(0); + return message; + }, + fromAmino(object: ABCIParamsAmino): ABCIParams { + const message = createBaseABCIParams(); + if (object.vote_extensions_enable_height !== undefined && object.vote_extensions_enable_height !== null) { + message.voteExtensionsEnableHeight = BigInt(object.vote_extensions_enable_height); + } + return message; + }, + toAmino(message: ABCIParams): ABCIParamsAmino { + const obj: any = {}; + obj.vote_extensions_enable_height = message.voteExtensionsEnableHeight !== BigInt(0) ? message.voteExtensionsEnableHeight?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ABCIParamsAminoMsg): ABCIParams { + return ABCIParams.fromAmino(object.value); + }, + fromProtoMsg(message: ABCIParamsProtoMsg): ABCIParams { + return ABCIParams.decode(message.value); + }, + toProto(message: ABCIParams): Uint8Array { + return ABCIParams.encode(message).finish(); + }, + toProtoMsg(message: ABCIParams): ABCIParamsProtoMsg { + return { + typeUrl: "/tendermint.types.ABCIParams", + value: ABCIParams.encode(message).finish() + }; + } }; \ No newline at end of file diff --git a/packages/api/src/tendermint/types/types.ts b/packages/api/src/tendermint/types/types.ts index 4c8aa860..fc3b09eb 100644 --- a/packages/api/src/tendermint/types/types.ts +++ b/packages/api/src/tendermint/types/types.ts @@ -2,54 +2,9 @@ import { Proof, ProofAmino, ProofSDKType } from "../crypto/proof"; import { Consensus, ConsensusAmino, ConsensusSDKType } from "../version/types"; import { Timestamp } from "../../google/protobuf/timestamp"; -import { ValidatorSet, ValidatorSetAmino, ValidatorSetSDKType } from "./validator"; +import { BlockIDFlag, ValidatorSet, ValidatorSetAmino, ValidatorSetSDKType } from "./validator"; import { BinaryReader, BinaryWriter } from "../../binary"; import { bytesFromBase64, base64FromBytes, toTimestamp, fromTimestamp } from "../../helpers"; -/** BlockIdFlag indicates which BlcokID the signature is for */ -export enum BlockIDFlag { - BLOCK_ID_FLAG_UNKNOWN = 0, - BLOCK_ID_FLAG_ABSENT = 1, - BLOCK_ID_FLAG_COMMIT = 2, - BLOCK_ID_FLAG_NIL = 3, - UNRECOGNIZED = -1, -} -export const BlockIDFlagSDKType = BlockIDFlag; -export const BlockIDFlagAmino = BlockIDFlag; -export function blockIDFlagFromJSON(object: any): BlockIDFlag { - switch (object) { - case 0: - case "BLOCK_ID_FLAG_UNKNOWN": - return BlockIDFlag.BLOCK_ID_FLAG_UNKNOWN; - case 1: - case "BLOCK_ID_FLAG_ABSENT": - return BlockIDFlag.BLOCK_ID_FLAG_ABSENT; - case 2: - case "BLOCK_ID_FLAG_COMMIT": - return BlockIDFlag.BLOCK_ID_FLAG_COMMIT; - case 3: - case "BLOCK_ID_FLAG_NIL": - return BlockIDFlag.BLOCK_ID_FLAG_NIL; - case -1: - case "UNRECOGNIZED": - default: - return BlockIDFlag.UNRECOGNIZED; - } -} -export function blockIDFlagToJSON(object: BlockIDFlag): string { - switch (object) { - case BlockIDFlag.BLOCK_ID_FLAG_UNKNOWN: - return "BLOCK_ID_FLAG_UNKNOWN"; - case BlockIDFlag.BLOCK_ID_FLAG_ABSENT: - return "BLOCK_ID_FLAG_ABSENT"; - case BlockIDFlag.BLOCK_ID_FLAG_COMMIT: - return "BLOCK_ID_FLAG_COMMIT"; - case BlockIDFlag.BLOCK_ID_FLAG_NIL: - return "BLOCK_ID_FLAG_NIL"; - case BlockIDFlag.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} /** SignedMsgType is a type of signed message in the consensus. */ export enum SignedMsgType { SIGNED_MSG_TYPE_UNKNOWN = 0, @@ -278,43 +233,75 @@ export interface DataSDKType { txs: Uint8Array[]; } /** - * Vote represents a prevote, precommit, or commit vote from validators for + * Vote represents a prevote or precommit vote from validators for * consensus. */ export interface Vote { type: SignedMsgType; height: bigint; round: number; + /** zero if vote is nil. */ blockId: BlockID; timestamp: Date; validatorAddress: Uint8Array; validatorIndex: number; + /** + * Vote signature by the validator if they participated in consensus for the + * associated block. + */ signature: Uint8Array; + /** + * Vote extension provided by the application. Only valid for precommit + * messages. + */ + extension: Uint8Array; + /** + * Vote extension signature by the validator if they participated in + * consensus for the associated block. + * Only valid for precommit messages. + */ + extensionSignature: Uint8Array; } export interface VoteProtoMsg { typeUrl: "/tendermint.types.Vote"; value: Uint8Array; } /** - * Vote represents a prevote, precommit, or commit vote from validators for + * Vote represents a prevote or precommit vote from validators for * consensus. */ export interface VoteAmino { type?: SignedMsgType; height?: string; round?: number; + /** zero if vote is nil. */ block_id?: BlockIDAmino; timestamp?: string; validator_address?: string; validator_index?: number; + /** + * Vote signature by the validator if they participated in consensus for the + * associated block. + */ signature?: string; + /** + * Vote extension provided by the application. Only valid for precommit + * messages. + */ + extension?: string; + /** + * Vote extension signature by the validator if they participated in + * consensus for the associated block. + * Only valid for precommit messages. + */ + extension_signature?: string; } export interface VoteAminoMsg { type: "/tendermint.types.Vote"; value: VoteAmino; } /** - * Vote represents a prevote, precommit, or commit vote from validators for + * Vote represents a prevote or precommit vote from validators for * consensus. */ export interface VoteSDKType { @@ -326,6 +313,8 @@ export interface VoteSDKType { validator_address: Uint8Array; validator_index: number; signature: Uint8Array; + extension: Uint8Array; + extension_signature: Uint8Array; } /** Commit contains the evidence that a block was committed by a set of validators. */ export interface Commit { @@ -385,6 +374,83 @@ export interface CommitSigSDKType { timestamp: Date; signature: Uint8Array; } +export interface ExtendedCommit { + height: bigint; + round: number; + blockId: BlockID; + extendedSignatures: ExtendedCommitSig[]; +} +export interface ExtendedCommitProtoMsg { + typeUrl: "/tendermint.types.ExtendedCommit"; + value: Uint8Array; +} +export interface ExtendedCommitAmino { + height?: string; + round?: number; + block_id?: BlockIDAmino; + extended_signatures?: ExtendedCommitSigAmino[]; +} +export interface ExtendedCommitAminoMsg { + type: "/tendermint.types.ExtendedCommit"; + value: ExtendedCommitAmino; +} +export interface ExtendedCommitSDKType { + height: bigint; + round: number; + block_id: BlockIDSDKType; + extended_signatures: ExtendedCommitSigSDKType[]; +} +/** + * ExtendedCommitSig retains all the same fields as CommitSig but adds vote + * extension-related fields. We use two signatures to ensure backwards compatibility. + * That is the digest of the original signature is still the same in prior versions + */ +export interface ExtendedCommitSig { + blockIdFlag: BlockIDFlag; + validatorAddress: Uint8Array; + timestamp: Date; + signature: Uint8Array; + /** Vote extension data */ + extension: Uint8Array; + /** Vote extension signature */ + extensionSignature: Uint8Array; +} +export interface ExtendedCommitSigProtoMsg { + typeUrl: "/tendermint.types.ExtendedCommitSig"; + value: Uint8Array; +} +/** + * ExtendedCommitSig retains all the same fields as CommitSig but adds vote + * extension-related fields. We use two signatures to ensure backwards compatibility. + * That is the digest of the original signature is still the same in prior versions + */ +export interface ExtendedCommitSigAmino { + block_id_flag?: BlockIDFlag; + validator_address?: string; + timestamp?: string; + signature?: string; + /** Vote extension data */ + extension?: string; + /** Vote extension signature */ + extension_signature?: string; +} +export interface ExtendedCommitSigAminoMsg { + type: "/tendermint.types.ExtendedCommitSig"; + value: ExtendedCommitSigAmino; +} +/** + * ExtendedCommitSig retains all the same fields as CommitSig but adds vote + * extension-related fields. We use two signatures to ensure backwards compatibility. + * That is the digest of the original signature is still the same in prior versions + */ +export interface ExtendedCommitSigSDKType { + block_id_flag: BlockIDFlag; + validator_address: Uint8Array; + timestamp: Date; + signature: Uint8Array; + extension: Uint8Array; + extension_signature: Uint8Array; +} export interface Proposal { type: SignedMsgType; height: bigint; @@ -1042,7 +1108,9 @@ function createBaseVote(): Vote { timestamp: new Date(), validatorAddress: new Uint8Array(), validatorIndex: 0, - signature: new Uint8Array() + signature: new Uint8Array(), + extension: new Uint8Array(), + extensionSignature: new Uint8Array() }; } export const Vote = { @@ -1072,6 +1140,12 @@ export const Vote = { if (message.signature.length !== 0) { writer.uint32(66).bytes(message.signature); } + if (message.extension.length !== 0) { + writer.uint32(74).bytes(message.extension); + } + if (message.extensionSignature.length !== 0) { + writer.uint32(82).bytes(message.extensionSignature); + } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): Vote { @@ -1105,6 +1179,12 @@ export const Vote = { case 8: message.signature = reader.bytes(); break; + case 9: + message.extension = reader.bytes(); + break; + case 10: + message.extensionSignature = reader.bytes(); + break; default: reader.skipType(tag & 7); break; @@ -1122,6 +1202,8 @@ export const Vote = { message.validatorAddress = object.validatorAddress ?? new Uint8Array(); message.validatorIndex = object.validatorIndex ?? 0; message.signature = object.signature ?? new Uint8Array(); + message.extension = object.extension ?? new Uint8Array(); + message.extensionSignature = object.extensionSignature ?? new Uint8Array(); return message; }, fromAmino(object: VoteAmino): Vote { @@ -1150,6 +1232,12 @@ export const Vote = { if (object.signature !== undefined && object.signature !== null) { message.signature = bytesFromBase64(object.signature); } + if (object.extension !== undefined && object.extension !== null) { + message.extension = bytesFromBase64(object.extension); + } + if (object.extension_signature !== undefined && object.extension_signature !== null) { + message.extensionSignature = bytesFromBase64(object.extension_signature); + } return message; }, toAmino(message: Vote): VoteAmino { @@ -1162,6 +1250,8 @@ export const Vote = { obj.validator_address = message.validatorAddress ? base64FromBytes(message.validatorAddress) : undefined; obj.validator_index = message.validatorIndex === 0 ? undefined : message.validatorIndex; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; + obj.extension = message.extension ? base64FromBytes(message.extension) : undefined; + obj.extension_signature = message.extensionSignature ? base64FromBytes(message.extensionSignature) : undefined; return obj; }, fromAminoMsg(object: VoteAminoMsg): Vote { @@ -1380,6 +1470,230 @@ export const CommitSig = { }; } }; +function createBaseExtendedCommit(): ExtendedCommit { + return { + height: BigInt(0), + round: 0, + blockId: BlockID.fromPartial({}), + extendedSignatures: [] + }; +} +export const ExtendedCommit = { + typeUrl: "/tendermint.types.ExtendedCommit", + encode(message: ExtendedCommit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.height !== BigInt(0)) { + writer.uint32(8).int64(message.height); + } + if (message.round !== 0) { + writer.uint32(16).int32(message.round); + } + if (message.blockId !== undefined) { + BlockID.encode(message.blockId, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.extendedSignatures) { + ExtendedCommitSig.encode(v!, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ExtendedCommit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtendedCommit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = reader.int64(); + break; + case 2: + message.round = reader.int32(); + break; + case 3: + message.blockId = BlockID.decode(reader, reader.uint32()); + break; + case 4: + message.extendedSignatures.push(ExtendedCommitSig.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): ExtendedCommit { + const message = createBaseExtendedCommit(); + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + message.round = object.round ?? 0; + message.blockId = object.blockId !== undefined && object.blockId !== null ? BlockID.fromPartial(object.blockId) : undefined; + message.extendedSignatures = object.extendedSignatures?.map(e => ExtendedCommitSig.fromPartial(e)) || []; + return message; + }, + fromAmino(object: ExtendedCommitAmino): ExtendedCommit { + const message = createBaseExtendedCommit(); + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.round !== undefined && object.round !== null) { + message.round = object.round; + } + if (object.block_id !== undefined && object.block_id !== null) { + message.blockId = BlockID.fromAmino(object.block_id); + } + message.extendedSignatures = object.extended_signatures?.map(e => ExtendedCommitSig.fromAmino(e)) || []; + return message; + }, + toAmino(message: ExtendedCommit): ExtendedCommitAmino { + const obj: any = {}; + obj.height = message.height !== BigInt(0) ? message.height?.toString() : undefined; + obj.round = message.round === 0 ? undefined : message.round; + obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; + if (message.extendedSignatures) { + obj.extended_signatures = message.extendedSignatures.map(e => e ? ExtendedCommitSig.toAmino(e) : undefined); + } else { + obj.extended_signatures = message.extendedSignatures; + } + return obj; + }, + fromAminoMsg(object: ExtendedCommitAminoMsg): ExtendedCommit { + return ExtendedCommit.fromAmino(object.value); + }, + fromProtoMsg(message: ExtendedCommitProtoMsg): ExtendedCommit { + return ExtendedCommit.decode(message.value); + }, + toProto(message: ExtendedCommit): Uint8Array { + return ExtendedCommit.encode(message).finish(); + }, + toProtoMsg(message: ExtendedCommit): ExtendedCommitProtoMsg { + return { + typeUrl: "/tendermint.types.ExtendedCommit", + value: ExtendedCommit.encode(message).finish() + }; + } +}; +function createBaseExtendedCommitSig(): ExtendedCommitSig { + return { + blockIdFlag: 0, + validatorAddress: new Uint8Array(), + timestamp: new Date(), + signature: new Uint8Array(), + extension: new Uint8Array(), + extensionSignature: new Uint8Array() + }; +} +export const ExtendedCommitSig = { + typeUrl: "/tendermint.types.ExtendedCommitSig", + encode(message: ExtendedCommitSig, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.blockIdFlag !== 0) { + writer.uint32(8).int32(message.blockIdFlag); + } + if (message.validatorAddress.length !== 0) { + writer.uint32(18).bytes(message.validatorAddress); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(26).fork()).ldelim(); + } + if (message.signature.length !== 0) { + writer.uint32(34).bytes(message.signature); + } + if (message.extension.length !== 0) { + writer.uint32(42).bytes(message.extension); + } + if (message.extensionSignature.length !== 0) { + writer.uint32(50).bytes(message.extensionSignature); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ExtendedCommitSig { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtendedCommitSig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.blockIdFlag = (reader.int32() as any); + break; + case 2: + message.validatorAddress = reader.bytes(); + break; + case 3: + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 4: + message.signature = reader.bytes(); + break; + case 5: + message.extension = reader.bytes(); + break; + case 6: + message.extensionSignature = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: Partial): ExtendedCommitSig { + const message = createBaseExtendedCommitSig(); + message.blockIdFlag = object.blockIdFlag ?? 0; + message.validatorAddress = object.validatorAddress ?? new Uint8Array(); + message.timestamp = object.timestamp ?? undefined; + message.signature = object.signature ?? new Uint8Array(); + message.extension = object.extension ?? new Uint8Array(); + message.extensionSignature = object.extensionSignature ?? new Uint8Array(); + return message; + }, + fromAmino(object: ExtendedCommitSigAmino): ExtendedCommitSig { + const message = createBaseExtendedCommitSig(); + if (object.block_id_flag !== undefined && object.block_id_flag !== null) { + message.blockIdFlag = object.block_id_flag; + } + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = bytesFromBase64(object.validator_address); + } + if (object.timestamp !== undefined && object.timestamp !== null) { + message.timestamp = fromTimestamp(Timestamp.fromAmino(object.timestamp)); + } + if (object.signature !== undefined && object.signature !== null) { + message.signature = bytesFromBase64(object.signature); + } + if (object.extension !== undefined && object.extension !== null) { + message.extension = bytesFromBase64(object.extension); + } + if (object.extension_signature !== undefined && object.extension_signature !== null) { + message.extensionSignature = bytesFromBase64(object.extension_signature); + } + return message; + }, + toAmino(message: ExtendedCommitSig): ExtendedCommitSigAmino { + const obj: any = {}; + obj.block_id_flag = message.blockIdFlag === 0 ? undefined : message.blockIdFlag; + obj.validator_address = message.validatorAddress ? base64FromBytes(message.validatorAddress) : undefined; + obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; + obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; + obj.extension = message.extension ? base64FromBytes(message.extension) : undefined; + obj.extension_signature = message.extensionSignature ? base64FromBytes(message.extensionSignature) : undefined; + return obj; + }, + fromAminoMsg(object: ExtendedCommitSigAminoMsg): ExtendedCommitSig { + return ExtendedCommitSig.fromAmino(object.value); + }, + fromProtoMsg(message: ExtendedCommitSigProtoMsg): ExtendedCommitSig { + return ExtendedCommitSig.decode(message.value); + }, + toProto(message: ExtendedCommitSig): Uint8Array { + return ExtendedCommitSig.encode(message).finish(); + }, + toProtoMsg(message: ExtendedCommitSig): ExtendedCommitSigProtoMsg { + return { + typeUrl: "/tendermint.types.ExtendedCommitSig", + value: ExtendedCommitSig.encode(message).finish() + }; + } +}; function createBaseProposal(): Proposal { return { type: 0, diff --git a/packages/api/src/tendermint/types/validator.ts b/packages/api/src/tendermint/types/validator.ts index 79da5a4b..33294cb3 100644 --- a/packages/api/src/tendermint/types/validator.ts +++ b/packages/api/src/tendermint/types/validator.ts @@ -2,6 +2,54 @@ import { PublicKey, PublicKeyAmino, PublicKeySDKType } from "../crypto/keys"; import { BinaryReader, BinaryWriter } from "../../binary"; import { bytesFromBase64, base64FromBytes } from "../../helpers"; +/** BlockIdFlag indicates which BlockID the signature is for */ +export enum BlockIDFlag { + /** BLOCK_ID_FLAG_UNKNOWN - indicates an error condition */ + BLOCK_ID_FLAG_UNKNOWN = 0, + /** BLOCK_ID_FLAG_ABSENT - the vote was not received */ + BLOCK_ID_FLAG_ABSENT = 1, + BLOCK_ID_FLAG_COMMIT = 2, + /** BLOCK_ID_FLAG_NIL - voted for nil */ + BLOCK_ID_FLAG_NIL = 3, + UNRECOGNIZED = -1, +} +export const BlockIDFlagSDKType = BlockIDFlag; +export const BlockIDFlagAmino = BlockIDFlag; +export function blockIDFlagFromJSON(object: any): BlockIDFlag { + switch (object) { + case 0: + case "BLOCK_ID_FLAG_UNKNOWN": + return BlockIDFlag.BLOCK_ID_FLAG_UNKNOWN; + case 1: + case "BLOCK_ID_FLAG_ABSENT": + return BlockIDFlag.BLOCK_ID_FLAG_ABSENT; + case 2: + case "BLOCK_ID_FLAG_COMMIT": + return BlockIDFlag.BLOCK_ID_FLAG_COMMIT; + case 3: + case "BLOCK_ID_FLAG_NIL": + return BlockIDFlag.BLOCK_ID_FLAG_NIL; + case -1: + case "UNRECOGNIZED": + default: + return BlockIDFlag.UNRECOGNIZED; + } +} +export function blockIDFlagToJSON(object: BlockIDFlag): string { + switch (object) { + case BlockIDFlag.BLOCK_ID_FLAG_UNKNOWN: + return "BLOCK_ID_FLAG_UNKNOWN"; + case BlockIDFlag.BLOCK_ID_FLAG_ABSENT: + return "BLOCK_ID_FLAG_ABSENT"; + case BlockIDFlag.BLOCK_ID_FLAG_COMMIT: + return "BLOCK_ID_FLAG_COMMIT"; + case BlockIDFlag.BLOCK_ID_FLAG_NIL: + return "BLOCK_ID_FLAG_NIL"; + case BlockIDFlag.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} export interface ValidatorSet { validators: Validator[]; proposer?: Validator;