From 99edbad2fb4553d85c366d6c62466d984b42e7cf Mon Sep 17 00:00:00 2001 From: atticusofsparta Date: Thu, 25 Jul 2024 12:01:57 -0600 Subject: [PATCH 1/2] fix(types): update type name to what contract returns --- README.md | 6 +++--- src/contract-state.ts | 2 +- src/io.ts | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index f6951f07..35b239db 100644 --- a/README.md +++ b/README.md @@ -124,7 +124,7 @@ const gateways = await io.getGateways(); "failedConsecutiveEpochs": 0, "passedEpochCount": 30, "submittedEpochCount": 30, - "totalEpochParticipationCount": 31, + "totalEpochCount": 31, "totalEpochsPrescribedCount": 31 }, "status": "joined", @@ -364,7 +364,7 @@ const gateway = await io.getGateway({ "failedConsecutiveEpochs": 0, "passedEpochCount": 30, "submittedEpochCount": 30, - "totalEpochParticipationCount": 31, + "totalEpochCount": 31, "totalEpochsPrescribedCount": 31 }, "status": "joined", @@ -412,7 +412,7 @@ Available `sortBy` options are any of the keys on the gateway object, e.g. `oper "failedConsecutiveEpochs": 0, "passedEpochCount": 30, "submittedEpochCount": 30, - "totalEpochParticipationCount": 31, + "totalEpochCount": 31, "totalEpochsPrescribedCount": 31 }, "status": "joined", diff --git a/src/contract-state.ts b/src/contract-state.ts index 0ba06f82..c17ae4d2 100644 --- a/src/contract-state.ts +++ b/src/contract-state.ts @@ -135,7 +135,7 @@ export type GatewayStats = { failedConsecutiveEpochs: number; passedEpochCount: number; submittedEpochCount: number; - totalEpochParticipationCount: number; + totalEpochCount: number; totalEpochsPrescribedCount: number; }; diff --git a/src/io.ts b/src/io.ts index 38d21633..9f48ea68 100644 --- a/src/io.ts +++ b/src/io.ts @@ -390,7 +390,7 @@ export type AoEpochData = { export type AoGatewayStats = { passedConsecutiveEpochs: number; failedConsecutiveEpochs: number; - totalEpochParticipationCount: number; + totalEpochCount: number; passedEpochCount: number; failedEpochCount: number; observedEpochCount: number; From b6f215763b5d7b3e713f0dbb1babca99ddd79dfe Mon Sep 17 00:00:00 2001 From: atticusofsparta Date: Thu, 25 Jul 2024 12:06:47 -0600 Subject: [PATCH 2/2] fix(emitter): add page size param for emitter to increase amount of records per page to 50k --- src/utils/processes.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/utils/processes.ts b/src/utils/processes.ts index dbb7ea79..fa7d0230 100644 --- a/src/utils/processes.ts +++ b/src/utils/processes.ts @@ -115,7 +115,13 @@ export class ArNSEventEmitter extends EventEmitter { this.logger = logger; } - async fetchProcessesOwnedByWallet({ address }: { address: WalletAddress }) { + async fetchProcessesOwnedByWallet({ + address, + pageSize, + }: { + address: WalletAddress; + pageSize?: number; + }) { const uniqueContractProcessIds: Record< string, { @@ -126,7 +132,7 @@ export class ArNSEventEmitter extends EventEmitter { await timeout( this.timeoutMs, - fetchAllArNSRecords({ contract: this.contract, emitter: this }), + fetchAllArNSRecords({ contract: this.contract, emitter: this, pageSize }), ) .catch((e) => { this.emit('error', `Error getting ArNS records: ${e}`); @@ -201,17 +207,19 @@ export const fetchAllArNSRecords = async ({ }), emitter, logger = Logger.default, + pageSize = 50_000, }: { contract?: AoIORead; emitter?: EventEmitter; logger?: ILogger; + pageSize?: number; }): Promise> => { let cursor: string | undefined; const startTimestamp = Date.now(); const records: Record = {}; do { const pageResult = await contract - .getArNSRecords({ cursor }) + .getArNSRecords({ cursor, limit: pageSize }) .catch((e: any) => { logger?.error(`Error getting ArNS records`, { message: e?.message,