Nameservice module cli, grpc test cases (#7)
* WIP: migrating the nameservice module * WIP: migrating the nameservice module from dxns to ethermint * refactor: move the proto package version from `v1` to `v1beta1` for vulcanize modules * refactor: added bond module dependency to nameserivce module * feat: added auction module dependency to nameservice module * refactor: refactored the nameservice module * refactor: add human-readable attributes output to cli nameservice `list` * WIP: add grpc query test cases * fix: fix the sub names authority storing issue * WIP: add the test cases * refactor: removed legacyCodec from nameservice * fix: fix the responses for `authority-expiry` and `records-expiry` commands query result * refactor: sort the imports in app * WIP: add test cases for cli query, tx for nameservice module * feat: add test cases for grpc of nameservice module 1. renamed grpc gateway routes from ethermint to vulcanize * refactor: refactored the test cases for grpc lookup of nameservice * refactor: refactored the test cases for bond module
This commit is contained in:
parent
95dde36e1c
commit
db925906f3
@ -191,7 +191,7 @@
|
||||
- [QueryWhoisRequest](#vulcanize.nameservice.v1beta1.QueryWhoisRequest)
|
||||
- [QueryWhoisResponse](#vulcanize.nameservice.v1beta1.QueryWhoisResponse)
|
||||
|
||||
- [Query](#vulcanize.nameservice.v1beta1.Query)
|
||||
- [Query](#vulcanize.nameservice.v1beta1.Query)
|
||||
|
||||
- [vulcanize/nameservice/v1beta1/tx.proto](#vulcanize/nameservice/v1beta1/tx.proto)
|
||||
- [MsgAssociateBond](#vulcanize.nameservice.v1beta1.MsgAssociateBond)
|
||||
@ -2445,6 +2445,7 @@ QueryGetAuthorityExpiryQueue
|
||||
### QueryGetAuthorityExpiryQueueResponse
|
||||
QueryGetAuthorityExpiryQueueResponse
|
||||
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| `authorities` | [ExpiryQueueRecord](#vulcanize.nameservice.v1beta1.ExpiryQueueRecord) | repeated | |
|
||||
@ -2475,6 +2476,7 @@ QueryGetRecordExpiryQueue
|
||||
### QueryGetRecordExpiryQueueResponse
|
||||
QueryGetRecordExpiryQueueResponse
|
||||
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| `records` | [ExpiryQueueRecord](#vulcanize.nameservice.v1beta1.ExpiryQueueRecord) | repeated | |
|
||||
@ -2534,8 +2536,8 @@ QueryListRecordsRequest is request type for nameservice records list
|
||||
<a name="vulcanize.nameservice.v1beta1.QueryListRecordsResponse"></a>
|
||||
|
||||
### QueryListRecordsResponse
|
||||
QueryListRecordsResponse is response type for nameservice records list
|
||||
|
||||
QueryListRecordsResponse is response type for nameservice records list
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
@ -2718,17 +2720,17 @@ Query defines the gRPC querier service for nameservice module
|
||||
|
||||
| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint |
|
||||
| ----------- | ------------ | ------------- | ------------| ------- | -------- |
|
||||
| `Params` | [QueryParamsRequest](#vulcanize.nameservice.v1beta1.QueryParamsRequest) | [QueryParamsResponse](#vulcanize.nameservice.v1beta1.QueryParamsResponse) | Params queries the nameservice module params. | GET|/ethermint/nameservice/v1/params|
|
||||
| `ListRecords` | [QueryListRecordsRequest](#vulcanize.nameservice.v1beta1.QueryListRecordsRequest) | [QueryListRecordsResponse](#vulcanize.nameservice.v1beta1.QueryListRecordsResponse) | List records | GET|/ethermint/nameservice/v1/records|
|
||||
| `GetRecord` | [QueryRecordByIdRequest](#vulcanize.nameservice.v1beta1.QueryRecordByIdRequest) | [QueryRecordByIdResponse](#vulcanize.nameservice.v1beta1.QueryRecordByIdResponse) | Get record by id | GET|/ethermint/nameservice/v1/records/{id}|
|
||||
| `GetRecordByBondId` | [QueryRecordByBondIdRequest](#vulcanize.nameservice.v1beta1.QueryRecordByBondIdRequest) | [QueryRecordByBondIdResponse](#vulcanize.nameservice.v1beta1.QueryRecordByBondIdResponse) | Get records by bond id | GET|/ethermint/nameservice/v1/records-by-bond-id/{id}|
|
||||
| `GetNameServiceModuleBalance` | [GetNameServiceModuleBalanceRequest](#vulcanize.nameservice.v1beta1.GetNameServiceModuleBalanceRequest) | [GetNameServiceModuleBalanceResponse](#vulcanize.nameservice.v1beta1.GetNameServiceModuleBalanceResponse) | Get nameservice module balance | GET|/ethermint/nameservice/v1/balance|
|
||||
| `ListNameRecords` | [QueryListNameRecordsRequest](#vulcanize.nameservice.v1beta1.QueryListNameRecordsRequest) | [QueryListNameRecordsResponse](#vulcanize.nameservice.v1beta1.QueryListNameRecordsResponse) | List name records | GET|/ethermint/nameservice/v1/names|
|
||||
| `Whois` | [QueryWhoisRequest](#vulcanize.nameservice.v1beta1.QueryWhoisRequest) | [QueryWhoisResponse](#vulcanize.nameservice.v1beta1.QueryWhoisResponse) | Whois method retrieve the name authority info | GET|/ethermint/nameservice/v1/whois/{name}|
|
||||
| `LookupWrn` | [QueryLookupWrn](#vulcanize.nameservice.v1beta1.QueryLookupWrn) | [QueryLookupWrnResponse](#vulcanize.nameservice.v1beta1.QueryLookupWrnResponse) | LookupWrn | GET|/ethermint/nameservice/v1/lookup/{wrn}|
|
||||
| `ResolveWrn` | [QueryResolveWrn](#vulcanize.nameservice.v1beta1.QueryResolveWrn) | [QueryResolveWrnResponse](#vulcanize.nameservice.v1beta1.QueryResolveWrnResponse) | ResolveWrn | GET|/ethermint/nameservice/v1/resolve/{wrn}|
|
||||
| `GetRecordExpiryQueue` | [QueryGetRecordExpiryQueue](#vulcanize.nameservice.v1beta1.QueryGetRecordExpiryQueue) | [QueryGetRecordExpiryQueueResponse](#vulcanize.nameservice.v1beta1.QueryGetRecordExpiryQueueResponse) | GetRecordExpiryQueue | GET|/ethermint/nameservice/v1/record-expiry|
|
||||
| `GetAuthorityExpiryQueue` | [QueryGetAuthorityExpiryQueue](#vulcanize.nameservice.v1beta1.QueryGetAuthorityExpiryQueue) | [QueryGetAuthorityExpiryQueueResponse](#vulcanize.nameservice.v1beta1.QueryGetAuthorityExpiryQueueResponse) | GetAuthorityExpiryQueue | GET|/ethermint/nameservice/v1/authority-expiry|
|
||||
| `Params` | [QueryParamsRequest](#vulcanize.nameservice.v1beta1.QueryParamsRequest) | [QueryParamsResponse](#vulcanize.nameservice.v1beta1.QueryParamsResponse) | Params queries the nameservice module params. | GET|/vulcanize/nameservice/v1beta1/params|
|
||||
| `ListRecords` | [QueryListRecordsRequest](#vulcanize.nameservice.v1beta1.QueryListRecordsRequest) | [QueryListRecordsResponse](#vulcanize.nameservice.v1beta1.QueryListRecordsResponse) | List records | GET|/vulcanize/nameservice/v1beta1/records|
|
||||
| `GetRecord` | [QueryRecordByIdRequest](#vulcanize.nameservice.v1beta1.QueryRecordByIdRequest) | [QueryRecordByIdResponse](#vulcanize.nameservice.v1beta1.QueryRecordByIdResponse) | Get record by id | GET|/vulcanize/nameservice/v1beta1/records/{id}|
|
||||
| `GetRecordByBondId` | [QueryRecordByBondIdRequest](#vulcanize.nameservice.v1beta1.QueryRecordByBondIdRequest) | [QueryRecordByBondIdResponse](#vulcanize.nameservice.v1beta1.QueryRecordByBondIdResponse) | Get records by bond id | GET|/vulcanize/nameservice/v1beta1/records-by-bond-id/{id}|
|
||||
| `GetNameServiceModuleBalance` | [GetNameServiceModuleBalanceRequest](#vulcanize.nameservice.v1beta1.GetNameServiceModuleBalanceRequest) | [GetNameServiceModuleBalanceResponse](#vulcanize.nameservice.v1beta1.GetNameServiceModuleBalanceResponse) | Get nameservice module balance | GET|/vulcanize/nameservice/v1beta1/balance|
|
||||
| `ListNameRecords` | [QueryListNameRecordsRequest](#vulcanize.nameservice.v1beta1.QueryListNameRecordsRequest) | [QueryListNameRecordsResponse](#vulcanize.nameservice.v1beta1.QueryListNameRecordsResponse) | List name records | GET|/vulcanize/nameservice/v1beta1/names|
|
||||
| `Whois` | [QueryWhoisRequest](#vulcanize.nameservice.v1beta1.QueryWhoisRequest) | [QueryWhoisResponse](#vulcanize.nameservice.v1beta1.QueryWhoisResponse) | Whois method retrieve the name authority info | GET|/vulcanize/nameservice/v1beta1/whois/{name}|
|
||||
| `LookupWrn` | [QueryLookupWrn](#vulcanize.nameservice.v1beta1.QueryLookupWrn) | [QueryLookupWrnResponse](#vulcanize.nameservice.v1beta1.QueryLookupWrnResponse) | LookupWrn | GET|/vulcanize/nameservice/v1beta1/lookup|
|
||||
| `ResolveWrn` | [QueryResolveWrn](#vulcanize.nameservice.v1beta1.QueryResolveWrn) | [QueryResolveWrnResponse](#vulcanize.nameservice.v1beta1.QueryResolveWrnResponse) | ResolveWrn | GET|/vulcanize/nameservice/v1beta1/resolve|
|
||||
| `GetRecordExpiryQueue` | [QueryGetRecordExpiryQueue](#vulcanize.nameservice.v1beta1.QueryGetRecordExpiryQueue) | [QueryGetRecordExpiryQueueResponse](#vulcanize.nameservice.v1beta1.QueryGetRecordExpiryQueueResponse) | GetRecordExpiryQueue | GET|/vulcanize/nameservice/v1beta1/record-expiry|
|
||||
| `GetAuthorityExpiryQueue` | [QueryGetAuthorityExpiryQueue](#vulcanize.nameservice.v1beta1.QueryGetAuthorityExpiryQueue) | [QueryGetAuthorityExpiryQueueResponse](#vulcanize.nameservice.v1beta1.QueryGetAuthorityExpiryQueueResponse) | GetAuthorityExpiryQueue | GET|/vulcanize/nameservice/v1beta1/authority-expiry|
|
||||
|
||||
<!-- end services -->
|
||||
|
||||
|
2
go.mod
2
go.mod
@ -37,7 +37,7 @@ require (
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 // indirect
|
||||
golang.org/x/net v0.0.0-20210903162142-ad29c8ab022f // indirect
|
||||
golang.org/x/sys v0.0.0-20210903071746-97244b99971b // indirect
|
||||
google.golang.org/genproto v0.0.0-20211001223012-bfb93cce50d9
|
||||
google.golang.org/genproto v0.0.0-20211005153810-c76a74d43a8e
|
||||
google.golang.org/grpc v1.40.0
|
||||
google.golang.org/protobuf v1.27.1
|
||||
gopkg.in/yaml.v2 v2.4.0
|
||||
|
2
go.sum
2
go.sum
@ -1566,6 +1566,8 @@ google.golang.org/genproto v0.0.0-20210930144712-2e2e1008e8a3 h1:+F3FcO6LTrzNq5w
|
||||
google.golang.org/genproto v0.0.0-20210930144712-2e2e1008e8a3/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
|
||||
google.golang.org/genproto v0.0.0-20211001223012-bfb93cce50d9 h1:eF1wcrhdz56Vugf8qNX5dD93ItkrhothojQyHXqloe0=
|
||||
google.golang.org/genproto v0.0.0-20211001223012-bfb93cce50d9/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
|
||||
google.golang.org/genproto v0.0.0-20211005153810-c76a74d43a8e h1:Im71rbA1N3CbIag/PumYhQcNR8bLNmuOtRIyOnnLsT8=
|
||||
google.golang.org/genproto v0.0.0-20211005153810-c76a74d43a8e/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
|
||||
google.golang.org/grpc v1.33.2 h1:EQyQC3sa8M+p6Ulc8yy9SWSS2GVwyRc83gAbG8lrl4o=
|
||||
google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=
|
||||
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.0.1/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw=
|
||||
|
@ -13,47 +13,47 @@ option go_package = "github.com/tharsis/ethermint/x/nameservice/types";
|
||||
service Query {
|
||||
// Params queries the nameservice module params.
|
||||
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
|
||||
option (google.api.http).get = "/ethermint/nameservice/v1/params";
|
||||
option (google.api.http).get = "/vulcanize/nameservice/v1beta1/params";
|
||||
}
|
||||
// List records
|
||||
rpc ListRecords(QueryListRecordsRequest) returns (QueryListRecordsResponse){
|
||||
option (google.api.http).get = "/ethermint/nameservice/v1/records";
|
||||
option (google.api.http).get = "/vulcanize/nameservice/v1beta1/records";
|
||||
}
|
||||
// Get record by id
|
||||
rpc GetRecord(QueryRecordByIdRequest) returns (QueryRecordByIdResponse){
|
||||
option (google.api.http).get = "/ethermint/nameservice/v1/records/{id}";
|
||||
option (google.api.http).get = "/vulcanize/nameservice/v1beta1/records/{id}";
|
||||
}
|
||||
// Get records by bond id
|
||||
rpc GetRecordByBondId(QueryRecordByBondIdRequest) returns (QueryRecordByBondIdResponse){
|
||||
option (google.api.http).get = "/ethermint/nameservice/v1/records-by-bond-id/{id}";
|
||||
option (google.api.http).get = "/vulcanize/nameservice/v1beta1/records-by-bond-id/{id}";
|
||||
}
|
||||
// Get nameservice module balance
|
||||
rpc GetNameServiceModuleBalance(GetNameServiceModuleBalanceRequest) returns (GetNameServiceModuleBalanceResponse){
|
||||
option (google.api.http).get = "/ethermint/nameservice/v1/balance";
|
||||
option (google.api.http).get = "/vulcanize/nameservice/v1beta1/balance";
|
||||
}
|
||||
// List name records
|
||||
rpc ListNameRecords(QueryListNameRecordsRequest) returns (QueryListNameRecordsResponse){
|
||||
option (google.api.http).get = "/ethermint/nameservice/v1/names";
|
||||
option (google.api.http).get = "/vulcanize/nameservice/v1beta1/names";
|
||||
}
|
||||
// Whois method retrieve the name authority info
|
||||
rpc Whois(QueryWhoisRequest) returns (QueryWhoisResponse){
|
||||
option (google.api.http).get = "/ethermint/nameservice/v1/whois/{name}";
|
||||
option (google.api.http).get = "/vulcanize/nameservice/v1beta1/whois/{name}";
|
||||
}
|
||||
// LookupWrn
|
||||
rpc LookupWrn(QueryLookupWrn) returns (QueryLookupWrnResponse){
|
||||
option (google.api.http).get = "/ethermint/nameservice/v1/lookup/{wrn}";
|
||||
option (google.api.http).get = "/vulcanize/nameservice/v1beta1/lookup";
|
||||
}
|
||||
// ResolveWrn
|
||||
rpc ResolveWrn(QueryResolveWrn) returns (QueryResolveWrnResponse){
|
||||
option (google.api.http).get = "/ethermint/nameservice/v1/resolve/{wrn}";
|
||||
option (google.api.http).get = "/vulcanize/nameservice/v1beta1/resolve";
|
||||
}
|
||||
// GetRecordExpiryQueue
|
||||
rpc GetRecordExpiryQueue(QueryGetRecordExpiryQueue) returns (QueryGetRecordExpiryQueueResponse){
|
||||
option (google.api.http).get = "/ethermint/nameservice/v1/record-expiry";
|
||||
option (google.api.http).get = "/vulcanize/nameservice/v1beta1/record-expiry";
|
||||
}
|
||||
// GetAuthorityExpiryQueue
|
||||
rpc GetAuthorityExpiryQueue(QueryGetAuthorityExpiryQueue) returns (QueryGetAuthorityExpiryQueueResponse){
|
||||
option (google.api.http).get = "/ethermint/nameservice/v1/authority-expiry";
|
||||
option (google.api.http).get = "/vulcanize/nameservice/v1beta1/authority-expiry";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -59,6 +59,7 @@ func NewKeeper(accountKeeper auth.AccountKeeper, bankKeeper bank.Keeper, storeKe
|
||||
if !ps.HasKeyTable() {
|
||||
ps = ps.WithKeyTable(types.ParamKeyTable())
|
||||
}
|
||||
|
||||
return Keeper{
|
||||
accountKeeper: accountKeeper,
|
||||
bankKeeper: bankKeeper,
|
||||
|
213
x/bond/client/testutil/grpc.go
Normal file
213
x/bond/client/testutil/grpc.go
Normal file
@ -0,0 +1,213 @@
|
||||
package testutil
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli"
|
||||
"github.com/cosmos/cosmos-sdk/types/rest"
|
||||
tmcli "github.com/tendermint/tendermint/libs/cli"
|
||||
"github.com/tharsis/ethermint/x/bond/client/cli"
|
||||
bondtypes "github.com/tharsis/ethermint/x/bond/types"
|
||||
)
|
||||
|
||||
func (s *IntegrationTestSuite) TestGRPCGetBonds() {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
reqUrl := fmt.Sprintf("%s/vulcanize/bond/v1beta1/bonds", val.APIAddress)
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
url string
|
||||
expErr bool
|
||||
errorMsg string
|
||||
preRun func()
|
||||
}{
|
||||
{
|
||||
"invalid request with headers",
|
||||
reqUrl + "asdasdas",
|
||||
true,
|
||||
"",
|
||||
func() {
|
||||
|
||||
},
|
||||
},
|
||||
{
|
||||
"valid request",
|
||||
reqUrl,
|
||||
false,
|
||||
"",
|
||||
func() {
|
||||
s.createBond()
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, tc := range testCases {
|
||||
s.Run(tc.name, func() {
|
||||
resp, _ := rest.GetRequest(tc.url)
|
||||
if tc.expErr {
|
||||
sr.Contains(string(resp), tc.errorMsg)
|
||||
} else {
|
||||
var response bondtypes.QueryGetBondsResponse
|
||||
err := val.ClientCtx.Codec.UnmarshalJSON(resp, &response)
|
||||
sr.NoError(err)
|
||||
sr.NotZero(len(response.GetBonds()))
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (s *IntegrationTestSuite) TestGRPCGetParams() {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
reqUrl := fmt.Sprintf("%s/vulcanize/bond/v1beta1/params", val.APIAddress)
|
||||
|
||||
resp, err := rest.GetRequest(reqUrl)
|
||||
s.Require().NoError(err)
|
||||
|
||||
var params bondtypes.QueryParamsResponse
|
||||
err = val.ClientCtx.Codec.UnmarshalJSON(resp, ¶ms)
|
||||
|
||||
sr.NoError(err)
|
||||
sr.Equal(params.GetParams().MaxBondAmount, bondtypes.DefaultParams().MaxBondAmount)
|
||||
}
|
||||
|
||||
func (s *IntegrationTestSuite) TestGRPCGetBondsByOwner() {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
reqUrl := val.APIAddress + "/vulcanize/bond/v1beta1/by-owner/%s"
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
url string
|
||||
expErr bool
|
||||
preRun func()
|
||||
}{
|
||||
{
|
||||
"empty list",
|
||||
fmt.Sprintf(reqUrl, "asdasd"),
|
||||
true,
|
||||
func() {
|
||||
|
||||
},
|
||||
},
|
||||
{
|
||||
"valid request",
|
||||
fmt.Sprintf(reqUrl, s.accountAddress),
|
||||
false,
|
||||
func() {
|
||||
s.createBond()
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
s.Run(tc.name, func() {
|
||||
if !tc.expErr {
|
||||
tc.preRun()
|
||||
}
|
||||
|
||||
resp, err := rest.GetRequest(tc.url)
|
||||
s.Require().NoError(err)
|
||||
|
||||
var bonds bondtypes.QueryGetBondsByOwnerResponse
|
||||
err = val.ClientCtx.Codec.UnmarshalJSON(resp, &bonds)
|
||||
sr.NoError(err)
|
||||
if tc.expErr {
|
||||
sr.Empty(bonds.GetBonds())
|
||||
} else {
|
||||
bondsList := bonds.GetBonds()
|
||||
sr.NotZero(len(bondsList))
|
||||
sr.Equal(s.accountAddress, bondsList[0].GetOwner())
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (s *IntegrationTestSuite) TestGRPCGetBondById() {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
reqUrl := val.APIAddress + "/vulcanize/bond/v1beta1/bonds/%s"
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
url string
|
||||
expErr bool
|
||||
preRun func() string
|
||||
}{
|
||||
{
|
||||
"invalid request",
|
||||
fmt.Sprintf(reqUrl, "asdadad"),
|
||||
true,
|
||||
func() string {
|
||||
return ""
|
||||
},
|
||||
},
|
||||
{
|
||||
"valid request",
|
||||
reqUrl,
|
||||
false,
|
||||
func() string {
|
||||
// creating the bond
|
||||
s.createBond()
|
||||
|
||||
// getting the bonds list and returning the bond-id
|
||||
clientCtx := val.ClientCtx
|
||||
cmd := cli.GetQueryBondLists()
|
||||
args := []string{
|
||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
}
|
||||
out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args)
|
||||
sr.NoError(err)
|
||||
var queryResponse bondtypes.QueryGetBondsResponse
|
||||
err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &queryResponse)
|
||||
sr.NoError(err)
|
||||
|
||||
// extract bond id from bonds list
|
||||
bond := queryResponse.GetBonds()[0]
|
||||
return bond.GetId()
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, tc := range testCases {
|
||||
s.Run(tc.name, func() {
|
||||
var bondId string
|
||||
if !tc.expErr {
|
||||
bondId = tc.preRun()
|
||||
tc.url = fmt.Sprintf(reqUrl, bondId)
|
||||
}
|
||||
|
||||
resp, err := rest.GetRequest(tc.url)
|
||||
s.Require().NoError(err)
|
||||
|
||||
var bonds bondtypes.QueryGetBondByIdResponse
|
||||
err = val.ClientCtx.Codec.UnmarshalJSON(resp, &bonds)
|
||||
|
||||
if tc.expErr {
|
||||
sr.Empty(bonds.GetBond().GetId())
|
||||
} else {
|
||||
sr.NoError(err)
|
||||
sr.NotZero(bonds.GetBond().GetId())
|
||||
sr.Equal(bonds.GetBond().GetId(), bondId)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (s *IntegrationTestSuite) TestGRPCGetBondModuleBalance() {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
reqUrl := fmt.Sprintf("%s/vulcanize/bond/v1beta1/balance", val.APIAddress)
|
||||
|
||||
// creating the bond
|
||||
s.createBond()
|
||||
|
||||
s.Run("valid request", func() {
|
||||
resp, err := rest.GetRequest(reqUrl)
|
||||
sr.NoError(err)
|
||||
|
||||
var response bondtypes.QueryGetBondModuleBalanceResponse
|
||||
err = val.ClientCtx.Codec.UnmarshalJSON(resp, &response)
|
||||
|
||||
sr.NoError(err)
|
||||
sr.False(response.GetBalance().IsZero())
|
||||
})
|
||||
}
|
@ -1,225 +0,0 @@
|
||||
package testutil
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/cosmos/cosmos-sdk/testutil"
|
||||
grpctypes "github.com/cosmos/cosmos-sdk/types/grpc"
|
||||
"github.com/cosmos/cosmos-sdk/types/rest"
|
||||
bondtypes "github.com/tharsis/ethermint/x/bond/types"
|
||||
)
|
||||
|
||||
func (s *IntegrationTestSuite) TestGetBondsGRPC() {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
testCases := []struct {
|
||||
name string
|
||||
url string
|
||||
headers map[string]string
|
||||
noOfBonds int
|
||||
expErr bool
|
||||
}{
|
||||
{
|
||||
"invalid request with headers",
|
||||
fmt.Sprintf("%s/vulcanize/bond/v1beta1/bonds", val.APIAddress),
|
||||
map[string]string{
|
||||
grpctypes.GRPCBlockHeightHeader: "1",
|
||||
},
|
||||
0,
|
||||
true,
|
||||
},
|
||||
{
|
||||
"valid request",
|
||||
fmt.Sprintf("%s/vulcanize/bond/v1beta1/bonds", val.APIAddress),
|
||||
map[string]string{},
|
||||
0,
|
||||
false,
|
||||
},
|
||||
}
|
||||
for _, tc := range testCases {
|
||||
s.Run(tc.name, func() {
|
||||
resp, err := testutil.GetRequestWithHeaders(tc.url, tc.headers)
|
||||
sr.NoError(err)
|
||||
|
||||
var bonds bondtypes.QueryGetBondsResponse
|
||||
err = val.ClientCtx.Codec.UnmarshalJSON(resp, &bonds)
|
||||
|
||||
if tc.expErr {
|
||||
sr.Empty(bonds.GetBonds())
|
||||
} else {
|
||||
sr.NoError(err)
|
||||
sr.Len(bonds.GetBonds(), tc.noOfBonds)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (s *IntegrationTestSuite) TestGetParamsGRPC() {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
testCases := []struct {
|
||||
name string
|
||||
url string
|
||||
headers map[string]string
|
||||
noOfBonds int
|
||||
expErr bool
|
||||
}{
|
||||
{
|
||||
"valid request",
|
||||
fmt.Sprintf("%s/vulcanize/bond/v1beta1/params", val.APIAddress),
|
||||
map[string]string{},
|
||||
0,
|
||||
false,
|
||||
},
|
||||
}
|
||||
for _, tc := range testCases {
|
||||
s.Run(tc.name, func() {
|
||||
resp, err := rest.GetRequest(tc.url)
|
||||
s.Require().NoError(err)
|
||||
|
||||
var params bondtypes.QueryParamsResponse
|
||||
err = val.ClientCtx.Codec.UnmarshalJSON(resp, ¶ms)
|
||||
|
||||
if tc.expErr {
|
||||
sr.Empty(params.GetParams())
|
||||
} else {
|
||||
sr.NoError(err)
|
||||
sr.Equal(params.GetParams().MaxBondAmount, bondtypes.DefaultParams().MaxBondAmount)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (s *IntegrationTestSuite) TestGetBondsByOwnerGRPC() {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
testCases := []struct {
|
||||
name string
|
||||
url string
|
||||
headers map[string]string
|
||||
noOfBonds int
|
||||
expErr bool
|
||||
}{
|
||||
{
|
||||
"invalid request with headers",
|
||||
fmt.Sprintf("%s/vulcanize/bond/v1beta1/by-owner", val.APIAddress),
|
||||
map[string]string{
|
||||
grpctypes.GRPCBlockHeightHeader: "1",
|
||||
},
|
||||
0,
|
||||
true,
|
||||
},
|
||||
{
|
||||
"valid request",
|
||||
fmt.Sprintf("%s/vulcanize/bond/v1beta1/by-owner/%s,", val.APIAddress, val.Address.String()),
|
||||
map[string]string{},
|
||||
0,
|
||||
false,
|
||||
},
|
||||
}
|
||||
for _, tc := range testCases {
|
||||
s.Run(tc.name, func() {
|
||||
resp, err := testutil.GetRequestWithHeaders(tc.url, tc.headers)
|
||||
sr.NoError(err)
|
||||
|
||||
var bonds bondtypes.QueryGetBondsByOwnerResponse
|
||||
err = val.ClientCtx.Codec.UnmarshalJSON(resp, &bonds)
|
||||
|
||||
if tc.expErr {
|
||||
sr.Empty(bonds.GetBonds())
|
||||
} else {
|
||||
sr.NoError(err)
|
||||
sr.Len(bonds.GetBonds(), tc.noOfBonds)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (s *IntegrationTestSuite) TestGetBondByIdGRPC() {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
testCases := []struct {
|
||||
name string
|
||||
url string
|
||||
headers map[string]string
|
||||
noOfBonds int
|
||||
expErr bool
|
||||
}{
|
||||
{
|
||||
"invalid request with headers",
|
||||
fmt.Sprintf("%s/vulcanize/bond/v1beta1/bonds/%s", val.APIAddress, "asdadad"),
|
||||
map[string]string{
|
||||
grpctypes.GRPCBlockHeightHeader: "1",
|
||||
},
|
||||
0,
|
||||
true,
|
||||
},
|
||||
{
|
||||
"valid request",
|
||||
fmt.Sprintf("%s/vulcanize/bond/v1beta1/bonds/%s,", val.APIAddress, "asdadad"),
|
||||
map[string]string{},
|
||||
0,
|
||||
false,
|
||||
},
|
||||
}
|
||||
for _, tc := range testCases {
|
||||
s.Run(tc.name, func() {
|
||||
resp, err := testutil.GetRequestWithHeaders(tc.url, tc.headers)
|
||||
sr.NoError(err)
|
||||
|
||||
var bonds bondtypes.QueryGetBondByIdResponse
|
||||
err = val.ClientCtx.Codec.UnmarshalJSON(resp, &bonds)
|
||||
|
||||
if tc.expErr {
|
||||
sr.Empty(bonds.GetBond().GetId())
|
||||
} else {
|
||||
sr.NoError(err)
|
||||
sr.Len(bonds.GetBond().GetId(), tc.noOfBonds)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (s *IntegrationTestSuite) TestGetBondModuleBalanceGRPC() {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
testCases := []struct {
|
||||
name string
|
||||
url string
|
||||
headers map[string]string
|
||||
noOfBonds int
|
||||
expErr bool
|
||||
}{
|
||||
{
|
||||
"invalid request with headers",
|
||||
fmt.Sprintf("%s/vulcanize/bond/v1beta1/balance", val.APIAddress),
|
||||
map[string]string{
|
||||
grpctypes.GRPCBlockHeightHeader: "1",
|
||||
},
|
||||
0,
|
||||
true,
|
||||
},
|
||||
{
|
||||
"valid request",
|
||||
fmt.Sprintf("%s/vulcanize/bond/v1beta1/balance", val.APIAddress),
|
||||
map[string]string{},
|
||||
0,
|
||||
false,
|
||||
},
|
||||
}
|
||||
for _, tc := range testCases {
|
||||
s.Run(tc.name, func() {
|
||||
resp, err := testutil.GetRequestWithHeaders(tc.url, tc.headers)
|
||||
sr.NoError(err)
|
||||
|
||||
var bonds bondtypes.QueryGetBondModuleBalanceResponse
|
||||
err = val.ClientCtx.Codec.UnmarshalJSON(resp, &bonds)
|
||||
|
||||
if tc.expErr {
|
||||
sr.Empty(bonds.GetBalance())
|
||||
} else {
|
||||
sr.NoError(err)
|
||||
sr.True(bonds.GetBalance().IsZero())
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
@ -14,20 +14,16 @@ import (
|
||||
"github.com/tharsis/ethermint/testutil/network"
|
||||
"github.com/tharsis/ethermint/x/bond/client/cli"
|
||||
"github.com/tharsis/ethermint/x/bond/types"
|
||||
"gopkg.in/yaml.v2"
|
||||
)
|
||||
|
||||
type IntegrationTestSuite struct {
|
||||
suite.Suite
|
||||
|
||||
cfg network.Config
|
||||
network *network.Network
|
||||
}
|
||||
|
||||
var (
|
||||
accountName = "accountName"
|
||||
cfg network.Config
|
||||
network *network.Network
|
||||
accountName string
|
||||
accountAddress string
|
||||
)
|
||||
}
|
||||
|
||||
func NewIntegrationTestSuite(cfg network.Config) *IntegrationTestSuite {
|
||||
return &IntegrationTestSuite{cfg: cfg}
|
||||
@ -41,8 +37,9 @@ func (s *IntegrationTestSuite) SetupSuite() {
|
||||
_, err := s.network.WaitForHeight(1)
|
||||
s.Require().NoError(err)
|
||||
|
||||
s.accountName = "accountName"
|
||||
// setting up random account
|
||||
s.createAccountWithBalance(accountName)
|
||||
s.createAccountWithBalance(s.accountName)
|
||||
}
|
||||
|
||||
func (s *IntegrationTestSuite) TearDownSuite() {
|
||||
@ -72,15 +69,10 @@ func (s *IntegrationTestSuite) TestGetCmdQueryParams() {
|
||||
|
||||
out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args)
|
||||
s.Require().NoError(err)
|
||||
var param types.QueryParamsResponse
|
||||
if tc.outputType == "json" {
|
||||
err := clientCtx.Codec.UnmarshalJSON(out.Bytes(), ¶m)
|
||||
s.Require().NoError(err)
|
||||
} else {
|
||||
err := yaml.Unmarshal(out.Bytes(), ¶m)
|
||||
s.Require().NoError(err)
|
||||
}
|
||||
s.Require().Equal(param.Params.MaxBondAmount, types.DefaultParams().MaxBondAmount)
|
||||
var response types.QueryParamsResponse
|
||||
err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response)
|
||||
s.Require().NoError(err)
|
||||
s.Require().Equal(response.Params.MaxBondAmount, types.DefaultParams().MaxBondAmount)
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -101,12 +93,14 @@ func (s *IntegrationTestSuite) createAccountWithBalance(accountName string) {
|
||||
val.ClientCtx,
|
||||
val.Address,
|
||||
newAddr,
|
||||
sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(200))), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||
sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(200))),
|
||||
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()),
|
||||
)
|
||||
sr.NoError(err)
|
||||
accountAddress = newAddr.String()
|
||||
s.accountAddress = newAddr.String()
|
||||
}
|
||||
|
||||
func (s *IntegrationTestSuite) createBond() {
|
||||
@ -115,7 +109,8 @@ func (s *IntegrationTestSuite) createBond() {
|
||||
createBondCmd := cli.NewCreateBondCmd()
|
||||
args := []string{
|
||||
fmt.Sprintf("10%s", s.cfg.BondDenom),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountName),
|
||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)),
|
||||
@ -123,7 +118,8 @@ func (s *IntegrationTestSuite) createBond() {
|
||||
out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, createBondCmd, args)
|
||||
sr.NoError(err)
|
||||
var d sdk.TxResponse
|
||||
val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d)
|
||||
err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d)
|
||||
sr.NoError(err)
|
||||
sr.Zero(d.Code)
|
||||
err = s.network.WaitForNextBlock()
|
||||
sr.NoError(err)
|
||||
@ -136,14 +132,16 @@ func (s *IntegrationTestSuite) TestGetQueryBondLists() {
|
||||
testCases := []struct {
|
||||
name string
|
||||
args []string
|
||||
outputType string
|
||||
createBond bool
|
||||
preRun func()
|
||||
}{
|
||||
{
|
||||
"create and get bond lists",
|
||||
[]string{fmt.Sprintf("--%s=json", tmcli.OutputFlag)},
|
||||
"json",
|
||||
true,
|
||||
func() {
|
||||
s.createBond()
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@ -151,20 +149,15 @@ func (s *IntegrationTestSuite) TestGetQueryBondLists() {
|
||||
s.Run(fmt.Sprintf("Case %s", tc.name), func() {
|
||||
clientCtx := val.ClientCtx
|
||||
if tc.createBond {
|
||||
s.createBond()
|
||||
tc.preRun()
|
||||
}
|
||||
cmd := cli.GetQueryBondLists()
|
||||
|
||||
cmd := cli.GetQueryBondLists()
|
||||
out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args)
|
||||
sr.NoError(err)
|
||||
var queryResponse types.QueryGetBondsResponse
|
||||
if tc.outputType == "json" {
|
||||
err := clientCtx.Codec.UnmarshalJSON(out.Bytes(), &queryResponse)
|
||||
sr.NoError(err)
|
||||
} else {
|
||||
err := yaml.Unmarshal(out.Bytes(), &queryResponse)
|
||||
sr.NoError(err)
|
||||
}
|
||||
err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &queryResponse)
|
||||
sr.NoError(err)
|
||||
sr.NotZero(len(queryResponse.GetBonds()))
|
||||
})
|
||||
}
|
||||
@ -174,10 +167,10 @@ func (s *IntegrationTestSuite) TestGetQueryBondById() {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
testCases := []struct {
|
||||
name string
|
||||
args []string
|
||||
createBond bool
|
||||
err bool
|
||||
name string
|
||||
args []string
|
||||
err bool
|
||||
preRun func() string
|
||||
}{
|
||||
{
|
||||
"invalid bond id",
|
||||
@ -185,34 +178,44 @@ func (s *IntegrationTestSuite) TestGetQueryBondById() {
|
||||
fmt.Sprint("not_found_bond_id"),
|
||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
},
|
||||
false,
|
||||
true,
|
||||
func() string {
|
||||
return ""
|
||||
},
|
||||
},
|
||||
{
|
||||
"create and get bond by id",
|
||||
[]string{fmt.Sprintf("--%s=json", tmcli.OutputFlag)},
|
||||
true,
|
||||
false,
|
||||
func() string {
|
||||
// creating the bond
|
||||
s.createBond()
|
||||
|
||||
// getting the bonds list and returning the bond-id
|
||||
clientCtx := val.ClientCtx
|
||||
cmd := cli.GetQueryBondLists()
|
||||
args := []string{
|
||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
}
|
||||
out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args)
|
||||
sr.NoError(err)
|
||||
var queryResponse types.QueryGetBondsResponse
|
||||
err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &queryResponse)
|
||||
sr.NoError(err)
|
||||
|
||||
// extract bond id from bonds list
|
||||
bond := queryResponse.GetBonds()[0]
|
||||
return bond.GetId()
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
s.Run(fmt.Sprintf("Case %s", tc.name), func() {
|
||||
clientCtx := val.ClientCtx
|
||||
if tc.createBond {
|
||||
s.createBond()
|
||||
cmd := cli.GetQueryBondLists()
|
||||
|
||||
out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args)
|
||||
sr.NoError(err)
|
||||
var queryResponse types.QueryGetBondsResponse
|
||||
err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &queryResponse)
|
||||
sr.NoError(err)
|
||||
|
||||
// extract bond id from bonds list
|
||||
bond := queryResponse.GetBonds()[0]
|
||||
tc.args = append([]string{bond.GetId()}, tc.args...)
|
||||
|
||||
if !tc.err {
|
||||
bondId := tc.preRun()
|
||||
tc.args = append([]string{bondId}, tc.args...)
|
||||
}
|
||||
cmd := cli.GetBondByIdCmd()
|
||||
|
||||
@ -225,7 +228,7 @@ func (s *IntegrationTestSuite) TestGetQueryBondById() {
|
||||
sr.Zero(len(queryResponse.GetBond().GetId()))
|
||||
} else {
|
||||
sr.NotZero(len(queryResponse.GetBond().GetId()))
|
||||
sr.Equal(accountAddress, queryResponse.GetBond().GetOwner())
|
||||
sr.Equal(s.accountAddress, queryResponse.GetBond().GetOwner())
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -235,10 +238,10 @@ func (s *IntegrationTestSuite) TestGetQueryBondListsByOwner() {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
testCases := []struct {
|
||||
name string
|
||||
args []string
|
||||
createBond bool
|
||||
err bool
|
||||
name string
|
||||
args []string
|
||||
err bool
|
||||
preRun func()
|
||||
}{
|
||||
{
|
||||
"invalid owner address",
|
||||
@ -246,25 +249,29 @@ func (s *IntegrationTestSuite) TestGetQueryBondListsByOwner() {
|
||||
fmt.Sprint("not_found_bond_id"),
|
||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
},
|
||||
false,
|
||||
true,
|
||||
func() {
|
||||
|
||||
},
|
||||
},
|
||||
{
|
||||
"get bond lists by owner address",
|
||||
[]string{
|
||||
fmt.Sprint(accountAddress),
|
||||
fmt.Sprint(s.accountAddress),
|
||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
},
|
||||
true,
|
||||
false,
|
||||
func() {
|
||||
s.createBond()
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
s.Run(fmt.Sprintf("Case %s", tc.name), func() {
|
||||
clientCtx := val.ClientCtx
|
||||
if tc.createBond {
|
||||
s.createBond()
|
||||
if !tc.err {
|
||||
tc.preRun()
|
||||
}
|
||||
cmd := cli.GetBondListByOwnerCmd()
|
||||
|
||||
@ -277,7 +284,7 @@ func (s *IntegrationTestSuite) TestGetQueryBondListsByOwner() {
|
||||
sr.Zero(len(queryResponse.GetBonds()))
|
||||
} else {
|
||||
sr.NotZero(len(queryResponse.GetBonds()))
|
||||
sr.Equal(accountAddress, queryResponse.GetBonds()[0].GetOwner())
|
||||
sr.Equal(s.accountAddress, queryResponse.GetBonds()[0].GetOwner())
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -287,27 +294,32 @@ func (s *IntegrationTestSuite) TestGetQueryBondModuleBalance() {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
testCases := []struct {
|
||||
name string
|
||||
args []string
|
||||
createBond bool
|
||||
name string
|
||||
args []string
|
||||
err bool
|
||||
preRun func()
|
||||
}{
|
||||
{
|
||||
"get bond module balance",
|
||||
[]string{
|
||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
},
|
||||
true,
|
||||
false,
|
||||
func() {
|
||||
s.createBond()
|
||||
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
s.Run(fmt.Sprintf("Case %s", tc.name), func() {
|
||||
clientCtx := val.ClientCtx
|
||||
if tc.createBond {
|
||||
s.createBond()
|
||||
if !tc.err {
|
||||
tc.preRun()
|
||||
}
|
||||
cmd := cli.GetBondModuleBalanceCmd()
|
||||
|
||||
cmd := cli.GetBondModuleBalanceCmd()
|
||||
out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args)
|
||||
sr.NoError(err)
|
||||
var queryResponse types.QueryGetBondModuleBalanceResponse
|
@ -22,7 +22,8 @@ func (s *IntegrationTestSuite) TestTxCreateBond() {
|
||||
{
|
||||
"without deposit",
|
||||
[]string{
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountName),
|
||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)),
|
||||
@ -33,8 +34,10 @@ func (s *IntegrationTestSuite) TestTxCreateBond() {
|
||||
"create bond",
|
||||
[]string{
|
||||
fmt.Sprintf("10%s", s.cfg.BondDenom),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountName),
|
||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)),
|
||||
},
|
||||
@ -54,6 +57,7 @@ func (s *IntegrationTestSuite) TestTxCreateBond() {
|
||||
sr.NoError(err)
|
||||
var d sdk.TxResponse
|
||||
err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d)
|
||||
sr.Nil(err)
|
||||
sr.NoError(err)
|
||||
sr.Zero(d.Code)
|
||||
}
|
||||
@ -74,7 +78,8 @@ func (s *IntegrationTestSuite) TestTxRefillBond() {
|
||||
{
|
||||
"without refill amount and bond id",
|
||||
[]string{
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountName),
|
||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)),
|
||||
@ -86,7 +91,8 @@ func (s *IntegrationTestSuite) TestTxRefillBond() {
|
||||
"refill bond",
|
||||
[]string{
|
||||
fmt.Sprintf("10%s", s.cfg.BondDenom),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountName),
|
||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)),
|
||||
@ -157,7 +163,8 @@ func (s *IntegrationTestSuite) TestTxWithdrawAmountFromBond() {
|
||||
{
|
||||
"without withdraw amount and bond id",
|
||||
[]string{
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountName),
|
||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)),
|
||||
@ -169,7 +176,8 @@ func (s *IntegrationTestSuite) TestTxWithdrawAmountFromBond() {
|
||||
"withdraw amount from bond",
|
||||
[]string{
|
||||
fmt.Sprintf("10%s", s.cfg.BondDenom),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountName),
|
||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)),
|
||||
@ -240,7 +248,8 @@ func (s *IntegrationTestSuite) TestTxCancelBond() {
|
||||
{
|
||||
"without bond id",
|
||||
[]string{
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountName),
|
||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)),
|
||||
@ -251,7 +260,8 @@ func (s *IntegrationTestSuite) TestTxCancelBond() {
|
||||
{
|
||||
"cancel bond",
|
||||
[]string{
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, s.accountName),
|
||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)),
|
@ -60,7 +60,7 @@ $ %s tx %s set [payload file path] [bond-id]
|
||||
return err
|
||||
}
|
||||
|
||||
payload, err := getPayloadFromFile(args[0])
|
||||
payload, err := GetPayloadFromFile(args[0])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -370,8 +370,8 @@ $ %s tx %s delete-name [wrn]
|
||||
return cmd
|
||||
}
|
||||
|
||||
// Load payload object from YAML file.
|
||||
func getPayloadFromFile(filePath string) (*types.PayloadType, error) {
|
||||
//GetPayloadFromFile Load payload object from YAML file.
|
||||
func GetPayloadFromFile(filePath string) (*types.PayloadType, error) {
|
||||
var payload types.PayloadType
|
||||
|
||||
data, err := ioutil.ReadFile(filePath)
|
13
x/nameservice/client/testutil/cli_test.go
Normal file
13
x/nameservice/client/testutil/cli_test.go
Normal file
@ -0,0 +1,13 @@
|
||||
package testutil
|
||||
|
||||
import (
|
||||
"github.com/stretchr/testify/suite"
|
||||
"github.com/tharsis/ethermint/testutil/network"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestIntegrationTestSuite(t *testing.T) {
|
||||
cfg := network.DefaultConfig()
|
||||
cfg.NumValidators = 1
|
||||
suite.Run(t, NewIntegrationTestSuite(cfg))
|
||||
}
|
7
x/nameservice/client/testutil/example1.yml
Normal file
7
x/nameservice/client/testutil/example1.yml
Normal file
@ -0,0 +1,7 @@
|
||||
record:
|
||||
attr1: value1
|
||||
attr2: value2
|
||||
link1:
|
||||
/: QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D
|
||||
link2:
|
||||
/: QmP8jTG1m9GSDJLCbeWhVSVgEzCPPwXRdCRuJtQ5Tz9Kc9
|
649
x/nameservice/client/testutil/grpc.go
Normal file
649
x/nameservice/client/testutil/grpc.go
Normal file
@ -0,0 +1,649 @@
|
||||
package testutil
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/cosmos/cosmos-sdk/client/flags"
|
||||
clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/types/rest"
|
||||
tmcli "github.com/tendermint/tendermint/libs/cli"
|
||||
"github.com/tharsis/ethermint/x/nameservice/client/cli"
|
||||
nstypes "github.com/tharsis/ethermint/x/nameservice/types"
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
|
||||
func (s *IntegrationTestSuite) TestGRPCQueryParams() {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
reqUrl := val.APIAddress + "/vulcanize/nameservice/v1beta1/params"
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
url string
|
||||
expectErr bool
|
||||
errorMsg string
|
||||
}{
|
||||
{
|
||||
"invalid url",
|
||||
reqUrl + "/asdasd",
|
||||
true,
|
||||
"",
|
||||
},
|
||||
{
|
||||
"Success",
|
||||
reqUrl,
|
||||
false,
|
||||
"",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
s.Run(tc.name, func() {
|
||||
resp, _ := rest.GetRequest(tc.url)
|
||||
require := s.Require()
|
||||
if tc.expectErr {
|
||||
require.Contains(string(resp), tc.errorMsg)
|
||||
} else {
|
||||
var response nstypes.QueryParamsResponse
|
||||
err := val.ClientCtx.Codec.UnmarshalJSON(resp, &response)
|
||||
sr.NoError(err)
|
||||
params := nstypes.DefaultParams()
|
||||
params.RecordRent = sdk.NewCoin(s.cfg.BondDenom, nstypes.DefaultRecordRent)
|
||||
params.RecordRentDuration = 5 * time.Second
|
||||
params.AuthorityGracePeriod = 5 * time.Second
|
||||
sr.Equal(response.GetParams().String(), params.String())
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (s *IntegrationTestSuite) TestGRPCQueryWhoIs() {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
reqUrl := val.APIAddress + "/vulcanize/nameservice/v1beta1/whois/%s"
|
||||
var authorityName = "QueryWhoIS"
|
||||
testCases := []struct {
|
||||
name string
|
||||
url string
|
||||
expectErr bool
|
||||
errorMsg string
|
||||
preRun func(authorityName string)
|
||||
}{
|
||||
{
|
||||
"invalid url",
|
||||
reqUrl + "/asdasd",
|
||||
true,
|
||||
"",
|
||||
func(authorityName string) {
|
||||
|
||||
},
|
||||
},
|
||||
{
|
||||
"Success",
|
||||
reqUrl,
|
||||
false,
|
||||
"",
|
||||
func(authorityName string) {
|
||||
clientCtx := val.ClientCtx
|
||||
cmd := cli.GetCmdReserveName()
|
||||
args := []string{
|
||||
authorityName,
|
||||
fmt.Sprintf("--owner=%s", accountAddress),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName),
|
||||
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)),
|
||||
}
|
||||
out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args)
|
||||
sr.NoError(err)
|
||||
var d sdk.TxResponse
|
||||
err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d)
|
||||
sr.NoError(err)
|
||||
sr.Zero(d.Code)
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
s.Run(tc.name, func() {
|
||||
if !tc.expectErr {
|
||||
tc.preRun(authorityName)
|
||||
tc.url = fmt.Sprintf(tc.url, authorityName)
|
||||
}
|
||||
resp, _ := rest.GetRequest(tc.url)
|
||||
require := s.Require()
|
||||
if tc.expectErr {
|
||||
require.Contains(string(resp), tc.errorMsg)
|
||||
} else {
|
||||
var response nstypes.QueryWhoisResponse
|
||||
err := val.ClientCtx.Codec.UnmarshalJSON(resp, &response)
|
||||
sr.NoError(err)
|
||||
sr.Equal(nstypes.AuthorityActive, response.GetNameAuthority().Status)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (s *IntegrationTestSuite) TestGRPCQueryLookup() {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
reqUrl := val.APIAddress + "/vulcanize/nameservice/v1beta1/lookup?wrn=%s"
|
||||
var authorityName = "QueryLookUp"
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
url string
|
||||
expectErr bool
|
||||
errorMsg string
|
||||
preRun func(authorityName string)
|
||||
}{
|
||||
{
|
||||
"invalid url",
|
||||
reqUrl + "/asdasd",
|
||||
true,
|
||||
"",
|
||||
func(authorityName string) {
|
||||
|
||||
},
|
||||
},
|
||||
{
|
||||
"Success",
|
||||
reqUrl,
|
||||
false,
|
||||
"",
|
||||
func(authorityName string) {
|
||||
// create name record
|
||||
createNameRecord(authorityName, s)
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
s.Run(tc.name, func() {
|
||||
if !tc.expectErr {
|
||||
tc.preRun(authorityName)
|
||||
tc.url = fmt.Sprintf(reqUrl, fmt.Sprintf("wrn://%s/", authorityName))
|
||||
}
|
||||
resp, _ := rest.GetRequest(tc.url)
|
||||
if tc.expectErr {
|
||||
sr.Contains(string(resp), tc.errorMsg)
|
||||
} else {
|
||||
var response nstypes.QueryLookupWrnResponse
|
||||
err := val.ClientCtx.Codec.UnmarshalJSON(resp, &response)
|
||||
sr.NoError(err)
|
||||
sr.NotZero(len(response.Name.Latest.Id))
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (s *IntegrationTestSuite) TestGRPCQueryRecordExpiryQueue() {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
reqUrl := val.APIAddress + "/vulcanize/nameservice/v1beta1/record-expiry"
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
url string
|
||||
expectErr bool
|
||||
errorMsg string
|
||||
preRun func(bondId string)
|
||||
}{
|
||||
{
|
||||
"invalid url",
|
||||
reqUrl + "/asdasd",
|
||||
true,
|
||||
"",
|
||||
func(bondId string) {
|
||||
|
||||
},
|
||||
},
|
||||
{
|
||||
"Success",
|
||||
reqUrl,
|
||||
false,
|
||||
"",
|
||||
func(bondId string) {
|
||||
dir, err := os.Getwd()
|
||||
sr.NoError(err)
|
||||
payloadPath := dir + "/example1.yml"
|
||||
args := []string{
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName),
|
||||
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)),
|
||||
}
|
||||
args = append([]string{payloadPath, bondId}, args...)
|
||||
clientCtx := val.ClientCtx
|
||||
cmd := cli.GetCmdSetRecord()
|
||||
|
||||
out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args)
|
||||
sr.NoError(err)
|
||||
var d sdk.TxResponse
|
||||
err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d)
|
||||
sr.NoError(err)
|
||||
sr.Zero(d.Code)
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
s.Run(tc.name, func() {
|
||||
if !tc.expectErr {
|
||||
tc.preRun(s.bondId)
|
||||
}
|
||||
// wait 7 seconds for records expires
|
||||
time.Sleep(time.Second * 7)
|
||||
resp, _ := rest.GetRequest(tc.url)
|
||||
require := s.Require()
|
||||
if tc.expectErr {
|
||||
require.Contains(string(resp), tc.errorMsg)
|
||||
} else {
|
||||
var response nstypes.QueryGetRecordExpiryQueueResponse
|
||||
err := val.ClientCtx.Codec.UnmarshalJSON(resp, &response)
|
||||
sr.NoError(err)
|
||||
sr.NotZero(len(response.GetRecords()))
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (s *IntegrationTestSuite) TestGRPCQueryAuthorityExpiryQueue() {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
reqUrl := val.APIAddress + "/vulcanize/nameservice/v1beta1/authority-expiry"
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
url string
|
||||
expectErr bool
|
||||
errorMsg string
|
||||
preRun func(authorityName string)
|
||||
}{
|
||||
{
|
||||
"invalid url",
|
||||
reqUrl + "/asdasd",
|
||||
true,
|
||||
"",
|
||||
func(authorityName string) {
|
||||
|
||||
},
|
||||
},
|
||||
{
|
||||
"Success",
|
||||
reqUrl,
|
||||
false,
|
||||
"",
|
||||
func(authorityName string) {
|
||||
// reserving the name
|
||||
clientCtx := val.ClientCtx
|
||||
cmd := cli.GetCmdReserveName()
|
||||
args := []string{
|
||||
authorityName,
|
||||
fmt.Sprintf("--owner=%s", accountAddress),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName),
|
||||
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)),
|
||||
}
|
||||
out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args)
|
||||
sr.NoError(err)
|
||||
var d sdk.TxResponse
|
||||
err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d)
|
||||
sr.NoError(err)
|
||||
sr.Zero(d.Code)
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
s.Run(tc.name, func() {
|
||||
if !tc.expectErr {
|
||||
tc.preRun("QueryAuthorityExpiryQueue")
|
||||
}
|
||||
// wait 7 seconds to name authorites expires
|
||||
time.Sleep(time.Second * 7)
|
||||
|
||||
resp, _ := rest.GetRequest(tc.url)
|
||||
require := s.Require()
|
||||
if tc.expectErr {
|
||||
require.Contains(string(resp), tc.errorMsg)
|
||||
} else {
|
||||
var response nstypes.QueryGetAuthorityExpiryQueueResponse
|
||||
err := val.ClientCtx.Codec.UnmarshalJSON(resp, &response)
|
||||
sr.NoError(err)
|
||||
sr.NotZero(len(response.GetAuthorities()))
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (s *IntegrationTestSuite) TestGRPCQueryListRecords() {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
reqUrl := val.APIAddress + "/vulcanize/nameservice/v1beta1/records"
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
url string
|
||||
expectErr bool
|
||||
errorMsg string
|
||||
preRun func(bondId string)
|
||||
}{
|
||||
{
|
||||
"invalid url",
|
||||
reqUrl + "/asdasd",
|
||||
true,
|
||||
"",
|
||||
func(bondId string) {
|
||||
|
||||
},
|
||||
},
|
||||
{
|
||||
"Success",
|
||||
reqUrl,
|
||||
false,
|
||||
"",
|
||||
func(bondId string) {
|
||||
dir, err := os.Getwd()
|
||||
sr.NoError(err)
|
||||
payloadPath := dir + "/example1.yml"
|
||||
args := []string{
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName),
|
||||
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)),
|
||||
}
|
||||
args = append([]string{payloadPath, bondId}, args...)
|
||||
clientCtx := val.ClientCtx
|
||||
cmd := cli.GetCmdSetRecord()
|
||||
|
||||
out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args)
|
||||
sr.NoError(err)
|
||||
var d sdk.TxResponse
|
||||
err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d)
|
||||
sr.NoError(err)
|
||||
sr.Zero(d.Code)
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
s.Run(tc.name, func() {
|
||||
if !tc.expectErr {
|
||||
tc.preRun(s.bondId)
|
||||
}
|
||||
resp, _ := rest.GetRequest(tc.url)
|
||||
require := s.Require()
|
||||
if tc.expectErr {
|
||||
require.Contains(string(resp), tc.errorMsg)
|
||||
} else {
|
||||
var response nstypes.QueryListRecordsResponse
|
||||
err := val.ClientCtx.Codec.UnmarshalJSON(resp, &response)
|
||||
sr.NoError(err)
|
||||
sr.NotZero(len(response.GetRecords()))
|
||||
sr.Equal(s.bondId, response.GetRecords()[0].GetBondId())
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (s *IntegrationTestSuite) TestGRPCQueryGetRecordByID() {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
reqUrl := val.APIAddress + "/vulcanize/nameservice/v1beta1/records/%s"
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
url string
|
||||
expectErr bool
|
||||
errorMsg string
|
||||
preRun func(bondId string) string
|
||||
}{
|
||||
{
|
||||
"invalid url",
|
||||
reqUrl + "/asdasd",
|
||||
true,
|
||||
"",
|
||||
func(bondId string) string {
|
||||
return ""
|
||||
},
|
||||
},
|
||||
{
|
||||
"Success",
|
||||
reqUrl,
|
||||
false,
|
||||
"",
|
||||
func(bondId string) string {
|
||||
// creating the record
|
||||
createRecord(bondId, s)
|
||||
|
||||
// list the records
|
||||
clientCtx := val.ClientCtx
|
||||
cmd := cli.GetCmdList()
|
||||
args := []string{
|
||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
}
|
||||
out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args)
|
||||
sr.NoError(err)
|
||||
var records []nstypes.RecordType
|
||||
err = json.Unmarshal(out.Bytes(), &records)
|
||||
sr.NoError(err)
|
||||
return records[0].Id
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
s.Run(tc.name, func() {
|
||||
var recordId string
|
||||
if !tc.expectErr {
|
||||
recordId = tc.preRun(s.bondId)
|
||||
tc.url = fmt.Sprintf(reqUrl, recordId)
|
||||
}
|
||||
resp, _ := rest.GetRequest(tc.url)
|
||||
require := s.Require()
|
||||
if tc.expectErr {
|
||||
require.Contains(string(resp), tc.errorMsg)
|
||||
} else {
|
||||
var response nstypes.QueryRecordByIdResponse
|
||||
err := val.ClientCtx.Codec.UnmarshalJSON(resp, &response)
|
||||
sr.NoError(err)
|
||||
record := response.GetRecord()
|
||||
sr.NotZero(len(record.GetId()))
|
||||
sr.Equal(record.GetId(), recordId)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (s *IntegrationTestSuite) TestGRPCQueryGetRecordByBondID() {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
reqUrl := val.APIAddress + "/vulcanize/nameservice/v1beta1/records-by-bond-id/%s"
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
url string
|
||||
expectErr bool
|
||||
errorMsg string
|
||||
preRun func(bondId string)
|
||||
}{
|
||||
{
|
||||
"invalid url",
|
||||
reqUrl + "/asdasd",
|
||||
true,
|
||||
"",
|
||||
func(bondId string) {
|
||||
|
||||
},
|
||||
},
|
||||
{
|
||||
"Success",
|
||||
reqUrl,
|
||||
false,
|
||||
"",
|
||||
func(bondId string) {
|
||||
// creating the record
|
||||
createRecord(bondId, s)
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
s.Run(tc.name, func() {
|
||||
if !tc.expectErr {
|
||||
tc.preRun(s.bondId)
|
||||
tc.url = fmt.Sprintf(reqUrl, s.bondId)
|
||||
}
|
||||
resp, _ := rest.GetRequest(tc.url)
|
||||
require := s.Require()
|
||||
if tc.expectErr {
|
||||
require.Contains(string(resp), tc.errorMsg)
|
||||
} else {
|
||||
var response nstypes.QueryRecordByBondIdResponse
|
||||
err := val.ClientCtx.Codec.UnmarshalJSON(resp, &response)
|
||||
sr.NoError(err)
|
||||
records := response.GetRecords()
|
||||
sr.NotZero(len(records))
|
||||
sr.Equal(records[0].GetBondId(), s.bondId)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (s *IntegrationTestSuite) TestGRPCQueryGetNameServiceModuleBalance() {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
reqUrl := val.APIAddress + "/vulcanize/nameservice/v1beta1/balance"
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
url string
|
||||
expectErr bool
|
||||
errorMsg string
|
||||
preRun func(bondId string)
|
||||
}{
|
||||
{
|
||||
"invalid url",
|
||||
reqUrl + "/asdasd",
|
||||
true,
|
||||
"",
|
||||
func(bondId string) {
|
||||
|
||||
},
|
||||
},
|
||||
{
|
||||
"Success",
|
||||
reqUrl,
|
||||
false,
|
||||
"",
|
||||
func(bondId string) {
|
||||
// creating the record
|
||||
createRecord(bondId, s)
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
s.Run(tc.name, func() {
|
||||
if !tc.expectErr {
|
||||
tc.preRun(s.bondId)
|
||||
}
|
||||
resp, _ := rest.GetRequest(tc.url)
|
||||
require := s.Require()
|
||||
if tc.expectErr {
|
||||
require.Contains(string(resp), tc.errorMsg)
|
||||
} else {
|
||||
var response nstypes.GetNameServiceModuleBalanceResponse
|
||||
err := val.ClientCtx.Codec.UnmarshalJSON(resp, &response)
|
||||
sr.NoError(err)
|
||||
sr.NotZero(len(response.GetBalances()))
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (s *IntegrationTestSuite) TestGRPCQueryNamesList() {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
reqUrl := val.APIAddress + "/vulcanize/nameservice/v1beta1/names"
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
url string
|
||||
expectErr bool
|
||||
errorMsg string
|
||||
preRun func(authorityName string)
|
||||
}{
|
||||
{
|
||||
"invalid url",
|
||||
reqUrl + "/asdasd",
|
||||
true,
|
||||
"",
|
||||
func(authorityName string) {
|
||||
|
||||
},
|
||||
},
|
||||
{
|
||||
"Success",
|
||||
reqUrl,
|
||||
false,
|
||||
"",
|
||||
func(authorityName string) {
|
||||
// create name record
|
||||
createNameRecord(authorityName, s)
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
s.Run(tc.name, func() {
|
||||
if !tc.expectErr {
|
||||
tc.preRun("ListNameRecords")
|
||||
}
|
||||
resp, _ := rest.GetRequest(tc.url)
|
||||
require := s.Require()
|
||||
if tc.expectErr {
|
||||
require.Contains(string(resp), tc.errorMsg)
|
||||
} else {
|
||||
var response nstypes.QueryListNameRecordsResponse
|
||||
err := val.ClientCtx.Codec.UnmarshalJSON(resp, &response)
|
||||
sr.NoError(err)
|
||||
sr.NotZero(len(response.GetNames()))
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func createRecord(bondId string, s *IntegrationTestSuite) {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
|
||||
dir, err := os.Getwd()
|
||||
sr.NoError(err)
|
||||
payloadPath := dir + "/example1.yml"
|
||||
args := []string{
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName),
|
||||
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)),
|
||||
}
|
||||
args = append([]string{payloadPath, bondId}, args...)
|
||||
clientCtx := val.ClientCtx
|
||||
cmd := cli.GetCmdSetRecord()
|
||||
|
||||
out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args)
|
||||
sr.NoError(err)
|
||||
var d sdk.TxResponse
|
||||
err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d)
|
||||
sr.NoError(err)
|
||||
sr.Zero(d.Code)
|
||||
}
|
584
x/nameservice/client/testutil/query.go
Normal file
584
x/nameservice/client/testutil/query.go
Normal file
@ -0,0 +1,584 @@
|
||||
package testutil
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/cosmos/cosmos-sdk/client/flags"
|
||||
clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
tmcli "github.com/tendermint/tendermint/libs/cli"
|
||||
"github.com/tharsis/ethermint/x/nameservice/client/cli"
|
||||
"github.com/tharsis/ethermint/x/nameservice/types"
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
|
||||
func (s *IntegrationTestSuite) TestGetCmdQueryParams() {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
args []string
|
||||
}{
|
||||
{
|
||||
"params",
|
||||
[]string{fmt.Sprintf("--%s=json", tmcli.OutputFlag)},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
s.Run(tc.name, func() {
|
||||
cmd := cli.GetQueryParamsCmd()
|
||||
clientCtx := val.ClientCtx
|
||||
|
||||
out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args)
|
||||
sr.NoError(err)
|
||||
var param types.QueryParamsResponse
|
||||
err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), ¶m)
|
||||
sr.NoError(err)
|
||||
params := types.DefaultParams()
|
||||
params.RecordRent = sdk.NewCoin(s.cfg.BondDenom, types.DefaultRecordRent)
|
||||
params.RecordRentDuration = 5 * time.Second
|
||||
params.AuthorityGracePeriod = 5 * time.Second
|
||||
sr.Equal(param.GetParams().String(), params.String())
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (s *IntegrationTestSuite) TestGetCmdQueryForRecords() {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
var recordID string
|
||||
var bondId string
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
args []string
|
||||
expErr bool
|
||||
noOfRecords int
|
||||
preRun func()
|
||||
}{
|
||||
{
|
||||
"invalid request",
|
||||
[]string{"invalid", fmt.Sprintf("--%s=json", tmcli.OutputFlag)},
|
||||
true,
|
||||
0,
|
||||
func() {
|
||||
|
||||
},
|
||||
},
|
||||
{
|
||||
"get records list",
|
||||
[]string{fmt.Sprintf("--%s=json", tmcli.OutputFlag)},
|
||||
false,
|
||||
1,
|
||||
func() {
|
||||
CreateBond(s)
|
||||
// get the bond id from bond list
|
||||
bondId := GetBondId(s)
|
||||
dir, err := os.Getwd()
|
||||
sr.NoError(err)
|
||||
payloadPath := dir + "/example1.yml"
|
||||
args := []string{
|
||||
payloadPath, bondId,
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName),
|
||||
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)),
|
||||
}
|
||||
|
||||
clientCtx := val.ClientCtx
|
||||
cmd := cli.GetCmdSetRecord()
|
||||
|
||||
out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args)
|
||||
sr.NoError(err)
|
||||
var d sdk.TxResponse
|
||||
err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d)
|
||||
sr.NoError(err)
|
||||
sr.Zero(d.Code)
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
s.Run(tc.name, func() {
|
||||
clientCtx := val.ClientCtx
|
||||
if !tc.expErr {
|
||||
tc.preRun()
|
||||
}
|
||||
cmd := cli.GetCmdList()
|
||||
out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args)
|
||||
if tc.expErr {
|
||||
sr.Error(err)
|
||||
} else {
|
||||
sr.NoError(err)
|
||||
var records []types.RecordType
|
||||
err := json.Unmarshal(out.Bytes(), &records)
|
||||
sr.NoError(err)
|
||||
sr.Equal(tc.noOfRecords, len(records))
|
||||
recordID = records[0].Id
|
||||
bondId = GetBondId(s)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
s.T().Log("Test Cases for getting records by record-id")
|
||||
testCasesByRecordID := []struct {
|
||||
name string
|
||||
args []string
|
||||
expErr bool
|
||||
}{
|
||||
{
|
||||
"invalid request without record id",
|
||||
[]string{fmt.Sprintf("--%s=json", tmcli.OutputFlag)},
|
||||
true,
|
||||
},
|
||||
{
|
||||
"get records by id",
|
||||
[]string{recordID, fmt.Sprintf("--%s=json", tmcli.OutputFlag)},
|
||||
false,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCasesByRecordID {
|
||||
s.Run(tc.name, func() {
|
||||
cmd := cli.GetCmdGetResource()
|
||||
clientCtx := val.ClientCtx
|
||||
|
||||
out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args)
|
||||
if tc.expErr {
|
||||
sr.Error(err)
|
||||
} else {
|
||||
sr.NoError(err)
|
||||
var response types.QueryRecordByIdResponse
|
||||
err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response)
|
||||
sr.NoError(err)
|
||||
sr.NotNil(response.GetRecord())
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
s.T().Log("Test Cases for getting records by bond-id")
|
||||
testCasesByRecordByBondID := []struct {
|
||||
name string
|
||||
args []string
|
||||
expErr bool
|
||||
}{
|
||||
{
|
||||
"invalid request without bond-id",
|
||||
[]string{fmt.Sprintf("--%s=json", tmcli.OutputFlag)},
|
||||
true,
|
||||
},
|
||||
{
|
||||
"get records by bond-id",
|
||||
[]string{bondId, fmt.Sprintf("--%s=json", tmcli.OutputFlag)},
|
||||
false,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCasesByRecordByBondID {
|
||||
s.Run(tc.name, func() {
|
||||
cmd := cli.GetCmdQueryByBond()
|
||||
clientCtx := val.ClientCtx
|
||||
|
||||
out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args)
|
||||
if tc.expErr {
|
||||
sr.Error(err)
|
||||
} else {
|
||||
sr.NoError(err)
|
||||
var response types.QueryRecordByBondIdResponse
|
||||
err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response)
|
||||
sr.NoError(err)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
s.T().Log("Test Cases for getting nameservice module account balance")
|
||||
testCasesForNameServiceModuleBalance := []struct {
|
||||
name string
|
||||
args []string
|
||||
expErr bool
|
||||
noOfRecords int
|
||||
}{
|
||||
{
|
||||
"get nameservice module accounts balance",
|
||||
[]string{fmt.Sprintf("--%s=json", tmcli.OutputFlag)},
|
||||
false,
|
||||
1,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCasesForNameServiceModuleBalance {
|
||||
s.Run(tc.name, func() {
|
||||
cmd := cli.GetCmdBalance()
|
||||
clientCtx := val.ClientCtx
|
||||
|
||||
out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args)
|
||||
if tc.expErr {
|
||||
sr.Error(err)
|
||||
} else {
|
||||
sr.NoError(err)
|
||||
var response types.GetNameServiceModuleBalanceResponse
|
||||
err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response)
|
||||
sr.NoError(err)
|
||||
sr.Equal(tc.noOfRecords, len(response.GetBalances()))
|
||||
balance := response.GetBalances()[0]
|
||||
sr.Equal(balance.AccountName, types.RecordRentModuleAccountName)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (s *IntegrationTestSuite) TestGetCmdWhoIs() {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
var authorityName = "test2"
|
||||
testCases := []struct {
|
||||
name string
|
||||
args []string
|
||||
expErr bool
|
||||
noOfRecords int
|
||||
preRun func(authorityName string)
|
||||
}{
|
||||
{
|
||||
"invalid request without name",
|
||||
[]string{fmt.Sprintf("--%s=json", tmcli.OutputFlag)},
|
||||
true,
|
||||
1,
|
||||
func(authorityName string) {
|
||||
|
||||
},
|
||||
},
|
||||
{
|
||||
"success query with name",
|
||||
[]string{authorityName, fmt.Sprintf("--%s=json", tmcli.OutputFlag)},
|
||||
false,
|
||||
1,
|
||||
func(authorityName string) {
|
||||
// reserving the name
|
||||
clientCtx := val.ClientCtx
|
||||
cmd := cli.GetCmdReserveName()
|
||||
args := []string{
|
||||
authorityName,
|
||||
fmt.Sprintf("--owner=%s", accountAddress),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName),
|
||||
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)),
|
||||
}
|
||||
out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args)
|
||||
sr.NoError(err)
|
||||
var d sdk.TxResponse
|
||||
err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d)
|
||||
sr.NoError(err)
|
||||
sr.Zero(d.Code)
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
s.Run(tc.name, func() {
|
||||
if !tc.expErr {
|
||||
tc.preRun(authorityName)
|
||||
}
|
||||
cmd := cli.GetCmdWhoIs()
|
||||
clientCtx := val.ClientCtx
|
||||
|
||||
out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args)
|
||||
if tc.expErr {
|
||||
sr.Error(err)
|
||||
} else {
|
||||
sr.NoError(err)
|
||||
var response types.QueryWhoisResponse
|
||||
err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response)
|
||||
sr.NoError(err)
|
||||
nameAuthority := response.GetNameAuthority()
|
||||
nameAuthority.OwnerAddress = accountAddress
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (s *IntegrationTestSuite) TestGetCmdLookupWRN() {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
var authorityName = "test1"
|
||||
testCases := []struct {
|
||||
name string
|
||||
args []string
|
||||
expErr bool
|
||||
noOfRecords int
|
||||
preRun func(authorityName string)
|
||||
}{
|
||||
{
|
||||
"invalid request without wrn",
|
||||
[]string{fmt.Sprintf("--%s=json", tmcli.OutputFlag)},
|
||||
true,
|
||||
0,
|
||||
func(authorityName string) {
|
||||
|
||||
},
|
||||
},
|
||||
{
|
||||
"success query with name",
|
||||
[]string{fmt.Sprintf("wrn://%s/", authorityName), fmt.Sprintf("--%s=json", tmcli.OutputFlag)},
|
||||
false,
|
||||
1,
|
||||
func(authorityName string) {
|
||||
// reserving the name
|
||||
createNameRecord(authorityName, s)
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
s.Run(tc.name, func() {
|
||||
if !tc.expErr {
|
||||
// set-name with wrn and bond-id
|
||||
tc.preRun(authorityName)
|
||||
}
|
||||
cmd := cli.GetCmdLookupWRN()
|
||||
clientCtx := val.ClientCtx
|
||||
|
||||
out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args)
|
||||
if tc.expErr {
|
||||
sr.Error(err)
|
||||
} else {
|
||||
sr.NoError(err)
|
||||
var response types.QueryLookupWrnResponse
|
||||
err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response)
|
||||
sr.NoError(err)
|
||||
nameRecord := response.GetName()
|
||||
sr.NotNil(nameRecord.Latest.Id)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
testCasesForNamesList := []struct {
|
||||
name string
|
||||
args []string
|
||||
expErr bool
|
||||
noOfRecords int
|
||||
}{
|
||||
{
|
||||
"invalid request without wrn",
|
||||
[]string{"invalid", fmt.Sprintf("--%s=json", tmcli.OutputFlag)},
|
||||
true,
|
||||
0,
|
||||
},
|
||||
{
|
||||
"success query with name",
|
||||
[]string{fmt.Sprintf("--%s=json", tmcli.OutputFlag)},
|
||||
false,
|
||||
1,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCasesForNamesList {
|
||||
s.Run(tc.name, func() {
|
||||
cmd := cli.GetCmdNames()
|
||||
clientCtx := val.ClientCtx
|
||||
|
||||
out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args)
|
||||
if tc.expErr {
|
||||
sr.Error(err)
|
||||
} else {
|
||||
sr.NoError(err)
|
||||
var response types.QueryListNameRecordsResponse
|
||||
err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response)
|
||||
sr.NoError(err)
|
||||
sr.NotZero(len(response.GetNames()))
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (s *IntegrationTestSuite) GetRecordExpiryQueue() {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
var authorityName = "GetRecordExpiryQueue"
|
||||
|
||||
testCasesForRecordsExpiry := []struct {
|
||||
name string
|
||||
args []string
|
||||
expErr bool
|
||||
noOfRecords int
|
||||
preRun func(authorityName string, s *IntegrationTestSuite)
|
||||
}{
|
||||
{
|
||||
"invalid request",
|
||||
[]string{"invalid", fmt.Sprintf("--%s=json", tmcli.OutputFlag)},
|
||||
true,
|
||||
0,
|
||||
func(authorityName string, s *IntegrationTestSuite) {
|
||||
|
||||
},
|
||||
},
|
||||
{
|
||||
"get expiry records ",
|
||||
[]string{fmt.Sprintf("--%s=json", tmcli.OutputFlag)},
|
||||
false,
|
||||
1,
|
||||
func(authorityName string, s *IntegrationTestSuite) {
|
||||
createNameRecord(authorityName, s)
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCasesForRecordsExpiry {
|
||||
s.Run(tc.name, func() {
|
||||
if !tc.expErr {
|
||||
tc.preRun(authorityName, s)
|
||||
time.Sleep(time.Second * 7)
|
||||
}
|
||||
cmd := cli.GetRecordExpiryQueue()
|
||||
clientCtx := val.ClientCtx
|
||||
|
||||
out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args)
|
||||
if tc.expErr {
|
||||
sr.Error(err)
|
||||
} else {
|
||||
sr.NoError(err)
|
||||
var response types.QueryGetRecordExpiryQueueResponse
|
||||
err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response)
|
||||
sr.NoError(err)
|
||||
sr.Equal(tc.noOfRecords, len(response.GetRecords()))
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
func (s *IntegrationTestSuite) TestGetAuthorityExpiryQueue() {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
var authorityName = "TestGetAuthorityExpiryQueue"
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
args []string
|
||||
expErr bool
|
||||
preRun func(authorityName string)
|
||||
}{
|
||||
{
|
||||
"invalid request without name",
|
||||
[]string{"invalid", fmt.Sprintf("--%s=json", tmcli.OutputFlag)},
|
||||
true,
|
||||
func(authorityName string) {
|
||||
|
||||
},
|
||||
},
|
||||
{
|
||||
"success query",
|
||||
[]string{fmt.Sprintf("--%s=json", tmcli.OutputFlag)},
|
||||
false,
|
||||
func(authorityName string) {
|
||||
// reserving the name
|
||||
clientCtx := val.ClientCtx
|
||||
cmd := cli.GetCmdReserveName()
|
||||
args := []string{
|
||||
authorityName,
|
||||
fmt.Sprintf("--owner=%s", accountAddress),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName),
|
||||
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)),
|
||||
}
|
||||
out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args)
|
||||
sr.NoError(err)
|
||||
var d sdk.TxResponse
|
||||
err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d)
|
||||
sr.NoError(err)
|
||||
sr.Zero(d.Code)
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
s.Run(tc.name, func() {
|
||||
if !tc.expErr {
|
||||
tc.preRun(authorityName)
|
||||
time.Sleep(time.Second * 6)
|
||||
}
|
||||
cmd := cli.GetAuthorityExpiryQueue()
|
||||
clientCtx := val.ClientCtx
|
||||
|
||||
out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args)
|
||||
if tc.expErr {
|
||||
sr.Error(err)
|
||||
} else {
|
||||
sr.NoError(err)
|
||||
var response types.QueryGetAuthorityExpiryQueueResponse
|
||||
err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response)
|
||||
sr.NoError(err)
|
||||
sr.NotZero(len(response.GetAuthorities()))
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func createNameRecord(authorityName string, s *IntegrationTestSuite) {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
// reserving the name
|
||||
clientCtx := val.ClientCtx
|
||||
cmd := cli.GetCmdReserveName()
|
||||
args := []string{
|
||||
authorityName,
|
||||
fmt.Sprintf("--owner=%s", accountAddress),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName),
|
||||
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)),
|
||||
}
|
||||
out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args)
|
||||
sr.NoError(err)
|
||||
var d sdk.TxResponse
|
||||
err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d)
|
||||
sr.NoError(err)
|
||||
sr.Zero(d.Code)
|
||||
|
||||
// creating the bond
|
||||
CreateBond(s)
|
||||
|
||||
// Get the bond-id
|
||||
bondId := GetBondId(s)
|
||||
|
||||
// adding bond-id to name authority
|
||||
args = []string{
|
||||
authorityName, bondId,
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName),
|
||||
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)),
|
||||
}
|
||||
cmd = cli.GetCmdSetAuthorityBond()
|
||||
|
||||
out, err = clitestutil.ExecTestCLICmd(clientCtx, cmd, args)
|
||||
sr.NoError(err)
|
||||
err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d)
|
||||
sr.NoError(err)
|
||||
sr.Zero(d.Code)
|
||||
|
||||
args = []string{
|
||||
fmt.Sprintf("wrn://%s/", authorityName),
|
||||
"test_hello_cid",
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName),
|
||||
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)),
|
||||
}
|
||||
|
||||
cmd = cli.GetCmdSetName()
|
||||
|
||||
out, err = clitestutil.ExecTestCLICmd(clientCtx, cmd, args)
|
||||
sr.NoError(err)
|
||||
err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d)
|
||||
sr.NoError(err)
|
||||
sr.Zero(d.Code)
|
||||
}
|
910
x/nameservice/client/testutil/tx.go
Normal file
910
x/nameservice/client/testutil/tx.go
Normal file
@ -0,0 +1,910 @@
|
||||
package testutil
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/cosmos/cosmos-sdk/client/flags"
|
||||
"github.com/cosmos/cosmos-sdk/crypto/hd"
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keyring"
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"
|
||||
clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
banktestutil "github.com/cosmos/cosmos-sdk/x/bank/client/testutil"
|
||||
"github.com/stretchr/testify/suite"
|
||||
tmcli "github.com/tendermint/tendermint/libs/cli"
|
||||
"github.com/tharsis/ethermint/testutil/network"
|
||||
bondcli "github.com/tharsis/ethermint/x/bond/client/cli"
|
||||
"github.com/tharsis/ethermint/x/bond/types"
|
||||
"github.com/tharsis/ethermint/x/nameservice/client/cli"
|
||||
nstypes "github.com/tharsis/ethermint/x/nameservice/types"
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
|
||||
var (
|
||||
accountName = "accountName"
|
||||
accountAddress string
|
||||
)
|
||||
|
||||
type IntegrationTestSuite struct {
|
||||
suite.Suite
|
||||
|
||||
cfg network.Config
|
||||
network *network.Network
|
||||
bondId string
|
||||
}
|
||||
|
||||
func NewIntegrationTestSuite(cfg network.Config) *IntegrationTestSuite {
|
||||
return &IntegrationTestSuite{cfg: cfg}
|
||||
}
|
||||
|
||||
func (s *IntegrationTestSuite) SetupSuite() {
|
||||
s.T().Log("setting up integration test suite")
|
||||
|
||||
var genesisState = s.cfg.GenesisState
|
||||
var nsData nstypes.GenesisState
|
||||
s.Require().NoError(s.cfg.Codec.UnmarshalJSON(genesisState[nstypes.ModuleName], &nsData))
|
||||
|
||||
nsData.Params.RecordRent = sdk.NewCoin(s.cfg.BondDenom, nstypes.DefaultRecordRent)
|
||||
nsData.Params.RecordRentDuration = 5 * time.Second
|
||||
nsData.Params.AuthorityGracePeriod = 5 * time.Second
|
||||
nsDataBz, err := s.cfg.Codec.MarshalJSON(&nsData)
|
||||
s.Require().NoError(err)
|
||||
genesisState[nstypes.ModuleName] = nsDataBz
|
||||
s.cfg.GenesisState = genesisState
|
||||
|
||||
s.network = network.New(s.T(), s.cfg)
|
||||
|
||||
_, err = s.network.WaitForHeight(2)
|
||||
s.Require().NoError(err)
|
||||
|
||||
// setting up random account
|
||||
s.createAccountWithBalance(accountName)
|
||||
CreateBond(s)
|
||||
s.bondId = GetBondId(s)
|
||||
}
|
||||
|
||||
func (s *IntegrationTestSuite) createAccountWithBalance(accountName string) {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
consPrivKey := ed25519.GenPrivKey()
|
||||
consPubKeyBz, err := s.cfg.Codec.MarshalInterfaceJSON(consPrivKey.PubKey())
|
||||
sr.NoError(err)
|
||||
sr.NotNil(consPubKeyBz)
|
||||
|
||||
info, _, err := val.ClientCtx.Keyring.NewMnemonic(accountName, keyring.English, sdk.FullFundraiserPath, keyring.DefaultBIP39Passphrase, hd.Secp256k1)
|
||||
sr.NoError(err)
|
||||
|
||||
newAddr := sdk.AccAddress(info.GetPubKey().Address())
|
||||
_, err = banktestutil.MsgSendExec(
|
||||
val.ClientCtx,
|
||||
val.Address,
|
||||
newAddr,
|
||||
sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(1000000000000000000))),
|
||||
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()),
|
||||
)
|
||||
sr.NoError(err)
|
||||
accountAddress = newAddr.String()
|
||||
}
|
||||
|
||||
func (s *IntegrationTestSuite) TearDownSuite() {
|
||||
s.T().Log("tearing down integration test suite")
|
||||
s.network.Cleanup()
|
||||
}
|
||||
|
||||
func CreateBond(s *IntegrationTestSuite) {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
args []string
|
||||
err bool
|
||||
}{
|
||||
{
|
||||
"create bond",
|
||||
[]string{
|
||||
fmt.Sprintf("100000000000%s", s.cfg.BondDenom),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName),
|
||||
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)),
|
||||
},
|
||||
false,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
s.Run(fmt.Sprintf("Case %s", tc.name), func() {
|
||||
clientCtx := val.ClientCtx
|
||||
cmd := bondcli.NewCreateBondCmd()
|
||||
|
||||
out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args)
|
||||
if tc.err {
|
||||
sr.Error(err)
|
||||
} else {
|
||||
sr.NoError(err)
|
||||
var d sdk.TxResponse
|
||||
err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d)
|
||||
sr.NoError(err)
|
||||
sr.Zero(d.Code)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func GetBondId(s *IntegrationTestSuite) string {
|
||||
cmd := bondcli.GetQueryBondLists()
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
clientCtx := val.ClientCtx
|
||||
|
||||
out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, []string{fmt.Sprintf("--%s=json", tmcli.OutputFlag)})
|
||||
sr.NoError(err)
|
||||
var queryResponse types.QueryGetBondsResponse
|
||||
err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &queryResponse)
|
||||
sr.NoError(err)
|
||||
|
||||
// extract bond id from bonds list
|
||||
bond := queryResponse.GetBonds()[0]
|
||||
return bond.GetId()
|
||||
}
|
||||
|
||||
func (s *IntegrationTestSuite) TestGetCmdSetRecord() {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
args []string
|
||||
err bool
|
||||
}{
|
||||
{
|
||||
"invalid request without bond id/without payload",
|
||||
[]string{
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName),
|
||||
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)),
|
||||
},
|
||||
true,
|
||||
},
|
||||
{
|
||||
"success",
|
||||
[]string{
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName),
|
||||
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)),
|
||||
},
|
||||
false,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
s.Run(fmt.Sprintf("Case %s", tc.name), func() {
|
||||
if !tc.err {
|
||||
// create the bond
|
||||
CreateBond(s)
|
||||
// get the bond id from bond list
|
||||
bondId := GetBondId(s)
|
||||
dir, err := os.Getwd()
|
||||
sr.NoError(err)
|
||||
payloadPath := dir + "/example1.yml"
|
||||
|
||||
tc.args = append([]string{payloadPath, bondId}, tc.args...)
|
||||
}
|
||||
clientCtx := val.ClientCtx
|
||||
cmd := cli.GetCmdSetRecord()
|
||||
|
||||
out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args)
|
||||
if tc.err {
|
||||
sr.Error(err)
|
||||
} else {
|
||||
sr.NoError(err)
|
||||
var d sdk.TxResponse
|
||||
err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d)
|
||||
sr.NoError(err)
|
||||
sr.Zero(d.Code)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (s *IntegrationTestSuite) TestGetCmdReserveName() {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
var authorityName = "testtest"
|
||||
testCases := []struct {
|
||||
name string
|
||||
args []string
|
||||
err bool
|
||||
}{
|
||||
{
|
||||
"invalid request without name",
|
||||
[]string{
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName),
|
||||
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)),
|
||||
},
|
||||
true,
|
||||
},
|
||||
{
|
||||
"success for parent name",
|
||||
[]string{
|
||||
authorityName,
|
||||
fmt.Sprintf("--owner=%s", accountAddress),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName),
|
||||
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)),
|
||||
},
|
||||
false,
|
||||
},
|
||||
{
|
||||
"success for sub domains",
|
||||
[]string{
|
||||
"sub." + authorityName,
|
||||
fmt.Sprintf("--owner=%s", accountAddress),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName),
|
||||
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)),
|
||||
},
|
||||
false,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
s.Run(fmt.Sprintf("Case %s", tc.name), func() {
|
||||
clientCtx := val.ClientCtx
|
||||
cmd := cli.GetCmdReserveName()
|
||||
|
||||
out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args)
|
||||
if tc.err {
|
||||
sr.Error(err)
|
||||
} else {
|
||||
sr.NoError(err)
|
||||
var d sdk.TxResponse
|
||||
err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d)
|
||||
sr.NoError(err)
|
||||
sr.Zero(d.Code)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (s *IntegrationTestSuite) TestGetCmdSetName() {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
var authorityName = "TestGetCmdSetName"
|
||||
testCases := []struct {
|
||||
name string
|
||||
args []string
|
||||
err bool
|
||||
preRun func(authorityName string)
|
||||
}{
|
||||
{
|
||||
"invalid request without name",
|
||||
[]string{
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName),
|
||||
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)),
|
||||
},
|
||||
true,
|
||||
func(authorityName string) {
|
||||
|
||||
},
|
||||
},
|
||||
{
|
||||
"success",
|
||||
[]string{
|
||||
fmt.Sprintf("wrn://%s/", authorityName),
|
||||
"test_hello_cid",
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName),
|
||||
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)),
|
||||
},
|
||||
false,
|
||||
func(authorityName string) {
|
||||
// reserving the name
|
||||
clientCtx := val.ClientCtx
|
||||
cmd := cli.GetCmdReserveName()
|
||||
args := []string{
|
||||
authorityName,
|
||||
fmt.Sprintf("--owner=%s", accountAddress),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName),
|
||||
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)),
|
||||
}
|
||||
out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args)
|
||||
sr.NoError(err)
|
||||
var d sdk.TxResponse
|
||||
err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d)
|
||||
sr.NoError(err)
|
||||
sr.Zero(d.Code)
|
||||
|
||||
// creating the bond
|
||||
CreateBond(s)
|
||||
|
||||
// Get the bond-id
|
||||
bondId := GetBondId(s)
|
||||
|
||||
// adding bond-id to name authority
|
||||
args = []string{
|
||||
authorityName, bondId,
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName),
|
||||
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)),
|
||||
}
|
||||
cmd = cli.GetCmdSetAuthorityBond()
|
||||
|
||||
out, err = clitestutil.ExecTestCLICmd(clientCtx, cmd, args)
|
||||
sr.NoError(err)
|
||||
err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d)
|
||||
sr.NoError(err)
|
||||
sr.Zero(d.Code)
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
s.Run(fmt.Sprintf("Case %s", tc.name), func() {
|
||||
if !tc.err {
|
||||
tc.preRun(authorityName)
|
||||
}
|
||||
|
||||
clientCtx := val.ClientCtx
|
||||
cmd := cli.GetCmdSetName()
|
||||
|
||||
out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args)
|
||||
if tc.err {
|
||||
sr.Error(err)
|
||||
} else {
|
||||
sr.NoError(err)
|
||||
var d sdk.TxResponse
|
||||
err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d)
|
||||
sr.NoError(err)
|
||||
sr.Zero(d.Code)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (s *IntegrationTestSuite) TestGetCmdSetAuthorityBond() {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
var authorityName = "TestGetCmdSetAuthorityBond"
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
args []string
|
||||
err bool
|
||||
preRun func(authorityName string)
|
||||
}{
|
||||
{
|
||||
"invalid request without name",
|
||||
[]string{
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName),
|
||||
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)),
|
||||
},
|
||||
true,
|
||||
func(authorityName string) {
|
||||
|
||||
},
|
||||
},
|
||||
{
|
||||
"success with name and bond-id",
|
||||
[]string{
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName),
|
||||
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)),
|
||||
},
|
||||
false,
|
||||
func(authorityName string) {
|
||||
// reserving the name
|
||||
clientCtx := val.ClientCtx
|
||||
cmd := cli.GetCmdReserveName()
|
||||
args := []string{
|
||||
authorityName,
|
||||
fmt.Sprintf("--owner=%s", accountAddress),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName),
|
||||
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)),
|
||||
}
|
||||
out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args)
|
||||
sr.NoError(err)
|
||||
var d sdk.TxResponse
|
||||
err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d)
|
||||
sr.NoError(err)
|
||||
sr.Zero(d.Code)
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
s.Run(fmt.Sprintf("Case %s", tc.name), func() {
|
||||
if !tc.err {
|
||||
// reserve the name
|
||||
tc.preRun(authorityName)
|
||||
// creating the bond
|
||||
CreateBond(s)
|
||||
// getting the bond-id
|
||||
bondId := GetBondId(s)
|
||||
tc.args = append([]string{authorityName, bondId}, tc.args...)
|
||||
}
|
||||
clientCtx := val.ClientCtx
|
||||
cmd := cli.GetCmdSetAuthorityBond()
|
||||
|
||||
out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args)
|
||||
if tc.err {
|
||||
sr.Error(err)
|
||||
} else {
|
||||
sr.NoError(err)
|
||||
var d sdk.TxResponse
|
||||
err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d)
|
||||
sr.NoError(err)
|
||||
sr.Zero(d.Code)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (s *IntegrationTestSuite) TestGetCmdDeleteName() {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
var authorityName = "TestGetCmdDeleteName"
|
||||
testCasesForDeletingName := []struct {
|
||||
name string
|
||||
args []string
|
||||
err bool
|
||||
preRun func(authorityName string, s *IntegrationTestSuite)
|
||||
}{
|
||||
{
|
||||
"invalid request without wrn",
|
||||
[]string{
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName),
|
||||
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)),
|
||||
},
|
||||
true,
|
||||
func(authorityName string, s *IntegrationTestSuite) {
|
||||
|
||||
},
|
||||
},
|
||||
{
|
||||
"successfully delete name",
|
||||
[]string{
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName),
|
||||
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)),
|
||||
},
|
||||
false,
|
||||
func(authorityName string, s *IntegrationTestSuite) {
|
||||
createNameRecord(authorityName, s)
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCasesForDeletingName {
|
||||
s.Run(fmt.Sprintf("Case %s", tc.name), func() {
|
||||
if !tc.err {
|
||||
tc.preRun(authorityName, s)
|
||||
tc.args = append([]string{fmt.Sprintf("wrn://%s/", authorityName)}, tc.args...)
|
||||
}
|
||||
clientCtx := val.ClientCtx
|
||||
cmd := cli.GetCmdDeleteName()
|
||||
|
||||
out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args)
|
||||
if tc.err {
|
||||
sr.Error(err)
|
||||
} else {
|
||||
sr.NoError(err)
|
||||
var d sdk.TxResponse
|
||||
err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d)
|
||||
sr.NoError(err)
|
||||
sr.Zero(d.Code)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (s *IntegrationTestSuite) TestGetCmdDissociateBond() {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
testCasesForDeletingName := []struct {
|
||||
name string
|
||||
args []string
|
||||
err bool
|
||||
preRun func(s *IntegrationTestSuite) string
|
||||
postRun func(recordId string, s *IntegrationTestSuite)
|
||||
}{
|
||||
{
|
||||
"invalid request without wrn",
|
||||
[]string{
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName),
|
||||
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)),
|
||||
},
|
||||
true,
|
||||
func(s *IntegrationTestSuite) string {
|
||||
return ""
|
||||
},
|
||||
func(recordId string, s *IntegrationTestSuite) {
|
||||
|
||||
},
|
||||
},
|
||||
{
|
||||
"successfully dissociate bond-id from record ",
|
||||
[]string{
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName),
|
||||
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)),
|
||||
},
|
||||
false,
|
||||
func(s *IntegrationTestSuite) string {
|
||||
// create the bond
|
||||
CreateBond(s)
|
||||
// get the bond id from bond list
|
||||
bondId := GetBondId(s)
|
||||
dir, err := os.Getwd()
|
||||
sr.NoError(err)
|
||||
payloadPath := dir + "/example1.yml"
|
||||
|
||||
args := []string{
|
||||
payloadPath, bondId,
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName),
|
||||
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)),
|
||||
}
|
||||
|
||||
clientCtx := val.ClientCtx
|
||||
cmd := cli.GetCmdSetRecord()
|
||||
|
||||
out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args)
|
||||
sr.NoError(err)
|
||||
var d sdk.TxResponse
|
||||
err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d)
|
||||
sr.NoError(err)
|
||||
sr.Zero(d.Code)
|
||||
|
||||
// retrieving the record-id
|
||||
args = []string{fmt.Sprintf("--%s=json", tmcli.OutputFlag)}
|
||||
cmd = cli.GetCmdList()
|
||||
out, err = clitestutil.ExecTestCLICmd(clientCtx, cmd, args)
|
||||
sr.NoError(err)
|
||||
var records []nstypes.RecordType
|
||||
err = json.Unmarshal(out.Bytes(), &records)
|
||||
sr.NoError(err)
|
||||
return records[0].Id
|
||||
},
|
||||
func(recordId string, s *IntegrationTestSuite) {
|
||||
// checking the bond-id removed or not
|
||||
clientCtx := val.ClientCtx
|
||||
args := []string{recordId, fmt.Sprintf("--%s=json", tmcli.OutputFlag)}
|
||||
cmd := cli.GetCmdGetResource()
|
||||
out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args)
|
||||
sr.NoError(err)
|
||||
var response nstypes.QueryRecordByIdResponse
|
||||
err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response)
|
||||
sr.NoError(err)
|
||||
record := response.GetRecord()
|
||||
sr.NotNil(record)
|
||||
sr.Zero(len(record.GetBondId()))
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCasesForDeletingName {
|
||||
s.Run(fmt.Sprintf("Case %s", tc.name), func() {
|
||||
var recordId string
|
||||
if !tc.err {
|
||||
recordId = tc.preRun(s)
|
||||
tc.args = append([]string{recordId}, tc.args...)
|
||||
}
|
||||
clientCtx := val.ClientCtx
|
||||
cmd := cli.GetCmdDissociateBond()
|
||||
|
||||
out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args)
|
||||
if tc.err {
|
||||
sr.Error(err)
|
||||
} else {
|
||||
sr.NoError(err)
|
||||
var d sdk.TxResponse
|
||||
err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d)
|
||||
sr.NoError(err)
|
||||
sr.Zero(d.Code)
|
||||
// post-run
|
||||
tc.postRun(recordId, s)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
//func (s *IntegrationTestSuite) TestGetCmdDissociateRecords() {
|
||||
// val := s.network.Validators[0]
|
||||
// sr := s.Require()
|
||||
// testCasesForDeletingName := []struct {
|
||||
// name string
|
||||
// args []string
|
||||
// err bool
|
||||
// preRun func(s *IntegrationTestSuite) (string, string)
|
||||
// postRun func(recordId string, s *IntegrationTestSuite)
|
||||
// }{
|
||||
// {
|
||||
// "invalid request without wrn",
|
||||
// []string{
|
||||
// fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName),
|
||||
// fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||
// fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
// fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
|
||||
// fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)),
|
||||
// },
|
||||
// true,
|
||||
// func(s *IntegrationTestSuite) (string, string) {
|
||||
// return "", ""
|
||||
// },
|
||||
// func(recordId string, s *IntegrationTestSuite) {
|
||||
//
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// "successfully dissociate records from bond-id",
|
||||
// []string{
|
||||
// fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName),
|
||||
// fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||
// fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
// fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
|
||||
// fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)),
|
||||
// },
|
||||
// false,
|
||||
// func(s *IntegrationTestSuite) (string, string) {
|
||||
// // create the bond
|
||||
// CreateBond(s)
|
||||
// // get the bond id from bond list
|
||||
// bondId := GetBondId(s)
|
||||
// dir, err := os.Getwd()
|
||||
// sr.NoError(err)
|
||||
// payloadPath := dir + "/example1.yml"
|
||||
//
|
||||
// args := []string{
|
||||
// payloadPath, bondId,
|
||||
// fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName),
|
||||
// fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||
// fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
// fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
|
||||
// fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)),
|
||||
// }
|
||||
//
|
||||
// clientCtx := val.ClientCtx
|
||||
// cmd := cli.GetCmdSetRecord()
|
||||
//
|
||||
// out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args)
|
||||
// sr.NoError(err)
|
||||
// var d sdk.TxResponse
|
||||
// err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d)
|
||||
// sr.NoError(err)
|
||||
// sr.Zero(d.Code)
|
||||
//
|
||||
// // retrieving the record-id
|
||||
// args = []string{fmt.Sprintf("--%s=json", tmcli.OutputFlag)}
|
||||
// cmd = cli.GetCmdList()
|
||||
// out, err = clitestutil.ExecTestCLICmd(clientCtx, cmd, args)
|
||||
// sr.NoError(err)
|
||||
// var records []nstypes.RecordType
|
||||
// err = json.Unmarshal(out.Bytes(), &records)
|
||||
// sr.NoError(err)
|
||||
// for _, record := range records {
|
||||
// if len(record.BondId) != 0 {
|
||||
// return record.Id, record.BondId
|
||||
// }
|
||||
// }
|
||||
// return records[0].Id, records[0].BondId
|
||||
// },
|
||||
// func(recordId string, s *IntegrationTestSuite) {
|
||||
// // checking the bond-id removed or not
|
||||
// clientCtx := val.ClientCtx
|
||||
// args := []string{recordId, fmt.Sprintf("--%s=json", tmcli.OutputFlag)}
|
||||
// cmd := cli.GetCmdGetResource()
|
||||
// out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args)
|
||||
// sr.NoError(err)
|
||||
// var response nstypes.QueryRecordByIdResponse
|
||||
// err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response)
|
||||
// sr.NoError(err)
|
||||
// record := response.GetRecord()
|
||||
// sr.NotNil(record)
|
||||
// sr.Zero(len(record.GetBondId()))
|
||||
// },
|
||||
// },
|
||||
// }
|
||||
//
|
||||
// for _, tc := range testCasesForDeletingName {
|
||||
// s.Run(fmt.Sprintf("Case %s", tc.name), func() {
|
||||
// var bondId string
|
||||
// var recordId string
|
||||
// if !tc.err {
|
||||
// recordId, bondId = tc.preRun(s)
|
||||
// tc.args = append([]string{bondId}, tc.args...)
|
||||
// }
|
||||
// clientCtx := val.ClientCtx
|
||||
// cmd := cli.GetCmdDissociateRecords()
|
||||
//
|
||||
// out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args)
|
||||
// if tc.err {
|
||||
// sr.Error(err)
|
||||
// } else {
|
||||
// sr.NoError(err)
|
||||
// var d sdk.TxResponse
|
||||
// err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d)
|
||||
// sr.NoError(err)
|
||||
// sr.Zero(d.Code)
|
||||
// // post-run
|
||||
// tc.postRun(recordId, s)
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
//}
|
||||
|
||||
func (s *IntegrationTestSuite) TestGetCmdAssociateBond() {
|
||||
val := s.network.Validators[0]
|
||||
sr := s.Require()
|
||||
testCasesForDeletingName := []struct {
|
||||
name string
|
||||
args []string
|
||||
err bool
|
||||
preRun func(s *IntegrationTestSuite) (string, string)
|
||||
postRun func(recordId, bondId string, s *IntegrationTestSuite)
|
||||
}{
|
||||
{
|
||||
"invalid request without wrn",
|
||||
[]string{
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName),
|
||||
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)),
|
||||
},
|
||||
true,
|
||||
func(s *IntegrationTestSuite) (string, string) {
|
||||
return "", ""
|
||||
},
|
||||
func(recordId, bondId string, s *IntegrationTestSuite) {
|
||||
|
||||
},
|
||||
},
|
||||
{
|
||||
"successfully dissociate records from bond-id",
|
||||
[]string{
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName),
|
||||
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)),
|
||||
},
|
||||
false,
|
||||
func(s *IntegrationTestSuite) (string, string) {
|
||||
// create the bond
|
||||
CreateBond(s)
|
||||
// get the bond id from bond list
|
||||
bondId := GetBondId(s)
|
||||
dir, err := os.Getwd()
|
||||
sr.NoError(err)
|
||||
payloadPath := dir + "/example1.yml"
|
||||
|
||||
txArgs := []string{
|
||||
payloadPath, bondId,
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName),
|
||||
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("3%s", s.cfg.BondDenom)),
|
||||
}
|
||||
|
||||
clientCtx := val.ClientCtx
|
||||
cmd := cli.GetCmdSetRecord()
|
||||
|
||||
out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, txArgs)
|
||||
sr.NoError(err)
|
||||
var d sdk.TxResponse
|
||||
err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d)
|
||||
sr.NoError(err)
|
||||
sr.Zero(d.Code)
|
||||
|
||||
// retrieving the record-id
|
||||
args := []string{fmt.Sprintf("--%s=json", tmcli.OutputFlag)}
|
||||
cmd = cli.GetCmdList()
|
||||
out, err = clitestutil.ExecTestCLICmd(clientCtx, cmd, args)
|
||||
sr.NoError(err)
|
||||
var records []nstypes.RecordType
|
||||
err = json.Unmarshal(out.Bytes(), &records)
|
||||
sr.NoError(err)
|
||||
|
||||
// GetCmdDissociateBond bond
|
||||
cmd = cli.GetCmdDissociateBond()
|
||||
txArgs = append([]string{records[0].Id}, txArgs[2:]...)
|
||||
out, err = clitestutil.ExecTestCLICmd(clientCtx, cmd, txArgs)
|
||||
sr.NoError(err)
|
||||
err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d)
|
||||
sr.NoError(err)
|
||||
sr.Zero(d.Code)
|
||||
|
||||
return records[0].Id, records[0].BondId
|
||||
},
|
||||
func(recordId, bondId string, s *IntegrationTestSuite) {
|
||||
// checking the bond-id removed or not
|
||||
clientCtx := val.ClientCtx
|
||||
args := []string{recordId, fmt.Sprintf("--%s=json", tmcli.OutputFlag)}
|
||||
cmd := cli.GetCmdGetResource()
|
||||
out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args)
|
||||
sr.NoError(err)
|
||||
var response nstypes.QueryRecordByIdResponse
|
||||
err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response)
|
||||
sr.NoError(err)
|
||||
record := response.GetRecord()
|
||||
sr.NotNil(record)
|
||||
sr.Equal(record.GetBondId(), bondId)
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCasesForDeletingName {
|
||||
s.Run(fmt.Sprintf("Case %s", tc.name), func() {
|
||||
var recordId string
|
||||
var bondId string
|
||||
if !tc.err {
|
||||
recordId, bondId = tc.preRun(s)
|
||||
tc.args = append([]string{recordId, bondId}, tc.args...)
|
||||
}
|
||||
clientCtx := val.ClientCtx
|
||||
cmd := cli.GetCmdAssociateBond()
|
||||
|
||||
out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args)
|
||||
if tc.err {
|
||||
sr.Error(err)
|
||||
} else {
|
||||
sr.NoError(err)
|
||||
var d sdk.TxResponse
|
||||
err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &d)
|
||||
sr.NoError(err)
|
||||
sr.Zero(d.Code)
|
||||
// post-run
|
||||
tc.postRun(recordId, bondId, s)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
7
x/nameservice/helpers/examples/example1.yml
Normal file
7
x/nameservice/helpers/examples/example1.yml
Normal file
@ -0,0 +1,7 @@
|
||||
record:
|
||||
attr1: value1
|
||||
attr2: value2
|
||||
link1:
|
||||
/: QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D
|
||||
link2:
|
||||
/: QmP8jTG1m9GSDJLCbeWhVSVgEzCPPwXRdCRuJtQ5Tz9Kc9
|
@ -58,7 +58,7 @@ func (q Querier) ListNameRecords(c context.Context, _ *types.QueryListNameRecord
|
||||
func (q Querier) Whois(c context.Context, request *types.QueryWhoisRequest) (*types.QueryWhoisResponse, error) {
|
||||
ctx := sdk.UnwrapSDKContext(c)
|
||||
nameAuthority := q.Keeper.GetNameAuthority(ctx, request.GetName())
|
||||
return &types.QueryWhoisResponse{NameAuthority: *nameAuthority}, nil
|
||||
return &types.QueryWhoisResponse{NameAuthority: nameAuthority}, nil
|
||||
}
|
||||
|
||||
func (q Querier) LookupWrn(c context.Context, req *types.QueryLookupWrn) (*types.QueryLookupWrnResponse, error) {
|
||||
|
269
x/nameservice/keeper/grpc_query_test.go
Normal file
269
x/nameservice/keeper/grpc_query_test.go
Normal file
@ -0,0 +1,269 @@
|
||||
package keeper_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/tharsis/ethermint/x/nameservice/client/cli"
|
||||
nameservicetypes "github.com/tharsis/ethermint/x/nameservice/types"
|
||||
"os"
|
||||
)
|
||||
|
||||
func (suite *KeeperTestSuite) TestGrpcQueryParams() {
|
||||
grpcClient := suite.queryClient
|
||||
|
||||
testCases := []struct {
|
||||
msg string
|
||||
req *nameservicetypes.QueryParamsRequest
|
||||
}{
|
||||
{
|
||||
"Get Params",
|
||||
&nameservicetypes.QueryParamsRequest{},
|
||||
},
|
||||
}
|
||||
for _, test := range testCases {
|
||||
suite.Run(fmt.Sprintf("Case %s ", test.msg), func() {
|
||||
resp, _ := grpcClient.Params(context.Background(), test.req)
|
||||
defaultParams := nameservicetypes.DefaultParams()
|
||||
suite.Require().Equal(defaultParams.String(), resp.GetParams().String())
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (suite *KeeperTestSuite) TestGrpcGetRecordLists() {
|
||||
grpcClient, ctx := suite.queryClient, suite.ctx
|
||||
sr := suite.Require()
|
||||
var recordId string
|
||||
testCases := []struct {
|
||||
msg string
|
||||
req *nameservicetypes.QueryListRecordsRequest
|
||||
createRecord bool
|
||||
expErr bool
|
||||
noOfRecords int
|
||||
}{
|
||||
{
|
||||
"Empty Records",
|
||||
&nameservicetypes.QueryListRecordsRequest{},
|
||||
false,
|
||||
false,
|
||||
0,
|
||||
},
|
||||
{
|
||||
"List Records",
|
||||
&nameservicetypes.QueryListRecordsRequest{},
|
||||
true,
|
||||
false,
|
||||
1,
|
||||
},
|
||||
}
|
||||
for _, test := range testCases {
|
||||
suite.Run(fmt.Sprintf("Case %s ", test.msg), func() {
|
||||
if test.createRecord {
|
||||
dir, err := os.Getwd()
|
||||
sr.NoError(err)
|
||||
payload, err := cli.GetPayloadFromFile(dir + "/../helpers/examples/example1.yml")
|
||||
sr.NoError(err)
|
||||
err = suite.app.NameServiceKeeper.ProcessSetRecord(ctx, nameservicetypes.MsgSetRecord{
|
||||
BondId: suite.bond.GetId(),
|
||||
Signer: suite.accounts[0].String(),
|
||||
Payload: payload.ToPayload(),
|
||||
})
|
||||
sr.NoError(err)
|
||||
}
|
||||
resp, err := grpcClient.ListRecords(context.Background(), test.req)
|
||||
if test.expErr {
|
||||
suite.Error(err)
|
||||
} else {
|
||||
sr.NoError(err)
|
||||
sr.Equal(test.noOfRecords, len(resp.GetRecords()))
|
||||
if test.createRecord {
|
||||
recordId = resp.GetRecords()[0].GetId()
|
||||
sr.NotZero(resp.GetRecords())
|
||||
sr.Equal(resp.GetRecords()[0].GetBondId(), suite.bond.GetId())
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// Get the records by record id
|
||||
testCases1 := []struct {
|
||||
msg string
|
||||
req *nameservicetypes.QueryRecordByIdRequest
|
||||
createRecord bool
|
||||
expErr bool
|
||||
noOfRecords int
|
||||
}{
|
||||
{
|
||||
"Invalid Request without record id",
|
||||
&nameservicetypes.QueryRecordByIdRequest{},
|
||||
false,
|
||||
true,
|
||||
0,
|
||||
},
|
||||
{
|
||||
"With Record ID",
|
||||
&nameservicetypes.QueryRecordByIdRequest{
|
||||
Id: recordId,
|
||||
},
|
||||
true,
|
||||
false,
|
||||
1,
|
||||
},
|
||||
}
|
||||
for _, test := range testCases1 {
|
||||
suite.Run(fmt.Sprintf("Case %s ", test.msg), func() {
|
||||
resp, err := grpcClient.GetRecord(context.Background(), test.req)
|
||||
if test.expErr {
|
||||
suite.Error(err)
|
||||
} else {
|
||||
sr.NoError(err)
|
||||
sr.NotNil(resp.GetRecord())
|
||||
if test.createRecord {
|
||||
sr.Equal(resp.GetRecord().BondId, suite.bond.GetId())
|
||||
sr.Equal(resp.GetRecord().Id, recordId)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// Get the records by record id
|
||||
testCasesByBondID := []struct {
|
||||
msg string
|
||||
req *nameservicetypes.QueryRecordByBondIdRequest
|
||||
createRecord bool
|
||||
expErr bool
|
||||
noOfRecords int
|
||||
}{
|
||||
{
|
||||
"Invalid Request without bond id",
|
||||
&nameservicetypes.QueryRecordByBondIdRequest{},
|
||||
false,
|
||||
true,
|
||||
0,
|
||||
},
|
||||
{
|
||||
"With Bond ID",
|
||||
&nameservicetypes.QueryRecordByBondIdRequest{
|
||||
Id: suite.bond.GetId(),
|
||||
},
|
||||
true,
|
||||
false,
|
||||
1,
|
||||
},
|
||||
}
|
||||
for _, test := range testCasesByBondID {
|
||||
suite.Run(fmt.Sprintf("Case %s ", test.msg), func() {
|
||||
resp, err := grpcClient.GetRecordByBondId(context.Background(), test.req)
|
||||
if test.expErr {
|
||||
sr.Zero(resp.GetRecords())
|
||||
} else {
|
||||
sr.NoError(err)
|
||||
sr.NotNil(resp.GetRecords())
|
||||
if test.createRecord {
|
||||
sr.NotZero(resp.GetRecords())
|
||||
sr.Equal(resp.GetRecords()[0].GetBondId(), suite.bond.GetId())
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (suite *KeeperTestSuite) TestGrpcQueryNameserviceModuleBalance() {
|
||||
grpcClient, ctx := suite.queryClient, suite.ctx
|
||||
sr := suite.Require()
|
||||
testCases := []struct {
|
||||
msg string
|
||||
req *nameservicetypes.GetNameServiceModuleBalanceRequest
|
||||
createRecord bool
|
||||
expErr bool
|
||||
noOfRecords int
|
||||
}{
|
||||
{
|
||||
"Get Module Balance",
|
||||
&nameservicetypes.GetNameServiceModuleBalanceRequest{},
|
||||
true,
|
||||
false,
|
||||
1,
|
||||
},
|
||||
}
|
||||
for _, test := range testCases {
|
||||
suite.Run(fmt.Sprintf("Case %s ", test.msg), func() {
|
||||
if test.createRecord {
|
||||
dir, err := os.Getwd()
|
||||
sr.NoError(err)
|
||||
payload, err := cli.GetPayloadFromFile(dir + "/../helpers/examples/example1.yml")
|
||||
sr.NoError(err)
|
||||
err = suite.app.NameServiceKeeper.ProcessSetRecord(ctx, nameservicetypes.MsgSetRecord{
|
||||
BondId: suite.bond.GetId(),
|
||||
Signer: suite.accounts[0].String(),
|
||||
Payload: payload.ToPayload(),
|
||||
})
|
||||
sr.NoError(err)
|
||||
}
|
||||
resp, err := grpcClient.GetNameServiceModuleBalance(context.Background(), test.req)
|
||||
if test.expErr {
|
||||
suite.Error(err)
|
||||
} else {
|
||||
sr.NoError(err)
|
||||
sr.Equal(test.noOfRecords, len(resp.GetBalances()))
|
||||
if test.createRecord {
|
||||
balance := resp.GetBalances()[0]
|
||||
sr.Equal(balance.AccountName, nameservicetypes.RecordRentModuleAccountName)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (suite *KeeperTestSuite) TestGrpcQueryWhoIS() {
|
||||
grpcClient, ctx := suite.queryClient, suite.ctx
|
||||
sr := suite.Require()
|
||||
var authorityName = "TestGrpcQueryWhoIS"
|
||||
|
||||
testCases := []struct {
|
||||
msg string
|
||||
req *nameservicetypes.QueryWhoisRequest
|
||||
createName bool
|
||||
expErr bool
|
||||
noOfRecords int
|
||||
}{
|
||||
{
|
||||
"Invalid Request without name",
|
||||
&nameservicetypes.QueryWhoisRequest{},
|
||||
false,
|
||||
true,
|
||||
1,
|
||||
},
|
||||
{
|
||||
"Success",
|
||||
&nameservicetypes.QueryWhoisRequest{},
|
||||
true,
|
||||
false,
|
||||
1,
|
||||
},
|
||||
}
|
||||
for _, test := range testCases {
|
||||
suite.Run(fmt.Sprintf("Case %s ", test.msg), func() {
|
||||
if test.createName {
|
||||
err := suite.app.NameServiceKeeper.ProcessReserveAuthority(ctx, nameservicetypes.MsgReserveAuthority{
|
||||
Name: authorityName,
|
||||
Signer: suite.accounts[0].String(),
|
||||
Owner: suite.accounts[0].String(),
|
||||
})
|
||||
sr.NoError(err)
|
||||
test.req = &nameservicetypes.QueryWhoisRequest{Name: authorityName}
|
||||
}
|
||||
resp, err := grpcClient.Whois(context.Background(), test.req)
|
||||
if test.expErr {
|
||||
sr.Zero(len(resp.NameAuthority.AuctionId))
|
||||
} else {
|
||||
sr.NoError(err)
|
||||
if test.createName {
|
||||
nameAuth := resp.NameAuthority
|
||||
sr.NotNil(nameAuth)
|
||||
sr.Equal(nameAuth.OwnerAddress, suite.accounts[0].String())
|
||||
sr.Equal(nameservicetypes.AuthorityActive, nameAuth.Status)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
package keeper
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/codec/legacy"
|
||||
@ -134,8 +133,7 @@ func (k Keeper) GetRecordExpiryQueue(ctx sdk.Context) []*types.ExpiryQueueRecord
|
||||
itr := sdk.KVStorePrefixIterator(store, PrefixExpiryTimeToRecordsIndex)
|
||||
defer itr.Close()
|
||||
for ; itr.Valid(); itr.Next() {
|
||||
var record []string
|
||||
err := json.Unmarshal(itr.Value(), &record)
|
||||
record, err := helpers.BytesArrToStringArr(itr.Value())
|
||||
if err != nil {
|
||||
return records
|
||||
}
|
||||
|
62
x/nameservice/keeper/keeper_test.go
Normal file
62
x/nameservice/keeper/keeper_test.go
Normal file
@ -0,0 +1,62 @@
|
||||
package keeper_test
|
||||
|
||||
import (
|
||||
"github.com/cosmos/cosmos-sdk/baseapp"
|
||||
"github.com/cosmos/cosmos-sdk/simapp"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/suite"
|
||||
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
|
||||
"github.com/tharsis/ethermint/app"
|
||||
bondtypes "github.com/tharsis/ethermint/x/bond/types"
|
||||
nameservicekeeper "github.com/tharsis/ethermint/x/nameservice/keeper"
|
||||
"github.com/tharsis/ethermint/x/nameservice/types"
|
||||
"testing"
|
||||
)
|
||||
|
||||
type KeeperTestSuite struct {
|
||||
suite.Suite
|
||||
app *app.EthermintApp
|
||||
ctx sdk.Context
|
||||
queryClient types.QueryClient
|
||||
accounts []sdk.AccAddress
|
||||
bond bondtypes.Bond
|
||||
}
|
||||
|
||||
func (suite *KeeperTestSuite) SetupTest() {
|
||||
testApp := app.Setup(false)
|
||||
ctx := testApp.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
querier := nameservicekeeper.Querier{Keeper: testApp.NameServiceKeeper}
|
||||
|
||||
queryHelper := baseapp.NewQueryServerTestHelper(ctx, testApp.InterfaceRegistry())
|
||||
types.RegisterQueryServer(queryHelper, querier)
|
||||
queryClient := types.NewQueryClient(queryHelper)
|
||||
|
||||
suite.accounts = app.CreateRandomAccounts(1)
|
||||
account := suite.accounts[0]
|
||||
_ = simapp.FundAccount(testApp.BankKeeper, ctx, account, sdk.NewCoins(sdk.Coin{
|
||||
Denom: sdk.DefaultBondDenom,
|
||||
Amount: sdk.NewInt(100000000000),
|
||||
}))
|
||||
|
||||
bond, err := testApp.BondKeeper.CreateBond(ctx, account, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(1000000000))))
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
suite.bond = *bond
|
||||
suite.app, suite.ctx, suite.queryClient = testApp, ctx, queryClient
|
||||
}
|
||||
|
||||
func TestParams(t *testing.T) {
|
||||
testApp := app.Setup(false)
|
||||
ctx := testApp.BaseApp.NewContext(false, tmproto.Header{})
|
||||
|
||||
expParams := types.DefaultParams()
|
||||
params := testApp.NameServiceKeeper.GetParams(ctx)
|
||||
require.True(t, params.Equal(expParams))
|
||||
}
|
||||
|
||||
func TestKeeperTestSuite(t *testing.T) {
|
||||
suite.Run(t, new(KeeperTestSuite))
|
||||
}
|
@ -54,21 +54,21 @@ func (k Keeper) RemoveAuctionToAuthorityMapping(ctx sdk.Context, auctionID strin
|
||||
}
|
||||
|
||||
// GetNameAuthority - gets a name authority from the store.
|
||||
func GetNameAuthority(store sdk.KVStore, codec codec.BinaryCodec, name string) *types.NameAuthority {
|
||||
func GetNameAuthority(store sdk.KVStore, codec codec.BinaryCodec, name string) types.NameAuthority {
|
||||
authorityKey := GetNameAuthorityIndexKey(name)
|
||||
if !store.Has(authorityKey) {
|
||||
return nil
|
||||
return types.NameAuthority{}
|
||||
}
|
||||
|
||||
bz := store.Get(authorityKey)
|
||||
var obj types.NameAuthority
|
||||
codec.MustUnmarshal(bz, &obj)
|
||||
|
||||
return &obj
|
||||
return obj
|
||||
}
|
||||
|
||||
// GetNameAuthority - gets a name authority from the store.
|
||||
func (k Keeper) GetNameAuthority(ctx sdk.Context, name string) *types.NameAuthority {
|
||||
func (k Keeper) GetNameAuthority(ctx sdk.Context, name string) types.NameAuthority {
|
||||
return GetNameAuthority(ctx.KVStore(k.storeKey), k.cdc, name)
|
||||
}
|
||||
|
||||
@ -114,12 +114,11 @@ func (k Keeper) getAuthority(ctx sdk.Context, wrn string) (string, *url.URL, *ty
|
||||
}
|
||||
|
||||
name := parsedWRN.Host
|
||||
authority := k.GetNameAuthority(ctx, name)
|
||||
if authority == nil {
|
||||
if !k.HasNameAuthority(ctx, name) {
|
||||
return name, nil, nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Name authority not found.")
|
||||
}
|
||||
|
||||
return name, parsedWRN, authority, nil
|
||||
authority := k.GetNameAuthority(ctx, name)
|
||||
return name, parsedWRN, &authority, nil
|
||||
}
|
||||
|
||||
func (k Keeper) checkWRNAccess(ctx sdk.Context, signer sdk.AccAddress, wrn string) error {
|
||||
@ -204,7 +203,7 @@ func (k Keeper) GetNameRecord(ctx sdk.Context, wrn string) *types.NameRecord {
|
||||
}
|
||||
|
||||
// RemoveRecordToNameMapping removes a name from the record ID -> []names index.
|
||||
func RemoveRecordToNameMapping(store sdk.KVStore, codec codec.BinaryCodec, id string, wrn string) {
|
||||
func RemoveRecordToNameMapping(store sdk.KVStore, id string, wrn string) {
|
||||
reverseNameIndexKey := GetCIDToNamesIndexKey(id)
|
||||
|
||||
names, _ := helpers.BytesArrToStringArr(store.Get(reverseNameIndexKey))
|
||||
@ -247,7 +246,7 @@ func SetNameRecord(store sdk.KVStore, codec codec.BinaryCodec, wrn string, id st
|
||||
|
||||
// Update old CID -> []Name index.
|
||||
if nameRecord.Latest.Id != "" || len(nameRecord.Latest.Id) != 0 {
|
||||
RemoveRecordToNameMapping(store, codec, nameRecord.Latest.Id, wrn)
|
||||
RemoveRecordToNameMapping(store, nameRecord.Latest.Id, wrn)
|
||||
}
|
||||
}
|
||||
|
||||
@ -321,10 +320,10 @@ func (k Keeper) ProcessReserveSubAuthority(ctx sdk.Context, name string, msg typ
|
||||
parent := strings.Join(names[1:], ".")
|
||||
|
||||
// Check if parent authority exists.
|
||||
parentAuthority := k.GetNameAuthority(ctx, parent)
|
||||
if parentAuthority == nil {
|
||||
if !k.HasNameAuthority(ctx, parent) {
|
||||
return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Parent authority not found.")
|
||||
}
|
||||
parentAuthority := k.GetNameAuthority(ctx, parent)
|
||||
|
||||
// Sub-authority creator needs to be the owner of the parent authority.
|
||||
if parentAuthority.OwnerAddress != msg.Signer {
|
||||
@ -417,6 +416,7 @@ func (k Keeper) createAuthority(ctx sdk.Context, name string, owner string, isRo
|
||||
authority.AuctionId = auction.Id
|
||||
authority.ExpiryTime = auction.RevealsEndTime.Add(moduleParams.AuthorityGracePeriod)
|
||||
}
|
||||
|
||||
k.SetNameAuthority(ctx, name, &authority)
|
||||
k.InsertAuthorityExpiryQueue(ctx, name, authority.ExpiryTime)
|
||||
|
||||
@ -447,10 +447,10 @@ func (k Keeper) ProcessReserveAuthority(ctx sdk.Context, msg types.MsgReserveAut
|
||||
func (k Keeper) ProcessSetAuthorityBond(ctx sdk.Context, msg types.MsgSetAuthorityBond) error {
|
||||
name := msg.GetName()
|
||||
signer := msg.GetSigner()
|
||||
authority := k.GetNameAuthority(ctx, name)
|
||||
if authority == nil {
|
||||
if !k.HasNameAuthority(ctx, name) {
|
||||
return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Name authority not found.")
|
||||
}
|
||||
authority := k.GetNameAuthority(ctx, name)
|
||||
if authority.OwnerAddress != signer {
|
||||
return sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Access denied")
|
||||
}
|
||||
@ -476,7 +476,7 @@ func (k Keeper) ProcessSetAuthorityBond(ctx sdk.Context, msg types.MsgSetAuthori
|
||||
|
||||
// Update bond ID for authority.
|
||||
authority.BondId = bond.Id
|
||||
k.SetNameAuthority(ctx, name, authority)
|
||||
k.SetNameAuthority(ctx, name, &authority)
|
||||
// Add new bond ID mapping.
|
||||
k.AddBondToAuthorityIndexEntry(ctx, authority.BondId, name)
|
||||
return nil
|
||||
|
@ -76,7 +76,7 @@ func (k RecordKeeper) OnAuctionWinnerSelected(ctx sdk.Context, auctionID string)
|
||||
}
|
||||
|
||||
authority.AuctionId = ""
|
||||
SetNameAuthority(ctx, store, k.cdc, name, authority)
|
||||
SetNameAuthority(ctx, store, k.cdc, name, &authority)
|
||||
|
||||
// Forget about this auction now, we no longer need it.
|
||||
removeAuctionToAuthorityMapping(store, auctionID)
|
||||
|
@ -1,6 +1,7 @@
|
||||
package nameservice
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
@ -12,7 +13,7 @@ import (
|
||||
"github.com/grpc-ecosystem/grpc-gateway/runtime"
|
||||
"github.com/spf13/cobra"
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
"github.com/tharsis/ethermint/x/nameservice/cli"
|
||||
"github.com/tharsis/ethermint/x/nameservice/client/cli"
|
||||
"github.com/tharsis/ethermint/x/nameservice/keeper"
|
||||
"github.com/tharsis/ethermint/x/nameservice/types"
|
||||
)
|
||||
@ -54,7 +55,11 @@ func (a AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEnc
|
||||
func (a AppModuleBasic) RegisterRESTRoutes(context client.Context, router *mux.Router) {
|
||||
}
|
||||
|
||||
func (a AppModuleBasic) RegisterGRPCGatewayRoutes(context client.Context, mux *runtime.ServeMux) {
|
||||
func (a AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) {
|
||||
err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func (a AppModuleBasic) GetTxCmd() *cobra.Command {
|
||||
|
@ -1202,84 +1202,84 @@ func init() {
|
||||
}
|
||||
|
||||
var fileDescriptor_73d2465766c8f876 = []byte{
|
||||
// 1227 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x58, 0xcf, 0x6f, 0xdc, 0x44,
|
||||
0x14, 0xce, 0x6c, 0x9a, 0x94, 0xbc, 0x40, 0x42, 0x86, 0x88, 0xa6, 0x6e, 0xbb, 0x49, 0x9c, 0xb6,
|
||||
0xd9, 0xad, 0xba, 0x76, 0x36, 0x55, 0x0b, 0x49, 0x85, 0x44, 0x36, 0x84, 0xa8, 0x55, 0x41, 0xc4,
|
||||
0x20, 0x05, 0x71, 0xa0, 0xf2, 0xae, 0x87, 0x8d, 0xe9, 0xae, 0x67, 0xeb, 0x1f, 0x49, 0x97, 0x28,
|
||||
0x17, 0x0e, 0x3d, 0x23, 0x71, 0x42, 0x82, 0x03, 0x07, 0x0e, 0x44, 0xea, 0x89, 0x0b, 0xf7, 0x0a,
|
||||
0xa9, 0xb7, 0x56, 0xe2, 0xc2, 0x29, 0xa0, 0x04, 0x89, 0x7b, 0xff, 0x02, 0xe4, 0x99, 0xb1, 0x63,
|
||||
0xef, 0x4f, 0xef, 0x36, 0x95, 0x7a, 0x8a, 0x3d, 0xf3, 0xbe, 0xf7, 0xbe, 0xf7, 0xde, 0xcc, 0xf3,
|
||||
0xb7, 0x81, 0xec, 0xb6, 0x57, 0x29, 0xe9, 0x96, 0xf9, 0x0d, 0x51, 0x2d, 0xbd, 0x4a, 0x1c, 0x62,
|
||||
0x6f, 0x9b, 0x25, 0xa2, 0x6e, 0xe7, 0x8b, 0xc4, 0xd5, 0xf3, 0xea, 0x7d, 0x8f, 0xd8, 0x75, 0xa5,
|
||||
0x66, 0x53, 0x97, 0xe2, 0x0b, 0xa1, 0xa9, 0x12, 0x31, 0x55, 0x84, 0xa9, 0xa4, 0x76, 0xf6, 0x14,
|
||||
0x85, 0x30, 0x7f, 0xd2, 0xf9, 0x32, 0xa5, 0xe5, 0x0a, 0x51, 0xf5, 0x9a, 0xa9, 0xea, 0x96, 0x45,
|
||||
0x5d, 0xdd, 0x35, 0xa9, 0xe5, 0x88, 0xdd, 0x2b, 0x25, 0xea, 0x54, 0xa9, 0xa3, 0x16, 0x75, 0x87,
|
||||
0x70, 0x1a, 0xa1, 0xab, 0x9a, 0x5e, 0x36, 0x2d, 0x66, 0x2c, 0x6c, 0x27, 0xcb, 0xb4, 0x4c, 0xd9,
|
||||
0xa3, 0xea, 0x3f, 0x89, 0xd5, 0x74, 0xd4, 0x43, 0x80, 0x2d, 0x51, 0x53, 0xa0, 0xe4, 0x49, 0xc0,
|
||||
0x1b, 0xbe, 0xdf, 0x4f, 0x74, 0x5b, 0xaf, 0x3a, 0x1a, 0xb9, 0xef, 0x11, 0xc7, 0x95, 0x3f, 0x83,
|
||||
0xb7, 0x62, 0xab, 0x4e, 0x8d, 0x5a, 0x0e, 0xc1, 0xef, 0xc1, 0x70, 0x8d, 0xad, 0x4c, 0xa1, 0x19,
|
||||
0x94, 0x19, 0x5d, 0xbc, 0xa4, 0x74, 0xac, 0x86, 0x22, 0xe0, 0x02, 0x24, 0xeb, 0x70, 0x86, 0x79,
|
||||
0xbd, 0x63, 0x3a, 0xae, 0x46, 0x4a, 0xd4, 0x36, 0x82, 0x80, 0xf8, 0x43, 0x80, 0xe3, 0x84, 0x84,
|
||||
0xf7, 0xcb, 0x0a, 0xe7, 0xae, 0xf8, 0xdc, 0x15, 0xde, 0x84, 0x63, 0xcf, 0x65, 0x22, 0xb0, 0x5a,
|
||||
0x04, 0x29, 0xef, 0x23, 0x98, 0x6a, 0x8e, 0x21, 0xe8, 0xaf, 0xc1, 0x69, 0x9b, 0x2f, 0x4d, 0xa1,
|
||||
0x99, 0xc1, 0x04, 0xfc, 0xb9, 0x83, 0xc2, 0xa9, 0x27, 0x07, 0xd3, 0x03, 0x5a, 0x80, 0xc5, 0xeb,
|
||||
0x31, 0xae, 0x29, 0xc6, 0x75, 0xbe, 0x2b, 0x57, 0xce, 0x21, 0x46, 0x36, 0x03, 0x6f, 0x33, 0xae,
|
||||
0x22, 0x4c, 0xfd, 0x96, 0x11, 0x94, 0x63, 0x0c, 0x52, 0xa6, 0xc1, 0xca, 0x30, 0xa2, 0xa5, 0x4c,
|
||||
0x43, 0xfe, 0x52, 0x54, 0x2e, 0x6a, 0x29, 0x92, 0x5a, 0x85, 0x61, 0x4e, 0x2c, 0x61, 0x4f, 0x62,
|
||||
0x39, 0x09, 0xa8, 0xec, 0x82, 0x14, 0xf3, 0x5f, 0xa0, 0x96, 0xd1, 0x96, 0x4d, 0x43, 0xb3, 0x52,
|
||||
0x7d, 0x37, 0xeb, 0x11, 0x82, 0x73, 0x2d, 0xc3, 0xbe, 0xa2, 0xfd, 0xba, 0x08, 0xf2, 0x3a, 0x71,
|
||||
0x3f, 0xd6, 0xab, 0xe4, 0x53, 0x1e, 0xf8, 0x23, 0x6a, 0x78, 0x15, 0x52, 0xd0, 0x2b, 0xba, 0x55,
|
||||
0x0a, 0x32, 0x94, 0x6b, 0x30, 0xd7, 0xd1, 0x4a, 0x24, 0x77, 0x0b, 0x5e, 0x2b, 0xf2, 0xa5, 0x20,
|
||||
0xbb, 0x5c, 0x97, 0xec, 0x56, 0x4a, 0x25, 0xea, 0x59, 0x6e, 0xe0, 0x28, 0x84, 0xcb, 0xff, 0x21,
|
||||
0x18, 0x8b, 0x6f, 0xe2, 0x3b, 0xf0, 0xba, 0xce, 0x57, 0xee, 0xfa, 0xae, 0x78, 0xf3, 0x0a, 0xd9,
|
||||
0xe7, 0x07, 0xd3, 0x97, 0xbe, 0x76, 0xa8, 0xb5, 0x2c, 0x8b, 0x5d, 0x9f, 0xa6, 0x3c, 0x53, 0xd7,
|
||||
0xab, 0x95, 0xf8, 0x92, 0x36, 0x1a, 0x79, 0xc3, 0x0f, 0x11, 0x9c, 0x16, 0xd1, 0xa6, 0x06, 0x19,
|
||||
0xd7, 0xb3, 0xb1, 0xfa, 0x05, 0x0c, 0x57, 0xa9, 0x69, 0x15, 0x36, 0xfc, 0xea, 0x3f, 0x3f, 0x98,
|
||||
0xbe, 0xc0, 0x03, 0x09, 0x5c, 0x10, 0x24, 0x78, 0xdd, 0xff, 0x7b, 0x3a, 0x53, 0x36, 0xdd, 0x2d,
|
||||
0xaf, 0xa8, 0x94, 0x68, 0x55, 0x15, 0x53, 0x8a, 0xff, 0xc9, 0x39, 0xc6, 0x3d, 0xd5, 0xad, 0xd7,
|
||||
0x88, 0xc3, 0x3c, 0x3a, 0x5a, 0x10, 0x5c, 0x26, 0xe2, 0xc0, 0xf8, 0xb7, 0xdb, 0x67, 0xf6, 0x92,
|
||||
0xa6, 0xc8, 0x23, 0x04, 0xe7, 0x5b, 0xc7, 0x11, 0xcd, 0xfb, 0x00, 0x86, 0x58, 0x87, 0x44, 0xe7,
|
||||
0x32, 0x5d, 0x3a, 0xe7, 0xbb, 0x58, 0xb3, 0x5c, 0xbb, 0x2e, 0x8e, 0x26, 0x07, 0x9f, 0xdc, 0xc1,
|
||||
0x9c, 0x87, 0x09, 0x46, 0x77, 0x73, 0x8b, 0x9a, 0x61, 0x31, 0x30, 0x9c, 0x3a, 0x6e, 0xbd, 0xc6,
|
||||
0x9e, 0xe5, 0x9f, 0x90, 0x18, 0xf7, 0xc2, 0x52, 0xa4, 0xf3, 0x10, 0xc1, 0x98, 0xbf, 0x7f, 0x57,
|
||||
0xf7, 0xdc, 0x2d, 0x6a, 0x9b, 0x6e, 0x5d, 0x14, 0xef, 0x6a, 0x82, 0xc4, 0x56, 0x02, 0x4c, 0x21,
|
||||
0x2f, 0x3a, 0x9f, 0xe5, 0x9d, 0xb7, 0xa2, 0x9b, 0x41, 0xff, 0xe3, 0x8b, 0xda, 0x1b, 0xf1, 0x77,
|
||||
0x19, 0xc6, 0x78, 0xdd, 0x29, 0xbd, 0xe7, 0xd5, 0x36, 0x6d, 0x0b, 0xbf, 0x09, 0x83, 0x3b, 0xb6,
|
||||
0x25, 0x92, 0xf0, 0x1f, 0xe5, 0x4d, 0x31, 0x35, 0x43, 0x9b, 0xc8, 0xe7, 0xe9, 0x38, 0xe3, 0xd1,
|
||||
0xc5, 0x6c, 0x02, 0xee, 0xbc, 0xaf, 0xa2, 0x38, 0x73, 0x30, 0x2e, 0xa6, 0x91, 0x43, 0x2b, 0xdb,
|
||||
0xa4, 0x75, 0xf4, 0xcf, 0xc3, 0x49, 0x1c, 0x18, 0x45, 0xbf, 0x8e, 0x7d, 0x4c, 0xe2, 0x70, 0x06,
|
||||
0x97, 0xe0, 0x2c, 0xf3, 0xbc, 0x4e, 0xc4, 0x87, 0x6b, 0xed, 0x41, 0xcd, 0xb4, 0xeb, 0x1b, 0x1e,
|
||||
0xf1, 0xc8, 0x89, 0x9d, 0xec, 0xdf, 0x11, 0xcc, 0xb6, 0x8d, 0x12, 0x66, 0x72, 0xbb, 0x71, 0xf0,
|
||||
0x2e, 0x74, 0x49, 0x25, 0xe6, 0x84, 0x65, 0x75, 0xf2, 0xd3, 0x77, 0x09, 0x26, 0x9a, 0xc2, 0x34,
|
||||
0x7d, 0x9a, 0x26, 0x61, 0x68, 0x5b, 0xaf, 0x78, 0x64, 0x2a, 0x35, 0x33, 0x98, 0x19, 0xd1, 0xf8,
|
||||
0x8b, 0xfc, 0x95, 0xb8, 0xce, 0xeb, 0xc4, 0x0d, 0xcf, 0xda, 0xcb, 0xa8, 0xee, 0x63, 0x04, 0x17,
|
||||
0x3b, 0x05, 0x0a, 0x0b, 0xac, 0xc1, 0x68, 0x70, 0xd5, 0x4c, 0xd2, 0x7f, 0x91, 0xa3, 0x4e, 0x4e,
|
||||
0xac, 0xd0, 0x8b, 0x4f, 0xc7, 0x61, 0x88, 0x65, 0x81, 0x7f, 0x40, 0x30, 0xcc, 0x35, 0x1c, 0xce,
|
||||
0x77, 0x21, 0xd7, 0x2c, 0x22, 0xa5, 0xc5, 0x5e, 0x20, 0x9c, 0x87, 0x9c, 0xf9, 0xf6, 0xcf, 0x7f,
|
||||
0xbf, 0x4f, 0xc9, 0x78, 0x46, 0x25, 0xee, 0x16, 0xb1, 0xab, 0xa6, 0xe5, 0x36, 0x08, 0x69, 0x95,
|
||||
0x8b, 0x49, 0xfc, 0x2b, 0x82, 0xd1, 0x88, 0xc8, 0xc3, 0x37, 0x92, 0x44, 0x6b, 0x56, 0x9e, 0xd2,
|
||||
0x3b, 0x3d, 0xe3, 0x04, 0xd5, 0x2c, 0xa3, 0x3a, 0x87, 0x67, 0xdb, 0x53, 0x0d, 0xee, 0xc0, 0x3e,
|
||||
0x82, 0x91, 0xf0, 0xc2, 0xe1, 0xeb, 0x49, 0x22, 0x36, 0x69, 0x42, 0xe9, 0x46, 0xaf, 0x30, 0xc1,
|
||||
0x53, 0x61, 0x3c, 0x33, 0xf8, 0x72, 0x57, 0x9e, 0xea, 0xae, 0x69, 0xec, 0xe1, 0x3f, 0x10, 0x4c,
|
||||
0x84, 0x64, 0x03, 0x4d, 0x86, 0x97, 0x7a, 0x89, 0x1e, 0x93, 0x8f, 0xd2, 0x72, 0x3f, 0x50, 0x41,
|
||||
0x7e, 0x89, 0x91, 0xbf, 0x86, 0xf3, 0x5d, 0xc9, 0xe7, 0x8a, 0xf5, 0x5c, 0x91, 0x5a, 0x46, 0xce,
|
||||
0x34, 0x78, 0x1e, 0x4f, 0x11, 0x9c, 0xeb, 0x20, 0xc4, 0xf0, 0x4a, 0x17, 0x5a, 0xdd, 0xa5, 0x9e,
|
||||
0x54, 0x78, 0x11, 0x17, 0xc9, 0x8f, 0x91, 0x50, 0x3f, 0xf8, 0x37, 0x04, 0xe3, 0x0d, 0x8a, 0x04,
|
||||
0x2f, 0x27, 0x3d, 0xbe, 0xcd, 0x72, 0x49, 0xba, 0xd9, 0x17, 0x56, 0xf0, 0x9e, 0x67, 0xbc, 0x67,
|
||||
0xf1, 0x74, 0x7b, 0xde, 0x5c, 0xe5, 0xfc, 0x88, 0x60, 0x88, 0xc9, 0x0d, 0xbc, 0x90, 0x24, 0x5e,
|
||||
0x54, 0xc3, 0x48, 0xf9, 0x1e, 0x10, 0xc9, 0x8f, 0xfb, 0x8e, 0x0f, 0x50, 0x77, 0xfd, 0xd5, 0x3d,
|
||||
0xfc, 0x33, 0x82, 0x91, 0x63, 0xb9, 0x91, 0x4b, 0x54, 0x92, 0xc0, 0x5c, 0xba, 0xde, 0x93, 0x79,
|
||||
0x2f, 0x1c, 0x2b, 0x0c, 0xa4, 0xee, 0xee, 0xd8, 0xd6, 0x1e, 0xfe, 0x05, 0x01, 0x44, 0x54, 0x89,
|
||||
0x92, 0xec, 0x42, 0x05, 0xf6, 0x49, 0x27, 0x47, 0xa3, 0xa0, 0x91, 0x55, 0x46, 0x33, 0x8b, 0xe7,
|
||||
0x3b, 0x5d, 0x3e, 0x86, 0x12, 0x3c, 0x1f, 0x23, 0x98, 0x6c, 0x29, 0x5f, 0xde, 0x4d, 0xc2, 0xa0,
|
||||
0x15, 0x52, 0x7a, 0xbf, 0x5f, 0x64, 0x6f, 0x59, 0xf8, 0xe0, 0x1c, 0x61, 0x68, 0x7f, 0x70, 0x9c,
|
||||
0x69, 0xa7, 0x14, 0x6e, 0x26, 0xa4, 0xd3, 0x0a, 0x2c, 0xad, 0xbe, 0x00, 0x38, 0x4c, 0x67, 0x91,
|
||||
0xa5, 0x73, 0x15, 0x5f, 0x69, 0x9f, 0x4e, 0xa8, 0xe2, 0x45, 0x46, 0x85, 0xdb, 0x4f, 0x0e, 0xd3,
|
||||
0xe8, 0xd9, 0x61, 0x1a, 0xfd, 0x73, 0x98, 0x46, 0xdf, 0x1d, 0xa5, 0x07, 0x9e, 0x1d, 0xa5, 0x07,
|
||||
0xfe, 0x3a, 0x4a, 0x0f, 0x7c, 0xb1, 0x10, 0xf9, 0x0d, 0xe6, 0x6e, 0xe9, 0xb6, 0x63, 0x3a, 0x11,
|
||||
0xbf, 0x0f, 0x62, 0x9e, 0xd9, 0x2f, 0xb2, 0xe2, 0x30, 0xfb, 0xbf, 0xd1, 0xb5, 0xff, 0x03, 0x00,
|
||||
0x00, 0xff, 0xff, 0x64, 0xd6, 0x54, 0x09, 0x34, 0x13, 0x00, 0x00,
|
||||
// 1218 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x58, 0x4d, 0x6c, 0xdc, 0x44,
|
||||
0x14, 0xce, 0x6c, 0x9a, 0x94, 0xbc, 0x40, 0x42, 0x86, 0x88, 0xa6, 0x6e, 0xbb, 0x09, 0x6e, 0x7e,
|
||||
0x36, 0x90, 0xb5, 0xb3, 0x29, 0x4d, 0xdb, 0x54, 0x20, 0xb2, 0x21, 0x44, 0xad, 0x0a, 0x22, 0x06,
|
||||
0x29, 0x88, 0x03, 0x95, 0x77, 0x3d, 0x6c, 0x4c, 0x77, 0x3d, 0x5b, 0xff, 0xa4, 0x5d, 0xaa, 0x5e,
|
||||
0x38, 0xf4, 0x8c, 0xc4, 0x19, 0x04, 0x12, 0xa7, 0x4a, 0x85, 0x6b, 0xef, 0x5c, 0x22, 0x4e, 0x95,
|
||||
0xe0, 0xc0, 0x29, 0xa0, 0x04, 0x89, 0x7b, 0x8f, 0x9c, 0x90, 0x67, 0xc6, 0x8e, 0x9d, 0xdd, 0xc4,
|
||||
0xf6, 0x36, 0x95, 0x38, 0xc5, 0x9e, 0x79, 0xdf, 0x7b, 0xdf, 0xf7, 0xde, 0xcc, 0xf3, 0xdb, 0xc0,
|
||||
0xec, 0x96, 0x57, 0xaf, 0xea, 0x96, 0xf9, 0x25, 0x51, 0x2d, 0xbd, 0x41, 0x1c, 0x62, 0x6f, 0x99,
|
||||
0x55, 0xa2, 0x6e, 0x95, 0x2a, 0xc4, 0xd5, 0x4b, 0xea, 0x6d, 0x8f, 0xd8, 0x2d, 0xa5, 0x69, 0x53,
|
||||
0x97, 0xe2, 0x73, 0xa1, 0xa9, 0x12, 0x31, 0x55, 0x84, 0xa9, 0xa4, 0x1e, 0xed, 0x29, 0x0a, 0x61,
|
||||
0xfe, 0xa4, 0xb3, 0x35, 0x4a, 0x6b, 0x75, 0xa2, 0xea, 0x4d, 0x53, 0xd5, 0x2d, 0x8b, 0xba, 0xba,
|
||||
0x6b, 0x52, 0xcb, 0x11, 0xbb, 0xaf, 0x57, 0xa9, 0xd3, 0xa0, 0x8e, 0x5a, 0xd1, 0x1d, 0xc2, 0x69,
|
||||
0x84, 0xae, 0x9a, 0x7a, 0xcd, 0xb4, 0x98, 0xb1, 0xb0, 0x1d, 0xad, 0xd1, 0x1a, 0x65, 0x8f, 0xaa,
|
||||
0xff, 0x24, 0x56, 0xf3, 0x51, 0x0f, 0x01, 0xb6, 0x4a, 0x4d, 0x81, 0x92, 0x47, 0x01, 0xaf, 0xfb,
|
||||
0x7e, 0x3f, 0xd4, 0x6d, 0xbd, 0xe1, 0x68, 0xe4, 0xb6, 0x47, 0x1c, 0x57, 0xfe, 0x18, 0x5e, 0x89,
|
||||
0xad, 0x3a, 0x4d, 0x6a, 0x39, 0x04, 0xbf, 0x05, 0xfd, 0x4d, 0xb6, 0x32, 0x86, 0x26, 0x50, 0x61,
|
||||
0x70, 0x61, 0x4a, 0x39, 0x32, 0x1b, 0x8a, 0x80, 0x0b, 0x90, 0xac, 0xc3, 0x29, 0xe6, 0xf5, 0x86,
|
||||
0xe9, 0xb8, 0x1a, 0xa9, 0x52, 0xdb, 0x08, 0x02, 0xe2, 0xf7, 0x00, 0xf6, 0x05, 0x09, 0xef, 0xd3,
|
||||
0x0a, 0xe7, 0xae, 0xf8, 0xdc, 0x15, 0x5e, 0x84, 0x7d, 0xcf, 0x35, 0x22, 0xb0, 0x5a, 0x04, 0x29,
|
||||
0x3f, 0x44, 0x30, 0xd6, 0x1e, 0x43, 0xd0, 0x5f, 0x85, 0x93, 0x36, 0x5f, 0x1a, 0x43, 0x13, 0xbd,
|
||||
0x29, 0xf8, 0x73, 0x07, 0xe5, 0x13, 0xdb, 0x3b, 0xe3, 0x3d, 0x5a, 0x80, 0xc5, 0x6b, 0x31, 0xae,
|
||||
0x39, 0xc6, 0x75, 0x26, 0x91, 0x2b, 0xe7, 0x10, 0x23, 0x5b, 0x80, 0x57, 0x19, 0x57, 0x11, 0xa6,
|
||||
0x75, 0xcd, 0x08, 0xd2, 0x31, 0x04, 0x39, 0xd3, 0x60, 0x69, 0x18, 0xd0, 0x72, 0xa6, 0x21, 0x7f,
|
||||
0x26, 0x32, 0x17, 0xb5, 0x14, 0xa2, 0x56, 0xa0, 0x9f, 0x13, 0x4b, 0x59, 0x93, 0x98, 0x26, 0x01,
|
||||
0x95, 0x5d, 0x90, 0x62, 0xfe, 0xcb, 0xd4, 0x32, 0x0e, 0x65, 0x73, 0xa0, 0x58, 0xb9, 0xae, 0x8b,
|
||||
0xf5, 0x08, 0xc1, 0x99, 0x8e, 0x61, 0xff, 0xa7, 0xf5, 0x9a, 0x04, 0x79, 0x8d, 0xb8, 0x1f, 0xe8,
|
||||
0x0d, 0xf2, 0x11, 0x0f, 0xfc, 0x3e, 0x35, 0xbc, 0x3a, 0x29, 0xeb, 0x75, 0xdd, 0xaa, 0x06, 0x0a,
|
||||
0xe5, 0x26, 0x9c, 0x3f, 0xd2, 0x4a, 0x88, 0xbb, 0x06, 0x2f, 0x54, 0xf8, 0x52, 0xa0, 0xae, 0x98,
|
||||
0xa0, 0x6e, 0xb9, 0x5a, 0xa5, 0x9e, 0xe5, 0x06, 0x8e, 0x42, 0xb8, 0xfc, 0x0f, 0x82, 0xa1, 0xf8,
|
||||
0x26, 0xbe, 0x01, 0x2f, 0xea, 0x7c, 0xe5, 0xa6, 0xef, 0x8a, 0x17, 0xaf, 0x3c, 0xfb, 0x74, 0x67,
|
||||
0x7c, 0xea, 0x0b, 0x87, 0x5a, 0x4b, 0xb2, 0xd8, 0xf5, 0x69, 0xca, 0x13, 0x2d, 0xbd, 0x51, 0x8f,
|
||||
0x2f, 0x69, 0x83, 0x91, 0x37, 0xfc, 0x00, 0xc1, 0x49, 0x11, 0x6d, 0xac, 0x97, 0x71, 0x3d, 0x1d,
|
||||
0xcb, 0x5f, 0xc0, 0x70, 0x85, 0x9a, 0x56, 0x79, 0xdd, 0xcf, 0xfe, 0xd3, 0x9d, 0xf1, 0x73, 0x3c,
|
||||
0x90, 0xc0, 0x05, 0x41, 0x82, 0xd7, 0x87, 0x7f, 0x8e, 0x17, 0x6a, 0xa6, 0xbb, 0xe9, 0x55, 0x94,
|
||||
0x2a, 0x6d, 0xa8, 0xa2, 0x4b, 0xf1, 0x3f, 0x45, 0xc7, 0xb8, 0xa5, 0xba, 0xad, 0x26, 0x71, 0x98,
|
||||
0x47, 0x47, 0x0b, 0x82, 0xcb, 0x44, 0x1c, 0x18, 0xff, 0x76, 0xfb, 0xcc, 0x9e, 0x53, 0x17, 0x79,
|
||||
0x84, 0xe0, 0x6c, 0xe7, 0x38, 0xa2, 0x78, 0xef, 0x42, 0x1f, 0xab, 0x90, 0xa8, 0x5c, 0x21, 0xa1,
|
||||
0x72, 0xbe, 0x8b, 0x55, 0xcb, 0xb5, 0x5b, 0xe2, 0x68, 0x72, 0xf0, 0xf1, 0x1d, 0xcc, 0x19, 0x18,
|
||||
0x61, 0x74, 0x37, 0x36, 0xa9, 0x19, 0x26, 0x03, 0xc3, 0x89, 0xfd, 0xd2, 0x6b, 0xec, 0x59, 0xfe,
|
||||
0x16, 0x89, 0x76, 0x2f, 0x2c, 0x85, 0x9c, 0x07, 0x08, 0x86, 0xfc, 0xfd, 0x9b, 0xba, 0xe7, 0x6e,
|
||||
0x52, 0xdb, 0x74, 0x5b, 0x22, 0x79, 0x73, 0x29, 0x84, 0x2d, 0x07, 0x98, 0x72, 0x49, 0x54, 0x7e,
|
||||
0x96, 0x57, 0xde, 0x8a, 0x6e, 0x06, 0xf5, 0x8f, 0x2f, 0x6a, 0x2f, 0xc5, 0xdf, 0x65, 0x18, 0xe2,
|
||||
0x79, 0xa7, 0xf4, 0x96, 0xd7, 0xdc, 0xb0, 0x2d, 0xfc, 0x32, 0xf4, 0xde, 0xb1, 0x2d, 0x21, 0xc2,
|
||||
0x7f, 0x94, 0x37, 0x44, 0xd7, 0x0c, 0x6d, 0x22, 0x9f, 0xa7, 0x7d, 0xc5, 0x83, 0x0b, 0xb3, 0x29,
|
||||
0xb8, 0xf3, 0xba, 0x8a, 0xe4, 0x9c, 0x87, 0x61, 0xd1, 0x8d, 0x1c, 0x5a, 0xdf, 0x22, 0x9d, 0xa3,
|
||||
0x7f, 0x12, 0x76, 0xe2, 0xc0, 0x28, 0xfa, 0x75, 0xec, 0xa2, 0x13, 0x87, 0x3d, 0xb8, 0x0a, 0xa7,
|
||||
0x99, 0xe7, 0x35, 0x22, 0x3e, 0x5c, 0xab, 0x77, 0x9b, 0xa6, 0xdd, 0x5a, 0xf7, 0x88, 0x47, 0x8e,
|
||||
0xed, 0x64, 0x3f, 0x46, 0xf0, 0xda, 0xa1, 0x51, 0x42, 0x25, 0xd7, 0x0f, 0x36, 0xde, 0xf9, 0x04,
|
||||
0x29, 0x31, 0x27, 0x4c, 0xd5, 0xf1, 0x77, 0xdf, 0x2b, 0x30, 0xd2, 0x16, 0xa6, 0xed, 0xd3, 0x34,
|
||||
0x0a, 0x7d, 0x5b, 0x7a, 0xdd, 0x23, 0x63, 0xb9, 0x89, 0xde, 0xc2, 0x80, 0xc6, 0x5f, 0xe4, 0xcf,
|
||||
0xc5, 0x75, 0x5e, 0x23, 0x6e, 0x78, 0xd6, 0x9e, 0x47, 0x76, 0x7f, 0x41, 0x30, 0x79, 0x54, 0xa0,
|
||||
0x30, 0xc1, 0x1a, 0x0c, 0x06, 0x57, 0xcd, 0x24, 0xdd, 0x27, 0x39, 0xea, 0xe4, 0xd8, 0x12, 0xbd,
|
||||
0xf0, 0xef, 0x30, 0xf4, 0x31, 0x15, 0xf8, 0x3b, 0x04, 0xfd, 0x7c, 0x86, 0xc3, 0xa5, 0x04, 0x72,
|
||||
0xed, 0x43, 0xa4, 0xb4, 0x90, 0x05, 0xc2, 0x79, 0xc8, 0xc5, 0xaf, 0x7e, 0xfb, 0xfb, 0x9b, 0xdc,
|
||||
0x0c, 0x9e, 0x4a, 0x18, 0xa4, 0xf9, 0x44, 0x89, 0x7f, 0x42, 0x30, 0x18, 0x99, 0xf4, 0xf0, 0x62,
|
||||
0x9a, 0x90, 0xed, 0xe3, 0xa7, 0x74, 0x29, 0x33, 0x4e, 0xf0, 0x55, 0x18, 0xdf, 0x02, 0x9e, 0x4e,
|
||||
0xe0, 0x1b, 0xdc, 0x86, 0x9f, 0x11, 0x0c, 0x84, 0x57, 0x0f, 0x5f, 0x4c, 0x13, 0xb6, 0x6d, 0x3a,
|
||||
0x94, 0x16, 0xb3, 0xc2, 0x04, 0xd9, 0x0b, 0x8c, 0x6c, 0x11, 0xbf, 0x91, 0x8e, 0xac, 0x7a, 0xcf,
|
||||
0x34, 0xee, 0xe3, 0x5f, 0x11, 0x8c, 0x84, 0x8c, 0x83, 0x11, 0x0d, 0x5f, 0xc9, 0x42, 0x21, 0x36,
|
||||
0x4d, 0x4a, 0x4b, 0xdd, 0x40, 0x85, 0x82, 0xb7, 0x99, 0x82, 0xcb, 0x78, 0x31, 0x9d, 0x82, 0x62,
|
||||
0xa5, 0x55, 0xac, 0x50, 0xcb, 0x28, 0x9a, 0x06, 0x17, 0xf3, 0x3b, 0x82, 0x33, 0x47, 0x0c, 0x67,
|
||||
0x78, 0x39, 0x81, 0x5b, 0xf2, 0xf8, 0x27, 0x95, 0x9f, 0xc5, 0x45, 0xc6, 0x53, 0x25, 0xc6, 0x22,
|
||||
0xfc, 0x18, 0xc1, 0xf0, 0x81, 0x51, 0x05, 0x2f, 0xa5, 0x3d, 0xd2, 0xed, 0x73, 0x94, 0x74, 0xb5,
|
||||
0x2b, 0xac, 0x20, 0x3f, 0xc7, 0xc8, 0x4f, 0xe3, 0xc9, 0x34, 0xbf, 0x85, 0xf1, 0x0f, 0x08, 0xfa,
|
||||
0xd8, 0x30, 0x82, 0xe7, 0xd3, 0x04, 0x8d, 0x4e, 0x38, 0x52, 0x29, 0x03, 0x22, 0xe3, 0x15, 0xb8,
|
||||
0xe3, 0xa3, 0xd4, 0x7b, 0xfe, 0xd6, 0x7d, 0xfc, 0x3d, 0x82, 0x81, 0xfd, 0x89, 0xa4, 0x98, 0x2a,
|
||||
0x39, 0x81, 0xb9, 0x74, 0x31, 0x93, 0x79, 0xe6, 0x46, 0x58, 0x67, 0x48, 0xfc, 0x23, 0x02, 0x88,
|
||||
0xcc, 0x2d, 0x4a, 0xba, 0x3b, 0x16, 0xd8, 0xa7, 0xed, 0x28, 0x07, 0x47, 0x9e, 0x0c, 0xed, 0x8f,
|
||||
0x41, 0xf1, 0x36, 0x82, 0xd1, 0x8e, 0xf3, 0xcd, 0xe5, 0x34, 0x04, 0x3a, 0x21, 0xa5, 0x77, 0xba,
|
||||
0x45, 0x86, 0x22, 0xde, 0x64, 0x22, 0x14, 0x3c, 0x97, 0xaa, 0xa9, 0x14, 0x09, 0x73, 0xe1, 0xb7,
|
||||
0x92, 0x53, 0x87, 0xcd, 0x13, 0x57, 0x53, 0x72, 0xea, 0x04, 0x96, 0x56, 0x9e, 0x01, 0x1c, 0x6a,
|
||||
0xba, 0xc4, 0x34, 0x95, 0xb0, 0x9a, 0xa0, 0x29, 0x1c, 0xf8, 0x85, 0xac, 0xf2, 0xf5, 0xed, 0xdd,
|
||||
0x3c, 0x7a, 0xb2, 0x9b, 0x47, 0x7f, 0xed, 0xe6, 0xd1, 0xd7, 0x7b, 0xf9, 0x9e, 0x27, 0x7b, 0xf9,
|
||||
0x9e, 0x3f, 0xf6, 0xf2, 0x3d, 0x9f, 0xce, 0x47, 0x7e, 0xae, 0xb9, 0x9b, 0xba, 0xed, 0x98, 0x8e,
|
||||
0x4a, 0xdc, 0x4d, 0x62, 0x37, 0x4c, 0xcb, 0x55, 0xef, 0xc6, 0xdc, 0xb3, 0x1f, 0x6f, 0x95, 0x7e,
|
||||
0xf6, 0x2f, 0xa6, 0x0b, 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0x7c, 0xa9, 0x7f, 0x91, 0x5f, 0x13,
|
||||
0x00, 0x00,
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
|
@ -319,26 +319,19 @@ func local_request_Query_Whois_0(ctx context.Context, marshaler runtime.Marshale
|
||||
|
||||
}
|
||||
|
||||
var (
|
||||
filter_Query_LookupWrn_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
|
||||
)
|
||||
|
||||
func request_Query_LookupWrn_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryLookupWrn
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
var (
|
||||
val string
|
||||
ok bool
|
||||
err error
|
||||
_ = err
|
||||
)
|
||||
|
||||
val, ok = pathParams["wrn"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "wrn")
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
protoReq.Wrn, err = runtime.String(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "wrn", err)
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_LookupWrn_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := client.LookupWrn(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
@ -350,22 +343,11 @@ func local_request_Query_LookupWrn_0(ctx context.Context, marshaler runtime.Mars
|
||||
var protoReq QueryLookupWrn
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
var (
|
||||
val string
|
||||
ok bool
|
||||
err error
|
||||
_ = err
|
||||
)
|
||||
|
||||
val, ok = pathParams["wrn"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "wrn")
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
protoReq.Wrn, err = runtime.String(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "wrn", err)
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_LookupWrn_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := server.LookupWrn(ctx, &protoReq)
|
||||
@ -373,26 +355,19 @@ func local_request_Query_LookupWrn_0(ctx context.Context, marshaler runtime.Mars
|
||||
|
||||
}
|
||||
|
||||
var (
|
||||
filter_Query_ResolveWrn_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
|
||||
)
|
||||
|
||||
func request_Query_ResolveWrn_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryResolveWrn
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
var (
|
||||
val string
|
||||
ok bool
|
||||
err error
|
||||
_ = err
|
||||
)
|
||||
|
||||
val, ok = pathParams["wrn"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "wrn")
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
protoReq.Wrn, err = runtime.String(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "wrn", err)
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ResolveWrn_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := client.ResolveWrn(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
@ -404,22 +379,11 @@ func local_request_Query_ResolveWrn_0(ctx context.Context, marshaler runtime.Mar
|
||||
var protoReq QueryResolveWrn
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
var (
|
||||
val string
|
||||
ok bool
|
||||
err error
|
||||
_ = err
|
||||
)
|
||||
|
||||
val, ok = pathParams["wrn"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "wrn")
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
protoReq.Wrn, err = runtime.String(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "wrn", err)
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ResolveWrn_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := server.ResolveWrn(ctx, &protoReq)
|
||||
@ -990,27 +954,27 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
|
||||
}
|
||||
|
||||
var (
|
||||
pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"ethermint", "nameservice", "v1", "params"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"vulcanize", "nameservice", "v1beta1", "params"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
|
||||
pattern_Query_ListRecords_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"ethermint", "nameservice", "v1", "records"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
pattern_Query_ListRecords_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"vulcanize", "nameservice", "v1beta1", "records"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
|
||||
pattern_Query_GetRecord_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"ethermint", "nameservice", "v1", "records", "id"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
pattern_Query_GetRecord_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"vulcanize", "nameservice", "v1beta1", "records", "id"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
|
||||
pattern_Query_GetRecordByBondId_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"ethermint", "nameservice", "v1", "records-by-bond-id", "id"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
pattern_Query_GetRecordByBondId_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"vulcanize", "nameservice", "v1beta1", "records-by-bond-id", "id"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
|
||||
pattern_Query_GetNameServiceModuleBalance_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"ethermint", "nameservice", "v1", "balance"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
pattern_Query_GetNameServiceModuleBalance_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"vulcanize", "nameservice", "v1beta1", "balance"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
|
||||
pattern_Query_ListNameRecords_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"ethermint", "nameservice", "v1", "names"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
pattern_Query_ListNameRecords_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"vulcanize", "nameservice", "v1beta1", "names"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
|
||||
pattern_Query_Whois_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"ethermint", "nameservice", "v1", "whois", "name"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
pattern_Query_Whois_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"vulcanize", "nameservice", "v1beta1", "whois", "name"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
|
||||
pattern_Query_LookupWrn_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"ethermint", "nameservice", "v1", "lookup", "wrn"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
pattern_Query_LookupWrn_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"vulcanize", "nameservice", "v1beta1", "lookup"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
|
||||
pattern_Query_ResolveWrn_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"ethermint", "nameservice", "v1", "resolve", "wrn"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
pattern_Query_ResolveWrn_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"vulcanize", "nameservice", "v1beta1", "resolve"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
|
||||
pattern_Query_GetRecordExpiryQueue_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"ethermint", "nameservice", "v1", "record-expiry"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
pattern_Query_GetRecordExpiryQueue_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"vulcanize", "nameservice", "v1beta1", "record-expiry"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
|
||||
pattern_Query_GetAuthorityExpiryQueue_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"ethermint", "nameservice", "v1", "authority-expiry"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
pattern_Query_GetAuthorityExpiryQueue_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"vulcanize", "nameservice", "v1beta1", "authority-expiry"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
)
|
||||
|
||||
var (
|
||||
|
Loading…
Reference in New Issue
Block a user