@@ -43,8 +43,7 @@ describe("account api", () => {
4343 } ) ;
4444
4545 test ( "it fetches account modules with a limit" , async ( ) => {
46- const config = new AptosConfig ( { network : Network . LOCAL } ) ;
47- const aptos = new Aptos ( config ) ;
46+ const { aptos } = getAptosClient ( ) ;
4847 const data = await aptos . getAccountModules ( {
4948 accountAddress : "0x1" ,
5049 options : {
@@ -55,8 +54,7 @@ describe("account api", () => {
5554 } ) ;
5655
5756 test ( "it fetches account modules with pagination" , async ( ) => {
58- const config = new AptosConfig ( { network : Network . LOCAL } ) ;
59- const aptos = new Aptos ( config ) ;
57+ const { aptos } = getAptosClient ( ) ;
6058 let { modules, cursor } = await aptos . getAccountModulesPage ( {
6159 accountAddress : "0x1" ,
6260 options : {
@@ -82,8 +80,7 @@ describe("account api", () => {
8280 } ) ;
8381
8482 test ( "it fetches an account module" , async ( ) => {
85- const config = new AptosConfig ( { network : Network . LOCAL } ) ;
86- const aptos = new Aptos ( config ) ;
83+ const { aptos } = getAptosClient ( ) ;
8784 const data = await aptos . getAccountModule ( {
8885 accountAddress : "0x1" ,
8986 moduleName : "coin" ,
@@ -92,17 +89,15 @@ describe("account api", () => {
9289 } ) ;
9390
9491 test ( "it fetches account resources" , async ( ) => {
95- const config = new AptosConfig ( { network : Network . LOCAL } ) ;
96- const aptos = new Aptos ( config ) ;
92+ const { aptos } = getAptosClient ( ) ;
9793 const data = await aptos . getAccountResources ( {
9894 accountAddress : "0x1" ,
9995 } ) ;
10096 expect ( data . length ) . toBeGreaterThan ( 0 ) ;
10197 } ) ;
10298
10399 test ( "it fetches account resources with a limit" , async ( ) => {
104- const config = new AptosConfig ( { network : Network . LOCAL } ) ;
105- const aptos = new Aptos ( config ) ;
100+ const { aptos } = getAptosClient ( ) ;
106101 const data = await aptos . getAccountResources ( {
107102 accountAddress : "0x1" ,
108103 options : {
@@ -113,8 +108,7 @@ describe("account api", () => {
113108 } ) ;
114109
115110 test ( "it fetches account resources with pagination" , async ( ) => {
116- const config = new AptosConfig ( { network : Network . LOCAL } ) ;
117- const aptos = new Aptos ( config ) ;
111+ const { aptos } = getAptosClient ( ) ;
118112 const { resources, cursor } = await aptos . getAccountResourcesPage ( {
119113 accountAddress : "0x1" ,
120114 options : {
@@ -136,8 +130,7 @@ describe("account api", () => {
136130 } ) ;
137131
138132 test ( "it fetches an account resource without a type" , async ( ) => {
139- const config = new AptosConfig ( { network : Network . LOCAL } ) ;
140- const aptos = new Aptos ( config ) ;
133+ const { aptos } = getAptosClient ( ) ;
141134 const data = await aptos . getAccountResource ( {
142135 accountAddress : "0x1" ,
143136 resourceType : "0x1::account::Account" ,
@@ -149,8 +142,7 @@ describe("account api", () => {
149142 } ) ;
150143
151144 test ( "it fetches an account resource typed" , async ( ) => {
152- const config = new AptosConfig ( { network : Network . LOCAL } ) ;
153- const aptos = new Aptos ( config ) ;
145+ const { aptos } = getAptosClient ( ) ;
154146 type AccountRes = {
155147 authentication_key : string ;
156148 coin_register_events : {
@@ -186,8 +178,7 @@ describe("account api", () => {
186178 } ) ;
187179
188180 test ( "it fetches account transactions" , async ( ) => {
189- const config = new AptosConfig ( { network : Network . LOCAL } ) ;
190- const aptos = new Aptos ( config ) ;
181+ const { aptos } = getAptosClient ( ) ;
191182 const senderAccount = Account . generate ( ) ;
192183 await aptos . fundAccount ( {
193184 accountAddress : senderAccount . accountAddress ,
@@ -217,8 +208,7 @@ describe("account api", () => {
217208 } ) ;
218209
219210 test ( "it fetches account transactions count" , async ( ) => {
220- const config = new AptosConfig ( { network : Network . LOCAL } ) ;
221- const aptos = new Aptos ( config ) ;
211+ const { aptos } = getAptosClient ( ) ;
222212 const senderAccount = Account . generate ( ) ;
223213 const response = await aptos . fundAccount ( {
224214 accountAddress : senderAccount . accountAddress ,
@@ -233,8 +223,7 @@ describe("account api", () => {
233223 } ) ;
234224
235225 test ( "it fetches account coins data" , async ( ) => {
236- const config = new AptosConfig ( { network : Network . LOCAL } ) ;
237- const aptos = new Aptos ( config ) ;
226+ const { aptos } = getAptosClient ( ) ;
238227 const senderAccount = Account . generate ( ) ;
239228 const fundTxn = await aptos . fundAccount ( {
240229 accountAddress : senderAccount . accountAddress ,
@@ -250,8 +239,7 @@ describe("account api", () => {
250239 } ) ;
251240
252241 test ( "it fetches account coins count" , async ( ) => {
253- const config = new AptosConfig ( { network : Network . LOCAL } ) ;
254- const aptos = new Aptos ( config ) ;
242+ const { aptos } = getAptosClient ( ) ;
255243 const senderAccount = Account . generate ( ) ;
256244 const fundTxn = await aptos . fundAccount ( {
257245 accountAddress : senderAccount . accountAddress ,
@@ -266,8 +254,7 @@ describe("account api", () => {
266254 } ) ;
267255
268256 test ( "it fetches account's coin amount" , async ( ) => {
269- const config = new AptosConfig ( { network : Network . LOCAL } ) ;
270- const aptos = new Aptos ( config ) ;
257+ const { aptos } = getAptosClient ( ) ;
271258 const senderAccount = Account . generate ( ) ;
272259 const fundTxn = await aptos . fundAccount ( {
273260 accountAddress : senderAccount . accountAddress ,
@@ -317,8 +304,7 @@ describe("account api", () => {
317304 } ) ;
318305
319306 test ( "it fetches account balance by coin type (APT)" , async ( ) => {
320- const config = new AptosConfig ( { network : Network . LOCAL } ) ;
321- const aptos = new Aptos ( config ) ;
307+ const { aptos } = getAptosClient ( ) ;
322308 const account = Account . generate ( ) ;
323309
324310 const fundTxn = await aptos . fundAccount ( {
@@ -335,8 +321,7 @@ describe("account api", () => {
335321 } ) ;
336322
337323 test ( "it fetches account balance by FA metadata address (APT)" , async ( ) => {
338- const config = new AptosConfig ( { network : Network . LOCAL } ) ;
339- const aptos = new Aptos ( config ) ;
324+ const { aptos } = getAptosClient ( ) ;
340325 const account = Account . generate ( ) ;
341326
342327 const fundTxn = await aptos . fundAccount ( {
@@ -353,8 +338,7 @@ describe("account api", () => {
353338 } ) ;
354339
355340 test ( "lookupOriginalAccountAddress - Look up account address before key rotation" , async ( ) => {
356- const config = new AptosConfig ( { network : Network . LOCAL } ) ;
357- const aptos = new Aptos ( config ) ;
341+ const { aptos } = getAptosClient ( ) ;
358342 const account = Account . generate ( ) ;
359343
360344 // Fund and create account on-chain
@@ -367,8 +351,7 @@ describe("account api", () => {
367351 } ) ;
368352
369353 test ( "it fetches account owned token from collection" , async ( ) => {
370- const config = new AptosConfig ( { network : Network . LOCAL } ) ;
371- const aptos = new Aptos ( config ) ;
354+ const { aptos } = getAptosClient ( ) ;
372355 const creator = Account . generate ( ) ;
373356 await aptos . fundAccount ( { accountAddress : creator . accountAddress , amount : FUND_AMOUNT } ) ;
374357 const collectionCreationTransaction = await aptos . createCollectionTransaction ( {
@@ -410,10 +393,7 @@ describe("account api", () => {
410393 } ) ;
411394
412395 describe ( "it derives an account from a private key" , ( ) => {
413- const config = new AptosConfig ( {
414- network : Network . LOCAL ,
415- } ) ;
416- const aptos = new Aptos ( config ) ;
396+ const { aptos } = getAptosClient ( ) ;
417397
418398 test ( "single sender ed25519" , async ( ) => {
419399 const account = Account . generate ( { scheme : SigningSchemeInput . Ed25519 , legacy : false } ) ;
@@ -459,8 +439,7 @@ describe("account api", () => {
459439
460440 describe ( "Key Rotation" , ( ) => {
461441 test ( "it should rotate ed25519 to ed25519 auth key correctly" , async ( ) => {
462- const config = new AptosConfig ( { network : Network . LOCAL } ) ;
463- const aptos = new Aptos ( config ) ;
442+ const { aptos } = getAptosClient ( ) ;
464443
465444 // Current Account
466445 const account = Account . generate ( { scheme : SigningSchemeInput . Ed25519 , legacy : true } ) ;
@@ -491,8 +470,7 @@ describe("account api", () => {
491470 } , 10000 ) ;
492471
493472 test ( "it should rotate ed25519 to multi-ed25519 auth key correctly" , async ( ) => {
494- const config = new AptosConfig ( { network : Network . LOCAL } ) ;
495- const aptos = new Aptos ( config ) ;
473+ const { aptos } = getAptosClient ( ) ;
496474
497475 // Current Account
498476 const account = Account . generate ( { scheme : SigningSchemeInput . Ed25519 , legacy : true } ) ;
@@ -530,8 +508,7 @@ describe("account api", () => {
530508 } , 10000 ) ;
531509
532510 test ( "it should rotate ed25519 to multikey auth key correctly" , async ( ) => {
533- const config = new AptosConfig ( { network : Network . LOCAL } ) ;
534- const aptos = new Aptos ( config ) ;
511+ const { aptos } = getAptosClient ( ) ;
535512
536513 // Current Account
537514 const account = Account . generate ( { scheme : SigningSchemeInput . Ed25519 , legacy : true } ) ;
@@ -568,8 +545,7 @@ describe("account api", () => {
568545 } , 10000 ) ;
569546
570547 test ( "it should rotate ed25519 to unverified auth key correctly" , async ( ) => {
571- const config = new AptosConfig ( { network : Network . LOCAL } ) ;
572- const aptos = new Aptos ( config ) ;
548+ const { aptos } = getAptosClient ( ) ;
573549
574550 // Current Account
575551 const account = Account . generate ( { scheme : SigningSchemeInput . Ed25519 , legacy : true } ) ;
@@ -601,8 +577,7 @@ describe("account api", () => {
601577 } ) ;
602578
603579 describe ( "Account Derivation APIs" , ( ) => {
604- const config = new AptosConfig ( { network : Network . LOCAL } ) ;
605- const aptos = new Aptos ( config ) ;
580+ const { aptos } = getAptosClient ( ) ;
606581
607582 const minterAccount = Account . generate ( ) ;
608583
0 commit comments