mirror of https://github.com/certusone/wasmd.git
Add GRPC querier and REST gateway
This commit is contained in:
parent
bcb00d6017
commit
5cc3e6dc8b
|
@ -75,6 +75,13 @@ If you want to deploy a whole cluster, [look at the network scripts](./networks/
|
|||
```sh
|
||||
go install github.com/regen-network/cosmos-proto/protoc-gen-gocosmos
|
||||
```
|
||||
3. Install [grpc gateway extension](github.com/grpc-ecosystem/grpc-gateway)
|
||||
```go
|
||||
go install \ upgrade_stargate_rebased 3a8aa77 ✗
|
||||
github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway \
|
||||
github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger \
|
||||
github.com/golang/protobuf/protoc-gen-go
|
||||
```
|
||||
3. Run generator
|
||||
```sh
|
||||
make proto-gen
|
||||
|
|
4
go.mod
4
go.mod
|
@ -8,6 +8,7 @@ require (
|
|||
github.com/cosmos/iavl v0.15.0-rc4
|
||||
github.com/dvsekhvalnov/jose2go v0.0.0-20200901110807-248326c1351b
|
||||
github.com/gogo/protobuf v1.3.1
|
||||
github.com/golang/protobuf v1.4.3
|
||||
github.com/google/gofuzz v1.0.0
|
||||
github.com/gorilla/mux v1.8.0
|
||||
github.com/grpc-ecosystem/grpc-gateway v1.15.2
|
||||
|
@ -21,10 +22,9 @@ require (
|
|||
github.com/stretchr/testify v1.6.1
|
||||
github.com/tendermint/tendermint v0.34.0-rc5
|
||||
github.com/tendermint/tm-db v0.6.2
|
||||
google.golang.org/genproto v0.0.0-20201014134559-03b6142f0dc9
|
||||
google.golang.org/grpc v1.33.0
|
||||
gopkg.in/yaml.v2 v2.3.0
|
||||
)
|
||||
|
||||
replace github.com/keybase/go-keychain => github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4
|
||||
|
||||
replace github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.2-alpha.regen.4
|
||||
|
|
6
go.sum
6
go.sum
|
@ -11,8 +11,6 @@ cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqCl
|
|||
cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I=
|
||||
cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw=
|
||||
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
||||
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs=
|
||||
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4/go.mod h1:hN7oaIRCjzsZ2dE+yG5k+rsdt3qcwykqK6HVGcKwsw4=
|
||||
github.com/99designs/keyring v1.1.6 h1:kVDC2uCgVwecxCk+9zoCt2uEL6dt+dfVzMvGgnVcIuM=
|
||||
github.com/99designs/keyring v1.1.6/go.mod h1:16e0ds7LGQQcT59QqkTg72Hh5ShM51Byv5PEmW6uoRU=
|
||||
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
|
||||
|
@ -174,6 +172,7 @@ github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2
|
|||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
|
||||
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
|
||||
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
|
||||
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
||||
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||
|
@ -193,6 +192,7 @@ github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2/go.mod h1:bBOAhwG1umN6
|
|||
github.com/gogo/gateway v1.1.0 h1:u0SuhL9+Il+UbjM9VIE3ntfRujKbvVpFvNB4HbjeVQ0=
|
||||
github.com/gogo/gateway v1.1.0/go.mod h1:S7rR8FRQyG3QFESeSv4l2WnsyzlCLG0CzBbUUo/mbic=
|
||||
github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s=
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58=
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||
github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
|
@ -326,6 +326,8 @@ github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7
|
|||
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
|
||||
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
|
||||
github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM=
|
||||
github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d h1:Z+RDyXzjKE0i2sTjZ/b1uxiGtPhFy34Ou/Tk0qwN0kM=
|
||||
github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d/go.mod h1:JJNrCn9otv/2QP4D7SMJBgaleKpOf66PnW6F5WGNRIc=
|
||||
github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
|
||||
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
||||
github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4=
|
||||
|
|
|
@ -2,18 +2,22 @@
|
|||
|
||||
set -eo pipefail
|
||||
|
||||
|
||||
project_dir=x/wasm/internal/types/
|
||||
cosmos_sdk_dir=$(go list -f "{{ .Dir }}" -m github.com/cosmos/cosmos-sdk)
|
||||
# Generate Go types from protobuf
|
||||
protoc \
|
||||
-I=. \
|
||||
-I="$(go list -f "{{ .Dir }}" -m github.com/cosmos/cosmos-sdk)/third_party/proto" \
|
||||
-I="$(go list -f "{{ .Dir }}" -m github.com/cosmos/cosmos-sdk)/proto" \
|
||||
--gocosmos_out=\
|
||||
Mgoogle/protobuf/any.proto=github.com/gogo/protobuf/types,\
|
||||
Mgoogle/protobuf/duration.proto=github.com/gogo/protobuf/types,\
|
||||
Mgoogle/protobuf/empty.proto=github.com/gogo/protobuf/types,\
|
||||
Mgoogle/protobuf/struct.proto=github.com/gogo/protobuf/types,\
|
||||
Mgoogle/protobuf/timestamp.proto=github.com/gogo/protobuf/types,\
|
||||
Mgoogle/protobuf/wrappers.proto=github.com/gogo/protobuf/types,\
|
||||
plugins=interfacetype+grpc,paths=source_relative:. \
|
||||
./x/wasm/internal/types/types.proto ./x/wasm/internal/types/query.proto ./x/wasm/internal/types/msg.proto \
|
||||
./x/wasm/internal/types/proposal.proto ./x/wasm/internal/types/genesis.proto
|
||||
-I=. \
|
||||
-I="$cosmos_sdk_dir/third_party/proto" \
|
||||
-I="$cosmos_sdk_dir/proto" \
|
||||
--gocosmos_out=Mgoogle/protobuf/any.proto=github.com/cosmos/cosmos-sdk/codec/types,plugins=interfacetype+grpc,paths=source_relative:. \
|
||||
$(find "${project_dir}" -maxdepth 1 -name '*.proto')
|
||||
|
||||
# Generate gRPC gateway (*.pb.gw.go in respective modules) files
|
||||
protoc \
|
||||
-I=. \
|
||||
-I="$cosmos_sdk_dir/third_party/proto" \
|
||||
-I="$cosmos_sdk_dir/proto" \
|
||||
--grpc-gateway_out .\
|
||||
--grpc-gateway_opt logtostderr=true \
|
||||
--grpc-gateway_opt paths=source_relative \
|
||||
$(find "${project_dir}" -maxdepth 1 -name '*.proto')
|
||||
|
|
|
@ -2,7 +2,6 @@ package keeper
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/binary"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"io/ioutil"
|
||||
|
@ -14,13 +13,9 @@ import (
|
|||
stypes "github.com/cosmos/cosmos-sdk/store/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
|
||||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
"github.com/tendermint/tendermint/crypto/ed25519"
|
||||
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
|
||||
)
|
||||
|
||||
|
@ -293,7 +288,7 @@ func TestInstantiate(t *testing.T) {
|
|||
_, _, bob := keyPubAddr()
|
||||
_, _, fred := keyPubAddr()
|
||||
|
||||
initMsg := InitMsg{
|
||||
initMsg := HackatomExampleInitMsg{
|
||||
Verifier: fred,
|
||||
Beneficiary: bob,
|
||||
}
|
||||
|
@ -335,7 +330,7 @@ func TestInstantiateWithDeposit(t *testing.T) {
|
|||
fred = bytes.Repeat([]byte{2}, sdk.AddrLen)
|
||||
|
||||
deposit = sdk.NewCoins(sdk.NewInt64Coin("denom", 100))
|
||||
initMsg = InitMsg{Verifier: fred, Beneficiary: bob}
|
||||
initMsg = HackatomExampleInitMsg{Verifier: fred, Beneficiary: bob}
|
||||
)
|
||||
|
||||
initMsgBz, err := json.Marshal(initMsg)
|
||||
|
@ -399,7 +394,7 @@ func TestInstantiateWithPermissions(t *testing.T) {
|
|||
anyAddr = bytes.Repeat([]byte{3}, sdk.AddrLen)
|
||||
)
|
||||
|
||||
initMsg := InitMsg{
|
||||
initMsg := HackatomExampleInitMsg{
|
||||
Verifier: anyAddr,
|
||||
Beneficiary: anyAddr,
|
||||
}
|
||||
|
@ -464,7 +459,7 @@ func TestInstantiateWithNonExistingCodeID(t *testing.T) {
|
|||
|
||||
require.NoError(t, err)
|
||||
|
||||
initMsg := InitMsg{}
|
||||
initMsg := HackatomExampleInitMsg{}
|
||||
initMsgBz, err := json.Marshal(initMsg)
|
||||
require.NoError(t, err)
|
||||
|
||||
|
@ -493,7 +488,7 @@ func TestExecute(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
|
||||
_, _, bob := keyPubAddr()
|
||||
initMsg := InitMsg{
|
||||
initMsg := HackatomExampleInitMsg{
|
||||
Verifier: fred,
|
||||
Beneficiary: bob,
|
||||
}
|
||||
|
@ -607,7 +602,7 @@ func TestExecuteWithDeposit(t *testing.T) {
|
|||
codeID, err := keeper.Create(ctx, spec.srcActor, wasmCode, "https://example.com/escrow.wasm", "", nil)
|
||||
require.NoError(t, err)
|
||||
|
||||
initMsg := InitMsg{Verifier: spec.srcActor, Beneficiary: spec.beneficiary}
|
||||
initMsg := HackatomExampleInitMsg{Verifier: spec.srcActor, Beneficiary: spec.beneficiary}
|
||||
initMsgBz, err := json.Marshal(initMsg)
|
||||
require.NoError(t, err)
|
||||
|
||||
|
@ -664,7 +659,7 @@ func TestExecuteWithPanic(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
|
||||
_, _, bob := keyPubAddr()
|
||||
initMsg := InitMsg{
|
||||
initMsg := HackatomExampleInitMsg{
|
||||
Verifier: fred,
|
||||
Beneficiary: bob,
|
||||
}
|
||||
|
@ -700,7 +695,7 @@ func TestExecuteWithCpuLoop(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
|
||||
_, _, bob := keyPubAddr()
|
||||
initMsg := InitMsg{
|
||||
initMsg := HackatomExampleInitMsg{
|
||||
Verifier: fred,
|
||||
Beneficiary: bob,
|
||||
}
|
||||
|
@ -748,7 +743,7 @@ func TestExecuteWithStorageLoop(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
|
||||
_, _, bob := keyPubAddr()
|
||||
initMsg := InitMsg{
|
||||
initMsg := HackatomExampleInitMsg{
|
||||
Verifier: fred,
|
||||
Beneficiary: bob,
|
||||
}
|
||||
|
@ -799,7 +794,7 @@ func TestMigrate(t *testing.T) {
|
|||
|
||||
_, _, anyAddr := keyPubAddr()
|
||||
_, _, newVerifierAddr := keyPubAddr()
|
||||
initMsg := InitMsg{
|
||||
initMsg := HackatomExampleInitMsg{
|
||||
Verifier: fred,
|
||||
Beneficiary: anyAddr,
|
||||
}
|
||||
|
@ -943,7 +938,7 @@ func TestMigrateWithDispatchedMessage(t *testing.T) {
|
|||
require.NotEqual(t, originalContractID, burnerContractID)
|
||||
|
||||
_, _, myPayoutAddr := keyPubAddr()
|
||||
initMsg := InitMsg{
|
||||
initMsg := HackatomExampleInitMsg{
|
||||
Verifier: fred,
|
||||
Beneficiary: fred,
|
||||
}
|
||||
|
@ -1051,7 +1046,7 @@ func TestUpdateContractAdmin(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
|
||||
_, _, anyAddr := keyPubAddr()
|
||||
initMsg := InitMsg{
|
||||
initMsg := HackatomExampleInitMsg{
|
||||
Verifier: fred,
|
||||
Beneficiary: anyAddr,
|
||||
}
|
||||
|
@ -1126,7 +1121,7 @@ func TestClearContractAdmin(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
|
||||
_, _, anyAddr := keyPubAddr()
|
||||
initMsg := InitMsg{
|
||||
initMsg := HackatomExampleInitMsg{
|
||||
Verifier: fred,
|
||||
Beneficiary: anyAddr,
|
||||
}
|
||||
|
@ -1175,35 +1170,3 @@ func TestClearContractAdmin(t *testing.T) {
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
type InitMsg struct {
|
||||
Verifier sdk.AccAddress `json:"verifier"`
|
||||
Beneficiary sdk.AccAddress `json:"beneficiary"`
|
||||
}
|
||||
|
||||
func createFakeFundedAccount(t *testing.T, ctx sdk.Context, am authkeeper.AccountKeeper, bank bankkeeper.Keeper, coins sdk.Coins) sdk.AccAddress {
|
||||
_, _, addr := keyPubAddr()
|
||||
fundAccounts(t, ctx, am, bank, addr, coins)
|
||||
return addr
|
||||
}
|
||||
|
||||
func fundAccounts(t *testing.T, ctx sdk.Context, am authkeeper.AccountKeeper, bank bankkeeper.Keeper, addr sdk.AccAddress, coins sdk.Coins) {
|
||||
acc := am.NewAccountWithAddress(ctx, addr)
|
||||
am.SetAccount(ctx, acc)
|
||||
require.NoError(t, bank.SetBalances(ctx, addr, coins))
|
||||
}
|
||||
|
||||
var keyCounter uint64 = 0
|
||||
|
||||
// we need to make this deterministic (same every test run), as encoded address size and thus gas cost,
|
||||
// depends on the actual bytes (due to ugly CanonicalAddress encoding)
|
||||
func keyPubAddr() (crypto.PrivKey, crypto.PubKey, sdk.AccAddress) {
|
||||
keyCounter++
|
||||
seed := make([]byte, 8)
|
||||
binary.BigEndian.PutUint64(seed, keyCounter)
|
||||
|
||||
key := ed25519.GenPrivKeyFromSecret(seed)
|
||||
pub := key.PubKey()
|
||||
addr := sdk.AccAddress(pub.Address())
|
||||
return key, pub, addr
|
||||
}
|
||||
|
|
|
@ -0,0 +1,120 @@
|
|||
package keeper
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"reflect"
|
||||
"strconv"
|
||||
|
||||
"github.com/CosmWasm/wasmd/x/wasm/internal/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
)
|
||||
|
||||
const (
|
||||
QueryListContractByCode = "list-contracts-by-code"
|
||||
QueryGetContract = "contract-info"
|
||||
QueryGetContractState = "contract-state"
|
||||
QueryGetCode = "code"
|
||||
QueryListCode = "list-code"
|
||||
QueryContractHistory = "contract-history"
|
||||
)
|
||||
|
||||
const (
|
||||
QueryMethodContractStateSmart = "smart"
|
||||
QueryMethodContractStateAll = "all"
|
||||
QueryMethodContractStateRaw = "raw"
|
||||
)
|
||||
|
||||
// NewLegacyQuerier creates a new querier
|
||||
func NewLegacyQuerier(keeper Keeper) sdk.Querier {
|
||||
return func(ctx sdk.Context, path []string, req abci.RequestQuery) ([]byte, error) {
|
||||
var (
|
||||
rsp interface{}
|
||||
err error
|
||||
)
|
||||
switch path[0] {
|
||||
case QueryGetContract:
|
||||
addr, err := sdk.AccAddressFromBech32(path[1])
|
||||
if err != nil {
|
||||
return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, err.Error())
|
||||
}
|
||||
rsp, err = queryContractInfo(ctx, addr, keeper)
|
||||
case QueryListContractByCode:
|
||||
codeID, err := strconv.ParseUint(path[1], 10, 64)
|
||||
if err != nil {
|
||||
return nil, sdkerrors.Wrapf(types.ErrInvalid, "code id: %s", err.Error())
|
||||
}
|
||||
rsp, err = queryContractListByCode(ctx, codeID, keeper)
|
||||
case QueryGetContractState:
|
||||
if len(path) < 3 {
|
||||
return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, "unknown data query endpoint")
|
||||
}
|
||||
return queryContractState(ctx, path[1], path[2], req.Data, keeper)
|
||||
case QueryGetCode:
|
||||
codeID, err := strconv.ParseUint(path[1], 10, 64)
|
||||
if err != nil {
|
||||
return nil, sdkerrors.Wrapf(types.ErrInvalid, "code id: %s", err.Error())
|
||||
}
|
||||
rsp, err = queryCode(ctx, codeID, keeper)
|
||||
case QueryListCode:
|
||||
rsp, err = queryCodeList(ctx, keeper)
|
||||
case QueryContractHistory:
|
||||
contractAddr, err := sdk.AccAddressFromBech32(path[1])
|
||||
if err != nil {
|
||||
return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, err.Error())
|
||||
}
|
||||
rsp, err = queryContractHistory(ctx, contractAddr, keeper)
|
||||
default:
|
||||
return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, "unknown data query endpoint")
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if rsp == nil || reflect.ValueOf(rsp).IsNil() {
|
||||
return nil, nil
|
||||
}
|
||||
bz, err := json.MarshalIndent(rsp, "", " ")
|
||||
if err != nil {
|
||||
return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error())
|
||||
}
|
||||
return bz, nil
|
||||
}
|
||||
}
|
||||
|
||||
func queryContractState(ctx sdk.Context, bech, queryMethod string, data []byte, keeper Keeper) (json.RawMessage, error) {
|
||||
contractAddr, err := sdk.AccAddressFromBech32(bech)
|
||||
if err != nil {
|
||||
return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, bech)
|
||||
}
|
||||
|
||||
var resultData []types.Model
|
||||
switch queryMethod {
|
||||
case QueryMethodContractStateAll:
|
||||
// this returns a serialized json object (which internally encoded binary fields properly)
|
||||
for iter := keeper.GetContractState(ctx, contractAddr); iter.Valid(); iter.Next() {
|
||||
resultData = append(resultData, types.Model{
|
||||
Key: iter.Key(),
|
||||
Value: iter.Value(),
|
||||
})
|
||||
}
|
||||
if resultData == nil {
|
||||
resultData = make([]types.Model, 0)
|
||||
}
|
||||
case QueryMethodContractStateRaw:
|
||||
// this returns the raw data from the state, base64-encoded
|
||||
return keeper.QueryRaw(ctx, contractAddr, data), nil
|
||||
case QueryMethodContractStateSmart:
|
||||
// we enforce a subjective gas limit on all queries to avoid infinite loops
|
||||
ctx = ctx.WithGasMeter(sdk.NewGasMeter(keeper.queryGasLimit))
|
||||
// this returns raw bytes (must be base64-encoded)
|
||||
return keeper.QuerySmart(ctx, contractAddr, data)
|
||||
default:
|
||||
return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, queryMethod)
|
||||
}
|
||||
bz, err := json.Marshal(resultData)
|
||||
if err != nil {
|
||||
return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error())
|
||||
}
|
||||
return bz, nil
|
||||
}
|
|
@ -0,0 +1,378 @@
|
|||
package keeper
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/CosmWasm/wasmd/x/wasm/internal/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
sdkErrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
)
|
||||
|
||||
func TestLegacyQueryContractState(t *testing.T) {
|
||||
tempDir, err := ioutil.TempDir("", "wasm")
|
||||
require.NoError(t, err)
|
||||
defer os.RemoveAll(tempDir)
|
||||
ctx, keepers := CreateTestInput(t, false, tempDir, SupportedFeatures, nil, nil)
|
||||
accKeeper, keeper, bankKeeper := keepers.AccountKeeper, keepers.WasmKeeper, keepers.BankKeeper
|
||||
|
||||
deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000))
|
||||
topUp := sdk.NewCoins(sdk.NewInt64Coin("denom", 5000))
|
||||
creator := createFakeFundedAccount(t, ctx, accKeeper, bankKeeper, deposit.Add(deposit...))
|
||||
anyAddr := createFakeFundedAccount(t, ctx, accKeeper, bankKeeper, topUp)
|
||||
|
||||
wasmCode, err := ioutil.ReadFile("./testdata/hackatom.wasm")
|
||||
require.NoError(t, err)
|
||||
|
||||
contractID, err := keeper.Create(ctx, creator, wasmCode, "", "", nil)
|
||||
require.NoError(t, err)
|
||||
|
||||
_, _, bob := keyPubAddr()
|
||||
initMsg := HackatomExampleInitMsg{
|
||||
Verifier: anyAddr,
|
||||
Beneficiary: bob,
|
||||
}
|
||||
initMsgBz, err := json.Marshal(initMsg)
|
||||
require.NoError(t, err)
|
||||
|
||||
addr, err := keeper.Instantiate(ctx, contractID, creator, nil, initMsgBz, "demo contract to query", deposit)
|
||||
require.NoError(t, err)
|
||||
|
||||
contractModel := []types.Model{
|
||||
{Key: []byte("foo"), Value: []byte(`"bar"`)},
|
||||
{Key: []byte{0x0, 0x1}, Value: []byte(`{"count":8}`)},
|
||||
}
|
||||
keeper.importContractState(ctx, addr, contractModel)
|
||||
|
||||
// this gets us full error, not redacted sdk.Error
|
||||
q := NewLegacyQuerier(keeper)
|
||||
specs := map[string]struct {
|
||||
srcPath []string
|
||||
srcReq abci.RequestQuery
|
||||
// smart and raw queries (not all queries) return raw bytes from contract not []types.Model
|
||||
// if this is set, then we just compare - (should be json encoded string)
|
||||
expRes []byte
|
||||
// if success and expSmartRes is not set, we parse into []types.Model and compare (all state)
|
||||
expModelLen int
|
||||
expModelContains []types.Model
|
||||
expErr *sdkErrors.Error
|
||||
}{
|
||||
"query all": {
|
||||
srcPath: []string{QueryGetContractState, addr.String(), QueryMethodContractStateAll},
|
||||
expModelLen: 3,
|
||||
expModelContains: []types.Model{
|
||||
{Key: []byte("foo"), Value: []byte(`"bar"`)},
|
||||
{Key: []byte{0x0, 0x1}, Value: []byte(`{"count":8}`)},
|
||||
},
|
||||
},
|
||||
"query raw key": {
|
||||
srcPath: []string{QueryGetContractState, addr.String(), QueryMethodContractStateRaw},
|
||||
srcReq: abci.RequestQuery{Data: []byte("foo")},
|
||||
expRes: []byte(`"bar"`),
|
||||
},
|
||||
"query raw binary key": {
|
||||
srcPath: []string{QueryGetContractState, addr.String(), QueryMethodContractStateRaw},
|
||||
srcReq: abci.RequestQuery{Data: []byte{0x0, 0x1}},
|
||||
expRes: []byte(`{"count":8}`),
|
||||
},
|
||||
"query smart": {
|
||||
srcPath: []string{QueryGetContractState, addr.String(), QueryMethodContractStateSmart},
|
||||
srcReq: abci.RequestQuery{Data: []byte(`{"verifier":{}}`)},
|
||||
expRes: []byte(fmt.Sprintf(`{"verifier":"%s"}`, anyAddr.String())),
|
||||
},
|
||||
"query smart invalid request": {
|
||||
srcPath: []string{QueryGetContractState, addr.String(), QueryMethodContractStateSmart},
|
||||
srcReq: abci.RequestQuery{Data: []byte(`{"raw":{"key":"config"}}`)},
|
||||
expErr: types.ErrQueryFailed,
|
||||
},
|
||||
"query smart with invalid json": {
|
||||
srcPath: []string{QueryGetContractState, addr.String(), QueryMethodContractStateSmart},
|
||||
srcReq: abci.RequestQuery{Data: []byte(`not a json string`)},
|
||||
expErr: types.ErrQueryFailed,
|
||||
},
|
||||
"query non-existent raw key": {
|
||||
srcPath: []string{QueryGetContractState, addr.String(), QueryMethodContractStateRaw},
|
||||
srcReq: abci.RequestQuery{Data: []byte("i do not exist")},
|
||||
expRes: nil,
|
||||
},
|
||||
"query empty raw key": {
|
||||
srcPath: []string{QueryGetContractState, addr.String(), QueryMethodContractStateRaw},
|
||||
srcReq: abci.RequestQuery{Data: []byte("")},
|
||||
expRes: nil,
|
||||
},
|
||||
"query nil raw key": {
|
||||
srcPath: []string{QueryGetContractState, addr.String(), QueryMethodContractStateRaw},
|
||||
srcReq: abci.RequestQuery{Data: nil},
|
||||
expRes: nil,
|
||||
},
|
||||
"query raw with unknown address": {
|
||||
srcPath: []string{QueryGetContractState, anyAddr.String(), QueryMethodContractStateRaw},
|
||||
expRes: nil,
|
||||
},
|
||||
"query all with unknown address": {
|
||||
srcPath: []string{QueryGetContractState, anyAddr.String(), QueryMethodContractStateAll},
|
||||
expModelLen: 0,
|
||||
},
|
||||
"query smart with unknown address": {
|
||||
srcPath: []string{QueryGetContractState, anyAddr.String(), QueryMethodContractStateSmart},
|
||||
expModelLen: 0,
|
||||
expErr: types.ErrNotFound,
|
||||
},
|
||||
}
|
||||
|
||||
for msg, spec := range specs {
|
||||
t.Run(msg, func(t *testing.T) {
|
||||
binResult, err := q(ctx, spec.srcPath, spec.srcReq)
|
||||
// require.True(t, spec.expErr.Is(err), "unexpected error")
|
||||
require.True(t, spec.expErr.Is(err), err)
|
||||
|
||||
// if smart query, check custom response
|
||||
if spec.srcPath[2] != QueryMethodContractStateAll {
|
||||
require.Equal(t, spec.expRes, binResult)
|
||||
return
|
||||
}
|
||||
|
||||
// otherwise, check returned models
|
||||
var r []types.Model
|
||||
if spec.expErr == nil {
|
||||
require.NoError(t, json.Unmarshal(binResult, &r))
|
||||
require.NotNil(t, r)
|
||||
}
|
||||
require.Len(t, r, spec.expModelLen)
|
||||
// and in result set
|
||||
for _, v := range spec.expModelContains {
|
||||
assert.Contains(t, r, v)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestLegacyQueryContractListByCodeOrdering(t *testing.T) {
|
||||
tempDir, err := ioutil.TempDir("", "wasm")
|
||||
require.NoError(t, err)
|
||||
defer os.RemoveAll(tempDir)
|
||||
ctx, keepers := CreateTestInput(t, false, tempDir, SupportedFeatures, nil, nil)
|
||||
accKeeper, keeper, bankKeeper := keepers.AccountKeeper, keepers.WasmKeeper, keepers.BankKeeper
|
||||
|
||||
deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 1000000))
|
||||
topUp := sdk.NewCoins(sdk.NewInt64Coin("denom", 500))
|
||||
creator := createFakeFundedAccount(t, ctx, accKeeper, bankKeeper, deposit)
|
||||
anyAddr := createFakeFundedAccount(t, ctx, accKeeper, bankKeeper, topUp)
|
||||
|
||||
wasmCode, err := ioutil.ReadFile("./testdata/hackatom.wasm")
|
||||
require.NoError(t, err)
|
||||
|
||||
codeID, err := keeper.Create(ctx, creator, wasmCode, "", "", nil)
|
||||
require.NoError(t, err)
|
||||
|
||||
_, _, bob := keyPubAddr()
|
||||
initMsg := HackatomExampleInitMsg{
|
||||
Verifier: anyAddr,
|
||||
Beneficiary: bob,
|
||||
}
|
||||
initMsgBz, err := json.Marshal(initMsg)
|
||||
require.NoError(t, err)
|
||||
|
||||
// manage some realistic block settings
|
||||
var h int64 = 10
|
||||
setBlock := func(ctx sdk.Context, height int64) sdk.Context {
|
||||
ctx = ctx.WithBlockHeight(height)
|
||||
meter := sdk.NewGasMeter(1000000)
|
||||
ctx = ctx.WithGasMeter(meter)
|
||||
ctx = ctx.WithBlockGasMeter(meter)
|
||||
return ctx
|
||||
}
|
||||
|
||||
// create 10 contracts with real block/gas setup
|
||||
for i := range [10]int{} {
|
||||
// 3 tx per block, so we ensure both comparisons work
|
||||
if i%3 == 0 {
|
||||
ctx = setBlock(ctx, h)
|
||||
h++
|
||||
}
|
||||
_, err = keeper.Instantiate(ctx, codeID, creator, nil, initMsgBz, fmt.Sprintf("contract %d", i), topUp)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
// query and check the results are properly sorted
|
||||
q := NewLegacyQuerier(keeper)
|
||||
query := []string{QueryListContractByCode, fmt.Sprintf("%d", codeID)}
|
||||
data := abci.RequestQuery{}
|
||||
res, err := q(ctx, query, data)
|
||||
require.NoError(t, err)
|
||||
|
||||
var contracts []map[string]interface{}
|
||||
err = json.Unmarshal(res, &contracts)
|
||||
require.NoError(t, err)
|
||||
|
||||
require.Equal(t, 10, len(contracts))
|
||||
|
||||
for i, contract := range contracts {
|
||||
assert.Equal(t, fmt.Sprintf("contract %d", i), contract["label"])
|
||||
assert.NotEmpty(t, contract["address"])
|
||||
// ensure these are not shown
|
||||
assert.Nil(t, contract["created"])
|
||||
}
|
||||
}
|
||||
|
||||
func TestLegacyQueryContractHistory(t *testing.T) {
|
||||
tempDir, err := ioutil.TempDir("", "wasm")
|
||||
require.NoError(t, err)
|
||||
defer os.RemoveAll(tempDir)
|
||||
ctx, keepers := CreateTestInput(t, false, tempDir, SupportedFeatures, nil, nil)
|
||||
keeper := keepers.WasmKeeper
|
||||
|
||||
var (
|
||||
otherAddr sdk.AccAddress = bytes.Repeat([]byte{0x2}, sdk.AddrLen)
|
||||
)
|
||||
|
||||
specs := map[string]struct {
|
||||
srcQueryAddr sdk.AccAddress
|
||||
srcHistory []types.ContractCodeHistoryEntry
|
||||
expContent []types.ContractCodeHistoryEntry
|
||||
}{
|
||||
"response with internal fields cleared": {
|
||||
srcHistory: []types.ContractCodeHistoryEntry{{
|
||||
Operation: types.ContractCodeHistoryTypeGenesis,
|
||||
CodeID: firstCodeID,
|
||||
Updated: types.NewAbsoluteTxPosition(ctx),
|
||||
Msg: []byte(`"init message"`),
|
||||
}},
|
||||
expContent: []types.ContractCodeHistoryEntry{{
|
||||
Operation: types.ContractCodeHistoryTypeGenesis,
|
||||
CodeID: firstCodeID,
|
||||
Msg: []byte(`"init message"`),
|
||||
}},
|
||||
},
|
||||
"response with multiple entries": {
|
||||
srcHistory: []types.ContractCodeHistoryEntry{{
|
||||
Operation: types.ContractCodeHistoryTypeInit,
|
||||
CodeID: firstCodeID,
|
||||
Updated: types.NewAbsoluteTxPosition(ctx),
|
||||
Msg: []byte(`"init message"`),
|
||||
}, {
|
||||
Operation: types.ContractCodeHistoryTypeMigrate,
|
||||
CodeID: 2,
|
||||
Updated: types.NewAbsoluteTxPosition(ctx),
|
||||
Msg: []byte(`"migrate message 1"`),
|
||||
}, {
|
||||
Operation: types.ContractCodeHistoryTypeMigrate,
|
||||
CodeID: 3,
|
||||
Updated: types.NewAbsoluteTxPosition(ctx),
|
||||
Msg: []byte(`"migrate message 2"`),
|
||||
}},
|
||||
expContent: []types.ContractCodeHistoryEntry{{
|
||||
Operation: types.ContractCodeHistoryTypeInit,
|
||||
CodeID: firstCodeID,
|
||||
Msg: []byte(`"init message"`),
|
||||
}, {
|
||||
Operation: types.ContractCodeHistoryTypeMigrate,
|
||||
CodeID: 2,
|
||||
Msg: []byte(`"migrate message 1"`),
|
||||
}, {
|
||||
Operation: types.ContractCodeHistoryTypeMigrate,
|
||||
CodeID: 3,
|
||||
Msg: []byte(`"migrate message 2"`),
|
||||
}},
|
||||
},
|
||||
"unknown contract address": {
|
||||
srcQueryAddr: otherAddr,
|
||||
srcHistory: []types.ContractCodeHistoryEntry{{
|
||||
Operation: types.ContractCodeHistoryTypeGenesis,
|
||||
CodeID: firstCodeID,
|
||||
Updated: types.NewAbsoluteTxPosition(ctx),
|
||||
Msg: []byte(`"init message"`),
|
||||
}},
|
||||
expContent: nil,
|
||||
},
|
||||
}
|
||||
for msg, spec := range specs {
|
||||
t.Run(msg, func(t *testing.T) {
|
||||
_, _, myContractAddr := keyPubAddr()
|
||||
keeper.appendToContractHistory(ctx, myContractAddr, spec.srcHistory...)
|
||||
q := NewLegacyQuerier(keeper)
|
||||
queryContractAddr := spec.srcQueryAddr
|
||||
if queryContractAddr == nil {
|
||||
queryContractAddr = myContractAddr
|
||||
}
|
||||
|
||||
// when
|
||||
query := []string{QueryContractHistory, queryContractAddr.String()}
|
||||
data := abci.RequestQuery{}
|
||||
resData, err := q(ctx, query, data)
|
||||
|
||||
// then
|
||||
require.NoError(t, err)
|
||||
if spec.expContent == nil {
|
||||
require.Nil(t, resData)
|
||||
return
|
||||
}
|
||||
var got []types.ContractCodeHistoryEntry
|
||||
err = json.Unmarshal(resData, &got)
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Equal(t, spec.expContent, got)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestLegacyQueryCodeList(t *testing.T) {
|
||||
wasmCode, err := ioutil.ReadFile("./testdata/hackatom.wasm")
|
||||
require.NoError(t, err)
|
||||
|
||||
specs := map[string]struct {
|
||||
codeIDs []uint64
|
||||
}{
|
||||
"none": {},
|
||||
"no gaps": {
|
||||
codeIDs: []uint64{1, 2, 3},
|
||||
},
|
||||
"with gaps": {
|
||||
codeIDs: []uint64{2, 4, 6},
|
||||
},
|
||||
}
|
||||
|
||||
for msg, spec := range specs {
|
||||
t.Run(msg, func(t *testing.T) {
|
||||
tempDir, err := ioutil.TempDir("", "wasm")
|
||||
require.NoError(t, err)
|
||||
defer os.RemoveAll(tempDir)
|
||||
ctx, keepers := CreateTestInput(t, false, tempDir, SupportedFeatures, nil, nil)
|
||||
keeper := keepers.WasmKeeper
|
||||
|
||||
for _, codeID := range spec.codeIDs {
|
||||
require.NoError(t, keeper.importCode(ctx, codeID,
|
||||
types.CodeInfoFixture(types.WithSHA256CodeHash(wasmCode)),
|
||||
wasmCode),
|
||||
)
|
||||
}
|
||||
q := NewLegacyQuerier(keeper)
|
||||
// when
|
||||
query := []string{QueryListCode}
|
||||
data := abci.RequestQuery{}
|
||||
resData, err := q(ctx, query, data)
|
||||
|
||||
// then
|
||||
require.NoError(t, err)
|
||||
if len(spec.codeIDs) == 0 {
|
||||
require.Nil(t, resData)
|
||||
return
|
||||
}
|
||||
|
||||
var got []map[string]interface{}
|
||||
err = json.Unmarshal(resData, &got)
|
||||
require.NoError(t, err)
|
||||
require.Len(t, got, len(spec.codeIDs))
|
||||
for i, exp := range spec.codeIDs {
|
||||
assert.EqualValues(t, exp, got[i]["id"])
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
|
@ -2,85 +2,14 @@ package keeper
|
|||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"reflect"
|
||||
"sort"
|
||||
"strconv"
|
||||
|
||||
"github.com/CosmWasm/wasmd/x/wasm/internal/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||
types2 "github.com/gogo/protobuf/types"
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
"github.com/golang/protobuf/ptypes/empty"
|
||||
)
|
||||
|
||||
const (
|
||||
QueryListContractByCode = "list-contracts-by-code"
|
||||
QueryGetContract = "contract-info"
|
||||
QueryGetContractState = "contract-state"
|
||||
QueryGetCode = "code"
|
||||
QueryListCode = "list-code"
|
||||
QueryContractHistory = "contract-history"
|
||||
)
|
||||
|
||||
const (
|
||||
QueryMethodContractStateSmart = "smart"
|
||||
QueryMethodContractStateAll = "all"
|
||||
QueryMethodContractStateRaw = "raw"
|
||||
)
|
||||
|
||||
// NewLegacyQuerier creates a new querier
|
||||
func NewLegacyQuerier(keeper Keeper) sdk.Querier {
|
||||
return func(ctx sdk.Context, path []string, req abci.RequestQuery) ([]byte, error) {
|
||||
var (
|
||||
rsp interface{}
|
||||
err error
|
||||
)
|
||||
switch path[0] {
|
||||
case QueryGetContract:
|
||||
addr, err2 := sdk.AccAddressFromBech32(path[1])
|
||||
if err2 != nil {
|
||||
return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, err2.Error())
|
||||
}
|
||||
rsp, err = queryContractInfo(ctx, addr, keeper)
|
||||
case QueryListContractByCode:
|
||||
codeID, err2 := strconv.ParseUint(path[1], 10, 64)
|
||||
if err2 != nil {
|
||||
return nil, err2
|
||||
}
|
||||
rsp, err = queryContractListByCode(ctx, codeID, keeper)
|
||||
case QueryGetContractState:
|
||||
if len(path) < 3 {
|
||||
return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, "unknown data query endpoint")
|
||||
}
|
||||
return queryContractState(ctx, path[1], path[2], req.Data, keeper)
|
||||
case QueryGetCode:
|
||||
codeID, err2 := strconv.ParseUint(path[1], 10, 64)
|
||||
if err2 != nil {
|
||||
return nil, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "invalid codeID: %s", err2.Error())
|
||||
}
|
||||
rsp, err = queryCode(ctx, codeID, keeper)
|
||||
case QueryListCode:
|
||||
rsp, err = queryCodeList(ctx, keeper)
|
||||
case QueryContractHistory:
|
||||
rsp, err = queryContractHistory(ctx, path[1], keeper)
|
||||
default:
|
||||
return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, "unknown data query endpoint")
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if rsp == nil || reflect.ValueOf(rsp).IsNil() {
|
||||
return nil, nil
|
||||
}
|
||||
bz, err := json.MarshalIndent(rsp, "", " ")
|
||||
if err != nil {
|
||||
return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error())
|
||||
}
|
||||
return bz, nil
|
||||
}
|
||||
}
|
||||
|
||||
type grpcQuerier struct {
|
||||
keeper Keeper
|
||||
}
|
||||
|
@ -107,11 +36,27 @@ func (q grpcQuerier) ContractInfo(c context.Context, req *types.QueryContractInf
|
|||
}, nil
|
||||
}
|
||||
|
||||
func (q grpcQuerier) ContractHistory(c context.Context, req *types.QueryContractHistoryRequest) (*types.QueryContractHistoryResponse, error) {
|
||||
if err := sdk.VerifyAddressFormat(req.Address); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
rsp, err := queryContractHistory(sdk.UnwrapSDKContext(c), req.Address, q.keeper)
|
||||
switch {
|
||||
case err != nil:
|
||||
return nil, err
|
||||
case rsp == nil:
|
||||
return nil, types.ErrNotFound
|
||||
}
|
||||
return &types.QueryContractHistoryResponse{
|
||||
Entries: rsp,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (q grpcQuerier) ContractsByCode(c context.Context, req *types.QueryContractsByCodeRequest) (*types.QueryContractsByCodeResponse, error) {
|
||||
if req.CodeID == 0 {
|
||||
if req.CodeId == 0 {
|
||||
return nil, sdkerrors.Wrap(types.ErrInvalid, "code id")
|
||||
}
|
||||
rsp, err := queryContractListByCode(sdk.UnwrapSDKContext(c), req.CodeID, q.keeper)
|
||||
rsp, err := queryContractListByCode(sdk.UnwrapSDKContext(c), req.CodeId, q.keeper)
|
||||
switch {
|
||||
case err != nil:
|
||||
return nil, err
|
||||
|
@ -124,10 +69,10 @@ func (q grpcQuerier) ContractsByCode(c context.Context, req *types.QueryContract
|
|||
}
|
||||
|
||||
func (q grpcQuerier) AllContractState(c context.Context, req *types.QueryAllContractStateRequest) (*types.QueryAllContractStateResponse, error) {
|
||||
ctx := sdk.UnwrapSDKContext(c)
|
||||
if err := sdk.VerifyAddressFormat(req.Address); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ctx := sdk.UnwrapSDKContext(c)
|
||||
if !q.keeper.containsContractInfo(ctx, req.Address) {
|
||||
return nil, types.ErrNotFound
|
||||
}
|
||||
|
@ -159,7 +104,8 @@ func (q grpcQuerier) SmartContractState(c context.Context, req *types.QuerySmart
|
|||
if err := sdk.VerifyAddressFormat(req.Address); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
rsp, err := q.keeper.QuerySmart(sdk.UnwrapSDKContext(c), req.Address, req.QueryData)
|
||||
ctx := sdk.UnwrapSDKContext(c).WithGasMeter(sdk.NewGasMeter(q.keeper.queryGasLimit))
|
||||
rsp, err := q.keeper.QuerySmart(ctx, req.Address, req.QueryData)
|
||||
switch {
|
||||
case err != nil:
|
||||
return nil, err
|
||||
|
@ -171,10 +117,10 @@ func (q grpcQuerier) SmartContractState(c context.Context, req *types.QuerySmart
|
|||
}
|
||||
|
||||
func (q grpcQuerier) Code(c context.Context, req *types.QueryCodeRequest) (*types.QueryCodeResponse, error) {
|
||||
if req.CodeID == 0 {
|
||||
if req.CodeId == 0 {
|
||||
return nil, sdkerrors.Wrap(types.ErrInvalid, "code id")
|
||||
}
|
||||
rsp, err := queryCode(sdk.UnwrapSDKContext(c), req.CodeID, q.keeper)
|
||||
rsp, err := queryCode(sdk.UnwrapSDKContext(c), req.CodeId, q.keeper)
|
||||
switch {
|
||||
case err != nil:
|
||||
return nil, err
|
||||
|
@ -187,7 +133,7 @@ func (q grpcQuerier) Code(c context.Context, req *types.QueryCodeRequest) (*type
|
|||
}, nil
|
||||
}
|
||||
|
||||
func (q grpcQuerier) Codes(c context.Context, _ *types2.Empty) (*types.QueryCodesResponse, error) {
|
||||
func (q grpcQuerier) Codes(c context.Context, _ *empty.Empty) (*types.QueryCodesResponse, error) {
|
||||
rsp, err := queryCodeList(sdk.UnwrapSDKContext(c), q.keeper)
|
||||
switch {
|
||||
case err != nil:
|
||||
|
@ -236,43 +182,6 @@ func queryContractListByCode(ctx sdk.Context, codeID uint64, keeper Keeper) ([]t
|
|||
return contracts, nil
|
||||
}
|
||||
|
||||
func queryContractState(ctx sdk.Context, bech, queryMethod string, data []byte, keeper Keeper) (json.RawMessage, error) {
|
||||
contractAddr, err := sdk.AccAddressFromBech32(bech)
|
||||
if err != nil {
|
||||
return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, bech)
|
||||
}
|
||||
|
||||
var resultData []types.Model
|
||||
switch queryMethod {
|
||||
case QueryMethodContractStateAll:
|
||||
// this returns a serialized json object (which internally encoded binary fields properly)
|
||||
for iter := keeper.GetContractState(ctx, contractAddr); iter.Valid(); iter.Next() {
|
||||
resultData = append(resultData, types.Model{
|
||||
Key: iter.Key(),
|
||||
Value: iter.Value(),
|
||||
})
|
||||
}
|
||||
if resultData == nil {
|
||||
resultData = make([]types.Model, 0)
|
||||
}
|
||||
case QueryMethodContractStateRaw:
|
||||
// this returns the raw data from the state, base64-encoded
|
||||
return keeper.QueryRaw(ctx, contractAddr, data), nil
|
||||
case QueryMethodContractStateSmart:
|
||||
// we enforce a subjective gas limit on all queries to avoid infinite loops
|
||||
ctx = ctx.WithGasMeter(sdk.NewGasMeter(keeper.queryGasLimit))
|
||||
// this returns raw bytes (must be base64-encoded)
|
||||
return keeper.QuerySmart(ctx, contractAddr, data)
|
||||
default:
|
||||
return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, queryMethod)
|
||||
}
|
||||
bz, err := json.Marshal(resultData)
|
||||
if err != nil {
|
||||
return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error())
|
||||
}
|
||||
return bz, nil
|
||||
}
|
||||
|
||||
func queryCode(ctx sdk.Context, codeID uint64, keeper Keeper) (*types.QueryCodeResponse, error) {
|
||||
if codeID == 0 {
|
||||
return nil, nil
|
||||
|
@ -313,11 +222,7 @@ func queryCodeList(ctx sdk.Context, keeper Keeper) ([]types.CodeInfoResponse, er
|
|||
return info, nil
|
||||
}
|
||||
|
||||
func queryContractHistory(ctx sdk.Context, bech string, keeper Keeper) ([]types.ContractCodeHistoryEntry, error) {
|
||||
contractAddr, err := sdk.AccAddressFromBech32(bech)
|
||||
if err != nil {
|
||||
return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, err.Error())
|
||||
}
|
||||
func queryContractHistory(ctx sdk.Context, contractAddr sdk.AccAddress, keeper Keeper) ([]types.ContractCodeHistoryEntry, error) {
|
||||
history := keeper.GetContractHistory(ctx, contractAddr)
|
||||
if history.CodeHistoryEntries == nil {
|
||||
// nil, nil leads to 404 in rest handler
|
||||
|
|
|
@ -13,148 +13,157 @@ import (
|
|||
sdkErrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
)
|
||||
|
||||
func TestQueryContractState(t *testing.T) {
|
||||
func TestQueryAllContractState(t *testing.T) {
|
||||
tempDir, err := ioutil.TempDir("", "wasm")
|
||||
require.NoError(t, err)
|
||||
defer os.RemoveAll(tempDir)
|
||||
ctx, keepers := CreateTestInput(t, false, tempDir, SupportedFeatures, nil, nil)
|
||||
accKeeper, keeper, bankKeeper := keepers.AccountKeeper, keepers.WasmKeeper, keepers.BankKeeper
|
||||
|
||||
deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000))
|
||||
topUp := sdk.NewCoins(sdk.NewInt64Coin("denom", 5000))
|
||||
creator := createFakeFundedAccount(t, ctx, accKeeper, bankKeeper, deposit.Add(deposit...))
|
||||
anyAddr := createFakeFundedAccount(t, ctx, accKeeper, bankKeeper, topUp)
|
||||
|
||||
wasmCode, err := ioutil.ReadFile("./testdata/hackatom.wasm")
|
||||
require.NoError(t, err)
|
||||
|
||||
contractID, err := keeper.Create(ctx, creator, wasmCode, "", "", nil)
|
||||
require.NoError(t, err)
|
||||
|
||||
_, _, bob := keyPubAddr()
|
||||
initMsg := InitMsg{
|
||||
Verifier: anyAddr,
|
||||
Beneficiary: bob,
|
||||
}
|
||||
initMsgBz, err := json.Marshal(initMsg)
|
||||
require.NoError(t, err)
|
||||
|
||||
addr, err := keeper.Instantiate(ctx, contractID, creator, nil, initMsgBz, "demo contract to query", deposit)
|
||||
require.NoError(t, err)
|
||||
|
||||
exampleContract := InstantiateHackatomExampleContract(t, ctx, accKeeper, bankKeeper, err, keeper)
|
||||
contractAddr := exampleContract.Contract
|
||||
contractModel := []types.Model{
|
||||
{Key: []byte("foo"), Value: []byte(`"bar"`)},
|
||||
{Key: []byte{0x0, 0x1}, Value: []byte(`{"count":8}`)},
|
||||
}
|
||||
keeper.importContractState(ctx, addr, contractModel)
|
||||
keeper.importContractState(ctx, contractAddr, contractModel)
|
||||
|
||||
// this gets us full error, not redacted sdk.Error
|
||||
q := NewLegacyQuerier(keeper)
|
||||
q := NewQuerier(keeper)
|
||||
specs := map[string]struct {
|
||||
srcPath []string
|
||||
srcReq abci.RequestQuery
|
||||
// smart and raw queries (not all queries) return raw bytes from contract not []types.Model
|
||||
// if this is set, then we just compare - (should be json encoded string)
|
||||
expRes []byte
|
||||
// if success and expSmartRes is not set, we parse into []types.Model and compare (all state)
|
||||
expModelLen int
|
||||
srcQuery *types.QueryAllContractStateRequest
|
||||
expModelContains []types.Model
|
||||
expErr *sdkErrors.Error
|
||||
}{
|
||||
"query all": {
|
||||
srcPath: []string{QueryGetContractState, addr.String(), QueryMethodContractStateAll},
|
||||
expModelLen: 3,
|
||||
expModelContains: []types.Model{
|
||||
{Key: []byte("foo"), Value: []byte(`"bar"`)},
|
||||
{Key: []byte{0x0, 0x1}, Value: []byte(`{"count":8}`)},
|
||||
},
|
||||
},
|
||||
"query raw key": {
|
||||
srcPath: []string{QueryGetContractState, addr.String(), QueryMethodContractStateRaw},
|
||||
srcReq: abci.RequestQuery{Data: []byte("foo")},
|
||||
expRes: []byte(`"bar"`),
|
||||
},
|
||||
"query raw binary key": {
|
||||
srcPath: []string{QueryGetContractState, addr.String(), QueryMethodContractStateRaw},
|
||||
srcReq: abci.RequestQuery{Data: []byte{0x0, 0x1}},
|
||||
expRes: []byte(`{"count":8}`),
|
||||
},
|
||||
"query smart": {
|
||||
srcPath: []string{QueryGetContractState, addr.String(), QueryMethodContractStateSmart},
|
||||
srcReq: abci.RequestQuery{Data: []byte(`{"verifier":{}}`)},
|
||||
expRes: []byte(fmt.Sprintf(`{"verifier":"%s"}`, anyAddr.String())),
|
||||
},
|
||||
"query smart invalid request": {
|
||||
srcPath: []string{QueryGetContractState, addr.String(), QueryMethodContractStateSmart},
|
||||
srcReq: abci.RequestQuery{Data: []byte(`{"raw":{"key":"config"}}`)},
|
||||
expErr: types.ErrQueryFailed,
|
||||
},
|
||||
"query smart with invalid json": {
|
||||
srcPath: []string{QueryGetContractState, addr.String(), QueryMethodContractStateSmart},
|
||||
srcReq: abci.RequestQuery{Data: []byte(`not a json string`)},
|
||||
expErr: types.ErrQueryFailed,
|
||||
},
|
||||
"query non-existent raw key": {
|
||||
srcPath: []string{QueryGetContractState, addr.String(), QueryMethodContractStateRaw},
|
||||
srcReq: abci.RequestQuery{Data: []byte("i do not exist")},
|
||||
expRes: nil,
|
||||
},
|
||||
"query empty raw key": {
|
||||
srcPath: []string{QueryGetContractState, addr.String(), QueryMethodContractStateRaw},
|
||||
srcReq: abci.RequestQuery{Data: []byte("")},
|
||||
expRes: nil,
|
||||
},
|
||||
"query nil raw key": {
|
||||
srcPath: []string{QueryGetContractState, addr.String(), QueryMethodContractStateRaw},
|
||||
srcReq: abci.RequestQuery{Data: nil},
|
||||
expRes: nil,
|
||||
},
|
||||
"query raw with unknown address": {
|
||||
srcPath: []string{QueryGetContractState, anyAddr.String(), QueryMethodContractStateRaw},
|
||||
expRes: nil,
|
||||
srcQuery: &types.QueryAllContractStateRequest{Address: contractAddr},
|
||||
expModelContains: contractModel,
|
||||
},
|
||||
"query all with unknown address": {
|
||||
srcPath: []string{QueryGetContractState, anyAddr.String(), QueryMethodContractStateAll},
|
||||
expModelLen: 0,
|
||||
},
|
||||
"query smart with unknown address": {
|
||||
srcPath: []string{QueryGetContractState, anyAddr.String(), QueryMethodContractStateSmart},
|
||||
expModelLen: 0,
|
||||
expErr: types.ErrNotFound,
|
||||
srcQuery: &types.QueryAllContractStateRequest{Address: AnyAccAddress(t)},
|
||||
expErr: types.ErrNotFound,
|
||||
},
|
||||
}
|
||||
|
||||
for msg, spec := range specs {
|
||||
t.Run(msg, func(t *testing.T) {
|
||||
binResult, err := q(ctx, spec.srcPath, spec.srcReq)
|
||||
// require.True(t, spec.expErr.Is(err), "unexpected error")
|
||||
got, err := q.AllContractState(sdk.WrapSDKContext(ctx), spec.srcQuery)
|
||||
require.True(t, spec.expErr.Is(err), err)
|
||||
|
||||
// if smart query, check custom response
|
||||
if spec.srcPath[2] != QueryMethodContractStateAll {
|
||||
require.Equal(t, spec.expRes, binResult)
|
||||
if spec.expErr != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// otherwise, check returned models
|
||||
var r []types.Model
|
||||
if spec.expErr == nil {
|
||||
require.NoError(t, json.Unmarshal(binResult, &r))
|
||||
require.NotNil(t, r)
|
||||
}
|
||||
require.Len(t, r, spec.expModelLen)
|
||||
// and in result set
|
||||
for _, v := range spec.expModelContains {
|
||||
assert.Contains(t, r, v)
|
||||
for _, exp := range spec.expModelContains {
|
||||
assert.Contains(t, got.Models, exp)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestListContractByCodeOrdering(t *testing.T) {
|
||||
func TestQuerySmartContractState(t *testing.T) {
|
||||
tempDir, err := ioutil.TempDir("", "wasm")
|
||||
require.NoError(t, err)
|
||||
defer os.RemoveAll(tempDir)
|
||||
ctx, keepers := CreateTestInput(t, false, tempDir, SupportedFeatures, nil, nil)
|
||||
accKeeper, keeper, bankKeeper := keepers.AccountKeeper, keepers.WasmKeeper, keepers.BankKeeper
|
||||
|
||||
exampleContract := InstantiateHackatomExampleContract(t, ctx, accKeeper, bankKeeper, err, keeper)
|
||||
contractAddr := exampleContract.Contract
|
||||
|
||||
q := NewQuerier(keeper)
|
||||
specs := map[string]struct {
|
||||
srcAddr sdk.AccAddress
|
||||
srcQuery *types.QuerySmartContractStateRequest
|
||||
expResp string
|
||||
expErr *sdkErrors.Error
|
||||
}{
|
||||
"query smart": {
|
||||
srcQuery: &types.QuerySmartContractStateRequest{Address: contractAddr, QueryData: []byte(`{"verifier":{}}`)},
|
||||
expResp: fmt.Sprintf(`{"verifier":"%s"}`, exampleContract.VerifierAddr.String()),
|
||||
},
|
||||
"query smart invalid request": {
|
||||
srcQuery: &types.QuerySmartContractStateRequest{Address: contractAddr, QueryData: []byte(`{"raw":{"key":"config"}}`)},
|
||||
expErr: types.ErrQueryFailed,
|
||||
},
|
||||
"query smart with invalid json": {
|
||||
srcQuery: &types.QuerySmartContractStateRequest{Address: contractAddr, QueryData: []byte(`not a json string`)},
|
||||
expErr: types.ErrQueryFailed,
|
||||
},
|
||||
"query smart with unknown address": {
|
||||
srcQuery: &types.QuerySmartContractStateRequest{Address: AnyAccAddress(t), QueryData: []byte(`{"verifier":{}}`)},
|
||||
expErr: types.ErrNotFound,
|
||||
},
|
||||
}
|
||||
for msg, spec := range specs {
|
||||
t.Run(msg, func(t *testing.T) {
|
||||
got, err := q.SmartContractState(sdk.WrapSDKContext(ctx), spec.srcQuery)
|
||||
require.True(t, spec.expErr.Is(err), err)
|
||||
if spec.expErr != nil {
|
||||
return
|
||||
}
|
||||
assert.JSONEq(t, string(got.Data), spec.expResp)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestQueryRawContractState(t *testing.T) {
|
||||
tempDir, err := ioutil.TempDir("", "wasm")
|
||||
require.NoError(t, err)
|
||||
defer os.RemoveAll(tempDir)
|
||||
ctx, keepers := CreateTestInput(t, false, tempDir, SupportedFeatures, nil, nil)
|
||||
accKeeper, keeper, bankKeeper := keepers.AccountKeeper, keepers.WasmKeeper, keepers.BankKeeper
|
||||
|
||||
exampleContract := InstantiateHackatomExampleContract(t, ctx, accKeeper, bankKeeper, err, keeper)
|
||||
contractAddr := exampleContract.Contract
|
||||
contractModel := []types.Model{
|
||||
{Key: []byte("foo"), Value: []byte(`"bar"`)},
|
||||
{Key: []byte{0x0, 0x1}, Value: []byte(`{"count":8}`)},
|
||||
}
|
||||
keeper.importContractState(ctx, contractAddr, contractModel)
|
||||
|
||||
q := NewQuerier(keeper)
|
||||
specs := map[string]struct {
|
||||
srcQuery *types.QueryRawContractStateRequest
|
||||
expData []byte
|
||||
expErr *sdkErrors.Error
|
||||
}{
|
||||
"query raw key": {
|
||||
srcQuery: &types.QueryRawContractStateRequest{Address: contractAddr, QueryData: []byte("foo")},
|
||||
expData: []byte(`"bar"`),
|
||||
},
|
||||
"query raw binary key": {
|
||||
srcQuery: &types.QueryRawContractStateRequest{Address: contractAddr, QueryData: []byte{0x0, 0x1}},
|
||||
expData: []byte(`{"count":8}`),
|
||||
},
|
||||
"query non-existent raw key": {
|
||||
srcQuery: &types.QueryRawContractStateRequest{Address: contractAddr, QueryData: []byte("not existing key")},
|
||||
expData: nil,
|
||||
},
|
||||
"query empty raw key": {
|
||||
srcQuery: &types.QueryRawContractStateRequest{Address: contractAddr, QueryData: []byte("")},
|
||||
expData: nil,
|
||||
},
|
||||
"query nil raw key": {
|
||||
srcQuery: &types.QueryRawContractStateRequest{Address: contractAddr},
|
||||
expData: nil,
|
||||
},
|
||||
"query raw with unknown address": {
|
||||
srcQuery: &types.QueryRawContractStateRequest{Address: AnyAccAddress(t), QueryData: []byte("foo")},
|
||||
expErr: types.ErrNotFound,
|
||||
},
|
||||
}
|
||||
for msg, spec := range specs {
|
||||
t.Run(msg, func(t *testing.T) {
|
||||
got, err := q.RawContractState(sdk.WrapSDKContext(ctx), spec.srcQuery)
|
||||
require.True(t, spec.expErr.Is(err), err)
|
||||
if spec.expErr != nil {
|
||||
return
|
||||
}
|
||||
assert.Equal(t, spec.expData, got.Data)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestQueryContractListByCodeOrdering(t *testing.T) {
|
||||
tempDir, err := ioutil.TempDir("", "wasm")
|
||||
require.NoError(t, err)
|
||||
defer os.RemoveAll(tempDir)
|
||||
|
@ -173,7 +182,7 @@ func TestListContractByCodeOrdering(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
|
||||
_, _, bob := keyPubAddr()
|
||||
initMsg := InitMsg{
|
||||
initMsg := HackatomExampleInitMsg{
|
||||
Verifier: anyAddr,
|
||||
Beneficiary: bob,
|
||||
}
|
||||
|
@ -202,23 +211,17 @@ func TestListContractByCodeOrdering(t *testing.T) {
|
|||
}
|
||||
|
||||
// query and check the results are properly sorted
|
||||
q := NewLegacyQuerier(keeper)
|
||||
query := []string{QueryListContractByCode, fmt.Sprintf("%d", codeID)}
|
||||
data := abci.RequestQuery{}
|
||||
res, err := q(ctx, query, data)
|
||||
q := NewQuerier(keeper)
|
||||
res, err := q.ContractsByCode(sdk.WrapSDKContext(ctx), &types.QueryContractsByCodeRequest{CodeId: codeID})
|
||||
require.NoError(t, err)
|
||||
|
||||
var contracts []map[string]interface{}
|
||||
err = json.Unmarshal(res, &contracts)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, 10, len(res.ContractInfos))
|
||||
|
||||
require.Equal(t, 10, len(contracts))
|
||||
|
||||
for i, contract := range contracts {
|
||||
assert.Equal(t, fmt.Sprintf("contract %d", i), contract["label"])
|
||||
assert.NotEmpty(t, contract["address"])
|
||||
for i, contract := range res.ContractInfos {
|
||||
assert.Equal(t, fmt.Sprintf("contract %d", i), contract.Label)
|
||||
assert.NotEmpty(t, contract.Address)
|
||||
// ensure these are not shown
|
||||
assert.Nil(t, contract["created"])
|
||||
assert.Nil(t, contract.Created)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -297,28 +300,24 @@ func TestQueryContractHistory(t *testing.T) {
|
|||
t.Run(msg, func(t *testing.T) {
|
||||
_, _, myContractAddr := keyPubAddr()
|
||||
keeper.appendToContractHistory(ctx, myContractAddr, spec.srcHistory...)
|
||||
q := NewLegacyQuerier(keeper)
|
||||
|
||||
queryContractAddr := spec.srcQueryAddr
|
||||
if queryContractAddr == nil {
|
||||
queryContractAddr = myContractAddr
|
||||
}
|
||||
req := &types.QueryContractHistoryRequest{Address: queryContractAddr}
|
||||
|
||||
// when
|
||||
query := []string{QueryContractHistory, queryContractAddr.String()}
|
||||
data := abci.RequestQuery{}
|
||||
resData, err := q(ctx, query, data)
|
||||
q := NewQuerier(keeper)
|
||||
got, err := q.ContractHistory(sdk.WrapSDKContext(ctx), req)
|
||||
|
||||
// then
|
||||
require.NoError(t, err)
|
||||
if spec.expContent == nil {
|
||||
require.Nil(t, resData)
|
||||
require.Error(t, types.ErrEmpty)
|
||||
return
|
||||
}
|
||||
var got []types.ContractCodeHistoryEntry
|
||||
err = json.Unmarshal(resData, &got)
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Equal(t, spec.expContent, got)
|
||||
assert.Equal(t, spec.expContent, got.Entries)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -353,25 +352,20 @@ func TestQueryCodeList(t *testing.T) {
|
|||
wasmCode),
|
||||
)
|
||||
}
|
||||
q := NewLegacyQuerier(keeper)
|
||||
// when
|
||||
query := []string{QueryListCode}
|
||||
data := abci.RequestQuery{}
|
||||
resData, err := q(ctx, query, data)
|
||||
q := NewQuerier(keeper)
|
||||
got, err := q.Codes(sdk.WrapSDKContext(ctx), nil)
|
||||
|
||||
// then
|
||||
require.NoError(t, err)
|
||||
if len(spec.codeIDs) == 0 {
|
||||
require.Nil(t, resData)
|
||||
require.Error(t, err)
|
||||
return
|
||||
}
|
||||
|
||||
var got []map[string]interface{}
|
||||
err = json.Unmarshal(resData, &got)
|
||||
require.NoError(t, err)
|
||||
require.Len(t, got, len(spec.codeIDs))
|
||||
|
||||
require.Len(t, got.CodeInfos, len(spec.codeIDs))
|
||||
for i, exp := range spec.codeIDs {
|
||||
assert.EqualValues(t, exp, got[i]["id"])
|
||||
assert.EqualValues(t, exp, got.CodeInfos[i].CodeID)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ func initRecurseContract(t *testing.T) (contract sdk.AccAddress, creator sdk.Acc
|
|||
// instantiate the contract
|
||||
_, _, bob := keyPubAddr()
|
||||
_, _, fred := keyPubAddr()
|
||||
initMsg := InitMsg{
|
||||
initMsg := HackatomExampleInitMsg{
|
||||
Verifier: fred,
|
||||
Beneficiary: bob,
|
||||
}
|
||||
|
|
|
@ -105,7 +105,7 @@ func TestMaskReflectContractSend(t *testing.T) {
|
|||
require.NotEmpty(t, maskAddr)
|
||||
|
||||
// now we set contract as verifier of an escrow
|
||||
initMsg := InitMsg{
|
||||
initMsg := HackatomExampleInitMsg{
|
||||
Verifier: maskAddr,
|
||||
Beneficiary: bob,
|
||||
}
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
package keeper
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
|
@ -52,14 +55,13 @@ import (
|
|||
"github.com/cosmos/cosmos-sdk/x/upgrade"
|
||||
upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
"github.com/tendermint/tendermint/crypto/ed25519"
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
|
||||
dbm "github.com/tendermint/tm-db"
|
||||
)
|
||||
|
||||
const flagLRUCacheSize = "lru_size"
|
||||
const flagQueryGasLimit = "query_gas_limit"
|
||||
|
||||
var ModuleBasics = module.NewBasicManager(
|
||||
auth.AppModuleBasic{},
|
||||
bank.AppModuleBasic{},
|
||||
|
@ -308,3 +310,87 @@ func handleExecute(ctx sdk.Context, k Keeper, msg *wasmtypes.MsgExecuteContract)
|
|||
res.Events = ctx.EventManager().Events().ToABCIEvents()
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func AnyAccAddress(t *testing.T) sdk.AccAddress {
|
||||
_, _, addr := keyPubAddr()
|
||||
return addr
|
||||
}
|
||||
|
||||
type HackatomExampleContract struct {
|
||||
InitialAmount sdk.Coins
|
||||
Contract sdk.AccAddress
|
||||
Creator crypto.PrivKey
|
||||
CreatorAddr sdk.AccAddress
|
||||
Verifier crypto.PrivKey
|
||||
VerifierAddr sdk.AccAddress
|
||||
Beneficiary crypto.PrivKey
|
||||
BeneficiaryAddr sdk.AccAddress
|
||||
}
|
||||
|
||||
// InstantiateHackatomExampleContract load and instantiate the "./testdata/hackatom.wasm" contract
|
||||
func InstantiateHackatomExampleContract(t *testing.T, ctx sdk.Context, accKeeper authkeeper.AccountKeeper, bankKeeper bankkeeper.Keeper, err error, keeper Keeper) HackatomExampleContract {
|
||||
anyAmount := sdk.NewCoins(sdk.NewInt64Coin("denom", 1000))
|
||||
creator, _, creatorAddr := keyPubAddr()
|
||||
fundAccounts(t, ctx, accKeeper, bankKeeper, creatorAddr, anyAmount)
|
||||
verifier, _, verifierAddr := keyPubAddr()
|
||||
fundAccounts(t, ctx, accKeeper, bankKeeper, verifierAddr, anyAmount)
|
||||
|
||||
wasmCode, err := ioutil.ReadFile("./testdata/hackatom.wasm")
|
||||
require.NoError(t, err)
|
||||
|
||||
contractID, err := keeper.Create(ctx, creatorAddr, wasmCode, "", "", nil)
|
||||
require.NoError(t, err)
|
||||
|
||||
beneficiary, _, beneficiaryAddr := keyPubAddr()
|
||||
initMsg := HackatomExampleInitMsg{
|
||||
Verifier: verifierAddr,
|
||||
Beneficiary: beneficiaryAddr,
|
||||
}
|
||||
initMsgBz, err := json.Marshal(initMsg)
|
||||
require.NoError(t, err)
|
||||
initialAmount := sdk.NewCoins(sdk.NewInt64Coin("denom", 100))
|
||||
contractAddr, err := keeper.Instantiate(ctx, contractID, creatorAddr, nil, initMsgBz, "demo contract to query", initialAmount)
|
||||
require.NoError(t, err)
|
||||
return HackatomExampleContract{
|
||||
InitialAmount: initialAmount,
|
||||
Contract: contractAddr,
|
||||
Creator: creator,
|
||||
CreatorAddr: creatorAddr,
|
||||
Verifier: verifier,
|
||||
VerifierAddr: verifierAddr,
|
||||
Beneficiary: beneficiary,
|
||||
BeneficiaryAddr: beneficiaryAddr,
|
||||
}
|
||||
}
|
||||
|
||||
type HackatomExampleInitMsg struct {
|
||||
Verifier sdk.AccAddress `json:"verifier"`
|
||||
Beneficiary sdk.AccAddress `json:"beneficiary"`
|
||||
}
|
||||
|
||||
func createFakeFundedAccount(t *testing.T, ctx sdk.Context, am authkeeper.AccountKeeper, bank bankkeeper.Keeper, coins sdk.Coins) sdk.AccAddress {
|
||||
_, _, addr := keyPubAddr()
|
||||
fundAccounts(t, ctx, am, bank, addr, coins)
|
||||
return addr
|
||||
}
|
||||
|
||||
func fundAccounts(t *testing.T, ctx sdk.Context, am authkeeper.AccountKeeper, bank bankkeeper.Keeper, addr sdk.AccAddress, coins sdk.Coins) {
|
||||
acc := am.NewAccountWithAddress(ctx, addr)
|
||||
am.SetAccount(ctx, acc)
|
||||
require.NoError(t, bank.SetBalances(ctx, addr, coins))
|
||||
}
|
||||
|
||||
var keyCounter uint64 = 0
|
||||
|
||||
// we need to make this deterministic (same every test run), as encoded address size and thus gas cost,
|
||||
// depends on the actual bytes (due to ugly CanonicalAddress encoding)
|
||||
func keyPubAddr() (crypto.PrivKey, crypto.PubKey, sdk.AccAddress) {
|
||||
keyCounter++
|
||||
seed := make([]byte, 8)
|
||||
binary.BigEndian.PutUint64(seed, keyCounter)
|
||||
|
||||
key := ed25519.GenPrivKeyFromSecret(seed)
|
||||
pub := key.PubKey()
|
||||
addr := sdk.AccAddress(pub.Address())
|
||||
return key, pub, addr
|
||||
}
|
||||
|
|
|
@ -12,8 +12,9 @@ import (
|
|||
_ "github.com/gogo/protobuf/gogoproto"
|
||||
grpc1 "github.com/gogo/protobuf/grpc"
|
||||
proto "github.com/gogo/protobuf/proto"
|
||||
types "github.com/gogo/protobuf/types"
|
||||
empty "github.com/golang/protobuf/ptypes/empty"
|
||||
github_com_tendermint_tendermint_libs_bytes "github.com/tendermint/tendermint/libs/bytes"
|
||||
_ "google.golang.org/genproto/googleapis/api/annotations"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
|
@ -112,15 +113,90 @@ func (m *QueryContractInfoResponse) XXX_DiscardUnknown() {
|
|||
|
||||
var xxx_messageInfo_QueryContractInfoResponse proto.InternalMessageInfo
|
||||
|
||||
type QueryContractHistoryRequest struct {
|
||||
// address is the address of the contract to query
|
||||
Address github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=address,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"address,omitempty"`
|
||||
}
|
||||
|
||||
func (m *QueryContractHistoryRequest) Reset() { *m = QueryContractHistoryRequest{} }
|
||||
func (m *QueryContractHistoryRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*QueryContractHistoryRequest) ProtoMessage() {}
|
||||
func (*QueryContractHistoryRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_845473e9a3330642, []int{2}
|
||||
}
|
||||
func (m *QueryContractHistoryRequest) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *QueryContractHistoryRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_QueryContractHistoryRequest.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 *QueryContractHistoryRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_QueryContractHistoryRequest.Merge(m, src)
|
||||
}
|
||||
func (m *QueryContractHistoryRequest) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *QueryContractHistoryRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_QueryContractHistoryRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_QueryContractHistoryRequest proto.InternalMessageInfo
|
||||
|
||||
type QueryContractHistoryResponse struct {
|
||||
Entries []ContractCodeHistoryEntry `protobuf:"bytes,1,rep,name=entries,proto3" json:"entries"`
|
||||
}
|
||||
|
||||
func (m *QueryContractHistoryResponse) Reset() { *m = QueryContractHistoryResponse{} }
|
||||
func (m *QueryContractHistoryResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*QueryContractHistoryResponse) ProtoMessage() {}
|
||||
func (*QueryContractHistoryResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_845473e9a3330642, []int{3}
|
||||
}
|
||||
func (m *QueryContractHistoryResponse) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *QueryContractHistoryResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_QueryContractHistoryResponse.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 *QueryContractHistoryResponse) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_QueryContractHistoryResponse.Merge(m, src)
|
||||
}
|
||||
func (m *QueryContractHistoryResponse) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *QueryContractHistoryResponse) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_QueryContractHistoryResponse.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_QueryContractHistoryResponse proto.InternalMessageInfo
|
||||
|
||||
type QueryContractsByCodeRequest struct {
|
||||
CodeID uint64 `protobuf:"varint,1,opt,name=code_id,json=codeId,proto3" json:"code_id,omitempty"`
|
||||
CodeId uint64 `protobuf:"varint,1,opt,name=code_id,json=codeId,proto3" json:"code_id,omitempty"`
|
||||
}
|
||||
|
||||
func (m *QueryContractsByCodeRequest) Reset() { *m = QueryContractsByCodeRequest{} }
|
||||
func (m *QueryContractsByCodeRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*QueryContractsByCodeRequest) ProtoMessage() {}
|
||||
func (*QueryContractsByCodeRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_845473e9a3330642, []int{2}
|
||||
return fileDescriptor_845473e9a3330642, []int{4}
|
||||
}
|
||||
func (m *QueryContractsByCodeRequest) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
|
@ -159,7 +235,7 @@ func (m *ContractInfoWithAddress) Reset() { *m = ContractInfoWithAddress
|
|||
func (m *ContractInfoWithAddress) String() string { return proto.CompactTextString(m) }
|
||||
func (*ContractInfoWithAddress) ProtoMessage() {}
|
||||
func (*ContractInfoWithAddress) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_845473e9a3330642, []int{3}
|
||||
return fileDescriptor_845473e9a3330642, []int{5}
|
||||
}
|
||||
func (m *ContractInfoWithAddress) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
|
@ -196,7 +272,7 @@ func (m *QueryContractsByCodeResponse) Reset() { *m = QueryContractsByCo
|
|||
func (m *QueryContractsByCodeResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*QueryContractsByCodeResponse) ProtoMessage() {}
|
||||
func (*QueryContractsByCodeResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_845473e9a3330642, []int{4}
|
||||
return fileDescriptor_845473e9a3330642, []int{6}
|
||||
}
|
||||
func (m *QueryContractsByCodeResponse) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
|
@ -234,7 +310,7 @@ func (m *QueryAllContractStateRequest) Reset() { *m = QueryAllContractSt
|
|||
func (m *QueryAllContractStateRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*QueryAllContractStateRequest) ProtoMessage() {}
|
||||
func (*QueryAllContractStateRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_845473e9a3330642, []int{5}
|
||||
return fileDescriptor_845473e9a3330642, []int{7}
|
||||
}
|
||||
func (m *QueryAllContractStateRequest) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
|
@ -271,7 +347,7 @@ func (m *QueryAllContractStateResponse) Reset() { *m = QueryAllContractS
|
|||
func (m *QueryAllContractStateResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*QueryAllContractStateResponse) ProtoMessage() {}
|
||||
func (*QueryAllContractStateResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_845473e9a3330642, []int{6}
|
||||
return fileDescriptor_845473e9a3330642, []int{8}
|
||||
}
|
||||
func (m *QueryAllContractStateResponse) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
|
@ -310,7 +386,7 @@ func (m *QueryRawContractStateRequest) Reset() { *m = QueryRawContractSt
|
|||
func (m *QueryRawContractStateRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*QueryRawContractStateRequest) ProtoMessage() {}
|
||||
func (*QueryRawContractStateRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_845473e9a3330642, []int{7}
|
||||
return fileDescriptor_845473e9a3330642, []int{9}
|
||||
}
|
||||
func (m *QueryRawContractStateRequest) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
|
@ -347,7 +423,7 @@ func (m *QueryRawContractStateResponse) Reset() { *m = QueryRawContractS
|
|||
func (m *QueryRawContractStateResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*QueryRawContractStateResponse) ProtoMessage() {}
|
||||
func (*QueryRawContractStateResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_845473e9a3330642, []int{8}
|
||||
return fileDescriptor_845473e9a3330642, []int{10}
|
||||
}
|
||||
func (m *QueryRawContractStateResponse) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
|
@ -386,7 +462,7 @@ func (m *QuerySmartContractStateRequest) Reset() { *m = QuerySmartContra
|
|||
func (m *QuerySmartContractStateRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*QuerySmartContractStateRequest) ProtoMessage() {}
|
||||
func (*QuerySmartContractStateRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_845473e9a3330642, []int{9}
|
||||
return fileDescriptor_845473e9a3330642, []int{11}
|
||||
}
|
||||
func (m *QuerySmartContractStateRequest) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
|
@ -423,7 +499,7 @@ func (m *QuerySmartContractStateResponse) Reset() { *m = QuerySmartContr
|
|||
func (m *QuerySmartContractStateResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*QuerySmartContractStateResponse) ProtoMessage() {}
|
||||
func (*QuerySmartContractStateResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_845473e9a3330642, []int{10}
|
||||
return fileDescriptor_845473e9a3330642, []int{12}
|
||||
}
|
||||
func (m *QuerySmartContractStateResponse) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
|
@ -453,14 +529,14 @@ func (m *QuerySmartContractStateResponse) XXX_DiscardUnknown() {
|
|||
var xxx_messageInfo_QuerySmartContractStateResponse proto.InternalMessageInfo
|
||||
|
||||
type QueryCodeRequest struct {
|
||||
CodeID uint64 `protobuf:"varint,1,opt,name=code_id,json=codeId,proto3" json:"code_id,omitempty"`
|
||||
CodeId uint64 `protobuf:"varint,1,opt,name=code_id,json=codeId,proto3" json:"code_id,omitempty"`
|
||||
}
|
||||
|
||||
func (m *QueryCodeRequest) Reset() { *m = QueryCodeRequest{} }
|
||||
func (m *QueryCodeRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*QueryCodeRequest) ProtoMessage() {}
|
||||
func (*QueryCodeRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_845473e9a3330642, []int{11}
|
||||
return fileDescriptor_845473e9a3330642, []int{13}
|
||||
}
|
||||
func (m *QueryCodeRequest) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
|
@ -501,7 +577,7 @@ func (m *CodeInfoResponse) Reset() { *m = CodeInfoResponse{} }
|
|||
func (m *CodeInfoResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*CodeInfoResponse) ProtoMessage() {}
|
||||
func (*CodeInfoResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_845473e9a3330642, []int{12}
|
||||
return fileDescriptor_845473e9a3330642, []int{14}
|
||||
}
|
||||
func (m *CodeInfoResponse) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
|
@ -539,7 +615,7 @@ func (m *QueryCodeResponse) Reset() { *m = QueryCodeResponse{} }
|
|||
func (m *QueryCodeResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*QueryCodeResponse) ProtoMessage() {}
|
||||
func (*QueryCodeResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_845473e9a3330642, []int{13}
|
||||
return fileDescriptor_845473e9a3330642, []int{15}
|
||||
}
|
||||
func (m *QueryCodeResponse) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
|
@ -576,7 +652,7 @@ func (m *QueryCodesResponse) Reset() { *m = QueryCodesResponse{} }
|
|||
func (m *QueryCodesResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*QueryCodesResponse) ProtoMessage() {}
|
||||
func (*QueryCodesResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_845473e9a3330642, []int{14}
|
||||
return fileDescriptor_845473e9a3330642, []int{16}
|
||||
}
|
||||
func (m *QueryCodesResponse) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
|
@ -608,6 +684,8 @@ var xxx_messageInfo_QueryCodesResponse proto.InternalMessageInfo
|
|||
func init() {
|
||||
proto.RegisterType((*QueryContractInfoRequest)(nil), "wasmd.x.wasmd.v1beta1.QueryContractInfoRequest")
|
||||
proto.RegisterType((*QueryContractInfoResponse)(nil), "wasmd.x.wasmd.v1beta1.QueryContractInfoResponse")
|
||||
proto.RegisterType((*QueryContractHistoryRequest)(nil), "wasmd.x.wasmd.v1beta1.QueryContractHistoryRequest")
|
||||
proto.RegisterType((*QueryContractHistoryResponse)(nil), "wasmd.x.wasmd.v1beta1.QueryContractHistoryResponse")
|
||||
proto.RegisterType((*QueryContractsByCodeRequest)(nil), "wasmd.x.wasmd.v1beta1.QueryContractsByCodeRequest")
|
||||
proto.RegisterType((*ContractInfoWithAddress)(nil), "wasmd.x.wasmd.v1beta1.ContractInfoWithAddress")
|
||||
proto.RegisterType((*QueryContractsByCodeResponse)(nil), "wasmd.x.wasmd.v1beta1.QueryContractsByCodeResponse")
|
||||
|
@ -626,63 +704,74 @@ func init() {
|
|||
func init() { proto.RegisterFile("x/wasm/internal/types/query.proto", fileDescriptor_845473e9a3330642) }
|
||||
|
||||
var fileDescriptor_845473e9a3330642 = []byte{
|
||||
// 891 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0xcf, 0x6f, 0xdc, 0x44,
|
||||
0x14, 0xde, 0x49, 0x37, 0x9b, 0xec, 0x6b, 0x80, 0x30, 0x82, 0x62, 0xb6, 0xa9, 0x1d, 0xdc, 0x43,
|
||||
0xb7, 0x87, 0xda, 0xf9, 0x51, 0x7e, 0x88, 0x5b, 0x9c, 0x22, 0x35, 0xa2, 0x45, 0xaa, 0x23, 0x54,
|
||||
0x89, 0x1c, 0xa2, 0xb1, 0x3d, 0xf1, 0x9a, 0xae, 0x3d, 0xa9, 0x67, 0x96, 0x24, 0x02, 0x09, 0x71,
|
||||
0xe0, 0x82, 0x38, 0x20, 0xf1, 0x4f, 0x70, 0xe3, 0x8c, 0xf8, 0x07, 0x72, 0xcc, 0x91, 0x93, 0x05,
|
||||
0x9b, 0x5b, 0xfe, 0x84, 0x9c, 0x90, 0xc7, 0xe3, 0x8d, 0x37, 0x8d, 0xb7, 0x09, 0xa2, 0x82, 0xcb,
|
||||
0x7a, 0x66, 0xe7, 0xbd, 0xef, 0x7d, 0xdf, 0x1b, 0xcf, 0xe7, 0x81, 0xf7, 0xf6, 0xed, 0x3d, 0xc2,
|
||||
0x63, 0x3b, 0x4a, 0x04, 0x4d, 0x13, 0xd2, 0xb7, 0xc5, 0xc1, 0x2e, 0xe5, 0xf6, 0xf3, 0x01, 0x4d,
|
||||
0x0f, 0xac, 0xdd, 0x94, 0x09, 0x86, 0xdf, 0xce, 0x03, 0x02, 0x6b, 0xdf, 0x2a, 0x9e, 0x5f, 0x2d,
|
||||
0x7b, 0x54, 0x90, 0xe5, 0xce, 0x5b, 0x21, 0x0b, 0x99, 0x8c, 0xb0, 0xf3, 0x51, 0x11, 0xdc, 0xa9,
|
||||
0xc1, 0x93, 0xbf, 0x2a, 0xe4, 0x66, 0xc8, 0x58, 0xd8, 0xa7, 0xb6, 0x9c, 0x79, 0x83, 0x1d, 0x9b,
|
||||
0xc6, 0xbb, 0x42, 0x15, 0x33, 0x43, 0xd0, 0x9e, 0xe4, 0xb5, 0xd7, 0x59, 0x22, 0x52, 0xe2, 0x8b,
|
||||
0x8d, 0x64, 0x87, 0xb9, 0xf4, 0xf9, 0x80, 0x72, 0x81, 0x3f, 0x85, 0x19, 0x12, 0x04, 0x29, 0xe5,
|
||||
0x5c, 0x43, 0x8b, 0xa8, 0x3b, 0xe7, 0x2c, 0x9f, 0x66, 0xc6, 0xbd, 0x30, 0x12, 0xbd, 0x81, 0x67,
|
||||
0xf9, 0x2c, 0xb6, 0x7d, 0xc6, 0x63, 0xc6, 0xd5, 0xe3, 0x1e, 0x0f, 0x9e, 0xa9, 0xba, 0x6b, 0xbe,
|
||||
0xbf, 0x56, 0x24, 0xba, 0x25, 0x82, 0xf9, 0x3b, 0x82, 0x77, 0x2f, 0xa8, 0xc4, 0x77, 0x59, 0xc2,
|
||||
0xe9, 0xbf, 0x5a, 0x0a, 0x3f, 0x81, 0xb9, 0x6a, 0x11, 0x6d, 0x6a, 0x11, 0x75, 0xaf, 0xaf, 0xdc,
|
||||
0xb6, 0x2e, 0xec, 0xab, 0x55, 0x0d, 0x75, 0x66, 0x8f, 0x32, 0x03, 0x9d, 0x64, 0x46, 0xc3, 0x1d,
|
||||
0x83, 0x30, 0x1d, 0xb8, 0x39, 0x46, 0x9e, 0x3b, 0x07, 0xeb, 0x2c, 0xa0, 0x65, 0xa7, 0x6e, 0xc3,
|
||||
0x8c, 0xcf, 0x02, 0xba, 0x1d, 0x05, 0x92, 0x7e, 0xd3, 0x81, 0x61, 0x66, 0xb4, 0xf2, 0x88, 0x8d,
|
||||
0x07, 0x6e, 0x2b, 0x5f, 0xda, 0x08, 0xcc, 0xdf, 0x10, 0xbc, 0x53, 0x05, 0x7d, 0x1a, 0x89, 0x9e,
|
||||
0xe2, 0xfe, 0xbf, 0xd7, 0xff, 0x35, 0x2c, 0x5c, 0xac, 0x5f, 0xed, 0xdf, 0x16, 0xbc, 0xee, 0xab,
|
||||
0xa5, 0xed, 0x28, 0xd9, 0x61, 0xb9, 0x8c, 0x6b, 0xdd, 0xeb, 0x2b, 0xd6, 0x25, 0x8a, 0x56, 0xfa,
|
||||
0xe0, 0x34, 0x0f, 0xf3, 0xda, 0xaf, 0xf9, 0x95, 0x65, 0x6e, 0x3e, 0x53, 0xc5, 0xd7, 0xfa, 0xfd,
|
||||
0x32, 0x6f, 0x53, 0x10, 0x41, 0x5f, 0xc9, 0x7b, 0xba, 0x05, 0xb7, 0x6a, 0x8a, 0x29, 0xa9, 0x1f,
|
||||
0x43, 0x2b, 0x66, 0x01, 0xed, 0x97, 0x12, 0x17, 0x6a, 0x24, 0x3e, 0xce, 0x83, 0x94, 0x20, 0x95,
|
||||
0x61, 0xfe, 0x80, 0x94, 0x14, 0x97, 0xec, 0xbd, 0x72, 0x29, 0xf8, 0x16, 0x80, 0xf4, 0x95, 0xed,
|
||||
0x80, 0x08, 0x22, 0xdf, 0x82, 0x39, 0xb7, 0x2d, 0xff, 0x79, 0x40, 0x04, 0x31, 0x57, 0x95, 0xd2,
|
||||
0x17, 0xb9, 0x28, 0xa5, 0x18, 0x9a, 0x32, 0x53, 0x32, 0x71, 0xe5, 0xd8, 0xfc, 0x11, 0x81, 0x2e,
|
||||
0xb3, 0x36, 0x63, 0x92, 0x8a, 0xff, 0x5c, 0xc3, 0x26, 0x18, 0xb5, 0x6c, 0x94, 0x8a, 0xa5, 0xaa,
|
||||
0x0a, 0x67, 0xe1, 0x34, 0x33, 0x34, 0x9a, 0xf8, 0x2c, 0x88, 0x92, 0xd0, 0xfe, 0x92, 0xb3, 0xc4,
|
||||
0x72, 0xc9, 0xde, 0x63, 0xca, 0x39, 0x09, 0xa9, 0xd2, 0xf8, 0x21, 0xcc, 0xab, 0x97, 0xfd, 0x8a,
|
||||
0x27, 0xfc, 0xe7, 0x29, 0x98, 0x97, 0x7f, 0x55, 0xad, 0xed, 0xee, 0xf9, 0xcc, 0xf9, 0xb3, 0xcc,
|
||||
0x93, 0xcc, 0x98, 0x8a, 0x82, 0x32, 0x3f, 0xef, 0x9c, 0x9f, 0x52, 0x22, 0x58, 0x5a, 0x28, 0xfd,
|
||||
0x47, 0x9d, 0x53, 0x08, 0xf8, 0x73, 0x68, 0xe7, 0x6a, 0xb6, 0x7b, 0x84, 0xf7, 0xb4, 0x6b, 0x12,
|
||||
0xee, 0xa3, 0xd3, 0xcc, 0xb8, 0x5f, 0x81, 0x13, 0x34, 0x09, 0x68, 0x1a, 0x47, 0x89, 0xa8, 0x0e,
|
||||
0xfb, 0x91, 0xc7, 0x6d, 0xef, 0x40, 0x50, 0x6e, 0x3d, 0xa4, 0xfb, 0x4e, 0x3e, 0x70, 0x67, 0x73,
|
||||
0xa8, 0x87, 0x84, 0xf7, 0xf0, 0x0d, 0x68, 0x71, 0x36, 0x48, 0x7d, 0xaa, 0x35, 0x17, 0x51, 0xb7,
|
||||
0xed, 0xaa, 0x19, 0xd6, 0x60, 0xc6, 0x1b, 0x44, 0xfd, 0x80, 0xa6, 0xda, 0xb4, 0x5c, 0x28, 0xa7,
|
||||
0xe6, 0x77, 0x08, 0xde, 0xac, 0xf4, 0x53, 0xb5, 0xe5, 0x33, 0x68, 0x17, 0x6d, 0xc9, 0x1d, 0x0a,
|
||||
0x49, 0x87, 0xba, 0x53, 0x6b, 0x16, 0xe3, 0x2d, 0xad, 0xb8, 0xd4, 0xac, 0xaf, 0xd6, 0xf0, 0x82,
|
||||
0xda, 0xe6, 0xa2, 0x71, 0xb3, 0x27, 0x99, 0x21, 0xe7, 0x6a, 0x4b, 0x3d, 0xc0, 0x23, 0x0a, 0x7c,
|
||||
0xc4, 0xe1, 0x11, 0xc0, 0x88, 0x43, 0x79, 0x9c, 0x2f, 0x4d, 0xa2, 0x38, 0xd9, 0xed, 0x92, 0x00,
|
||||
0x5f, 0xf9, 0xb5, 0x05, 0xd3, 0xb2, 0x08, 0xe6, 0xe3, 0x06, 0x8c, 0xed, 0x1a, 0xcc, 0xba, 0x2f,
|
||||
0x6f, 0x67, 0xe9, 0xf2, 0x09, 0x05, 0x1b, 0xb3, 0x81, 0xbf, 0x81, 0x37, 0xce, 0xb9, 0x33, 0x5e,
|
||||
0xb9, 0x0c, 0xcc, 0xf8, 0xa7, 0xac, 0xb3, 0x7a, 0xa5, 0x9c, 0x51, 0xf5, 0x6f, 0x61, 0xfe, 0xbc,
|
||||
0x63, 0xe2, 0x89, 0x50, 0x35, 0x66, 0xde, 0xb9, 0x7f, 0xb5, 0xa4, 0x2a, 0x81, 0xf3, 0x46, 0x36,
|
||||
0x99, 0x40, 0x8d, 0x05, 0x4f, 0x26, 0x50, 0xe7, 0x95, 0x66, 0x03, 0x7f, 0x8f, 0x00, 0xbf, 0x68,
|
||||
0x43, 0xf8, 0xfd, 0x49, 0x70, 0xb5, 0x26, 0xda, 0xf9, 0xe0, 0xaa, 0x69, 0x23, 0x1e, 0x5b, 0xd0,
|
||||
0x94, 0x9b, 0x7f, 0x67, 0xf2, 0x46, 0x9e, 0xed, 0x78, 0xf7, 0xe5, 0x81, 0x23, 0xf0, 0x47, 0x30,
|
||||
0x2d, 0x8f, 0x10, 0xbe, 0x61, 0x15, 0xb7, 0x4a, 0xab, 0xbc, 0x55, 0x5a, 0x9f, 0xe4, 0xb7, 0xca,
|
||||
0xce, 0xdd, 0x97, 0x81, 0xf1, 0x33, 0x34, 0xc7, 0x3d, 0xfc, 0x4b, 0x6f, 0xfc, 0x32, 0xd4, 0xd1,
|
||||
0xe1, 0x50, 0x47, 0x47, 0x43, 0x1d, 0xfd, 0x39, 0xd4, 0xd1, 0x4f, 0xc7, 0x7a, 0xe3, 0xe8, 0x58,
|
||||
0x6f, 0xfc, 0x71, 0xac, 0x37, 0xbe, 0x58, 0xaa, 0xb8, 0xd5, 0x3a, 0xe3, 0xf1, 0xd3, 0xfc, 0xae,
|
||||
0x2b, 0x91, 0xed, 0x7d, 0xf5, 0x1c, 0xbf, 0xf9, 0x7a, 0x2d, 0x49, 0x68, 0xf5, 0xef, 0x00, 0x00,
|
||||
0x00, 0xff, 0xff, 0x2b, 0xb6, 0x07, 0xc8, 0x69, 0x0b, 0x00, 0x00,
|
||||
// 1071 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x57, 0xcf, 0x6f, 0x1b, 0x45,
|
||||
0x14, 0xce, 0xa4, 0x8e, 0x13, 0x4f, 0x03, 0x98, 0x51, 0x69, 0x8d, 0xeb, 0xae, 0xc3, 0x82, 0xa8,
|
||||
0x0b, 0xea, 0x6e, 0x12, 0xb7, 0x15, 0x3f, 0x4e, 0x71, 0x5a, 0x29, 0x15, 0x14, 0xd4, 0x8d, 0x50,
|
||||
0x25, 0x7a, 0x88, 0xc6, 0xbb, 0x13, 0x7b, 0x5b, 0x7b, 0xc7, 0xdd, 0x19, 0x93, 0x58, 0x51, 0x84,
|
||||
0xe0, 0x88, 0x38, 0x20, 0xf5, 0x82, 0xc4, 0x3f, 0x80, 0x10, 0xdc, 0x41, 0x5c, 0x38, 0xe6, 0x18,
|
||||
0x89, 0x0b, 0x27, 0x0b, 0x1c, 0x4e, 0xf9, 0x13, 0x72, 0x42, 0x3b, 0xfb, 0xd6, 0x5d, 0x3b, 0x59,
|
||||
0xdb, 0x41, 0x44, 0xf4, 0xe2, 0x9d, 0xf1, 0xbc, 0x1f, 0xdf, 0xf7, 0xed, 0xcc, 0x7b, 0x3b, 0xf8,
|
||||
0xb5, 0x6d, 0x73, 0x8b, 0x8a, 0xa6, 0xe9, 0x7a, 0x92, 0xf9, 0x1e, 0x6d, 0x98, 0xb2, 0xd3, 0x62,
|
||||
0xc2, 0x7c, 0xd2, 0x66, 0x7e, 0xc7, 0x68, 0xf9, 0x5c, 0x72, 0xf2, 0x4a, 0x60, 0xe0, 0x18, 0xdb,
|
||||
0x46, 0xf8, 0xfc, 0x6c, 0xa9, 0xca, 0x24, 0x5d, 0xca, 0x5f, 0xa8, 0xf1, 0x1a, 0x57, 0x16, 0x66,
|
||||
0x30, 0x0a, 0x8d, 0xf3, 0x09, 0xf1, 0xd4, 0x2f, 0x98, 0x5c, 0xae, 0x71, 0x5e, 0x6b, 0x30, 0x53,
|
||||
0xcd, 0xaa, 0xed, 0x4d, 0x93, 0x35, 0x5b, 0x12, 0x92, 0xe5, 0x0b, 0xb0, 0x48, 0x5b, 0xae, 0x49,
|
||||
0x3d, 0x8f, 0x4b, 0x2a, 0x5d, 0xee, 0x81, 0xab, 0x5e, 0xc3, 0xb9, 0xfb, 0x01, 0xb2, 0x55, 0xee,
|
||||
0x49, 0x9f, 0xda, 0xf2, 0xae, 0xb7, 0xc9, 0x2d, 0xf6, 0xa4, 0xcd, 0x84, 0x24, 0x1f, 0xe0, 0x59,
|
||||
0xea, 0x38, 0x3e, 0x13, 0x22, 0x87, 0x16, 0x50, 0x69, 0xbe, 0xb2, 0x74, 0xd4, 0x2d, 0x5e, 0xaf,
|
||||
0xb9, 0xb2, 0xde, 0xae, 0x1a, 0x36, 0x6f, 0x9a, 0x36, 0x17, 0x4d, 0x2e, 0xe0, 0x71, 0x5d, 0x38,
|
||||
0x8f, 0x01, 0xd5, 0x8a, 0x6d, 0xaf, 0x84, 0x8e, 0x56, 0x14, 0x41, 0xff, 0x15, 0xe1, 0x57, 0x4f,
|
||||
0xc8, 0x24, 0x5a, 0xdc, 0x13, 0xec, 0x3f, 0x4d, 0x45, 0xee, 0xe3, 0xf9, 0x78, 0x92, 0xdc, 0xf4,
|
||||
0x02, 0x2a, 0x9d, 0x5f, 0x7e, 0xdd, 0x38, 0x51, 0x75, 0x23, 0x6e, 0x5a, 0x99, 0xdb, 0xef, 0x16,
|
||||
0xd1, 0x61, 0xb7, 0x38, 0x65, 0x0d, 0x84, 0xd0, 0x1f, 0xe1, 0xcb, 0x03, 0xe0, 0xd7, 0x5c, 0x21,
|
||||
0xb9, 0xdf, 0x39, 0x13, 0xa5, 0x38, 0x2e, 0x9c, 0x9c, 0x0b, 0xb4, 0xfa, 0x18, 0xcf, 0x32, 0x4f,
|
||||
0xfa, 0x2e, 0x0b, 0x92, 0x9d, 0x2b, 0x9d, 0x5f, 0x36, 0xc7, 0x30, 0x5b, 0xe5, 0x0e, 0x83, 0x20,
|
||||
0x77, 0x3c, 0xe9, 0x77, 0x2a, 0xa9, 0xbd, 0x80, 0x61, 0x14, 0x45, 0xbf, 0x35, 0x44, 0x4e, 0x54,
|
||||
0x3a, 0x81, 0x4b, 0x44, 0xee, 0x12, 0x9e, 0xb5, 0xb9, 0xc3, 0x36, 0x5c, 0x47, 0x91, 0x4b, 0x59,
|
||||
0xe9, 0x60, 0x7a, 0xd7, 0xd1, 0x7f, 0x41, 0xf8, 0x52, 0x5c, 0xa5, 0x07, 0xae, 0xac, 0x03, 0x9b,
|
||||
0xe7, 0xfe, 0x85, 0xee, 0x0c, 0x89, 0xdc, 0xe7, 0x0c, 0x22, 0x3f, 0xc4, 0x2f, 0xda, 0xb0, 0xb4,
|
||||
0xe1, 0x7a, 0x9b, 0x3c, 0xd2, 0xda, 0x98, 0x20, 0x69, 0x4c, 0x07, 0x90, 0xfa, 0x05, 0x3b, 0xb6,
|
||||
0x2c, 0xf4, 0xc7, 0x90, 0x7c, 0xa5, 0xd1, 0x88, 0xfc, 0xd6, 0x25, 0x95, 0xec, 0x4c, 0xb6, 0xd3,
|
||||
0x43, 0x7c, 0x25, 0x21, 0x19, 0x50, 0x7d, 0x0f, 0xa7, 0x9b, 0xdc, 0x61, 0x8d, 0x88, 0x62, 0x21,
|
||||
0x81, 0xe2, 0xbd, 0xc0, 0x08, 0x08, 0x81, 0x87, 0xfe, 0x15, 0x02, 0x2a, 0x16, 0xdd, 0x3a, 0x73,
|
||||
0x2a, 0xe4, 0x0a, 0xc6, 0xaa, 0x8c, 0x6e, 0x38, 0x54, 0x52, 0xb5, 0x0b, 0xe6, 0xad, 0x8c, 0xfa,
|
||||
0xe7, 0x36, 0x95, 0x54, 0x2f, 0x03, 0xd3, 0xe3, 0x58, 0x80, 0x29, 0xc1, 0x29, 0xe5, 0xa9, 0x90,
|
||||
0x58, 0x6a, 0xac, 0x7f, 0x8d, 0xb0, 0xa6, 0xbc, 0xd6, 0x9b, 0xd4, 0x97, 0xff, 0x3b, 0x87, 0x75,
|
||||
0x5c, 0x4c, 0x44, 0x03, 0x2c, 0x16, 0xe3, 0x2c, 0x2a, 0x85, 0xa3, 0x6e, 0x31, 0xc7, 0x3c, 0x9b,
|
||||
0x3b, 0xae, 0x57, 0x33, 0x1f, 0x09, 0xee, 0x19, 0x16, 0xdd, 0xba, 0xc7, 0x84, 0xa0, 0x35, 0x06,
|
||||
0x1c, 0xdf, 0xc6, 0x59, 0xd8, 0xec, 0x13, 0x9c, 0xea, 0xa7, 0xd3, 0x38, 0x1b, 0x18, 0x0e, 0xd4,
|
||||
0xe7, 0x6b, 0x43, 0xd6, 0x95, 0x6c, 0xaf, 0x5b, 0x4c, 0x2b, 0xb3, 0xdb, 0x87, 0xdd, 0xe2, 0xb4,
|
||||
0xeb, 0x44, 0xfe, 0x81, 0x5a, 0xb6, 0xcf, 0xa8, 0xe4, 0x7e, 0xc8, 0xee, 0x5f, 0xa9, 0x05, 0x11,
|
||||
0xc8, 0x27, 0x38, 0x13, 0x30, 0xd8, 0xa8, 0x53, 0x51, 0xcf, 0x9d, 0x53, 0xe1, 0xde, 0x39, 0xea,
|
||||
0x16, 0x6f, 0xc4, 0xc2, 0x49, 0xe6, 0x39, 0xcc, 0x6f, 0xba, 0x9e, 0x8c, 0x0f, 0x1b, 0x6e, 0x55,
|
||||
0x98, 0xd5, 0x8e, 0x64, 0xc2, 0x58, 0x63, 0xdb, 0x95, 0x60, 0x60, 0xcd, 0x05, 0xa1, 0xd6, 0xa8,
|
||||
0xa8, 0x93, 0x8b, 0x38, 0x2d, 0x78, 0xdb, 0xb7, 0x59, 0x2e, 0xb5, 0x80, 0x4a, 0x19, 0x0b, 0x66,
|
||||
0x24, 0x87, 0x67, 0xab, 0x6d, 0xb7, 0xe1, 0x30, 0x3f, 0x37, 0xa3, 0x16, 0xa2, 0xa9, 0xfe, 0x05,
|
||||
0xc2, 0x2f, 0xc7, 0x34, 0x04, 0x59, 0x3e, 0xc2, 0x99, 0x50, 0x96, 0xa0, 0x2a, 0x21, 0x55, 0x95,
|
||||
0xae, 0x26, 0x16, 0x88, 0x41, 0x49, 0x63, 0x95, 0x69, 0xce, 0x86, 0x35, 0x52, 0x80, 0x57, 0x1b,
|
||||
0x0a, 0x37, 0x77, 0xd8, 0x2d, 0xaa, 0x39, 0xbc, 0xc6, 0x2a, 0x26, 0x7d, 0x08, 0xa2, 0x8f, 0xe1,
|
||||
0x43, 0x8c, 0xfb, 0x18, 0xa2, 0x23, 0x3c, 0x31, 0x88, 0xf0, 0x34, 0x67, 0x22, 0x00, 0x62, 0xf9,
|
||||
0x5b, 0x8c, 0x67, 0x54, 0x12, 0xf2, 0x1d, 0x1a, 0xac, 0xba, 0x24, 0xa9, 0xcd, 0x24, 0x7d, 0x3f,
|
||||
0xe4, 0x17, 0x27, 0x77, 0x08, 0xe1, 0xe8, 0xa5, 0x2f, 0x7f, 0xff, 0xfb, 0xe9, 0xb4, 0x4e, 0x16,
|
||||
0xc2, 0x4f, 0x1e, 0x70, 0x30, 0xa3, 0xea, 0x69, 0xee, 0xc0, 0x29, 0xda, 0x25, 0x3f, 0x22, 0xfc,
|
||||
0xd2, 0x50, 0x83, 0x24, 0xcb, 0x93, 0xe4, 0x1b, 0xec, 0xdc, 0xf9, 0xf2, 0xa9, 0x7c, 0x00, 0xe6,
|
||||
0xa2, 0x82, 0xf9, 0x16, 0x29, 0x8d, 0x83, 0x69, 0xd6, 0x01, 0xda, 0x0f, 0x31, 0xb8, 0xd0, 0x6a,
|
||||
0x26, 0x83, 0x3b, 0xd8, 0x8b, 0x27, 0x83, 0x3b, 0xd4, 0xcb, 0x74, 0x43, 0xc1, 0x2d, 0x91, 0x37,
|
||||
0x87, 0xe1, 0x3a, 0xcc, 0xdc, 0x81, 0x63, 0xbd, 0xdb, 0x47, 0x2f, 0xc8, 0x4f, 0x08, 0x67, 0x87,
|
||||
0xbb, 0x05, 0x19, 0x99, 0x39, 0xa1, 0x91, 0xe5, 0x6f, 0x9c, 0xce, 0x69, 0x1c, 0xde, 0x63, 0xf2,
|
||||
0x0a, 0x05, 0xed, 0x67, 0x84, 0xb3, 0xc3, 0x35, 0x7f, 0x34, 0xde, 0x84, 0x6e, 0x35, 0x1a, 0x6f,
|
||||
0x52, 0x5b, 0xd1, 0xdf, 0x55, 0x78, 0xcb, 0x64, 0x69, 0x2c, 0x5e, 0x9f, 0x6e, 0x99, 0x3b, 0xcf,
|
||||
0xca, 0xff, 0x2e, 0xf9, 0x0d, 0x61, 0x72, 0xbc, 0xd4, 0x93, 0x9b, 0xa3, 0x70, 0x24, 0x36, 0xaa,
|
||||
0xfc, 0xad, 0xd3, 0xba, 0x01, 0x81, 0xf7, 0x15, 0x81, 0x9b, 0xa4, 0x3c, 0x5e, 0xf0, 0x20, 0xc8,
|
||||
0x20, 0x85, 0xcf, 0x71, 0x4a, 0x6d, 0xe7, 0xab, 0xa3, 0xb7, 0xe6, 0xb3, 0x3d, 0x5c, 0x1a, 0x6f,
|
||||
0x08, 0xb8, 0xde, 0x50, 0xb8, 0x34, 0x52, 0x18, 0xb5, 0x71, 0xc9, 0x26, 0x9e, 0x51, 0x15, 0x91,
|
||||
0x5c, 0x34, 0xc2, 0xab, 0x8e, 0x11, 0xdd, 0x83, 0x8c, 0x3b, 0xc1, 0x3d, 0x28, 0x7f, 0x6d, 0x5c,
|
||||
0xc2, 0x7e, 0x31, 0xd5, 0xf3, 0x2a, 0xe3, 0x05, 0x42, 0x8e, 0x67, 0xac, 0x58, 0x7b, 0x7f, 0x69,
|
||||
0x53, 0xdf, 0xf7, 0x34, 0xb4, 0xd7, 0xd3, 0xd0, 0x7e, 0x4f, 0x43, 0x7f, 0xf6, 0x34, 0xf4, 0xcd,
|
||||
0x81, 0x36, 0xb5, 0x7f, 0xa0, 0x4d, 0xfd, 0x71, 0xa0, 0x4d, 0x7d, 0xba, 0x18, 0x6b, 0x4b, 0xab,
|
||||
0x5c, 0x34, 0x1f, 0x04, 0x31, 0x54, 0x4e, 0x73, 0x1b, 0x9e, 0x83, 0xb7, 0xb8, 0x6a, 0x5a, 0x41,
|
||||
0x2d, 0xff, 0x13, 0x00, 0x00, 0xff, 0xff, 0xb6, 0x67, 0xf5, 0xed, 0x35, 0x0e, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (this *QueryContractInfoRequest) Equal(that interface{}) bool {
|
||||
|
@ -736,6 +825,59 @@ func (this *QueryContractInfoResponse) Equal(that interface{}) bool {
|
|||
}
|
||||
return true
|
||||
}
|
||||
func (this *QueryContractHistoryRequest) Equal(that interface{}) bool {
|
||||
if that == nil {
|
||||
return this == nil
|
||||
}
|
||||
|
||||
that1, ok := that.(*QueryContractHistoryRequest)
|
||||
if !ok {
|
||||
that2, ok := that.(QueryContractHistoryRequest)
|
||||
if ok {
|
||||
that1 = &that2
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
if that1 == nil {
|
||||
return this == nil
|
||||
} else if this == nil {
|
||||
return false
|
||||
}
|
||||
if !bytes.Equal(this.Address, that1.Address) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
func (this *QueryContractHistoryResponse) Equal(that interface{}) bool {
|
||||
if that == nil {
|
||||
return this == nil
|
||||
}
|
||||
|
||||
that1, ok := that.(*QueryContractHistoryResponse)
|
||||
if !ok {
|
||||
that2, ok := that.(QueryContractHistoryResponse)
|
||||
if ok {
|
||||
that1 = &that2
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
if that1 == nil {
|
||||
return this == nil
|
||||
} else if this == nil {
|
||||
return false
|
||||
}
|
||||
if len(this.Entries) != len(that1.Entries) {
|
||||
return false
|
||||
}
|
||||
for i := range this.Entries {
|
||||
if !this.Entries[i].Equal(&that1.Entries[i]) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
func (this *QueryContractsByCodeRequest) Equal(that interface{}) bool {
|
||||
if that == nil {
|
||||
return this == nil
|
||||
|
@ -755,7 +897,7 @@ func (this *QueryContractsByCodeRequest) Equal(that interface{}) bool {
|
|||
} else if this == nil {
|
||||
return false
|
||||
}
|
||||
if this.CodeID != that1.CodeID {
|
||||
if this.CodeId != that1.CodeId {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
|
@ -990,7 +1132,7 @@ func (this *QueryCodeRequest) Equal(that interface{}) bool {
|
|||
} else if this == nil {
|
||||
return false
|
||||
}
|
||||
if this.CodeID != that1.CodeID {
|
||||
if this.CodeId != that1.CodeId {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
|
@ -1101,12 +1243,13 @@ 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 QueryClient interface {
|
||||
ContractInfo(ctx context.Context, in *QueryContractInfoRequest, opts ...grpc.CallOption) (*QueryContractInfoResponse, error)
|
||||
ContractHistory(ctx context.Context, in *QueryContractHistoryRequest, opts ...grpc.CallOption) (*QueryContractHistoryResponse, error)
|
||||
ContractsByCode(ctx context.Context, in *QueryContractsByCodeRequest, opts ...grpc.CallOption) (*QueryContractsByCodeResponse, error)
|
||||
AllContractState(ctx context.Context, in *QueryAllContractStateRequest, opts ...grpc.CallOption) (*QueryAllContractStateResponse, error)
|
||||
RawContractState(ctx context.Context, in *QueryRawContractStateRequest, opts ...grpc.CallOption) (*QueryRawContractStateResponse, error)
|
||||
SmartContractState(ctx context.Context, in *QuerySmartContractStateRequest, opts ...grpc.CallOption) (*QuerySmartContractStateResponse, error)
|
||||
Code(ctx context.Context, in *QueryCodeRequest, opts ...grpc.CallOption) (*QueryCodeResponse, error)
|
||||
Codes(ctx context.Context, in *types.Empty, opts ...grpc.CallOption) (*QueryCodesResponse, error)
|
||||
Codes(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*QueryCodesResponse, error)
|
||||
}
|
||||
|
||||
type queryClient struct {
|
||||
|
@ -1126,6 +1269,15 @@ func (c *queryClient) ContractInfo(ctx context.Context, in *QueryContractInfoReq
|
|||
return out, nil
|
||||
}
|
||||
|
||||
func (c *queryClient) ContractHistory(ctx context.Context, in *QueryContractHistoryRequest, opts ...grpc.CallOption) (*QueryContractHistoryResponse, error) {
|
||||
out := new(QueryContractHistoryResponse)
|
||||
err := c.cc.Invoke(ctx, "/wasmd.x.wasmd.v1beta1.Query/ContractHistory", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *queryClient) ContractsByCode(ctx context.Context, in *QueryContractsByCodeRequest, opts ...grpc.CallOption) (*QueryContractsByCodeResponse, error) {
|
||||
out := new(QueryContractsByCodeResponse)
|
||||
err := c.cc.Invoke(ctx, "/wasmd.x.wasmd.v1beta1.Query/ContractsByCode", in, out, opts...)
|
||||
|
@ -1171,7 +1323,7 @@ func (c *queryClient) Code(ctx context.Context, in *QueryCodeRequest, opts ...gr
|
|||
return out, nil
|
||||
}
|
||||
|
||||
func (c *queryClient) Codes(ctx context.Context, in *types.Empty, opts ...grpc.CallOption) (*QueryCodesResponse, error) {
|
||||
func (c *queryClient) Codes(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*QueryCodesResponse, error) {
|
||||
out := new(QueryCodesResponse)
|
||||
err := c.cc.Invoke(ctx, "/wasmd.x.wasmd.v1beta1.Query/Codes", in, out, opts...)
|
||||
if err != nil {
|
||||
|
@ -1183,12 +1335,13 @@ func (c *queryClient) Codes(ctx context.Context, in *types.Empty, opts ...grpc.C
|
|||
// QueryServer is the server API for Query service.
|
||||
type QueryServer interface {
|
||||
ContractInfo(context.Context, *QueryContractInfoRequest) (*QueryContractInfoResponse, error)
|
||||
ContractHistory(context.Context, *QueryContractHistoryRequest) (*QueryContractHistoryResponse, error)
|
||||
ContractsByCode(context.Context, *QueryContractsByCodeRequest) (*QueryContractsByCodeResponse, error)
|
||||
AllContractState(context.Context, *QueryAllContractStateRequest) (*QueryAllContractStateResponse, error)
|
||||
RawContractState(context.Context, *QueryRawContractStateRequest) (*QueryRawContractStateResponse, error)
|
||||
SmartContractState(context.Context, *QuerySmartContractStateRequest) (*QuerySmartContractStateResponse, error)
|
||||
Code(context.Context, *QueryCodeRequest) (*QueryCodeResponse, error)
|
||||
Codes(context.Context, *types.Empty) (*QueryCodesResponse, error)
|
||||
Codes(context.Context, *empty.Empty) (*QueryCodesResponse, error)
|
||||
}
|
||||
|
||||
// UnimplementedQueryServer can be embedded to have forward compatible implementations.
|
||||
|
@ -1198,6 +1351,9 @@ type UnimplementedQueryServer struct {
|
|||
func (*UnimplementedQueryServer) ContractInfo(ctx context.Context, req *QueryContractInfoRequest) (*QueryContractInfoResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ContractInfo not implemented")
|
||||
}
|
||||
func (*UnimplementedQueryServer) ContractHistory(ctx context.Context, req *QueryContractHistoryRequest) (*QueryContractHistoryResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ContractHistory not implemented")
|
||||
}
|
||||
func (*UnimplementedQueryServer) ContractsByCode(ctx context.Context, req *QueryContractsByCodeRequest) (*QueryContractsByCodeResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ContractsByCode not implemented")
|
||||
}
|
||||
|
@ -1213,7 +1369,7 @@ func (*UnimplementedQueryServer) SmartContractState(ctx context.Context, req *Qu
|
|||
func (*UnimplementedQueryServer) Code(ctx context.Context, req *QueryCodeRequest) (*QueryCodeResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Code not implemented")
|
||||
}
|
||||
func (*UnimplementedQueryServer) Codes(ctx context.Context, req *types.Empty) (*QueryCodesResponse, error) {
|
||||
func (*UnimplementedQueryServer) Codes(ctx context.Context, req *empty.Empty) (*QueryCodesResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Codes not implemented")
|
||||
}
|
||||
|
||||
|
@ -1239,6 +1395,24 @@ func _Query_ContractInfo_Handler(srv interface{}, ctx context.Context, dec func(
|
|||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Query_ContractHistory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(QueryContractHistoryRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(QueryServer).ContractHistory(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/wasmd.x.wasmd.v1beta1.Query/ContractHistory",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(QueryServer).ContractHistory(ctx, req.(*QueryContractHistoryRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Query_ContractsByCode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(QueryContractsByCodeRequest)
|
||||
if err := dec(in); err != nil {
|
||||
|
@ -1330,7 +1504,7 @@ func _Query_Code_Handler(srv interface{}, ctx context.Context, dec func(interfac
|
|||
}
|
||||
|
||||
func _Query_Codes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(types.Empty)
|
||||
in := new(empty.Empty)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -1342,7 +1516,7 @@ func _Query_Codes_Handler(srv interface{}, ctx context.Context, dec func(interfa
|
|||
FullMethod: "/wasmd.x.wasmd.v1beta1.Query/Codes",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(QueryServer).Codes(ctx, req.(*types.Empty))
|
||||
return srv.(QueryServer).Codes(ctx, req.(*empty.Empty))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
@ -1355,6 +1529,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{
|
|||
MethodName: "ContractInfo",
|
||||
Handler: _Query_ContractInfo_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ContractHistory",
|
||||
Handler: _Query_ContractHistory_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ContractsByCode",
|
||||
Handler: _Query_ContractsByCode_Handler,
|
||||
|
@ -1456,6 +1634,73 @@ func (m *QueryContractInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, erro
|
|||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *QueryContractHistoryRequest) 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 *QueryContractHistoryRequest) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *QueryContractHistoryRequest) 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 *QueryContractHistoryResponse) 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 *QueryContractHistoryResponse) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *QueryContractHistoryResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.Entries) > 0 {
|
||||
for iNdEx := len(m.Entries) - 1; iNdEx >= 0; iNdEx-- {
|
||||
{
|
||||
size, err := m.Entries[iNdEx].MarshalToSizedBuffer(dAtA[:i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i -= size
|
||||
i = encodeVarintQuery(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *QueryContractsByCodeRequest) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
|
@ -1476,8 +1721,8 @@ func (m *QueryContractsByCodeRequest) MarshalToSizedBuffer(dAtA []byte) (int, er
|
|||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.CodeID != 0 {
|
||||
i = encodeVarintQuery(dAtA, i, uint64(m.CodeID))
|
||||
if m.CodeId != 0 {
|
||||
i = encodeVarintQuery(dAtA, i, uint64(m.CodeId))
|
||||
i--
|
||||
dAtA[i] = 0x8
|
||||
}
|
||||
|
@ -1784,8 +2029,8 @@ func (m *QueryCodeRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
|||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.CodeID != 0 {
|
||||
i = encodeVarintQuery(dAtA, i, uint64(m.CodeID))
|
||||
if m.CodeId != 0 {
|
||||
i = encodeVarintQuery(dAtA, i, uint64(m.CodeId))
|
||||
i--
|
||||
dAtA[i] = 0x8
|
||||
}
|
||||
|
@ -1968,14 +2213,42 @@ func (m *QueryContractInfoResponse) Size() (n int) {
|
|||
return n
|
||||
}
|
||||
|
||||
func (m *QueryContractHistoryRequest) 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 *QueryContractHistoryResponse) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.Entries) > 0 {
|
||||
for _, e := range m.Entries {
|
||||
l = e.Size()
|
||||
n += 1 + l + sovQuery(uint64(l))
|
||||
}
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *QueryContractsByCodeRequest) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
if m.CodeID != 0 {
|
||||
n += 1 + sovQuery(uint64(m.CodeID))
|
||||
if m.CodeId != 0 {
|
||||
n += 1 + sovQuery(uint64(m.CodeId))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
@ -2106,8 +2379,8 @@ func (m *QueryCodeRequest) Size() (n int) {
|
|||
}
|
||||
var l int
|
||||
_ = l
|
||||
if m.CodeID != 0 {
|
||||
n += 1 + sovQuery(uint64(m.CodeID))
|
||||
if m.CodeId != 0 {
|
||||
n += 1 + sovQuery(uint64(m.CodeId))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
@ -2388,6 +2661,180 @@ func (m *QueryContractInfoResponse) Unmarshal(dAtA []byte) error {
|
|||
}
|
||||
return nil
|
||||
}
|
||||
func (m *QueryContractHistoryRequest) 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: QueryContractHistoryRequest: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: QueryContractHistoryRequest: 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 byteLen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowQuery
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
byteLen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if byteLen < 0 {
|
||||
return ErrInvalidLengthQuery
|
||||
}
|
||||
postIndex := iNdEx + byteLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthQuery
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Address = append(m.Address[:0], dAtA[iNdEx:postIndex]...)
|
||||
if m.Address == nil {
|
||||
m.Address = []byte{}
|
||||
}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipQuery(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if skippy < 0 {
|
||||
return ErrInvalidLengthQuery
|
||||
}
|
||||
if (iNdEx + skippy) < 0 {
|
||||
return ErrInvalidLengthQuery
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *QueryContractHistoryResponse) 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: QueryContractHistoryResponse: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: QueryContractHistoryResponse: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Entries", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowQuery
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthQuery
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthQuery
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Entries = append(m.Entries, ContractCodeHistoryEntry{})
|
||||
if err := m.Entries[len(m.Entries)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipQuery(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if skippy < 0 {
|
||||
return ErrInvalidLengthQuery
|
||||
}
|
||||
if (iNdEx + skippy) < 0 {
|
||||
return ErrInvalidLengthQuery
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *QueryContractsByCodeRequest) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
|
@ -2419,9 +2866,9 @@ func (m *QueryContractsByCodeRequest) Unmarshal(dAtA []byte) error {
|
|||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field CodeID", wireType)
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field CodeId", wireType)
|
||||
}
|
||||
m.CodeID = 0
|
||||
m.CodeId = 0
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowQuery
|
||||
|
@ -2431,7 +2878,7 @@ func (m *QueryContractsByCodeRequest) Unmarshal(dAtA []byte) error {
|
|||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
m.CodeID |= uint64(b&0x7F) << shift
|
||||
m.CodeId |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
|
@ -3291,9 +3738,9 @@ func (m *QueryCodeRequest) Unmarshal(dAtA []byte) error {
|
|||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field CodeID", wireType)
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field CodeId", wireType)
|
||||
}
|
||||
m.CodeID = 0
|
||||
m.CodeId = 0
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowQuery
|
||||
|
@ -3303,7 +3750,7 @@ func (m *QueryCodeRequest) Unmarshal(dAtA []byte) error {
|
|||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
m.CodeID |= uint64(b&0x7F) << shift
|
||||
m.CodeId |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
|
|
|
@ -0,0 +1,905 @@
|
|||
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
|
||||
// source: x/wasm/internal/types/query.proto
|
||||
|
||||
/*
|
||||
Package types is a reverse proxy.
|
||||
|
||||
It translates gRPC into RESTful JSON APIs.
|
||||
*/
|
||||
package types
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/golang/protobuf/descriptor"
|
||||
"github.com/golang/protobuf/proto"
|
||||
"github.com/golang/protobuf/ptypes/empty"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/runtime"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/utilities"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/grpclog"
|
||||
"google.golang.org/grpc/metadata"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// Suppress "imported and not used" errors
|
||||
var _ codes.Code
|
||||
var _ io.Reader
|
||||
var _ status.Status
|
||||
var _ = runtime.String
|
||||
var _ = utilities.NewDoubleArray
|
||||
var _ = descriptor.ForMessage
|
||||
var _ = metadata.Join
|
||||
|
||||
func request_Query_ContractInfo_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryContractInfoRequest
|
||||
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.Bytes(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err)
|
||||
}
|
||||
|
||||
msg, err := client.ContractInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_Query_ContractInfo_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryContractInfoRequest
|
||||
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.Bytes(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err)
|
||||
}
|
||||
|
||||
msg, err := server.ContractInfo(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func request_Query_ContractHistory_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryContractHistoryRequest
|
||||
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.Bytes(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err)
|
||||
}
|
||||
|
||||
msg, err := client.ContractHistory(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_Query_ContractHistory_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryContractHistoryRequest
|
||||
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.Bytes(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err)
|
||||
}
|
||||
|
||||
msg, err := server.ContractHistory(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func request_Query_ContractsByCode_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryContractsByCodeRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
var (
|
||||
val string
|
||||
ok bool
|
||||
err error
|
||||
_ = err
|
||||
)
|
||||
|
||||
val, ok = pathParams["code_id"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "code_id")
|
||||
}
|
||||
|
||||
protoReq.CodeId, err = runtime.Uint64(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "code_id", err)
|
||||
}
|
||||
|
||||
msg, err := client.ContractsByCode(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_Query_ContractsByCode_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryContractsByCodeRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
var (
|
||||
val string
|
||||
ok bool
|
||||
err error
|
||||
_ = err
|
||||
)
|
||||
|
||||
val, ok = pathParams["code_id"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "code_id")
|
||||
}
|
||||
|
||||
protoReq.CodeId, err = runtime.Uint64(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "code_id", err)
|
||||
}
|
||||
|
||||
msg, err := server.ContractsByCode(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func request_Query_AllContractState_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryAllContractStateRequest
|
||||
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.Bytes(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err)
|
||||
}
|
||||
|
||||
msg, err := client.AllContractState(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_Query_AllContractState_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryAllContractStateRequest
|
||||
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.Bytes(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err)
|
||||
}
|
||||
|
||||
msg, err := server.AllContractState(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func request_Query_RawContractState_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryRawContractStateRequest
|
||||
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.Bytes(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err)
|
||||
}
|
||||
|
||||
val, ok = pathParams["query_data"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "query_data")
|
||||
}
|
||||
|
||||
protoReq.QueryData, err = runtime.Bytes(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "query_data", err)
|
||||
}
|
||||
|
||||
msg, err := client.RawContractState(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_Query_RawContractState_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryRawContractStateRequest
|
||||
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.Bytes(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err)
|
||||
}
|
||||
|
||||
val, ok = pathParams["query_data"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "query_data")
|
||||
}
|
||||
|
||||
protoReq.QueryData, err = runtime.Bytes(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "query_data", err)
|
||||
}
|
||||
|
||||
msg, err := server.RawContractState(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func request_Query_SmartContractState_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QuerySmartContractStateRequest
|
||||
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.Bytes(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err)
|
||||
}
|
||||
|
||||
val, ok = pathParams["query_data"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "query_data")
|
||||
}
|
||||
|
||||
protoReq.QueryData, err = runtime.Bytes(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "query_data", err)
|
||||
}
|
||||
|
||||
msg, err := client.SmartContractState(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_Query_SmartContractState_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QuerySmartContractStateRequest
|
||||
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.Bytes(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err)
|
||||
}
|
||||
|
||||
val, ok = pathParams["query_data"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "query_data")
|
||||
}
|
||||
|
||||
protoReq.QueryData, err = runtime.Bytes(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "query_data", err)
|
||||
}
|
||||
|
||||
msg, err := server.SmartContractState(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func request_Query_Code_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryCodeRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
var (
|
||||
val string
|
||||
ok bool
|
||||
err error
|
||||
_ = err
|
||||
)
|
||||
|
||||
val, ok = pathParams["code_id"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "code_id")
|
||||
}
|
||||
|
||||
protoReq.CodeId, err = runtime.Uint64(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "code_id", err)
|
||||
}
|
||||
|
||||
msg, err := client.Code(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_Query_Code_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryCodeRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
var (
|
||||
val string
|
||||
ok bool
|
||||
err error
|
||||
_ = err
|
||||
)
|
||||
|
||||
val, ok = pathParams["code_id"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "code_id")
|
||||
}
|
||||
|
||||
protoReq.CodeId, err = runtime.Uint64(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "code_id", err)
|
||||
}
|
||||
|
||||
msg, err := server.Code(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func request_Query_Codes_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq empty.Empty
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
msg, err := client.Codes(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_Query_Codes_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq empty.Empty
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
msg, err := server.Codes(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
// RegisterQueryHandlerServer registers the http handlers for service Query to "mux".
|
||||
// UnaryRPC :call QueryServer directly.
|
||||
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
|
||||
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead.
|
||||
func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error {
|
||||
|
||||
mux.Handle("GET", pattern_Query_ContractInfo_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_ContractInfo_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_ContractInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_ContractHistory_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_ContractHistory_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_ContractHistory_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_ContractsByCode_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_ContractsByCode_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_ContractsByCode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_AllContractState_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_AllContractState_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_AllContractState_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_RawContractState_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_RawContractState_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_RawContractState_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_SmartContractState_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_SmartContractState_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_SmartContractState_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_Code_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_Code_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_Code_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_Codes_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_Codes_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_Codes_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but
|
||||
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
|
||||
func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
|
||||
conn, err := grpc.Dial(endpoint, opts...)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer func() {
|
||||
if err != nil {
|
||||
if cerr := conn.Close(); cerr != nil {
|
||||
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
|
||||
}
|
||||
return
|
||||
}
|
||||
go func() {
|
||||
<-ctx.Done()
|
||||
if cerr := conn.Close(); cerr != nil {
|
||||
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
|
||||
}
|
||||
}()
|
||||
}()
|
||||
|
||||
return RegisterQueryHandler(ctx, mux, conn)
|
||||
}
|
||||
|
||||
// RegisterQueryHandler registers the http handlers for service Query to "mux".
|
||||
// The handlers forward requests to the grpc endpoint over "conn".
|
||||
func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
|
||||
return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn))
|
||||
}
|
||||
|
||||
// RegisterQueryHandlerClient registers the http handlers for service Query
|
||||
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient".
|
||||
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient"
|
||||
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
|
||||
// "QueryClient" to call the correct interceptors.
|
||||
func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error {
|
||||
|
||||
mux.Handle("GET", pattern_Query_ContractInfo_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_ContractInfo_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_ContractInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_ContractHistory_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_ContractHistory_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_ContractHistory_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_ContractsByCode_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_ContractsByCode_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_ContractsByCode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_AllContractState_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_AllContractState_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_AllContractState_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_RawContractState_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_RawContractState_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_RawContractState_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_SmartContractState_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_SmartContractState_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_SmartContractState_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_Code_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_Code_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_Code_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_Codes_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_Codes_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_Codes_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
var (
|
||||
pattern_Query_ContractInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"wasm", "v1beta1", "contract", "address"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
|
||||
pattern_Query_ContractHistory_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 2, 4}, []string{"wasm", "v1beta1", "contract", "address", "history"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
|
||||
pattern_Query_ContractsByCode_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 2, 4}, []string{"wasm", "v1beta1", "code", "code_id", "contracts"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
|
||||
pattern_Query_AllContractState_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 2, 4}, []string{"wasm", "v1beta1", "contract", "address", "state"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
|
||||
pattern_Query_RawContractState_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"wasm", "v1beta1", "contract", "address", "raw", "query_data"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
|
||||
pattern_Query_SmartContractState_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"wasm", "v1beta1", "contract", "address", "smart", "query_data"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
|
||||
pattern_Query_Code_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"wasm", "v1beta1", "code", "code_id"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
|
||||
pattern_Query_Codes_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"wasm", "v1beta1", "code"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
)
|
||||
|
||||
var (
|
||||
forward_Query_ContractInfo_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Query_ContractHistory_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Query_ContractsByCode_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Query_AllContractState_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Query_RawContractState_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Query_SmartContractState_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Query_Code_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Query_Codes_0 = runtime.ForwardResponseMessage
|
||||
)
|
|
@ -4,6 +4,7 @@ package wasmd.x.wasmd.v1beta1;
|
|||
import "gogoproto/gogo.proto";
|
||||
import "x/wasm/internal/types/types.proto";
|
||||
import "google/protobuf/empty.proto";
|
||||
import "google/api/annotations.proto";
|
||||
|
||||
option go_package = "github.com/CosmWasm/wasmd/x/wasmd/internal/types";
|
||||
option (gogoproto.goproto_getters_all) = false;
|
||||
|
@ -12,18 +13,28 @@ option (gogoproto.equal_all) = true;
|
|||
// Query provides defines the gRPC querier service
|
||||
service Query {
|
||||
rpc ContractInfo (QueryContractInfoRequest) returns (QueryContractInfoResponse) {
|
||||
option (google.api.http).get = "/wasm/v1beta1/contract/{address}";
|
||||
}
|
||||
rpc ContractHistory (QueryContractHistoryRequest) returns (QueryContractHistoryResponse) {
|
||||
option (google.api.http).get = "/wasm/v1beta1/contract/{address}/history";
|
||||
}
|
||||
rpc ContractsByCode (QueryContractsByCodeRequest) returns (QueryContractsByCodeResponse) {
|
||||
option (google.api.http).get = "/wasm/v1beta1/code/{code_id}/contracts";
|
||||
}
|
||||
rpc AllContractState (QueryAllContractStateRequest) returns (QueryAllContractStateResponse) {
|
||||
option (google.api.http).get = "/wasm/v1beta1/contract/{address}/state";
|
||||
}
|
||||
rpc RawContractState (QueryRawContractStateRequest) returns (QueryRawContractStateResponse) {
|
||||
option (google.api.http).get = "/wasm/v1beta1/contract/{address}/raw/{query_data}";
|
||||
}
|
||||
rpc SmartContractState (QuerySmartContractStateRequest) returns (QuerySmartContractStateResponse) {
|
||||
option (google.api.http).get = "/wasm/v1beta1/contract/{address}/smart/{query_data}";
|
||||
}
|
||||
rpc Code (QueryCodeRequest) returns (QueryCodeResponse) {
|
||||
option (google.api.http).get = "/wasm/v1beta1/code/{code_id}";
|
||||
}
|
||||
rpc Codes (google.protobuf.Empty) returns (QueryCodesResponse) {
|
||||
option (google.api.http).get = "/wasm/v1beta1/code";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -39,8 +50,17 @@ message QueryContractInfoResponse {
|
|||
ContractInfo ContractInfo = 2 [(gogoproto.embed) = true, (gogoproto.jsontag) = ""];
|
||||
}
|
||||
|
||||
message QueryContractHistoryRequest {
|
||||
// address is the address of the contract to query
|
||||
bytes address = 1 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
|
||||
}
|
||||
|
||||
message QueryContractHistoryResponse {
|
||||
repeated ContractCodeHistoryEntry entries = 1 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message QueryContractsByCodeRequest {
|
||||
uint64 code_id = 1 [(gogoproto.customname) = "CodeID"];
|
||||
uint64 code_id = 1; // grpc-gateway_out does not support Go style CodID
|
||||
}
|
||||
|
||||
// ContractInfoWithAddress adds the address (key) to the ContractInfo representation
|
||||
|
@ -83,7 +103,7 @@ message QuerySmartContractStateResponse {
|
|||
}
|
||||
|
||||
message QueryCodeRequest {
|
||||
uint64 code_id = 1 [(gogoproto.customname) = "CodeID"];
|
||||
uint64 code_id = 1; // grpc-gateway_out does not support Go style CodID
|
||||
}
|
||||
|
||||
message CodeInfoResponse {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package wasm
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"math/rand"
|
||||
|
||||
|
@ -33,8 +34,8 @@ func (b AppModuleBasic) RegisterLegacyAminoCodec(amino *codec.LegacyAmino) {
|
|||
RegisterCodec(amino)
|
||||
}
|
||||
|
||||
func (b AppModuleBasic) RegisterGRPCRoutes(context client.Context, serveMux *runtime.ServeMux) {
|
||||
panic("implement me")
|
||||
func (b AppModuleBasic) RegisterGRPCRoutes(clientCtx client.Context, serveMux *runtime.ServeMux) {
|
||||
types.RegisterQueryHandlerClient(context.Background(), serveMux, types.NewQueryClient(clientCtx))
|
||||
}
|
||||
|
||||
// Name returns the wasm module's name.
|
||||
|
|
Loading…
Reference in New Issue