fix gas for NFT minting

This commit is contained in:
Shunji Zhan 2022-04-24 12:25:15 +08:00 committed by Evan Gray
parent a3886e3c20
commit 205f47b509
1 changed files with 14 additions and 1 deletions

View File

@ -1,5 +1,7 @@
import {
ChainId,
CHAIN_ID_ACALA,
CHAIN_ID_KARURA,
CHAIN_ID_SOLANA,
getClaimAddressSolana,
hexToUint8Array,
@ -26,12 +28,15 @@ import { useSolanaWallet } from "../contexts/SolanaWalletContext";
import { setIsRedeeming, setRedeemTx } from "../store/nftSlice";
import { selectNFTIsRedeeming, selectNFTTargetChain } from "../store/selectors";
import {
ACALA_HOST,
getNFTBridgeAddressForChain,
KARURA_HOST,
MAX_VAA_UPLOAD_RETRIES_SOLANA,
SOLANA_HOST,
SOL_BRIDGE_ADDRESS,
SOL_NFT_BRIDGE_ADDRESS,
} from "../utils/consts";
import { getKaruraGasParams } from "../utils/karura";
import { getMetadataAddress } from "../utils/metaplex";
import parseError from "../utils/parseError";
import { postVaaWithRetry } from "../utils/postVaa";
@ -47,10 +52,18 @@ async function evm(
) {
dispatch(setIsRedeeming(true));
try {
// Karura and Acala need gas params for NFT minting
const overrides =
chainId === CHAIN_ID_KARURA
? await getKaruraGasParams(KARURA_HOST)
: chainId === CHAIN_ID_ACALA
? await getKaruraGasParams(ACALA_HOST)
: {};
const receipt = await redeemOnEth(
getNFTBridgeAddressForChain(chainId),
signer,
signedVAA
signedVAA,
overrides
);
dispatch(
setRedeemTx({ id: receipt.transactionHash, block: receipt.blockNumber })