From 5596b54dae57fe821395594ad6c0d4f08b95a11e Mon Sep 17 00:00:00 2001 From: Raul Bernal Date: Fri, 8 Mar 2024 16:40:31 +0100 Subject: [PATCH 01/37] Burn module & custom burn message --- app/app.go | 22 + docs/static/openapi.yml | 590 ++++++----- proto/bcna/burn/genesis.proto | 12 + proto/bcna/burn/params.proto | 12 + proto/bcna/burn/query.proto | 26 + proto/bcna/burn/tx.proto | 20 + testutil/keeper/burn.go | 53 + vue/src/store/generated/bcna.burn/index.ts | 161 +++ .../bitcannaglobal.bcna.bcna/index.ts | 453 ++++++++ .../generated/cosmos.auth.v1beta1/index.ts | 409 ++++++++ .../generated/cosmos.authz.v1beta1/index.ts | 295 ++++++ .../generated/cosmos.bank.v1beta1/index.ts | 532 ++++++++++ .../cosmos.base.node.v1beta1/index.ts | 132 +++ .../cosmos.base.tendermint.v1beta1/index.ts | 332 ++++++ .../generated/cosmos.consensus.v1/index.ts | 159 +++ .../generated/cosmos.crisis.v1beta1/index.ts | 157 +++ .../cosmos.distribution.v1beta1/index.ts | 597 +++++++++++ .../cosmos.evidence.v1beta1/index.ts | 198 ++++ .../cosmos.feegrant.v1beta1/index.ts | 260 +++++ .../store/generated/cosmos.gov.v1/index.ts | 500 +++++++++ .../generated/cosmos.gov.v1beta1/index.ts | 473 +++++++++ .../store/generated/cosmos.group.v1/index.ts | 965 ++++++++++++++++++ .../generated/cosmos.mint.v1beta1/index.ts | 194 ++++ .../generated/cosmos.nft.v1beta1/index.ts | 326 ++++++ .../generated/cosmos.params.v1beta1/index.ts | 171 ++++ .../cosmos.slashing.v1beta1/index.ts | 231 +++++ .../generated/cosmos.staking.v1beta1/index.ts | 747 ++++++++++++++ .../generated/cosmos.tx.v1beta1/index.ts | 398 ++++++++ .../generated/cosmos.upgrade.v1beta1/index.ts | 314 ++++++ .../generated/cosmos.vesting.v1beta1/index.ts | 196 ++++ .../index.ts | 163 +++ .../index.ts | 134 +++ .../ibc.applications.transfer.v1/index.ts | 316 ++++++ .../generated/ibc.core.channel.v1/index.ts | 512 ++++++++++ .../generated/ibc.core.client.v1/index.ts | 398 ++++++++ .../generated/ibc.core.connection.v1/index.ts | 295 ++++++ vue/src/store/generated/index.ts | 83 ++ vue/src/store/generated/local-check.js | 15 + vue/src/store/generated/package.json | 34 + vue/src/store/generated/postinstall.js | 9 + vue/src/store/generated/tsconfig.json | 11 + x/burn/client/cli/query.go | 31 + x/burn/client/cli/query_params.go | 36 + x/burn/client/cli/tx.go | 37 + x/burn/client/cli/tx_burn_coins_action.go | 46 + x/burn/genesis.go | 23 + x/burn/genesis_test.go | 29 + x/burn/keeper/keeper.go | 51 + x/burn/keeper/msg_server.go | 17 + x/burn/keeper/msg_server_burn_coins_action.go | 28 + x/burn/keeper/msg_server_test.go | 23 + x/burn/keeper/params.go | 16 + x/burn/keeper/params_test.go | 18 + x/burn/keeper/query.go | 7 + x/burn/keeper/query_params.go | 19 + x/burn/keeper/query_params_test.go | 21 + x/burn/module.go | 148 +++ x/burn/module_simulation.go | 87 ++ x/burn/simulation/burn_coins_action.go | 29 + x/burn/simulation/helpers.go | 15 + x/burn/types/codec.go | 27 + x/burn/types/errors.go | 12 + x/burn/types/expected_keepers.go | 20 + x/burn/types/genesis.go | 24 + x/burn/types/genesis.pb.go | 321 ++++++ x/burn/types/genesis_test.go | 41 + x/burn/types/keys.go | 19 + x/burn/types/message_burn_coins_action.go | 46 + .../types/message_burn_coins_action_test.go | 40 + x/burn/types/params.go | 39 + x/burn/types/params.pb.go | 264 +++++ x/burn/types/query.pb.go | 537 ++++++++++ x/burn/types/query.pb.gw.go | 153 +++ x/burn/types/tx.pb.go | 590 +++++++++++ x/burn/types/types.go | 1 + 75 files changed, 13449 insertions(+), 271 deletions(-) create mode 100644 proto/bcna/burn/genesis.proto create mode 100644 proto/bcna/burn/params.proto create mode 100644 proto/bcna/burn/query.proto create mode 100644 proto/bcna/burn/tx.proto create mode 100644 testutil/keeper/burn.go create mode 100755 vue/src/store/generated/bcna.burn/index.ts create mode 100755 vue/src/store/generated/bitcannaglobal.bcna.bcna/index.ts create mode 100755 vue/src/store/generated/cosmos.auth.v1beta1/index.ts create mode 100755 vue/src/store/generated/cosmos.authz.v1beta1/index.ts create mode 100755 vue/src/store/generated/cosmos.bank.v1beta1/index.ts create mode 100755 vue/src/store/generated/cosmos.base.node.v1beta1/index.ts create mode 100755 vue/src/store/generated/cosmos.base.tendermint.v1beta1/index.ts create mode 100755 vue/src/store/generated/cosmos.consensus.v1/index.ts create mode 100755 vue/src/store/generated/cosmos.crisis.v1beta1/index.ts create mode 100755 vue/src/store/generated/cosmos.distribution.v1beta1/index.ts create mode 100755 vue/src/store/generated/cosmos.evidence.v1beta1/index.ts create mode 100755 vue/src/store/generated/cosmos.feegrant.v1beta1/index.ts create mode 100755 vue/src/store/generated/cosmos.gov.v1/index.ts create mode 100755 vue/src/store/generated/cosmos.gov.v1beta1/index.ts create mode 100755 vue/src/store/generated/cosmos.group.v1/index.ts create mode 100755 vue/src/store/generated/cosmos.mint.v1beta1/index.ts create mode 100755 vue/src/store/generated/cosmos.nft.v1beta1/index.ts create mode 100755 vue/src/store/generated/cosmos.params.v1beta1/index.ts create mode 100755 vue/src/store/generated/cosmos.slashing.v1beta1/index.ts create mode 100755 vue/src/store/generated/cosmos.staking.v1beta1/index.ts create mode 100755 vue/src/store/generated/cosmos.tx.v1beta1/index.ts create mode 100755 vue/src/store/generated/cosmos.upgrade.v1beta1/index.ts create mode 100755 vue/src/store/generated/cosmos.vesting.v1beta1/index.ts create mode 100755 vue/src/store/generated/ibc.applications.interchain_accounts.controller.v1/index.ts create mode 100755 vue/src/store/generated/ibc.applications.interchain_accounts.host.v1/index.ts create mode 100755 vue/src/store/generated/ibc.applications.transfer.v1/index.ts create mode 100755 vue/src/store/generated/ibc.core.channel.v1/index.ts create mode 100755 vue/src/store/generated/ibc.core.client.v1/index.ts create mode 100755 vue/src/store/generated/ibc.core.connection.v1/index.ts create mode 100755 vue/src/store/generated/index.ts create mode 100755 vue/src/store/generated/local-check.js create mode 100755 vue/src/store/generated/package.json create mode 100755 vue/src/store/generated/postinstall.js create mode 100755 vue/src/store/generated/tsconfig.json create mode 100644 x/burn/client/cli/query.go create mode 100644 x/burn/client/cli/query_params.go create mode 100644 x/burn/client/cli/tx.go create mode 100644 x/burn/client/cli/tx_burn_coins_action.go create mode 100644 x/burn/genesis.go create mode 100644 x/burn/genesis_test.go create mode 100644 x/burn/keeper/keeper.go create mode 100644 x/burn/keeper/msg_server.go create mode 100644 x/burn/keeper/msg_server_burn_coins_action.go create mode 100644 x/burn/keeper/msg_server_test.go create mode 100644 x/burn/keeper/params.go create mode 100644 x/burn/keeper/params_test.go create mode 100644 x/burn/keeper/query.go create mode 100644 x/burn/keeper/query_params.go create mode 100644 x/burn/keeper/query_params_test.go create mode 100644 x/burn/module.go create mode 100644 x/burn/module_simulation.go create mode 100644 x/burn/simulation/burn_coins_action.go create mode 100644 x/burn/simulation/helpers.go create mode 100644 x/burn/types/codec.go create mode 100644 x/burn/types/errors.go create mode 100644 x/burn/types/expected_keepers.go create mode 100644 x/burn/types/genesis.go create mode 100644 x/burn/types/genesis.pb.go create mode 100644 x/burn/types/genesis_test.go create mode 100644 x/burn/types/keys.go create mode 100644 x/burn/types/message_burn_coins_action.go create mode 100644 x/burn/types/message_burn_coins_action_test.go create mode 100644 x/burn/types/params.go create mode 100644 x/burn/types/params.pb.go create mode 100644 x/burn/types/query.pb.go create mode 100644 x/burn/types/query.pb.gw.go create mode 100644 x/burn/types/tx.pb.go create mode 100644 x/burn/types/types.go diff --git a/app/app.go b/app/app.go index 6224e36e..66fe2cb0 100644 --- a/app/app.go +++ b/app/app.go @@ -119,6 +119,9 @@ import ( bcnamodule "github.com/BitCannaGlobal/bcna/x/bcna" bcnamodulekeeper "github.com/BitCannaGlobal/bcna/x/bcna/keeper" bcnamoduletypes "github.com/BitCannaGlobal/bcna/x/bcna/types" + burnmodule "github.com/BitCannaGlobal/bcna/x/burn" + burnmodulekeeper "github.com/BitCannaGlobal/bcna/x/burn/keeper" + burnmoduletypes "github.com/BitCannaGlobal/bcna/x/burn/types" appparams "github.com/BitCannaGlobal/bcna/app/params" "github.com/BitCannaGlobal/bcna/docs" @@ -176,6 +179,7 @@ var ( vesting.AppModuleBasic{}, consensus.AppModuleBasic{}, bcnamodule.AppModuleBasic{}, + burnmodule.AppModuleBasic{}, ) // module account permissions @@ -188,6 +192,7 @@ var ( stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, govtypes.ModuleName: {authtypes.Burner}, ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, + burnmoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner, authtypes.Staking}, // nft.ModuleName: nil, } ) @@ -253,6 +258,7 @@ type App struct { // Custom module keepers BcnaKeeper bcnamodulekeeper.Keeper + BurnKeeper burnmodulekeeper.Keeper // mm is the module manager mm *module.Manager @@ -315,6 +321,7 @@ func New( // nftkeeper.StoreKey, consensusparamtypes.StoreKey, bcnamoduletypes.StoreKey, + burnmoduletypes.StoreKey, ) tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey) memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey) @@ -568,6 +575,16 @@ func New( ) bcnaModule := bcnamodule.NewAppModule(appCodec, app.BcnaKeeper, app.AccountKeeper, app.BankKeeper) + app.BurnKeeper = *burnmodulekeeper.NewKeeper( + appCodec, + keys[burnmoduletypes.StoreKey], + keys[burnmoduletypes.MemStoreKey], + app.GetSubspace(burnmoduletypes.ModuleName), + + app.BankKeeper, + ) + burnModule := burnmodule.NewAppModule(appCodec, app.BurnKeeper, app.AccountKeeper, app.BankKeeper) + // Create static IBC router, add transfer route, then set and seal it ibcRouter := ibcporttypes.NewRouter() ibcRouter.AddRoute(icahosttypes.SubModuleName, icaHostIBCModule). @@ -625,6 +642,7 @@ func New( icaModule, consensus.NewAppModule(appCodec, app.ConsensusParamsKeeper), bcnaModule, + burnModule, ) // During begin block slashing happens after distr.BeginBlocker so that @@ -656,6 +674,7 @@ func New( vestingtypes.ModuleName, consensusparamtypes.ModuleName, bcnamoduletypes.ModuleName, + burnmoduletypes.ModuleName, ) app.mm.SetOrderEndBlockers( @@ -682,6 +701,7 @@ func New( vestingtypes.ModuleName, consensusparamtypes.ModuleName, bcnamoduletypes.ModuleName, + burnmoduletypes.ModuleName, ) // NOTE: The genutils module must occur after staking so that pools are @@ -713,6 +733,7 @@ func New( vestingtypes.ModuleName, consensusparamtypes.ModuleName, bcnamoduletypes.ModuleName, + burnmoduletypes.ModuleName, } app.mm.SetOrderInitGenesis(genesisModuleOrder...) app.mm.SetOrderExportGenesis(genesisModuleOrder...) @@ -942,6 +963,7 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino paramsKeeper.Subspace(icacontrollertypes.SubModuleName) paramsKeeper.Subspace(icahosttypes.SubModuleName) paramsKeeper.Subspace(bcnamoduletypes.ModuleName) + paramsKeeper.Subspace(burnmoduletypes.ModuleName) // paramsKeeper.Subspace(nft.ModuleName) return paramsKeeper diff --git a/docs/static/openapi.yml b/docs/static/openapi.yml index 8ad979f7..5e8022e5 100644 --- a/docs/static/openapi.yml +++ b/docs/static/openapi.yml @@ -4,6 +4,42 @@ info: name: '' description: '' paths: + /BitCannaGlobal/bcna/burn/params: + get: + summary: Parameters queries the parameters of the module. + operationId: BcnaBurnParams + responses: + '200': + description: A successful response. + schema: + type: object + properties: + params: + description: params holds all the parameters of this module. + type: object + description: >- + QueryParamsResponse is response type for the Query/Params RPC + method. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + tags: + - Query /BitCannaGlobal/bcna/bcna/bitcannaid: get: summary: Queries a list of Bitcannaid items. @@ -46883,280 +46919,30 @@ paths: tags: - Query definitions: - bitcannaglobal.bcna.bcna.Bitcannaid: + bcna.burn.MsgBurnCoinsActionResponse: type: object - properties: - id: - type: string - format: uint64 - bcnaid: - type: string - address: - type: string - creator: - type: string - bitcannaglobal.bcna.bcna.MsgCreateBitcannaidResponse: - type: object - properties: - id: - type: string - format: uint64 - bitcannaglobal.bcna.bcna.MsgCreateSupplychainResponse: - type: object - properties: - id: - type: string - format: uint64 - bitcannaglobal.bcna.bcna.MsgDeleteBitcannaidResponse: - type: object - bitcannaglobal.bcna.bcna.MsgDeleteSupplychainResponse: - type: object - bitcannaglobal.bcna.bcna.MsgUpdateBitcannaidResponse: - type: object - bitcannaglobal.bcna.bcna.MsgUpdateSupplychainResponse: - type: object - bitcannaglobal.bcna.bcna.Params: + bcna.burn.Params: type: object description: Params defines the parameters for the module. - bitcannaglobal.bcna.bcna.QueryAllBitcannaidResponse: - type: object - properties: - Bitcannaid: - type: array - items: - type: object - properties: - id: - type: string - format: uint64 - bcnaid: - type: string - address: - type: string - creator: - type: string - pagination: - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: |- - PageResponse is to be embedded in gRPC response messages where the - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - bitcannaglobal.bcna.bcna.QueryAllSupplychainResponse: - type: object - properties: - Supplychain: - type: array - items: - type: object - properties: - id: - type: string - format: uint64 - product: - type: string - info: - type: string - supplyinfo: - type: string - supplyextra: - type: string - creator: - type: string - pagination: - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: |- - PageResponse is to be embedded in gRPC response messages where the - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - bitcannaglobal.bcna.bcna.QueryGetBitcannaidByBcnaidResponse: - type: object - properties: - Bitcannaid: - type: object - properties: - id: - type: string - format: uint64 - bcnaid: - type: string - address: - type: string - creator: - type: string - bitcannaglobal.bcna.bcna.QueryGetBitcannaidResponse: - type: object - properties: - Bitcannaid: - type: object - properties: - id: - type: string - format: uint64 - bcnaid: - type: string - address: - type: string - creator: - type: string - bitcannaglobal.bcna.bcna.QueryGetSupplychainResponse: - type: object - properties: - Supplychain: - type: object - properties: - id: - type: string - format: uint64 - product: - type: string - info: - type: string - supplyinfo: - type: string - supplyextra: - type: string - creator: - type: string - bitcannaglobal.bcna.bcna.QueryParamsResponse: + bcna.burn.QueryParamsResponse: type: object properties: params: description: params holds all the parameters of this module. type: object description: QueryParamsResponse is response type for the Query/Params RPC method. - bitcannaglobal.bcna.bcna.Supplychain: - type: object - properties: - id: - type: string - format: uint64 - product: - type: string - info: - type: string - supplyinfo: - type: string - supplyextra: - type: string - creator: - type: string - cosmos.base.query.v1beta1.PageRequest: - type: object - properties: - key: - type: string - format: byte - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - offset: - type: string - format: uint64 - description: |- - offset is a numeric offset that can be used when key is unavailable. - It is less efficient than using key. Only one of offset or key should - be set. - limit: - type: string - format: uint64 - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - count_total: - type: boolean - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in UIs. - - count_total is only respected when offset is used. It is ignored when - key - - is set. - reverse: - type: boolean - description: >- - reverse is set to true if results are to be returned in the descending - order. - - - Since: cosmos-sdk 0.43 - description: |- - message SomeRequest { - Foo some_parameter = 1; - PageRequest pagination = 2; - } - title: |- - PageRequest is to be embedded in gRPC request messages for efficient - pagination. Ex: - cosmos.base.query.v1beta1.PageResponse: + cosmos.base.v1beta1.Coin: type: object properties: - next_key: + denom: type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: + amount: type: string - format: uint64 - title: |- - total is total number of results available if PageRequest.count_total - was set, its value is undefined otherwise description: |- - PageResponse is to be embedded in gRPC response messages where the - corresponding request message has used PageRequest. + Coin defines a token with a denomination and an amount. - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. google.protobuf.Any: type: object properties: @@ -47480,6 +47266,280 @@ definitions: "@type": "type.googleapis.com/google.protobuf.Duration", "value": "1.212s" } + bitcannaglobal.bcna.bcna.Bitcannaid: + type: object + properties: + id: + type: string + format: uint64 + bcnaid: + type: string + address: + type: string + creator: + type: string + bitcannaglobal.bcna.bcna.MsgCreateBitcannaidResponse: + type: object + properties: + id: + type: string + format: uint64 + bitcannaglobal.bcna.bcna.MsgCreateSupplychainResponse: + type: object + properties: + id: + type: string + format: uint64 + bitcannaglobal.bcna.bcna.MsgDeleteBitcannaidResponse: + type: object + bitcannaglobal.bcna.bcna.MsgDeleteSupplychainResponse: + type: object + bitcannaglobal.bcna.bcna.MsgUpdateBitcannaidResponse: + type: object + bitcannaglobal.bcna.bcna.MsgUpdateSupplychainResponse: + type: object + bitcannaglobal.bcna.bcna.Params: + type: object + description: Params defines the parameters for the module. + bitcannaglobal.bcna.bcna.QueryAllBitcannaidResponse: + type: object + properties: + Bitcannaid: + type: array + items: + type: object + properties: + id: + type: string + format: uint64 + bcnaid: + type: string + address: + type: string + creator: + type: string + pagination: + type: object + properties: + next_key: + type: string + format: byte + description: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently. It will be empty if + there are no more results. + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total + + was set, its value is undefined otherwise + description: |- + PageResponse is to be embedded in gRPC response messages where the + corresponding request message has used PageRequest. + + message SomeResponse { + repeated Bar results = 1; + PageResponse page = 2; + } + bitcannaglobal.bcna.bcna.QueryAllSupplychainResponse: + type: object + properties: + Supplychain: + type: array + items: + type: object + properties: + id: + type: string + format: uint64 + product: + type: string + info: + type: string + supplyinfo: + type: string + supplyextra: + type: string + creator: + type: string + pagination: + type: object + properties: + next_key: + type: string + format: byte + description: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently. It will be empty if + there are no more results. + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total + + was set, its value is undefined otherwise + description: |- + PageResponse is to be embedded in gRPC response messages where the + corresponding request message has used PageRequest. + + message SomeResponse { + repeated Bar results = 1; + PageResponse page = 2; + } + bitcannaglobal.bcna.bcna.QueryGetBitcannaidByBcnaidResponse: + type: object + properties: + Bitcannaid: + type: object + properties: + id: + type: string + format: uint64 + bcnaid: + type: string + address: + type: string + creator: + type: string + bitcannaglobal.bcna.bcna.QueryGetBitcannaidResponse: + type: object + properties: + Bitcannaid: + type: object + properties: + id: + type: string + format: uint64 + bcnaid: + type: string + address: + type: string + creator: + type: string + bitcannaglobal.bcna.bcna.QueryGetSupplychainResponse: + type: object + properties: + Supplychain: + type: object + properties: + id: + type: string + format: uint64 + product: + type: string + info: + type: string + supplyinfo: + type: string + supplyextra: + type: string + creator: + type: string + bitcannaglobal.bcna.bcna.QueryParamsResponse: + type: object + properties: + params: + description: params holds all the parameters of this module. + type: object + description: QueryParamsResponse is response type for the Query/Params RPC method. + bitcannaglobal.bcna.bcna.Supplychain: + type: object + properties: + id: + type: string + format: uint64 + product: + type: string + info: + type: string + supplyinfo: + type: string + supplyextra: + type: string + creator: + type: string + cosmos.base.query.v1beta1.PageRequest: + type: object + properties: + key: + type: string + format: byte + description: |- + key is a value returned in PageResponse.next_key to begin + querying the next page most efficiently. Only one of offset or key + should be set. + offset: + type: string + format: uint64 + description: |- + offset is a numeric offset that can be used when key is unavailable. + It is less efficient than using key. Only one of offset or key should + be set. + limit: + type: string + format: uint64 + description: >- + limit is the total number of results to be returned in the result + page. + + If left empty it will default to a value to be set by each app. + count_total: + type: boolean + description: >- + count_total is set to true to indicate that the result set should + include + + a count of the total number of items available for pagination in UIs. + + count_total is only respected when offset is used. It is ignored when + key + + is set. + reverse: + type: boolean + description: >- + reverse is set to true if results are to be returned in the descending + order. + + + Since: cosmos-sdk 0.43 + description: |- + message SomeRequest { + Foo some_parameter = 1; + PageRequest pagination = 2; + } + title: |- + PageRequest is to be embedded in gRPC request messages for efficient + pagination. Ex: + cosmos.base.query.v1beta1.PageResponse: + type: object + properties: + next_key: + type: string + format: byte + description: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently. It will be empty if + there are no more results. + total: + type: string + format: uint64 + title: |- + total is total number of results available if PageRequest.count_total + was set, its value is undefined otherwise + description: |- + PageResponse is to be embedded in gRPC response messages where the + corresponding request message has used PageRequest. + + message SomeResponse { + repeated Bar results = 1; + PageResponse page = 2; + } cosmos.auth.v1beta1.AddressBytesToStringResponse: type: object properties: @@ -50363,18 +50423,6 @@ definitions: description: |- SendEnabled maps coin denom to a send_enabled status (whether a denom is sendable). - cosmos.base.v1beta1.Coin: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. - - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. cosmos.base.node.v1beta1.ConfigResponse: type: object properties: diff --git a/proto/bcna/burn/genesis.proto b/proto/bcna/burn/genesis.proto new file mode 100644 index 00000000..86f87eaf --- /dev/null +++ b/proto/bcna/burn/genesis.proto @@ -0,0 +1,12 @@ +syntax = "proto3"; +package bcna.burn; + +import "gogoproto/gogo.proto"; +import "bcna/burn/params.proto"; + +option go_package = "github.com/BitCannaGlobal/bcna/x/burn/types"; + +// GenesisState defines the burn module's genesis state. +message GenesisState { + Params params = 1 [(gogoproto.nullable) = false]; +} diff --git a/proto/bcna/burn/params.proto b/proto/bcna/burn/params.proto new file mode 100644 index 00000000..a4483e81 --- /dev/null +++ b/proto/bcna/burn/params.proto @@ -0,0 +1,12 @@ +syntax = "proto3"; +package bcna.burn; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/BitCannaGlobal/bcna/x/burn/types"; + +// Params defines the parameters for the module. +message Params { + option (gogoproto.goproto_stringer) = false; + +} diff --git a/proto/bcna/burn/query.proto b/proto/bcna/burn/query.proto new file mode 100644 index 00000000..bb150ad1 --- /dev/null +++ b/proto/bcna/burn/query.proto @@ -0,0 +1,26 @@ +syntax = "proto3"; +package bcna.burn; + +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; +import "bcna/burn/params.proto"; + +option go_package = "github.com/BitCannaGlobal/bcna/x/burn/types"; + +// Query defines the gRPC querier service. +service Query { + // Parameters queries the parameters of the module. + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/BitCannaGlobal/bcna/burn/params"; + } +} + +// QueryParamsRequest is request type for the Query/Params RPC method. +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]; +} \ No newline at end of file diff --git a/proto/bcna/burn/tx.proto b/proto/bcna/burn/tx.proto new file mode 100644 index 00000000..9b962cd0 --- /dev/null +++ b/proto/bcna/burn/tx.proto @@ -0,0 +1,20 @@ +syntax = "proto3"; + +package bcna.burn; + +import "gogoproto/gogo.proto"; +import "cosmos/base/v1beta1/coin.proto"; + +option go_package = "github.com/BitCannaGlobal/bcna/x/burn/types"; + +// Msg defines the Msg service. +service Msg { + rpc BurnCoinsAction (MsgBurnCoinsAction) returns (MsgBurnCoinsActionResponse); +} +message MsgBurnCoinsAction { + string creator = 1; + repeated cosmos.base.v1beta1.Coin coins = 2 [(gogoproto.nullable) = false]; +} + +message MsgBurnCoinsActionResponse {} + diff --git a/testutil/keeper/burn.go b/testutil/keeper/burn.go new file mode 100644 index 00000000..c9f6c95b --- /dev/null +++ b/testutil/keeper/burn.go @@ -0,0 +1,53 @@ +package keeper + +import ( + "testing" + + "github.com/BitCannaGlobal/bcna/x/burn/keeper" + "github.com/BitCannaGlobal/bcna/x/burn/types" + tmdb "github.com/cometbft/cometbft-db" + "github.com/cometbft/cometbft/libs/log" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/store" + storetypes "github.com/cosmos/cosmos-sdk/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" + typesparams "github.com/cosmos/cosmos-sdk/x/params/types" + "github.com/stretchr/testify/require" +) + +func BurnKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { + storeKey := sdk.NewKVStoreKey(types.StoreKey) + memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey) + + db := tmdb.NewMemDB() + stateStore := store.NewCommitMultiStore(db) + stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db) + stateStore.MountStoreWithDB(memStoreKey, storetypes.StoreTypeMemory, nil) + require.NoError(t, stateStore.LoadLatestVersion()) + + registry := codectypes.NewInterfaceRegistry() + cdc := codec.NewProtoCodec(registry) + + paramsSubspace := typesparams.NewSubspace(cdc, + types.Amino, + storeKey, + memStoreKey, + "BurnParams", + ) + k := keeper.NewKeeper( + cdc, + storeKey, + memStoreKey, + paramsSubspace, + nil, + ) + + ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger()) + + // Initialize params + k.SetParams(ctx, types.DefaultParams()) + + return k, ctx +} diff --git a/vue/src/store/generated/bcna.burn/index.ts b/vue/src/store/generated/bcna.burn/index.ts new file mode 100755 index 00000000..2150d839 --- /dev/null +++ b/vue/src/store/generated/bcna.burn/index.ts @@ -0,0 +1,161 @@ +import { Client, registry, MissingWalletError } from 'BitCannaGlobal-bcna-client-ts' + +import { Params } from "BitCannaGlobal-bcna-client-ts/bcna.burn/types" + + +export { Params }; + +function initClient(vuexGetters) { + return new Client(vuexGetters['common/env/getEnv'], vuexGetters['common/wallet/signer']) +} + +function mergeResults(value, next_values) { + for (let prop of Object.keys(next_values)) { + if (Array.isArray(next_values[prop])) { + value[prop]=[...value[prop], ...next_values[prop]] + }else{ + value[prop]=next_values[prop] + } + } + return value +} + +type Field = { + name: string; + type: unknown; +} +function getStructure(template) { + let structure: {fields: Field[]} = { fields: [] } + for (const [key, value] of Object.entries(template)) { + let field = { name: key, type: typeof value } + structure.fields.push(field) + } + return structure +} +const getDefaultState = () => { + return { + Params: {}, + + _Structure: { + Params: getStructure(Params.fromPartial({})), + + }, + _Registry: registry, + _Subscriptions: new Set(), + } +} + +// initial state +const state = getDefaultState() + +export default { + namespaced: true, + state, + mutations: { + RESET_STATE(state) { + Object.assign(state, getDefaultState()) + }, + QUERY(state, { query, key, value }) { + state[query][JSON.stringify(key)] = value + }, + SUBSCRIBE(state, subscription) { + state._Subscriptions.add(JSON.stringify(subscription)) + }, + UNSUBSCRIBE(state, subscription) { + state._Subscriptions.delete(JSON.stringify(subscription)) + } + }, + getters: { + getParams: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Params[JSON.stringify(params)] ?? {} + }, + + getTypeStructure: (state) => (type) => { + return state._Structure[type].fields + }, + getRegistry: (state) => { + return state._Registry + } + }, + actions: { + init({ dispatch, rootGetters }) { + console.log('Vuex module: bcna.burn initialized!') + if (rootGetters['common/env/client']) { + rootGetters['common/env/client'].on('newblock', () => { + dispatch('StoreUpdate') + }) + } + }, + resetState({ commit }) { + commit('RESET_STATE') + }, + unsubscribe({ commit }, subscription) { + commit('UNSUBSCRIBE', subscription) + }, + async StoreUpdate({ state, dispatch }) { + state._Subscriptions.forEach(async (subscription) => { + try { + const sub=JSON.parse(subscription) + await dispatch(sub.action, sub.payload) + }catch(e) { + throw new Error('Subscriptions: ' + e.message) + } + }) + }, + + + + + + + async QueryParams({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.BcnaBurn.query.queryParams()).data + + + commit('QUERY', { query: 'Params', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryParams', payload: { options: { all }, params: {...key},query }}) + return getters['getParams']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryParams API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + async sendMsgBurnCoinsAction({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.BcnaBurn.tx.sendMsgBurnCoinsAction({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgBurnCoinsAction:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgBurnCoinsAction:Send Could not broadcast Tx: '+ e.message) + } + } + }, + + async MsgBurnCoinsAction({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.BcnaBurn.tx.msgBurnCoinsAction({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgBurnCoinsAction:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgBurnCoinsAction:Create Could not create message: ' + e.message) + } + } + }, + + } +} \ No newline at end of file diff --git a/vue/src/store/generated/bitcannaglobal.bcna.bcna/index.ts b/vue/src/store/generated/bitcannaglobal.bcna.bcna/index.ts new file mode 100755 index 00000000..df6d6e9e --- /dev/null +++ b/vue/src/store/generated/bitcannaglobal.bcna.bcna/index.ts @@ -0,0 +1,453 @@ +import { Client, registry, MissingWalletError } from 'BitCannaGlobal-bcna-client-ts' + +import { Bitcannaid } from "BitCannaGlobal-bcna-client-ts/bitcannaglobal.bcna.bcna/types" +import { Params } from "BitCannaGlobal-bcna-client-ts/bitcannaglobal.bcna.bcna/types" +import { Supplychain } from "BitCannaGlobal-bcna-client-ts/bitcannaglobal.bcna.bcna/types" + + +export { Bitcannaid, Params, Supplychain }; + +function initClient(vuexGetters) { + return new Client(vuexGetters['common/env/getEnv'], vuexGetters['common/wallet/signer']) +} + +function mergeResults(value, next_values) { + for (let prop of Object.keys(next_values)) { + if (Array.isArray(next_values[prop])) { + value[prop]=[...value[prop], ...next_values[prop]] + }else{ + value[prop]=next_values[prop] + } + } + return value +} + +type Field = { + name: string; + type: unknown; +} +function getStructure(template) { + let structure: {fields: Field[]} = { fields: [] } + for (const [key, value] of Object.entries(template)) { + let field = { name: key, type: typeof value } + structure.fields.push(field) + } + return structure +} +const getDefaultState = () => { + return { + Params: {}, + Bitcannaid: {}, + BitcannaidAll: {}, + BitcannaidByBcnaid: {}, + Supplychain: {}, + SupplychainAll: {}, + + _Structure: { + Bitcannaid: getStructure(Bitcannaid.fromPartial({})), + Params: getStructure(Params.fromPartial({})), + Supplychain: getStructure(Supplychain.fromPartial({})), + + }, + _Registry: registry, + _Subscriptions: new Set(), + } +} + +// initial state +const state = getDefaultState() + +export default { + namespaced: true, + state, + mutations: { + RESET_STATE(state) { + Object.assign(state, getDefaultState()) + }, + QUERY(state, { query, key, value }) { + state[query][JSON.stringify(key)] = value + }, + SUBSCRIBE(state, subscription) { + state._Subscriptions.add(JSON.stringify(subscription)) + }, + UNSUBSCRIBE(state, subscription) { + state._Subscriptions.delete(JSON.stringify(subscription)) + } + }, + getters: { + getParams: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Params[JSON.stringify(params)] ?? {} + }, + getBitcannaid: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Bitcannaid[JSON.stringify(params)] ?? {} + }, + getBitcannaidAll: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.BitcannaidAll[JSON.stringify(params)] ?? {} + }, + getBitcannaidByBcnaid: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.BitcannaidByBcnaid[JSON.stringify(params)] ?? {} + }, + getSupplychain: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Supplychain[JSON.stringify(params)] ?? {} + }, + getSupplychainAll: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.SupplychainAll[JSON.stringify(params)] ?? {} + }, + + getTypeStructure: (state) => (type) => { + return state._Structure[type].fields + }, + getRegistry: (state) => { + return state._Registry + } + }, + actions: { + init({ dispatch, rootGetters }) { + console.log('Vuex module: bitcannaglobal.bcna.bcna initialized!') + if (rootGetters['common/env/client']) { + rootGetters['common/env/client'].on('newblock', () => { + dispatch('StoreUpdate') + }) + } + }, + resetState({ commit }) { + commit('RESET_STATE') + }, + unsubscribe({ commit }, subscription) { + commit('UNSUBSCRIBE', subscription) + }, + async StoreUpdate({ state, dispatch }) { + state._Subscriptions.forEach(async (subscription) => { + try { + const sub=JSON.parse(subscription) + await dispatch(sub.action, sub.payload) + }catch(e) { + throw new Error('Subscriptions: ' + e.message) + } + }) + }, + + + + + + + async QueryParams({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.BitcannaglobalBcnaBcna.query.queryParams()).data + + + commit('QUERY', { query: 'Params', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryParams', payload: { options: { all }, params: {...key},query }}) + return getters['getParams']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryParams API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryBitcannaid({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.BitcannaglobalBcnaBcna.query.queryBitcannaid( key.id)).data + + + commit('QUERY', { query: 'Bitcannaid', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryBitcannaid', payload: { options: { all }, params: {...key},query }}) + return getters['getBitcannaid']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryBitcannaid API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryBitcannaidAll({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.BitcannaglobalBcnaBcna.query.queryBitcannaidAll(query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.BitcannaglobalBcnaBcna.query.queryBitcannaidAll({...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'BitcannaidAll', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryBitcannaidAll', payload: { options: { all }, params: {...key},query }}) + return getters['getBitcannaidAll']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryBitcannaidAll API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryBitcannaidByBcnaid({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.BitcannaglobalBcnaBcna.query.queryBitcannaidByBcnaid( key.bcnaid)).data + + + commit('QUERY', { query: 'BitcannaidByBcnaid', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryBitcannaidByBcnaid', payload: { options: { all }, params: {...key},query }}) + return getters['getBitcannaidByBcnaid']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryBitcannaidByBcnaid API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QuerySupplychain({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.BitcannaglobalBcnaBcna.query.querySupplychain( key.id)).data + + + commit('QUERY', { query: 'Supplychain', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QuerySupplychain', payload: { options: { all }, params: {...key},query }}) + return getters['getSupplychain']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QuerySupplychain API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QuerySupplychainAll({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.BitcannaglobalBcnaBcna.query.querySupplychainAll(query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.BitcannaglobalBcnaBcna.query.querySupplychainAll({...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'SupplychainAll', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QuerySupplychainAll', payload: { options: { all }, params: {...key},query }}) + return getters['getSupplychainAll']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QuerySupplychainAll API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + async sendMsgCreateBitcannaid({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.BitcannaglobalBcnaBcna.tx.sendMsgCreateBitcannaid({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgCreateBitcannaid:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgCreateBitcannaid:Send Could not broadcast Tx: '+ e.message) + } + } + }, + async sendMsgUpdateBitcannaid({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.BitcannaglobalBcnaBcna.tx.sendMsgUpdateBitcannaid({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgUpdateBitcannaid:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgUpdateBitcannaid:Send Could not broadcast Tx: '+ e.message) + } + } + }, + async sendMsgUpdateSupplychain({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.BitcannaglobalBcnaBcna.tx.sendMsgUpdateSupplychain({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgUpdateSupplychain:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgUpdateSupplychain:Send Could not broadcast Tx: '+ e.message) + } + } + }, + async sendMsgDeleteBitcannaid({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.BitcannaglobalBcnaBcna.tx.sendMsgDeleteBitcannaid({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgDeleteBitcannaid:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgDeleteBitcannaid:Send Could not broadcast Tx: '+ e.message) + } + } + }, + async sendMsgCreateSupplychain({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.BitcannaglobalBcnaBcna.tx.sendMsgCreateSupplychain({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgCreateSupplychain:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgCreateSupplychain:Send Could not broadcast Tx: '+ e.message) + } + } + }, + async sendMsgDeleteSupplychain({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.BitcannaglobalBcnaBcna.tx.sendMsgDeleteSupplychain({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgDeleteSupplychain:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgDeleteSupplychain:Send Could not broadcast Tx: '+ e.message) + } + } + }, + + async MsgCreateBitcannaid({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.BitcannaglobalBcnaBcna.tx.msgCreateBitcannaid({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgCreateBitcannaid:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgCreateBitcannaid:Create Could not create message: ' + e.message) + } + } + }, + async MsgUpdateBitcannaid({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.BitcannaglobalBcnaBcna.tx.msgUpdateBitcannaid({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgUpdateBitcannaid:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgUpdateBitcannaid:Create Could not create message: ' + e.message) + } + } + }, + async MsgUpdateSupplychain({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.BitcannaglobalBcnaBcna.tx.msgUpdateSupplychain({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgUpdateSupplychain:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgUpdateSupplychain:Create Could not create message: ' + e.message) + } + } + }, + async MsgDeleteBitcannaid({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.BitcannaglobalBcnaBcna.tx.msgDeleteBitcannaid({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgDeleteBitcannaid:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgDeleteBitcannaid:Create Could not create message: ' + e.message) + } + } + }, + async MsgCreateSupplychain({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.BitcannaglobalBcnaBcna.tx.msgCreateSupplychain({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgCreateSupplychain:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgCreateSupplychain:Create Could not create message: ' + e.message) + } + } + }, + async MsgDeleteSupplychain({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.BitcannaglobalBcnaBcna.tx.msgDeleteSupplychain({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgDeleteSupplychain:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgDeleteSupplychain:Create Could not create message: ' + e.message) + } + } + }, + + } +} \ No newline at end of file diff --git a/vue/src/store/generated/cosmos.auth.v1beta1/index.ts b/vue/src/store/generated/cosmos.auth.v1beta1/index.ts new file mode 100755 index 00000000..9f9b3bca --- /dev/null +++ b/vue/src/store/generated/cosmos.auth.v1beta1/index.ts @@ -0,0 +1,409 @@ +import { Client, registry, MissingWalletError } from 'BitCannaGlobal-bcna-client-ts' + +import { BaseAccount } from "BitCannaGlobal-bcna-client-ts/cosmos.auth.v1beta1/types" +import { ModuleAccount } from "BitCannaGlobal-bcna-client-ts/cosmos.auth.v1beta1/types" +import { ModuleCredential } from "BitCannaGlobal-bcna-client-ts/cosmos.auth.v1beta1/types" +import { Params } from "BitCannaGlobal-bcna-client-ts/cosmos.auth.v1beta1/types" + + +export { BaseAccount, ModuleAccount, ModuleCredential, Params }; + +function initClient(vuexGetters) { + return new Client(vuexGetters['common/env/getEnv'], vuexGetters['common/wallet/signer']) +} + +function mergeResults(value, next_values) { + for (let prop of Object.keys(next_values)) { + if (Array.isArray(next_values[prop])) { + value[prop]=[...value[prop], ...next_values[prop]] + }else{ + value[prop]=next_values[prop] + } + } + return value +} + +type Field = { + name: string; + type: unknown; +} +function getStructure(template) { + let structure: {fields: Field[]} = { fields: [] } + for (const [key, value] of Object.entries(template)) { + let field = { name: key, type: typeof value } + structure.fields.push(field) + } + return structure +} +const getDefaultState = () => { + return { + Accounts: {}, + Account: {}, + AccountAddressByID: {}, + Params: {}, + ModuleAccounts: {}, + ModuleAccountByName: {}, + Bech32Prefix: {}, + AddressBytesToString: {}, + AddressStringToBytes: {}, + AccountInfo: {}, + + _Structure: { + BaseAccount: getStructure(BaseAccount.fromPartial({})), + ModuleAccount: getStructure(ModuleAccount.fromPartial({})), + ModuleCredential: getStructure(ModuleCredential.fromPartial({})), + Params: getStructure(Params.fromPartial({})), + + }, + _Registry: registry, + _Subscriptions: new Set(), + } +} + +// initial state +const state = getDefaultState() + +export default { + namespaced: true, + state, + mutations: { + RESET_STATE(state) { + Object.assign(state, getDefaultState()) + }, + QUERY(state, { query, key, value }) { + state[query][JSON.stringify(key)] = value + }, + SUBSCRIBE(state, subscription) { + state._Subscriptions.add(JSON.stringify(subscription)) + }, + UNSUBSCRIBE(state, subscription) { + state._Subscriptions.delete(JSON.stringify(subscription)) + } + }, + getters: { + getAccounts: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Accounts[JSON.stringify(params)] ?? {} + }, + getAccount: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Account[JSON.stringify(params)] ?? {} + }, + getAccountAddressByID: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.AccountAddressByID[JSON.stringify(params)] ?? {} + }, + getParams: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Params[JSON.stringify(params)] ?? {} + }, + getModuleAccounts: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.ModuleAccounts[JSON.stringify(params)] ?? {} + }, + getModuleAccountByName: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.ModuleAccountByName[JSON.stringify(params)] ?? {} + }, + getBech32Prefix: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Bech32Prefix[JSON.stringify(params)] ?? {} + }, + getAddressBytesToString: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.AddressBytesToString[JSON.stringify(params)] ?? {} + }, + getAddressStringToBytes: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.AddressStringToBytes[JSON.stringify(params)] ?? {} + }, + getAccountInfo: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.AccountInfo[JSON.stringify(params)] ?? {} + }, + + getTypeStructure: (state) => (type) => { + return state._Structure[type].fields + }, + getRegistry: (state) => { + return state._Registry + } + }, + actions: { + init({ dispatch, rootGetters }) { + console.log('Vuex module: cosmos.auth.v1beta1 initialized!') + if (rootGetters['common/env/client']) { + rootGetters['common/env/client'].on('newblock', () => { + dispatch('StoreUpdate') + }) + } + }, + resetState({ commit }) { + commit('RESET_STATE') + }, + unsubscribe({ commit }, subscription) { + commit('UNSUBSCRIBE', subscription) + }, + async StoreUpdate({ state, dispatch }) { + state._Subscriptions.forEach(async (subscription) => { + try { + const sub=JSON.parse(subscription) + await dispatch(sub.action, sub.payload) + }catch(e) { + throw new Error('Subscriptions: ' + e.message) + } + }) + }, + + + + + + + async QueryAccounts({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosAuthV1Beta1.query.queryAccounts(query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.CosmosAuthV1Beta1.query.queryAccounts({...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'Accounts', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryAccounts', payload: { options: { all }, params: {...key},query }}) + return getters['getAccounts']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryAccounts API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryAccount({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosAuthV1Beta1.query.queryAccount( key.address)).data + + + commit('QUERY', { query: 'Account', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryAccount', payload: { options: { all }, params: {...key},query }}) + return getters['getAccount']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryAccount API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryAccountAddressByID({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosAuthV1Beta1.query.queryAccountAddressByID( key.id, query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.CosmosAuthV1Beta1.query.queryAccountAddressByID( key.id, {...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'AccountAddressByID', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryAccountAddressByID', payload: { options: { all }, params: {...key},query }}) + return getters['getAccountAddressByID']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryAccountAddressByID API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryParams({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosAuthV1Beta1.query.queryParams()).data + + + commit('QUERY', { query: 'Params', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryParams', payload: { options: { all }, params: {...key},query }}) + return getters['getParams']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryParams API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryModuleAccounts({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosAuthV1Beta1.query.queryModuleAccounts()).data + + + commit('QUERY', { query: 'ModuleAccounts', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryModuleAccounts', payload: { options: { all }, params: {...key},query }}) + return getters['getModuleAccounts']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryModuleAccounts API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryModuleAccountByName({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosAuthV1Beta1.query.queryModuleAccountByName( key.name)).data + + + commit('QUERY', { query: 'ModuleAccountByName', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryModuleAccountByName', payload: { options: { all }, params: {...key},query }}) + return getters['getModuleAccountByName']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryModuleAccountByName API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryBech32Prefix({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosAuthV1Beta1.query.queryBech32Prefix()).data + + + commit('QUERY', { query: 'Bech32Prefix', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryBech32Prefix', payload: { options: { all }, params: {...key},query }}) + return getters['getBech32Prefix']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryBech32Prefix API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryAddressBytesToString({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosAuthV1Beta1.query.queryAddressBytesToString( key.address_bytes)).data + + + commit('QUERY', { query: 'AddressBytesToString', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryAddressBytesToString', payload: { options: { all }, params: {...key},query }}) + return getters['getAddressBytesToString']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryAddressBytesToString API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryAddressStringToBytes({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosAuthV1Beta1.query.queryAddressStringToBytes( key.address_string)).data + + + commit('QUERY', { query: 'AddressStringToBytes', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryAddressStringToBytes', payload: { options: { all }, params: {...key},query }}) + return getters['getAddressStringToBytes']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryAddressStringToBytes API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryAccountInfo({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosAuthV1Beta1.query.queryAccountInfo( key.address)).data + + + commit('QUERY', { query: 'AccountInfo', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryAccountInfo', payload: { options: { all }, params: {...key},query }}) + return getters['getAccountInfo']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryAccountInfo API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + } +} \ No newline at end of file diff --git a/vue/src/store/generated/cosmos.authz.v1beta1/index.ts b/vue/src/store/generated/cosmos.authz.v1beta1/index.ts new file mode 100755 index 00000000..c7ded7c1 --- /dev/null +++ b/vue/src/store/generated/cosmos.authz.v1beta1/index.ts @@ -0,0 +1,295 @@ +import { Client, registry, MissingWalletError } from 'BitCannaGlobal-bcna-client-ts' + +import { GenericAuthorization } from "BitCannaGlobal-bcna-client-ts/cosmos.authz.v1beta1/types" +import { Grant } from "BitCannaGlobal-bcna-client-ts/cosmos.authz.v1beta1/types" +import { GrantAuthorization } from "BitCannaGlobal-bcna-client-ts/cosmos.authz.v1beta1/types" +import { GrantQueueItem } from "BitCannaGlobal-bcna-client-ts/cosmos.authz.v1beta1/types" +import { EventGrant } from "BitCannaGlobal-bcna-client-ts/cosmos.authz.v1beta1/types" +import { EventRevoke } from "BitCannaGlobal-bcna-client-ts/cosmos.authz.v1beta1/types" + + +export { GenericAuthorization, Grant, GrantAuthorization, GrantQueueItem, EventGrant, EventRevoke }; + +function initClient(vuexGetters) { + return new Client(vuexGetters['common/env/getEnv'], vuexGetters['common/wallet/signer']) +} + +function mergeResults(value, next_values) { + for (let prop of Object.keys(next_values)) { + if (Array.isArray(next_values[prop])) { + value[prop]=[...value[prop], ...next_values[prop]] + }else{ + value[prop]=next_values[prop] + } + } + return value +} + +type Field = { + name: string; + type: unknown; +} +function getStructure(template) { + let structure: {fields: Field[]} = { fields: [] } + for (const [key, value] of Object.entries(template)) { + let field = { name: key, type: typeof value } + structure.fields.push(field) + } + return structure +} +const getDefaultState = () => { + return { + Grants: {}, + GranterGrants: {}, + GranteeGrants: {}, + + _Structure: { + GenericAuthorization: getStructure(GenericAuthorization.fromPartial({})), + Grant: getStructure(Grant.fromPartial({})), + GrantAuthorization: getStructure(GrantAuthorization.fromPartial({})), + GrantQueueItem: getStructure(GrantQueueItem.fromPartial({})), + EventGrant: getStructure(EventGrant.fromPartial({})), + EventRevoke: getStructure(EventRevoke.fromPartial({})), + + }, + _Registry: registry, + _Subscriptions: new Set(), + } +} + +// initial state +const state = getDefaultState() + +export default { + namespaced: true, + state, + mutations: { + RESET_STATE(state) { + Object.assign(state, getDefaultState()) + }, + QUERY(state, { query, key, value }) { + state[query][JSON.stringify(key)] = value + }, + SUBSCRIBE(state, subscription) { + state._Subscriptions.add(JSON.stringify(subscription)) + }, + UNSUBSCRIBE(state, subscription) { + state._Subscriptions.delete(JSON.stringify(subscription)) + } + }, + getters: { + getGrants: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Grants[JSON.stringify(params)] ?? {} + }, + getGranterGrants: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.GranterGrants[JSON.stringify(params)] ?? {} + }, + getGranteeGrants: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.GranteeGrants[JSON.stringify(params)] ?? {} + }, + + getTypeStructure: (state) => (type) => { + return state._Structure[type].fields + }, + getRegistry: (state) => { + return state._Registry + } + }, + actions: { + init({ dispatch, rootGetters }) { + console.log('Vuex module: cosmos.authz.v1beta1 initialized!') + if (rootGetters['common/env/client']) { + rootGetters['common/env/client'].on('newblock', () => { + dispatch('StoreUpdate') + }) + } + }, + resetState({ commit }) { + commit('RESET_STATE') + }, + unsubscribe({ commit }, subscription) { + commit('UNSUBSCRIBE', subscription) + }, + async StoreUpdate({ state, dispatch }) { + state._Subscriptions.forEach(async (subscription) => { + try { + const sub=JSON.parse(subscription) + await dispatch(sub.action, sub.payload) + }catch(e) { + throw new Error('Subscriptions: ' + e.message) + } + }) + }, + + + + + + + async QueryGrants({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosAuthzV1Beta1.query.queryGrants(query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.CosmosAuthzV1Beta1.query.queryGrants({...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'Grants', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryGrants', payload: { options: { all }, params: {...key},query }}) + return getters['getGrants']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryGrants API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryGranterGrants({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosAuthzV1Beta1.query.queryGranterGrants( key.granter, query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.CosmosAuthzV1Beta1.query.queryGranterGrants( key.granter, {...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'GranterGrants', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryGranterGrants', payload: { options: { all }, params: {...key},query }}) + return getters['getGranterGrants']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryGranterGrants API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryGranteeGrants({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosAuthzV1Beta1.query.queryGranteeGrants( key.grantee, query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.CosmosAuthzV1Beta1.query.queryGranteeGrants( key.grantee, {...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'GranteeGrants', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryGranteeGrants', payload: { options: { all }, params: {...key},query }}) + return getters['getGranteeGrants']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryGranteeGrants API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + async sendMsgGrant({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.CosmosAuthzV1Beta1.tx.sendMsgGrant({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgGrant:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgGrant:Send Could not broadcast Tx: '+ e.message) + } + } + }, + async sendMsgRevoke({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.CosmosAuthzV1Beta1.tx.sendMsgRevoke({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgRevoke:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgRevoke:Send Could not broadcast Tx: '+ e.message) + } + } + }, + async sendMsgExec({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.CosmosAuthzV1Beta1.tx.sendMsgExec({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgExec:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgExec:Send Could not broadcast Tx: '+ e.message) + } + } + }, + + async MsgGrant({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.CosmosAuthzV1Beta1.tx.msgGrant({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgGrant:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgGrant:Create Could not create message: ' + e.message) + } + } + }, + async MsgRevoke({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.CosmosAuthzV1Beta1.tx.msgRevoke({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgRevoke:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgRevoke:Create Could not create message: ' + e.message) + } + } + }, + async MsgExec({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.CosmosAuthzV1Beta1.tx.msgExec({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgExec:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgExec:Create Could not create message: ' + e.message) + } + } + }, + + } +} \ No newline at end of file diff --git a/vue/src/store/generated/cosmos.bank.v1beta1/index.ts b/vue/src/store/generated/cosmos.bank.v1beta1/index.ts new file mode 100755 index 00000000..f9b32fca --- /dev/null +++ b/vue/src/store/generated/cosmos.bank.v1beta1/index.ts @@ -0,0 +1,532 @@ +import { Client, registry, MissingWalletError } from 'BitCannaGlobal-bcna-client-ts' + +import { SendAuthorization } from "BitCannaGlobal-bcna-client-ts/cosmos.bank.v1beta1/types" +import { Params } from "BitCannaGlobal-bcna-client-ts/cosmos.bank.v1beta1/types" +import { SendEnabled } from "BitCannaGlobal-bcna-client-ts/cosmos.bank.v1beta1/types" +import { Input } from "BitCannaGlobal-bcna-client-ts/cosmos.bank.v1beta1/types" +import { Output } from "BitCannaGlobal-bcna-client-ts/cosmos.bank.v1beta1/types" +import { Supply } from "BitCannaGlobal-bcna-client-ts/cosmos.bank.v1beta1/types" +import { DenomUnit } from "BitCannaGlobal-bcna-client-ts/cosmos.bank.v1beta1/types" +import { Metadata } from "BitCannaGlobal-bcna-client-ts/cosmos.bank.v1beta1/types" +import { Balance } from "BitCannaGlobal-bcna-client-ts/cosmos.bank.v1beta1/types" +import { DenomOwner } from "BitCannaGlobal-bcna-client-ts/cosmos.bank.v1beta1/types" + + +export { SendAuthorization, Params, SendEnabled, Input, Output, Supply, DenomUnit, Metadata, Balance, DenomOwner }; + +function initClient(vuexGetters) { + return new Client(vuexGetters['common/env/getEnv'], vuexGetters['common/wallet/signer']) +} + +function mergeResults(value, next_values) { + for (let prop of Object.keys(next_values)) { + if (Array.isArray(next_values[prop])) { + value[prop]=[...value[prop], ...next_values[prop]] + }else{ + value[prop]=next_values[prop] + } + } + return value +} + +type Field = { + name: string; + type: unknown; +} +function getStructure(template) { + let structure: {fields: Field[]} = { fields: [] } + for (const [key, value] of Object.entries(template)) { + let field = { name: key, type: typeof value } + structure.fields.push(field) + } + return structure +} +const getDefaultState = () => { + return { + Balance: {}, + AllBalances: {}, + SpendableBalances: {}, + SpendableBalanceByDenom: {}, + TotalSupply: {}, + SupplyOf: {}, + Params: {}, + DenomMetadata: {}, + DenomsMetadata: {}, + DenomOwners: {}, + SendEnabled: {}, + + _Structure: { + SendAuthorization: getStructure(SendAuthorization.fromPartial({})), + Params: getStructure(Params.fromPartial({})), + SendEnabled: getStructure(SendEnabled.fromPartial({})), + Input: getStructure(Input.fromPartial({})), + Output: getStructure(Output.fromPartial({})), + Supply: getStructure(Supply.fromPartial({})), + DenomUnit: getStructure(DenomUnit.fromPartial({})), + Metadata: getStructure(Metadata.fromPartial({})), + Balance: getStructure(Balance.fromPartial({})), + DenomOwner: getStructure(DenomOwner.fromPartial({})), + + }, + _Registry: registry, + _Subscriptions: new Set(), + } +} + +// initial state +const state = getDefaultState() + +export default { + namespaced: true, + state, + mutations: { + RESET_STATE(state) { + Object.assign(state, getDefaultState()) + }, + QUERY(state, { query, key, value }) { + state[query][JSON.stringify(key)] = value + }, + SUBSCRIBE(state, subscription) { + state._Subscriptions.add(JSON.stringify(subscription)) + }, + UNSUBSCRIBE(state, subscription) { + state._Subscriptions.delete(JSON.stringify(subscription)) + } + }, + getters: { + getBalance: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Balance[JSON.stringify(params)] ?? {} + }, + getAllBalances: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.AllBalances[JSON.stringify(params)] ?? {} + }, + getSpendableBalances: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.SpendableBalances[JSON.stringify(params)] ?? {} + }, + getSpendableBalanceByDenom: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.SpendableBalanceByDenom[JSON.stringify(params)] ?? {} + }, + getTotalSupply: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.TotalSupply[JSON.stringify(params)] ?? {} + }, + getSupplyOf: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.SupplyOf[JSON.stringify(params)] ?? {} + }, + getParams: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Params[JSON.stringify(params)] ?? {} + }, + getDenomMetadata: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.DenomMetadata[JSON.stringify(params)] ?? {} + }, + getDenomsMetadata: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.DenomsMetadata[JSON.stringify(params)] ?? {} + }, + getDenomOwners: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.DenomOwners[JSON.stringify(params)] ?? {} + }, + getSendEnabled: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.SendEnabled[JSON.stringify(params)] ?? {} + }, + + getTypeStructure: (state) => (type) => { + return state._Structure[type].fields + }, + getRegistry: (state) => { + return state._Registry + } + }, + actions: { + init({ dispatch, rootGetters }) { + console.log('Vuex module: cosmos.bank.v1beta1 initialized!') + if (rootGetters['common/env/client']) { + rootGetters['common/env/client'].on('newblock', () => { + dispatch('StoreUpdate') + }) + } + }, + resetState({ commit }) { + commit('RESET_STATE') + }, + unsubscribe({ commit }, subscription) { + commit('UNSUBSCRIBE', subscription) + }, + async StoreUpdate({ state, dispatch }) { + state._Subscriptions.forEach(async (subscription) => { + try { + const sub=JSON.parse(subscription) + await dispatch(sub.action, sub.payload) + }catch(e) { + throw new Error('Subscriptions: ' + e.message) + } + }) + }, + + + + + + + async QueryBalance({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosBankV1Beta1.query.queryBalance( key.address, query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.CosmosBankV1Beta1.query.queryBalance( key.address, {...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'Balance', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryBalance', payload: { options: { all }, params: {...key},query }}) + return getters['getBalance']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryBalance API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryAllBalances({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosBankV1Beta1.query.queryAllBalances( key.address, query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.CosmosBankV1Beta1.query.queryAllBalances( key.address, {...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'AllBalances', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryAllBalances', payload: { options: { all }, params: {...key},query }}) + return getters['getAllBalances']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryAllBalances API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QuerySpendableBalances({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosBankV1Beta1.query.querySpendableBalances( key.address, query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.CosmosBankV1Beta1.query.querySpendableBalances( key.address, {...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'SpendableBalances', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QuerySpendableBalances', payload: { options: { all }, params: {...key},query }}) + return getters['getSpendableBalances']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QuerySpendableBalances API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QuerySpendableBalanceByDenom({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosBankV1Beta1.query.querySpendableBalanceByDenom( key.address, query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.CosmosBankV1Beta1.query.querySpendableBalanceByDenom( key.address, {...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'SpendableBalanceByDenom', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QuerySpendableBalanceByDenom', payload: { options: { all }, params: {...key},query }}) + return getters['getSpendableBalanceByDenom']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QuerySpendableBalanceByDenom API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryTotalSupply({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosBankV1Beta1.query.queryTotalSupply(query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.CosmosBankV1Beta1.query.queryTotalSupply({...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'TotalSupply', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryTotalSupply', payload: { options: { all }, params: {...key},query }}) + return getters['getTotalSupply']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryTotalSupply API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QuerySupplyOf({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosBankV1Beta1.query.querySupplyOf(query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.CosmosBankV1Beta1.query.querySupplyOf({...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'SupplyOf', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QuerySupplyOf', payload: { options: { all }, params: {...key},query }}) + return getters['getSupplyOf']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QuerySupplyOf API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryParams({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosBankV1Beta1.query.queryParams()).data + + + commit('QUERY', { query: 'Params', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryParams', payload: { options: { all }, params: {...key},query }}) + return getters['getParams']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryParams API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryDenomMetadata({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosBankV1Beta1.query.queryDenomMetadata( key.denom)).data + + + commit('QUERY', { query: 'DenomMetadata', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryDenomMetadata', payload: { options: { all }, params: {...key},query }}) + return getters['getDenomMetadata']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryDenomMetadata API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryDenomsMetadata({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosBankV1Beta1.query.queryDenomsMetadata(query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.CosmosBankV1Beta1.query.queryDenomsMetadata({...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'DenomsMetadata', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryDenomsMetadata', payload: { options: { all }, params: {...key},query }}) + return getters['getDenomsMetadata']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryDenomsMetadata API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryDenomOwners({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosBankV1Beta1.query.queryDenomOwners( key.denom, query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.CosmosBankV1Beta1.query.queryDenomOwners( key.denom, {...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'DenomOwners', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryDenomOwners', payload: { options: { all }, params: {...key},query }}) + return getters['getDenomOwners']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryDenomOwners API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QuerySendEnabled({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosBankV1Beta1.query.querySendEnabled(query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.CosmosBankV1Beta1.query.querySendEnabled({...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'SendEnabled', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QuerySendEnabled', payload: { options: { all }, params: {...key},query }}) + return getters['getSendEnabled']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QuerySendEnabled API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + async sendMsgSend({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.CosmosBankV1Beta1.tx.sendMsgSend({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgSend:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgSend:Send Could not broadcast Tx: '+ e.message) + } + } + }, + async sendMsgMultiSend({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.CosmosBankV1Beta1.tx.sendMsgMultiSend({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgMultiSend:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgMultiSend:Send Could not broadcast Tx: '+ e.message) + } + } + }, + + async MsgSend({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.CosmosBankV1Beta1.tx.msgSend({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgSend:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgSend:Create Could not create message: ' + e.message) + } + } + }, + async MsgMultiSend({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.CosmosBankV1Beta1.tx.msgMultiSend({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgMultiSend:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgMultiSend:Create Could not create message: ' + e.message) + } + } + }, + + } +} \ No newline at end of file diff --git a/vue/src/store/generated/cosmos.base.node.v1beta1/index.ts b/vue/src/store/generated/cosmos.base.node.v1beta1/index.ts new file mode 100755 index 00000000..10613f58 --- /dev/null +++ b/vue/src/store/generated/cosmos.base.node.v1beta1/index.ts @@ -0,0 +1,132 @@ +import { Client, registry, MissingWalletError } from 'BitCannaGlobal-bcna-client-ts' + + + +export { }; + +function initClient(vuexGetters) { + return new Client(vuexGetters['common/env/getEnv'], vuexGetters['common/wallet/signer']) +} + +function mergeResults(value, next_values) { + for (let prop of Object.keys(next_values)) { + if (Array.isArray(next_values[prop])) { + value[prop]=[...value[prop], ...next_values[prop]] + }else{ + value[prop]=next_values[prop] + } + } + return value +} + +type Field = { + name: string; + type: unknown; +} +function getStructure(template) { + let structure: {fields: Field[]} = { fields: [] } + for (const [key, value] of Object.entries(template)) { + let field = { name: key, type: typeof value } + structure.fields.push(field) + } + return structure +} +const getDefaultState = () => { + return { + Config: {}, + + _Structure: { + + }, + _Registry: registry, + _Subscriptions: new Set(), + } +} + +// initial state +const state = getDefaultState() + +export default { + namespaced: true, + state, + mutations: { + RESET_STATE(state) { + Object.assign(state, getDefaultState()) + }, + QUERY(state, { query, key, value }) { + state[query][JSON.stringify(key)] = value + }, + SUBSCRIBE(state, subscription) { + state._Subscriptions.add(JSON.stringify(subscription)) + }, + UNSUBSCRIBE(state, subscription) { + state._Subscriptions.delete(JSON.stringify(subscription)) + } + }, + getters: { + getConfig: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Config[JSON.stringify(params)] ?? {} + }, + + getTypeStructure: (state) => (type) => { + return state._Structure[type].fields + }, + getRegistry: (state) => { + return state._Registry + } + }, + actions: { + init({ dispatch, rootGetters }) { + console.log('Vuex module: cosmos.base.node.v1beta1 initialized!') + if (rootGetters['common/env/client']) { + rootGetters['common/env/client'].on('newblock', () => { + dispatch('StoreUpdate') + }) + } + }, + resetState({ commit }) { + commit('RESET_STATE') + }, + unsubscribe({ commit }, subscription) { + commit('UNSUBSCRIBE', subscription) + }, + async StoreUpdate({ state, dispatch }) { + state._Subscriptions.forEach(async (subscription) => { + try { + const sub=JSON.parse(subscription) + await dispatch(sub.action, sub.payload) + }catch(e) { + throw new Error('Subscriptions: ' + e.message) + } + }) + }, + + + + + + + async ServiceConfig({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosBaseNodeV1Beta1.query.serviceConfig()).data + + + commit('QUERY', { query: 'Config', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'ServiceConfig', payload: { options: { all }, params: {...key},query }}) + return getters['getConfig']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:ServiceConfig API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + } +} \ No newline at end of file diff --git a/vue/src/store/generated/cosmos.base.tendermint.v1beta1/index.ts b/vue/src/store/generated/cosmos.base.tendermint.v1beta1/index.ts new file mode 100755 index 00000000..ef23aeff --- /dev/null +++ b/vue/src/store/generated/cosmos.base.tendermint.v1beta1/index.ts @@ -0,0 +1,332 @@ +import { Client, registry, MissingWalletError } from 'BitCannaGlobal-bcna-client-ts' + +import { Validator } from "BitCannaGlobal-bcna-client-ts/cosmos.base.tendermint.v1beta1/types" +import { VersionInfo } from "BitCannaGlobal-bcna-client-ts/cosmos.base.tendermint.v1beta1/types" +import { Module } from "BitCannaGlobal-bcna-client-ts/cosmos.base.tendermint.v1beta1/types" +import { ProofOp } from "BitCannaGlobal-bcna-client-ts/cosmos.base.tendermint.v1beta1/types" +import { ProofOps } from "BitCannaGlobal-bcna-client-ts/cosmos.base.tendermint.v1beta1/types" +import { Block } from "BitCannaGlobal-bcna-client-ts/cosmos.base.tendermint.v1beta1/types" +import { Header } from "BitCannaGlobal-bcna-client-ts/cosmos.base.tendermint.v1beta1/types" + + +export { Validator, VersionInfo, Module, ProofOp, ProofOps, Block, Header }; + +function initClient(vuexGetters) { + return new Client(vuexGetters['common/env/getEnv'], vuexGetters['common/wallet/signer']) +} + +function mergeResults(value, next_values) { + for (let prop of Object.keys(next_values)) { + if (Array.isArray(next_values[prop])) { + value[prop]=[...value[prop], ...next_values[prop]] + }else{ + value[prop]=next_values[prop] + } + } + return value +} + +type Field = { + name: string; + type: unknown; +} +function getStructure(template) { + let structure: {fields: Field[]} = { fields: [] } + for (const [key, value] of Object.entries(template)) { + let field = { name: key, type: typeof value } + structure.fields.push(field) + } + return structure +} +const getDefaultState = () => { + return { + GetNodeInfo: {}, + GetSyncing: {}, + GetLatestBlock: {}, + GetBlockByHeight: {}, + GetLatestValidatorSet: {}, + GetValidatorSetByHeight: {}, + ABCIQuery: {}, + + _Structure: { + Validator: getStructure(Validator.fromPartial({})), + VersionInfo: getStructure(VersionInfo.fromPartial({})), + Module: getStructure(Module.fromPartial({})), + ProofOp: getStructure(ProofOp.fromPartial({})), + ProofOps: getStructure(ProofOps.fromPartial({})), + Block: getStructure(Block.fromPartial({})), + Header: getStructure(Header.fromPartial({})), + + }, + _Registry: registry, + _Subscriptions: new Set(), + } +} + +// initial state +const state = getDefaultState() + +export default { + namespaced: true, + state, + mutations: { + RESET_STATE(state) { + Object.assign(state, getDefaultState()) + }, + QUERY(state, { query, key, value }) { + state[query][JSON.stringify(key)] = value + }, + SUBSCRIBE(state, subscription) { + state._Subscriptions.add(JSON.stringify(subscription)) + }, + UNSUBSCRIBE(state, subscription) { + state._Subscriptions.delete(JSON.stringify(subscription)) + } + }, + getters: { + getGetNodeInfo: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.GetNodeInfo[JSON.stringify(params)] ?? {} + }, + getGetSyncing: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.GetSyncing[JSON.stringify(params)] ?? {} + }, + getGetLatestBlock: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.GetLatestBlock[JSON.stringify(params)] ?? {} + }, + getGetBlockByHeight: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.GetBlockByHeight[JSON.stringify(params)] ?? {} + }, + getGetLatestValidatorSet: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.GetLatestValidatorSet[JSON.stringify(params)] ?? {} + }, + getGetValidatorSetByHeight: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.GetValidatorSetByHeight[JSON.stringify(params)] ?? {} + }, + getABCIQuery: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.ABCIQuery[JSON.stringify(params)] ?? {} + }, + + getTypeStructure: (state) => (type) => { + return state._Structure[type].fields + }, + getRegistry: (state) => { + return state._Registry + } + }, + actions: { + init({ dispatch, rootGetters }) { + console.log('Vuex module: cosmos.base.tendermint.v1beta1 initialized!') + if (rootGetters['common/env/client']) { + rootGetters['common/env/client'].on('newblock', () => { + dispatch('StoreUpdate') + }) + } + }, + resetState({ commit }) { + commit('RESET_STATE') + }, + unsubscribe({ commit }, subscription) { + commit('UNSUBSCRIBE', subscription) + }, + async StoreUpdate({ state, dispatch }) { + state._Subscriptions.forEach(async (subscription) => { + try { + const sub=JSON.parse(subscription) + await dispatch(sub.action, sub.payload) + }catch(e) { + throw new Error('Subscriptions: ' + e.message) + } + }) + }, + + + + + + + async ServiceGetNodeInfo({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosBaseTendermintV1Beta1.query.serviceGetNodeInfo()).data + + + commit('QUERY', { query: 'GetNodeInfo', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'ServiceGetNodeInfo', payload: { options: { all }, params: {...key},query }}) + return getters['getGetNodeInfo']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:ServiceGetNodeInfo API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async ServiceGetSyncing({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosBaseTendermintV1Beta1.query.serviceGetSyncing()).data + + + commit('QUERY', { query: 'GetSyncing', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'ServiceGetSyncing', payload: { options: { all }, params: {...key},query }}) + return getters['getGetSyncing']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:ServiceGetSyncing API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async ServiceGetLatestBlock({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosBaseTendermintV1Beta1.query.serviceGetLatestBlock()).data + + + commit('QUERY', { query: 'GetLatestBlock', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'ServiceGetLatestBlock', payload: { options: { all }, params: {...key},query }}) + return getters['getGetLatestBlock']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:ServiceGetLatestBlock API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async ServiceGetBlockByHeight({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosBaseTendermintV1Beta1.query.serviceGetBlockByHeight( key.height)).data + + + commit('QUERY', { query: 'GetBlockByHeight', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'ServiceGetBlockByHeight', payload: { options: { all }, params: {...key},query }}) + return getters['getGetBlockByHeight']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:ServiceGetBlockByHeight API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async ServiceGetLatestValidatorSet({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosBaseTendermintV1Beta1.query.serviceGetLatestValidatorSet(query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.CosmosBaseTendermintV1Beta1.query.serviceGetLatestValidatorSet({...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'GetLatestValidatorSet', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'ServiceGetLatestValidatorSet', payload: { options: { all }, params: {...key},query }}) + return getters['getGetLatestValidatorSet']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:ServiceGetLatestValidatorSet API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async ServiceGetValidatorSetByHeight({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosBaseTendermintV1Beta1.query.serviceGetValidatorSetByHeight( key.height, query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.CosmosBaseTendermintV1Beta1.query.serviceGetValidatorSetByHeight( key.height, {...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'GetValidatorSetByHeight', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'ServiceGetValidatorSetByHeight', payload: { options: { all }, params: {...key},query }}) + return getters['getGetValidatorSetByHeight']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:ServiceGetValidatorSetByHeight API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async ServiceABCIQuery({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosBaseTendermintV1Beta1.query.serviceABCIQuery(query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.CosmosBaseTendermintV1Beta1.query.serviceABCIQuery({...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'ABCIQuery', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'ServiceABCIQuery', payload: { options: { all }, params: {...key},query }}) + return getters['getABCIQuery']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:ServiceABCIQuery API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + } +} \ No newline at end of file diff --git a/vue/src/store/generated/cosmos.consensus.v1/index.ts b/vue/src/store/generated/cosmos.consensus.v1/index.ts new file mode 100755 index 00000000..38981189 --- /dev/null +++ b/vue/src/store/generated/cosmos.consensus.v1/index.ts @@ -0,0 +1,159 @@ +import { Client, registry, MissingWalletError } from 'BitCannaGlobal-bcna-client-ts' + + + +export { }; + +function initClient(vuexGetters) { + return new Client(vuexGetters['common/env/getEnv'], vuexGetters['common/wallet/signer']) +} + +function mergeResults(value, next_values) { + for (let prop of Object.keys(next_values)) { + if (Array.isArray(next_values[prop])) { + value[prop]=[...value[prop], ...next_values[prop]] + }else{ + value[prop]=next_values[prop] + } + } + return value +} + +type Field = { + name: string; + type: unknown; +} +function getStructure(template) { + let structure: {fields: Field[]} = { fields: [] } + for (const [key, value] of Object.entries(template)) { + let field = { name: key, type: typeof value } + structure.fields.push(field) + } + return structure +} +const getDefaultState = () => { + return { + Params: {}, + + _Structure: { + + }, + _Registry: registry, + _Subscriptions: new Set(), + } +} + +// initial state +const state = getDefaultState() + +export default { + namespaced: true, + state, + mutations: { + RESET_STATE(state) { + Object.assign(state, getDefaultState()) + }, + QUERY(state, { query, key, value }) { + state[query][JSON.stringify(key)] = value + }, + SUBSCRIBE(state, subscription) { + state._Subscriptions.add(JSON.stringify(subscription)) + }, + UNSUBSCRIBE(state, subscription) { + state._Subscriptions.delete(JSON.stringify(subscription)) + } + }, + getters: { + getParams: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Params[JSON.stringify(params)] ?? {} + }, + + getTypeStructure: (state) => (type) => { + return state._Structure[type].fields + }, + getRegistry: (state) => { + return state._Registry + } + }, + actions: { + init({ dispatch, rootGetters }) { + console.log('Vuex module: cosmos.consensus.v1 initialized!') + if (rootGetters['common/env/client']) { + rootGetters['common/env/client'].on('newblock', () => { + dispatch('StoreUpdate') + }) + } + }, + resetState({ commit }) { + commit('RESET_STATE') + }, + unsubscribe({ commit }, subscription) { + commit('UNSUBSCRIBE', subscription) + }, + async StoreUpdate({ state, dispatch }) { + state._Subscriptions.forEach(async (subscription) => { + try { + const sub=JSON.parse(subscription) + await dispatch(sub.action, sub.payload) + }catch(e) { + throw new Error('Subscriptions: ' + e.message) + } + }) + }, + + + + + + + async QueryParams({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosConsensusV1.query.queryParams()).data + + + commit('QUERY', { query: 'Params', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryParams', payload: { options: { all }, params: {...key},query }}) + return getters['getParams']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryParams API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + async sendMsgUpdateParams({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.CosmosConsensusV1.tx.sendMsgUpdateParams({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgUpdateParams:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgUpdateParams:Send Could not broadcast Tx: '+ e.message) + } + } + }, + + async MsgUpdateParams({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.CosmosConsensusV1.tx.msgUpdateParams({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgUpdateParams:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgUpdateParams:Create Could not create message: ' + e.message) + } + } + }, + + } +} \ No newline at end of file diff --git a/vue/src/store/generated/cosmos.crisis.v1beta1/index.ts b/vue/src/store/generated/cosmos.crisis.v1beta1/index.ts new file mode 100755 index 00000000..4d8f657f --- /dev/null +++ b/vue/src/store/generated/cosmos.crisis.v1beta1/index.ts @@ -0,0 +1,157 @@ +import { Client, registry, MissingWalletError } from 'BitCannaGlobal-bcna-client-ts' + + + +export { }; + +function initClient(vuexGetters) { + return new Client(vuexGetters['common/env/getEnv'], vuexGetters['common/wallet/signer']) +} + +function mergeResults(value, next_values) { + for (let prop of Object.keys(next_values)) { + if (Array.isArray(next_values[prop])) { + value[prop]=[...value[prop], ...next_values[prop]] + }else{ + value[prop]=next_values[prop] + } + } + return value +} + +type Field = { + name: string; + type: unknown; +} +function getStructure(template) { + let structure: {fields: Field[]} = { fields: [] } + for (const [key, value] of Object.entries(template)) { + let field = { name: key, type: typeof value } + structure.fields.push(field) + } + return structure +} +const getDefaultState = () => { + return { + + _Structure: { + + }, + _Registry: registry, + _Subscriptions: new Set(), + } +} + +// initial state +const state = getDefaultState() + +export default { + namespaced: true, + state, + mutations: { + RESET_STATE(state) { + Object.assign(state, getDefaultState()) + }, + QUERY(state, { query, key, value }) { + state[query][JSON.stringify(key)] = value + }, + SUBSCRIBE(state, subscription) { + state._Subscriptions.add(JSON.stringify(subscription)) + }, + UNSUBSCRIBE(state, subscription) { + state._Subscriptions.delete(JSON.stringify(subscription)) + } + }, + getters: { + + getTypeStructure: (state) => (type) => { + return state._Structure[type].fields + }, + getRegistry: (state) => { + return state._Registry + } + }, + actions: { + init({ dispatch, rootGetters }) { + console.log('Vuex module: cosmos.crisis.v1beta1 initialized!') + if (rootGetters['common/env/client']) { + rootGetters['common/env/client'].on('newblock', () => { + dispatch('StoreUpdate') + }) + } + }, + resetState({ commit }) { + commit('RESET_STATE') + }, + unsubscribe({ commit }, subscription) { + commit('UNSUBSCRIBE', subscription) + }, + async StoreUpdate({ state, dispatch }) { + state._Subscriptions.forEach(async (subscription) => { + try { + const sub=JSON.parse(subscription) + await dispatch(sub.action, sub.payload) + }catch(e) { + throw new Error('Subscriptions: ' + e.message) + } + }) + }, + + async sendMsgUpdateParams({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.CosmosCrisisV1Beta1.tx.sendMsgUpdateParams({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgUpdateParams:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgUpdateParams:Send Could not broadcast Tx: '+ e.message) + } + } + }, + async sendMsgVerifyInvariant({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.CosmosCrisisV1Beta1.tx.sendMsgVerifyInvariant({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgVerifyInvariant:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgVerifyInvariant:Send Could not broadcast Tx: '+ e.message) + } + } + }, + + async MsgUpdateParams({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.CosmosCrisisV1Beta1.tx.msgUpdateParams({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgUpdateParams:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgUpdateParams:Create Could not create message: ' + e.message) + } + } + }, + async MsgVerifyInvariant({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.CosmosCrisisV1Beta1.tx.msgVerifyInvariant({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgVerifyInvariant:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgVerifyInvariant:Create Could not create message: ' + e.message) + } + } + }, + + } +} \ No newline at end of file diff --git a/vue/src/store/generated/cosmos.distribution.v1beta1/index.ts b/vue/src/store/generated/cosmos.distribution.v1beta1/index.ts new file mode 100755 index 00000000..81120f14 --- /dev/null +++ b/vue/src/store/generated/cosmos.distribution.v1beta1/index.ts @@ -0,0 +1,597 @@ +import { Client, registry, MissingWalletError } from 'BitCannaGlobal-bcna-client-ts' + +import { Params } from "BitCannaGlobal-bcna-client-ts/cosmos.distribution.v1beta1/types" +import { ValidatorHistoricalRewards } from "BitCannaGlobal-bcna-client-ts/cosmos.distribution.v1beta1/types" +import { ValidatorCurrentRewards } from "BitCannaGlobal-bcna-client-ts/cosmos.distribution.v1beta1/types" +import { ValidatorAccumulatedCommission } from "BitCannaGlobal-bcna-client-ts/cosmos.distribution.v1beta1/types" +import { ValidatorOutstandingRewards } from "BitCannaGlobal-bcna-client-ts/cosmos.distribution.v1beta1/types" +import { ValidatorSlashEvent } from "BitCannaGlobal-bcna-client-ts/cosmos.distribution.v1beta1/types" +import { ValidatorSlashEvents } from "BitCannaGlobal-bcna-client-ts/cosmos.distribution.v1beta1/types" +import { FeePool } from "BitCannaGlobal-bcna-client-ts/cosmos.distribution.v1beta1/types" +import { CommunityPoolSpendProposal } from "BitCannaGlobal-bcna-client-ts/cosmos.distribution.v1beta1/types" +import { DelegatorStartingInfo } from "BitCannaGlobal-bcna-client-ts/cosmos.distribution.v1beta1/types" +import { DelegationDelegatorReward } from "BitCannaGlobal-bcna-client-ts/cosmos.distribution.v1beta1/types" +import { CommunityPoolSpendProposalWithDeposit } from "BitCannaGlobal-bcna-client-ts/cosmos.distribution.v1beta1/types" +import { DelegatorWithdrawInfo } from "BitCannaGlobal-bcna-client-ts/cosmos.distribution.v1beta1/types" +import { ValidatorOutstandingRewardsRecord } from "BitCannaGlobal-bcna-client-ts/cosmos.distribution.v1beta1/types" +import { ValidatorAccumulatedCommissionRecord } from "BitCannaGlobal-bcna-client-ts/cosmos.distribution.v1beta1/types" +import { ValidatorHistoricalRewardsRecord } from "BitCannaGlobal-bcna-client-ts/cosmos.distribution.v1beta1/types" +import { ValidatorCurrentRewardsRecord } from "BitCannaGlobal-bcna-client-ts/cosmos.distribution.v1beta1/types" +import { DelegatorStartingInfoRecord } from "BitCannaGlobal-bcna-client-ts/cosmos.distribution.v1beta1/types" +import { ValidatorSlashEventRecord } from "BitCannaGlobal-bcna-client-ts/cosmos.distribution.v1beta1/types" + + +export { Params, ValidatorHistoricalRewards, ValidatorCurrentRewards, ValidatorAccumulatedCommission, ValidatorOutstandingRewards, ValidatorSlashEvent, ValidatorSlashEvents, FeePool, CommunityPoolSpendProposal, DelegatorStartingInfo, DelegationDelegatorReward, CommunityPoolSpendProposalWithDeposit, DelegatorWithdrawInfo, ValidatorOutstandingRewardsRecord, ValidatorAccumulatedCommissionRecord, ValidatorHistoricalRewardsRecord, ValidatorCurrentRewardsRecord, DelegatorStartingInfoRecord, ValidatorSlashEventRecord }; + +function initClient(vuexGetters) { + return new Client(vuexGetters['common/env/getEnv'], vuexGetters['common/wallet/signer']) +} + +function mergeResults(value, next_values) { + for (let prop of Object.keys(next_values)) { + if (Array.isArray(next_values[prop])) { + value[prop]=[...value[prop], ...next_values[prop]] + }else{ + value[prop]=next_values[prop] + } + } + return value +} + +type Field = { + name: string; + type: unknown; +} +function getStructure(template) { + let structure: {fields: Field[]} = { fields: [] } + for (const [key, value] of Object.entries(template)) { + let field = { name: key, type: typeof value } + structure.fields.push(field) + } + return structure +} +const getDefaultState = () => { + return { + Params: {}, + ValidatorDistributionInfo: {}, + ValidatorOutstandingRewards: {}, + ValidatorCommission: {}, + ValidatorSlashes: {}, + DelegationRewards: {}, + DelegationTotalRewards: {}, + DelegatorValidators: {}, + DelegatorWithdrawAddress: {}, + CommunityPool: {}, + + _Structure: { + Params: getStructure(Params.fromPartial({})), + ValidatorHistoricalRewards: getStructure(ValidatorHistoricalRewards.fromPartial({})), + ValidatorCurrentRewards: getStructure(ValidatorCurrentRewards.fromPartial({})), + ValidatorAccumulatedCommission: getStructure(ValidatorAccumulatedCommission.fromPartial({})), + ValidatorOutstandingRewards: getStructure(ValidatorOutstandingRewards.fromPartial({})), + ValidatorSlashEvent: getStructure(ValidatorSlashEvent.fromPartial({})), + ValidatorSlashEvents: getStructure(ValidatorSlashEvents.fromPartial({})), + FeePool: getStructure(FeePool.fromPartial({})), + CommunityPoolSpendProposal: getStructure(CommunityPoolSpendProposal.fromPartial({})), + DelegatorStartingInfo: getStructure(DelegatorStartingInfo.fromPartial({})), + DelegationDelegatorReward: getStructure(DelegationDelegatorReward.fromPartial({})), + CommunityPoolSpendProposalWithDeposit: getStructure(CommunityPoolSpendProposalWithDeposit.fromPartial({})), + DelegatorWithdrawInfo: getStructure(DelegatorWithdrawInfo.fromPartial({})), + ValidatorOutstandingRewardsRecord: getStructure(ValidatorOutstandingRewardsRecord.fromPartial({})), + ValidatorAccumulatedCommissionRecord: getStructure(ValidatorAccumulatedCommissionRecord.fromPartial({})), + ValidatorHistoricalRewardsRecord: getStructure(ValidatorHistoricalRewardsRecord.fromPartial({})), + ValidatorCurrentRewardsRecord: getStructure(ValidatorCurrentRewardsRecord.fromPartial({})), + DelegatorStartingInfoRecord: getStructure(DelegatorStartingInfoRecord.fromPartial({})), + ValidatorSlashEventRecord: getStructure(ValidatorSlashEventRecord.fromPartial({})), + + }, + _Registry: registry, + _Subscriptions: new Set(), + } +} + +// initial state +const state = getDefaultState() + +export default { + namespaced: true, + state, + mutations: { + RESET_STATE(state) { + Object.assign(state, getDefaultState()) + }, + QUERY(state, { query, key, value }) { + state[query][JSON.stringify(key)] = value + }, + SUBSCRIBE(state, subscription) { + state._Subscriptions.add(JSON.stringify(subscription)) + }, + UNSUBSCRIBE(state, subscription) { + state._Subscriptions.delete(JSON.stringify(subscription)) + } + }, + getters: { + getParams: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Params[JSON.stringify(params)] ?? {} + }, + getValidatorDistributionInfo: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.ValidatorDistributionInfo[JSON.stringify(params)] ?? {} + }, + getValidatorOutstandingRewards: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.ValidatorOutstandingRewards[JSON.stringify(params)] ?? {} + }, + getValidatorCommission: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.ValidatorCommission[JSON.stringify(params)] ?? {} + }, + getValidatorSlashes: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.ValidatorSlashes[JSON.stringify(params)] ?? {} + }, + getDelegationRewards: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.DelegationRewards[JSON.stringify(params)] ?? {} + }, + getDelegationTotalRewards: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.DelegationTotalRewards[JSON.stringify(params)] ?? {} + }, + getDelegatorValidators: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.DelegatorValidators[JSON.stringify(params)] ?? {} + }, + getDelegatorWithdrawAddress: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.DelegatorWithdrawAddress[JSON.stringify(params)] ?? {} + }, + getCommunityPool: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.CommunityPool[JSON.stringify(params)] ?? {} + }, + + getTypeStructure: (state) => (type) => { + return state._Structure[type].fields + }, + getRegistry: (state) => { + return state._Registry + } + }, + actions: { + init({ dispatch, rootGetters }) { + console.log('Vuex module: cosmos.distribution.v1beta1 initialized!') + if (rootGetters['common/env/client']) { + rootGetters['common/env/client'].on('newblock', () => { + dispatch('StoreUpdate') + }) + } + }, + resetState({ commit }) { + commit('RESET_STATE') + }, + unsubscribe({ commit }, subscription) { + commit('UNSUBSCRIBE', subscription) + }, + async StoreUpdate({ state, dispatch }) { + state._Subscriptions.forEach(async (subscription) => { + try { + const sub=JSON.parse(subscription) + await dispatch(sub.action, sub.payload) + }catch(e) { + throw new Error('Subscriptions: ' + e.message) + } + }) + }, + + + + + + + async QueryParams({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosDistributionV1Beta1.query.queryParams()).data + + + commit('QUERY', { query: 'Params', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryParams', payload: { options: { all }, params: {...key},query }}) + return getters['getParams']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryParams API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryValidatorDistributionInfo({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosDistributionV1Beta1.query.queryValidatorDistributionInfo( key.validator_address)).data + + + commit('QUERY', { query: 'ValidatorDistributionInfo', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryValidatorDistributionInfo', payload: { options: { all }, params: {...key},query }}) + return getters['getValidatorDistributionInfo']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryValidatorDistributionInfo API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryValidatorOutstandingRewards({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosDistributionV1Beta1.query.queryValidatorOutstandingRewards( key.validator_address)).data + + + commit('QUERY', { query: 'ValidatorOutstandingRewards', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryValidatorOutstandingRewards', payload: { options: { all }, params: {...key},query }}) + return getters['getValidatorOutstandingRewards']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryValidatorOutstandingRewards API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryValidatorCommission({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosDistributionV1Beta1.query.queryValidatorCommission( key.validator_address)).data + + + commit('QUERY', { query: 'ValidatorCommission', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryValidatorCommission', payload: { options: { all }, params: {...key},query }}) + return getters['getValidatorCommission']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryValidatorCommission API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryValidatorSlashes({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosDistributionV1Beta1.query.queryValidatorSlashes( key.validator_address, query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.CosmosDistributionV1Beta1.query.queryValidatorSlashes( key.validator_address, {...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'ValidatorSlashes', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryValidatorSlashes', payload: { options: { all }, params: {...key},query }}) + return getters['getValidatorSlashes']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryValidatorSlashes API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryDelegationRewards({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosDistributionV1Beta1.query.queryDelegationRewards( key.delegator_address, key.validator_address)).data + + + commit('QUERY', { query: 'DelegationRewards', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryDelegationRewards', payload: { options: { all }, params: {...key},query }}) + return getters['getDelegationRewards']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryDelegationRewards API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryDelegationTotalRewards({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosDistributionV1Beta1.query.queryDelegationTotalRewards( key.delegator_address)).data + + + commit('QUERY', { query: 'DelegationTotalRewards', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryDelegationTotalRewards', payload: { options: { all }, params: {...key},query }}) + return getters['getDelegationTotalRewards']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryDelegationTotalRewards API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryDelegatorValidators({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosDistributionV1Beta1.query.queryDelegatorValidators( key.delegator_address)).data + + + commit('QUERY', { query: 'DelegatorValidators', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryDelegatorValidators', payload: { options: { all }, params: {...key},query }}) + return getters['getDelegatorValidators']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryDelegatorValidators API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryDelegatorWithdrawAddress({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosDistributionV1Beta1.query.queryDelegatorWithdrawAddress( key.delegator_address)).data + + + commit('QUERY', { query: 'DelegatorWithdrawAddress', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryDelegatorWithdrawAddress', payload: { options: { all }, params: {...key},query }}) + return getters['getDelegatorWithdrawAddress']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryDelegatorWithdrawAddress API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryCommunityPool({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosDistributionV1Beta1.query.queryCommunityPool()).data + + + commit('QUERY', { query: 'CommunityPool', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryCommunityPool', payload: { options: { all }, params: {...key},query }}) + return getters['getCommunityPool']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryCommunityPool API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + async sendMsgUpdateParams({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.CosmosDistributionV1Beta1.tx.sendMsgUpdateParams({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgUpdateParams:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgUpdateParams:Send Could not broadcast Tx: '+ e.message) + } + } + }, + async sendMsgWithdrawDelegatorReward({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.CosmosDistributionV1Beta1.tx.sendMsgWithdrawDelegatorReward({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgWithdrawDelegatorReward:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgWithdrawDelegatorReward:Send Could not broadcast Tx: '+ e.message) + } + } + }, + async sendMsgWithdrawValidatorCommission({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.CosmosDistributionV1Beta1.tx.sendMsgWithdrawValidatorCommission({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgWithdrawValidatorCommission:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgWithdrawValidatorCommission:Send Could not broadcast Tx: '+ e.message) + } + } + }, + async sendMsgSetWithdrawAddress({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.CosmosDistributionV1Beta1.tx.sendMsgSetWithdrawAddress({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgSetWithdrawAddress:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgSetWithdrawAddress:Send Could not broadcast Tx: '+ e.message) + } + } + }, + async sendMsgCommunityPoolSpend({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.CosmosDistributionV1Beta1.tx.sendMsgCommunityPoolSpend({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgCommunityPoolSpend:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgCommunityPoolSpend:Send Could not broadcast Tx: '+ e.message) + } + } + }, + async sendMsgFundCommunityPool({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.CosmosDistributionV1Beta1.tx.sendMsgFundCommunityPool({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgFundCommunityPool:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgFundCommunityPool:Send Could not broadcast Tx: '+ e.message) + } + } + }, + + async MsgUpdateParams({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.CosmosDistributionV1Beta1.tx.msgUpdateParams({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgUpdateParams:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgUpdateParams:Create Could not create message: ' + e.message) + } + } + }, + async MsgWithdrawDelegatorReward({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.CosmosDistributionV1Beta1.tx.msgWithdrawDelegatorReward({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgWithdrawDelegatorReward:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgWithdrawDelegatorReward:Create Could not create message: ' + e.message) + } + } + }, + async MsgWithdrawValidatorCommission({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.CosmosDistributionV1Beta1.tx.msgWithdrawValidatorCommission({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgWithdrawValidatorCommission:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgWithdrawValidatorCommission:Create Could not create message: ' + e.message) + } + } + }, + async MsgSetWithdrawAddress({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.CosmosDistributionV1Beta1.tx.msgSetWithdrawAddress({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgSetWithdrawAddress:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgSetWithdrawAddress:Create Could not create message: ' + e.message) + } + } + }, + async MsgCommunityPoolSpend({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.CosmosDistributionV1Beta1.tx.msgCommunityPoolSpend({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgCommunityPoolSpend:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgCommunityPoolSpend:Create Could not create message: ' + e.message) + } + } + }, + async MsgFundCommunityPool({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.CosmosDistributionV1Beta1.tx.msgFundCommunityPool({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgFundCommunityPool:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgFundCommunityPool:Create Could not create message: ' + e.message) + } + } + }, + + } +} \ No newline at end of file diff --git a/vue/src/store/generated/cosmos.evidence.v1beta1/index.ts b/vue/src/store/generated/cosmos.evidence.v1beta1/index.ts new file mode 100755 index 00000000..419d11b3 --- /dev/null +++ b/vue/src/store/generated/cosmos.evidence.v1beta1/index.ts @@ -0,0 +1,198 @@ +import { Client, registry, MissingWalletError } from 'BitCannaGlobal-bcna-client-ts' + +import { Equivocation } from "BitCannaGlobal-bcna-client-ts/cosmos.evidence.v1beta1/types" + + +export { Equivocation }; + +function initClient(vuexGetters) { + return new Client(vuexGetters['common/env/getEnv'], vuexGetters['common/wallet/signer']) +} + +function mergeResults(value, next_values) { + for (let prop of Object.keys(next_values)) { + if (Array.isArray(next_values[prop])) { + value[prop]=[...value[prop], ...next_values[prop]] + }else{ + value[prop]=next_values[prop] + } + } + return value +} + +type Field = { + name: string; + type: unknown; +} +function getStructure(template) { + let structure: {fields: Field[]} = { fields: [] } + for (const [key, value] of Object.entries(template)) { + let field = { name: key, type: typeof value } + structure.fields.push(field) + } + return structure +} +const getDefaultState = () => { + return { + Evidence: {}, + AllEvidence: {}, + + _Structure: { + Equivocation: getStructure(Equivocation.fromPartial({})), + + }, + _Registry: registry, + _Subscriptions: new Set(), + } +} + +// initial state +const state = getDefaultState() + +export default { + namespaced: true, + state, + mutations: { + RESET_STATE(state) { + Object.assign(state, getDefaultState()) + }, + QUERY(state, { query, key, value }) { + state[query][JSON.stringify(key)] = value + }, + SUBSCRIBE(state, subscription) { + state._Subscriptions.add(JSON.stringify(subscription)) + }, + UNSUBSCRIBE(state, subscription) { + state._Subscriptions.delete(JSON.stringify(subscription)) + } + }, + getters: { + getEvidence: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Evidence[JSON.stringify(params)] ?? {} + }, + getAllEvidence: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.AllEvidence[JSON.stringify(params)] ?? {} + }, + + getTypeStructure: (state) => (type) => { + return state._Structure[type].fields + }, + getRegistry: (state) => { + return state._Registry + } + }, + actions: { + init({ dispatch, rootGetters }) { + console.log('Vuex module: cosmos.evidence.v1beta1 initialized!') + if (rootGetters['common/env/client']) { + rootGetters['common/env/client'].on('newblock', () => { + dispatch('StoreUpdate') + }) + } + }, + resetState({ commit }) { + commit('RESET_STATE') + }, + unsubscribe({ commit }, subscription) { + commit('UNSUBSCRIBE', subscription) + }, + async StoreUpdate({ state, dispatch }) { + state._Subscriptions.forEach(async (subscription) => { + try { + const sub=JSON.parse(subscription) + await dispatch(sub.action, sub.payload) + }catch(e) { + throw new Error('Subscriptions: ' + e.message) + } + }) + }, + + + + + + + async QueryEvidence({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosEvidenceV1Beta1.query.queryEvidence( key.hash, query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.CosmosEvidenceV1Beta1.query.queryEvidence( key.hash, {...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'Evidence', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryEvidence', payload: { options: { all }, params: {...key},query }}) + return getters['getEvidence']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryEvidence API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryAllEvidence({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosEvidenceV1Beta1.query.queryAllEvidence(query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.CosmosEvidenceV1Beta1.query.queryAllEvidence({...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'AllEvidence', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryAllEvidence', payload: { options: { all }, params: {...key},query }}) + return getters['getAllEvidence']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryAllEvidence API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + async sendMsgSubmitEvidence({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.CosmosEvidenceV1Beta1.tx.sendMsgSubmitEvidence({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgSubmitEvidence:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgSubmitEvidence:Send Could not broadcast Tx: '+ e.message) + } + } + }, + + async MsgSubmitEvidence({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.CosmosEvidenceV1Beta1.tx.msgSubmitEvidence({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgSubmitEvidence:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgSubmitEvidence:Create Could not create message: ' + e.message) + } + } + }, + + } +} \ No newline at end of file diff --git a/vue/src/store/generated/cosmos.feegrant.v1beta1/index.ts b/vue/src/store/generated/cosmos.feegrant.v1beta1/index.ts new file mode 100755 index 00000000..76971027 --- /dev/null +++ b/vue/src/store/generated/cosmos.feegrant.v1beta1/index.ts @@ -0,0 +1,260 @@ +import { Client, registry, MissingWalletError } from 'BitCannaGlobal-bcna-client-ts' + +import { BasicAllowance } from "BitCannaGlobal-bcna-client-ts/cosmos.feegrant.v1beta1/types" +import { PeriodicAllowance } from "BitCannaGlobal-bcna-client-ts/cosmos.feegrant.v1beta1/types" +import { AllowedMsgAllowance } from "BitCannaGlobal-bcna-client-ts/cosmos.feegrant.v1beta1/types" +import { Grant } from "BitCannaGlobal-bcna-client-ts/cosmos.feegrant.v1beta1/types" + + +export { BasicAllowance, PeriodicAllowance, AllowedMsgAllowance, Grant }; + +function initClient(vuexGetters) { + return new Client(vuexGetters['common/env/getEnv'], vuexGetters['common/wallet/signer']) +} + +function mergeResults(value, next_values) { + for (let prop of Object.keys(next_values)) { + if (Array.isArray(next_values[prop])) { + value[prop]=[...value[prop], ...next_values[prop]] + }else{ + value[prop]=next_values[prop] + } + } + return value +} + +type Field = { + name: string; + type: unknown; +} +function getStructure(template) { + let structure: {fields: Field[]} = { fields: [] } + for (const [key, value] of Object.entries(template)) { + let field = { name: key, type: typeof value } + structure.fields.push(field) + } + return structure +} +const getDefaultState = () => { + return { + Allowance: {}, + Allowances: {}, + AllowancesByGranter: {}, + + _Structure: { + BasicAllowance: getStructure(BasicAllowance.fromPartial({})), + PeriodicAllowance: getStructure(PeriodicAllowance.fromPartial({})), + AllowedMsgAllowance: getStructure(AllowedMsgAllowance.fromPartial({})), + Grant: getStructure(Grant.fromPartial({})), + + }, + _Registry: registry, + _Subscriptions: new Set(), + } +} + +// initial state +const state = getDefaultState() + +export default { + namespaced: true, + state, + mutations: { + RESET_STATE(state) { + Object.assign(state, getDefaultState()) + }, + QUERY(state, { query, key, value }) { + state[query][JSON.stringify(key)] = value + }, + SUBSCRIBE(state, subscription) { + state._Subscriptions.add(JSON.stringify(subscription)) + }, + UNSUBSCRIBE(state, subscription) { + state._Subscriptions.delete(JSON.stringify(subscription)) + } + }, + getters: { + getAllowance: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Allowance[JSON.stringify(params)] ?? {} + }, + getAllowances: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Allowances[JSON.stringify(params)] ?? {} + }, + getAllowancesByGranter: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.AllowancesByGranter[JSON.stringify(params)] ?? {} + }, + + getTypeStructure: (state) => (type) => { + return state._Structure[type].fields + }, + getRegistry: (state) => { + return state._Registry + } + }, + actions: { + init({ dispatch, rootGetters }) { + console.log('Vuex module: cosmos.feegrant.v1beta1 initialized!') + if (rootGetters['common/env/client']) { + rootGetters['common/env/client'].on('newblock', () => { + dispatch('StoreUpdate') + }) + } + }, + resetState({ commit }) { + commit('RESET_STATE') + }, + unsubscribe({ commit }, subscription) { + commit('UNSUBSCRIBE', subscription) + }, + async StoreUpdate({ state, dispatch }) { + state._Subscriptions.forEach(async (subscription) => { + try { + const sub=JSON.parse(subscription) + await dispatch(sub.action, sub.payload) + }catch(e) { + throw new Error('Subscriptions: ' + e.message) + } + }) + }, + + + + + + + async QueryAllowance({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosFeegrantV1Beta1.query.queryAllowance( key.granter, key.grantee)).data + + + commit('QUERY', { query: 'Allowance', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryAllowance', payload: { options: { all }, params: {...key},query }}) + return getters['getAllowance']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryAllowance API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryAllowances({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosFeegrantV1Beta1.query.queryAllowances( key.grantee, query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.CosmosFeegrantV1Beta1.query.queryAllowances( key.grantee, {...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'Allowances', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryAllowances', payload: { options: { all }, params: {...key},query }}) + return getters['getAllowances']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryAllowances API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryAllowancesByGranter({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosFeegrantV1Beta1.query.queryAllowancesByGranter( key.granter, query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.CosmosFeegrantV1Beta1.query.queryAllowancesByGranter( key.granter, {...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'AllowancesByGranter', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryAllowancesByGranter', payload: { options: { all }, params: {...key},query }}) + return getters['getAllowancesByGranter']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryAllowancesByGranter API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + async sendMsgGrantAllowance({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.CosmosFeegrantV1Beta1.tx.sendMsgGrantAllowance({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgGrantAllowance:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgGrantAllowance:Send Could not broadcast Tx: '+ e.message) + } + } + }, + async sendMsgRevokeAllowance({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.CosmosFeegrantV1Beta1.tx.sendMsgRevokeAllowance({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgRevokeAllowance:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgRevokeAllowance:Send Could not broadcast Tx: '+ e.message) + } + } + }, + + async MsgGrantAllowance({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.CosmosFeegrantV1Beta1.tx.msgGrantAllowance({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgGrantAllowance:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgGrantAllowance:Create Could not create message: ' + e.message) + } + } + }, + async MsgRevokeAllowance({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.CosmosFeegrantV1Beta1.tx.msgRevokeAllowance({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgRevokeAllowance:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgRevokeAllowance:Create Could not create message: ' + e.message) + } + } + }, + + } +} \ No newline at end of file diff --git a/vue/src/store/generated/cosmos.gov.v1/index.ts b/vue/src/store/generated/cosmos.gov.v1/index.ts new file mode 100755 index 00000000..b21d26da --- /dev/null +++ b/vue/src/store/generated/cosmos.gov.v1/index.ts @@ -0,0 +1,500 @@ +import { Client, registry, MissingWalletError } from 'BitCannaGlobal-bcna-client-ts' + +import { WeightedVoteOption } from "BitCannaGlobal-bcna-client-ts/cosmos.gov.v1/types" +import { Deposit } from "BitCannaGlobal-bcna-client-ts/cosmos.gov.v1/types" +import { Proposal } from "BitCannaGlobal-bcna-client-ts/cosmos.gov.v1/types" +import { TallyResult } from "BitCannaGlobal-bcna-client-ts/cosmos.gov.v1/types" +import { Vote } from "BitCannaGlobal-bcna-client-ts/cosmos.gov.v1/types" +import { DepositParams } from "BitCannaGlobal-bcna-client-ts/cosmos.gov.v1/types" +import { VotingParams } from "BitCannaGlobal-bcna-client-ts/cosmos.gov.v1/types" +import { TallyParams } from "BitCannaGlobal-bcna-client-ts/cosmos.gov.v1/types" +import { Params } from "BitCannaGlobal-bcna-client-ts/cosmos.gov.v1/types" + + +export { WeightedVoteOption, Deposit, Proposal, TallyResult, Vote, DepositParams, VotingParams, TallyParams, Params }; + +function initClient(vuexGetters) { + return new Client(vuexGetters['common/env/getEnv'], vuexGetters['common/wallet/signer']) +} + +function mergeResults(value, next_values) { + for (let prop of Object.keys(next_values)) { + if (Array.isArray(next_values[prop])) { + value[prop]=[...value[prop], ...next_values[prop]] + }else{ + value[prop]=next_values[prop] + } + } + return value +} + +type Field = { + name: string; + type: unknown; +} +function getStructure(template) { + let structure: {fields: Field[]} = { fields: [] } + for (const [key, value] of Object.entries(template)) { + let field = { name: key, type: typeof value } + structure.fields.push(field) + } + return structure +} +const getDefaultState = () => { + return { + Proposal: {}, + Proposals: {}, + Vote: {}, + Votes: {}, + Params: {}, + Deposit: {}, + Deposits: {}, + TallyResult: {}, + + _Structure: { + WeightedVoteOption: getStructure(WeightedVoteOption.fromPartial({})), + Deposit: getStructure(Deposit.fromPartial({})), + Proposal: getStructure(Proposal.fromPartial({})), + TallyResult: getStructure(TallyResult.fromPartial({})), + Vote: getStructure(Vote.fromPartial({})), + DepositParams: getStructure(DepositParams.fromPartial({})), + VotingParams: getStructure(VotingParams.fromPartial({})), + TallyParams: getStructure(TallyParams.fromPartial({})), + Params: getStructure(Params.fromPartial({})), + + }, + _Registry: registry, + _Subscriptions: new Set(), + } +} + +// initial state +const state = getDefaultState() + +export default { + namespaced: true, + state, + mutations: { + RESET_STATE(state) { + Object.assign(state, getDefaultState()) + }, + QUERY(state, { query, key, value }) { + state[query][JSON.stringify(key)] = value + }, + SUBSCRIBE(state, subscription) { + state._Subscriptions.add(JSON.stringify(subscription)) + }, + UNSUBSCRIBE(state, subscription) { + state._Subscriptions.delete(JSON.stringify(subscription)) + } + }, + getters: { + getProposal: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Proposal[JSON.stringify(params)] ?? {} + }, + getProposals: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Proposals[JSON.stringify(params)] ?? {} + }, + getVote: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Vote[JSON.stringify(params)] ?? {} + }, + getVotes: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Votes[JSON.stringify(params)] ?? {} + }, + getParams: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Params[JSON.stringify(params)] ?? {} + }, + getDeposit: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Deposit[JSON.stringify(params)] ?? {} + }, + getDeposits: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Deposits[JSON.stringify(params)] ?? {} + }, + getTallyResult: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.TallyResult[JSON.stringify(params)] ?? {} + }, + + getTypeStructure: (state) => (type) => { + return state._Structure[type].fields + }, + getRegistry: (state) => { + return state._Registry + } + }, + actions: { + init({ dispatch, rootGetters }) { + console.log('Vuex module: cosmos.gov.v1 initialized!') + if (rootGetters['common/env/client']) { + rootGetters['common/env/client'].on('newblock', () => { + dispatch('StoreUpdate') + }) + } + }, + resetState({ commit }) { + commit('RESET_STATE') + }, + unsubscribe({ commit }, subscription) { + commit('UNSUBSCRIBE', subscription) + }, + async StoreUpdate({ state, dispatch }) { + state._Subscriptions.forEach(async (subscription) => { + try { + const sub=JSON.parse(subscription) + await dispatch(sub.action, sub.payload) + }catch(e) { + throw new Error('Subscriptions: ' + e.message) + } + }) + }, + + + + + + + async QueryProposal({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosGovV1.query.queryProposal( key.proposal_id)).data + + + commit('QUERY', { query: 'Proposal', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryProposal', payload: { options: { all }, params: {...key},query }}) + return getters['getProposal']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryProposal API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryProposals({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosGovV1.query.queryProposals(query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.CosmosGovV1.query.queryProposals({...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'Proposals', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryProposals', payload: { options: { all }, params: {...key},query }}) + return getters['getProposals']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryProposals API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryVote({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosGovV1.query.queryVote( key.proposal_id, key.voter)).data + + + commit('QUERY', { query: 'Vote', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryVote', payload: { options: { all }, params: {...key},query }}) + return getters['getVote']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryVote API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryVotes({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosGovV1.query.queryVotes( key.proposal_id, query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.CosmosGovV1.query.queryVotes( key.proposal_id, {...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'Votes', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryVotes', payload: { options: { all }, params: {...key},query }}) + return getters['getVotes']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryVotes API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryParams({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosGovV1.query.queryParams( key.params_type)).data + + + commit('QUERY', { query: 'Params', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryParams', payload: { options: { all }, params: {...key},query }}) + return getters['getParams']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryParams API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryDeposit({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosGovV1.query.queryDeposit( key.proposal_id, key.depositor)).data + + + commit('QUERY', { query: 'Deposit', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryDeposit', payload: { options: { all }, params: {...key},query }}) + return getters['getDeposit']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryDeposit API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryDeposits({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosGovV1.query.queryDeposits( key.proposal_id, query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.CosmosGovV1.query.queryDeposits( key.proposal_id, {...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'Deposits', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryDeposits', payload: { options: { all }, params: {...key},query }}) + return getters['getDeposits']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryDeposits API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryTallyResult({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosGovV1.query.queryTallyResult( key.proposal_id)).data + + + commit('QUERY', { query: 'TallyResult', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryTallyResult', payload: { options: { all }, params: {...key},query }}) + return getters['getTallyResult']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryTallyResult API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + async sendMsgDeposit({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.CosmosGovV1.tx.sendMsgDeposit({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgDeposit:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgDeposit:Send Could not broadcast Tx: '+ e.message) + } + } + }, + async sendMsgUpdateParams({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.CosmosGovV1.tx.sendMsgUpdateParams({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgUpdateParams:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgUpdateParams:Send Could not broadcast Tx: '+ e.message) + } + } + }, + async sendMsgVoteWeighted({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.CosmosGovV1.tx.sendMsgVoteWeighted({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgVoteWeighted:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgVoteWeighted:Send Could not broadcast Tx: '+ e.message) + } + } + }, + async sendMsgSubmitProposal({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.CosmosGovV1.tx.sendMsgSubmitProposal({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgSubmitProposal:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgSubmitProposal:Send Could not broadcast Tx: '+ e.message) + } + } + }, + async sendMsgVote({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.CosmosGovV1.tx.sendMsgVote({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgVote:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgVote:Send Could not broadcast Tx: '+ e.message) + } + } + }, + + async MsgDeposit({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.CosmosGovV1.tx.msgDeposit({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgDeposit:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgDeposit:Create Could not create message: ' + e.message) + } + } + }, + async MsgUpdateParams({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.CosmosGovV1.tx.msgUpdateParams({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgUpdateParams:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgUpdateParams:Create Could not create message: ' + e.message) + } + } + }, + async MsgVoteWeighted({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.CosmosGovV1.tx.msgVoteWeighted({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgVoteWeighted:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgVoteWeighted:Create Could not create message: ' + e.message) + } + } + }, + async MsgSubmitProposal({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.CosmosGovV1.tx.msgSubmitProposal({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgSubmitProposal:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgSubmitProposal:Create Could not create message: ' + e.message) + } + } + }, + async MsgVote({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.CosmosGovV1.tx.msgVote({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgVote:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgVote:Create Could not create message: ' + e.message) + } + } + }, + + } +} \ No newline at end of file diff --git a/vue/src/store/generated/cosmos.gov.v1beta1/index.ts b/vue/src/store/generated/cosmos.gov.v1beta1/index.ts new file mode 100755 index 00000000..3f2ee500 --- /dev/null +++ b/vue/src/store/generated/cosmos.gov.v1beta1/index.ts @@ -0,0 +1,473 @@ +import { Client, registry, MissingWalletError } from 'BitCannaGlobal-bcna-client-ts' + +import { WeightedVoteOption } from "BitCannaGlobal-bcna-client-ts/cosmos.gov.v1beta1/types" +import { TextProposal } from "BitCannaGlobal-bcna-client-ts/cosmos.gov.v1beta1/types" +import { Deposit } from "BitCannaGlobal-bcna-client-ts/cosmos.gov.v1beta1/types" +import { Proposal } from "BitCannaGlobal-bcna-client-ts/cosmos.gov.v1beta1/types" +import { TallyResult } from "BitCannaGlobal-bcna-client-ts/cosmos.gov.v1beta1/types" +import { Vote } from "BitCannaGlobal-bcna-client-ts/cosmos.gov.v1beta1/types" +import { DepositParams } from "BitCannaGlobal-bcna-client-ts/cosmos.gov.v1beta1/types" +import { VotingParams } from "BitCannaGlobal-bcna-client-ts/cosmos.gov.v1beta1/types" +import { TallyParams } from "BitCannaGlobal-bcna-client-ts/cosmos.gov.v1beta1/types" + + +export { WeightedVoteOption, TextProposal, Deposit, Proposal, TallyResult, Vote, DepositParams, VotingParams, TallyParams }; + +function initClient(vuexGetters) { + return new Client(vuexGetters['common/env/getEnv'], vuexGetters['common/wallet/signer']) +} + +function mergeResults(value, next_values) { + for (let prop of Object.keys(next_values)) { + if (Array.isArray(next_values[prop])) { + value[prop]=[...value[prop], ...next_values[prop]] + }else{ + value[prop]=next_values[prop] + } + } + return value +} + +type Field = { + name: string; + type: unknown; +} +function getStructure(template) { + let structure: {fields: Field[]} = { fields: [] } + for (const [key, value] of Object.entries(template)) { + let field = { name: key, type: typeof value } + structure.fields.push(field) + } + return structure +} +const getDefaultState = () => { + return { + Proposal: {}, + Proposals: {}, + Vote: {}, + Votes: {}, + Params: {}, + Deposit: {}, + Deposits: {}, + TallyResult: {}, + + _Structure: { + WeightedVoteOption: getStructure(WeightedVoteOption.fromPartial({})), + TextProposal: getStructure(TextProposal.fromPartial({})), + Deposit: getStructure(Deposit.fromPartial({})), + Proposal: getStructure(Proposal.fromPartial({})), + TallyResult: getStructure(TallyResult.fromPartial({})), + Vote: getStructure(Vote.fromPartial({})), + DepositParams: getStructure(DepositParams.fromPartial({})), + VotingParams: getStructure(VotingParams.fromPartial({})), + TallyParams: getStructure(TallyParams.fromPartial({})), + + }, + _Registry: registry, + _Subscriptions: new Set(), + } +} + +// initial state +const state = getDefaultState() + +export default { + namespaced: true, + state, + mutations: { + RESET_STATE(state) { + Object.assign(state, getDefaultState()) + }, + QUERY(state, { query, key, value }) { + state[query][JSON.stringify(key)] = value + }, + SUBSCRIBE(state, subscription) { + state._Subscriptions.add(JSON.stringify(subscription)) + }, + UNSUBSCRIBE(state, subscription) { + state._Subscriptions.delete(JSON.stringify(subscription)) + } + }, + getters: { + getProposal: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Proposal[JSON.stringify(params)] ?? {} + }, + getProposals: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Proposals[JSON.stringify(params)] ?? {} + }, + getVote: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Vote[JSON.stringify(params)] ?? {} + }, + getVotes: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Votes[JSON.stringify(params)] ?? {} + }, + getParams: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Params[JSON.stringify(params)] ?? {} + }, + getDeposit: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Deposit[JSON.stringify(params)] ?? {} + }, + getDeposits: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Deposits[JSON.stringify(params)] ?? {} + }, + getTallyResult: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.TallyResult[JSON.stringify(params)] ?? {} + }, + + getTypeStructure: (state) => (type) => { + return state._Structure[type].fields + }, + getRegistry: (state) => { + return state._Registry + } + }, + actions: { + init({ dispatch, rootGetters }) { + console.log('Vuex module: cosmos.gov.v1beta1 initialized!') + if (rootGetters['common/env/client']) { + rootGetters['common/env/client'].on('newblock', () => { + dispatch('StoreUpdate') + }) + } + }, + resetState({ commit }) { + commit('RESET_STATE') + }, + unsubscribe({ commit }, subscription) { + commit('UNSUBSCRIBE', subscription) + }, + async StoreUpdate({ state, dispatch }) { + state._Subscriptions.forEach(async (subscription) => { + try { + const sub=JSON.parse(subscription) + await dispatch(sub.action, sub.payload) + }catch(e) { + throw new Error('Subscriptions: ' + e.message) + } + }) + }, + + + + + + + async QueryProposal({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosGovV1Beta1.query.queryProposal( key.proposal_id)).data + + + commit('QUERY', { query: 'Proposal', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryProposal', payload: { options: { all }, params: {...key},query }}) + return getters['getProposal']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryProposal API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryProposals({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosGovV1Beta1.query.queryProposals(query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.CosmosGovV1Beta1.query.queryProposals({...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'Proposals', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryProposals', payload: { options: { all }, params: {...key},query }}) + return getters['getProposals']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryProposals API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryVote({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosGovV1Beta1.query.queryVote( key.proposal_id, key.voter)).data + + + commit('QUERY', { query: 'Vote', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryVote', payload: { options: { all }, params: {...key},query }}) + return getters['getVote']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryVote API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryVotes({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosGovV1Beta1.query.queryVotes( key.proposal_id, query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.CosmosGovV1Beta1.query.queryVotes( key.proposal_id, {...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'Votes', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryVotes', payload: { options: { all }, params: {...key},query }}) + return getters['getVotes']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryVotes API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryParams({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosGovV1Beta1.query.queryParams( key.params_type)).data + + + commit('QUERY', { query: 'Params', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryParams', payload: { options: { all }, params: {...key},query }}) + return getters['getParams']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryParams API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryDeposit({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosGovV1Beta1.query.queryDeposit( key.proposal_id, key.depositor)).data + + + commit('QUERY', { query: 'Deposit', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryDeposit', payload: { options: { all }, params: {...key},query }}) + return getters['getDeposit']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryDeposit API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryDeposits({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosGovV1Beta1.query.queryDeposits( key.proposal_id, query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.CosmosGovV1Beta1.query.queryDeposits( key.proposal_id, {...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'Deposits', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryDeposits', payload: { options: { all }, params: {...key},query }}) + return getters['getDeposits']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryDeposits API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryTallyResult({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosGovV1Beta1.query.queryTallyResult( key.proposal_id)).data + + + commit('QUERY', { query: 'TallyResult', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryTallyResult', payload: { options: { all }, params: {...key},query }}) + return getters['getTallyResult']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryTallyResult API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + async sendMsgSubmitProposal({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.CosmosGovV1Beta1.tx.sendMsgSubmitProposal({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgSubmitProposal:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgSubmitProposal:Send Could not broadcast Tx: '+ e.message) + } + } + }, + async sendMsgVoteWeighted({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.CosmosGovV1Beta1.tx.sendMsgVoteWeighted({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgVoteWeighted:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgVoteWeighted:Send Could not broadcast Tx: '+ e.message) + } + } + }, + async sendMsgVote({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.CosmosGovV1Beta1.tx.sendMsgVote({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgVote:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgVote:Send Could not broadcast Tx: '+ e.message) + } + } + }, + async sendMsgDeposit({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.CosmosGovV1Beta1.tx.sendMsgDeposit({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgDeposit:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgDeposit:Send Could not broadcast Tx: '+ e.message) + } + } + }, + + async MsgSubmitProposal({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.CosmosGovV1Beta1.tx.msgSubmitProposal({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgSubmitProposal:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgSubmitProposal:Create Could not create message: ' + e.message) + } + } + }, + async MsgVoteWeighted({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.CosmosGovV1Beta1.tx.msgVoteWeighted({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgVoteWeighted:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgVoteWeighted:Create Could not create message: ' + e.message) + } + } + }, + async MsgVote({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.CosmosGovV1Beta1.tx.msgVote({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgVote:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgVote:Create Could not create message: ' + e.message) + } + } + }, + async MsgDeposit({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.CosmosGovV1Beta1.tx.msgDeposit({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgDeposit:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgDeposit:Create Could not create message: ' + e.message) + } + } + }, + + } +} \ No newline at end of file diff --git a/vue/src/store/generated/cosmos.group.v1/index.ts b/vue/src/store/generated/cosmos.group.v1/index.ts new file mode 100755 index 00000000..1956fa24 --- /dev/null +++ b/vue/src/store/generated/cosmos.group.v1/index.ts @@ -0,0 +1,965 @@ +import { Client, registry, MissingWalletError } from 'BitCannaGlobal-bcna-client-ts' + +import { EventCreateGroup } from "BitCannaGlobal-bcna-client-ts/cosmos.group.v1/types" +import { EventUpdateGroup } from "BitCannaGlobal-bcna-client-ts/cosmos.group.v1/types" +import { EventCreateGroupPolicy } from "BitCannaGlobal-bcna-client-ts/cosmos.group.v1/types" +import { EventUpdateGroupPolicy } from "BitCannaGlobal-bcna-client-ts/cosmos.group.v1/types" +import { EventSubmitProposal } from "BitCannaGlobal-bcna-client-ts/cosmos.group.v1/types" +import { EventWithdrawProposal } from "BitCannaGlobal-bcna-client-ts/cosmos.group.v1/types" +import { EventVote } from "BitCannaGlobal-bcna-client-ts/cosmos.group.v1/types" +import { EventExec } from "BitCannaGlobal-bcna-client-ts/cosmos.group.v1/types" +import { EventLeaveGroup } from "BitCannaGlobal-bcna-client-ts/cosmos.group.v1/types" +import { EventProposalPruned } from "BitCannaGlobal-bcna-client-ts/cosmos.group.v1/types" +import { Member } from "BitCannaGlobal-bcna-client-ts/cosmos.group.v1/types" +import { MemberRequest } from "BitCannaGlobal-bcna-client-ts/cosmos.group.v1/types" +import { ThresholdDecisionPolicy } from "BitCannaGlobal-bcna-client-ts/cosmos.group.v1/types" +import { PercentageDecisionPolicy } from "BitCannaGlobal-bcna-client-ts/cosmos.group.v1/types" +import { DecisionPolicyWindows } from "BitCannaGlobal-bcna-client-ts/cosmos.group.v1/types" +import { GroupInfo } from "BitCannaGlobal-bcna-client-ts/cosmos.group.v1/types" +import { GroupMember } from "BitCannaGlobal-bcna-client-ts/cosmos.group.v1/types" +import { GroupPolicyInfo } from "BitCannaGlobal-bcna-client-ts/cosmos.group.v1/types" +import { Proposal } from "BitCannaGlobal-bcna-client-ts/cosmos.group.v1/types" +import { TallyResult } from "BitCannaGlobal-bcna-client-ts/cosmos.group.v1/types" +import { Vote } from "BitCannaGlobal-bcna-client-ts/cosmos.group.v1/types" + + +export { EventCreateGroup, EventUpdateGroup, EventCreateGroupPolicy, EventUpdateGroupPolicy, EventSubmitProposal, EventWithdrawProposal, EventVote, EventExec, EventLeaveGroup, EventProposalPruned, Member, MemberRequest, ThresholdDecisionPolicy, PercentageDecisionPolicy, DecisionPolicyWindows, GroupInfo, GroupMember, GroupPolicyInfo, Proposal, TallyResult, Vote }; + +function initClient(vuexGetters) { + return new Client(vuexGetters['common/env/getEnv'], vuexGetters['common/wallet/signer']) +} + +function mergeResults(value, next_values) { + for (let prop of Object.keys(next_values)) { + if (Array.isArray(next_values[prop])) { + value[prop]=[...value[prop], ...next_values[prop]] + }else{ + value[prop]=next_values[prop] + } + } + return value +} + +type Field = { + name: string; + type: unknown; +} +function getStructure(template) { + let structure: {fields: Field[]} = { fields: [] } + for (const [key, value] of Object.entries(template)) { + let field = { name: key, type: typeof value } + structure.fields.push(field) + } + return structure +} +const getDefaultState = () => { + return { + GroupInfo: {}, + GroupPolicyInfo: {}, + GroupMembers: {}, + GroupsByAdmin: {}, + GroupPoliciesByGroup: {}, + GroupPoliciesByAdmin: {}, + Proposal: {}, + ProposalsByGroupPolicy: {}, + VoteByProposalVoter: {}, + VotesByProposal: {}, + VotesByVoter: {}, + GroupsByMember: {}, + TallyResult: {}, + Groups: {}, + + _Structure: { + EventCreateGroup: getStructure(EventCreateGroup.fromPartial({})), + EventUpdateGroup: getStructure(EventUpdateGroup.fromPartial({})), + EventCreateGroupPolicy: getStructure(EventCreateGroupPolicy.fromPartial({})), + EventUpdateGroupPolicy: getStructure(EventUpdateGroupPolicy.fromPartial({})), + EventSubmitProposal: getStructure(EventSubmitProposal.fromPartial({})), + EventWithdrawProposal: getStructure(EventWithdrawProposal.fromPartial({})), + EventVote: getStructure(EventVote.fromPartial({})), + EventExec: getStructure(EventExec.fromPartial({})), + EventLeaveGroup: getStructure(EventLeaveGroup.fromPartial({})), + EventProposalPruned: getStructure(EventProposalPruned.fromPartial({})), + Member: getStructure(Member.fromPartial({})), + MemberRequest: getStructure(MemberRequest.fromPartial({})), + ThresholdDecisionPolicy: getStructure(ThresholdDecisionPolicy.fromPartial({})), + PercentageDecisionPolicy: getStructure(PercentageDecisionPolicy.fromPartial({})), + DecisionPolicyWindows: getStructure(DecisionPolicyWindows.fromPartial({})), + GroupInfo: getStructure(GroupInfo.fromPartial({})), + GroupMember: getStructure(GroupMember.fromPartial({})), + GroupPolicyInfo: getStructure(GroupPolicyInfo.fromPartial({})), + Proposal: getStructure(Proposal.fromPartial({})), + TallyResult: getStructure(TallyResult.fromPartial({})), + Vote: getStructure(Vote.fromPartial({})), + + }, + _Registry: registry, + _Subscriptions: new Set(), + } +} + +// initial state +const state = getDefaultState() + +export default { + namespaced: true, + state, + mutations: { + RESET_STATE(state) { + Object.assign(state, getDefaultState()) + }, + QUERY(state, { query, key, value }) { + state[query][JSON.stringify(key)] = value + }, + SUBSCRIBE(state, subscription) { + state._Subscriptions.add(JSON.stringify(subscription)) + }, + UNSUBSCRIBE(state, subscription) { + state._Subscriptions.delete(JSON.stringify(subscription)) + } + }, + getters: { + getGroupInfo: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.GroupInfo[JSON.stringify(params)] ?? {} + }, + getGroupPolicyInfo: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.GroupPolicyInfo[JSON.stringify(params)] ?? {} + }, + getGroupMembers: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.GroupMembers[JSON.stringify(params)] ?? {} + }, + getGroupsByAdmin: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.GroupsByAdmin[JSON.stringify(params)] ?? {} + }, + getGroupPoliciesByGroup: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.GroupPoliciesByGroup[JSON.stringify(params)] ?? {} + }, + getGroupPoliciesByAdmin: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.GroupPoliciesByAdmin[JSON.stringify(params)] ?? {} + }, + getProposal: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Proposal[JSON.stringify(params)] ?? {} + }, + getProposalsByGroupPolicy: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.ProposalsByGroupPolicy[JSON.stringify(params)] ?? {} + }, + getVoteByProposalVoter: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.VoteByProposalVoter[JSON.stringify(params)] ?? {} + }, + getVotesByProposal: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.VotesByProposal[JSON.stringify(params)] ?? {} + }, + getVotesByVoter: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.VotesByVoter[JSON.stringify(params)] ?? {} + }, + getGroupsByMember: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.GroupsByMember[JSON.stringify(params)] ?? {} + }, + getTallyResult: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.TallyResult[JSON.stringify(params)] ?? {} + }, + getGroups: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Groups[JSON.stringify(params)] ?? {} + }, + + getTypeStructure: (state) => (type) => { + return state._Structure[type].fields + }, + getRegistry: (state) => { + return state._Registry + } + }, + actions: { + init({ dispatch, rootGetters }) { + console.log('Vuex module: cosmos.group.v1 initialized!') + if (rootGetters['common/env/client']) { + rootGetters['common/env/client'].on('newblock', () => { + dispatch('StoreUpdate') + }) + } + }, + resetState({ commit }) { + commit('RESET_STATE') + }, + unsubscribe({ commit }, subscription) { + commit('UNSUBSCRIBE', subscription) + }, + async StoreUpdate({ state, dispatch }) { + state._Subscriptions.forEach(async (subscription) => { + try { + const sub=JSON.parse(subscription) + await dispatch(sub.action, sub.payload) + }catch(e) { + throw new Error('Subscriptions: ' + e.message) + } + }) + }, + + + + + + + async QueryGroupInfo({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosGroupV1.query.queryGroupInfo( key.group_id)).data + + + commit('QUERY', { query: 'GroupInfo', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryGroupInfo', payload: { options: { all }, params: {...key},query }}) + return getters['getGroupInfo']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryGroupInfo API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryGroupPolicyInfo({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosGroupV1.query.queryGroupPolicyInfo( key.address)).data + + + commit('QUERY', { query: 'GroupPolicyInfo', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryGroupPolicyInfo', payload: { options: { all }, params: {...key},query }}) + return getters['getGroupPolicyInfo']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryGroupPolicyInfo API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryGroupMembers({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosGroupV1.query.queryGroupMembers( key.group_id, query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.CosmosGroupV1.query.queryGroupMembers( key.group_id, {...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'GroupMembers', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryGroupMembers', payload: { options: { all }, params: {...key},query }}) + return getters['getGroupMembers']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryGroupMembers API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryGroupsByAdmin({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosGroupV1.query.queryGroupsByAdmin( key.admin, query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.CosmosGroupV1.query.queryGroupsByAdmin( key.admin, {...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'GroupsByAdmin', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryGroupsByAdmin', payload: { options: { all }, params: {...key},query }}) + return getters['getGroupsByAdmin']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryGroupsByAdmin API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryGroupPoliciesByGroup({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosGroupV1.query.queryGroupPoliciesByGroup( key.group_id, query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.CosmosGroupV1.query.queryGroupPoliciesByGroup( key.group_id, {...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'GroupPoliciesByGroup', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryGroupPoliciesByGroup', payload: { options: { all }, params: {...key},query }}) + return getters['getGroupPoliciesByGroup']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryGroupPoliciesByGroup API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryGroupPoliciesByAdmin({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosGroupV1.query.queryGroupPoliciesByAdmin( key.admin, query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.CosmosGroupV1.query.queryGroupPoliciesByAdmin( key.admin, {...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'GroupPoliciesByAdmin', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryGroupPoliciesByAdmin', payload: { options: { all }, params: {...key},query }}) + return getters['getGroupPoliciesByAdmin']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryGroupPoliciesByAdmin API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryProposal({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosGroupV1.query.queryProposal( key.proposal_id)).data + + + commit('QUERY', { query: 'Proposal', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryProposal', payload: { options: { all }, params: {...key},query }}) + return getters['getProposal']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryProposal API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryProposalsByGroupPolicy({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosGroupV1.query.queryProposalsByGroupPolicy( key.address, query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.CosmosGroupV1.query.queryProposalsByGroupPolicy( key.address, {...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'ProposalsByGroupPolicy', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryProposalsByGroupPolicy', payload: { options: { all }, params: {...key},query }}) + return getters['getProposalsByGroupPolicy']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryProposalsByGroupPolicy API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryVoteByProposalVoter({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosGroupV1.query.queryVoteByProposalVoter( key.proposal_id, key.voter)).data + + + commit('QUERY', { query: 'VoteByProposalVoter', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryVoteByProposalVoter', payload: { options: { all }, params: {...key},query }}) + return getters['getVoteByProposalVoter']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryVoteByProposalVoter API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryVotesByProposal({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosGroupV1.query.queryVotesByProposal( key.proposal_id, query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.CosmosGroupV1.query.queryVotesByProposal( key.proposal_id, {...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'VotesByProposal', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryVotesByProposal', payload: { options: { all }, params: {...key},query }}) + return getters['getVotesByProposal']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryVotesByProposal API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryVotesByVoter({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosGroupV1.query.queryVotesByVoter( key.voter, query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.CosmosGroupV1.query.queryVotesByVoter( key.voter, {...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'VotesByVoter', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryVotesByVoter', payload: { options: { all }, params: {...key},query }}) + return getters['getVotesByVoter']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryVotesByVoter API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryGroupsByMember({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosGroupV1.query.queryGroupsByMember( key.address, query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.CosmosGroupV1.query.queryGroupsByMember( key.address, {...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'GroupsByMember', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryGroupsByMember', payload: { options: { all }, params: {...key},query }}) + return getters['getGroupsByMember']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryGroupsByMember API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryTallyResult({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosGroupV1.query.queryTallyResult( key.proposal_id)).data + + + commit('QUERY', { query: 'TallyResult', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryTallyResult', payload: { options: { all }, params: {...key},query }}) + return getters['getTallyResult']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryTallyResult API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryGroups({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosGroupV1.query.queryGroups(query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.CosmosGroupV1.query.queryGroups({...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'Groups', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryGroups', payload: { options: { all }, params: {...key},query }}) + return getters['getGroups']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryGroups API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + async sendMsgCreateGroup({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.CosmosGroupV1.tx.sendMsgCreateGroup({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgCreateGroup:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgCreateGroup:Send Could not broadcast Tx: '+ e.message) + } + } + }, + async sendMsgUpdateGroupAdmin({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.CosmosGroupV1.tx.sendMsgUpdateGroupAdmin({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgUpdateGroupAdmin:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgUpdateGroupAdmin:Send Could not broadcast Tx: '+ e.message) + } + } + }, + async sendMsgCreateGroupWithPolicy({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.CosmosGroupV1.tx.sendMsgCreateGroupWithPolicy({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgCreateGroupWithPolicy:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgCreateGroupWithPolicy:Send Could not broadcast Tx: '+ e.message) + } + } + }, + async sendMsgUpdateGroupPolicyDecisionPolicy({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.CosmosGroupV1.tx.sendMsgUpdateGroupPolicyDecisionPolicy({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgUpdateGroupPolicyDecisionPolicy:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgUpdateGroupPolicyDecisionPolicy:Send Could not broadcast Tx: '+ e.message) + } + } + }, + async sendMsgCreateGroupPolicy({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.CosmosGroupV1.tx.sendMsgCreateGroupPolicy({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgCreateGroupPolicy:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgCreateGroupPolicy:Send Could not broadcast Tx: '+ e.message) + } + } + }, + async sendMsgUpdateGroupMetadata({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.CosmosGroupV1.tx.sendMsgUpdateGroupMetadata({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgUpdateGroupMetadata:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgUpdateGroupMetadata:Send Could not broadcast Tx: '+ e.message) + } + } + }, + async sendMsgUpdateGroupPolicyAdmin({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.CosmosGroupV1.tx.sendMsgUpdateGroupPolicyAdmin({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgUpdateGroupPolicyAdmin:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgUpdateGroupPolicyAdmin:Send Could not broadcast Tx: '+ e.message) + } + } + }, + async sendMsgVote({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.CosmosGroupV1.tx.sendMsgVote({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgVote:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgVote:Send Could not broadcast Tx: '+ e.message) + } + } + }, + async sendMsgSubmitProposal({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.CosmosGroupV1.tx.sendMsgSubmitProposal({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgSubmitProposal:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgSubmitProposal:Send Could not broadcast Tx: '+ e.message) + } + } + }, + async sendMsgUpdateGroupMembers({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.CosmosGroupV1.tx.sendMsgUpdateGroupMembers({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgUpdateGroupMembers:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgUpdateGroupMembers:Send Could not broadcast Tx: '+ e.message) + } + } + }, + async sendMsgExec({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.CosmosGroupV1.tx.sendMsgExec({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgExec:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgExec:Send Could not broadcast Tx: '+ e.message) + } + } + }, + async sendMsgUpdateGroupPolicyMetadata({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.CosmosGroupV1.tx.sendMsgUpdateGroupPolicyMetadata({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgUpdateGroupPolicyMetadata:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgUpdateGroupPolicyMetadata:Send Could not broadcast Tx: '+ e.message) + } + } + }, + async sendMsgLeaveGroup({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.CosmosGroupV1.tx.sendMsgLeaveGroup({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgLeaveGroup:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgLeaveGroup:Send Could not broadcast Tx: '+ e.message) + } + } + }, + async sendMsgWithdrawProposal({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.CosmosGroupV1.tx.sendMsgWithdrawProposal({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgWithdrawProposal:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgWithdrawProposal:Send Could not broadcast Tx: '+ e.message) + } + } + }, + + async MsgCreateGroup({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.CosmosGroupV1.tx.msgCreateGroup({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgCreateGroup:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgCreateGroup:Create Could not create message: ' + e.message) + } + } + }, + async MsgUpdateGroupAdmin({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.CosmosGroupV1.tx.msgUpdateGroupAdmin({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgUpdateGroupAdmin:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgUpdateGroupAdmin:Create Could not create message: ' + e.message) + } + } + }, + async MsgCreateGroupWithPolicy({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.CosmosGroupV1.tx.msgCreateGroupWithPolicy({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgCreateGroupWithPolicy:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgCreateGroupWithPolicy:Create Could not create message: ' + e.message) + } + } + }, + async MsgUpdateGroupPolicyDecisionPolicy({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.CosmosGroupV1.tx.msgUpdateGroupPolicyDecisionPolicy({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgUpdateGroupPolicyDecisionPolicy:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgUpdateGroupPolicyDecisionPolicy:Create Could not create message: ' + e.message) + } + } + }, + async MsgCreateGroupPolicy({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.CosmosGroupV1.tx.msgCreateGroupPolicy({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgCreateGroupPolicy:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgCreateGroupPolicy:Create Could not create message: ' + e.message) + } + } + }, + async MsgUpdateGroupMetadata({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.CosmosGroupV1.tx.msgUpdateGroupMetadata({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgUpdateGroupMetadata:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgUpdateGroupMetadata:Create Could not create message: ' + e.message) + } + } + }, + async MsgUpdateGroupPolicyAdmin({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.CosmosGroupV1.tx.msgUpdateGroupPolicyAdmin({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgUpdateGroupPolicyAdmin:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgUpdateGroupPolicyAdmin:Create Could not create message: ' + e.message) + } + } + }, + async MsgVote({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.CosmosGroupV1.tx.msgVote({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgVote:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgVote:Create Could not create message: ' + e.message) + } + } + }, + async MsgSubmitProposal({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.CosmosGroupV1.tx.msgSubmitProposal({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgSubmitProposal:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgSubmitProposal:Create Could not create message: ' + e.message) + } + } + }, + async MsgUpdateGroupMembers({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.CosmosGroupV1.tx.msgUpdateGroupMembers({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgUpdateGroupMembers:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgUpdateGroupMembers:Create Could not create message: ' + e.message) + } + } + }, + async MsgExec({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.CosmosGroupV1.tx.msgExec({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgExec:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgExec:Create Could not create message: ' + e.message) + } + } + }, + async MsgUpdateGroupPolicyMetadata({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.CosmosGroupV1.tx.msgUpdateGroupPolicyMetadata({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgUpdateGroupPolicyMetadata:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgUpdateGroupPolicyMetadata:Create Could not create message: ' + e.message) + } + } + }, + async MsgLeaveGroup({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.CosmosGroupV1.tx.msgLeaveGroup({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgLeaveGroup:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgLeaveGroup:Create Could not create message: ' + e.message) + } + } + }, + async MsgWithdrawProposal({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.CosmosGroupV1.tx.msgWithdrawProposal({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgWithdrawProposal:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgWithdrawProposal:Create Could not create message: ' + e.message) + } + } + }, + + } +} \ No newline at end of file diff --git a/vue/src/store/generated/cosmos.mint.v1beta1/index.ts b/vue/src/store/generated/cosmos.mint.v1beta1/index.ts new file mode 100755 index 00000000..983280fd --- /dev/null +++ b/vue/src/store/generated/cosmos.mint.v1beta1/index.ts @@ -0,0 +1,194 @@ +import { Client, registry, MissingWalletError } from 'BitCannaGlobal-bcna-client-ts' + +import { Minter } from "BitCannaGlobal-bcna-client-ts/cosmos.mint.v1beta1/types" +import { Params } from "BitCannaGlobal-bcna-client-ts/cosmos.mint.v1beta1/types" + + +export { Minter, Params }; + +function initClient(vuexGetters) { + return new Client(vuexGetters['common/env/getEnv'], vuexGetters['common/wallet/signer']) +} + +function mergeResults(value, next_values) { + for (let prop of Object.keys(next_values)) { + if (Array.isArray(next_values[prop])) { + value[prop]=[...value[prop], ...next_values[prop]] + }else{ + value[prop]=next_values[prop] + } + } + return value +} + +type Field = { + name: string; + type: unknown; +} +function getStructure(template) { + let structure: {fields: Field[]} = { fields: [] } + for (const [key, value] of Object.entries(template)) { + let field = { name: key, type: typeof value } + structure.fields.push(field) + } + return structure +} +const getDefaultState = () => { + return { + Params: {}, + Inflation: {}, + AnnualProvisions: {}, + + _Structure: { + Minter: getStructure(Minter.fromPartial({})), + Params: getStructure(Params.fromPartial({})), + + }, + _Registry: registry, + _Subscriptions: new Set(), + } +} + +// initial state +const state = getDefaultState() + +export default { + namespaced: true, + state, + mutations: { + RESET_STATE(state) { + Object.assign(state, getDefaultState()) + }, + QUERY(state, { query, key, value }) { + state[query][JSON.stringify(key)] = value + }, + SUBSCRIBE(state, subscription) { + state._Subscriptions.add(JSON.stringify(subscription)) + }, + UNSUBSCRIBE(state, subscription) { + state._Subscriptions.delete(JSON.stringify(subscription)) + } + }, + getters: { + getParams: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Params[JSON.stringify(params)] ?? {} + }, + getInflation: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Inflation[JSON.stringify(params)] ?? {} + }, + getAnnualProvisions: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.AnnualProvisions[JSON.stringify(params)] ?? {} + }, + + getTypeStructure: (state) => (type) => { + return state._Structure[type].fields + }, + getRegistry: (state) => { + return state._Registry + } + }, + actions: { + init({ dispatch, rootGetters }) { + console.log('Vuex module: cosmos.mint.v1beta1 initialized!') + if (rootGetters['common/env/client']) { + rootGetters['common/env/client'].on('newblock', () => { + dispatch('StoreUpdate') + }) + } + }, + resetState({ commit }) { + commit('RESET_STATE') + }, + unsubscribe({ commit }, subscription) { + commit('UNSUBSCRIBE', subscription) + }, + async StoreUpdate({ state, dispatch }) { + state._Subscriptions.forEach(async (subscription) => { + try { + const sub=JSON.parse(subscription) + await dispatch(sub.action, sub.payload) + }catch(e) { + throw new Error('Subscriptions: ' + e.message) + } + }) + }, + + + + + + + async QueryParams({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosMintV1Beta1.query.queryParams()).data + + + commit('QUERY', { query: 'Params', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryParams', payload: { options: { all }, params: {...key},query }}) + return getters['getParams']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryParams API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryInflation({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosMintV1Beta1.query.queryInflation()).data + + + commit('QUERY', { query: 'Inflation', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryInflation', payload: { options: { all }, params: {...key},query }}) + return getters['getInflation']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryInflation API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryAnnualProvisions({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosMintV1Beta1.query.queryAnnualProvisions()).data + + + commit('QUERY', { query: 'AnnualProvisions', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryAnnualProvisions', payload: { options: { all }, params: {...key},query }}) + return getters['getAnnualProvisions']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryAnnualProvisions API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + } +} \ No newline at end of file diff --git a/vue/src/store/generated/cosmos.nft.v1beta1/index.ts b/vue/src/store/generated/cosmos.nft.v1beta1/index.ts new file mode 100755 index 00000000..4d386a57 --- /dev/null +++ b/vue/src/store/generated/cosmos.nft.v1beta1/index.ts @@ -0,0 +1,326 @@ +import { Client, registry, MissingWalletError } from 'BitCannaGlobal-bcna-client-ts' + +import { EventSend } from "BitCannaGlobal-bcna-client-ts/cosmos.nft.v1beta1/types" +import { EventMint } from "BitCannaGlobal-bcna-client-ts/cosmos.nft.v1beta1/types" +import { EventBurn } from "BitCannaGlobal-bcna-client-ts/cosmos.nft.v1beta1/types" +import { Entry } from "BitCannaGlobal-bcna-client-ts/cosmos.nft.v1beta1/types" +import { Class } from "BitCannaGlobal-bcna-client-ts/cosmos.nft.v1beta1/types" +import { NFT } from "BitCannaGlobal-bcna-client-ts/cosmos.nft.v1beta1/types" + + +export { EventSend, EventMint, EventBurn, Entry, Class, NFT }; + +function initClient(vuexGetters) { + return new Client(vuexGetters['common/env/getEnv'], vuexGetters['common/wallet/signer']) +} + +function mergeResults(value, next_values) { + for (let prop of Object.keys(next_values)) { + if (Array.isArray(next_values[prop])) { + value[prop]=[...value[prop], ...next_values[prop]] + }else{ + value[prop]=next_values[prop] + } + } + return value +} + +type Field = { + name: string; + type: unknown; +} +function getStructure(template) { + let structure: {fields: Field[]} = { fields: [] } + for (const [key, value] of Object.entries(template)) { + let field = { name: key, type: typeof value } + structure.fields.push(field) + } + return structure +} +const getDefaultState = () => { + return { + Balance: {}, + Owner: {}, + Supply: {}, + NFTs: {}, + NFT: {}, + Class: {}, + Classes: {}, + + _Structure: { + EventSend: getStructure(EventSend.fromPartial({})), + EventMint: getStructure(EventMint.fromPartial({})), + EventBurn: getStructure(EventBurn.fromPartial({})), + Entry: getStructure(Entry.fromPartial({})), + Class: getStructure(Class.fromPartial({})), + NFT: getStructure(NFT.fromPartial({})), + + }, + _Registry: registry, + _Subscriptions: new Set(), + } +} + +// initial state +const state = getDefaultState() + +export default { + namespaced: true, + state, + mutations: { + RESET_STATE(state) { + Object.assign(state, getDefaultState()) + }, + QUERY(state, { query, key, value }) { + state[query][JSON.stringify(key)] = value + }, + SUBSCRIBE(state, subscription) { + state._Subscriptions.add(JSON.stringify(subscription)) + }, + UNSUBSCRIBE(state, subscription) { + state._Subscriptions.delete(JSON.stringify(subscription)) + } + }, + getters: { + getBalance: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Balance[JSON.stringify(params)] ?? {} + }, + getOwner: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Owner[JSON.stringify(params)] ?? {} + }, + getSupply: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Supply[JSON.stringify(params)] ?? {} + }, + getNFTs: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.NFTs[JSON.stringify(params)] ?? {} + }, + getNFT: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.NFT[JSON.stringify(params)] ?? {} + }, + getClass: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Class[JSON.stringify(params)] ?? {} + }, + getClasses: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Classes[JSON.stringify(params)] ?? {} + }, + + getTypeStructure: (state) => (type) => { + return state._Structure[type].fields + }, + getRegistry: (state) => { + return state._Registry + } + }, + actions: { + init({ dispatch, rootGetters }) { + console.log('Vuex module: cosmos.nft.v1beta1 initialized!') + if (rootGetters['common/env/client']) { + rootGetters['common/env/client'].on('newblock', () => { + dispatch('StoreUpdate') + }) + } + }, + resetState({ commit }) { + commit('RESET_STATE') + }, + unsubscribe({ commit }, subscription) { + commit('UNSUBSCRIBE', subscription) + }, + async StoreUpdate({ state, dispatch }) { + state._Subscriptions.forEach(async (subscription) => { + try { + const sub=JSON.parse(subscription) + await dispatch(sub.action, sub.payload) + }catch(e) { + throw new Error('Subscriptions: ' + e.message) + } + }) + }, + + + + + + + async QueryBalance({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosNftV1Beta1.query.queryBalance( key.owner, key.class_id)).data + + + commit('QUERY', { query: 'Balance', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryBalance', payload: { options: { all }, params: {...key},query }}) + return getters['getBalance']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryBalance API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryOwner({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosNftV1Beta1.query.queryOwner( key.class_id, key.id)).data + + + commit('QUERY', { query: 'Owner', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryOwner', payload: { options: { all }, params: {...key},query }}) + return getters['getOwner']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryOwner API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QuerySupply({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosNftV1Beta1.query.querySupply( key.class_id)).data + + + commit('QUERY', { query: 'Supply', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QuerySupply', payload: { options: { all }, params: {...key},query }}) + return getters['getSupply']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QuerySupply API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryNFTs({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosNftV1Beta1.query.queryNFTs(query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.CosmosNftV1Beta1.query.queryNFTs({...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'NFTs', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryNFTs', payload: { options: { all }, params: {...key},query }}) + return getters['getNFTs']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryNFTs API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryNFT({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosNftV1Beta1.query.queryNFT( key.class_id, key.id)).data + + + commit('QUERY', { query: 'NFT', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryNFT', payload: { options: { all }, params: {...key},query }}) + return getters['getNFT']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryNFT API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryClass({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosNftV1Beta1.query.queryClass( key.class_id)).data + + + commit('QUERY', { query: 'Class', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryClass', payload: { options: { all }, params: {...key},query }}) + return getters['getClass']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryClass API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryClasses({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosNftV1Beta1.query.queryClasses(query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.CosmosNftV1Beta1.query.queryClasses({...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'Classes', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryClasses', payload: { options: { all }, params: {...key},query }}) + return getters['getClasses']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryClasses API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + } +} \ No newline at end of file diff --git a/vue/src/store/generated/cosmos.params.v1beta1/index.ts b/vue/src/store/generated/cosmos.params.v1beta1/index.ts new file mode 100755 index 00000000..16c4787b --- /dev/null +++ b/vue/src/store/generated/cosmos.params.v1beta1/index.ts @@ -0,0 +1,171 @@ +import { Client, registry, MissingWalletError } from 'BitCannaGlobal-bcna-client-ts' + +import { ParameterChangeProposal } from "BitCannaGlobal-bcna-client-ts/cosmos.params.v1beta1/types" +import { ParamChange } from "BitCannaGlobal-bcna-client-ts/cosmos.params.v1beta1/types" +import { Subspace } from "BitCannaGlobal-bcna-client-ts/cosmos.params.v1beta1/types" + + +export { ParameterChangeProposal, ParamChange, Subspace }; + +function initClient(vuexGetters) { + return new Client(vuexGetters['common/env/getEnv'], vuexGetters['common/wallet/signer']) +} + +function mergeResults(value, next_values) { + for (let prop of Object.keys(next_values)) { + if (Array.isArray(next_values[prop])) { + value[prop]=[...value[prop], ...next_values[prop]] + }else{ + value[prop]=next_values[prop] + } + } + return value +} + +type Field = { + name: string; + type: unknown; +} +function getStructure(template) { + let structure: {fields: Field[]} = { fields: [] } + for (const [key, value] of Object.entries(template)) { + let field = { name: key, type: typeof value } + structure.fields.push(field) + } + return structure +} +const getDefaultState = () => { + return { + Params: {}, + Subspaces: {}, + + _Structure: { + ParameterChangeProposal: getStructure(ParameterChangeProposal.fromPartial({})), + ParamChange: getStructure(ParamChange.fromPartial({})), + Subspace: getStructure(Subspace.fromPartial({})), + + }, + _Registry: registry, + _Subscriptions: new Set(), + } +} + +// initial state +const state = getDefaultState() + +export default { + namespaced: true, + state, + mutations: { + RESET_STATE(state) { + Object.assign(state, getDefaultState()) + }, + QUERY(state, { query, key, value }) { + state[query][JSON.stringify(key)] = value + }, + SUBSCRIBE(state, subscription) { + state._Subscriptions.add(JSON.stringify(subscription)) + }, + UNSUBSCRIBE(state, subscription) { + state._Subscriptions.delete(JSON.stringify(subscription)) + } + }, + getters: { + getParams: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Params[JSON.stringify(params)] ?? {} + }, + getSubspaces: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Subspaces[JSON.stringify(params)] ?? {} + }, + + getTypeStructure: (state) => (type) => { + return state._Structure[type].fields + }, + getRegistry: (state) => { + return state._Registry + } + }, + actions: { + init({ dispatch, rootGetters }) { + console.log('Vuex module: cosmos.params.v1beta1 initialized!') + if (rootGetters['common/env/client']) { + rootGetters['common/env/client'].on('newblock', () => { + dispatch('StoreUpdate') + }) + } + }, + resetState({ commit }) { + commit('RESET_STATE') + }, + unsubscribe({ commit }, subscription) { + commit('UNSUBSCRIBE', subscription) + }, + async StoreUpdate({ state, dispatch }) { + state._Subscriptions.forEach(async (subscription) => { + try { + const sub=JSON.parse(subscription) + await dispatch(sub.action, sub.payload) + }catch(e) { + throw new Error('Subscriptions: ' + e.message) + } + }) + }, + + + + + + + async QueryParams({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosParamsV1Beta1.query.queryParams(query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.CosmosParamsV1Beta1.query.queryParams({...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'Params', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryParams', payload: { options: { all }, params: {...key},query }}) + return getters['getParams']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryParams API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QuerySubspaces({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosParamsV1Beta1.query.querySubspaces()).data + + + commit('QUERY', { query: 'Subspaces', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QuerySubspaces', payload: { options: { all }, params: {...key},query }}) + return getters['getSubspaces']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QuerySubspaces API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + } +} \ No newline at end of file diff --git a/vue/src/store/generated/cosmos.slashing.v1beta1/index.ts b/vue/src/store/generated/cosmos.slashing.v1beta1/index.ts new file mode 100755 index 00000000..8c7a9e6f --- /dev/null +++ b/vue/src/store/generated/cosmos.slashing.v1beta1/index.ts @@ -0,0 +1,231 @@ +import { Client, registry, MissingWalletError } from 'BitCannaGlobal-bcna-client-ts' + +import { SigningInfo } from "BitCannaGlobal-bcna-client-ts/cosmos.slashing.v1beta1/types" +import { ValidatorMissedBlocks } from "BitCannaGlobal-bcna-client-ts/cosmos.slashing.v1beta1/types" +import { MissedBlock } from "BitCannaGlobal-bcna-client-ts/cosmos.slashing.v1beta1/types" +import { ValidatorSigningInfo } from "BitCannaGlobal-bcna-client-ts/cosmos.slashing.v1beta1/types" +import { Params } from "BitCannaGlobal-bcna-client-ts/cosmos.slashing.v1beta1/types" + + +export { SigningInfo, ValidatorMissedBlocks, MissedBlock, ValidatorSigningInfo, Params }; + +function initClient(vuexGetters) { + return new Client(vuexGetters['common/env/getEnv'], vuexGetters['common/wallet/signer']) +} + +function mergeResults(value, next_values) { + for (let prop of Object.keys(next_values)) { + if (Array.isArray(next_values[prop])) { + value[prop]=[...value[prop], ...next_values[prop]] + }else{ + value[prop]=next_values[prop] + } + } + return value +} + +type Field = { + name: string; + type: unknown; +} +function getStructure(template) { + let structure: {fields: Field[]} = { fields: [] } + for (const [key, value] of Object.entries(template)) { + let field = { name: key, type: typeof value } + structure.fields.push(field) + } + return structure +} +const getDefaultState = () => { + return { + Params: {}, + SigningInfo: {}, + SigningInfos: {}, + + _Structure: { + SigningInfo: getStructure(SigningInfo.fromPartial({})), + ValidatorMissedBlocks: getStructure(ValidatorMissedBlocks.fromPartial({})), + MissedBlock: getStructure(MissedBlock.fromPartial({})), + ValidatorSigningInfo: getStructure(ValidatorSigningInfo.fromPartial({})), + Params: getStructure(Params.fromPartial({})), + + }, + _Registry: registry, + _Subscriptions: new Set(), + } +} + +// initial state +const state = getDefaultState() + +export default { + namespaced: true, + state, + mutations: { + RESET_STATE(state) { + Object.assign(state, getDefaultState()) + }, + QUERY(state, { query, key, value }) { + state[query][JSON.stringify(key)] = value + }, + SUBSCRIBE(state, subscription) { + state._Subscriptions.add(JSON.stringify(subscription)) + }, + UNSUBSCRIBE(state, subscription) { + state._Subscriptions.delete(JSON.stringify(subscription)) + } + }, + getters: { + getParams: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Params[JSON.stringify(params)] ?? {} + }, + getSigningInfo: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.SigningInfo[JSON.stringify(params)] ?? {} + }, + getSigningInfos: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.SigningInfos[JSON.stringify(params)] ?? {} + }, + + getTypeStructure: (state) => (type) => { + return state._Structure[type].fields + }, + getRegistry: (state) => { + return state._Registry + } + }, + actions: { + init({ dispatch, rootGetters }) { + console.log('Vuex module: cosmos.slashing.v1beta1 initialized!') + if (rootGetters['common/env/client']) { + rootGetters['common/env/client'].on('newblock', () => { + dispatch('StoreUpdate') + }) + } + }, + resetState({ commit }) { + commit('RESET_STATE') + }, + unsubscribe({ commit }, subscription) { + commit('UNSUBSCRIBE', subscription) + }, + async StoreUpdate({ state, dispatch }) { + state._Subscriptions.forEach(async (subscription) => { + try { + const sub=JSON.parse(subscription) + await dispatch(sub.action, sub.payload) + }catch(e) { + throw new Error('Subscriptions: ' + e.message) + } + }) + }, + + + + + + + async QueryParams({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosSlashingV1Beta1.query.queryParams()).data + + + commit('QUERY', { query: 'Params', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryParams', payload: { options: { all }, params: {...key},query }}) + return getters['getParams']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryParams API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QuerySigningInfo({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosSlashingV1Beta1.query.querySigningInfo( key.cons_address)).data + + + commit('QUERY', { query: 'SigningInfo', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QuerySigningInfo', payload: { options: { all }, params: {...key},query }}) + return getters['getSigningInfo']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QuerySigningInfo API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QuerySigningInfos({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosSlashingV1Beta1.query.querySigningInfos(query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.CosmosSlashingV1Beta1.query.querySigningInfos({...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'SigningInfos', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QuerySigningInfos', payload: { options: { all }, params: {...key},query }}) + return getters['getSigningInfos']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QuerySigningInfos API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + async sendMsgUnjail({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.CosmosSlashingV1Beta1.tx.sendMsgUnjail({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgUnjail:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgUnjail:Send Could not broadcast Tx: '+ e.message) + } + } + }, + + async MsgUnjail({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.CosmosSlashingV1Beta1.tx.msgUnjail({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgUnjail:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgUnjail:Create Could not create message: ' + e.message) + } + } + }, + + } +} \ No newline at end of file diff --git a/vue/src/store/generated/cosmos.staking.v1beta1/index.ts b/vue/src/store/generated/cosmos.staking.v1beta1/index.ts new file mode 100755 index 00000000..f4d5f8e5 --- /dev/null +++ b/vue/src/store/generated/cosmos.staking.v1beta1/index.ts @@ -0,0 +1,747 @@ +import { Client, registry, MissingWalletError } from 'BitCannaGlobal-bcna-client-ts' + +import { StakeAuthorization } from "BitCannaGlobal-bcna-client-ts/cosmos.staking.v1beta1/types" +import { StakeAuthorization_Validators } from "BitCannaGlobal-bcna-client-ts/cosmos.staking.v1beta1/types" +import { LastValidatorPower } from "BitCannaGlobal-bcna-client-ts/cosmos.staking.v1beta1/types" +import { HistoricalInfo } from "BitCannaGlobal-bcna-client-ts/cosmos.staking.v1beta1/types" +import { CommissionRates } from "BitCannaGlobal-bcna-client-ts/cosmos.staking.v1beta1/types" +import { Commission } from "BitCannaGlobal-bcna-client-ts/cosmos.staking.v1beta1/types" +import { Description } from "BitCannaGlobal-bcna-client-ts/cosmos.staking.v1beta1/types" +import { Validator } from "BitCannaGlobal-bcna-client-ts/cosmos.staking.v1beta1/types" +import { ValAddresses } from "BitCannaGlobal-bcna-client-ts/cosmos.staking.v1beta1/types" +import { DVPair } from "BitCannaGlobal-bcna-client-ts/cosmos.staking.v1beta1/types" +import { DVPairs } from "BitCannaGlobal-bcna-client-ts/cosmos.staking.v1beta1/types" +import { DVVTriplet } from "BitCannaGlobal-bcna-client-ts/cosmos.staking.v1beta1/types" +import { DVVTriplets } from "BitCannaGlobal-bcna-client-ts/cosmos.staking.v1beta1/types" +import { Delegation } from "BitCannaGlobal-bcna-client-ts/cosmos.staking.v1beta1/types" +import { UnbondingDelegation } from "BitCannaGlobal-bcna-client-ts/cosmos.staking.v1beta1/types" +import { UnbondingDelegationEntry } from "BitCannaGlobal-bcna-client-ts/cosmos.staking.v1beta1/types" +import { RedelegationEntry } from "BitCannaGlobal-bcna-client-ts/cosmos.staking.v1beta1/types" +import { Redelegation } from "BitCannaGlobal-bcna-client-ts/cosmos.staking.v1beta1/types" +import { Params } from "BitCannaGlobal-bcna-client-ts/cosmos.staking.v1beta1/types" +import { DelegationResponse } from "BitCannaGlobal-bcna-client-ts/cosmos.staking.v1beta1/types" +import { RedelegationEntryResponse } from "BitCannaGlobal-bcna-client-ts/cosmos.staking.v1beta1/types" +import { RedelegationResponse } from "BitCannaGlobal-bcna-client-ts/cosmos.staking.v1beta1/types" +import { Pool } from "BitCannaGlobal-bcna-client-ts/cosmos.staking.v1beta1/types" +import { ValidatorUpdates } from "BitCannaGlobal-bcna-client-ts/cosmos.staking.v1beta1/types" + + +export { StakeAuthorization, StakeAuthorization_Validators, LastValidatorPower, HistoricalInfo, CommissionRates, Commission, Description, Validator, ValAddresses, DVPair, DVPairs, DVVTriplet, DVVTriplets, Delegation, UnbondingDelegation, UnbondingDelegationEntry, RedelegationEntry, Redelegation, Params, DelegationResponse, RedelegationEntryResponse, RedelegationResponse, Pool, ValidatorUpdates }; + +function initClient(vuexGetters) { + return new Client(vuexGetters['common/env/getEnv'], vuexGetters['common/wallet/signer']) +} + +function mergeResults(value, next_values) { + for (let prop of Object.keys(next_values)) { + if (Array.isArray(next_values[prop])) { + value[prop]=[...value[prop], ...next_values[prop]] + }else{ + value[prop]=next_values[prop] + } + } + return value +} + +type Field = { + name: string; + type: unknown; +} +function getStructure(template) { + let structure: {fields: Field[]} = { fields: [] } + for (const [key, value] of Object.entries(template)) { + let field = { name: key, type: typeof value } + structure.fields.push(field) + } + return structure +} +const getDefaultState = () => { + return { + Validators: {}, + Validator: {}, + ValidatorDelegations: {}, + ValidatorUnbondingDelegations: {}, + Delegation: {}, + UnbondingDelegation: {}, + DelegatorDelegations: {}, + DelegatorUnbondingDelegations: {}, + Redelegations: {}, + DelegatorValidators: {}, + DelegatorValidator: {}, + HistoricalInfo: {}, + Pool: {}, + Params: {}, + + _Structure: { + StakeAuthorization: getStructure(StakeAuthorization.fromPartial({})), + StakeAuthorization_Validators: getStructure(StakeAuthorization_Validators.fromPartial({})), + LastValidatorPower: getStructure(LastValidatorPower.fromPartial({})), + HistoricalInfo: getStructure(HistoricalInfo.fromPartial({})), + CommissionRates: getStructure(CommissionRates.fromPartial({})), + Commission: getStructure(Commission.fromPartial({})), + Description: getStructure(Description.fromPartial({})), + Validator: getStructure(Validator.fromPartial({})), + ValAddresses: getStructure(ValAddresses.fromPartial({})), + DVPair: getStructure(DVPair.fromPartial({})), + DVPairs: getStructure(DVPairs.fromPartial({})), + DVVTriplet: getStructure(DVVTriplet.fromPartial({})), + DVVTriplets: getStructure(DVVTriplets.fromPartial({})), + Delegation: getStructure(Delegation.fromPartial({})), + UnbondingDelegation: getStructure(UnbondingDelegation.fromPartial({})), + UnbondingDelegationEntry: getStructure(UnbondingDelegationEntry.fromPartial({})), + RedelegationEntry: getStructure(RedelegationEntry.fromPartial({})), + Redelegation: getStructure(Redelegation.fromPartial({})), + Params: getStructure(Params.fromPartial({})), + DelegationResponse: getStructure(DelegationResponse.fromPartial({})), + RedelegationEntryResponse: getStructure(RedelegationEntryResponse.fromPartial({})), + RedelegationResponse: getStructure(RedelegationResponse.fromPartial({})), + Pool: getStructure(Pool.fromPartial({})), + ValidatorUpdates: getStructure(ValidatorUpdates.fromPartial({})), + + }, + _Registry: registry, + _Subscriptions: new Set(), + } +} + +// initial state +const state = getDefaultState() + +export default { + namespaced: true, + state, + mutations: { + RESET_STATE(state) { + Object.assign(state, getDefaultState()) + }, + QUERY(state, { query, key, value }) { + state[query][JSON.stringify(key)] = value + }, + SUBSCRIBE(state, subscription) { + state._Subscriptions.add(JSON.stringify(subscription)) + }, + UNSUBSCRIBE(state, subscription) { + state._Subscriptions.delete(JSON.stringify(subscription)) + } + }, + getters: { + getValidators: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Validators[JSON.stringify(params)] ?? {} + }, + getValidator: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Validator[JSON.stringify(params)] ?? {} + }, + getValidatorDelegations: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.ValidatorDelegations[JSON.stringify(params)] ?? {} + }, + getValidatorUnbondingDelegations: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.ValidatorUnbondingDelegations[JSON.stringify(params)] ?? {} + }, + getDelegation: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Delegation[JSON.stringify(params)] ?? {} + }, + getUnbondingDelegation: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.UnbondingDelegation[JSON.stringify(params)] ?? {} + }, + getDelegatorDelegations: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.DelegatorDelegations[JSON.stringify(params)] ?? {} + }, + getDelegatorUnbondingDelegations: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.DelegatorUnbondingDelegations[JSON.stringify(params)] ?? {} + }, + getRedelegations: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Redelegations[JSON.stringify(params)] ?? {} + }, + getDelegatorValidators: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.DelegatorValidators[JSON.stringify(params)] ?? {} + }, + getDelegatorValidator: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.DelegatorValidator[JSON.stringify(params)] ?? {} + }, + getHistoricalInfo: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.HistoricalInfo[JSON.stringify(params)] ?? {} + }, + getPool: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Pool[JSON.stringify(params)] ?? {} + }, + getParams: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Params[JSON.stringify(params)] ?? {} + }, + + getTypeStructure: (state) => (type) => { + return state._Structure[type].fields + }, + getRegistry: (state) => { + return state._Registry + } + }, + actions: { + init({ dispatch, rootGetters }) { + console.log('Vuex module: cosmos.staking.v1beta1 initialized!') + if (rootGetters['common/env/client']) { + rootGetters['common/env/client'].on('newblock', () => { + dispatch('StoreUpdate') + }) + } + }, + resetState({ commit }) { + commit('RESET_STATE') + }, + unsubscribe({ commit }, subscription) { + commit('UNSUBSCRIBE', subscription) + }, + async StoreUpdate({ state, dispatch }) { + state._Subscriptions.forEach(async (subscription) => { + try { + const sub=JSON.parse(subscription) + await dispatch(sub.action, sub.payload) + }catch(e) { + throw new Error('Subscriptions: ' + e.message) + } + }) + }, + + + + + + + async QueryValidators({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosStakingV1Beta1.query.queryValidators(query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.CosmosStakingV1Beta1.query.queryValidators({...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'Validators', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryValidators', payload: { options: { all }, params: {...key},query }}) + return getters['getValidators']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryValidators API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryValidator({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosStakingV1Beta1.query.queryValidator( key.validator_addr)).data + + + commit('QUERY', { query: 'Validator', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryValidator', payload: { options: { all }, params: {...key},query }}) + return getters['getValidator']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryValidator API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryValidatorDelegations({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosStakingV1Beta1.query.queryValidatorDelegations( key.validator_addr, query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.CosmosStakingV1Beta1.query.queryValidatorDelegations( key.validator_addr, {...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'ValidatorDelegations', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryValidatorDelegations', payload: { options: { all }, params: {...key},query }}) + return getters['getValidatorDelegations']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryValidatorDelegations API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryValidatorUnbondingDelegations({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosStakingV1Beta1.query.queryValidatorUnbondingDelegations( key.validator_addr, query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.CosmosStakingV1Beta1.query.queryValidatorUnbondingDelegations( key.validator_addr, {...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'ValidatorUnbondingDelegations', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryValidatorUnbondingDelegations', payload: { options: { all }, params: {...key},query }}) + return getters['getValidatorUnbondingDelegations']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryValidatorUnbondingDelegations API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryDelegation({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosStakingV1Beta1.query.queryDelegation( key.validator_addr, key.delegator_addr)).data + + + commit('QUERY', { query: 'Delegation', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryDelegation', payload: { options: { all }, params: {...key},query }}) + return getters['getDelegation']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryDelegation API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryUnbondingDelegation({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosStakingV1Beta1.query.queryUnbondingDelegation( key.validator_addr, key.delegator_addr)).data + + + commit('QUERY', { query: 'UnbondingDelegation', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryUnbondingDelegation', payload: { options: { all }, params: {...key},query }}) + return getters['getUnbondingDelegation']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryUnbondingDelegation API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryDelegatorDelegations({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosStakingV1Beta1.query.queryDelegatorDelegations( key.delegator_addr, query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.CosmosStakingV1Beta1.query.queryDelegatorDelegations( key.delegator_addr, {...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'DelegatorDelegations', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryDelegatorDelegations', payload: { options: { all }, params: {...key},query }}) + return getters['getDelegatorDelegations']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryDelegatorDelegations API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryDelegatorUnbondingDelegations({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosStakingV1Beta1.query.queryDelegatorUnbondingDelegations( key.delegator_addr, query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.CosmosStakingV1Beta1.query.queryDelegatorUnbondingDelegations( key.delegator_addr, {...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'DelegatorUnbondingDelegations', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryDelegatorUnbondingDelegations', payload: { options: { all }, params: {...key},query }}) + return getters['getDelegatorUnbondingDelegations']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryDelegatorUnbondingDelegations API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryRedelegations({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosStakingV1Beta1.query.queryRedelegations( key.delegator_addr, query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.CosmosStakingV1Beta1.query.queryRedelegations( key.delegator_addr, {...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'Redelegations', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryRedelegations', payload: { options: { all }, params: {...key},query }}) + return getters['getRedelegations']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryRedelegations API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryDelegatorValidators({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosStakingV1Beta1.query.queryDelegatorValidators( key.delegator_addr, query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.CosmosStakingV1Beta1.query.queryDelegatorValidators( key.delegator_addr, {...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'DelegatorValidators', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryDelegatorValidators', payload: { options: { all }, params: {...key},query }}) + return getters['getDelegatorValidators']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryDelegatorValidators API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryDelegatorValidator({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosStakingV1Beta1.query.queryDelegatorValidator( key.delegator_addr, key.validator_addr)).data + + + commit('QUERY', { query: 'DelegatorValidator', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryDelegatorValidator', payload: { options: { all }, params: {...key},query }}) + return getters['getDelegatorValidator']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryDelegatorValidator API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryHistoricalInfo({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosStakingV1Beta1.query.queryHistoricalInfo( key.height)).data + + + commit('QUERY', { query: 'HistoricalInfo', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryHistoricalInfo', payload: { options: { all }, params: {...key},query }}) + return getters['getHistoricalInfo']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryHistoricalInfo API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryPool({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosStakingV1Beta1.query.queryPool()).data + + + commit('QUERY', { query: 'Pool', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPool', payload: { options: { all }, params: {...key},query }}) + return getters['getPool']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryPool API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryParams({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosStakingV1Beta1.query.queryParams()).data + + + commit('QUERY', { query: 'Params', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryParams', payload: { options: { all }, params: {...key},query }}) + return getters['getParams']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryParams API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + async sendMsgEditValidator({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.CosmosStakingV1Beta1.tx.sendMsgEditValidator({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgEditValidator:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgEditValidator:Send Could not broadcast Tx: '+ e.message) + } + } + }, + async sendMsgCancelUnbondingDelegation({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.CosmosStakingV1Beta1.tx.sendMsgCancelUnbondingDelegation({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgCancelUnbondingDelegation:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgCancelUnbondingDelegation:Send Could not broadcast Tx: '+ e.message) + } + } + }, + async sendMsgUndelegate({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.CosmosStakingV1Beta1.tx.sendMsgUndelegate({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgUndelegate:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgUndelegate:Send Could not broadcast Tx: '+ e.message) + } + } + }, + async sendMsgCreateValidator({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.CosmosStakingV1Beta1.tx.sendMsgCreateValidator({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgCreateValidator:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgCreateValidator:Send Could not broadcast Tx: '+ e.message) + } + } + }, + async sendMsgBeginRedelegate({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.CosmosStakingV1Beta1.tx.sendMsgBeginRedelegate({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgBeginRedelegate:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgBeginRedelegate:Send Could not broadcast Tx: '+ e.message) + } + } + }, + async sendMsgDelegate({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.CosmosStakingV1Beta1.tx.sendMsgDelegate({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgDelegate:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgDelegate:Send Could not broadcast Tx: '+ e.message) + } + } + }, + + async MsgEditValidator({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.CosmosStakingV1Beta1.tx.msgEditValidator({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgEditValidator:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgEditValidator:Create Could not create message: ' + e.message) + } + } + }, + async MsgCancelUnbondingDelegation({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.CosmosStakingV1Beta1.tx.msgCancelUnbondingDelegation({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgCancelUnbondingDelegation:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgCancelUnbondingDelegation:Create Could not create message: ' + e.message) + } + } + }, + async MsgUndelegate({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.CosmosStakingV1Beta1.tx.msgUndelegate({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgUndelegate:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgUndelegate:Create Could not create message: ' + e.message) + } + } + }, + async MsgCreateValidator({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.CosmosStakingV1Beta1.tx.msgCreateValidator({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgCreateValidator:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgCreateValidator:Create Could not create message: ' + e.message) + } + } + }, + async MsgBeginRedelegate({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.CosmosStakingV1Beta1.tx.msgBeginRedelegate({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgBeginRedelegate:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgBeginRedelegate:Create Could not create message: ' + e.message) + } + } + }, + async MsgDelegate({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.CosmosStakingV1Beta1.tx.msgDelegate({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgDelegate:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgDelegate:Create Could not create message: ' + e.message) + } + } + }, + + } +} \ No newline at end of file diff --git a/vue/src/store/generated/cosmos.tx.v1beta1/index.ts b/vue/src/store/generated/cosmos.tx.v1beta1/index.ts new file mode 100755 index 00000000..06af50b2 --- /dev/null +++ b/vue/src/store/generated/cosmos.tx.v1beta1/index.ts @@ -0,0 +1,398 @@ +import { Client, registry, MissingWalletError } from 'BitCannaGlobal-bcna-client-ts' + +import { Tx } from "BitCannaGlobal-bcna-client-ts/cosmos.tx.v1beta1/types" +import { TxRaw } from "BitCannaGlobal-bcna-client-ts/cosmos.tx.v1beta1/types" +import { SignDoc } from "BitCannaGlobal-bcna-client-ts/cosmos.tx.v1beta1/types" +import { SignDocDirectAux } from "BitCannaGlobal-bcna-client-ts/cosmos.tx.v1beta1/types" +import { TxBody } from "BitCannaGlobal-bcna-client-ts/cosmos.tx.v1beta1/types" +import { AuthInfo } from "BitCannaGlobal-bcna-client-ts/cosmos.tx.v1beta1/types" +import { SignerInfo } from "BitCannaGlobal-bcna-client-ts/cosmos.tx.v1beta1/types" +import { ModeInfo } from "BitCannaGlobal-bcna-client-ts/cosmos.tx.v1beta1/types" +import { ModeInfo_Single } from "BitCannaGlobal-bcna-client-ts/cosmos.tx.v1beta1/types" +import { ModeInfo_Multi } from "BitCannaGlobal-bcna-client-ts/cosmos.tx.v1beta1/types" +import { Fee } from "BitCannaGlobal-bcna-client-ts/cosmos.tx.v1beta1/types" +import { Tip } from "BitCannaGlobal-bcna-client-ts/cosmos.tx.v1beta1/types" +import { AuxSignerData } from "BitCannaGlobal-bcna-client-ts/cosmos.tx.v1beta1/types" + + +export { Tx, TxRaw, SignDoc, SignDocDirectAux, TxBody, AuthInfo, SignerInfo, ModeInfo, ModeInfo_Single, ModeInfo_Multi, Fee, Tip, AuxSignerData }; + +function initClient(vuexGetters) { + return new Client(vuexGetters['common/env/getEnv'], vuexGetters['common/wallet/signer']) +} + +function mergeResults(value, next_values) { + for (let prop of Object.keys(next_values)) { + if (Array.isArray(next_values[prop])) { + value[prop]=[...value[prop], ...next_values[prop]] + }else{ + value[prop]=next_values[prop] + } + } + return value +} + +type Field = { + name: string; + type: unknown; +} +function getStructure(template) { + let structure: {fields: Field[]} = { fields: [] } + for (const [key, value] of Object.entries(template)) { + let field = { name: key, type: typeof value } + structure.fields.push(field) + } + return structure +} +const getDefaultState = () => { + return { + Simulate: {}, + GetTx: {}, + BroadcastTx: {}, + GetTxsEvent: {}, + GetBlockWithTxs: {}, + TxDecode: {}, + TxEncode: {}, + TxEncodeAmino: {}, + TxDecodeAmino: {}, + + _Structure: { + Tx: getStructure(Tx.fromPartial({})), + TxRaw: getStructure(TxRaw.fromPartial({})), + SignDoc: getStructure(SignDoc.fromPartial({})), + SignDocDirectAux: getStructure(SignDocDirectAux.fromPartial({})), + TxBody: getStructure(TxBody.fromPartial({})), + AuthInfo: getStructure(AuthInfo.fromPartial({})), + SignerInfo: getStructure(SignerInfo.fromPartial({})), + ModeInfo: getStructure(ModeInfo.fromPartial({})), + ModeInfo_Single: getStructure(ModeInfo_Single.fromPartial({})), + ModeInfo_Multi: getStructure(ModeInfo_Multi.fromPartial({})), + Fee: getStructure(Fee.fromPartial({})), + Tip: getStructure(Tip.fromPartial({})), + AuxSignerData: getStructure(AuxSignerData.fromPartial({})), + + }, + _Registry: registry, + _Subscriptions: new Set(), + } +} + +// initial state +const state = getDefaultState() + +export default { + namespaced: true, + state, + mutations: { + RESET_STATE(state) { + Object.assign(state, getDefaultState()) + }, + QUERY(state, { query, key, value }) { + state[query][JSON.stringify(key)] = value + }, + SUBSCRIBE(state, subscription) { + state._Subscriptions.add(JSON.stringify(subscription)) + }, + UNSUBSCRIBE(state, subscription) { + state._Subscriptions.delete(JSON.stringify(subscription)) + } + }, + getters: { + getSimulate: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Simulate[JSON.stringify(params)] ?? {} + }, + getGetTx: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.GetTx[JSON.stringify(params)] ?? {} + }, + getBroadcastTx: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.BroadcastTx[JSON.stringify(params)] ?? {} + }, + getGetTxsEvent: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.GetTxsEvent[JSON.stringify(params)] ?? {} + }, + getGetBlockWithTxs: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.GetBlockWithTxs[JSON.stringify(params)] ?? {} + }, + getTxDecode: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.TxDecode[JSON.stringify(params)] ?? {} + }, + getTxEncode: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.TxEncode[JSON.stringify(params)] ?? {} + }, + getTxEncodeAmino: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.TxEncodeAmino[JSON.stringify(params)] ?? {} + }, + getTxDecodeAmino: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.TxDecodeAmino[JSON.stringify(params)] ?? {} + }, + + getTypeStructure: (state) => (type) => { + return state._Structure[type].fields + }, + getRegistry: (state) => { + return state._Registry + } + }, + actions: { + init({ dispatch, rootGetters }) { + console.log('Vuex module: cosmos.tx.v1beta1 initialized!') + if (rootGetters['common/env/client']) { + rootGetters['common/env/client'].on('newblock', () => { + dispatch('StoreUpdate') + }) + } + }, + resetState({ commit }) { + commit('RESET_STATE') + }, + unsubscribe({ commit }, subscription) { + commit('UNSUBSCRIBE', subscription) + }, + async StoreUpdate({ state, dispatch }) { + state._Subscriptions.forEach(async (subscription) => { + try { + const sub=JSON.parse(subscription) + await dispatch(sub.action, sub.payload) + }catch(e) { + throw new Error('Subscriptions: ' + e.message) + } + }) + }, + + + + + + + async ServiceSimulate({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosTxV1Beta1.query.serviceSimulate({...key})).data + + + commit('QUERY', { query: 'Simulate', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'ServiceSimulate', payload: { options: { all }, params: {...key},query }}) + return getters['getSimulate']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:ServiceSimulate API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async ServiceGetTx({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosTxV1Beta1.query.serviceGetTx( key.hash)).data + + + commit('QUERY', { query: 'GetTx', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'ServiceGetTx', payload: { options: { all }, params: {...key},query }}) + return getters['getGetTx']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:ServiceGetTx API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async ServiceBroadcastTx({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosTxV1Beta1.query.serviceBroadcastTx({...key})).data + + + commit('QUERY', { query: 'BroadcastTx', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'ServiceBroadcastTx', payload: { options: { all }, params: {...key},query }}) + return getters['getBroadcastTx']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:ServiceBroadcastTx API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async ServiceGetTxsEvent({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosTxV1Beta1.query.serviceGetTxsEvent(query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.CosmosTxV1Beta1.query.serviceGetTxsEvent({...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'GetTxsEvent', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'ServiceGetTxsEvent', payload: { options: { all }, params: {...key},query }}) + return getters['getGetTxsEvent']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:ServiceGetTxsEvent API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async ServiceGetBlockWithTxs({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosTxV1Beta1.query.serviceGetBlockWithTxs( key.height, query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.CosmosTxV1Beta1.query.serviceGetBlockWithTxs( key.height, {...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'GetBlockWithTxs', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'ServiceGetBlockWithTxs', payload: { options: { all }, params: {...key},query }}) + return getters['getGetBlockWithTxs']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:ServiceGetBlockWithTxs API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async ServiceTxDecode({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosTxV1Beta1.query.serviceTxDecode({...key})).data + + + commit('QUERY', { query: 'TxDecode', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'ServiceTxDecode', payload: { options: { all }, params: {...key},query }}) + return getters['getTxDecode']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:ServiceTxDecode API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async ServiceTxEncode({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosTxV1Beta1.query.serviceTxEncode({...key})).data + + + commit('QUERY', { query: 'TxEncode', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'ServiceTxEncode', payload: { options: { all }, params: {...key},query }}) + return getters['getTxEncode']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:ServiceTxEncode API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async ServiceTxEncodeAmino({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosTxV1Beta1.query.serviceTxEncodeAmino({...key})).data + + + commit('QUERY', { query: 'TxEncodeAmino', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'ServiceTxEncodeAmino', payload: { options: { all }, params: {...key},query }}) + return getters['getTxEncodeAmino']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:ServiceTxEncodeAmino API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async ServiceTxDecodeAmino({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosTxV1Beta1.query.serviceTxDecodeAmino({...key})).data + + + commit('QUERY', { query: 'TxDecodeAmino', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'ServiceTxDecodeAmino', payload: { options: { all }, params: {...key},query }}) + return getters['getTxDecodeAmino']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:ServiceTxDecodeAmino API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + } +} \ No newline at end of file diff --git a/vue/src/store/generated/cosmos.upgrade.v1beta1/index.ts b/vue/src/store/generated/cosmos.upgrade.v1beta1/index.ts new file mode 100755 index 00000000..c18abc98 --- /dev/null +++ b/vue/src/store/generated/cosmos.upgrade.v1beta1/index.ts @@ -0,0 +1,314 @@ +import { Client, registry, MissingWalletError } from 'BitCannaGlobal-bcna-client-ts' + +import { Plan } from "BitCannaGlobal-bcna-client-ts/cosmos.upgrade.v1beta1/types" +import { SoftwareUpgradeProposal } from "BitCannaGlobal-bcna-client-ts/cosmos.upgrade.v1beta1/types" +import { CancelSoftwareUpgradeProposal } from "BitCannaGlobal-bcna-client-ts/cosmos.upgrade.v1beta1/types" +import { ModuleVersion } from "BitCannaGlobal-bcna-client-ts/cosmos.upgrade.v1beta1/types" + + +export { Plan, SoftwareUpgradeProposal, CancelSoftwareUpgradeProposal, ModuleVersion }; + +function initClient(vuexGetters) { + return new Client(vuexGetters['common/env/getEnv'], vuexGetters['common/wallet/signer']) +} + +function mergeResults(value, next_values) { + for (let prop of Object.keys(next_values)) { + if (Array.isArray(next_values[prop])) { + value[prop]=[...value[prop], ...next_values[prop]] + }else{ + value[prop]=next_values[prop] + } + } + return value +} + +type Field = { + name: string; + type: unknown; +} +function getStructure(template) { + let structure: {fields: Field[]} = { fields: [] } + for (const [key, value] of Object.entries(template)) { + let field = { name: key, type: typeof value } + structure.fields.push(field) + } + return structure +} +const getDefaultState = () => { + return { + CurrentPlan: {}, + AppliedPlan: {}, + UpgradedConsensusState: {}, + ModuleVersions: {}, + Authority: {}, + + _Structure: { + Plan: getStructure(Plan.fromPartial({})), + SoftwareUpgradeProposal: getStructure(SoftwareUpgradeProposal.fromPartial({})), + CancelSoftwareUpgradeProposal: getStructure(CancelSoftwareUpgradeProposal.fromPartial({})), + ModuleVersion: getStructure(ModuleVersion.fromPartial({})), + + }, + _Registry: registry, + _Subscriptions: new Set(), + } +} + +// initial state +const state = getDefaultState() + +export default { + namespaced: true, + state, + mutations: { + RESET_STATE(state) { + Object.assign(state, getDefaultState()) + }, + QUERY(state, { query, key, value }) { + state[query][JSON.stringify(key)] = value + }, + SUBSCRIBE(state, subscription) { + state._Subscriptions.add(JSON.stringify(subscription)) + }, + UNSUBSCRIBE(state, subscription) { + state._Subscriptions.delete(JSON.stringify(subscription)) + } + }, + getters: { + getCurrentPlan: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.CurrentPlan[JSON.stringify(params)] ?? {} + }, + getAppliedPlan: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.AppliedPlan[JSON.stringify(params)] ?? {} + }, + getUpgradedConsensusState: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.UpgradedConsensusState[JSON.stringify(params)] ?? {} + }, + getModuleVersions: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.ModuleVersions[JSON.stringify(params)] ?? {} + }, + getAuthority: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Authority[JSON.stringify(params)] ?? {} + }, + + getTypeStructure: (state) => (type) => { + return state._Structure[type].fields + }, + getRegistry: (state) => { + return state._Registry + } + }, + actions: { + init({ dispatch, rootGetters }) { + console.log('Vuex module: cosmos.upgrade.v1beta1 initialized!') + if (rootGetters['common/env/client']) { + rootGetters['common/env/client'].on('newblock', () => { + dispatch('StoreUpdate') + }) + } + }, + resetState({ commit }) { + commit('RESET_STATE') + }, + unsubscribe({ commit }, subscription) { + commit('UNSUBSCRIBE', subscription) + }, + async StoreUpdate({ state, dispatch }) { + state._Subscriptions.forEach(async (subscription) => { + try { + const sub=JSON.parse(subscription) + await dispatch(sub.action, sub.payload) + }catch(e) { + throw new Error('Subscriptions: ' + e.message) + } + }) + }, + + + + + + + async QueryCurrentPlan({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosUpgradeV1Beta1.query.queryCurrentPlan()).data + + + commit('QUERY', { query: 'CurrentPlan', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryCurrentPlan', payload: { options: { all }, params: {...key},query }}) + return getters['getCurrentPlan']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryCurrentPlan API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryAppliedPlan({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosUpgradeV1Beta1.query.queryAppliedPlan( key.name)).data + + + commit('QUERY', { query: 'AppliedPlan', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryAppliedPlan', payload: { options: { all }, params: {...key},query }}) + return getters['getAppliedPlan']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryAppliedPlan API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryUpgradedConsensusState({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosUpgradeV1Beta1.query.queryUpgradedConsensusState( key.last_height)).data + + + commit('QUERY', { query: 'UpgradedConsensusState', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryUpgradedConsensusState', payload: { options: { all }, params: {...key},query }}) + return getters['getUpgradedConsensusState']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryUpgradedConsensusState API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryModuleVersions({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosUpgradeV1Beta1.query.queryModuleVersions(query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.CosmosUpgradeV1Beta1.query.queryModuleVersions({...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'ModuleVersions', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryModuleVersions', payload: { options: { all }, params: {...key},query }}) + return getters['getModuleVersions']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryModuleVersions API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryAuthority({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.CosmosUpgradeV1Beta1.query.queryAuthority()).data + + + commit('QUERY', { query: 'Authority', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryAuthority', payload: { options: { all }, params: {...key},query }}) + return getters['getAuthority']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryAuthority API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + async sendMsgSoftwareUpgrade({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.CosmosUpgradeV1Beta1.tx.sendMsgSoftwareUpgrade({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgSoftwareUpgrade:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgSoftwareUpgrade:Send Could not broadcast Tx: '+ e.message) + } + } + }, + async sendMsgCancelUpgrade({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.CosmosUpgradeV1Beta1.tx.sendMsgCancelUpgrade({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgCancelUpgrade:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgCancelUpgrade:Send Could not broadcast Tx: '+ e.message) + } + } + }, + + async MsgSoftwareUpgrade({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.CosmosUpgradeV1Beta1.tx.msgSoftwareUpgrade({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgSoftwareUpgrade:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgSoftwareUpgrade:Create Could not create message: ' + e.message) + } + } + }, + async MsgCancelUpgrade({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.CosmosUpgradeV1Beta1.tx.msgCancelUpgrade({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgCancelUpgrade:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgCancelUpgrade:Create Could not create message: ' + e.message) + } + } + }, + + } +} \ No newline at end of file diff --git a/vue/src/store/generated/cosmos.vesting.v1beta1/index.ts b/vue/src/store/generated/cosmos.vesting.v1beta1/index.ts new file mode 100755 index 00000000..526c0d4a --- /dev/null +++ b/vue/src/store/generated/cosmos.vesting.v1beta1/index.ts @@ -0,0 +1,196 @@ +import { Client, registry, MissingWalletError } from 'BitCannaGlobal-bcna-client-ts' + +import { BaseVestingAccount } from "BitCannaGlobal-bcna-client-ts/cosmos.vesting.v1beta1/types" +import { ContinuousVestingAccount } from "BitCannaGlobal-bcna-client-ts/cosmos.vesting.v1beta1/types" +import { DelayedVestingAccount } from "BitCannaGlobal-bcna-client-ts/cosmos.vesting.v1beta1/types" +import { Period } from "BitCannaGlobal-bcna-client-ts/cosmos.vesting.v1beta1/types" +import { PeriodicVestingAccount } from "BitCannaGlobal-bcna-client-ts/cosmos.vesting.v1beta1/types" +import { PermanentLockedAccount } from "BitCannaGlobal-bcna-client-ts/cosmos.vesting.v1beta1/types" + + +export { BaseVestingAccount, ContinuousVestingAccount, DelayedVestingAccount, Period, PeriodicVestingAccount, PermanentLockedAccount }; + +function initClient(vuexGetters) { + return new Client(vuexGetters['common/env/getEnv'], vuexGetters['common/wallet/signer']) +} + +function mergeResults(value, next_values) { + for (let prop of Object.keys(next_values)) { + if (Array.isArray(next_values[prop])) { + value[prop]=[...value[prop], ...next_values[prop]] + }else{ + value[prop]=next_values[prop] + } + } + return value +} + +type Field = { + name: string; + type: unknown; +} +function getStructure(template) { + let structure: {fields: Field[]} = { fields: [] } + for (const [key, value] of Object.entries(template)) { + let field = { name: key, type: typeof value } + structure.fields.push(field) + } + return structure +} +const getDefaultState = () => { + return { + + _Structure: { + BaseVestingAccount: getStructure(BaseVestingAccount.fromPartial({})), + ContinuousVestingAccount: getStructure(ContinuousVestingAccount.fromPartial({})), + DelayedVestingAccount: getStructure(DelayedVestingAccount.fromPartial({})), + Period: getStructure(Period.fromPartial({})), + PeriodicVestingAccount: getStructure(PeriodicVestingAccount.fromPartial({})), + PermanentLockedAccount: getStructure(PermanentLockedAccount.fromPartial({})), + + }, + _Registry: registry, + _Subscriptions: new Set(), + } +} + +// initial state +const state = getDefaultState() + +export default { + namespaced: true, + state, + mutations: { + RESET_STATE(state) { + Object.assign(state, getDefaultState()) + }, + QUERY(state, { query, key, value }) { + state[query][JSON.stringify(key)] = value + }, + SUBSCRIBE(state, subscription) { + state._Subscriptions.add(JSON.stringify(subscription)) + }, + UNSUBSCRIBE(state, subscription) { + state._Subscriptions.delete(JSON.stringify(subscription)) + } + }, + getters: { + + getTypeStructure: (state) => (type) => { + return state._Structure[type].fields + }, + getRegistry: (state) => { + return state._Registry + } + }, + actions: { + init({ dispatch, rootGetters }) { + console.log('Vuex module: cosmos.vesting.v1beta1 initialized!') + if (rootGetters['common/env/client']) { + rootGetters['common/env/client'].on('newblock', () => { + dispatch('StoreUpdate') + }) + } + }, + resetState({ commit }) { + commit('RESET_STATE') + }, + unsubscribe({ commit }, subscription) { + commit('UNSUBSCRIBE', subscription) + }, + async StoreUpdate({ state, dispatch }) { + state._Subscriptions.forEach(async (subscription) => { + try { + const sub=JSON.parse(subscription) + await dispatch(sub.action, sub.payload) + }catch(e) { + throw new Error('Subscriptions: ' + e.message) + } + }) + }, + + async sendMsgCreatePeriodicVestingAccount({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.CosmosVestingV1Beta1.tx.sendMsgCreatePeriodicVestingAccount({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgCreatePeriodicVestingAccount:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgCreatePeriodicVestingAccount:Send Could not broadcast Tx: '+ e.message) + } + } + }, + async sendMsgCreateVestingAccount({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.CosmosVestingV1Beta1.tx.sendMsgCreateVestingAccount({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgCreateVestingAccount:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgCreateVestingAccount:Send Could not broadcast Tx: '+ e.message) + } + } + }, + async sendMsgCreatePermanentLockedAccount({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.CosmosVestingV1Beta1.tx.sendMsgCreatePermanentLockedAccount({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgCreatePermanentLockedAccount:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgCreatePermanentLockedAccount:Send Could not broadcast Tx: '+ e.message) + } + } + }, + + async MsgCreatePeriodicVestingAccount({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.CosmosVestingV1Beta1.tx.msgCreatePeriodicVestingAccount({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgCreatePeriodicVestingAccount:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgCreatePeriodicVestingAccount:Create Could not create message: ' + e.message) + } + } + }, + async MsgCreateVestingAccount({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.CosmosVestingV1Beta1.tx.msgCreateVestingAccount({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgCreateVestingAccount:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgCreateVestingAccount:Create Could not create message: ' + e.message) + } + } + }, + async MsgCreatePermanentLockedAccount({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.CosmosVestingV1Beta1.tx.msgCreatePermanentLockedAccount({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgCreatePermanentLockedAccount:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgCreatePermanentLockedAccount:Create Could not create message: ' + e.message) + } + } + }, + + } +} \ No newline at end of file diff --git a/vue/src/store/generated/ibc.applications.interchain_accounts.controller.v1/index.ts b/vue/src/store/generated/ibc.applications.interchain_accounts.controller.v1/index.ts new file mode 100755 index 00000000..895bd249 --- /dev/null +++ b/vue/src/store/generated/ibc.applications.interchain_accounts.controller.v1/index.ts @@ -0,0 +1,163 @@ +import { Client, registry, MissingWalletError } from 'BitCannaGlobal-bcna-client-ts' + +import { Params } from "BitCannaGlobal-bcna-client-ts/ibc.applications.interchain_accounts.controller.v1/types" + + +export { Params }; + +function initClient(vuexGetters) { + return new Client(vuexGetters['common/env/getEnv'], vuexGetters['common/wallet/signer']) +} + +function mergeResults(value, next_values) { + for (let prop of Object.keys(next_values)) { + if (Array.isArray(next_values[prop])) { + value[prop]=[...value[prop], ...next_values[prop]] + }else{ + value[prop]=next_values[prop] + } + } + return value +} + +type Field = { + name: string; + type: unknown; +} +function getStructure(template) { + let structure: {fields: Field[]} = { fields: [] } + for (const [key, value] of Object.entries(template)) { + let field = { name: key, type: typeof value } + structure.fields.push(field) + } + return structure +} +const getDefaultState = () => { + return { + InterchainAccount: {}, + Params: {}, + + _Structure: { + Params: getStructure(Params.fromPartial({})), + + }, + _Registry: registry, + _Subscriptions: new Set(), + } +} + +// initial state +const state = getDefaultState() + +export default { + namespaced: true, + state, + mutations: { + RESET_STATE(state) { + Object.assign(state, getDefaultState()) + }, + QUERY(state, { query, key, value }) { + state[query][JSON.stringify(key)] = value + }, + SUBSCRIBE(state, subscription) { + state._Subscriptions.add(JSON.stringify(subscription)) + }, + UNSUBSCRIBE(state, subscription) { + state._Subscriptions.delete(JSON.stringify(subscription)) + } + }, + getters: { + getInterchainAccount: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.InterchainAccount[JSON.stringify(params)] ?? {} + }, + getParams: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Params[JSON.stringify(params)] ?? {} + }, + + getTypeStructure: (state) => (type) => { + return state._Structure[type].fields + }, + getRegistry: (state) => { + return state._Registry + } + }, + actions: { + init({ dispatch, rootGetters }) { + console.log('Vuex module: ibc.applications.interchain_accounts.controller.v1 initialized!') + if (rootGetters['common/env/client']) { + rootGetters['common/env/client'].on('newblock', () => { + dispatch('StoreUpdate') + }) + } + }, + resetState({ commit }) { + commit('RESET_STATE') + }, + unsubscribe({ commit }, subscription) { + commit('UNSUBSCRIBE', subscription) + }, + async StoreUpdate({ state, dispatch }) { + state._Subscriptions.forEach(async (subscription) => { + try { + const sub=JSON.parse(subscription) + await dispatch(sub.action, sub.payload) + }catch(e) { + throw new Error('Subscriptions: ' + e.message) + } + }) + }, + + + + + + + async QueryInterchainAccount({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.IbcApplicationsInterchainAccountsControllerV1.query.queryInterchainAccount( key.owner, key.connection_id)).data + + + commit('QUERY', { query: 'InterchainAccount', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryInterchainAccount', payload: { options: { all }, params: {...key},query }}) + return getters['getInterchainAccount']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryInterchainAccount API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryParams({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.IbcApplicationsInterchainAccountsControllerV1.query.queryParams()).data + + + commit('QUERY', { query: 'Params', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryParams', payload: { options: { all }, params: {...key},query }}) + return getters['getParams']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryParams API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + } +} \ No newline at end of file diff --git a/vue/src/store/generated/ibc.applications.interchain_accounts.host.v1/index.ts b/vue/src/store/generated/ibc.applications.interchain_accounts.host.v1/index.ts new file mode 100755 index 00000000..5eb78d30 --- /dev/null +++ b/vue/src/store/generated/ibc.applications.interchain_accounts.host.v1/index.ts @@ -0,0 +1,134 @@ +import { Client, registry, MissingWalletError } from 'BitCannaGlobal-bcna-client-ts' + +import { Params } from "BitCannaGlobal-bcna-client-ts/ibc.applications.interchain_accounts.host.v1/types" + + +export { Params }; + +function initClient(vuexGetters) { + return new Client(vuexGetters['common/env/getEnv'], vuexGetters['common/wallet/signer']) +} + +function mergeResults(value, next_values) { + for (let prop of Object.keys(next_values)) { + if (Array.isArray(next_values[prop])) { + value[prop]=[...value[prop], ...next_values[prop]] + }else{ + value[prop]=next_values[prop] + } + } + return value +} + +type Field = { + name: string; + type: unknown; +} +function getStructure(template) { + let structure: {fields: Field[]} = { fields: [] } + for (const [key, value] of Object.entries(template)) { + let field = { name: key, type: typeof value } + structure.fields.push(field) + } + return structure +} +const getDefaultState = () => { + return { + Params: {}, + + _Structure: { + Params: getStructure(Params.fromPartial({})), + + }, + _Registry: registry, + _Subscriptions: new Set(), + } +} + +// initial state +const state = getDefaultState() + +export default { + namespaced: true, + state, + mutations: { + RESET_STATE(state) { + Object.assign(state, getDefaultState()) + }, + QUERY(state, { query, key, value }) { + state[query][JSON.stringify(key)] = value + }, + SUBSCRIBE(state, subscription) { + state._Subscriptions.add(JSON.stringify(subscription)) + }, + UNSUBSCRIBE(state, subscription) { + state._Subscriptions.delete(JSON.stringify(subscription)) + } + }, + getters: { + getParams: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Params[JSON.stringify(params)] ?? {} + }, + + getTypeStructure: (state) => (type) => { + return state._Structure[type].fields + }, + getRegistry: (state) => { + return state._Registry + } + }, + actions: { + init({ dispatch, rootGetters }) { + console.log('Vuex module: ibc.applications.interchain_accounts.host.v1 initialized!') + if (rootGetters['common/env/client']) { + rootGetters['common/env/client'].on('newblock', () => { + dispatch('StoreUpdate') + }) + } + }, + resetState({ commit }) { + commit('RESET_STATE') + }, + unsubscribe({ commit }, subscription) { + commit('UNSUBSCRIBE', subscription) + }, + async StoreUpdate({ state, dispatch }) { + state._Subscriptions.forEach(async (subscription) => { + try { + const sub=JSON.parse(subscription) + await dispatch(sub.action, sub.payload) + }catch(e) { + throw new Error('Subscriptions: ' + e.message) + } + }) + }, + + + + + + + async QueryParams({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.IbcApplicationsInterchainAccountsHostV1.query.queryParams()).data + + + commit('QUERY', { query: 'Params', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryParams', payload: { options: { all }, params: {...key},query }}) + return getters['getParams']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryParams API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + } +} \ No newline at end of file diff --git a/vue/src/store/generated/ibc.applications.transfer.v1/index.ts b/vue/src/store/generated/ibc.applications.transfer.v1/index.ts new file mode 100755 index 00000000..304c174c --- /dev/null +++ b/vue/src/store/generated/ibc.applications.transfer.v1/index.ts @@ -0,0 +1,316 @@ +import { Client, registry, MissingWalletError } from 'BitCannaGlobal-bcna-client-ts' + +import { Allocation } from "BitCannaGlobal-bcna-client-ts/ibc.applications.transfer.v1/types" +import { TransferAuthorization } from "BitCannaGlobal-bcna-client-ts/ibc.applications.transfer.v1/types" +import { DenomTrace } from "BitCannaGlobal-bcna-client-ts/ibc.applications.transfer.v1/types" +import { Params } from "BitCannaGlobal-bcna-client-ts/ibc.applications.transfer.v1/types" + + +export { Allocation, TransferAuthorization, DenomTrace, Params }; + +function initClient(vuexGetters) { + return new Client(vuexGetters['common/env/getEnv'], vuexGetters['common/wallet/signer']) +} + +function mergeResults(value, next_values) { + for (let prop of Object.keys(next_values)) { + if (Array.isArray(next_values[prop])) { + value[prop]=[...value[prop], ...next_values[prop]] + }else{ + value[prop]=next_values[prop] + } + } + return value +} + +type Field = { + name: string; + type: unknown; +} +function getStructure(template) { + let structure: {fields: Field[]} = { fields: [] } + for (const [key, value] of Object.entries(template)) { + let field = { name: key, type: typeof value } + structure.fields.push(field) + } + return structure +} +const getDefaultState = () => { + return { + DenomTraces: {}, + DenomTrace: {}, + Params: {}, + DenomHash: {}, + EscrowAddress: {}, + TotalEscrowForDenom: {}, + + _Structure: { + Allocation: getStructure(Allocation.fromPartial({})), + TransferAuthorization: getStructure(TransferAuthorization.fromPartial({})), + DenomTrace: getStructure(DenomTrace.fromPartial({})), + Params: getStructure(Params.fromPartial({})), + + }, + _Registry: registry, + _Subscriptions: new Set(), + } +} + +// initial state +const state = getDefaultState() + +export default { + namespaced: true, + state, + mutations: { + RESET_STATE(state) { + Object.assign(state, getDefaultState()) + }, + QUERY(state, { query, key, value }) { + state[query][JSON.stringify(key)] = value + }, + SUBSCRIBE(state, subscription) { + state._Subscriptions.add(JSON.stringify(subscription)) + }, + UNSUBSCRIBE(state, subscription) { + state._Subscriptions.delete(JSON.stringify(subscription)) + } + }, + getters: { + getDenomTraces: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.DenomTraces[JSON.stringify(params)] ?? {} + }, + getDenomTrace: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.DenomTrace[JSON.stringify(params)] ?? {} + }, + getParams: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Params[JSON.stringify(params)] ?? {} + }, + getDenomHash: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.DenomHash[JSON.stringify(params)] ?? {} + }, + getEscrowAddress: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.EscrowAddress[JSON.stringify(params)] ?? {} + }, + getTotalEscrowForDenom: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.TotalEscrowForDenom[JSON.stringify(params)] ?? {} + }, + + getTypeStructure: (state) => (type) => { + return state._Structure[type].fields + }, + getRegistry: (state) => { + return state._Registry + } + }, + actions: { + init({ dispatch, rootGetters }) { + console.log('Vuex module: ibc.applications.transfer.v1 initialized!') + if (rootGetters['common/env/client']) { + rootGetters['common/env/client'].on('newblock', () => { + dispatch('StoreUpdate') + }) + } + }, + resetState({ commit }) { + commit('RESET_STATE') + }, + unsubscribe({ commit }, subscription) { + commit('UNSUBSCRIBE', subscription) + }, + async StoreUpdate({ state, dispatch }) { + state._Subscriptions.forEach(async (subscription) => { + try { + const sub=JSON.parse(subscription) + await dispatch(sub.action, sub.payload) + }catch(e) { + throw new Error('Subscriptions: ' + e.message) + } + }) + }, + + + + + + + async QueryDenomTraces({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.IbcApplicationsTransferV1.query.queryDenomTraces(query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.IbcApplicationsTransferV1.query.queryDenomTraces({...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'DenomTraces', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryDenomTraces', payload: { options: { all }, params: {...key},query }}) + return getters['getDenomTraces']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryDenomTraces API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryDenomTrace({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.IbcApplicationsTransferV1.query.queryDenomTrace( key.hash=**)).data + + + commit('QUERY', { query: 'DenomTrace', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryDenomTrace', payload: { options: { all }, params: {...key},query }}) + return getters['getDenomTrace']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryDenomTrace API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryParams({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.IbcApplicationsTransferV1.query.queryParams()).data + + + commit('QUERY', { query: 'Params', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryParams', payload: { options: { all }, params: {...key},query }}) + return getters['getParams']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryParams API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryDenomHash({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.IbcApplicationsTransferV1.query.queryDenomHash( key.trace=**)).data + + + commit('QUERY', { query: 'DenomHash', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryDenomHash', payload: { options: { all }, params: {...key},query }}) + return getters['getDenomHash']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryDenomHash API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryEscrowAddress({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.IbcApplicationsTransferV1.query.queryEscrowAddress( key.channel_id, key.port_id)).data + + + commit('QUERY', { query: 'EscrowAddress', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryEscrowAddress', payload: { options: { all }, params: {...key},query }}) + return getters['getEscrowAddress']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryEscrowAddress API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryTotalEscrowForDenom({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.IbcApplicationsTransferV1.query.queryTotalEscrowForDenom( key.denom=**)).data + + + commit('QUERY', { query: 'TotalEscrowForDenom', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryTotalEscrowForDenom', payload: { options: { all }, params: {...key},query }}) + return getters['getTotalEscrowForDenom']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryTotalEscrowForDenom API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + async sendMsgTransfer({ rootGetters }, { value, fee = {amount: [], gas: "200000"}, memo = '' }) { + try { + const client=await initClient(rootGetters) + const fullFee = Array.isArray(fee) ? {amount: fee, gas: "200000"} :fee; + const result = await client.IbcApplicationsTransferV1.tx.sendMsgTransfer({ value, fee: fullFee, memo }) + return result + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgTransfer:Init Could not initialize signing client. Wallet is required.') + }else{ + throw new Error('TxClient:MsgTransfer:Send Could not broadcast Tx: '+ e.message) + } + } + }, + + async MsgTransfer({ rootGetters }, { value }) { + try { + const client=initClient(rootGetters) + const msg = await client.IbcApplicationsTransferV1.tx.msgTransfer({value}) + return msg + } catch (e) { + if (e == MissingWalletError) { + throw new Error('TxClient:MsgTransfer:Init Could not initialize signing client. Wallet is required.') + } else{ + throw new Error('TxClient:MsgTransfer:Create Could not create message: ' + e.message) + } + } + }, + + } +} \ No newline at end of file diff --git a/vue/src/store/generated/ibc.core.channel.v1/index.ts b/vue/src/store/generated/ibc.core.channel.v1/index.ts new file mode 100755 index 00000000..3a077af2 --- /dev/null +++ b/vue/src/store/generated/ibc.core.channel.v1/index.ts @@ -0,0 +1,512 @@ +import { Client, registry, MissingWalletError } from 'BitCannaGlobal-bcna-client-ts' + +import { Channel } from "BitCannaGlobal-bcna-client-ts/ibc.core.channel.v1/types" +import { IdentifiedChannel } from "BitCannaGlobal-bcna-client-ts/ibc.core.channel.v1/types" +import { Counterparty } from "BitCannaGlobal-bcna-client-ts/ibc.core.channel.v1/types" +import { Packet } from "BitCannaGlobal-bcna-client-ts/ibc.core.channel.v1/types" +import { PacketState } from "BitCannaGlobal-bcna-client-ts/ibc.core.channel.v1/types" +import { PacketId } from "BitCannaGlobal-bcna-client-ts/ibc.core.channel.v1/types" +import { Acknowledgement } from "BitCannaGlobal-bcna-client-ts/ibc.core.channel.v1/types" +import { PacketSequence } from "BitCannaGlobal-bcna-client-ts/ibc.core.channel.v1/types" + + +export { Channel, IdentifiedChannel, Counterparty, Packet, PacketState, PacketId, Acknowledgement, PacketSequence }; + +function initClient(vuexGetters) { + return new Client(vuexGetters['common/env/getEnv'], vuexGetters['common/wallet/signer']) +} + +function mergeResults(value, next_values) { + for (let prop of Object.keys(next_values)) { + if (Array.isArray(next_values[prop])) { + value[prop]=[...value[prop], ...next_values[prop]] + }else{ + value[prop]=next_values[prop] + } + } + return value +} + +type Field = { + name: string; + type: unknown; +} +function getStructure(template) { + let structure: {fields: Field[]} = { fields: [] } + for (const [key, value] of Object.entries(template)) { + let field = { name: key, type: typeof value } + structure.fields.push(field) + } + return structure +} +const getDefaultState = () => { + return { + Channel: {}, + Channels: {}, + ConnectionChannels: {}, + ChannelClientState: {}, + ChannelConsensusState: {}, + PacketCommitment: {}, + PacketCommitments: {}, + PacketReceipt: {}, + PacketAcknowledgement: {}, + PacketAcknowledgements: {}, + UnreceivedPackets: {}, + UnreceivedAcks: {}, + NextSequenceReceive: {}, + + _Structure: { + Channel: getStructure(Channel.fromPartial({})), + IdentifiedChannel: getStructure(IdentifiedChannel.fromPartial({})), + Counterparty: getStructure(Counterparty.fromPartial({})), + Packet: getStructure(Packet.fromPartial({})), + PacketState: getStructure(PacketState.fromPartial({})), + PacketId: getStructure(PacketId.fromPartial({})), + Acknowledgement: getStructure(Acknowledgement.fromPartial({})), + PacketSequence: getStructure(PacketSequence.fromPartial({})), + + }, + _Registry: registry, + _Subscriptions: new Set(), + } +} + +// initial state +const state = getDefaultState() + +export default { + namespaced: true, + state, + mutations: { + RESET_STATE(state) { + Object.assign(state, getDefaultState()) + }, + QUERY(state, { query, key, value }) { + state[query][JSON.stringify(key)] = value + }, + SUBSCRIBE(state, subscription) { + state._Subscriptions.add(JSON.stringify(subscription)) + }, + UNSUBSCRIBE(state, subscription) { + state._Subscriptions.delete(JSON.stringify(subscription)) + } + }, + getters: { + getChannel: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Channel[JSON.stringify(params)] ?? {} + }, + getChannels: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Channels[JSON.stringify(params)] ?? {} + }, + getConnectionChannels: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.ConnectionChannels[JSON.stringify(params)] ?? {} + }, + getChannelClientState: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.ChannelClientState[JSON.stringify(params)] ?? {} + }, + getChannelConsensusState: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.ChannelConsensusState[JSON.stringify(params)] ?? {} + }, + getPacketCommitment: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.PacketCommitment[JSON.stringify(params)] ?? {} + }, + getPacketCommitments: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.PacketCommitments[JSON.stringify(params)] ?? {} + }, + getPacketReceipt: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.PacketReceipt[JSON.stringify(params)] ?? {} + }, + getPacketAcknowledgement: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.PacketAcknowledgement[JSON.stringify(params)] ?? {} + }, + getPacketAcknowledgements: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.PacketAcknowledgements[JSON.stringify(params)] ?? {} + }, + getUnreceivedPackets: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.UnreceivedPackets[JSON.stringify(params)] ?? {} + }, + getUnreceivedAcks: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.UnreceivedAcks[JSON.stringify(params)] ?? {} + }, + getNextSequenceReceive: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.NextSequenceReceive[JSON.stringify(params)] ?? {} + }, + + getTypeStructure: (state) => (type) => { + return state._Structure[type].fields + }, + getRegistry: (state) => { + return state._Registry + } + }, + actions: { + init({ dispatch, rootGetters }) { + console.log('Vuex module: ibc.core.channel.v1 initialized!') + if (rootGetters['common/env/client']) { + rootGetters['common/env/client'].on('newblock', () => { + dispatch('StoreUpdate') + }) + } + }, + resetState({ commit }) { + commit('RESET_STATE') + }, + unsubscribe({ commit }, subscription) { + commit('UNSUBSCRIBE', subscription) + }, + async StoreUpdate({ state, dispatch }) { + state._Subscriptions.forEach(async (subscription) => { + try { + const sub=JSON.parse(subscription) + await dispatch(sub.action, sub.payload) + }catch(e) { + throw new Error('Subscriptions: ' + e.message) + } + }) + }, + + + + + + + async QueryChannel({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.IbcCoreChannelV1.query.queryChannel( key.channel_id, key.port_id)).data + + + commit('QUERY', { query: 'Channel', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryChannel', payload: { options: { all }, params: {...key},query }}) + return getters['getChannel']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryChannel API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryChannels({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.IbcCoreChannelV1.query.queryChannels(query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.IbcCoreChannelV1.query.queryChannels({...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'Channels', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryChannels', payload: { options: { all }, params: {...key},query }}) + return getters['getChannels']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryChannels API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryConnectionChannels({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.IbcCoreChannelV1.query.queryConnectionChannels( key.connection, query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.IbcCoreChannelV1.query.queryConnectionChannels( key.connection, {...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'ConnectionChannels', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryConnectionChannels', payload: { options: { all }, params: {...key},query }}) + return getters['getConnectionChannels']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryConnectionChannels API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryChannelClientState({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.IbcCoreChannelV1.query.queryChannelClientState( key.channel_id, key.port_id)).data + + + commit('QUERY', { query: 'ChannelClientState', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryChannelClientState', payload: { options: { all }, params: {...key},query }}) + return getters['getChannelClientState']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryChannelClientState API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryChannelConsensusState({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.IbcCoreChannelV1.query.queryChannelConsensusState( key.channel_id, key.port_id, key.revision_number, key.revision_height)).data + + + commit('QUERY', { query: 'ChannelConsensusState', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryChannelConsensusState', payload: { options: { all }, params: {...key},query }}) + return getters['getChannelConsensusState']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryChannelConsensusState API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryPacketCommitment({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.IbcCoreChannelV1.query.queryPacketCommitment( key.channel_id, key.port_id, key.sequence)).data + + + commit('QUERY', { query: 'PacketCommitment', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPacketCommitment', payload: { options: { all }, params: {...key},query }}) + return getters['getPacketCommitment']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryPacketCommitment API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryPacketCommitments({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.IbcCoreChannelV1.query.queryPacketCommitments( key.channel_id, key.port_id, query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.IbcCoreChannelV1.query.queryPacketCommitments( key.channel_id, key.port_id, {...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'PacketCommitments', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPacketCommitments', payload: { options: { all }, params: {...key},query }}) + return getters['getPacketCommitments']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryPacketCommitments API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryPacketReceipt({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.IbcCoreChannelV1.query.queryPacketReceipt( key.channel_id, key.port_id, key.sequence)).data + + + commit('QUERY', { query: 'PacketReceipt', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPacketReceipt', payload: { options: { all }, params: {...key},query }}) + return getters['getPacketReceipt']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryPacketReceipt API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryPacketAcknowledgement({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.IbcCoreChannelV1.query.queryPacketAcknowledgement( key.channel_id, key.port_id, key.sequence)).data + + + commit('QUERY', { query: 'PacketAcknowledgement', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPacketAcknowledgement', payload: { options: { all }, params: {...key},query }}) + return getters['getPacketAcknowledgement']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryPacketAcknowledgement API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryPacketAcknowledgements({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.IbcCoreChannelV1.query.queryPacketAcknowledgements( key.channel_id, key.port_id, query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.IbcCoreChannelV1.query.queryPacketAcknowledgements( key.channel_id, key.port_id, {...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'PacketAcknowledgements', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPacketAcknowledgements', payload: { options: { all }, params: {...key},query }}) + return getters['getPacketAcknowledgements']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryPacketAcknowledgements API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryUnreceivedPackets({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.IbcCoreChannelV1.query.queryUnreceivedPackets( key.channel_id, key.port_id, key.packet_commitment_sequences)).data + + + commit('QUERY', { query: 'UnreceivedPackets', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryUnreceivedPackets', payload: { options: { all }, params: {...key},query }}) + return getters['getUnreceivedPackets']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryUnreceivedPackets API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryUnreceivedAcks({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.IbcCoreChannelV1.query.queryUnreceivedAcks( key.channel_id, key.port_id, key.packet_ack_sequences)).data + + + commit('QUERY', { query: 'UnreceivedAcks', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryUnreceivedAcks', payload: { options: { all }, params: {...key},query }}) + return getters['getUnreceivedAcks']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryUnreceivedAcks API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryNextSequenceReceive({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.IbcCoreChannelV1.query.queryNextSequenceReceive( key.channel_id, key.port_id)).data + + + commit('QUERY', { query: 'NextSequenceReceive', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryNextSequenceReceive', payload: { options: { all }, params: {...key},query }}) + return getters['getNextSequenceReceive']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryNextSequenceReceive API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + } +} \ No newline at end of file diff --git a/vue/src/store/generated/ibc.core.client.v1/index.ts b/vue/src/store/generated/ibc.core.client.v1/index.ts new file mode 100755 index 00000000..8e1abf52 --- /dev/null +++ b/vue/src/store/generated/ibc.core.client.v1/index.ts @@ -0,0 +1,398 @@ +import { Client, registry, MissingWalletError } from 'BitCannaGlobal-bcna-client-ts' + +import { IdentifiedClientState } from "BitCannaGlobal-bcna-client-ts/ibc.core.client.v1/types" +import { ConsensusStateWithHeight } from "BitCannaGlobal-bcna-client-ts/ibc.core.client.v1/types" +import { ClientConsensusStates } from "BitCannaGlobal-bcna-client-ts/ibc.core.client.v1/types" +import { ClientUpdateProposal } from "BitCannaGlobal-bcna-client-ts/ibc.core.client.v1/types" +import { UpgradeProposal } from "BitCannaGlobal-bcna-client-ts/ibc.core.client.v1/types" +import { Height } from "BitCannaGlobal-bcna-client-ts/ibc.core.client.v1/types" +import { Params } from "BitCannaGlobal-bcna-client-ts/ibc.core.client.v1/types" +import { GenesisMetadata } from "BitCannaGlobal-bcna-client-ts/ibc.core.client.v1/types" +import { IdentifiedGenesisMetadata } from "BitCannaGlobal-bcna-client-ts/ibc.core.client.v1/types" + + +export { IdentifiedClientState, ConsensusStateWithHeight, ClientConsensusStates, ClientUpdateProposal, UpgradeProposal, Height, Params, GenesisMetadata, IdentifiedGenesisMetadata }; + +function initClient(vuexGetters) { + return new Client(vuexGetters['common/env/getEnv'], vuexGetters['common/wallet/signer']) +} + +function mergeResults(value, next_values) { + for (let prop of Object.keys(next_values)) { + if (Array.isArray(next_values[prop])) { + value[prop]=[...value[prop], ...next_values[prop]] + }else{ + value[prop]=next_values[prop] + } + } + return value +} + +type Field = { + name: string; + type: unknown; +} +function getStructure(template) { + let structure: {fields: Field[]} = { fields: [] } + for (const [key, value] of Object.entries(template)) { + let field = { name: key, type: typeof value } + structure.fields.push(field) + } + return structure +} +const getDefaultState = () => { + return { + ClientState: {}, + ClientStates: {}, + ConsensusState: {}, + ConsensusStates: {}, + ConsensusStateHeights: {}, + ClientStatus: {}, + ClientParams: {}, + UpgradedClientState: {}, + UpgradedConsensusState: {}, + + _Structure: { + IdentifiedClientState: getStructure(IdentifiedClientState.fromPartial({})), + ConsensusStateWithHeight: getStructure(ConsensusStateWithHeight.fromPartial({})), + ClientConsensusStates: getStructure(ClientConsensusStates.fromPartial({})), + ClientUpdateProposal: getStructure(ClientUpdateProposal.fromPartial({})), + UpgradeProposal: getStructure(UpgradeProposal.fromPartial({})), + Height: getStructure(Height.fromPartial({})), + Params: getStructure(Params.fromPartial({})), + GenesisMetadata: getStructure(GenesisMetadata.fromPartial({})), + IdentifiedGenesisMetadata: getStructure(IdentifiedGenesisMetadata.fromPartial({})), + + }, + _Registry: registry, + _Subscriptions: new Set(), + } +} + +// initial state +const state = getDefaultState() + +export default { + namespaced: true, + state, + mutations: { + RESET_STATE(state) { + Object.assign(state, getDefaultState()) + }, + QUERY(state, { query, key, value }) { + state[query][JSON.stringify(key)] = value + }, + SUBSCRIBE(state, subscription) { + state._Subscriptions.add(JSON.stringify(subscription)) + }, + UNSUBSCRIBE(state, subscription) { + state._Subscriptions.delete(JSON.stringify(subscription)) + } + }, + getters: { + getClientState: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.ClientState[JSON.stringify(params)] ?? {} + }, + getClientStates: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.ClientStates[JSON.stringify(params)] ?? {} + }, + getConsensusState: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.ConsensusState[JSON.stringify(params)] ?? {} + }, + getConsensusStates: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.ConsensusStates[JSON.stringify(params)] ?? {} + }, + getConsensusStateHeights: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.ConsensusStateHeights[JSON.stringify(params)] ?? {} + }, + getClientStatus: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.ClientStatus[JSON.stringify(params)] ?? {} + }, + getClientParams: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.ClientParams[JSON.stringify(params)] ?? {} + }, + getUpgradedClientState: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.UpgradedClientState[JSON.stringify(params)] ?? {} + }, + getUpgradedConsensusState: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.UpgradedConsensusState[JSON.stringify(params)] ?? {} + }, + + getTypeStructure: (state) => (type) => { + return state._Structure[type].fields + }, + getRegistry: (state) => { + return state._Registry + } + }, + actions: { + init({ dispatch, rootGetters }) { + console.log('Vuex module: ibc.core.client.v1 initialized!') + if (rootGetters['common/env/client']) { + rootGetters['common/env/client'].on('newblock', () => { + dispatch('StoreUpdate') + }) + } + }, + resetState({ commit }) { + commit('RESET_STATE') + }, + unsubscribe({ commit }, subscription) { + commit('UNSUBSCRIBE', subscription) + }, + async StoreUpdate({ state, dispatch }) { + state._Subscriptions.forEach(async (subscription) => { + try { + const sub=JSON.parse(subscription) + await dispatch(sub.action, sub.payload) + }catch(e) { + throw new Error('Subscriptions: ' + e.message) + } + }) + }, + + + + + + + async QueryClientState({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.IbcCoreClientV1.query.queryClientState( key.client_id)).data + + + commit('QUERY', { query: 'ClientState', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryClientState', payload: { options: { all }, params: {...key},query }}) + return getters['getClientState']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryClientState API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryClientStates({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.IbcCoreClientV1.query.queryClientStates(query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.IbcCoreClientV1.query.queryClientStates({...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'ClientStates', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryClientStates', payload: { options: { all }, params: {...key},query }}) + return getters['getClientStates']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryClientStates API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryConsensusState({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.IbcCoreClientV1.query.queryConsensusState( key.client_id, key.revision_number, key.revision_height, query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.IbcCoreClientV1.query.queryConsensusState( key.client_id, key.revision_number, key.revision_height, {...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'ConsensusState', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryConsensusState', payload: { options: { all }, params: {...key},query }}) + return getters['getConsensusState']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryConsensusState API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryConsensusStates({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.IbcCoreClientV1.query.queryConsensusStates( key.client_id, query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.IbcCoreClientV1.query.queryConsensusStates( key.client_id, {...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'ConsensusStates', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryConsensusStates', payload: { options: { all }, params: {...key},query }}) + return getters['getConsensusStates']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryConsensusStates API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryConsensusStateHeights({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.IbcCoreClientV1.query.queryConsensusStateHeights( key.client_id, query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.IbcCoreClientV1.query.queryConsensusStateHeights( key.client_id, {...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'ConsensusStateHeights', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryConsensusStateHeights', payload: { options: { all }, params: {...key},query }}) + return getters['getConsensusStateHeights']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryConsensusStateHeights API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryClientStatus({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.IbcCoreClientV1.query.queryClientStatus( key.client_id)).data + + + commit('QUERY', { query: 'ClientStatus', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryClientStatus', payload: { options: { all }, params: {...key},query }}) + return getters['getClientStatus']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryClientStatus API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryClientParams({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.IbcCoreClientV1.query.queryClientParams()).data + + + commit('QUERY', { query: 'ClientParams', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryClientParams', payload: { options: { all }, params: {...key},query }}) + return getters['getClientParams']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryClientParams API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryUpgradedClientState({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.IbcCoreClientV1.query.queryUpgradedClientState()).data + + + commit('QUERY', { query: 'UpgradedClientState', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryUpgradedClientState', payload: { options: { all }, params: {...key},query }}) + return getters['getUpgradedClientState']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryUpgradedClientState API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryUpgradedConsensusState({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.IbcCoreClientV1.query.queryUpgradedConsensusState()).data + + + commit('QUERY', { query: 'UpgradedConsensusState', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryUpgradedConsensusState', payload: { options: { all }, params: {...key},query }}) + return getters['getUpgradedConsensusState']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryUpgradedConsensusState API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + } +} \ No newline at end of file diff --git a/vue/src/store/generated/ibc.core.connection.v1/index.ts b/vue/src/store/generated/ibc.core.connection.v1/index.ts new file mode 100755 index 00000000..f4c8b06b --- /dev/null +++ b/vue/src/store/generated/ibc.core.connection.v1/index.ts @@ -0,0 +1,295 @@ +import { Client, registry, MissingWalletError } from 'BitCannaGlobal-bcna-client-ts' + +import { ConnectionEnd } from "BitCannaGlobal-bcna-client-ts/ibc.core.connection.v1/types" +import { IdentifiedConnection } from "BitCannaGlobal-bcna-client-ts/ibc.core.connection.v1/types" +import { Counterparty } from "BitCannaGlobal-bcna-client-ts/ibc.core.connection.v1/types" +import { ClientPaths } from "BitCannaGlobal-bcna-client-ts/ibc.core.connection.v1/types" +import { ConnectionPaths } from "BitCannaGlobal-bcna-client-ts/ibc.core.connection.v1/types" +import { Version } from "BitCannaGlobal-bcna-client-ts/ibc.core.connection.v1/types" +import { Params } from "BitCannaGlobal-bcna-client-ts/ibc.core.connection.v1/types" + + +export { ConnectionEnd, IdentifiedConnection, Counterparty, ClientPaths, ConnectionPaths, Version, Params }; + +function initClient(vuexGetters) { + return new Client(vuexGetters['common/env/getEnv'], vuexGetters['common/wallet/signer']) +} + +function mergeResults(value, next_values) { + for (let prop of Object.keys(next_values)) { + if (Array.isArray(next_values[prop])) { + value[prop]=[...value[prop], ...next_values[prop]] + }else{ + value[prop]=next_values[prop] + } + } + return value +} + +type Field = { + name: string; + type: unknown; +} +function getStructure(template) { + let structure: {fields: Field[]} = { fields: [] } + for (const [key, value] of Object.entries(template)) { + let field = { name: key, type: typeof value } + structure.fields.push(field) + } + return structure +} +const getDefaultState = () => { + return { + Connection: {}, + Connections: {}, + ClientConnections: {}, + ConnectionClientState: {}, + ConnectionConsensusState: {}, + ConnectionParams: {}, + + _Structure: { + ConnectionEnd: getStructure(ConnectionEnd.fromPartial({})), + IdentifiedConnection: getStructure(IdentifiedConnection.fromPartial({})), + Counterparty: getStructure(Counterparty.fromPartial({})), + ClientPaths: getStructure(ClientPaths.fromPartial({})), + ConnectionPaths: getStructure(ConnectionPaths.fromPartial({})), + Version: getStructure(Version.fromPartial({})), + Params: getStructure(Params.fromPartial({})), + + }, + _Registry: registry, + _Subscriptions: new Set(), + } +} + +// initial state +const state = getDefaultState() + +export default { + namespaced: true, + state, + mutations: { + RESET_STATE(state) { + Object.assign(state, getDefaultState()) + }, + QUERY(state, { query, key, value }) { + state[query][JSON.stringify(key)] = value + }, + SUBSCRIBE(state, subscription) { + state._Subscriptions.add(JSON.stringify(subscription)) + }, + UNSUBSCRIBE(state, subscription) { + state._Subscriptions.delete(JSON.stringify(subscription)) + } + }, + getters: { + getConnection: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Connection[JSON.stringify(params)] ?? {} + }, + getConnections: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Connections[JSON.stringify(params)] ?? {} + }, + getClientConnections: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.ClientConnections[JSON.stringify(params)] ?? {} + }, + getConnectionClientState: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.ConnectionClientState[JSON.stringify(params)] ?? {} + }, + getConnectionConsensusState: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.ConnectionConsensusState[JSON.stringify(params)] ?? {} + }, + getConnectionParams: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.ConnectionParams[JSON.stringify(params)] ?? {} + }, + + getTypeStructure: (state) => (type) => { + return state._Structure[type].fields + }, + getRegistry: (state) => { + return state._Registry + } + }, + actions: { + init({ dispatch, rootGetters }) { + console.log('Vuex module: ibc.core.connection.v1 initialized!') + if (rootGetters['common/env/client']) { + rootGetters['common/env/client'].on('newblock', () => { + dispatch('StoreUpdate') + }) + } + }, + resetState({ commit }) { + commit('RESET_STATE') + }, + unsubscribe({ commit }, subscription) { + commit('UNSUBSCRIBE', subscription) + }, + async StoreUpdate({ state, dispatch }) { + state._Subscriptions.forEach(async (subscription) => { + try { + const sub=JSON.parse(subscription) + await dispatch(sub.action, sub.payload) + }catch(e) { + throw new Error('Subscriptions: ' + e.message) + } + }) + }, + + + + + + + async QueryConnection({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.IbcCoreConnectionV1.query.queryConnection( key.connection_id)).data + + + commit('QUERY', { query: 'Connection', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryConnection', payload: { options: { all }, params: {...key},query }}) + return getters['getConnection']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryConnection API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryConnections({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.IbcCoreConnectionV1.query.queryConnections(query ?? undefined)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await client.IbcCoreConnectionV1.query.queryConnections({...query ?? {}, 'pagination.key':( value).pagination.next_key} as any)).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'Connections', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryConnections', payload: { options: { all }, params: {...key},query }}) + return getters['getConnections']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryConnections API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryClientConnections({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.IbcCoreConnectionV1.query.queryClientConnections( key.client_id)).data + + + commit('QUERY', { query: 'ClientConnections', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryClientConnections', payload: { options: { all }, params: {...key},query }}) + return getters['getClientConnections']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryClientConnections API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryConnectionClientState({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.IbcCoreConnectionV1.query.queryConnectionClientState( key.connection_id)).data + + + commit('QUERY', { query: 'ConnectionClientState', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryConnectionClientState', payload: { options: { all }, params: {...key},query }}) + return getters['getConnectionClientState']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryConnectionClientState API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryConnectionConsensusState({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.IbcCoreConnectionV1.query.queryConnectionConsensusState( key.connection_id, key.revision_number, key.revision_height)).data + + + commit('QUERY', { query: 'ConnectionConsensusState', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryConnectionConsensusState', payload: { options: { all }, params: {...key},query }}) + return getters['getConnectionConsensusState']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryConnectionConsensusState API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryConnectionParams({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const client = initClient(rootGetters); + let value= (await client.IbcCoreConnectionV1.query.queryConnectionParams()).data + + + commit('QUERY', { query: 'ConnectionParams', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryConnectionParams', payload: { options: { all }, params: {...key},query }}) + return getters['getConnectionParams']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryConnectionParams API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + } +} \ No newline at end of file diff --git a/vue/src/store/generated/index.ts b/vue/src/store/generated/index.ts new file mode 100755 index 00000000..93c0a9f8 --- /dev/null +++ b/vue/src/store/generated/index.ts @@ -0,0 +1,83 @@ +// THIS FILE IS GENERATED AUTOMATICALLY. DO NOT MODIFY. + +import BcnaBurn from './bcna.burn' +import BitcannaglobalBcnaBcna from './bitcannaglobal.bcna.bcna' +import IbcApplicationsInterchainAccountsControllerV1 from './ibc.applications.interchain_accounts.controller.v1' +import IbcApplicationsInterchainAccountsHostV1 from './ibc.applications.interchain_accounts.host.v1' +import IbcApplicationsTransferV1 from './ibc.applications.transfer.v1' +import IbcCoreChannelV1 from './ibc.core.channel.v1' +import IbcCoreClientV1 from './ibc.core.client.v1' +import IbcCoreConnectionV1 from './ibc.core.connection.v1' +import CosmosAuthV1Beta1 from './cosmos.auth.v1beta1' +import CosmosAuthzV1Beta1 from './cosmos.authz.v1beta1' +import CosmosBankV1Beta1 from './cosmos.bank.v1beta1' +import CosmosBaseNodeV1Beta1 from './cosmos.base.node.v1beta1' +import CosmosBaseTendermintV1Beta1 from './cosmos.base.tendermint.v1beta1' +import CosmosConsensusV1 from './cosmos.consensus.v1' +import CosmosCrisisV1Beta1 from './cosmos.crisis.v1beta1' +import CosmosDistributionV1Beta1 from './cosmos.distribution.v1beta1' +import CosmosEvidenceV1Beta1 from './cosmos.evidence.v1beta1' +import CosmosFeegrantV1Beta1 from './cosmos.feegrant.v1beta1' +import CosmosGovV1 from './cosmos.gov.v1' +import CosmosGovV1Beta1 from './cosmos.gov.v1beta1' +import CosmosGroupV1 from './cosmos.group.v1' +import CosmosMintV1Beta1 from './cosmos.mint.v1beta1' +import CosmosNftV1Beta1 from './cosmos.nft.v1beta1' +import CosmosParamsV1Beta1 from './cosmos.params.v1beta1' +import CosmosSlashingV1Beta1 from './cosmos.slashing.v1beta1' +import CosmosStakingV1Beta1 from './cosmos.staking.v1beta1' +import CosmosTxV1Beta1 from './cosmos.tx.v1beta1' +import CosmosUpgradeV1Beta1 from './cosmos.upgrade.v1beta1' +import CosmosVestingV1Beta1 from './cosmos.vesting.v1beta1' + + +export default { + BcnaBurn: load(BcnaBurn, 'bcna.burn'), + BitcannaglobalBcnaBcna: load(BitcannaglobalBcnaBcna, 'bitcannaglobal.bcna.bcna'), + IbcApplicationsInterchainAccountsControllerV1: load(IbcApplicationsInterchainAccountsControllerV1, 'ibc.applications.interchain_accounts.controller.v1'), + IbcApplicationsInterchainAccountsHostV1: load(IbcApplicationsInterchainAccountsHostV1, 'ibc.applications.interchain_accounts.host.v1'), + IbcApplicationsTransferV1: load(IbcApplicationsTransferV1, 'ibc.applications.transfer.v1'), + IbcCoreChannelV1: load(IbcCoreChannelV1, 'ibc.core.channel.v1'), + IbcCoreClientV1: load(IbcCoreClientV1, 'ibc.core.client.v1'), + IbcCoreConnectionV1: load(IbcCoreConnectionV1, 'ibc.core.connection.v1'), + CosmosAuthV1Beta1: load(CosmosAuthV1Beta1, 'cosmos.auth.v1beta1'), + CosmosAuthzV1Beta1: load(CosmosAuthzV1Beta1, 'cosmos.authz.v1beta1'), + CosmosBankV1Beta1: load(CosmosBankV1Beta1, 'cosmos.bank.v1beta1'), + CosmosBaseNodeV1Beta1: load(CosmosBaseNodeV1Beta1, 'cosmos.base.node.v1beta1'), + CosmosBaseTendermintV1Beta1: load(CosmosBaseTendermintV1Beta1, 'cosmos.base.tendermint.v1beta1'), + CosmosConsensusV1: load(CosmosConsensusV1, 'cosmos.consensus.v1'), + CosmosCrisisV1Beta1: load(CosmosCrisisV1Beta1, 'cosmos.crisis.v1beta1'), + CosmosDistributionV1Beta1: load(CosmosDistributionV1Beta1, 'cosmos.distribution.v1beta1'), + CosmosEvidenceV1Beta1: load(CosmosEvidenceV1Beta1, 'cosmos.evidence.v1beta1'), + CosmosFeegrantV1Beta1: load(CosmosFeegrantV1Beta1, 'cosmos.feegrant.v1beta1'), + CosmosGovV1: load(CosmosGovV1, 'cosmos.gov.v1'), + CosmosGovV1Beta1: load(CosmosGovV1Beta1, 'cosmos.gov.v1beta1'), + CosmosGroupV1: load(CosmosGroupV1, 'cosmos.group.v1'), + CosmosMintV1Beta1: load(CosmosMintV1Beta1, 'cosmos.mint.v1beta1'), + CosmosNftV1Beta1: load(CosmosNftV1Beta1, 'cosmos.nft.v1beta1'), + CosmosParamsV1Beta1: load(CosmosParamsV1Beta1, 'cosmos.params.v1beta1'), + CosmosSlashingV1Beta1: load(CosmosSlashingV1Beta1, 'cosmos.slashing.v1beta1'), + CosmosStakingV1Beta1: load(CosmosStakingV1Beta1, 'cosmos.staking.v1beta1'), + CosmosTxV1Beta1: load(CosmosTxV1Beta1, 'cosmos.tx.v1beta1'), + CosmosUpgradeV1Beta1: load(CosmosUpgradeV1Beta1, 'cosmos.upgrade.v1beta1'), + CosmosVestingV1Beta1: load(CosmosVestingV1Beta1, 'cosmos.vesting.v1beta1'), + +} + + +function load(mod, fullns) { + return function init(store) { + if (store.hasModule([fullns])) { + throw new Error('Duplicate module name detected: '+ fullns) + }else{ + store.registerModule([fullns], mod) + store.subscribe((mutation) => { + if (mutation.type == 'common/env/INITIALIZE_WS_COMPLETE') { + store.dispatch(fullns+ '/init', null, { + root: true + }) + } + }) + } + } +} \ No newline at end of file diff --git a/vue/src/store/generated/local-check.js b/vue/src/store/generated/local-check.js new file mode 100755 index 00000000..1cb66c57 --- /dev/null +++ b/vue/src/store/generated/local-check.js @@ -0,0 +1,15 @@ +/* eslint-env node */ +const pkgjson = require("./package.json"); + +for (let pkg in pkgjson.dependencies) { + if (pkgjson.dependencies[pkg].startsWith("file:")) { + console.error( + "\x1b[31m%s\x1b[0m", + `Package '${pkg}' located at '${pkgjson.dependencies[pkg].replace( + "file:", + "" + )}' needs to be published and your package.json file updated before publishing.` + ); + process.exit(1) + } +} \ No newline at end of file diff --git a/vue/src/store/generated/package.json b/vue/src/store/generated/package.json new file mode 100755 index 00000000..ca9afe46 --- /dev/null +++ b/vue/src/store/generated/package.json @@ -0,0 +1,34 @@ +{ + "author": "Ignite Codegen ", + "dependencies": { + "BitCannaGlobal-bcna-client-ts": "file:../../../../ts-client", + "buffer": "^6.0.3" + }, + "description": "Autogenerated Vuex Stores", + "devDependencies": { + "typescript": "^4.8.4" + }, + "license": "Apache-2.0", + "licenses": [ + { + "type": "Apache-2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0" + } + ], + "main": "./lib/index.js", + "name": "BitCannaGlobal-bcna-vuex", + "peerDependencies": { + "@cosmjs/proto-signing": "0.27.0", + "@cosmjs/stargate": "0.27.0", + "vue": "3.2.31" + }, + "publishConfig": { + "access": "public" + }, + "scripts": { + "build": "tsc", + "postinstall": "node postinstall.js", + "prepublishOnly": "node local-check.js && tsc" + }, + "version": "0.0.1" +} diff --git a/vue/src/store/generated/postinstall.js b/vue/src/store/generated/postinstall.js new file mode 100755 index 00000000..4ce12284 --- /dev/null +++ b/vue/src/store/generated/postinstall.js @@ -0,0 +1,9 @@ +/* eslint-env node */ +const pkgjson = require("./package.json"); +var exec = require("child_process").exec; + +for (let pkg in pkgjson.dependencies) { + if (pkgjson.dependencies[pkg].startsWith("file:")) { + exec(`cd ./node_modules/${pkg} && npm install`); + } +} \ No newline at end of file diff --git a/vue/src/store/generated/tsconfig.json b/vue/src/store/generated/tsconfig.json new file mode 100755 index 00000000..87d99d67 --- /dev/null +++ b/vue/src/store/generated/tsconfig.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "target": "es2020", + "module": "es2020", /* Specify the root folder within your source files. */ + "moduleResolution": "node", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ + "outDir": "./lib", + "esModuleInterop": true, + "strict": false, + "skipLibCheck": true /* Skip type checking all .d.ts files. */ + } +} diff --git a/x/burn/client/cli/query.go b/x/burn/client/cli/query.go new file mode 100644 index 00000000..ffa60607 --- /dev/null +++ b/x/burn/client/cli/query.go @@ -0,0 +1,31 @@ +package cli + +import ( + "fmt" + // "strings" + + "github.com/spf13/cobra" + + "github.com/cosmos/cosmos-sdk/client" + // "github.com/cosmos/cosmos-sdk/client/flags" + // sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/BitCannaGlobal/bcna/x/burn/types" +) + +// GetQueryCmd returns the cli query commands for this module +func GetQueryCmd(queryRoute string) *cobra.Command { + // Group burn queries under a subcommand + cmd := &cobra.Command{ + Use: types.ModuleName, + Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + cmd.AddCommand(CmdQueryParams()) + // this line is used by starport scaffolding # 1 + + return cmd +} diff --git a/x/burn/client/cli/query_params.go b/x/burn/client/cli/query_params.go new file mode 100644 index 00000000..798aac04 --- /dev/null +++ b/x/burn/client/cli/query_params.go @@ -0,0 +1,36 @@ +package cli + +import ( + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/spf13/cobra" + + "github.com/BitCannaGlobal/bcna/x/burn/types" +) + +func CmdQueryParams() *cobra.Command { + cmd := &cobra.Command{ + Use: "params", + Short: "shows the parameters of the module", + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + res, err := queryClient.Params(cmd.Context(), &types.QueryParamsRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/burn/client/cli/tx.go b/x/burn/client/cli/tx.go new file mode 100644 index 00000000..261861c8 --- /dev/null +++ b/x/burn/client/cli/tx.go @@ -0,0 +1,37 @@ +package cli + +import ( + "fmt" + "time" + + "github.com/spf13/cobra" + + "github.com/cosmos/cosmos-sdk/client" + // "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/BitCannaGlobal/bcna/x/burn/types" +) + +var ( + DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) +) + +const ( + flagPacketTimeoutTimestamp = "packet-timeout-timestamp" + listSeparator = "," +) + +// GetTxCmd returns the transaction commands for this module +func GetTxCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: types.ModuleName, + Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName), + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + cmd.AddCommand(CmdBurnCoinsAction()) + // this line is used by starport scaffolding # 1 + + return cmd +} diff --git a/x/burn/client/cli/tx_burn_coins_action.go b/x/burn/client/cli/tx_burn_coins_action.go new file mode 100644 index 00000000..33f8515d --- /dev/null +++ b/x/burn/client/cli/tx_burn_coins_action.go @@ -0,0 +1,46 @@ +package cli + +import ( + "strconv" + + "github.com/BitCannaGlobal/bcna/x/burn/types" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/tx" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/spf13/cobra" +) + +var _ = strconv.Itoa(0) + +func CmdBurnCoinsAction() *cobra.Command { + cmd := &cobra.Command{ + Use: "burn-coins-action [coins]", + Short: "Broadcast message BurnCoinsAction", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) (err error) { + argCoins, err := sdk.ParseCoinsNormalized(args[0]) + if err != nil { + return err + } + + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + msg := types.NewMsgBurnCoinsAction( + clientCtx.GetFromAddress().String(), + argCoins, + ) + if err := msg.ValidateBasic(); err != nil { + return err + } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} diff --git a/x/burn/genesis.go b/x/burn/genesis.go new file mode 100644 index 00000000..53baf697 --- /dev/null +++ b/x/burn/genesis.go @@ -0,0 +1,23 @@ +package burn + +import ( + "github.com/BitCannaGlobal/bcna/x/burn/keeper" + "github.com/BitCannaGlobal/bcna/x/burn/types" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// InitGenesis initializes the module's state from a provided genesis state. +func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { + // this line is used by starport scaffolding # genesis/module/init + k.SetParams(ctx, genState.Params) +} + +// ExportGenesis returns the module's exported genesis +func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { + genesis := types.DefaultGenesis() + genesis.Params = k.GetParams(ctx) + + // this line is used by starport scaffolding # genesis/module/export + + return genesis +} diff --git a/x/burn/genesis_test.go b/x/burn/genesis_test.go new file mode 100644 index 00000000..98f321c5 --- /dev/null +++ b/x/burn/genesis_test.go @@ -0,0 +1,29 @@ +package burn_test + +import ( + "testing" + + keepertest "github.com/BitCannaGlobal/bcna/testutil/keeper" + "github.com/BitCannaGlobal/bcna/testutil/nullify" + "github.com/BitCannaGlobal/bcna/x/burn" + "github.com/BitCannaGlobal/bcna/x/burn/types" + "github.com/stretchr/testify/require" +) + +func TestGenesis(t *testing.T) { + genesisState := types.GenesisState{ + Params: types.DefaultParams(), + + // this line is used by starport scaffolding # genesis/test/state + } + + k, ctx := keepertest.BurnKeeper(t) + burn.InitGenesis(ctx, *k, genesisState) + got := burn.ExportGenesis(ctx, *k) + require.NotNil(t, got) + + nullify.Fill(&genesisState) + nullify.Fill(got) + + // this line is used by starport scaffolding # genesis/test/assert +} diff --git a/x/burn/keeper/keeper.go b/x/burn/keeper/keeper.go new file mode 100644 index 00000000..9033bbdb --- /dev/null +++ b/x/burn/keeper/keeper.go @@ -0,0 +1,51 @@ +package keeper + +import ( + "fmt" + + "github.com/cometbft/cometbft/libs/log" + "github.com/cosmos/cosmos-sdk/codec" + storetypes "github.com/cosmos/cosmos-sdk/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + + "github.com/BitCannaGlobal/bcna/x/burn/types" +) + +type ( + Keeper struct { + cdc codec.BinaryCodec + storeKey storetypes.StoreKey + memKey storetypes.StoreKey + paramstore paramtypes.Subspace + + bankKeeper types.BankKeeper + } +) + +func NewKeeper( + cdc codec.BinaryCodec, + storeKey, + memKey storetypes.StoreKey, + ps paramtypes.Subspace, + + bankKeeper types.BankKeeper, +) *Keeper { + // set KeyTable if it has not already been set + if !ps.HasKeyTable() { + ps = ps.WithKeyTable(types.ParamKeyTable()) + } + + return &Keeper{ + cdc: cdc, + storeKey: storeKey, + memKey: memKey, + paramstore: ps, + + bankKeeper: bankKeeper, + } +} + +func (k Keeper) Logger(ctx sdk.Context) log.Logger { + return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) +} diff --git a/x/burn/keeper/msg_server.go b/x/burn/keeper/msg_server.go new file mode 100644 index 00000000..cc4eb3e2 --- /dev/null +++ b/x/burn/keeper/msg_server.go @@ -0,0 +1,17 @@ +package keeper + +import ( + "github.com/BitCannaGlobal/bcna/x/burn/types" +) + +type msgServer struct { + Keeper +} + +// NewMsgServerImpl returns an implementation of the MsgServer interface +// for the provided Keeper. +func NewMsgServerImpl(keeper Keeper) types.MsgServer { + return &msgServer{Keeper: keeper} +} + +var _ types.MsgServer = msgServer{} diff --git a/x/burn/keeper/msg_server_burn_coins_action.go b/x/burn/keeper/msg_server_burn_coins_action.go new file mode 100644 index 00000000..b8558faa --- /dev/null +++ b/x/burn/keeper/msg_server_burn_coins_action.go @@ -0,0 +1,28 @@ +package keeper + +import ( + "context" + + "github.com/BitCannaGlobal/bcna/x/burn/types" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// Burn msg.Coins from msg.Creator balances +func (k msgServer) BurnCoinsAction(goCtx context.Context, msg *types.MsgBurnCoinsAction) (*types.MsgBurnCoinsActionResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + creatorAddr, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + return nil, err + } + + if err := k.bankKeeper.SendCoinsFromAccountToModule(ctx, creatorAddr, types.ModuleName, msg.Coins); err != nil { + return nil, err + } + + if err := k.bankKeeper.BurnCoins(ctx, types.ModuleName, msg.Coins); err != nil { + return nil, err + } + + return &types.MsgBurnCoinsActionResponse{}, nil +} diff --git a/x/burn/keeper/msg_server_test.go b/x/burn/keeper/msg_server_test.go new file mode 100644 index 00000000..c89a2832 --- /dev/null +++ b/x/burn/keeper/msg_server_test.go @@ -0,0 +1,23 @@ +package keeper_test + +import ( + "context" + "testing" + + keepertest "github.com/BitCannaGlobal/bcna/testutil/keeper" + "github.com/BitCannaGlobal/bcna/x/burn/keeper" + "github.com/BitCannaGlobal/bcna/x/burn/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" +) + +func setupMsgServer(t testing.TB) (types.MsgServer, context.Context) { + k, ctx := keepertest.BurnKeeper(t) + return keeper.NewMsgServerImpl(*k), sdk.WrapSDKContext(ctx) +} + +func TestMsgServer(t *testing.T) { + ms, ctx := setupMsgServer(t) + require.NotNil(t, ms) + require.NotNil(t, ctx) +} diff --git a/x/burn/keeper/params.go b/x/burn/keeper/params.go new file mode 100644 index 00000000..a4078815 --- /dev/null +++ b/x/burn/keeper/params.go @@ -0,0 +1,16 @@ +package keeper + +import ( + "github.com/BitCannaGlobal/bcna/x/burn/types" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// GetParams get all parameters as types.Params +func (k Keeper) GetParams(ctx sdk.Context) types.Params { + return types.NewParams() +} + +// SetParams set the params +func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { + k.paramstore.SetParamSet(ctx, ¶ms) +} diff --git a/x/burn/keeper/params_test.go b/x/burn/keeper/params_test.go new file mode 100644 index 00000000..34829667 --- /dev/null +++ b/x/burn/keeper/params_test.go @@ -0,0 +1,18 @@ +package keeper_test + +import ( + "testing" + + testkeeper "github.com/BitCannaGlobal/bcna/testutil/keeper" + "github.com/BitCannaGlobal/bcna/x/burn/types" + "github.com/stretchr/testify/require" +) + +func TestGetParams(t *testing.T) { + k, ctx := testkeeper.BurnKeeper(t) + params := types.DefaultParams() + + k.SetParams(ctx, params) + + require.EqualValues(t, params, k.GetParams(ctx)) +} diff --git a/x/burn/keeper/query.go b/x/burn/keeper/query.go new file mode 100644 index 00000000..05328b67 --- /dev/null +++ b/x/burn/keeper/query.go @@ -0,0 +1,7 @@ +package keeper + +import ( + "github.com/BitCannaGlobal/bcna/x/burn/types" +) + +var _ types.QueryServer = Keeper{} diff --git a/x/burn/keeper/query_params.go b/x/burn/keeper/query_params.go new file mode 100644 index 00000000..91f5df9f --- /dev/null +++ b/x/burn/keeper/query_params.go @@ -0,0 +1,19 @@ +package keeper + +import ( + "context" + + "github.com/BitCannaGlobal/bcna/x/burn/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(goCtx) + + return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil +} diff --git a/x/burn/keeper/query_params_test.go b/x/burn/keeper/query_params_test.go new file mode 100644 index 00000000..1e2f0291 --- /dev/null +++ b/x/burn/keeper/query_params_test.go @@ -0,0 +1,21 @@ +package keeper_test + +import ( + "testing" + + testkeeper "github.com/BitCannaGlobal/bcna/testutil/keeper" + "github.com/BitCannaGlobal/bcna/x/burn/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" +) + +func TestParamsQuery(t *testing.T) { + keeper, ctx := testkeeper.BurnKeeper(t) + wctx := sdk.WrapSDKContext(ctx) + params := types.DefaultParams() + keeper.SetParams(ctx, params) + + response, err := keeper.Params(wctx, &types.QueryParamsRequest{}) + require.NoError(t, err) + require.Equal(t, &types.QueryParamsResponse{Params: params}, response) +} diff --git a/x/burn/module.go b/x/burn/module.go new file mode 100644 index 00000000..e52cf94d --- /dev/null +++ b/x/burn/module.go @@ -0,0 +1,148 @@ +package burn + +import ( + "context" + "encoding/json" + "fmt" + // this line is used by starport scaffolding # 1 + + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/spf13/cobra" + + abci "github.com/cometbft/cometbft/abci/types" + + "github.com/BitCannaGlobal/bcna/x/burn/client/cli" + "github.com/BitCannaGlobal/bcna/x/burn/keeper" + "github.com/BitCannaGlobal/bcna/x/burn/types" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" +) + +var ( + _ module.AppModule = AppModule{} + _ module.AppModuleBasic = AppModuleBasic{} +) + +// ---------------------------------------------------------------------------- +// AppModuleBasic +// ---------------------------------------------------------------------------- + +// AppModuleBasic implements the AppModuleBasic interface that defines the independent methods a Cosmos SDK module needs to implement. +type AppModuleBasic struct { + cdc codec.BinaryCodec +} + +func NewAppModuleBasic(cdc codec.BinaryCodec) AppModuleBasic { + return AppModuleBasic{cdc: cdc} +} + +// Name returns the name of the module as a string +func (AppModuleBasic) Name() string { + return types.ModuleName +} + +// RegisterLegacyAminoCodec registers the amino codec for the module, which is used to marshal and unmarshal structs to/from []byte in order to persist them in the module's KVStore +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + types.RegisterCodec(cdc) +} + +// RegisterInterfaces registers a module's interface types and their concrete implementations as proto.Message +func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { + types.RegisterInterfaces(reg) +} + +// DefaultGenesis returns a default GenesisState for the module, marshalled to json.RawMessage. The default GenesisState need to be defined by the module developer and is primarily used for testing +func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { + return cdc.MustMarshalJSON(types.DefaultGenesis()) +} + +// ValidateGenesis used to validate the GenesisState, given in its json.RawMessage form +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { + var genState types.GenesisState + if err := cdc.UnmarshalJSON(bz, &genState); err != nil { + return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) + } + return genState.Validate() +} + +// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module +func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { + types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)) +} + +// GetTxCmd returns the root Tx command for the module. The subcommands of this root command are used by end-users to generate new transactions containing messages defined in the module +func (a AppModuleBasic) GetTxCmd() *cobra.Command { + return cli.GetTxCmd() +} + +// GetQueryCmd returns the root query command for the module. The subcommands of this root command are used by end-users to generate new queries to the subset of the state defined by the module +func (AppModuleBasic) GetQueryCmd() *cobra.Command { + return cli.GetQueryCmd(types.StoreKey) +} + +// ---------------------------------------------------------------------------- +// AppModule +// ---------------------------------------------------------------------------- + +// AppModule implements the AppModule interface that defines the inter-dependent methods that modules need to implement +type AppModule struct { + AppModuleBasic + + keeper keeper.Keeper + accountKeeper types.AccountKeeper + bankKeeper types.BankKeeper +} + +func NewAppModule( + cdc codec.Codec, + keeper keeper.Keeper, + accountKeeper types.AccountKeeper, + bankKeeper types.BankKeeper, +) AppModule { + return AppModule{ + AppModuleBasic: NewAppModuleBasic(cdc), + keeper: keeper, + accountKeeper: accountKeeper, + bankKeeper: bankKeeper, + } +} + +// RegisterServices registers a gRPC query service to respond to the module-specific gRPC queries +func (am AppModule) RegisterServices(cfg module.Configurator) { + types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) + types.RegisterQueryServer(cfg.QueryServer(), am.keeper) +} + +// RegisterInvariants registers the invariants of the module. If an invariant deviates from its predicted value, the InvariantRegistry triggers appropriate logic (most often the chain will be halted) +func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} + +// InitGenesis performs the module's genesis initialization. It returns no validator updates. +func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) []abci.ValidatorUpdate { + var genState types.GenesisState + // Initialize global index to index in genesis state + cdc.MustUnmarshalJSON(gs, &genState) + + InitGenesis(ctx, am.keeper, genState) + + return []abci.ValidatorUpdate{} +} + +// ExportGenesis returns the module's exported genesis state as raw JSON bytes. +func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { + genState := ExportGenesis(ctx, am.keeper) + return cdc.MustMarshalJSON(genState) +} + +// ConsensusVersion is a sequence number for state-breaking change of the module. It should be incremented on each consensus-breaking change introduced by the module. To avoid wrong/empty versions, the initial version should be set to 1 +func (AppModule) ConsensusVersion() uint64 { return 1 } + +// BeginBlock contains the logic that is automatically triggered at the beginning of each block +func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} + +// EndBlock contains the logic that is automatically triggered at the end of each block +func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { + return []abci.ValidatorUpdate{} +} diff --git a/x/burn/module_simulation.go b/x/burn/module_simulation.go new file mode 100644 index 00000000..33557468 --- /dev/null +++ b/x/burn/module_simulation.go @@ -0,0 +1,87 @@ +package burn + +import ( + "math/rand" + + "github.com/BitCannaGlobal/bcna/testutil/sample" + burnsimulation "github.com/BitCannaGlobal/bcna/x/burn/simulation" + "github.com/BitCannaGlobal/bcna/x/burn/types" + "github.com/cosmos/cosmos-sdk/baseapp" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/cosmos/cosmos-sdk/x/simulation" +) + +// avoid unused import issue +var ( + _ = sample.AccAddress + _ = burnsimulation.FindAccount + _ = simulation.MsgEntryKind + _ = baseapp.Paramspace + _ = rand.Rand{} +) + +const ( + opWeightMsgBurnCoinsAction = "op_weight_msg_burn_coins_action" + // TODO: Determine the simulation weight value + defaultWeightMsgBurnCoinsAction int = 100 + + // this line is used by starport scaffolding # simapp/module/const +) + +// GenerateGenesisState creates a randomized GenState of the module. +func (AppModule) GenerateGenesisState(simState *module.SimulationState) { + accs := make([]string, len(simState.Accounts)) + for i, acc := range simState.Accounts { + accs[i] = acc.Address.String() + } + burnGenesis := types.GenesisState{ + Params: types.DefaultParams(), + // this line is used by starport scaffolding # simapp/module/genesisState + } + simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(&burnGenesis) +} + +// RegisterStoreDecoder registers a decoder. +func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) {} + +// ProposalContents doesn't return any content functions for governance proposals. +func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { + return nil +} + +// WeightedOperations returns the all the gov module operations with their respective weights. +func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { + operations := make([]simtypes.WeightedOperation, 0) + + var weightMsgBurnCoinsAction int + simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgBurnCoinsAction, &weightMsgBurnCoinsAction, nil, + func(_ *rand.Rand) { + weightMsgBurnCoinsAction = defaultWeightMsgBurnCoinsAction + }, + ) + operations = append(operations, simulation.NewWeightedOperation( + weightMsgBurnCoinsAction, + burnsimulation.SimulateMsgBurnCoinsAction(am.accountKeeper, am.bankKeeper, am.keeper), + )) + + // this line is used by starport scaffolding # simapp/module/operation + + return operations +} + +// ProposalMsgs returns msgs used for governance proposals for simulations. +func (am AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.WeightedProposalMsg { + return []simtypes.WeightedProposalMsg{ + simulation.NewWeightedProposalMsg( + opWeightMsgBurnCoinsAction, + defaultWeightMsgBurnCoinsAction, + func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { + burnsimulation.SimulateMsgBurnCoinsAction(am.accountKeeper, am.bankKeeper, am.keeper) + return nil + }, + ), + // this line is used by starport scaffolding # simapp/module/OpMsg + } +} diff --git a/x/burn/simulation/burn_coins_action.go b/x/burn/simulation/burn_coins_action.go new file mode 100644 index 00000000..5b0165da --- /dev/null +++ b/x/burn/simulation/burn_coins_action.go @@ -0,0 +1,29 @@ +package simulation + +import ( + "math/rand" + + "github.com/BitCannaGlobal/bcna/x/burn/keeper" + "github.com/BitCannaGlobal/bcna/x/burn/types" + "github.com/cosmos/cosmos-sdk/baseapp" + sdk "github.com/cosmos/cosmos-sdk/types" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" +) + +func SimulateMsgBurnCoinsAction( + ak types.AccountKeeper, + bk types.BankKeeper, + k keeper.Keeper, +) simtypes.Operation { + return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, + ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { + simAccount, _ := simtypes.RandomAcc(r, accs) + msg := &types.MsgBurnCoinsAction{ + Creator: simAccount.Address.String(), + } + + // TODO: Handling the BurnCoinsAction simulation + + return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "BurnCoinsAction simulation not implemented"), nil, nil + } +} diff --git a/x/burn/simulation/helpers.go b/x/burn/simulation/helpers.go new file mode 100644 index 00000000..92c437c0 --- /dev/null +++ b/x/burn/simulation/helpers.go @@ -0,0 +1,15 @@ +package simulation + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" +) + +// FindAccount find a specific address from an account list +func FindAccount(accs []simtypes.Account, address string) (simtypes.Account, bool) { + creator, err := sdk.AccAddressFromBech32(address) + if err != nil { + panic(err) + } + return simtypes.FindAccount(accs, creator) +} diff --git a/x/burn/types/codec.go b/x/burn/types/codec.go new file mode 100644 index 00000000..11a8d696 --- /dev/null +++ b/x/burn/types/codec.go @@ -0,0 +1,27 @@ +package types + +import ( + "github.com/cosmos/cosmos-sdk/codec" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/msgservice" +) + +func RegisterCodec(cdc *codec.LegacyAmino) { + cdc.RegisterConcrete(&MsgBurnCoinsAction{}, "burn/BurnCoinsAction", nil) + // this line is used by starport scaffolding # 2 +} + +func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgBurnCoinsAction{}, + ) + // this line is used by starport scaffolding # 3 + + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) +} + +var ( + Amino = codec.NewLegacyAmino() + ModuleCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry()) +) diff --git a/x/burn/types/errors.go b/x/burn/types/errors.go new file mode 100644 index 00000000..b9ba77f0 --- /dev/null +++ b/x/burn/types/errors.go @@ -0,0 +1,12 @@ +package types + +// DONTCOVER + +import ( + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +// x/burn module sentinel errors +var ( + ErrSample = sdkerrors.Register(ModuleName, 1100, "sample error") +) diff --git a/x/burn/types/expected_keepers.go b/x/burn/types/expected_keepers.go new file mode 100644 index 00000000..32d7935d --- /dev/null +++ b/x/burn/types/expected_keepers.go @@ -0,0 +1,20 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/auth/types" +) + +// AccountKeeper defines the expected account keeper used for simulations (noalias) +type AccountKeeper interface { + GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI + // Methods imported from account should be defined here +} + +// BankKeeper defines the expected interface needed to retrieve account balances. +type BankKeeper interface { + SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins + BurnCoins(ctx sdk.Context, burn string, amt sdk.Coins) error + SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error + // Methods imported from bank should be defined here +} diff --git a/x/burn/types/genesis.go b/x/burn/types/genesis.go new file mode 100644 index 00000000..0af9b441 --- /dev/null +++ b/x/burn/types/genesis.go @@ -0,0 +1,24 @@ +package types + +import ( +// this line is used by starport scaffolding # genesis/types/import +) + +// DefaultIndex is the default global index +const DefaultIndex uint64 = 1 + +// DefaultGenesis returns the default genesis state +func DefaultGenesis() *GenesisState { + return &GenesisState{ + // this line is used by starport scaffolding # genesis/types/default + Params: DefaultParams(), + } +} + +// Validate performs basic genesis state validation returning an error upon any +// failure. +func (gs GenesisState) Validate() error { + // this line is used by starport scaffolding # genesis/types/validate + + return gs.Params.Validate() +} diff --git a/x/burn/types/genesis.pb.go b/x/burn/types/genesis.pb.go new file mode 100644 index 00000000..f7d055da --- /dev/null +++ b/x/burn/types/genesis.pb.go @@ -0,0 +1,321 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: bcna/burn/genesis.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// GenesisState defines the burn module's genesis state. +type GenesisState struct { + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` +} + +func (m *GenesisState) Reset() { *m = GenesisState{} } +func (m *GenesisState) String() string { return proto.CompactTextString(m) } +func (*GenesisState) ProtoMessage() {} +func (*GenesisState) Descriptor() ([]byte, []int) { + return fileDescriptor_db3144ddeb8b7a79, []int{0} +} +func (m *GenesisState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GenesisState) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisState.Merge(m, src) +} +func (m *GenesisState) XXX_Size() int { + return m.Size() +} +func (m *GenesisState) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisState.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisState proto.InternalMessageInfo + +func (m *GenesisState) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +func init() { + proto.RegisterType((*GenesisState)(nil), "bcna.burn.GenesisState") +} + +func init() { proto.RegisterFile("bcna/burn/genesis.proto", fileDescriptor_db3144ddeb8b7a79) } + +var fileDescriptor_db3144ddeb8b7a79 = []byte{ + // 193 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4f, 0x4a, 0xce, 0x4b, + 0xd4, 0x4f, 0x2a, 0x2d, 0xca, 0xd3, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, + 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x04, 0x49, 0xe8, 0x81, 0x24, 0xa4, 0x44, 0xd2, 0xf3, 0xd3, 0xf3, + 0xc1, 0xa2, 0xfa, 0x20, 0x16, 0x44, 0x81, 0x94, 0x18, 0x42, 0x67, 0x41, 0x62, 0x51, 0x62, 0x2e, + 0x54, 0xa3, 0x92, 0x3d, 0x17, 0x8f, 0x3b, 0xc4, 0xa4, 0xe0, 0x92, 0xc4, 0x92, 0x54, 0x21, 0x7d, + 0x2e, 0x36, 0x88, 0xbc, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0xb7, 0x91, 0xa0, 0x1e, 0xdc, 0x64, 0xbd, + 0x00, 0xb0, 0x84, 0x13, 0xcb, 0x89, 0x7b, 0xf2, 0x0c, 0x41, 0x50, 0x65, 0x4e, 0xae, 0x27, 0x1e, + 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, + 0x1e, 0xcb, 0x31, 0xdc, 0x78, 0x2c, 0xc7, 0x10, 0xa5, 0x9d, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, + 0x97, 0x9c, 0x9f, 0xab, 0xef, 0x94, 0x59, 0xe2, 0x9c, 0x98, 0x97, 0x97, 0xe8, 0x9e, 0x93, 0x9f, + 0x94, 0x98, 0xa3, 0x0f, 0x76, 0x4c, 0x05, 0xc4, 0x39, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, + 0x60, 0xe7, 0x18, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0xb7, 0x24, 0x39, 0xbd, 0xe2, 0x00, 0x00, + 0x00, +} + +func (m *GenesisState) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GenesisState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { + offset -= sovGenesis(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *GenesisState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovGenesis(uint64(l)) + return n +} + +func sovGenesis(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGenesis(x uint64) (n int) { + return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *GenesisState) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGenesis(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthGenesis + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGenesis + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGenesis + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/burn/types/genesis_test.go b/x/burn/types/genesis_test.go new file mode 100644 index 00000000..d626158c --- /dev/null +++ b/x/burn/types/genesis_test.go @@ -0,0 +1,41 @@ +package types_test + +import ( + "testing" + + "github.com/BitCannaGlobal/bcna/x/burn/types" + "github.com/stretchr/testify/require" +) + +func TestGenesisState_Validate(t *testing.T) { + tests := []struct { + desc string + genState *types.GenesisState + valid bool + }{ + { + desc: "default is valid", + genState: types.DefaultGenesis(), + valid: true, + }, + { + desc: "valid genesis state", + genState: &types.GenesisState{ + + // this line is used by starport scaffolding # types/genesis/validField + }, + valid: true, + }, + // this line is used by starport scaffolding # types/genesis/testcase + } + for _, tc := range tests { + t.Run(tc.desc, func(t *testing.T) { + err := tc.genState.Validate() + if tc.valid { + require.NoError(t, err) + } else { + require.Error(t, err) + } + }) + } +} diff --git a/x/burn/types/keys.go b/x/burn/types/keys.go new file mode 100644 index 00000000..09ad9247 --- /dev/null +++ b/x/burn/types/keys.go @@ -0,0 +1,19 @@ +package types + +const ( + // ModuleName defines the module name + ModuleName = "burn" + + // StoreKey defines the primary module store key + StoreKey = ModuleName + + // RouterKey defines the module's message routing key + RouterKey = ModuleName + + // MemStoreKey defines the in-memory store key + MemStoreKey = "mem_burn" +) + +func KeyPrefix(p string) []byte { + return []byte(p) +} diff --git a/x/burn/types/message_burn_coins_action.go b/x/burn/types/message_burn_coins_action.go new file mode 100644 index 00000000..2e535f23 --- /dev/null +++ b/x/burn/types/message_burn_coins_action.go @@ -0,0 +1,46 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +const TypeMsgBurnCoinsAction = "burn_coins_action" + +var _ sdk.Msg = &MsgBurnCoinsAction{} + +func NewMsgBurnCoinsAction(creator string, coins sdk.Coins) *MsgBurnCoinsAction { + return &MsgBurnCoinsAction{ + Creator: creator, + Coins: coins, + } +} + +func (msg *MsgBurnCoinsAction) Route() string { + return RouterKey +} + +func (msg *MsgBurnCoinsAction) Type() string { + return TypeMsgBurnCoinsAction +} + +func (msg *MsgBurnCoinsAction) GetSigners() []sdk.AccAddress { + creator, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + panic(err) + } + return []sdk.AccAddress{creator} +} + +func (msg *MsgBurnCoinsAction) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) +} + +func (msg *MsgBurnCoinsAction) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + } + return nil +} diff --git a/x/burn/types/message_burn_coins_action_test.go b/x/burn/types/message_burn_coins_action_test.go new file mode 100644 index 00000000..a40317ed --- /dev/null +++ b/x/burn/types/message_burn_coins_action_test.go @@ -0,0 +1,40 @@ +package types + +import ( + "testing" + + "github.com/BitCannaGlobal/bcna/testutil/sample" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/stretchr/testify/require" +) + +func TestMsgBurnCoinsAction_ValidateBasic(t *testing.T) { + tests := []struct { + name string + msg MsgBurnCoinsAction + err error + }{ + { + name: "invalid address", + msg: MsgBurnCoinsAction{ + Creator: "invalid_address", + }, + err: sdkerrors.ErrInvalidAddress, + }, { + name: "valid address", + msg: MsgBurnCoinsAction{ + Creator: sample.AccAddress(), + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := tt.msg.ValidateBasic() + if tt.err != nil { + require.ErrorIs(t, err, tt.err) + return + } + require.NoError(t, err) + }) + } +} diff --git a/x/burn/types/params.go b/x/burn/types/params.go new file mode 100644 index 00000000..357196ad --- /dev/null +++ b/x/burn/types/params.go @@ -0,0 +1,39 @@ +package types + +import ( + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + "gopkg.in/yaml.v2" +) + +var _ paramtypes.ParamSet = (*Params)(nil) + +// ParamKeyTable the param key table for launch module +func ParamKeyTable() paramtypes.KeyTable { + return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) +} + +// NewParams creates a new Params instance +func NewParams() Params { + return Params{} +} + +// DefaultParams returns a default set of parameters +func DefaultParams() Params { + return NewParams() +} + +// ParamSetPairs get the params.ParamSet +func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { + return paramtypes.ParamSetPairs{} +} + +// Validate validates the set of params +func (p Params) Validate() error { + return nil +} + +// String implements the Stringer interface. +func (p Params) String() string { + out, _ := yaml.Marshal(p) + return string(out) +} diff --git a/x/burn/types/params.pb.go b/x/burn/types/params.pb.go new file mode 100644 index 00000000..4a71eb5e --- /dev/null +++ b/x/burn/types/params.pb.go @@ -0,0 +1,264 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: bcna/burn/params.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// Params defines the parameters for the module. +type Params struct { +} + +func (m *Params) Reset() { *m = Params{} } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_93e0b1c02465615e, []int{0} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +func init() { + proto.RegisterType((*Params)(nil), "bcna.burn.Params") +} + +func init() { proto.RegisterFile("bcna/burn/params.proto", fileDescriptor_93e0b1c02465615e) } + +var fileDescriptor_93e0b1c02465615e = []byte{ + // 152 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4b, 0x4a, 0xce, 0x4b, + 0xd4, 0x4f, 0x2a, 0x2d, 0xca, 0xd3, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, 0x2b, 0x28, 0xca, + 0x2f, 0xc9, 0x17, 0xe2, 0x04, 0x89, 0xeb, 0x81, 0xc4, 0xa5, 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, + 0xa2, 0xfa, 0x20, 0x16, 0x44, 0x81, 0x12, 0x1f, 0x17, 0x5b, 0x00, 0x58, 0x83, 0x15, 0xcb, 0x8c, + 0x05, 0xf2, 0x0c, 0x4e, 0xae, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, + 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, 0xdc, 0x78, 0x2c, 0xc7, 0x10, 0xa5, + 0x9d, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, 0xef, 0x94, 0x59, 0xe2, 0x9c, + 0x98, 0x97, 0x97, 0xe8, 0x9e, 0x93, 0x9f, 0x94, 0x98, 0xa3, 0x0f, 0xb6, 0xbc, 0x02, 0x62, 0x7d, + 0x49, 0x65, 0x41, 0x6a, 0x71, 0x12, 0x1b, 0xd8, 0x74, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, + 0x8f, 0x08, 0x19, 0xb2, 0x98, 0x00, 0x00, 0x00, +} + +func (m *Params) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintParams(dAtA []byte, offset int, v uint64) int { + offset -= sovParams(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovParams(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozParams(x uint64) (n int) { + return sovParams(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Params) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipParams(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthParams + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipParams(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowParams + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowParams + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowParams + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthParams + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupParams + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthParams + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthParams = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowParams = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/burn/types/query.pb.go b/x/burn/types/query.pb.go new file mode 100644 index 00000000..795ecbd5 --- /dev/null +++ b/x/burn/types/query.pb.go @@ -0,0 +1,537 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: bcna/burn/query.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/cosmos/cosmos-sdk/types/query" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// QueryParamsRequest is request type for the Query/Params RPC method. +type QueryParamsRequest struct { +} + +func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } +func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryParamsRequest) ProtoMessage() {} +func (*QueryParamsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_c3bb5397a0397ca1, []int{0} +} +func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsRequest.Merge(m, src) +} +func (m *QueryParamsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo + +// QueryParamsResponse is response type for the Query/Params RPC method. +type QueryParamsResponse struct { + // params holds all the parameters of this module. + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` +} + +func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } +func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryParamsResponse) ProtoMessage() {} +func (*QueryParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_c3bb5397a0397ca1, []int{1} +} +func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsResponse.Merge(m, src) +} +func (m *QueryParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo + +func (m *QueryParamsResponse) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +func init() { + proto.RegisterType((*QueryParamsRequest)(nil), "bcna.burn.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "bcna.burn.QueryParamsResponse") +} + +func init() { proto.RegisterFile("bcna/burn/query.proto", fileDescriptor_c3bb5397a0397ca1) } + +var fileDescriptor_c3bb5397a0397ca1 = []byte{ + // 296 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x90, 0xcf, 0x4a, 0xc3, 0x40, + 0x10, 0xc6, 0x13, 0xd1, 0x82, 0xeb, 0xc9, 0xb5, 0x8a, 0x14, 0x5d, 0x4b, 0x4e, 0x45, 0x21, 0x4b, + 0xeb, 0x1b, 0x54, 0xd4, 0xab, 0xf6, 0xe8, 0x6d, 0xb6, 0x2c, 0x6b, 0xa0, 0xd9, 0xd9, 0x64, 0x37, + 0x62, 0x3d, 0xfa, 0x04, 0x82, 0x2f, 0xd5, 0x63, 0xc1, 0x8b, 0x27, 0x91, 0xc4, 0x07, 0x91, 0x64, + 0x83, 0xff, 0xbd, 0x85, 0x6f, 0x7e, 0xdf, 0x2f, 0x33, 0x4b, 0xb6, 0xc5, 0x54, 0x03, 0x17, 0x45, + 0xae, 0x79, 0x56, 0xc8, 0x7c, 0x1e, 0x9b, 0x1c, 0x1d, 0xd2, 0xf5, 0x3a, 0x8e, 0xeb, 0xb8, 0xd7, + 0x55, 0xa8, 0xb0, 0x49, 0x79, 0xfd, 0xe5, 0x81, 0xde, 0x9e, 0x42, 0x54, 0x33, 0xc9, 0xc1, 0x24, + 0x1c, 0xb4, 0x46, 0x07, 0x2e, 0x41, 0x6d, 0xdb, 0xe9, 0xe1, 0x14, 0x6d, 0x8a, 0x96, 0x0b, 0xb0, + 0xd2, 0x7b, 0xf9, 0xcd, 0x50, 0x48, 0x07, 0x43, 0x6e, 0x40, 0x25, 0xba, 0x81, 0x5b, 0x76, 0xe7, + 0x73, 0x03, 0x03, 0x39, 0xa4, 0xad, 0x23, 0xea, 0x12, 0x7a, 0x59, 0x37, 0x2f, 0x9a, 0x70, 0x22, + 0xb3, 0x42, 0x5a, 0x17, 0x9d, 0x91, 0xad, 0x6f, 0xa9, 0x35, 0xa8, 0xad, 0xa4, 0x9c, 0x74, 0x7c, + 0x79, 0x37, 0xec, 0x87, 0x83, 0x8d, 0xd1, 0x66, 0xfc, 0x71, 0x40, 0xec, 0xd1, 0xf1, 0xea, 0xe2, + 0xe5, 0x20, 0x98, 0xb4, 0xd8, 0xe8, 0x8e, 0xac, 0x35, 0x1e, 0x9a, 0x91, 0x8e, 0x07, 0xe8, 0xfe, + 0x97, 0xce, 0xef, 0x3f, 0xf7, 0xd8, 0x7f, 0x63, 0xbf, 0x42, 0x34, 0xb8, 0x7f, 0x7a, 0x7b, 0x5c, + 0x89, 0x68, 0x9f, 0x8f, 0x13, 0x77, 0x02, 0x5a, 0xc3, 0xf9, 0x0c, 0x05, 0xcc, 0xf8, 0xcf, 0xfb, + 0xc6, 0xa7, 0x8b, 0x92, 0x85, 0xcb, 0x92, 0x85, 0xaf, 0x25, 0x0b, 0x1f, 0x2a, 0x16, 0x2c, 0x2b, + 0x16, 0x3c, 0x57, 0x2c, 0xb8, 0x3a, 0x52, 0x89, 0xbb, 0x2e, 0x44, 0x3c, 0xc5, 0xf4, 0x4f, 0xcb, + 0xad, 0xf7, 0xb8, 0xb9, 0x91, 0x56, 0x74, 0x9a, 0x77, 0x3a, 0x7e, 0x0f, 0x00, 0x00, 0xff, 0xff, + 0xce, 0xdf, 0x48, 0x1a, 0xc3, 0x01, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// QueryClient is the client API for Query service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type QueryClient interface { + // Parameters queries the parameters of the module. + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, "/bcna.burn.Query/Params", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // Parameters queries the parameters of the module. + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryParamsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Params(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/bcna.burn.Query/Params", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "bcna.burn.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "bcna/burn/query.proto", +} + +func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipQuery(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthQuery + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupQuery + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthQuery + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/burn/types/query.pb.gw.go b/x/burn/types/query.pb.gw.go new file mode 100644 index 00000000..f89777f6 --- /dev/null +++ b/x/burn/types/query.pb.gw.go @@ -0,0 +1,153 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: bcna/burn/query.proto + +/* +Package types is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package types + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/descriptor" + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage +var _ = metadata.Join + +func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := server.Params(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". +// UnaryRPC :call QueryServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterQueryHandler(ctx, mux, conn) +} + +// RegisterQueryHandler registers the http handlers for service Query to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) +} + +// RegisterQueryHandlerClient registers the http handlers for service Query +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "QueryClient" to call the correct interceptors. +func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"BitCannaGlobal", "bcna", "burn", "params"}, "", runtime.AssumeColonVerbOpt(true))) +) + +var ( + forward_Query_Params_0 = runtime.ForwardResponseMessage +) diff --git a/x/burn/types/tx.pb.go b/x/burn/types/tx.pb.go new file mode 100644 index 00000000..389b01ad --- /dev/null +++ b/x/burn/types/tx.pb.go @@ -0,0 +1,590 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: bcna/burn/tx.proto + +package types + +import ( + context "context" + fmt "fmt" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type MsgBurnCoinsAction struct { + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + Coins []types.Coin `protobuf:"bytes,2,rep,name=coins,proto3" json:"coins"` +} + +func (m *MsgBurnCoinsAction) Reset() { *m = MsgBurnCoinsAction{} } +func (m *MsgBurnCoinsAction) String() string { return proto.CompactTextString(m) } +func (*MsgBurnCoinsAction) ProtoMessage() {} +func (*MsgBurnCoinsAction) Descriptor() ([]byte, []int) { + return fileDescriptor_7b8a0e462b5fa7e6, []int{0} +} +func (m *MsgBurnCoinsAction) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgBurnCoinsAction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgBurnCoinsAction.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgBurnCoinsAction) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgBurnCoinsAction.Merge(m, src) +} +func (m *MsgBurnCoinsAction) XXX_Size() int { + return m.Size() +} +func (m *MsgBurnCoinsAction) XXX_DiscardUnknown() { + xxx_messageInfo_MsgBurnCoinsAction.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgBurnCoinsAction proto.InternalMessageInfo + +func (m *MsgBurnCoinsAction) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +func (m *MsgBurnCoinsAction) GetCoins() []types.Coin { + if m != nil { + return m.Coins + } + return nil +} + +type MsgBurnCoinsActionResponse struct { +} + +func (m *MsgBurnCoinsActionResponse) Reset() { *m = MsgBurnCoinsActionResponse{} } +func (m *MsgBurnCoinsActionResponse) String() string { return proto.CompactTextString(m) } +func (*MsgBurnCoinsActionResponse) ProtoMessage() {} +func (*MsgBurnCoinsActionResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_7b8a0e462b5fa7e6, []int{1} +} +func (m *MsgBurnCoinsActionResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgBurnCoinsActionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgBurnCoinsActionResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgBurnCoinsActionResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgBurnCoinsActionResponse.Merge(m, src) +} +func (m *MsgBurnCoinsActionResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgBurnCoinsActionResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgBurnCoinsActionResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgBurnCoinsActionResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgBurnCoinsAction)(nil), "bcna.burn.MsgBurnCoinsAction") + proto.RegisterType((*MsgBurnCoinsActionResponse)(nil), "bcna.burn.MsgBurnCoinsActionResponse") +} + +func init() { proto.RegisterFile("bcna/burn/tx.proto", fileDescriptor_7b8a0e462b5fa7e6) } + +var fileDescriptor_7b8a0e462b5fa7e6 = []byte{ + // 281 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x90, 0x4f, 0x4b, 0xc3, 0x30, + 0x18, 0xc6, 0x5b, 0xe7, 0x1f, 0x16, 0x0f, 0x42, 0xf0, 0x50, 0x8b, 0xc6, 0x31, 0x10, 0x06, 0x42, + 0xc2, 0x26, 0x7e, 0x00, 0x3b, 0xc4, 0xd3, 0x2e, 0xbd, 0x08, 0x1e, 0x84, 0x24, 0x84, 0x5a, 0xd8, + 0xf2, 0x96, 0xbe, 0xa9, 0xcc, 0x6f, 0xe1, 0xc7, 0xda, 0x71, 0x47, 0x4f, 0x22, 0xed, 0x17, 0x91, + 0xb4, 0x9b, 0x07, 0x07, 0xbb, 0x25, 0xcf, 0xf3, 0xe4, 0x97, 0xf7, 0x7d, 0x08, 0x55, 0xda, 0x4a, + 0xa1, 0xaa, 0xd2, 0x0a, 0xb7, 0xe4, 0x45, 0x09, 0x0e, 0x68, 0xdf, 0x6b, 0xdc, 0x6b, 0xf1, 0x79, + 0x06, 0x19, 0xb4, 0xaa, 0xf0, 0xa7, 0x2e, 0x10, 0x33, 0x0d, 0xb8, 0x00, 0x14, 0x4a, 0xa2, 0x11, + 0xef, 0x63, 0x65, 0x9c, 0x1c, 0x0b, 0x0d, 0xb9, 0xed, 0xfc, 0xa1, 0x21, 0x74, 0x86, 0x59, 0x52, + 0x95, 0x76, 0x0a, 0xb9, 0xc5, 0x07, 0xed, 0x72, 0xb0, 0x34, 0x22, 0x27, 0xba, 0x34, 0xd2, 0x41, + 0x19, 0x85, 0x83, 0x70, 0xd4, 0x4f, 0xb7, 0x57, 0x7a, 0x4f, 0x8e, 0xfc, 0x6b, 0x8c, 0x0e, 0x06, + 0xbd, 0xd1, 0xe9, 0xe4, 0x82, 0x77, 0x7c, 0xee, 0xf9, 0x7c, 0xc3, 0xe7, 0x1e, 0x95, 0x1c, 0xae, + 0xbe, 0xaf, 0x83, 0xb4, 0x4b, 0x0f, 0x2f, 0x49, 0xbc, 0xfb, 0x4d, 0x6a, 0xb0, 0x00, 0x8b, 0x66, + 0xf2, 0x4a, 0x7a, 0x33, 0xcc, 0xe8, 0x33, 0x39, 0xfb, 0x3f, 0xc8, 0x15, 0xff, 0x5b, 0x90, 0xef, + 0x02, 0xe2, 0x9b, 0xbd, 0xf6, 0x96, 0x9f, 0x3c, 0xae, 0x6a, 0x16, 0xae, 0x6b, 0x16, 0xfe, 0xd4, + 0x2c, 0xfc, 0x6c, 0x58, 0xb0, 0x6e, 0x58, 0xf0, 0xd5, 0xb0, 0xe0, 0xe5, 0x36, 0xcb, 0xdd, 0x5b, + 0xa5, 0xb8, 0x86, 0x85, 0x48, 0x72, 0x37, 0x95, 0xd6, 0xca, 0xa7, 0x39, 0x28, 0x39, 0x17, 0x6d, + 0xdb, 0xcb, 0x4d, 0xdf, 0x1f, 0x85, 0x41, 0x75, 0xdc, 0x56, 0x76, 0xf7, 0x1b, 0x00, 0x00, 0xff, + 0xff, 0x6b, 0x2b, 0xe4, 0xa4, 0x89, 0x01, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// MsgClient is the client API for Msg service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type MsgClient interface { + BurnCoinsAction(ctx context.Context, in *MsgBurnCoinsAction, opts ...grpc.CallOption) (*MsgBurnCoinsActionResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) BurnCoinsAction(ctx context.Context, in *MsgBurnCoinsAction, opts ...grpc.CallOption) (*MsgBurnCoinsActionResponse, error) { + out := new(MsgBurnCoinsActionResponse) + err := c.cc.Invoke(ctx, "/bcna.burn.Msg/BurnCoinsAction", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + BurnCoinsAction(context.Context, *MsgBurnCoinsAction) (*MsgBurnCoinsActionResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) BurnCoinsAction(ctx context.Context, req *MsgBurnCoinsAction) (*MsgBurnCoinsActionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method BurnCoinsAction not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_BurnCoinsAction_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgBurnCoinsAction) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).BurnCoinsAction(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/bcna.burn.Msg/BurnCoinsAction", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).BurnCoinsAction(ctx, req.(*MsgBurnCoinsAction)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "bcna.burn.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "BurnCoinsAction", + Handler: _Msg_BurnCoinsAction_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "bcna/burn/tx.proto", +} + +func (m *MsgBurnCoinsAction) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgBurnCoinsAction) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgBurnCoinsAction) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Coins) > 0 { + for iNdEx := len(m.Coins) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Coins[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgBurnCoinsActionResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgBurnCoinsActionResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgBurnCoinsActionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgBurnCoinsAction) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.Coins) > 0 { + for _, e := range m.Coins { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + return n +} + +func (m *MsgBurnCoinsActionResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgBurnCoinsAction) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgBurnCoinsAction: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgBurnCoinsAction: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Creator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Coins", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Coins = append(m.Coins, types.Coin{}) + if err := m.Coins[len(m.Coins)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgBurnCoinsActionResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgBurnCoinsActionResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgBurnCoinsActionResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTx(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTx + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTx + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTx + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/burn/types/types.go b/x/burn/types/types.go new file mode 100644 index 00000000..ab1254f4 --- /dev/null +++ b/x/burn/types/types.go @@ -0,0 +1 @@ +package types From 0aa8b34c0f5cdfb3c1599e4b17ef920fa09a98c2 Mon Sep 17 00:00:00 2001 From: Raul Bernal Date: Mon, 11 Mar 2024 12:40:37 +0100 Subject: [PATCH 02/37] LINT Error: const `listSeparator` is unused (unused) --- x/burn/client/cli/tx.go | 1 - 1 file changed, 1 deletion(-) diff --git a/x/burn/client/cli/tx.go b/x/burn/client/cli/tx.go index 261861c8..455f9afd 100644 --- a/x/burn/client/cli/tx.go +++ b/x/burn/client/cli/tx.go @@ -17,7 +17,6 @@ var ( const ( flagPacketTimeoutTimestamp = "packet-timeout-timestamp" - listSeparator = "," ) // GetTxCmd returns the transaction commands for this module From e0bc150ca0d2328d790644f1ff1beba8e70f89d0 Mon Sep 17 00:00:00 2001 From: Raul Bernal Date: Mon, 11 Mar 2024 12:41:30 +0100 Subject: [PATCH 03/37] LINT Error: const `flagPacketTimeoutTimestamp` is unused (unused) --- x/burn/client/cli/tx.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/x/burn/client/cli/tx.go b/x/burn/client/cli/tx.go index 455f9afd..ed7ad272 100644 --- a/x/burn/client/cli/tx.go +++ b/x/burn/client/cli/tx.go @@ -15,10 +15,6 @@ var ( DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) ) -const ( - flagPacketTimeoutTimestamp = "packet-timeout-timestamp" -) - // GetTxCmd returns the transaction commands for this module func GetTxCmd() *cobra.Command { cmd := &cobra.Command{ From a85d9761e00c2269543a6718af11d95dda2970a4 Mon Sep 17 00:00:00 2001 From: Raul Bernal Date: Mon, 11 Mar 2024 12:42:57 +0100 Subject: [PATCH 04/37] LINT bypass: Error return value of `types.RegisterQueryHandlerClient` is not checked (errcheck) --- x/burn/module.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/x/burn/module.go b/x/burn/module.go index e52cf94d..4907427c 100644 --- a/x/burn/module.go +++ b/x/burn/module.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "fmt" + // this line is used by starport scaffolding # 1 "github.com/grpc-ecosystem/grpc-gateway/runtime" @@ -70,7 +71,7 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncod // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { - types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)) + types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)) //nolint } // GetTxCmd returns the root Tx command for the module. The subcommands of this root command are used by end-users to generate new transactions containing messages defined in the module From c28c20c0bc288ffdf72fff66e1bd2594e75fe84c Mon Sep 17 00:00:00 2001 From: Raul Bernal Date: Mon, 11 Mar 2024 12:45:09 +0100 Subject: [PATCH 05/37] LINT Error: SA1019: simtypes.WeightedProposalContent is deprecated: Use WeightedProposalMsg instead. --- x/burn/module_simulation.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/burn/module_simulation.go b/x/burn/module_simulation.go index 33557468..e4ac724f 100644 --- a/x/burn/module_simulation.go +++ b/x/burn/module_simulation.go @@ -47,7 +47,7 @@ func (AppModule) GenerateGenesisState(simState *module.SimulationState) { func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) {} // ProposalContents doesn't return any content functions for governance proposals. -func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { +func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalMsg { return nil } From c66439f9dba1fa309f8de3f1d01010e2d313a6d7 Mon Sep 17 00:00:00 2001 From: Raul Bernal Date: Mon, 11 Mar 2024 12:48:12 +0100 Subject: [PATCH 06/37] LINT Error: SA1019: sdkerrors.Register is deprecated --- x/burn/types/errors.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x/burn/types/errors.go b/x/burn/types/errors.go index b9ba77f0..7a408807 100644 --- a/x/burn/types/errors.go +++ b/x/burn/types/errors.go @@ -3,10 +3,10 @@ package types // DONTCOVER import ( - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + sdkioerrors "cosmossdk.io/errors" ) // x/burn module sentinel errors var ( - ErrSample = sdkerrors.Register(ModuleName, 1100, "sample error") + ErrSample = sdkioerrors.Register(ModuleName, 1101, "Custom error") ) From 977260ee8aa9ddec3b094034e66b63601afa8374 Mon Sep 17 00:00:00 2001 From: Raul Bernal Date: Mon, 11 Mar 2024 12:48:26 +0100 Subject: [PATCH 07/37] Fix typo --- x/bcna/types/errors.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/bcna/types/errors.go b/x/bcna/types/errors.go index 7e00ca90..9763ec19 100644 --- a/x/bcna/types/errors.go +++ b/x/bcna/types/errors.go @@ -9,7 +9,7 @@ var ( ErrDuplicateBitcannaid = sdkioerrors.Register(ModuleName, 1101, "BitCannaID already exists") ErrKeyNotFound = sdkioerrors.Register(ModuleName, 1102, "Key doesn't exists") ErrUnauthorized = sdkioerrors.Register(ModuleName, 1103, "Incorrect owner") - ErrUnrecognized = sdkioerrors.Register(ModuleName, 1104, "Unrecognized messager") + ErrUnrecognized = sdkioerrors.Register(ModuleName, 1104, "Unrecognized message") ErrInvalidAddress = sdkioerrors.Register(ModuleName, 1105, "invalid address") ErrMaxCharacters = sdkioerrors.Register(ModuleName, 1106, "input exceeds the permitted length limit") ) From 8f27cdb080c8423cdcfd15961eb3493834c12941 Mon Sep 17 00:00:00 2001 From: Raul Bernal Date: Mon, 11 Mar 2024 12:52:46 +0100 Subject: [PATCH 08/37] LINT Error: SA1019: sdkerrors.Wrapf is deprecated: --- x/burn/types/message_burn_coins_action.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/x/burn/types/message_burn_coins_action.go b/x/burn/types/message_burn_coins_action.go index 2e535f23..f5c700e8 100644 --- a/x/burn/types/message_burn_coins_action.go +++ b/x/burn/types/message_burn_coins_action.go @@ -1,8 +1,10 @@ package types import ( + "errors" + "fmt" + sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) const TypeMsgBurnCoinsAction = "burn_coins_action" @@ -40,7 +42,7 @@ func (msg *MsgBurnCoinsAction) GetSignBytes() []byte { func (msg *MsgBurnCoinsAction) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + return fmt.Errorf("invalid creator address: %v: %w", err, errors.New("invalid address")) } return nil } From 3157592b08e1492f3aea41d95e1c09517636386e Mon Sep 17 00:00:00 2001 From: Raul Bernal Date: Tue, 12 Mar 2024 11:29:02 +0100 Subject: [PATCH 09/37] Add some controls to burn & starting test --- release/release_checksum | 1 + x/burn/keeper/msg_server_burn_coins_action.go | 23 +++++++++++++++++-- x/burn/types/expected_keepers.go | 1 + .../types/message_burn_coins_action_test.go | 5 +++- 4 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 release/release_checksum diff --git a/release/release_checksum b/release/release_checksum new file mode 100644 index 00000000..733cd7c0 --- /dev/null +++ b/release/release_checksum @@ -0,0 +1 @@ +1bf25f7a95437ccbb26e034593b9eebfeadddad852720d2c81acf763e5478b29 bcna_linux_amd64.tar.gz diff --git a/x/burn/keeper/msg_server_burn_coins_action.go b/x/burn/keeper/msg_server_burn_coins_action.go index b8558faa..3943cb7a 100644 --- a/x/burn/keeper/msg_server_burn_coins_action.go +++ b/x/burn/keeper/msg_server_burn_coins_action.go @@ -2,18 +2,37 @@ package keeper import ( "context" + "fmt" "github.com/BitCannaGlobal/bcna/x/burn/types" sdk "github.com/cosmos/cosmos-sdk/types" ) -// Burn msg.Coins from msg.Creator balances +// Move coins from sender to Bank account module and then the module burns the coins. func (k msgServer) BurnCoinsAction(goCtx context.Context, msg *types.MsgBurnCoinsAction) (*types.MsgBurnCoinsActionResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) creatorAddr, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return nil, err + return nil, fmt.Errorf("the address is not valid") + } + + // Check nulls and valid amounts + if msg.Coins == nil || len(msg.Coins) == 0 { + return nil, fmt.Errorf("no coins specified or the amount is not valid") + } + for _, coin := range msg.Coins { + if coin.Amount.LTE(sdk.ZeroInt()) { // Comprueba si la cantidad es menor o igual a cero. + return nil, fmt.Errorf("invalid amount for coin %s, amount must be positive", coin.Denom) + } + } + + // Gets the balance of the sender to check if are there enough coins. + for _, coin := range msg.Coins { + balance := k.bankKeeper.GetBalance(ctx, creatorAddr, coin.Denom) + if balance.Amount.LT(coin.Amount) { + return nil, fmt.Errorf("insufficient balance for coin %s", coin.Denom) + } } if err := k.bankKeeper.SendCoinsFromAccountToModule(ctx, creatorAddr, types.ModuleName, msg.Coins); err != nil { diff --git a/x/burn/types/expected_keepers.go b/x/burn/types/expected_keepers.go index 32d7935d..d16e9654 100644 --- a/x/burn/types/expected_keepers.go +++ b/x/burn/types/expected_keepers.go @@ -16,5 +16,6 @@ type BankKeeper interface { SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins BurnCoins(ctx sdk.Context, burn string, amt sdk.Coins) error SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error + GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin // Methods imported from bank should be defined here } diff --git a/x/burn/types/message_burn_coins_action_test.go b/x/burn/types/message_burn_coins_action_test.go index a40317ed..b1e0b534 100644 --- a/x/burn/types/message_burn_coins_action_test.go +++ b/x/burn/types/message_burn_coins_action_test.go @@ -4,6 +4,7 @@ import ( "testing" "github.com/BitCannaGlobal/bcna/testutil/sample" + sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" ) @@ -18,12 +19,14 @@ func TestMsgBurnCoinsAction_ValidateBasic(t *testing.T) { name: "invalid address", msg: MsgBurnCoinsAction{ Creator: "invalid_address", + Coins: sdk.Coins{sdk.NewInt64Coin("testcoin", 1000)}, }, err: sdkerrors.ErrInvalidAddress, }, { name: "valid address", msg: MsgBurnCoinsAction{ Creator: sample.AccAddress(), + Coins: sdk.Coins{sdk.NewInt64Coin("testcoin", 1000)}, }, }, } @@ -31,7 +34,7 @@ func TestMsgBurnCoinsAction_ValidateBasic(t *testing.T) { t.Run(tt.name, func(t *testing.T) { err := tt.msg.ValidateBasic() if tt.err != nil { - require.ErrorIs(t, err, tt.err) + require.Contains(t, err.Error(), tt.err.Error()) return } require.NoError(t, err) From bc1d979a8ea1c59b5e1b650c34b6f2f218b5824e Mon Sep 17 00:00:00 2001 From: Raul Bernal Date: Tue, 12 Mar 2024 11:29:56 +0100 Subject: [PATCH 10/37] git ignore changes --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 1cbfc61b..da7c179c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ config.yml .DS_Store ts-client/* +release/* From c198584de66f8ad0d9101f454c1d6f209a0e8289 Mon Sep 17 00:00:00 2001 From: Raul Bernal Date: Wed, 13 Mar 2024 09:24:03 +0100 Subject: [PATCH 11/37] module account permissions fixed for burn --- .gitignore | 1 + app/app.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index da7c179c..f18ea91b 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ config.yml .DS_Store ts-client/* release/* + diff --git a/app/app.go b/app/app.go index 66fe2cb0..f530b1a5 100644 --- a/app/app.go +++ b/app/app.go @@ -192,7 +192,7 @@ var ( stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, govtypes.ModuleName: {authtypes.Burner}, ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, - burnmoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner, authtypes.Staking}, + burnmoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner}, // nft.ModuleName: nil, } ) From ee6150881f789f7663c4e7582a15d04004e56d7a Mon Sep 17 00:00:00 2001 From: Raul Bernal Date: Thu, 14 Mar 2024 11:34:25 +0100 Subject: [PATCH 12/37] Fix init messages from v46>v47 upgrade --- app/upgrades.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/upgrades.go b/app/upgrades.go index fb7bbb85..7b4fad29 100644 --- a/app/upgrades.go +++ b/app/upgrades.go @@ -24,6 +24,7 @@ import ( upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" bcnamoduletypes "github.com/BitCannaGlobal/bcna/x/bcna/types" + burnmoduletypes "github.com/BitCannaGlobal/bcna/x/burn/types" icacontrollertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types" icahosttypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types" @@ -101,6 +102,11 @@ func (app *App) GanjaRevolution47(_ upgradetypes.Plan) { keyTable = bcnamoduletypes.ParamKeyTable() //nolint:staticcheck keyTableAssigned = true + // BurnModule types + case burnmoduletypes.ModuleName: + keyTable = bcnamoduletypes.ParamKeyTable() //nolint:staticcheck + keyTableAssigned = true + // Debug: default: fmt.Println("No matching subspace found:", subspace.Name()) From 15cb1f4dfbfcdfa9b90e1226f40843f7d4275b5b Mon Sep 17 00:00:00 2001 From: Raul Bernal Date: Thu, 14 Mar 2024 12:35:30 +0100 Subject: [PATCH 13/37] Upgrade handler for to add x/burn module --- app/upgrades.go | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/app/upgrades.go b/app/upgrades.go index 7b4fad29..cb3f4a71 100644 --- a/app/upgrades.go +++ b/app/upgrades.go @@ -46,9 +46,47 @@ func (app App) RegisterUpgradeHandlers() { } app.GanjaRevolution47(upgradeInfo) + app.GanjaRevolution47_burn(upgradeInfo) } +func (app *App) GanjaRevolution47_burn(_ upgradetypes.Plan) { + planName := "ganjarevolutionburn" + app.UpgradeKeeper.SetUpgradeHandler(planName, func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { + ctx.Logger().Info("start to run module migrations...adding x/burn module...") + logger := ctx.Logger().With("upgrade", planName) + + // Run migrations + logger.Info(fmt.Sprintf("pre migrate version map: %v", fromVM)) + versionMap, err := app.mm.RunMigrations(ctx, app.configurator, fromVM) + if err != nil { + return nil, err + } + logger.Info(fmt.Sprintf("post migrate version map: %v", versionMap)) + + return versionMap, err + // return app.mm.RunMigrations(ctx, app.configurator, fromVM) + }) + + upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk() + if err != nil { + panic(err) + } + + if upgradeInfo.Name == planName && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) { + storeUpgrades := storetypes.StoreUpgrades{ + Added: []string{ + + burnmoduletypes.ModuleName, + // nft.ModuleName, + }, + } + + // Configure store loader that checks if version == upgradeHeight and applies store upgrades + app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades)) + } +} + func (app *App) GanjaRevolution47(_ upgradetypes.Plan) { planName := "GanjaRevolution" // Set param key table for params module migration From ce2d6886bff5411bf2cd60b98db8a29a2732d2c3 Mon Sep 17 00:00:00 2001 From: Raul Bernal Date: Fri, 15 Mar 2024 10:35:38 +0100 Subject: [PATCH 14/37] Remove v046>v047 upgrade code --- app/upgrades.go | 165 ------------------------------------------------ 1 file changed, 165 deletions(-) diff --git a/app/upgrades.go b/app/upgrades.go index cb3f4a71..06d0cd72 100644 --- a/app/upgrades.go +++ b/app/upgrades.go @@ -6,33 +6,9 @@ import ( storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" - - // v047 migration - "github.com/cosmos/cosmos-sdk/baseapp" - - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - consensustypes "github.com/cosmos/cosmos-sdk/x/consensus/types" - crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" - distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" - minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" - paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" - slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - bcnamoduletypes "github.com/BitCannaGlobal/bcna/x/bcna/types" burnmoduletypes "github.com/BitCannaGlobal/bcna/x/burn/types" - - icacontrollertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types" - icahosttypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types" - ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" - - // "github.com/cosmos/cosmos-sdk/x/nft" - ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported" - ibctmmigrations "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint/migrations" ) var keyTableAssigned = false @@ -45,7 +21,6 @@ func (app App) RegisterUpgradeHandlers() { panic(err) } - app.GanjaRevolution47(upgradeInfo) app.GanjaRevolution47_burn(upgradeInfo) } @@ -87,144 +62,4 @@ func (app *App) GanjaRevolution47_burn(_ upgradetypes.Plan) { } } -func (app *App) GanjaRevolution47(_ upgradetypes.Plan) { - planName := "GanjaRevolution" - // Set param key table for params module migration - for _, subspace := range app.ParamsKeeper.GetSubspaces() { - subspace := subspace - - var keyTable paramstypes.KeyTable - - switch subspace.Name() { - case authtypes.ModuleName: - keyTable = authtypes.ParamKeyTable() //nolint:staticcheck - keyTableAssigned = true - case banktypes.ModuleName: - keyTable = banktypes.ParamKeyTable() //nolint:staticcheck - keyTableAssigned = true - case stakingtypes.ModuleName: - keyTable = stakingtypes.ParamKeyTable() //nolint:staticcheck - keyTableAssigned = true - case minttypes.ModuleName: - keyTable = minttypes.ParamKeyTable() //nolint:staticcheck - keyTableAssigned = true - case distrtypes.ModuleName: - keyTable = distrtypes.ParamKeyTable() //nolint:staticcheck - keyTableAssigned = true - case slashingtypes.ModuleName: - keyTable = slashingtypes.ParamKeyTable() //nolint:staticcheck - keyTableAssigned = true - case govtypes.ModuleName: - keyTable = govv1.ParamKeyTable() //nolint:staticcheck - keyTableAssigned = true - case crisistypes.ModuleName: - keyTable = crisistypes.ParamKeyTable() //nolint:staticcheck - keyTableAssigned = true - - // ibc types - case ibcexported.ModuleName: - keyTable = icacontrollertypes.ParamKeyTable() - keyTableAssigned = true - case ibctransfertypes.ModuleName: - keyTable = ibctransfertypes.ParamKeyTable() - keyTableAssigned = true - case icahosttypes.SubModuleName: - keyTable = icahosttypes.ParamKeyTable() - keyTableAssigned = true - case icacontrollertypes.SubModuleName: - keyTable = icacontrollertypes.ParamKeyTable() - keyTableAssigned = true - - // Bitcanna types - case bcnamoduletypes.ModuleName: - keyTable = bcnamoduletypes.ParamKeyTable() //nolint:staticcheck - keyTableAssigned = true - - // BurnModule types - case burnmoduletypes.ModuleName: - keyTable = bcnamoduletypes.ParamKeyTable() //nolint:staticcheck - keyTableAssigned = true - - // Debug: - default: - fmt.Println("No matching subspace found:", subspace.Name()) - keyTableAssigned = false - } - - if !subspace.HasKeyTable() { - if !keyTableAssigned { - fmt.Println("KeyTable is not assigned for subspace:", subspace.Name()) - } else { - subspace.WithKeyTable(keyTable) - } - } - } - - app.UpgradeKeeper.SetUpgradeHandler(planName, func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { - ctx.Logger().Info("start to run module migrations...") - logger := ctx.Logger().With("upgrade", planName) - - // Migrate Tendermint consensus parameters from x/params module to a dedicated x/consensus module. - baseAppLegacySS := app.ParamsKeeper.Subspace(baseapp.Paramspace).WithKeyTable(paramstypes.ConsensusParamsKeyTable()) - baseapp.MigrateParams(ctx, baseAppLegacySS, &app.ConsensusParamsKeeper) - - // ibc/go v7.0 migration - // OPTIONAL: prune expired tendermint consensus states to save storage space - if _, err := ibctmmigrations.PruneExpiredConsensusStates(ctx, app.appCodec, app.IBCKeeper.ClientKeeper); err != nil { - return nil, err - } - - // https://github.com/cosmos/ibc-go/blob/v7.1.0/docs/migrations/v7-to-v7_1.md - // explicitly update the IBC 02-client params, adding the localhost client type - params := app.IBCKeeper.ClientKeeper.GetParams(ctx) - params.AllowedClients = append(params.AllowedClients, ibcexported.Localhost) - app.IBCKeeper.ClientKeeper.SetParams(ctx, params) - - // Run migrations - logger.Info(fmt.Sprintf("pre migrate version map: %v", fromVM)) - versionMap, err := app.mm.RunMigrations(ctx, app.configurator, fromVM) - if err != nil { - return nil, err - } - logger.Info(fmt.Sprintf("post migrate version map: %v", versionMap)) - - // Update gov params to use a 20% initial deposit ratio, allowing us to remote the ante handler - govParams := app.GovKeeper.GetParams(ctx) - govParams.MinInitialDepositRatio = sdk.NewDec(20).Quo(sdk.NewDec(100)).String() - if err := app.GovKeeper.SetParams(ctx, govParams); err != nil { - return nil, err - } - - // Update x/Staking - set minimum commission to 4,20% 0.042000000000000000 - stakingParams := app.StakingKeeper.GetParams(ctx) - stakingParams.MinCommissionRate = sdk.NewDecWithPrec(420, 4) - err = app.StakingKeeper.SetParams(ctx, stakingParams) - if err != nil { - return nil, err - } - - return versionMap, err - // return app.mm.RunMigrations(ctx, app.configurator, fromVM) - }) - - upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk() - if err != nil { - panic(err) - } - - if upgradeInfo.Name == planName && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) { - storeUpgrades := storetypes.StoreUpgrades{ - Added: []string{ - - consensustypes.ModuleName, - crisistypes.ModuleName, - // nft.ModuleName, - }, - } - - // Configure store loader that checks if version == upgradeHeight and applies store upgrades - app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades)) - } -} - // app.IBCKeeper.ClientKeeper From 4b0d25ad6a9051929219419a857fb11b2eeeab04 Mon Sep 17 00:00:00 2001 From: Raul Bernal Date: Fri, 15 Mar 2024 10:36:37 +0100 Subject: [PATCH 15/37] Log when burn coins is called successfully --- x/burn/keeper/msg_server_burn_coins_action.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/x/burn/keeper/msg_server_burn_coins_action.go b/x/burn/keeper/msg_server_burn_coins_action.go index 3943cb7a..754752ed 100644 --- a/x/burn/keeper/msg_server_burn_coins_action.go +++ b/x/burn/keeper/msg_server_burn_coins_action.go @@ -42,6 +42,8 @@ func (k msgServer) BurnCoinsAction(goCtx context.Context, msg *types.MsgBurnCoin if err := k.bankKeeper.BurnCoins(ctx, types.ModuleName, msg.Coins); err != nil { return nil, err } + // Log the successful burn operation + k.Logger(ctx).Info("Burning coins!! ", "signer", msg.Creator, "amount", msg.Coins) return &types.MsgBurnCoinsActionResponse{}, nil } From 134956652c71480c2a6d569caa16328834a4c253 Mon Sep 17 00:00:00 2001 From: Raul Bernal Date: Fri, 15 Mar 2024 11:06:37 +0100 Subject: [PATCH 16/37] Bump Cosmos-SDK v0.47.9 to v0.47.10 --- go.mod | 6 +++--- go.sum | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index ea54f434..9a3ae47c 100644 --- a/go.mod +++ b/go.mod @@ -6,10 +6,10 @@ require ( cosmossdk.io/api v0.3.1 cosmossdk.io/errors v1.0.1 cosmossdk.io/log v1.3.1 - cosmossdk.io/math v1.2.0 + cosmossdk.io/math v1.3.0 github.com/cometbft/cometbft v0.37.4 github.com/cometbft/cometbft-db v0.11.0 - github.com/cosmos/cosmos-sdk v0.47.9 + github.com/cosmos/cosmos-sdk v0.47.10 github.com/cosmos/gogoproto v1.4.10 github.com/cosmos/ibc-go/v7 v7.3.2 github.com/golang/protobuf v1.5.3 @@ -180,7 +180,7 @@ require ( gopkg.in/yaml.v3 v3.0.1 // indirect nhooyr.io/websocket v1.8.6 // indirect pgregory.net/rapid v1.1.0 // indirect - sigs.k8s.io/yaml v1.3.0 // indirect + sigs.k8s.io/yaml v1.4.0 // indirect ) replace ( diff --git a/go.sum b/go.sum index 8f2d75f6..50ca08c0 100644 --- a/go.sum +++ b/go.sum @@ -197,8 +197,8 @@ cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= cosmossdk.io/log v1.3.1 h1:UZx8nWIkfbbNEWusZqzAx3ZGvu54TZacWib3EzUYmGI= cosmossdk.io/log v1.3.1/go.mod h1:2/dIomt8mKdk6vl3OWJcPk2be3pGOS8OQaLUM/3/tCM= -cosmossdk.io/math v1.2.0 h1:8gudhTkkD3NxOP2YyyJIYYmt6dQ55ZfJkDOaxXpy7Ig= -cosmossdk.io/math v1.2.0/go.mod h1:l2Gnda87F0su8a/7FEKJfFdJrM0JZRXQaohlgJeyQh0= +cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= +cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/tools/rosetta v0.2.1 h1:ddOMatOH+pbxWbrGJKRAawdBkPYLfKXutK9IETnjYxw= cosmossdk.io/tools/rosetta v0.2.1/go.mod h1:Pqdc1FdvkNV3LcNIkYWt2RQY6IP1ge6YWZk8MhhO9Hw= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= @@ -338,8 +338,8 @@ github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= github.com/cosmos/cosmos-proto v1.0.0-beta.4 h1:aEL7tU/rLOmxZQ9z4i7mzxcLbSCY48OdY7lIWTLG7oU= github.com/cosmos/cosmos-proto v1.0.0-beta.4/go.mod h1:oeB+FyVzG3XrQJbJng0EnV8Vljfk9XvTIpGILNU/9Co= -github.com/cosmos/cosmos-sdk v0.47.9 h1:D51VLkF59D53PMLsbNtp6JyWR+6MbetFyomrH88+y08= -github.com/cosmos/cosmos-sdk v0.47.9/go.mod h1:cmAawe8FV/52oPKbgeHLt4UpNkrNu8R5KD+kw0kxJFc= +github.com/cosmos/cosmos-sdk v0.47.10 h1:Wxf5yEN3jZbG4fftxAMKB6rpd8ME0mxuCVihpz65dt0= +github.com/cosmos/cosmos-sdk v0.47.10/go.mod h1:UWpgWkhcsBIATS68uUC0del7IiBN4hPv/vqg8Zz23uw= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= @@ -1687,6 +1687,6 @@ rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8 rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= -sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo= -sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8= +sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= +sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU= From 9f86f1d33393b7d0f1eb8b4679a0f934e2ce19fd Mon Sep 17 00:00:00 2001 From: Raul Bernal Date: Fri, 15 Mar 2024 13:44:48 +0100 Subject: [PATCH 17/37] LINT remove unused var --- app/upgrades.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/app/upgrades.go b/app/upgrades.go index 06d0cd72..e96a9139 100644 --- a/app/upgrades.go +++ b/app/upgrades.go @@ -11,8 +11,6 @@ import ( burnmoduletypes "github.com/BitCannaGlobal/bcna/x/burn/types" ) -var keyTableAssigned = false - // RegisterUpgradeHandlers registers upgrade handlers. func (app App) RegisterUpgradeHandlers() { @@ -61,5 +59,3 @@ func (app *App) GanjaRevolution47_burn(_ upgradetypes.Plan) { app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades)) } } - -// app.IBCKeeper.ClientKeeper From 7fe1154e41ac4f2d2817cac6a398bbce34b93458 Mon Sep 17 00:00:00 2001 From: Raul Bernal Date: Thu, 21 Mar 2024 13:55:01 +0100 Subject: [PATCH 18/37] Add param burn_denom to module --- docs/static/openapi.yml | 12 +++++++ proto/bcna/burn/params.proto | 1 + x/burn/keeper/params.go | 5 +-- x/burn/types/params.go | 49 ++++++++++++++++++++----- x/burn/types/params.pb.go | 69 +++++++++++++++++++++++++++++++----- 5 files changed, 118 insertions(+), 18 deletions(-) diff --git a/docs/static/openapi.yml b/docs/static/openapi.yml index 5e8022e5..aaf88995 100644 --- a/docs/static/openapi.yml +++ b/docs/static/openapi.yml @@ -17,6 +17,10 @@ paths: params: description: params holds all the parameters of this module. type: object + properties: + burn_denom: + type: string + title: denom allowed to be burned description: >- QueryParamsResponse is response type for the Query/Params RPC method. @@ -46923,6 +46927,10 @@ definitions: type: object bcna.burn.Params: type: object + properties: + burn_denom: + type: string + title: denom allowed to be burned description: Params defines the parameters for the module. bcna.burn.QueryParamsResponse: type: object @@ -46930,6 +46938,10 @@ definitions: params: description: params holds all the parameters of this module. type: object + properties: + burn_denom: + type: string + title: denom allowed to be burned description: QueryParamsResponse is response type for the Query/Params RPC method. cosmos.base.v1beta1.Coin: type: object diff --git a/proto/bcna/burn/params.proto b/proto/bcna/burn/params.proto index a4483e81..af588ef4 100644 --- a/proto/bcna/burn/params.proto +++ b/proto/bcna/burn/params.proto @@ -8,5 +8,6 @@ option go_package = "github.com/BitCannaGlobal/bcna/x/burn/types"; // Params defines the parameters for the module. message Params { option (gogoproto.goproto_stringer) = false; + string burn_denom = 1; // denom allowed to be burned } diff --git a/x/burn/keeper/params.go b/x/burn/keeper/params.go index a4078815..5fa339a2 100644 --- a/x/burn/keeper/params.go +++ b/x/burn/keeper/params.go @@ -6,8 +6,9 @@ import ( ) // GetParams get all parameters as types.Params -func (k Keeper) GetParams(ctx sdk.Context) types.Params { - return types.NewParams() +func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { + k.paramstore.GetParamSet(ctx, ¶ms) + return params } // SetParams set the params diff --git a/x/burn/types/params.go b/x/burn/types/params.go index 357196ad..25d4458a 100644 --- a/x/burn/types/params.go +++ b/x/burn/types/params.go @@ -1,34 +1,67 @@ package types import ( + "fmt" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" "gopkg.in/yaml.v2" ) var _ paramtypes.ParamSet = (*Params)(nil) -// ParamKeyTable the param key table for launch module -func ParamKeyTable() paramtypes.KeyTable { - return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) -} +// Keys for parameter access +var ( + KeyBurnDenom = []byte("BurnDenom") +) + +// // Params defines the parameters for the module. +// type Params struct { +// BurnDenom string `json:"burn_denom" yaml:"burn_denom"` +// } // NewParams creates a new Params instance -func NewParams() Params { - return Params{} +func NewParams(burnDenom string) Params { + return Params{ + BurnDenom: burnDenom, + } } // DefaultParams returns a default set of parameters func DefaultParams() Params { - return NewParams() + return Params{ + BurnDenom: "ubcna", + } +} + +// ParamKeyTable the param key table for the module +func ParamKeyTable() paramtypes.KeyTable { + return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) } // ParamSetPairs get the params.ParamSet func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { - return paramtypes.ParamSetPairs{} + return paramtypes.ParamSetPairs{ + paramtypes.NewParamSetPair(KeyBurnDenom, &p.BurnDenom, validateBurnDenom), + } } // Validate validates the set of params func (p Params) Validate() error { + if err := validateBurnDenom(p.BurnDenom); err != nil { + return err + } + return nil +} + +// ValidateBurnDenom validates the BurnDenom parameter +func validateBurnDenom(i interface{}) error { + v, ok := i.(string) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + if v == "" { + return fmt.Errorf("burn denom cannot be empty") + } return nil } diff --git a/x/burn/types/params.pb.go b/x/burn/types/params.pb.go index 4a71eb5e..f231d374 100644 --- a/x/burn/types/params.pb.go +++ b/x/burn/types/params.pb.go @@ -25,6 +25,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Params defines the parameters for the module. type Params struct { + BurnDenom string `protobuf:"bytes,1,opt,name=burn_denom,json=burnDenom,proto3" json:"burn_denom,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -59,6 +60,13 @@ func (m *Params) XXX_DiscardUnknown() { var xxx_messageInfo_Params proto.InternalMessageInfo +func (m *Params) GetBurnDenom() string { + if m != nil { + return m.BurnDenom + } + return "" +} + func init() { proto.RegisterType((*Params)(nil), "bcna.burn.Params") } @@ -66,17 +74,19 @@ func init() { func init() { proto.RegisterFile("bcna/burn/params.proto", fileDescriptor_93e0b1c02465615e) } var fileDescriptor_93e0b1c02465615e = []byte{ - // 152 bytes of a gzipped FileDescriptorProto + // 177 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4b, 0x4a, 0xce, 0x4b, 0xd4, 0x4f, 0x2a, 0x2d, 0xca, 0xd3, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x04, 0x89, 0xeb, 0x81, 0xc4, 0xa5, 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, - 0xa2, 0xfa, 0x20, 0x16, 0x44, 0x81, 0x12, 0x1f, 0x17, 0x5b, 0x00, 0x58, 0x83, 0x15, 0xcb, 0x8c, - 0x05, 0xf2, 0x0c, 0x4e, 0xae, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, - 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, 0xdc, 0x78, 0x2c, 0xc7, 0x10, 0xa5, - 0x9d, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, 0xef, 0x94, 0x59, 0xe2, 0x9c, - 0x98, 0x97, 0x97, 0xe8, 0x9e, 0x93, 0x9f, 0x94, 0x98, 0xa3, 0x0f, 0xb6, 0xbc, 0x02, 0x62, 0x7d, - 0x49, 0x65, 0x41, 0x6a, 0x71, 0x12, 0x1b, 0xd8, 0x74, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, - 0x8f, 0x08, 0x19, 0xb2, 0x98, 0x00, 0x00, 0x00, + 0xa2, 0xfa, 0x20, 0x16, 0x44, 0x81, 0x92, 0x2e, 0x17, 0x5b, 0x00, 0x58, 0x83, 0x90, 0x2c, 0x17, + 0x17, 0x48, 0x5d, 0x7c, 0x4a, 0x6a, 0x5e, 0x7e, 0xae, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0x67, 0x10, + 0x27, 0x48, 0xc4, 0x05, 0x24, 0x60, 0xc5, 0x32, 0x63, 0x81, 0x3c, 0x83, 0x93, 0xeb, 0x89, 0x47, + 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, + 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x44, 0x69, 0xa7, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, + 0x25, 0xe7, 0xe7, 0xea, 0x3b, 0x65, 0x96, 0x38, 0x27, 0xe6, 0xe5, 0x25, 0xba, 0xe7, 0xe4, 0x27, + 0x25, 0xe6, 0xe8, 0x83, 0xdd, 0x56, 0x01, 0x71, 0x5d, 0x49, 0x65, 0x41, 0x6a, 0x71, 0x12, 0x1b, + 0xd8, 0x72, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x83, 0x1f, 0xae, 0x50, 0xb7, 0x00, 0x00, + 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -99,6 +109,13 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.BurnDenom) > 0 { + i -= len(m.BurnDenom) + copy(dAtA[i:], m.BurnDenom) + i = encodeVarintParams(dAtA, i, uint64(len(m.BurnDenom))) + i-- + dAtA[i] = 0xa + } return len(dAtA) - i, nil } @@ -119,6 +136,10 @@ func (m *Params) Size() (n int) { } var l int _ = l + l = len(m.BurnDenom) + if l > 0 { + n += 1 + l + sovParams(uint64(l)) + } return n } @@ -157,6 +178,38 @@ func (m *Params) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BurnDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BurnDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipParams(dAtA[iNdEx:]) From a3a54ebac97edce34a9ae0202e9d489554509306 Mon Sep 17 00:00:00 2001 From: Raul Bernal Date: Fri, 22 Mar 2024 10:27:59 +0100 Subject: [PATCH 19/37] Remove deprecation in App.go --- app/app.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/app.go b/app/app.go index f530b1a5..d31fc190 100644 --- a/app/app.go +++ b/app/app.go @@ -67,7 +67,6 @@ import ( govclient "github.com/cosmos/cosmos-sdk/x/gov/client" govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" "github.com/cosmos/cosmos-sdk/x/group" groupkeeper "github.com/cosmos/cosmos-sdk/x/group/keeper" @@ -956,7 +955,7 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino paramsKeeper.Subspace(minttypes.ModuleName) paramsKeeper.Subspace(distrtypes.ModuleName) paramsKeeper.Subspace(slashingtypes.ModuleName) - paramsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(govv1.ParamKeyTable()) //nolint:staticcheck + paramsKeeper.Subspace(govtypes.ModuleName) //.WithKeyTable(govv1.ParamKeyTable()) //nolint: staticcheck // SA1019 //https://github.com/cosmos/cosmos-sdk/discussions/19832 paramsKeeper.Subspace(crisistypes.ModuleName) paramsKeeper.Subspace(ibctransfertypes.ModuleName) paramsKeeper.Subspace(ibcexported.ModuleName) From 5368c1dd5ca1a7fca7f5e4baadaebcbf5ff965f2 Mon Sep 17 00:00:00 2001 From: Raul Bernal Date: Fri, 22 Mar 2024 10:29:19 +0100 Subject: [PATCH 20/37] Allow 1 denom in place of list of denoms --- proto/bcna/burn/tx.proto | 4 +- x/burn/client/cli/tx_burn_coins_action.go | 9 ++- x/burn/keeper/msg_server_burn_coins_action.go | 34 ++++---- x/burn/types/message_burn_coins_action.go | 9 ++- .../types/message_burn_coins_action_test.go | 4 +- x/burn/types/tx.pb.go | 79 ++++++++----------- 6 files changed, 66 insertions(+), 73 deletions(-) diff --git a/proto/bcna/burn/tx.proto b/proto/bcna/burn/tx.proto index 9b962cd0..b521defb 100644 --- a/proto/bcna/burn/tx.proto +++ b/proto/bcna/burn/tx.proto @@ -12,8 +12,8 @@ service Msg { rpc BurnCoinsAction (MsgBurnCoinsAction) returns (MsgBurnCoinsActionResponse); } message MsgBurnCoinsAction { - string creator = 1; - repeated cosmos.base.v1beta1.Coin coins = 2 [(gogoproto.nullable) = false]; + string creator = 1; + cosmos.base.v1beta1.Coin amount = 2 [(gogoproto.nullable) = false]; // Now is only one coin not a list of coins } message MsgBurnCoinsActionResponse {} diff --git a/x/burn/client/cli/tx_burn_coins_action.go b/x/burn/client/cli/tx_burn_coins_action.go index 33f8515d..d727c1c2 100644 --- a/x/burn/client/cli/tx_burn_coins_action.go +++ b/x/burn/client/cli/tx_burn_coins_action.go @@ -1,6 +1,7 @@ package cli import ( + "fmt" "strconv" "github.com/BitCannaGlobal/bcna/x/burn/types" @@ -19,14 +20,14 @@ func CmdBurnCoinsAction() *cobra.Command { Short: "Broadcast message BurnCoinsAction", Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) (err error) { - argCoins, err := sdk.ParseCoinsNormalized(args[0]) + argCoins, err := sdk.ParseCoinNormalized(args[0]) if err != nil { - return err + return fmt.Errorf("failed to parse coin: %w", err) } clientCtx, err := client.GetClientTxContext(cmd) if err != nil { - return err + return fmt.Errorf("failed to get client context: %w", err) } msg := types.NewMsgBurnCoinsAction( @@ -34,7 +35,7 @@ func CmdBurnCoinsAction() *cobra.Command { argCoins, ) if err := msg.ValidateBasic(); err != nil { - return err + return fmt.Errorf("message validation failed: %w", err) } return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) }, diff --git a/x/burn/keeper/msg_server_burn_coins_action.go b/x/burn/keeper/msg_server_burn_coins_action.go index 754752ed..d74205b4 100644 --- a/x/burn/keeper/msg_server_burn_coins_action.go +++ b/x/burn/keeper/msg_server_burn_coins_action.go @@ -16,34 +16,32 @@ func (k msgServer) BurnCoinsAction(goCtx context.Context, msg *types.MsgBurnCoin if err != nil { return nil, fmt.Errorf("the address is not valid") } - - // Check nulls and valid amounts - if msg.Coins == nil || len(msg.Coins) == 0 { - return nil, fmt.Errorf("no coins specified or the amount is not valid") + // Get the module's params to verify the allowed denom + params := k.GetParams(ctx) + if msg.Amount.Denom != params.BurnDenom { + return nil, fmt.Errorf("denomination mismatch: expected %s, got %s", params.BurnDenom, msg.Amount.Denom) } - for _, coin := range msg.Coins { - if coin.Amount.LTE(sdk.ZeroInt()) { // Comprueba si la cantidad es menor o igual a cero. - return nil, fmt.Errorf("invalid amount for coin %s, amount must be positive", coin.Denom) - } + // Check if it is a valid amount + if msg.Amount.IsZero() || msg.Amount.IsNegative() { + return nil, fmt.Errorf("invalid amount: %s", msg.Amount.String()) } // Gets the balance of the sender to check if are there enough coins. - for _, coin := range msg.Coins { - balance := k.bankKeeper.GetBalance(ctx, creatorAddr, coin.Denom) - if balance.Amount.LT(coin.Amount) { - return nil, fmt.Errorf("insufficient balance for coin %s", coin.Denom) - } + balance := k.bankKeeper.GetBalance(ctx, creatorAddr, msg.Amount.Denom) + if balance.Amount.LT(msg.Amount.Amount) { + return nil, fmt.Errorf("insufficient balance for %s", msg.Amount.Denom) } - if err := k.bankKeeper.SendCoinsFromAccountToModule(ctx, creatorAddr, types.ModuleName, msg.Coins); err != nil { - return nil, err + // Send the coins from the creator to the module and later it burns + if err := k.bankKeeper.SendCoinsFromAccountToModule(ctx, creatorAddr, types.ModuleName, sdk.NewCoins(msg.Amount)); err != nil { + return nil, fmt.Errorf("failed to send coins from account to module: %v", err) } - if err := k.bankKeeper.BurnCoins(ctx, types.ModuleName, msg.Coins); err != nil { - return nil, err + if err := k.bankKeeper.BurnCoins(ctx, types.ModuleName, sdk.NewCoins(msg.Amount)); err != nil { + return nil, fmt.Errorf("failed to burn coins: %v", err) } // Log the successful burn operation - k.Logger(ctx).Info("Burning coins!! ", "signer", msg.Creator, "amount", msg.Coins) + k.Logger(ctx).Info("Burning coins!! ", "signer", msg.Creator, "amount", msg.Amount) return &types.MsgBurnCoinsActionResponse{}, nil } diff --git a/x/burn/types/message_burn_coins_action.go b/x/burn/types/message_burn_coins_action.go index f5c700e8..ac36fa6b 100644 --- a/x/burn/types/message_burn_coins_action.go +++ b/x/burn/types/message_burn_coins_action.go @@ -11,10 +11,10 @@ const TypeMsgBurnCoinsAction = "burn_coins_action" var _ sdk.Msg = &MsgBurnCoinsAction{} -func NewMsgBurnCoinsAction(creator string, coins sdk.Coins) *MsgBurnCoinsAction { +func NewMsgBurnCoinsAction(creator string, amount sdk.Coin) *MsgBurnCoinsAction { return &MsgBurnCoinsAction{ Creator: creator, - Coins: coins, + Amount: amount, } } @@ -39,10 +39,13 @@ func (msg *MsgBurnCoinsAction) GetSignBytes() []byte { return sdk.MustSortJSON(bz) } -func (msg *MsgBurnCoinsAction) ValidateBasic() error { +func (msg *MsgBurnCoinsAction) ValidateBasic() error { // TODO call IsValid and IsAllPositive _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { return fmt.Errorf("invalid creator address: %v: %w", err, errors.New("invalid address")) } + if msg.Amount.IsNegative() || msg.Amount.IsZero() { + return fmt.Errorf("amount must be positive") + } return nil } diff --git a/x/burn/types/message_burn_coins_action_test.go b/x/burn/types/message_burn_coins_action_test.go index b1e0b534..12ecb21e 100644 --- a/x/burn/types/message_burn_coins_action_test.go +++ b/x/burn/types/message_burn_coins_action_test.go @@ -19,14 +19,14 @@ func TestMsgBurnCoinsAction_ValidateBasic(t *testing.T) { name: "invalid address", msg: MsgBurnCoinsAction{ Creator: "invalid_address", - Coins: sdk.Coins{sdk.NewInt64Coin("testcoin", 1000)}, + Amount: sdk.NewInt64Coin("testcoin", 1000), }, err: sdkerrors.ErrInvalidAddress, }, { name: "valid address", msg: MsgBurnCoinsAction{ Creator: sample.AccAddress(), - Coins: sdk.Coins{sdk.NewInt64Coin("testcoin", 1000)}, + Amount: sdk.NewInt64Coin("testcoin", 1000), }, }, } diff --git a/x/burn/types/tx.pb.go b/x/burn/types/tx.pb.go index 389b01ad..16831910 100644 --- a/x/burn/types/tx.pb.go +++ b/x/burn/types/tx.pb.go @@ -30,8 +30,8 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type MsgBurnCoinsAction struct { - Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` - Coins []types.Coin `protobuf:"bytes,2,rep,name=coins,proto3" json:"coins"` + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + Amount types.Coin `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount"` } func (m *MsgBurnCoinsAction) Reset() { *m = MsgBurnCoinsAction{} } @@ -74,11 +74,11 @@ func (m *MsgBurnCoinsAction) GetCreator() string { return "" } -func (m *MsgBurnCoinsAction) GetCoins() []types.Coin { +func (m *MsgBurnCoinsAction) GetAmount() types.Coin { if m != nil { - return m.Coins + return m.Amount } - return nil + return types.Coin{} } type MsgBurnCoinsActionResponse struct { @@ -126,24 +126,24 @@ func init() { proto.RegisterFile("bcna/burn/tx.proto", fileDescriptor_7b8a0e462b var fileDescriptor_7b8a0e462b5fa7e6 = []byte{ // 281 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x90, 0x4f, 0x4b, 0xc3, 0x30, - 0x18, 0xc6, 0x5b, 0xe7, 0x1f, 0x16, 0x0f, 0x42, 0xf0, 0x50, 0x8b, 0xc6, 0x31, 0x10, 0x06, 0x42, - 0xc2, 0x26, 0x7e, 0x00, 0x3b, 0xc4, 0xd3, 0x2e, 0xbd, 0x08, 0x1e, 0x84, 0x24, 0x84, 0x5a, 0xd8, - 0xf2, 0x96, 0xbe, 0xa9, 0xcc, 0x6f, 0xe1, 0xc7, 0xda, 0x71, 0x47, 0x4f, 0x22, 0xed, 0x17, 0x91, - 0xb4, 0x9b, 0x07, 0x07, 0xbb, 0x25, 0xcf, 0xf3, 0xe4, 0x97, 0xf7, 0x7d, 0x08, 0x55, 0xda, 0x4a, - 0xa1, 0xaa, 0xd2, 0x0a, 0xb7, 0xe4, 0x45, 0x09, 0x0e, 0x68, 0xdf, 0x6b, 0xdc, 0x6b, 0xf1, 0x79, - 0x06, 0x19, 0xb4, 0xaa, 0xf0, 0xa7, 0x2e, 0x10, 0x33, 0x0d, 0xb8, 0x00, 0x14, 0x4a, 0xa2, 0x11, - 0xef, 0x63, 0x65, 0x9c, 0x1c, 0x0b, 0x0d, 0xb9, 0xed, 0xfc, 0xa1, 0x21, 0x74, 0x86, 0x59, 0x52, - 0x95, 0x76, 0x0a, 0xb9, 0xc5, 0x07, 0xed, 0x72, 0xb0, 0x34, 0x22, 0x27, 0xba, 0x34, 0xd2, 0x41, - 0x19, 0x85, 0x83, 0x70, 0xd4, 0x4f, 0xb7, 0x57, 0x7a, 0x4f, 0x8e, 0xfc, 0x6b, 0x8c, 0x0e, 0x06, - 0xbd, 0xd1, 0xe9, 0xe4, 0x82, 0x77, 0x7c, 0xee, 0xf9, 0x7c, 0xc3, 0xe7, 0x1e, 0x95, 0x1c, 0xae, - 0xbe, 0xaf, 0x83, 0xb4, 0x4b, 0x0f, 0x2f, 0x49, 0xbc, 0xfb, 0x4d, 0x6a, 0xb0, 0x00, 0x8b, 0x66, - 0xf2, 0x4a, 0x7a, 0x33, 0xcc, 0xe8, 0x33, 0x39, 0xfb, 0x3f, 0xc8, 0x15, 0xff, 0x5b, 0x90, 0xef, - 0x02, 0xe2, 0x9b, 0xbd, 0xf6, 0x96, 0x9f, 0x3c, 0xae, 0x6a, 0x16, 0xae, 0x6b, 0x16, 0xfe, 0xd4, - 0x2c, 0xfc, 0x6c, 0x58, 0xb0, 0x6e, 0x58, 0xf0, 0xd5, 0xb0, 0xe0, 0xe5, 0x36, 0xcb, 0xdd, 0x5b, - 0xa5, 0xb8, 0x86, 0x85, 0x48, 0x72, 0x37, 0x95, 0xd6, 0xca, 0xa7, 0x39, 0x28, 0x39, 0x17, 0x6d, - 0xdb, 0xcb, 0x4d, 0xdf, 0x1f, 0x85, 0x41, 0x75, 0xdc, 0x56, 0x76, 0xf7, 0x1b, 0x00, 0x00, 0xff, - 0xff, 0x6b, 0x2b, 0xe4, 0xa4, 0x89, 0x01, 0x00, 0x00, + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x90, 0x41, 0x4b, 0xc3, 0x30, + 0x1c, 0xc5, 0x1b, 0x95, 0xc9, 0xe2, 0x41, 0x08, 0x1e, 0x66, 0xd1, 0x38, 0x06, 0xc2, 0x40, 0x48, + 0xd8, 0x3c, 0x78, 0xb6, 0x43, 0x3c, 0xed, 0xd2, 0x8b, 0xe0, 0x41, 0x48, 0x42, 0x88, 0x85, 0x35, + 0xff, 0xd2, 0xa4, 0x32, 0xbf, 0x85, 0x1f, 0x6b, 0xc7, 0x1d, 0x3d, 0x89, 0xb4, 0x5f, 0x44, 0xd2, + 0x76, 0x1e, 0x1c, 0x78, 0x4b, 0xde, 0x7b, 0xbc, 0x5f, 0xf2, 0x30, 0x91, 0xca, 0x0a, 0x2e, 0xab, + 0xd2, 0x72, 0xbf, 0x66, 0x45, 0x09, 0x1e, 0xc8, 0x30, 0x68, 0x2c, 0x68, 0xf1, 0x99, 0x01, 0x03, + 0xad, 0xca, 0xc3, 0xa9, 0x0b, 0xc4, 0x54, 0x81, 0xcb, 0xc1, 0x71, 0x29, 0x9c, 0xe6, 0x6f, 0x33, + 0xa9, 0xbd, 0x98, 0x71, 0x05, 0x99, 0xed, 0xfc, 0x89, 0xc1, 0x64, 0xe9, 0x4c, 0x52, 0x95, 0x76, + 0x01, 0x99, 0x75, 0xf7, 0xca, 0x67, 0x60, 0xc9, 0x08, 0x1f, 0xab, 0x52, 0x0b, 0x0f, 0xe5, 0x08, + 0x8d, 0xd1, 0x74, 0x98, 0xee, 0xae, 0xe4, 0x0e, 0x0f, 0x44, 0x0e, 0x95, 0xf5, 0xa3, 0x83, 0x31, + 0x9a, 0x9e, 0xcc, 0xcf, 0x59, 0x07, 0x60, 0x01, 0xc0, 0x7a, 0x00, 0x0b, 0x5d, 0xc9, 0xd1, 0xe6, + 0xeb, 0x2a, 0x4a, 0xfb, 0xf8, 0xe4, 0x02, 0xc7, 0xfb, 0xa0, 0x54, 0xbb, 0x02, 0xac, 0xd3, 0xf3, + 0x17, 0x7c, 0xb8, 0x74, 0x86, 0x3c, 0xe1, 0xd3, 0xbf, 0x4f, 0xb9, 0x64, 0xbf, 0x5f, 0x64, 0xfb, + 0x05, 0xf1, 0xf5, 0xbf, 0xf6, 0xae, 0x3f, 0x79, 0xd8, 0xd4, 0x14, 0x6d, 0x6b, 0x8a, 0xbe, 0x6b, + 0x8a, 0x3e, 0x1a, 0x1a, 0x6d, 0x1b, 0x1a, 0x7d, 0x36, 0x34, 0x7a, 0xbe, 0x31, 0x99, 0x7f, 0xad, + 0x24, 0x53, 0x90, 0xf3, 0x24, 0xf3, 0x0b, 0x61, 0xad, 0x78, 0x5c, 0x81, 0x14, 0x2b, 0xde, 0xee, + 0xbd, 0xee, 0x17, 0x7f, 0x2f, 0xb4, 0x93, 0x83, 0x76, 0xb4, 0xdb, 0x9f, 0x00, 0x00, 0x00, 0xff, + 0xff, 0x9c, 0xf7, 0x78, 0x24, 0x8b, 0x01, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -246,20 +246,16 @@ func (m *MsgBurnCoinsAction) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.Coins) > 0 { - for iNdEx := len(m.Coins) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Coins[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 + { + size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x12 if len(m.Creator) > 0 { i -= len(m.Creator) copy(dAtA[i:], m.Creator) @@ -314,12 +310,8 @@ func (m *MsgBurnCoinsAction) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - if len(m.Coins) > 0 { - for _, e := range m.Coins { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } - } + l = m.Amount.Size() + n += 1 + l + sovTx(uint64(l)) return n } @@ -401,7 +393,7 @@ func (m *MsgBurnCoinsAction) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Coins", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -428,8 +420,7 @@ func (m *MsgBurnCoinsAction) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Coins = append(m.Coins, types.Coin{}) - if err := m.Coins[len(m.Coins)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex From 6a7d28019520be6bff3c29d051dac3302b9770ac Mon Sep 17 00:00:00 2001 From: Raul Bernal Date: Fri, 22 Mar 2024 13:13:52 +0100 Subject: [PATCH 21/37] Fix permissions for Burn module --- app/app.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/app.go b/app/app.go index d31fc190..c5b65fc3 100644 --- a/app/app.go +++ b/app/app.go @@ -191,7 +191,7 @@ var ( stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, govtypes.ModuleName: {authtypes.Burner}, ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, - burnmoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner}, + burnmoduletypes.ModuleName: {authtypes.Burner}, // nft.ModuleName: nil, } ) From c2e1b34abbd5c9bfb008ddf9b11e76034bf46dc5 Mon Sep 17 00:00:00 2001 From: Raul Bernal Date: Fri, 22 Mar 2024 16:19:13 +0100 Subject: [PATCH 22/37] fix error message --- x/burn/keeper/msg_server_burn_coins_action.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/burn/keeper/msg_server_burn_coins_action.go b/x/burn/keeper/msg_server_burn_coins_action.go index d74205b4..2406caf9 100644 --- a/x/burn/keeper/msg_server_burn_coins_action.go +++ b/x/burn/keeper/msg_server_burn_coins_action.go @@ -29,7 +29,7 @@ func (k msgServer) BurnCoinsAction(goCtx context.Context, msg *types.MsgBurnCoin // Gets the balance of the sender to check if are there enough coins. balance := k.bankKeeper.GetBalance(ctx, creatorAddr, msg.Amount.Denom) if balance.Amount.LT(msg.Amount.Amount) { - return nil, fmt.Errorf("insufficient balance for %s", msg.Amount.Denom) + return nil, fmt.Errorf("insufficient balance for %s", creatorAddr) } // Send the coins from the creator to the module and later it burns From 905d8f1b9b00427086ad040c19150b8a18c6e392 Mon Sep 17 00:00:00 2001 From: Raul Bernal Date: Fri, 22 Mar 2024 16:19:48 +0100 Subject: [PATCH 23/37] Include more validations --- x/burn/types/message_burn_coins_action.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/x/burn/types/message_burn_coins_action.go b/x/burn/types/message_burn_coins_action.go index ac36fa6b..638dbaca 100644 --- a/x/burn/types/message_burn_coins_action.go +++ b/x/burn/types/message_burn_coins_action.go @@ -39,13 +39,13 @@ func (msg *MsgBurnCoinsAction) GetSignBytes() []byte { return sdk.MustSortJSON(bz) } -func (msg *MsgBurnCoinsAction) ValidateBasic() error { // TODO call IsValid and IsAllPositive +func (msg *MsgBurnCoinsAction) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { return fmt.Errorf("invalid creator address: %v: %w", err, errors.New("invalid address")) } - if msg.Amount.IsNegative() || msg.Amount.IsZero() { - return fmt.Errorf("amount must be positive") + if msg.Amount.IsNegative() || msg.Amount.IsZero() || !msg.Amount.IsValid() { + return fmt.Errorf("amount must be positive or valid") } return nil } From 4227bdda673480b2585a8d5dc2f64a0417c0a09c Mon Sep 17 00:00:00 2001 From: Raul Bernal Date: Fri, 22 Mar 2024 17:00:54 +0100 Subject: [PATCH 24/37] More checks in keeper and use sdkerrors --- x/burn/keeper/msg_server_burn_coins_action.go | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/x/burn/keeper/msg_server_burn_coins_action.go b/x/burn/keeper/msg_server_burn_coins_action.go index 2406caf9..36e2b3df 100644 --- a/x/burn/keeper/msg_server_burn_coins_action.go +++ b/x/burn/keeper/msg_server_burn_coins_action.go @@ -2,10 +2,11 @@ package keeper import ( "context" - "fmt" + errorsmod "cosmossdk.io/errors" "github.com/BitCannaGlobal/bcna/x/burn/types" sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) // Move coins from sender to Bank account module and then the module burns the coins. @@ -14,31 +15,38 @@ func (k msgServer) BurnCoinsAction(goCtx context.Context, msg *types.MsgBurnCoin creatorAddr, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return nil, fmt.Errorf("the address is not valid") + return nil, sdkerrors.ErrInvalidAddress.Wrapf("invalid creator address: %s", err) } + + // Validate the coins + coins := sdk.NewCoins(msg.Amount) + if !coins.IsValid() { + return nil, errorsmod.Wrap(sdkerrors.ErrInvalidCoins, coins.String()) + } + // Get the module's params to verify the allowed denom params := k.GetParams(ctx) if msg.Amount.Denom != params.BurnDenom { - return nil, fmt.Errorf("denomination mismatch: expected %s, got %s", params.BurnDenom, msg.Amount.Denom) + return nil, sdkerrors.ErrInvalidAddress.Wrapf("denomination mismatch: expected %s, got %s", params.BurnDenom, msg.Amount.Denom) } - // Check if it is a valid amount - if msg.Amount.IsZero() || msg.Amount.IsNegative() { - return nil, fmt.Errorf("invalid amount: %s", msg.Amount.String()) + // Ensure coins are positive + if !coins.IsAllPositive() { + return nil, errorsmod.Wrap(sdkerrors.ErrInvalidCoins, coins.String()) } // Gets the balance of the sender to check if are there enough coins. balance := k.bankKeeper.GetBalance(ctx, creatorAddr, msg.Amount.Denom) if balance.Amount.LT(msg.Amount.Amount) { - return nil, fmt.Errorf("insufficient balance for %s", creatorAddr) + return nil, sdkerrors.ErrInvalidAddress.Wrapf("insufficient balance for %s", creatorAddr) } // Send the coins from the creator to the module and later it burns if err := k.bankKeeper.SendCoinsFromAccountToModule(ctx, creatorAddr, types.ModuleName, sdk.NewCoins(msg.Amount)); err != nil { - return nil, fmt.Errorf("failed to send coins from account to module: %v", err) + return nil, sdkerrors.ErrInvalidAddress.Wrapf("failed to send coins from account to module: %v", err) } if err := k.bankKeeper.BurnCoins(ctx, types.ModuleName, sdk.NewCoins(msg.Amount)); err != nil { - return nil, fmt.Errorf("failed to burn coins: %v", err) + return nil, sdkerrors.ErrInvalidAddress.Wrapf("failed to burn coins: %v", err) } // Log the successful burn operation k.Logger(ctx).Info("Burning coins!! ", "signer", msg.Creator, "amount", msg.Amount) From 873759c4381c04dcf31c9532af10dc01f1184548 Mon Sep 17 00:00:00 2001 From: Raul Bernal Date: Thu, 28 Mar 2024 13:22:42 +0100 Subject: [PATCH 25/37] Fix Genesis UT adding BurnDenom param --- x/burn/types/genesis_test.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/x/burn/types/genesis_test.go b/x/burn/types/genesis_test.go index d626158c..e12ec22d 100644 --- a/x/burn/types/genesis_test.go +++ b/x/burn/types/genesis_test.go @@ -19,9 +19,11 @@ func TestGenesisState_Validate(t *testing.T) { valid: true, }, { - desc: "valid genesis state", + desc: "valid genesis state", genState: &types.GenesisState{ - + Params: types.Params{ + BurnDenom: "ubcna", + }, // this line is used by starport scaffolding # types/genesis/validField }, valid: true, From 88d4c635800f1cbaa3903ae66c726efba84ad5aa Mon Sep 17 00:00:00 2001 From: Raul Bernal Date: Thu, 28 Mar 2024 15:56:43 +0100 Subject: [PATCH 26/37] Build Unit Test and simulations --- x/burn/module_simulation.go | 6 +-- x/burn/simulation/burn_coins_action.go | 41 ++++++++++++++++-- x/burn/types/message_burn_coins_action.go | 5 +++ .../types/message_burn_coins_action_test.go | 42 ++++++++++++++++++- 4 files changed, 86 insertions(+), 8 deletions(-) diff --git a/x/burn/module_simulation.go b/x/burn/module_simulation.go index e4ac724f..34d21d8f 100644 --- a/x/burn/module_simulation.go +++ b/x/burn/module_simulation.go @@ -63,7 +63,7 @@ func (am AppModule) WeightedOperations(simState module.SimulationState) []simtyp ) operations = append(operations, simulation.NewWeightedOperation( weightMsgBurnCoinsAction, - burnsimulation.SimulateMsgBurnCoinsAction(am.accountKeeper, am.bankKeeper, am.keeper), + burnsimulation.SimulateMsgBurnCoinsAction(am.accountKeeper, am.bankKeeper, am.keeper, types.ModuleCdc), )) // this line is used by starport scaffolding # simapp/module/operation @@ -71,14 +71,14 @@ func (am AppModule) WeightedOperations(simState module.SimulationState) []simtyp return operations } -// ProposalMsgs returns msgs used for governance proposals for simulations. +// ProposalMsgs returns msgs used for governance proposals for simulations. // TODO func (am AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.WeightedProposalMsg { return []simtypes.WeightedProposalMsg{ simulation.NewWeightedProposalMsg( opWeightMsgBurnCoinsAction, defaultWeightMsgBurnCoinsAction, func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { - burnsimulation.SimulateMsgBurnCoinsAction(am.accountKeeper, am.bankKeeper, am.keeper) + burnsimulation.SimulateMsgBurnCoinsAction(am.accountKeeper, am.bankKeeper, am.keeper, types.ModuleCdc) return nil }, ), diff --git a/x/burn/simulation/burn_coins_action.go b/x/burn/simulation/burn_coins_action.go index 5b0165da..734f9842 100644 --- a/x/burn/simulation/burn_coins_action.go +++ b/x/burn/simulation/burn_coins_action.go @@ -6,24 +6,57 @@ import ( "github.com/BitCannaGlobal/bcna/x/burn/keeper" "github.com/BitCannaGlobal/bcna/x/burn/types" "github.com/cosmos/cosmos-sdk/baseapp" + "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" ) +// func SimulateMsgBurnCoinsAction( +// ak types.AccountKeeper, +// bk types.BankKeeper, +// k keeper.Keeper, +// ) simtypes.Operation { +// return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, +// ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { +// simAccount, _ := simtypes.RandomAcc(r, accs) +// msg := &types.MsgBurnCoinsAction{ +// Creator: simAccount.Address.String(), +// } + +// // TODO: Handling the BurnCoinsAction simulation + +// return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "BurnCoinsAction simulation not implemented"), nil, nil +// } +// } func SimulateMsgBurnCoinsAction( ak types.AccountKeeper, bk types.BankKeeper, k keeper.Keeper, + cdc *codec.ProtoCodec, ) simtypes.Operation { - return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, - ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { + return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { + // Select a random account simAccount, _ := simtypes.RandomAcc(r, accs) + + // Get the balance of the account + balance := bk.GetBalance(ctx, simAccount.Address, "ubcna") + + // Has the account coins? + if balance.IsZero() { + return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgBurnCoinsAction, "Balance insuficiente"), nil, nil + } + + // Assign a ramdom amount (within the max balance) + amount := simtypes.RandIntBetween(r, 1, int(balance.Amount.Int64())) + + // Build and send the message msg := &types.MsgBurnCoinsAction{ Creator: simAccount.Address.String(), + Amount: sdk.NewCoin(balance.Denom, sdk.NewInt(int64(amount))), } - // TODO: Handling the BurnCoinsAction simulation + opMsg := simtypes.NewOperationMsg(msg, true, "", cdc) - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "BurnCoinsAction simulation not implemented"), nil, nil + return opMsg, nil, nil } } diff --git a/x/burn/types/message_burn_coins_action.go b/x/burn/types/message_burn_coins_action.go index 638dbaca..9a0fca07 100644 --- a/x/burn/types/message_burn_coins_action.go +++ b/x/burn/types/message_burn_coins_action.go @@ -47,5 +47,10 @@ func (msg *MsgBurnCoinsAction) ValidateBasic() error { if msg.Amount.IsNegative() || msg.Amount.IsZero() || !msg.Amount.IsValid() { return fmt.Errorf("amount must be positive or valid") } + // Let's filter the length in the amount (max digits or bigger possible number ) + maxDigits := 18 + if len(msg.Amount.Amount.String()) > maxDigits { + return fmt.Errorf("token amount exceeds maximum length of %d digits", maxDigits) + } return nil } diff --git a/x/burn/types/message_burn_coins_action_test.go b/x/burn/types/message_burn_coins_action_test.go index 12ecb21e..37ed396b 100644 --- a/x/burn/types/message_burn_coins_action_test.go +++ b/x/burn/types/message_burn_coins_action_test.go @@ -1,6 +1,9 @@ package types import ( + "fmt" + "math" + "strings" "testing" "github.com/BitCannaGlobal/bcna/testutil/sample" @@ -23,11 +26,48 @@ func TestMsgBurnCoinsAction_ValidateBasic(t *testing.T) { }, err: sdkerrors.ErrInvalidAddress, }, { - name: "valid address", + name: "valid address and valid amount", msg: MsgBurnCoinsAction{ Creator: sample.AccAddress(), Amount: sdk.NewInt64Coin("testcoin", 1000), }, + }, { + name: "negative amount", + msg: MsgBurnCoinsAction{ + Creator: sample.AccAddress(), + Amount: sdk.Coin{Denom: "testcoin", Amount: sdk.NewInt(-1000)}, + }, + err: fmt.Errorf("amount must be positive or valid"), + }, { + name: "zero amount", + msg: MsgBurnCoinsAction{ + Creator: sample.AccAddress(), + Amount: sdk.NewInt64Coin("testcoin", 0), + }, + err: fmt.Errorf("amount must be positive or valid"), + }, { + name: "invalid denom", + msg: MsgBurnCoinsAction{ + Creator: sample.AccAddress(), + Amount: sdk.Coin{Denom: "", Amount: sdk.NewInt(1000)}, + }, + err: fmt.Errorf("amount must be positive or valid"), + }, + { + name: "excessive token amount length", + msg: MsgBurnCoinsAction{ + Creator: sample.AccAddress(), + Amount: sdk.Coin{Denom: "ubcna", Amount: sdk.NewInt(math.MaxInt64)}, //9223372036854775807 + }, + err: fmt.Errorf("token amount exceeds maximum length of 18 digits"), + }, + { + name: "excessive denom length", + msg: MsgBurnCoinsAction{ + Creator: sample.AccAddress(), + Amount: sdk.Coin{Denom: strings.Repeat("a", 129), Amount: sdk.NewInt(1000)}, + }, + err: fmt.Errorf("amount must be positive or valid"), }, } for _, tt := range tests { From 519600c0992820d7fcd8a7e5ae725b680d80cc5b Mon Sep 17 00:00:00 2001 From: Raul Bernal Date: Mon, 1 Apr 2024 11:51:27 +0200 Subject: [PATCH 27/37] Bump CometBFT and deps --- go.mod | 44 +++++++++++++--------- go.sum | 114 +++++++++++++++++++++++++++++---------------------------- 2 files changed, 84 insertions(+), 74 deletions(-) diff --git a/go.mod b/go.mod index 9a3ae47c..ab1efcf8 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( cosmossdk.io/errors v1.0.1 cosmossdk.io/log v1.3.1 cosmossdk.io/math v1.3.0 - github.com/cometbft/cometbft v0.37.4 + github.com/cometbft/cometbft v0.37.5 github.com/cometbft/cometbft-db v0.11.0 github.com/cosmos/cosmos-sdk v0.47.10 github.com/cosmos/gogoproto v1.4.10 @@ -16,9 +16,9 @@ require ( github.com/gorilla/mux v1.8.0 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 - github.com/spf13/cast v1.5.1 - github.com/spf13/cobra v1.7.0 - github.com/spf13/viper v1.16.0 + github.com/spf13/cast v1.6.0 + github.com/spf13/cobra v1.8.0 + github.com/spf13/viper v1.18.1 github.com/stretchr/testify v1.8.4 google.golang.org/genproto/googleapis/api v0.0.0-20231212172506-995d672761c0 google.golang.org/grpc v1.60.1 @@ -30,7 +30,7 @@ require ( cloud.google.com/go/compute v1.23.3 // indirect cloud.google.com/go/compute/metadata v0.2.3 // indirect cloud.google.com/go/iam v1.1.5 // indirect - cloud.google.com/go/storage v1.30.1 // indirect + cloud.google.com/go/storage v1.35.1 // indirect cosmossdk.io/core v0.5.1 // indirect cosmossdk.io/depinject v1.0.0-alpha.4 // indirect cosmossdk.io/tools/rosetta v0.2.1 // indirect @@ -67,7 +67,7 @@ require ( github.com/cosmos/rosetta-sdk-go v0.10.0 // indirect github.com/creachadair/taskgroup v0.4.2 // indirect github.com/danieljoos/wincred v1.1.2 // indirect - github.com/davecgh/go-spew v1.1.1 // indirect + github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect github.com/dgraph-io/badger/v2 v2.2007.4 // indirect @@ -76,7 +76,7 @@ require ( github.com/dustin/go-humanize v1.0.1 // indirect github.com/dvsekhvalnov/jose2go v1.6.0 // indirect github.com/felixge/httpsnoop v1.0.2 // indirect - github.com/fsnotify/fsnotify v1.6.0 // indirect + github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/getsentry/sentry-go v0.23.0 // indirect github.com/ghodss/yaml v1.0.0 // indirect github.com/go-kit/kit v0.12.0 // indirect @@ -117,7 +117,7 @@ require ( github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/jmhodges/levigo v1.0.0 // indirect - github.com/klauspost/compress v1.16.7 // indirect + github.com/klauspost/compress v1.17.0 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect github.com/lib/pq v1.10.7 // indirect @@ -134,10 +134,10 @@ require ( github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mtibben/percent v0.2.1 // indirect - github.com/pelletier/go-toml/v2 v2.0.8 // indirect + github.com/pelletier/go-toml/v2 v2.1.0 // indirect github.com/petermattis/goid v0.0.0-20230317030725-371a4b8eda08 // indirect github.com/pkg/errors v0.9.1 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.14.0 // indirect github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.42.0 // indirect @@ -147,11 +147,13 @@ require ( github.com/rogpeppe/go-internal v1.11.0 // indirect github.com/rs/cors v1.8.3 // indirect github.com/rs/zerolog v1.32.0 // indirect + github.com/sagikazarmark/locafero v0.4.0 // indirect + github.com/sagikazarmark/slog-shim v0.1.0 // indirect github.com/sasha-s/go-deadlock v0.3.1 // indirect - github.com/spf13/afero v1.9.5 // indirect - github.com/spf13/jwalterweatherman v1.1.0 // indirect + github.com/sourcegraph/conc v0.3.0 // indirect + github.com/spf13/afero v1.11.0 // indirect github.com/spf13/pflag v1.0.5 // indirect - github.com/subosito/gotenv v1.4.2 // indirect + github.com/subosito/gotenv v1.6.0 // indirect github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect github.com/tendermint/go-amino v0.16.0 // indirect github.com/tidwall/btree v1.6.0 // indirect @@ -163,15 +165,18 @@ require ( go.opentelemetry.io/otel v1.19.0 // indirect go.opentelemetry.io/otel/metric v1.19.0 // indirect go.opentelemetry.io/otel/trace v1.19.0 // indirect + go.uber.org/atomic v1.10.0 // indirect + go.uber.org/multierr v1.9.0 // indirect golang.org/x/crypto v0.18.0 // indirect - golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb // indirect + golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect golang.org/x/net v0.20.0 // indirect - golang.org/x/oauth2 v0.13.0 // indirect - golang.org/x/sync v0.4.0 // indirect + golang.org/x/oauth2 v0.15.0 // indirect + golang.org/x/sync v0.5.0 // indirect golang.org/x/sys v0.16.0 // indirect golang.org/x/term v0.16.0 // indirect golang.org/x/text v0.14.0 // indirect - google.golang.org/api v0.149.0 // indirect + golang.org/x/time v0.5.0 // indirect + google.golang.org/api v0.153.0 // indirect google.golang.org/appengine v1.6.8 // indirect google.golang.org/genproto v0.0.0-20240102182953-50ed04b92917 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240108191215-35c7eff3a6b1 // indirect @@ -188,5 +193,8 @@ replace ( github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0 // replace broken goleveldb github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 - + // stick with compatible version or x/exp in v0.47.x line + golang.org/x/exp => golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb + // stick with compatible version of rapid in v0.47.x line + pgregory.net/rapid => pgregory.net/rapid v0.5.5 ) diff --git a/go.sum b/go.sum index 50ca08c0..15e5e3dd 100644 --- a/go.sum +++ b/go.sum @@ -3,7 +3,6 @@ cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= -cloud.google.com/go v0.44.3/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= @@ -16,7 +15,6 @@ cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOY cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= -cloud.google.com/go v0.75.0/go.mod h1:VGuuCn7PG0dwsd5XPVm2Mm3wlh3EL55/79EKB6hlPTY= cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg= cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8= cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0= @@ -170,12 +168,11 @@ cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0Zeo cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= -cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= cloud.google.com/go/storage v1.22.1/go.mod h1:S8N1cAStu7BOeFfE8KAQzmyyLkK8p/vmRq6kuBTW58Y= cloud.google.com/go/storage v1.23.0/go.mod h1:vOEEDNFnciUMhBeT6hsJIn3ieU5cFRmzeLgDvXzfIXc= cloud.google.com/go/storage v1.27.0/go.mod h1:x9DOL8TK/ygDUMieqwfhdpQryTeEkhGKMi80i/iqR2s= -cloud.google.com/go/storage v1.30.1 h1:uOdMxAs8HExqBlnLtnQyP0YkvbiDpdGShGKtx6U/oNM= -cloud.google.com/go/storage v1.30.1/go.mod h1:NfxhC0UJE1aXSx7CIIbCf7y9HKT7BiccwkR7+P7gN8E= +cloud.google.com/go/storage v1.35.1 h1:B59ahL//eDfx2IIKFBeT5Atm9wnNmj3+8xG/W4WB//w= +cloud.google.com/go/storage v1.35.1/go.mod h1:M6M/3V/D3KpzMTJyPOR/HU6n2Si5QdaXYEsng2xgOs8= cloud.google.com/go/talent v1.1.0/go.mod h1:Vl4pt9jiHKvOgF9KoZo6Kob9oV4lwd/ZD5Cto54zDRw= cloud.google.com/go/talent v1.2.0/go.mod h1:MoNF9bhFQbiJ6eFD3uSsg0uBALw4n4gaCaEjBw9zo8g= cloud.google.com/go/videointelligence v1.6.0/go.mod h1:w0DIDlVRKtwPCn/C4iwZIJdvC69yInhW0cfi+p546uU= @@ -216,8 +213,8 @@ github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3 github.com/DataDog/zstd v1.4.5 h1:EndNeuB0l9syBZhut0wns3gV1hL8zX8LIu6ZiVHWLIQ= github.com/DataDog/zstd v1.4.5/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= -github.com/Microsoft/go-winio v0.6.0 h1:slsWYD/zyx7lCXoZVlvQrj0hPTM1HI4+v1sIda2yDvg= -github.com/Microsoft/go-winio v0.6.0/go.mod h1:cTAf44im0RAYeL23bpB+fzCyDH2MJiz2BO69KH/soAE= +github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= +github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw= github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk= github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= @@ -320,8 +317,8 @@ github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1: github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= github.com/coinbase/rosetta-sdk-go/types v1.0.0 h1:jpVIwLcPoOeCR6o1tU+Xv7r5bMONNbHU7MuEHboiFuA= github.com/coinbase/rosetta-sdk-go/types v1.0.0/go.mod h1:eq7W2TMRH22GTW0N0beDnN931DW0/WOI1R2sdHNHG4c= -github.com/cometbft/cometbft v0.37.4 h1:xyvvEqlyfK8MgNIIKVJaMsuIp03wxOcFmVkT26+Ikpg= -github.com/cometbft/cometbft v0.37.4/go.mod h1:Cmg5Hp4sNpapm7j+x0xRyt2g0juQfmB752ous+pA0G8= +github.com/cometbft/cometbft v0.37.5 h1:/U/TlgMh4NdnXNo+YU9T2NMCWyhXNDF34Mx582jlvq0= +github.com/cometbft/cometbft v0.37.5/go.mod h1:QC+mU0lBhKn8r9qvmnq53Dmf3DWBt4VtkcKw2C81wxY= github.com/cometbft/cometbft-db v0.11.0 h1:M3Lscmpogx5NTbb1EGyGDaFRdsoLWrUWimFEyf7jej8= github.com/cometbft/cometbft-db v0.11.0/go.mod h1:GDPJAC/iFHNjmZZPN8V8C1yr/eyityhi2W1hz2MGKSc= github.com/confio/ics23/go v0.9.0 h1:cWs+wdbS2KRPZezoaaj+qBleXgUk5WOQFMP3CQFGTr4= @@ -362,7 +359,7 @@ github.com/cosmos/rosetta-sdk-go v0.10.0 h1:E5RhTruuoA7KTIXUcMicL76cffyeoyvNybzU github.com/cosmos/rosetta-sdk-go v0.10.0/go.mod h1:SImAZkb96YbwvoRkzSMQB6noNJXFgWl/ENIznEoYQI4= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creachadair/taskgroup v0.4.2 h1:jsBLdAJE42asreGss2xZGZ8fJra7WtwnHWeJFxv2Li8= github.com/creachadair/taskgroup v0.4.2/go.mod h1:qiXUOSrbwAY3u0JPGTzObbE3yf9hcXHDKBZ2ZjpCbgM= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= @@ -370,8 +367,9 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3 github.com/danieljoos/wincred v1.1.2 h1:QLdCxFs1/Yl4zduvBdcHB8goaYk9RARS2SgLLRuAyr0= github.com/danieljoos/wincred v1.1.2/go.mod h1:GijpziifJoIBfYh+S7BbkdUTU4LfM+QnGqR5Vl2tAx0= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0= github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 h1:HbphB4TFFXpv7MNrT52FGrrgVXF1owhMVTHFZIlnvd4= @@ -420,12 +418,12 @@ github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8 github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= -github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY= -github.com/frankban/quicktest v1.14.4/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= +github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= +github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= -github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= +github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= +github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= github.com/getsentry/sentry-go v0.23.0 h1:dn+QRCeJv4pPt9OjVXiMcGIBIefaTJPw/h0bZWO05nE= github.com/getsentry/sentry-go v0.23.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= @@ -576,7 +574,6 @@ github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hf github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= @@ -607,7 +604,6 @@ github.com/googleapis/gax-go/v2 v2.6.0/go.mod h1:1mjbznJAPHFpesgE5ucqfYEscaz5kMd github.com/googleapis/gax-go/v2 v2.12.0 h1:A+gCJKdRfqXkr+BIRGtZLibNXf0m1f9E4HG56etFpas= github.com/googleapis/gax-go/v2 v2.12.0/go.mod h1:y+aIqrI5eb1YGMVJfuV3185Ts/D7qKpsEkdD5+I6QGU= github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4= -github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= github.com/gorilla/handlers v1.5.1 h1:9lRY6j8DEeeBT10CvO9hGW0gmky0BprnvDI5vfhUHH4= @@ -721,11 +717,10 @@ github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYs github.com/klauspost/compress v1.11.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.12.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= github.com/klauspost/compress v1.15.11/go.mod h1:QPwzmACJjUTFsnSHH934V6woptycfrDDJnH7hvFVbGM= -github.com/klauspost/compress v1.16.7 h1:2mk3MPGNzKyxErAw8YaohYh69+pa4sIQSC0fPGCFR9I= -github.com/klauspost/compress v1.16.7/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= +github.com/klauspost/compress v1.17.0 h1:Rnbp4K9EjcDuVuHtd0dgA4qNuv9yKDYKK1ulpJwgrqM= +github.com/klauspost/compress v1.17.0/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= @@ -846,8 +841,8 @@ github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0Mw github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/pelletier/go-toml/v2 v2.0.8 h1:0ctb6s9mE31h0/lhu+J6OPmVeDxJn+kYnJc2jZR9tGQ= -github.com/pelletier/go-toml/v2 v2.0.8/go.mod h1:vuYfssBdrU2XDZ9bYydBu6t+6a6PYNcZljzZR9VXg+4= +github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4= +github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= github.com/petermattis/goid v0.0.0-20230317030725-371a4b8eda08 h1:hDSdbBuw3Lefr6R18ax0tZ2BJeNB3NehB3trOwYBsdU= @@ -862,9 +857,9 @@ github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= -github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= @@ -919,6 +914,10 @@ github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ= +github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= +github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= +github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= github.com/sasha-s/go-deadlock v0.3.1 h1:sqv7fDNShgjcaxkO0JNcOAlr8B9+cV5Ey/OB71efZx0= github.com/sasha-s/go-deadlock v0.3.1/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= @@ -934,29 +933,29 @@ github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1 github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY= +github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= +github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/afero v1.9.5 h1:stMpOSZFs//0Lv29HduCmli3GUfpFoF3Y1Q/aXj/wVM= -github.com/spf13/afero v1.9.5/go.mod h1:UBogFpq8E9Hx+xc5CNTTEpTnuHVmXDwZcZcE1eb/UhQ= +github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= +github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cast v1.5.1 h1:R+kOtfhWQE6TVQzY+4D7wJLBgkdVasCEFxSUBYBYIlA= -github.com/spf13/cast v1.5.1/go.mod h1:b9PdjNptOpzXr7Rq1q9gJML/2cdGQAo69NKzQ10KN48= +github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= +github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= -github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= -github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= +github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0= +github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= -github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= -github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= -github.com/spf13/viper v1.16.0 h1:rGGH0XDZhdUOryiDWjmIvUSWpbNqisK8Wk0Vyefw8hc= -github.com/spf13/viper v1.16.0/go.mod h1:yg78JgCJcbrQOvV9YLXgkLaZqUidkY9K+Dd1FofRzQg= +github.com/spf13/viper v1.18.1 h1:rmuU42rScKWlhhJDyXZRKJQHXFX02chSVW1IvkPGiVM= +github.com/spf13/viper v1.18.1/go.mod h1:EKmWIqdnk5lOcmR72yw6hS+8OPYcwD0jteitLMVB+yk= github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= @@ -974,11 +973,10 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8= -github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= +github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= +github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= github.com/tendermint/go-amino v0.16.0 h1:GyhmgQKvqF82e2oZeuMSp9JTN0N09emoSZlb2lyGa2E= @@ -1037,8 +1035,12 @@ go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqe go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= +go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= +go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= +go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI= +go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ= go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= @@ -1053,9 +1055,8 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc= golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1071,6 +1072,8 @@ golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMk golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb h1:xIApU0ow1zwMa2uL1VDNeQlNVFTWMQxZUZCMDy0Q4Us= golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= +golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g= +golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -1097,8 +1100,10 @@ golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.11.0 h1:bUO06HqtnRcc/7l71XBe4WcqTZ+3AH1J59zWDDwLKgU= +golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= golang.org/x/mod v0.11.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= +golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1140,14 +1145,12 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220325170049-de3da57026de/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= @@ -1187,8 +1190,8 @@ golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094/go.mod h1:h4gKUeWbJ4rQPri golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.1.0/go.mod h1:G9FE4dLTsbXUu90h/Pf85g4w1D+SSAgR+q46nJZ8M4A= -golang.org/x/oauth2 v0.13.0 h1:jDDenyj+WgFtmV3zYVoi8aE2BwtXFLWOA67ZfNWftiY= -golang.org/x/oauth2 v0.13.0/go.mod h1:/JMhi4ZRXAf4HG9LiNmxvk+45+96RUlVThiH8FzNBn0= +golang.org/x/oauth2 v0.15.0 h1:s8pnnxNVzjWyrvYdFUQq5llS1PX2zhPXmccZv99h7uQ= +golang.org/x/oauth2 v0.15.0/go.mod h1:q48ptWNTY5XWf+JNten23lcvHpLJ0ZSxF5ttTHKVCAM= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1203,8 +1206,8 @@ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ= -golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= +golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1261,13 +1264,11 @@ golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1298,7 +1299,6 @@ golang.org/x/sys v0.0.0-20220624220833-87e55d714810/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1327,6 +1327,8 @@ golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxb golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= +golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -1381,7 +1383,6 @@ golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= @@ -1389,8 +1390,9 @@ golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM= -golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= +golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= +golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -1449,8 +1451,8 @@ google.golang.org/api v0.96.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ google.golang.org/api v0.97.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= google.golang.org/api v0.98.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= google.golang.org/api v0.100.0/go.mod h1:ZE3Z2+ZOr87Rx7dqFsdRQkRBk36kDtp/h+QpHbB7a70= -google.golang.org/api v0.149.0 h1:b2CqT6kG+zqJIVKRQ3ELJVLN1PwHZ6DJ3dW8yl82rgY= -google.golang.org/api v0.149.0/go.mod h1:Mwn1B7JTXrzXtnvmzQE2BD6bYZQ8DShKZDZbeN9I7qI= +google.golang.org/api v0.153.0 h1:N1AwGhielyKFaUqH07/ZSIQR3uNPcV7NVw0vj+j4iR4= +google.golang.org/api v0.153.0/go.mod h1:3qNJX5eOmhiWYc67jRA/3GsDw97UFb5ivv7Y2PrriAY= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -1499,10 +1501,8 @@ google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210126160654-44e461bb6506/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= @@ -1681,6 +1681,8 @@ honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9 honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= nhooyr.io/websocket v1.8.6 h1:s+C3xAMLwGmlI31Nyn/eAehUlZPwfYZu2JXM621Q5/k= nhooyr.io/websocket v1.8.6/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= +pgregory.net/rapid v0.5.5 h1:jkgx1TjbQPD/feRoK+S/mXw9e1uj6WilpHrXJowi6oA= +pgregory.net/rapid v0.5.5/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04= pgregory.net/rapid v1.1.0 h1:CMa0sjHSru3puNx+J0MIAuiiEV4N0qj8/cMWGBBCsjw= pgregory.net/rapid v1.1.0/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= From ad54f14086c02ee640e5ec49d1301b6cef62c058 Mon Sep 17 00:00:00 2001 From: Raul Bernal Date: Mon, 1 Apr 2024 11:54:03 +0200 Subject: [PATCH 28/37] go.sum clean --- go.sum | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/go.sum b/go.sum index 15e5e3dd..225e4fbe 100644 --- a/go.sum +++ b/go.sum @@ -198,7 +198,6 @@ cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/tools/rosetta v0.2.1 h1:ddOMatOH+pbxWbrGJKRAawdBkPYLfKXutK9IETnjYxw= cosmossdk.io/tools/rosetta v0.2.1/go.mod h1:Pqdc1FdvkNV3LcNIkYWt2RQY6IP1ge6YWZk8MhhO9Hw= -dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.0.0 h1:0wAIcmJUqRdI8IJ/3eGi5/HwXZWPujYXXlkrQogz0Ek= filippo.io/edwards25519 v1.0.0/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns= github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs= @@ -206,7 +205,6 @@ github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4/go.mod h1:hN github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8= github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/ChainSafe/go-schnorrkel v1.0.0 h1:3aDA67lAykLaG1y3AOjs88dMxC88PgUuHRrLeDnvGIM= github.com/ChainSafe/go-schnorrkel v1.0.0/go.mod h1:dpzHYVxLZcp8pjlV+O+UR8K0Hp/z7vcchBSbMBEhCw4= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= @@ -435,9 +433,6 @@ github.com/gin-gonic/gin v1.8.1 h1:4+fr/el88TOO3ewCmQr8cx/CtZ/umlIRIs5M4NTNjf8= github.com/gin-gonic/gin v1.8.1/go.mod h1:ji8BvRH1azfM+SYow9zQ6SZMvR8qOMZHmsCuWR9tTTk= github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= -github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o= @@ -1059,23 +1054,8 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc= golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= -golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= -golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= -golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= -golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb h1:xIApU0ow1zwMa2uL1VDNeQlNVFTWMQxZUZCMDy0Q4Us= golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= -golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g= -golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k= -golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= -golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -1088,12 +1068,8 @@ golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPI golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= -golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= -golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= @@ -1219,7 +1195,6 @@ golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190130150945-aca44879d564/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1230,7 +1205,6 @@ golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1336,7 +1310,6 @@ golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= @@ -1345,9 +1318,7 @@ golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBn golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= @@ -1362,7 +1333,6 @@ golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapK golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= @@ -1683,8 +1653,6 @@ nhooyr.io/websocket v1.8.6 h1:s+C3xAMLwGmlI31Nyn/eAehUlZPwfYZu2JXM621Q5/k= nhooyr.io/websocket v1.8.6/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= pgregory.net/rapid v0.5.5 h1:jkgx1TjbQPD/feRoK+S/mXw9e1uj6WilpHrXJowi6oA= pgregory.net/rapid v0.5.5/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04= -pgregory.net/rapid v1.1.0 h1:CMa0sjHSru3puNx+J0MIAuiiEV4N0qj8/cMWGBBCsjw= -pgregory.net/rapid v1.1.0/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= From ce4451cda75125143fd111e40316538fcd258d5b Mon Sep 17 00:00:00 2001 From: Raul Bernal Date: Mon, 1 Apr 2024 13:01:18 +0200 Subject: [PATCH 29/37] Bump github.com/golang/protobuf from 1.5.3 to 1.5.4 --- go.mod | 4 ++-- go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index ab1efcf8..1425b5e8 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/cosmos/cosmos-sdk v0.47.10 github.com/cosmos/gogoproto v1.4.10 github.com/cosmos/ibc-go/v7 v7.3.2 - github.com/golang/protobuf v1.5.3 + github.com/golang/protobuf v1.5.4 github.com/gorilla/mux v1.8.0 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 @@ -180,7 +180,7 @@ require ( google.golang.org/appengine v1.6.8 // indirect google.golang.org/genproto v0.0.0-20240102182953-50ed04b92917 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240108191215-35c7eff3a6b1 // indirect - google.golang.org/protobuf v1.32.0 // indirect + google.golang.org/protobuf v1.33.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect nhooyr.io/websocket v1.8.6 // indirect diff --git a/go.sum b/go.sum index 225e4fbe..f177b1da 100644 --- a/go.sum +++ b/go.sum @@ -520,8 +520,8 @@ github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= @@ -1604,8 +1604,8 @@ google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= -google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= From 3c509022df3c0f64bb6cbf67dfb8ed730dba3ef4 Mon Sep 17 00:00:00 2001 From: Raul Bernal Date: Mon, 1 Apr 2024 13:07:29 +0200 Subject: [PATCH 30/37] Bump google.golang.org/grpc from 1.60.1 to 1.62.1 --- go.mod | 34 +++++++++++++------------- go.sum | 76 ++++++++++++++++++++++++++++++++-------------------------- 2 files changed, 60 insertions(+), 50 deletions(-) diff --git a/go.mod b/go.mod index 1425b5e8..1aab2e61 100644 --- a/go.mod +++ b/go.mod @@ -20,17 +20,17 @@ require ( github.com/spf13/cobra v1.8.0 github.com/spf13/viper v1.18.1 github.com/stretchr/testify v1.8.4 - google.golang.org/genproto/googleapis/api v0.0.0-20231212172506-995d672761c0 - google.golang.org/grpc v1.60.1 + google.golang.org/genproto/googleapis/api v0.0.0-20240123012728-ef4313101c80 + google.golang.org/grpc v1.62.1 gopkg.in/yaml.v2 v2.4.0 ) require ( - cloud.google.com/go v0.111.0 // indirect + cloud.google.com/go v0.112.0 // indirect cloud.google.com/go/compute v1.23.3 // indirect cloud.google.com/go/compute/metadata v0.2.3 // indirect cloud.google.com/go/iam v1.1.5 // indirect - cloud.google.com/go/storage v1.35.1 // indirect + cloud.google.com/go/storage v1.36.0 // indirect cosmossdk.io/core v0.5.1 // indirect cosmossdk.io/depinject v1.0.0-alpha.4 // indirect cosmossdk.io/tools/rosetta v0.2.1 // indirect @@ -75,19 +75,19 @@ require ( github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/dvsekhvalnov/jose2go v1.6.0 // indirect - github.com/felixge/httpsnoop v1.0.2 // indirect + github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/getsentry/sentry-go v0.23.0 // indirect github.com/ghodss/yaml v1.0.0 // indirect github.com/go-kit/kit v0.12.0 // indirect github.com/go-kit/log v0.2.1 // indirect github.com/go-logfmt/logfmt v0.6.0 // indirect - github.com/go-logr/logr v1.2.4 // indirect + github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect github.com/gogo/googleapis v1.4.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang/glog v1.1.2 // indirect + github.com/golang/glog v1.2.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/mock v1.6.0 // indirect github.com/golang/snappy v0.0.4 // indirect @@ -95,7 +95,7 @@ require ( github.com/google/go-cmp v0.6.0 // indirect github.com/google/orderedcode v0.0.1 // indirect github.com/google/s2a-go v0.1.7 // indirect - github.com/google/uuid v1.4.0 // indirect + github.com/google/uuid v1.6.0 // indirect github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect github.com/googleapis/gax-go/v2 v2.12.0 // indirect github.com/gorilla/handlers v1.5.1 // indirect @@ -162,24 +162,26 @@ require ( github.com/zondax/ledger-go v0.14.3 // indirect go.etcd.io/bbolt v1.3.8 // indirect go.opencensus.io v0.24.0 // indirect - go.opentelemetry.io/otel v1.19.0 // indirect - go.opentelemetry.io/otel/metric v1.19.0 // indirect - go.opentelemetry.io/otel/trace v1.19.0 // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 // indirect + go.opentelemetry.io/otel v1.21.0 // indirect + go.opentelemetry.io/otel/metric v1.21.0 // indirect + go.opentelemetry.io/otel/trace v1.21.0 // indirect go.uber.org/atomic v1.10.0 // indirect go.uber.org/multierr v1.9.0 // indirect golang.org/x/crypto v0.18.0 // indirect golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect golang.org/x/net v0.20.0 // indirect - golang.org/x/oauth2 v0.15.0 // indirect - golang.org/x/sync v0.5.0 // indirect + golang.org/x/oauth2 v0.16.0 // indirect + golang.org/x/sync v0.6.0 // indirect golang.org/x/sys v0.16.0 // indirect golang.org/x/term v0.16.0 // indirect golang.org/x/text v0.14.0 // indirect golang.org/x/time v0.5.0 // indirect - google.golang.org/api v0.153.0 // indirect + google.golang.org/api v0.155.0 // indirect google.golang.org/appengine v1.6.8 // indirect - google.golang.org/genproto v0.0.0-20240102182953-50ed04b92917 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240108191215-35c7eff3a6b1 // indirect + google.golang.org/genproto v0.0.0-20240123012728-ef4313101c80 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 // indirect google.golang.org/protobuf v1.33.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/go.sum b/go.sum index f177b1da..c8e28194 100644 --- a/go.sum +++ b/go.sum @@ -30,8 +30,8 @@ cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w9 cloud.google.com/go v0.102.0/go.mod h1:oWcCzKlqJ5zgHQt9YsaeTY9KzIvjyy0ArmiBUgpQ+nc= cloud.google.com/go v0.102.1/go.mod h1:XZ77E9qnTEnrgEOvr4xzfdX5TRo7fB4T2F4O6+34hIU= cloud.google.com/go v0.104.0/go.mod h1:OO6xxXdJyvuJPcEPBLN9BJPD+jep5G1+2U5B5gkRYtA= -cloud.google.com/go v0.111.0 h1:YHLKNupSD1KqjDbQ3+LVdQ81h/UJbJyZG203cEfnQgM= -cloud.google.com/go v0.111.0/go.mod h1:0mibmpKP1TyOOFYQY5izo0LnT+ecvOQ0Sg3OdmMiNRU= +cloud.google.com/go v0.112.0 h1:tpFCD7hpHFlQ8yPwT3x+QeXqc2T6+n6T+hmABHfDUSM= +cloud.google.com/go v0.112.0/go.mod h1:3jEEVwZ/MHU4djK5t5RHuKOA/GbLddgTdVubX1qnPD4= cloud.google.com/go/aiplatform v1.22.0/go.mod h1:ig5Nct50bZlzV6NvKaTwmplLLddFx0YReh9WfTO5jKw= cloud.google.com/go/aiplatform v1.24.0/go.mod h1:67UUvRBKG6GTayHKV8DBv2RtR1t93YRu5B1P3x99mYY= cloud.google.com/go/analytics v0.11.0/go.mod h1:DjEWCu41bVbYcKyvlws9Er60YE4a//bK6mnhWvQeFNI= @@ -171,8 +171,8 @@ cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9 cloud.google.com/go/storage v1.22.1/go.mod h1:S8N1cAStu7BOeFfE8KAQzmyyLkK8p/vmRq6kuBTW58Y= cloud.google.com/go/storage v1.23.0/go.mod h1:vOEEDNFnciUMhBeT6hsJIn3ieU5cFRmzeLgDvXzfIXc= cloud.google.com/go/storage v1.27.0/go.mod h1:x9DOL8TK/ygDUMieqwfhdpQryTeEkhGKMi80i/iqR2s= -cloud.google.com/go/storage v1.35.1 h1:B59ahL//eDfx2IIKFBeT5Atm9wnNmj3+8xG/W4WB//w= -cloud.google.com/go/storage v1.35.1/go.mod h1:M6M/3V/D3KpzMTJyPOR/HU6n2Si5QdaXYEsng2xgOs8= +cloud.google.com/go/storage v1.36.0 h1:P0mOkAcaJxhCTvAkMhxMfrTKiNcub4YmmPBtlhAyTr8= +cloud.google.com/go/storage v1.36.0/go.mod h1:M6M/3V/D3KpzMTJyPOR/HU6n2Si5QdaXYEsng2xgOs8= cloud.google.com/go/talent v1.1.0/go.mod h1:Vl4pt9jiHKvOgF9KoZo6Kob9oV4lwd/ZD5Cto54zDRw= cloud.google.com/go/talent v1.2.0/go.mod h1:MoNF9bhFQbiJ6eFD3uSsg0uBALw4n4gaCaEjBw9zo8g= cloud.google.com/go/videointelligence v1.6.0/go.mod h1:w0DIDlVRKtwPCn/C4iwZIJdvC69yInhW0cfi+p546uU= @@ -297,6 +297,8 @@ github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20231128003011-0fa0005c9caa h1:jQCWAUqqlij9Pgj2i/PB79y4KOPYVyFYdROxgaCwdTQ= +github.com/cncf/xds/go v0.0.0-20231128003011-0fa0005c9caa/go.mod h1:x/1Gn8zydmfq8dk6e9PdstVsDgu9RuyIIJqAaF//0IM= github.com/cockroachdb/apd/v2 v2.0.2 h1:weh8u7Cneje73dDh+2tEVLUvyBc89iwepWCD8b8034E= github.com/cockroachdb/apd/v2 v2.0.2/go.mod h1:DDxRlzC2lo3/vSlmSoS7JkqbbrARPuFOGr0B9pvN3Gw= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= @@ -408,10 +410,12 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.m github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/envoyproxy/protoc-gen-validate v1.0.4 h1:gVPz/FMfvh57HdSJQyvBtF00j8JU4zdyUgIUNhlgg0A= +github.com/envoyproxy/protoc-gen-validate v1.0.4/go.mod h1:qys6tmnRsYrQqIhm2bvKZH4Blx/1gTIZ2UKVY1M+Yew= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= -github.com/felixge/httpsnoop v1.0.2 h1:+nS9g82KMXccJ/wp0zyRW9ZBHFETmMGtkk+2CTTrW4o= -github.com/felixge/httpsnoop v1.0.2/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= +github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= +github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= @@ -446,8 +450,8 @@ github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG github.com/go-logfmt/logfmt v0.6.0 h1:wGYYu3uicYdqXVgoYbvnkrPVXkuLM1p1ifugDMEdRi4= github.com/go-logfmt/logfmt v0.6.0/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= @@ -484,8 +488,8 @@ github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXP github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.1.2 h1:DVjP2PbBOzHyzA+dn3WhHIq4NdVu3Q+pvivFICf/7fo= -github.com/golang/glog v1.1.2/go.mod h1:zR+okUeTbrL6EL3xHUDxZuEtGv04p5shwip1+mL/rLQ= +github.com/golang/glog v1.2.0 h1:uCdmnmatrKCgMBlM4rMuJZWOkPDqdbZPnrMXDY4gI68= +github.com/golang/glog v1.2.0/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -580,8 +584,8 @@ github.com/google/s2a-go v0.1.7/go.mod h1:50CgR4k1jNlWBu4UfS4AcfhVe1r6pdZPygJ3R8 github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4= -github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/enterprise-certificate-proxy v0.0.0-20220520183353-fd19c99a87aa/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= github.com/googleapis/enterprise-certificate-proxy v0.1.0/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= github.com/googleapis/enterprise-certificate-proxy v0.2.0/go.mod h1:8C0jb7/mgJe/9KK8Lm7X9ctZC2t60YyIpYEI16jx0Qg= @@ -1018,14 +1022,18 @@ go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= -go.opentelemetry.io/otel v1.19.0 h1:MuS/TNf4/j4IXsZuJegVzI1cwut7Qc00344rgH7p8bs= -go.opentelemetry.io/otel v1.19.0/go.mod h1:i0QyjOq3UPoTzff0PJB2N66fb4S0+rSbSB15/oyH9fY= -go.opentelemetry.io/otel/metric v1.19.0 h1:aTzpGtV0ar9wlV4Sna9sdJyII5jTVJEvKETPiOKwvpE= -go.opentelemetry.io/otel/metric v1.19.0/go.mod h1:L5rUsV9kM1IxCj1MmSdS+JQAcVm319EUrDVLrt7jqt8= -go.opentelemetry.io/otel/sdk v1.19.0 h1:6USY6zH+L8uMH8L3t1enZPR3WFEmSTADlqldyHtJi3o= -go.opentelemetry.io/otel/sdk v1.19.0/go.mod h1:NedEbbS4w3C6zElbLdPJKOpJQOrGUJ+GfzpjUvI0v1A= -go.opentelemetry.io/otel/trace v1.19.0 h1:DFVQmlVbfVeOuBRrwdtaehRrWiL1JoVs9CPIQ1Dzxpg= -go.opentelemetry.io/otel/trace v1.19.0/go.mod h1:mfaSyvGyEJEI0nyV2I4qhNQnbBOUUmYZpYojqMnX2vo= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1 h1:SpGay3w+nEwMpfVnbqOLH5gY52/foP8RE8UzTZ1pdSE= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1/go.mod h1:4UoMYEZOC0yN/sPGH76KPkkU7zgiEWYWL9vwmbnTJPE= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 h1:aFJWCqJMNjENlcleuuOkGAPH82y0yULBScfXcIEdS24= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1/go.mod h1:sEGXWArGqc3tVa+ekntsN65DmVbVeW+7lTKTjZF3/Fo= +go.opentelemetry.io/otel v1.21.0 h1:hzLeKBZEL7Okw2mGzZ0cc4k/A7Fta0uoPgaJCr8fsFc= +go.opentelemetry.io/otel v1.21.0/go.mod h1:QZzNPQPm1zLX4gZK4cMi+71eaorMSGT3A4znnUvNNEo= +go.opentelemetry.io/otel/metric v1.21.0 h1:tlYWfeo+Bocx5kLEloTjbcDwBuELRrIFxwdQ36PlJu4= +go.opentelemetry.io/otel/metric v1.21.0/go.mod h1:o1p3CA8nNHW8j5yuQLdc1eeqEaPfzug24uvsyIEJRWM= +go.opentelemetry.io/otel/sdk v1.21.0 h1:FTt8qirL1EysG6sTQRZ5TokkU8d0ugCj8htOgThZXQ8= +go.opentelemetry.io/otel/sdk v1.21.0/go.mod h1:Nna6Yv7PWTdgJHVRD9hIYywQBRx7pbox6nwBnZIxl/E= +go.opentelemetry.io/otel/trace v1.21.0 h1:WD9i5gzvoUPuXIXH24ZNBudiarZDKuekPqi/E8fpfLc= +go.opentelemetry.io/otel/trace v1.21.0/go.mod h1:LGbsEB0f9LGjN+OZaQQ26sohbOmiMR+BaslueVtS/qQ= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= @@ -1166,8 +1174,8 @@ golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094/go.mod h1:h4gKUeWbJ4rQPri golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.1.0/go.mod h1:G9FE4dLTsbXUu90h/Pf85g4w1D+SSAgR+q46nJZ8M4A= -golang.org/x/oauth2 v0.15.0 h1:s8pnnxNVzjWyrvYdFUQq5llS1PX2zhPXmccZv99h7uQ= -golang.org/x/oauth2 v0.15.0/go.mod h1:q48ptWNTY5XWf+JNten23lcvHpLJ0ZSxF5ttTHKVCAM= +golang.org/x/oauth2 v0.16.0 h1:aDkGMBSYxElaoP81NpoUoz2oo2R2wHdZpGToUxfyQrQ= +golang.org/x/oauth2 v0.16.0/go.mod h1:hqZ+0LWXsiVoZpeld6jVt06P3adbS2Uu911W1SsJv2o= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1182,8 +1190,8 @@ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= -golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= +golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1421,8 +1429,8 @@ google.golang.org/api v0.96.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ google.golang.org/api v0.97.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= google.golang.org/api v0.98.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= google.golang.org/api v0.100.0/go.mod h1:ZE3Z2+ZOr87Rx7dqFsdRQkRBk36kDtp/h+QpHbB7a70= -google.golang.org/api v0.153.0 h1:N1AwGhielyKFaUqH07/ZSIQR3uNPcV7NVw0vj+j4iR4= -google.golang.org/api v0.153.0/go.mod h1:3qNJX5eOmhiWYc67jRA/3GsDw97UFb5ivv7Y2PrriAY= +google.golang.org/api v0.155.0 h1:vBmGhCYs0djJttDNynWo44zosHlPvHmA0XiN2zP2DtA= +google.golang.org/api v0.155.0/go.mod h1:GI5qK5f40kCpHfPn6+YzGAByIKWv8ujFnmoWm7Igduk= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -1539,12 +1547,12 @@ google.golang.org/genproto v0.0.0-20221010155953-15ba04fc1c0e/go.mod h1:3526vdqw google.golang.org/genproto v0.0.0-20221014173430-6e2ab493f96b/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= google.golang.org/genproto v0.0.0-20221025140454-527a21cfbd71/go.mod h1:9qHF0xnpdSfF6knlcsnpzUu5y+rpwgbvsyGAZPBMg4s= -google.golang.org/genproto v0.0.0-20240102182953-50ed04b92917 h1:nz5NESFLZbJGPFxDT/HCn+V1mZ8JGNoY4nUpmW/Y2eg= -google.golang.org/genproto v0.0.0-20240102182953-50ed04b92917/go.mod h1:pZqR+glSb11aJ+JQcczCvgf47+duRuzNSKqE8YAQnV0= -google.golang.org/genproto/googleapis/api v0.0.0-20231212172506-995d672761c0 h1:s1w3X6gQxwrLEpxnLd/qXTVLgQE2yXwaOaoa6IlY/+o= -google.golang.org/genproto/googleapis/api v0.0.0-20231212172506-995d672761c0/go.mod h1:CAny0tYF+0/9rmDB9fahA9YLzX3+AEVl1qXbv5hhj6c= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240108191215-35c7eff3a6b1 h1:gphdwh0npgs8elJ4T6J+DQJHPVF7RsuJHCfwztUb4J4= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240108191215-35c7eff3a6b1/go.mod h1:daQN87bsDqDoe316QbbvX60nMoJQa4r6Ds0ZuoAe5yA= +google.golang.org/genproto v0.0.0-20240123012728-ef4313101c80 h1:KAeGQVN3M9nD0/bQXnr/ClcEMJ968gUXJQ9pwfSynuQ= +google.golang.org/genproto v0.0.0-20240123012728-ef4313101c80/go.mod h1:cc8bqMqtv9gMOr0zHg2Vzff5ULhhL2IXP4sbcn32Dro= +google.golang.org/genproto/googleapis/api v0.0.0-20240123012728-ef4313101c80 h1:Lj5rbfG876hIAYFjqiJnPHfhXbv+nzTWfm04Fg/XSVU= +google.golang.org/genproto/googleapis/api v0.0.0-20240123012728-ef4313101c80/go.mod h1:4jWUdICTdgc3Ibxmr8nAJiiLHwQBY0UI0XZcEMaFKaA= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 h1:AjyfHzEPEFp/NpvfN5g+KDla3EMojjhRVZc1i7cj+oM= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80/go.mod h1:PAREbraiVEVGVdTZsVWjSbbTtSyGbAgIIvni8a8CD5s= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= @@ -1586,8 +1594,8 @@ google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACu google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.60.1 h1:26+wFr+cNqSGFcOXcabYC0lUVJVRa2Sb2ortSK7VrEU= -google.golang.org/grpc v1.60.1/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= +google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk= +google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= From 8e01887e62d1fcc51bca59a1a1fd88585872adfc Mon Sep 17 00:00:00 2001 From: Raul Bernal Date: Mon, 1 Apr 2024 13:09:45 +0200 Subject: [PATCH 31/37] Bump github.com/stretchr/testify from 1.8.4 to 1.9.0 --- go.mod | 2 +- go.sum | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 1aab2e61..833b0212 100644 --- a/go.mod +++ b/go.mod @@ -19,7 +19,7 @@ require ( github.com/spf13/cast v1.6.0 github.com/spf13/cobra v1.8.0 github.com/spf13/viper v1.18.1 - github.com/stretchr/testify v1.8.4 + github.com/stretchr/testify v1.9.0 google.golang.org/genproto/googleapis/api v0.0.0-20240123012728-ef4313101c80 google.golang.org/grpc v1.62.1 gopkg.in/yaml.v2 v2.4.0 diff --git a/go.sum b/go.sum index c8e28194..eb819346 100644 --- a/go.sum +++ b/go.sum @@ -961,8 +961,9 @@ github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5J github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= @@ -972,8 +973,9 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= From da936df7242b3921c8f65ba7026745efcf7f4b67 Mon Sep 17 00:00:00 2001 From: Raul Bernal Date: Mon, 8 Apr 2024 10:58:12 +0200 Subject: [PATCH 32/37] SEC: bump ibc-go from v7.3.2 to v7.4.0 --- app/upgrades.go | 27 ++++++++++++++++++++++++--- go.mod | 2 +- go.sum | 4 ++-- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/app/upgrades.go b/app/upgrades.go index e96a9139..0d10c5f3 100644 --- a/app/upgrades.go +++ b/app/upgrades.go @@ -3,12 +3,11 @@ package app import ( "fmt" + burnmoduletypes "github.com/BitCannaGlobal/bcna/x/burn/types" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - - burnmoduletypes "github.com/BitCannaGlobal/bcna/x/burn/types" ) // RegisterUpgradeHandlers registers upgrade handlers. @@ -37,6 +36,28 @@ func (app *App) GanjaRevolution47_burn(_ upgradetypes.Plan) { } logger.Info(fmt.Sprintf("post migrate version map: %v", versionMap)) + // Inflation control mechanism - TBD + // // Get the current params from Mint module + // mintParams := app.MintKeeper.GetParams(ctx) + + // // Log the params BEFORE apply the new values + // logger.Info(fmt.Sprintf("Current values for Mint value: InflationMax: %s, InflationMin: %s, InflationRateChange: %s", + // mintParams.InflationMax.String(), mintParams.InflationMin.String(), mintParams.InflationRateChange.String())) + + // // Reduce to half the value of inflation_max, inflation_min and inflation_rate_change + // mintParams.InflationMax = mintParams.InflationMax.Quo(sdk.NewDec(2)) + // mintParams.InflationMin = mintParams.InflationMin.Quo(sdk.NewDec(2)) + // mintParams.InflationRateChange = mintParams.InflationRateChange.Quo(sdk.NewDec(2)) + + // // Set the new values at Mint module + // if err := app.MintKeeper.SetParams(ctx, mintParams); err != nil { + // return nil, err + // } + + // // Log the values after apply the changes + // logger.Info(fmt.Sprintf("New values for Mint value: InflationMax: %s, InflationMin: %s, InflationRateChange: %s", + // mintParams.InflationMax.String(), mintParams.InflationMin.String(), mintParams.InflationRateChange.String())) + return versionMap, err // return app.mm.RunMigrations(ctx, app.configurator, fromVM) }) @@ -50,7 +71,7 @@ func (app *App) GanjaRevolution47_burn(_ upgradetypes.Plan) { storeUpgrades := storetypes.StoreUpgrades{ Added: []string{ - burnmoduletypes.ModuleName, + burnmoduletypes.ModuleName, // Create the Store for the new module: burn // nft.ModuleName, }, } diff --git a/go.mod b/go.mod index 833b0212..219786c5 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/cometbft/cometbft-db v0.11.0 github.com/cosmos/cosmos-sdk v0.47.10 github.com/cosmos/gogoproto v1.4.10 - github.com/cosmos/ibc-go/v7 v7.3.2 + github.com/cosmos/ibc-go/v7 v7.4.0 github.com/golang/protobuf v1.5.4 github.com/gorilla/mux v1.8.0 github.com/grpc-ecosystem/grpc-gateway v1.16.0 diff --git a/go.sum b/go.sum index eb819346..da6e1820 100644 --- a/go.sum +++ b/go.sum @@ -347,8 +347,8 @@ github.com/cosmos/gogoproto v1.4.10 h1:QH/yT8X+c0F4ZDacDv3z+xE3WU1P1Z3wQoLMBRJoK github.com/cosmos/gogoproto v1.4.10/go.mod h1:3aAZzeRWpAwr+SS/LLkICX2/kDFyaYVzckBDzygIxek= github.com/cosmos/iavl v0.20.1 h1:rM1kqeG3/HBT85vsZdoSNsehciqUQPWrR4BYmqE2+zg= github.com/cosmos/iavl v0.20.1/go.mod h1:WO7FyvaZJoH65+HFOsDir7xU9FWk2w9cHXNW1XHcl7A= -github.com/cosmos/ibc-go/v7 v7.3.2 h1:FeUDcBX7VYY0e0iRmcVkPPUjYfAqIc//QuHXo8JHz9c= -github.com/cosmos/ibc-go/v7 v7.3.2/go.mod h1:IMeOXb7gwpZ+/nOG5BuUkdW4weM1ezvN4PQPws4uzOI= +github.com/cosmos/ibc-go/v7 v7.4.0 h1:8FqYMptvksgMvlbN4UW9jFxTXzsPyfAzEZurujXac8M= +github.com/cosmos/ibc-go/v7 v7.4.0/go.mod h1:L/KaEhzV5TGUCTfGysVgMBQtl5Dm7hHitfpk+GIeoAo= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= github.com/cosmos/keyring v1.2.0 h1:8C1lBP9xhImmIabyXW4c3vFjjLiBdGCmfLUfeZlV1Yo= From 1434f87a8edc33e5f6429cf36c8acb5a948d6146 Mon Sep 17 00:00:00 2001 From: Raul Bernal Date: Fri, 12 Apr 2024 23:03:19 +0200 Subject: [PATCH 33/37] WhiteList control --- x/burn/keeper/msg_server_burn_coins_action.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/x/burn/keeper/msg_server_burn_coins_action.go b/x/burn/keeper/msg_server_burn_coins_action.go index 36e2b3df..dfb8c4a9 100644 --- a/x/burn/keeper/msg_server_burn_coins_action.go +++ b/x/burn/keeper/msg_server_burn_coins_action.go @@ -9,15 +9,31 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) +// List of auth. addresses (whitelist) +var authorizedAddresses = map[string]bool{ + "bcna1tdpec339xrucmmr4x73teu3lc2phq45mv07z9n": true, // Vesting account + "bcna1465kg4xaa5sl3vlm02zwe6y7jqltyncvcsygxr": true, // Business Development + "bcna16pczhqlsglmjyyap3785cqnpq30q430jkgw4gk": true, // Marketing + "bcna1tqywev6xmvrnagfq57c0h5susdy3l789rumufz": true, // Test1 + "bcna1h2sz97wffluqtt07zmkky3cvuywv6dzq38zr9r": true, // Test2 + "bcna1zvxldjgetj5u9wah0t8fnz229533xzsmz8y5js": true, // Test3 +} + // Move coins from sender to Bank account module and then the module burns the coins. func (k msgServer) BurnCoinsAction(goCtx context.Context, msg *types.MsgBurnCoinsAction) (*types.MsgBurnCoinsActionResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) + // Validate the address creatorAddr, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { return nil, sdkerrors.ErrInvalidAddress.Wrapf("invalid creator address: %s", err) } + // Check if the address of the creator is whitelisted + if _, ok := authorizedAddresses[msg.Creator]; !ok { + return nil, sdkerrors.ErrUnauthorized.Wrap("address not authorized to burn coins") + } + // Validate the coins coins := sdk.NewCoins(msg.Amount) if !coins.IsValid() { From e7409269114365442a53a716de6f5978fe5c0952 Mon Sep 17 00:00:00 2001 From: Raul Bernal Date: Mon, 15 Apr 2024 12:19:38 +0200 Subject: [PATCH 34/37] Change order of checks --- x/burn/keeper/msg_server_burn_coins_action.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/x/burn/keeper/msg_server_burn_coins_action.go b/x/burn/keeper/msg_server_burn_coins_action.go index dfb8c4a9..14871463 100644 --- a/x/burn/keeper/msg_server_burn_coins_action.go +++ b/x/burn/keeper/msg_server_burn_coins_action.go @@ -14,7 +14,7 @@ var authorizedAddresses = map[string]bool{ "bcna1tdpec339xrucmmr4x73teu3lc2phq45mv07z9n": true, // Vesting account "bcna1465kg4xaa5sl3vlm02zwe6y7jqltyncvcsygxr": true, // Business Development "bcna16pczhqlsglmjyyap3785cqnpq30q430jkgw4gk": true, // Marketing - "bcna1tqywev6xmvrnagfq57c0h5susdy3l789rumufz": true, // Test1 + "bcna1rp6fpd8lry8kgmxaermw8eqlkgr4q9lv3u0eae": true, // Test1 "bcna1h2sz97wffluqtt07zmkky3cvuywv6dzq38zr9r": true, // Test2 "bcna1zvxldjgetj5u9wah0t8fnz229533xzsmz8y5js": true, // Test3 } @@ -29,11 +29,6 @@ func (k msgServer) BurnCoinsAction(goCtx context.Context, msg *types.MsgBurnCoin return nil, sdkerrors.ErrInvalidAddress.Wrapf("invalid creator address: %s", err) } - // Check if the address of the creator is whitelisted - if _, ok := authorizedAddresses[msg.Creator]; !ok { - return nil, sdkerrors.ErrUnauthorized.Wrap("address not authorized to burn coins") - } - // Validate the coins coins := sdk.NewCoins(msg.Amount) if !coins.IsValid() { @@ -50,6 +45,11 @@ func (k msgServer) BurnCoinsAction(goCtx context.Context, msg *types.MsgBurnCoin return nil, errorsmod.Wrap(sdkerrors.ErrInvalidCoins, coins.String()) } + // Check if the address of the creator is whitelisted + if _, ok := authorizedAddresses[msg.Creator]; !ok { + return nil, sdkerrors.ErrUnauthorized.Wrap("address not authorized to burn coins") + } + // Gets the balance of the sender to check if are there enough coins. balance := k.bankKeeper.GetBalance(ctx, creatorAddr, msg.Amount.Denom) if balance.Amount.LT(msg.Amount.Amount) { From 1e74a4274a82bad7aabaa2e2d67ea2562d98f25a Mon Sep 17 00:00:00 2001 From: Raul Bernal Date: Wed, 17 Apr 2024 08:55:15 +0200 Subject: [PATCH 35/37] update Burn whitelist --- x/burn/keeper/msg_server_burn_coins_action.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/x/burn/keeper/msg_server_burn_coins_action.go b/x/burn/keeper/msg_server_burn_coins_action.go index 14871463..391b5f5b 100644 --- a/x/burn/keeper/msg_server_burn_coins_action.go +++ b/x/burn/keeper/msg_server_burn_coins_action.go @@ -11,12 +11,14 @@ import ( // List of auth. addresses (whitelist) var authorizedAddresses = map[string]bool{ - "bcna1tdpec339xrucmmr4x73teu3lc2phq45mv07z9n": true, // Vesting account - "bcna1465kg4xaa5sl3vlm02zwe6y7jqltyncvcsygxr": true, // Business Development - "bcna16pczhqlsglmjyyap3785cqnpq30q430jkgw4gk": true, // Marketing + // "bcna1tdpec339xrucmmr4x73teu3lc2phq45mv07z9n": true, // Vesting account + // "bcna1465kg4xaa5sl3vlm02zwe6y7jqltyncvcsygxr": true, // Business Development + // "bcna16pczhqlsglmjyyap3785cqnpq30q430jkgw4gk": true, // Marketing + "bcna14zzg8gnzmss09jvwldrcg2f85prwwg38fnwjda": true, // BitCore > Cosmos swap leftovers "bcna1rp6fpd8lry8kgmxaermw8eqlkgr4q9lv3u0eae": true, // Test1 "bcna1h2sz97wffluqtt07zmkky3cvuywv6dzq38zr9r": true, // Test2 "bcna1zvxldjgetj5u9wah0t8fnz229533xzsmz8y5js": true, // Test3 + "bcna1tqywev6xmvrnagfq57c0h5susdy3l789rumufz": true, // Test4 } // Move coins from sender to Bank account module and then the module burns the coins. From 68114ab5317f3d29562a4aff8fee62ab92e56622 Mon Sep 17 00:00:00 2001 From: Raul Bernal Date: Wed, 17 Apr 2024 09:10:44 +0200 Subject: [PATCH 36/37] set inflation max and min --- app/upgrades.go | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/app/upgrades.go b/app/upgrades.go index 0d10c5f3..09838025 100644 --- a/app/upgrades.go +++ b/app/upgrades.go @@ -36,27 +36,26 @@ func (app *App) GanjaRevolution47_burn(_ upgradetypes.Plan) { } logger.Info(fmt.Sprintf("post migrate version map: %v", versionMap)) - // Inflation control mechanism - TBD - // // Get the current params from Mint module - // mintParams := app.MintKeeper.GetParams(ctx) - - // // Log the params BEFORE apply the new values - // logger.Info(fmt.Sprintf("Current values for Mint value: InflationMax: %s, InflationMin: %s, InflationRateChange: %s", - // mintParams.InflationMax.String(), mintParams.InflationMin.String(), mintParams.InflationRateChange.String())) - - // // Reduce to half the value of inflation_max, inflation_min and inflation_rate_change - // mintParams.InflationMax = mintParams.InflationMax.Quo(sdk.NewDec(2)) - // mintParams.InflationMin = mintParams.InflationMin.Quo(sdk.NewDec(2)) - // mintParams.InflationRateChange = mintParams.InflationRateChange.Quo(sdk.NewDec(2)) - - // // Set the new values at Mint module - // if err := app.MintKeeper.SetParams(ctx, mintParams); err != nil { - // return nil, err - // } - - // // Log the values after apply the changes - // logger.Info(fmt.Sprintf("New values for Mint value: InflationMax: %s, InflationMin: %s, InflationRateChange: %s", - // mintParams.InflationMax.String(), mintParams.InflationMin.String(), mintParams.InflationRateChange.String())) + // Inflation control mechanism + // Get the current params from Mint module + mintParams := app.MintKeeper.GetParams(ctx) + + // Log the params BEFORE apply the new values + logger.Info(fmt.Sprintf("Current values for Mint value: InflationMax: %s, InflationMin: %s", + mintParams.InflationMax.String(), mintParams.InflationMin.String())) + + // Set fixed values for InflationMax and InflationMin + mintParams.InflationMin = sdk.NewDec(0) // 0% + mintParams.InflationMax = sdk.NewDecWithPrec(7, 2) // 7% + + // Set the new values at Mint module + if err := app.MintKeeper.SetParams(ctx, mintParams); err != nil { + return nil, err + } + + // Log the values after apply the changes + logger.Info(fmt.Sprintf("New values for Mint value: InflationMax: %s, InflationMin: %s", + mintParams.InflationMax.String(), mintParams.InflationMin.String())) return versionMap, err // return app.mm.RunMigrations(ctx, app.configurator, fromVM) From fe28c20132d213aebbadab5d9a1e365390ce1f04 Mon Sep 17 00:00:00 2001 From: Raul Bernal Date: Mon, 6 May 2024 15:55:41 +0200 Subject: [PATCH 37/37] Burn module --- app/upgrades.go | 28 ++++++++++++++-------------- go.mod | 14 +++++++------- go.sum | 28 ++++++++++++++-------------- 3 files changed, 35 insertions(+), 35 deletions(-) diff --git a/app/upgrades.go b/app/upgrades.go index 09838025..bbf44e8e 100644 --- a/app/upgrades.go +++ b/app/upgrades.go @@ -38,24 +38,24 @@ func (app *App) GanjaRevolution47_burn(_ upgradetypes.Plan) { // Inflation control mechanism // Get the current params from Mint module - mintParams := app.MintKeeper.GetParams(ctx) + // mintParams := app.MintKeeper.GetParams(ctx) - // Log the params BEFORE apply the new values - logger.Info(fmt.Sprintf("Current values for Mint value: InflationMax: %s, InflationMin: %s", - mintParams.InflationMax.String(), mintParams.InflationMin.String())) + // // Log the params BEFORE apply the new values + // logger.Info(fmt.Sprintf("Current values for Mint value: InflationMax: %s, InflationMin: %s", + // mintParams.InflationMax.String(), mintParams.InflationMin.String())) - // Set fixed values for InflationMax and InflationMin - mintParams.InflationMin = sdk.NewDec(0) // 0% - mintParams.InflationMax = sdk.NewDecWithPrec(7, 2) // 7% + // // Set fixed values for InflationMax and InflationMin + // mintParams.InflationMin = sdk.NewDec(0) // 0% + // mintParams.InflationMax = sdk.NewDecWithPrec(7, 2) // 7% - // Set the new values at Mint module - if err := app.MintKeeper.SetParams(ctx, mintParams); err != nil { - return nil, err - } + // // Set the new values at Mint module + // if err := app.MintKeeper.SetParams(ctx, mintParams); err != nil { + // return nil, err + // } - // Log the values after apply the changes - logger.Info(fmt.Sprintf("New values for Mint value: InflationMax: %s, InflationMin: %s", - mintParams.InflationMax.String(), mintParams.InflationMin.String())) + // // Log the values after apply the changes + // logger.Info(fmt.Sprintf("New values for Mint value: InflationMax: %s, InflationMin: %s", + // mintParams.InflationMax.String(), mintParams.InflationMin.String())) return versionMap, err // return app.mm.RunMigrations(ctx, app.configurator, fromVM) diff --git a/go.mod b/go.mod index 219786c5..1ffbee8b 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( cosmossdk.io/math v1.3.0 github.com/cometbft/cometbft v0.37.5 github.com/cometbft/cometbft-db v0.11.0 - github.com/cosmos/cosmos-sdk v0.47.10 + github.com/cosmos/cosmos-sdk v0.47.11 github.com/cosmos/gogoproto v1.4.10 github.com/cosmos/ibc-go/v7 v7.4.0 github.com/golang/protobuf v1.5.4 @@ -18,7 +18,7 @@ require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 github.com/spf13/cast v1.6.0 github.com/spf13/cobra v1.8.0 - github.com/spf13/viper v1.18.1 + github.com/spf13/viper v1.18.2 github.com/stretchr/testify v1.9.0 google.golang.org/genproto/googleapis/api v0.0.0-20240123012728-ef4313101c80 google.golang.org/grpc v1.62.1 @@ -58,7 +58,7 @@ require ( github.com/coinbase/rosetta-sdk-go/types v1.0.0 // indirect github.com/confio/ics23/go v0.9.0 // indirect github.com/cosmos/btcutil v1.0.5 // indirect - github.com/cosmos/cosmos-proto v1.0.0-beta.4 // indirect + github.com/cosmos/cosmos-proto v1.0.0-beta.5 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect github.com/cosmos/iavl v0.20.1 // indirect @@ -169,13 +169,13 @@ require ( go.opentelemetry.io/otel/trace v1.21.0 // indirect go.uber.org/atomic v1.10.0 // indirect go.uber.org/multierr v1.9.0 // indirect - golang.org/x/crypto v0.18.0 // indirect + golang.org/x/crypto v0.21.0 // indirect golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect - golang.org/x/net v0.20.0 // indirect + golang.org/x/net v0.23.0 // indirect golang.org/x/oauth2 v0.16.0 // indirect golang.org/x/sync v0.6.0 // indirect - golang.org/x/sys v0.16.0 // indirect - golang.org/x/term v0.16.0 // indirect + golang.org/x/sys v0.18.0 // indirect + golang.org/x/term v0.18.0 // indirect golang.org/x/text v0.14.0 // indirect golang.org/x/time v0.5.0 // indirect google.golang.org/api v0.155.0 // indirect diff --git a/go.sum b/go.sum index da6e1820..163e63f6 100644 --- a/go.sum +++ b/go.sum @@ -333,10 +333,10 @@ github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSV github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= -github.com/cosmos/cosmos-proto v1.0.0-beta.4 h1:aEL7tU/rLOmxZQ9z4i7mzxcLbSCY48OdY7lIWTLG7oU= -github.com/cosmos/cosmos-proto v1.0.0-beta.4/go.mod h1:oeB+FyVzG3XrQJbJng0EnV8Vljfk9XvTIpGILNU/9Co= -github.com/cosmos/cosmos-sdk v0.47.10 h1:Wxf5yEN3jZbG4fftxAMKB6rpd8ME0mxuCVihpz65dt0= -github.com/cosmos/cosmos-sdk v0.47.10/go.mod h1:UWpgWkhcsBIATS68uUC0del7IiBN4hPv/vqg8Zz23uw= +github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= +github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= +github.com/cosmos/cosmos-sdk v0.47.11 h1:0Qx7eORw0RJqPv+mvDuU8NQ1LV3nJJKJnPoYblWHolc= +github.com/cosmos/cosmos-sdk v0.47.11/go.mod h1:ADjORYzUQqQv/FxDi0H0K5gW/rAk1CiDR3ZKsExfJV0= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= @@ -953,8 +953,8 @@ github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnIn github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= -github.com/spf13/viper v1.18.1 h1:rmuU42rScKWlhhJDyXZRKJQHXFX02chSVW1IvkPGiVM= -github.com/spf13/viper v1.18.1/go.mod h1:EKmWIqdnk5lOcmR72yw6hS+8OPYcwD0jteitLMVB+yk= +github.com/spf13/viper v1.18.2 h1:LUXCnvUvSM6FXAsj6nnfc8Q2tp1dIgUfY9Kc8GsSOiQ= +github.com/spf13/viper v1.18.2/go.mod h1:EKmWIqdnk5lOcmR72yw6hS+8OPYcwD0jteitLMVB+yk= github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= @@ -1062,8 +1062,8 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= -golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc= -golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= +golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= +golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb h1:xIApU0ow1zwMa2uL1VDNeQlNVFTWMQxZUZCMDy0Q4Us= golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -1149,8 +1149,8 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= -golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= -golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= +golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= +golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1287,13 +1287,13 @@ golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= -golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.16.0 h1:m+B6fahuftsE9qjo0VWp2FW0mB3MTJvR0BaMQrq0pmE= -golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY= +golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8= +golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=