@@ -15,7 +15,7 @@ import Web3 from "web3";
1515import { CHAINS } from "@pythnetwork/xc-admin-common" ;
1616import * as fs from "fs" ;
1717
18- const { getDefaultConfig } = require ( "../../target_chains/ethereum/contracts/scripts/contractManagerConfig" ) ;
18+ import { getDefaultConfig } from "../../target_chains/ethereum/contracts/scripts/contractManagerConfig" ;
1919
2020const parser = yargs ( hideBin ( process . argv ) )
2121 . usage (
@@ -45,10 +45,13 @@ const parser = yargs(hideBin(process.argv))
4545 } ,
4646 } ) ;
4747
48- async function memoize ( key : string , fn : ( ) => Promise < any > ) {
49- const cacheDir = '../../target_chains/ethereum/contracts/cache' ;
48+ async function memoize (
49+ key : string ,
50+ fn : ( ) => Promise < string > ,
51+ ) : Promise < string > {
52+ const cacheDir = "../../target_chains/ethereum/contracts/cache" ;
5053 const path = `${ cacheDir } /${ key } .json` ;
51-
54+
5255 if ( fs . existsSync ( path ) ) {
5356 return JSON . parse ( fs . readFileSync ( path ) . toString ( ) ) ;
5457 }
@@ -61,11 +64,14 @@ async function main() {
6164 const argv = await parser . argv ;
6265 const privateKey = argv [ "private-key" ] ;
6366 const network = argv [ "network" ] ;
64- const setupInfo = require ( argv [ "contract" ] + "/ReceiverSetup.json" ) ;
65- const implementationInfo = require (
66- argv [ "contract" ] + "/ReceiverImplementation.json" ,
67+
68+ const setupInfo = await import ( argv [ "contract" ] + "/ReceiverSetup.json" ) ;
69+ const implementationInfo = await import (
70+ argv [ "contract" ] + "/ReceiverImplementation.json"
71+ ) ;
72+ const receiverInfo = await import (
73+ argv [ "contract" ] + "/WormholeReceiver.json"
6774 ) ;
68- const receiverInfo = require ( argv [ "contract" ] + "/WormholeReceiver.json" ) ;
6975
7076 const payloads : Buffer [ ] = [ ] ;
7177 for ( const chain of Object . values ( DefaultStore . chains ) ) {
0 commit comments