Fix relaying (#658)
This commit is contained in:
parent
4524bd4984
commit
a0db4266ba
|
@ -66,7 +66,7 @@ async function run() {
|
||||||
: -1;
|
: -1;
|
||||||
lastSequenceNumber = Math.max(lastSequenceNumber, OFFSET);
|
lastSequenceNumber = Math.max(lastSequenceNumber, OFFSET);
|
||||||
const wormholeApi = WORMHOLE_API_ENDPOINT[CLUSTER];
|
const wormholeApi = WORMHOLE_API_ENDPOINT[CLUSTER];
|
||||||
|
const productAccountToSymbol: { [key: string]: string } = {};
|
||||||
while (true) {
|
while (true) {
|
||||||
lastSequenceNumber += 1;
|
lastSequenceNumber += 1;
|
||||||
console.log(`Trying sequence number : ${lastSequenceNumber}`);
|
console.log(`Trying sequence number : ${lastSequenceNumber}`);
|
||||||
|
@ -129,6 +129,9 @@ async function run() {
|
||||||
AccountType.Product
|
AccountType.Product
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
productAccountToSymbol[
|
||||||
|
parsedInstruction.accounts.named.productAccount.pubkey.toBase58()
|
||||||
|
] = parsedInstruction.args.symbol;
|
||||||
} else if (
|
} else if (
|
||||||
parsedInstruction instanceof PythMultisigInstruction &&
|
parsedInstruction instanceof PythMultisigInstruction &&
|
||||||
parsedInstruction.name == "addPrice"
|
parsedInstruction.name == "addPrice"
|
||||||
|
@ -136,13 +139,18 @@ async function run() {
|
||||||
const productAccount = await provider.connection.getAccountInfo(
|
const productAccount = await provider.connection.getAccountInfo(
|
||||||
parsedInstruction.accounts.named.productAccount.pubkey
|
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(
|
preInstructions.push(
|
||||||
await getCreateAccountWithSeedInstruction(
|
await getCreateAccountWithSeedInstruction(
|
||||||
provider.connection,
|
provider.connection,
|
||||||
CLUSTER,
|
CLUSTER,
|
||||||
provider.wallet.publicKey,
|
provider.wallet.publicKey,
|
||||||
parseProductData(productAccount.data).product.symbol,
|
productSymbol,
|
||||||
AccountType.Price
|
AccountType.Price
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue