@@ -23,8 +23,6 @@ import {
23
23
BorshInstructionCoder ,
24
24
} from "@coral-xyz/anchor" ;
25
25
import BN from "bn.js" ;
26
- import * as fs from "fs" ;
27
- import * as path from "path" ;
28
26
29
27
export const confirmTransaction = async (
30
28
connection : Connection ,
@@ -387,6 +385,9 @@ export async function getIdlParsedAccountData<T = any>(
387
385
accountAddress : PublicKey ,
388
386
connection ?: Connection ,
389
387
) : Promise < T > {
388
+ const fs = await import ( "node:fs" ) ;
389
+ const path = await import ( "node:path" ) ;
390
+
390
391
// Load and parse IDL file
391
392
const idlFile = fs . readFileSync ( path . resolve ( idlPath ) , "utf8" ) ;
392
393
const idl = JSON . parse ( idlFile ) as Idl ;
@@ -426,6 +427,9 @@ export async function parseAnchorTransactionEvents(
426
427
data : any ;
427
428
} >
428
429
> {
430
+ const fs = await import ( "node:fs" ) ;
431
+ const path = await import ( "node:path" ) ;
432
+
429
433
const idlFile = fs . readFileSync ( path . resolve ( idlPath ) , "utf8" ) ;
430
434
const idl = JSON . parse ( idlFile ) as Idl ;
431
435
@@ -493,6 +497,9 @@ export async function decodeAnchorTransaction(
493
497
signature : string ,
494
498
connection ?: Connection ,
495
499
) : Promise < DecodedTransaction > {
500
+ const fs = await import ( "node:fs" ) ;
501
+ const path = await import ( "node:path" ) ;
502
+
496
503
const idlFile = fs . readFileSync ( path . resolve ( idlPath ) , "utf8" ) ;
497
504
const idl = JSON . parse ( idlFile ) as Idl ;
498
505
0 commit comments