0xtrails 0.2.4 → 0.2.6

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 (212) hide show
  1. package/dist/aave.d.ts +8 -0
  2. package/dist/aave.d.ts.map +1 -1
  3. package/dist/abortController.d.ts +8 -0
  4. package/dist/abortController.d.ts.map +1 -0
  5. package/dist/{ccip-BlV1Mry3.js → ccip-Xjh9d1gb.js} +7 -7
  6. package/dist/config.d.ts +1 -1
  7. package/dist/config.d.ts.map +1 -1
  8. package/dist/constants.d.ts +3 -0
  9. package/dist/constants.d.ts.map +1 -1
  10. package/dist/error.d.ts +1 -0
  11. package/dist/error.d.ts.map +1 -1
  12. package/dist/estimate.d.ts +52 -0
  13. package/dist/estimate.d.ts.map +1 -1
  14. package/dist/fees.d.ts +19 -0
  15. package/dist/fees.d.ts.map +1 -0
  16. package/dist/{index-BNWCIGfQ.js → index-BnhdZ8Ho.js} +76406 -75798
  17. package/dist/index.js +726 -520
  18. package/dist/intents.d.ts +40 -0
  19. package/dist/intents.d.ts.map +1 -1
  20. package/dist/metaTxnMonitor.d.ts +3 -3
  21. package/dist/metaTxnMonitor.d.ts.map +1 -1
  22. package/dist/metaTxns.d.ts +3 -3
  23. package/dist/metaTxns.d.ts.map +1 -1
  24. package/dist/morpho.d.ts +8 -0
  25. package/dist/morpho.d.ts.map +1 -1
  26. package/dist/prepareSend.d.ts +19 -75
  27. package/dist/prepareSend.d.ts.map +1 -1
  28. package/dist/queryParams.d.ts.map +1 -1
  29. package/dist/relayer.d.ts +6 -6
  30. package/dist/relayer.d.ts.map +1 -1
  31. package/dist/sequenceWallet.d.ts +2 -2
  32. package/dist/sequenceWallet.d.ts.map +1 -1
  33. package/dist/tokens.d.ts.map +1 -1
  34. package/dist/transactions.d.ts +4 -2
  35. package/dist/transactions.d.ts.map +1 -1
  36. package/dist/wallets.d.ts.map +1 -1
  37. package/dist/widget/components/AccountActionsDropdown.d.ts.map +1 -1
  38. package/dist/widget/components/AccountIntentTransactionHistoryButton.d.ts +4 -0
  39. package/dist/widget/components/AccountIntentTransactionHistoryButton.d.ts.map +1 -0
  40. package/dist/widget/components/AccountSettings.d.ts.map +1 -1
  41. package/dist/widget/components/ChainFilterDropdown.d.ts.map +1 -1
  42. package/dist/widget/components/ClassicSwap.d.ts +4 -2
  43. package/dist/widget/components/ClassicSwap.d.ts.map +1 -1
  44. package/dist/widget/components/ConnectWallet.d.ts.map +1 -1
  45. package/dist/widget/components/ConnectedWallets.d.ts +4 -0
  46. package/dist/widget/components/ConnectedWallets.d.ts.map +1 -1
  47. package/dist/widget/components/DynamicInputStyles.d.ts +18 -0
  48. package/dist/widget/components/DynamicInputStyles.d.ts.map +1 -0
  49. package/dist/widget/components/Earn.d.ts +2 -2
  50. package/dist/widget/components/Earn.d.ts.map +1 -1
  51. package/dist/widget/components/ErrorAnimationIcon.d.ts +2 -0
  52. package/dist/widget/components/ErrorAnimationIcon.d.ts.map +1 -0
  53. package/dist/widget/components/FeeBreakdown.d.ts +9 -0
  54. package/dist/widget/components/FeeBreakdown.d.ts.map +1 -0
  55. package/dist/widget/components/Fund.d.ts +2 -2
  56. package/dist/widget/components/Fund.d.ts.map +1 -1
  57. package/dist/widget/components/FundMethods.d.ts.map +1 -1
  58. package/dist/widget/components/{FundSendForm.d.ts → FundSwap.d.ts} +13 -7
  59. package/dist/widget/components/FundSwap.d.ts.map +1 -0
  60. package/dist/widget/components/FundingMethodSelectorButton.d.ts +4 -0
  61. package/dist/widget/components/FundingMethodSelectorButton.d.ts.map +1 -0
  62. package/dist/widget/components/Identicon.d.ts.map +1 -1
  63. package/dist/widget/components/MeshConnectExchanges.d.ts +0 -3
  64. package/dist/widget/components/MeshConnectExchanges.d.ts.map +1 -1
  65. package/dist/widget/components/Modal.d.ts.map +1 -1
  66. package/dist/widget/components/Pay.d.ts +2 -2
  67. package/dist/widget/components/Pay.d.ts.map +1 -1
  68. package/dist/widget/components/PercentageMaxButtons.d.ts +12 -0
  69. package/dist/widget/components/PercentageMaxButtons.d.ts.map +1 -0
  70. package/dist/widget/components/{PaySendForm.d.ts → PoolDeposit.d.ts} +14 -36
  71. package/dist/widget/components/PoolDeposit.d.ts.map +1 -0
  72. package/dist/widget/components/{SimpleSwap.d.ts → PoolWithdraw.d.ts} +19 -10
  73. package/dist/widget/components/PoolWithdraw.d.ts.map +1 -0
  74. package/dist/widget/components/QuoteDetails.d.ts +1 -0
  75. package/dist/widget/components/QuoteDetails.d.ts.map +1 -1
  76. package/dist/widget/components/Receipt.d.ts.map +1 -1
  77. package/dist/widget/components/Receive.d.ts.map +1 -1
  78. package/dist/widget/components/RecipientSelectorButton.d.ts +4 -0
  79. package/dist/widget/components/RecipientSelectorButton.d.ts.map +1 -0
  80. package/dist/widget/components/Recipients.d.ts.map +1 -1
  81. package/dist/widget/components/RequiredPropsError.d.ts +8 -0
  82. package/dist/widget/components/RequiredPropsError.d.ts.map +1 -0
  83. package/dist/widget/components/ScreenHeader.d.ts.map +1 -1
  84. package/dist/widget/components/SlippageToleranceSettings.d.ts.map +1 -1
  85. package/dist/widget/components/Swap.d.ts +3 -2
  86. package/dist/widget/components/Swap.d.ts.map +1 -1
  87. package/dist/widget/components/SwapSettings.d.ts.map +1 -1
  88. package/dist/widget/components/ThemeProvider.d.ts.map +1 -1
  89. package/dist/widget/components/TokenDisplayNonSelectable.d.ts +11 -0
  90. package/dist/widget/components/TokenDisplayNonSelectable.d.ts.map +1 -0
  91. package/dist/widget/components/TokenImage.d.ts +1 -0
  92. package/dist/widget/components/TokenImage.d.ts.map +1 -1
  93. package/dist/widget/components/TokenList.d.ts.map +1 -1
  94. package/dist/widget/components/TokenSelector.d.ts.map +1 -1
  95. package/dist/widget/components/TokenSelectorButton.d.ts +16 -0
  96. package/dist/widget/components/TokenSelectorButton.d.ts.map +1 -0
  97. package/dist/widget/components/Tooltip.d.ts +9 -0
  98. package/dist/widget/components/Tooltip.d.ts.map +1 -0
  99. package/dist/widget/components/UserPreferences.d.ts.map +1 -1
  100. package/dist/widget/components/WaasFeeOptions.d.ts +9 -0
  101. package/dist/widget/components/WaasFeeOptions.d.ts.map +1 -0
  102. package/dist/widget/components/WalletConfirmation.d.ts.map +1 -1
  103. package/dist/widget/components/WalletConnect.d.ts.map +1 -1
  104. package/dist/widget/components/WalletList.d.ts.map +1 -1
  105. package/dist/widget/css/compiled.css +2 -0
  106. package/dist/widget/css/index.css +554 -0
  107. package/dist/widget/hooks/useBack.d.ts +1 -0
  108. package/dist/widget/hooks/useBack.d.ts.map +1 -1
  109. package/dist/widget/hooks/useCheckout.d.ts +1 -1
  110. package/dist/widget/hooks/useCheckout.d.ts.map +1 -1
  111. package/dist/widget/hooks/useCurrentScreen.d.ts +1 -1
  112. package/dist/widget/hooks/useCurrentScreen.d.ts.map +1 -1
  113. package/dist/widget/hooks/useDefaultTokenSelection.d.ts +3 -3
  114. package/dist/widget/hooks/useDefaultTokenSelection.d.ts.map +1 -1
  115. package/dist/widget/hooks/usePayMessage.d.ts.map +1 -1
  116. package/dist/widget/hooks/useQuote.d.ts +83 -0
  117. package/dist/widget/hooks/useQuote.d.ts.map +1 -0
  118. package/dist/widget/hooks/useSelectedFundMethod.d.ts +12 -0
  119. package/dist/widget/hooks/useSelectedFundMethod.d.ts.map +1 -0
  120. package/dist/widget/hooks/useSelectedRecipient.d.ts.map +1 -1
  121. package/dist/widget/hooks/useSendForm.d.ts +2 -2
  122. package/dist/widget/hooks/useSendForm.d.ts.map +1 -1
  123. package/dist/widget/index.js +2 -2
  124. package/dist/widget/widget.d.ts +9 -4
  125. package/dist/widget/widget.d.ts.map +1 -1
  126. package/package.json +18 -12
  127. package/src/aave.ts +32 -0
  128. package/src/abortController.ts +35 -0
  129. package/src/config.ts +12 -4
  130. package/src/constants.ts +5 -0
  131. package/src/error.ts +19 -1
  132. package/src/estimate.ts +416 -5
  133. package/src/fees.ts +199 -0
  134. package/src/intents.ts +161 -11
  135. package/src/metaTxnMonitor.ts +3 -3
  136. package/src/metaTxns.ts +3 -5
  137. package/src/morpho.ts +32 -0
  138. package/src/prepareSend.ts +714 -550
  139. package/src/queryParams.ts +2 -1
  140. package/src/relayer.ts +11 -11
  141. package/src/sequenceWallet.ts +2 -2
  142. package/src/tokens.ts +7 -1
  143. package/src/trails.ts +3 -3
  144. package/src/transactions.ts +62 -18
  145. package/src/wallets.ts +8 -0
  146. package/src/widget/compiled.css +2 -2
  147. package/src/widget/components/AccountActionsDropdown.tsx +3 -13
  148. package/src/widget/components/AccountIntentTransactionHistoryButton.tsx +22 -0
  149. package/src/widget/components/AccountSettings.tsx +48 -54
  150. package/src/widget/components/ChainFilterDropdown.tsx +24 -3
  151. package/src/widget/components/ClassicSwap.tsx +131 -213
  152. package/src/widget/components/ConnectWallet.tsx +8 -38
  153. package/src/widget/components/ConnectedWallets.tsx +132 -77
  154. package/src/widget/components/DynamicInputStyles.tsx +76 -0
  155. package/src/widget/components/Earn.tsx +82 -593
  156. package/src/widget/components/ErrorAnimationIcon.tsx +130 -0
  157. package/src/widget/components/FeeBreakdown.tsx +155 -0
  158. package/src/widget/components/Fund.tsx +41 -108
  159. package/src/widget/components/FundMethods.tsx +82 -159
  160. package/src/widget/components/FundSwap.tsx +52 -0
  161. package/src/widget/components/FundingMethodSelectorButton.tsx +70 -0
  162. package/src/widget/components/Identicon.tsx +164 -95
  163. package/src/widget/components/MeshConnectExchanges.tsx +2 -15
  164. package/src/widget/components/Modal.tsx +0 -8
  165. package/src/widget/components/Pay.tsx +214 -237
  166. package/src/widget/components/PercentageMaxButtons.tsx +77 -0
  167. package/src/widget/components/PoolDeposit.tsx +569 -0
  168. package/src/widget/components/PoolWithdraw.tsx +884 -0
  169. package/src/widget/components/PriceImpactWarning.tsx +1 -1
  170. package/src/widget/components/QuoteDetails.tsx +43 -12
  171. package/src/widget/components/Receipt.tsx +16 -2
  172. package/src/widget/components/Receive.tsx +0 -2
  173. package/src/widget/components/RecipientSelectorButton.tsx +44 -0
  174. package/src/widget/components/Recipients.tsx +63 -157
  175. package/src/widget/components/RequiredPropsError.tsx +33 -0
  176. package/src/widget/components/ScreenHeader.tsx +62 -34
  177. package/src/widget/components/SlippageToleranceSettings.tsx +2 -1
  178. package/src/widget/components/Swap.tsx +4 -45
  179. package/src/widget/components/SwapSettings.tsx +2 -14
  180. package/src/widget/components/ThemeProvider.tsx +2 -1
  181. package/src/widget/components/TokenDisplayNonSelectable.tsx +40 -0
  182. package/src/widget/components/TokenImage.tsx +22 -5
  183. package/src/widget/components/TokenList.tsx +0 -1
  184. package/src/widget/components/TokenSelector.tsx +63 -53
  185. package/src/widget/components/TokenSelectorButton.tsx +98 -0
  186. package/src/widget/components/Tooltip.tsx +51 -0
  187. package/src/widget/components/TransferPendingVertical.tsx +1 -1
  188. package/src/widget/components/UserPreferences.tsx +6 -24
  189. package/src/widget/components/WaasFeeOptions.tsx +450 -0
  190. package/src/widget/components/WalletConfirmation.tsx +76 -14
  191. package/src/widget/components/WalletConnect.tsx +93 -29
  192. package/src/widget/components/WalletList.tsx +4 -2
  193. package/src/widget/hooks/useBack.tsx +2 -0
  194. package/src/widget/hooks/useCheckout.ts +36 -20
  195. package/src/widget/hooks/useCurrentScreen.tsx +1 -0
  196. package/src/widget/hooks/useDefaultTokenSelection.tsx +104 -28
  197. package/src/widget/hooks/usePayMessage.tsx +86 -11
  198. package/src/widget/hooks/useQuote.ts +413 -0
  199. package/src/widget/hooks/useSelectedFundMethod.tsx +41 -0
  200. package/src/widget/hooks/useSelectedRecipient.tsx +10 -0
  201. package/src/widget/hooks/useSendForm.ts +32 -6
  202. package/src/widget/index.css +27 -0
  203. package/src/widget/widget.tsx +326 -283
  204. package/dist/widget/components/FundSendForm.d.ts.map +0 -1
  205. package/dist/widget/components/PaySendForm.d.ts.map +0 -1
  206. package/dist/widget/components/SimpleSwap.d.ts.map +0 -1
  207. package/dist/widget/hooks/useSwapSettings.d.ts +0 -16
  208. package/dist/widget/hooks/useSwapSettings.d.ts.map +0 -1
  209. package/src/widget/components/FundSendForm.tsx +0 -903
  210. package/src/widget/components/PaySendForm.tsx +0 -869
  211. package/src/widget/components/SimpleSwap.tsx +0 -983
  212. package/src/widget/hooks/useSwapSettings.tsx +0 -100
