0xtrails 0.3.0 → 0.4.1
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.
- package/dist/{ccip-BMB3uDZt.js → ccip-Bc-mZIIK.js} +1 -1
- package/dist/{index-QXPUrZVv.js → index-BWGjgMLm.js} +850 -808
- package/dist/index.js +508 -507
- package/dist/intents.d.ts +3 -3
- package/dist/intents.d.ts.map +1 -1
- package/dist/trailsClient.d.ts +5 -6
- package/dist/trailsClient.d.ts.map +1 -1
- package/dist/transactionIntent/deposits/depositOrchestrator.d.ts +2 -2
- package/dist/transactionIntent/deposits/depositOrchestrator.d.ts.map +1 -1
- package/dist/transactionIntent/deposits/gaslessDeposit.d.ts +2 -2
- package/dist/transactionIntent/deposits/gaslessDeposit.d.ts.map +1 -1
- package/dist/transactionIntent/handlers/crossChain.d.ts +2 -2
- package/dist/transactionIntent/handlers/crossChain.d.ts.map +1 -1
- package/dist/transactionIntent/handlers/sameChainSameToken.d.ts +2 -2
- package/dist/transactionIntent/handlers/sameChainSameToken.d.ts.map +1 -1
- package/dist/transactionIntent/types.d.ts +2 -2
- package/dist/transactionIntent/types.d.ts.map +1 -1
- package/dist/widget/hooks/useQuote.d.ts +2 -1
- package/dist/widget/hooks/useQuote.d.ts.map +1 -1
- package/dist/widget/index.js +1 -1
- package/package.json +4 -4
- package/src/indexerClient.ts +1 -1
- package/src/intents.ts +4 -4
- package/src/trailsClient.ts +10 -23
- package/src/transactionIntent/deposits/depositOrchestrator.ts +2 -2
- package/src/transactionIntent/deposits/gaslessDeposit.ts +2 -2
- package/src/transactionIntent/handlers/crossChain.ts +2 -2
- package/src/transactionIntent/handlers/sameChainSameToken.ts +2 -2
- package/src/transactionIntent/types.ts +2 -2
- package/src/widget/hooks/useQuote.ts +17 -3
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { l as t, u as
|
|
2
|
-
import { I as Zn, W as et, ae as nt, ag as tt, U as st, C as it, af as ot, X as rt, K as at, G as ct, A as lt, ab as dt, L as ut, M as gt, B as mt, F as ft, x as It, ac as ht, $ as pt, _ as vt, a4 as Tt, Y as At, a9 as Ct, y as St, R as wt, Z as
|
|
3
|
-
import { useQuery as
|
|
4
|
-
import { useRef as Dn, useState as d, useCallback as
|
|
5
|
-
import { zeroAddress as
|
|
6
|
-
import { useSwitchChain as Bn, useSendTransaction as Nn, useEstimateGas as
|
|
7
|
-
const
|
|
8
|
-
const
|
|
1
|
+
import { l as t, u as Ie, t as Sn, a as wn, b as kn, g as Pe, c as En, d as yn, e as bn, f as Re, h as xn, T as Pn, p as Rn, i as De, j as Un, k as xe, m as Fe, n as qn, o as ne, q as Le, r as On, s as Mn, v as Hn, w as Be } from "./index-BWGjgMLm.js";
|
|
2
|
+
import { I as Zn, W as et, ae as nt, ag as tt, U as st, C as it, af as ot, X as rt, K as at, G as ct, A as lt, ab as dt, L as ut, M as gt, B as mt, F as ft, x as It, ac as ht, $ as pt, _ as vt, a4 as Tt, Y as At, a9 as Ct, y as St, R as wt, Z as kt, ad as Et, V as yt, a7 as bt, E as xt, D as Pt, aa as Rt, a5 as Ut, a2 as qt, a3 as Ot, a0 as Mt, a8 as Ht, a1 as Dt, a6 as Ft, N as Lt, H as Bt, O as Nt, P as Gt, J as $t, z as jt, Q as Qt, S as Wt } from "./index-BWGjgMLm.js";
|
|
3
|
+
import { useQuery as Ue, useMutation as me } from "@tanstack/react-query";
|
|
4
|
+
import { useRef as Dn, useMemo as Ne, useState as d, useCallback as Ge, useEffect as x } from "react";
|
|
5
|
+
import { zeroAddress as fe, isAddressEqual as ae, isAddress as Fn, ethAddress as Ln, createWalletClient as $e, custom as je } from "viem";
|
|
6
|
+
import { useSwitchChain as Bn, useSendTransaction as Nn, useEstimateGas as Gn, useWaitForTransactionReceipt as $n } from "wagmi";
|
|
7
|
+
const Qe = 150, jn = (u, i) => {
|
|
8
|
+
const a = Ue({
|
|
9
9
|
queryKey: ["waitIntentReceipt", u],
|
|
10
10
|
queryFn: async () => {
|
|
11
11
|
if (!u)
|
|
@@ -13,313 +13,317 @@ const Ge = 150, jn = (u, i) => {
|
|
|
13
13
|
t.console.log(
|
|
14
14
|
`[trails-sdk] 🔍 Monitoring intent receipt for ${u}`
|
|
15
15
|
);
|
|
16
|
-
const
|
|
16
|
+
const o = await i.waitIntentReceipt({
|
|
17
17
|
intentId: u
|
|
18
18
|
});
|
|
19
19
|
return t.console.log(
|
|
20
|
-
`[trails-sdk] 📊 Intent ${u} status: ${
|
|
21
|
-
),
|
|
20
|
+
`[trails-sdk] 📊 Intent ${u} status: ${o.intentReceipt.status}, done: ${o.done}`
|
|
21
|
+
), o;
|
|
22
22
|
},
|
|
23
23
|
enabled: !!u,
|
|
24
24
|
refetchIntervalInBackground: !0,
|
|
25
|
-
refetchInterval: (
|
|
26
|
-
const
|
|
27
|
-
return
|
|
25
|
+
refetchInterval: (o) => {
|
|
26
|
+
const c = o.state.data;
|
|
27
|
+
return c && c.done ? (t.console.log(
|
|
28
28
|
`[trails-sdk] ✅ Intent monitoring complete for ${u}`
|
|
29
|
-
), !1) :
|
|
29
|
+
), !1) : Qe;
|
|
30
30
|
},
|
|
31
|
-
retry: (
|
|
31
|
+
retry: (o, c) => o >= 30 ? (t.console.error(
|
|
32
32
|
`[trails-sdk] ❌ Giving up on intent ${u} after 30 failed API attempts:`,
|
|
33
|
-
|
|
33
|
+
c
|
|
34
34
|
), !1) : !0
|
|
35
35
|
});
|
|
36
36
|
return {
|
|
37
|
-
intentReceipt:
|
|
38
|
-
done:
|
|
39
|
-
isLoading:
|
|
40
|
-
isError:
|
|
41
|
-
error:
|
|
37
|
+
intentReceipt: a.data?.intentReceipt ?? null,
|
|
38
|
+
done: a.data?.done ?? !1,
|
|
39
|
+
isLoading: a.isLoading,
|
|
40
|
+
isError: a.isError,
|
|
41
|
+
error: a.error
|
|
42
42
|
};
|
|
43
43
|
};
|
|
44
|
-
function
|
|
45
|
-
const u =
|
|
46
|
-
return
|
|
44
|
+
function We() {
|
|
45
|
+
const u = Ie();
|
|
46
|
+
return me({
|
|
47
47
|
mutationFn: async (i) => {
|
|
48
48
|
t.console.log("[trails-sdk] useCommitIntent: Starting commit", {
|
|
49
49
|
intentId: i.intentId,
|
|
50
50
|
originIntentAddress: i.originIntentAddress
|
|
51
51
|
});
|
|
52
|
-
const
|
|
52
|
+
const a = i.calls[0]?.chainId, o = i.calls[1]?.chainId;
|
|
53
53
|
try {
|
|
54
54
|
Sn({
|
|
55
55
|
intentAddress: i.originIntentAddress,
|
|
56
56
|
userAddress: i.ownerAddress,
|
|
57
|
-
originChainId:
|
|
58
|
-
destinationChainId:
|
|
57
|
+
originChainId: a ? Number(a) : void 0,
|
|
58
|
+
destinationChainId: o ? Number(o) : void 0
|
|
59
59
|
});
|
|
60
|
-
const
|
|
60
|
+
const c = await u.commitIntent({ intent: i });
|
|
61
61
|
return t.console.log("[trails-sdk] useCommitIntent: Commit successful", {
|
|
62
62
|
intentId: i.intentId,
|
|
63
|
-
response:
|
|
63
|
+
response: c
|
|
64
64
|
}), wn({
|
|
65
65
|
intentAddress: i.originIntentAddress,
|
|
66
66
|
userAddress: i.ownerAddress,
|
|
67
|
-
originChainId:
|
|
68
|
-
destinationChainId:
|
|
69
|
-
}),
|
|
70
|
-
} catch (
|
|
71
|
-
throw
|
|
72
|
-
error:
|
|
67
|
+
originChainId: a ? Number(a) : void 0,
|
|
68
|
+
destinationChainId: o ? Number(o) : void 0
|
|
69
|
+
}), c;
|
|
70
|
+
} catch (c) {
|
|
71
|
+
throw kn({
|
|
72
|
+
error: Pe(c),
|
|
73
73
|
userAddress: i.ownerAddress,
|
|
74
74
|
intentAddress: i.originIntentAddress,
|
|
75
|
-
originChainId:
|
|
76
|
-
destinationChainId:
|
|
77
|
-
}),
|
|
75
|
+
originChainId: a ? Number(a) : void 0,
|
|
76
|
+
destinationChainId: o ? Number(o) : void 0
|
|
77
|
+
}), c;
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
});
|
|
81
81
|
}
|
|
82
|
-
function
|
|
83
|
-
const u =
|
|
84
|
-
return
|
|
82
|
+
function Ve() {
|
|
83
|
+
const u = Ie();
|
|
84
|
+
return me({
|
|
85
85
|
mutationFn: async ({
|
|
86
86
|
intentId: i,
|
|
87
|
-
depositTransactionHash:
|
|
88
|
-
depositSignature:
|
|
87
|
+
depositTransactionHash: a,
|
|
88
|
+
depositSignature: o
|
|
89
89
|
}) => {
|
|
90
90
|
if (t.console.log("[trails-sdk] useExecuteIntent: Starting execution", {
|
|
91
91
|
intentId: i,
|
|
92
|
-
depositTransactionHash:
|
|
93
|
-
hasDepositSignature: !!
|
|
94
|
-
}), !
|
|
92
|
+
depositTransactionHash: a,
|
|
93
|
+
hasDepositSignature: !!o
|
|
94
|
+
}), !a && !o)
|
|
95
95
|
throw new Error(
|
|
96
96
|
"[trails-sdk] Either depositTransactionHash or depositSignature must be provided"
|
|
97
97
|
);
|
|
98
|
-
const
|
|
98
|
+
const c = await u.executeIntent({
|
|
99
99
|
intentId: i,
|
|
100
|
-
depositTransactionHash:
|
|
101
|
-
depositSignature:
|
|
100
|
+
depositTransactionHash: a,
|
|
101
|
+
depositSignature: o
|
|
102
102
|
});
|
|
103
103
|
return t.console.log(
|
|
104
104
|
"[trails-sdk] useExecuteIntent: Execution successful",
|
|
105
105
|
{
|
|
106
106
|
intentId: i,
|
|
107
|
-
response:
|
|
107
|
+
response: c
|
|
108
108
|
}
|
|
109
|
-
),
|
|
109
|
+
), c;
|
|
110
110
|
}
|
|
111
111
|
});
|
|
112
112
|
}
|
|
113
|
-
function
|
|
113
|
+
function Xn({
|
|
114
114
|
walletClient: u,
|
|
115
115
|
fromTokenAddress: i,
|
|
116
|
-
fromChainId:
|
|
117
|
-
toTokenAddress:
|
|
118
|
-
toChainId:
|
|
119
|
-
swapAmount:
|
|
120
|
-
tradeType:
|
|
121
|
-
toRecipient:
|
|
122
|
-
toCalldata:
|
|
123
|
-
slippageTolerance:
|
|
124
|
-
onStatusUpdate:
|
|
125
|
-
quoteProvider:
|
|
126
|
-
paymasterUrl:
|
|
127
|
-
selectedFeeToken:
|
|
128
|
-
nodeGatewayEnv:
|
|
129
|
-
abortSignal:
|
|
116
|
+
fromChainId: a,
|
|
117
|
+
toTokenAddress: o,
|
|
118
|
+
toChainId: c,
|
|
119
|
+
swapAmount: P,
|
|
120
|
+
tradeType: J,
|
|
121
|
+
toRecipient: F,
|
|
122
|
+
toCalldata: j,
|
|
123
|
+
slippageTolerance: ce,
|
|
124
|
+
onStatusUpdate: Q,
|
|
125
|
+
quoteProvider: R,
|
|
126
|
+
paymasterUrl: W,
|
|
127
|
+
selectedFeeToken: U,
|
|
128
|
+
nodeGatewayEnv: w,
|
|
129
|
+
abortSignal: q,
|
|
130
|
+
apiKey: p
|
|
130
131
|
} = {}) {
|
|
131
|
-
|
|
132
|
-
const
|
|
133
|
-
const
|
|
134
|
-
return
|
|
135
|
-
|
|
136
|
-
}),
|
|
137
|
-
|
|
138
|
-
}),
|
|
139
|
-
})() :
|
|
132
|
+
w && (globalThis.__testNodeGatewayEnv = w);
|
|
133
|
+
const A = Dn(new AbortController()), te = q ? (() => {
|
|
134
|
+
const s = new AbortController();
|
|
135
|
+
return q.addEventListener("abort", () => {
|
|
136
|
+
s.abort(), A.current?.abort();
|
|
137
|
+
}), A.current?.signal.addEventListener("abort", () => {
|
|
138
|
+
s.abort();
|
|
139
|
+
}), s.signal;
|
|
140
|
+
})() : A.current.signal, he = Ne(() => p ? { apiKey: p } : {}, [p]), h = Ne(() => p ? { projectAccessKey: p } : {}, [p]), O = Ie(he), g = En(
|
|
141
|
+
h
|
|
142
|
+
), { supportedTokens: k } = yn(), pe = We(), V = Ve(), { data: M, isLoading: _, error: le, refetch: z } = Ue({
|
|
140
143
|
queryKey: [
|
|
141
144
|
"prepareSend",
|
|
142
145
|
i,
|
|
143
|
-
|
|
144
|
-
l,
|
|
146
|
+
a,
|
|
145
147
|
o,
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
148
|
+
c,
|
|
149
|
+
P?.toString(),
|
|
150
|
+
F,
|
|
151
|
+
j,
|
|
152
|
+
J,
|
|
153
|
+
ce,
|
|
154
|
+
R,
|
|
155
|
+
p
|
|
152
156
|
],
|
|
153
157
|
queryFn: async () => {
|
|
154
158
|
try {
|
|
155
|
-
if (
|
|
159
|
+
if (A.current.signal.aborted && (t.console.log(
|
|
156
160
|
"[trails-sdk] Resetting aborted controller for new query"
|
|
157
|
-
),
|
|
161
|
+
), A.current = new AbortController()), !u || !O || !i || !o || !P || !F || !a || !c || !g)
|
|
158
162
|
return null;
|
|
159
|
-
let
|
|
163
|
+
let s = [];
|
|
160
164
|
try {
|
|
161
|
-
|
|
165
|
+
s = (await bn({
|
|
162
166
|
account: u.account.address,
|
|
163
|
-
indexerGatewayClient:
|
|
164
|
-
trailsClient:
|
|
167
|
+
indexerGatewayClient: g,
|
|
168
|
+
trailsClient: O
|
|
165
169
|
})).balances;
|
|
166
|
-
} catch (
|
|
167
|
-
const
|
|
168
|
-
if (
|
|
170
|
+
} catch (l) {
|
|
171
|
+
const I = Pe(l), $ = I.includes("Cross-Origin") || I.includes("CORS") || I.includes("Same Origin Policy"), we = I.includes("fetch failed") || I.includes("network");
|
|
172
|
+
if ($ || we)
|
|
169
173
|
t.console.warn(
|
|
170
174
|
"[trails-sdk] [useQuote] Network or CORS error fetching balances, proceeding with quote using zero balance:",
|
|
171
175
|
{
|
|
172
|
-
error:
|
|
176
|
+
error: I,
|
|
173
177
|
account: u.account.address
|
|
174
178
|
}
|
|
175
|
-
),
|
|
179
|
+
), s = [];
|
|
176
180
|
else
|
|
177
|
-
throw
|
|
181
|
+
throw l;
|
|
178
182
|
}
|
|
179
|
-
const
|
|
180
|
-
(
|
|
183
|
+
const ve = s.find(
|
|
184
|
+
(l) => l.chainId === a && (l.contractAddress?.toLowerCase() === i.toLowerCase() || !l.contractAddress && i === fe)
|
|
181
185
|
)?.balance ?? "0";
|
|
182
|
-
let
|
|
186
|
+
let se = 0;
|
|
183
187
|
try {
|
|
184
|
-
const
|
|
185
|
-
|
|
186
|
-
tokenSymbol:
|
|
187
|
-
tokenAddress:
|
|
188
|
-
chainId:
|
|
188
|
+
const I = Re(a)?.nativeCurrency?.symbol ?? "";
|
|
189
|
+
I && (se = (await xn(O, {
|
|
190
|
+
tokenSymbol: I,
|
|
191
|
+
tokenAddress: fe,
|
|
192
|
+
chainId: a
|
|
189
193
|
}))?.priceUsd ?? 0, t.console.log(
|
|
190
194
|
"[trails-sdk] [useQuote] Origin native token price:",
|
|
191
195
|
{
|
|
192
|
-
chainId:
|
|
193
|
-
symbol:
|
|
194
|
-
priceUsd:
|
|
196
|
+
chainId: a,
|
|
197
|
+
symbol: I,
|
|
198
|
+
priceUsd: se
|
|
195
199
|
}
|
|
196
200
|
));
|
|
197
|
-
} catch (
|
|
201
|
+
} catch (l) {
|
|
198
202
|
t.console.error(
|
|
199
203
|
"[trails-sdk] [useQuote] Error getting origin native token price:",
|
|
200
|
-
|
|
204
|
+
l
|
|
201
205
|
);
|
|
202
206
|
}
|
|
203
|
-
const
|
|
204
|
-
(
|
|
205
|
-
),
|
|
206
|
-
(
|
|
207
|
-
),
|
|
208
|
-
if (!
|
|
207
|
+
const L = k?.find(
|
|
208
|
+
(l) => l.contractAddress?.toLowerCase() === i?.toLowerCase() && l.chainId === a
|
|
209
|
+
), B = k?.find(
|
|
210
|
+
(l) => l.contractAddress?.toLowerCase() === o?.toLowerCase() && l.chainId === c
|
|
211
|
+
), ie = L?.decimals;
|
|
212
|
+
if (!ie)
|
|
209
213
|
throw t.console.error(
|
|
210
214
|
"[trails-sdk] [useQuote] Missing source token decimals:",
|
|
211
215
|
{
|
|
212
|
-
originToken:
|
|
216
|
+
originToken: L,
|
|
213
217
|
fromTokenAddress: i,
|
|
214
|
-
fromChainId:
|
|
218
|
+
fromChainId: a
|
|
215
219
|
}
|
|
216
220
|
), new Error("Source token decimals not found");
|
|
217
|
-
const
|
|
218
|
-
if (!
|
|
221
|
+
const N = B?.decimals;
|
|
222
|
+
if (!N)
|
|
219
223
|
throw t.console.error(
|
|
220
224
|
"[trails-sdk] Missing destination token decimals:",
|
|
221
225
|
{
|
|
222
|
-
destinationToken:
|
|
223
|
-
toTokenAddress:
|
|
224
|
-
toChainId:
|
|
226
|
+
destinationToken: B,
|
|
227
|
+
toTokenAddress: o,
|
|
228
|
+
toChainId: c
|
|
225
229
|
}
|
|
226
230
|
), new Error("Destination token decimals not found");
|
|
227
|
-
const
|
|
231
|
+
const Te = B?.symbol ?? "", Ae = L?.symbol ?? "", G = {
|
|
228
232
|
account: u.account,
|
|
229
233
|
originTokenAddress: i,
|
|
230
|
-
originChainId:
|
|
231
|
-
originTokenBalance:
|
|
232
|
-
destinationChainId:
|
|
233
|
-
recipient:
|
|
234
|
-
destinationTokenAddress:
|
|
235
|
-
swapAmount:
|
|
236
|
-
tradeType:
|
|
237
|
-
originTokenSymbol:
|
|
238
|
-
destinationTokenSymbol:
|
|
239
|
-
destinationCalldata:
|
|
234
|
+
originChainId: a,
|
|
235
|
+
originTokenBalance: ve,
|
|
236
|
+
destinationChainId: c,
|
|
237
|
+
recipient: F,
|
|
238
|
+
destinationTokenAddress: o,
|
|
239
|
+
swapAmount: P.toString(),
|
|
240
|
+
tradeType: J ?? Pn.EXACT_OUTPUT,
|
|
241
|
+
originTokenSymbol: Ae,
|
|
242
|
+
destinationTokenSymbol: Te,
|
|
243
|
+
destinationCalldata: j,
|
|
240
244
|
client: u,
|
|
241
|
-
trailsClient:
|
|
242
|
-
sourceTokenDecimals:
|
|
243
|
-
destinationTokenDecimals:
|
|
245
|
+
trailsClient: O,
|
|
246
|
+
sourceTokenDecimals: ie,
|
|
247
|
+
destinationTokenDecimals: N,
|
|
244
248
|
fee: "0",
|
|
245
249
|
dryMode: !1,
|
|
246
|
-
onTransactionStateChange:
|
|
250
|
+
onTransactionStateChange: Q ?? (() => {
|
|
247
251
|
}),
|
|
248
|
-
slippageTolerance:
|
|
249
|
-
quoteProvider:
|
|
250
|
-
paymasterUrl:
|
|
251
|
-
selectedFeeToken:
|
|
252
|
-
abortSignal:
|
|
253
|
-
originNativeTokenPriceUsd:
|
|
254
|
-
commitIntentFn:
|
|
255
|
-
executeIntentFn:
|
|
252
|
+
slippageTolerance: ce?.toString(),
|
|
253
|
+
quoteProvider: R,
|
|
254
|
+
paymasterUrl: W,
|
|
255
|
+
selectedFeeToken: U ?? void 0,
|
|
256
|
+
abortSignal: te,
|
|
257
|
+
originNativeTokenPriceUsd: se,
|
|
258
|
+
commitIntentFn: pe.mutateAsync,
|
|
259
|
+
executeIntentFn: V.mutateAsync
|
|
256
260
|
};
|
|
257
|
-
t.console.log("[trails-sdk] options",
|
|
258
|
-
const { quote:
|
|
261
|
+
t.console.log("[trails-sdk] options", G);
|
|
262
|
+
const { quote: r, send: Ce } = await Rn(G);
|
|
259
263
|
return {
|
|
260
264
|
quote: {
|
|
261
|
-
fromAmount:
|
|
262
|
-
toAmount:
|
|
263
|
-
fromAmountMin:
|
|
264
|
-
toAmountMin:
|
|
265
|
-
originToken:
|
|
266
|
-
destinationToken:
|
|
267
|
-
originChain:
|
|
268
|
-
destinationChain:
|
|
269
|
-
fees:
|
|
270
|
-
priceImpact:
|
|
271
|
-
completionEstimateSeconds:
|
|
272
|
-
slippageTolerance:
|
|
273
|
-
transactionStates:
|
|
274
|
-
originTokenRate:
|
|
275
|
-
destinationTokenRate:
|
|
276
|
-
quoteProvider:
|
|
277
|
-
fromAmountUsdDisplay:
|
|
278
|
-
toAmountUsdDisplay:
|
|
279
|
-
gasCostUsd:
|
|
280
|
-
gasCostUsdDisplay:
|
|
281
|
-
gasCost:
|
|
282
|
-
gasCostFormatted:
|
|
265
|
+
fromAmount: r.originAmount,
|
|
266
|
+
toAmount: r.destinationAmount,
|
|
267
|
+
fromAmountMin: r.originAmountMin,
|
|
268
|
+
toAmountMin: r.destinationAmountMin,
|
|
269
|
+
originToken: r.originToken,
|
|
270
|
+
destinationToken: r.destinationToken,
|
|
271
|
+
originChain: r.originChain,
|
|
272
|
+
destinationChain: r.destinationChain,
|
|
273
|
+
fees: r.fees,
|
|
274
|
+
priceImpact: r.priceImpact,
|
|
275
|
+
completionEstimateSeconds: r.completionEstimateSeconds,
|
|
276
|
+
slippageTolerance: r.slippageTolerance,
|
|
277
|
+
transactionStates: r.transactionStates,
|
|
278
|
+
originTokenRate: r.originTokenRate,
|
|
279
|
+
destinationTokenRate: r.destinationTokenRate,
|
|
280
|
+
quoteProvider: r.quoteProvider,
|
|
281
|
+
fromAmountUsdDisplay: r.originAmountUsdDisplay ?? void 0,
|
|
282
|
+
toAmountUsdDisplay: r.destinationAmountUsdDisplay ?? void 0,
|
|
283
|
+
gasCostUsd: r.gasCostUsd ?? void 0,
|
|
284
|
+
gasCostUsdDisplay: r.gasCostUsdDisplay ?? void 0,
|
|
285
|
+
gasCost: r.gasCost ?? void 0,
|
|
286
|
+
gasCostFormatted: r.gasCostFormatted ?? void 0
|
|
283
287
|
},
|
|
284
288
|
swap: async () => {
|
|
285
289
|
const {
|
|
286
|
-
depositUserTxnReceipt:
|
|
287
|
-
destinationMetaTxnReceipt:
|
|
288
|
-
totalCompletionSeconds:
|
|
289
|
-
} = await
|
|
290
|
-
selectedFeeToken:
|
|
290
|
+
depositUserTxnReceipt: l,
|
|
291
|
+
destinationMetaTxnReceipt: I,
|
|
292
|
+
totalCompletionSeconds: $
|
|
293
|
+
} = await Ce({
|
|
294
|
+
selectedFeeToken: U ?? void 0
|
|
291
295
|
});
|
|
292
296
|
return {
|
|
293
297
|
originTransaction: {
|
|
294
|
-
transactionHash:
|
|
295
|
-
explorerUrl:
|
|
296
|
-
txHash:
|
|
297
|
-
chainId:
|
|
298
|
+
transactionHash: l?.transactionHash,
|
|
299
|
+
explorerUrl: De({
|
|
300
|
+
txHash: l?.transactionHash,
|
|
301
|
+
chainId: a
|
|
298
302
|
}),
|
|
299
|
-
receipt:
|
|
303
|
+
receipt: l
|
|
300
304
|
},
|
|
301
305
|
destinationTransaction: {
|
|
302
|
-
transactionHash:
|
|
303
|
-
explorerUrl:
|
|
304
|
-
txHash:
|
|
305
|
-
chainId:
|
|
306
|
+
transactionHash: I?.txnHash,
|
|
307
|
+
explorerUrl: De({
|
|
308
|
+
txHash: I?.txnHash,
|
|
309
|
+
chainId: c
|
|
306
310
|
}),
|
|
307
|
-
receipt:
|
|
311
|
+
receipt: I
|
|
308
312
|
},
|
|
309
|
-
totalCompletionSeconds:
|
|
313
|
+
totalCompletionSeconds: $
|
|
310
314
|
};
|
|
311
315
|
}
|
|
312
316
|
};
|
|
313
|
-
} catch (
|
|
317
|
+
} catch (s) {
|
|
314
318
|
throw t.console.error(
|
|
315
319
|
"[trails-sdk] [useQuote] Error getting quote:",
|
|
316
|
-
|
|
317
|
-
),
|
|
320
|
+
s
|
|
321
|
+
), Pe(s);
|
|
318
322
|
}
|
|
319
323
|
},
|
|
320
324
|
// Prevent unnecessary refetching
|
|
321
|
-
enabled: !!(u &&
|
|
322
|
-
|
|
325
|
+
enabled: !!(u && O && i && o && P && F && a && c && g && // !isLoadingTokens &&
|
|
326
|
+
k && k.length > 0),
|
|
323
327
|
staleTime: 30 * 1e3,
|
|
324
328
|
// Consider data fresh for 30 seconds
|
|
325
329
|
refetchOnWindowFocus: !1,
|
|
@@ -334,117 +338,114 @@ function zn({
|
|
|
334
338
|
// Refetch when network reconnects
|
|
335
339
|
});
|
|
336
340
|
return {
|
|
337
|
-
quote:
|
|
338
|
-
swap:
|
|
339
|
-
isLoadingQuote:
|
|
341
|
+
quote: M?.quote || null,
|
|
342
|
+
swap: M?.swap || null,
|
|
343
|
+
isLoadingQuote: _,
|
|
340
344
|
quoteError: le,
|
|
341
345
|
quoteErrorPrettified: Un(le),
|
|
342
|
-
refetchQuote: () =>
|
|
346
|
+
refetchQuote: () => z(),
|
|
343
347
|
abort: () => {
|
|
344
348
|
t.console.log("[trails-sdk] useQuote abort() called"), t.console.log(
|
|
345
349
|
"[trails-sdk] Active operations before abort:",
|
|
346
|
-
|
|
347
|
-
),
|
|
350
|
+
xe.getAll()
|
|
351
|
+
), A.current.abort(), xe.abortAll(), t.console.log(
|
|
348
352
|
"[trails-sdk] Abort completed, active operations:",
|
|
349
|
-
|
|
353
|
+
xe.getAll()
|
|
350
354
|
);
|
|
351
355
|
}
|
|
352
356
|
};
|
|
353
357
|
}
|
|
354
|
-
function
|
|
358
|
+
function Jn(u) {
|
|
355
359
|
const {
|
|
356
360
|
account: i,
|
|
357
|
-
disableAutoExecute:
|
|
358
|
-
|
|
359
|
-
} = u, o = pe({
|
|
360
|
-
projectAccessKey: l
|
|
361
|
-
}), [C, N] = d(!r), [H, _] = d(!1), [$, ve] = d(
|
|
361
|
+
disableAutoExecute: a = !1
|
|
362
|
+
} = u, o = Ie({}), [c, P] = d(!a), [J, F] = d(!1), [j, ce] = d(
|
|
362
363
|
{}
|
|
363
|
-
), [
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
] = d(null), [
|
|
364
|
+
), [Q, R] = d(null), [W, U] = d(null), [w, q] = d(null), [p, A] = d(null), [te, he] = d(null), [h, O] = d(), [g, k] = d(null), [
|
|
365
|
+
pe,
|
|
366
|
+
V
|
|
367
|
+
] = d(null), [M, _] = d(
|
|
367
368
|
null
|
|
368
|
-
), [
|
|
369
|
-
switchChain:
|
|
370
|
-
isPending:
|
|
371
|
-
error:
|
|
372
|
-
} = Bn(),
|
|
373
|
-
data:
|
|
374
|
-
isError:
|
|
375
|
-
error:
|
|
376
|
-
} =
|
|
369
|
+
), [le, z] = d(null), [s, K] = d(null), [ve, se] = d({}), [L, B] = d(!1), [ie, N] = d(!1), {
|
|
370
|
+
switchChain: Te,
|
|
371
|
+
isPending: Ae,
|
|
372
|
+
error: G
|
|
373
|
+
} = Bn(), r = Nn(), [Ce, Se] = d(!1), [E, l] = d(null), [I, $] = d(null), [we, qe] = d({}), [_e, de] = d(null), {
|
|
374
|
+
data: ue,
|
|
375
|
+
isError: ke,
|
|
376
|
+
error: Ee
|
|
377
|
+
} = Gn(
|
|
377
378
|
s?.to && s?.chainId && !s.error ? {
|
|
378
379
|
to: s.to || void 0,
|
|
379
380
|
data: s.data || void 0,
|
|
380
381
|
value: s.value || void 0,
|
|
381
382
|
chainId: s.chainId || void 0
|
|
382
383
|
} : void 0
|
|
383
|
-
),
|
|
384
|
+
), ze = We(), C = me({
|
|
384
385
|
mutationFn: async (e) => {
|
|
385
386
|
t.console.log(
|
|
386
387
|
"[useTrails] commitIntentMutation started with intent:",
|
|
387
388
|
e
|
|
388
389
|
);
|
|
389
390
|
try {
|
|
390
|
-
const n = v.variables?.originChainId,
|
|
391
|
-
if (!n || !
|
|
391
|
+
const n = v.variables?.originChainId, m = v.variables?.destinationChainId;
|
|
392
|
+
if (!n || !m)
|
|
392
393
|
throw t.console.error(
|
|
393
394
|
"[useTrails] Could not determine origin/destination chain IDs for verification."
|
|
394
395
|
), new Error(
|
|
395
396
|
"Could not determine origin/destination chain IDs for verification."
|
|
396
397
|
);
|
|
397
398
|
t.console.log("[useTrails] Calculating intent address..."), t.console.log("[useTrails] Main signer:", e.ownerAddress), t.console.log("[useTrails] Calls:", e.calls);
|
|
398
|
-
const { originIntentAddress:
|
|
399
|
+
const { originIntentAddress: S, destinationIntentAddress: y } = Fe(
|
|
399
400
|
e.ownerAddress,
|
|
400
401
|
e.calls
|
|
401
402
|
), {
|
|
402
|
-
originAddress:
|
|
403
|
-
destinationAddress:
|
|
403
|
+
originAddress: re,
|
|
404
|
+
destinationAddress: X
|
|
404
405
|
} = qn(
|
|
405
406
|
e.preconditions,
|
|
406
407
|
n,
|
|
407
|
-
|
|
408
|
+
m
|
|
408
409
|
);
|
|
409
410
|
t.console.log("[useTrails] Verification addresses:", {
|
|
410
|
-
calculatedOrigin:
|
|
411
|
-
calculatedDestination:
|
|
412
|
-
preconditionOrigin:
|
|
413
|
-
preconditionDestination:
|
|
411
|
+
calculatedOrigin: S.toString(),
|
|
412
|
+
calculatedDestination: y.toString(),
|
|
413
|
+
preconditionOrigin: re,
|
|
414
|
+
preconditionDestination: X
|
|
414
415
|
});
|
|
415
|
-
const
|
|
416
|
-
|
|
417
|
-
|
|
416
|
+
const b = !!re && ae(
|
|
417
|
+
ne(re),
|
|
418
|
+
S
|
|
418
419
|
);
|
|
419
|
-
t.console.log("[useTrails] Origin verified:",
|
|
420
|
-
const
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
) || !
|
|
420
|
+
t.console.log("[useTrails] Origin verified:", b);
|
|
421
|
+
const T = X && ae(
|
|
422
|
+
ne(X),
|
|
423
|
+
y
|
|
424
|
+
) || !X && n === m && ae(y, fe);
|
|
424
425
|
t.console.log(
|
|
425
426
|
"[useTrails] Destination verified:",
|
|
426
|
-
|
|
427
|
+
T
|
|
427
428
|
);
|
|
428
|
-
const
|
|
429
|
-
if (
|
|
430
|
-
success:
|
|
431
|
-
receivedOriginAddress:
|
|
432
|
-
receivedDestinationAddress:
|
|
433
|
-
calculatedOriginAddress:
|
|
434
|
-
calculatedDestinationAddress:
|
|
435
|
-
}), !
|
|
429
|
+
const Me = b && T;
|
|
430
|
+
if (de({
|
|
431
|
+
success: Me,
|
|
432
|
+
receivedOriginAddress: re,
|
|
433
|
+
receivedDestinationAddress: X,
|
|
434
|
+
calculatedOriginAddress: S.toString(),
|
|
435
|
+
calculatedDestinationAddress: y.toString()
|
|
436
|
+
}), !Me)
|
|
436
437
|
throw t.console.error("[useTrails] Address verification failed.", {
|
|
437
|
-
isOriginVerified:
|
|
438
|
-
isDestinationVerified:
|
|
438
|
+
isOriginVerified: b,
|
|
439
|
+
isDestinationVerified: T
|
|
439
440
|
}), new Error(
|
|
440
|
-
`Address verification failed. Origin verified: ${
|
|
441
|
+
`Address verification failed. Origin verified: ${b}, Destination verified: ${T}`
|
|
441
442
|
);
|
|
442
443
|
t.console.log("[useTrails] Committing intent to API...");
|
|
443
|
-
const
|
|
444
|
-
return t.console.log("[useTrails] API Commit Response:",
|
|
445
|
-
originIntentAddress:
|
|
446
|
-
destinationIntentAddress:
|
|
447
|
-
response:
|
|
444
|
+
const He = await ze.mutateAsync(e);
|
|
445
|
+
return t.console.log("[useTrails] API Commit Response:", He), {
|
|
446
|
+
originIntentAddress: S.toString(),
|
|
447
|
+
destinationIntentAddress: y.toString(),
|
|
448
|
+
response: He
|
|
448
449
|
};
|
|
449
450
|
} catch (n) {
|
|
450
451
|
throw console.error("[useTrails] Error during commit intent mutation:", n), n;
|
|
@@ -457,89 +458,89 @@ function Xn(u) {
|
|
|
457
458
|
), t.console.log(
|
|
458
459
|
"[useTrails] Setting committedOriginIntentAddress:",
|
|
459
460
|
e.originIntentAddress
|
|
460
|
-
),
|
|
461
|
+
), k(e.originIntentAddress), V(e.destinationIntentAddress);
|
|
461
462
|
},
|
|
462
463
|
onError: (e) => {
|
|
463
|
-
t.console.error("[useTrails] Failed to commit intent config:", e),
|
|
464
|
+
t.console.error("[useTrails] Failed to commit intent config:", e), k(null), V(null);
|
|
464
465
|
}
|
|
465
|
-
}),
|
|
466
|
-
data:
|
|
467
|
-
isLoading:
|
|
468
|
-
error:
|
|
469
|
-
} =
|
|
470
|
-
queryKey: ["getIntent",
|
|
466
|
+
}), Y = Ve(), {
|
|
467
|
+
data: Xe,
|
|
468
|
+
isLoading: Je,
|
|
469
|
+
error: Ke
|
|
470
|
+
} = Ue({
|
|
471
|
+
queryKey: ["getIntent", g],
|
|
471
472
|
queryFn: async () => {
|
|
472
|
-
if (!o || !
|
|
473
|
+
if (!o || !g)
|
|
473
474
|
throw new Error("API client or committed intent address not available");
|
|
474
475
|
return t.console.log(
|
|
475
476
|
"Fetching intent config for address:",
|
|
476
|
-
|
|
477
|
+
g
|
|
477
478
|
), (await o.getIntent({
|
|
478
|
-
intentId:
|
|
479
|
+
intentId: g
|
|
479
480
|
})).intent;
|
|
480
481
|
},
|
|
481
|
-
enabled: !!
|
|
482
|
+
enabled: !!g && !!o && C.isSuccess,
|
|
482
483
|
staleTime: 1e3 * 60 * 5,
|
|
483
484
|
// 5 minutes
|
|
484
485
|
retry: 1
|
|
485
486
|
});
|
|
486
487
|
async function Ye(e) {
|
|
487
|
-
const { intent: n } = await
|
|
488
|
+
const { intent: n } = await Le(o, e);
|
|
488
489
|
return n;
|
|
489
490
|
}
|
|
490
|
-
const v =
|
|
491
|
+
const v = me({
|
|
491
492
|
mutationFn: async (e) => {
|
|
492
|
-
if (e.originChainId === e.destinationChainId &&
|
|
493
|
-
|
|
494
|
-
|
|
493
|
+
if (e.originChainId === e.destinationChainId && ae(
|
|
494
|
+
ne(e.originTokenAddress),
|
|
495
|
+
ne(e.destinationTokenAddress)
|
|
495
496
|
))
|
|
496
497
|
throw new Error(
|
|
497
498
|
"The same token cannot be used as both the source and destination token."
|
|
498
499
|
);
|
|
499
500
|
if (!i.address)
|
|
500
501
|
throw new Error("Missing selected token or account address");
|
|
501
|
-
|
|
502
|
-
const { intent: n } = await
|
|
503
|
-
return
|
|
502
|
+
k(null), V(null), de(null), A(null), R(null), U(null), q(null), _(null), z(null);
|
|
503
|
+
const { intent: n } = await Le(o, e);
|
|
504
|
+
return R(n.metaTxns), U(n.calls), q(n.preconditions), A(n.fees), _(n.originIntentAddress), z(n.destinationIntentAddress), he(n), k(null), V(null), de(null), n;
|
|
504
505
|
},
|
|
505
506
|
onSuccess: (e) => {
|
|
506
|
-
t.console.log("Intent Config Success:", e),
|
|
507
|
+
t.console.log("Intent Config Success:", e), A(e.fees || null), _(e.originIntentAddress), z(e.destinationIntentAddress), e?.calls && e.calls.length > 0 && e.preconditions && e.preconditions.length > 0 && e.metaTxns && e.metaTxns.length > 0 ? (U(e.calls), q(e.preconditions), R(e.metaTxns)) : (t.console.warn("API returned success but no operations found."), U(null), q(null), R(null));
|
|
507
508
|
},
|
|
508
509
|
onError: (e) => {
|
|
509
|
-
console.error("Intent Config Error:", e),
|
|
510
|
+
console.error("Intent Config Error:", e), U(null), q(null), R(null), A(null), _(null), z(null);
|
|
510
511
|
}
|
|
511
512
|
});
|
|
512
513
|
function Ze(e) {
|
|
513
514
|
v.mutate(e);
|
|
514
515
|
}
|
|
515
|
-
const en =
|
|
516
|
-
t.console.log("[Trails] Clearing intent state"),
|
|
517
|
-
}, []),
|
|
518
|
-
(e, n,
|
|
519
|
-
|
|
516
|
+
const en = Ge(() => {
|
|
517
|
+
t.console.log("[Trails] Clearing intent state"), U(null), q(null), R(null), A(null), k(null), V(null), de(null), _(null), z(null), se({}), F(!1), qe({});
|
|
518
|
+
}, []), H = Ge(
|
|
519
|
+
(e, n, m, S, y) => {
|
|
520
|
+
l({
|
|
520
521
|
txnHash: e,
|
|
521
522
|
status: n === "success" ? "Success" : n === "reverted" ? "Failed" : n === "sending" ? "Sending..." : "Pending",
|
|
522
|
-
revertReason: n === "reverted" ?
|
|
523
|
-
gasUsed:
|
|
524
|
-
effectiveGasPrice:
|
|
523
|
+
revertReason: n === "reverted" ? y || "Transaction reverted" : void 0,
|
|
524
|
+
gasUsed: m ? Number(m) : void 0,
|
|
525
|
+
effectiveGasPrice: S?.toString()
|
|
525
526
|
});
|
|
526
527
|
},
|
|
527
528
|
[]
|
|
528
529
|
), nn = async () => {
|
|
529
530
|
if (t.console.log("Sending origin transaction..."), t.console.log(
|
|
530
|
-
|
|
531
|
+
L,
|
|
531
532
|
s,
|
|
532
533
|
s?.error,
|
|
533
534
|
s?.to,
|
|
534
535
|
s?.data,
|
|
535
536
|
s?.value,
|
|
536
537
|
s?.chainId
|
|
537
|
-
),
|
|
538
|
+
), L || // Prevent duplicate transactions
|
|
538
539
|
!s || s.error || !s.to || s.data === null || s.value === null || s.chainId === null) {
|
|
539
540
|
t.console.error(
|
|
540
541
|
"Origin call parameters not available or invalid:",
|
|
541
542
|
s
|
|
542
|
-
),
|
|
543
|
+
), H(
|
|
543
544
|
void 0,
|
|
544
545
|
"reverted",
|
|
545
546
|
void 0,
|
|
@@ -549,55 +550,55 @@ function Xn(u) {
|
|
|
549
550
|
return;
|
|
550
551
|
}
|
|
551
552
|
if (i.chainId !== s.chainId) {
|
|
552
|
-
|
|
553
|
+
N(!0), H(
|
|
553
554
|
void 0,
|
|
554
555
|
"pending",
|
|
555
556
|
void 0,
|
|
556
557
|
void 0,
|
|
557
558
|
`Switching to chain ${s.chainId}...`
|
|
558
559
|
);
|
|
559
|
-
const e =
|
|
560
|
-
chain:
|
|
561
|
-
transport:
|
|
560
|
+
const e = $e({
|
|
561
|
+
chain: Re(s.chainId),
|
|
562
|
+
transport: je(await i.connector.getProvider())
|
|
562
563
|
// TODO: Add proper type
|
|
563
564
|
});
|
|
564
565
|
try {
|
|
565
|
-
await
|
|
566
|
+
await Be({
|
|
566
567
|
walletClient: e,
|
|
567
568
|
desiredChainId: s.chainId
|
|
568
|
-
}),
|
|
569
|
+
}), N(!1);
|
|
569
570
|
} catch (n) {
|
|
570
|
-
t.console.error("Chain switch failed:", n), n instanceof Error && n.message.includes("User rejected") &&
|
|
571
|
+
t.console.error("Chain switch failed:", n), n instanceof Error && n.message.includes("User rejected") && P(!1), H(
|
|
571
572
|
void 0,
|
|
572
573
|
"reverted",
|
|
573
574
|
void 0,
|
|
574
575
|
void 0,
|
|
575
576
|
n instanceof Error ? n.message : "Unknown error switching chain"
|
|
576
|
-
),
|
|
577
|
+
), N(!1);
|
|
577
578
|
return;
|
|
578
579
|
}
|
|
579
580
|
}
|
|
580
|
-
if (
|
|
581
|
+
if (L)
|
|
581
582
|
t.console.warn(
|
|
582
583
|
"Transaction already in progress. Skipping duplicate request."
|
|
583
584
|
);
|
|
584
585
|
else {
|
|
585
|
-
if (
|
|
586
|
-
|
|
586
|
+
if (B(!0), O(void 0), H(void 0, "sending"), !ue && !ke) {
|
|
587
|
+
Se(!0);
|
|
587
588
|
return;
|
|
588
589
|
}
|
|
589
|
-
if (
|
|
590
|
-
t.console.error("Gas estimation failed:",
|
|
590
|
+
if (ke) {
|
|
591
|
+
t.console.error("Gas estimation failed:", Ee), H(
|
|
591
592
|
void 0,
|
|
592
593
|
"reverted",
|
|
593
594
|
void 0,
|
|
594
595
|
void 0,
|
|
595
|
-
`Gas estimation failed: ${
|
|
596
|
-
),
|
|
596
|
+
`Gas estimation failed: ${Ee?.message}`
|
|
597
|
+
), B(!1);
|
|
597
598
|
return;
|
|
598
599
|
}
|
|
599
|
-
const e =
|
|
600
|
-
|
|
600
|
+
const e = ue ? BigInt(Math.floor(Number(ue) * 1.2)) : void 0;
|
|
601
|
+
r.sendTransaction(
|
|
601
602
|
{
|
|
602
603
|
to: s.to,
|
|
603
604
|
data: s.data,
|
|
@@ -607,44 +608,44 @@ function Xn(u) {
|
|
|
607
608
|
},
|
|
608
609
|
{
|
|
609
610
|
onSuccess: (n) => {
|
|
610
|
-
t.console.log("Transaction sent, hash:", n),
|
|
611
|
+
t.console.log("Transaction sent, hash:", n), O(n), B(!1);
|
|
611
612
|
},
|
|
612
613
|
onError: (n) => {
|
|
613
|
-
t.console.error("Transaction failed:", n), n instanceof Error && (n.message.includes("User rejected") || n.message.includes("user rejected")) &&
|
|
614
|
+
t.console.error("Transaction failed:", n), n instanceof Error && (n.message.includes("User rejected") || n.message.includes("user rejected")) && P(!1), H(
|
|
614
615
|
void 0,
|
|
615
616
|
"reverted",
|
|
616
617
|
void 0,
|
|
617
618
|
void 0,
|
|
618
619
|
n instanceof Error ? n.message : "Unknown error"
|
|
619
|
-
),
|
|
620
|
+
), B(!1);
|
|
620
621
|
}
|
|
621
622
|
}
|
|
622
623
|
);
|
|
623
624
|
}
|
|
624
625
|
};
|
|
625
|
-
|
|
626
|
-
|
|
626
|
+
x(() => {
|
|
627
|
+
G && (t.console.error("Chain switch error:", G), H(
|
|
627
628
|
void 0,
|
|
628
629
|
"reverted",
|
|
629
630
|
void 0,
|
|
630
631
|
void 0,
|
|
631
|
-
`Chain switch failed: ${
|
|
632
|
-
),
|
|
633
|
-
}, [
|
|
634
|
-
|
|
635
|
-
}, []),
|
|
636
|
-
s?.chainId && i.chainId === s.chainId && (t.console.log("No chain switch required"),
|
|
637
|
-
}, [i.chainId, s?.chainId]),
|
|
632
|
+
`Chain switch failed: ${G.message || "Unknown error"}`
|
|
633
|
+
), N(!1));
|
|
634
|
+
}, [G, H]), x(() => {
|
|
635
|
+
Se(!1);
|
|
636
|
+
}, []), x(() => {
|
|
637
|
+
s?.chainId && i.chainId === s.chainId && (t.console.log("No chain switch required"), N(!1));
|
|
638
|
+
}, [i.chainId, s?.chainId]), x(() => {
|
|
638
639
|
if (s?.chainId && i.chainId !== s.chainId) {
|
|
639
640
|
async function e() {
|
|
640
641
|
try {
|
|
641
|
-
const n = s.chainId,
|
|
642
|
-
chain:
|
|
643
|
-
transport:
|
|
642
|
+
const n = s.chainId, m = $e({
|
|
643
|
+
chain: Re(n),
|
|
644
|
+
transport: je(await i.connector.getProvider())
|
|
644
645
|
// TODO: Add proper type
|
|
645
646
|
});
|
|
646
|
-
await
|
|
647
|
-
walletClient:
|
|
647
|
+
await Be({
|
|
648
|
+
walletClient: m,
|
|
648
649
|
desiredChainId: n
|
|
649
650
|
});
|
|
650
651
|
} catch (n) {
|
|
@@ -655,76 +656,76 @@ function Xn(u) {
|
|
|
655
656
|
}
|
|
656
657
|
}, [i, s]);
|
|
657
658
|
const {
|
|
658
|
-
data:
|
|
659
|
-
isLoading:
|
|
659
|
+
data: D,
|
|
660
|
+
isLoading: Z,
|
|
660
661
|
isSuccess: ye,
|
|
661
|
-
isError:
|
|
662
|
-
error:
|
|
663
|
-
} =
|
|
664
|
-
hash:
|
|
662
|
+
isError: be,
|
|
663
|
+
error: ge
|
|
664
|
+
} = $n({
|
|
665
|
+
hash: h,
|
|
665
666
|
confirmations: 1,
|
|
666
667
|
query: {
|
|
667
|
-
enabled: !!
|
|
668
|
+
enabled: !!h
|
|
668
669
|
}
|
|
669
670
|
});
|
|
670
|
-
|
|
671
|
-
if (!
|
|
672
|
-
|
|
671
|
+
x(() => {
|
|
672
|
+
if (!h) {
|
|
673
|
+
E?.txnHash && l(null), $(null), Object.keys(j).length > 0 && ce({});
|
|
673
674
|
return;
|
|
674
675
|
}
|
|
675
|
-
if (!(
|
|
676
|
-
if (
|
|
677
|
-
|
|
678
|
-
...e?.txnHash ===
|
|
676
|
+
if (!(E?.txnHash === h && (E?.status === "Success" || E?.status === "Failed") && !Z)) {
|
|
677
|
+
if (Z) {
|
|
678
|
+
l((e) => ({
|
|
679
|
+
...e?.txnHash === h ? e : {
|
|
679
680
|
gasUsed: void 0,
|
|
680
681
|
effectiveGasPrice: void 0,
|
|
681
682
|
revertReason: void 0
|
|
682
683
|
},
|
|
683
|
-
txnHash:
|
|
684
|
+
txnHash: h,
|
|
684
685
|
status: "Pending"
|
|
685
686
|
}));
|
|
686
687
|
return;
|
|
687
688
|
}
|
|
688
|
-
if (ye &&
|
|
689
|
-
const e =
|
|
690
|
-
|
|
691
|
-
txnHash:
|
|
689
|
+
if (ye && D) {
|
|
690
|
+
const e = D.status === "success" ? "Success" : "Failed";
|
|
691
|
+
l({
|
|
692
|
+
txnHash: D.transactionHash,
|
|
692
693
|
status: e,
|
|
693
|
-
gasUsed:
|
|
694
|
-
effectiveGasPrice:
|
|
695
|
-
revertReason:
|
|
696
|
-
}), e !== "Success" &&
|
|
694
|
+
gasUsed: D.gasUsed ? Number(D.gasUsed) : void 0,
|
|
695
|
+
effectiveGasPrice: D.effectiveGasPrice?.toString(),
|
|
696
|
+
revertReason: D.status === "reverted" ? ge?.message || "Transaction reverted by receipt" : void 0
|
|
697
|
+
}), e !== "Success" && $(null), e === "Success" && Q && Q.length > 0 && c && !Q.some((n) => j[`${n.chainId}-${n.id}`]) && (t.console.log(
|
|
697
698
|
"Origin transaction successful, calling executeIntent and auto-sending all meta transactions..."
|
|
698
|
-
),
|
|
699
|
-
intentId:
|
|
700
|
-
depositTransactionHash:
|
|
699
|
+
), g && h && Y.mutate({
|
|
700
|
+
intentId: g,
|
|
701
|
+
depositTransactionHash: h
|
|
701
702
|
}));
|
|
702
|
-
} else
|
|
703
|
-
txnHash:
|
|
703
|
+
} else be && (l({
|
|
704
|
+
txnHash: h,
|
|
704
705
|
status: "Failed",
|
|
705
|
-
revertReason:
|
|
706
|
+
revertReason: ge?.message || "Failed to get receipt",
|
|
706
707
|
gasUsed: void 0,
|
|
707
708
|
effectiveGasPrice: void 0
|
|
708
|
-
}),
|
|
709
|
+
}), $(null));
|
|
709
710
|
}
|
|
710
711
|
}, [
|
|
711
|
-
|
|
712
|
-
|
|
712
|
+
h,
|
|
713
|
+
Z,
|
|
713
714
|
ye,
|
|
714
|
-
|
|
715
|
-
M,
|
|
716
|
-
fe,
|
|
715
|
+
be,
|
|
717
716
|
D,
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
717
|
+
ge,
|
|
718
|
+
Q,
|
|
719
|
+
j,
|
|
720
|
+
c,
|
|
721
|
+
E?.status,
|
|
722
|
+
E?.txnHash,
|
|
723
|
+
g,
|
|
724
|
+
Y
|
|
725
|
+
]), x(() => {
|
|
726
|
+
c && C.isSuccess && s?.chainId && i.chainId === s.chainId && !s.error && s.to && s.data !== null && s.value !== null && !r.isPending && !Z && !h && !ie && !E && !J && (t.console.log("Auto-executing transaction: All conditions met."), F(!0), l({
|
|
726
727
|
status: "Sending..."
|
|
727
|
-
}),
|
|
728
|
+
}), r.sendTransaction(
|
|
728
729
|
{
|
|
729
730
|
to: s.to,
|
|
730
731
|
data: s.data,
|
|
@@ -733,87 +734,87 @@ function Xn(u) {
|
|
|
733
734
|
},
|
|
734
735
|
{
|
|
735
736
|
onSuccess: (n) => {
|
|
736
|
-
t.console.log("Auto-executed transaction sent, hash:", n),
|
|
737
|
+
t.console.log("Auto-executed transaction sent, hash:", n), O(n);
|
|
737
738
|
},
|
|
738
739
|
onError: (n) => {
|
|
739
|
-
t.console.error("Auto-executed transaction failed:", n), n instanceof Error && (n.message.includes("User rejected") || n.message.includes("user rejected")) &&
|
|
740
|
+
t.console.error("Auto-executed transaction failed:", n), n instanceof Error && (n.message.includes("User rejected") || n.message.includes("user rejected")) && P(!1), l({
|
|
740
741
|
status: "Failed",
|
|
741
742
|
revertReason: n instanceof Error ? n.message : "Unknown error"
|
|
742
|
-
}),
|
|
743
|
+
}), F(!1);
|
|
743
744
|
}
|
|
744
745
|
}
|
|
745
746
|
));
|
|
746
747
|
}, [
|
|
747
|
-
|
|
748
|
-
|
|
748
|
+
c,
|
|
749
|
+
C.isSuccess,
|
|
749
750
|
s,
|
|
750
751
|
i.chainId,
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
y,
|
|
756
|
-
H,
|
|
757
|
-
a
|
|
758
|
-
]), P(() => {
|
|
759
|
-
C && L && E && B && i.address && f && !S.isPending && !S.isSuccess && (t.console.log("Auto-committing intent configuration..."), G && S.mutate(G));
|
|
760
|
-
}, [
|
|
761
|
-
C,
|
|
762
|
-
G,
|
|
763
|
-
L,
|
|
752
|
+
r.isPending,
|
|
753
|
+
Z,
|
|
754
|
+
h,
|
|
755
|
+
ie,
|
|
764
756
|
E,
|
|
765
|
-
|
|
757
|
+
J,
|
|
758
|
+
r
|
|
759
|
+
]), x(() => {
|
|
760
|
+
c && W && w && p && i.address && M && !C.isPending && !C.isSuccess && (t.console.log("Auto-committing intent configuration..."), te && C.mutate(te));
|
|
761
|
+
}, [
|
|
762
|
+
c,
|
|
763
|
+
te,
|
|
764
|
+
W,
|
|
765
|
+
w,
|
|
766
|
+
p,
|
|
766
767
|
i.address,
|
|
767
|
-
|
|
768
|
-
|
|
768
|
+
M,
|
|
769
|
+
C
|
|
769
770
|
]);
|
|
770
|
-
const [
|
|
771
|
-
|
|
772
|
-
if (!
|
|
773
|
-
|
|
771
|
+
const [ee, tn] = d(null), [oe, sn] = d(null);
|
|
772
|
+
x(() => {
|
|
773
|
+
if (!M || !W?.[0]?.chainId || !ee || !oe || !w || !i.address) {
|
|
774
|
+
K(null);
|
|
774
775
|
return;
|
|
775
776
|
}
|
|
776
777
|
try {
|
|
777
|
-
const e =
|
|
778
|
+
const e = M;
|
|
778
779
|
if (!e || !Fn(e)) {
|
|
779
|
-
|
|
780
|
+
K(null);
|
|
780
781
|
return;
|
|
781
782
|
}
|
|
782
|
-
let n,
|
|
783
|
-
const
|
|
784
|
-
if (
|
|
785
|
-
const
|
|
786
|
-
(
|
|
783
|
+
let n, m = "0x", S = 0n;
|
|
784
|
+
const y = e;
|
|
785
|
+
if (ee === fe || ee === Ln) {
|
|
786
|
+
const b = w.find(
|
|
787
|
+
(T) => (T.type === "transfer-native" || T.type === "native-balance") && T.chainId === oe
|
|
787
788
|
)?.minAmount?.toString();
|
|
788
|
-
if (
|
|
789
|
+
if (b === void 0)
|
|
789
790
|
throw new Error("Could not find precondition or min amount");
|
|
790
|
-
|
|
791
|
+
S = BigInt(b), n = y;
|
|
791
792
|
} else {
|
|
792
|
-
const
|
|
793
|
-
(
|
|
794
|
-
|
|
795
|
-
|
|
793
|
+
const b = w.find(
|
|
794
|
+
(T) => T.type === "erc20-balance" && T.chainId === oe && T.tokenAddress && ae(
|
|
795
|
+
ne(T.tokenAddress),
|
|
796
|
+
ne(ee)
|
|
796
797
|
)
|
|
797
798
|
)?.minAmount?.toString();
|
|
798
|
-
if (
|
|
799
|
+
if (b === void 0)
|
|
799
800
|
throw new Error("Could not find precondition or min amount");
|
|
800
|
-
|
|
801
|
-
recipient:
|
|
802
|
-
amount: BigInt(
|
|
803
|
-
}), n =
|
|
801
|
+
m = On({
|
|
802
|
+
recipient: y,
|
|
803
|
+
amount: BigInt(b)
|
|
804
|
+
}), n = ee;
|
|
804
805
|
}
|
|
805
|
-
|
|
806
|
+
K({
|
|
806
807
|
to: n,
|
|
807
|
-
data:
|
|
808
|
-
value:
|
|
809
|
-
chainId:
|
|
808
|
+
data: m,
|
|
809
|
+
value: S,
|
|
810
|
+
chainId: oe,
|
|
810
811
|
error: void 0
|
|
811
812
|
});
|
|
812
813
|
} catch (e) {
|
|
813
814
|
t.console.error(
|
|
814
815
|
"[trails-sdk] Failed to calculate origin call params for UI:",
|
|
815
816
|
e
|
|
816
|
-
),
|
|
817
|
+
), K({
|
|
817
818
|
to: null,
|
|
818
819
|
data: null,
|
|
819
820
|
value: null,
|
|
@@ -822,107 +823,107 @@ function Xn(u) {
|
|
|
822
823
|
});
|
|
823
824
|
}
|
|
824
825
|
}, [
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
826
|
+
W,
|
|
827
|
+
ee,
|
|
828
|
+
oe,
|
|
829
|
+
w,
|
|
829
830
|
i.address,
|
|
830
|
-
|
|
831
|
+
M
|
|
831
832
|
]);
|
|
832
|
-
const
|
|
833
|
-
|
|
833
|
+
const f = jn(
|
|
834
|
+
g ?? void 0,
|
|
834
835
|
o
|
|
835
836
|
);
|
|
836
|
-
|
|
837
|
+
x(() => {
|
|
837
838
|
if (t.console.log("[trails-sdk] Intent receipt status update:", {
|
|
838
|
-
intentId:
|
|
839
|
-
done:
|
|
840
|
-
hasReceipt: !!
|
|
841
|
-
}), !
|
|
839
|
+
intentId: g,
|
|
840
|
+
done: f.done,
|
|
841
|
+
hasReceipt: !!f.intentReceipt
|
|
842
|
+
}), !f.intentReceipt) {
|
|
842
843
|
t.console.log("[trails-sdk] No intent receipt yet, waiting...");
|
|
843
844
|
return;
|
|
844
845
|
}
|
|
845
846
|
const e = {};
|
|
846
|
-
if (
|
|
847
|
-
const n =
|
|
848
|
-
e[
|
|
847
|
+
if (f.intentReceipt.originTransaction) {
|
|
848
|
+
const n = f.intentReceipt.originTransaction, m = `${n.chainId}-${n.metaTxnId}`;
|
|
849
|
+
e[m] = { timestamp: null };
|
|
849
850
|
}
|
|
850
|
-
if (
|
|
851
|
-
const n =
|
|
852
|
-
e[
|
|
851
|
+
if (f.intentReceipt.destinationTransaction) {
|
|
852
|
+
const n = f.intentReceipt.destinationTransaction, m = `${n.chainId}-${n.metaTxnId}`;
|
|
853
|
+
e[m] = { timestamp: null };
|
|
853
854
|
}
|
|
854
|
-
|
|
855
|
+
qe(e);
|
|
855
856
|
}, [
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
]),
|
|
860
|
-
if (
|
|
861
|
-
intentId:
|
|
862
|
-
status:
|
|
863
|
-
}),
|
|
864
|
-
const e =
|
|
857
|
+
f.intentReceipt,
|
|
858
|
+
f.done,
|
|
859
|
+
g
|
|
860
|
+
]), x(() => {
|
|
861
|
+
if (f.done && f.intentReceipt && (t.console.log("[trails-sdk] Intent execution completed", {
|
|
862
|
+
intentId: g,
|
|
863
|
+
status: f.intentReceipt.status
|
|
864
|
+
}), f.intentReceipt.originTransaction?.txnHash)) {
|
|
865
|
+
const e = p?.quoteProvider ? String(p.quoteProvider).toLowerCase() : void 0, n = v.variables?.options?.quoteProvider ? String(
|
|
865
866
|
v.variables.options.quoteProvider
|
|
866
867
|
).toLowerCase() : void 0;
|
|
867
868
|
if ((e === "cctp" || n === "cctp") && v.variables)
|
|
868
869
|
try {
|
|
869
870
|
Mn({
|
|
870
|
-
sourceTxHash:
|
|
871
|
+
sourceTxHash: f.intentReceipt.originTransaction.txnHash,
|
|
871
872
|
sourceChainId: v.variables.originChainId,
|
|
872
873
|
destinationChainId: v.variables.destinationChainId,
|
|
873
874
|
trailsClient: o
|
|
874
875
|
});
|
|
875
|
-
} catch (
|
|
876
|
-
t.console.error("[Trails] queueCCTPTransfer error",
|
|
876
|
+
} catch (S) {
|
|
877
|
+
t.console.error("[Trails] queueCCTPTransfer error", S);
|
|
877
878
|
}
|
|
878
879
|
}
|
|
879
880
|
}, [
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
881
|
+
f.done,
|
|
882
|
+
f.intentReceipt,
|
|
883
|
+
g,
|
|
884
|
+
p,
|
|
884
885
|
v.variables,
|
|
885
886
|
o
|
|
886
887
|
]);
|
|
887
888
|
const on = (e) => {
|
|
888
|
-
|
|
889
|
+
P(e);
|
|
889
890
|
};
|
|
890
891
|
function rn(e) {
|
|
891
892
|
v.mutate(e);
|
|
892
893
|
}
|
|
893
894
|
function an(e) {
|
|
894
|
-
t.console.log("[trails-sdk] commitIntent", e),
|
|
895
|
+
t.console.log("[trails-sdk] commitIntent", e), C.mutate(e);
|
|
895
896
|
}
|
|
896
897
|
function cn(e) {
|
|
897
898
|
if (!e) {
|
|
898
|
-
|
|
899
|
+
K(null);
|
|
899
900
|
return;
|
|
900
901
|
}
|
|
901
|
-
const { originChainId: n, tokenAddress:
|
|
902
|
-
sn(n), tn(
|
|
902
|
+
const { originChainId: n, tokenAddress: m } = e;
|
|
903
|
+
sn(n), tn(m);
|
|
903
904
|
}
|
|
904
|
-
const { chainId: ln } = i,
|
|
905
|
+
const { chainId: ln } = i, Oe = s?.chainId, dn = v.isPending, un = v.isSuccess, gn = v.error, mn = v.variables, fn = C.isPending, In = C.isSuccess, hn = C.error, pn = C.variables, vn = Y.isPending, Tn = Y.isSuccess, An = Y.error;
|
|
905
906
|
function Cn(e) {
|
|
906
|
-
|
|
907
|
+
Y.mutate(e);
|
|
907
908
|
}
|
|
908
909
|
return {
|
|
909
910
|
trailsClient: o,
|
|
910
|
-
metaTxns:
|
|
911
|
-
intentCallsPayloads:
|
|
912
|
-
intentPreconditions:
|
|
913
|
-
trailsFee:
|
|
914
|
-
txnHash:
|
|
915
|
-
committedOriginIntentAddress:
|
|
916
|
-
committedDestinationIntentAddress:
|
|
917
|
-
verificationStatus:
|
|
918
|
-
estimatedGas:
|
|
919
|
-
isEstimateError:
|
|
920
|
-
estimateError:
|
|
911
|
+
metaTxns: Q,
|
|
912
|
+
intentCallsPayloads: W,
|
|
913
|
+
intentPreconditions: w,
|
|
914
|
+
trailsFee: p,
|
|
915
|
+
txnHash: h,
|
|
916
|
+
committedOriginIntentAddress: g,
|
|
917
|
+
committedDestinationIntentAddress: pe,
|
|
918
|
+
verificationStatus: _e,
|
|
919
|
+
estimatedGas: ue,
|
|
920
|
+
isEstimateError: ke,
|
|
921
|
+
estimateError: Ee,
|
|
921
922
|
calculateIntentAddress: Hn,
|
|
922
|
-
calculateOriginAndDestinationIntentAddresses:
|
|
923
|
-
committedIntentConfig:
|
|
924
|
-
isLoadingCommittedConfig:
|
|
925
|
-
committedConfigError:
|
|
923
|
+
calculateOriginAndDestinationIntentAddresses: Fe,
|
|
924
|
+
committedIntentConfig: Xe,
|
|
925
|
+
isLoadingCommittedConfig: Je,
|
|
926
|
+
committedConfigError: Ke,
|
|
926
927
|
commitIntent: an,
|
|
927
928
|
commitIntentPending: fn,
|
|
928
929
|
commitIntentSuccess: In,
|
|
@@ -933,31 +934,31 @@ function Xn(u) {
|
|
|
933
934
|
executeIntentSuccess: Tn,
|
|
934
935
|
executeIntentError: An,
|
|
935
936
|
getIntent: Ye,
|
|
936
|
-
operationHashes:
|
|
937
|
+
operationHashes: ve,
|
|
937
938
|
callIntentCallsPayload: Ze,
|
|
938
939
|
sendOriginTransaction: nn,
|
|
939
|
-
switchChain:
|
|
940
|
-
isSwitchingChain:
|
|
941
|
-
switchChainError:
|
|
942
|
-
isTransactionInProgress:
|
|
943
|
-
isChainSwitchRequired: ln !==
|
|
944
|
-
sendTransaction:
|
|
945
|
-
isSendingTransaction:
|
|
946
|
-
originCallStatus:
|
|
947
|
-
updateOriginCallStatus:
|
|
948
|
-
isEstimatingGas:
|
|
949
|
-
isAutoExecute:
|
|
940
|
+
switchChain: Te,
|
|
941
|
+
isSwitchingChain: Ae,
|
|
942
|
+
switchChainError: G,
|
|
943
|
+
isTransactionInProgress: L,
|
|
944
|
+
isChainSwitchRequired: ln !== Oe && !!Oe,
|
|
945
|
+
sendTransaction: r.sendTransaction,
|
|
946
|
+
isSendingTransaction: r.isPending,
|
|
947
|
+
originCallStatus: E,
|
|
948
|
+
updateOriginCallStatus: H,
|
|
949
|
+
isEstimatingGas: Ce,
|
|
950
|
+
isAutoExecute: c,
|
|
950
951
|
updateAutoExecute: on,
|
|
951
|
-
receipt:
|
|
952
|
-
isWaitingForReceipt:
|
|
952
|
+
receipt: D,
|
|
953
|
+
isWaitingForReceipt: Z,
|
|
953
954
|
receiptIsSuccess: ye,
|
|
954
|
-
receiptIsError:
|
|
955
|
-
receiptError:
|
|
956
|
-
hasAutoExecuted:
|
|
957
|
-
originCallSuccess:
|
|
958
|
-
sentMetaTxns:
|
|
955
|
+
receiptIsError: be,
|
|
956
|
+
receiptError: ge,
|
|
957
|
+
hasAutoExecuted: J,
|
|
958
|
+
originCallSuccess: r.isSuccess,
|
|
959
|
+
sentMetaTxns: j,
|
|
959
960
|
clearIntent: en,
|
|
960
|
-
intentReceiptStatus:
|
|
961
|
+
intentReceiptStatus: f,
|
|
961
962
|
createIntent: rn,
|
|
962
963
|
createIntentPending: dn,
|
|
963
964
|
createIntentSuccess: un,
|
|
@@ -965,10 +966,10 @@ function Xn(u) {
|
|
|
965
966
|
createIntentArgs: mn,
|
|
966
967
|
originCallParams: s,
|
|
967
968
|
updateOriginCallParams: cn,
|
|
968
|
-
originBlockTimestamp:
|
|
969
|
-
metaTxnBlockTimestamps:
|
|
970
|
-
originIntentAddress:
|
|
971
|
-
destinationIntentAddress:
|
|
969
|
+
originBlockTimestamp: I,
|
|
970
|
+
metaTxnBlockTimestamps: we,
|
|
971
|
+
originIntentAddress: M,
|
|
972
|
+
destinationIntentAddress: le
|
|
972
973
|
};
|
|
973
974
|
}
|
|
974
975
|
export {
|
|
@@ -979,20 +980,20 @@ export {
|
|
|
979
980
|
tt as TrailsWidget,
|
|
980
981
|
st as UserRejectionError,
|
|
981
982
|
Hn as calculateIntentAddress,
|
|
982
|
-
|
|
983
|
+
Fe as calculateOriginAndDestinationIntentAddresses,
|
|
983
984
|
it as commitIntent,
|
|
984
985
|
ot as createModalController,
|
|
985
986
|
rt as declareSequenceEnv,
|
|
986
987
|
at as getAccountTotalBalanceUsd,
|
|
987
988
|
ct as getAccountTransactionHistory,
|
|
988
989
|
lt as getAllChains,
|
|
989
|
-
|
|
990
|
+
Re as getChainInfo,
|
|
990
991
|
dt as getDebug,
|
|
991
992
|
On as getERC20TransferData,
|
|
992
993
|
ut as getHasSufficientBalanceToken,
|
|
993
994
|
gt as getHasSufficientBalanceUsd,
|
|
994
995
|
mt as getIndexerGatewayClient,
|
|
995
|
-
|
|
996
|
+
Le as getIntent,
|
|
996
997
|
ft as getIntentTransactionHistory,
|
|
997
998
|
It as getIsUserRejectionError,
|
|
998
999
|
ht as getMinLogLevel,
|
|
@@ -1003,9 +1004,9 @@ export {
|
|
|
1003
1004
|
Ct as getSlippageTolerance,
|
|
1004
1005
|
St as getSupportedChains,
|
|
1005
1006
|
wt as getSupportedTokens,
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1007
|
+
kt as getTrailsApiUrl,
|
|
1008
|
+
Et as getTrailsClient,
|
|
1009
|
+
yt as getTxTimeDiff,
|
|
1009
1010
|
bt as getWalletConnectProjectId,
|
|
1010
1011
|
t as logger,
|
|
1011
1012
|
xt as pollIntentReceipt,
|
|
@@ -1021,18 +1022,18 @@ export {
|
|
|
1021
1022
|
Ft as setWalletConnectProjectId,
|
|
1022
1023
|
Lt as useAccountTotalBalanceUsd,
|
|
1023
1024
|
Bt as useAccountTransactionHistory,
|
|
1024
|
-
|
|
1025
|
-
|
|
1025
|
+
We as useCommitIntent,
|
|
1026
|
+
Ve as useExecuteIntent,
|
|
1026
1027
|
Nt as useHasSufficientBalanceToken,
|
|
1027
|
-
|
|
1028
|
-
|
|
1028
|
+
Gt as useHasSufficientBalanceUsd,
|
|
1029
|
+
En as useIndexerGatewayClient,
|
|
1029
1030
|
jn as useIntentReceiptMonitor,
|
|
1030
|
-
|
|
1031
|
-
|
|
1031
|
+
$t as useIntentTransactionHistory,
|
|
1032
|
+
Xn as useQuote,
|
|
1032
1033
|
jt as useSupportedChains,
|
|
1033
|
-
|
|
1034
|
+
yn as useSupportedTokens,
|
|
1034
1035
|
Qt as useTokenBalances,
|
|
1035
1036
|
Wt as useTokenList,
|
|
1036
|
-
|
|
1037
|
-
|
|
1037
|
+
Jn as useTrails,
|
|
1038
|
+
Ie as useTrailsClient
|
|
1038
1039
|
};
|