From c02ef395ede79af57ff8eeacf7817ad2ab2d2e0f Mon Sep 17 00:00:00 2001 From: Justin Starry Date: Wed, 29 Sep 2021 11:27:11 -0400 Subject: [PATCH] fix: use stable endpoints for getBlocks (#20310) --- web3.js/src/connection.ts | 2 +- web3.js/test/connection.test.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/web3.js/src/connection.ts b/web3.js/src/connection.ts index bc601720e..db33300a0 100644 --- a/web3.js/src/connection.ts +++ b/web3.js/src/connection.ts @@ -3119,7 +3119,7 @@ export class Connection { endSlot !== undefined ? [startSlot, endSlot] : [startSlot], commitment, ); - const unsafeRes = await this._rpcRequest('getBlocks', args); + const unsafeRes = await this._rpcRequest('getConfirmedBlocks', args); const res = create(unsafeRes, jsonRpcResult(array(number()))); if ('error' in res) { throw new Error('failed to get blocks: ' + res.error.message); diff --git a/web3.js/test/connection.test.ts b/web3.js/test/connection.test.ts index 035ff626b..4978c247e 100644 --- a/web3.js/test/connection.test.ts +++ b/web3.js/test/connection.test.ts @@ -2080,7 +2080,7 @@ describe('Connection', () => { it('get blocks between two slots', async () => { await mockRpcResponse({ - method: 'getBlocks', + method: 'getConfirmedBlocks', params: [0, 10], value: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], }); @@ -2100,7 +2100,7 @@ describe('Connection', () => { it('get blocks from starting slot', async () => { await mockRpcResponse({ - method: 'getBlocks', + method: 'getConfirmedBlocks', params: [0], value: [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,