fix: getConfirmationTime() was removed upstream
This commit is contained in:
parent
6b73d7d17c
commit
5b9665098a
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue