fix: getConfirmationTime() was removed upstream
This commit is contained in:
@ -59,7 +59,6 @@ declare module '@solana/web3.js' {
|
|||||||
): Promise<SignatureStatus>;
|
): Promise<SignatureStatus>;
|
||||||
getTransactionCount(): Promise<number>;
|
getTransactionCount(): Promise<number>;
|
||||||
getLastId(): Promise<TransactionId>;
|
getLastId(): Promise<TransactionId>;
|
||||||
getConfirmationTime(): Promise<number>;
|
|
||||||
requestAirdrop(
|
requestAirdrop(
|
||||||
to: PublicKey,
|
to: PublicKey,
|
||||||
amount: number,
|
amount: number,
|
||||||
|
@ -128,11 +128,6 @@ const GetTransactionCountRpcResult = jsonRpcResult('number');
|
|||||||
*/
|
*/
|
||||||
const GetLastId = jsonRpcResult('string');
|
const GetLastId = jsonRpcResult('string');
|
||||||
|
|
||||||
/**
|
|
||||||
* Expected JSON RPC response for the "getConfirmationTime" message
|
|
||||||
*/
|
|
||||||
const GetConfirmationTimeRpcResult = jsonRpcResult('number');
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Expected JSON RPC response for the "requestAirdrop" message
|
* Expected JSON RPC response for the "requestAirdrop" message
|
||||||
*/
|
*/
|
||||||
@ -328,19 +323,6 @@ export class Connection {
|
|||||||
return res.result;
|
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
|
* Request an allocation of tokens to the specified account
|
||||||
*/
|
*/
|
||||||
|
@ -123,25 +123,6 @@ test('get last Id', async () => {
|
|||||||
expect(lastId.length).toBeGreaterThanOrEqual(43);
|
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 () => {
|
test('request airdrop', async () => {
|
||||||
const account = new Account();
|
const account = new Account();
|
||||||
const connection = new Connection(url);
|
const connection = new Connection(url);
|
||||||
|
Reference in New Issue
Block a user