0xtrails 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/dist/address.d.ts.map +1 -1
  2. package/dist/analytics.d.ts +86 -1
  3. package/dist/analytics.d.ts.map +1 -1
  4. package/dist/apiClient.d.ts +1 -1
  5. package/dist/apiClient.d.ts.map +1 -1
  6. package/dist/{ccip-BmFTEOaB.js → ccip-dLSEJjCf.js} +55 -55
  7. package/dist/cctpqueue.d.ts +1 -1
  8. package/dist/cctpqueue.d.ts.map +1 -1
  9. package/dist/chains.d.ts +9 -3
  10. package/dist/chains.d.ts.map +1 -1
  11. package/dist/constants.d.ts +1 -0
  12. package/dist/constants.d.ts.map +1 -1
  13. package/dist/decoders.d.ts +58 -0
  14. package/dist/decoders.d.ts.map +1 -0
  15. package/dist/ens.d.ts +13 -0
  16. package/dist/ens.d.ts.map +1 -0
  17. package/dist/error.d.ts +9 -0
  18. package/dist/error.d.ts.map +1 -1
  19. package/dist/{index-BPsVj7zK.js → index-BXbaLmtt.js} +28779 -25738
  20. package/dist/index.js +2 -2
  21. package/dist/intents.d.ts +4 -4
  22. package/dist/intents.d.ts.map +1 -1
  23. package/dist/lifi.d.ts +4 -0
  24. package/dist/lifi.d.ts.map +1 -0
  25. package/dist/metaTxns.d.ts +1 -1
  26. package/dist/metaTxns.d.ts.map +1 -1
  27. package/dist/mode.d.ts +1 -1
  28. package/dist/mode.d.ts.map +1 -1
  29. package/dist/preconditions.d.ts +1 -1
  30. package/dist/preconditions.d.ts.map +1 -1
  31. package/dist/prepareSend.d.ts +32 -24
  32. package/dist/prepareSend.d.ts.map +1 -1
  33. package/dist/prices.d.ts +3 -1
  34. package/dist/prices.d.ts.map +1 -1
  35. package/dist/proxyCaller.d.ts +0 -1
  36. package/dist/proxyCaller.d.ts.map +1 -1
  37. package/dist/relaySdk.d.ts.map +1 -1
  38. package/dist/relayer.d.ts.map +1 -1
  39. package/dist/tokenBalances.d.ts +1 -1
  40. package/dist/tokenBalances.d.ts.map +1 -1
  41. package/dist/tokens.d.ts +2 -1
  42. package/dist/tokens.d.ts.map +1 -1
  43. package/dist/trails.d.ts +4 -4
  44. package/dist/trails.d.ts.map +1 -1
  45. package/dist/transactions.d.ts +4 -0
  46. package/dist/transactions.d.ts.map +1 -1
  47. package/dist/utils.d.ts +6 -0
  48. package/dist/utils.d.ts.map +1 -1
  49. package/dist/wallets.d.ts +247 -5
  50. package/dist/wallets.d.ts.map +1 -1
  51. package/dist/widget/components/ChainFilterDropdown.d.ts +2 -0
  52. package/dist/widget/components/ChainFilterDropdown.d.ts.map +1 -1
  53. package/dist/widget/components/ConnectWallet.d.ts +1 -0
  54. package/dist/widget/components/ConnectWallet.d.ts.map +1 -1
  55. package/dist/widget/components/DebugScreensDropdown.d.ts.map +1 -1
  56. package/dist/widget/components/ErrorDisplay.d.ts +9 -0
  57. package/dist/widget/components/ErrorDisplay.d.ts.map +1 -0
  58. package/dist/widget/components/FundSendForm.d.ts +2 -2
  59. package/dist/widget/components/FundSendForm.d.ts.map +1 -1
  60. package/dist/widget/components/OriginTransferInformation.d.ts +10 -0
  61. package/dist/widget/components/OriginTransferInformation.d.ts.map +1 -0
  62. package/dist/widget/components/PaySendForm.d.ts +2 -2
  63. package/dist/widget/components/PaySendForm.d.ts.map +1 -1
  64. package/dist/widget/components/QrCode.d.ts +1 -1
  65. package/dist/widget/components/QrCode.d.ts.map +1 -1
  66. package/dist/widget/components/QuoteDetails.d.ts.map +1 -1
  67. package/dist/widget/components/Receipt.d.ts.map +1 -1
  68. package/dist/widget/components/Receive.d.ts +12 -0
  69. package/dist/widget/components/Receive.d.ts.map +1 -0
  70. package/dist/widget/components/RefundAddressInput.d.ts +13 -0
  71. package/dist/widget/components/RefundAddressInput.d.ts.map +1 -0
  72. package/dist/widget/components/Swap.d.ts +47 -0
  73. package/dist/widget/components/Swap.d.ts.map +1 -0
  74. package/dist/widget/components/SwapDisplay.d.ts +9 -0
  75. package/dist/widget/components/SwapDisplay.d.ts.map +1 -0
  76. package/dist/widget/components/TokenList.d.ts +0 -2
  77. package/dist/widget/components/TokenList.d.ts.map +1 -1
  78. package/dist/widget/components/TokenSelector.d.ts +26 -0
  79. package/dist/widget/components/TokenSelector.d.ts.map +1 -0
  80. package/dist/widget/components/TransferPendingVertical.d.ts +2 -0
  81. package/dist/widget/components/TransferPendingVertical.d.ts.map +1 -1
  82. package/dist/widget/components/WalletConnect.d.ts.map +1 -1
  83. package/dist/widget/components/WalletConnectionPending.d.ts +12 -0
  84. package/dist/widget/components/WalletConnectionPending.d.ts.map +1 -0
  85. package/dist/widget/components/WalletList.d.ts.map +1 -1
  86. package/dist/widget/components/YellowWarningAnimation.d.ts +2 -0
  87. package/dist/widget/components/YellowWarningAnimation.d.ts.map +1 -0
  88. package/dist/widget/hooks/useAmountUsd.d.ts +1 -3
  89. package/dist/widget/hooks/useAmountUsd.d.ts.map +1 -1
  90. package/dist/widget/hooks/useCheckout.d.ts.map +1 -1
  91. package/dist/widget/hooks/useDebugScreens.d.ts +22 -0
  92. package/dist/widget/hooks/useDebugScreens.d.ts.map +1 -0
  93. package/dist/widget/hooks/useSendForm.d.ts +12 -6
  94. package/dist/widget/hooks/useSendForm.d.ts.map +1 -1
  95. package/dist/widget/hooks/useTokenList.d.ts +2 -3
  96. package/dist/widget/hooks/useTokenList.d.ts.map +1 -1
  97. package/dist/widget/index.js +1 -1
  98. package/dist/widget/widget.d.ts.map +1 -1
  99. package/package.json +19 -15
  100. package/src/aave.ts +13 -13
  101. package/src/address.ts +3 -0
  102. package/src/analytics.ts +192 -8
  103. package/src/apiClient.ts +1 -1
  104. package/src/cctpqueue.ts +1 -1
  105. package/src/chains.ts +45 -7
  106. package/src/constants.ts +7 -4
  107. package/src/decoders.ts +310 -0
  108. package/src/ens.ts +32 -0
  109. package/src/error.ts +101 -1
  110. package/src/intents.ts +10 -2
  111. package/src/lifi.ts +58 -0
  112. package/src/metaTxns.ts +1 -1
  113. package/src/mode.ts +1 -1
  114. package/src/morpho.ts +3 -3
  115. package/src/pools.ts +18 -18
  116. package/src/preconditions.ts +1 -1
  117. package/src/prepareSend.ts +463 -113
  118. package/src/prices.ts +26 -1
  119. package/src/proxyCaller.ts +2 -14
  120. package/src/relaySdk.ts +1 -0
  121. package/src/relayer.ts +8 -0
  122. package/src/tokenBalances.ts +24 -17
  123. package/src/tokens.ts +147 -22
  124. package/src/trails.ts +4 -4
  125. package/src/transactions.ts +35 -17
  126. package/src/utils.ts +28 -0
  127. package/src/wallets.ts +275 -35
  128. package/src/widget/compiled.css +2 -2
  129. package/src/widget/components/ChainFilterDropdown.tsx +42 -33
  130. package/src/widget/components/ChainImage.tsx +1 -1
  131. package/src/widget/components/ConnectWallet.tsx +92 -128
  132. package/src/widget/components/DebugScreensDropdown.tsx +6 -0
  133. package/src/widget/components/ErrorDisplay.tsx +150 -0
  134. package/src/widget/components/FundSendForm.tsx +78 -11
  135. package/src/widget/components/OriginTransferInformation.tsx +59 -0
  136. package/src/widget/components/PaySendForm.tsx +80 -13
  137. package/src/widget/components/QRCodeDeposit.tsx +6 -6
  138. package/src/widget/components/QrCode.tsx +278 -17
  139. package/src/widget/components/QuoteDetails.tsx +93 -25
  140. package/src/widget/components/Receipt.tsx +296 -103
  141. package/src/widget/components/Receive.tsx +146 -0
  142. package/src/widget/components/RecentTokens.tsx +1 -1
  143. package/src/widget/components/RefundAddressInput.tsx +149 -0
  144. package/src/widget/components/Swap.tsx +769 -0
  145. package/src/widget/components/SwapDisplay.tsx +68 -0
  146. package/src/widget/components/TokenList.tsx +27 -363
  147. package/src/widget/components/TokenSelector.tsx +405 -0
  148. package/src/widget/components/TransferPendingVertical.tsx +162 -112
  149. package/src/widget/components/WalletConnect.tsx +9 -7
  150. package/src/widget/components/WalletConnectionPending.tsx +157 -0
  151. package/src/widget/components/WalletList.tsx +6 -5
  152. package/src/widget/components/YellowWarningAnimation.tsx +146 -0
  153. package/src/widget/hooks/useAmountUsd.ts +3 -8
  154. package/src/widget/hooks/useCheckout.ts +3 -2
  155. package/src/widget/hooks/useDebugScreens.ts +583 -0
  156. package/src/widget/hooks/useSendForm.ts +111 -35
  157. package/src/widget/hooks/useTokenList.ts +155 -122
  158. package/src/widget/widget.tsx +503 -523