package/dist/index.js CHANGED
@@ -1,122 +1,328 @@
1
- import { u as bn, a as En, l as t, c as Pe, f as Pn, b as B, S as xe, d as Me, e as xn, h as Mn, i as ce, q as On, j as Rn, k as Oe } from "./index-BNWCIGfQ.js";
2
- import { O as zn, T as Yn, ad as Jn, af as Xn, v as Zn, ae as et, U as nt, m as tt, D as st, A as it, r as at, aa as ot, E as rt, F as ct, s as lt, z as dt, R as ut, ab as gt, P as mt, W as ft, Z as ht, Y as It, a3 as pt, V as vt, a8 as Tt, o as Ct, K as St, X as At, ac as yt, N as wt, a6 as kt, x as bt, Q as Et, w as Pt, a9 as xt, $ as Mt, a4 as Ot, a1 as Rt, a2 as qt, _ as $t, a7 as Nt, a0 as Ft, a5 as Ut, n as Ht, G as Dt, B as Bt, H as jt, I as Gt, t as Lt, C as _t, y as Wt, p as Qt, L as Vt, J as Kt, M as zt } from "./index-BNWCIGfQ.js";
3
- import { useMutation as Se, useQuery as qn } from "@tanstack/react-query";
4
- import { useState as c, useCallback as Re, useEffect as b, useMemo as $n, useRef as qe } from "react";
5
- import { isAddressEqual as ee, zeroAddress as $e, isAddress as Nn, createPublicClient as Ne, http as Fe, createWalletClient as Ue, custom as He } from "viem";
6
- import { useSwitchChain as Fn, useSendTransaction as Un, useEstimateGas as Hn, useWaitForTransactionReceipt as Dn } from "wagmi";
7
- const De = 1e4;
8
- function Qn(Be) {
1
+ import { u as qn, a as Ze, b as en, c as On, d as Rn, l as t, g as Un, T as Dn, p as Fn, e as je, f as Hn, h as Fe, i as $n, j as Ge, k as Nn, m as ae, S as Qe, n as _e, q as Bn, r as Ln, s as Ce, t as jn, v as Gn, w as We } from "./index-BnhdZ8Ho.js";
2
+ import { U as it, ag as rt, ai as ct, C as lt, ah as dt, Y as ut, x as gt, I as mt, F as ft, A as ht, ad as pt, J as It, K as vt, B as Tt, E as Ct, X as St, ae as yt, V as At, _ as wt, a0 as bt, a6 as kt, Z as Et, ab as Pt, y as xt, P as Mt, $ as qt, af as Ot, R as Rt, a9 as Ut, W as Dt, D as Ft, ac as Ht, a2 as $t, a7 as Nt, a4 as Bt, a5 as Lt, a1 as jt, aa as Gt, a3 as Qt, a8 as _t, L as Wt, G as Vt, M as Kt, N as zt, H as Xt, z as Yt, O as Jt, Q as Zt } from "./index-BnhdZ8Ho.js";
3
+ import { useQuery as nn, useMutation as He } from "@tanstack/react-query";
4
+ import { useRef as $e, useState as d, useCallback as Ve, useEffect as F, useMemo as Qn } from "react";
5
+ import { zeroAddress as Ne, isAddressEqual as me, isAddress as _n, createPublicClient as Ke, http as ze, createWalletClient as Xe, custom as Ye } from "viem";
6
+ import { useSwitchChain as Wn, useSendTransaction as Vn, useEstimateGas as Kn, useWaitForTransactionReceipt as zn } from "wagmi";
7
+ function tt({
8
+ walletClient: K,
9
+ fromTokenAddress: c,
10
+ fromChainId: k,
11
+ toTokenAddress: H,
12
+ toChainId: P,
13
+ swapAmount: T,
14
+ tradeType: x,
15
+ toRecipient: q,
16
+ toCalldata: Z,
17
+ slippageTolerance: ee,
18
+ onStatusUpdate: z,
19
+ quoteProvider: ie,
20
+ gasless: u,
21
+ paymasterUrl: $,
22
+ selectedFeeToken: A,
23
+ relayerEnv: N,
24
+ nodeGatewayEnv: C,
25
+ abortSignal: O
26
+ } = {}) {
27
+ C && (globalThis.__testNodeGatewayEnv = C);
28
+ const h = $e(new AbortController()), X = O ? (() => {
29
+ const S = new AbortController();
30
+ return O.addEventListener("abort", () => {
31
+ S.abort(), h.current?.abort();
32
+ }), h.current?.signal.addEventListener("abort", () => {
33
+ S.abort();
34
+ }), S.signal;
35
+ })() : h.current.signal, I = qn(), ne = Ze(), { getRelayer: R } = en({
36
+ env: N || $n()
37
+ }), U = On(), { supportedTokens: fe } = Rn(), { data: B, isLoading: L, error: Y, refetch: Se } = nn({
38
+ queryKey: [
39
+ "quote",
40
+ c,
41
+ k,
42
+ H,
43
+ P,
44
+ T?.toString(),
45
+ q,
46
+ Z,
47
+ x,
48
+ ee,
49
+ ie
50
+ ],
51
+ queryFn: async () => {
52
+ try {
53
+ if (h.current.signal.aborted && (t.console.log(
54
+ "[trails-sdk] Resetting aborted controller for new query"
55
+ ), h.current = new AbortController()), !K || !I || !ne || !c || !H || !T || !q || !k || !P || !U)
56
+ return null;
57
+ const { balances: S } = await Un({
58
+ account: K.account.address,
59
+ indexerGatewayClient: U,
60
+ apiClient: I
61
+ }), J = S.find(
62
+ (g) => g.chainId === k && (g.contractAddress?.toLowerCase() === c.toLowerCase() || !g.contractAddress && c === Ne)
63
+ )?.balance ?? "0", ye = R(P), he = R(k), j = fe?.find(
64
+ (g) => g.contractAddress?.toLowerCase() === c?.toLowerCase() && g.chainId === k
65
+ ), G = fe?.find(
66
+ (g) => g.contractAddress?.toLowerCase() === H?.toLowerCase() && g.chainId === P
67
+ ), re = j?.decimals;
68
+ if (!re)
69
+ throw t.console.error(
70
+ "[trails-sdk] [useQuote] Missing source token decimals:",
71
+ {
72
+ originToken: j,
73
+ fromTokenAddress: c,
74
+ fromChainId: k
75
+ }
76
+ ), new Error("Source token decimals not found");
77
+ const Q = G?.decimals;
78
+ if (!Q)
79
+ throw t.console.error(
80
+ "[trails-sdk] Missing destination token decimals:",
81
+ {
82
+ destinationToken: G,
83
+ toTokenAddress: H,
84
+ toChainId: P
85
+ }
86
+ ), new Error("Destination token decimals not found");
87
+ const Ae = G?.symbol ?? "", we = j?.symbol ?? "", _ = {
88
+ account: K.account,
89
+ originTokenAddress: c,
90
+ originChainId: k,
91
+ originTokenBalance: J,
92
+ destinationChainId: P,
93
+ recipient: q,
94
+ destinationTokenAddress: H,
95
+ swapAmount: T.toString(),
96
+ tradeType: x ?? Dn.EXACT_OUTPUT,
97
+ originTokenSymbol: we,
98
+ destinationTokenSymbol: Ae,
99
+ destinationCalldata: Z,
100
+ client: K,
101
+ apiClient: I,
102
+ trailsClient: ne,
103
+ originRelayer: he,
104
+ destinationRelayer: ye,
105
+ sourceTokenDecimals: re,
106
+ destinationTokenDecimals: Q,
107
+ fee: "0",
108
+ dryMode: !1,
109
+ onTransactionStateChange: z ?? (() => {
110
+ }),
111
+ slippageTolerance: ee?.toString(),
112
+ quoteProvider: ie,
113
+ gasless: u ?? !1,
114
+ paymasterUrl: $,
115
+ selectedFeeToken: A ?? void 0,
116
+ abortSignal: X
117
+ };
118
+ t.console.log("[trails-sdk] options", _);
119
+ const { quote: r, send: be } = await Fn(_);
120
+ return {
121
+ quote: {
122
+ fromAmount: r.originAmount,
123
+ toAmount: r.destinationAmount,
124
+ fromAmountMin: r.originAmountMin,
125
+ toAmountMin: r.destinationAmountMin,
126
+ originToken: r.originToken,
127
+ destinationToken: r.destinationToken,
128
+ originChain: r.originChain,
129
+ destinationChain: r.destinationChain,
130
+ fees: r.fees,
131
+ priceImpact: r.priceImpact,
132
+ completionEstimateSeconds: r.completionEstimateSeconds,
133
+ slippageTolerance: r.slippageTolerance,
134
+ transactionStates: r.transactionStates,
135
+ originTokenRate: r.originTokenRate,
136
+ destinationTokenRate: r.destinationTokenRate,
137
+ quoteProvider: r.quoteProvider,
138
+ fromAmountUsdDisplay: r.originAmountUsdDisplay ?? void 0,
139
+ toAmountUsdDisplay: r.destinationAmountUsdDisplay ?? void 0,
140
+ gasCostUsd: r.gasCostUsd ?? void 0,
141
+ gasCostUsdDisplay: r.gasCostUsdDisplay ?? void 0,
142
+ gasCost: r.gasCost ?? void 0,
143
+ gasCostFormatted: r.gasCostFormatted ?? void 0
144
+ },
145
+ swap: async () => {
146
+ const {
147
+ originUserTxReceipt: g,
148
+ destinationMetaTxnReceipt: ce,
149
+ totalCompletionSeconds: W
150
+ } = await be({
151
+ selectedFeeToken: A ?? void 0
152
+ });
153
+ return {
154
+ originTransaction: {
155
+ transactionHash: g?.transactionHash,
156
+ explorerUrl: je({
157
+ txHash: g?.transactionHash,
158
+ chainId: k
159
+ }),
160
+ receipt: g
161
+ },
162
+ destinationTransaction: {
163
+ transactionHash: ce?.txnHash,
164
+ explorerUrl: je({
165
+ txHash: ce?.txnHash,
166
+ chainId: P
167
+ }),
168
+ receipt: ce
169
+ },
170
+ totalCompletionSeconds: W
171
+ };
172
+ }
173
+ };
174
+ } catch (S) {
175
+ throw t.console.error(
176
+ "[trails-sdk] [useQuote] Error getting quote:",
177
+ S
178
+ ), Hn(S);
179
+ }
180
+ },
181
+ // Prevent unnecessary refetching
182
+ enabled: !!(K && I && c && H && T && q && k && P && U),
183
+ staleTime: 30 * 1e3,
184
+ // Consider data fresh for 30 seconds
185
+ refetchOnWindowFocus: !1,
186
+ // Don't refetch when window regains focus
187
+ refetchOnMount: !1,
188
+ // Don't refetch on component remount if data exists
189
+ refetchInterval: !1,
190
+ // Disable automatic polling
191
+ retry: 2,
192
+ // Limit retry attempts
193
+ refetchOnReconnect: !0
194
+ // Refetch when network reconnects
195
+ });
196
+ return {
197
+ quote: B?.quote || null,
198
+ swap: B?.swap || null,
199
+ isLoadingQuote: L,
200
+ quoteError: Y,
201
+ refetchQuote: () => Se(),
202
+ abort: () => {
203
+ t.console.log("[trails-sdk] useQuote abort() called"), t.console.log(
204
+ "[trails-sdk] Active operations before abort:",
205
+ Fe.getAll()
206
+ ), h.current.abort(), Fe.abortAll(), t.console.log(
207
+ "[trails-sdk] Abort completed, active operations:",
208
+ Fe.getAll()
209
+ );
210
+ }
211
+ };
212
+ }
213
+ const Je = 1e4;
214
+ function st(K) {
9
215
  const {
10
- account: d,
11
- disableAutoExecute: je = !1,
12
- env: Ge,
13
- sequenceProjectAccessKey: Le
14
- } = Be, S = bn({
15
- projectAccessKey: Le
16
- }), [x, ne] = c(!je), [le, de] = c(!1), [j, Ae] = c(
216
+ account: c,
217
+ disableAutoExecute: k = !1,
218
+ env: H,
219
+ sequenceProjectAccessKey: P
220
+ } = K, T = Ze({
221
+ projectAccessKey: P
222
+ }), [x, q] = d(!k), [Z, ee] = d(!1), [z, ie] = d(
17
223
  {}
18
- ), [u, O] = c(null), [y, R] = c(null), [v, q] = c(null), [A, G] = c(null), [T, ue] = c(), [$, L] = c(null), [
19
- _e,
20
- _
21
- ] = c(null), [N, W] = c(
224
+ ), [u, $] = d(null), [A, N] = d(null), [C, O] = d(null), [h, X] = d(null), [I, ne] = d(), [R, U] = d(null), [
225
+ fe,
226
+ B
227
+ ] = d(null), [L, Y] = d(
22
228
  null
23
- ), [We, Q] = c(null), [i, V] = c(null), [Qe, ye] = c({}), [te, se] = c(!1), [we, K] = c(!1), {
24
- switchChain: Ve,
25
- isPending: Ke,
26
- error: z
27
- } = Fn(), E = Un(), [ze, ke] = c(!1), [w, M] = c(null), [Ye, F] = c(null), [ge, Y] = c({}), [Je, ie] = c(null), { getRelayer: me, relayers: Xe } = En({
28
- env: Ge
229
+ ), [Se, S] = d(null), [o, J] = d(null), [ye, he] = d({}), [j, G] = d(!1), [re, Q] = d(!1), {
230
+ switchChain: Ae,
231
+ isPending: we,
232
+ error: _
233
+ } = Wn(), r = Vn(), [be, ke] = d(!1), [M, g] = d(null), [ce, W] = d(null), [Ee, le] = d({}), [tn, pe] = d(null), { getRelayer: Pe, relayers: sn } = en({
234
+ env: H
29
235
  }), {
30
- data: ae,
31
- isError: fe,
32
- error: he
33
- } = Hn(
34
- i?.to && i?.chainId && !i.error ? {
35
- to: i.to || void 0,
36
- data: i.data || void 0,
37
- value: i.value || void 0,
38
- chainId: i.chainId || void 0
236
+ data: Ie,
237
+ isError: xe,
238
+ error: Me
239
+ } = Kn(
240
+ o?.to && o?.chainId && !o.error ? {
241
+ to: o.to || void 0,
242
+ data: o.data || void 0,
243
+ value: o.value || void 0,
244
+ chainId: o.chainId || void 0
39
245
  } : void 0
40
- ), I = Se({
246
+ ), w = He({
41
247
  mutationFn: async (e) => {
42
248
  if (t.console.log(
43
249
  "[useTrails] commitIntentConfigMutation started with args:",
44
250
  e
45
- ), !S)
251
+ ), !T)
46
252
  throw t.console.error("[useTrails] API client not available"), new Error("API client not available");
47
253
  if (!e.quoteProvider)
48
254
  throw t.console.error("[useTrails] quoteProvider is required"), new Error("quoteProvider is required");
49
255
  try {
50
256
  t.console.log("[useTrails] Calculating intent address..."), t.console.log("[useTrails] Main signer:", e.mainSignerAddress), t.console.log("[useTrails] Calls:", e.calls);
51
- const n = g.variables?.params.originChainId, a = g.variables?.params.destinationChainId;
257
+ const n = f.variables?.params.originChainId, a = f.variables?.params.destinationChainId;
52
258
  if (!n || !a)
53
259
  throw t.console.error(
54
260
  "[useTrails] Could not determine origin/destination chain IDs for verification."
55
261
  ), new Error(
56
262
  "Could not determine origin/destination chain IDs for verification."
57
263
  );
58
- const { originIntentAddress: l, destinationIntentAddress: s } = Pe(
264
+ const { originIntentAddress: m, destinationIntentAddress: s } = Ge(
59
265
  e.mainSignerAddress,
60
266
  e.calls
61
267
  ), {
62
- originAddress: r,
63
- destinationAddress: f
64
- } = Pn(
268
+ originAddress: l,
269
+ destinationAddress: v
270
+ } = Nn(
65
271
  e.preconditions,
66
272
  n,
67
273
  a
68
274
  );
69
275
  t.console.log("[useTrails] Verification addresses:", {
70
- calculatedOrigin: l.toString(),
276
+ calculatedOrigin: m.toString(),
71
277
  calculatedDestination: s.toString(),
72
- preconditionOrigin: r,
73
- preconditionDestination: f
278
+ preconditionOrigin: l,
279
+ preconditionDestination: v
74
280
  });
75
- const m = !!r && ee(
76
- B(r),
77
- l
281
+ const p = !!l && me(
282
+ ae(l),
283
+ m
78
284
  );
79
- t.console.log("[useTrails] Origin verified:", m);
80
- const o = f && ee(
81
- B(f),
285
+ t.console.log("[useTrails] Origin verified:", p);
286
+ const i = v && me(
287
+ ae(v),
82
288
  s
83
- ) || !f && n === a && ee(s, $e);
289
+ ) || !v && n === a && me(s, Ne);
84
290
  t.console.log(
85
291
  "[useTrails] Destination verified:",
86
- o
292
+ i
87
293
  );
88
- const h = m && o;
89
- if (ie({
90
- success: h,
91
- receivedOriginAddress: r,
92
- receivedDestinationAddress: f,
93
- calculatedOriginAddress: l.toString(),
294
+ const y = p && i;
295
+ if (pe({
296
+ success: y,
297
+ receivedOriginAddress: l,
298
+ receivedDestinationAddress: v,
299
+ calculatedOriginAddress: m.toString(),
94
300
  calculatedDestinationAddress: s.toString()
95
- }), !h)
301
+ }), !y)
96
302
  throw t.console.error("[useTrails] Address verification failed.", {
97
- isOriginVerified: m,
98
- isDestinationVerified: o
303
+ isOriginVerified: p,
304
+ isDestinationVerified: i
99
305
  }), new Error(
100
- `Address verification failed. Origin verified: ${m}, Destination verified: ${o}`
306
+ `Address verification failed. Origin verified: ${p}, Destination verified: ${i}`
101
307
  );
102
308
  t.console.log("[useTrails] Committing intent config to API...");
103
- const p = await S.commitIntentConfig({
309
+ const b = await T.commitIntentConfig({
104
310
  params: {
105
- originIntentAddress: l.toString(),
311
+ originIntentAddress: m.toString(),
106
312
  destinationIntentAddress: s.toString(),
107
313
  mainSigner: e.mainSignerAddress,
108
314
  calls: e.calls,
109
315
  preconditions: e.preconditions,
110
316
  addressOverrides: {
111
- ...xe,
317
+ ...Qe,
112
318
  ...e.addressOverrides
113
319
  }
114
320
  }
115
321
  });
116
- return t.console.log("[useTrails] API Commit Response:", p), {
117
- originIntentAddress: l.toString(),
322
+ return t.console.log("[useTrails] API Commit Response:", b), {
323
+ originIntentAddress: m.toString(),
118
324
  destinationIntentAddress: s.toString(),
119
- response: p
325
+ response: b
120
326
  };
121
327
  } catch (n) {
122
328
  throw console.error("[useTrails] Error during commit intent mutation:", n), n;
@@ -129,96 +335,96 @@ function Qn(Be) {
129
335
  ), t.console.log(
130
336
  "[useTrails] Setting committedOriginIntentAddress:",
131
337
  e.originIntentAddress
132
- ), L(e.originIntentAddress), _(e.destinationIntentAddress);
338
+ ), U(e.originIntentAddress), B(e.destinationIntentAddress);
133
339
  },
134
340
  onError: (e) => {
135
- t.console.error("[useTrails] Failed to commit intent config:", e), L(null), _(null);
341
+ t.console.error("[useTrails] Failed to commit intent config:", e), U(null), B(null);
136
342
  }
137
343
  }), {
138
- data: Ze,
139
- isLoading: en,
140
- error: nn
141
- } = qn({
142
- queryKey: ["getIntentConfig", $],
344
+ data: on,
345
+ isLoading: an,
346
+ error: rn
347
+ } = nn({
348
+ queryKey: ["getIntentConfig", R],
143
349
  queryFn: async () => {
144
- if (!S || !$)
350
+ if (!T || !R)
145
351
  throw new Error("API client or committed intent address not available");
146
352
  return t.console.log(
147
353
  "Fetching intent config for address:",
148
- $
149
- ), await S.getIntentConfig({
150
- intentAddress: $
354
+ R
355
+ ), await T.getIntentConfig({
356
+ intentAddress: R
151
357
  });
152
358
  },
153
- enabled: !!$ && !!S && I.isSuccess,
359
+ enabled: !!R && !!T && w.isSuccess,
154
360
  staleTime: 1e3 * 60 * 5,
155
361
  // 5 minutes
156
362
  retry: 1
157
363
  });
158
- async function be(e) {
159
- return Rn(S, {
364
+ async function Be(e) {
365
+ return Gn(T, {
160
366
  params: {
161
367
  ...e.params,
162
368
  addressOverrides: {
163
- ...xe,
369
+ ...Qe,
164
370
  ...e.params.addressOverrides
165
371
  }
166
372
  }
167
373
  });
168
374
  }
169
- const g = Se({
375
+ const f = He({
170
376
  mutationFn: async (e) => {
171
- if (e.params.originChainId === e.params.destinationChainId && ee(
172
- B(e.params.originTokenAddress),
173
- B(e.params.destinationTokenAddress)
377
+ if (e.params.originChainId === e.params.destinationChainId && me(
378
+ ae(e.params.originTokenAddress),
379
+ ae(e.params.destinationTokenAddress)
174
380
  ))
175
381
  throw new Error(
176
382
  "The same token cannot be used as both the source and destination token."
177
383
  );
178
- if (!d.address)
384
+ if (!c.address)
179
385
  throw new Error("Missing selected token or account address");
180
- L(null), _(null), ie(null), G(null), O(null), R(null), q(null), W(null), Q(null);
181
- const n = await be(e);
182
- return O(n.payloads.metaTxns), R(n.payloads.calls), q(n.payloads.preconditions), G(n.payloads.trailsFee), W(n.payloads.originIntentAddress), Q(n.payloads.destinationIntentAddress), L(null), _(null), ie(null), n;
386
+ U(null), B(null), pe(null), X(null), $(null), N(null), O(null), Y(null), S(null);
387
+ const n = await Be(e);
388
+ return $(n.payloads.metaTxns), N(n.payloads.calls), O(n.payloads.preconditions), X(n.payloads.trailsFee), Y(n.payloads.originIntentAddress), S(n.payloads.destinationIntentAddress), U(null), B(null), pe(null), n;
183
389
  },
184
390
  onSuccess: (e) => {
185
- t.console.log("Intent Config Success:", e), G(e.payloads.trailsFee || null), W(e.payloads.originIntentAddress), Q(e.payloads.destinationIntentAddress), e.payloads?.calls && e.payloads.calls.length > 0 && e.payloads.preconditions && e.payloads.preconditions.length > 0 && e.payloads.metaTxns && e.payloads.metaTxns.length > 0 ? (R(e.payloads.calls), q(e.payloads.preconditions), O(e.payloads.metaTxns)) : (t.console.warn("API returned success but no operations found."), R(null), q(null), O(null));
391
+ t.console.log("Intent Config Success:", e), X(e.payloads.trailsFee || null), Y(e.payloads.originIntentAddress), S(e.payloads.destinationIntentAddress), e.payloads?.calls && e.payloads.calls.length > 0 && e.payloads.preconditions && e.payloads.preconditions.length > 0 && e.payloads.metaTxns && e.payloads.metaTxns.length > 0 ? (N(e.payloads.calls), O(e.payloads.preconditions), $(e.payloads.metaTxns)) : (t.console.warn("API returned success but no operations found."), N(null), O(null), $(null));
186
392
  },
187
393
  onError: (e) => {
188
- console.error("Intent Config Error:", e), R(null), q(null), O(null), G(null), W(null), Q(null);
394
+ console.error("Intent Config Error:", e), N(null), O(null), $(null), X(null), Y(null), S(null);
189
395
  }
190
396
  });
191
- function tn(e) {
192
- g.mutate(e);
397
+ function cn(e) {
398
+ f.mutate(e);
193
399
  }
194
- const sn = Re(() => {
195
- t.console.log("[Trails] Clearing intent state"), R(null), q(null), O(null), G(null), L(null), _(null), ie(null), W(null), Q(null), ye({}), de(!1), Y({});
196
- }, []), k = Re(
197
- (e, n, a, l, s) => {
198
- M({
400
+ const ln = Ve(() => {
401
+ t.console.log("[Trails] Clearing intent state"), N(null), O(null), $(null), X(null), U(null), B(null), pe(null), Y(null), S(null), he({}), ee(!1), le({});
402
+ }, []), D = Ve(
403
+ (e, n, a, m, s) => {
404
+ g({
199
405
  txnHash: e,
200
406
  status: n === "success" ? "Success" : n === "reverted" ? "Failed" : n === "sending" ? "Sending..." : "Pending",
201
407
  revertReason: n === "reverted" ? s || "Transaction reverted" : void 0,
202
408
  gasUsed: a ? Number(a) : void 0,
203
- effectiveGasPrice: l?.toString()
409
+ effectiveGasPrice: m?.toString()
204
410
  });
205
411
  },
206
412
  []
207
- ), an = async () => {
413
+ ), dn = async () => {
208
414
  if (t.console.log("Sending origin transaction..."), t.console.log(
209
- te,
210
- i,
211
- i?.error,
212
- i?.to,
213
- i?.data,
214
- i?.value,
215
- i?.chainId
216
- ), te || // Prevent duplicate transactions
217
- !i || i.error || !i.to || i.data === null || i.value === null || i.chainId === null) {
415
+ j,
416
+ o,
417
+ o?.error,
418
+ o?.to,
419
+ o?.data,
420
+ o?.value,
421
+ o?.chainId
422
+ ), j || // Prevent duplicate transactions
423
+ !o || o.error || !o.to || o.data === null || o.value === null || o.chainId === null) {
218
424
  t.console.error(
219
425
  "Origin call parameters not available or invalid:",
220
- i
221
- ), k(
426
+ o
427
+ ), D(
222
428
  void 0,
223
429
  "reverted",
224
430
  void 0,
@@ -227,102 +433,102 @@ function Qn(Be) {
227
433
  );
228
434
  return;
229
435
  }
230
- if (d.chainId !== i.chainId) {
231
- K(!0), k(
436
+ if (c.chainId !== o.chainId) {
437
+ Q(!0), D(
232
438
  void 0,
233
439
  "pending",
234
440
  void 0,
235
441
  void 0,
236
- `Switching to chain ${i.chainId}...`
442
+ `Switching to chain ${o.chainId}...`
237
443
  );
238
- const e = Ue({
239
- chain: ce(i.chainId),
240
- transport: He(await d.connector.getProvider())
444
+ const e = Xe({
445
+ chain: Ce(o.chainId),
446
+ transport: Ye(await c.connector.getProvider())
241
447
  // TODO: Add proper type
242
448
  });
243
449
  try {
244
- await Oe({
450
+ await We({
245
451
  walletClient: e,
246
- desiredChainId: i.chainId
247
- }), K(!1);
452
+ desiredChainId: o.chainId
453
+ }), Q(!1);
248
454
  } catch (n) {
249
- t.console.error("Chain switch failed:", n), n instanceof Error && n.message.includes("User rejected") && ne(!1), k(
455
+ t.console.error("Chain switch failed:", n), n instanceof Error && n.message.includes("User rejected") && q(!1), D(
250
456
  void 0,
251
457
  "reverted",
252
458
  void 0,
253
459
  void 0,
254
460
  n instanceof Error ? n.message : "Unknown error switching chain"
255
- ), K(!1);
461
+ ), Q(!1);
256
462
  return;
257
463
  }
258
464
  }
259
- if (te)
465
+ if (j)
260
466
  t.console.warn(
261
467
  "Transaction already in progress. Skipping duplicate request."
262
468
  );
263
469
  else {
264
- if (se(!0), ue(void 0), k(void 0, "sending"), !ae && !fe) {
470
+ if (G(!0), ne(void 0), D(void 0, "sending"), !Ie && !xe) {
265
471
  ke(!0);
266
472
  return;
267
473
  }
268
- if (fe) {
269
- t.console.error("Gas estimation failed:", he), k(
474
+ if (xe) {
475
+ t.console.error("Gas estimation failed:", Me), D(
270
476
  void 0,
271
477
  "reverted",
272
478
  void 0,
273
479
  void 0,
274
- `Gas estimation failed: ${he?.message}`
275
- ), se(!1);
480
+ `Gas estimation failed: ${Me?.message}`
481
+ ), G(!1);
276
482
  return;
277
483
  }
278
- const e = ae ? BigInt(Math.floor(Number(ae) * 1.2)) : void 0;
279
- E.sendTransaction(
484
+ const e = Ie ? BigInt(Math.floor(Number(Ie) * 1.2)) : void 0;
485
+ r.sendTransaction(
280
486
  {
281
- to: i.to,
282
- data: i.data,
283
- value: i.value,
284
- chainId: i.chainId,
487
+ to: o.to,
488
+ data: o.data,
489
+ value: o.value,
490
+ chainId: o.chainId,
285
491
  gas: e
286
492
  },
287
493
  {
288
494
  onSuccess: (n) => {
289
- t.console.log("Transaction sent, hash:", n), ue(n), se(!1);
495
+ t.console.log("Transaction sent, hash:", n), ne(n), G(!1);
290
496
  },
291
497
  onError: (n) => {
292
- t.console.error("Transaction failed:", n), n instanceof Error && (n.message.includes("User rejected") || n.message.includes("user rejected")) && ne(!1), k(
498
+ t.console.error("Transaction failed:", n), n instanceof Error && (n.message.includes("User rejected") || n.message.includes("user rejected")) && q(!1), D(
293
499
  void 0,
294
500
  "reverted",
295
501
  void 0,
296
502
  void 0,
297
503
  n instanceof Error ? n.message : "Unknown error"
298
- ), se(!1);
504
+ ), G(!1);
299
505
  }
300
506
  }
301
507
  );
302
508
  }
303
509
  };
304
- b(() => {
305
- z && (t.console.error("Chain switch error:", z), k(
510
+ F(() => {
511
+ _ && (t.console.error("Chain switch error:", _), D(
306
512
  void 0,
307
513
  "reverted",
308
514
  void 0,
309
515
  void 0,
310
- `Chain switch failed: ${z.message || "Unknown error"}`
311
- ), K(!1));
312
- }, [z, k]), b(() => {
516
+ `Chain switch failed: ${_.message || "Unknown error"}`
517
+ ), Q(!1));
518
+ }, [_, D]), F(() => {
313
519
  ke(!1);
314
- }, []), b(() => {
315
- i?.chainId && d.chainId === i.chainId && (t.console.log("No chain switch required"), K(!1));
316
- }, [d.chainId, i?.chainId]), b(() => {
317
- if (i?.chainId && d.chainId !== i.chainId) {
520
+ }, []), F(() => {
521
+ o?.chainId && c.chainId === o.chainId && (t.console.log("No chain switch required"), Q(!1));
522
+ }, [c.chainId, o?.chainId]), F(() => {
523
+ if (o?.chainId && c.chainId !== o.chainId) {
318
524
  async function e() {
319
525
  try {
320
- const n = i.chainId, a = Ue({
321
- chain: ce(n),
322
- transport: He(await d.connector.getProvider())
526
+ const n = o.chainId, a = Xe({
527
+ chain: Ce(n),
528
+ transport: Ye(await c.connector.getProvider())
323
529
  // TODO: Add proper type
324
530
  });
325
- await Oe({
531
+ await We({
326
532
  walletClient: a,
327
533
  desiredChainId: n
328
534
  });
@@ -332,159 +538,159 @@ function Qn(Be) {
332
538
  }
333
539
  e().catch(t.console.error);
334
540
  }
335
- }, [d, i]);
541
+ }, [c, o]);
336
542
  const {
337
- data: C,
338
- isLoading: U,
339
- isSuccess: Ie,
340
- isError: pe,
341
- error: oe
342
- } = Dn({
343
- hash: T,
543
+ data: E,
544
+ isLoading: te,
545
+ isSuccess: qe,
546
+ isError: Oe,
547
+ error: ve
548
+ } = zn({
549
+ hash: I,
344
550
  confirmations: 1,
345
551
  query: {
346
- enabled: !!T
552
+ enabled: !!I
347
553
  }
348
554
  });
349
- b(() => {
350
- if (!T) {
351
- w?.txnHash && M(null), F(null), Object.keys(j).length > 0 && Ae({});
555
+ F(() => {
556
+ if (!I) {
557
+ M?.txnHash && g(null), W(null), Object.keys(z).length > 0 && ie({});
352
558
  return;
353
559
  }
354
- if (!(w?.txnHash === T && (w?.status === "Success" || w?.status === "Failed") && !U)) {
355
- if (U) {
356
- M((e) => ({
357
- ...e?.txnHash === T ? e : {
560
+ if (!(M?.txnHash === I && (M?.status === "Success" || M?.status === "Failed") && !te)) {
561
+ if (te) {
562
+ g((e) => ({
563
+ ...e?.txnHash === I ? e : {
358
564
  gasUsed: void 0,
359
565
  effectiveGasPrice: void 0,
360
566
  revertReason: void 0
361
567
  },
362
- txnHash: T,
568
+ txnHash: I,
363
569
  status: "Pending"
364
570
  }));
365
571
  return;
366
572
  }
367
- if (Ie && C) {
368
- const e = C.status === "success" ? "Success" : "Failed";
369
- M({
370
- txnHash: C.transactionHash,
573
+ if (qe && E) {
574
+ const e = E.status === "success" ? "Success" : "Failed";
575
+ g({
576
+ txnHash: E.transactionHash,
371
577
  status: e,
372
- gasUsed: C.gasUsed ? Number(C.gasUsed) : void 0,
373
- effectiveGasPrice: C.effectiveGasPrice?.toString(),
374
- revertReason: C.status === "reverted" ? oe?.message || "Transaction reverted by receipt" : void 0
375
- }), e === "Success" && C.blockNumber ? (async () => {
578
+ gasUsed: E.gasUsed ? Number(E.gasUsed) : void 0,
579
+ effectiveGasPrice: E.effectiveGasPrice?.toString(),
580
+ revertReason: E.status === "reverted" ? ve?.message || "Transaction reverted by receipt" : void 0
581
+ }), e === "Success" && E.blockNumber ? (async () => {
376
582
  try {
377
- if (!i?.chainId) {
583
+ if (!o?.chainId) {
378
584
  t.console.error(
379
585
  "[Trails] Origin chainId not available for fetching origin block timestamp."
380
- ), F(null);
586
+ ), W(null);
381
587
  return;
382
588
  }
383
- const a = ce(i.chainId), s = await Ne({
589
+ const a = Ce(o.chainId), s = await Ke({
384
590
  chain: a,
385
- transport: Fe()
591
+ transport: ze()
386
592
  }).getBlock({
387
- blockNumber: BigInt(C.blockNumber)
593
+ blockNumber: BigInt(E.blockNumber)
388
594
  });
389
- F(Number(s.timestamp));
595
+ W(Number(s.timestamp));
390
596
  } catch (a) {
391
597
  t.console.error(
392
598
  "[Trails] Error fetching origin block timestamp:",
393
599
  a
394
- ), F(null);
600
+ ), W(null);
395
601
  }
396
- })() : e !== "Success" && F(null), e === "Success" && u && u.length > 0 && x && !u.some((n) => j[`${n.chainId}-${n.id}`]) && (t.console.log(
602
+ })() : e !== "Success" && W(null), e === "Success" && u && u.length > 0 && x && !u.some((n) => z[`${n.chainId}-${n.id}`]) && (t.console.log(
397
603
  "Origin transaction successful, auto-sending all meta transactions..."
398
- ), H.mutate({ selectedId: null }));
399
- } else pe && (M({
400
- txnHash: T,
604
+ ), se.mutate({ selectedId: null }));
605
+ } else Oe && (g({
606
+ txnHash: I,
401
607
  status: "Failed",
402
- revertReason: oe?.message || "Failed to get receipt",
608
+ revertReason: ve?.message || "Failed to get receipt",
403
609
  gasUsed: void 0,
404
610
  effectiveGasPrice: void 0
405
- }), F(null));
611
+ }), W(null));
406
612
  }
407
613
  }, [
408
- T,
409
- U,
410
- Ie,
411
- pe,
412
- C,
413
- oe,
614
+ I,
615
+ te,
616
+ qe,
617
+ Oe,
618
+ E,
619
+ ve,
414
620
  u,
415
- j,
621
+ z,
416
622
  x,
417
- i?.chainId,
418
- w?.status,
419
- w?.txnHash
420
- ]), b(() => {
421
- x && I.isSuccess && i?.chainId && d.chainId === i.chainId && !i.error && i.to && i.data !== null && i.value !== null && !E.isPending && !U && !T && !we && !w && !le && (t.console.log("Auto-executing transaction: All conditions met."), de(!0), M({
623
+ o?.chainId,
624
+ M?.status,
625
+ M?.txnHash
626
+ ]), F(() => {
627
+ x && w.isSuccess && o?.chainId && c.chainId === o.chainId && !o.error && o.to && o.data !== null && o.value !== null && !r.isPending && !te && !I && !re && !M && !Z && (t.console.log("Auto-executing transaction: All conditions met."), ee(!0), g({
422
628
  status: "Sending..."
423
- }), E.sendTransaction(
629
+ }), r.sendTransaction(
424
630
  {
425
- to: i.to,
426
- data: i.data,
427
- value: i.value,
428
- chainId: i.chainId
631
+ to: o.to,
632
+ data: o.data,
633
+ value: o.value,
634
+ chainId: o.chainId
429
635
  },
430
636
  {
431
637
  onSuccess: (n) => {
432
- t.console.log("Auto-executed transaction sent, hash:", n), ue(n);
638
+ t.console.log("Auto-executed transaction sent, hash:", n), ne(n);
433
639
  },
434
640
  onError: (n) => {
435
- t.console.error("Auto-executed transaction failed:", n), n instanceof Error && (n.message.includes("User rejected") || n.message.includes("user rejected")) && ne(!1), M({
641
+ t.console.error("Auto-executed transaction failed:", n), n instanceof Error && (n.message.includes("User rejected") || n.message.includes("user rejected")) && q(!1), g({
436
642
  status: "Failed",
437
643
  revertReason: n instanceof Error ? n.message : "Unknown error"
438
- }), de(!1);
644
+ }), ee(!1);
439
645
  }
440
646
  }
441
647
  ));
442
648
  }, [
443
649
  x,
444
- I.isSuccess,
445
- i,
446
- d.chainId,
447
- E.isPending,
448
- U,
449
- T,
450
- we,
451
- w,
452
- le,
453
- E
454
- ]), b(() => {
455
- x && y && v && A && d.address && N && !I.isPending && !I.isSuccess && (t.console.log("Auto-committing intent configuration..."), I.mutate({
456
- mainSignerAddress: d.address,
457
- calls: y,
458
- preconditions: v,
459
- quoteProvider: A.quoteProvider,
460
- addressOverrides: g.variables?.params.addressOverrides
650
+ w.isSuccess,
651
+ o,
652
+ c.chainId,
653
+ r.isPending,
654
+ te,
655
+ I,
656
+ re,
657
+ M,
658
+ Z,
659
+ r
660
+ ]), F(() => {
661
+ x && A && C && h && c.address && L && !w.isPending && !w.isSuccess && (t.console.log("Auto-committing intent configuration..."), w.mutate({
662
+ mainSignerAddress: c.address,
663
+ calls: A,
664
+ preconditions: C,
665
+ quoteProvider: h.quoteProvider,
666
+ addressOverrides: f.variables?.params.addressOverrides
461
667
  }));
462
668
  }, [
463
669
  x,
464
- y,
465
- v,
466
670
  A,
467
- d.address,
468
- N,
469
- I,
470
- g.variables
671
+ C,
672
+ h,
673
+ c.address,
674
+ L,
675
+ w,
676
+ f.variables
471
677
  ]);
472
- const H = Se({
678
+ const se = He({
473
679
  mutationFn: async ({ selectedId: e }) => {
474
680
  if (t.console.log("[trails-sdk] Starting sendMetaTxn mutation", {
475
681
  selectedId: e,
476
- hasIntentCallsPayloads: !!y,
477
- hasIntentPreconditions: !!v,
682
+ hasIntentCallsPayloads: !!A,
683
+ hasIntentPreconditions: !!C,
478
684
  hasMetaTxns: !!u,
479
- hasAccountAddress: !!d.address,
480
- quoteProvider: A?.quoteProvider
481
- }), !y || !v || !u || !d.address)
685
+ hasAccountAddress: !!c.address,
686
+ quoteProvider: h?.quoteProvider
687
+ }), !A || !C || !u || !c.address)
482
688
  throw new Error("Missing required data for meta-transaction");
483
- if (!A?.quoteProvider)
689
+ if (!h?.quoteProvider)
484
690
  throw new Error("quoteProvider is required");
485
- const n = Me(
486
- d.address,
487
- y
691
+ const n = _e(
692
+ c.address,
693
+ A
488
694
  ), a = e ? [u.find((s) => s.id === e)] : u;
489
695
  if (t.console.log("[trails-sdk] Selected transactions to send", {
490
696
  selectedId: e,
@@ -498,12 +704,12 @@ function Qn(Be) {
498
704
  }))
499
705
  }), !a || e && !a[0])
500
706
  throw new Error("Meta transaction not found");
501
- const l = [];
707
+ const m = [];
502
708
  for (const s of a) {
503
709
  if (!s) continue;
504
- const r = `${s.chainId}-${s.id}`, f = j[r], m = Date.now();
710
+ const l = `${s.chainId}-${s.id}`, v = z[l], p = Date.now();
505
711
  if (t.console.log(
506
- `[trails-sdk] Processing meta transaction ${r}`,
712
+ `[trails-sdk] Processing meta transaction ${l}`,
507
713
  {
508
714
  metaTxnId: s.id,
509
715
  chainId: s.chainId,
@@ -511,93 +717,93 @@ function Qn(Be) {
511
717
  contract: s.contract,
512
718
  intentAddress: n
513
719
  }
514
- ), f && m - f < De) {
515
- const o = Math.ceil(
516
- (De - (m - f)) / 1e3
720
+ ), v && p - v < Je) {
721
+ const i = Math.ceil(
722
+ (Je - (p - v)) / 1e3
517
723
  );
518
724
  t.console.log(
519
- `[trails-sdk] Meta transaction for ${r} was sent recently. Wait ${o}s before retry`,
725
+ `[trails-sdk] Meta transaction for ${l} was sent recently. Wait ${i}s before retry`,
520
726
  {
521
- lastSentTime: f,
522
- now: m,
523
- timeLeft: o
727
+ lastSentTime: v,
728
+ now: p,
729
+ timeLeft: i
524
730
  }
525
731
  );
526
732
  continue;
527
733
  }
528
734
  try {
529
- const o = parseInt(s.chainId, 10);
530
- if (Number.isNaN(o) || o <= 0)
735
+ const i = parseInt(s.chainId, 10);
736
+ if (Number.isNaN(i) || i <= 0)
531
737
  throw t.console.error(
532
738
  "[trails-sdk] Invalid chainId for meta transaction",
533
739
  {
534
- chainId: o,
535
- operationKey: r,
740
+ chainId: i,
741
+ operationKey: l,
536
742
  metaTxn: s
537
743
  }
538
- ), new Error(`Invalid chainId for meta transaction: ${o}`);
539
- const h = me(o);
540
- if (!h)
744
+ ), new Error(`Invalid chainId for meta transaction: ${i}`);
745
+ const y = Pe(i);
746
+ if (!y)
541
747
  throw t.console.error("[trails-sdk] No relayer found for chainId", {
542
- chainId: o,
543
- operationKey: r,
544
- availableRelayers: Array.from(Xe.keys())
545
- }), new Error(`No relayer found for chainId: ${o}`);
546
- const p = v.filter(
547
- (D) => D.chainId && parseInt(D.chainId, 10) === o
748
+ chainId: i,
749
+ operationKey: l,
750
+ availableRelayers: Array.from(sn.keys())
751
+ }), new Error(`No relayer found for chainId: ${i}`);
752
+ const b = C.filter(
753
+ (oe) => oe.chainId && parseInt(oe.chainId, 10) === i
548
754
  );
549
755
  t.console.log(
550
- `[trails-sdk] Relaying meta transaction ${r} to intent ${n} via relayer`,
756
+ `[trails-sdk] Relaying meta transaction ${l} to intent ${n} via relayer`,
551
757
  {
552
- chainId: o,
553
- operationKey: r,
758
+ chainId: i,
759
+ operationKey: l,
554
760
  intentAddress: n,
555
- relayer: !!h,
556
- preconditionsCount: p.length
761
+ relayer: !!y,
762
+ preconditionsCount: b.length
557
763
  }
558
764
  );
559
- const { opHash: Z } = await h.sendMetaTxn(
765
+ const { opHash: ge } = await y.sendMetaTxn(
560
766
  s.walletAddress,
561
767
  s.contract,
562
768
  s.input,
563
769
  Number(s.chainId),
564
770
  void 0,
565
- p
771
+ b
566
772
  );
567
773
  t.console.log(
568
- `[trails-sdk] Successfully sent meta transaction ${r}`,
774
+ `[trails-sdk] Successfully sent meta transaction ${l}`,
569
775
  {
570
- operationKey: r,
571
- opHash: Z,
572
- chainId: o
776
+ operationKey: l,
777
+ opHash: ge,
778
+ chainId: i
573
779
  }
574
780
  );
575
- const re = !1;
576
- l.push({
577
- operationKey: r,
578
- opHash: Z,
781
+ const Te = !1;
782
+ m.push({
783
+ operationKey: l,
784
+ opHash: ge,
579
785
  success: !0
580
786
  });
581
- } catch (o) {
582
- const h = o instanceof Error ? o.message : "Unknown error";
787
+ } catch (i) {
788
+ const y = i instanceof Error ? i.message : "Unknown error";
583
789
  t.console.error(
584
- `[trails-sdk] Failed to send meta transaction ${r}`,
790
+ `[trails-sdk] Failed to send meta transaction ${l}`,
585
791
  {
586
- operationKey: r,
587
- error: h,
792
+ operationKey: l,
793
+ error: y,
588
794
  chainId: s.chainId,
589
795
  metaTxnId: s.id,
590
796
  walletAddress: s.walletAddress,
591
797
  contract: s.contract
592
798
  }
593
- ), l.push({
594
- operationKey: r,
595
- error: h,
799
+ ), m.push({
800
+ operationKey: l,
801
+ error: y,
596
802
  success: !1
597
803
  });
598
804
  }
599
805
  }
600
- return l;
806
+ return m;
601
807
  },
602
808
  onSuccess: (e) => {
603
809
  t.console.log(
@@ -613,11 +819,11 @@ function Qn(Be) {
613
819
  error: n.error || null
614
820
  }))
615
821
  }
616
- ), e.forEach(({ operationKey: n, opHash: a, success: l }) => {
617
- l && a ? (Ae((s) => ({
822
+ ), e.forEach(({ operationKey: n, opHash: a, success: m }) => {
823
+ m && a ? (ie((s) => ({
618
824
  ...s,
619
825
  [n]: Date.now()
620
- })), ye((s) => ({
826
+ })), he((s) => ({
621
827
  ...s,
622
828
  [n]: a
623
829
  }))) : t.console.warn(
@@ -640,57 +846,57 @@ function Qn(Be) {
640
846
  // Allow up to 2 retries
641
847
  retryDelay: (e) => Math.min(1e3 * 2 ** e, 3e4)
642
848
  // Exponential backoff
643
- }), [J, on] = c(null), [X, rn] = c(null);
644
- b(() => {
645
- if (!N || !y?.[0]?.chainId || !J || !X || !v || !d.address) {
646
- V(null);
849
+ }), [de, un] = d(null), [ue, gn] = d(null);
850
+ F(() => {
851
+ if (!L || !A?.[0]?.chainId || !de || !ue || !C || !c.address) {
852
+ J(null);
647
853
  return;
648
854
  }
649
855
  try {
650
- const e = N;
651
- if (!e || !Nn(e)) {
652
- V(null);
856
+ const e = L;
857
+ if (!e || !_n(e)) {
858
+ J(null);
653
859
  return;
654
860
  }
655
- let n, a = "0x", l = 0n;
861
+ let n, a = "0x", m = 0n;
656
862
  const s = e;
657
- if (J === $e) {
658
- const m = v.find(
659
- (o) => (o.type === "transfer-native" || o.type === "native-balance") && o.chainId === X.toString()
863
+ if (de === Ne) {
864
+ const p = C.find(
865
+ (i) => (i.type === "transfer-native" || i.type === "native-balance") && i.chainId === ue.toString()
660
866
  )?.data?.min?.toString();
661
- if (m === void 0)
867
+ if (p === void 0)
662
868
  throw new Error(
663
869
  "Could not find native precondition (transfer-native or native-balance) or min amount"
664
870
  );
665
- l = BigInt(m), n = s;
871
+ m = BigInt(p), n = s;
666
872
  } else {
667
- const m = v.find(
668
- (o) => o.type === "erc20-balance" && o.chainId === X.toString() && o.data?.token && ee(
669
- B(o.data.token),
670
- B(J)
873
+ const p = C.find(
874
+ (i) => i.type === "erc20-balance" && i.chainId === ue.toString() && i.data?.token && me(
875
+ ae(i.data.token),
876
+ ae(de)
671
877
  )
672
878
  )?.data?.min?.toString();
673
- if (m === void 0)
879
+ if (p === void 0)
674
880
  throw new Error(
675
881
  "Could not find ERC20 balance precondition or min amount"
676
882
  );
677
- a = xn({
883
+ a = Bn({
678
884
  recipient: s,
679
- amount: BigInt(m)
680
- }), n = J;
885
+ amount: BigInt(p)
886
+ }), n = de;
681
887
  }
682
- V({
888
+ J({
683
889
  to: n,
684
890
  data: a,
685
- value: l,
686
- chainId: X,
891
+ value: m,
892
+ chainId: ue,
687
893
  error: void 0
688
894
  });
689
895
  } catch (e) {
690
896
  t.console.error(
691
897
  "[trails-sdk] Failed to calculate origin call params for UI:",
692
898
  e
693
- ), V({
899
+ ), J({
694
900
  to: null,
695
901
  data: null,
696
902
  value: null,
@@ -699,55 +905,55 @@ function Qn(Be) {
699
905
  });
700
906
  }
701
907
  }, [
702
- y,
703
- J,
704
- X,
705
- v,
706
- d.address,
707
- N
908
+ A,
909
+ de,
910
+ ue,
911
+ C,
912
+ c.address,
913
+ L
708
914
  ]);
709
- const P = Mn(
915
+ const V = Ln(
710
916
  u,
711
- me
917
+ Pe
712
918
  );
713
- $n(() => !u || Object.keys(P).length === 0 ? "no_statuses" : u.map((n) => `${n.chainId}-${n.id}`).sort().map((n) => {
714
- const a = P[n];
919
+ Qn(() => !u || Object.keys(V).length === 0 ? "no_statuses" : u.map((n) => `${n.chainId}-${n.id}`).sort().map((n) => {
920
+ const a = V[n];
715
921
  return `${n}:${a ? a.status : "loading"}`;
716
- }).join(","), [u, P]);
717
- const ve = qe(/* @__PURE__ */ new Set()), Te = qe(null);
718
- b(() => {
922
+ }).join(","), [u, V]);
923
+ const Re = $e(/* @__PURE__ */ new Set()), Ue = $e(null);
924
+ F(() => {
719
925
  if (t.console.log(
720
926
  "[trails-sdk] Running meta-transaction block timestamp effect:",
721
927
  {
722
928
  metaTxnsLength: u?.length,
723
- monitorStatusesLength: Object.keys(P).length
929
+ monitorStatusesLength: Object.keys(V).length
724
930
  }
725
931
  ), !u || u.length === 0) {
726
932
  t.console.log(
727
933
  "[trails-sdk] No meta transactions, clearing timestamps"
728
- ), ve.current.clear(), Object.keys(ge).length > 0 && Y({});
934
+ ), Re.current.clear(), Object.keys(Ee).length > 0 && le({});
729
935
  return;
730
936
  }
731
- if (!Object.keys(P).length) {
937
+ if (!Object.keys(V).length) {
732
938
  t.console.log("[trails-sdk] No monitor statuses yet, waiting...");
733
939
  return;
734
940
  }
735
941
  u.forEach(async (e, n) => {
736
942
  const a = `${e.chainId}-${e.id}`;
737
- if (ve.current.has(a)) {
943
+ if (Re.current.has(a)) {
738
944
  t.console.log(
739
945
  `[trails-sdk] MetaTxn ${a}: Already processed, skipping`
740
946
  );
741
947
  return;
742
948
  }
743
- const l = P[a];
744
- if (!l || l.status !== "confirmed") {
949
+ const m = V[a];
950
+ if (!m || m.status !== "confirmed") {
745
951
  t.console.log(
746
952
  `[trails-sdk] MetaTxn ${a}: Status not confirmed, skipping`
747
953
  );
748
954
  return;
749
955
  }
750
- const s = l.transactionHash;
956
+ const s = m.transactionHash;
751
957
  if (!s) {
752
958
  t.console.log(
753
959
  `[trails-sdk] MetaTxn ${a}: No transaction hash, skipping`
@@ -756,256 +962,256 @@ function Qn(Be) {
756
962
  }
757
963
  t.console.log(
758
964
  `[trails-sdk] MetaTxn ${a}: Processing transaction ${s}`
759
- ), ve.current.add(a);
965
+ ), Re.current.add(a);
760
966
  try {
761
- const r = parseInt(e.chainId, 10);
762
- if (Number.isNaN(r) || r <= 0)
967
+ const l = parseInt(e.chainId, 10);
968
+ if (Number.isNaN(l) || l <= 0)
763
969
  throw new Error(
764
970
  `Invalid chainId for meta transaction: ${e.chainId}`
765
971
  );
766
- const f = ce(r), m = Ne({
767
- chain: f,
768
- transport: Fe()
769
- }), o = await m.getTransactionReceipt({
972
+ const v = Ce(l), p = Ke({
973
+ chain: v,
974
+ transport: ze()
975
+ }), i = await p.getTransactionReceipt({
770
976
  hash: s
771
977
  });
772
- if (o && typeof o.blockNumber == "bigint") {
773
- const h = await m.getBlock({
774
- blockNumber: o.blockNumber
978
+ if (i && typeof i.blockNumber == "bigint") {
979
+ const y = await p.getBlock({
980
+ blockNumber: i.blockNumber
775
981
  });
776
982
  t.console.log(
777
- `[trails-sdk] MetaTxn ${a}: Got block timestamp ${h.timestamp}`
778
- ), Y((p) => ({
779
- ...p,
983
+ `[trails-sdk] MetaTxn ${a}: Got block timestamp ${y.timestamp}`
984
+ ), le((b) => ({
985
+ ...b,
780
986
  [a]: {
781
- timestamp: Number(h.timestamp),
987
+ timestamp: Number(y.timestamp),
782
988
  error: void 0
783
989
  }
784
990
  }));
785
991
  try {
786
- const p = A?.quoteProvider ? String(A.quoteProvider).toLowerCase() : void 0, Z = g.variables?.params.provider ? String(
787
- g.variables.params.provider
788
- ).toLowerCase() : void 0, re = p === "cctp" || Z === "cctp", D = g.variables?.params.originChainId, Ce = g.variables?.params.destinationChainId;
789
- t.console.log("[Trails] isCctp", re), t.console.log("[Trails] providerFromQuote", p), t.console.log("[Trails] providerFromArgs", Z), t.console.log("[Trails] trailsFee", A), t.console.log(
992
+ const b = h?.quoteProvider ? String(h.quoteProvider).toLowerCase() : void 0, ge = f.variables?.params.provider ? String(
993
+ f.variables.params.provider
994
+ ).toLowerCase() : void 0, Te = b === "cctp" || ge === "cctp", oe = f.variables?.params.originChainId, De = f.variables?.params.destinationChainId;
995
+ t.console.log("[Trails] isCctp", Te), t.console.log("[Trails] providerFromQuote", b), t.console.log("[Trails] providerFromArgs", ge), t.console.log("[Trails] trailsFee", h), t.console.log(
790
996
  "[Trails] createIntentMutation.variables",
791
- g.variables
997
+ f.variables
792
998
  ), t.console.log(
793
999
  "[Trails] createIntentMutation.variables.params.provider",
794
- g.variables?.params.provider
1000
+ f.variables?.params.provider
795
1001
  ), t.console.log(
796
1002
  "[Trails] createIntentMutation.variables.params.originChainId",
797
- g.variables?.params.originChainId
1003
+ f.variables?.params.originChainId
798
1004
  ), t.console.log(
799
1005
  "[Trails] createIntentMutation.variables.params.destinationChainId",
800
- g.variables?.params.destinationChainId
1006
+ f.variables?.params.destinationChainId
801
1007
  ), t.console.log(
802
1008
  "[Trails] lastQueuedCctpSourceTxHash",
803
- Te.current
1009
+ Ue.current
804
1010
  ), t.console.log("[Trails] transactionHash", s), t.console.log(
805
1011
  "[Trails] originChainIdForCctp",
806
- D
1012
+ oe
807
1013
  ), t.console.log(
808
1014
  "[Trails] destinationChainIdForCctp",
809
- Ce
810
- ), re && S && s && typeof D == "number" && typeof Ce == "number" && Te.current !== s && n === 0 && (Te.current = s, await On({
811
- trailsClient: S,
1015
+ De
1016
+ ), Te && T && s && typeof oe == "number" && typeof De == "number" && Ue.current !== s && n === 0 && (Ue.current = s, await jn({
1017
+ trailsClient: T,
812
1018
  sourceTxHash: s,
813
- sourceChainId: D,
814
- destinationChainId: Ce
1019
+ sourceChainId: oe,
1020
+ destinationChainId: De
815
1021
  }));
816
- } catch (p) {
1022
+ } catch (b) {
817
1023
  t.console.error(
818
1024
  `[trails-sdk] Queue CCTP on meta-tx error (${a}):`,
819
- p
1025
+ b
820
1026
  );
821
1027
  }
822
1028
  } else
823
1029
  t.console.warn(
824
1030
  `[trails-sdk] MetaTxn ${a}: No block number in receipt`
825
- ), Y((h) => ({
826
- ...h,
1031
+ ), le((y) => ({
1032
+ ...y,
827
1033
  [a]: {
828
1034
  timestamp: null,
829
1035
  error: "Block number not found in receipt"
830
1036
  }
831
1037
  }));
832
- } catch (r) {
1038
+ } catch (l) {
833
1039
  t.console.error(
834
1040
  `[trails-sdk] MetaTxn ${a}: Error:`,
835
- r
836
- ), Y((f) => ({
837
- ...f,
1041
+ l
1042
+ ), le((v) => ({
1043
+ ...v,
838
1044
  [a]: {
839
1045
  timestamp: null,
840
- error: r.message || "Failed to fetch receipt/timestamp"
1046
+ error: l.message || "Failed to fetch receipt/timestamp"
841
1047
  }
842
1048
  }));
843
1049
  }
844
1050
  });
845
1051
  }, [
846
1052
  u,
847
- P,
848
- ge,
849
- A,
850
- g.variables,
851
- S
1053
+ V,
1054
+ Ee,
1055
+ h,
1056
+ f.variables,
1057
+ T
852
1058
  ]);
853
- const cn = (e) => {
854
- ne(e);
1059
+ const mn = (e) => {
1060
+ q(e);
855
1061
  };
856
- function ln(e) {
857
- g.mutate({
1062
+ function fn(e) {
1063
+ f.mutate({
858
1064
  ...e,
859
1065
  destinationSalt: Date.now().toString()
860
1066
  });
861
1067
  }
862
- function dn(e) {
863
- t.console.log("[trails-sdk] commitIntentConfig", e), I.mutate(e);
1068
+ function hn(e) {
1069
+ t.console.log("[trails-sdk] commitIntentConfig", e), w.mutate(e);
864
1070
  }
865
- function un(e) {
1071
+ function pn(e) {
866
1072
  if (!e) {
867
- V(null);
1073
+ J(null);
868
1074
  return;
869
1075
  }
870
1076
  const { originChainId: n, tokenAddress: a } = e;
871
- rn(n), on(a);
1077
+ gn(n), un(a);
872
1078
  }
873
- function gn(e) {
874
- H.mutate({ selectedId: e });
1079
+ function In(e) {
1080
+ se.mutate({ selectedId: e });
875
1081
  }
876
- const { chainId: mn } = d, Ee = i?.chainId, fn = g.isPending, hn = g.isSuccess, In = g.error, pn = g.variables, vn = I.isPending, Tn = I.isSuccess, Cn = I.error, Sn = I.variables, An = H.isPending, yn = H.isSuccess, wn = H.error, kn = H.variables;
1082
+ const { chainId: vn } = c, Le = o?.chainId, Tn = f.isPending, Cn = f.isSuccess, Sn = f.error, yn = f.variables, An = w.isPending, wn = w.isSuccess, bn = w.error, kn = w.variables, En = se.isPending, Pn = se.isSuccess, xn = se.error, Mn = se.variables;
877
1083
  return {
878
- trailsClient: S,
1084
+ trailsClient: T,
879
1085
  metaTxns: u,
880
- intentCallsPayloads: y,
881
- intentPreconditions: v,
882
- trailsFee: A,
883
- txnHash: T,
884
- committedOriginIntentAddress: $,
885
- committedDestinationIntentAddress: _e,
886
- verificationStatus: Je,
887
- getRelayer: me,
888
- estimatedGas: ae,
889
- isEstimateError: fe,
890
- estimateError: he,
891
- calculateIntentAddress: Me,
892
- calculateOriginAndDestinationIntentAddresses: Pe,
893
- committedIntentConfig: Ze,
894
- isLoadingCommittedConfig: en,
895
- committedConfigError: nn,
896
- commitIntentConfig: dn,
897
- commitIntentConfigPending: vn,
898
- commitIntentConfigSuccess: Tn,
899
- commitIntentConfigError: Cn,
900
- commitIntentConfigArgs: Sn,
901
- getIntentCallsPayloads: be,
902
- operationHashes: Qe,
903
- callIntentCallsPayload: tn,
904
- sendOriginTransaction: an,
905
- switchChain: Ve,
906
- isSwitchingChain: Ke,
907
- switchChainError: z,
908
- isTransactionInProgress: te,
909
- isChainSwitchRequired: mn !== Ee && !!Ee,
910
- sendTransaction: E.sendTransaction,
911
- isSendingTransaction: E.isPending,
912
- originCallStatus: w,
913
- updateOriginCallStatus: k,
914
- isEstimatingGas: ze,
1086
+ intentCallsPayloads: A,
1087
+ intentPreconditions: C,
1088
+ trailsFee: h,
1089
+ txnHash: I,
1090
+ committedOriginIntentAddress: R,
1091
+ committedDestinationIntentAddress: fe,
1092
+ verificationStatus: tn,
1093
+ getRelayer: Pe,
1094
+ estimatedGas: Ie,
1095
+ isEstimateError: xe,
1096
+ estimateError: Me,
1097
+ calculateIntentAddress: _e,
1098
+ calculateOriginAndDestinationIntentAddresses: Ge,
1099
+ committedIntentConfig: on,
1100
+ isLoadingCommittedConfig: an,
1101
+ committedConfigError: rn,
1102
+ commitIntentConfig: hn,
1103
+ commitIntentConfigPending: An,
1104
+ commitIntentConfigSuccess: wn,
1105
+ commitIntentConfigError: bn,
1106
+ commitIntentConfigArgs: kn,
1107
+ getIntentCallsPayloads: Be,
1108
+ operationHashes: ye,
1109
+ callIntentCallsPayload: cn,
1110
+ sendOriginTransaction: dn,
1111
+ switchChain: Ae,
1112
+ isSwitchingChain: we,
1113
+ switchChainError: _,
1114
+ isTransactionInProgress: j,
1115
+ isChainSwitchRequired: vn !== Le && !!Le,
1116
+ sendTransaction: r.sendTransaction,
1117
+ isSendingTransaction: r.isPending,
1118
+ originCallStatus: M,
1119
+ updateOriginCallStatus: D,
1120
+ isEstimatingGas: be,
915
1121
  isAutoExecute: x,
916
- updateAutoExecute: cn,
917
- receipt: C,
918
- isWaitingForReceipt: U,
919
- receiptIsSuccess: Ie,
920
- receiptIsError: pe,
921
- receiptError: oe,
922
- hasAutoExecuted: le,
923
- originCallSuccess: E.isSuccess,
924
- sentMetaTxns: j,
925
- sendMetaTxn: gn,
926
- sendMetaTxnPending: An,
927
- sendMetaTxnSuccess: yn,
928
- sendMetaTxnError: wn,
929
- sendMetaTxnArgs: kn,
930
- clearIntent: sn,
931
- metaTxnMonitorStatuses: P,
932
- createIntent: ln,
933
- createIntentPending: fn,
934
- createIntentSuccess: hn,
935
- createIntentError: In,
936
- createIntentArgs: pn,
937
- originCallParams: i,
938
- updateOriginCallParams: un,
939
- originBlockTimestamp: Ye,
940
- metaTxnBlockTimestamps: ge,
941
- originIntentAddress: N,
942
- destinationIntentAddress: We
1122
+ updateAutoExecute: mn,
1123
+ receipt: E,
1124
+ isWaitingForReceipt: te,
1125
+ receiptIsSuccess: qe,
1126
+ receiptIsError: Oe,
1127
+ receiptError: ve,
1128
+ hasAutoExecuted: Z,
1129
+ originCallSuccess: r.isSuccess,
1130
+ sentMetaTxns: z,
1131
+ sendMetaTxn: In,
1132
+ sendMetaTxnPending: En,
1133
+ sendMetaTxnSuccess: Pn,
1134
+ sendMetaTxnError: xn,
1135
+ sendMetaTxnArgs: Mn,
1136
+ clearIntent: ln,
1137
+ metaTxnMonitorStatuses: V,
1138
+ createIntent: fn,
1139
+ createIntentPending: Tn,
1140
+ createIntentSuccess: Cn,
1141
+ createIntentError: Sn,
1142
+ createIntentArgs: yn,
1143
+ originCallParams: o,
1144
+ updateOriginCallParams: pn,
1145
+ originBlockTimestamp: ce,
1146
+ metaTxnBlockTimestamps: Ee,
1147
+ originIntentAddress: L,
1148
+ destinationIntentAddress: Se
943
1149
  };
944
1150
  }
945
1151
  export {
946
- zn as TRAILS_ROUTER_PLACEHOLDER_AMOUNT,
947
- Yn as TradeType,
948
- Jn as TrailsClient,
949
- Xn as TrailsWidget,
950
- Me as calculateIntentAddress,
951
- Pe as calculateOriginAndDestinationIntentAddresses,
952
- Zn as commitIntentConfig,
953
- et as createModalController,
954
- nt as declareSequenceEnv,
955
- tt as getAPIClient,
956
- st as getAccountTotalBalanceUsd,
957
- it as getAccountTransactionHistory,
958
- at as getAllChains,
959
- ce as getChainInfo,
960
- ot as getDebug,
961
- xn as getERC20TransferData,
962
- rt as getHasSufficientBalanceToken,
963
- ct as getHasSufficientBalanceUsd,
964
- lt as getIndexerGatewayClient,
965
- Rn as getIntentCallsPayloads,
966
- dt as getIntentTransactionHistory,
967
- ut as getMetaTxnReceipt,
968
- gt as getMinLogLevel,
969
- mt as getRelayer,
970
- ft as getSequenceApiUrl,
971
- ht as getSequenceEnv,
972
- It as getSequenceIndexerUrl,
973
- pt as getSequenceNodeGatewayUrl,
974
- vt as getSequenceProjectAccessKey,
975
- Tt as getSlippageTolerance,
976
- Ct as getSupportedChains,
977
- St as getSupportedTokens,
978
- At as getTrailsApiUrl,
979
- yt as getTrailsClient,
980
- wt as getTxTimeDiff,
981
- kt as getWalletConnectProjectId,
1152
+ it as TRAILS_ROUTER_PLACEHOLDER_AMOUNT,
1153
+ Dn as TradeType,
1154
+ rt as TrailsClient,
1155
+ ct as TrailsWidget,
1156
+ _e as calculateIntentAddress,
1157
+ Ge as calculateOriginAndDestinationIntentAddresses,
1158
+ lt as commitIntentConfig,
1159
+ dt as createModalController,
1160
+ ut as declareSequenceEnv,
1161
+ gt as getAPIClient,
1162
+ mt as getAccountTotalBalanceUsd,
1163
+ ft as getAccountTransactionHistory,
1164
+ ht as getAllChains,
1165
+ Ce as getChainInfo,
1166
+ pt as getDebug,
1167
+ Bn as getERC20TransferData,
1168
+ It as getHasSufficientBalanceToken,
1169
+ vt as getHasSufficientBalanceUsd,
1170
+ Tt as getIndexerGatewayClient,
1171
+ Gn as getIntentCallsPayloads,
1172
+ Ct as getIntentTransactionHistory,
1173
+ St as getMetaTxnReceipt,
1174
+ yt as getMinLogLevel,
1175
+ At as getRelayer,
1176
+ wt as getSequenceApiUrl,
1177
+ $n as getSequenceEnv,
1178
+ bt as getSequenceIndexerUrl,
1179
+ kt as getSequenceNodeGatewayUrl,
1180
+ Et as getSequenceProjectAccessKey,
1181
+ Pt as getSlippageTolerance,
1182
+ xt as getSupportedChains,
1183
+ Mt as getSupportedTokens,
1184
+ qt as getTrailsApiUrl,
1185
+ Ot as getTrailsClient,
1186
+ Rt as getTxTimeDiff,
1187
+ Ut as getWalletConnectProjectId,
982
1188
  t as logger,
983
- bt as prepareSend,
984
- Et as relayerSendMetaTx,
985
- Pt as sendOriginTransaction,
986
- xt as setDebug,
987
- Mt as setSequenceApiUrl,
988
- Ot as setSequenceEnv,
989
- Rt as setSequenceIndexerUrl,
990
- qt as setSequenceNodeGatewayUrl,
991
- $t as setSequenceProjectAccessKey,
992
- Nt as setSlippageTolerance,
993
- Ft as setTrailsApiUrl,
994
- Ut as setWalletConnectProjectId,
995
- Ht as useAPIClient,
996
- Dt as useAccountTotalBalanceUsd,
997
- Bt as useAccountTransactionHistory,
998
- jt as useHasSufficientBalanceToken,
999
- Gt as useHasSufficientBalanceUsd,
1000
- Lt as useIndexerGatewayClient,
1001
- _t as useIntentTransactionHistory,
1002
- Mn as useMetaTxnsMonitor,
1003
- Wt as useQuote,
1004
- En as useRelayers,
1005
- Qt as useSupportedChains,
1006
- Vt as useSupportedTokens,
1007
- Kt as useTokenBalances,
1008
- zt as useTokenList,
1009
- Qn as useTrails,
1010
- bn as useTrailsClient
1189
+ Fn as prepareSend,
1190
+ Dt as relayerSendMetaTx,
1191
+ Ft as sendOriginTransaction,
1192
+ Ht as setDebug,
1193
+ $t as setSequenceApiUrl,
1194
+ Nt as setSequenceEnv,
1195
+ Bt as setSequenceIndexerUrl,
1196
+ Lt as setSequenceNodeGatewayUrl,
1197
+ jt as setSequenceProjectAccessKey,
1198
+ Gt as setSlippageTolerance,
1199
+ Qt as setTrailsApiUrl,
1200
+ _t as setWalletConnectProjectId,
1201
+ qn as useAPIClient,
1202
+ Wt as useAccountTotalBalanceUsd,
1203
+ Vt as useAccountTransactionHistory,
1204
+ Kt as useHasSufficientBalanceToken,
1205
+ zt as useHasSufficientBalanceUsd,
1206
+ On as useIndexerGatewayClient,
1207
+ Xt as useIntentTransactionHistory,
1208
+ Ln as useMetaTxnsMonitor,
1209
+ tt as useQuote,
1210
+ en as useRelayers,
1211
+ Yt as useSupportedChains,
1212
+ Rn as useSupportedTokens,
1213
+ Jt as useTokenBalances,
1214
+ Zt as useTokenList,
1215
+ st as useTrails,
1216
+ Ze as useTrailsClient
1011
1217
  };