File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change
1
+ import yargs from "yargs" ;
2
+ import { hideBin } from "yargs/helpers" ;
3
+ import { DefaultStore , EvmWormholeContract } from "../src" ;
4
+
5
+ const parser = yargs ( hideBin ( process . argv ) )
6
+ . usage ( "Usage: $0" )
7
+ . options ( {
8
+ testnet : {
9
+ type : "boolean" ,
10
+ default : false ,
11
+ desc : "Fetch testnet contracts instead of mainnet" ,
12
+ } ,
13
+ } ) ;
14
+
15
+ async function main ( ) {
16
+ const argv = await parser . argv ;
17
+ const entries = [ ] ;
18
+ for ( const contract of Object . values ( DefaultStore . wormhole_contracts ) ) {
19
+ if (
20
+ contract instanceof EvmWormholeContract &&
21
+ contract . getChain ( ) . isMainnet ( ) !== argv . testnet
22
+ ) {
23
+ try {
24
+ const index = await contract . getCurrentGuardianSetIndex ( ) ;
25
+ const chainId = await contract . getChainId ( ) ;
26
+ entries . push ( {
27
+ chain : contract . getChain ( ) . getId ( ) ,
28
+ contract : contract . address ,
29
+ guardianSetIndex : index ,
30
+ chainId : chainId ,
31
+ } ) ;
32
+ console . log ( `Fetched contract for ${ contract . getId ( ) } ` ) ;
33
+ } catch ( e ) {
34
+ console . error ( `Error fetching contract for ${ contract . getId ( ) } ` , e ) ;
35
+ }
36
+ }
37
+ }
38
+ console . table ( entries ) ;
39
+ }
40
+
41
+ main ( ) ;
You can’t perform that action at this time.
0 commit comments