@@ -2,8 +2,9 @@ import { CopyTextButton } from "@/components/ui/CopyTextButton";
22import { TableCell , TableRow } from "@/components/ui/table" ;
33import { getThirdwebClient } from "@/constants/thirdweb.server" ;
44import { resolveSchemeWithErrorHandler } from "@/lib/resolveSchemeWithErrorHandler" ;
5+ import { getContract } from "thirdweb" ;
56import { defineChain , getChainMetadata } from "thirdweb/chains" ;
6- import { TokenProvider , TokenSymbol } from "thirdweb/react " ;
7+ import { symbol } from "thirdweb/extensions/common " ;
78
89type RouteListRowProps = {
910 originChainId : number ;
@@ -24,95 +25,109 @@ export async function RouteListRow({
2425} : RouteListRowProps ) {
2526 const [
2627 originChain ,
28+ originTokenSymbol ,
2729 destinationChain ,
30+ destinationTokenSymbol ,
2831 resolvedOriginTokenIconUri ,
2932 resolvedDestinationTokenIconUri ,
3033 ] = await Promise . all ( [
3134 // eslint-disable-next-line no-restricted-syntax
3235 getChainMetadata ( defineChain ( originChainId ) ) ,
36+ originTokenAddress === "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"
37+ ? "ETH"
38+ : symbol ( {
39+ contract : getContract ( {
40+ address : originTokenAddress ,
41+ chain : defineChain ( originChainId ) ,
42+ client : getThirdwebClient ( ) ,
43+ } ) ,
44+ } ) . catch ( ( ) => undefined ) ,
3345 // eslint-disable-next-line no-restricted-syntax
3446 getChainMetadata ( defineChain ( destinationChainId ) ) ,
47+ destinationTokenAddress === "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"
48+ ? "ETH"
49+ : symbol ( {
50+ contract : getContract ( {
51+ address : destinationTokenAddress ,
52+ chain : defineChain ( destinationChainId ) ,
53+ client : getThirdwebClient ( ) ,
54+ } ) ,
55+ } ) . catch ( ( ) => undefined ) ,
3556 originTokenIconUri
3657 ? resolveSchemeWithErrorHandler ( {
37- uri : originTokenIconUri ,
38- client : getThirdwebClient ( ) ,
39- } )
58+ uri : originTokenIconUri ,
59+ client : getThirdwebClient ( ) ,
60+ } )
4061 : undefined ,
4162 destinationTokenIconUri
4263 ? resolveSchemeWithErrorHandler ( {
43- uri : destinationTokenIconUri ,
44- client : getThirdwebClient ( ) ,
45- } )
64+ uri : destinationTokenIconUri ,
65+ client : getThirdwebClient ( ) ,
66+ } )
4667 : undefined ,
4768 ] ) ;
4869
4970 return (
5071 < TableRow linkBox className = "hover:bg-accent/50" >
5172 < TableCell >
52- < TokenProvider
53- address = { originTokenAddress }
54- // eslint-disable-next-line no-restricted-syntax
55- chain = { defineChain ( originChainId ) }
56- client = { getThirdwebClient ( ) }
57- >
58- < div className = "flex flex-row items-center gap-4" >
59- < div className = "flex items-center gap-1" >
60- { resolvedOriginTokenIconUri ? (
61- // For now we're using a normal img tag because the domain for these images is unknown
62- < img
63- src = { resolvedOriginTokenIconUri }
64- alt = { originTokenAddress }
65- className = "size-6 rounded-full bg-muted-foreground"
66- />
67- ) : (
68- < div className = "size-6 rounded-full bg-muted-foreground" />
69- ) }
70- < CopyTextButton
71- textToCopy = { originTokenAddress }
72- textToShow = { < TokenSymbol /> }
73- tooltip = "Copy Token Address"
74- className = "relative z-10 text-base"
75- variant = "ghost"
76- copyIconPosition = "right"
73+ < div className = "flex flex-row items-center gap-4" >
74+ < div className = "flex items-center gap-1" >
75+ { resolvedOriginTokenIconUri ? (
76+ // For now we're using a normal img tag because the domain for these images is unknown
77+ < img
78+ src = { resolvedOriginTokenIconUri }
79+ alt = { originTokenAddress }
80+ className = "size-6 rounded-full bg-muted-foreground"
7781 />
78- </ div >
82+ ) : (
83+ < div className = "size-6 rounded-full bg-muted-foreground" />
84+ ) }
85+ < CopyTextButton
86+ textToCopy = { originTokenAddress }
87+ textToShow = {
88+ originTokenSymbol === "ETH"
89+ ? originChain . nativeCurrency . symbol
90+ : originTokenSymbol
91+ }
92+ tooltip = "Copy Token Address"
93+ className = "relative z-10 text-base"
94+ variant = "ghost"
95+ copyIconPosition = "right"
96+ />
7997 </ div >
80- </ TokenProvider >
98+ </ div >
8199 </ TableCell >
82100
83101 < TableCell className = "text-muted-foreground" >
84102 { originChain . name }
85103 </ TableCell >
86104
87105 < TableCell >
88- < TokenProvider
89- address = { destinationTokenAddress }
90- // eslint-disable-next-line no-restricted-syntax
91- chain = { defineChain ( destinationChainId ) }
92- client = { getThirdwebClient ( ) }
93- >
94- < div className = "flex flex-row items-center gap-4" >
95- < div className = "flex items-center gap-1" >
96- { resolvedDestinationTokenIconUri ? (
97- < img
98- src = { resolvedDestinationTokenIconUri }
99- alt = { destinationTokenAddress }
100- className = "size-6 rounded-full bg-muted-foreground"
101- />
102- ) : (
103- < div className = "size-6 rounded-full bg-muted-foreground" />
104- ) }
105- < CopyTextButton
106- textToCopy = { destinationTokenAddress }
107- textToShow = { < TokenSymbol /> }
108- tooltip = "Copy Token Address"
109- className = "relative z-10 text-base"
110- variant = "ghost"
111- copyIconPosition = "right"
106+ < div className = "flex flex-row items-center gap-4" >
107+ < div className = "flex items-center gap-1" >
108+ { resolvedDestinationTokenIconUri ? (
109+ < img
110+ src = { resolvedDestinationTokenIconUri }
111+ alt = { destinationTokenAddress }
112+ className = "size-6 rounded-full bg-muted-foreground"
112113 />
113- </ div >
114+ ) : (
115+ < div className = "size-6 rounded-full bg-muted-foreground" />
116+ ) }
117+ < CopyTextButton
118+ textToCopy = { destinationTokenAddress }
119+ textToShow = {
120+ destinationTokenSymbol === "ETH"
121+ ? destinationChain . nativeCurrency . symbol
122+ : destinationTokenSymbol
123+ }
124+ tooltip = "Copy Token Address"
125+ className = "relative z-10 text-base"
126+ variant = "ghost"
127+ copyIconPosition = "right"
128+ />
114129 </ div >
115- </ TokenProvider >
130+ </ div >
116131 </ TableCell >
117132
118133 < TableCell className = "text-muted-foreground" >
0 commit comments