Skip to content

Commit

Permalink
feat: Change name queryService to query in proto and add pnft genesis…
Browse files Browse the repository at this point in the history
… feature (#676)
  • Loading branch information
gyuguen authored Mar 12, 2024
1 parent f1c7ba5 commit c63aafd
Show file tree
Hide file tree
Showing 43 changed files with 1,471 additions and 1,355 deletions.
34 changes: 17 additions & 17 deletions proto/panacea/aol/v2/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -10,90 +10,90 @@ import "panacea/aol/v2/topic.proto";
option java_multiple_files = true;
option go_package = "github.com/medibloc/panacea-core/x/aol/types";

// QueryService defines the gRPC querier service.
service QueryService {
// Query defines the gRPC querier service.
service Query {
// Topic returns topic details.
rpc Topic(QueryServiceTopicRequest) returns (QueryServiceTopicResponse) {
rpc Topic(QueryTopicRequest) returns (QueryTopicResponse) {
option (google.api.http).get =
"/panacea/aol/v2/owners/{owner_address}/topics/{topic_name}";
}

// Topics returns topic names.
rpc Topics(QueryServiceTopicsRequest) returns (QueryServiceTopicsResponse) {
rpc Topics(QueryTopicsRequest) returns (QueryTopicsResponse) {
option (google.api.http).get =
"/panacea/aol/v2/owners/{owner_address}/topics";
}

// Writer returns writer details.
rpc Writer(QueryServiceWriterRequest) returns (QueryServiceWriterResponse) {
rpc Writer(QueryWriterRequest) returns (QueryWriterResponse) {
option (google.api.http).get =
"/panacea/aol/v2/owners/{owner_address}/topics/{topic_name}/writers/"
"{writer_address}";
}

// Writers returns writer addresses.
rpc Writers(QueryServiceWritersRequest) returns (QueryServiceWritersResponse) {
rpc Writers(QueryWritersRequest) returns (QueryWritersResponse) {
option (google.api.http).get =
"/panacea/aol/v2/owners/{owner_address}/topics/{topic_name}/writers";
}

// Record returns record details.
rpc Record(QueryServiceRecordRequest) returns (QueryServiceRecordResponse) {
rpc Record(QueryRecordRequest) returns (QueryRecordResponse) {
option (google.api.http).get = "/panacea/aol/v2/owners/{owner_address}/"
"topics/{topic_name}/records/{offset}";
}
}

// QueryTopicRequest is the request type for the Query/Topic RPC method.
message QueryServiceTopicRequest {
message QueryTopicRequest {
string owner_address = 1;
string topic_name = 2;
}

// QueryTopicResponse is the response type for the Query/Topic RPC method.
message QueryServiceTopicResponse { Topic topic = 1; }
message QueryTopicResponse { Topic topic = 1; }

// QueryTopicsRequest is the request type for the Query/Topics RPC method.
message QueryServiceTopicsRequest {
message QueryTopicsRequest {
string owner_address = 1;
cosmos.base.query.v1beta1.PageRequest pagination = 2;
}

// QueryTopicsResponse is the response type for the Query/Topics RPC method.
message QueryServiceTopicsResponse {
message QueryTopicsResponse {
repeated string topic_names = 1;
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}

// QueryWriterRequest is the request type for the Query/Writer RPC method.
message QueryServiceWriterRequest {
message QueryWriterRequest {
string owner_address = 1;
string topic_name = 2;
string writer_address = 3;
}

// QueryWriterResponse is the response type for the Query/Writer RPC method.
message QueryServiceWriterResponse { Writer writer = 1; }
message QueryWriterResponse { Writer writer = 1; }

// QueryWritersRequest is the request type for the Query/Writers RPC method.
message QueryServiceWritersRequest {
message QueryWritersRequest {
string owner_address = 1;
string topic_name = 2;
cosmos.base.query.v1beta1.PageRequest pagination = 3;
}

// QueryWritersResponse is the response type for the Query/Writers RPC method.
message QueryServiceWritersResponse {
message QueryWritersResponse {
repeated string writer_addresses = 1;
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}

// QueryRecordRequest is the request type for the Query/Record RPC method.
message QueryServiceRecordRequest {
message QueryRecordRequest {
string owner_address = 1;
string topic_name = 2;
uint64 offset = 3;
}

// QueryRecordResponse is the response type for the Query/Record RPC method.
message QueryServiceRecordResponse { Record record = 1; }
message QueryRecordResponse { Record record = 1; }
2 changes: 1 addition & 1 deletion proto/panacea/burn/v2/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ option java_multiple_files = true;
option go_package = "github.com/medibloc/panacea-core/x/burn/types";

// Query defines the gRPC querier service.
service QueryService {}
service Query {}
8 changes: 4 additions & 4 deletions proto/panacea/did/v2/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ option java_multiple_files = true;
option go_package = "github.com/medibloc/panacea-core/x/did/types";

// Query defines the gRPC querier service.
service QueryService {
service Query {
// DID returns a DID Document with a sequence number.
rpc DID(QueryServiceDIDRequest) returns (QueryServiceDIDResponse) {
rpc DID(QueryDIDRequest) returns (QueryDIDResponse) {
option (google.api.http).get = "/panacea/did/v2/dids/{did_base64}";
}
}

// QueryDIDRequest is the request type for the Query/DIDDocumentWithSeq RPC
// method.
message QueryServiceDIDRequest {
message QueryDIDRequest {
// NOTE: Using base64 due to the URI path cannot contain colons.
string did_base64 = 1;
}

// QueryDIDResponse is the response type for the Query/DIDDocumentWithSeq RPC
// method.
message QueryServiceDIDResponse { DIDDocumentWithSeq did_document_with_seq = 1; }
message QueryDIDResponse { DIDDocumentWithSeq did_document_with_seq = 1; }
2 changes: 2 additions & 0 deletions proto/panacea/pnft/v2/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ syntax = "proto3";
package panacea.pnft.v2;

import "panacea/pnft/v2/denom.proto";
import "panacea/pnft/v2/pnft.proto";

option go_package = "github.com/medibloc/panacea-core/x/pnft/types";
option java_multiple_files = true;

// GenesisState defines the nft module's genesis state.
message GenesisState {
repeated panacea.pnft.v2.Denom denoms = 1;
repeated panacea.pnft.v2.Pnft pnfts = 2;
}
2 changes: 1 addition & 1 deletion proto/panacea/pnft/v2/pnft.proto
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ option go_package = "github.com/medibloc/panacea-core/x/pnft/types";
option java_multiple_files = true;


message PNFT {
message Pnft {
string denom_id = 1;
string id = 2;
string name = 3;
Expand Down
70 changes: 35 additions & 35 deletions proto/panacea/pnft/v2/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -9,98 +9,98 @@ import "panacea/pnft/v2/pnft.proto";
option java_multiple_files = true;
option go_package = "github.com/medibloc/panacea-core/x/pnft/types";

// QueryService defines the gRPC querier service.
service QueryService {
// Query defines the gRPC querier service.
service Query {
// Denoms returns denom list.
rpc Denoms(QueryServiceDenomsRequest) returns (QueryServiceDenomsResponse) {
rpc Denoms(QueryDenomsRequest) returns (QueryDenomsResponse) {
option (google.api.http).get =
"/panacea/pnft/v2/denoms";
}

rpc DenomsByOwner(QueryServiceDenomsByOwnerRequest) returns (QueryServiceDenomsByOwnerResponse) {
rpc DenomsByOwner(QueryDenomsByOwnerRequest) returns (QueryDenomsByOwnerResponse) {
option (google.api.http).get =
"/panacea/pnft/v2/denoms/owners/{owner}";
}

// Denom returns denom detail.
rpc Denom(QueryServiceDenomRequest) returns (QueryServiceDenomResponse) {
rpc Denom(QueryDenomRequest) returns (QueryDenomResponse) {
option (google.api.http).get =
"/panacea/pnft/v2/denoms/{id}";
}

rpc PNFTs(QueryServicePNFTsRequest) returns (QueryServicePNFTsResponse) {
rpc PNFTs(QueryPNFTsRequest) returns (QueryPNFTsResponse) {
option (google.api.http).get = "/panacea/pnft/v2/denoms/{denom_id}/pnfts";
}

rpc PNFTsByDenomOwner(QueryServicePNFTsByDenomOwnerRequest) returns (QueryServicePNFTsByDenomOwnerResponse) {
rpc PNFTsByDenomOwner(QueryPNFTsByDenomOwnerRequest) returns (QueryPNFTsByDenomOwnerResponse) {
option (google.api.http).get = "/panacea/pnft/v2/denoms/{denom_id}/owners/{owner}/pnfts";
}


rpc PNFT(QueryServicePNFTRequest) returns (QueryServicePNFTResponse) {
rpc PNFT(QueryPNFTRequest) returns (QueryPNFTResponse) {
option (google.api.http).get = "/panacea/pnft/v2/denoms/{denom_id}/pnfts/{id}";
}
}

// QueryServiceDenomsRequest is the response type for the Query RPC method.
message QueryServiceDenomsRequest {
// QueryDenomsRequest is the response type for the Query RPC method.
message QueryDenomsRequest {
cosmos.base.query.v1beta1.PageRequest pagination = 2;
}

// QueryServiceDenomsResponse is the response type for the Query RPC method.
message QueryServiceDenomsResponse {
// QueryDenomsResponse is the response type for the Query RPC method.
message QueryDenomsResponse {
repeated panacea.pnft.v2.Denom denoms = 1;
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}

// QueryServiceDenomsByOwnerRequest is the response type for the Query RPC method.
message QueryServiceDenomsByOwnerRequest {
// QueryDenomsByOwnerRequest is the response type for the Query RPC method.
message QueryDenomsByOwnerRequest {
string owner = 1;
}

// QueryServiceDenomsByOwnerResponse is the response type for the Query RPC method.
message QueryServiceDenomsByOwnerResponse {
// QueryDenomsByOwnerResponse is the response type for the Query RPC method.
message QueryDenomsByOwnerResponse {
repeated panacea.pnft.v2.Denom denoms = 1;
}

// QueryServiceDenomRequest is the response type for the Query RPC method.
message QueryServiceDenomRequest {
// QueryDenomRequest is the response type for the Query RPC method.
message QueryDenomRequest {
string id = 1;
}

// QueryServiceDenomResponse is the response type for the Query RPC method.
message QueryServiceDenomResponse {
// QueryDenomResponse is the response type for the Query RPC method.
message QueryDenomResponse {
panacea.pnft.v2.Denom denom = 1;
}

// QueryServicePNFTsRequest is the response type for the Query RPC method.
message QueryServicePNFTsRequest {
// QueryPNFTsRequest is the response type for the Query RPC method.
message QueryPNFTsRequest {
string denom_id = 1;
}

// QueryServicePNFTsResponse is the response type for the Query RPC method.
message QueryServicePNFTsResponse {
repeated panacea.pnft.v2.PNFT pnfts = 1;
// QueryPNFTsResponse is the response type for the Query RPC method.
message QueryPNFTsResponse {
repeated panacea.pnft.v2.Pnft pnfts = 1;
}

// QueryServicePNFTsRequest is the response type for the Query RPC method.
message QueryServicePNFTsByDenomOwnerRequest {
// QueryPNFTsRequest is the response type for the Query RPC method.
message QueryPNFTsByDenomOwnerRequest {
string denom_id = 1;
string owner = 2;
}

// QueryServicePNFTsResponse is the response type for the Query RPC method.
message QueryServicePNFTsByDenomOwnerResponse {
repeated panacea.pnft.v2.PNFT pnfts = 1;
// QueryPNFTsResponse is the response type for the Query RPC method.
message QueryPNFTsByDenomOwnerResponse {
repeated panacea.pnft.v2.Pnft pnfts = 1;
}

// QueryServicePNFTRequest is the response type for the Query RPC method.
message QueryServicePNFTRequest {
// QueryPNFTRequest is the response type for the Query RPC method.
message QueryPNFTRequest {
string denom_id = 1;
string id = 2;
}

// QueryServicePNFTResponse is the response type for the Query RPC method.
message QueryServicePNFTResponse {
panacea.pnft.v2.PNFT pnft = 1;
// QueryPNFTResponse is the response type for the Query RPC method.
message QueryPNFTResponse {
panacea.pnft.v2.Pnft pnft = 1;
}
2 changes: 0 additions & 2 deletions proto/panacea/pnft/v2/tx.proto
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
syntax = "proto3";
package panacea.pnft.v2;

import "panacea/pnft/v2/pnft.proto";

option go_package = "github.com/medibloc/panacea-core/x/pnft/types";
option java_multiple_files = true;

Expand Down
4 changes: 2 additions & 2 deletions x/aol/client/cli/queryRecord.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ func CmdGetRecord() *cobra.Command {
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)

queryClient := types.NewQueryServiceClient(clientCtx)
queryClient := types.NewQueryClient(clientCtx)

offset, err := strconv.ParseUint(args[2], 10, 64)
if err != nil {
return err
}

params := &types.QueryServiceRecordRequest{
params := &types.QueryRecordRequest{
OwnerAddress: args[0],
TopicName: args[1],
Offset: offset,
Expand Down
8 changes: 4 additions & 4 deletions x/aol/client/cli/queryTopic.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ func CmdGetTopic() *cobra.Command {
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)

queryClient := types.NewQueryServiceClient(clientCtx)
queryClient := types.NewQueryClient(clientCtx)

params := &types.QueryServiceTopicRequest{
params := &types.QueryTopicRequest{
OwnerAddress: args[0],
TopicName: args[1],
}
Expand Down Expand Up @@ -51,9 +51,9 @@ func CmdListTopics() *cobra.Command {
return err
}

queryClient := types.NewQueryServiceClient(clientCtx)
queryClient := types.NewQueryClient(clientCtx)

params := &types.QueryServiceTopicsRequest{
params := &types.QueryTopicsRequest{
OwnerAddress: args[0],
Pagination: pageReq,
}
Expand Down
8 changes: 4 additions & 4 deletions x/aol/client/cli/queryWriter.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ func CmdGetWriter() *cobra.Command {
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)

queryClient := types.NewQueryServiceClient(clientCtx)
queryClient := types.NewQueryClient(clientCtx)

params := &types.QueryServiceWriterRequest{
params := &types.QueryWriterRequest{
OwnerAddress: args[0],
TopicName: args[1],
WriterAddress: args[2],
Expand Down Expand Up @@ -52,9 +52,9 @@ func CmdListWriters() *cobra.Command {
return err
}

queryClient := types.NewQueryServiceClient(clientCtx)
queryClient := types.NewQueryClient(clientCtx)

params := &types.QueryServiceWritersRequest{
params := &types.QueryWritersRequest{
OwnerAddress: args[0],
TopicName: args[1],
Pagination: pageReq,
Expand Down
2 changes: 1 addition & 1 deletion x/aol/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ import (
"github.com/medibloc/panacea-core/v2/x/aol/types"
)

var _ types.QueryServiceServer = Keeper{}
var _ types.QueryServer = Keeper{}
4 changes: 2 additions & 2 deletions x/aol/keeper/grpc_query_record.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"google.golang.org/grpc/status"
)

func (k Keeper) Record(c context.Context, req *types.QueryServiceRecordRequest) (*types.QueryServiceRecordResponse, error) {
func (k Keeper) Record(c context.Context, req *types.QueryRecordRequest) (*types.QueryRecordResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
Expand All @@ -27,5 +27,5 @@ func (k Keeper) Record(c context.Context, req *types.QueryServiceRecordRequest)
}

record := k.GetRecord(ctx, recordKey)
return &types.QueryServiceRecordResponse{Record: &record}, nil
return &types.QueryRecordResponse{Record: &record}, nil
}
Loading

0 comments on commit c63aafd

Please sign in to comment.