diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml deleted file mode 100644 index 9095437c..00000000 --- a/.github/workflows/stale.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: "Close stale issues & pull requests" -on: - schedule: - - cron: "0 0 * * *" - -jobs: - stale: - runs-on: ubuntu-latest - steps: - - uses: actions/stale@v4 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - stale-pr-message: "This pull request has been automatically marked as stale because it has not had - recent activity. It will be closed in 7 days-before-close if no further activity occurs." - stale-issue-message: "This issue is stale because it has been open 45 days with no activity. Remove `Status: Stale` label or comment or this will be closed in 7 days." - days-before-stale: 45 - days-before-close: 7 - exempt-issue-labels: "Status: Blocked, Type: Bug, pinned, automerge" - exempt-pr-labels: "Status: Blocked, Type: Bug, pinned, automerge" - stale-pr-label: "Status: Stale" - stale-issue-label: "Status: Stale" diff --git a/.gitignore b/.gitignore index 0949de2f..a33caab6 100644 --- a/.gitignore +++ b/.gitignore @@ -70,4 +70,5 @@ dependency-graph.png # Node.js tests/**/node_modules/* -tests-solidity/**/node_modules/* \ No newline at end of file +tests-solidity/**/node_modules/* +**/**.json \ No newline at end of file diff --git a/DXNS_MODULES_README.md b/DXNS_MODULES_README.md new file mode 100644 index 00000000..07c96fec --- /dev/null +++ b/DXNS_MODULES_README.md @@ -0,0 +1,351 @@ +# Vulcanize chiba-clonk gql + +> Browser : http://localhost:9473 for gql + +## Start server + +```shell +./build/chibaclonkd start --gql-playground --gql-server +``` + +Basic node status: + +```graphql +{ + getStatus { + version + node { + id + network + moniker + } + sync { + latest_block_height + catching_up + } + num_peers + peers { + is_outbound + remote_ip + } + disk_usage + } +} +``` + +Full node status: + +```graphql +{ + getStatus { + version + node { + id + network + moniker + } + sync { + latest_block_hash + latest_block_time + latest_block_height + catching_up + } + validator { + address + voting_power + proposer_priority + } + validators { + address + voting_power + proposer_priority + } + num_peers + peers { + node { + id + network + moniker + } + is_outbound + remote_ip + } + disk_usage + } +} +``` + +Get records by IDs. + +```graphql +{ + getRecordsByIds(ids: ["QmYDtNCKtTu6u6jaHaFAC5PWZXcj7fAmry6NoWwMaixFHz"]) { + id + names + bondId + createTime + expiryTime + owners + attributes { + key + value { + string + } + } + } +} +``` + +Query records. + +```graphql +{ + queryRecords(attributes: [{ key: "type", value: { string: "crn:bot" } }]) { + id + names + bondId + createTime + expiryTime + owners + attributes { + key + value { + string + } + } + } +} +``` + +Get account details: + +```graphql +{ + getAccounts(addresses: ["cosmos1wh8vvd0ymc5nt37h29z8kk2g2ays45ct2qu094"]) { + address + pubKey + number + sequence + balance { + type + quantity + } + } +} +``` + +Query bonds: + +```graphql +{ + queryBonds( + attributes: [ + { + key: "owner" + value: { string: "cosmos1wh8vvd0ymc5nt37h29z8kk2g2ays45ct2qu094" } + } + ] + ) { + id + owner + balance { + type + quantity + } + } +} +``` + +Get bonds by IDs. + +```graphql +{ + getBondsByIds(ids : + [ + "1c2b677cb2a27c88cc6bf8acf675c94b69051125b40c4fd073153b10f046dd87", + "c3f7a78c5042d2003880962ba31ff3b01fcf5942960e0bc3ca331f816346a440" + ]) + { + id + owner + balance{ + type + quantity + } + } +} +``` + +Query Bonds by Owner + +```graphql +{ + queryBondsByOwner(ownerAddresses: ["ethm1mfdjngh5jvjs9lqtt9a7y2hlgw8v3syh3hsqzk"]) + { + owner + bonds{ + id + owner + balance + { + type + quantity + } + } + } +} +``` + +Query auctions by ids + +```graphql +{ + getAuctionsByIds(ids: ["be98f2073c246194276554eefdb4c95b682a35a0f06fbe619a6da57c10c93e90"]){ + id + ownerAddress + createTime + minimumBid{ + type + quantity + } + commitFee{ + type + quantity + } + commitsEndTime + revealFee{ + type + quantity + } + revealsEndTime + winnerBid{ + type + quantity + } + winnerPrice{ + type + quantity + } + winnerAddress + bids{ + bidderAddress + commitHash + commitTime + commitFee{ + type + quantity + } + revealFee{ + type + quantity + } + revealTime + bidAmount{ + type + quantity + } + status + } + } +} +``` + +LookUp Authorities + +```graphql +{ + lookupAuthorities(names: []){ + ownerAddress + ownerAddress + height + bondId + status + expiryTime + auction { + id + ownerAddress + createTime + minimumBid{ + type + quantity + } + commitFee{ + type + quantity + } + commitsEndTime + revealFee{ + type + quantity + } + revealsEndTime + winnerBid{ + type + quantity + } + winnerPrice{ + type + quantity + } + winnerAddress + bids{ + bidderAddress + commitHash + commitTime + commitFee{ + type + quantity + } + revealFee{ + type + quantity + } + revealTime + bidAmount{ + type + quantity + } + status + } + } + } +} +``` + +LookUp Names + +```graphql +{ + lookupNames(names: ["crn://hello/test"]){ + latest{ + id + height + } + history{ + id + height + } + } +} +``` + +Resolve Names + +```graphql +{ + resolveNames(names: ["asd"]){ + id + names + bondId + createTime + expiryTime + owners + attributes { + key + value { + string + } + } + } +} +``` \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 5ae4109c..67cfb08e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ FROM golang:alpine AS build-env ENV PACKAGES git build-base # Set working directory for the build -WORKDIR /go/src/github.com/tharsis/ethermint +WORKDIR /go/src/github.com/vulcanize/chiba-clonk # Install dependencies RUN apk add --update $PACKAGES @@ -24,7 +24,7 @@ RUN apk add --update ca-certificates jq WORKDIR / # Copy over binaries from the build-env -COPY --from=build-env /go/src/github.com/tharsis/ethermint/build/ethermintd /usr/bin/ethermintd +COPY --from=build-env /go/src/github.com/vulcanize/chiba-clonk/build/chibaclonkd /usr/bin/chibaclonkd -# Run ethermintd by default -CMD ["ethermintd"] +# Run chibaclonkd by default +CMD ["chibaclonkd"] diff --git a/Makefile b/Makefile index de98980e..d4870d31 100755 --- a/Makefile +++ b/Makefile @@ -7,13 +7,14 @@ TMVERSION := $(shell go list -m github.com/tendermint/tendermint | sed 's:.* ::' COMMIT := $(shell git log -1 --format='%H') LEDGER_ENABLED ?= true BINDIR ?= $(GOPATH)/bin -ETHERMINT_BINARY = ethermintd -ETHERMINT_DIR = ethermint +CHIBACLONK_BINARY = chibaclonkd +CHIBACLONK_DIR = chibaclonk BUILDDIR ?= $(CURDIR)/build SIMAPP = ./app -HTTPS_GIT := https://github.com/tharsis/ethermint.git +HTTPS_GIT := https://github.com/vulcanize/chiba-clonk.git DOCKER := $(shell which docker) DOCKER_BUF := $(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace bufbuild/buf +PROJECT_NAME = $(shell git remote get-url origin | xargs basename -s .git) export GO111MODULE = on @@ -61,8 +62,8 @@ build_tags_comma_sep := $(subst $(whitespace),$(comma),$(build_tags)) # process linker flags -ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=ethermint \ - -X github.com/cosmos/cosmos-sdk/version.AppName=$(ETHERMINT_BINARY) \ +ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=chibaclonk \ + -X github.com/cosmos/cosmos-sdk/version.AppName=$(CHIBACLONK_BINARY) \ -X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \ -X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT) \ -X "github.com/cosmos/cosmos-sdk/version.BuildTags=$(build_tags_comma_sep)" \ @@ -344,8 +345,8 @@ test-sim-nondeterminism: test-sim-custom-genesis-fast: @echo "Running custom genesis simulation..." - @echo "By default, ${HOME}/.$(ETHERMINT_DIR)/config/genesis.json will be used." - @go test -mod=readonly $(SIMAPP) -run TestFullAppSimulation -Genesis=${HOME}/.$(ETHERMINT_DIR)/config/genesis.json \ + @echo "By default, ${HOME}/.$(CHIBACLONK_DIR)/config/genesis.json will be used." + @go test -mod=readonly $(SIMAPP) -run TestFullAppSimulation -Genesis=${HOME}/.$(CHIBACLONK_DIR)/config/genesis.json \ -Enabled=true -NumBlocks=100 -BlockSize=200 -Commit=true -Seed=99 -Period=5 -v -timeout 24h test-sim-import-export: runsim @@ -358,8 +359,8 @@ test-sim-after-import: runsim test-sim-custom-genesis-multi-seed: runsim @echo "Running multi-seed custom genesis simulation..." - @echo "By default, ${HOME}/.$(ETHERMINT_DIR)/config/genesis.json will be used." - @$(BINDIR)/runsim -Genesis=${HOME}/.$(ETHERMINT_DIR)/config/genesis.json -SimAppPkg=$(SIMAPP) -ExitOnFail 400 5 TestFullAppSimulation + @echo "By default, ${HOME}/.$(CHIBACLONK_DIR)/config/genesis.json will be used." + @$(BINDIR)/runsim -Genesis=${HOME}/.$(CHIBACLONK_DIR)/config/genesis.json -SimAppPkg=$(SIMAPP) -ExitOnFail 400 5 TestFullAppSimulation test-sim-multi-seed-long: runsim @echo "Running long multi-seed application simulation. This may take awhile!" @@ -414,9 +415,9 @@ format-fix: containerProtoVer=v0.2 containerProtoImage=tendermintdev/sdk-proto-gen:$(containerProtoVer) -containerProtoGen=cosmos-sdk-proto-gen-$(containerProtoVer) -containerProtoGenSwagger=cosmos-sdk-proto-gen-swagger-$(containerProtoVer) -containerProtoFmt=cosmos-sdk-proto-fmt-$(containerProtoVer) +containerProtoGen=$(PROJECT_NAME)-proto-gen-$(containerProtoVer) +containerProtoGenSwagger=$(PROJECT_NAME)-proto-gen-swagger-$(containerProtoVer) +containerProtoFmt=$(PROJECT_NAME)-proto-fmt-$(containerProtoVer) proto-all: proto-format proto-lint proto-gen @@ -494,19 +495,19 @@ ifeq ($(OS),Windows_NT) mkdir localnet-setup & @$(MAKE) localnet-build - IF not exist "build/node0/$(ETHERMINT_BINARY)/config/genesis.json" docker run --rm -v $(CURDIR)/build\ethermint\Z ethermintd/node "./ethermintd testnet --v 4 -o /ethermint --keyring-backend=test --ip-addresses ethermintdnode0,ethermintdnode1,ethermintdnode2,ethermintdnode3" + IF not exist "build/node0/$(CHIBACLONK_BINARY)/config/genesis.json" docker run --rm -v $(CURDIR)/build\ethermint\Z chibaclonkd/node sh -c "chibaclonkd testnet init-files --v 4 --keyring-backend=test" docker-compose up -d else mkdir -p localnet-setup @$(MAKE) localnet-build - if ! [ -f localnet-setup/node0/$(ETHERMINT_BINARY)/config/genesis.json ]; then docker run --rm -v $(CURDIR)/localnet-setup:/ethermint:Z ethermintd/node "./ethermintd testnet --v 4 -o /ethermint --keyring-backend=test --ip-addresses ethermintdnode0,ethermintdnode1,ethermintdnode2,ethermintdnode3"; fi + if ! [ -f localnet-setup/node0/$(CHIBACLONK_BINARY)/config/genesis.json ]; then docker run --rm -v $(CURDIR)/localnet-setup:/localnet-setup:Z chibaclonkd/node sh -c "chibaclonkd testnet init-files --v 4 --keyring-backend=test"; fi docker-compose up -d endif # Stop testnet localnet-stop: - docker-compose down + docker-compose down -v # Clean testnet localnet-clean: @@ -517,15 +518,15 @@ localnet-clean: localnet-unsafe-reset: docker-compose down ifeq ($(OS),Windows_NT) - @docker run --rm -v $(CURDIR)\localnet-setup\node0\ethermitd:ethermint\Z ethermintd/node "./ethermintd unsafe-reset-all --home=/ethermint" - @docker run --rm -v $(CURDIR)\localnet-setup\node1\ethermitd:ethermint\Z ethermintd/node "./ethermintd unsafe-reset-all --home=/ethermint" - @docker run --rm -v $(CURDIR)\localnet-setup\node2\ethermitd:ethermint\Z ethermintd/node "./ethermintd unsafe-reset-all --home=/ethermint" - @docker run --rm -v $(CURDIR)\localnet-setup\node3\ethermitd:ethermint\Z ethermintd/node "./ethermintd unsafe-reset-all --home=/ethermint" + @docker run --rm -v $(CURDIR)\localnet-setup\node0\chibaclonkd:chibaclonk\Z chibaclonkd/node "chibaclonkd unsafe-reset-all --home=/chibaclonk" + @docker run --rm -v $(CURDIR)\localnet-setup\node1\chibaclonkd:chibaclonk\Z chibaclonkd/node "chibaclonkd unsafe-reset-all --home=/chibaclonk" + @docker run --rm -v $(CURDIR)\localnet-setup\node2\chibaclonkd:chibaclonk\Z chibaclonkd/node "chibaclonkd unsafe-reset-all --home=/chibaclonk" + @docker run --rm -v $(CURDIR)\localnet-setup\node3\chibaclonkd:chibaclonk\Z chibaclonkd/node "chibaclonkd unsafe-reset-all --home=/chibaclonk" else - @docker run --rm -v $(CURDIR)/localnet-setup/node0/ethermitd:/ethermint:Z ethermintd/node "./ethermintd unsafe-reset-all --home=/ethermint" - @docker run --rm -v $(CURDIR)/localnet-setup/node1/ethermitd:/ethermint:Z ethermintd/node "./ethermintd unsafe-reset-all --home=/ethermint" - @docker run --rm -v $(CURDIR)/localnet-setup/node2/ethermitd:/ethermint:Z ethermintd/node "./ethermintd unsafe-reset-all --home=/ethermint" - @docker run --rm -v $(CURDIR)/localnet-setup/node3/ethermitd:/ethermint:Z ethermintd/node "./ethermintd unsafe-reset-all --home=/ethermint" + @docker run --rm -v $(CURDIR)/localnet-setup/node0/chibaclonkd:/chibaclonk:Z chibaclonkd/node "chibaclonkd unsafe-reset-all --home=/chibaclonk" + @docker run --rm -v $(CURDIR)/localnet-setup/node1/chibaclonkd:/chibaclonk:Z chibaclonkd/node "chibaclonkd unsafe-reset-all --home=/chibaclonk" + @docker run --rm -v $(CURDIR)/localnet-setup/node2/chibaclonkd:/chibaclonk:Z chibaclonkd/node "chibaclonkd unsafe-reset-all --home=/chibaclonk" + @docker run --rm -v $(CURDIR)/localnet-setup/node3/chibaclonkd:/chibaclonk:Z chibaclonkd/node "chibaclonkd unsafe-reset-all --home=/chibaclonk" endif # Clean testnet diff --git a/app/addr_prefixes.go b/app/addr_prefixes.go new file mode 100644 index 00000000..143a15eb --- /dev/null +++ b/app/addr_prefixes.go @@ -0,0 +1,17 @@ +package app + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + cmdcfg "github.com/tharsis/ethermint/cmd/config" +) + +// sdk config +func init() { + config := sdk.GetConfig() + cmdcfg.SetBech32Prefixes(config) + cmdcfg.SetBip44CoinType(config) + config.Seal() + + cmdcfg.RegisterDenoms() +} diff --git a/app/app.go b/app/app.go index 69f70893..8f628640 100644 --- a/app/app.go +++ b/app/app.go @@ -122,6 +122,16 @@ import ( // Force-load the tracer engines to trigger registration due to Go-Ethereum v1.10.15 changes _ "github.com/ethereum/go-ethereum/eth/tracers/js" _ "github.com/ethereum/go-ethereum/eth/tracers/native" + + "github.com/tharsis/ethermint/x/auction" + auctionkeeper "github.com/tharsis/ethermint/x/auction/keeper" + auctiontypes "github.com/tharsis/ethermint/x/auction/types" + "github.com/tharsis/ethermint/x/bond" + bondkeeper "github.com/tharsis/ethermint/x/bond/keeper" + bondtypes "github.com/tharsis/ethermint/x/bond/types" + "github.com/tharsis/ethermint/x/nameservice" + nameservicekeeper "github.com/tharsis/ethermint/x/nameservice/keeper" + nameservicetypes "github.com/tharsis/ethermint/x/nameservice/types" ) func init() { @@ -130,10 +140,10 @@ func init() { panic(err) } - DefaultNodeHome = filepath.Join(userHomeDir, ".ethermintd") + DefaultNodeHome = filepath.Join(userHomeDir, ".chibaclonkd") } -const appName = "ethermintd" +const appName = "chibaclonkd" var ( // DefaultNodeHome default home directories for the application daemon @@ -167,6 +177,10 @@ var ( // Ethermint modules evm.AppModuleBasic{}, feemarket.AppModuleBasic{}, + // Vulcanize chiba-clonk modules + auction.AppModuleBasic{}, + bond.AppModuleBasic{}, + nameservice.AppModuleBasic{}, ) // module account permissions @@ -178,7 +192,13 @@ var ( stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, govtypes.ModuleName: {authtypes.Burner}, // ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, - evmtypes.ModuleName: {authtypes.Minter, authtypes.Burner}, // used for secure addition and subtraction of balance using module account + evmtypes.ModuleName: {authtypes.Minter, authtypes.Burner}, // used for secure addition and subtraction of balance using module account + auctiontypes.ModuleName: nil, + auctiontypes.AuctionBurnModuleAccountName: nil, + nameservicetypes.ModuleName: nil, + nameservicetypes.RecordRentModuleAccountName: nil, + nameservicetypes.AuthorityRentModuleAccountName: nil, + bondtypes.ModuleName: nil, } // module accounts that are allowed to receive tokens @@ -236,6 +256,12 @@ type EthermintApp struct { EvmKeeper *evmkeeper.Keeper FeeMarketKeeper feemarketkeeper.Keeper + // chiba-clonk keepers + AuctionKeeper auctionkeeper.Keeper + BondKeeper bondkeeper.Keeper + NameServiceKeeper nameservicekeeper.Keeper + NameServiceRecordKeeper nameservicekeeper.RecordKeeper + // the module manager mm *module.Manager @@ -275,6 +301,10 @@ func NewEthermintApp( // ibchost.StoreKey, ibctransfertypes.StoreKey, // ethermint keys evmtypes.StoreKey, feemarkettypes.StoreKey, + // chiba-clonk keys + auctiontypes.StoreKey, + bondtypes.StoreKey, + nameservicetypes.StoreKey, ) // Add the EVM transient store key @@ -402,6 +432,27 @@ func NewEthermintApp( appCodec, keys[feemarkettypes.StoreKey], app.GetSubspace(feemarkettypes.ModuleName), ) + // Create Vulcanize chiba-clonk keepers + app.AuctionKeeper = auctionkeeper.NewKeeper( + app.AccountKeeper, app.BankKeeper, keys[auctiontypes.StoreKey], + appCodec, app.GetSubspace(auctiontypes.ModuleName), + ) + + app.NameServiceRecordKeeper = nameservicekeeper.NewRecordKeeper(app.AuctionKeeper, keys[nameservicetypes.StoreKey], appCodec) + + app.AuctionKeeper.SetUsageKeepers([]auctiontypes.AuctionUsageKeeper{app.NameServiceRecordKeeper}) + + app.BondKeeper = bondkeeper.NewKeeper( + appCodec, app.AccountKeeper, app.BankKeeper, + []bondtypes.BondUsageKeeper{app.NameServiceRecordKeeper}, keys[bondtypes.StoreKey], app.GetSubspace(bondtypes.ModuleName), + ) + + app.NameServiceKeeper = nameservicekeeper.NewKeeper( + appCodec, app.AccountKeeper, app.BankKeeper, + app.NameServiceRecordKeeper, app.BondKeeper, app.AuctionKeeper, + keys[nameservicetypes.StoreKey], app.GetSubspace(nameservicetypes.ModuleName), + ) + app.EvmKeeper = evmkeeper.NewKeeper( appCodec, keys[evmtypes.StoreKey], tkeys[evmtypes.TransientKey], app.GetSubspace(evmtypes.ModuleName), app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.FeeMarketKeeper, @@ -493,6 +544,10 @@ func NewEthermintApp( // Ethermint app modules evm.NewAppModule(app.EvmKeeper, app.AccountKeeper), feemarket.NewAppModule(app.FeeMarketKeeper), + // chiba-clonk modules + auction.NewAppModule(appCodec, app.AuctionKeeper), + bond.NewAppModule(appCodec, app.BondKeeper), + nameservice.NewAppModule(app.NameServiceKeeper), ) // During begin block slashing happens after distr.BeginBlocker so that @@ -521,6 +576,10 @@ func NewEthermintApp( feegrant.ModuleName, paramstypes.ModuleName, vestingtypes.ModuleName, + // chiba-clonk modules + auctiontypes.ModuleName, + bondtypes.ModuleName, + nameservicetypes.ModuleName, ) // NOTE: fee market module must go last in order to retrieve the block gas used. @@ -544,6 +603,10 @@ func NewEthermintApp( paramstypes.ModuleName, upgradetypes.ModuleName, vestingtypes.ModuleName, + // chiba-clonk modules + auctiontypes.ModuleName, + bondtypes.ModuleName, + nameservicetypes.ModuleName, ) // NOTE: The genutils module must occur after staking so that pools are @@ -571,6 +634,10 @@ func NewEthermintApp( // Ethermint modules evmtypes.ModuleName, feemarkettypes.ModuleName, + // chiba-clonk modules + auctiontypes.ModuleName, + bondtypes.ModuleName, + nameservicetypes.ModuleName, // NOTE: crisis module must go at the end to check for invariants on each module crisistypes.ModuleName, @@ -826,5 +893,9 @@ func initParamsKeeper( // ethermint subspaces paramsKeeper.Subspace(evmtypes.ModuleName) paramsKeeper.Subspace(feemarkettypes.ModuleName) + // chiba-clonk subspaces + paramsKeeper.Subspace(auctiontypes.ModuleName) + paramsKeeper.Subspace(bondtypes.ModuleName) + paramsKeeper.Subspace(nameservicetypes.ModuleName) return paramsKeeper } diff --git a/app/test_helpers.go b/app/test_helpers.go index 01653022..104654eb 100644 --- a/app/test_helpers.go +++ b/app/test_helpers.go @@ -4,11 +4,14 @@ import ( "encoding/json" "time" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/simapp" "github.com/tharsis/ethermint/encoding" "github.com/cosmos/cosmos-sdk/db/memdb" abci "github.com/tendermint/tendermint/abci/types" + "github.com/tendermint/tendermint/crypto/ed25519" "github.com/tendermint/tendermint/libs/log" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" tmtypes "github.com/tendermint/tendermint/types" @@ -61,3 +64,15 @@ func Setup(isCheckTx bool, patchGenesis func(*EthermintApp, simapp.GenesisState) return app } + +// CreateRandomAccounts will generate random accounts +func CreateRandomAccounts(accNum int) []sdk.AccAddress { + // createRandomAccounts is a strategy used by addTestAddrs() in order to generated addresses in random order. + testAddrs := make([]sdk.AccAddress, accNum) + for i := 0; i < accNum; i++ { + pk := ed25519.GenPrivKey().PubKey() + testAddrs[i] = sdk.AccAddress(pk.Address()) + } + + return testAddrs +} diff --git a/client/testnet.go b/client/testnet.go index 9d4aabc9..cf4e9098 100644 --- a/client/testnet.go +++ b/client/testnet.go @@ -89,7 +89,7 @@ type startArgs struct { func addTestnetFlagsToCmd(cmd *cobra.Command) { cmd.Flags().Int(flagNumValidators, 4, "Number of validators to initialize the testnet with") - cmd.Flags().StringP(flagOutputDir, "o", "./.testnets", "Directory to store initialization data for the testnet") + cmd.Flags().StringP(flagOutputDir, "o", "./localnet-setup", "Directory to store initialization data for the testnet") cmd.Flags().String(flags.FlagChainID, "", "genesis file chain-id, if left blank will be randomly created") cmd.Flags().String(sdkserver.FlagMinGasPrices, fmt.Sprintf("0.000006%s", ethermint.AttoPhoton), "Minimum gas prices to accept for transactions; All fees in a tx must meet this minimum (e.g. 0.01photino,0.001stake)") cmd.Flags().String(flags.FlagKeyAlgorithm, string(hd.EthSecp256k1Type), "Key signing algorithm to generate keys for") @@ -126,7 +126,7 @@ or a similar setup where each node has a manually configurable IP address. Note, strict routability for addresses is turned off in the config file. Example: - evmosd testnet init-files --v 4 --output-dir ./.testnets --starting-ip-address 192.168.10.2 + chibaclonkd testnet init-files --v 4 --output-dir ./.testnets --starting-ip-address 192.168.10.2 `, RunE: func(cmd *cobra.Command, _ []string) error { clientCtx, err := client.GetClientQueryContext(cmd) @@ -153,8 +153,8 @@ Example: addTestnetFlagsToCmd(cmd) cmd.Flags().String(flagNodeDirPrefix, "node", "Prefix the directory name for each node with (node results in node0, node1, ...)") - cmd.Flags().String(flagNodeDaemonHome, "evmosd", "Home directory of the node's daemon configuration") - cmd.Flags().String(flagStartingIPAddress, "192.168.0.1", "Starting IP address (192.168.0.1 results in persistent peers list ID0@192.168.0.1:46656, ID1@192.168.0.2:46656, ...)") + cmd.Flags().String(flagNodeDaemonHome, "chibaclonkd", "Home directory of the node's daemon configuration") + cmd.Flags().String(flagStartingIPAddress, "192.168.10.1", "Starting IP address (192.168.10.1 results in persistent peers list ID0@192.168.10.1:46656, ID1@192.168.10.2:46656, ...)") cmd.Flags().String(flags.FlagKeyringBackend, flags.DefaultKeyringBackend, "Select keyring's backend (os|file|test)") return cmd @@ -170,7 +170,7 @@ and generate "v" directories, populated with necessary validator configuration f (private validator, genesis, config, etc.). Example: - evmosd testnet --v 4 --output-dir ./.testnets + chibaclonkd testnet --v 4 --output-dir ./.testnets `, RunE: func(cmd *cobra.Command, _ []string) error { args := startArgs{} diff --git a/cmd/ethermintd/cmd_test.go b/cmd/chibaclonkd/cmd_test.go similarity index 86% rename from cmd/ethermintd/cmd_test.go rename to cmd/chibaclonkd/cmd_test.go index 3fe91e5a..b3ddf0dc 100644 --- a/cmd/ethermintd/cmd_test.go +++ b/cmd/chibaclonkd/cmd_test.go @@ -11,11 +11,11 @@ import ( "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" "github.com/tharsis/ethermint/app" - ethermintd "github.com/tharsis/ethermint/cmd/ethermintd" + chibaclonkd "github.com/tharsis/ethermint/cmd/chibaclonkd" ) func TestInitCmd(t *testing.T) { - rootCmd, _ := ethermintd.NewRootCmd() + rootCmd, _ := chibaclonkd.NewRootCmd() rootCmd.SetArgs([]string{ "init", // Test the init cmd "etherminttest", // Moniker diff --git a/cmd/ethermintd/flags.go b/cmd/chibaclonkd/flags.go similarity index 100% rename from cmd/ethermintd/flags.go rename to cmd/chibaclonkd/flags.go diff --git a/cmd/ethermintd/genaccounts.go b/cmd/chibaclonkd/genaccounts.go similarity index 100% rename from cmd/ethermintd/genaccounts.go rename to cmd/chibaclonkd/genaccounts.go diff --git a/cmd/ethermintd/main.go b/cmd/chibaclonkd/main.go similarity index 56% rename from cmd/ethermintd/main.go rename to cmd/chibaclonkd/main.go index 1676c8a9..f888a0cd 100644 --- a/cmd/ethermintd/main.go +++ b/cmd/chibaclonkd/main.go @@ -5,16 +5,11 @@ import ( "github.com/cosmos/cosmos-sdk/server" svrcmd "github.com/cosmos/cosmos-sdk/server/cmd" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/tharsis/ethermint/app" - cmdcfg "github.com/tharsis/ethermint/cmd/config" ) func main() { - setupConfig() - cmdcfg.RegisterDenoms() - rootCmd, _ := NewRootCmd() if err := svrcmd.Execute(rootCmd, "", app.DefaultNodeHome); err != nil { @@ -27,11 +22,3 @@ func main() { } } } - -func setupConfig() { - // set the address prefixes - config := sdk.GetConfig() - cmdcfg.SetBech32Prefixes(config) - cmdcfg.SetBip44CoinType(config) - config.Seal() -} diff --git a/cmd/ethermintd/root.go b/cmd/chibaclonkd/root.go similarity index 98% rename from cmd/ethermintd/root.go rename to cmd/chibaclonkd/root.go index 758208d5..25045002 100644 --- a/cmd/ethermintd/root.go +++ b/cmd/chibaclonkd/root.go @@ -41,7 +41,7 @@ import ( ethermint "github.com/tharsis/ethermint/types" ) -const EnvPrefix = "ETHERMINT" +const EnvPrefix = "CHIBACLONK" // NewRootCmd creates a new root command for simd. It is called once in the // main function. @@ -60,8 +60,8 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) { WithViper(EnvPrefix) rootCmd := &cobra.Command{ - Use: "ethermintd", - Short: "Ethermint Daemon", + Use: "chibaclonkd", + Short: "Chiba-Clonk Daemon", PersistentPreRunE: func(cmd *cobra.Command, _ []string) error { // set the default command outputs cmd.SetOut(cmd.OutOrStdout()) @@ -128,6 +128,10 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) { // add rosetta rootCmd.AddCommand(sdkserver.RosettaCommand(encodingConfig.InterfaceRegistry, encodingConfig.Codec)) + + // Add flags for GQL server. + rootCmd = srvflags.AddGQLFlags(rootCmd) + return rootCmd, encodingConfig } diff --git a/docker-compose.yml b/docker-compose.yml index 81968f56..afaa00eb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,73 +1,87 @@ version: "3" services: - ethermintdnode0: - container_name: ethermintdnode0 - image: "ethermintd/node" + chibaclonkdnode0: + container_name: chibaclonkdnode0 + image: "chibaclonkd/node" ports: - - "26657:26657" + - "26656-26657:26656-26657" + - "1317:1317" + - "9090:9090" - "8545:8545" - "8546:8546" - "8125:8125" environment: - ID=0 - - LOG=${LOG:-ethermintd.log} + - LOG=${LOG:-chibaclonkd.log} volumes: - - ./localnet-setup/node0/ethermintd:/ethermint:Z + - ./localnet-setup/node0/chibaclonkd:/chibaclonk:Z networks: - - localnet - entrypoint: "bash start-docker.sh" + localnet: + ipv4_address: 192.168.10.1 - ethermintdnode1: - container_name: ethermintdnode1 - image: "ethermintd/node" + chibaclonkdnode1: + container_name: chibaclonkdnode1 + image: "chibaclonkd/node" ports: - - "26658:26657" + - "26666-26667:26656-26657" + - "1318:1317" + - "9091:9090" - "8555:8545" - "8556:8546" - "8126:8125" environment: - ID=1 - - LOG=${LOG:-ethermintd.log} + - LOG=${LOG:-chibaclonkd.log} volumes: - - ./localnet-setup/node1/ethermintd:/ethermint:Z + - ./localnet-setup/node1/chibaclonkd:/chibaclonk:Z networks: - - localnet - entrypoint: "bash start-docker.sh" + localnet: + ipv4_address: 192.168.10.2 - ethermintdnode2: - container_name: ethermintdnode2 - image: "ethermintd/node" + chibaclonkdnode2: + container_name: chibaclonkdnode2 + image: "chibaclonkd/node" environment: - ID=2 - - LOG=${LOG:-ethermintd.log} + - LOG=${LOG:-chibaclonkd.log} ports: - - "26659:26657" + - "26676-26677:26656-26657" + - "1319:1317" + - "9092:9090" - "8565:8545" - "8566:8546" - "8127:8125" volumes: - - ./localnet-setup/node2/ethermintd:/ethermint:Z + - ./localnet-setup/node2/chibaclonkd:/chibaclonk:Z networks: - - localnet - entrypoint: "bash start-docker.sh" + localnet: + ipv4_address: 192.168.10.3 - ethermintdnode3: - container_name: ethermintdnode3 - image: "ethermintd/node" + chibaclonkdnode3: + container_name: chibaclonkdnode3 + image: "chibaclonkd/node" environment: - ID=3 - - LOG=${LOG:-ethermintd.log} + - LOG=${LOG:-chibaclonkd.log} ports: - - "26660:26657" + - "26686-26687:26656-26657" + - "1320:1317" + - "9093:9090" - "8575:8545" - "8576:8546" - "8128:8125" volumes: - - ./localnet-setup/node3/ethermintd:/ethermint:Z + - ./localnet-setup/node3/chibaclonkd:/chibaclonk:Z networks: - - localnet - entrypoint: "bash start-docker.sh" - + localnet: + ipv4_address: 192.168.10.4 + # entrypoint: "sh scripts/start-docker.sh" + networks: localnet: + driver: bridge + ipam: + driver: default + config: + - subnet: 192.168.10.0/16 \ No newline at end of file diff --git a/docs/api/proto-docs.md b/docs/api/proto-docs.md index eb7c82cc..94e938eb 100644 --- a/docs/api/proto-docs.md +++ b/docs/api/proto-docs.md @@ -80,6 +80,149 @@ - [ethermint/types/v1/web3.proto](#ethermint/types/v1/web3.proto) - [ExtensionOptionsWeb3Tx](#ethermint.types.v1.ExtensionOptionsWeb3Tx) +- [vulcanize/auction/v1beta1/types.proto](#vulcanize/auction/v1beta1/types.proto) + - [Auction](#vulcanize.auction.v1beta1.Auction) + - [Auctions](#vulcanize.auction.v1beta1.Auctions) + - [Bid](#vulcanize.auction.v1beta1.Bid) + - [Params](#vulcanize.auction.v1beta1.Params) + +- [vulcanize/auction/v1beta1/genesis.proto](#vulcanize/auction/v1beta1/genesis.proto) + - [GenesisState](#vulcanize.auction.v1beta1.GenesisState) + +- [vulcanize/auction/v1beta1/query.proto](#vulcanize/auction/v1beta1/query.proto) + - [AuctionRequest](#vulcanize.auction.v1beta1.AuctionRequest) + - [AuctionResponse](#vulcanize.auction.v1beta1.AuctionResponse) + - [AuctionsByBidderRequest](#vulcanize.auction.v1beta1.AuctionsByBidderRequest) + - [AuctionsByBidderResponse](#vulcanize.auction.v1beta1.AuctionsByBidderResponse) + - [AuctionsByOwnerRequest](#vulcanize.auction.v1beta1.AuctionsByOwnerRequest) + - [AuctionsByOwnerResponse](#vulcanize.auction.v1beta1.AuctionsByOwnerResponse) + - [AuctionsRequest](#vulcanize.auction.v1beta1.AuctionsRequest) + - [AuctionsResponse](#vulcanize.auction.v1beta1.AuctionsResponse) + - [BalanceRequest](#vulcanize.auction.v1beta1.BalanceRequest) + - [BalanceResponse](#vulcanize.auction.v1beta1.BalanceResponse) + - [BidRequest](#vulcanize.auction.v1beta1.BidRequest) + - [BidResponse](#vulcanize.auction.v1beta1.BidResponse) + - [BidsRequest](#vulcanize.auction.v1beta1.BidsRequest) + - [BidsResponse](#vulcanize.auction.v1beta1.BidsResponse) + - [QueryParamsRequest](#vulcanize.auction.v1beta1.QueryParamsRequest) + - [QueryParamsResponse](#vulcanize.auction.v1beta1.QueryParamsResponse) + + - [Query](#vulcanize.auction.v1beta1.Query) + +- [vulcanize/auction/v1beta1/tx.proto](#vulcanize/auction/v1beta1/tx.proto) + - [MsgCommitBid](#vulcanize.auction.v1beta1.MsgCommitBid) + - [MsgCommitBidResponse](#vulcanize.auction.v1beta1.MsgCommitBidResponse) + - [MsgCreateAuction](#vulcanize.auction.v1beta1.MsgCreateAuction) + - [MsgCreateAuctionResponse](#vulcanize.auction.v1beta1.MsgCreateAuctionResponse) + - [MsgRevealBid](#vulcanize.auction.v1beta1.MsgRevealBid) + - [MsgRevealBidResponse](#vulcanize.auction.v1beta1.MsgRevealBidResponse) + + - [Msg](#vulcanize.auction.v1beta1.Msg) + +- [vulcanize/bond/v1beta1/bond.proto](#vulcanize/bond/v1beta1/bond.proto) + - [Bond](#vulcanize.bond.v1beta1.Bond) + - [Params](#vulcanize.bond.v1beta1.Params) + +- [vulcanize/bond/v1beta1/genesis.proto](#vulcanize/bond/v1beta1/genesis.proto) + - [GenesisState](#vulcanize.bond.v1beta1.GenesisState) + +- [vulcanize/bond/v1beta1/query.proto](#vulcanize/bond/v1beta1/query.proto) + - [QueryGetBondByIdRequest](#vulcanize.bond.v1beta1.QueryGetBondByIdRequest) + - [QueryGetBondByIdResponse](#vulcanize.bond.v1beta1.QueryGetBondByIdResponse) + - [QueryGetBondModuleBalanceRequest](#vulcanize.bond.v1beta1.QueryGetBondModuleBalanceRequest) + - [QueryGetBondModuleBalanceResponse](#vulcanize.bond.v1beta1.QueryGetBondModuleBalanceResponse) + - [QueryGetBondsByOwnerRequest](#vulcanize.bond.v1beta1.QueryGetBondsByOwnerRequest) + - [QueryGetBondsByOwnerResponse](#vulcanize.bond.v1beta1.QueryGetBondsByOwnerResponse) + - [QueryGetBondsRequest](#vulcanize.bond.v1beta1.QueryGetBondsRequest) + - [QueryGetBondsResponse](#vulcanize.bond.v1beta1.QueryGetBondsResponse) + - [QueryParamsRequest](#vulcanize.bond.v1beta1.QueryParamsRequest) + - [QueryParamsResponse](#vulcanize.bond.v1beta1.QueryParamsResponse) + + - [Query](#vulcanize.bond.v1beta1.Query) + +- [vulcanize/bond/v1beta1/tx.proto](#vulcanize/bond/v1beta1/tx.proto) + - [MsgCancelBond](#vulcanize.bond.v1beta1.MsgCancelBond) + - [MsgCancelBondResponse](#vulcanize.bond.v1beta1.MsgCancelBondResponse) + - [MsgCreateBond](#vulcanize.bond.v1beta1.MsgCreateBond) + - [MsgCreateBondResponse](#vulcanize.bond.v1beta1.MsgCreateBondResponse) + - [MsgRefillBond](#vulcanize.bond.v1beta1.MsgRefillBond) + - [MsgRefillBondResponse](#vulcanize.bond.v1beta1.MsgRefillBondResponse) + - [MsgWithdrawBond](#vulcanize.bond.v1beta1.MsgWithdrawBond) + - [MsgWithdrawBondResponse](#vulcanize.bond.v1beta1.MsgWithdrawBondResponse) + + - [Msg](#vulcanize.bond.v1beta1.Msg) + +- [vulcanize/nameservice/v1beta1/nameservice.proto](#vulcanize/nameservice/v1beta1/nameservice.proto) + - [AuctionBidInfo](#vulcanize.nameservice.v1beta1.AuctionBidInfo) + - [AuthorityEntry](#vulcanize.nameservice.v1beta1.AuthorityEntry) + - [BlockChangeSet](#vulcanize.nameservice.v1beta1.BlockChangeSet) + - [NameAuthority](#vulcanize.nameservice.v1beta1.NameAuthority) + - [NameEntry](#vulcanize.nameservice.v1beta1.NameEntry) + - [NameRecord](#vulcanize.nameservice.v1beta1.NameRecord) + - [NameRecordEntry](#vulcanize.nameservice.v1beta1.NameRecordEntry) + - [Params](#vulcanize.nameservice.v1beta1.Params) + - [Record](#vulcanize.nameservice.v1beta1.Record) + - [Signature](#vulcanize.nameservice.v1beta1.Signature) + +- [vulcanize/nameservice/v1beta1/genesis.proto](#vulcanize/nameservice/v1beta1/genesis.proto) + - [GenesisState](#vulcanize.nameservice.v1beta1.GenesisState) + +- [vulcanize/nameservice/v1beta1/query.proto](#vulcanize/nameservice/v1beta1/query.proto) + - [AccountBalance](#vulcanize.nameservice.v1beta1.AccountBalance) + - [ExpiryQueueRecord](#vulcanize.nameservice.v1beta1.ExpiryQueueRecord) + - [GetNameServiceModuleBalanceRequest](#vulcanize.nameservice.v1beta1.GetNameServiceModuleBalanceRequest) + - [GetNameServiceModuleBalanceResponse](#vulcanize.nameservice.v1beta1.GetNameServiceModuleBalanceResponse) + - [QueryGetAuthorityExpiryQueue](#vulcanize.nameservice.v1beta1.QueryGetAuthorityExpiryQueue) + - [QueryGetAuthorityExpiryQueueResponse](#vulcanize.nameservice.v1beta1.QueryGetAuthorityExpiryQueueResponse) + - [QueryGetRecordExpiryQueue](#vulcanize.nameservice.v1beta1.QueryGetRecordExpiryQueue) + - [QueryGetRecordExpiryQueueResponse](#vulcanize.nameservice.v1beta1.QueryGetRecordExpiryQueueResponse) + - [QueryListNameRecordsRequest](#vulcanize.nameservice.v1beta1.QueryListNameRecordsRequest) + - [QueryListNameRecordsResponse](#vulcanize.nameservice.v1beta1.QueryListNameRecordsResponse) + - [QueryListRecordsRequest](#vulcanize.nameservice.v1beta1.QueryListRecordsRequest) + - [QueryListRecordsRequest.KeyValueInput](#vulcanize.nameservice.v1beta1.QueryListRecordsRequest.KeyValueInput) + - [QueryListRecordsRequest.ReferenceInput](#vulcanize.nameservice.v1beta1.QueryListRecordsRequest.ReferenceInput) + - [QueryListRecordsRequest.ValueInput](#vulcanize.nameservice.v1beta1.QueryListRecordsRequest.ValueInput) + - [QueryListRecordsResponse](#vulcanize.nameservice.v1beta1.QueryListRecordsResponse) + - [QueryLookupCrn](#vulcanize.nameservice.v1beta1.QueryLookupCrn) + - [QueryLookupCrnResponse](#vulcanize.nameservice.v1beta1.QueryLookupCrnResponse) + - [QueryParamsRequest](#vulcanize.nameservice.v1beta1.QueryParamsRequest) + - [QueryParamsResponse](#vulcanize.nameservice.v1beta1.QueryParamsResponse) + - [QueryRecordByBondIdRequest](#vulcanize.nameservice.v1beta1.QueryRecordByBondIdRequest) + - [QueryRecordByBondIdResponse](#vulcanize.nameservice.v1beta1.QueryRecordByBondIdResponse) + - [QueryRecordByIdRequest](#vulcanize.nameservice.v1beta1.QueryRecordByIdRequest) + - [QueryRecordByIdResponse](#vulcanize.nameservice.v1beta1.QueryRecordByIdResponse) + - [QueryResolveCrn](#vulcanize.nameservice.v1beta1.QueryResolveCrn) + - [QueryResolveCrnResponse](#vulcanize.nameservice.v1beta1.QueryResolveCrnResponse) + - [QueryWhoisRequest](#vulcanize.nameservice.v1beta1.QueryWhoisRequest) + - [QueryWhoisResponse](#vulcanize.nameservice.v1beta1.QueryWhoisResponse) + + - [Query](#vulcanize.nameservice.v1beta1.Query) + +- [vulcanize/nameservice/v1beta1/tx.proto](#vulcanize/nameservice/v1beta1/tx.proto) + - [MsgAssociateBond](#vulcanize.nameservice.v1beta1.MsgAssociateBond) + - [MsgAssociateBondResponse](#vulcanize.nameservice.v1beta1.MsgAssociateBondResponse) + - [MsgDeleteNameAuthority](#vulcanize.nameservice.v1beta1.MsgDeleteNameAuthority) + - [MsgDeleteNameAuthorityResponse](#vulcanize.nameservice.v1beta1.MsgDeleteNameAuthorityResponse) + - [MsgDissociateBond](#vulcanize.nameservice.v1beta1.MsgDissociateBond) + - [MsgDissociateBondResponse](#vulcanize.nameservice.v1beta1.MsgDissociateBondResponse) + - [MsgDissociateRecords](#vulcanize.nameservice.v1beta1.MsgDissociateRecords) + - [MsgDissociateRecordsResponse](#vulcanize.nameservice.v1beta1.MsgDissociateRecordsResponse) + - [MsgReAssociateRecords](#vulcanize.nameservice.v1beta1.MsgReAssociateRecords) + - [MsgReAssociateRecordsResponse](#vulcanize.nameservice.v1beta1.MsgReAssociateRecordsResponse) + - [MsgRenewRecord](#vulcanize.nameservice.v1beta1.MsgRenewRecord) + - [MsgRenewRecordResponse](#vulcanize.nameservice.v1beta1.MsgRenewRecordResponse) + - [MsgReserveAuthority](#vulcanize.nameservice.v1beta1.MsgReserveAuthority) + - [MsgReserveAuthorityResponse](#vulcanize.nameservice.v1beta1.MsgReserveAuthorityResponse) + - [MsgSetAuthorityBond](#vulcanize.nameservice.v1beta1.MsgSetAuthorityBond) + - [MsgSetAuthorityBondResponse](#vulcanize.nameservice.v1beta1.MsgSetAuthorityBondResponse) + - [MsgSetName](#vulcanize.nameservice.v1beta1.MsgSetName) + - [MsgSetNameResponse](#vulcanize.nameservice.v1beta1.MsgSetNameResponse) + - [MsgSetRecord](#vulcanize.nameservice.v1beta1.MsgSetRecord) + - [MsgSetRecordResponse](#vulcanize.nameservice.v1beta1.MsgSetRecordResponse) + - [Payload](#vulcanize.nameservice.v1beta1.Payload) + + - [Msg](#vulcanize.nameservice.v1beta1.Msg) + - [Scalar Value Types](#scalar-value-types) @@ -1143,6 +1286,1926 @@ authtypes.BaseAccount type. It is compatible with the auth AccountKeeper. + +

Top

+ +## vulcanize/auction/v1beta1/types.proto + + + + + +### Auction +Auction represents a sealed-bid on-chain auction + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `id` | [string](#string) | | | +| `status` | [string](#string) | | | +| `owner_address` | [string](#string) | | Address of the creator of the auction | +| `create_time` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | Timestamp at which the auction was created | +| `commits_end_time` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | Timestamp at which the commits phase concluded | +| `reveals_end_time` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | Timestamp at which the reveals phase concluded | +| `commit_fee` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | Commit and reveal fees must both be paid when committing a bid Reveal fee is returned only if the bid is revealed | +| `reveal_fee` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `minimum_bid` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | Minimum acceptable bid amount for a valid commit | +| `winner_address` | [string](#string) | | Address of the winner | +| `winning_bid` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | Winning bid, i.e., the highest bid | +| `winning_price` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | Amount the winner pays, i.e. the second highest auction | + + + + + + + + +### Auctions + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `auctions` | [Auction](#vulcanize.auction.v1beta1.Auction) | repeated | | + + + + + + + + +### Bid +Bid represents a sealed bid (commit) made during the auction + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `auction_id` | [string](#string) | | | +| `bidder_address` | [string](#string) | | | +| `status` | [string](#string) | | | +| `commit_hash` | [string](#string) | | | +| `commit_time` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | +| `commit_fee` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `reveal_time` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | +| `reveal_fee` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `bid_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | + + + + + + + + +### Params +Params defines the auction module parameters + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `commits_duration` | [google.protobuf.Duration](#google.protobuf.Duration) | | Duration of the commits phase in seconds | +| `reveals_duration` | [google.protobuf.Duration](#google.protobuf.Duration) | | Duration of the reveals phase in seconds | +| `commit_fee` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | Commit fees | +| `reveal_fee` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | Reveal fees | +| `minimum_bid` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | Minimum acceptable bid amount | + + + + + + + + + + + + + + + + +

Top

+ +## vulcanize/auction/v1beta1/genesis.proto + + + + + +### GenesisState +GenesisState defines the genesis state of the auction module + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `params` | [Params](#vulcanize.auction.v1beta1.Params) | | | +| `auctions` | [Auction](#vulcanize.auction.v1beta1.Auction) | repeated | | + + + + + + + + + + + + + + + + +

Top

+ +## vulcanize/auction/v1beta1/query.proto + + + + + +### AuctionRequest +AuctionRequest is the format for querying a specific auction + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `id` | [string](#string) | | Auction ID | + + + + + + + + +### AuctionResponse +AuctionResponse returns the details of the queried auction + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `auction` | [Auction](#vulcanize.auction.v1beta1.Auction) | | Auction details | + + + + + + + + +### AuctionsByBidderRequest +AuctionsByBidderRequest is the format for querying all auctions containing a bidder address + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `bidder_address` | [string](#string) | | Address of the bidder | + + + + + + + + +### AuctionsByBidderResponse +AuctionsByBidderResponse returns all auctions containing a bidder + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `auctions` | [Auctions](#vulcanize.auction.v1beta1.Auctions) | | List of auctions | + + + + + + + + +### AuctionsByOwnerRequest +AuctionsByOwnerRequest is the format for querying all auctions created by an owner + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `owner_address` | [string](#string) | | Address of the owner | + + + + + + + + +### AuctionsByOwnerResponse +AuctionsByOwnerResponse returns all auctions created by an owner + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `auctions` | [Auctions](#vulcanize.auction.v1beta1.Auctions) | | List of auctions | + + + + + + + + +### AuctionsRequest +AuctionsRequest is the format for querying all the auctions + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | pagination defines an optional pagination info for the next request | + + + + + + + + +### AuctionsResponse +AuctionsResponse returns the list of all auctions + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `auctions` | [Auctions](#vulcanize.auction.v1beta1.Auctions) | | List of auctions | +| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | pagination defines an optional pagination info for the next request | + + + + + + + + +### BalanceRequest +BalanceRequest is the format to fetch all balances + + + + + + + + +### BalanceResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `balance` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | Set of all balances within the auction | + + + + + + + + +### BidRequest +BidRequest is the format for querying a specific bid in an auction + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `auction_id` | [string](#string) | | Auction ID | +| `bidder` | [string](#string) | | Bidder address | + + + + + + + + +### BidResponse +BidResponse returns the details of the queried bid + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `bid` | [Bid](#vulcanize.auction.v1beta1.Bid) | | Bid details | + + + + + + + + +### BidsRequest +BidsRequest is the format for querying all bids in an auction + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `auction_id` | [string](#string) | | Auction ID | + + + + + + + + +### BidsResponse +BidsResponse returns details of all bids in an auction + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `bids` | [Bid](#vulcanize.auction.v1beta1.Bid) | repeated | List of bids in the auction | + + + + + + + + +### QueryParamsRequest +QueryParamsRequest is the format to query the parameters of the auction module + + + + + + + + +### QueryParamsResponse +QueryParamsResponse returns parameters of the auction module + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `params` | [Params](#vulcanize.auction.v1beta1.Params) | | | + + + + + + + + + + + + + + +### Query +Query defines the gRPC querier interface for the auction module + +| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | +| ----------- | ------------ | ------------- | ------------| ------- | -------- | +| `Auctions` | [AuctionsRequest](#vulcanize.auction.v1beta1.AuctionsRequest) | [AuctionsResponse](#vulcanize.auction.v1beta1.AuctionsResponse) | Auctions queries all auctions | GET|/vulcanize/auction/v1beta1/auctions| +| `GetAuction` | [AuctionRequest](#vulcanize.auction.v1beta1.AuctionRequest) | [AuctionResponse](#vulcanize.auction.v1beta1.AuctionResponse) | GetAuction queries an auction | GET|/vulcanize/auction/v1beta1/auctions/{id}| +| `GetBid` | [BidRequest](#vulcanize.auction.v1beta1.BidRequest) | [BidResponse](#vulcanize.auction.v1beta1.BidResponse) | GetBid queries an auction bid | GET|/vulcanize/auction/v1beta1/bids/{auction_id}/{bidder}| +| `GetBids` | [BidsRequest](#vulcanize.auction.v1beta1.BidsRequest) | [BidsResponse](#vulcanize.auction.v1beta1.BidsResponse) | GetBids queries all auction bids | GET|/vulcanize/auction/v1beta1/bids/{auction_id}| +| `AuctionsByBidder` | [AuctionsByBidderRequest](#vulcanize.auction.v1beta1.AuctionsByBidderRequest) | [AuctionsByBidderResponse](#vulcanize.auction.v1beta1.AuctionsByBidderResponse) | AuctionsByBidder queries auctions by bidder | GET|/vulcanize/auction/v1beta1/by-bidder/{bidder_address}| +| `AuctionsByOwner` | [AuctionsByOwnerRequest](#vulcanize.auction.v1beta1.AuctionsByOwnerRequest) | [AuctionsByOwnerResponse](#vulcanize.auction.v1beta1.AuctionsByOwnerResponse) | AuctionsByOwner queries auctions by owner | GET|/vulcanize/auction/v1beta1/by-owner/{owner_address}| +| `QueryParams` | [QueryParamsRequest](#vulcanize.auction.v1beta1.QueryParamsRequest) | [QueryParamsResponse](#vulcanize.auction.v1beta1.QueryParamsResponse) | QueryParams implements the params query command | GET|/vulcanize/auction/v1beta1/params| +| `Balance` | [BalanceRequest](#vulcanize.auction.v1beta1.BalanceRequest) | [BalanceResponse](#vulcanize.auction.v1beta1.BalanceResponse) | Balance queries the auction module account balance | GET|/vulcanize/auction/v1beta1/balance| + + + + + + +

Top

+ +## vulcanize/auction/v1beta1/tx.proto + + + + + +### MsgCommitBid +CommitBid defines the message to commit a bid + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `auction_id` | [string](#string) | | Auction ID | +| `commit_hash` | [string](#string) | | Commit Hash | +| `signer` | [string](#string) | | Address of the signer | + + + + + + + + +### MsgCommitBidResponse +MsgCommitBidResponse returns the state of the auction after the bid creation + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `bid` | [Bid](#vulcanize.auction.v1beta1.Bid) | | Auction details | + + + + + + + + +### MsgCreateAuction +MsgCreateAuction defines a create auction message + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `commits_duration` | [google.protobuf.Duration](#google.protobuf.Duration) | | Duration of the commits phase in seconds | +| `reveals_duration` | [google.protobuf.Duration](#google.protobuf.Duration) | | Duration of the reveals phase in seconds | +| `commit_fee` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | Commit fees | +| `reveal_fee` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | Reveal fees | +| `minimum_bid` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | Minimum acceptable bid amount | +| `signer` | [string](#string) | | Address of the signer | + + + + + + + + +### MsgCreateAuctionResponse +MsgCreateAuctionResponse returns the details of the created auction + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `auction` | [Auction](#vulcanize.auction.v1beta1.Auction) | | Auction details | + + + + + + + + +### MsgRevealBid +RevealBid defines the message to reveal a bid + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `auction_id` | [string](#string) | | Auction ID | +| `reveal` | [string](#string) | | Commit Hash | +| `signer` | [string](#string) | | Address of the signer | + + + + + + + + +### MsgRevealBidResponse +MsgRevealBidResponse returns the state of the auction after the bid reveal + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `auction` | [Auction](#vulcanize.auction.v1beta1.Auction) | | Auction details | + + + + + + + + + + + + + + +### Msg +Tx defines the gRPC tx interface + +| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | +| ----------- | ------------ | ------------- | ------------| ------- | -------- | +| `CreateAuction` | [MsgCreateAuction](#vulcanize.auction.v1beta1.MsgCreateAuction) | [MsgCreateAuctionResponse](#vulcanize.auction.v1beta1.MsgCreateAuctionResponse) | CreateAuction is the command for creating an auction | | +| `CommitBid` | [MsgCommitBid](#vulcanize.auction.v1beta1.MsgCommitBid) | [MsgCommitBidResponse](#vulcanize.auction.v1beta1.MsgCommitBidResponse) | CommitBid is the command for committing a bid | | +| `RevealBid` | [MsgRevealBid](#vulcanize.auction.v1beta1.MsgRevealBid) | [MsgRevealBidResponse](#vulcanize.auction.v1beta1.MsgRevealBidResponse) | RevealBid is the command for revealing a bid | | + + + + + + +

Top

+ +## vulcanize/bond/v1beta1/bond.proto + + + + + +### Bond +Bond represents funds deposited by an account for record rent payments. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `id` | [string](#string) | | id is unique identifier of the bond | +| `owner` | [string](#string) | | owner of the bond | +| `balance` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | balance of the bond | + + + + + + + + +### Params +Params defines the bond module parameters + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `max_bond_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | max_bond_amount is maximum amount to bond | + + + + + + + + + + + + + + + + +

Top

+ +## vulcanize/bond/v1beta1/genesis.proto + + + + + +### GenesisState +GenesisState defines the bond module's genesis state. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `params` | [Params](#vulcanize.bond.v1beta1.Params) | | params defines all the parameters of the module. | +| `bonds` | [Bond](#vulcanize.bond.v1beta1.Bond) | repeated | bonds defines all the bonds | + + + + + + + + + + + + + + + + +

Top

+ +## vulcanize/bond/v1beta1/query.proto + + + + + +### QueryGetBondByIdRequest +QueryGetBondById + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `id` | [string](#string) | | | + + + + + + + + +### QueryGetBondByIdResponse +QueryGetBondByIdResponse returns QueryGetBondById query response + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `bond` | [Bond](#vulcanize.bond.v1beta1.Bond) | | | + + + + + + + + +### QueryGetBondModuleBalanceRequest +QueryGetBondModuleBalanceRequest is request type for bond module balance rpc method + + + + + + + + +### QueryGetBondModuleBalanceResponse +QueryGetBondModuleBalanceResponse is the response type for bond module balance rpc method + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `balance` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | + + + + + + + + +### QueryGetBondsByOwnerRequest +QueryGetBondsByOwnerRequest is request type for Query/GetBondsByOwner RPC Method + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `owner` | [string](#string) | | | +| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | pagination defines the pagination in the response. | + + + + + + + + +### QueryGetBondsByOwnerResponse +QueryGetBondsByOwnerResponse is response type for Query/GetBondsByOwner RPC Method + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `bonds` | [Bond](#vulcanize.bond.v1beta1.Bond) | repeated | | +| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | pagination defines the pagination in the response. | + + + + + + + + +### QueryGetBondsRequest +QueryGetBondById queries a bond by bond-id. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | pagination defines an optional pagination for the request. | + + + + + + + + +### QueryGetBondsResponse +QueryGetBondsResponse is response type for get the bonds by bond-id + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `bonds` | [Bond](#vulcanize.bond.v1beta1.Bond) | repeated | | +| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | pagination defines the pagination in the response. | + + + + + + + + +### QueryParamsRequest +QueryParamsRequest is request for query the bond module params + + + + + + + + +### QueryParamsResponse +QueryParamsResponse returns response type of bond module params + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `params` | [Params](#vulcanize.bond.v1beta1.Params) | | | + + + + + + + + + + + + + + +### Query +Query defines the gRPC querier service for bond module + +| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | +| ----------- | ------------ | ------------- | ------------| ------- | -------- | +| `Params` | [QueryParamsRequest](#vulcanize.bond.v1beta1.QueryParamsRequest) | [QueryParamsResponse](#vulcanize.bond.v1beta1.QueryParamsResponse) | Params queries bonds module params. | GET|/vulcanize/bond/v1beta1/params| +| `Bonds` | [QueryGetBondsRequest](#vulcanize.bond.v1beta1.QueryGetBondsRequest) | [QueryGetBondsResponse](#vulcanize.bond.v1beta1.QueryGetBondsResponse) | Bonds queries bonds list. | GET|/vulcanize/bond/v1beta1/bonds| +| `GetBondById` | [QueryGetBondByIdRequest](#vulcanize.bond.v1beta1.QueryGetBondByIdRequest) | [QueryGetBondByIdResponse](#vulcanize.bond.v1beta1.QueryGetBondByIdResponse) | GetBondById | GET|/vulcanize/bond/v1beta1/bonds/{id}| +| `GetBondsByOwner` | [QueryGetBondsByOwnerRequest](#vulcanize.bond.v1beta1.QueryGetBondsByOwnerRequest) | [QueryGetBondsByOwnerResponse](#vulcanize.bond.v1beta1.QueryGetBondsByOwnerResponse) | Get Bonds List by Owner | GET|/vulcanize/bond/v1beta1/by-owner/{owner}| +| `GetBondsModuleBalance` | [QueryGetBondModuleBalanceRequest](#vulcanize.bond.v1beta1.QueryGetBondModuleBalanceRequest) | [QueryGetBondModuleBalanceResponse](#vulcanize.bond.v1beta1.QueryGetBondModuleBalanceResponse) | Get Bonds module balance | GET|/vulcanize/bond/v1beta1/balance| + + + + + + +

Top

+ +## vulcanize/bond/v1beta1/tx.proto + + + + + +### MsgCancelBond +MsgCancelBond defines a SDK message for the cancel the bond. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `id` | [string](#string) | | | +| `signer` | [string](#string) | | | + + + + + + + + +### MsgCancelBondResponse +MsgCancelBondResponse defines the Msg/CancelBond response type. + + + + + + + + +### MsgCreateBond +MsgCreateBond defines a SDK message for creating a new bond. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `signer` | [string](#string) | | | +| `coins` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | + + + + + + + + +### MsgCreateBondResponse +MsgCreateBondResponse defines the Msg/CreateBond response type. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `id` | [string](#string) | | | + + + + + + + + +### MsgRefillBond +MsgRefillBond defines a SDK message for refill the amount for bond. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `id` | [string](#string) | | | +| `signer` | [string](#string) | | | +| `coins` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | + + + + + + + + +### MsgRefillBondResponse +MsgRefillBondResponse defines the Msg/RefillBond response type. + + + + + + + + +### MsgWithdrawBond +MsgWithdrawBond defines a SDK message for withdrawing amount from bond. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `id` | [string](#string) | | | +| `signer` | [string](#string) | | | +| `coins` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | + + + + + + + + +### MsgWithdrawBondResponse +MsgWithdrawBondResponse defines the Msg/WithdrawBond response type. + + + + + + + + + + + + + + +### Msg +Msg defines the bond Msg service. + +| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | +| ----------- | ------------ | ------------- | ------------| ------- | -------- | +| `CreateBond` | [MsgCreateBond](#vulcanize.bond.v1beta1.MsgCreateBond) | [MsgCreateBondResponse](#vulcanize.bond.v1beta1.MsgCreateBondResponse) | CreateBond defines a method for creating a new bond. | | +| `RefillBond` | [MsgRefillBond](#vulcanize.bond.v1beta1.MsgRefillBond) | [MsgRefillBondResponse](#vulcanize.bond.v1beta1.MsgRefillBondResponse) | RefillBond defines a method for refilling amount for bond. | | +| `WithdrawBond` | [MsgWithdrawBond](#vulcanize.bond.v1beta1.MsgWithdrawBond) | [MsgWithdrawBondResponse](#vulcanize.bond.v1beta1.MsgWithdrawBondResponse) | WithdrawBond defines a method for withdrawing amount from bond. | | +| `CancelBond` | [MsgCancelBond](#vulcanize.bond.v1beta1.MsgCancelBond) | [MsgCancelBondResponse](#vulcanize.bond.v1beta1.MsgCancelBondResponse) | CancelBond defines a method for cancelling a bond. | | + + + + + + +

Top

+ +## vulcanize/nameservice/v1beta1/nameservice.proto + + + + + +### AuctionBidInfo +AuctionBidInfo + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `auction_id` | [string](#string) | | | +| `bidder_address` | [string](#string) | | | + + + + + + + + +### AuthorityEntry +AuthorityEntry defines the nameservice module AuthorityEntries + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `name` | [string](#string) | | | +| `entry` | [NameAuthority](#vulcanize.nameservice.v1beta1.NameAuthority) | | | + + + + + + + + +### BlockChangeSet +BlockChangeSet + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `height` | [int64](#int64) | | | +| `records` | [string](#string) | repeated | | +| `auctions` | [string](#string) | repeated | | +| `auction_bids` | [AuctionBidInfo](#vulcanize.nameservice.v1beta1.AuctionBidInfo) | repeated | | +| `authorities` | [string](#string) | repeated | | +| `names` | [string](#string) | repeated | | + + + + + + + + +### NameAuthority +NameAuthority + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `owner_public_key` | [string](#string) | | Owner public key. | +| `owner_address` | [string](#string) | | Owner address. | +| `height` | [uint64](#uint64) | | height at which name/authority was created. | +| `status` | [string](#string) | | | +| `auction_id` | [string](#string) | | | +| `bond_id` | [string](#string) | | | +| `expiry_time` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | + + + + + + + + +### NameEntry +NameEntry + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `name` | [string](#string) | | | +| `entry` | [NameRecord](#vulcanize.nameservice.v1beta1.NameRecord) | | | + + + + + + + + +### NameRecord +NameRecord + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `latest` | [NameRecordEntry](#vulcanize.nameservice.v1beta1.NameRecordEntry) | | | +| `history` | [NameRecordEntry](#vulcanize.nameservice.v1beta1.NameRecordEntry) | repeated | | + + + + + + + + +### NameRecordEntry +NameRecordEntry + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `id` | [string](#string) | | | +| `height` | [uint64](#uint64) | | | + + + + + + + + +### Params +Params defines the nameservice module parameters + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `record_rent` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `record_rent_duration` | [google.protobuf.Duration](#google.protobuf.Duration) | | | +| `authority_rent` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `authority_rent_duration` | [google.protobuf.Duration](#google.protobuf.Duration) | | | +| `authority_grace_period` | [google.protobuf.Duration](#google.protobuf.Duration) | | | +| `authority_auction_enabled` | [bool](#bool) | | | +| `authority_auction_commits_duration` | [google.protobuf.Duration](#google.protobuf.Duration) | | | +| `authority_auction_reveals_duration` | [google.protobuf.Duration](#google.protobuf.Duration) | | | +| `authority_auction_commit_fee` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `authority_auction_reveal_fee` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `authority_auction_minimum_bid` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | + + + + + + + + +### Record +Params defines the nameservice module records + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `id` | [string](#string) | | | +| `bond_id` | [string](#string) | | | +| `create_time` | [string](#string) | | | +| `expiry_time` | [string](#string) | | | +| `deleted` | [bool](#bool) | | | +| `owners` | [string](#string) | repeated | | +| `attributes` | [string](#string) | | | +| `names` | [string](#string) | repeated | | + + + + + + + + +### Signature +Signature + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `sig` | [string](#string) | | | +| `pub_key` | [string](#string) | | | + + + + + + + + + + + + + + + + +

Top

+ +## vulcanize/nameservice/v1beta1/genesis.proto + + + + + +### GenesisState +GenesisState defines the nameservice module's genesis state. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `params` | [Params](#vulcanize.nameservice.v1beta1.Params) | | params defines all the params of nameservice module. | +| `records` | [Record](#vulcanize.nameservice.v1beta1.Record) | repeated | records | +| `authorities` | [AuthorityEntry](#vulcanize.nameservice.v1beta1.AuthorityEntry) | repeated | authorities | +| `names` | [NameEntry](#vulcanize.nameservice.v1beta1.NameEntry) | repeated | names | + + + + + + + + + + + + + + + + +

Top

+ +## vulcanize/nameservice/v1beta1/query.proto + + + + + +### AccountBalance +AccountBalance is nameservice module account balance + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `account_name` | [string](#string) | | | +| `balance` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | + + + + + + + + +### ExpiryQueueRecord +ExpiryQueueRecord + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `id` | [string](#string) | | | +| `value` | [string](#string) | repeated | | + + + + + + + + +### GetNameServiceModuleBalanceRequest +GetNameServiceModuleBalanceRequest is request type for nameservice module accounts balance + + + + + + + + +### GetNameServiceModuleBalanceResponse +GetNameServiceModuleBalanceResponse is response type for nameservice module accounts balance + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `balances` | [AccountBalance](#vulcanize.nameservice.v1beta1.AccountBalance) | repeated | | + + + + + + + + +### QueryGetAuthorityExpiryQueue +QueryGetAuthorityExpiryQueue + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | pagination defines an optional pagination for the request. | + + + + + + + + +### QueryGetAuthorityExpiryQueueResponse +QueryGetAuthorityExpiryQueueResponse + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `authorities` | [ExpiryQueueRecord](#vulcanize.nameservice.v1beta1.ExpiryQueueRecord) | repeated | | +| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | pagination defines the pagination in the response. | + + + + + + + + +### QueryGetRecordExpiryQueue +QueryGetRecordExpiryQueue + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | pagination defines an optional pagination for the request. | + + + + + + + + +### QueryGetRecordExpiryQueueResponse +QueryGetRecordExpiryQueueResponse + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `records` | [ExpiryQueueRecord](#vulcanize.nameservice.v1beta1.ExpiryQueueRecord) | repeated | | +| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | pagination defines the pagination in the response. | + + + + + + + + +### QueryListNameRecordsRequest +QueryListNameRecordsRequest is request type for nameservice names records + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | pagination defines an optional pagination for the request. | + + + + + + + + +### QueryListNameRecordsResponse +QueryListNameRecordsResponse is response type for nameservice names records + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `names` | [NameEntry](#vulcanize.nameservice.v1beta1.NameEntry) | repeated | | +| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | pagination defines the pagination in the response. | + + + + + + + + +### QueryListRecordsRequest +QueryListRecordsRequest is request type for nameservice records list + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `attributes` | [QueryListRecordsRequest.KeyValueInput](#vulcanize.nameservice.v1beta1.QueryListRecordsRequest.KeyValueInput) | repeated | | +| `all` | [bool](#bool) | | | +| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | pagination defines an optional pagination for the request. | + + + + + + + + +### QueryListRecordsRequest.KeyValueInput + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `key` | [string](#string) | | | +| `value` | [QueryListRecordsRequest.ValueInput](#vulcanize.nameservice.v1beta1.QueryListRecordsRequest.ValueInput) | | | + + + + + + + + +### QueryListRecordsRequest.ReferenceInput + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `id` | [string](#string) | | | + + + + + + + + +### QueryListRecordsRequest.ValueInput + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `type` | [string](#string) | | | +| `string` | [string](#string) | | | +| `int` | [int64](#int64) | | | +| `float` | [double](#double) | | | +| `boolean` | [bool](#bool) | | | +| `reference` | [QueryListRecordsRequest.ReferenceInput](#vulcanize.nameservice.v1beta1.QueryListRecordsRequest.ReferenceInput) | | | +| `values` | [QueryListRecordsRequest.ValueInput](#vulcanize.nameservice.v1beta1.QueryListRecordsRequest.ValueInput) | repeated | | + + + + + + + + +### QueryListRecordsResponse +QueryListRecordsResponse is response type for nameservice records list + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `records` | [Record](#vulcanize.nameservice.v1beta1.Record) | repeated | | +| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | pagination defines the pagination in the response. | + + + + + + + + +### QueryLookupCrn +QueryLookupCrn is request type for LookupCrn + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `crn` | [string](#string) | | | + + + + + + + + +### QueryLookupCrnResponse +QueryLookupCrnResponse is response type for QueryLookupCrn + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `name` | [NameRecord](#vulcanize.nameservice.v1beta1.NameRecord) | | | + + + + + + + + +### QueryParamsRequest +QueryParamsRequest is request type for nameservice params + + + + + + + + +### QueryParamsResponse +QueryParamsResponse is response type for nameservice params + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `params` | [Params](#vulcanize.nameservice.v1beta1.Params) | | | + + + + + + + + +### QueryRecordByBondIdRequest +QueryRecordByBondIdRequest is request type for get the records by bond-id + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `id` | [string](#string) | | | +| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | pagination defines an optional pagination for the request. | + + + + + + + + +### QueryRecordByBondIdResponse +QueryRecordByBondIdResponse is response type for records list by bond-id + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `records` | [Record](#vulcanize.nameservice.v1beta1.Record) | repeated | | +| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | pagination defines the pagination in the response. | + + + + + + + + +### QueryRecordByIdRequest +QueryRecordByIdRequest is request type for nameservice records by id + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `id` | [string](#string) | | | + + + + + + + + +### QueryRecordByIdResponse +QueryRecordByIdResponse is response type for nameservice records by id + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `record` | [Record](#vulcanize.nameservice.v1beta1.Record) | | | + + + + + + + + +### QueryResolveCrn +QueryResolveCrn is request type for ResolveCrn + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `crn` | [string](#string) | | | + + + + + + + + +### QueryResolveCrnResponse +QueryResolveCrnResponse is response type for QueryResolveCrn + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `record` | [Record](#vulcanize.nameservice.v1beta1.Record) | | | + + + + + + + + +### QueryWhoisRequest +QueryWhoisRequest is request type for Get NameAuthority + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `name` | [string](#string) | | | + + + + + + + + +### QueryWhoisResponse +QueryWhoisResponse is response type for whois request + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `name_authority` | [NameAuthority](#vulcanize.nameservice.v1beta1.NameAuthority) | | | + + + + + + + + + + + + + + +### Query +Query defines the gRPC querier service for nameservice module + +| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | +| ----------- | ------------ | ------------- | ------------| ------- | -------- | +| `Params` | [QueryParamsRequest](#vulcanize.nameservice.v1beta1.QueryParamsRequest) | [QueryParamsResponse](#vulcanize.nameservice.v1beta1.QueryParamsResponse) | Params queries the nameservice module params. | GET|/vulcanize/nameservice/v1beta1/params| +| `ListRecords` | [QueryListRecordsRequest](#vulcanize.nameservice.v1beta1.QueryListRecordsRequest) | [QueryListRecordsResponse](#vulcanize.nameservice.v1beta1.QueryListRecordsResponse) | List records | GET|/vulcanize/nameservice/v1beta1/records| +| `GetRecord` | [QueryRecordByIdRequest](#vulcanize.nameservice.v1beta1.QueryRecordByIdRequest) | [QueryRecordByIdResponse](#vulcanize.nameservice.v1beta1.QueryRecordByIdResponse) | Get record by id | GET|/vulcanize/nameservice/v1beta1/records/{id}| +| `GetRecordByBondId` | [QueryRecordByBondIdRequest](#vulcanize.nameservice.v1beta1.QueryRecordByBondIdRequest) | [QueryRecordByBondIdResponse](#vulcanize.nameservice.v1beta1.QueryRecordByBondIdResponse) | Get records by bond id | GET|/vulcanize/nameservice/v1beta1/records-by-bond-id/{id}| +| `GetNameServiceModuleBalance` | [GetNameServiceModuleBalanceRequest](#vulcanize.nameservice.v1beta1.GetNameServiceModuleBalanceRequest) | [GetNameServiceModuleBalanceResponse](#vulcanize.nameservice.v1beta1.GetNameServiceModuleBalanceResponse) | Get nameservice module balance | GET|/vulcanize/nameservice/v1beta1/balance| +| `ListNameRecords` | [QueryListNameRecordsRequest](#vulcanize.nameservice.v1beta1.QueryListNameRecordsRequest) | [QueryListNameRecordsResponse](#vulcanize.nameservice.v1beta1.QueryListNameRecordsResponse) | List name records | GET|/vulcanize/nameservice/v1beta1/names| +| `Whois` | [QueryWhoisRequest](#vulcanize.nameservice.v1beta1.QueryWhoisRequest) | [QueryWhoisResponse](#vulcanize.nameservice.v1beta1.QueryWhoisResponse) | Whois method retrieve the name authority info | GET|/vulcanize/nameservice/v1beta1/whois/{name}| +| `LookupCrn` | [QueryLookupCrn](#vulcanize.nameservice.v1beta1.QueryLookupCrn) | [QueryLookupCrnResponse](#vulcanize.nameservice.v1beta1.QueryLookupCrnResponse) | LookupCrn | GET|/vulcanize/nameservice/v1beta1/lookup| +| `ResolveCrn` | [QueryResolveCrn](#vulcanize.nameservice.v1beta1.QueryResolveCrn) | [QueryResolveCrnResponse](#vulcanize.nameservice.v1beta1.QueryResolveCrnResponse) | ResolveCrn | GET|/vulcanize/nameservice/v1beta1/resolve| +| `GetRecordExpiryQueue` | [QueryGetRecordExpiryQueue](#vulcanize.nameservice.v1beta1.QueryGetRecordExpiryQueue) | [QueryGetRecordExpiryQueueResponse](#vulcanize.nameservice.v1beta1.QueryGetRecordExpiryQueueResponse) | GetRecordExpiryQueue | GET|/vulcanize/nameservice/v1beta1/record-expiry| +| `GetAuthorityExpiryQueue` | [QueryGetAuthorityExpiryQueue](#vulcanize.nameservice.v1beta1.QueryGetAuthorityExpiryQueue) | [QueryGetAuthorityExpiryQueueResponse](#vulcanize.nameservice.v1beta1.QueryGetAuthorityExpiryQueueResponse) | GetAuthorityExpiryQueue | GET|/vulcanize/nameservice/v1beta1/authority-expiry| + + + + + + +

Top

+ +## vulcanize/nameservice/v1beta1/tx.proto + + + + + +### MsgAssociateBond +MsgAssociateBond + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `record_id` | [string](#string) | | | +| `bond_id` | [string](#string) | | | +| `signer` | [string](#string) | | | + + + + + + + + +### MsgAssociateBondResponse +MsgAssociateBondResponse + + + + + + + + +### MsgDeleteNameAuthority +MsgDeleteNameAuthority is SDK message for DeleteNameAuthority + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `crn` | [string](#string) | | | +| `signer` | [string](#string) | | | + + + + + + + + +### MsgDeleteNameAuthorityResponse +MsgDeleteNameAuthorityResponse + + + + + + + + +### MsgDissociateBond +MsgDissociateBond is SDK message for Msg/DissociateBond + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `record_id` | [string](#string) | | | +| `signer` | [string](#string) | | | + + + + + + + + +### MsgDissociateBondResponse +MsgDissociateBondResponse is response type for MsgDissociateBond + + + + + + + + +### MsgDissociateRecords +MsgDissociateRecords is SDK message for Msg/DissociateRecords + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `bond_id` | [string](#string) | | | +| `signer` | [string](#string) | | | + + + + + + + + +### MsgDissociateRecordsResponse +MsgDissociateRecordsResponse is response type for MsgDissociateRecords + + + + + + + + +### MsgReAssociateRecords +MsgReAssociateRecords is SDK message for Msg/ReAssociateRecords + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `new_bond_id` | [string](#string) | | | +| `old_bond_id` | [string](#string) | | | +| `signer` | [string](#string) | | | + + + + + + + + +### MsgReAssociateRecordsResponse +MsgReAssociateRecordsResponse is response type for MsgReAssociateRecords + + + + + + + + +### MsgRenewRecord +MsgRenewRecord is SDK message for Renew a record + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `record_id` | [string](#string) | | | +| `signer` | [string](#string) | | | + + + + + + + + +### MsgRenewRecordResponse +MsgRenewRecordResponse + + + + + + + + +### MsgReserveAuthority +MsgReserveName + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `name` | [string](#string) | | | +| `signer` | [string](#string) | | | +| `owner` | [string](#string) | | if creating a sub-authority. | + + + + + + + + +### MsgReserveAuthorityResponse +MsgReserveNameResponse + + + + + + + + +### MsgSetAuthorityBond +MsgSetAuthorityBond is SDK message for SetAuthorityBond + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `name` | [string](#string) | | | +| `bond_id` | [string](#string) | | | +| `signer` | [string](#string) | | | + + + + + + + + +### MsgSetAuthorityBondResponse +MsgSetAuthorityBondResponse + + + + + + + + +### MsgSetName +MsgSetName + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `crn` | [string](#string) | | | +| `cid` | [string](#string) | | | +| `signer` | [string](#string) | | | + + + + + + + + +### MsgSetNameResponse +MsgSetNameResponse + + + + + + + + +### MsgSetRecord +MsgSetRecord + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `bond_id` | [string](#string) | | | +| `signer` | [string](#string) | | | +| `payload` | [Payload](#vulcanize.nameservice.v1beta1.Payload) | | | + + + + + + + + +### MsgSetRecordResponse +MsgSetRecordResponse + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `id` | [string](#string) | | | + + + + + + + + +### Payload +Payload + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `record` | [Record](#vulcanize.nameservice.v1beta1.Record) | | | +| `signatures` | [Signature](#vulcanize.nameservice.v1beta1.Signature) | repeated | | + + + + + + + + + + + + + + +### Msg +Msg + +| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | +| ----------- | ------------ | ------------- | ------------| ------- | -------- | +| `SetRecord` | [MsgSetRecord](#vulcanize.nameservice.v1beta1.MsgSetRecord) | [MsgSetRecordResponse](#vulcanize.nameservice.v1beta1.MsgSetRecordResponse) | SetRecord will records a new record with given payload and bond id | | +| `RenewRecord` | [MsgRenewRecord](#vulcanize.nameservice.v1beta1.MsgRenewRecord) | [MsgRenewRecordResponse](#vulcanize.nameservice.v1beta1.MsgRenewRecordResponse) | Renew Record will renew the expire record | | +| `AssociateBond` | [MsgAssociateBond](#vulcanize.nameservice.v1beta1.MsgAssociateBond) | [MsgAssociateBondResponse](#vulcanize.nameservice.v1beta1.MsgAssociateBondResponse) | AssociateBond | | +| `DissociateBond` | [MsgDissociateBond](#vulcanize.nameservice.v1beta1.MsgDissociateBond) | [MsgDissociateBondResponse](#vulcanize.nameservice.v1beta1.MsgDissociateBondResponse) | DissociateBond | | +| `DissociateRecords` | [MsgDissociateRecords](#vulcanize.nameservice.v1beta1.MsgDissociateRecords) | [MsgDissociateRecordsResponse](#vulcanize.nameservice.v1beta1.MsgDissociateRecordsResponse) | DissociateRecords | | +| `ReAssociateRecords` | [MsgReAssociateRecords](#vulcanize.nameservice.v1beta1.MsgReAssociateRecords) | [MsgReAssociateRecordsResponse](#vulcanize.nameservice.v1beta1.MsgReAssociateRecordsResponse) | ReAssociateRecords | | +| `SetName` | [MsgSetName](#vulcanize.nameservice.v1beta1.MsgSetName) | [MsgSetNameResponse](#vulcanize.nameservice.v1beta1.MsgSetNameResponse) | SetName will store the name with given crn and name | | +| `ReserveName` | [MsgReserveAuthority](#vulcanize.nameservice.v1beta1.MsgReserveAuthority) | [MsgReserveAuthorityResponse](#vulcanize.nameservice.v1beta1.MsgReserveAuthorityResponse) | Reserve name | | +| `DeleteName` | [MsgDeleteNameAuthority](#vulcanize.nameservice.v1beta1.MsgDeleteNameAuthority) | [MsgDeleteNameAuthorityResponse](#vulcanize.nameservice.v1beta1.MsgDeleteNameAuthorityResponse) | Delete Name method will remove authority name | | +| `SetAuthorityBond` | [MsgSetAuthorityBond](#vulcanize.nameservice.v1beta1.MsgSetAuthorityBond) | [MsgSetAuthorityBondResponse](#vulcanize.nameservice.v1beta1.MsgSetAuthorityBondResponse) | SetAuthorityBond | | + + + + + ## Scalar Value Types | .proto Type | Notes | C++ | Java | Python | Go | C# | PHP | Ruby | diff --git a/go.mod b/go.mod index 4f162129..a96602d1 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,7 @@ module github.com/tharsis/ethermint go 1.17 require ( + github.com/99designs/gqlgen v0.17.2 github.com/btcsuite/btcd v0.22.0-beta github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce github.com/cosmos/cosmos-sdk v0.46.0-alpha3.0.20220325134903-a69764f9f01b @@ -10,7 +11,9 @@ require ( github.com/cosmos/go-bip39 v1.0.0 github.com/cosmos/ibc-go/v3 v3.0.0-alpha1.0.20220331200732-34f03df4aa59 github.com/davecgh/go-spew v1.1.1 + github.com/deckarep/golang-set v1.8.0 github.com/ethereum/go-ethereum v1.10.16 + github.com/gibson042/canonicaljson-go v1.0.3 github.com/gogo/protobuf v1.3.3 github.com/golang/protobuf v1.5.2 github.com/gorilla/mux v1.8.0 @@ -18,7 +21,9 @@ require ( github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/holiman/uint256 v1.2.0 github.com/improbable-eng/grpc-web v0.15.0 + github.com/ipfs/go-ipld-cbor v0.0.6 github.com/miguelmota/go-ethereum-hdwallet v0.1.1 + github.com/multiformats/go-multihash v0.1.0 github.com/onsi/ginkgo v1.16.5 github.com/pkg/errors v0.9.1 github.com/rakyll/statik v0.1.7 @@ -33,10 +38,12 @@ require ( github.com/tendermint/tendermint v0.35.2 github.com/tendermint/tm-db v0.6.7 github.com/tyler-smith/go-bip39 v1.1.0 - google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf + github.com/vektah/gqlparser/v2 v2.4.1 + google.golang.org/genproto v0.0.0-20220401170504-314d38edb7de google.golang.org/grpc v1.45.0 google.golang.org/protobuf v1.28.0 gopkg.in/yaml.v2 v2.4.0 + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b ) require ( @@ -47,6 +54,7 @@ require ( github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect github.com/VictoriaMetrics/fastcache v1.6.0 // indirect github.com/Workiva/go-datastructures v1.0.53 // indirect + github.com/agnivade/levenshtein v1.1.0 // indirect github.com/armon/go-metrics v0.3.10 // indirect github.com/aws/aws-sdk-go v1.40.45 // indirect github.com/beorn7/perks v1.0.1 // indirect @@ -67,7 +75,6 @@ require ( github.com/cosmos/ledger-cosmos-go v0.11.1 // indirect github.com/cosmos/ledger-go v0.9.2 // indirect github.com/danieljoos/wincred v1.0.2 // indirect - github.com/deckarep/golang-set v1.8.0 // indirect github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect github.com/dgraph-io/badger/v2 v2.2007.4 // indirect github.com/dgraph-io/badger/v3 v3.2103.2 // indirect @@ -109,11 +116,16 @@ require ( github.com/holiman/bloomfilter/v2 v2.0.3 // indirect github.com/huin/goupnp v1.0.2 // indirect github.com/inconshreveable/mousetrap v1.0.0 // indirect + github.com/ipfs/go-block-format v0.0.2 // indirect + github.com/ipfs/go-cid v0.0.3 // indirect + github.com/ipfs/go-ipfs-util v0.0.1 // indirect + github.com/ipfs/go-ipld-format v0.0.1 // indirect github.com/jackpal/go-nat-pmp v1.0.2 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/jmhodges/levigo v1.0.0 // indirect github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d // indirect github.com/klauspost/compress v1.13.6 // indirect + github.com/klauspost/cpuid/v2 v2.0.9 // indirect github.com/lazyledger/smt v0.2.1-0.20210709230900-03ea40719554 // indirect github.com/lib/pq v1.10.4 // indirect github.com/libp2p/go-buffer-pool v0.0.2 // indirect @@ -121,17 +133,24 @@ require ( github.com/mattn/go-isatty v0.0.14 // indirect github.com/mattn/go-runewidth v0.0.9 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect + github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 // indirect github.com/minio/highwayhash v1.0.2 // indirect + github.com/minio/sha256-simd v1.0.0 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/go-testing-interface v1.0.0 // indirect github.com/mitchellh/mapstructure v1.4.3 // indirect + github.com/mr-tron/base58 v1.2.0 // indirect github.com/mtibben/percent v0.2.1 // indirect + github.com/multiformats/go-base32 v0.0.3 // indirect + github.com/multiformats/go-multibase v0.0.1 // indirect + github.com/multiformats/go-varint v0.0.6 // indirect github.com/nxadm/tail v1.4.8 // indirect github.com/oasisprotocol/curve25519-voi v0.0.0-20210609091139-0a56a4bca00b // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect github.com/pelletier/go-toml v1.9.4 // indirect github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/polydawn/refmt v0.0.0-20190221155625-df39d6c2d992 // indirect github.com/prometheus/client_golang v1.12.1 // indirect github.com/prometheus/client_model v0.2.0 // indirect github.com/prometheus/common v0.33.0 // indirect @@ -141,6 +160,7 @@ require ( github.com/rjeczalik/notify v0.9.1 // indirect github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa // indirect github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect + github.com/spaolacci/murmur3 v1.1.0 // indirect github.com/spf13/afero v1.8.0 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect @@ -152,10 +172,11 @@ require ( github.com/tklauser/go-sysconf v0.3.9 // indirect github.com/tklauser/numcpus v0.3.0 // indirect github.com/ulikunitz/xz v0.5.8 // indirect + github.com/whyrusleeping/cbor-gen v0.0.0-20200123233031-1cdf64d27158 // indirect github.com/zondax/hid v0.9.1-0.20220302062450-5552068d2266 // indirect go.etcd.io/bbolt v1.3.6 // indirect go.opencensus.io v0.23.0 // indirect - golang.org/x/crypto v0.0.0-20220213190939-1e6e3497d506 // indirect + golang.org/x/crypto v0.0.0-20220331220935-ae2d96664a29 // indirect golang.org/x/net v0.0.0-20220225172249-27dd8689420f // indirect golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b // indirect golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect @@ -170,7 +191,7 @@ require ( gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect gopkg.in/olebedev/go-duktape.v3 v3.0.0-20200619000410-60c24ae608a6 // indirect gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect - gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect + lukechampine.com/blake3 v1.1.6 // indirect nhooyr.io/websocket v1.8.6 // indirect sigs.k8s.io/yaml v1.3.0 // indirect ) diff --git a/go.sum b/go.sum index 74661b11..b245dda4 100644 --- a/go.sum +++ b/go.sum @@ -67,6 +67,8 @@ filippo.io/edwards25519 v1.0.0-rc.1 h1:m0VOOB23frXZvAOK44usCgLWvtsxIoMCTBGJZlpmG filippo.io/edwards25519 v1.0.0-rc.1/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns= git.sr.ht/~sircmpwn/getopt v0.0.0-20191230200459-23622cc906b3/go.mod h1:wMEGFFFNuPos7vHmWXfszqImLppbc0wEhh6JBfJIUgw= git.sr.ht/~sircmpwn/go-bare v0.0.0-20210406120253-ab86bc2846d9/go.mod h1:BVJwbDfVjCjoFiKrhkei6NdGcZYpkDkdyCdg1ukytRA= +github.com/99designs/gqlgen v0.17.2 h1:yczvlwMsfcVu/JtejqfrLwXuSP0yZFhmcss3caEvHw8= +github.com/99designs/gqlgen v0.17.2/go.mod h1:K5fzLKwtph+FFgh9j7nFbRUdBKvTcGnsta51fsMTn3o= github.com/Antonboom/errname v0.1.5/go.mod h1:DugbBstvPFQbv/5uLcRRzfrNqKE9tVdVCqWCLp6Cifo= github.com/Antonboom/nilnil v0.1.0/go.mod h1:PhHLvRPSghY5Y7mX4TW+BHZQYo1A8flE5H20D3IPZBo= github.com/Azure/azure-pipeline-go v0.2.1/go.mod h1:UGSo8XybXnIGZ3epmeBw7Jdz+HiUVpqIlpz/HKHylF4= @@ -123,6 +125,9 @@ github.com/adlio/schema v1.2.3 h1:GfKThfEsjS9cCz7gaF8zdXv4cpTdUqdljkKGDTbJjys= github.com/adlio/schema v1.2.3/go.mod h1:nD7ZWmMMbwU12Pqwg+qL0rTvHBrBXfNz+5UQxTfy38M= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c= +github.com/agnivade/levenshtein v1.0.1/go.mod h1:CURSv5d9Uaml+FovSIICkLbAUZ9S4RqaHDIsdSBg7lM= +github.com/agnivade/levenshtein v1.1.0 h1:n6qGwyHG61v3ABce1rPVZklEYRT8NFpCMrpZdBUbYGM= +github.com/agnivade/levenshtein v1.1.0/go.mod h1:veldBMzWxcCG2ZvUTKD2kJNRdCk5hVbJomOvKkmgYbo= github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= @@ -133,6 +138,7 @@ github.com/alexkohler/prealloc v1.0.0/go.mod h1:VetnK3dIgFBBKmg0YnD9F9x6Icjd+9cv github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= github.com/allegro/bigcache v1.2.1 h1:hg1sY1raCwic3Vnsvje6TT7/pnZba83LeFck5NrFKSc= github.com/allegro/bigcache v1.2.1/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= +github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883 h1:bvNMNQO63//z+xNgfBlViaCIJKLlCJ6/fmUseuG0wVQ= github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= github.com/andybalholm/brotli v1.0.2/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y= github.com/andybalholm/brotli v1.0.3/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= @@ -142,6 +148,8 @@ github.com/aokoli/goutils v1.0.1/go.mod h1:SijmP0QR8LtwsmDs8Yii5Z/S4trXFGFC2oO5g github.com/apache/arrow/go/arrow v0.0.0-20191024131854-af6fa24be0db/go.mod h1:VTxUBvSJ3s3eHAg65PNgrsn5BtqCRPdmyXh6rAfdxN0= github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= +github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0 h1:jfIu9sQUG6Ig+0+Ap1h4unLjW6YQJpKZVmUzxsD4E/Q= +github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0/go.mod h1:t2tdKJDJF9BV14lnkjHmOQgcvEKgtqs5a1N3LNdJhGE= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= @@ -341,6 +349,8 @@ github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUn github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WAFKLNi6ZS0675eEUC9y3AlwSbQu1Y= github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= +github.com/dgryski/trifles v0.0.0-20200323201526-dd97f9abfb48 h1:fRzb/w+pyskVMQ+UbP35JkH8yB7MYb4q/qhBarqZE6g= +github.com/dgryski/trifles v0.0.0-20200323201526-dd97f9abfb48/go.mod h1:if7Fbed8SFyPtHLHbg49SI7NAdJiC5WIA09pe59rfAA= github.com/dlclark/regexp2 v1.2.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= github.com/docker/docker v1.4.2-0.20180625184442-8e610b2b55bf/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= @@ -410,6 +420,8 @@ github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x github.com/getkin/kin-openapi v0.53.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4= github.com/getkin/kin-openapi v0.61.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/gibson042/canonicaljson-go v1.0.3 h1:EAyF8L74AWabkyUmrvEFHEt/AGFQeD6RfwbAuf0j1bI= +github.com/gibson042/canonicaljson-go v1.0.3/go.mod h1:DsLpJTThXyGNO+KZlI85C1/KDcImpP67k/RKVjcaEqo= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M= @@ -611,6 +623,7 @@ github.com/googleapis/gax-go/v2 v2.1.1 h1:dp3bWCh+PPO1zjRRiCSczJav13sBvG4UhNyVTa github.com/googleapis/gax-go/v2 v2.1.1/go.mod h1:hddJymUZASv3XPyGkUpKj8pPO47Rmb0eJc8R6ouapiM= github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= github.com/gookit/color v1.5.0/go.mod h1:43aQb+Zerm/BWh2GnrgOQm7ffz7tvQXEKV6BFMl7wAo= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gordonklaus/ineffassign v0.0.0-20200309095847-7953dde2c7bf/go.mod h1:cuNKsD1zp2v6XfE/orVX2QE1LC+i254ceGcVeDT3pTU= github.com/gordonklaus/ineffassign v0.0.0-20210914165742-4cc7213b9bc8/go.mod h1:Qcp2HIAYhR7mNUVSIxZww3Guk4it82ghYcEXIAk+QT0= @@ -660,6 +673,8 @@ github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFb github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0= github.com/gtank/merlin v0.1.1/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= +github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= +github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE= github.com/hashicorp/consul/api v1.10.1/go.mod h1:XjsvQN+RJGWI2TWy1/kqaE16HrR2J/FWgkYjdZQsX9M= github.com/hashicorp/consul/api v1.11.0/go.mod h1:XjsvQN+RJGWI2TWy1/kqaE16HrR2J/FWgkYjdZQsX9M= @@ -756,6 +771,17 @@ github.com/influxdata/promql/v2 v2.12.0/go.mod h1:fxOPu+DY0bqCTCECchSRtWfc+0X19y github.com/influxdata/roaring v0.4.13-0.20180809181101-fc520f41fab6/go.mod h1:bSgUQ7q5ZLSO+bKBGqJiCBGAl+9DxyW63zLTujjUlOE= github.com/influxdata/tdigest v0.0.0-20181121200506-bf2b5ad3c0a9/go.mod h1:Js0mqiSBE6Ffsg94weZZ2c+v/ciT8QRHFOap7EKDrR0= github.com/influxdata/usage-client v0.0.0-20160829180054-6d3895376368/go.mod h1:Wbbw6tYNvwa5dlB6304Sd+82Z3f7PmVZHVKU637d4po= +github.com/ipfs/go-block-format v0.0.2 h1:qPDvcP19izTjU8rgo6p7gTXZlkMkF5bz5G3fqIsSCPE= +github.com/ipfs/go-block-format v0.0.2/go.mod h1:AWR46JfpcObNfg3ok2JHDUfdiHRgWhJgCQF+KIgOPJY= +github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= +github.com/ipfs/go-cid v0.0.3 h1:UIAh32wymBpStoe83YCzwVQQ5Oy/H0FdxvUS6DJDzms= +github.com/ipfs/go-cid v0.0.3/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= +github.com/ipfs/go-ipfs-util v0.0.1 h1:Wz9bL2wB2YBJqggkA4dD7oSmqB4cAnpNbGrlHJulv50= +github.com/ipfs/go-ipfs-util v0.0.1/go.mod h1:spsl5z8KUnrve+73pOhSVZND1SIxPW5RyBCNzQxlJBc= +github.com/ipfs/go-ipld-cbor v0.0.6 h1:pYuWHyvSpIsOOLw4Jy7NbBkCyzLDcl64Bf/LZW7eBQ0= +github.com/ipfs/go-ipld-cbor v0.0.6/go.mod h1:ssdxxaLJPXH7OjF5V4NSjBbcfh+evoR4ukuru0oPXMA= +github.com/ipfs/go-ipld-format v0.0.1 h1:HCu4eB/Gh+KD/Q0M8u888RFkorTWNIL3da4oc5dwc80= +github.com/ipfs/go-ipld-format v0.0.1/go.mod h1:kyJtbkDALmFHv3QR6et67i35QzO3S0dCDnkOJhcZkms= github.com/jackpal/go-nat-pmp v1.0.2-0.20160603034137-1fa385a6f458/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus= github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= @@ -797,6 +823,8 @@ github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHm github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/jsternberg/zap-logfmt v1.0.0/go.mod h1:uvPs/4X51zdkcm5jXl5SYoN+4RK21K8mysFmDaM/h+o= +github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/juju/ratelimit v1.0.1/go.mod h1:qapgC/Gy+xNh9UxzV13HGGl/6UXNN+ct+vwSgWNm/qk= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= @@ -808,6 +836,7 @@ github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q github.com/karalabe/usb v0.0.0-20190919080040-51dc0efba356/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= github.com/karalabe/usb v0.0.0-20211005121534-4c5740d64559/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= github.com/karalabe/usb v0.0.2/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= +github.com/kevinmbeaulieu/eq-go v1.0.0/go.mod h1:G3S8ajA56gKBZm4UB9AOyoOS37JO3roToPzKNM8dtdM= github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d h1:Z+RDyXzjKE0i2sTjZ/b1uxiGtPhFy34Ou/Tk0qwN0kM= github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d/go.mod h1:JJNrCn9otv/2QP4D7SMJBgaleKpOf66PnW6F5WGNRIc= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= @@ -823,7 +852,11 @@ github.com/klauspost/compress v1.13.4/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8 github.com/klauspost/compress v1.13.5/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/klauspost/compress v1.13.6 h1:P76CopJELS0TiO2mebmnzgWaajssP/EszplttgQxcgc= github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= +github.com/klauspost/cpuid v0.0.0-20170728055534-ae7887de9fa5 h1:2U0HzY8BJ8hVwDKIzp7y4voR9CX/nvcfymLmg2UiOio= github.com/klauspost/cpuid v0.0.0-20170728055534-ae7887de9fa5/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= +github.com/klauspost/cpuid/v2 v2.0.4/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= +github.com/klauspost/cpuid/v2 v2.0.9 h1:lgaqFMSdTdQYdZ04uHyN2d/eKdOMyi2YLSvlQIBFYa4= +github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/crc32 v0.0.0-20161016154125-cb6bfca970f6/go.mod h1:+ZoRqAPRLkC4NPOvfYeR5KNOrY6TD+/sAC3HXPZgDYg= github.com/klauspost/pgzip v1.0.2-0.20170402124221-0bf5dcad4ada/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= @@ -865,6 +898,7 @@ github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoR github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= github.com/logrusorgru/aurora v0.0.0-20181002194514-a7b3b318ed4e/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= +github.com/logrusorgru/aurora/v3 v3.0.0/go.mod h1:vsR12bk5grlLvLXAYrBsb5Oc/N+LxAlxggSjiwMnCUc= github.com/lucasjones/reggen v0.0.0-20180717132126-cdb49ff09d77/go.mod h1:5ELEyG+X8f+meRWHuqUOewBOhvHkl7M76pdGEansxW4= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= github.com/lyft/protoc-gen-star v0.5.3/go.mod h1:V0xaHgaf5oCCqmcxYcWiDfTiKsZsRc87/1qhoTACD8w= @@ -878,6 +912,7 @@ github.com/maratori/testpackage v1.0.1/go.mod h1:ddKdw+XG0Phzhx8BFDTKgpWP4i7MpAp github.com/matoous/godox v0.0.0-20210227103229-6504466cf951/go.mod h1:1BELzlh859Sh1c6+90blK8lbYy0kwQf1bYlBhBysy1s= github.com/matryer/is v1.4.0/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU= github.com/matryer/moq v0.0.0-20190312154309-6cfb0558e1bd/go.mod h1:9ELz6aaclSIGnZBoaSLZ3NAl1VTufbOrXBPvtcy6WiQ= +github.com/matryer/moq v0.2.3/go.mod h1:9RtPYjTnH1bSBIkpvtHkFN7nbWAnO7oRpdJkEIn6UtE= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.0/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= @@ -925,9 +960,15 @@ github.com/miekg/pkcs11 v1.0.3/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WT github.com/miguelmota/go-ethereum-hdwallet v0.1.1 h1:zdXGlHao7idpCBjEGTXThVAtMKs+IxAgivZ75xqkWK0= github.com/miguelmota/go-ethereum-hdwallet v0.1.1/go.mod h1:f9m9uXokAHA6WNoYOPjj4AqjJS5pquQRiYYj/XSyPYc= github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= +github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= +github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= github.com/minio/highwayhash v1.0.1/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= github.com/minio/highwayhash v1.0.2 h1:Aak5U0nElisjDCfPSG79Tgzkn2gl66NxOMspRrKnA/g= github.com/minio/highwayhash v1.0.2/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= +github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= +github.com/minio/sha256-simd v0.1.1-0.20190913151208-6de447530771/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM= +github.com/minio/sha256-simd v1.0.0 h1:v1ta+49hkWZyvaKwrQB8elexRqm6Y0aMLjCNsrYxo6g= +github.com/minio/sha256-simd v1.0.0/go.mod h1:OuYzVNI5vcoYIAmbIvHPl3N3jUzVedXbKy5RFepssQM= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= github.com/mitchellh/cli v1.1.0/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXxx3xhI= github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= @@ -941,6 +982,7 @@ github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS4 github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.2.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.4.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.4.3 h1:OVowDSCllw/YjdLkam3/sm7wEtOy59d8ndGgCcyj8cs= @@ -961,11 +1003,25 @@ github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwd github.com/moricho/tparallel v0.2.1/go.mod h1:fXEIZxG2vdfl0ZF8b42f5a78EhjjD5mX8qUplsoSU4k= github.com/mozilla/scribe v0.0.0-20180711195314-fb71baf557c1/go.mod h1:FIczTrinKo8VaLxe6PWTPEXRXDIHz2QAwiaBaP5/4a8= github.com/mozilla/tls-observatory v0.0.0-20210609171429-7bc42856d2e5/go.mod h1:FUqVoUPHSEdDR0MnFM3Dh8AU0pZHLXUD127SAJGER/s= +github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= +github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= +github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= +github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= github.com/mroth/weightedrand v0.4.1/go.mod h1:3p2SIcC8al1YMzGhAIoXD+r9olo/g/cdJgAD905gyNE= github.com/mrunalp/fileutils v0.5.0/go.mod h1:M1WthSahJixYnrXQl/DFQuteStB1weuxD2QJNHXfbSQ= github.com/mschoch/smat v0.0.0-20160514031455-90eadee771ae/go.mod h1:qAyveg+e4CE+eKJXWVjKXM4ck2QobLqTDytGJbLLhJg= github.com/mtibben/percent v0.2.1 h1:5gssi8Nqo8QU/r2pynCm+hBQHpkB/uNK7BJCFogWdzs= github.com/mtibben/percent v0.2.1/go.mod h1:KG9uO+SZkUp+VkRHsCdYQV3XSZrrSpR3O9ibNBTZrns= +github.com/multiformats/go-base32 v0.0.3 h1:tw5+NhuwaOjJCC5Pp82QuXbrmLzWg7uxlMFp8Nq/kkI= +github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= +github.com/multiformats/go-multibase v0.0.1 h1:PN9/v21eLywrFWdFNsFKaU04kLJzuYzmrJR+ubhT9qA= +github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= +github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= +github.com/multiformats/go-multihash v0.0.10/go.mod h1:YSLudS+Pi8NHE7o6tb3D8vrpKa63epEDmG8nTduyAew= +github.com/multiformats/go-multihash v0.1.0 h1:CgAgwqk3//SVEw3T+6DqI4mWMyRuDwZtOWcJT0q9+EA= +github.com/multiformats/go-multihash v0.1.0/go.mod h1:RJlXsxt6vHGaia+S8We0ErjhojtKzPP2AH4+kYM7k84= +github.com/multiformats/go-varint v0.0.6 h1:gk85QWKxh3TazbLxED/NlDVv8+q+ReFJk7Y2W/KhfNY= +github.com/multiformats/go-varint v0.0.6/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+SVif2QVs3tOP0zanoHgBEVAwHxUSIzRqU= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= @@ -1084,6 +1140,8 @@ github.com/pkg/term v0.0.0-20180730021639-bffc007b7fd5/go.mod h1:eCbImbZ95eXtAUI github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 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/polydawn/refmt v0.0.0-20190221155625-df39d6c2d992 h1:bzMe+2coZJYHnhGgVlcQKuRy4FSny4ds8dLQjw5P1XE= +github.com/polydawn/refmt v0.0.0-20190221155625-df39d6c2d992/go.mod h1:uIp+gprXxxrWSjjklXD+mN4wed/tMfjMMmN/9+JsA9o= github.com/polyfloyd/go-errorlint v0.0.0-20211125173453-6d6d39c5bb8b/go.mod h1:wi9BfjxjF/bwiZ701TzmfKu6UKC357IOAtNr0Td0Lvw= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s= @@ -1187,6 +1245,7 @@ github.com/segmentio/fasthash v1.0.3/go.mod h1:waKX8l2N8yckOgmSsXJi7x1ZfdKZ4x7KR github.com/segmentio/kafka-go v0.1.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo= github.com/segmentio/kafka-go v0.2.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= +github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c/go.mod h1:/PevMnwAxekIXwN8qQyfc5gl2NlkB3CQlkizAbOkeBs= github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible h1:Bn1aCHHRnjv4Bl16T8rcaFjYSrGrIZvpiGO6P3Q4GpU= @@ -1203,7 +1262,10 @@ github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sivchari/containedctx v1.0.1/go.mod h1:PwZOeqm4/DLoJOqMSIJs3aKqXRX4YO+uXww087KZ7Bw= github.com/sivchari/tenv v1.4.7/go.mod h1:5nF+bITvkebQVanjU6IuMbvIot/7ReNsUV7I5NbprB0= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/goconvey v0.0.0-20190222223459-a17d461953aa/go.mod h1:2RVY1rIf+2J2o/IM9+vPq9RzmHDSseB7FoXiSNIUsoU= +github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/snikch/goodman v0.0.0-20171125024755-10e37e294daa/go.mod h1:oJyF+mSPHbB5mVY2iO9KV3pTt/QbIkGaO8gQ2WrDbP4= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= @@ -1338,6 +1400,9 @@ github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPU github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= github.com/valyala/quicktemplate v1.7.0/go.mod h1:sqKJnoaOF88V07vkO+9FL8fb9uZg/VPSJnLYn+LmLk8= github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc= +github.com/vektah/gqlparser/v2 v2.4.0/go.mod h1:flJWIR04IMQPGz+BXLrORkrARBxv/rtyIAFvd/MceW0= +github.com/vektah/gqlparser/v2 v2.4.1 h1:QOyEn8DAPMUMARGMeshKDkDgNmVoEaEGiDB0uWxcSlQ= +github.com/vektah/gqlparser/v2 v2.4.1/go.mod h1:flJWIR04IMQPGz+BXLrORkrARBxv/rtyIAFvd/MceW0= github.com/vektra/mockery/v2 v2.10.0/go.mod h1:m/WO2UzWzqgVX3nvqpRQq70I4Z7jbSCRhdmkgtp+Ab4= github.com/viki-org/dnscache v0.0.0-20130720023526-c70c1f23c5d8/go.mod h1:dniwbG03GafCjFohMDmz6Zc6oCuiqgH6tGNyXTkHzXE= github.com/vishvananda/netlink v1.1.0/go.mod h1:cTgwzPIzzgDAYoQrMm0EdrjRUBkTqKYppBueQtXaqoE= @@ -1346,6 +1411,10 @@ github.com/vmihailenco/msgpack/v5 v5.3.5/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= github.com/vulcanize/cosmos-sdk v0.46.0-smt-0.0.3-alpha h1:uo9s4iQ5GFqEPBaWWCxc1NndJzvrkPkIbCDz3WorcH4= github.com/vulcanize/cosmos-sdk v0.46.0-smt-0.0.3-alpha/go.mod h1:qvWphKMtDelR8tVWRq1+kQRHgMSanu3hfM/ahK7X86Q= +github.com/warpfork/go-wish v0.0.0-20180510122957-5ad1f5abf436 h1:qOpVTI+BrstcjTZLm2Yz/3sOnqkzj3FQoh0g+E5s3Gc= +github.com/warpfork/go-wish v0.0.0-20180510122957-5ad1f5abf436/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw= +github.com/whyrusleeping/cbor-gen v0.0.0-20200123233031-1cdf64d27158 h1:WXhVOwj2USAXB5oMDwRl3piOux2XMV9TANaYxXHdkoE= +github.com/whyrusleeping/cbor-gen v0.0.0-20200123233031-1cdf64d27158/go.mod h1:Xj/M2wWU+QdTdRbu/L/1dIZY8/Wb2K9pAhtroQuxJJI= github.com/willf/bitset v1.1.3/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xlab/treeprint v0.0.0-20180616005107-d6fb6747feb6/go.mod h1:ce1O1j6UtZfjr22oyGxGLbauSBp2YVXpARAosm7dHBg= @@ -1417,10 +1486,12 @@ golang.org/x/crypto v0.0.0-20180501155221-613d6eafa307/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190909091759-094676da4a83/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -1433,6 +1504,7 @@ 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-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= +golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210314154223-e6e6c4f2bb5b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= @@ -1444,8 +1516,8 @@ golang.org/x/crypto v0.0.0-20210915214749-c084706c2272/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211215165025-cf75a172585e/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= golang.org/x/crypto v0.0.0-20220112180741-5e0467b6c7ce/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.0.0-20220213190939-1e6e3497d506 h1:EuGTJDfeg/PGZJp3gq1K+14eSLFTsrj1eg8KQuiUyKg= -golang.org/x/crypto v0.0.0-20220213190939-1e6e3497d506/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20220331220935-ae2d96664a29 h1:tkVvjkPTB7pnW3jnid7kNyAMPVWllTNOf/qKDze4p9o= +golang.org/x/crypto v0.0.0-20220331220935-ae2d96664a29/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1595,6 +1667,7 @@ 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-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/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= @@ -1661,6 +1734,7 @@ golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210303074136-134d130e1a04/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210309074719-68d13333faf2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210316164454-77fc1eacc6aa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1792,6 +1866,7 @@ golang.org/x/tools v0.0.0-20200724022722-7017fd6b1305/go.mod h1:njjCfa9FT2d7l9Bc golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200812195022-5ae4c3c160a0/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200815165600-90abf76919f3/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200820010801-b793a1359eac/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200831203904-5a2aa26beb65/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= @@ -1959,8 +2034,9 @@ google.golang.org/genproto v0.0.0-20211203200212-54befc351ae9/go.mod h1:5CzLGKJ6 google.golang.org/genproto v0.0.0-20211206160659-862468c7d6e0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20211223182754-3ac035c7e7cb/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf h1:SVYXkUz2yZS9FWb2Gm8ivSlbNQzL2Z/NpPKE3RG2jWk= google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= +google.golang.org/genproto v0.0.0-20220401170504-314d38edb7de h1:9Ti5SG2U4cAcluryUo/sFay3TQKoxiFMfaT0pbizU7k= +google.golang.org/genproto v0.0.0-20220401170504-314d38edb7de/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= google.golang.org/grpc v1.44.0 h1:weqSxi/TMs1SqFRMHCtBgXRs8k3X39QIDEZ0pRcttUg= google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= @@ -2031,6 +2107,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= honnef.co/go/tools v0.1.3/go.mod h1:NgwopIslSNH47DimFoV78dnkksY2EFtX0ajyb3K/las= honnef.co/go/tools v0.2.2/go.mod h1:lPVVZ2BS5TfnjLyizF7o7hv7j9/L+8cZY2hLyjP9cGY= +lukechampine.com/blake3 v1.1.6 h1:H3cROdztr7RCfoaTpGZFQsrqvweFLrqS73j7L7cmR5c= +lukechampine.com/blake3 v1.1.6/go.mod h1:tkKEOtDkNtklkXtLNEOGNq5tcV90tJiA1vAA12R78LA= mvdan.cc/gofumpt v0.2.1/go.mod h1:a/rvZPhsNaedOJBzqRD9omnwVwHZsBdJirXHa9Gh9Ig= mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc= mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4= diff --git a/gql/README.md b/gql/README.md new file mode 100644 index 00000000..07c96fec --- /dev/null +++ b/gql/README.md @@ -0,0 +1,351 @@ +# Vulcanize chiba-clonk gql + +> Browser : http://localhost:9473 for gql + +## Start server + +```shell +./build/chibaclonkd start --gql-playground --gql-server +``` + +Basic node status: + +```graphql +{ + getStatus { + version + node { + id + network + moniker + } + sync { + latest_block_height + catching_up + } + num_peers + peers { + is_outbound + remote_ip + } + disk_usage + } +} +``` + +Full node status: + +```graphql +{ + getStatus { + version + node { + id + network + moniker + } + sync { + latest_block_hash + latest_block_time + latest_block_height + catching_up + } + validator { + address + voting_power + proposer_priority + } + validators { + address + voting_power + proposer_priority + } + num_peers + peers { + node { + id + network + moniker + } + is_outbound + remote_ip + } + disk_usage + } +} +``` + +Get records by IDs. + +```graphql +{ + getRecordsByIds(ids: ["QmYDtNCKtTu6u6jaHaFAC5PWZXcj7fAmry6NoWwMaixFHz"]) { + id + names + bondId + createTime + expiryTime + owners + attributes { + key + value { + string + } + } + } +} +``` + +Query records. + +```graphql +{ + queryRecords(attributes: [{ key: "type", value: { string: "crn:bot" } }]) { + id + names + bondId + createTime + expiryTime + owners + attributes { + key + value { + string + } + } + } +} +``` + +Get account details: + +```graphql +{ + getAccounts(addresses: ["cosmos1wh8vvd0ymc5nt37h29z8kk2g2ays45ct2qu094"]) { + address + pubKey + number + sequence + balance { + type + quantity + } + } +} +``` + +Query bonds: + +```graphql +{ + queryBonds( + attributes: [ + { + key: "owner" + value: { string: "cosmos1wh8vvd0ymc5nt37h29z8kk2g2ays45ct2qu094" } + } + ] + ) { + id + owner + balance { + type + quantity + } + } +} +``` + +Get bonds by IDs. + +```graphql +{ + getBondsByIds(ids : + [ + "1c2b677cb2a27c88cc6bf8acf675c94b69051125b40c4fd073153b10f046dd87", + "c3f7a78c5042d2003880962ba31ff3b01fcf5942960e0bc3ca331f816346a440" + ]) + { + id + owner + balance{ + type + quantity + } + } +} +``` + +Query Bonds by Owner + +```graphql +{ + queryBondsByOwner(ownerAddresses: ["ethm1mfdjngh5jvjs9lqtt9a7y2hlgw8v3syh3hsqzk"]) + { + owner + bonds{ + id + owner + balance + { + type + quantity + } + } + } +} +``` + +Query auctions by ids + +```graphql +{ + getAuctionsByIds(ids: ["be98f2073c246194276554eefdb4c95b682a35a0f06fbe619a6da57c10c93e90"]){ + id + ownerAddress + createTime + minimumBid{ + type + quantity + } + commitFee{ + type + quantity + } + commitsEndTime + revealFee{ + type + quantity + } + revealsEndTime + winnerBid{ + type + quantity + } + winnerPrice{ + type + quantity + } + winnerAddress + bids{ + bidderAddress + commitHash + commitTime + commitFee{ + type + quantity + } + revealFee{ + type + quantity + } + revealTime + bidAmount{ + type + quantity + } + status + } + } +} +``` + +LookUp Authorities + +```graphql +{ + lookupAuthorities(names: []){ + ownerAddress + ownerAddress + height + bondId + status + expiryTime + auction { + id + ownerAddress + createTime + minimumBid{ + type + quantity + } + commitFee{ + type + quantity + } + commitsEndTime + revealFee{ + type + quantity + } + revealsEndTime + winnerBid{ + type + quantity + } + winnerPrice{ + type + quantity + } + winnerAddress + bids{ + bidderAddress + commitHash + commitTime + commitFee{ + type + quantity + } + revealFee{ + type + quantity + } + revealTime + bidAmount{ + type + quantity + } + status + } + } + } +} +``` + +LookUp Names + +```graphql +{ + lookupNames(names: ["crn://hello/test"]){ + latest{ + id + height + } + history{ + id + height + } + } +} +``` + +Resolve Names + +```graphql +{ + resolveNames(names: ["asd"]){ + id + names + bondId + createTime + expiryTime + owners + attributes { + key + value { + string + } + } + } +} +``` \ No newline at end of file diff --git a/gql/generated.go b/gql/generated.go new file mode 100644 index 00000000..8e030164 --- /dev/null +++ b/gql/generated.go @@ -0,0 +1,8781 @@ +// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. + +package gql + +import ( + "bytes" + "context" + "errors" + "strconv" + "sync" + "sync/atomic" + + "github.com/99designs/gqlgen/graphql" + "github.com/99designs/gqlgen/graphql/introspection" + gqlparser "github.com/vektah/gqlparser/v2" + "github.com/vektah/gqlparser/v2/ast" +) + +// region ************************** generated!.gotpl ************************** + +// NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface. +func NewExecutableSchema(cfg Config) graphql.ExecutableSchema { + return &executableSchema{ + resolvers: cfg.Resolvers, + directives: cfg.Directives, + complexity: cfg.Complexity, + } +} + +type Config struct { + Resolvers ResolverRoot + Directives DirectiveRoot + Complexity ComplexityRoot +} + +type ResolverRoot interface { + Query() QueryResolver +} + +type DirectiveRoot struct { +} + +type ComplexityRoot struct { + Account struct { + Address func(childComplexity int) int + Balance func(childComplexity int) int + Number func(childComplexity int) int + PubKey func(childComplexity int) int + Sequence func(childComplexity int) int + } + + Auction struct { + Bids func(childComplexity int) int + CommitFee func(childComplexity int) int + CommitsEndTime func(childComplexity int) int + CreateTime func(childComplexity int) int + ID func(childComplexity int) int + MinimumBid func(childComplexity int) int + OwnerAddress func(childComplexity int) int + RevealFee func(childComplexity int) int + RevealsEndTime func(childComplexity int) int + Status func(childComplexity int) int + WinnerAddress func(childComplexity int) int + WinnerBid func(childComplexity int) int + WinnerPrice func(childComplexity int) int + } + + AuctionBid struct { + BidAmount func(childComplexity int) int + BidderAddress func(childComplexity int) int + CommitFee func(childComplexity int) int + CommitHash func(childComplexity int) int + CommitTime func(childComplexity int) int + RevealFee func(childComplexity int) int + RevealTime func(childComplexity int) int + Status func(childComplexity int) int + } + + AuthorityRecord struct { + Auction func(childComplexity int) int + BondID func(childComplexity int) int + ExpiryTime func(childComplexity int) int + Height func(childComplexity int) int + OwnerAddress func(childComplexity int) int + OwnerPublicKey func(childComplexity int) int + Status func(childComplexity int) int + } + + Bond struct { + Balance func(childComplexity int) int + ID func(childComplexity int) int + Owner func(childComplexity int) int + } + + Coin struct { + Quantity func(childComplexity int) int + Type func(childComplexity int) int + } + + KeyValue struct { + Key func(childComplexity int) int + Value func(childComplexity int) int + } + + NameRecord struct { + History func(childComplexity int) int + Latest func(childComplexity int) int + } + + NameRecordEntry struct { + Height func(childComplexity int) int + ID func(childComplexity int) int + } + + NodeInfo struct { + ID func(childComplexity int) int + Moniker func(childComplexity int) int + Network func(childComplexity int) int + } + + OwnerBonds struct { + Bonds func(childComplexity int) int + Owner func(childComplexity int) int + } + + PeerInfo struct { + IsOutbound func(childComplexity int) int + Node func(childComplexity int) int + RemoteIP func(childComplexity int) int + } + + Query struct { + GetAccounts func(childComplexity int, addresses []string) int + GetAuctionsByIds func(childComplexity int, ids []string) int + GetBondsByIds func(childComplexity int, ids []string) int + GetRecordsByIds func(childComplexity int, ids []string) int + GetStatus func(childComplexity int) int + LookupAuthorities func(childComplexity int, names []string) int + LookupNames func(childComplexity int, names []string) int + QueryBonds func(childComplexity int, attributes []*KeyValueInput) int + QueryBondsByOwner func(childComplexity int, ownerAddresses []string) int + QueryRecords func(childComplexity int, attributes []*KeyValueInput, all *bool) int + ResolveNames func(childComplexity int, names []string) int + } + + Record struct { + Attributes func(childComplexity int) int + BondID func(childComplexity int) int + CreateTime func(childComplexity int) int + ExpiryTime func(childComplexity int) int + ID func(childComplexity int) int + Names func(childComplexity int) int + Owners func(childComplexity int) int + References func(childComplexity int) int + } + + Reference struct { + ID func(childComplexity int) int + } + + Status struct { + DiskUsage func(childComplexity int) int + Node func(childComplexity int) int + NumPeers func(childComplexity int) int + Peers func(childComplexity int) int + Sync func(childComplexity int) int + Validator func(childComplexity int) int + Validators func(childComplexity int) int + Version func(childComplexity int) int + } + + SyncInfo struct { + CatchingUp func(childComplexity int) int + LatestBlockHash func(childComplexity int) int + LatestBlockHeight func(childComplexity int) int + LatestBlockTime func(childComplexity int) int + } + + ValidatorInfo struct { + Address func(childComplexity int) int + ProposerPriority func(childComplexity int) int + VotingPower func(childComplexity int) int + } + + Value struct { + Boolean func(childComplexity int) int + Float func(childComplexity int) int + Int func(childComplexity int) int + JSON func(childComplexity int) int + Null func(childComplexity int) int + Reference func(childComplexity int) int + String func(childComplexity int) int + Values func(childComplexity int) int + } +} + +type QueryResolver interface { + GetStatus(ctx context.Context) (*Status, error) + GetAccounts(ctx context.Context, addresses []string) ([]*Account, error) + GetBondsByIds(ctx context.Context, ids []string) ([]*Bond, error) + QueryBonds(ctx context.Context, attributes []*KeyValueInput) ([]*Bond, error) + QueryBondsByOwner(ctx context.Context, ownerAddresses []string) ([]*OwnerBonds, error) + GetRecordsByIds(ctx context.Context, ids []string) ([]*Record, error) + QueryRecords(ctx context.Context, attributes []*KeyValueInput, all *bool) ([]*Record, error) + LookupAuthorities(ctx context.Context, names []string) ([]*AuthorityRecord, error) + LookupNames(ctx context.Context, names []string) ([]*NameRecord, error) + ResolveNames(ctx context.Context, names []string) ([]*Record, error) + GetAuctionsByIds(ctx context.Context, ids []string) ([]*Auction, error) +} + +type executableSchema struct { + resolvers ResolverRoot + directives DirectiveRoot + complexity ComplexityRoot +} + +func (e *executableSchema) Schema() *ast.Schema { + return parsedSchema +} + +func (e *executableSchema) Complexity(typeName, field string, childComplexity int, rawArgs map[string]interface{}) (int, bool) { + ec := executionContext{nil, e} + _ = ec + switch typeName + "." + field { + + case "Account.address": + if e.complexity.Account.Address == nil { + break + } + + return e.complexity.Account.Address(childComplexity), true + + case "Account.balance": + if e.complexity.Account.Balance == nil { + break + } + + return e.complexity.Account.Balance(childComplexity), true + + case "Account.number": + if e.complexity.Account.Number == nil { + break + } + + return e.complexity.Account.Number(childComplexity), true + + case "Account.pubKey": + if e.complexity.Account.PubKey == nil { + break + } + + return e.complexity.Account.PubKey(childComplexity), true + + case "Account.sequence": + if e.complexity.Account.Sequence == nil { + break + } + + return e.complexity.Account.Sequence(childComplexity), true + + case "Auction.bids": + if e.complexity.Auction.Bids == nil { + break + } + + return e.complexity.Auction.Bids(childComplexity), true + + case "Auction.commitFee": + if e.complexity.Auction.CommitFee == nil { + break + } + + return e.complexity.Auction.CommitFee(childComplexity), true + + case "Auction.commitsEndTime": + if e.complexity.Auction.CommitsEndTime == nil { + break + } + + return e.complexity.Auction.CommitsEndTime(childComplexity), true + + case "Auction.createTime": + if e.complexity.Auction.CreateTime == nil { + break + } + + return e.complexity.Auction.CreateTime(childComplexity), true + + case "Auction.id": + if e.complexity.Auction.ID == nil { + break + } + + return e.complexity.Auction.ID(childComplexity), true + + case "Auction.minimumBid": + if e.complexity.Auction.MinimumBid == nil { + break + } + + return e.complexity.Auction.MinimumBid(childComplexity), true + + case "Auction.ownerAddress": + if e.complexity.Auction.OwnerAddress == nil { + break + } + + return e.complexity.Auction.OwnerAddress(childComplexity), true + + case "Auction.revealFee": + if e.complexity.Auction.RevealFee == nil { + break + } + + return e.complexity.Auction.RevealFee(childComplexity), true + + case "Auction.revealsEndTime": + if e.complexity.Auction.RevealsEndTime == nil { + break + } + + return e.complexity.Auction.RevealsEndTime(childComplexity), true + + case "Auction.status": + if e.complexity.Auction.Status == nil { + break + } + + return e.complexity.Auction.Status(childComplexity), true + + case "Auction.winnerAddress": + if e.complexity.Auction.WinnerAddress == nil { + break + } + + return e.complexity.Auction.WinnerAddress(childComplexity), true + + case "Auction.winnerBid": + if e.complexity.Auction.WinnerBid == nil { + break + } + + return e.complexity.Auction.WinnerBid(childComplexity), true + + case "Auction.winnerPrice": + if e.complexity.Auction.WinnerPrice == nil { + break + } + + return e.complexity.Auction.WinnerPrice(childComplexity), true + + case "AuctionBid.bidAmount": + if e.complexity.AuctionBid.BidAmount == nil { + break + } + + return e.complexity.AuctionBid.BidAmount(childComplexity), true + + case "AuctionBid.bidderAddress": + if e.complexity.AuctionBid.BidderAddress == nil { + break + } + + return e.complexity.AuctionBid.BidderAddress(childComplexity), true + + case "AuctionBid.commitFee": + if e.complexity.AuctionBid.CommitFee == nil { + break + } + + return e.complexity.AuctionBid.CommitFee(childComplexity), true + + case "AuctionBid.commitHash": + if e.complexity.AuctionBid.CommitHash == nil { + break + } + + return e.complexity.AuctionBid.CommitHash(childComplexity), true + + case "AuctionBid.commitTime": + if e.complexity.AuctionBid.CommitTime == nil { + break + } + + return e.complexity.AuctionBid.CommitTime(childComplexity), true + + case "AuctionBid.revealFee": + if e.complexity.AuctionBid.RevealFee == nil { + break + } + + return e.complexity.AuctionBid.RevealFee(childComplexity), true + + case "AuctionBid.revealTime": + if e.complexity.AuctionBid.RevealTime == nil { + break + } + + return e.complexity.AuctionBid.RevealTime(childComplexity), true + + case "AuctionBid.status": + if e.complexity.AuctionBid.Status == nil { + break + } + + return e.complexity.AuctionBid.Status(childComplexity), true + + case "AuthorityRecord.auction": + if e.complexity.AuthorityRecord.Auction == nil { + break + } + + return e.complexity.AuthorityRecord.Auction(childComplexity), true + + case "AuthorityRecord.bondId": + if e.complexity.AuthorityRecord.BondID == nil { + break + } + + return e.complexity.AuthorityRecord.BondID(childComplexity), true + + case "AuthorityRecord.expiryTime": + if e.complexity.AuthorityRecord.ExpiryTime == nil { + break + } + + return e.complexity.AuthorityRecord.ExpiryTime(childComplexity), true + + case "AuthorityRecord.height": + if e.complexity.AuthorityRecord.Height == nil { + break + } + + return e.complexity.AuthorityRecord.Height(childComplexity), true + + case "AuthorityRecord.ownerAddress": + if e.complexity.AuthorityRecord.OwnerAddress == nil { + break + } + + return e.complexity.AuthorityRecord.OwnerAddress(childComplexity), true + + case "AuthorityRecord.ownerPublicKey": + if e.complexity.AuthorityRecord.OwnerPublicKey == nil { + break + } + + return e.complexity.AuthorityRecord.OwnerPublicKey(childComplexity), true + + case "AuthorityRecord.status": + if e.complexity.AuthorityRecord.Status == nil { + break + } + + return e.complexity.AuthorityRecord.Status(childComplexity), true + + case "Bond.balance": + if e.complexity.Bond.Balance == nil { + break + } + + return e.complexity.Bond.Balance(childComplexity), true + + case "Bond.id": + if e.complexity.Bond.ID == nil { + break + } + + return e.complexity.Bond.ID(childComplexity), true + + case "Bond.owner": + if e.complexity.Bond.Owner == nil { + break + } + + return e.complexity.Bond.Owner(childComplexity), true + + case "Coin.quantity": + if e.complexity.Coin.Quantity == nil { + break + } + + return e.complexity.Coin.Quantity(childComplexity), true + + case "Coin.type": + if e.complexity.Coin.Type == nil { + break + } + + return e.complexity.Coin.Type(childComplexity), true + + case "KeyValue.key": + if e.complexity.KeyValue.Key == nil { + break + } + + return e.complexity.KeyValue.Key(childComplexity), true + + case "KeyValue.value": + if e.complexity.KeyValue.Value == nil { + break + } + + return e.complexity.KeyValue.Value(childComplexity), true + + case "NameRecord.history": + if e.complexity.NameRecord.History == nil { + break + } + + return e.complexity.NameRecord.History(childComplexity), true + + case "NameRecord.latest": + if e.complexity.NameRecord.Latest == nil { + break + } + + return e.complexity.NameRecord.Latest(childComplexity), true + + case "NameRecordEntry.height": + if e.complexity.NameRecordEntry.Height == nil { + break + } + + return e.complexity.NameRecordEntry.Height(childComplexity), true + + case "NameRecordEntry.id": + if e.complexity.NameRecordEntry.ID == nil { + break + } + + return e.complexity.NameRecordEntry.ID(childComplexity), true + + case "NodeInfo.id": + if e.complexity.NodeInfo.ID == nil { + break + } + + return e.complexity.NodeInfo.ID(childComplexity), true + + case "NodeInfo.moniker": + if e.complexity.NodeInfo.Moniker == nil { + break + } + + return e.complexity.NodeInfo.Moniker(childComplexity), true + + case "NodeInfo.network": + if e.complexity.NodeInfo.Network == nil { + break + } + + return e.complexity.NodeInfo.Network(childComplexity), true + + case "OwnerBonds.bonds": + if e.complexity.OwnerBonds.Bonds == nil { + break + } + + return e.complexity.OwnerBonds.Bonds(childComplexity), true + + case "OwnerBonds.owner": + if e.complexity.OwnerBonds.Owner == nil { + break + } + + return e.complexity.OwnerBonds.Owner(childComplexity), true + + case "PeerInfo.is_outbound": + if e.complexity.PeerInfo.IsOutbound == nil { + break + } + + return e.complexity.PeerInfo.IsOutbound(childComplexity), true + + case "PeerInfo.node": + if e.complexity.PeerInfo.Node == nil { + break + } + + return e.complexity.PeerInfo.Node(childComplexity), true + + case "PeerInfo.remote_ip": + if e.complexity.PeerInfo.RemoteIP == nil { + break + } + + return e.complexity.PeerInfo.RemoteIP(childComplexity), true + + case "Query.getAccounts": + if e.complexity.Query.GetAccounts == nil { + break + } + + args, err := ec.field_Query_getAccounts_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.GetAccounts(childComplexity, args["addresses"].([]string)), true + + case "Query.getAuctionsByIds": + if e.complexity.Query.GetAuctionsByIds == nil { + break + } + + args, err := ec.field_Query_getAuctionsByIds_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.GetAuctionsByIds(childComplexity, args["ids"].([]string)), true + + case "Query.getBondsByIds": + if e.complexity.Query.GetBondsByIds == nil { + break + } + + args, err := ec.field_Query_getBondsByIds_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.GetBondsByIds(childComplexity, args["ids"].([]string)), true + + case "Query.getRecordsByIds": + if e.complexity.Query.GetRecordsByIds == nil { + break + } + + args, err := ec.field_Query_getRecordsByIds_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.GetRecordsByIds(childComplexity, args["ids"].([]string)), true + + case "Query.getStatus": + if e.complexity.Query.GetStatus == nil { + break + } + + return e.complexity.Query.GetStatus(childComplexity), true + + case "Query.lookupAuthorities": + if e.complexity.Query.LookupAuthorities == nil { + break + } + + args, err := ec.field_Query_lookupAuthorities_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.LookupAuthorities(childComplexity, args["names"].([]string)), true + + case "Query.lookupNames": + if e.complexity.Query.LookupNames == nil { + break + } + + args, err := ec.field_Query_lookupNames_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.LookupNames(childComplexity, args["names"].([]string)), true + + case "Query.queryBonds": + if e.complexity.Query.QueryBonds == nil { + break + } + + args, err := ec.field_Query_queryBonds_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.QueryBonds(childComplexity, args["attributes"].([]*KeyValueInput)), true + + case "Query.queryBondsByOwner": + if e.complexity.Query.QueryBondsByOwner == nil { + break + } + + args, err := ec.field_Query_queryBondsByOwner_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.QueryBondsByOwner(childComplexity, args["ownerAddresses"].([]string)), true + + case "Query.queryRecords": + if e.complexity.Query.QueryRecords == nil { + break + } + + args, err := ec.field_Query_queryRecords_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.QueryRecords(childComplexity, args["attributes"].([]*KeyValueInput), args["all"].(*bool)), true + + case "Query.resolveNames": + if e.complexity.Query.ResolveNames == nil { + break + } + + args, err := ec.field_Query_resolveNames_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.ResolveNames(childComplexity, args["names"].([]string)), true + + case "Record.attributes": + if e.complexity.Record.Attributes == nil { + break + } + + return e.complexity.Record.Attributes(childComplexity), true + + case "Record.bondId": + if e.complexity.Record.BondID == nil { + break + } + + return e.complexity.Record.BondID(childComplexity), true + + case "Record.createTime": + if e.complexity.Record.CreateTime == nil { + break + } + + return e.complexity.Record.CreateTime(childComplexity), true + + case "Record.expiryTime": + if e.complexity.Record.ExpiryTime == nil { + break + } + + return e.complexity.Record.ExpiryTime(childComplexity), true + + case "Record.id": + if e.complexity.Record.ID == nil { + break + } + + return e.complexity.Record.ID(childComplexity), true + + case "Record.names": + if e.complexity.Record.Names == nil { + break + } + + return e.complexity.Record.Names(childComplexity), true + + case "Record.owners": + if e.complexity.Record.Owners == nil { + break + } + + return e.complexity.Record.Owners(childComplexity), true + + case "Record.references": + if e.complexity.Record.References == nil { + break + } + + return e.complexity.Record.References(childComplexity), true + + case "Reference.id": + if e.complexity.Reference.ID == nil { + break + } + + return e.complexity.Reference.ID(childComplexity), true + + case "Status.disk_usage": + if e.complexity.Status.DiskUsage == nil { + break + } + + return e.complexity.Status.DiskUsage(childComplexity), true + + case "Status.node": + if e.complexity.Status.Node == nil { + break + } + + return e.complexity.Status.Node(childComplexity), true + + case "Status.num_peers": + if e.complexity.Status.NumPeers == nil { + break + } + + return e.complexity.Status.NumPeers(childComplexity), true + + case "Status.peers": + if e.complexity.Status.Peers == nil { + break + } + + return e.complexity.Status.Peers(childComplexity), true + + case "Status.sync": + if e.complexity.Status.Sync == nil { + break + } + + return e.complexity.Status.Sync(childComplexity), true + + case "Status.validator": + if e.complexity.Status.Validator == nil { + break + } + + return e.complexity.Status.Validator(childComplexity), true + + case "Status.validators": + if e.complexity.Status.Validators == nil { + break + } + + return e.complexity.Status.Validators(childComplexity), true + + case "Status.version": + if e.complexity.Status.Version == nil { + break + } + + return e.complexity.Status.Version(childComplexity), true + + case "SyncInfo.catching_up": + if e.complexity.SyncInfo.CatchingUp == nil { + break + } + + return e.complexity.SyncInfo.CatchingUp(childComplexity), true + + case "SyncInfo.latest_block_hash": + if e.complexity.SyncInfo.LatestBlockHash == nil { + break + } + + return e.complexity.SyncInfo.LatestBlockHash(childComplexity), true + + case "SyncInfo.latest_block_height": + if e.complexity.SyncInfo.LatestBlockHeight == nil { + break + } + + return e.complexity.SyncInfo.LatestBlockHeight(childComplexity), true + + case "SyncInfo.latest_block_time": + if e.complexity.SyncInfo.LatestBlockTime == nil { + break + } + + return e.complexity.SyncInfo.LatestBlockTime(childComplexity), true + + case "ValidatorInfo.address": + if e.complexity.ValidatorInfo.Address == nil { + break + } + + return e.complexity.ValidatorInfo.Address(childComplexity), true + + case "ValidatorInfo.proposer_priority": + if e.complexity.ValidatorInfo.ProposerPriority == nil { + break + } + + return e.complexity.ValidatorInfo.ProposerPriority(childComplexity), true + + case "ValidatorInfo.voting_power": + if e.complexity.ValidatorInfo.VotingPower == nil { + break + } + + return e.complexity.ValidatorInfo.VotingPower(childComplexity), true + + case "Value.boolean": + if e.complexity.Value.Boolean == nil { + break + } + + return e.complexity.Value.Boolean(childComplexity), true + + case "Value.float": + if e.complexity.Value.Float == nil { + break + } + + return e.complexity.Value.Float(childComplexity), true + + case "Value.int": + if e.complexity.Value.Int == nil { + break + } + + return e.complexity.Value.Int(childComplexity), true + + case "Value.json": + if e.complexity.Value.JSON == nil { + break + } + + return e.complexity.Value.JSON(childComplexity), true + + case "Value.null": + if e.complexity.Value.Null == nil { + break + } + + return e.complexity.Value.Null(childComplexity), true + + case "Value.reference": + if e.complexity.Value.Reference == nil { + break + } + + return e.complexity.Value.Reference(childComplexity), true + + case "Value.string": + if e.complexity.Value.String == nil { + break + } + + return e.complexity.Value.String(childComplexity), true + + case "Value.values": + if e.complexity.Value.Values == nil { + break + } + + return e.complexity.Value.Values(childComplexity), true + + } + return 0, false +} + +func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { + rc := graphql.GetOperationContext(ctx) + ec := executionContext{rc, e} + first := true + + switch rc.Operation.Operation { + case ast.Query: + return func(ctx context.Context) *graphql.Response { + if !first { + return nil + } + first = false + data := ec._Query(ctx, rc.Operation.SelectionSet) + var buf bytes.Buffer + data.MarshalGQL(&buf) + + return &graphql.Response{ + Data: buf.Bytes(), + } + } + + default: + return graphql.OneShot(graphql.ErrorResponse(ctx, "unsupported GraphQL operation")) + } +} + +type executionContext struct { + *graphql.OperationContext + *executableSchema +} + +func (ec *executionContext) introspectSchema() (*introspection.Schema, error) { + if ec.DisableIntrospection { + return nil, errors.New("introspection disabled") + } + return introspection.WrapSchema(parsedSchema), nil +} + +func (ec *executionContext) introspectType(name string) (*introspection.Type, error) { + if ec.DisableIntrospection { + return nil, errors.New("introspection disabled") + } + return introspection.WrapTypeFromDef(parsedSchema, parsedSchema.Types[name]), nil +} + +var sources = []*ast.Source{ + {Name: "vulcanize/chiba-clonk/schema.graphql", Input: `# Reference to another record. +type Reference { + id: String! # ID of linked record. +} + +# Reference to another record. +input ReferenceInput { + id: String! +} + +# Bonds contain funds that are used to pay rent on record registration and renewal. +type Bond { + id: String! # Primary key, auto-generated by the server. + owner: String! # Bond owner cosmos-sdk address. + balance: [Coin!] # Current balance for each coin type. +} + +# OwnerBonds contains the bonds related the owner +type OwnerBonds { + owner: String! + bonds: [Bond!] +} + +# Mutations require payment in coins (e.g. 100wire). +# Used by the wallet to get the account balance for display and mutations. +type Coin { + type: String! # e.g. 'WIRE' + quantity: String! # e.g. 1000000 +} +# Represents an account on the blockchain. +# Mutations have to be signed by a particular account. +type Account { + address: String! # Blockchain address. + pubKey: String # Public key. + number: String! # Account number. + sequence: String! # Sequence number used to prevent replays. + balance: [Coin!] # Current balance for each coin type. +} + +# Value of a given type. +type Value { + null: Boolean + + int: Int + float: Float + string: String + boolean: Boolean + json: String + + reference: Reference + + values: [Value] +} +# Value of a given type used as input to queries. +input ValueInput { + null: Boolean + + int: Int + float: Float + string: String + boolean: Boolean + + reference: ReferenceInput + + values: [ValueInput] +} + +# Key/value pair. +type KeyValue { + key: String! + value: Value! +} + +# Key/value pair for inputs. +input KeyValueInput { + key: String! + value: ValueInput! +} + +# Status information about a node (https://docs.tendermint.com/master/rpc/#/Info/status). +type NodeInfo { + id: String! # Tendermint Node ID. + network: String! # Name of the network/blockchain. + moniker: String! # Name of the node. +} + +# Node sync status. +type SyncInfo { + latest_block_hash: String! + latest_block_height: String! + latest_block_time: String! + catching_up: Boolean! +} + +# Validator set info (https://docs.tendermint.com/master/rpc/#/Info/validators). +type ValidatorInfo { + address: String! + voting_power: String! + proposer_priority: String +} + +# Network/peer info (https://docs.tendermint.com/master/rpc/#/Info/net_info). +type PeerInfo { + node: NodeInfo! + is_outbound: Boolean! + remote_ip: String! +} + +# Vulcanize chiba-clonk status. +type Status { + version: String! + node: NodeInfo! + sync: SyncInfo! + validator: ValidatorInfo + validators: [ValidatorInfo]! + num_peers: String! + peers: [PeerInfo] + disk_usage: String! +} + + +# An auction bid. +type AuctionBid { + bidderAddress: String! + status: String! + commitHash: String! + commitTime: String! + commitFee: Coin! + revealTime: String! + revealFee: Coin! + bidAmount: Coin! +} + +# A sealed-bid, 2nd price auction. +type Auction { + id: String! # Auction ID. + status: String! # Auction status (commit, reveal, expired). + ownerAddress: String! # Auction owner time. + createTime: String! # Create time. + commitsEndTime: String! # Commit phase end time. + revealsEndTime: String! # Reveal phase end time. + commitFee: Coin! # Fee required to bid/participate in the auction. + revealFee: Coin! # Reveal fee (paid back to bidders only if they unseal/reveal the bid). + minimumBid: Coin! # Minimum bid amount. + winnerAddress: String! # Winner address. + winnerBid: Coin! # The winning bid amount. + winnerPrice: Coin! # The price that the winner actually pays (2nd highest bid). + bids: [AuctionBid] # Bids make in the auction. +} + + +# Record defines the basic properties of an entity in the graph database. +type Record { + id: String! # Computed attribute: Multibase encoded content hash (https://github.com/multiformats/multibase). + names: [String!] # Names pointing to this CID (reverse lookup). + + bondId: String! # Associated bond ID. + createTime: String! # Record create time. + expiryTime: String! # Record expiry time. + + owners: [String!] # Addresses of record owners. + attributes: [KeyValue] # Record attributes. + references: [Record] # Record references. +} + +# Name authority record. +type AuthorityRecord { + ownerAddress: String! # Owner address. + ownerPublicKey: String! # Owner public key. + height: String! # Height at which record was created. + status: String! # Status (active, auction, expired). + bondId: String! # Associated bond ID. + expiryTime: String! # Authority expiry time. + auction: Auction # Authority auction. +} + +# Name record entry, created at a particular height. +type NameRecordEntry { + id: String! # Target record ID. + height: String! # Height at which record was created. +} + +# Name record stores the latest and historical name -> record ID mappings. +type NameRecord { + latest: NameRecordEntry! # Latest mame record entry. + history: [NameRecordEntry] # Historical name record entries. +} + +type Query { + # + # Status API. + # + getStatus: Status! + + # Get blockchain accounts. + getAccounts( + addresses: [String!] + ): [Account] + + # Get bonds by IDs. + getBondsByIds( + ids: [String!] + ): [Bond] + + # Query bonds. + queryBonds( + attributes: [KeyValueInput] + ): [Bond] + + # Query bonds by owner. + queryBondsByOwner( + ownerAddresses: [String!] + ): [OwnerBonds] + + # + # GraphDB API. + # + + # Get records by IDs. + getRecordsByIds( + ids: [String!] + ): [Record] + + # Query records. + queryRecords( + # Multiple attribute conditions are in a logical AND. + attributes: [KeyValueInput] + + # Whether to query all records, not just named ones (false by default). + all: Boolean + ): [Record] + + # + # Naming API. + # + + # Lookup authority information. + lookupAuthorities( + names: [String!] + ): [AuthorityRecord]! + + # Lookup name to record mapping information. + lookupNames( + names: [String!] + ): [NameRecord]! + + # Resolve names to records. + resolveNames( + names: [String!] + ): [Record]! + + # + # Auctions API. + # + + # Get auctions by IDs. + getAuctionsByIds( + ids: [String!] + ): [Auction] +}`, BuiltIn: false}, +} +var parsedSchema = gqlparser.MustLoadSchema(sources...) + +// endregion ************************** generated!.gotpl ************************** + +// region ***************************** args.gotpl ***************************** + +func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["name"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["name"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Query_getAccounts_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 []string + if tmp, ok := rawArgs["addresses"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("addresses")) + arg0, err = ec.unmarshalOString2ᚕstringᚄ(ctx, tmp) + if err != nil { + return nil, err + } + } + args["addresses"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Query_getAuctionsByIds_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 []string + if tmp, ok := rawArgs["ids"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ids")) + arg0, err = ec.unmarshalOString2ᚕstringᚄ(ctx, tmp) + if err != nil { + return nil, err + } + } + args["ids"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Query_getBondsByIds_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 []string + if tmp, ok := rawArgs["ids"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ids")) + arg0, err = ec.unmarshalOString2ᚕstringᚄ(ctx, tmp) + if err != nil { + return nil, err + } + } + args["ids"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Query_getRecordsByIds_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 []string + if tmp, ok := rawArgs["ids"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ids")) + arg0, err = ec.unmarshalOString2ᚕstringᚄ(ctx, tmp) + if err != nil { + return nil, err + } + } + args["ids"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Query_lookupAuthorities_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 []string + if tmp, ok := rawArgs["names"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("names")) + arg0, err = ec.unmarshalOString2ᚕstringᚄ(ctx, tmp) + if err != nil { + return nil, err + } + } + args["names"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Query_lookupNames_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 []string + if tmp, ok := rawArgs["names"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("names")) + arg0, err = ec.unmarshalOString2ᚕstringᚄ(ctx, tmp) + if err != nil { + return nil, err + } + } + args["names"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Query_queryBondsByOwner_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 []string + if tmp, ok := rawArgs["ownerAddresses"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ownerAddresses")) + arg0, err = ec.unmarshalOString2ᚕstringᚄ(ctx, tmp) + if err != nil { + return nil, err + } + } + args["ownerAddresses"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Query_queryBonds_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 []*KeyValueInput + if tmp, ok := rawArgs["attributes"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("attributes")) + arg0, err = ec.unmarshalOKeyValueInput2ᚕᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐKeyValueInput(ctx, tmp) + if err != nil { + return nil, err + } + } + args["attributes"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Query_queryRecords_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 []*KeyValueInput + if tmp, ok := rawArgs["attributes"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("attributes")) + arg0, err = ec.unmarshalOKeyValueInput2ᚕᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐKeyValueInput(ctx, tmp) + if err != nil { + return nil, err + } + } + args["attributes"] = arg0 + var arg1 *bool + if tmp, ok := rawArgs["all"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("all")) + arg1, err = ec.unmarshalOBoolean2ᚖbool(ctx, tmp) + if err != nil { + return nil, err + } + } + args["all"] = arg1 + return args, nil +} + +func (ec *executionContext) field_Query_resolveNames_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 []string + if tmp, ok := rawArgs["names"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("names")) + arg0, err = ec.unmarshalOString2ᚕstringᚄ(ctx, tmp) + if err != nil { + return nil, err + } + } + args["names"] = arg0 + return args, nil +} + +func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 bool + if tmp, ok := rawArgs["includeDeprecated"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + if err != nil { + return nil, err + } + } + args["includeDeprecated"] = arg0 + return args, nil +} + +func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 bool + if tmp, ok := rawArgs["includeDeprecated"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + if err != nil { + return nil, err + } + } + args["includeDeprecated"] = arg0 + return args, nil +} + +// endregion ***************************** args.gotpl ***************************** + +// region ************************** directives.gotpl ************************** + +// endregion ************************** directives.gotpl ************************** + +// region **************************** field.gotpl ***************************** + +func (ec *executionContext) _Account_address(ctx context.Context, field graphql.CollectedField, obj *Account) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Account", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Address, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _Account_pubKey(ctx context.Context, field graphql.CollectedField, obj *Account) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Account", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.PubKey, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) _Account_number(ctx context.Context, field graphql.CollectedField, obj *Account) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Account", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Number, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _Account_sequence(ctx context.Context, field graphql.CollectedField, obj *Account) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Account", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Sequence, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _Account_balance(ctx context.Context, field graphql.CollectedField, obj *Account) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Account", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Balance, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]*Coin) + fc.Result = res + return ec.marshalOCoin2ᚕᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐCoinᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) _Auction_id(ctx context.Context, field graphql.CollectedField, obj *Auction) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Auction", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _Auction_status(ctx context.Context, field graphql.CollectedField, obj *Auction) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Auction", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Status, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _Auction_ownerAddress(ctx context.Context, field graphql.CollectedField, obj *Auction) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Auction", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.OwnerAddress, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _Auction_createTime(ctx context.Context, field graphql.CollectedField, obj *Auction) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Auction", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.CreateTime, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _Auction_commitsEndTime(ctx context.Context, field graphql.CollectedField, obj *Auction) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Auction", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.CommitsEndTime, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _Auction_revealsEndTime(ctx context.Context, field graphql.CollectedField, obj *Auction) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Auction", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.RevealsEndTime, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _Auction_commitFee(ctx context.Context, field graphql.CollectedField, obj *Auction) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Auction", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.CommitFee, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*Coin) + fc.Result = res + return ec.marshalNCoin2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐCoin(ctx, field.Selections, res) +} + +func (ec *executionContext) _Auction_revealFee(ctx context.Context, field graphql.CollectedField, obj *Auction) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Auction", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.RevealFee, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*Coin) + fc.Result = res + return ec.marshalNCoin2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐCoin(ctx, field.Selections, res) +} + +func (ec *executionContext) _Auction_minimumBid(ctx context.Context, field graphql.CollectedField, obj *Auction) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Auction", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.MinimumBid, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*Coin) + fc.Result = res + return ec.marshalNCoin2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐCoin(ctx, field.Selections, res) +} + +func (ec *executionContext) _Auction_winnerAddress(ctx context.Context, field graphql.CollectedField, obj *Auction) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Auction", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.WinnerAddress, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _Auction_winnerBid(ctx context.Context, field graphql.CollectedField, obj *Auction) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Auction", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.WinnerBid, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*Coin) + fc.Result = res + return ec.marshalNCoin2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐCoin(ctx, field.Selections, res) +} + +func (ec *executionContext) _Auction_winnerPrice(ctx context.Context, field graphql.CollectedField, obj *Auction) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Auction", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.WinnerPrice, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*Coin) + fc.Result = res + return ec.marshalNCoin2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐCoin(ctx, field.Selections, res) +} + +func (ec *executionContext) _Auction_bids(ctx context.Context, field graphql.CollectedField, obj *Auction) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Auction", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Bids, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]*AuctionBid) + fc.Result = res + return ec.marshalOAuctionBid2ᚕᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐAuctionBid(ctx, field.Selections, res) +} + +func (ec *executionContext) _AuctionBid_bidderAddress(ctx context.Context, field graphql.CollectedField, obj *AuctionBid) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "AuctionBid", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.BidderAddress, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _AuctionBid_status(ctx context.Context, field graphql.CollectedField, obj *AuctionBid) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "AuctionBid", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Status, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _AuctionBid_commitHash(ctx context.Context, field graphql.CollectedField, obj *AuctionBid) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "AuctionBid", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.CommitHash, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _AuctionBid_commitTime(ctx context.Context, field graphql.CollectedField, obj *AuctionBid) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "AuctionBid", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.CommitTime, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _AuctionBid_commitFee(ctx context.Context, field graphql.CollectedField, obj *AuctionBid) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "AuctionBid", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.CommitFee, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*Coin) + fc.Result = res + return ec.marshalNCoin2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐCoin(ctx, field.Selections, res) +} + +func (ec *executionContext) _AuctionBid_revealTime(ctx context.Context, field graphql.CollectedField, obj *AuctionBid) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "AuctionBid", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.RevealTime, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _AuctionBid_revealFee(ctx context.Context, field graphql.CollectedField, obj *AuctionBid) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "AuctionBid", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.RevealFee, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*Coin) + fc.Result = res + return ec.marshalNCoin2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐCoin(ctx, field.Selections, res) +} + +func (ec *executionContext) _AuctionBid_bidAmount(ctx context.Context, field graphql.CollectedField, obj *AuctionBid) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "AuctionBid", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.BidAmount, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*Coin) + fc.Result = res + return ec.marshalNCoin2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐCoin(ctx, field.Selections, res) +} + +func (ec *executionContext) _AuthorityRecord_ownerAddress(ctx context.Context, field graphql.CollectedField, obj *AuthorityRecord) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "AuthorityRecord", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.OwnerAddress, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _AuthorityRecord_ownerPublicKey(ctx context.Context, field graphql.CollectedField, obj *AuthorityRecord) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "AuthorityRecord", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.OwnerPublicKey, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _AuthorityRecord_height(ctx context.Context, field graphql.CollectedField, obj *AuthorityRecord) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "AuthorityRecord", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Height, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _AuthorityRecord_status(ctx context.Context, field graphql.CollectedField, obj *AuthorityRecord) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "AuthorityRecord", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Status, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _AuthorityRecord_bondId(ctx context.Context, field graphql.CollectedField, obj *AuthorityRecord) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "AuthorityRecord", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.BondID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _AuthorityRecord_expiryTime(ctx context.Context, field graphql.CollectedField, obj *AuthorityRecord) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "AuthorityRecord", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ExpiryTime, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _AuthorityRecord_auction(ctx context.Context, field graphql.CollectedField, obj *AuthorityRecord) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "AuthorityRecord", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Auction, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*Auction) + fc.Result = res + return ec.marshalOAuction2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐAuction(ctx, field.Selections, res) +} + +func (ec *executionContext) _Bond_id(ctx context.Context, field graphql.CollectedField, obj *Bond) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Bond", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _Bond_owner(ctx context.Context, field graphql.CollectedField, obj *Bond) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Bond", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Owner, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _Bond_balance(ctx context.Context, field graphql.CollectedField, obj *Bond) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Bond", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Balance, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]*Coin) + fc.Result = res + return ec.marshalOCoin2ᚕᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐCoinᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) _Coin_type(ctx context.Context, field graphql.CollectedField, obj *Coin) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Coin", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Type, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _Coin_quantity(ctx context.Context, field graphql.CollectedField, obj *Coin) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Coin", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Quantity, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _KeyValue_key(ctx context.Context, field graphql.CollectedField, obj *KeyValue) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "KeyValue", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Key, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _KeyValue_value(ctx context.Context, field graphql.CollectedField, obj *KeyValue) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "KeyValue", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Value, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*Value) + fc.Result = res + return ec.marshalNValue2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐValue(ctx, field.Selections, res) +} + +func (ec *executionContext) _NameRecord_latest(ctx context.Context, field graphql.CollectedField, obj *NameRecord) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "NameRecord", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Latest, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*NameRecordEntry) + fc.Result = res + return ec.marshalNNameRecordEntry2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐNameRecordEntry(ctx, field.Selections, res) +} + +func (ec *executionContext) _NameRecord_history(ctx context.Context, field graphql.CollectedField, obj *NameRecord) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "NameRecord", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.History, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]*NameRecordEntry) + fc.Result = res + return ec.marshalONameRecordEntry2ᚕᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐNameRecordEntry(ctx, field.Selections, res) +} + +func (ec *executionContext) _NameRecordEntry_id(ctx context.Context, field graphql.CollectedField, obj *NameRecordEntry) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "NameRecordEntry", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _NameRecordEntry_height(ctx context.Context, field graphql.CollectedField, obj *NameRecordEntry) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "NameRecordEntry", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Height, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _NodeInfo_id(ctx context.Context, field graphql.CollectedField, obj *NodeInfo) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "NodeInfo", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _NodeInfo_network(ctx context.Context, field graphql.CollectedField, obj *NodeInfo) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "NodeInfo", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Network, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _NodeInfo_moniker(ctx context.Context, field graphql.CollectedField, obj *NodeInfo) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "NodeInfo", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Moniker, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _OwnerBonds_owner(ctx context.Context, field graphql.CollectedField, obj *OwnerBonds) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "OwnerBonds", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Owner, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _OwnerBonds_bonds(ctx context.Context, field graphql.CollectedField, obj *OwnerBonds) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "OwnerBonds", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Bonds, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]*Bond) + fc.Result = res + return ec.marshalOBond2ᚕᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐBondᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) _PeerInfo_node(ctx context.Context, field graphql.CollectedField, obj *PeerInfo) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "PeerInfo", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Node, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*NodeInfo) + fc.Result = res + return ec.marshalNNodeInfo2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐNodeInfo(ctx, field.Selections, res) +} + +func (ec *executionContext) _PeerInfo_is_outbound(ctx context.Context, field graphql.CollectedField, obj *PeerInfo) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "PeerInfo", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.IsOutbound, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) _PeerInfo_remote_ip(ctx context.Context, field graphql.CollectedField, obj *PeerInfo) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "PeerInfo", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.RemoteIP, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _Query_getStatus(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + IsResolver: true, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().GetStatus(rctx) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*Status) + fc.Result = res + return ec.marshalNStatus2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐStatus(ctx, field.Selections, res) +} + +func (ec *executionContext) _Query_getAccounts(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + IsResolver: true, + } + + ctx = graphql.WithFieldContext(ctx, fc) + rawArgs := field.ArgumentMap(ec.Variables) + args, err := ec.field_Query_getAccounts_args(ctx, rawArgs) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + fc.Args = args + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().GetAccounts(rctx, args["addresses"].([]string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]*Account) + fc.Result = res + return ec.marshalOAccount2ᚕᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐAccount(ctx, field.Selections, res) +} + +func (ec *executionContext) _Query_getBondsByIds(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + IsResolver: true, + } + + ctx = graphql.WithFieldContext(ctx, fc) + rawArgs := field.ArgumentMap(ec.Variables) + args, err := ec.field_Query_getBondsByIds_args(ctx, rawArgs) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + fc.Args = args + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().GetBondsByIds(rctx, args["ids"].([]string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]*Bond) + fc.Result = res + return ec.marshalOBond2ᚕᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐBond(ctx, field.Selections, res) +} + +func (ec *executionContext) _Query_queryBonds(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + IsResolver: true, + } + + ctx = graphql.WithFieldContext(ctx, fc) + rawArgs := field.ArgumentMap(ec.Variables) + args, err := ec.field_Query_queryBonds_args(ctx, rawArgs) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + fc.Args = args + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().QueryBonds(rctx, args["attributes"].([]*KeyValueInput)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]*Bond) + fc.Result = res + return ec.marshalOBond2ᚕᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐBond(ctx, field.Selections, res) +} + +func (ec *executionContext) _Query_queryBondsByOwner(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + IsResolver: true, + } + + ctx = graphql.WithFieldContext(ctx, fc) + rawArgs := field.ArgumentMap(ec.Variables) + args, err := ec.field_Query_queryBondsByOwner_args(ctx, rawArgs) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + fc.Args = args + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().QueryBondsByOwner(rctx, args["ownerAddresses"].([]string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]*OwnerBonds) + fc.Result = res + return ec.marshalOOwnerBonds2ᚕᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐOwnerBonds(ctx, field.Selections, res) +} + +func (ec *executionContext) _Query_getRecordsByIds(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + IsResolver: true, + } + + ctx = graphql.WithFieldContext(ctx, fc) + rawArgs := field.ArgumentMap(ec.Variables) + args, err := ec.field_Query_getRecordsByIds_args(ctx, rawArgs) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + fc.Args = args + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().GetRecordsByIds(rctx, args["ids"].([]string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]*Record) + fc.Result = res + return ec.marshalORecord2ᚕᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐRecord(ctx, field.Selections, res) +} + +func (ec *executionContext) _Query_queryRecords(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + IsResolver: true, + } + + ctx = graphql.WithFieldContext(ctx, fc) + rawArgs := field.ArgumentMap(ec.Variables) + args, err := ec.field_Query_queryRecords_args(ctx, rawArgs) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + fc.Args = args + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().QueryRecords(rctx, args["attributes"].([]*KeyValueInput), args["all"].(*bool)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]*Record) + fc.Result = res + return ec.marshalORecord2ᚕᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐRecord(ctx, field.Selections, res) +} + +func (ec *executionContext) _Query_lookupAuthorities(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + IsResolver: true, + } + + ctx = graphql.WithFieldContext(ctx, fc) + rawArgs := field.ArgumentMap(ec.Variables) + args, err := ec.field_Query_lookupAuthorities_args(ctx, rawArgs) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + fc.Args = args + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().LookupAuthorities(rctx, args["names"].([]string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*AuthorityRecord) + fc.Result = res + return ec.marshalNAuthorityRecord2ᚕᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐAuthorityRecord(ctx, field.Selections, res) +} + +func (ec *executionContext) _Query_lookupNames(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + IsResolver: true, + } + + ctx = graphql.WithFieldContext(ctx, fc) + rawArgs := field.ArgumentMap(ec.Variables) + args, err := ec.field_Query_lookupNames_args(ctx, rawArgs) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + fc.Args = args + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().LookupNames(rctx, args["names"].([]string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*NameRecord) + fc.Result = res + return ec.marshalNNameRecord2ᚕᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐNameRecord(ctx, field.Selections, res) +} + +func (ec *executionContext) _Query_resolveNames(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + IsResolver: true, + } + + ctx = graphql.WithFieldContext(ctx, fc) + rawArgs := field.ArgumentMap(ec.Variables) + args, err := ec.field_Query_resolveNames_args(ctx, rawArgs) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + fc.Args = args + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().ResolveNames(rctx, args["names"].([]string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*Record) + fc.Result = res + return ec.marshalNRecord2ᚕᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐRecord(ctx, field.Selections, res) +} + +func (ec *executionContext) _Query_getAuctionsByIds(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + IsResolver: true, + } + + ctx = graphql.WithFieldContext(ctx, fc) + rawArgs := field.ArgumentMap(ec.Variables) + args, err := ec.field_Query_getAuctionsByIds_args(ctx, rawArgs) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + fc.Args = args + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().GetAuctionsByIds(rctx, args["ids"].([]string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]*Auction) + fc.Result = res + return ec.marshalOAuction2ᚕᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐAuction(ctx, field.Selections, res) +} + +func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + rawArgs := field.ArgumentMap(ec.Variables) + args, err := ec.field_Query___type_args(ctx, rawArgs) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + fc.Args = args + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.introspectType(args["name"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) +} + +func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.introspectSchema() + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*introspection.Schema) + fc.Result = res + return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res) +} + +func (ec *executionContext) _Record_id(ctx context.Context, field graphql.CollectedField, obj *Record) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Record", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _Record_names(ctx context.Context, field graphql.CollectedField, obj *Record) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Record", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Names, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]string) + fc.Result = res + return ec.marshalOString2ᚕstringᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) _Record_bondId(ctx context.Context, field graphql.CollectedField, obj *Record) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Record", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.BondID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _Record_createTime(ctx context.Context, field graphql.CollectedField, obj *Record) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Record", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.CreateTime, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _Record_expiryTime(ctx context.Context, field graphql.CollectedField, obj *Record) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Record", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ExpiryTime, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _Record_owners(ctx context.Context, field graphql.CollectedField, obj *Record) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Record", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Owners, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]string) + fc.Result = res + return ec.marshalOString2ᚕstringᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) _Record_attributes(ctx context.Context, field graphql.CollectedField, obj *Record) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Record", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Attributes, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]*KeyValue) + fc.Result = res + return ec.marshalOKeyValue2ᚕᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐKeyValue(ctx, field.Selections, res) +} + +func (ec *executionContext) _Record_references(ctx context.Context, field graphql.CollectedField, obj *Record) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Record", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.References, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]*Record) + fc.Result = res + return ec.marshalORecord2ᚕᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐRecord(ctx, field.Selections, res) +} + +func (ec *executionContext) _Reference_id(ctx context.Context, field graphql.CollectedField, obj *Reference) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Reference", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _Status_version(ctx context.Context, field graphql.CollectedField, obj *Status) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Status", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Version, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _Status_node(ctx context.Context, field graphql.CollectedField, obj *Status) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Status", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Node, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*NodeInfo) + fc.Result = res + return ec.marshalNNodeInfo2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐNodeInfo(ctx, field.Selections, res) +} + +func (ec *executionContext) _Status_sync(ctx context.Context, field graphql.CollectedField, obj *Status) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Status", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Sync, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*SyncInfo) + fc.Result = res + return ec.marshalNSyncInfo2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐSyncInfo(ctx, field.Selections, res) +} + +func (ec *executionContext) _Status_validator(ctx context.Context, field graphql.CollectedField, obj *Status) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Status", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Validator, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*ValidatorInfo) + fc.Result = res + return ec.marshalOValidatorInfo2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐValidatorInfo(ctx, field.Selections, res) +} + +func (ec *executionContext) _Status_validators(ctx context.Context, field graphql.CollectedField, obj *Status) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Status", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Validators, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*ValidatorInfo) + fc.Result = res + return ec.marshalNValidatorInfo2ᚕᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐValidatorInfo(ctx, field.Selections, res) +} + +func (ec *executionContext) _Status_num_peers(ctx context.Context, field graphql.CollectedField, obj *Status) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Status", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.NumPeers, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _Status_peers(ctx context.Context, field graphql.CollectedField, obj *Status) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Status", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Peers, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]*PeerInfo) + fc.Result = res + return ec.marshalOPeerInfo2ᚕᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐPeerInfo(ctx, field.Selections, res) +} + +func (ec *executionContext) _Status_disk_usage(ctx context.Context, field graphql.CollectedField, obj *Status) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Status", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.DiskUsage, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _SyncInfo_latest_block_hash(ctx context.Context, field graphql.CollectedField, obj *SyncInfo) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "SyncInfo", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.LatestBlockHash, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _SyncInfo_latest_block_height(ctx context.Context, field graphql.CollectedField, obj *SyncInfo) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "SyncInfo", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.LatestBlockHeight, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _SyncInfo_latest_block_time(ctx context.Context, field graphql.CollectedField, obj *SyncInfo) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "SyncInfo", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.LatestBlockTime, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _SyncInfo_catching_up(ctx context.Context, field graphql.CollectedField, obj *SyncInfo) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "SyncInfo", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.CatchingUp, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) _ValidatorInfo_address(ctx context.Context, field graphql.CollectedField, obj *ValidatorInfo) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "ValidatorInfo", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Address, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _ValidatorInfo_voting_power(ctx context.Context, field graphql.CollectedField, obj *ValidatorInfo) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "ValidatorInfo", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.VotingPower, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _ValidatorInfo_proposer_priority(ctx context.Context, field graphql.CollectedField, obj *ValidatorInfo) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "ValidatorInfo", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ProposerPriority, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) _Value_null(ctx context.Context, field graphql.CollectedField, obj *Value) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Value", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Null, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*bool) + fc.Result = res + return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res) +} + +func (ec *executionContext) _Value_int(ctx context.Context, field graphql.CollectedField, obj *Value) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Value", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Int, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*int) + fc.Result = res + return ec.marshalOInt2ᚖint(ctx, field.Selections, res) +} + +func (ec *executionContext) _Value_float(ctx context.Context, field graphql.CollectedField, obj *Value) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Value", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Float, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*float64) + fc.Result = res + return ec.marshalOFloat2ᚖfloat64(ctx, field.Selections, res) +} + +func (ec *executionContext) _Value_string(ctx context.Context, field graphql.CollectedField, obj *Value) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Value", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.String, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) _Value_boolean(ctx context.Context, field graphql.CollectedField, obj *Value) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Value", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Boolean, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*bool) + fc.Result = res + return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res) +} + +func (ec *executionContext) _Value_json(ctx context.Context, field graphql.CollectedField, obj *Value) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Value", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.JSON, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) _Value_reference(ctx context.Context, field graphql.CollectedField, obj *Value) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Value", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Reference, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*Reference) + fc.Result = res + return ec.marshalOReference2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐReference(ctx, field.Selections, res) +} + +func (ec *executionContext) _Value_values(ctx context.Context, field graphql.CollectedField, obj *Value) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Value", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Values, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]*Value) + fc.Result = res + return ec.marshalOValue2ᚕᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐValue(ctx, field.Selections, res) +} + +func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Description, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalOString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Locations, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]string) + fc.Result = res + return ec.marshalN__DirectiveLocation2ᚕstringᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Args, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]introspection.InputValue) + fc.Result = res + return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) ___Directive_isRepeatable(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "__Directive", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.IsRepeatable, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Description, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalOString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + Args: nil, + IsMethod: true, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.IsDeprecated(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + Args: nil, + IsMethod: true, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.DeprecationReason(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Description, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalOString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Args, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]introspection.InputValue) + fc.Result = res + return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Type, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) +} + +func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: true, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.IsDeprecated(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "__Field", + Field: field, + Args: nil, + IsMethod: true, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.DeprecationReason(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Description, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalOString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Type, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) +} + +func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.DefaultValue, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Types(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]introspection.Type) + fc.Result = res + return ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.QueryType(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) +} + +func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.MutationType(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) +} + +func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.SubscriptionType(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) +} + +func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "__Schema", + Field: field, + Args: nil, + IsMethod: true, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Directives(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]introspection.Directive) + fc.Result = res + return ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirectiveᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Kind(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalN__TypeKind2string(ctx, field.Selections, res) +} + +func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Description(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalOString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + rawArgs := field.ArgumentMap(ec.Variables) + args, err := ec.field___Type_fields_args(ctx, rawArgs) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + fc.Args = args + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Fields(args["includeDeprecated"].(bool)), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]introspection.Field) + fc.Result = res + return ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐFieldᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Interfaces(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]introspection.Type) + fc.Result = res + return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.PossibleTypes(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]introspection.Type) + fc.Result = res + return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + rawArgs := field.ArgumentMap(ec.Variables) + args, err := ec.field___Type_enumValues_args(ctx, rawArgs) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + fc.Args = args + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.EnumValues(args["includeDeprecated"].(bool)), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]introspection.EnumValue) + fc.Result = res + return ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValueᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.InputFields(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]introspection.InputValue) + fc.Result = res + return ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "__Type", + Field: field, + Args: nil, + IsMethod: true, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.OfType(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) +} + +// endregion **************************** field.gotpl ***************************** + +// region **************************** input.gotpl ***************************** + +func (ec *executionContext) unmarshalInputKeyValueInput(ctx context.Context, obj interface{}) (KeyValueInput, error) { + var it KeyValueInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + for k, v := range asMap { + switch k { + case "key": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("key")) + it.Key, err = ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + case "value": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("value")) + it.Value, err = ec.unmarshalNValueInput2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐValueInput(ctx, v) + if err != nil { + return it, err + } + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputReferenceInput(ctx context.Context, obj interface{}) (ReferenceInput, error) { + var it ReferenceInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + for k, v := range asMap { + switch k { + case "id": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + it.ID, err = ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputValueInput(ctx context.Context, obj interface{}) (ValueInput, error) { + var it ValueInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + for k, v := range asMap { + switch k { + case "null": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("null")) + it.Null, err = ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + case "int": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("int")) + it.Int, err = ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + case "float": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("float")) + it.Float, err = ec.unmarshalOFloat2ᚖfloat64(ctx, v) + if err != nil { + return it, err + } + case "string": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("string")) + it.String, err = ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + case "boolean": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("boolean")) + it.Boolean, err = ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + case "reference": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("reference")) + it.Reference, err = ec.unmarshalOReferenceInput2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐReferenceInput(ctx, v) + if err != nil { + return it, err + } + case "values": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("values")) + it.Values, err = ec.unmarshalOValueInput2ᚕᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐValueInput(ctx, v) + if err != nil { + return it, err + } + } + } + + return it, nil +} + +// endregion **************************** input.gotpl ***************************** + +// region ************************** interface.gotpl *************************** + +// endregion ************************** interface.gotpl *************************** + +// region **************************** object.gotpl **************************** + +var accountImplementors = []string{"Account"} + +func (ec *executionContext) _Account(ctx context.Context, sel ast.SelectionSet, obj *Account) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, accountImplementors) + + out := graphql.NewFieldSet(fields) + var invalids uint32 + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Account") + case "address": + out.Values[i] = ec._Account_address(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "pubKey": + out.Values[i] = ec._Account_pubKey(ctx, field, obj) + case "number": + out.Values[i] = ec._Account_number(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "sequence": + out.Values[i] = ec._Account_sequence(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "balance": + out.Values[i] = ec._Account_balance(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch() + if invalids > 0 { + return graphql.Null + } + return out +} + +var auctionImplementors = []string{"Auction"} + +func (ec *executionContext) _Auction(ctx context.Context, sel ast.SelectionSet, obj *Auction) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, auctionImplementors) + + out := graphql.NewFieldSet(fields) + var invalids uint32 + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Auction") + case "id": + out.Values[i] = ec._Auction_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "status": + out.Values[i] = ec._Auction_status(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "ownerAddress": + out.Values[i] = ec._Auction_ownerAddress(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "createTime": + out.Values[i] = ec._Auction_createTime(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "commitsEndTime": + out.Values[i] = ec._Auction_commitsEndTime(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "revealsEndTime": + out.Values[i] = ec._Auction_revealsEndTime(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "commitFee": + out.Values[i] = ec._Auction_commitFee(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "revealFee": + out.Values[i] = ec._Auction_revealFee(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "minimumBid": + out.Values[i] = ec._Auction_minimumBid(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "winnerAddress": + out.Values[i] = ec._Auction_winnerAddress(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "winnerBid": + out.Values[i] = ec._Auction_winnerBid(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "winnerPrice": + out.Values[i] = ec._Auction_winnerPrice(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "bids": + out.Values[i] = ec._Auction_bids(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch() + if invalids > 0 { + return graphql.Null + } + return out +} + +var auctionBidImplementors = []string{"AuctionBid"} + +func (ec *executionContext) _AuctionBid(ctx context.Context, sel ast.SelectionSet, obj *AuctionBid) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, auctionBidImplementors) + + out := graphql.NewFieldSet(fields) + var invalids uint32 + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("AuctionBid") + case "bidderAddress": + out.Values[i] = ec._AuctionBid_bidderAddress(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "status": + out.Values[i] = ec._AuctionBid_status(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "commitHash": + out.Values[i] = ec._AuctionBid_commitHash(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "commitTime": + out.Values[i] = ec._AuctionBid_commitTime(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "commitFee": + out.Values[i] = ec._AuctionBid_commitFee(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "revealTime": + out.Values[i] = ec._AuctionBid_revealTime(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "revealFee": + out.Values[i] = ec._AuctionBid_revealFee(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "bidAmount": + out.Values[i] = ec._AuctionBid_bidAmount(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch() + if invalids > 0 { + return graphql.Null + } + return out +} + +var authorityRecordImplementors = []string{"AuthorityRecord"} + +func (ec *executionContext) _AuthorityRecord(ctx context.Context, sel ast.SelectionSet, obj *AuthorityRecord) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, authorityRecordImplementors) + + out := graphql.NewFieldSet(fields) + var invalids uint32 + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("AuthorityRecord") + case "ownerAddress": + out.Values[i] = ec._AuthorityRecord_ownerAddress(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "ownerPublicKey": + out.Values[i] = ec._AuthorityRecord_ownerPublicKey(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "height": + out.Values[i] = ec._AuthorityRecord_height(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "status": + out.Values[i] = ec._AuthorityRecord_status(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "bondId": + out.Values[i] = ec._AuthorityRecord_bondId(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "expiryTime": + out.Values[i] = ec._AuthorityRecord_expiryTime(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "auction": + out.Values[i] = ec._AuthorityRecord_auction(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch() + if invalids > 0 { + return graphql.Null + } + return out +} + +var bondImplementors = []string{"Bond"} + +func (ec *executionContext) _Bond(ctx context.Context, sel ast.SelectionSet, obj *Bond) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, bondImplementors) + + out := graphql.NewFieldSet(fields) + var invalids uint32 + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Bond") + case "id": + out.Values[i] = ec._Bond_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "owner": + out.Values[i] = ec._Bond_owner(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "balance": + out.Values[i] = ec._Bond_balance(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch() + if invalids > 0 { + return graphql.Null + } + return out +} + +var coinImplementors = []string{"Coin"} + +func (ec *executionContext) _Coin(ctx context.Context, sel ast.SelectionSet, obj *Coin) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, coinImplementors) + + out := graphql.NewFieldSet(fields) + var invalids uint32 + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Coin") + case "type": + out.Values[i] = ec._Coin_type(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "quantity": + out.Values[i] = ec._Coin_quantity(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch() + if invalids > 0 { + return graphql.Null + } + return out +} + +var keyValueImplementors = []string{"KeyValue"} + +func (ec *executionContext) _KeyValue(ctx context.Context, sel ast.SelectionSet, obj *KeyValue) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, keyValueImplementors) + + out := graphql.NewFieldSet(fields) + var invalids uint32 + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("KeyValue") + case "key": + out.Values[i] = ec._KeyValue_key(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "value": + out.Values[i] = ec._KeyValue_value(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch() + if invalids > 0 { + return graphql.Null + } + return out +} + +var nameRecordImplementors = []string{"NameRecord"} + +func (ec *executionContext) _NameRecord(ctx context.Context, sel ast.SelectionSet, obj *NameRecord) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, nameRecordImplementors) + + out := graphql.NewFieldSet(fields) + var invalids uint32 + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("NameRecord") + case "latest": + out.Values[i] = ec._NameRecord_latest(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "history": + out.Values[i] = ec._NameRecord_history(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch() + if invalids > 0 { + return graphql.Null + } + return out +} + +var nameRecordEntryImplementors = []string{"NameRecordEntry"} + +func (ec *executionContext) _NameRecordEntry(ctx context.Context, sel ast.SelectionSet, obj *NameRecordEntry) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, nameRecordEntryImplementors) + + out := graphql.NewFieldSet(fields) + var invalids uint32 + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("NameRecordEntry") + case "id": + out.Values[i] = ec._NameRecordEntry_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "height": + out.Values[i] = ec._NameRecordEntry_height(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch() + if invalids > 0 { + return graphql.Null + } + return out +} + +var nodeInfoImplementors = []string{"NodeInfo"} + +func (ec *executionContext) _NodeInfo(ctx context.Context, sel ast.SelectionSet, obj *NodeInfo) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, nodeInfoImplementors) + + out := graphql.NewFieldSet(fields) + var invalids uint32 + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("NodeInfo") + case "id": + out.Values[i] = ec._NodeInfo_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "network": + out.Values[i] = ec._NodeInfo_network(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "moniker": + out.Values[i] = ec._NodeInfo_moniker(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch() + if invalids > 0 { + return graphql.Null + } + return out +} + +var ownerBondsImplementors = []string{"OwnerBonds"} + +func (ec *executionContext) _OwnerBonds(ctx context.Context, sel ast.SelectionSet, obj *OwnerBonds) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, ownerBondsImplementors) + + out := graphql.NewFieldSet(fields) + var invalids uint32 + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("OwnerBonds") + case "owner": + out.Values[i] = ec._OwnerBonds_owner(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "bonds": + out.Values[i] = ec._OwnerBonds_bonds(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch() + if invalids > 0 { + return graphql.Null + } + return out +} + +var peerInfoImplementors = []string{"PeerInfo"} + +func (ec *executionContext) _PeerInfo(ctx context.Context, sel ast.SelectionSet, obj *PeerInfo) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, peerInfoImplementors) + + out := graphql.NewFieldSet(fields) + var invalids uint32 + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("PeerInfo") + case "node": + out.Values[i] = ec._PeerInfo_node(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "is_outbound": + out.Values[i] = ec._PeerInfo_is_outbound(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "remote_ip": + out.Values[i] = ec._PeerInfo_remote_ip(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch() + if invalids > 0 { + return graphql.Null + } + return out +} + +var queryImplementors = []string{"Query"} + +func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, queryImplementors) + + ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ + Object: "Query", + }) + + out := graphql.NewFieldSet(fields) + var invalids uint32 + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Query") + case "getStatus": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_getStatus(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&invalids, 1) + } + return res + }) + case "getAccounts": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_getAccounts(ctx, field) + return res + }) + case "getBondsByIds": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_getBondsByIds(ctx, field) + return res + }) + case "queryBonds": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_queryBonds(ctx, field) + return res + }) + case "queryBondsByOwner": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_queryBondsByOwner(ctx, field) + return res + }) + case "getRecordsByIds": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_getRecordsByIds(ctx, field) + return res + }) + case "queryRecords": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_queryRecords(ctx, field) + return res + }) + case "lookupAuthorities": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_lookupAuthorities(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&invalids, 1) + } + return res + }) + case "lookupNames": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_lookupNames(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&invalids, 1) + } + return res + }) + case "resolveNames": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_resolveNames(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&invalids, 1) + } + return res + }) + case "getAuctionsByIds": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_getAuctionsByIds(ctx, field) + return res + }) + case "__type": + out.Values[i] = ec._Query___type(ctx, field) + case "__schema": + out.Values[i] = ec._Query___schema(ctx, field) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch() + if invalids > 0 { + return graphql.Null + } + return out +} + +var recordImplementors = []string{"Record"} + +func (ec *executionContext) _Record(ctx context.Context, sel ast.SelectionSet, obj *Record) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, recordImplementors) + + out := graphql.NewFieldSet(fields) + var invalids uint32 + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Record") + case "id": + out.Values[i] = ec._Record_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "names": + out.Values[i] = ec._Record_names(ctx, field, obj) + case "bondId": + out.Values[i] = ec._Record_bondId(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "createTime": + out.Values[i] = ec._Record_createTime(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "expiryTime": + out.Values[i] = ec._Record_expiryTime(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "owners": + out.Values[i] = ec._Record_owners(ctx, field, obj) + case "attributes": + out.Values[i] = ec._Record_attributes(ctx, field, obj) + case "references": + out.Values[i] = ec._Record_references(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch() + if invalids > 0 { + return graphql.Null + } + return out +} + +var referenceImplementors = []string{"Reference"} + +func (ec *executionContext) _Reference(ctx context.Context, sel ast.SelectionSet, obj *Reference) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, referenceImplementors) + + out := graphql.NewFieldSet(fields) + var invalids uint32 + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Reference") + case "id": + out.Values[i] = ec._Reference_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch() + if invalids > 0 { + return graphql.Null + } + return out +} + +var statusImplementors = []string{"Status"} + +func (ec *executionContext) _Status(ctx context.Context, sel ast.SelectionSet, obj *Status) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, statusImplementors) + + out := graphql.NewFieldSet(fields) + var invalids uint32 + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Status") + case "version": + out.Values[i] = ec._Status_version(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "node": + out.Values[i] = ec._Status_node(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "sync": + out.Values[i] = ec._Status_sync(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "validator": + out.Values[i] = ec._Status_validator(ctx, field, obj) + case "validators": + out.Values[i] = ec._Status_validators(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "num_peers": + out.Values[i] = ec._Status_num_peers(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "peers": + out.Values[i] = ec._Status_peers(ctx, field, obj) + case "disk_usage": + out.Values[i] = ec._Status_disk_usage(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch() + if invalids > 0 { + return graphql.Null + } + return out +} + +var syncInfoImplementors = []string{"SyncInfo"} + +func (ec *executionContext) _SyncInfo(ctx context.Context, sel ast.SelectionSet, obj *SyncInfo) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, syncInfoImplementors) + + out := graphql.NewFieldSet(fields) + var invalids uint32 + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("SyncInfo") + case "latest_block_hash": + out.Values[i] = ec._SyncInfo_latest_block_hash(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "latest_block_height": + out.Values[i] = ec._SyncInfo_latest_block_height(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "latest_block_time": + out.Values[i] = ec._SyncInfo_latest_block_time(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "catching_up": + out.Values[i] = ec._SyncInfo_catching_up(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch() + if invalids > 0 { + return graphql.Null + } + return out +} + +var validatorInfoImplementors = []string{"ValidatorInfo"} + +func (ec *executionContext) _ValidatorInfo(ctx context.Context, sel ast.SelectionSet, obj *ValidatorInfo) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, validatorInfoImplementors) + + out := graphql.NewFieldSet(fields) + var invalids uint32 + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("ValidatorInfo") + case "address": + out.Values[i] = ec._ValidatorInfo_address(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "voting_power": + out.Values[i] = ec._ValidatorInfo_voting_power(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "proposer_priority": + out.Values[i] = ec._ValidatorInfo_proposer_priority(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch() + if invalids > 0 { + return graphql.Null + } + return out +} + +var valueImplementors = []string{"Value"} + +func (ec *executionContext) _Value(ctx context.Context, sel ast.SelectionSet, obj *Value) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, valueImplementors) + + out := graphql.NewFieldSet(fields) + var invalids uint32 + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Value") + case "null": + out.Values[i] = ec._Value_null(ctx, field, obj) + case "int": + out.Values[i] = ec._Value_int(ctx, field, obj) + case "float": + out.Values[i] = ec._Value_float(ctx, field, obj) + case "string": + out.Values[i] = ec._Value_string(ctx, field, obj) + case "boolean": + out.Values[i] = ec._Value_boolean(ctx, field, obj) + case "json": + out.Values[i] = ec._Value_json(ctx, field, obj) + case "reference": + out.Values[i] = ec._Value_reference(ctx, field, obj) + case "values": + out.Values[i] = ec._Value_values(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch() + if invalids > 0 { + return graphql.Null + } + return out +} + +var __DirectiveImplementors = []string{"__Directive"} + +func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionSet, obj *introspection.Directive) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __DirectiveImplementors) + + out := graphql.NewFieldSet(fields) + var invalids uint32 + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("__Directive") + case "name": + out.Values[i] = ec.___Directive_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "description": + out.Values[i] = ec.___Directive_description(ctx, field, obj) + case "locations": + out.Values[i] = ec.___Directive_locations(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "args": + out.Values[i] = ec.___Directive_args(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "isRepeatable": + out.Values[i] = ec.___Directive_isRepeatable(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch() + if invalids > 0 { + return graphql.Null + } + return out +} + +var __EnumValueImplementors = []string{"__EnumValue"} + +func (ec *executionContext) ___EnumValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.EnumValue) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __EnumValueImplementors) + + out := graphql.NewFieldSet(fields) + var invalids uint32 + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("__EnumValue") + case "name": + out.Values[i] = ec.___EnumValue_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "description": + out.Values[i] = ec.___EnumValue_description(ctx, field, obj) + case "isDeprecated": + out.Values[i] = ec.___EnumValue_isDeprecated(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "deprecationReason": + out.Values[i] = ec.___EnumValue_deprecationReason(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch() + if invalids > 0 { + return graphql.Null + } + return out +} + +var __FieldImplementors = []string{"__Field"} + +func (ec *executionContext) ___Field(ctx context.Context, sel ast.SelectionSet, obj *introspection.Field) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __FieldImplementors) + + out := graphql.NewFieldSet(fields) + var invalids uint32 + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("__Field") + case "name": + out.Values[i] = ec.___Field_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "description": + out.Values[i] = ec.___Field_description(ctx, field, obj) + case "args": + out.Values[i] = ec.___Field_args(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "type": + out.Values[i] = ec.___Field_type(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "isDeprecated": + out.Values[i] = ec.___Field_isDeprecated(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "deprecationReason": + out.Values[i] = ec.___Field_deprecationReason(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch() + if invalids > 0 { + return graphql.Null + } + return out +} + +var __InputValueImplementors = []string{"__InputValue"} + +func (ec *executionContext) ___InputValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.InputValue) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __InputValueImplementors) + + out := graphql.NewFieldSet(fields) + var invalids uint32 + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("__InputValue") + case "name": + out.Values[i] = ec.___InputValue_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "description": + out.Values[i] = ec.___InputValue_description(ctx, field, obj) + case "type": + out.Values[i] = ec.___InputValue_type(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "defaultValue": + out.Values[i] = ec.___InputValue_defaultValue(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch() + if invalids > 0 { + return graphql.Null + } + return out +} + +var __SchemaImplementors = []string{"__Schema"} + +func (ec *executionContext) ___Schema(ctx context.Context, sel ast.SelectionSet, obj *introspection.Schema) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __SchemaImplementors) + + out := graphql.NewFieldSet(fields) + var invalids uint32 + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("__Schema") + case "types": + out.Values[i] = ec.___Schema_types(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "queryType": + out.Values[i] = ec.___Schema_queryType(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "mutationType": + out.Values[i] = ec.___Schema_mutationType(ctx, field, obj) + case "subscriptionType": + out.Values[i] = ec.___Schema_subscriptionType(ctx, field, obj) + case "directives": + out.Values[i] = ec.___Schema_directives(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch() + if invalids > 0 { + return graphql.Null + } + return out +} + +var __TypeImplementors = []string{"__Type"} + +func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, obj *introspection.Type) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __TypeImplementors) + + out := graphql.NewFieldSet(fields) + var invalids uint32 + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("__Type") + case "kind": + out.Values[i] = ec.___Type_kind(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "name": + out.Values[i] = ec.___Type_name(ctx, field, obj) + case "description": + out.Values[i] = ec.___Type_description(ctx, field, obj) + case "fields": + out.Values[i] = ec.___Type_fields(ctx, field, obj) + case "interfaces": + out.Values[i] = ec.___Type_interfaces(ctx, field, obj) + case "possibleTypes": + out.Values[i] = ec.___Type_possibleTypes(ctx, field, obj) + case "enumValues": + out.Values[i] = ec.___Type_enumValues(ctx, field, obj) + case "inputFields": + out.Values[i] = ec.___Type_inputFields(ctx, field, obj) + case "ofType": + out.Values[i] = ec.___Type_ofType(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch() + if invalids > 0 { + return graphql.Null + } + return out +} + +// endregion **************************** object.gotpl **************************** + +// region ***************************** type.gotpl ***************************** + +func (ec *executionContext) marshalNAuthorityRecord2ᚕᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐAuthorityRecord(ctx context.Context, sel ast.SelectionSet, v []*AuthorityRecord) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalOAuthorityRecord2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐAuthorityRecord(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + return ret +} + +func (ec *executionContext) marshalNBond2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐBond(ctx context.Context, sel ast.SelectionSet, v *Bond) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + return ec._Bond(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interface{}) (bool, error) { + res, err := graphql.UnmarshalBoolean(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { + res := graphql.MarshalBoolean(v) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "must not be null") + } + } + return res +} + +func (ec *executionContext) marshalNCoin2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐCoin(ctx context.Context, sel ast.SelectionSet, v *Coin) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + return ec._Coin(ctx, sel, v) +} + +func (ec *executionContext) marshalNNameRecord2ᚕᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐNameRecord(ctx context.Context, sel ast.SelectionSet, v []*NameRecord) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalONameRecord2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐNameRecord(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + return ret +} + +func (ec *executionContext) marshalNNameRecordEntry2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐNameRecordEntry(ctx context.Context, sel ast.SelectionSet, v *NameRecordEntry) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + return ec._NameRecordEntry(ctx, sel, v) +} + +func (ec *executionContext) marshalNNodeInfo2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐNodeInfo(ctx context.Context, sel ast.SelectionSet, v *NodeInfo) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + return ec._NodeInfo(ctx, sel, v) +} + +func (ec *executionContext) marshalNRecord2ᚕᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐRecord(ctx context.Context, sel ast.SelectionSet, v []*Record) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalORecord2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐRecord(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + return ret +} + +func (ec *executionContext) marshalNStatus2githubᚗcomᚋtharsisᚋethermintᚋgqlᚐStatus(ctx context.Context, sel ast.SelectionSet, v Status) graphql.Marshaler { + return ec._Status(ctx, sel, &v) +} + +func (ec *executionContext) marshalNStatus2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐStatus(ctx context.Context, sel ast.SelectionSet, v *Status) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + return ec._Status(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNString2string(ctx context.Context, v interface{}) (string, error) { + res, err := graphql.UnmarshalString(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { + res := graphql.MarshalString(v) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "must not be null") + } + } + return res +} + +func (ec *executionContext) marshalNSyncInfo2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐSyncInfo(ctx context.Context, sel ast.SelectionSet, v *SyncInfo) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + return ec._SyncInfo(ctx, sel, v) +} + +func (ec *executionContext) marshalNValidatorInfo2ᚕᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐValidatorInfo(ctx context.Context, sel ast.SelectionSet, v []*ValidatorInfo) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalOValidatorInfo2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐValidatorInfo(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + return ret +} + +func (ec *executionContext) marshalNValue2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐValue(ctx context.Context, sel ast.SelectionSet, v *Value) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + return ec._Value(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNValueInput2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐValueInput(ctx context.Context, v interface{}) (*ValueInput, error) { + res, err := ec.unmarshalInputValueInput(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalN__Directive2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx context.Context, sel ast.SelectionSet, v introspection.Directive) graphql.Marshaler { + return ec.___Directive(ctx, sel, &v) +} + +func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirectiveᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.Directive) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalN__Directive2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) unmarshalN__DirectiveLocation2string(ctx context.Context, v interface{}) (string, error) { + res, err := graphql.UnmarshalString(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalN__DirectiveLocation2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { + res := graphql.MarshalString(v) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "must not be null") + } + } + return res +} + +func (ec *executionContext) unmarshalN__DirectiveLocation2ᚕstringᚄ(ctx context.Context, v interface{}) ([]string, error) { + var vSlice []interface{} + if v != nil { + if tmp1, ok := v.([]interface{}); ok { + vSlice = tmp1 + } else { + vSlice = []interface{}{v} + } + } + var err error + res := make([]string, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalN__DirectiveLocation2string(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) marshalN__DirectiveLocation2ᚕstringᚄ(ctx context.Context, sel ast.SelectionSet, v []string) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalN__DirectiveLocation2string(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalN__EnumValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx context.Context, sel ast.SelectionSet, v introspection.EnumValue) graphql.Marshaler { + return ec.___EnumValue(ctx, sel, &v) +} + +func (ec *executionContext) marshalN__Field2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx context.Context, sel ast.SelectionSet, v introspection.Field) graphql.Marshaler { + return ec.___Field(ctx, sel, &v) +} + +func (ec *executionContext) marshalN__InputValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx context.Context, sel ast.SelectionSet, v introspection.InputValue) graphql.Marshaler { + return ec.___InputValue(ctx, sel, &v) +} + +func (ec *executionContext) marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.InputValue) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalN__InputValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalN__Type2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v introspection.Type) graphql.Marshaler { + return ec.___Type(ctx, sel, &v) +} + +func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.Type) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalN__Type2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v *introspection.Type) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + return ec.___Type(ctx, sel, v) +} + +func (ec *executionContext) unmarshalN__TypeKind2string(ctx context.Context, v interface{}) (string, error) { + res, err := graphql.UnmarshalString(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { + res := graphql.MarshalString(v) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "must not be null") + } + } + return res +} + +func (ec *executionContext) marshalOAccount2ᚕᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐAccount(ctx context.Context, sel ast.SelectionSet, v []*Account) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalOAccount2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐAccount(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + return ret +} + +func (ec *executionContext) marshalOAccount2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐAccount(ctx context.Context, sel ast.SelectionSet, v *Account) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._Account(ctx, sel, v) +} + +func (ec *executionContext) marshalOAuction2ᚕᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐAuction(ctx context.Context, sel ast.SelectionSet, v []*Auction) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalOAuction2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐAuction(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + return ret +} + +func (ec *executionContext) marshalOAuction2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐAuction(ctx context.Context, sel ast.SelectionSet, v *Auction) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._Auction(ctx, sel, v) +} + +func (ec *executionContext) marshalOAuctionBid2ᚕᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐAuctionBid(ctx context.Context, sel ast.SelectionSet, v []*AuctionBid) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalOAuctionBid2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐAuctionBid(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + return ret +} + +func (ec *executionContext) marshalOAuctionBid2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐAuctionBid(ctx context.Context, sel ast.SelectionSet, v *AuctionBid) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._AuctionBid(ctx, sel, v) +} + +func (ec *executionContext) marshalOAuthorityRecord2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐAuthorityRecord(ctx context.Context, sel ast.SelectionSet, v *AuthorityRecord) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._AuthorityRecord(ctx, sel, v) +} + +func (ec *executionContext) marshalOBond2ᚕᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐBond(ctx context.Context, sel ast.SelectionSet, v []*Bond) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalOBond2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐBond(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + return ret +} + +func (ec *executionContext) marshalOBond2ᚕᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐBondᚄ(ctx context.Context, sel ast.SelectionSet, v []*Bond) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNBond2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐBond(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalOBond2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐBond(ctx context.Context, sel ast.SelectionSet, v *Bond) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._Bond(ctx, sel, v) +} + +func (ec *executionContext) unmarshalOBoolean2bool(ctx context.Context, v interface{}) (bool, error) { + res, err := graphql.UnmarshalBoolean(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { + return graphql.MarshalBoolean(v) +} + +func (ec *executionContext) unmarshalOBoolean2ᚖbool(ctx context.Context, v interface{}) (*bool, error) { + if v == nil { + return nil, nil + } + res, err := graphql.UnmarshalBoolean(v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOBoolean2ᚖbool(ctx context.Context, sel ast.SelectionSet, v *bool) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return graphql.MarshalBoolean(*v) +} + +func (ec *executionContext) marshalOCoin2ᚕᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐCoinᚄ(ctx context.Context, sel ast.SelectionSet, v []*Coin) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNCoin2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐCoin(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) unmarshalOFloat2ᚖfloat64(ctx context.Context, v interface{}) (*float64, error) { + if v == nil { + return nil, nil + } + res, err := graphql.UnmarshalFloat(v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOFloat2ᚖfloat64(ctx context.Context, sel ast.SelectionSet, v *float64) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return graphql.MarshalFloat(*v) +} + +func (ec *executionContext) unmarshalOInt2ᚖint(ctx context.Context, v interface{}) (*int, error) { + if v == nil { + return nil, nil + } + res, err := graphql.UnmarshalInt(v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOInt2ᚖint(ctx context.Context, sel ast.SelectionSet, v *int) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return graphql.MarshalInt(*v) +} + +func (ec *executionContext) marshalOKeyValue2ᚕᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐKeyValue(ctx context.Context, sel ast.SelectionSet, v []*KeyValue) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalOKeyValue2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐKeyValue(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + return ret +} + +func (ec *executionContext) marshalOKeyValue2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐKeyValue(ctx context.Context, sel ast.SelectionSet, v *KeyValue) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._KeyValue(ctx, sel, v) +} + +func (ec *executionContext) unmarshalOKeyValueInput2ᚕᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐKeyValueInput(ctx context.Context, v interface{}) ([]*KeyValueInput, error) { + if v == nil { + return nil, nil + } + var vSlice []interface{} + if v != nil { + if tmp1, ok := v.([]interface{}); ok { + vSlice = tmp1 + } else { + vSlice = []interface{}{v} + } + } + var err error + res := make([]*KeyValueInput, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalOKeyValueInput2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐKeyValueInput(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) unmarshalOKeyValueInput2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐKeyValueInput(ctx context.Context, v interface{}) (*KeyValueInput, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputKeyValueInput(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalONameRecord2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐNameRecord(ctx context.Context, sel ast.SelectionSet, v *NameRecord) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._NameRecord(ctx, sel, v) +} + +func (ec *executionContext) marshalONameRecordEntry2ᚕᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐNameRecordEntry(ctx context.Context, sel ast.SelectionSet, v []*NameRecordEntry) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalONameRecordEntry2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐNameRecordEntry(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + return ret +} + +func (ec *executionContext) marshalONameRecordEntry2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐNameRecordEntry(ctx context.Context, sel ast.SelectionSet, v *NameRecordEntry) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._NameRecordEntry(ctx, sel, v) +} + +func (ec *executionContext) marshalOOwnerBonds2ᚕᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐOwnerBonds(ctx context.Context, sel ast.SelectionSet, v []*OwnerBonds) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalOOwnerBonds2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐOwnerBonds(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + return ret +} + +func (ec *executionContext) marshalOOwnerBonds2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐOwnerBonds(ctx context.Context, sel ast.SelectionSet, v *OwnerBonds) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._OwnerBonds(ctx, sel, v) +} + +func (ec *executionContext) marshalOPeerInfo2ᚕᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐPeerInfo(ctx context.Context, sel ast.SelectionSet, v []*PeerInfo) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalOPeerInfo2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐPeerInfo(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + return ret +} + +func (ec *executionContext) marshalOPeerInfo2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐPeerInfo(ctx context.Context, sel ast.SelectionSet, v *PeerInfo) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._PeerInfo(ctx, sel, v) +} + +func (ec *executionContext) marshalORecord2ᚕᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐRecord(ctx context.Context, sel ast.SelectionSet, v []*Record) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalORecord2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐRecord(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + return ret +} + +func (ec *executionContext) marshalORecord2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐRecord(ctx context.Context, sel ast.SelectionSet, v *Record) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._Record(ctx, sel, v) +} + +func (ec *executionContext) marshalOReference2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐReference(ctx context.Context, sel ast.SelectionSet, v *Reference) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._Reference(ctx, sel, v) +} + +func (ec *executionContext) unmarshalOReferenceInput2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐReferenceInput(ctx context.Context, v interface{}) (*ReferenceInput, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputReferenceInput(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) unmarshalOString2string(ctx context.Context, v interface{}) (string, error) { + res, err := graphql.UnmarshalString(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { + return graphql.MarshalString(v) +} + +func (ec *executionContext) unmarshalOString2ᚕstringᚄ(ctx context.Context, v interface{}) ([]string, error) { + if v == nil { + return nil, nil + } + var vSlice []interface{} + if v != nil { + if tmp1, ok := v.([]interface{}); ok { + vSlice = tmp1 + } else { + vSlice = []interface{}{v} + } + } + var err error + res := make([]string, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalNString2string(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) marshalOString2ᚕstringᚄ(ctx context.Context, sel ast.SelectionSet, v []string) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + for i := range v { + ret[i] = ec.marshalNString2string(ctx, sel, v[i]) + } + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) unmarshalOString2ᚖstring(ctx context.Context, v interface{}) (*string, error) { + if v == nil { + return nil, nil + } + res, err := graphql.UnmarshalString(v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOString2ᚖstring(ctx context.Context, sel ast.SelectionSet, v *string) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return graphql.MarshalString(*v) +} + +func (ec *executionContext) marshalOValidatorInfo2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐValidatorInfo(ctx context.Context, sel ast.SelectionSet, v *ValidatorInfo) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._ValidatorInfo(ctx, sel, v) +} + +func (ec *executionContext) marshalOValue2ᚕᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐValue(ctx context.Context, sel ast.SelectionSet, v []*Value) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalOValue2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐValue(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + return ret +} + +func (ec *executionContext) marshalOValue2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐValue(ctx context.Context, sel ast.SelectionSet, v *Value) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._Value(ctx, sel, v) +} + +func (ec *executionContext) unmarshalOValueInput2ᚕᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐValueInput(ctx context.Context, v interface{}) ([]*ValueInput, error) { + if v == nil { + return nil, nil + } + var vSlice []interface{} + if v != nil { + if tmp1, ok := v.([]interface{}); ok { + vSlice = tmp1 + } else { + vSlice = []interface{}{v} + } + } + var err error + res := make([]*ValueInput, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalOValueInput2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐValueInput(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) unmarshalOValueInput2ᚖgithubᚗcomᚋtharsisᚋethermintᚋgqlᚐValueInput(ctx context.Context, v interface{}) (*ValueInput, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputValueInput(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValueᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.EnumValue) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalN__EnumValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐFieldᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.Field) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalN__Field2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.InputValue) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalN__InputValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx context.Context, sel ast.SelectionSet, v *introspection.Schema) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec.___Schema(ctx, sel, v) +} + +func (ec *executionContext) marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.Type) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalN__Type2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v *introspection.Type) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec.___Type(ctx, sel, v) +} + +// endregion ***************************** type.gotpl ***************************** diff --git a/gql/gqlgen.yml b/gql/gqlgen.yml new file mode 100644 index 00000000..c50c7b44 --- /dev/null +++ b/gql/gqlgen.yml @@ -0,0 +1,14 @@ +# .gqlgen.yml example +# +# Refer to https://gqlgen.com/config/ +# for detailed .gqlgen.yml documentation. + +schema: + - vulcanize/chiba-clonk/*.graphql +exec: + filename: generated.go +model: + filename: models_gen.go +resolver: + filename: resolver.go + type: Resolver \ No newline at end of file diff --git a/gql/models_gen.go b/gql/models_gen.go new file mode 100644 index 00000000..4fcef293 --- /dev/null +++ b/gql/models_gen.go @@ -0,0 +1,160 @@ +// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. + +package gql + +type Account struct { + Address string `json:"address"` + PubKey *string `json:"pubKey"` + Number string `json:"number"` + Sequence string `json:"sequence"` + Balance []*Coin `json:"balance"` +} + +type Auction struct { + ID string `json:"id"` + Status string `json:"status"` + OwnerAddress string `json:"ownerAddress"` + CreateTime string `json:"createTime"` + CommitsEndTime string `json:"commitsEndTime"` + RevealsEndTime string `json:"revealsEndTime"` + CommitFee *Coin `json:"commitFee"` + RevealFee *Coin `json:"revealFee"` + MinimumBid *Coin `json:"minimumBid"` + WinnerAddress string `json:"winnerAddress"` + WinnerBid *Coin `json:"winnerBid"` + WinnerPrice *Coin `json:"winnerPrice"` + Bids []*AuctionBid `json:"bids"` +} + +type AuctionBid struct { + BidderAddress string `json:"bidderAddress"` + Status string `json:"status"` + CommitHash string `json:"commitHash"` + CommitTime string `json:"commitTime"` + CommitFee *Coin `json:"commitFee"` + RevealTime string `json:"revealTime"` + RevealFee *Coin `json:"revealFee"` + BidAmount *Coin `json:"bidAmount"` +} + +type AuthorityRecord struct { + OwnerAddress string `json:"ownerAddress"` + OwnerPublicKey string `json:"ownerPublicKey"` + Height string `json:"height"` + Status string `json:"status"` + BondID string `json:"bondId"` + ExpiryTime string `json:"expiryTime"` + Auction *Auction `json:"auction"` +} + +type Bond struct { + ID string `json:"id"` + Owner string `json:"owner"` + Balance []*Coin `json:"balance"` +} + +type Coin struct { + Type string `json:"type"` + Quantity string `json:"quantity"` +} + +type KeyValue struct { + Key string `json:"key"` + Value *Value `json:"value"` +} + +type KeyValueInput struct { + Key string `json:"key"` + Value *ValueInput `json:"value"` +} + +type NameRecord struct { + Latest *NameRecordEntry `json:"latest"` + History []*NameRecordEntry `json:"history"` +} + +type NameRecordEntry struct { + ID string `json:"id"` + Height string `json:"height"` +} + +type NodeInfo struct { + ID string `json:"id"` + Network string `json:"network"` + Moniker string `json:"moniker"` +} + +type OwnerBonds struct { + Owner string `json:"owner"` + Bonds []*Bond `json:"bonds"` +} + +type PeerInfo struct { + Node *NodeInfo `json:"node"` + IsOutbound bool `json:"is_outbound"` + RemoteIP string `json:"remote_ip"` +} + +type Record struct { + ID string `json:"id"` + Names []string `json:"names"` + BondID string `json:"bondId"` + CreateTime string `json:"createTime"` + ExpiryTime string `json:"expiryTime"` + Owners []string `json:"owners"` + Attributes []*KeyValue `json:"attributes"` + References []*Record `json:"references"` +} + +type Reference struct { + ID string `json:"id"` +} + +type ReferenceInput struct { + ID string `json:"id"` +} + +type Status struct { + Version string `json:"version"` + Node *NodeInfo `json:"node"` + Sync *SyncInfo `json:"sync"` + Validator *ValidatorInfo `json:"validator"` + Validators []*ValidatorInfo `json:"validators"` + NumPeers string `json:"num_peers"` + Peers []*PeerInfo `json:"peers"` + DiskUsage string `json:"disk_usage"` +} + +type SyncInfo struct { + LatestBlockHash string `json:"latest_block_hash"` + LatestBlockHeight string `json:"latest_block_height"` + LatestBlockTime string `json:"latest_block_time"` + CatchingUp bool `json:"catching_up"` +} + +type ValidatorInfo struct { + Address string `json:"address"` + VotingPower string `json:"voting_power"` + ProposerPriority *string `json:"proposer_priority"` +} + +type Value struct { + Null *bool `json:"null"` + Int *int `json:"int"` + Float *float64 `json:"float"` + String *string `json:"string"` + Boolean *bool `json:"boolean"` + JSON *string `json:"json"` + Reference *Reference `json:"reference"` + Values []*Value `json:"values"` +} + +type ValueInput struct { + Null *bool `json:"null"` + Int *int `json:"int"` + Float *float64 `json:"float"` + String *string `json:"string"` + Boolean *bool `json:"boolean"` + Reference *ReferenceInput `json:"reference"` + Values []*ValueInput `json:"values"` +} diff --git a/gql/resolver.go b/gql/resolver.go new file mode 100644 index 00000000..7b02db5d --- /dev/null +++ b/gql/resolver.go @@ -0,0 +1,348 @@ +package gql + +import ( + "context" + "encoding/base64" + "strconv" + + "github.com/cosmos/cosmos-sdk/client" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + auctiontypes "github.com/tharsis/ethermint/x/auction/types" + bondtypes "github.com/tharsis/ethermint/x/bond/types" + nstypes "github.com/tharsis/ethermint/x/nameservice/types" +) + +// DefaultLogNumLines is the number of log lines to tail by default. +const DefaultLogNumLines = 50 + +// MaxLogNumLines is the max number of log lines that can be tailed. +const MaxLogNumLines = 1000 + +type Resolver struct { + ctx client.Context + logFile string +} + +// Query is the entry point to query execution. +func (r *Resolver) Query() QueryResolver { + return &queryResolver{r} +} + +type queryResolver struct{ *Resolver } + +func (q queryResolver) LookupAuthorities(ctx context.Context, names []string) ([]*AuthorityRecord, error) { + nsQueryClient := nstypes.NewQueryClient(q.ctx) + auctionQueryClient := auctiontypes.NewQueryClient(q.ctx) + var gqlResponse []*AuthorityRecord + + for _, name := range names { + res, err := nsQueryClient.Whois(context.Background(), &nstypes.QueryWhoisRequest{Name: name}) + if err != nil { + return nil, err + } + + nameAuthority := res.GetNameAuthority() + gqlNameAuthorityRecord, err := GetGQLNameAuthorityRecord(&nameAuthority) + if err != nil { + return nil, err + } + + if nameAuthority.AuctionId != "" { + auctionResp, err := auctionQueryClient.GetAuction(context.Background(), &auctiontypes.AuctionRequest{Id: nameAuthority.GetAuctionId()}) + if err != nil { + return nil, err + } + bidsResp, err := auctionQueryClient.GetBids(context.Background(), &auctiontypes.BidsRequest{AuctionId: nameAuthority.GetAuctionId()}) + if err != nil { + return nil, err + } + + gqlAuctionRecord, err := GetGQLAuction(auctionResp.GetAuction(), bidsResp.GetBids()) + if err != nil { + return nil, err + } + + gqlNameAuthorityRecord.Auction = gqlAuctionRecord + } + + gqlResponse = append(gqlResponse, gqlNameAuthorityRecord) + } + + return gqlResponse, nil +} + +func (q queryResolver) ResolveNames(ctx context.Context, names []string) ([]*Record, error) { + nsQueryClient := nstypes.NewQueryClient(q.ctx) + var gqlResponse []*Record + for _, name := range names { + res, err := nsQueryClient.ResolveCrn(context.Background(), &nstypes.QueryResolveCrn{Crn: name}) + if err != nil { + // Return nil for record not found. + gqlResponse = append(gqlResponse, nil) + } else { + gqlRecord, err := getGQLRecord(context.Background(), q, *res.GetRecord()) + if err != nil { + return nil, err + } + + gqlResponse = append(gqlResponse, gqlRecord) + } + } + + return gqlResponse, nil +} + +func (q queryResolver) LookupNames(ctx context.Context, names []string) ([]*NameRecord, error) { + nsQueryClient := nstypes.NewQueryClient(q.ctx) + var gqlResponse []*NameRecord + + for _, name := range names { + res, err := nsQueryClient.LookupCrn(context.Background(), &nstypes.QueryLookupCrn{Crn: name}) + if err != nil { + // Return nil for name not found. + gqlResponse = append(gqlResponse, nil) + } else { + gqlRecord, err := getGQLNameRecord(res.GetName()) + if err != nil { + return nil, err + } + + gqlResponse = append(gqlResponse, gqlRecord) + } + } + + return gqlResponse, nil +} + +func (q queryResolver) QueryRecords(ctx context.Context, attributes []*KeyValueInput, all *bool) ([]*Record, error) { + nsQueryClient := nstypes.NewQueryClient(q.ctx) + + res, err := nsQueryClient.ListRecords( + context.Background(), + &nstypes.QueryListRecordsRequest{ + Attributes: parseRequestAttributes(attributes), + All: (all != nil && *all), + }, + ) + + if err != nil { + return nil, err + } + + records := res.GetRecords() + gqlResponse := make([]*Record, len(records)) + + for i, record := range records { + gqlRecord, err := getGQLRecord(context.Background(), q, record) + if err != nil { + return nil, err + } + gqlResponse[i] = gqlRecord + } + + return gqlResponse, nil + +} + +func (q queryResolver) GetRecordsByIds(ctx context.Context, ids []string) ([]*Record, error) { + nsQueryClient := nstypes.NewQueryClient(q.ctx) + gqlResponse := make([]*Record, len(ids)) + + for i, id := range ids { + res, err := nsQueryClient.GetRecord(context.Background(), &nstypes.QueryRecordByIdRequest{Id: id}) + if err != nil { + // Return nil for record not found. + gqlResponse[i] = nil + } else { + record, err := getGQLRecord(context.Background(), q, res.GetRecord()) + if err != nil { + return nil, err + } + gqlResponse[i] = record + } + } + + return gqlResponse, nil +} + +func (q queryResolver) GetStatus(ctx context.Context) (*Status, error) { + nodeInfo, syncInfo, validatorInfo, err := getStatusInfo(q.ctx) + if err != nil { + return nil, err + } + + numPeers, peers, err := getNetInfo(q.ctx) + if err != nil { + return nil, err + } + + validatorSet, err := getValidatorSet(q.ctx) + if err != nil { + return nil, err + } + + diskUsage, err := GetDiskUsage(NodeDataPath) + if err != nil { + return nil, err + } + + return &Status{ + Version: NameServiceVersion, + Node: nodeInfo, + Sync: syncInfo, + Validator: validatorInfo, + Validators: validatorSet, + NumPeers: numPeers, + Peers: peers, + DiskUsage: diskUsage, + }, nil +} + +func (q queryResolver) GetAccounts(ctx context.Context, addresses []string) ([]*Account, error) { + accounts := make([]*Account, len(addresses)) + for index, address := range addresses { + account, err := q.GetAccount(ctx, address) + if err != nil { + return nil, err + } + accounts[index] = account + } + return accounts, nil +} + +func (q queryResolver) GetAccount(ctx context.Context, address string) (*Account, error) { + authQueryClient := authtypes.NewQueryClient(q.ctx) + accountResponse, err := authQueryClient.Account(ctx, &authtypes.QueryAccountRequest{Address: address}) + if err != nil { + return nil, err + } + var account authtypes.AccountI + err = q.ctx.Codec.UnpackAny(accountResponse.GetAccount(), &account) + if err != nil { + return nil, err + } + var pubKey *string + if account.GetPubKey() != nil { + pubKeyStr := base64.StdEncoding.EncodeToString(account.GetPubKey().Bytes()) + pubKey = &pubKeyStr + } + + // Get the account balance + bankQueryClient := banktypes.NewQueryClient(q.ctx) + balance, err := bankQueryClient.AllBalances(ctx, &banktypes.QueryAllBalancesRequest{Address: address}) + + accNum := strconv.FormatUint(account.GetAccountNumber(), 10) + seq := strconv.FormatUint(account.GetSequence(), 10) + + return &Account{ + Address: address, + Number: accNum, + Sequence: seq, + PubKey: pubKey, + Balance: getGQLCoins(balance.GetBalances()), + }, nil +} + +func (q queryResolver) GetBondsByIds(ctx context.Context, ids []string) ([]*Bond, error) { + bonds := make([]*Bond, len(ids)) + for index, id := range ids { + bondObj, err := q.GetBond(ctx, id) + if err != nil { + return nil, err + } + bonds[index] = bondObj + } + + return bonds, nil +} + +func (q *queryResolver) GetBond(ctx context.Context, id string) (*Bond, error) { + bondQueryClient := bondtypes.NewQueryClient(q.ctx) + bondResp, err := bondQueryClient.GetBondById(context.Background(), &bondtypes.QueryGetBondByIdRequest{Id: id}) + if err != nil { + return nil, err + } + + bond := bondResp.GetBond() + if bond == nil { + return nil, nil + } + return getGQLBond(bondResp.GetBond()) +} + +func (q queryResolver) QueryBonds(ctx context.Context, attributes []*KeyValueInput) ([]*Bond, error) { + bondQueryClient := bondtypes.NewQueryClient(q.ctx) + bonds, err := bondQueryClient.Bonds(context.Background(), &bondtypes.QueryGetBondsRequest{}) + if err != nil { + return nil, err + } + + gqlResponse := make([]*Bond, len(bonds.GetBonds())) + for i, bondObj := range bonds.GetBonds() { + gqlBond, err := getGQLBond(bondObj) + if err != nil { + return nil, err + } + gqlResponse[i] = gqlBond + } + + return gqlResponse, nil +} + +// QueryBondsByOwner will return bonds by owner +func (q queryResolver) QueryBondsByOwner(ctx context.Context, ownerAddresses []string) ([]*OwnerBonds, error) { + ownerBonds := make([]*OwnerBonds, len(ownerAddresses)) + for index, ownerAddress := range ownerAddresses { + bondsObj, err := q.GetBondsByOwner(ctx, ownerAddress) + if err != nil { + return nil, err + } + ownerBonds[index] = bondsObj + } + + return ownerBonds, nil +} + +func (q queryResolver) GetBondsByOwner(ctx context.Context, address string) (*OwnerBonds, error) { + bondQueryClient := bondtypes.NewQueryClient(q.ctx) + bondResp, err := bondQueryClient.GetBondsByOwner(context.Background(), &bondtypes.QueryGetBondsByOwnerRequest{Owner: address}) + if err != nil { + return nil, err + } + + ownerBonds := make([]*Bond, len(bondResp.GetBonds())) + for i, bond := range bondResp.GetBonds() { + bondObj, err := getGQLBond(&bond) + if err != nil { + return nil, err + } + ownerBonds[i] = bondObj + } + + return &OwnerBonds{Bonds: ownerBonds, Owner: address}, nil +} + +func (q queryResolver) GetAuctionsByIds(ctx context.Context, ids []string) ([]*Auction, error) { + auctionQueryClient := auctiontypes.NewQueryClient(q.ctx) + gqlAuctionResponse := make([]*Auction, len(ids)) + for i, id := range ids { + auctionObj, err := auctionQueryClient.GetAuction(context.Background(), &auctiontypes.AuctionRequest{Id: id}) + if err != nil { + return nil, err + } + bidsObj, err := auctionQueryClient.GetBids(context.Background(), &auctiontypes.BidsRequest{AuctionId: id}) + if err != nil { + return nil, err + } + + gqlAuction, err := GetGQLAuction(auctionObj.GetAuction(), bidsObj.GetBids()) + if err != nil { + return nil, err + } + + gqlAuctionResponse[i] = gqlAuction + } + + return gqlAuctionResponse, nil +} diff --git a/gql/server.go b/gql/server.go new file mode 100644 index 00000000..3429f254 --- /dev/null +++ b/gql/server.go @@ -0,0 +1,44 @@ +package gql + +import ( + "fmt" + "github.com/99designs/gqlgen/graphql/handler" + "github.com/99designs/gqlgen/graphql/playground" + "github.com/cosmos/cosmos-sdk/client" + "github.com/ethereum/go-ethereum/log" + "github.com/spf13/viper" + "net/http" +) + +// Server configures and starts the GQL server. +func Server(ctx client.Context) { + if !viper.GetBool("gql-server") { + return + } + logFile := viper.GetString("log-file") + + port := viper.GetString("gql-port") + + srv := handler.NewDefaultServer(NewExecutableSchema(Config{Resolvers: &Resolver{ + ctx: ctx, + logFile: logFile, + }})) + + http.Handle("/", playground.Handler("GraphQL playground", "/api")) + + if viper.GetBool("gql-playground") { + apiBase := viper.GetString("gql-playground-api-base") + + http.Handle("/webui", playground.Handler("GraphQL playground", apiBase+"/api")) + http.Handle("/console", playground.Handler("GraphQL playground", apiBase+"/graphql")) + } + + http.Handle("/api", srv) + http.Handle("/graphql", srv) + + log.Info("Connect to GraphQL playground", "url", fmt.Sprintf("http://localhost:%s", port)) + err := http.ListenAndServe(":"+port, nil) + if err != nil { + panic(err) + } +} diff --git a/gql/status.go b/gql/status.go new file mode 100644 index 00000000..b774a0fc --- /dev/null +++ b/gql/status.go @@ -0,0 +1,99 @@ +package gql + +import ( + "context" + "github.com/cosmos/cosmos-sdk/client" + "os" + "os/exec" + "strconv" + "strings" +) + +// NodeDataPath is the path to the ethermintd data folder. +var NodeDataPath = os.ExpandEnv("$HOME/.ethermintd/data") + +func getStatusInfo(client client.Context) (*NodeInfo, *SyncInfo, *ValidatorInfo, error) { + nodeClient, err := client.GetNode() + if err != nil { + return nil, nil, nil, err + } + nodeStatus, err := nodeClient.Status(context.Background()) + if err != nil { + return nil, nil, nil, err + } + + return &NodeInfo{ + ID: string(nodeStatus.NodeInfo.ID()), + Network: nodeStatus.NodeInfo.Network, + Moniker: nodeStatus.NodeInfo.Moniker, + }, &SyncInfo{ + LatestBlockHash: nodeStatus.SyncInfo.LatestBlockHash.String(), + LatestBlockHeight: strconv.FormatInt(nodeStatus.SyncInfo.LatestBlockHeight, 10), + LatestBlockTime: nodeStatus.SyncInfo.LatestBlockTime.String(), + CatchingUp: nodeStatus.SyncInfo.CatchingUp, + }, &ValidatorInfo{ + Address: nodeStatus.ValidatorInfo.Address.String(), + VotingPower: strconv.FormatInt(nodeStatus.ValidatorInfo.VotingPower, 10), + ProposerPriority: nil, + }, nil +} + +func getNetInfo(client client.Context) (string, []*PeerInfo, error) { + nodeClient, err := client.GetNode() + if err != nil { + return "", nil, err + } + netInfo, err := nodeClient.NetInfo(context.Background()) + if err != nil { + return "", nil, err + } + + peers := netInfo.Peers + peersInfo := make([]*PeerInfo, len(peers)) + for index, peer := range peers { + peersInfo[index] = &PeerInfo{ + Node: &NodeInfo{ + ID: string(peer.NodeInfo.ID()), + Moniker: peer.NodeInfo.Moniker, + Network: peer.NodeInfo.Network, + }, + IsOutbound: peer.IsOutbound, + RemoteIP: peer.RemoteIP, + } + } + + return strconv.FormatInt(int64(netInfo.NPeers), 10), peersInfo, nil +} + +func getValidatorSet(client client.Context) ([]*ValidatorInfo, error) { + nodeClient, err := client.GetNode() + if err != nil { + return nil, err + } + res, err := nodeClient.Validators(context.Background(), nil, nil, nil) + if err != nil { + return nil, err + } + + validatorSet := make([]*ValidatorInfo, len(res.Validators)) + for index, validator := range res.Validators { + proposerPriority := strconv.FormatInt(validator.ProposerPriority, 10) + validatorSet[index] = &ValidatorInfo{ + Address: validator.Address.String(), + VotingPower: strconv.FormatInt(validator.VotingPower, 10), + ProposerPriority: &proposerPriority, + } + } + + return validatorSet, nil +} + +// GetDiskUsage returns disk usage for the given path. +func GetDiskUsage(dirPath string) (string, error) { + out, err := exec.Command("du", "-sh", dirPath).Output() + if err != nil { + return "", err + } + + return strings.Fields(string(out))[0], nil +} diff --git a/gql/util.go b/gql/util.go new file mode 100644 index 00000000..bbcdb2f1 --- /dev/null +++ b/gql/util.go @@ -0,0 +1,315 @@ +package gql + +import ( + "context" + "encoding/json" + "reflect" + "strconv" + + sdk "github.com/cosmos/cosmos-sdk/types" + auctiontypes "github.com/tharsis/ethermint/x/auction/types" + bondtypes "github.com/tharsis/ethermint/x/bond/types" + nstypes "github.com/tharsis/ethermint/x/nameservice/types" +) + +// OwnerAttributeName denotes the owner attribute name for a bond. +const OwnerAttributeName = "owner" + +// BondIDAttributeName denotes the record bond ID. +const BondIDAttributeName = "bondId" + +// ExpiryTimeAttributeName denotes the record expiry time. +const ExpiryTimeAttributeName = "expiryTime" + +func getGQLCoin(coin sdk.Coin) *Coin { + gqlCoin := Coin{ + Type: coin.Denom, + Quantity: coin.Amount.String(), + } + + return &gqlCoin +} + +func getGQLCoins(coins sdk.Coins) []*Coin { + gqlCoins := make([]*Coin, len(coins)) + for index, coin := range coins { + gqlCoins[index] = getGQLCoin(coin) + } + + return gqlCoins +} +func GetGQLNameAuthorityRecord(record *nstypes.NameAuthority) (*AuthorityRecord, error) { + if record == nil { + return nil, nil + } + + return &AuthorityRecord{ + OwnerAddress: record.OwnerAddress, + OwnerPublicKey: record.OwnerPublicKey, + Height: strconv.FormatUint(record.Height, 10), + Status: record.Status, + BondID: record.GetBondId(), + ExpiryTime: record.GetExpiryTime().String(), + }, nil +} + +func getGQLRecord(ctx context.Context, resolver QueryResolver, record nstypes.Record) (*Record, error) { + // Nil record. + if record.Deleted { + return nil, nil + } + + recordType := record.ToRecordType() + attributes, err := getAttributes(&recordType) + if err != nil { + return nil, err + } + + references, err := getReferences(ctx, resolver, &recordType) + if err != nil { + return nil, err + } + + return &Record{ + ID: record.Id, + BondID: record.GetBondId(), + CreateTime: record.GetCreateTime(), + ExpiryTime: record.GetExpiryTime(), + Owners: record.GetOwners(), + Names: record.GetNames(), + Attributes: attributes, + References: references, + }, nil +} + +func getGQLNameRecord(record *nstypes.NameRecord) (*NameRecord, error) { + if record == nil { + return nil, nil + } + + records := make([]*NameRecordEntry, len(record.History)) + for index, entry := range record.History { + records[index] = getNameRecordEntry(entry) + } + + return &NameRecord{ + Latest: getNameRecordEntry(record.Latest), + History: records, + }, nil +} + +func getNameRecordEntry(record *nstypes.NameRecordEntry) *NameRecordEntry { + return &NameRecordEntry{ + ID: record.Id, + Height: strconv.FormatUint(record.Height, 10), + } +} + +func getGQLBond(bondObj *bondtypes.Bond) (*Bond, error) { + // Nil record. + if bondObj == nil { + return nil, nil + } + + return &Bond{ + ID: bondObj.Id, + Owner: bondObj.Owner, + Balance: getGQLCoins(bondObj.Balance), + }, nil +} + +func matchBondOnAttributes(bondObj *bondtypes.Bond, attributes []*KeyValueInput) bool { + for _, attr := range attributes { + switch attr.Key { + case OwnerAttributeName: + { + if attr.Value.String == nil || bondObj.Owner != *attr.Value.String { + return false + } + } + default: + { + // Only attributes explicitly listed in the switch are queryable. + return false + } + } + } + + return true +} + +func getAuctionBid(bid *auctiontypes.Bid) *AuctionBid { + return &AuctionBid{ + BidderAddress: bid.BidderAddress, + Status: bid.Status, + CommitHash: bid.CommitHash, + CommitTime: bid.GetCommitTime(), + RevealTime: bid.GetRevealTime(), + CommitFee: getGQLCoin(bid.CommitFee), + RevealFee: getGQLCoin(bid.RevealFee), + BidAmount: getGQLCoin(bid.BidAmount), + } +} + +func GetGQLAuction(auction *auctiontypes.Auction, bids []*auctiontypes.Bid) (*Auction, error) { + if auction == nil { + return nil, nil + } + + gqlAuction := Auction{ + ID: auction.Id, + Status: auction.Status, + OwnerAddress: auction.OwnerAddress, + CreateTime: auction.GetCreateTime(), + CommitsEndTime: auction.GetCommitsEndTime(), + RevealsEndTime: auction.GetRevealsEndTime(), + CommitFee: getGQLCoin(auction.CommitFee), + RevealFee: getGQLCoin(auction.RevealFee), + MinimumBid: getGQLCoin(auction.MinimumBid), + WinnerAddress: auction.WinnerAddress, + WinnerBid: getGQLCoin(auction.WinningBid), + WinnerPrice: getGQLCoin(auction.WinningPrice), + } + + auctionBids := make([]*AuctionBid, len(bids)) + for index, entry := range bids { + auctionBids[index] = getAuctionBid(entry) + } + + gqlAuction.Bids = auctionBids + + return &gqlAuction, nil +} + +func getReferences(ctx context.Context, resolver QueryResolver, r *nstypes.RecordType) ([]*Record, error) { + var ids []string + + for _, value := range r.Attributes { + switch value.(type) { + case interface{}: + if obj, ok := value.(map[string]interface{}); ok { + if _, ok := obj["/"]; ok && len(obj) == 1 { + if _, ok := obj["/"].(string); ok { + ids = append(ids, obj["/"].(string)) + } + } + } + } + } + + return resolver.GetRecordsByIds(ctx, ids) +} + +func getAttributes(r *nstypes.RecordType) ([]*KeyValue, error) { + return mapToKeyValuePairs(r.Attributes) +} + +func mapToKeyValuePairs(attrs map[string]interface{}) ([]*KeyValue, error) { + var kvPairs []*KeyValue + + trueVal := true + falseVal := false + + for key, value := range attrs { + kvPair := &KeyValue{ + Key: key, + Value: &Value{}, + } + + switch val := value.(type) { + case nil: + kvPair.Value.Null = &trueVal + case int: + kvPair.Value.Int = &val + case float64: + kvPair.Value.Float = &val + case string: + kvPair.Value.String = &val + case bool: + kvPair.Value.Boolean = &val + case interface{}: + if obj, ok := value.(map[string]interface{}); ok { + if _, ok := obj["/"]; ok && len(obj) == 1 { + if _, ok := obj["/"].(string); ok { + kvPair.Value.Reference = &Reference{ + ID: obj["/"].(string), + } + } + } else { + bytes, err := json.Marshal(obj) + if err != nil { + return nil, err + } + + jsonStr := string(bytes) + kvPair.Value.JSON = &jsonStr + } + } + } + + if kvPair.Value.Null == nil { + kvPair.Value.Null = &falseVal + } + + valueType := reflect.ValueOf(value) + if valueType.Kind() == reflect.Slice { + bytes, err := json.Marshal(value) + if err != nil { + return nil, err + } + + jsonStr := string(bytes) + kvPair.Value.JSON = &jsonStr + } + + kvPairs = append(kvPairs, kvPair) + } + + return kvPairs, nil +} + +func parseRequestAttributes(attrs []*KeyValueInput) []*nstypes.QueryListRecordsRequest_KeyValueInput { + kvPairs := []*nstypes.QueryListRecordsRequest_KeyValueInput{} + + for _, value := range attrs { + kvPair := &nstypes.QueryListRecordsRequest_KeyValueInput{ + Key: value.Key, + Value: &nstypes.QueryListRecordsRequest_ValueInput{}, + } + + if value.Value.String != nil { + kvPair.Value.String_ = *value.Value.String + kvPair.Value.Type = "string" + } + + if value.Value.Int != nil { + kvPair.Value.Int = int64(*value.Value.Int) + kvPair.Value.Type = "int" + } + + if value.Value.Float != nil { + kvPair.Value.Float = *value.Value.Float + kvPair.Value.Type = "float" + } + + if value.Value.Boolean != nil { + kvPair.Value.Boolean = *value.Value.Boolean + kvPair.Value.Type = "boolean" + } + + if value.Value.Reference != nil { + reference := &nstypes.QueryListRecordsRequest_ReferenceInput{ + Id: value.Value.Reference.ID, + } + + kvPair.Value.Reference = reference + kvPair.Value.Type = "reference" + } + + // TODO: Handle arrays. + + kvPairs = append(kvPairs, kvPair) + } + + return kvPairs +} diff --git a/gql/version.go b/gql/version.go new file mode 100644 index 00000000..9eedc530 --- /dev/null +++ b/gql/version.go @@ -0,0 +1,4 @@ +package gql + +// NameServiceVersion is the registry API version. +const NameServiceVersion = "0.3.0" diff --git a/gql/vulcanize/chiba-clonk/schema.graphql b/gql/vulcanize/chiba-clonk/schema.graphql new file mode 100644 index 00000000..c1134277 --- /dev/null +++ b/gql/vulcanize/chiba-clonk/schema.graphql @@ -0,0 +1,260 @@ +# Reference to another record. +type Reference { + id: String! # ID of linked record. +} + +# Reference to another record. +input ReferenceInput { + id: String! +} + +# Bonds contain funds that are used to pay rent on record registration and renewal. +type Bond { + id: String! # Primary key, auto-generated by the server. + owner: String! # Bond owner cosmos-sdk address. + balance: [Coin!] # Current balance for each coin type. +} + +# OwnerBonds contains the bonds related the owner +type OwnerBonds { + owner: String! + bonds: [Bond!] +} + +# Mutations require payment in coins (e.g. 100wire). +# Used by the wallet to get the account balance for display and mutations. +type Coin { + type: String! # e.g. 'WIRE' + quantity: String! # e.g. 1000000 +} +# Represents an account on the blockchain. +# Mutations have to be signed by a particular account. +type Account { + address: String! # Blockchain address. + pubKey: String # Public key. + number: String! # Account number. + sequence: String! # Sequence number used to prevent replays. + balance: [Coin!] # Current balance for each coin type. +} + +# Value of a given type. +type Value { + null: Boolean + + int: Int + float: Float + string: String + boolean: Boolean + json: String + + reference: Reference + + values: [Value] +} +# Value of a given type used as input to queries. +input ValueInput { + null: Boolean + + int: Int + float: Float + string: String + boolean: Boolean + + reference: ReferenceInput + + values: [ValueInput] +} + +# Key/value pair. +type KeyValue { + key: String! + value: Value! +} + +# Key/value pair for inputs. +input KeyValueInput { + key: String! + value: ValueInput! +} + +# Status information about a node (https://docs.tendermint.com/master/rpc/#/Info/status). +type NodeInfo { + id: String! # Tendermint Node ID. + network: String! # Name of the network/blockchain. + moniker: String! # Name of the node. +} + +# Node sync status. +type SyncInfo { + latest_block_hash: String! + latest_block_height: String! + latest_block_time: String! + catching_up: Boolean! +} + +# Validator set info (https://docs.tendermint.com/master/rpc/#/Info/validators). +type ValidatorInfo { + address: String! + voting_power: String! + proposer_priority: String +} + +# Network/peer info (https://docs.tendermint.com/master/rpc/#/Info/net_info). +type PeerInfo { + node: NodeInfo! + is_outbound: Boolean! + remote_ip: String! +} + +# Vulcanize chiba-clonk status. +type Status { + version: String! + node: NodeInfo! + sync: SyncInfo! + validator: ValidatorInfo + validators: [ValidatorInfo]! + num_peers: String! + peers: [PeerInfo] + disk_usage: String! +} + + +# An auction bid. +type AuctionBid { + bidderAddress: String! + status: String! + commitHash: String! + commitTime: String! + commitFee: Coin! + revealTime: String! + revealFee: Coin! + bidAmount: Coin! +} + +# A sealed-bid, 2nd price auction. +type Auction { + id: String! # Auction ID. + status: String! # Auction status (commit, reveal, expired). + ownerAddress: String! # Auction owner time. + createTime: String! # Create time. + commitsEndTime: String! # Commit phase end time. + revealsEndTime: String! # Reveal phase end time. + commitFee: Coin! # Fee required to bid/participate in the auction. + revealFee: Coin! # Reveal fee (paid back to bidders only if they unseal/reveal the bid). + minimumBid: Coin! # Minimum bid amount. + winnerAddress: String! # Winner address. + winnerBid: Coin! # The winning bid amount. + winnerPrice: Coin! # The price that the winner actually pays (2nd highest bid). + bids: [AuctionBid] # Bids make in the auction. +} + + +# Record defines the basic properties of an entity in the graph database. +type Record { + id: String! # Computed attribute: Multibase encoded content hash (https://github.com/multiformats/multibase). + names: [String!] # Names pointing to this CID (reverse lookup). + + bondId: String! # Associated bond ID. + createTime: String! # Record create time. + expiryTime: String! # Record expiry time. + + owners: [String!] # Addresses of record owners. + attributes: [KeyValue] # Record attributes. + references: [Record] # Record references. +} + +# Name authority record. +type AuthorityRecord { + ownerAddress: String! # Owner address. + ownerPublicKey: String! # Owner public key. + height: String! # Height at which record was created. + status: String! # Status (active, auction, expired). + bondId: String! # Associated bond ID. + expiryTime: String! # Authority expiry time. + auction: Auction # Authority auction. +} + +# Name record entry, created at a particular height. +type NameRecordEntry { + id: String! # Target record ID. + height: String! # Height at which record was created. +} + +# Name record stores the latest and historical name -> record ID mappings. +type NameRecord { + latest: NameRecordEntry! # Latest mame record entry. + history: [NameRecordEntry] # Historical name record entries. +} + +type Query { + # + # Status API. + # + getStatus: Status! + + # Get blockchain accounts. + getAccounts( + addresses: [String!] + ): [Account] + + # Get bonds by IDs. + getBondsByIds( + ids: [String!] + ): [Bond] + + # Query bonds. + queryBonds( + attributes: [KeyValueInput] + ): [Bond] + + # Query bonds by owner. + queryBondsByOwner( + ownerAddresses: [String!] + ): [OwnerBonds] + + # + # GraphDB API. + # + + # Get records by IDs. + getRecordsByIds( + ids: [String!] + ): [Record] + + # Query records. + queryRecords( + # Multiple attribute conditions are in a logical AND. + attributes: [KeyValueInput] + + # Whether to query all records, not just named ones (false by default). + all: Boolean + ): [Record] + + # + # Naming API. + # + + # Lookup authority information. + lookupAuthorities( + names: [String!] + ): [AuthorityRecord]! + + # Lookup name to record mapping information. + lookupNames( + names: [String!] + ): [NameRecord]! + + # Resolve names to records. + resolveNames( + names: [String!] + ): [Record]! + + # + # Auctions API. + # + + # Get auctions by IDs. + getAuctionsByIds( + ids: [String!] + ): [Auction] +} \ No newline at end of file diff --git a/init.bat b/init.bat index 54244d0e..c765712a 100644 --- a/init.bat +++ b/init.bat @@ -1,5 +1,5 @@ -rem ethermint compile on windows +rem chibaclonk compile on windows rem install golang , gcc, sed for windows rem 1. install msys2 : https://www.msys2.org/ rem 2. pacman -S mingw-w64-x86_64-toolchain @@ -9,7 +9,7 @@ rem 3. add path C:\msys64\mingw64\bin rem C:\msys64\usr\bin set KEY="mykey" -set CHAINID="ethermint_9000-1" +set CHAINID="chibaclonk_9000-1" set MONIKER="localtestnet" set KEYRING="test" set KEYALGO="eth_secp256k1" @@ -17,26 +17,26 @@ set LOGLEVEL="info" rem to trace evm rem TRACE="--trace" set TRACE="" -set HOME=%USERPROFILE%\.ethermintd +set HOME=%USERPROFILE%\.chibaclonkd echo %HOME% set ETHCONFIG=%HOME%\config\config.toml set GENESIS=%HOME%\config\genesis.json set TMPGENESIS=%HOME%\config\tmp_genesis.json @echo build binary -go build .\cmd\ethermintd +go build .\cmd\chibaclonkd @echo clear home folder del /s /q %HOME% -ethermintd config keyring-backend %KEYRING% -ethermintd config chain-id %CHAINID% +chibaclonkd config keyring-backend %KEYRING% +chibaclonkd config chain-id %CHAINID% -ethermintd keys add %KEY% --keyring-backend %KEYRING% --algo %KEYALGO% +chibaclonkd keys add %KEY% --keyring-backend %KEYRING% --algo %KEYALGO% -rem Set moniker and chain-id for Ethermint (Moniker can be anything, chain-id must be an integer) -ethermintd init %MONIKER% --chain-id %CHAINID% +rem Set moniker and chain-id for chibaclonk (Moniker can be anything, chain-id must be an integer) +chibaclonkd init %MONIKER% --chain-id %CHAINID% rem Change parameter token denominations to aphoton cat %GENESIS% | jq ".app_state[\"staking\"][\"params\"][\"bond_denom\"]=\"aphoton\"" > %TMPGENESIS% && move %TMPGENESIS% %GENESIS% @@ -54,18 +54,18 @@ rem setup sed -i "s/create_empty_blocks = true/create_empty_blocks = false/g" %ETHCONFIG% rem Allocate genesis accounts (cosmos formatted addresses) -ethermintd add-genesis-account %KEY% 100000000000000000000000000aphoton --keyring-backend %KEYRING% +chibaclonkd add-genesis-account %KEY% 100000000000000000000000000aphoton --keyring-backend %KEYRING% rem Sign genesis transaction -ethermintd gentx %KEY% 1000000000000000000000aphoton --keyring-backend %KEYRING% --chain-id %CHAINID% +chibaclonkd gentx %KEY% 1000000000000000000000aphoton --keyring-backend %KEYRING% --chain-id %CHAINID% rem Collect genesis tx -ethermintd collect-gentxs +chibaclonkd collect-gentxs rem Run this to ensure everything worked and that the genesis file is setup correctly -ethermintd validate-genesis +chibaclonkd validate-genesis rem Start the node (remove the --pruning=nothing flag if historical queries are not needed) -ethermintd start --pruning=nothing %TRACE% --log_level %LOGLEVEL% --minimum-gas-prices=0.0001aphoton \ No newline at end of file +chibaclonkd start --pruning=nothing %TRACE% --log_level %LOGLEVEL% --minimum-gas-prices=0.0001aphoton \ No newline at end of file diff --git a/init.sh b/init.sh index de11d281..bfd5f72d 100755 --- a/init.sh +++ b/init.sh @@ -1,7 +1,7 @@ #!/bin/bash KEY="mykey" -CHAINID="ethermint_9000-1" +CHAINID="chibaclonk_9000-1" MONIKER="localtestnet" KEYRING="test" KEYALGO="eth_secp256k1" @@ -14,77 +14,101 @@ TRACE="--trace" command -v jq > /dev/null 2>&1 || { echo >&2 "jq not installed. More info: https://stedolan.github.io/jq/download/"; exit 1; } # remove existing daemon and client -rm -rf ~/.ethermintd* +rm -rf ~/.chibaclonk* make install -ethermintd config keyring-backend $KEYRING -ethermintd config chain-id $CHAINID +chibaclonkd config keyring-backend $KEYRING +chibaclonkd config chain-id $CHAINID # if $KEY exists it should be deleted -ethermintd keys add $KEY --keyring-backend $KEYRING --algo $KEYALGO +chibaclonkd keys add $KEY --keyring-backend $KEYRING --algo $KEYALGO -# Set moniker and chain-id for Ethermint (Moniker can be anything, chain-id must be an integer) -ethermintd init $MONIKER --chain-id $CHAINID +# Set moniker and chain-id for chibaclonk (Moniker can be anything, chain-id must be an integer) +chibaclonkd init $MONIKER --chain-id $CHAINID # Change parameter token denominations to aphoton -cat $HOME/.ethermintd/config/genesis.json | jq '.app_state["staking"]["params"]["bond_denom"]="aphoton"' > $HOME/.ethermintd/config/tmp_genesis.json && mv $HOME/.ethermintd/config/tmp_genesis.json $HOME/.ethermintd/config/genesis.json -cat $HOME/.ethermintd/config/genesis.json | jq '.app_state["crisis"]["constant_fee"]["denom"]="aphoton"' > $HOME/.ethermintd/config/tmp_genesis.json && mv $HOME/.ethermintd/config/tmp_genesis.json $HOME/.ethermintd/config/genesis.json -cat $HOME/.ethermintd/config/genesis.json | jq '.app_state["gov"]["deposit_params"]["min_deposit"][0]["denom"]="aphoton"' > $HOME/.ethermintd/config/tmp_genesis.json && mv $HOME/.ethermintd/config/tmp_genesis.json $HOME/.ethermintd/config/genesis.json -cat $HOME/.ethermintd/config/genesis.json | jq '.app_state["mint"]["params"]["mint_denom"]="aphoton"' > $HOME/.ethermintd/config/tmp_genesis.json && mv $HOME/.ethermintd/config/tmp_genesis.json $HOME/.ethermintd/config/genesis.json +cat $HOME/.chibaclonkd/config/genesis.json | jq '.app_state["staking"]["params"]["bond_denom"]="aphoton"' > $HOME/.chibaclonkd/config/tmp_genesis.json && mv $HOME/.chibaclonkd/config/tmp_genesis.json $HOME/.chibaclonkd/config/genesis.json +cat $HOME/.chibaclonkd/config/genesis.json | jq '.app_state["crisis"]["constant_fee"]["denom"]="aphoton"' > $HOME/.chibaclonkd/config/tmp_genesis.json && mv $HOME/.chibaclonkd/config/tmp_genesis.json $HOME/.chibaclonkd/config/genesis.json +cat $HOME/.chibaclonkd/config/genesis.json | jq '.app_state["gov"]["deposit_params"]["min_deposit"][0]["denom"]="aphoton"' > $HOME/.chibaclonkd/config/tmp_genesis.json && mv $HOME/.chibaclonkd/config/tmp_genesis.json $HOME/.chibaclonkd/config/genesis.json +cat $HOME/.chibaclonkd/config/genesis.json | jq '.app_state["mint"]["params"]["mint_denom"]="aphoton"' > $HOME/.chibaclonkd/config/tmp_genesis.json && mv $HOME/.chibaclonkd/config/tmp_genesis.json $HOME/.chibaclonkd/config/genesis.json +# Custom modules +cat $HOME/.chibaclonkd/config/genesis.json | jq '.app_state["nameservice"]["params"]["record_rent"]["denom"]="aphoton"' > $HOME/.chibaclonkd/config/tmp_genesis.json && mv $HOME/.chibaclonkd/config/tmp_genesis.json $HOME/.chibaclonkd/config/genesis.json +cat $HOME/.chibaclonkd/config/genesis.json | jq '.app_state["nameservice"]["params"]["authority_rent"]["denom"]="aphoton"' > $HOME/.chibaclonkd/config/tmp_genesis.json && mv $HOME/.chibaclonkd/config/tmp_genesis.json $HOME/.chibaclonkd/config/genesis.json +cat $HOME/.chibaclonkd/config/genesis.json | jq '.app_state["nameservice"]["params"]["authority_auction_commit_fee"]["denom"]="aphoton"' > $HOME/.chibaclonkd/config/tmp_genesis.json && mv $HOME/.chibaclonkd/config/tmp_genesis.json $HOME/.chibaclonkd/config/genesis.json +cat $HOME/.chibaclonkd/config/genesis.json | jq '.app_state["nameservice"]["params"]["authority_auction_reveal_fee"]["denom"]="aphoton"' > $HOME/.chibaclonkd/config/tmp_genesis.json && mv $HOME/.chibaclonkd/config/tmp_genesis.json $HOME/.chibaclonkd/config/genesis.json +cat $HOME/.chibaclonkd/config/genesis.json | jq '.app_state["nameservice"]["params"]["authority_auction_minimum_bid"]["denom"]="aphoton"' > $HOME/.chibaclonkd/config/tmp_genesis.json && mv $HOME/.chibaclonkd/config/tmp_genesis.json $HOME/.chibaclonkd/config/genesis.json + +if [[ "$TEST_NAMESERVICE_EXPIRY" == "true" ]]; then + echo "Setting timers for expiry tests." + + cat $HOME/.chibaclonkd/config/genesis.json | jq '.app_state["nameservice"]["params"]["record_rent_duration"]="60s"' > $HOME/.chibaclonkd/config/tmp_genesis.json && mv $HOME/.chibaclonkd/config/tmp_genesis.json $HOME/.chibaclonkd/config/genesis.json + cat $HOME/.chibaclonkd/config/genesis.json | jq '.app_state["nameservice"]["params"]["authority_grace_period"]="60s"' > $HOME/.chibaclonkd/config/tmp_genesis.json && mv $HOME/.chibaclonkd/config/tmp_genesis.json $HOME/.chibaclonkd/config/genesis.json + cat $HOME/.chibaclonkd/config/genesis.json | jq '.app_state["nameservice"]["params"]["authority_rent_duration"]="60s"' > $HOME/.chibaclonkd/config/tmp_genesis.json && mv $HOME/.chibaclonkd/config/tmp_genesis.json $HOME/.chibaclonkd/config/genesis.json +fi + +if [[ "$TEST_AUCTION_ENABLED" == "true" ]]; then + echo "Enabling auction and setting timers." + + cat $HOME/.chibaclonkd/config/genesis.json | jq '.app_state["nameservice"]["params"]["authority_auction_enabled"]=true' > $HOME/.chibaclonkd/config/tmp_genesis.json && mv $HOME/.chibaclonkd/config/tmp_genesis.json $HOME/.chibaclonkd/config/genesis.json + cat $HOME/.chibaclonkd/config/genesis.json | jq '.app_state["nameservice"]["params"]["authority_rent_duration"]="60s"' > $HOME/.chibaclonkd/config/tmp_genesis.json && mv $HOME/.chibaclonkd/config/tmp_genesis.json $HOME/.chibaclonkd/config/genesis.json + cat $HOME/.chibaclonkd/config/genesis.json | jq '.app_state["nameservice"]["params"]["authority_grace_period"]="300s"' > $HOME/.chibaclonkd/config/tmp_genesis.json && mv $HOME/.chibaclonkd/config/tmp_genesis.json $HOME/.chibaclonkd/config/genesis.json + cat $HOME/.chibaclonkd/config/genesis.json | jq '.app_state["nameservice"]["params"]["authority_auction_commits_duration"]="60s"' > $HOME/.chibaclonkd/config/tmp_genesis.json && mv $HOME/.chibaclonkd/config/tmp_genesis.json $HOME/.chibaclonkd/config/genesis.json + cat $HOME/.chibaclonkd/config/genesis.json | jq '.app_state["nameservice"]["params"]["authority_auction_reveals_duration"]="60s"' > $HOME/.chibaclonkd/config/tmp_genesis.json && mv $HOME/.chibaclonkd/config/tmp_genesis.json $HOME/.chibaclonkd/config/genesis.json +fi # increase block time (?) -cat $HOME/.ethermintd/config/genesis.json | jq '.consensus_params["block"]["time_iota_ms"]="1000"' > $HOME/.ethermintd/config/tmp_genesis.json && mv $HOME/.ethermintd/config/tmp_genesis.json $HOME/.ethermintd/config/genesis.json +cat $HOME/.chibaclonkd/config/genesis.json | jq '.consensus_params["block"]["time_iota_ms"]="1000"' > $HOME/.chibaclonkd/config/tmp_genesis.json && mv $HOME/.chibaclonkd/config/tmp_genesis.json $HOME/.chibaclonkd/config/genesis.json # Set gas limit in genesis -cat $HOME/.ethermintd/config/genesis.json | jq '.consensus_params["block"]["max_gas"]="10000000"' > $HOME/.ethermintd/config/tmp_genesis.json && mv $HOME/.ethermintd/config/tmp_genesis.json $HOME/.ethermintd/config/genesis.json +cat $HOME/.chibaclonkd/config/genesis.json | jq '.consensus_params["block"]["max_gas"]="10000000"' > $HOME/.chibaclonkd/config/tmp_genesis.json && mv $HOME/.chibaclonkd/config/tmp_genesis.json $HOME/.chibaclonkd/config/genesis.json # disable produce empty block if [[ "$OSTYPE" == "darwin"* ]]; then - sed -i '' 's/create_empty_blocks = true/create_empty_blocks = false/g' $HOME/.ethermintd/config/config.toml + sed -i '' 's/create_empty_blocks = true/create_empty_blocks = false/g' $HOME/.chibaclonkd/config/config.toml else - sed -i 's/create_empty_blocks = true/create_empty_blocks = false/g' $HOME/.ethermintd/config/config.toml + sed -i 's/create_empty_blocks = true/create_empty_blocks = false/g' $HOME/.chibaclonkd/config/config.toml fi if [[ $1 == "pending" ]]; then if [[ "$OSTYPE" == "darwin"* ]]; then - sed -i '' 's/create_empty_blocks_interval = "0s"/create_empty_blocks_interval = "30s"/g' $HOME/.ethermintd/config/config.toml - sed -i '' 's/timeout_propose = "3s"/timeout_propose = "30s"/g' $HOME/.ethermintd/config/config.toml - sed -i '' 's/timeout_propose_delta = "500ms"/timeout_propose_delta = "5s"/g' $HOME/.ethermintd/config/config.toml - sed -i '' 's/timeout_prevote = "1s"/timeout_prevote = "10s"/g' $HOME/.ethermintd/config/config.toml - sed -i '' 's/timeout_prevote_delta = "500ms"/timeout_prevote_delta = "5s"/g' $HOME/.ethermintd/config/config.toml - sed -i '' 's/timeout_precommit = "1s"/timeout_precommit = "10s"/g' $HOME/.ethermintd/config/config.toml - sed -i '' 's/timeout_precommit_delta = "500ms"/timeout_precommit_delta = "5s"/g' $HOME/.ethermintd/config/config.toml - sed -i '' 's/timeout_commit = "5s"/timeout_commit = "150s"/g' $HOME/.ethermintd/config/config.toml - sed -i '' 's/timeout_broadcast_tx_commit = "10s"/timeout_broadcast_tx_commit = "150s"/g' $HOME/.ethermintd/config/config.toml + sed -i '' 's/create_empty_blocks_interval = "0s"/create_empty_blocks_interval = "30s"/g' $HOME/.chibaclonkd/config/config.toml + sed -i '' 's/timeout_propose = "3s"/timeout_propose = "30s"/g' $HOME/.chibaclonkd/config/config.toml + sed -i '' 's/timeout_propose_delta = "500ms"/timeout_propose_delta = "5s"/g' $HOME/.chibaclonkd/config/config.toml + sed -i '' 's/timeout_prevote = "1s"/timeout_prevote = "10s"/g' $HOME/.chibaclonkd/config/config.toml + sed -i '' 's/timeout_prevote_delta = "500ms"/timeout_prevote_delta = "5s"/g' $HOME/.chibaclonkd/config/config.toml + sed -i '' 's/timeout_precommit = "1s"/timeout_precommit = "10s"/g' $HOME/.chibaclonkd/config/config.toml + sed -i '' 's/timeout_precommit_delta = "500ms"/timeout_precommit_delta = "5s"/g' $HOME/.chibaclonkd/config/config.toml + sed -i '' 's/timeout_commit = "5s"/timeout_commit = "150s"/g' $HOME/.chibaclonkd/config/config.toml + sed -i '' 's/timeout_broadcast_tx_commit = "10s"/timeout_broadcast_tx_commit = "150s"/g' $HOME/.chibaclonkd/config/config.toml else - sed -i 's/create_empty_blocks_interval = "0s"/create_empty_blocks_interval = "30s"/g' $HOME/.ethermintd/config/config.toml - sed -i 's/timeout_propose = "3s"/timeout_propose = "30s"/g' $HOME/.ethermintd/config/config.toml - sed -i 's/timeout_propose_delta = "500ms"/timeout_propose_delta = "5s"/g' $HOME/.ethermintd/config/config.toml - sed -i 's/timeout_prevote = "1s"/timeout_prevote = "10s"/g' $HOME/.ethermintd/config/config.toml - sed -i 's/timeout_prevote_delta = "500ms"/timeout_prevote_delta = "5s"/g' $HOME/.ethermintd/config/config.toml - sed -i 's/timeout_precommit = "1s"/timeout_precommit = "10s"/g' $HOME/.ethermintd/config/config.toml - sed -i 's/timeout_precommit_delta = "500ms"/timeout_precommit_delta = "5s"/g' $HOME/.ethermintd/config/config.toml - sed -i 's/timeout_commit = "5s"/timeout_commit = "150s"/g' $HOME/.ethermintd/config/config.toml - sed -i 's/timeout_broadcast_tx_commit = "10s"/timeout_broadcast_tx_commit = "150s"/g' $HOME/.ethermintd/config/config.toml + sed -i 's/create_empty_blocks_interval = "0s"/create_empty_blocks_interval = "30s"/g' $HOME/.chibaclonkd/config/config.toml + sed -i 's/timeout_propose = "3s"/timeout_propose = "30s"/g' $HOME/.chibaclonkd/config/config.toml + sed -i 's/timeout_propose_delta = "500ms"/timeout_propose_delta = "5s"/g' $HOME/.chibaclonkd/config/config.toml + sed -i 's/timeout_prevote = "1s"/timeout_prevote = "10s"/g' $HOME/.chibaclonkd/config/config.toml + sed -i 's/timeout_prevote_delta = "500ms"/timeout_prevote_delta = "5s"/g' $HOME/.chibaclonkd/config/config.toml + sed -i 's/timeout_precommit = "1s"/timeout_precommit = "10s"/g' $HOME/.chibaclonkd/config/config.toml + sed -i 's/timeout_precommit_delta = "500ms"/timeout_precommit_delta = "5s"/g' $HOME/.chibaclonkd/config/config.toml + sed -i 's/timeout_commit = "5s"/timeout_commit = "150s"/g' $HOME/.chibaclonkd/config/config.toml + sed -i 's/timeout_broadcast_tx_commit = "10s"/timeout_broadcast_tx_commit = "150s"/g' $HOME/.chibaclonkd/config/config.toml fi fi # Allocate genesis accounts (cosmos formatted addresses) -ethermintd add-genesis-account $KEY 100000000000000000000000000aphoton --keyring-backend $KEYRING +chibaclonkd add-genesis-account $KEY 100000000000000000000000000aphoton --keyring-backend $KEYRING # Sign genesis transaction -ethermintd gentx $KEY 1000000000000000000000aphoton --keyring-backend $KEYRING --chain-id $CHAINID +chibaclonkd gentx $KEY 1000000000000000000000aphoton --keyring-backend $KEYRING --chain-id $CHAINID # Collect genesis tx -ethermintd collect-gentxs +chibaclonkd collect-gentxs # Run this to ensure everything worked and that the genesis file is setup correctly -ethermintd validate-genesis +chibaclonkd validate-genesis if [[ $1 == "pending" ]]; then echo "pending mode is on, please wait for the first block committed." fi # Start the node (remove the --pruning=nothing flag if historical queries are not needed) -ethermintd start --pruning=nothing --evm.tracer=json $TRACE --log_level $LOGLEVEL --minimum-gas-prices=0.0001aphoton --json-rpc.api eth,txpool,personal,net,debug,web3,miner --api.enable +chibaclonkd start --pruning=nothing --evm.tracer=json $TRACE --log_level $LOGLEVEL --minimum-gas-prices=0.0001aphoton --json-rpc.api eth,txpool,personal,net,debug,web3,miner --api.enable --gql-server --gql-playground diff --git a/networks/local/Makefile b/networks/local/Makefile index 1ddf1fdc..fe571dbb 100644 --- a/networks/local/Makefile +++ b/networks/local/Makefile @@ -1,4 +1,4 @@ all: - docker build --no-cache --tag ethermintd/node ../.. -f ethermintnode/Dockerfile + docker build --no-cache --tag chibaclonkd/node ../.. -f chibaclonknode/Dockerfile .PHONY: all diff --git a/networks/local/chibaclonknode/Dockerfile b/networks/local/chibaclonknode/Dockerfile new file mode 100644 index 00000000..df880566 --- /dev/null +++ b/networks/local/chibaclonknode/Dockerfile @@ -0,0 +1,33 @@ +FROM golang:alpine AS build-env + +# Install minimum necessary dependencies, +ENV PACKAGES curl make git libc-dev bash gcc linux-headers eudev-dev python3 +RUN apk add --no-cache $PACKAGES + +# Set up dependencies +ENV PACKAGES git build-base + +# Set working directory for the build +WORKDIR /go/src/github.com/vulcanize/chiba-clonk + +# Add source files +COPY . . + +# build binary +RUN make build-linux + + +# Final image +FROM alpine:edge + +# Install ca-certificates +RUN apk add --update ca-certificates jq +WORKDIR / + +# Copy over binaries from the build-env +COPY --from=build-env /go/src/github.com/vulcanize/chiba-clonk/build/chibaclonkd /usr/bin/chibaclonkd + +EXPOSE 26656 26657 1317 9090 8545 8546 + +# Run ethermintd by default +CMD ["chibaclonkd","start","--gql-playground","--gql-server","--home","/chibaclonk"] \ No newline at end of file diff --git a/networks/local/ethermintnode/Dockerfile b/networks/local/ethermintnode/Dockerfile deleted file mode 100644 index 04189063..00000000 --- a/networks/local/ethermintnode/Dockerfile +++ /dev/null @@ -1,31 +0,0 @@ -FROM golang:stretch as build-env - -# Install minimum necessary dependencies -ENV PACKAGES curl make git libc-dev bash gcc -RUN apt-get update && apt-get upgrade -y && \ - apt-get install -y $PACKAGES - -# Set working directory for the build -WORKDIR /go/src/github.com/tharsis/ethermint - -# Add source files -COPY . . - -# build Ethermint -RUN make build-linux - -# Final image -FROM golang:1.17 as final - -WORKDIR / - -RUN apt-get update - -# Copy over binaries from the build-env -COPY --from=build-env /go/src/github.com/tharsis/ethermint/build/ethermintd / -COPY --from=build-env /go/src/github.com/tharsis/ethermint/scripts/start-docker.sh / - -EXPOSE 26656 26657 1317 8545 8546 - -# Run ethermintd by default, omit entrypoint to ease using container with ethermintd -ENTRYPOINT ["/bin/bash", "-c"] \ No newline at end of file diff --git a/proto/vulcanize/auction/v1beta1/genesis.proto b/proto/vulcanize/auction/v1beta1/genesis.proto new file mode 100644 index 00000000..9a50e3f3 --- /dev/null +++ b/proto/vulcanize/auction/v1beta1/genesis.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; +package vulcanize.auction.v1beta1; + +import "gogoproto/gogo.proto"; +import "vulcanize/auction/v1beta1/types.proto"; + +option go_package = "github.com/tharsis/ethermint/x/auction/types"; + +// GenesisState defines the genesis state of the auction module +message GenesisState { + Params params = 1 [(gogoproto.nullable) = false]; + repeated Auction auctions = 2 [ + (gogoproto.moretags) = "json:\"bonds\" yaml:\"bonds\"" + ]; +} diff --git a/proto/vulcanize/auction/v1beta1/query.proto b/proto/vulcanize/auction/v1beta1/query.proto new file mode 100644 index 00000000..6ef39d2b --- /dev/null +++ b/proto/vulcanize/auction/v1beta1/query.proto @@ -0,0 +1,149 @@ +syntax = "proto3"; +package vulcanize.auction.v1beta1; + +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "vulcanize/auction/v1beta1/types.proto"; + +option go_package = "github.com/tharsis/ethermint/x/auction/types"; + +// AuctionsRequest is the format for querying all the auctions +message AuctionsRequest { + // pagination defines an optional pagination info for the next request + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +// AuctionsResponse returns the list of all auctions +message AuctionsResponse { + // List of auctions + Auctions auctions = 1; + // pagination defines an optional pagination info for the next request + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// AuctionRequest is the format for querying a specific auction +message AuctionRequest { + // Auction ID + string id = 1; +} + +// AuctionResponse returns the details of the queried auction +message AuctionResponse { + // Auction details + Auction auction = 1; +} + +// BidRequest is the format for querying a specific bid in an auction +message BidRequest { + // Auction ID + string auction_id = 1; + // Bidder address + string bidder = 2; +} + +// BidResponse returns the details of the queried bid +message BidResponse { + // Bid details + Bid bid = 1; +} + +// BidsRequest is the format for querying all bids in an auction +message BidsRequest { + // Auction ID + string auction_id = 1; +} + +// BidsResponse returns details of all bids in an auction +message BidsResponse { + // List of bids in the auction + repeated Bid bids = 1; +} + +// AuctionsByBidderRequest is the format for querying all auctions containing a bidder address +message AuctionsByBidderRequest { + // Address of the bidder + string bidder_address = 1; +} + +// AuctionsByBidderResponse returns all auctions containing a bidder +message AuctionsByBidderResponse { + // List of auctions + Auctions auctions = 1; +} + +// AuctionsByOwnerRequest is the format for querying all auctions created by an owner +message AuctionsByOwnerRequest { + // Address of the owner + string owner_address = 1; +} + +// AuctionsByOwnerResponse returns all auctions created by an owner +message AuctionsByOwnerResponse { + // List of auctions + Auctions auctions = 1; +} + +// QueryParamsRequest is the format to query the parameters of the auction module +message QueryParamsRequest { +} + +// QueryParamsResponse returns parameters of the auction module +message QueryParamsResponse { + Params params = 1; +} + +// BalanceRequest is the format to fetch all balances +message BalanceRequest { +} + +message BalanceResponse { + // Set of all balances within the auction + repeated cosmos.base.v1beta1.Coin balance = 1 [ + (gogoproto.nullable) = false + ]; +} + +// Query defines the gRPC querier interface for the auction module +service Query { + // Auctions queries all auctions + rpc Auctions(AuctionsRequest) returns (AuctionsResponse) { + option (google.api.http).get = "/vulcanize/auction/v1beta1/auctions"; + } + + // GetAuction queries an auction + rpc GetAuction(AuctionRequest) returns (AuctionResponse) { + option (google.api.http).get = "/vulcanize/auction/v1beta1/auctions/{id}"; + } + + // GetBid queries an auction bid + rpc GetBid(BidRequest) returns (BidResponse) { + option (google.api.http).get = "/vulcanize/auction/v1beta1/bids/{auction_id}/{bidder}"; + } + + // GetBids queries all auction bids + rpc GetBids(BidsRequest) returns (BidsResponse) { + option (google.api.http).get = "/vulcanize/auction/v1beta1/bids/{auction_id}"; + } + + // AuctionsByBidder queries auctions by bidder + rpc AuctionsByBidder(AuctionsByBidderRequest) returns (AuctionsByBidderResponse) { + option (google.api.http).get = "/vulcanize/auction/v1beta1/by-bidder/{bidder_address}"; + } + + // AuctionsByOwner queries auctions by owner + rpc AuctionsByOwner(AuctionsByOwnerRequest) returns (AuctionsByOwnerResponse) { + option (google.api.http).get = "/vulcanize/auction/v1beta1/by-owner/{owner_address}"; + } + + // QueryParams implements the params query command + rpc QueryParams(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/vulcanize/auction/v1beta1/params"; + } + + // Balance queries the auction module account balance + rpc Balance(BalanceRequest) returns (BalanceResponse) { + option (google.api.http).get = "/vulcanize/auction/v1beta1/balance"; + } +} diff --git a/proto/vulcanize/auction/v1beta1/tx.proto b/proto/vulcanize/auction/v1beta1/tx.proto new file mode 100644 index 00000000..9602dece --- /dev/null +++ b/proto/vulcanize/auction/v1beta1/tx.proto @@ -0,0 +1,122 @@ +syntax = "proto3"; +package vulcanize.auction.v1beta1; + +import "gogoproto/gogo.proto"; +import "google/protobuf/duration.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "vulcanize/auction/v1beta1/types.proto"; + +option go_package = "github.com/tharsis/ethermint/x/auction/types"; + +// MsgCreateAuction defines a create auction message +message MsgCreateAuction { + option (gogoproto.goproto_getters) = false; + + // Duration of the commits phase in seconds + google.protobuf.Duration commits_duration = 1 [ + (gogoproto.nullable) = false, + (gogoproto.stdduration) = true, + (gogoproto.moretags) = "json:\"commits_duration\" yaml:\"commits_duration\"" + ]; + // Duration of the reveals phase in seconds + google.protobuf.Duration reveals_duration = 2 [ + (gogoproto.nullable) = false, + (gogoproto.stdduration) = true, + (gogoproto.moretags) = "json:\"reveals_duration\" yaml:\"reveals_duration\"" + ]; + // Commit fees + cosmos.base.v1beta1.Coin commit_fee = 3 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "json:\"commit_fee\" yaml:\"commit_fee\"" + ]; + // Reveal fees + cosmos.base.v1beta1.Coin reveal_fee = 4 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "json:\"reveal_fee\" yaml:\"reveal_fee\"" + ]; + // Minimum acceptable bid amount + cosmos.base.v1beta1.Coin minimum_bid = 5 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "json:\"minimum_bid\" yaml:\"minimum_bid\"" + ]; + // Address of the signer + string signer = 6 [ + (gogoproto.moretags) = "json:\"signer\" yaml:\"signer\"" + ]; +} + +// MsgCreateAuctionResponse returns the details of the created auction +message MsgCreateAuctionResponse { + option (gogoproto.goproto_getters) = false; + // Auction details + Auction auction = 1 [ + (gogoproto.moretags) = "json:\"auction\" yaml:\"auction\"" + ]; +} + +// CommitBid defines the message to commit a bid +message MsgCommitBid { + option (gogoproto.goproto_getters) = false; + + // Auction ID + string auction_id = 1 [ + (gogoproto.moretags) = "json:\"auction_id\" yaml:\"auction_id\"" + ]; + // Commit Hash + string commit_hash = 2 [ + (gogoproto.moretags) = "json:\"commit_hash\" yaml:\"commit_hash\"" + ]; + // Address of the signer + string signer = 3 [ + (gogoproto.moretags) = "json:\"signer\" yaml:\"signer\"" + ]; +} + +// RevealBid defines the message to reveal a bid +message MsgRevealBid { + option (gogoproto.goproto_getters) = false; + + // Auction ID + string auction_id = 1 [ + (gogoproto.moretags) = "json:\"auction_id\" yaml:\"auction_id\"" + ]; + // Commit Hash + string reveal = 2 [ + (gogoproto.moretags) = "json:\"reveal\" yaml:\"reveal\"" + ]; + // Address of the signer + string signer = 3 [ + (gogoproto.moretags) = "json:\"signer\" yaml:\"signer\"" + ]; +} + +// MsgCommitBidResponse returns the state of the auction after the bid creation +message MsgCommitBidResponse { + option (gogoproto.goproto_getters) = false; + // Auction details + Bid bid = 1 [ + (gogoproto.moretags) = "json:\"bid\" yaml:\"bid\"" + ]; +} + +// MsgRevealBidResponse returns the state of the auction after the bid reveal +message MsgRevealBidResponse { + option (gogoproto.goproto_getters) = false; + // Auction details + Auction auction = 1 [ + (gogoproto.moretags) = "json:\"auction\" yaml:\"auction\"" + ]; +} + +// Tx defines the gRPC tx interface +service Msg { + // CreateAuction is the command for creating an auction + rpc CreateAuction(MsgCreateAuction) returns (MsgCreateAuctionResponse); + + // CommitBid is the command for committing a bid + rpc CommitBid(MsgCommitBid) returns (MsgCommitBidResponse); + + //RevealBid is the command for revealing a bid + rpc RevealBid(MsgRevealBid) returns (MsgRevealBidResponse); +} + diff --git a/proto/vulcanize/auction/v1beta1/types.proto b/proto/vulcanize/auction/v1beta1/types.proto new file mode 100644 index 00000000..4ec5462f --- /dev/null +++ b/proto/vulcanize/auction/v1beta1/types.proto @@ -0,0 +1,135 @@ +syntax = "proto3"; +package vulcanize.auction.v1beta1; + +import "gogoproto/gogo.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; +import "cosmos/base/v1beta1/coin.proto"; + +option go_package = "github.com/tharsis/ethermint/x/auction/types"; + +// Params defines the auction module parameters +message Params { + option (gogoproto.goproto_stringer) = false; + + // Duration of the commits phase in seconds + google.protobuf.Duration commits_duration = 1 [ + (gogoproto.nullable) = false, + (gogoproto.stdduration) = true, + (gogoproto.moretags) = "json:\"commits_duration\" yaml:\"commits_duration\"" + ]; + // Duration of the reveals phase in seconds + google.protobuf.Duration reveals_duration = 2 [ + (gogoproto.nullable) = false, + (gogoproto.stdduration) = true, + (gogoproto.moretags) = "json:\"reveals_duration\" yaml:\"reveals_duration\"" + ]; + // Commit fees + cosmos.base.v1beta1.Coin commit_fee = 3 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "json:\"commit_fee\" yaml:\"commit_fee\"" + ]; + // Reveal fees + cosmos.base.v1beta1.Coin reveal_fee = 4 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "json:\"reveal_fee\" yaml:\"reveal_fee\"" + ]; + // Minimum acceptable bid amount + cosmos.base.v1beta1.Coin minimum_bid = 5 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "json:\"minimum_bid\" yaml:\"minimum_bid\"" + ]; +} + +// Auction represents a sealed-bid on-chain auction +message Auction { + option (gogoproto.goproto_getters) = false; + + string id = 1; + string status = 2; + // Address of the creator of the auction + string owner_address = 3; + // Timestamp at which the auction was created + google.protobuf.Timestamp create_time = 4 [ + (gogoproto.stdtime) = true, + (gogoproto.nullable) = false, + (gogoproto.moretags) = "json:\"create_time\" yaml:\"create_time\"" + ]; + // Timestamp at which the commits phase concluded + google.protobuf.Timestamp commits_end_time = 5 [ + (gogoproto.stdtime) = true, + (gogoproto.nullable) = false, + (gogoproto.moretags) = "json:\"commits_end_time\" yaml:\"commits_end_time\"" + ]; + // Timestamp at which the reveals phase concluded + google.protobuf.Timestamp reveals_end_time = 6 [ + (gogoproto.stdtime) = true, + (gogoproto.nullable) = false, + (gogoproto.moretags) = "json:\"reveals_end_time\" yaml:\"reveals_end_time\"" + ]; + // Commit and reveal fees must both be paid when committing a bid + // Reveal fee is returned only if the bid is revealed + cosmos.base.v1beta1.Coin commit_fee = 7 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "json:\"commit_fee\" yaml:\"commit_fee\"" + ]; + cosmos.base.v1beta1.Coin reveal_fee = 8 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "json:\"reveal_fee\" yaml:\"reveal_fee\"" + ]; + // Minimum acceptable bid amount for a valid commit + cosmos.base.v1beta1.Coin minimum_bid = 9 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "json:\"minimum_bid\" yaml:\"minimum_bid\"" + ]; + // Address of the winner + string winner_address = 10; + // Winning bid, i.e., the highest bid + cosmos.base.v1beta1.Coin winning_bid = 11 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "json:\"winning_bid\" yaml:\"winning_bid\"" + ]; + // Amount the winner pays, i.e. the second highest auction + cosmos.base.v1beta1.Coin winning_price = 12 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "json:\"winning_price\" yaml:\"winning_price\"" + ]; +} + +message Auctions { + option (gogoproto.goproto_getters) = false; + + repeated Auction auctions = 1 [(gogoproto.nullable) = false]; +} + +// Bid represents a sealed bid (commit) made during the auction +message Bid { + option (gogoproto.goproto_getters) = false; + + string auction_id = 1; + string bidder_address = 2; + string status = 3; + string commit_hash = 4; + google.protobuf.Timestamp commit_time = 5 [ + (gogoproto.stdtime) = true, + (gogoproto.nullable) = false, + (gogoproto.moretags) = "json:\"commit_time\" yaml:\"commit_time\"" + ]; + cosmos.base.v1beta1.Coin commit_fee = 6 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "json:\"commit_fee\" yaml:\"commit_fee\"" + ]; + google.protobuf.Timestamp reveal_time = 7 [ + (gogoproto.stdtime) = true, + (gogoproto.nullable) = false, + (gogoproto.moretags) = "json:\"reveal_time\" yaml:\"reveal_time\"" + ]; + cosmos.base.v1beta1.Coin reveal_fee = 8 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "json:\"reveal_fee\" yaml:\"reveal_fee\"" + ]; + cosmos.base.v1beta1.Coin bid_amount = 9 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "json:\"bid_amount\" yaml:\"bid_amount\"" + ];; +} diff --git a/proto/vulcanize/bond/v1beta1/bond.proto b/proto/vulcanize/bond/v1beta1/bond.proto new file mode 100644 index 00000000..c5b32141 --- /dev/null +++ b/proto/vulcanize/bond/v1beta1/bond.proto @@ -0,0 +1,29 @@ +syntax = "proto3"; +package vulcanize.bond.v1beta1; + +option go_package = "github.com/tharsis/ethermint/x/bond/types"; + +import "gogoproto/gogo.proto"; +import "cosmos/base/v1beta1/coin.proto"; + +// Params defines the bond module parameters +message Params { + // max_bond_amount is maximum amount to bond + cosmos.base.v1beta1.Coin max_bond_amount = 1 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "json:\"max_bond_amount\" yaml:\"max_bond_amount\"" + ]; +} + +// Bond represents funds deposited by an account for record rent payments. +message Bond { + // id is unique identifier of the bond + string id = 1; + // owner of the bond + string owner = 2; + // balance of the bond + repeated cosmos.base.v1beta1.Coin balance = 3 [ + (gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (gogoproto.moretags) = "json:\"balance\" yaml:\"balance\"" + ]; +} diff --git a/proto/vulcanize/bond/v1beta1/genesis.proto b/proto/vulcanize/bond/v1beta1/genesis.proto new file mode 100644 index 00000000..7f46f061 --- /dev/null +++ b/proto/vulcanize/bond/v1beta1/genesis.proto @@ -0,0 +1,18 @@ +syntax = "proto3"; +package vulcanize.bond.v1beta1; + +import "gogoproto/gogo.proto"; +import "vulcanize/bond/v1beta1/bond.proto"; + +option go_package = "github.com/tharsis/ethermint/x/bond/types"; + +// GenesisState defines the bond module's genesis state. +message GenesisState { + // params defines all the parameters of the module. + Params params = 1 [(gogoproto.nullable) = false]; + + // bonds defines all the bonds + repeated Bond bonds = 2 [ + (gogoproto.moretags) = "json:\"bonds\" yaml:\"bonds\"" + ]; +} diff --git a/proto/vulcanize/bond/v1beta1/query.proto b/proto/vulcanize/bond/v1beta1/query.proto new file mode 100644 index 00000000..866c3c09 --- /dev/null +++ b/proto/vulcanize/bond/v1beta1/query.proto @@ -0,0 +1,109 @@ +syntax = "proto3"; +package vulcanize.bond.v1beta1; + +import "gogoproto/gogo.proto"; +import "vulcanize/bond/v1beta1/bond.proto"; +import "google/api/annotations.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; +import "cosmos/base/v1beta1/coin.proto"; + +option go_package = "github.com/tharsis/ethermint/x/bond/types"; + +// Query defines the gRPC querier service for bond module +service Query { + // Params queries bonds module params. + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/vulcanize/bond/v1beta1/params"; + } + + // Bonds queries bonds list. + rpc Bonds(QueryGetBondsRequest) returns (QueryGetBondsResponse) { + option (google.api.http).get = "/vulcanize/bond/v1beta1/bonds"; + } + + // GetBondById + rpc GetBondById(QueryGetBondByIdRequest) returns (QueryGetBondByIdResponse){ + option (google.api.http).get = "/vulcanize/bond/v1beta1/bonds/{id}"; + } + + // Get Bonds List by Owner + rpc GetBondsByOwner(QueryGetBondsByOwnerRequest) returns (QueryGetBondsByOwnerResponse){ + option (google.api.http).get = "/vulcanize/bond/v1beta1/by-owner/{owner}"; + } + + // Get Bonds module balance + rpc GetBondsModuleBalance(QueryGetBondModuleBalanceRequest) returns (QueryGetBondModuleBalanceResponse){ + option (google.api.http).get = "/vulcanize/bond/v1beta1/balance"; + } +} + +// QueryParamsRequest is request for query the bond module params +message QueryParamsRequest{ +} + +// QueryParamsResponse returns response type of bond module params +message QueryParamsResponse{ + Params params = 1 [ + (gogoproto.moretags) = "json:\"params\" yaml:\"params\"" + ]; +} + +// QueryGetBondById queries a bond by bond-id. +message QueryGetBondsRequest{ + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +// QueryGetBondsResponse is response type for get the bonds by bond-id +message QueryGetBondsResponse{ + repeated Bond bonds = 1 [ + (gogoproto.moretags) = "json:\"bonds\" yaml:\"bonds\"" + ]; + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryGetBondById +message QueryGetBondByIdRequest{ + string id = 1 [ + (gogoproto.moretags) = "json:\"id\" yaml:\"id\"" + ]; +} + +// QueryGetBondByIdResponse returns QueryGetBondById query response +message QueryGetBondByIdResponse{ + Bond bond = 1 [ + (gogoproto.moretags) = "json:\"bond\" yaml:\"bond\"" + ]; +} + +// QueryGetBondsByOwnerRequest is request type for Query/GetBondsByOwner RPC Method +message QueryGetBondsByOwnerRequest{ + string owner = 1; + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryGetBondsByOwnerResponse is response type for Query/GetBondsByOwner RPC Method +message QueryGetBondsByOwnerResponse { + repeated Bond bonds = 1 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "json:\"bonds\" yaml:\"bonds\"" + ]; + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryGetBondModuleBalanceRequest is request type for bond module balance rpc method +message QueryGetBondModuleBalanceRequest{ + +} + +// QueryGetBondModuleBalanceResponse is the response type for bond module balance rpc method +message QueryGetBondModuleBalanceResponse{ + repeated cosmos.base.v1beta1.Coin balance = 2 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (gogoproto.moretags) = "json:\"coins\" yaml:\"coins\"" + ]; +} diff --git a/proto/vulcanize/bond/v1beta1/tx.proto b/proto/vulcanize/bond/v1beta1/tx.proto new file mode 100644 index 00000000..16cfe8e8 --- /dev/null +++ b/proto/vulcanize/bond/v1beta1/tx.proto @@ -0,0 +1,77 @@ +syntax = "proto3"; +package vulcanize.bond.v1beta1; + +option go_package = "github.com/tharsis/ethermint/x/bond/types"; + +import "gogoproto/gogo.proto"; +import "cosmos/base/v1beta1/coin.proto"; + +// Msg defines the bond Msg service. +service Msg { + // CreateBond defines a method for creating a new bond. + rpc CreateBond(MsgCreateBond) returns (MsgCreateBondResponse); + + // RefillBond defines a method for refilling amount for bond. + rpc RefillBond(MsgRefillBond) returns (MsgRefillBondResponse); + + // WithdrawBond defines a method for withdrawing amount from bond. + rpc WithdrawBond(MsgWithdrawBond) returns (MsgWithdrawBondResponse); + + // CancelBond defines a method for cancelling a bond. + rpc CancelBond(MsgCancelBond) returns (MsgCancelBondResponse); +} + +// MsgCreateBond defines a SDK message for creating a new bond. +message MsgCreateBond{ + string signer = 1; + repeated cosmos.base.v1beta1.Coin coins = 2 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (gogoproto.moretags) = "json:\"coins\" yaml:\"coins\"" + ]; +} + +// MsgCreateBondResponse defines the Msg/CreateBond response type. +message MsgCreateBondResponse{ + string id = 1; +} + +// MsgRefillBond defines a SDK message for refill the amount for bond. +message MsgRefillBond{ + string id = 1; + string signer = 2; + repeated cosmos.base.v1beta1.Coin coins = 3 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (gogoproto.moretags) = "json:\"coins\" yaml:\"coins\"" + ]; +} + +// MsgRefillBondResponse defines the Msg/RefillBond response type. +message MsgRefillBondResponse{ +} + +// MsgWithdrawBond defines a SDK message for withdrawing amount from bond. +message MsgWithdrawBond { + string id = 1; + string signer = 2; + repeated cosmos.base.v1beta1.Coin coins = 3 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (gogoproto.moretags) = "json:\"coins\" yaml:\"coins\"" + ]; +} + +// MsgWithdrawBondResponse defines the Msg/WithdrawBond response type. +message MsgWithdrawBondResponse{ +} + +// MsgCancelBond defines a SDK message for the cancel the bond. +message MsgCancelBond{ + string id = 1; + string signer = 2; +} + +// MsgCancelBondResponse defines the Msg/CancelBond response type. +message MsgCancelBondResponse{ +} diff --git a/proto/vulcanize/nameservice/v1beta1/genesis.proto b/proto/vulcanize/nameservice/v1beta1/genesis.proto new file mode 100644 index 00000000..8d71c3ec --- /dev/null +++ b/proto/vulcanize/nameservice/v1beta1/genesis.proto @@ -0,0 +1,30 @@ +syntax = "proto3"; +package vulcanize.nameservice.v1beta1; + +import "gogoproto/gogo.proto"; +import "vulcanize/nameservice/v1beta1/nameservice.proto"; + +option go_package = "github.com/tharsis/ethermint/x/nameservice/types"; + +// GenesisState defines the nameservice module's genesis state. +message GenesisState { + // params defines all the params of nameservice module. + Params params = 1 [ + (gogoproto.nullable) = false + ]; + // records + repeated Record records = 2 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "json:\"records\" yaml:\"records\"" + ]; + // authorities + repeated AuthorityEntry authorities = 3 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "json:\"authorities\" yaml:\"authorities\"" + ]; + // names + repeated NameEntry names = 4 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "json:\"names\" yaml:\"names\"" + ]; +} diff --git a/proto/vulcanize/nameservice/v1beta1/nameservice.proto b/proto/vulcanize/nameservice/v1beta1/nameservice.proto new file mode 100644 index 00000000..860dd91c --- /dev/null +++ b/proto/vulcanize/nameservice/v1beta1/nameservice.proto @@ -0,0 +1,169 @@ +syntax = "proto3"; +package vulcanize.nameservice.v1beta1; + +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; +import "gogoproto/gogo.proto"; +import "cosmos/base/v1beta1/coin.proto"; + +option go_package = "github.com/tharsis/ethermint/x/nameservice/types"; + +// Params defines the nameservice module parameters +message Params { + cosmos.base.v1beta1.Coin record_rent = 1 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "json:\"record_rent\" yaml:\"record_rent\"" + ]; + google.protobuf.Duration record_rent_duration = 2 [ + (gogoproto.nullable) = false, + (gogoproto.stdduration) = true, + (gogoproto.moretags) = "json:\"record_rent_duration\" yaml:\"record_rent_duration\"" + ]; + cosmos.base.v1beta1.Coin authority_rent = 3 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "json:\"authority_rent\" yaml:\"authority_rent\"" + ]; + google.protobuf.Duration authority_rent_duration = 4 [ + (gogoproto.nullable) = false, + (gogoproto.stdduration) = true, + (gogoproto.moretags) = "json:\"authority_rent_duration\" yaml:\"authority_rent_duration\"" + ]; + google.protobuf.Duration authority_grace_period = 5 [ + (gogoproto.nullable) = false, + (gogoproto.stdduration) = true, + (gogoproto.moretags) = "json:\"authority_grace_period\" yaml:\"authority_grace_period\"" + ]; + bool authority_auction_enabled = 6 [ + (gogoproto.moretags) = "json:\"authority_auction_enabled\" yaml:\"authority_auction_enabled\"" + ]; + google.protobuf.Duration authority_auction_commits_duration = 7 [ + (gogoproto.nullable) = false, + (gogoproto.stdduration) = true, + (gogoproto.moretags) = "json:\"authority_auction_commits_duration\" yaml:\"authority_auction_commits_duration\"" + ]; + google.protobuf.Duration authority_auction_reveals_duration = 8 [ + (gogoproto.nullable) = false, + (gogoproto.stdduration) = true, + (gogoproto.moretags) = "json:\"authority_auction_reveals_duration\" yaml:\"authority_auction_reveals_duration\"" + ]; + cosmos.base.v1beta1.Coin authority_auction_commit_fee = 9 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "json:\"authority_auction_commit_fee\" yaml:\"authority_auction_commit_fee\"" + ]; + cosmos.base.v1beta1.Coin authority_auction_reveal_fee = 10 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "json:\"authority_auction_reveal_fee\" yaml:\"authority_auction_reveal_fee\"" + ]; + cosmos.base.v1beta1.Coin authority_auction_minimum_bid = 11 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "json:\"authority_auction_minimum_bid\" yaml:\"authority_auction_minimum_bid\"" + ]; +} + +// Params defines the nameservice module records +message Record { + string id = 1 [ + (gogoproto.moretags) = "json:\"id\" yaml:\"id\"" + ]; + string bond_id = 2 [ + (gogoproto.moretags) = "json:\"bondId\" yaml:\"bondId\"" + ]; + string create_time = 3 [ + (gogoproto.moretags) = "json:\"createTime\" yaml:\"createTime\"" + ]; + string expiry_time = 4 [ + (gogoproto.moretags) = "json:\"expiryTime\" yaml:\"expiryTime\"" + ]; + bool deleted = 5; + repeated string owners = 6 [ + (gogoproto.moretags) = "json:\"owners\" yaml:\"owners\"" + ]; + string attributes = 7 [ + (gogoproto.moretags) = "json:\"attributes\" yaml:\"attributes\"" + ]; + repeated string names = 8 [ + (gogoproto.moretags) = "json:\"names\" yaml:\"names\"" + ]; +} + +// AuthorityEntry defines the nameservice module AuthorityEntries +message AuthorityEntry{ + string name = 1; + NameAuthority entry = 2; +} + +// NameAuthority +message NameAuthority { + // Owner public key. + string owner_public_key = 1 [ + (gogoproto.moretags) = "json:\"ownerPublicKey\" yaml:\"ownerPublicKey\"" + ]; + // Owner address. + string owner_address = 2 [ + (gogoproto.moretags) = "json:\"ownerAddress\" yaml:\"ownerAddress\"" + ]; + // height at which name/authority was created. + uint64 height = 3; + string status = 4; + string auction_id = 5 [ + (gogoproto.moretags) = "json:\"auctionID\" yaml:\"auctionID\"" + ]; + string bond_id = 6 [ + (gogoproto.moretags) = "json:\"bondID\" yaml:\"bondID\"" + ]; + google.protobuf.Timestamp expiry_time = 7 [ + (gogoproto.nullable) = false, + (gogoproto.stdtime) = true, + (gogoproto.moretags) = "json:\"expiryTime\" yaml:\"expiryTime\"" + ]; +} + +// NameEntry +message NameEntry{ + string name = 1; + NameRecord entry = 2; +} + +// NameRecord +message NameRecord { + NameRecordEntry latest = 1; + repeated NameRecordEntry history = 2; +} + +// NameRecordEntry +message NameRecordEntry{ + string id = 1; + uint64 height = 2; +} + +// Signature +message Signature{ + string sig = 1 [ + (gogoproto.moretags) = "json:\"sig\" yaml:\"sig\"" + ]; + string pub_key = 2 [ + (gogoproto.moretags) = "json:\"pubKey\" yaml:\"pubKey\"" + ]; +} + +// BlockChangeSet +message BlockChangeSet{ + int64 height = 1; + repeated string records = 2; + repeated string auctions = 3; + repeated AuctionBidInfo auction_bids = 4 [ + (gogoproto.moretags) = "json:\"auctionBids\" yaml:\"auctionBids\"" + ]; + repeated string authorities = 5; + repeated string names = 6; +} + +// AuctionBidInfo +message AuctionBidInfo { + string auction_id = 1 [ + (gogoproto.moretags) = "json:\"auctionID\" yaml:\"auctionID\"" + ]; + string bidder_address = 2 [ + (gogoproto.moretags) = "json:\"bidderAddress\" yaml:\"bidderAddress\"" + ]; +} \ No newline at end of file diff --git a/proto/vulcanize/nameservice/v1beta1/query.proto b/proto/vulcanize/nameservice/v1beta1/query.proto new file mode 100644 index 00000000..c6dd8e08 --- /dev/null +++ b/proto/vulcanize/nameservice/v1beta1/query.proto @@ -0,0 +1,231 @@ +syntax = "proto3"; +package vulcanize.nameservice.v1beta1; + +import "vulcanize/nameservice/v1beta1/nameservice.proto"; +import "google/api/annotations.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; +import "gogoproto/gogo.proto"; +import "cosmos/base/v1beta1/coin.proto"; + +option go_package = "github.com/tharsis/ethermint/x/nameservice/types"; + +// Query defines the gRPC querier service for nameservice module +service Query { + // Params queries the nameservice module params. + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/vulcanize/nameservice/v1beta1/params"; + } + // List records + rpc ListRecords(QueryListRecordsRequest) returns (QueryListRecordsResponse){ + option (google.api.http).get = "/vulcanize/nameservice/v1beta1/records"; + } + // Get record by id + rpc GetRecord(QueryRecordByIdRequest) returns (QueryRecordByIdResponse){ + option (google.api.http).get = "/vulcanize/nameservice/v1beta1/records/{id}"; + } + // Get records by bond id + rpc GetRecordByBondId(QueryRecordByBondIdRequest) returns (QueryRecordByBondIdResponse){ + option (google.api.http).get = "/vulcanize/nameservice/v1beta1/records-by-bond-id/{id}"; + } + // Get nameservice module balance + rpc GetNameServiceModuleBalance(GetNameServiceModuleBalanceRequest) returns (GetNameServiceModuleBalanceResponse){ + option (google.api.http).get = "/vulcanize/nameservice/v1beta1/balance"; + } + // List name records + rpc ListNameRecords(QueryListNameRecordsRequest) returns (QueryListNameRecordsResponse){ + option (google.api.http).get = "/vulcanize/nameservice/v1beta1/names"; + } + // Whois method retrieve the name authority info + rpc Whois(QueryWhoisRequest) returns (QueryWhoisResponse){ + option (google.api.http).get = "/vulcanize/nameservice/v1beta1/whois/{name}"; + } + // LookupCrn + rpc LookupCrn(QueryLookupCrn) returns (QueryLookupCrnResponse){ + option (google.api.http).get = "/vulcanize/nameservice/v1beta1/lookup"; + } + // ResolveCrn + rpc ResolveCrn(QueryResolveCrn) returns (QueryResolveCrnResponse){ + option (google.api.http).get = "/vulcanize/nameservice/v1beta1/resolve"; + } + // GetRecordExpiryQueue + rpc GetRecordExpiryQueue(QueryGetRecordExpiryQueue) returns (QueryGetRecordExpiryQueueResponse){ + option (google.api.http).get = "/vulcanize/nameservice/v1beta1/record-expiry"; + } + // GetAuthorityExpiryQueue + rpc GetAuthorityExpiryQueue(QueryGetAuthorityExpiryQueue) returns (QueryGetAuthorityExpiryQueueResponse){ + option (google.api.http).get = "/vulcanize/nameservice/v1beta1/authority-expiry"; + } +} + +// QueryParamsRequest is request type for nameservice params +message QueryParamsRequest{ +} + +// QueryParamsResponse is response type for nameservice params +message QueryParamsResponse{ + Params params = 1; +} + +// QueryListRecordsRequest is request type for nameservice records list +message QueryListRecordsRequest{ + message ReferenceInput { + string id = 1; + } + message ValueInput { + string type = 1; + string string = 2; + int64 int = 3; + double float = 4; + bool boolean = 5; + ReferenceInput reference = 6; + repeated ValueInput values = 7; + } + message KeyValueInput { + string key = 1; + ValueInput value = 2; + } + repeated KeyValueInput attributes = 1; + + bool all = 2; + + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 3; +} + +// QueryListRecordsResponse is response type for nameservice records list +message QueryListRecordsResponse{ + repeated Record records = 1 [ + (gogoproto.nullable) = false + ]; + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +//QueryRecordByIdRequest is request type for nameservice records by id +message QueryRecordByIdRequest{ + string id = 1 ; +} + +// QueryRecordByIdResponse is response type for nameservice records by id +message QueryRecordByIdResponse{ + Record record = 1[ + (gogoproto.nullable) = false + ]; +} + +// QueryRecordByBondIdRequest is request type for get the records by bond-id +message QueryRecordByBondIdRequest{ + string id = 1; + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// QueryRecordByBondIdResponse is response type for records list by bond-id +message QueryRecordByBondIdResponse{ + repeated Record records = 1 [ + (gogoproto.nullable) = false + ]; + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// GetNameServiceModuleBalanceRequest is request type for nameservice module accounts balance +message GetNameServiceModuleBalanceRequest{ +} + +// GetNameServiceModuleBalanceResponse is response type for nameservice module accounts balance +message GetNameServiceModuleBalanceResponse{ + repeated AccountBalance balances = 1; +} + +// AccountBalance is nameservice module account balance +message AccountBalance { + string account_name = 1 [ + (gogoproto.moretags) = "json:\"accountName\" yaml:\"accountName\"" + ]; + repeated cosmos.base.v1beta1.Coin balance = 3 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (gogoproto.moretags) = "json:\"balance\" yaml:\"balance\"" + ]; +} + +// QueryListNameRecordsRequest is request type for nameservice names records +message QueryListNameRecordsRequest{ + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +// QueryListNameRecordsResponse is response type for nameservice names records +message QueryListNameRecordsResponse{ + repeated NameEntry names = 1 [ + (gogoproto.nullable) = false + ]; + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryWhoisRequest is request type for Get NameAuthority +message QueryWhoisRequest{ + string name = 1; +} + +// QueryWhoisResponse is response type for whois request +message QueryWhoisResponse{ + NameAuthority name_authority = 1 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "json:\"nameAuthority\" yaml:\"nameAuthority\"" + ]; +} + +// QueryLookupCrn is request type for LookupCrn +message QueryLookupCrn{ + string crn = 1; +} + +// QueryLookupCrnResponse is response type for QueryLookupCrn +message QueryLookupCrnResponse{ + NameRecord name = 1; +} + +// QueryResolveCrn is request type for ResolveCrn +message QueryResolveCrn{ + string crn = 1; +} + +// QueryResolveCrnResponse is response type for QueryResolveCrn +message QueryResolveCrnResponse{ + Record record = 1; +} + +// QueryGetRecordExpiryQueue +message QueryGetRecordExpiryQueue{ + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +// QueryGetRecordExpiryQueueResponse +message QueryGetRecordExpiryQueueResponse{ + repeated ExpiryQueueRecord records = 1; + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// ExpiryQueueRecord +message ExpiryQueueRecord{ + string id = 1; + repeated string value = 2; +} + +// QueryGetAuthorityExpiryQueue +message QueryGetAuthorityExpiryQueue{ + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +// QueryGetAuthorityExpiryQueueResponse +message QueryGetAuthorityExpiryQueueResponse{ + repeated ExpiryQueueRecord authorities = 1; + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} diff --git a/proto/vulcanize/nameservice/v1beta1/tx.proto b/proto/vulcanize/nameservice/v1beta1/tx.proto new file mode 100644 index 00000000..f66d3a11 --- /dev/null +++ b/proto/vulcanize/nameservice/v1beta1/tx.proto @@ -0,0 +1,168 @@ +syntax = "proto3"; +package vulcanize.nameservice.v1beta1; + +import "gogoproto/gogo.proto"; +import "vulcanize/nameservice/v1beta1/nameservice.proto"; + +option go_package = "github.com/tharsis/ethermint/x/nameservice/types"; + +// Msg +service Msg { + // SetRecord will records a new record with given payload and bond id + rpc SetRecord(MsgSetRecord) returns(MsgSetRecordResponse){} + // Renew Record will renew the expire record + rpc RenewRecord(MsgRenewRecord) returns (MsgRenewRecordResponse){} + // AssociateBond + rpc AssociateBond(MsgAssociateBond) returns (MsgAssociateBondResponse){} + // DissociateBond + rpc DissociateBond(MsgDissociateBond) returns (MsgDissociateBondResponse){} + // DissociateRecords + rpc DissociateRecords(MsgDissociateRecords) returns (MsgDissociateRecordsResponse){} + // ReAssociateRecords + rpc ReAssociateRecords(MsgReAssociateRecords) returns (MsgReAssociateRecordsResponse){} + // SetName will store the name with given crn and name + rpc SetName(MsgSetName) returns (MsgSetNameResponse){} + // Reserve name + rpc ReserveName(MsgReserveAuthority) returns (MsgReserveAuthorityResponse){} + // Delete Name method will remove authority name + rpc DeleteName(MsgDeleteNameAuthority) returns (MsgDeleteNameAuthorityResponse){} + // SetAuthorityBond + rpc SetAuthorityBond(MsgSetAuthorityBond) returns (MsgSetAuthorityBondResponse){} +} + +// MsgSetRecord +message MsgSetRecord{ + string bond_id = 1 [ + (gogoproto.moretags) = "json:\"bondId\" yaml:\"bondId\"" + ]; + string signer = 2; + Payload payload = 3 [ + (gogoproto.nullable) = false + ]; +} + +// MsgSetRecordResponse +message MsgSetRecordResponse{ + string id = 1; +} + +// Payload +message Payload { + Record record = 1; + repeated Signature signatures = 2 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "json:\"signatures\" yaml:\"signatures\"" + ]; +} + +// MsgSetName +message MsgSetName{ + string crn = 1; + string cid = 2; + string signer = 3; +} + +// MsgSetNameResponse +message MsgSetNameResponse{ +} + +// MsgReserveName +message MsgReserveAuthority{ + string name = 1; + string signer = 2; + // if creating a sub-authority. + string owner = 3; +} + +// MsgReserveNameResponse +message MsgReserveAuthorityResponse{ +} + +// MsgSetAuthorityBond is SDK message for SetAuthorityBond +message MsgSetAuthorityBond{ + string name = 1; + string bond_id = 2 [ + (gogoproto.moretags) = "json:\"bondId\" yaml:\"bondId\"" + ]; + string signer = 3; +} + +// MsgSetAuthorityBondResponse +message MsgSetAuthorityBondResponse{ +} + +// MsgDeleteNameAuthority is SDK message for DeleteNameAuthority +message MsgDeleteNameAuthority{ + string crn = 1; + string signer = 2; +} + +// MsgDeleteNameAuthorityResponse +message MsgDeleteNameAuthorityResponse{ +} + +//MsgRenewRecord is SDK message for Renew a record +message MsgRenewRecord{ + string record_id = 1 [ + (gogoproto.moretags) = "json:\"recordId\" yaml:\"recordId\"" + ]; + string signer = 2; +} + +// MsgRenewRecordResponse +message MsgRenewRecordResponse{ +} + +// MsgAssociateBond +message MsgAssociateBond{ + string record_id = 1 [ + (gogoproto.moretags) = "json:\"recordId\" yaml:\"recordId\"" + ]; + string bond_id = 2 [ + (gogoproto.moretags) = "json:\"bondId\" yaml:\"bondId\"" + ]; + string signer = 3; +} + +// MsgAssociateBondResponse +message MsgAssociateBondResponse{ +} + +// MsgDissociateBond is SDK message for Msg/DissociateBond +message MsgDissociateBond{ + string record_id = 1 [ + (gogoproto.moretags) = "json:\"recordId\" yaml:\"recordId\"" + ]; + string signer = 2; +} + +// MsgDissociateBondResponse is response type for MsgDissociateBond +message MsgDissociateBondResponse{ +} + +// MsgDissociateRecords is SDK message for Msg/DissociateRecords +message MsgDissociateRecords{ + string bond_id = 1 [ + (gogoproto.moretags) = "json:\"bondId\" yaml:\"bondId\"" + ]; + string signer = 2; +} + +// MsgDissociateRecordsResponse is response type for MsgDissociateRecords +message MsgDissociateRecordsResponse{ +} + +// MsgReAssociateRecords is SDK message for Msg/ReAssociateRecords +message MsgReAssociateRecords{ + string new_bond_id = 1 [ + (gogoproto.moretags) = "json:\"newBondId\" yaml:\"newBondId\"" + ]; + string old_bond_id = 2 [ + (gogoproto.moretags) = "json:\"oldBondId\" yaml:\"oldBondId\"" + ]; + string signer = 3; +} + +// MsgReAssociateRecordsResponse is response type for MsgReAssociateRecords +message MsgReAssociateRecordsResponse{ +} diff --git a/scripts/contract-test.sh b/scripts/contract-test.sh index 951a4c20..9b011bcf 100644 --- a/scripts/contract-test.sh +++ b/scripts/contract-test.sh @@ -1,41 +1,41 @@ #!/bin/bash KEY="mykey" -CHAINID="ethermint_9000-1" +CHAINID="chibaclonk_9000-1" MONIKER="localtestnet" # stop and remove existing daemon and client data and process(es) -rm -rf ~/.ethermint* -pkill -f "ethermint*" +rm -rf ~/.chibaclonk* +pkill -f "chibaclonk*" -make build-ethermint +make build # if $KEY exists it should be override -"$PWD"/build/ethermintd keys add $KEY --keyring-backend test --algo "eth_secp256k1" +"$PWD"/build/chibaclonkd keys add $KEY --keyring-backend test --algo "eth_secp256k1" # Set moniker and chain-id for Ethermint (Moniker can be anything, chain-id must be an integer) -"$PWD"/build/ethermintd init $MONIKER --chain-id $CHAINID +"$PWD"/build/chibaclonkd init $MONIKER --chain-id $CHAINID # Change parameter token denominations to aphoton -cat $HOME/.ethermint/config/genesis.json | jq '.app_state["staking"]["params"]["bond_denom"]="stake"' > $HOME/.ethermint/config/tmp_genesis.json && mv $HOME/.ethermint/config/tmp_genesis.json $HOME/.ethermint/config/genesis.json -cat $HOME/.ethermint/config/genesis.json | jq '.app_state["crisis"]["constant_fee"]["denom"]="aphoton"' > $HOME/.ethermint/config/tmp_genesis.json && mv $HOME/.ethermint/config/tmp_genesis.json $HOME/.ethermint/config/genesis.json -cat $HOME/.ethermint/config/genesis.json | jq '.app_state["gov"]["deposit_params"]["min_deposit"][0]["denom"]="aphoton"' > $HOME/.ethermint/config/tmp_genesis.json && mv $HOME/.ethermint/config/tmp_genesis.json $HOME/.ethermint/config/genesis.json -cat $HOME/.ethermint/config/genesis.json | jq '.app_state["mint"]["params"]["mint_denom"]="aphoton"' > $HOME/.ethermint/config/tmp_genesis.json && mv $HOME/.ethermint/config/tmp_genesis.json $HOME/.ethermint/config/genesis.json +cat $HOME/.chibaclonkd/config/genesis.json | jq '.app_state["staking"]["params"]["bond_denom"]="stake"' > $HOME/.chibaclonkd/config/tmp_genesis.json && mv $HOME/.chibaclonkd/config/tmp_genesis.json $HOME/.chibaclonkd/config/genesis.json +cat $HOME/.chibaclonkd/config/genesis.json | jq '.app_state["crisis"]["constant_fee"]["denom"]="aphoton"' > $HOME/.chibaclonkd/config/tmp_genesis.json && mv $HOME/.chibaclonkd/config/tmp_genesis.json $HOME/.chibaclonkd/config/genesis.json +cat $HOME/.chibaclonkd/config/genesis.json | jq '.app_state["gov"]["deposit_params"]["min_deposit"][0]["denom"]="aphoton"' > $HOME/.chibaclonkd/config/tmp_genesis.json && mv $HOME/.chibaclonkd/config/tmp_genesis.json $HOME/.chibaclonkd/config/genesis.json +cat $HOME/.chibaclonkd/config/genesis.json | jq '.app_state["mint"]["params"]["mint_denom"]="aphoton"' > $HOME/.chibaclonkd/config/tmp_genesis.json && mv $HOME/.chibaclonkd/config/tmp_genesis.json $HOME/.chibaclonkd/config/genesis.json # Allocate genesis accounts (cosmos formatted addresses) -"$PWD"/build/ethermintd add-genesis-account "$("$PWD"/build/ethermintd keys show "$KEY" -a --keyring-backend test)" 100000000000000000000aphoton,10000000000000000000stake --keyring-backend test +"$PWD"/build/chibaclonkd add-genesis-account "$("$PWD"/build/chibaclonkd keys show "$KEY" -a --keyring-backend test)" 100000000000000000000aphoton,10000000000000000000stake --keyring-backend test # Sign genesis transaction -"$PWD"/build/ethermintd gentx $KEY 10000000000000000000stake --amount=100000000000000000000aphoton --keyring-backend test --chain-id $CHAINID +"$PWD"/build/chibaclonkd gentx $KEY 10000000000000000000stake --amount=100000000000000000000aphoton --keyring-backend test --chain-id $CHAINID # Collect genesis tx -"$PWD"/build/ethermintd collect-gentxs +"$PWD"/build/chibaclonkd collect-gentxs # Run this to ensure everything worked and that the genesis file is setup correctly -"$PWD"/build/ethermintd validate-genesis +"$PWD"/build/chibaclonkd validate-genesis # Start the node (remove the --pruning=nothing flag if historical queries are not needed) in background and log to file -"$PWD"/build/ethermintd start --pruning=nothing --rpc.unsafe --json-rpc.address="0.0.0.0:8545" --keyring-backend test > ethermintd.log 2>&1 & +"$PWD"/build/chibaclonkd start --pruning=nothing --rpc.unsafe --json-rpc.address="0.0.0.0:8545" --keyring-backend test > ethermintd.log 2>&1 & # Give ethermintd node enough time to launch sleep 5 @@ -51,7 +51,7 @@ echo "$ACCT" # Start testcases (not supported) # curl -X POST --data '{"jsonrpc":"2.0","method":"personal_unlockAccount","params":["'$ACCT'", ""],"id":1}' -H "Content-Type: application/json" http://localhost:8545 -#PRIVKEY="$("$PWD"/build/ethermintd keys export $KEY)" +#PRIVKEY="$("$PWD"/build/chibaclonkd keys export $KEY)" ## need to get the private key from the account in order to check this functionality. cd tests/solidity/suites/basic/ && go get && go run main.go $ACCT diff --git a/scripts/integration-test-all.sh b/scripts/integration-test-all.sh index 1522f219..c13d84c4 100755 --- a/scripts/integration-test-all.sh +++ b/scripts/integration-test-all.sh @@ -67,14 +67,14 @@ make build arr=() init_func() { - "$PWD"/build/ethermintd keys add $KEY"$i" --keyring-backend test --home "$DATA_DIR$i" --no-backup --algo "eth_secp256k1" - "$PWD"/build/ethermintd init $MONIKER --chain-id $CHAINID --home "$DATA_DIR$i" - "$PWD"/build/ethermintd add-genesis-account \ - "$("$PWD"/build/ethermintd keys show "$KEY$i" --keyring-backend test -a --home "$DATA_DIR$i")" 1000000000000000000aphoton,1000000000000000000stake \ + "$PWD"/build/chibaclonkd keys add $KEY"$i" --keyring-backend test --home "$DATA_DIR$i" --no-backup --algo "eth_secp256k1" + "$PWD"/build/chibaclonkd init $MONIKER --chain-id $CHAINID --home "$DATA_DIR$i" + "$PWD"/build/chibaclonkd add-genesis-account \ + "$("$PWD"/build/chibaclonkd keys show "$KEY$i" --keyring-backend test -a --home "$DATA_DIR$i")" 1000000000000000000aphoton,1000000000000000000stake \ --keyring-backend test --home "$DATA_DIR$i" - "$PWD"/build/ethermintd gentx "$KEY$i" 1000000000000000000stake --chain-id $CHAINID --keyring-backend test --home "$DATA_DIR$i" - "$PWD"/build/ethermintd collect-gentxs --home "$DATA_DIR$i" - "$PWD"/build/ethermintd validate-genesis --home "$DATA_DIR$i" + "$PWD"/build/chibaclonkd gentx "$KEY$i" 1000000000000000000stake --chain-id $CHAINID --keyring-backend test --home "$DATA_DIR$i" + "$PWD"/build/chibaclonkd collect-gentxs --home "$DATA_DIR$i" + "$PWD"/build/chibaclonkd validate-genesis --home "$DATA_DIR$i" if [[ $MODE == "pending" ]]; then ls $DATA_DIR$i @@ -104,7 +104,7 @@ init_func() { start_func() { echo "starting ethermint node $i in background ..." - "$PWD"/build/ethermintd start --pruning=nothing --rpc.unsafe \ + "$PWD"/build/chibaclonkd start --pruning=nothing --rpc.unsafe \ --p2p.laddr tcp://$IP_ADDR:$NODE_P2P_PORT"$i" --address tcp://$IP_ADDR:$NODE_PORT"$i" --rpc.laddr tcp://$IP_ADDR:$NODE_RPC_PORT"$i" \ --json-rpc.address=$IP_ADDR:$RPC_PORT"$i" \ --json-rpc.api="eth,txpool,personal,net,debug,web3" \ diff --git a/scripts/start-docker.sh b/scripts/start-docker.sh index 6ffa7484..8a91326d 100755 --- a/scripts/start-docker.sh +++ b/scripts/start-docker.sh @@ -1,11 +1,11 @@ -#!/bin/bash +#!/bin/sh echo "prepare genesis: Run validate-genesis to ensure everything worked and that the genesis file is setup correctly" -./ethermintd validate-genesis --home /ethermint +chibaclonkd validate-genesis --home /chibaclonk -echo "starting ethermint node $ID in background ..." -./ethermintd start \ ---home /ethermint \ +echo "starting chibaclonk node $ID in background ..." +chibaclonkd start \ +--home /chibaclonk \ --keyring-backend test echo "started ethermint node" diff --git a/scripts/start.sh b/scripts/start.sh index c05bff70..0a332c8e 100755 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -63,7 +63,7 @@ fi # Compile ethermint echo "compiling ethermint" -make build-ethermint +make build # PID array declaration arr=() @@ -73,24 +73,24 @@ arrcli=() init_func() { echo "create and add new keys" - "$PWD"/build/ethermintd keys add $KEY"$i" --home "$DATA_DIR$i" --no-backup --chain-id $CHAINID --algo "eth_secp256k1" --keyring-backend test + "$PWD"/build/chibaclonkd keys add $KEY"$i" --home "$DATA_DIR$i" --no-backup --chain-id $CHAINID --algo "eth_secp256k1" --keyring-backend test echo "init Ethermint with moniker=$MONIKER and chain-id=$CHAINID" - "$PWD"/build/ethermintd init $MONIKER --chain-id $CHAINID --home "$DATA_DIR$i" + "$PWD"/build/chibaclonkd init $MONIKER --chain-id $CHAINID --home "$DATA_DIR$i" echo "prepare genesis: Allocate genesis accounts" - "$PWD"/build/ethermintd add-genesis-account \ - "$("$PWD"/build/ethermintd keys show "$KEY$i" -a --home "$DATA_DIR$i" --keyring-backend test)" 1000000000000000000aphoton,1000000000000000000stake \ + "$PWD"/build/chibaclonkd add-genesis-account \ + "$("$PWD"/build/chibaclonkd keys show "$KEY$i" -a --home "$DATA_DIR$i" --keyring-backend test)" 1000000000000000000aphoton,1000000000000000000stake \ --home "$DATA_DIR$i" --keyring-backend test echo "prepare genesis: Sign genesis transaction" - "$PWD"/build/ethermintd gentx $KEY"$i" 1000000000000000000stake --keyring-backend test --home "$DATA_DIR$i" --keyring-backend test --chain-id $CHAINID + "$PWD"/build/chibaclonkd gentx $KEY"$i" 1000000000000000000stake --keyring-backend test --home "$DATA_DIR$i" --keyring-backend test --chain-id $CHAINID echo "prepare genesis: Collect genesis tx" - "$PWD"/build/ethermintd collect-gentxs --home "$DATA_DIR$i" + "$PWD"/build/chibaclonkd collect-gentxs --home "$DATA_DIR$i" echo "prepare genesis: Run validate-genesis to ensure everything worked and that the genesis file is setup correctly" - "$PWD"/build/ethermintd validate-genesis --home "$DATA_DIR$i" + "$PWD"/build/chibaclonkd validate-genesis --home "$DATA_DIR$i" } start_func() { echo "starting ethermint node $i in background ..." - "$PWD"/build/ethermintd start --pruning=nothing --rpc.unsafe \ + "$PWD"/build/chibaclonkd start --pruning=nothing --rpc.unsafe \ --p2p.laddr tcp://$IP_ADDR:$NODE_P2P_PORT"$i" --address tcp://$IP_ADDR:$NODE_PORT"$i" --rpc.laddr tcp://$IP_ADDR:$NODE_RPC_PORT"$i" \ --json-rpc.address=$IP_ADDR:$RPC_PORT"$i" \ --keyring-backend test --home "$DATA_DIR$i" \ diff --git a/server/flags/flags.go b/server/flags/flags.go index 53b7ced3..ac06bb9b 100644 --- a/server/flags/flags.go +++ b/server/flags/flags.go @@ -5,6 +5,7 @@ import ( "github.com/cosmos/cosmos-sdk/crypto/keyring" "github.com/spf13/cobra" "github.com/spf13/viper" + tmcli "github.com/tendermint/tendermint/libs/cli" ) // Tendermint full-node start flags @@ -68,6 +69,8 @@ func AddTxFlags(cmd *cobra.Command) (*cobra.Command, error) { cmd.PersistentFlags().Float64(flags.FlagGasAdjustment, flags.DefaultGasAdjustment, "adjustment factor to be multiplied against the estimate returned by the tx simulation; if the gas limit is set manually this flag is ignored ") cmd.PersistentFlags().StringP(flags.FlagBroadcastMode, "b", flags.BroadcastSync, "Transaction broadcasting mode (sync|async|block)") cmd.PersistentFlags().String(flags.FlagKeyringBackend, keyring.BackendOS, "Select keyring's backend") + cmd.PersistentFlags().BoolP(flags.FlagSkipConfirmation, "y", false, "Skip tx broadcasting prompt confirmation") + cmd.Flags().StringP(tmcli.OutputFlag, "o", "text", "Output format (text|json)") // --gas can accept integers and "simulate" // cmd.PersistentFlags().Var(&flags.GasFlagVar, "gas", fmt.Sprintf( @@ -84,3 +87,15 @@ func AddTxFlags(cmd *cobra.Command) (*cobra.Command, error) { } return cmd, nil } + +// AddGQLFlags adds gql flags for +func AddGQLFlags(cmd *cobra.Command) *cobra.Command { + // Add flags for GQL server. + cmd.PersistentFlags().Bool("gql-server", false, "Start GQL server.") + cmd.PersistentFlags().Bool("gql-playground", false, "Enable GQL playground.") + cmd.PersistentFlags().String("gql-playground-api-base", "", "GQL API base path to use in GQL playground.") + cmd.PersistentFlags().String("gql-port", "9473", "Port to use for the GQL server.") + cmd.PersistentFlags().String("log-file", "", "File to tail for GQL 'getLogs' API.") + + return cmd +} diff --git a/server/start.go b/server/start.go index a7fe2b8d..7992ca22 100644 --- a/server/start.go +++ b/server/start.go @@ -41,6 +41,8 @@ import ( ethdebug "github.com/tharsis/ethermint/rpc/ethereum/namespaces/debug" "github.com/tharsis/ethermint/server/config" srvflags "github.com/tharsis/ethermint/server/flags" + + "github.com/tharsis/ethermint/gql" ) const ( @@ -447,6 +449,9 @@ func startInProcess(ctx *server.Context, clientCtx client.Context, appCreator ty } } + // Start the GQL Server + go gql.Server(clientCtx) + defer func() { if tmNode.IsRunning() { _ = tmNode.Stop() diff --git a/testnet/README.md b/testnet/README.md new file mode 100644 index 00000000..c837ef33 --- /dev/null +++ b/testnet/README.md @@ -0,0 +1,11 @@ +# Testnet + +## Setup local chibaclonk multi node testnet in local enviorment + +```shell +$ bash multinode_testnet.sh + +or +# this is create localnet with docker containers +$ make localnet-start +``` diff --git a/testnet/full_node.md b/testnet/full_node.md new file mode 100644 index 00000000..f9e75536 --- /dev/null +++ b/testnet/full_node.md @@ -0,0 +1,205 @@ +# Instructions to Run Full Node + +Hardware +--- + +#### Supported + +- **Operating System (OS):** Ubuntu 20.04 +- **CPU:** 1 core +- **RAM:** 2GB +- **Storage:** 25GB SSD + +#### Recommended + +- **Operating System (OS):** Ubuntu 20.04 +- **CPU:** 2 core +- **RAM:** 4GB +- **Storage:** 50GB SSD + +# A) Setup + +## 1) Install Golang (go) + +1.1) Remove any existing installation of `go` + +``` +sudo rm -rf /usr/local/go +``` + +1.2) Install latest/required Go version (installing `go1.17.2`) + +``` +curl https://golang.org/dl/go1.17.2.linux-amd64.tar.gz +sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.17.2.linux-amd64.tar.gz +``` + +1.3) Update env variables to include `go` + +``` +cat <<'EOF' >>$HOME/.profile +export GOROOT=/usr/local/go +export GOPATH=$HOME/go +export GO111MODULE=on +export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin +EOF + +source $HOME/.profile +``` + +1.4) Check the version of go installed + +``` +go version +``` + +### 2) Install required software packages + +``` +sudo apt-get install git curl build-essential make jq -y +``` + +### 3) Install `chibaclonkd` + +``` +git clone https://github.com/vulcanize/chiba-clonk.git +cd chiba-clonk +git fetch --all +git checkout main +make install +``` + +### 4) Verify your installation + +``` +chibaclonkd version --long +``` + +On running the above command, you should see a similar response like this. Make sure that the *version* and *commit +hash* are accurate + +``` +name: chibaclonkd +server_name: chibaclonkd +``` + +### 5) Initialize Node + +**Not required if you have already initialized before** + +``` +chibaclonkd init --chain-id chibaclonk_81337-1 +``` + +On running the above command, node will be initialized with default configuration. (config files will be saved in node's +default home directory (~/.chibaclonkd/config) + +NOTE: Backup node and validator keys . You will need to use these keys at a later point in time. + +--- + +# B) Starting Node + +## 1) Download Final Genesis + +Use `curl` to download the genesis file +**Replace your **genesis** file with published genesis file** + +```shell +# Will be updated +curl {GENESIS_LINK} | jq .result.genesis > ~/.chibaclonkd/config/genesis.json +``` + +Verify sha256 hash of genesis file with the below command + +``` +jq -S -c -M '' ~/.chibaclonkd/config/genesis.json | shasum -a 256 +``` + +genesis sha256 hash should be + +``` +{WILL BE UPDATED} +``` + +## 2) Update Peers & Seeds in config.toml + +``` + + +{peers={WILL BE UPDATED}} +sed -i.bak -e "s/^persistent_peers *=.*/persistent_peers = \"$peers\"/" ~/.chibaclonkd/config/config.toml +``` + +## 3) Start the Full Node + +#### 3.1) Start node as `systemctl` service + +3.1.1) Create the service file + +``` +sudo tee /etc/systemd/system/chibaclonkd.service > /dev/null <>$HOME/.profile +export GOROOT=/usr/local/go +export GOPATH=$HOME/go +export GO111MODULE=on +export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin +EOF + +source $HOME/.profile +``` + +1.4) Check the version of go installed + +``` +go version +``` + +### 2) Install required software packages + +``` +sudo apt-get update && sudo apt-get install git curl build-essential make jq -y +``` + +### 3) Install `chibaclonk` + +``` +git clone https://github.com/vulcanize/chiba-clonk.git +cd chiba-clonk +git fetch --all +git checkout main +make install +``` + +### 4) Verify your installation + +``` +chibaclonkd version --long +``` + +On running the above command, you should see a similar response like this. Make sure that the *version* and *commit +hash* are accurate + +``` +name: chibaclonk +server_name: chibaclonkd +``` + +### 5) Initialize Node + +**Not required if you have already initialized before** + +``` +chibaclonkd init --chain-id chibaclonk_81337-1 +``` + +On running the above command, node will be initialized with default configuration. (config files will be saved in node's +default home directory (~/.chibaclonkd/config) + +NOTE: Backup node and validator keys. You will need to use these keys at a later point in time. + +--- + +## 6) Create Account keys + +if you have participated in previous testnet and have mnemonic phrase, use below command to recover your account + +``` +chibaclonkd keys add --recover +``` + +to create new account + +``` +chibaclonkd keys add +``` + +NOTE: Save `mnemonic` and related account details (public key). You will need to use the need mnemonic/private key to +recover accounts at a later point in time. + +## 7) Add Genesis Account +**Note: don't add more than 12,000 CHK , if you add more than that, your gentx will be ignored.** +``` +chibaclonkd add-genesis-account 12000000000000000000000achk --keyring-backend os +``` + +## 8) Create Your `gentx` + +``` +chibaclonkd gentx 12000000000000000000000achk \ + --pubkey=$(chibaclonkd tendermint show-validator) \ + --chain-id="chibaclonk_81337-1" \ + --moniker="YOUR_MONIKER_NAME" \ + --website="https://yourweb.site" \ + --details="description of my validator" \ + --commission-rate="0.10" \ + --commission-max-rate="0.20" \ + --commission-max-change-rate="0.01" \ + --min-self-delegation="1" +``` + +Note: + +- `` and `chain-id` are required. other flags are optional +- Don't change amount value while creating your gentx +- Genesis transaction file will be saved in `~/.chibaclonkd/config/gentx` folder + +## 9) Submit Your gentx + +Submit your `gentx` file to the [testnets]() in the format of +`-gentx.json` + +NOTE: (Do NOT use space in the file name) + +To submit the gentx file, follow the below process: + +- Fork the [testnets]() repository +- Upload your gentx file in `chibaclonk_81337-1/config/gentxs` folder +- Submit Pull Request to [testnets]() with name `ADD gentx` + +--- + +**Execute below instructions only after publishing of final genesis file** + +genesis file will be published to [testnets/chibaclonk_9000-1]() + +# B) Starting the validator + +TBU + +## 3) Start the Node + +#### 3.1) Start node as `systemctl` service + +3.1.1) Create the service file Note: this step is not required if you did setup before + +``` +sudo tee /etc/systemd/system/chibaclonkd.service > /dev/null </dev/null +} + +if command_exists go; then + echo "Golang is already installed" +else + echo "Installing golang dependencies" + wget https://golang.org/dl/go1.17.2.linux-amd64.tar.gz + rm -rf /usr/local/go && tar -C /usr/local -xzf go1.17.2.linux-amd64.tar.gz + + echo "Updating the profile" + export GOPATH=$HOME/go + export GOROOT=/usr/local/go + export GOBIN=$GOPATH/bin + export PATH=$PATH:/usr/local/go/bin:$GOBIN + + echo "" >>~/.profile + echo 'export GOPATH=$HOME/go' >>~/.profile + echo 'export GOROOT=/usr/local/go' >>~/.profile + echo 'export GOBIN=$GOPATH/bin' >>~/.profile + echo 'export PATH=$PATH:/usr/local/go/bin:$GOBIN' >>~/.profile + + source ~/.profile + mkdir -p "$GOBIN" + mkdir -p $GOPATH/src/github.com + go version +fi + +# chain env variables +export DAEMON_HOME=~/.testchibaclonk +export CHAINID=chibaclonk_9000-1 +export DENOM=achk +export GH_URL=https://github.com/vulcanize/chiba-clonk.git +export CHAIN_VERSION=main +export DAEMON=chibaclonkd + +display_usage() { + printf "** Please check the exported values:: **\n Daemon : $DAEMON\n Denom : $DENOM\n ChainID : $CHAINID\n DaemonHome : $DAEMON_HOME\n \n Github URL : $GH_URL\n Chain Version : $CHAIN_VERSION\n" + exit 1 +} + +if [ -z $DAEMON ] || [ -z $DENOM ] || [ -z $CHAINID ] || [ -z $DAEMON_HOME ] || [ -z $GH_URL ] || [ -z $CHAIN_VERSION ]; then + display_usage +fi + +echo "--------- Install $DAEMON ---------" +git clone -b $CHAIN_VERSION --single-branch $GH_URL && cd $(basename $_ .git) +git fetch && git checkout $CHAIN_VERSION +make install + +cd $HOME + +# check version +$DAEMON version --long + +#echo "----------Create test keys-----------" + +export DAEMON_HOME_1=$DAEMON_HOME-1 +export DAEMON_HOME_2=$DAEMON_HOME-2 +export DAEMON_HOME_3=$DAEMON_HOME-3 +export DAEMON_HOME_4=$DAEMON_HOME-4 + +printf "DAEMON_HOME_1=$DAEMON_HOME_1\nDAEMON_HOME_2=$DAEMON_HOME_2\nDAEMON_HOME_3=$DAEMON_HOME_3\nDAEMON_HOME_4=$DAEMON_HOME_4\n" + +rm -rf $DAEMON_HOME* + +echo "-----Create daemon home directories if not exist------" + +mkdir -p "$DAEMON_HOME_1" +mkdir -p "$DAEMON_HOME_2" +mkdir -p "$DAEMON_HOME_3" +mkdir -p "$DAEMON_HOME_4" + +echo "--------Start initializing the chain ($CHAINID)---------" + +$DAEMON init --chain-id $CHAINID $DAEMON_HOME_1 --home $DAEMON_HOME_1 --keyring-backend test +$DAEMON init --chain-id $CHAINID $DAEMON_HOME_2 --home $DAEMON_HOME_2 --keyring-backend test +$DAEMON init --chain-id $CHAINID $DAEMON_HOME_3 --home $DAEMON_HOME_3 --keyring-backend test +$DAEMON init --chain-id $CHAINID $DAEMON_HOME_4 --home $DAEMON_HOME_4 --keyring-backend test + +echo "---------Creating four keys-------------" + +$DAEMON keys add validator1 --home $DAEMON_HOME_1 --keyring-backend test +$DAEMON keys add validator2 --home $DAEMON_HOME_2 --keyring-backend test +$DAEMON keys add validator3 --home $DAEMON_HOME_3 --keyring-backend test +$DAEMON keys add validator4 --home $DAEMON_HOME_4 --keyring-backend test + +echo "----------Genesis creation---------" + +$DAEMON --home $DAEMON_HOME_1 add-genesis-account validator1 1000000000000$DENOM --keyring-backend test +$DAEMON --home $DAEMON_HOME_2 add-genesis-account validator2 1000000000000$DENOM --keyring-backend test +$DAEMON --home $DAEMON_HOME_3 add-genesis-account validator3 1000000000000$DENOM --keyring-backend test +$DAEMON --home $DAEMON_HOME_4 add-genesis-account validator4 1000000000000$DENOM --keyring-backend test +$DAEMON --home $DAEMON_HOME_1 add-genesis-account $($DAEMON keys show validator2 -a --home $DAEMON_HOME_2 --keyring-backend test) 1000000000000$DENOM +$DAEMON --home $DAEMON_HOME_1 add-genesis-account $($DAEMON keys show validator3 -a --home $DAEMON_HOME_3 --keyring-backend test) 1000000000000$DENOM +$DAEMON --home $DAEMON_HOME_1 add-genesis-account $($DAEMON keys show validator4 -a --home $DAEMON_HOME_4 --keyring-backend test) 1000000000000$DENOM + +echo "--------Gentx--------" + +$DAEMON gentx validator1 90000000000$DENOM --chain-id $CHAINID --keyring-backend test --home $DAEMON_HOME_1 +$DAEMON gentx validator2 90000000000$DENOM --chain-id $CHAINID --keyring-backend test --home $DAEMON_HOME_2 +$DAEMON gentx validator3 90000000000$DENOM --chain-id $CHAINID --keyring-backend test --home $DAEMON_HOME_3 +$DAEMON gentx validator4 90000000000$DENOM --chain-id $CHAINID --keyring-backend test --home $DAEMON_HOME_4 + +echo "---------Copy all the genesis to $DAEMON_HOME_1----------" + +cp $DAEMON_HOME_2/config/gentx/*.json $DAEMON_HOME_1/config/gentx/ +cp $DAEMON_HOME_3/config/gentx/*.json $DAEMON_HOME_1/config/gentx/ +cp $DAEMON_HOME_4/config/gentx/*.json $DAEMON_HOME_1/config/gentx/ + +echo "----------collect-gentxs------------" + +$DAEMON collect-gentxs --home $DAEMON_HOME_1 + +echo "---------Updating $DAEMON_HOME_1 genesis.json ------------" + +sed -i "s/172800000000000/600000000000/g" $DAEMON_HOME_1/config/genesis.json +sed -i "s/172800s/600s/g" $DAEMON_HOME_1/config/genesis.json +sed -i "s/stake/$DENOM/g" $DAEMON_HOME_1/config/genesis.json + +echo "---------Distribute genesis.json of $DAEMON_HOME_1 to remaining nodes-------" + +cp $DAEMON_HOME_1/config/genesis.json $DAEMON_HOME_2/config/ +cp $DAEMON_HOME_1/config/genesis.json $DAEMON_HOME_3/config/ +cp $DAEMON_HOME_1/config/genesis.json $DAEMON_HOME_4/config/ + +echo "---------Getting public IP address-----------" + +IP="127.0.0.1" +echo "Public IP address: ${IP}" + +echo "----------Update node-id of $DAEMON_HOME_1 in remaining nodes---------" +nodeID=$("${DAEMON}" tendermint show-node-id --home $DAEMON_HOME_1) +echo $nodeID +PERSISTENT_PEERS="$nodeID@$IP:16656" +echo "PERSISTENT_PEERS : $PERSISTENT_PEERS" + +echo "----------Updating $DAEMON_HOME_1 chain config-----------" + +sed -i 's#tcp://127.0.0.1:26657#tcp://0.0.0.0:16657#g' $DAEMON_HOME_1/config/config.toml +sed -i 's#tcp://0.0.0.0:26656#tcp://0.0.0.0:16656#g' $DAEMON_HOME_1/config/config.toml +sed -i '/persistent_peers =/c\persistent_peers = "'""'"' $DAEMON_HOME_1/config/config.toml +sed -i '/max_num_inbound_peers =/c\max_num_inbound_peers = 140' $DAEMON_HOME_1/config/config.toml +sed -i '/max_num_outbound_peers =/c\max_num_outbound_peers = 110' $DAEMON_HOME_1/config/config.toml +sed -i '/pprof_laddr =/c\# pprof_laddr = "localhost:6060"' $DAEMON_HOME_1/config/config.toml +sed -i '/allow_duplicate_ip =/c\allow_duplicate_ip = true' $DAEMON_HOME_1/config/config.toml + +sed -i 's#0.0.0.0:9090#0.0.0.0:1090#g' $DAEMON_HOME_1/config/app.toml +sed -i 's#0.0.0.0:9091#0.0.0.0:1091#g' $DAEMON_HOME_1/config/app.toml + +sed -i 's#0.0.0.0:8545#0.0.0.0:1545#g' $DAEMON_HOME_1/config/app.toml +sed -i 's#0.0.0.0:8546#0.0.0.0:1546#g' $DAEMON_HOME_1/config/app.toml + +echo "----------Updating $DAEMON_HOME_2 chain config-----------" + +sed -i 's#tcp://127.0.0.1:26657#tcp://0.0.0.0:26657#g' $DAEMON_HOME_2/config/config.toml +sed -i 's#tcp://0.0.0.0:26656#tcp://0.0.0.0:26656#g' $DAEMON_HOME_2/config/config.toml +sed -i '/persistent_peers =/c\persistent_peers = "'"$PERSISTENT_PEERS"'"' $DAEMON_HOME_2/config/config.toml +sed -i '/max_num_inbound_peers =/c\max_num_inbound_peers = 140' $DAEMON_HOME_2/config/config.toml +sed -i '/max_num_outbound_peers =/c\max_num_outbound_peers = 110' $DAEMON_HOME_2/config/config.toml +sed -i '/pprof_laddr =/c\# pprof_laddr = "localhost:6060"' $DAEMON_HOME_2/config/config.toml +sed -i '/allow_duplicate_ip =/c\allow_duplicate_ip = true' $DAEMON_HOME_2/config/config.toml + +sed -i 's#0.0.0.0:9090#0.0.0.0:2090#g' $DAEMON_HOME_2/config/app.toml +sed -i 's#0.0.0.0:9091#0.0.0.0:2091#g' $DAEMON_HOME_2/config/app.toml + +sed -i 's#0.0.0.0:8545#0.0.0.0:2545#g' $DAEMON_HOME_2/config/app.toml +sed -i 's#0.0.0.0:8546#0.0.0.0:2546#g' $DAEMON_HOME_2/config/app.toml + +echo "----------Updating $DAEMON_HOME_3 chain config------------" + +sed -i 's#tcp://127.0.0.1:26657#tcp://0.0.0.0:36657#g' $DAEMON_HOME_3/config/config.toml +sed -i 's#tcp://0.0.0.0:26656#tcp://0.0.0.0:36656#g' $DAEMON_HOME_3/config/config.toml +sed -i '/persistent_peers =/c\persistent_peers = "'"$PERSISTENT_PEERS"'"' $DAEMON_HOME_3/config/config.toml +sed -i '/max_num_inbound_peers =/c\max_num_inbound_peers = 140' $DAEMON_HOME_3/config/config.toml +sed -i '/max_num_outbound_peers =/c\max_num_outbound_peers = 110' $DAEMON_HOME_3/config/config.toml +sed -i '/pprof_laddr =/c\# pprof_laddr = "localhost:6060"' $DAEMON_HOME_3/config/config.toml +sed -i '/allow_duplicate_ip =/c\allow_duplicate_ip = true' $DAEMON_HOME_3/config/config.toml + +sed -i 's#0.0.0.0:9090#0.0.0.0:3090#g' $DAEMON_HOME_3/config/app.toml +sed -i 's#0.0.0.0:9091#0.0.0.0:3091#g' $DAEMON_HOME_3/config/app.toml + +sed -i 's#0.0.0.0:8545#0.0.0.0:3545#g' $DAEMON_HOME_3/config/app.toml +sed -i 's#0.0.0.0:8546#0.0.0.0:3546#g' $DAEMON_HOME_3/config/app.toml + +echo "----------Updating $DAEMON_HOME_4 chain config------------" + +sed -i 's#tcp://127.0.0.1:26657#tcp://0.0.0.0:46657#g' $DAEMON_HOME_4/config/config.toml +sed -i 's#tcp://0.0.0.0:26656#tcp://0.0.0.0:46656#g' $DAEMON_HOME_4/config/config.toml +sed -i '/persistent_peers =/c\persistent_peers = "'"$PERSISTENT_PEERS"'"' $DAEMON_HOME_4/config/config.toml +sed -i '/max_num_inbound_peers =/c\max_num_inbound_peers = 140' $DAEMON_HOME_4/config/config.toml +sed -i '/max_num_outbound_peers =/c\max_num_outbound_peers = 110' $DAEMON_HOME_4/config/config.toml +sed -i '/pprof_laddr =/c\# pprof_laddr = "localhost:6060"' $DAEMON_HOME_4/config/config.toml +sed -i '/allow_duplicate_ip =/c\allow_duplicate_ip = true' $DAEMON_HOME_4/config/config.toml + +sed -i 's#0.0.0.0:9090#0.0.0.0:4090#g' $DAEMON_HOME_4/config/app.toml +sed -i 's#0.0.0.0:9091#0.0.0.0:4091#g' $DAEMON_HOME_4/config/app.toml + +sed -i 's#0.0.0.0:8545#0.0.0.0:4545#g' $DAEMON_HOME_4/config/app.toml +sed -i 's#0.0.0.0:8546#0.0.0.0:4546#g' $DAEMON_HOME_4/config/app.toml + +echo "starting the chains" + +nohup $(which $DAEMON) start --gql-playground --gql-server --home $DAEMON_HOME_1 >$DAEMON_HOME_1.log & +sleep 5s +echo "Checking $DAEMON_HOME_1 chain status" +$DAEMON status --node tcp://localhost:16657 + +nohup $(which $DAEMON) start --gql-playground --gql-server --home $DAEMON_HOME_2 >$DAEMON_HOME_2.log & +sleep 5s +echo "Checking $DAEMON_HOME_2 chain status" +$DAEMON status --node tcp://localhost:26657 + +nohup $(which $DAEMON) start --gql-playground --gql-server --home $DAEMON_HOME_3 >$DAEMON_HOME_3.log & +sleep 5s +echo "Checking $DAEMON_HOME_3 chain status" +$DAEMON status --node tcp://localhost:36657 + +nohup $(which $DAEMON) start --gql-playground --gql-server --home $DAEMON_HOME_4 >$DAEMON_HOME_4.log & +sleep 5s +echo "Checking $DAEMON_HOME_4 chain status" +$DAEMON status --node tcp://localhost:46657 \ No newline at end of file diff --git a/testnet/validator_node.md b/testnet/validator_node.md new file mode 100644 index 00000000..b831a5d2 --- /dev/null +++ b/testnet/validator_node.md @@ -0,0 +1,54 @@ +### Create Validator Post Genesis + +1. Run Full Node +2. Create Account and Get test tokens +3. Create Validator + +### 1.Run Full Node + +- Check "[Run Full Node](full-node.md)" section to Run a Full Node + +### 2. Create Account & Get test tokens + +``` +chibaclonkd keys add --keyring-backend test +``` + +NOTE: Save `mnemonic` and related account details (public key). You will need to use the need mnemonic/private key to +recover accounts at a later point in time. + +##### Get Test tokens from faucet + +- Faucet website link will be updated +- 1 CHK = 1 * 10e^18 achk + +### 3.Create Validator + +- ##### Check full node sync status + + `chibaclonkd status 2>&1 | jq -r ".SyncInfo"` + + `catching_up: false` means node is completely synced +- ##### Create validator + +`Note:` Only execute below transaction after complete sync of your full node + +Please replace `key_name` with your key name, amount with staking amount, validator description and `moniker` also + +``` +chibaclonkd tx staking create-validator \ + --amount="AMOUNT" \ + --pubkey=$(chibaclonkd tendermint show-validator) \ + --moniker="my-moniker" \ + --website="https://myweb.site" \ + --details="description of your validator" \ + --chain-id="chibaclonk_81337-1" \ + --commission-rate="0.10" \ + --commission-max-rate="0.20" \ + --commission-max-change-rate="0.01" \ + --min-self-delegation="1" \ + --gas="auto" \ + --gas-adjustment="1.2" \ + --gas-prices="0.025achk" \ + --from= +``` \ No newline at end of file diff --git a/tests/solidity/init-test-node.sh b/tests/solidity/init-test-node.sh index 6f0cf15c..4093be2f 100755 --- a/tests/solidity/init-test-node.sh +++ b/tests/solidity/init-test-node.sh @@ -24,38 +24,38 @@ USER4_KEY="user4" USER4_MNEMONIC="doll midnight silk carpet brush boring pluck office gown inquiry duck chief aim exit gain never tennis crime fragile ship cloud surface exotic patch" # remove existing daemon and client -rm -rf ~/.ethermint* +rm -rf ~/.chibaclonk* # Import keys from mnemonics -echo $VAL_MNEMONIC | ethermintd keys add $VAL_KEY --recover --keyring-backend test --algo "eth_secp256k1" -echo $USER1_MNEMONIC | ethermintd keys add $USER1_KEY --recover --keyring-backend test --algo "eth_secp256k1" -echo $USER2_MNEMONIC | ethermintd keys add $USER2_KEY --recover --keyring-backend test --algo "eth_secp256k1" -echo $USER3_MNEMONIC | ethermintd keys add $USER3_KEY --recover --keyring-backend test --algo "eth_secp256k1" -echo $USER4_MNEMONIC | ethermintd keys add $USER4_KEY --recover --keyring-backend test --algo "eth_secp256k1" +echo $VAL_MNEMONIC | chibaclonkd keys add $VAL_KEY --recover --keyring-backend test --algo "eth_secp256k1" +echo $USER1_MNEMONIC | chibaclonkd keys add $USER1_KEY --recover --keyring-backend test --algo "eth_secp256k1" +echo $USER2_MNEMONIC | chibaclonkd keys add $USER2_KEY --recover --keyring-backend test --algo "eth_secp256k1" +echo $USER3_MNEMONIC | chibaclonkd keys add $USER3_KEY --recover --keyring-backend test --algo "eth_secp256k1" +echo $USER4_MNEMONIC | chibaclonkd keys add $USER4_KEY --recover --keyring-backend test --algo "eth_secp256k1" -ethermintd init $MONIKER --chain-id $CHAINID +chibaclonkd init $MONIKER --chain-id $CHAINID # Set gas limit in genesis -cat $HOME/.ethermintd/config/genesis.json | jq '.consensus_params["block"]["max_gas"]="10000000"' > $HOME/.ethermintd/config/tmp_genesis.json && mv $HOME/.ethermintd/config/tmp_genesis.json $HOME/.ethermintd/config/genesis.json +cat $HOME/.chibaclonkd/config/genesis.json | jq '.consensus_params["block"]["max_gas"]="10000000"' > $HOME/.chibaclonkd/config/tmp_genesis.json && mv $HOME/.chibaclonkd/config/tmp_genesis.json $HOME/.chibaclonkd/config/genesis.json # Reduce the block time to 1s -sed -i -e '/^timeout_commit =/ s/= .*/= "850ms"/' $HOME/.ethermintd/config/config.toml +sed -i -e '/^timeout_commit =/ s/= .*/= "850ms"/' $HOME/.chibaclonkd/config/config.toml # Allocate genesis accounts (cosmos formatted addresses) -ethermintd add-genesis-account "$(ethermintd keys show $VAL_KEY -a --keyring-backend test)" 1000000000000000000000aphoton,1000000000000000000stake --keyring-backend test -ethermintd add-genesis-account "$(ethermintd keys show $USER1_KEY -a --keyring-backend test)" 1000000000000000000000aphoton,1000000000000000000stake --keyring-backend test -ethermintd add-genesis-account "$(ethermintd keys show $USER2_KEY -a --keyring-backend test)" 1000000000000000000000aphoton,1000000000000000000stake --keyring-backend test -ethermintd add-genesis-account "$(ethermintd keys show $USER3_KEY -a --keyring-backend test)" 1000000000000000000000aphoton,1000000000000000000stake --keyring-backend test -ethermintd add-genesis-account "$(ethermintd keys show $USER4_KEY -a --keyring-backend test)" 1000000000000000000000aphoton,1000000000000000000stake --keyring-backend test +chibaclonkd add-genesis-account "$(chibaclonkd keys show $VAL_KEY -a --keyring-backend test)" 1000000000000000000000aphoton,1000000000000000000stake --keyring-backend test +chibaclonkd add-genesis-account "$(chibaclonkd keys show $USER1_KEY -a --keyring-backend test)" 1000000000000000000000aphoton,1000000000000000000stake --keyring-backend test +chibaclonkd add-genesis-account "$(chibaclonkd keys show $USER2_KEY -a --keyring-backend test)" 1000000000000000000000aphoton,1000000000000000000stake --keyring-backend test +chibaclonkd add-genesis-account "$(chibaclonkd keys show $USER3_KEY -a --keyring-backend test)" 1000000000000000000000aphoton,1000000000000000000stake --keyring-backend test +chibaclonkd add-genesis-account "$(chibaclonkd keys show $USER4_KEY -a --keyring-backend test)" 1000000000000000000000aphoton,1000000000000000000stake --keyring-backend test # Sign genesis transaction -ethermintd gentx $VAL_KEY 1000000000000000000stake --amount=1000000000000000000000aphoton --chain-id $CHAINID --keyring-backend test +chibaclonkd gentx $VAL_KEY 1000000000000000000stake --amount=1000000000000000000000aphoton --chain-id $CHAINID --keyring-backend test # Collect genesis tx -ethermintd collect-gentxs +chibaclonkd collect-gentxs # Run this to ensure everything worked and that the genesis file is setup correctly -ethermintd validate-genesis +chibaclonkd validate-genesis # Start the node (remove the --pruning=nothing flag if historical queries are not needed) -ethermintd start --pruning=nothing --rpc.unsafe --keyring-backend test --log_level info --json-rpc.api eth,txpool,personal,net,debug,web3 --api.enable +chibaclonkd start --pruning=nothing --rpc.unsafe --keyring-backend test --log_level info --json-rpc.api eth,txpool,personal,net,debug,web3 --api.enable diff --git a/tests/solidity/test-helper.js b/tests/solidity/test-helper.js index dee961a6..363023ab 100644 --- a/tests/solidity/test-helper.js +++ b/tests/solidity/test-helper.js @@ -181,7 +181,7 @@ function setupNetwork({ runConfig, timeout }) { stdio: ['ignore', runConfig.verboseLog ? 'pipe' : 'ignore', 'pipe'], }); - logger.info(`Starting Ethermintd process... timeout: ${timeout}ms`); + logger.info(`Starting Chibaclonkd process... timeout: ${timeout}ms`); if (runConfig.verboseLog) { ethermintdProc.stdout.pipe(process.stdout); } @@ -191,14 +191,14 @@ function setupNetwork({ runConfig, timeout }) { process.stdout.write(oLine); } if (oLine.indexOf('Starting JSON-RPC server') !== -1) { - logger.info('Ethermintd started'); + logger.info('Chibaclonkd started'); resolve(ethermintdProc); } }); }); const timeoutPromise = new Promise((resolve, reject) => { - setTimeout(() => reject(new Error('Start ethermintd timeout!')), timeout); + setTimeout(() => reject(new Error('Start chibaclonkd timeout!')), timeout); }); return Promise.race([spawnPromise, timeoutPromise]); } diff --git a/testutil/network/network.go b/testutil/network/network.go index 85b25f0d..498b3f3c 100644 --- a/testutil/network/network.go +++ b/testutil/network/network.go @@ -428,6 +428,7 @@ func New(l Logger, baseDir string, cfg Config) (*Network, error) { stakingtypes.NewCommissionRates(commission, sdk.OneDec(), sdk.OneDec()), sdk.OneInt(), ) + if err != nil { return nil, err } diff --git a/testutil/network/util.go b/testutil/network/util.go index 47019f20..ddf541b0 100644 --- a/testutil/network/util.go +++ b/testutil/network/util.go @@ -195,6 +195,7 @@ func initGenFiles(cfg Config, genAccounts []authtypes.GenesisAccount, genBalance // set the balances in the genesis state var bankGenState banktypes.GenesisState + cfg.Codec.MustUnmarshalJSON(cfg.GenesisState[banktypes.ModuleName], &bankGenState) bankGenState.Balances = genBalances cfg.GenesisState[banktypes.ModuleName] = cfg.Codec.MustMarshalJSON(&bankGenState) diff --git a/utils/json.go b/utils/json.go new file mode 100644 index 00000000..b6faafe2 --- /dev/null +++ b/utils/json.go @@ -0,0 +1,52 @@ +// +// Copyright 2020 Wireline, Inc. +// + +package utils + +import ( + "bytes" + "errors" + + canonicalJson "github.com/gibson042/canonicaljson-go" + cbor "github.com/ipfs/go-ipld-cbor" + mh "github.com/multiformats/go-multihash" +) + +// GenerateHash returns the hash of the canonicalized JSON input. +func GenerateHash(json map[string]interface{}) (string, []byte, error) { + content, err := canonicalJson.Marshal(json) + if err != nil { + return "", nil, err + } + + cid, err := CIDFromJSONBytes(content) + if err != nil { + return "", nil, err + } + + return cid, content, nil +} + +// CIDFromJSONBytes returns CID (cbor) for json (as bytes). +func CIDFromJSONBytes(content []byte) (string, error) { + cid, err := cbor.FromJSON(bytes.NewReader(content), mh.SHA2_256, -1) + if err != nil { + return "", err + } + + return cid.String(), nil +} + +// GetAttributeAsString returns a map attribute as string, if possible. +func GetAttributeAsString(obj map[string]interface{}, attr string) (string, error) { + if value, ok := obj[attr]; ok { + if valueStr, ok := value.(string); ok { + return valueStr, nil + } + + return "", errors.New("attribute not of string type") + } + + return "", errors.New("attribute not found") +} diff --git a/utils/mnemonic.go b/utils/mnemonic.go new file mode 100644 index 00000000..80dce1ac --- /dev/null +++ b/utils/mnemonic.go @@ -0,0 +1,25 @@ +// +// Copyright 2020 Wireline, Inc. +// + +package utils + +import "github.com/cosmos/go-bip39" + +const ( + mnemonicEntropySize = 256 +) + +func GenerateMnemonic() (string, error) { + entropySeed, err := bip39.NewEntropy(mnemonicEntropySize) + if err != nil { + return "", err + } + + mnemonic, err := bip39.NewMnemonic(entropySeed[:]) + if err != nil { + return "", err + } + + return mnemonic, nil +} diff --git a/utils/types.go b/utils/types.go new file mode 100644 index 00000000..51e42acd --- /dev/null +++ b/utils/types.go @@ -0,0 +1,52 @@ +// +// Copyright 2020 Wireline, Inc. +// + +package utils + +import ( + "bytes" + "encoding/binary" + "sort" + + set "github.com/deckarep/golang-set" +) + +func Int64ToBytes(num int64) []byte { + buf := new(bytes.Buffer) + binary.Write(buf, binary.BigEndian, num) + return buf.Bytes() +} + +func SetToSlice(set set.Set) []string { + names := []string{} + + for name := range set.Iter() { + if name, ok := name.(string); ok && name != "" { + names = append(names, name) + } + } + + sort.SliceStable(names, func(i, j int) bool { return names[i] < names[j] }) + + return names +} + +func SliceToSet(names []string) set.Set { + set := set.NewThreadUnsafeSet() + + for _, name := range names { + if name != "" { + set.Add(name) + } + } + + return set +} + +func AppendUnique(list []string, element string) []string { + set := SliceToSet(list) + set.Add(element) + + return SetToSlice(set) +} diff --git a/x/auction/README.md b/x/auction/README.md new file mode 100644 index 00000000..7800cbdf --- /dev/null +++ b/x/auction/README.md @@ -0,0 +1,298 @@ +# Auction Module CLI Commands + +## Build the Chain + +The following command builds the Ethermint daemon and places the binary in the `build` directory + +``` +make build + +``` + +## Setup the Chain + +The following steps need to be followed only before running the chain for the first time. + +1. Add the root key: + ``` + ./build/chibaclonkd keys add root + ``` + Keep a note of the keyring passphrase if you set it. +2. Init the chain: + ``` + ./build/chibaclonkd init test-moniker --chain-id ethermint_9000-1 + ``` +3. Add genesis account: + ``` + ./build/chibaclonkd add-genesis-account $(./build/chibaclonkd keys show root -a) 1000000000000000000aphoton,1000000000000000000stake + ``` +4. Make a genesis tx: + ``` + ./build/chibaclonkd gentx root 1000000000000000000stake --chain-id ethermint_9000-1 + ``` +5. Collect gentxs: + ``` + ./build/chibaclonkd collect-gentxs + ``` + +The chain can now be started using: + +``` +./build/chibaclonkd start +``` + +## Querying the Params + +The following command will dislay the default params for the `auction` module: + +``` +# ./build/chibaclonkd q auction params -o json | jq + +{ + "params": { + "commits_duration": "0s", + "reveals_duration": "0s", + "commit_fee": { + "denom": "", + "amount": "0" + }, + "reveal_fee": { + "denom": "", + "amount": "0" + }, + "minimum_bid": { + "denom": "", + "amount": "0" + } + } +} +``` + +## Auction TX CLI Commands + +### Create Auction + +``` +# ./build/chibaclonkd tx auction create 100s 100s 10aphoton 10aphoton 1000aphoton --from root --chain-id $(./build/chibaclonkd status | jq .NodeInfo.network -r) + +Enter keyring passphrase: + +{"body":{"messages":[{"@type":"/vulcanize.auction.v1beta1.MsgCreateAuction","commits_duration":"100s","reveals_duration":"100s","commit_fee":{"denom":"aphoton","amount":"10"},"reveal_fee":{"denom":"aphoton","amount":"10"},"minimum_bid":{"denom":"aphoton","amount":"1000"},"signer":"ethm1l7cstwtf2lvev27ka67c23yk7mmj8ad7tetpqc"}],"memo":"","timeout_height":"0","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[],"fee":{"amount":[],"gas_limit":"200000","payer":"","granter":""}},"signatures":[]} + +confirm transaction before signing and broadcasting [y/N]: y + +code: 0 +codespace: "" +data: "" +gas_used: "0" +gas_wanted: "0" +height: "0" +info: "" +logs: [] +raw_log: '[]' +timestamp: "" +tx: null +txhash: ECAD6DF1ECA763FBD26EB7C2C0B77425FFE2FBEA2BEC57CE0FBC173AE0F45298 +``` + +### Commit Bid + +``` +# ./build/chibaclonkd tx auction commit-bid e7d14c7e7a6d7537cbdb8fbe62f22b1553c2ef4ce3705ada7c28f80faf2fbe0d 2000aphoton --from root --chain-id $(./build/chibaclonkd status | jq .NodeInfo.network -r) + +Enter keyring passphrase: + +{"body":{"messages":[{"@type":"/vulcanize.auction.v1beta1.MsgCommitBid","auction_id":"e7d14c7e7a6d7537cbdb8fbe62f22b1553c2ef4ce3705ada7c28f80faf2fbe0d","commit_hash":"bafyreibt4twofrc3xi2es27cfrroy346iy6lr3gkw33i5dltkqqarlyltm","signer":"ethm1l7cstwtf2lvev27ka67c23yk7mmj8ad7tetpqc"}],"memo":"","timeout_height":"0","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[],"fee":{"amount":[],"gas_limit":"200000","payer":"","granter":""}},"signatures":[]} + +confirm transaction before signing and broadcasting [y/N]: y + +code: 0 +codespace: "" +data: "" +gas_used: "0" +gas_wanted: "0" +height: "0" +info: "" +logs: [] +raw_log: '[]' +timestamp: "" +tx: null +txhash: 71D8CF34026E32A3A34C2C2D4ADF25ABC8D7943A4619761BE27F196603D91B9D +``` + +### Reveal Bid + +``` +# ./build/chibaclonkd tx auction reveal-bid e7d14c7e7a6d7537cbdb8fbe62f22b1553c2ef4ce3705ada7c28f80faf2fbe0d root-bafyreibt4twofrc3xi2es27cfrroy346iy6lr3gkw33i5dltkqqarlyltm.json --from root --chain-id $(./build/chibaclonkd status | jq .NodeInfo.network -r) + +Enter keyring passphrase: + +{"body":{"messages":[{"@type":"/vulcanize.auction.v1beta1.MsgRevealBid","auction_id":"e7d14c7e7a6d7537cbdb8fbe62f22b1553c2ef4ce3705ada7c28f80faf2fbe0d","reveal":"7b2261756374696f6e4964223a2265376431346337653761366437353337636264623866626536326632326231353533633265663463653337303561646137633238663830666166326662653064222c22626964416d6f756e74223a22323030306170686f746f6e222c2262696464657241646472657373223a226574686d316c37637374777466326c76657632376b613637633233796b376d6d6a38616437746574707163222c22636861696e4964223a2265746865726d696e745f393030302d31222c226e6f697365223a22636c69666620737566666572206472616d6120676f7370656c2077656173656c207061706572206c696272617279206469736f726465722063757276652073706f74206375727461696e207a6562726120696e76657374206465766f74652072656e64657220636c6970207377616c6c6f77206d6f6e6b6579206f62736572766520726573706f6e7365206c696e6b206372616e6520766961626c6520736576656e227d","signer":"ethm1l7cstwtf2lvev27ka67c23yk7mmj8ad7tetpqc"}],"memo":"","timeout_height":"0","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[],"fee":{"amount":[],"gas_limit":"200000","payer":"","granter":""}},"signatures":[]} + +confirm transaction before signing and broadcasting [y/N]: y + +code: 0 +codespace: "" +data: "" +gas_used: "0" +gas_wanted: "0" +height: "0" +info: "" +logs: [] +raw_log: '[]' +timestamp: "" +tx: null +txhash: 4D1C0B3DDA4050F9BB32240FBD5234229E5C32543C1A0A78033B9531EB0CF8BA +``` + +## Auction Query CLI Commands + +### List Auctions + +``` +# ./build/chibaclonkd q auction list + +auctions: + auctions: + - commit_fee: + amount: "10" + denom: aphoton + commits_end_time: "2021-09-30T07:57:07.933412800Z" + create_time: "2021-09-30T07:55:27.933412800Z" + id: e7d14c7e7a6d7537cbdb8fbe62f22b1553c2ef4ce3705ada7c28f80faf2fbe0d + minimum_bid: + amount: "1000" + denom: aphoton + owner_address: ethm1l7cstwtf2lvev27ka67c23yk7mmj8ad7tetpqc + reveal_fee: + amount: "10" + denom: aphoton + reveals_end_time: "2021-09-30T07:58:47.933412800Z" + status: commit + winner_address: "" + winning_bid: + amount: "0" + denom: "" + winning_price: + amount: "0" + denom: "" +pagination: null +``` + +### Get Bid + +``` +# ./build/chibaclonkd q auction get-bid e7d14c7e7a6d7537cbdb8fbe62f22b1553c2ef4ce3705ada7c28f80faf2fbe0e ethm1l7cstwtf2lvev27ka67c23yk7mmj8ad7tetpqc + +bid: + auction_id: e7d14c7e7a6d7537cbdb8fbe62f22b1553c2ef4ce3705ada7c28f80faf2fbe0d + bid_amount: + amount: "0" + denom: "" + bidder_address: ethm1l7cstwtf2lvev27ka67c23yk7mmj8ad7tetpqc + commit_fee: + amount: "10" + denom: aphoton + commit_hash: bafyreibt4twofrc3xi2es27cfrroy346iy6lr3gkw33i5dltkqqarlyltm + commit_time: "2021-09-30T08:49:48.358878200Z" + reveal_fee: + amount: "10" + denom: aphoton + reveal_time: "0001-01-01T00:00:00Z" + status: commit +``` + +### Get All Bids for an Auction + +``` +./build/chibaclonkd q auction get-bids e7d14c7e7a6d7537cbdb8fbe62f22b1553c2ef4ce3705ada7c28f80faf2fbe0d + +bids: +- auction_id: e7d14c7e7a6d7537cbdb8fbe62f22b1553c2ef4ce3705ada7c28f80faf2fbe0d + bid_amount: + amount: "0" + denom: "" + bidder_address: ethm1l7cstwtf2lvev27ka67c23yk7mmj8ad7tetpqc + commit_fee: + amount: "10" + denom: aphoton + commit_hash: bafyreibt4twofrc3xi2es27cfrroy346iy6lr3gkw33i5dltkqqarlyltm + commit_time: "2021-09-30T08:49:48.358878200Z" + reveal_fee: + amount: "10" + denom: aphoton + reveal_time: "0001-01-01T00:00:00Z" + status: commit +``` + +### Get Auction by AuctionID + +``` +# ./build/chibaclonkd q auction get e7d14c7e7a6d7537cbdb8fbe62f22b1553c2ef4ce3705ada7c28f80faf2fbe0d + +auction: + commit_fee: + amount: "10" + denom: aphoton + commits_end_time: "2021-09-30T07:57:07.933412800Z" + create_time: "2021-09-30T07:55:27.933412800Z" + id: e7d14c7e7a6d7537cbdb8fbe62f22b1553c2ef4ce3705ada7c28f80faf2fbe0d + minimum_bid: + amount: "1000" + denom: aphoton + owner_address: ethm1l7cstwtf2lvev27ka67c23yk7mmj8ad7tetpqc + reveal_fee: + amount: "10" + denom: aphoton + reveals_end_time: "2021-09-30T07:58:47.933412800Z" + status: commit + winner_address: "" + winning_bid: + amount: "0" + denom: "" + winning_price: + amount: "0" + denom: "" + +``` + +### Get Auction by Bidder + +``` +# ./build/chibaclonkd q auction query-by-owner ethm1l7cstwtf2lvev27ka67c23yk7mmj8ad7tetpqc + +auctions: + auctions: + - commit_fee: + amount: "10" + denom: aphoton + commits_end_time: "2021-09-30T07:57:07.933412800Z" + create_time: "2021-09-30T07:55:27.933412800Z" + id: e7d14c7e7a6d7537cbdb8fbe62f22b1553c2ef4ce3705ada7c28f80faf2fbe0d + minimum_bid: + amount: "1000" + denom: aphoton + owner_address: ethm1l7cstwtf2lvev27ka67c23yk7mmj8ad7tetpqc + reveal_fee: + amount: "10" + denom: aphoton + reveals_end_time: "2021-09-30T07:58:47.933412800Z" + status: commit + winner_address: "" + winning_bid: + amount: "0" + denom: "" + winning_price: + amount: "0" + denom: "" +``` + +### Query Account Balance + +``` +# ./build/chibaclonkd q auction balance + +balance: +- amount: "20" + denom: aphoton +``` \ No newline at end of file diff --git a/x/auction/abci.go b/x/auction/abci.go new file mode 100644 index 00000000..636803d5 --- /dev/null +++ b/x/auction/abci.go @@ -0,0 +1,13 @@ +package auction + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + abci "github.com/tendermint/tendermint/abci/types" + "github.com/tharsis/ethermint/x/auction/keeper" +) + +// EndBlocker is called every block, returns updated validator set. +func EndBlocker(ctx sdk.Context, k keeper.Keeper) []abci.ValidatorUpdate { + k.EndBlockerProcessAuctions(ctx) + return []abci.ValidatorUpdate{} +} diff --git a/x/auction/client/cli/query.go b/x/auction/client/cli/query.go new file mode 100644 index 00000000..844f29bc --- /dev/null +++ b/x/auction/client/cli/query.go @@ -0,0 +1,263 @@ +package cli + +import ( + "fmt" + "strings" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/version" + + "github.com/spf13/cobra" + + "github.com/tharsis/ethermint/x/auction/types" +) + +func GetQueryCmd() *cobra.Command { + auctionQueryCmd := &cobra.Command{ + Use: types.ModuleName, + Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + auctionQueryCmd.AddCommand( + GetCmdList(), + GetCmdGetAuction(), + GetCmdGetBid(), + GetCmdGetBids(), + GetCmdAuctionsByBidder(), + GetCmdAuctionsByOwner(), + GetCmdQueryParams(), + GetCmdBalance(), + ) + + return auctionQueryCmd +} + +// GetCmdList queries all auctions. +func GetCmdList() *cobra.Command { + cmd := &cobra.Command{ + Use: "list", + Short: "List auctions.", + Args: cobra.ExactArgs(0), + 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.Auctions(cmd.Context(), &types.AuctionsRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + return cmd +} + +// GetCmdGetBid queries an auction bid. +func GetCmdGetBid() *cobra.Command { + cmd := &cobra.Command{ + Use: "get-bid [auction-id] [bidder]", + Short: "Get auction bid.", + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + id := args[0] + bidder := args[1] + + queryClient := types.NewQueryClient(clientCtx) + res, err := queryClient.GetBid(cmd.Context(), &types.BidRequest{AuctionId: id, Bidder: bidder}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + return cmd +} + +// GetCmdGetBids queries all auction bids. +func GetCmdGetBids() *cobra.Command { + cmd := &cobra.Command{ + Use: "get-bids [auction-id]", + Short: "Get all auction bids.", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + id := args[0] + + queryClient := types.NewQueryClient(clientCtx) + res, err := queryClient.GetBids(cmd.Context(), &types.BidsRequest{AuctionId: id}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + return cmd +} + +// GetCmdGetAuction queries an auction. +func GetCmdGetAuction() *cobra.Command { + cmd := &cobra.Command{ + Use: "get [ID]", + Short: "Get auction.", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + id := args[0] + + queryClient := types.NewQueryClient(clientCtx) + res, err := queryClient.GetAuction(cmd.Context(), &types.AuctionRequest{Id: id}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + return cmd +} + +// GetCmdAuctionsByBidder queries auctions by bidder. +func GetCmdAuctionsByBidder() *cobra.Command { + cmd := &cobra.Command{ + Use: "query-by-bidder [address]", + Short: "Query auctions by bidder.", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + address := args[0] + + queryClient := types.NewQueryClient(clientCtx) + res, err := queryClient.AuctionsByBidder(cmd.Context(), &types.AuctionsByBidderRequest{BidderAddress: address}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + return cmd +} + +// GetCmdAuctionsByOwner queries auctions by owner +func GetCmdAuctionsByOwner() *cobra.Command { + cmd := &cobra.Command{ + Use: "query-by-owner [address]", + Short: "Query auctions by owner/creator.", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + address := args[0] + + queryClient := types.NewQueryClient(clientCtx) + res, err := queryClient.AuctionsByOwner(cmd.Context(), &types.AuctionsByOwnerRequest{OwnerAddress: address}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + return cmd +} + +// GetCmdQueryParams implements the params query command. +func GetCmdQueryParams() *cobra.Command { + cmd := &cobra.Command{ + Use: "params", + Args: cobra.NoArgs, + Short: "Query the current auction parameters information.", + Long: strings.TrimSpace( + fmt.Sprintf(`Query values set as auction parameters. + Example: + $ %s query auction params + `, + version.AppName, + ), + ), + 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.QueryParams(cmd.Context(), &types.QueryParamsRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + return cmd +} + +// GetCmdBalance queries the auction module account balance. +func GetCmdBalance() *cobra.Command { + cmd := &cobra.Command{ + Use: "balance", + Short: "Get auction module account balance.", + Args: cobra.ExactArgs(0), + 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.Balance(cmd.Context(), &types.BalanceRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + return cmd +} diff --git a/x/auction/client/cli/tx.go b/x/auction/client/cli/tx.go new file mode 100644 index 00000000..2728716d --- /dev/null +++ b/x/auction/client/cli/tx.go @@ -0,0 +1,187 @@ +package cli + +import ( + "encoding/hex" + "fmt" + "io/ioutil" + "time" + + "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" + "github.com/spf13/viper" + + "github.com/tharsis/ethermint/x/auction/types" + + wnsUtils "github.com/tharsis/ethermint/utils" +) + +// GetTxCmd returns transaction commands for this module. +func GetTxCmd() *cobra.Command { + auctionTxCmd := &cobra.Command{ + Use: types.ModuleName, + Short: "Auction transactions subcommands", + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + auctionTxCmd.AddCommand( + GetCmdCreateAuction(), + GetCmdCommitBid(), + GetCmdRevealBid(), + ) + + return auctionTxCmd +} + +func GetCmdCreateAuction() *cobra.Command { + cmd := &cobra.Command{ + Use: "create [commits-duration] [reveals-duration] [commit-fee] [reveal-fee] [minimum-bid]", + Short: "Create auction.", + Args: cobra.ExactArgs(5), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + commitsDuration, err := time.ParseDuration(args[0]) + if err != nil { + return err + } + + revealsDuration, err := time.ParseDuration(args[1]) + if err != nil { + return err + } + + commitFee, err := sdk.ParseCoinNormalized(args[2]) + if err != nil { + return err + } + + revealFee, err := sdk.ParseCoinNormalized(args[3]) + if err != nil { + return err + } + + minimumBid, err := sdk.ParseCoinNormalized(args[4]) + if err != nil { + return err + } + + params := types.Params{ + CommitsDuration: commitsDuration, + RevealsDuration: revealsDuration, + CommitFee: commitFee, + RevealFee: revealFee, + MinimumBid: minimumBid, + } + msg := types.NewMsgCreateAuction(params, clientCtx.GetFromAddress()) + err = msg.ValidateBasic() + if err != nil { + return err + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + return cmd +} + +// GetCmdCommitBid is the CLI command for committing a bid. +func GetCmdCommitBid() *cobra.Command { + cmd := &cobra.Command{ + Use: "commit-bid [auction-id] [bid-amount]", + Short: "Commit sealed bid.", + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + bidAmount, err := sdk.ParseCoinNormalized(args[1]) + if err != nil { + return err + } + + mnemonic, err := wnsUtils.GenerateMnemonic() + if err != nil { + return err + } + + chainID := viper.GetString("chain-id") + auctionID := args[0] + + reveal := map[string]interface{}{ + "chainId": chainID, + "auctionId": auctionID, + "bidderAddress": clientCtx.GetFromAddress().String(), + "bidAmount": bidAmount.String(), + "noise": mnemonic, + } + + commitHash, content, err := wnsUtils.GenerateHash(reveal) + if err != nil { + return err + } + + // Save reveal file. + ioutil.WriteFile(fmt.Sprintf("%s-%s.json", clientCtx.GetFromName(), commitHash), content, 0600) + + msg := types.NewMsgCommitBid(auctionID, commitHash, clientCtx.GetFromAddress()) + err = msg.ValidateBasic() + if err != nil { + return err + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} + +// GetCmdRevealBid is the CLI command for revealing a bid. +func GetCmdRevealBid() *cobra.Command { + cmd := &cobra.Command{ + Use: "reveal-bid [auction-id] [reveal-file-path]", + Short: "Reveal bid.", + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + auctionID := args[0] + revealFilePath := args[1] + + revealBytes, err := ioutil.ReadFile(revealFilePath) + if err != nil { + return err + } + + msg := types.NewMsgRevealBid(auctionID, hex.EncodeToString(revealBytes), clientCtx.GetFromAddress()) + err = msg.ValidateBasic() + if err != nil { + return err + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} diff --git a/x/auction/client/testutil/cli_test.go b/x/auction/client/testutil/cli_test.go new file mode 100644 index 00000000..6b027215 --- /dev/null +++ b/x/auction/client/testutil/cli_test.go @@ -0,0 +1,16 @@ +package testutil + +import ( + "testing" + + "github.com/stretchr/testify/suite" + + "github.com/tharsis/ethermint/testutil/network" +) + +func TestIntegrationTestSuite(t *testing.T) { + cfg := network.DefaultConfig() + cfg.NumValidators = 1 + + suite.Run(t, NewIntegrationTestSuite(cfg)) +} diff --git a/x/auction/client/testutil/common.go b/x/auction/client/testutil/common.go new file mode 100644 index 00000000..b937d66c --- /dev/null +++ b/x/auction/client/testutil/common.go @@ -0,0 +1,80 @@ +package testutil + +import ( + "fmt" + + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/crypto/keyring" + sdk "github.com/cosmos/cosmos-sdk/types" + banktestutil "github.com/cosmos/cosmos-sdk/x/bank/client/testutil" + "github.com/stretchr/testify/suite" + tmcli "github.com/tendermint/tendermint/libs/cli" + "github.com/tharsis/ethermint/crypto/hd" + "github.com/tharsis/ethermint/testutil/network" +) + +type IntegrationTestSuite struct { + suite.Suite + + cfg network.Config + network *network.Network + defaultAuctionID string +} + +var ( + ownerAccount = "owner" + bidderAccount = "bidder" + ownerAddress string + bidderAddress string +) + +func NewIntegrationTestSuite(cfg network.Config) *IntegrationTestSuite { + return &IntegrationTestSuite{cfg: cfg} +} + +func (s *IntegrationTestSuite) SetupSuite() { + s.T().Log("setting up integration test suite") + + var err error + s.network, err = network.New(s.T(), s.T().TempDir(), s.cfg) + s.Require().NoError(err) + + _, err = s.network.WaitForHeight(1) + s.Require().NoError(err) + + // setting up random owner and bidder accounts + s.createAccountWithBalance(ownerAccount, &ownerAddress) + s.createAccountWithBalance(bidderAccount, &bidderAddress) + + s.defaultAuctionID = s.createAuctionAndBid(true, false) +} + +func (s *IntegrationTestSuite) TearDownSuite() { + s.T().Log("tearing down integration test suite") + s.network.Cleanup() +} + +func (s *IntegrationTestSuite) createAccountWithBalance(accountName string, accountAddress *string) { + val := s.network.Validators[0] + sr := s.Require() + + info, _, err := val.ClientCtx.Keyring.NewMnemonic(accountName, keyring.English, sdk.FullFundraiserPath, keyring.DefaultBIP39Passphrase, hd.EthSecp256k1) + sr.NoError(err) + + val.ClientCtx.Keyring.SavePubKey(accountName, info.GetPubKey(), hd.EthSecp256k1Type) + + newAddr := sdk.AccAddress(info.GetPubKey().Address()) + _, err = banktestutil.MsgSendExec( + val.ClientCtx, + val.Address, + newAddr, + sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(200000))), + fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), + ) + sr.NoError(err) + *accountAddress = newAddr.String() +} diff --git a/x/auction/client/testutil/grpc.go b/x/auction/client/testutil/grpc.go new file mode 100644 index 00000000..03037a7c --- /dev/null +++ b/x/auction/client/testutil/grpc.go @@ -0,0 +1,255 @@ +package testutil + +import ( + "fmt" + + "github.com/cosmos/cosmos-sdk/types/rest" + auctiontypes "github.com/tharsis/ethermint/x/auction/types" +) + +const ( + randomAuctionID = "randomAuctionID" + randomBidderAddress = "randomBidderAddress" + randomOwnerAddress = "randomOwnerAddress" +) + +func (suite *IntegrationTestSuite) TestGetAllAuctionsGrpc() { + val := suite.network.Validators[0] + sr := suite.Require() + reqUrl := fmt.Sprintf("%s/vulcanize/auction/v1beta1/auctions", val.APIAddress) + + testCases := []struct { + msg string + url string + errorMsg string + isErrorExpected bool + }{ + { + "invalid request to get all auctions", + reqUrl + randomAuctionID, + "", + true, + }, + { + "valid request to get all auctions", + reqUrl, + "", + false, + }, + } + for _, tc := range testCases { + suite.Run(tc.msg, func() { + resp, err := rest.GetRequest(tc.url) + if tc.isErrorExpected { + sr.Contains(string(resp), tc.errorMsg) + } else { + sr.NoError(err) + var auctions auctiontypes.AuctionsResponse + err = val.ClientCtx.Codec.UnmarshalJSON(resp, &auctions) + sr.NotZero(len(auctions.Auctions.Auctions)) + } + }) + } +} + +func (suite *IntegrationTestSuite) TestQueryParamsGrpc() { + val := suite.network.Validators[0] + sr := suite.Require() + reqUrl := fmt.Sprintf("%s/vulcanize/auction/v1beta1/params", val.APIAddress) + + suite.Run("valid request to get auction params", func() { + resp, err := rest.GetRequest(reqUrl) + suite.Require().NoError(err) + + var params auctiontypes.QueryParamsResponse + err = val.ClientCtx.Codec.UnmarshalJSON(resp, ¶ms) + + sr.NoError(err) + sr.Equal(*params.GetParams(), auctiontypes.DefaultParams()) + }) +} + +func (suite *IntegrationTestSuite) TestGetAuctionGrpc() { + val := suite.network.Validators[0] + sr := suite.Require() + reqUrl := fmt.Sprintf("%s/vulcanize/auction/v1beta1/auctions/", val.APIAddress) + + testCases := []struct { + msg string + url string + errorMsg string + isErrorExpected bool + preRun func() string + }{ + { + "invalid request to get an auction", + reqUrl + randomAuctionID, + "", + true, + func() string { return "" }, + }, + { + "valid request to get an auction", + reqUrl, + "", + false, + func() string { return suite.defaultAuctionID }, + }, + } + for _, tc := range testCases { + suite.Run(tc.msg, func() { + auctionID := tc.preRun() + resp, err := rest.GetRequest(tc.url + auctionID) + if tc.isErrorExpected { + sr.Contains(string(resp), tc.errorMsg) + } else { + sr.NoError(err) + var auction auctiontypes.AuctionResponse + err = val.ClientCtx.Codec.UnmarshalJSON(resp, &auction) + sr.NoError(err) + sr.Equal(auctionID, auction.Auction.Id) + } + }) + } +} + +func (suite *IntegrationTestSuite) TestGetBidsGrpc() { + val := suite.network.Validators[0] + sr := suite.Require() + reqUrl := fmt.Sprintf("%s/vulcanize/auction/v1beta1/bids/", val.APIAddress) + testCases := []struct { + msg string + url string + errorMsg string + isErrorExpected bool + preRun func() string + }{ + { + "invalid request to get all bids", + reqUrl, + "", + true, + func() string { return "" }, + }, + { + "valid request to get all bids", + reqUrl, + "", + false, + func() string { return suite.createAuctionAndBid(false, true) }, + }, + } + + for _, tc := range testCases { + suite.Run(tc.msg, func() { + auctionID := tc.preRun() + tc.url += auctionID + resp, err := rest.GetRequest(tc.url) + if tc.isErrorExpected { + sr.Contains(string(resp), tc.errorMsg) + } else { + sr.NoError(err) + var bids auctiontypes.BidsResponse + err = val.ClientCtx.Codec.UnmarshalJSON(resp, &bids) + sr.NoError(err) + sr.Equal(auctionID, bids.Bids[0].AuctionId) + } + }) + } +} + +func (suite *IntegrationTestSuite) TestGetBidGrpc() { + val := suite.network.Validators[0] + sr := suite.Require() + reqUrl := fmt.Sprintf("%s/vulcanize/auction/v1beta1/bids/", val.APIAddress) + testCases := []struct { + msg string + url string + errorMsg string + isErrorExpected bool + }{ + { + "invalid request to get bid", + fmt.Sprintf("%s/%s/", reqUrl, randomAuctionID), + "", + true, + }, + { + "valid request to get bid", + fmt.Sprintf("%s/%s/%s", reqUrl, randomAuctionID, randomBidderAddress), + "", + false, + }, + } + for _, tc := range testCases { + suite.Run(tc.msg, func() { + resp, err := rest.GetRequest(tc.url) + if tc.isErrorExpected { + sr.Contains(string(resp), tc.errorMsg) + } else { + sr.NoError(err) + var bid auctiontypes.BidResponse + err = val.ClientCtx.Codec.UnmarshalJSON(resp, &bid) + sr.NoError(err) + } + }) + } +} + +func (suite *IntegrationTestSuite) TestGetAuctionsByOwnerGrpc() { + val := suite.network.Validators[0] + sr := suite.Require() + reqUrl := fmt.Sprintf("%s/vulcanize/auction/v1beta1/by-owner/", val.APIAddress) + testCases := []struct { + msg string + url string + errorMsg string + isErrorExpected bool + }{ + { + "invalid request to get auctions by owner", + reqUrl, + "", + true, + }, + { + "valid request to get auctions by owner", + fmt.Sprintf("%s/%s", reqUrl, randomOwnerAddress), + "", + false, + }, + } + for _, tc := range testCases { + suite.Run(tc.msg, func() { + resp, err := rest.GetRequest(tc.url) + if tc.isErrorExpected { + sr.Contains(string(resp), tc.errorMsg) + } else { + sr.NoError(err) + var auctions auctiontypes.AuctionsResponse + err = val.ClientCtx.Codec.UnmarshalJSON(resp, &auctions) + sr.NoError(err) + } + }) + } +} + +func (suite *IntegrationTestSuite) TestQueryBalanceGrpc() { + val := suite.network.Validators[0] + sr := suite.Require() + reqUrl := fmt.Sprintf("%s/vulcanize/auction/v1beta1/balance", val.APIAddress) + msg := "valid request to get the auction module balance" + + suite.createAuctionAndBid(false, true) + + suite.Run(msg, func() { + resp, err := rest.GetRequest(reqUrl) + sr.NoError(err) + + var response auctiontypes.BalanceResponse + err = val.ClientCtx.Codec.UnmarshalJSON(resp, &response) + + sr.NoError(err) + sr.NotZero(len(response.GetBalance())) + }) +} diff --git a/x/auction/client/testutil/query.go b/x/auction/client/testutil/query.go new file mode 100644 index 00000000..e0ff2495 --- /dev/null +++ b/x/auction/client/testutil/query.go @@ -0,0 +1,311 @@ +package testutil + +import ( + "fmt" + + clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" + tmcli "github.com/tendermint/tendermint/libs/cli" + "github.com/tharsis/ethermint/x/auction/client/cli" + "github.com/tharsis/ethermint/x/auction/types" +) + +var queryJSONFlag = []string{fmt.Sprintf("--%s=json", tmcli.OutputFlag)} + +func (suite *IntegrationTestSuite) TestGetCmdQueryParams() { + val := suite.network.Validators[0] + sr := suite.Require() + + suite.Run(fmt.Sprintf("Case %s", "fetch query params"), func() { + out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cli.GetCmdQueryParams(), queryJSONFlag) + sr.NoError(err) + var params types.QueryParamsResponse + err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), ¶ms) + sr.NoError(err) + sr.Equal(types.DefaultParams(), *params.Params) + }) +} + +func (suite *IntegrationTestSuite) TestGetCmdBalance() { + val := suite.network.Validators[0] + sr := suite.Require() + + testCases := []struct { + msg string + createAuctionAndBid bool + }{ + { + "fetch module balance without creating auction and bid", + false, + }, + { + "fetch module balance with valid auction and bid", + true, + }, + } + + for _, test := range testCases { + suite.Run(fmt.Sprintf("Case %s", test.msg), func() { + if test.createAuctionAndBid { + suite.createAuctionAndBid(false, true) + } + + out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cli.GetCmdBalance(), queryJSONFlag) + sr.NoError(err) + var balance types.BalanceResponse + err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &balance) + sr.NoError(err) + if test.createAuctionAndBid { + sr.NotZero(len(balance.Balance)) + } + }) + } +} + +func (suite *IntegrationTestSuite) TestGetCmdList() { + val := suite.network.Validators[0] + sr := suite.Require() + + testCases := []struct { + msg string + createAuction bool + }{ + { + "list auctions when no auctions exist", + false, + }, + { + "list auctions after creating an auction", + true, + }, + } + + for _, test := range testCases { + suite.Run(fmt.Sprintf("Case %s", test.msg), func() { + out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cli.GetCmdList(), queryJSONFlag) + sr.NoError(err) + var auctions types.AuctionsResponse + err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &auctions) + sr.NoError(err) + if test.createAuction { + sr.NotZero(len(auctions.Auctions.Auctions)) + } + }) + } +} + +func (suite *IntegrationTestSuite) TestGetCmdGetBid() { + val := suite.network.Validators[0] + sr := suite.Require() + + testCases := []struct { + msg string + args []string + createAuctionAndBid bool + }{ + { + "get bid without creating auction", + []string{}, + false, + }, + { + "get bid after creating auction and bid", + []string{}, + true, + }, + } + + for _, test := range testCases { + suite.Run(fmt.Sprintf("Case %s", test.msg), func() { + if test.createAuctionAndBid { + auctionID := suite.createAuctionAndBid(false, true) + test.args = append(test.args, auctionID) + getBidsArgs := []string{auctionID, queryJSONFlag[0]} + out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cli.GetCmdGetBids(), getBidsArgs) + sr.NoError(err) + var bids types.BidsResponse + err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &bids) + sr.NoError(err) + test.args = append(test.args, bids.GetBids()[0].BidderAddress) + } + + test.args = append(test.args, queryJSONFlag...) + out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cli.GetCmdGetBid(), test.args) + if test.createAuctionAndBid { + sr.NoError(err) + var bid types.BidResponse + err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &bid) + sr.NoError(err) + sr.NotNil(bid.GetBid()) + } else { + sr.Error(err) + } + }) + } +} + +func (suite *IntegrationTestSuite) TestGetCmdGetBids() { + val := suite.network.Validators[0] + sr := suite.Require() + + testCases := []struct { + msg string + args []string + createAuctionAndBid bool + }{ + { + "get bids without creating auction", + []string{}, + false, + }, + { + "get bids after creating auction and bid", + []string{}, + true, + }, + } + + for _, test := range testCases { + suite.Run(fmt.Sprintf("Case %s", test.msg), func() { + if test.createAuctionAndBid { + auctionID := suite.createAuctionAndBid(false, true) + test.args = append(test.args, auctionID) + } + + test.args = append(test.args, queryJSONFlag...) + out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cli.GetCmdGetBids(), test.args) + if test.createAuctionAndBid { + sr.NoError(err) + var bids types.BidsResponse + err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &bids) + sr.NoError(err) + sr.NotZero(len(bids.Bids)) + } else { + sr.Error(err) + } + }) + } +} + +func (suite *IntegrationTestSuite) TestGetCmdGetAuction() { + val := suite.network.Validators[0] + sr := suite.Require() + + testCases := []struct { + msg string + auctionID string + createAuction bool + }{ + { + "get auction with empty auction ID", + "", + false, + }, + { + "get auction with valid auction ID", + "", + true, + }, + } + + for _, test := range testCases { + suite.Run(fmt.Sprintf("Case %s", test.msg), func() { + if test.createAuction { + test.auctionID = suite.defaultAuctionID + } + + args := []string{test.auctionID, queryJSONFlag[0]} + out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cli.GetCmdGetAuction(), args) + if test.createAuction { + sr.NoError(err) + var auction types.AuctionResponse + err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &auction) + sr.NoError(err) + sr.NotNil(auction.GetAuction()) + sr.Equal(test.auctionID, auction.GetAuction().Id) + } else { + sr.Error(err) + } + }) + } +} + +func (suite *IntegrationTestSuite) TestGetCmdAuctionsByBidder() { + val := suite.network.Validators[0] + sr := suite.Require() + + testCases := []struct { + msg string + createAuctionAndBid bool + bidderAddress string + }{ + { + "get auctions by bidder without creating auctions", + false, + "", + }, + { + "get auctions by bidder for valid bidder address", + true, + "", + }, + } + + for _, test := range testCases { + suite.Run(fmt.Sprintf("Case %s", test.msg), func() { + if test.createAuctionAndBid { + auctionID := suite.createAuctionAndBid(false, true) + args := []string{auctionID, queryJSONFlag[0]} + out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cli.GetCmdGetBids(), args) + sr.NoError(err) + var bids types.BidsResponse + err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &bids) + sr.NoError(err) + test.bidderAddress = bids.Bids[0].BidderAddress + } + + getByBidderArgs := []string{test.bidderAddress, queryJSONFlag[0]} + _, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cli.GetCmdAuctionsByBidder(), getByBidderArgs) + if test.createAuctionAndBid { + sr.NoError(err) + } else { + sr.Error(err) + } + }) + } +} + +func (suite IntegrationTestSuite) createAuctionAndBid(createAuction, createBid bool) string { + val := suite.network.Validators[0] + sr := suite.Require() + auctionID := "" + + if createAuction { + auctionArgs := []string{ + sampleCommitTime, sampleRevealTime, + fmt.Sprintf("10%s", suite.cfg.BondDenom), + fmt.Sprintf("10%s", suite.cfg.BondDenom), + fmt.Sprintf("100%s", suite.cfg.BondDenom), + } + + resp, err := suite.executeTx(cli.GetCmdCreateAuction(), auctionArgs, ownerAccount) + sr.NoError(err) + sr.Zero(resp.Code) + out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cli.GetCmdList(), queryJSONFlag) + sr.NoError(err) + var queryResponse types.AuctionsResponse + err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &queryResponse) + sr.NoError(err) + auctionID = queryResponse.Auctions.Auctions[0].Id + } else { + auctionID = suite.defaultAuctionID + } + + if createBid { + bidArgs := []string{auctionID, fmt.Sprintf("200%s", suite.cfg.BondDenom)} + resp, err := suite.executeTx(cli.GetCmdCommitBid(), bidArgs, bidderAccount) + sr.NoError(err) + sr.Zero(resp.Code) + } + + return auctionID +} diff --git a/x/auction/client/testutil/tx.go b/x/auction/client/testutil/tx.go new file mode 100644 index 00000000..21f08554 --- /dev/null +++ b/x/auction/client/testutil/tx.go @@ -0,0 +1,141 @@ +package testutil + +import ( + "fmt" + + "github.com/cosmos/cosmos-sdk/client/flags" + clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/spf13/cobra" + tmcli "github.com/tendermint/tendermint/libs/cli" + "github.com/tharsis/ethermint/x/auction/client/cli" + "github.com/tharsis/ethermint/x/auction/types" +) + +const ( + sampleCommitTime = "90s" + sampleRevealTime = "5s" + placeholderAuctionID = "placeholder_auction_id" +) + +func (suite *IntegrationTestSuite) TestTxCreateAuction() { + sr := suite.Require() + testCases := []struct { + msg string + args []string + expectErr bool + }{ + { + "create auction with missing arguments", + []string{sampleCommitTime, sampleRevealTime}, + true, + }, + { + "create auction with proper arguments", + []string{ + sampleCommitTime, sampleRevealTime, + fmt.Sprintf("10%s", suite.cfg.BondDenom), + fmt.Sprintf("10%s", suite.cfg.BondDenom), + fmt.Sprintf("100%s", suite.cfg.BondDenom), + }, + false, + }, + } + + for _, test := range testCases { + suite.Run(fmt.Sprintf("Case %s", test.msg), func() { + resp, err := suite.executeTx(cli.GetCmdCreateAuction(), test.args, ownerAccount) + if test.expectErr { + sr.Error(err) + } else { + sr.NoError(err) + sr.Zero(resp.Code) + } + }) + } +} + +func (suite *IntegrationTestSuite) TestTxCommitBid() { + val := suite.network.Validators[0] + sr := suite.Require() + testCases := []struct { + msg string + args []string + createAuction bool + }{ + { + "commit bid with missing args", + []string{fmt.Sprintf("200%s", suite.cfg.BondDenom)}, + false, + }, + { + "commit bid with valid args", + []string{ + placeholderAuctionID, + fmt.Sprintf("200%s", suite.cfg.BondDenom), + }, + true, + }, + } + + for _, test := range testCases { + suite.Run(fmt.Sprintf("Case %s", test.msg), func() { + if test.createAuction { + auctionArgs := []string{ + sampleCommitTime, sampleRevealTime, + fmt.Sprintf("10%s", suite.cfg.BondDenom), + fmt.Sprintf("10%s", suite.cfg.BondDenom), + fmt.Sprintf("100%s", suite.cfg.BondDenom), + } + _, err := suite.executeTx(cli.GetCmdCreateAuction(), auctionArgs, ownerAccount) + sr.NoError(err) + + out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cli.GetCmdList(), + []string{fmt.Sprintf("--%s=json", tmcli.OutputFlag)}) + sr.NoError(err) + var queryResponse types.AuctionsResponse + err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &queryResponse) + sr.NoError(err) + sr.NotNil(queryResponse.GetAuctions()) + test.args[0] = queryResponse.GetAuctions().Auctions[0].Id + } + + resp, err := suite.executeTx(cli.GetCmdCommitBid(), test.args, bidderAccount) + if test.createAuction { + sr.NoError(err) + sr.Zero(resp.Code) + } else { + sr.Error(err) + } + }) + } +} + +func (suite *IntegrationTestSuite) executeTx(cmd *cobra.Command, args []string, caller string) (sdk.TxResponse, error) { + val := suite.network.Validators[0] + additionalArgs := []string{ + fmt.Sprintf("--%s=%s", flags.FlagFrom, caller), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", suite.cfg.BondDenom)), + } + args = append(args, additionalArgs...) + + out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cmd, args) + if err != nil { + return sdk.TxResponse{}, err + } + + var resp sdk.TxResponse + err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &resp) + if err != nil { + return sdk.TxResponse{}, err + } + + err = suite.network.WaitForNextBlock() + if err != nil { + return sdk.TxResponse{}, err + } + + return resp, nil +} diff --git a/x/auction/genesis.go b/x/auction/genesis.go new file mode 100644 index 00000000..a413a1c7 --- /dev/null +++ b/x/auction/genesis.go @@ -0,0 +1,44 @@ +package auction + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + abci "github.com/tendermint/tendermint/abci/types" + + "github.com/tharsis/ethermint/x/auction/keeper" + "github.com/tharsis/ethermint/x/auction/types" +) + +// func NewGenesisState(params types.Params, auctions []types.Auction) types.GenesisState { +// return types.GenesisState{Params: params, Auctions: &types.Auctions{Auctions: auctions}} +// } + +func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, data types.GenesisState) []abci.ValidatorUpdate { + keeper.SetParams(ctx, data.Params) + + for _, auction := range data.Auctions { + keeper.SaveAuction(ctx, auction) + } + + return []abci.ValidatorUpdate{} +} + +func ExportGenesis(ctx sdk.Context, keeper keeper.Keeper) types.GenesisState { + params := keeper.GetParams(ctx) + auctions := keeper.ListAuctions(ctx) + + var genesisAuctions []*types.Auction + for _, auction := range auctions { + genesisAuctions = append(genesisAuctions, &auction) + } + return types.GenesisState{Params: params, Auctions: genesisAuctions} +} + +func ValidateGenesis(data types.GenesisState) error { + err := data.Params.Validate() + if err != nil { + return err + } + + return nil +} diff --git a/x/auction/keeper/grpc_query.go b/x/auction/keeper/grpc_query.go new file mode 100644 index 00000000..4cd7370b --- /dev/null +++ b/x/auction/keeper/grpc_query.go @@ -0,0 +1,91 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + + "github.com/tharsis/ethermint/x/auction/types" +) + +type Querier struct { + Keeper +} + +var _ types.QueryServer = Querier{} + +// Auctions queries all auctions +func (q Querier) Auctions(c context.Context, req *types.AuctionsRequest) (*types.AuctionsResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + resp := q.Keeper.ListAuctions(ctx) + return &types.AuctionsResponse{Auctions: &types.Auctions{Auctions: resp}}, nil +} + +// GetAuction queries an auction +func (q Querier) GetAuction(c context.Context, req *types.AuctionRequest) (*types.AuctionResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + if req.Id == "" { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "auction ID is required") + } + + resp := q.Keeper.GetAuction(ctx, req.Id) + return &types.AuctionResponse{Auction: resp}, nil +} + +// GetBid queries and auction bid +func (q Querier) GetBid(c context.Context, req *types.BidRequest) (*types.BidResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + if req.AuctionId == "" { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "auction ID is required") + } + if req.Bidder == "" { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "bidder address is required") + } + resp := q.Keeper.GetBid(ctx, req.AuctionId, req.Bidder) + return &types.BidResponse{Bid: &resp}, nil +} + +// GetBids queries all auction bids +func (q Querier) GetBids(c context.Context, req *types.BidsRequest) (*types.BidsResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + if req.AuctionId == "" { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "auction ID is required") + } + resp := q.Keeper.GetBids(ctx, req.AuctionId) + return &types.BidsResponse{Bids: resp}, nil +} + +// AuctionsByBidder queries auctions by bidder +func (q Querier) AuctionsByBidder(c context.Context, req *types.AuctionsByBidderRequest) (*types.AuctionsByBidderResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + if req.BidderAddress == "" { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "bidder address is required") + } + resp := q.Keeper.QueryAuctionsByBidder(ctx, req.BidderAddress) + return &types.AuctionsByBidderResponse{Auctions: &types.Auctions{Auctions: resp}}, nil +} + +// AuctionsByOwner queries auctions by owner +func (q Querier) AuctionsByOwner(c context.Context, req *types.AuctionsByOwnerRequest) (*types.AuctionsByOwnerResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + if req.OwnerAddress == "" { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "owner address is required") + } + resp := q.Keeper.QueryAuctionsByOwner(ctx, req.OwnerAddress) + return &types.AuctionsByOwnerResponse{Auctions: &types.Auctions{Auctions: resp}}, nil +} + +// QueryParams implements the params query command +func (q Querier) QueryParams(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + resp := q.Keeper.GetParams(ctx) + return &types.QueryParamsResponse{Params: &resp}, nil +} + +// Balance queries the auction module account balance +func (q Querier) Balance(c context.Context, req *types.BalanceRequest) (*types.BalanceResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + resp := q.Keeper.GetAuctionModuleBalances(ctx) + return &types.BalanceResponse{Balance: resp}, nil +} diff --git a/x/auction/keeper/grpc_query_test.go b/x/auction/keeper/grpc_query_test.go new file mode 100644 index 00000000..dd3440e3 --- /dev/null +++ b/x/auction/keeper/grpc_query_test.go @@ -0,0 +1,355 @@ +package keeper_test + +import ( + "context" + "fmt" + + "github.com/cosmos/cosmos-sdk/simapp" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/tharsis/ethermint/app" + "github.com/tharsis/ethermint/x/auction/types" +) + +const testCommitHash = "71D8CF34026E32A3A34C2C2D4ADF25ABC8D7943A4619761BE27F196603D91B9D" + +func (suite *KeeperTestSuite) TestGrpcGetAllAuctions() { + client, ctx, k := suite.queryClient, suite.ctx, suite.app.AuctionKeeper + + testCases := []struct { + msg string + req *types.AuctionsRequest + createAuctions bool + auctionCount int + }{ + { + "fetch auctions when no auctions exist", + &types.AuctionsRequest{}, + false, + 0, + }, + + { + "fetch auctions with one auction created", + &types.AuctionsRequest{}, + true, + 1, + }, + } + + for _, test := range testCases { + suite.Run(fmt.Sprintf("Case %s", test.msg), func() { + if test.createAuctions { + account := app.CreateRandomAccounts(1)[0] + err := simapp.FundAccount(suite.app.BankKeeper, ctx, account, sdk.NewCoins( + sdk.Coin{Amount: sdk.NewInt(100), Denom: sdk.DefaultBondDenom}, + )) + + _, err = k.CreateAuction(ctx, types.NewMsgCreateAuction(k.GetParams(ctx), account)) + suite.Require().NoError(err) + } + + resp, _ := client.Auctions(context.Background(), test.req) + suite.Require().Equal(test.auctionCount, len(resp.GetAuctions().Auctions)) + }) + } +} + +func (suite *KeeperTestSuite) TestGrpcQueryParams() { + testCases := []struct { + msg string + req *types.QueryParamsRequest + }{ + { + "fetch params", + &types.QueryParamsRequest{}, + }, + } + for _, test := range testCases { + suite.Run(fmt.Sprintf("Case %s", test.msg), func() { + resp, err := suite.queryClient.QueryParams(context.Background(), test.req) + suite.Require().Nil(err) + suite.Require().Equal(*(resp.Params), types.DefaultParams()) + }) + } +} + +func (suite *KeeperTestSuite) TestGrpcGetAuction() { + testCases := []struct { + msg string + req *types.AuctionRequest + createAuction bool + }{ + { + "fetch auction with empty auction ID", + &types.AuctionRequest{}, + false, + }, + { + "fetch auction with valid auction ID", + &types.AuctionRequest{}, + true, + }, + } + + for _, test := range testCases { + suite.Run(fmt.Sprintf("Case %s", test.msg), func() { + if test.createAuction { + auction, _, err := suite.createAuctionAndCommitBid(false) + suite.Require().NoError(err) + test.req.Id = auction.Id + } + + resp, err := suite.queryClient.GetAuction(context.Background(), test.req) + if test.createAuction { + suite.Require().Nil(err) + suite.Require().NotNil(resp.GetAuction()) + suite.Require().Equal(test.req.Id, resp.GetAuction().Id) + } else { + suite.Require().NotNil(err) + suite.Require().Error(err) + } + }) + } +} + +func (suite *KeeperTestSuite) TestGrpcGetBids() { + testCases := []struct { + msg string + req *types.BidsRequest + createAuction bool + commitBid bool + bidCount int + }{ + { + "fetch all bids when no auction exists", + &types.BidsRequest{}, + false, + false, + 0, + }, + { + "fetch all bids for valid auction but no added bids", + &types.BidsRequest{}, + true, + false, + 0, + }, + { + "fetch all bids for valid auction and valid bid", + &types.BidsRequest{}, + true, + true, + 1, + }, + } + + for _, test := range testCases { + suite.Run(fmt.Sprintf("Case %s", test.msg), func() { + if test.createAuction { + auction, _, err := suite.createAuctionAndCommitBid(test.commitBid) + suite.Require().NoError(err) + test.req.AuctionId = auction.Id + } + + resp, err := suite.queryClient.GetBids(context.Background(), test.req) + if test.createAuction { + suite.Require().Nil(err) + suite.Require().Equal(test.bidCount, len(resp.GetBids())) + } else { + suite.Require().NotNil(err) + suite.Require().Error(err) + } + }) + } +} + +func (suite *KeeperTestSuite) TestGrpcGetBid() { + testCases := []struct { + msg string + req *types.BidRequest + createAuctionAndBid bool + }{ + { + "fetch bid when bid does not exist", + &types.BidRequest{}, + false, + }, + { + "fetch bid when valid bid exists", + &types.BidRequest{}, + true, + }, + } + + for _, test := range testCases { + suite.Run(fmt.Sprintf("Case %s", test.msg), func() { + if test.createAuctionAndBid { + auction, bid, err := suite.createAuctionAndCommitBid(test.createAuctionAndBid) + suite.Require().NoError(err) + test.req.AuctionId = auction.Id + test.req.Bidder = bid.BidderAddress + } + + resp, err := suite.queryClient.GetBid(context.Background(), test.req) + if test.createAuctionAndBid { + suite.Require().NoError(err) + suite.Require().NotNil(resp.Bid) + suite.Require().Equal(test.req.Bidder, resp.Bid.BidderAddress) + } else { + suite.Require().NotNil(err) + suite.Require().Error(err) + } + }) + } +} + +func (suite *KeeperTestSuite) TestGrpcGetAuctionsByBidder() { + testCases := []struct { + msg string + req *types.AuctionsByBidderRequest + createAuctionAndCommitBid bool + auctionCount int + }{ + { + "get auctions by bidder with invalid bidder address", + &types.AuctionsByBidderRequest{}, + false, + 0, + }, + { + "get auctions by bidder with valid auction and bid", + &types.AuctionsByBidderRequest{}, + true, + 1, + }, + } + + for _, test := range testCases { + suite.Run(fmt.Sprintf("Case %s", test.msg), func() { + if test.createAuctionAndCommitBid { + _, bid, err := suite.createAuctionAndCommitBid(test.createAuctionAndCommitBid) + suite.Require().NoError(err) + test.req.BidderAddress = bid.BidderAddress + } + + resp, err := suite.queryClient.AuctionsByBidder(context.Background(), test.req) + if test.createAuctionAndCommitBid { + suite.Require().NoError(err) + suite.Require().NotNil(resp.Auctions) + suite.Require().Equal(test.auctionCount, len(resp.Auctions.Auctions)) + } else { + suite.Require().NotNil(err) + suite.Require().Error(err) + } + }) + } +} + +func (suite *KeeperTestSuite) TestGrpcGetAuctionsByOwner() { + testCases := []struct { + msg string + req *types.AuctionsByOwnerRequest + createAuction bool + auctionCount int + }{ + { + "get auctions by owner with invalid owner address", + &types.AuctionsByOwnerRequest{}, + false, + 0, + }, + { + "get auctions by owner with valid auction", + &types.AuctionsByOwnerRequest{}, + true, + 1, + }, + } + + for _, test := range testCases { + suite.Run(fmt.Sprintf("Case %s", test.msg), func() { + if test.createAuction { + auction, _, err := suite.createAuctionAndCommitBid(false) + suite.Require().NoError(err) + test.req.OwnerAddress = auction.OwnerAddress + } + + resp, err := suite.queryClient.AuctionsByOwner(context.Background(), test.req) + if test.createAuction { + suite.Require().NoError(err) + suite.Require().NotNil(resp.Auctions) + suite.Require().Equal(test.auctionCount, len(resp.Auctions.Auctions)) + } else { + suite.Require().NotNil(err) + suite.Require().Error(err) + } + }) + } +} + +func (suite KeeperTestSuite) TestGrpcQueryBalance() { + testCases := []struct { + msg string + req *types.BalanceRequest + createAuction bool + auctionCount int + }{ + { + "get balance with no auctions created", + &types.BalanceRequest{}, + false, + 0, + }, + { + "get balance with single auction created", + &types.BalanceRequest{}, + true, + 1, + }, + } + + for _, test := range testCases { + if test.createAuction { + _, _, err := suite.createAuctionAndCommitBid(true) + suite.Require().NoError(err) + } + + resp, err := suite.queryClient.Balance(context.Background(), test.req) + suite.Require().NoError(err) + suite.Require().Equal(test.auctionCount, len(resp.GetBalance())) + } +} + +func (suite *KeeperTestSuite) createAuctionAndCommitBid(commitBid bool) (*types.Auction, *types.Bid, error) { + ctx, k := suite.ctx, suite.app.AuctionKeeper + accCount := 1 + if commitBid { + accCount++ + } + + accounts := app.CreateRandomAccounts(accCount) + for _, account := range accounts { + err := simapp.FundAccount(suite.app.BankKeeper, ctx, account, sdk.NewCoins( + sdk.Coin{Amount: sdk.NewInt(100), Denom: sdk.DefaultBondDenom}, + )) + if err != nil { + return nil, nil, err + } + } + + auction, err := k.CreateAuction(ctx, types.NewMsgCreateAuction(k.GetParams(ctx), accounts[0])) + if err != nil { + return nil, nil, err + } + + if commitBid { + bid, err := k.CommitBid(ctx, types.NewMsgCommitBid(auction.Id, testCommitHash, accounts[1])) + if err != nil { + return nil, nil, err + } + + return auction, bid, nil + } + + return auction, nil, nil +} diff --git a/x/auction/keeper/invariants.go b/x/auction/keeper/invariants.go new file mode 100644 index 00000000..5fc83d1b --- /dev/null +++ b/x/auction/keeper/invariants.go @@ -0,0 +1,37 @@ +package keeper + +import ( + "fmt" + + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/tharsis/ethermint/x/auction/types" +) + +// RegisterInvariants registers all auction module invariants. +func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper) { + ir.RegisterRoute(types.ModuleName, "module-account", ModuleAccountInvariant(k)) +} + +// ModuleAccountInvariant checks that the 'auction' module account balance is non-negative. +func ModuleAccountInvariant(k Keeper) sdk.Invariant { + return func(ctx sdk.Context) (string, bool) { + moduleAddress := k.accountKeeper.GetModuleAddress(types.ModuleName) + if k.bankKeeper.GetAllBalances(ctx, moduleAddress).IsAnyNegative() { + return sdk.FormatInvariant( + types.ModuleName, + "module-account", + fmt.Sprintf("Module account '%s' has negative balance.", types.ModuleName)), + true + } + + return "", false + } +} + +// AllInvariants runs all invariants of the auctions module. +func AllInvariants(k Keeper) sdk.Invariant { + return func(ctx sdk.Context) (string, bool) { + return ModuleAccountInvariant(k)(ctx) + } +} diff --git a/x/auction/keeper/keeper.go b/x/auction/keeper/keeper.go new file mode 100644 index 00000000..97bf8912 --- /dev/null +++ b/x/auction/keeper/keeper.go @@ -0,0 +1,658 @@ +package keeper + +import ( + "encoding/hex" + "encoding/json" + "fmt" + "time" + + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + auth "github.com/cosmos/cosmos-sdk/x/auth/keeper" + bank "github.com/cosmos/cosmos-sdk/x/bank/keeper" + params "github.com/cosmos/cosmos-sdk/x/params/types" + + "github.com/tharsis/ethermint/x/auction/types" + + wnsUtils "github.com/tharsis/ethermint/utils" +) + +// CompletedAuctionDeleteTimeout => Completed auctions are deleted after this timeout (after reveals end time). +const CompletedAuctionDeleteTimeout = time.Hour * 24 + +// PrefixIDToAuctionIndex is the prefix for Id -> Auction index in the KVStore. +// Note: This is the primary index in the system. +// Note: Golang doesn't support const arrays. +var PrefixIDToAuctionIndex = []byte{0x00} + +// prefixOwnerToAuctionsIndex is the prefix for the Owner -> [Auction] index in the KVStore. +var prefixOwnerToAuctionsIndex = []byte{0x01} + +// PrefixAuctionBidsIndex is the prefix for the (auction, bidder) -> Bid index in the KVStore. +var PrefixAuctionBidsIndex = []byte{0x02} + +// PrefixBidderToAuctionsIndex is the prefix for the Bidder -> [Auction] index in the KVStore. +var PrefixBidderToAuctionsIndex = []byte{0x03} + +// Keeper maintains the link to storage and exposes getter/setter methods for the various parts of the state machine +type Keeper struct { + accountKeeper auth.AccountKeeper + bankKeeper bank.Keeper + + // Track auction usage in other cosmos-sdk modules (more like a usage tracker). + usageKeepers []types.AuctionUsageKeeper + + storeKey sdk.StoreKey // Unexposed key to access store from sdk.Context + + cdc codec.BinaryCodec // The wire codec for binary encoding/decoding. + + paramSubspace params.Subspace +} + +// AuctionClientKeeper is the subset of functionality exposed to other modules. +type AuctionClientKeeper interface { + HasAuction(ctx sdk.Context, id string) bool + GetAuction(ctx sdk.Context, id string) types.Auction + MatchAuctions(ctx sdk.Context, matchFn func(*types.Auction) bool) []*types.Auction +} + +// NewKeeper creates new instances of the auction Keeper +func NewKeeper(accountKeeper auth.AccountKeeper, bankKeeper bank.Keeper, storeKey sdk.StoreKey, cdc codec.BinaryCodec, ps params.Subspace) Keeper { + if !ps.HasKeyTable() { + ps = ps.WithKeyTable(types.ParamKeyTable()) + } + + return Keeper{ + accountKeeper: accountKeeper, + bankKeeper: bankKeeper, + storeKey: storeKey, + cdc: cdc, + paramSubspace: ps, + } +} + +func (k *Keeper) SetUsageKeepers(usageKeepers []types.AuctionUsageKeeper) { + k.usageKeepers = usageKeepers +} + +func (k Keeper) GetUsageKeepers() []types.AuctionUsageKeeper { + return k.usageKeepers +} + +// Generates Auction Id -> Auction index key. +func GetAuctionIndexKey(id string) []byte { + return append(PrefixIDToAuctionIndex, []byte(id)...) +} + +// Generates Owner -> Auctions index key. +func GetOwnerToAuctionsIndexKey(owner string, auctionID string) []byte { + return append(append(prefixOwnerToAuctionsIndex, []byte(owner)...), []byte(auctionID)...) +} + +func GetBidderToAuctionsIndexKey(bidder string, auctionID string) []byte { + return append(append(PrefixBidderToAuctionsIndex, []byte(bidder)...), []byte(auctionID)...) +} + +func GetBidIndexKey(auctionID string, bidder string) []byte { + return append(GetAuctionBidsIndexPrefix(auctionID), []byte(bidder)...) +} + +func GetAuctionBidsIndexPrefix(auctionID string) []byte { + return append(append(PrefixAuctionBidsIndex, []byte(auctionID)...)) +} + +// SaveAuction - saves a auction to the store. +func (k Keeper) SaveAuction(ctx sdk.Context, auction *types.Auction) { + store := ctx.KVStore(k.storeKey) + + // Auction Id -> Auction index. + store.Set(GetAuctionIndexKey(auction.Id), k.cdc.MustMarshal(auction)) + + // Owner -> [Auction] index. + store.Set(GetOwnerToAuctionsIndexKey(auction.OwnerAddress, auction.Id), []byte{}) + + // Notify interested parties. + for _, keeper := range k.usageKeepers { + keeper.OnAuction(ctx, auction.Id) + } +} + +func (k Keeper) SaveBid(ctx sdk.Context, bid *types.Bid) { + store := ctx.KVStore(k.storeKey) + store.Set(GetBidIndexKey(bid.AuctionId, bid.BidderAddress), k.cdc.MustMarshal(bid)) + store.Set(GetBidderToAuctionsIndexKey(bid.BidderAddress, bid.AuctionId), []byte{}) + + // Notify interested parties. + for _, keeper := range k.usageKeepers { + keeper.OnAuctionBid(ctx, bid.AuctionId, bid.BidderAddress) + } +} + +func (k Keeper) DeleteBid(ctx sdk.Context, bid types.Bid) { + store := ctx.KVStore(k.storeKey) + store.Delete(GetBidIndexKey(bid.AuctionId, bid.BidderAddress)) + store.Delete(GetOwnerToAuctionsIndexKey(bid.BidderAddress, bid.AuctionId)) +} + +// HasAuction - checks if a auction by the given Id exists. +func (k Keeper) HasAuction(ctx sdk.Context, id string) bool { + store := ctx.KVStore(k.storeKey) + return store.Has(GetAuctionIndexKey(id)) +} + +func (k Keeper) HasBid(ctx sdk.Context, id string, bidder string) bool { + store := ctx.KVStore(k.storeKey) + return store.Has(GetBidIndexKey(id, bidder)) +} + +// DeleteAuction - deletes the auction. +func (k Keeper) DeleteAuction(ctx sdk.Context, auction types.Auction) { + // Delete all bids first. + bids := k.GetBids(ctx, auction.Id) + for _, bid := range bids { + k.DeleteBid(ctx, *bid) + } + + // Delete the auction itself. + store := ctx.KVStore(k.storeKey) + store.Delete(GetAuctionIndexKey(auction.Id)) + store.Delete(GetOwnerToAuctionsIndexKey(auction.OwnerAddress, auction.Id)) +} + +// GetAuction - gets a record from the store. +func (k Keeper) GetAuction(ctx sdk.Context, id string) *types.Auction { + store := ctx.KVStore(k.storeKey) + auctionKey := GetAuctionIndexKey(id) + if !store.Has(auctionKey) { + return nil + } + + bz := store.Get(auctionKey) + var obj types.Auction + k.cdc.MustUnmarshal(bz, &obj) + + return &obj +} + +// GetBids gets the auction bids. +func (k Keeper) GetBids(ctx sdk.Context, id string) []*types.Bid { + store := ctx.KVStore(k.storeKey) + bids := []*types.Bid{} + itr := sdk.KVStorePrefixIterator(store, GetAuctionBidsIndexPrefix(id)) + defer itr.Close() + for ; itr.Valid(); itr.Next() { + bz := store.Get(itr.Key()) + if bz != nil { + var obj types.Bid + k.cdc.MustUnmarshal(bz, &obj) + bids = append(bids, &obj) + } + } + + return bids +} + +func (k Keeper) GetBid(ctx sdk.Context, id string, bidder string) types.Bid { + store := ctx.KVStore(k.storeKey) + + bz := store.Get(GetBidIndexKey(id, bidder)) + var obj types.Bid + k.cdc.MustUnmarshal(bz, &obj) + + return obj +} + +// ListAuctions - get all auctions. +func (k Keeper) ListAuctions(ctx sdk.Context) []types.Auction { + var auctions []types.Auction + + store := ctx.KVStore(k.storeKey) + itr := sdk.KVStorePrefixIterator(store, PrefixIDToAuctionIndex) + defer itr.Close() + for ; itr.Valid(); itr.Next() { + bz := store.Get(itr.Key()) + if bz != nil { + var obj types.Auction + k.cdc.MustUnmarshal(bz, &obj) + auctions = append(auctions, obj) + } + } + + return auctions +} + +// QueryAuctionsByOwner - query auctions by owner. +func (k Keeper) QueryAuctionsByOwner(ctx sdk.Context, ownerAddress string) []types.Auction { + auctions := []types.Auction{} + + ownerPrefix := append(prefixOwnerToAuctionsIndex, []byte(ownerAddress)...) + store := ctx.KVStore(k.storeKey) + itr := sdk.KVStorePrefixIterator(store, ownerPrefix) + defer itr.Close() + for ; itr.Valid(); itr.Next() { + auctionID := itr.Key()[len(ownerPrefix):] + bz := store.Get(append(PrefixIDToAuctionIndex, auctionID...)) + if bz != nil { + var obj types.Auction + k.cdc.MustUnmarshal(bz, &obj) + auctions = append(auctions, obj) + } + } + + return auctions +} + +// QueryAuctionsByBidder - query auctions by bidder +func (k Keeper) QueryAuctionsByBidder(ctx sdk.Context, bidderAddress string) []types.Auction { + auctions := []types.Auction{} + + bidderPrefix := append(PrefixBidderToAuctionsIndex, []byte(bidderAddress)...) + store := ctx.KVStore(k.storeKey) + itr := sdk.KVStorePrefixIterator(store, []byte(bidderPrefix)) + defer itr.Close() + for ; itr.Valid(); itr.Next() { + auctionID := itr.Key()[len(bidderPrefix):] + bz := store.Get(append(PrefixIDToAuctionIndex, auctionID...)) + if bz != nil { + var obj types.Auction + k.cdc.MustUnmarshal(bz, &obj) + auctions = append(auctions, obj) + } + } + + return auctions +} + +// MatchAuctions - get all matching auctions. +func (k Keeper) MatchAuctions(ctx sdk.Context, matchFn func(*types.Auction) bool) []*types.Auction { + var auctions []*types.Auction + + store := ctx.KVStore(k.storeKey) + itr := sdk.KVStorePrefixIterator(store, PrefixIDToAuctionIndex) + defer itr.Close() + for ; itr.Valid(); itr.Next() { + bz := store.Get(itr.Key()) + if bz != nil { + var obj types.Auction + k.cdc.MustUnmarshal(bz, &obj) + if matchFn(&obj) { + auctions = append(auctions, &obj) + } + } + } + + return auctions +} + +// CreateAuction creates a new auction. +func (k Keeper) CreateAuction(ctx sdk.Context, msg types.MsgCreateAuction) (*types.Auction, error) { + // Might be called from another module directly, always validate. + err := msg.ValidateBasic() + if err != nil { + return nil, err + } + + signerAddress, err := sdk.AccAddressFromBech32(msg.Signer) + if err != nil { + return nil, err + } + + // Generate auction Id. + account := k.accountKeeper.GetAccount(ctx, signerAddress) + if account == nil { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "Account not found.") + } + + auctionID := types.AuctionID{ + Address: signerAddress, + AccNum: account.GetAccountNumber(), + Sequence: account.GetSequence(), + }.Generate() + + // Compute timestamps. + now := ctx.BlockTime() + commitsEndTime := now.Add(time.Duration(msg.CommitsDuration)) + revealsEndTime := now.Add(time.Duration(msg.CommitsDuration + msg.RevealsDuration)) + + auction := types.Auction{ + Id: auctionID, + Status: types.AuctionStatusCommitPhase, + OwnerAddress: signerAddress.String(), + CreateTime: now, + CommitsEndTime: commitsEndTime, + RevealsEndTime: revealsEndTime, + CommitFee: msg.CommitFee, + RevealFee: msg.RevealFee, + MinimumBid: msg.MinimumBid, + } + + // Save auction in store. + k.SaveAuction(ctx, &auction) + + return &auction, nil +} + +func (k Keeper) CommitBid(ctx sdk.Context, msg types.MsgCommitBid) (*types.Bid, error) { + if !k.HasAuction(ctx, msg.AuctionId) { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Auction not found.") + } + + auction := k.GetAuction(ctx, msg.AuctionId) + if auction.Status != types.AuctionStatusCommitPhase { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Auction is not in commit phase.") + } + + signerAddress, err := sdk.AccAddressFromBech32(msg.Signer) + if err != nil { + return nil, err + } + + // Take auction fees from account. + totalFee := auction.CommitFee.Add(auction.RevealFee) + sdkErr := k.bankKeeper.SendCoinsFromAccountToModule(ctx, signerAddress, types.ModuleName, sdk.NewCoins(totalFee)) + if sdkErr != nil { + return nil, sdkErr + } + + // Check if an old bid already exists, if so, return old bids auction fee (update bid scenario). + bidder := signerAddress.String() + if k.HasBid(ctx, msg.AuctionId, bidder) { + oldBid := k.GetBid(ctx, msg.AuctionId, bidder) + oldTotalFee := oldBid.CommitFee.Add(oldBid.RevealFee) + sdkErr := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, signerAddress, sdk.NewCoins(oldTotalFee)) + if sdkErr != nil { + return nil, sdkErr + } + } + + // Save new bid. + bid := types.Bid{ + AuctionId: msg.AuctionId, + BidderAddress: bidder, + Status: types.BidStatusCommitted, + CommitHash: msg.CommitHash, + CommitTime: ctx.BlockTime(), + CommitFee: auction.CommitFee, + RevealFee: auction.RevealFee, + } + + k.SaveBid(ctx, &bid) + + return &bid, nil +} + +// RevealBid reeals a bid comitted earlier. +func (k Keeper) RevealBid(ctx sdk.Context, msg types.MsgRevealBid) (*types.Auction, error) { + if !k.HasAuction(ctx, msg.AuctionId) { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Auction not found.") + } + + auction := k.GetAuction(ctx, msg.AuctionId) + if auction.Status != types.AuctionStatusRevealPhase { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Auction is not in reveal phase.") + } + + signerAddress, err := sdk.AccAddressFromBech32(msg.Signer) + if err != nil { + return nil, err + } + + if !k.HasBid(ctx, msg.AuctionId, signerAddress.String()) { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Bid not found.") + } + + bid := k.GetBid(ctx, auction.Id, signerAddress.String()) + if bid.Status != types.BidStatusCommitted { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Bid not in committed state.") + } + + revealBytes, err := hex.DecodeString(msg.Reveal) + if err != nil { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Invalid reveal string.") + } + + cid, err := wnsUtils.CIDFromJSONBytes(revealBytes) + if err != nil { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Invalid reveal JSON.") + } + + if bid.CommitHash != cid { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Commit hash mismatch.") + } + + var reveal map[string]interface{} + err = json.Unmarshal(revealBytes, &reveal) + if err != nil { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Reveal JSON unmarshal error.") + } + + chainID, err := wnsUtils.GetAttributeAsString(reveal, "chainId") + if err != nil || chainID != ctx.ChainID() { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Invalid reveal chainID.") + } + + auctionID, err := wnsUtils.GetAttributeAsString(reveal, "auctionId") + if err != nil || auctionID != msg.AuctionId { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Invalid reveal auction Id.") + } + + bidderAddress, err := wnsUtils.GetAttributeAsString(reveal, "bidderAddress") + if err != nil { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Invalid reveal bid address.") + } + + if bidderAddress != signerAddress.String() { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Reveal bid address mismatch.") + } + + bidAmountStr, err := wnsUtils.GetAttributeAsString(reveal, "bidAmount") + if err != nil { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Invalid reveal bid amount.") + } + + bidAmount, err := sdk.ParseCoinNormalized(bidAmountStr) + if err != nil { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Invalid reveal bid amount.") + } + + if bidAmount.IsLT(auction.MinimumBid) { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Bid is lower than minimum bid.") + } + + // Lock bid amount. + sdkErr := k.bankKeeper.SendCoinsFromAccountToModule(ctx, signerAddress, types.ModuleName, sdk.NewCoins(bidAmount)) + if sdkErr != nil { + return nil, sdkErr + } + + // Update bid. + bid.BidAmount = bidAmount + bid.RevealTime = ctx.BlockTime() + bid.Status = types.BidStatusRevealed + k.SaveBid(ctx, &bid) + + return auction, nil +} + +// GetAuctionModuleBalances gets the auction module account(s) balances. +func (k Keeper) GetAuctionModuleBalances(ctx sdk.Context) sdk.Coins { + moduleAddress := k.accountKeeper.GetModuleAddress(types.ModuleName) + balances := k.bankKeeper.GetAllBalances(ctx, moduleAddress) + return balances +} + +func (k Keeper) EndBlockerProcessAuctions(ctx sdk.Context) { + // Transition auction state (commit, reveal, expired, completed). + k.processAuctionPhases(ctx) + + // Delete stale auctions. + k.deleteCompletedAuctions(ctx) +} + +func (k Keeper) processAuctionPhases(ctx sdk.Context) { + auctions := k.MatchAuctions(ctx, func(_ *types.Auction) bool { + return true + }) + + for _, auction := range auctions { + // Commit -> Reveal state. + if auction.Status == types.AuctionStatusCommitPhase && ctx.BlockTime().After(auction.CommitsEndTime) { + auction.Status = types.AuctionStatusRevealPhase + k.SaveAuction(ctx, auction) + ctx.Logger().Info(fmt.Sprintf("Moved auction %s to reveal phase.", auction.Id)) + } + + // Reveal -> Expired state. + if auction.Status == types.AuctionStatusRevealPhase && ctx.BlockTime().After(auction.RevealsEndTime) { + auction.Status = types.AuctionStatusExpired + k.SaveAuction(ctx, auction) + ctx.Logger().Info(fmt.Sprintf("Moved auction %s to expired state.", auction.Id)) + } + + // If auction has expired, pick a winner from revealed bids. + if auction.Status == types.AuctionStatusExpired { + k.pickAuctionWinner(ctx, auction) + } + } +} + +// Delete completed stale auctions. +func (k Keeper) deleteCompletedAuctions(ctx sdk.Context) { + auctions := k.MatchAuctions(ctx, func(auction *types.Auction) bool { + deleteTime := auction.RevealsEndTime.Add(CompletedAuctionDeleteTimeout) + return auction.Status == types.AuctionStatusCompleted && ctx.BlockTime().After(deleteTime) + }) + + for _, auction := range auctions { + ctx.Logger().Info(fmt.Sprintf("Deleting completed auction %s after timeout.", auction.Id)) + k.DeleteAuction(ctx, *auction) + } +} + +func (k Keeper) pickAuctionWinner(ctx sdk.Context, auction *types.Auction) { + ctx.Logger().Info(fmt.Sprintf("Picking auction %s winner.", auction.Id)) + + var highestBid *types.Bid + var secondHighestBid *types.Bid + + bids := k.GetBids(ctx, auction.Id) + for _, bid := range bids { + ctx.Logger().Info(fmt.Sprintf("Processing bid %s %s", bid.BidderAddress, bid.BidAmount.String())) + + // Only consider revealed bids. + if bid.Status != types.BidStatusRevealed { + ctx.Logger().Info(fmt.Sprintf("Ignoring unrevealed bid %s %s", bid.BidderAddress, bid.BidAmount.String())) + continue + } + + // Init highest bid. + if highestBid == nil { + highestBid = bid + ctx.Logger().Info(fmt.Sprintf("Initializing 1st bid %s %s", bid.BidderAddress, bid.BidAmount.String())) + continue + } + + if highestBid.BidAmount.IsLT(bid.BidAmount) { + ctx.Logger().Info(fmt.Sprintf("New highest bid %s %s", bid.BidderAddress, bid.BidAmount.String())) + + secondHighestBid = highestBid + highestBid = bid + + ctx.Logger().Info(fmt.Sprintf("Updated 1st bid %s %s", highestBid.BidderAddress, highestBid.BidAmount.String())) + ctx.Logger().Info(fmt.Sprintf("Updated 2nd bid %s %s", secondHighestBid.BidderAddress, secondHighestBid.BidAmount.String())) + + } else if secondHighestBid == nil || secondHighestBid.BidAmount.IsLT(bid.BidAmount) { + ctx.Logger().Info(fmt.Sprintf("New 2nd highest bid %s %s", bid.BidderAddress, bid.BidAmount.String())) + + secondHighestBid = bid + ctx.Logger().Info(fmt.Sprintf("Updated 2nd bid %s %s", secondHighestBid.BidderAddress, secondHighestBid.BidAmount.String())) + } else { + ctx.Logger().Info(fmt.Sprintf("Ignoring bid as it doesn't affect 1st/2nd price %s %s", bid.BidderAddress, bid.BidAmount.String())) + } + } + + // Highest bid is the winner, but pays second highest bid price. + auction.Status = types.AuctionStatusCompleted + + if highestBid != nil { + auction.WinnerAddress = highestBid.BidderAddress + auction.WinningBid = highestBid.BidAmount + + // Winner pays 2nd price, if a 2nd price exists. + auction.WinningPrice = highestBid.BidAmount + if secondHighestBid != nil { + auction.WinningPrice = secondHighestBid.BidAmount + } + + ctx.Logger().Info(fmt.Sprintf("Auction %s winner %s.", auction.Id, auction.WinnerAddress)) + ctx.Logger().Info(fmt.Sprintf("Auction %s winner bid %s.", auction.Id, auction.WinningBid.String())) + ctx.Logger().Info(fmt.Sprintf("Auction %s winner price %s.", auction.Id, auction.WinningPrice.String())) + + } else { + ctx.Logger().Info(fmt.Sprintf("Auction %s has no valid revealed bids (no winner).", auction.Id)) + } + + k.SaveAuction(ctx, auction) + + for _, bid := range bids { + bidderAddress, err := sdk.AccAddressFromBech32(bid.BidderAddress) + if err != nil { + ctx.Logger().Error(fmt.Sprintf("Invalid bidderAddress address. %v", err)) + panic("Invalid bidder address.") + } + + if bid.Status == types.BidStatusRevealed { + // Send reveal fee back to bidders that've revealed the bid. + sdkErr := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, bidderAddress, sdk.NewCoins(bid.RevealFee)) + if sdkErr != nil { + ctx.Logger().Error(fmt.Sprintf("Auction error returning reveal fee: %v", sdkErr)) + panic(sdkErr) + } + } + + // Send back locked bid amount to all bidders. + sdkErr := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, bidderAddress, sdk.NewCoins(bid.BidAmount)) + if sdkErr != nil { + ctx.Logger().Error(fmt.Sprintf("Auction error returning bid amount: %v", sdkErr)) + panic(sdkErr) + } + } + + // Process winner account (if nobody bids, there won't be a winner). + if auction.WinnerAddress != "" { + winnerAddress, err := sdk.AccAddressFromBech32(auction.WinnerAddress) + if err != nil { + ctx.Logger().Error(fmt.Sprintf("Invalid winner address. %v", err)) + panic("Invalid winner address.") + } + + // Take 2nd price from winner. + sdkErr := k.bankKeeper.SendCoinsFromAccountToModule(ctx, winnerAddress, types.ModuleName, sdk.NewCoins(auction.WinningPrice)) + if sdkErr != nil { + ctx.Logger().Error(fmt.Sprintf("Auction error taking funds from winner: %v", sdkErr)) + panic(sdkErr) + } + + // Burn anything over the min. bid amount. + amountToBurn := auction.WinningPrice.Sub(auction.MinimumBid) + if amountToBurn.IsNegative() { + ctx.Logger().Error(fmt.Sprintf("Auction coins to burn cannot be negative.")) + panic("Auction coins to burn cannot be negative.") + } + + // Use auction burn module account instead of actually burning coins to better keep track of supply. + sdkErr = k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, types.AuctionBurnModuleAccountName, sdk.NewCoins(amountToBurn)) + if sdkErr != nil { + ctx.Logger().Error(fmt.Sprintf("Auction error burning coins: %v", sdkErr)) + panic(sdkErr) + } + } + + // Notify other modules (hook). + ctx.Logger().Info(fmt.Sprintf("Auction %s notifying %d modules.", auction.Id, len(k.usageKeepers))) + for _, keeper := range k.usageKeepers { + ctx.Logger().Info(fmt.Sprintf("Auction %s notifying module %s.", auction.Id, keeper.ModuleName())) + keeper.OnAuctionWinnerSelected(ctx, auction.Id) + } +} diff --git a/x/auction/keeper/keeper_test.go b/x/auction/keeper/keeper_test.go new file mode 100644 index 00000000..95cda669 --- /dev/null +++ b/x/auction/keeper/keeper_test.go @@ -0,0 +1,56 @@ +package keeper_test + +import ( + "testing" + + "github.com/cosmos/cosmos-sdk/baseapp" + "github.com/cosmos/cosmos-sdk/simapp" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + "github.com/tharsis/ethermint/app" + auctionkeeper "github.com/tharsis/ethermint/x/auction/keeper" + "github.com/tharsis/ethermint/x/auction/types" +) + +type KeeperTestSuite struct { + suite.Suite + app *app.EthermintApp + ctx sdk.Context + queryClient types.QueryClient +} + +func (suite *KeeperTestSuite) SetupTest() { + testApp := app.Setup(false, func(ea *app.EthermintApp, genesis simapp.GenesisState) simapp.GenesisState { + return genesis + }) + ctx := testApp.BaseApp.NewContext(false, tmproto.Header{}) + + querier := auctionkeeper.Querier{Keeper: testApp.AuctionKeeper} + + queryHelper := baseapp.NewQueryServerTestHelper(ctx, testApp.InterfaceRegistry()) + types.RegisterQueryServer(queryHelper, querier) + queryClient := types.NewQueryClient(queryHelper) + + suite.app, suite.ctx, suite.queryClient = testApp, ctx, queryClient +} + +func TestParams(t *testing.T) { + testApp := app.Setup(false, func(ea *app.EthermintApp, genesis simapp.GenesisState) simapp.GenesisState { + return genesis + }) + ctx := testApp.BaseApp.NewContext(false, tmproto.Header{}) + + expParams := types.DefaultParams() + params := testApp.AuctionKeeper.GetParams(ctx) + require.Equal(t, expParams.CommitsDuration, params.CommitsDuration) + require.Equal(t, expParams.RevealsDuration, params.RevealsDuration) + require.Equal(t, expParams.CommitFee, params.CommitFee) + require.Equal(t, expParams.RevealFee, params.RevealFee) + require.Equal(t, expParams.MinimumBid, params.MinimumBid) +} + +func TestKeeperTestSuite(t *testing.T) { + suite.Run(t, new(KeeperTestSuite)) +} diff --git a/x/auction/keeper/msg_server.go b/x/auction/keeper/msg_server.go new file mode 100644 index 00000000..d0c99fbe --- /dev/null +++ b/x/auction/keeper/msg_server.go @@ -0,0 +1,110 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/tharsis/ethermint/x/auction/types" +) + +type msgServer struct { + Keeper +} + +func NewMsgServer(keeper Keeper) types.MsgServer { + return &msgServer{Keeper: keeper} +} + +var _ types.MsgServer = msgServer{} + +func (s msgServer) CreateAuction(c context.Context, msg *types.MsgCreateAuction) (*types.MsgCreateAuctionResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + + signerAddress, err := sdk.AccAddressFromBech32(msg.Signer) + if err != nil { + return nil, err + } + + resp, err := s.Keeper.CreateAuction(ctx, *msg) + if err != nil { + return nil, err + } + + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.EventTypeCreateAuction, + sdk.NewAttribute(types.AttributeKeyCommitsDuration, msg.CommitsDuration.String()), + sdk.NewAttribute(types.AttributeKeyCommitFee, msg.CommitFee.String()), + sdk.NewAttribute(types.AttributeKeyRevealFee, msg.RevealFee.String()), + sdk.NewAttribute(types.AttributeKeyMinimumBid, msg.MinimumBid.String()), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + sdk.NewAttribute(types.AttributeKeySigner, signerAddress.String()), + ), + }) + + return &types.MsgCreateAuctionResponse{Auction: resp}, nil +} + +// CommitBid is the command for committing a bid +func (s msgServer) CommitBid(c context.Context, msg *types.MsgCommitBid) (*types.MsgCommitBidResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + + signerAddress, err := sdk.AccAddressFromBech32(msg.Signer) + if err != nil { + return nil, err + } + + resp, err := s.Keeper.CommitBid(ctx, *msg) + if err != nil { + return nil, err + } + + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.EventTypeCommitBid, + sdk.NewAttribute(types.AttributeKeyAuctionID, msg.AuctionId), + sdk.NewAttribute(types.AttributeKeyCommitHash, msg.CommitHash), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + sdk.NewAttribute(types.AttributeKeySigner, signerAddress.String()), + ), + }) + + return &types.MsgCommitBidResponse{Bid: resp}, nil +} + +//RevealBid is the command for revealing a bid +func (s msgServer) RevealBid(c context.Context, msg *types.MsgRevealBid) (*types.MsgRevealBidResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + + signerAddress, err := sdk.AccAddressFromBech32(msg.Signer) + if err != nil { + return nil, err + } + + resp, err := s.Keeper.RevealBid(ctx, *msg) + if err != nil { + return nil, err + } + + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.EventTypeRevealBid, + sdk.NewAttribute(types.AttributeKeyAuctionID, msg.AuctionId), + sdk.NewAttribute(types.AttributeKeyReveal, msg.Reveal), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + sdk.NewAttribute(types.AttributeKeySigner, signerAddress.String()), + ), + }) + + return &types.MsgRevealBidResponse{Auction: resp}, nil +} diff --git a/x/auction/keeper/params.go b/x/auction/keeper/params.go new file mode 100644 index 00000000..2896f5a2 --- /dev/null +++ b/x/auction/keeper/params.go @@ -0,0 +1,18 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/tharsis/ethermint/x/auction/types" +) + +// GetParams - Get all parameteras as types.Params. +func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { + k.paramSubspace.GetParamSet(ctx, ¶ms) + return +} + +// SetParams - set the params. +func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { + k.paramSubspace.SetParamSet(ctx, ¶ms) +} diff --git a/x/auction/module.go b/x/auction/module.go new file mode 100644 index 00000000..b4d59ddb --- /dev/null +++ b/x/auction/module.go @@ -0,0 +1,142 @@ +package auction + +import ( + "context" + "encoding/json" + "fmt" + + "github.com/gorilla/mux" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/spf13/cobra" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + + abci "github.com/tendermint/tendermint/abci/types" + + "github.com/tharsis/ethermint/x/auction/client/cli" + "github.com/tharsis/ethermint/x/auction/keeper" + "github.com/tharsis/ethermint/x/auction/types" +) + +// type check to ensure the interface is properly implemented +var ( + _ module.AppModule = AppModule{} + _ module.AppModuleBasic = AppModuleBasic{} +) + +// app module Basics object +type AppModuleBasic struct { + cdc codec.Codec +} + +func (b AppModuleBasic) Name() string { + return types.ModuleName +} + +func (b AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + types.RegisterLegacyAminoCodec(cdc) +} + +func (b AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry) { + types.RegisterInterfaces(registry) +} + +func (b AppModuleBasic) DefaultGenesis(jsonCodec codec.JSONCodec) json.RawMessage { + return jsonCodec.MustMarshalJSON(types.DefaultGenesisState()) +} + +// Validation check of the Genesis +func (b AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { + var data types.GenesisState + err := cdc.UnmarshalJSON(bz, &data) + if err != nil { + return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) + } + // Once json successfully marshalled, passes along to genesis.go + return ValidateGenesis(data) +} + +// Register rest routes +func (b AppModuleBasic) RegisterRESTRoutes(ctx client.Context, rtr *mux.Router) { + // No-op. +} + +func (b AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, serveMux *runtime.ServeMux) { + err := types.RegisterQueryHandlerClient(context.Background(), serveMux, types.NewQueryClient(clientCtx)) + if err != nil { + panic(err) + } +} + +// Get the root query command of this module +func (b AppModuleBasic) GetQueryCmd() *cobra.Command { + return cli.GetQueryCmd() +} + +// Get the root tx command of this module +func (b AppModuleBasic) GetTxCmd() *cobra.Command { + return cli.GetTxCmd() +} + +type AppModule struct { + AppModuleBasic + keeper keeper.Keeper +} + +// NewAppModule creates a new AppModule Object +func NewAppModule(cdc codec.Codec, k keeper.Keeper) AppModule { + return AppModule{ + AppModuleBasic: AppModuleBasic{cdc: cdc}, + keeper: k, + } +} + +func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) { + keeper.RegisterInvariants(ir, am.keeper) +} + +func (am AppModule) Route() sdk.Route { + return sdk.Route{} +} + +func (am AppModule) QuerierRoute() string { + return types.QuerierRoute +} + +func (am AppModule) LegacyQuerierHandler(cdc *codec.LegacyAmino) sdk.Querier { + return nil +} + +func (am AppModule) RegisterServices(cfg module.Configurator) { + querier := keeper.Querier{Keeper: am.keeper} + types.RegisterQueryServer(cfg.QueryServer(), querier) + + msgServer := keeper.NewMsgServer(am.keeper) + types.RegisterMsgServer(cfg.MsgServer(), msgServer) +} + +func (am AppModule) ConsensusVersion() uint64 { + return 1 +} + +func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} + +func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { + return EndBlocker(ctx, am.keeper) +} + +func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) []abci.ValidatorUpdate { + var genesisState types.GenesisState + cdc.MustUnmarshalJSON(data, &genesisState) + InitGenesis(ctx, am.keeper, genesisState) + return []abci.ValidatorUpdate{} +} + +func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { + gs := ExportGenesis(ctx, am.keeper) + return cdc.MustMarshalJSON(&gs) +} diff --git a/x/auction/module_test.go b/x/auction/module_test.go new file mode 100644 index 00000000..277d7e4f --- /dev/null +++ b/x/auction/module_test.go @@ -0,0 +1,14 @@ +package auction_test + +// func TestItCreatesModuleAccountOnInitBlock(t *testing.T) { +// app := app2.Setup(false) +// ctx := app.BaseApp.NewContext(false, tmproto.Header{}) + +// app.InitChain(abcitypes.RequestInitChain{ +// AppStateBytes: []byte("{}"), +// ChainId: "test-chain-id", +// }) + +// acc := app.AccountKeeper.GetModuleAccount(ctx, auctiontypes.ModuleName) +// require.NotNil(t, acc) +// } diff --git a/x/auction/types/codec.go b/x/auction/types/codec.go new file mode 100644 index 00000000..9d4e9767 --- /dev/null +++ b/x/auction/types/codec.go @@ -0,0 +1,37 @@ +package types + +import ( + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/types" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/msgservice" +) + +// RegisterLegacyAminoCodec registers the necessary x/auction interfaces and concrete types +// on the provided LegacyAmino codec. These types are used for Amino JSON serialization. +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + cdc.RegisterConcrete(&MsgCreateAuction{}, "auction/MsgCreateAuction", nil) + cdc.RegisterConcrete(&MsgCommitBid{}, "auction/MsgCommitBid", nil) + cdc.RegisterConcrete(&MsgRevealBid{}, "auction/MsgRevealBid", nil) +} + +func RegisterInterfaces(registry types.InterfaceRegistry) { + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgCreateAuction{}, + &MsgCommitBid{}, + &MsgRevealBid{}, + ) + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) +} + +var ( + amino = codec.NewLegacyAmino() + ModuleCdc = codec.NewAminoCodec(amino) +) + +func init() { + RegisterLegacyAminoCodec(amino) + cryptocodec.RegisterCrypto(amino) + amino.Seal() +} diff --git a/x/auction/types/events.go b/x/auction/types/events.go new file mode 100644 index 00000000..caa3fb2e --- /dev/null +++ b/x/auction/types/events.go @@ -0,0 +1,19 @@ +package types + +const ( + EventTypeCreateAuction = "create-auction" + EventTypeCommitBid = "commit-bid" + EventTypeRevealBid = "reveal-bid" + + AttributeKeyCommitsDuration = "commits-duration" + AttributeKeyRevealsDuration = "reveals-duration" + AttributeKeyCommitFee = "commit-fee" + AttributeKeyRevealFee = "reveal-fee" + AttributeKeyMinimumBid = "minimum-bid" + AttributeKeySigner = "signer" + AttributeKeyAuctionID = "auction-id" + AttributeKeyCommitHash = "commit-hash" + AttributeKeyReveal = "reveal" + + AttributeValueCategory = ModuleName +) diff --git a/x/auction/types/expected_keepers.go b/x/auction/types/expected_keepers.go new file mode 100644 index 00000000..3c29ec5e --- /dev/null +++ b/x/auction/types/expected_keepers.go @@ -0,0 +1,16 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// AuctionUsageKeeper keep track of auction usage in other modules. +// Used to, for example, prevent deletion of a auction that's in use. +type AuctionUsageKeeper interface { + ModuleName() string + UsesAuction(ctx sdk.Context, auctionID string) bool + + OnAuction(ctx sdk.Context, auctionID string) + OnAuctionBid(ctx sdk.Context, auctionID string, bidderAddress string) + OnAuctionWinnerSelected(ctx sdk.Context, auctionID string) +} diff --git a/x/auction/types/genesis.go b/x/auction/types/genesis.go new file mode 100644 index 00000000..04a185f5 --- /dev/null +++ b/x/auction/types/genesis.go @@ -0,0 +1,9 @@ +package types + +// DefaultGenesisState sets default evm genesis state with empty accounts and default params and +// chain config values. +func DefaultGenesisState() *GenesisState { + return &GenesisState{ + Params: DefaultParams(), + } +} diff --git a/x/auction/types/genesis.pb.go b/x/auction/types/genesis.pb.go new file mode 100644 index 00000000..2eb11d7a --- /dev/null +++ b/x/auction/types/genesis.pb.go @@ -0,0 +1,389 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: vulcanize/auction/v1beta1/genesis.proto + +package types + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/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 genesis state of the auction module +type GenesisState struct { + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` + Auctions []*Auction `protobuf:"bytes,2,rep,name=auctions,proto3" json:"auctions,omitempty" json:"bonds" yaml:"bonds"` +} + +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_23ebfbd3a1e67fe6, []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 (m *GenesisState) GetAuctions() []*Auction { + if m != nil { + return m.Auctions + } + return nil +} + +func init() { + proto.RegisterType((*GenesisState)(nil), "vulcanize.auction.v1beta1.GenesisState") +} + +func init() { + proto.RegisterFile("vulcanize/auction/v1beta1/genesis.proto", fileDescriptor_23ebfbd3a1e67fe6) +} + +var fileDescriptor_23ebfbd3a1e67fe6 = []byte{ + // 264 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x2f, 0x2b, 0xcd, 0x49, + 0x4e, 0xcc, 0xcb, 0xac, 0x4a, 0xd5, 0x4f, 0x2c, 0x4d, 0x2e, 0xc9, 0xcc, 0xcf, 0xd3, 0x2f, 0x33, + 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, + 0xca, 0x2f, 0xc9, 0x17, 0x92, 0x84, 0x2b, 0xd4, 0x83, 0x2a, 0xd4, 0x83, 0x2a, 0x94, 0x12, 0x49, + 0xcf, 0x4f, 0xcf, 0x07, 0xab, 0xd2, 0x07, 0xb1, 0x20, 0x1a, 0xa4, 0x54, 0x71, 0x9b, 0x5c, 0x52, + 0x59, 0x90, 0x0a, 0x35, 0x57, 0x69, 0x1d, 0x23, 0x17, 0x8f, 0x3b, 0xc4, 0xa6, 0xe0, 0x92, 0xc4, + 0x92, 0x54, 0x21, 0x7b, 0x2e, 0xb6, 0x82, 0xc4, 0xa2, 0xc4, 0xdc, 0x62, 0x09, 0x46, 0x05, 0x46, + 0x0d, 0x6e, 0x23, 0x45, 0x3d, 0x9c, 0x36, 0xeb, 0x05, 0x80, 0x15, 0x3a, 0xb1, 0x9c, 0xb8, 0x27, + 0xcf, 0x10, 0x04, 0xd5, 0x26, 0x14, 0xcb, 0xc5, 0x01, 0x55, 0x57, 0x2c, 0xc1, 0xa4, 0xc0, 0xac, + 0xc1, 0x6d, 0xa4, 0x84, 0xc7, 0x08, 0x47, 0x08, 0xdf, 0x49, 0xf6, 0xd3, 0x3d, 0x79, 0xc9, 0xac, + 0xe2, 0xfc, 0x3c, 0x2b, 0xa5, 0xa4, 0xfc, 0xbc, 0x94, 0x62, 0x25, 0x85, 0xca, 0xc4, 0xdc, 0x1c, + 0x18, 0x27, 0x08, 0x6e, 0xa4, 0x93, 0xdb, 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, 0xe9, 0xa4, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0x97, 0x64, 0x24, + 0x16, 0x15, 0x67, 0x16, 0xeb, 0xa7, 0x96, 0x64, 0xa4, 0x16, 0xe5, 0x66, 0xe6, 0x95, 0xe8, 0x57, + 0xc0, 0x83, 0x01, 0xec, 0xfd, 0x24, 0x36, 0xb0, 0xff, 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, + 0x40, 0x0a, 0x31, 0x1a, 0x82, 0x01, 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 + if len(m.Auctions) > 0 { + for iNdEx := len(m.Auctions) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Auctions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + 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)) + if len(m.Auctions) > 0 { + for _, e := range m.Auctions { + l = e.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 + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Auctions", 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 + } + m.Auctions = append(m.Auctions, &Auction{}) + if err := m.Auctions[len(m.Auctions)-1].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/auction/types/key.go b/x/auction/types/key.go new file mode 100644 index 00000000..f7937a5e --- /dev/null +++ b/x/auction/types/key.go @@ -0,0 +1,18 @@ +package types + +const ( + // ModuleName is the name of the module + ModuleName = "auction" + + // AuctionBurnModuleAccountName is the name of the auction burn module account. + AuctionBurnModuleAccountName = "auction_burn" + + // StoreKey to be used when creating the KVStore + StoreKey = ModuleName + + // QuerierRoute is the querier route for the staking module + QuerierRoute = ModuleName + + // RouterKey is the msg router key for the staking module + RouterKey = ModuleName +) diff --git a/x/auction/types/msgs.go b/x/auction/types/msgs.go new file mode 100644 index 00000000..7b2069d8 --- /dev/null +++ b/x/auction/types/msgs.go @@ -0,0 +1,150 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +var ( + _ sdk.Msg = &MsgCreateAuction{} + _ sdk.Msg = &MsgCommitBid{} + _ sdk.Msg = &MsgRevealBid{} +) + +// NewMsgCreateAuction is the constructor function for MsgCreateAuction. +func NewMsgCreateAuction(params Params, signer sdk.AccAddress) MsgCreateAuction { + return MsgCreateAuction{ + CommitsDuration: params.CommitsDuration, + RevealsDuration: params.RevealsDuration, + CommitFee: params.CommitFee, + RevealFee: params.RevealFee, + MinimumBid: params.MinimumBid, + Signer: signer.String(), + } +} + +// Route Implements Msg. +func (msg MsgCreateAuction) Route() string { return RouterKey } + +// Type Implements Msg. +func (msg MsgCreateAuction) Type() string { return "create" } + +// ValidateBasic Implements Msg. +func (msg MsgCreateAuction) ValidateBasic() error { + if msg.Signer == "" { + return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, msg.Signer) + } + + if msg.CommitsDuration <= 0 { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "commit phase duration invalid.") + } + + if msg.RevealsDuration <= 0 { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "reveal phase duration invalid.") + } + + if !msg.MinimumBid.IsPositive() { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "minimum bid should be greater than zero.") + } + + return nil +} + +// GetSignBytes Implements Msg. +func (msg MsgCreateAuction) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) +} + +// GetSigners Implements Msg. +func (msg MsgCreateAuction) GetSigners() []sdk.AccAddress { + accAddr, _ := sdk.AccAddressFromBech32(msg.Signer) + return []sdk.AccAddress{accAddr} +} + +// NewMsgCommitBid is the constructor function for MsgCommitBid. +func NewMsgCommitBid(auctionID string, commitHash string, signer sdk.AccAddress) MsgCommitBid { + + return MsgCommitBid{ + AuctionId: auctionID, + CommitHash: commitHash, + Signer: signer.String(), + } +} + +// Route Implements Msg. +func (msg MsgCommitBid) Route() string { return RouterKey } + +// Type Implements Msg. +func (msg MsgCommitBid) Type() string { return "commit" } + +// ValidateBasic Implements Msg. +func (msg MsgCommitBid) ValidateBasic() error { + if msg.Signer == "" { + return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "invalid signer address.") + } + + if msg.AuctionId == "" { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "invalid auction ID.") + } + + if msg.CommitHash == "" { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "invalid commit hash.") + } + + return nil +} + +// GetSignBytes Implements Msg. +func (msg MsgCommitBid) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) +} + +// GetSigners Implements Msg. +func (msg MsgCommitBid) GetSigners() []sdk.AccAddress { + accAddr, _ := sdk.AccAddressFromBech32(msg.Signer) + return []sdk.AccAddress{accAddr} +} + +// NewMsgRevealBid is the constructor function for MsgRevealBid. +func NewMsgRevealBid(auctionID string, reveal string, signer sdk.AccAddress) MsgRevealBid { + + return MsgRevealBid{ + AuctionId: auctionID, + Reveal: reveal, + Signer: signer.String(), + } +} + +// Route Implements Msg. +func (msg MsgRevealBid) Route() string { return RouterKey } + +// Type Implements Msg. +func (msg MsgRevealBid) Type() string { return "reveal" } + +// ValidateBasic Implements Msg. +func (msg MsgRevealBid) ValidateBasic() error { + if msg.Signer == "" { + return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "invalid signer address.") + } + + if msg.AuctionId == "" { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "invalid auction ID.") + } + + if msg.Reveal == "" { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "invalid reveal data.") + } + + return nil +} + +// GetSignBytes Implements Msg. +func (msg MsgRevealBid) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) +} + +// GetSigners Implements Msg. +func (msg MsgRevealBid) GetSigners() []sdk.AccAddress { + accAddr, _ := sdk.AccAddressFromBech32(msg.Signer) + return []sdk.AccAddress{accAddr} +} diff --git a/x/auction/types/params.go b/x/auction/types/params.go new file mode 100644 index 00000000..11fe66cd --- /dev/null +++ b/x/auction/types/params.go @@ -0,0 +1,173 @@ +package types + +import ( + "bytes" + "errors" + "fmt" + "strings" + "time" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/params/types" +) + +// Default parameter namespace. +const ( + DefaultParamspace = ModuleName +) + +var ( + DefaultCommitsDuration = 5 * time.Minute + DefaultRevealsDuration = 5 * time.Minute + DefaultCommitFee = sdk.Coin{Amount: sdk.NewInt(10), Denom: sdk.DefaultBondDenom} + DefaultRevealFee = sdk.Coin{Amount: sdk.NewInt(10), Denom: sdk.DefaultBondDenom} + DefaultMinimumBid = sdk.Coin{Amount: sdk.NewInt(1000), Denom: sdk.DefaultBondDenom} + + ParamStoreKeyCommitsDuration = []byte("CommitsDuration") + ParamStoreKeyRevealsDuration = []byte("RevealsDuration") + ParamStoreKeyCommitFee = []byte("CommitFee") + ParamStoreKeyRevealFee = []byte("RevealFee") + ParamStoreKeyMinimumBid = []byte("MinimumBid") +) + +var _ types.ParamSet = &Params{} + +func NewParams() Params { + return DefaultParams() +} + +// ParamKeyTable - ParamTable for bond module. +func ParamKeyTable() types.KeyTable { + return types.NewKeyTable().RegisterParamSet(&Params{}) +} + +// ParamSetPairs - implements params.ParamSet +func (p *Params) ParamSetPairs() types.ParamSetPairs { + return types.ParamSetPairs{ + types.NewParamSetPair(ParamStoreKeyCommitsDuration, &p.CommitsDuration, validateCommitsDuration), + types.NewParamSetPair(ParamStoreKeyRevealsDuration, &p.RevealsDuration, validateRevealsDuration), + types.NewParamSetPair(ParamStoreKeyCommitFee, &p.CommitFee, validateCommitFee), + types.NewParamSetPair(ParamStoreKeyRevealFee, &p.RevealFee, validateRevealFee), + types.NewParamSetPair(ParamStoreKeyMinimumBid, &p.MinimumBid, validateMinimumBid), + } +} + +// Equal returns a boolean determining if two Params types are identical. +func (p Params) Equal(p2 Params) bool { + bz1 := ModuleCdc.MustMarshalLengthPrefixed(&p) + bz2 := ModuleCdc.MustMarshalLengthPrefixed(&p2) + return bytes.Equal(bz1, bz2) +} + +// DefaultParams returns a default set of parameters. +func DefaultParams() Params { + return Params{ + CommitsDuration: DefaultCommitsDuration, + RevealsDuration: DefaultRevealsDuration, + CommitFee: DefaultCommitFee, + RevealFee: DefaultRevealFee, + MinimumBid: DefaultMinimumBid, + } +} + +// String returns a human readable string representation of the parameters. +func (p Params) String() string { + var sb strings.Builder + sb.WriteString("Params: \n") + sb.WriteString(fmt.Sprintf("CommitsDuration: %s\n", p.CommitsDuration.String())) + sb.WriteString(fmt.Sprintf("RevealsDuration: %s\n", p.RevealsDuration.String())) + sb.WriteString(fmt.Sprintf("CommitFee: %s\n", p.CommitFee.String())) + sb.WriteString(fmt.Sprintf("RevealFee: %s\n", p.RevealFee.String())) + sb.WriteString(fmt.Sprintf("MinimumBid: %s\n", p.MinimumBid.String())) + return sb.String() +} + +func validateCommitsDuration(i interface{}) error { + v, ok := i.(time.Duration) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + if v < 0 { + return errors.New("commits duration cannot be negative") + } + + return nil +} + +func validateRevealsDuration(i interface{}) error { + v, ok := i.(time.Duration) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + if v < 0 { + return errors.New("commits duration cannot be negative") + } + + return nil +} + +func validateCommitFee(i interface{}) error { + v, ok := i.(sdk.Coin) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + if v.Amount.IsNegative() { + return errors.New("commit fee must be positive") + } + + return nil +} + +func validateRevealFee(i interface{}) error { + v, ok := i.(sdk.Coin) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + if v.Amount.IsNegative() { + return errors.New("reveal fee must be positive") + } + + return nil +} + +func validateMinimumBid(i interface{}) error { + v, ok := i.(sdk.Coin) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + if v.Amount.IsNegative() { + return errors.New("minimum bid must be positive") + } + + return nil +} + +// Validate a set of params. +func (p Params) Validate() error { + if err := validateCommitsDuration(p.CommitsDuration); err != nil { + return err + } + + if err := validateRevealsDuration(p.RevealsDuration); err != nil { + return err + } + + if err := validateCommitFee(p.CommitFee); err != nil { + return err + } + + if err := validateRevealFee(p.RevealFee); err != nil { + return err + } + + if err := validateMinimumBid(p.MinimumBid); err != nil { + return err + } + + return nil +} diff --git a/x/auction/types/query.pb.go b/x/auction/types/query.pb.go new file mode 100644 index 00000000..ffd23ebf --- /dev/null +++ b/x/auction/types/query.pb.go @@ -0,0 +1,3390 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: vulcanize/auction/v1beta1/query.proto + +package types + +import ( + context "context" + fmt "fmt" + types "github.com/cosmos/cosmos-sdk/types" + query "github.com/cosmos/cosmos-sdk/types/query" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/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 + +// AuctionsRequest is the format for querying all the auctions +type AuctionsRequest struct { + // pagination defines an optional pagination info for the next request + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *AuctionsRequest) Reset() { *m = AuctionsRequest{} } +func (m *AuctionsRequest) String() string { return proto.CompactTextString(m) } +func (*AuctionsRequest) ProtoMessage() {} +func (*AuctionsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_888c39bb00ad61a7, []int{0} +} +func (m *AuctionsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AuctionsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AuctionsRequest.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 *AuctionsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_AuctionsRequest.Merge(m, src) +} +func (m *AuctionsRequest) XXX_Size() int { + return m.Size() +} +func (m *AuctionsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_AuctionsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_AuctionsRequest proto.InternalMessageInfo + +func (m *AuctionsRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// AuctionsResponse returns the list of all auctions +type AuctionsResponse struct { + // List of auctions + Auctions *Auctions `protobuf:"bytes,1,opt,name=auctions,proto3" json:"auctions,omitempty"` + // pagination defines an optional pagination info for the next request + Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *AuctionsResponse) Reset() { *m = AuctionsResponse{} } +func (m *AuctionsResponse) String() string { return proto.CompactTextString(m) } +func (*AuctionsResponse) ProtoMessage() {} +func (*AuctionsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_888c39bb00ad61a7, []int{1} +} +func (m *AuctionsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AuctionsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AuctionsResponse.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 *AuctionsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_AuctionsResponse.Merge(m, src) +} +func (m *AuctionsResponse) XXX_Size() int { + return m.Size() +} +func (m *AuctionsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_AuctionsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_AuctionsResponse proto.InternalMessageInfo + +func (m *AuctionsResponse) GetAuctions() *Auctions { + if m != nil { + return m.Auctions + } + return nil +} + +func (m *AuctionsResponse) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// AuctionRequest is the format for querying a specific auction +type AuctionRequest struct { + // Auction ID + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (m *AuctionRequest) Reset() { *m = AuctionRequest{} } +func (m *AuctionRequest) String() string { return proto.CompactTextString(m) } +func (*AuctionRequest) ProtoMessage() {} +func (*AuctionRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_888c39bb00ad61a7, []int{2} +} +func (m *AuctionRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AuctionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AuctionRequest.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 *AuctionRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_AuctionRequest.Merge(m, src) +} +func (m *AuctionRequest) XXX_Size() int { + return m.Size() +} +func (m *AuctionRequest) XXX_DiscardUnknown() { + xxx_messageInfo_AuctionRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_AuctionRequest proto.InternalMessageInfo + +func (m *AuctionRequest) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +// AuctionResponse returns the details of the queried auction +type AuctionResponse struct { + // Auction details + Auction *Auction `protobuf:"bytes,1,opt,name=auction,proto3" json:"auction,omitempty"` +} + +func (m *AuctionResponse) Reset() { *m = AuctionResponse{} } +func (m *AuctionResponse) String() string { return proto.CompactTextString(m) } +func (*AuctionResponse) ProtoMessage() {} +func (*AuctionResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_888c39bb00ad61a7, []int{3} +} +func (m *AuctionResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AuctionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AuctionResponse.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 *AuctionResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_AuctionResponse.Merge(m, src) +} +func (m *AuctionResponse) XXX_Size() int { + return m.Size() +} +func (m *AuctionResponse) XXX_DiscardUnknown() { + xxx_messageInfo_AuctionResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_AuctionResponse proto.InternalMessageInfo + +func (m *AuctionResponse) GetAuction() *Auction { + if m != nil { + return m.Auction + } + return nil +} + +// BidRequest is the format for querying a specific bid in an auction +type BidRequest struct { + // Auction ID + AuctionId string `protobuf:"bytes,1,opt,name=auction_id,json=auctionId,proto3" json:"auction_id,omitempty"` + // Bidder address + Bidder string `protobuf:"bytes,2,opt,name=bidder,proto3" json:"bidder,omitempty"` +} + +func (m *BidRequest) Reset() { *m = BidRequest{} } +func (m *BidRequest) String() string { return proto.CompactTextString(m) } +func (*BidRequest) ProtoMessage() {} +func (*BidRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_888c39bb00ad61a7, []int{4} +} +func (m *BidRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BidRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BidRequest.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 *BidRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_BidRequest.Merge(m, src) +} +func (m *BidRequest) XXX_Size() int { + return m.Size() +} +func (m *BidRequest) XXX_DiscardUnknown() { + xxx_messageInfo_BidRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_BidRequest proto.InternalMessageInfo + +func (m *BidRequest) GetAuctionId() string { + if m != nil { + return m.AuctionId + } + return "" +} + +func (m *BidRequest) GetBidder() string { + if m != nil { + return m.Bidder + } + return "" +} + +// BidResponse returns the details of the queried bid +type BidResponse struct { + // Bid details + Bid *Bid `protobuf:"bytes,1,opt,name=bid,proto3" json:"bid,omitempty"` +} + +func (m *BidResponse) Reset() { *m = BidResponse{} } +func (m *BidResponse) String() string { return proto.CompactTextString(m) } +func (*BidResponse) ProtoMessage() {} +func (*BidResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_888c39bb00ad61a7, []int{5} +} +func (m *BidResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BidResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BidResponse.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 *BidResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_BidResponse.Merge(m, src) +} +func (m *BidResponse) XXX_Size() int { + return m.Size() +} +func (m *BidResponse) XXX_DiscardUnknown() { + xxx_messageInfo_BidResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_BidResponse proto.InternalMessageInfo + +func (m *BidResponse) GetBid() *Bid { + if m != nil { + return m.Bid + } + return nil +} + +// BidsRequest is the format for querying all bids in an auction +type BidsRequest struct { + // Auction ID + AuctionId string `protobuf:"bytes,1,opt,name=auction_id,json=auctionId,proto3" json:"auction_id,omitempty"` +} + +func (m *BidsRequest) Reset() { *m = BidsRequest{} } +func (m *BidsRequest) String() string { return proto.CompactTextString(m) } +func (*BidsRequest) ProtoMessage() {} +func (*BidsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_888c39bb00ad61a7, []int{6} +} +func (m *BidsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BidsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BidsRequest.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 *BidsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_BidsRequest.Merge(m, src) +} +func (m *BidsRequest) XXX_Size() int { + return m.Size() +} +func (m *BidsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_BidsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_BidsRequest proto.InternalMessageInfo + +func (m *BidsRequest) GetAuctionId() string { + if m != nil { + return m.AuctionId + } + return "" +} + +// BidsResponse returns details of all bids in an auction +type BidsResponse struct { + // List of bids in the auction + Bids []*Bid `protobuf:"bytes,1,rep,name=bids,proto3" json:"bids,omitempty"` +} + +func (m *BidsResponse) Reset() { *m = BidsResponse{} } +func (m *BidsResponse) String() string { return proto.CompactTextString(m) } +func (*BidsResponse) ProtoMessage() {} +func (*BidsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_888c39bb00ad61a7, []int{7} +} +func (m *BidsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BidsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BidsResponse.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 *BidsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_BidsResponse.Merge(m, src) +} +func (m *BidsResponse) XXX_Size() int { + return m.Size() +} +func (m *BidsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_BidsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_BidsResponse proto.InternalMessageInfo + +func (m *BidsResponse) GetBids() []*Bid { + if m != nil { + return m.Bids + } + return nil +} + +// AuctionsByBidderRequest is the format for querying all auctions containing a bidder address +type AuctionsByBidderRequest struct { + // Address of the bidder + BidderAddress string `protobuf:"bytes,1,opt,name=bidder_address,json=bidderAddress,proto3" json:"bidder_address,omitempty"` +} + +func (m *AuctionsByBidderRequest) Reset() { *m = AuctionsByBidderRequest{} } +func (m *AuctionsByBidderRequest) String() string { return proto.CompactTextString(m) } +func (*AuctionsByBidderRequest) ProtoMessage() {} +func (*AuctionsByBidderRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_888c39bb00ad61a7, []int{8} +} +func (m *AuctionsByBidderRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AuctionsByBidderRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AuctionsByBidderRequest.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 *AuctionsByBidderRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_AuctionsByBidderRequest.Merge(m, src) +} +func (m *AuctionsByBidderRequest) XXX_Size() int { + return m.Size() +} +func (m *AuctionsByBidderRequest) XXX_DiscardUnknown() { + xxx_messageInfo_AuctionsByBidderRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_AuctionsByBidderRequest proto.InternalMessageInfo + +func (m *AuctionsByBidderRequest) GetBidderAddress() string { + if m != nil { + return m.BidderAddress + } + return "" +} + +// AuctionsByBidderResponse returns all auctions containing a bidder +type AuctionsByBidderResponse struct { + // List of auctions + Auctions *Auctions `protobuf:"bytes,1,opt,name=auctions,proto3" json:"auctions,omitempty"` +} + +func (m *AuctionsByBidderResponse) Reset() { *m = AuctionsByBidderResponse{} } +func (m *AuctionsByBidderResponse) String() string { return proto.CompactTextString(m) } +func (*AuctionsByBidderResponse) ProtoMessage() {} +func (*AuctionsByBidderResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_888c39bb00ad61a7, []int{9} +} +func (m *AuctionsByBidderResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AuctionsByBidderResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AuctionsByBidderResponse.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 *AuctionsByBidderResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_AuctionsByBidderResponse.Merge(m, src) +} +func (m *AuctionsByBidderResponse) XXX_Size() int { + return m.Size() +} +func (m *AuctionsByBidderResponse) XXX_DiscardUnknown() { + xxx_messageInfo_AuctionsByBidderResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_AuctionsByBidderResponse proto.InternalMessageInfo + +func (m *AuctionsByBidderResponse) GetAuctions() *Auctions { + if m != nil { + return m.Auctions + } + return nil +} + +// AuctionsByOwnerRequest is the format for querying all auctions created by an owner +type AuctionsByOwnerRequest struct { + // Address of the owner + OwnerAddress string `protobuf:"bytes,1,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address,omitempty"` +} + +func (m *AuctionsByOwnerRequest) Reset() { *m = AuctionsByOwnerRequest{} } +func (m *AuctionsByOwnerRequest) String() string { return proto.CompactTextString(m) } +func (*AuctionsByOwnerRequest) ProtoMessage() {} +func (*AuctionsByOwnerRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_888c39bb00ad61a7, []int{10} +} +func (m *AuctionsByOwnerRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AuctionsByOwnerRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AuctionsByOwnerRequest.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 *AuctionsByOwnerRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_AuctionsByOwnerRequest.Merge(m, src) +} +func (m *AuctionsByOwnerRequest) XXX_Size() int { + return m.Size() +} +func (m *AuctionsByOwnerRequest) XXX_DiscardUnknown() { + xxx_messageInfo_AuctionsByOwnerRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_AuctionsByOwnerRequest proto.InternalMessageInfo + +func (m *AuctionsByOwnerRequest) GetOwnerAddress() string { + if m != nil { + return m.OwnerAddress + } + return "" +} + +// AuctionsByOwnerResponse returns all auctions created by an owner +type AuctionsByOwnerResponse struct { + // List of auctions + Auctions *Auctions `protobuf:"bytes,1,opt,name=auctions,proto3" json:"auctions,omitempty"` +} + +func (m *AuctionsByOwnerResponse) Reset() { *m = AuctionsByOwnerResponse{} } +func (m *AuctionsByOwnerResponse) String() string { return proto.CompactTextString(m) } +func (*AuctionsByOwnerResponse) ProtoMessage() {} +func (*AuctionsByOwnerResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_888c39bb00ad61a7, []int{11} +} +func (m *AuctionsByOwnerResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AuctionsByOwnerResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AuctionsByOwnerResponse.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 *AuctionsByOwnerResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_AuctionsByOwnerResponse.Merge(m, src) +} +func (m *AuctionsByOwnerResponse) XXX_Size() int { + return m.Size() +} +func (m *AuctionsByOwnerResponse) XXX_DiscardUnknown() { + xxx_messageInfo_AuctionsByOwnerResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_AuctionsByOwnerResponse proto.InternalMessageInfo + +func (m *AuctionsByOwnerResponse) GetAuctions() *Auctions { + if m != nil { + return m.Auctions + } + return nil +} + +// QueryParamsRequest is the format to query the parameters of the auction module +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_888c39bb00ad61a7, []int{12} +} +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 returns parameters of the auction module +type QueryParamsResponse struct { + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` +} + +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_888c39bb00ad61a7, []int{13} +} +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 nil +} + +// BalanceRequest is the format to fetch all balances +type BalanceRequest struct { +} + +func (m *BalanceRequest) Reset() { *m = BalanceRequest{} } +func (m *BalanceRequest) String() string { return proto.CompactTextString(m) } +func (*BalanceRequest) ProtoMessage() {} +func (*BalanceRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_888c39bb00ad61a7, []int{14} +} +func (m *BalanceRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BalanceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BalanceRequest.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 *BalanceRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_BalanceRequest.Merge(m, src) +} +func (m *BalanceRequest) XXX_Size() int { + return m.Size() +} +func (m *BalanceRequest) XXX_DiscardUnknown() { + xxx_messageInfo_BalanceRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_BalanceRequest proto.InternalMessageInfo + +type BalanceResponse struct { + // Set of all balances within the auction + Balance []types.Coin `protobuf:"bytes,1,rep,name=balance,proto3" json:"balance"` +} + +func (m *BalanceResponse) Reset() { *m = BalanceResponse{} } +func (m *BalanceResponse) String() string { return proto.CompactTextString(m) } +func (*BalanceResponse) ProtoMessage() {} +func (*BalanceResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_888c39bb00ad61a7, []int{15} +} +func (m *BalanceResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BalanceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BalanceResponse.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 *BalanceResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_BalanceResponse.Merge(m, src) +} +func (m *BalanceResponse) XXX_Size() int { + return m.Size() +} +func (m *BalanceResponse) XXX_DiscardUnknown() { + xxx_messageInfo_BalanceResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_BalanceResponse proto.InternalMessageInfo + +func (m *BalanceResponse) GetBalance() []types.Coin { + if m != nil { + return m.Balance + } + return nil +} + +func init() { + proto.RegisterType((*AuctionsRequest)(nil), "vulcanize.auction.v1beta1.AuctionsRequest") + proto.RegisterType((*AuctionsResponse)(nil), "vulcanize.auction.v1beta1.AuctionsResponse") + proto.RegisterType((*AuctionRequest)(nil), "vulcanize.auction.v1beta1.AuctionRequest") + proto.RegisterType((*AuctionResponse)(nil), "vulcanize.auction.v1beta1.AuctionResponse") + proto.RegisterType((*BidRequest)(nil), "vulcanize.auction.v1beta1.BidRequest") + proto.RegisterType((*BidResponse)(nil), "vulcanize.auction.v1beta1.BidResponse") + proto.RegisterType((*BidsRequest)(nil), "vulcanize.auction.v1beta1.BidsRequest") + proto.RegisterType((*BidsResponse)(nil), "vulcanize.auction.v1beta1.BidsResponse") + proto.RegisterType((*AuctionsByBidderRequest)(nil), "vulcanize.auction.v1beta1.AuctionsByBidderRequest") + proto.RegisterType((*AuctionsByBidderResponse)(nil), "vulcanize.auction.v1beta1.AuctionsByBidderResponse") + proto.RegisterType((*AuctionsByOwnerRequest)(nil), "vulcanize.auction.v1beta1.AuctionsByOwnerRequest") + proto.RegisterType((*AuctionsByOwnerResponse)(nil), "vulcanize.auction.v1beta1.AuctionsByOwnerResponse") + proto.RegisterType((*QueryParamsRequest)(nil), "vulcanize.auction.v1beta1.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "vulcanize.auction.v1beta1.QueryParamsResponse") + proto.RegisterType((*BalanceRequest)(nil), "vulcanize.auction.v1beta1.BalanceRequest") + proto.RegisterType((*BalanceResponse)(nil), "vulcanize.auction.v1beta1.BalanceResponse") +} + +func init() { + proto.RegisterFile("vulcanize/auction/v1beta1/query.proto", fileDescriptor_888c39bb00ad61a7) +} + +var fileDescriptor_888c39bb00ad61a7 = []byte{ + // 845 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x96, 0xcf, 0x6f, 0xe3, 0x44, + 0x14, 0xc7, 0xe3, 0xec, 0x92, 0x6c, 0x5e, 0x76, 0xb3, 0xab, 0x61, 0xb5, 0xec, 0x46, 0x60, 0x76, + 0x27, 0x64, 0x69, 0xd3, 0xd6, 0x6e, 0x53, 0x2a, 0x84, 0xa0, 0x2a, 0x75, 0xa5, 0x56, 0x48, 0x48, + 0x2d, 0xb9, 0x51, 0x0e, 0x95, 0x1d, 0x8f, 0xd2, 0x91, 0x1a, 0x3b, 0x8d, 0x9d, 0x42, 0x88, 0x72, + 0xe1, 0xcc, 0xa1, 0x12, 0x02, 0x0e, 0xfc, 0x1d, 0x5c, 0xf8, 0x0b, 0x7a, 0xac, 0xc4, 0x85, 0x13, + 0x42, 0x2d, 0x7f, 0x06, 0x07, 0xe4, 0x99, 0x37, 0xce, 0x8f, 0xaa, 0x8e, 0xb3, 0xea, 0x2d, 0x79, + 0xfe, 0xbe, 0xf7, 0x3e, 0xf3, 0xc6, 0xef, 0x9b, 0x40, 0xf5, 0xac, 0x77, 0xd2, 0xb4, 0x3d, 0xfe, + 0x3d, 0x33, 0xed, 0x5e, 0x33, 0xe4, 0xbe, 0x67, 0x9e, 0xad, 0x39, 0x2c, 0xb4, 0xd7, 0xcc, 0xd3, + 0x1e, 0xeb, 0xf6, 0x8d, 0x4e, 0xd7, 0x0f, 0x7d, 0xf2, 0x22, 0x96, 0x19, 0x28, 0x33, 0x50, 0x56, + 0x7e, 0xda, 0xf2, 0x5b, 0xbe, 0x50, 0x99, 0xd1, 0x27, 0x99, 0x50, 0x7e, 0xb7, 0xe5, 0xfb, 0xad, + 0x13, 0x66, 0xda, 0x1d, 0x6e, 0xda, 0x9e, 0xe7, 0x87, 0x76, 0x94, 0x14, 0xe0, 0xd3, 0x5a, 0xd3, + 0x0f, 0xda, 0x7e, 0x60, 0x3a, 0x76, 0xc0, 0x64, 0x9f, 0xb8, 0x6b, 0xc7, 0x6e, 0x71, 0x4f, 0x88, + 0x51, 0xab, 0x8f, 0x6b, 0x95, 0xaa, 0xe9, 0x73, 0xf5, 0x3c, 0xe1, 0x04, 0x61, 0xbf, 0xc3, 0xb0, + 0x25, 0xfd, 0x1a, 0x1e, 0x6f, 0xcb, 0xc7, 0x41, 0x83, 0x9d, 0xf6, 0x58, 0x10, 0x92, 0x5d, 0x80, + 0x51, 0xb7, 0xe7, 0xda, 0x4b, 0x6d, 0xa1, 0x58, 0x7f, 0x6d, 0xc8, 0x76, 0x46, 0xd4, 0xce, 0x90, + 0x23, 0xc0, 0x72, 0xc6, 0x81, 0xdd, 0x62, 0x98, 0xdb, 0x18, 0xcb, 0xa4, 0xbf, 0x69, 0xf0, 0x64, + 0x54, 0x3b, 0xe8, 0xf8, 0x5e, 0xc0, 0xc8, 0x16, 0x3c, 0x40, 0x9c, 0x00, 0x4b, 0x57, 0x8c, 0x5b, + 0x87, 0x68, 0xc4, 0xe9, 0x71, 0xd2, 0x14, 0x5d, 0xf6, 0x8d, 0xe9, 0x5e, 0x42, 0x09, 0xab, 0xab, + 0x73, 0x97, 0x20, 0xcb, 0x5d, 0x01, 0x55, 0x68, 0x64, 0xb9, 0x4b, 0xf7, 0xe3, 0xd1, 0xc4, 0xf4, + 0x9f, 0x41, 0x1e, 0x41, 0x10, 0x9e, 0xce, 0x86, 0x6f, 0xa8, 0x14, 0xba, 0x03, 0x60, 0x71, 0x57, + 0xb5, 0x7b, 0x0f, 0x00, 0x1f, 0x1c, 0xc5, 0x6d, 0x0b, 0x18, 0xf9, 0xc2, 0x25, 0xcf, 0x20, 0xe7, + 0x70, 0xd7, 0x65, 0x5d, 0x71, 0xc6, 0x42, 0x03, 0xbf, 0xd1, 0x2d, 0x28, 0x8a, 0x22, 0x48, 0xb4, + 0x0a, 0xf7, 0x1c, 0x4c, 0x2f, 0xd6, 0xf5, 0x04, 0x9a, 0x28, 0x29, 0x92, 0xd2, 0x65, 0x51, 0x20, + 0x48, 0x87, 0x41, 0x2d, 0x78, 0x28, 0xd5, 0xd8, 0xaf, 0x0e, 0xf7, 0x1d, 0xee, 0x46, 0x77, 0x77, + 0x2f, 0x45, 0x43, 0xa1, 0xa5, 0x9f, 0xc3, 0x3b, 0xea, 0x22, 0xad, 0xbe, 0x25, 0x8e, 0xa1, 0xba, + 0x57, 0xa1, 0x24, 0xcf, 0x75, 0x64, 0xbb, 0x6e, 0x97, 0x05, 0x01, 0x12, 0x3c, 0x92, 0xd1, 0x6d, + 0x19, 0xa4, 0xdf, 0xc0, 0xf3, 0x9b, 0x15, 0xee, 0xe8, 0x8d, 0xa2, 0x9b, 0xf0, 0x6c, 0x54, 0x7c, + 0xff, 0x5b, 0x6f, 0x44, 0x57, 0x81, 0x47, 0x7e, 0xf4, 0x7d, 0x0a, 0xee, 0xa1, 0x08, 0x2a, 0xb6, + 0xc3, 0xf1, 0xd3, 0x61, 0xfa, 0x5d, 0xa1, 0x3d, 0x05, 0xf2, 0x55, 0xf4, 0x36, 0x1f, 0xd8, 0x5d, + 0xbb, 0xad, 0xae, 0x8c, 0x1e, 0xc0, 0xdb, 0x13, 0x51, 0xec, 0xf6, 0x09, 0xe4, 0x3a, 0x22, 0x82, + 0xbd, 0x5e, 0x25, 0xf4, 0xc2, 0x54, 0x4c, 0xa0, 0x4f, 0xa0, 0x64, 0xd9, 0x27, 0xb6, 0xd7, 0x54, + 0xab, 0x42, 0xbf, 0x84, 0xc7, 0x71, 0x24, 0xae, 0x9f, 0x77, 0x64, 0x08, 0x6f, 0xff, 0xc5, 0xc4, + 0xda, 0xa9, 0xd2, 0x3b, 0x3e, 0xf7, 0xac, 0xfb, 0x17, 0x7f, 0xbf, 0x9f, 0x69, 0x28, 0x7d, 0xfd, + 0xbf, 0x02, 0xbc, 0x25, 0x90, 0xc9, 0xb9, 0x06, 0x0f, 0xd4, 0x41, 0x49, 0x2d, 0xcd, 0x34, 0x24, + 0x50, 0x79, 0x29, 0x95, 0x56, 0xa2, 0xd2, 0xa5, 0x1f, 0xfe, 0xfc, 0xf7, 0xa7, 0x6c, 0x95, 0x54, + 0xcc, 0xdb, 0x5d, 0x30, 0x76, 0x94, 0x9f, 0x35, 0x80, 0x3d, 0x16, 0x62, 0x11, 0xb2, 0x98, 0x62, + 0xa5, 0x91, 0xa9, 0x96, 0x46, 0x8a, 0x48, 0xab, 0x02, 0xa9, 0x46, 0x16, 0x52, 0x20, 0x99, 0x03, + 0xee, 0x0e, 0xc9, 0x2f, 0x1a, 0xe4, 0xf6, 0x58, 0x68, 0x71, 0x97, 0x54, 0x67, 0xec, 0x19, 0xf2, + 0xbc, 0x9e, 0x25, 0x43, 0x96, 0x4d, 0xc1, 0xf2, 0x31, 0xd9, 0x48, 0x60, 0x89, 0x36, 0xd7, 0x1c, + 0x8c, 0xac, 0x61, 0x68, 0x0e, 0xe4, 0x4e, 0x0e, 0xa3, 0x3b, 0xcc, 0x4b, 0xb0, 0x80, 0xcc, 0x68, + 0x19, 0x5f, 0xdf, 0x87, 0x33, 0x75, 0xc8, 0xf6, 0x91, 0x60, 0x33, 0xc8, 0xf2, 0x3c, 0x6c, 0xe4, + 0x8f, 0xb1, 0xdf, 0x1a, 0xe5, 0x10, 0xa4, 0x9e, 0xe2, 0x95, 0x99, 0x32, 0xa4, 0xf2, 0xfa, 0x5c, + 0x39, 0xf3, 0xcc, 0xb3, 0xbf, 0x22, 0xe7, 0xa7, 0xe6, 0xa8, 0x4c, 0x65, 0x48, 0x7e, 0xd7, 0x46, + 0x3f, 0xc2, 0x68, 0x21, 0x64, 0x2d, 0x15, 0xc7, 0xb8, 0x5b, 0x95, 0xeb, 0xf3, 0xa4, 0x20, 0xf9, + 0xa7, 0x82, 0x7c, 0x83, 0xac, 0x27, 0x93, 0x0b, 0xc3, 0x33, 0x07, 0x13, 0x66, 0x38, 0x24, 0xbf, + 0x6a, 0x50, 0x1c, 0x33, 0x22, 0xb2, 0x92, 0x00, 0x70, 0xd3, 0xc6, 0xca, 0x46, 0x5a, 0x39, 0xb2, + 0x2e, 0x0a, 0xd6, 0x0a, 0x79, 0x95, 0xc0, 0x2a, 0xfd, 0x8c, 0xfc, 0xa8, 0x41, 0x1e, 0xed, 0x2b, + 0x71, 0x9f, 0x27, 0x4d, 0x2f, 0x71, 0x9f, 0xa7, 0xdc, 0x90, 0xd6, 0x04, 0xcd, 0x07, 0x84, 0x26, + 0x4d, 0x4e, 0xe6, 0x58, 0xbb, 0x17, 0x57, 0xba, 0x76, 0x79, 0xa5, 0x6b, 0xff, 0x5c, 0xe9, 0xda, + 0xf9, 0xb5, 0x9e, 0xb9, 0xbc, 0xd6, 0x33, 0x7f, 0x5d, 0xeb, 0x99, 0xc3, 0xe5, 0x16, 0x0f, 0x8f, + 0x7b, 0x8e, 0xd1, 0xf4, 0xdb, 0x66, 0x78, 0x6c, 0x77, 0x03, 0x1e, 0x98, 0x2c, 0x3c, 0x66, 0xdd, + 0x36, 0xf7, 0x42, 0xf3, 0xbb, 0xb8, 0xa2, 0xf8, 0xcb, 0xe6, 0xe4, 0xc4, 0x7f, 0xb6, 0xf5, 0xff, + 0x03, 0x00, 0x00, 0xff, 0xff, 0x6b, 0xcc, 0x1f, 0xc3, 0x9e, 0x0a, 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 { + // Auctions queries all auctions + Auctions(ctx context.Context, in *AuctionsRequest, opts ...grpc.CallOption) (*AuctionsResponse, error) + // GetAuction queries an auction + GetAuction(ctx context.Context, in *AuctionRequest, opts ...grpc.CallOption) (*AuctionResponse, error) + // GetBid queries an auction bid + GetBid(ctx context.Context, in *BidRequest, opts ...grpc.CallOption) (*BidResponse, error) + // GetBids queries all auction bids + GetBids(ctx context.Context, in *BidsRequest, opts ...grpc.CallOption) (*BidsResponse, error) + // AuctionsByBidder queries auctions by bidder + AuctionsByBidder(ctx context.Context, in *AuctionsByBidderRequest, opts ...grpc.CallOption) (*AuctionsByBidderResponse, error) + // AuctionsByOwner queries auctions by owner + AuctionsByOwner(ctx context.Context, in *AuctionsByOwnerRequest, opts ...grpc.CallOption) (*AuctionsByOwnerResponse, error) + // QueryParams implements the params query command + QueryParams(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) + // Balance queries the auction module account balance + Balance(ctx context.Context, in *BalanceRequest, opts ...grpc.CallOption) (*BalanceResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Auctions(ctx context.Context, in *AuctionsRequest, opts ...grpc.CallOption) (*AuctionsResponse, error) { + out := new(AuctionsResponse) + err := c.cc.Invoke(ctx, "/vulcanize.auction.v1beta1.Query/Auctions", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) GetAuction(ctx context.Context, in *AuctionRequest, opts ...grpc.CallOption) (*AuctionResponse, error) { + out := new(AuctionResponse) + err := c.cc.Invoke(ctx, "/vulcanize.auction.v1beta1.Query/GetAuction", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) GetBid(ctx context.Context, in *BidRequest, opts ...grpc.CallOption) (*BidResponse, error) { + out := new(BidResponse) + err := c.cc.Invoke(ctx, "/vulcanize.auction.v1beta1.Query/GetBid", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) GetBids(ctx context.Context, in *BidsRequest, opts ...grpc.CallOption) (*BidsResponse, error) { + out := new(BidsResponse) + err := c.cc.Invoke(ctx, "/vulcanize.auction.v1beta1.Query/GetBids", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) AuctionsByBidder(ctx context.Context, in *AuctionsByBidderRequest, opts ...grpc.CallOption) (*AuctionsByBidderResponse, error) { + out := new(AuctionsByBidderResponse) + err := c.cc.Invoke(ctx, "/vulcanize.auction.v1beta1.Query/AuctionsByBidder", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) AuctionsByOwner(ctx context.Context, in *AuctionsByOwnerRequest, opts ...grpc.CallOption) (*AuctionsByOwnerResponse, error) { + out := new(AuctionsByOwnerResponse) + err := c.cc.Invoke(ctx, "/vulcanize.auction.v1beta1.Query/AuctionsByOwner", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) QueryParams(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, "/vulcanize.auction.v1beta1.Query/QueryParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Balance(ctx context.Context, in *BalanceRequest, opts ...grpc.CallOption) (*BalanceResponse, error) { + out := new(BalanceResponse) + err := c.cc.Invoke(ctx, "/vulcanize.auction.v1beta1.Query/Balance", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // Auctions queries all auctions + Auctions(context.Context, *AuctionsRequest) (*AuctionsResponse, error) + // GetAuction queries an auction + GetAuction(context.Context, *AuctionRequest) (*AuctionResponse, error) + // GetBid queries an auction bid + GetBid(context.Context, *BidRequest) (*BidResponse, error) + // GetBids queries all auction bids + GetBids(context.Context, *BidsRequest) (*BidsResponse, error) + // AuctionsByBidder queries auctions by bidder + AuctionsByBidder(context.Context, *AuctionsByBidderRequest) (*AuctionsByBidderResponse, error) + // AuctionsByOwner queries auctions by owner + AuctionsByOwner(context.Context, *AuctionsByOwnerRequest) (*AuctionsByOwnerResponse, error) + // QueryParams implements the params query command + QueryParams(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) + // Balance queries the auction module account balance + Balance(context.Context, *BalanceRequest) (*BalanceResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) Auctions(ctx context.Context, req *AuctionsRequest) (*AuctionsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Auctions not implemented") +} +func (*UnimplementedQueryServer) GetAuction(ctx context.Context, req *AuctionRequest) (*AuctionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetAuction not implemented") +} +func (*UnimplementedQueryServer) GetBid(ctx context.Context, req *BidRequest) (*BidResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetBid not implemented") +} +func (*UnimplementedQueryServer) GetBids(ctx context.Context, req *BidsRequest) (*BidsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetBids not implemented") +} +func (*UnimplementedQueryServer) AuctionsByBidder(ctx context.Context, req *AuctionsByBidderRequest) (*AuctionsByBidderResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AuctionsByBidder not implemented") +} +func (*UnimplementedQueryServer) AuctionsByOwner(ctx context.Context, req *AuctionsByOwnerRequest) (*AuctionsByOwnerResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AuctionsByOwner not implemented") +} +func (*UnimplementedQueryServer) QueryParams(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method QueryParams not implemented") +} +func (*UnimplementedQueryServer) Balance(ctx context.Context, req *BalanceRequest) (*BalanceResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Balance not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_Auctions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AuctionsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Auctions(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vulcanize.auction.v1beta1.Query/Auctions", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Auctions(ctx, req.(*AuctionsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_GetAuction_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AuctionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).GetAuction(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vulcanize.auction.v1beta1.Query/GetAuction", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GetAuction(ctx, req.(*AuctionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_GetBid_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(BidRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).GetBid(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vulcanize.auction.v1beta1.Query/GetBid", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GetBid(ctx, req.(*BidRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_GetBids_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(BidsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).GetBids(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vulcanize.auction.v1beta1.Query/GetBids", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GetBids(ctx, req.(*BidsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_AuctionsByBidder_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AuctionsByBidderRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).AuctionsByBidder(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vulcanize.auction.v1beta1.Query/AuctionsByBidder", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).AuctionsByBidder(ctx, req.(*AuctionsByBidderRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_AuctionsByOwner_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AuctionsByOwnerRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).AuctionsByOwner(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vulcanize.auction.v1beta1.Query/AuctionsByOwner", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).AuctionsByOwner(ctx, req.(*AuctionsByOwnerRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_QueryParams_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).QueryParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vulcanize.auction.v1beta1.Query/QueryParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).QueryParams(ctx, req.(*QueryParamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Balance_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(BalanceRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Balance(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vulcanize.auction.v1beta1.Query/Balance", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Balance(ctx, req.(*BalanceRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "vulcanize.auction.v1beta1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Auctions", + Handler: _Query_Auctions_Handler, + }, + { + MethodName: "GetAuction", + Handler: _Query_GetAuction_Handler, + }, + { + MethodName: "GetBid", + Handler: _Query_GetBid_Handler, + }, + { + MethodName: "GetBids", + Handler: _Query_GetBids_Handler, + }, + { + MethodName: "AuctionsByBidder", + Handler: _Query_AuctionsByBidder_Handler, + }, + { + MethodName: "AuctionsByOwner", + Handler: _Query_AuctionsByOwner_Handler, + }, + { + MethodName: "QueryParams", + Handler: _Query_QueryParams_Handler, + }, + { + MethodName: "Balance", + Handler: _Query_Balance_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "vulcanize/auction/v1beta1/query.proto", +} + +func (m *AuctionsRequest) 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 *AuctionsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AuctionsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.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 (m *AuctionsResponse) 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 *AuctionsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AuctionsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Auctions != nil { + { + size, err := m.Auctions.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 (m *AuctionRequest) 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 *AuctionRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AuctionRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Id) > 0 { + i -= len(m.Id) + copy(dAtA[i:], m.Id) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Id))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *AuctionResponse) 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 *AuctionResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AuctionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Auction != nil { + { + size, err := m.Auction.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 (m *BidRequest) 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 *BidRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BidRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Bidder) > 0 { + i -= len(m.Bidder) + copy(dAtA[i:], m.Bidder) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Bidder))) + i-- + dAtA[i] = 0x12 + } + if len(m.AuctionId) > 0 { + i -= len(m.AuctionId) + copy(dAtA[i:], m.AuctionId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.AuctionId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *BidResponse) 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 *BidResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BidResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Bid != nil { + { + size, err := m.Bid.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 (m *BidsRequest) 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 *BidsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BidsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.AuctionId) > 0 { + i -= len(m.AuctionId) + copy(dAtA[i:], m.AuctionId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.AuctionId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *BidsResponse) 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 *BidsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BidsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Bids) > 0 { + for iNdEx := len(m.Bids) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Bids[iNdEx].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 (m *AuctionsByBidderRequest) 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 *AuctionsByBidderRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AuctionsByBidderRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.BidderAddress) > 0 { + i -= len(m.BidderAddress) + copy(dAtA[i:], m.BidderAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.BidderAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *AuctionsByBidderResponse) 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 *AuctionsByBidderResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AuctionsByBidderResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Auctions != nil { + { + size, err := m.Auctions.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 (m *AuctionsByOwnerRequest) 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 *AuctionsByOwnerRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AuctionsByOwnerRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.OwnerAddress) > 0 { + i -= len(m.OwnerAddress) + copy(dAtA[i:], m.OwnerAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.OwnerAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *AuctionsByOwnerResponse) 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 *AuctionsByOwnerResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AuctionsByOwnerResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Auctions != nil { + { + size, err := m.Auctions.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 (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 + if m.Params != nil { + { + 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 (m *BalanceRequest) 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 *BalanceRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BalanceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *BalanceResponse) 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 *BalanceResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BalanceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Balance) > 0 { + for iNdEx := len(m.Balance) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Balance[iNdEx].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 *AuctionsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *AuctionsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Auctions != nil { + l = m.Auctions.Size() + n += 1 + l + sovQuery(uint64(l)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *AuctionRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Id) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *AuctionResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Auction != nil { + l = m.Auction.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *BidRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.AuctionId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.Bidder) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *BidResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Bid != nil { + l = m.Bid.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *BidsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.AuctionId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *BidsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Bids) > 0 { + for _, e := range m.Bids { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *AuctionsByBidderRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.BidderAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *AuctionsByBidderResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Auctions != nil { + l = m.Auctions.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *AuctionsByOwnerRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.OwnerAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *AuctionsByOwnerResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Auctions != nil { + l = m.Auctions.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +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 + if m.Params != nil { + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *BalanceRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *BalanceResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Balance) > 0 { + for _, e := range m.Balance { + l = e.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 *AuctionsRequest) 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: AuctionsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AuctionsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", 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 m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.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 (m *AuctionsResponse) 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: AuctionsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AuctionsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Auctions", 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 m.Auctions == nil { + m.Auctions = &Auctions{} + } + if err := m.Auctions.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", 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 m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.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 (m *AuctionRequest) 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: AuctionRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AuctionRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Id = string(dAtA[iNdEx:postIndex]) + 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 (m *AuctionResponse) 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: AuctionResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AuctionResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Auction", 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 m.Auction == nil { + m.Auction = &Auction{} + } + if err := m.Auction.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 (m *BidRequest) 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: BidRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BidRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AuctionId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AuctionId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Bidder", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Bidder = string(dAtA[iNdEx:postIndex]) + 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 (m *BidResponse) 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: BidResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BidResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Bid", 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 m.Bid == nil { + m.Bid = &Bid{} + } + if err := m.Bid.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 (m *BidsRequest) 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: BidsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BidsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AuctionId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AuctionId = string(dAtA[iNdEx:postIndex]) + 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 (m *BidsResponse) 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: BidsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BidsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Bids", 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 + } + m.Bids = append(m.Bids, &Bid{}) + if err := m.Bids[len(m.Bids)-1].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 (m *AuctionsByBidderRequest) 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: AuctionsByBidderRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AuctionsByBidderRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BidderAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BidderAddress = string(dAtA[iNdEx:postIndex]) + 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 (m *AuctionsByBidderResponse) 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: AuctionsByBidderResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AuctionsByBidderResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Auctions", 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 m.Auctions == nil { + m.Auctions = &Auctions{} + } + if err := m.Auctions.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 (m *AuctionsByOwnerRequest) 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: AuctionsByOwnerRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AuctionsByOwnerRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OwnerAddress = string(dAtA[iNdEx:postIndex]) + 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 (m *AuctionsByOwnerResponse) 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: AuctionsByOwnerResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AuctionsByOwnerResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Auctions", 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 m.Auctions == nil { + m.Auctions = &Auctions{} + } + if err := m.Auctions.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 (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 m.Params == nil { + m.Params = &Params{} + } + 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 (m *BalanceRequest) 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: BalanceRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BalanceRequest: 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 *BalanceResponse) 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: BalanceResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BalanceResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Balance", 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 + } + m.Balance = append(m.Balance, types.Coin{}) + if err := m.Balance[len(m.Balance)-1].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/auction/types/query.pb.gw.go b/x/auction/types/query.pb.gw.go new file mode 100644 index 00000000..99f10fd7 --- /dev/null +++ b/x/auction/types/query.pb.gw.go @@ -0,0 +1,802 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: vulcanize/auction/v1beta1/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/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 ( + filter_Query_Auctions_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_Auctions_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq AuctionsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Auctions_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Auctions(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Auctions_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq AuctionsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Auctions_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Auctions(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_GetAuction_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq AuctionRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") + } + + protoReq.Id, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) + } + + msg, err := client.GetAuction(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_GetAuction_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq AuctionRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") + } + + protoReq.Id, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) + } + + msg, err := server.GetAuction(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_GetBid_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq BidRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["auction_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "auction_id") + } + + protoReq.AuctionId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "auction_id", err) + } + + val, ok = pathParams["bidder"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "bidder") + } + + protoReq.Bidder, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "bidder", err) + } + + msg, err := client.GetBid(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_GetBid_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq BidRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["auction_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "auction_id") + } + + protoReq.AuctionId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "auction_id", err) + } + + val, ok = pathParams["bidder"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "bidder") + } + + protoReq.Bidder, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "bidder", err) + } + + msg, err := server.GetBid(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_GetBids_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq BidsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["auction_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "auction_id") + } + + protoReq.AuctionId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "auction_id", err) + } + + msg, err := client.GetBids(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_GetBids_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq BidsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["auction_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "auction_id") + } + + protoReq.AuctionId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "auction_id", err) + } + + msg, err := server.GetBids(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_AuctionsByBidder_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq AuctionsByBidderRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["bidder_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "bidder_address") + } + + protoReq.BidderAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "bidder_address", err) + } + + msg, err := client.AuctionsByBidder(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_AuctionsByBidder_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq AuctionsByBidderRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["bidder_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "bidder_address") + } + + protoReq.BidderAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "bidder_address", err) + } + + msg, err := server.AuctionsByBidder(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_AuctionsByOwner_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq AuctionsByOwnerRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["owner_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "owner_address") + } + + protoReq.OwnerAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "owner_address", err) + } + + msg, err := client.AuctionsByOwner(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_AuctionsByOwner_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq AuctionsByOwnerRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["owner_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "owner_address") + } + + protoReq.OwnerAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "owner_address", err) + } + + msg, err := server.AuctionsByOwner(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_QueryParams_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.QueryParams(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_QueryParams_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.QueryParams(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_Balance_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq BalanceRequest + var metadata runtime.ServerMetadata + + msg, err := client.Balance(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Balance_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq BalanceRequest + var metadata runtime.ServerMetadata + + msg, err := server.Balance(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 (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + + mux.Handle("GET", pattern_Query_Auctions_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.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Auctions_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Auctions_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GetAuction_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.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_GetAuction_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_GetAuction_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GetBid_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.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_GetBid_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_GetBid_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GetBids_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.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_GetBids_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_GetBids_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_AuctionsByBidder_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.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_AuctionsByBidder_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_AuctionsByBidder_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_AuctionsByOwner_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.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_AuctionsByOwner_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_AuctionsByOwner_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_QueryParams_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.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_QueryParams_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_QueryParams_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Balance_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.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Balance_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Balance_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_Auctions_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_Auctions_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_Auctions_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GetAuction_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_GetAuction_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_GetAuction_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GetBid_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_GetBid_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_GetBid_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GetBids_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_GetBids_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_GetBids_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_AuctionsByBidder_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_AuctionsByBidder_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_AuctionsByBidder_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_AuctionsByOwner_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_AuctionsByOwner_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_AuctionsByOwner_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_QueryParams_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_QueryParams_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_QueryParams_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Balance_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_Balance_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_Balance_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Query_Auctions_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"vulcanize", "auction", "v1beta1", "auctions"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_GetAuction_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"vulcanize", "auction", "v1beta1", "auctions", "id"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_GetBid_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5}, []string{"vulcanize", "auction", "v1beta1", "bids", "auction_id", "bidder"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_GetBids_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"vulcanize", "auction", "v1beta1", "bids", "auction_id"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_AuctionsByBidder_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"vulcanize", "auction", "v1beta1", "by-bidder", "bidder_address"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_AuctionsByOwner_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"vulcanize", "auction", "v1beta1", "by-owner", "owner_address"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_QueryParams_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"vulcanize", "auction", "v1beta1", "params"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_Balance_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"vulcanize", "auction", "v1beta1", "balance"}, "", runtime.AssumeColonVerbOpt(true))) +) + +var ( + forward_Query_Auctions_0 = runtime.ForwardResponseMessage + + forward_Query_GetAuction_0 = runtime.ForwardResponseMessage + + forward_Query_GetBid_0 = runtime.ForwardResponseMessage + + forward_Query_GetBids_0 = runtime.ForwardResponseMessage + + forward_Query_AuctionsByBidder_0 = runtime.ForwardResponseMessage + + forward_Query_AuctionsByOwner_0 = runtime.ForwardResponseMessage + + forward_Query_QueryParams_0 = runtime.ForwardResponseMessage + + forward_Query_Balance_0 = runtime.ForwardResponseMessage +) diff --git a/x/auction/types/tx.pb.go b/x/auction/types/tx.pb.go new file mode 100644 index 00000000..006e4501 --- /dev/null +++ b/x/auction/types/tx.pb.go @@ -0,0 +1,1777 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: vulcanize/auction/v1beta1/tx.proto + +package types + +import ( + context "context" + fmt "fmt" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + _ "google.golang.org/protobuf/types/known/durationpb" + io "io" + math "math" + math_bits "math/bits" + time "time" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// 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 + +// MsgCreateAuction defines a create auction message +type MsgCreateAuction struct { + // Duration of the commits phase in seconds + CommitsDuration time.Duration `protobuf:"bytes,1,opt,name=commits_duration,json=commitsDuration,proto3,stdduration" json:"commits_duration" json:"commits_duration" yaml:"commits_duration"` + // Duration of the reveals phase in seconds + RevealsDuration time.Duration `protobuf:"bytes,2,opt,name=reveals_duration,json=revealsDuration,proto3,stdduration" json:"reveals_duration" json:"reveals_duration" yaml:"reveals_duration"` + // Commit fees + CommitFee types.Coin `protobuf:"bytes,3,opt,name=commit_fee,json=commitFee,proto3" json:"commit_fee" json:"commit_fee" yaml:"commit_fee"` + // Reveal fees + RevealFee types.Coin `protobuf:"bytes,4,opt,name=reveal_fee,json=revealFee,proto3" json:"reveal_fee" json:"reveal_fee" yaml:"reveal_fee"` + // Minimum acceptable bid amount + MinimumBid types.Coin `protobuf:"bytes,5,opt,name=minimum_bid,json=minimumBid,proto3" json:"minimum_bid" json:"minimum_bid" yaml:"minimum_bid"` + // Address of the signer + Signer string `protobuf:"bytes,6,opt,name=signer,proto3" json:"signer,omitempty" json:"signer" yaml:"signer"` +} + +func (m *MsgCreateAuction) Reset() { *m = MsgCreateAuction{} } +func (m *MsgCreateAuction) String() string { return proto.CompactTextString(m) } +func (*MsgCreateAuction) ProtoMessage() {} +func (*MsgCreateAuction) Descriptor() ([]byte, []int) { + return fileDescriptor_1684caa22ed7f7bf, []int{0} +} +func (m *MsgCreateAuction) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateAuction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateAuction.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 *MsgCreateAuction) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateAuction.Merge(m, src) +} +func (m *MsgCreateAuction) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateAuction) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateAuction.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateAuction proto.InternalMessageInfo + +// MsgCreateAuctionResponse returns the details of the created auction +type MsgCreateAuctionResponse struct { + // Auction details + Auction *Auction `protobuf:"bytes,1,opt,name=auction,proto3" json:"auction,omitempty" json:"auction" yaml:"auction"` +} + +func (m *MsgCreateAuctionResponse) Reset() { *m = MsgCreateAuctionResponse{} } +func (m *MsgCreateAuctionResponse) String() string { return proto.CompactTextString(m) } +func (*MsgCreateAuctionResponse) ProtoMessage() {} +func (*MsgCreateAuctionResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_1684caa22ed7f7bf, []int{1} +} +func (m *MsgCreateAuctionResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateAuctionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateAuctionResponse.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 *MsgCreateAuctionResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateAuctionResponse.Merge(m, src) +} +func (m *MsgCreateAuctionResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateAuctionResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateAuctionResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateAuctionResponse proto.InternalMessageInfo + +// CommitBid defines the message to commit a bid +type MsgCommitBid struct { + // Auction ID + AuctionId string `protobuf:"bytes,1,opt,name=auction_id,json=auctionId,proto3" json:"auction_id,omitempty" json:"auction_id" yaml:"auction_id"` + // Commit Hash + CommitHash string `protobuf:"bytes,2,opt,name=commit_hash,json=commitHash,proto3" json:"commit_hash,omitempty" json:"commit_hash" yaml:"commit_hash"` + // Address of the signer + Signer string `protobuf:"bytes,3,opt,name=signer,proto3" json:"signer,omitempty" json:"signer" yaml:"signer"` +} + +func (m *MsgCommitBid) Reset() { *m = MsgCommitBid{} } +func (m *MsgCommitBid) String() string { return proto.CompactTextString(m) } +func (*MsgCommitBid) ProtoMessage() {} +func (*MsgCommitBid) Descriptor() ([]byte, []int) { + return fileDescriptor_1684caa22ed7f7bf, []int{2} +} +func (m *MsgCommitBid) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCommitBid) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCommitBid.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 *MsgCommitBid) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCommitBid.Merge(m, src) +} +func (m *MsgCommitBid) XXX_Size() int { + return m.Size() +} +func (m *MsgCommitBid) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCommitBid.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCommitBid proto.InternalMessageInfo + +// RevealBid defines the message to reveal a bid +type MsgRevealBid struct { + // Auction ID + AuctionId string `protobuf:"bytes,1,opt,name=auction_id,json=auctionId,proto3" json:"auction_id,omitempty" json:"auction_id" yaml:"auction_id"` + // Commit Hash + Reveal string `protobuf:"bytes,2,opt,name=reveal,proto3" json:"reveal,omitempty" json:"reveal" yaml:"reveal"` + // Address of the signer + Signer string `protobuf:"bytes,3,opt,name=signer,proto3" json:"signer,omitempty" json:"signer" yaml:"signer"` +} + +func (m *MsgRevealBid) Reset() { *m = MsgRevealBid{} } +func (m *MsgRevealBid) String() string { return proto.CompactTextString(m) } +func (*MsgRevealBid) ProtoMessage() {} +func (*MsgRevealBid) Descriptor() ([]byte, []int) { + return fileDescriptor_1684caa22ed7f7bf, []int{3} +} +func (m *MsgRevealBid) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRevealBid) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRevealBid.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 *MsgRevealBid) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRevealBid.Merge(m, src) +} +func (m *MsgRevealBid) XXX_Size() int { + return m.Size() +} +func (m *MsgRevealBid) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRevealBid.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRevealBid proto.InternalMessageInfo + +// MsgCommitBidResponse returns the state of the auction after the bid creation +type MsgCommitBidResponse struct { + // Auction details + Bid *Bid `protobuf:"bytes,1,opt,name=bid,proto3" json:"bid,omitempty" json:"bid" yaml:"bid"` +} + +func (m *MsgCommitBidResponse) Reset() { *m = MsgCommitBidResponse{} } +func (m *MsgCommitBidResponse) String() string { return proto.CompactTextString(m) } +func (*MsgCommitBidResponse) ProtoMessage() {} +func (*MsgCommitBidResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_1684caa22ed7f7bf, []int{4} +} +func (m *MsgCommitBidResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCommitBidResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCommitBidResponse.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 *MsgCommitBidResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCommitBidResponse.Merge(m, src) +} +func (m *MsgCommitBidResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgCommitBidResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCommitBidResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCommitBidResponse proto.InternalMessageInfo + +// MsgRevealBidResponse returns the state of the auction after the bid reveal +type MsgRevealBidResponse struct { + // Auction details + Auction *Auction `protobuf:"bytes,1,opt,name=auction,proto3" json:"auction,omitempty" json:"auction" yaml:"auction"` +} + +func (m *MsgRevealBidResponse) Reset() { *m = MsgRevealBidResponse{} } +func (m *MsgRevealBidResponse) String() string { return proto.CompactTextString(m) } +func (*MsgRevealBidResponse) ProtoMessage() {} +func (*MsgRevealBidResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_1684caa22ed7f7bf, []int{5} +} +func (m *MsgRevealBidResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRevealBidResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRevealBidResponse.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 *MsgRevealBidResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRevealBidResponse.Merge(m, src) +} +func (m *MsgRevealBidResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgRevealBidResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRevealBidResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRevealBidResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgCreateAuction)(nil), "vulcanize.auction.v1beta1.MsgCreateAuction") + proto.RegisterType((*MsgCreateAuctionResponse)(nil), "vulcanize.auction.v1beta1.MsgCreateAuctionResponse") + proto.RegisterType((*MsgCommitBid)(nil), "vulcanize.auction.v1beta1.MsgCommitBid") + proto.RegisterType((*MsgRevealBid)(nil), "vulcanize.auction.v1beta1.MsgRevealBid") + proto.RegisterType((*MsgCommitBidResponse)(nil), "vulcanize.auction.v1beta1.MsgCommitBidResponse") + proto.RegisterType((*MsgRevealBidResponse)(nil), "vulcanize.auction.v1beta1.MsgRevealBidResponse") +} + +func init() { + proto.RegisterFile("vulcanize/auction/v1beta1/tx.proto", fileDescriptor_1684caa22ed7f7bf) +} + +var fileDescriptor_1684caa22ed7f7bf = []byte{ + // 691 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x55, 0x4f, 0x6f, 0xd3, 0x4e, + 0x10, 0x8d, 0x9b, 0x36, 0x3f, 0x65, 0xf3, 0x43, 0x54, 0x51, 0x91, 0xd2, 0x20, 0xec, 0x62, 0x54, + 0xb5, 0xa8, 0xe0, 0x55, 0xdb, 0x43, 0xa5, 0x72, 0xc2, 0x45, 0x15, 0x7f, 0xd4, 0x8b, 0x8f, 0x5c, + 0x22, 0x3b, 0xd9, 0x3a, 0x8b, 0x62, 0x6f, 0xf1, 0xda, 0x55, 0x8b, 0xc4, 0xa1, 0x37, 0x8e, 0x88, + 0x13, 0x47, 0x3e, 0x0d, 0xea, 0x09, 0xf5, 0xc8, 0x29, 0x40, 0xfb, 0x0d, 0xf2, 0x09, 0x90, 0x77, + 0x67, 0x6d, 0xc7, 0x85, 0x86, 0x00, 0xe2, 0x96, 0x99, 0x7d, 0x33, 0xef, 0xcd, 0xec, 0x73, 0x16, + 0x99, 0x87, 0xc9, 0xa0, 0xeb, 0x86, 0xf4, 0x15, 0xc1, 0x6e, 0xd2, 0x8d, 0x29, 0x0b, 0xf1, 0xe1, + 0xba, 0x47, 0x62, 0x77, 0x1d, 0xc7, 0x47, 0xd6, 0x41, 0xc4, 0x62, 0xd6, 0x5c, 0xcc, 0x30, 0x16, + 0x60, 0x2c, 0xc0, 0xb4, 0x17, 0x7c, 0xe6, 0x33, 0x81, 0xc2, 0xe9, 0x2f, 0x59, 0xd0, 0xd6, 0x7d, + 0xc6, 0xfc, 0x01, 0xc1, 0x22, 0xf2, 0x92, 0x7d, 0xdc, 0x4b, 0x22, 0x57, 0xd4, 0xc1, 0x79, 0x97, + 0xf1, 0x80, 0x71, 0xec, 0xb9, 0x9c, 0x64, 0x74, 0x5d, 0x46, 0xd5, 0xf9, 0xf2, 0x15, 0xa2, 0x8e, + 0x0f, 0x08, 0x97, 0x30, 0xf3, 0xdd, 0x1c, 0x9a, 0xdf, 0xe3, 0xfe, 0x4e, 0x44, 0xdc, 0x98, 0x3c, + 0x94, 0xc0, 0xe6, 0x89, 0x86, 0xe6, 0xbb, 0x2c, 0x08, 0x68, 0xcc, 0x3b, 0x8a, 0xb6, 0xa5, 0x2d, + 0x69, 0xab, 0x8d, 0x8d, 0x45, 0x4b, 0xea, 0xb2, 0x94, 0x2e, 0xeb, 0x11, 0x00, 0xec, 0x07, 0xa7, + 0x43, 0xa3, 0x32, 0x1a, 0x1a, 0xf8, 0x05, 0x67, 0xe1, 0xb6, 0x59, 0x6e, 0x60, 0x2e, 0x1d, 0xbb, + 0xc1, 0xe0, 0x07, 0xf9, 0xf7, 0x5f, 0x0c, 0xcd, 0xb9, 0x0e, 0x69, 0xd5, 0x4d, 0x68, 0x88, 0xc8, + 0x21, 0x71, 0x07, 0x05, 0x0d, 0x33, 0x53, 0x6a, 0x28, 0x37, 0x50, 0x1a, 0x2e, 0xe5, 0xa5, 0x06, + 0x48, 0x67, 0x1a, 0x08, 0x42, 0x52, 0x56, 0x67, 0x9f, 0x90, 0x56, 0x15, 0xc8, 0xe5, 0xe2, 0xad, + 0x74, 0xf1, 0xea, 0x0e, 0xad, 0x1d, 0x46, 0x43, 0x7b, 0x0d, 0xc8, 0xef, 0x14, 0x17, 0x90, 0x96, + 0x8e, 0x8f, 0x2e, 0x32, 0x4e, 0x5d, 0x06, 0xbb, 0x84, 0xa4, 0x34, 0x92, 0x59, 0xd0, 0xcc, 0x4e, + 0x49, 0x93, 0x97, 0x8e, 0x4f, 0x07, 0x34, 0x32, 0x48, 0x69, 0x28, 0x6a, 0x04, 0x34, 0xa4, 0x41, + 0x12, 0x74, 0x3c, 0xda, 0x6b, 0xcd, 0x4d, 0xe2, 0xb9, 0x0f, 0x3c, 0xcb, 0x92, 0xa7, 0x50, 0xab, + 0x88, 0x8a, 0x29, 0x07, 0x41, 0x64, 0xd3, 0x5e, 0x73, 0x0b, 0xd5, 0x38, 0xf5, 0x43, 0x12, 0xb5, + 0x6a, 0x4b, 0xda, 0x6a, 0xdd, 0x36, 0x46, 0x43, 0xe3, 0xa6, 0x6c, 0x23, 0xf3, 0xaa, 0x03, 0x44, + 0x0e, 0xc0, 0xb7, 0x67, 0xdf, 0x7c, 0x30, 0x2a, 0xe6, 0x89, 0x86, 0x5a, 0x65, 0x53, 0x3a, 0x84, + 0x1f, 0xb0, 0x90, 0x93, 0x66, 0x07, 0xfd, 0x07, 0x86, 0x06, 0x4b, 0x9a, 0xd6, 0x4f, 0xbf, 0x2d, + 0x0b, 0x8a, 0xed, 0xdb, 0xa3, 0xa1, 0x71, 0x4b, 0x0a, 0x00, 0x88, 0x52, 0xa0, 0x42, 0x47, 0x75, + 0x05, 0x0d, 0xdf, 0x34, 0xf4, 0x7f, 0xaa, 0x41, 0xdc, 0x52, 0x3a, 0xd3, 0x2e, 0x42, 0x80, 0xe8, + 0xd0, 0x9e, 0xa0, 0xae, 0xdb, 0x2b, 0xf9, 0x35, 0xe4, 0x67, 0xa5, 0xce, 0x69, 0xc6, 0xa9, 0x43, + 0xf0, 0xa4, 0xd7, 0x7c, 0x8a, 0x1a, 0xe0, 0x83, 0xbe, 0xcb, 0xfb, 0xc2, 0xd2, 0x75, 0xfb, 0x6e, + 0xbe, 0xe7, 0xc2, 0x61, 0xc9, 0x37, 0x22, 0xe5, 0x80, 0x25, 0x1f, 0xbb, 0xbc, 0x5f, 0xd8, 0x73, + 0xf5, 0x77, 0xf6, 0xfc, 0x49, 0xce, 0xe8, 0x08, 0x8b, 0xfc, 0xcd, 0x19, 0xb7, 0x50, 0x4d, 0xfa, + 0x0e, 0xc6, 0x2b, 0xe8, 0x92, 0xf9, 0x71, 0xab, 0x9a, 0x0e, 0xc0, 0xff, 0x74, 0x20, 0x8a, 0x16, + 0x8a, 0x77, 0x96, 0x79, 0xe6, 0x19, 0xaa, 0x7a, 0x30, 0x50, 0x63, 0x43, 0xbf, 0xc2, 0x2f, 0x36, + 0xed, 0xd9, 0x8b, 0xa3, 0xa1, 0x71, 0x43, 0x72, 0x16, 0xbc, 0x2e, 0x3c, 0x9e, 0x76, 0x01, 0xaa, + 0xd7, 0x82, 0x2a, 0x5b, 0xdd, 0x3f, 0xb6, 0xe7, 0xc6, 0xc7, 0x19, 0x54, 0xdd, 0xe3, 0x7e, 0xf3, + 0x25, 0xba, 0x36, 0xfe, 0xdf, 0xbd, 0x76, 0x05, 0x5d, 0xf9, 0x9b, 0x6a, 0x6f, 0x4e, 0x01, 0xce, + 0x26, 0x24, 0xa8, 0x9e, 0x7f, 0x15, 0x2b, 0x13, 0x3a, 0x28, 0x60, 0x1b, 0xff, 0x22, 0xb0, 0x48, + 0x93, 0x1b, 0x73, 0x02, 0x4d, 0x06, 0x9c, 0x44, 0x73, 0xe9, 0xbe, 0xec, 0xdd, 0xd3, 0x73, 0x5d, + 0x3b, 0x3b, 0xd7, 0xb5, 0xaf, 0xe7, 0xba, 0xf6, 0xf6, 0x42, 0xaf, 0x9c, 0x5d, 0xe8, 0x95, 0xcf, + 0x17, 0x7a, 0xe5, 0xf9, 0x3d, 0x9f, 0xc6, 0xfd, 0xc4, 0xb3, 0xba, 0x2c, 0xc0, 0x71, 0xdf, 0x8d, + 0x38, 0xe5, 0x98, 0xc4, 0x7d, 0x12, 0x05, 0x34, 0x8c, 0xf1, 0x51, 0xf6, 0xac, 0x8a, 0xe7, 0xd4, + 0xab, 0x89, 0xc7, 0x68, 0xf3, 0x7b, 0x00, 0x00, 0x00, 0xff, 0xff, 0xfd, 0xa6, 0x65, 0x14, 0x0d, + 0x08, 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 { + // CreateAuction is the command for creating an auction + CreateAuction(ctx context.Context, in *MsgCreateAuction, opts ...grpc.CallOption) (*MsgCreateAuctionResponse, error) + // CommitBid is the command for committing a bid + CommitBid(ctx context.Context, in *MsgCommitBid, opts ...grpc.CallOption) (*MsgCommitBidResponse, error) + //RevealBid is the command for revealing a bid + RevealBid(ctx context.Context, in *MsgRevealBid, opts ...grpc.CallOption) (*MsgRevealBidResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) CreateAuction(ctx context.Context, in *MsgCreateAuction, opts ...grpc.CallOption) (*MsgCreateAuctionResponse, error) { + out := new(MsgCreateAuctionResponse) + err := c.cc.Invoke(ctx, "/vulcanize.auction.v1beta1.Msg/CreateAuction", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) CommitBid(ctx context.Context, in *MsgCommitBid, opts ...grpc.CallOption) (*MsgCommitBidResponse, error) { + out := new(MsgCommitBidResponse) + err := c.cc.Invoke(ctx, "/vulcanize.auction.v1beta1.Msg/CommitBid", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) RevealBid(ctx context.Context, in *MsgRevealBid, opts ...grpc.CallOption) (*MsgRevealBidResponse, error) { + out := new(MsgRevealBidResponse) + err := c.cc.Invoke(ctx, "/vulcanize.auction.v1beta1.Msg/RevealBid", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + // CreateAuction is the command for creating an auction + CreateAuction(context.Context, *MsgCreateAuction) (*MsgCreateAuctionResponse, error) + // CommitBid is the command for committing a bid + CommitBid(context.Context, *MsgCommitBid) (*MsgCommitBidResponse, error) + //RevealBid is the command for revealing a bid + RevealBid(context.Context, *MsgRevealBid) (*MsgRevealBidResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) CreateAuction(ctx context.Context, req *MsgCreateAuction) (*MsgCreateAuctionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateAuction not implemented") +} +func (*UnimplementedMsgServer) CommitBid(ctx context.Context, req *MsgCommitBid) (*MsgCommitBidResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CommitBid not implemented") +} +func (*UnimplementedMsgServer) RevealBid(ctx context.Context, req *MsgRevealBid) (*MsgRevealBidResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RevealBid not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_CreateAuction_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgCreateAuction) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).CreateAuction(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vulcanize.auction.v1beta1.Msg/CreateAuction", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).CreateAuction(ctx, req.(*MsgCreateAuction)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_CommitBid_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgCommitBid) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).CommitBid(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vulcanize.auction.v1beta1.Msg/CommitBid", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).CommitBid(ctx, req.(*MsgCommitBid)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_RevealBid_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgRevealBid) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).RevealBid(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vulcanize.auction.v1beta1.Msg/RevealBid", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).RevealBid(ctx, req.(*MsgRevealBid)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "vulcanize.auction.v1beta1.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreateAuction", + Handler: _Msg_CreateAuction_Handler, + }, + { + MethodName: "CommitBid", + Handler: _Msg_CommitBid_Handler, + }, + { + MethodName: "RevealBid", + Handler: _Msg_RevealBid_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "vulcanize/auction/v1beta1/tx.proto", +} + +func (m *MsgCreateAuction) 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 *MsgCreateAuction) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateAuction) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Signer) > 0 { + i -= len(m.Signer) + copy(dAtA[i:], m.Signer) + i = encodeVarintTx(dAtA, i, uint64(len(m.Signer))) + i-- + dAtA[i] = 0x32 + } + { + size, err := m.MinimumBid.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + { + size, err := m.RevealFee.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + { + size, err := m.CommitFee.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + n4, err4 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.RevealsDuration, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.RevealsDuration):]) + if err4 != nil { + return 0, err4 + } + i -= n4 + i = encodeVarintTx(dAtA, i, uint64(n4)) + i-- + dAtA[i] = 0x12 + n5, err5 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.CommitsDuration, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.CommitsDuration):]) + if err5 != nil { + return 0, err5 + } + i -= n5 + i = encodeVarintTx(dAtA, i, uint64(n5)) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *MsgCreateAuctionResponse) 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 *MsgCreateAuctionResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateAuctionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Auction != nil { + { + size, err := m.Auction.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgCommitBid) 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 *MsgCommitBid) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCommitBid) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Signer) > 0 { + i -= len(m.Signer) + copy(dAtA[i:], m.Signer) + i = encodeVarintTx(dAtA, i, uint64(len(m.Signer))) + i-- + dAtA[i] = 0x1a + } + if len(m.CommitHash) > 0 { + i -= len(m.CommitHash) + copy(dAtA[i:], m.CommitHash) + i = encodeVarintTx(dAtA, i, uint64(len(m.CommitHash))) + i-- + dAtA[i] = 0x12 + } + if len(m.AuctionId) > 0 { + i -= len(m.AuctionId) + copy(dAtA[i:], m.AuctionId) + i = encodeVarintTx(dAtA, i, uint64(len(m.AuctionId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgRevealBid) 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 *MsgRevealBid) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRevealBid) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Signer) > 0 { + i -= len(m.Signer) + copy(dAtA[i:], m.Signer) + i = encodeVarintTx(dAtA, i, uint64(len(m.Signer))) + i-- + dAtA[i] = 0x1a + } + if len(m.Reveal) > 0 { + i -= len(m.Reveal) + copy(dAtA[i:], m.Reveal) + i = encodeVarintTx(dAtA, i, uint64(len(m.Reveal))) + i-- + dAtA[i] = 0x12 + } + if len(m.AuctionId) > 0 { + i -= len(m.AuctionId) + copy(dAtA[i:], m.AuctionId) + i = encodeVarintTx(dAtA, i, uint64(len(m.AuctionId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgCommitBidResponse) 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 *MsgCommitBidResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCommitBidResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Bid != nil { + { + size, err := m.Bid.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgRevealBidResponse) 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 *MsgRevealBidResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRevealBidResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Auction != nil { + { + size, err := m.Auction.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + 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 *MsgCreateAuction) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.CommitsDuration) + n += 1 + l + sovTx(uint64(l)) + l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.RevealsDuration) + n += 1 + l + sovTx(uint64(l)) + l = m.CommitFee.Size() + n += 1 + l + sovTx(uint64(l)) + l = m.RevealFee.Size() + n += 1 + l + sovTx(uint64(l)) + l = m.MinimumBid.Size() + n += 1 + l + sovTx(uint64(l)) + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgCreateAuctionResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Auction != nil { + l = m.Auction.Size() + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgCommitBid) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.AuctionId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.CommitHash) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgRevealBid) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.AuctionId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Reveal) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgCommitBidResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Bid != nil { + l = m.Bid.Size() + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgRevealBidResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Auction != nil { + l = m.Auction.Size() + n += 1 + l + sovTx(uint64(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 *MsgCreateAuction) 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: MsgCreateAuction: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateAuction: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommitsDuration", 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 + } + if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.CommitsDuration, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RevealsDuration", 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 + } + if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.RevealsDuration, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommitFee", 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 + } + if err := m.CommitFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RevealFee", 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 + } + if err := m.RevealFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinimumBid", 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 + } + if err := m.MinimumBid.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signer", 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.Signer = string(dAtA[iNdEx:postIndex]) + 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 *MsgCreateAuctionResponse) 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: MsgCreateAuctionResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateAuctionResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Auction", 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 + } + if m.Auction == nil { + m.Auction = &Auction{} + } + if err := m.Auction.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 *MsgCommitBid) 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: MsgCommitBid: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCommitBid: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AuctionId", 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.AuctionId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommitHash", 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.CommitHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signer", 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.Signer = string(dAtA[iNdEx:postIndex]) + 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 *MsgRevealBid) 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: MsgRevealBid: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRevealBid: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AuctionId", 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.AuctionId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Reveal", 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.Reveal = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signer", 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.Signer = string(dAtA[iNdEx:postIndex]) + 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 *MsgCommitBidResponse) 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: MsgCommitBidResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCommitBidResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Bid", 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 + } + if m.Bid == nil { + m.Bid = &Bid{} + } + if err := m.Bid.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 *MsgRevealBidResponse) 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: MsgRevealBidResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRevealBidResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Auction", 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 + } + if m.Auction == nil { + m.Auction = &Auction{} + } + if err := m.Auction.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 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/auction/types/types.go b/x/auction/types/types.go new file mode 100644 index 00000000..db56bef1 --- /dev/null +++ b/x/auction/types/types.go @@ -0,0 +1,65 @@ +package types + +import ( + "crypto/sha256" + "encoding/hex" + "fmt" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// Auction status values. +const ( + // Auction is in commit phase. + AuctionStatusCommitPhase = "commit" + + // Auction is in reveal phase. + AuctionStatusRevealPhase = "reveal" + + // Auction has ended (no reveals allowed). + AuctionStatusExpired = "expired" + + // Auction has completed (winner selected). + AuctionStatusCompleted = "completed" +) + +// Bid status values. +const ( + BidStatusCommitted = "commit" + BidStatusRevealed = "reveal" +) + +// AuctionID simplifies generation of auction IDs. +type AuctionID struct { + Address sdk.Address + AccNum uint64 + Sequence uint64 +} + +// Generate creates the auction ID. +func (auctionID AuctionID) Generate() string { + hasher := sha256.New() + str := fmt.Sprintf("%s:%d:%d", auctionID.Address.String(), auctionID.AccNum, auctionID.Sequence) + hasher.Write([]byte(str)) + return hex.EncodeToString(hasher.Sum(nil)) +} + +func (auction Auction) GetCreateTime() string { + return string(sdk.FormatTimeBytes(auction.CreateTime)) +} + +func (auction Auction) GetCommitsEndTime() string { + return string(sdk.FormatTimeBytes(auction.CommitsEndTime)) +} + +func (auction Auction) GetRevealsEndTime() string { + return string(sdk.FormatTimeBytes(auction.RevealsEndTime)) +} + +func (bid Bid) GetCommitTime() string { + return string(sdk.FormatTimeBytes(bid.CommitTime)) +} + +func (bid Bid) GetRevealTime() string { + return string(sdk.FormatTimeBytes(bid.RevealTime)) +} diff --git a/x/auction/types/types.pb.go b/x/auction/types/types.pb.go new file mode 100644 index 00000000..8e9465a7 --- /dev/null +++ b/x/auction/types/types.pb.go @@ -0,0 +1,1943 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: vulcanize/auction/v1beta1/types.proto + +package types + +import ( + fmt "fmt" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + _ "google.golang.org/protobuf/types/known/durationpb" + _ "google.golang.org/protobuf/types/known/timestamppb" + io "io" + math "math" + math_bits "math/bits" + time "time" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// 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 auction module parameters +type Params struct { + // Duration of the commits phase in seconds + CommitsDuration time.Duration `protobuf:"bytes,1,opt,name=commits_duration,json=commitsDuration,proto3,stdduration" json:"commits_duration" json:"commits_duration" yaml:"commits_duration"` + // Duration of the reveals phase in seconds + RevealsDuration time.Duration `protobuf:"bytes,2,opt,name=reveals_duration,json=revealsDuration,proto3,stdduration" json:"reveals_duration" json:"reveals_duration" yaml:"reveals_duration"` + // Commit fees + CommitFee types.Coin `protobuf:"bytes,3,opt,name=commit_fee,json=commitFee,proto3" json:"commit_fee" json:"commit_fee" yaml:"commit_fee"` + // Reveal fees + RevealFee types.Coin `protobuf:"bytes,4,opt,name=reveal_fee,json=revealFee,proto3" json:"reveal_fee" json:"reveal_fee" yaml:"reveal_fee"` + // Minimum acceptable bid amount + MinimumBid types.Coin `protobuf:"bytes,5,opt,name=minimum_bid,json=minimumBid,proto3" json:"minimum_bid" json:"minimum_bid" yaml:"minimum_bid"` +} + +func (m *Params) Reset() { *m = Params{} } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_4ef8053ad65dd4d3, []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 (m *Params) GetCommitsDuration() time.Duration { + if m != nil { + return m.CommitsDuration + } + return 0 +} + +func (m *Params) GetRevealsDuration() time.Duration { + if m != nil { + return m.RevealsDuration + } + return 0 +} + +func (m *Params) GetCommitFee() types.Coin { + if m != nil { + return m.CommitFee + } + return types.Coin{} +} + +func (m *Params) GetRevealFee() types.Coin { + if m != nil { + return m.RevealFee + } + return types.Coin{} +} + +func (m *Params) GetMinimumBid() types.Coin { + if m != nil { + return m.MinimumBid + } + return types.Coin{} +} + +// Auction represents a sealed-bid on-chain auction +type Auction struct { + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Status string `protobuf:"bytes,2,opt,name=status,proto3" json:"status,omitempty"` + // Address of the creator of the auction + OwnerAddress string `protobuf:"bytes,3,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address,omitempty"` + // Timestamp at which the auction was created + CreateTime time.Time `protobuf:"bytes,4,opt,name=create_time,json=createTime,proto3,stdtime" json:"create_time" json:"create_time" yaml:"create_time"` + // Timestamp at which the commits phase concluded + CommitsEndTime time.Time `protobuf:"bytes,5,opt,name=commits_end_time,json=commitsEndTime,proto3,stdtime" json:"commits_end_time" json:"commits_end_time" yaml:"commits_end_time"` + // Timestamp at which the reveals phase concluded + RevealsEndTime time.Time `protobuf:"bytes,6,opt,name=reveals_end_time,json=revealsEndTime,proto3,stdtime" json:"reveals_end_time" json:"reveals_end_time" yaml:"reveals_end_time"` + // Commit and reveal fees must both be paid when committing a bid + // Reveal fee is returned only if the bid is revealed + CommitFee types.Coin `protobuf:"bytes,7,opt,name=commit_fee,json=commitFee,proto3" json:"commit_fee" json:"commit_fee" yaml:"commit_fee"` + RevealFee types.Coin `protobuf:"bytes,8,opt,name=reveal_fee,json=revealFee,proto3" json:"reveal_fee" json:"reveal_fee" yaml:"reveal_fee"` + // Minimum acceptable bid amount for a valid commit + MinimumBid types.Coin `protobuf:"bytes,9,opt,name=minimum_bid,json=minimumBid,proto3" json:"minimum_bid" json:"minimum_bid" yaml:"minimum_bid"` + // Address of the winner + WinnerAddress string `protobuf:"bytes,10,opt,name=winner_address,json=winnerAddress,proto3" json:"winner_address,omitempty"` + // Winning bid, i.e., the highest bid + WinningBid types.Coin `protobuf:"bytes,11,opt,name=winning_bid,json=winningBid,proto3" json:"winning_bid" json:"winning_bid" yaml:"winning_bid"` + // Amount the winner pays, i.e. the second highest auction + WinningPrice types.Coin `protobuf:"bytes,12,opt,name=winning_price,json=winningPrice,proto3" json:"winning_price" json:"winning_price" yaml:"winning_price"` +} + +func (m *Auction) Reset() { *m = Auction{} } +func (m *Auction) String() string { return proto.CompactTextString(m) } +func (*Auction) ProtoMessage() {} +func (*Auction) Descriptor() ([]byte, []int) { + return fileDescriptor_4ef8053ad65dd4d3, []int{1} +} +func (m *Auction) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Auction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Auction.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 *Auction) XXX_Merge(src proto.Message) { + xxx_messageInfo_Auction.Merge(m, src) +} +func (m *Auction) XXX_Size() int { + return m.Size() +} +func (m *Auction) XXX_DiscardUnknown() { + xxx_messageInfo_Auction.DiscardUnknown(m) +} + +var xxx_messageInfo_Auction proto.InternalMessageInfo + +type Auctions struct { + Auctions []Auction `protobuf:"bytes,1,rep,name=auctions,proto3" json:"auctions"` +} + +func (m *Auctions) Reset() { *m = Auctions{} } +func (m *Auctions) String() string { return proto.CompactTextString(m) } +func (*Auctions) ProtoMessage() {} +func (*Auctions) Descriptor() ([]byte, []int) { + return fileDescriptor_4ef8053ad65dd4d3, []int{2} +} +func (m *Auctions) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Auctions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Auctions.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 *Auctions) XXX_Merge(src proto.Message) { + xxx_messageInfo_Auctions.Merge(m, src) +} +func (m *Auctions) XXX_Size() int { + return m.Size() +} +func (m *Auctions) XXX_DiscardUnknown() { + xxx_messageInfo_Auctions.DiscardUnknown(m) +} + +var xxx_messageInfo_Auctions proto.InternalMessageInfo + +// Bid represents a sealed bid (commit) made during the auction +type Bid struct { + AuctionId string `protobuf:"bytes,1,opt,name=auction_id,json=auctionId,proto3" json:"auction_id,omitempty"` + BidderAddress string `protobuf:"bytes,2,opt,name=bidder_address,json=bidderAddress,proto3" json:"bidder_address,omitempty"` + Status string `protobuf:"bytes,3,opt,name=status,proto3" json:"status,omitempty"` + CommitHash string `protobuf:"bytes,4,opt,name=commit_hash,json=commitHash,proto3" json:"commit_hash,omitempty"` + CommitTime time.Time `protobuf:"bytes,5,opt,name=commit_time,json=commitTime,proto3,stdtime" json:"commit_time" json:"commit_time" yaml:"commit_time"` + CommitFee types.Coin `protobuf:"bytes,6,opt,name=commit_fee,json=commitFee,proto3" json:"commit_fee" json:"commit_fee" yaml:"commit_fee"` + RevealTime time.Time `protobuf:"bytes,7,opt,name=reveal_time,json=revealTime,proto3,stdtime" json:"reveal_time" json:"reveal_time" yaml:"reveal_time"` + RevealFee types.Coin `protobuf:"bytes,8,opt,name=reveal_fee,json=revealFee,proto3" json:"reveal_fee" json:"reveal_fee" yaml:"reveal_fee"` + BidAmount types.Coin `protobuf:"bytes,9,opt,name=bid_amount,json=bidAmount,proto3" json:"bid_amount" json:"bid_amount" yaml:"bid_amount"` +} + +func (m *Bid) Reset() { *m = Bid{} } +func (m *Bid) String() string { return proto.CompactTextString(m) } +func (*Bid) ProtoMessage() {} +func (*Bid) Descriptor() ([]byte, []int) { + return fileDescriptor_4ef8053ad65dd4d3, []int{3} +} +func (m *Bid) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Bid) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Bid.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 *Bid) XXX_Merge(src proto.Message) { + xxx_messageInfo_Bid.Merge(m, src) +} +func (m *Bid) XXX_Size() int { + return m.Size() +} +func (m *Bid) XXX_DiscardUnknown() { + xxx_messageInfo_Bid.DiscardUnknown(m) +} + +var xxx_messageInfo_Bid proto.InternalMessageInfo + +func init() { + proto.RegisterType((*Params)(nil), "vulcanize.auction.v1beta1.Params") + proto.RegisterType((*Auction)(nil), "vulcanize.auction.v1beta1.Auction") + proto.RegisterType((*Auctions)(nil), "vulcanize.auction.v1beta1.Auctions") + proto.RegisterType((*Bid)(nil), "vulcanize.auction.v1beta1.Bid") +} + +func init() { + proto.RegisterFile("vulcanize/auction/v1beta1/types.proto", fileDescriptor_4ef8053ad65dd4d3) +} + +var fileDescriptor_4ef8053ad65dd4d3 = []byte{ + // 809 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0x4d, 0x4f, 0xdb, 0x4a, + 0x14, 0x8d, 0x49, 0x08, 0xf1, 0x98, 0xf0, 0x9e, 0xac, 0xa7, 0xa7, 0x80, 0xd4, 0x04, 0x05, 0x21, + 0x51, 0xb5, 0xb5, 0x05, 0xdd, 0xd1, 0x15, 0x29, 0x45, 0xed, 0x0e, 0x59, 0x55, 0x17, 0xdd, 0x44, + 0x63, 0x7b, 0x48, 0xa6, 0x8a, 0x3d, 0xa9, 0x67, 0x0c, 0xa5, 0xbb, 0xee, 0xba, 0x44, 0x5d, 0xb1, + 0x6b, 0x7f, 0x0e, 0xbb, 0xb2, 0xec, 0x8a, 0x56, 0xf0, 0x0f, 0xfa, 0x0b, 0x2a, 0xcf, 0x87, 0x33, + 0x36, 0xa0, 0x34, 0x0b, 0xd8, 0x65, 0xce, 0xcc, 0xbd, 0xe7, 0xdc, 0x99, 0x7b, 0x6e, 0x0c, 0xd6, + 0x0f, 0xd3, 0x51, 0x00, 0x63, 0xfc, 0x11, 0xb9, 0x30, 0x0d, 0x18, 0x26, 0xb1, 0x7b, 0xb8, 0xe9, + 0x23, 0x06, 0x37, 0x5d, 0x76, 0x3c, 0x46, 0xd4, 0x19, 0x27, 0x84, 0x11, 0x7b, 0x39, 0x3f, 0xe6, + 0xc8, 0x63, 0x8e, 0x3c, 0xb6, 0xf2, 0xdf, 0x80, 0x0c, 0x08, 0x3f, 0xe5, 0x66, 0xbf, 0x44, 0xc0, + 0x4a, 0x7b, 0x40, 0xc8, 0x60, 0x84, 0x5c, 0xbe, 0xf2, 0xd3, 0x03, 0x37, 0x4c, 0x13, 0xc8, 0xe3, + 0xc4, 0x7e, 0xa7, 0xbc, 0xcf, 0x70, 0x84, 0x28, 0x83, 0xd1, 0x58, 0x25, 0x08, 0x08, 0x8d, 0x08, + 0x75, 0x7d, 0x48, 0x51, 0x2e, 0x29, 0x20, 0x58, 0x26, 0xe8, 0x7e, 0xaf, 0x81, 0xfa, 0x3e, 0x4c, + 0x60, 0x44, 0xed, 0x4f, 0x06, 0xf8, 0x37, 0x20, 0x51, 0x84, 0x19, 0xed, 0x2b, 0x9a, 0x96, 0xb1, + 0x6a, 0x6c, 0x58, 0x5b, 0xcb, 0x8e, 0xe0, 0x71, 0x14, 0x8f, 0xb3, 0x2b, 0x0f, 0xf4, 0x9e, 0x9d, + 0x5d, 0x74, 0x2a, 0xbf, 0x2f, 0x3a, 0xee, 0x3b, 0x4a, 0xe2, 0xed, 0x6e, 0x39, 0x41, 0x77, 0xf5, + 0x18, 0x46, 0xa3, 0x1b, 0xf0, 0xd3, 0x9f, 0x1d, 0xc3, 0xfb, 0x47, 0xc2, 0x2a, 0x1b, 0xd7, 0x90, + 0xa0, 0x43, 0x04, 0x47, 0x9a, 0x86, 0xb9, 0x19, 0x35, 0x94, 0x13, 0x28, 0x0d, 0xd7, 0x70, 0xa1, + 0x41, 0xc2, 0xb9, 0x06, 0x04, 0x80, 0x90, 0xd5, 0x3f, 0x40, 0xa8, 0x55, 0x95, 0xe4, 0xe2, 0x1e, + 0x9d, 0xec, 0x1e, 0xd5, 0x9b, 0x39, 0xcf, 0x09, 0x8e, 0x7b, 0x8f, 0x24, 0xf9, 0x9a, 0x7e, 0x01, + 0x59, 0x68, 0xb1, 0x74, 0x8e, 0x78, 0xa6, 0x58, 0xec, 0x21, 0x94, 0xd1, 0x08, 0x66, 0x4e, 0x53, + 0x9b, 0x91, 0x66, 0x12, 0x5a, 0xac, 0x4e, 0xd2, 0x88, 0x45, 0x46, 0x83, 0x81, 0x15, 0xe1, 0x18, + 0x47, 0x69, 0xd4, 0xf7, 0x71, 0xd8, 0x9a, 0x9f, 0xc6, 0xf3, 0x44, 0xf2, 0xac, 0x0b, 0x1e, 0x2d, + 0x56, 0x11, 0xe9, 0x90, 0x07, 0xe4, 0xaa, 0x87, 0xc3, 0xed, 0xda, 0xe9, 0xb7, 0x4e, 0xa5, 0xfb, + 0xa5, 0x01, 0x16, 0x76, 0x44, 0x73, 0xdb, 0x4b, 0x60, 0x0e, 0x87, 0xbc, 0x87, 0x4c, 0x6f, 0x0e, + 0x87, 0xf6, 0xff, 0xa0, 0x4e, 0x19, 0x64, 0x29, 0xe5, 0x6f, 0x6a, 0x7a, 0x72, 0x65, 0xaf, 0x81, + 0x26, 0x39, 0x8a, 0x51, 0xd2, 0x87, 0x61, 0x98, 0x20, 0x4a, 0xf9, 0xad, 0x9b, 0xde, 0x22, 0x07, + 0x77, 0x04, 0x66, 0xc7, 0xc0, 0x0a, 0x12, 0x04, 0x19, 0xea, 0x67, 0x4d, 0x2e, 0x6f, 0x6c, 0xe5, + 0x5a, 0x57, 0xbc, 0x56, 0x0e, 0xe8, 0x6d, 0x16, 0x4b, 0xd1, 0x82, 0xf3, 0xa7, 0xd1, 0xa0, 0x93, + 0xac, 0x19, 0x80, 0x40, 0xb2, 0x1c, 0x05, 0x3f, 0xa0, 0x38, 0x14, 0xac, 0xf3, 0x53, 0x59, 0x6f, + 0x31, 0x84, 0xca, 0x50, 0x36, 0x44, 0x8e, 0x73, 0xfe, 0x25, 0x09, 0xbf, 0x88, 0xc3, 0x5c, 0x83, + 0x6a, 0xdb, 0x5c, 0x43, 0x7d, 0x56, 0x0d, 0xe5, 0x0c, 0x65, 0x43, 0x94, 0x34, 0x48, 0x58, 0x69, + 0x28, 0xfa, 0x61, 0xe1, 0x7e, 0xfc, 0xd0, 0xb8, 0x27, 0x3f, 0x98, 0x77, 0xe7, 0x07, 0x7b, 0x1d, + 0x2c, 0x1d, 0xe1, 0x58, 0x6f, 0x6b, 0xc0, 0xdb, 0xba, 0x29, 0x50, 0xd5, 0xd7, 0x18, 0x58, 0x19, + 0x80, 0xe3, 0x01, 0x57, 0x64, 0xcd, 0xa8, 0x48, 0x8b, 0x55, 0x8a, 0x74, 0xc8, 0x03, 0x72, 0x95, + 0x29, 0x7a, 0x0f, 0x9a, 0x6a, 0x6f, 0x9c, 0xe0, 0x00, 0xb5, 0x16, 0xa7, 0x91, 0x29, 0x0f, 0x3d, + 0x2c, 0x92, 0xf1, 0xe8, 0x32, 0x9d, 0x00, 0xbd, 0x45, 0xb9, 0xde, 0xcf, 0x96, 0xdb, 0xb5, 0xcf, + 0xd9, 0x50, 0x78, 0x03, 0x1a, 0x72, 0x26, 0x50, 0x7b, 0x17, 0x34, 0xe4, 0x9f, 0x1f, 0x6d, 0x19, + 0xab, 0xd5, 0x0d, 0x6b, 0xab, 0xeb, 0xdc, 0xfa, 0xbf, 0xe8, 0xc8, 0xb0, 0x5e, 0x2d, 0x13, 0xe2, + 0xe5, 0x91, 0x32, 0xef, 0xd7, 0x79, 0x50, 0xcd, 0x0a, 0x7b, 0x00, 0x80, 0xdc, 0xe9, 0xe7, 0x03, + 0xc7, 0x94, 0xc8, 0x2b, 0xfe, 0x12, 0x3e, 0x0e, 0x43, 0xed, 0x25, 0xc4, 0xfc, 0x69, 0x0a, 0x54, + 0xbd, 0xc4, 0x64, 0x3c, 0x55, 0x0b, 0xe3, 0xa9, 0x03, 0x2c, 0xd9, 0xb4, 0x43, 0x48, 0x87, 0x7c, + 0xf2, 0x98, 0x9e, 0x34, 0xc5, 0x4b, 0x48, 0x87, 0x7c, 0x34, 0x89, 0x03, 0x7f, 0x39, 0x24, 0xca, + 0xa3, 0x69, 0x12, 0x5c, 0x72, 0x89, 0x3e, 0x9a, 0x38, 0x72, 0x83, 0x25, 0xeb, 0x77, 0x65, 0xc9, + 0x18, 0x58, 0xd2, 0x45, 0xbc, 0xac, 0x85, 0x59, 0xcb, 0xd2, 0x82, 0x4b, 0xae, 0xd4, 0xca, 0x12, + 0x88, 0x2a, 0xeb, 0x3e, 0x46, 0x00, 0x02, 0xc0, 0xc7, 0x61, 0x1f, 0x46, 0x24, 0x8d, 0xd9, 0xf4, + 0x09, 0x50, 0xa2, 0x99, 0x84, 0x2a, 0x1a, 0x0d, 0xf1, 0x4c, 0x1f, 0x87, 0x3b, 0xfc, 0xb7, 0xe8, + 0xd0, 0xde, 0xde, 0xd9, 0x65, 0xdb, 0x38, 0xbf, 0x6c, 0x1b, 0xbf, 0x2e, 0xdb, 0xc6, 0xc9, 0x55, + 0xbb, 0x72, 0x7e, 0xd5, 0xae, 0xfc, 0xb8, 0x6a, 0x57, 0xde, 0x3e, 0x1e, 0x60, 0x36, 0x4c, 0x7d, + 0x27, 0x20, 0x91, 0xcb, 0x86, 0x30, 0xa1, 0x98, 0xba, 0x88, 0x0d, 0x51, 0x12, 0xe1, 0x98, 0xb9, + 0x1f, 0xf2, 0x0f, 0x49, 0xfe, 0x01, 0xe9, 0xd7, 0xf9, 0x75, 0x3f, 0xfd, 0x13, 0x00, 0x00, 0xff, + 0xff, 0xb9, 0xce, 0x8c, 0x23, 0x6a, 0x0a, 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 + { + size, err := m.MinimumBid.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + { + size, err := m.RevealFee.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + { + size, err := m.CommitFee.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + n4, err4 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.RevealsDuration, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.RevealsDuration):]) + if err4 != nil { + return 0, err4 + } + i -= n4 + i = encodeVarintTypes(dAtA, i, uint64(n4)) + i-- + dAtA[i] = 0x12 + n5, err5 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.CommitsDuration, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.CommitsDuration):]) + if err5 != nil { + return 0, err5 + } + i -= n5 + i = encodeVarintTypes(dAtA, i, uint64(n5)) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *Auction) 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 *Auction) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Auction) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.WinningPrice.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x62 + { + size, err := m.WinningBid.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x5a + if len(m.WinnerAddress) > 0 { + i -= len(m.WinnerAddress) + copy(dAtA[i:], m.WinnerAddress) + i = encodeVarintTypes(dAtA, i, uint64(len(m.WinnerAddress))) + i-- + dAtA[i] = 0x52 + } + { + size, err := m.MinimumBid.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x4a + { + size, err := m.RevealFee.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x42 + { + size, err := m.CommitFee.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + n11, err11 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.RevealsEndTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.RevealsEndTime):]) + if err11 != nil { + return 0, err11 + } + i -= n11 + i = encodeVarintTypes(dAtA, i, uint64(n11)) + i-- + dAtA[i] = 0x32 + n12, err12 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CommitsEndTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CommitsEndTime):]) + if err12 != nil { + return 0, err12 + } + i -= n12 + i = encodeVarintTypes(dAtA, i, uint64(n12)) + i-- + dAtA[i] = 0x2a + n13, err13 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CreateTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CreateTime):]) + if err13 != nil { + return 0, err13 + } + i -= n13 + i = encodeVarintTypes(dAtA, i, uint64(n13)) + i-- + dAtA[i] = 0x22 + if len(m.OwnerAddress) > 0 { + i -= len(m.OwnerAddress) + copy(dAtA[i:], m.OwnerAddress) + i = encodeVarintTypes(dAtA, i, uint64(len(m.OwnerAddress))) + i-- + dAtA[i] = 0x1a + } + if len(m.Status) > 0 { + i -= len(m.Status) + copy(dAtA[i:], m.Status) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Status))) + i-- + dAtA[i] = 0x12 + } + if len(m.Id) > 0 { + i -= len(m.Id) + copy(dAtA[i:], m.Id) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Id))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Auctions) 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 *Auctions) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Auctions) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Auctions) > 0 { + for iNdEx := len(m.Auctions) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Auctions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *Bid) 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 *Bid) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Bid) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.BidAmount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x4a + { + size, err := m.RevealFee.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x42 + n16, err16 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.RevealTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.RevealTime):]) + if err16 != nil { + return 0, err16 + } + i -= n16 + i = encodeVarintTypes(dAtA, i, uint64(n16)) + i-- + dAtA[i] = 0x3a + { + size, err := m.CommitFee.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + n18, err18 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CommitTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CommitTime):]) + if err18 != nil { + return 0, err18 + } + i -= n18 + i = encodeVarintTypes(dAtA, i, uint64(n18)) + i-- + dAtA[i] = 0x2a + if len(m.CommitHash) > 0 { + i -= len(m.CommitHash) + copy(dAtA[i:], m.CommitHash) + i = encodeVarintTypes(dAtA, i, uint64(len(m.CommitHash))) + i-- + dAtA[i] = 0x22 + } + if len(m.Status) > 0 { + i -= len(m.Status) + copy(dAtA[i:], m.Status) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Status))) + i-- + dAtA[i] = 0x1a + } + if len(m.BidderAddress) > 0 { + i -= len(m.BidderAddress) + copy(dAtA[i:], m.BidderAddress) + i = encodeVarintTypes(dAtA, i, uint64(len(m.BidderAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.AuctionId) > 0 { + i -= len(m.AuctionId) + copy(dAtA[i:], m.AuctionId) + i = encodeVarintTypes(dAtA, i, uint64(len(m.AuctionId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { + offset -= sovTypes(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 + l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.CommitsDuration) + n += 1 + l + sovTypes(uint64(l)) + l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.RevealsDuration) + n += 1 + l + sovTypes(uint64(l)) + l = m.CommitFee.Size() + n += 1 + l + sovTypes(uint64(l)) + l = m.RevealFee.Size() + n += 1 + l + sovTypes(uint64(l)) + l = m.MinimumBid.Size() + n += 1 + l + sovTypes(uint64(l)) + return n +} + +func (m *Auction) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Id) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.Status) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.OwnerAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.CreateTime) + n += 1 + l + sovTypes(uint64(l)) + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.CommitsEndTime) + n += 1 + l + sovTypes(uint64(l)) + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.RevealsEndTime) + n += 1 + l + sovTypes(uint64(l)) + l = m.CommitFee.Size() + n += 1 + l + sovTypes(uint64(l)) + l = m.RevealFee.Size() + n += 1 + l + sovTypes(uint64(l)) + l = m.MinimumBid.Size() + n += 1 + l + sovTypes(uint64(l)) + l = len(m.WinnerAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = m.WinningBid.Size() + n += 1 + l + sovTypes(uint64(l)) + l = m.WinningPrice.Size() + n += 1 + l + sovTypes(uint64(l)) + return n +} + +func (m *Auctions) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Auctions) > 0 { + for _, e := range m.Auctions { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + return n +} + +func (m *Bid) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.AuctionId) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.BidderAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.Status) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.CommitHash) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.CommitTime) + n += 1 + l + sovTypes(uint64(l)) + l = m.CommitFee.Size() + n += 1 + l + sovTypes(uint64(l)) + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.RevealTime) + n += 1 + l + sovTypes(uint64(l)) + l = m.RevealFee.Size() + n += 1 + l + sovTypes(uint64(l)) + l = m.BidAmount.Size() + n += 1 + l + sovTypes(uint64(l)) + return n +} + +func sovTypes(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTypes(x uint64) (n int) { + return sovTypes(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 ErrIntOverflowTypes + } + 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 { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommitsDuration", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.CommitsDuration, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RevealsDuration", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.RevealsDuration, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommitFee", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommitFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RevealFee", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RevealFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinimumBid", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MinimumBid.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Auction) 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 ErrIntOverflowTypes + } + 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: Auction: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Auction: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Id = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Status = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OwnerAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CreateTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.CreateTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommitsEndTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.CommitsEndTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RevealsEndTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.RevealsEndTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommitFee", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommitFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RevealFee", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RevealFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinimumBid", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MinimumBid.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field WinnerAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.WinnerAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field WinningBid", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.WinningBid.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 12: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field WinningPrice", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.WinningPrice.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Auctions) 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 ErrIntOverflowTypes + } + 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: Auctions: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Auctions: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Auctions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Auctions = append(m.Auctions, Auction{}) + if err := m.Auctions[len(m.Auctions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Bid) 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 ErrIntOverflowTypes + } + 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: Bid: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Bid: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AuctionId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AuctionId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BidderAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BidderAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Status = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommitHash", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CommitHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommitTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.CommitTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommitFee", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommitFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RevealTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.RevealTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RevealFee", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RevealFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BidAmount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.BidAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTypes(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, ErrIntOverflowTypes + } + 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, ErrIntOverflowTypes + } + 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, ErrIntOverflowTypes + } + 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, ErrInvalidLengthTypes + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTypes + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTypes + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/bond/README.md b/x/bond/README.md new file mode 100644 index 00000000..f03ddd3f --- /dev/null +++ b/x/bond/README.md @@ -0,0 +1,196 @@ +# Build chain +```bash +# it will create binary in build folder with `ethermintd` +$ make build +``` +# Setup Chain +```bash +./build/chibaclonkd keys add root +./build/chibaclonkd init test-moniker --chain-id ethermint_9000-1 +./build/chibaclonkd add-genesis-account $(./build/chibaclonkd keys show root -a) 1000000000000000000aphoton,1000000000000000000stake +./build/chibaclonkd gentx root 1000000000000000000stake --chain-id ethermint_9000-1 +./build/chibaclonkd collect-gentxs +./build/chibaclonkd start +``` + +# Params +``` +$ ./build/chibaclonkd q bond params -o json | jq . + +{ + "params": { + "max_bond_amount": { + "denom": "stake", + "amount": "100000000000" + } + } +} +``` + +# Create Bond +``` + $ ./build/chibaclonkd tx bond create 100aphoton --from root --chain-id $(./build/chibaclonkd status | jq .NodeInfo.network -r) + +{"body":{"messages":[{"@type":"/vulcanize.bond.v1beta1.MsgCreateBond","signer":"ethm1mfdjngh5jvjs9lqtt9a7y2hlgw8v3syh3hsqzk","coins":[{"denom":"aphoton","amount":"100"}]}],"memo":"","timeout_height":"0","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[],"fee":{"amount":[],"gas_limit":"200000","payer":"","granter":""}},"signatures":[]} + +confirm transaction before signing and broadcasting [y/N]: y +code: 0 +codespace: "" +data: "" +gas_used: "0" +gas_wanted: "0" +height: "0" +info: "" +logs: [] +raw_log: '[]' +timestamp: "" +tx: null +txhash: C6D362E11D4C9FB06D620F3CCAF363A69A074297A00E9CAECBDA5BE1CC302EB8 +``` +# Refill Bond +``` + $ ./build/chibaclonkd tx bond refill c3f7a78c5042d2003880962ba31ff3b01fcf5942960e0bc3ca331f816346a440 1000aphoton --from root --chain-id $(./build/chibaclonkd status | jq .NodeInfo.network -r) +{"body":{"messages":[{"@type":"/vulcanize.bond.v1beta1.MsgRefillBond","id":"c3f7a78c5042d2003880962ba31ff3b01fcf5942960e0bc3ca331f816346a440","signer":"ethm1mfdjngh5jvjs9lqtt9a7y2hlgw8v3syh3hsqzk","coins":[{"denom":"aphoton","amount":"1000"}]}],"memo":"","timeout_height":"0","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[],"fee":{"amount":[],"gas_limit":"200000","payer":"","granter":""}},"signatures":[]} + +confirm transaction before signing and broadcasting [y/N]: y +code: 0 +codespace: "" +data: "" +gas_used: "0" +gas_wanted: "0" +height: "0" +info: "" +logs: [] +raw_log: '[]' +timestamp: "" +tx: null +txhash: 025B04E2C923EFE2299CD171B40829CB1FE4D1A69DA7563C64AAC3D5C27BDFC9 + +``` +# Withdraw from bond +``` + $ ./build/chibaclonkd tx bond withdraw c3f7a78c5042d2003880962ba31ff3b01fcf5942960e0bc3ca331f816346a440 1000aphoton --from root --chain-id $(./build/chibaclonkd status | jq .NodeInfo.network -r) +{"body":{"messages":[{"@type":"/vulcanize.bond.v1beta1.MsgWithdrawBond","id":"c3f7a78c5042d2003880962ba31ff3b01fcf5942960e0bc3ca331f816346a440","signer":"ethm1mfdjngh5jvjs9lqtt9a7y2hlgw8v3syh3hsqzk","coins":[{"denom":"aphoton","amount":"1000"}]}],"memo":"","timeout_height":"0","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[],"fee":{"amount":[],"gas_limit":"200000","payer":"","granter":""}},"signatures":[]} + +confirm transaction before signing and broadcasting [y/N]: y +code: 0 +codespace: "" +data: "" +gas_used: "0" +gas_wanted: "0" +height: "0" +info: "" +logs: [] +raw_log: '[]' +timestamp: "" +tx: null +txhash: 7C5E2FE674577CD6BFFF9F92FCCBC61EDFE8F1A00CE29AC84D58FB8F013D2F03 +``` +# List Bond +``` + $ ./build/chibaclonkd q bond list -o json | jq . +{ + "bonds": [ + { + "id": "c3f7a78c5042d2003880962ba31ff3b01fcf5942960e0bc3ca331f816346a440", + "owner": "ethm1mfdjngh5jvjs9lqtt9a7y2hlgw8v3syh3hsqzk", + "balance": [ + { + "denom": "aphoton", + "amount": "100" + } + ] + } + ], + "pagination": null +} + +``` +# Get Bond by Id +``` +$ ./build/chibaclonkd q bond get c3f7a78c5042d2003880962ba31ff3b01fcf5942960e0bc3ca331f816346a440 -o json | jq . +{ + "bond": { + "id": "c3f7a78c5042d2003880962ba31ff3b01fcf5942960e0bc3ca331f816346a440", + "owner": "ethm1mfdjngh5jvjs9lqtt9a7y2hlgw8v3syh3hsqzk", + "balance": [ + { + "denom": "aphoton", + "amount": "100" + } + ] + } +} + +``` + +# Get Bond Module Balance +``` +$ ./build/chibaclonkd q bond balance -o json | jq . +{ + "balance": [ + { + "denom": "aphoton", + "amount": "100" + } + ] +} +``` + +# Get Bonds By Owner +``` +$ ./build/chibaclonkd q bond by-owner ethm1mfdjngh5jvjs9lqtt9a7y2hlgw8v3syh3hsqzk -o json | jq . +{ + "bonds": [ + { + "id": "c3f7a78c5042d2003880962ba31ff3b01fcf5942960e0bc3ca331f816346a440", + "owner": "ethm1mfdjngh5jvjs9lqtt9a7y2hlgw8v3syh3hsqzk", + "balance": [ + { + "denom": "aphoton", + "amount": "100" + } + ] + } + ], + "pagination": null +} +``` + +# Cancel the bond +``` + $ ./build/chibaclonkd tx bond cancel c3f7a78c5042d2003880962ba31ff3b01fcf5942960e0bc3ca331f816346a440 --from root --chain-id $(./build/chibaclonkd status | jq .NodeInfo.network -r) +{"body":{"messages":[{"@type":"/vulcanize.bond.v1beta1.MsgCancelBond","id":"c3f7a78c5042d2003880962ba31ff3b01fcf5942960e0bc3ca331f816346a440","signer":"ethm1mfdjngh5jvjs9lqtt9a7y2hlgw8v3syh3hsqzk"}],"memo":"","timeout_height":"0","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[],"fee":{"amount":[],"gas_limit":"200000","payer":"","granter":""}},"signatures":[]} + +confirm transaction before signing and broadcasting [y/N]: y +code: 0 +codespace: "" +data: "" +gas_used: "0" +gas_wanted: "0" +height: "0" +info: "" +logs: [] +raw_log: '[]' +timestamp: "" +tx: null +txhash: 06440D0B35A862E3A6783E147F0E1CDD3374870DAE07E471D465E2830DAF7044 + +``` + +Note : After the bond create and withdraw bond and cancel bond , account amount needs change as per module +``` +$ ./build/chibaclonkd q bank balances $(./build/chibaclonkd keys show root -a) -o json | jq . +{ + "balances": [ + { + "denom": "aphoton", + "amount": "1000000000000000000" + } + ], + "pagination": { + "next_key": null, + "total": "0" + } +} +``` \ No newline at end of file diff --git a/x/bond/abci.go b/x/bond/abci.go new file mode 100644 index 00000000..1b89cc90 --- /dev/null +++ b/x/bond/abci.go @@ -0,0 +1,17 @@ +package bond + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + abci "github.com/tendermint/tendermint/abci/types" + "github.com/tharsis/ethermint/x/bond/keeper" +) + +// BeginBlocker will persist the current header and validator set as a historical entry +// and prune the oldest entry based on the HistoricalEntries parameter +func BeginBlocker(ctx sdk.Context, k keeper.Keeper) { +} + +// EndBlocker Called every block, update validator set +func EndBlocker(ctx sdk.Context, k keeper.Keeper) []abci.ValidatorUpdate { + return []abci.ValidatorUpdate{} +} diff --git a/x/bond/client/cli/query.go b/x/bond/client/cli/query.go new file mode 100644 index 00000000..546f08ae --- /dev/null +++ b/x/bond/client/cli/query.go @@ -0,0 +1,203 @@ +package cli + +import ( + "fmt" + "strings" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/version" + "github.com/spf13/cobra" + "github.com/tharsis/ethermint/x/bond/types" +) + +// GetQueryCmd returns the cli query commands for this module +func GetQueryCmd() *cobra.Command { + bondQueryCmd := &cobra.Command{ + Use: types.ModuleName, + Short: "Querying commands for the bond module", + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + bondQueryCmd.AddCommand( + GetQueryParamsCmd(), + GetQueryBondLists(), + GetBondByIdCmd(), + GetBondListByOwnerCmd(), + GetBondModuleBalanceCmd(), + ) + + return bondQueryCmd +} + +// GetQueryParamsCmd implements the params query command. +func GetQueryParamsCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "params", + Args: cobra.NoArgs, + Short: "Query the current bond parameters information.", + Long: strings.TrimSpace( + fmt.Sprintf(`Query values set as bond parameters. + +Example: +$ %s query %s params +`, + version.AppName, types.ModuleName, + ), + ), + 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 +} + +// GetQueryBondLists implements the bond lists query command. +func GetQueryBondLists() *cobra.Command { + cmd := &cobra.Command{ + Use: "list", + Short: "List bonds.", + Long: strings.TrimSpace( + fmt.Sprintf(`Get bond list . + +Example: +$ %s query %s list +`, + version.AppName, types.ModuleName, + ), + ), + Args: cobra.ExactArgs(0), + 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.Bonds(cmd.Context(), &types.QueryGetBondsRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + flags.AddQueryFlagsToCmd(cmd) + return cmd +} + +// GetBondByIdCmd implements the bond info by id query command. +func GetBondByIdCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "get [bond Id]", + Short: "Get bond.", + Long: strings.TrimSpace( + fmt.Sprintf(`Get bond info by bond id . + +Example: +$ %s query bond get {BOND ID} +`, + version.AppName, + ), + ), + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + queryClient := types.NewQueryClient(clientCtx) + + id := args[0] + + res, err := queryClient.GetBondById(cmd.Context(), &types.QueryGetBondByIdRequest{Id: id}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + flags.AddQueryFlagsToCmd(cmd) + return cmd +} + +// GetBondListByOwnerCmd queries the bond list by owner. +func GetBondListByOwnerCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "by-owner [address]", + Short: "Query bonds by owner.", + Long: strings.TrimSpace( + fmt.Sprintf(`Get bond list by owner. + +Example: +$ %s query %s query-by-owner [address] +`, + version.AppName, types.ModuleName, + ), + ), + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + queryClient := types.NewQueryClient(clientCtx) + owner := args[0] + res, err := queryClient.GetBondsByOwner(cmd.Context(), &types.QueryGetBondsByOwnerRequest{Owner: owner}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + flags.AddQueryFlagsToCmd(cmd) + return cmd +} + +// GetBondModuleBalanceCmd queries the bond module account balance. +func GetBondModuleBalanceCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "balance", + Short: "Get bond module account balance.", + Long: strings.TrimSpace( + fmt.Sprintf(`Get bond module balance. + +Example: +$ %s query %s balance +`, + version.AppName, types.ModuleName, + ), + ), + Args: cobra.ExactArgs(0), + 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.GetBondsModuleBalance(cmd.Context(), &types.QueryGetBondModuleBalanceRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + flags.AddQueryFlagsToCmd(cmd) + return cmd +} diff --git a/x/bond/client/cli/tx.go b/x/bond/client/cli/tx.go new file mode 100644 index 00000000..c39eec75 --- /dev/null +++ b/x/bond/client/cli/tx.go @@ -0,0 +1,125 @@ +package cli + +import ( + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/tx" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/spf13/cobra" + "github.com/tharsis/ethermint/server/flags" + "github.com/tharsis/ethermint/x/bond/types" +) + +// NewTxCmd returns a root CLI command handler for all x/bond transaction commands. +func NewTxCmd() *cobra.Command { + bondTxCmd := &cobra.Command{ + Use: types.ModuleName, + Short: "bond transaction subcommands", + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + bondTxCmd.AddCommand( + NewCreateBondCmd(), + RefillBondCmd(), + WithdrawBondCmd(), + CancelBondCmd(), + ) + + return bondTxCmd +} + +// NewCreateBondCmd is the CLI command for creating a bond. +func NewCreateBondCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "create [amount]", + Short: "Create bond.", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + coin, err := sdk.ParseCoinNormalized(args[0]) + if err != nil { + return err + } + + msg := types.NewMsgCreateBond(sdk.NewCoins(coin), clientCtx.GetFromAddress()) + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) + }, + } + + flags.AddTxFlags(cmd) + return cmd +} + +// RefillBondCmd is the CLI command for creating a bond. +func RefillBondCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "refill [bond Id] [amount]", + Short: "Refill bond.", + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + bondId := args[0] + coin, err := sdk.ParseCoinNormalized(args[1]) + if err != nil { + return err + } + + msg := types.NewMsgRefillBond(bondId, coin, clientCtx.GetFromAddress()) + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) + }, + } + flags.AddTxFlags(cmd) + return cmd +} + +// WithdrawBondCmd is the CLI command for withdrawing funds from a bond. +func WithdrawBondCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "withdraw [bond Id] [amount]", + Short: "Withdraw amount from bond.", + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + bondId := args[0] + coin, err := sdk.ParseCoinNormalized(args[1]) + if err != nil { + return err + } + + msg := types.NewMsgWithdrawBond(bondId, coin, clientCtx.GetFromAddress()) + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) + }, + } + flags.AddTxFlags(cmd) + return cmd +} + +// CancelBondCmd is the CLI command for cancelling a bond. +func CancelBondCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "cancel [bond Id]", + Short: "cancel bond.", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + bondId := args[0] + msg := types.NewMsgCancelBond(bondId, clientCtx.GetFromAddress()) + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) + }, + } + flags.AddTxFlags(cmd) + return cmd +} diff --git a/x/bond/client/testutil/cli_test.go b/x/bond/client/testutil/cli_test.go new file mode 100644 index 00000000..26939954 --- /dev/null +++ b/x/bond/client/testutil/cli_test.go @@ -0,0 +1,14 @@ +package testutil + +import ( + "testing" + + "github.com/stretchr/testify/suite" + "github.com/tharsis/ethermint/testutil/network" +) + +func TestIntegrationTestSuite(t *testing.T) { + cfg := network.DefaultConfig() + cfg.NumValidators = 1 + suite.Run(t, NewIntegrationTestSuite(cfg)) +} diff --git a/x/bond/client/testutil/grpc.go b/x/bond/client/testutil/grpc.go new file mode 100644 index 00000000..da249ff2 --- /dev/null +++ b/x/bond/client/testutil/grpc.go @@ -0,0 +1,213 @@ +package testutil + +import ( + "fmt" + clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" + "github.com/cosmos/cosmos-sdk/types/rest" + tmcli "github.com/tendermint/tendermint/libs/cli" + "github.com/tharsis/ethermint/x/bond/client/cli" + bondtypes "github.com/tharsis/ethermint/x/bond/types" +) + +func (s *IntegrationTestSuite) TestGRPCGetBonds() { + val := s.network.Validators[0] + sr := s.Require() + reqUrl := fmt.Sprintf("%s/vulcanize/bond/v1beta1/bonds", val.APIAddress) + + testCases := []struct { + name string + url string + expErr bool + errorMsg string + preRun func() + }{ + { + "invalid request with headers", + reqUrl + "asdasdas", + true, + "", + func() { + + }, + }, + { + "valid request", + reqUrl, + false, + "", + func() { + s.createBond() + }, + }, + } + for _, tc := range testCases { + s.Run(tc.name, func() { + resp, _ := rest.GetRequest(tc.url) + if tc.expErr { + sr.Contains(string(resp), tc.errorMsg) + } else { + var response bondtypes.QueryGetBondsResponse + err := val.ClientCtx.Codec.UnmarshalJSON(resp, &response) + sr.NoError(err) + sr.NotZero(len(response.GetBonds())) + } + }) + } +} + +func (s *IntegrationTestSuite) TestGRPCGetParams() { + val := s.network.Validators[0] + sr := s.Require() + reqUrl := fmt.Sprintf("%s/vulcanize/bond/v1beta1/params", val.APIAddress) + + resp, err := rest.GetRequest(reqUrl) + s.Require().NoError(err) + + var params bondtypes.QueryParamsResponse + err = val.ClientCtx.Codec.UnmarshalJSON(resp, ¶ms) + + sr.NoError(err) + sr.Equal(params.GetParams().MaxBondAmount, bondtypes.DefaultParams().MaxBondAmount) +} + +func (s *IntegrationTestSuite) TestGRPCGetBondsByOwner() { + val := s.network.Validators[0] + sr := s.Require() + reqUrl := val.APIAddress + "/vulcanize/bond/v1beta1/by-owner/%s" + + testCases := []struct { + name string + url string + expErr bool + preRun func() + }{ + { + "empty list", + fmt.Sprintf(reqUrl, "asdasd"), + true, + func() { + + }, + }, + { + "valid request", + fmt.Sprintf(reqUrl, s.accountAddress), + false, + func() { + s.createBond() + }, + }, + } + + for _, tc := range testCases { + s.Run(tc.name, func() { + if !tc.expErr { + tc.preRun() + } + + resp, err := rest.GetRequest(tc.url) + s.Require().NoError(err) + + var bonds bondtypes.QueryGetBondsByOwnerResponse + err = val.ClientCtx.Codec.UnmarshalJSON(resp, &bonds) + sr.NoError(err) + if tc.expErr { + sr.Empty(bonds.GetBonds()) + } else { + bondsList := bonds.GetBonds() + sr.NotZero(len(bondsList)) + sr.Equal(s.accountAddress, bondsList[0].GetOwner()) + } + }) + } +} + +func (s *IntegrationTestSuite) TestGRPCGetBondById() { + val := s.network.Validators[0] + sr := s.Require() + reqUrl := val.APIAddress + "/vulcanize/bond/v1beta1/bonds/%s" + + testCases := []struct { + name string + url string + expErr bool + preRun func() string + }{ + { + "invalid request", + fmt.Sprintf(reqUrl, "asdadad"), + true, + func() string { + return "" + }, + }, + { + "valid request", + reqUrl, + false, + func() string { + // creating the bond + s.createBond() + + // getting the bonds list and returning the bond-id + clientCtx := val.ClientCtx + cmd := cli.GetQueryBondLists() + args := []string{ + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + } + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) + sr.NoError(err) + var queryResponse bondtypes.QueryGetBondsResponse + err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &queryResponse) + sr.NoError(err) + + // extract bond id from bonds list + bond := queryResponse.GetBonds()[0] + return bond.GetId() + }, + }, + } + for _, tc := range testCases { + s.Run(tc.name, func() { + var bondId string + if !tc.expErr { + bondId = tc.preRun() + tc.url = fmt.Sprintf(reqUrl, bondId) + } + + resp, err := rest.GetRequest(tc.url) + s.Require().NoError(err) + + var bonds bondtypes.QueryGetBondByIdResponse + err = val.ClientCtx.Codec.UnmarshalJSON(resp, &bonds) + + if tc.expErr { + sr.Empty(bonds.GetBond().GetId()) + } else { + sr.NoError(err) + sr.NotZero(bonds.GetBond().GetId()) + sr.Equal(bonds.GetBond().GetId(), bondId) + } + }) + } +} + +func (s *IntegrationTestSuite) TestGRPCGetBondModuleBalance() { + val := s.network.Validators[0] + sr := s.Require() + reqUrl := fmt.Sprintf("%s/vulcanize/bond/v1beta1/balance", val.APIAddress) + + // creating the bond + s.createBond() + + s.Run("valid request", func() { + resp, err := rest.GetRequest(reqUrl) + sr.NoError(err) + + var response bondtypes.QueryGetBondModuleBalanceResponse + err = val.ClientCtx.Codec.UnmarshalJSON(resp, &response) + + sr.NoError(err) + sr.False(response.GetBalance().IsZero()) + }) +} diff --git a/x/bond/client/testutil/query.go b/x/bond/client/testutil/query.go new file mode 100644 index 00000000..3e52c7ba --- /dev/null +++ b/x/bond/client/testutil/query.go @@ -0,0 +1,330 @@ +package testutil + +import ( + "fmt" + + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/crypto/hd" + "github.com/cosmos/cosmos-sdk/crypto/keyring" + "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" + clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" + sdk "github.com/cosmos/cosmos-sdk/types" + banktestutil "github.com/cosmos/cosmos-sdk/x/bank/client/testutil" + "github.com/stretchr/testify/suite" + tmcli "github.com/tendermint/tendermint/libs/cli" + "github.com/tharsis/ethermint/testutil/network" + "github.com/tharsis/ethermint/x/bond/client/cli" + "github.com/tharsis/ethermint/x/bond/types" +) + +type IntegrationTestSuite struct { + suite.Suite + + cfg network.Config + network *network.Network + accountName string + accountAddress string +} + +func NewIntegrationTestSuite(cfg network.Config) *IntegrationTestSuite { + return &IntegrationTestSuite{cfg: cfg} +} + +func (s *IntegrationTestSuite) SetupSuite() { + s.T().Log("setting up integration test suite") + var err error + s.network, err = network.New(s.T(), s.T().TempDir(), s.cfg) + s.Require().NoError(err) + + _, err = s.network.WaitForHeight(1) + s.Require().NoError(err) + + s.accountName = "accountName" + // setting up random account + s.createAccountWithBalance(s.accountName) +} + +func (s *IntegrationTestSuite) TearDownSuite() { + s.T().Log("tearing down integration test suite") + s.network.Cleanup() +} + +func (s *IntegrationTestSuite) TestGetCmdQueryParams() { + val := s.network.Validators[0] + + testCases := []struct { + name string + args []string + outputType string + }{ + { + "json output", + []string{fmt.Sprintf("--%s=json", tmcli.OutputFlag)}, + "json", + }, + } + + for _, tc := range testCases { + s.Run(tc.name, func() { + cmd := cli.GetQueryParamsCmd() + clientCtx := val.ClientCtx + + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) + s.Require().NoError(err) + var response types.QueryParamsResponse + err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response) + s.Require().NoError(err) + s.Require().Equal(response.Params.MaxBondAmount, types.DefaultParams().MaxBondAmount) + }) + } +} + +func (s *IntegrationTestSuite) createAccountWithBalance(accountName string) { + val := s.network.Validators[0] + sr := s.Require() + consPrivKey := ed25519.GenPrivKey() + consPubKeyBz, err := s.cfg.Codec.MarshalInterfaceJSON(consPrivKey.PubKey()) + sr.NoError(err) + sr.NotNil(consPubKeyBz) + info, _, err := val.ClientCtx.Keyring.NewMnemonic(accountName, keyring.English, sdk.FullFundraiserPath, keyring.DefaultBIP39Passphrase, hd.Secp256k1) + sr.NoError(err) + + newAddr := sdk.AccAddress(info.GetPubKey().Address()) + _, err = banktestutil.MsgSendExec( + val.ClientCtx, + val.Address, + newAddr, + sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(200))), + fmt.Sprintf("--%s", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), + ) + sr.NoError(err) + s.accountAddress = newAddr.String() +} + +func (s *IntegrationTestSuite) createBond() { + val := s.network.Validators[0] + sr := s.Require() + createBondCmd := cli.NewCreateBondCmd() + args := []string{ + fmt.Sprintf("10%s", s.cfg.BondDenom), + fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountName), + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), + } + out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, createBondCmd, args) + sr.NoError(err) + var d sdk.TxResponse + err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d) + sr.NoError(err) + sr.Zero(d.Code) + err = s.network.WaitForNextBlock() + sr.NoError(err) +} + +func (s *IntegrationTestSuite) TestGetQueryBondLists() { + val := s.network.Validators[0] + sr := s.Require() + + testCases := []struct { + name string + args []string + createBond bool + preRun func() + }{ + { + "create and get bond lists", + []string{fmt.Sprintf("--%s=json", tmcli.OutputFlag)}, + true, + func() { + s.createBond() + }, + }, + } + + for _, tc := range testCases { + s.Run(fmt.Sprintf("Case %s", tc.name), func() { + clientCtx := val.ClientCtx + if tc.createBond { + tc.preRun() + } + + cmd := cli.GetQueryBondLists() + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) + sr.NoError(err) + var queryResponse types.QueryGetBondsResponse + err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &queryResponse) + sr.NoError(err) + sr.NotZero(len(queryResponse.GetBonds())) + }) + } +} + +func (s *IntegrationTestSuite) TestGetQueryBondById() { + val := s.network.Validators[0] + sr := s.Require() + testCases := []struct { + name string + args []string + err bool + preRun func() string + }{ + { + "invalid bond id", + []string{ + fmt.Sprint("not_found_bond_id"), + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + }, + true, + func() string { + return "" + }, + }, + { + "create and get bond by id", + []string{fmt.Sprintf("--%s=json", tmcli.OutputFlag)}, + false, + func() string { + // creating the bond + s.createBond() + + // getting the bonds list and returning the bond-id + clientCtx := val.ClientCtx + cmd := cli.GetQueryBondLists() + args := []string{ + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + } + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) + sr.NoError(err) + var queryResponse types.QueryGetBondsResponse + err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &queryResponse) + sr.NoError(err) + + // extract bond id from bonds list + bond := queryResponse.GetBonds()[0] + return bond.GetId() + }, + }, + } + + for _, tc := range testCases { + s.Run(fmt.Sprintf("Case %s", tc.name), func() { + clientCtx := val.ClientCtx + if !tc.err { + bondId := tc.preRun() + tc.args = append([]string{bondId}, tc.args...) + } + cmd := cli.GetBondByIdCmd() + + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) + sr.NoError(err) + var queryResponse types.QueryGetBondByIdResponse + err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &queryResponse) + sr.NoError(err) + if tc.err { + sr.Zero(len(queryResponse.GetBond().GetId())) + } else { + sr.NotZero(len(queryResponse.GetBond().GetId())) + sr.Equal(s.accountAddress, queryResponse.GetBond().GetOwner()) + } + }) + } +} + +func (s *IntegrationTestSuite) TestGetQueryBondListsByOwner() { + val := s.network.Validators[0] + sr := s.Require() + testCases := []struct { + name string + args []string + err bool + preRun func() + }{ + { + "invalid owner address", + []string{ + fmt.Sprint("not_found_bond_id"), + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + }, + true, + func() { + + }, + }, + { + "get bond lists by owner address", + []string{ + fmt.Sprint(s.accountAddress), + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + }, + false, + func() { + s.createBond() + }, + }, + } + + for _, tc := range testCases { + s.Run(fmt.Sprintf("Case %s", tc.name), func() { + clientCtx := val.ClientCtx + if !tc.err { + tc.preRun() + } + cmd := cli.GetBondListByOwnerCmd() + + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) + sr.NoError(err) + var queryResponse types.QueryGetBondsByOwnerResponse + err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &queryResponse) + sr.NoError(err) + if tc.err { + sr.Zero(len(queryResponse.GetBonds())) + } else { + sr.NotZero(len(queryResponse.GetBonds())) + sr.Equal(s.accountAddress, queryResponse.GetBonds()[0].GetOwner()) + } + }) + } +} + +func (s *IntegrationTestSuite) TestGetQueryBondModuleBalance() { + val := s.network.Validators[0] + sr := s.Require() + testCases := []struct { + name string + args []string + err bool + preRun func() + }{ + { + "get bond module balance", + []string{ + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + }, + false, + func() { + s.createBond() + }, + }, + } + + for _, tc := range testCases { + s.Run(fmt.Sprintf("Case %s", tc.name), func() { + clientCtx := val.ClientCtx + if !tc.err { + tc.preRun() + } + + cmd := cli.GetBondModuleBalanceCmd() + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) + sr.NoError(err) + var queryResponse types.QueryGetBondModuleBalanceResponse + err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &queryResponse) + sr.NoError(err) + sr.False(queryResponse.GetBalance().IsZero()) + }) + } +} diff --git a/x/bond/client/testutil/tx.go b/x/bond/client/testutil/tx.go new file mode 100644 index 00000000..e01a1942 --- /dev/null +++ b/x/bond/client/testutil/tx.go @@ -0,0 +1,317 @@ +package testutil + +import ( + "fmt" + + "github.com/cosmos/cosmos-sdk/client/flags" + clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" + sdk "github.com/cosmos/cosmos-sdk/types" + tmcli "github.com/tendermint/tendermint/libs/cli" + "github.com/tharsis/ethermint/x/bond/client/cli" + "github.com/tharsis/ethermint/x/bond/types" +) + +func (s *IntegrationTestSuite) TestTxCreateBond() { + val := s.network.Validators[0] + sr := s.Require() + + testCases := []struct { + name string + args []string + err bool + }{ + { + "without deposit", + []string{ + fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountName), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), + }, + true, + }, + { + "create bond", + []string{ + fmt.Sprintf("10%s", s.cfg.BondDenom), + fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountName), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), + }, + false, + }, + } + + for _, tc := range testCases { + s.Run(fmt.Sprintf("Case %s", tc.name), func() { + clientCtx := val.ClientCtx + cmd := cli.NewCreateBondCmd() + + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) + if tc.err { + sr.Error(err) + } else { + sr.NoError(err) + var d sdk.TxResponse + err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d) + sr.Nil(err) + sr.NoError(err) + sr.Zero(d.Code) + } + }) + } +} + +func (s *IntegrationTestSuite) TestTxRefillBond() { + val := s.network.Validators[0] + sr := s.Require() + + testCases := []struct { + name string + args []string + getBondId bool + err bool + }{ + { + "without refill amount and bond id", + []string{ + fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountName), + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), + }, + false, + true, + }, + { + "refill bond", + []string{ + fmt.Sprintf("10%s", s.cfg.BondDenom), + fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountName), + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), + }, + true, + false, + }, + } + + for _, tc := range testCases { + s.Run(fmt.Sprintf("Case %s", tc.name), func() { + clientCtx := val.ClientCtx + cmd := cli.RefillBondCmd() + if tc.getBondId { + cmd := cli.GetQueryBondLists() + + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, []string{ + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + }) + sr.NoError(err) + var queryResponse types.QueryGetBondsResponse + err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &queryResponse) + sr.NoError(err) + + // extract bond id from bonds list + bond := queryResponse.GetBonds()[0] + tc.args = append([]string{bond.GetId()}, tc.args...) + } + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) + if tc.err { + sr.Error(err) + } else { + sr.NoError(err) + var d sdk.TxResponse + err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d) + sr.NoError(err) + sr.Zero(d.Code) + + // checking the balance of bond + cmd := cli.GetBondByIdCmd() + + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, []string{ + fmt.Sprintf(tc.args[0]), + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + }) + sr.NoError(err) + var queryResponse types.QueryGetBondByIdResponse + err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &queryResponse) + sr.NoError(err) + + sr.True(queryResponse.GetBond().GetBalance().IsEqual( + sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(20))))) + } + }) + } +} + +func (s *IntegrationTestSuite) TestTxWithdrawAmountFromBond() { + val := s.network.Validators[0] + sr := s.Require() + + testCases := []struct { + name string + args []string + getBondId bool + err bool + }{ + { + "without withdraw amount and bond id", + []string{ + fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountName), + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), + }, + false, + true, + }, + { + "withdraw amount from bond", + []string{ + fmt.Sprintf("10%s", s.cfg.BondDenom), + fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountName), + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), + }, + true, + false, + }, + } + + for _, tc := range testCases { + s.Run(fmt.Sprintf("Case %s", tc.name), func() { + clientCtx := val.ClientCtx + cmd := cli.WithdrawBondCmd() + if tc.getBondId { + cmd := cli.GetQueryBondLists() + + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, []string{ + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + }) + sr.NoError(err) + var queryResponse types.QueryGetBondsResponse + err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &queryResponse) + sr.NoError(err) + + // extract bond id from bonds list + bond := queryResponse.GetBonds()[0] + tc.args = append([]string{bond.GetId()}, tc.args...) + } + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) + if tc.err { + sr.Error(err) + } else { + sr.NoError(err) + var d sdk.TxResponse + err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d) + sr.NoError(err) + sr.Zero(d.Code) + + // checking the balance of bond + cmd := cli.GetBondByIdCmd() + + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, []string{ + fmt.Sprintf(tc.args[0]), + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + }) + sr.NoError(err) + var queryResponse types.QueryGetBondByIdResponse + err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &queryResponse) + sr.NoError(err) + + sr.True(queryResponse.GetBond().GetBalance().IsEqual( + sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))))) + } + }) + } +} + +func (s *IntegrationTestSuite) TestTxCancelBond() { + val := s.network.Validators[0] + sr := s.Require() + + testCases := []struct { + name string + args []string + getBondId bool + err bool + }{ + { + "without bond id", + []string{ + fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountName), + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), + }, + false, + true, + }, + { + "cancel bond", + []string{ + fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountName), + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), + }, + true, + false, + }, + } + + for _, tc := range testCases { + s.Run(fmt.Sprintf("Case %s", tc.name), func() { + clientCtx := val.ClientCtx + cmd := cli.CancelBondCmd() + if tc.getBondId { + cmd := cli.GetQueryBondLists() + + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, []string{ + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + }) + sr.NoError(err) + var queryResponse types.QueryGetBondsResponse + err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &queryResponse) + sr.NoError(err) + + // extract bond id from bonds list + bond := queryResponse.GetBonds()[0] + tc.args = append([]string{bond.GetId()}, tc.args...) + } + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) + if tc.err { + sr.Error(err) + } else { + sr.NoError(err) + var d sdk.TxResponse + err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d) + sr.NoError(err) + sr.Zero(d.Code) + + // checking the bond exists or not after cancel + cmd := cli.GetBondByIdCmd() + + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, []string{ + fmt.Sprintf(tc.args[0]), + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + }) + sr.NoError(err) + var queryResponse types.QueryGetBondByIdResponse + err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &queryResponse) + sr.NoError(err) + + sr.Zero(queryResponse.GetBond().GetId()) + } + }) + } +} diff --git a/x/bond/genesis.go b/x/bond/genesis.go new file mode 100644 index 00000000..5457122c --- /dev/null +++ b/x/bond/genesis.go @@ -0,0 +1,40 @@ +package bond + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + abci "github.com/tendermint/tendermint/abci/types" + "github.com/tharsis/ethermint/x/bond/keeper" + "github.com/tharsis/ethermint/x/bond/types" +) + +// InitGenesis initializes genesis state based on exported genesis +func InitGenesis( + ctx sdk.Context, + k keeper.Keeper, data types.GenesisState) []abci.ValidatorUpdate { + + k.SetParams(ctx, data.Params) + + for _, bond := range data.Bonds { + k.SaveBond(ctx, bond) + } + + return []abci.ValidatorUpdate{} +} + +// ExportGenesis - output genesis parameters +func ExportGenesis(ctx sdk.Context, keeper keeper.Keeper) types.GenesisState { + params := keeper.GetParams(ctx) + bonds := keeper.ListBonds(ctx) + + return types.GenesisState{Params: params, Bonds: bonds} +} + +// ValidateGenesis - validating the genesis data +func ValidateGenesis(data types.GenesisState) error { + err := data.Params.Validate() + if err != nil { + return err + } + + return nil +} diff --git a/x/bond/keeper/grpc_query.go b/x/bond/keeper/grpc_query.go new file mode 100644 index 00000000..9a19d7bc --- /dev/null +++ b/x/bond/keeper/grpc_query.go @@ -0,0 +1,53 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/tharsis/ethermint/x/bond/types" +) + +type Querier struct { + Keeper +} + +var _ types.QueryServer = Querier{} + +func (q Querier) Bonds(c context.Context, _ *types.QueryGetBondsRequest) (*types.QueryGetBondsResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + resp := q.Keeper.ListBonds(ctx) + return &types.QueryGetBondsResponse{Bonds: resp}, nil +} + +func (q Querier) Params(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + params := q.Keeper.GetParams(ctx) + return &types.QueryParamsResponse{Params: ¶ms}, nil +} + +func (q Querier) GetBondById(c context.Context, req *types.QueryGetBondByIdRequest) (*types.QueryGetBondByIdResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + bondId := req.GetId() + if len(bondId) == 0 { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "bond id required") + } + bond := q.Keeper.GetBond(ctx, req.GetId()) + return &types.QueryGetBondByIdResponse{Bond: &bond}, nil +} + +func (q Querier) GetBondsByOwner(c context.Context, req *types.QueryGetBondsByOwnerRequest) (*types.QueryGetBondsByOwnerResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + owner := req.GetOwner() + if len(owner) == 0 { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "owner id required") + } + bonds := q.Keeper.QueryBondsByOwner(ctx, owner) + return &types.QueryGetBondsByOwnerResponse{Bonds: bonds}, nil +} + +func (q Querier) GetBondsModuleBalance(c context.Context, _ *types.QueryGetBondModuleBalanceRequest) (*types.QueryGetBondModuleBalanceResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + balance := q.Keeper.GetBondModuleBalances(ctx) + return &types.QueryGetBondModuleBalanceResponse{Balance: balance}, nil +} diff --git a/x/bond/keeper/grpc_query_test.go b/x/bond/keeper/grpc_query_test.go new file mode 100644 index 00000000..bb443b2c --- /dev/null +++ b/x/bond/keeper/grpc_query_test.go @@ -0,0 +1,221 @@ +package keeper_test + +import ( + "context" + "fmt" + "github.com/cosmos/cosmos-sdk/simapp" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/tharsis/ethermint/app" + "github.com/tharsis/ethermint/x/bond/types" +) + +func (suite *KeeperTestSuite) TestGrpcQueryBondsList() { + grpcClient, ctx, k := suite.queryClient, suite.ctx, suite.app.BondKeeper + + testCases := []struct { + msg string + req *types.QueryGetBondsRequest + resp *types.QueryGetBondsResponse + noOfBonds int + createBonds bool + }{ + { + "empty request", + &types.QueryGetBondsRequest{}, + &types.QueryGetBondsResponse{}, + 0, + false, + }, + { + "Get Bonds", + &types.QueryGetBondsRequest{}, + &types.QueryGetBondsResponse{}, + 1, + true, + }, + } + + for _, test := range testCases { + suite.Run(fmt.Sprintf("Case %s ", test.msg), func() { + if test.createBonds { + account := app.CreateRandomAccounts(1)[0] + err := simapp.FundAccount(suite.app.BankKeeper, ctx, account, sdk.NewCoins(sdk.Coin{ + Denom: sdk.DefaultBondDenom, + Amount: sdk.NewInt(1000), + })) + _, err = k.CreateBond(ctx, account, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(10)))) + suite.Require().NoError(err) + } + resp, _ := grpcClient.Bonds(context.Background(), test.req) + suite.Require().Equal(test.noOfBonds, len(resp.GetBonds())) + }) + } +} + +func (suite *KeeperTestSuite) TestGrpcQueryParams() { + grpcClient := suite.queryClient + + testCases := []struct { + msg string + req *types.QueryParamsRequest + }{ + { + "Get Params", + &types.QueryParamsRequest{}, + }, + } + for _, test := range testCases { + suite.Run(fmt.Sprintf("Case %s ", test.msg), func() { + resp, _ := grpcClient.Params(context.Background(), test.req) + suite.Require().Equal(resp.GetParams().MaxBondAmount, types.DefaultParams().MaxBondAmount) + }) + } +} + +func (suite *KeeperTestSuite) TestGrpcQueryBondBondId() { + grpcClient, ctx, k, suiteRequire := suite.queryClient, suite.ctx, suite.app.BondKeeper, suite.Require() + + testCases := []struct { + msg string + req *types.QueryGetBondByIdRequest + createBonds bool + errResponse bool + bondId string + }{ + { + "empty request", + &types.QueryGetBondByIdRequest{}, + false, + true, + "", + }, + { + "Get Bond By ID", + &types.QueryGetBondByIdRequest{}, + true, + false, + "", + }, + } + + for _, test := range testCases { + suite.Run(fmt.Sprintf("Case %s ", test.msg), func() { + if test.createBonds { + account := app.CreateRandomAccounts(1)[0] + err := simapp.FundAccount(suite.app.BankKeeper, ctx, account, sdk.NewCoins(sdk.Coin{ + Denom: sdk.DefaultBondDenom, + Amount: sdk.NewInt(1000), + })) + bond, err := k.CreateBond(ctx, account, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(10)))) + suiteRequire.NoError(err) + test.req.Id = bond.Id + } + resp, err := grpcClient.GetBondById(context.Background(), test.req) + if !test.errResponse { + suiteRequire.Nil(err) + suiteRequire.NotNil(resp.GetBond()) + suiteRequire.Equal(test.req.Id, resp.GetBond().GetId()) + } else { + suiteRequire.NotNil(err) + suiteRequire.Error(err) + } + }) + } +} + +func (suite *KeeperTestSuite) TestGrpcGetBondsByOwner() { + grpcClient, ctx, k, suiteRequire := suite.queryClient, suite.ctx, suite.app.BondKeeper, suite.Require() + + testCases := []struct { + msg string + req *types.QueryGetBondsByOwnerRequest + noOfBonds int + createBonds bool + errResponse bool + bondId string + }{ + { + "empty request", + &types.QueryGetBondsByOwnerRequest{}, + 0, + false, + true, + "", + }, + { + "Get Bond By Owner", + &types.QueryGetBondsByOwnerRequest{}, + 1, + true, + false, + "", + }, + } + + for _, test := range testCases { + suite.Run(fmt.Sprintf("Case %s ", test.msg), func() { + if test.createBonds { + account := app.CreateRandomAccounts(1)[0] + _ = simapp.FundAccount(suite.app.BankKeeper, ctx, account, sdk.NewCoins(sdk.Coin{ + Denom: sdk.DefaultBondDenom, + Amount: sdk.NewInt(1000), + })) + _, err := k.CreateBond(ctx, account, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(10)))) + suiteRequire.NoError(err) + test.req.Owner = account.String() + } + resp, err := grpcClient.GetBondsByOwner(context.Background(), test.req) + if !test.errResponse { + suiteRequire.Nil(err) + suiteRequire.NotNil(resp.GetBonds()) + suiteRequire.Equal(test.noOfBonds, len(resp.GetBonds())) + } else { + suiteRequire.NotNil(err) + suiteRequire.Error(err) + } + }) + } +} + +func (suite *KeeperTestSuite) TestGrpcGetModuleBalance() { + grpcClient, ctx, k, suiteRequire := suite.queryClient, suite.ctx, suite.app.BondKeeper, suite.Require() + + testCases := []struct { + msg string + req *types.QueryGetBondModuleBalanceRequest + noOfBonds int + createBonds bool + errResponse bool + }{ + { + "empty request", + &types.QueryGetBondModuleBalanceRequest{}, + 0, + true, + false, + }, + } + + for _, test := range testCases { + suite.Run(fmt.Sprintf("Case %s ", test.msg), func() { + if test.createBonds { + account := app.CreateRandomAccounts(1)[0] + _ = simapp.FundAccount(suite.app.BankKeeper, ctx, account, sdk.NewCoins(sdk.Coin{ + Denom: sdk.DefaultBondDenom, + Amount: sdk.NewInt(1000), + })) + _, err := k.CreateBond(ctx, account, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(10)))) + suiteRequire.NoError(err) + } + resp, err := grpcClient.GetBondsModuleBalance(context.Background(), test.req) + if !test.errResponse { + suiteRequire.Nil(err) + suiteRequire.NotNil(resp.GetBalance()) + suiteRequire.Equal(resp.GetBalance(), sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(10)))) + } else { + suiteRequire.NotNil(err) + suiteRequire.Error(err) + } + }) + } +} diff --git a/x/bond/keeper/invariants.go b/x/bond/keeper/invariants.go new file mode 100644 index 00000000..f7c8a4d8 --- /dev/null +++ b/x/bond/keeper/invariants.go @@ -0,0 +1,37 @@ +package keeper + +import ( + "fmt" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/tharsis/ethermint/x/bond/types" +) + +// RegisterInvariants registers all bond invariants +func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper) { + ir.RegisterRoute(types.ModuleName, "module-account", ModuleAccountInvariant(k)) +} + +// ModuleAccountInvariant checks that the 'bond' module account balance is non-negative. +func ModuleAccountInvariant(k Keeper) sdk.Invariant { + return func(ctx sdk.Context) (string, bool) { + moduleAddress := k.accountKeeper.GetModuleAddress(types.ModuleName) + balances := k.bankKeeper.GetAllBalances(ctx, moduleAddress) + for _, balance := range balances { + if balance.IsNegative() { + return sdk.FormatInvariant( + types.ModuleName, + "module-account", + fmt.Sprintf("Module account '%s' has negative balance.", types.ModuleName)), + true + } + } + return "", false + } +} + +// AllInvariants runs all invariants of the bonds module. +func AllInvariants(k Keeper) sdk.Invariant { + return func(ctx sdk.Context) (string, bool) { + return ModuleAccountInvariant(k)(ctx) + } +} diff --git a/x/bond/keeper/keeper.go b/x/bond/keeper/keeper.go new file mode 100644 index 00000000..e1c785bf --- /dev/null +++ b/x/bond/keeper/keeper.go @@ -0,0 +1,355 @@ +package keeper + +import ( + "crypto/sha256" + "encoding/hex" + "fmt" + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + auth "github.com/cosmos/cosmos-sdk/x/auth/keeper" + bank "github.com/cosmos/cosmos-sdk/x/bank/keeper" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + "github.com/tharsis/ethermint/x/bond/types" +) + +// prefixIDToBondIndex is the prefix for ID -> Bond index in the KVStore. +// Note: This is the primary index in the system. +// Note: Golang doesn't support const arrays. +var prefixIDToBondIndex = []byte{0x00} + +// prefixOwnerToBondsIndex is the prefix for the Owner -> [Bond] index in the KVStore. +var prefixOwnerToBondsIndex = []byte{0x01} + +// Keeper maintains the link to storage and exposes getter/setter methods for the various parts of the state machine +type Keeper struct { + accountKeeper auth.AccountKeeper + bankKeeper bank.Keeper + + // Track bond usage in other cosmos-sdk modules (more like a usage tracker). + usageKeepers []types.BondUsageKeeper + + storeKey sdk.StoreKey + + cdc codec.BinaryCodec + + paramSubspace paramtypes.Subspace +} + +// NewKeeper creates new instances of the bond Keeper +func NewKeeper(cdc codec.BinaryCodec, accountKeeper auth.AccountKeeper, bankKeeper bank.Keeper, usageKeepers []types.BondUsageKeeper, storeKey sdk.StoreKey, ps paramtypes.Subspace) Keeper { + // set KeyTable if it has not already been set + if !ps.HasKeyTable() { + ps = ps.WithKeyTable(types.ParamKeyTable()) + } + + return Keeper{ + accountKeeper: accountKeeper, + bankKeeper: bankKeeper, + storeKey: storeKey, + cdc: cdc, + usageKeepers: usageKeepers, + paramSubspace: ps, + } +} + +// Generates Bond ID -> Bond index key. +func getBondIndexKey(id string) []byte { + return append(prefixIDToBondIndex, []byte(id)...) +} + +// Generates Owner -> Bonds index key. +func getOwnerToBondsIndexKey(owner string, bondID string) []byte { + return append(append(prefixOwnerToBondsIndex, []byte(owner)...), []byte(bondID)...) +} + +// BondID simplifies generation of bond IDs. +type BondID struct { + Address sdk.Address + AccNum uint64 + Sequence uint64 +} + +// Generate creates the bond ID. +func (bondID BondID) Generate() string { + hasher := sha256.New() + str := fmt.Sprintf("%s:%d:%d", bondID.Address.String(), bondID.AccNum, bondID.Sequence) + hasher.Write([]byte(str)) + return hex.EncodeToString(hasher.Sum(nil)) +} + +// MatchBonds - get all matching bonds. +func (k Keeper) MatchBonds(ctx sdk.Context, matchFn func(*types.Bond) bool) []*types.Bond { + var bonds []*types.Bond + + store := ctx.KVStore(k.storeKey) + itr := sdk.KVStorePrefixIterator(store, prefixIDToBondIndex) + defer itr.Close() + for ; itr.Valid(); itr.Next() { + bz := store.Get(itr.Key()) + if bz != nil { + var obj types.Bond + k.cdc.MustUnmarshal(bz, &obj) + if matchFn(&obj) { + bonds = append(bonds, &obj) + } + } + } + + return bonds +} + +// CreateBond creates a new bond. +func (k Keeper) CreateBond(ctx sdk.Context, ownerAddress sdk.AccAddress, coins sdk.Coins) (*types.Bond, error) { + // Check if account has funds. + for _, coin := range coins { + balance := k.bankKeeper.HasBalance(ctx, ownerAddress, coin) + if !balance { + return nil, sdkerrors.Wrap(sdkerrors.ErrInsufficientFunds, "failed to create bond; Insufficient funds") + } + } + + // Generate bond ID. + account := k.accountKeeper.GetAccount(ctx, ownerAddress) + bondID := BondID{ + Address: ownerAddress, + AccNum: account.GetAccountNumber(), + Sequence: account.GetSequence(), + }.Generate() + + maxBondAmount, err := k.getMaxBondAmount(ctx) + if err != nil { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Invalid max bond amount.") + } + + bond := types.Bond{Id: bondID, Owner: ownerAddress.String(), Balance: coins} + if bond.Balance.IsAnyGT(maxBondAmount) { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Max bond amount exceeded.") + } + + // Move funds into the bond account module. + err = k.bankKeeper.SendCoinsFromAccountToModule(ctx, ownerAddress, types.ModuleName, bond.Balance) + if err != nil { + return nil, err + } + + // Save bond in store. + k.SaveBond(ctx, &bond) + + return &bond, nil +} + +// SaveBond - saves a bond to the store. +func (k Keeper) SaveBond(ctx sdk.Context, bond *types.Bond) { + store := ctx.KVStore(k.storeKey) + + // Bond ID -> Bond index. + store.Set(getBondIndexKey(bond.Id), k.cdc.MustMarshal(bond)) + + // Owner -> [Bond] index. + store.Set(getOwnerToBondsIndexKey(bond.Owner, bond.Id), []byte{}) +} + +// HasBond - checks if a bond by the given ID exists. +func (k Keeper) HasBond(ctx sdk.Context, id string) bool { + store := ctx.KVStore(k.storeKey) + return store.Has(getBondIndexKey(id)) +} + +// GetBond - gets a record from the store. +func (k Keeper) GetBond(ctx sdk.Context, id string) types.Bond { + store := ctx.KVStore(k.storeKey) + + bz := store.Get(getBondIndexKey(id)) + var obj types.Bond + k.cdc.MustUnmarshal(bz, &obj) + + return obj +} + +// DeleteBond - deletes the bond. +func (k Keeper) DeleteBond(ctx sdk.Context, bond types.Bond) { + store := ctx.KVStore(k.storeKey) + store.Delete(getBondIndexKey(bond.Id)) + store.Delete(getOwnerToBondsIndexKey(bond.Owner, bond.Id)) +} + +// ListBonds - get all bonds. +func (k Keeper) ListBonds(ctx sdk.Context) []*types.Bond { + var bonds []*types.Bond + + store := ctx.KVStore(k.storeKey) + itr := sdk.KVStorePrefixIterator(store, prefixIDToBondIndex) + defer itr.Close() + for ; itr.Valid(); itr.Next() { + bz := store.Get(itr.Key()) + if bz != nil { + var obj types.Bond + k.cdc.MustUnmarshal(bz, &obj) + bonds = append(bonds, &obj) + } + } + return bonds +} + +// QueryBondsByOwner - query bonds by owner. +func (k Keeper) QueryBondsByOwner(ctx sdk.Context, ownerAddress string) []types.Bond { + var bonds []types.Bond + + ownerPrefix := append(prefixOwnerToBondsIndex, []byte(ownerAddress)...) + store := ctx.KVStore(k.storeKey) + itr := sdk.KVStorePrefixIterator(store, ownerPrefix) + defer itr.Close() + for ; itr.Valid(); itr.Next() { + bondID := itr.Key()[len(ownerPrefix):] + bz := store.Get(append(prefixIDToBondIndex, bondID...)) + if bz != nil { + var obj types.Bond + k.cdc.MustUnmarshal(bz, &obj) + bonds = append(bonds, obj) + } + } + + return bonds +} + +// RefillBond refills an existing bond. +func (k Keeper) RefillBond(ctx sdk.Context, id string, ownerAddress sdk.AccAddress, coins sdk.Coins) (*types.Bond, error) { + if !k.HasBond(ctx, id) { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Bond not found.") + } + + bond := k.GetBond(ctx, id) + if bond.Owner != ownerAddress.String() { + return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Bond owner mismatch.") + } + + // Check if account has funds. + for _, coin := range coins { + if !k.bankKeeper.HasBalance(ctx, ownerAddress, coin) { + return nil, sdkerrors.Wrap(sdkerrors.ErrInsufficientFunds, "Insufficient funds.") + } + } + + maxBondAmount, err := k.getMaxBondAmount(ctx) + if err != nil { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Invalid max bond amount.") + } + + updatedBalance := bond.Balance.Add(coins...) + if updatedBalance.IsAnyGT(maxBondAmount) { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Max bond amount exceeded.") + } + + // Move funds into the bond account module. + err = k.bankKeeper.SendCoinsFromAccountToModule(ctx, ownerAddress, types.ModuleName, coins) + if err != nil { + return nil, err + } + + // Update bond balance and save. + bond.Balance = updatedBalance + k.SaveBond(ctx, &bond) + + return &bond, nil +} + +// WithdrawBond withdraws funds from a bond. +func (k Keeper) WithdrawBond(ctx sdk.Context, id string, ownerAddress sdk.AccAddress, coins sdk.Coins) (*types.Bond, error) { + if !k.HasBond(ctx, id) { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Bond not found.") + } + + bond := k.GetBond(ctx, id) + if bond.Owner != ownerAddress.String() { + return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Bond owner mismatch.") + } + + updatedBalance, isNeg := bond.Balance.SafeSub(coins) + if isNeg { + return nil, sdkerrors.Wrap(sdkerrors.ErrInsufficientFunds, "Insufficient bond balance.") + } + + // Move funds from the bond into the account. + err := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, ownerAddress, coins) + if err != nil { + return nil, err + } + + // Update bond balance and save. + bond.Balance = updatedBalance + k.SaveBond(ctx, &bond) + + return &bond, nil +} + +// CancelBond cancels a bond, returning funds to the owner. +func (k Keeper) CancelBond(ctx sdk.Context, id string, ownerAddress sdk.AccAddress) (*types.Bond, error) { + if !k.HasBond(ctx, id) { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Bond not found.") + } + + bond := k.GetBond(ctx, id) + if bond.Owner != ownerAddress.String() { + return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Bond owner mismatch.") + } + + // Check if bond is used in other modules. + for _, usageKeeper := range k.usageKeepers { + if usageKeeper.UsesBond(ctx, id) { + return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, fmt.Sprintf("Bond in use by the '%s' module.", usageKeeper.ModuleName())) + } + } + + // Move funds from the bond into the account. + err := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, ownerAddress, bond.Balance) + if err != nil { + return nil, err + } + + k.DeleteBond(ctx, bond) + + return &bond, nil +} + +func (k Keeper) getMaxBondAmount(ctx sdk.Context) (sdk.Coins, error) { + params := k.GetParams(ctx) + maxBondAmount := params.MaxBondAmount + return sdk.NewCoins(maxBondAmount), nil +} + +// GetBondModuleBalances gets the bond module account(s) balances. +func (k Keeper) GetBondModuleBalances(ctx sdk.Context) sdk.Coins { + moduleAddress := k.accountKeeper.GetModuleAddress(types.ModuleName) + balances := k.bankKeeper.GetAllBalances(ctx, moduleAddress) + return balances +} + +// TransferCoinsToModuleAccount moves funds from the bonds module account to another module account. +func (k Keeper) TransferCoinsToModuleAccount(ctx sdk.Context, id, moduleAccount string, coins sdk.Coins) error { + if !k.HasBond(ctx, id) { + return sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Bond not found.") + } + + bondObj := k.GetBond(ctx, id) + + // Deduct rent from bond. + updatedBalance, isNeg := bondObj.Balance.SafeSub(coins) + + if isNeg { + // Check if bond has sufficient funds. + return sdkerrors.Wrap(sdkerrors.ErrInsufficientFunds, "Insufficient funds.") + } + + // Move funds from bond module to record rent module. + err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, moduleAccount, coins) + if err != nil { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Error transferring funds.") + } + + // Update bond balance. + bondObj.Balance = updatedBalance + k.SaveBond(ctx, &bondObj) + + return nil +} diff --git a/x/bond/keeper/keeper_test.go b/x/bond/keeper/keeper_test.go new file mode 100644 index 00000000..c9444704 --- /dev/null +++ b/x/bond/keeper/keeper_test.go @@ -0,0 +1,52 @@ +package keeper_test + +import ( + "testing" + + "github.com/cosmos/cosmos-sdk/baseapp" + "github.com/cosmos/cosmos-sdk/simapp" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + "github.com/tharsis/ethermint/app" + bondkeeper "github.com/tharsis/ethermint/x/bond/keeper" + "github.com/tharsis/ethermint/x/bond/types" +) + +type KeeperTestSuite struct { + suite.Suite + app *app.EthermintApp + ctx sdk.Context + queryClient types.QueryClient +} + +func (suite *KeeperTestSuite) SetupTest() { + testApp := app.Setup(false, func(ea *app.EthermintApp, genesis simapp.GenesisState) simapp.GenesisState { + return genesis + }) + ctx := testApp.BaseApp.NewContext(false, tmproto.Header{}) + + querier := bondkeeper.Querier{Keeper: testApp.BondKeeper} + + queryHelper := baseapp.NewQueryServerTestHelper(ctx, testApp.InterfaceRegistry()) + types.RegisterQueryServer(queryHelper, querier) + queryClient := types.NewQueryClient(queryHelper) + + suite.app, suite.ctx, suite.queryClient = testApp, ctx, queryClient +} + +func TestParams(t *testing.T) { + testApp := app.Setup(false, func(ea *app.EthermintApp, genesis simapp.GenesisState) simapp.GenesisState { + return genesis + }) + ctx := testApp.BaseApp.NewContext(false, tmproto.Header{}) + + expParams := types.DefaultParams() + params := testApp.BondKeeper.GetParams(ctx) + require.Equal(t, expParams.MaxBondAmount, params.MaxBondAmount) +} + +func TestKeeperTestSuite(t *testing.T) { + suite.Run(t, new(KeeperTestSuite)) +} diff --git a/x/bond/keeper/msg_server.go b/x/bond/keeper/msg_server.go new file mode 100644 index 00000000..f34a60b8 --- /dev/null +++ b/x/bond/keeper/msg_server.go @@ -0,0 +1,130 @@ +package keeper + +import ( + "context" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/tharsis/ethermint/x/bond/types" +) + +type msgServer struct { + Keeper +} + +// NewMsgServerImpl returns an implementation of the bond MsgServer interface for the provided Keeper. +func NewMsgServerImpl(keeper Keeper) types.MsgServer { + return &msgServer{Keeper: keeper} +} + +var _ types.MsgServer = msgServer{} + +func (k msgServer) CreateBond(c context.Context, msg *types.MsgCreateBond) (*types.MsgCreateBondResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + signerAddress, err := sdk.AccAddressFromBech32(msg.Signer) + if err != nil { + return nil, err + } + _, err = k.Keeper.CreateBond(ctx, signerAddress, msg.Coins) + if err != nil { + return nil, err + } + + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.EventTypeCreateBond, + sdk.NewAttribute(types.AttributeKeySigner, msg.Signer), + sdk.NewAttribute(sdk.AttributeKeyAmount, msg.Coins.String()), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + sdk.NewAttribute(types.AttributeKeySigner, msg.Signer), + ), + }) + + return &types.MsgCreateBondResponse{}, nil +} + +func (k msgServer) RefillBond(c context.Context, msg *types.MsgRefillBond) (*types.MsgRefillBondResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + signerAddress, err := sdk.AccAddressFromBech32(msg.Signer) + if err != nil { + return nil, err + } + + _, err = k.Keeper.RefillBond(ctx, msg.Id, signerAddress, msg.Coins) + if err != nil { + return nil, err + } + + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.EventTypeRefillBond, + sdk.NewAttribute(types.AttributeKeySigner, msg.Signer), + sdk.NewAttribute(types.AttributeKeyBondId, msg.Id), + sdk.NewAttribute(sdk.AttributeKeyAmount, msg.Coins.String()), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + sdk.NewAttribute(types.AttributeKeySigner, msg.Signer), + ), + }) + + return &types.MsgRefillBondResponse{}, nil +} + +func (k msgServer) WithdrawBond(c context.Context, msg *types.MsgWithdrawBond) (*types.MsgWithdrawBondResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + signerAddress, err := sdk.AccAddressFromBech32(msg.Signer) + if err != nil { + return nil, err + } + + _, err = k.Keeper.WithdrawBond(ctx, msg.Id, signerAddress, msg.Coins) + if err != nil { + return nil, err + } + + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.EventTypeWithdrawBond, + sdk.NewAttribute(types.AttributeKeySigner, msg.Signer), + sdk.NewAttribute(types.AttributeKeyBondId, msg.Id), + sdk.NewAttribute(sdk.AttributeKeyAmount, msg.Coins.String()), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + sdk.NewAttribute(types.AttributeKeySigner, msg.Signer), + ), + }) + + return &types.MsgWithdrawBondResponse{}, nil +} + +func (k msgServer) CancelBond(c context.Context, msg *types.MsgCancelBond) (*types.MsgCancelBondResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + signerAddress, err := sdk.AccAddressFromBech32(msg.Signer) + if err != nil { + return nil, err + } + _, err = k.Keeper.CancelBond(ctx, msg.Id, signerAddress) + if err != nil { + return nil, err + } + + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.EventTypeCancelBond, + sdk.NewAttribute(types.AttributeKeySigner, msg.Signer), + sdk.NewAttribute(types.AttributeKeyBondId, msg.Id), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + sdk.NewAttribute(types.AttributeKeySigner, msg.Signer), + ), + }) + + return &types.MsgCancelBondResponse{}, nil +} diff --git a/x/bond/keeper/params.go b/x/bond/keeper/params.go new file mode 100644 index 00000000..d2a484cf --- /dev/null +++ b/x/bond/keeper/params.go @@ -0,0 +1,23 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/tharsis/ethermint/x/bond/types" +) + +// GetMaxBondAmount max bond amount +func (k Keeper) GetMaxBondAmount(ctx sdk.Context) (res sdk.Coin) { + k.paramSubspace.Get(ctx, types.ParamStoreKeyMaxBondAmount, &res) + return +} + +// GetParams - Get all parameter as types.Params. +func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { + getMaxBondAmount := k.GetMaxBondAmount(ctx) + return types.Params{MaxBondAmount: getMaxBondAmount} +} + +// SetParams - set the params. +func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { + k.paramSubspace.SetParamSet(ctx, ¶ms) +} diff --git a/x/bond/module.go b/x/bond/module.go new file mode 100644 index 00000000..eb9f0103 --- /dev/null +++ b/x/bond/module.go @@ -0,0 +1,135 @@ +package bond + +import ( + "context" + "encoding/json" + "fmt" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + "github.com/gorilla/mux" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/spf13/cobra" + abci "github.com/tendermint/tendermint/abci/types" + "github.com/tharsis/ethermint/x/bond/client/cli" + "github.com/tharsis/ethermint/x/bond/keeper" + "github.com/tharsis/ethermint/x/bond/types" +) + +var ( + _ module.AppModule = AppModule{} + _ module.AppModuleBasic = AppModuleBasic{} +) + +// AppModuleBasic defines the basic application module used by the staking module. +type AppModuleBasic struct { + cdc codec.Codec +} + +func (b AppModuleBasic) RegisterLegacyAminoCodec(amino *codec.LegacyAmino) { + types.RegisterLegacyAminoCodec(amino) +} + +func (b AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry) { + types.RegisterInterfaces(registry) +} + +func (b AppModuleBasic) DefaultGenesis(jsonCodec codec.JSONCodec) json.RawMessage { + return jsonCodec.MustMarshalJSON(types.DefaultGenesisState()) +} + +func (b AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, message json.RawMessage) error { + var data types.GenesisState + if err := cdc.UnmarshalJSON(message, &data); err != nil { + return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) + } + + return ValidateGenesis(data) +} + +func (b AppModuleBasic) RegisterRESTRoutes(context client.Context, router *mux.Router) { +} + +func (b AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, serveMux *runtime.ServeMux) { + err := types.RegisterQueryHandlerClient(context.Background(), serveMux, types.NewQueryClient(clientCtx)) + if err != nil { + panic(err) + } +} + +func (b AppModuleBasic) GetTxCmd() *cobra.Command { + return cli.NewTxCmd() +} + +func (b AppModuleBasic) GetQueryCmd() *cobra.Command { + return cli.GetQueryCmd() +} + +// Name returns the staking module's name. +func (AppModuleBasic) Name() string { + return types.ModuleName +} + +type AppModule struct { + AppModuleBasic + keeper keeper.Keeper +} + +// NewAppModule creates a new AppModule Object +func NewAppModule(cdc codec.Codec, keeper keeper.Keeper) AppModule { + return AppModule{ + AppModuleBasic: AppModuleBasic{cdc: cdc}, + keeper: keeper, + } +} + +func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, message json.RawMessage) []abci.ValidatorUpdate { + var genesisState types.GenesisState + + cdc.MustUnmarshalJSON(message, &genesisState) + + return InitGenesis(ctx, am.keeper, genesisState) +} + +func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { + gs := ExportGenesis(ctx, am.keeper) + return cdc.MustMarshalJSON(&gs) +} + +func (am AppModule) RegisterInvariants(registry sdk.InvariantRegistry) { + keeper.RegisterInvariants(registry, am.keeper) +} + +func (am AppModule) Route() sdk.Route { + return sdk.Route{} +} + +func (am AppModule) QuerierRoute() string { + return types.QuerierRoute +} + +func (am AppModule) LegacyQuerierHandler(amino *codec.LegacyAmino) sdk.Querier { + return nil +} + +func (am AppModule) RegisterServices(cfg module.Configurator) { + querier := keeper.Querier{Keeper: am.keeper} + types.RegisterQueryServer(cfg.QueryServer(), querier) + + msgServer := keeper.NewMsgServerImpl(am.keeper) + types.RegisterMsgServer(cfg.MsgServer(), msgServer) +} + +func (am AppModule) ConsensusVersion() uint64 { + return 1 +} + +func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { + BeginBlocker(ctx, am.keeper) +} + +func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { + return EndBlocker(ctx, am.keeper) +} diff --git a/x/bond/module_test.go b/x/bond/module_test.go new file mode 100644 index 00000000..c4cd211c --- /dev/null +++ b/x/bond/module_test.go @@ -0,0 +1,27 @@ +package bond_test + +import ( + "testing" + + "github.com/cosmos/cosmos-sdk/simapp" + "github.com/stretchr/testify/require" + abcitypes "github.com/tendermint/tendermint/abci/types" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + app "github.com/tharsis/ethermint/app" + bondtypes "github.com/tharsis/ethermint/x/bond/types" +) + +func TestItCreatesModuleAccountOnInitBlock(t *testing.T) { + app := app.Setup(false, func(ea *app.EthermintApp, genesis simapp.GenesisState) simapp.GenesisState { + return genesis + }) + ctx := app.BaseApp.NewContext(false, tmproto.Header{}) + + app.InitChain(abcitypes.RequestInitChain{ + AppStateBytes: []byte("{}"), + ChainId: "test-chain-id", + }) + + acc := app.AccountKeeper.GetModuleAccount(ctx, bondtypes.ModuleName) + require.NotNil(t, acc) +} diff --git a/x/bond/types/bond.pb.go b/x/bond/types/bond.pb.go new file mode 100644 index 00000000..28a22501 --- /dev/null +++ b/x/bond/types/bond.pb.go @@ -0,0 +1,620 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: vulcanize/bond/v1beta1/bond.proto + +package types + +import ( + fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/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 bond module parameters +type Params struct { + // max_bond_amount is maximum amount to bond + MaxBondAmount types.Coin `protobuf:"bytes,1,opt,name=max_bond_amount,json=maxBondAmount,proto3" json:"max_bond_amount" json:"max_bond_amount" yaml:"max_bond_amount"` +} + +func (m *Params) Reset() { *m = Params{} } +func (m *Params) String() string { return proto.CompactTextString(m) } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_ff3ef02fadb61511, []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 (m *Params) GetMaxBondAmount() types.Coin { + if m != nil { + return m.MaxBondAmount + } + return types.Coin{} +} + +// Bond represents funds deposited by an account for record rent payments. +type Bond struct { + // id is unique identifier of the bond + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // owner of the bond + Owner string `protobuf:"bytes,2,opt,name=owner,proto3" json:"owner,omitempty"` + // balance of the bond + Balance github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,3,rep,name=balance,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"balance" json:"balance" yaml:"balance"` +} + +func (m *Bond) Reset() { *m = Bond{} } +func (m *Bond) String() string { return proto.CompactTextString(m) } +func (*Bond) ProtoMessage() {} +func (*Bond) Descriptor() ([]byte, []int) { + return fileDescriptor_ff3ef02fadb61511, []int{1} +} +func (m *Bond) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Bond) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Bond.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 *Bond) XXX_Merge(src proto.Message) { + xxx_messageInfo_Bond.Merge(m, src) +} +func (m *Bond) XXX_Size() int { + return m.Size() +} +func (m *Bond) XXX_DiscardUnknown() { + xxx_messageInfo_Bond.DiscardUnknown(m) +} + +var xxx_messageInfo_Bond proto.InternalMessageInfo + +func (m *Bond) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +func (m *Bond) GetOwner() string { + if m != nil { + return m.Owner + } + return "" +} + +func (m *Bond) GetBalance() github_com_cosmos_cosmos_sdk_types.Coins { + if m != nil { + return m.Balance + } + return nil +} + +func init() { + proto.RegisterType((*Params)(nil), "vulcanize.bond.v1beta1.Params") + proto.RegisterType((*Bond)(nil), "vulcanize.bond.v1beta1.Bond") +} + +func init() { proto.RegisterFile("vulcanize/bond/v1beta1/bond.proto", fileDescriptor_ff3ef02fadb61511) } + +var fileDescriptor_ff3ef02fadb61511 = []byte{ + // 344 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x91, 0xc1, 0x4e, 0x32, 0x31, + 0x14, 0x85, 0xa7, 0xf0, 0xff, 0x18, 0xc7, 0xa8, 0xc9, 0x84, 0x18, 0x24, 0xb1, 0x20, 0x2b, 0x5c, + 0x30, 0x0d, 0x1a, 0x37, 0xee, 0x84, 0x17, 0x50, 0x96, 0x6e, 0x48, 0x67, 0xa6, 0x81, 0x2a, 0xed, + 0x25, 0xd3, 0x82, 0x83, 0x4b, 0x17, 0xae, 0x7d, 0x0e, 0xf7, 0xbe, 0x03, 0x4b, 0x96, 0xae, 0xd0, + 0xc0, 0x1b, 0xf8, 0x04, 0x66, 0xda, 0x19, 0x62, 0x34, 0x71, 0xd5, 0x9e, 0xdb, 0x73, 0xbf, 0x7b, + 0xd2, 0xeb, 0x1e, 0x4f, 0x27, 0xa3, 0x90, 0x4a, 0xfe, 0xc0, 0x48, 0x00, 0x32, 0x22, 0xd3, 0x76, + 0xc0, 0x34, 0x6d, 0x1b, 0xe1, 0x8f, 0x63, 0xd0, 0xe0, 0x1d, 0x6c, 0x2c, 0xbe, 0xa9, 0x66, 0x96, + 0x6a, 0x79, 0x00, 0x03, 0x30, 0x16, 0x92, 0xde, 0xac, 0xbb, 0x8a, 0x43, 0x50, 0x02, 0x14, 0x09, + 0xa8, 0x62, 0x1b, 0x5a, 0x08, 0x5c, 0xda, 0xf7, 0xc6, 0x23, 0x72, 0x4b, 0x57, 0x34, 0xa6, 0x42, + 0x79, 0x89, 0xbb, 0x2f, 0x68, 0xd2, 0x4f, 0xa1, 0x7d, 0x2a, 0x60, 0x22, 0x75, 0x05, 0xd5, 0x51, + 0x73, 0xe7, 0xf4, 0xd0, 0xb7, 0x10, 0x3f, 0x85, 0xe4, 0xf3, 0xfc, 0x2e, 0x70, 0xd9, 0x39, 0x9f, + 0x2f, 0x6b, 0xce, 0xe7, 0xb2, 0xd6, 0xba, 0x55, 0x20, 0x2f, 0x1a, 0x3f, 0xfa, 0x1b, 0xf5, 0x19, + 0x15, 0xa3, 0xdf, 0xe5, 0xde, 0xae, 0xa0, 0x49, 0x07, 0x64, 0x74, 0x69, 0xf5, 0x2b, 0x72, 0xff, + 0xa5, 0xd2, 0xdb, 0x73, 0x0b, 0x3c, 0x32, 0x53, 0xb7, 0x7b, 0x05, 0x1e, 0x79, 0x65, 0xf7, 0x3f, + 0xdc, 0x4b, 0x16, 0x57, 0x0a, 0xa6, 0x64, 0x85, 0xf7, 0x84, 0xdc, 0xad, 0x80, 0x8e, 0xa8, 0x0c, + 0x59, 0xa5, 0x58, 0x2f, 0xfe, 0x9d, 0xf0, 0x3a, 0x4b, 0x78, 0x64, 0x13, 0x66, 0x7d, 0x79, 0xb2, + 0x5c, 0xbe, 0xbc, 0xd7, 0x9a, 0x03, 0xae, 0x87, 0x93, 0xc0, 0x0f, 0x41, 0x90, 0xec, 0xd3, 0xec, + 0xd1, 0x52, 0xd1, 0x1d, 0xd1, 0xb3, 0x31, 0x53, 0x86, 0xa8, 0x7a, 0xf9, 0xf0, 0x4e, 0x77, 0xbe, + 0xc2, 0x68, 0xb1, 0xc2, 0xe8, 0x63, 0x85, 0xd1, 0xf3, 0x1a, 0x3b, 0x8b, 0x35, 0x76, 0xde, 0xd6, + 0xd8, 0xb9, 0x39, 0xf9, 0x06, 0xd3, 0x43, 0x1a, 0x2b, 0xae, 0x08, 0xd3, 0x43, 0x16, 0x0b, 0x2e, + 0x35, 0x49, 0xec, 0x72, 0x0d, 0x33, 0x28, 0x99, 0x45, 0x9c, 0x7d, 0x05, 0x00, 0x00, 0xff, 0xff, + 0x45, 0xf7, 0x5e, 0x13, 0xfb, 0x01, 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 + { + size, err := m.MaxBondAmount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintBond(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *Bond) 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 *Bond) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Bond) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Balance) > 0 { + for iNdEx := len(m.Balance) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Balance[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintBond(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintBond(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0x12 + } + if len(m.Id) > 0 { + i -= len(m.Id) + copy(dAtA[i:], m.Id) + i = encodeVarintBond(dAtA, i, uint64(len(m.Id))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintBond(dAtA []byte, offset int, v uint64) int { + offset -= sovBond(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 + l = m.MaxBondAmount.Size() + n += 1 + l + sovBond(uint64(l)) + return n +} + +func (m *Bond) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Id) + if l > 0 { + n += 1 + l + sovBond(uint64(l)) + } + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovBond(uint64(l)) + } + if len(m.Balance) > 0 { + for _, e := range m.Balance { + l = e.Size() + n += 1 + l + sovBond(uint64(l)) + } + } + return n +} + +func sovBond(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozBond(x uint64) (n int) { + return sovBond(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 ErrIntOverflowBond + } + 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 { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxBondAmount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBond + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthBond + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthBond + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MaxBondAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipBond(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthBond + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Bond) 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 ErrIntOverflowBond + } + 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: Bond: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Bond: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBond + } + 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 ErrInvalidLengthBond + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthBond + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Id = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBond + } + 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 ErrInvalidLengthBond + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthBond + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Owner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Balance", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBond + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthBond + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthBond + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Balance = append(m.Balance, types.Coin{}) + if err := m.Balance[len(m.Balance)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipBond(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthBond + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipBond(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, ErrIntOverflowBond + } + 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, ErrIntOverflowBond + } + 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, ErrIntOverflowBond + } + 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, ErrInvalidLengthBond + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupBond + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthBond + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthBond = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowBond = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupBond = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/bond/types/codec.go b/x/bond/types/codec.go new file mode 100644 index 00000000..90017b79 --- /dev/null +++ b/x/bond/types/codec.go @@ -0,0 +1,39 @@ +package types + +import ( + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/types" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/msgservice" +) + +// RegisterLegacyAminoCodec registers the necessary x/bond interfaces and concrete types +// on the provided LegacyAmino codec. These types are used for Amino JSON serialization. +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + cdc.RegisterConcrete(&MsgCreateBond{}, "bond/MsgCreateBond", nil) + cdc.RegisterConcrete(&MsgRefillBond{}, "bond/MsgRefillBond", nil) + cdc.RegisterConcrete(&MsgWithdrawBond{}, "bond/MsgWithdrawBond", nil) + cdc.RegisterConcrete(&MsgCancelBond{}, "bond/MsgCancelBond", nil) +} + +func RegisterInterfaces(registry types.InterfaceRegistry) { + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgCreateBond{}, + &MsgRefillBond{}, + &MsgCancelBond{}, + &MsgWithdrawBond{}, + ) + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) +} + +var ( + amino = codec.NewLegacyAmino() + ModuleCdc = codec.NewAminoCodec(amino) +) + +func init() { + RegisterLegacyAminoCodec(amino) + cryptocodec.RegisterCrypto(amino) + amino.Seal() +} diff --git a/x/bond/types/events.go b/x/bond/types/events.go new file mode 100644 index 00000000..11a7fd42 --- /dev/null +++ b/x/bond/types/events.go @@ -0,0 +1,15 @@ +package types + +// bond module event types + +const ( + EventTypeCreateBond = "crate_bond" + EventTypeRefillBond = "refill_bond" + EventTypeCancelBond = "cancel_bond" + EventTypeWithdrawBond = "withdraw_bond" + + AttributeKeySigner = "signer" + AttributeKeyAmount = "amount" + AttributeKeyBondId = "bond_id" + AttributeValueCategory = ModuleName +) diff --git a/x/bond/types/expected_keeper.go b/x/bond/types/expected_keeper.go new file mode 100644 index 00000000..a17e8931 --- /dev/null +++ b/x/bond/types/expected_keeper.go @@ -0,0 +1,12 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// BondUsageKeeper keep track of bond usage in other modules. +// Used to, for example, prevent deletion of a bond that's in use. +type BondUsageKeeper interface { + ModuleName() string + UsesBond(ctx sdk.Context, bondId string) bool +} diff --git a/x/bond/types/genesis.go b/x/bond/types/genesis.go new file mode 100644 index 00000000..04a185f5 --- /dev/null +++ b/x/bond/types/genesis.go @@ -0,0 +1,9 @@ +package types + +// DefaultGenesisState sets default evm genesis state with empty accounts and default params and +// chain config values. +func DefaultGenesisState() *GenesisState { + return &GenesisState{ + Params: DefaultParams(), + } +} diff --git a/x/bond/types/genesis.pb.go b/x/bond/types/genesis.pb.go new file mode 100644 index 00000000..eea1c623 --- /dev/null +++ b/x/bond/types/genesis.pb.go @@ -0,0 +1,391 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: vulcanize/bond/v1beta1/genesis.proto + +package types + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/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 bond module's genesis state. +type GenesisState struct { + // params defines all the parameters of the module. + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` + // bonds defines all the bonds + Bonds []*Bond `protobuf:"bytes,2,rep,name=bonds,proto3" json:"bonds,omitempty" json:"bonds" yaml:"bonds"` +} + +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_f9582eb9edb1dcdf, []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 (m *GenesisState) GetBonds() []*Bond { + if m != nil { + return m.Bonds + } + return nil +} + +func init() { + proto.RegisterType((*GenesisState)(nil), "vulcanize.bond.v1beta1.GenesisState") +} + +func init() { + proto.RegisterFile("vulcanize/bond/v1beta1/genesis.proto", fileDescriptor_f9582eb9edb1dcdf) +} + +var fileDescriptor_f9582eb9edb1dcdf = []byte{ + // 259 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x29, 0x2b, 0xcd, 0x49, + 0x4e, 0xcc, 0xcb, 0xac, 0x4a, 0xd5, 0x4f, 0xca, 0xcf, 0x4b, 0xd1, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, + 0x49, 0x34, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, + 0x17, 0x12, 0x83, 0xab, 0xd2, 0x03, 0xa9, 0xd2, 0x83, 0xaa, 0x92, 0x12, 0x49, 0xcf, 0x4f, 0xcf, + 0x07, 0x2b, 0xd1, 0x07, 0xb1, 0x20, 0xaa, 0xa5, 0x14, 0x71, 0x98, 0x09, 0xd6, 0x0a, 0x56, 0xa2, + 0x34, 0x9f, 0x91, 0x8b, 0xc7, 0x1d, 0x62, 0x45, 0x70, 0x49, 0x62, 0x49, 0xaa, 0x90, 0x0d, 0x17, + 0x5b, 0x41, 0x62, 0x51, 0x62, 0x6e, 0xb1, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0xb7, 0x91, 0x9c, 0x1e, + 0x76, 0x2b, 0xf5, 0x02, 0xc0, 0xaa, 0x9c, 0x58, 0x4e, 0xdc, 0x93, 0x67, 0x08, 0x82, 0xea, 0x11, + 0x0a, 0xe4, 0x62, 0x05, 0x29, 0x2a, 0x96, 0x60, 0x52, 0x60, 0xd6, 0xe0, 0x36, 0x92, 0xc1, 0xa5, + 0xd9, 0x29, 0x3f, 0x2f, 0xc5, 0x49, 0xf6, 0xd3, 0x3d, 0x79, 0xc9, 0xac, 0xe2, 0xfc, 0x3c, 0x2b, + 0x25, 0xb0, 0x26, 0x25, 0x85, 0xca, 0xc4, 0xdc, 0x1c, 0x18, 0x27, 0x08, 0x62, 0x92, 0x93, 0xf3, + 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, 0xa6, 0x67, 0x96, 0x64, 0x94, + 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0x97, 0x64, 0x24, 0x16, 0x15, 0x67, 0x16, 0xeb, 0xa7, 0x96, + 0x64, 0xa4, 0x16, 0xe5, 0x66, 0xe6, 0x95, 0xe8, 0x57, 0x40, 0xfc, 0x5c, 0x52, 0x59, 0x90, 0x5a, + 0x9c, 0xc4, 0x06, 0xf6, 0xad, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0xaa, 0xe9, 0x23, 0x03, 0x66, + 0x01, 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 + if len(m.Bonds) > 0 { + for iNdEx := len(m.Bonds) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Bonds[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + 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)) + if len(m.Bonds) > 0 { + for _, e := range m.Bonds { + l = e.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 + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Bonds", 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 + } + m.Bonds = append(m.Bonds, &Bond{}) + if err := m.Bonds[len(m.Bonds)-1].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/bond/types/keys.go b/x/bond/types/keys.go new file mode 100644 index 00000000..6c5ac625 --- /dev/null +++ b/x/bond/types/keys.go @@ -0,0 +1,15 @@ +package types + +const ( + // ModuleName is the name of the staking module + ModuleName = "bond" + + // StoreKey is the string store representation + StoreKey = ModuleName + + // QuerierRoute is the querier route for the staking module + QuerierRoute = ModuleName + + // RouterKey is the msg router key for the staking module + RouterKey = ModuleName +) diff --git a/x/bond/types/msg.go b/x/bond/types/msg.go new file mode 100644 index 00000000..653d14c0 --- /dev/null +++ b/x/bond/types/msg.go @@ -0,0 +1,161 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +var ( + _ sdk.Msg = &MsgCreateBond{} + _ sdk.Msg = &MsgRefillBond{} + _ sdk.Msg = &MsgWithdrawBond{} + _ sdk.Msg = &MsgCancelBond{} +) + +// NewMsgCreateBond is the constructor function for MsgCreateBond. +func NewMsgCreateBond(coins sdk.Coins, signer sdk.AccAddress) MsgCreateBond { + return MsgCreateBond{ + Coins: coins, + Signer: signer.String(), + } +} + +// Route Implements Msg. +func (msg MsgCreateBond) Route() string { return RouterKey } + +// Type Implements Msg. +func (msg MsgCreateBond) Type() string { return "create" } + +func (msg MsgCreateBond) ValidateBasic() error { + if len(msg.Signer) == 0 { + return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, msg.Signer) + } + if len(msg.Coins) == 0 || !msg.Coins.IsValid() { + return sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, "Invalid amount.") + } + return nil +} + +func (msg MsgCreateBond) GetSigners() []sdk.AccAddress { + accAddr, _ := sdk.AccAddressFromBech32(msg.Signer) + return []sdk.AccAddress{accAddr} +} + +// GetSignBytes gets the sign bytes for the msg MsgCreateBond +func (msg MsgCreateBond) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +// NewMsgRefillBond is the constructor function for MsgRefillBond. +func NewMsgRefillBond(id string, amount sdk.Coin, signer sdk.AccAddress) MsgRefillBond { + return MsgRefillBond{ + Id: id, + Coins: sdk.NewCoins(amount), + Signer: signer.String(), + } +} + +// Route Implements Msg. +func (msg MsgRefillBond) Route() string { return RouterKey } + +// Type Implements Msg. +func (msg MsgRefillBond) Type() string { return "refill" } + +func (msg MsgRefillBond) ValidateBasic() error { + if len(msg.Id) == 0 { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, msg.Id) + } + if len(msg.Signer) == 0 { + return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, msg.Signer) + } + if len(msg.Coins) == 0 || !msg.Coins.IsValid() { + return sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, "Invalid amount.") + } + return nil +} + +func (msg MsgRefillBond) GetSigners() []sdk.AccAddress { + accAddr, _ := sdk.AccAddressFromBech32(msg.Signer) + return []sdk.AccAddress{accAddr} +} + +// GetSignBytes gets the sign bytes for the msg MsgCreateBond +func (msg MsgRefillBond) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +// NewMsgWithdrawBond is the constructor function for NewMsgWithdrawBond. +func NewMsgWithdrawBond(id string, amount sdk.Coin, signer sdk.AccAddress) MsgWithdrawBond { + return MsgWithdrawBond{ + Id: id, + Coins: sdk.NewCoins(amount), + Signer: signer.String(), + } +} + +// Route Implements Msg. +func (msg MsgWithdrawBond) Route() string { return RouterKey } + +// Type Implements Msg. +func (msg MsgWithdrawBond) Type() string { return "withdraw" } + +func (msg MsgWithdrawBond) ValidateBasic() error { + if len(msg.Id) == 0 { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, msg.Id) + } + if len(msg.Signer) == 0 { + return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, msg.Signer) + } + if len(msg.Coins) == 0 || !msg.Coins.IsValid() { + return sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, "Invalid amount.") + } + return nil +} + +func (msg MsgWithdrawBond) GetSigners() []sdk.AccAddress { + accAddr, _ := sdk.AccAddressFromBech32(msg.Signer) + return []sdk.AccAddress{accAddr} +} + +// GetSignBytes gets the sign bytes for the msg MsgCreateBond +func (msg MsgWithdrawBond) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +// NewMsgCancelBond is the constructor function for CalcelBond. +func NewMsgCancelBond(id string, signer sdk.AccAddress) MsgCancelBond { + return MsgCancelBond{ + Id: id, + Signer: signer.String(), + } +} + +// Route Implements Msg. +func (msg MsgCancelBond) Route() string { return RouterKey } + +// Type Implements Msg. +func (msg MsgCancelBond) Type() string { return "cancel" } + +func (msg MsgCancelBond) ValidateBasic() error { + if len(msg.Id) == 0 { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, msg.Id) + } + if len(msg.Signer) == 0 { + return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, msg.Signer) + } + return nil +} + +func (msg MsgCancelBond) GetSigners() []sdk.AccAddress { + accAddr, _ := sdk.AccAddressFromBech32(msg.Signer) + return []sdk.AccAddress{accAddr} +} + +// GetSignBytes gets the sign bytes for the msg MsgCreateBond +func (msg MsgCancelBond) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} diff --git a/x/bond/types/params.go b/x/bond/types/params.go new file mode 100644 index 00000000..587f8c6f --- /dev/null +++ b/x/bond/types/params.go @@ -0,0 +1,64 @@ +package types + +import ( + "errors" + "fmt" + sdk "github.com/cosmos/cosmos-sdk/types" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" +) + +var _ paramtypes.ParamSet = &Params{} + +// Default parameter values. +var ( + DefaultMaxBondAmountTokens = sdk.NewInt(100000000000) +) + +// Parameter keys +var ( + ParamStoreKeyMaxBondAmount = []byte("MaxBondAmount") +) + +// ParamKeyTable ParamTable for staking module +func ParamKeyTable() paramtypes.KeyTable { + return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) +} + +func NewParams(maxBondAmount sdk.Coin) Params { + return Params{MaxBondAmount: maxBondAmount} +} + +// DefaultParams returns default evm parameters +// ExtraEIPs is empty to prevent overriding the latest hard fork instruction set +func DefaultParams() Params { + return NewParams(sdk.NewCoin(sdk.DefaultBondDenom, DefaultMaxBondAmountTokens)) +} + +// ParamSetPairs returns the parameter set pairs. +func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { + return paramtypes.ParamSetPairs{ + paramtypes.NewParamSetPair(ParamStoreKeyMaxBondAmount, &p.MaxBondAmount, validateMaxBondAmount), + } +} + +func validateMaxBondAmount(i interface{}) error { + v, ok := i.(sdk.Coin) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + if v.Amount.IsNegative() { + return errors.New("max bond amount must be positive") + } + + return nil +} + +// Validate checks that the parameters have valid values. +func (p Params) Validate() error { + if err := validateMaxBondAmount(p.MaxBondAmount); err != nil { + return err + } + + return nil +} diff --git a/x/bond/types/query.pb.go b/x/bond/types/query.pb.go new file mode 100644 index 00000000..56b259e8 --- /dev/null +++ b/x/bond/types/query.pb.go @@ -0,0 +1,2280 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: vulcanize/bond/v1beta1/query.proto + +package types + +import ( + context "context" + fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + types "github.com/cosmos/cosmos-sdk/types" + query "github.com/cosmos/cosmos-sdk/types/query" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/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 for query the bond module params +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_2f225717b20da431, []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 returns response type of bond module params +type QueryParamsResponse struct { + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty" json:"params" yaml:"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_2f225717b20da431, []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 nil +} + +// QueryGetBondById queries a bond by bond-id. +type QueryGetBondsRequest struct { + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryGetBondsRequest) Reset() { *m = QueryGetBondsRequest{} } +func (m *QueryGetBondsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGetBondsRequest) ProtoMessage() {} +func (*QueryGetBondsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_2f225717b20da431, []int{2} +} +func (m *QueryGetBondsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetBondsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetBondsRequest.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 *QueryGetBondsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetBondsRequest.Merge(m, src) +} +func (m *QueryGetBondsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryGetBondsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetBondsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetBondsRequest proto.InternalMessageInfo + +func (m *QueryGetBondsRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryGetBondsResponse is response type for get the bonds by bond-id +type QueryGetBondsResponse struct { + Bonds []*Bond `protobuf:"bytes,1,rep,name=bonds,proto3" json:"bonds,omitempty" json:"bonds" yaml:"bonds"` + // pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryGetBondsResponse) Reset() { *m = QueryGetBondsResponse{} } +func (m *QueryGetBondsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGetBondsResponse) ProtoMessage() {} +func (*QueryGetBondsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_2f225717b20da431, []int{3} +} +func (m *QueryGetBondsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetBondsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetBondsResponse.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 *QueryGetBondsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetBondsResponse.Merge(m, src) +} +func (m *QueryGetBondsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryGetBondsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetBondsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetBondsResponse proto.InternalMessageInfo + +func (m *QueryGetBondsResponse) GetBonds() []*Bond { + if m != nil { + return m.Bonds + } + return nil +} + +func (m *QueryGetBondsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryGetBondById +type QueryGetBondByIdRequest struct { + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" json:"id" yaml:"id"` +} + +func (m *QueryGetBondByIdRequest) Reset() { *m = QueryGetBondByIdRequest{} } +func (m *QueryGetBondByIdRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGetBondByIdRequest) ProtoMessage() {} +func (*QueryGetBondByIdRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_2f225717b20da431, []int{4} +} +func (m *QueryGetBondByIdRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetBondByIdRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetBondByIdRequest.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 *QueryGetBondByIdRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetBondByIdRequest.Merge(m, src) +} +func (m *QueryGetBondByIdRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryGetBondByIdRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetBondByIdRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetBondByIdRequest proto.InternalMessageInfo + +func (m *QueryGetBondByIdRequest) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +// QueryGetBondByIdResponse returns QueryGetBondById query response +type QueryGetBondByIdResponse struct { + Bond *Bond `protobuf:"bytes,1,opt,name=bond,proto3" json:"bond,omitempty" json:"bond" yaml:"bond"` +} + +func (m *QueryGetBondByIdResponse) Reset() { *m = QueryGetBondByIdResponse{} } +func (m *QueryGetBondByIdResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGetBondByIdResponse) ProtoMessage() {} +func (*QueryGetBondByIdResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_2f225717b20da431, []int{5} +} +func (m *QueryGetBondByIdResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetBondByIdResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetBondByIdResponse.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 *QueryGetBondByIdResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetBondByIdResponse.Merge(m, src) +} +func (m *QueryGetBondByIdResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryGetBondByIdResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetBondByIdResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetBondByIdResponse proto.InternalMessageInfo + +func (m *QueryGetBondByIdResponse) GetBond() *Bond { + if m != nil { + return m.Bond + } + return nil +} + +// QueryGetBondsByOwnerRequest is request type for Query/GetBondsByOwner RPC Method +type QueryGetBondsByOwnerRequest struct { + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + // pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryGetBondsByOwnerRequest) Reset() { *m = QueryGetBondsByOwnerRequest{} } +func (m *QueryGetBondsByOwnerRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGetBondsByOwnerRequest) ProtoMessage() {} +func (*QueryGetBondsByOwnerRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_2f225717b20da431, []int{6} +} +func (m *QueryGetBondsByOwnerRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetBondsByOwnerRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetBondsByOwnerRequest.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 *QueryGetBondsByOwnerRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetBondsByOwnerRequest.Merge(m, src) +} +func (m *QueryGetBondsByOwnerRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryGetBondsByOwnerRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetBondsByOwnerRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetBondsByOwnerRequest proto.InternalMessageInfo + +func (m *QueryGetBondsByOwnerRequest) GetOwner() string { + if m != nil { + return m.Owner + } + return "" +} + +func (m *QueryGetBondsByOwnerRequest) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryGetBondsByOwnerResponse is response type for Query/GetBondsByOwner RPC Method +type QueryGetBondsByOwnerResponse struct { + Bonds []Bond `protobuf:"bytes,1,rep,name=bonds,proto3" json:"bonds" json:"bonds" yaml:"bonds"` + // pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryGetBondsByOwnerResponse) Reset() { *m = QueryGetBondsByOwnerResponse{} } +func (m *QueryGetBondsByOwnerResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGetBondsByOwnerResponse) ProtoMessage() {} +func (*QueryGetBondsByOwnerResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_2f225717b20da431, []int{7} +} +func (m *QueryGetBondsByOwnerResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetBondsByOwnerResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetBondsByOwnerResponse.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 *QueryGetBondsByOwnerResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetBondsByOwnerResponse.Merge(m, src) +} +func (m *QueryGetBondsByOwnerResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryGetBondsByOwnerResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetBondsByOwnerResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetBondsByOwnerResponse proto.InternalMessageInfo + +func (m *QueryGetBondsByOwnerResponse) GetBonds() []Bond { + if m != nil { + return m.Bonds + } + return nil +} + +func (m *QueryGetBondsByOwnerResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryGetBondModuleBalanceRequest is request type for bond module balance rpc method +type QueryGetBondModuleBalanceRequest struct { +} + +func (m *QueryGetBondModuleBalanceRequest) Reset() { *m = QueryGetBondModuleBalanceRequest{} } +func (m *QueryGetBondModuleBalanceRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGetBondModuleBalanceRequest) ProtoMessage() {} +func (*QueryGetBondModuleBalanceRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_2f225717b20da431, []int{8} +} +func (m *QueryGetBondModuleBalanceRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetBondModuleBalanceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetBondModuleBalanceRequest.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 *QueryGetBondModuleBalanceRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetBondModuleBalanceRequest.Merge(m, src) +} +func (m *QueryGetBondModuleBalanceRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryGetBondModuleBalanceRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetBondModuleBalanceRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetBondModuleBalanceRequest proto.InternalMessageInfo + +// QueryGetBondModuleBalanceResponse is the response type for bond module balance rpc method +type QueryGetBondModuleBalanceResponse struct { + Balance github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,2,rep,name=balance,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"balance" json:"coins" yaml:"coins"` +} + +func (m *QueryGetBondModuleBalanceResponse) Reset() { *m = QueryGetBondModuleBalanceResponse{} } +func (m *QueryGetBondModuleBalanceResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGetBondModuleBalanceResponse) ProtoMessage() {} +func (*QueryGetBondModuleBalanceResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_2f225717b20da431, []int{9} +} +func (m *QueryGetBondModuleBalanceResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetBondModuleBalanceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetBondModuleBalanceResponse.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 *QueryGetBondModuleBalanceResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetBondModuleBalanceResponse.Merge(m, src) +} +func (m *QueryGetBondModuleBalanceResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryGetBondModuleBalanceResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetBondModuleBalanceResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetBondModuleBalanceResponse proto.InternalMessageInfo + +func (m *QueryGetBondModuleBalanceResponse) GetBalance() github_com_cosmos_cosmos_sdk_types.Coins { + if m != nil { + return m.Balance + } + return nil +} + +func init() { + proto.RegisterType((*QueryParamsRequest)(nil), "vulcanize.bond.v1beta1.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "vulcanize.bond.v1beta1.QueryParamsResponse") + proto.RegisterType((*QueryGetBondsRequest)(nil), "vulcanize.bond.v1beta1.QueryGetBondsRequest") + proto.RegisterType((*QueryGetBondsResponse)(nil), "vulcanize.bond.v1beta1.QueryGetBondsResponse") + proto.RegisterType((*QueryGetBondByIdRequest)(nil), "vulcanize.bond.v1beta1.QueryGetBondByIdRequest") + proto.RegisterType((*QueryGetBondByIdResponse)(nil), "vulcanize.bond.v1beta1.QueryGetBondByIdResponse") + proto.RegisterType((*QueryGetBondsByOwnerRequest)(nil), "vulcanize.bond.v1beta1.QueryGetBondsByOwnerRequest") + proto.RegisterType((*QueryGetBondsByOwnerResponse)(nil), "vulcanize.bond.v1beta1.QueryGetBondsByOwnerResponse") + proto.RegisterType((*QueryGetBondModuleBalanceRequest)(nil), "vulcanize.bond.v1beta1.QueryGetBondModuleBalanceRequest") + proto.RegisterType((*QueryGetBondModuleBalanceResponse)(nil), "vulcanize.bond.v1beta1.QueryGetBondModuleBalanceResponse") +} + +func init() { + proto.RegisterFile("vulcanize/bond/v1beta1/query.proto", fileDescriptor_2f225717b20da431) +} + +var fileDescriptor_2f225717b20da431 = []byte{ + // 764 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x95, 0x3f, 0x6f, 0xd3, 0x4e, + 0x18, 0xc7, 0xe3, 0xfc, 0x7e, 0x09, 0xe2, 0x3a, 0x20, 0x5d, 0x53, 0xda, 0xa6, 0xad, 0x9d, 0x9c, + 0xa0, 0x0d, 0x81, 0xfa, 0xfa, 0x87, 0x01, 0x18, 0x5d, 0x89, 0x8a, 0xa1, 0x82, 0x5a, 0x42, 0x48, + 0x0c, 0x48, 0x4e, 0x7c, 0x72, 0x0f, 0x12, 0x5f, 0x9a, 0x73, 0x0a, 0xa1, 0x74, 0xe9, 0x86, 0x58, + 0x90, 0x58, 0x79, 0x01, 0xc0, 0xc0, 0x82, 0x58, 0x99, 0x3b, 0x56, 0x62, 0x61, 0x0a, 0xa8, 0xe5, + 0x15, 0xe4, 0x15, 0x20, 0xdf, 0x9d, 0x53, 0xbb, 0x6d, 0x42, 0x8a, 0x10, 0x93, 0x73, 0xf6, 0xf7, + 0x79, 0x9e, 0xcf, 0xf7, 0xb1, 0x9f, 0x27, 0x00, 0x6d, 0xb5, 0x6a, 0x55, 0xc7, 0xa7, 0xcf, 0x09, + 0xae, 0x30, 0xdf, 0xc5, 0x5b, 0x8b, 0x15, 0x12, 0x38, 0x8b, 0x78, 0xb3, 0x45, 0x9a, 0x6d, 0xb3, + 0xd1, 0x64, 0x01, 0x83, 0x17, 0x7b, 0x1a, 0x33, 0xd4, 0x98, 0x4a, 0x93, 0xcf, 0x79, 0xcc, 0x63, + 0x42, 0x82, 0xc3, 0x5f, 0x52, 0x9d, 0x2f, 0xf6, 0xc9, 0x28, 0x42, 0xa5, 0x64, 0xda, 0x63, 0xcc, + 0xab, 0x11, 0xec, 0x34, 0x28, 0x76, 0x7c, 0x9f, 0x05, 0x4e, 0x40, 0x99, 0xcf, 0xd5, 0xd3, 0x72, + 0x95, 0xf1, 0x3a, 0xe3, 0xb8, 0xe2, 0x70, 0x22, 0x39, 0x7a, 0x39, 0x1a, 0x8e, 0x47, 0x7d, 0x21, + 0x56, 0x5a, 0x3d, 0xae, 0x8d, 0x54, 0x55, 0x46, 0xd5, 0x73, 0x94, 0x03, 0x70, 0x3d, 0xcc, 0x70, + 0xcf, 0x69, 0x3a, 0x75, 0x6e, 0x93, 0xcd, 0x16, 0xe1, 0x01, 0xf2, 0xc1, 0x68, 0xe2, 0x2e, 0x6f, + 0x30, 0x9f, 0x13, 0xf8, 0x00, 0x64, 0x1b, 0xe2, 0xce, 0x84, 0x56, 0xd0, 0x4a, 0x23, 0x4b, 0xba, + 0x79, 0xba, 0x71, 0x53, 0xc6, 0x59, 0x46, 0xb7, 0x63, 0x4c, 0x3d, 0xe6, 0xcc, 0xbf, 0x85, 0x64, + 0x1c, 0x2a, 0xb4, 0x9d, 0x7a, 0xad, 0x77, 0xb2, 0x55, 0x3a, 0xf4, 0x08, 0xe4, 0x44, 0xbd, 0x55, + 0x12, 0x58, 0xcc, 0x77, 0x23, 0x0e, 0x78, 0x1b, 0x80, 0x23, 0x47, 0xaa, 0xe8, 0xac, 0x29, 0x2d, + 0x99, 0xa1, 0x25, 0x53, 0xbe, 0x86, 0xa3, 0xba, 0x1e, 0x51, 0xb1, 0x76, 0x2c, 0x12, 0x7d, 0xd2, + 0xc0, 0xd8, 0xb1, 0x02, 0xca, 0xd2, 0x3a, 0xc8, 0x84, 0xe4, 0xa1, 0xa3, 0xff, 0x4a, 0x23, 0x4b, + 0xd3, 0xfd, 0x1c, 0x85, 0x51, 0xd6, 0x4c, 0xb7, 0x63, 0x4c, 0x4a, 0x3f, 0x22, 0x28, 0xb2, 0x23, + 0x0f, 0xb6, 0xcc, 0x04, 0x57, 0x13, 0xd0, 0x69, 0x01, 0x3d, 0xf7, 0x5b, 0x68, 0xc9, 0x93, 0xa0, + 0xb6, 0xc0, 0x78, 0x1c, 0xda, 0x6a, 0xdf, 0x71, 0xa3, 0xc6, 0xcc, 0x81, 0x34, 0x75, 0x45, 0x43, + 0xce, 0x5b, 0xe3, 0xdd, 0x8e, 0x31, 0x2a, 0xa9, 0xa8, 0x1b, 0x21, 0x51, 0x17, 0xd9, 0x69, 0xea, + 0x22, 0x0a, 0x26, 0x4e, 0xe6, 0x50, 0xde, 0xd7, 0xc0, 0xff, 0x21, 0xb1, 0xea, 0xeb, 0x60, 0xeb, + 0x53, 0xdd, 0x8e, 0x31, 0x7e, 0x64, 0x3d, 0xee, 0x1c, 0xd9, 0x22, 0x0d, 0x7a, 0x01, 0xa6, 0x12, + 0x3d, 0xb6, 0xda, 0x77, 0x9f, 0xfa, 0xa4, 0x19, 0x21, 0xe7, 0x40, 0x86, 0x85, 0x67, 0x49, 0x6d, + 0xcb, 0xc3, 0xdf, 0x6b, 0xd6, 0x17, 0x0d, 0x4c, 0x9f, 0x5e, 0x5e, 0xb9, 0xbd, 0x7f, 0x96, 0x37, + 0x5d, 0xdc, 0xeb, 0x18, 0xa9, 0x7f, 0xfb, 0xb6, 0x11, 0x28, 0xc4, 0xf9, 0xd7, 0x98, 0xdb, 0xaa, + 0x11, 0xcb, 0xa9, 0x39, 0x7e, 0x35, 0xfa, 0xa6, 0xd1, 0x3b, 0x0d, 0x14, 0x07, 0x88, 0x94, 0xd3, + 0x5d, 0x0d, 0x9c, 0xab, 0xc8, 0x7b, 0x13, 0x69, 0x61, 0x76, 0x32, 0x01, 0x14, 0xa1, 0xac, 0x30, + 0xea, 0x5b, 0x6b, 0x49, 0xa7, 0xe1, 0x6a, 0xe8, 0x39, 0x95, 0x87, 0x0f, 0xdf, 0x8d, 0x92, 0x47, + 0x83, 0x8d, 0x56, 0xc5, 0xac, 0xb2, 0x3a, 0x56, 0x0b, 0x45, 0x5e, 0xe6, 0xb9, 0xfb, 0x04, 0x07, + 0xed, 0x06, 0xe1, 0x22, 0x1b, 0xb7, 0xa3, 0xc2, 0x4b, 0xef, 0xb3, 0x20, 0x23, 0x50, 0xe1, 0x4b, + 0x0d, 0x64, 0xe5, 0x42, 0x80, 0xe5, 0x7e, 0x4d, 0x3f, 0xb9, 0x83, 0xf2, 0x57, 0x87, 0xd2, 0x4a, + 0xcb, 0x68, 0x76, 0xf7, 0xeb, 0xcf, 0x37, 0xe9, 0x02, 0xd4, 0x71, 0x9f, 0xe5, 0x2a, 0x17, 0x0d, + 0x7c, 0xa5, 0x81, 0x8c, 0xf8, 0x3a, 0xe0, 0xb5, 0x81, 0xe9, 0x8f, 0x2d, 0xa2, 0xfc, 0xfc, 0x90, + 0x6a, 0x85, 0x73, 0x59, 0xe0, 0x18, 0x70, 0x06, 0x0f, 0xd8, 0xf5, 0x1c, 0xbe, 0xd5, 0xc0, 0x48, + 0x6c, 0x30, 0x21, 0x1e, 0xa6, 0x4a, 0x6c, 0x0d, 0xe4, 0x17, 0x86, 0x0f, 0x50, 0x64, 0x65, 0x41, + 0x76, 0x09, 0xa2, 0x81, 0x64, 0x78, 0x9b, 0xba, 0x3b, 0xf0, 0xa3, 0x06, 0x2e, 0x1c, 0x9b, 0x26, + 0xb8, 0x3c, 0x54, 0x23, 0x92, 0xa3, 0x9f, 0xbf, 0x7e, 0xb6, 0x20, 0x85, 0xba, 0x20, 0x50, 0xcb, + 0xb0, 0xd4, 0x17, 0xb5, 0x3d, 0x2f, 0x96, 0x08, 0xde, 0x16, 0x97, 0x1d, 0xf8, 0x59, 0x03, 0x63, + 0x51, 0xb6, 0xc4, 0x68, 0xc0, 0x1b, 0xc3, 0x10, 0x9c, 0x36, 0x72, 0xf9, 0x9b, 0x7f, 0x10, 0xa9, + 0x0c, 0xcc, 0x09, 0x03, 0x45, 0x68, 0xf4, 0x35, 0x20, 0x03, 0xac, 0x95, 0xbd, 0x03, 0x5d, 0xdb, + 0x3f, 0xd0, 0xb5, 0x1f, 0x07, 0xba, 0xf6, 0xfa, 0x50, 0x4f, 0xed, 0x1f, 0xea, 0xa9, 0x6f, 0x87, + 0x7a, 0xea, 0xe1, 0x95, 0xd8, 0xe0, 0x05, 0x1b, 0x4e, 0x93, 0x53, 0x8e, 0x49, 0xb0, 0x41, 0x9a, + 0x75, 0xea, 0x07, 0xf8, 0x99, 0x4c, 0x27, 0xe6, 0xaf, 0x92, 0x15, 0x7f, 0xe8, 0xcb, 0xbf, 0x02, + 0x00, 0x00, 0xff, 0xff, 0x0f, 0x7a, 0x69, 0x08, 0xb1, 0x08, 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 { + // Params queries bonds module params. + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) + // Bonds queries bonds list. + Bonds(ctx context.Context, in *QueryGetBondsRequest, opts ...grpc.CallOption) (*QueryGetBondsResponse, error) + // GetBondById + GetBondById(ctx context.Context, in *QueryGetBondByIdRequest, opts ...grpc.CallOption) (*QueryGetBondByIdResponse, error) + // Get Bonds List by Owner + GetBondsByOwner(ctx context.Context, in *QueryGetBondsByOwnerRequest, opts ...grpc.CallOption) (*QueryGetBondsByOwnerResponse, error) + // Get Bonds module balance + GetBondsModuleBalance(ctx context.Context, in *QueryGetBondModuleBalanceRequest, opts ...grpc.CallOption) (*QueryGetBondModuleBalanceResponse, 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, "/vulcanize.bond.v1beta1.Query/Params", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Bonds(ctx context.Context, in *QueryGetBondsRequest, opts ...grpc.CallOption) (*QueryGetBondsResponse, error) { + out := new(QueryGetBondsResponse) + err := c.cc.Invoke(ctx, "/vulcanize.bond.v1beta1.Query/Bonds", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) GetBondById(ctx context.Context, in *QueryGetBondByIdRequest, opts ...grpc.CallOption) (*QueryGetBondByIdResponse, error) { + out := new(QueryGetBondByIdResponse) + err := c.cc.Invoke(ctx, "/vulcanize.bond.v1beta1.Query/GetBondById", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) GetBondsByOwner(ctx context.Context, in *QueryGetBondsByOwnerRequest, opts ...grpc.CallOption) (*QueryGetBondsByOwnerResponse, error) { + out := new(QueryGetBondsByOwnerResponse) + err := c.cc.Invoke(ctx, "/vulcanize.bond.v1beta1.Query/GetBondsByOwner", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) GetBondsModuleBalance(ctx context.Context, in *QueryGetBondModuleBalanceRequest, opts ...grpc.CallOption) (*QueryGetBondModuleBalanceResponse, error) { + out := new(QueryGetBondModuleBalanceResponse) + err := c.cc.Invoke(ctx, "/vulcanize.bond.v1beta1.Query/GetBondsModuleBalance", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // Params queries bonds module params. + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) + // Bonds queries bonds list. + Bonds(context.Context, *QueryGetBondsRequest) (*QueryGetBondsResponse, error) + // GetBondById + GetBondById(context.Context, *QueryGetBondByIdRequest) (*QueryGetBondByIdResponse, error) + // Get Bonds List by Owner + GetBondsByOwner(context.Context, *QueryGetBondsByOwnerRequest) (*QueryGetBondsByOwnerResponse, error) + // Get Bonds module balance + GetBondsModuleBalance(context.Context, *QueryGetBondModuleBalanceRequest) (*QueryGetBondModuleBalanceResponse, 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 (*UnimplementedQueryServer) Bonds(ctx context.Context, req *QueryGetBondsRequest) (*QueryGetBondsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Bonds not implemented") +} +func (*UnimplementedQueryServer) GetBondById(ctx context.Context, req *QueryGetBondByIdRequest) (*QueryGetBondByIdResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetBondById not implemented") +} +func (*UnimplementedQueryServer) GetBondsByOwner(ctx context.Context, req *QueryGetBondsByOwnerRequest) (*QueryGetBondsByOwnerResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetBondsByOwner not implemented") +} +func (*UnimplementedQueryServer) GetBondsModuleBalance(ctx context.Context, req *QueryGetBondModuleBalanceRequest) (*QueryGetBondModuleBalanceResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetBondsModuleBalance 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: "/vulcanize.bond.v1beta1.Query/Params", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Bonds_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetBondsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Bonds(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vulcanize.bond.v1beta1.Query/Bonds", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Bonds(ctx, req.(*QueryGetBondsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_GetBondById_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetBondByIdRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).GetBondById(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vulcanize.bond.v1beta1.Query/GetBondById", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GetBondById(ctx, req.(*QueryGetBondByIdRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_GetBondsByOwner_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetBondsByOwnerRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).GetBondsByOwner(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vulcanize.bond.v1beta1.Query/GetBondsByOwner", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GetBondsByOwner(ctx, req.(*QueryGetBondsByOwnerRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_GetBondsModuleBalance_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetBondModuleBalanceRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).GetBondsModuleBalance(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vulcanize.bond.v1beta1.Query/GetBondsModuleBalance", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GetBondsModuleBalance(ctx, req.(*QueryGetBondModuleBalanceRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "vulcanize.bond.v1beta1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + { + MethodName: "Bonds", + Handler: _Query_Bonds_Handler, + }, + { + MethodName: "GetBondById", + Handler: _Query_GetBondById_Handler, + }, + { + MethodName: "GetBondsByOwner", + Handler: _Query_GetBondsByOwner_Handler, + }, + { + MethodName: "GetBondsModuleBalance", + Handler: _Query_GetBondsModuleBalance_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "vulcanize/bond/v1beta1/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 + if m.Params != nil { + { + 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 (m *QueryGetBondsRequest) 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 *QueryGetBondsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetBondsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.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 (m *QueryGetBondsResponse) 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 *QueryGetBondsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetBondsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Bonds) > 0 { + for iNdEx := len(m.Bonds) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Bonds[iNdEx].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 (m *QueryGetBondByIdRequest) 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 *QueryGetBondByIdRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetBondByIdRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Id) > 0 { + i -= len(m.Id) + copy(dAtA[i:], m.Id) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Id))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryGetBondByIdResponse) 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 *QueryGetBondByIdResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetBondByIdResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Bond != nil { + { + size, err := m.Bond.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 (m *QueryGetBondsByOwnerRequest) 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 *QueryGetBondsByOwnerRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetBondsByOwnerRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryGetBondsByOwnerResponse) 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 *QueryGetBondsByOwnerResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetBondsByOwnerResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Bonds) > 0 { + for iNdEx := len(m.Bonds) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Bonds[iNdEx].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 (m *QueryGetBondModuleBalanceRequest) 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 *QueryGetBondModuleBalanceRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetBondModuleBalanceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryGetBondModuleBalanceResponse) 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 *QueryGetBondModuleBalanceResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetBondModuleBalanceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Balance) > 0 { + for iNdEx := len(m.Balance) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Balance[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + 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 + if m.Params != nil { + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGetBondsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGetBondsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Bonds) > 0 { + for _, e := range m.Bonds { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGetBondByIdRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Id) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGetBondByIdResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Bond != nil { + l = m.Bond.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGetBondsByOwnerRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGetBondsByOwnerResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Bonds) > 0 { + for _, e := range m.Bonds { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGetBondModuleBalanceRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryGetBondModuleBalanceResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Balance) > 0 { + for _, e := range m.Balance { + l = e.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 m.Params == nil { + m.Params = &Params{} + } + 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 (m *QueryGetBondsRequest) 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: QueryGetBondsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetBondsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", 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 m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.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 (m *QueryGetBondsResponse) 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: QueryGetBondsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetBondsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Bonds", 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 + } + m.Bonds = append(m.Bonds, &Bond{}) + if err := m.Bonds[len(m.Bonds)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", 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 m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.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 (m *QueryGetBondByIdRequest) 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: QueryGetBondByIdRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetBondByIdRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Id = string(dAtA[iNdEx:postIndex]) + 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 (m *QueryGetBondByIdResponse) 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: QueryGetBondByIdResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetBondByIdResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Bond", 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 m.Bond == nil { + m.Bond = &Bond{} + } + if err := m.Bond.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 (m *QueryGetBondsByOwnerRequest) 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: QueryGetBondsByOwnerRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetBondsByOwnerRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Owner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", 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 m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.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 (m *QueryGetBondsByOwnerResponse) 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: QueryGetBondsByOwnerResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetBondsByOwnerResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Bonds", 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 + } + m.Bonds = append(m.Bonds, Bond{}) + if err := m.Bonds[len(m.Bonds)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", 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 m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.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 (m *QueryGetBondModuleBalanceRequest) 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: QueryGetBondModuleBalanceRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetBondModuleBalanceRequest: 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 *QueryGetBondModuleBalanceResponse) 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: QueryGetBondModuleBalanceResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetBondModuleBalanceResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Balance", 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 + } + m.Balance = append(m.Balance, types.Coin{}) + if err := m.Balance[len(m.Balance)-1].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/bond/types/query.pb.gw.go b/x/bond/types/query.pb.gw.go new file mode 100644 index 00000000..cdb30933 --- /dev/null +++ b/x/bond/types/query.pb.gw.go @@ -0,0 +1,504 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: vulcanize/bond/v1beta1/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/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 + +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 + +} + +var ( + filter_Query_Bonds_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_Bonds_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetBondsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Bonds_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Bonds(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Bonds_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetBondsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Bonds_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Bonds(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_GetBondById_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetBondByIdRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") + } + + protoReq.Id, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) + } + + msg, err := client.GetBondById(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_GetBondById_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetBondByIdRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") + } + + protoReq.Id, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) + } + + msg, err := server.GetBondById(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_GetBondsByOwner_0 = &utilities.DoubleArray{Encoding: map[string]int{"owner": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Query_GetBondsByOwner_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetBondsByOwnerRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["owner"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "owner") + } + + protoReq.Owner, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "owner", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GetBondsByOwner_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.GetBondsByOwner(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_GetBondsByOwner_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetBondsByOwnerRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["owner"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "owner") + } + + protoReq.Owner, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "owner", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GetBondsByOwner_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.GetBondsByOwner(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_GetBondsModuleBalance_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetBondModuleBalanceRequest + var metadata runtime.ServerMetadata + + msg, err := client.GetBondsModuleBalance(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_GetBondsModuleBalance_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetBondModuleBalanceRequest + var metadata runtime.ServerMetadata + + msg, err := server.GetBondsModuleBalance(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 (such as grpc.SendHeader, etc) 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() + 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) + 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()...) + + }) + + mux.Handle("GET", pattern_Query_Bonds_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.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Bonds_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Bonds_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GetBondById_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.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_GetBondById_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_GetBondById_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GetBondsByOwner_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.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_GetBondsByOwner_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_GetBondsByOwner_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GetBondsModuleBalance_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.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_GetBondsModuleBalance_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_GetBondsModuleBalance_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()...) + + }) + + mux.Handle("GET", pattern_Query_Bonds_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_Bonds_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_Bonds_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GetBondById_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_GetBondById_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_GetBondById_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GetBondsByOwner_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_GetBondsByOwner_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_GetBondsByOwner_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GetBondsModuleBalance_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_GetBondsModuleBalance_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_GetBondsModuleBalance_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{"vulcanize", "bond", "v1beta1", "params"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_Bonds_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"vulcanize", "bond", "v1beta1", "bonds"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_GetBondById_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"vulcanize", "bond", "v1beta1", "bonds", "id"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_GetBondsByOwner_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"vulcanize", "bond", "v1beta1", "by-owner", "owner"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_GetBondsModuleBalance_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"vulcanize", "bond", "v1beta1", "balance"}, "", runtime.AssumeColonVerbOpt(true))) +) + +var ( + forward_Query_Params_0 = runtime.ForwardResponseMessage + + forward_Query_Bonds_0 = runtime.ForwardResponseMessage + + forward_Query_GetBondById_0 = runtime.ForwardResponseMessage + + forward_Query_GetBondsByOwner_0 = runtime.ForwardResponseMessage + + forward_Query_GetBondsModuleBalance_0 = runtime.ForwardResponseMessage +) diff --git a/x/bond/types/tx.pb.go b/x/bond/types/tx.pb.go new file mode 100644 index 00000000..fea4beaf --- /dev/null +++ b/x/bond/types/tx.pb.go @@ -0,0 +1,1921 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: vulcanize/bond/v1beta1/tx.proto + +package types + +import ( + context "context" + fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/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 + +// MsgCreateBond defines a SDK message for creating a new bond. +type MsgCreateBond struct { + Signer string `protobuf:"bytes,1,opt,name=signer,proto3" json:"signer,omitempty"` + Coins github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,2,rep,name=coins,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"coins" json:"coins" yaml:"coins"` +} + +func (m *MsgCreateBond) Reset() { *m = MsgCreateBond{} } +func (m *MsgCreateBond) String() string { return proto.CompactTextString(m) } +func (*MsgCreateBond) ProtoMessage() {} +func (*MsgCreateBond) Descriptor() ([]byte, []int) { + return fileDescriptor_4a1095dfb30dc368, []int{0} +} +func (m *MsgCreateBond) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateBond) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateBond.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 *MsgCreateBond) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateBond.Merge(m, src) +} +func (m *MsgCreateBond) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateBond) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateBond.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateBond proto.InternalMessageInfo + +func (m *MsgCreateBond) GetSigner() string { + if m != nil { + return m.Signer + } + return "" +} + +func (m *MsgCreateBond) GetCoins() github_com_cosmos_cosmos_sdk_types.Coins { + if m != nil { + return m.Coins + } + return nil +} + +// MsgCreateBondResponse defines the Msg/CreateBond response type. +type MsgCreateBondResponse struct { + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (m *MsgCreateBondResponse) Reset() { *m = MsgCreateBondResponse{} } +func (m *MsgCreateBondResponse) String() string { return proto.CompactTextString(m) } +func (*MsgCreateBondResponse) ProtoMessage() {} +func (*MsgCreateBondResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_4a1095dfb30dc368, []int{1} +} +func (m *MsgCreateBondResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateBondResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateBondResponse.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 *MsgCreateBondResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateBondResponse.Merge(m, src) +} +func (m *MsgCreateBondResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateBondResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateBondResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateBondResponse proto.InternalMessageInfo + +func (m *MsgCreateBondResponse) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +// MsgRefillBond defines a SDK message for refill the amount for bond. +type MsgRefillBond struct { + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Signer string `protobuf:"bytes,2,opt,name=signer,proto3" json:"signer,omitempty"` + Coins github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,3,rep,name=coins,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"coins" json:"coins" yaml:"coins"` +} + +func (m *MsgRefillBond) Reset() { *m = MsgRefillBond{} } +func (m *MsgRefillBond) String() string { return proto.CompactTextString(m) } +func (*MsgRefillBond) ProtoMessage() {} +func (*MsgRefillBond) Descriptor() ([]byte, []int) { + return fileDescriptor_4a1095dfb30dc368, []int{2} +} +func (m *MsgRefillBond) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRefillBond) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRefillBond.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 *MsgRefillBond) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRefillBond.Merge(m, src) +} +func (m *MsgRefillBond) XXX_Size() int { + return m.Size() +} +func (m *MsgRefillBond) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRefillBond.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRefillBond proto.InternalMessageInfo + +func (m *MsgRefillBond) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +func (m *MsgRefillBond) GetSigner() string { + if m != nil { + return m.Signer + } + return "" +} + +func (m *MsgRefillBond) GetCoins() github_com_cosmos_cosmos_sdk_types.Coins { + if m != nil { + return m.Coins + } + return nil +} + +// MsgRefillBondResponse defines the Msg/RefillBond response type. +type MsgRefillBondResponse struct { +} + +func (m *MsgRefillBondResponse) Reset() { *m = MsgRefillBondResponse{} } +func (m *MsgRefillBondResponse) String() string { return proto.CompactTextString(m) } +func (*MsgRefillBondResponse) ProtoMessage() {} +func (*MsgRefillBondResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_4a1095dfb30dc368, []int{3} +} +func (m *MsgRefillBondResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRefillBondResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRefillBondResponse.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 *MsgRefillBondResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRefillBondResponse.Merge(m, src) +} +func (m *MsgRefillBondResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgRefillBondResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRefillBondResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRefillBondResponse proto.InternalMessageInfo + +// MsgWithdrawBond defines a SDK message for withdrawing amount from bond. +type MsgWithdrawBond struct { + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Signer string `protobuf:"bytes,2,opt,name=signer,proto3" json:"signer,omitempty"` + Coins github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,3,rep,name=coins,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"coins" json:"coins" yaml:"coins"` +} + +func (m *MsgWithdrawBond) Reset() { *m = MsgWithdrawBond{} } +func (m *MsgWithdrawBond) String() string { return proto.CompactTextString(m) } +func (*MsgWithdrawBond) ProtoMessage() {} +func (*MsgWithdrawBond) Descriptor() ([]byte, []int) { + return fileDescriptor_4a1095dfb30dc368, []int{4} +} +func (m *MsgWithdrawBond) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgWithdrawBond) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgWithdrawBond.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 *MsgWithdrawBond) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgWithdrawBond.Merge(m, src) +} +func (m *MsgWithdrawBond) XXX_Size() int { + return m.Size() +} +func (m *MsgWithdrawBond) XXX_DiscardUnknown() { + xxx_messageInfo_MsgWithdrawBond.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgWithdrawBond proto.InternalMessageInfo + +func (m *MsgWithdrawBond) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +func (m *MsgWithdrawBond) GetSigner() string { + if m != nil { + return m.Signer + } + return "" +} + +func (m *MsgWithdrawBond) GetCoins() github_com_cosmos_cosmos_sdk_types.Coins { + if m != nil { + return m.Coins + } + return nil +} + +// MsgWithdrawBondResponse defines the Msg/WithdrawBond response type. +type MsgWithdrawBondResponse struct { +} + +func (m *MsgWithdrawBondResponse) Reset() { *m = MsgWithdrawBondResponse{} } +func (m *MsgWithdrawBondResponse) String() string { return proto.CompactTextString(m) } +func (*MsgWithdrawBondResponse) ProtoMessage() {} +func (*MsgWithdrawBondResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_4a1095dfb30dc368, []int{5} +} +func (m *MsgWithdrawBondResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgWithdrawBondResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgWithdrawBondResponse.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 *MsgWithdrawBondResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgWithdrawBondResponse.Merge(m, src) +} +func (m *MsgWithdrawBondResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgWithdrawBondResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgWithdrawBondResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgWithdrawBondResponse proto.InternalMessageInfo + +// MsgCancelBond defines a SDK message for the cancel the bond. +type MsgCancelBond struct { + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Signer string `protobuf:"bytes,2,opt,name=signer,proto3" json:"signer,omitempty"` +} + +func (m *MsgCancelBond) Reset() { *m = MsgCancelBond{} } +func (m *MsgCancelBond) String() string { return proto.CompactTextString(m) } +func (*MsgCancelBond) ProtoMessage() {} +func (*MsgCancelBond) Descriptor() ([]byte, []int) { + return fileDescriptor_4a1095dfb30dc368, []int{6} +} +func (m *MsgCancelBond) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCancelBond) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCancelBond.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 *MsgCancelBond) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCancelBond.Merge(m, src) +} +func (m *MsgCancelBond) XXX_Size() int { + return m.Size() +} +func (m *MsgCancelBond) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCancelBond.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCancelBond proto.InternalMessageInfo + +func (m *MsgCancelBond) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +func (m *MsgCancelBond) GetSigner() string { + if m != nil { + return m.Signer + } + return "" +} + +// MsgCancelBondResponse defines the Msg/CancelBond response type. +type MsgCancelBondResponse struct { +} + +func (m *MsgCancelBondResponse) Reset() { *m = MsgCancelBondResponse{} } +func (m *MsgCancelBondResponse) String() string { return proto.CompactTextString(m) } +func (*MsgCancelBondResponse) ProtoMessage() {} +func (*MsgCancelBondResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_4a1095dfb30dc368, []int{7} +} +func (m *MsgCancelBondResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCancelBondResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCancelBondResponse.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 *MsgCancelBondResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCancelBondResponse.Merge(m, src) +} +func (m *MsgCancelBondResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgCancelBondResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCancelBondResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCancelBondResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgCreateBond)(nil), "vulcanize.bond.v1beta1.MsgCreateBond") + proto.RegisterType((*MsgCreateBondResponse)(nil), "vulcanize.bond.v1beta1.MsgCreateBondResponse") + proto.RegisterType((*MsgRefillBond)(nil), "vulcanize.bond.v1beta1.MsgRefillBond") + proto.RegisterType((*MsgRefillBondResponse)(nil), "vulcanize.bond.v1beta1.MsgRefillBondResponse") + proto.RegisterType((*MsgWithdrawBond)(nil), "vulcanize.bond.v1beta1.MsgWithdrawBond") + proto.RegisterType((*MsgWithdrawBondResponse)(nil), "vulcanize.bond.v1beta1.MsgWithdrawBondResponse") + proto.RegisterType((*MsgCancelBond)(nil), "vulcanize.bond.v1beta1.MsgCancelBond") + proto.RegisterType((*MsgCancelBondResponse)(nil), "vulcanize.bond.v1beta1.MsgCancelBondResponse") +} + +func init() { proto.RegisterFile("vulcanize/bond/v1beta1/tx.proto", fileDescriptor_4a1095dfb30dc368) } + +var fileDescriptor_4a1095dfb30dc368 = []byte{ + // 462 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x94, 0x3f, 0x6e, 0xd4, 0x40, + 0x14, 0xc6, 0xd7, 0xb6, 0x88, 0xc4, 0xf0, 0x4f, 0xb2, 0x20, 0xc9, 0xba, 0xb0, 0x57, 0x96, 0x50, + 0x96, 0x22, 0x33, 0x4a, 0x28, 0x90, 0x28, 0x77, 0x6b, 0x37, 0x6e, 0x90, 0xe8, 0xc6, 0xf6, 0x60, + 0x0f, 0xd8, 0x33, 0x2b, 0xbf, 0x49, 0x48, 0x28, 0x38, 0x03, 0x3d, 0x07, 0x40, 0xe2, 0x02, 0x88, + 0x1b, 0xa4, 0x4c, 0x49, 0x15, 0xd0, 0xee, 0x0d, 0x38, 0x01, 0xb2, 0xc7, 0xf6, 0x7a, 0x93, 0xc8, + 0x5a, 0x2a, 0x44, 0x65, 0x8f, 0xfc, 0x7b, 0x6f, 0xbe, 0x6f, 0xde, 0xe7, 0x41, 0xde, 0xe9, 0x49, + 0x1e, 0x53, 0xc1, 0x3f, 0x30, 0x12, 0x49, 0x91, 0x90, 0xd3, 0xa3, 0x88, 0x29, 0x7a, 0x44, 0xd4, + 0x19, 0x5e, 0x94, 0x52, 0x49, 0x7b, 0xb7, 0x03, 0x70, 0x05, 0xe0, 0x06, 0x70, 0x1e, 0xa7, 0x32, + 0x95, 0x35, 0x42, 0xaa, 0x37, 0x4d, 0x3b, 0x6e, 0x2c, 0xa1, 0x90, 0x40, 0x22, 0x0a, 0xac, 0xeb, + 0x15, 0x4b, 0x2e, 0xf4, 0x77, 0xff, 0x8b, 0x81, 0x1e, 0x04, 0x90, 0xce, 0x4b, 0x46, 0x15, 0x9b, + 0x49, 0x91, 0xd8, 0xbb, 0x68, 0x07, 0x78, 0x2a, 0x58, 0xb9, 0x6f, 0x4c, 0x8c, 0xe9, 0xdd, 0xb0, + 0x59, 0xd9, 0x1f, 0xd1, 0x9d, 0xaa, 0x0e, 0xf6, 0xcd, 0x89, 0x35, 0xbd, 0x77, 0x3c, 0xc6, 0xba, + 0x33, 0xae, 0x3a, 0xb7, 0x22, 0xf0, 0x5c, 0x72, 0x31, 0x0b, 0x2e, 0xae, 0xbc, 0xd1, 0xef, 0x2b, + 0x6f, 0xfc, 0x16, 0xa4, 0x78, 0xe9, 0xd7, 0x55, 0xfe, 0xe4, 0x9c, 0x16, 0x79, 0xbb, 0xf8, 0xfa, + 0xd3, 0x9b, 0xa6, 0x5c, 0x65, 0x27, 0x11, 0x8e, 0x65, 0x41, 0x1a, 0x8d, 0xfa, 0x71, 0x08, 0xc9, + 0x3b, 0xa2, 0xce, 0x17, 0x0c, 0xea, 0x6e, 0x10, 0xea, 0x6d, 0xfd, 0x03, 0xf4, 0x64, 0x43, 0x68, + 0xc8, 0x60, 0x21, 0x05, 0x30, 0xfb, 0x21, 0x32, 0x79, 0xd2, 0x88, 0x35, 0x79, 0xe2, 0x7f, 0xd3, + 0x96, 0x42, 0xf6, 0x86, 0xe7, 0x79, 0x6d, 0xe9, 0x1a, 0xd1, 0xb3, 0x68, 0xde, 0x6e, 0xd1, 0xfa, + 0x37, 0x16, 0xf7, 0x6a, 0x8b, 0x6b, 0xe1, 0xad, 0x45, 0xff, 0xbb, 0x81, 0x1e, 0x05, 0x90, 0xbe, + 0xe2, 0x2a, 0x4b, 0x4a, 0xfa, 0xfe, 0xbf, 0x32, 0x35, 0x46, 0x7b, 0xd7, 0xa4, 0x77, 0xb6, 0x5e, + 0xe8, 0xec, 0x51, 0x11, 0xb3, 0xbf, 0x1a, 0x54, 0x73, 0x50, 0xeb, 0xc2, 0xb6, 0xe3, 0xf1, 0x67, + 0x0b, 0x59, 0x01, 0xa4, 0x76, 0x84, 0x50, 0x2f, 0xd2, 0x4f, 0xf1, 0xed, 0xff, 0x0c, 0xde, 0x08, + 0x94, 0x73, 0xb8, 0x15, 0xd6, 0xe5, 0x2e, 0x42, 0xa8, 0x97, 0xb1, 0xa1, 0x3d, 0xd6, 0xd8, 0xe0, + 0x1e, 0x37, 0x07, 0x6f, 0x67, 0xe8, 0xfe, 0xc6, 0xd0, 0x0f, 0x06, 0xca, 0xfb, 0xa0, 0x43, 0xb6, + 0x04, 0xfb, 0x6e, 0x7a, 0x83, 0x18, 0x3c, 0xb1, 0x0e, 0x1b, 0x3e, 0xb1, 0x1b, 0xd3, 0x99, 0xcd, + 0x2f, 0x96, 0xae, 0x71, 0xb9, 0x74, 0x8d, 0x5f, 0x4b, 0xd7, 0xf8, 0xb4, 0x72, 0x47, 0x97, 0x2b, + 0x77, 0xf4, 0x63, 0xe5, 0x8e, 0x5e, 0x3f, 0xeb, 0xa5, 0x4a, 0x65, 0xb4, 0x04, 0x0e, 0x84, 0xa9, + 0x8c, 0x95, 0x05, 0x17, 0x8a, 0x9c, 0xe9, 0xab, 0xb0, 0x0e, 0x57, 0xb4, 0x53, 0x5f, 0x5c, 0xcf, + 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0x5f, 0xd8, 0x87, 0xb6, 0x29, 0x05, 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 { + // CreateBond defines a method for creating a new bond. + CreateBond(ctx context.Context, in *MsgCreateBond, opts ...grpc.CallOption) (*MsgCreateBondResponse, error) + // RefillBond defines a method for refilling amount for bond. + RefillBond(ctx context.Context, in *MsgRefillBond, opts ...grpc.CallOption) (*MsgRefillBondResponse, error) + // WithdrawBond defines a method for withdrawing amount from bond. + WithdrawBond(ctx context.Context, in *MsgWithdrawBond, opts ...grpc.CallOption) (*MsgWithdrawBondResponse, error) + // CancelBond defines a method for cancelling a bond. + CancelBond(ctx context.Context, in *MsgCancelBond, opts ...grpc.CallOption) (*MsgCancelBondResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) CreateBond(ctx context.Context, in *MsgCreateBond, opts ...grpc.CallOption) (*MsgCreateBondResponse, error) { + out := new(MsgCreateBondResponse) + err := c.cc.Invoke(ctx, "/vulcanize.bond.v1beta1.Msg/CreateBond", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) RefillBond(ctx context.Context, in *MsgRefillBond, opts ...grpc.CallOption) (*MsgRefillBondResponse, error) { + out := new(MsgRefillBondResponse) + err := c.cc.Invoke(ctx, "/vulcanize.bond.v1beta1.Msg/RefillBond", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) WithdrawBond(ctx context.Context, in *MsgWithdrawBond, opts ...grpc.CallOption) (*MsgWithdrawBondResponse, error) { + out := new(MsgWithdrawBondResponse) + err := c.cc.Invoke(ctx, "/vulcanize.bond.v1beta1.Msg/WithdrawBond", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) CancelBond(ctx context.Context, in *MsgCancelBond, opts ...grpc.CallOption) (*MsgCancelBondResponse, error) { + out := new(MsgCancelBondResponse) + err := c.cc.Invoke(ctx, "/vulcanize.bond.v1beta1.Msg/CancelBond", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + // CreateBond defines a method for creating a new bond. + CreateBond(context.Context, *MsgCreateBond) (*MsgCreateBondResponse, error) + // RefillBond defines a method for refilling amount for bond. + RefillBond(context.Context, *MsgRefillBond) (*MsgRefillBondResponse, error) + // WithdrawBond defines a method for withdrawing amount from bond. + WithdrawBond(context.Context, *MsgWithdrawBond) (*MsgWithdrawBondResponse, error) + // CancelBond defines a method for cancelling a bond. + CancelBond(context.Context, *MsgCancelBond) (*MsgCancelBondResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) CreateBond(ctx context.Context, req *MsgCreateBond) (*MsgCreateBondResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateBond not implemented") +} +func (*UnimplementedMsgServer) RefillBond(ctx context.Context, req *MsgRefillBond) (*MsgRefillBondResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RefillBond not implemented") +} +func (*UnimplementedMsgServer) WithdrawBond(ctx context.Context, req *MsgWithdrawBond) (*MsgWithdrawBondResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method WithdrawBond not implemented") +} +func (*UnimplementedMsgServer) CancelBond(ctx context.Context, req *MsgCancelBond) (*MsgCancelBondResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CancelBond not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_CreateBond_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgCreateBond) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).CreateBond(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vulcanize.bond.v1beta1.Msg/CreateBond", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).CreateBond(ctx, req.(*MsgCreateBond)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_RefillBond_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgRefillBond) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).RefillBond(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vulcanize.bond.v1beta1.Msg/RefillBond", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).RefillBond(ctx, req.(*MsgRefillBond)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_WithdrawBond_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgWithdrawBond) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).WithdrawBond(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vulcanize.bond.v1beta1.Msg/WithdrawBond", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).WithdrawBond(ctx, req.(*MsgWithdrawBond)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_CancelBond_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgCancelBond) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).CancelBond(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vulcanize.bond.v1beta1.Msg/CancelBond", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).CancelBond(ctx, req.(*MsgCancelBond)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "vulcanize.bond.v1beta1.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreateBond", + Handler: _Msg_CreateBond_Handler, + }, + { + MethodName: "RefillBond", + Handler: _Msg_RefillBond_Handler, + }, + { + MethodName: "WithdrawBond", + Handler: _Msg_WithdrawBond_Handler, + }, + { + MethodName: "CancelBond", + Handler: _Msg_CancelBond_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "vulcanize/bond/v1beta1/tx.proto", +} + +func (m *MsgCreateBond) 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 *MsgCreateBond) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateBond) 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.Signer) > 0 { + i -= len(m.Signer) + copy(dAtA[i:], m.Signer) + i = encodeVarintTx(dAtA, i, uint64(len(m.Signer))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgCreateBondResponse) 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 *MsgCreateBondResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateBondResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Id) > 0 { + i -= len(m.Id) + copy(dAtA[i:], m.Id) + i = encodeVarintTx(dAtA, i, uint64(len(m.Id))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgRefillBond) 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 *MsgRefillBond) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRefillBond) 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] = 0x1a + } + } + if len(m.Signer) > 0 { + i -= len(m.Signer) + copy(dAtA[i:], m.Signer) + i = encodeVarintTx(dAtA, i, uint64(len(m.Signer))) + i-- + dAtA[i] = 0x12 + } + if len(m.Id) > 0 { + i -= len(m.Id) + copy(dAtA[i:], m.Id) + i = encodeVarintTx(dAtA, i, uint64(len(m.Id))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgRefillBondResponse) 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 *MsgRefillBondResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRefillBondResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgWithdrawBond) 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 *MsgWithdrawBond) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgWithdrawBond) 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] = 0x1a + } + } + if len(m.Signer) > 0 { + i -= len(m.Signer) + copy(dAtA[i:], m.Signer) + i = encodeVarintTx(dAtA, i, uint64(len(m.Signer))) + i-- + dAtA[i] = 0x12 + } + if len(m.Id) > 0 { + i -= len(m.Id) + copy(dAtA[i:], m.Id) + i = encodeVarintTx(dAtA, i, uint64(len(m.Id))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgWithdrawBondResponse) 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 *MsgWithdrawBondResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgWithdrawBondResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgCancelBond) 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 *MsgCancelBond) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCancelBond) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Signer) > 0 { + i -= len(m.Signer) + copy(dAtA[i:], m.Signer) + i = encodeVarintTx(dAtA, i, uint64(len(m.Signer))) + i-- + dAtA[i] = 0x12 + } + if len(m.Id) > 0 { + i -= len(m.Id) + copy(dAtA[i:], m.Id) + i = encodeVarintTx(dAtA, i, uint64(len(m.Id))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgCancelBondResponse) 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 *MsgCancelBondResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCancelBondResponse) 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 *MsgCreateBond) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Signer) + 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 *MsgCreateBondResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Id) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgRefillBond) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Id) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Signer) + 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 *MsgRefillBondResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgWithdrawBond) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Id) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Signer) + 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 *MsgWithdrawBondResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgCancelBond) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Id) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgCancelBondResponse) 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 *MsgCreateBond) 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: MsgCreateBond: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateBond: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signer", 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.Signer = 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 *MsgCreateBondResponse) 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: MsgCreateBondResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateBondResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", 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.Id = string(dAtA[iNdEx:postIndex]) + 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 *MsgRefillBond) 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: MsgRefillBond: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRefillBond: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", 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.Id = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signer", 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.Signer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + 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 *MsgRefillBondResponse) 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: MsgRefillBondResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRefillBondResponse: 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 (m *MsgWithdrawBond) 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: MsgWithdrawBond: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgWithdrawBond: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", 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.Id = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signer", 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.Signer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + 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 *MsgWithdrawBondResponse) 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: MsgWithdrawBondResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgWithdrawBondResponse: 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 (m *MsgCancelBond) 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: MsgCancelBond: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCancelBond: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", 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.Id = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signer", 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.Signer = string(dAtA[iNdEx:postIndex]) + 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 *MsgCancelBondResponse) 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: MsgCancelBondResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCancelBondResponse: 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/nameservice/README.md b/x/nameservice/README.md new file mode 100644 index 00000000..92b49c7c --- /dev/null +++ b/x/nameservice/README.md @@ -0,0 +1,340 @@ +# Build chain + +```bash +# it will create binary in build folder with `ethermintd` +$ make build +``` + +# Setup Chain + +```bash +./build/chibaclonkd keys add root +./build/chibaclonkd init test-moniker --chain-id ethermint_9000-1 +./build/chibaclonkd add-genesis-account $(./build/chibaclonkd keys show root -a) 1000000000000000000aphoton,1000000000000000000stake +./build/chibaclonkd gentx root 1000000000000000000stake --chain-id ethermint_9000-1 +./build/chibaclonkd collect-gentxs +./build/chibaclonkd start +``` + +## Get Params + +```bash +$ ./build/chibaclonkd q nameservice params -o json | jq . +{ + "params": { + "record_rent": { + "denom": "stake", + "amount": "1000000" + }, + + "record_rent_duration": "31536000s", + "authority_rent": { + "denom": "stake", + "amount": "1000000" + }, + "authority_rent_duration": "31536000s", + "authority_grace_period": "172800s", + "authority_auction_enabled": false, + "authority_auction_commits_duration": "86400s", + "authority_auction_reveals_duration": "86400s", + "authority_auction_commit_fee": { + "denom": "stake", + "amount": "1000000" + }, + "authority_auction_reveal_fee": { + "denom": "stake", + "amount": "1000000" + }, + "authority_auction_minimum_bid": { + "denom": "stake", + "amount": "5000000" + } + } + +``` + +## Create (Set) Record + +> First you have to Create bond + +```bash +$ ./build/chibaclonkd tx nameservice set ~/Desktop/examples/records/example1.yml 95f68b1b862bfd1609b0c9aaf7300287b92fec90ac64027092c3e723af36e83d --from root --chain-id ethermint_9000-1 --yes -o json +{ + "height": "0", + "txhash": "BA44ABE1194724694E7CB290F9F3121DB4E63E1A030D95CB84813EEA132CF95F", + "codespace": "", + "code": 0, + "data": "", + "raw_log": "[]", + "logs": [], + "info": "", + "gas_wanted": "0", + "gas_used": "0", + "tx": null, + "timestamp": "" +} +``` + +## Get records list + +```bash +$ ./build/chibaclonkd q nameservice list -o json | jq +[ + { + "id": "bafyreih7un2ntk235wshncebus5emlozdhdixrrv675my5umb6fgdergae", + "bondId": "c3f7a78c5042d2003880962ba31ff3b01fcf5942960e0bc3ca331f816346a440", + "createTime": "2021-10-04T06:50:06.369025861Z", + "expiryTime": "2022-10-04T06:50:06.369025861Z", + "attributes": { + "attr1": "value1", + "attr2": "value2", + "link1": { + "/": "QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D" + }, + "link2": { + "/": "QmP8jTG1m9GSDJLCbeWhVSVgEzCPPwXRdCRuJtQ5Tz9Kc9" + } + } + } +] + + +``` + +## Get record by id + +```bash +$ ./build/chibaclonkd q nameservice get bafyreih7un2ntk235wshncebus5emlozdhdixrrv675my5umb6fgdergae -o json | jq . +{ + "record": { + "id": "bafyreih7un2ntk235wshncebus5emlozdhdixrrv675my5umb6fgdergae", + "bond_id": "95f68b1b862bfd1609b0c9aaf7300287b92fec90ac64027092c3e723af36e83d", + "create_time": "2021-09-27T07:23:25.558111606Z", + "expiry_time": "2022-09-27T07:23:25.558111606Z", + "deleted": false, + "owners": [], + "attributes": "eyJhdHRyMSI6InZhbHVlMSIsImF0dHIyIjoidmFsdWUyIiwibGluazEiOnsiLyI6IlFtU251V214cHRKWmRMSnBLUmFyeEJNUzJKdTJvQU5WcmdicjJ4V2JpZTliMkQifSwibGluazIiOnsiLyI6IlFtUDhqVEcxbTlHU0RKTENiZVdoVlNWZ0V6Q1BQd1hSZENSdUp0UTVUejlLYzkifX0=" + } +} +``` + +## Reserve name + +```bash + ./build/chibaclonkd tx nameservice reserve-name hello --from root --chain-id ethermint_9000-1 --owner $(./build/chibaclonkd key +s show root -a) -y -o json | jq . +{ + "height": "0", + "txhash": "7EC19157AC89279DEBE840EA3384FC95D1E2A0931C27746CA42AC23AE285B7ED", + "codespace": "", + "code": 0, + "data": "", + "raw_log": "[]", + "logs": [], + "info": "", + "gas_wanted": "0", + "gas_used": "0", + "tx": null, + "timestamp": "" +} + +``` + +## Query Whois for name authority + +```bash + ./build/chibaclonkd q nameservice whois hello -o json | jq . +{ + "name_authority": { + "owner_public_key": "Au3hH1tzL1KgZfXfA71jGYSe5RV9Wg95kwhBWs8V+N+h", + "owner_address": "ethm1mfdjngh5jvjs9lqtt9a7y2hlgw8v3syh3hsqzk", + "height": "174", + "status": "active", + "auction_id": "", + "bond_id": "", + "expiry_time": "2021-09-29T07:34:36.304545965Z" + } +} + +``` + +## Query the nameservice module balance + +```bash +$ ./build/chibaclonkd q nameservice balance -o json | jq . +{ + "balances": [ + { + "account_name": "record_rent", + "balance": [ + { + "denom": "stake", + "amount": "1000000" + } + ] + } + ] +} + +``` + +## add bond to the authority + +```bash +$ ./build/chibaclonkd tx nameservice authority-bond [Authority Name] [Bond ID ] --from root --chain-id ethermint_9000-1 -y -o json | jq . +$ ./build/chibaclonkd tx nameservice authority-bond hello 95f68b1b862bfd1609b0c9aaf7300287b92fec90ac64027092c3e723af36e83d --from root --chain-id ethermint_9000-1 -y -o json | jq . + ``` + +## Query the records by associate bond id + +```bash +$ ./build/chibaclonkd q nameservice query-by-bond 95f68b1b862bfd1609b0c9aaf7300287b92fec90ac64027092c3e723af36e83d -o json | jq . +{ + "records": [ + { + "id": "bafyreih7un2ntk235wshncebus5emlozdhdixrrv675my5umb6fgdergae", + "bond_id": "95f68b1b862bfd1609b0c9aaf7300287b92fec90ac64027092c3e723af36e83d", + "create_time": "2021-09-27T08:25:32.893155609Z", + "expiry_time": "2022-09-27T08:25:32.893155609Z", + "deleted": false, + "owners": [], + "attributes": "eyJhdHRyMSI6InZhbHVlMSIsImF0dHIyIjoidmFsdWUyIiwibGluazEiOnsiLyI6IlFtU251V214cHRKWmRMSnBLUmFyeEJNUzJKdTJvQU5WcmdicjJ4V2JpZTliMkQifSwibGluazIiOnsiLyI6IlFtUDhqVEcxbTlHU0RKTENiZVdoVlNWZ0V6Q1BQd1hSZENSdUp0UTVUejlLYzkifX0=" + } + ], + "pagination": null +} + +``` + +## dissociate bond from record + +```bash +$ ./build/chibaclonkd tx nameservice dissociate-bond bafyreih7un2ntk235wshncebus5emlozdhdixrrv675my5umb6fgdergae --from root --chain-id ethermint_9000-1 +{"body":{"messages":[{"@type":"/vulcanize.nameservice.v1beta1.MsgDissociateBond","record_id":"bafyreih7un2ntk235wshncebus5emlozdhdixrrv675my5umb6fgdergae","signer":"ethm1mfdjngh5jvjs9lqtt9a7y2hlgw8v3syh3hsqzk"}],"memo":"","timeout_height":"0","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[],"fee":{"amount":[],"gas_limit":"200000","payer":"","granter":""}},"signatures":[]} + +confirm transaction before signing and broadcasting [y/N]: y +code: 0 +codespace: "" +data: "" +gas_used: "0" +gas_wanted: "0" +height: "0" +info: "" +logs: [] +raw_log: '[]' +timestamp: "" +tx: null +txhash: 7AFEF524CB0D92D6576FC08601A787786E802449888FD8DDAA7635698CC85060 + +``` + +## Associate bond with record + +```bash +./build/chibaclonkd tx nameservice associate-bond bafyreih7un2ntk235wshncebus5emlozdhdixrrv675my5umb6fgdergae c3f7a78c5042d2003880962ba31ff3b01fcf5942960e0bc3ca331f816346a440 --from root --chain-id ethermint_9000-1 -y -o json | jq . +{ + "height": "0", + "txhash": "F75C2BF2FE73668AE1332E1237F924AC549E31E822A56394DE5AC17200B199F9", + "codespace": "", + "code": 0, + "data": "", + "raw_log": "[]", + "logs": [], + "info": "", + "gas_wanted": "0", + "gas_used": "0", + "tx": null, + "timestamp": "" +} + +``` + +## dissociate-records => remove all record from bond + +```bash +$./build/chibaclonkd tx nameservice dissociate-records c3f7a78c5042d2003880962ba31ff3b01fcf5942960e0bc3ca331f816346a440 --from root --chain-id ethermint_9000-1 -y -o json | jq . +{ + "height": "0", + "txhash": "0316F503E5DEA47CB108AE6C7C7FFAF3F71CC56BC22F63CB97322E1BE48B33B9", + "codespace": "", + "code": 0, + "data": "", + "raw_log": "[]", + "logs": [], + "info": "", + "gas_wanted": "0", + "gas_used": "0", + "tx": null, + "timestamp": "" +} +``` + +## Renew a record + +> When a record is expires , needs to renew record + +```bash +$ ./build/chibaclonkd tx nameservice renew-record bafyreih7un2ntk235wshncebus5emlozdhdixrrv675my5umb6fgdergae --from root --chain-id ethermint_9000-1 + +``` + +## Set the authority name + +```bash +$ ./build/chibaclonkd tx nameservice set-name crn://hello/test test_hello_cid --from root --chain-id ethermint_9000-1 -y -o json | jq . +{ + "height": "0", + "txhash": "66A63C73B076EEE9A2F7605354448EDEB161F0115D4D03AF68C01BA28DB97486", + "codespace": "", + "code": 0, + "data": "", + "raw_log": "[]", + "logs": [], + "info": "", + "gas_wanted": "0", + "gas_used": "0", + "tx": null, + "timestamp": "" +} +``` + +## Delete the name + +```bash +$./build/chibaclonkd tx nameservice delete-name crn://hello/test --from root --chain-id ethermint_9000-1 -y +code: 0 +codespace: "" +data: "" +gas_used: "0" +gas_wanted: "0" +height: "0" +info: "" +logs: [] +raw_log: '[]' +timestamp: "" +tx: null +txhash: A3FF4C46BAC7BD6E54BBB743A49830AE8C6F6FE59282384789CBA323C1FE540C + +``` + +## List of Authorities Expire Queue + +```bash +$ ./build/chibaclonkd q nameservice authority-expiry -o json | jq . +{ + "authorities": [], + "pagination": null +} + +``` + +## List of Records Expire Queue + +```bash +$ ./build/chibaclonkd q nameservice record-expiry -o json | jq . +{ + "records": [], + "pagination": null +} + +``` \ No newline at end of file diff --git a/x/nameservice/abci.go b/x/nameservice/abci.go new file mode 100644 index 00000000..7deb1556 --- /dev/null +++ b/x/nameservice/abci.go @@ -0,0 +1,20 @@ +package nameservice + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + abci "github.com/tendermint/tendermint/abci/types" + "github.com/tharsis/ethermint/x/nameservice/keeper" +) + +// BeginBlocker will persist the current header and validator set as a historical entry +// and prune the oldest entry based on the HistoricalEntries parameter +func BeginBlocker(ctx sdk.Context, k keeper.Keeper) { +} + +// EndBlocker Called every block, update validator set +func EndBlocker(ctx sdk.Context, k keeper.Keeper) []abci.ValidatorUpdate { + k.ProcessRecordExpiryQueue(ctx) + k.ProcessAuthorityExpiryQueue(ctx) + + return []abci.ValidatorUpdate{} +} diff --git a/x/nameservice/client/cli/query.go b/x/nameservice/client/cli/query.go new file mode 100644 index 00000000..71257932 --- /dev/null +++ b/x/nameservice/client/cli/query.go @@ -0,0 +1,398 @@ +package cli + +import ( + "encoding/json" + "fmt" + "strings" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/version" + "github.com/spf13/cobra" + "github.com/tharsis/ethermint/x/nameservice/types" +) + +// GetQueryCmd returns the cli query commands for this module +func GetQueryCmd() *cobra.Command { + bondQueryCmd := &cobra.Command{ + Use: types.ModuleName, + Short: "Querying commands for the nameservice module", + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + bondQueryCmd.AddCommand( + GetCmdWhoIs(), + GetCmdResolve(), + GetCmdLookupCRN(), + GetRecordExpiryQueue(), + GetAuthorityExpiryQueue(), + GetQueryParamsCmd(), + GetCmdList(), + GetCmdGetResource(), + GetCmdQueryByBond(), + GetCmdBalance(), + GetCmdNames(), + ) + return bondQueryCmd +} + +// GetCmdWhoIs queries a whois info for a name. +func GetCmdWhoIs() *cobra.Command { + cmd := &cobra.Command{ + Use: "whois [name]", + Short: "Get name owner info.", + Long: strings.TrimSpace( + fmt.Sprintf(`Get name owner info. +Example: +$ %s query %s whois [name] +`, + version.AppName, types.ModuleName, + ), + ), + Args: cobra.ExactArgs(1), + 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.Whois(cmd.Context(), &types.QueryWhoisRequest{Name: args[0]}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + flags.AddQueryFlagsToCmd(cmd) + return cmd +} + +// GetCmdLookupCRN queries naming info for a CRN. +func GetCmdLookupCRN() *cobra.Command { + cmd := &cobra.Command{ + Use: "lookup [crn]", + Short: "Get naming info for CRN.", + Long: strings.TrimSpace( + fmt.Sprintf(`Get naming info for CRN. +Example: +$ %s query %s lookup [crn] +`, + version.AppName, types.ModuleName, + ), + ), + Args: cobra.ExactArgs(1), + 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.LookupCrn(cmd.Context(), &types.QueryLookupCrn{Crn: args[0]}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + flags.AddQueryFlagsToCmd(cmd) + return cmd +} + +// GetQueryParamsCmd implements the params query command. +func GetQueryParamsCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "params", + Args: cobra.NoArgs, + Short: "Query the current bond parameters information.", + Long: strings.TrimSpace( + fmt.Sprintf(`Query values set as bond parameters. +Example: +$ %s query %s params +`, + version.AppName, types.ModuleName, + ), + ), + 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 +} + +// GetCmdList queries all records. +func GetCmdList() *cobra.Command { + cmd := &cobra.Command{ + Use: "list", + Short: "List records.", + Long: strings.TrimSpace( + fmt.Sprintf(`Get the records. +Example: +$ %s query %s list +`, + version.AppName, types.ModuleName, + ), + ), + Args: cobra.ExactArgs(0), + 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.ListRecords(cmd.Context(), &types.QueryListRecordsRequest{}) + if err != nil { + return err + } + + recordsList := res.GetRecords() + records := make([]types.RecordType, len(recordsList)) + for i, record := range res.GetRecords() { + records[i] = record.ToRecordType() + } + bytesResult, err := json.Marshal(records) + if err != nil { + return err + } + return clientCtx.PrintBytes(bytesResult) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + return cmd +} + +// GetCmdGetResource queries a record record. +func GetCmdGetResource() *cobra.Command { + cmd := &cobra.Command{ + Use: "get [ID]", + Short: "Get record.", + Long: strings.TrimSpace( + fmt.Sprintf(`Get the record by id. +Example: +$ %s query %s get [ID] +`, + version.AppName, types.ModuleName, + ), + ), + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + queryClient := types.NewQueryClient(clientCtx) + record, err := queryClient.GetRecord(cmd.Context(), &types.QueryRecordByIdRequest{Id: args[0]}) + if err != nil { + return err + } + return clientCtx.PrintProto(record) + }, + } + flags.AddQueryFlagsToCmd(cmd) + return cmd +} + +// GetCmdResolve resolves a CRN to a record. +func GetCmdResolve() *cobra.Command { + cmd := &cobra.Command{ + Use: "resolve [crn]", + Short: "Resolve CRN to record.", + Long: strings.TrimSpace( + fmt.Sprintf(`Resolve CRN to record. +Example: +$ %s query %s resolve [crn] +`, + version.AppName, types.ModuleName, + ), + ), + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + queryClient := types.NewQueryClient(clientCtx) + record, err := queryClient.ResolveCrn(cmd.Context(), &types.QueryResolveCrn{Crn: args[0]}) + if err != nil { + return err + } + return clientCtx.PrintProto(record) + }, + } + flags.AddQueryFlagsToCmd(cmd) + return cmd +} + +// GetCmdQueryByBond queries records by bond ID. +func GetCmdQueryByBond() *cobra.Command { + cmd := &cobra.Command{ + Use: "query-by-bond [bond-id]", + Short: "Query records by bond ID.", + Long: strings.TrimSpace( + fmt.Sprintf(`Get the record by bond id. +Example: +$ %s query %s query-by-bond [bond id] +`, + version.AppName, types.ModuleName, + ), + ), + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + queryClient := types.NewQueryClient(clientCtx) + + bondID := args[0] + res, err := queryClient.GetRecordByBondId(cmd.Context(), &types.QueryRecordByBondIdRequest{Id: bondID}) + if err != nil { + return err + } + return clientCtx.PrintProto(res) + + }, + } + flags.AddQueryFlagsToCmd(cmd) + return cmd +} + +// GetCmdBalance queries the bond module account balance. +func GetCmdBalance() *cobra.Command { + cmd := &cobra.Command{ + Use: "balance", + Short: "Get record rent module account balance.", + Long: strings.TrimSpace( + fmt.Sprintf(`Get the record rent module account balance. +Example: +$ %s query %s balance +`, + version.AppName, types.ModuleName, + ), + ), + Args: cobra.ExactArgs(0), + 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.GetNameServiceModuleBalance(cmd.Context(), &types.GetNameServiceModuleBalanceRequest{}) + if err != nil { + return err + } + return clientCtx.PrintProto(res) + }, + } + flags.AddQueryFlagsToCmd(cmd) + return cmd +} + +// GetCmdNames queries all naming records. +func GetCmdNames() *cobra.Command { + cmd := &cobra.Command{ + Use: "names", + Short: "List name records.", + Long: strings.TrimSpace( + fmt.Sprintf(`Get the names list. +Example: +$ %s query %s names +`, + version.AppName, types.ModuleName, + ), + ), + Args: cobra.ExactArgs(0), + 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.ListNameRecords(cmd.Context(), &types.QueryListNameRecordsRequest{}) + if err != nil { + return err + } + return clientCtx.PrintProto(res) + }, + } + flags.AddQueryFlagsToCmd(cmd) + return cmd +} + +// GetRecordExpiryQueue gets the record expiry queue. +func GetRecordExpiryQueue() *cobra.Command { + cmd := &cobra.Command{ + Use: "record-expiry", + Short: "Get record expiry queue.", + Long: strings.TrimSpace( + fmt.Sprintf(`Get record expiry queue. +Example: +$ %s query %s record-expiry +`, + version.AppName, types.ModuleName, + ), + ), + Args: cobra.ExactArgs(0), + 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.GetRecordExpiryQueue(cmd.Context(), &types.QueryGetRecordExpiryQueue{}) + if err != nil { + return err + } + return clientCtx.PrintProto(res) + }, + } + flags.AddQueryFlagsToCmd(cmd) + return cmd +} + +// GetAuthorityExpiryQueue gets the authority expiry queue. +func GetAuthorityExpiryQueue() *cobra.Command { + cmd := &cobra.Command{ + Use: "authority-expiry", + Short: "Get authority expiry queue.", + Long: strings.TrimSpace( + fmt.Sprintf(`Get authority expiry queue. +Example: +$ %s query %s authority-expiry +`, + version.AppName, types.ModuleName, + ), + ), + Args: cobra.ExactArgs(0), + 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.GetAuthorityExpiryQueue(cmd.Context(), &types.QueryGetAuthorityExpiryQueue{}) + if err != nil { + return err + } + return clientCtx.PrintProto(res) + }, + } + flags.AddQueryFlagsToCmd(cmd) + return cmd +} diff --git a/x/nameservice/client/cli/tx.go b/x/nameservice/client/cli/tx.go new file mode 100644 index 00000000..02840a76 --- /dev/null +++ b/x/nameservice/client/cli/tx.go @@ -0,0 +1,389 @@ +package cli + +import ( + "fmt" + "io/ioutil" + "strings" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/tx" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/version" + "github.com/spf13/cobra" + "github.com/tharsis/ethermint/server/flags" + "github.com/tharsis/ethermint/x/nameservice/types" + "gopkg.in/yaml.v3" +) + +// NewTxCmd returns a root CLI command handler for all x/bond transaction commands. +func NewTxCmd() *cobra.Command { + bondTxCmd := &cobra.Command{ + Use: types.ModuleName, + Short: "nameservice transaction subcommands", + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + bondTxCmd.AddCommand( + GetCmdSetRecord(), + GetCmdRenewRecord(), + GetCmdAssociateBond(), + GetCmdDissociateBond(), + GetCmdDissociateRecords(), + GetCmdReAssociateRecords(), + GetCmdSetName(), + GetCmdReserveName(), + GetCmdSetAuthorityBond(), + GetCmdDeleteName(), + ) + + return bondTxCmd +} + +// GetCmdSetRecord is the CLI command for creating/updating a record. +func GetCmdSetRecord() *cobra.Command { + cmd := &cobra.Command{ + Use: "set [payload file path] [bond-id]", + Short: "Set record.", + Long: strings.TrimSpace( + fmt.Sprintf(`Create a new record with payload and bond id. +Example: +$ %s tx %s set [payload file path] [bond-id] +`, + version.AppName, types.ModuleName, + ), + ), + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + payload, err := GetPayloadFromFile(args[0]) + if err != nil { + return err + } + + msg := types.NewMsgSetRecord(payload.ToPayload(), args[1], clientCtx.GetFromAddress()) + err = msg.ValidateBasic() + if err != nil { + return err + } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) + }, + } + + flags.AddTxFlags(cmd) + return cmd +} + +// GetCmdRenewRecord is the CLI command for renewing an expired record. +func GetCmdRenewRecord() *cobra.Command { + cmd := &cobra.Command{ + Use: "renew-record [record-id]", + Short: "Renew (expired) record.", + Long: strings.TrimSpace( + fmt.Sprintf(`Renew record. +Example: +$ %s tx %s renew-record [record-id] +`, + version.AppName, types.ModuleName, + ), + ), + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + msg := types.NewMsgRenewRecord(args[0], clientCtx.GetFromAddress()) + err = msg.ValidateBasic() + if err != nil { + return err + } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) + }, + } + + flags.AddTxFlags(cmd) + return cmd +} + +// GetCmdAssociateBond is the CLI command for associating a record with a bond. +func GetCmdAssociateBond() *cobra.Command { + cmd := &cobra.Command{ + Use: "associate-bond [record-id] [bond-id]", + Short: "Associate record with bond.", + Long: strings.TrimSpace( + fmt.Sprintf(`Associate record with bond. +Example: +$ %s tx %s associate-bond [record-id] [bond-id] +`, + version.AppName, types.ModuleName, + ), + ), + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + msg := types.NewMsgAssociateBond(args[0], args[1], clientCtx.GetFromAddress()) + err = msg.ValidateBasic() + if err != nil { + return err + } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) + }, + } + + flags.AddTxFlags(cmd) + return cmd +} + +// GetCmdDissociateBond is the CLI command for dissociating a record from a bond. +func GetCmdDissociateBond() *cobra.Command { + cmd := &cobra.Command{ + Use: "dissociate-bond [record-id]", + Short: "Dissociate record from (existing) bond.", + Long: strings.TrimSpace( + fmt.Sprintf(`Dissociate record from (existing) bond. +Example: +$ %s tx %s dissociate-bond [record-id] +`, + version.AppName, types.ModuleName, + ), + ), + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + msg := types.NewMsgDissociateBond(args[0], clientCtx.GetFromAddress()) + err = msg.ValidateBasic() + if err != nil { + return err + } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) + }, + } + + flags.AddTxFlags(cmd) + return cmd +} + +// GetCmdDissociateRecords is the CLI command for dissociating all records from a bond. +func GetCmdDissociateRecords() *cobra.Command { + cmd := &cobra.Command{ + Use: "dissociate-records [bond-id]", + Short: "Dissociate all records from bond.", + Long: strings.TrimSpace( + fmt.Sprintf(`Dissociate all records from bond. +Example: +$ %s tx %s dissociate-bond [record-id] +`, + version.AppName, types.ModuleName, + ), + ), + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + msg := types.NewMsgDissociateRecords(args[0], clientCtx.GetFromAddress()) + err = msg.ValidateBasic() + if err != nil { + return err + } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) + }, + } + + flags.AddTxFlags(cmd) + return cmd +} + +// GetCmdReAssociateRecords is the CLI command for reassociating all records from old to new bond. +func GetCmdReAssociateRecords() *cobra.Command { + cmd := &cobra.Command{ + Use: "reassociate-records [old-bond-id] [new-bond-id]", + Short: "Re-Associates all records from old to new bond.", + Long: strings.TrimSpace( + fmt.Sprintf(`Re-Associates all records from old to new bond. +Example: +$ %s tx %s reassociate-records [old-bond-id] [new-bond-id] +`, + version.AppName, types.ModuleName, + ), + ), + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + msg := types.NewMsgReAssociateRecords(args[0], args[1], clientCtx.GetFromAddress()) + err = msg.ValidateBasic() + if err != nil { + return err + } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) + }, + } + + flags.AddTxFlags(cmd) + return cmd +} + +// GetCmdSetName is the CLI command for mapping a name to a CID. +func GetCmdSetName() *cobra.Command { + cmd := &cobra.Command{ + Use: "set-name [crn] [cid]", + Short: "Set CRN to CID mapping.", + Long: strings.TrimSpace( + fmt.Sprintf(`Set name with crn and cid. +Example: +$ %s tx %s set-name [crn] [cid] +`, + version.AppName, types.ModuleName, + ), + ), + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + msg := types.NewMsgSetName(args[0], args[1], clientCtx.GetFromAddress()) + err = msg.ValidateBasic() + if err != nil { + return err + } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) + }, + } + + flags.AddTxFlags(cmd) + return cmd +} + +// GetCmdReserveName is the CLI command for reserving a name. +func GetCmdReserveName() *cobra.Command { + cmd := &cobra.Command{ + Use: "reserve-name [name]", + Short: "Reserve name.", + Long: strings.TrimSpace( + fmt.Sprintf(`Reserver name with owner address . +Example: +$ %s tx %s reserve-name [name] --owner [ownerAddress] +`, + version.AppName, types.ModuleName, + ), + ), + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + owner, err := cmd.Flags().GetString("owner") + if err != nil { + return err + } + ownerAddress, err := sdk.AccAddressFromBech32(owner) + if err != nil { + return err + } + + msg := types.NewMsgReserveAuthority(args[0], clientCtx.GetFromAddress(), ownerAddress) + err = msg.ValidateBasic() + if err != nil { + return err + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) + }, + } + + cmd.Flags().String("owner", "", "Owner address, if creating a sub-authority.") + + flags.AddTxFlags(cmd) + return cmd +} + +// GetCmdSetAuthorityBond is the CLI command for associating a bond with an authority. +func GetCmdSetAuthorityBond() *cobra.Command { + cmd := &cobra.Command{ + Use: "authority-bond [name] [bond-id]", + Short: "Associate authority with bond.", + Long: strings.TrimSpace( + fmt.Sprintf(`Reserver name with owner address . +Example: +$ %s tx %s authority-bond [name] [bond-id] +`, + version.AppName, types.ModuleName, + ), + ), + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + msg := types.NewMsgSetAuthorityBond(args[0], args[1], clientCtx.GetFromAddress()) + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) + }, + } + + flags.AddTxFlags(cmd) + return cmd +} + +func GetCmdDeleteName() *cobra.Command { + cmd := &cobra.Command{ + Use: "delete-name [crn]", + Short: "Delete CRN.", + Long: strings.TrimSpace( + fmt.Sprintf(`Delete CRN. +Example: +$ %s tx %s delete-name [crn] +`, + version.AppName, types.ModuleName, + ), + ), + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + msg := types.NewMsgDeleteNameAuthority(args[0], clientCtx.GetFromAddress()) + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) + }, + } + + flags.AddTxFlags(cmd) + return cmd +} + +//GetPayloadFromFile Load payload object from YAML file. +func GetPayloadFromFile(filePath string) (*types.PayloadType, error) { + var payload types.PayloadType + + data, err := ioutil.ReadFile(filePath) + if err != nil { + return nil, err + } + + err = yaml.Unmarshal(data, &payload) + if err != nil { + return nil, err + } + + return &payload, nil +} diff --git a/x/nameservice/client/testutil/cli_test.go b/x/nameservice/client/testutil/cli_test.go new file mode 100644 index 00000000..69069bc5 --- /dev/null +++ b/x/nameservice/client/testutil/cli_test.go @@ -0,0 +1,13 @@ +package testutil + +import ( + "github.com/stretchr/testify/suite" + "github.com/tharsis/ethermint/testutil/network" + "testing" +) + +func TestIntegrationTestSuite(t *testing.T) { + cfg := network.DefaultConfig() + cfg.NumValidators = 1 + suite.Run(t, NewIntegrationTestSuite(cfg)) +} diff --git a/x/nameservice/client/testutil/example1.yml b/x/nameservice/client/testutil/example1.yml new file mode 100644 index 00000000..3f7b4863 --- /dev/null +++ b/x/nameservice/client/testutil/example1.yml @@ -0,0 +1,7 @@ +record: + attr1: value1 + attr2: value2 + link1: + /: QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D + link2: + /: QmP8jTG1m9GSDJLCbeWhVSVgEzCPPwXRdCRuJtQ5Tz9Kc9 diff --git a/x/nameservice/client/testutil/grpc.go b/x/nameservice/client/testutil/grpc.go new file mode 100644 index 00000000..fd7a16e3 --- /dev/null +++ b/x/nameservice/client/testutil/grpc.go @@ -0,0 +1,651 @@ +package testutil + +import ( + "encoding/json" + "fmt" + "os" + "time" + + "github.com/cosmos/cosmos-sdk/client/flags" + clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/rest" + tmcli "github.com/tendermint/tendermint/libs/cli" + "github.com/tharsis/ethermint/x/nameservice/client/cli" + nstypes "github.com/tharsis/ethermint/x/nameservice/types" +) + +func (s *IntegrationTestSuite) TestGRPCQueryParams() { + val := s.network.Validators[0] + sr := s.Require() + reqUrl := val.APIAddress + "/vulcanize/nameservice/v1beta1/params" + + testCases := []struct { + name string + url string + expectErr bool + errorMsg string + }{ + { + "invalid url", + reqUrl + "/asdasd", + true, + "", + }, + { + "Success", + reqUrl, + false, + "", + }, + } + + for _, tc := range testCases { + s.Run(tc.name, func() { + resp, _ := rest.GetRequest(tc.url) + require := s.Require() + if tc.expectErr { + require.Contains(string(resp), tc.errorMsg) + } else { + var response nstypes.QueryParamsResponse + err := val.ClientCtx.Codec.UnmarshalJSON(resp, &response) + sr.NoError(err) + params := nstypes.DefaultParams() + params.RecordRent = sdk.NewCoin(s.cfg.BondDenom, nstypes.DefaultRecordRent) + params.RecordRentDuration = 10 * time.Second + params.AuthorityGracePeriod = 10 * time.Second + sr.Equal(response.GetParams().String(), params.String()) + } + }) + } +} + +func (s *IntegrationTestSuite) TestGRPCQueryWhoIs() { + val := s.network.Validators[0] + sr := s.Require() + reqUrl := val.APIAddress + "/vulcanize/nameservice/v1beta1/whois/%s" + var authorityName = "QueryWhoIS" + testCases := []struct { + name string + url string + expectErr bool + errorMsg string + preRun func(authorityName string) + }{ + { + "invalid url", + reqUrl + "/asdasd", + true, + "", + func(authorityName string) { + + }, + }, + { + "Success", + reqUrl, + false, + "", + func(authorityName string) { + clientCtx := val.ClientCtx + cmd := cli.GetCmdReserveName() + args := []string{ + authorityName, + fmt.Sprintf("--owner=%s", accountAddress), + fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), + } + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) + sr.NoError(err) + var d sdk.TxResponse + err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d) + sr.NoError(err) + sr.Zero(d.Code) + }, + }, + } + + for _, tc := range testCases { + s.Run(tc.name, func() { + if !tc.expectErr { + tc.preRun(authorityName) + tc.url = fmt.Sprintf(tc.url, authorityName) + } + resp, _ := rest.GetRequest(tc.url) + require := s.Require() + if tc.expectErr { + require.Contains(string(resp), tc.errorMsg) + } else { + var response nstypes.QueryWhoisResponse + err := val.ClientCtx.Codec.UnmarshalJSON(resp, &response) + sr.NoError(err) + sr.Equal(nstypes.AuthorityActive, response.GetNameAuthority().Status) + } + }) + } +} + +func (s *IntegrationTestSuite) TestGRPCQueryLookup() { + val := s.network.Validators[0] + sr := s.Require() + reqUrl := val.APIAddress + "/vulcanize/nameservice/v1beta1/lookup?crn=%s" + var authorityName = "QueryLookUp" + + testCases := []struct { + name string + url string + expectErr bool + errorMsg string + preRun func(authorityName string) + }{ + { + "invalid url", + reqUrl + "/asdasd", + true, + "", + func(authorityName string) { + + }, + }, + { + "Success", + reqUrl, + false, + "", + func(authorityName string) { + // create name record + createNameRecord(authorityName, s) + }, + }, + } + + for _, tc := range testCases { + s.Run(tc.name, func() { + if !tc.expectErr { + tc.preRun(authorityName) + tc.url = fmt.Sprintf(reqUrl, fmt.Sprintf("crn://%s/", authorityName)) + } + resp, _ := rest.GetRequest(tc.url) + if tc.expectErr { + sr.Contains(string(resp), tc.errorMsg) + } else { + var response nstypes.QueryLookupCrnResponse + err := val.ClientCtx.Codec.UnmarshalJSON(resp, &response) + sr.NoError(err) + sr.NotZero(len(response.Name.Latest.Id)) + } + }) + } +} + +func (s *IntegrationTestSuite) TestGRPCQueryRecordExpiryQueue() { + val := s.network.Validators[0] + sr := s.Require() + reqUrl := val.APIAddress + "/vulcanize/nameservice/v1beta1/record-expiry" + + testCases := []struct { + name string + url string + expectErr bool + errorMsg string + preRun func(bondId string) + }{ + { + "invalid url", + reqUrl + "/asdasd", + true, + "", + func(bondId string) { + + }, + }, + { + "Success", + reqUrl, + false, + "", + func(bondId string) { + dir, err := os.Getwd() + sr.NoError(err) + payloadPath := dir + "/example1.yml" + args := []string{ + fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), + } + args = append([]string{payloadPath, bondId}, args...) + clientCtx := val.ClientCtx + cmd := cli.GetCmdSetRecord() + + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) + sr.NoError(err) + var d sdk.TxResponse + err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d) + sr.NoError(err) + sr.Zero(d.Code) + }, + }, + } + + for _, tc := range testCases { + s.Run(tc.name, func() { + if !tc.expectErr { + tc.preRun(s.bondId) + } + // wait 12 seconds for records expires + time.Sleep(time.Second * 12) + resp, _ := rest.GetRequest(tc.url) + require := s.Require() + if tc.expectErr { + require.Contains(string(resp), tc.errorMsg) + } else { + var response nstypes.QueryGetRecordExpiryQueueResponse + err := val.ClientCtx.Codec.UnmarshalJSON(resp, &response) + sr.NoError(err) + sr.NotZero(len(response.GetRecords())) + } + }) + } +} + +func (s *IntegrationTestSuite) TestGRPCQueryAuthorityExpiryQueue() { + val := s.network.Validators[0] + sr := s.Require() + reqUrl := val.APIAddress + "/vulcanize/nameservice/v1beta1/authority-expiry" + + testCases := []struct { + name string + url string + expectErr bool + errorMsg string + preRun func(authorityName string) + }{ + { + "invalid url", + reqUrl + "/asdasd", + true, + "", + func(authorityName string) { + + }, + }, + { + "Success", + reqUrl, + false, + "", + func(authorityName string) { + // reserving the name + clientCtx := val.ClientCtx + cmd := cli.GetCmdReserveName() + args := []string{ + authorityName, + fmt.Sprintf("--owner=%s", accountAddress), + fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), + } + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) + sr.NoError(err) + var d sdk.TxResponse + err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d) + sr.NoError(err) + sr.Zero(d.Code) + }, + }, + } + + for _, tc := range testCases { + s.Run(tc.name, func() { + if !tc.expectErr { + tc.preRun("QueryAuthorityExpiryQueue") + } + // wait 12 seconds to name authorites expires + time.Sleep(time.Second * 12) + + resp, _ := rest.GetRequest(tc.url) + require := s.Require() + if tc.expectErr { + require.Contains(string(resp), tc.errorMsg) + } else { + var response nstypes.QueryGetAuthorityExpiryQueueResponse + err := val.ClientCtx.Codec.UnmarshalJSON(resp, &response) + sr.NoError(err) + // removed from expiry queue as no bond set + sr.Zero(len(response.GetAuthorities())) + } + }) + } +} + +func (s *IntegrationTestSuite) TestGRPCQueryListRecords() { + val := s.network.Validators[0] + sr := s.Require() + reqUrl := val.APIAddress + "/vulcanize/nameservice/v1beta1/records" + + testCases := []struct { + name string + url string + expectErr bool + errorMsg string + preRun func(bondId string) + }{ + { + "invalid url", + reqUrl + "/asdasd", + true, + "", + func(bondId string) { + + }, + }, + { + "Success", + reqUrl, + false, + "", + func(bondId string) { + dir, err := os.Getwd() + sr.NoError(err) + payloadPath := dir + "/example1.yml" + args := []string{ + fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), + } + args = append([]string{payloadPath, bondId}, args...) + clientCtx := val.ClientCtx + cmd := cli.GetCmdSetRecord() + + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) + sr.NoError(err) + var d sdk.TxResponse + err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d) + sr.NoError(err) + sr.Zero(d.Code) + }, + }, + } + + for _, tc := range testCases { + s.Run(tc.name, func() { + if !tc.expectErr { + tc.preRun(s.bondId) + } + resp, _ := rest.GetRequest(tc.url) + require := s.Require() + if tc.expectErr { + require.Contains(string(resp), tc.errorMsg) + } else { + var response nstypes.QueryListRecordsResponse + err := val.ClientCtx.Codec.UnmarshalJSON(resp, &response) + sr.NoError(err) + sr.NotZero(len(response.GetRecords())) + sr.Equal(s.bondId, response.GetRecords()[0].GetBondId()) + } + }) + } +} + +func (s *IntegrationTestSuite) TestGRPCQueryGetRecordByID() { + val := s.network.Validators[0] + sr := s.Require() + reqUrl := val.APIAddress + "/vulcanize/nameservice/v1beta1/records/%s" + + testCases := []struct { + name string + url string + expectErr bool + errorMsg string + preRun func(bondId string) string + }{ + { + "invalid url", + reqUrl + "/asdasd", + true, + "", + func(bondId string) string { + return "" + }, + }, + { + "Success", + reqUrl, + false, + "", + func(bondId string) string { + // creating the record + createRecord(bondId, s) + + // list the records + clientCtx := val.ClientCtx + cmd := cli.GetCmdList() + args := []string{ + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + } + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) + sr.NoError(err) + var records []nstypes.RecordType + err = json.Unmarshal(out.Bytes(), &records) + sr.NoError(err) + return records[0].Id + }, + }, + } + + for _, tc := range testCases { + s.Run(tc.name, func() { + var recordId string + if !tc.expectErr { + recordId = tc.preRun(s.bondId) + tc.url = fmt.Sprintf(reqUrl, recordId) + } + resp, _ := rest.GetRequest(tc.url) + require := s.Require() + if tc.expectErr { + require.Contains(string(resp), tc.errorMsg) + } else { + var response nstypes.QueryRecordByIdResponse + err := val.ClientCtx.Codec.UnmarshalJSON(resp, &response) + sr.NoError(err) + record := response.GetRecord() + sr.NotZero(len(record.GetId())) + sr.Equal(record.GetId(), recordId) + } + }) + } +} + +func (s *IntegrationTestSuite) TestGRPCQueryGetRecordByBondID() { + val := s.network.Validators[0] + sr := s.Require() + reqUrl := val.APIAddress + "/vulcanize/nameservice/v1beta1/records-by-bond-id/%s" + + testCases := []struct { + name string + url string + expectErr bool + errorMsg string + preRun func(bondId string) + }{ + { + "invalid url", + reqUrl + "/asdasd", + true, + "", + func(bondId string) { + + }, + }, + { + "Success", + reqUrl, + false, + "", + func(bondId string) { + // creating the record + createRecord(bondId, s) + }, + }, + } + + for _, tc := range testCases { + s.Run(tc.name, func() { + if !tc.expectErr { + tc.preRun(s.bondId) + tc.url = fmt.Sprintf(reqUrl, s.bondId) + } + resp, _ := rest.GetRequest(tc.url) + require := s.Require() + if tc.expectErr { + require.Contains(string(resp), tc.errorMsg) + } else { + var response nstypes.QueryRecordByBondIdResponse + err := val.ClientCtx.Codec.UnmarshalJSON(resp, &response) + sr.NoError(err) + records := response.GetRecords() + sr.NotZero(len(records)) + sr.Equal(records[0].GetBondId(), s.bondId) + } + }) + } +} + +func (s *IntegrationTestSuite) TestGRPCQueryGetNameServiceModuleBalance() { + val := s.network.Validators[0] + sr := s.Require() + reqUrl := val.APIAddress + "/vulcanize/nameservice/v1beta1/balance" + + testCases := []struct { + name string + url string + expectErr bool + errorMsg string + preRun func(bondId string) + }{ + { + "invalid url", + reqUrl + "/asdasd", + true, + "", + func(bondId string) { + + }, + }, + { + "Success", + reqUrl, + false, + "", + func(bondId string) { + // creating the record + createRecord(bondId, s) + }, + }, + } + + for _, tc := range testCases { + s.Run(tc.name, func() { + if !tc.expectErr { + tc.preRun(s.bondId) + } + resp, _ := rest.GetRequest(tc.url) + require := s.Require() + if tc.expectErr { + require.Contains(string(resp), tc.errorMsg) + } else { + var response nstypes.GetNameServiceModuleBalanceResponse + err := val.ClientCtx.Codec.UnmarshalJSON(resp, &response) + sr.NoError(err) + sr.NotZero(len(response.GetBalances())) + } + }) + } +} + +func (s *IntegrationTestSuite) TestGRPCQueryNamesList() { + val := s.network.Validators[0] + sr := s.Require() + reqUrl := val.APIAddress + "/vulcanize/nameservice/v1beta1/names" + + testCases := []struct { + name string + url string + expectErr bool + errorMsg string + preRun func(authorityName string) + }{ + { + "invalid url", + reqUrl + "/asdasd", + true, + "", + func(authorityName string) { + + }, + }, + { + "Success", + reqUrl, + false, + "", + func(authorityName string) { + // create name record + createNameRecord(authorityName, s) + }, + }, + } + + for _, tc := range testCases { + s.Run(tc.name, func() { + if !tc.expectErr { + tc.preRun("ListNameRecords") + } + resp, _ := rest.GetRequest(tc.url) + require := s.Require() + if tc.expectErr { + require.Contains(string(resp), tc.errorMsg) + } else { + var response nstypes.QueryListNameRecordsResponse + err := val.ClientCtx.Codec.UnmarshalJSON(resp, &response) + sr.NoError(err) + sr.NotZero(len(response.GetNames())) + } + }) + } +} + +func createRecord(bondId string, s *IntegrationTestSuite) { + val := s.network.Validators[0] + sr := s.Require() + + dir, err := os.Getwd() + sr.NoError(err) + payloadPath := dir + "/example1.yml" + args := []string{ + fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), + } + args = append([]string{payloadPath, bondId}, args...) + clientCtx := val.ClientCtx + cmd := cli.GetCmdSetRecord() + + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) + sr.NoError(err) + var d sdk.TxResponse + err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d) + sr.NoError(err) + sr.Zero(d.Code) +} diff --git a/x/nameservice/client/testutil/query.go b/x/nameservice/client/testutil/query.go new file mode 100644 index 00000000..0616fb0b --- /dev/null +++ b/x/nameservice/client/testutil/query.go @@ -0,0 +1,585 @@ +package testutil + +import ( + "encoding/json" + "fmt" + "os" + "time" + + "github.com/cosmos/cosmos-sdk/client/flags" + clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" + sdk "github.com/cosmos/cosmos-sdk/types" + tmcli "github.com/tendermint/tendermint/libs/cli" + "github.com/tharsis/ethermint/x/nameservice/client/cli" + "github.com/tharsis/ethermint/x/nameservice/types" +) + +func (s *IntegrationTestSuite) TestGetCmdQueryParams() { + val := s.network.Validators[0] + sr := s.Require() + + testCases := []struct { + name string + args []string + }{ + { + "params", + []string{fmt.Sprintf("--%s=json", tmcli.OutputFlag)}, + }, + } + + for _, tc := range testCases { + s.Run(tc.name, func() { + cmd := cli.GetQueryParamsCmd() + clientCtx := val.ClientCtx + + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) + sr.NoError(err) + var param types.QueryParamsResponse + err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), ¶m) + sr.NoError(err) + params := types.DefaultParams() + params.RecordRent = sdk.NewCoin(s.cfg.BondDenom, types.DefaultRecordRent) + params.RecordRentDuration = 10 * time.Second + params.AuthorityGracePeriod = 10 * time.Second + sr.Equal(param.GetParams().String(), params.String()) + }) + } +} + +func (s *IntegrationTestSuite) TestGetCmdQueryForRecords() { + val := s.network.Validators[0] + sr := s.Require() + var recordID string + var bondId string + + testCases := []struct { + name string + args []string + expErr bool + noOfRecords int + preRun func() + }{ + { + "invalid request", + []string{"invalid", fmt.Sprintf("--%s=json", tmcli.OutputFlag)}, + true, + 0, + func() { + + }, + }, + { + "get records list", + []string{fmt.Sprintf("--%s=json", tmcli.OutputFlag)}, + false, + 1, + func() { + CreateBond(s) + // get the bond id from bond list + bondId := GetBondId(s) + dir, err := os.Getwd() + sr.NoError(err) + payloadPath := dir + "/example1.yml" + args := []string{ + payloadPath, bondId, + fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), + } + + clientCtx := val.ClientCtx + cmd := cli.GetCmdSetRecord() + + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) + sr.NoError(err) + var d sdk.TxResponse + err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d) + sr.NoError(err) + sr.Zero(d.Code) + }, + }, + } + + for _, tc := range testCases { + s.Run(tc.name, func() { + clientCtx := val.ClientCtx + if !tc.expErr { + tc.preRun() + } + cmd := cli.GetCmdList() + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) + if tc.expErr { + sr.Error(err) + } else { + sr.NoError(err) + var records []types.RecordType + err := json.Unmarshal(out.Bytes(), &records) + sr.NoError(err) + sr.Equal(tc.noOfRecords, len(records)) + recordID = records[0].Id + bondId = GetBondId(s) + } + }) + } + + s.T().Log("Test Cases for getting records by record-id") + testCasesByRecordID := []struct { + name string + args []string + expErr bool + }{ + { + "invalid request without record id", + []string{fmt.Sprintf("--%s=json", tmcli.OutputFlag)}, + true, + }, + { + "get records by id", + []string{recordID, fmt.Sprintf("--%s=json", tmcli.OutputFlag)}, + false, + }, + } + + for _, tc := range testCasesByRecordID { + s.Run(tc.name, func() { + cmd := cli.GetCmdGetResource() + clientCtx := val.ClientCtx + + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) + if tc.expErr { + sr.Error(err) + } else { + sr.NoError(err) + var response types.QueryRecordByIdResponse + err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response) + sr.NoError(err) + sr.NotNil(response.GetRecord()) + } + }) + } + + s.T().Log("Test Cases for getting records by bond-id") + testCasesByRecordByBondID := []struct { + name string + args []string + expErr bool + }{ + { + "invalid request without bond-id", + []string{fmt.Sprintf("--%s=json", tmcli.OutputFlag)}, + true, + }, + { + "get records by bond-id", + []string{bondId, fmt.Sprintf("--%s=json", tmcli.OutputFlag)}, + false, + }, + } + + for _, tc := range testCasesByRecordByBondID { + s.Run(tc.name, func() { + cmd := cli.GetCmdQueryByBond() + clientCtx := val.ClientCtx + + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) + if tc.expErr { + sr.Error(err) + } else { + sr.NoError(err) + var response types.QueryRecordByBondIdResponse + err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response) + sr.NoError(err) + } + }) + } + + s.T().Log("Test Cases for getting nameservice module account balance") + testCasesForNameServiceModuleBalance := []struct { + name string + args []string + expErr bool + noOfRecords int + }{ + { + "get nameservice module accounts balance", + []string{fmt.Sprintf("--%s=json", tmcli.OutputFlag)}, + false, + 1, + }, + } + + for _, tc := range testCasesForNameServiceModuleBalance { + s.Run(tc.name, func() { + cmd := cli.GetCmdBalance() + clientCtx := val.ClientCtx + + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) + if tc.expErr { + sr.Error(err) + } else { + sr.NoError(err) + var response types.GetNameServiceModuleBalanceResponse + err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response) + sr.NoError(err) + sr.Equal(tc.noOfRecords, len(response.GetBalances())) + balance := response.GetBalances()[0] + sr.Equal(balance.AccountName, types.RecordRentModuleAccountName) + } + }) + } +} + +func (s *IntegrationTestSuite) TestGetCmdWhoIs() { + val := s.network.Validators[0] + sr := s.Require() + var authorityName = "test2" + testCases := []struct { + name string + args []string + expErr bool + noOfRecords int + preRun func(authorityName string) + }{ + { + "invalid request without name", + []string{fmt.Sprintf("--%s=json", tmcli.OutputFlag)}, + true, + 1, + func(authorityName string) { + + }, + }, + { + "success query with name", + []string{authorityName, fmt.Sprintf("--%s=json", tmcli.OutputFlag)}, + false, + 1, + func(authorityName string) { + // reserving the name + clientCtx := val.ClientCtx + cmd := cli.GetCmdReserveName() + args := []string{ + authorityName, + fmt.Sprintf("--owner=%s", accountAddress), + fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), + } + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) + sr.NoError(err) + var d sdk.TxResponse + err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d) + sr.NoError(err) + sr.Zero(d.Code) + }, + }, + } + + for _, tc := range testCases { + s.Run(tc.name, func() { + if !tc.expErr { + tc.preRun(authorityName) + } + cmd := cli.GetCmdWhoIs() + clientCtx := val.ClientCtx + + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) + if tc.expErr { + sr.Error(err) + } else { + sr.NoError(err) + var response types.QueryWhoisResponse + err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response) + sr.NoError(err) + nameAuthority := response.GetNameAuthority() + nameAuthority.OwnerAddress = accountAddress + } + }) + } +} + +func (s *IntegrationTestSuite) TestGetCmdLookupCRN() { + val := s.network.Validators[0] + sr := s.Require() + var authorityName = "test1" + testCases := []struct { + name string + args []string + expErr bool + noOfRecords int + preRun func(authorityName string) + }{ + { + "invalid request without crn", + []string{fmt.Sprintf("--%s=json", tmcli.OutputFlag)}, + true, + 0, + func(authorityName string) { + + }, + }, + { + "success query with name", + []string{fmt.Sprintf("crn://%s/", authorityName), fmt.Sprintf("--%s=json", tmcli.OutputFlag)}, + false, + 1, + func(authorityName string) { + // reserving the name + createNameRecord(authorityName, s) + }, + }, + } + + for _, tc := range testCases { + s.Run(tc.name, func() { + if !tc.expErr { + // set-name with crn and bond-id + tc.preRun(authorityName) + } + cmd := cli.GetCmdLookupCRN() + clientCtx := val.ClientCtx + + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) + if tc.expErr { + sr.Error(err) + } else { + sr.NoError(err) + var response types.QueryLookupCrnResponse + err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response) + sr.NoError(err) + nameRecord := response.GetName() + sr.NotNil(nameRecord.Latest.Id) + } + }) + } + + testCasesForNamesList := []struct { + name string + args []string + expErr bool + noOfRecords int + }{ + { + "invalid request without crn", + []string{"invalid", fmt.Sprintf("--%s=json", tmcli.OutputFlag)}, + true, + 0, + }, + { + "success query with name", + []string{fmt.Sprintf("--%s=json", tmcli.OutputFlag)}, + false, + 1, + }, + } + + for _, tc := range testCasesForNamesList { + s.Run(tc.name, func() { + cmd := cli.GetCmdNames() + clientCtx := val.ClientCtx + + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) + if tc.expErr { + sr.Error(err) + } else { + sr.NoError(err) + var response types.QueryListNameRecordsResponse + err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response) + sr.NoError(err) + sr.NotZero(len(response.GetNames())) + } + }) + } +} + +func (s *IntegrationTestSuite) GetRecordExpiryQueue() { + val := s.network.Validators[0] + sr := s.Require() + var authorityName = "GetRecordExpiryQueue" + + testCasesForRecordsExpiry := []struct { + name string + args []string + expErr bool + noOfRecords int + preRun func(authorityName string, s *IntegrationTestSuite) + }{ + { + "invalid request", + []string{"invalid", fmt.Sprintf("--%s=json", tmcli.OutputFlag)}, + true, + 0, + func(authorityName string, s *IntegrationTestSuite) { + + }, + }, + { + "get expiry records ", + []string{fmt.Sprintf("--%s=json", tmcli.OutputFlag)}, + false, + 1, + func(authorityName string, s *IntegrationTestSuite) { + createNameRecord(authorityName, s) + }, + }, + } + + for _, tc := range testCasesForRecordsExpiry { + s.Run(tc.name, func() { + if !tc.expErr { + tc.preRun(authorityName, s) + time.Sleep(time.Second * 12) + } + cmd := cli.GetRecordExpiryQueue() + clientCtx := val.ClientCtx + + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) + if tc.expErr { + sr.Error(err) + } else { + sr.NoError(err) + var response types.QueryGetRecordExpiryQueueResponse + err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response) + sr.NoError(err) + sr.Equal(tc.noOfRecords, len(response.GetRecords())) + } + }) + } +} +func (s *IntegrationTestSuite) TestGetAuthorityExpiryQueue() { + val := s.network.Validators[0] + sr := s.Require() + var authorityName = "TestGetAuthorityExpiryQueue" + + testCases := []struct { + name string + args []string + expErr bool + preRun func(authorityName string) + }{ + { + "invalid request without name", + []string{"invalid", fmt.Sprintf("--%s=json", tmcli.OutputFlag)}, + true, + func(authorityName string) { + + }, + }, + { + "success query", + []string{fmt.Sprintf("--%s=json", tmcli.OutputFlag)}, + false, + func(authorityName string) { + // reserving the name + clientCtx := val.ClientCtx + cmd := cli.GetCmdReserveName() + args := []string{ + authorityName, + fmt.Sprintf("--owner=%s", accountAddress), + fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), + } + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) + sr.NoError(err) + var d sdk.TxResponse + err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d) + sr.NoError(err) + sr.Zero(d.Code) + }, + }, + } + + for _, tc := range testCases { + s.Run(tc.name, func() { + if !tc.expErr { + tc.preRun(authorityName) + time.Sleep(time.Second * 6) + } + cmd := cli.GetAuthorityExpiryQueue() + clientCtx := val.ClientCtx + + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) + if tc.expErr { + sr.Error(err) + } else { + sr.NoError(err) + var response types.QueryGetAuthorityExpiryQueueResponse + err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response) + sr.NoError(err) + sr.NotZero(len(response.GetAuthorities())) + } + }) + } +} + +func createNameRecord(authorityName string, s *IntegrationTestSuite) { + val := s.network.Validators[0] + sr := s.Require() + // reserving the name + clientCtx := val.ClientCtx + cmd := cli.GetCmdReserveName() + args := []string{ + authorityName, + fmt.Sprintf("--owner=%s", accountAddress), + fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), + } + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) + sr.NoError(err) + var d sdk.TxResponse + err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d) + sr.NoError(err) + sr.Zero(d.Code) + + // creating the bond + CreateBond(s) + + // Get the bond-id + bondId := GetBondId(s) + + // adding bond-id to name authority + args = []string{ + authorityName, bondId, + fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), + } + cmd = cli.GetCmdSetAuthorityBond() + + out, err = clitestutil.ExecTestCLICmd(clientCtx, cmd, args) + sr.NoError(err) + err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d) + sr.NoError(err) + sr.Zero(d.Code) + + args = []string{ + fmt.Sprintf("crn://%s/", authorityName), + "test_hello_cid", + fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), + } + + cmd = cli.GetCmdSetName() + + out, err = clitestutil.ExecTestCLICmd(clientCtx, cmd, args) + sr.NoError(err) + err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d) + sr.NoError(err) + sr.Zero(d.Code) +} diff --git a/x/nameservice/client/testutil/tx.go b/x/nameservice/client/testutil/tx.go new file mode 100644 index 00000000..d45ecd9b --- /dev/null +++ b/x/nameservice/client/testutil/tx.go @@ -0,0 +1,913 @@ +package testutil + +import ( + "encoding/json" + "fmt" + "os" + "time" + + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/crypto/hd" + "github.com/cosmos/cosmos-sdk/crypto/keyring" + "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" + clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" + sdk "github.com/cosmos/cosmos-sdk/types" + banktestutil "github.com/cosmos/cosmos-sdk/x/bank/client/testutil" + "github.com/stretchr/testify/suite" + tmcli "github.com/tendermint/tendermint/libs/cli" + "github.com/tharsis/ethermint/testutil/network" + bondcli "github.com/tharsis/ethermint/x/bond/client/cli" + "github.com/tharsis/ethermint/x/bond/types" + "github.com/tharsis/ethermint/x/nameservice/client/cli" + nstypes "github.com/tharsis/ethermint/x/nameservice/types" +) + +var ( + accountName = "accountName" + accountAddress string +) + +type IntegrationTestSuite struct { + suite.Suite + + cfg network.Config + network *network.Network + bondId string +} + +func NewIntegrationTestSuite(cfg network.Config) *IntegrationTestSuite { + return &IntegrationTestSuite{cfg: cfg} +} + +func (s *IntegrationTestSuite) SetupSuite() { + s.T().Log("setting up integration test suite") + + var genesisState = s.cfg.GenesisState + var nsData nstypes.GenesisState + s.Require().NoError(s.cfg.Codec.UnmarshalJSON(genesisState[nstypes.ModuleName], &nsData)) + + nsData.Params.RecordRent = sdk.NewCoin(s.cfg.BondDenom, nstypes.DefaultRecordRent) + nsData.Params.RecordRentDuration = 10 * time.Second + nsData.Params.AuthorityGracePeriod = 10 * time.Second + nsDataBz, err := s.cfg.Codec.MarshalJSON(&nsData) + s.Require().NoError(err) + genesisState[nstypes.ModuleName] = nsDataBz + s.cfg.GenesisState = genesisState + + s.network, err = network.New(s.T(), s.T().TempDir(), s.cfg) + s.Require().NoError(err) + + _, err = s.network.WaitForHeight(2) + s.Require().NoError(err) + + // setting up random account + s.createAccountWithBalance(accountName) + CreateBond(s) + s.bondId = GetBondId(s) +} + +func (s *IntegrationTestSuite) createAccountWithBalance(accountName string) { + val := s.network.Validators[0] + sr := s.Require() + consPrivKey := ed25519.GenPrivKey() + consPubKeyBz, err := s.cfg.Codec.MarshalInterfaceJSON(consPrivKey.PubKey()) + sr.NoError(err) + sr.NotNil(consPubKeyBz) + + info, _, err := val.ClientCtx.Keyring.NewMnemonic(accountName, keyring.English, sdk.FullFundraiserPath, keyring.DefaultBIP39Passphrase, hd.Secp256k1) + sr.NoError(err) + + // account key + newAddr := sdk.AccAddress(info.GetPubKey().Address()) + _, err = banktestutil.MsgSendExec( + val.ClientCtx, + val.Address, + newAddr, + sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(1000000000000000000))), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), + ) + sr.NoError(err) + accountAddress = newAddr.String() +} + +func (s *IntegrationTestSuite) TearDownSuite() { + s.T().Log("tearing down integration test suite") + s.network.Cleanup() +} + +func CreateBond(s *IntegrationTestSuite) { + val := s.network.Validators[0] + sr := s.Require() + + testCases := []struct { + name string + args []string + err bool + }{ + { + "create bond", + []string{ + fmt.Sprintf("100000000000%s", s.cfg.BondDenom), + fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), + }, + false, + }, + } + + for _, tc := range testCases { + s.Run(fmt.Sprintf("Case %s", tc.name), func() { + clientCtx := val.ClientCtx + cmd := bondcli.NewCreateBondCmd() + + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) + if tc.err { + sr.Error(err) + } else { + sr.NoError(err) + var d sdk.TxResponse + err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d) + sr.NoError(err) + sr.Zero(d.Code) + } + }) + } +} + +func GetBondId(s *IntegrationTestSuite) string { + cmd := bondcli.GetQueryBondLists() + val := s.network.Validators[0] + sr := s.Require() + clientCtx := val.ClientCtx + + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, []string{fmt.Sprintf("--%s=json", tmcli.OutputFlag)}) + sr.NoError(err) + var queryResponse types.QueryGetBondsResponse + err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &queryResponse) + sr.NoError(err) + + // extract bond id from bonds list + bond := queryResponse.GetBonds()[0] + return bond.GetId() +} + +func (s *IntegrationTestSuite) TestGetCmdSetRecord() { + val := s.network.Validators[0] + sr := s.Require() + + testCases := []struct { + name string + args []string + err bool + }{ + { + "invalid request without bond id/without payload", + []string{ + fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), + }, + true, + }, + { + "success", + []string{ + fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), + }, + false, + }, + } + + for _, tc := range testCases { + s.Run(fmt.Sprintf("Case %s", tc.name), func() { + if !tc.err { + // create the bond + CreateBond(s) + // get the bond id from bond list + bondId := GetBondId(s) + dir, err := os.Getwd() + sr.NoError(err) + payloadPath := dir + "/example1.yml" + + tc.args = append([]string{payloadPath, bondId}, tc.args...) + } + clientCtx := val.ClientCtx + cmd := cli.GetCmdSetRecord() + + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) + if tc.err { + sr.Error(err) + } else { + sr.NoError(err) + var d sdk.TxResponse + err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d) + sr.NoError(err) + sr.Zero(d.Code) + } + }) + } +} + +func (s *IntegrationTestSuite) TestGetCmdReserveName() { + val := s.network.Validators[0] + sr := s.Require() + var authorityName = "testtest" + testCases := []struct { + name string + args []string + err bool + }{ + { + "invalid request without name", + []string{ + fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), + }, + true, + }, + { + "success for parent name", + []string{ + authorityName, + fmt.Sprintf("--owner=%s", accountAddress), + fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), + }, + false, + }, + { + "success for sub domains", + []string{ + "sub." + authorityName, + fmt.Sprintf("--owner=%s", accountAddress), + fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), + }, + false, + }, + } + + for _, tc := range testCases { + s.Run(fmt.Sprintf("Case %s", tc.name), func() { + clientCtx := val.ClientCtx + cmd := cli.GetCmdReserveName() + + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) + if tc.err { + sr.Error(err) + } else { + sr.NoError(err) + var d sdk.TxResponse + err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d) + sr.NoError(err) + sr.Zero(d.Code) + } + }) + } +} + +func (s *IntegrationTestSuite) TestGetCmdSetName() { + val := s.network.Validators[0] + sr := s.Require() + var authorityName = "TestGetCmdSetName" + testCases := []struct { + name string + args []string + err bool + preRun func(authorityName string) + }{ + { + "invalid request without name", + []string{ + fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), + }, + true, + func(authorityName string) { + + }, + }, + { + "success", + []string{ + fmt.Sprintf("crn://%s/", authorityName), + "test_hello_cid", + fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), + }, + false, + func(authorityName string) { + // reserving the name + clientCtx := val.ClientCtx + cmd := cli.GetCmdReserveName() + args := []string{ + authorityName, + fmt.Sprintf("--owner=%s", accountAddress), + fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), + } + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) + sr.NoError(err) + var d sdk.TxResponse + err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d) + sr.NoError(err) + sr.Zero(d.Code) + + // creating the bond + CreateBond(s) + + // Get the bond-id + bondId := GetBondId(s) + + // adding bond-id to name authority + args = []string{ + authorityName, bondId, + fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), + } + cmd = cli.GetCmdSetAuthorityBond() + + out, err = clitestutil.ExecTestCLICmd(clientCtx, cmd, args) + sr.NoError(err) + err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d) + sr.NoError(err) + sr.Zero(d.Code) + }, + }, + } + + for _, tc := range testCases { + s.Run(fmt.Sprintf("Case %s", tc.name), func() { + if !tc.err { + tc.preRun(authorityName) + } + + clientCtx := val.ClientCtx + cmd := cli.GetCmdSetName() + + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) + if tc.err { + sr.Error(err) + } else { + sr.NoError(err) + var d sdk.TxResponse + err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d) + sr.NoError(err) + sr.Zero(d.Code) + } + }) + } +} + +func (s *IntegrationTestSuite) TestGetCmdSetAuthorityBond() { + val := s.network.Validators[0] + sr := s.Require() + var authorityName = "TestGetCmdSetAuthorityBond" + + testCases := []struct { + name string + args []string + err bool + preRun func(authorityName string) + }{ + { + "invalid request without name", + []string{ + fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), + }, + true, + func(authorityName string) { + + }, + }, + { + "success with name and bond-id", + []string{ + fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), + }, + false, + func(authorityName string) { + // reserving the name + clientCtx := val.ClientCtx + cmd := cli.GetCmdReserveName() + args := []string{ + authorityName, + fmt.Sprintf("--owner=%s", accountAddress), + fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), + } + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) + sr.NoError(err) + var d sdk.TxResponse + err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d) + sr.NoError(err) + sr.Zero(d.Code) + }, + }, + } + + for _, tc := range testCases { + s.Run(fmt.Sprintf("Case %s", tc.name), func() { + if !tc.err { + // reserve the name + tc.preRun(authorityName) + // creating the bond + CreateBond(s) + // getting the bond-id + bondId := GetBondId(s) + tc.args = append([]string{authorityName, bondId}, tc.args...) + } + clientCtx := val.ClientCtx + cmd := cli.GetCmdSetAuthorityBond() + + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) + if tc.err { + sr.Error(err) + } else { + sr.NoError(err) + var d sdk.TxResponse + err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d) + sr.NoError(err) + sr.Zero(d.Code) + } + }) + } +} + +func (s *IntegrationTestSuite) TestGetCmdDeleteName() { + val := s.network.Validators[0] + sr := s.Require() + var authorityName = "TestGetCmdDeleteName" + testCasesForDeletingName := []struct { + name string + args []string + err bool + preRun func(authorityName string, s *IntegrationTestSuite) + }{ + { + "invalid request without crn", + []string{ + fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), + }, + true, + func(authorityName string, s *IntegrationTestSuite) { + + }, + }, + { + "successfully delete name", + []string{ + fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), + }, + false, + func(authorityName string, s *IntegrationTestSuite) { + createNameRecord(authorityName, s) + }, + }, + } + + for _, tc := range testCasesForDeletingName { + s.Run(fmt.Sprintf("Case %s", tc.name), func() { + if !tc.err { + tc.preRun(authorityName, s) + tc.args = append([]string{fmt.Sprintf("crn://%s/", authorityName)}, tc.args...) + } + clientCtx := val.ClientCtx + cmd := cli.GetCmdDeleteName() + + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) + if tc.err { + sr.Error(err) + } else { + sr.NoError(err) + var d sdk.TxResponse + err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d) + sr.NoError(err) + sr.Zero(d.Code) + } + }) + } +} + +func (s *IntegrationTestSuite) TestGetCmdDissociateBond() { + val := s.network.Validators[0] + sr := s.Require() + testCasesForDeletingName := []struct { + name string + args []string + err bool + preRun func(s *IntegrationTestSuite) string + postRun func(recordId string, s *IntegrationTestSuite) + }{ + { + "invalid request without crn", + []string{ + fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), + }, + true, + func(s *IntegrationTestSuite) string { + return "" + }, + func(recordId string, s *IntegrationTestSuite) { + + }, + }, + { + "successfully dissociate bond-id from record ", + []string{ + fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), + }, + false, + func(s *IntegrationTestSuite) string { + // create the bond + CreateBond(s) + // get the bond id from bond list + bondId := GetBondId(s) + dir, err := os.Getwd() + sr.NoError(err) + payloadPath := dir + "/example1.yml" + + args := []string{ + payloadPath, bondId, + fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), + } + + clientCtx := val.ClientCtx + cmd := cli.GetCmdSetRecord() + + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) + sr.NoError(err) + var d sdk.TxResponse + err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d) + sr.NoError(err) + sr.Zero(d.Code) + + // retrieving the record-id + args = []string{fmt.Sprintf("--%s=json", tmcli.OutputFlag)} + cmd = cli.GetCmdList() + out, err = clitestutil.ExecTestCLICmd(clientCtx, cmd, args) + sr.NoError(err) + var records []nstypes.RecordType + err = json.Unmarshal(out.Bytes(), &records) + sr.NoError(err) + return records[0].Id + }, + func(recordId string, s *IntegrationTestSuite) { + // checking the bond-id removed or not + clientCtx := val.ClientCtx + args := []string{recordId, fmt.Sprintf("--%s=json", tmcli.OutputFlag)} + cmd := cli.GetCmdGetResource() + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) + sr.NoError(err) + var response nstypes.QueryRecordByIdResponse + err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response) + sr.NoError(err) + record := response.GetRecord() + sr.NotNil(record) + sr.Zero(len(record.GetBondId())) + }, + }, + } + + for _, tc := range testCasesForDeletingName { + s.Run(fmt.Sprintf("Case %s", tc.name), func() { + var recordId string + if !tc.err { + recordId = tc.preRun(s) + tc.args = append([]string{recordId}, tc.args...) + } + clientCtx := val.ClientCtx + cmd := cli.GetCmdDissociateBond() + + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) + if tc.err { + sr.Error(err) + } else { + sr.NoError(err) + var d sdk.TxResponse + err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d) + sr.NoError(err) + sr.Zero(d.Code) + // post-run + tc.postRun(recordId, s) + } + }) + } +} + +// +//func (s *IntegrationTestSuite) TestGetCmdDissociateRecords() { +// val := s.network.Validators[0] +// sr := s.Require() +// testCasesForDeletingName := []struct { +// name string +// args []string +// err bool +// preRun func(s *IntegrationTestSuite) (string, string) +// postRun func(recordId string, s *IntegrationTestSuite) +// }{ +// { +// "invalid request without crn", +// []string{ +// fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), +// fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), +// fmt.Sprintf("--%s=json", tmcli.OutputFlag), +// fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), +// fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), +// }, +// true, +// func(s *IntegrationTestSuite) (string, string) { +// return "", "" +// }, +// func(recordId string, s *IntegrationTestSuite) { +// +// }, +// }, +// { +// "successfully dissociate records from bond-id", +// []string{ +// fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), +// fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), +// fmt.Sprintf("--%s=json", tmcli.OutputFlag), +// fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), +// fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), +// }, +// false, +// func(s *IntegrationTestSuite) (string, string) { +// // create the bond +// CreateBond(s) +// // get the bond id from bond list +// bondId := GetBondId(s) +// dir, err := os.Getwd() +// sr.NoError(err) +// payloadPath := dir + "/example1.yml" +// +// args := []string{ +// payloadPath, bondId, +// fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), +// fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), +// fmt.Sprintf("--%s=json", tmcli.OutputFlag), +// fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), +// fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), +// } +// +// clientCtx := val.ClientCtx +// cmd := cli.GetCmdSetRecord() +// +// out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) +// sr.NoError(err) +// var d sdk.TxResponse +// err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d) +// sr.NoError(err) +// sr.Zero(d.Code) +// +// // retrieving the record-id +// args = []string{fmt.Sprintf("--%s=json", tmcli.OutputFlag)} +// cmd = cli.GetCmdList() +// out, err = clitestutil.ExecTestCLICmd(clientCtx, cmd, args) +// sr.NoError(err) +// var records []nstypes.RecordType +// err = json.Unmarshal(out.Bytes(), &records) +// sr.NoError(err) +// for _, record := range records { +// if len(record.BondId) != 0 { +// return record.Id, record.BondId +// } +// } +// return records[0].Id, records[0].BondId +// }, +// func(recordId string, s *IntegrationTestSuite) { +// // checking the bond-id removed or not +// clientCtx := val.ClientCtx +// args := []string{recordId, fmt.Sprintf("--%s=json", tmcli.OutputFlag)} +// cmd := cli.GetCmdGetResource() +// out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) +// sr.NoError(err) +// var response nstypes.QueryRecordByIdResponse +// err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response) +// sr.NoError(err) +// record := response.GetRecord() +// sr.NotNil(record) +// sr.Zero(len(record.GetBondId())) +// }, +// }, +// } +// +// for _, tc := range testCasesForDeletingName { +// s.Run(fmt.Sprintf("Case %s", tc.name), func() { +// var bondId string +// var recordId string +// if !tc.err { +// recordId, bondId = tc.preRun(s) +// tc.args = append([]string{bondId}, tc.args...) +// } +// clientCtx := val.ClientCtx +// cmd := cli.GetCmdDissociateRecords() +// +// out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) +// if tc.err { +// sr.Error(err) +// } else { +// sr.NoError(err) +// var d sdk.TxResponse +// err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d) +// sr.NoError(err) +// sr.Zero(d.Code) +// // post-run +// tc.postRun(recordId, s) +// } +// }) +// } +//} + +func (s *IntegrationTestSuite) TestGetCmdAssociateBond() { + val := s.network.Validators[0] + sr := s.Require() + testCasesForDeletingName := []struct { + name string + args []string + err bool + preRun func(s *IntegrationTestSuite) (string, string) + postRun func(recordId, bondId string, s *IntegrationTestSuite) + }{ + { + "invalid request without crn", + []string{ + fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), + }, + true, + func(s *IntegrationTestSuite) (string, string) { + return "", "" + }, + func(recordId, bondId string, s *IntegrationTestSuite) { + + }, + }, + { + "successfully dissociate records from bond-id", + []string{ + fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), + }, + false, + func(s *IntegrationTestSuite) (string, string) { + // create the bond + CreateBond(s) + // get the bond id from bond list + bondId := GetBondId(s) + dir, err := os.Getwd() + sr.NoError(err) + payloadPath := dir + "/example1.yml" + + txArgs := []string{ + payloadPath, bondId, + fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)), + } + + clientCtx := val.ClientCtx + cmd := cli.GetCmdSetRecord() + + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, txArgs) + sr.NoError(err) + var d sdk.TxResponse + err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d) + sr.NoError(err) + sr.Zero(d.Code) + + // retrieving the record-id + args := []string{fmt.Sprintf("--%s=json", tmcli.OutputFlag)} + cmd = cli.GetCmdList() + out, err = clitestutil.ExecTestCLICmd(clientCtx, cmd, args) + sr.NoError(err) + var records []nstypes.RecordType + err = json.Unmarshal(out.Bytes(), &records) + sr.NoError(err) + + // GetCmdDissociateBond bond + cmd = cli.GetCmdDissociateBond() + txArgs = append([]string{records[0].Id}, txArgs[2:]...) + out, err = clitestutil.ExecTestCLICmd(clientCtx, cmd, txArgs) + sr.NoError(err) + err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d) + sr.NoError(err) + sr.Zero(d.Code) + + return records[0].Id, records[0].BondId + }, + func(recordId, bondId string, s *IntegrationTestSuite) { + // checking the bond-id removed or not + clientCtx := val.ClientCtx + args := []string{recordId, fmt.Sprintf("--%s=json", tmcli.OutputFlag)} + cmd := cli.GetCmdGetResource() + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) + sr.NoError(err) + var response nstypes.QueryRecordByIdResponse + err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response) + sr.NoError(err) + record := response.GetRecord() + sr.NotNil(record) + sr.Equal(record.GetBondId(), bondId) + }, + }, + } + + for _, tc := range testCasesForDeletingName { + s.Run(fmt.Sprintf("Case %s", tc.name), func() { + var recordId string + var bondId string + if !tc.err { + recordId, bondId = tc.preRun(s) + tc.args = append([]string{recordId, bondId}, tc.args...) + } + clientCtx := val.ClientCtx + cmd := cli.GetCmdAssociateBond() + + out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) + if tc.err { + sr.Error(err) + } else { + sr.NoError(err) + var d sdk.TxResponse + err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d) + sr.NoError(err) + sr.Zero(d.Code) + // post-run + tc.postRun(recordId, bondId, s) + } + }) + } +} diff --git a/x/nameservice/genesis.go b/x/nameservice/genesis.go new file mode 100644 index 00000000..040eea5a --- /dev/null +++ b/x/nameservice/genesis.go @@ -0,0 +1,79 @@ +package nameservice + +import ( + "time" + + sdk "github.com/cosmos/cosmos-sdk/types" + abci "github.com/tendermint/tendermint/abci/types" + "github.com/tharsis/ethermint/x/nameservice/keeper" + "github.com/tharsis/ethermint/x/nameservice/types" +) + +func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, data types.GenesisState) []abci.ValidatorUpdate { + keeper.SetParams(ctx, data.Params) + + for _, record := range data.Records { + keeper.PutRecord(ctx, record) + + // Add to record expiry queue if expiry time is in the future. + expiryTime, err := time.Parse(time.RFC3339, record.ExpiryTime) + + if err != nil { + panic(err) + } + + if expiryTime.After(ctx.BlockTime()) { + keeper.InsertRecordExpiryQueue(ctx, record) + } + + // Note: Bond genesis runs first, so bonds will already be present. + if record.BondId != "" { + keeper.AddBondToRecordIndexEntry(ctx, record.BondId, record.Id) + } + } + + for _, authority := range data.Authorities { + //Only import authorities that are marked active. + if authority.Entry.Status == types.AuthorityActive { + keeper.SetNameAuthority(ctx, authority.Name, authority.Entry) + + // Add authority name to expiry queue. + keeper.InsertAuthorityExpiryQueue(ctx, authority.Name, authority.Entry.ExpiryTime) + + // Note: Bond genesis runs first, so bonds will already be present. + if authority.Entry.BondId != "" { + keeper.AddBondToAuthorityIndexEntry(ctx, authority.Entry.BondId, authority.Name) + } + } + } + + for _, nameEntry := range data.Names { + keeper.SetNameRecord(ctx, nameEntry.Name, nameEntry.Entry.Latest.Id) + } + + return []abci.ValidatorUpdate{} +} + +func ExportGenesis(ctx sdk.Context, keeper keeper.Keeper) types.GenesisState { + params := keeper.GetParams(ctx) + + records := keeper.ListRecords(ctx) + + authorities := keeper.ListNameAuthorityRecords(ctx) + var authorityEntries []types.AuthorityEntry + for name, record := range authorities { + authorityEntries = append(authorityEntries, types.AuthorityEntry{ + Name: name, + Entry: &record, + }) + } + + names := keeper.ListNameRecords(ctx) + + return types.GenesisState{ + Params: params, + Records: records, + Authorities: authorityEntries, + Names: names, + } +} diff --git a/x/nameservice/helpers/examples/example1.yml b/x/nameservice/helpers/examples/example1.yml new file mode 100644 index 00000000..3f7b4863 --- /dev/null +++ b/x/nameservice/helpers/examples/example1.yml @@ -0,0 +1,7 @@ +record: + attr1: value1 + attr2: value2 + link1: + /: QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D + link2: + /: QmP8jTG1m9GSDJLCbeWhVSVgEzCPPwXRdCRuJtQ5Tz9Kc9 diff --git a/x/nameservice/helpers/helpers.go b/x/nameservice/helpers/helpers.go new file mode 100644 index 00000000..2864315f --- /dev/null +++ b/x/nameservice/helpers/helpers.go @@ -0,0 +1,144 @@ +package helpers + +import ( + "bytes" + "encoding/base64" + "encoding/binary" + "encoding/gob" + "encoding/hex" + "encoding/json" + set "github.com/deckarep/golang-set" + cbor "github.com/ipfs/go-ipld-cbor" + mh "github.com/multiformats/go-multihash" + + "sort" +) + +func StringToBytes(val string) []byte { + return []byte(val) +} + +func BytesToString(val []byte) string { + return string(val) +} + +func StrArrToBytesArr(val []string) ([]byte, error) { + buffer := &bytes.Buffer{} + + err := gob.NewEncoder(buffer).Encode(val) + if err != nil { + return nil, err + } + return buffer.Bytes(), nil +} + +func BytesArrToStringArr(val []byte) ([]string, error) { + buffer := bytes.NewReader(val) + var v []string + err := gob.NewDecoder(buffer).Decode(&v) + if err != nil { + return nil, err + } + return v, nil +} + +func Int64ToBytes(num int64) []byte { + buf := new(bytes.Buffer) + binary.Write(buf, binary.BigEndian, num) + return buf.Bytes() +} + +// MarshalMapToJSONBytes converts map[string]interface{} to bytes. +func MarshalMapToJSONBytes(val map[string]interface{}) (bytes []byte) { + bytes, err := json.Marshal(val) + if err != nil { + panic("Marshal error.") + } + + return +} + +// UnMarshalMapFromJSONBytes converts bytes to map[string]interface{}. +func UnMarshalMapFromJSONBytes(bytes []byte) map[string]interface{} { + var val map[string]interface{} + err := json.Unmarshal(bytes, &val) + + if err != nil { + panic("Marshal error.") + } + + return val +} + +// GetCid gets the content ID. +func GetCid(content []byte) (string, error) { + node, err := cbor.FromJSON(bytes.NewReader(content), mh.SHA2_256, -1) + if err != nil { + return "", err + } + + return node.Cid().String(), nil +} + +// BytesToBase64 encodes a byte array as a base64 string. +func BytesToBase64(bytes []byte) string { + return base64.StdEncoding.EncodeToString(bytes) +} + +// BytesFromBase64 decodes a byte array from a base64 string. +func BytesFromBase64(str string) []byte { + bytes, err := base64.StdEncoding.DecodeString(str) + if err != nil { + panic("Error decoding string to bytes.") + } + + return bytes +} + +// BytesToHex encodes a byte array as a hex string. +func BytesToHex(bytes []byte) string { + return hex.EncodeToString(bytes) +} + +// BytesFromHex decodes a byte array from a hex string. +func BytesFromHex(str string) []byte { + bytes, err := hex.DecodeString(str) + if err != nil { + panic("Error decoding hex to bytes.") + } + + return bytes +} + +func SetToSlice(set set.Set) []string { + names := []string{} + + for name := range set.Iter() { + if name, ok := name.(string); ok && name != "" { + names = append(names, name) + } + } + + sort.SliceStable(names, func(i, j int) bool { return names[i] < names[j] }) + + return names +} + +func SliceToSet(names []string) set.Set { + set := set.NewThreadUnsafeSet() + + for _, name := range names { + if name != "" { + set.Add(name) + } + } + + return set +} + +func AppendUnique(list []string, element string) []string { + set := SliceToSet(list) + set.Add(element) + + return SetToSlice(set) +} diff --git a/x/nameservice/keeper/grpc_query.go b/x/nameservice/keeper/grpc_query.go new file mode 100644 index 00000000..35620223 --- /dev/null +++ b/x/nameservice/keeper/grpc_query.go @@ -0,0 +1,227 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/tharsis/ethermint/x/nameservice/types" +) + +// BondIDAttributeName denotes the record bond ID. +const BondIDAttributeName = "bondId" + +// ExpiryTimeAttributeName denotes the record expiry time. +const ExpiryTimeAttributeName = "expiryTime" + +type Querier struct { + Keeper +} + +var _ types.QueryServer = Querier{} + +func (q Querier) Params(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + params := q.Keeper.GetParams(ctx) + return &types.QueryParamsResponse{Params: ¶ms}, nil +} + +func (q Querier) ListRecords(c context.Context, req *types.QueryListRecordsRequest) (*types.QueryListRecordsResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + attributes := req.GetAttributes() + all := req.GetAll() + records := []types.Record{} + + if len(attributes) > 0 { + records = q.Keeper.MatchRecords(ctx, func(record *types.RecordType) bool { + return MatchOnAttributes(record, attributes, all) + }) + } else { + records = q.Keeper.ListRecords(ctx) + } + + return &types.QueryListRecordsResponse{Records: records}, nil +} + +func (q Querier) GetRecord(c context.Context, req *types.QueryRecordByIdRequest) (*types.QueryRecordByIdResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + id := req.GetId() + if !q.Keeper.HasRecord(ctx, id) { + return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, "Record not found.") + } + record := q.Keeper.GetRecord(ctx, id) + return &types.QueryRecordByIdResponse{Record: record}, nil +} + +func (q Querier) GetRecordByBondId(c context.Context, req *types.QueryRecordByBondIdRequest) (*types.QueryRecordByBondIdResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + records := q.recordKeeper.QueryRecordsByBond(ctx, req.GetId()) + return &types.QueryRecordByBondIdResponse{Records: records}, nil +} + +func (q Querier) GetNameServiceModuleBalance(c context.Context, _ *types.GetNameServiceModuleBalanceRequest) (*types.GetNameServiceModuleBalanceResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + balances := q.Keeper.GetModuleBalances(ctx) + return &types.GetNameServiceModuleBalanceResponse{ + Balances: balances, + }, nil +} + +func (q Querier) ListNameRecords(c context.Context, _ *types.QueryListNameRecordsRequest) (*types.QueryListNameRecordsResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + nameRecords := q.Keeper.ListNameRecords(ctx) + return &types.QueryListNameRecordsResponse{Names: nameRecords}, nil +} + +func (q Querier) Whois(c context.Context, request *types.QueryWhoisRequest) (*types.QueryWhoisResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + nameAuthority := q.Keeper.GetNameAuthority(ctx, request.GetName()) + return &types.QueryWhoisResponse{NameAuthority: nameAuthority}, nil +} + +func (q Querier) LookupCrn(c context.Context, req *types.QueryLookupCrn) (*types.QueryLookupCrnResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + crn := req.GetCrn() + if !q.Keeper.HasNameRecord(ctx, crn) { + return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, "CRN not found.") + } + nameRecord := q.Keeper.GetNameRecord(ctx, crn) + if nameRecord == nil { + return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, "name record not found.") + } + return &types.QueryLookupCrnResponse{Name: nameRecord}, nil +} + +func (q Querier) ResolveCrn(c context.Context, req *types.QueryResolveCrn) (*types.QueryResolveCrnResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + crn := req.GetCrn() + record := q.Keeper.ResolveCRN(ctx, crn) + if record == nil { + return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, "record not found.") + } + return &types.QueryResolveCrnResponse{Record: record}, nil +} + +func (q Querier) GetRecordExpiryQueue(c context.Context, _ *types.QueryGetRecordExpiryQueue) (*types.QueryGetRecordExpiryQueueResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + records := q.Keeper.GetRecordExpiryQueue(ctx) + return &types.QueryGetRecordExpiryQueueResponse{Records: records}, nil +} + +func (q Querier) GetAuthorityExpiryQueue(c context.Context, _ *types.QueryGetAuthorityExpiryQueue) (*types.QueryGetAuthorityExpiryQueueResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + authorities := q.Keeper.GetAuthorityExpiryQueue(ctx) + return &types.QueryGetAuthorityExpiryQueueResponse{Authorities: authorities}, nil +} + +func matchOnRecordField(record *types.RecordType, attr *types.QueryListRecordsRequest_KeyValueInput) (fieldFound bool, matched bool) { + fieldFound = false + matched = true + + switch attr.Key { + case BondIDAttributeName: + { + fieldFound = true + if record.BondId != attr.Value.GetString_() { + matched = false + return + } + } + case ExpiryTimeAttributeName: + { + fieldFound = true + if record.ExpiryTime != attr.Value.GetString_() { + matched = false + return + } + } + } + + return +} + +func MatchOnAttributes(record *types.RecordType, attributes []*types.QueryListRecordsRequest_KeyValueInput, all bool) bool { + // Filter deleted records. + if record.Deleted { + return false + } + + // If ONLY named records are requested, check for that condition first. + if !all && len(record.Names) == 0 { + return false + } + + recAttrs := record.Attributes + + for _, attr := range attributes { + // First try matching on record struct fields. + fieldFound, matched := matchOnRecordField(record, attr) + + if fieldFound { + if !matched { + return false + } + + continue + } + + recAttrVal, recAttrFound := recAttrs[attr.Key] + if !recAttrFound { + return false + } + + if attr.Value.Type == "int" { + recAttrValInt, ok := recAttrVal.(int) + if !ok || int(attr.Value.GetInt()) != recAttrValInt { + return false + } + } + + if attr.Value.Type == "float" { + recAttrValFloat, ok := recAttrVal.(float64) + if !ok || attr.Value.GetFloat() != recAttrValFloat { + return false + } + } + + if attr.Value.Type == "string" { + recAttrValString, ok := recAttrVal.(string) + if !ok { + return false + } + + if attr.Value.GetString_() != recAttrValString { + return false + } + } + + if attr.Value.Type == "boolean" { + recAttrValBool, ok := recAttrVal.(bool) + if !ok || attr.Value.GetBoolean() != recAttrValBool { + return false + } + } + + if attr.Value.Type == "reference" { + obj, ok := recAttrVal.(map[string]interface{}) + if !ok { + // Attr value is not an object. + return false + } + + if _, ok := obj["/"].(string); !ok { + // Attr value is not a reference. + return false + } + + recAttrValRefID := obj["/"].(string) + if recAttrValRefID != attr.Value.GetReference().GetId() { + return false + } + } + + // TODO: Handle arrays. + } + + return true +} diff --git a/x/nameservice/keeper/grpc_query_test.go b/x/nameservice/keeper/grpc_query_test.go new file mode 100644 index 00000000..331a2676 --- /dev/null +++ b/x/nameservice/keeper/grpc_query_test.go @@ -0,0 +1,272 @@ +package keeper_test + +import ( + "context" + "fmt" + "os" + + "github.com/tharsis/ethermint/x/nameservice/client/cli" + nameservicetypes "github.com/tharsis/ethermint/x/nameservice/types" +) + +func (suite *KeeperTestSuite) TestGrpcQueryParams() { + grpcClient := suite.queryClient + + testCases := []struct { + msg string + req *nameservicetypes.QueryParamsRequest + }{ + { + "Get Params", + &nameservicetypes.QueryParamsRequest{}, + }, + } + for _, test := range testCases { + suite.Run(fmt.Sprintf("Case %s ", test.msg), func() { + resp, _ := grpcClient.Params(context.Background(), test.req) + defaultParams := nameservicetypes.DefaultParams() + suite.Require().Equal(defaultParams.String(), resp.GetParams().String()) + }) + } +} + +func (suite *KeeperTestSuite) TestGrpcGetRecordLists() { + grpcClient, ctx := suite.queryClient, suite.ctx + sr := suite.Require() + var recordId string + testCases := []struct { + msg string + req *nameservicetypes.QueryListRecordsRequest + createRecord bool + expErr bool + noOfRecords int + }{ + { + "Empty Records", + &nameservicetypes.QueryListRecordsRequest{}, + false, + false, + 0, + }, + { + "List Records", + &nameservicetypes.QueryListRecordsRequest{}, + true, + false, + 1, + }, + } + for _, test := range testCases { + suite.Run(fmt.Sprintf("Case %s ", test.msg), func() { + if test.createRecord { + dir, err := os.Getwd() + sr.NoError(err) + payload, err := cli.GetPayloadFromFile(dir + "/../helpers/examples/example1.yml") + sr.NoError(err) + record, err := suite.app.NameServiceKeeper.ProcessSetRecord(ctx, nameservicetypes.MsgSetRecord{ + BondId: suite.bond.GetId(), + Signer: suite.accounts[0].String(), + Payload: payload.ToPayload(), + }) + sr.NoError(err) + sr.NotNil(record.Id) + } + resp, err := grpcClient.ListRecords(context.Background(), test.req) + if test.expErr { + suite.Error(err) + } else { + sr.NoError(err) + sr.Equal(test.noOfRecords, len(resp.GetRecords())) + if test.createRecord { + recordId = resp.GetRecords()[0].GetId() + sr.NotZero(resp.GetRecords()) + sr.Equal(resp.GetRecords()[0].GetBondId(), suite.bond.GetId()) + } + } + }) + } + + // Get the records by record id + testCases1 := []struct { + msg string + req *nameservicetypes.QueryRecordByIdRequest + createRecord bool + expErr bool + noOfRecords int + }{ + { + "Invalid Request without record id", + &nameservicetypes.QueryRecordByIdRequest{}, + false, + true, + 0, + }, + { + "With Record ID", + &nameservicetypes.QueryRecordByIdRequest{ + Id: recordId, + }, + true, + false, + 1, + }, + } + for _, test := range testCases1 { + suite.Run(fmt.Sprintf("Case %s ", test.msg), func() { + resp, err := grpcClient.GetRecord(context.Background(), test.req) + if test.expErr { + suite.Error(err) + } else { + sr.NoError(err) + sr.NotNil(resp.GetRecord()) + if test.createRecord { + sr.Equal(resp.GetRecord().BondId, suite.bond.GetId()) + sr.Equal(resp.GetRecord().Id, recordId) + } + } + }) + } + + // Get the records by record id + testCasesByBondID := []struct { + msg string + req *nameservicetypes.QueryRecordByBondIdRequest + createRecord bool + expErr bool + noOfRecords int + }{ + { + "Invalid Request without bond id", + &nameservicetypes.QueryRecordByBondIdRequest{}, + false, + true, + 0, + }, + { + "With Bond ID", + &nameservicetypes.QueryRecordByBondIdRequest{ + Id: suite.bond.GetId(), + }, + true, + false, + 1, + }, + } + for _, test := range testCasesByBondID { + suite.Run(fmt.Sprintf("Case %s ", test.msg), func() { + resp, err := grpcClient.GetRecordByBondId(context.Background(), test.req) + if test.expErr { + sr.Zero(resp.GetRecords()) + } else { + sr.NoError(err) + sr.NotNil(resp.GetRecords()) + if test.createRecord { + sr.NotZero(resp.GetRecords()) + sr.Equal(resp.GetRecords()[0].GetBondId(), suite.bond.GetId()) + } + } + }) + } +} + +func (suite *KeeperTestSuite) TestGrpcQueryNameserviceModuleBalance() { + grpcClient, ctx := suite.queryClient, suite.ctx + sr := suite.Require() + testCases := []struct { + msg string + req *nameservicetypes.GetNameServiceModuleBalanceRequest + createRecord bool + expErr bool + noOfRecords int + }{ + { + "Get Module Balance", + &nameservicetypes.GetNameServiceModuleBalanceRequest{}, + true, + false, + 1, + }, + } + for _, test := range testCases { + suite.Run(fmt.Sprintf("Case %s ", test.msg), func() { + if test.createRecord { + dir, err := os.Getwd() + sr.NoError(err) + payload, err := cli.GetPayloadFromFile(dir + "/../helpers/examples/example1.yml") + sr.NoError(err) + record, err := suite.app.NameServiceKeeper.ProcessSetRecord(ctx, nameservicetypes.MsgSetRecord{ + BondId: suite.bond.GetId(), + Signer: suite.accounts[0].String(), + Payload: payload.ToPayload(), + }) + sr.NoError(err) + sr.NotNil(record.Id) + } + resp, err := grpcClient.GetNameServiceModuleBalance(context.Background(), test.req) + if test.expErr { + suite.Error(err) + } else { + sr.NoError(err) + sr.Equal(test.noOfRecords, len(resp.GetBalances())) + if test.createRecord { + balance := resp.GetBalances()[0] + sr.Equal(balance.AccountName, nameservicetypes.RecordRentModuleAccountName) + } + } + }) + } +} + +func (suite *KeeperTestSuite) TestGrpcQueryWhoIS() { + grpcClient, ctx := suite.queryClient, suite.ctx + sr := suite.Require() + var authorityName = "TestGrpcQueryWhoIS" + + testCases := []struct { + msg string + req *nameservicetypes.QueryWhoisRequest + createName bool + expErr bool + noOfRecords int + }{ + { + "Invalid Request without name", + &nameservicetypes.QueryWhoisRequest{}, + false, + true, + 1, + }, + { + "Success", + &nameservicetypes.QueryWhoisRequest{}, + true, + false, + 1, + }, + } + for _, test := range testCases { + suite.Run(fmt.Sprintf("Case %s ", test.msg), func() { + if test.createName { + err := suite.app.NameServiceKeeper.ProcessReserveAuthority(ctx, nameservicetypes.MsgReserveAuthority{ + Name: authorityName, + Signer: suite.accounts[0].String(), + Owner: suite.accounts[0].String(), + }) + sr.NoError(err) + test.req = &nameservicetypes.QueryWhoisRequest{Name: authorityName} + } + resp, err := grpcClient.Whois(context.Background(), test.req) + if test.expErr { + sr.Zero(len(resp.NameAuthority.AuctionId)) + } else { + sr.NoError(err) + if test.createName { + nameAuth := resp.NameAuthority + sr.NotNil(nameAuth) + sr.Equal(nameAuth.OwnerAddress, suite.accounts[0].String()) + sr.Equal(nameservicetypes.AuthorityActive, nameAuth.Status) + } + } + }) + } +} diff --git a/x/nameservice/keeper/invariants.go b/x/nameservice/keeper/invariants.go new file mode 100644 index 00000000..00069e31 --- /dev/null +++ b/x/nameservice/keeper/invariants.go @@ -0,0 +1,36 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/tharsis/ethermint/x/nameservice/types" +) + +// RegisterInvariants registers all nameservice module invariants. +func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper) { + ir.RegisterRoute(types.ModuleName, "record", RecordInvariants(k)) +} + +// RecordInvariants checks that every record: +// (1) has a corresponding naming record & +// (2) associated bond exists, if bondID is not null. +func RecordInvariants(k Keeper) sdk.Invariant { + return func(ctx sdk.Context) (string, bool) { + //store := ctx.KVStore(k.storeKey) + //itr := sdk.KVStorePrefixIterator(store, PrefixCIDToRecordIndex) + //defer itr.Close() + //for ; itr.Valid(); itr.Next() { + // bz := store.Get(itr.Key()) + // if bz != nil { + // var obj types.RecordObj + // k.cdc.MustUnmarshalBinaryBare(bz, &obj) + // record := obj.ToRecord() + // + // if record.BondID != "" && !k.bondKeeper.HasBond(ctx, record.BondID) { + // return sdk.FormatInvariant(types.ModuleName, "record-bond", fmt.Sprintf("Bond not found for record ID: '%s'.", record.ID)), true + // } + // } + //} + + return "", false + } +} diff --git a/x/nameservice/keeper/keeper.go b/x/nameservice/keeper/keeper.go new file mode 100644 index 00000000..f5fbeef9 --- /dev/null +++ b/x/nameservice/keeper/keeper.go @@ -0,0 +1,437 @@ +package keeper + +import ( + "bytes" + "fmt" + "sort" + "time" + + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/legacy" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + auth "github.com/cosmos/cosmos-sdk/x/auth/keeper" + bank "github.com/cosmos/cosmos-sdk/x/bank/keeper" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + auctionkeeper "github.com/tharsis/ethermint/x/auction/keeper" + bondkeeper "github.com/tharsis/ethermint/x/bond/keeper" + "github.com/tharsis/ethermint/x/nameservice/helpers" + "github.com/tharsis/ethermint/x/nameservice/types" +) + +var ( + + // PrefixCIDToRecordIndex is the prefix for CID -> Record index. + // Note: This is the primary index in the system. + // Note: Golang doesn't support const arrays. + PrefixCIDToRecordIndex = []byte{0x00} + + // PrefixNameAuthorityRecordIndex is the prefix for the name -> NameAuthority index. + PrefixNameAuthorityRecordIndex = []byte{0x01} + + // PrefixCRNToNameRecordIndex is the prefix for the CRN -> NamingRecord index. + PrefixCRNToNameRecordIndex = []byte{0x02} + + // PrefixBondIDToRecordsIndex is the prefix for the Bond ID -> [Record] index. + PrefixBondIDToRecordsIndex = []byte{0x03} + + // PrefixBlockChangesetIndex is the prefix for the block changeset index. + PrefixBlockChangesetIndex = []byte{0x04} + + // PrefixAuctionToAuthorityNameIndex is the prefix for the auction ID -> authority name index. + PrefixAuctionToAuthorityNameIndex = []byte{0x05} + + // PrefixBondIDToAuthoritiesIndex is the prefix for the Bond ID -> [Authority] index. + PrefixBondIDToAuthoritiesIndex = []byte{0x06} + + // PrefixExpiryTimeToRecordsIndex is the prefix for the Expiry Time -> [Record] index. + PrefixExpiryTimeToRecordsIndex = []byte{0x10} + + // PrefixExpiryTimeToAuthoritiesIndex is the prefix for the Expiry Time -> [Authority] index. + PrefixExpiryTimeToAuthoritiesIndex = []byte{0x11} + + // PrefixCIDToNamesIndex the the reverse index for naming, i.e. maps CID -> []Names. + // TODO(ashwin): Move out of WNS once we have an indexing service. + PrefixCIDToNamesIndex = []byte{0xe0} +) + +// Keeper maintains the link to storage and exposes getter/setter methods for the various parts of the state machine +type Keeper struct { + accountKeeper auth.AccountKeeper + bankKeeper bank.Keeper + recordKeeper RecordKeeper + bondKeeper bondkeeper.Keeper + auctionKeeper auctionkeeper.Keeper + + storeKey sdk.StoreKey // Unexposed key to access store from sdk.Context + + cdc codec.BinaryCodec // The wire codec for binary encoding/decoding. + + paramSubspace paramtypes.Subspace +} + +// NewKeeper creates new instances of the nameservice Keeper +func NewKeeper(cdc codec.BinaryCodec, accountKeeper auth.AccountKeeper, bankKeeper bank.Keeper, recordKeeper RecordKeeper, + bondKeeper bondkeeper.Keeper, auctionKeeper auctionkeeper.Keeper, storeKey sdk.StoreKey, ps paramtypes.Subspace) Keeper { + // set KeyTable if it has not already been set + if !ps.HasKeyTable() { + ps = ps.WithKeyTable(types.ParamKeyTable()) + } + return Keeper{ + accountKeeper: accountKeeper, + bankKeeper: bankKeeper, + recordKeeper: recordKeeper, + bondKeeper: bondKeeper, + auctionKeeper: auctionKeeper, + storeKey: storeKey, + cdc: cdc, + paramSubspace: ps, + } +} + +// GetRecordIndexKey Generates Bond ID -> Bond index key. +func GetRecordIndexKey(id string) []byte { + return append(PrefixCIDToRecordIndex, []byte(id)...) +} + +// HasRecord - checks if a record by the given ID exists. +func (k Keeper) HasRecord(ctx sdk.Context, id string) bool { + store := ctx.KVStore(k.storeKey) + return store.Has(GetRecordIndexKey(id)) +} + +// GetRecord - gets a record from the store. +func (k Keeper) GetRecord(ctx sdk.Context, id string) (record types.Record) { + store := ctx.KVStore(k.storeKey) + result := store.Get(GetRecordIndexKey(id)) + k.cdc.MustUnmarshal(result, &record) + return record +} + +// ListRecords - get all records. +func (k Keeper) ListRecords(ctx sdk.Context) []types.Record { + var records []types.Record + + store := ctx.KVStore(k.storeKey) + itr := sdk.KVStorePrefixIterator(store, PrefixCIDToRecordIndex) + defer itr.Close() + for ; itr.Valid(); itr.Next() { + bz := store.Get(itr.Key()) + if bz != nil { + var obj types.Record + k.cdc.MustUnmarshal(bz, &obj) + records = append(records, recordObjToRecord(store, k.cdc, obj)) + } + } + + return records +} + +// MatchRecords - get all matching records. +func (k Keeper) MatchRecords(ctx sdk.Context, matchFn func(*types.RecordType) bool) []types.Record { + var records []types.Record + + store := ctx.KVStore(k.storeKey) + itr := sdk.KVStorePrefixIterator(store, PrefixCIDToRecordIndex) + defer itr.Close() + for ; itr.Valid(); itr.Next() { + bz := store.Get(itr.Key()) + if bz != nil { + var obj types.Record + k.cdc.MustUnmarshal(bz, &obj) + obj = recordObjToRecord(store, k.cdc, obj) + record := obj.ToRecordType() + if matchFn(&record) { + records = append(records, obj) + } + } + } + + return records +} + +func (k Keeper) GetRecordExpiryQueue(ctx sdk.Context) []*types.ExpiryQueueRecord { + var records []*types.ExpiryQueueRecord + + store := ctx.KVStore(k.storeKey) + itr := sdk.KVStorePrefixIterator(store, PrefixExpiryTimeToRecordsIndex) + defer itr.Close() + for ; itr.Valid(); itr.Next() { + record, err := helpers.BytesArrToStringArr(itr.Value()) + if err != nil { + return records + } + records = append(records, &types.ExpiryQueueRecord{ + Id: string(itr.Key()[len(PrefixExpiryTimeToRecordsIndex):]), + Value: record, + }) + } + + return records +} + +// ProcessSetRecord creates a record. +func (k Keeper) ProcessSetRecord(ctx sdk.Context, msg types.MsgSetRecord) (*types.RecordType, error) { + payload := msg.Payload.ToReadablePayload() + record := types.RecordType{Attributes: payload.Record, BondId: msg.BondId} + + // Check signatures. + resourceSignBytes, _ := record.GetSignBytes() + cid, err := record.GetCID() + if err != nil { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Invalid record JSON") + } + + record.Id = cid + + if exists := k.HasRecord(ctx, record.Id); exists { + // Immutable record already exists. No-op. + return &record, nil + } + + record.Owners = []string{} + for _, sig := range payload.Signatures { + pubKey, err := legacy.PubKeyFromBytes(helpers.BytesFromBase64(sig.PubKey)) + if err != nil { + fmt.Println("Error decoding pubKey from bytes: ", err) + return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Invalid public key.") + } + + sigOK := pubKey.VerifySignature(resourceSignBytes, helpers.BytesFromBase64(sig.Sig)) + if !sigOK { + fmt.Println("Signature mismatch: ", sig.PubKey) + return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Invalid signature.") + } + record.Owners = append(record.Owners, pubKey.Address().String()) + } + + // Sort owners list. + sort.Strings(record.Owners) + sdkErr := k.processRecord(ctx, &record, false) + if sdkErr != nil { + return nil, sdkErr + } + return &record, nil +} + +func (k Keeper) processRecord(ctx sdk.Context, record *types.RecordType, isRenewal bool) error { + params := k.GetParams(ctx) + rent := params.RecordRent + + err := k.bondKeeper.TransferCoinsToModuleAccount(ctx, record.BondId, types.RecordRentModuleAccountName, sdk.NewCoins(rent)) + if err != nil { + return err + } + + record.CreateTime = ctx.BlockHeader().Time.Format(time.RFC3339) + record.ExpiryTime = ctx.BlockHeader().Time.Add(params.RecordRentDuration).Format(time.RFC3339) + record.Deleted = false + + k.PutRecord(ctx, record.ToRecordObj()) + k.InsertRecordExpiryQueue(ctx, record.ToRecordObj()) + + // Renewal doesn't change the name and bond indexes. + if !isRenewal { + k.AddBondToRecordIndexEntry(ctx, record.BondId, record.Id) + } + + return nil +} + +// PutRecord - saves a record to the store and updates ID -> Record index. +func (k Keeper) PutRecord(ctx sdk.Context, record types.Record) { + store := ctx.KVStore(k.storeKey) + store.Set(GetRecordIndexKey(record.Id), k.cdc.MustMarshal(&record)) + k.updateBlockChangeSetForRecord(ctx, record.Id) +} + +// AddBondToRecordIndexEntry adds the Bond ID -> [Record] index entry. +func (k Keeper) AddBondToRecordIndexEntry(ctx sdk.Context, bondID string, id string) { + store := ctx.KVStore(k.storeKey) + store.Set(getBondIDToRecordsIndexKey(bondID, id), []byte{}) +} + +// Generates Bond ID -> Records index key. +func getBondIDToRecordsIndexKey(bondID string, id string) []byte { + return append(append(PrefixBondIDToRecordsIndex, []byte(bondID)...), []byte(id)...) +} + +// getRecordExpiryQueueTimeKey gets the prefix for the record expiry queue. +func getRecordExpiryQueueTimeKey(timestamp time.Time) []byte { + timeBytes := sdk.FormatTimeBytes(timestamp) + return append(PrefixExpiryTimeToRecordsIndex, timeBytes...) +} + +// SetRecordExpiryQueueTimeSlice sets a specific record expiry queue timeslice. +func (k Keeper) SetRecordExpiryQueueTimeSlice(ctx sdk.Context, timestamp time.Time, cids []string) { + store := ctx.KVStore(k.storeKey) + bz, _ := helpers.StrArrToBytesArr(cids) + store.Set(getRecordExpiryQueueTimeKey(timestamp), bz) +} + +// DeleteRecordExpiryQueueTimeSlice deletes a specific record expiry queue timeslice. +func (k Keeper) DeleteRecordExpiryQueueTimeSlice(ctx sdk.Context, timestamp time.Time) { + store := ctx.KVStore(k.storeKey) + store.Delete(getRecordExpiryQueueTimeKey(timestamp)) +} + +// GetRecordExpiryQueueTimeSlice gets a specific record queue timeslice. +// A timeslice is a slice of CIDs corresponding to records that expire at a certain time. +func (k Keeper) GetRecordExpiryQueueTimeSlice(ctx sdk.Context, timestamp time.Time) []string { + store := ctx.KVStore(k.storeKey) + + bz := store.Get(getRecordExpiryQueueTimeKey(timestamp)) + if bz == nil { + return []string{} + } + cids, err := helpers.BytesArrToStringArr(bz) + if err != nil { + return []string{} + } + return cids +} + +// InsertRecordExpiryQueue inserts a record CID to the appropriate timeslice in the record expiry queue. +func (k Keeper) InsertRecordExpiryQueue(ctx sdk.Context, val types.Record) { + expiryTime, err := time.Parse(time.RFC3339, val.ExpiryTime) + + if err != nil { + panic(err) + } + + timeSlice := k.GetRecordExpiryQueueTimeSlice(ctx, expiryTime) + timeSlice = append(timeSlice, val.Id) + k.SetRecordExpiryQueueTimeSlice(ctx, expiryTime, timeSlice) +} + +// DeleteRecordExpiryQueue deletes a record CID from the record expiry queue. +func (k Keeper) DeleteRecordExpiryQueue(ctx sdk.Context, record types.Record) { + expiryTime, err := time.Parse(time.RFC3339, record.ExpiryTime) + + if err != nil { + panic(err) + } + + timeSlice := k.GetRecordExpiryQueueTimeSlice(ctx, expiryTime) + var newTimeSlice []string + + for _, cid := range timeSlice { + if !bytes.Equal([]byte(cid), []byte(record.Id)) { + newTimeSlice = append(newTimeSlice, cid) + } + } + + if len(newTimeSlice) == 0 { + k.DeleteRecordExpiryQueueTimeSlice(ctx, expiryTime) + } else { + k.SetRecordExpiryQueueTimeSlice(ctx, expiryTime, newTimeSlice) + } +} + +// RecordExpiryQueueIterator returns all the record expiry queue timeslices from time 0 until endTime. +func (k Keeper) RecordExpiryQueueIterator(ctx sdk.Context, endTime time.Time) sdk.Iterator { + store := ctx.KVStore(k.storeKey) + rangeEndBytes := sdk.InclusiveEndBytes(getRecordExpiryQueueTimeKey(endTime)) + return store.Iterator(PrefixExpiryTimeToRecordsIndex, rangeEndBytes) +} + +// GetAllExpiredRecords returns a concatenated list of all the timeslices before currTime. +func (k Keeper) GetAllExpiredRecords(ctx sdk.Context, currTime time.Time) (expiredRecordCIDs []string) { + // Gets an iterator for all timeslices from time 0 until the current block header time. + itr := k.RecordExpiryQueueIterator(ctx, ctx.BlockHeader().Time) + defer itr.Close() + + for ; itr.Valid(); itr.Next() { + timeslice, err := helpers.BytesArrToStringArr(itr.Value()) + + if err != nil { + panic(err) + } + + expiredRecordCIDs = append(expiredRecordCIDs, timeslice...) + } + + return expiredRecordCIDs +} + +// ProcessRecordExpiryQueue tries to renew expiring records (by collecting rent) else marks them as deleted. +func (k Keeper) ProcessRecordExpiryQueue(ctx sdk.Context) { + cids := k.GetAllExpiredRecords(ctx, ctx.BlockHeader().Time) + for _, cid := range cids { + record := k.GetRecord(ctx, cid) + + // If record doesn't have an associated bond or if bond no longer exists, mark it deleted. + if record.BondId == "" || !k.bondKeeper.HasBond(ctx, record.BondId) { + record.Deleted = true + k.PutRecord(ctx, record) + k.DeleteRecordExpiryQueue(ctx, record) + + return + } + + // Try to renew the record by taking rent. + k.TryTakeRecordRent(ctx, record) + } +} + +// TryTakeRecordRent tries to take rent from the record bond. +func (k Keeper) TryTakeRecordRent(ctx sdk.Context, record types.Record) { + params := k.GetParams(ctx) + rent := params.RecordRent + sdkErr := k.bondKeeper.TransferCoinsToModuleAccount(ctx, record.BondId, types.RecordRentModuleAccountName, sdk.NewCoins(rent)) + + if sdkErr != nil { + // Insufficient funds, mark record as deleted. + record.Deleted = true + k.PutRecord(ctx, record) + k.DeleteRecordExpiryQueue(ctx, record) + + return + } + + // Delete old expiry queue entry, create new one. + k.DeleteRecordExpiryQueue(ctx, record) + record.ExpiryTime = ctx.BlockHeader().Time.Add(params.RecordRentDuration).Format(time.RFC3339) + k.InsertRecordExpiryQueue(ctx, record) + + // Save record. + record.Deleted = false + k.PutRecord(ctx, record) + k.AddBondToRecordIndexEntry(ctx, record.BondId, record.Id) +} + +// GetModuleBalances gets the nameservice module account(s) balances. +func (k Keeper) GetModuleBalances(ctx sdk.Context) []*types.AccountBalance { + var balances []*types.AccountBalance + accountNames := []string{types.RecordRentModuleAccountName, types.AuthorityRentModuleAccountName} + + for _, accountName := range accountNames { + moduleAddress := k.accountKeeper.GetModuleAddress(accountName) + moduleAccount := k.accountKeeper.GetAccount(ctx, moduleAddress) + if moduleAccount != nil { + accountBalance := k.bankKeeper.GetAllBalances(ctx, moduleAddress) + balances = append(balances, &types.AccountBalance{ + AccountName: accountName, + Balance: accountBalance, + }) + } + } + + return balances +} + +func recordObjToRecord(store sdk.KVStore, codec codec.BinaryCodec, record types.Record) types.Record { + reverseNameIndexKey := GetCIDToNamesIndexKey(record.Id) + + if store.Has(reverseNameIndexKey) { + names, err := helpers.BytesArrToStringArr(store.Get(reverseNameIndexKey)) + + if err != nil { + panic(err) + } + + record.Names = names + } + + return record +} diff --git a/x/nameservice/keeper/keeper_test.go b/x/nameservice/keeper/keeper_test.go new file mode 100644 index 00000000..f3057269 --- /dev/null +++ b/x/nameservice/keeper/keeper_test.go @@ -0,0 +1,67 @@ +package keeper_test + +import ( + "testing" + + "github.com/cosmos/cosmos-sdk/baseapp" + "github.com/cosmos/cosmos-sdk/simapp" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + "github.com/tharsis/ethermint/app" + bondtypes "github.com/tharsis/ethermint/x/bond/types" + nameservicekeeper "github.com/tharsis/ethermint/x/nameservice/keeper" + "github.com/tharsis/ethermint/x/nameservice/types" +) + +type KeeperTestSuite struct { + suite.Suite + app *app.EthermintApp + ctx sdk.Context + queryClient types.QueryClient + accounts []sdk.AccAddress + bond bondtypes.Bond +} + +func (suite *KeeperTestSuite) SetupTest() { + testApp := app.Setup(false, func(ea *app.EthermintApp, genesis simapp.GenesisState) simapp.GenesisState { + return genesis + }) + ctx := testApp.BaseApp.NewContext(false, tmproto.Header{}) + + querier := nameservicekeeper.Querier{Keeper: testApp.NameServiceKeeper} + + queryHelper := baseapp.NewQueryServerTestHelper(ctx, testApp.InterfaceRegistry()) + types.RegisterQueryServer(queryHelper, querier) + queryClient := types.NewQueryClient(queryHelper) + + suite.accounts = app.CreateRandomAccounts(1) + account := suite.accounts[0] + _ = simapp.FundAccount(testApp.BankKeeper, ctx, account, sdk.NewCoins(sdk.Coin{ + Denom: sdk.DefaultBondDenom, + Amount: sdk.NewInt(100000000000), + })) + + bond, err := testApp.BondKeeper.CreateBond(ctx, account, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(1000000000)))) + if err != nil { + return + } + suite.bond = *bond + suite.app, suite.ctx, suite.queryClient = testApp, ctx, queryClient +} + +func TestParams(t *testing.T) { + testApp := app.Setup(false, func(ea *app.EthermintApp, genesis simapp.GenesisState) simapp.GenesisState { + return genesis + }) + ctx := testApp.BaseApp.NewContext(false, tmproto.Header{}) + + expParams := types.DefaultParams() + params := testApp.NameServiceKeeper.GetParams(ctx) + require.True(t, params.Equal(expParams)) +} + +func TestKeeperTestSuite(t *testing.T) { + suite.Run(t, new(KeeperTestSuite)) +} diff --git a/x/nameservice/keeper/msg_server.go b/x/nameservice/keeper/msg_server.go new file mode 100644 index 00000000..31224b7a --- /dev/null +++ b/x/nameservice/keeper/msg_server.go @@ -0,0 +1,281 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/tharsis/ethermint/x/nameservice/types" +) + +type msgServer struct { + Keeper +} + +// NewMsgServerImpl returns an implementation of the bond MsgServer interface for the provided Keeper. +func NewMsgServerImpl(keeper Keeper) types.MsgServer { + return &msgServer{Keeper: keeper} +} + +var _ types.MsgServer = msgServer{} + +func (m msgServer) SetRecord(c context.Context, msg *types.MsgSetRecord) (*types.MsgSetRecordResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + _, err := sdk.AccAddressFromBech32(msg.Signer) + if err != nil { + return nil, err + } + + record, err := m.Keeper.ProcessSetRecord(ctx, types.MsgSetRecord{ + BondId: msg.GetBondId(), + Signer: msg.GetSigner(), + Payload: msg.GetPayload(), + }) + if err != nil { + return nil, err + } + + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.EventTypeSetRecord, + sdk.NewAttribute(types.AttributeKeySigner, msg.GetSigner()), + sdk.NewAttribute(types.AttributeKeyBondId, msg.GetBondId()), + sdk.NewAttribute(types.AttributeKeyPayload, msg.Payload.String()), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + sdk.NewAttribute(types.AttributeKeySigner, msg.Signer), + ), + }) + + return &types.MsgSetRecordResponse{Id: record.Id}, nil +} + +func (m msgServer) SetName(c context.Context, msg *types.MsgSetName) (*types.MsgSetNameResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + _, err := sdk.AccAddressFromBech32(msg.Signer) + if err != nil { + return nil, err + } + err = m.Keeper.ProcessSetName(ctx, *msg) + if err != nil { + return nil, err + } + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.EventTypeSetRecord, + sdk.NewAttribute(types.AttributeKeySigner, msg.Signer), + sdk.NewAttribute(types.AttributeKeyCRN, msg.Crn), + sdk.NewAttribute(types.AttributeKeyCID, msg.Cid), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + sdk.NewAttribute(types.AttributeKeySigner, msg.Signer), + ), + }) + return &types.MsgSetNameResponse{}, nil +} + +func (m msgServer) ReserveName(c context.Context, msg *types.MsgReserveAuthority) (*types.MsgReserveAuthorityResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + _, err := sdk.AccAddressFromBech32(msg.Signer) + if err != nil { + return nil, err + } + _, err = sdk.AccAddressFromBech32(msg.Owner) + if err != nil { + return nil, err + } + err = m.Keeper.ProcessReserveAuthority(ctx, *msg) + if err != nil { + return nil, err + } + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.EventTypeReserveNameAuthority, + sdk.NewAttribute(types.AttributeKeySigner, msg.Signer), + sdk.NewAttribute(types.AttributeKeyName, msg.Name), + sdk.NewAttribute(types.AttributeKeyOwner, msg.Owner), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + sdk.NewAttribute(types.AttributeKeySigner, msg.Signer), + ), + }) + return &types.MsgReserveAuthorityResponse{}, nil +} + +func (m msgServer) SetAuthorityBond(c context.Context, msg *types.MsgSetAuthorityBond) (*types.MsgSetAuthorityBondResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + _, err := sdk.AccAddressFromBech32(msg.Signer) + if err != nil { + return nil, err + } + err = m.Keeper.ProcessSetAuthorityBond(ctx, *msg) + if err != nil { + return nil, err + } + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.EventTypeAuthorityBond, + sdk.NewAttribute(types.AttributeKeySigner, msg.Signer), + sdk.NewAttribute(types.AttributeKeyName, msg.Name), + sdk.NewAttribute(types.AttributeKeyBondId, msg.BondId), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + sdk.NewAttribute(types.AttributeKeySigner, msg.Signer), + ), + }) + return &types.MsgSetAuthorityBondResponse{}, nil +} + +func (m msgServer) DeleteName(c context.Context, msg *types.MsgDeleteNameAuthority) (*types.MsgDeleteNameAuthorityResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + _, err := sdk.AccAddressFromBech32(msg.Signer) + if err != nil { + return nil, err + } + err = m.Keeper.ProcessDeleteName(ctx, *msg) + if err != nil { + return nil, err + } + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.EventTypeDeleteName, + sdk.NewAttribute(types.AttributeKeySigner, msg.Signer), + sdk.NewAttribute(types.AttributeKeyCRN, msg.Crn), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + sdk.NewAttribute(types.AttributeKeySigner, msg.Signer), + ), + }) + return &types.MsgDeleteNameAuthorityResponse{}, nil +} + +func (m msgServer) RenewRecord(c context.Context, msg *types.MsgRenewRecord) (*types.MsgRenewRecordResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + _, err := sdk.AccAddressFromBech32(msg.Signer) + err = m.Keeper.ProcessRenewRecord(ctx, *msg) + if err != nil { + return nil, err + } + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.EventTypeRenewRecord, + sdk.NewAttribute(types.AttributeKeySigner, msg.Signer), + sdk.NewAttribute(types.AttributeKeyRecordId, msg.RecordId), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + sdk.NewAttribute(types.AttributeKeySigner, msg.Signer), + ), + }) + return &types.MsgRenewRecordResponse{}, nil +} + +func (m msgServer) AssociateBond(c context.Context, msg *types.MsgAssociateBond) (*types.MsgAssociateBondResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + _, err := sdk.AccAddressFromBech32(msg.Signer) + if err != nil { + return nil, err + } + + err = m.Keeper.ProcessAssociateBond(ctx, *msg) + if err != nil { + return nil, err + } + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.EventTypeAssociateBond, + sdk.NewAttribute(types.AttributeKeySigner, msg.Signer), + sdk.NewAttribute(types.AttributeKeyRecordId, msg.RecordId), + sdk.NewAttribute(types.AttributeKeyBondId, msg.BondId), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + sdk.NewAttribute(types.AttributeKeySigner, msg.Signer), + ), + }) + return &types.MsgAssociateBondResponse{}, nil +} + +func (m msgServer) DissociateBond(c context.Context, msg *types.MsgDissociateBond) (*types.MsgDissociateBondResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + _, err := sdk.AccAddressFromBech32(msg.Signer) + if err != nil { + return nil, err + } + err = m.Keeper.ProcessDissociateBond(ctx, *msg) + if err != nil { + return nil, err + } + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.EventTypeDissociateBond, + sdk.NewAttribute(types.AttributeKeySigner, msg.Signer), + sdk.NewAttribute(types.AttributeKeyRecordId, msg.RecordId), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + sdk.NewAttribute(types.AttributeKeySigner, msg.Signer), + ), + }) + return &types.MsgDissociateBondResponse{}, nil +} + +func (m msgServer) DissociateRecords(c context.Context, msg *types.MsgDissociateRecords) (*types.MsgDissociateRecordsResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + _, err := sdk.AccAddressFromBech32(msg.Signer) + if err != nil { + return nil, err + } + err = m.Keeper.ProcessDissociateRecords(ctx, *msg) + if err != nil { + return nil, err + } + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.EventTypeDissociateRecords, + sdk.NewAttribute(types.AttributeKeySigner, msg.Signer), + sdk.NewAttribute(types.AttributeKeyBondId, msg.BondId), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + sdk.NewAttribute(types.AttributeKeySigner, msg.Signer), + ), + }) + return &types.MsgDissociateRecordsResponse{}, nil +} + +func (m msgServer) ReAssociateRecords(c context.Context, msg *types.MsgReAssociateRecords) (*types.MsgReAssociateRecordsResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + _, err := sdk.AccAddressFromBech32(msg.Signer) + if err != nil { + return nil, err + } + err = m.Keeper.ProcessReAssociateRecords(ctx, *msg) + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.EventTypeReAssociateRecords, + sdk.NewAttribute(types.AttributeKeySigner, msg.Signer), + sdk.NewAttribute(types.AttributeKeyOldBondId, msg.OldBondId), + sdk.NewAttribute(types.AttributeKeyNewBondId, msg.NewBondId), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + sdk.NewAttribute(types.AttributeKeySigner, msg.Signer), + ), + }) + return &types.MsgReAssociateRecordsResponse{}, nil +} diff --git a/x/nameservice/keeper/naming_keeper.go b/x/nameservice/keeper/naming_keeper.go new file mode 100644 index 00000000..cc61f567 --- /dev/null +++ b/x/nameservice/keeper/naming_keeper.go @@ -0,0 +1,723 @@ +package keeper + +import ( + "bytes" + "fmt" + "net/url" + "strings" + "time" + + "github.com/cosmos/cosmos-sdk/codec" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + auctiontypes "github.com/tharsis/ethermint/x/auction/types" + "github.com/tharsis/ethermint/x/nameservice/helpers" + "github.com/tharsis/ethermint/x/nameservice/types" +) + +func getAuthorityPubKey(pubKey cryptotypes.PubKey) string { + if pubKey != nil { + return helpers.BytesToBase64(pubKey.Bytes()) + } + return "" +} + +// GetNameAuthorityIndexKey Generates name -> NameAuthority index key. +func GetNameAuthorityIndexKey(name string) []byte { + return append(PrefixNameAuthorityRecordIndex, []byte(name)...) +} + +// GetNameRecordIndexKey Generates CRN -> NameRecord index key. +func GetNameRecordIndexKey(crn string) []byte { + return append(PrefixCRNToNameRecordIndex, []byte(crn)...) +} + +func GetCIDToNamesIndexKey(id string) []byte { + return append(PrefixCIDToNamesIndex, []byte(id)...) +} + +func SetNameAuthority(ctx sdk.Context, store sdk.KVStore, codec codec.BinaryCodec, name string, authority *types.NameAuthority) { + store.Set(GetNameAuthorityIndexKey(name), codec.MustMarshal(authority)) + updateBlockChangeSetForNameAuthority(ctx, codec, store, name) +} + +// SetNameAuthority creates the NameAuthority record. +func (k Keeper) SetNameAuthority(ctx sdk.Context, name string, authority *types.NameAuthority) { + SetNameAuthority(ctx, ctx.KVStore(k.storeKey), k.cdc, name, authority) +} + +func removeAuctionToAuthorityMapping(store sdk.KVStore, auctionID string) { + store.Delete(GetAuctionToAuthorityIndexKey(auctionID)) +} + +func (k Keeper) RemoveAuctionToAuthorityMapping(ctx sdk.Context, auctionID string) { + removeAuctionToAuthorityMapping(ctx.KVStore(k.storeKey), auctionID) +} + +// GetNameAuthority - gets a name authority from the store. +func GetNameAuthority(store sdk.KVStore, codec codec.BinaryCodec, name string) types.NameAuthority { + authorityKey := GetNameAuthorityIndexKey(name) + if !store.Has(authorityKey) { + return types.NameAuthority{} + } + + bz := store.Get(authorityKey) + var obj types.NameAuthority + codec.MustUnmarshal(bz, &obj) + + return obj +} + +// GetNameAuthority - gets a name authority from the store. +func (k Keeper) GetNameAuthority(ctx sdk.Context, name string) types.NameAuthority { + return GetNameAuthority(ctx.KVStore(k.storeKey), k.cdc, name) +} + +// HasNameAuthority - checks if a name authority entry exists. +func HasNameAuthority(store sdk.KVStore, name string) bool { + return store.Has(GetNameAuthorityIndexKey(name)) +} + +// HasNameAuthority - checks if a name/authority exists. +func (k Keeper) HasNameAuthority(ctx sdk.Context, name string) bool { + return HasNameAuthority(ctx.KVStore(k.storeKey), name) +} + +func getBondIDToAuthoritiesIndexKey(bondID string, name string) []byte { + return append(append(PrefixBondIDToAuthoritiesIndex, []byte(bondID)...), []byte(name)...) +} + +// AddBondToAuthorityIndexEntry adds the Bond ID -> [Authority] index entry. +func (k Keeper) AddBondToAuthorityIndexEntry(ctx sdk.Context, bondID string, name string) { + store := ctx.KVStore(k.storeKey) + store.Set(getBondIDToAuthoritiesIndexKey(bondID, name), []byte{}) +} + +// RemoveBondToAuthorityIndexEntry removes the Bond ID -> [Authority] index entry. +func (k Keeper) RemoveBondToAuthorityIndexEntry(ctx sdk.Context, bondID string, name string) { + RemoveBondToAuthorityIndexEntry(ctx.KVStore(k.storeKey), bondID, name) +} + +func RemoveBondToAuthorityIndexEntry(store sdk.KVStore, bondID string, name string) { + store.Delete(getBondIDToAuthoritiesIndexKey(bondID, name)) +} + +func (k Keeper) updateBlockChangeSetForName(ctx sdk.Context, crn string) { + changeSet := k.getOrCreateBlockChangeSet(ctx, ctx.BlockHeight()) + changeSet.Names = append(changeSet.Names, crn) + k.saveBlockChangeSet(ctx, changeSet) +} + +func (k Keeper) getAuthority(ctx sdk.Context, crn string) (string, *url.URL, *types.NameAuthority, error) { + parsedCRN, err := url.Parse(crn) + if err != nil { + return "", nil, nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Invalid CRN.") + } + + name := parsedCRN.Host + if !k.HasNameAuthority(ctx, name) { + return name, nil, nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Name authority not found.") + } + authority := k.GetNameAuthority(ctx, name) + return name, parsedCRN, &authority, nil +} + +func (k Keeper) checkCRNAccess(ctx sdk.Context, signer sdk.AccAddress, crn string) error { + name, parsedCRN, authority, err := k.getAuthority(ctx, crn) + if err != nil { + return err + } + + formattedCRN := fmt.Sprintf("crn://%s%s", name, parsedCRN.RequestURI()) + if formattedCRN != crn { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Invalid CRN.") + } + + if authority.OwnerAddress != signer.String() { + return sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Access denied.") + } + + if authority.Status != types.AuthorityActive { + return sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Authority is not active.") + } + + if authority.BondId == "" || len(authority.BondId) == 0 { + return sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Authority bond not found.") + } + + if authority.OwnerPublicKey == "" { + // Try to set owner public key if account has it available now. + ownerAccount := k.accountKeeper.GetAccount(ctx, signer) + pubKey := ownerAccount.GetPubKey() + if pubKey != nil { + // Update public key in authority record. + authority.OwnerPublicKey = getAuthorityPubKey(pubKey) + k.SetNameAuthority(ctx, name, authority) + } + } + + return nil +} + +// HasNameRecord - checks if a name record exists. +func (k Keeper) HasNameRecord(ctx sdk.Context, crn string) bool { + store := ctx.KVStore(k.storeKey) + return store.Has(GetNameRecordIndexKey(crn)) +} + +// GetNameRecord - gets a name record from the store. +func GetNameRecord(store sdk.KVStore, codec codec.BinaryCodec, crn string) *types.NameRecord { + nameRecordKey := GetNameRecordIndexKey(crn) + if !store.Has(nameRecordKey) { + return nil + } + + bz := store.Get(nameRecordKey) + var obj types.NameRecord + codec.MustUnmarshal(bz, &obj) + + return &obj +} + +// GetNameRecord - gets a name record from the store. +func (k Keeper) GetNameRecord(ctx sdk.Context, crn string) *types.NameRecord { + _, _, authority, err := k.getAuthority(ctx, crn) + if err != nil || authority.Status != types.AuthorityActive { + // If authority is not active (or any other error), lookup fails. + return nil + } + + nameRecord := GetNameRecord(ctx.KVStore(k.storeKey), k.cdc, crn) + + // Name record may not exist. + if nameRecord == nil { + return nil + } + + // Name lookup should fail if the name record is stale. + // i.e. authority was registered later than the name. + if authority.Height > nameRecord.Latest.Height { + return nil + } + + return nameRecord +} + +// RemoveRecordToNameMapping removes a name from the record ID -> []names index. +func RemoveRecordToNameMapping(store sdk.KVStore, id string, crn string) { + reverseNameIndexKey := GetCIDToNamesIndexKey(id) + + names, _ := helpers.BytesArrToStringArr(store.Get(reverseNameIndexKey)) + nameSet := helpers.SliceToSet(names) + nameSet.Remove(crn) + + if nameSet.Cardinality() == 0 { + // Delete as storing empty slice throws error from baseapp. + store.Delete(reverseNameIndexKey) + } else { + data, _ := helpers.StrArrToBytesArr(helpers.SetToSlice(nameSet)) + store.Set(reverseNameIndexKey, data) + } +} + +// AddRecordToNameMapping adds a name to the record ID -> []names index. +func AddRecordToNameMapping(store sdk.KVStore, id string, crn string) { + reverseNameIndexKey := GetCIDToNamesIndexKey(id) + + var names []string + if store.Has(reverseNameIndexKey) { + names, _ = helpers.BytesArrToStringArr(store.Get(reverseNameIndexKey)) + } + + nameSet := helpers.SliceToSet(names) + nameSet.Add(crn) + bz, _ := helpers.StrArrToBytesArr(helpers.SetToSlice(nameSet)) + store.Set(reverseNameIndexKey, bz) +} + +// SetNameRecord - sets a name record. +func SetNameRecord(store sdk.KVStore, codec codec.BinaryCodec, crn string, id string, height int64) { + nameRecordIndexKey := GetNameRecordIndexKey(crn) + + var nameRecord types.NameRecord + if store.Has(nameRecordIndexKey) { + bz := store.Get(nameRecordIndexKey) + codec.MustUnmarshal(bz, &nameRecord) + nameRecord.History = append(nameRecord.History, nameRecord.Latest) + + // Update old CID -> []Name index. + if nameRecord.Latest.Id != "" || len(nameRecord.Latest.Id) != 0 { + RemoveRecordToNameMapping(store, nameRecord.Latest.Id, crn) + } + } + + nameRecord.Latest = &types.NameRecordEntry{ + Id: id, + Height: uint64(height), + } + + store.Set(nameRecordIndexKey, codec.MustMarshal(&nameRecord)) + + // Update new CID -> []Name index. + if id != "" { + AddRecordToNameMapping(store, id, crn) + } +} + +// SetNameRecord - sets a name record. +func (k Keeper) SetNameRecord(ctx sdk.Context, crn string, id string) { + SetNameRecord(ctx.KVStore(k.storeKey), k.cdc, crn, id, ctx.BlockHeight()) + + // Update changeSet for name. + k.updateBlockChangeSetForName(ctx, crn) +} + +// ProcessSetName creates a CRN -> Record ID mapping. +func (k Keeper) ProcessSetName(ctx sdk.Context, msg types.MsgSetName) error { + signerAddress, err := sdk.AccAddressFromBech32(msg.Signer) + if err != nil { + return err + } + err = k.checkCRNAccess(ctx, signerAddress, msg.Crn) + if err != nil { + return err + } + + nameRecord := k.GetNameRecord(ctx, msg.Crn) + if nameRecord != nil && nameRecord.Latest.Id == msg.Cid { + return nil + } + + k.SetNameRecord(ctx, msg.Crn, msg.Cid) + + return nil +} + +// ListNameRecords - get all name records. +func (k Keeper) ListNameRecords(ctx sdk.Context) []types.NameEntry { + var nameEntries []types.NameEntry + store := ctx.KVStore(k.storeKey) + itr := sdk.KVStorePrefixIterator(store, PrefixCRNToNameRecordIndex) + defer itr.Close() + for ; itr.Valid(); itr.Next() { + bz := store.Get(itr.Key()) + if bz != nil { + var record types.NameRecord + k.cdc.MustUnmarshal(bz, &record) + nameEntries = append(nameEntries, types.NameEntry{ + Name: string(itr.Key()[len(PrefixCRNToNameRecordIndex):]), + Entry: &record, + }) + } + } + + return nameEntries +} + +// ProcessReserveSubAuthority reserves a sub-authority. +func (k Keeper) ProcessReserveSubAuthority(ctx sdk.Context, name string, msg types.MsgReserveAuthority) error { + // Get parent authority name. + names := strings.Split(name, ".") + parent := strings.Join(names[1:], ".") + + // Check if parent authority exists. + if !k.HasNameAuthority(ctx, parent) { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Parent authority not found.") + } + parentAuthority := k.GetNameAuthority(ctx, parent) + + // Sub-authority creator needs to be the owner of the parent authority. + if parentAuthority.OwnerAddress != msg.Signer { + return sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Access denied.") + } + + // Sub-authority owner defaults to parent authority owner. + subAuthorityOwner := msg.Signer + if len(msg.Owner) != 0 { + // Override sub-authority owner if provided in message. + subAuthorityOwner = msg.Owner + } + + sdkErr := k.createAuthority(ctx, name, subAuthorityOwner, false) + if sdkErr != nil { + return sdkErr + } + + return nil +} + +func GetAuctionToAuthorityIndexKey(auctionID string) []byte { + return append(PrefixAuctionToAuthorityNameIndex, []byte(auctionID)...) +} + +func (k Keeper) AddAuctionToAuthorityMapping(ctx sdk.Context, auctionID string, name string) { + store := ctx.KVStore(k.storeKey) + store.Set(GetAuctionToAuthorityIndexKey(auctionID), []byte(name)) +} + +func (k Keeper) createAuthority(ctx sdk.Context, name string, owner string, isRoot bool) error { + moduleParams := k.GetParams(ctx) + + if k.HasNameAuthority(ctx, name) { + authority := k.GetNameAuthority(ctx, name) + if authority.Status != types.AuthorityExpired { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Name already reserved.") + } + } + + ownerAddress, err := sdk.AccAddressFromBech32(owner) + if err != nil { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Invalid owner address.") + } + ownerAccount := k.accountKeeper.GetAccount(ctx, ownerAddress) + if ownerAccount == nil { + return sdkerrors.Wrap(sdkerrors.ErrUnknownAddress, "Account not found.") + } + + authority := types.NameAuthority{ + OwnerPublicKey: getAuthorityPubKey(ownerAccount.GetPubKey()), + OwnerAddress: owner, + Height: uint64(ctx.BlockHeight()), + Status: types.AuthorityActive, + AuctionId: "", + BondId: "", + ExpiryTime: ctx.BlockTime().Add(moduleParams.AuthorityGracePeriod), + } + + if isRoot && moduleParams.AuthorityAuctionEnabled { + // If auctions are enabled, clear out owner fields. They will be set after a winner is picked. + authority.OwnerAddress = "" + authority.OwnerPublicKey = "" + // Reset bond ID if required. + if authority.BondId != "" || len(authority.BondId) != 0 { + k.RemoveBondToAuthorityIndexEntry(ctx, authority.BondId, name) + authority.BondId = "" + } + + params := auctiontypes.Params{ + CommitsDuration: moduleParams.AuthorityAuctionCommitsDuration, + RevealsDuration: moduleParams.AuthorityAuctionRevealsDuration, + CommitFee: moduleParams.AuthorityAuctionCommitFee, + RevealFee: moduleParams.AuthorityAuctionRevealFee, + MinimumBid: moduleParams.AuthorityAuctionMinimumBid, + } + + // Create an auction. + msg := auctiontypes.NewMsgCreateAuction(params, ownerAddress) + + auction, sdkErr := k.auctionKeeper.CreateAuction(ctx, msg) + if sdkErr != nil { + return sdkErr + } + + // Create auction ID -> authority name index. + k.AddAuctionToAuthorityMapping(ctx, auction.Id, name) + + authority.Status = types.AuthorityUnderAuction + authority.AuctionId = auction.Id + authority.ExpiryTime = auction.RevealsEndTime.Add(moduleParams.AuthorityGracePeriod) + } + + k.SetNameAuthority(ctx, name, &authority) + k.InsertAuthorityExpiryQueue(ctx, name, authority.ExpiryTime) + + return nil +} + +// ProcessReserveAuthority reserves a name authority. +func (k Keeper) ProcessReserveAuthority(ctx sdk.Context, msg types.MsgReserveAuthority) error { + crn := fmt.Sprintf("crn://%s", msg.GetName()) + parsedCrn, err := url.Parse(crn) + if err != nil { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Invalid name") + } + name := parsedCrn.Host + if fmt.Sprintf("crn://%s", name) != crn { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Invalid name") + } + if strings.Contains(name, ".") { + return k.ProcessReserveSubAuthority(ctx, name, msg) + } + err = k.createAuthority(ctx, name, msg.GetSigner(), true) + if err != nil { + return err + } + return nil +} + +func (k Keeper) ProcessSetAuthorityBond(ctx sdk.Context, msg types.MsgSetAuthorityBond) error { + name := msg.GetName() + signer := msg.GetSigner() + if !k.HasNameAuthority(ctx, name) { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Name authority not found.") + } + authority := k.GetNameAuthority(ctx, name) + if authority.OwnerAddress != signer { + return sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Access denied") + } + + if !k.bondKeeper.HasBond(ctx, msg.BondId) { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Bond not found.") + } + // + bond := k.bondKeeper.GetBond(ctx, msg.BondId) + if bond.Owner != signer { + return sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Bond owner mismatch.") + } + + // No-op if bond hasn't changed. + if authority.BondId == msg.BondId { + return nil + } + + // Remove old bond ID mapping, if any. + if authority.BondId != "" { + k.RemoveBondToAuthorityIndexEntry(ctx, authority.BondId, name) + } + + // Update bond ID for authority. + authority.BondId = bond.Id + k.SetNameAuthority(ctx, name, &authority) + // Add new bond ID mapping. + k.AddBondToAuthorityIndexEntry(ctx, authority.BondId, name) + return nil +} + +// ProcessDeleteName removes a CRN -> Record ID mapping. +func (k Keeper) ProcessDeleteName(ctx sdk.Context, msg types.MsgDeleteNameAuthority) error { + signerAddress, err := sdk.AccAddressFromBech32(msg.Signer) + if err != nil { + return err + } + err = k.checkCRNAccess(ctx, signerAddress, msg.Crn) + if err != nil { + return err + } + + if !k.HasNameRecord(ctx, msg.Crn) { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Name not found.") + } + + // Set CID to empty string. + k.SetNameRecord(ctx, msg.Crn, "") + + return nil +} + +func (k Keeper) GetAuthorityExpiryQueue(ctx sdk.Context) []*types.ExpiryQueueRecord { + var authorities []*types.ExpiryQueueRecord + + store := ctx.KVStore(k.storeKey) + itr := sdk.KVStorePrefixIterator(store, PrefixExpiryTimeToAuthoritiesIndex) + defer itr.Close() + for ; itr.Valid(); itr.Next() { + var record []string + record, err := helpers.BytesArrToStringArr(itr.Value()) + if err != nil { + return authorities + } + authorities = append(authorities, &types.ExpiryQueueRecord{ + Id: string(itr.Key()[len(PrefixExpiryTimeToAuthoritiesIndex):]), + Value: record, + }) + } + + return authorities +} + +// ResolveCRN resolves a CRN to a record. +func (k Keeper) ResolveCRN(ctx sdk.Context, crn string) *types.Record { + _, _, authority, err := k.getAuthority(ctx, crn) + if err != nil || authority.Status != types.AuthorityActive { + // If authority is not active (or any other error), resolution fails. + return nil + } + + // Name should not resolve if it's stale. + // i.e. authority was registered later than the name. + record, nameRecord := ResolveCRN(ctx.KVStore(k.storeKey), crn, k, ctx) + if authority.Height > nameRecord.Latest.Height { + return nil + } + + return record +} + +// ResolveCRN resolves a CRN to a record. +func ResolveCRN(store sdk.KVStore, crn string, k Keeper, c sdk.Context) (*types.Record, *types.NameRecord) { + nameKey := GetNameRecordIndexKey(crn) + + if store.Has(nameKey) { + bz := store.Get(nameKey) + var obj types.NameRecord + k.cdc.MustUnmarshal(bz, &obj) + + recordExists := k.HasRecord(c, obj.Latest.Id) + if !recordExists || obj.Latest.Id == "" { + return nil, &obj + } + + record := k.GetRecord(c, obj.Latest.Id) + return &record, &obj + } + + return nil, nil +} + +func getAuthorityExpiryQueueTimeKey(timestamp time.Time) []byte { + timeBytes := sdk.FormatTimeBytes(timestamp) + return append(PrefixExpiryTimeToAuthoritiesIndex, timeBytes...) +} + +func (k Keeper) InsertAuthorityExpiryQueue(ctx sdk.Context, name string, expiryTime time.Time) { + timeSlice := k.GetAuthorityExpiryQueueTimeSlice(ctx, expiryTime) + timeSlice = append(timeSlice, name) + k.SetAuthorityExpiryQueueTimeSlice(ctx, expiryTime, timeSlice) +} + +func (k Keeper) GetAuthorityExpiryQueueTimeSlice(ctx sdk.Context, timestamp time.Time) []string { + store := ctx.KVStore(k.storeKey) + + bz := store.Get(getAuthorityExpiryQueueTimeKey(timestamp)) + if bz == nil { + return []string{} + } + + names, err := helpers.BytesArrToStringArr(bz) + if err != nil { + return []string{} + } + + return names +} + +func (k Keeper) SetAuthorityExpiryQueueTimeSlice(ctx sdk.Context, timestamp time.Time, names []string) { + store := ctx.KVStore(k.storeKey) + bz, _ := helpers.StrArrToBytesArr(names) + store.Set(getAuthorityExpiryQueueTimeKey(timestamp), bz) +} + +// ProcessAuthorityExpiryQueue tries to renew expiring authorities (by collecting rent) else marks them as expired. +func (k Keeper) ProcessAuthorityExpiryQueue(ctx sdk.Context) { + names := k.GetAllExpiredAuthorities(ctx, ctx.BlockHeader().Time) + for _, name := range names { + authority := k.GetNameAuthority(ctx, name) + + // If authority doesn't have an associated bond or if bond no longer exists, mark it expired. + if authority.BondId == "" || !k.bondKeeper.HasBond(ctx, authority.BondId) { + authority.Status = types.AuthorityExpired + k.SetNameAuthority(ctx, name, &authority) + k.DeleteAuthorityExpiryQueue(ctx, name, authority) + + ctx.Logger().Info(fmt.Sprintf("Marking authority expired as no bond present: %s", name)) + + return + } + + // Try to renew the authority by taking rent. + k.TryTakeAuthorityRent(ctx, name, authority) + } +} + +// DeleteAuthorityExpiryQueueTimeSlice deletes a specific authority expiry queue timeslice. +func (k Keeper) DeleteAuthorityExpiryQueueTimeSlice(ctx sdk.Context, timestamp time.Time) { + store := ctx.KVStore(k.storeKey) + store.Delete(getAuthorityExpiryQueueTimeKey(timestamp)) +} + +// DeleteAuthorityExpiryQueue deletes an authority name from the authority expiry queue. +func (k Keeper) DeleteAuthorityExpiryQueue(ctx sdk.Context, name string, authority types.NameAuthority) { + timeSlice := k.GetAuthorityExpiryQueueTimeSlice(ctx, authority.ExpiryTime) + newTimeSlice := []string{} + + for _, existingName := range timeSlice { + if !bytes.Equal([]byte(existingName), []byte(name)) { + newTimeSlice = append(newTimeSlice, existingName) + } + } + + if len(newTimeSlice) == 0 { + k.DeleteAuthorityExpiryQueueTimeSlice(ctx, authority.ExpiryTime) + } else { + k.SetAuthorityExpiryQueueTimeSlice(ctx, authority.ExpiryTime, newTimeSlice) + } +} + +// GetAllExpiredAuthorities returns a concatenated list of all the timeslices before currTime. +func (k Keeper) GetAllExpiredAuthorities(ctx sdk.Context, currTime time.Time) (expiredAuthorityNames []string) { + // Gets an iterator for all timeslices from time 0 until the current block header time. + itr := k.AuthorityExpiryQueueIterator(ctx, ctx.BlockHeader().Time) + defer itr.Close() + + for ; itr.Valid(); itr.Next() { + timeslice := []string{} + timeslice, err := helpers.BytesArrToStringArr(itr.Value()) + + if err != nil { + panic(err) + } + + expiredAuthorityNames = append(expiredAuthorityNames, timeslice...) + } + + return expiredAuthorityNames +} + +// AuthorityExpiryQueueIterator returns all the authority expiry queue timeslices from time 0 until endTime. +func (k Keeper) AuthorityExpiryQueueIterator(ctx sdk.Context, endTime time.Time) sdk.Iterator { + store := ctx.KVStore(k.storeKey) + rangeEndBytes := sdk.InclusiveEndBytes(getAuthorityExpiryQueueTimeKey(endTime)) + return store.Iterator(PrefixExpiryTimeToAuthoritiesIndex, rangeEndBytes) +} + +// TryTakeAuthorityRent tries to take rent from the authority bond. +func (k Keeper) TryTakeAuthorityRent(ctx sdk.Context, name string, authority types.NameAuthority) { + ctx.Logger().Info(fmt.Sprintf("Trying to take rent for authority: %s", name)) + + params := k.GetParams(ctx) + rent := params.AuthorityRent + sdkErr := k.bondKeeper.TransferCoinsToModuleAccount(ctx, authority.BondId, types.AuthorityRentModuleAccountName, sdk.NewCoins(rent)) + + if sdkErr != nil { + // Insufficient funds, mark authority as expired. + authority.Status = types.AuthorityExpired + k.SetNameAuthority(ctx, name, &authority) + k.DeleteAuthorityExpiryQueue(ctx, name, authority) + + ctx.Logger().Info(fmt.Sprintf("Insufficient funds in owner account to pay authority rent, marking as expired: %s", name)) + + return + } + + // Delete old expiry queue entry, create new one. + k.DeleteAuthorityExpiryQueue(ctx, name, authority) + authority.ExpiryTime = ctx.BlockTime().Add(params.AuthorityRentDuration) + k.InsertAuthorityExpiryQueue(ctx, name, authority.ExpiryTime) + + // Save authority. + authority.Status = types.AuthorityActive + k.SetNameAuthority(ctx, name, &authority) + k.AddBondToAuthorityIndexEntry(ctx, authority.BondId, name) + + ctx.Logger().Info(fmt.Sprintf("Authority rent paid successfully: %s", name)) +} + +// ListNameAuthorityRecords - get all name authority records. +func (k Keeper) ListNameAuthorityRecords(ctx sdk.Context) map[string]types.NameAuthority { + nameAuthorityRecords := make(map[string]types.NameAuthority) + store := ctx.KVStore(k.storeKey) + + itr := sdk.KVStorePrefixIterator(store, PrefixNameAuthorityRecordIndex) + defer itr.Close() + for ; itr.Valid(); itr.Next() { + bz := store.Get(itr.Key()) + if bz != nil { + var record types.NameAuthority + k.cdc.MustUnmarshal(bz, &record) + nameAuthorityRecords[string(itr.Key()[len(PrefixNameAuthorityRecordIndex):])] = record + } + } + + return nameAuthorityRecords +} diff --git a/x/nameservice/keeper/params.go b/x/nameservice/keeper/params.go new file mode 100644 index 00000000..da9c8360 --- /dev/null +++ b/x/nameservice/keeper/params.go @@ -0,0 +1,17 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/tharsis/ethermint/x/nameservice/types" +) + +// GetParams - Get all parameters as types.Params. +func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { + k.paramSubspace.GetParamSet(ctx, ¶ms) + return +} + +// SetParams - set the params. +func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { + k.paramSubspace.SetParamSet(ctx, ¶ms) +} diff --git a/x/nameservice/keeper/record_keeper.go b/x/nameservice/keeper/record_keeper.go new file mode 100644 index 00000000..2a856e32 --- /dev/null +++ b/x/nameservice/keeper/record_keeper.go @@ -0,0 +1,306 @@ +package keeper + +import ( + "fmt" + "time" + + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + auctionkeeper "github.com/tharsis/ethermint/x/auction/keeper" + auctiontypes "github.com/tharsis/ethermint/x/auction/types" + bondtypes "github.com/tharsis/ethermint/x/bond/types" + "github.com/tharsis/ethermint/x/nameservice/types" +) + +// RecordKeeper exposes the bare minimal read-only API for other modules. +type RecordKeeper struct { + auctionKeeper auctionkeeper.Keeper + storeKey sdk.StoreKey // Unexposed key to access store from sdk.Context + cdc codec.BinaryCodec // The wire codec for binary encoding/decoding. +} + +func (k RecordKeeper) UsesAuction(ctx sdk.Context, auctionID string) bool { + return k.GetAuctionToAuthorityMapping(ctx, auctionID) != "" +} + +func (k RecordKeeper) OnAuction(ctx sdk.Context, auctionId string) { + updateBlockChangeSetForAuction(ctx, k, auctionId) +} + +func (k RecordKeeper) OnAuctionBid(ctx sdk.Context, auctionID string, bidderAddress string) { + updateBlockChangeSetForAuctionBid(ctx, k, auctionID, bidderAddress) +} + +func (k RecordKeeper) OnAuctionWinnerSelected(ctx sdk.Context, auctionID string) { + // Update authority status based on auction status/winner. + name := k.GetAuctionToAuthorityMapping(ctx, auctionID) + if name == "" { + // We don't know about this auction, ignore. + ctx.Logger().Info(fmt.Sprintf("Ignoring auction notification, name mapping not found: %s", auctionID)) + return + } + + store := ctx.KVStore(k.storeKey) + if !HasNameAuthority(store, name) { + // We don't know about this authority, ignore. + ctx.Logger().Info(fmt.Sprintf("Ignoring auction notification, authority not found: %s", auctionID)) + return + } + + authority := GetNameAuthority(store, k.cdc, name) + auctionObj := k.auctionKeeper.GetAuction(ctx, auctionID) + + if auctionObj.Status == auctiontypes.AuctionStatusCompleted { + store := ctx.KVStore(k.storeKey) + + if auctionObj.WinnerAddress != "" { + // Mark authority owner and change status to active. + authority.OwnerAddress = auctionObj.WinnerAddress + authority.Status = types.AuthorityActive + + // Reset bond ID if required, as owner has changed. + if authority.BondId != "" { + RemoveBondToAuthorityIndexEntry(store, authority.BondId, name) + authority.BondId = "" + } + + // Update height for updated/changed authority (owner). + // Can be used to check if names are older than the authority itself (stale names). + authority.Height = uint64(ctx.BlockHeight()) + + ctx.Logger().Info(fmt.Sprintf("Winner selected, marking authority as active: %s", name)) + } else { + // Mark as expired. + authority.Status = types.AuthorityExpired + + ctx.Logger().Info(fmt.Sprintf("No winner, marking authority as expired: %s", name)) + } + + authority.AuctionId = "" + SetNameAuthority(ctx, store, k.cdc, name, &authority) + + // Forget about this auction now, we no longer need it. + removeAuctionToAuthorityMapping(store, auctionID) + } else { + ctx.Logger().Info(fmt.Sprintf("Ignoring auction notification, status: %s", auctionObj.Status)) + } +} + +// Record keeper implements the bond usage keeper interface. +var _ bondtypes.BondUsageKeeper = (*RecordKeeper)(nil) +var _ auctiontypes.AuctionUsageKeeper = (*RecordKeeper)(nil) + +// ModuleName returns the module name. +func (k RecordKeeper) ModuleName() string { + return types.ModuleName +} + +func (k RecordKeeper) GetAuctionToAuthorityMapping(ctx sdk.Context, auctionID string) string { + store := ctx.KVStore(k.storeKey) + + auctionToAuthorityIndexKey := GetAuctionToAuthorityIndexKey(auctionID) + if store.Has(auctionToAuthorityIndexKey) { + bz := store.Get(auctionToAuthorityIndexKey) + return string(bz) + } + return "" +} + +// UsesBond returns true if the bond has associated records. +func (k RecordKeeper) UsesBond(ctx sdk.Context, bondId string) bool { + bondIDPrefix := append(PrefixBondIDToRecordsIndex, []byte(bondId)...) + store := ctx.KVStore(k.storeKey) + itr := sdk.KVStorePrefixIterator(store, bondIDPrefix) + defer itr.Close() + return itr.Valid() +} + +// RemoveBondToRecordIndexEntry removes the Bond ID -> [Record] index entry. +func (k Keeper) RemoveBondToRecordIndexEntry(ctx sdk.Context, bondID string, id string) { + store := ctx.KVStore(k.storeKey) + store.Delete(getBondIDToRecordsIndexKey(bondID, id)) +} + +// NewRecordKeeper creates new instances of the nameservice RecordKeeper +func NewRecordKeeper(auctionKeeper auctionkeeper.Keeper, storeKey sdk.StoreKey, cdc codec.BinaryCodec) RecordKeeper { + return RecordKeeper{ + auctionKeeper: auctionKeeper, + storeKey: storeKey, + cdc: cdc, + } +} + +// QueryRecordsByBond - get all records for the given bond. +func (k RecordKeeper) QueryRecordsByBond(ctx sdk.Context, bondID string) []types.Record { + var records []types.Record + + bondIDPrefix := append(PrefixBondIDToRecordsIndex, []byte(bondID)...) + store := ctx.KVStore(k.storeKey) + itr := sdk.KVStorePrefixIterator(store, bondIDPrefix) + defer itr.Close() + for ; itr.Valid(); itr.Next() { + cid := itr.Key()[len(bondIDPrefix):] + bz := store.Get(append(PrefixCIDToRecordIndex, cid...)) + if bz != nil { + var obj types.Record + k.cdc.MustUnmarshal(bz, &obj) + records = append(records, recordObjToRecord(store, k.cdc, obj)) + } + } + + return records +} + +// ProcessRenewRecord renews a record. +func (k Keeper) ProcessRenewRecord(ctx sdk.Context, msg types.MsgRenewRecord) error { + if !k.HasRecord(ctx, msg.RecordId) { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Record not found.") + } + + // Check if renewal is required (i.e. expired record marked as deleted). + record := k.GetRecord(ctx, msg.RecordId) + expiryTime, err := time.Parse(time.RFC3339, record.ExpiryTime) + + if err != nil { + panic(err) + } + + if !record.Deleted || expiryTime.After(ctx.BlockTime()) { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Renewal not required.") + } + + recordType := record.ToRecordType() + err = k.processRecord(ctx, &recordType, true) + if err != nil { + return err + } + + return nil +} + +// ProcessAssociateBond associates a record with a bond. +func (k Keeper) ProcessAssociateBond(ctx sdk.Context, msg types.MsgAssociateBond) error { + + if !k.HasRecord(ctx, msg.RecordId) { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Record not found.") + } + + if !k.bondKeeper.HasBond(ctx, msg.BondId) { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Bond not found.") + } + + // Check if already associated with a bond. + record := k.GetRecord(ctx, msg.RecordId) + if record.BondId != "" || len(record.BondId) != 0 { + return sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Bond already exists.") + } + + // Only the bond owner can associate a record with the bond. + bond := k.bondKeeper.GetBond(ctx, msg.BondId) + if msg.Signer != bond.Owner { + return sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Bond owner mismatch.") + } + + record.BondId = msg.BondId + k.PutRecord(ctx, record) + k.AddBondToRecordIndexEntry(ctx, msg.BondId, msg.RecordId) + + // Required so that renewal is triggered (with new bond ID) for expired records. + if record.Deleted { + k.InsertRecordExpiryQueue(ctx, record) + } + + return nil +} + +// ProcessDissociateBond dissociates a record from its bond. +func (k Keeper) ProcessDissociateBond(ctx sdk.Context, msg types.MsgDissociateBond) error { + if !k.HasRecord(ctx, msg.RecordId) { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Record not found.") + } + + // Check if associated with a bond. + record := k.GetRecord(ctx, msg.RecordId) + bondID := record.BondId + if bondID == "" || len(bondID) == 0 { + return sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Bond not found.") + } + + // Only the bond owner can dissociate a record from the bond. + bond := k.bondKeeper.GetBond(ctx, bondID) + if msg.Signer != bond.Owner { + return sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Bond owner mismatch.") + } + + // Clear bond ID. + record.BondId = "" + k.PutRecord(ctx, record) + k.RemoveBondToRecordIndexEntry(ctx, bondID, record.Id) + + return nil +} + +// ProcessDissociateRecords dissociates all records associated with a given bond. +func (k Keeper) ProcessDissociateRecords(ctx sdk.Context, msg types.MsgDissociateRecords) error { + if !k.bondKeeper.HasBond(ctx, msg.BondId) { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Bond not found.") + } + + // Only the bond owner can dissociate all records from the bond. + bond := k.bondKeeper.GetBond(ctx, msg.BondId) + if msg.Signer != bond.Owner { + return sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Bond owner mismatch.") + } + + // Dissociate all records from the bond. + records := k.recordKeeper.QueryRecordsByBond(ctx, msg.BondId) + for _, record := range records { + // Clear bond ID. + record.BondId = "" + k.PutRecord(ctx, record) + k.RemoveBondToRecordIndexEntry(ctx, msg.BondId, record.Id) + } + + return nil +} + +// ProcessReAssociateRecords switches records from and old to new bond. +func (k Keeper) ProcessReAssociateRecords(ctx sdk.Context, msg types.MsgReAssociateRecords) error { + if !k.bondKeeper.HasBond(ctx, msg.OldBondId) { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Old bond not found.") + } + + if !k.bondKeeper.HasBond(ctx, msg.NewBondId) { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "New bond not found.") + } + + // Only the bond owner can re-associate all records. + oldBond := k.bondKeeper.GetBond(ctx, msg.OldBondId) + if msg.Signer != oldBond.Owner { + return sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Old bond owner mismatch.") + } + + newBond := k.bondKeeper.GetBond(ctx, msg.NewBondId) + if msg.Signer != newBond.Owner { + return sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "New bond owner mismatch.") + } + + // Re-associate all records. + records := k.recordKeeper.QueryRecordsByBond(ctx, msg.OldBondId) + for _, record := range records { + // Switch bond ID. + record.BondId = msg.NewBondId + k.PutRecord(ctx, record) + + k.RemoveBondToRecordIndexEntry(ctx, msg.OldBondId, record.Id) + k.AddBondToRecordIndexEntry(ctx, msg.NewBondId, record.Id) + + // Required so that renewal is triggered (with new bond ID) for expired records. + if record.Deleted { + k.InsertRecordExpiryQueue(ctx, record) + } + } + + return nil +} diff --git a/x/nameservice/keeper/sync.go b/x/nameservice/keeper/sync.go new file mode 100644 index 00000000..e0de1d35 --- /dev/null +++ b/x/nameservice/keeper/sync.go @@ -0,0 +1,99 @@ +package keeper + +import ( + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/tharsis/ethermint/x/nameservice/helpers" + "github.com/tharsis/ethermint/x/nameservice/types" +) + +func GetBlockChangeSetIndexKey(height int64) []byte { + return append(PrefixBlockChangesetIndex, helpers.Int64ToBytes(height)...) +} + +func getOrCreateBlockChangeset(store sdk.KVStore, codec codec.BinaryCodec, height int64) *types.BlockChangeSet { + bz := store.Get(GetBlockChangeSetIndexKey(height)) + + if bz != nil { + var changeSet types.BlockChangeSet + err := codec.Unmarshal(bz, &changeSet) + if err != nil { + return nil + } + return &changeSet + } + + return &types.BlockChangeSet{ + Height: height, + Records: []string{}, + Names: []string{}, + Auctions: []string{}, + AuctionBids: []*types.AuctionBidInfo{}, + } +} + +func updateBlockChangeSetForAuction(ctx sdk.Context, k RecordKeeper, id string) { + changeSet := getOrCreateBlockChangeset(ctx.KVStore(k.storeKey), k.cdc, ctx.BlockHeight()) + + found := false + for _, elem := range changeSet.Auctions { + if id == elem { + found = true + break + } + } + + if !found { + changeSet.Auctions = append(changeSet.Auctions, id) + saveBlockChangeSet(ctx.KVStore(k.storeKey), k.cdc, changeSet) + } +} + +func saveBlockChangeSet(store sdk.KVStore, codec codec.BinaryCodec, changeset *types.BlockChangeSet) { + bz := codec.MustMarshal(changeset) + store.Set(GetBlockChangeSetIndexKey(changeset.Height), bz) +} + +func (k Keeper) saveBlockChangeSet(ctx sdk.Context, changeSet *types.BlockChangeSet) { + saveBlockChangeSet(ctx.KVStore(k.storeKey), k.cdc, changeSet) +} + +func (k Keeper) updateBlockChangeSetForRecord(ctx sdk.Context, id string) { + changeSet := k.getOrCreateBlockChangeSet(ctx, ctx.BlockHeight()) + changeSet.Records = append(changeSet.Records, id) + k.saveBlockChangeSet(ctx, changeSet) +} + +func (k Keeper) getOrCreateBlockChangeSet(ctx sdk.Context, height int64) *types.BlockChangeSet { + store := ctx.KVStore(k.storeKey) + bz := store.Get(GetBlockChangeSetIndexKey(height)) + + if bz != nil { + var changeSet types.BlockChangeSet + err := k.cdc.Unmarshal(bz, &changeSet) + if err != nil { + return nil + } + return &changeSet + } + + return &types.BlockChangeSet{ + Height: height, + Records: []string{}, + Names: []string{}, + Auctions: []string{}, + AuctionBids: []*types.AuctionBidInfo{}, + } +} + +func updateBlockChangeSetForAuctionBid(ctx sdk.Context, k RecordKeeper, id, bidderAddress string) { + changeSet := getOrCreateBlockChangeset(ctx.KVStore(k.storeKey), k.cdc, ctx.BlockHeight()) + changeSet.AuctionBids = append(changeSet.AuctionBids, &types.AuctionBidInfo{AuctionId: id, BidderAddress: bidderAddress}) + saveBlockChangeSet(ctx.KVStore(k.storeKey), k.cdc, changeSet) +} + +func updateBlockChangeSetForNameAuthority(ctx sdk.Context, codec codec.BinaryCodec, store sdk.KVStore, name string) { + changeSet := getOrCreateBlockChangeset(store, codec, ctx.BlockHeight()) + changeSet.Authorities = append(changeSet.Authorities, name) + saveBlockChangeSet(store, codec, changeSet) +} diff --git a/x/nameservice/module.go b/x/nameservice/module.go new file mode 100644 index 00000000..d1011fc7 --- /dev/null +++ b/x/nameservice/module.go @@ -0,0 +1,134 @@ +package nameservice + +import ( + "context" + "encoding/json" + "fmt" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + "github.com/gorilla/mux" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/spf13/cobra" + abci "github.com/tendermint/tendermint/abci/types" + "github.com/tharsis/ethermint/x/nameservice/client/cli" + "github.com/tharsis/ethermint/x/nameservice/keeper" + "github.com/tharsis/ethermint/x/nameservice/types" +) + +// type check to ensure the interface is properly implemented +var ( + _ module.AppModule = AppModule{} + _ module.AppModuleBasic = AppModuleBasic{} +) + +// AppModuleBasic _ app module Basics object +type AppModuleBasic struct{} + +func (a AppModuleBasic) Name() string { + return types.ModuleName +} + +func (a AppModuleBasic) RegisterLegacyAminoCodec(amino *codec.LegacyAmino) { + types.RegisterLegacyAminoCodec(amino) +} + +func (a AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry) { + types.RegisterInterfaces(registry) +} + +func (a AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { + return cdc.MustMarshalJSON(types.DefaultGenesisState()) +} + +func (a AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, message json.RawMessage) error { + var data types.GenesisState + if err := cdc.UnmarshalJSON(message, &data); err != nil { + return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) + } + + return types.ValidateGenesis(data) +} + +func (a AppModuleBasic) RegisterRESTRoutes(context client.Context, router *mux.Router) { +} + +func (a AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { + err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)) + if err != nil { + panic(err) + } +} + +func (a AppModuleBasic) GetTxCmd() *cobra.Command { + return cli.NewTxCmd() +} + +func (a AppModuleBasic) GetQueryCmd() *cobra.Command { + return cli.GetQueryCmd() +} + +type AppModule struct { + AppModuleBasic + keeper keeper.Keeper +} + +func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, message json.RawMessage) []abci.ValidatorUpdate { + var genesisState types.GenesisState + + cdc.MustUnmarshalJSON(message, &genesisState) + + return InitGenesis(ctx, am.keeper, genesisState) +} + +func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { + gs := ExportGenesis(ctx, am.keeper) + return cdc.MustMarshalJSON(&gs) +} + +func (am AppModule) RegisterInvariants(registry sdk.InvariantRegistry) { + keeper.RegisterInvariants(registry, am.keeper) +} + +func (am AppModule) Route() sdk.Route { + return sdk.Route{} +} + +func (am AppModule) QuerierRoute() string { + return types.QuerierRoute +} + +func (am AppModule) LegacyQuerierHandler(amino *codec.LegacyAmino) sdk.Querier { + return nil +} + +func (am AppModule) RegisterServices(cfg module.Configurator) { + + querier := keeper.Querier{Keeper: am.keeper} + types.RegisterQueryServer(cfg.QueryServer(), querier) + + msgServer := keeper.NewMsgServerImpl(am.keeper) + types.RegisterMsgServer(cfg.MsgServer(), msgServer) +} + +func (am AppModule) ConsensusVersion() uint64 { + return 1 +} + +func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { + BeginBlocker(ctx, am.keeper) +} + +func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { + return EndBlocker(ctx, am.keeper) +} + +// NewAppModule creates a new AppModule Object +func NewAppModule(k keeper.Keeper) AppModule { + return AppModule{ + AppModuleBasic: AppModuleBasic{}, + keeper: k, + } +} diff --git a/x/nameservice/types/codec.go b/x/nameservice/types/codec.go new file mode 100644 index 00000000..fc97b989 --- /dev/null +++ b/x/nameservice/types/codec.go @@ -0,0 +1,53 @@ +package types + +import ( + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/types" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/msgservice" +) + +// RegisterLegacyAminoCodec registers the necessary x/bond interfaces and concrete types +// on the provided LegacyAmino codec. These types are used for Amino JSON serialization. +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + cdc.RegisterConcrete(&MsgSetName{}, "nameservice/SetName", nil) + cdc.RegisterConcrete(&MsgReserveAuthority{}, "nameservice/ReserveAuthority", nil) + cdc.RegisterConcrete(&MsgDeleteNameAuthority{}, "nameservice/DeleteAuthority", nil) + cdc.RegisterConcrete(&MsgSetAuthorityBond{}, "nameservice/SetAuthorityBond", nil) + + cdc.RegisterConcrete(&MsgSetRecord{}, "nameservice/SetRecord", nil) + cdc.RegisterConcrete(&MsgRenewRecord{}, "nameservice/RenewRecord", nil) + cdc.RegisterConcrete(&MsgAssociateBond{}, "nameservice/AssociateBond", nil) + cdc.RegisterConcrete(&MsgDissociateBond{}, "nameservice/DissociateBond", nil) + cdc.RegisterConcrete(&MsgDissociateRecords{}, "nameservice/DissociateRecords", nil) + cdc.RegisterConcrete(&MsgReAssociateRecords{}, "nameservice/ReassociateRecords", nil) +} + +func RegisterInterfaces(registry types.InterfaceRegistry) { + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgSetName{}, + &MsgReserveAuthority{}, + &MsgDeleteNameAuthority{}, + &MsgSetAuthorityBond{}, + + &MsgSetRecord{}, + &MsgRenewRecord{}, + &MsgAssociateBond{}, + &MsgDissociateBond{}, + &MsgDissociateRecords{}, + &MsgReAssociateRecords{}, + ) + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) +} + +var ( + amino = codec.NewLegacyAmino() + ModuleCdc = codec.NewAminoCodec(amino) +) + +func init() { + RegisterLegacyAminoCodec(amino) + cryptocodec.RegisterCrypto(amino) + amino.Seal() +} diff --git a/x/nameservice/types/events.go b/x/nameservice/types/events.go new file mode 100644 index 00000000..d376f131 --- /dev/null +++ b/x/nameservice/types/events.go @@ -0,0 +1,25 @@ +package types + +const ( + EventTypeSetRecord = "set" + EventTypeDeleteName = "delete-name" + EventTypeReserveNameAuthority = "reserve-authority" + EventTypeAuthorityBond = "authority-bond" + EventTypeRenewRecord = "renew-record" + EventTypeAssociateBond = "associate-bond" + EventTypeDissociateBond = "dissociate-bond" + EventTypeDissociateRecords = "dissociate-record" + EventTypeReAssociateRecords = "re-associate-records" + + AttributeKeySigner = "signer" + AttributeKeyOwner = "owner" + AttributeKeyBondId = "bond-id" + AttributeKeyPayload = "payload" + AttributeKeyOldBondId = "old-bond-id" + AttributeKeyNewBondId = "new-bond-id" + AttributeKeyCID = "cid" + AttributeKeyName = "name" + AttributeKeyCRN = "crn" + AttributeKeyRecordId = "record-id" + AttributeValueCategory = ModuleName +) diff --git a/x/nameservice/types/genesis.go b/x/nameservice/types/genesis.go new file mode 100644 index 00000000..b49d2a95 --- /dev/null +++ b/x/nameservice/types/genesis.go @@ -0,0 +1,27 @@ +package types + +func NewGenesisState(params Params, records []Record, authorities []AuthorityEntry, names []NameEntry) GenesisState { + return GenesisState{ + Params: params, + Records: records, + Authorities: authorities, + Names: names, + } +} + +// DefaultGenesisState sets default evm genesis state with empty accounts and default params and +// chain config values. +func DefaultGenesisState() *GenesisState { + return &GenesisState{ + Params: DefaultParams(), + } +} + +func ValidateGenesis(data GenesisState) error { + err := data.Params.Validate() + if err != nil { + return err + } + + return nil +} diff --git a/x/nameservice/types/genesis.pb.go b/x/nameservice/types/genesis.pb.go new file mode 100644 index 00000000..b6ea3a41 --- /dev/null +++ b/x/nameservice/types/genesis.pb.go @@ -0,0 +1,522 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: vulcanize/nameservice/v1beta1/genesis.proto + +package types + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/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 nameservice module's genesis state. +type GenesisState struct { + // params defines all the params of nameservice module. + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` + // records + Records []Record `protobuf:"bytes,2,rep,name=records,proto3" json:"records" json:"records" yaml:"records"` + // authorities + Authorities []AuthorityEntry `protobuf:"bytes,3,rep,name=authorities,proto3" json:"authorities" json:"authorities" yaml:"authorities"` + // names + Names []NameEntry `protobuf:"bytes,4,rep,name=names,proto3" json:"names" json:"names" yaml:"names"` +} + +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_fe7037a2b22e67ef, []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 (m *GenesisState) GetRecords() []Record { + if m != nil { + return m.Records + } + return nil +} + +func (m *GenesisState) GetAuthorities() []AuthorityEntry { + if m != nil { + return m.Authorities + } + return nil +} + +func (m *GenesisState) GetNames() []NameEntry { + if m != nil { + return m.Names + } + return nil +} + +func init() { + proto.RegisterType((*GenesisState)(nil), "vulcanize.nameservice.v1beta1.GenesisState") +} + +func init() { + proto.RegisterFile("vulcanize/nameservice/v1beta1/genesis.proto", fileDescriptor_fe7037a2b22e67ef) +} + +var fileDescriptor_fe7037a2b22e67ef = []byte{ + // 347 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0xd2, 0xb1, 0x4a, 0xfb, 0x40, + 0x1c, 0x07, 0xf0, 0xe4, 0xdf, 0xfe, 0x2b, 0xa4, 0x4e, 0xc1, 0x21, 0x16, 0x9a, 0xd6, 0x42, 0xa1, + 0x20, 0xcd, 0x59, 0xdd, 0xdc, 0x8c, 0x88, 0xe0, 0x20, 0x12, 0x37, 0xb7, 0x6b, 0xfc, 0x99, 0x9c, + 0x34, 0xb9, 0x72, 0xf7, 0x6b, 0x31, 0x0e, 0x3e, 0x83, 0x4f, 0xe0, 0xf3, 0x74, 0xec, 0xe8, 0x54, + 0xa4, 0x7d, 0x03, 0x9f, 0x40, 0x7a, 0x97, 0x68, 0x5c, 0x5a, 0xb7, 0x5c, 0xf8, 0x7e, 0xbf, 0x9f, + 0x40, 0xce, 0x3a, 0x9c, 0x4e, 0x46, 0x21, 0x4d, 0xd9, 0x33, 0x90, 0x94, 0x26, 0x20, 0x41, 0x4c, + 0x59, 0x08, 0x64, 0x3a, 0x18, 0x02, 0xd2, 0x01, 0x89, 0x20, 0x05, 0xc9, 0xa4, 0x37, 0x16, 0x1c, + 0xb9, 0xdd, 0xfc, 0x0e, 0x7b, 0xa5, 0xb0, 0x97, 0x87, 0x1b, 0x7b, 0x11, 0x8f, 0xb8, 0x4a, 0x92, + 0xf5, 0x93, 0x2e, 0x35, 0xc8, 0x66, 0xa1, 0x3c, 0xa4, 0x0a, 0x9d, 0xb7, 0x8a, 0xb5, 0x7b, 0xa9, + 0xdd, 0x5b, 0xa4, 0x08, 0xf6, 0xb9, 0x55, 0x1b, 0x53, 0x41, 0x13, 0xe9, 0x98, 0x6d, 0xb3, 0x57, + 0x3f, 0xee, 0x7a, 0x1b, 0xbf, 0xc3, 0xbb, 0x51, 0x61, 0xbf, 0x3a, 0x5b, 0xb4, 0x8c, 0x20, 0xaf, + 0xda, 0x0f, 0xd6, 0x8e, 0x80, 0x90, 0x8b, 0x7b, 0xe9, 0xfc, 0x6b, 0x57, 0xfe, 0xb0, 0x12, 0xa8, + 0xb4, 0xdf, 0x5d, 0xaf, 0x7c, 0x2e, 0x5a, 0xcd, 0x47, 0xc9, 0xd3, 0xd3, 0x4e, 0xbe, 0xd1, 0x69, + 0x67, 0x34, 0x19, 0xfd, 0x1c, 0x83, 0x62, 0xdc, 0x7e, 0xb1, 0xea, 0x74, 0x82, 0x31, 0x17, 0x0c, + 0x19, 0x48, 0xa7, 0xa2, 0xac, 0xfe, 0x16, 0xeb, 0x2c, 0x6f, 0x64, 0x17, 0x29, 0x8a, 0xcc, 0xef, + 0xe7, 0x66, 0x57, 0x9b, 0xa5, 0xbd, 0xc2, 0x2d, 0xbf, 0x0a, 0xca, 0xa0, 0x4d, 0xad, 0xff, 0x4a, + 0x70, 0xaa, 0x4a, 0xee, 0x6d, 0x91, 0xaf, 0x69, 0x02, 0x1a, 0x3d, 0xc8, 0xd1, 0x7d, 0x8d, 0xaa, + 0x70, 0xc1, 0xe9, 0x43, 0xa0, 0x97, 0xfd, 0xab, 0xd9, 0xd2, 0x35, 0xe7, 0x4b, 0xd7, 0xfc, 0x58, + 0xba, 0xe6, 0xeb, 0xca, 0x35, 0xe6, 0x2b, 0xd7, 0x78, 0x5f, 0xb9, 0xc6, 0xdd, 0x51, 0xc4, 0x30, + 0x9e, 0x0c, 0xbd, 0x90, 0x27, 0x04, 0x63, 0x2a, 0x24, 0x93, 0x04, 0x30, 0x06, 0x91, 0xb0, 0x14, + 0xc9, 0xd3, 0xaf, 0x0b, 0x80, 0xd9, 0x18, 0xe4, 0xb0, 0xa6, 0xfe, 0xf9, 0xc9, 0x57, 0x00, 0x00, + 0x00, 0xff, 0xff, 0xbe, 0x6b, 0x6e, 0x5b, 0x88, 0x02, 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 + if len(m.Names) > 0 { + for iNdEx := len(m.Names) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Names[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + if len(m.Authorities) > 0 { + for iNdEx := len(m.Authorities) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Authorities[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.Records) > 0 { + for iNdEx := len(m.Records) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Records[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + 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)) + if len(m.Records) > 0 { + for _, e := range m.Records { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.Authorities) > 0 { + for _, e := range m.Authorities { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.Names) > 0 { + for _, e := range m.Names { + l = e.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 + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Records", 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 + } + m.Records = append(m.Records, Record{}) + if err := m.Records[len(m.Records)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authorities", 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 + } + m.Authorities = append(m.Authorities, AuthorityEntry{}) + if err := m.Authorities[len(m.Authorities)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Names", 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 + } + m.Names = append(m.Names, NameEntry{}) + if err := m.Names[len(m.Names)-1].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/nameservice/types/keys.go b/x/nameservice/types/keys.go new file mode 100644 index 00000000..5e142cab --- /dev/null +++ b/x/nameservice/types/keys.go @@ -0,0 +1,21 @@ +package types + +const ( + // ModuleName is the name of the staking module + ModuleName = "nameservice" + + // RecordRentModuleAccountName is the name of the module account that keeps track of record rents paid. + RecordRentModuleAccountName = "record_rent" + + // AuthorityRentModuleAccountName is the name of the module account that keeps track of authority rents paid. + AuthorityRentModuleAccountName = "authority_rent" + + // StoreKey is the string store representation + StoreKey = ModuleName + + // QuerierRoute is the querier route for the staking module + QuerierRoute = ModuleName + + // RouterKey is the msg router key for the staking module + RouterKey = ModuleName +) diff --git a/x/nameservice/types/msg.go b/x/nameservice/types/msg.go new file mode 100644 index 00000000..309ab017 --- /dev/null +++ b/x/nameservice/types/msg.go @@ -0,0 +1,189 @@ +package types + +import ( + "net/url" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +var ( + _ sdk.Msg = &MsgSetName{} + _ sdk.Msg = &MsgReserveAuthority{} + _ sdk.Msg = &MsgSetAuthorityBond{} + _ sdk.Msg = &MsgDeleteNameAuthority{} +) + +// NewMsgSetName is the constructor function for MsgSetName. +func NewMsgSetName(crn string, cid string, signer sdk.AccAddress) MsgSetName { + return MsgSetName{ + Crn: crn, + Cid: cid, + Signer: signer.String(), + } +} + +// Route Implements Msg. +func (msg MsgSetName) Route() string { return RouterKey } + +// Type Implements Msg. +func (msg MsgSetName) Type() string { return "set-name" } + +// ValidateBasic Implements Msg. +func (msg MsgSetName) ValidateBasic() error { + + if msg.Crn == "" { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "CRN is required.") + } + + if msg.Cid == "" { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "CID is required.") + } + + if len(msg.Signer) == 0 { + return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "invalid signer") + } + + return nil +} + +// GetSignBytes gets the sign bytes for the msg MsgSetName +func (msg MsgSetName) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +// GetSigners Implements Msg. +func (msg MsgSetName) GetSigners() []sdk.AccAddress { + accAddr, _ := sdk.AccAddressFromBech32(msg.Signer) + return []sdk.AccAddress{accAddr} +} + +// NewMsgReserveAuthority is the constructor function for MsgReserveName. +func NewMsgReserveAuthority(name string, signer sdk.AccAddress, owner sdk.AccAddress) MsgReserveAuthority { + return MsgReserveAuthority{ + Name: name, + Owner: owner.String(), + Signer: signer.String(), + } +} + +// Route Implements Msg. +func (msg MsgReserveAuthority) Route() string { return RouterKey } + +// Type Implements Msg. +func (msg MsgReserveAuthority) Type() string { return "reserve-authority" } + +// ValidateBasic Implements Msg. +func (msg MsgReserveAuthority) ValidateBasic() error { + + if len(msg.Name) == 0 { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "name is required.") + } + + if len(msg.Signer) == 0 { + return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "invalid signer") + } + + return nil +} + +// GetSignBytes gets the sign bytes for the msg MsgSetName +func (msg MsgReserveAuthority) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +// GetSigners Implements Msg. +func (msg MsgReserveAuthority) GetSigners() []sdk.AccAddress { + accAddr, _ := sdk.AccAddressFromBech32(msg.Signer) + return []sdk.AccAddress{accAddr} +} + +// NewMsgSetAuthorityBond is the constructor function for MsgSetAuthorityBond. +func NewMsgSetAuthorityBond(name string, bondId string, signer sdk.AccAddress) MsgSetAuthorityBond { + return MsgSetAuthorityBond{ + Name: name, + Signer: signer.String(), + BondId: bondId, + } +} + +// Route Implements Msg. +func (msg MsgSetAuthorityBond) Route() string { return RouterKey } + +// Type Implements Msg. +func (msg MsgSetAuthorityBond) Type() string { return "authority-bond" } + +// ValidateBasic Implements Msg. +func (msg MsgSetAuthorityBond) ValidateBasic() error { + if len(msg.Name) == 0 { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "name is required.") + } + + if len(msg.Signer) == 0 { + return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "invalid signer.") + } + + if len(msg.BondId) == 0 { + return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "bond id is required.") + } + + return nil +} + +// GetSignBytes gets the sign bytes for the msg MsgSetName +func (msg MsgSetAuthorityBond) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +// GetSigners Implements Msg. +func (msg MsgSetAuthorityBond) GetSigners() []sdk.AccAddress { + accAddr, _ := sdk.AccAddressFromBech32(msg.Signer) + return []sdk.AccAddress{accAddr} +} + +// NewMsgDeleteNameAuthority is the constructor function for MsgDeleteNameAuthority. +func NewMsgDeleteNameAuthority(crn string, signer sdk.AccAddress) MsgDeleteNameAuthority { + return MsgDeleteNameAuthority{ + Crn: crn, + Signer: signer.String(), + } +} + +// Route Implements Msg. +func (msg MsgDeleteNameAuthority) Route() string { return RouterKey } + +// Type Implements Msg. +func (msg MsgDeleteNameAuthority) Type() string { return "delete-name" } + +// ValidateBasic Implements Msg. +func (msg MsgDeleteNameAuthority) ValidateBasic() error { + if len(msg.Crn) == 0 { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "crn is required.") + } + + if len(msg.Signer) == 0 { + return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "invalid signer.") + } + + _, err := url.Parse(msg.Crn) + if err != nil { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "invalid crn.") + } + + return nil +} + +// GetSignBytes gets the sign bytes for the msg MsgSetName +func (msg MsgDeleteNameAuthority) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +// GetSigners Implements Msg. +func (msg MsgDeleteNameAuthority) GetSigners() []sdk.AccAddress { + accAddr, _ := sdk.AccAddressFromBech32(msg.Signer) + return []sdk.AccAddress{accAddr} +} diff --git a/x/nameservice/types/nameservice.pb.go b/x/nameservice/types/nameservice.pb.go new file mode 100644 index 00000000..655895e3 --- /dev/null +++ b/x/nameservice/types/nameservice.pb.go @@ -0,0 +1,3688 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: vulcanize/nameservice/v1beta1/nameservice.proto + +package types + +import ( + fmt "fmt" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + _ "google.golang.org/protobuf/types/known/durationpb" + _ "google.golang.org/protobuf/types/known/timestamppb" + io "io" + math "math" + math_bits "math/bits" + time "time" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// 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 nameservice module parameters +type Params struct { + RecordRent types.Coin `protobuf:"bytes,1,opt,name=record_rent,json=recordRent,proto3" json:"record_rent" json:"record_rent" yaml:"record_rent"` + RecordRentDuration time.Duration `protobuf:"bytes,2,opt,name=record_rent_duration,json=recordRentDuration,proto3,stdduration" json:"record_rent_duration" json:"record_rent_duration" yaml:"record_rent_duration"` + AuthorityRent types.Coin `protobuf:"bytes,3,opt,name=authority_rent,json=authorityRent,proto3" json:"authority_rent" json:"authority_rent" yaml:"authority_rent"` + AuthorityRentDuration time.Duration `protobuf:"bytes,4,opt,name=authority_rent_duration,json=authorityRentDuration,proto3,stdduration" json:"authority_rent_duration" json:"authority_rent_duration" yaml:"authority_rent_duration"` + AuthorityGracePeriod time.Duration `protobuf:"bytes,5,opt,name=authority_grace_period,json=authorityGracePeriod,proto3,stdduration" json:"authority_grace_period" json:"authority_grace_period" yaml:"authority_grace_period"` + AuthorityAuctionEnabled bool `protobuf:"varint,6,opt,name=authority_auction_enabled,json=authorityAuctionEnabled,proto3" json:"authority_auction_enabled,omitempty" json:"authority_auction_enabled" yaml:"authority_auction_enabled"` + AuthorityAuctionCommitsDuration time.Duration `protobuf:"bytes,7,opt,name=authority_auction_commits_duration,json=authorityAuctionCommitsDuration,proto3,stdduration" json:"authority_auction_commits_duration" json:"authority_auction_commits_duration" yaml:"authority_auction_commits_duration"` + AuthorityAuctionRevealsDuration time.Duration `protobuf:"bytes,8,opt,name=authority_auction_reveals_duration,json=authorityAuctionRevealsDuration,proto3,stdduration" json:"authority_auction_reveals_duration" json:"authority_auction_reveals_duration" yaml:"authority_auction_reveals_duration"` + AuthorityAuctionCommitFee types.Coin `protobuf:"bytes,9,opt,name=authority_auction_commit_fee,json=authorityAuctionCommitFee,proto3" json:"authority_auction_commit_fee" json:"authority_auction_commit_fee" yaml:"authority_auction_commit_fee"` + AuthorityAuctionRevealFee types.Coin `protobuf:"bytes,10,opt,name=authority_auction_reveal_fee,json=authorityAuctionRevealFee,proto3" json:"authority_auction_reveal_fee" json:"authority_auction_reveal_fee" yaml:"authority_auction_reveal_fee"` + AuthorityAuctionMinimumBid types.Coin `protobuf:"bytes,11,opt,name=authority_auction_minimum_bid,json=authorityAuctionMinimumBid,proto3" json:"authority_auction_minimum_bid" json:"authority_auction_minimum_bid" yaml:"authority_auction_minimum_bid"` +} + +func (m *Params) Reset() { *m = Params{} } +func (m *Params) String() string { return proto.CompactTextString(m) } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_c2009c2df775dbad, []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 (m *Params) GetRecordRent() types.Coin { + if m != nil { + return m.RecordRent + } + return types.Coin{} +} + +func (m *Params) GetRecordRentDuration() time.Duration { + if m != nil { + return m.RecordRentDuration + } + return 0 +} + +func (m *Params) GetAuthorityRent() types.Coin { + if m != nil { + return m.AuthorityRent + } + return types.Coin{} +} + +func (m *Params) GetAuthorityRentDuration() time.Duration { + if m != nil { + return m.AuthorityRentDuration + } + return 0 +} + +func (m *Params) GetAuthorityGracePeriod() time.Duration { + if m != nil { + return m.AuthorityGracePeriod + } + return 0 +} + +func (m *Params) GetAuthorityAuctionEnabled() bool { + if m != nil { + return m.AuthorityAuctionEnabled + } + return false +} + +func (m *Params) GetAuthorityAuctionCommitsDuration() time.Duration { + if m != nil { + return m.AuthorityAuctionCommitsDuration + } + return 0 +} + +func (m *Params) GetAuthorityAuctionRevealsDuration() time.Duration { + if m != nil { + return m.AuthorityAuctionRevealsDuration + } + return 0 +} + +func (m *Params) GetAuthorityAuctionCommitFee() types.Coin { + if m != nil { + return m.AuthorityAuctionCommitFee + } + return types.Coin{} +} + +func (m *Params) GetAuthorityAuctionRevealFee() types.Coin { + if m != nil { + return m.AuthorityAuctionRevealFee + } + return types.Coin{} +} + +func (m *Params) GetAuthorityAuctionMinimumBid() types.Coin { + if m != nil { + return m.AuthorityAuctionMinimumBid + } + return types.Coin{} +} + +// Params defines the nameservice module records +type Record struct { + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" json:"id" yaml:"id"` + BondId string `protobuf:"bytes,2,opt,name=bond_id,json=bondId,proto3" json:"bond_id,omitempty" json:"bondId" yaml:"bondId"` + CreateTime string `protobuf:"bytes,3,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty" json:"createTime" yaml:"createTime"` + ExpiryTime string `protobuf:"bytes,4,opt,name=expiry_time,json=expiryTime,proto3" json:"expiry_time,omitempty" json:"expiryTime" yaml:"expiryTime"` + Deleted bool `protobuf:"varint,5,opt,name=deleted,proto3" json:"deleted,omitempty"` + Owners []string `protobuf:"bytes,6,rep,name=owners,proto3" json:"owners,omitempty" json:"owners" yaml:"owners"` + Attributes string `protobuf:"bytes,7,opt,name=attributes,proto3" json:"attributes,omitempty" json:"attributes" yaml:"attributes"` + Names []string `protobuf:"bytes,8,rep,name=names,proto3" json:"names,omitempty" json:"names" yaml:"names"` +} + +func (m *Record) Reset() { *m = Record{} } +func (m *Record) String() string { return proto.CompactTextString(m) } +func (*Record) ProtoMessage() {} +func (*Record) Descriptor() ([]byte, []int) { + return fileDescriptor_c2009c2df775dbad, []int{1} +} +func (m *Record) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Record) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Record.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 *Record) XXX_Merge(src proto.Message) { + xxx_messageInfo_Record.Merge(m, src) +} +func (m *Record) XXX_Size() int { + return m.Size() +} +func (m *Record) XXX_DiscardUnknown() { + xxx_messageInfo_Record.DiscardUnknown(m) +} + +var xxx_messageInfo_Record proto.InternalMessageInfo + +func (m *Record) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +func (m *Record) GetBondId() string { + if m != nil { + return m.BondId + } + return "" +} + +func (m *Record) GetCreateTime() string { + if m != nil { + return m.CreateTime + } + return "" +} + +func (m *Record) GetExpiryTime() string { + if m != nil { + return m.ExpiryTime + } + return "" +} + +func (m *Record) GetDeleted() bool { + if m != nil { + return m.Deleted + } + return false +} + +func (m *Record) GetOwners() []string { + if m != nil { + return m.Owners + } + return nil +} + +func (m *Record) GetAttributes() string { + if m != nil { + return m.Attributes + } + return "" +} + +func (m *Record) GetNames() []string { + if m != nil { + return m.Names + } + return nil +} + +// AuthorityEntry defines the nameservice module AuthorityEntries +type AuthorityEntry struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Entry *NameAuthority `protobuf:"bytes,2,opt,name=entry,proto3" json:"entry,omitempty"` +} + +func (m *AuthorityEntry) Reset() { *m = AuthorityEntry{} } +func (m *AuthorityEntry) String() string { return proto.CompactTextString(m) } +func (*AuthorityEntry) ProtoMessage() {} +func (*AuthorityEntry) Descriptor() ([]byte, []int) { + return fileDescriptor_c2009c2df775dbad, []int{2} +} +func (m *AuthorityEntry) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AuthorityEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AuthorityEntry.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 *AuthorityEntry) XXX_Merge(src proto.Message) { + xxx_messageInfo_AuthorityEntry.Merge(m, src) +} +func (m *AuthorityEntry) XXX_Size() int { + return m.Size() +} +func (m *AuthorityEntry) XXX_DiscardUnknown() { + xxx_messageInfo_AuthorityEntry.DiscardUnknown(m) +} + +var xxx_messageInfo_AuthorityEntry proto.InternalMessageInfo + +func (m *AuthorityEntry) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *AuthorityEntry) GetEntry() *NameAuthority { + if m != nil { + return m.Entry + } + return nil +} + +// NameAuthority +type NameAuthority struct { + // Owner public key. + OwnerPublicKey string `protobuf:"bytes,1,opt,name=owner_public_key,json=ownerPublicKey,proto3" json:"owner_public_key,omitempty" json:"ownerPublicKey" yaml:"ownerPublicKey"` + // Owner address. + OwnerAddress string `protobuf:"bytes,2,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address,omitempty" json:"ownerAddress" yaml:"ownerAddress"` + // height at which name/authority was created. + Height uint64 `protobuf:"varint,3,opt,name=height,proto3" json:"height,omitempty"` + Status string `protobuf:"bytes,4,opt,name=status,proto3" json:"status,omitempty"` + AuctionId string `protobuf:"bytes,5,opt,name=auction_id,json=auctionId,proto3" json:"auction_id,omitempty" json:"auctionID" yaml:"auctionID"` + BondId string `protobuf:"bytes,6,opt,name=bond_id,json=bondId,proto3" json:"bond_id,omitempty" json:"bondID" yaml:"bondID"` + ExpiryTime time.Time `protobuf:"bytes,7,opt,name=expiry_time,json=expiryTime,proto3,stdtime" json:"expiry_time" json:"expiryTime" yaml:"expiryTime"` +} + +func (m *NameAuthority) Reset() { *m = NameAuthority{} } +func (m *NameAuthority) String() string { return proto.CompactTextString(m) } +func (*NameAuthority) ProtoMessage() {} +func (*NameAuthority) Descriptor() ([]byte, []int) { + return fileDescriptor_c2009c2df775dbad, []int{3} +} +func (m *NameAuthority) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *NameAuthority) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_NameAuthority.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 *NameAuthority) XXX_Merge(src proto.Message) { + xxx_messageInfo_NameAuthority.Merge(m, src) +} +func (m *NameAuthority) XXX_Size() int { + return m.Size() +} +func (m *NameAuthority) XXX_DiscardUnknown() { + xxx_messageInfo_NameAuthority.DiscardUnknown(m) +} + +var xxx_messageInfo_NameAuthority proto.InternalMessageInfo + +func (m *NameAuthority) GetOwnerPublicKey() string { + if m != nil { + return m.OwnerPublicKey + } + return "" +} + +func (m *NameAuthority) GetOwnerAddress() string { + if m != nil { + return m.OwnerAddress + } + return "" +} + +func (m *NameAuthority) GetHeight() uint64 { + if m != nil { + return m.Height + } + return 0 +} + +func (m *NameAuthority) GetStatus() string { + if m != nil { + return m.Status + } + return "" +} + +func (m *NameAuthority) GetAuctionId() string { + if m != nil { + return m.AuctionId + } + return "" +} + +func (m *NameAuthority) GetBondId() string { + if m != nil { + return m.BondId + } + return "" +} + +func (m *NameAuthority) GetExpiryTime() time.Time { + if m != nil { + return m.ExpiryTime + } + return time.Time{} +} + +// NameEntry +type NameEntry struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Entry *NameRecord `protobuf:"bytes,2,opt,name=entry,proto3" json:"entry,omitempty"` +} + +func (m *NameEntry) Reset() { *m = NameEntry{} } +func (m *NameEntry) String() string { return proto.CompactTextString(m) } +func (*NameEntry) ProtoMessage() {} +func (*NameEntry) Descriptor() ([]byte, []int) { + return fileDescriptor_c2009c2df775dbad, []int{4} +} +func (m *NameEntry) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *NameEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_NameEntry.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 *NameEntry) XXX_Merge(src proto.Message) { + xxx_messageInfo_NameEntry.Merge(m, src) +} +func (m *NameEntry) XXX_Size() int { + return m.Size() +} +func (m *NameEntry) XXX_DiscardUnknown() { + xxx_messageInfo_NameEntry.DiscardUnknown(m) +} + +var xxx_messageInfo_NameEntry proto.InternalMessageInfo + +func (m *NameEntry) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *NameEntry) GetEntry() *NameRecord { + if m != nil { + return m.Entry + } + return nil +} + +// NameRecord +type NameRecord struct { + Latest *NameRecordEntry `protobuf:"bytes,1,opt,name=latest,proto3" json:"latest,omitempty"` + History []*NameRecordEntry `protobuf:"bytes,2,rep,name=history,proto3" json:"history,omitempty"` +} + +func (m *NameRecord) Reset() { *m = NameRecord{} } +func (m *NameRecord) String() string { return proto.CompactTextString(m) } +func (*NameRecord) ProtoMessage() {} +func (*NameRecord) Descriptor() ([]byte, []int) { + return fileDescriptor_c2009c2df775dbad, []int{5} +} +func (m *NameRecord) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *NameRecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_NameRecord.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 *NameRecord) XXX_Merge(src proto.Message) { + xxx_messageInfo_NameRecord.Merge(m, src) +} +func (m *NameRecord) XXX_Size() int { + return m.Size() +} +func (m *NameRecord) XXX_DiscardUnknown() { + xxx_messageInfo_NameRecord.DiscardUnknown(m) +} + +var xxx_messageInfo_NameRecord proto.InternalMessageInfo + +func (m *NameRecord) GetLatest() *NameRecordEntry { + if m != nil { + return m.Latest + } + return nil +} + +func (m *NameRecord) GetHistory() []*NameRecordEntry { + if m != nil { + return m.History + } + return nil +} + +// NameRecordEntry +type NameRecordEntry struct { + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Height uint64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"` +} + +func (m *NameRecordEntry) Reset() { *m = NameRecordEntry{} } +func (m *NameRecordEntry) String() string { return proto.CompactTextString(m) } +func (*NameRecordEntry) ProtoMessage() {} +func (*NameRecordEntry) Descriptor() ([]byte, []int) { + return fileDescriptor_c2009c2df775dbad, []int{6} +} +func (m *NameRecordEntry) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *NameRecordEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_NameRecordEntry.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 *NameRecordEntry) XXX_Merge(src proto.Message) { + xxx_messageInfo_NameRecordEntry.Merge(m, src) +} +func (m *NameRecordEntry) XXX_Size() int { + return m.Size() +} +func (m *NameRecordEntry) XXX_DiscardUnknown() { + xxx_messageInfo_NameRecordEntry.DiscardUnknown(m) +} + +var xxx_messageInfo_NameRecordEntry proto.InternalMessageInfo + +func (m *NameRecordEntry) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +func (m *NameRecordEntry) GetHeight() uint64 { + if m != nil { + return m.Height + } + return 0 +} + +// Signature +type Signature struct { + Sig string `protobuf:"bytes,1,opt,name=sig,proto3" json:"sig,omitempty" json:"sig" yaml:"sig"` + PubKey string `protobuf:"bytes,2,opt,name=pub_key,json=pubKey,proto3" json:"pub_key,omitempty" json:"pubKey" yaml:"pubKey"` +} + +func (m *Signature) Reset() { *m = Signature{} } +func (m *Signature) String() string { return proto.CompactTextString(m) } +func (*Signature) ProtoMessage() {} +func (*Signature) Descriptor() ([]byte, []int) { + return fileDescriptor_c2009c2df775dbad, []int{7} +} +func (m *Signature) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Signature) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Signature.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 *Signature) XXX_Merge(src proto.Message) { + xxx_messageInfo_Signature.Merge(m, src) +} +func (m *Signature) XXX_Size() int { + return m.Size() +} +func (m *Signature) XXX_DiscardUnknown() { + xxx_messageInfo_Signature.DiscardUnknown(m) +} + +var xxx_messageInfo_Signature proto.InternalMessageInfo + +func (m *Signature) GetSig() string { + if m != nil { + return m.Sig + } + return "" +} + +func (m *Signature) GetPubKey() string { + if m != nil { + return m.PubKey + } + return "" +} + +// BlockChangeSet +type BlockChangeSet struct { + Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` + Records []string `protobuf:"bytes,2,rep,name=records,proto3" json:"records,omitempty"` + Auctions []string `protobuf:"bytes,3,rep,name=auctions,proto3" json:"auctions,omitempty"` + AuctionBids []*AuctionBidInfo `protobuf:"bytes,4,rep,name=auction_bids,json=auctionBids,proto3" json:"auction_bids,omitempty" json:"auctionBids" yaml:"auctionBids"` + Authorities []string `protobuf:"bytes,5,rep,name=authorities,proto3" json:"authorities,omitempty"` + Names []string `protobuf:"bytes,6,rep,name=names,proto3" json:"names,omitempty"` +} + +func (m *BlockChangeSet) Reset() { *m = BlockChangeSet{} } +func (m *BlockChangeSet) String() string { return proto.CompactTextString(m) } +func (*BlockChangeSet) ProtoMessage() {} +func (*BlockChangeSet) Descriptor() ([]byte, []int) { + return fileDescriptor_c2009c2df775dbad, []int{8} +} +func (m *BlockChangeSet) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BlockChangeSet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BlockChangeSet.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 *BlockChangeSet) XXX_Merge(src proto.Message) { + xxx_messageInfo_BlockChangeSet.Merge(m, src) +} +func (m *BlockChangeSet) XXX_Size() int { + return m.Size() +} +func (m *BlockChangeSet) XXX_DiscardUnknown() { + xxx_messageInfo_BlockChangeSet.DiscardUnknown(m) +} + +var xxx_messageInfo_BlockChangeSet proto.InternalMessageInfo + +func (m *BlockChangeSet) GetHeight() int64 { + if m != nil { + return m.Height + } + return 0 +} + +func (m *BlockChangeSet) GetRecords() []string { + if m != nil { + return m.Records + } + return nil +} + +func (m *BlockChangeSet) GetAuctions() []string { + if m != nil { + return m.Auctions + } + return nil +} + +func (m *BlockChangeSet) GetAuctionBids() []*AuctionBidInfo { + if m != nil { + return m.AuctionBids + } + return nil +} + +func (m *BlockChangeSet) GetAuthorities() []string { + if m != nil { + return m.Authorities + } + return nil +} + +func (m *BlockChangeSet) GetNames() []string { + if m != nil { + return m.Names + } + return nil +} + +// AuctionBidInfo +type AuctionBidInfo struct { + AuctionId string `protobuf:"bytes,1,opt,name=auction_id,json=auctionId,proto3" json:"auction_id,omitempty" json:"auctionID" yaml:"auctionID"` + BidderAddress string `protobuf:"bytes,2,opt,name=bidder_address,json=bidderAddress,proto3" json:"bidder_address,omitempty" json:"bidderAddress" yaml:"bidderAddress"` +} + +func (m *AuctionBidInfo) Reset() { *m = AuctionBidInfo{} } +func (m *AuctionBidInfo) String() string { return proto.CompactTextString(m) } +func (*AuctionBidInfo) ProtoMessage() {} +func (*AuctionBidInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_c2009c2df775dbad, []int{9} +} +func (m *AuctionBidInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AuctionBidInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AuctionBidInfo.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 *AuctionBidInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_AuctionBidInfo.Merge(m, src) +} +func (m *AuctionBidInfo) XXX_Size() int { + return m.Size() +} +func (m *AuctionBidInfo) XXX_DiscardUnknown() { + xxx_messageInfo_AuctionBidInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_AuctionBidInfo proto.InternalMessageInfo + +func (m *AuctionBidInfo) GetAuctionId() string { + if m != nil { + return m.AuctionId + } + return "" +} + +func (m *AuctionBidInfo) GetBidderAddress() string { + if m != nil { + return m.BidderAddress + } + return "" +} + +func init() { + proto.RegisterType((*Params)(nil), "vulcanize.nameservice.v1beta1.Params") + proto.RegisterType((*Record)(nil), "vulcanize.nameservice.v1beta1.Record") + proto.RegisterType((*AuthorityEntry)(nil), "vulcanize.nameservice.v1beta1.AuthorityEntry") + proto.RegisterType((*NameAuthority)(nil), "vulcanize.nameservice.v1beta1.NameAuthority") + proto.RegisterType((*NameEntry)(nil), "vulcanize.nameservice.v1beta1.NameEntry") + proto.RegisterType((*NameRecord)(nil), "vulcanize.nameservice.v1beta1.NameRecord") + proto.RegisterType((*NameRecordEntry)(nil), "vulcanize.nameservice.v1beta1.NameRecordEntry") + proto.RegisterType((*Signature)(nil), "vulcanize.nameservice.v1beta1.Signature") + proto.RegisterType((*BlockChangeSet)(nil), "vulcanize.nameservice.v1beta1.BlockChangeSet") + proto.RegisterType((*AuctionBidInfo)(nil), "vulcanize.nameservice.v1beta1.AuctionBidInfo") +} + +func init() { + proto.RegisterFile("vulcanize/nameservice/v1beta1/nameservice.proto", fileDescriptor_c2009c2df775dbad) +} + +var fileDescriptor_c2009c2df775dbad = []byte{ + // 1325 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x57, 0xdd, 0x6e, 0x1b, 0xc5, + 0x17, 0xcf, 0xc6, 0x89, 0x13, 0x4f, 0x1a, 0xff, 0xff, 0x1a, 0xd2, 0x76, 0x13, 0xa8, 0x37, 0x18, + 0x55, 0x6d, 0x55, 0xea, 0xa5, 0xf4, 0xa2, 0x7c, 0x08, 0xa1, 0x6c, 0xd2, 0xa6, 0x01, 0x01, 0x61, + 0xda, 0x1b, 0xb8, 0x31, 0xb3, 0xbb, 0x53, 0x7b, 0xa8, 0x77, 0xd7, 0xda, 0x99, 0x0d, 0x35, 0x5c, + 0xf1, 0x06, 0x95, 0xb8, 0xe9, 0x05, 0xe2, 0x05, 0x40, 0xe2, 0x31, 0xe8, 0x65, 0x2f, 0x11, 0x12, + 0x06, 0xb5, 0x6f, 0xe0, 0x27, 0x40, 0x3b, 0x1f, 0xfb, 0x65, 0xbb, 0x8e, 0xda, 0xbb, 0x3d, 0xe7, + 0x77, 0xce, 0x99, 0xdf, 0x9c, 0x39, 0xe7, 0xcc, 0x2c, 0xb0, 0x4f, 0x92, 0x81, 0x87, 0x43, 0xfa, + 0x3d, 0xb1, 0x43, 0x1c, 0x10, 0x46, 0xe2, 0x13, 0xea, 0x11, 0xfb, 0xe4, 0xba, 0x4b, 0x38, 0xbe, + 0x5e, 0xd4, 0x75, 0x86, 0x71, 0xc4, 0x23, 0x78, 0x21, 0x73, 0xe8, 0x14, 0x41, 0xe5, 0xb0, 0xd3, + 0xea, 0x45, 0x51, 0x6f, 0x40, 0x6c, 0x61, 0xec, 0x26, 0xf7, 0x6d, 0x3f, 0x89, 0x31, 0xa7, 0x51, + 0x28, 0xdd, 0x77, 0xac, 0x2a, 0xce, 0x69, 0x40, 0x18, 0xc7, 0xc1, 0x50, 0x19, 0x6c, 0xf5, 0xa2, + 0x5e, 0x24, 0x3e, 0xed, 0xf4, 0x4b, 0x69, 0x5b, 0x5e, 0xc4, 0x82, 0x88, 0xd9, 0x2e, 0x66, 0x39, + 0x39, 0x2f, 0xa2, 0x2a, 0x6c, 0xfb, 0xef, 0x4d, 0x50, 0x3f, 0xc6, 0x31, 0x0e, 0x18, 0xa4, 0x60, + 0x23, 0x26, 0x5e, 0x14, 0xfb, 0xdd, 0x98, 0x84, 0xdc, 0x34, 0x76, 0x8d, 0xcb, 0x1b, 0xef, 0x6e, + 0x77, 0x64, 0x80, 0x4e, 0x1a, 0x40, 0x93, 0xed, 0xec, 0x47, 0x34, 0x74, 0xae, 0x3d, 0x19, 0x5b, + 0x4b, 0x93, 0xb1, 0x75, 0xf1, 0x5b, 0x16, 0x85, 0x1f, 0xb4, 0x0b, 0xbe, 0xed, 0xdd, 0x11, 0x0e, + 0x06, 0x65, 0x15, 0x02, 0x52, 0x42, 0x24, 0xe4, 0xf0, 0x91, 0x01, 0xb6, 0x0a, 0x60, 0x57, 0xef, + 0xd5, 0x5c, 0x56, 0x8b, 0xca, 0xcd, 0x76, 0xf4, 0x66, 0x3b, 0x07, 0xca, 0xc0, 0xd9, 0x57, 0x8b, + 0xde, 0x9c, 0x5a, 0x34, 0x0b, 0x32, 0x63, 0xf5, 0x1c, 0x7b, 0xfc, 0x8f, 0x65, 0x20, 0x98, 0x53, + 0xd1, 0x81, 0x61, 0x02, 0x9a, 0x38, 0xe1, 0xfd, 0x28, 0xa6, 0x7c, 0x24, 0x13, 0x50, 0x5b, 0x94, + 0x80, 0x1b, 0x8a, 0xcb, 0x55, 0xc9, 0xa5, 0xec, 0xae, 0x59, 0x54, 0xb4, 0x68, 0x33, 0x53, 0x88, + 0x4c, 0xfc, 0x6c, 0x80, 0xf3, 0x65, 0x93, 0x3c, 0x19, 0x2b, 0x8b, 0x92, 0x71, 0xa4, 0x08, 0x7c, + 0x34, 0x8b, 0xc0, 0x54, 0x3e, 0xe6, 0xc1, 0x22, 0x25, 0x67, 0x4b, 0xb4, 0xb2, 0xac, 0x3c, 0x36, + 0xc0, 0xb9, 0xdc, 0xaf, 0x17, 0x63, 0x8f, 0x74, 0x87, 0x24, 0xa6, 0x91, 0x6f, 0xae, 0x2e, 0x62, + 0x77, 0xa8, 0xd8, 0x7d, 0x58, 0x65, 0x57, 0x0c, 0x33, 0x4d, 0xae, 0x84, 0x0a, 0x6e, 0x5b, 0x19, + 0x78, 0x98, 0x62, 0xc7, 0x02, 0x82, 0x3f, 0x1a, 0x60, 0x3b, 0xf7, 0xc2, 0x89, 0x97, 0x2e, 0xda, + 0x25, 0x21, 0x76, 0x07, 0xc4, 0x37, 0xeb, 0xbb, 0xc6, 0xe5, 0x75, 0xe7, 0xd6, 0x64, 0x6c, 0xed, + 0x55, 0x97, 0xaf, 0x98, 0x4e, 0x33, 0xa8, 0x1a, 0xa0, 0xfc, 0x84, 0xf6, 0x24, 0x74, 0x4b, 0x22, + 0xf0, 0x0f, 0x03, 0xcc, 0xf0, 0xf3, 0xa2, 0x20, 0xa0, 0x9c, 0xe5, 0x07, 0xb9, 0xb6, 0x28, 0x55, + 0x5d, 0x95, 0xaa, 0xbb, 0xf3, 0xb8, 0x56, 0x43, 0xce, 0x27, 0x3d, 0x65, 0x29, 0x52, 0x68, 0x55, + 0x77, 0xb0, 0x2f, 0xcd, 0xb2, 0x83, 0x9e, 0xbd, 0x93, 0x98, 0x9c, 0x10, 0x3c, 0x28, 0xec, 0x64, + 0xfd, 0x95, 0x77, 0x52, 0x0d, 0x39, 0x7f, 0x27, 0x53, 0x96, 0xb3, 0x77, 0x82, 0xa4, 0x59, 0xb6, + 0x93, 0x5f, 0x0d, 0xf0, 0xc6, 0xbc, 0xb4, 0x74, 0xef, 0x13, 0x62, 0x36, 0x16, 0xf5, 0xf5, 0x17, + 0x6a, 0x0f, 0x87, 0x2f, 0x3e, 0x8d, 0x34, 0xd8, 0xa2, 0x73, 0x10, 0x36, 0x68, 0x7b, 0x76, 0xf6, + 0x6f, 0x13, 0x32, 0x87, 0xad, 0xdc, 0xba, 0x60, 0x0b, 0x5e, 0x99, 0x6d, 0x1e, 0x6c, 0x51, 0xae, + 0xe7, 0xb0, 0x95, 0x19, 0x4e, 0xd9, 0xfe, 0x6e, 0x80, 0x0b, 0xd3, 0xce, 0x01, 0x0d, 0x69, 0x90, + 0x04, 0x5d, 0x97, 0xfa, 0xe6, 0xc6, 0x22, 0xba, 0x5f, 0x2a, 0xba, 0x47, 0xf3, 0xe8, 0x16, 0xa2, + 0xcd, 0xe7, 0x5b, 0x34, 0x42, 0x3b, 0x55, 0xc2, 0x9f, 0x49, 0xd4, 0xa1, 0x7e, 0xfb, 0x69, 0x0d, + 0xd4, 0x91, 0x98, 0xf6, 0xf0, 0x12, 0x58, 0xa6, 0xbe, 0xb8, 0xd6, 0x1a, 0xce, 0xf9, 0xc9, 0xd8, + 0x7a, 0x4d, 0x32, 0xc8, 0x97, 0x49, 0x63, 0x2d, 0x53, 0x1f, 0xbe, 0x07, 0xd6, 0xdc, 0x28, 0xf4, + 0xbb, 0xd4, 0x17, 0xf7, 0x51, 0xc3, 0xb1, 0x26, 0x63, 0xeb, 0x75, 0x69, 0x9d, 0x02, 0x47, 0x99, + 0x87, 0x92, 0x50, 0x5d, 0x7e, 0xc0, 0x3b, 0x60, 0xc3, 0x8b, 0x09, 0xe6, 0xa4, 0x9b, 0xde, 0xce, + 0xe2, 0x06, 0x69, 0x38, 0x97, 0x26, 0x63, 0xeb, 0x2d, 0xe9, 0x2d, 0xc1, 0x7b, 0x34, 0xc8, 0x8e, + 0xa2, 0xa0, 0x41, 0x20, 0x17, 0xd2, 0x48, 0xe4, 0xe1, 0x90, 0xc6, 0x23, 0x19, 0x69, 0xa5, 0x1a, + 0x49, 0x82, 0xc5, 0x48, 0x05, 0x0d, 0x02, 0xb9, 0x00, 0x4d, 0xb0, 0xe6, 0x93, 0x01, 0xe1, 0x44, + 0x8e, 0xec, 0x75, 0xa4, 0x45, 0x78, 0x13, 0xd4, 0xa3, 0xef, 0x42, 0x12, 0x33, 0xb3, 0xbe, 0x5b, + 0x2b, 0x6f, 0x53, 0xea, 0x75, 0x68, 0x25, 0x21, 0x65, 0x0e, 0x0f, 0x01, 0xc0, 0x9c, 0xc7, 0xd4, + 0x4d, 0x38, 0x61, 0x62, 0xba, 0x95, 0xb8, 0xe5, 0x58, 0x76, 0x80, 0xb9, 0x06, 0x15, 0x5c, 0xe1, + 0x0d, 0xb0, 0x2a, 0xde, 0x42, 0xe6, 0xba, 0x20, 0x70, 0x61, 0x32, 0xb6, 0xb6, 0x65, 0x0c, 0xa1, + 0xd6, 0xee, 0x52, 0x40, 0xd2, 0xb6, 0xdd, 0x07, 0xcd, 0x3d, 0x7d, 0xe0, 0xb7, 0x42, 0x1e, 0x8f, + 0x20, 0x04, 0x2b, 0x29, 0x24, 0xcf, 0x16, 0x89, 0x6f, 0xe8, 0x80, 0x55, 0x92, 0x82, 0xea, 0x49, + 0xf1, 0x76, 0xe7, 0x85, 0xcf, 0xaf, 0xce, 0xe7, 0x38, 0x20, 0x59, 0x54, 0x24, 0x5d, 0xdb, 0x7f, + 0xd5, 0xc0, 0x66, 0x09, 0x80, 0x5f, 0x81, 0xff, 0x8b, 0x1c, 0x74, 0x87, 0x89, 0x3b, 0xa0, 0x5e, + 0xf7, 0x01, 0x19, 0xa9, 0x8a, 0xb2, 0xf3, 0x87, 0x80, 0xb0, 0x38, 0x16, 0x06, 0x9f, 0x92, 0x51, + 0x29, 0x89, 0xb9, 0x16, 0x35, 0xcb, 0x0a, 0x78, 0x0c, 0x36, 0x65, 0x68, 0xec, 0xfb, 0x31, 0x61, + 0x4c, 0xd5, 0xde, 0xd5, 0xc9, 0xd8, 0xba, 0x54, 0x88, 0xbb, 0x27, 0xd1, 0x52, 0x54, 0xad, 0x43, + 0x67, 0x8a, 0x22, 0x3c, 0x07, 0xea, 0x7d, 0x42, 0x7b, 0x7d, 0xf9, 0x94, 0x59, 0x41, 0x4a, 0x4a, + 0xf5, 0x8c, 0x63, 0x9e, 0x30, 0x59, 0x56, 0x48, 0x49, 0xf0, 0x00, 0x00, 0xdd, 0x5f, 0x54, 0x16, + 0x4b, 0xc3, 0xb9, 0x38, 0x19, 0x5b, 0x6f, 0xea, 0x56, 0x15, 0xd8, 0xd1, 0x41, 0xde, 0x96, 0x5a, + 0x81, 0x1a, 0xfa, 0xbb, 0xd4, 0x3d, 0xf5, 0x99, 0xdd, 0x73, 0x50, 0xea, 0x9e, 0x83, 0xbc, 0x7b, + 0x06, 0xe5, 0x9a, 0x97, 0xb7, 0xe6, 0xce, 0xd4, 0x5d, 0x73, 0x4f, 0x3f, 0x7c, 0x1d, 0x5b, 0xcd, + 0x92, 0xd3, 0xf4, 0xc4, 0xa3, 0xf4, 0xf2, 0x28, 0xf4, 0x45, 0xfb, 0x1b, 0xd0, 0x48, 0xcf, 0x76, + 0x7e, 0x05, 0x7d, 0x5c, 0xae, 0xa0, 0x2b, 0xa7, 0xa8, 0x20, 0x39, 0x69, 0x74, 0xf9, 0xfc, 0x62, + 0x00, 0x90, 0x6b, 0xe1, 0x6d, 0x50, 0x1f, 0x60, 0x4e, 0x98, 0x7e, 0x5a, 0x77, 0x4e, 0x1d, 0x50, + 0x70, 0x44, 0xca, 0x1b, 0xde, 0x01, 0x6b, 0x7d, 0xca, 0x78, 0x24, 0x98, 0xd5, 0x5e, 0x22, 0x90, + 0x76, 0x6f, 0xbf, 0x0f, 0xfe, 0x57, 0xc1, 0x60, 0x33, 0x1f, 0x92, 0x62, 0x16, 0xe6, 0x35, 0xb4, + 0x5c, 0xac, 0xa1, 0x76, 0x0c, 0x1a, 0x77, 0x69, 0x2f, 0xc4, 0x3c, 0x89, 0x09, 0xbc, 0x0a, 0x6a, + 0x8c, 0xf6, 0x54, 0x23, 0x6c, 0x4f, 0xc6, 0xd6, 0x59, 0x79, 0x20, 0x8c, 0xf6, 0xf4, 0x49, 0xa4, + 0x9f, 0x28, 0xb5, 0x4a, 0xeb, 0x63, 0x98, 0xb8, 0xa2, 0x73, 0xa6, 0xa6, 0xeb, 0x30, 0x71, 0x0b, + 0x1d, 0xa3, 0x24, 0x54, 0x57, 0x1f, 0x3f, 0x2d, 0x83, 0xa6, 0x33, 0x88, 0xbc, 0x07, 0xfb, 0x7d, + 0x1c, 0xf6, 0xc8, 0x5d, 0xc2, 0x0b, 0xf4, 0xd2, 0xc5, 0x6b, 0x59, 0x89, 0x9b, 0x60, 0x4d, 0xbe, + 0xf1, 0x99, 0xc8, 0x51, 0x03, 0x69, 0x11, 0xee, 0x80, 0x75, 0x55, 0xab, 0xcc, 0xac, 0x09, 0x28, + 0x93, 0xe1, 0x0f, 0xe0, 0x8c, 0x6e, 0x00, 0x97, 0xfa, 0x69, 0x7b, 0xa4, 0xe9, 0xbd, 0xb6, 0x20, + 0xbd, 0xea, 0xd2, 0x71, 0xa8, 0x7f, 0x14, 0xde, 0x8f, 0x9c, 0x2b, 0xf9, 0x2f, 0x11, 0xce, 0x10, + 0x56, 0xe9, 0x19, 0xa1, 0x42, 0x1b, 0x05, 0x09, 0xee, 0x82, 0x0d, 0x7d, 0x8f, 0x51, 0xc2, 0xcc, + 0x55, 0xc1, 0xad, 0xa8, 0x82, 0x5b, 0x7a, 0x5a, 0x8a, 0x71, 0xad, 0xc7, 0xe1, 0x6f, 0x46, 0x3a, + 0x0f, 0x8b, 0x14, 0x2a, 0x8d, 0x6c, 0xbc, 0x64, 0x23, 0xdf, 0x03, 0x4d, 0x97, 0xfa, 0xfe, 0xd4, + 0x44, 0xba, 0x36, 0x19, 0x5b, 0x57, 0x54, 0x3f, 0x0b, 0xbc, 0x32, 0x92, 0xca, 0x4a, 0xb4, 0x59, + 0x92, 0x9d, 0x4f, 0x9e, 0x3c, 0x6b, 0x19, 0x4f, 0x9f, 0xb5, 0x8c, 0x7f, 0x9f, 0xb5, 0x8c, 0x47, + 0xcf, 0x5b, 0x4b, 0x4f, 0x9f, 0xb7, 0x96, 0xfe, 0x7c, 0xde, 0x5a, 0xfa, 0xfa, 0x9d, 0x1e, 0xe5, + 0xfd, 0xc4, 0xed, 0x78, 0x51, 0x60, 0xf3, 0x3e, 0x8e, 0x19, 0x65, 0x36, 0xe1, 0x7d, 0x12, 0x07, + 0x34, 0xe4, 0xf6, 0xc3, 0xd2, 0x6f, 0x36, 0x1f, 0x0d, 0x09, 0x73, 0xeb, 0x62, 0x26, 0xdc, 0xf8, + 0x2f, 0x00, 0x00, 0xff, 0xff, 0x7f, 0x95, 0x34, 0xdd, 0x8c, 0x0f, 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 + { + size, err := m.AuthorityAuctionMinimumBid.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintNameservice(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x5a + { + size, err := m.AuthorityAuctionRevealFee.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintNameservice(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x52 + { + size, err := m.AuthorityAuctionCommitFee.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintNameservice(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x4a + n4, err4 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.AuthorityAuctionRevealsDuration, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.AuthorityAuctionRevealsDuration):]) + if err4 != nil { + return 0, err4 + } + i -= n4 + i = encodeVarintNameservice(dAtA, i, uint64(n4)) + i-- + dAtA[i] = 0x42 + n5, err5 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.AuthorityAuctionCommitsDuration, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.AuthorityAuctionCommitsDuration):]) + if err5 != nil { + return 0, err5 + } + i -= n5 + i = encodeVarintNameservice(dAtA, i, uint64(n5)) + i-- + dAtA[i] = 0x3a + if m.AuthorityAuctionEnabled { + i-- + if m.AuthorityAuctionEnabled { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x30 + } + n6, err6 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.AuthorityGracePeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.AuthorityGracePeriod):]) + if err6 != nil { + return 0, err6 + } + i -= n6 + i = encodeVarintNameservice(dAtA, i, uint64(n6)) + i-- + dAtA[i] = 0x2a + n7, err7 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.AuthorityRentDuration, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.AuthorityRentDuration):]) + if err7 != nil { + return 0, err7 + } + i -= n7 + i = encodeVarintNameservice(dAtA, i, uint64(n7)) + i-- + dAtA[i] = 0x22 + { + size, err := m.AuthorityRent.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintNameservice(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + n9, err9 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.RecordRentDuration, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.RecordRentDuration):]) + if err9 != nil { + return 0, err9 + } + i -= n9 + i = encodeVarintNameservice(dAtA, i, uint64(n9)) + i-- + dAtA[i] = 0x12 + { + size, err := m.RecordRent.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintNameservice(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *Record) 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 *Record) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Record) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Names) > 0 { + for iNdEx := len(m.Names) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Names[iNdEx]) + copy(dAtA[i:], m.Names[iNdEx]) + i = encodeVarintNameservice(dAtA, i, uint64(len(m.Names[iNdEx]))) + i-- + dAtA[i] = 0x42 + } + } + if len(m.Attributes) > 0 { + i -= len(m.Attributes) + copy(dAtA[i:], m.Attributes) + i = encodeVarintNameservice(dAtA, i, uint64(len(m.Attributes))) + i-- + dAtA[i] = 0x3a + } + if len(m.Owners) > 0 { + for iNdEx := len(m.Owners) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Owners[iNdEx]) + copy(dAtA[i:], m.Owners[iNdEx]) + i = encodeVarintNameservice(dAtA, i, uint64(len(m.Owners[iNdEx]))) + i-- + dAtA[i] = 0x32 + } + } + if m.Deleted { + i-- + if m.Deleted { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x28 + } + if len(m.ExpiryTime) > 0 { + i -= len(m.ExpiryTime) + copy(dAtA[i:], m.ExpiryTime) + i = encodeVarintNameservice(dAtA, i, uint64(len(m.ExpiryTime))) + i-- + dAtA[i] = 0x22 + } + if len(m.CreateTime) > 0 { + i -= len(m.CreateTime) + copy(dAtA[i:], m.CreateTime) + i = encodeVarintNameservice(dAtA, i, uint64(len(m.CreateTime))) + i-- + dAtA[i] = 0x1a + } + if len(m.BondId) > 0 { + i -= len(m.BondId) + copy(dAtA[i:], m.BondId) + i = encodeVarintNameservice(dAtA, i, uint64(len(m.BondId))) + i-- + dAtA[i] = 0x12 + } + if len(m.Id) > 0 { + i -= len(m.Id) + copy(dAtA[i:], m.Id) + i = encodeVarintNameservice(dAtA, i, uint64(len(m.Id))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *AuthorityEntry) 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 *AuthorityEntry) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AuthorityEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Entry != nil { + { + size, err := m.Entry.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintNameservice(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintNameservice(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *NameAuthority) 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 *NameAuthority) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *NameAuthority) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + n12, err12 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.ExpiryTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.ExpiryTime):]) + if err12 != nil { + return 0, err12 + } + i -= n12 + i = encodeVarintNameservice(dAtA, i, uint64(n12)) + i-- + dAtA[i] = 0x3a + if len(m.BondId) > 0 { + i -= len(m.BondId) + copy(dAtA[i:], m.BondId) + i = encodeVarintNameservice(dAtA, i, uint64(len(m.BondId))) + i-- + dAtA[i] = 0x32 + } + if len(m.AuctionId) > 0 { + i -= len(m.AuctionId) + copy(dAtA[i:], m.AuctionId) + i = encodeVarintNameservice(dAtA, i, uint64(len(m.AuctionId))) + i-- + dAtA[i] = 0x2a + } + if len(m.Status) > 0 { + i -= len(m.Status) + copy(dAtA[i:], m.Status) + i = encodeVarintNameservice(dAtA, i, uint64(len(m.Status))) + i-- + dAtA[i] = 0x22 + } + if m.Height != 0 { + i = encodeVarintNameservice(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x18 + } + if len(m.OwnerAddress) > 0 { + i -= len(m.OwnerAddress) + copy(dAtA[i:], m.OwnerAddress) + i = encodeVarintNameservice(dAtA, i, uint64(len(m.OwnerAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.OwnerPublicKey) > 0 { + i -= len(m.OwnerPublicKey) + copy(dAtA[i:], m.OwnerPublicKey) + i = encodeVarintNameservice(dAtA, i, uint64(len(m.OwnerPublicKey))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *NameEntry) 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 *NameEntry) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *NameEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Entry != nil { + { + size, err := m.Entry.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintNameservice(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintNameservice(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *NameRecord) 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 *NameRecord) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *NameRecord) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.History) > 0 { + for iNdEx := len(m.History) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.History[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintNameservice(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if m.Latest != nil { + { + size, err := m.Latest.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintNameservice(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *NameRecordEntry) 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 *NameRecordEntry) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *NameRecordEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Height != 0 { + i = encodeVarintNameservice(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x10 + } + if len(m.Id) > 0 { + i -= len(m.Id) + copy(dAtA[i:], m.Id) + i = encodeVarintNameservice(dAtA, i, uint64(len(m.Id))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Signature) 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 *Signature) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Signature) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.PubKey) > 0 { + i -= len(m.PubKey) + copy(dAtA[i:], m.PubKey) + i = encodeVarintNameservice(dAtA, i, uint64(len(m.PubKey))) + i-- + dAtA[i] = 0x12 + } + if len(m.Sig) > 0 { + i -= len(m.Sig) + copy(dAtA[i:], m.Sig) + i = encodeVarintNameservice(dAtA, i, uint64(len(m.Sig))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *BlockChangeSet) 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 *BlockChangeSet) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BlockChangeSet) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Names) > 0 { + for iNdEx := len(m.Names) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Names[iNdEx]) + copy(dAtA[i:], m.Names[iNdEx]) + i = encodeVarintNameservice(dAtA, i, uint64(len(m.Names[iNdEx]))) + i-- + dAtA[i] = 0x32 + } + } + if len(m.Authorities) > 0 { + for iNdEx := len(m.Authorities) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Authorities[iNdEx]) + copy(dAtA[i:], m.Authorities[iNdEx]) + i = encodeVarintNameservice(dAtA, i, uint64(len(m.Authorities[iNdEx]))) + i-- + dAtA[i] = 0x2a + } + } + if len(m.AuctionBids) > 0 { + for iNdEx := len(m.AuctionBids) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.AuctionBids[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintNameservice(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + if len(m.Auctions) > 0 { + for iNdEx := len(m.Auctions) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Auctions[iNdEx]) + copy(dAtA[i:], m.Auctions[iNdEx]) + i = encodeVarintNameservice(dAtA, i, uint64(len(m.Auctions[iNdEx]))) + i-- + dAtA[i] = 0x1a + } + } + if len(m.Records) > 0 { + for iNdEx := len(m.Records) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Records[iNdEx]) + copy(dAtA[i:], m.Records[iNdEx]) + i = encodeVarintNameservice(dAtA, i, uint64(len(m.Records[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + if m.Height != 0 { + i = encodeVarintNameservice(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *AuctionBidInfo) 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 *AuctionBidInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AuctionBidInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.BidderAddress) > 0 { + i -= len(m.BidderAddress) + copy(dAtA[i:], m.BidderAddress) + i = encodeVarintNameservice(dAtA, i, uint64(len(m.BidderAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.AuctionId) > 0 { + i -= len(m.AuctionId) + copy(dAtA[i:], m.AuctionId) + i = encodeVarintNameservice(dAtA, i, uint64(len(m.AuctionId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintNameservice(dAtA []byte, offset int, v uint64) int { + offset -= sovNameservice(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 + l = m.RecordRent.Size() + n += 1 + l + sovNameservice(uint64(l)) + l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.RecordRentDuration) + n += 1 + l + sovNameservice(uint64(l)) + l = m.AuthorityRent.Size() + n += 1 + l + sovNameservice(uint64(l)) + l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.AuthorityRentDuration) + n += 1 + l + sovNameservice(uint64(l)) + l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.AuthorityGracePeriod) + n += 1 + l + sovNameservice(uint64(l)) + if m.AuthorityAuctionEnabled { + n += 2 + } + l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.AuthorityAuctionCommitsDuration) + n += 1 + l + sovNameservice(uint64(l)) + l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.AuthorityAuctionRevealsDuration) + n += 1 + l + sovNameservice(uint64(l)) + l = m.AuthorityAuctionCommitFee.Size() + n += 1 + l + sovNameservice(uint64(l)) + l = m.AuthorityAuctionRevealFee.Size() + n += 1 + l + sovNameservice(uint64(l)) + l = m.AuthorityAuctionMinimumBid.Size() + n += 1 + l + sovNameservice(uint64(l)) + return n +} + +func (m *Record) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Id) + if l > 0 { + n += 1 + l + sovNameservice(uint64(l)) + } + l = len(m.BondId) + if l > 0 { + n += 1 + l + sovNameservice(uint64(l)) + } + l = len(m.CreateTime) + if l > 0 { + n += 1 + l + sovNameservice(uint64(l)) + } + l = len(m.ExpiryTime) + if l > 0 { + n += 1 + l + sovNameservice(uint64(l)) + } + if m.Deleted { + n += 2 + } + if len(m.Owners) > 0 { + for _, s := range m.Owners { + l = len(s) + n += 1 + l + sovNameservice(uint64(l)) + } + } + l = len(m.Attributes) + if l > 0 { + n += 1 + l + sovNameservice(uint64(l)) + } + if len(m.Names) > 0 { + for _, s := range m.Names { + l = len(s) + n += 1 + l + sovNameservice(uint64(l)) + } + } + return n +} + +func (m *AuthorityEntry) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovNameservice(uint64(l)) + } + if m.Entry != nil { + l = m.Entry.Size() + n += 1 + l + sovNameservice(uint64(l)) + } + return n +} + +func (m *NameAuthority) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.OwnerPublicKey) + if l > 0 { + n += 1 + l + sovNameservice(uint64(l)) + } + l = len(m.OwnerAddress) + if l > 0 { + n += 1 + l + sovNameservice(uint64(l)) + } + if m.Height != 0 { + n += 1 + sovNameservice(uint64(m.Height)) + } + l = len(m.Status) + if l > 0 { + n += 1 + l + sovNameservice(uint64(l)) + } + l = len(m.AuctionId) + if l > 0 { + n += 1 + l + sovNameservice(uint64(l)) + } + l = len(m.BondId) + if l > 0 { + n += 1 + l + sovNameservice(uint64(l)) + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.ExpiryTime) + n += 1 + l + sovNameservice(uint64(l)) + return n +} + +func (m *NameEntry) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovNameservice(uint64(l)) + } + if m.Entry != nil { + l = m.Entry.Size() + n += 1 + l + sovNameservice(uint64(l)) + } + return n +} + +func (m *NameRecord) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Latest != nil { + l = m.Latest.Size() + n += 1 + l + sovNameservice(uint64(l)) + } + if len(m.History) > 0 { + for _, e := range m.History { + l = e.Size() + n += 1 + l + sovNameservice(uint64(l)) + } + } + return n +} + +func (m *NameRecordEntry) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Id) + if l > 0 { + n += 1 + l + sovNameservice(uint64(l)) + } + if m.Height != 0 { + n += 1 + sovNameservice(uint64(m.Height)) + } + return n +} + +func (m *Signature) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sig) + if l > 0 { + n += 1 + l + sovNameservice(uint64(l)) + } + l = len(m.PubKey) + if l > 0 { + n += 1 + l + sovNameservice(uint64(l)) + } + return n +} + +func (m *BlockChangeSet) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Height != 0 { + n += 1 + sovNameservice(uint64(m.Height)) + } + if len(m.Records) > 0 { + for _, s := range m.Records { + l = len(s) + n += 1 + l + sovNameservice(uint64(l)) + } + } + if len(m.Auctions) > 0 { + for _, s := range m.Auctions { + l = len(s) + n += 1 + l + sovNameservice(uint64(l)) + } + } + if len(m.AuctionBids) > 0 { + for _, e := range m.AuctionBids { + l = e.Size() + n += 1 + l + sovNameservice(uint64(l)) + } + } + if len(m.Authorities) > 0 { + for _, s := range m.Authorities { + l = len(s) + n += 1 + l + sovNameservice(uint64(l)) + } + } + if len(m.Names) > 0 { + for _, s := range m.Names { + l = len(s) + n += 1 + l + sovNameservice(uint64(l)) + } + } + return n +} + +func (m *AuctionBidInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.AuctionId) + if l > 0 { + n += 1 + l + sovNameservice(uint64(l)) + } + l = len(m.BidderAddress) + if l > 0 { + n += 1 + l + sovNameservice(uint64(l)) + } + return n +} + +func sovNameservice(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozNameservice(x uint64) (n int) { + return sovNameservice(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 ErrIntOverflowNameservice + } + 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 { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RecordRent", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthNameservice + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthNameservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RecordRent.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RecordRentDuration", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthNameservice + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthNameservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.RecordRentDuration, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AuthorityRent", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthNameservice + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthNameservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.AuthorityRent.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AuthorityRentDuration", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthNameservice + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthNameservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.AuthorityRentDuration, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AuthorityGracePeriod", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthNameservice + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthNameservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.AuthorityGracePeriod, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AuthorityAuctionEnabled", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.AuthorityAuctionEnabled = bool(v != 0) + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AuthorityAuctionCommitsDuration", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthNameservice + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthNameservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.AuthorityAuctionCommitsDuration, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AuthorityAuctionRevealsDuration", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthNameservice + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthNameservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.AuthorityAuctionRevealsDuration, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AuthorityAuctionCommitFee", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthNameservice + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthNameservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.AuthorityAuctionCommitFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AuthorityAuctionRevealFee", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthNameservice + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthNameservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.AuthorityAuctionRevealFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AuthorityAuctionMinimumBid", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthNameservice + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthNameservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.AuthorityAuctionMinimumBid.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNameservice(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthNameservice + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Record) 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 ErrIntOverflowNameservice + } + 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: Record: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Record: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameservice + } + 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 ErrInvalidLengthNameservice + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNameservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Id = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BondId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameservice + } + 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 ErrInvalidLengthNameservice + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNameservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BondId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CreateTime", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameservice + } + 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 ErrInvalidLengthNameservice + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNameservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CreateTime = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ExpiryTime", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameservice + } + 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 ErrInvalidLengthNameservice + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNameservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ExpiryTime = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Deleted", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Deleted = bool(v != 0) + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Owners", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameservice + } + 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 ErrInvalidLengthNameservice + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNameservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Owners = append(m.Owners, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Attributes", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameservice + } + 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 ErrInvalidLengthNameservice + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNameservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Attributes = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Names", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameservice + } + 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 ErrInvalidLengthNameservice + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNameservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Names = append(m.Names, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNameservice(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthNameservice + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AuthorityEntry) 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 ErrIntOverflowNameservice + } + 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: AuthorityEntry: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AuthorityEntry: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameservice + } + 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 ErrInvalidLengthNameservice + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNameservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Entry", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthNameservice + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthNameservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Entry == nil { + m.Entry = &NameAuthority{} + } + if err := m.Entry.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNameservice(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthNameservice + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NameAuthority) 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 ErrIntOverflowNameservice + } + 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: NameAuthority: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NameAuthority: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerPublicKey", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameservice + } + 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 ErrInvalidLengthNameservice + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNameservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OwnerPublicKey = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OwnerAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameservice + } + 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 ErrInvalidLengthNameservice + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNameservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OwnerAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + } + m.Height = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Height |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameservice + } + 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 ErrInvalidLengthNameservice + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNameservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Status = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AuctionId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameservice + } + 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 ErrInvalidLengthNameservice + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNameservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AuctionId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BondId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameservice + } + 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 ErrInvalidLengthNameservice + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNameservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BondId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ExpiryTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthNameservice + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthNameservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.ExpiryTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNameservice(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthNameservice + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NameEntry) 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 ErrIntOverflowNameservice + } + 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: NameEntry: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NameEntry: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameservice + } + 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 ErrInvalidLengthNameservice + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNameservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Entry", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthNameservice + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthNameservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Entry == nil { + m.Entry = &NameRecord{} + } + if err := m.Entry.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNameservice(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthNameservice + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NameRecord) 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 ErrIntOverflowNameservice + } + 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: NameRecord: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NameRecord: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Latest", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthNameservice + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthNameservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Latest == nil { + m.Latest = &NameRecordEntry{} + } + if err := m.Latest.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field History", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthNameservice + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthNameservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.History = append(m.History, &NameRecordEntry{}) + if err := m.History[len(m.History)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNameservice(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthNameservice + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NameRecordEntry) 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 ErrIntOverflowNameservice + } + 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: NameRecordEntry: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NameRecordEntry: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameservice + } + 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 ErrInvalidLengthNameservice + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNameservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Id = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + } + m.Height = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Height |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipNameservice(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthNameservice + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Signature) 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 ErrIntOverflowNameservice + } + 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: Signature: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Signature: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sig", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameservice + } + 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 ErrInvalidLengthNameservice + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNameservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sig = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PubKey", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameservice + } + 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 ErrInvalidLengthNameservice + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNameservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PubKey = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNameservice(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthNameservice + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BlockChangeSet) 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 ErrIntOverflowNameservice + } + 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: BlockChangeSet: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BlockChangeSet: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + } + m.Height = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Height |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Records", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameservice + } + 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 ErrInvalidLengthNameservice + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNameservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Records = append(m.Records, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Auctions", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameservice + } + 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 ErrInvalidLengthNameservice + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNameservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Auctions = append(m.Auctions, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AuctionBids", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameservice + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthNameservice + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthNameservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AuctionBids = append(m.AuctionBids, &AuctionBidInfo{}) + if err := m.AuctionBids[len(m.AuctionBids)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authorities", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameservice + } + 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 ErrInvalidLengthNameservice + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNameservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authorities = append(m.Authorities, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Names", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameservice + } + 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 ErrInvalidLengthNameservice + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNameservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Names = append(m.Names, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNameservice(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthNameservice + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AuctionBidInfo) 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 ErrIntOverflowNameservice + } + 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: AuctionBidInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AuctionBidInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AuctionId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameservice + } + 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 ErrInvalidLengthNameservice + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNameservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AuctionId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BidderAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNameservice + } + 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 ErrInvalidLengthNameservice + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNameservice + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BidderAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNameservice(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthNameservice + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipNameservice(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, ErrIntOverflowNameservice + } + 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, ErrIntOverflowNameservice + } + 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, ErrIntOverflowNameservice + } + 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, ErrInvalidLengthNameservice + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupNameservice + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthNameservice + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthNameservice = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowNameservice = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupNameservice = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/nameservice/types/params.go b/x/nameservice/types/params.go new file mode 100644 index 00000000..a6aa6b80 --- /dev/null +++ b/x/nameservice/types/params.go @@ -0,0 +1,239 @@ +package types + +import ( + "bytes" + "fmt" + sdk "github.com/cosmos/cosmos-sdk/types" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + "time" +) + +// Default parameter values. +var ( + // DefaultRecordRent is the default record rent for 1 time period (see expiry time). + DefaultRecordRent = sdk.NewInt(1000000) + + // DefaultRecordExpiryTime is the default record expiry time (1 year). + DefaultRecordExpiryTime = time.Hour * 24 * 365 + + DefaultAuthorityRent = sdk.NewInt(1000000) + DefaultAuthorityExpiryTime = time.Hour * 24 * 365 + DefaultAuthorityGracePeriod = time.Hour * 24 * 2 + + DefaultAuthorityAuctionEnabled = false + DefaultCommitsDuration = time.Hour * 24 + DefaultRevealsDuration = time.Hour * 24 + DefaultCommitFee = sdk.NewInt(1000000) + DefaultRevealFee = sdk.NewInt(1000000) + DefaultMinimumBid = sdk.NewInt(5000000) +) + +// Keys for parameter access +var ( + KeyRecordRent = []byte("RecordRent") + KeyRecordRentDuration = []byte("RecordRentDuration") + + KeyAuthorityRent = []byte("AuthorityRent") + KeyAuthorityRentDuration = []byte("AuthorityRentDuration") + KeyAuthorityGracePeriod = []byte("AuthorityGracePeriod") + + KeyAuthorityAuctionEnabled = []byte("AuthorityAuctionEnabled") + KeyCommitsDuration = []byte("AuthorityAuctionCommitsDuration") + KeyRevealsDuration = []byte("AuthorityAuctionRevealsDuration") + KeyCommitFee = []byte("AuthorityAuctionCommitFee") + KeyRevealFee = []byte("AuthorityAuctionRevealFee") + KeyMinimumBid = []byte("AuthorityAuctionMinimumBid") +) + +var _ paramtypes.ParamSet = &Params{} + +// ParamKeyTable ParamTable for staking module +func ParamKeyTable() paramtypes.KeyTable { + return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) +} + +// ParamSetPairs returns the parameter set pairs. +func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { + return paramtypes.ParamSetPairs{ + paramtypes.NewParamSetPair(KeyRecordRent, &p.RecordRent, validateRecordRent), + paramtypes.NewParamSetPair(KeyRecordRentDuration, &p.RecordRentDuration, validateRecordRentDuration), + + paramtypes.NewParamSetPair(KeyAuthorityRent, &p.AuthorityRent, validateAuthorityRent), + paramtypes.NewParamSetPair(KeyAuthorityRentDuration, &p.AuthorityRentDuration, validateAuthorityRentDuration), + paramtypes.NewParamSetPair(KeyAuthorityGracePeriod, &p.AuthorityGracePeriod, validateAuthorityGracePeriod), + + paramtypes.NewParamSetPair(KeyAuthorityAuctionEnabled, &p.AuthorityAuctionEnabled, validateAuthorityAuctionEnabled), + paramtypes.NewParamSetPair(KeyCommitsDuration, &p.AuthorityAuctionCommitsDuration, validateCommitsDuration), + paramtypes.NewParamSetPair(KeyRevealsDuration, &p.AuthorityAuctionRevealsDuration, validateRevealsDuration), + paramtypes.NewParamSetPair(KeyCommitFee, &p.AuthorityAuctionCommitFee, validateCommitFee), + paramtypes.NewParamSetPair(KeyRevealFee, &p.AuthorityAuctionRevealFee, validateRevealFee), + paramtypes.NewParamSetPair(KeyMinimumBid, &p.AuthorityAuctionMinimumBid, validateMinimumBid), + } +} + +// NewParams creates a new Params instance +func NewParams(recordRent sdk.Coin, recordRentDuration time.Duration, + authorityRent sdk.Coin, authorityRentDuration time.Duration, authorityGracePeriod time.Duration, + authorityAuctionEnabled bool, commitsDuration time.Duration, revealsDuration time.Duration, + commitFee sdk.Coin, revealFee sdk.Coin, minimumBid sdk.Coin) Params { + + return Params{ + RecordRent: recordRent, + RecordRentDuration: recordRentDuration, + + AuthorityRent: authorityRent, + AuthorityRentDuration: authorityRentDuration, + AuthorityGracePeriod: authorityGracePeriod, + + AuthorityAuctionEnabled: authorityAuctionEnabled, + AuthorityAuctionCommitsDuration: commitsDuration, + AuthorityAuctionRevealsDuration: revealsDuration, + AuthorityAuctionCommitFee: commitFee, + AuthorityAuctionRevealFee: revealFee, + AuthorityAuctionMinimumBid: minimumBid, + } +} + +// Equal returns a boolean determining if two Params types are identical. +func (p Params) Equal(p2 Params) bool { + bz1 := ModuleCdc.MustMarshalLengthPrefixed(&p) + bz2 := ModuleCdc.MustMarshalLengthPrefixed(&p2) + return bytes.Equal(bz1, bz2) +} + +// DefaultParams returns a default set of parameters. +func DefaultParams() Params { + return NewParams( + sdk.NewCoin(sdk.DefaultBondDenom, DefaultRecordRent), DefaultRecordExpiryTime, + sdk.NewCoin(sdk.DefaultBondDenom, DefaultAuthorityRent), + DefaultAuthorityExpiryTime, DefaultAuthorityGracePeriod, DefaultAuthorityAuctionEnabled, DefaultCommitsDuration, + DefaultRevealsDuration, + sdk.NewCoin(sdk.DefaultBondDenom, DefaultCommitFee), + sdk.NewCoin(sdk.DefaultBondDenom, DefaultRevealFee), + sdk.NewCoin(sdk.DefaultBondDenom, DefaultMinimumBid), + ) +} + +func validateAmount(name string, i interface{}) error { + v, ok := i.(sdk.Coin) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + if v.Amount.IsNegative() { + return fmt.Errorf("%s can't be negative", name) + } + + return nil +} + +func validateDuration(name string, i interface{}) error { + v, ok := i.(time.Duration) + if !ok { + return fmt.Errorf("%s invalid parameter type: %T", name, i) + } + + if v <= 0 { + return fmt.Errorf("%s must be a positive integer", name) + } + + return nil +} + +func validateRecordRent(i interface{}) error { + return validateAmount("RecordRent", i) +} + +func validateRecordRentDuration(i interface{}) error { + return validateDuration("RecordRentDuration", i) +} + +func validateAuthorityRent(i interface{}) error { + return validateAmount("AuthorityRent", i) +} + +func validateAuthorityRentDuration(i interface{}) error { + return validateDuration("AuthorityRentDuration", i) +} + +func validateAuthorityGracePeriod(i interface{}) error { + return validateDuration("AuthorityGracePeriod", i) +} + +func validateAuthorityAuctionEnabled(i interface{}) error { + _, ok := i.(bool) + if !ok { + return fmt.Errorf("%s invalid parameter type: %T", "AuthorityAuctionEnabled", i) + } + + return nil +} + +func validateCommitsDuration(i interface{}) error { + return validateDuration("AuthorityCommitsDuration", i) +} + +func validateRevealsDuration(i interface{}) error { + return validateDuration("AuthorityRevealsDuration", i) +} + +func validateCommitFee(i interface{}) error { + return validateAmount("AuthorityCommitFee", i) +} + +func validateRevealFee(i interface{}) error { + return validateAmount("AuthorityRevealFee", i) +} + +func validateMinimumBid(i interface{}) error { + return validateAmount("AuthorityMinimumBid", i) +} + +// Validate a set of params. +func (p Params) Validate() error { + if err := validateRecordRent(p.RecordRent); err != nil { + return err + } + + if err := validateRecordRentDuration(p.RecordRentDuration); err != nil { + return err + } + + if err := validateAuthorityRent(p.AuthorityRent); err != nil { + return err + } + + if err := validateAuthorityRentDuration(p.AuthorityRentDuration); err != nil { + return err + } + + if err := validateAuthorityGracePeriod(p.AuthorityGracePeriod); err != nil { + return err + } + + if err := validateAuthorityAuctionEnabled(p.AuthorityAuctionEnabled); err != nil { + return err + } + + if err := validateCommitsDuration(p.AuthorityAuctionCommitsDuration); err != nil { + return err + } + + if err := validateRevealsDuration(p.AuthorityAuctionRevealsDuration); err != nil { + return err + } + + if err := validateCommitFee(p.AuthorityAuctionCommitFee); err != nil { + return err + } + + if err := validateRevealFee(p.AuthorityAuctionRevealFee); err != nil { + return err + } + + if err := validateMinimumBid(p.AuthorityAuctionMinimumBid); err != nil { + return err + } + + return nil +} diff --git a/x/nameservice/types/query.pb.go b/x/nameservice/types/query.pb.go new file mode 100644 index 00000000..064ac626 --- /dev/null +++ b/x/nameservice/types/query.pb.go @@ -0,0 +1,6272 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: vulcanize/nameservice/v1beta1/query.proto + +package types + +import ( + context "context" + encoding_binary "encoding/binary" + fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + types "github.com/cosmos/cosmos-sdk/types" + query "github.com/cosmos/cosmos-sdk/types/query" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/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 nameservice params +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_73d2465766c8f876, []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 nameservice params +type QueryParamsResponse struct { + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` +} + +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_73d2465766c8f876, []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 nil +} + +// QueryListRecordsRequest is request type for nameservice records list +type QueryListRecordsRequest struct { + Attributes []*QueryListRecordsRequest_KeyValueInput `protobuf:"bytes,1,rep,name=attributes,proto3" json:"attributes,omitempty"` + All bool `protobuf:"varint,2,opt,name=all,proto3" json:"all,omitempty"` + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,3,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryListRecordsRequest) Reset() { *m = QueryListRecordsRequest{} } +func (m *QueryListRecordsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryListRecordsRequest) ProtoMessage() {} +func (*QueryListRecordsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_73d2465766c8f876, []int{2} +} +func (m *QueryListRecordsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryListRecordsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryListRecordsRequest.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 *QueryListRecordsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryListRecordsRequest.Merge(m, src) +} +func (m *QueryListRecordsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryListRecordsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryListRecordsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryListRecordsRequest proto.InternalMessageInfo + +func (m *QueryListRecordsRequest) GetAttributes() []*QueryListRecordsRequest_KeyValueInput { + if m != nil { + return m.Attributes + } + return nil +} + +func (m *QueryListRecordsRequest) GetAll() bool { + if m != nil { + return m.All + } + return false +} + +func (m *QueryListRecordsRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +type QueryListRecordsRequest_ReferenceInput struct { + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (m *QueryListRecordsRequest_ReferenceInput) Reset() { + *m = QueryListRecordsRequest_ReferenceInput{} +} +func (m *QueryListRecordsRequest_ReferenceInput) String() string { return proto.CompactTextString(m) } +func (*QueryListRecordsRequest_ReferenceInput) ProtoMessage() {} +func (*QueryListRecordsRequest_ReferenceInput) Descriptor() ([]byte, []int) { + return fileDescriptor_73d2465766c8f876, []int{2, 0} +} +func (m *QueryListRecordsRequest_ReferenceInput) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryListRecordsRequest_ReferenceInput) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryListRecordsRequest_ReferenceInput.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 *QueryListRecordsRequest_ReferenceInput) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryListRecordsRequest_ReferenceInput.Merge(m, src) +} +func (m *QueryListRecordsRequest_ReferenceInput) XXX_Size() int { + return m.Size() +} +func (m *QueryListRecordsRequest_ReferenceInput) XXX_DiscardUnknown() { + xxx_messageInfo_QueryListRecordsRequest_ReferenceInput.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryListRecordsRequest_ReferenceInput proto.InternalMessageInfo + +func (m *QueryListRecordsRequest_ReferenceInput) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +type QueryListRecordsRequest_ValueInput struct { + Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` + String_ string `protobuf:"bytes,2,opt,name=string,proto3" json:"string,omitempty"` + Int int64 `protobuf:"varint,3,opt,name=int,proto3" json:"int,omitempty"` + Float float64 `protobuf:"fixed64,4,opt,name=float,proto3" json:"float,omitempty"` + Boolean bool `protobuf:"varint,5,opt,name=boolean,proto3" json:"boolean,omitempty"` + Reference *QueryListRecordsRequest_ReferenceInput `protobuf:"bytes,6,opt,name=reference,proto3" json:"reference,omitempty"` + Values []*QueryListRecordsRequest_ValueInput `protobuf:"bytes,7,rep,name=values,proto3" json:"values,omitempty"` +} + +func (m *QueryListRecordsRequest_ValueInput) Reset() { *m = QueryListRecordsRequest_ValueInput{} } +func (m *QueryListRecordsRequest_ValueInput) String() string { return proto.CompactTextString(m) } +func (*QueryListRecordsRequest_ValueInput) ProtoMessage() {} +func (*QueryListRecordsRequest_ValueInput) Descriptor() ([]byte, []int) { + return fileDescriptor_73d2465766c8f876, []int{2, 1} +} +func (m *QueryListRecordsRequest_ValueInput) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryListRecordsRequest_ValueInput) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryListRecordsRequest_ValueInput.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 *QueryListRecordsRequest_ValueInput) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryListRecordsRequest_ValueInput.Merge(m, src) +} +func (m *QueryListRecordsRequest_ValueInput) XXX_Size() int { + return m.Size() +} +func (m *QueryListRecordsRequest_ValueInput) XXX_DiscardUnknown() { + xxx_messageInfo_QueryListRecordsRequest_ValueInput.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryListRecordsRequest_ValueInput proto.InternalMessageInfo + +func (m *QueryListRecordsRequest_ValueInput) GetType() string { + if m != nil { + return m.Type + } + return "" +} + +func (m *QueryListRecordsRequest_ValueInput) GetString_() string { + if m != nil { + return m.String_ + } + return "" +} + +func (m *QueryListRecordsRequest_ValueInput) GetInt() int64 { + if m != nil { + return m.Int + } + return 0 +} + +func (m *QueryListRecordsRequest_ValueInput) GetFloat() float64 { + if m != nil { + return m.Float + } + return 0 +} + +func (m *QueryListRecordsRequest_ValueInput) GetBoolean() bool { + if m != nil { + return m.Boolean + } + return false +} + +func (m *QueryListRecordsRequest_ValueInput) GetReference() *QueryListRecordsRequest_ReferenceInput { + if m != nil { + return m.Reference + } + return nil +} + +func (m *QueryListRecordsRequest_ValueInput) GetValues() []*QueryListRecordsRequest_ValueInput { + if m != nil { + return m.Values + } + return nil +} + +type QueryListRecordsRequest_KeyValueInput struct { + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Value *QueryListRecordsRequest_ValueInput `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` +} + +func (m *QueryListRecordsRequest_KeyValueInput) Reset() { *m = QueryListRecordsRequest_KeyValueInput{} } +func (m *QueryListRecordsRequest_KeyValueInput) String() string { return proto.CompactTextString(m) } +func (*QueryListRecordsRequest_KeyValueInput) ProtoMessage() {} +func (*QueryListRecordsRequest_KeyValueInput) Descriptor() ([]byte, []int) { + return fileDescriptor_73d2465766c8f876, []int{2, 2} +} +func (m *QueryListRecordsRequest_KeyValueInput) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryListRecordsRequest_KeyValueInput) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryListRecordsRequest_KeyValueInput.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 *QueryListRecordsRequest_KeyValueInput) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryListRecordsRequest_KeyValueInput.Merge(m, src) +} +func (m *QueryListRecordsRequest_KeyValueInput) XXX_Size() int { + return m.Size() +} +func (m *QueryListRecordsRequest_KeyValueInput) XXX_DiscardUnknown() { + xxx_messageInfo_QueryListRecordsRequest_KeyValueInput.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryListRecordsRequest_KeyValueInput proto.InternalMessageInfo + +func (m *QueryListRecordsRequest_KeyValueInput) GetKey() string { + if m != nil { + return m.Key + } + return "" +} + +func (m *QueryListRecordsRequest_KeyValueInput) GetValue() *QueryListRecordsRequest_ValueInput { + if m != nil { + return m.Value + } + return nil +} + +// QueryListRecordsResponse is response type for nameservice records list +type QueryListRecordsResponse struct { + Records []Record `protobuf:"bytes,1,rep,name=records,proto3" json:"records"` + // pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryListRecordsResponse) Reset() { *m = QueryListRecordsResponse{} } +func (m *QueryListRecordsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryListRecordsResponse) ProtoMessage() {} +func (*QueryListRecordsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_73d2465766c8f876, []int{3} +} +func (m *QueryListRecordsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryListRecordsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryListRecordsResponse.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 *QueryListRecordsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryListRecordsResponse.Merge(m, src) +} +func (m *QueryListRecordsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryListRecordsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryListRecordsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryListRecordsResponse proto.InternalMessageInfo + +func (m *QueryListRecordsResponse) GetRecords() []Record { + if m != nil { + return m.Records + } + return nil +} + +func (m *QueryListRecordsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +//QueryRecordByIdRequest is request type for nameservice records by id +type QueryRecordByIdRequest struct { + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (m *QueryRecordByIdRequest) Reset() { *m = QueryRecordByIdRequest{} } +func (m *QueryRecordByIdRequest) String() string { return proto.CompactTextString(m) } +func (*QueryRecordByIdRequest) ProtoMessage() {} +func (*QueryRecordByIdRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_73d2465766c8f876, []int{4} +} +func (m *QueryRecordByIdRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryRecordByIdRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryRecordByIdRequest.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 *QueryRecordByIdRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryRecordByIdRequest.Merge(m, src) +} +func (m *QueryRecordByIdRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryRecordByIdRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryRecordByIdRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryRecordByIdRequest proto.InternalMessageInfo + +func (m *QueryRecordByIdRequest) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +// QueryRecordByIdResponse is response type for nameservice records by id +type QueryRecordByIdResponse struct { + Record Record `protobuf:"bytes,1,opt,name=record,proto3" json:"record"` +} + +func (m *QueryRecordByIdResponse) Reset() { *m = QueryRecordByIdResponse{} } +func (m *QueryRecordByIdResponse) String() string { return proto.CompactTextString(m) } +func (*QueryRecordByIdResponse) ProtoMessage() {} +func (*QueryRecordByIdResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_73d2465766c8f876, []int{5} +} +func (m *QueryRecordByIdResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryRecordByIdResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryRecordByIdResponse.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 *QueryRecordByIdResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryRecordByIdResponse.Merge(m, src) +} +func (m *QueryRecordByIdResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryRecordByIdResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryRecordByIdResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryRecordByIdResponse proto.InternalMessageInfo + +func (m *QueryRecordByIdResponse) GetRecord() Record { + if m != nil { + return m.Record + } + return Record{} +} + +// QueryRecordByBondIdRequest is request type for get the records by bond-id +type QueryRecordByBondIdRequest struct { + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryRecordByBondIdRequest) Reset() { *m = QueryRecordByBondIdRequest{} } +func (m *QueryRecordByBondIdRequest) String() string { return proto.CompactTextString(m) } +func (*QueryRecordByBondIdRequest) ProtoMessage() {} +func (*QueryRecordByBondIdRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_73d2465766c8f876, []int{6} +} +func (m *QueryRecordByBondIdRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryRecordByBondIdRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryRecordByBondIdRequest.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 *QueryRecordByBondIdRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryRecordByBondIdRequest.Merge(m, src) +} +func (m *QueryRecordByBondIdRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryRecordByBondIdRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryRecordByBondIdRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryRecordByBondIdRequest proto.InternalMessageInfo + +func (m *QueryRecordByBondIdRequest) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +func (m *QueryRecordByBondIdRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryRecordByBondIdResponse is response type for records list by bond-id +type QueryRecordByBondIdResponse struct { + Records []Record `protobuf:"bytes,1,rep,name=records,proto3" json:"records"` + // pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryRecordByBondIdResponse) Reset() { *m = QueryRecordByBondIdResponse{} } +func (m *QueryRecordByBondIdResponse) String() string { return proto.CompactTextString(m) } +func (*QueryRecordByBondIdResponse) ProtoMessage() {} +func (*QueryRecordByBondIdResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_73d2465766c8f876, []int{7} +} +func (m *QueryRecordByBondIdResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryRecordByBondIdResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryRecordByBondIdResponse.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 *QueryRecordByBondIdResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryRecordByBondIdResponse.Merge(m, src) +} +func (m *QueryRecordByBondIdResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryRecordByBondIdResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryRecordByBondIdResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryRecordByBondIdResponse proto.InternalMessageInfo + +func (m *QueryRecordByBondIdResponse) GetRecords() []Record { + if m != nil { + return m.Records + } + return nil +} + +func (m *QueryRecordByBondIdResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +// GetNameServiceModuleBalanceRequest is request type for nameservice module accounts balance +type GetNameServiceModuleBalanceRequest struct { +} + +func (m *GetNameServiceModuleBalanceRequest) Reset() { *m = GetNameServiceModuleBalanceRequest{} } +func (m *GetNameServiceModuleBalanceRequest) String() string { return proto.CompactTextString(m) } +func (*GetNameServiceModuleBalanceRequest) ProtoMessage() {} +func (*GetNameServiceModuleBalanceRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_73d2465766c8f876, []int{8} +} +func (m *GetNameServiceModuleBalanceRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetNameServiceModuleBalanceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetNameServiceModuleBalanceRequest.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 *GetNameServiceModuleBalanceRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetNameServiceModuleBalanceRequest.Merge(m, src) +} +func (m *GetNameServiceModuleBalanceRequest) XXX_Size() int { + return m.Size() +} +func (m *GetNameServiceModuleBalanceRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetNameServiceModuleBalanceRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetNameServiceModuleBalanceRequest proto.InternalMessageInfo + +// GetNameServiceModuleBalanceResponse is response type for nameservice module accounts balance +type GetNameServiceModuleBalanceResponse struct { + Balances []*AccountBalance `protobuf:"bytes,1,rep,name=balances,proto3" json:"balances,omitempty"` +} + +func (m *GetNameServiceModuleBalanceResponse) Reset() { *m = GetNameServiceModuleBalanceResponse{} } +func (m *GetNameServiceModuleBalanceResponse) String() string { return proto.CompactTextString(m) } +func (*GetNameServiceModuleBalanceResponse) ProtoMessage() {} +func (*GetNameServiceModuleBalanceResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_73d2465766c8f876, []int{9} +} +func (m *GetNameServiceModuleBalanceResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetNameServiceModuleBalanceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetNameServiceModuleBalanceResponse.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 *GetNameServiceModuleBalanceResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetNameServiceModuleBalanceResponse.Merge(m, src) +} +func (m *GetNameServiceModuleBalanceResponse) XXX_Size() int { + return m.Size() +} +func (m *GetNameServiceModuleBalanceResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetNameServiceModuleBalanceResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetNameServiceModuleBalanceResponse proto.InternalMessageInfo + +func (m *GetNameServiceModuleBalanceResponse) GetBalances() []*AccountBalance { + if m != nil { + return m.Balances + } + return nil +} + +// AccountBalance is nameservice module account balance +type AccountBalance struct { + AccountName string `protobuf:"bytes,1,opt,name=account_name,json=accountName,proto3" json:"account_name,omitempty" json:"accountName" yaml:"accountName"` + Balance github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,3,rep,name=balance,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"balance" json:"balance" yaml:"balance"` +} + +func (m *AccountBalance) Reset() { *m = AccountBalance{} } +func (m *AccountBalance) String() string { return proto.CompactTextString(m) } +func (*AccountBalance) ProtoMessage() {} +func (*AccountBalance) Descriptor() ([]byte, []int) { + return fileDescriptor_73d2465766c8f876, []int{10} +} +func (m *AccountBalance) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AccountBalance) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AccountBalance.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 *AccountBalance) XXX_Merge(src proto.Message) { + xxx_messageInfo_AccountBalance.Merge(m, src) +} +func (m *AccountBalance) XXX_Size() int { + return m.Size() +} +func (m *AccountBalance) XXX_DiscardUnknown() { + xxx_messageInfo_AccountBalance.DiscardUnknown(m) +} + +var xxx_messageInfo_AccountBalance proto.InternalMessageInfo + +func (m *AccountBalance) GetAccountName() string { + if m != nil { + return m.AccountName + } + return "" +} + +func (m *AccountBalance) GetBalance() github_com_cosmos_cosmos_sdk_types.Coins { + if m != nil { + return m.Balance + } + return nil +} + +// QueryListNameRecordsRequest is request type for nameservice names records +type QueryListNameRecordsRequest struct { + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryListNameRecordsRequest) Reset() { *m = QueryListNameRecordsRequest{} } +func (m *QueryListNameRecordsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryListNameRecordsRequest) ProtoMessage() {} +func (*QueryListNameRecordsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_73d2465766c8f876, []int{11} +} +func (m *QueryListNameRecordsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryListNameRecordsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryListNameRecordsRequest.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 *QueryListNameRecordsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryListNameRecordsRequest.Merge(m, src) +} +func (m *QueryListNameRecordsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryListNameRecordsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryListNameRecordsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryListNameRecordsRequest proto.InternalMessageInfo + +func (m *QueryListNameRecordsRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryListNameRecordsResponse is response type for nameservice names records +type QueryListNameRecordsResponse struct { + Names []NameEntry `protobuf:"bytes,1,rep,name=names,proto3" json:"names"` + // pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryListNameRecordsResponse) Reset() { *m = QueryListNameRecordsResponse{} } +func (m *QueryListNameRecordsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryListNameRecordsResponse) ProtoMessage() {} +func (*QueryListNameRecordsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_73d2465766c8f876, []int{12} +} +func (m *QueryListNameRecordsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryListNameRecordsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryListNameRecordsResponse.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 *QueryListNameRecordsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryListNameRecordsResponse.Merge(m, src) +} +func (m *QueryListNameRecordsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryListNameRecordsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryListNameRecordsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryListNameRecordsResponse proto.InternalMessageInfo + +func (m *QueryListNameRecordsResponse) GetNames() []NameEntry { + if m != nil { + return m.Names + } + return nil +} + +func (m *QueryListNameRecordsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryWhoisRequest is request type for Get NameAuthority +type QueryWhoisRequest struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` +} + +func (m *QueryWhoisRequest) Reset() { *m = QueryWhoisRequest{} } +func (m *QueryWhoisRequest) String() string { return proto.CompactTextString(m) } +func (*QueryWhoisRequest) ProtoMessage() {} +func (*QueryWhoisRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_73d2465766c8f876, []int{13} +} +func (m *QueryWhoisRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryWhoisRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryWhoisRequest.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 *QueryWhoisRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryWhoisRequest.Merge(m, src) +} +func (m *QueryWhoisRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryWhoisRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryWhoisRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryWhoisRequest proto.InternalMessageInfo + +func (m *QueryWhoisRequest) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +// QueryWhoisResponse is response type for whois request +type QueryWhoisResponse struct { + NameAuthority NameAuthority `protobuf:"bytes,1,opt,name=name_authority,json=nameAuthority,proto3" json:"name_authority" json:"nameAuthority" yaml:"nameAuthority"` +} + +func (m *QueryWhoisResponse) Reset() { *m = QueryWhoisResponse{} } +func (m *QueryWhoisResponse) String() string { return proto.CompactTextString(m) } +func (*QueryWhoisResponse) ProtoMessage() {} +func (*QueryWhoisResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_73d2465766c8f876, []int{14} +} +func (m *QueryWhoisResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryWhoisResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryWhoisResponse.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 *QueryWhoisResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryWhoisResponse.Merge(m, src) +} +func (m *QueryWhoisResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryWhoisResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryWhoisResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryWhoisResponse proto.InternalMessageInfo + +func (m *QueryWhoisResponse) GetNameAuthority() NameAuthority { + if m != nil { + return m.NameAuthority + } + return NameAuthority{} +} + +// QueryLookupCrn is request type for LookupCrn +type QueryLookupCrn struct { + Crn string `protobuf:"bytes,1,opt,name=crn,proto3" json:"crn,omitempty"` +} + +func (m *QueryLookupCrn) Reset() { *m = QueryLookupCrn{} } +func (m *QueryLookupCrn) String() string { return proto.CompactTextString(m) } +func (*QueryLookupCrn) ProtoMessage() {} +func (*QueryLookupCrn) Descriptor() ([]byte, []int) { + return fileDescriptor_73d2465766c8f876, []int{15} +} +func (m *QueryLookupCrn) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryLookupCrn) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryLookupCrn.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 *QueryLookupCrn) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryLookupCrn.Merge(m, src) +} +func (m *QueryLookupCrn) XXX_Size() int { + return m.Size() +} +func (m *QueryLookupCrn) XXX_DiscardUnknown() { + xxx_messageInfo_QueryLookupCrn.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryLookupCrn proto.InternalMessageInfo + +func (m *QueryLookupCrn) GetCrn() string { + if m != nil { + return m.Crn + } + return "" +} + +// QueryLookupCrnResponse is response type for QueryLookupCrn +type QueryLookupCrnResponse struct { + Name *NameRecord `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` +} + +func (m *QueryLookupCrnResponse) Reset() { *m = QueryLookupCrnResponse{} } +func (m *QueryLookupCrnResponse) String() string { return proto.CompactTextString(m) } +func (*QueryLookupCrnResponse) ProtoMessage() {} +func (*QueryLookupCrnResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_73d2465766c8f876, []int{16} +} +func (m *QueryLookupCrnResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryLookupCrnResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryLookupCrnResponse.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 *QueryLookupCrnResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryLookupCrnResponse.Merge(m, src) +} +func (m *QueryLookupCrnResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryLookupCrnResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryLookupCrnResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryLookupCrnResponse proto.InternalMessageInfo + +func (m *QueryLookupCrnResponse) GetName() *NameRecord { + if m != nil { + return m.Name + } + return nil +} + +// QueryResolveCrn is request type for ResolveCrn +type QueryResolveCrn struct { + Crn string `protobuf:"bytes,1,opt,name=crn,proto3" json:"crn,omitempty"` +} + +func (m *QueryResolveCrn) Reset() { *m = QueryResolveCrn{} } +func (m *QueryResolveCrn) String() string { return proto.CompactTextString(m) } +func (*QueryResolveCrn) ProtoMessage() {} +func (*QueryResolveCrn) Descriptor() ([]byte, []int) { + return fileDescriptor_73d2465766c8f876, []int{17} +} +func (m *QueryResolveCrn) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryResolveCrn) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryResolveCrn.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 *QueryResolveCrn) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryResolveCrn.Merge(m, src) +} +func (m *QueryResolveCrn) XXX_Size() int { + return m.Size() +} +func (m *QueryResolveCrn) XXX_DiscardUnknown() { + xxx_messageInfo_QueryResolveCrn.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryResolveCrn proto.InternalMessageInfo + +func (m *QueryResolveCrn) GetCrn() string { + if m != nil { + return m.Crn + } + return "" +} + +// QueryResolveCrnResponse is response type for QueryResolveCrn +type QueryResolveCrnResponse struct { + Record *Record `protobuf:"bytes,1,opt,name=record,proto3" json:"record,omitempty"` +} + +func (m *QueryResolveCrnResponse) Reset() { *m = QueryResolveCrnResponse{} } +func (m *QueryResolveCrnResponse) String() string { return proto.CompactTextString(m) } +func (*QueryResolveCrnResponse) ProtoMessage() {} +func (*QueryResolveCrnResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_73d2465766c8f876, []int{18} +} +func (m *QueryResolveCrnResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryResolveCrnResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryResolveCrnResponse.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 *QueryResolveCrnResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryResolveCrnResponse.Merge(m, src) +} +func (m *QueryResolveCrnResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryResolveCrnResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryResolveCrnResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryResolveCrnResponse proto.InternalMessageInfo + +func (m *QueryResolveCrnResponse) GetRecord() *Record { + if m != nil { + return m.Record + } + return nil +} + +// QueryGetRecordExpiryQueue +type QueryGetRecordExpiryQueue struct { + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryGetRecordExpiryQueue) Reset() { *m = QueryGetRecordExpiryQueue{} } +func (m *QueryGetRecordExpiryQueue) String() string { return proto.CompactTextString(m) } +func (*QueryGetRecordExpiryQueue) ProtoMessage() {} +func (*QueryGetRecordExpiryQueue) Descriptor() ([]byte, []int) { + return fileDescriptor_73d2465766c8f876, []int{19} +} +func (m *QueryGetRecordExpiryQueue) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetRecordExpiryQueue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetRecordExpiryQueue.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 *QueryGetRecordExpiryQueue) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetRecordExpiryQueue.Merge(m, src) +} +func (m *QueryGetRecordExpiryQueue) XXX_Size() int { + return m.Size() +} +func (m *QueryGetRecordExpiryQueue) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetRecordExpiryQueue.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetRecordExpiryQueue proto.InternalMessageInfo + +func (m *QueryGetRecordExpiryQueue) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryGetRecordExpiryQueueResponse +type QueryGetRecordExpiryQueueResponse struct { + Records []*ExpiryQueueRecord `protobuf:"bytes,1,rep,name=records,proto3" json:"records,omitempty"` + // pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryGetRecordExpiryQueueResponse) Reset() { *m = QueryGetRecordExpiryQueueResponse{} } +func (m *QueryGetRecordExpiryQueueResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGetRecordExpiryQueueResponse) ProtoMessage() {} +func (*QueryGetRecordExpiryQueueResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_73d2465766c8f876, []int{20} +} +func (m *QueryGetRecordExpiryQueueResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetRecordExpiryQueueResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetRecordExpiryQueueResponse.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 *QueryGetRecordExpiryQueueResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetRecordExpiryQueueResponse.Merge(m, src) +} +func (m *QueryGetRecordExpiryQueueResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryGetRecordExpiryQueueResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetRecordExpiryQueueResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetRecordExpiryQueueResponse proto.InternalMessageInfo + +func (m *QueryGetRecordExpiryQueueResponse) GetRecords() []*ExpiryQueueRecord { + if m != nil { + return m.Records + } + return nil +} + +func (m *QueryGetRecordExpiryQueueResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +// ExpiryQueueRecord +type ExpiryQueueRecord struct { + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Value []string `protobuf:"bytes,2,rep,name=value,proto3" json:"value,omitempty"` +} + +func (m *ExpiryQueueRecord) Reset() { *m = ExpiryQueueRecord{} } +func (m *ExpiryQueueRecord) String() string { return proto.CompactTextString(m) } +func (*ExpiryQueueRecord) ProtoMessage() {} +func (*ExpiryQueueRecord) Descriptor() ([]byte, []int) { + return fileDescriptor_73d2465766c8f876, []int{21} +} +func (m *ExpiryQueueRecord) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ExpiryQueueRecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ExpiryQueueRecord.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 *ExpiryQueueRecord) XXX_Merge(src proto.Message) { + xxx_messageInfo_ExpiryQueueRecord.Merge(m, src) +} +func (m *ExpiryQueueRecord) XXX_Size() int { + return m.Size() +} +func (m *ExpiryQueueRecord) XXX_DiscardUnknown() { + xxx_messageInfo_ExpiryQueueRecord.DiscardUnknown(m) +} + +var xxx_messageInfo_ExpiryQueueRecord proto.InternalMessageInfo + +func (m *ExpiryQueueRecord) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +func (m *ExpiryQueueRecord) GetValue() []string { + if m != nil { + return m.Value + } + return nil +} + +// QueryGetAuthorityExpiryQueue +type QueryGetAuthorityExpiryQueue struct { + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryGetAuthorityExpiryQueue) Reset() { *m = QueryGetAuthorityExpiryQueue{} } +func (m *QueryGetAuthorityExpiryQueue) String() string { return proto.CompactTextString(m) } +func (*QueryGetAuthorityExpiryQueue) ProtoMessage() {} +func (*QueryGetAuthorityExpiryQueue) Descriptor() ([]byte, []int) { + return fileDescriptor_73d2465766c8f876, []int{22} +} +func (m *QueryGetAuthorityExpiryQueue) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetAuthorityExpiryQueue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetAuthorityExpiryQueue.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 *QueryGetAuthorityExpiryQueue) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetAuthorityExpiryQueue.Merge(m, src) +} +func (m *QueryGetAuthorityExpiryQueue) XXX_Size() int { + return m.Size() +} +func (m *QueryGetAuthorityExpiryQueue) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetAuthorityExpiryQueue.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetAuthorityExpiryQueue proto.InternalMessageInfo + +func (m *QueryGetAuthorityExpiryQueue) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryGetAuthorityExpiryQueueResponse +type QueryGetAuthorityExpiryQueueResponse struct { + Authorities []*ExpiryQueueRecord `protobuf:"bytes,1,rep,name=authorities,proto3" json:"authorities,omitempty"` + // pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryGetAuthorityExpiryQueueResponse) Reset() { *m = QueryGetAuthorityExpiryQueueResponse{} } +func (m *QueryGetAuthorityExpiryQueueResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGetAuthorityExpiryQueueResponse) ProtoMessage() {} +func (*QueryGetAuthorityExpiryQueueResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_73d2465766c8f876, []int{23} +} +func (m *QueryGetAuthorityExpiryQueueResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetAuthorityExpiryQueueResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetAuthorityExpiryQueueResponse.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 *QueryGetAuthorityExpiryQueueResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetAuthorityExpiryQueueResponse.Merge(m, src) +} +func (m *QueryGetAuthorityExpiryQueueResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryGetAuthorityExpiryQueueResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetAuthorityExpiryQueueResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetAuthorityExpiryQueueResponse proto.InternalMessageInfo + +func (m *QueryGetAuthorityExpiryQueueResponse) GetAuthorities() []*ExpiryQueueRecord { + if m != nil { + return m.Authorities + } + return nil +} + +func (m *QueryGetAuthorityExpiryQueueResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +func init() { + proto.RegisterType((*QueryParamsRequest)(nil), "vulcanize.nameservice.v1beta1.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "vulcanize.nameservice.v1beta1.QueryParamsResponse") + proto.RegisterType((*QueryListRecordsRequest)(nil), "vulcanize.nameservice.v1beta1.QueryListRecordsRequest") + proto.RegisterType((*QueryListRecordsRequest_ReferenceInput)(nil), "vulcanize.nameservice.v1beta1.QueryListRecordsRequest.ReferenceInput") + proto.RegisterType((*QueryListRecordsRequest_ValueInput)(nil), "vulcanize.nameservice.v1beta1.QueryListRecordsRequest.ValueInput") + proto.RegisterType((*QueryListRecordsRequest_KeyValueInput)(nil), "vulcanize.nameservice.v1beta1.QueryListRecordsRequest.KeyValueInput") + proto.RegisterType((*QueryListRecordsResponse)(nil), "vulcanize.nameservice.v1beta1.QueryListRecordsResponse") + proto.RegisterType((*QueryRecordByIdRequest)(nil), "vulcanize.nameservice.v1beta1.QueryRecordByIdRequest") + proto.RegisterType((*QueryRecordByIdResponse)(nil), "vulcanize.nameservice.v1beta1.QueryRecordByIdResponse") + proto.RegisterType((*QueryRecordByBondIdRequest)(nil), "vulcanize.nameservice.v1beta1.QueryRecordByBondIdRequest") + proto.RegisterType((*QueryRecordByBondIdResponse)(nil), "vulcanize.nameservice.v1beta1.QueryRecordByBondIdResponse") + proto.RegisterType((*GetNameServiceModuleBalanceRequest)(nil), "vulcanize.nameservice.v1beta1.GetNameServiceModuleBalanceRequest") + proto.RegisterType((*GetNameServiceModuleBalanceResponse)(nil), "vulcanize.nameservice.v1beta1.GetNameServiceModuleBalanceResponse") + proto.RegisterType((*AccountBalance)(nil), "vulcanize.nameservice.v1beta1.AccountBalance") + proto.RegisterType((*QueryListNameRecordsRequest)(nil), "vulcanize.nameservice.v1beta1.QueryListNameRecordsRequest") + proto.RegisterType((*QueryListNameRecordsResponse)(nil), "vulcanize.nameservice.v1beta1.QueryListNameRecordsResponse") + proto.RegisterType((*QueryWhoisRequest)(nil), "vulcanize.nameservice.v1beta1.QueryWhoisRequest") + proto.RegisterType((*QueryWhoisResponse)(nil), "vulcanize.nameservice.v1beta1.QueryWhoisResponse") + proto.RegisterType((*QueryLookupCrn)(nil), "vulcanize.nameservice.v1beta1.QueryLookupCrn") + proto.RegisterType((*QueryLookupCrnResponse)(nil), "vulcanize.nameservice.v1beta1.QueryLookupCrnResponse") + proto.RegisterType((*QueryResolveCrn)(nil), "vulcanize.nameservice.v1beta1.QueryResolveCrn") + proto.RegisterType((*QueryResolveCrnResponse)(nil), "vulcanize.nameservice.v1beta1.QueryResolveCrnResponse") + proto.RegisterType((*QueryGetRecordExpiryQueue)(nil), "vulcanize.nameservice.v1beta1.QueryGetRecordExpiryQueue") + proto.RegisterType((*QueryGetRecordExpiryQueueResponse)(nil), "vulcanize.nameservice.v1beta1.QueryGetRecordExpiryQueueResponse") + proto.RegisterType((*ExpiryQueueRecord)(nil), "vulcanize.nameservice.v1beta1.ExpiryQueueRecord") + proto.RegisterType((*QueryGetAuthorityExpiryQueue)(nil), "vulcanize.nameservice.v1beta1.QueryGetAuthorityExpiryQueue") + proto.RegisterType((*QueryGetAuthorityExpiryQueueResponse)(nil), "vulcanize.nameservice.v1beta1.QueryGetAuthorityExpiryQueueResponse") +} + +func init() { + proto.RegisterFile("vulcanize/nameservice/v1beta1/query.proto", fileDescriptor_73d2465766c8f876) +} + +var fileDescriptor_73d2465766c8f876 = []byte{ + // 1412 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x58, 0x4b, 0x6c, 0x1b, 0x45, + 0x18, 0xce, 0x24, 0xb1, 0xd3, 0xfc, 0xa1, 0x29, 0x1d, 0xa2, 0xd6, 0xdd, 0xb6, 0x4e, 0xd8, 0xbe, + 0x1c, 0xa8, 0x77, 0x9b, 0x94, 0xbe, 0x05, 0xa2, 0x4e, 0x43, 0xd4, 0x52, 0x10, 0x5d, 0x10, 0x05, + 0x0e, 0x54, 0xeb, 0xf5, 0xd4, 0x59, 0x6a, 0xcf, 0xb8, 0xbb, 0xb3, 0xa1, 0x6e, 0xd5, 0x0b, 0x87, + 0x9e, 0x91, 0x38, 0x83, 0x40, 0xe2, 0x54, 0x09, 0xb8, 0x70, 0xa8, 0xb8, 0x72, 0xa9, 0x38, 0x55, + 0x82, 0x03, 0xa7, 0x82, 0x5a, 0x24, 0xee, 0x3d, 0x72, 0x42, 0x3b, 0x33, 0xbb, 0xde, 0x4d, 0x9c, + 0x78, 0xed, 0x04, 0x89, 0x93, 0x67, 0x67, 0xff, 0xc7, 0xf7, 0xfd, 0x8f, 0xd9, 0x7f, 0x0c, 0xb3, + 0x2b, 0x41, 0xc3, 0xb1, 0xa9, 0x7b, 0x9b, 0x98, 0xd4, 0x6e, 0x12, 0x9f, 0x78, 0x2b, 0xae, 0x43, + 0xcc, 0x95, 0xb9, 0x2a, 0xe1, 0xf6, 0x9c, 0x79, 0x33, 0x20, 0x5e, 0xdb, 0x68, 0x79, 0x8c, 0x33, + 0xbc, 0x3f, 0x16, 0x35, 0x12, 0xa2, 0x86, 0x12, 0xd5, 0xcc, 0x8d, 0x2d, 0x25, 0x55, 0x84, 0x3d, + 0x6d, 0x5f, 0x9d, 0xb1, 0x7a, 0x83, 0x98, 0x76, 0xcb, 0x35, 0x6d, 0x4a, 0x19, 0xb7, 0xb9, 0xcb, + 0xa8, 0xaf, 0xde, 0xbe, 0xe4, 0x30, 0xbf, 0xc9, 0x7c, 0xb3, 0x6a, 0xfb, 0x44, 0xc2, 0x88, 0x4d, + 0xb5, 0xec, 0xba, 0x4b, 0x85, 0xb0, 0x92, 0x9d, 0xaa, 0xb3, 0x3a, 0x13, 0x4b, 0x33, 0x5c, 0xa9, + 0xdd, 0x62, 0xd2, 0x42, 0xa4, 0xeb, 0x30, 0x57, 0x69, 0xe9, 0x53, 0x80, 0xaf, 0x84, 0x76, 0xdf, + 0xb1, 0x3d, 0xbb, 0xe9, 0x5b, 0xe4, 0x66, 0x40, 0x7c, 0xae, 0xbf, 0x07, 0x2f, 0xa4, 0x76, 0xfd, + 0x16, 0xa3, 0x3e, 0xc1, 0xaf, 0x42, 0xbe, 0x25, 0x76, 0x0a, 0x68, 0x06, 0x95, 0x26, 0xe6, 0x0f, + 0x19, 0x1b, 0x46, 0xc3, 0x50, 0xea, 0x4a, 0x49, 0xff, 0x31, 0x07, 0xbb, 0x85, 0xd9, 0xcb, 0xae, + 0xcf, 0x2d, 0xe2, 0x30, 0xaf, 0x16, 0x79, 0xc4, 0x35, 0x00, 0x9b, 0x73, 0xcf, 0xad, 0x06, 0x9c, + 0x84, 0xe6, 0x47, 0x4a, 0x13, 0xf3, 0x17, 0x7a, 0x98, 0x5f, 0xc7, 0x96, 0xf1, 0x26, 0x69, 0xbf, + 0x6f, 0x37, 0x02, 0x72, 0x91, 0xb6, 0x02, 0x6e, 0x25, 0xec, 0xe2, 0xe7, 0x61, 0xc4, 0x6e, 0x34, + 0x0a, 0xc3, 0x33, 0xa8, 0xb4, 0xcd, 0x0a, 0x97, 0xf8, 0x0d, 0x80, 0x4e, 0x24, 0x0b, 0x23, 0x82, + 0xd6, 0x61, 0x43, 0x06, 0xcd, 0x08, 0x83, 0x66, 0xc8, 0xec, 0x77, 0x28, 0xd5, 0x89, 0xf2, 0x63, + 0x25, 0x34, 0xb5, 0x19, 0x98, 0xb4, 0xc8, 0x75, 0xe2, 0x11, 0xea, 0x48, 0xbf, 0x78, 0x12, 0x86, + 0xdd, 0x9a, 0x08, 0xd4, 0xb8, 0x35, 0xec, 0xd6, 0xb4, 0x9f, 0x86, 0x01, 0x3a, 0xb0, 0x30, 0x86, + 0x51, 0xde, 0x6e, 0x11, 0x25, 0x20, 0xd6, 0x78, 0x17, 0xe4, 0x7d, 0xee, 0xb9, 0xb4, 0x2e, 0x10, + 0x8e, 0x5b, 0xea, 0x29, 0x84, 0xed, 0x52, 0x2e, 0xd0, 0x8d, 0x58, 0xe1, 0x12, 0x4f, 0x41, 0xee, + 0x7a, 0x83, 0xd9, 0xbc, 0x30, 0x3a, 0x83, 0x4a, 0xc8, 0x92, 0x0f, 0xb8, 0x00, 0x63, 0x55, 0xc6, + 0x1a, 0xc4, 0xa6, 0x85, 0x9c, 0xa0, 0x18, 0x3d, 0x62, 0x07, 0xc6, 0xbd, 0x08, 0x5e, 0x21, 0x2f, + 0x58, 0x2e, 0x0e, 0x18, 0xdd, 0x34, 0x4d, 0xab, 0x63, 0x17, 0x7f, 0x08, 0xf9, 0x95, 0x90, 0xa0, + 0x5f, 0x18, 0x13, 0xf9, 0x3b, 0x3f, 0xa0, 0x87, 0x44, 0xf2, 0x94, 0x41, 0xed, 0x36, 0x6c, 0x4f, + 0x65, 0x35, 0x0c, 0xc9, 0x0d, 0xd2, 0x56, 0xd1, 0x0b, 0x97, 0xf8, 0x2a, 0xe4, 0x84, 0xb0, 0x88, + 0xdd, 0x96, 0x38, 0x97, 0xf6, 0xf4, 0xfb, 0x08, 0x0a, 0x6b, 0xa5, 0x55, 0x4b, 0x2c, 0xc2, 0x98, + 0x27, 0xb7, 0x54, 0xd1, 0xf6, 0xea, 0x09, 0x69, 0xa0, 0x32, 0xfa, 0xf0, 0xf1, 0xf4, 0x90, 0x15, + 0xe9, 0xe2, 0xa5, 0x54, 0x19, 0x4a, 0x06, 0x47, 0x7a, 0x96, 0xa1, 0xc4, 0x90, 0xac, 0x43, 0xbd, + 0x04, 0xbb, 0x04, 0x56, 0xe5, 0xa6, 0x7d, 0xb1, 0x16, 0x75, 0xd8, 0xaa, 0x7a, 0xd4, 0x3f, 0x56, + 0xcd, 0x98, 0x94, 0x54, 0xa4, 0x16, 0x20, 0x2f, 0x81, 0x65, 0xec, 0xf3, 0x14, 0x27, 0xa5, 0xaa, + 0x73, 0xd0, 0x52, 0xf6, 0x2b, 0x8c, 0xd6, 0xd6, 0x45, 0xb3, 0xaa, 0x0f, 0x87, 0x07, 0xed, 0x43, + 0xfd, 0x3b, 0x04, 0x7b, 0xbb, 0xba, 0xfd, 0x9f, 0xe6, 0xeb, 0x20, 0xe8, 0x4b, 0x84, 0xbf, 0x6d, + 0x37, 0xc9, 0xbb, 0xd2, 0xf1, 0x5b, 0xac, 0x16, 0x34, 0x48, 0xc5, 0x6e, 0xd8, 0xd4, 0x89, 0x18, + 0xea, 0x2d, 0x38, 0xb0, 0xa1, 0x94, 0x22, 0x77, 0x11, 0xb6, 0x55, 0xe5, 0x56, 0xc4, 0xae, 0xdc, + 0x83, 0xdd, 0x79, 0xc7, 0x61, 0x01, 0xe5, 0x91, 0xa1, 0x58, 0x5d, 0xff, 0x1b, 0xc1, 0x64, 0xfa, + 0x25, 0xbe, 0x0c, 0xcf, 0xd9, 0x72, 0xe7, 0x5a, 0x68, 0x4a, 0x26, 0xaf, 0x32, 0xfb, 0xec, 0xf1, + 0xf4, 0xa1, 0x4f, 0x7c, 0x46, 0xcf, 0xea, 0xea, 0x6d, 0x08, 0x53, 0x9f, 0x69, 0xdb, 0xcd, 0x46, + 0x7a, 0xcb, 0x9a, 0x48, 0x3c, 0xe1, 0x7b, 0x08, 0xc6, 0x94, 0xb7, 0xc2, 0x88, 0xc0, 0xba, 0x27, + 0x15, 0xbf, 0x08, 0xe1, 0x02, 0x73, 0x69, 0xe5, 0x4a, 0x18, 0xfd, 0x67, 0x8f, 0xa7, 0xf7, 0x4b, + 0x47, 0x4a, 0x2f, 0x72, 0x12, 0x3d, 0xde, 0xff, 0x63, 0xba, 0x54, 0x77, 0xf9, 0x72, 0x50, 0x35, + 0x1c, 0xd6, 0x34, 0xd5, 0x97, 0x4f, 0xfe, 0x94, 0xfd, 0xda, 0x0d, 0x33, 0x3c, 0x64, 0x7d, 0x61, + 0xd1, 0xb7, 0x22, 0xe7, 0x3a, 0x51, 0x05, 0x13, 0x76, 0x77, 0x88, 0x6c, 0xd5, 0x87, 0x29, 0x5d, + 0x98, 0x68, 0x33, 0x85, 0xb9, 0xaf, 0xbb, 0x1f, 0x95, 0xbc, 0x0b, 0x90, 0x13, 0x19, 0x52, 0x99, + 0x2b, 0xf5, 0xc8, 0x5c, 0x68, 0x62, 0x91, 0x72, 0xaf, 0xad, 0x4a, 0x53, 0x2a, 0x6f, 0x5d, 0x61, + 0x1e, 0x81, 0x9d, 0x02, 0xee, 0xd5, 0x65, 0xe6, 0xc6, 0xc1, 0xc0, 0x30, 0xda, 0x49, 0xbd, 0x25, + 0xd6, 0xfa, 0x97, 0x48, 0x8d, 0x10, 0x4a, 0x52, 0xd1, 0xb9, 0x87, 0x60, 0x32, 0x7c, 0x7f, 0xcd, + 0x0e, 0xf8, 0x32, 0xf3, 0x5c, 0xde, 0x56, 0xc1, 0x3b, 0x9a, 0x81, 0xd8, 0xf9, 0x48, 0xa7, 0x32, + 0xa7, 0x32, 0x3f, 0x2b, 0x33, 0x4f, 0x93, 0x2f, 0xa3, 0xfc, 0xa7, 0x37, 0xad, 0xed, 0xe9, 0x67, + 0x1d, 0x26, 0x65, 0xdc, 0x19, 0xbb, 0x11, 0xb4, 0x16, 0x3c, 0x1a, 0x7e, 0x3b, 0x1c, 0x8f, 0x46, + 0xdf, 0x0e, 0xc7, 0xa3, 0xfa, 0x55, 0x75, 0x6a, 0xc6, 0x32, 0x89, 0x91, 0xa7, 0xc3, 0x78, 0x62, + 0x7e, 0x36, 0x03, 0x76, 0x99, 0x57, 0x15, 0x9c, 0x03, 0xb0, 0x43, 0x9d, 0x46, 0x3e, 0x6b, 0xac, + 0x90, 0xee, 0xde, 0x3f, 0x88, 0x4f, 0xe2, 0x48, 0x28, 0x39, 0x71, 0x0d, 0x70, 0x12, 0xc7, 0x67, + 0xb0, 0x03, 0x7b, 0x84, 0xe5, 0x25, 0xa2, 0x3e, 0x5c, 0x8b, 0xb7, 0x5a, 0xae, 0xd7, 0xbe, 0x12, + 0x90, 0x80, 0x6c, 0x59, 0x65, 0x3f, 0x40, 0xf0, 0xe2, 0xba, 0x5e, 0x62, 0x26, 0x97, 0x56, 0x1f, + 0xbc, 0xc7, 0x7a, 0x50, 0x49, 0x19, 0x11, 0xac, 0xb6, 0xfe, 0xf4, 0x3d, 0x03, 0x3b, 0xd7, 0xb8, + 0x59, 0xf3, 0x69, 0x9a, 0xea, 0x0c, 0x16, 0x23, 0xa5, 0xf1, 0x68, 0x2a, 0xb8, 0xae, 0xda, 0x79, + 0x89, 0xf0, 0xb8, 0xd6, 0xfe, 0x8b, 0xe8, 0xfe, 0x8c, 0xe0, 0xe0, 0x46, 0x8e, 0xe2, 0x00, 0x5b, + 0x30, 0x11, 0xb5, 0x9a, 0x4b, 0x06, 0x0f, 0x72, 0xd2, 0xc8, 0x96, 0x05, 0x7a, 0xfe, 0x9f, 0x1d, + 0x90, 0x13, 0x2c, 0xf0, 0x57, 0x08, 0xf2, 0xf2, 0x5e, 0x80, 0xe7, 0xb2, 0x8c, 0x68, 0xa9, 0x8b, + 0x89, 0x36, 0xdf, 0x8f, 0x8a, 0xc4, 0xa1, 0x97, 0x3f, 0xfb, 0xf5, 0xaf, 0x2f, 0x86, 0x8f, 0xe0, + 0x43, 0x3d, 0x2e, 0x67, 0xf2, 0x96, 0x82, 0xbf, 0x47, 0x30, 0x91, 0x98, 0xf4, 0xf0, 0xc9, 0xc1, + 0x06, 0x49, 0xed, 0x54, 0xdf, 0x7a, 0x0a, 0xaf, 0x21, 0xf0, 0x96, 0xf0, 0xe1, 0x1e, 0x78, 0xa3, + 0x6e, 0xf8, 0x01, 0xc1, 0x78, 0xdc, 0x7a, 0xf8, 0x44, 0x16, 0xb7, 0x6b, 0xa6, 0x43, 0xed, 0x64, + 0xbf, 0x6a, 0x0a, 0xec, 0x71, 0x01, 0xb6, 0x8c, 0x5f, 0xce, 0x06, 0xd6, 0xbc, 0xe3, 0xd6, 0xee, + 0xe2, 0x5f, 0x10, 0xec, 0x8c, 0x11, 0x47, 0x23, 0x1a, 0x3e, 0xd3, 0x0f, 0x84, 0xd4, 0x34, 0xa9, + 0x9d, 0x1d, 0x44, 0x55, 0x31, 0x78, 0x4d, 0x30, 0x38, 0x8d, 0x4f, 0x66, 0x63, 0x50, 0xae, 0xb6, + 0xcb, 0x55, 0x46, 0x6b, 0x65, 0xb7, 0x26, 0xc9, 0xfc, 0x86, 0x60, 0xef, 0x06, 0xc3, 0x19, 0xee, + 0x75, 0x11, 0xe9, 0x3d, 0xfe, 0x69, 0x95, 0xcd, 0x98, 0xe8, 0xb3, 0xaa, 0xd4, 0x58, 0x84, 0x1f, + 0x20, 0xd8, 0xb1, 0x6a, 0x54, 0xc1, 0x67, 0xb3, 0x96, 0xf4, 0xda, 0x39, 0x4a, 0x3b, 0x37, 0x90, + 0xae, 0x02, 0x7f, 0x54, 0x80, 0x3f, 0x8c, 0x0f, 0x66, 0xf9, 0x7f, 0x05, 0x7f, 0x83, 0x20, 0x27, + 0x86, 0x11, 0x7c, 0x2c, 0x8b, 0xd3, 0xe4, 0x84, 0xa3, 0xcd, 0xf5, 0xa1, 0xd1, 0x67, 0x0b, 0x7c, + 0x1a, 0x6a, 0x99, 0x77, 0xc2, 0x57, 0x77, 0xf1, 0xd7, 0x08, 0xc6, 0x3b, 0x13, 0x49, 0x39, 0x53, + 0x70, 0x22, 0x71, 0xed, 0x44, 0x5f, 0xe2, 0x7d, 0x1f, 0x84, 0x0d, 0xa1, 0x89, 0xbf, 0x45, 0x00, + 0x89, 0xb9, 0xc5, 0xc8, 0xd6, 0x63, 0x91, 0x7c, 0xd6, 0x13, 0x65, 0xf5, 0xc8, 0xd3, 0xc7, 0xf1, + 0x27, 0x54, 0xf1, 0x43, 0x04, 0x53, 0x5d, 0xe7, 0x9b, 0xd3, 0x59, 0x00, 0x74, 0xd3, 0xd4, 0x5e, + 0x1f, 0x54, 0x33, 0x26, 0xf1, 0x8a, 0x20, 0x61, 0xe0, 0xa3, 0x99, 0x0e, 0x95, 0x32, 0x11, 0x26, + 0xc2, 0xa3, 0x64, 0xf7, 0x7a, 0xf3, 0xc4, 0xb9, 0x8c, 0x98, 0xba, 0x29, 0x6b, 0x0b, 0x9b, 0x50, + 0x8e, 0x39, 0x9d, 0x12, 0x9c, 0xe6, 0xb0, 0xd9, 0x83, 0x53, 0x3c, 0xf0, 0x2b, 0x5a, 0x95, 0x4b, + 0x0f, 0x9f, 0x14, 0xd1, 0xa3, 0x27, 0x45, 0xf4, 0xe7, 0x93, 0x22, 0xfa, 0xfc, 0x69, 0x71, 0xe8, + 0xd1, 0xd3, 0xe2, 0xd0, 0xef, 0x4f, 0x8b, 0x43, 0x1f, 0x1d, 0x4b, 0x5c, 0xd7, 0xf8, 0xb2, 0xed, + 0xf9, 0xae, 0x6f, 0x12, 0xbe, 0x4c, 0xbc, 0xa6, 0x4b, 0xb9, 0x79, 0x2b, 0x65, 0x5e, 0x5c, 0xde, + 0xaa, 0x79, 0xf1, 0xb7, 0xe5, 0xf1, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0xb9, 0x17, 0xf0, 0x11, + 0xb3, 0x15, 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 { + // Params queries the nameservice module params. + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) + // List records + ListRecords(ctx context.Context, in *QueryListRecordsRequest, opts ...grpc.CallOption) (*QueryListRecordsResponse, error) + // Get record by id + GetRecord(ctx context.Context, in *QueryRecordByIdRequest, opts ...grpc.CallOption) (*QueryRecordByIdResponse, error) + // Get records by bond id + GetRecordByBondId(ctx context.Context, in *QueryRecordByBondIdRequest, opts ...grpc.CallOption) (*QueryRecordByBondIdResponse, error) + // Get nameservice module balance + GetNameServiceModuleBalance(ctx context.Context, in *GetNameServiceModuleBalanceRequest, opts ...grpc.CallOption) (*GetNameServiceModuleBalanceResponse, error) + // List name records + ListNameRecords(ctx context.Context, in *QueryListNameRecordsRequest, opts ...grpc.CallOption) (*QueryListNameRecordsResponse, error) + // Whois method retrieve the name authority info + Whois(ctx context.Context, in *QueryWhoisRequest, opts ...grpc.CallOption) (*QueryWhoisResponse, error) + // LookupCrn + LookupCrn(ctx context.Context, in *QueryLookupCrn, opts ...grpc.CallOption) (*QueryLookupCrnResponse, error) + // ResolveCrn + ResolveCrn(ctx context.Context, in *QueryResolveCrn, opts ...grpc.CallOption) (*QueryResolveCrnResponse, error) + // GetRecordExpiryQueue + GetRecordExpiryQueue(ctx context.Context, in *QueryGetRecordExpiryQueue, opts ...grpc.CallOption) (*QueryGetRecordExpiryQueueResponse, error) + // GetAuthorityExpiryQueue + GetAuthorityExpiryQueue(ctx context.Context, in *QueryGetAuthorityExpiryQueue, opts ...grpc.CallOption) (*QueryGetAuthorityExpiryQueueResponse, 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, "/vulcanize.nameservice.v1beta1.Query/Params", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) ListRecords(ctx context.Context, in *QueryListRecordsRequest, opts ...grpc.CallOption) (*QueryListRecordsResponse, error) { + out := new(QueryListRecordsResponse) + err := c.cc.Invoke(ctx, "/vulcanize.nameservice.v1beta1.Query/ListRecords", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) GetRecord(ctx context.Context, in *QueryRecordByIdRequest, opts ...grpc.CallOption) (*QueryRecordByIdResponse, error) { + out := new(QueryRecordByIdResponse) + err := c.cc.Invoke(ctx, "/vulcanize.nameservice.v1beta1.Query/GetRecord", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) GetRecordByBondId(ctx context.Context, in *QueryRecordByBondIdRequest, opts ...grpc.CallOption) (*QueryRecordByBondIdResponse, error) { + out := new(QueryRecordByBondIdResponse) + err := c.cc.Invoke(ctx, "/vulcanize.nameservice.v1beta1.Query/GetRecordByBondId", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) GetNameServiceModuleBalance(ctx context.Context, in *GetNameServiceModuleBalanceRequest, opts ...grpc.CallOption) (*GetNameServiceModuleBalanceResponse, error) { + out := new(GetNameServiceModuleBalanceResponse) + err := c.cc.Invoke(ctx, "/vulcanize.nameservice.v1beta1.Query/GetNameServiceModuleBalance", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) ListNameRecords(ctx context.Context, in *QueryListNameRecordsRequest, opts ...grpc.CallOption) (*QueryListNameRecordsResponse, error) { + out := new(QueryListNameRecordsResponse) + err := c.cc.Invoke(ctx, "/vulcanize.nameservice.v1beta1.Query/ListNameRecords", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Whois(ctx context.Context, in *QueryWhoisRequest, opts ...grpc.CallOption) (*QueryWhoisResponse, error) { + out := new(QueryWhoisResponse) + err := c.cc.Invoke(ctx, "/vulcanize.nameservice.v1beta1.Query/Whois", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) LookupCrn(ctx context.Context, in *QueryLookupCrn, opts ...grpc.CallOption) (*QueryLookupCrnResponse, error) { + out := new(QueryLookupCrnResponse) + err := c.cc.Invoke(ctx, "/vulcanize.nameservice.v1beta1.Query/LookupCrn", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) ResolveCrn(ctx context.Context, in *QueryResolveCrn, opts ...grpc.CallOption) (*QueryResolveCrnResponse, error) { + out := new(QueryResolveCrnResponse) + err := c.cc.Invoke(ctx, "/vulcanize.nameservice.v1beta1.Query/ResolveCrn", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) GetRecordExpiryQueue(ctx context.Context, in *QueryGetRecordExpiryQueue, opts ...grpc.CallOption) (*QueryGetRecordExpiryQueueResponse, error) { + out := new(QueryGetRecordExpiryQueueResponse) + err := c.cc.Invoke(ctx, "/vulcanize.nameservice.v1beta1.Query/GetRecordExpiryQueue", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) GetAuthorityExpiryQueue(ctx context.Context, in *QueryGetAuthorityExpiryQueue, opts ...grpc.CallOption) (*QueryGetAuthorityExpiryQueueResponse, error) { + out := new(QueryGetAuthorityExpiryQueueResponse) + err := c.cc.Invoke(ctx, "/vulcanize.nameservice.v1beta1.Query/GetAuthorityExpiryQueue", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // Params queries the nameservice module params. + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) + // List records + ListRecords(context.Context, *QueryListRecordsRequest) (*QueryListRecordsResponse, error) + // Get record by id + GetRecord(context.Context, *QueryRecordByIdRequest) (*QueryRecordByIdResponse, error) + // Get records by bond id + GetRecordByBondId(context.Context, *QueryRecordByBondIdRequest) (*QueryRecordByBondIdResponse, error) + // Get nameservice module balance + GetNameServiceModuleBalance(context.Context, *GetNameServiceModuleBalanceRequest) (*GetNameServiceModuleBalanceResponse, error) + // List name records + ListNameRecords(context.Context, *QueryListNameRecordsRequest) (*QueryListNameRecordsResponse, error) + // Whois method retrieve the name authority info + Whois(context.Context, *QueryWhoisRequest) (*QueryWhoisResponse, error) + // LookupCrn + LookupCrn(context.Context, *QueryLookupCrn) (*QueryLookupCrnResponse, error) + // ResolveCrn + ResolveCrn(context.Context, *QueryResolveCrn) (*QueryResolveCrnResponse, error) + // GetRecordExpiryQueue + GetRecordExpiryQueue(context.Context, *QueryGetRecordExpiryQueue) (*QueryGetRecordExpiryQueueResponse, error) + // GetAuthorityExpiryQueue + GetAuthorityExpiryQueue(context.Context, *QueryGetAuthorityExpiryQueue) (*QueryGetAuthorityExpiryQueueResponse, 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 (*UnimplementedQueryServer) ListRecords(ctx context.Context, req *QueryListRecordsRequest) (*QueryListRecordsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListRecords not implemented") +} +func (*UnimplementedQueryServer) GetRecord(ctx context.Context, req *QueryRecordByIdRequest) (*QueryRecordByIdResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetRecord not implemented") +} +func (*UnimplementedQueryServer) GetRecordByBondId(ctx context.Context, req *QueryRecordByBondIdRequest) (*QueryRecordByBondIdResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetRecordByBondId not implemented") +} +func (*UnimplementedQueryServer) GetNameServiceModuleBalance(ctx context.Context, req *GetNameServiceModuleBalanceRequest) (*GetNameServiceModuleBalanceResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetNameServiceModuleBalance not implemented") +} +func (*UnimplementedQueryServer) ListNameRecords(ctx context.Context, req *QueryListNameRecordsRequest) (*QueryListNameRecordsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListNameRecords not implemented") +} +func (*UnimplementedQueryServer) Whois(ctx context.Context, req *QueryWhoisRequest) (*QueryWhoisResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Whois not implemented") +} +func (*UnimplementedQueryServer) LookupCrn(ctx context.Context, req *QueryLookupCrn) (*QueryLookupCrnResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method LookupCrn not implemented") +} +func (*UnimplementedQueryServer) ResolveCrn(ctx context.Context, req *QueryResolveCrn) (*QueryResolveCrnResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ResolveCrn not implemented") +} +func (*UnimplementedQueryServer) GetRecordExpiryQueue(ctx context.Context, req *QueryGetRecordExpiryQueue) (*QueryGetRecordExpiryQueueResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetRecordExpiryQueue not implemented") +} +func (*UnimplementedQueryServer) GetAuthorityExpiryQueue(ctx context.Context, req *QueryGetAuthorityExpiryQueue) (*QueryGetAuthorityExpiryQueueResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetAuthorityExpiryQueue 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: "/vulcanize.nameservice.v1beta1.Query/Params", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_ListRecords_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryListRecordsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).ListRecords(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vulcanize.nameservice.v1beta1.Query/ListRecords", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).ListRecords(ctx, req.(*QueryListRecordsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_GetRecord_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryRecordByIdRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).GetRecord(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vulcanize.nameservice.v1beta1.Query/GetRecord", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GetRecord(ctx, req.(*QueryRecordByIdRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_GetRecordByBondId_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryRecordByBondIdRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).GetRecordByBondId(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vulcanize.nameservice.v1beta1.Query/GetRecordByBondId", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GetRecordByBondId(ctx, req.(*QueryRecordByBondIdRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_GetNameServiceModuleBalance_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetNameServiceModuleBalanceRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).GetNameServiceModuleBalance(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vulcanize.nameservice.v1beta1.Query/GetNameServiceModuleBalance", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GetNameServiceModuleBalance(ctx, req.(*GetNameServiceModuleBalanceRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_ListNameRecords_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryListNameRecordsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).ListNameRecords(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vulcanize.nameservice.v1beta1.Query/ListNameRecords", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).ListNameRecords(ctx, req.(*QueryListNameRecordsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Whois_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryWhoisRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Whois(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vulcanize.nameservice.v1beta1.Query/Whois", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Whois(ctx, req.(*QueryWhoisRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_LookupCrn_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryLookupCrn) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).LookupCrn(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vulcanize.nameservice.v1beta1.Query/LookupCrn", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).LookupCrn(ctx, req.(*QueryLookupCrn)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_ResolveCrn_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryResolveCrn) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).ResolveCrn(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vulcanize.nameservice.v1beta1.Query/ResolveCrn", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).ResolveCrn(ctx, req.(*QueryResolveCrn)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_GetRecordExpiryQueue_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetRecordExpiryQueue) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).GetRecordExpiryQueue(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vulcanize.nameservice.v1beta1.Query/GetRecordExpiryQueue", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GetRecordExpiryQueue(ctx, req.(*QueryGetRecordExpiryQueue)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_GetAuthorityExpiryQueue_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetAuthorityExpiryQueue) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).GetAuthorityExpiryQueue(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vulcanize.nameservice.v1beta1.Query/GetAuthorityExpiryQueue", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GetAuthorityExpiryQueue(ctx, req.(*QueryGetAuthorityExpiryQueue)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "vulcanize.nameservice.v1beta1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + { + MethodName: "ListRecords", + Handler: _Query_ListRecords_Handler, + }, + { + MethodName: "GetRecord", + Handler: _Query_GetRecord_Handler, + }, + { + MethodName: "GetRecordByBondId", + Handler: _Query_GetRecordByBondId_Handler, + }, + { + MethodName: "GetNameServiceModuleBalance", + Handler: _Query_GetNameServiceModuleBalance_Handler, + }, + { + MethodName: "ListNameRecords", + Handler: _Query_ListNameRecords_Handler, + }, + { + MethodName: "Whois", + Handler: _Query_Whois_Handler, + }, + { + MethodName: "LookupCrn", + Handler: _Query_LookupCrn_Handler, + }, + { + MethodName: "ResolveCrn", + Handler: _Query_ResolveCrn_Handler, + }, + { + MethodName: "GetRecordExpiryQueue", + Handler: _Query_GetRecordExpiryQueue_Handler, + }, + { + MethodName: "GetAuthorityExpiryQueue", + Handler: _Query_GetAuthorityExpiryQueue_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "vulcanize/nameservice/v1beta1/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 + if m.Params != nil { + { + 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 (m *QueryListRecordsRequest) 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 *QueryListRecordsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryListRecordsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.All { + i-- + if m.All { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 + } + if len(m.Attributes) > 0 { + for iNdEx := len(m.Attributes) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Attributes[iNdEx].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 (m *QueryListRecordsRequest_ReferenceInput) 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 *QueryListRecordsRequest_ReferenceInput) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryListRecordsRequest_ReferenceInput) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Id) > 0 { + i -= len(m.Id) + copy(dAtA[i:], m.Id) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Id))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryListRecordsRequest_ValueInput) 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 *QueryListRecordsRequest_ValueInput) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryListRecordsRequest_ValueInput) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Values) > 0 { + for iNdEx := len(m.Values) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Values[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + } + } + if m.Reference != nil { + { + size, err := m.Reference.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + if m.Boolean { + i-- + if m.Boolean { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x28 + } + if m.Float != 0 { + i -= 8 + encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.Float)))) + i-- + dAtA[i] = 0x21 + } + if m.Int != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Int)) + i-- + dAtA[i] = 0x18 + } + if len(m.String_) > 0 { + i -= len(m.String_) + copy(dAtA[i:], m.String_) + i = encodeVarintQuery(dAtA, i, uint64(len(m.String_))) + i-- + dAtA[i] = 0x12 + } + if len(m.Type) > 0 { + i -= len(m.Type) + copy(dAtA[i:], m.Type) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Type))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryListRecordsRequest_KeyValueInput) 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 *QueryListRecordsRequest_KeyValueInput) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryListRecordsRequest_KeyValueInput) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Value != nil { + { + size, err := m.Value.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Key) > 0 { + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryListRecordsResponse) 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 *QueryListRecordsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryListRecordsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Records) > 0 { + for iNdEx := len(m.Records) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Records[iNdEx].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 (m *QueryRecordByIdRequest) 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 *QueryRecordByIdRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryRecordByIdRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Id) > 0 { + i -= len(m.Id) + copy(dAtA[i:], m.Id) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Id))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryRecordByIdResponse) 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 *QueryRecordByIdResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryRecordByIdResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Record.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 (m *QueryRecordByBondIdRequest) 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 *QueryRecordByBondIdRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryRecordByBondIdRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Id) > 0 { + i -= len(m.Id) + copy(dAtA[i:], m.Id) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Id))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryRecordByBondIdResponse) 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 *QueryRecordByBondIdResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryRecordByBondIdResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Records) > 0 { + for iNdEx := len(m.Records) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Records[iNdEx].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 (m *GetNameServiceModuleBalanceRequest) 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 *GetNameServiceModuleBalanceRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetNameServiceModuleBalanceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *GetNameServiceModuleBalanceResponse) 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 *GetNameServiceModuleBalanceResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetNameServiceModuleBalanceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Balances) > 0 { + for iNdEx := len(m.Balances) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Balances[iNdEx].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 (m *AccountBalance) 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 *AccountBalance) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AccountBalance) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Balance) > 0 { + for iNdEx := len(m.Balance) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Balance[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.AccountName) > 0 { + i -= len(m.AccountName) + copy(dAtA[i:], m.AccountName) + i = encodeVarintQuery(dAtA, i, uint64(len(m.AccountName))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryListNameRecordsRequest) 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 *QueryListNameRecordsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryListNameRecordsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.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 (m *QueryListNameRecordsResponse) 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 *QueryListNameRecordsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryListNameRecordsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Names) > 0 { + for iNdEx := len(m.Names) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Names[iNdEx].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 (m *QueryWhoisRequest) 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 *QueryWhoisRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryWhoisRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryWhoisResponse) 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 *QueryWhoisResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryWhoisResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.NameAuthority.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 (m *QueryLookupCrn) 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 *QueryLookupCrn) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryLookupCrn) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Crn) > 0 { + i -= len(m.Crn) + copy(dAtA[i:], m.Crn) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Crn))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryLookupCrnResponse) 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 *QueryLookupCrnResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryLookupCrnResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Name != nil { + { + size, err := m.Name.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 (m *QueryResolveCrn) 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 *QueryResolveCrn) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryResolveCrn) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Crn) > 0 { + i -= len(m.Crn) + copy(dAtA[i:], m.Crn) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Crn))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryResolveCrnResponse) 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 *QueryResolveCrnResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryResolveCrnResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Record != nil { + { + size, err := m.Record.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 (m *QueryGetRecordExpiryQueue) 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 *QueryGetRecordExpiryQueue) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetRecordExpiryQueue) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.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 (m *QueryGetRecordExpiryQueueResponse) 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 *QueryGetRecordExpiryQueueResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetRecordExpiryQueueResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Records) > 0 { + for iNdEx := len(m.Records) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Records[iNdEx].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 (m *ExpiryQueueRecord) 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 *ExpiryQueueRecord) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ExpiryQueueRecord) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Value) > 0 { + for iNdEx := len(m.Value) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Value[iNdEx]) + copy(dAtA[i:], m.Value[iNdEx]) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Value[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + if len(m.Id) > 0 { + i -= len(m.Id) + copy(dAtA[i:], m.Id) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Id))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryGetAuthorityExpiryQueue) 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 *QueryGetAuthorityExpiryQueue) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetAuthorityExpiryQueue) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.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 (m *QueryGetAuthorityExpiryQueueResponse) 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 *QueryGetAuthorityExpiryQueueResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetAuthorityExpiryQueueResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Authorities) > 0 { + for iNdEx := len(m.Authorities) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Authorities[iNdEx].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 + if m.Params != nil { + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryListRecordsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Attributes) > 0 { + for _, e := range m.Attributes { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.All { + n += 2 + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryListRecordsRequest_ReferenceInput) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Id) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryListRecordsRequest_ValueInput) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Type) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.String_) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Int != 0 { + n += 1 + sovQuery(uint64(m.Int)) + } + if m.Float != 0 { + n += 9 + } + if m.Boolean { + n += 2 + } + if m.Reference != nil { + l = m.Reference.Size() + n += 1 + l + sovQuery(uint64(l)) + } + if len(m.Values) > 0 { + for _, e := range m.Values { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryListRecordsRequest_KeyValueInput) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Key) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Value != nil { + l = m.Value.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryListRecordsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Records) > 0 { + for _, e := range m.Records { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryRecordByIdRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Id) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryRecordByIdResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Record.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryRecordByBondIdRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Id) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryRecordByBondIdResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Records) > 0 { + for _, e := range m.Records { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *GetNameServiceModuleBalanceRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *GetNameServiceModuleBalanceResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Balances) > 0 { + for _, e := range m.Balances { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *AccountBalance) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.AccountName) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if len(m.Balance) > 0 { + for _, e := range m.Balance { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryListNameRecordsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryListNameRecordsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Names) > 0 { + for _, e := range m.Names { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryWhoisRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryWhoisResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.NameAuthority.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryLookupCrn) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Crn) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryLookupCrnResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Name != nil { + l = m.Name.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryResolveCrn) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Crn) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryResolveCrnResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Record != nil { + l = m.Record.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGetRecordExpiryQueue) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGetRecordExpiryQueueResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Records) > 0 { + for _, e := range m.Records { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *ExpiryQueueRecord) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Id) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if len(m.Value) > 0 { + for _, s := range m.Value { + l = len(s) + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryGetAuthorityExpiryQueue) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGetAuthorityExpiryQueueResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Authorities) > 0 { + for _, e := range m.Authorities { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.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 m.Params == nil { + m.Params = &Params{} + } + 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 (m *QueryListRecordsRequest) 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: QueryListRecordsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryListRecordsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Attributes", 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 + } + m.Attributes = append(m.Attributes, &QueryListRecordsRequest_KeyValueInput{}) + if err := m.Attributes[len(m.Attributes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field All", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.All = bool(v != 0) + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", 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 m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.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 (m *QueryListRecordsRequest_ReferenceInput) 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: ReferenceInput: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ReferenceInput: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Id = string(dAtA[iNdEx:postIndex]) + 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 (m *QueryListRecordsRequest_ValueInput) 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: ValueInput: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ValueInput: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Type = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field String_", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.String_ = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Int", wireType) + } + m.Int = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Int |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field Float", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.Float = float64(math.Float64frombits(v)) + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Boolean", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Boolean = bool(v != 0) + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Reference", 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 m.Reference == nil { + m.Reference = &QueryListRecordsRequest_ReferenceInput{} + } + if err := m.Reference.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Values", 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 + } + m.Values = append(m.Values, &QueryListRecordsRequest_ValueInput{}) + if err := m.Values[len(m.Values)-1].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 (m *QueryListRecordsRequest_KeyValueInput) 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: KeyValueInput: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: KeyValueInput: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", 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 m.Value == nil { + m.Value = &QueryListRecordsRequest_ValueInput{} + } + if err := m.Value.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 (m *QueryListRecordsResponse) 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: QueryListRecordsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryListRecordsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Records", 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 + } + m.Records = append(m.Records, Record{}) + if err := m.Records[len(m.Records)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", 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 m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.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 (m *QueryRecordByIdRequest) 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: QueryRecordByIdRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryRecordByIdRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Id = string(dAtA[iNdEx:postIndex]) + 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 (m *QueryRecordByIdResponse) 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: QueryRecordByIdResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryRecordByIdResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Record", 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.Record.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 (m *QueryRecordByBondIdRequest) 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: QueryRecordByBondIdRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryRecordByBondIdRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Id = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", 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 m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.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 (m *QueryRecordByBondIdResponse) 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: QueryRecordByBondIdResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryRecordByBondIdResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Records", 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 + } + m.Records = append(m.Records, Record{}) + if err := m.Records[len(m.Records)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", 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 m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.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 (m *GetNameServiceModuleBalanceRequest) 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: GetNameServiceModuleBalanceRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetNameServiceModuleBalanceRequest: 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 *GetNameServiceModuleBalanceResponse) 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: GetNameServiceModuleBalanceResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetNameServiceModuleBalanceResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Balances", 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 + } + m.Balances = append(m.Balances, &AccountBalance{}) + if err := m.Balances[len(m.Balances)-1].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 (m *AccountBalance) 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: AccountBalance: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AccountBalance: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AccountName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AccountName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Balance", 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 + } + m.Balance = append(m.Balance, types.Coin{}) + if err := m.Balance[len(m.Balance)-1].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 (m *QueryListNameRecordsRequest) 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: QueryListNameRecordsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryListNameRecordsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", 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 m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.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 (m *QueryListNameRecordsResponse) 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: QueryListNameRecordsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryListNameRecordsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Names", 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 + } + m.Names = append(m.Names, NameEntry{}) + if err := m.Names[len(m.Names)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", 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 m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.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 (m *QueryWhoisRequest) 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: QueryWhoisRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryWhoisRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + 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 (m *QueryWhoisResponse) 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: QueryWhoisResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryWhoisResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NameAuthority", 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.NameAuthority.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 (m *QueryLookupCrn) 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: QueryLookupCrn: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryLookupCrn: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Crn", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Crn = string(dAtA[iNdEx:postIndex]) + 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 (m *QueryLookupCrnResponse) 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: QueryLookupCrnResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryLookupCrnResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", 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 m.Name == nil { + m.Name = &NameRecord{} + } + if err := m.Name.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 (m *QueryResolveCrn) 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: QueryResolveCrn: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryResolveCrn: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Crn", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Crn = string(dAtA[iNdEx:postIndex]) + 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 (m *QueryResolveCrnResponse) 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: QueryResolveCrnResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryResolveCrnResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Record", 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 m.Record == nil { + m.Record = &Record{} + } + if err := m.Record.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 (m *QueryGetRecordExpiryQueue) 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: QueryGetRecordExpiryQueue: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetRecordExpiryQueue: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", 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 m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.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 (m *QueryGetRecordExpiryQueueResponse) 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: QueryGetRecordExpiryQueueResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetRecordExpiryQueueResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Records", 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 + } + m.Records = append(m.Records, &ExpiryQueueRecord{}) + if err := m.Records[len(m.Records)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", 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 m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.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 (m *ExpiryQueueRecord) 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: ExpiryQueueRecord: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ExpiryQueueRecord: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Id = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = append(m.Value, string(dAtA[iNdEx:postIndex])) + 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 (m *QueryGetAuthorityExpiryQueue) 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: QueryGetAuthorityExpiryQueue: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetAuthorityExpiryQueue: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", 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 m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.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 (m *QueryGetAuthorityExpiryQueueResponse) 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: QueryGetAuthorityExpiryQueueResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetAuthorityExpiryQueueResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authorities", 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 + } + m.Authorities = append(m.Authorities, &ExpiryQueueRecord{}) + if err := m.Authorities[len(m.Authorities)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", 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 m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.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/nameservice/types/query.pb.gw.go b/x/nameservice/types/query.pb.gw.go new file mode 100644 index 00000000..a6094b92 --- /dev/null +++ b/x/nameservice/types/query.pb.gw.go @@ -0,0 +1,1002 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: vulcanize/nameservice/v1beta1/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/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 + +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 + +} + +var ( + filter_Query_ListRecords_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_ListRecords_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryListRecordsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ListRecords_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.ListRecords(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_ListRecords_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryListRecordsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ListRecords_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.ListRecords(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_GetRecord_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryRecordByIdRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") + } + + protoReq.Id, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) + } + + msg, err := client.GetRecord(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_GetRecord_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryRecordByIdRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") + } + + protoReq.Id, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) + } + + msg, err := server.GetRecord(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_GetRecordByBondId_0 = &utilities.DoubleArray{Encoding: map[string]int{"id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Query_GetRecordByBondId_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryRecordByBondIdRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") + } + + protoReq.Id, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GetRecordByBondId_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.GetRecordByBondId(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_GetRecordByBondId_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryRecordByBondIdRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") + } + + protoReq.Id, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GetRecordByBondId_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.GetRecordByBondId(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_GetNameServiceModuleBalance_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetNameServiceModuleBalanceRequest + var metadata runtime.ServerMetadata + + msg, err := client.GetNameServiceModuleBalance(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_GetNameServiceModuleBalance_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetNameServiceModuleBalanceRequest + var metadata runtime.ServerMetadata + + msg, err := server.GetNameServiceModuleBalance(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_ListNameRecords_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_ListNameRecords_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryListNameRecordsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ListNameRecords_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.ListNameRecords(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_ListNameRecords_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryListNameRecordsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ListNameRecords_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.ListNameRecords(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_Whois_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryWhoisRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + + protoReq.Name, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + + msg, err := client.Whois(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Whois_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryWhoisRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + + protoReq.Name, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + + msg, err := server.Whois(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_LookupCrn_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_LookupCrn_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryLookupCrn + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_LookupCrn_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.LookupCrn(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_LookupCrn_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryLookupCrn + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_LookupCrn_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.LookupCrn(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_ResolveCrn_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_ResolveCrn_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryResolveCrn + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ResolveCrn_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.ResolveCrn(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_ResolveCrn_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryResolveCrn + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ResolveCrn_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.ResolveCrn(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_GetRecordExpiryQueue_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_GetRecordExpiryQueue_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetRecordExpiryQueue + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GetRecordExpiryQueue_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.GetRecordExpiryQueue(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_GetRecordExpiryQueue_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetRecordExpiryQueue + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GetRecordExpiryQueue_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.GetRecordExpiryQueue(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_GetAuthorityExpiryQueue_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_GetAuthorityExpiryQueue_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetAuthorityExpiryQueue + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GetAuthorityExpiryQueue_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.GetAuthorityExpiryQueue(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_GetAuthorityExpiryQueue_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetAuthorityExpiryQueue + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GetAuthorityExpiryQueue_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.GetAuthorityExpiryQueue(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 (such as grpc.SendHeader, etc) 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() + 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) + 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()...) + + }) + + mux.Handle("GET", pattern_Query_ListRecords_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.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_ListRecords_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_ListRecords_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GetRecord_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.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_GetRecord_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_GetRecord_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GetRecordByBondId_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.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_GetRecordByBondId_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_GetRecordByBondId_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GetNameServiceModuleBalance_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.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_GetNameServiceModuleBalance_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_GetNameServiceModuleBalance_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_ListNameRecords_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.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_ListNameRecords_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_ListNameRecords_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Whois_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.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Whois_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Whois_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_LookupCrn_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.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_LookupCrn_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_LookupCrn_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_ResolveCrn_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.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_ResolveCrn_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_ResolveCrn_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GetRecordExpiryQueue_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.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_GetRecordExpiryQueue_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_GetRecordExpiryQueue_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GetAuthorityExpiryQueue_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.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_GetAuthorityExpiryQueue_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_GetAuthorityExpiryQueue_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()...) + + }) + + mux.Handle("GET", pattern_Query_ListRecords_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_ListRecords_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_ListRecords_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GetRecord_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_GetRecord_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_GetRecord_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GetRecordByBondId_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_GetRecordByBondId_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_GetRecordByBondId_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GetNameServiceModuleBalance_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_GetNameServiceModuleBalance_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_GetNameServiceModuleBalance_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_ListNameRecords_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_ListNameRecords_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_ListNameRecords_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Whois_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_Whois_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_Whois_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_LookupCrn_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_LookupCrn_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_LookupCrn_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_ResolveCrn_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_ResolveCrn_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_ResolveCrn_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GetRecordExpiryQueue_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_GetRecordExpiryQueue_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_GetRecordExpiryQueue_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GetAuthorityExpiryQueue_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_GetAuthorityExpiryQueue_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_GetAuthorityExpiryQueue_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{"vulcanize", "nameservice", "v1beta1", "params"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_ListRecords_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"vulcanize", "nameservice", "v1beta1", "records"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_GetRecord_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"vulcanize", "nameservice", "v1beta1", "records", "id"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_GetRecordByBondId_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"vulcanize", "nameservice", "v1beta1", "records-by-bond-id", "id"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_GetNameServiceModuleBalance_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"vulcanize", "nameservice", "v1beta1", "balance"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_ListNameRecords_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"vulcanize", "nameservice", "v1beta1", "names"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_Whois_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"vulcanize", "nameservice", "v1beta1", "whois", "name"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_LookupCrn_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"vulcanize", "nameservice", "v1beta1", "lookup"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_ResolveCrn_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"vulcanize", "nameservice", "v1beta1", "resolve"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_GetRecordExpiryQueue_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"vulcanize", "nameservice", "v1beta1", "record-expiry"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_GetAuthorityExpiryQueue_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"vulcanize", "nameservice", "v1beta1", "authority-expiry"}, "", runtime.AssumeColonVerbOpt(true))) +) + +var ( + forward_Query_Params_0 = runtime.ForwardResponseMessage + + forward_Query_ListRecords_0 = runtime.ForwardResponseMessage + + forward_Query_GetRecord_0 = runtime.ForwardResponseMessage + + forward_Query_GetRecordByBondId_0 = runtime.ForwardResponseMessage + + forward_Query_GetNameServiceModuleBalance_0 = runtime.ForwardResponseMessage + + forward_Query_ListNameRecords_0 = runtime.ForwardResponseMessage + + forward_Query_Whois_0 = runtime.ForwardResponseMessage + + forward_Query_LookupCrn_0 = runtime.ForwardResponseMessage + + forward_Query_ResolveCrn_0 = runtime.ForwardResponseMessage + + forward_Query_GetRecordExpiryQueue_0 = runtime.ForwardResponseMessage + + forward_Query_GetAuthorityExpiryQueue_0 = runtime.ForwardResponseMessage +) diff --git a/x/nameservice/types/record_msg.go b/x/nameservice/types/record_msg.go new file mode 100644 index 00000000..c0dd6963 --- /dev/null +++ b/x/nameservice/types/record_msg.go @@ -0,0 +1,257 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +var ( + _ sdk.Msg = &MsgSetRecord{} + _ sdk.Msg = &MsgRenewRecord{} + _ sdk.Msg = &MsgAssociateBond{} + _ sdk.Msg = &MsgDissociateBond{} + _ sdk.Msg = &MsgDissociateRecords{} + _ sdk.Msg = &MsgReAssociateRecords{} +) + +// NewMsgSetRecord is the constructor function for MsgSetRecord. +func NewMsgSetRecord(payload Payload, bondID string, signer sdk.AccAddress) MsgSetRecord { + return MsgSetRecord{ + Payload: payload, + BondId: bondID, + Signer: signer.String(), + } +} + +// Route Implements Msg. +func (msg MsgSetRecord) Route() string { return RouterKey } + +// Type Implements Msg. +func (msg MsgSetRecord) Type() string { return "set-record" } + +func (msg MsgSetRecord) ValidateBasic() error { + if len(msg.Signer) == 0 { + return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, msg.Signer) + } + owners := msg.Payload.Record.Owners + for _, owner := range owners { + if owner == "" { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Record owner not set.") + } + } + + if len(msg.BondId) == 0 { + return sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Bond ID is required.") + } + return nil +} + +func (msg MsgSetRecord) GetSigners() []sdk.AccAddress { + accAddr, _ := sdk.AccAddressFromBech32(msg.Signer) + return []sdk.AccAddress{accAddr} +} + +// GetSignBytes gets the sign bytes for the msg MsgCreateBond +func (msg MsgSetRecord) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +// NewMsgRenewRecord is the constructor function for MsgRenewRecord. +func NewMsgRenewRecord(recordId string, signer sdk.AccAddress) MsgRenewRecord { + return MsgRenewRecord{ + RecordId: recordId, + Signer: signer.String(), + } +} + +// Route Implements Msg. +func (msg MsgRenewRecord) Route() string { return RouterKey } + +// Type Implements Msg. +func (msg MsgRenewRecord) Type() string { return "renew-record" } + +// ValidateBasic Implements Msg. +func (msg MsgRenewRecord) ValidateBasic() error { + if len(msg.RecordId) == 0 { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "record id is required.") + } + + if len(msg.Signer) == 0 { + return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "invalid signer.") + } + + return nil +} + +// GetSignBytes gets the sign bytes for Msg +func (msg MsgRenewRecord) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +// GetSigners Implements Msg. +func (msg MsgRenewRecord) GetSigners() []sdk.AccAddress { + accAddr, _ := sdk.AccAddressFromBech32(msg.Signer) + return []sdk.AccAddress{accAddr} +} + +// NewMsgAssociateBond is the constructor function for MsgAssociateBond. +func NewMsgAssociateBond(recordId, bondId string, signer sdk.AccAddress) MsgAssociateBond { + return MsgAssociateBond{ + BondId: bondId, + RecordId: recordId, + Signer: signer.String(), + } +} + +// Route Implements Msg. +func (msg MsgAssociateBond) Route() string { return RouterKey } + +// Type Implements Msg. +func (msg MsgAssociateBond) Type() string { return "associate-bond" } + +// ValidateBasic Implements Msg. +func (msg MsgAssociateBond) ValidateBasic() error { + if len(msg.RecordId) == 0 { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "record id is required.") + } + if len(msg.BondId) == 0 { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "bond id is required.") + } + if len(msg.Signer) == 0 { + return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "invalid signer.") + } + + return nil +} + +// GetSignBytes gets the sign bytes for Msg +func (msg MsgAssociateBond) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +// GetSigners Implements Msg. +func (msg MsgAssociateBond) GetSigners() []sdk.AccAddress { + accAddr, _ := sdk.AccAddressFromBech32(msg.Signer) + return []sdk.AccAddress{accAddr} +} + +// NewMsgDissociateBond is the constructor function for MsgDissociateBond. +func NewMsgDissociateBond(recordId string, signer sdk.AccAddress) MsgDissociateBond { + return MsgDissociateBond{ + RecordId: recordId, + Signer: signer.String(), + } +} + +// Route Implements Msg. +func (msg MsgDissociateBond) Route() string { return RouterKey } + +// Type Implements Msg. +func (msg MsgDissociateBond) Type() string { return "dissociate-bond" } + +// ValidateBasic Implements Msg. +func (msg MsgDissociateBond) ValidateBasic() error { + if len(msg.RecordId) == 0 { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "record id is required.") + } + if len(msg.Signer) == 0 { + return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "invalid signer.") + } + + return nil +} + +// GetSignBytes gets the sign bytes for Msg +func (msg MsgDissociateBond) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +// GetSigners Implements Msg. +func (msg MsgDissociateBond) GetSigners() []sdk.AccAddress { + accAddr, _ := sdk.AccAddressFromBech32(msg.Signer) + return []sdk.AccAddress{accAddr} +} + +// NewMsgDissociateRecords is the constructor function for MsgDissociateRecords. +func NewMsgDissociateRecords(bondId string, signer sdk.AccAddress) MsgDissociateRecords { + return MsgDissociateRecords{ + BondId: bondId, + Signer: signer.String(), + } +} + +// Route Implements Msg. +func (msg MsgDissociateRecords) Route() string { return RouterKey } + +// Type Implements Msg. +func (msg MsgDissociateRecords) Type() string { return "dissociate-records" } + +// ValidateBasic Implements Msg. +func (msg MsgDissociateRecords) ValidateBasic() error { + if len(msg.BondId) == 0 { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "bond id is required.") + } + if len(msg.Signer) == 0 { + return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "invalid signer.") + } + + return nil +} + +// GetSignBytes gets the sign bytes for Msg +func (msg MsgDissociateRecords) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +// GetSigners Implements Msg. +func (msg MsgDissociateRecords) GetSigners() []sdk.AccAddress { + accAddr, _ := sdk.AccAddressFromBech32(msg.Signer) + return []sdk.AccAddress{accAddr} +} + +// NewMsgReAssociateRecords is the constructor function for MsgReAssociateRecords. +func NewMsgReAssociateRecords(oldBondId, newBondId string, signer sdk.AccAddress) MsgReAssociateRecords { + return MsgReAssociateRecords{ + OldBondId: oldBondId, + NewBondId: newBondId, + Signer: signer.String(), + } +} + +// Route Implements Msg. +func (msg MsgReAssociateRecords) Route() string { return RouterKey } + +// Type Implements Msg. +func (msg MsgReAssociateRecords) Type() string { return "reassociate-records" } + +// ValidateBasic Implements Msg. +func (msg MsgReAssociateRecords) ValidateBasic() error { + if len(msg.OldBondId) == 0 { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "old-bond-id is required.") + } + if len(msg.NewBondId) == 0 { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "new-bond-id is required.") + } + if len(msg.Signer) == 0 { + return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "invalid signer.") + } + + return nil +} + +// GetSignBytes gets the sign bytes for Msg +func (msg MsgReAssociateRecords) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +// GetSigners Implements Msg. +func (msg MsgReAssociateRecords) GetSigners() []sdk.AccAddress { + accAddr, _ := sdk.AccAddressFromBech32(msg.Signer) + return []sdk.AccAddress{accAddr} +} diff --git a/x/nameservice/types/tx.pb.go b/x/nameservice/types/tx.pb.go new file mode 100644 index 00000000..40138fb8 --- /dev/null +++ b/x/nameservice/types/tx.pb.go @@ -0,0 +1,4643 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: vulcanize/nameservice/v1beta1/tx.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/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 + +// MsgSetRecord +type MsgSetRecord struct { + BondId string `protobuf:"bytes,1,opt,name=bond_id,json=bondId,proto3" json:"bond_id,omitempty" json:"bondId" yaml:"bondId"` + Signer string `protobuf:"bytes,2,opt,name=signer,proto3" json:"signer,omitempty"` + Payload Payload `protobuf:"bytes,3,opt,name=payload,proto3" json:"payload"` +} + +func (m *MsgSetRecord) Reset() { *m = MsgSetRecord{} } +func (m *MsgSetRecord) String() string { return proto.CompactTextString(m) } +func (*MsgSetRecord) ProtoMessage() {} +func (*MsgSetRecord) Descriptor() ([]byte, []int) { + return fileDescriptor_b66a805dda801ce9, []int{0} +} +func (m *MsgSetRecord) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSetRecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSetRecord.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 *MsgSetRecord) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSetRecord.Merge(m, src) +} +func (m *MsgSetRecord) XXX_Size() int { + return m.Size() +} +func (m *MsgSetRecord) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSetRecord.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSetRecord proto.InternalMessageInfo + +func (m *MsgSetRecord) GetBondId() string { + if m != nil { + return m.BondId + } + return "" +} + +func (m *MsgSetRecord) GetSigner() string { + if m != nil { + return m.Signer + } + return "" +} + +func (m *MsgSetRecord) GetPayload() Payload { + if m != nil { + return m.Payload + } + return Payload{} +} + +// MsgSetRecordResponse +type MsgSetRecordResponse struct { + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (m *MsgSetRecordResponse) Reset() { *m = MsgSetRecordResponse{} } +func (m *MsgSetRecordResponse) String() string { return proto.CompactTextString(m) } +func (*MsgSetRecordResponse) ProtoMessage() {} +func (*MsgSetRecordResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b66a805dda801ce9, []int{1} +} +func (m *MsgSetRecordResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSetRecordResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSetRecordResponse.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 *MsgSetRecordResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSetRecordResponse.Merge(m, src) +} +func (m *MsgSetRecordResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgSetRecordResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSetRecordResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSetRecordResponse proto.InternalMessageInfo + +func (m *MsgSetRecordResponse) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +// Payload +type Payload struct { + Record *Record `protobuf:"bytes,1,opt,name=record,proto3" json:"record,omitempty"` + Signatures []Signature `protobuf:"bytes,2,rep,name=signatures,proto3" json:"signatures" json:"signatures" yaml:"signatures"` +} + +func (m *Payload) Reset() { *m = Payload{} } +func (m *Payload) String() string { return proto.CompactTextString(m) } +func (*Payload) ProtoMessage() {} +func (*Payload) Descriptor() ([]byte, []int) { + return fileDescriptor_b66a805dda801ce9, []int{2} +} +func (m *Payload) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Payload) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Payload.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 *Payload) XXX_Merge(src proto.Message) { + xxx_messageInfo_Payload.Merge(m, src) +} +func (m *Payload) XXX_Size() int { + return m.Size() +} +func (m *Payload) XXX_DiscardUnknown() { + xxx_messageInfo_Payload.DiscardUnknown(m) +} + +var xxx_messageInfo_Payload proto.InternalMessageInfo + +func (m *Payload) GetRecord() *Record { + if m != nil { + return m.Record + } + return nil +} + +func (m *Payload) GetSignatures() []Signature { + if m != nil { + return m.Signatures + } + return nil +} + +// MsgSetName +type MsgSetName struct { + Crn string `protobuf:"bytes,1,opt,name=crn,proto3" json:"crn,omitempty"` + Cid string `protobuf:"bytes,2,opt,name=cid,proto3" json:"cid,omitempty"` + Signer string `protobuf:"bytes,3,opt,name=signer,proto3" json:"signer,omitempty"` +} + +func (m *MsgSetName) Reset() { *m = MsgSetName{} } +func (m *MsgSetName) String() string { return proto.CompactTextString(m) } +func (*MsgSetName) ProtoMessage() {} +func (*MsgSetName) Descriptor() ([]byte, []int) { + return fileDescriptor_b66a805dda801ce9, []int{3} +} +func (m *MsgSetName) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSetName) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSetName.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 *MsgSetName) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSetName.Merge(m, src) +} +func (m *MsgSetName) XXX_Size() int { + return m.Size() +} +func (m *MsgSetName) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSetName.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSetName proto.InternalMessageInfo + +func (m *MsgSetName) GetCrn() string { + if m != nil { + return m.Crn + } + return "" +} + +func (m *MsgSetName) GetCid() string { + if m != nil { + return m.Cid + } + return "" +} + +func (m *MsgSetName) GetSigner() string { + if m != nil { + return m.Signer + } + return "" +} + +// MsgSetNameResponse +type MsgSetNameResponse struct { +} + +func (m *MsgSetNameResponse) Reset() { *m = MsgSetNameResponse{} } +func (m *MsgSetNameResponse) String() string { return proto.CompactTextString(m) } +func (*MsgSetNameResponse) ProtoMessage() {} +func (*MsgSetNameResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b66a805dda801ce9, []int{4} +} +func (m *MsgSetNameResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSetNameResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSetNameResponse.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 *MsgSetNameResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSetNameResponse.Merge(m, src) +} +func (m *MsgSetNameResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgSetNameResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSetNameResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSetNameResponse proto.InternalMessageInfo + +// MsgReserveName +type MsgReserveAuthority struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Signer string `protobuf:"bytes,2,opt,name=signer,proto3" json:"signer,omitempty"` + // if creating a sub-authority. + Owner string `protobuf:"bytes,3,opt,name=owner,proto3" json:"owner,omitempty"` +} + +func (m *MsgReserveAuthority) Reset() { *m = MsgReserveAuthority{} } +func (m *MsgReserveAuthority) String() string { return proto.CompactTextString(m) } +func (*MsgReserveAuthority) ProtoMessage() {} +func (*MsgReserveAuthority) Descriptor() ([]byte, []int) { + return fileDescriptor_b66a805dda801ce9, []int{5} +} +func (m *MsgReserveAuthority) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgReserveAuthority) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgReserveAuthority.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 *MsgReserveAuthority) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgReserveAuthority.Merge(m, src) +} +func (m *MsgReserveAuthority) XXX_Size() int { + return m.Size() +} +func (m *MsgReserveAuthority) XXX_DiscardUnknown() { + xxx_messageInfo_MsgReserveAuthority.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgReserveAuthority proto.InternalMessageInfo + +func (m *MsgReserveAuthority) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *MsgReserveAuthority) GetSigner() string { + if m != nil { + return m.Signer + } + return "" +} + +func (m *MsgReserveAuthority) GetOwner() string { + if m != nil { + return m.Owner + } + return "" +} + +// MsgReserveNameResponse +type MsgReserveAuthorityResponse struct { +} + +func (m *MsgReserveAuthorityResponse) Reset() { *m = MsgReserveAuthorityResponse{} } +func (m *MsgReserveAuthorityResponse) String() string { return proto.CompactTextString(m) } +func (*MsgReserveAuthorityResponse) ProtoMessage() {} +func (*MsgReserveAuthorityResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b66a805dda801ce9, []int{6} +} +func (m *MsgReserveAuthorityResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgReserveAuthorityResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgReserveAuthorityResponse.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 *MsgReserveAuthorityResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgReserveAuthorityResponse.Merge(m, src) +} +func (m *MsgReserveAuthorityResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgReserveAuthorityResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgReserveAuthorityResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgReserveAuthorityResponse proto.InternalMessageInfo + +// MsgSetAuthorityBond is SDK message for SetAuthorityBond +type MsgSetAuthorityBond struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + BondId string `protobuf:"bytes,2,opt,name=bond_id,json=bondId,proto3" json:"bond_id,omitempty" json:"bondId" yaml:"bondId"` + Signer string `protobuf:"bytes,3,opt,name=signer,proto3" json:"signer,omitempty"` +} + +func (m *MsgSetAuthorityBond) Reset() { *m = MsgSetAuthorityBond{} } +func (m *MsgSetAuthorityBond) String() string { return proto.CompactTextString(m) } +func (*MsgSetAuthorityBond) ProtoMessage() {} +func (*MsgSetAuthorityBond) Descriptor() ([]byte, []int) { + return fileDescriptor_b66a805dda801ce9, []int{7} +} +func (m *MsgSetAuthorityBond) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSetAuthorityBond) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSetAuthorityBond.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 *MsgSetAuthorityBond) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSetAuthorityBond.Merge(m, src) +} +func (m *MsgSetAuthorityBond) XXX_Size() int { + return m.Size() +} +func (m *MsgSetAuthorityBond) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSetAuthorityBond.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSetAuthorityBond proto.InternalMessageInfo + +func (m *MsgSetAuthorityBond) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *MsgSetAuthorityBond) GetBondId() string { + if m != nil { + return m.BondId + } + return "" +} + +func (m *MsgSetAuthorityBond) GetSigner() string { + if m != nil { + return m.Signer + } + return "" +} + +// MsgSetAuthorityBondResponse +type MsgSetAuthorityBondResponse struct { +} + +func (m *MsgSetAuthorityBondResponse) Reset() { *m = MsgSetAuthorityBondResponse{} } +func (m *MsgSetAuthorityBondResponse) String() string { return proto.CompactTextString(m) } +func (*MsgSetAuthorityBondResponse) ProtoMessage() {} +func (*MsgSetAuthorityBondResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b66a805dda801ce9, []int{8} +} +func (m *MsgSetAuthorityBondResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSetAuthorityBondResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSetAuthorityBondResponse.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 *MsgSetAuthorityBondResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSetAuthorityBondResponse.Merge(m, src) +} +func (m *MsgSetAuthorityBondResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgSetAuthorityBondResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSetAuthorityBondResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSetAuthorityBondResponse proto.InternalMessageInfo + +// MsgDeleteNameAuthority is SDK message for DeleteNameAuthority +type MsgDeleteNameAuthority struct { + Crn string `protobuf:"bytes,1,opt,name=crn,proto3" json:"crn,omitempty"` + Signer string `protobuf:"bytes,2,opt,name=signer,proto3" json:"signer,omitempty"` +} + +func (m *MsgDeleteNameAuthority) Reset() { *m = MsgDeleteNameAuthority{} } +func (m *MsgDeleteNameAuthority) String() string { return proto.CompactTextString(m) } +func (*MsgDeleteNameAuthority) ProtoMessage() {} +func (*MsgDeleteNameAuthority) Descriptor() ([]byte, []int) { + return fileDescriptor_b66a805dda801ce9, []int{9} +} +func (m *MsgDeleteNameAuthority) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDeleteNameAuthority) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDeleteNameAuthority.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 *MsgDeleteNameAuthority) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDeleteNameAuthority.Merge(m, src) +} +func (m *MsgDeleteNameAuthority) XXX_Size() int { + return m.Size() +} +func (m *MsgDeleteNameAuthority) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDeleteNameAuthority.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDeleteNameAuthority proto.InternalMessageInfo + +func (m *MsgDeleteNameAuthority) GetCrn() string { + if m != nil { + return m.Crn + } + return "" +} + +func (m *MsgDeleteNameAuthority) GetSigner() string { + if m != nil { + return m.Signer + } + return "" +} + +// MsgDeleteNameAuthorityResponse +type MsgDeleteNameAuthorityResponse struct { +} + +func (m *MsgDeleteNameAuthorityResponse) Reset() { *m = MsgDeleteNameAuthorityResponse{} } +func (m *MsgDeleteNameAuthorityResponse) String() string { return proto.CompactTextString(m) } +func (*MsgDeleteNameAuthorityResponse) ProtoMessage() {} +func (*MsgDeleteNameAuthorityResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b66a805dda801ce9, []int{10} +} +func (m *MsgDeleteNameAuthorityResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDeleteNameAuthorityResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDeleteNameAuthorityResponse.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 *MsgDeleteNameAuthorityResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDeleteNameAuthorityResponse.Merge(m, src) +} +func (m *MsgDeleteNameAuthorityResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgDeleteNameAuthorityResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDeleteNameAuthorityResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDeleteNameAuthorityResponse proto.InternalMessageInfo + +//MsgRenewRecord is SDK message for Renew a record +type MsgRenewRecord struct { + RecordId string `protobuf:"bytes,1,opt,name=record_id,json=recordId,proto3" json:"record_id,omitempty" json:"recordId" yaml:"recordId"` + Signer string `protobuf:"bytes,2,opt,name=signer,proto3" json:"signer,omitempty"` +} + +func (m *MsgRenewRecord) Reset() { *m = MsgRenewRecord{} } +func (m *MsgRenewRecord) String() string { return proto.CompactTextString(m) } +func (*MsgRenewRecord) ProtoMessage() {} +func (*MsgRenewRecord) Descriptor() ([]byte, []int) { + return fileDescriptor_b66a805dda801ce9, []int{11} +} +func (m *MsgRenewRecord) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRenewRecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRenewRecord.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 *MsgRenewRecord) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRenewRecord.Merge(m, src) +} +func (m *MsgRenewRecord) XXX_Size() int { + return m.Size() +} +func (m *MsgRenewRecord) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRenewRecord.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRenewRecord proto.InternalMessageInfo + +func (m *MsgRenewRecord) GetRecordId() string { + if m != nil { + return m.RecordId + } + return "" +} + +func (m *MsgRenewRecord) GetSigner() string { + if m != nil { + return m.Signer + } + return "" +} + +// MsgRenewRecordResponse +type MsgRenewRecordResponse struct { +} + +func (m *MsgRenewRecordResponse) Reset() { *m = MsgRenewRecordResponse{} } +func (m *MsgRenewRecordResponse) String() string { return proto.CompactTextString(m) } +func (*MsgRenewRecordResponse) ProtoMessage() {} +func (*MsgRenewRecordResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b66a805dda801ce9, []int{12} +} +func (m *MsgRenewRecordResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRenewRecordResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRenewRecordResponse.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 *MsgRenewRecordResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRenewRecordResponse.Merge(m, src) +} +func (m *MsgRenewRecordResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgRenewRecordResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRenewRecordResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRenewRecordResponse proto.InternalMessageInfo + +// MsgAssociateBond +type MsgAssociateBond struct { + RecordId string `protobuf:"bytes,1,opt,name=record_id,json=recordId,proto3" json:"record_id,omitempty" json:"recordId" yaml:"recordId"` + BondId string `protobuf:"bytes,2,opt,name=bond_id,json=bondId,proto3" json:"bond_id,omitempty" json:"bondId" yaml:"bondId"` + Signer string `protobuf:"bytes,3,opt,name=signer,proto3" json:"signer,omitempty"` +} + +func (m *MsgAssociateBond) Reset() { *m = MsgAssociateBond{} } +func (m *MsgAssociateBond) String() string { return proto.CompactTextString(m) } +func (*MsgAssociateBond) ProtoMessage() {} +func (*MsgAssociateBond) Descriptor() ([]byte, []int) { + return fileDescriptor_b66a805dda801ce9, []int{13} +} +func (m *MsgAssociateBond) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgAssociateBond) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgAssociateBond.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 *MsgAssociateBond) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgAssociateBond.Merge(m, src) +} +func (m *MsgAssociateBond) XXX_Size() int { + return m.Size() +} +func (m *MsgAssociateBond) XXX_DiscardUnknown() { + xxx_messageInfo_MsgAssociateBond.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgAssociateBond proto.InternalMessageInfo + +func (m *MsgAssociateBond) GetRecordId() string { + if m != nil { + return m.RecordId + } + return "" +} + +func (m *MsgAssociateBond) GetBondId() string { + if m != nil { + return m.BondId + } + return "" +} + +func (m *MsgAssociateBond) GetSigner() string { + if m != nil { + return m.Signer + } + return "" +} + +// MsgAssociateBondResponse +type MsgAssociateBondResponse struct { +} + +func (m *MsgAssociateBondResponse) Reset() { *m = MsgAssociateBondResponse{} } +func (m *MsgAssociateBondResponse) String() string { return proto.CompactTextString(m) } +func (*MsgAssociateBondResponse) ProtoMessage() {} +func (*MsgAssociateBondResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b66a805dda801ce9, []int{14} +} +func (m *MsgAssociateBondResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgAssociateBondResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgAssociateBondResponse.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 *MsgAssociateBondResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgAssociateBondResponse.Merge(m, src) +} +func (m *MsgAssociateBondResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgAssociateBondResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgAssociateBondResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgAssociateBondResponse proto.InternalMessageInfo + +// MsgDissociateBond is SDK message for Msg/DissociateBond +type MsgDissociateBond struct { + RecordId string `protobuf:"bytes,1,opt,name=record_id,json=recordId,proto3" json:"record_id,omitempty" json:"recordId" yaml:"recordId"` + Signer string `protobuf:"bytes,2,opt,name=signer,proto3" json:"signer,omitempty"` +} + +func (m *MsgDissociateBond) Reset() { *m = MsgDissociateBond{} } +func (m *MsgDissociateBond) String() string { return proto.CompactTextString(m) } +func (*MsgDissociateBond) ProtoMessage() {} +func (*MsgDissociateBond) Descriptor() ([]byte, []int) { + return fileDescriptor_b66a805dda801ce9, []int{15} +} +func (m *MsgDissociateBond) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDissociateBond) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDissociateBond.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 *MsgDissociateBond) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDissociateBond.Merge(m, src) +} +func (m *MsgDissociateBond) XXX_Size() int { + return m.Size() +} +func (m *MsgDissociateBond) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDissociateBond.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDissociateBond proto.InternalMessageInfo + +func (m *MsgDissociateBond) GetRecordId() string { + if m != nil { + return m.RecordId + } + return "" +} + +func (m *MsgDissociateBond) GetSigner() string { + if m != nil { + return m.Signer + } + return "" +} + +// MsgDissociateBondResponse is response type for MsgDissociateBond +type MsgDissociateBondResponse struct { +} + +func (m *MsgDissociateBondResponse) Reset() { *m = MsgDissociateBondResponse{} } +func (m *MsgDissociateBondResponse) String() string { return proto.CompactTextString(m) } +func (*MsgDissociateBondResponse) ProtoMessage() {} +func (*MsgDissociateBondResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b66a805dda801ce9, []int{16} +} +func (m *MsgDissociateBondResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDissociateBondResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDissociateBondResponse.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 *MsgDissociateBondResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDissociateBondResponse.Merge(m, src) +} +func (m *MsgDissociateBondResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgDissociateBondResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDissociateBondResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDissociateBondResponse proto.InternalMessageInfo + +// MsgDissociateRecords is SDK message for Msg/DissociateRecords +type MsgDissociateRecords struct { + BondId string `protobuf:"bytes,1,opt,name=bond_id,json=bondId,proto3" json:"bond_id,omitempty" json:"bondId" yaml:"bondId"` + Signer string `protobuf:"bytes,2,opt,name=signer,proto3" json:"signer,omitempty"` +} + +func (m *MsgDissociateRecords) Reset() { *m = MsgDissociateRecords{} } +func (m *MsgDissociateRecords) String() string { return proto.CompactTextString(m) } +func (*MsgDissociateRecords) ProtoMessage() {} +func (*MsgDissociateRecords) Descriptor() ([]byte, []int) { + return fileDescriptor_b66a805dda801ce9, []int{17} +} +func (m *MsgDissociateRecords) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDissociateRecords) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDissociateRecords.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 *MsgDissociateRecords) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDissociateRecords.Merge(m, src) +} +func (m *MsgDissociateRecords) XXX_Size() int { + return m.Size() +} +func (m *MsgDissociateRecords) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDissociateRecords.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDissociateRecords proto.InternalMessageInfo + +func (m *MsgDissociateRecords) GetBondId() string { + if m != nil { + return m.BondId + } + return "" +} + +func (m *MsgDissociateRecords) GetSigner() string { + if m != nil { + return m.Signer + } + return "" +} + +// MsgDissociateRecordsResponse is response type for MsgDissociateRecords +type MsgDissociateRecordsResponse struct { +} + +func (m *MsgDissociateRecordsResponse) Reset() { *m = MsgDissociateRecordsResponse{} } +func (m *MsgDissociateRecordsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgDissociateRecordsResponse) ProtoMessage() {} +func (*MsgDissociateRecordsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b66a805dda801ce9, []int{18} +} +func (m *MsgDissociateRecordsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDissociateRecordsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDissociateRecordsResponse.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 *MsgDissociateRecordsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDissociateRecordsResponse.Merge(m, src) +} +func (m *MsgDissociateRecordsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgDissociateRecordsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDissociateRecordsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDissociateRecordsResponse proto.InternalMessageInfo + +// MsgReAssociateRecords is SDK message for Msg/ReAssociateRecords +type MsgReAssociateRecords struct { + NewBondId string `protobuf:"bytes,1,opt,name=new_bond_id,json=newBondId,proto3" json:"new_bond_id,omitempty" json:"newBondId" yaml:"newBondId"` + OldBondId string `protobuf:"bytes,2,opt,name=old_bond_id,json=oldBondId,proto3" json:"old_bond_id,omitempty" json:"oldBondId" yaml:"oldBondId"` + Signer string `protobuf:"bytes,3,opt,name=signer,proto3" json:"signer,omitempty"` +} + +func (m *MsgReAssociateRecords) Reset() { *m = MsgReAssociateRecords{} } +func (m *MsgReAssociateRecords) String() string { return proto.CompactTextString(m) } +func (*MsgReAssociateRecords) ProtoMessage() {} +func (*MsgReAssociateRecords) Descriptor() ([]byte, []int) { + return fileDescriptor_b66a805dda801ce9, []int{19} +} +func (m *MsgReAssociateRecords) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgReAssociateRecords) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgReAssociateRecords.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 *MsgReAssociateRecords) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgReAssociateRecords.Merge(m, src) +} +func (m *MsgReAssociateRecords) XXX_Size() int { + return m.Size() +} +func (m *MsgReAssociateRecords) XXX_DiscardUnknown() { + xxx_messageInfo_MsgReAssociateRecords.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgReAssociateRecords proto.InternalMessageInfo + +func (m *MsgReAssociateRecords) GetNewBondId() string { + if m != nil { + return m.NewBondId + } + return "" +} + +func (m *MsgReAssociateRecords) GetOldBondId() string { + if m != nil { + return m.OldBondId + } + return "" +} + +func (m *MsgReAssociateRecords) GetSigner() string { + if m != nil { + return m.Signer + } + return "" +} + +// MsgReAssociateRecordsResponse is response type for MsgReAssociateRecords +type MsgReAssociateRecordsResponse struct { +} + +func (m *MsgReAssociateRecordsResponse) Reset() { *m = MsgReAssociateRecordsResponse{} } +func (m *MsgReAssociateRecordsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgReAssociateRecordsResponse) ProtoMessage() {} +func (*MsgReAssociateRecordsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b66a805dda801ce9, []int{20} +} +func (m *MsgReAssociateRecordsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgReAssociateRecordsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgReAssociateRecordsResponse.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 *MsgReAssociateRecordsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgReAssociateRecordsResponse.Merge(m, src) +} +func (m *MsgReAssociateRecordsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgReAssociateRecordsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgReAssociateRecordsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgReAssociateRecordsResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgSetRecord)(nil), "vulcanize.nameservice.v1beta1.MsgSetRecord") + proto.RegisterType((*MsgSetRecordResponse)(nil), "vulcanize.nameservice.v1beta1.MsgSetRecordResponse") + proto.RegisterType((*Payload)(nil), "vulcanize.nameservice.v1beta1.Payload") + proto.RegisterType((*MsgSetName)(nil), "vulcanize.nameservice.v1beta1.MsgSetName") + proto.RegisterType((*MsgSetNameResponse)(nil), "vulcanize.nameservice.v1beta1.MsgSetNameResponse") + proto.RegisterType((*MsgReserveAuthority)(nil), "vulcanize.nameservice.v1beta1.MsgReserveAuthority") + proto.RegisterType((*MsgReserveAuthorityResponse)(nil), "vulcanize.nameservice.v1beta1.MsgReserveAuthorityResponse") + proto.RegisterType((*MsgSetAuthorityBond)(nil), "vulcanize.nameservice.v1beta1.MsgSetAuthorityBond") + proto.RegisterType((*MsgSetAuthorityBondResponse)(nil), "vulcanize.nameservice.v1beta1.MsgSetAuthorityBondResponse") + proto.RegisterType((*MsgDeleteNameAuthority)(nil), "vulcanize.nameservice.v1beta1.MsgDeleteNameAuthority") + proto.RegisterType((*MsgDeleteNameAuthorityResponse)(nil), "vulcanize.nameservice.v1beta1.MsgDeleteNameAuthorityResponse") + proto.RegisterType((*MsgRenewRecord)(nil), "vulcanize.nameservice.v1beta1.MsgRenewRecord") + proto.RegisterType((*MsgRenewRecordResponse)(nil), "vulcanize.nameservice.v1beta1.MsgRenewRecordResponse") + proto.RegisterType((*MsgAssociateBond)(nil), "vulcanize.nameservice.v1beta1.MsgAssociateBond") + proto.RegisterType((*MsgAssociateBondResponse)(nil), "vulcanize.nameservice.v1beta1.MsgAssociateBondResponse") + proto.RegisterType((*MsgDissociateBond)(nil), "vulcanize.nameservice.v1beta1.MsgDissociateBond") + proto.RegisterType((*MsgDissociateBondResponse)(nil), "vulcanize.nameservice.v1beta1.MsgDissociateBondResponse") + proto.RegisterType((*MsgDissociateRecords)(nil), "vulcanize.nameservice.v1beta1.MsgDissociateRecords") + proto.RegisterType((*MsgDissociateRecordsResponse)(nil), "vulcanize.nameservice.v1beta1.MsgDissociateRecordsResponse") + proto.RegisterType((*MsgReAssociateRecords)(nil), "vulcanize.nameservice.v1beta1.MsgReAssociateRecords") + proto.RegisterType((*MsgReAssociateRecordsResponse)(nil), "vulcanize.nameservice.v1beta1.MsgReAssociateRecordsResponse") +} + +func init() { + proto.RegisterFile("vulcanize/nameservice/v1beta1/tx.proto", fileDescriptor_b66a805dda801ce9) +} + +var fileDescriptor_b66a805dda801ce9 = []byte{ + // 878 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0x4d, 0x6b, 0xe3, 0x46, + 0x18, 0xb6, 0xec, 0xd4, 0xae, 0x5f, 0xb7, 0x21, 0x51, 0xdd, 0xe0, 0x2a, 0x8d, 0xe4, 0x2a, 0x24, + 0xb8, 0x84, 0x5a, 0x89, 0xd3, 0xd2, 0x90, 0x36, 0xd0, 0x98, 0xb6, 0xb4, 0x05, 0x97, 0xa2, 0x1c, + 0x0a, 0xbd, 0x04, 0xd9, 0x1a, 0x64, 0x05, 0x5b, 0x63, 0x34, 0x72, 0x1c, 0x37, 0xd0, 0x5e, 0x16, + 0x16, 0xf6, 0xb4, 0xbf, 0x62, 0xd9, 0x3f, 0xb1, 0xec, 0x35, 0xc7, 0x1c, 0xf7, 0x64, 0x96, 0xe4, + 0x1f, 0xf8, 0xba, 0x97, 0x45, 0xa3, 0xaf, 0x91, 0x3f, 0xe2, 0x8f, 0xcd, 0x6d, 0x34, 0xf3, 0x3e, + 0xef, 0xf3, 0xbc, 0xcf, 0xcc, 0xab, 0x91, 0x60, 0xf7, 0xb2, 0xdb, 0x6a, 0x68, 0x96, 0xf9, 0x2f, + 0x52, 0x2c, 0xad, 0x8d, 0x08, 0xb2, 0x2f, 0xcd, 0x06, 0x52, 0x2e, 0x0f, 0xea, 0xc8, 0xd1, 0x0e, + 0x14, 0xe7, 0xaa, 0xdc, 0xb1, 0xb1, 0x83, 0xf9, 0xad, 0x30, 0xae, 0xcc, 0xc4, 0x95, 0xfd, 0x38, + 0x21, 0x6f, 0x60, 0x03, 0xd3, 0x48, 0xc5, 0x1d, 0x79, 0x20, 0x41, 0x79, 0x38, 0x39, 0x9b, 0x88, + 0x02, 0xe4, 0x97, 0x1c, 0x7c, 0x52, 0x23, 0xc6, 0x19, 0x72, 0x54, 0xd4, 0xc0, 0xb6, 0xce, 0x1f, + 0x41, 0xa6, 0x8e, 0x2d, 0xfd, 0xdc, 0xd4, 0x0b, 0x5c, 0x91, 0x2b, 0x65, 0xab, 0xd2, 0x70, 0x20, + 0x6d, 0x5e, 0x10, 0x6c, 0x1d, 0xcb, 0xee, 0xc2, 0xef, 0xba, 0x5c, 0xec, 0x6b, 0xed, 0x56, 0xf8, + 0xa4, 0xa6, 0xbd, 0x01, 0xbf, 0x01, 0x69, 0x62, 0x1a, 0x16, 0xb2, 0x0b, 0x49, 0x17, 0xa8, 0xfa, + 0x4f, 0xfc, 0xaf, 0x90, 0xe9, 0x68, 0xfd, 0x16, 0xd6, 0xf4, 0x42, 0xaa, 0xc8, 0x95, 0x72, 0x95, + 0xdd, 0xf2, 0x83, 0xa5, 0x95, 0xff, 0xf2, 0xa2, 0xab, 0x2b, 0x37, 0x03, 0x29, 0xa1, 0x06, 0x60, + 0x79, 0x17, 0xf2, 0xac, 0x52, 0x15, 0x91, 0x0e, 0xb6, 0x08, 0xe2, 0x57, 0x21, 0x19, 0x88, 0x55, + 0x93, 0xa6, 0x2e, 0xbf, 0xe6, 0x20, 0xe3, 0xa7, 0xe0, 0x4f, 0x20, 0x6d, 0xd3, 0x68, 0xba, 0x9e, + 0xab, 0xec, 0xcc, 0xa0, 0xf6, 0x53, 0xfb, 0x20, 0xbe, 0x0b, 0xe0, 0x16, 0xa1, 0x39, 0x5d, 0x1b, + 0x91, 0x42, 0xb2, 0x98, 0x2a, 0xe5, 0x2a, 0xa5, 0x19, 0x29, 0xce, 0x02, 0x40, 0x75, 0xcf, 0xd5, + 0x3f, 0x1c, 0x48, 0xdb, 0x9e, 0x7b, 0x51, 0xa6, 0xc0, 0x41, 0x66, 0x46, 0x65, 0x88, 0xe4, 0xdf, + 0x00, 0xbc, 0x4a, 0xff, 0xd4, 0xda, 0x88, 0x5f, 0x83, 0x54, 0xc3, 0xb6, 0xfc, 0x02, 0xdd, 0x21, + 0x9d, 0x31, 0x75, 0xdf, 0x66, 0x77, 0xc8, 0x78, 0x9f, 0x62, 0xbd, 0x97, 0xf3, 0xc0, 0x47, 0x99, + 0x02, 0xc7, 0xe4, 0xbf, 0xe1, 0xb3, 0x1a, 0x31, 0x54, 0x2a, 0x1d, 0x9d, 0x76, 0x9d, 0x26, 0xb6, + 0x4d, 0xa7, 0xcf, 0xf3, 0xb0, 0xe2, 0x16, 0xe4, 0x33, 0xd1, 0xf1, 0xd4, 0x4d, 0xcd, 0xc3, 0x47, + 0xb8, 0x17, 0xf1, 0x79, 0x0f, 0xf2, 0x16, 0x6c, 0x4e, 0x48, 0x1c, 0xf2, 0x5e, 0x53, 0xde, 0x33, + 0xe4, 0x84, 0x4b, 0x55, 0x6c, 0xe9, 0x13, 0x79, 0x99, 0x63, 0x98, 0x5c, 0xf6, 0x18, 0xc6, 0xad, + 0xf0, 0xb4, 0x8d, 0x92, 0x87, 0xda, 0xaa, 0xb0, 0x51, 0x23, 0xc6, 0xcf, 0xa8, 0x85, 0x1c, 0xe4, + 0x9a, 0x15, 0xd9, 0x32, 0xee, 0xff, 0x14, 0x53, 0xe4, 0x22, 0x88, 0x93, 0x73, 0x84, 0x2c, 0x17, + 0xb0, 0x4a, 0x0d, 0xb2, 0x50, 0xcf, 0xef, 0xb7, 0x9f, 0x20, 0xeb, 0x1d, 0xb6, 0xa8, 0xe3, 0xb6, + 0x87, 0x03, 0x49, 0xf2, 0x4a, 0xf5, 0x96, 0xa2, 0x62, 0xc3, 0x67, 0xf5, 0xe3, 0x60, 0x38, 0x55, + 0x4d, 0x81, 0x56, 0xc4, 0x70, 0x85, 0x2a, 0x5e, 0x70, 0xb0, 0x56, 0x23, 0xc6, 0x29, 0x21, 0xb8, + 0x61, 0x6a, 0x0e, 0xa2, 0xbb, 0xf0, 0xe1, 0x42, 0x1e, 0x7f, 0xcf, 0x04, 0x28, 0x8c, 0xea, 0x0c, + 0x8b, 0x68, 0xc3, 0xba, 0x6b, 0xb6, 0xf9, 0xc8, 0x45, 0x4c, 0x73, 0x73, 0x13, 0xbe, 0x18, 0xa3, + 0x0b, 0xb5, 0x34, 0xe9, 0xab, 0x29, 0x5a, 0xf4, 0xfc, 0x26, 0x8f, 0xff, 0x32, 0x95, 0x45, 0xf8, + 0x72, 0x12, 0x53, 0xa8, 0xe4, 0x15, 0x07, 0x9f, 0xd3, 0x5d, 0x3f, 0x1d, 0xd5, 0xf2, 0x0b, 0xe4, + 0x2c, 0xd4, 0x3b, 0x8f, 0xeb, 0xd9, 0x19, 0x0e, 0xa4, 0xaf, 0x3c, 0x3d, 0x16, 0xea, 0x55, 0x63, + 0x92, 0xa2, 0x09, 0x35, 0x1b, 0x8e, 0xdd, 0x34, 0xb8, 0xa5, 0x9f, 0xc7, 0x37, 0x9a, 0x49, 0x83, + 0x5b, 0x7a, 0x3c, 0x4d, 0x34, 0xa1, 0x66, 0xc3, 0xf1, 0xd4, 0x1d, 0x97, 0x60, 0x6b, 0xa2, 0xfc, + 0xa0, 0xc0, 0xca, 0xbb, 0x2c, 0xa4, 0x6a, 0xc4, 0xe0, 0x31, 0x64, 0xa3, 0x4b, 0x6b, 0x6f, 0xc6, + 0x3b, 0x99, 0xbd, 0x37, 0x84, 0xc3, 0x05, 0x82, 0x43, 0x5f, 0x13, 0x7c, 0x17, 0x72, 0x6c, 0xdf, + 0x7e, 0x33, 0x3b, 0x0b, 0x13, 0x2e, 0x7c, 0xb7, 0x50, 0x38, 0x43, 0x7b, 0x0d, 0x9f, 0xc6, 0xfb, + 0x54, 0x99, 0x9d, 0x29, 0x06, 0x10, 0xbe, 0x5f, 0x10, 0xc0, 0x90, 0xff, 0x07, 0xab, 0x23, 0x0d, + 0xb6, 0x3f, 0x3b, 0x59, 0x1c, 0x21, 0x1c, 0x2d, 0x8a, 0x60, 0xf8, 0x9f, 0x72, 0xb0, 0x3e, 0xde, + 0x55, 0x87, 0x8b, 0x64, 0xf4, 0x41, 0xc2, 0x0f, 0x4b, 0x80, 0x18, 0x25, 0xcf, 0x38, 0xe0, 0x27, + 0x34, 0xd5, 0xb7, 0xf3, 0x6c, 0xeb, 0x28, 0x4a, 0xf8, 0x71, 0x19, 0x14, 0x23, 0xc6, 0x84, 0x4c, + 0xf0, 0x71, 0xf0, 0xf5, 0x5c, 0x87, 0xd9, 0x0d, 0x15, 0x0e, 0xe6, 0x0e, 0x65, 0xa8, 0xfe, 0x77, + 0x4f, 0x3d, 0xbd, 0xce, 0x29, 0x5d, 0x65, 0x1e, 0xe5, 0xf1, 0xdb, 0x5f, 0x38, 0x5e, 0x1c, 0xc3, + 0x08, 0x78, 0xc2, 0x01, 0x44, 0x37, 0x2a, 0x3f, 0x47, 0x1f, 0x4d, 0xb8, 0x7f, 0x85, 0x93, 0xa5, + 0x60, 0x71, 0x19, 0x6b, 0x63, 0x1f, 0x2e, 0x95, 0xb9, 0x1c, 0x8d, 0x61, 0xe6, 0x71, 0x63, 0xea, + 0x37, 0x4a, 0xa2, 0xfa, 0xc7, 0xcd, 0x9d, 0xc8, 0xdd, 0xde, 0x89, 0xdc, 0xdb, 0x3b, 0x91, 0x7b, + 0x7e, 0x2f, 0x26, 0x6e, 0xef, 0xc5, 0xc4, 0x9b, 0x7b, 0x31, 0xf1, 0xcf, 0xbe, 0x61, 0x3a, 0xcd, + 0x6e, 0xbd, 0xdc, 0xc0, 0x6d, 0xc5, 0x69, 0x6a, 0x36, 0x31, 0x89, 0x82, 0x9c, 0x26, 0xb2, 0xdb, + 0xa6, 0xe5, 0x28, 0x57, 0xb1, 0xdf, 0x01, 0xa7, 0xdf, 0x41, 0xa4, 0x9e, 0xa6, 0x7f, 0x00, 0x87, + 0xef, 0x03, 0x00, 0x00, 0xff, 0xff, 0x08, 0x20, 0xb1, 0x62, 0x91, 0x0c, 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 { + // SetRecord will records a new record with given payload and bond id + SetRecord(ctx context.Context, in *MsgSetRecord, opts ...grpc.CallOption) (*MsgSetRecordResponse, error) + // Renew Record will renew the expire record + RenewRecord(ctx context.Context, in *MsgRenewRecord, opts ...grpc.CallOption) (*MsgRenewRecordResponse, error) + // AssociateBond + AssociateBond(ctx context.Context, in *MsgAssociateBond, opts ...grpc.CallOption) (*MsgAssociateBondResponse, error) + // DissociateBond + DissociateBond(ctx context.Context, in *MsgDissociateBond, opts ...grpc.CallOption) (*MsgDissociateBondResponse, error) + // DissociateRecords + DissociateRecords(ctx context.Context, in *MsgDissociateRecords, opts ...grpc.CallOption) (*MsgDissociateRecordsResponse, error) + // ReAssociateRecords + ReAssociateRecords(ctx context.Context, in *MsgReAssociateRecords, opts ...grpc.CallOption) (*MsgReAssociateRecordsResponse, error) + // SetName will store the name with given crn and name + SetName(ctx context.Context, in *MsgSetName, opts ...grpc.CallOption) (*MsgSetNameResponse, error) + // Reserve name + ReserveName(ctx context.Context, in *MsgReserveAuthority, opts ...grpc.CallOption) (*MsgReserveAuthorityResponse, error) + // Delete Name method will remove authority name + DeleteName(ctx context.Context, in *MsgDeleteNameAuthority, opts ...grpc.CallOption) (*MsgDeleteNameAuthorityResponse, error) + // SetAuthorityBond + SetAuthorityBond(ctx context.Context, in *MsgSetAuthorityBond, opts ...grpc.CallOption) (*MsgSetAuthorityBondResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) SetRecord(ctx context.Context, in *MsgSetRecord, opts ...grpc.CallOption) (*MsgSetRecordResponse, error) { + out := new(MsgSetRecordResponse) + err := c.cc.Invoke(ctx, "/vulcanize.nameservice.v1beta1.Msg/SetRecord", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) RenewRecord(ctx context.Context, in *MsgRenewRecord, opts ...grpc.CallOption) (*MsgRenewRecordResponse, error) { + out := new(MsgRenewRecordResponse) + err := c.cc.Invoke(ctx, "/vulcanize.nameservice.v1beta1.Msg/RenewRecord", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) AssociateBond(ctx context.Context, in *MsgAssociateBond, opts ...grpc.CallOption) (*MsgAssociateBondResponse, error) { + out := new(MsgAssociateBondResponse) + err := c.cc.Invoke(ctx, "/vulcanize.nameservice.v1beta1.Msg/AssociateBond", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) DissociateBond(ctx context.Context, in *MsgDissociateBond, opts ...grpc.CallOption) (*MsgDissociateBondResponse, error) { + out := new(MsgDissociateBondResponse) + err := c.cc.Invoke(ctx, "/vulcanize.nameservice.v1beta1.Msg/DissociateBond", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) DissociateRecords(ctx context.Context, in *MsgDissociateRecords, opts ...grpc.CallOption) (*MsgDissociateRecordsResponse, error) { + out := new(MsgDissociateRecordsResponse) + err := c.cc.Invoke(ctx, "/vulcanize.nameservice.v1beta1.Msg/DissociateRecords", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) ReAssociateRecords(ctx context.Context, in *MsgReAssociateRecords, opts ...grpc.CallOption) (*MsgReAssociateRecordsResponse, error) { + out := new(MsgReAssociateRecordsResponse) + err := c.cc.Invoke(ctx, "/vulcanize.nameservice.v1beta1.Msg/ReAssociateRecords", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) SetName(ctx context.Context, in *MsgSetName, opts ...grpc.CallOption) (*MsgSetNameResponse, error) { + out := new(MsgSetNameResponse) + err := c.cc.Invoke(ctx, "/vulcanize.nameservice.v1beta1.Msg/SetName", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) ReserveName(ctx context.Context, in *MsgReserveAuthority, opts ...grpc.CallOption) (*MsgReserveAuthorityResponse, error) { + out := new(MsgReserveAuthorityResponse) + err := c.cc.Invoke(ctx, "/vulcanize.nameservice.v1beta1.Msg/ReserveName", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) DeleteName(ctx context.Context, in *MsgDeleteNameAuthority, opts ...grpc.CallOption) (*MsgDeleteNameAuthorityResponse, error) { + out := new(MsgDeleteNameAuthorityResponse) + err := c.cc.Invoke(ctx, "/vulcanize.nameservice.v1beta1.Msg/DeleteName", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) SetAuthorityBond(ctx context.Context, in *MsgSetAuthorityBond, opts ...grpc.CallOption) (*MsgSetAuthorityBondResponse, error) { + out := new(MsgSetAuthorityBondResponse) + err := c.cc.Invoke(ctx, "/vulcanize.nameservice.v1beta1.Msg/SetAuthorityBond", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + // SetRecord will records a new record with given payload and bond id + SetRecord(context.Context, *MsgSetRecord) (*MsgSetRecordResponse, error) + // Renew Record will renew the expire record + RenewRecord(context.Context, *MsgRenewRecord) (*MsgRenewRecordResponse, error) + // AssociateBond + AssociateBond(context.Context, *MsgAssociateBond) (*MsgAssociateBondResponse, error) + // DissociateBond + DissociateBond(context.Context, *MsgDissociateBond) (*MsgDissociateBondResponse, error) + // DissociateRecords + DissociateRecords(context.Context, *MsgDissociateRecords) (*MsgDissociateRecordsResponse, error) + // ReAssociateRecords + ReAssociateRecords(context.Context, *MsgReAssociateRecords) (*MsgReAssociateRecordsResponse, error) + // SetName will store the name with given crn and name + SetName(context.Context, *MsgSetName) (*MsgSetNameResponse, error) + // Reserve name + ReserveName(context.Context, *MsgReserveAuthority) (*MsgReserveAuthorityResponse, error) + // Delete Name method will remove authority name + DeleteName(context.Context, *MsgDeleteNameAuthority) (*MsgDeleteNameAuthorityResponse, error) + // SetAuthorityBond + SetAuthorityBond(context.Context, *MsgSetAuthorityBond) (*MsgSetAuthorityBondResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) SetRecord(ctx context.Context, req *MsgSetRecord) (*MsgSetRecordResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SetRecord not implemented") +} +func (*UnimplementedMsgServer) RenewRecord(ctx context.Context, req *MsgRenewRecord) (*MsgRenewRecordResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RenewRecord not implemented") +} +func (*UnimplementedMsgServer) AssociateBond(ctx context.Context, req *MsgAssociateBond) (*MsgAssociateBondResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AssociateBond not implemented") +} +func (*UnimplementedMsgServer) DissociateBond(ctx context.Context, req *MsgDissociateBond) (*MsgDissociateBondResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DissociateBond not implemented") +} +func (*UnimplementedMsgServer) DissociateRecords(ctx context.Context, req *MsgDissociateRecords) (*MsgDissociateRecordsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DissociateRecords not implemented") +} +func (*UnimplementedMsgServer) ReAssociateRecords(ctx context.Context, req *MsgReAssociateRecords) (*MsgReAssociateRecordsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ReAssociateRecords not implemented") +} +func (*UnimplementedMsgServer) SetName(ctx context.Context, req *MsgSetName) (*MsgSetNameResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SetName not implemented") +} +func (*UnimplementedMsgServer) ReserveName(ctx context.Context, req *MsgReserveAuthority) (*MsgReserveAuthorityResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ReserveName not implemented") +} +func (*UnimplementedMsgServer) DeleteName(ctx context.Context, req *MsgDeleteNameAuthority) (*MsgDeleteNameAuthorityResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteName not implemented") +} +func (*UnimplementedMsgServer) SetAuthorityBond(ctx context.Context, req *MsgSetAuthorityBond) (*MsgSetAuthorityBondResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SetAuthorityBond not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_SetRecord_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSetRecord) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).SetRecord(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vulcanize.nameservice.v1beta1.Msg/SetRecord", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).SetRecord(ctx, req.(*MsgSetRecord)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_RenewRecord_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgRenewRecord) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).RenewRecord(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vulcanize.nameservice.v1beta1.Msg/RenewRecord", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).RenewRecord(ctx, req.(*MsgRenewRecord)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_AssociateBond_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgAssociateBond) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).AssociateBond(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vulcanize.nameservice.v1beta1.Msg/AssociateBond", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).AssociateBond(ctx, req.(*MsgAssociateBond)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_DissociateBond_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgDissociateBond) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).DissociateBond(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vulcanize.nameservice.v1beta1.Msg/DissociateBond", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).DissociateBond(ctx, req.(*MsgDissociateBond)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_DissociateRecords_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgDissociateRecords) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).DissociateRecords(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vulcanize.nameservice.v1beta1.Msg/DissociateRecords", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).DissociateRecords(ctx, req.(*MsgDissociateRecords)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_ReAssociateRecords_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgReAssociateRecords) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).ReAssociateRecords(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vulcanize.nameservice.v1beta1.Msg/ReAssociateRecords", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).ReAssociateRecords(ctx, req.(*MsgReAssociateRecords)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_SetName_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSetName) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).SetName(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vulcanize.nameservice.v1beta1.Msg/SetName", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).SetName(ctx, req.(*MsgSetName)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_ReserveName_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgReserveAuthority) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).ReserveName(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vulcanize.nameservice.v1beta1.Msg/ReserveName", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).ReserveName(ctx, req.(*MsgReserveAuthority)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_DeleteName_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgDeleteNameAuthority) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).DeleteName(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vulcanize.nameservice.v1beta1.Msg/DeleteName", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).DeleteName(ctx, req.(*MsgDeleteNameAuthority)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_SetAuthorityBond_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSetAuthorityBond) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).SetAuthorityBond(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vulcanize.nameservice.v1beta1.Msg/SetAuthorityBond", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).SetAuthorityBond(ctx, req.(*MsgSetAuthorityBond)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "vulcanize.nameservice.v1beta1.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "SetRecord", + Handler: _Msg_SetRecord_Handler, + }, + { + MethodName: "RenewRecord", + Handler: _Msg_RenewRecord_Handler, + }, + { + MethodName: "AssociateBond", + Handler: _Msg_AssociateBond_Handler, + }, + { + MethodName: "DissociateBond", + Handler: _Msg_DissociateBond_Handler, + }, + { + MethodName: "DissociateRecords", + Handler: _Msg_DissociateRecords_Handler, + }, + { + MethodName: "ReAssociateRecords", + Handler: _Msg_ReAssociateRecords_Handler, + }, + { + MethodName: "SetName", + Handler: _Msg_SetName_Handler, + }, + { + MethodName: "ReserveName", + Handler: _Msg_ReserveName_Handler, + }, + { + MethodName: "DeleteName", + Handler: _Msg_DeleteName_Handler, + }, + { + MethodName: "SetAuthorityBond", + Handler: _Msg_SetAuthorityBond_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "vulcanize/nameservice/v1beta1/tx.proto", +} + +func (m *MsgSetRecord) 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 *MsgSetRecord) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSetRecord) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Payload.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.Signer) > 0 { + i -= len(m.Signer) + copy(dAtA[i:], m.Signer) + i = encodeVarintTx(dAtA, i, uint64(len(m.Signer))) + i-- + dAtA[i] = 0x12 + } + if len(m.BondId) > 0 { + i -= len(m.BondId) + copy(dAtA[i:], m.BondId) + i = encodeVarintTx(dAtA, i, uint64(len(m.BondId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgSetRecordResponse) 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 *MsgSetRecordResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSetRecordResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Id) > 0 { + i -= len(m.Id) + copy(dAtA[i:], m.Id) + i = encodeVarintTx(dAtA, i, uint64(len(m.Id))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Payload) 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 *Payload) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Payload) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Signatures) > 0 { + for iNdEx := len(m.Signatures) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Signatures[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if m.Record != nil { + { + size, err := m.Record.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgSetName) 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 *MsgSetName) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSetName) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Signer) > 0 { + i -= len(m.Signer) + copy(dAtA[i:], m.Signer) + i = encodeVarintTx(dAtA, i, uint64(len(m.Signer))) + i-- + dAtA[i] = 0x1a + } + if len(m.Cid) > 0 { + i -= len(m.Cid) + copy(dAtA[i:], m.Cid) + i = encodeVarintTx(dAtA, i, uint64(len(m.Cid))) + i-- + dAtA[i] = 0x12 + } + if len(m.Crn) > 0 { + i -= len(m.Crn) + copy(dAtA[i:], m.Crn) + i = encodeVarintTx(dAtA, i, uint64(len(m.Crn))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgSetNameResponse) 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 *MsgSetNameResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSetNameResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgReserveAuthority) 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 *MsgReserveAuthority) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgReserveAuthority) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintTx(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0x1a + } + if len(m.Signer) > 0 { + i -= len(m.Signer) + copy(dAtA[i:], m.Signer) + i = encodeVarintTx(dAtA, i, uint64(len(m.Signer))) + i-- + dAtA[i] = 0x12 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintTx(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgReserveAuthorityResponse) 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 *MsgReserveAuthorityResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgReserveAuthorityResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgSetAuthorityBond) 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 *MsgSetAuthorityBond) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSetAuthorityBond) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Signer) > 0 { + i -= len(m.Signer) + copy(dAtA[i:], m.Signer) + i = encodeVarintTx(dAtA, i, uint64(len(m.Signer))) + i-- + dAtA[i] = 0x1a + } + if len(m.BondId) > 0 { + i -= len(m.BondId) + copy(dAtA[i:], m.BondId) + i = encodeVarintTx(dAtA, i, uint64(len(m.BondId))) + i-- + dAtA[i] = 0x12 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintTx(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgSetAuthorityBondResponse) 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 *MsgSetAuthorityBondResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSetAuthorityBondResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgDeleteNameAuthority) 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 *MsgDeleteNameAuthority) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDeleteNameAuthority) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Signer) > 0 { + i -= len(m.Signer) + copy(dAtA[i:], m.Signer) + i = encodeVarintTx(dAtA, i, uint64(len(m.Signer))) + i-- + dAtA[i] = 0x12 + } + if len(m.Crn) > 0 { + i -= len(m.Crn) + copy(dAtA[i:], m.Crn) + i = encodeVarintTx(dAtA, i, uint64(len(m.Crn))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgDeleteNameAuthorityResponse) 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 *MsgDeleteNameAuthorityResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDeleteNameAuthorityResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgRenewRecord) 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 *MsgRenewRecord) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRenewRecord) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Signer) > 0 { + i -= len(m.Signer) + copy(dAtA[i:], m.Signer) + i = encodeVarintTx(dAtA, i, uint64(len(m.Signer))) + i-- + dAtA[i] = 0x12 + } + if len(m.RecordId) > 0 { + i -= len(m.RecordId) + copy(dAtA[i:], m.RecordId) + i = encodeVarintTx(dAtA, i, uint64(len(m.RecordId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgRenewRecordResponse) 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 *MsgRenewRecordResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRenewRecordResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgAssociateBond) 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 *MsgAssociateBond) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgAssociateBond) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Signer) > 0 { + i -= len(m.Signer) + copy(dAtA[i:], m.Signer) + i = encodeVarintTx(dAtA, i, uint64(len(m.Signer))) + i-- + dAtA[i] = 0x1a + } + if len(m.BondId) > 0 { + i -= len(m.BondId) + copy(dAtA[i:], m.BondId) + i = encodeVarintTx(dAtA, i, uint64(len(m.BondId))) + i-- + dAtA[i] = 0x12 + } + if len(m.RecordId) > 0 { + i -= len(m.RecordId) + copy(dAtA[i:], m.RecordId) + i = encodeVarintTx(dAtA, i, uint64(len(m.RecordId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgAssociateBondResponse) 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 *MsgAssociateBondResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgAssociateBondResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgDissociateBond) 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 *MsgDissociateBond) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDissociateBond) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Signer) > 0 { + i -= len(m.Signer) + copy(dAtA[i:], m.Signer) + i = encodeVarintTx(dAtA, i, uint64(len(m.Signer))) + i-- + dAtA[i] = 0x12 + } + if len(m.RecordId) > 0 { + i -= len(m.RecordId) + copy(dAtA[i:], m.RecordId) + i = encodeVarintTx(dAtA, i, uint64(len(m.RecordId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgDissociateBondResponse) 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 *MsgDissociateBondResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDissociateBondResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgDissociateRecords) 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 *MsgDissociateRecords) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDissociateRecords) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Signer) > 0 { + i -= len(m.Signer) + copy(dAtA[i:], m.Signer) + i = encodeVarintTx(dAtA, i, uint64(len(m.Signer))) + i-- + dAtA[i] = 0x12 + } + if len(m.BondId) > 0 { + i -= len(m.BondId) + copy(dAtA[i:], m.BondId) + i = encodeVarintTx(dAtA, i, uint64(len(m.BondId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgDissociateRecordsResponse) 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 *MsgDissociateRecordsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDissociateRecordsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgReAssociateRecords) 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 *MsgReAssociateRecords) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgReAssociateRecords) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Signer) > 0 { + i -= len(m.Signer) + copy(dAtA[i:], m.Signer) + i = encodeVarintTx(dAtA, i, uint64(len(m.Signer))) + i-- + dAtA[i] = 0x1a + } + if len(m.OldBondId) > 0 { + i -= len(m.OldBondId) + copy(dAtA[i:], m.OldBondId) + i = encodeVarintTx(dAtA, i, uint64(len(m.OldBondId))) + i-- + dAtA[i] = 0x12 + } + if len(m.NewBondId) > 0 { + i -= len(m.NewBondId) + copy(dAtA[i:], m.NewBondId) + i = encodeVarintTx(dAtA, i, uint64(len(m.NewBondId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgReAssociateRecordsResponse) 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 *MsgReAssociateRecordsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgReAssociateRecordsResponse) 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 *MsgSetRecord) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.BondId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Payload.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgSetRecordResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Id) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *Payload) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Record != nil { + l = m.Record.Size() + n += 1 + l + sovTx(uint64(l)) + } + if len(m.Signatures) > 0 { + for _, e := range m.Signatures { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + return n +} + +func (m *MsgSetName) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Crn) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Cid) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgSetNameResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgReserveAuthority) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgReserveAuthorityResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgSetAuthorityBond) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.BondId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgSetAuthorityBondResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgDeleteNameAuthority) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Crn) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgDeleteNameAuthorityResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgRenewRecord) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.RecordId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgRenewRecordResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgAssociateBond) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.RecordId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.BondId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgAssociateBondResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgDissociateBond) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.RecordId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgDissociateBondResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgDissociateRecords) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.BondId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgDissociateRecordsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgReAssociateRecords) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.NewBondId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.OldBondId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgReAssociateRecordsResponse) 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 *MsgSetRecord) 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: MsgSetRecord: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSetRecord: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BondId", 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.BondId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signer", 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.Signer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Payload", 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 + } + if err := m.Payload.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 *MsgSetRecordResponse) 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: MsgSetRecordResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSetRecordResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", 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.Id = string(dAtA[iNdEx:postIndex]) + 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 *Payload) 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: Payload: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Payload: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Record", 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 + } + if m.Record == nil { + m.Record = &Record{} + } + if err := m.Record.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signatures", 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.Signatures = append(m.Signatures, Signature{}) + if err := m.Signatures[len(m.Signatures)-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 *MsgSetName) 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: MsgSetName: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSetName: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Crn", 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.Crn = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Cid", 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.Cid = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signer", 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.Signer = string(dAtA[iNdEx:postIndex]) + 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 *MsgSetNameResponse) 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: MsgSetNameResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSetNameResponse: 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 (m *MsgReserveAuthority) 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: MsgReserveAuthority: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgReserveAuthority: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", 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.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signer", 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.Signer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Owner", 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.Owner = string(dAtA[iNdEx:postIndex]) + 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 *MsgReserveAuthorityResponse) 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: MsgReserveAuthorityResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgReserveAuthorityResponse: 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 (m *MsgSetAuthorityBond) 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: MsgSetAuthorityBond: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSetAuthorityBond: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", 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.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BondId", 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.BondId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signer", 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.Signer = string(dAtA[iNdEx:postIndex]) + 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 *MsgSetAuthorityBondResponse) 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: MsgSetAuthorityBondResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSetAuthorityBondResponse: 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 (m *MsgDeleteNameAuthority) 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: MsgDeleteNameAuthority: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDeleteNameAuthority: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Crn", 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.Crn = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signer", 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.Signer = string(dAtA[iNdEx:postIndex]) + 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 *MsgDeleteNameAuthorityResponse) 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: MsgDeleteNameAuthorityResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDeleteNameAuthorityResponse: 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 (m *MsgRenewRecord) 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: MsgRenewRecord: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRenewRecord: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RecordId", 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.RecordId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signer", 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.Signer = string(dAtA[iNdEx:postIndex]) + 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 *MsgRenewRecordResponse) 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: MsgRenewRecordResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRenewRecordResponse: 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 (m *MsgAssociateBond) 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: MsgAssociateBond: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgAssociateBond: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RecordId", 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.RecordId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BondId", 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.BondId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signer", 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.Signer = string(dAtA[iNdEx:postIndex]) + 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 *MsgAssociateBondResponse) 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: MsgAssociateBondResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgAssociateBondResponse: 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 (m *MsgDissociateBond) 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: MsgDissociateBond: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDissociateBond: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RecordId", 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.RecordId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signer", 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.Signer = string(dAtA[iNdEx:postIndex]) + 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 *MsgDissociateBondResponse) 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: MsgDissociateBondResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDissociateBondResponse: 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 (m *MsgDissociateRecords) 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: MsgDissociateRecords: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDissociateRecords: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BondId", 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.BondId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signer", 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.Signer = string(dAtA[iNdEx:postIndex]) + 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 *MsgDissociateRecordsResponse) 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: MsgDissociateRecordsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDissociateRecordsResponse: 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 (m *MsgReAssociateRecords) 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: MsgReAssociateRecords: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgReAssociateRecords: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NewBondId", 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.NewBondId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OldBondId", 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.OldBondId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signer", 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.Signer = string(dAtA[iNdEx:postIndex]) + 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 *MsgReAssociateRecordsResponse) 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: MsgReAssociateRecordsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgReAssociateRecordsResponse: 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/nameservice/types/types.go b/x/nameservice/types/types.go new file mode 100644 index 00000000..f60b0cea --- /dev/null +++ b/x/nameservice/types/types.go @@ -0,0 +1,131 @@ +package types + +import ( + "crypto/sha256" + + canonicalJson "github.com/gibson042/canonicaljson-go" + "github.com/tharsis/ethermint/x/nameservice/helpers" +) + +const ( + AuthorityActive = "active" + AuthorityExpired = "expired" + AuthorityUnderAuction = "auction" +) + +// PayloadType represents a signed record payload that can be serialized from/to YAML. +type PayloadType struct { + Record map[string]interface{} `json:"record"` + Signatures []Signature `json:"signatures"` +} + +// ToPayload converts PayloadType to Payload object. +// Why? Because go-amino can't handle maps: https://github.com/tendermint/go-amino/issues/4. +func (payloadObj *PayloadType) ToPayload() Payload { + var payload = Payload{ + Record: &Record{ + Deleted: false, + Owners: nil, + Attributes: helpers.BytesToBase64(helpers.MarshalMapToJSONBytes(payloadObj.Record)), + }, + Signatures: payloadObj.Signatures, + } + return payload +} + +// ToReadablePayload converts Payload to PayloadType +// It will unmarshal with record attributes +func (payload Payload) ToReadablePayload() PayloadType { + var payloadType PayloadType + + payloadType.Record = helpers.UnMarshalMapFromJSONBytes(helpers.BytesFromBase64(payload.Record.Attributes)) + + payloadType.Signatures = payload.Signatures + + return payloadType +} + +// Record to Record Type for human-readable attributes + +func (r *Record) ToRecordType() RecordType { + var resourceObj RecordType + + resourceObj.Id = r.Id + resourceObj.BondId = r.BondId + resourceObj.CreateTime = r.CreateTime + resourceObj.ExpiryTime = r.ExpiryTime + resourceObj.Deleted = r.Deleted + resourceObj.Owners = r.Owners + resourceObj.Names = r.Names + resourceObj.Attributes = helpers.UnMarshalMapFromJSONBytes(helpers.BytesFromBase64(r.Attributes)) + + return resourceObj +} + +// RecordType represents a WNS record. +type RecordType struct { + Id string `json:"id,omitempty"` + Names []string `json:"names,omitempty"` + BondId string `json:"bondId,omitempty"` + CreateTime string `json:"createTime,omitempty"` + ExpiryTime string `json:"expiryTime,omitempty"` + Deleted bool `json:"deleted,omitempty"` + Owners []string `json:"owners,omitempty"` + Attributes map[string]interface{} `json:"attributes,omitempty"` +} + +// ToRecordObj converts Record to RecordObj. +// Why? Because go-amino can't handle maps: https://github.com/tendermint/go-amino/issues/4. +func (r *RecordType) ToRecordObj() Record { + var resourceObj Record + + resourceObj.Id = r.Id + resourceObj.BondId = r.BondId + resourceObj.CreateTime = r.CreateTime + resourceObj.ExpiryTime = r.ExpiryTime + resourceObj.Deleted = r.Deleted + resourceObj.Owners = r.Owners + resourceObj.Attributes = helpers.BytesToBase64(helpers.MarshalMapToJSONBytes(r.Attributes)) + + return resourceObj +} + +// CanonicalJSON returns the canonical JSON representation of the record. +func (r *RecordType) CanonicalJSON() []byte { + bytes, err := canonicalJson.Marshal(r.Attributes) + if err != nil { + panic("Record marshal error.") + } + + return bytes +} + +// GetSignBytes generates a record hash to be signed. +func (r *RecordType) GetSignBytes() ([]byte, []byte) { + // Double SHA256 hash. + + // Input to the first round of hashing. + bytes := r.CanonicalJSON() + + // First round. + first := sha256.New() + first.Write(bytes) + firstHash := first.Sum(nil) + + // Second round of hashing takes as input the output of the first round. + second := sha256.New() + second.Write(firstHash) + secondHash := second.Sum(nil) + + return secondHash, bytes +} + +// GetCID gets the record CID. +func (r *RecordType) GetCID() (string, error) { + id, err := helpers.GetCid(r.CanonicalJSON()) + if err != nil { + return "", err + } + + return id, nil +}