Skip to content

Commit ebc8437

Browse files
authored
make lookup case insensitive when resolving custom token symbols (#261)
Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org>
1 parent 402b927 commit ebc8437

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/components/Currency.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,11 @@ export function Currency(props: Props) {
6161
href={`${makeBlockExplorerLink(address, chainId, "address")}`}
6262
className="border text-sm inline-flex gap-2 items-center border-dashed border-dark/50 hover:border-dark rounded-lg px-1 mr-1"
6363
>
64-
{symbolForDisplay}
6564
{hasIcon ? (
66-
<Icon className="w-[16px] h-[16px] inline-block" />
65+
<>
66+
{symbolForDisplay}
67+
<Icon className="w-[16px] h-[16px] inline-block" />
68+
</>
6769
) : (
6870
symbolForDisplay
6971
)}

src/constants/tokens.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import type { Address } from "wagmi";
22

33
// Add chains as we support bridged usdc
4-
const USDC_MAP: {
5-
[key: number]: Record<Address, string>;
6-
} = {
4+
const USDC_MAP: Record<number, Record<Address, string>> = {
75
137: {
86
"0x2791bca1f2de4661ed88a30c99a7a9449aa84174": "USDC.e",
97
},
@@ -14,5 +12,7 @@ export function resolveUsdcSymbol(
1412
address: Address | undefined,
1513
) {
1614
if (!chainId || !address) return;
17-
return USDC_MAP?.[chainId]?.[address];
15+
return Object.entries(USDC_MAP?.[chainId] ?? {})?.find(
16+
([add, _]) => add.toLowerCase() === address.toLowerCase(),
17+
)?.[1];
1818
}

0 commit comments

Comments
 (0)