fix: rename getFinality to getConfirmationTime

This commit is contained in:
Michael Vines 2018-12-20 18:43:22 -08:00
parent 62c1efc955
commit 88abaa3cc9
3 changed files with 10 additions and 10 deletions

View File

@ -60,7 +60,7 @@ declare module '@solana/web3.js' {
): Promise<SignatureStatus>; ): Promise<SignatureStatus>;
getTransactionCount(): Promise<number>; getTransactionCount(): Promise<number>;
getLastId(): Promise<TransactionId>; getLastId(): Promise<TransactionId>;
getFinality(): Promise<number>; getConfirmationTime(): Promise<number>;
requestAirdrop( requestAirdrop(
to: PublicKey, to: PublicKey,
amount: number, amount: number,

View File

@ -130,9 +130,9 @@ const GetTransactionCountRpcResult = jsonRpcResult('number');
const GetLastId = jsonRpcResult('string'); 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 * 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<number> { async getConfirmationTime(): Promise<number> {
const unsafeRes = await this._rpcRequest('getFinality', []); const unsafeRes = await this._rpcRequest('getConfirmationTime', []);
const res = GetFinalityRpcResult(unsafeRes); const res = GetConfirmationTimeRpcResult(unsafeRes);
if (res.error) { if (res.error) {
throw new Error(res.error.message); throw new Error(res.error.message);
} }

View File

@ -123,13 +123,13 @@ test('get last Id', async () => {
expect(lastId.length).toBeGreaterThanOrEqual(43); expect(lastId.length).toBeGreaterThanOrEqual(43);
}); });
test('get finality', async () => { test('get confirmation time', async () => {
const connection = new Connection(url); const connection = new Connection(url);
mockRpc.push([ mockRpc.push([
url, url,
{ {
method: 'getFinality', method: 'getConfirmationTime',
params: [], params: [],
}, },
{ {
@ -138,7 +138,7 @@ test('get finality', async () => {
}, },
]); ]);
const finality = await connection.getFinality(); const finality = await connection.getConfirmationTime();
expect(finality).toBeGreaterThanOrEqual(0); expect(finality).toBeGreaterThanOrEqual(0);
}); });