@@ -1,4 +1,3 @@
1
- import type { SequenceIndexerGateway } from "@0xsequence/indexer"
2
1
  import { ResourceStatus } from "@0xsequence/indexer"
3
2
  import { Address } from "ox"
4
3
  import { useEffect, useMemo, useState } from "react"
@@ -16,7 +15,8 @@ import {
16
15
  useHasSufficientBalanceUsd,
17
16
  useTokenBalances,
18
17
  } from "../../tokenBalances.js"
19
- import { getFormatttedTokenName, getSupportedTokens } from "../../tokens.js"
18
+ import { getFormatttedTokenName, useSupportedTokens } from "../../tokens.js"
19
+ import { useIndexerGatewayClient } from "../../indexerClient.js"
20
20
 
21
21
  export interface Token {
22
22
  id: number
@@ -50,9 +50,9 @@ export type TokenFormatted = Token &
50
50
  export type UseTokenListProps = {
51
51
  onContinue: (selectedToken: Token) => void
52
52
  targetAmountUsd?: number | null
53
- indexerGatewayClient: SequenceIndexerGateway
54
53
  onError: (error: Error | string | null) => void
55
54
  fundMethod?: string | null
55
+ allSupportedTokens?: boolean
56
56
  }
57
57
 
58
58
  export type UseTokenListReturn = {
@@ -76,27 +76,31 @@ export type UseTokenListReturn = {
76
76
  export function useTokenList({
77
77
  onContinue,
78
78
  targetAmountUsd,
79
- indexerGatewayClient,
80
79
  onError,
81
80
  fundMethod,
81
+ allSupportedTokens = false,
82
82
  }: UseTokenListProps): UseTokenListReturn {
83
83
  const [selectedToken, setSelectedToken] = useState<Token | null>(null)
84
84
  const [searchQuery, setSearchQuery] = useState("")
85
- const [allSupportedTokens, setAllSupportedTokens] = useState<any[]>([])
86
- const [isLoadingSupportedTokens, setIsLoadingSupportedTokens] =
87
- useState(false)
88
85
  const { address } = useAccount()
86
+ const indexerGatewayClient = useIndexerGatewayClient()
89
87
  const {
90
88
  sortedTokens: allSortedTokens,
91
89
  isLoadingSortedTokens,
92
90
  balanceError,
93
91
  } = useTokenBalances(address as Address.Address, indexerGatewayClient)
94
92
 
95
- // Determine loading state based on fund method
93
+ // Use cached supported tokens hook
94
+ const { supportedTokens, isLoadingTokens: isLoadingSupportedTokens } =
95
+ useSupportedTokens()
96
+
97
+ // Determine loading state based on fund method and allSupportedTokens
96
98
  const isLoadingTokens =
97
99
  fundMethod === "qr-code" || fundMethod === "exchange"
98
100
  ? isLoadingSupportedTokens
99
- : isLoadingSortedTokens
101
+ : allSupportedTokens
102
+ ? isLoadingSortedTokens || isLoadingSupportedTokens
103
+ : isLoadingSortedTokens
100
104
 
101
105
  const {
102
106
  totalBalanceUsd,
@@ -111,32 +115,17 @@ export function useTokenList({
111
115
  const showContinueButton = false
112
116
  const { supportedChains: supportedToChains } = useSupportedChains()
113
117
 
114
- // Fetch all supported tokens when fundMethod is "qr-code" or "exchange"
115
- useEffect(() => {
116
- if (fundMethod === "qr-code" || fundMethod === "exchange") {
117
- setIsLoadingSupportedTokens(true)
118
- getSupportedTokens()
119
- .then((tokens) => {
120
- setAllSupportedTokens(tokens)
121
- })
122
- .catch((error) => {
123
- console.error("[trails-sdk] Failed to fetch supported tokens:", error)
124
- })
125
- .finally(() => {
126
- setIsLoadingSupportedTokens(false)
127
- })
128
- }
129
- }, [fundMethod])
118
+ // Note: Supported tokens are now fetched via useSupportedTokens hook with caching
130
119
 
131
120
  const supportedChainIds = useMemo(() => {
132
121
  return new Set(supportedToChains.map((c) => c.id))
133
122
  }, [supportedToChains])
134
123
 
135
124
  const sortedTokens = useMemo<Array<TokenBalanceExtended>>(() => {
136
- // If fundMethod is "qr-code" or "exchange", use all supported tokens instead of account-specific tokens
125
+ // If fundMethod is "qr-code" or "exchange", use filtered supported tokens
137
126
  if (fundMethod === "qr-code" || fundMethod === "exchange") {
138
127
  // Filter to only show specific tokens for QR code and exchange modes
139
- const filteredTokens = allSupportedTokens.filter((token) => {
128
+ const filteredTokens = supportedTokens.filter((token: any) => {
140
129
  const symbol = token.symbol.toUpperCase()
141
130
  return ["ETH", "POL", "USDC", "USDT", "DAI", "BAT", "WETH"].includes(
142
131
  symbol,
@@ -144,7 +133,7 @@ export function useTokenList({
144
133
  })
145
134
 
146
135
  // Convert SupportedToken to TokenBalanceExtended format
147
- return filteredTokens.map((token) => {
136
+ return filteredTokens.map((token: any) => {
148
137
  // Check if it's a native token (like ETH)
149
138
  if (
150
139
  token.contractAddress === "0x0000000000000000000000000000000000000000"
@@ -199,16 +188,10 @@ export function useTokenList({
199
188
  }
200
189
  return true
201
190
  })
202
- }, [
203
- allSortedTokens,
204
- supportedChainIds,
205
- fundMethod,
206
- allSupportedTokens,
207
- address,
208
- ])
191
+ }, [allSortedTokens, supportedChainIds, fundMethod, supportedTokens, address])
209
192
 
210
193
  useEffect(() => {
211
- if (onError) {
194
+ if (onError && balanceError) {
212
195
  onError(balanceError)
213
196
  }
214
197
  }, [balanceError, onError])
@@ -359,95 +342,145 @@ export function useTokenList({
359
342
  }, [sortedTokens, searchQuery])
360
343
 
361
344
  const filteredTokensFormatted = useMemo(() => {
362
- return filteredTokens.map((token: TokenBalanceExtended): TokenFormatted => {
363
- const isNative = !("contractAddress" in token)
364
- const chainInfo = getChainInfo(token.chainId)
365
- const nativeSymbol = chainInfo?.nativeCurrency.symbol || "ETH"
366
- const tokenSymbol = isNative
367
- ? nativeSymbol
368
- : token.contractInfo?.symbol || "???"
369
- const contractAddress = isNative ? zeroAddress : token.contractAddress
370
- let imageContractAddress = contractAddress
371
- if (tokenSymbol === "WETH") {
372
- imageContractAddress = zeroAddress
373
- }
374
- const imageUrl = `https://assets.sequence.info/images/tokens/small/${token.chainId}/${imageContractAddress}.webp`
375
- const currentTokenName =
376
- (token as TokenBalanceWithPrice).contractInfo?.name || ""
377
- const tokenName = getFormatttedTokenName(
378
- currentTokenName,
379
- tokenSymbol,
380
- token.chainId,
381
- )
382
- const formattedBalance = formatRawAmount(
383
- token.balance,
384
- isNative ? 18 : token.contractInfo?.decimals,
385
- )
386
- const priceUsd = Number(token.price?.value) ?? 0
387
- const balanceUsdFormatted = token.balanceUsdFormatted ?? ""
388
- const decimals = isNative ? 18 : (token.contractInfo?.decimals ?? 18)
389
- let isSufficientBalance = true
390
- if (targetAmountUsd) {
391
- isSufficientBalance = (token.balanceUsd ?? 0) >= targetAmountUsd
392
- }
393
- const chainName = chainInfo?.name || ""
394
-
395
- return {
396
- ...token,
397
- id: token.chainId,
398
- contractInfo: {
399
- ...(token as TokenBalanceWithPrice).contractInfo,
400
- chainId: Number(token.chainId),
401
- source: (token as TokenBalanceWithPrice).contractInfo?.source || "",
402
- type: (token as TokenBalanceWithPrice).contractInfo?.type || "",
403
- logoURI: (token as TokenBalanceWithPrice).contractInfo?.logoURI || "",
404
- deployed:
405
- (token as TokenBalanceWithPrice).contractInfo?.deployed || false,
406
- bytecodeHash:
407
- (token as TokenBalanceWithPrice).contractInfo?.bytecodeHash || "",
408
- updatedAt:
409
- (token as TokenBalanceWithPrice).contractInfo?.updatedAt || "",
410
- queuedAt:
411
- (token as TokenBalanceWithPrice).contractInfo?.queuedAt || "",
412
- extensions: (token as TokenBalanceWithPrice).contractInfo
413
- ?.extensions || {
414
- link: "",
415
- description: "",
416
- categories: [],
417
- ogImage: "",
418
- ogName: "",
419
- originChainId: 0,
420
- originAddress: "",
421
- blacklist: false,
422
- verified: false,
423
- featureIndex: 0,
424
- verifiedBy: "",
425
- featured: false,
345
+ // Get base formatted tokens
346
+ const baseFormattedTokens = filteredTokens.map(
347
+ (token: TokenBalanceExtended): TokenFormatted => {
348
+ const isNative = !("contractAddress" in token)
349
+ const chainInfo = getChainInfo(token.chainId)
350
+ const nativeSymbol = chainInfo?.nativeCurrency.symbol || "ETH"
351
+ const tokenSymbol = isNative
352
+ ? nativeSymbol
353
+ : token.contractInfo?.symbol || "???"
354
+ const contractAddress = isNative ? zeroAddress : token.contractAddress
355
+ let imageContractAddress = contractAddress
356
+ if (tokenSymbol === "WETH") {
357
+ imageContractAddress = zeroAddress
358
+ }
359
+ const imageUrl = `https://assets.sequence.info/images/tokens/small/${token.chainId}/${imageContractAddress}.webp`
360
+ const currentTokenName =
361
+ (token as TokenBalanceWithPrice).contractInfo?.name || ""
362
+ const tokenName = getFormatttedTokenName(
363
+ currentTokenName,
364
+ tokenSymbol,
365
+ token.chainId,
366
+ )
367
+ const formattedBalance = formatRawAmount(
368
+ token.balance,
369
+ isNative ? 18 : token.contractInfo?.decimals,
370
+ )
371
+ const priceUsd = Number(token.price?.value) ?? 0
372
+ const balanceUsdFormatted = token.balanceUsdFormatted ?? ""
373
+ const decimals = isNative ? 18 : (token.contractInfo?.decimals ?? 18)
374
+ let isSufficientBalance = true
375
+ if (targetAmountUsd) {
376
+ isSufficientBalance = (token.balanceUsd ?? 0) >= targetAmountUsd
377
+ }
378
+ const chainName = chainInfo?.name || ""
379
+
380
+ return {
381
+ ...token,
382
+ id: token.chainId,
383
+ contractInfo: {
384
+ ...(token as TokenBalanceWithPrice).contractInfo,
385
+ chainId: Number(token.chainId),
386
+ source: (token as TokenBalanceWithPrice).contractInfo?.source || "",
387
+ type: (token as TokenBalanceWithPrice).contractInfo?.type || "",
388
+ logoURI:
389
+ (token as TokenBalanceWithPrice).contractInfo?.logoURI || "",
390
+ deployed:
391
+ (token as TokenBalanceWithPrice).contractInfo?.deployed || false,
392
+ bytecodeHash:
393
+ (token as TokenBalanceWithPrice).contractInfo?.bytecodeHash || "",
394
+ updatedAt:
395
+ (token as TokenBalanceWithPrice).contractInfo?.updatedAt || "",
396
+ queuedAt:
397
+ (token as TokenBalanceWithPrice).contractInfo?.queuedAt || "",
398
+ extensions: (token as TokenBalanceWithPrice).contractInfo
399
+ ?.extensions || {
400
+ link: "",
401
+ description: "",
402
+ categories: [],
403
+ ogImage: "",
404
+ ogName: "",
405
+ originChainId: 0,
406
+ originAddress: "",
407
+ blacklist: false,
408
+ verified: false,
409
+ featureIndex: 0,
410
+ verifiedBy: "",
411
+ featured: false,
412
+ },
413
+ status:
414
+ (token as TokenBalanceWithPrice).contractInfo?.status ||
415
+ ResourceStatus.NOT_AVAILABLE,
416
+ address: contractAddress,
417
+ name: tokenName,
418
+ symbol: tokenSymbol,
419
+ decimals: decimals,
426
420
  },
427
- status:
428
- (token as TokenBalanceWithPrice).contractInfo?.status ||
429
- ResourceStatus.NOT_AVAILABLE,
430
- address: contractAddress,
431
421
  name: tokenName,
432
422
  symbol: tokenSymbol,
433
- decimals: decimals,
434
- },
435
- name: tokenName,
436
- symbol: tokenSymbol,
437
- balanceFormatted: formattedBalance,
438
- imageUrl,
439
- chainId: token.chainId,
440
- contractAddress: contractAddress,
441
- balanceUsdFormatted,
442
- tokenPriceUsd: priceUsd,
443
- isNative: isNative,
444
- tokenName: tokenName,
445
- priceUsd: priceUsd,
446
- isSufficientBalance,
447
- chainName,
448
- }
449
- })
450
- }, [filteredTokens, targetAmountUsd])
423
+ balanceFormatted: formattedBalance,
424
+ imageUrl,
425
+ chainId: token.chainId,
426
+ contractAddress: contractAddress,
427
+ balanceUsdFormatted,
428
+ tokenPriceUsd: priceUsd,
429
+ isNative: isNative,
430
+ tokenName: tokenName,
431
+ priceUsd: priceUsd,
432
+ isSufficientBalance,
433
+ chainName,
434
+ }
435
+ },
436
+ )
437
+
438
+ // If allSupportedTokens is true, combine with supported tokens
439
+ if (allSupportedTokens) {
440
+ // Create a set of existing token keys for quick lookup
441
+ const existingTokenKeys = new Set(
442
+ baseFormattedTokens.map(
443
+ (token) => `${token.chainId}-${token.contractAddress.toLowerCase()}`,
444
+ ),
445
+ )
446
+
447
+ // Add supported tokens that don't exist in the base list
448
+ const additionalSupportedTokens = supportedTokens
449
+ .filter((supportedToken) => {
450
+ const key = `${supportedToken.chainId}-${supportedToken.contractAddress.toLowerCase()}`
451
+ return !existingTokenKeys.has(key)
452
+ })
453
+ .map((supportedToken) => {
454
+ const tokenName = getFormatttedTokenName(
455
+ supportedToken.name,
456
+ supportedToken.symbol,
457
+ supportedToken.chainId,
458
+ )
459
+
460
+ return {
461
+ ...supportedToken,
462
+ tokenName: tokenName,
463
+ contractInfo: {
464
+ decimals: supportedToken.decimals,
465
+ symbol: supportedToken.symbol,
466
+ name: supportedToken.name,
467
+ },
468
+ // Add minimal required properties to make it work
469
+ balance: "",
470
+ balanceFormatted: "",
471
+ balanceUsdFormatted: "",
472
+ priceUsd: 0,
473
+ isSufficientBalance: true,
474
+ // Use any type to bypass strict type checking for now
475
+ } as any
476
+ })
477
+
478
+ // Combine lists with base tokens taking precedence
479
+ return [...baseFormattedTokens, ...additionalSupportedTokens]
480
+ }
481
+
482
+ return baseFormattedTokens
483
+ }, [filteredTokens, targetAmountUsd, allSupportedTokens, supportedTokens])
451
484
 
452
485
  const showInsufficientBalance = useMemo(() => {
453
486
  return (