diff --git a/bridge_ui/src/components/Transfer/Recovery.tsx b/bridge_ui/src/components/Transfer/Recovery.tsx index 3a89ac11..06262dcc 100644 --- a/bridge_ui/src/components/Transfer/Recovery.tsx +++ b/bridge_ui/src/components/Transfer/Recovery.tsx @@ -24,6 +24,7 @@ import { makeStyles, MenuItem, TextField, + Tooltip, Typography, } from "@material-ui/core"; import { Restore } from "@material-ui/icons"; @@ -121,7 +122,6 @@ async function terra(tx: string) { const emitterAddress = await getEmitterAddressTerra( TERRA_TOKEN_BRIDGE_ADDRESS ); - console.log(emitterAddress); const { vaaBytes } = await getSignedVAA( WORMHOLE_RPC_HOST, CHAIN_ID_TERRA, @@ -441,9 +441,11 @@ export default function Recovery({ }, [setOpen]); return ( <> - - - + + + + + Recovery diff --git a/bridge_ui/src/hooks/useGetSourceParsedTokenAccounts.ts b/bridge_ui/src/hooks/useGetSourceParsedTokenAccounts.ts index e68cb783..caf97e29 100644 --- a/bridge_ui/src/hooks/useGetSourceParsedTokenAccounts.ts +++ b/bridge_ui/src/hooks/useGetSourceParsedTokenAccounts.ts @@ -175,7 +175,6 @@ const getSolanaParsedTokenAccounts = ( }) .then( (result) => { - console.log(result); const mappedItems = result.value.map((item) => createParsedTokenAccountFromInfo(item.pubkey, item.account) ); diff --git a/bridge_ui/src/hooks/useIsWalletReady.ts b/bridge_ui/src/hooks/useIsWalletReady.ts index de44f393..e65bffc2 100644 --- a/bridge_ui/src/hooks/useIsWalletReady.ts +++ b/bridge_ui/src/hooks/useIsWalletReady.ts @@ -4,6 +4,7 @@ import { CHAIN_ID_SOLANA, CHAIN_ID_TERRA, } from "@certusone/wormhole-sdk"; +import { hexlify, hexStripZeros } from "@ethersproject/bytes"; import { useConnectedWallet } from "@terra-money/wallet-provider"; import { useMemo } from "react"; import { useEthereumProvider } from "../contexts/EthereumProviderContext"; @@ -43,6 +44,13 @@ function useIsWalletReady(chainId: ChainId): { if (hasCorrectEthNetwork) { return createWalletStatus(true); } else { + if (provider) { + try { + provider.send("wallet_switchEthereumChain", [ + { chainId: hexStripZeros(hexlify(ETH_NETWORK_CHAIN_ID)) }, + ]); + } catch (e) {} + } return createWalletStatus( false, `Wallet is not connected to ${CLUSTER}. Expected Chain ID: ${ETH_NETWORK_CHAIN_ID}` @@ -51,7 +59,14 @@ function useIsWalletReady(chainId: ChainId): { } //TODO bsc return createWalletStatus(false, "Wallet not connected"); - }, [chainId, hasTerraWallet, solPK, hasEthInfo, hasCorrectEthNetwork]); + }, [ + chainId, + hasTerraWallet, + solPK, + hasEthInfo, + hasCorrectEthNetwork, + provider, + ]); } export default useIsWalletReady; diff --git a/bridge_ui/src/store/attestSlice.ts b/bridge_ui/src/store/attestSlice.ts index fab187d4..3ad31395 100644 --- a/bridge_ui/src/store/attestSlice.ts +++ b/bridge_ui/src/store/attestSlice.ts @@ -2,14 +2,8 @@ import { ChainId, CHAIN_ID_ETH, CHAIN_ID_SOLANA, - CHAIN_ID_TERRA, } from "@certusone/wormhole-sdk"; import { createSlice, PayloadAction } from "@reduxjs/toolkit"; -import { - ETH_TEST_TOKEN_ADDRESS, - SOL_TEST_TOKEN_ADDRESS, - TERRA_TEST_TOKEN_ADDRESS, -} from "../utils/consts"; const LAST_STEP = 3; @@ -28,7 +22,7 @@ export interface AttestState { const initialState: AttestState = { activeStep: 0, sourceChain: CHAIN_ID_SOLANA, - sourceAsset: SOL_TEST_TOKEN_ADDRESS, + sourceAsset: "", targetChain: CHAIN_ID_ETH, signedVAAHex: undefined, isSending: false, @@ -51,16 +45,7 @@ export const attestSlice = createSlice({ setSourceChain: (state, action: PayloadAction) => { const prevSourceChain = state.sourceChain; state.sourceChain = action.payload; - // TODO: remove or check env - for testing purposes - if (action.payload === CHAIN_ID_ETH) { - state.sourceAsset = ETH_TEST_TOKEN_ADDRESS; - } - if (action.payload === CHAIN_ID_SOLANA) { - state.sourceAsset = SOL_TEST_TOKEN_ADDRESS; - } - if (action.payload === CHAIN_ID_TERRA) { - state.sourceAsset = TERRA_TEST_TOKEN_ADDRESS; - } + state.sourceAsset = ""; if (state.targetChain === action.payload) { state.targetChain = prevSourceChain; } @@ -74,16 +59,7 @@ export const attestSlice = createSlice({ if (state.sourceChain === action.payload) { state.sourceChain = prevTargetChain; state.activeStep = 0; - // TODO: remove or check env - for testing purposes - if (state.targetChain === CHAIN_ID_ETH) { - state.sourceAsset = ETH_TEST_TOKEN_ADDRESS; - } - if (state.targetChain === CHAIN_ID_SOLANA) { - state.sourceAsset = SOL_TEST_TOKEN_ADDRESS; - } - if (state.targetChain === CHAIN_ID_TERRA) { - state.sourceAsset = TERRA_TEST_TOKEN_ADDRESS; - } + state.sourceAsset = ""; } }, setSignedVAAHex: (state, action: PayloadAction) => { @@ -97,7 +73,11 @@ export const attestSlice = createSlice({ setIsCreating: (state, action: PayloadAction) => { state.isCreating = action.payload; }, - reset: () => initialState, + reset: (state) => ({ + ...initialState, + sourceChain: state.sourceChain, + targetChain: state.targetChain, + }), }, }); diff --git a/bridge_ui/src/store/transferSlice.ts b/bridge_ui/src/store/transferSlice.ts index 3efb1023..1c744933 100644 --- a/bridge_ui/src/store/transferSlice.ts +++ b/bridge_ui/src/store/transferSlice.ts @@ -181,7 +181,11 @@ export const transferSlice = createSlice({ setRedeemTx: (state, action: PayloadAction) => { state.redeemTx = action.payload; }, - reset: () => initialState, + reset: (state) => ({ + ...initialState, + sourceChain: state.sourceChain, + targetChain: state.targetChain, + }), }, });