bridge_ui: prep bridge_ui for sdk 0.1.5

This commit is contained in:
Chase Moran 2021-12-15 17:25:13 -05:00 committed by Evan Gray
parent 0233f03a3c
commit 30a9d7410e
4 changed files with 16 additions and 9 deletions

View File

@ -8,7 +8,7 @@ import {
updateWrappedOnEth,
updateWrappedOnTerra,
updateWrappedOnSolana,
postVaaSolana,
postVaaSolanaWithRetry,
isEVMChain,
} from "@certusone/wormhole-sdk";
import { WalletContextState } from "@solana/wallet-adapter-react";
@ -31,6 +31,7 @@ import {
} from "../store/selectors";
import {
getTokenBridgeAddressForChain,
MAX_VAA_UPLOAD_RETRIES_SOLANA,
SOLANA_HOST,
SOL_BRIDGE_ADDRESS,
SOL_TOKEN_BRIDGE_ADDRESS,
@ -90,12 +91,13 @@ async function solana(
throw new Error("wallet.signTransaction is undefined");
}
const connection = new Connection(SOLANA_HOST, "confirmed");
await postVaaSolana(
await postVaaSolanaWithRetry(
connection,
wallet.signTransaction,
SOL_BRIDGE_ADDRESS,
payerAddress,
Buffer.from(signedVAA)
Buffer.from(signedVAA),
MAX_VAA_UPLOAD_RETRIES_SOLANA
);
const transaction = shouldUpdate
? await updateWrappedOnSolana(

View File

@ -5,7 +5,7 @@ import {
hexToUint8Array,
isEVMChain,
parseNFTPayload,
postVaaSolana,
postVaaSolanaWithRetry,
} from "@certusone/wormhole-sdk";
import {
createMetaOnSolana,
@ -28,6 +28,7 @@ import { setIsRedeeming, setRedeemTx } from "../store/nftSlice";
import { selectNFTIsRedeeming, selectNFTTargetChain } from "../store/selectors";
import {
getNFTBridgeAddressForChain,
MAX_VAA_UPLOAD_RETRIES_SOLANA,
SOLANA_HOST,
SOL_BRIDGE_ADDRESS,
SOL_NFT_BRIDGE_ADDRESS,
@ -85,12 +86,13 @@ async function solana(
const claimInfo = await connection.getAccountInfo(claimAddress);
let txid;
if (!claimInfo) {
await postVaaSolana(
await postVaaSolanaWithRetry(
connection,
wallet.signTransaction,
SOL_BRIDGE_ADDRESS,
payerAddress,
Buffer.from(signedVAA)
Buffer.from(signedVAA),
MAX_VAA_UPLOAD_RETRIES_SOLANA
);
// TODO: how do we retry in between these steps
const transaction = await redeemOnSolana(

View File

@ -3,7 +3,7 @@ import {
CHAIN_ID_SOLANA,
CHAIN_ID_TERRA,
isEVMChain,
postVaaSolana,
postVaaSolanaWithRetry,
redeemAndUnwrapOnSolana,
redeemOnEth,
redeemOnEthNative,
@ -30,6 +30,7 @@ import {
import { setIsRedeeming, setRedeemTx } from "../store/transferSlice";
import {
getTokenBridgeAddressForChain,
MAX_VAA_UPLOAD_RETRIES_SOLANA,
SOLANA_HOST,
SOL_BRIDGE_ADDRESS,
SOL_TOKEN_BRIDGE_ADDRESS,
@ -89,12 +90,13 @@ async function solana(
throw new Error("wallet.signTransaction is undefined");
}
const connection = new Connection(SOLANA_HOST, "confirmed");
await postVaaSolana(
await postVaaSolanaWithRetry(
connection,
wallet.signTransaction,
SOL_BRIDGE_ADDRESS,
payerAddress,
Buffer.from(signedVAA)
Buffer.from(signedVAA),
MAX_VAA_UPLOAD_RETRIES_SOLANA
);
// TODO: how do we retry in between these steps
const transaction = isNative

View File

@ -892,3 +892,4 @@ export const getHowToAddToTokenListUrl = (chainId: ChainId) => {
export const SOLANA_TOKEN_METADATA_PROGRAM_URL =
"https://github.com/metaplex-foundation/metaplex/tree/master/rust/token-metadata/program";
export const MAX_VAA_UPLOAD_RETRIES_SOLANA = 5;