bridge_ui: prefer metaplex metadata over solana token list
Change-Id: I7a287545425852a10c07c594af8e9558317cda02
This commit is contained in:
parent
c600686677
commit
7ad15fbfc4
|
@ -123,7 +123,6 @@ function SendConfirmationContent({
|
||||||
originChain={originChain}
|
originChain={originChain}
|
||||||
targetAsset={targetAsset ?? undefined}
|
targetAsset={targetAsset ?? undefined}
|
||||||
targetChain={targetChain}
|
targetChain={targetChain}
|
||||||
symbol={symbol}
|
|
||||||
/>
|
/>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
<DialogActions>
|
<DialogActions>
|
||||||
|
|
|
@ -90,14 +90,12 @@ export default function TokenWarning({
|
||||||
originChain,
|
originChain,
|
||||||
targetChain,
|
targetChain,
|
||||||
targetAsset,
|
targetAsset,
|
||||||
symbol,
|
|
||||||
}: {
|
}: {
|
||||||
sourceChain?: ChainId;
|
sourceChain?: ChainId;
|
||||||
sourceAsset?: string;
|
sourceAsset?: string;
|
||||||
originChain?: ChainId;
|
originChain?: ChainId;
|
||||||
targetChain?: ChainId;
|
targetChain?: ChainId;
|
||||||
targetAsset?: string;
|
targetAsset?: string;
|
||||||
symbol?: string;
|
|
||||||
}) {
|
}) {
|
||||||
if (
|
if (
|
||||||
!(originChain && targetChain && targetAsset && sourceChain && sourceAsset)
|
!(originChain && targetChain && targetAsset && sourceChain && sourceAsset)
|
||||||
|
@ -109,7 +107,9 @@ export default function TokenWarning({
|
||||||
? sourceAsset.toLowerCase()
|
? sourceAsset.toLowerCase()
|
||||||
: sourceAsset;
|
: sourceAsset;
|
||||||
const isWormholeWrapped = originChain !== targetChain;
|
const isWormholeWrapped = originChain !== targetChain;
|
||||||
const isMultiChain = !!MULTI_CHAIN_TOKENS[sourceChain]?.[searchableAddress];
|
const multichainSymbol =
|
||||||
|
MULTI_CHAIN_TOKENS[sourceChain]?.[searchableAddress] || undefined;
|
||||||
|
const isMultiChain = !!multichainSymbol;
|
||||||
const isRewardsToken =
|
const isRewardsToken =
|
||||||
searchableAddress === "0xae7ab96520de3a18e5e111b5eaab095312d7fe84" &&
|
searchableAddress === "0xae7ab96520de3a18e5e111b5eaab095312d7fe84" &&
|
||||||
sourceChain === CHAIN_ID_ETH;
|
sourceChain === CHAIN_ID_ETH;
|
||||||
|
@ -122,7 +122,7 @@ export default function TokenWarning({
|
||||||
<>
|
<>
|
||||||
{showMultiChainWarning ? (
|
{showMultiChainWarning ? (
|
||||||
<MultichainWarning
|
<MultichainWarning
|
||||||
symbol={symbol || "tokens"}
|
symbol={multichainSymbol || "tokens"}
|
||||||
targetChain={targetChain}
|
targetChain={targetChain}
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
|
@ -17,7 +17,7 @@ export type GenericMetadata = {
|
||||||
symbol?: string;
|
symbol?: string;
|
||||||
logo?: string;
|
logo?: string;
|
||||||
tokenName?: string;
|
tokenName?: string;
|
||||||
decimals?: number;
|
//decimals?: number;
|
||||||
//TODO more items
|
//TODO more items
|
||||||
raw?: any;
|
raw?: any;
|
||||||
};
|
};
|
||||||
|
@ -36,9 +36,9 @@ const constructSolanaMetadata = (
|
||||||
const tokenInfo = solanaTokenMap.data?.find((x) => x.address === address);
|
const tokenInfo = solanaTokenMap.data?.find((x) => x.address === address);
|
||||||
//Both this and the token picker, at present, give priority to the tokenmap
|
//Both this and the token picker, at present, give priority to the tokenmap
|
||||||
const obj = {
|
const obj = {
|
||||||
symbol: tokenInfo?.symbol || metaplex?.data.symbol || undefined,
|
symbol: metaplex?.data?.symbol || tokenInfo?.symbol || undefined,
|
||||||
logo: tokenInfo?.logoURI || metaplex?.data.uri || undefined, //TODO is URI on metaplex actually the logo? If not, where is it?
|
logo: tokenInfo?.logoURI || undefined, //TODO is URI on metaplex actually the logo? If not, where is it?
|
||||||
tokenName: tokenInfo?.name || metaplex?.data.name || undefined,
|
tokenName: metaplex?.data?.name || tokenInfo?.name || undefined,
|
||||||
decimals: tokenInfo?.decimals || undefined, //TODO decimals are actually on the mint, not the metaplex account.
|
decimals: tokenInfo?.decimals || undefined, //TODO decimals are actually on the mint, not the metaplex account.
|
||||||
raw: metaplex,
|
raw: metaplex,
|
||||||
};
|
};
|
||||||
|
|
|
@ -631,12 +631,13 @@ export const VAA_EMITTER_ADDRESSES = [
|
||||||
|
|
||||||
export const WORMHOLE_EXPLORER_BASE = "https://wormholenetwork.com/en/explorer";
|
export const WORMHOLE_EXPLORER_BASE = "https://wormholenetwork.com/en/explorer";
|
||||||
|
|
||||||
export const MULTI_CHAIN_TOKENS: {
|
export type MultiChainInfo = {
|
||||||
[x: number]: { [address: string]: string };
|
[key in ChainId]: { [address: string]: string };
|
||||||
} =
|
};
|
||||||
|
export const MULTI_CHAIN_TOKENS: MultiChainInfo =
|
||||||
//EVM chains should format the addresses to all lowercase
|
//EVM chains should format the addresses to all lowercase
|
||||||
CLUSTER === "mainnet"
|
CLUSTER === "mainnet"
|
||||||
? {
|
? ({
|
||||||
[CHAIN_ID_SOLANA]: {
|
[CHAIN_ID_SOLANA]: {
|
||||||
EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v: "USDC",
|
EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v: "USDC",
|
||||||
Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB: "USDT",
|
Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB: "USDT",
|
||||||
|
@ -654,12 +655,16 @@ export const MULTI_CHAIN_TOKENS: {
|
||||||
"0x2791bca1f2de4661ed88a30c99a7a9449aa84174": "USDC",
|
"0x2791bca1f2de4661ed88a30c99a7a9449aa84174": "USDC",
|
||||||
"0xc2132d05d31c914a87c6611c10748aeb04b58e8f": "USDT",
|
"0xc2132d05d31c914a87c6611c10748aeb04b58e8f": "USDT",
|
||||||
},
|
},
|
||||||
}
|
} as MultiChainInfo)
|
||||||
: {
|
: ({
|
||||||
[CHAIN_ID_SOLANA]: {
|
[CHAIN_ID_SOLANA]: {
|
||||||
"2WDq7wSs9zYrpx2kbHDA4RUTRch2CCTP6ZWaH4GNfnQQ": "SOLT",
|
"2WDq7wSs9zYrpx2kbHDA4RUTRch2CCTP6ZWaH4GNfnQQ": "SOLT",
|
||||||
},
|
},
|
||||||
};
|
[CHAIN_ID_ETH]: {},
|
||||||
|
[CHAIN_ID_TERRA]: {},
|
||||||
|
[CHAIN_ID_BSC]: {},
|
||||||
|
[CHAIN_ID_POLYGON]: {},
|
||||||
|
} as MultiChainInfo);
|
||||||
|
|
||||||
export const AVAILABLE_MARKETS_URL =
|
export const AVAILABLE_MARKETS_URL =
|
||||||
"https://docs.wormholenetwork.com/wormhole/overview-liquid-markets";
|
"https://docs.wormholenetwork.com/wormhole/overview-liquid-markets";
|
||||||
|
|
Loading…
Reference in New Issue