fix: getConfirmationTime() was removed upstream

This commit is contained in:
Michael Vines 2019-02-17 16:09:55 -08:00
parent 6b73d7d17c
commit 5b9665098a
3 changed files with 0 additions and 38 deletions

View File

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

View File

@ -128,11 +128,6 @@ const GetTransactionCountRpcResult = jsonRpcResult('number');
*/
const GetLastId = jsonRpcResult('string');
/**
* Expected JSON RPC response for the "getConfirmationTime" message
*/
const GetConfirmationTimeRpcResult = jsonRpcResult('number');
/**
* Expected JSON RPC response for the "requestAirdrop" message
*/
@ -328,19 +323,6 @@ export class Connection {
return res.result;
}
/**
* Return the current cluster confirmation time in millliseconds
*/
async getConfirmationTime(): Promise<number> {
const unsafeRes = await this._rpcRequest('getConfirmationTime', []);
const res = GetConfirmationTimeRpcResult(unsafeRes);
if (res.error) {
throw new Error(res.error.message);
}
assert(typeof res.result !== 'undefined');
return Number(res.result);
}
/**
* Request an allocation of tokens to the specified account
*/

View File

@ -123,25 +123,6 @@ test('get last Id', async () => {
expect(lastId.length).toBeGreaterThanOrEqual(43);
});
test('get confirmation time', async () => {
const connection = new Connection(url);
mockRpc.push([
url,
{
method: 'getConfirmationTime',
params: [],
},
{
error: null,
result: 123,
},
]);
const finality = await connection.getConfirmationTime();
expect(finality).toBeGreaterThanOrEqual(0);
});
test('request airdrop', async () => {
const account = new Account();
const connection = new Connection(url);