Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/mocknet-testing' into mocknet-te…
Browse files Browse the repository at this point in the history
…sting
  • Loading branch information
kingpinXD committed Sep 21, 2023
2 parents 83c7867 + cf24d77 commit a35e398
Show file tree
Hide file tree
Showing 5 changed files with 734 additions and 210 deletions.
25 changes: 25 additions & 0 deletions docs/openapi/openapi.swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27213,6 +27213,26 @@ paths:
$ref: '#/definitions/googlerpcStatus'
tags:
- Query
/zeta-chain/crosschain/pendingNonces/{chain_id}:
get:
operationId: Query_PendingNoncesByChain
responses:
"200":
description: A successful response.
schema:
$ref: '#/definitions/crosschainQueryPendingNoncesByChainResponse'
default:
description: An unexpected error response.
schema:
$ref: '#/definitions/googlerpcStatus'
parameters:
- name: chain_id
in: path
required: true
type: string
format: uint64
tags:
- Query
/zeta-chain/crosschain/protocolFee:
get:
operationId: Query_ProtocolFee
Expand Down Expand Up @@ -50660,6 +50680,11 @@ definitions:
properties:
feeInZeta:
type: string
crosschainQueryPendingNoncesByChainResponse:
type: object
properties:
pending_nonces:
$ref: '#/definitions/crosschainPendingNonces'
crosschainQueryTssHistoryResponse:
type: object
properties:
Expand Down
12 changes: 12 additions & 0 deletions proto/crosschain/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ service Query {
option (google.api.http).get = "/zeta-chain/crosschain/pendingNonces";
}

rpc PendingNoncesByChain(QueryPendingNoncesByChainRequest) returns (QueryPendingNoncesByChainResponse) {
option (google.api.http).get = "/zeta-chain/crosschain/pendingNonces/{chain_id}";
}

// Queries a lastBlockHeight by index.
rpc LastBlockHeight(QueryGetLastBlockHeightRequest) returns (QueryGetLastBlockHeightResponse) {
option (google.api.http).get = "/zeta-chain/crosschain/lastBlockHeight/{index}";
Expand Down Expand Up @@ -253,6 +257,14 @@ message QueryAllPendingNoncesResponse {
repeated PendingNonces pending_nonces = 1;
}

message QueryPendingNoncesByChainRequest {
uint64 chain_id = 1;
}

message QueryPendingNoncesByChainResponse {
PendingNonces pending_nonces = 1 [(gogoproto.nullable) = false];
}

message QueryGetLastBlockHeightRequest {
string index = 1;
}
Expand Down
20 changes: 20 additions & 0 deletions x/crosschain/keeper/keeper_pending_nonces.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,23 @@ func (k Keeper) PendingNoncesAll(c context.Context, req *types.QueryAllPendingNo
PendingNonces: list,
}, nil
}

func (k Keeper) PendingNoncesByChain(c context.Context, req *types.QueryPendingNoncesByChainRequest) (*types.QueryPendingNoncesByChainResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}

ctx := sdk.UnwrapSDKContext(c)
tss, found := k.GetTSS(ctx)
if !found {
return nil, status.Error(codes.NotFound, "tss not found")
}
list, found := k.GetPendingNonces(ctx, tss.TssPubkey, req.ChainId)
if !found {
return nil, status.Error(codes.NotFound, fmt.Sprintf("pending nonces not found for chain id : %d", req.ChainId))
}

return &types.QueryPendingNoncesByChainResponse{
PendingNonces: list,
}, nil
}
Loading

0 comments on commit a35e398

Please sign in to comment.