Skip to content

Commit

Permalink
code review observation
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianscatularo committed Aug 13, 2023
1 parent 1772ba4 commit ff9baa2
Showing 1 changed file with 12 additions and 20 deletions.
32 changes: 12 additions & 20 deletions src/hooks/useHandleRedeem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -352,19 +352,19 @@ async function solana(
throw new Error("wallet.signTransaction is undefined");
}
const connection = new Connection(SOLANA_HOST, "confirmed");
// TODO compute the amount of tx that postVaaSolanaWithRetry
// will create to notice the user up front
// we could call createPostSignedVaaTransactions to create fake txs
// and read the length of the array
await postVaaSolanaWithRetry(
connection,
wallet.signTransaction.bind(wallet),
SOL_BRIDGE_ADDRESS,
payerAddress,
Buffer.from(signedVAA),
MAX_VAA_UPLOAD_RETRIES_SOLANA
);
if (isTbtc) {
// TODO compute the amount of tx that postVaaSolanaWithRetry
// will create to notice the user up front
// we could call createPostSignedVaaTransactions to create fake txs
// and read the length of the array
await postVaaSolanaWithRetry(
connection,
wallet.signTransaction.bind(wallet),
SOL_BRIDGE_ADDRESS,
payerAddress,
Buffer.from(signedVAA),
MAX_VAA_UPLOAD_RETRIES_SOLANA
);
const tbtcGateway = newThresholdWormholeGateway(connection, wallet);
const transaction = await tbtcGateway.receiveTbtc(
signedVAA,
Expand All @@ -376,14 +376,6 @@ async function solana(
content: <Alert severity="success">Transaction confirmed</Alert>,
});
} else {
await postVaaSolanaWithRetry(
connection,
wallet.signTransaction.bind(wallet),
SOL_BRIDGE_ADDRESS,
payerAddress,
Buffer.from(signedVAA),
MAX_VAA_UPLOAD_RETRIES_SOLANA
);
// TODO: how do we retry in between these steps
const transaction = isNative
? await redeemAndUnwrapOnSolana(
Expand Down

0 comments on commit ff9baa2

Please sign in to comment.