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