0xtrails 0.6.6 → 0.7.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 (365) hide show
  1. package/dist/aave.d.ts +10 -2
  2. package/dist/aave.d.ts.map +1 -1
  3. package/dist/analytics.d.ts +26 -0
  4. package/dist/analytics.d.ts.map +1 -1
  5. package/dist/{ccip-CbJrlK-L.js → ccip-fConRNoG.js} +21 -21
  6. package/dist/chains.d.ts +23 -8
  7. package/dist/chains.d.ts.map +1 -1
  8. package/dist/constants.d.ts +5 -5
  9. package/dist/constants.d.ts.map +1 -1
  10. package/dist/customTokens.d.ts +12 -0
  11. package/dist/customTokens.d.ts.map +1 -0
  12. package/dist/decoders.d.ts +2 -2
  13. package/dist/decoders.d.ts.map +1 -1
  14. package/dist/error.d.ts.map +1 -1
  15. package/dist/fees.d.ts +37 -2
  16. package/dist/fees.d.ts.map +1 -1
  17. package/dist/gasless.d.ts +15 -36
  18. package/dist/gasless.d.ts.map +1 -1
  19. package/dist/{index-w7_dK4c5.js → index-BbajxCG_.js} +59269 -77146
  20. package/dist/index.d.ts +8 -6
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +828 -359
  23. package/dist/indexerClient.d.ts.map +1 -1
  24. package/dist/intentReceiptMonitor.d.ts +1 -1
  25. package/dist/intentReceiptMonitor.d.ts.map +1 -1
  26. package/dist/intentReceiptPoller.d.ts +1 -1
  27. package/dist/intentReceiptPoller.d.ts.map +1 -1
  28. package/dist/intents.d.ts +3 -2
  29. package/dist/intents.d.ts.map +1 -1
  30. package/dist/mode.d.ts +1 -1
  31. package/dist/mode.d.ts.map +1 -1
  32. package/dist/mutations.d.ts +2 -2
  33. package/dist/mutations.d.ts.map +1 -1
  34. package/dist/prepareSend.d.ts +2 -2
  35. package/dist/prepareSend.d.ts.map +1 -1
  36. package/dist/prices.d.ts +1 -1
  37. package/dist/prices.d.ts.map +1 -1
  38. package/dist/sequenceWallet.d.ts +2 -2
  39. package/dist/sequenceWallet.d.ts.map +1 -1
  40. package/dist/time.d.ts +6 -0
  41. package/dist/time.d.ts.map +1 -1
  42. package/dist/tokenBalances.d.ts +40 -25
  43. package/dist/tokenBalances.d.ts.map +1 -1
  44. package/dist/tokens.d.ts +54 -14
  45. package/dist/tokens.d.ts.map +1 -1
  46. package/dist/trailsClient.d.ts +1 -1
  47. package/dist/trailsClient.d.ts.map +1 -1
  48. package/dist/trailsRouter.d.ts +2 -1
  49. package/dist/trailsRouter.d.ts.map +1 -1
  50. package/dist/transactionIntent/deposits/depositOrchestrator.d.ts +3 -2
  51. package/dist/transactionIntent/deposits/depositOrchestrator.d.ts.map +1 -1
  52. package/dist/transactionIntent/deposits/gaslessDeposit.d.ts +2 -1
  53. package/dist/transactionIntent/deposits/gaslessDeposit.d.ts.map +1 -1
  54. package/dist/transactionIntent/execution/transactionState.d.ts +1 -1
  55. package/dist/transactionIntent/execution/transactionState.d.ts.map +1 -1
  56. package/dist/transactionIntent/handlers/crossChain.d.ts +5 -3
  57. package/dist/transactionIntent/handlers/crossChain.d.ts.map +1 -1
  58. package/dist/transactionIntent/handlers/sameChainSameToken.d.ts +5 -3
  59. package/dist/transactionIntent/handlers/sameChainSameToken.d.ts.map +1 -1
  60. package/dist/transactionIntent/quote/feeExtractors.d.ts +1 -6
  61. package/dist/transactionIntent/quote/feeExtractors.d.ts.map +1 -1
  62. package/dist/transactionIntent/quote/normalizeQuote.d.ts +4 -2
  63. package/dist/transactionIntent/quote/normalizeQuote.d.ts.map +1 -1
  64. package/dist/transactionIntent/quote/quoteHelpers.d.ts +1 -1
  65. package/dist/transactionIntent/quote/quoteHelpers.d.ts.map +1 -1
  66. package/dist/transactionIntent/types.d.ts +28 -5
  67. package/dist/transactionIntent/types.d.ts.map +1 -1
  68. package/dist/transactionIntent/utils/testnetHelpers.d.ts +0 -1
  69. package/dist/transactionIntent/utils/testnetHelpers.d.ts.map +1 -1
  70. package/dist/transactionIntent/validators.d.ts +0 -2
  71. package/dist/transactionIntent/validators.d.ts.map +1 -1
  72. package/dist/transactions.d.ts +2 -2
  73. package/dist/transactions.d.ts.map +1 -1
  74. package/dist/utils.d.ts +7 -0
  75. package/dist/utils.d.ts.map +1 -1
  76. package/dist/wallets.d.ts +1 -0
  77. package/dist/wallets.d.ts.map +1 -1
  78. package/dist/widget/components/AccountIntentTransactionHistory.d.ts.map +1 -1
  79. package/dist/widget/components/AddressWalletIcon.d.ts +6 -0
  80. package/dist/widget/components/AddressWalletIcon.d.ts.map +1 -0
  81. package/dist/widget/components/ChainFilterDropdown.d.ts +2 -6
  82. package/dist/widget/components/ChainFilterDropdown.d.ts.map +1 -1
  83. package/dist/widget/components/ChainImage.d.ts.map +1 -1
  84. package/dist/widget/components/ChainList.d.ts +0 -5
  85. package/dist/widget/components/ChainList.d.ts.map +1 -1
  86. package/dist/widget/components/ClassicSwap.d.ts +6 -6
  87. package/dist/widget/components/ClassicSwap.d.ts.map +1 -1
  88. package/dist/widget/components/ConnectWallet.d.ts.map +1 -1
  89. package/dist/widget/components/ConnectedWallets.d.ts.map +1 -1
  90. package/dist/widget/components/DebugMenu.d.ts +1 -1
  91. package/dist/widget/components/DebugMenu.d.ts.map +1 -1
  92. package/dist/widget/components/DebugScreensList.d.ts.map +1 -1
  93. package/dist/widget/components/DepositTracker.d.ts.map +1 -1
  94. package/dist/widget/components/Earn.d.ts +5 -5
  95. package/dist/widget/components/Earn.d.ts.map +1 -1
  96. package/dist/widget/components/FeeOption.d.ts +1 -1
  97. package/dist/widget/components/FeeOption.d.ts.map +1 -1
  98. package/dist/widget/components/FeeOptions.d.ts +2 -2
  99. package/dist/widget/components/FeeOptions.d.ts.map +1 -1
  100. package/dist/widget/components/Footer.d.ts +1 -1
  101. package/dist/widget/components/Footer.d.ts.map +1 -1
  102. package/dist/widget/components/Fund.d.ts +5 -5
  103. package/dist/widget/components/Fund.d.ts.map +1 -1
  104. package/dist/widget/components/FundMethods.d.ts +0 -1
  105. package/dist/widget/components/FundMethods.d.ts.map +1 -1
  106. package/dist/widget/components/FundSwap.d.ts +6 -6
  107. package/dist/widget/components/FundSwap.d.ts.map +1 -1
  108. package/dist/widget/components/HookModalContent.d.ts +8 -0
  109. package/dist/widget/components/HookModalContent.d.ts.map +1 -0
  110. package/dist/widget/components/OriginSelectionAmount.d.ts +11 -0
  111. package/dist/widget/components/OriginSelectionAmount.d.ts.map +1 -0
  112. package/dist/widget/components/Pay.d.ts +5 -5
  113. package/dist/widget/components/Pay.d.ts.map +1 -1
  114. package/dist/widget/components/PoolDeposit.d.ts +5 -5
  115. package/dist/widget/components/PoolDeposit.d.ts.map +1 -1
  116. package/dist/widget/components/PoolWithdraw.d.ts +3 -3
  117. package/dist/widget/components/PoolWithdraw.d.ts.map +1 -1
  118. package/dist/widget/components/QuoteDetails.d.ts.map +1 -1
  119. package/dist/widget/components/Receipt.d.ts +2 -1
  120. package/dist/widget/components/Receipt.d.ts.map +1 -1
  121. package/dist/widget/components/RecentTokens.d.ts +4 -4
  122. package/dist/widget/components/RecentTokens.d.ts.map +1 -1
  123. package/dist/widget/components/RecipientSelectorButton.d.ts.map +1 -1
  124. package/dist/widget/components/ShadowPortal.d.ts +6 -0
  125. package/dist/widget/components/ShadowPortal.d.ts.map +1 -0
  126. package/dist/widget/components/Swap.d.ts +6 -6
  127. package/dist/widget/components/Swap.d.ts.map +1 -1
  128. package/dist/widget/components/ThemeProvider.d.ts +1 -1
  129. package/dist/widget/components/ThemeProvider.d.ts.map +1 -1
  130. package/dist/widget/components/TokenList.d.ts +3 -4
  131. package/dist/widget/components/TokenList.d.ts.map +1 -1
  132. package/dist/widget/components/TokenSelector.d.ts +3 -4
  133. package/dist/widget/components/TokenSelector.d.ts.map +1 -1
  134. package/dist/widget/components/Tooltip.d.ts +6 -1
  135. package/dist/widget/components/Tooltip.d.ts.map +1 -1
  136. package/dist/widget/components/TrailsHookModal.d.ts +10 -0
  137. package/dist/widget/components/TrailsHookModal.d.ts.map +1 -0
  138. package/dist/widget/components/WaasFeeOptions.d.ts +3 -0
  139. package/dist/widget/components/WaasFeeOptions.d.ts.map +1 -1
  140. package/dist/widget/components/WalletConfirmation.d.ts.map +1 -1
  141. package/dist/widget/components/WalletConnect.d.ts.map +1 -1
  142. package/dist/widget/components/WidgetProviders.d.ts +14 -0
  143. package/dist/widget/components/WidgetProviders.d.ts.map +1 -0
  144. package/dist/widget/css/compiled.css +1 -1
  145. package/dist/widget/hooks/useAddressWalletIcon.d.ts +10 -0
  146. package/dist/widget/hooks/useAddressWalletIcon.d.ts.map +1 -0
  147. package/dist/widget/hooks/useBalanceVisible.d.ts +1 -1
  148. package/dist/widget/hooks/useBalanceVisible.d.ts.map +1 -1
  149. package/dist/widget/hooks/useChainFilter.d.ts +1 -1
  150. package/dist/widget/hooks/useChainFilter.d.ts.map +1 -1
  151. package/dist/widget/hooks/useCheckout.d.ts +13 -1
  152. package/dist/widget/hooks/useCheckout.d.ts.map +1 -1
  153. package/dist/widget/hooks/useConnector.d.ts +4 -0
  154. package/dist/widget/hooks/useConnector.d.ts.map +1 -0
  155. package/dist/widget/hooks/useCurrentScreen.d.ts +1 -1
  156. package/dist/widget/hooks/useCurrentScreen.d.ts.map +1 -1
  157. package/dist/widget/hooks/useCustomTokenFetch.d.ts +19 -0
  158. package/dist/widget/hooks/useCustomTokenFetch.d.ts.map +1 -0
  159. package/dist/widget/hooks/useCustomTokenSearch.d.ts +20 -0
  160. package/dist/widget/hooks/useCustomTokenSearch.d.ts.map +1 -0
  161. package/dist/widget/hooks/useDebounce.d.ts +10 -0
  162. package/dist/widget/hooks/useDebounce.d.ts.map +1 -0
  163. package/dist/widget/hooks/useDebugScreens.d.ts +7 -2
  164. package/dist/widget/hooks/useDebugScreens.d.ts.map +1 -1
  165. package/dist/widget/hooks/useDefaultTokenSelection.d.ts +3 -19
  166. package/dist/widget/hooks/useDefaultTokenSelection.d.ts.map +1 -1
  167. package/dist/widget/hooks/useDestinationSelectedToken.d.ts +1 -14
  168. package/dist/widget/hooks/useDestinationSelectedToken.d.ts.map +1 -1
  169. package/dist/widget/hooks/useEarnPool.d.ts +1 -1
  170. package/dist/widget/hooks/useEarnPool.d.ts.map +1 -1
  171. package/dist/widget/hooks/useIntentTransactionHistory.d.ts.map +1 -1
  172. package/dist/widget/hooks/useIsMobile.d.ts +5 -0
  173. package/dist/widget/hooks/useIsMobile.d.ts.map +1 -0
  174. package/dist/widget/hooks/useMode.d.ts +2 -2
  175. package/dist/widget/hooks/useMode.d.ts.map +1 -1
  176. package/dist/widget/hooks/useOriginSelectedToken.d.ts +2 -15
  177. package/dist/widget/hooks/useOriginSelectedToken.d.ts.map +1 -1
  178. package/dist/widget/hooks/usePayMessage.d.ts.map +1 -1
  179. package/dist/widget/hooks/usePriceImpactWarning.d.ts +1 -1
  180. package/dist/widget/hooks/usePriceImpactWarning.d.ts.map +1 -1
  181. package/dist/widget/hooks/useQuote.d.ts +173 -4
  182. package/dist/widget/hooks/useQuote.d.ts.map +1 -1
  183. package/dist/widget/hooks/useRecentTokens.d.ts +3 -3
  184. package/dist/widget/hooks/useRecentTokens.d.ts.map +1 -1
  185. package/dist/widget/hooks/useRecipients.d.ts +1 -1
  186. package/dist/widget/hooks/useRecipients.d.ts.map +1 -1
  187. package/dist/widget/hooks/useSelectedFeeOption.d.ts +2 -2
  188. package/dist/widget/hooks/useSelectedFeeOption.d.ts.map +1 -1
  189. package/dist/widget/hooks/useSelectedFundMethod.d.ts +1 -1
  190. package/dist/widget/hooks/useSelectedFundMethod.d.ts.map +1 -1
  191. package/dist/widget/hooks/useSelectedRecipient.d.ts +1 -1
  192. package/dist/widget/hooks/useSelectedRecipient.d.ts.map +1 -1
  193. package/dist/widget/hooks/useSendForm.d.ts +9 -31
  194. package/dist/widget/hooks/useSendForm.d.ts.map +1 -1
  195. package/dist/widget/hooks/useSwapAmount.d.ts +1 -1
  196. package/dist/widget/hooks/useSwapAmount.d.ts.map +1 -1
  197. package/dist/widget/hooks/useTheme.d.ts +1 -1
  198. package/dist/widget/hooks/useTheme.d.ts.map +1 -1
  199. package/dist/widget/hooks/useTokenList.d.ts +7 -31
  200. package/dist/widget/hooks/useTokenList.d.ts.map +1 -1
  201. package/dist/widget/hooks/useTrailsSendTransaction.d.ts +83 -0
  202. package/dist/widget/hooks/useTrailsSendTransaction.d.ts.map +1 -0
  203. package/dist/widget/hooks/useWalletConnectUri.d.ts +11 -0
  204. package/dist/widget/hooks/useWalletConnectUri.d.ts.map +1 -0
  205. package/dist/widget/hooks/useWidgetProps.d.ts +5 -0
  206. package/dist/widget/hooks/useWidgetProps.d.ts.map +1 -1
  207. package/dist/widget/index.d.ts +2 -0
  208. package/dist/widget/index.d.ts.map +1 -1
  209. package/dist/widget/index.js +8 -5
  210. package/dist/widget/providers/TrailsModalProvider.d.ts +65 -0
  211. package/dist/widget/providers/TrailsModalProvider.d.ts.map +1 -0
  212. package/dist/widget/providers/TrailsProvider.d.ts +1 -1
  213. package/dist/widget/providers/TrailsProvider.d.ts.map +1 -1
  214. package/dist/widget/types.d.ts +11 -18
  215. package/dist/widget/types.d.ts.map +1 -1
  216. package/dist/widget/widget.d.ts +20 -11
  217. package/dist/widget/widget.d.ts.map +1 -1
  218. package/package.json +45 -49
  219. package/src/aave.ts +387 -138
  220. package/src/analytics.ts +208 -2
  221. package/src/chains.ts +65 -64
  222. package/src/constants.ts +18 -14
  223. package/src/customTokens.ts +151 -0
  224. package/src/decoders.ts +4 -7
  225. package/src/error.ts +7 -3
  226. package/src/fees.ts +239 -125
  227. package/src/gasless.ts +54 -108
  228. package/src/index.ts +29 -9
  229. package/src/indexerClient.ts +2 -0
  230. package/src/intentReceiptMonitor.ts +1 -4
  231. package/src/intentReceiptPoller.ts +2 -2
  232. package/src/intents.ts +16 -5
  233. package/src/mode.ts +1 -1
  234. package/src/mutations.ts +7 -3
  235. package/src/prepareSend.ts +19 -14
  236. package/src/prices.ts +1 -1
  237. package/src/sequenceWallet.ts +2 -2
  238. package/src/time.ts +28 -0
  239. package/src/tokenBalances.ts +348 -153
  240. package/src/tokens.ts +393 -142
  241. package/src/trailsClient.ts +1 -1
  242. package/src/trailsRouter.ts +4 -5
  243. package/src/transactionIntent/deposits/depositOrchestrator.ts +6 -2
  244. package/src/transactionIntent/deposits/gaslessDeposit.ts +13 -7
  245. package/src/transactionIntent/deposits/standardDeposit.ts +1 -1
  246. package/src/transactionIntent/execution/transactionState.ts +1 -1
  247. package/src/transactionIntent/handlers/crossChain.ts +75 -37
  248. package/src/transactionIntent/handlers/sameChainSameToken.ts +66 -20
  249. package/src/transactionIntent/quote/feeExtractors.ts +1 -29
  250. package/src/transactionIntent/quote/normalizeQuote.ts +99 -7
  251. package/src/transactionIntent/quote/quoteHelpers.ts +1 -1
  252. package/src/transactionIntent/types.ts +31 -6
  253. package/src/transactionIntent/utils/testnetHelpers.ts +0 -5
  254. package/src/transactionIntent/validators.ts +0 -30
  255. package/src/transactions.ts +3 -3
  256. package/src/utils.ts +18 -0
  257. package/src/wallets.ts +32 -10
  258. package/src/widget/compiled.css +1 -1
  259. package/src/widget/components/AccountIntentTransactionHistory.tsx +2 -1
  260. package/src/widget/components/AccountIntentTransactionHistoryButton.tsx +2 -2
  261. package/src/widget/components/AddressWalletIcon.tsx +29 -0
  262. package/src/widget/components/ChainFilterDropdown.tsx +2 -8
  263. package/src/widget/components/ChainImage.tsx +8 -5
  264. package/src/widget/components/ChainList.tsx +6 -8
  265. package/src/widget/components/ClassicSwap.tsx +93 -85
  266. package/src/widget/components/ConnectWallet.tsx +1 -2
  267. package/src/widget/components/ConnectedWallets.tsx +17 -4
  268. package/src/widget/components/DebugMenu.tsx +2 -2
  269. package/src/widget/components/DebugScreensList.tsx +0 -1
  270. package/src/widget/components/DepositTracker.tsx +20 -34
  271. package/src/widget/components/Earn.tsx +7 -6
  272. package/src/widget/components/FeeOption.tsx +4 -4
  273. package/src/widget/components/FeeOptions.tsx +19 -39
  274. package/src/widget/components/Footer.tsx +1 -1
  275. package/src/widget/components/Fund.tsx +23 -119
  276. package/src/widget/components/FundMethods.tsx +9 -6
  277. package/src/widget/components/FundSwap.tsx +6 -5
  278. package/src/widget/components/FundingMethodSelectorButton.tsx +2 -2
  279. package/src/widget/components/HookModalContent.tsx +306 -0
  280. package/src/widget/components/Modal.tsx +1 -1
  281. package/src/widget/components/OriginSelectionAmount.tsx +135 -0
  282. package/src/widget/components/Pay.tsx +66 -124
  283. package/src/widget/components/PoolDeposit.tsx +11 -55
  284. package/src/widget/components/PoolWithdraw.tsx +3 -3
  285. package/src/widget/components/QuoteDetails.tsx +473 -728
  286. package/src/widget/components/Receipt.tsx +74 -7
  287. package/src/widget/components/RecentTokens.tsx +8 -8
  288. package/src/widget/components/RecipientSelectorButton.tsx +4 -2
  289. package/src/widget/components/ScreenHeader.tsx +2 -2
  290. package/src/widget/components/SearchInputField.tsx +1 -1
  291. package/src/widget/components/ShadowPortal.tsx +58 -0
  292. package/src/widget/components/Swap.tsx +6 -5
  293. package/src/widget/components/ThemeProvider.tsx +1 -1
  294. package/src/widget/components/TokenList.tsx +3 -4
  295. package/src/widget/components/TokenSelector.tsx +211 -80
  296. package/src/widget/components/Tooltip.tsx +18 -7
  297. package/src/widget/components/TrailsHookModal.tsx +118 -0
  298. package/src/widget/components/WaasFeeOptions.tsx +333 -138
  299. package/src/widget/components/WalletConfirmation.tsx +7 -2
  300. package/src/widget/components/WalletConnect.tsx +197 -235
  301. package/src/widget/components/WidgetProviders.tsx +75 -0
  302. package/src/widget/hooks/useAddressWalletIcon.ts +53 -0
  303. package/src/widget/hooks/useBalanceVisible.tsx +1 -1
  304. package/src/widget/hooks/useChainFilter.tsx +1 -1
  305. package/src/widget/hooks/useCheckout.ts +13 -1
  306. package/src/widget/hooks/useConnector.tsx +18 -0
  307. package/src/widget/hooks/useCurrentScreen.tsx +3 -3
  308. package/src/widget/hooks/useCustomTokenFetch.tsx +72 -0
  309. package/src/widget/hooks/useCustomTokenSearch.tsx +402 -0
  310. package/src/widget/hooks/useDebounce.ts +25 -0
  311. package/src/widget/hooks/useDebugScreens.ts +26 -10
  312. package/src/widget/hooks/useDefaultTokenSelection.tsx +99 -143
  313. package/src/widget/hooks/useDestinationSelectedToken.tsx +1 -14
  314. package/src/widget/hooks/useEarnPool.tsx +1 -1
  315. package/src/widget/hooks/useIntentTransactionHistory.ts +20 -11
  316. package/src/widget/hooks/useIsMobile.tsx +50 -0
  317. package/src/widget/hooks/useMode.ts +2 -3
  318. package/src/widget/hooks/useOriginSelectedToken.tsx +2 -15
  319. package/src/widget/hooks/usePayMessage.tsx +31 -11
  320. package/src/widget/hooks/usePriceImpactWarning.ts +1 -1
  321. package/src/widget/hooks/useQuote.ts +189 -6
  322. package/src/widget/hooks/useRecentTokens.ts +6 -6
  323. package/src/widget/hooks/useRecipients.ts +1 -1
  324. package/src/widget/hooks/useSelectedFeeOption.tsx +2 -2
  325. package/src/widget/hooks/useSelectedFundMethod.tsx +1 -1
  326. package/src/widget/hooks/useSelectedRecipient.tsx +1 -1
  327. package/src/widget/hooks/useSendForm.ts +328 -152
  328. package/src/widget/hooks/useSwapAmount.tsx +1 -1
  329. package/src/widget/hooks/useTheme.tsx +1 -1
  330. package/src/widget/hooks/useTokenList.ts +672 -400
  331. package/src/widget/hooks/useTrailsSendTransaction.ts +949 -0
  332. package/src/widget/hooks/useWalletConnectUri.tsx +228 -0
  333. package/src/widget/hooks/useWidgetProps.tsx +3 -1
  334. package/src/widget/index.tsx +12 -0
  335. package/src/widget/providers/TrailsModalProvider.tsx +195 -0
  336. package/src/widget/providers/TrailsProvider.tsx +9 -3
  337. package/src/widget/types.ts +12 -20
  338. package/src/widget/widget.tsx +598 -385
  339. package/dist/cctp.d.ts +0 -3
  340. package/dist/cctp.d.ts.map +0 -1
  341. package/dist/lifi.d.ts +0 -4
  342. package/dist/lifi.d.ts.map +0 -1
  343. package/dist/meshconnect.d.ts +0 -171
  344. package/dist/meshconnect.d.ts.map +0 -1
  345. package/dist/relaySdk.d.ts +0 -87
  346. package/dist/relaySdk.d.ts.map +0 -1
  347. package/dist/widget/components/MeshConnectExchanges.d.ts +0 -7
  348. package/dist/widget/components/MeshConnectExchanges.d.ts.map +0 -1
  349. package/dist/widget/components/MeshConnectFlow.d.ts +0 -13
  350. package/dist/widget/components/MeshConnectFlow.d.ts.map +0 -1
  351. package/dist/widget/components/MeshConnectIframe.d.ts +0 -15
  352. package/dist/widget/components/MeshConnectIframe.d.ts.map +0 -1
  353. package/dist/widget/components/Receive.d.ts +0 -12
  354. package/dist/widget/components/Receive.d.ts.map +0 -1
  355. package/dist/widget/hooks/useSelectedMeshExchange.d.ts +0 -14
  356. package/dist/widget/hooks/useSelectedMeshExchange.d.ts.map +0 -1
  357. package/src/cctp.ts +0 -54
  358. package/src/lifi.ts +0 -108
  359. package/src/meshconnect.ts +0 -531
  360. package/src/relaySdk.ts +0 -703
  361. package/src/widget/components/MeshConnectExchanges.tsx +0 -290
  362. package/src/widget/components/MeshConnectFlow.tsx +0 -90
  363. package/src/widget/components/MeshConnectIframe.tsx +0 -500
  364. package/src/widget/components/Receive.tsx +0 -175
  365. package/src/widget/hooks/useSelectedMeshExchange.tsx +0 -46
