From 25fd5a4e4a8ee64e900b13ae40b7446638a4e5b9 Mon Sep 17 00:00:00 2001 From: IshaVenikar Date: Fri, 30 Aug 2024 09:47:36 +0530 Subject: [PATCH 1/3] 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) { -- 2.45.2 From 30d152c57d28a21dece0a40c7746d72a4e167eb7 Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Thu, 5 Sep 2024 18:53:47 +0530 Subject: [PATCH 2/3] Update bond list CLI for owner filter --- package.json | 2 +- src/cmds/registry-cmds/bond-cmds/list.ts | 9 ++++++++- yarn.lock | 8 ++++---- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 0e5d681..725dc0f 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "typescript": "^4.6.3" }, "dependencies": { - "@cerc-io/registry-sdk": "^0.2.6", + "@cerc-io/registry-sdk": "^0.2.8", "fs-extra": "^10.1.0", "js-yaml": "^3.14.1", "lodash": "^4.17.21", diff --git a/src/cmds/registry-cmds/bond-cmds/list.ts b/src/cmds/registry-cmds/bond-cmds/list.ts index edc36de..d7c7e66 100644 --- a/src/cmds/registry-cmds/bond-cmds/list.ts +++ b/src/cmds/registry-cmds/bond-cmds/list.ts @@ -23,8 +23,15 @@ export const handler = async (argv: Arguments) => { const registry = new Registry(gqlEndpoint, rpcEndpoint, chainId); + let result: any; + const { owner } = argv; - const result = await registry.queryBonds({ owner }); + if (owner) { + const [bondsByOwnerResult] = await registry.queryBondsByOwner([String(owner)]); + result = bondsByOwnerResult.bonds; + } else { + result = await registry.queryBonds(); + } queryOutput(result, argv.output); }; diff --git a/yarn.lock b/yarn.lock index 62ac42b..aee5e1e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -302,10 +302,10 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@cerc-io/registry-sdk@^0.2.6": - version "0.2.6" - resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fregistry-sdk/-/0.2.6/registry-sdk-0.2.6.tgz#af8a5844bdb742a01d322a9d93ace90d35aad37e" - integrity sha512-Z2rneeoPLTJk9aBTqMrR9WPKfPQZhNWShI4IYOb7kzoIorp3eD8mEals0I5bVjzStjapw/5RKf8lVnDCX9I4iA== +"@cerc-io/registry-sdk@^0.2.8": + version "0.2.8" + resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fregistry-sdk/-/0.2.8/registry-sdk-0.2.8.tgz#d71837f735d998987055068457fdf8b2e94ca69c" + integrity sha512-utK3Rq5qZrEoRs/eOsOkowcsD740nlnBs6C3KKFRHgKIiR0XedD6t33KukUPLKbGp4mYZOYXRTA7/A04x58lKw== dependencies: "@cosmjs/amino" "^0.28.1" "@cosmjs/crypto" "^0.28.1" -- 2.45.2 From 03791ecdd5ba6cdd712063686b7f8fa1c34ff9d2 Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Thu, 5 Sep 2024 19:07:04 +0530 Subject: [PATCH 3/3] Increment package version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 725dc0f..29a16a2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@cerc-io/laconic-registry-cli", - "version": "0.2.6", + "version": "0.2.7", "main": "index.js", "repository": "git@github.com:cerc-io/laconic-registry-cli.git", "author": "", -- 2.45.2