11// @flow
22
3- import { Account } from '../src/account' ;
4- import { Connection } from '../src/connection' ;
5- import { Token , TokenAmount } from '../src/token-program' ;
6- import { PublicKey } from '../src/publickey' ;
3+ import {
4+ Connection ,
5+ PublicKey ,
6+ Token ,
7+ TokenAmount ,
8+ } from '../src' ;
79import { mockRpc , mockRpcEnabled } from './__mocks__/node-fetch' ;
8- import { url } from './url.js ' ;
9- import type { SignatureStatus } from '../src/connection ' ;
10+ import { url } from './url' ;
11+ import { newAccountWithTokens } from './new-account-with-tokens ' ;
1012
1113if ( ! mockRpcEnabled ) {
1214 // The default of 5 seconds is too slow for live testing sometimes
@@ -27,7 +29,7 @@ function mockGetLastId() {
2729 ] ) ;
2830}
2931
30- function mockGetSignatureStatus ( result : SignatureStatus = 'Confirmed' ) {
32+ function mockGetSignatureStatus ( result : string = 'Confirmed' ) {
3133 mockRpc . push ( [
3234 url ,
3335 {
@@ -53,27 +55,6 @@ function mockSendTransaction() {
5355}
5456
5557
56- async function newAccountWithTokens ( connection : Connection , amount : number = 10 ) : Promise < Account > {
57- const account = new Account ( ) ;
58-
59- {
60- mockRpc . push ( [
61- url ,
62- {
63- method : 'requestAirdrop' ,
64- params : [ account . publicKey . toBase58 ( ) , amount ] ,
65- } ,
66- {
67- error : null ,
68- result : '3WE5w4B7v59x6qjyC4FbG2FEKYKQfvsJwqSxNVmtMjT8TQ31hsZieDHcSgqzxiAoTL56n2w5TncjqEKjLhtF4Vk' ,
69- }
70- ] ) ;
71- }
72-
73- await connection . requestAirdrop ( account . publicKey , amount ) ;
74- return account ;
75- }
76-
7758// A token created by the first test and used by all subsequent tests
7859let testToken : Token ;
7960
0 commit comments