Skip to content

Commit 8ad1432

Browse files
authored
Merge pull request #1576 from input-output-hk/fix/lw-12169-map-pool-id-in-blockfrost-rewards-provider-response
fix: [lw-12169] map pool id in blockfrost rewards provider response
2 parents 2e4f552 + 6456c91 commit 8ad1432

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

packages/cardano-services-client/src/RewardsProvider/BlockfrostRewardsProvider.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,10 @@ export class BlockfrostRewardsProvider extends BlockfrostProvider implements Rew
4444
responseTranslator: (rewardsPage) =>
4545
rewardsPage
4646
.filter(({ epoch }) => lowerBound <= epoch && epoch <= upperBound)
47-
.map(({ epoch, amount }) => ({
47+
.map(({ epoch, amount, pool_id }) => ({
4848
epoch: Cardano.EpochNo(epoch),
49-
rewards: stringToBigInt(amount)
49+
rewards: stringToBigInt(amount),
50+
...(pool_id && { poolId: Cardano.PoolId(pool_id) })
5051
}))
5152
});
5253
}

packages/cardano-services-client/test/RewardProvider/BlockfrostRewardsProvider.test.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ describe('blockfrostRewardsProvider', () => {
7171

7272
expect(response).toEqual(
7373
new Map([
74-
[rewardAccounts[0], [{ epoch: 98, rewards: 1000n }]],
75-
[rewardAccounts[1], [{ epoch: 98, rewards: 1000n }]]
74+
[rewardAccounts[0], [{ epoch: 98, poolId: Cardano.PoolId(pool_id), rewards: 1000n }]],
75+
[rewardAccounts[1], [{ epoch: 98, poolId: Cardano.PoolId(pool_id), rewards: 1000n }]]
7676
])
7777
);
7878
});
@@ -95,8 +95,8 @@ describe('blockfrostRewardsProvider', () => {
9595
[
9696
rewardAccounts[0],
9797
[
98-
{ epoch: 98, rewards: 1000n },
99-
{ epoch: 99, rewards: 1000n }
98+
{ epoch: 98, poolId: Cardano.PoolId(pool_id), rewards: 1000n },
99+
{ epoch: 99, poolId: Cardano.PoolId(pool_id), rewards: 1000n }
100100
]
101101
]
102102
])

0 commit comments

Comments
 (0)