Fix relaying (#658)

This commit is contained in:
guibescos 2023-03-03 15:42:37 -06:00 committed by GitHub
parent 4524bd4984
commit a0db4266ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 3 deletions

View File

@ -66,7 +66,7 @@ async function run() {
: -1;
lastSequenceNumber = Math.max(lastSequenceNumber, OFFSET);
const wormholeApi = WORMHOLE_API_ENDPOINT[CLUSTER];
const productAccountToSymbol: { [key: string]: string } = {};
while (true) {
lastSequenceNumber += 1;
console.log(`Trying sequence number : ${lastSequenceNumber}`);
@ -129,6 +129,9 @@ async function run() {
AccountType.Product
)
);
productAccountToSymbol[
parsedInstruction.accounts.named.productAccount.pubkey.toBase58()
] = parsedInstruction.args.symbol;
} else if (
parsedInstruction instanceof PythMultisigInstruction &&
parsedInstruction.name == "addPrice"
@ -136,13 +139,18 @@ async function run() {
const productAccount = await provider.connection.getAccountInfo(
parsedInstruction.accounts.named.productAccount.pubkey
);
if (productAccount) {
const productSymbol = productAccount
? parseProductData(productAccount.data).product.symbol
: productAccountToSymbol[
parsedInstruction.accounts.named.productAccount.pubkey.toBase58()
];
if (productSymbol) {
preInstructions.push(
await getCreateAccountWithSeedInstruction(
provider.connection,
CLUSTER,
provider.wallet.publicKey,
parseProductData(productAccount.data).product.symbol,
productSymbol,
AccountType.Price
)
);