diff --git a/CHANGELOG.md b/CHANGELOG.md index 0dceba56..17b378ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [2.3.2-alpha.3](https://github.com/ar-io/ar-io-sdk/compare/v2.3.2-alpha.2...v2.3.2-alpha.3) (2024-10-15) + + +### Bug Fixes + +* **types:** add `totalEligibleGateways` to `AoEpochDistributionData` type ([9a35d39](https://github.com/ar-io/ar-io-sdk/commit/9a35d39ed811076a03a392cd5ac7b8f2ce878d98)) + ## [2.3.2-alpha.2](https://github.com/ar-io/ar-io-sdk/compare/v2.3.2-alpha.1...v2.3.2-alpha.2) (2024-10-15) diff --git a/README.md b/README.md index d6998459..1fe8f4b9 100644 --- a/README.md +++ b/README.md @@ -592,7 +592,7 @@ const demandFactor = await io.getDemandFactor(); #### `getObservations({ epochIndex })` -Returns the epoch-indexed observation list. +Returns the epoch-indexed observation list. If no epoch index is provided, the current epoch is used. ```typescript const io = IO.init(); @@ -625,11 +625,11 @@ const observations = await io.getObservations(); #### `getDistributions({ epochIndex })` -Returns the current rewards distribution information. +Returns the current rewards distribution information. If no epoch index is provided, the current epoch is used. ```typescript const io = IO.init(); -const distributions = await io.getDistributions(); +const distributions = await io.getDistributions({ epochIndex: 0 }); ```
@@ -637,11 +637,22 @@ const distributions = await io.getDistributions(); ```json { + "totalEligibleGateways": 1, "totalEligibleRewards": 100000000, + "totalEligibleObserverReward": 100000000, + "totalEligibleGatewayReward": 100000000, "totalDistributedRewards": 100000000, "distributedTimestamp": 1720720621424, "rewards": { - "IPdwa3Mb_9pDD8c2IaJx6aad51Ss-_TfStVwBuhtXMs": 100000000 + "eligible": { + "IPdwa3Mb_9pDD8c2IaJx6aad51Ss-_TfStVwBuhtXMs": { + "operatorReward": 100000000, + "delegateRewards": {} + } + }, + "distributed": { + "IPdwa3Mb_9pDD8c2IaJx6aad51Ss-_TfStVwBuhtXMs": 100000000 + } } } ``` @@ -650,7 +661,7 @@ const distributions = await io.getDistributions(); #### `getEpoch({ epochIndex })` -Returns the epoch data for the specified block height. +Returns the epoch data for the specified block height. If no epoch index is provided, the current epoch is used. ```typescript const io = IO.init(); @@ -693,11 +704,22 @@ const epoch = await io.getEpoch({ epochIndex: 0 }); } ], "distributions": { - "distributedTimestamp": 1752256702026, + "totalEligibleGateways": 1, "totalEligibleRewards": 100000000, - "totoalDistributedRewards": 100000000, + "totalEligibleObserverReward": 100000000, + "totalEligibleGatewayReward": 100000000, + "totalDistributedRewards": 100000000, + "distributedTimestamp": 1720720621424, "rewards": { - "IPdwa3Mb_9pDD8c2IaJx6aad51Ss-_TfStVwBuhtXMs": 100000000 + "eligible": { + "IPdwa3Mb_9pDD8c2IaJx6aad51Ss-_TfStVwBuhtXMs": { + "operatorReward": 100000000, + "delegateRewards": {} + } + }, + "distributed": { + "IPdwa3Mb_9pDD8c2IaJx6aad51Ss-_TfStVwBuhtXMs": 100000000 + } } } } diff --git a/package.json b/package.json index 5c090e20..7cfb2f2b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ar.io/sdk", - "version": "2.3.2-alpha.2", + "version": "2.3.2-alpha.3", "repository": { "type": "git", "url": "git+https://github.com/ar-io/ar-io-sdk.git" diff --git a/src/types/io.ts b/src/types/io.ts index 20e2d09c..86635e62 100644 --- a/src/types/io.ts +++ b/src/types/io.ts @@ -113,6 +113,7 @@ export type AoEpochDistributionRewards = { export type AoEpochDistributionData = { rewards: AoEpochDistributionRewards; + totalEligibleGateways: number; totalEligibleRewards: number; totalEligibleObserverReward: number; totalEligibleGatewayReward: number; diff --git a/src/version.ts b/src/version.ts index e8aaecf5..8a2e0b51 100644 --- a/src/version.ts +++ b/src/version.ts @@ -16,4 +16,4 @@ // AUTOMATICALLY GENERATED FILE - DO NOT TOUCH -export const version = '2.3.2-alpha.2'; +export const version = '2.3.2-alpha.3'; diff --git a/tests/e2e/cjs/index.test.js b/tests/e2e/cjs/index.test.js index dfbda0dd..da4fd85b 100644 --- a/tests/e2e/cjs/index.test.js +++ b/tests/e2e/cjs/index.test.js @@ -121,11 +121,16 @@ describe('IO', async () => { assert.ok(arns); }); - it('should be able to get the current epoch', async () => { + it('should be able to get the current epoch using getCurrentEpoch', async () => { const epoch = await io.getCurrentEpoch(); assert.ok(epoch); }); + it('should be able to get the current epoch using getEpoch', async () => { + const epoch = await io.getEpoch({ epochIndex: 0 }); + assert.ok(epoch); + }); + it('should be able to get epoch-settings', async () => { const epochSettings = await io.getEpochSettings(); assert.ok(epochSettings); diff --git a/tests/e2e/esm/index.test.js b/tests/e2e/esm/index.test.js index a1b62394..033e24dd 100644 --- a/tests/e2e/esm/index.test.js +++ b/tests/e2e/esm/index.test.js @@ -334,6 +334,31 @@ describe('IO', async () => { } }); + it('should be able to get current epoch distributions', async () => { + const distributions = await io.getDistributions(); + assert.ok(distributions); + }); + + it('should be able to get epoch distributions at a specific epoch', async () => { + const distributions = await io.getDistributions({ epochIndex: 0 }); + assert.ok(distributions); + }); + + it('should be able to get current epoch observations', async () => { + const observations = await io.getObservations(); + assert.ok(observations); + }); + + it('should be able to get epoch observations at a specific epoch', async () => { + const observations = await io.getObservations({ epochIndex: 0 }); + assert.ok(observations); + }); + + it('should be able to get current demand factor', async () => { + const demandFactor = await io.getDemandFactor(); + assert.ok(demandFactor); + }); + it('should be able to create IOWriteable with valid signers', async () => { for (const signer of signers) { const io = IO.init({ signer });