@@ -5,11 +5,13 @@ import type Sigchain from '../../../sigchain/Sigchain';
55import type {
66 AgentRPCRequestParams ,
77 AgentRPCResponseResult ,
8- ClaimIdMessage ,
98 AgentClaimMessage ,
9+ NodesClaimsGetMessage ,
1010} from '../types' ;
1111import { ServerHandler } from '@matrixai/rpc' ;
1212import * as claimsUtils from '../../../claims/utils' ;
13+ import * as ids from '../../../ids' ;
14+
1315
1416/**
1517 * Gets the sigchain claims of a node
@@ -19,21 +21,29 @@ class NodesClaimsGet extends ServerHandler<
1921 sigchain : Sigchain ;
2022 db : DB ;
2123 } ,
22- AgentRPCRequestParams < ClaimIdMessage > ,
24+ AgentRPCRequestParams < NodesClaimsGetMessage > ,
2325 AgentRPCResponseResult < AgentClaimMessage >
2426> {
2527 public handle = async function * (
26- _input : ClaimIdMessage ,
28+ input : NodesClaimsGetMessage ,
2729 _cancel : ( reason ?: any ) => void ,
2830 _meta : Record < string , JSONValue > | undefined ,
2931 ctx : ContextTimed ,
3032 ) : AsyncGenerator < AgentRPCResponseResult < AgentClaimMessage > > {
33+ const { seek, order, limit } = input ;
3134 const { sigchain, db } : { sigchain : Sigchain ; db : DB } = this . container ;
35+
36+ const decodedClaimId = ids . decodeClaimId ( seek ) ;
37+
3238 yield * db . withTransactionG ( async function * ( tran ) : AsyncGenerator <
3339 AgentRPCResponseResult < AgentClaimMessage >
3440 > {
3541 for await ( const [ claimId , signedClaim ] of sigchain . getSignedClaims (
36- { order : 'asc' } ,
42+ {
43+ seek : decodedClaimId ,
44+ order : order ,
45+ limit : limit ,
46+ } ,
3747 tran ,
3848 ) ) {
3949 ctx . signal . throwIfAborted ( ) ;
0 commit comments