package/src/relaySdk.ts DELETED
@@ -1,703 +0,0 @@
1
- import {
2
- convertViemChainToRelayChain,
3
- createClient,
4
- getClient,
5
- MAINNET_RELAY_API,
6
- } from "@reservoir0x/relay-sdk"
7
- import type { WalletClient } from "viem"
8
- import {
9
- arbitrum,
10
- avalanche,
11
- base,
12
- berachain,
13
- blast,
14
- opBNB,
15
- bsc,
16
- bob,
17
- boba,
18
- celo,
19
- corn,
20
- cronos,
21
- cyber,
22
- degen,
23
- mainnet,
24
- flowMainnet,
25
- forma,
26
- funkiMainnet,
27
- gnosis,
28
- gravity,
29
- hemi,
30
- hychain,
31
- ink,
32
- linea,
33
- lisk,
34
- manta,
35
- mantle,
36
- metis,
37
- mint,
38
- mode,
39
- morph,
40
- optimism,
41
- plume,
42
- polygon,
43
- polygonZkEvm,
44
- ronin,
45
- redstone,
46
- sanko,
47
- scroll,
48
- sei,
49
- shape,
50
- soneium,
51
- sonic,
52
- story,
53
- superposition,
54
- superseed,
55
- swellchain,
56
- taiko,
57
- tron,
58
- unichain,
59
- worldchain,
60
- xai,
61
- zeroG,
62
- zircuit,
63
- zksync,
64
- zora,
65
- katana,
66
- abstract,
67
- ancient8,
68
- apeChain,
69
- arbitrumNova,
70
- arenaz,
71
- b3,
72
- } from "viem/chains"
73
- import { somnia } from "./customChains.js"
74
- import { logger } from "./logger.js"
75
-
76
- export type Chain = any
77
- export type RelayQuote = any
78
- export type RelayExecuteResult = any
79
- export type RelayProgressData = any
80
-
81
- // Source: https://docs.relay.link/resources/supported-chains
82
- export const relaySupportedChains: Record<number, Chain> = {
83
- [abstract.id]: abstract,
84
- [ancient8.id]: ancient8,
85
- [apeChain.id]: apeChain,
86
- [arbitrum.id]: arbitrum,
87
- [arbitrumNova.id]: arbitrumNova,
88
- [arenaz.id]: arenaz,
89
- [avalanche.id]: avalanche,
90
- [b3.id]: b3,
91
- [base.id]: base,
92
- [berachain.id]: berachain,
93
- [blast.id]: blast,
94
- [bsc.id]: bsc,
95
- [opBNB.id]: opBNB,
96
- [bob.id]: bob,
97
- [boba.id]: boba,
98
- [celo.id]: celo,
99
- [corn.id]: corn,
100
- [cronos.id]: cronos,
101
- [cyber.id]: cyber,
102
- [degen.id]: degen,
103
- [mainnet.id]: mainnet,
104
- [flowMainnet.id]: flowMainnet,
105
- [forma.id]: forma,
106
- [funkiMainnet.id]: funkiMainnet,
107
- [gnosis.id]: gnosis,
108
- [gravity.id]: gravity,
109
- [hemi.id]: hemi,
110
- [hychain.id]: hychain,
111
- [ink.id]: ink,
112
- [linea.id]: linea,
113
- [lisk.id]: lisk,
114
- [manta.id]: manta,
115
- [mantle.id]: mantle,
116
- [metis.id]: metis,
117
- [mint.id]: mint,
118
- [mode.id]: mode,
119
- [morph.id]: morph,
120
- [optimism.id]: optimism,
121
- [plume.id]: plume,
122
- [polygon.id]: polygon,
123
- [polygonZkEvm.id]: polygonZkEvm,
124
- [ronin.id]: ronin,
125
- [redstone.id]: redstone,
126
- [sanko.id]: sanko,
127
- [scroll.id]: scroll,
128
- [sei.id]: sei,
129
- [shape.id]: shape,
130
- [soneium.id]: soneium,
131
- [sonic.id]: sonic,
132
- [story.id]: story,
133
- [superposition.id]: superposition,
134
- [superseed.id]: superseed,
135
- [swellchain.id]: swellchain,
136
- [taiko.id]: taiko,
137
- [tron.id]: tron,
138
- [unichain.id]: unichain,
139
- [worldchain.id]: worldchain,
140
- [xai.id]: xai,
141
- [zeroG.id]: zeroG,
142
- [zircuit.id]: zircuit,
143
- [zksync.id]: zksync,
144
- [zora.id]: zora,
145
- [katana.id]: katana,
146
- [somnia.id]: somnia,
147
- }
148
-
149
- getRelaySupportedChains().then((relayChains) => {
150
- createClient({
151
- baseApiUrl: MAINNET_RELAY_API,
152
- source: "Trails",
153
- chains: relayChains.map((chain: Chain) =>
154
- convertViemChainToRelayChain(chain),
155
- ),
156
- })
157
- })
158
-
159
- export enum RelayTradeType {
160
- EXACT_INPUT = "EXACT_INPUT",
161
- EXACT_OUTPUT = "EXACT_OUTPUT",
162
- }
163
-
164
- export interface RelayQuoteOptions {
165
- wallet: WalletClient
166
- chainId: number
167
- toChainId?: number
168
- amount: string
169
- currency: string
170
- toCurrency?: string
171
- tradeType?: RelayTradeType
172
- txs: Array<{
173
- to: string
174
- value: string
175
- data: string
176
- }>
177
- recipient?: string
178
- slippageTolerance?: string
179
- }
180
-
181
- export interface RelayExecuteOptions {
182
- quote: RelayQuote
183
- wallet: WalletClient
184
- onProgress?: (data: RelayProgressData) => void
185
- }
186
-
187
- /**
188
- * Get a quote for a relay transaction
189
- */
190
- export async function getRelaySDKQuote(
191
- options: RelayQuoteOptions,
192
- ): Promise<RelayQuote> {
193
- try {
194
- const client = getClient()
195
- if (!client) {
196
- throw new Error("Relay client not available")
197
- }
198
-
199
- logger.console.log("[trails-sdk] getRelaySDKQuote", options)
200
-
201
- const quote = await client.actions.getQuote({
202
- wallet: options.wallet,
203
- chainId: options.chainId,
204
- toChainId: options.toChainId || options.chainId,
205
- amount: options.amount,
206
- currency: options.currency,
207
- toCurrency: options.toCurrency || options.currency,
208
- tradeType: options.tradeType || RelayTradeType.EXACT_OUTPUT,
209
- txs: options.txs,
210
- user: options.wallet.account!.address,
211
- recipient: options.recipient || options.wallet.account!.address,
212
- options: {
213
- slippageTolerance: options.slippageTolerance
214
- ? Math.round(Number(options.slippageTolerance) * 100 * 100).toString()
215
- : undefined,
216
- },
217
- })
218
-
219
- return quote
220
- } catch (error) {
221
- logger.console.error("[trails-sdk] Error getting relay quote:", error)
222
- throw error
223
- }
224
- }
225
-
226
- /**
227
- * Execute a relay transaction
228
- */
229
- export async function relaySDKExecute(
230
- options: RelayExecuteOptions,
231
- ): Promise<RelayExecuteResult> {
232
- try {
233
- const client = getClient()
234
- if (!client) {
235
- throw new Error("Relay client not available")
236
- }
237
-
238
- logger.console.log(
239
- "[trails-sdk] relaysdkclient",
240
- client.chains,
241
- options.quote,
242
- )
243
-
244
- const result = await client.actions.execute({
245
- quote: options.quote,
246
- wallet: options.wallet,
247
- onProgress:
248
- options.onProgress ||
249
- ((data) => {
250
- logger.console.log("[trails-sdk] Relay progress:", data)
251
- }),
252
- })
253
-
254
- return result
255
- } catch (error) {
256
- logger.console.error(
257
- "[trails-sdk] Error executing relay transaction:",
258
- error,
259
- )
260
- throw error
261
- }
262
- }
263
-
264
- /**
265
- * Helper function to create a simple relay transaction for a contract call
266
- */
267
- export async function createSimpleRelayTransaction(
268
- wallet: WalletClient,
269
- contractAddress: string,
270
- callData: string,
271
- value: string,
272
- chainId: number,
273
- currency: string = "0x0000000000000000000000000000000000000000", // ETH
274
- ): Promise<RelayQuote> {
275
- const options: RelayQuoteOptions = {
276
- wallet,
277
- chainId,
278
- amount: value,
279
- currency,
280
- txs: [
281
- {
282
- to: contractAddress,
283
- value,
284
- data: callData,
285
- },
286
- ],
287
- }
288
-
289
- return await getRelaySDKQuote(options)
290
- }
291
-
292
- /**
293
- * Helper function to execute a simple relay transaction
294
- */
295
- export async function executeSimpleRelayTransaction(
296
- quote: RelayQuote,
297
- wallet: WalletClient,
298
- onProgress?: RelayExecuteOptions["onProgress"],
299
- ): Promise<RelayExecuteResult> {
300
- return await relaySDKExecute({
301
- quote,
302
- wallet,
303
- onProgress,
304
- })
305
- }
306
-
307
- export function getTxHashFromRelayResult(result: RelayExecuteResult): string {
308
- let txHash =
309
- result?.data?.steps?.[result?.data?.steps?.length - 1]?.items?.[0]
310
- ?.txHashes?.[0]?.txHash
311
-
312
- if (!txHash) {
313
- txHash =
314
- result?.data?.steps?.[result?.data?.steps?.length - 1]?.items?.[0]
315
- ?.internalTxHashes?.[0]?.txHash
316
- }
317
-
318
- if (!txHash) {
319
- throw new Error("No transaction hash found in relay result")
320
- }
321
-
322
- return txHash
323
- }
324
-
325
- export async function getRelaySupportedChains(): Promise<Chain[]> {
326
- return Object.values(relaySupportedChains)
327
- }
328
-
329
- export async function isChainSupported(chainId: number): Promise<boolean> {
330
- return Object.keys(relaySupportedChains).includes(chainId.toString())
331
- }
332
-
333
- export interface RelayToken {
334
- id: string
335
- symbol: string
336
- name: string
337
- contractAddress: string
338
- decimals: number
339
- chainId: number
340
- chainName: string
341
- imageUrl: string
342
- }
343
-
344
- export async function getRelaySupportedTokens(): Promise<RelayToken[]> {
345
- try {
346
- const relayChains = await fetchRelayChains()
347
-
348
- const tokens: RelayToken[] = []
349
-
350
- relayChains.forEach((chain) => {
351
- if (!chain.disabled) {
352
- // Add native currency
353
- tokens.push({
354
- id: chain.currency.id || `${chain.currency.symbol}-${chain.name}`,
355
- symbol: chain.currency.symbol,
356
- name: chain.currency.name,
357
- contractAddress: chain.currency.address,
358
- decimals: chain.currency.decimals,
359
- chainId: chain.id,
360
- chainName: chain.displayName || chain.name,
361
- imageUrl: "", // Native currencies typically don't have logoURI
362
- })
363
-
364
- // Add featured tokens
365
- chain.featuredTokens.forEach((token) => {
366
- tokens.push({
367
- id: token.id || `${token.symbol}-${chain.name}`,
368
- symbol: token.symbol,
369
- name: token.name,
370
- contractAddress: token.address,
371
- decimals: token.decimals,
372
- chainId: chain.id,
373
- chainName: chain.displayName || chain.name,
374
- imageUrl: token.metadata?.logoURI || "",
375
- })
376
- })
377
-
378
- // Add ERC20 currencies
379
- chain.erc20Currencies.forEach((token) => {
380
- tokens.push({
381
- id: token.id || `${token.symbol}-${chain.name}`,
382
- symbol: token.symbol,
383
- name: token.name,
384
- contractAddress: token.address,
385
- decimals: token.decimals,
386
- chainId: chain.id,
387
- chainName: chain.displayName || chain.name,
388
- imageUrl: token.metadata?.logoURI || "",
389
- })
390
- })
391
-
392
- // Add solver currencies (fallback for chains that might not have featuredTokens/erc20Currencies)
393
- chain.solverCurrencies.forEach((token) => {
394
- tokens.push({
395
- id: token.id || `${token.symbol}-${chain.name}`,
396
- symbol: token.symbol,
397
- name: token.name,
398
- contractAddress: token.address,
399
- decimals: token.decimals,
400
- chainId: chain.id,
401
- chainName: chain.displayName || chain.name,
402
- imageUrl: token.metadata?.logoURI || "",
403
- })
404
- })
405
- }
406
- })
407
-
408
- // Remove duplicates by chainId and contractAddress
409
- const uniqueTokens = tokens.filter(
410
- (token, index, self) =>
411
- index ===
412
- self.findIndex(
413
- (t) =>
414
- t.chainId === token.chainId &&
415
- t.contractAddress.toLowerCase() ===
416
- token.contractAddress.toLowerCase(),
417
- ),
418
- )
419
-
420
- logger.console.log(
421
- `[trails-sdk] Fetched ${uniqueTokens.length} unique tokens from Relay API`,
422
- )
423
-
424
- return uniqueTokens
425
- } catch (error) {
426
- logger.console.error(
427
- "[trails-sdk] Error fetching Relay supported tokens:",
428
- error,
429
- )
430
- return []
431
- }
432
- }
433
-
434
- // Types for Relay API response
435
- interface RelayApiToken {
436
- id: string
437
- symbol: string
438
- name: string
439
- address: string
440
- decimals: number
441
- metadata?: {
442
- logoURI?: string
443
- }
444
- supportsBridging?: boolean
445
- withdrawalFee?: number
446
- depositFee?: number
447
- surgeEnabled?: boolean
448
- supportsPermit?: boolean
449
- }
450
-
451
- interface RelayChain {
452
- id: number
453
- name: string
454
- displayName: string
455
- disabled: boolean
456
- currency: {
457
- id: string
458
- symbol: string
459
- name: string
460
- address: string
461
- decimals: number
462
- supportsBridging: boolean
463
- }
464
- featuredTokens: RelayApiToken[]
465
- erc20Currencies: RelayApiToken[]
466
- solverCurrencies: RelayApiToken[]
467
- }
468
-
469
- interface RelayChainsResponse {
470
- chains: RelayChain[]
471
- }
472
-
473
- // Cache for chains data
474
- let cachedChains: RelayChain[] | null = null
475
- let cacheTimestamp: number = 0
476
- const CACHE_DURATION = 5 * 60 * 1000 // 5 minutes
477
-
478
- async function fetchRelayChains(): Promise<RelayChain[]> {
479
- const now = Date.now()
480
-
481
- // Return cached data if still valid
482
- if (cachedChains && now - cacheTimestamp < CACHE_DURATION) {
483
- return cachedChains
484
- }
485
-
486
- try {
487
- const response = await fetch("https://api.relay.link/chains")
488
- if (!response.ok) {
489
- throw new Error(`Failed to fetch chains: ${response.status}`)
490
- }
491
-
492
- const data: RelayChainsResponse = await response.json()
493
- cachedChains = data.chains
494
- cacheTimestamp = now
495
-
496
- return data.chains
497
- } catch (error) {
498
- logger.console.error("[trails-sdk] Error fetching Relay chains:", error)
499
- // Return cached data if available, even if expired
500
- if (cachedChains) {
501
- return cachedChains
502
- }
503
- throw error
504
- }
505
- }
506
-
507
- export type GetIsRouteSupportedOptions = {
508
- originChainId: number
509
- destinationChainId: number
510
- amount: string
511
- originToken: string
512
- destinationToken: string
513
- }
514
-
515
- export async function getIsRouteSupported({
516
- originChainId,
517
- destinationChainId,
518
- amount,
519
- originToken,
520
- destinationToken,
521
- }: GetIsRouteSupportedOptions): Promise<boolean> {
522
- try {
523
- // Fetch supported chains from Relay API
524
- const chains = await fetchRelayChains()
525
-
526
- // Check if both chains are supported and not disabled
527
- const originChain = chains.find((chain) => chain.id === originChainId)
528
- const destinationChain = chains.find(
529
- (chain) => chain.id === destinationChainId,
530
- )
531
-
532
- if (
533
- !originChain ||
534
- !destinationChain ||
535
- originChain.disabled ||
536
- destinationChain.disabled
537
- ) {
538
- return false
539
- }
540
-
541
- // Check if destination token is supported on destination chain
542
- const isDestinationTokenSupported = destinationChain.solverCurrencies.some(
543
- (currency) =>
544
- currency.address.toLowerCase() === destinationToken.toLowerCase(),
545
- )
546
-
547
- if (!isDestinationTokenSupported) {
548
- return false
549
- }
550
-
551
- // If we have a client available, try to get a quote to verify the route
552
- const client = getClient()
553
- if (client) {
554
- try {
555
- const sender = "0x1111111111111111111111111111111111111111"
556
-
557
- const quote = await client.actions.getQuote({
558
- chainId: originChainId,
559
- toChainId: destinationChainId,
560
- amount: amount,
561
- currency: originToken,
562
- toCurrency: destinationToken,
563
- tradeType: "EXACT_OUTPUT",
564
- txs: [],
565
- user: sender,
566
- recipient: sender,
567
- })
568
-
569
- return quote.steps.length > 0
570
- } catch (error) {
571
- logger.console.warn(
572
- "[trails-sdk] Quote check failed, falling back to chain/token validation:",
573
- error,
574
- )
575
- // If quote fails, we still return true if chains and tokens are supported
576
- return true
577
- }
578
- }
579
-
580
- // If no client available, return true if chains and tokens are supported
581
- return true
582
- } catch (error) {
583
- logger.console.error("[trails-sdk] Error checking route support:", error)
584
- return false
585
- }
586
- }
587
-
588
- interface RelayStatusResponse {
589
- status: string
590
- inTxHashes: string[]
591
- txHashes: string[]
592
- time: number
593
- originChainId: number
594
- destinationChainId: number
595
- }
596
-
597
- /**
598
- * Fetch the status of a relay request by request ID
599
- */
600
- export async function fetchRelayRequestStatus(
601
- requestId: string,
602
- ): Promise<RelayStatusResponse> {
603
- try {
604
- const response = await fetch(
605
- `https://api.relay.link/intents/status/v2?requestId=${requestId}`,
606
- )
607
-
608
- if (!response.ok) {
609
- throw new Error(
610
- `Failed to fetch relay status: ${response.status} ${response.statusText}`,
611
- )
612
- }
613
-
614
- const data = await response.json()
615
- return data as RelayStatusResponse
616
- } catch (error) {
617
- logger.console.error(
618
- "[trails-sdk] Error fetching relay request status:",
619
- error,
620
- )
621
- throw error
622
- }
623
- }
624
-
625
- /**
626
- * Wait for relay destination transaction to complete and return the last transaction hash
627
- */
628
- export async function waitForRelayDestinationTx(
629
- quoteProviderRequestId: string,
630
- ): Promise<string> {
631
- const maxWaitTime = 5 * 60 * 1000 // 5 minutes
632
- const pollInterval = 5000 // 5 seconds
633
- const startTime = Date.now()
634
-
635
- const sleep = (ms: number): Promise<void> =>
636
- new Promise((resolve) => setTimeout(resolve, ms))
637
-
638
- while (Date.now() - startTime < maxWaitTime) {
639
- try {
640
- const status = await fetchRelayRequestStatus(quoteProviderRequestId)
641
- if (!status) {
642
- throw new Error("No status found")
643
- }
644
-
645
- if (
646
- status.inTxHashes &&
647
- status.inTxHashes.length > 0 &&
648
- status.originChainId === status.destinationChainId
649
- ) {
650
- return status.inTxHashes[status.inTxHashes.length - 1]!
651
- }
652
-
653
- logger.console.log("[trails-sdk] Relay status check:", {
654
- requestId: quoteProviderRequestId,
655
- status: status.status,
656
- txHashesCount: status.txHashes?.length || 0,
657
- })
658
-
659
- // Check if we have transaction hashes
660
- if (status.txHashes && status.txHashes.length > 0) {
661
- // Return the last transaction hash in the array
662
- const lastTxHash = status.txHashes[status.txHashes.length - 1]
663
- if (lastTxHash) {
664
- logger.console.log(
665
- "[trails-sdk] Relay transaction completed:",
666
- lastTxHash,
667
- )
668
- return lastTxHash
669
- }
670
- }
671
-
672
- // If status is failed or error, throw an error
673
- if (status.status === "failed" || status.status === "error") {
674
- throw new Error(
675
- `Relay transaction failed with status: ${status.status}`,
676
- )
677
- }
678
-
679
- // Wait before next poll
680
- await sleep(pollInterval)
681
- } catch (error) {
682
- // If it's a fetch error (like 404), continue polling as the request might not be indexed yet
683
- if (
684
- error instanceof Error &&
685
- (error.message.includes("Failed to fetch relay status") ||
686
- error.message.includes("No status found"))
687
- ) {
688
- logger.console.warn(
689
- "[trails-sdk] Relay status not yet available, continuing to poll...",
690
- )
691
- await sleep(pollInterval)
692
- continue
693
- }
694
-
695
- // For other errors, rethrow
696
- throw error
697
- }
698
- }
699
-
700
- throw new Error(
701
- `Timeout waiting for relay transaction after ${maxWaitTime / 1000} seconds`,
702
- )
703
- }