diff --git a/web3.js/module.flow.js b/web3.js/module.flow.js index c000b541d1..968b3fc524 100644 --- a/web3.js/module.flow.js +++ b/web3.js/module.flow.js @@ -60,7 +60,7 @@ declare module '@solana/web3.js' { ): Promise; getTransactionCount(): Promise; getLastId(): Promise; - getFinality(): Promise; + getConfirmationTime(): Promise; requestAirdrop( to: PublicKey, amount: number, diff --git a/web3.js/src/connection.js b/web3.js/src/connection.js index db21598b72..0d683be13e 100644 --- a/web3.js/src/connection.js +++ b/web3.js/src/connection.js @@ -130,9 +130,9 @@ const GetTransactionCountRpcResult = jsonRpcResult('number'); const GetLastId = jsonRpcResult('string'); /** - * Expected JSON RPC response for the "getFinality" message + * Expected JSON RPC response for the "getConfirmationTime" message */ -const GetFinalityRpcResult = jsonRpcResult('number'); +const GetConfirmationTimeRpcResult = jsonRpcResult('number'); /** * Expected JSON RPC response for the "requestAirdrop" message @@ -333,11 +333,11 @@ export class Connection { } /** - * Return the current network finality time in millliseconds + * Return the current cluster confirmation time in millliseconds */ - async getFinality(): Promise { - const unsafeRes = await this._rpcRequest('getFinality', []); - const res = GetFinalityRpcResult(unsafeRes); + async getConfirmationTime(): Promise { + const unsafeRes = await this._rpcRequest('getConfirmationTime', []); + const res = GetConfirmationTimeRpcResult(unsafeRes); if (res.error) { throw new Error(res.error.message); } diff --git a/web3.js/test/connection.test.js b/web3.js/test/connection.test.js index bd4499f475..b782d8884b 100644 --- a/web3.js/test/connection.test.js +++ b/web3.js/test/connection.test.js @@ -123,13 +123,13 @@ test('get last Id', async () => { expect(lastId.length).toBeGreaterThanOrEqual(43); }); -test('get finality', async () => { +test('get confirmation time', async () => { const connection = new Connection(url); mockRpc.push([ url, { - method: 'getFinality', + method: 'getConfirmationTime', params: [], }, { @@ -138,7 +138,7 @@ test('get finality', async () => { }, ]); - const finality = await connection.getFinality(); + const finality = await connection.getConfirmationTime(); expect(finality).toBeGreaterThanOrEqual(0); });