bridge_ui: update migration assets
Change-Id: I7c2adf547a8a386570b5644bf355d7356bfe04cc
This commit is contained in:
parent
2645b547da
commit
835d9bee7f
|
@ -84,7 +84,6 @@ const getBalance = async (
|
||||||
const info = await connection.getParsedAccountInfo(pk);
|
const info = await connection.getParsedAccountInfo(pk);
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const balance = info.value?.data.parsed.info.tokenAmount.uiAmountString;
|
const balance = info.value?.data.parsed.info.tokenAmount.uiAmountString;
|
||||||
console.log(`${address} has a balance of ${balance}`);
|
|
||||||
setter(balance);
|
setter(balance);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(`Unable to determine balance of ${address}`);
|
console.log(`Unable to determine balance of ${address}`);
|
||||||
|
@ -194,7 +193,7 @@ export default function Workflow({
|
||||||
if (toCustodyAddress) {
|
if (toCustodyAddress) {
|
||||||
getBalance(connection, toCustodyAddress, setToCustodyBalance);
|
getBalance(connection, toCustodyAddress, setToCustodyBalance);
|
||||||
} else {
|
} else {
|
||||||
setToCustodyAddress(undefined);
|
setToCustodyBalance(undefined);
|
||||||
}
|
}
|
||||||
}, [connection, toCustodyAddress, setToCustodyBalance]);
|
}, [connection, toCustodyAddress, setToCustodyBalance]);
|
||||||
|
|
||||||
|
@ -242,9 +241,17 @@ export default function Workflow({
|
||||||
|
|
||||||
//Set relevant information derived from poolAddress
|
//Set relevant information derived from poolAddress
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getToCustodyAddress(MIGRATION_PROGRAM_ADDRESS, poolAddress).then(
|
if (poolAddress) {
|
||||||
(result: any) => setToCustodyAddress(new PublicKey(result).toString())
|
getToCustodyAddress(MIGRATION_PROGRAM_ADDRESS, poolAddress)
|
||||||
);
|
.then((result: any) =>
|
||||||
|
setToCustodyAddress(new PublicKey(result).toString())
|
||||||
|
)
|
||||||
|
.catch((e) => {
|
||||||
|
setToCustodyAddress(undefined);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
setToCustodyAddress(undefined);
|
||||||
|
}
|
||||||
}, [poolAddress]);
|
}, [poolAddress]);
|
||||||
|
|
||||||
//Set the associated token accounts when the designated mint changes
|
//Set the associated token accounts when the designated mint changes
|
||||||
|
@ -338,8 +345,6 @@ export default function Workflow({
|
||||||
fromParse(migrationAmount) <= fromParse(fromTokenAccountBalance) &&
|
fromParse(migrationAmount) <= fromParse(fromTokenAccountBalance) &&
|
||||||
parseFloat(migrationAmount) <= parseFloat(toCustodyBalance);
|
parseFloat(migrationAmount) <= parseFloat(toCustodyBalance);
|
||||||
|
|
||||||
console.log("rendered");
|
|
||||||
|
|
||||||
const isReadyToTransfer =
|
const isReadyToTransfer =
|
||||||
isReady && sufficientBalances && accountsReady && hasRequisiteData;
|
isReady && sufficientBalances && accountsReady && hasRequisiteData;
|
||||||
|
|
||||||
|
@ -429,6 +434,21 @@ export default function Workflow({
|
||||||
associatedAccountExists={toTokenAccountExists}
|
associatedAccountExists={toTokenAccountExists}
|
||||||
setAssociatedAccountExists={setToTokenAccountExists}
|
setAssociatedAccountExists={setToTokenAccountExists}
|
||||||
/>
|
/>
|
||||||
|
{poolAddress && toCustodyAddress && toCustodyBalance ? (
|
||||||
|
<>
|
||||||
|
<div className={classes.spacer} />
|
||||||
|
<Typography variant="body2">
|
||||||
|
Using pool {shortenAddress(poolAddress)} holding tokens in
|
||||||
|
this account:
|
||||||
|
</Typography>
|
||||||
|
<Typography variant="h5">
|
||||||
|
{shortenAddress(toCustodyAddress) +
|
||||||
|
` (Balance: ${toCustodyBalance}${
|
||||||
|
toMetadata.symbol && " " + toMetadata.symbol
|
||||||
|
})`}
|
||||||
|
</Typography>
|
||||||
|
</>
|
||||||
|
) : null}
|
||||||
</>
|
</>
|
||||||
) : null}
|
) : null}
|
||||||
<div className={classes.spacer} />
|
<div className={classes.spacer} />
|
||||||
|
|
|
@ -25,7 +25,11 @@ const MigrationRoot: React.FC<Migration> = (props) => {
|
||||||
if (fromMint && toMint) {
|
if (fromMint && toMint) {
|
||||||
return <Workflow fromMint={fromMint} toMint={toMint} />;
|
return <Workflow fromMint={fromMint} toMint={toMint} />;
|
||||||
} else {
|
} else {
|
||||||
return <Typography>This asset is not eligible for migration.</Typography>;
|
return (
|
||||||
|
<Typography style={{ textAlign: "center" }}>
|
||||||
|
This asset is not eligible for migration.
|
||||||
|
</Typography>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@ import {
|
||||||
import EthereumSourceTokenSelector from "./EthereumSourceTokenSelector";
|
import EthereumSourceTokenSelector from "./EthereumSourceTokenSelector";
|
||||||
import SolanaSourceTokenSelector from "./SolanaSourceTokenSelector";
|
import SolanaSourceTokenSelector from "./SolanaSourceTokenSelector";
|
||||||
import TerraSourceTokenSelector from "./TerraSourceTokenSelector";
|
import TerraSourceTokenSelector from "./TerraSourceTokenSelector";
|
||||||
|
import RefreshButtonWrapper from "./RefreshButtonWrapper";
|
||||||
|
|
||||||
type TokenSelectorProps = {
|
type TokenSelectorProps = {
|
||||||
disabled: boolean;
|
disabled: boolean;
|
||||||
|
@ -73,6 +74,7 @@ export const TokenSelector = (props: TokenSelectorProps) => {
|
||||||
);
|
);
|
||||||
|
|
||||||
const maps = useGetSourceParsedTokens(nft);
|
const maps = useGetSourceParsedTokens(nft);
|
||||||
|
const resetAccountWrapper = maps?.resetAccounts || (() => {}); //This should never happen.
|
||||||
|
|
||||||
//This is only for errors so bad that we shouldn't even mount the component
|
//This is only for errors so bad that we shouldn't even mount the component
|
||||||
const fatalError =
|
const fatalError =
|
||||||
|
@ -81,7 +83,9 @@ export const TokenSelector = (props: TokenSelectorProps) => {
|
||||||
maps?.tokenAccounts?.error; //Terra & ETH can proceed because it has advanced mode
|
maps?.tokenAccounts?.error; //Terra & ETH can proceed because it has advanced mode
|
||||||
|
|
||||||
const content = fatalError ? (
|
const content = fatalError ? (
|
||||||
|
<RefreshButtonWrapper callback={resetAccountWrapper}>
|
||||||
<Typography>{fatalError}</Typography>
|
<Typography>{fatalError}</Typography>
|
||||||
|
</RefreshButtonWrapper>
|
||||||
) : lookupChain === CHAIN_ID_SOLANA ? (
|
) : lookupChain === CHAIN_ID_SOLANA ? (
|
||||||
<SolanaSourceTokenSelector
|
<SolanaSourceTokenSelector
|
||||||
value={sourceParsedTokenAccount || null}
|
value={sourceParsedTokenAccount || null}
|
||||||
|
|
|
@ -218,9 +218,96 @@ export const MIGRATION_PROGRAM_ADDRESS =
|
||||||
? ""
|
? ""
|
||||||
: "Ex9bCdVMSfx7EzB3pgSi2R4UHwJAXvTw18rBQm5YQ8gK";
|
: "Ex9bCdVMSfx7EzB3pgSi2R4UHwJAXvTw18rBQm5YQ8gK";
|
||||||
|
|
||||||
export const MIGRATION_ASSET_MAP = new Map<string, string>([
|
export const MIGRATION_ASSET_MAP = new Map<string, string>(
|
||||||
|
CLUSTER === "mainnet"
|
||||||
|
? [
|
||||||
[
|
[
|
||||||
"2WDq7wSs9zYrpx2kbHDA4RUTRch2CCTP6ZWaH4GNfnQQ",
|
// HUSD
|
||||||
"ApgUoB1467PXXofoLWFELH2Kz9DKB8WXdU2szGSsFKhX",
|
"BybpSTBoZHsmKnfxYG47GDhVPKrnEKX31CScShbrzUhX",
|
||||||
|
"7VQo3HFLNH5QqGtM8eC3XQbPkJUu7nS9LeGWjerRh5Sw",
|
||||||
],
|
],
|
||||||
]);
|
[
|
||||||
|
// BUSD
|
||||||
|
"AJ1W9A9N9dEMdVyoDiam2rV44gnBm2csrPDP7xqcapgX",
|
||||||
|
"33fsBLA8djQm82RpHmE3SuVrPGtZBWNYExsEUeKX1HXX",
|
||||||
|
],
|
||||||
|
[
|
||||||
|
// HBTC
|
||||||
|
"8pBc4v9GAwCBNWPB5XKA93APexMGAS4qMr37vNke9Ref",
|
||||||
|
"7dVH61ChzgmN9BwG4PkzwRP8PbYwPJ7ZPNF2vamKT2H8",
|
||||||
|
],
|
||||||
|
[
|
||||||
|
// DAI
|
||||||
|
"FYpdBuyAHSbdaAyD1sKkxyLWbAP8uUW9h6uvdhK74ij1",
|
||||||
|
"EjmyN6qEC1Tf1JxiG1ae7UTJhUxSwk1TCWNWqxWV4J6o",
|
||||||
|
],
|
||||||
|
[
|
||||||
|
// FRAX
|
||||||
|
"8L8pDf3jutdpdr4m3np68CL9ZroLActrqwxi6s9Ah5xU",
|
||||||
|
"FR87nWEUxVgerFGhZM8Y4AggKGLnaXswr1Pd8wZ4kZcp",
|
||||||
|
],
|
||||||
|
[
|
||||||
|
// USDK
|
||||||
|
"2kycGCD8tJbrjJJqWN2Qz5ysN9iB4Bth3Uic4mSB7uak",
|
||||||
|
"43m2ewFV5nDepieFjT9EmAQnc1HRtAF247RBpLGFem5F",
|
||||||
|
],
|
||||||
|
[
|
||||||
|
// UST
|
||||||
|
"CXLBjMMcwkc17GfJtBos6rQCo1ypeH6eDbB82Kby4MRm",
|
||||||
|
"5Un6AdG9GBjxVhTSvvt2x6X6vtN1zrDxkkDpDcShnHfF",
|
||||||
|
],
|
||||||
|
[
|
||||||
|
// Wrapped LUNA
|
||||||
|
"2Xf2yAXJfg82sWwdLUo2x9mZXy6JCdszdMZkcF1Hf4KV",
|
||||||
|
"EQTV1LW23Mgtjb5LXSg9NGw1J32oqTV4HCPmHCVSGmqD",
|
||||||
|
],
|
||||||
|
[
|
||||||
|
// FTT
|
||||||
|
"GbBWwtYTMPis4VHb8MrBbdibPhn28TSrLB53KvUmb7Gi",
|
||||||
|
"EzfgjvkSwthhgHaceR3LnKXUoRkP6NUhfghdaHAj1tUv",
|
||||||
|
],
|
||||||
|
[
|
||||||
|
// SRM
|
||||||
|
"2jXy799YnEcRXneFo2GEAB6SDRsAa767HpWmktRr1DaP",
|
||||||
|
"xnorPhAzWXUczCP3KjU5yDxmKKZi5cSbxytQ1LgE3kG",
|
||||||
|
],
|
||||||
|
[
|
||||||
|
// FTT (Sollet)
|
||||||
|
"AGFEad2et2ZJif9jaGpdMixQqvW5i81aBdvKe7PHNfz3",
|
||||||
|
"EzfgjvkSwthhgHaceR3LnKXUoRkP6NUhfghdaHAj1tUv",
|
||||||
|
],
|
||||||
|
[
|
||||||
|
// WETH (Sollet)
|
||||||
|
"2FPyTwcZLUg1MDrwsyoP4D6s1tM7hAkHYRjkNb5w6Pxk",
|
||||||
|
"7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs",
|
||||||
|
],
|
||||||
|
[
|
||||||
|
// UNI (Sollet)
|
||||||
|
"DEhAasscXF4kEGxFgJ3bq4PpVGp5wyUxMRvn6TzGVHaw",
|
||||||
|
"8FU95xFJhUUkyyCLU13HSzDLs7oC4QZdXQHL6SCeab36",
|
||||||
|
],
|
||||||
|
[
|
||||||
|
// HXRO (Sollet)
|
||||||
|
"DJafV9qemGp7mLMEn5wrfqaFwxsbLgUsGVS16zKRk9kc",
|
||||||
|
"HxhWkVpk5NS4Ltg5nij2G671CKXFRKPK8vy271Ub4uEK",
|
||||||
|
],
|
||||||
|
[
|
||||||
|
// ALEPH (Sollet)
|
||||||
|
"CsZ5LZkDS7h9TDKjrbL7VAwQZ9nsRu8vJLhRYfmGaN8K",
|
||||||
|
"3UCMiSnkcnkPE1pgQ5ggPCBv6dXgVUy16TmMUe1WpG9x",
|
||||||
|
],
|
||||||
|
[
|
||||||
|
// TOMOE (Sollet)
|
||||||
|
"GXMvfY2jpQctDqZ9RoU3oWPhufKiCcFEfchvYumtX7jd",
|
||||||
|
"46AiRdka3HYGkhV6r9gyS6Teo9cojfGXfK8oniALYMZx",
|
||||||
|
],
|
||||||
|
]
|
||||||
|
: CLUSTER === "testnet"
|
||||||
|
? []
|
||||||
|
: [
|
||||||
|
// [
|
||||||
|
// "2WDq7wSs9zYrpx2kbHDA4RUTRch2CCTP6ZWaH4GNfnQQ",
|
||||||
|
// "ApgUoB1467PXXofoLWFELH2Kz9DKB8WXdU2szGSsFKhX",
|
||||||
|
// ],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
Loading…
Reference in New Issue