0xtrails 0.13.1 → 0.14.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 (804) hide show
  1. package/dist/abis/trailsHydrate.d.ts +5 -42
  2. package/dist/abis/trailsHydrate.d.ts.map +1 -1
  3. package/dist/abis/trailsRouter.d.ts +1 -1
  4. package/dist/abis/trailsRouter.d.ts.map +1 -1
  5. package/dist/{widget/analytics → analytics/hooks}/useWidgetAnalytics.d.ts +2 -4
  6. package/dist/analytics/hooks/useWidgetAnalytics.d.ts.map +1 -0
  7. package/dist/analytics.d.ts.map +1 -1
  8. package/dist/chainSwitch.d.ts.map +1 -1
  9. package/dist/chains-C1NhDLF_.js +4 -0
  10. package/dist/chains-CcoarGia.js +658 -0
  11. package/dist/chains.d.ts +0 -1
  12. package/dist/chains.d.ts.map +1 -1
  13. package/dist/committedIntentStore.d.ts +5 -0
  14. package/dist/committedIntentStore.d.ts.map +1 -0
  15. package/dist/config.d.ts +2 -0
  16. package/dist/config.d.ts.map +1 -1
  17. package/dist/constants.d.ts +3 -1
  18. package/dist/constants.d.ts.map +1 -1
  19. package/dist/customTokens.d.ts.map +1 -1
  20. package/dist/error.d.ts +73 -4
  21. package/dist/error.d.ts.map +1 -1
  22. package/dist/hooks/useAddressWalletIcon.d.ts.map +1 -0
  23. package/dist/hooks/useAmountUsd.d.ts.map +1 -0
  24. package/dist/hooks/useBalanceVisible.d.ts.map +1 -0
  25. package/dist/hooks/useChainFilter.d.ts.map +1 -0
  26. package/dist/{widget/hooks → hooks}/useCheckout.d.ts +15 -15
  27. package/dist/hooks/useCheckout.d.ts.map +1 -0
  28. package/dist/hooks/useClickTracking.d.ts.map +1 -0
  29. package/dist/{widget/hooks → hooks}/useCombinedHistory.d.ts +3 -2
  30. package/dist/hooks/useCombinedHistory.d.ts.map +1 -0
  31. package/dist/hooks/useConnector.d.ts.map +1 -0
  32. package/dist/{widget/hooks → hooks}/useCustomTokenSearch.d.ts +7 -2
  33. package/dist/hooks/useCustomTokenSearch.d.ts.map +1 -0
  34. package/dist/hooks/useDebounce.d.ts.map +1 -0
  35. package/dist/{widget/hooks → hooks}/useDebugScreens.d.ts +2 -2
  36. package/dist/hooks/useDebugScreens.d.ts.map +1 -0
  37. package/dist/{widget/hooks → hooks}/useDefaultDestinationToken.d.ts +1 -1
  38. package/dist/hooks/useDefaultDestinationToken.d.ts.map +1 -0
  39. package/dist/{widget/hooks → hooks}/useDefaultOriginToken.d.ts +1 -1
  40. package/dist/hooks/useDefaultOriginToken.d.ts.map +1 -0
  41. package/dist/hooks/useDepositMonitor.d.ts.map +1 -0
  42. package/dist/{widget/hooks → hooks}/useDestinationSelectedToken.d.ts +2 -2
  43. package/dist/hooks/useDestinationSelectedToken.d.ts.map +1 -0
  44. package/dist/hooks/useDisplayCurrencyPreference.d.ts.map +1 -0
  45. package/dist/{widget/hooks → hooks}/useEarnPool.d.ts +1 -1
  46. package/dist/hooks/useEarnPool.d.ts.map +1 -0
  47. package/dist/hooks/useEffectiveFundBalance.d.ts +28 -0
  48. package/dist/hooks/useEffectiveFundBalance.d.ts.map +1 -0
  49. package/dist/hooks/useExecutingIntentsCount.d.ts.map +1 -0
  50. package/dist/{widget/hooks → hooks}/useExternalFundingReceiptSync.d.ts +1 -1
  51. package/dist/hooks/useExternalFundingReceiptSync.d.ts.map +1 -0
  52. package/dist/{widget/hooks → hooks}/useFiatOnRampCurrencies.d.ts +2 -2
  53. package/dist/hooks/useFiatOnRampCurrencies.d.ts.map +1 -0
  54. package/dist/hooks/useFiatSelectedCurrency.d.ts.map +1 -0
  55. package/dist/hooks/useGetIntent.d.ts.map +1 -0
  56. package/dist/{widget/hooks → hooks}/useIntentReceiptBalances.d.ts +1 -1
  57. package/dist/hooks/useIntentReceiptBalances.d.ts.map +1 -0
  58. package/dist/{widget/hooks → hooks}/useIntentTransactionHistory.d.ts +2 -1
  59. package/dist/hooks/useIntentTransactionHistory.d.ts.map +1 -0
  60. package/dist/hooks/useIsMobile.d.ts.map +1 -0
  61. package/dist/hooks/useIsSequenceWallet.d.ts.map +1 -0
  62. package/dist/hooks/useLocalePreference.d.ts.map +1 -0
  63. package/dist/hooks/useMeldTransactionHistory.d.ts.map +1 -0
  64. package/dist/hooks/useMeldTransactionStatus.d.ts.map +1 -0
  65. package/dist/hooks/useOnRampCountryDefaults.d.ts.map +1 -0
  66. package/dist/{widget/hooks → hooks}/useOnRampPaymentMethods.d.ts +2 -2
  67. package/dist/hooks/useOnRampPaymentMethods.d.ts.map +1 -0
  68. package/dist/{widget/hooks → hooks}/useOnRampProviderWidget.d.ts +1 -1
  69. package/dist/hooks/useOnRampProviderWidget.d.ts.map +1 -0
  70. package/dist/{widget/hooks → hooks}/useOnRampQuote.d.ts +3 -3
  71. package/dist/hooks/useOnRampQuote.d.ts.map +1 -0
  72. package/dist/{widget/hooks → hooks}/useOnRampTransactionStatus.d.ts +1 -1
  73. package/dist/hooks/useOnRampTransactionStatus.d.ts.map +1 -0
  74. package/dist/{widget/hooks → hooks}/useOriginSelectedToken.d.ts +1 -1
  75. package/dist/hooks/useOriginSelectedToken.d.ts.map +1 -0
  76. package/dist/hooks/usePayMessage.d.ts.map +1 -0
  77. package/dist/hooks/usePriceImpactWarning.d.ts.map +1 -0
  78. package/dist/hooks/useQuote.d.ts +439 -0
  79. package/dist/hooks/useQuote.d.ts.map +1 -0
  80. package/dist/{widget/hooks → hooks}/useRecentTokens.d.ts +1 -1
  81. package/dist/hooks/useRecentTokens.d.ts.map +1 -0
  82. package/dist/hooks/useRecipients.d.ts.map +1 -0
  83. package/dist/hooks/useSelectedFeeOption.d.ts.map +1 -0
  84. package/dist/{widget/hooks → hooks}/useSelectedFundMethod.d.ts +18 -1
  85. package/dist/hooks/useSelectedFundMethod.d.ts.map +1 -0
  86. package/dist/hooks/useSelectedRecipient.d.ts.map +1 -0
  87. package/dist/{widget/hooks → hooks}/useSendForm.d.ts +6 -11
  88. package/dist/hooks/useSendForm.d.ts.map +1 -0
  89. package/dist/hooks/useSwapAmount.d.ts.map +1 -0
  90. package/dist/{widget/hooks → hooks}/useSwapState.d.ts +1 -1
  91. package/dist/hooks/useSwapState.d.ts.map +1 -0
  92. package/dist/hooks/useTargetAmount.d.ts.map +1 -0
  93. package/dist/hooks/useTheme.d.ts.map +1 -0
  94. package/dist/{widget/hooks → hooks}/useTokenList.d.ts +9 -3
  95. package/dist/hooks/useTokenList.d.ts.map +1 -0
  96. package/dist/{widget/hooks → hooks}/useTrailsSendTransaction.d.ts +1 -1
  97. package/dist/hooks/useTrailsSendTransaction.d.ts.map +1 -0
  98. package/dist/{widget/hooks → hooks}/useViewManager.d.ts +1 -1
  99. package/dist/hooks/useViewManager.d.ts.map +1 -0
  100. package/dist/hooks/useWalletConnectUri.d.ts +19 -0
  101. package/dist/hooks/useWalletConnectUri.d.ts.map +1 -0
  102. package/dist/hooks/useWalletConnectionContext.d.ts.map +1 -0
  103. package/dist/{widget/hooks → hooks}/useWidgetProps.d.ts +1 -1
  104. package/dist/hooks/useWidgetProps.d.ts.map +1 -0
  105. package/dist/hydrate/builder.d.ts +131 -0
  106. package/dist/hydrate/builder.d.ts.map +1 -0
  107. package/dist/hydrate/constants.d.ts +13 -0
  108. package/dist/hydrate/constants.d.ts.map +1 -0
  109. package/dist/hydrate/encodeExecute.d.ts +73 -0
  110. package/dist/hydrate/encodeExecute.d.ts.map +1 -0
  111. package/dist/hydrate/index.d.ts +6 -0
  112. package/dist/hydrate/index.d.ts.map +1 -0
  113. package/dist/hydrate/index.js +11 -0
  114. package/dist/hydrate/payload.d.ts +38 -0
  115. package/dist/hydrate/payload.d.ts.map +1 -0
  116. package/dist/hydrate/selectors.d.ts +28 -0
  117. package/dist/hydrate/selectors.d.ts.map +1 -0
  118. package/dist/hydrate/types.d.ts +19 -0
  119. package/dist/hydrate/types.d.ts.map +1 -0
  120. package/dist/hydrate/utils.d.ts +8 -0
  121. package/dist/hydrate/utils.d.ts.map +1 -0
  122. package/dist/hydrate-Cr9eaeDK.js +654 -0
  123. package/dist/index.d.ts +20 -13
  124. package/dist/index.d.ts.map +1 -1
  125. package/dist/index.js +156 -610
  126. package/dist/intentConfigStore.d.ts +8 -0
  127. package/dist/intentConfigStore.d.ts.map +1 -0
  128. package/dist/intentProtocolApi.d.ts +11 -0
  129. package/dist/intentProtocolApi.d.ts.map +1 -0
  130. package/dist/intentProtocolEncoding.d.ts +25 -0
  131. package/dist/intentProtocolEncoding.d.ts.map +1 -0
  132. package/dist/intentProtocolResolver.d.ts +28 -0
  133. package/dist/intentProtocolResolver.d.ts.map +1 -0
  134. package/dist/intentReceiptPoller.d.ts.map +1 -1
  135. package/dist/intentValidation.d.ts +5 -0
  136. package/dist/intentValidation.d.ts.map +1 -0
  137. package/dist/intents.d.ts +8 -2
  138. package/dist/intents.d.ts.map +1 -1
  139. package/dist/keyMachineClient.d.ts +9 -0
  140. package/dist/keyMachineClient.d.ts.map +1 -0
  141. package/dist/keymachine/index.d.ts +34 -0
  142. package/dist/keymachine/index.d.ts.map +1 -0
  143. package/dist/keymachine/key-machine.gen.d.ts +461 -0
  144. package/dist/keymachine/key-machine.gen.d.ts.map +1 -0
  145. package/dist/mutations.d.ts.map +1 -1
  146. package/dist/offlineRecovery.d.ts +24 -0
  147. package/dist/offlineRecovery.d.ts.map +1 -0
  148. package/dist/onramp/MeshConnectFlow.d.ts +27 -0
  149. package/dist/onramp/MeshConnectFlow.d.ts.map +1 -0
  150. package/dist/onramp/MeshConnectIframe.d.ts +22 -0
  151. package/dist/onramp/MeshConnectIframe.d.ts.map +1 -0
  152. package/dist/onramp/SendFromExchangeButton.d.ts +16 -0
  153. package/dist/onramp/SendFromExchangeButton.d.ts.map +1 -0
  154. package/dist/onramp/TrailsOnRampProvider.d.ts +31 -0
  155. package/dist/onramp/TrailsOnRampProvider.d.ts.map +1 -0
  156. package/dist/onramp/index.d.ts +13 -0
  157. package/dist/onramp/index.d.ts.map +1 -0
  158. package/dist/onramp/mesh/components/MeshExchangeConfirmation.d.ts +10 -0
  159. package/dist/onramp/mesh/components/MeshExchangeConfirmation.d.ts.map +1 -0
  160. package/dist/onramp/mesh/components/MeshExchangeIcon.d.ts +13 -0
  161. package/dist/onramp/mesh/components/MeshExchangeIcon.d.ts.map +1 -0
  162. package/dist/onramp/mesh/components/MeshExchangeSelection.d.ts +12 -0
  163. package/dist/onramp/mesh/components/MeshExchangeSelection.d.ts.map +1 -0
  164. package/dist/onramp/mesh/components/MeshSessionOptions.d.ts +15 -0
  165. package/dist/onramp/mesh/components/MeshSessionOptions.d.ts.map +1 -0
  166. package/dist/onramp/mesh/hooks/useMeshAccessTokens.d.ts +9 -0
  167. package/dist/onramp/mesh/hooks/useMeshAccessTokens.d.ts.map +1 -0
  168. package/dist/onramp/mesh/hooks/useMeshFundingSelection.d.ts +11 -0
  169. package/dist/onramp/mesh/hooks/useMeshFundingSelection.d.ts.map +1 -0
  170. package/dist/onramp/mesh/hooks/useMeshOnrampFlow.d.ts +71 -0
  171. package/dist/onramp/mesh/hooks/useMeshOnrampFlow.d.ts.map +1 -0
  172. package/dist/onramp/mesh/hooks/useMeshOnrampSessionState.d.ts +32 -0
  173. package/dist/onramp/mesh/hooks/useMeshOnrampSessionState.d.ts.map +1 -0
  174. package/dist/onramp/mesh/hooks/useMeshSelectedTokenBalance.d.ts +19 -0
  175. package/dist/onramp/mesh/hooks/useMeshSelectedTokenBalance.d.ts.map +1 -0
  176. package/dist/onramp/mesh/hooks/useMeshSessionAccountBalance.d.ts +15 -0
  177. package/dist/onramp/mesh/hooks/useMeshSessionAccountBalance.d.ts.map +1 -0
  178. package/dist/onramp/mesh/hooks/useMeshSessionStorage.d.ts +7 -0
  179. package/dist/onramp/mesh/hooks/useMeshSessionStorage.d.ts.map +1 -0
  180. package/dist/onramp/meshSessionStorage.d.ts +13 -0
  181. package/dist/onramp/meshSessionStorage.d.ts.map +1 -0
  182. package/dist/onramp/meshconnect.d.ts +32 -0
  183. package/dist/onramp/meshconnect.d.ts.map +1 -0
  184. package/dist/onramp/trailsOnramp.d.ts +32 -0
  185. package/dist/onramp/trailsOnramp.d.ts.map +1 -0
  186. package/dist/onramp-client/index.d.ts +3 -3
  187. package/dist/onramp-client/index.d.ts.map +1 -1
  188. package/dist/onrampClient.d.ts.map +1 -1
  189. package/dist/prepareSend.d.ts +3 -2
  190. package/dist/prepareSend.d.ts.map +1 -1
  191. package/dist/query/balance.fetchers.d.ts +27 -0
  192. package/dist/query/balance.fetchers.d.ts.map +1 -1
  193. package/dist/query/balance.hooks.d.ts +19 -0
  194. package/dist/query/balance.hooks.d.ts.map +1 -1
  195. package/dist/query/balance.queries.d.ts +18 -1
  196. package/dist/query/balance.queries.d.ts.map +1 -1
  197. package/dist/query/chains.queries.d.ts.map +1 -1
  198. package/dist/query/intentProtocol.queries.d.ts +32 -0
  199. package/dist/query/intentProtocol.queries.d.ts.map +1 -0
  200. package/dist/query/meld.fetchers.d.ts +1 -1
  201. package/dist/query/meld.fetchers.d.ts.map +1 -1
  202. package/dist/query/meld.hooks.d.ts +3 -3
  203. package/dist/query/meld.hooks.d.ts.map +1 -1
  204. package/dist/query/meld.queries.d.ts +1 -1
  205. package/dist/query/meld.queries.d.ts.map +1 -1
  206. package/dist/query/tokenList.queries.d.ts +54 -0
  207. package/dist/query/tokenList.queries.d.ts.map +1 -0
  208. package/dist/recover.d.ts +71 -23
  209. package/dist/recover.d.ts.map +1 -1
  210. package/dist/src-4HYDQv2T.js +48798 -0
  211. package/dist/tokens.d.ts +13 -0
  212. package/dist/tokens.d.ts.map +1 -1
  213. package/dist/transactionIntent/deposits/depositOrchestrator.d.ts +3 -4
  214. package/dist/transactionIntent/deposits/depositOrchestrator.d.ts.map +1 -1
  215. package/dist/transactionIntent/deposits/gaslessDeposit.d.ts +3 -4
  216. package/dist/transactionIntent/deposits/gaslessDeposit.d.ts.map +1 -1
  217. package/dist/transactionIntent/deposits/standardDeposit.d.ts +2 -5
  218. package/dist/transactionIntent/deposits/standardDeposit.d.ts.map +1 -1
  219. package/dist/transactionIntent/handlers/intentHandler.d.ts +4 -4
  220. package/dist/transactionIntent/handlers/intentHandler.d.ts.map +1 -1
  221. package/dist/transactionIntent/helpers/transactionStateHelpers.d.ts.map +1 -1
  222. package/dist/transactionIntent/quote/normalizeQuote.d.ts.map +1 -1
  223. package/dist/transactionIntent/quote/quoteHelpers.d.ts +2 -2
  224. package/dist/transactionIntent/quote/quoteHelpers.d.ts.map +1 -1
  225. package/dist/transactionIntent/types.d.ts +4 -4
  226. package/dist/transactionIntent/types.d.ts.map +1 -1
  227. package/dist/transactions.d.ts +4 -0
  228. package/dist/transactions.d.ts.map +1 -1
  229. package/dist/umd/trails.min.js +1371 -322
  230. package/dist/utils/localStorageGc.d.ts +22 -0
  231. package/dist/utils/localStorageGc.d.ts.map +1 -0
  232. package/dist/walletUtils.d.ts +2 -1
  233. package/dist/walletUtils.d.ts.map +1 -1
  234. package/dist/wallets.d.ts +13 -54
  235. package/dist/wallets.d.ts.map +1 -1
  236. package/dist/widget/components/AccountIntentTransactionHistory.d.ts.map +1 -1
  237. package/dist/widget/components/ClassicSwap.d.ts.map +1 -1
  238. package/dist/widget/components/ConnectWallet.d.ts.map +1 -1
  239. package/dist/widget/components/ConnectedWallets.d.ts +1 -1
  240. package/dist/widget/components/ConnectedWallets.d.ts.map +1 -1
  241. package/dist/widget/components/DirectTransfer.d.ts +1 -1
  242. package/dist/widget/components/DirectTransfer.d.ts.map +1 -1
  243. package/dist/widget/components/Earn.d.ts +2 -6
  244. package/dist/widget/components/Earn.d.ts.map +1 -1
  245. package/dist/widget/components/FeeOption.d.ts +1 -1
  246. package/dist/widget/components/FeeOption.d.ts.map +1 -1
  247. package/dist/widget/components/FeeOptions.d.ts +1 -1
  248. package/dist/widget/components/FeeOptions.d.ts.map +1 -1
  249. package/dist/widget/components/FiatSelector.d.ts +1 -1
  250. package/dist/widget/components/FiatSelector.d.ts.map +1 -1
  251. package/dist/widget/components/FiatSelectorButton.d.ts +1 -1
  252. package/dist/widget/components/FiatSelectorButton.d.ts.map +1 -1
  253. package/dist/widget/components/Fund.d.ts +1 -1
  254. package/dist/widget/components/Fund.d.ts.map +1 -1
  255. package/dist/widget/components/FundMethods.d.ts.map +1 -1
  256. package/dist/widget/components/FundingMethodSelectorButton.d.ts +1 -1
  257. package/dist/widget/components/FundingMethodSelectorButton.d.ts.map +1 -1
  258. package/dist/widget/components/MeldHistory.d.ts +1 -1
  259. package/dist/widget/components/MeldHistory.d.ts.map +1 -1
  260. package/dist/widget/components/MeldTransactionStatus.d.ts +1 -1
  261. package/dist/widget/components/MeldTransactionStatus.d.ts.map +1 -1
  262. package/dist/widget/components/MeshExchangeAccountHeader.d.ts +9 -0
  263. package/dist/widget/components/MeshExchangeAccountHeader.d.ts.map +1 -0
  264. package/dist/widget/components/OnrampHistoryRow.d.ts +2 -2
  265. package/dist/widget/components/OnrampHistoryRow.d.ts.map +1 -1
  266. package/dist/widget/components/OnrampProviderConfirmation.d.ts +1 -1
  267. package/dist/widget/components/OnrampProviderConfirmation.d.ts.map +1 -1
  268. package/dist/widget/components/Pay.d.ts.map +1 -1
  269. package/dist/widget/components/PoolDeposit.d.ts +2 -6
  270. package/dist/widget/components/PoolDeposit.d.ts.map +1 -1
  271. package/dist/widget/components/PoolWithdraw.d.ts +2 -2
  272. package/dist/widget/components/PoolWithdraw.d.ts.map +1 -1
  273. package/dist/widget/components/PulsatingButton.d.ts +9 -0
  274. package/dist/widget/components/PulsatingButton.d.ts.map +1 -0
  275. package/dist/widget/components/QRCodeWalletSelect.d.ts +1 -1
  276. package/dist/widget/components/QRCodeWalletSelect.d.ts.map +1 -1
  277. package/dist/widget/components/QuoteDetails.d.ts.map +1 -1
  278. package/dist/widget/components/Receipt.d.ts +1 -1
  279. package/dist/widget/components/Receipt.d.ts.map +1 -1
  280. package/dist/widget/components/RecipientSelectorButton.d.ts.map +1 -1
  281. package/dist/widget/components/Recipients.d.ts.map +1 -1
  282. package/dist/widget/components/RefundWarning.d.ts.map +1 -1
  283. package/dist/widget/components/Swap.d.ts +2 -6
  284. package/dist/widget/components/Swap.d.ts.map +1 -1
  285. package/dist/widget/components/TokenList.d.ts +1 -0
  286. package/dist/widget/components/TokenList.d.ts.map +1 -1
  287. package/dist/widget/components/TokenSelector.d.ts +1 -2
  288. package/dist/widget/components/TokenSelector.d.ts.map +1 -1
  289. package/dist/widget/components/TransactionDetails.d.ts +1 -0
  290. package/dist/widget/components/TransactionDetails.d.ts.map +1 -1
  291. package/dist/widget/components/TransactionHistoryItem.d.ts +1 -0
  292. package/dist/widget/components/TransactionHistoryItem.d.ts.map +1 -1
  293. package/dist/widget/components/TransferPendingVertical.d.ts +2 -1
  294. package/dist/widget/components/TransferPendingVertical.d.ts.map +1 -1
  295. package/dist/widget/components/WalletAccountHeader.d.ts +7 -0
  296. package/dist/widget/components/WalletAccountHeader.d.ts.map +1 -0
  297. package/dist/widget/components/WalletConfirmation.d.ts +2 -1
  298. package/dist/widget/components/WalletConfirmation.d.ts.map +1 -1
  299. package/dist/widget/components/WalletConnect.d.ts.map +1 -1
  300. package/dist/widget/components/WalletList.d.ts.map +1 -1
  301. package/dist/widget/components/WidgetProviders.d.ts.map +1 -1
  302. package/dist/widget/components/Withdraw.d.ts.map +1 -1
  303. package/dist/widget/index.d.ts +13 -0
  304. package/dist/widget/index.d.ts.map +1 -1
  305. package/dist/widget/index.js +16 -8
  306. package/dist/widget/modes/EarnWidget.d.ts +83 -0
  307. package/dist/widget/modes/EarnWidget.d.ts.map +1 -0
  308. package/dist/widget/modes/FundWidget.d.ts +103 -0
  309. package/dist/widget/modes/FundWidget.d.ts.map +1 -0
  310. package/dist/widget/modes/PayWidget.d.ts +86 -0
  311. package/dist/widget/modes/PayWidget.d.ts.map +1 -0
  312. package/dist/widget/modes/SwapWidget.d.ts +82 -0
  313. package/dist/widget/modes/SwapWidget.d.ts.map +1 -0
  314. package/dist/widget/modes/WithdrawWidget.d.ts +71 -0
  315. package/dist/widget/modes/WithdrawWidget.d.ts.map +1 -0
  316. package/dist/widget/providers/TrailsProvider.d.ts +5 -0
  317. package/dist/widget/providers/TrailsProvider.d.ts.map +1 -1
  318. package/dist/widget/shared/mapSharedProps.d.ts +9 -0
  319. package/dist/widget/shared/mapSharedProps.d.ts.map +1 -0
  320. package/dist/widget/shared/methodMap.d.ts +18 -0
  321. package/dist/widget/shared/methodMap.d.ts.map +1 -0
  322. package/dist/widget/shared/resolution.d.ts +22 -0
  323. package/dist/widget/shared/resolution.d.ts.map +1 -0
  324. package/dist/widget/shared/resolvePaymentSource.d.ts +34 -0
  325. package/dist/widget/shared/resolvePaymentSource.d.ts.map +1 -0
  326. package/dist/widget/shared/types.d.ts +94 -0
  327. package/dist/widget/shared/types.d.ts.map +1 -0
  328. package/dist/widget/types/commonProps.d.ts +3 -7
  329. package/dist/widget/types/commonProps.d.ts.map +1 -1
  330. package/dist/widget/utils/createWagmiConfig.d.ts +2 -2
  331. package/dist/widget/utils/createWagmiConfig.d.ts.map +1 -1
  332. package/dist/widget/utils/fundMethodSwitchState.d.ts +2 -0
  333. package/dist/widget/utils/fundMethodSwitchState.d.ts.map +1 -1
  334. package/dist/widget/utils/meldProviderUtils.d.ts +1 -1
  335. package/dist/widget/utils/meldProviderUtils.d.ts.map +1 -1
  336. package/dist/widget/utils/meshSupportedTokens.d.ts +4 -0
  337. package/dist/widget/utils/meshSupportedTokens.d.ts.map +1 -0
  338. package/dist/widget/utils/onrampConfig.d.ts +11 -0
  339. package/dist/widget/utils/onrampConfig.d.ts.map +1 -0
  340. package/dist/widget/utils/trailsOnrampConfig.d.ts +18 -0
  341. package/dist/widget/utils/trailsOnrampConfig.d.ts.map +1 -0
  342. package/dist/widget/utils/viewManagerGuards.d.ts +1 -1
  343. package/dist/widget/utils/viewManagerGuards.d.ts.map +1 -1
  344. package/dist/widget/widget.d.ts +45 -24
  345. package/dist/widget/widget.d.ts.map +1 -1
  346. package/package.json +20 -24
  347. package/dist/buffer.d.ts +0 -3
  348. package/dist/buffer.d.ts.map +0 -1
  349. package/dist/ccip-DStzFCYT.js +0 -230
  350. package/dist/index-HY9_ppit.js +0 -101240
  351. package/dist/onramp-client/trails-onramp.gen.d.ts +0 -570
  352. package/dist/onramp-client/trails-onramp.gen.d.ts.map +0 -1
  353. package/dist/paymasterSend.d.ts +0 -90
  354. package/dist/paymasterSend.d.ts.map +0 -1
  355. package/dist/sendUserOp.d.ts +0 -122
  356. package/dist/sendUserOp.d.ts.map +0 -1
  357. package/dist/toSimpleSmartAccount.d.ts +0 -95
  358. package/dist/toSimpleSmartAccount.d.ts.map +0 -1
  359. package/dist/transactionIntent/utils/erc20Approval.d.ts +0 -34
  360. package/dist/transactionIntent/utils/erc20Approval.d.ts.map +0 -1
  361. package/dist/utils/allowance.d.ts +0 -19
  362. package/dist/utils/allowance.d.ts.map +0 -1
  363. package/dist/widget/analytics/useWidgetAnalytics.d.ts.map +0 -1
  364. package/dist/widget/components/FeeBreakdown.d.ts +0 -9
  365. package/dist/widget/components/FeeBreakdown.d.ts.map +0 -1
  366. package/dist/widget/components/HideBalances.d.ts +0 -4
  367. package/dist/widget/components/HideBalances.d.ts.map +0 -1
  368. package/dist/widget/components/OnrampDeposit.d.ts +0 -10
  369. package/dist/widget/components/OnrampDeposit.d.ts.map +0 -1
  370. package/dist/widget/components/SwapSettings.d.ts +0 -4
  371. package/dist/widget/components/SwapSettings.d.ts.map +0 -1
  372. package/dist/widget/components/TruncatedAddress.d.ts +0 -12
  373. package/dist/widget/components/TruncatedAddress.d.ts.map +0 -1
  374. package/dist/widget/components/WalletImage.d.ts +0 -8
  375. package/dist/widget/components/WalletImage.d.ts.map +0 -1
  376. package/dist/widget/css/compiled.css +0 -26
  377. package/dist/widget/css/index.css +0 -686
  378. package/dist/widget/hooks/useAddressWalletIcon.d.ts.map +0 -1
  379. package/dist/widget/hooks/useAmountUsd.d.ts.map +0 -1
  380. package/dist/widget/hooks/useBalanceVisible.d.ts.map +0 -1
  381. package/dist/widget/hooks/useChainFilter.d.ts.map +0 -1
  382. package/dist/widget/hooks/useCheckout.d.ts.map +0 -1
  383. package/dist/widget/hooks/useClickTracking.d.ts.map +0 -1
  384. package/dist/widget/hooks/useCombinedHistory.d.ts.map +0 -1
  385. package/dist/widget/hooks/useConnector.d.ts.map +0 -1
  386. package/dist/widget/hooks/useCustomTokenFetch.d.ts +0 -19
  387. package/dist/widget/hooks/useCustomTokenFetch.d.ts.map +0 -1
  388. package/dist/widget/hooks/useCustomTokenSearch.d.ts.map +0 -1
  389. package/dist/widget/hooks/useDebounce.d.ts.map +0 -1
  390. package/dist/widget/hooks/useDebugScreens.d.ts.map +0 -1
  391. package/dist/widget/hooks/useDefaultDestinationToken.d.ts.map +0 -1
  392. package/dist/widget/hooks/useDefaultOriginToken.d.ts.map +0 -1
  393. package/dist/widget/hooks/useDepositMonitor.d.ts.map +0 -1
  394. package/dist/widget/hooks/useDestinationSelectedToken.d.ts.map +0 -1
  395. package/dist/widget/hooks/useDisplayCurrencyPreference.d.ts.map +0 -1
  396. package/dist/widget/hooks/useEarnPool.d.ts.map +0 -1
  397. package/dist/widget/hooks/useExecutingIntentsCount.d.ts.map +0 -1
  398. package/dist/widget/hooks/useExternalFundingReceiptSync.d.ts.map +0 -1
  399. package/dist/widget/hooks/useFiatOnRampCurrencies.d.ts.map +0 -1
  400. package/dist/widget/hooks/useFiatSelectedCurrency.d.ts.map +0 -1
  401. package/dist/widget/hooks/useGetIntent.d.ts.map +0 -1
  402. package/dist/widget/hooks/useIntentReceiptBalances.d.ts.map +0 -1
  403. package/dist/widget/hooks/useIntentTransactionHistory.d.ts.map +0 -1
  404. package/dist/widget/hooks/useIsConnectedWalletSmartContract.d.ts +0 -7
  405. package/dist/widget/hooks/useIsConnectedWalletSmartContract.d.ts.map +0 -1
  406. package/dist/widget/hooks/useIsMobile.d.ts.map +0 -1
  407. package/dist/widget/hooks/useIsSequenceWallet.d.ts.map +0 -1
  408. package/dist/widget/hooks/useLocalePreference.d.ts.map +0 -1
  409. package/dist/widget/hooks/useMeldTransactionHistory.d.ts.map +0 -1
  410. package/dist/widget/hooks/useMeldTransactionStatus.d.ts.map +0 -1
  411. package/dist/widget/hooks/useOnRampCountryDefaults.d.ts.map +0 -1
  412. package/dist/widget/hooks/useOnRampPaymentMethods.d.ts.map +0 -1
  413. package/dist/widget/hooks/useOnRampProviderWidget.d.ts.map +0 -1
  414. package/dist/widget/hooks/useOnRampQuote.d.ts.map +0 -1
  415. package/dist/widget/hooks/useOnRampTransactionStatus.d.ts.map +0 -1
  416. package/dist/widget/hooks/useOriginSelectedToken.d.ts.map +0 -1
  417. package/dist/widget/hooks/usePayMessage.d.ts.map +0 -1
  418. package/dist/widget/hooks/usePriceImpactWarning.d.ts.map +0 -1
  419. package/dist/widget/hooks/useQuote.d.ts +0 -378
  420. package/dist/widget/hooks/useQuote.d.ts.map +0 -1
  421. package/dist/widget/hooks/useRecentTokens.d.ts.map +0 -1
  422. package/dist/widget/hooks/useRecipients.d.ts.map +0 -1
  423. package/dist/widget/hooks/useScreenTracking.d.ts +0 -2
  424. package/dist/widget/hooks/useScreenTracking.d.ts.map +0 -1
  425. package/dist/widget/hooks/useSelectedFeeOption.d.ts.map +0 -1
  426. package/dist/widget/hooks/useSelectedFundMethod.d.ts.map +0 -1
  427. package/dist/widget/hooks/useSelectedRecipient.d.ts.map +0 -1
  428. package/dist/widget/hooks/useSendForm.d.ts.map +0 -1
  429. package/dist/widget/hooks/useSwapAmount.d.ts.map +0 -1
  430. package/dist/widget/hooks/useSwapState.d.ts.map +0 -1
  431. package/dist/widget/hooks/useTargetAmount.d.ts.map +0 -1
  432. package/dist/widget/hooks/useTheme.d.ts.map +0 -1
  433. package/dist/widget/hooks/useTokenList.d.ts.map +0 -1
  434. package/dist/widget/hooks/useTokenWithFreshBalance.d.ts +0 -18
  435. package/dist/widget/hooks/useTokenWithFreshBalance.d.ts.map +0 -1
  436. package/dist/widget/hooks/useTrailsSendTransaction.d.ts.map +0 -1
  437. package/dist/widget/hooks/useViewManager.d.ts.map +0 -1
  438. package/dist/widget/hooks/useWalletConnectUri.d.ts +0 -11
  439. package/dist/widget/hooks/useWalletConnectUri.d.ts.map +0 -1
  440. package/dist/widget/hooks/useWalletConnectionContext.d.ts.map +0 -1
  441. package/dist/widget/hooks/useWidgetProps.d.ts.map +0 -1
  442. package/dist/widget/types.d.ts +0 -44
  443. package/dist/widget/types.d.ts.map +0 -1
  444. package/dist/widget/utils/historyUtils.d.ts +0 -18
  445. package/dist/widget/utils/historyUtils.d.ts.map +0 -1
  446. package/src/abi.ts +0 -38
  447. package/src/abis/erc20.ts +0 -60
  448. package/src/abis/trailsHydrate.ts +0 -185
  449. package/src/abis/trailsRouter.ts +0 -121
  450. package/src/abis/trailsSweep.ts +0 -32
  451. package/src/abortController.ts +0 -35
  452. package/src/analytics.ts +0 -2029
  453. package/src/buffer.ts +0 -10
  454. package/src/chainSwitch.ts +0 -95
  455. package/src/chains.ts +0 -565
  456. package/src/config.ts +0 -118
  457. package/src/constants.ts +0 -237
  458. package/src/contractUtils.ts +0 -46
  459. package/src/cssUtils.ts +0 -5
  460. package/src/customChains.ts +0 -24
  461. package/src/customTokens.ts +0 -147
  462. package/src/decoders.ts +0 -365
  463. package/src/ens.ts +0 -74
  464. package/src/error.ts +0 -268
  465. package/src/estimate.ts +0 -480
  466. package/src/explorer.ts +0 -38
  467. package/src/fees.ts +0 -362
  468. package/src/gasless.ts +0 -638
  469. package/src/index.ts +0 -204
  470. package/src/indexerClient.ts +0 -118
  471. package/src/intentReceiptMonitor.ts +0 -99
  472. package/src/intentReceiptPoller.ts +0 -327
  473. package/src/intents.ts +0 -1125
  474. package/src/localeUtils.ts +0 -244
  475. package/src/logger/index.ts +0 -95
  476. package/src/logger/useSyncLoggerDebug.ts +0 -11
  477. package/src/logger.ts +0 -1
  478. package/src/meld/components/MeldCountriesList.tsx +0 -237
  479. package/src/meld/components/MeldFundMethods.tsx +0 -265
  480. package/src/meld/components/MeldProvidersList.tsx +0 -187
  481. package/src/meld/components/MeldTokensList.tsx +0 -321
  482. package/src/meld/components/SimpleHeader.tsx +0 -35
  483. package/src/meld/utils/meld.ts +0 -77
  484. package/src/mutations.ts +0 -166
  485. package/src/onramp-client/index.ts +0 -54
  486. package/src/onramp-client/trails-onramp.gen.ts +0 -1320
  487. package/src/onrampClient.ts +0 -46
  488. package/src/paymasterSend.ts +0 -521
  489. package/src/placeholder.ts +0 -92
  490. package/src/poolUtils.ts +0 -222
  491. package/src/pools.ts +0 -120
  492. package/src/prepareSend.ts +0 -552
  493. package/src/query/balance.fetchers.ts +0 -623
  494. package/src/query/balance.hooks.ts +0 -298
  495. package/src/query/balance.queries.ts +0 -244
  496. package/src/query/chains.hooks.ts +0 -45
  497. package/src/query/chains.queries.ts +0 -22
  498. package/src/query/client.ts +0 -20
  499. package/src/query/fiat.fetchers.ts +0 -33
  500. package/src/query/fiat.hooks.ts +0 -71
  501. package/src/query/fiat.queries.ts +0 -67
  502. package/src/query/geo.fetchers.ts +0 -100
  503. package/src/query/geo.hooks.ts +0 -16
  504. package/src/query/geo.queries.ts +0 -36
  505. package/src/query/helpers.ts +0 -81
  506. package/src/query/meld.fetchers.ts +0 -97
  507. package/src/query/meld.hooks.ts +0 -18
  508. package/src/query/meld.queries.ts +0 -184
  509. package/src/query/persister.ts +0 -11
  510. package/src/query/price.fetchers.ts +0 -53
  511. package/src/query/price.hooks.ts +0 -46
  512. package/src/query/price.queries.ts +0 -364
  513. package/src/queryParams.ts +0 -100
  514. package/src/recover.ts +0 -1665
  515. package/src/sendUserOp.ts +0 -512
  516. package/src/theme.ts +0 -2
  517. package/src/toSimpleSmartAccount.ts +0 -567
  518. package/src/toast.ts +0 -110
  519. package/src/tokens.ts +0 -1780
  520. package/src/trailsClient.ts +0 -40
  521. package/src/transactionIntent/constants.ts +0 -15
  522. package/src/transactionIntent/deposits/depositOrchestrator.ts +0 -243
  523. package/src/transactionIntent/deposits/gaslessDeposit.ts +0 -705
  524. package/src/transactionIntent/deposits/index.ts +0 -3
  525. package/src/transactionIntent/deposits/standardDeposit.ts +0 -594
  526. package/src/transactionIntent/execution/index.ts +0 -1
  527. package/src/transactionIntent/execution/transactionState.ts +0 -38
  528. package/src/transactionIntent/handlers/index.ts +0 -1
  529. package/src/transactionIntent/handlers/intentHandler.ts +0 -1596
  530. package/src/transactionIntent/helpers/index.ts +0 -1
  531. package/src/transactionIntent/helpers/transactionStateHelpers.ts +0 -437
  532. package/src/transactionIntent/index.ts +0 -10
  533. package/src/transactionIntent/quote/feeExtractors.ts +0 -61
  534. package/src/transactionIntent/quote/index.ts +0 -3
  535. package/src/transactionIntent/quote/normalizeQuote.ts +0 -553
  536. package/src/transactionIntent/quote/quoteHelpers.ts +0 -117
  537. package/src/transactionIntent/types.ts +0 -241
  538. package/src/transactionIntent/utils/balanceChecker.ts +0 -103
  539. package/src/transactionIntent/utils/erc20Approval.ts +0 -171
  540. package/src/transactionIntent/utils/index.ts +0 -2
  541. package/src/transactionIntent/utils/resilientDepositTracker.ts +0 -171
  542. package/src/transactionIntent/utils/testnetHelpers.ts +0 -5
  543. package/src/transactionIntent/validators.ts +0 -27
  544. package/src/transactions.ts +0 -426
  545. package/src/types.d.ts +0 -16
  546. package/src/umd.tsx +0 -33
  547. package/src/utils/address.ts +0 -78
  548. package/src/utils/allowance.ts +0 -47
  549. package/src/utils/fiat.ts +0 -32
  550. package/src/utils/format.ts +0 -625
  551. package/src/utils/passthrough.ts +0 -93
  552. package/src/utils/time.ts +0 -118
  553. package/src/utils/validation.ts +0 -104
  554. package/src/utils.ts +0 -112
  555. package/src/version.ts +0 -8
  556. package/src/vite-env.d.ts +0 -4
  557. package/src/walletUtils.ts +0 -292
  558. package/src/wallets.ts +0 -740
  559. package/src/widget/analytics/useWidgetAnalytics.ts +0 -56
  560. package/src/widget/assets/Binance_Icon_Logo.svg +0 -14
  561. package/src/widget/assets/Bitfinex_Icon_Logo.svg +0 -5
  562. package/src/widget/assets/Coinbase_Icon_Logo.svg +0 -1
  563. package/src/widget/assets/Exchange-icon-black.svg +0 -5
  564. package/src/widget/assets/MetaMask-icon-fox-with-margins.svg +0 -31
  565. package/src/widget/assets/MetaMask-icon-fox.svg +0 -26
  566. package/src/widget/assets/MetaMask-logo-black.svg +0 -3
  567. package/src/widget/assets/MetaMask-logo-white.svg +0 -16
  568. package/src/widget/assets/Trails-logo-black.svg +0 -13
  569. package/src/widget/assets/Trails-logo-white.svg +0 -13
  570. package/src/widget/assets/WalletChange-black.svg +0 -5
  571. package/src/widget/assets/WalletConnect-logo-black.svg +0 -14
  572. package/src/widget/assets/WalletConnect-logo-blue-bg.svg +0 -11
  573. package/src/widget/assets/WalletConnect-logo-blue.svg +0 -14
  574. package/src/widget/assets/WalletConnect-logo-white.svg +0 -14
  575. package/src/widget/assets/WalletConnect-logo.svg +0 -40
  576. package/src/widget/assets/aave.svg +0 -14
  577. package/src/widget/assets/morpho.svg +0 -14
  578. package/src/widget/assets/sequence-logo.svg +0 -15
  579. package/src/widget/compiled.css +0 -26
  580. package/src/widget/components/AccountActionsDropdown.tsx +0 -31
  581. package/src/widget/components/AccountIntentTransactionHistory.tsx +0 -756
  582. package/src/widget/components/AccountIntentTransactionHistoryButton.tsx +0 -34
  583. package/src/widget/components/AccountSettings.tsx +0 -168
  584. package/src/widget/components/AddressOrEnsName.tsx +0 -24
  585. package/src/widget/components/AddressWalletIcon.tsx +0 -49
  586. package/src/widget/components/AllChainsIcon.tsx +0 -54
  587. package/src/widget/components/ChainFilterDropdown.tsx +0 -220
  588. package/src/widget/components/ChainImage.tsx +0 -40
  589. package/src/widget/components/ChainList.tsx +0 -158
  590. package/src/widget/components/ClassicSwap.tsx +0 -1744
  591. package/src/widget/components/ConfigDisplay.tsx +0 -158
  592. package/src/widget/components/ConnectWallet.tsx +0 -564
  593. package/src/widget/components/ConnectedWallets.tsx +0 -417
  594. package/src/widget/components/CopyButton.tsx +0 -108
  595. package/src/widget/components/CountryFilterDropdown.tsx +0 -179
  596. package/src/widget/components/DebugMenu.tsx +0 -50
  597. package/src/widget/components/DebugScreensList.tsx +0 -70
  598. package/src/widget/components/DebugToast.tsx +0 -63
  599. package/src/widget/components/DepositTracker.tsx +0 -326
  600. package/src/widget/components/DirectTransfer.tsx +0 -302
  601. package/src/widget/components/Disconnect.tsx +0 -68
  602. package/src/widget/components/DynamicInputStyles.tsx +0 -121
  603. package/src/widget/components/DynamicSizeInputField.tsx +0 -245
  604. package/src/widget/components/ENSAvatar.tsx +0 -33
  605. package/src/widget/components/Earn.tsx +0 -160
  606. package/src/widget/components/EarnPools.tsx +0 -417
  607. package/src/widget/components/EarnPoolsFilters.tsx +0 -165
  608. package/src/widget/components/ErrorAnimationIcon.tsx +0 -130
  609. package/src/widget/components/ErrorDisplay.tsx +0 -152
  610. package/src/widget/components/ExecutingIntentsBadge.tsx +0 -24
  611. package/src/widget/components/ExecutionStatusBadge.tsx +0 -53
  612. package/src/widget/components/FeeBreakdown.tsx +0 -155
  613. package/src/widget/components/FeeOption.tsx +0 -170
  614. package/src/widget/components/FeeOptions.tsx +0 -247
  615. package/src/widget/components/FiatSelector.tsx +0 -308
  616. package/src/widget/components/FiatSelectorButton.tsx +0 -68
  617. package/src/widget/components/Footer.tsx +0 -67
  618. package/src/widget/components/Fund.tsx +0 -2331
  619. package/src/widget/components/FundMethods.tsx +0 -427
  620. package/src/widget/components/FundWalletSelection.tsx +0 -60
  621. package/src/widget/components/FundingMethodSelectorButton.tsx +0 -106
  622. package/src/widget/components/GreenCheckAnimation.tsx +0 -119
  623. package/src/widget/components/HideBalances.tsx +0 -24
  624. package/src/widget/components/HighPriceImpactBlock.tsx +0 -44
  625. package/src/widget/components/HookModalContent.tsx +0 -377
  626. package/src/widget/components/Identicon.tsx +0 -228
  627. package/src/widget/components/LoadingSpinner.tsx +0 -9
  628. package/src/widget/components/MeldForm.tsx +0 -780
  629. package/src/widget/components/MeldHistory.tsx +0 -433
  630. package/src/widget/components/MeldStepsFlow.tsx +0 -1651
  631. package/src/widget/components/MeldTransactionStatus.tsx +0 -255
  632. package/src/widget/components/Modal.tsx +0 -86
  633. package/src/widget/components/OFTProgressBar.tsx +0 -89
  634. package/src/widget/components/OnRampProviderSelector.tsx +0 -263
  635. package/src/widget/components/OnrampDeposit.tsx +0 -122
  636. package/src/widget/components/OnrampErrorScreen.tsx +0 -163
  637. package/src/widget/components/OnrampHistoryRow.tsx +0 -321
  638. package/src/widget/components/OnrampPaymentMethods.tsx +0 -81
  639. package/src/widget/components/OnrampProviderConfirmation.tsx +0 -1060
  640. package/src/widget/components/OriginSelectionAmount.tsx +0 -144
  641. package/src/widget/components/OriginTransferInformation.tsx +0 -59
  642. package/src/widget/components/Pay.tsx +0 -1181
  643. package/src/widget/components/PaymentMethods.tsx +0 -198
  644. package/src/widget/components/PercentageMaxButtons.tsx +0 -112
  645. package/src/widget/components/PoolDeposit.tsx +0 -651
  646. package/src/widget/components/PoolWithdraw.tsx +0 -761
  647. package/src/widget/components/PriceImpactWarning.tsx +0 -87
  648. package/src/widget/components/QRCodeOptions.tsx +0 -65
  649. package/src/widget/components/QRCodeWalletSelect.tsx +0 -77
  650. package/src/widget/components/QrCode.tsx +0 -216
  651. package/src/widget/components/QuoteDetails.tsx +0 -1266
  652. package/src/widget/components/Receipt.tsx +0 -673
  653. package/src/widget/components/ReceiptRecoverableFunds.tsx +0 -135
  654. package/src/widget/components/RecentTokens.tsx +0 -66
  655. package/src/widget/components/RecipientSelectorButton.tsx +0 -50
  656. package/src/widget/components/Recipients.tsx +0 -412
  657. package/src/widget/components/RefundWarning.tsx +0 -66
  658. package/src/widget/components/RequiredPropsError.tsx +0 -33
  659. package/src/widget/components/ScreenHeader.tsx +0 -123
  660. package/src/widget/components/SearchInputField.tsx +0 -99
  661. package/src/widget/components/SessionTimeoutScreen.tsx +0 -103
  662. package/src/widget/components/ShadowPortal.tsx +0 -99
  663. package/src/widget/components/ShadowRootContext.tsx +0 -17
  664. package/src/widget/components/SimpleRecipientInputScreen.tsx +0 -91
  665. package/src/widget/components/SlippageToleranceSettings.tsx +0 -279
  666. package/src/widget/components/Swap.tsx +0 -50
  667. package/src/widget/components/SwapDisplay.tsx +0 -68
  668. package/src/widget/components/SwapSettings.tsx +0 -52
  669. package/src/widget/components/ThemeProvider.tsx +0 -115
  670. package/src/widget/components/ThemeSyncer.tsx +0 -47
  671. package/src/widget/components/Toast.tsx +0 -336
  672. package/src/widget/components/TokenDisplayNonSelectable.tsx +0 -40
  673. package/src/widget/components/TokenImage.tsx +0 -156
  674. package/src/widget/components/TokenList.tsx +0 -107
  675. package/src/widget/components/TokenSelector.tsx +0 -738
  676. package/src/widget/components/TokenSelectorButton.tsx +0 -123
  677. package/src/widget/components/TokenSkeleton.tsx +0 -53
  678. package/src/widget/components/Tooltip.tsx +0 -64
  679. package/src/widget/components/TrailsHookModal.tsx +0 -107
  680. package/src/widget/components/TransactionDetails.tsx +0 -488
  681. package/src/widget/components/TransactionHistoryItem.tsx +0 -767
  682. package/src/widget/components/TransferPendingVertical.tsx +0 -583
  683. package/src/widget/components/TruncatedAddress.tsx +0 -68
  684. package/src/widget/components/TruncatedTransactionHash.tsx +0 -74
  685. package/src/widget/components/UserPreferences.tsx +0 -570
  686. package/src/widget/components/WaasFeeOptions.tsx +0 -588
  687. package/src/widget/components/WalletConfirmation.tsx +0 -220
  688. package/src/widget/components/WalletConnect.tsx +0 -351
  689. package/src/widget/components/WalletConnectionPending.tsx +0 -178
  690. package/src/widget/components/WalletImage.tsx +0 -64
  691. package/src/widget/components/WalletList.tsx +0 -125
  692. package/src/widget/components/WidgetProviders.tsx +0 -82
  693. package/src/widget/components/Withdraw.tsx +0 -1088
  694. package/src/widget/components/YellowWarningAnimation.tsx +0 -146
  695. package/src/widget/hooks/useAddressWalletIcon.ts +0 -54
  696. package/src/widget/hooks/useAmountUsd.ts +0 -44
  697. package/src/widget/hooks/useBalanceVisible.tsx +0 -95
  698. package/src/widget/hooks/useChainFilter.tsx +0 -56
  699. package/src/widget/hooks/useCheckout.ts +0 -361
  700. package/src/widget/hooks/useClickTracking.ts +0 -74
  701. package/src/widget/hooks/useCombinedHistory.ts +0 -420
  702. package/src/widget/hooks/useConnector.tsx +0 -24
  703. package/src/widget/hooks/useCustomTokenFetch.tsx +0 -74
  704. package/src/widget/hooks/useCustomTokenSearch.tsx +0 -339
  705. package/src/widget/hooks/useDebounce.ts +0 -25
  706. package/src/widget/hooks/useDebugScreens.ts +0 -600
  707. package/src/widget/hooks/useDefaultDestinationToken.tsx +0 -182
  708. package/src/widget/hooks/useDefaultOriginToken.tsx +0 -410
  709. package/src/widget/hooks/useDepositMonitor.ts +0 -118
  710. package/src/widget/hooks/useDestinationSelectedToken.tsx +0 -310
  711. package/src/widget/hooks/useDisplayCurrencyPreference.tsx +0 -145
  712. package/src/widget/hooks/useEarnPool.tsx +0 -36
  713. package/src/widget/hooks/useExecutingIntentsCount.ts +0 -78
  714. package/src/widget/hooks/useExternalFundingReceiptSync.ts +0 -79
  715. package/src/widget/hooks/useFiatOnRampCurrencies.ts +0 -46
  716. package/src/widget/hooks/useFiatSelectedCurrency.tsx +0 -123
  717. package/src/widget/hooks/useGetIntent.ts +0 -54
  718. package/src/widget/hooks/useIntentReceiptBalances.ts +0 -141
  719. package/src/widget/hooks/useIntentTransactionHistory.ts +0 -785
  720. package/src/widget/hooks/useIsConnectedWalletSmartContract.ts +0 -43
  721. package/src/widget/hooks/useIsMobile.tsx +0 -50
  722. package/src/widget/hooks/useIsSequenceWallet.ts +0 -17
  723. package/src/widget/hooks/useLocalePreference.tsx +0 -187
  724. package/src/widget/hooks/useMeldTransactionHistory.ts +0 -184
  725. package/src/widget/hooks/useMeldTransactionStatus.ts +0 -707
  726. package/src/widget/hooks/useOnRampCountryDefaults.ts +0 -57
  727. package/src/widget/hooks/useOnRampPaymentMethods.ts +0 -72
  728. package/src/widget/hooks/useOnRampProviderWidget.ts +0 -184
  729. package/src/widget/hooks/useOnRampQuote.ts +0 -340
  730. package/src/widget/hooks/useOnRampTransactionStatus.ts +0 -196
  731. package/src/widget/hooks/useOriginSelectedToken.tsx +0 -253
  732. package/src/widget/hooks/usePayMessage.tsx +0 -496
  733. package/src/widget/hooks/usePriceImpactWarning.ts +0 -17
  734. package/src/widget/hooks/useQuote.ts +0 -1233
  735. package/src/widget/hooks/useRecentTokens.ts +0 -159
  736. package/src/widget/hooks/useRecipients.ts +0 -167
  737. package/src/widget/hooks/useScreenTracking.ts +0 -14
  738. package/src/widget/hooks/useSelectedFeeOption.tsx +0 -323
  739. package/src/widget/hooks/useSelectedFundMethod.tsx +0 -80
  740. package/src/widget/hooks/useSelectedRecipient.tsx +0 -75
  741. package/src/widget/hooks/useSendForm.ts +0 -1373
  742. package/src/widget/hooks/useSwapAmount.tsx +0 -50
  743. package/src/widget/hooks/useSwapState.tsx +0 -121
  744. package/src/widget/hooks/useTargetAmount.ts +0 -26
  745. package/src/widget/hooks/useTheme.tsx +0 -80
  746. package/src/widget/hooks/useTokenList.ts +0 -1099
  747. package/src/widget/hooks/useTokenWithFreshBalance.ts +0 -246
  748. package/src/widget/hooks/useTrailsSendTransaction.ts +0 -987
  749. package/src/widget/hooks/useViewManager.tsx +0 -505
  750. package/src/widget/hooks/useWalletConnectUri.tsx +0 -307
  751. package/src/widget/hooks/useWalletConnectionContext.tsx +0 -128
  752. package/src/widget/hooks/useWidgetProps.tsx +0 -33
  753. package/src/widget/index.css +0 -686
  754. package/src/widget/index.tsx +0 -28
  755. package/src/widget/providers/TrailsModalProvider.tsx +0 -238
  756. package/src/widget/providers/TrailsProvider.tsx +0 -150
  757. package/src/widget/providers/UserActivityProvider.tsx +0 -78
  758. package/src/widget/providers/WidgetProviderTree.tsx +0 -90
  759. package/src/widget/styles.ts +0 -26
  760. package/src/widget/types/analytics.ts +0 -22
  761. package/src/widget/types/commonProps.ts +0 -56
  762. package/src/widget/types/svg.d.ts +0 -8
  763. package/src/widget/types.ts +0 -51
  764. package/src/widget/utils/countryUtils.ts +0 -89
  765. package/src/widget/utils/createWagmiConfig.ts +0 -38
  766. package/src/widget/utils/forexRateStore.ts +0 -120
  767. package/src/widget/utils/fundMethodSwitchState.ts +0 -25
  768. package/src/widget/utils/historyFilters.ts +0 -157
  769. package/src/widget/utils/historyUtils.ts +0 -101
  770. package/src/widget/utils/localeStore.ts +0 -68
  771. package/src/widget/utils/meldProviderUtils.ts +0 -20
  772. package/src/widget/utils/statusLabel.ts +0 -3
  773. package/src/widget/utils/tokens.ts +0 -138
  774. package/src/widget/utils/transactionFailure.ts +0 -52
  775. package/src/widget/utils/viewManagerGuards.ts +0 -49
  776. package/src/widget/utils/windowUtils.ts +0 -138
  777. package/src/widget/widget.tsx +0 -3334
  778. /package/dist/{widget/hooks → hooks}/useAddressWalletIcon.d.ts +0 -0
  779. /package/dist/{widget/hooks → hooks}/useAmountUsd.d.ts +0 -0
  780. /package/dist/{widget/hooks → hooks}/useBalanceVisible.d.ts +0 -0
  781. /package/dist/{widget/hooks → hooks}/useChainFilter.d.ts +0 -0
  782. /package/dist/{widget/hooks → hooks}/useClickTracking.d.ts +0 -0
  783. /package/dist/{widget/hooks → hooks}/useConnector.d.ts +0 -0
  784. /package/dist/{widget/hooks → hooks}/useDebounce.d.ts +0 -0
  785. /package/dist/{widget/hooks → hooks}/useDepositMonitor.d.ts +0 -0
  786. /package/dist/{widget/hooks → hooks}/useDisplayCurrencyPreference.d.ts +0 -0
  787. /package/dist/{widget/hooks → hooks}/useExecutingIntentsCount.d.ts +0 -0
  788. /package/dist/{widget/hooks → hooks}/useFiatSelectedCurrency.d.ts +0 -0
  789. /package/dist/{widget/hooks → hooks}/useGetIntent.d.ts +0 -0
  790. /package/dist/{widget/hooks → hooks}/useIsMobile.d.ts +0 -0
  791. /package/dist/{widget/hooks → hooks}/useIsSequenceWallet.d.ts +0 -0
  792. /package/dist/{widget/hooks → hooks}/useLocalePreference.d.ts +0 -0
  793. /package/dist/{widget/hooks → hooks}/useMeldTransactionHistory.d.ts +0 -0
  794. /package/dist/{widget/hooks → hooks}/useMeldTransactionStatus.d.ts +0 -0
  795. /package/dist/{widget/hooks → hooks}/useOnRampCountryDefaults.d.ts +0 -0
  796. /package/dist/{widget/hooks → hooks}/usePayMessage.d.ts +0 -0
  797. /package/dist/{widget/hooks → hooks}/usePriceImpactWarning.d.ts +0 -0
  798. /package/dist/{widget/hooks → hooks}/useRecipients.d.ts +0 -0
  799. /package/dist/{widget/hooks → hooks}/useSelectedFeeOption.d.ts +0 -0
  800. /package/dist/{widget/hooks → hooks}/useSelectedRecipient.d.ts +0 -0
  801. /package/dist/{widget/hooks → hooks}/useSwapAmount.d.ts +0 -0
  802. /package/dist/{widget/hooks → hooks}/useTargetAmount.d.ts +0 -0
  803. /package/dist/{widget/hooks → hooks}/useTheme.d.ts +0 -0
  804. /package/dist/{widget/hooks → hooks}/useWalletConnectionContext.d.ts +0 -0
