Skip to content
This repository has been archived by the owner on Oct 24, 2024. It is now read-only.

Commit

Permalink
rename query name
Browse files Browse the repository at this point in the history
  • Loading branch information
taryune committed Sep 14, 2023
1 parent 680fc48 commit a254c1e
Show file tree
Hide file tree
Showing 6 changed files with 125 additions and 126 deletions.
6 changes: 3 additions & 3 deletions docs/static/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50733,7 +50733,7 @@ paths:
additionalProperties: {}
tags:
- Query
/mycel-domain/mycel/resolver/query_wallet_record/{domainName}/{domainParent}/{networkName}:
/mycel-domain/mycel/resolver/wallet_record/{domainName}/{domainParent}/{walletRecordType}:
get:
summary: Queries a list of QueryWalletRecord items.
operationId: MycelResolverQueryWalletRecord
Expand Down Expand Up @@ -50824,7 +50824,7 @@ paths:
in: path
required: true
type: string
- name: networkName
- name: walletRecordType
in: path
required: true
type: string
Expand Down Expand Up @@ -81642,7 +81642,7 @@ definitions:
description: params holds all the parameters of this module.
type: object
description: QueryParamsResponse is response type for the Query/Params RPC method.
mycel.resolver.QueryQueryWalletRecordResponse:
mycel.resolver.QueryWalletRecordResponse:
type: object
properties:
value:
Expand Down
10 changes: 5 additions & 5 deletions proto/mycel/resolver/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ service Query {
}

// Queries a list of QueryWalletRecord items.
rpc QueryWalletRecord (QueryQueryWalletRecordRequest) returns (QueryQueryWalletRecordResponse) {
option (google.api.http).get = "/mycel-domain/mycel/resolver/query_wallet_record/{domainName}/{domainParent}/{networkName}";
rpc QueryWalletRecord (QueryWalletRecordRequest) returns (QueryWalletRecordResponse) {
option (google.api.http).get = "/mycel-domain/mycel/resolver/wallet_record/{domainName}/{domainParent}/{walletRecordType}";

}
}
Expand All @@ -35,13 +35,13 @@ message QueryParamsResponse {
Params params = 1 [(gogoproto.nullable) = false];
}

message QueryQueryWalletRecordRequest {
message QueryWalletRecordRequest {
string domainName = 1;
string domainParent = 2;
string networkName = 3;
string walletRecordType = 3;
}

message QueryQueryWalletRecordResponse {
message QueryWalletRecordResponse {
mycel.registry.WalletRecord value = 1;
}

Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ var _ = strconv.Itoa(0)

func CmdQueryWalletRecord() *cobra.Command {
cmd := &cobra.Command{
Use: "query-wallet-record [domain-name] [domain-parent] [network-name]",
Short: "Query queryWalletRecord",
Use: "wallet-record [domain-name] [domain-parent] [wallet-record-type]",
Short: "Query wallet record",
Args: cobra.ExactArgs(3),
RunE: func(cmd *cobra.Command, args []string) (err error) {
reqDomainName := args[0]
reqDomainParent := args[1]
reqNetworkName := args[2]
reqWalletRecordType := args[2]

clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
Expand All @@ -28,11 +28,11 @@ func CmdQueryWalletRecord() *cobra.Command {

queryClient := types.NewQueryClient(clientCtx)

params := &types.QueryQueryWalletRecordRequest{
params := &types.QueryWalletRecordRequest{

DomainName: reqDomainName,
DomainParent: reqDomainParent,
NetworkName: reqNetworkName,
WalletRecordType: reqWalletRecordType,
}

res, err := queryClient.QueryWalletRecord(cmd.Context(), params)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,20 @@ import (
registrytypes "github.com/mycel-domain/mycel/x/registry/types"
)

func (k Keeper) QueryWalletRecord(goCtx context.Context, req *types.QueryQueryWalletRecordRequest) (*types.QueryQueryWalletRecordResponse, error) {
func (k Keeper) QueryWalletRecord(goCtx context.Context, req *types.QueryWalletRecordRequest) (*types.QueryWalletRecordResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}

ctx := sdk.UnwrapSDKContext(goCtx)

// Validate request parameters
walletAddressFormat, err := registrytypes.GetWalletAddressFormat(req.NetworkName)
_, err := registrytypes.GetWalletAddressFormat(req.WalletRecordType)
if err != nil {
return nil, err
}
_ = walletAddressFormat

// TODO: Query domain QueryWalletRecord
// Query domain QueryWalletRecord
_, err = k.registryKeeper.GetValidTopLevelDomain(ctx, req.DomainParent)
if err != nil {
return nil, err
Expand All @@ -35,5 +34,5 @@ func (k Keeper) QueryWalletRecord(goCtx context.Context, req *types.QueryQueryWa
return nil, err
}

return &types.QueryQueryWalletRecordResponse{Value: secondLevelDomain.WalletRecords[req.NetworkName]}, nil
return &types.QueryWalletRecordResponse{Value: secondLevelDomain.WalletRecords[req.WalletRecordType]}, nil
}
Loading

0 comments on commit a254c1e

Please sign in to comment.