solana/web3.js/test/mockrpc/get-recent-blockhash.js

37 lines
804 B
JavaScript
Raw Normal View History

// @flow
2018-11-04 11:41:21 -08:00
import {Account} from '../../src';
import type {Commitment} from '../../src/connection';
import {url} from '../url';
import {mockRpc} from '../__mocks__/node-fetch';
export function mockGetRecentBlockhash(commitment: ?Commitment) {
2019-03-04 08:06:33 -08:00
const recentBlockhash = new Account();
const params = [];
if (commitment) {
params.push({commitment});
}
mockRpc.push([
url,
{
2019-03-04 08:06:33 -08:00
method: 'getRecentBlockhash',
params,
},
{
error: null,
result: [
recentBlockhash.publicKey.toBase58(),
2019-05-23 10:44:55 -06:00
{
2019-06-12 14:36:05 -07:00
lamportsPerSignature: 42,
burnPercent: 50,
maxLamportsPerSignature: 42,
minLamportsPerSignature: 42,
targetLamportsPerSignature: 42,
targetSignaturesPerSlot: 42,
2019-05-23 10:44:55 -06:00
},
],
2018-11-04 11:41:21 -08:00
},
]);
}