0xtrails 0.13.2 → 0.15.0

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 (844) hide show
  1. package/dist/abis/requireUtils.d.ts +134 -0
  2. package/dist/abis/requireUtils.d.ts.map +1 -0
  3. package/dist/abis/trailsHydrate.d.ts +6 -42
  4. package/dist/abis/trailsHydrate.d.ts.map +1 -1
  5. package/dist/abis/trailsRouter.d.ts +1 -1
  6. package/dist/abis/trailsRouter.d.ts.map +1 -1
  7. package/dist/actions/actionBuilder.d.ts +414 -0
  8. package/dist/actions/actionBuilder.d.ts.map +1 -0
  9. package/dist/actions/constants.d.ts +1853 -0
  10. package/dist/actions/constants.d.ts.map +1 -0
  11. package/dist/actions/custom-integrations/sushiswapV3/addresses.d.ts +4 -0
  12. package/dist/actions/custom-integrations/sushiswapV3/addresses.d.ts.map +1 -0
  13. package/dist/actions/custom-integrations/sushiswapV3/calldata.d.ts +4 -0
  14. package/dist/actions/custom-integrations/sushiswapV3/calldata.d.ts.map +1 -0
  15. package/dist/actions/custom-integrations/sushiswapV3/calls.d.ts +28 -0
  16. package/dist/actions/custom-integrations/sushiswapV3/calls.d.ts.map +1 -0
  17. package/dist/actions/custom-integrations/sushiswapV3/helpers.d.ts +15 -0
  18. package/dist/actions/custom-integrations/sushiswapV3/helpers.d.ts.map +1 -0
  19. package/dist/actions/custom-integrations/sushiswapV3/sushiswapV3.d.ts +9 -0
  20. package/dist/actions/custom-integrations/sushiswapV3/sushiswapV3.d.ts.map +1 -0
  21. package/dist/actions/custom-integrations/sushiswapV3/types.d.ts +95 -0
  22. package/dist/actions/custom-integrations/sushiswapV3/types.d.ts.map +1 -0
  23. package/dist/actions/custom-integrations/uniswapV3/addresses.d.ts +4 -0
  24. package/dist/actions/custom-integrations/uniswapV3/addresses.d.ts.map +1 -0
  25. package/dist/actions/custom-integrations/uniswapV3/calldata.d.ts +4 -0
  26. package/dist/actions/custom-integrations/uniswapV3/calldata.d.ts.map +1 -0
  27. package/dist/actions/custom-integrations/uniswapV3/calls.d.ts +50 -0
  28. package/dist/actions/custom-integrations/uniswapV3/calls.d.ts.map +1 -0
  29. package/dist/actions/custom-integrations/uniswapV3/helpers.d.ts +23 -0
  30. package/dist/actions/custom-integrations/uniswapV3/helpers.d.ts.map +1 -0
  31. package/dist/actions/custom-integrations/uniswapV3/types.d.ts +90 -0
  32. package/dist/actions/custom-integrations/uniswapV3/types.d.ts.map +1 -0
  33. package/dist/actions/custom-integrations/uniswapV3/uniswapV3.d.ts +9 -0
  34. package/dist/actions/custom-integrations/uniswapV3/uniswapV3.d.ts.map +1 -0
  35. package/dist/actions/destinationCalls.d.ts +17 -0
  36. package/dist/actions/destinationCalls.d.ts.map +1 -0
  37. package/dist/actions/dynamic.d.ts +97 -0
  38. package/dist/actions/dynamic.d.ts.map +1 -0
  39. package/dist/actions/hooks/useEarnBalances.d.ts +53 -0
  40. package/dist/actions/hooks/useEarnBalances.d.ts.map +1 -0
  41. package/dist/actions/hooks/useEarnMarkets.d.ts +29 -0
  42. package/dist/actions/hooks/useEarnMarkets.d.ts.map +1 -0
  43. package/dist/actions/hooks/useEarnProviders.d.ts +18 -0
  44. package/dist/actions/hooks/useEarnProviders.d.ts.map +1 -0
  45. package/dist/actions/hooks/useResolveActions.d.ts +28 -0
  46. package/dist/actions/hooks/useResolveActions.d.ts.map +1 -0
  47. package/dist/actions/index.d.ts +8 -0
  48. package/dist/actions/index.d.ts.map +1 -0
  49. package/dist/actions/index.js +13 -0
  50. package/dist/actions/resolvers.d.ts +30 -0
  51. package/dist/actions/resolvers.d.ts.map +1 -0
  52. package/dist/actions/types/earn.d.ts +51 -0
  53. package/dist/actions/types/earn.d.ts.map +1 -0
  54. package/dist/actions/types.d.ts +303 -0
  55. package/dist/actions/types.d.ts.map +1 -0
  56. package/dist/actions/utils.d.ts +181 -0
  57. package/dist/actions/utils.d.ts.map +1 -0
  58. package/dist/{widget/analytics → analytics/hooks}/useWidgetAnalytics.d.ts +2 -4
  59. package/dist/analytics/hooks/useWidgetAnalytics.d.ts.map +1 -0
  60. package/dist/analytics.d.ts.map +1 -1
  61. package/dist/chainSwitch.d.ts.map +1 -1
  62. package/dist/chains-DttlfV-6.js +4 -0
  63. package/dist/chains-ccVR_-73.js +655 -0
  64. package/dist/chains.d.ts +0 -1
  65. package/dist/chains.d.ts.map +1 -1
  66. package/dist/committedIntentStore.d.ts +5 -0
  67. package/dist/committedIntentStore.d.ts.map +1 -0
  68. package/dist/config.d.ts +2 -0
  69. package/dist/config.d.ts.map +1 -1
  70. package/dist/constants.d.ts +2 -1
  71. package/dist/constants.d.ts.map +1 -1
  72. package/dist/error.d.ts +73 -4
  73. package/dist/error.d.ts.map +1 -1
  74. package/dist/hooks/persistedToken.d.ts +22 -0
  75. package/dist/hooks/persistedToken.d.ts.map +1 -0
  76. package/dist/hooks/prepareTrailsSendTransactionDestination.d.ts +26 -0
  77. package/dist/hooks/prepareTrailsSendTransactionDestination.d.ts.map +1 -0
  78. package/dist/hooks/useAddressWalletIcon.d.ts.map +1 -0
  79. package/dist/hooks/useAmountUsd.d.ts.map +1 -0
  80. package/dist/hooks/useBalanceVisible.d.ts.map +1 -0
  81. package/dist/hooks/useChainFilter.d.ts.map +1 -0
  82. package/dist/{widget/hooks → hooks}/useCheckout.d.ts +15 -15
  83. package/dist/hooks/useCheckout.d.ts.map +1 -0
  84. package/dist/hooks/useClickTracking.d.ts.map +1 -0
  85. package/dist/{widget/hooks → hooks}/useCombinedHistory.d.ts +3 -2
  86. package/dist/hooks/useCombinedHistory.d.ts.map +1 -0
  87. package/dist/hooks/useConnector.d.ts.map +1 -0
  88. package/dist/{widget/hooks → hooks}/useCustomTokenSearch.d.ts +3 -2
  89. package/dist/hooks/useCustomTokenSearch.d.ts.map +1 -0
  90. package/dist/hooks/useDebounce.d.ts.map +1 -0
  91. package/dist/{widget/hooks → hooks}/useDebugScreens.d.ts +2 -2
  92. package/dist/hooks/useDebugScreens.d.ts.map +1 -0
  93. package/dist/{widget/hooks → hooks}/useDefaultDestinationToken.d.ts +1 -1
  94. package/dist/hooks/useDefaultDestinationToken.d.ts.map +1 -0
  95. package/dist/{widget/hooks → hooks}/useDefaultOriginToken.d.ts +1 -1
  96. package/dist/hooks/useDefaultOriginToken.d.ts.map +1 -0
  97. package/dist/hooks/useDepositMonitor.d.ts.map +1 -0
  98. package/dist/{widget/hooks → hooks}/useDestinationSelectedToken.d.ts +10 -2
  99. package/dist/hooks/useDestinationSelectedToken.d.ts.map +1 -0
  100. package/dist/hooks/useDisplayCurrencyPreference.d.ts.map +1 -0
  101. package/dist/{widget/hooks → hooks}/useEarnPool.d.ts +1 -1
  102. package/dist/hooks/useEarnPool.d.ts.map +1 -0
  103. package/dist/hooks/useEffectiveFundBalance.d.ts +28 -0
  104. package/dist/hooks/useEffectiveFundBalance.d.ts.map +1 -0
  105. package/dist/hooks/useExecutingIntentsCount.d.ts.map +1 -0
  106. package/dist/{widget/hooks → hooks}/useExternalFundingReceiptSync.d.ts +1 -1
  107. package/dist/hooks/useExternalFundingReceiptSync.d.ts.map +1 -0
  108. package/dist/{widget/hooks → hooks}/useFiatOnRampCurrencies.d.ts +1 -1
  109. package/dist/hooks/useFiatOnRampCurrencies.d.ts.map +1 -0
  110. package/dist/hooks/useFiatSelectedCurrency.d.ts.map +1 -0
  111. package/dist/hooks/useGetIntent.d.ts.map +1 -0
  112. package/dist/{widget/hooks → hooks}/useIntentReceiptBalances.d.ts +1 -1
  113. package/dist/hooks/useIntentReceiptBalances.d.ts.map +1 -0
  114. package/dist/{widget/hooks → hooks}/useIntentTransactionHistory.d.ts +2 -1
  115. package/dist/hooks/useIntentTransactionHistory.d.ts.map +1 -0
  116. package/dist/hooks/useIsMobile.d.ts.map +1 -0
  117. package/dist/hooks/useIsSequenceWallet.d.ts.map +1 -0
  118. package/dist/hooks/useLocalePreference.d.ts.map +1 -0
  119. package/dist/hooks/useMeldTransactionHistory.d.ts.map +1 -0
  120. package/dist/hooks/useMeldTransactionStatus.d.ts.map +1 -0
  121. package/dist/hooks/useOnRampCountryDefaults.d.ts.map +1 -0
  122. package/dist/{widget/hooks → hooks}/useOnRampPaymentMethods.d.ts +2 -2
  123. package/dist/hooks/useOnRampPaymentMethods.d.ts.map +1 -0
  124. package/dist/{widget/hooks → hooks}/useOnRampProviderWidget.d.ts +1 -1
  125. package/dist/hooks/useOnRampProviderWidget.d.ts.map +1 -0
  126. package/dist/{widget/hooks → hooks}/useOnRampQuote.d.ts +3 -3
  127. package/dist/hooks/useOnRampQuote.d.ts.map +1 -0
  128. package/dist/{widget/hooks → hooks}/useOnRampTransactionStatus.d.ts +1 -1
  129. package/dist/hooks/useOnRampTransactionStatus.d.ts.map +1 -0
  130. package/dist/{widget/hooks → hooks}/useOriginSelectedToken.d.ts +1 -1
  131. package/dist/hooks/useOriginSelectedToken.d.ts.map +1 -0
  132. package/dist/hooks/usePayMessage.d.ts.map +1 -0
  133. package/dist/hooks/usePriceImpactWarning.d.ts.map +1 -0
  134. package/dist/hooks/useQuote.d.ts +619 -0
  135. package/dist/hooks/useQuote.d.ts.map +1 -0
  136. package/dist/{widget/hooks → hooks}/useRecentTokens.d.ts +1 -1
  137. package/dist/hooks/useRecentTokens.d.ts.map +1 -0
  138. package/dist/hooks/useRecipients.d.ts.map +1 -0
  139. package/dist/hooks/useSelectedFeeOption.d.ts.map +1 -0
  140. package/dist/{widget/hooks → hooks}/useSelectedFundMethod.d.ts +11 -1
  141. package/dist/hooks/useSelectedFundMethod.d.ts.map +1 -0
  142. package/dist/hooks/useSelectedRecipient.d.ts.map +1 -0
  143. package/dist/{widget/hooks → hooks}/useSendForm.d.ts +10 -12
  144. package/dist/hooks/useSendForm.d.ts.map +1 -0
  145. package/dist/hooks/useSwapAmount.d.ts.map +1 -0
  146. package/dist/{widget/hooks → hooks}/useSwapState.d.ts +1 -1
  147. package/dist/hooks/useSwapState.d.ts.map +1 -0
  148. package/dist/hooks/useTargetAmount.d.ts.map +1 -0
  149. package/dist/hooks/useTheme.d.ts.map +1 -0
  150. package/dist/{widget/hooks → hooks}/useTokenList.d.ts +4 -3
  151. package/dist/hooks/useTokenList.d.ts.map +1 -0
  152. package/dist/hooks/useTrailsSendTransaction.d.ts +171 -0
  153. package/dist/hooks/useTrailsSendTransaction.d.ts.map +1 -0
  154. package/dist/{widget/hooks → hooks}/useViewManager.d.ts +1 -1
  155. package/dist/hooks/useViewManager.d.ts.map +1 -0
  156. package/dist/hooks/useWalletConnectUri.d.ts +19 -0
  157. package/dist/hooks/useWalletConnectUri.d.ts.map +1 -0
  158. package/dist/hooks/useWalletConnectionContext.d.ts.map +1 -0
  159. package/dist/{widget/hooks → hooks}/useWidgetProps.d.ts +1 -1
  160. package/dist/hooks/useWidgetProps.d.ts.map +1 -0
  161. package/dist/hydrate/builder.d.ts +131 -0
  162. package/dist/hydrate/builder.d.ts.map +1 -0
  163. package/dist/hydrate/constants.d.ts +13 -0
  164. package/dist/hydrate/constants.d.ts.map +1 -0
  165. package/dist/hydrate/encodeExecute.d.ts +73 -0
  166. package/dist/hydrate/encodeExecute.d.ts.map +1 -0
  167. package/dist/hydrate/index.d.ts +8 -0
  168. package/dist/hydrate/index.d.ts.map +1 -0
  169. package/dist/hydrate/index.js +14 -0
  170. package/dist/hydrate/multicall.d.ts +69 -0
  171. package/dist/hydrate/multicall.d.ts.map +1 -0
  172. package/dist/hydrate/payload.d.ts +38 -0
  173. package/dist/hydrate/payload.d.ts.map +1 -0
  174. package/dist/hydrate/selectors.d.ts +28 -0
  175. package/dist/hydrate/selectors.d.ts.map +1 -0
  176. package/dist/hydrate/source.d.ts +11 -0
  177. package/dist/hydrate/source.d.ts.map +1 -0
  178. package/dist/hydrate/types.d.ts +21 -0
  179. package/dist/hydrate/types.d.ts.map +1 -0
  180. package/dist/hydrate/utils.d.ts +8 -0
  181. package/dist/hydrate/utils.d.ts.map +1 -0
  182. package/dist/hydrate-BsQ8nPlI.js +882 -0
  183. package/dist/index.d.ts +47 -14
  184. package/dist/index.d.ts.map +1 -1
  185. package/dist/index.js +189 -662
  186. package/dist/intentConfigStore.d.ts +8 -0
  187. package/dist/intentConfigStore.d.ts.map +1 -0
  188. package/dist/intentProtocolApi.d.ts +11 -0
  189. package/dist/intentProtocolApi.d.ts.map +1 -0
  190. package/dist/intentProtocolEncoding.d.ts +30 -0
  191. package/dist/intentProtocolEncoding.d.ts.map +1 -0
  192. package/dist/intentProtocolResolver.d.ts +28 -0
  193. package/dist/intentProtocolResolver.d.ts.map +1 -0
  194. package/dist/intentReceiptPoller.d.ts.map +1 -1
  195. package/dist/intentValidation.d.ts +5 -0
  196. package/dist/intentValidation.d.ts.map +1 -0
  197. package/dist/intents.d.ts.map +1 -1
  198. package/dist/keymachine/index.d.ts +20 -0
  199. package/dist/keymachine/index.d.ts.map +1 -1
  200. package/dist/mutations.d.ts.map +1 -1
  201. package/dist/offlineRecovery.d.ts +24 -0
  202. package/dist/offlineRecovery.d.ts.map +1 -0
  203. package/dist/onramp/MeshConnectFlow.d.ts +9 -0
  204. package/dist/onramp/MeshConnectFlow.d.ts.map +1 -1
  205. package/dist/onramp/MeshConnectIframe.d.ts +9 -0
  206. package/dist/onramp/MeshConnectIframe.d.ts.map +1 -1
  207. package/dist/onramp/TrailsOnRampProvider.d.ts.map +1 -1
  208. package/dist/onramp/mesh/components/MeshExchangeConfirmation.d.ts +10 -0
  209. package/dist/onramp/mesh/components/MeshExchangeConfirmation.d.ts.map +1 -0
  210. package/dist/onramp/mesh/components/MeshExchangeIcon.d.ts +13 -0
  211. package/dist/onramp/mesh/components/MeshExchangeIcon.d.ts.map +1 -0
  212. package/dist/{widget → onramp/mesh}/components/MeshExchangeSelection.d.ts +1 -0
  213. package/dist/onramp/mesh/components/MeshExchangeSelection.d.ts.map +1 -0
  214. package/dist/onramp/mesh/components/MeshSessionOptions.d.ts +15 -0
  215. package/dist/onramp/mesh/components/MeshSessionOptions.d.ts.map +1 -0
  216. package/dist/onramp/mesh/hooks/useMeshAccessTokens.d.ts +9 -0
  217. package/dist/onramp/mesh/hooks/useMeshAccessTokens.d.ts.map +1 -0
  218. package/dist/onramp/mesh/hooks/useMeshFundingSelection.d.ts +11 -0
  219. package/dist/onramp/mesh/hooks/useMeshFundingSelection.d.ts.map +1 -0
  220. package/dist/onramp/mesh/hooks/useMeshOnrampFlow.d.ts +71 -0
  221. package/dist/onramp/mesh/hooks/useMeshOnrampFlow.d.ts.map +1 -0
  222. package/dist/onramp/mesh/hooks/useMeshOnrampSessionState.d.ts +32 -0
  223. package/dist/onramp/mesh/hooks/useMeshOnrampSessionState.d.ts.map +1 -0
  224. package/dist/onramp/mesh/hooks/useMeshSelectedTokenBalance.d.ts +19 -0
  225. package/dist/onramp/mesh/hooks/useMeshSelectedTokenBalance.d.ts.map +1 -0
  226. package/dist/onramp/mesh/hooks/useMeshSessionAccountBalance.d.ts +15 -0
  227. package/dist/onramp/mesh/hooks/useMeshSessionAccountBalance.d.ts.map +1 -0
  228. package/dist/onramp/mesh/hooks/useMeshSessionStorage.d.ts +7 -0
  229. package/dist/onramp/mesh/hooks/useMeshSessionStorage.d.ts.map +1 -0
  230. package/dist/onramp/meshSessionStorage.d.ts +13 -0
  231. package/dist/onramp/meshSessionStorage.d.ts.map +1 -0
  232. package/dist/onramp/meshconnect.d.ts +6 -4
  233. package/dist/onramp/meshconnect.d.ts.map +1 -1
  234. package/dist/onramp/trailsOnramp.d.ts +8 -0
  235. package/dist/onramp/trailsOnramp.d.ts.map +1 -1
  236. package/dist/onrampClient.d.ts.map +1 -1
  237. package/dist/placeholder.d.ts +129 -5
  238. package/dist/placeholder.d.ts.map +1 -1
  239. package/dist/poolUtils.d.ts +0 -14
  240. package/dist/poolUtils.d.ts.map +1 -1
  241. package/dist/prepareSend.d.ts +3 -2
  242. package/dist/prepareSend.d.ts.map +1 -1
  243. package/dist/query/balance.fetchers.d.ts +7 -1
  244. package/dist/query/balance.fetchers.d.ts.map +1 -1
  245. package/dist/query/intentProtocol.queries.d.ts +32 -0
  246. package/dist/query/intentProtocol.queries.d.ts.map +1 -0
  247. package/dist/recover.d.ts +70 -24
  248. package/dist/recover.d.ts.map +1 -1
  249. package/dist/src-CQhZqidH.js +51593 -0
  250. package/dist/tokens.d.ts.map +1 -1
  251. package/dist/transactionIntent/deposits/depositOrchestrator.d.ts +2 -3
  252. package/dist/transactionIntent/deposits/depositOrchestrator.d.ts.map +1 -1
  253. package/dist/transactionIntent/deposits/gaslessDeposit.d.ts +2 -3
  254. package/dist/transactionIntent/deposits/gaslessDeposit.d.ts.map +1 -1
  255. package/dist/transactionIntent/deposits/standardDeposit.d.ts +2 -5
  256. package/dist/transactionIntent/deposits/standardDeposit.d.ts.map +1 -1
  257. package/dist/transactionIntent/handlers/intentHandler.d.ts +5 -4
  258. package/dist/transactionIntent/handlers/intentHandler.d.ts.map +1 -1
  259. package/dist/transactionIntent/quote/quoteHelpers.d.ts +2 -2
  260. package/dist/transactionIntent/quote/quoteHelpers.d.ts.map +1 -1
  261. package/dist/transactionIntent/types.d.ts +4 -3
  262. package/dist/transactionIntent/types.d.ts.map +1 -1
  263. package/dist/transactions.d.ts +1 -0
  264. package/dist/transactions.d.ts.map +1 -1
  265. package/dist/umd/trails.min.js +1371 -409
  266. package/dist/utils/localStorageGc.d.ts +22 -0
  267. package/dist/utils/localStorageGc.d.ts.map +1 -0
  268. package/dist/utils/validation.d.ts +14 -0
  269. package/dist/utils/validation.d.ts.map +1 -1
  270. package/dist/walletUtils.d.ts.map +1 -1
  271. package/dist/widget/components/AccountIntentTransactionHistory.d.ts.map +1 -1
  272. package/dist/widget/components/ChainList.d.ts +2 -0
  273. package/dist/widget/components/ChainList.d.ts.map +1 -1
  274. package/dist/widget/components/ClassicSwap.d.ts.map +1 -1
  275. package/dist/widget/components/ConnectedWallets.d.ts +1 -1
  276. package/dist/widget/components/ConnectedWallets.d.ts.map +1 -1
  277. package/dist/widget/components/Earn.d.ts +2 -6
  278. package/dist/widget/components/Earn.d.ts.map +1 -1
  279. package/dist/widget/components/EarnMarkets.d.ts +9 -0
  280. package/dist/widget/components/EarnMarkets.d.ts.map +1 -0
  281. package/dist/widget/components/EarnPoolsFilters.d.ts +7 -1
  282. package/dist/widget/components/EarnPoolsFilters.d.ts.map +1 -1
  283. package/dist/widget/components/{PoolWithdraw.d.ts → EarnWithdraw.d.ts} +5 -5
  284. package/dist/widget/components/{PoolWithdraw.d.ts.map → EarnWithdraw.d.ts.map} +1 -1
  285. package/dist/widget/components/FeeOption.d.ts +1 -1
  286. package/dist/widget/components/FeeOption.d.ts.map +1 -1
  287. package/dist/widget/components/FeeOptions.d.ts +1 -1
  288. package/dist/widget/components/FeeOptions.d.ts.map +1 -1
  289. package/dist/widget/components/FiatSelector.d.ts +1 -1
  290. package/dist/widget/components/FiatSelector.d.ts.map +1 -1
  291. package/dist/widget/components/FiatSelectorButton.d.ts +1 -1
  292. package/dist/widget/components/FiatSelectorButton.d.ts.map +1 -1
  293. package/dist/widget/components/Fund.d.ts +1 -1
  294. package/dist/widget/components/Fund.d.ts.map +1 -1
  295. package/dist/widget/components/FundMethods.d.ts.map +1 -1
  296. package/dist/widget/components/FundingMethodSelectorButton.d.ts +1 -1
  297. package/dist/widget/components/FundingMethodSelectorButton.d.ts.map +1 -1
  298. package/dist/widget/components/HookModalContent.d.ts.map +1 -1
  299. package/dist/widget/components/MeldHistory.d.ts +1 -1
  300. package/dist/widget/components/MeldHistory.d.ts.map +1 -1
  301. package/dist/widget/components/MeldTransactionStatus.d.ts +1 -1
  302. package/dist/widget/components/MeldTransactionStatus.d.ts.map +1 -1
  303. package/dist/widget/components/MeshExchangeAccountHeader.d.ts +9 -0
  304. package/dist/widget/components/MeshExchangeAccountHeader.d.ts.map +1 -0
  305. package/dist/widget/components/OnrampHistoryRow.d.ts +1 -1
  306. package/dist/widget/components/OnrampHistoryRow.d.ts.map +1 -1
  307. package/dist/widget/components/OnrampProviderConfirmation.d.ts +1 -1
  308. package/dist/widget/components/OnrampProviderConfirmation.d.ts.map +1 -1
  309. package/dist/widget/components/Pay.d.ts.map +1 -1
  310. package/dist/widget/components/PoolDeposit.d.ts +2 -6
  311. package/dist/widget/components/PoolDeposit.d.ts.map +1 -1
  312. package/dist/widget/components/PulsatingButton.d.ts +9 -0
  313. package/dist/widget/components/PulsatingButton.d.ts.map +1 -0
  314. package/dist/widget/components/Receipt.d.ts +1 -1
  315. package/dist/widget/components/Receipt.d.ts.map +1 -1
  316. package/dist/widget/components/RecipientSelectorButton.d.ts.map +1 -1
  317. package/dist/widget/components/Recipients.d.ts.map +1 -1
  318. package/dist/widget/components/Swap.d.ts +2 -6
  319. package/dist/widget/components/Swap.d.ts.map +1 -1
  320. package/dist/widget/components/TokenList.d.ts +1 -0
  321. package/dist/widget/components/TokenList.d.ts.map +1 -1
  322. package/dist/widget/components/TokenSelector.d.ts +2 -2
  323. package/dist/widget/components/TokenSelector.d.ts.map +1 -1
  324. package/dist/widget/components/TransactionDetails.d.ts +1 -0
  325. package/dist/widget/components/TransactionDetails.d.ts.map +1 -1
  326. package/dist/widget/components/TransactionHistoryItem.d.ts +1 -0
  327. package/dist/widget/components/TransactionHistoryItem.d.ts.map +1 -1
  328. package/dist/widget/components/TransferPendingVertical.d.ts +1 -1
  329. package/dist/widget/components/TransferPendingVertical.d.ts.map +1 -1
  330. package/dist/widget/components/WalletAccountHeader.d.ts +7 -0
  331. package/dist/widget/components/WalletAccountHeader.d.ts.map +1 -0
  332. package/dist/widget/components/WalletConfirmation.d.ts +2 -1
  333. package/dist/widget/components/WalletConfirmation.d.ts.map +1 -1
  334. package/dist/widget/components/WalletConnect.d.ts.map +1 -1
  335. package/dist/widget/components/WidgetProviders.d.ts.map +1 -1
  336. package/dist/widget/components/Withdraw.d.ts.map +1 -1
  337. package/dist/widget/components/earnMarketUtils.d.ts +11 -0
  338. package/dist/widget/components/earnMarketUtils.d.ts.map +1 -0
  339. package/dist/widget/components/earnNetworks.d.ts +6 -0
  340. package/dist/widget/components/earnNetworks.d.ts.map +1 -0
  341. package/dist/widget/index.d.ts +13 -0
  342. package/dist/widget/index.d.ts.map +1 -1
  343. package/dist/widget/index.js +17 -9
  344. package/dist/widget/modes/EarnWidget.d.ts +90 -0
  345. package/dist/widget/modes/EarnWidget.d.ts.map +1 -0
  346. package/dist/widget/modes/FundWidget.d.ts +97 -0
  347. package/dist/widget/modes/FundWidget.d.ts.map +1 -0
  348. package/dist/widget/modes/PayWidget.d.ts +80 -0
  349. package/dist/widget/modes/PayWidget.d.ts.map +1 -0
  350. package/dist/widget/modes/SwapWidget.d.ts +76 -0
  351. package/dist/widget/modes/SwapWidget.d.ts.map +1 -0
  352. package/dist/widget/modes/WithdrawWidget.d.ts +87 -0
  353. package/dist/widget/modes/WithdrawWidget.d.ts.map +1 -0
  354. package/dist/widget/providers/TrailsProvider.d.ts +3 -0
  355. package/dist/widget/providers/TrailsProvider.d.ts.map +1 -1
  356. package/dist/widget/providers/WidgetProviderTree.d.ts.map +1 -1
  357. package/dist/widget/shared/destinationDefaultToken.d.ts +15 -0
  358. package/dist/widget/shared/destinationDefaultToken.d.ts.map +1 -0
  359. package/dist/widget/shared/mapSharedProps.d.ts +9 -0
  360. package/dist/widget/shared/mapSharedProps.d.ts.map +1 -0
  361. package/dist/widget/shared/methodMap.d.ts +18 -0
  362. package/dist/widget/shared/methodMap.d.ts.map +1 -0
  363. package/dist/widget/shared/resolution.d.ts +23 -0
  364. package/dist/widget/shared/resolution.d.ts.map +1 -0
  365. package/dist/widget/shared/resolvePaymentSource.d.ts +36 -0
  366. package/dist/widget/shared/resolvePaymentSource.d.ts.map +1 -0
  367. package/dist/widget/shared/tokenAllowlist.d.ts +36 -0
  368. package/dist/widget/shared/tokenAllowlist.d.ts.map +1 -0
  369. package/dist/widget/shared/types.d.ts +150 -0
  370. package/dist/widget/shared/types.d.ts.map +1 -0
  371. package/dist/widget/styles.gen.d.ts +2 -0
  372. package/dist/widget/styles.gen.d.ts.map +1 -0
  373. package/dist/widget/types/commonProps.d.ts +3 -7
  374. package/dist/widget/types/commonProps.d.ts.map +1 -1
  375. package/dist/widget/utils/fundMethodSwitchState.d.ts +1 -0
  376. package/dist/widget/utils/fundMethodSwitchState.d.ts.map +1 -1
  377. package/dist/widget/utils/viewManagerGuards.d.ts +1 -1
  378. package/dist/widget/utils/viewManagerGuards.d.ts.map +1 -1
  379. package/dist/widget/widget.d.ts +23 -16
  380. package/dist/widget/widget.d.ts.map +1 -1
  381. package/package.json +22 -23
  382. package/dist/buffer.d.ts +0 -3
  383. package/dist/buffer.d.ts.map +0 -1
  384. package/dist/ccip-CT_An6eM.js +0 -230
  385. package/dist/index-RfqL5Foz.js +0 -114567
  386. package/dist/paymasterSend.d.ts +0 -90
  387. package/dist/paymasterSend.d.ts.map +0 -1
  388. package/dist/sendUserOp.d.ts +0 -122
  389. package/dist/sendUserOp.d.ts.map +0 -1
  390. package/dist/toSimpleSmartAccount.d.ts +0 -95
  391. package/dist/toSimpleSmartAccount.d.ts.map +0 -1
  392. package/dist/transactionIntent/utils/erc20Approval.d.ts +0 -34
  393. package/dist/transactionIntent/utils/erc20Approval.d.ts.map +0 -1
  394. package/dist/utils/allowance.d.ts +0 -19
  395. package/dist/utils/allowance.d.ts.map +0 -1
  396. package/dist/widget/analytics/useWidgetAnalytics.d.ts.map +0 -1
  397. package/dist/widget/components/FeeBreakdown.d.ts +0 -9
  398. package/dist/widget/components/FeeBreakdown.d.ts.map +0 -1
  399. package/dist/widget/components/HideBalances.d.ts +0 -4
  400. package/dist/widget/components/HideBalances.d.ts.map +0 -1
  401. package/dist/widget/components/MeshExchangeSelection.d.ts.map +0 -1
  402. package/dist/widget/components/OnrampDeposit.d.ts +0 -10
  403. package/dist/widget/components/OnrampDeposit.d.ts.map +0 -1
  404. package/dist/widget/components/SwapSettings.d.ts +0 -4
  405. package/dist/widget/components/SwapSettings.d.ts.map +0 -1
  406. package/dist/widget/components/TruncatedAddress.d.ts +0 -12
  407. package/dist/widget/components/TruncatedAddress.d.ts.map +0 -1
  408. package/dist/widget/components/WalletImage.d.ts +0 -8
  409. package/dist/widget/components/WalletImage.d.ts.map +0 -1
  410. package/dist/widget/css/compiled.css +0 -26
  411. package/dist/widget/css/index.css +0 -686
  412. package/dist/widget/hooks/useAddressWalletIcon.d.ts.map +0 -1
  413. package/dist/widget/hooks/useAmountUsd.d.ts.map +0 -1
  414. package/dist/widget/hooks/useBalanceVisible.d.ts.map +0 -1
  415. package/dist/widget/hooks/useChainFilter.d.ts.map +0 -1
  416. package/dist/widget/hooks/useCheckout.d.ts.map +0 -1
  417. package/dist/widget/hooks/useClickTracking.d.ts.map +0 -1
  418. package/dist/widget/hooks/useCombinedHistory.d.ts.map +0 -1
  419. package/dist/widget/hooks/useConnector.d.ts.map +0 -1
  420. package/dist/widget/hooks/useCustomTokenSearch.d.ts.map +0 -1
  421. package/dist/widget/hooks/useDebounce.d.ts.map +0 -1
  422. package/dist/widget/hooks/useDebugScreens.d.ts.map +0 -1
  423. package/dist/widget/hooks/useDefaultDestinationToken.d.ts.map +0 -1
  424. package/dist/widget/hooks/useDefaultOriginToken.d.ts.map +0 -1
  425. package/dist/widget/hooks/useDepositMonitor.d.ts.map +0 -1
  426. package/dist/widget/hooks/useDestinationSelectedToken.d.ts.map +0 -1
  427. package/dist/widget/hooks/useDisplayCurrencyPreference.d.ts.map +0 -1
  428. package/dist/widget/hooks/useEarnPool.d.ts.map +0 -1
  429. package/dist/widget/hooks/useExecutingIntentsCount.d.ts.map +0 -1
  430. package/dist/widget/hooks/useExternalFundingReceiptSync.d.ts.map +0 -1
  431. package/dist/widget/hooks/useFiatOnRampCurrencies.d.ts.map +0 -1
  432. package/dist/widget/hooks/useFiatSelectedCurrency.d.ts.map +0 -1
  433. package/dist/widget/hooks/useGetIntent.d.ts.map +0 -1
  434. package/dist/widget/hooks/useIntentReceiptBalances.d.ts.map +0 -1
  435. package/dist/widget/hooks/useIntentTransactionHistory.d.ts.map +0 -1
  436. package/dist/widget/hooks/useIsConnectedWalletSmartContract.d.ts +0 -7
  437. package/dist/widget/hooks/useIsConnectedWalletSmartContract.d.ts.map +0 -1
  438. package/dist/widget/hooks/useIsMobile.d.ts.map +0 -1
  439. package/dist/widget/hooks/useIsSequenceWallet.d.ts.map +0 -1
  440. package/dist/widget/hooks/useLocalePreference.d.ts.map +0 -1
  441. package/dist/widget/hooks/useMeldTransactionHistory.d.ts.map +0 -1
  442. package/dist/widget/hooks/useMeldTransactionStatus.d.ts.map +0 -1
  443. package/dist/widget/hooks/useOnRampCountryDefaults.d.ts.map +0 -1
  444. package/dist/widget/hooks/useOnRampPaymentMethods.d.ts.map +0 -1
  445. package/dist/widget/hooks/useOnRampProviderWidget.d.ts.map +0 -1
  446. package/dist/widget/hooks/useOnRampQuote.d.ts.map +0 -1
  447. package/dist/widget/hooks/useOnRampTransactionStatus.d.ts.map +0 -1
  448. package/dist/widget/hooks/useOriginSelectedToken.d.ts.map +0 -1
  449. package/dist/widget/hooks/usePayMessage.d.ts.map +0 -1
  450. package/dist/widget/hooks/usePriceImpactWarning.d.ts.map +0 -1
  451. package/dist/widget/hooks/useQuote.d.ts +0 -378
  452. package/dist/widget/hooks/useQuote.d.ts.map +0 -1
  453. package/dist/widget/hooks/useRecentTokens.d.ts.map +0 -1
  454. package/dist/widget/hooks/useRecipients.d.ts.map +0 -1
  455. package/dist/widget/hooks/useScreenTracking.d.ts +0 -2
  456. package/dist/widget/hooks/useScreenTracking.d.ts.map +0 -1
  457. package/dist/widget/hooks/useSelectedFeeOption.d.ts.map +0 -1
  458. package/dist/widget/hooks/useSelectedFundMethod.d.ts.map +0 -1
  459. package/dist/widget/hooks/useSelectedRecipient.d.ts.map +0 -1
  460. package/dist/widget/hooks/useSendForm.d.ts.map +0 -1
  461. package/dist/widget/hooks/useSwapAmount.d.ts.map +0 -1
  462. package/dist/widget/hooks/useSwapState.d.ts.map +0 -1
  463. package/dist/widget/hooks/useTargetAmount.d.ts.map +0 -1
  464. package/dist/widget/hooks/useTheme.d.ts.map +0 -1
  465. package/dist/widget/hooks/useTokenList.d.ts.map +0 -1
  466. package/dist/widget/hooks/useTrailsSendTransaction.d.ts +0 -83
  467. package/dist/widget/hooks/useTrailsSendTransaction.d.ts.map +0 -1
  468. package/dist/widget/hooks/useViewManager.d.ts.map +0 -1
  469. package/dist/widget/hooks/useWalletConnectUri.d.ts +0 -11
  470. package/dist/widget/hooks/useWalletConnectUri.d.ts.map +0 -1
  471. package/dist/widget/hooks/useWalletConnectionContext.d.ts.map +0 -1
  472. package/dist/widget/hooks/useWidgetProps.d.ts.map +0 -1
  473. package/dist/widget/styles.d.ts +0 -2
  474. package/dist/widget/styles.d.ts.map +0 -1
  475. package/dist/widget/types.d.ts +0 -44
  476. package/dist/widget/types.d.ts.map +0 -1
  477. package/dist/widget/utils/historyUtils.d.ts +0 -18
  478. package/dist/widget/utils/historyUtils.d.ts.map +0 -1
  479. package/src/abi.ts +0 -38
  480. package/src/abis/erc20.ts +0 -60
  481. package/src/abis/trailsHydrate.ts +0 -185
  482. package/src/abis/trailsRouter.ts +0 -121
  483. package/src/abis/trailsSweep.ts +0 -32
  484. package/src/abortController.ts +0 -35
  485. package/src/analytics.ts +0 -2029
  486. package/src/buffer.ts +0 -10
  487. package/src/chainSwitch.ts +0 -95
  488. package/src/chains.ts +0 -570
  489. package/src/config.ts +0 -118
  490. package/src/constants.ts +0 -239
  491. package/src/contractUtils.ts +0 -46
  492. package/src/cssUtils.ts +0 -5
  493. package/src/customChains.ts +0 -24
  494. package/src/customTokens.ts +0 -168
  495. package/src/decoders.ts +0 -365
  496. package/src/ens.ts +0 -74
  497. package/src/error.ts +0 -268
  498. package/src/estimate.ts +0 -480
  499. package/src/explorer.ts +0 -38
  500. package/src/fees.ts +0 -362
  501. package/src/gasless.ts +0 -638
  502. package/src/index.ts +0 -205
  503. package/src/indexerClient.ts +0 -118
  504. package/src/intentReceiptMonitor.ts +0 -99
  505. package/src/intentReceiptPoller.ts +0 -327
  506. package/src/intents.ts +0 -1133
  507. package/src/keyMachineClient.ts +0 -29
  508. package/src/keymachine/index.ts +0 -175
  509. package/src/keymachine/key-machine.gen.ts +0 -993
  510. package/src/localeUtils.ts +0 -244
  511. package/src/logger/index.ts +0 -95
  512. package/src/logger/useSyncLoggerDebug.ts +0 -11
  513. package/src/logger.ts +0 -1
  514. package/src/meld/components/MeldCountriesList.tsx +0 -237
  515. package/src/meld/components/MeldFundMethods.tsx +0 -265
  516. package/src/meld/components/MeldProvidersList.tsx +0 -187
  517. package/src/meld/components/MeldTokensList.tsx +0 -321
  518. package/src/meld/components/SimpleHeader.tsx +0 -35
  519. package/src/meld/utils/meld.ts +0 -77
  520. package/src/mutations.ts +0 -166
  521. package/src/onramp/MeshConnectFlow.tsx +0 -86
  522. package/src/onramp/MeshConnectIframe.tsx +0 -661
  523. package/src/onramp/SendFromExchangeButton.tsx +0 -81
  524. package/src/onramp/TrailsOnRampProvider.tsx +0 -59
  525. package/src/onramp/index.ts +0 -31
  526. package/src/onramp/meshconnect.ts +0 -277
  527. package/src/onramp/trailsOnramp.tsx +0 -130
  528. package/src/onramp-client/index.ts +0 -52
  529. package/src/onrampClient.ts +0 -46
  530. package/src/paymasterSend.ts +0 -521
  531. package/src/placeholder.ts +0 -92
  532. package/src/poolUtils.ts +0 -222
  533. package/src/pools.ts +0 -120
  534. package/src/prepareSend.ts +0 -553
  535. package/src/query/balance.fetchers.ts +0 -753
  536. package/src/query/balance.hooks.ts +0 -357
  537. package/src/query/balance.queries.ts +0 -307
  538. package/src/query/chains.hooks.ts +0 -45
  539. package/src/query/chains.queries.ts +0 -17
  540. package/src/query/client.ts +0 -20
  541. package/src/query/fiat.fetchers.ts +0 -33
  542. package/src/query/fiat.hooks.ts +0 -71
  543. package/src/query/fiat.queries.ts +0 -67
  544. package/src/query/geo.fetchers.ts +0 -100
  545. package/src/query/geo.hooks.ts +0 -16
  546. package/src/query/geo.queries.ts +0 -36
  547. package/src/query/helpers.ts +0 -81
  548. package/src/query/meld.fetchers.ts +0 -97
  549. package/src/query/meld.hooks.ts +0 -18
  550. package/src/query/meld.queries.ts +0 -184
  551. package/src/query/persister.ts +0 -11
  552. package/src/query/price.fetchers.ts +0 -53
  553. package/src/query/price.hooks.ts +0 -46
  554. package/src/query/price.queries.ts +0 -364
  555. package/src/query/tokenList.queries.ts +0 -118
  556. package/src/queryParams.ts +0 -100
  557. package/src/recover.ts +0 -1728
  558. package/src/sendUserOp.ts +0 -512
  559. package/src/theme.ts +0 -2
  560. package/src/toSimpleSmartAccount.ts +0 -567
  561. package/src/toast.ts +0 -110
  562. package/src/tokens.ts +0 -1862
  563. package/src/trailsClient.ts +0 -40
  564. package/src/transactionIntent/constants.ts +0 -15
  565. package/src/transactionIntent/deposits/depositOrchestrator.ts +0 -243
  566. package/src/transactionIntent/deposits/gaslessDeposit.ts +0 -705
  567. package/src/transactionIntent/deposits/index.ts +0 -3
  568. package/src/transactionIntent/deposits/standardDeposit.ts +0 -590
  569. package/src/transactionIntent/execution/index.ts +0 -1
  570. package/src/transactionIntent/execution/transactionState.ts +0 -38
  571. package/src/transactionIntent/handlers/index.ts +0 -1
  572. package/src/transactionIntent/handlers/intentHandler.ts +0 -1613
  573. package/src/transactionIntent/helpers/index.ts +0 -1
  574. package/src/transactionIntent/helpers/transactionStateHelpers.ts +0 -440
  575. package/src/transactionIntent/index.ts +0 -10
  576. package/src/transactionIntent/quote/feeExtractors.ts +0 -61
  577. package/src/transactionIntent/quote/index.ts +0 -3
  578. package/src/transactionIntent/quote/normalizeQuote.ts +0 -559
  579. package/src/transactionIntent/quote/quoteHelpers.ts +0 -117
  580. package/src/transactionIntent/types.ts +0 -241
  581. package/src/transactionIntent/utils/balanceChecker.ts +0 -103
  582. package/src/transactionIntent/utils/erc20Approval.ts +0 -171
  583. package/src/transactionIntent/utils/index.ts +0 -2
  584. package/src/transactionIntent/utils/resilientDepositTracker.ts +0 -171
  585. package/src/transactionIntent/utils/testnetHelpers.ts +0 -5
  586. package/src/transactionIntent/validators.ts +0 -27
  587. package/src/transactions.ts +0 -429
  588. package/src/types.d.ts +0 -16
  589. package/src/umd.tsx +0 -33
  590. package/src/utils/address.ts +0 -78
  591. package/src/utils/allowance.ts +0 -47
  592. package/src/utils/fiat.ts +0 -32
  593. package/src/utils/format.ts +0 -625
  594. package/src/utils/passthrough.ts +0 -93
  595. package/src/utils/time.ts +0 -118
  596. package/src/utils/validation.ts +0 -104
  597. package/src/utils.ts +0 -112
  598. package/src/version.ts +0 -8
  599. package/src/vite-env.d.ts +0 -4
  600. package/src/walletUtils.ts +0 -293
  601. package/src/wallets.ts +0 -544
  602. package/src/widget/analytics/useWidgetAnalytics.ts +0 -56
  603. package/src/widget/assets/Exchange-icon-black.svg +0 -5
  604. package/src/widget/assets/MetaMask-icon-fox-with-margins.svg +0 -31
  605. package/src/widget/assets/MetaMask-icon-fox.svg +0 -26
  606. package/src/widget/assets/MetaMask-logo-black.svg +0 -3
  607. package/src/widget/assets/MetaMask-logo-white.svg +0 -16
  608. package/src/widget/assets/Trails-logo-black.svg +0 -13
  609. package/src/widget/assets/Trails-logo-white.svg +0 -13
  610. package/src/widget/assets/WalletChange-black.svg +0 -5
  611. package/src/widget/assets/WalletConnect-logo-black.svg +0 -14
  612. package/src/widget/assets/WalletConnect-logo-blue.svg +0 -14
  613. package/src/widget/assets/WalletConnect-logo-white.svg +0 -14
  614. package/src/widget/assets/WalletConnect-logo.svg +0 -40
  615. package/src/widget/assets/aave.svg +0 -14
  616. package/src/widget/assets/morpho.svg +0 -14
  617. package/src/widget/compiled.css +0 -26
  618. package/src/widget/components/AccountActionsDropdown.tsx +0 -31
  619. package/src/widget/components/AccountIntentTransactionHistory.tsx +0 -756
  620. package/src/widget/components/AccountIntentTransactionHistoryButton.tsx +0 -34
  621. package/src/widget/components/AccountSettings.tsx +0 -168
  622. package/src/widget/components/AddressOrEnsName.tsx +0 -24
  623. package/src/widget/components/AddressWalletIcon.tsx +0 -49
  624. package/src/widget/components/AllChainsIcon.tsx +0 -54
  625. package/src/widget/components/ChainFilterDropdown.tsx +0 -220
  626. package/src/widget/components/ChainImage.tsx +0 -40
  627. package/src/widget/components/ChainList.tsx +0 -158
  628. package/src/widget/components/ClassicSwap.tsx +0 -1761
  629. package/src/widget/components/ConfigDisplay.tsx +0 -158
  630. package/src/widget/components/ConnectWallet.tsx +0 -566
  631. package/src/widget/components/ConnectedWallets.tsx +0 -414
  632. package/src/widget/components/CopyButton.tsx +0 -108
  633. package/src/widget/components/CountryFilterDropdown.tsx +0 -179
  634. package/src/widget/components/DebugMenu.tsx +0 -50
  635. package/src/widget/components/DebugScreensList.tsx +0 -70
  636. package/src/widget/components/DebugToast.tsx +0 -63
  637. package/src/widget/components/DepositTracker.tsx +0 -326
  638. package/src/widget/components/DirectTransfer.tsx +0 -305
  639. package/src/widget/components/Disconnect.tsx +0 -68
  640. package/src/widget/components/DynamicInputStyles.tsx +0 -121
  641. package/src/widget/components/DynamicSizeInputField.tsx +0 -245
  642. package/src/widget/components/ENSAvatar.tsx +0 -33
  643. package/src/widget/components/Earn.tsx +0 -160
  644. package/src/widget/components/EarnPools.tsx +0 -417
  645. package/src/widget/components/EarnPoolsFilters.tsx +0 -165
  646. package/src/widget/components/ErrorAnimationIcon.tsx +0 -130
  647. package/src/widget/components/ErrorDisplay.tsx +0 -152
  648. package/src/widget/components/ExecutingIntentsBadge.tsx +0 -24
  649. package/src/widget/components/ExecutionStatusBadge.tsx +0 -53
  650. package/src/widget/components/FeeBreakdown.tsx +0 -155
  651. package/src/widget/components/FeeOption.tsx +0 -170
  652. package/src/widget/components/FeeOptions.tsx +0 -247
  653. package/src/widget/components/FiatSelector.tsx +0 -308
  654. package/src/widget/components/FiatSelectorButton.tsx +0 -68
  655. package/src/widget/components/Footer.tsx +0 -67
  656. package/src/widget/components/Fund.tsx +0 -2463
  657. package/src/widget/components/FundMethods.tsx +0 -423
  658. package/src/widget/components/FundWalletSelection.tsx +0 -60
  659. package/src/widget/components/FundingMethodSelectorButton.tsx +0 -106
  660. package/src/widget/components/GreenCheckAnimation.tsx +0 -119
  661. package/src/widget/components/HideBalances.tsx +0 -24
  662. package/src/widget/components/HighPriceImpactBlock.tsx +0 -44
  663. package/src/widget/components/HookModalContent.tsx +0 -377
  664. package/src/widget/components/Identicon.tsx +0 -228
  665. package/src/widget/components/LoadingSpinner.tsx +0 -9
  666. package/src/widget/components/MeldForm.tsx +0 -780
  667. package/src/widget/components/MeldHistory.tsx +0 -433
  668. package/src/widget/components/MeldStepsFlow.tsx +0 -1651
  669. package/src/widget/components/MeldTransactionStatus.tsx +0 -255
  670. package/src/widget/components/MeshExchangeSelection.tsx +0 -218
  671. package/src/widget/components/Modal.tsx +0 -86
  672. package/src/widget/components/OFTProgressBar.tsx +0 -89
  673. package/src/widget/components/OnRampProviderSelector.tsx +0 -263
  674. package/src/widget/components/OnrampDeposit.tsx +0 -122
  675. package/src/widget/components/OnrampErrorScreen.tsx +0 -163
  676. package/src/widget/components/OnrampHistoryRow.tsx +0 -321
  677. package/src/widget/components/OnrampPaymentMethods.tsx +0 -81
  678. package/src/widget/components/OnrampProviderConfirmation.tsx +0 -1060
  679. package/src/widget/components/OriginSelectionAmount.tsx +0 -144
  680. package/src/widget/components/OriginTransferInformation.tsx +0 -59
  681. package/src/widget/components/Pay.tsx +0 -1165
  682. package/src/widget/components/PaymentMethods.tsx +0 -198
  683. package/src/widget/components/PercentageMaxButtons.tsx +0 -112
  684. package/src/widget/components/PoolDeposit.tsx +0 -642
  685. package/src/widget/components/PoolWithdraw.tsx +0 -761
  686. package/src/widget/components/PriceImpactWarning.tsx +0 -87
  687. package/src/widget/components/QRCodeOptions.tsx +0 -65
  688. package/src/widget/components/QRCodeWalletSelect.tsx +0 -80
  689. package/src/widget/components/QrCode.tsx +0 -216
  690. package/src/widget/components/QuoteDetails.tsx +0 -1275
  691. package/src/widget/components/Receipt.tsx +0 -673
  692. package/src/widget/components/ReceiptRecoverableFunds.tsx +0 -135
  693. package/src/widget/components/RecentTokens.tsx +0 -66
  694. package/src/widget/components/RecipientSelectorButton.tsx +0 -50
  695. package/src/widget/components/Recipients.tsx +0 -413
  696. package/src/widget/components/RefundWarning.tsx +0 -61
  697. package/src/widget/components/RequiredPropsError.tsx +0 -33
  698. package/src/widget/components/ScreenHeader.tsx +0 -123
  699. package/src/widget/components/SearchInputField.tsx +0 -99
  700. package/src/widget/components/SessionTimeoutScreen.tsx +0 -103
  701. package/src/widget/components/ShadowPortal.tsx +0 -99
  702. package/src/widget/components/ShadowRootContext.tsx +0 -17
  703. package/src/widget/components/SimpleRecipientInputScreen.tsx +0 -91
  704. package/src/widget/components/SlippageToleranceSettings.tsx +0 -279
  705. package/src/widget/components/Swap.tsx +0 -50
  706. package/src/widget/components/SwapDisplay.tsx +0 -68
  707. package/src/widget/components/SwapSettings.tsx +0 -52
  708. package/src/widget/components/ThemeProvider.tsx +0 -115
  709. package/src/widget/components/ThemeSyncer.tsx +0 -47
  710. package/src/widget/components/Toast.tsx +0 -336
  711. package/src/widget/components/TokenDisplayNonSelectable.tsx +0 -40
  712. package/src/widget/components/TokenImage.tsx +0 -156
  713. package/src/widget/components/TokenList.tsx +0 -107
  714. package/src/widget/components/TokenSelector.tsx +0 -807
  715. package/src/widget/components/TokenSelectorButton.tsx +0 -123
  716. package/src/widget/components/TokenSkeleton.tsx +0 -53
  717. package/src/widget/components/Tooltip.tsx +0 -64
  718. package/src/widget/components/TrailsHookModal.tsx +0 -107
  719. package/src/widget/components/TransactionDetails.tsx +0 -534
  720. package/src/widget/components/TransactionHistoryItem.tsx +0 -767
  721. package/src/widget/components/TransferPendingVertical.tsx +0 -591
  722. package/src/widget/components/TruncatedAddress.tsx +0 -68
  723. package/src/widget/components/TruncatedTransactionHash.tsx +0 -74
  724. package/src/widget/components/UserPreferences.tsx +0 -570
  725. package/src/widget/components/WaasFeeOptions.tsx +0 -588
  726. package/src/widget/components/WalletConfirmation.tsx +0 -220
  727. package/src/widget/components/WalletConnect.tsx +0 -348
  728. package/src/widget/components/WalletConnectionPending.tsx +0 -178
  729. package/src/widget/components/WalletImage.tsx +0 -52
  730. package/src/widget/components/WalletList.tsx +0 -125
  731. package/src/widget/components/WidgetProviders.tsx +0 -82
  732. package/src/widget/components/Withdraw.tsx +0 -1106
  733. package/src/widget/components/YellowWarningAnimation.tsx +0 -146
  734. package/src/widget/hooks/useAddressWalletIcon.ts +0 -55
  735. package/src/widget/hooks/useAmountUsd.ts +0 -44
  736. package/src/widget/hooks/useBalanceVisible.tsx +0 -95
  737. package/src/widget/hooks/useChainFilter.tsx +0 -56
  738. package/src/widget/hooks/useCheckout.ts +0 -361
  739. package/src/widget/hooks/useClickTracking.ts +0 -74
  740. package/src/widget/hooks/useCombinedHistory.ts +0 -420
  741. package/src/widget/hooks/useConnector.tsx +0 -24
  742. package/src/widget/hooks/useCustomTokenSearch.tsx +0 -369
  743. package/src/widget/hooks/useDebounce.ts +0 -25
  744. package/src/widget/hooks/useDebugScreens.ts +0 -600
  745. package/src/widget/hooks/useDefaultDestinationToken.tsx +0 -179
  746. package/src/widget/hooks/useDefaultOriginToken.tsx +0 -407
  747. package/src/widget/hooks/useDepositMonitor.ts +0 -118
  748. package/src/widget/hooks/useDestinationSelectedToken.tsx +0 -310
  749. package/src/widget/hooks/useDisplayCurrencyPreference.tsx +0 -145
  750. package/src/widget/hooks/useEarnPool.tsx +0 -36
  751. package/src/widget/hooks/useExecutingIntentsCount.ts +0 -78
  752. package/src/widget/hooks/useExternalFundingReceiptSync.ts +0 -79
  753. package/src/widget/hooks/useFiatOnRampCurrencies.ts +0 -46
  754. package/src/widget/hooks/useFiatSelectedCurrency.tsx +0 -123
  755. package/src/widget/hooks/useGetIntent.ts +0 -54
  756. package/src/widget/hooks/useIntentReceiptBalances.ts +0 -141
  757. package/src/widget/hooks/useIntentTransactionHistory.ts +0 -790
  758. package/src/widget/hooks/useIsConnectedWalletSmartContract.ts +0 -43
  759. package/src/widget/hooks/useIsMobile.tsx +0 -50
  760. package/src/widget/hooks/useIsSequenceWallet.ts +0 -17
  761. package/src/widget/hooks/useLocalePreference.tsx +0 -187
  762. package/src/widget/hooks/useMeldTransactionHistory.ts +0 -184
  763. package/src/widget/hooks/useMeldTransactionStatus.ts +0 -707
  764. package/src/widget/hooks/useOnRampCountryDefaults.ts +0 -57
  765. package/src/widget/hooks/useOnRampPaymentMethods.ts +0 -72
  766. package/src/widget/hooks/useOnRampProviderWidget.ts +0 -184
  767. package/src/widget/hooks/useOnRampQuote.ts +0 -340
  768. package/src/widget/hooks/useOnRampTransactionStatus.ts +0 -196
  769. package/src/widget/hooks/useOriginSelectedToken.tsx +0 -253
  770. package/src/widget/hooks/usePayMessage.tsx +0 -496
  771. package/src/widget/hooks/usePriceImpactWarning.ts +0 -17
  772. package/src/widget/hooks/useQuote.ts +0 -1239
  773. package/src/widget/hooks/useRecentTokens.ts +0 -159
  774. package/src/widget/hooks/useRecipients.ts +0 -167
  775. package/src/widget/hooks/useScreenTracking.ts +0 -14
  776. package/src/widget/hooks/useSelectedFeeOption.tsx +0 -323
  777. package/src/widget/hooks/useSelectedFundMethod.tsx +0 -93
  778. package/src/widget/hooks/useSelectedRecipient.tsx +0 -75
  779. package/src/widget/hooks/useSendForm.ts +0 -1389
  780. package/src/widget/hooks/useSwapAmount.tsx +0 -50
  781. package/src/widget/hooks/useSwapState.tsx +0 -121
  782. package/src/widget/hooks/useTargetAmount.ts +0 -26
  783. package/src/widget/hooks/useTheme.tsx +0 -80
  784. package/src/widget/hooks/useTokenList.ts +0 -1168
  785. package/src/widget/hooks/useTrailsSendTransaction.ts +0 -987
  786. package/src/widget/hooks/useViewManager.tsx +0 -506
  787. package/src/widget/hooks/useWalletConnectUri.tsx +0 -307
  788. package/src/widget/hooks/useWalletConnectionContext.tsx +0 -128
  789. package/src/widget/hooks/useWidgetProps.tsx +0 -33
  790. package/src/widget/index.css +0 -686
  791. package/src/widget/index.tsx +0 -28
  792. package/src/widget/providers/TrailsModalProvider.tsx +0 -238
  793. package/src/widget/providers/TrailsProvider.tsx +0 -155
  794. package/src/widget/providers/UserActivityProvider.tsx +0 -78
  795. package/src/widget/providers/WidgetProviderTree.tsx +0 -90
  796. package/src/widget/styles.ts +0 -26
  797. package/src/widget/types/analytics.ts +0 -22
  798. package/src/widget/types/commonProps.ts +0 -56
  799. package/src/widget/types/svg.d.ts +0 -8
  800. package/src/widget/types.ts +0 -51
  801. package/src/widget/utils/countryUtils.ts +0 -89
  802. package/src/widget/utils/createWagmiConfig.ts +0 -43
  803. package/src/widget/utils/forexRateStore.ts +0 -120
  804. package/src/widget/utils/fundMethodSwitchState.ts +0 -27
  805. package/src/widget/utils/historyFilters.ts +0 -157
  806. package/src/widget/utils/historyUtils.ts +0 -101
  807. package/src/widget/utils/localeStore.ts +0 -68
  808. package/src/widget/utils/meldProviderUtils.ts +0 -26
  809. package/src/widget/utils/meshSupportedTokens.ts +0 -28
  810. package/src/widget/utils/onrampConfig.ts +0 -15
  811. package/src/widget/utils/statusLabel.ts +0 -3
  812. package/src/widget/utils/tokens.ts +0 -138
  813. package/src/widget/utils/trailsOnrampConfig.ts +0 -39
  814. package/src/widget/utils/transactionFailure.ts +0 -52
  815. package/src/widget/utils/viewManagerGuards.ts +0 -49
  816. package/src/widget/utils/windowUtils.ts +0 -138
  817. package/src/widget/widget.tsx +0 -3400
  818. /package/dist/{widget/hooks → hooks}/useAddressWalletIcon.d.ts +0 -0
  819. /package/dist/{widget/hooks → hooks}/useAmountUsd.d.ts +0 -0
  820. /package/dist/{widget/hooks → hooks}/useBalanceVisible.d.ts +0 -0
  821. /package/dist/{widget/hooks → hooks}/useChainFilter.d.ts +0 -0
  822. /package/dist/{widget/hooks → hooks}/useClickTracking.d.ts +0 -0
  823. /package/dist/{widget/hooks → hooks}/useConnector.d.ts +0 -0
  824. /package/dist/{widget/hooks → hooks}/useDebounce.d.ts +0 -0
  825. /package/dist/{widget/hooks → hooks}/useDepositMonitor.d.ts +0 -0
  826. /package/dist/{widget/hooks → hooks}/useDisplayCurrencyPreference.d.ts +0 -0
  827. /package/dist/{widget/hooks → hooks}/useExecutingIntentsCount.d.ts +0 -0
  828. /package/dist/{widget/hooks → hooks}/useFiatSelectedCurrency.d.ts +0 -0
  829. /package/dist/{widget/hooks → hooks}/useGetIntent.d.ts +0 -0
  830. /package/dist/{widget/hooks → hooks}/useIsMobile.d.ts +0 -0
  831. /package/dist/{widget/hooks → hooks}/useIsSequenceWallet.d.ts +0 -0
  832. /package/dist/{widget/hooks → hooks}/useLocalePreference.d.ts +0 -0
  833. /package/dist/{widget/hooks → hooks}/useMeldTransactionHistory.d.ts +0 -0
  834. /package/dist/{widget/hooks → hooks}/useMeldTransactionStatus.d.ts +0 -0
  835. /package/dist/{widget/hooks → hooks}/useOnRampCountryDefaults.d.ts +0 -0
  836. /package/dist/{widget/hooks → hooks}/usePayMessage.d.ts +0 -0
  837. /package/dist/{widget/hooks → hooks}/usePriceImpactWarning.d.ts +0 -0
  838. /package/dist/{widget/hooks → hooks}/useRecipients.d.ts +0 -0
  839. /package/dist/{widget/hooks → hooks}/useSelectedFeeOption.d.ts +0 -0
  840. /package/dist/{widget/hooks → hooks}/useSelectedRecipient.d.ts +0 -0
  841. /package/dist/{widget/hooks → hooks}/useSwapAmount.d.ts +0 -0
  842. /package/dist/{widget/hooks → hooks}/useTargetAmount.d.ts +0 -0
  843. /package/dist/{widget/hooks → hooks}/useTheme.d.ts +0 -0
  844. /package/dist/{widget/hooks → hooks}/useWalletConnectionContext.d.ts +0 -0
