Rename RPC method to reserve authority and fix proto lint errors (#17)

- Rename RPC method to reserve authority from `ReserveName` to `ReserveAuthority`
  and `GetBondsModuleBalance` to `GetBondModuleBalance`
- Run lint formatter
- Fix proto lint errors and regenerate proto bindings

Reviewed-on: deep-stack/laconic2d#17
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
This commit is contained in:
2024-03-07 11:25:15 +00:00
committed by ashwin
parent 33b6cce362
commit aed2d6d4c6
52 changed files with 3052 additions and 2979 deletions
+3 -3
View File
@@ -106,7 +106,7 @@ func (ets *E2ETestSuite) TestGetAuctionGrpc() {
sr.Contains(string(resp), tc.errorMsg)
} else {
sr.NoError(err)
var auction auctiontypes.QueryAuctionResponse
var auction auctiontypes.QueryGetAuctionResponse
err = val.ClientCtx.Codec.UnmarshalJSON(resp, &auction)
sr.NoError(err)
sr.Equal(auctionId, auction.Auction.Id)
@@ -151,7 +151,7 @@ func (ets *E2ETestSuite) TestGetBidsGrpc() {
sr.Contains(string(resp), tc.errorMsg)
} else {
sr.NoError(err)
var bids auctiontypes.QueryBidsResponse
var bids auctiontypes.QueryGetBidsResponse
err = val.ClientCtx.Codec.UnmarshalJSON(resp, &bids)
sr.NoError(err)
sr.Equal(auctionId, bids.Bids[0].AuctionId)
@@ -196,7 +196,7 @@ func (ets *E2ETestSuite) TestGetBidGrpc() {
sr.Contains(string(resp), tc.errorMsg)
} else {
sr.NoError(err)
var bid auctiontypes.QueryBidResponse
var bid auctiontypes.QueryGetBidResponse
err = val.ClientCtx.Codec.UnmarshalJSON(resp, &bid)
sr.NoError(err)
}
+1 -1
View File
@@ -58,7 +58,7 @@ func (ets *E2ETestSuite) TestGRPCGetBonds() {
if tc.expErr {
sr.Contains(string(resp), tc.errorMsg)
} else {
var response bondtypes.QueryGetBondsResponse
var response bondtypes.QueryBondsResponse
err := val.ClientCtx.Codec.UnmarshalJSON(resp, &response)
sr.NoError(err)
sr.NotZero(len(response.GetBonds()))
+1 -1
View File
@@ -40,7 +40,7 @@ func (ets *E2ETestSuite) TestGetQueryBondList() {
cmd := cli.GetQueryBondList()
out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args)
sr.NoError(err)
var queryResponse bondtypes.QueryGetBondsResponse
var queryResponse bondtypes.QueryBondsResponse
err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &queryResponse)
sr.NoError(err)
sr.NotZero(len(queryResponse.GetBonds()))
+1 -1
View File
@@ -113,7 +113,7 @@ func (ets *E2ETestSuite) createBond() string {
}
out, err = clitestutil.ExecTestCLICmd(clientCtx, cmd, args)
sr.NoError(err)
var queryResponse bondtypes.QueryGetBondsResponse
var queryResponse bondtypes.QueryBondsResponse
err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &queryResponse)
sr.NoError(err)
+2 -2
View File
@@ -263,7 +263,7 @@ func (ets *E2ETestSuite) TestGRPCQueryGetRecordById() {
if tc.expectErr {
require.Contains(string(resp), tc.errorMsg)
} else {
var response registrytypes.QueryRecordByIdResponse
var response registrytypes.QueryGetRecordResponse
err := val.ClientCtx.Codec.UnmarshalJSON(resp, &response)
sr.NoError(err)
record := response.GetRecord()
@@ -317,7 +317,7 @@ func (ets *E2ETestSuite) TestGRPCQueryGetRecordByBondId() {
if tc.expectErr {
require.Contains(string(resp), tc.errorMsg)
} else {
var response registrytypes.QueryRecordsByBondIdResponse
var response registrytypes.QueryGetRecordsByBondIdResponse
err := val.ClientCtx.Codec.UnmarshalJSON(resp, &response)
sr.NoError(err)
records := response.GetRecords()
+3 -3
View File
@@ -132,7 +132,7 @@ func (ets *E2ETestSuite) createBond() string {
}
out, err = clitestutil.ExecTestCLICmd(clientCtx, cmd, args)
sr.NoError(err)
var queryResponse bondtypes.QueryGetBondsResponse
var queryResponse bondtypes.QueryBondsResponse
err = val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &queryResponse)
sr.NoError(err)
@@ -146,7 +146,7 @@ func (ets *E2ETestSuite) reserveName(authorityName string) {
sr := ets.Require()
clientCtx := val.ClientCtx
cmd := cli.GetCmdReserveName()
cmd := cli.GetCmdReserveAuthority()
args := []string{
authorityName,
fmt.Sprintf("--owner=%s", ets.accountAddress),
@@ -174,7 +174,7 @@ func (ets *E2ETestSuite) createNameRecord(authorityName string) {
// reserving the name
clientCtx := val.ClientCtx
cmd := cli.GetCmdReserveName()
cmd := cli.GetCmdReserveAuthority()
args := []string{
authorityName,
fmt.Sprintf("--owner=%s", ets.accountAddress),
@@ -35,17 +35,17 @@ func (kts *KeeperTestSuite) TestGrpcQueryParams() {
func (kts *KeeperTestSuite) TestGrpcGetAuction() {
testCases := []struct {
msg string
req *types.QueryAuctionRequest
req *types.QueryGetAuctionRequest
createAuction bool
}{
{
"fetch auction with empty auction ID",
&types.QueryAuctionRequest{},
&types.QueryGetAuctionRequest{},
false,
},
{
"fetch auction with valid auction ID",
&types.QueryAuctionRequest{},
&types.QueryGetAuctionRequest{},
true,
},
}
@@ -111,28 +111,28 @@ func (kts *KeeperTestSuite) TestGrpcGetAllAuctions() {
func (kts *KeeperTestSuite) TestGrpcGetBids() {
testCases := []struct {
msg string
req *types.QueryBidsRequest
req *types.QueryGetBidsRequest
createAuction bool
commitBid bool
bidCount int
}{
{
"fetch all bids when no auction exists",
&types.QueryBidsRequest{},
&types.QueryGetBidsRequest{},
false,
false,
0,
},
{
"fetch all bids for valid auction but no added bids",
&types.QueryBidsRequest{},
&types.QueryGetBidsRequest{},
true,
false,
0,
},
{
"fetch all bids for valid auction and valid bid",
&types.QueryBidsRequest{},
&types.QueryGetBidsRequest{},
true,
true,
1,
@@ -162,17 +162,17 @@ func (kts *KeeperTestSuite) TestGrpcGetBids() {
func (kts *KeeperTestSuite) TestGrpcGetBid() {
testCases := []struct {
msg string
req *types.QueryBidRequest
req *types.QueryGetBidRequest
createAuctionAndBid bool
}{
{
"fetch bid when bid does not exist",
&types.QueryBidRequest{},
&types.QueryGetBidRequest{},
false,
},
{
"fetch bid when valid bid exists",
&types.QueryBidRequest{},
&types.QueryGetBidRequest{},
true,
},
}
@@ -34,22 +34,22 @@ func (kts *KeeperTestSuite) TestGrpcQueryParams() {
func (kts *KeeperTestSuite) TestGrpcQueryBondsList() {
testCases := []struct {
msg string
req *types.QueryGetBondsRequest
resp *types.QueryGetBondsResponse
req *types.QueryBondsRequest
resp *types.QueryBondsResponse
noOfBonds int
createBonds bool
}{
{
"empty request",
&types.QueryGetBondsRequest{},
&types.QueryGetBondsResponse{},
&types.QueryBondsRequest{},
&types.QueryBondsResponse{},
0,
false,
},
{
"Get Bonds",
&types.QueryGetBondsRequest{},
&types.QueryGetBondsResponse{},
&types.QueryBondsRequest{},
&types.QueryBondsResponse{},
1,
true,
},
@@ -181,7 +181,7 @@ func (kts *KeeperTestSuite) TestGrpcGetModuleBalance() {
_, err := kts.createBond()
kts.Require().NoError(err)
}
resp, err := kts.queryClient.GetBondsModuleBalance(context.Background(), test.req)
resp, err := kts.queryClient.GetBondModuleBalance(context.Background(), test.req)
if !test.errResponse {
kts.Require().Nil(err)
kts.Require().NotNil(resp.GetBalance())
@@ -228,21 +228,21 @@ func (kts *KeeperTestSuite) TestGrpcGetRecordLists() {
// Get the records by record id
testCases1 := []struct {
msg string
req *types.QueryRecordByIdRequest
req *types.QueryGetRecordRequest
createRecord bool
expErr bool
noOfRecords int
}{
{
"Invalid Request without record id",
&types.QueryRecordByIdRequest{},
&types.QueryGetRecordRequest{},
false,
true,
0,
},
{
"With Record ID",
&types.QueryRecordByIdRequest{
&types.QueryGetRecordRequest{
Id: recordId,
},
true,
@@ -270,21 +270,21 @@ func (kts *KeeperTestSuite) TestGrpcGetRecordLists() {
// Get the records by record id
testCasesByBondId := []struct {
msg string
req *types.QueryRecordsByBondIdRequest
req *types.QueryGetRecordsByBondIdRequest
createRecord bool
expErr bool
noOfRecords int
}{
{
"Invalid Request without bond id",
&types.QueryRecordsByBondIdRequest{},
&types.QueryGetRecordsByBondIdRequest{},
false,
true,
0,
},
{
"With Bond ID",
&types.QueryRecordsByBondIdRequest{
&types.QueryGetRecordsByBondIdRequest{
Id: kts.bond.GetId(),
},
true,