bridge_ui: override orion metadata

Change-Id: I8c4a85247e66b8e7bf0071cfa95f27275accbfec
This commit is contained in:
Chase Moran 2021-12-08 21:32:36 -05:00
parent b5d534465c
commit 5b46564bee
5 changed files with 20 additions and 6 deletions

View File

@ -57,6 +57,7 @@ import {
} from "../store/transferSlice"; } from "../store/transferSlice";
import { import {
COVALENT_GET_TOKENS_URL, COVALENT_GET_TOKENS_URL,
logoOverrides,
ROPSTEN_WETH_ADDRESS, ROPSTEN_WETH_ADDRESS,
ROPSTEN_WETH_DECIMALS, ROPSTEN_WETH_DECIMALS,
SOLANA_HOST, SOLANA_HOST,
@ -167,7 +168,7 @@ const createParsedTokenAccountFromCovalent = (
uiAmountString: formatUnits(covalent.balance, covalent.contract_decimals), uiAmountString: formatUnits(covalent.balance, covalent.contract_decimals),
symbol: covalent.contract_ticker_symbol, symbol: covalent.contract_ticker_symbol,
name: covalent.contract_name, name: covalent.contract_name,
logo: covalent.logo_url, logo: logoOverrides.get(covalent.contract_address) || covalent.logo_url,
}; };
}; };

View File

@ -7,6 +7,7 @@ import {
import { TokenInfo } from "@solana/spl-token-registry"; import { TokenInfo } from "@solana/spl-token-registry";
import { useMemo } from "react"; import { useMemo } from "react";
import { DataWrapper, getEmptyDataWrapper } from "../store/helpers"; import { DataWrapper, getEmptyDataWrapper } from "../store/helpers";
import { logoOverrides } from "../utils/consts";
import { Metadata } from "../utils/metaplex"; import { Metadata } from "../utils/metaplex";
import useEvmMetadata, { EvmMetadata } from "./useEvmMetadata"; import useEvmMetadata, { EvmMetadata } from "./useEvmMetadata";
import useMetaplexData from "./useMetaplexData"; import useMetaplexData from "./useMetaplexData";
@ -67,9 +68,9 @@ const constructTerraMetadata = (
const metadata = terraMetadata.data?.get(address); const metadata = terraMetadata.data?.get(address);
const tokenInfo = tokenMap.data?.mainnet[address]; const tokenInfo = tokenMap.data?.mainnet[address];
const obj = { const obj = {
symbol: metadata?.symbol || tokenInfo?.symbol || undefined, symbol: tokenInfo?.symbol || metadata?.symbol || undefined,
logo: metadata?.logo || tokenInfo?.icon || undefined, logo: tokenInfo?.icon || metadata?.logo || undefined,
tokenName: metadata?.tokenName || tokenInfo?.token || undefined, tokenName: tokenInfo?.name || metadata?.tokenName || undefined,
decimals: metadata?.decimals || undefined, decimals: metadata?.decimals || undefined,
}; };
data.set(address, obj); data.set(address, obj);
@ -95,7 +96,7 @@ const constructEthMetadata = (
const meta = metadataMap.data?.get(address); const meta = metadataMap.data?.get(address);
const obj = { const obj = {
symbol: meta?.symbol || undefined, symbol: meta?.symbol || undefined,
logo: meta?.logo || undefined, logo: logoOverrides.get(address) || meta?.logo || undefined,
tokenName: meta?.tokenName || undefined, tokenName: meta?.tokenName || undefined,
decimals: meta?.decimals, decimals: meta?.decimals,
}; };

View File

@ -23,6 +23,7 @@ import {
CHAINS_BY_ID, CHAINS_BY_ID,
COVALENT_GET_TOKENS_URL, COVALENT_GET_TOKENS_URL,
ETH_TOKEN_BRIDGE_ADDRESS, ETH_TOKEN_BRIDGE_ADDRESS,
logoOverrides,
POLYGON_TOKEN_BRIDGE_ADDRESS, POLYGON_TOKEN_BRIDGE_ADDRESS,
SOLANA_HOST, SOLANA_HOST,
SOL_CUSTODY_ADDRESS, SOL_CUSTODY_ADDRESS,
@ -69,7 +70,10 @@ const calcEvmTVL = (covalentReport: any, chainId: ChainId): TVL[] => {
BAD_PRICES_BY_CHAIN[chainId]?.includes(item.contract_address) || BAD_PRICES_BY_CHAIN[chainId]?.includes(item.contract_address) ||
item.quote_rate > 1000000; item.quote_rate > 1000000;
output.push({ output.push({
logo: item.logo_url || undefined, logo:
logoOverrides.get(item.contract_address) ||
item.logo_url ||
undefined,
symbol: item.contract_ticker_symbol || undefined, symbol: item.contract_ticker_symbol || undefined,
name: item.contract_name || undefined, name: item.contract_name || undefined,
amount: formatUnits(item.balance, item.contract_decimals), amount: formatUnits(item.balance, item.contract_decimals),

View File

@ -16,6 +16,7 @@ export type TerraTokenMetadata = {
symbol: string; symbol: string;
token: string; token: string;
icon: string; icon: string;
name?: string;
balance?: string; // populated by native tokens, could move to a type that extends this balance?: string; // populated by native tokens, could move to a type that extends this
}; };

View File

@ -737,3 +737,10 @@ export const AVAILABLE_MARKETS_URL =
export const SOLANA_SYSTEM_PROGRAM_ADDRESS = "11111111111111111111111111111111"; export const SOLANA_SYSTEM_PROGRAM_ADDRESS = "11111111111111111111111111111111";
export const FEATURED_MARKETS_JSON_URL = export const FEATURED_MARKETS_JSON_URL =
"https://raw.githubusercontent.com/certusone/wormhole-token-list/main/src/markets.json"; "https://raw.githubusercontent.com/certusone/wormhole-token-list/main/src/markets.json";
export const logoOverrides = new Map<string, string>([
[
"0x727f064a78dc734d33eec18d5370aef32ffd46e4",
"https://orion.money/assets/ORION-LOGO-2.1-GREEN@256x256.png",
],
]);