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/decoders.ts CHANGED
@@ -100,10 +100,7 @@ export type GuestModuleEvent =
100
100
  | CallSkippedEvent
101
101
 
102
102
  // Trails Token Sweeper events: see PR references above for canonical specs.
103
- export type TrailsTokenSweeperEvent =
104
- | RefundEvent
105
- | SweepEvent
106
- | RefundAndSweepEvent
103
+ export type TokenSweeperEvent = RefundEvent | SweepEvent | RefundAndSweepEvent
107
104
 
108
105
  // === Decoders ===
109
106
 
@@ -285,10 +282,10 @@ export function decodeSweep(log: Log): SweepEvent | null {
285
282
 
286
283
  // === Main decoder ===
287
284
 
288
- export function decodeTrailsTokenSweeperEvents(
285
+ export function decodeTokenSweeperEvents(
289
286
  receipt: TransactionReceipt,
290
- ): TrailsTokenSweeperEvent[] {
291
- const events: TrailsTokenSweeperEvent[] = []
287
+ ): TokenSweeperEvent[] {
288
+ const events: TokenSweeperEvent[] = []
292
289
 
293
290
  for (const log of receipt.logs) {
294
291
  const refund = decodeRefund(log)
package/src/error.ts CHANGED
@@ -33,9 +33,13 @@ export function getIsUserRejectionError(
33
33
  }
34
34
 
35
35
  // Check if the error message indicates a user rejection
36
- const isRejected = /rejected|denied|user rejected the request/gi.test(
37
- getErrorString(err).toLowerCase(),
38
- )
36
+ // Use getFullErrorMessage to check nested error messages as well
37
+ // Match patterns like: "rejected", "denied", "user rejected", "denied transaction signature", etc.
38
+ const errorString = getFullErrorMessage(err).toLowerCase()
39
+ const isRejected =
40
+ /rejected|denied|user rejected|denied transaction signature|user denied transaction|user denied the request/gi.test(
41
+ errorString,
42
+ )
39
43
  return isRejected
40
44
  }
41
45
 
package/src/fees.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Intent } from "@0xsequence/trails-api"
1
+ import type { Intent } from "@0xtrails/api"
2
2
  import { getTokenInfo } from "./tokens.js"
3
3
  import { formatRawAmount, formatUsdAmountDisplay } from "./tokenBalances.js"
4
4
  import { zeroAddress } from "viem"
@@ -26,13 +26,14 @@ async function formatTokenAmount(
26
26
  amount: string | number | undefined,
27
27
  tokenAddress: string,
28
28
  chainId: number,
29
+ config: { trailsApiKey: string; trailsApiUrl: string },
29
30
  ): Promise<string> {
30
31
  if (!amount) return "0"
31
32
  const num = typeof amount === "string" ? parseFloat(amount) : amount
32
33
  if (num === 0) return "0"
33
34
 
34
35
  // Get token info to determine decimals
35
- const tokenInfo = await getTokenInfo(chainId, tokenAddress)
36
+ const tokenInfo = await getTokenInfo(chainId, tokenAddress, config)
36
37
  if (!tokenInfo?.decimals) {
37
38
  throw new Error(
38
39
  `Token decimals not found for token ${tokenAddress} on chain ${chainId}`,
@@ -49,13 +50,73 @@ async function formatTokenAmount(
49
50
  return formatted
50
51
  }
51
52
 
52
- // Extract fee breakdown from intent data
53
+ /**
54
+ * Extract fee breakdown and calculate all fee values from intent data
55
+ * Uses raw USD values from intent to avoid parsing display strings
56
+ */
53
57
  export async function extractTrailsFeeBreakdown(
54
58
  intent: Intent,
55
- ): Promise<TrailsFeeBreakdown | null> {
59
+ config: { trailsApiKey: string; trailsApiUrl: string },
60
+ options?: {
61
+ originAmountUsd?: number
62
+ destinationAmountUsd?: number
63
+ totalFeesUsd?: number
64
+ },
65
+ ): Promise<{
66
+ trailsFeeBreakdown: TrailsFeeBreakdown | null
67
+ // Calculated fee values (using raw USD numbers)
68
+ originGasUsd: number
69
+ destGasUsd: number
70
+ totalGasUsd: number
71
+ providerUsd: number
72
+ trailsUsd: number
73
+ originUsd: number
74
+ destUsd: number
75
+ totalFeesUsd: number
76
+ swapFeesUsd: number
77
+ totalProviderUsd: number
78
+ allProviderFeesUsd: number
79
+ grandTotalUsd: number
80
+ grandTotalUsdDisplay: string
81
+ // Display values
82
+ originGasUsdDisplay: string
83
+ destGasUsdDisplay: string
84
+ totalGasUsdDisplay: string
85
+ providerUsdDisplay: string
86
+ trailsUsdDisplay: string
87
+ explicitProviderUsdDisplay: string
88
+ swapFeesUsdDisplay: string
89
+ totalProviderUsdDisplay: string
90
+ allProviderFeesUsdDisplay: string
91
+ }> {
56
92
  const fees = intent?.fees
57
93
  if (!fees) {
58
- return null
94
+ // Return zero values if no fees
95
+ return {
96
+ trailsFeeBreakdown: null,
97
+ originGasUsd: 0,
98
+ destGasUsd: 0,
99
+ totalGasUsd: 0,
100
+ providerUsd: 0,
101
+ trailsUsd: 0,
102
+ originUsd: options?.originAmountUsd ?? 0,
103
+ destUsd: options?.destinationAmountUsd ?? 0,
104
+ totalFeesUsd: options?.totalFeesUsd ?? 0,
105
+ swapFeesUsd: 0,
106
+ totalProviderUsd: 0,
107
+ grandTotalUsd: 0,
108
+ grandTotalUsdDisplay: formatUsdAmountDisplay(0),
109
+ originGasUsdDisplay: formatUsdAmountDisplay(0),
110
+ destGasUsdDisplay: formatUsdAmountDisplay(0),
111
+ totalGasUsdDisplay: formatUsdAmountDisplay(0),
112
+ providerUsdDisplay: formatUsdAmountDisplay(0),
113
+ trailsUsdDisplay: formatUsdAmountDisplay(0),
114
+ explicitProviderUsdDisplay: formatUsdAmountDisplay(0),
115
+ swapFeesUsdDisplay: formatUsdAmountDisplay(0),
116
+ totalProviderUsdDisplay: formatUsdAmountDisplay(0),
117
+ allProviderFeesUsd: 0,
118
+ allProviderFeesUsdDisplay: formatUsdAmountDisplay(0),
119
+ }
59
120
  }
60
121
 
61
122
  // Get chain IDs from origin and destination calls
@@ -66,140 +127,193 @@ export async function extractTrailsFeeBreakdown(
66
127
  const originChainQuote = fees.originGas
67
128
  const destinationChainQuote = fees.destinationGas
68
129
 
69
- // If we can't find any chain quotes, return null
70
- if (!originChainQuote && !destinationChainQuote) {
71
- console.warn(
72
- "[trails-sdk] Could not find any chain quotes for fee breakdown",
73
- {
74
- originChainId,
75
- destinationChainId,
76
- },
77
- )
78
- return null
79
- }
130
+ // Extract raw USD values (use numbers directly, avoid parsing strings)
131
+ const originGasUsd =
132
+ typeof originChainQuote?.totalFeeUsd === "string"
133
+ ? parseFloat(originChainQuote.totalFeeUsd)
134
+ : (originChainQuote?.totalFeeUsd ?? 0)
135
+ const destGasUsd =
136
+ typeof destinationChainQuote?.totalFeeUsd === "string"
137
+ ? parseFloat(destinationChainQuote.totalFeeUsd)
138
+ : (destinationChainQuote?.totalFeeUsd ?? 0)
139
+ const providerUsd =
140
+ typeof fees.provider?.quoteProviderFeeUsd === "number"
141
+ ? fees.provider.quoteProviderFeeUsd
142
+ : 0
143
+ const trailsUsd =
144
+ typeof fees.provider?.trailsFeeUsd === "number"
145
+ ? fees.provider.trailsFeeUsd
146
+ : 0
80
147
 
81
- const breakdown: TrailsFeeBreakdown = {}
148
+ // Use provided USD amounts or calculate from intent if available
149
+ const originUsd = options?.originAmountUsd ?? 0
150
+ const destUsd = options?.destinationAmountUsd ?? 0
151
+ const totalFeesUsd = options?.totalFeesUsd ?? 0
82
152
 
83
- // Extract origin relay fee if available
84
- if (originChainQuote && originChainId !== undefined) {
85
- const originTokenSymbol = originChainQuote.nativeTokenSymbol || "ETH"
86
- const originChainIdNum = originChainId
87
- const nativeTokenAddress = zeroAddress
153
+ // Calculate swap fees: (originAmount - destinationAmount) - totalFees
154
+ const swapFeesUsd = Math.max(0, originUsd - destUsd - totalFeesUsd)
88
155
 
89
- breakdown.originRelayFee = {
90
- amount: await formatTokenAmount(
91
- originChainQuote.totalFeeAmount.toString(),
92
- nativeTokenAddress,
93
- originChainIdNum,
94
- ),
95
- tokenSymbol: originTokenSymbol,
96
- tokenAddress: nativeTokenAddress,
97
- chainId: originChainIdNum,
98
- usdValue: formatUsdAmountDisplay(originChainQuote.totalFeeUsd),
99
- }
100
- breakdown.originChainId = originChainIdNum
101
- }
156
+ // Calculate totals
157
+ const totalGasUsd = originGasUsd + destGasUsd
158
+ const explicitProviderUsd = providerUsd + trailsUsd
159
+ const totalProviderUsd = providerUsd + trailsUsd + swapFeesUsd
160
+ // All provider fees = provider fee + swap fee (excluding trails)
161
+ const allProviderFeesUsd = providerUsd + swapFeesUsd
162
+ // Grand total = all gas costs + all provider fees
163
+ const grandTotalUsd = totalGasUsd + allProviderFeesUsd
102
164
 
103
- // Extract destination relay fee if available
104
- if (destinationChainQuote && destinationChainId !== undefined) {
105
- const destinationTokenSymbol =
106
- destinationChainQuote.nativeTokenSymbol || "ETH"
107
- const destinationChainIdNum = destinationChainId
108
- const nativeTokenAddress = zeroAddress
109
-
110
- breakdown.destinationRelayFee = {
111
- amount: await formatTokenAmount(
112
- destinationChainQuote.totalFeeAmount.toString(),
113
- nativeTokenAddress,
114
- destinationChainIdNum,
115
- ),
116
- tokenSymbol: destinationTokenSymbol,
117
- tokenAddress: nativeTokenAddress,
118
- chainId: destinationChainIdNum,
119
- usdValue: formatUsdAmountDisplay(destinationChainQuote.totalFeeUsd),
120
- }
121
- breakdown.destinationChainId = destinationChainIdNum
122
- }
165
+ // Build breakdown for display (only if we have chain quotes)
166
+ let breakdown: TrailsFeeBreakdown | null = null
167
+ if (originChainQuote || destinationChainQuote) {
168
+ breakdown = {}
123
169
 
124
- // Extract provider fee from provider fees if available
125
- const providerFeeAmount = fees.provider?.quoteProviderFeeUsd
126
- const providerFeeRawAmount = fees.provider?.quoteProviderFee
127
- if (
128
- (providerFeeAmount !== undefined || providerFeeRawAmount !== undefined) &&
129
- originChainId !== undefined
130
- ) {
131
- const feeTokenAddress = fees.feeTokenAddress || zeroAddress
132
- const originChainIdNum =
133
- typeof originChainId === "bigint" ? Number(originChainId) : originChainId
134
-
135
- // Get token info to determine the actual token symbol
136
- const feeTokenInfo = await getTokenInfo(originChainIdNum, feeTokenAddress)
137
- if (!feeTokenInfo?.symbol) {
138
- throw new Error(
139
- `Token symbol not found for provider fee token ${feeTokenAddress} on chain ${originChainIdNum}`,
140
- )
170
+ // Extract origin relay fee if available
171
+ if (originChainQuote && originChainId !== undefined) {
172
+ const originTokenSymbol = originChainQuote.nativeTokenSymbol || "ETH"
173
+ const originChainIdNum = originChainId
174
+ const nativeTokenAddress = zeroAddress
175
+
176
+ breakdown.originRelayFee = {
177
+ amount: await formatTokenAmount(
178
+ originChainQuote.totalFeeAmount.toString(),
179
+ nativeTokenAddress,
180
+ originChainIdNum,
181
+ config,
182
+ ),
183
+ tokenSymbol: originTokenSymbol,
184
+ tokenAddress: nativeTokenAddress,
185
+ chainId: originChainIdNum,
186
+ usdValue: formatUsdAmountDisplay(originGasUsd),
187
+ }
188
+ breakdown.originChainId = originChainIdNum
141
189
  }
142
190
 
143
- breakdown.providerFee = {
144
- amount: await formatTokenAmount(
145
- providerFeeRawAmount?.toString(),
146
- feeTokenAddress,
147
- originChainIdNum,
148
- ),
149
- tokenSymbol: feeTokenInfo.symbol,
150
- tokenAddress: feeTokenAddress,
151
- chainId: originChainIdNum,
152
- usdValue: formatUsdAmountDisplay(providerFeeAmount),
191
+ // Extract destination relay fee if available
192
+ if (destinationChainQuote && destinationChainId !== undefined) {
193
+ const destinationTokenSymbol =
194
+ destinationChainQuote.nativeTokenSymbol || "ETH"
195
+ const destinationChainIdNum = destinationChainId
196
+ const nativeTokenAddress = zeroAddress
197
+
198
+ breakdown.destinationRelayFee = {
199
+ amount: await formatTokenAmount(
200
+ destinationChainQuote.totalFeeAmount.toString(),
201
+ nativeTokenAddress,
202
+ destinationChainIdNum,
203
+ config,
204
+ ),
205
+ tokenSymbol: destinationTokenSymbol,
206
+ tokenAddress: nativeTokenAddress,
207
+ chainId: destinationChainIdNum,
208
+ usdValue: formatUsdAmountDisplay(destGasUsd),
209
+ }
210
+ breakdown.destinationChainId = destinationChainIdNum
153
211
  }
154
- }
155
212
 
156
- // Extract Trails platform fee from provider fees if available
157
- const trailsFeeAmount = fees.provider?.trailsFeeUsd
158
- const trailsFeeRawAmount = fees.provider?.trailsFee
159
- if (
160
- (trailsFeeAmount !== undefined || trailsFeeRawAmount !== undefined) &&
161
- originChainId !== undefined
162
- ) {
163
- const feeTokenAddress = fees.feeTokenAddress || zeroAddress
164
- const originChainIdNum =
165
- typeof originChainId === "bigint" ? Number(originChainId) : originChainId
166
-
167
- // Get token info to determine the actual token symbol
168
- const feeTokenInfo = await getTokenInfo(originChainIdNum, feeTokenAddress)
169
- if (!feeTokenInfo?.symbol) {
170
- throw new Error(
171
- `Token symbol not found for trails fee token ${feeTokenAddress} on chain ${originChainIdNum}`,
213
+ // Extract provider fee from provider fees if available
214
+ const providerFeeRawAmount = fees.provider?.quoteProviderFee
215
+ if (
216
+ (providerUsd > 0 || providerFeeRawAmount !== undefined) &&
217
+ originChainId !== undefined
218
+ ) {
219
+ const feeTokenAddress = fees.feeTokenAddress || zeroAddress
220
+ const originChainIdNum =
221
+ typeof originChainId === "bigint"
222
+ ? Number(originChainId)
223
+ : originChainId
224
+
225
+ // Get token info to determine the actual token symbol
226
+ const feeTokenInfo = await getTokenInfo(
227
+ originChainIdNum,
228
+ feeTokenAddress,
229
+ config,
172
230
  )
231
+ if (!feeTokenInfo?.symbol) {
232
+ throw new Error(
233
+ `Token symbol not found for provider fee token ${feeTokenAddress} on chain ${originChainIdNum}`,
234
+ )
235
+ }
236
+
237
+ breakdown.providerFee = {
238
+ amount: await formatTokenAmount(
239
+ providerFeeRawAmount?.toString(),
240
+ feeTokenAddress,
241
+ originChainIdNum,
242
+ config,
243
+ ),
244
+ tokenSymbol: feeTokenInfo.symbol,
245
+ tokenAddress: feeTokenAddress,
246
+ chainId: originChainIdNum,
247
+ usdValue: formatUsdAmountDisplay(providerUsd),
248
+ }
173
249
  }
174
250
 
175
- breakdown.trailsFee = {
176
- amount: await formatTokenAmount(
177
- trailsFeeRawAmount?.toString(),
178
- feeTokenAddress,
251
+ // Extract Trails platform fee from provider fees if available
252
+ const trailsFeeRawAmount = fees.provider?.trailsFee
253
+ if (
254
+ (trailsUsd > 0 || trailsFeeRawAmount !== undefined) &&
255
+ originChainId !== undefined
256
+ ) {
257
+ const feeTokenAddress = fees.feeTokenAddress || zeroAddress
258
+ const originChainIdNum =
259
+ typeof originChainId === "bigint"
260
+ ? Number(originChainId)
261
+ : originChainId
262
+
263
+ // Get token info to determine the actual token symbol
264
+ const feeTokenInfo = await getTokenInfo(
179
265
  originChainIdNum,
180
- ),
181
- tokenSymbol: feeTokenInfo.symbol,
182
- tokenAddress: feeTokenAddress,
183
- chainId: originChainIdNum,
184
- usdValue: formatUsdAmountDisplay(trailsFeeAmount),
185
- }
186
- }
266
+ feeTokenAddress,
267
+ config,
268
+ )
269
+ if (!feeTokenInfo?.symbol) {
270
+ throw new Error(
271
+ `Token symbol not found for trails fee token ${feeTokenAddress} on chain ${originChainIdNum}`,
272
+ )
273
+ }
187
274
 
188
- // Calculate total USD value from the actual data
189
- const originUsd =
190
- typeof originChainQuote?.totalFeeUsd === "string"
191
- ? parseFloat(originChainQuote.totalFeeUsd)
192
- : originChainQuote?.totalFeeUsd || 0
193
- const destinationUsd =
194
- typeof destinationChainQuote?.totalFeeUsd === "string"
195
- ? parseFloat(destinationChainQuote.totalFeeUsd)
196
- : destinationChainQuote?.totalFeeUsd || 0
197
- const providerUsd =
198
- typeof providerFeeAmount === "number" ? providerFeeAmount : 0
199
- const trailsUsd = typeof trailsFeeAmount === "number" ? trailsFeeAmount : 0
200
- const totalUsd = originUsd + destinationUsd + providerUsd + trailsUsd
275
+ breakdown.trailsFee = {
276
+ amount: await formatTokenAmount(
277
+ trailsFeeRawAmount?.toString(),
278
+ feeTokenAddress,
279
+ originChainIdNum,
280
+ config,
281
+ ),
282
+ tokenSymbol: feeTokenInfo.symbol,
283
+ tokenAddress: feeTokenAddress,
284
+ chainId: originChainIdNum,
285
+ usdValue: formatUsdAmountDisplay(trailsUsd),
286
+ }
287
+ }
201
288
 
202
- breakdown.totalUsdValue = formatUsdAmountDisplay(totalUsd)
289
+ // Calculate total USD value for breakdown display
290
+ const totalUsd = originGasUsd + destGasUsd + providerUsd + trailsUsd
291
+ breakdown.totalUsdValue = formatUsdAmountDisplay(totalUsd)
292
+ }
203
293
 
204
- return breakdown
294
+ return {
295
+ trailsFeeBreakdown: breakdown,
296
+ originGasUsd,
297
+ destGasUsd,
298
+ totalGasUsd,
299
+ providerUsd,
300
+ trailsUsd,
301
+ originUsd,
302
+ destUsd,
303
+ totalFeesUsd,
304
+ swapFeesUsd,
305
+ totalProviderUsd,
306
+ allProviderFeesUsd,
307
+ grandTotalUsd,
308
+ grandTotalUsdDisplay: formatUsdAmountDisplay(grandTotalUsd),
309
+ originGasUsdDisplay: formatUsdAmountDisplay(originGasUsd),
310
+ destGasUsdDisplay: formatUsdAmountDisplay(destGasUsd),
311
+ totalGasUsdDisplay: formatUsdAmountDisplay(totalGasUsd),
312
+ providerUsdDisplay: formatUsdAmountDisplay(providerUsd),
313
+ trailsUsdDisplay: formatUsdAmountDisplay(trailsUsd),
314
+ explicitProviderUsdDisplay: formatUsdAmountDisplay(explicitProviderUsd),
315
+ swapFeesUsdDisplay: formatUsdAmountDisplay(swapFeesUsd),
316
+ totalProviderUsdDisplay: formatUsdAmountDisplay(totalProviderUsd),
317
+ allProviderFeesUsdDisplay: formatUsdAmountDisplay(allProviderFeesUsd),
318
+ }
205
319
  }
package/src/gasless.ts CHANGED
@@ -92,38 +92,6 @@ export function getTransferCalldata({
92
92
  return transferCalldata
93
93
  }
94
94
 
95
- export function getPermitCalls(
96
- connectedAccount: `0x${string}`,
97
- delegatorSmartAccountAddress: `0x${string}`,
98
- amount: bigint,
99
- deadline: bigint,
100
- signature: `0x${string}`,
101
- recipient: `0x${string}`,
102
- tokenAddress: `0x${string}`,
103
- ): { to: `0x${string}`; data: `0x${string}`; value: string }[] {
104
- const permitCalldata = getPermitCalldata({
105
- signer: connectedAccount,
106
- spender: delegatorSmartAccountAddress,
107
- amount,
108
- deadline,
109
- signature,
110
- })
111
- const transferFromCalldata = getTransferFromCalldata({
112
- signer: connectedAccount,
113
- spender: delegatorSmartAccountAddress,
114
- amount,
115
- })
116
- const transferCalldata = getTransferCalldata({ recipient, amount })
117
-
118
- return [permitCalldata, transferFromCalldata, transferCalldata].map(
119
- (call) => ({
120
- to: tokenAddress,
121
- data: call,
122
- value: "0",
123
- }),
124
- )
125
- }
126
-
127
95
  export type GetPermitSignatureParams = {
128
96
  publicClient: PublicClient
129
97
  walletClient: WalletClient
@@ -318,6 +286,60 @@ export async function getPermitSignature({
318
286
  return { signature, deadline, v, r, s }
319
287
  }
320
288
 
289
+ export type GetNeedsIntentEntrypointApprovalParams = {
290
+ client: PublicClient
291
+ token: Address
292
+ account: Address
293
+ entrypoint: Address
294
+ amount: bigint
295
+ }
296
+
297
+ export async function getNeedsIntentEntrypointApproval({
298
+ client,
299
+ token,
300
+ account,
301
+ entrypoint,
302
+ amount,
303
+ }: GetNeedsIntentEntrypointApprovalParams): Promise<boolean> {
304
+ const allowance = await client.readContract({
305
+ address: token,
306
+ abi: erc20Abi,
307
+ functionName: "allowance",
308
+ args: [getAddress(account), getAddress(entrypoint)],
309
+ })
310
+
311
+ return allowance < amount
312
+ }
313
+
314
+ export type GetUserNonceParams = {
315
+ publicClient: PublicClient
316
+ userAddress: `0x${string}`
317
+ intentEntrypoint: `0x${string}`
318
+ }
319
+
320
+ export async function getUserNonce({
321
+ publicClient,
322
+ userAddress,
323
+ intentEntrypoint,
324
+ }: GetUserNonceParams): Promise<bigint> {
325
+ const nonce = await publicClient.readContract({
326
+ address: intentEntrypoint as `0x${string}`,
327
+ abi: [
328
+ {
329
+ name: "nonces",
330
+ type: "function",
331
+ stateMutability: "view",
332
+ inputs: [{ name: "user", type: "address" }],
333
+ outputs: [{ name: "", type: "uint256" }],
334
+ },
335
+ ],
336
+ functionName: "nonces",
337
+ args: [userAddress],
338
+ })
339
+
340
+ return nonce as bigint
341
+ }
342
+
321
343
  export type GetDepositToIntentWithPermitCalldataParams = {
322
344
  user: `0x${string}`
323
345
  token: `0x${string}`
@@ -438,71 +460,6 @@ export function getDepositToIntentWithoutPermitCalldata({
438
460
  })
439
461
  }
440
462
 
441
- export type GetDepositToIntentCallsParams = {
442
- publicClient: PublicClient
443
- walletClient: WalletClient
444
- account: Account
445
- intentEntrypoint: `0x${string}`
446
- depositTokenAddress: `0x${string}`
447
- depositTokenAmount: bigint
448
- depositRecipient: `0x${string}`
449
- chain: Chain
450
- }
451
-
452
- export type GetNeedsIntentEntrypointApprovalParams = {
453
- client: PublicClient
454
- token: Address
455
- account: Address
456
- entrypoint: Address
457
- amount: bigint
458
- }
459
-
460
- export async function getNeedsIntentEntrypointApproval({
461
- client,
462
- token,
463
- account,
464
- entrypoint,
465
- amount,
466
- }: GetNeedsIntentEntrypointApprovalParams): Promise<boolean> {
467
- const allowance = await client.readContract({
468
- address: token,
469
- abi: erc20Abi,
470
- functionName: "allowance",
471
- args: [getAddress(account), getAddress(entrypoint)],
472
- })
473
-
474
- return allowance < amount
475
- }
476
-
477
- export type GetUserNonceParams = {
478
- publicClient: PublicClient
479
- userAddress: `0x${string}`
480
- intentEntrypoint: `0x${string}`
481
- }
482
-
483
- export async function getUserNonce({
484
- publicClient,
485
- userAddress,
486
- intentEntrypoint,
487
- }: GetUserNonceParams): Promise<bigint> {
488
- const nonce = await publicClient.readContract({
489
- address: intentEntrypoint as `0x${string}`,
490
- abi: [
491
- {
492
- name: "nonces",
493
- type: "function",
494
- stateMutability: "view",
495
- inputs: [{ name: "user", type: "address" }],
496
- outputs: [{ name: "", type: "uint256" }],
497
- },
498
- ],
499
- functionName: "nonces",
500
- args: [userAddress],
501
- })
502
-
503
- return nonce as bigint
504
- }
505
-
506
463
  export type IntentParams = {
507
464
  user: `0x${string}`
508
465
  token: `0x${string}`
@@ -609,17 +566,6 @@ function getSignatureBytes(signature: string): number {
609
566
  : signature.length / 2
610
567
  }
611
568
 
612
- /**
613
- * Validates that a signature is exactly 65 bytes (standard ECDSA signature length).
614
- * @param signature - The signature to validate (hex string with or without 0x prefix)
615
- * @returns true if signature is 65 bytes, false otherwise
616
- */
617
- export function isValidGaslessSignature(signature: string): boolean {
618
- // Standard ECDSA signatures are 65 bytes (32 bytes r + 32 bytes s + 1 byte v)
619
- // Smart contract wallets return longer signatures which are not supported
620
- return getSignatureBytes(signature) === 65
621
- }
622
-
623
569
  /**
624
570
  * Validates that a signature is exactly 65 bytes and throws an appropriate error if invalid.
625
571
  * @param signature - The signature to validate (hex string with or without 0x prefix)