package/src/intents.ts DELETED
@@ -1,1125 +0,0 @@
1
- import type {
2
- AbortIntentRequest,
3
- AbortIntentResponse,
4
- CommitIntentResponse,
5
- DepositSignature,
6
- ExecuteIntentRequest,
7
- ExecuteIntentResponse,
8
- GasFeeOptions,
9
- GetIntentRequest,
10
- GetIntentResponse,
11
- Intent,
12
- IntentStatus,
13
- IntentCalls,
14
- PassthroughInfo,
15
- QuoteIntentRequest,
16
- TrailsApi,
17
- TrailsContracts,
18
- TransactionStateInfo,
19
- } from "@0xtrails/api"
20
- import { logger } from "./logger.js"
21
- import { IntentProtocolVersion, IntentSource, JsonEncode } from "@0xtrails/api"
22
- import type { TrailsClient } from "./trailsClient.js"
23
- import { getIntentStatusFromError } from "./error.js"
24
-
25
- import { Config, type Context, Payload } from "@0xsequence/wallet-primitives"
26
- import { Address, Bytes, ContractAddress, Hash, Hex } from "ox"
27
- import {
28
- type Account,
29
- type Chain,
30
- encodeFunctionData,
31
- erc20Abi,
32
- type WalletClient,
33
- } from "viem"
34
- import {
35
- trackIntentCommitCompleted,
36
- trackIntentCommitError,
37
- trackIntentCommitStarted,
38
- trackIntentQuoteError,
39
- trackIntentQuoteReceived,
40
- trackIntentQuoteRequested,
41
- trackTransactionError,
42
- trackTransactionStarted,
43
- trackTransactionSubmitted,
44
- } from "./analytics.js"
45
- import { getChainInfo, getChainRpcClient } from "./chains.js"
46
- import { attemptSwitchChain } from "./chainSwitch.js"
47
- import { SEQUENCE_V3_CONTRACT_ADDRESSES } from "./constants.js"
48
- import { getFullErrorMessage } from "./error.js"
49
- import { getFeeData } from "./estimate.js"
50
- import { zeroAddress } from "viem"
51
- import { addressEqual, isNativeToken } from "./utils/address.js"
52
- import { sendWalletTransaction } from "./walletUtils.js"
53
-
54
- export type IntentRequestParams = {
55
- userAddress: string
56
- originChainId: number
57
- originTokenAddress: string
58
- originTokenAmount: string
59
- destinationChainId: number
60
- destinationToAddress: string
61
- destinationTokenAddress: string
62
- destinationTokenAmount: string
63
- destinationCallData: string
64
- destinationCallValue: string
65
- }
66
-
67
- export interface MetaTxnFeeDetail {
68
- metaTxnID: string
69
- estimatedGasLimit: string
70
- feeNative: string
71
- }
72
-
73
- export interface ChainExecuteQuote {
74
- chainId: string
75
- totalGasLimit: string
76
- gasPrice: string
77
- totalFeeAmount: string
78
- nativeTokenSymbol: string
79
- nativeTokenPrice?: string
80
- metaTxnFeeDetails: Array<MetaTxnFeeDetail>
81
- totalFeeUSD?: string
82
- }
83
-
84
- export interface ExecuteQuote {
85
- chainQuotes: Array<ChainExecuteQuote>
86
- }
87
-
88
- export interface CrossChainFee {
89
- providerFee: string
90
- trailsSwapFee: string
91
- providerFeeUSD: number
92
- trailsSwapFeeUSD: number
93
- totalFeeAmount: string
94
- totalFeeUSD: number
95
- }
96
-
97
- export interface TrailsFee {
98
- executeQuote: ExecuteQuote
99
- crossChainFee?: CrossChainFee
100
- trailsFixedFeeUSD?: number
101
- feeToken?: string
102
- originTokenTotalAmount?: string
103
- totalFeeAmount?: string
104
- totalFeeUSD?: string
105
- }
106
-
107
- export type { Intent }
108
-
109
- export type OriginCallParams = {
110
- to: `0x${string}` | null
111
- data: Hex.Hex | null
112
- value: bigint | null
113
- chainId: number | null
114
- error?: string
115
- }
116
-
117
- export type SendOriginCallTxArgs = {
118
- to: string
119
- data: Hex.Hex
120
- value: bigint
121
- chain: Chain
122
- gasLimit?: bigint // Optional: if provided, skip gas estimation
123
- maxFeePerGas?: bigint // Optional: EIP-1559 max fee per gas
124
- maxPriorityFeePerGas?: bigint // Optional: EIP-1559 max priority fee per gas
125
- }
126
-
127
- export async function quoteIntent(
128
- trailsClient: TrailsApi,
129
- args: QuoteIntentRequest,
130
- additionalTrackingProps: Record<string, string> = {},
131
- abortSignal?: AbortSignal,
132
- ): Promise<{
133
- intent: Intent
134
- gasFeeOptions?: GasFeeOptions
135
- trailsContracts: TrailsContracts
136
- passthrough?: PassthroughInfo
137
- transactionStates?: TransactionStateInfo[]
138
- }> {
139
- // Track intent quote request
140
- trackIntentQuoteRequested({
141
- originChainId: args.originChainId || 0,
142
- destinationChainId: args.destinationChainId || 0,
143
- originTokenAddress: args.originTokenAddress,
144
- destinationTokenAddress: args.destinationTokenAddress,
145
- userAddress: args.ownerAddress,
146
- ...additionalTrackingProps,
147
- })
148
-
149
- try {
150
- logger.console.log("[trails-sdk] quote intent args:", args)
151
-
152
- type QuoteIntentResponse = Awaited<ReturnType<TrailsApi["quoteIntent"]>>
153
-
154
- // Create a promise that rejects when the abort signal fires
155
- let response: QuoteIntentResponse
156
- if (abortSignal) {
157
- const abortPromise = new Promise((_, reject) => {
158
- if (abortSignal.aborted) {
159
- reject(new Error("Request aborted"))
160
- }
161
- abortSignal.addEventListener("abort", () => {
162
- reject(new Error("Request aborted"))
163
- })
164
- })
165
-
166
- // Race between the API call and the abort signal
167
- response = (await Promise.race([
168
- trailsClient.quoteIntent(args, {}, abortSignal),
169
- abortPromise,
170
- ])) as QuoteIntentResponse
171
- } else {
172
- response = await trailsClient.quoteIntent(args)
173
- }
174
-
175
- if (!response || !(response as QuoteIntentResponse).intent) {
176
- logger.console.error("[trails-sdk] No result from quoteIntent")
177
- throw new Error("No result from quoteIntent")
178
- }
179
-
180
- const result = (response as QuoteIntentResponse).intent
181
-
182
- // Extract precondition amounts from origin and destination preconditions
183
- const originPrecondition = result.originPrecondition
184
- const destinationPrecondition = result.destinationPrecondition
185
-
186
- // Track successful intent quote received
187
- const providerFeeUSD =
188
- result.quote?.routeProvidersFeeUsd &&
189
- Array.isArray(result.quote.routeProvidersFeeUsd) &&
190
- result.quote.routeProvidersFeeUsd.length > 0
191
- ? result.quote.routeProvidersFeeUsd.reduce(
192
- (sum: number, fee: number) => sum + fee,
193
- 0,
194
- )
195
- : 0
196
-
197
- trackIntentQuoteReceived({
198
- quoteId: result.originIntentAddress || "unknown",
199
- totalFeeUSD: result.fees?.totalFeeUsd?.toString(),
200
- crossChainFeeTotalUSD: result.fees?.provider?.totalFeeUsd,
201
- providerFeeUSD,
202
- trailsSwapFeeUSD: result.fees?.provider?.trailsFeeUsd,
203
- gasFeesPerChainUSD: [
204
- typeof result.fees?.originGas?.totalFeeUsd === "string"
205
- ? parseFloat(result.fees.originGas.totalFeeUsd)
206
- : result.fees?.originGas?.totalFeeUsd || 0,
207
- typeof result.fees?.destinationGas?.totalFeeUsd === "string"
208
- ? parseFloat(result.fees.destinationGas.totalFeeUsd)
209
- : result.fees?.destinationGas?.totalFeeUsd || 0,
210
- ],
211
- originTokenTotalAmount: undefined, // This field no longer exists in IntentFees
212
- totalFeeAmount: result.fees?.totalFeeAmount?.toString(),
213
- provider: result.quote?.routeProviders
214
- ? result.quote.routeProviders.join(",")
215
- : undefined,
216
- swapProvider: result.quote?.routeProviders?.[0] || undefined,
217
- bridgeProvider: result.quote?.routeProviders?.[1] || undefined,
218
- feeToken: result.fees?.feeTokenAddress,
219
- userAddress: args.ownerAddress,
220
- intentAddress: result.originIntentAddress,
221
- originPreconditionAmount: originPrecondition?.minAmount?.toString(),
222
- destinationPreconditionAmount:
223
- destinationPrecondition?.minAmount?.toString(),
224
- fromAmount: result.quote?.fromAmount?.toString(),
225
- fromAmountMin: result.quote?.fromAmountMin?.toString(),
226
- toAmount: result.quote?.toAmount?.toString(),
227
- toAmountMin: result.quote?.toAmountMin?.toString(),
228
- ...additionalTrackingProps,
229
- })
230
-
231
- return {
232
- intent: result,
233
- gasFeeOptions: response.gasFeeOptions,
234
- trailsContracts: result.trailsContracts,
235
- passthrough: response.passthrough,
236
- transactionStates: response.transactionStates,
237
- }
238
- } catch (error) {
239
- logger.console.error("[trails-sdk] Error in getIntent", error)
240
- // Track intent quote error
241
- trackIntentQuoteError({
242
- error: getFullErrorMessage(error),
243
- userAddress: args.ownerAddress,
244
- originChainId: args.originChainId || 0,
245
- destinationChainId: args.destinationChainId || 0,
246
- originTokenAddress: args.originTokenAddress,
247
- destinationTokenAddress: args.destinationTokenAddress,
248
- ...additionalTrackingProps,
249
- })
250
- throw error
251
- }
252
- }
253
-
254
- export async function getIntentConfigurationFromCalls(
255
- trailsClient: TrailsClient,
256
- intentId: string,
257
- intentProtocolVersion: IntentProtocolVersion,
258
- mainSigner: string,
259
- checkpoint: number,
260
- calls: IntentCalls,
261
- isOrigin: boolean,
262
- context?: Context.Context,
263
- ): Promise<{
264
- address: `0x${string}`
265
- imageHash: `0x${string}`
266
- config: Config.Config
267
- }> {
268
- logger.console.log(
269
- "[trails-sdk] [intent-protocol] === Intent Configuration Calculation ===",
270
- {
271
- intentProtocolVersion,
272
- mainSigner,
273
- checkpoint,
274
- callsCount: calls?.calls?.length ?? 0,
275
- isOrigin,
276
- calculationMethod:
277
- intentProtocolVersion === IntentProtocolVersion.v1
278
- ? "client-side (Merkle tree)"
279
- : "server-side (API call)",
280
- },
281
- )
282
- if (intentProtocolVersion === IntentProtocolVersion.v1) {
283
- logger.console.log(
284
- "[trails-sdk] [intent-protocol] v1: Calculating intent config client-side (deprecated)",
285
- {
286
- intentProtocolVersion,
287
- method: "buildMerkleTreeFromMembers + counterfactual address",
288
- },
289
- )
290
- return getIntentConfigurationFromCallsV1(mainSigner, calls, context)
291
- }
292
-
293
- logger.console.log(
294
- "[trails-sdk] [intent-protocol] v1.5: Fetching intent config from API",
295
- {
296
- intentProtocolVersion,
297
- intentId,
298
- isOrigin,
299
- },
300
- )
301
-
302
- const response = await trailsClient.getIntentConfig({
303
- intentId,
304
- intentSource: isOrigin ? IntentSource.ORIGIN : IntentSource.DESTINATION,
305
- })
306
-
307
- const config = fromServiceConfig(response.walletConfiguration)
308
-
309
- logger.console.log(
310
- "[trails-sdk] [intent-protocol] v1.5: Received config from API",
311
- {
312
- address: response.address.toString(),
313
- imageHash: response.imageHash.toString(),
314
- hasConfig: !!config,
315
- },
316
- )
317
- return {
318
- address: response.address.toString() as `0x${string}`,
319
- imageHash: response.imageHash.toString() as `0x${string}`,
320
- config,
321
- }
322
- }
323
-
324
- // @deprecated - v1 only
325
- function getIntentConfigurationFromCallsV1(
326
- mainSigner: string,
327
- calls: IntentCalls,
328
- context?: Context.Context,
329
- ): {
330
- address: `0x${string}`
331
- imageHash: `0x${string}`
332
- config: Config.Config
333
- } {
334
- logger.console.log(
335
- "[trails-sdk] [intent-protocol] v1: Building Merkle tree client-side",
336
- {
337
- mainSigner,
338
- callsCount: calls?.calls?.length ?? 0,
339
- },
340
- )
341
-
342
- const sequenceContext = context || SEQUENCE_V3_CONTRACT_ADDRESSES
343
-
344
- const config = createIntentConfigurationV1(Address.from(mainSigner), [calls])
345
- const imageHash = Config.hashConfiguration(config)
346
- const calculatedAddress = calculateIntentAddressFromImageHash(
347
- sequenceContext,
348
- imageHash,
349
- )
350
-
351
- logger.console.log("[trails-sdk] Final calculated configuration:", {
352
- address: calculatedAddress.toString() as `0x${string}`,
353
- imageHash: Bytes.toHex(imageHash) as `0x${string}`,
354
- })
355
-
356
- return {
357
- address: calculatedAddress.toString() as `0x${string}`,
358
- imageHash: Bytes.toHex(imageHash) as `0x${string}`,
359
- config,
360
- }
361
- }
362
-
363
- function calculateIntentAddressFromImageHash(
364
- context: Context.Context,
365
- imageHash: Bytes.Bytes,
366
- ): Address.Address {
367
- const hash = imageHash
368
-
369
- logger.console.log(
370
- "[trails-sdk] calculateIntentConfigurationAddress imageHash:",
371
- Bytes.toHex(hash),
372
- )
373
-
374
- // Log context for debugging
375
- logger.console.log("[trails-sdk] Context values:", {
376
- factory: context.factory,
377
- creationCode: context.creationCode,
378
- stage1: context.stage1,
379
- })
380
-
381
- // Calculate the counterfactual address using the image hash and context
382
- const address = ContractAddress.fromCreate2({
383
- from: context.factory,
384
- bytecodeHash: Hash.keccak256(
385
- Bytes.concat(
386
- Bytes.from(context.creationCode),
387
- Bytes.padLeft(Bytes.from(context.stage1), 32),
388
- ),
389
- { as: "Bytes" },
390
- ),
391
- salt: hash,
392
- })
393
-
394
- logger.console.log("[trails-sdk] Final calculated address:", address)
395
- return address
396
- }
397
-
398
- export async function calculateOriginAndDestinationIntentAddresses(
399
- trailsClient: TrailsClient,
400
- intentId: string,
401
- intentProtocolVersion: IntentProtocolVersion,
402
- mainSigner: string,
403
- checkpoint: number,
404
- calls: Array<IntentCalls>,
405
- ): Promise<{
406
- originIntentAddress: Address.Address
407
- destinationIntentAddress: Address.Address
408
- }> {
409
- const originChainId = calls[0]?.chainId
410
- const destinationChainId = calls[1]?.chainId || originChainId
411
-
412
- logger.console.log("[trails-sdk] originChainId:", originChainId)
413
- logger.console.log("[trails-sdk] destinationChainId:", destinationChainId)
414
-
415
- // Different origin and destination chains: cross-chain execution.
416
- const originCalls = calls.filter((c) => c.chainId === originChainId)
417
- const destinationCalls = calls.filter((c) => c.chainId === destinationChainId)
418
-
419
- logger.console.log("[trails-sdk] originCalls:", originCalls)
420
- logger.console.log("[trails-sdk] destinationCalls:", destinationCalls)
421
-
422
- if (originCalls.length !== 1) {
423
- // This should never happen
424
- logger.console.log("[trails-sdk] calls length incorrect")
425
- throw new Error("origin calls length incorrect")
426
- }
427
-
428
- const { address: originIntentAddress } =
429
- await getIntentConfigurationFromCalls(
430
- trailsClient,
431
- intentId,
432
- intentProtocolVersion,
433
- mainSigner,
434
- checkpoint,
435
- originCalls[0]!,
436
- true,
437
- )
438
- let destinationIntentAddress = originIntentAddress
439
-
440
- // Calculate separate destination intent address if:
441
- // 1. Cross-chain scenario (different chain IDs), OR
442
- // 2. Same-chain with multiple payloads (e.g., custom calldata creates separate origin/destination payloads)
443
- if (originChainId !== destinationChainId || calls.length > 1) {
444
- if (destinationCalls.length !== 1) {
445
- // This should never happen
446
- logger.console.log("[trails-sdk] destination calls length incorrect")
447
- throw new Error("destination calls length incorrect")
448
- }
449
- const { address } = await getIntentConfigurationFromCalls(
450
- trailsClient,
451
- intentId,
452
- intentProtocolVersion,
453
- mainSigner,
454
- checkpoint,
455
- originCalls[0]!,
456
- false,
457
- )
458
- destinationIntentAddress = address
459
- }
460
-
461
- logger.console.log("[trails-sdk] originIntentAddress:", originIntentAddress)
462
- logger.console.log(
463
- "[trails-sdk] destinationIntentAddress:",
464
- destinationIntentAddress,
465
- )
466
-
467
- return { originIntentAddress, destinationIntentAddress }
468
- }
469
-
470
- export async function commitIntent(
471
- trailsClient: TrailsClient,
472
- intent: Intent,
473
- additionalTrackingProps: Record<string, string> = {},
474
- ): Promise<CommitIntentResponse> {
475
- // Build arrays for logging
476
- const originIntentCalls = intent.originCalls
477
- const destinationIntentCalls = intent.destinationCalls
478
- const calls = []
479
- if (originIntentCalls) calls.push(originIntentCalls)
480
- if (destinationIntentCalls) calls.push(destinationIntentCalls)
481
-
482
- const originPre = intent.originPrecondition
483
- const destinationPre = intent.destinationPrecondition
484
- const preconditions = []
485
- if (originPre) preconditions.push(originPre)
486
- if (destinationPre) preconditions.push(destinationPre)
487
-
488
- logger.console.log("[trails-sdk] commitIntent inputs:", {
489
- intentId: intent.intentId,
490
- ownerAddress: intent.ownerAddress,
491
- originIntentAddress: intent.originIntentAddress,
492
- destinationIntentAddress: intent.destinationIntentAddress,
493
- calls,
494
- preconditions,
495
- })
496
-
497
- // Additional detailed precondition logging
498
- logger.console.log("[trails-sdk] Detailed preconditions:", preconditions)
499
-
500
- // Log each precondition individually for easier reading
501
- preconditions.forEach((precondition, index) => {
502
- logger.console.log(`[trails-sdk] Precondition ${index}:`, {
503
- type: precondition.type,
504
- chainId: precondition.chainId,
505
- ownerAddress: precondition.ownerAddress,
506
- tokenAddress: precondition.tokenAddress,
507
- minAmount: precondition.minAmount?.toString(),
508
- })
509
- })
510
-
511
- logger.console.log(
512
- "[trails-sdk] originIntentAddress:",
513
- intent.originIntentAddress,
514
- )
515
- logger.console.log(
516
- "[trails-sdk] destinationIntentAddress:",
517
- intent.destinationIntentAddress,
518
- )
519
-
520
- const originChainIdStr = intent.quoteRequest.originChainId.toString()
521
- const destinationChainIdStr =
522
- intent.quoteRequest.destinationChainId.toString()
523
-
524
- // Get the origin precondition owner address directly
525
- const receivedAddress = originPre?.ownerAddress
526
-
527
- logger.console.log("[trails-sdk] Address comparison:", {
528
- receivedAddress,
529
- calculatedAddress: intent.originIntentAddress,
530
- match:
531
- receivedAddress &&
532
- addressEqual(receivedAddress, intent.originIntentAddress),
533
- })
534
-
535
- try {
536
- // Track intent commit start
537
- trackIntentCommitStarted({
538
- intentAddress: intent.originIntentAddress,
539
- userAddress: intent.ownerAddress,
540
- originChainId: originChainIdStr ? Number(originChainIdStr) : undefined,
541
- destinationChainId: destinationChainIdStr
542
- ? Number(destinationChainIdStr)
543
- : undefined,
544
- ...additionalTrackingProps,
545
- })
546
-
547
- // Commit the intent that was returned from quoteIntent
548
- const response = await trailsClient.commitIntent({
549
- intent,
550
- })
551
-
552
- logger.console.log("[trails-sdk] commitIntent response:", response)
553
-
554
- // Track successful intent commit
555
- trackIntentCommitCompleted({
556
- intentAddress: intent.originIntentAddress,
557
- userAddress: intent.ownerAddress,
558
- originChainId: originChainIdStr ? Number(originChainIdStr) : undefined,
559
- destinationChainId: destinationChainIdStr
560
- ? Number(destinationChainIdStr)
561
- : undefined,
562
- ...additionalTrackingProps,
563
- })
564
-
565
- return response
566
- } catch (error) {
567
- // Track intent commit error
568
- trackIntentCommitError({
569
- error: getFullErrorMessage(error),
570
- userAddress: intent.ownerAddress,
571
- intentAddress: intent.originIntentAddress,
572
- originChainId: originChainIdStr ? Number(originChainIdStr) : undefined,
573
- destinationChainId: destinationChainIdStr
574
- ? Number(destinationChainIdStr)
575
- : undefined,
576
- ...additionalTrackingProps,
577
- })
578
- throw error
579
- }
580
- }
581
-
582
- export async function executeIntent(
583
- trailsClient: TrailsClient,
584
- intentId: string,
585
- depositTransactionHash?: string,
586
- depositSignature?: DepositSignature,
587
- ): Promise<ExecuteIntentResponse> {
588
- logger.console.log("[trails-sdk] executeIntent inputs:", {
589
- intentId,
590
- providedDepositTransactionHash: depositTransactionHash,
591
- hasDepositSignature: !!depositSignature,
592
- })
593
-
594
- const request: ExecuteIntentRequest = {
595
- intentId,
596
- depositSignature,
597
- }
598
-
599
- logger.console.log("[trails-sdk] executeIntent request:", request)
600
-
601
- try {
602
- const response = await trailsClient.executeIntent(request)
603
- logger.console.log("[trails-sdk] executeIntent response:", response)
604
-
605
- return response
606
- } catch (error) {
607
- const intentStatus = getIntentStatusFromError(error)
608
-
609
- if (intentStatus) {
610
- logger.console.log(
611
- "[trails-sdk] executeIntent returned terminal/non-committed status, treating as current state",
612
- {
613
- intentId,
614
- intentStatus,
615
- },
616
- )
617
-
618
- return {
619
- intentId,
620
- intentStatus: intentStatus as IntentStatus,
621
- }
622
- }
623
-
624
- throw error
625
- }
626
- }
627
-
628
- export async function sendOriginTransaction(
629
- account: Account,
630
- walletClient: WalletClient,
631
- originParams: SendOriginCallTxArgs,
632
- additionalTrackingProps: Record<string, string> = {},
633
- ): Promise<`0x${string}`> {
634
- await attemptSwitchChain({
635
- walletClient,
636
- desiredChainId: originParams.chain.id,
637
- })
638
-
639
- // Track transaction start
640
- trackTransactionStarted({
641
- transactionType: "origin_call",
642
- chainId: originParams.chain.id,
643
- userAddress: account.address,
644
- ...additionalTrackingProps,
645
- })
646
-
647
- const chainInfo = getChainInfo(originParams.chain.id)
648
- if (!chainInfo) {
649
- throw new Error(`Chain ${originParams.chain.id} not found`)
650
- }
651
- const publicClient = getChainRpcClient(chainInfo.id)
652
-
653
- // Use provided gasLimit if available, otherwise let the wallet estimate
654
- let gasLimit: bigint | undefined
655
- if (originParams.gasLimit) {
656
- gasLimit = originParams.gasLimit
657
- logger.console.log(
658
- "[trails-sdk][gas-estimation] using provided gasLimit:",
659
- gasLimit,
660
- )
661
- } else {
662
- logger.console.log(
663
- "[trails-sdk][gas-estimation] no gasLimit provided, let wallet estimate",
664
- )
665
- }
666
-
667
- // Get fee parameters - try EIP-1559 first, then fall back to legacy
668
- // Use provided fees if available, otherwise fetch and boost them for faster processing
669
- let maxFeePerGas: bigint | undefined = originParams.maxFeePerGas
670
- let maxPriorityFeePerGas: bigint | undefined =
671
- originParams.maxPriorityFeePerGas
672
- let gasPrice: bigint | undefined
673
-
674
- if (!maxFeePerGas) {
675
- try {
676
- // Use getFeeData which applies the PRIORITY_FEE_MULTIPLIER
677
- const feeData = await getFeeData(publicClient)
678
-
679
- if (feeData.maxFeePerGas) {
680
- maxFeePerGas = feeData.maxFeePerGas
681
- maxPriorityFeePerGas = feeData.maxPriorityFeePerGas
682
- logger.console.log(
683
- "[trails-sdk][gas-estimation] Using boosted EIP-1559 fees in sendOriginTransaction:",
684
- { maxFeePerGas, maxPriorityFeePerGas },
685
- )
686
- } else if (feeData.gasPrice) {
687
- gasPrice = feeData.gasPrice
688
- logger.console.log(
689
- "[trails-sdk][gas-estimation] Using boosted legacy gas price in sendOriginTransaction:",
690
- { gasPrice },
691
- )
692
- }
693
- } catch (_error) {
694
- // Fee data fetch failed, will use wallet default
695
- logger.console.log(
696
- "[trails-sdk][gas-estimation] Fee data fetch failed in sendOriginTransaction, wallet will use default",
697
- )
698
- }
699
- }
700
-
701
- logger.console.log(
702
- "[trails-sdk] sending origin tx with sendWalletTransaction()",
703
- )
704
- const id = Date.now()
705
- logger.console.time(`[trails-sdk] sendWalletTransaction-${id}`)
706
-
707
- try {
708
- // Build transaction parameters - EIP-1559 and legacy are mutually exclusive
709
- const txParams: any = {
710
- account: account,
711
- to: originParams.to as `0x${string}`,
712
- data: originParams.data as `0x${string}`,
713
- value: BigInt(originParams.value),
714
- chain: originParams.chain,
715
- }
716
- if (gasLimit) {
717
- txParams.gas = gasLimit
718
- }
719
-
720
- // Add fee parameters based on transaction type
721
- if (maxFeePerGas && maxPriorityFeePerGas) {
722
- // EIP-1559 transaction
723
- txParams.maxFeePerGas = maxFeePerGas
724
- txParams.maxPriorityFeePerGas = maxPriorityFeePerGas
725
- } else if (gasPrice) {
726
- // Legacy transaction
727
- txParams.gasPrice = gasPrice
728
- }
729
-
730
- const hash = await sendWalletTransaction(walletClient, txParams)
731
- logger.console.timeEnd(`[trails-sdk] sendWalletTransaction-${id}`)
732
- logger.console.log("[trails-sdk] done sending, origin tx hash", hash)
733
-
734
- // Track successful transaction submission (pseudonymize() is called inside analytics)
735
- trackTransactionSubmitted({
736
- transactionHash: hash,
737
- chainId: originParams.chain.id,
738
- userAddress: account.address,
739
- ...additionalTrackingProps,
740
- })
741
-
742
- if (!hash) {
743
- throw new Error("No transaction hash returned from sendWalletTransaction")
744
- }
745
-
746
- return hash
747
- } catch (error) {
748
- logger.console.timeEnd(`[trails-sdk] sendWalletTransaction-${id}`)
749
-
750
- // Track failed transaction
751
- trackTransactionError({
752
- transactionHash: "",
753
- error: getFullErrorMessage(error),
754
- userAddress: account.address,
755
- ...additionalTrackingProps,
756
- })
757
-
758
- throw error
759
- }
760
- }
761
-
762
- // @deprecated - v1 only
763
- function createIntentConfigurationV1(
764
- mainSigner: Address.Address,
765
- calls: IntentCalls[],
766
- ): Config.Config {
767
- const mainSignerLeaf: Config.SignerLeaf = {
768
- type: "signer",
769
- address: mainSigner,
770
- weight: 1n,
771
- }
772
-
773
- logger.console.log("[trails-sdk] mainSignerLeaf:", mainSignerLeaf)
774
-
775
- // Log detailed call information for debugging configuration mismatch
776
- logger.console.log(
777
- "[trails-sdk] calls:",
778
- calls.map((call) => ({
779
- chainId: call.chainId,
780
- space: call.space,
781
- nonce: call.nonce,
782
- callsCount: call.calls.length,
783
- })),
784
- )
785
-
786
- const subdigestLeaves: Config.AnyAddressSubdigestLeaf[] = calls.map(
787
- (call) => {
788
- const spaceValue = BigInt(call.space || 0)
789
- const nonceValue = BigInt(call.nonce || 0)
790
-
791
- logger.console.log(
792
- `[trails-sdk] Processing call - chainId: ${call.chainId}, space: ${call.space} -> ${spaceValue}, nonce: ${call.nonce} -> ${nonceValue}`,
793
- )
794
-
795
- const payloadForHashing = {
796
- type: "call" as const,
797
- chainId: Number(call.chainId),
798
- space: spaceValue,
799
- nonce: nonceValue,
800
- calls: call.calls.map((call) => ({
801
- type: "call" as const,
802
- to: call.to as `0x${string}`,
803
- value: BigInt(call.value?.toString() || "0"),
804
- data: Bytes.toHex(Bytes.from((call.data as Hex.Hex) || "0x")),
805
- gasLimit: BigInt(call.gasLimit?.toString() || "0"),
806
- delegateCall: !!call.delegateCall,
807
- onlyFallback: !!call.onlyFallback,
808
- behaviorOnError: (call.behaviorOnError === 0
809
- ? "ignore"
810
- : call.behaviorOnError === 1
811
- ? "revert"
812
- : "abort") as "ignore" | "revert" | "abort",
813
- })),
814
- }
815
-
816
- logger.console.log(
817
- "[DEBUG CREATION] Payload being hashed:",
818
- payloadForHashing,
819
- )
820
- logger.console.log("[DEBUG CREATION] Chain ID:", Number(call.chainId))
821
- logger.console.log(
822
- "[DEBUG CREATION] Using zero address as verifying contract",
823
- )
824
-
825
- const digest = Payload.hash(
826
- Address.from(zeroAddress),
827
- Number(call.chainId),
828
- payloadForHashing,
829
- )
830
- logger.console.log("[trails-sdk] digest:", Bytes.toHex(digest))
831
- return {
832
- type: "any-address-subdigest",
833
- digest: Bytes.toHex(digest),
834
- } as Config.AnyAddressSubdigestLeaf
835
- },
836
- )
837
-
838
- logger.console.log("[trails-sdk] calls:", calls)
839
- logger.console.log("[trails-sdk] subdigestLeaves:", subdigestLeaves)
840
-
841
- const otherLeaves: Config.Topology[] = [...subdigestLeaves]
842
-
843
- if (otherLeaves.length === 0) {
844
- throw new Error(
845
- "Intent configuration must have at least one call or LiFi information.",
846
- )
847
- }
848
-
849
- let secondaryTopologyNode: Config.Topology
850
-
851
- if (otherLeaves.length === 1) {
852
- secondaryTopologyNode = otherLeaves[0]!
853
- } else {
854
- secondaryTopologyNode = buildMerkleTreeFromMembers(otherLeaves)
855
- }
856
-
857
- // Print the topology
858
- logger.console.log(
859
- "[trails-sdk] Topology:",
860
- JsonEncode([mainSignerLeaf, secondaryTopologyNode]),
861
- )
862
-
863
- return {
864
- threshold: 1n,
865
- checkpoint: 0n,
866
- topology: [mainSignerLeaf, secondaryTopologyNode] as Config.Node,
867
- }
868
- }
869
-
870
- // @deprecated - v1 only
871
- // Renamed and generalized from createSubdigestTree
872
- function buildMerkleTreeFromMembers(
873
- members: Config.Topology[],
874
- ): Config.Topology {
875
- if (members.length === 0) {
876
- throw new Error("Cannot create a tree from empty members")
877
- }
878
- if (members.length === 1) {
879
- return members[0]! // Returns a single Leaf or a Node
880
- }
881
-
882
- let currentLevel = [...members]
883
- while (currentLevel.length > 1) {
884
- const nextLevel: Config.Topology[] = []
885
- for (let i = 0; i < currentLevel.length; i += 2) {
886
- const left = currentLevel[i]!
887
- if (i + 1 < currentLevel.length) {
888
- const right = currentLevel[i + 1]!
889
- nextLevel.push([left, right] as Config.Node)
890
- } else {
891
- // Odd one out, carries over to the next level
892
- nextLevel.push(left)
893
- }
894
- }
895
- currentLevel = nextLevel
896
- }
897
- return currentLevel[0]!
898
- }
899
-
900
- function fromServiceConfig(config: any): Config.Config {
901
- if (config.checkpointer !== undefined) {
902
- Address.assert(config.checkpointer)
903
- }
904
-
905
- return {
906
- threshold: BigInt(config.threshold),
907
- checkpoint: BigInt(config.checkpoint),
908
- checkpointer: config.checkpointer,
909
- topology: fromServiceConfigTree(config.tree),
910
- }
911
- }
912
-
913
- function fromServiceConfigTree(tree: any): Config.Topology {
914
- logger.console.log("fromServiceConfigTree", tree)
915
- switch (typeof tree) {
916
- case "string":
917
- Hex.assert(tree)
918
- return tree
919
-
920
- case "object":
921
- if (Array.isArray(tree)) {
922
- return [fromServiceConfigTree(tree[0]), fromServiceConfigTree(tree[1])]
923
- }
924
-
925
- if ("weight" in tree) {
926
- if ("address" in tree) {
927
- Address.assert(tree.address)
928
-
929
- if (tree.imageHash) {
930
- Hex.assert(tree.imageHash)
931
- return {
932
- type: "sapient-signer",
933
- address: tree.address,
934
- weight: BigInt(tree.weight),
935
- imageHash: tree.imageHash,
936
- }
937
- } else {
938
- return {
939
- type: "signer",
940
- address: tree.address,
941
- weight: BigInt(tree.weight),
942
- }
943
- }
944
- }
945
-
946
- if ("tree" in tree) {
947
- return {
948
- type: "nested",
949
- weight: BigInt(tree.weight),
950
- threshold: BigInt(tree.threshold),
951
- tree: fromServiceConfigTree(tree.tree),
952
- }
953
- }
954
- }
955
-
956
- if ("subdigest" in tree) {
957
- Hex.assert(tree.subdigest)
958
- return {
959
- type: tree.isAnyAddress ? "any-address-subdigest" : "subdigest",
960
- digest: tree.subdigest,
961
- }
962
- }
963
- }
964
-
965
- throw new Error(`unknown config tree ${JSON.stringify(tree)}`)
966
- }
967
-
968
- /**
969
- * Fetches intent data from the Trails API
970
- * @param trailsClient - TrailsClient instance
971
- * @param intentId - The intent ID to fetch
972
- * @returns Promise resolving to the intent data
973
- */
974
- export async function getIntent(
975
- trailsClient: TrailsClient,
976
- intentId: string,
977
- ): Promise<GetIntentResponse> {
978
- const request: GetIntentRequest = {
979
- intentId,
980
- }
981
-
982
- return await trailsClient.getIntent(request)
983
- }
984
-
985
- /**
986
- * Abort an intent after a successful recovery
987
- * This should be called after the recover function executes successfully
988
- *
989
- * @param trailsClient - The Trails API client
990
- * @param intentId - The ID of the intent to abort
991
- * @param chainId - The chain ID where the recovery transaction was executed
992
- * @param abortTransactionHash - The transaction hash from the recovery
993
- * @returns Promise resolving to the abort response with intent status
994
- */
995
- export async function abortIntent(
996
- trailsClient: TrailsClient,
997
- intentId: string,
998
- chainId: number,
999
- abortTransactionHash: string,
1000
- ): Promise<AbortIntentResponse> {
1001
- logger.console.log("[trails-sdk] Aborting intent after recovery:", {
1002
- intentId,
1003
- chainId,
1004
- abortTransactionHash,
1005
- })
1006
-
1007
- try {
1008
- const request: AbortIntentRequest = {
1009
- intentId,
1010
- chainId,
1011
- abortTransactionHash,
1012
- }
1013
-
1014
- const response = await trailsClient.abortIntent(request)
1015
-
1016
- logger.console.log("[trails-sdk] Intent aborted successfully:", {
1017
- intentId,
1018
- status: response.status,
1019
- })
1020
-
1021
- return response
1022
- } catch (error) {
1023
- logger.console.error("[trails-sdk] Failed to abort intent:", {
1024
- intentId,
1025
- chainId,
1026
- abortTransactionHash,
1027
- error: error instanceof Error ? error.message : String(error),
1028
- })
1029
- throw error
1030
- }
1031
- }
1032
-
1033
- export function buildSameChainSameTokenTransactionParams({
1034
- hasCustomCalldata,
1035
- recipient,
1036
- effectiveOriginTokenAddress,
1037
- destinationCalldata,
1038
- swapAmount,
1039
- effectiveOriginChainId,
1040
- effectiveOriginChain,
1041
- }: {
1042
- hasCustomCalldata: boolean
1043
- recipient: string
1044
- effectiveOriginTokenAddress: string
1045
- destinationCalldata?: string
1046
- swapAmount: string
1047
- effectiveOriginChainId: number
1048
- effectiveOriginChain: Chain
1049
- }) {
1050
- const isNative = isNativeToken(effectiveOriginTokenAddress)
1051
-
1052
- // Determine transaction data based on token type and calldata
1053
- let data: string
1054
- let to: string
1055
-
1056
- if (hasCustomCalldata) {
1057
- // Custom calldata provided - use it directly
1058
- to = recipient
1059
- data = destinationCalldata || "0x"
1060
- } else if (isNative) {
1061
- // Native token transfer - no data needed
1062
- to = recipient
1063
- data = "0x"
1064
- } else {
1065
- // ERC20 token transfer - encode transfer function call
1066
- to = effectiveOriginTokenAddress
1067
- data = encodeFunctionData({
1068
- abi: erc20Abi,
1069
- functionName: "transfer",
1070
- args: [recipient as `0x${string}`, BigInt(swapAmount)],
1071
- })
1072
- }
1073
-
1074
- return {
1075
- to,
1076
- data,
1077
- value: isNative ? BigInt(swapAmount) : "0",
1078
- chainId: effectiveOriginChainId,
1079
- chain: effectiveOriginChain,
1080
- }
1081
- }
1082
-
1083
- /**
1084
- * Build transaction parameters for cross-chain deposit transactions
1085
- * Uses backend-provided transaction fields directly
1086
- */
1087
- export function buildCrossChainDepositParams({
1088
- depositTransaction,
1089
- chain,
1090
- }: {
1091
- depositTransaction: {
1092
- to: string
1093
- data: string
1094
- value?: string | bigint
1095
- chainId: number
1096
- }
1097
- chain: Chain
1098
- }) {
1099
- // Validate required backend-provided transaction fields
1100
- if (
1101
- !depositTransaction?.to ||
1102
- !depositTransaction?.data ||
1103
- !depositTransaction?.chainId ||
1104
- depositTransaction?.value == null
1105
- ) {
1106
- throw new Error(
1107
- "Backend did not provide required transaction fields (to, data, value, chainId) in depositTransaction.",
1108
- )
1109
- }
1110
-
1111
- // Sanity check: compare local chain object chainId with API chainId
1112
- if (chain.id !== depositTransaction.chainId) {
1113
- throw new Error(
1114
- `Chain ID mismatch: local chain object has chainId ${chain.id} but depositTransaction has chainId ${depositTransaction.chainId}`,
1115
- )
1116
- }
1117
-
1118
- return {
1119
- to: depositTransaction.to,
1120
- data: depositTransaction.data as Hex.Hex,
1121
- value: BigInt(depositTransaction.value ?? 0),
1122
- chainId: depositTransaction.chainId,
1123
- chain,
1124
- }
1125
- }