diff --git a/apps/marginfi-v2-ui/next.config.js b/apps/marginfi-v2-ui/next.config.js index 195129a435..5256c98dc1 100644 --- a/apps/marginfi-v2-ui/next.config.js +++ b/apps/marginfi-v2-ui/next.config.js @@ -25,141 +25,26 @@ let config = withBundleAnalyzer({ net: false, tls: false, child_process: false, - request: false + request: false, }; return config; }, images: { - remotePatterns: [{ - protocol: "https", - hostname: "raw.githubusercontent.com", - port: "", - pathname: "/solana-labs/token-list/main/assets/mainnet/**", - }, - { - protocol: "https", - hostname: "raw.githubusercontent.com", - port: "", - pathname: "/certusone/wormhole-token-list/main/assets/**", - }, - { - protocol: "https", - hostname: "cryptologos.cc", - port: "", - pathname: "/logos/**", - }, - { - protocol: "https", - hostname: "s2.coinmarketcap.com", - port: "", - pathname: "/static/img/coins/64x64/**", - }, - { - protocol: "https", - hostname: "storage.googleapis.com", - port: "", - pathname: "/token-metadata/**", - }, + remotePatterns: [ { protocol: "https", hostname: "storage.googleapis.com", - port: "", - pathname: "/static-marginfi/**", - }, - { - protocol: "https", - hostname: "lh3.googleusercontent.com", - port: "", - pathname: "/**", - }, - { - protocol: "https", - hostname: "pbs.twimg.com", - port: "", - pathname: "/profile_images/**", - }, - { - protocol: "https", - hostname: "arweave.net", - port: "", - pathname: "/**", - }, - { - protocol: "https", - hostname: "shdw-drive.genesysgo.net", - port: "", - pathname: "/**", - }, - { - protocol: "https", - hostname: "solblaze.org", - port: "", - pathname: "/assets/**", - }, - { - protocol: "https", - hostname: "s.gravatar.com", - port: "", - pathname: "/avatar/**", - }, - { - protocol: "https", - hostname: "pyth.network", - port: "", - pathname: "/**", - }, - { - protocol: "https", - hostname: "metadata.jito.network", - port: "", - pathname: "/**", - }, - { - protocol: "https", - hostname: "static.jup.ag", - port: "", - pathname: "/jlp/**", - }, - { - protocol: "https", - hostname: "metadata.jito.network", - port: "", - pathname: "/token/**", - }, - { - protocol: "https", - hostname: "static.jup.ag", - port: "", - pathname: "/jup/**", - }, - { - protocol: "https", - hostname: "bafkreibk3covs5ltyqxa272uodhculbr6kea6betidfwy3ajsav2vjzyum.ipfs.nftstorage.link", - port: "", - pathname: "/**", - }, - { - protocol: "https", - hostname: "static.jup.ag", - port: "", - pathname: "/**", - }, - { - protocol: "https", - hostname: "hivemapper-marketing-public.s3.us-west-2.amazonaws.com", - port: "", - pathname: "/Hivemapper_HONEY_token.png", + pathname: "/mrgn-public/mrgn-token-icons/**", }, ], }, }); -const { - withSentryConfig -} = require("@sentry/nextjs"); +const { withSentryConfig } = require("@sentry/nextjs"); config = withSentryConfig( - config, { + config, + { // For all available options, see: // https://github.com/getsentry/sentry-webpack-plugin#options @@ -168,7 +53,8 @@ config = withSentryConfig( org: "mrgn-labs", project: "marginfi-v2-ui", - }, { + }, + { // For all available options, see: // https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/ @@ -189,4 +75,4 @@ config = withSentryConfig( } ); -module.exports = withPWA(config); \ No newline at end of file +module.exports = withPWA(config); diff --git a/apps/marginfi-v2-ui/src/components/common/ActionBox/ActionBoxTokens.tsx b/apps/marginfi-v2-ui/src/components/common/ActionBox/ActionBoxTokens.tsx index cad6d3ea1c..7893a93962 100644 --- a/apps/marginfi-v2-ui/src/components/common/ActionBox/ActionBoxTokens.tsx +++ b/apps/marginfi-v2-ui/src/components/common/ActionBox/ActionBoxTokens.tsx @@ -9,7 +9,7 @@ import { ExtendedBankInfo, Emissions } from "@mrgnlabs/marginfi-v2-ui-state"; import { LendingModes } from "~/types"; import { useMrgnlendStore, useUiStore } from "~/store"; -import { cn } from "~/utils"; +import { cn, getTokenImageURL } from "~/utils"; import { useWalletContext } from "~/hooks/useWalletContext"; import { Popover, PopoverContent, PopoverTrigger } from "~/components/ui/popover"; @@ -438,7 +438,13 @@ type SelectedBankItemProps = { const SelectedBankItem = ({ rate, bank, lendingMode }: SelectedBankItemProps) => { return ( <> - {bank.meta.tokenName} + {bank.meta.tokenName}

{bank.meta.tokenSymbol}

- {bank.meta.tokenLogoUri && ( - {bank.meta.tokenName} - )} + {bank.meta.tokenName}

{bank.meta.tokenSymbol}

{ {(previousTxn?.bank.meta.tokenSymbol { const bank = sortedBanks.find((bank) => bank.meta.tokenSymbol === variant); if (!bank) return null; - return bank.meta.tokenLogoUri; + return getTokenImageURL(bank.meta.tokenSymbol); }, [variant, sortedBanks]); return ( diff --git a/apps/marginfi-v2-ui/src/components/common/AssetList/NewAssetBanner.tsx b/apps/marginfi-v2-ui/src/components/common/AssetList/NewAssetBanner.tsx index 9be5570aa4..53e7a7f5d5 100644 --- a/apps/marginfi-v2-ui/src/components/common/AssetList/NewAssetBanner.tsx +++ b/apps/marginfi-v2-ui/src/components/common/AssetList/NewAssetBanner.tsx @@ -4,6 +4,7 @@ import Image from "next/image"; import { ActionType, ExtendedBankInfo } from "@mrgnlabs/marginfi-v2-ui-state"; import { LendingModes } from "~/types"; +import { getTokenImageURL } from "~/utils"; import { ActionBoxDialog } from "../ActionBox"; import { Button } from "~/components/ui/button"; @@ -33,7 +34,12 @@ export const NewAssetBanner = ({ bankInfo }: NewAssetBannerProps) => {

- {bankInfo.meta.tokenSymbol} + {bankInfo.meta.tokenSymbol}

${bankInfo.meta.tokenSymbol} is now available on margnfi

diff --git a/apps/marginfi-v2-ui/src/components/common/Portfolio/PortfolioAssetCard.tsx b/apps/marginfi-v2-ui/src/components/common/Portfolio/PortfolioAssetCard.tsx index 9681e106d1..2bdbd532c1 100644 --- a/apps/marginfi-v2-ui/src/components/common/Portfolio/PortfolioAssetCard.tsx +++ b/apps/marginfi-v2-ui/src/components/common/Portfolio/PortfolioAssetCard.tsx @@ -8,7 +8,7 @@ import { usdFormatter, numeralFormatter } from "@mrgnlabs/mrgn-common"; import { ActiveBankInfo, ActionType } from "@mrgnlabs/marginfi-v2-ui-state"; import { LendingModes } from "~/types"; -import { cn } from "~/utils"; +import { cn, getTokenImageURL } from "~/utils"; import { useUiStore } from "~/store"; import { useAssetItemData } from "~/hooks/useAssetItemData"; @@ -56,15 +56,13 @@ export const PortfolioAssetCard = ({ bank, isInLendingMode }: PortfolioAssetCard
- {bank.meta.tokenLogoUri && ( - {bank.meta.tokenSymbol} - )} + {bank.meta.tokenSymbol}
{bank.meta.tokenSymbol}
diff --git a/apps/marginfi-v2-ui/src/components/common/Staking/StakingCard/StakingCard.tsx b/apps/marginfi-v2-ui/src/components/common/Staking/StakingCard/StakingCard.tsx index fc303685c3..55feebbc16 100644 --- a/apps/marginfi-v2-ui/src/components/common/Staking/StakingCard/StakingCard.tsx +++ b/apps/marginfi-v2-ui/src/components/common/Staking/StakingCard/StakingCard.tsx @@ -36,7 +36,7 @@ import { useConnection } from "~/hooks/useConnection"; import { capture } from "~/utils/analytics"; import { SwapMode, useJupiter } from "@jup-ag/react-hook"; import JSBI from "jsbi"; -import { StakeData, usePrevious } from "~/utils"; +import { StakeData, usePrevious, getTokenImageURL } from "~/utils"; import { createJupiterApiClient } from "@jup-ag/api"; import { SettingsModal } from "./SettingsModal"; import { SettingsIcon } from "./SettingsIcon"; @@ -615,17 +615,11 @@ const DropDownButton: FC = ({ const [iconUrl, optionName] = useMemo(() => { if (depositOption.type === "native") { - return [ - "https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/So11111111111111111111111111111111111111112/logo.png", - "SOL", - ]; + return [getTokenImageURL("SOL"), "SOL"]; } else if (depositOption.type === "stake") { - return [ - "https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/So11111111111111111111111111111111111111112/logo.png", - "Stake", - ]; + return [getTokenImageURL("SOL"), "Stake"]; } else { - return [depositOption.tokenData.iconUrl, depositOption.tokenData.symbol]; + return [getTokenImageURL(depositOption.tokenData.symbol), depositOption.tokenData.symbol]; } }, [depositOption]); diff --git a/apps/marginfi-v2-ui/src/components/common/Staking/StakingCard/StakingModal.tsx b/apps/marginfi-v2-ui/src/components/common/Staking/StakingCard/StakingModal.tsx index eb50bc94c1..dc852cc387 100644 --- a/apps/marginfi-v2-ui/src/components/common/Staking/StakingCard/StakingModal.tsx +++ b/apps/marginfi-v2-ui/src/components/common/Staking/StakingCard/StakingModal.tsx @@ -9,7 +9,7 @@ import { DepositOption } from "./StakingCard"; import BN from "bn.js"; import { PublicKey } from "@solana/web3.js"; import InfoIcon from "@mui/icons-material/Info"; -import { StakeData } from "~/utils"; +import { StakeData, getTokenImageURL } from "~/utils"; import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "~/components/ui/tooltip"; interface StakingModalProps { @@ -132,15 +132,7 @@ const TokenList: FC<{ } hover:text-white hover:bg-gray-700 cursor-pointer`} >
- token logo + token logo
{"SOL (native)"} @@ -184,7 +176,13 @@ const TokenList: FC<{ }`} >
- token logo + token logo
{token.address === SOL_MINT.toBase58() ? "SOL (wrapped)" : token.symbol} diff --git a/apps/marginfi-v2-ui/src/components/common/Wallet/Wallet.tsx b/apps/marginfi-v2-ui/src/components/common/Wallet/Wallet.tsx index b5a3a17427..a338668a87 100644 --- a/apps/marginfi-v2-ui/src/components/common/Wallet/Wallet.tsx +++ b/apps/marginfi-v2-ui/src/components/common/Wallet/Wallet.tsx @@ -6,6 +6,7 @@ import { CopyToClipboard } from "react-copy-to-clipboard"; import { shortenAddress, usdFormatter, numeralFormatter, groupedNumberFormatterDyn } from "@mrgnlabs/mrgn-common"; import { useMrgnlendStore, useUiStore, useUserProfileStore } from "~/store"; +import { getTokenImageURL } from "~/utils"; import { useConnection } from "~/hooks/useConnection"; import { useWalletContext } from "~/hooks/useWalletContext"; import { useIsMobile } from "~/hooks/useIsMobile"; @@ -86,7 +87,7 @@ export const Wallet = () => { return { name: isSolBank ? "Solana" : bank.meta.tokenName, - image: bank.meta.tokenLogoUri, + image: getTokenImageURL(bank.meta.tokenSymbol), symbol: bank.meta.tokenSymbol, value: value, valueUSD: valueUSD, diff --git a/apps/marginfi-v2-ui/src/components/desktop/AssetsList/AssetRow/AssetRow.tsx b/apps/marginfi-v2-ui/src/components/desktop/AssetsList/AssetRow/AssetRow.tsx index 651f3d070d..073e594bfe 100644 --- a/apps/marginfi-v2-ui/src/components/desktop/AssetsList/AssetRow/AssetRow.tsx +++ b/apps/marginfi-v2-ui/src/components/desktop/AssetsList/AssetRow/AssetRow.tsx @@ -14,10 +14,10 @@ import { ExtendedBankMetadata, } from "@mrgnlabs/marginfi-v2-ui-state"; import { getPriceWithConfidence, MarginfiAccountWrapper, PriceBias } from "@mrgnlabs/marginfi-client-v2"; -import { AssetRowAction, LSTDialogVariants } from "~/components/common/AssetList"; -import { ActionBoxDialog } from "~/components/common/ActionBox"; +import { useUserProfileStore, useUiStore } from "~/store"; import { LendingModes } from "~/types"; +import { getTokenImageURL, closeBalance, executeLendingAction, MarginfiActionParams, cn } from "~/utils"; import { useAssetItemData } from "~/hooks/useAssetItemData"; import { useIsMobile } from "~/hooks/useIsMobile"; import { @@ -27,10 +27,8 @@ import { IconPyth, IconSwitchboard, } from "~/components/ui/icons"; - -import { useUserProfileStore, useUiStore } from "~/store"; -import { closeBalance, executeLendingAction, MarginfiActionParams, cn } from "~/utils"; - +import { AssetRowAction, LSTDialogVariants } from "~/components/common/AssetList"; +import { ActionBoxDialog } from "~/components/common/ActionBox"; import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "~/components/ui/tooltip"; import { Button } from "~/components/ui/button"; @@ -219,15 +217,13 @@ const AssetRow: React.FC<{ }} >
- {bank.meta.tokenLogoUri && ( - {bank.meta.tokenSymbol} - )} + {`${bank.meta.tokenSymbol}
{bank.meta.tokenSymbol}
@@ -346,22 +342,12 @@ const AssetRow: React.FC<{ - info + info

- info + info MNDE rewards

Eligible for Marinade Earn rewards.

@@ -690,9 +676,12 @@ const LoadingAsset: React.FC<{ isInLendingMode: boolean; bankMetadata: ExtendedB }} >
- {bankMetadata.tokenLogoUri && ( - {bankMetadata.tokenSymbol} - )} + {bankMetadata.tokenSymbol}
{bankMetadata.tokenSymbol}
diff --git a/apps/marginfi-v2-ui/src/utils/mrgnUtils.ts b/apps/marginfi-v2-ui/src/utils/mrgnUtils.ts index 3fe7dd85ea..03aa74547a 100644 --- a/apps/marginfi-v2-ui/src/utils/mrgnUtils.ts +++ b/apps/marginfi-v2-ui/src/utils/mrgnUtils.ts @@ -108,3 +108,7 @@ export function extractErrorString(error: any, fallback?: string): string { return fallback ?? "Unrecognized error"; } + +export function getTokenImageURL(tokenSymbol: string): string { + return `https://storage.googleapis.com/mrgn-public/mrgn-token-icons/${tokenSymbol}.png`; +}