bridge_ui: fix solana nft target address display
Change-Id: I2e0f8a2c3e500ddd5f7294cb9e3030b9af8260ed
This commit is contained in:
parent
baae287ca8
commit
25d98e8500
|
@ -1,13 +1,18 @@
|
|||
import { CHAIN_ID_ETH, CHAIN_ID_SOLANA } from "@certusone/wormhole-sdk";
|
||||
import { makeStyles, MenuItem, TextField, Typography } from "@material-ui/core";
|
||||
import { Alert } from "@material-ui/lab";
|
||||
import { PublicKey } from "@solana/web3.js";
|
||||
import { BigNumber, ethers } from "ethers";
|
||||
import { useCallback, useMemo } from "react";
|
||||
import { ethers } from "ethers";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import useIsWalletReady from "../../hooks/useIsWalletReady";
|
||||
import useSyncTargetAddress from "../../hooks/useSyncTargetAddress";
|
||||
import { EthGasEstimateSummary } from "../../hooks/useTransactionFees";
|
||||
import { incrementStep, setTargetChain } from "../../store/nftSlice";
|
||||
import {
|
||||
selectNFTIsTargetComplete,
|
||||
selectNFTOriginAsset,
|
||||
selectNFTOriginChain,
|
||||
selectNFTOriginTokenId,
|
||||
selectNFTShouldLockFields,
|
||||
selectNFTSourceChain,
|
||||
|
@ -17,14 +22,12 @@ import {
|
|||
selectNFTTargetChain,
|
||||
selectNFTTargetError,
|
||||
} from "../../store/selectors";
|
||||
import { hexToNativeString } from "../../utils/array";
|
||||
import { hexToNativeString, hexToUint8Array } from "../../utils/array";
|
||||
import { CHAINS, CHAINS_BY_ID } from "../../utils/consts";
|
||||
import ButtonWithLoader from "../ButtonWithLoader";
|
||||
import KeyAndBalance from "../KeyAndBalance";
|
||||
import StepDescription from "../StepDescription";
|
||||
import LowBalanceWarning from "../LowBalanceWarning";
|
||||
import { Alert } from "@material-ui/lab";
|
||||
import { EthGasEstimateSummary } from "../../hooks/useTransactionFees";
|
||||
import StepDescription from "../StepDescription";
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
transferField: {
|
||||
|
@ -47,7 +50,20 @@ function Target() {
|
|||
const targetChain = useSelector(selectNFTTargetChain);
|
||||
const targetAddressHex = useSelector(selectNFTTargetAddressHex);
|
||||
const targetAsset = useSelector(selectNFTTargetAsset);
|
||||
const originChain = useSelector(selectNFTOriginChain);
|
||||
const originAsset = useSelector(selectNFTOriginAsset);
|
||||
const originTokenId = useSelector(selectNFTOriginTokenId);
|
||||
let tokenId;
|
||||
try {
|
||||
tokenId =
|
||||
originChain === CHAIN_ID_SOLANA && originAsset
|
||||
? BigNumber.from(
|
||||
new PublicKey(hexToUint8Array(originAsset)).toBytes()
|
||||
).toString()
|
||||
: originTokenId;
|
||||
} catch (e) {
|
||||
tokenId = originTokenId;
|
||||
}
|
||||
const readableTargetAddress =
|
||||
hexToNativeString(targetAddressHex, targetChain) || "";
|
||||
const uiAmountString = useSelector(selectNFTTargetBalanceString);
|
||||
|
@ -105,7 +121,7 @@ function Target() {
|
|||
label="TokenId"
|
||||
fullWidth
|
||||
className={classes.transferField}
|
||||
value={originTokenId || ""}
|
||||
value={tokenId || ""}
|
||||
disabled={true}
|
||||
/>
|
||||
) : null}
|
||||
|
|
|
@ -25,7 +25,6 @@ export async function getSignedVAAWithRetry(
|
|||
sequence
|
||||
);
|
||||
} catch (e) {
|
||||
console.log(`Attempt ${attempts}: `, e);
|
||||
if (retryAttempts !== undefined && attempts > retryAttempts) {
|
||||
throw e;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue