From 25fd5a4e4a8ee64e900b13ae40b7446638a4e5b9 Mon Sep 17 00:00:00 2001 From: IshaVenikar Date: Fri, 30 Aug 2024 09:47:36 +0530 Subject: [PATCH] Add pagination to list records CLI --- src/cmds/registry-cmds/record-cmds/list.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/cmds/registry-cmds/record-cmds/list.ts b/src/cmds/registry-cmds/record-cmds/list.ts index 4a0db44..33bdc1d 100644 --- a/src/cmds/registry-cmds/record-cmds/list.ts +++ b/src/cmds/registry-cmds/record-cmds/list.ts @@ -24,13 +24,23 @@ export const builder = { all: { type: 'boolean', default: false + }, + refs: { + type: 'boolean', + default: false + }, + limit: { + type: 'number' + }, + offset: { + type: 'number' } }; export const handler = async (argv: Arguments) => { const { services: { registry: registryConfig } } = getConfig(argv.config as string); const { rpcEndpoint, gqlEndpoint, chainId } = getConnectionInfo(argv, registryConfig); - const { type, name, bondId, owner, all } = argv; + const { type, name, bondId, owner, all, refs, limit, offset } = argv; const filters: any = {}; const filterArgs = argv._.slice(3); @@ -44,7 +54,7 @@ export const handler = async (argv: Arguments) => { const registry = new Registry(gqlEndpoint, rpcEndpoint, chainId); - let result = await registry.queryRecords({ ...filters, type, name }, all as boolean); + let result = await registry.queryRecords({ ...filters, type, name }, all as boolean, refs as boolean, limit as number, offset as number); // Apply ex post filters. if (bondId) {