laconicd/proto/cerc/registry/v1/query.proto
Prathamesh Musale ec6e2f3776 Add a query to list authorities (#42)
Part of [Add a CLI query to list all authorities with owner filter](cerc-io/laconicd#41)

Usage:
```bash
$ laconicd query registry list-authorities -h
List authorities (optionally by owner)
Usage:
  laconicd query registry list-authorities [flags]
Flags:
      --grpc-addr string   the gRPC endpoint to use for this chain
      --grpc-insecure      allow gRPC over insecure channels, if not the server must use TLS
      --height int         Use a specific height to query state at (this can error if the node is pruning state)
  -h, --help               help for list-authorities
      --no-indent          Do not indent JSON output
      --node string        <host>:<port> to CometBFT RPC interface for this chain (default "tcp://localhost:26657")
  -o, --output string      Output format (text|json) (default "text")
      --owner string       Owner to get the authorities for
```

Example:
```bash
# Without owner filter
$ laconicd query registry list-authorities
authorities:
- entry:
    expiry_time: "2024-07-26T06:54:28.491158167Z"
    height: "247"
    owner_address: laconic1e23vfttpvk045pqeydr4mujmlemx8hf9zjm7h2
    owner_public_key: A6RlTGLIpyA8nnEQN4V3sz3uaLMY0fHtB7aS7u1zTOdD
    status: active
  name: cerc
- entry:
    expiry_time: "2024-07-26T06:47:58.971429925Z"
    height: "118"
    owner_address: laconic10ztdu07xn7rracvzvehelgwvsytqlrvj6pvput
    owner_public_key: AvBxGIXBFmWCF+OHFwydqEtp2bfP+aimObO3teunbve7
    status: active
  name: laconic

# With owner filter
$ laconicd query registry list-authorities --owner laconic1e23vfttpvk045pqeydr4mujmlemx8hf9zjm7h2
authorities:
- entry:
    expiry_time: "2024-07-26T06:54:28.491158167Z"
    height: "247"
    owner_address: laconic1e23vfttpvk045pqeydr4mujmlemx8hf9zjm7h2
    owner_public_key: A6RlTGLIpyA8nnEQN4V3sz3uaLMY0fHtB7aS7u1zTOdD
    status: active
  name: cerc
```

Reviewed-on: cerc-io/laconicd#42
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
2024-07-24 09:14:39 +00:00

202 lines
6.8 KiB
Protocol Buffer

syntax = "proto3";
package cerc.registry.v1;
import "google/api/annotations.proto";
import "cosmos/base/query/v1beta1/pagination.proto";
import "gogoproto/gogo.proto";
import "cosmos/base/v1beta1/coin.proto";
import "cerc/registry/v1/registry.proto";
option go_package = "git.vdb.to/cerc-io/laconicd/x/registry";
// Query defines the gRPC querier service for registry module
service Query {
// Params queries the registry module params.
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
option (google.api.http).get = "/cerc/registry/v1/params";
}
// Records queries all records
rpc Records(QueryRecordsRequest) returns (QueryRecordsResponse) {
option (google.api.http).get = "/cerc/registry/v1/records";
}
// Get record by id
rpc GetRecord(QueryGetRecordRequest) returns (QueryGetRecordResponse) {
option (google.api.http).get = "/cerc/registry/v1/records/{id}";
}
// Get records by bond id
rpc GetRecordsByBondId(QueryGetRecordsByBondIdRequest)
returns (QueryGetRecordsByBondIdResponse) {
option (google.api.http).get = "/cerc/registry/v1/records-by-bond-id/{id}";
}
// NameRecords queries all name records
rpc NameRecords(QueryNameRecordsRequest) returns (QueryNameRecordsResponse) {
option (google.api.http).get = "/cerc/registry/v1/names";
}
// Whois method retrieve the name authority info
rpc Whois(QueryWhoisRequest) returns (QueryWhoisResponse) {
option (google.api.http).get = "/cerc/registry/v1/whois/{name}";
}
// LookupLrn
rpc LookupLrn(QueryLookupLrnRequest) returns (QueryLookupLrnResponse) {
option (google.api.http).get = "/cerc/registry/v1/lookup";
}
// ResolveLrn
rpc ResolveLrn(QueryResolveLrnRequest) returns (QueryResolveLrnResponse) {
option (google.api.http).get = "/cerc/registry/v1/resolve";
}
// Get registry module balance
rpc GetRegistryModuleBalance(QueryGetRegistryModuleBalanceRequest)
returns (QueryGetRegistryModuleBalanceResponse) {
option (google.api.http).get = "/cerc/registry/v1/balance";
}
// Authorities queries all authorities
rpc Authorities(QueryAuthoritiesRequest) returns (QueryAuthoritiesResponse) {
option (google.api.http).get = "/cerc/registry/v1/authorities";
}
}
// QueryParamsRequest is request type for registry params
message QueryParamsRequest {}
// QueryParamsResponse is response type for registry params
message QueryParamsResponse { Params params = 1; }
// QueryRecordsRequest is request type for registry records list
message QueryRecordsRequest {
// Array type attribute
message ArrayInput { repeated ValueInput values = 1; }
// Map type attribute
message MapInput { map<string, ValueInput> values = 1; }
// Type for record attribute value
message ValueInput {
// Value is one of the following types
oneof value {
string string = 1;
int64 int = 2;
double float = 3;
bool boolean = 4;
string link = 5;
ArrayInput array = 6;
MapInput map = 7;
}
}
// Type for record attribute key
message KeyValueInput {
string key = 1;
ValueInput value = 2;
}
repeated KeyValueInput attributes = 1;
bool all = 2;
// pagination defines an optional pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 3;
}
// QueryRecordsResponse is response type for registry records list
message QueryRecordsResponse {
repeated Record records = 1 [ (gogoproto.nullable) = false ];
// pagination defines the pagination in the response.
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}
// QueryGetRecordRequest is request type for registry records by id
message QueryGetRecordRequest { string id = 1; }
// QueryGetRecordResponse is response type for registry records by id
message QueryGetRecordResponse {
Record record = 1 [ (gogoproto.nullable) = false ];
}
// QueryGetRecordsByBondIdRequest is request type for get the records by bond-id
message QueryGetRecordsByBondIdRequest {
string id = 1;
// pagination defines an optional pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 2;
}
// QueryGetRecordsByBondIdResponse is response type for records list by bond-id
message QueryGetRecordsByBondIdResponse {
repeated Record records = 1 [ (gogoproto.nullable) = false ];
// pagination defines the pagination in the response.
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}
// QueryNameRecordsRequest is request type for registry names records
message QueryNameRecordsRequest {
// pagination defines an optional pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 1;
}
// QueryNameRecordsResponse is response type for registry names records
message QueryNameRecordsResponse {
repeated NameEntry names = 1 [ (gogoproto.nullable) = false ];
// pagination defines the pagination in the response.
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}
// QueryWhoisRequest is request type for Get NameAuthority
message QueryWhoisRequest { string name = 1; }
// QueryWhoisResponse is response type for whois request
message QueryWhoisResponse {
NameAuthority name_authority = 1 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "json:\"name_authority\" yaml:\"name_authority\""
];
}
// QueryAuthoritiesRequest is request type to get all authorities
message QueryAuthoritiesRequest { string owner = 1; }
// QueryAuthoritiesResponse is response type for authorities request
message QueryAuthoritiesResponse {
repeated AuthorityEntry authorities = 1 [ (gogoproto.nullable) = false ];
// pagination defines the pagination in the response.
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}
// QueryLookupLrnRequest is request type for LookupLrn
message QueryLookupLrnRequest { string lrn = 1; }
// QueryLookupLrnResponse is response type for QueryLookupLrnRequest
message QueryLookupLrnResponse { NameRecord name = 1; }
// QueryResolveLrnRequest is request type for ResolveLrn
message QueryResolveLrnRequest { string lrn = 1; }
// QueryResolveLrnResponse is response type for QueryResolveLrnRequest
message QueryResolveLrnResponse { Record record = 1; }
// QueryGetRegistryModuleBalanceRequest is request type for registry module
// accounts balance
message QueryGetRegistryModuleBalanceRequest {}
// QueryGetRegistryModuleBalanceResponse is response type for registry module
// accounts balance
message QueryGetRegistryModuleBalanceResponse {
repeated AccountBalance balances = 1;
}
// AccountBalance is registry module account balance
message AccountBalance {
string account_name = 1
[ (gogoproto.moretags) = "json:\"account_name\" yaml:\"account_name\"" ];
repeated cosmos.base.v1beta1.Coin balance = 3 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins",
(gogoproto.moretags) = "json:\"balance\" yaml:\"balance\""
];
}