feat: introduce getInflationReward to connection (#16807)

* feat: introduce getInflationReward to connection

* fix: only run getInflationReward test in mock mode
This commit is contained in:
Josh
2021-04-26 11:09:40 -07:00
committed by GitHub
parent cf779c63c5
commit c54daa8009
2 changed files with 90 additions and 0 deletions

View File

@ -588,6 +588,42 @@ describe('Connection', () => {
}
});
it('get inflation reward', async () => {
if (mockServer) {
await mockRpcResponse({
method: 'getInflationReward',
params: [
[
'7GHnTRB8Rz14qZQhDXf8ox1Kfu7mPcPLpKaBJJirmYj2',
'CrinLuHjVGDDcQfrEoCmM4k31Ni9sMoTCEEvNSUSh7Jg',
],
{
epoch: 0,
},
],
value: [
{
amount: 3646143,
effectiveSlot: 432000,
epoch: 0,
postBalance: 30504783,
},
null,
],
});
const inflationReward = await connection.getInflationReward(
[
new PublicKey('7GHnTRB8Rz14qZQhDXf8ox1Kfu7mPcPLpKaBJJirmYj2'),
new PublicKey('CrinLuHjVGDDcQfrEoCmM4k31Ni9sMoTCEEvNSUSh7Jg'),
],
0,
);
expect(inflationReward).to.have.lengthOf(2);
}
});
it('get epoch info', async () => {
await mockRpcResponse({
method: 'getEpochInfo',