Fix constructor for multisig transaction (#476)
This commit is contained in:
parent
d1f5e5955a
commit
5641008356
|
@ -35,7 +35,7 @@ test("Wormhole multisig instruction parse: send message without governance paylo
|
||||||
AnchorProvider.defaultOptions()
|
AnchorProvider.defaultOptions()
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
const parser = new MultisigParser(cluster);
|
const parser = MultisigParser.fromCluster(cluster);
|
||||||
|
|
||||||
wormholeProgram.methods
|
wormholeProgram.methods
|
||||||
.postMessage(1, Buffer.from([0]), 1)
|
.postMessage(1, Buffer.from([0]), 1)
|
||||||
|
@ -182,7 +182,7 @@ test("Wormhole multisig instruction parse: send message with governance payload"
|
||||||
AnchorProvider.defaultOptions()
|
AnchorProvider.defaultOptions()
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
const parser = new MultisigParser(cluster);
|
const parser = MultisigParser.fromCluster(cluster);
|
||||||
|
|
||||||
const executePostedVaaArgs: ExecutePostedVaaArgs = {
|
const executePostedVaaArgs: ExecutePostedVaaArgs = {
|
||||||
targetChainId: "pythnet" as ChainName,
|
targetChainId: "pythnet" as ChainName,
|
||||||
|
|
|
@ -39,9 +39,18 @@ export class MultisigParser {
|
||||||
readonly pythOracleAddress: PublicKey;
|
readonly pythOracleAddress: PublicKey;
|
||||||
readonly wormholeBridgeAddress: PublicKey | undefined;
|
readonly wormholeBridgeAddress: PublicKey | undefined;
|
||||||
|
|
||||||
constructor(cluster: PythCluster) {
|
constructor(
|
||||||
this.pythOracleAddress = getPythProgramKeyForCluster(cluster);
|
pythOracleAddress: PublicKey,
|
||||||
this.wormholeBridgeAddress = WORMHOLE_ADDRESS[cluster];
|
wormholeBridgeAddress: PublicKey | undefined
|
||||||
|
) {
|
||||||
|
this.pythOracleAddress = pythOracleAddress;
|
||||||
|
this.wormholeBridgeAddress = wormholeBridgeAddress;
|
||||||
|
}
|
||||||
|
static fromCluster(cluster: PythCluster): MultisigParser {
|
||||||
|
return new MultisigParser(
|
||||||
|
getPythProgramKeyForCluster(cluster),
|
||||||
|
WORMHOLE_ADDRESS[cluster]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
parseInstruction(instruction: TransactionInstruction): MultisigInstruction {
|
parseInstruction(instruction: TransactionInstruction): MultisigInstruction {
|
||||||
|
|
Loading…
Reference in New Issue