mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-06-03 20:56:38 +00:00
Merge branch 'main' into 124-propose-a-liquid-issuance-to-the-network-unsigned-transaction
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
This commit is contained in:
commit
b81cdb6dc9
@ -49,6 +49,7 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
|
||||
ante.NewTxTimeoutHeightDecorator(),
|
||||
ante.NewValidateMemoDecorator(options.AccountKeeper),
|
||||
NewCheckMachineDecorator(options.MachineKeeper),
|
||||
NewCheckMintAddressDecorator(),
|
||||
ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper),
|
||||
NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, options.TxFeeChecker),
|
||||
ante.NewSetPubKeyDecorator(options.AccountKeeper), // SetPubKeyDecorator must be called before all signature verification decorators
|
||||
|
32
app/ante/check_mint_address_decorator.go
Normal file
32
app/ante/check_mint_address_decorator.go
Normal file
@ -0,0 +1,32 @@
|
||||
package ante
|
||||
|
||||
import (
|
||||
errorsmod "cosmossdk.io/errors"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/planetmint/planetmint-go/config"
|
||||
daotypes "github.com/planetmint/planetmint-go/x/dao/types"
|
||||
)
|
||||
|
||||
type CheckMintAddressDecorator struct {
|
||||
MintAddress string
|
||||
}
|
||||
|
||||
func NewCheckMintAddressDecorator() CheckMintAddressDecorator {
|
||||
return CheckMintAddressDecorator{}
|
||||
}
|
||||
|
||||
func (cmad CheckMintAddressDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (sdk.Context, error) {
|
||||
for _, msg := range tx.GetMsgs() {
|
||||
if sdk.MsgTypeURL(msg) == "/planetmintgo.dao.MsgMintToken" {
|
||||
mintMsg, ok := msg.(*daotypes.MsgMintToken)
|
||||
if ok {
|
||||
cfg := config.GetConfig()
|
||||
if mintMsg.Creator != cfg.MintAddress {
|
||||
return ctx, errorsmod.Wrapf(daotypes.ErrInvalidMintAddress, "expected: %s; got: %s", cmad.MintAddress, mintMsg.Creator)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return next(ctx, tx, simulate)
|
||||
}
|
@ -315,7 +315,7 @@ func New(
|
||||
machinemoduletypes.StoreKey, machinemoduletypes.TAIndexKey, machinemoduletypes.IssuerPlanetmintIndexKey, machinemoduletypes.IssuerLiquidIndexKey,
|
||||
machinemoduletypes.TrustAnchorKey, machinemoduletypes.AddressIndexKey,
|
||||
assetmoduletypes.StoreKey,
|
||||
daomoduletypes.StoreKey, daomoduletypes.ChallengeKey,
|
||||
daomoduletypes.StoreKey, daomoduletypes.ChallengeKey, daomoduletypes.MintRequestHashKey, daomoduletypes.MintRequestAddressKey,
|
||||
// this line is used by starport scaffolding # stargate/app/storeKey
|
||||
)
|
||||
tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey)
|
||||
@ -550,7 +550,6 @@ func New(
|
||||
app.GetSubspace(machinemoduletypes.ModuleName),
|
||||
)
|
||||
machineModule := machinemodule.NewAppModule(appCodec, app.MachineKeeper, app.AccountKeeper, app.BankKeeper)
|
||||
go app.MachineKeeper.IssueResponseHandler(logger)
|
||||
|
||||
app.AssetKeeper = *assetmodulekeeper.NewKeeper(
|
||||
appCodec,
|
||||
@ -567,6 +566,8 @@ func New(
|
||||
keys[daomoduletypes.StoreKey],
|
||||
keys[daomoduletypes.MemStoreKey],
|
||||
keys[daomoduletypes.ChallengeKey],
|
||||
keys[daomoduletypes.MintRequestHashKey],
|
||||
keys[daomoduletypes.MintRequestAddressKey],
|
||||
app.GetSubspace(daomoduletypes.ModuleName),
|
||||
|
||||
app.BankKeeper,
|
||||
|
@ -13,9 +13,8 @@ const DefaultConfigTemplate = `
|
||||
###############################################################################
|
||||
|
||||
[planetmint]
|
||||
osc-service-port = {{ .PlmntConfig.OSCServicePort }}
|
||||
watchmen-endpoint = "{{ .PlmntConfig.WatchmenEndpoint }}"
|
||||
watchmen-port = {{ .PlmntConfig.WatchmenPort }}
|
||||
|
||||
asset-registry-endpoint = "{{ .PlmntConfig.AssetRegistryEndpoint }}"
|
||||
token-denom = "{{ .PlmntConfig.TokenDenom }}"
|
||||
stake-denom = "{{ .PlmntConfig.StakeDenom }}"
|
||||
fee-denom = "{{ .PlmntConfig.FeeDenom }}"
|
||||
@ -25,22 +24,24 @@ rpc-host = "{{ .PlmntConfig.RPCHost }}"
|
||||
rpc-port = {{ .PlmntConfig.RPCPort }}
|
||||
rpc-user = "{{ .PlmntConfig.RPCUser }}"
|
||||
rpc-password = "{{ .PlmntConfig.RPCPassword }}"
|
||||
mint-address = "{{ .PlmntConfig.MintAddress }}"
|
||||
issuance-service-dir = {{ .PlmntConfig.IssuanceServiceDir }}
|
||||
`
|
||||
|
||||
// Config defines Planetmint's top level configuration
|
||||
type Config struct {
|
||||
OSCServicePort int `mapstructure:"osc-service-port" json:"osc-service-port"`
|
||||
WatchmenEndpoint string `mapstructure:"watchmen-endpoint" json:"watchmen-endpoint"`
|
||||
WatchmenPort int `mapstructure:"watchmen-port" json:"watchmen-port"`
|
||||
TokenDenom string `mapstructure:"token-denom" json:"token-denom"`
|
||||
StakeDenom string `mapstructure:"stake-denom" json:"stake-denom"`
|
||||
FeeDenom string `mapstructure:"fee-denom" json:"fee-denom"`
|
||||
ConfigRootDir string `mapstructure:"config-root-dir" json:"config-root-dir"`
|
||||
PoPEpochs int `mapstructure:"pop-epochs" json:"pop-epochs"`
|
||||
RPCHost string `mapstructure:"rpc-host" json:"rpc-host"`
|
||||
RPCPort int `mapstructure:"rpc-port" json:"rpc-port"`
|
||||
RPCUser string `mapstructure:"rpc-user" json:"rpc-user"`
|
||||
RPCPassword string `mapstructure:"rpc-password" json:"rpc-password"`
|
||||
AssetRegistryEndpoint string `mapstructure:"asset-registry-endpoint " json:"asset-registry-endpoint "`
|
||||
TokenDenom string `mapstructure:"token-denom" json:"token-denom"`
|
||||
StakeDenom string `mapstructure:"stake-denom" json:"stake-denom"`
|
||||
FeeDenom string `mapstructure:"fee-denom" json:"fee-denom"`
|
||||
ConfigRootDir string `mapstructure:"config-root-dir" json:"config-root-dir"`
|
||||
PoPEpochs int `mapstructure:"pop-epochs" json:"pop-epochs"`
|
||||
RPCHost string `mapstructure:"rpc-host" json:"rpc-host"`
|
||||
RPCPort int `mapstructure:"rpc-port" json:"rpc-port"`
|
||||
RPCUser string `mapstructure:"rpc-user" json:"rpc-user"`
|
||||
RPCPassword string `mapstructure:"rpc-password" json:"rpc-password"`
|
||||
IssuanceServiceDir string `mapstructure:"issuance-service-dir" json:"issuance-service-dir"`
|
||||
MintAddress string `mapstructure:"mint-address" json:"mint-address"`
|
||||
}
|
||||
|
||||
// cosmos-sdk wide global singleton
|
||||
@ -57,18 +58,18 @@ func DefaultConfig() *Config {
|
||||
}
|
||||
|
||||
return &Config{
|
||||
OSCServicePort: 8766,
|
||||
WatchmenEndpoint: "lab.r3c.network",
|
||||
WatchmenPort: 7401,
|
||||
TokenDenom: "plmnt",
|
||||
StakeDenom: "plmntstake",
|
||||
FeeDenom: "plmnt",
|
||||
ConfigRootDir: filepath.Join(currentUser.HomeDir, ".planetmint-go"),
|
||||
PoPEpochs: 24, // 24 CometBFT epochs of 5s equate 120s
|
||||
RPCHost: "localhost",
|
||||
RPCPort: 18884,
|
||||
RPCUser: "user",
|
||||
RPCPassword: "password",
|
||||
AssetRegistryEndpoint: "https://assets.rddl.io/register_asset",
|
||||
TokenDenom: "plmnt",
|
||||
StakeDenom: "plmntstake",
|
||||
FeeDenom: "plmnt",
|
||||
ConfigRootDir: filepath.Join(currentUser.HomeDir, ".planetmint-go"),
|
||||
PoPEpochs: 24, // 24 CometBFT epochs of 5s equate 120s
|
||||
RPCHost: "localhost",
|
||||
RPCPort: 18884,
|
||||
RPCUser: "user",
|
||||
RPCPassword: "password",
|
||||
IssuanceServiceDir: "/opt/issuer_service",
|
||||
MintAddress: "default",
|
||||
}
|
||||
}
|
||||
|
||||
|
153
docs/static/openapi.yml
vendored
153
docs/static/openapi.yml
vendored
@ -46676,6 +46676,101 @@ paths:
|
||||
additionalProperties: {}
|
||||
tags:
|
||||
- Query
|
||||
/planetmint/planetmint-go/dao/get_mint_requests_by_hash/{hash}:
|
||||
get:
|
||||
summary: Queries a list of GetMintRequestsByHash items.
|
||||
operationId: PlanetmintgoDaoGetMintRequestsByHash
|
||||
responses:
|
||||
'200':
|
||||
description: A successful response.
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
mintRequest:
|
||||
type: object
|
||||
properties:
|
||||
beneficiary:
|
||||
type: string
|
||||
amount:
|
||||
type: string
|
||||
format: uint64
|
||||
liquidTxHash:
|
||||
type: string
|
||||
default:
|
||||
description: An unexpected error response.
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
code:
|
||||
type: integer
|
||||
format: int32
|
||||
message:
|
||||
type: string
|
||||
details:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
'@type':
|
||||
type: string
|
||||
additionalProperties: {}
|
||||
parameters:
|
||||
- name: hash
|
||||
in: path
|
||||
required: true
|
||||
type: string
|
||||
tags:
|
||||
- Query
|
||||
/planetmint/planetmint-go/dao/mint_requests_by_address/{address}:
|
||||
get:
|
||||
summary: Queries a list of MintRequestsByAddress items.
|
||||
operationId: PlanetmintgoDaoMintRequestsByAddress
|
||||
responses:
|
||||
'200':
|
||||
description: A successful response.
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
mintRequests:
|
||||
type: object
|
||||
properties:
|
||||
Requests:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
beneficiary:
|
||||
type: string
|
||||
amount:
|
||||
type: string
|
||||
format: uint64
|
||||
liquidTxHash:
|
||||
type: string
|
||||
default:
|
||||
description: An unexpected error response.
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
code:
|
||||
type: integer
|
||||
format: int32
|
||||
message:
|
||||
type: string
|
||||
details:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
'@type':
|
||||
type: string
|
||||
additionalProperties: {}
|
||||
parameters:
|
||||
- name: address
|
||||
in: path
|
||||
required: true
|
||||
type: string
|
||||
tags:
|
||||
- Query
|
||||
/github.com/planetmint/planetmint-go/machine/get_machine_by_public_key/{publicKey}:
|
||||
get:
|
||||
summary: Queries a list of GetMachineByPublicKey items.
|
||||
@ -75694,11 +75789,69 @@ definitions:
|
||||
description: params holds all the parameters of this module.
|
||||
type: object
|
||||
description: QueryParamsResponse is response type for the Query/Params RPC method.
|
||||
planetmintgo.dao.MintRequest:
|
||||
type: object
|
||||
properties:
|
||||
beneficiary:
|
||||
type: string
|
||||
amount:
|
||||
type: string
|
||||
format: uint64
|
||||
liquidTxHash:
|
||||
type: string
|
||||
planetmintgo.dao.MintRequests:
|
||||
type: object
|
||||
properties:
|
||||
Requests:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
beneficiary:
|
||||
type: string
|
||||
amount:
|
||||
type: string
|
||||
format: uint64
|
||||
liquidTxHash:
|
||||
type: string
|
||||
planetmintgo.dao.MsgMintTokenResponse:
|
||||
type: object
|
||||
planetmintgo.dao.MsgReissueRDDLProposalResponse:
|
||||
type: object
|
||||
planetmintgo.dao.Params:
|
||||
type: object
|
||||
description: Params defines the parameters for the module.
|
||||
planetmintgo.dao.QueryGetMintRequestsByHashResponse:
|
||||
type: object
|
||||
properties:
|
||||
mintRequest:
|
||||
type: object
|
||||
properties:
|
||||
beneficiary:
|
||||
type: string
|
||||
amount:
|
||||
type: string
|
||||
format: uint64
|
||||
liquidTxHash:
|
||||
type: string
|
||||
planetmintgo.dao.QueryMintRequestsByAddressResponse:
|
||||
type: object
|
||||
properties:
|
||||
mintRequests:
|
||||
type: object
|
||||
properties:
|
||||
Requests:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
beneficiary:
|
||||
type: string
|
||||
amount:
|
||||
type: string
|
||||
format: uint64
|
||||
liquidTxHash:
|
||||
type: string
|
||||
planetmintgo.dao.QueryParamsResponse:
|
||||
type: object
|
||||
properties:
|
||||
|
4
go.mod
4
go.mod
@ -6,7 +6,7 @@ require (
|
||||
cosmossdk.io/api v0.3.1
|
||||
cosmossdk.io/errors v1.0.0
|
||||
cosmossdk.io/math v1.1.2
|
||||
github.com/btcsuite/btcd v0.23.4
|
||||
github.com/btcsuite/btcd v0.23.2
|
||||
github.com/btcsuite/btcd/btcutil v1.1.2
|
||||
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1
|
||||
github.com/cometbft/cometbft v0.37.2
|
||||
@ -15,13 +15,11 @@ require (
|
||||
github.com/cosmos/go-bip39 v1.0.0
|
||||
github.com/cosmos/gogoproto v1.4.10
|
||||
github.com/cosmos/ibc-go/v7 v7.1.0
|
||||
github.com/crgimenes/go-osc v0.0.0-20230219003551-cc22b44f06a3
|
||||
github.com/golang/mock v1.6.0
|
||||
github.com/golang/protobuf v1.5.3
|
||||
github.com/gorilla/mux v1.8.0
|
||||
github.com/grpc-ecosystem/grpc-gateway v1.16.0
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.2
|
||||
github.com/hypebeast/go-osc v0.0.0-20220308234300-cec5a8a1e5f5
|
||||
github.com/spf13/cast v1.5.0
|
||||
github.com/spf13/cobra v1.6.1
|
||||
github.com/spf13/pflag v1.0.5
|
||||
|
8
go.sum
8
go.sum
@ -259,8 +259,8 @@ github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816/go.mod h1:+zsy
|
||||
github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ=
|
||||
github.com/btcsuite/btcd v0.22.0-beta.0.20220111032746-97732e52810c/go.mod h1:tjmYdS6MLJ5/s0Fj4DbLgSbDHbEqLJrtnHecBFkdz5M=
|
||||
github.com/btcsuite/btcd v0.23.0/go.mod h1:0QJIIN1wwIXF/3G/m87gIwGniDMDQqjVn4SZgnFpsYY=
|
||||
github.com/btcsuite/btcd v0.23.4 h1:IzV6qqkfwbItOS/sg/aDfPDsjPP8twrCOE2R93hxMlQ=
|
||||
github.com/btcsuite/btcd v0.23.4/go.mod h1:0QJIIN1wwIXF/3G/m87gIwGniDMDQqjVn4SZgnFpsYY=
|
||||
github.com/btcsuite/btcd v0.23.2 h1:/YOgUp25sdCnP5ho6Hl3s0E438zlX+Kak7E6TgBgoT0=
|
||||
github.com/btcsuite/btcd v0.23.2/go.mod h1:0QJIIN1wwIXF/3G/m87gIwGniDMDQqjVn4SZgnFpsYY=
|
||||
github.com/btcsuite/btcd/btcec/v2 v2.1.0/go.mod h1:2VzYrv4Gm4apmbVVsSq5bqf1Ec8v56E48Vt0Y/umPgA=
|
||||
github.com/btcsuite/btcd/btcec/v2 v2.1.3/go.mod h1:ctjw4H1kknNJmRN4iP1R7bTQ+v3GJkZBd6mui8ZsAZE=
|
||||
github.com/btcsuite/btcd/btcec/v2 v2.3.2 h1:5n0X6hX0Zk+6omWcihdYvdAlGf2DfasC0GMf7DClJ3U=
|
||||
@ -376,8 +376,6 @@ github.com/creachadair/taskgroup v0.4.2 h1:jsBLdAJE42asreGss2xZGZ8fJra7WtwnHWeJF
|
||||
github.com/creachadair/taskgroup v0.4.2/go.mod h1:qiXUOSrbwAY3u0JPGTzObbE3yf9hcXHDKBZ2ZjpCbgM=
|
||||
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
|
||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||
github.com/crgimenes/go-osc v0.0.0-20230219003551-cc22b44f06a3 h1:ffNeIlr2uX5jgPWlJq3pveSl9a3B6lftpuX978PMzk8=
|
||||
github.com/crgimenes/go-osc v0.0.0-20230219003551-cc22b44f06a3/go.mod h1:VgRiOtg6gFJfgCY2fMvfyORGwDM3EQ7Z9s/aO0k6cu8=
|
||||
github.com/danieljoos/wincred v1.1.2 h1:QLdCxFs1/Yl4zduvBdcHB8goaYk9RARS2SgLLRuAyr0=
|
||||
github.com/danieljoos/wincred v1.1.2/go.mod h1:GijpziifJoIBfYh+S7BbkdUTU4LfM+QnGqR5Vl2tAx0=
|
||||
github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
@ -680,8 +678,6 @@ github.com/huandu/go-assert v1.1.5/go.mod h1:yOLvuqZwmcHIC5rIzrBhT7D3Q9c3GFnd0Jr
|
||||
github.com/huandu/skiplist v1.2.0 h1:gox56QD77HzSC0w+Ws3MH3iie755GBJU1OER3h5VsYw=
|
||||
github.com/huandu/skiplist v1.2.0/go.mod h1:7v3iFjLcSAzO4fN5B8dvebvo/qsfumiLiDXMrPiHF9w=
|
||||
github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg=
|
||||
github.com/hypebeast/go-osc v0.0.0-20220308234300-cec5a8a1e5f5 h1:fqwINudmUrvGCuw+e3tedZ2UJ0hklSw6t8UPomctKyQ=
|
||||
github.com/hypebeast/go-osc v0.0.0-20220308234300-cec5a8a1e5f5/go.mod h1:lqMjoCs0y0GoRRujSPZRBaGb4c5ER6TfkFKSClxkMbY=
|
||||
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
||||
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
||||
github.com/improbable-eng/grpc-web v0.15.0 h1:BN+7z6uNXZ1tQGcNAuaU1YjsLTApzkjt2tzCixLaUPQ=
|
||||
|
11
proto/planetmintgo/dao/mint_request.proto
Normal file
11
proto/planetmintgo/dao/mint_request.proto
Normal file
@ -0,0 +1,11 @@
|
||||
syntax = "proto3";
|
||||
package planetmintgo.dao;
|
||||
|
||||
option go_package = "github.com/planetmint/planetmint-go/x/dao/types";
|
||||
|
||||
message MintRequest {
|
||||
|
||||
string beneficiary = 1;
|
||||
uint64 amount = 2;
|
||||
string liquidTxHash = 3;
|
||||
}
|
11
proto/planetmintgo/dao/mint_requests.proto
Normal file
11
proto/planetmintgo/dao/mint_requests.proto
Normal file
@ -0,0 +1,11 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package planetmintgo.dao;
|
||||
|
||||
import "planetmintgo/dao/mint_request.proto";
|
||||
|
||||
option go_package = "github.com/planetmint/planetmint-go/x/dao/types";
|
||||
|
||||
message MintRequests {
|
||||
repeated MintRequest Requests = 1;
|
||||
}
|
@ -1,26 +1,60 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package planetmintgo.dao;
|
||||
|
||||
import "gogoproto/gogo.proto";
|
||||
import "google/api/annotations.proto";
|
||||
import "cosmos/base/query/v1beta1/pagination.proto";
|
||||
import "planetmintgo/dao/params.proto";
|
||||
import "planetmintgo/dao/mint_request.proto";
|
||||
import "planetmintgo/dao/mint_requests.proto";
|
||||
|
||||
option go_package = "github.com/planetmint/planetmint-go/x/dao/types";
|
||||
|
||||
// Query defines the gRPC querier service.
|
||||
service Query {
|
||||
|
||||
// Parameters queries the parameters of the module.
|
||||
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
|
||||
rpc Params (QueryParamsRequest) returns (QueryParamsResponse) {
|
||||
option (google.api.http).get = "/github.com/planetmint/planetmint-go/dao/params";
|
||||
|
||||
}
|
||||
|
||||
// Queries a list of GetMintRequestsByHash items.
|
||||
rpc GetMintRequestsByHash (QueryGetMintRequestsByHashRequest) returns (QueryGetMintRequestsByHashResponse) {
|
||||
option (google.api.http).get = "/planetmint/planetmint-go/dao/get_mint_requests_by_hash/{hash}";
|
||||
|
||||
}
|
||||
|
||||
// Queries a list of MintRequestsByAddress items.
|
||||
rpc MintRequestsByAddress (QueryMintRequestsByAddressRequest) returns (QueryMintRequestsByAddressResponse) {
|
||||
option (google.api.http).get = "/planetmint/planetmint-go/dao/mint_requests_by_address/{address}";
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// QueryParamsRequest is request type for the Query/Params RPC method.
|
||||
message QueryParamsRequest {}
|
||||
|
||||
// QueryParamsResponse is response type for the Query/Params RPC method.
|
||||
message QueryParamsResponse {
|
||||
|
||||
// params holds all the parameters of this module.
|
||||
Params params = 1 [(gogoproto.nullable) = false];
|
||||
}
|
||||
}
|
||||
|
||||
message QueryGetMintRequestsByHashRequest {
|
||||
string hash = 1;
|
||||
}
|
||||
|
||||
message QueryGetMintRequestsByHashResponse {
|
||||
MintRequest mintRequest = 1;
|
||||
}
|
||||
|
||||
message QueryMintRequestsByAddressRequest {
|
||||
string address = 1;
|
||||
}
|
||||
|
||||
message QueryMintRequestsByAddressResponse {
|
||||
MintRequests mintRequests = 1;
|
||||
}
|
||||
|
||||
|
@ -2,11 +2,14 @@ syntax = "proto3";
|
||||
|
||||
package planetmintgo.dao;
|
||||
|
||||
import "planetmintgo/dao/mint_request.proto";
|
||||
|
||||
option go_package = "github.com/planetmint/planetmint-go/x/dao/types";
|
||||
|
||||
// Msg defines the Msg service.
|
||||
service Msg {
|
||||
rpc ReissueRDDLProposal (MsgReissueRDDLProposal) returns (MsgReissueRDDLProposalResponse);
|
||||
rpc MintToken (MsgMintToken) returns (MsgMintTokenResponse);
|
||||
}
|
||||
message MsgReissueRDDLProposal {
|
||||
string creator = 1;
|
||||
@ -17,3 +20,10 @@ message MsgReissueRDDLProposal {
|
||||
|
||||
message MsgReissueRDDLProposalResponse {}
|
||||
|
||||
message MsgMintToken {
|
||||
string creator = 1;
|
||||
MintRequest mintRequest = 2;
|
||||
}
|
||||
|
||||
message MsgMintTokenResponse {}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package dao
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"github.com/planetmint/planetmint-go/config"
|
||||
@ -18,6 +19,8 @@ import (
|
||||
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
daocli "github.com/planetmint/planetmint-go/x/dao/client/cli"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -136,3 +139,62 @@ func (s *E2ETestSuite) TestDistributeCollectedFees() {
|
||||
assert.Contains(s.T(), out.String(), "13")
|
||||
s.Require().NoError(err)
|
||||
}
|
||||
|
||||
func (s *E2ETestSuite) TestMintToken() {
|
||||
conf := config.GetConfig()
|
||||
val := s.network.Validators[0]
|
||||
|
||||
// val.Address.String()
|
||||
|
||||
mintRequest := sample.MintRequest(aliceAddr.String(), 1000, "hash")
|
||||
mrJSON, err := json.Marshal(&mintRequest)
|
||||
s.Require().NoError(err)
|
||||
|
||||
// send mint token request from non mint address
|
||||
args := []string{
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Moniker),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("10%s", conf.FeeDenom)),
|
||||
"--yes",
|
||||
string(mrJSON),
|
||||
}
|
||||
|
||||
out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, daocli.CmdMintToken(), args)
|
||||
s.Require().NoError(err)
|
||||
|
||||
txResponse, err := clitestutil.GetTxResponseFromOut(out)
|
||||
s.Require().NoError(err)
|
||||
s.Require().Equal(int(txResponse.Code), int(2))
|
||||
|
||||
// set mint address to val.address
|
||||
conf.MintAddress = val.Address.String()
|
||||
conf.SetPlanetmintConfig(conf)
|
||||
|
||||
// send mint token request from mint address
|
||||
args = []string{
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Moniker),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("10%s", conf.FeeDenom)),
|
||||
"--yes",
|
||||
string(mrJSON),
|
||||
}
|
||||
|
||||
out, err = clitestutil.ExecTestCLICmd(val.ClientCtx, daocli.CmdMintToken(), args)
|
||||
s.Require().NoError(err)
|
||||
|
||||
txResponse, err = clitestutil.GetTxResponseFromOut(out)
|
||||
s.Require().NoError(err)
|
||||
s.Require().Equal(int(txResponse.Code), int(0))
|
||||
|
||||
s.Require().NoError(s.network.WaitForNextBlock())
|
||||
rawLog, err := clitestutil.GetRawLogFromTxResponse(val, txResponse)
|
||||
s.Require().NoError(err)
|
||||
|
||||
assert.Contains(s.T(), rawLog, "planetmintgo.dao.MsgMintToken")
|
||||
|
||||
// assert that alice has actually received the minted tokens 10000 (initial supply) + 1000 (minted) = 11000 (total)
|
||||
out, err = clitestutil.ExecTestCLICmd(val.ClientCtx, bank.GetBalancesCmd(), []string{
|
||||
aliceAddr.String(),
|
||||
})
|
||||
assert.Contains(s.T(), out.String(), "plmnt")
|
||||
assert.Contains(s.T(), out.String(), "11000")
|
||||
s.Require().NoError(err)
|
||||
}
|
||||
|
@ -12,21 +12,32 @@ import (
|
||||
storetypes "github.com/cosmos/cosmos-sdk/store/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
typesparams "github.com/cosmos/cosmos-sdk/x/params/types"
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/planetmint/planetmint-go/config"
|
||||
"github.com/planetmint/planetmint-go/testutil/sample"
|
||||
"github.com/planetmint/planetmint-go/x/dao/keeper"
|
||||
"github.com/planetmint/planetmint-go/x/dao/types"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
daotestutil "github.com/planetmint/planetmint-go/x/dao/testutil"
|
||||
)
|
||||
|
||||
func DaoKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) {
|
||||
cfg := config.GetConfig()
|
||||
|
||||
storeKey := sdk.NewKVStoreKey(types.StoreKey)
|
||||
memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey)
|
||||
challengeStoreKey := storetypes.NewMemoryStoreKey(types.ChallengeKey)
|
||||
mintRequestHashStoreKey := storetypes.NewMemoryStoreKey(types.MintRequestHashKey)
|
||||
mintRequestAddressStoreKey := storetypes.NewMemoryStoreKey(types.MintRequestAddressKey)
|
||||
|
||||
db := tmdb.NewMemDB()
|
||||
stateStore := store.NewCommitMultiStore(db)
|
||||
stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db)
|
||||
stateStore.MountStoreWithDB(memStoreKey, storetypes.StoreTypeMemory, nil)
|
||||
stateStore.MountStoreWithDB(challengeStoreKey, storetypes.StoreTypeIAVL, db)
|
||||
stateStore.MountStoreWithDB(mintRequestHashStoreKey, storetypes.StoreTypeIAVL, db)
|
||||
stateStore.MountStoreWithDB(mintRequestAddressStoreKey, storetypes.StoreTypeIAVL, db)
|
||||
|
||||
require.NoError(t, stateStore.LoadLatestVersion())
|
||||
|
||||
@ -39,18 +50,30 @@ func DaoKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) {
|
||||
memStoreKey,
|
||||
"DaoParams",
|
||||
)
|
||||
|
||||
ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger())
|
||||
|
||||
ctrl := gomock.NewController(t)
|
||||
bk := daotestutil.NewMockBankKeeper(ctrl)
|
||||
|
||||
amt := sdk.NewCoins(sdk.NewCoin(cfg.TokenDenom, sdk.NewIntFromUint64(1000)))
|
||||
beneficiaryAddr, _ := sdk.AccAddressFromBech32(sample.ConstBech32Addr)
|
||||
|
||||
bk.EXPECT().MintCoins(ctx, types.ModuleName, amt).Return(nil).AnyTimes()
|
||||
bk.EXPECT().SendCoinsFromModuleToAccount(ctx, types.ModuleName, beneficiaryAddr, amt).Return(nil).AnyTimes()
|
||||
|
||||
k := keeper.NewKeeper(
|
||||
cdc,
|
||||
storeKey,
|
||||
memStoreKey,
|
||||
challengeStoreKey,
|
||||
mintRequestHashStoreKey,
|
||||
mintRequestAddressStoreKey,
|
||||
paramsSubspace,
|
||||
nil,
|
||||
bk,
|
||||
nil,
|
||||
)
|
||||
|
||||
ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger())
|
||||
|
||||
// Initialize params
|
||||
k.SetParams(ctx, types.DefaultParams())
|
||||
|
||||
|
@ -5,6 +5,7 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/planetmint/planetmint-go/config"
|
||||
daotypes "github.com/planetmint/planetmint-go/x/dao/types"
|
||||
machinetypes "github.com/planetmint/planetmint-go/x/machine/types"
|
||||
|
||||
"github.com/btcsuite/btcd/btcutil/hdkeychain"
|
||||
@ -34,6 +35,9 @@ const Fees = "1stake"
|
||||
// DefaultDerivationPath is the BIP44Prefix for PLMNT (see https://github.com/satoshilabs/slips/blob/master/slip-0044.md)
|
||||
const DefaultDerivationPath = "m/44'/8680'/0'/0/0"
|
||||
|
||||
// ConstantBech32Addr for mocks
|
||||
const ConstBech32Addr = "cosmos1fkmmfvjf39hurp2ls3whtv73266jhh2n49202g"
|
||||
|
||||
// KeyPair returns a sample private / public keypair
|
||||
func KeyPair(optional ...int) (string, string) {
|
||||
secret := "Don't tell anybody"
|
||||
@ -136,3 +140,11 @@ func TrustAnchor(pubkey string) machinetypes.TrustAnchor {
|
||||
Pubkey: pubkey,
|
||||
}
|
||||
}
|
||||
|
||||
func MintRequest(beneficiaryAddr string, amount uint64, txhash string) daotypes.MintRequest {
|
||||
return daotypes.MintRequest{
|
||||
Beneficiary: beneficiaryAddr,
|
||||
Amount: amount,
|
||||
LiquidTxHash: txhash,
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,10 @@ func GetQueryCmd(queryRoute string) *cobra.Command {
|
||||
}
|
||||
|
||||
cmd.AddCommand(CmdQueryParams())
|
||||
cmd.AddCommand(CmdGetMintRequestsByHash())
|
||||
|
||||
cmd.AddCommand(CmdMintRequestsByAddress())
|
||||
|
||||
// this line is used by starport scaffolding # 1
|
||||
|
||||
return cmd
|
||||
|
46
x/dao/client/cli/query_get_mint_requests_by_hash.go
Normal file
46
x/dao/client/cli/query_get_mint_requests_by_hash.go
Normal file
@ -0,0 +1,46 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/client/flags"
|
||||
"github.com/planetmint/planetmint-go/x/dao/types"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var _ = strconv.Itoa(0)
|
||||
|
||||
func CmdGetMintRequestsByHash() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "get-mint-requests-by-hash [hash]",
|
||||
Short: "Query get-mint-requests-by-hash",
|
||||
Args: cobra.ExactArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) (err error) {
|
||||
reqHash := args[0]
|
||||
|
||||
clientCtx, err := client.GetClientQueryContext(cmd)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
queryClient := types.NewQueryClient(clientCtx)
|
||||
|
||||
params := &types.QueryGetMintRequestsByHashRequest{
|
||||
|
||||
Hash: reqHash,
|
||||
}
|
||||
|
||||
res, err := queryClient.GetMintRequestsByHash(cmd.Context(), params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return clientCtx.PrintProto(res)
|
||||
},
|
||||
}
|
||||
|
||||
flags.AddQueryFlagsToCmd(cmd)
|
||||
|
||||
return cmd
|
||||
}
|
46
x/dao/client/cli/query_mint_requests_by_address.go
Normal file
46
x/dao/client/cli/query_mint_requests_by_address.go
Normal file
@ -0,0 +1,46 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/client/flags"
|
||||
"github.com/planetmint/planetmint-go/x/dao/types"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var _ = strconv.Itoa(0)
|
||||
|
||||
func CmdMintRequestsByAddress() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "mint-requests-by-address [address]",
|
||||
Short: "Query mint-requests-by-address",
|
||||
Args: cobra.ExactArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) (err error) {
|
||||
reqAddress := args[0]
|
||||
|
||||
clientCtx, err := client.GetClientQueryContext(cmd)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
queryClient := types.NewQueryClient(clientCtx)
|
||||
|
||||
params := &types.QueryMintRequestsByAddressRequest{
|
||||
|
||||
Address: reqAddress,
|
||||
}
|
||||
|
||||
res, err := queryClient.MintRequestsByAddress(cmd.Context(), params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return clientCtx.PrintProto(res)
|
||||
},
|
||||
}
|
||||
|
||||
flags.AddQueryFlagsToCmd(cmd)
|
||||
|
||||
return cmd
|
||||
}
|
@ -26,6 +26,7 @@ func GetTxCmd() *cobra.Command {
|
||||
}
|
||||
|
||||
cmd.AddCommand(CmdReissueRDDLProposal())
|
||||
cmd.AddCommand(CmdMintToken())
|
||||
// this line is used by starport scaffolding # 1
|
||||
|
||||
return cmd
|
||||
|
47
x/dao/client/cli/tx_mint_token.go
Normal file
47
x/dao/client/cli/tx_mint_token.go
Normal file
@ -0,0 +1,47 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
"encoding/json"
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/client/flags"
|
||||
"github.com/cosmos/cosmos-sdk/client/tx"
|
||||
"github.com/planetmint/planetmint-go/x/dao/types"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var _ = strconv.Itoa(0)
|
||||
|
||||
func CmdMintToken() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "mint-token [mint-request]",
|
||||
Short: "Broadcast message mint-token",
|
||||
Args: cobra.ExactArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) (err error) {
|
||||
argMintRequest := new(types.MintRequest)
|
||||
err = json.Unmarshal([]byte(args[0]), argMintRequest)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
clientCtx, err := client.GetClientTxContext(cmd)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
msg := types.NewMsgMintToken(
|
||||
clientCtx.GetFromAddress().String(),
|
||||
argMintRequest,
|
||||
)
|
||||
if err := msg.ValidateBasic(); err != nil {
|
||||
return err
|
||||
}
|
||||
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
|
||||
},
|
||||
}
|
||||
|
||||
flags.AddTxFlagsToCmd(cmd)
|
||||
|
||||
return cmd
|
||||
}
|
@ -18,11 +18,13 @@ import (
|
||||
|
||||
type (
|
||||
Keeper struct {
|
||||
cdc codec.BinaryCodec
|
||||
storeKey storetypes.StoreKey
|
||||
memKey storetypes.StoreKey
|
||||
challengeKey storetypes.StoreKey
|
||||
paramstore paramtypes.Subspace
|
||||
cdc codec.BinaryCodec
|
||||
storeKey storetypes.StoreKey
|
||||
memKey storetypes.StoreKey
|
||||
challengeKey storetypes.StoreKey
|
||||
mintRequestHashKey storetypes.StoreKey
|
||||
mintRequestAddressKey storetypes.StoreKey
|
||||
paramstore paramtypes.Subspace
|
||||
|
||||
bankKeeper types.BankKeeper
|
||||
accountKeeper types.AccountKeeper
|
||||
@ -34,6 +36,8 @@ func NewKeeper(
|
||||
storeKey,
|
||||
memKey storetypes.StoreKey,
|
||||
challengeKey storetypes.StoreKey,
|
||||
mintRequestHashKey storetypes.StoreKey,
|
||||
mintRequestAddressKey storetypes.StoreKey,
|
||||
ps paramtypes.Subspace,
|
||||
|
||||
bankKeeper types.BankKeeper,
|
||||
@ -45,11 +49,13 @@ func NewKeeper(
|
||||
}
|
||||
|
||||
return &Keeper{
|
||||
cdc: cdc,
|
||||
storeKey: storeKey,
|
||||
memKey: memKey,
|
||||
challengeKey: challengeKey,
|
||||
paramstore: ps,
|
||||
cdc: cdc,
|
||||
storeKey: storeKey,
|
||||
memKey: memKey,
|
||||
challengeKey: challengeKey,
|
||||
mintRequestHashKey: mintRequestHashKey,
|
||||
mintRequestAddressKey: mintRequestAddressKey,
|
||||
paramstore: ps,
|
||||
|
||||
bankKeeper: bankKeeper,
|
||||
accountKeeper: accountKeeper,
|
||||
|
45
x/dao/keeper/mint_request.go
Normal file
45
x/dao/keeper/mint_request.go
Normal file
@ -0,0 +1,45 @@
|
||||
package keeper
|
||||
|
||||
import (
|
||||
"github.com/cosmos/cosmos-sdk/store/prefix"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/planetmint/planetmint-go/x/dao/types"
|
||||
)
|
||||
|
||||
func (k Keeper) StoreMintRequest(ctx sdk.Context, mintRequest types.MintRequest) {
|
||||
hashStore := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.MintRequestHashKey))
|
||||
hashAppendValue := k.cdc.MustMarshal(&mintRequest)
|
||||
hashStore.Set(getMintRequestKeyBytes(mintRequest.LiquidTxHash), hashAppendValue)
|
||||
|
||||
addressStore := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.MintRequestAddressKey))
|
||||
mintRequests, _ := k.GetMintRequestsByAddress(ctx, mintRequest.Beneficiary)
|
||||
mintRequests.Requests = append(mintRequests.Requests, &mintRequest)
|
||||
addressAppendValue := k.cdc.MustMarshal(&mintRequests)
|
||||
addressStore.Set(getMintRequestKeyBytes(mintRequest.Beneficiary), addressAppendValue)
|
||||
|
||||
}
|
||||
|
||||
func (k Keeper) GetMintRequestsByAddress(ctx sdk.Context, address string) (val types.MintRequests, found bool) {
|
||||
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.MintRequestAddressKey))
|
||||
mintRequests := store.Get(getMintRequestKeyBytes(address))
|
||||
if mintRequests == nil {
|
||||
return val, false
|
||||
}
|
||||
k.cdc.MustUnmarshal(mintRequests, &val)
|
||||
return val, true
|
||||
}
|
||||
|
||||
func (k Keeper) GetMintRequestByHash(ctx sdk.Context, hash string) (val types.MintRequest, found bool) {
|
||||
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.MintRequestHashKey))
|
||||
mintRequest := store.Get(getMintRequestKeyBytes(hash))
|
||||
if mintRequest == nil {
|
||||
return val, false
|
||||
}
|
||||
k.cdc.MustUnmarshal(mintRequest, &val)
|
||||
return val, true
|
||||
}
|
||||
|
||||
func getMintRequestKeyBytes(key string) []byte {
|
||||
bz := []byte(key)
|
||||
return bz
|
||||
}
|
51
x/dao/keeper/mint_request_test.go
Normal file
51
x/dao/keeper/mint_request_test.go
Normal file
@ -0,0 +1,51 @@
|
||||
package keeper_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
keepertest "github.com/planetmint/planetmint-go/testutil/keeper"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/planetmint/planetmint-go/x/dao/keeper"
|
||||
"github.com/planetmint/planetmint-go/x/dao/types"
|
||||
)
|
||||
|
||||
func createNMintRequests(keeper *keeper.Keeper, ctx sdk.Context, beneficiary string, n int) []types.MintRequest {
|
||||
items := make([]types.MintRequest, n)
|
||||
for i := range items {
|
||||
items[i].Amount = uint64(i)
|
||||
items[i].LiquidTxHash = fmt.Sprintf("hash%v", i)
|
||||
items[i].Beneficiary = beneficiary
|
||||
keeper.StoreMintRequest(ctx, items[i])
|
||||
}
|
||||
return items
|
||||
}
|
||||
|
||||
func TestGetMintRequestByHash(t *testing.T) {
|
||||
keeper, ctx := keepertest.DaoKeeper(t)
|
||||
items := createNMintRequests(keeper, ctx, "beneficiary", 10)
|
||||
for _, item := range items {
|
||||
mintRequest, found := keeper.GetMintRequestByHash(ctx, item.LiquidTxHash)
|
||||
assert.True(t, found)
|
||||
assert.Equal(t, item, mintRequest)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetMintRequestByAddress(t *testing.T) {
|
||||
keeper, ctx := keepertest.DaoKeeper(t)
|
||||
items := createNMintRequests(keeper, ctx, "beneficiary", 10)
|
||||
mintRequests, found := keeper.GetMintRequestsByAddress(ctx, "beneficiary")
|
||||
assert.True(t, found)
|
||||
assert.Equal(t, items[0], *mintRequests.Requests[0])
|
||||
assert.Equal(t, items[1], *mintRequests.Requests[1])
|
||||
assert.Equal(t, items[2], *mintRequests.Requests[2])
|
||||
assert.Equal(t, items[3], *mintRequests.Requests[3])
|
||||
assert.Equal(t, items[4], *mintRequests.Requests[4])
|
||||
assert.Equal(t, items[5], *mintRequests.Requests[5])
|
||||
assert.Equal(t, items[6], *mintRequests.Requests[6])
|
||||
assert.Equal(t, items[7], *mintRequests.Requests[7])
|
||||
assert.Equal(t, items[8], *mintRequests.Requests[8])
|
||||
assert.Equal(t, items[9], *mintRequests.Requests[9])
|
||||
}
|
43
x/dao/keeper/msg_server_mint_token.go
Normal file
43
x/dao/keeper/msg_server_mint_token.go
Normal file
@ -0,0 +1,43 @@
|
||||
package keeper
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
errorsmod "cosmossdk.io/errors"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/planetmint/planetmint-go/config"
|
||||
"github.com/planetmint/planetmint-go/x/dao/types"
|
||||
)
|
||||
|
||||
func (k msgServer) MintToken(goCtx context.Context, msg *types.MsgMintToken) (*types.MsgMintTokenResponse, error) {
|
||||
ctx := sdk.UnwrapSDKContext(goCtx)
|
||||
cfg := config.GetConfig()
|
||||
|
||||
_, found := k.GetMintRequestByHash(ctx, msg.GetMintRequest().GetLiquidTxHash())
|
||||
if found {
|
||||
return nil, errorsmod.Wrapf(types.ErrAlreadyMinted, "liquid tx hash %s has already been minted", msg.GetMintRequest().GetLiquidTxHash())
|
||||
}
|
||||
|
||||
amt := msg.GetMintRequest().GetAmount()
|
||||
beneficiary := msg.GetMintRequest().GetBeneficiary()
|
||||
beneficiaryAddr, err := sdk.AccAddressFromBech32(beneficiary)
|
||||
if err != nil {
|
||||
return nil, errorsmod.Wrapf(types.ErrInvalidAddress, "for provided address %s", beneficiary)
|
||||
}
|
||||
|
||||
coin := sdk.NewCoin(cfg.TokenDenom, sdk.NewIntFromUint64(amt))
|
||||
coins := sdk.NewCoins(coin)
|
||||
err = k.bankKeeper.MintCoins(ctx, types.ModuleName, coins)
|
||||
if err != nil {
|
||||
return nil, errorsmod.Wrapf(types.ErrMintFailed, "error while minting %v token for address %s", amt, beneficiary)
|
||||
}
|
||||
|
||||
err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, beneficiaryAddr, coins)
|
||||
if err != nil {
|
||||
return nil, errorsmod.Wrapf(types.ErrTransferFailed, "error while transferring %v token to address %s", amt, beneficiary)
|
||||
}
|
||||
|
||||
k.StoreMintRequest(ctx, *msg.MintRequest)
|
||||
|
||||
return &types.MsgMintTokenResponse{}, nil
|
||||
}
|
@ -2,12 +2,15 @@ package keeper_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
keepertest "github.com/planetmint/planetmint-go/testutil/keeper"
|
||||
"github.com/planetmint/planetmint-go/testutil/sample"
|
||||
"github.com/planetmint/planetmint-go/x/dao/keeper"
|
||||
"github.com/planetmint/planetmint-go/x/dao/types"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
@ -21,3 +24,35 @@ func TestMsgServer(t *testing.T) {
|
||||
require.NotNil(t, ms)
|
||||
require.NotNil(t, ctx)
|
||||
}
|
||||
|
||||
func TestMsgServerMintToken(t *testing.T) {
|
||||
minter := sample.AccAddress()
|
||||
beneficiary := sample.ConstBech32Addr
|
||||
mintRequest := sample.MintRequest(beneficiary, 1000, "hash")
|
||||
|
||||
msg := types.NewMsgMintToken(minter, &mintRequest)
|
||||
msgServer, ctx := setupMsgServer(t)
|
||||
res, err := msgServer.MintToken(ctx, msg)
|
||||
if assert.NoError(t, err) {
|
||||
assert.Equal(t, &types.MsgMintTokenResponse{}, res)
|
||||
}
|
||||
|
||||
// should throw error because hash has already been used
|
||||
_, err = msgServer.MintToken(ctx, msg)
|
||||
if assert.Error(t, err) {
|
||||
assert.EqualError(t, err, fmt.Sprintf("liquid tx hash %s has already been minted: already minted", "hash"))
|
||||
}
|
||||
}
|
||||
|
||||
func TestMsgServerMintTokenInvalidAddress(t *testing.T) {
|
||||
minter := sample.AccAddress()
|
||||
beneficiary := "invalid address"
|
||||
mintRequest := sample.MintRequest(beneficiary, 1000, "hash")
|
||||
|
||||
msg := types.NewMsgMintToken(minter, &mintRequest)
|
||||
msgServer, ctx := setupMsgServer(t)
|
||||
_, err := msgServer.MintToken(ctx, msg)
|
||||
if assert.Error(t, err) {
|
||||
assert.EqualError(t, err, fmt.Sprintf("for provided address %s: invalid address", beneficiary))
|
||||
}
|
||||
}
|
||||
|
25
x/dao/keeper/query_get_mint_requests_by_hash.go
Normal file
25
x/dao/keeper/query_get_mint_requests_by_hash.go
Normal file
@ -0,0 +1,25 @@
|
||||
package keeper
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/planetmint/planetmint-go/x/dao/types"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
func (k Keeper) GetMintRequestsByHash(goCtx context.Context, req *types.QueryGetMintRequestsByHashRequest) (*types.QueryGetMintRequestsByHashResponse, error) {
|
||||
if req == nil {
|
||||
return nil, status.Error(codes.InvalidArgument, "invalid request")
|
||||
}
|
||||
|
||||
ctx := sdk.UnwrapSDKContext(goCtx)
|
||||
|
||||
mintRequest, found := k.GetMintRequestByHash(ctx, req.GetHash())
|
||||
if !found {
|
||||
return nil, status.Error(codes.NotFound, "mint request not found")
|
||||
}
|
||||
|
||||
return &types.QueryGetMintRequestsByHashResponse{MintRequest: &mintRequest}, nil
|
||||
}
|
46
x/dao/keeper/query_get_mint_requests_by_hash_test.go
Normal file
46
x/dao/keeper/query_get_mint_requests_by_hash_test.go
Normal file
@ -0,0 +1,46 @@
|
||||
package keeper_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
keepertest "github.com/planetmint/planetmint-go/testutil/keeper"
|
||||
"github.com/planetmint/planetmint-go/testutil/sample"
|
||||
"github.com/planetmint/planetmint-go/x/dao/types"
|
||||
"github.com/stretchr/testify/require"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
func TestQueryGetMintRequestByHash(t *testing.T) {
|
||||
keeper, ctx := keepertest.DaoKeeper(t)
|
||||
wctx := sdk.WrapSDKContext(ctx)
|
||||
items := createNMintRequests(keeper, ctx, sample.ConstBech32Addr, 1)
|
||||
|
||||
for _, tc := range []struct {
|
||||
desc string
|
||||
request *types.QueryGetMintRequestsByHashRequest
|
||||
response *types.QueryGetMintRequestsByHashResponse
|
||||
err error
|
||||
}{
|
||||
{
|
||||
desc: "mint request found",
|
||||
request: &types.QueryGetMintRequestsByHashRequest{Hash: "hash0"},
|
||||
response: &types.QueryGetMintRequestsByHashResponse{MintRequest: &items[0]},
|
||||
},
|
||||
{
|
||||
desc: "mint request not found",
|
||||
request: &types.QueryGetMintRequestsByHashRequest{Hash: "invalid hash"},
|
||||
err: status.Error(codes.NotFound, "mint request not found"),
|
||||
},
|
||||
} {
|
||||
t.Run(tc.desc, func(t *testing.T) {
|
||||
res, err := keeper.GetMintRequestsByHash(wctx, tc.request)
|
||||
if tc.err != nil {
|
||||
require.ErrorIs(t, err, tc.err)
|
||||
} else {
|
||||
require.Equal(t, tc.response, res)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
25
x/dao/keeper/query_mint_requests_by_address.go
Normal file
25
x/dao/keeper/query_mint_requests_by_address.go
Normal file
@ -0,0 +1,25 @@
|
||||
package keeper
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/planetmint/planetmint-go/x/dao/types"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
func (k Keeper) MintRequestsByAddress(goCtx context.Context, req *types.QueryMintRequestsByAddressRequest) (*types.QueryMintRequestsByAddressResponse, error) {
|
||||
if req == nil {
|
||||
return nil, status.Error(codes.InvalidArgument, "invalid request")
|
||||
}
|
||||
|
||||
ctx := sdk.UnwrapSDKContext(goCtx)
|
||||
|
||||
mintRequests, found := k.GetMintRequestsByAddress(ctx, req.GetAddress())
|
||||
if !found {
|
||||
return nil, status.Error(codes.NotFound, "mint requests not found")
|
||||
}
|
||||
|
||||
return &types.QueryMintRequestsByAddressResponse{MintRequests: &mintRequests}, nil
|
||||
}
|
51
x/dao/keeper/query_mint_requests_by_address_test.go
Normal file
51
x/dao/keeper/query_mint_requests_by_address_test.go
Normal file
@ -0,0 +1,51 @@
|
||||
package keeper_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
keepertest "github.com/planetmint/planetmint-go/testutil/keeper"
|
||||
"github.com/planetmint/planetmint-go/testutil/sample"
|
||||
"github.com/planetmint/planetmint-go/x/dao/types"
|
||||
"github.com/stretchr/testify/require"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
func TestQueryMintRequestByAddress(t *testing.T) {
|
||||
keeper, ctx := keepertest.DaoKeeper(t)
|
||||
wctx := sdk.WrapSDKContext(ctx)
|
||||
items := createNMintRequests(keeper, ctx, sample.ConstBech32Addr, 10)
|
||||
|
||||
var mintRequests types.MintRequests
|
||||
for i := range items {
|
||||
mintRequests.Requests = append(mintRequests.Requests, &items[i])
|
||||
}
|
||||
|
||||
for _, tc := range []struct {
|
||||
desc string
|
||||
request *types.QueryMintRequestsByAddressRequest
|
||||
response *types.QueryMintRequestsByAddressResponse
|
||||
err error
|
||||
}{
|
||||
{
|
||||
desc: "mint requests found",
|
||||
request: &types.QueryMintRequestsByAddressRequest{Address: sample.ConstBech32Addr},
|
||||
response: &types.QueryMintRequestsByAddressResponse{MintRequests: &mintRequests},
|
||||
},
|
||||
{
|
||||
desc: "mint requests not found",
|
||||
request: &types.QueryMintRequestsByAddressRequest{Address: "invalid hash"},
|
||||
err: status.Error(codes.NotFound, "mint requests not found"),
|
||||
},
|
||||
} {
|
||||
t.Run(tc.desc, func(t *testing.T) {
|
||||
res, err := keeper.MintRequestsByAddress(wctx, tc.request)
|
||||
if tc.err != nil {
|
||||
require.ErrorIs(t, err, tc.err)
|
||||
} else {
|
||||
require.Equal(t, tc.response, res)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
29
x/dao/simulation/mint_token.go
Normal file
29
x/dao/simulation/mint_token.go
Normal file
@ -0,0 +1,29 @@
|
||||
package simulation
|
||||
|
||||
import (
|
||||
"math/rand"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/baseapp"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
|
||||
"github.com/planetmint/planetmint-go/x/dao/keeper"
|
||||
"github.com/planetmint/planetmint-go/x/dao/types"
|
||||
)
|
||||
|
||||
func SimulateMsgMintToken(
|
||||
ak types.AccountKeeper,
|
||||
bk types.BankKeeper,
|
||||
k keeper.Keeper,
|
||||
) simtypes.Operation {
|
||||
return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string,
|
||||
) (simtypes.OperationMsg, []simtypes.FutureOperation, error) {
|
||||
simAccount, _ := simtypes.RandomAcc(r, accs)
|
||||
msg := &types.MsgMintToken{
|
||||
Creator: simAccount.Address.String(),
|
||||
}
|
||||
|
||||
// TODO: Handling the MintToken simulation
|
||||
|
||||
return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "MintToken simulation not implemented"), nil, nil
|
||||
}
|
||||
}
|
155
x/dao/testutil/expected_keepers_mocks.go
Normal file
155
x/dao/testutil/expected_keepers_mocks.go
Normal file
@ -0,0 +1,155 @@
|
||||
// Code generated by MockGen. DO NOT EDIT.
|
||||
// Source: x/dao/types/expected_keepers.go
|
||||
|
||||
// Package testutil is a generated GoMock package.
|
||||
package testutil
|
||||
|
||||
import (
|
||||
reflect "reflect"
|
||||
|
||||
types "github.com/cosmos/cosmos-sdk/types"
|
||||
types0 "github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||
gomock "github.com/golang/mock/gomock"
|
||||
)
|
||||
|
||||
// MockAccountKeeper is a mock of AccountKeeper interface.
|
||||
type MockAccountKeeper struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockAccountKeeperMockRecorder
|
||||
}
|
||||
|
||||
// MockAccountKeeperMockRecorder is the mock recorder for MockAccountKeeper.
|
||||
type MockAccountKeeperMockRecorder struct {
|
||||
mock *MockAccountKeeper
|
||||
}
|
||||
|
||||
// NewMockAccountKeeper creates a new mock instance.
|
||||
func NewMockAccountKeeper(ctrl *gomock.Controller) *MockAccountKeeper {
|
||||
mock := &MockAccountKeeper{ctrl: ctrl}
|
||||
mock.recorder = &MockAccountKeeperMockRecorder{mock}
|
||||
return mock
|
||||
}
|
||||
|
||||
// EXPECT returns an object that allows the caller to indicate expected use.
|
||||
func (m *MockAccountKeeper) EXPECT() *MockAccountKeeperMockRecorder {
|
||||
return m.recorder
|
||||
}
|
||||
|
||||
// GetAccount mocks base method.
|
||||
func (m *MockAccountKeeper) GetAccount(ctx types.Context, addr types.AccAddress) types0.AccountI {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "GetAccount", ctx, addr)
|
||||
ret0, _ := ret[0].(types0.AccountI)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// GetAccount indicates an expected call of GetAccount.
|
||||
func (mr *MockAccountKeeperMockRecorder) GetAccount(ctx, addr interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAccount", reflect.TypeOf((*MockAccountKeeper)(nil).GetAccount), ctx, addr)
|
||||
}
|
||||
|
||||
// GetModuleAddress mocks base method.
|
||||
func (m *MockAccountKeeper) GetModuleAddress(module string) types.AccAddress {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "GetModuleAddress", module)
|
||||
ret0, _ := ret[0].(types.AccAddress)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// GetModuleAddress indicates an expected call of GetModuleAddress.
|
||||
func (mr *MockAccountKeeperMockRecorder) GetModuleAddress(module interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetModuleAddress", reflect.TypeOf((*MockAccountKeeper)(nil).GetModuleAddress), module)
|
||||
}
|
||||
|
||||
// IterateAccounts mocks base method.
|
||||
func (m *MockAccountKeeper) IterateAccounts(arg0 types.Context, arg1 func(types0.AccountI) bool) {
|
||||
m.ctrl.T.Helper()
|
||||
m.ctrl.Call(m, "IterateAccounts", arg0, arg1)
|
||||
}
|
||||
|
||||
// IterateAccounts indicates an expected call of IterateAccounts.
|
||||
func (mr *MockAccountKeeperMockRecorder) IterateAccounts(arg0, arg1 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IterateAccounts", reflect.TypeOf((*MockAccountKeeper)(nil).IterateAccounts), arg0, arg1)
|
||||
}
|
||||
|
||||
// MockBankKeeper is a mock of BankKeeper interface.
|
||||
type MockBankKeeper struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockBankKeeperMockRecorder
|
||||
}
|
||||
|
||||
// MockBankKeeperMockRecorder is the mock recorder for MockBankKeeper.
|
||||
type MockBankKeeperMockRecorder struct {
|
||||
mock *MockBankKeeper
|
||||
}
|
||||
|
||||
// NewMockBankKeeper creates a new mock instance.
|
||||
func NewMockBankKeeper(ctrl *gomock.Controller) *MockBankKeeper {
|
||||
mock := &MockBankKeeper{ctrl: ctrl}
|
||||
mock.recorder = &MockBankKeeperMockRecorder{mock}
|
||||
return mock
|
||||
}
|
||||
|
||||
// EXPECT returns an object that allows the caller to indicate expected use.
|
||||
func (m *MockBankKeeper) EXPECT() *MockBankKeeperMockRecorder {
|
||||
return m.recorder
|
||||
}
|
||||
|
||||
// BlockedAddr mocks base method.
|
||||
func (m *MockBankKeeper) BlockedAddr(addr types.AccAddress) bool {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "BlockedAddr", addr)
|
||||
ret0, _ := ret[0].(bool)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// BlockedAddr indicates an expected call of BlockedAddr.
|
||||
func (mr *MockBankKeeperMockRecorder) BlockedAddr(addr interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BlockedAddr", reflect.TypeOf((*MockBankKeeper)(nil).BlockedAddr), addr)
|
||||
}
|
||||
|
||||
// MintCoins mocks base method.
|
||||
func (m *MockBankKeeper) MintCoins(ctx types.Context, moduleName string, amt types.Coins) error {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "MintCoins", ctx, moduleName, amt)
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// MintCoins indicates an expected call of MintCoins.
|
||||
func (mr *MockBankKeeperMockRecorder) MintCoins(ctx, moduleName, amt interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MintCoins", reflect.TypeOf((*MockBankKeeper)(nil).MintCoins), ctx, moduleName, amt)
|
||||
}
|
||||
|
||||
// SendCoinsFromModuleToAccount mocks base method.
|
||||
func (m *MockBankKeeper) SendCoinsFromModuleToAccount(ctx types.Context, senderModule string, recipientAddr types.AccAddress, amt types.Coins) error {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "SendCoinsFromModuleToAccount", ctx, senderModule, recipientAddr, amt)
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// SendCoinsFromModuleToAccount indicates an expected call of SendCoinsFromModuleToAccount.
|
||||
func (mr *MockBankKeeperMockRecorder) SendCoinsFromModuleToAccount(ctx, senderModule, recipientAddr, amt interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendCoinsFromModuleToAccount", reflect.TypeOf((*MockBankKeeper)(nil).SendCoinsFromModuleToAccount), ctx, senderModule, recipientAddr, amt)
|
||||
}
|
||||
|
||||
// SpendableCoins mocks base method.
|
||||
func (m *MockBankKeeper) SpendableCoins(ctx types.Context, addr types.AccAddress) types.Coins {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "SpendableCoins", ctx, addr)
|
||||
ret0, _ := ret[0].(types.Coins)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// SpendableCoins indicates an expected call of SpendableCoins.
|
||||
func (mr *MockBankKeeperMockRecorder) SpendableCoins(ctx, addr interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SpendableCoins", reflect.TypeOf((*MockBankKeeper)(nil).SpendableCoins), ctx, addr)
|
||||
}
|
@ -9,12 +9,14 @@ import (
|
||||
|
||||
func RegisterCodec(cdc *codec.LegacyAmino) {
|
||||
cdc.RegisterConcrete(&MsgReissueRDDLProposal{}, "dao/ReissueRDDLProposal", nil)
|
||||
cdc.RegisterConcrete(&MsgMintToken{}, "dao/MintToken", nil)
|
||||
// this line is used by starport scaffolding # 2
|
||||
}
|
||||
|
||||
func RegisterInterfaces(registry cdctypes.InterfaceRegistry) {
|
||||
registry.RegisterImplementations((*sdk.Msg)(nil),
|
||||
&MsgReissueRDDLProposal{},
|
||||
&MsgMintToken{},
|
||||
)
|
||||
// this line is used by starport scaffolding # 3
|
||||
|
||||
|
@ -8,5 +8,9 @@ import (
|
||||
|
||||
// x/dao module sentinel errors
|
||||
var (
|
||||
ErrSample = errorsmod.Register(ModuleName, 1100, "sample error")
|
||||
ErrInvalidMintAddress = errorsmod.Register(ModuleName, 2, "invalid mint address")
|
||||
ErrMintFailed = errorsmod.Register(ModuleName, 3, "minting failed")
|
||||
ErrTransferFailed = errorsmod.Register(ModuleName, 4, "transfer failed")
|
||||
ErrInvalidAddress = errorsmod.Register(ModuleName, 5, "invalid address")
|
||||
ErrAlreadyMinted = errorsmod.Register(ModuleName, 6, "already minted")
|
||||
)
|
||||
|
@ -14,6 +14,10 @@ const (
|
||||
MemStoreKey = "mem_dao"
|
||||
|
||||
ChallengeKey = "Dao/Challenge"
|
||||
|
||||
MintRequestAddressKey = "Dao/MintRequestAddress"
|
||||
|
||||
MintRequestHashKey = "Dao/MintRequestHash"
|
||||
)
|
||||
|
||||
func KeyPrefix(p string) []byte {
|
||||
|
47
x/dao/types/message_mint_token.go
Normal file
47
x/dao/types/message_mint_token.go
Normal file
@ -0,0 +1,47 @@
|
||||
package types
|
||||
|
||||
import (
|
||||
errorsmod "cosmossdk.io/errors"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||
)
|
||||
|
||||
const TypeMsgMintToken = "mint_token"
|
||||
|
||||
var _ sdk.Msg = &MsgMintToken{}
|
||||
|
||||
func NewMsgMintToken(creator string, mintRequest *MintRequest) *MsgMintToken {
|
||||
return &MsgMintToken{
|
||||
Creator: creator,
|
||||
MintRequest: mintRequest,
|
||||
}
|
||||
}
|
||||
|
||||
func (msg *MsgMintToken) Route() string {
|
||||
return RouterKey
|
||||
}
|
||||
|
||||
func (msg *MsgMintToken) Type() string {
|
||||
return TypeMsgMintToken
|
||||
}
|
||||
|
||||
func (msg *MsgMintToken) GetSigners() []sdk.AccAddress {
|
||||
creator, err := sdk.AccAddressFromBech32(msg.Creator)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return []sdk.AccAddress{creator}
|
||||
}
|
||||
|
||||
func (msg *MsgMintToken) GetSignBytes() []byte {
|
||||
bz := ModuleCdc.MustMarshalJSON(msg)
|
||||
return sdk.MustSortJSON(bz)
|
||||
}
|
||||
|
||||
func (msg *MsgMintToken) ValidateBasic() error {
|
||||
_, err := sdk.AccAddressFromBech32(msg.Creator)
|
||||
if err != nil {
|
||||
return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err)
|
||||
}
|
||||
return nil
|
||||
}
|
34
x/dao/types/message_mint_token_test.go
Normal file
34
x/dao/types/message_mint_token_test.go
Normal file
@ -0,0 +1,34 @@
|
||||
package types
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestMsgMintToken_ValidateBasic(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
msg MsgMintToken
|
||||
err error
|
||||
}{
|
||||
{
|
||||
name: "invalid address",
|
||||
msg: MsgMintToken{
|
||||
Creator: "invalid_address",
|
||||
},
|
||||
err: sdkerrors.ErrInvalidAddress,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
err := tt.msg.ValidateBasic()
|
||||
if tt.err != nil {
|
||||
require.ErrorIs(t, err, tt.err)
|
||||
return
|
||||
}
|
||||
require.NoError(t, err)
|
||||
})
|
||||
}
|
||||
}
|
405
x/dao/types/mint_request.pb.go
Normal file
405
x/dao/types/mint_request.pb.go
Normal file
@ -0,0 +1,405 @@
|
||||
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||
// source: planetmintgo/dao/mint_request.proto
|
||||
|
||||
package types
|
||||
|
||||
import (
|
||||
fmt "fmt"
|
||||
proto "github.com/cosmos/gogoproto/proto"
|
||||
io "io"
|
||||
math "math"
|
||||
math_bits "math/bits"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
|
||||
|
||||
type MintRequest struct {
|
||||
Beneficiary string `protobuf:"bytes,1,opt,name=beneficiary,proto3" json:"beneficiary,omitempty"`
|
||||
Amount uint64 `protobuf:"varint,2,opt,name=amount,proto3" json:"amount,omitempty"`
|
||||
LiquidTxHash string `protobuf:"bytes,3,opt,name=liquidTxHash,proto3" json:"liquidTxHash,omitempty"`
|
||||
}
|
||||
|
||||
func (m *MintRequest) Reset() { *m = MintRequest{} }
|
||||
func (m *MintRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*MintRequest) ProtoMessage() {}
|
||||
func (*MintRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_dc5c152bf52708dc, []int{0}
|
||||
}
|
||||
func (m *MintRequest) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *MintRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_MintRequest.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 *MintRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_MintRequest.Merge(m, src)
|
||||
}
|
||||
func (m *MintRequest) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *MintRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_MintRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_MintRequest proto.InternalMessageInfo
|
||||
|
||||
func (m *MintRequest) GetBeneficiary() string {
|
||||
if m != nil {
|
||||
return m.Beneficiary
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *MintRequest) GetAmount() uint64 {
|
||||
if m != nil {
|
||||
return m.Amount
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *MintRequest) GetLiquidTxHash() string {
|
||||
if m != nil {
|
||||
return m.LiquidTxHash
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*MintRequest)(nil), "planetmintgo.dao.MintRequest")
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("planetmintgo/dao/mint_request.proto", fileDescriptor_dc5c152bf52708dc)
|
||||
}
|
||||
|
||||
var fileDescriptor_dc5c152bf52708dc = []byte{
|
||||
// 205 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x2e, 0xc8, 0x49, 0xcc,
|
||||
0x4b, 0x2d, 0xc9, 0xcd, 0xcc, 0x2b, 0x49, 0xcf, 0xd7, 0x4f, 0x49, 0xcc, 0xd7, 0x07, 0x31, 0xe3,
|
||||
0x8b, 0x52, 0x0b, 0x4b, 0x53, 0x8b, 0x4b, 0xf4, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, 0x85, 0x04, 0x90,
|
||||
0x15, 0xe9, 0xa5, 0x24, 0xe6, 0x2b, 0x65, 0x73, 0x71, 0xfb, 0x66, 0xe6, 0x95, 0x04, 0x41, 0x94,
|
||||
0x09, 0x29, 0x70, 0x71, 0x27, 0xa5, 0xe6, 0xa5, 0xa6, 0x65, 0x26, 0x67, 0x26, 0x16, 0x55, 0x4a,
|
||||
0x30, 0x2a, 0x30, 0x6a, 0x70, 0x06, 0x21, 0x0b, 0x09, 0x89, 0x71, 0xb1, 0x25, 0xe6, 0xe6, 0x97,
|
||||
0xe6, 0x95, 0x48, 0x30, 0x29, 0x30, 0x6a, 0xb0, 0x04, 0x41, 0x79, 0x42, 0x4a, 0x5c, 0x3c, 0x39,
|
||||
0x99, 0x85, 0xa5, 0x99, 0x29, 0x21, 0x15, 0x1e, 0x89, 0xc5, 0x19, 0x12, 0xcc, 0x60, 0xad, 0x28,
|
||||
0x62, 0x4e, 0x9e, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3,
|
||||
0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, 0xdc, 0x78, 0x2c, 0xc7, 0x10, 0xa5, 0x9f, 0x9e,
|
||||
0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, 0x8f, 0x70, 0x23, 0x12, 0x53, 0x37, 0x3d,
|
||||
0x5f, 0xbf, 0x02, 0xec, 0xad, 0x92, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, 0xb0, 0x87, 0x8c, 0x01,
|
||||
0x01, 0x00, 0x00, 0xff, 0xff, 0xca, 0x8a, 0xc6, 0x1d, 0xf7, 0x00, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (m *MintRequest) 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 *MintRequest) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *MintRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.LiquidTxHash) > 0 {
|
||||
i -= len(m.LiquidTxHash)
|
||||
copy(dAtA[i:], m.LiquidTxHash)
|
||||
i = encodeVarintMintRequest(dAtA, i, uint64(len(m.LiquidTxHash)))
|
||||
i--
|
||||
dAtA[i] = 0x1a
|
||||
}
|
||||
if m.Amount != 0 {
|
||||
i = encodeVarintMintRequest(dAtA, i, uint64(m.Amount))
|
||||
i--
|
||||
dAtA[i] = 0x10
|
||||
}
|
||||
if len(m.Beneficiary) > 0 {
|
||||
i -= len(m.Beneficiary)
|
||||
copy(dAtA[i:], m.Beneficiary)
|
||||
i = encodeVarintMintRequest(dAtA, i, uint64(len(m.Beneficiary)))
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func encodeVarintMintRequest(dAtA []byte, offset int, v uint64) int {
|
||||
offset -= sovMintRequest(v)
|
||||
base := offset
|
||||
for v >= 1<<7 {
|
||||
dAtA[offset] = uint8(v&0x7f | 0x80)
|
||||
v >>= 7
|
||||
offset++
|
||||
}
|
||||
dAtA[offset] = uint8(v)
|
||||
return base
|
||||
}
|
||||
func (m *MintRequest) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
l = len(m.Beneficiary)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovMintRequest(uint64(l))
|
||||
}
|
||||
if m.Amount != 0 {
|
||||
n += 1 + sovMintRequest(uint64(m.Amount))
|
||||
}
|
||||
l = len(m.LiquidTxHash)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovMintRequest(uint64(l))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func sovMintRequest(x uint64) (n int) {
|
||||
return (math_bits.Len64(x|1) + 6) / 7
|
||||
}
|
||||
func sozMintRequest(x uint64) (n int) {
|
||||
return sovMintRequest(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
||||
}
|
||||
func (m *MintRequest) 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 ErrIntOverflowMintRequest
|
||||
}
|
||||
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: MintRequest: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: MintRequest: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Beneficiary", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowMintRequest
|
||||
}
|
||||
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 ErrInvalidLengthMintRequest
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthMintRequest
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Beneficiary = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType)
|
||||
}
|
||||
m.Amount = 0
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowMintRequest
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
m.Amount |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
case 3:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field LiquidTxHash", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowMintRequest
|
||||
}
|
||||
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 ErrInvalidLengthMintRequest
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthMintRequest
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.LiquidTxHash = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipMintRequest(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||
return ErrInvalidLengthMintRequest
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func skipMintRequest(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, ErrIntOverflowMintRequest
|
||||
}
|
||||
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, ErrIntOverflowMintRequest
|
||||
}
|
||||
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, ErrIntOverflowMintRequest
|
||||
}
|
||||
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, ErrInvalidLengthMintRequest
|
||||
}
|
||||
iNdEx += length
|
||||
case 3:
|
||||
depth++
|
||||
case 4:
|
||||
if depth == 0 {
|
||||
return 0, ErrUnexpectedEndOfGroupMintRequest
|
||||
}
|
||||
depth--
|
||||
case 5:
|
||||
iNdEx += 4
|
||||
default:
|
||||
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
|
||||
}
|
||||
if iNdEx < 0 {
|
||||
return 0, ErrInvalidLengthMintRequest
|
||||
}
|
||||
if depth == 0 {
|
||||
return iNdEx, nil
|
||||
}
|
||||
}
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
|
||||
var (
|
||||
ErrInvalidLengthMintRequest = fmt.Errorf("proto: negative length found during unmarshaling")
|
||||
ErrIntOverflowMintRequest = fmt.Errorf("proto: integer overflow")
|
||||
ErrUnexpectedEndOfGroupMintRequest = fmt.Errorf("proto: unexpected end of group")
|
||||
)
|
328
x/dao/types/mint_requests.pb.go
Normal file
328
x/dao/types/mint_requests.pb.go
Normal file
@ -0,0 +1,328 @@
|
||||
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||
// source: planetmintgo/dao/mint_requests.proto
|
||||
|
||||
package types
|
||||
|
||||
import (
|
||||
fmt "fmt"
|
||||
proto "github.com/cosmos/gogoproto/proto"
|
||||
io "io"
|
||||
math "math"
|
||||
math_bits "math/bits"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
|
||||
|
||||
type MintRequests struct {
|
||||
Requests []*MintRequest `protobuf:"bytes,1,rep,name=Requests,proto3" json:"Requests,omitempty"`
|
||||
}
|
||||
|
||||
func (m *MintRequests) Reset() { *m = MintRequests{} }
|
||||
func (m *MintRequests) String() string { return proto.CompactTextString(m) }
|
||||
func (*MintRequests) ProtoMessage() {}
|
||||
func (*MintRequests) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_d28f1f28907eeede, []int{0}
|
||||
}
|
||||
func (m *MintRequests) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *MintRequests) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_MintRequests.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 *MintRequests) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_MintRequests.Merge(m, src)
|
||||
}
|
||||
func (m *MintRequests) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *MintRequests) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_MintRequests.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_MintRequests proto.InternalMessageInfo
|
||||
|
||||
func (m *MintRequests) GetRequests() []*MintRequest {
|
||||
if m != nil {
|
||||
return m.Requests
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*MintRequests)(nil), "planetmintgo.dao.MintRequests")
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("planetmintgo/dao/mint_requests.proto", fileDescriptor_d28f1f28907eeede)
|
||||
}
|
||||
|
||||
var fileDescriptor_d28f1f28907eeede = []byte{
|
||||
// 170 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x29, 0xc8, 0x49, 0xcc,
|
||||
0x4b, 0x2d, 0xc9, 0xcd, 0xcc, 0x2b, 0x49, 0xcf, 0xd7, 0x4f, 0x49, 0xcc, 0xd7, 0x07, 0x31, 0xe3,
|
||||
0x8b, 0x52, 0x0b, 0x4b, 0x53, 0x8b, 0x4b, 0x8a, 0xf5, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, 0x85, 0x04,
|
||||
0x90, 0x55, 0xe9, 0xa5, 0x24, 0xe6, 0x4b, 0x29, 0xe3, 0xd5, 0x07, 0xd1, 0xa6, 0xe4, 0xc9, 0xc5,
|
||||
0xe3, 0x9b, 0x99, 0x57, 0x12, 0x04, 0x35, 0x4c, 0xc8, 0x92, 0x8b, 0x03, 0xc6, 0x96, 0x60, 0x54,
|
||||
0x60, 0xd6, 0xe0, 0x36, 0x92, 0xd5, 0x43, 0x37, 0x59, 0x0f, 0x49, 0x47, 0x10, 0x5c, 0xb9, 0x93,
|
||||
0xe7, 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, 0xa7, 0x67, 0x96, 0x64,
|
||||
0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0x23, 0x0c, 0x43, 0x62, 0xea, 0xa6, 0xe7, 0xeb, 0x57,
|
||||
0x80, 0x9d, 0x58, 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0x76, 0x9c, 0x31, 0x20, 0x00, 0x00,
|
||||
0xff, 0xff, 0xa8, 0xa9, 0x35, 0x0f, 0xfb, 0x00, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (m *MintRequests) 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 *MintRequests) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *MintRequests) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.Requests) > 0 {
|
||||
for iNdEx := len(m.Requests) - 1; iNdEx >= 0; iNdEx-- {
|
||||
{
|
||||
size, err := m.Requests[iNdEx].MarshalToSizedBuffer(dAtA[:i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i -= size
|
||||
i = encodeVarintMintRequests(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func encodeVarintMintRequests(dAtA []byte, offset int, v uint64) int {
|
||||
offset -= sovMintRequests(v)
|
||||
base := offset
|
||||
for v >= 1<<7 {
|
||||
dAtA[offset] = uint8(v&0x7f | 0x80)
|
||||
v >>= 7
|
||||
offset++
|
||||
}
|
||||
dAtA[offset] = uint8(v)
|
||||
return base
|
||||
}
|
||||
func (m *MintRequests) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.Requests) > 0 {
|
||||
for _, e := range m.Requests {
|
||||
l = e.Size()
|
||||
n += 1 + l + sovMintRequests(uint64(l))
|
||||
}
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func sovMintRequests(x uint64) (n int) {
|
||||
return (math_bits.Len64(x|1) + 6) / 7
|
||||
}
|
||||
func sozMintRequests(x uint64) (n int) {
|
||||
return sovMintRequests(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
||||
}
|
||||
func (m *MintRequests) 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 ErrIntOverflowMintRequests
|
||||
}
|
||||
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: MintRequests: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: MintRequests: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Requests", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowMintRequests
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthMintRequests
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthMintRequests
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Requests = append(m.Requests, &MintRequest{})
|
||||
if err := m.Requests[len(m.Requests)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipMintRequests(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||
return ErrInvalidLengthMintRequests
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func skipMintRequests(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, ErrIntOverflowMintRequests
|
||||
}
|
||||
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, ErrIntOverflowMintRequests
|
||||
}
|
||||
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, ErrIntOverflowMintRequests
|
||||
}
|
||||
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, ErrInvalidLengthMintRequests
|
||||
}
|
||||
iNdEx += length
|
||||
case 3:
|
||||
depth++
|
||||
case 4:
|
||||
if depth == 0 {
|
||||
return 0, ErrUnexpectedEndOfGroupMintRequests
|
||||
}
|
||||
depth--
|
||||
case 5:
|
||||
iNdEx += 4
|
||||
default:
|
||||
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
|
||||
}
|
||||
if iNdEx < 0 {
|
||||
return 0, ErrInvalidLengthMintRequests
|
||||
}
|
||||
if depth == 0 {
|
||||
return iNdEx, nil
|
||||
}
|
||||
}
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
|
||||
var (
|
||||
ErrInvalidLengthMintRequests = fmt.Errorf("proto: negative length found during unmarshaling")
|
||||
ErrIntOverflowMintRequests = fmt.Errorf("proto: integer overflow")
|
||||
ErrUnexpectedEndOfGroupMintRequests = fmt.Errorf("proto: unexpected end of group")
|
||||
)
|
@ -113,34 +113,227 @@ func (m *QueryParamsResponse) GetParams() Params {
|
||||
return Params{}
|
||||
}
|
||||
|
||||
type QueryGetMintRequestsByHashRequest struct {
|
||||
Hash string `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"`
|
||||
}
|
||||
|
||||
func (m *QueryGetMintRequestsByHashRequest) Reset() { *m = QueryGetMintRequestsByHashRequest{} }
|
||||
func (m *QueryGetMintRequestsByHashRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*QueryGetMintRequestsByHashRequest) ProtoMessage() {}
|
||||
func (*QueryGetMintRequestsByHashRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_07bad0eeb5b27724, []int{2}
|
||||
}
|
||||
func (m *QueryGetMintRequestsByHashRequest) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *QueryGetMintRequestsByHashRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_QueryGetMintRequestsByHashRequest.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 *QueryGetMintRequestsByHashRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_QueryGetMintRequestsByHashRequest.Merge(m, src)
|
||||
}
|
||||
func (m *QueryGetMintRequestsByHashRequest) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *QueryGetMintRequestsByHashRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_QueryGetMintRequestsByHashRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_QueryGetMintRequestsByHashRequest proto.InternalMessageInfo
|
||||
|
||||
func (m *QueryGetMintRequestsByHashRequest) GetHash() string {
|
||||
if m != nil {
|
||||
return m.Hash
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type QueryGetMintRequestsByHashResponse struct {
|
||||
MintRequest *MintRequest `protobuf:"bytes,1,opt,name=mintRequest,proto3" json:"mintRequest,omitempty"`
|
||||
}
|
||||
|
||||
func (m *QueryGetMintRequestsByHashResponse) Reset() { *m = QueryGetMintRequestsByHashResponse{} }
|
||||
func (m *QueryGetMintRequestsByHashResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*QueryGetMintRequestsByHashResponse) ProtoMessage() {}
|
||||
func (*QueryGetMintRequestsByHashResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_07bad0eeb5b27724, []int{3}
|
||||
}
|
||||
func (m *QueryGetMintRequestsByHashResponse) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *QueryGetMintRequestsByHashResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_QueryGetMintRequestsByHashResponse.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 *QueryGetMintRequestsByHashResponse) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_QueryGetMintRequestsByHashResponse.Merge(m, src)
|
||||
}
|
||||
func (m *QueryGetMintRequestsByHashResponse) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *QueryGetMintRequestsByHashResponse) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_QueryGetMintRequestsByHashResponse.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_QueryGetMintRequestsByHashResponse proto.InternalMessageInfo
|
||||
|
||||
func (m *QueryGetMintRequestsByHashResponse) GetMintRequest() *MintRequest {
|
||||
if m != nil {
|
||||
return m.MintRequest
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type QueryMintRequestsByAddressRequest struct {
|
||||
Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
|
||||
}
|
||||
|
||||
func (m *QueryMintRequestsByAddressRequest) Reset() { *m = QueryMintRequestsByAddressRequest{} }
|
||||
func (m *QueryMintRequestsByAddressRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*QueryMintRequestsByAddressRequest) ProtoMessage() {}
|
||||
func (*QueryMintRequestsByAddressRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_07bad0eeb5b27724, []int{4}
|
||||
}
|
||||
func (m *QueryMintRequestsByAddressRequest) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *QueryMintRequestsByAddressRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_QueryMintRequestsByAddressRequest.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 *QueryMintRequestsByAddressRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_QueryMintRequestsByAddressRequest.Merge(m, src)
|
||||
}
|
||||
func (m *QueryMintRequestsByAddressRequest) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *QueryMintRequestsByAddressRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_QueryMintRequestsByAddressRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_QueryMintRequestsByAddressRequest proto.InternalMessageInfo
|
||||
|
||||
func (m *QueryMintRequestsByAddressRequest) GetAddress() string {
|
||||
if m != nil {
|
||||
return m.Address
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type QueryMintRequestsByAddressResponse struct {
|
||||
MintRequests *MintRequests `protobuf:"bytes,1,opt,name=mintRequests,proto3" json:"mintRequests,omitempty"`
|
||||
}
|
||||
|
||||
func (m *QueryMintRequestsByAddressResponse) Reset() { *m = QueryMintRequestsByAddressResponse{} }
|
||||
func (m *QueryMintRequestsByAddressResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*QueryMintRequestsByAddressResponse) ProtoMessage() {}
|
||||
func (*QueryMintRequestsByAddressResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_07bad0eeb5b27724, []int{5}
|
||||
}
|
||||
func (m *QueryMintRequestsByAddressResponse) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *QueryMintRequestsByAddressResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_QueryMintRequestsByAddressResponse.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 *QueryMintRequestsByAddressResponse) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_QueryMintRequestsByAddressResponse.Merge(m, src)
|
||||
}
|
||||
func (m *QueryMintRequestsByAddressResponse) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *QueryMintRequestsByAddressResponse) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_QueryMintRequestsByAddressResponse.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_QueryMintRequestsByAddressResponse proto.InternalMessageInfo
|
||||
|
||||
func (m *QueryMintRequestsByAddressResponse) GetMintRequests() *MintRequests {
|
||||
if m != nil {
|
||||
return m.MintRequests
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*QueryParamsRequest)(nil), "planetmintgo.dao.QueryParamsRequest")
|
||||
proto.RegisterType((*QueryParamsResponse)(nil), "planetmintgo.dao.QueryParamsResponse")
|
||||
proto.RegisterType((*QueryGetMintRequestsByHashRequest)(nil), "planetmintgo.dao.QueryGetMintRequestsByHashRequest")
|
||||
proto.RegisterType((*QueryGetMintRequestsByHashResponse)(nil), "planetmintgo.dao.QueryGetMintRequestsByHashResponse")
|
||||
proto.RegisterType((*QueryMintRequestsByAddressRequest)(nil), "planetmintgo.dao.QueryMintRequestsByAddressRequest")
|
||||
proto.RegisterType((*QueryMintRequestsByAddressResponse)(nil), "planetmintgo.dao.QueryMintRequestsByAddressResponse")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("planetmintgo/dao/query.proto", fileDescriptor_07bad0eeb5b27724) }
|
||||
|
||||
var fileDescriptor_07bad0eeb5b27724 = []byte{
|
||||
// 301 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x90, 0x31, 0x4b, 0x03, 0x31,
|
||||
0x14, 0xc7, 0x2f, 0xa2, 0x1d, 0xe2, 0x22, 0xb1, 0x43, 0x29, 0x35, 0xca, 0xa1, 0x20, 0x82, 0x17,
|
||||
0xae, 0x82, 0xee, 0xdd, 0x1c, 0x04, 0xed, 0xe8, 0x96, 0x6b, 0x43, 0x3c, 0xe8, 0xe5, 0xa5, 0x97,
|
||||
0x9c, 0xd8, 0xd5, 0x0f, 0x20, 0x82, 0x8b, 0x1f, 0xa9, 0x63, 0xc1, 0xc5, 0x49, 0xe4, 0xce, 0x0f,
|
||||
0x22, 0x4d, 0x0e, 0x6c, 0xbd, 0x41, 0xb7, 0xf0, 0xde, 0xef, 0xff, 0xe3, 0x9f, 0x87, 0x7b, 0x7a,
|
||||
0xc2, 0x95, 0xb0, 0x59, 0xaa, 0xac, 0x04, 0x36, 0xe6, 0xc0, 0xa6, 0x85, 0xc8, 0x67, 0x91, 0xce,
|
||||
0xc1, 0x02, 0xd9, 0x59, 0xdd, 0x46, 0x63, 0x0e, 0xdd, 0xb6, 0x04, 0x09, 0x6e, 0xc9, 0x96, 0x2f,
|
||||
0xcf, 0x75, 0x7b, 0x12, 0x40, 0x4e, 0x04, 0xe3, 0x3a, 0x65, 0x5c, 0x29, 0xb0, 0xdc, 0xa6, 0xa0,
|
||||
0x4c, 0xbd, 0x3d, 0x19, 0x81, 0xc9, 0xc0, 0xb0, 0x84, 0x1b, 0xe1, 0xf5, 0xec, 0x3e, 0x4e, 0x84,
|
||||
0xe5, 0x31, 0xd3, 0x5c, 0xa6, 0xca, 0xc1, 0x35, 0xbb, 0xd7, 0xe8, 0xa3, 0x79, 0xce, 0xb3, 0x5a,
|
||||
0x15, 0xb6, 0x31, 0xb9, 0x59, 0x0a, 0xae, 0xdd, 0x70, 0x28, 0xa6, 0x85, 0x30, 0x36, 0xbc, 0xc2,
|
||||
0xbb, 0x6b, 0x53, 0xa3, 0x41, 0x19, 0x41, 0xce, 0x71, 0xcb, 0x87, 0x3b, 0xe8, 0x00, 0x1d, 0x6f,
|
||||
0xf7, 0x3b, 0xd1, 0xef, 0xef, 0x44, 0x3e, 0x31, 0xd8, 0x9c, 0x7f, 0xec, 0x07, 0xc3, 0x9a, 0xee,
|
||||
0xbf, 0x22, 0xbc, 0xe5, 0x7c, 0xe4, 0x09, 0xe1, 0x96, 0x47, 0xc8, 0x61, 0x33, 0xdc, 0x6c, 0xd2,
|
||||
0x3d, 0xfa, 0x83, 0xf2, 0xcd, 0xc2, 0x8b, 0xc7, 0xb7, 0xaf, 0x97, 0x8d, 0x98, 0x30, 0x26, 0x53,
|
||||
0x7b, 0x57, 0x24, 0xd1, 0x08, 0x32, 0xf6, 0x93, 0x5c, 0x79, 0x9e, 0xae, 0x5d, 0x61, 0x70, 0x39,
|
||||
0x2f, 0x29, 0x5a, 0x94, 0x14, 0x7d, 0x96, 0x14, 0x3d, 0x57, 0x34, 0x58, 0x54, 0x34, 0x78, 0xaf,
|
||||
0x68, 0x70, 0xfb, 0x2f, 0xd3, 0x83, 0x73, 0xd9, 0x99, 0x16, 0x26, 0x69, 0xb9, 0x8b, 0x9e, 0x7d,
|
||||
0x07, 0x00, 0x00, 0xff, 0xff, 0x20, 0xd5, 0xef, 0x17, 0x02, 0x02, 0x00, 0x00,
|
||||
// 508 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0xcf, 0x6b, 0xd4, 0x40,
|
||||
0x14, 0xc7, 0x37, 0xb2, 0xae, 0x38, 0xf5, 0x20, 0x63, 0x0b, 0xcb, 0xd2, 0x46, 0x1d, 0x2b, 0x88,
|
||||
0x60, 0x86, 0x6d, 0xc5, 0x9e, 0xd4, 0x9a, 0x83, 0xd6, 0x43, 0x41, 0x73, 0xf4, 0xb2, 0x4c, 0xba,
|
||||
0x43, 0x12, 0x68, 0x66, 0xd2, 0xcc, 0xac, 0xb8, 0x94, 0x5e, 0xfc, 0x03, 0x44, 0xf0, 0x5f, 0xf1,
|
||||
0x8f, 0x28, 0xe2, 0xa1, 0xe0, 0xc5, 0x93, 0xc8, 0xae, 0x7f, 0x88, 0x64, 0xe6, 0x2d, 0x4d, 0x4c,
|
||||
0x77, 0xd4, 0xcb, 0xf2, 0x92, 0xf7, 0xde, 0xf7, 0x7d, 0xde, 0x8f, 0x0d, 0x5a, 0x2f, 0x0e, 0x99,
|
||||
0xe0, 0x3a, 0xcf, 0x84, 0x4e, 0x24, 0x1d, 0x33, 0x49, 0x8f, 0x26, 0xbc, 0x9c, 0x06, 0x45, 0x29,
|
||||
0xb5, 0xc4, 0xd7, 0xeb, 0xde, 0x60, 0xcc, 0xe4, 0x60, 0x35, 0x91, 0x89, 0x34, 0x4e, 0x5a, 0x59,
|
||||
0x36, 0x6e, 0xb0, 0x9e, 0x48, 0x99, 0x1c, 0x72, 0xca, 0x8a, 0x8c, 0x32, 0x21, 0xa4, 0x66, 0x3a,
|
||||
0x93, 0x42, 0x81, 0xf7, 0xfe, 0x81, 0x54, 0xb9, 0x54, 0x34, 0x66, 0x8a, 0x5b, 0x79, 0xfa, 0x76,
|
||||
0x18, 0x73, 0xcd, 0x86, 0xb4, 0x60, 0x49, 0x26, 0x4c, 0x30, 0xc4, 0x6e, 0xb4, 0x78, 0x0a, 0x56,
|
||||
0xb2, 0x7c, 0x21, 0x75, 0xa7, 0xe5, 0xae, 0xcc, 0x51, 0xc9, 0x8f, 0x26, 0x5c, 0x69, 0x08, 0xda,
|
||||
0x74, 0x06, 0x81, 0x14, 0x59, 0x45, 0xf8, 0x75, 0xc5, 0xf2, 0xca, 0xe8, 0x47, 0xd6, 0x49, 0xf6,
|
||||
0xd1, 0x8d, 0xc6, 0x5b, 0x55, 0x48, 0xa1, 0x38, 0x7e, 0x84, 0x7a, 0x96, 0xa3, 0xef, 0xdd, 0xf2,
|
||||
0xee, 0xad, 0x6c, 0xf5, 0x83, 0x3f, 0x27, 0x13, 0xd8, 0x8c, 0xb0, 0x7b, 0xfa, 0xe3, 0x66, 0x27,
|
||||
0x82, 0x68, 0xb2, 0x83, 0x6e, 0x1b, 0xb9, 0x17, 0x5c, 0xef, 0x67, 0x42, 0x43, 0x15, 0x15, 0x4e,
|
||||
0xf7, 0x98, 0x4a, 0xe1, 0x09, 0x63, 0xd4, 0x4d, 0x99, 0x4a, 0x8d, 0xf4, 0xd5, 0xc8, 0xd8, 0x84,
|
||||
0x23, 0xe2, 0x4a, 0x04, 0xac, 0xa7, 0x68, 0x25, 0x3f, 0xf7, 0x02, 0xdb, 0x46, 0x9b, 0xad, 0x26,
|
||||
0x11, 0xd5, 0x33, 0xc8, 0x63, 0xe0, 0x6b, 0xd6, 0x78, 0x36, 0x1e, 0x97, 0x5c, 0x2d, 0x66, 0x82,
|
||||
0xfb, 0xe8, 0x0a, 0xb3, 0x6f, 0x00, 0x71, 0xf1, 0x48, 0x52, 0xa0, 0x5c, 0x92, 0x0e, 0x94, 0x21,
|
||||
0xba, 0x56, 0xab, 0xb9, 0x18, 0xa1, 0xef, 0xc4, 0x54, 0x51, 0x23, 0x67, 0xeb, 0x73, 0x17, 0x5d,
|
||||
0x36, 0xa5, 0xf0, 0x07, 0x0f, 0xf5, 0xec, 0xac, 0xf1, 0x66, 0x5b, 0xa2, 0xbd, 0xd2, 0xc1, 0xdd,
|
||||
0xbf, 0x44, 0x59, 0x4a, 0xb2, 0xf3, 0xfe, 0xdb, 0xaf, 0x4f, 0x97, 0x86, 0x98, 0xd2, 0x24, 0xd3,
|
||||
0xe9, 0x24, 0x0e, 0x0e, 0x64, 0x4e, 0xcf, 0x33, 0x6b, 0xe6, 0x83, 0xc6, 0x65, 0xe2, 0x2f, 0x1e,
|
||||
0x5a, 0xbb, 0x70, 0x4d, 0x78, 0x7b, 0x49, 0x65, 0xd7, 0x35, 0x0c, 0x1e, 0xfe, 0x5f, 0x12, 0xd0,
|
||||
0x3f, 0x37, 0xf4, 0xbb, 0xf8, 0x89, 0x1b, 0x39, 0xe1, 0x7a, 0xd4, 0xf8, 0x33, 0x8c, 0xe2, 0xe9,
|
||||
0xa8, 0x3a, 0x38, 0x7a, 0x5c, 0xfd, 0x9e, 0xe0, 0xaf, 0x1e, 0x5a, 0xbb, 0x70, 0x9b, 0x4b, 0x9b,
|
||||
0x71, 0x9d, 0xce, 0xd2, 0x66, 0x9c, 0x07, 0x43, 0xf6, 0x4c, 0x33, 0x21, 0xde, 0x75, 0x37, 0xd3,
|
||||
0x6a, 0x04, 0xce, 0x92, 0x1e, 0x83, 0x71, 0x12, 0xbe, 0x3c, 0x9d, 0xf9, 0xde, 0xd9, 0xcc, 0xf7,
|
||||
0x7e, 0xce, 0x7c, 0xef, 0xe3, 0xdc, 0xef, 0x9c, 0xcd, 0xfd, 0xce, 0xf7, 0xb9, 0xdf, 0x79, 0xf3,
|
||||
0x4f, 0x5b, 0x7e, 0x67, 0xea, 0xe8, 0x69, 0xc1, 0x55, 0xdc, 0x33, 0x9f, 0x8d, 0xed, 0xdf, 0x01,
|
||||
0x00, 0x00, 0xff, 0xff, 0x4a, 0x7b, 0x5d, 0xc7, 0x32, 0x05, 0x00, 0x00,
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
@ -157,6 +350,10 @@ const _ = grpc.SupportPackageIsVersion4
|
||||
type QueryClient interface {
|
||||
// Parameters queries the parameters of the module.
|
||||
Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error)
|
||||
// Queries a list of GetMintRequestsByHash items.
|
||||
GetMintRequestsByHash(ctx context.Context, in *QueryGetMintRequestsByHashRequest, opts ...grpc.CallOption) (*QueryGetMintRequestsByHashResponse, error)
|
||||
// Queries a list of MintRequestsByAddress items.
|
||||
MintRequestsByAddress(ctx context.Context, in *QueryMintRequestsByAddressRequest, opts ...grpc.CallOption) (*QueryMintRequestsByAddressResponse, error)
|
||||
}
|
||||
|
||||
type queryClient struct {
|
||||
@ -176,10 +373,32 @@ func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts .
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *queryClient) GetMintRequestsByHash(ctx context.Context, in *QueryGetMintRequestsByHashRequest, opts ...grpc.CallOption) (*QueryGetMintRequestsByHashResponse, error) {
|
||||
out := new(QueryGetMintRequestsByHashResponse)
|
||||
err := c.cc.Invoke(ctx, "/planetmintgo.dao.Query/GetMintRequestsByHash", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *queryClient) MintRequestsByAddress(ctx context.Context, in *QueryMintRequestsByAddressRequest, opts ...grpc.CallOption) (*QueryMintRequestsByAddressResponse, error) {
|
||||
out := new(QueryMintRequestsByAddressResponse)
|
||||
err := c.cc.Invoke(ctx, "/planetmintgo.dao.Query/MintRequestsByAddress", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// QueryServer is the server API for Query service.
|
||||
type QueryServer interface {
|
||||
// Parameters queries the parameters of the module.
|
||||
Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error)
|
||||
// Queries a list of GetMintRequestsByHash items.
|
||||
GetMintRequestsByHash(context.Context, *QueryGetMintRequestsByHashRequest) (*QueryGetMintRequestsByHashResponse, error)
|
||||
// Queries a list of MintRequestsByAddress items.
|
||||
MintRequestsByAddress(context.Context, *QueryMintRequestsByAddressRequest) (*QueryMintRequestsByAddressResponse, error)
|
||||
}
|
||||
|
||||
// UnimplementedQueryServer can be embedded to have forward compatible implementations.
|
||||
@ -189,6 +408,12 @@ 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) GetMintRequestsByHash(ctx context.Context, req *QueryGetMintRequestsByHashRequest) (*QueryGetMintRequestsByHashResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetMintRequestsByHash not implemented")
|
||||
}
|
||||
func (*UnimplementedQueryServer) MintRequestsByAddress(ctx context.Context, req *QueryMintRequestsByAddressRequest) (*QueryMintRequestsByAddressResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method MintRequestsByAddress not implemented")
|
||||
}
|
||||
|
||||
func RegisterQueryServer(s grpc1.Server, srv QueryServer) {
|
||||
s.RegisterService(&_Query_serviceDesc, srv)
|
||||
@ -212,6 +437,42 @@ func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interf
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Query_GetMintRequestsByHash_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(QueryGetMintRequestsByHashRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(QueryServer).GetMintRequestsByHash(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/planetmintgo.dao.Query/GetMintRequestsByHash",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(QueryServer).GetMintRequestsByHash(ctx, req.(*QueryGetMintRequestsByHashRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Query_MintRequestsByAddress_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(QueryMintRequestsByAddressRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(QueryServer).MintRequestsByAddress(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/planetmintgo.dao.Query/MintRequestsByAddress",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(QueryServer).MintRequestsByAddress(ctx, req.(*QueryMintRequestsByAddressRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _Query_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "planetmintgo.dao.Query",
|
||||
HandlerType: (*QueryServer)(nil),
|
||||
@ -220,6 +481,14 @@ var _Query_serviceDesc = grpc.ServiceDesc{
|
||||
MethodName: "Params",
|
||||
Handler: _Query_Params_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetMintRequestsByHash",
|
||||
Handler: _Query_GetMintRequestsByHash_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "MintRequestsByAddress",
|
||||
Handler: _Query_MintRequestsByAddress_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "planetmintgo/dao/query.proto",
|
||||
@ -281,6 +550,136 @@ func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *QueryGetMintRequestsByHashRequest) 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 *QueryGetMintRequestsByHashRequest) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *QueryGetMintRequestsByHashRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.Hash) > 0 {
|
||||
i -= len(m.Hash)
|
||||
copy(dAtA[i:], m.Hash)
|
||||
i = encodeVarintQuery(dAtA, i, uint64(len(m.Hash)))
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *QueryGetMintRequestsByHashResponse) 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 *QueryGetMintRequestsByHashResponse) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *QueryGetMintRequestsByHashResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.MintRequest != nil {
|
||||
{
|
||||
size, err := m.MintRequest.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 *QueryMintRequestsByAddressRequest) 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 *QueryMintRequestsByAddressRequest) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *QueryMintRequestsByAddressRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.Address) > 0 {
|
||||
i -= len(m.Address)
|
||||
copy(dAtA[i:], m.Address)
|
||||
i = encodeVarintQuery(dAtA, i, uint64(len(m.Address)))
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *QueryMintRequestsByAddressResponse) 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 *QueryMintRequestsByAddressResponse) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *QueryMintRequestsByAddressResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.MintRequests != nil {
|
||||
{
|
||||
size, err := m.MintRequests.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
|
||||
@ -312,6 +711,58 @@ func (m *QueryParamsResponse) Size() (n int) {
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *QueryGetMintRequestsByHashRequest) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
l = len(m.Hash)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovQuery(uint64(l))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *QueryGetMintRequestsByHashResponse) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
if m.MintRequest != nil {
|
||||
l = m.MintRequest.Size()
|
||||
n += 1 + l + sovQuery(uint64(l))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *QueryMintRequestsByAddressRequest) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
l = len(m.Address)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovQuery(uint64(l))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *QueryMintRequestsByAddressResponse) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
if m.MintRequests != nil {
|
||||
l = m.MintRequests.Size()
|
||||
n += 1 + l + sovQuery(uint64(l))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func sovQuery(x uint64) (n int) {
|
||||
return (math_bits.Len64(x|1) + 6) / 7
|
||||
}
|
||||
@ -451,6 +902,342 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *QueryGetMintRequestsByHashRequest) 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: QueryGetMintRequestsByHashRequest: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: QueryGetMintRequestsByHashRequest: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Hash", 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.Hash = 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 *QueryGetMintRequestsByHashResponse) 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: QueryGetMintRequestsByHashResponse: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: QueryGetMintRequestsByHashResponse: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field MintRequest", 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.MintRequest == nil {
|
||||
m.MintRequest = &MintRequest{}
|
||||
}
|
||||
if err := m.MintRequest.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 *QueryMintRequestsByAddressRequest) 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: QueryMintRequestsByAddressRequest: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: QueryMintRequestsByAddressRequest: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Address", 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.Address = 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 *QueryMintRequestsByAddressResponse) 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: QueryMintRequestsByAddressResponse: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: QueryMintRequestsByAddressResponse: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field MintRequests", 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.MintRequests == nil {
|
||||
m.MintRequests = &MintRequests{}
|
||||
}
|
||||
if err := m.MintRequests.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
|
||||
|
@ -51,6 +51,114 @@ func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshal
|
||||
|
||||
}
|
||||
|
||||
func request_Query_GetMintRequestsByHash_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryGetMintRequestsByHashRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
var (
|
||||
val string
|
||||
ok bool
|
||||
err error
|
||||
_ = err
|
||||
)
|
||||
|
||||
val, ok = pathParams["hash"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "hash")
|
||||
}
|
||||
|
||||
protoReq.Hash, err = runtime.String(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "hash", err)
|
||||
}
|
||||
|
||||
msg, err := client.GetMintRequestsByHash(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_Query_GetMintRequestsByHash_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryGetMintRequestsByHashRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
var (
|
||||
val string
|
||||
ok bool
|
||||
err error
|
||||
_ = err
|
||||
)
|
||||
|
||||
val, ok = pathParams["hash"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "hash")
|
||||
}
|
||||
|
||||
protoReq.Hash, err = runtime.String(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "hash", err)
|
||||
}
|
||||
|
||||
msg, err := server.GetMintRequestsByHash(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func request_Query_MintRequestsByAddress_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryMintRequestsByAddressRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
var (
|
||||
val string
|
||||
ok bool
|
||||
err error
|
||||
_ = err
|
||||
)
|
||||
|
||||
val, ok = pathParams["address"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address")
|
||||
}
|
||||
|
||||
protoReq.Address, err = runtime.String(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err)
|
||||
}
|
||||
|
||||
msg, err := client.MintRequestsByAddress(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_Query_MintRequestsByAddress_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryMintRequestsByAddressRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
var (
|
||||
val string
|
||||
ok bool
|
||||
err error
|
||||
_ = err
|
||||
)
|
||||
|
||||
val, ok = pathParams["address"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address")
|
||||
}
|
||||
|
||||
protoReq.Address, err = runtime.String(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err)
|
||||
}
|
||||
|
||||
msg, err := server.MintRequestsByAddress(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.
|
||||
@ -80,6 +188,52 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_GetMintRequestsByHash_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Query_GetMintRequestsByHash_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Query_GetMintRequestsByHash_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_MintRequestsByAddress_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Query_MintRequestsByAddress_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Query_MintRequestsByAddress_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -141,13 +295,61 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_GetMintRequestsByHash_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_GetMintRequestsByHash_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_GetMintRequestsByHash_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_MintRequestsByAddress_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_MintRequestsByAddress_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_MintRequestsByAddress_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, 2, 4}, []string{"github.com", "planetmint", "planetmint-go", "dao", "params"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
|
||||
pattern_Query_GetMintRequestsByHash_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"planetmint", "planetmint-go", "dao", "get_mint_requests_by_hash", "hash"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
|
||||
pattern_Query_MintRequestsByAddress_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"planetmint", "planetmint-go", "dao", "mint_requests_by_address", "address"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
)
|
||||
|
||||
var (
|
||||
forward_Query_Params_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Query_GetMintRequestsByHash_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Query_MintRequestsByAddress_0 = runtime.ForwardResponseMessage
|
||||
)
|
||||
|
@ -131,32 +131,127 @@ func (m *MsgReissueRDDLProposalResponse) XXX_DiscardUnknown() {
|
||||
|
||||
var xxx_messageInfo_MsgReissueRDDLProposalResponse proto.InternalMessageInfo
|
||||
|
||||
type MsgMintToken struct {
|
||||
Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"`
|
||||
MintRequest *MintRequest `protobuf:"bytes,2,opt,name=mintRequest,proto3" json:"mintRequest,omitempty"`
|
||||
}
|
||||
|
||||
func (m *MsgMintToken) Reset() { *m = MsgMintToken{} }
|
||||
func (m *MsgMintToken) String() string { return proto.CompactTextString(m) }
|
||||
func (*MsgMintToken) ProtoMessage() {}
|
||||
func (*MsgMintToken) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_7117c47dbc1828c7, []int{2}
|
||||
}
|
||||
func (m *MsgMintToken) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *MsgMintToken) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_MsgMintToken.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 *MsgMintToken) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_MsgMintToken.Merge(m, src)
|
||||
}
|
||||
func (m *MsgMintToken) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *MsgMintToken) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_MsgMintToken.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_MsgMintToken proto.InternalMessageInfo
|
||||
|
||||
func (m *MsgMintToken) GetCreator() string {
|
||||
if m != nil {
|
||||
return m.Creator
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *MsgMintToken) GetMintRequest() *MintRequest {
|
||||
if m != nil {
|
||||
return m.MintRequest
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type MsgMintTokenResponse struct {
|
||||
}
|
||||
|
||||
func (m *MsgMintTokenResponse) Reset() { *m = MsgMintTokenResponse{} }
|
||||
func (m *MsgMintTokenResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*MsgMintTokenResponse) ProtoMessage() {}
|
||||
func (*MsgMintTokenResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_7117c47dbc1828c7, []int{3}
|
||||
}
|
||||
func (m *MsgMintTokenResponse) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *MsgMintTokenResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_MsgMintTokenResponse.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 *MsgMintTokenResponse) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_MsgMintTokenResponse.Merge(m, src)
|
||||
}
|
||||
func (m *MsgMintTokenResponse) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *MsgMintTokenResponse) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_MsgMintTokenResponse.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_MsgMintTokenResponse proto.InternalMessageInfo
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*MsgReissueRDDLProposal)(nil), "planetmintgo.dao.MsgReissueRDDLProposal")
|
||||
proto.RegisterType((*MsgReissueRDDLProposalResponse)(nil), "planetmintgo.dao.MsgReissueRDDLProposalResponse")
|
||||
proto.RegisterType((*MsgMintToken)(nil), "planetmintgo.dao.MsgMintToken")
|
||||
proto.RegisterType((*MsgMintTokenResponse)(nil), "planetmintgo.dao.MsgMintTokenResponse")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("planetmintgo/dao/tx.proto", fileDescriptor_7117c47dbc1828c7) }
|
||||
|
||||
var fileDescriptor_7117c47dbc1828c7 = []byte{
|
||||
// 261 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2c, 0xc8, 0x49, 0xcc,
|
||||
0x4b, 0x2d, 0xc9, 0xcd, 0xcc, 0x2b, 0x49, 0xcf, 0xd7, 0x4f, 0x49, 0xcc, 0xd7, 0x2f, 0xa9, 0xd0,
|
||||
0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x40, 0x96, 0xd2, 0x4b, 0x49, 0xcc, 0x57, 0x6a, 0x60,
|
||||
0xe4, 0x12, 0xf3, 0x2d, 0x4e, 0x0f, 0x4a, 0xcd, 0x2c, 0x2e, 0x2e, 0x4d, 0x0d, 0x72, 0x71, 0xf1,
|
||||
0x09, 0x28, 0xca, 0x2f, 0xc8, 0x2f, 0x4e, 0xcc, 0x11, 0x92, 0xe0, 0x62, 0x4f, 0x2e, 0x4a, 0x4d,
|
||||
0x2c, 0xc9, 0x2f, 0x92, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x0c, 0x82, 0x71, 0x85, 0xa4, 0xb8, 0x38,
|
||||
0x0a, 0xc0, 0xaa, 0x52, 0x8b, 0x24, 0x98, 0xc0, 0x52, 0x70, 0xbe, 0x10, 0x1f, 0x17, 0x53, 0x49,
|
||||
0x85, 0x04, 0x33, 0x58, 0x94, 0xa9, 0xa4, 0x42, 0x48, 0x81, 0x8b, 0x3b, 0x29, 0x27, 0x3f, 0x39,
|
||||
0x3b, 0x23, 0x35, 0x33, 0x3d, 0xa3, 0x44, 0x82, 0x45, 0x81, 0x51, 0x83, 0x25, 0x08, 0x59, 0x48,
|
||||
0x49, 0x81, 0x4b, 0x0e, 0xbb, 0x0b, 0x82, 0x52, 0x8b, 0x0b, 0xf2, 0xf3, 0x8a, 0x53, 0x8d, 0x2a,
|
||||
0xb8, 0x98, 0x7d, 0x8b, 0xd3, 0x85, 0x0a, 0xb9, 0x84, 0xb1, 0xb9, 0x53, 0x43, 0x0f, 0xdd, 0x57,
|
||||
0x7a, 0xd8, 0xcd, 0x93, 0x32, 0x20, 0x56, 0x25, 0xcc, 0x66, 0x27, 0xcf, 0x13, 0x8f, 0xe4, 0x18,
|
||||
0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5,
|
||||
0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0xd2, 0x4f, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce,
|
||||
0xcf, 0xd5, 0x47, 0x98, 0x8a, 0xc4, 0xd4, 0x4d, 0xcf, 0xd7, 0xaf, 0x80, 0x04, 0x7f, 0x65, 0x41,
|
||||
0x6a, 0x71, 0x12, 0x1b, 0x38, 0x0a, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x5c, 0xda, 0x60,
|
||||
0xc9, 0x9f, 0x01, 0x00, 0x00,
|
||||
// 341 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x52, 0xc1, 0x4a, 0xf3, 0x40,
|
||||
0x10, 0xee, 0xb6, 0xe5, 0xff, 0xed, 0x54, 0x44, 0x56, 0x29, 0x31, 0xe0, 0x12, 0x22, 0x48, 0x2f,
|
||||
0x26, 0x52, 0x1f, 0x40, 0x90, 0x5e, 0x04, 0x03, 0xb2, 0x7a, 0xf2, 0x22, 0x69, 0xbb, 0x6c, 0x43,
|
||||
0xdb, 0x4c, 0xba, 0xbb, 0x85, 0x78, 0xf3, 0x11, 0x7c, 0x2c, 0x2f, 0x42, 0x8f, 0x1e, 0xa5, 0x7d,
|
||||
0x11, 0x69, 0x4a, 0xda, 0xa0, 0xa1, 0x78, 0x9b, 0x99, 0xef, 0x9b, 0x99, 0xef, 0x1b, 0x06, 0x4e,
|
||||
0x92, 0x71, 0x18, 0x0b, 0x33, 0x89, 0x62, 0x23, 0xd1, 0x1f, 0x84, 0xe8, 0x9b, 0xd4, 0x4b, 0x14,
|
||||
0x1a, 0xa4, 0x87, 0x45, 0xc8, 0x1b, 0x84, 0x68, 0x9f, 0xfd, 0x22, 0xaf, 0xc2, 0x67, 0x25, 0xa6,
|
||||
0x33, 0xa1, 0xcd, 0xba, 0xcd, 0x7d, 0x25, 0xd0, 0x0a, 0xb4, 0xe4, 0x22, 0xd2, 0x7a, 0x26, 0x78,
|
||||
0xb7, 0x7b, 0x77, 0xaf, 0x30, 0x41, 0x1d, 0x8e, 0xa9, 0x05, 0xff, 0xfb, 0x4a, 0x84, 0x06, 0x95,
|
||||
0x45, 0x1c, 0xd2, 0x6e, 0xf0, 0x3c, 0xa5, 0x36, 0xec, 0x25, 0x19, 0x4b, 0x28, 0xab, 0x9a, 0x41,
|
||||
0x9b, 0x9c, 0x1e, 0x40, 0xd5, 0xa4, 0x56, 0x2d, 0xab, 0x56, 0x4d, 0x4a, 0x1d, 0x68, 0xf6, 0xc6,
|
||||
0xd8, 0x1f, 0x0d, 0x45, 0x24, 0x87, 0xc6, 0xaa, 0x3b, 0xa4, 0x5d, 0xe7, 0xc5, 0x92, 0xeb, 0x00,
|
||||
0x2b, 0x57, 0xc0, 0x85, 0x4e, 0x30, 0xd6, 0xc2, 0x8d, 0x60, 0x3f, 0xd0, 0x32, 0x88, 0x62, 0xf3,
|
||||
0x88, 0x23, 0x11, 0xef, 0x50, 0x76, 0x0d, 0xcd, 0x95, 0x49, 0xbe, 0xf6, 0x98, 0x89, 0x6b, 0x76,
|
||||
0x4e, 0xbd, 0x9f, 0xb7, 0xf1, 0x82, 0x2d, 0x89, 0x17, 0x3b, 0xdc, 0x16, 0x1c, 0x17, 0x57, 0xe5,
|
||||
0x12, 0x3a, 0x1f, 0x04, 0x6a, 0x81, 0x96, 0x74, 0x0a, 0x47, 0x65, 0xb7, 0x6a, 0x97, 0xac, 0x28,
|
||||
0xf5, 0x64, 0x5f, 0xfe, 0x95, 0x99, 0xaf, 0xa6, 0x0f, 0xd0, 0xd8, 0x5a, 0x67, 0xa5, 0xed, 0x1b,
|
||||
0xdc, 0x3e, 0xdf, 0x8d, 0xe7, 0x43, 0x6f, 0x6e, 0xdf, 0x17, 0x8c, 0xcc, 0x17, 0x8c, 0x7c, 0x2d,
|
||||
0x18, 0x79, 0x5b, 0xb2, 0xca, 0x7c, 0xc9, 0x2a, 0x9f, 0x4b, 0x56, 0x79, 0xf2, 0x65, 0x64, 0x86,
|
||||
0xb3, 0x9e, 0xd7, 0xc7, 0x89, 0xbf, 0x9d, 0x55, 0x08, 0x2f, 0x24, 0xfa, 0xe9, 0xfa, 0xf9, 0x5e,
|
||||
0x12, 0xa1, 0x7b, 0xff, 0xb2, 0x4f, 0xba, 0xfa, 0x0e, 0x00, 0x00, 0xff, 0xff, 0x39, 0x2e, 0x48,
|
||||
0xa1, 0x9d, 0x02, 0x00, 0x00,
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
@ -172,6 +267,7 @@ const _ = grpc.SupportPackageIsVersion4
|
||||
// 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 {
|
||||
ReissueRDDLProposal(ctx context.Context, in *MsgReissueRDDLProposal, opts ...grpc.CallOption) (*MsgReissueRDDLProposalResponse, error)
|
||||
MintToken(ctx context.Context, in *MsgMintToken, opts ...grpc.CallOption) (*MsgMintTokenResponse, error)
|
||||
}
|
||||
|
||||
type msgClient struct {
|
||||
@ -191,9 +287,19 @@ func (c *msgClient) ReissueRDDLProposal(ctx context.Context, in *MsgReissueRDDLP
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *msgClient) MintToken(ctx context.Context, in *MsgMintToken, opts ...grpc.CallOption) (*MsgMintTokenResponse, error) {
|
||||
out := new(MsgMintTokenResponse)
|
||||
err := c.cc.Invoke(ctx, "/planetmintgo.dao.Msg/MintToken", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// MsgServer is the server API for Msg service.
|
||||
type MsgServer interface {
|
||||
ReissueRDDLProposal(context.Context, *MsgReissueRDDLProposal) (*MsgReissueRDDLProposalResponse, error)
|
||||
MintToken(context.Context, *MsgMintToken) (*MsgMintTokenResponse, error)
|
||||
}
|
||||
|
||||
// UnimplementedMsgServer can be embedded to have forward compatible implementations.
|
||||
@ -203,6 +309,9 @@ type UnimplementedMsgServer struct {
|
||||
func (*UnimplementedMsgServer) ReissueRDDLProposal(ctx context.Context, req *MsgReissueRDDLProposal) (*MsgReissueRDDLProposalResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ReissueRDDLProposal not implemented")
|
||||
}
|
||||
func (*UnimplementedMsgServer) MintToken(ctx context.Context, req *MsgMintToken) (*MsgMintTokenResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method MintToken not implemented")
|
||||
}
|
||||
|
||||
func RegisterMsgServer(s grpc1.Server, srv MsgServer) {
|
||||
s.RegisterService(&_Msg_serviceDesc, srv)
|
||||
@ -226,6 +335,24 @@ func _Msg_ReissueRDDLProposal_Handler(srv interface{}, ctx context.Context, dec
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Msg_MintToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(MsgMintToken)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MsgServer).MintToken(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/planetmintgo.dao.Msg/MintToken",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MsgServer).MintToken(ctx, req.(*MsgMintToken))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _Msg_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "planetmintgo.dao.Msg",
|
||||
HandlerType: (*MsgServer)(nil),
|
||||
@ -234,6 +361,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{
|
||||
MethodName: "ReissueRDDLProposal",
|
||||
Handler: _Msg_ReissueRDDLProposal_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "MintToken",
|
||||
Handler: _Msg_MintToken_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "planetmintgo/dao/tx.proto",
|
||||
@ -311,6 +442,71 @@ func (m *MsgReissueRDDLProposalResponse) MarshalToSizedBuffer(dAtA []byte) (int,
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *MsgMintToken) 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 *MsgMintToken) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *MsgMintToken) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.MintRequest != nil {
|
||||
{
|
||||
size, err := m.MintRequest.MarshalToSizedBuffer(dAtA[:i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i -= size
|
||||
i = encodeVarintTx(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0x12
|
||||
}
|
||||
if len(m.Creator) > 0 {
|
||||
i -= len(m.Creator)
|
||||
copy(dAtA[i:], m.Creator)
|
||||
i = encodeVarintTx(dAtA, i, uint64(len(m.Creator)))
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *MsgMintTokenResponse) 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 *MsgMintTokenResponse) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *MsgMintTokenResponse) 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
|
||||
@ -355,6 +551,32 @@ func (m *MsgReissueRDDLProposalResponse) Size() (n int) {
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *MsgMintToken) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
l = len(m.Creator)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
}
|
||||
if m.MintRequest != nil {
|
||||
l = m.MintRequest.Size()
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *MsgMintTokenResponse) 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
|
||||
}
|
||||
@ -576,6 +798,174 @@ func (m *MsgReissueRDDLProposalResponse) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *MsgMintToken) 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: MsgMintToken: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: MsgMintToken: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowTx
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLen |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
intStringLen := int(stringLen)
|
||||
if intStringLen < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Creator = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field MintRequest", 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.MintRequest == nil {
|
||||
m.MintRequest = &MintRequest{}
|
||||
}
|
||||
if err := m.MintRequest.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 *MsgMintTokenResponse) 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: MsgMintTokenResponse: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: MsgMintTokenResponse: 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
|
||||
|
@ -1,29 +0,0 @@
|
||||
package keeper
|
||||
|
||||
import (
|
||||
config "github.com/planetmint/planetmint-go/config"
|
||||
"strconv"
|
||||
|
||||
"github.com/cometbft/cometbft/libs/log"
|
||||
"github.com/hypebeast/go-osc/osc"
|
||||
)
|
||||
|
||||
func (k Keeper) IssueResponseHandler(logger log.Logger) {
|
||||
conf := config.GetConfig()
|
||||
addr := "0.0.0.0:" + strconv.FormatInt(int64(conf.OSCServicePort), 10)
|
||||
d := osc.NewStandardDispatcher()
|
||||
err := d.AddMsgHandler("/rddl/resp", func(msg *osc.Message) {
|
||||
logger.Info("Issue Response: " + msg.String())
|
||||
})
|
||||
if err != nil {
|
||||
logger.Error("Unable to add handler to OSC service.")
|
||||
}
|
||||
server := &osc.Server{
|
||||
Addr: addr,
|
||||
Dispatcher: d,
|
||||
}
|
||||
err = server.ListenAndServe()
|
||||
if err != nil {
|
||||
logger.Error("Unable to start the OSC service.")
|
||||
}
|
||||
}
|
@ -1,8 +1,15 @@
|
||||
package keeper
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
"os/exec"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
config "github.com/planetmint/planetmint-go/config"
|
||||
"github.com/planetmint/planetmint-go/util"
|
||||
@ -10,7 +17,6 @@ import (
|
||||
|
||||
"github.com/btcsuite/btcd/btcutil/hdkeychain"
|
||||
"github.com/btcsuite/btcd/chaincfg"
|
||||
"github.com/crgimenes/go-osc"
|
||||
|
||||
errorsmod "cosmossdk.io/errors"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
@ -72,24 +78,90 @@ func validateExtendedPublicKey(issuer string, cfg chaincfg.Params) bool {
|
||||
return isValidExtendedPublicKey
|
||||
}
|
||||
|
||||
func (k msgServer) issueMachineNFT(machine *types.Machine) error {
|
||||
func (k msgServer) issueNFTAsset(name string, machine_address string) (asset_id string, contract string, err error) {
|
||||
conf := config.GetConfig()
|
||||
client := osc.NewClient(conf.WatchmenEndpoint, conf.WatchmenPort)
|
||||
machine_precision := strconv.FormatInt(int64(machine.Precision), 10)
|
||||
machine_amount := strconv.FormatInt(int64(machine.Amount), 10)
|
||||
machine_type := strconv.FormatUint(uint64(machine.GetType()), 10)
|
||||
|
||||
msg := osc.NewMessage("/rddl/issue")
|
||||
msg.Append(machine.Name)
|
||||
msg.Append(machine.Ticker)
|
||||
msg.Append(machine.Domain)
|
||||
msg.Append(machine_amount)
|
||||
msg.Append("1")
|
||||
msg.Append(machine_precision)
|
||||
msg.Append(machine.Metadata.GetAdditionalDataCID())
|
||||
msg.Append(machine.GetIssuerPlanetmint())
|
||||
msg.Append(machine_type)
|
||||
err := client.Send(msg)
|
||||
cmdName := "poetry"
|
||||
cmdArgs := []string{"run", "python", "issuer_service/issue2liquid.py", name, machine_address}
|
||||
|
||||
return err
|
||||
// Create a new command
|
||||
cmd := exec.Command(cmdName, cmdArgs...)
|
||||
|
||||
// If you want to set the working directory
|
||||
cmd.Dir = conf.IssuanceServiceDir
|
||||
|
||||
// Capture the output
|
||||
var stdout, stderr bytes.Buffer
|
||||
cmd.Stdout = &stdout
|
||||
cmd.Stderr = &stderr
|
||||
|
||||
// Execute the command
|
||||
err = cmd.Run()
|
||||
if err != nil {
|
||||
log.Fatalf("cmd.Run() failed with %s\n", err)
|
||||
err = errorsmod.Wrap(types.ErrMachineNFTIssuance, stderr.String())
|
||||
}
|
||||
lines := strings.Split(stdout.String(), "\n")
|
||||
if len(lines) == 3 {
|
||||
asset_id = lines[0]
|
||||
contract = lines[1]
|
||||
} else {
|
||||
err = errorsmod.Wrap(types.ErrMachineNFTIssuanceNoOutput, stderr.String())
|
||||
}
|
||||
return asset_id, contract, err
|
||||
}
|
||||
func (k msgServer) registerAsset(asset_id string, contract string) error {
|
||||
|
||||
conf := config.GetConfig()
|
||||
|
||||
// Create your request payload
|
||||
data := map[string]interface{}{
|
||||
"asset_id": asset_id,
|
||||
"contract": contract,
|
||||
}
|
||||
|
||||
jsonData, err := json.Marshal(data)
|
||||
if err != nil {
|
||||
return errorsmod.Wrap(types.ErrAssetRegistryReqFailure, "Marshall "+err.Error())
|
||||
}
|
||||
|
||||
req, err := http.NewRequest("POST", conf.AssetRegistryEndpoint, bytes.NewBuffer(jsonData))
|
||||
if err != nil {
|
||||
return errorsmod.Wrap(types.ErrAssetRegistryReqFailure, "Request creation: "+err.Error())
|
||||
}
|
||||
|
||||
// Set headers
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
req.Header.Set("accept", "application/json")
|
||||
|
||||
// Send request
|
||||
client := &http.Client{}
|
||||
resp, err := client.Do(req)
|
||||
if err != nil {
|
||||
return errorsmod.Wrap(types.ErrAssetRegistryReqSending, err.Error())
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
// Read response
|
||||
if resp.StatusCode > 299 {
|
||||
return errorsmod.Wrap(types.ErrAssetRegistryRepsonse, "Error reading response body:"+strconv.Itoa(resp.StatusCode))
|
||||
}
|
||||
body, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return errorsmod.Wrap(types.ErrAssetRegistryRepsonse, "Error reading response body:"+err.Error())
|
||||
}
|
||||
result_obj := string(body)
|
||||
if strings.Contains(result_obj, asset_id) {
|
||||
return nil
|
||||
} else {
|
||||
return errorsmod.Wrap(types.ErrAssetRegistryRepsonse, "does not confirm asset registration")
|
||||
}
|
||||
}
|
||||
|
||||
func (k msgServer) issueMachineNFT(machine *types.Machine) error {
|
||||
asset_id, contract, err := k.issueNFTAsset(machine.Name, machine.Address)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return k.registerAsset(asset_id, contract)
|
||||
}
|
||||
|
@ -17,4 +17,9 @@ var (
|
||||
ErrMachineTypeUndefined = errorsmod.Register(ModuleName, 8, "the machine type has to be defined")
|
||||
ErrInvalidTrustAnchorKey = errorsmod.Register(ModuleName, 9, "invalid trust anchor pubkey")
|
||||
ErrTrustAnchorAlreadyRegistered = errorsmod.Register(ModuleName, 10, "trust anchor is already registered")
|
||||
ErrMachineNFTIssuance = errorsmod.Register(ModuleName, 11, "the machine NFT could not be issued")
|
||||
ErrMachineNFTIssuanceNoOutput = errorsmod.Register(ModuleName, 12, "the machine NFT issuing process derivated")
|
||||
ErrAssetRegistryReqFailure = errorsmod.Register(ModuleName, 13, "request to asset registry could not be created")
|
||||
ErrAssetRegistryReqSending = errorsmod.Register(ModuleName, 14, "request to asset registry could not be sent")
|
||||
ErrAssetRegistryRepsonse = errorsmod.Register(ModuleName, 15, "request response issue")
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user