package/src/tokens.ts DELETED
@@ -1,1862 +0,0 @@
1
- import {
2
- useQuery,
3
- useQueryClient,
4
- type QueryClient,
5
- } from "@tanstack/react-query"
6
- import { DAY_MS, retryDelay } from "./utils/time.js"
7
- import { queryPersister } from "./query/persister.js"
8
- import { erc20Abi, zeroAddress } from "viem"
9
- import { getChainInfo, getChainRpcClient } from "./chains.js"
10
- import {
11
- arbitrum,
12
- base,
13
- optimism,
14
- polygon,
15
- mainnet,
16
- avalanche,
17
- gnosis,
18
- zksync,
19
- scroll,
20
- blast,
21
- sonic,
22
- fantom,
23
- hyperEvm,
24
- ink,
25
- katana,
26
- berachain,
27
- etherlink,
28
- linea,
29
- unichain,
30
- worldchain,
31
- bsc,
32
- monad,
33
- } from "viem/chains"
34
- import { useReadContracts } from "wagmi"
35
- import { useMemo } from "react"
36
- import { logger } from "./logger.js"
37
- import {
38
- addressEqual,
39
- isNativeToken,
40
- normalizeAddress,
41
- } from "./utils/address.js"
42
- import { somnia } from "./customChains.js"
43
- import { useTrails } from "./widget/providers/TrailsProvider.js"
44
- import { useCustomTokens } from "./customTokens.js"
45
- import { getTrailsClient } from "./trailsClient.js"
46
- import { formatBalanceFields, formatPriceFields } from "./utils/format.js"
47
- import { PROD_SEQUENCE_METADATA_URL } from "./constants.js"
48
- import { SequenceMetadata } from "@0xsequence/metadata"
49
- import { chainQueries } from "./query/chains.queries.js"
50
- import { tokenListQueries } from "./query/tokenList.queries.js"
51
- import { queryClient as defaultQueryClient } from "./query/client.js"
52
-
53
- // ApiTokenInfo type from trails-api (internal use only)
54
- interface ApiTokenInfo {
55
- chainId: number
56
- address: string
57
- name: string
58
- symbol: string
59
- decimals: number
60
- supportsBridging: boolean
61
- logoUri?: string
62
- }
63
-
64
- /**
65
- * Unified token type for the Trails SDK.
66
- * This type replaces all previous token type variations (SupportedToken, TokenBalanceExtended, etc.)
67
- */
68
- export type Token = {
69
- // Required properties
70
- symbol: string
71
- name: string
72
- decimals: number
73
- contractAddress: string // Use zeroAddress for native tokens
74
-
75
- // Optional properties
76
- tokenId?: string // For specific token IDs if applicable
77
- chainId?: number
78
- chainName?: string
79
- imageUrl?: string
80
- isCustomToken?: boolean // true when user inputted custom token address in search field
81
- isSufficientBalance?: boolean
82
- isNativeToken?: boolean
83
-
84
- // Balance fields (raw → formatted → display)
85
- balance?: string // Raw big number string (e.g., "1000000000000000000")
86
- balanceFormatted?: string // Formatted number without commas (e.g., "1.0") US format
87
- balanceDisplay?: string // Formatted number with commas (e.g., "1,000.00") US format
88
- balanceLocaleDisplay?: string // Formatted with user's locale (e.g., "1.000,00" for DE locale)
89
-
90
- // USD Balance fields
91
- balanceUsd?: number // Raw number (e.g., 1000.50) US format
92
- balanceUsdFormatted?: string // Formatted number without commas or currency symbol (e.g., "1000.50") US format
93
- balanceUsdDisplay?: string // Formatted number with commas and currency symbol (e.g., "$1,000.50") US format
94
- balanceUsdLocaleDisplay?: string // Formatted with user's locale (e.g., "1.000,50 $" for DE locale)
95
-
96
- // Price fields (raw → formatted → display)
97
- priceUsd?: number // Raw number (e.g., 1.50) US format
98
- priceUsdFormatted?: string // Formatted number without commas or currency symbol (e.g., "1.50") US format
99
- priceUsdDisplay?: string // Formatted number with commas and currency symbol (e.g., "$1.50") US format
100
- }
101
-
102
- // ============================================================================
103
- // Conversion Helper Functions
104
- // ============================================================================
105
-
106
- /**
107
- * Converts ApiTokenInfo (from trails-api) to Token
108
- */
109
- export function convertApiTokenInfoToToken(
110
- tokenInfo: ApiTokenInfo,
111
- options?: {
112
- balance?: string
113
- priceUsd?: number
114
- },
115
- ): Token {
116
- const chainInfo = getChainInfo(tokenInfo.chainId)
117
- const isNative = isNativeToken(tokenInfo.address) || !tokenInfo.address
118
-
119
- const result: Token = {
120
- symbol: tokenInfo.symbol,
121
- name: tokenInfo.name,
122
- decimals: tokenInfo.decimals,
123
- contractAddress: tokenInfo.address,
124
- tokenId: `${tokenInfo.symbol}-${chainInfo?.name || `chain-${tokenInfo.chainId}`}`, // Generate tokenId
125
- chainId: tokenInfo.chainId,
126
- chainName: chainInfo?.name || `Chain ${tokenInfo.chainId}`,
127
- imageUrl:
128
- tokenInfo.logoUri ||
129
- getTokenImageUrl({
130
- chainId: tokenInfo.chainId,
131
- contractAddress: tokenInfo.address,
132
- symbol: tokenInfo.symbol,
133
- }),
134
- isNativeToken: isNative,
135
- }
136
-
137
- // Format balance if provided
138
- if (options?.balance) {
139
- const balanceFields = formatBalanceFields(
140
- options.balance,
141
- tokenInfo.decimals,
142
- )
143
- result.balance = balanceFields.balance
144
- result.balanceFormatted = balanceFields.balanceFormatted
145
- result.balanceDisplay = balanceFields.balanceDisplay
146
- }
147
-
148
- // Format price if provided
149
- if (options?.priceUsd !== undefined) {
150
- const priceFields = formatPriceFields(options.priceUsd)
151
- result.priceUsd = priceFields.priceUsd
152
- result.priceUsdFormatted = priceFields.priceUsdFormatted
153
- result.priceUsdDisplay = priceFields.priceUsdDisplay
154
- }
155
-
156
- return result
157
- }
158
-
159
- export const commonTokenImages: Record<string, string> = {
160
- ETH: "https://assets.sequence.info/images/tokens/large/1/0x0000000000000000000000000000000000000000.webp",
161
- WETH: "https://assets.sequence.info/images/tokens/large/1/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2.webp",
162
- POL: "https://assets.sequence.info/images/tokens/large/137/0x0000000000000000000000000000000000000000.webp",
163
- MATIC:
164
- "https://assets.sequence.info/images/tokens/large/137/0x0000000000000000000000000000000000000000.webp",
165
- USDC: "https://assets.sequence.info/images/tokens/large/1/0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48.webp",
166
- USDT: "https://assets.sequence.info/images/tokens/large/1/0xdac17f958d2ee523a2206206994597c13d831ec7.webp",
167
- DAI: "https://assets.sequence.info/images/tokens/large/1/0x6b175474e89094c44da98b954eedeac495271d0f.webp",
168
- WBTC: "https://assets.sequence.info/images/tokens/large/1/0x2260fac5e5542a773aa44fbcfedf7c193bc2c599.webp",
169
- BAT: "https://assets.sequence.info/images/tokens/large/1/0x0d8775f648430679a709e98d2b0cb6250d2887ef.webp",
170
- ARB: "https://assets.sequence.info/images/tokens/large/42161/0x912ce59144191c1204e64559fe8253a0e49e6548.webp",
171
- LINK: "https://assets.sequence.info/images/tokens/large/1/0x514910771af9ca656af840dff83e8264ecf986ca.webp",
172
- XTZ: "https://assets.sequence.info/images/tokens/large/42793/0x0000000000000000000000000000000000000000.webp",
173
- BNB: "https://assets.sequence.info/images/tokens/large/56/0x0000000000000000000000000000000000000000.webp",
174
- WXTZ: "https://assets.coingecko.com/coins/images/976/standard/Tezos-logo.png?1696502091",
175
- SOMI: "https://assets.sequence.info/images/tokens/large/5031/0x0000000000000000000000000000000000000000.webp",
176
- XAI: "https://assets.coingecko.com/coins/images/34258/large/round_icon_2048_px.png?1719523838",
177
- APE: "https://assets.sequence.info/images/tokens/large/33139/0x0000000000000000000000000000000000000000.webp",
178
- ANIME:
179
- "https://assets.coingecko.com/coins/images/53575/large/anime.jpg?1736748703",
180
- AVAX: "https://assets.sequence.info/images/tokens/large/43114/0x0000000000000000000000000000000000000000.webp",
181
- MON: "https://assets.sequence.info/images/tokens/large/143/0x0000000000000000000000000000000000000000.webp",
182
- USDT0:
183
- "https://assets.coingecko.com/coins/images/53705/standard/usdt0.jpg?1737086183",
184
- AUSD: "https://assets.coingecko.com/coins/images/39284/standard/Circle_Agora_White_on_Olive_1080px.png?1722961274",
185
- }
186
-
187
- const cacheVersion = "01"
188
-
189
- // LocalStorage cache utilities for token images
190
- const TOKEN_IMAGE_CACHE_KEY = `trails-sdk:token-image-cache:${cacheVersion}`
191
- const TOKEN_IMAGE_CACHE_EXPIRY = 7 * DAY_MS // 7 days
192
-
193
- interface TokenImageCacheEntry {
194
- imageUrl: string
195
- timestamp: number
196
- found: boolean
197
- }
198
-
199
- // Token info cache utilities
200
- const TOKEN_INFO_CACHE_KEY = `trails-sdk:token-info-cache:${cacheVersion}`
201
- const TOKEN_INFO_CACHE_EXPIRY = DAY_MS
202
-
203
- // Cache entry matches Token structure (without optional fields)
204
- interface TokenInfoCacheEntry {
205
- tokenId?: string
206
- symbol: string
207
- name: string
208
- contractAddress: string
209
- decimals: number
210
- chainId: number
211
- chainName?: string
212
- imageUrl?: string
213
- isNativeToken?: boolean
214
- isCustomToken?: boolean
215
- timestamp: number
216
- }
217
-
218
- // In-memory token info cache
219
- const tokenInfoCache = new Map<string, TokenInfoCacheEntry>()
220
-
221
- function getTokenInfoCache(): Record<string, TokenInfoCacheEntry> {
222
- if (typeof window === "undefined") return {}
223
-
224
- try {
225
- const cached = localStorage.getItem(TOKEN_INFO_CACHE_KEY)
226
- if (!cached) return {}
227
-
228
- const parsed = JSON.parse(cached) as Record<string, TokenInfoCacheEntry>
229
- const now = Date.now()
230
-
231
- // Clean up expired entries
232
- const validEntries = Object.entries(parsed).filter(([_, entry]) => {
233
- return now - entry.timestamp < TOKEN_INFO_CACHE_EXPIRY
234
- })
235
-
236
- return Object.fromEntries(validEntries) as Record<
237
- string,
238
- TokenInfoCacheEntry
239
- >
240
- } catch {
241
- return {}
242
- }
243
- }
244
-
245
- function setTokenInfoCache(key: string, tokenInfo: Token): void {
246
- if (typeof window === "undefined") return
247
-
248
- try {
249
- const cache = getTokenInfoCache()
250
- // Ensure chainId is required for cache entry
251
- if (!tokenInfo.chainId) {
252
- logger.console.warn(
253
- "[trails-sdk] Cannot cache token without chainId:",
254
- tokenInfo,
255
- )
256
- return
257
- }
258
- const cacheEntry: TokenInfoCacheEntry = {
259
- tokenId: tokenInfo.tokenId,
260
- symbol: tokenInfo.symbol,
261
- name: tokenInfo.name,
262
- contractAddress: tokenInfo.contractAddress,
263
- decimals: tokenInfo.decimals,
264
- chainId: tokenInfo.chainId,
265
- chainName: tokenInfo.chainName,
266
- imageUrl: tokenInfo.imageUrl,
267
- isNativeToken: tokenInfo.isNativeToken,
268
- isCustomToken: tokenInfo.isCustomToken,
269
- timestamp: Date.now(),
270
- }
271
- cache[key] = cacheEntry
272
- localStorage.setItem(TOKEN_INFO_CACHE_KEY, JSON.stringify(cache))
273
-
274
- // Also update in-memory cache
275
- tokenInfoCache.set(key, cacheEntry)
276
- } catch (error) {
277
- logger.console.warn("[trails-sdk] Failed to cache token info:", error)
278
- }
279
- }
280
-
281
- function getCachedTokenInfo(
282
- chainId: number,
283
- contractAddress: string,
284
- ): Token | null {
285
- const key = `${chainId}:${normalizeAddress(contractAddress)}`
286
-
287
- // Check in-memory cache first
288
- const memoryEntry = tokenInfoCache.get(key)
289
- if (memoryEntry) {
290
- // Convert cache entry to Token
291
- return {
292
- symbol: memoryEntry.symbol,
293
- name: memoryEntry.name,
294
- decimals: memoryEntry.decimals,
295
- contractAddress: memoryEntry.contractAddress,
296
- tokenId: memoryEntry.tokenId,
297
- chainId: memoryEntry.chainId,
298
- chainName: memoryEntry.chainName,
299
- imageUrl: memoryEntry.imageUrl,
300
- isNativeToken: memoryEntry.isNativeToken,
301
- isCustomToken: memoryEntry.isCustomToken,
302
- }
303
- }
304
-
305
- // Check localStorage cache
306
- const cache = getTokenInfoCache()
307
- const cachedEntry = cache[key]
308
- if (cachedEntry) {
309
- // Update in-memory cache
310
- tokenInfoCache.set(key, cachedEntry)
311
- // Convert cache entry to Token
312
- return {
313
- symbol: cachedEntry.symbol,
314
- name: cachedEntry.name,
315
- decimals: cachedEntry.decimals,
316
- contractAddress: cachedEntry.contractAddress,
317
- tokenId: cachedEntry.tokenId,
318
- chainId: cachedEntry.chainId,
319
- chainName: cachedEntry.chainName,
320
- imageUrl: cachedEntry.imageUrl,
321
- isNativeToken: cachedEntry.isNativeToken,
322
- isCustomToken: cachedEntry.isCustomToken,
323
- }
324
- }
325
-
326
- return null
327
- }
328
-
329
- function getTokenImageCache(): Record<string, TokenImageCacheEntry> {
330
- if (typeof window === "undefined") return {}
331
-
332
- try {
333
- const cached = localStorage.getItem(TOKEN_IMAGE_CACHE_KEY)
334
- if (!cached) return {}
335
-
336
- const parsed = JSON.parse(cached) as Record<string, TokenImageCacheEntry>
337
- const now = Date.now()
338
-
339
- // Clean up expired entries
340
- const validEntries = Object.entries(parsed).filter(([_, entry]) => {
341
- return now - entry.timestamp < TOKEN_IMAGE_CACHE_EXPIRY
342
- })
343
-
344
- return Object.fromEntries(validEntries) as Record<
345
- string,
346
- TokenImageCacheEntry
347
- >
348
- } catch {
349
- return {}
350
- }
351
- }
352
-
353
- // Priority tokens that should appear first in the list
354
- const PRIORITY_TOKENS = [
355
- "ETH",
356
- "WETH",
357
- "AVAX",
358
- "WAVAX",
359
- "xDAI",
360
- "POL",
361
- "USDC",
362
- "USDT",
363
- "DAI",
364
- "MATIC",
365
- "ARB",
366
- "OP",
367
- "BAT",
368
- "WBTC",
369
- "cbBTC",
370
- "XAI",
371
- ]
372
-
373
- // Sort function for tokens with the specified priority order
374
- function sortTokens(tokens: Token[]): Token[] {
375
- return tokens.sort((a, b) => {
376
- // 1. Priority tokens first (ETH, USDC, USDT, DAI)
377
- const aPriority = PRIORITY_TOKENS.indexOf(a.symbol)
378
- const bPriority = PRIORITY_TOKENS.indexOf(b.symbol)
379
-
380
- // If both are priority tokens, sort by priority order
381
- if (aPriority !== -1 && bPriority !== -1) {
382
- return aPriority - bPriority
383
- }
384
-
385
- // If only one is a priority token, prioritize it
386
- if (aPriority !== -1) return -1
387
- if (bPriority !== -1) return 1
388
-
389
- // 2. Tokens with imageUrl before those without
390
- const aHasImage = !!a.imageUrl
391
- const bHasImage = !!b.imageUrl
392
-
393
- if (aHasImage && !bHasImage) return -1
394
- if (!aHasImage && bHasImage) return 1
395
-
396
- // 3. Alphabetical by symbol
397
- const symbolComparison = a.symbol.localeCompare(b.symbol)
398
- if (symbolComparison !== 0) {
399
- return symbolComparison
400
- }
401
-
402
- // 4. If symbols are the same, sort by chainName
403
- const aChainName = a.chainName || ""
404
- const bChainName = b.chainName || ""
405
- return aChainName.localeCompare(bChainName)
406
- })
407
- }
408
-
409
- export function getCachedTokenImageUrl(
410
- chainId: number,
411
- contractAddress: string,
412
- symbol: string,
413
- ) {
414
- const cacheKey = `${chainId}:${contractAddress}:${symbol}`
415
- const cache = getTokenImageCache()
416
- const cachedEntry = cache[cacheKey]
417
- return cachedEntry?.imageUrl || ""
418
- }
419
-
420
- export async function getSupportedTokens(config: {
421
- trailsApiKey: string
422
- trailsApiUrl: string
423
- queryClient?: QueryClient
424
- }): Promise<Token[]> {
425
- const effectiveQueryClient = config.queryClient ?? defaultQueryClient
426
- const chains = await effectiveQueryClient.ensureQueryData(
427
- chainQueries.supported({
428
- trailsApiUrl: config.trailsApiUrl,
429
- trailsApiKey: config.trailsApiKey,
430
- }),
431
- )
432
- const chainIds = chains.map((chain) => chain.id)
433
-
434
- // Get trails client using provided config
435
- const trailsClient = getTrailsClient({
436
- apiKey: config.trailsApiKey || "",
437
- hostname: config.trailsApiUrl,
438
- })
439
-
440
- // Fetch tokens from trails-api using getTokenList
441
- // This is the new endpoint that replaces getFeaturedTokens
442
- // It uses go-tokendirectory to fetch efficiently and cache data from token-directory
443
- // includeAllListed: true returns all tokens in the index (except external) even if not featured
444
- // Featured tokens are always included and sorted at the top
445
- let apiTokens: Token[] = []
446
- try {
447
- if (config.trailsApiKey && trailsClient) {
448
- // Use getTokenList to get tokens for the specified chains
449
- // includeAllListed: true includes all tokens in the index, not just featured
450
- // The API applies limit per chain, and lists are sorted, normalized, and deduped
451
- // When filtering by a single chain, use limit of 100, otherwise use 30 per chain
452
- // Type assertion needed because TrailsClient extends TrailsApi which has these methods
453
- const limit = chainIds.length === 1 ? 100 : 30
454
- const tokenListResponse =
455
- chainIds.length > 0
456
- ? await effectiveQueryClient.ensureQueryData(
457
- tokenListQueries.catalog(
458
- trailsClient,
459
- {
460
- trailsApiUrl: config.trailsApiUrl,
461
- trailsApiKey: config.trailsApiKey,
462
- },
463
- {
464
- chainIds,
465
- includeAllListed: true,
466
- limit,
467
- },
468
- ),
469
- )
470
- : { tokens: [] }
471
-
472
- // The API already handles sorting (featured first, then alphabetically) and deduplication
473
- // Map ApiTokenInfo from API to Token format using conversion helper
474
- apiTokens = (tokenListResponse.tokens || []).map((tokenInfo: any) => {
475
- const chainInfo = getChainInfo(tokenInfo.chainId)
476
- const tokenId = `${tokenInfo.symbol}-${chainInfo?.name || `chain-${tokenInfo.chainId}`}`
477
- const trailsToken = convertApiTokenInfoToToken(tokenInfo, {
478
- // No balance or price data from getTokenList
479
- })
480
- // Set tokenId for consistency
481
- trailsToken.tokenId = tokenId
482
- return trailsToken
483
- })
484
- }
485
- } catch (error) {
486
- logger.console.warn(
487
- "[trails-sdk] Error fetching tokens from trails-api:",
488
- error,
489
- )
490
- // Continue with empty apiTokens - will fall back to commonTokens
491
- apiTokens = []
492
- }
493
-
494
- // Ensure imageUrl is set for all tokens
495
- for (const token of apiTokens) {
496
- if (!token.imageUrl) {
497
- token.imageUrl = getTokenImageUrl({
498
- chainId: token.chainId || 0,
499
- contractAddress: token.contractAddress,
500
- symbol: token.symbol,
501
- })
502
- }
503
-
504
- // Use getTokenImageUrl directly (synchronous)
505
- const imageUrl = getTokenImageUrl({
506
- chainId: token.chainId || 0,
507
- contractAddress: token.contractAddress,
508
- symbol: token.symbol,
509
- })
510
- if (imageUrl) {
511
- token.imageUrl = imageUrl
512
- }
513
- }
514
-
515
- // Add common tokens that don't exist in API tokens
516
- const additionalTokens: Token[] = []
517
- for (const commonToken of commonTokens) {
518
- const contractAddress = commonToken.contractAddress
519
- const exists = apiTokens.some(
520
- (t) =>
521
- t.chainId === commonToken.chainId &&
522
- addressEqual(t.contractAddress, contractAddress),
523
- )
524
- if (!exists) {
525
- // commonTokens is now Token[], so we can use it directly
526
- additionalTokens.push(commonToken)
527
- }
528
- }
529
-
530
- const allTokens = [...apiTokens, ...additionalTokens]
531
-
532
- // Filter to only include tokens from supported sequence chains
533
- const supportedChainTokens = allTokens.filter((token) => {
534
- // Always include Etherlink tokens
535
- if (token.chainId === etherlink.id) {
536
- return true
537
- }
538
- // Filter by sequence chains
539
- return token.chainId && chainIds.includes(token.chainId)
540
- })
541
-
542
- // Remove duplicates
543
- const uniqueTokens = supportedChainTokens.filter(
544
- (token, index, self) =>
545
- index ===
546
- self.findIndex(
547
- (t) =>
548
- t.chainId === token.chainId &&
549
- addressEqual(t.contractAddress, token.contractAddress),
550
- ),
551
- )
552
-
553
- // Sort tokens according to priority order
554
- const sortedTokens = sortTokens(uniqueTokens)
555
-
556
- return sortedTokens
557
- }
558
-
559
- const EMPTY_TOKENS: Token[] = []
560
-
561
- export function useSupportedTokens({
562
- chainId,
563
- disabled = false,
564
- }: {
565
- chainId?: number
566
- disabled?: boolean
567
- } = {}): {
568
- supportedTokens: Token[]
569
- isLoadingTokens: boolean
570
- } {
571
- const { customTokens } = useCustomTokens()
572
- const trailsConfig = useTrails()
573
- const queryClient = useQueryClient()
574
- const { data: supportedTokens = EMPTY_TOKENS, isLoading: isLoadingTokens } =
575
- useQuery({
576
- queryKey: ["supportedTokens"],
577
- queryFn: async () => {
578
- return getSupportedTokens({
579
- trailsApiKey: trailsConfig.trailsApiKey,
580
- trailsApiUrl: trailsConfig.trailsApiUrl,
581
- queryClient,
582
- })
583
- },
584
- staleTime: DAY_MS,
585
- gcTime: DAY_MS,
586
- refetchOnMount: false,
587
- refetchOnWindowFocus: false,
588
- refetchOnReconnect: false,
589
- enabled: !disabled,
590
- persister: queryPersister.persisterFn,
591
- })
592
-
593
- // Merge custom tokens with supported tokens
594
- // Only add custom tokens that don't already exist in supported tokens
595
- const mergedTokens = useMemo(() => {
596
- const tokenMap = new Map<string, Token>()
597
-
598
- // Add regular supported tokens first
599
- supportedTokens.forEach((token) => {
600
- const key = `${token.chainId}-${normalizeAddress(token.contractAddress)}`
601
- tokenMap.set(key, token)
602
- })
603
-
604
- // Only add custom tokens that don't already exist in supported tokens
605
- // customTokens is already Token[]
606
- customTokens.forEach((token) => {
607
- const key = `${token.chainId || 0}-${normalizeAddress(token.contractAddress)}`
608
- // Only add if it doesn't already exist (supported tokens take precedence)
609
- if (!tokenMap.has(key)) {
610
- tokenMap.set(key, token)
611
- }
612
- })
613
-
614
- return Array.from(tokenMap.values())
615
- }, [supportedTokens, customTokens])
616
-
617
- const filteredTokens = useMemo(() => {
618
- if (!chainId) {
619
- return mergedTokens
620
- }
621
- return mergedTokens.filter((token) => token.chainId === chainId)
622
- }, [mergedTokens, chainId])
623
-
624
- return {
625
- supportedTokens: filteredTokens || EMPTY_TOKENS,
626
- isLoadingTokens,
627
- }
628
- }
629
-
630
- const tokenNames: Record<string, string> = {
631
- ETH: "Ethereum",
632
- WETH: "Wrapped ETH",
633
- USDC: "USDC",
634
- USDT: "Tether",
635
- DAI: "Dai Stablecoin",
636
- OP: "Optimism",
637
- ARB: "Arbitrum",
638
- POL: "POL",
639
- MATIC: "Matic Token",
640
- BAT: "Basic Attention Token",
641
- }
642
-
643
- export const tokensToPrefix: Record<string, string> = {
644
- USDC: "USDC",
645
- ETH: "ETH",
646
- POL: "POL",
647
- }
648
-
649
- export const tokenNamePrefixes: Record<string, string> = {
650
- [optimism.id]: "Optimistic",
651
- [arbitrum.id]: "Arbitrum",
652
- [polygon.id]: "Polygon",
653
- [etherlink.id]: "Etherlink",
654
- }
655
-
656
- export function getFormatttedTokenName(
657
- currentName: string,
658
- tokenSymbol: string,
659
- chainId?: number,
660
- ): string {
661
- let name = tokenNames[tokenSymbol] || currentName || tokenSymbol
662
- if (chainId) {
663
- try {
664
- const chainInfo = getChainInfo(chainId)
665
- if (chainInfo) {
666
- if (tokensToPrefix[tokenSymbol]) {
667
- if (chainId !== mainnet.id) {
668
- name = `${chainInfo?.name} ${tokenSymbol}`
669
- }
670
- const prefix = tokenNamePrefixes[chainId]
671
- if (prefix) {
672
- name = `${prefix} ${tokenSymbol}`
673
- }
674
- }
675
- }
676
- } catch (e) {
677
- logger.console.error("[trails-sdk] Error getting chain info:", e)
678
- }
679
- }
680
- return name
681
- }
682
-
683
- export async function getTokenInfo(
684
- chainId: number,
685
- contractAddress: string,
686
- config: {
687
- trailsApiKey: string
688
- trailsApiUrl: string
689
- sequenceMetadataUrl: string
690
- queryClient?: QueryClient
691
- },
692
- ): Promise<Token | null> {
693
- const normalizedAddress = normalizeAddress(contractAddress)
694
-
695
- // Check cache first
696
- const cachedInfo = getCachedTokenInfo(chainId, normalizedAddress)
697
- if (cachedInfo) {
698
- return cachedInfo
699
- }
700
-
701
- // Get chain info first (used in multiple places)
702
- const chainInfo = getChainInfo(chainId)
703
- if (!chainInfo) {
704
- logger.console.warn(
705
- `[trails-sdk] Chain info not found for chainId: ${chainId}`,
706
- )
707
- return null
708
- }
709
-
710
- // Check if it's a native token
711
- if (isNativeToken(normalizedAddress)) {
712
- const decimals = chainInfo.nativeCurrency.decimals ?? 18
713
- const symbol = chainInfo.nativeCurrency.symbol || "Unknown"
714
- const nativeToken: Token = {
715
- tokenId: `${symbol}-${chainInfo.name || "Unknown"}`,
716
- symbol,
717
- name: chainInfo.nativeCurrency.name || "Unknown",
718
- contractAddress: zeroAddress,
719
- decimals,
720
- chainId,
721
- chainName: chainInfo.name || "Unknown",
722
- // Use getTokenImageUrl for consistency
723
- imageUrl: getTokenImageUrl({
724
- chainId,
725
- contractAddress: zeroAddress,
726
- symbol,
727
- }),
728
- isNativeToken: true,
729
- }
730
-
731
- // Cache the native token info
732
- setTokenInfoCache(`${chainId}:${normalizedAddress}`, nativeToken)
733
-
734
- return nativeToken
735
- }
736
-
737
- // Look in supported tokens
738
- const tokens = await getSupportedTokens({
739
- trailsApiKey: config.trailsApiKey,
740
- trailsApiUrl: config.trailsApiUrl,
741
- queryClient: config.queryClient,
742
- })
743
- const token = tokens.find(
744
- (t) =>
745
- t.chainId === chainId &&
746
- t.contractAddress.toLowerCase() === normalizedAddress,
747
- )
748
-
749
- if (token) {
750
- // Always use getTokenImageUrl for consistency
751
- token.imageUrl = getTokenImageUrl({
752
- chainId,
753
- contractAddress: normalizedAddress,
754
- symbol: token.symbol,
755
- })
756
-
757
- // Cache the token info
758
- setTokenInfoCache(`${chainId}:${normalizedAddress}`, token)
759
-
760
- return token
761
- }
762
-
763
- // If not found in supported tokens, try Sequence metadata service first
764
- try {
765
- const metadataClient = new SequenceMetadata(
766
- config.sequenceMetadataUrl,
767
- config.trailsApiKey,
768
- )
769
- const { contractInfo } = await metadataClient.getContractInfo({
770
- chainID: String(chainId),
771
- contractAddress: normalizedAddress,
772
- })
773
-
774
- // Only return token info if it's deployed (actually an ERC20 contract)
775
- if (contractInfo.deployed !== true) {
776
- throw new Error(
777
- `Token at ${normalizedAddress} on chain ${chainId} is not deployed`,
778
- )
779
- }
780
-
781
- if (contractInfo.decimals == null) {
782
- throw new Error(
783
- `Token at ${normalizedAddress} on chain ${chainId} has no decimals`,
784
- )
785
- }
786
-
787
- // Build token from metadata service
788
- const metadataToken: Token = {
789
- tokenId: `${contractInfo.symbol}-${chainInfo.name}`,
790
- name: contractInfo.name,
791
- symbol: contractInfo.symbol,
792
- decimals: contractInfo.decimals,
793
- chainId: chainId,
794
- contractAddress: normalizedAddress,
795
- chainName: chainInfo.name,
796
- // Use getTokenImageUrl for consistency
797
- imageUrl: getTokenImageUrl({
798
- chainId,
799
- contractAddress: normalizedAddress,
800
- symbol: contractInfo.symbol,
801
- }),
802
- isCustomToken: true,
803
- }
804
-
805
- // Cache the token info
806
- setTokenInfoCache(`${chainId}:${normalizedAddress}`, metadataToken)
807
-
808
- logger.console.log(
809
- "[trails-sdk] Fetched token info from metadata service:",
810
- metadataToken,
811
- )
812
-
813
- return metadataToken
814
- } catch (error) {
815
- logger.console.warn(
816
- "[trails-sdk] Metadata service failed, falling back to on-chain:",
817
- error,
818
- )
819
- }
820
-
821
- // Fallback to on-chain data if metadata service fails
822
- try {
823
- // Create a public client for the specific chain
824
- const publicClient = getChainRpcClient(chainId)
825
-
826
- // Read token data on-chain
827
- const [name, symbol, decimals] = await Promise.all([
828
- publicClient.readContract({
829
- address: normalizedAddress as `0x${string}`,
830
- abi: erc20Abi,
831
- functionName: "name",
832
- }),
833
- publicClient.readContract({
834
- address: normalizedAddress as `0x${string}`,
835
- abi: erc20Abi,
836
- functionName: "symbol",
837
- }),
838
- publicClient.readContract({
839
- address: normalizedAddress as `0x${string}`,
840
- abi: erc20Abi,
841
- functionName: "decimals",
842
- }),
843
- ])
844
-
845
- // Create token info from on-chain data
846
- const onChainToken: Token = {
847
- tokenId: `${symbol}-${chainInfo.name}`,
848
- name: name,
849
- symbol: symbol,
850
- decimals: decimals,
851
- chainId: chainId,
852
- contractAddress: normalizedAddress,
853
- chainName: chainInfo.name,
854
- imageUrl: getTokenImageUrl({
855
- chainId,
856
- contractAddress: normalizedAddress,
857
- symbol: symbol,
858
- }),
859
- isCustomToken: true,
860
- }
861
-
862
- // Cache the on-chain token info
863
- setTokenInfoCache(`${chainId}:${normalizedAddress}`, onChainToken)
864
-
865
- logger.console.log(
866
- "[trails-sdk] Fetched token info on-chain:",
867
- onChainToken,
868
- )
869
-
870
- return onChainToken
871
- } catch (error) {
872
- logger.console.error(
873
- "[trails-sdk] Error fetching on-chain token info:",
874
- error,
875
- )
876
- return null
877
- }
878
- }
879
-
880
- /**
881
- * Search for a token by contract address across all chains using the
882
- * Sequence Metadata findContractInfo endpoint. Returns one Token per
883
- * chain where the contract is deployed with valid ERC-20 metadata.
884
- */
885
- export async function searchTokenByAddress(
886
- contractAddress: string,
887
- config: {
888
- sequenceMetadataUrl: string
889
- trailsApiKey: string
890
- },
891
- ): Promise<Token[]> {
892
- const normalizedAddress = normalizeAddress(contractAddress)
893
-
894
- const metadataClient = new SequenceMetadata(
895
- config.sequenceMetadataUrl,
896
- config.trailsApiKey,
897
- )
898
-
899
- const { contractInfoList } = await metadataClient.findContractInfo({
900
- contractAddress: normalizedAddress,
901
- })
902
-
903
- return (contractInfoList || [])
904
- .filter(
905
- (info) =>
906
- info.deployed === true && info.decimals != null && info.decimals > 0,
907
- )
908
- .map((info): Token => {
909
- const addr = normalizeAddress(info.address)
910
- const chainInfo = getChainInfo(info.chainId)
911
- const token: Token = {
912
- tokenId: `${info.symbol}-${chainInfo?.name || `chain-${info.chainId}`}`,
913
- symbol: info.symbol,
914
- name: info.name,
915
- decimals: info.decimals!,
916
- chainId: info.chainId,
917
- contractAddress: addr,
918
- chainName: chainInfo?.name || `Chain ${info.chainId}`,
919
- imageUrl:
920
- info.logoURI ||
921
- getTokenImageUrl({
922
- chainId: info.chainId,
923
- contractAddress: addr,
924
- symbol: info.symbol,
925
- }),
926
- isCustomToken: true,
927
- }
928
-
929
- setTokenInfoCache(`${info.chainId}:${addr}`, token)
930
- return token
931
- })
932
- }
933
-
934
- // Mapping of hyphenated symbols to their canonical token symbols.
935
- // The Sequence API returns BNB-USD, but we want to use USDT instead.
936
- const HYPHENATED_SYMBOL_MAP: Record<string, string> = {
937
- "BNB-USD": "USDT",
938
- }
939
-
940
- export async function getTokenAddress(
941
- chainId: number,
942
- tokenSymbol: string,
943
- config: {
944
- trailsApiKey: string
945
- trailsApiUrl: string
946
- queryClient?: QueryClient
947
- },
948
- ) {
949
- const chainInfo = getChainInfo(chainId)
950
- // Normalize token symbol: trim whitespace and convert to uppercase for comparison
951
- const normalizedTokenSymbol = tokenSymbol.trim().toUpperCase()
952
-
953
- const nativeSymbol = (chainInfo as any)?.nativeCurrency?.symbol
954
- if (nativeSymbol && normalizedTokenSymbol === nativeSymbol.toUpperCase()) {
955
- return zeroAddress
956
- }
957
-
958
- const tokens = await getSupportedTokens(config)
959
-
960
- // First try exact match (normalized)
961
- let token = tokens.find(
962
- (t) =>
963
- t.symbol.trim().toUpperCase() === normalizedTokenSymbol &&
964
- t.chainId === chainId,
965
- )
966
-
967
- // If not found, check if it's a hyphenated symbol that maps to another symbol
968
- if (!token) {
969
- const mappedSymbol = HYPHENATED_SYMBOL_MAP[normalizedTokenSymbol]
970
- if (mappedSymbol) {
971
- token = tokens.find(
972
- (t) =>
973
- t.symbol.trim().toUpperCase() === mappedSymbol.toUpperCase() &&
974
- t.chainId === chainId,
975
- )
976
- }
977
- }
978
-
979
- if (token?.contractAddress) {
980
- return token.contractAddress
981
- }
982
-
983
- throw new Error(
984
- `Unsupported token symbol: ${tokenSymbol} for chainId: ${chainId}`,
985
- )
986
- }
987
-
988
- type UseTokenAddressProps = {
989
- chainId?: number | null
990
- tokenSymbol?: string | null
991
- }
992
-
993
- export function useTokenAddress({
994
- chainId,
995
- tokenSymbol,
996
- }: UseTokenAddressProps) {
997
- const trailsConfig = useTrails()
998
- const queryClient = useQueryClient()
999
- const { data: tokenAddress } = useQuery({
1000
- queryKey: ["tokenAddress", chainId, tokenSymbol],
1001
- queryFn: () =>
1002
- chainId && tokenSymbol
1003
- ? getTokenAddress(chainId, tokenSymbol, {
1004
- trailsApiKey: trailsConfig.trailsApiKey,
1005
- trailsApiUrl: trailsConfig.trailsApiUrl,
1006
- queryClient,
1007
- })
1008
- : null,
1009
- enabled: !!chainId && !!tokenSymbol,
1010
- staleTime: DAY_MS,
1011
- gcTime: DAY_MS,
1012
- refetchOnMount: false, // Don't refetch when cached data exists (persistence-friendly)
1013
- refetchOnWindowFocus: false, // Don't refetch when window regains focus
1014
- refetchOnReconnect: false, // Don't refetch on network reconnect
1015
- persister: queryPersister.persisterFn,
1016
- })
1017
-
1018
- return tokenAddress || null
1019
- }
1020
-
1021
- export function getCommonTokenImageUrl({
1022
- symbol,
1023
- contractAddress,
1024
- chainId,
1025
- }: {
1026
- symbol?: string | null
1027
- contractAddress?: string | null
1028
- chainId?: number | null
1029
- }) {
1030
- // If symbol is provided, try to get image from it directly
1031
- if (symbol) {
1032
- const symbolKey = tokenImageSymbolMap[symbol] ?? symbol
1033
- if (commonTokenImages[symbolKey]) {
1034
- return commonTokenImages[symbolKey]
1035
- }
1036
- }
1037
-
1038
- // If we have contractAddress and chainId, try to look up the token
1039
- if (contractAddress && chainId) {
1040
- const token = commonTokens.find(
1041
- (t) =>
1042
- t.chainId === chainId &&
1043
- addressEqual(t.contractAddress, contractAddress),
1044
- )
1045
- if (token) {
1046
- const symbolKey = tokenImageSymbolMap[token.symbol] ?? token.symbol
1047
- if (commonTokenImages[symbolKey]) {
1048
- return commonTokenImages[symbolKey]
1049
- }
1050
- }
1051
- }
1052
-
1053
- return ""
1054
- }
1055
-
1056
- // Utility function to build Sequence metadata token image URL
1057
- export function getSequenceMetadataTokenImageUrl({
1058
- chainId,
1059
- contractAddress,
1060
- fallbackImageUrl,
1061
- sequenceMetadataUrl,
1062
- }: {
1063
- chainId: number
1064
- contractAddress: string
1065
- fallbackImageUrl?: string
1066
- sequenceMetadataUrl?: string
1067
- }) {
1068
- const baseUrl = sequenceMetadataUrl || PROD_SEQUENCE_METADATA_URL
1069
- const fallbackParam = fallbackImageUrl
1070
- ? `?fallback=${encodeURIComponent(fallbackImageUrl)}`
1071
- : "?happy=true"
1072
- const imageUrl = `${baseUrl}/tokens/${chainId}/${normalizeAddress(contractAddress)}/image${fallbackParam}`
1073
- return imageUrl
1074
- }
1075
-
1076
- export function getTokenImageUrl({
1077
- chainId,
1078
- contractAddress,
1079
- symbol,
1080
- }: {
1081
- chainId?: number
1082
- contractAddress?: string
1083
- symbol?: string
1084
- fallbackImageUrl?: string
1085
- }) {
1086
- if (!chainId || !contractAddress || !symbol) {
1087
- return ""
1088
- }
1089
-
1090
- const cachedImageUrl = getCachedTokenImageUrl(
1091
- chainId,
1092
- contractAddress,
1093
- symbol,
1094
- )
1095
- if (cachedImageUrl) {
1096
- return cachedImageUrl
1097
- }
1098
-
1099
- if (symbol) {
1100
- const commonImageUrl = getCommonTokenImageUrl({
1101
- symbol,
1102
- contractAddress,
1103
- chainId,
1104
- })
1105
- if (commonImageUrl) {
1106
- return commonImageUrl
1107
- }
1108
- }
1109
-
1110
- // Use Sequence assets CDN format (same as metadata service)
1111
- // This is the proper CDN that serves token images
1112
- const imageUrl = `https://assets.sequence.info/images/tokens/large/${chainId}/${normalizeAddress(contractAddress)}.webp`
1113
-
1114
- return imageUrl
1115
- }
1116
-
1117
- // React hook that returns a configured getTokenImageUrl function
1118
- export function useGetTokenImageUrl(): {
1119
- getTokenImageUrl: (params: {
1120
- chainId?: number
1121
- contractAddress?: string
1122
- symbol?: string
1123
- fallbackImageUrl?: string
1124
- }) => string
1125
- } {
1126
- return useMemo(
1127
- () => ({
1128
- getTokenImageUrl: (params: {
1129
- chainId?: number
1130
- contractAddress?: string
1131
- symbol?: string
1132
- fallbackImageUrl?: string
1133
- }) => getTokenImageUrl(params),
1134
- }),
1135
- [],
1136
- )
1137
- }
1138
-
1139
- // React hook that returns getSequenceMetadataTokenImageUrl with context
1140
- export function useGetSequenceMetadataTokenImageUrl(): {
1141
- getSequenceMetadataTokenImageUrl: (params: {
1142
- chainId: number
1143
- contractAddress: string
1144
- fallbackImageUrl?: string
1145
- }) => string
1146
- } {
1147
- const { sequenceMetadataUrl } = useTrails()
1148
-
1149
- return useMemo(
1150
- () => ({
1151
- getSequenceMetadataTokenImageUrl: (params: {
1152
- chainId: number
1153
- contractAddress: string
1154
- fallbackImageUrl?: string
1155
- }) =>
1156
- getSequenceMetadataTokenImageUrl({
1157
- ...params,
1158
- sequenceMetadataUrl,
1159
- }),
1160
- }),
1161
- [sequenceMetadataUrl],
1162
- )
1163
- }
1164
-
1165
- // React hook for token image fetching with caching
1166
- export function useTokenImageUrl({
1167
- chainId,
1168
- contractAddress,
1169
- symbol,
1170
- }: {
1171
- chainId?: number
1172
- contractAddress?: string
1173
- symbol?: string
1174
- }): {
1175
- imageUrl: string
1176
- isLoading: boolean
1177
- error: Error | null
1178
- hasImage: boolean
1179
- } {
1180
- const { getTokenImageUrl } = useGetTokenImageUrl()
1181
- const {
1182
- data: imageUrl = "",
1183
- isLoading,
1184
- error,
1185
- } = useQuery({
1186
- queryKey: ["tokenImage", chainId, contractAddress, symbol],
1187
- queryFn: () =>
1188
- Promise.resolve(getTokenImageUrl({ chainId, contractAddress, symbol })),
1189
- enabled: !!chainId && !!contractAddress,
1190
- staleTime: DAY_MS,
1191
- gcTime: 7 * DAY_MS,
1192
- retry: 2,
1193
- retryDelay,
1194
- refetchOnWindowFocus: false,
1195
- refetchOnReconnect: false,
1196
- persister: queryPersister.persisterFn,
1197
- })
1198
-
1199
- return {
1200
- imageUrl,
1201
- isLoading,
1202
- error,
1203
- hasImage: !!imageUrl,
1204
- }
1205
- }
1206
-
1207
- export function useTokenList() {
1208
- const { supportedTokens: tokens, isLoadingTokens } = useSupportedTokens()
1209
-
1210
- return {
1211
- tokens,
1212
- isLoadingTokens: isLoadingTokens,
1213
- }
1214
- }
1215
-
1216
- export function useTokenInfo({
1217
- address,
1218
- chainId,
1219
- }: {
1220
- address: string
1221
- chainId?: number
1222
- }): {
1223
- tokenInfo: Token | null
1224
- isLoading: boolean
1225
- error: Error | null
1226
- } {
1227
- // Always call hooks unconditionally
1228
- const { getTokenImageUrl } = useGetTokenImageUrl()
1229
- const isAddress = address?.startsWith("0x") ?? false
1230
-
1231
- // Handle any native token (zero address) - before any blockchain calls
1232
- const isNativeTokenAddress = isNativeToken(address) && !!chainId
1233
-
1234
- // Check cache first
1235
- const cachedInfo = useMemo(() => {
1236
- if (!isAddress || !chainId) return null
1237
- return getCachedTokenInfo(chainId, address)
1238
- }, [isAddress, chainId, address])
1239
-
1240
- const contract = {
1241
- address: address as `0x${string}`,
1242
- abi: erc20Abi,
1243
- chainId,
1244
- } as const
1245
- const result = useReadContracts({
1246
- contracts:
1247
- !!isAddress && !!chainId && !cachedInfo && !isNativeTokenAddress
1248
- ? [
1249
- { ...contract, functionName: "name" },
1250
- { ...contract, functionName: "symbol" },
1251
- { ...contract, functionName: "decimals" },
1252
- ]
1253
- : [],
1254
- })
1255
- const error =
1256
- result?.error ?? result?.data?.find((r: any) => r.error)?.error ?? null
1257
- const [name, symbol, decimals] = result.data ?? []
1258
- const chainInfo = getChainInfo(chainId!)
1259
-
1260
- const tokenInfo = useMemo(() => {
1261
- // Handle native token (zero address) for any chain
1262
- if (isNativeTokenAddress) {
1263
- const nativeSymbol = chainInfo?.nativeCurrency.symbol || "Unknown"
1264
- const nativeName = chainInfo?.nativeCurrency.name || "Unknown"
1265
- const decimals = chainInfo?.nativeCurrency.decimals ?? 18
1266
-
1267
- const nativeToken: Token = {
1268
- tokenId: `${nativeSymbol}-${chainInfo?.name || ""}`,
1269
- name: nativeName,
1270
- symbol: nativeSymbol,
1271
- decimals,
1272
- chainId: chainId!,
1273
- contractAddress: zeroAddress,
1274
- chainName: chainInfo?.name || "",
1275
- imageUrl: getTokenImageUrl({
1276
- chainId,
1277
- contractAddress: zeroAddress,
1278
- symbol: nativeSymbol,
1279
- }),
1280
- isNativeToken: true,
1281
- }
1282
-
1283
- // Cache the native token
1284
- setTokenInfoCache(`${chainId}:${normalizeAddress(address)}`, nativeToken)
1285
-
1286
- return nativeToken
1287
- }
1288
-
1289
- // If we have cached info, use it directly (already Token)
1290
- if (cachedInfo) {
1291
- return cachedInfo
1292
- }
1293
-
1294
- // If we have blockchain data, use it and cache it
1295
- if (symbol?.result && name?.result && decimals?.result != null) {
1296
- const onChainToken: Token = {
1297
- tokenId: `${symbol.result}-${chainInfo?.name || ""}`,
1298
- name: name.result,
1299
- symbol: symbol.result,
1300
- decimals: decimals.result,
1301
- chainId: chainId!,
1302
- contractAddress: address,
1303
- chainName: chainInfo?.name ?? "",
1304
- imageUrl: getTokenImageUrl({
1305
- chainId,
1306
- contractAddress: address,
1307
- symbol: symbol.result,
1308
- }),
1309
- }
1310
-
1311
- // Cache the result as Token
1312
- setTokenInfoCache(`${chainId}:${normalizeAddress(address)}`, onChainToken)
1313
-
1314
- return onChainToken
1315
- }
1316
-
1317
- return null
1318
- }, [
1319
- address,
1320
- chainId,
1321
- isNativeTokenAddress,
1322
- cachedInfo,
1323
- chainInfo?.name,
1324
- chainInfo?.nativeCurrency.symbol,
1325
- chainInfo?.nativeCurrency.name,
1326
- chainInfo?.nativeCurrency.decimals,
1327
- name?.result,
1328
- symbol?.result,
1329
- decimals?.result,
1330
- getTokenImageUrl,
1331
- ])
1332
-
1333
- // Early return if not a valid address or chainId
1334
- if (!isAddress || !chainId) {
1335
- return {
1336
- tokenInfo: null,
1337
- isLoading: false,
1338
- error: null,
1339
- }
1340
- }
1341
-
1342
- return {
1343
- tokenInfo,
1344
- isLoading: !cachedInfo && result.isLoading,
1345
- error: error,
1346
- }
1347
- }
1348
-
1349
- export const tokenImageSymbolMap: Record<string, string> = {
1350
- ETH: "ETH",
1351
- cbETH: "ETH",
1352
- POL: "POL",
1353
- WPOL: "POL",
1354
- USDC: "USDC",
1355
- "USDC.e": "USDC",
1356
- USDT: "USDT",
1357
- DAI: "DAI",
1358
- xDAI: "DAI",
1359
- XDAI: "DAI",
1360
- WBTC: "WBTC",
1361
- cbBTC: "WBTC",
1362
- BAT: "BAT",
1363
- ARB: "ARB",
1364
- LINK: "LINK",
1365
- MON: "MON",
1366
- WMON: "MON",
1367
-
1368
- // vault tokens
1369
- aBasUSDC: "USDC",
1370
- steakUSDC: "USDC",
1371
- }
1372
-
1373
- export const commonTokens: Token[] = [
1374
- // Native tokens
1375
- {
1376
- tokenId: "ETH-ethereum",
1377
- symbol: "ETH",
1378
- name: "Ethereum",
1379
- contractAddress: zeroAddress,
1380
- decimals: 18,
1381
- chainId: mainnet.id,
1382
- chainName: mainnet.name,
1383
- imageUrl: commonTokenImages.ETH!,
1384
- isNativeToken: true,
1385
- },
1386
- {
1387
- tokenId: "ETH-arbitrum",
1388
- symbol: "ETH",
1389
- name: "ETH Arbitrum",
1390
- contractAddress: zeroAddress,
1391
- decimals: 18,
1392
- chainId: arbitrum.id,
1393
- chainName: arbitrum.name,
1394
- imageUrl: commonTokenImages.ETH!,
1395
- isNativeToken: true,
1396
- },
1397
- {
1398
- tokenId: "ETH-optimism",
1399
- symbol: "ETH",
1400
- name: "ETH Optimism",
1401
- contractAddress: zeroAddress,
1402
- decimals: 18,
1403
- chainId: optimism.id,
1404
- chainName: optimism.name,
1405
- imageUrl: commonTokenImages.ETH!,
1406
- isNativeToken: true,
1407
- },
1408
- {
1409
- tokenId: "ETH-base",
1410
- symbol: "ETH",
1411
- name: "ETH Base",
1412
- contractAddress: zeroAddress,
1413
- decimals: 18,
1414
- chainId: base.id,
1415
- chainName: base.name,
1416
- imageUrl: commonTokenImages.ETH!,
1417
- isNativeToken: true,
1418
- },
1419
- {
1420
- tokenId: "POL-polygon",
1421
- symbol: "POL",
1422
- name: "Polygon",
1423
- contractAddress: zeroAddress,
1424
- decimals: 18,
1425
- chainId: polygon.id,
1426
- chainName: polygon.name,
1427
- imageUrl: commonTokenImages.POL!,
1428
- isNativeToken: true,
1429
- },
1430
-
1431
- // USDC
1432
- {
1433
- tokenId: "USDC-ethereum",
1434
- symbol: "USDC",
1435
- name: "USDC",
1436
- contractAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
1437
- decimals: 6,
1438
- chainId: mainnet.id,
1439
- chainName: mainnet.name,
1440
- imageUrl: commonTokenImages.USDC!,
1441
- },
1442
- {
1443
- tokenId: "USDC-arbitrum",
1444
- symbol: "USDC",
1445
- name: "USDC Arbitrum",
1446
- contractAddress: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
1447
- decimals: 6,
1448
- chainId: arbitrum.id,
1449
- chainName: arbitrum.name,
1450
- imageUrl: commonTokenImages.USDC!,
1451
- },
1452
- {
1453
- tokenId: "USDC-avalanche",
1454
- symbol: "USDC",
1455
- name: "USDC Avalanche",
1456
- contractAddress: "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",
1457
- decimals: 6,
1458
- chainId: avalanche.id,
1459
- chainName: avalanche.name,
1460
- imageUrl: commonTokenImages.USDC!,
1461
- },
1462
- {
1463
- tokenId: "USDC-base",
1464
- symbol: "USDC",
1465
- name: "USDC Base",
1466
- contractAddress: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
1467
- decimals: 6,
1468
- chainId: base.id,
1469
- chainName: base.name,
1470
- imageUrl: commonTokenImages.USDC!,
1471
- },
1472
- {
1473
- tokenId: "USDC-linea",
1474
- symbol: "USDC",
1475
- name: "USDC Linea",
1476
- contractAddress: "0x176211869cA2b568f2A7D4EE941E073a821EE1ff",
1477
- decimals: 6,
1478
- chainId: linea.id,
1479
- chainName: linea.name,
1480
- imageUrl: commonTokenImages.USDC!,
1481
- },
1482
- {
1483
- tokenId: "USDC-optimism",
1484
- symbol: "USDC",
1485
- name: "USDC Optimism",
1486
- contractAddress: "0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85",
1487
- decimals: 6,
1488
- chainId: optimism.id,
1489
- chainName: optimism.name,
1490
- imageUrl: commonTokenImages.USDC!,
1491
- },
1492
- {
1493
- tokenId: "USDC-polygon",
1494
- symbol: "USDC",
1495
- name: "USDC Polygon",
1496
- contractAddress: "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",
1497
- decimals: 6,
1498
- chainId: polygon.id,
1499
- chainName: polygon.name,
1500
- imageUrl: commonTokenImages.USDC!,
1501
- },
1502
- {
1503
- tokenId: "USDC-unichain",
1504
- symbol: "USDC",
1505
- name: "USDC Unichain",
1506
- contractAddress: "0x078D782b760474a361dDA0AF3839290b0EF57AD6",
1507
- decimals: 6,
1508
- chainId: unichain.id,
1509
- chainName: unichain.name,
1510
- imageUrl: commonTokenImages.USDC!,
1511
- },
1512
- {
1513
- tokenId: "USDC-worldchain",
1514
- symbol: "USDC",
1515
- name: "USDC WorldChain",
1516
- contractAddress: "0x79A02482A880bCe3F13E09da970dC34dB4cD24D1",
1517
- decimals: 6,
1518
- chainId: worldchain.id,
1519
- chainName: worldchain.name,
1520
- imageUrl: commonTokenImages.USDC!,
1521
- },
1522
-
1523
- // Basic Attention Token
1524
- {
1525
- tokenId: "BAT-ethereum",
1526
- symbol: "BAT",
1527
- name: "Basic Attention Token",
1528
- contractAddress: "0x0D8775F648430679A709E98d2b0Cb6250d2887EF",
1529
- decimals: 18,
1530
- chainId: mainnet.id,
1531
- chainName: mainnet.name,
1532
- imageUrl: commonTokenImages.BAT!,
1533
- },
1534
- {
1535
- tokenId: "BAT-polygon",
1536
- symbol: "BAT",
1537
- name: "Basic Attention Token",
1538
- contractAddress: "0x3Cef98bb43d732E2F285eE605a8158cDE967D219",
1539
- decimals: 18,
1540
- chainId: polygon.id,
1541
- chainName: polygon.name,
1542
- imageUrl: commonTokenImages.BAT!,
1543
- },
1544
- {
1545
- tokenId: "BAT-avalanche",
1546
- symbol: "BAT",
1547
- name: "Basic Attention Token",
1548
- contractAddress: "0x98443B96EA4b0858FDF3219Cd13e98C7A4690588",
1549
- decimals: 18,
1550
- chainId: avalanche.id,
1551
- chainName: avalanche.name,
1552
- imageUrl: commonTokenImages.BAT!,
1553
- },
1554
-
1555
- // ARB
1556
- {
1557
- tokenId: "ARB-arbitrum",
1558
- symbol: "ARB",
1559
- name: "Arbitrum",
1560
- contractAddress: "0x912CE59144191C1204E64559FE8253a0e49E6548",
1561
- decimals: 18,
1562
- chainId: arbitrum.id,
1563
- chainName: arbitrum.name,
1564
- imageUrl: commonTokenImages.ARB!,
1565
- },
1566
-
1567
- // Chainlink
1568
- {
1569
- tokenId: "LINK-ethereum",
1570
- symbol: "LINK",
1571
- name: "Chainlink",
1572
- contractAddress: "0x514910771AF9Ca656af840dff83E8264EcF986CA",
1573
- decimals: 18,
1574
- chainId: mainnet.id,
1575
- chainName: mainnet.name,
1576
- imageUrl: commonTokenImages.LINK!,
1577
- },
1578
-
1579
- // USDT (Tether)
1580
- {
1581
- tokenId: "USDT-ethereum",
1582
- symbol: "USDT",
1583
- name: "Tether USD",
1584
- contractAddress: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
1585
- decimals: 6,
1586
- chainId: mainnet.id,
1587
- chainName: mainnet.name,
1588
- imageUrl: commonTokenImages.USDT!,
1589
- },
1590
- {
1591
- tokenId: "USDT-polygon",
1592
- symbol: "USDT",
1593
- name: "Tether USD",
1594
- contractAddress: "0xc2132D05D31c914a87C6611C10748AEb04B58e8F",
1595
- decimals: 6,
1596
- chainId: polygon.id,
1597
- chainName: polygon.name,
1598
- imageUrl: commonTokenImages.USDT!,
1599
- },
1600
- {
1601
- tokenId: "USDT-arbitrum",
1602
- symbol: "USDT",
1603
- name: "Tether USD",
1604
- contractAddress: "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",
1605
- decimals: 6,
1606
- chainId: arbitrum.id,
1607
- chainName: arbitrum.name,
1608
- imageUrl: commonTokenImages.USDT!,
1609
- },
1610
- {
1611
- tokenId: "USDT-optimism",
1612
- symbol: "USDT",
1613
- name: "Tether USD",
1614
- contractAddress: "0x94b008aA00579c1307B0EF2c499aD98a8ce58e58",
1615
- decimals: 6,
1616
- chainId: optimism.id,
1617
- chainName: optimism.name,
1618
- imageUrl: commonTokenImages.USDT!,
1619
- },
1620
- {
1621
- tokenId: "USDT-avalanche",
1622
- symbol: "USDT",
1623
- name: "Tether USD",
1624
- contractAddress: "0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7",
1625
- decimals: 6,
1626
- chainId: avalanche.id,
1627
- chainName: avalanche.name,
1628
- imageUrl: commonTokenImages.USDT!,
1629
- },
1630
-
1631
- // DAI
1632
- {
1633
- tokenId: "DAI-ethereum",
1634
- symbol: "DAI",
1635
- name: "Dai Stablecoin",
1636
- contractAddress: "0x6B175474E89094C44Da98b954EedeAC495271d0F",
1637
- decimals: 18,
1638
- chainId: mainnet.id,
1639
- chainName: mainnet.name,
1640
- imageUrl: commonTokenImages.DAI!,
1641
- },
1642
- {
1643
- tokenId: "DAI-polygon",
1644
- symbol: "DAI",
1645
- name: "Dai Stablecoin",
1646
- contractAddress: "0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063",
1647
- decimals: 18,
1648
- chainId: polygon.id,
1649
- chainName: polygon.name,
1650
- imageUrl: commonTokenImages.DAI!,
1651
- },
1652
- {
1653
- tokenId: "DAI-arbitrum",
1654
- symbol: "DAI",
1655
- name: "Dai Stablecoin",
1656
- contractAddress: "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1",
1657
- decimals: 18,
1658
- chainId: arbitrum.id,
1659
- chainName: arbitrum.name,
1660
- imageUrl: commonTokenImages.DAI!,
1661
- },
1662
- {
1663
- tokenId: "DAI-optimism",
1664
- symbol: "DAI",
1665
- name: "Dai Stablecoin",
1666
- contractAddress: "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1",
1667
- decimals: 18,
1668
- chainId: optimism.id,
1669
- chainName: optimism.name,
1670
- imageUrl: commonTokenImages.DAI!,
1671
- },
1672
-
1673
- // MATIC (on Ethereum mainnet as ERC20)
1674
- {
1675
- tokenId: "MATIC-ethereum",
1676
- symbol: "MATIC",
1677
- name: "Matic Token",
1678
- contractAddress: "0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0",
1679
- decimals: 18,
1680
- chainId: mainnet.id,
1681
- chainName: mainnet.name,
1682
- imageUrl: commonTokenImages.MATIC!,
1683
- },
1684
-
1685
- // Etherlink tokens
1686
- {
1687
- tokenId: "XTZ-etherlink",
1688
- symbol: "XTZ",
1689
- name: "Tezos",
1690
- contractAddress: zeroAddress,
1691
- decimals: 18,
1692
- chainId: etherlink.id,
1693
- chainName: etherlink.name,
1694
- imageUrl: commonTokenImages.XTZ as string,
1695
- isNativeToken: true,
1696
- },
1697
- {
1698
- tokenId: "WXTZ-etherlink",
1699
- symbol: "WXTZ",
1700
- name: "Wrapped XTZ",
1701
- contractAddress: "0xc9B53AB2679f573e480d01e0f49e2B5CFB7a3EAb",
1702
- decimals: 18,
1703
- chainId: etherlink.id,
1704
- chainName: etherlink.name,
1705
- imageUrl: commonTokenImages.WXTZ as string,
1706
- },
1707
- {
1708
- tokenId: "USDC-etherlink",
1709
- symbol: "USDC",
1710
- name: "USD Coin",
1711
- contractAddress: "0x796Ea11Fa2dD751eD01b53C372fFDB4AAa8f00F9",
1712
- decimals: 6,
1713
- chainId: etherlink.id,
1714
- chainName: etherlink.name,
1715
- imageUrl: commonTokenImages.USDC as string,
1716
- },
1717
- {
1718
- tokenId: "WETH-etherlink",
1719
- symbol: "WETH",
1720
- name: "Wrapped ETH",
1721
- contractAddress: "0xfc24f770F94edBca6D6f885E12d4317320BcB401",
1722
- decimals: 18,
1723
- chainId: etherlink.id,
1724
- chainName: etherlink.name,
1725
- imageUrl: commonTokenImages.WETH as string,
1726
- },
1727
- {
1728
- tokenId: "USDT-etherlink",
1729
- symbol: "USDT",
1730
- name: "Bridged USDT",
1731
- contractAddress: "0x2C03058C8AFC06713be23e58D2febC8337dbfE6A",
1732
- decimals: 6,
1733
- chainId: etherlink.id,
1734
- chainName: etherlink.name,
1735
- imageUrl: commonTokenImages.USDT as string,
1736
- },
1737
- {
1738
- tokenId: "USDT-bsc",
1739
- symbol: "USDT",
1740
- name: "Tether USD",
1741
- contractAddress: "0x55d398326f99059ff775485246999027b3197955",
1742
- decimals: 18,
1743
- chainId: bsc.id,
1744
- chainName: bsc.name,
1745
- imageUrl: commonTokenImages.USDT as string,
1746
- },
1747
- {
1748
- tokenId: "USDC-bsc",
1749
- symbol: "USDC",
1750
- name: "USDC",
1751
- contractAddress: "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d",
1752
- decimals: 18,
1753
- chainId: bsc.id,
1754
- chainName: bsc.name,
1755
- imageUrl: commonTokenImages.USDC as string,
1756
- },
1757
- {
1758
- tokenId: "DAI-bsc",
1759
- symbol: "DAI",
1760
- name: "Dai Stablecoin",
1761
- contractAddress: "0x1af3f329e8be154074d8769d1ffa4ee058b1dbc3",
1762
- decimals: 18,
1763
- chainId: bsc.id,
1764
- chainName: bsc.name,
1765
- imageUrl: commonTokenImages.DAI as string,
1766
- },
1767
- {
1768
- tokenId: "BNB-bsc",
1769
- symbol: "BNB",
1770
- name: "BNB",
1771
- contractAddress: zeroAddress,
1772
- decimals: 18,
1773
- chainId: bsc.id,
1774
- chainName: bsc.name,
1775
- imageUrl: commonTokenImages.BNB as string,
1776
- isNativeToken: true,
1777
- },
1778
- {
1779
- tokenId: "AVAX-bsc",
1780
- symbol: "AVAX",
1781
- name: "Avalanche Token",
1782
- contractAddress: "0x1ce0c2827e2ef14d5c4f29a091d735a204794041",
1783
- decimals: 18,
1784
- chainId: bsc.id,
1785
- chainName: bsc.name,
1786
- imageUrl: commonTokenImages.AVAX as string,
1787
- },
1788
-
1789
- // Somnia
1790
- {
1791
- tokenId: "SOMI-somnia",
1792
- symbol: "SOMI",
1793
- name: "Somnia",
1794
- contractAddress: zeroAddress,
1795
- decimals: 18,
1796
- chainId: somnia.id,
1797
- chainName: somnia.name,
1798
- imageUrl: commonTokenImages.SOMI as string,
1799
- isNativeToken: true,
1800
- },
1801
-
1802
- // Monad
1803
- {
1804
- tokenId: "MON-monad",
1805
- symbol: "MON",
1806
- name: "Monad",
1807
- contractAddress: zeroAddress,
1808
- decimals: 18,
1809
- chainId: monad.id,
1810
- chainName: monad.name,
1811
- imageUrl: commonTokenImages.MONAD as string,
1812
- isNativeToken: true,
1813
- },
1814
- {
1815
- tokenId: "WMON-monad",
1816
- symbol: "WMON",
1817
- name: "Wrapped MON",
1818
- contractAddress: "0x3bd359c1119da7da1d913d1c4d2b7c461115433a",
1819
- decimals: 18,
1820
- chainId: monad.id,
1821
- chainName: monad.name,
1822
- imageUrl: commonTokenImages.MON as string,
1823
- },
1824
- {
1825
- tokenId: "USDC-monad",
1826
- symbol: "USDC",
1827
- name: "USDC",
1828
- contractAddress: "0x754704Bc059F8C67012fEd69BC8A327a5aafb603",
1829
- decimals: 6,
1830
- chainId: monad.id,
1831
- chainName: monad.name,
1832
- imageUrl: commonTokenImages.USDC as string,
1833
- },
1834
- ]
1835
-
1836
- // wrapped-native addresses
1837
- export const wethAddresses: Record<string, string> = {
1838
- [mainnet.id]: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
1839
- [optimism.id]: "0x4200000000000000000000000000000000000006",
1840
- [bsc.id]: "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c",
1841
- [gnosis.id]: "0xe91d153e0b41518a2ce8dd3d7944fa863463a97d",
1842
- [unichain.id]: "0x4200000000000000000000000000000000000006",
1843
- [base.id]: "0x4200000000000000000000000000000000000006",
1844
- [sonic.id]: "0x039e2fb66102314ce7b64ce5ce3e5183bc94ad38",
1845
- [fantom.id]: "0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83",
1846
- [zksync.id]: "0x5aea5775959fbc2557cc8789bc1bf90a239d9a91",
1847
- [worldchain.id]: "0x4200000000000000000000000000000000000006",
1848
- [hyperEvm.id]: "0x5555555555555555555555555555555555555555",
1849
- [polygon.id]: "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270",
1850
- [ink.id]: "0x4200000000000000000000000000000000000006",
1851
- [linea.id]: "0xe5d7c2a44ffddf6b295a15c148167daaaf5cf34f",
1852
- [arbitrum.id]: "0x82af49447d8a07e3bd95bd0d56f35241523fbab1",
1853
- [avalanche.id]: "0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7",
1854
- [scroll.id]: "0x5300000000000000000000000000000000000004",
1855
- [katana.id]: "0xee7d8bcfb72bc1880d0cf19822eb0a2e6577ab62",
1856
- [berachain.id]: "0x6969696969696969696969696969696969696969",
1857
- [blast.id]: "0x4300000000000000000000000000000000000004",
1858
- }
1859
-
1860
- export function getWethAddress(chainId: number): string | null {
1861
- return wethAddresses[chainId] ?? null
1862
- }