@@ -22,11 +22,12 @@ import { program } from "commander";
22
22
import * as fs from "fs" ;
23
23
import { LedgerNodeWallet } from "./wallet" ;
24
24
import lodash from "lodash" ;
25
+ import { getActiveProposals , getProposalInstructions } from "./multisig" ;
25
26
26
27
setDefaultWasm ( "node" ) ;
27
28
28
- type Cluster = "devnet" | "mainnet" ;
29
- type WormholeNetwork = "TESTNET" | "MAINNET" ;
29
+ type Cluster = "devnet" | "mainnet" | "localnet" ;
30
+ type WormholeNetwork = "TESTNET" | "MAINNET" | "DEVNET" ;
30
31
31
32
type Config = {
32
33
wormholeClusterName : WormholeNetwork ;
@@ -45,6 +46,11 @@ const CONFIG: Record<Cluster, Config> = {
45
46
vault : new PublicKey ( "FVQyHcooAtThJ83XFrNnv74BcinbRH3bRmfFamAHBfuj" ) ,
46
47
wormholeRpcEndpoint : "https://wormhole-v2-mainnet-api.certus.one" ,
47
48
} ,
49
+ localnet : {
50
+ wormholeClusterName : "DEVNET" ,
51
+ vault : new PublicKey ( "2VVHgWVHi32P1aoMjHmL3e1Hf6yi7uERahXF1T5n6EHx" ) , // Placeholder
52
+ wormholeRpcEndpoint : "https://wormhole-v2-mainnet-api.certus.one" , // Placeholder
53
+ } ,
48
54
} ;
49
55
50
56
program
@@ -374,7 +380,11 @@ async function getSquadsClient(
374
380
console . log ( `Loaded wallet with address: ${ wallet . publicKey . toBase58 ( ) } ` ) ;
375
381
}
376
382
const squad =
377
- cluster === "devnet" ? Squads . devnet ( wallet ) : Squads . mainnet ( wallet ) ;
383
+ cluster === "devnet"
384
+ ? Squads . devnet ( wallet )
385
+ : cluster == "mainnet"
386
+ ? Squads . mainnet ( wallet )
387
+ : Squads . endpoint ( "http://127.0.0.1:8899" , wallet ) ;
378
388
return squad ;
379
389
}
380
390
@@ -582,34 +592,16 @@ async function verifyWormholePayload(
582
592
console . log ( `Emitter Address: ${ emitter . toBase58 ( ) } ` ) ;
583
593
584
594
const tx = await squad . getTransaction ( txPubkey ) ;
595
+ const onChainInstructions = await getProposalInstructions ( squad , tx ) ;
585
596
586
- if ( tx . instructionIndex !== 2 ) {
597
+ if ( onChainInstructions . length !== 2 ) {
587
598
throw new Error (
588
599
`Expected 2 instructions in the transaction, found ${
589
600
tx . instructionIndex + 1
590
601
} `
591
602
) ;
592
603
}
593
604
594
- const [ ix1PubKey ] = getIxPDA (
595
- txPubkey ,
596
- new anchor . BN ( 1 ) ,
597
- squad . multisigProgramId
598
- ) ;
599
- const [ ix2PubKey ] = getIxPDA (
600
- txPubkey ,
601
- new anchor . BN ( 2 ) ,
602
- squad . multisigProgramId
603
- ) ;
604
-
605
- const onChainInstructions = await squad . getInstructions ( [
606
- ix1PubKey ,
607
- ix2PubKey ,
608
- ] ) ;
609
-
610
- console . log ( onChainInstructions [ 0 ] ) ;
611
- console . log ( onChainInstructions [ 1 ] ) ;
612
-
613
605
const [ messagePDA ] = getIxAuthorityPDA (
614
606
txPubkey ,
615
607
new anchor . BN ( 1 ) ,
0 commit comments