@orbs-network/spot-react 2.1.7 → 2.1.9
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/spot-react/src/context/create-spot-store.d.ts +1 -1
- package/dist/spot-react/src/context/create-spot-store.d.ts.map +1 -1
- package/dist/spot-react/src/hooks/order-hooks.d.ts +1 -1
- package/dist/spot-react/src/hooks/use-cancel-order.d.ts +1 -1
- package/dist/spot-react/src/hooks/use-cancel-order.d.ts.map +1 -1
- package/dist/spot-react.js +561 -563
- package/dist/spot-react.umd.cjs +1 -1
- package/package.json +2 -2
package/dist/spot-react.js
CHANGED
|
@@ -2,24 +2,24 @@
|
|
|
2
2
|
var Fe = Object.defineProperty;
|
|
3
3
|
var xe = (e, t, n) => t in e ? Fe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
4
4
|
var oe = (e, t, n) => xe(e, typeof t != "symbol" ? t + "" : t, n);
|
|
5
|
-
import { OrderStatus as
|
|
6
|
-
import { DISCLAIMER_URL as
|
|
7
|
-
import { jsx as
|
|
8
|
-
import { createContext as le, useContext as me, useState as Ke, useCallback as v, useEffect as
|
|
5
|
+
import { OrderStatus as J, Module as b, createClient as Ue, analytics as U, getTwapConfig as ve, calculateOrderForm as De, getPartnerChains as Ge, isNativeAddress as $, eqIgnoreCase as fe, toAmountRaw as ee, toAmountUI as ie, isTxRejected as Ce, getOrderLimitPriceRate as Me, getTriggerPriceRate as _e, getOrderExecutionRate as Re, getOrderFillDelayMillis as Be, invertPriceInput as he, setUIVersion as qe } from "@orbs-network/spot-ui";
|
|
6
|
+
import { DISCLAIMER_URL as ar, InputErrors as cr, Module as dr, ORBS_LOGO as ur, ORBS_SLTP_FAQ_URL as lr, ORBS_TWAP_FAQ_URL as mr, ORBS_WEBSITE_URL as gr, OrderFilter as Pr, OrderStatus as fr, OrderType as hr, Partners as Sr, SPOT_VERSION as Er, TimeUnit as Ir, calculateOrderForm as Or, createClient as pr, eqIgnoreCase as Ar, getOrderExecutionRate as wr, getOrderFillDelayMillis as vr, getOrderLimitPriceRate as Cr, getPartnerChains as Rr, getPartners as yr, getTriggerPriceRate as Tr, getTwapConfig as Nr, invertPriceInput as Lr, isNativeAddress as Fr, isTxRejected as xr, toAmountRaw as Ur, toAmountUI as Dr } from "@orbs-network/spot-ui";
|
|
7
|
+
import { jsx as D, jsxs as ue, Fragment as We } from "react/jsx-runtime";
|
|
8
|
+
import { createContext as le, useContext as me, useState as Ke, useCallback as v, useEffect as X, useMemo as C, Component as Ve, useRef as He } from "react";
|
|
9
9
|
import { useStore as je } from "zustand";
|
|
10
10
|
import { createStore as ze } from "zustand/vanilla";
|
|
11
|
-
const Je = "2.1.
|
|
11
|
+
const Je = "2.1.9", Qe = {
|
|
12
12
|
version: Je
|
|
13
13
|
}, ye = le(null), Ye = ({
|
|
14
14
|
children: e,
|
|
15
15
|
value: t
|
|
16
|
-
}) => /* @__PURE__ */
|
|
16
|
+
}) => /* @__PURE__ */ D(ye.Provider, { value: t, children: e }), x = () => {
|
|
17
17
|
const e = me(ye);
|
|
18
18
|
if (e === null)
|
|
19
19
|
throw new Error("useSpotRuntime must be used within SpotProvider");
|
|
20
20
|
return e;
|
|
21
21
|
};
|
|
22
|
-
var
|
|
22
|
+
var q = /* @__PURE__ */ ((e) => (e[e.LOADING = 1] = "LOADING", e[e.SUCCESS = 2] = "SUCCESS", e[e.FAILED = 3] = "FAILED", e))(q || {}), d = /* @__PURE__ */ ((e) => (e.IDLE = "idle", e.PREPARING = "preparing", e.WRAPPING = "wrapping", e.APPROVING = "approving", e.SIGNING = "signing", e.SUBMITTING = "submitting", e.SUCCESS = "success", e.FAILED = "failed", e.REJECTED = "rejected", e))(d || {}), te = /* @__PURE__ */ ((e) => (e.TRIGGER_MARKET_PRICE = "triggerMarketPriceDisclaimer", e.MARKET_PRICE = "marketOrderDisclaimer", e.LIMIT_PRICE = "limitOrderDisclaimer", e))(te || {}), Q = /* @__PURE__ */ ((e) => (e.WRAP = "wrap", e.APPROVE = "approve", e.CREATE = "create", e))(Q || {});
|
|
23
23
|
const $e = /* @__PURE__ */ new Set([
|
|
24
24
|
d.PREPARING,
|
|
25
25
|
d.WRAPPING,
|
|
@@ -66,16 +66,16 @@ const $e = /* @__PURE__ */ new Set([
|
|
|
66
66
|
}, re = (e) => ({
|
|
67
67
|
phase: d.IDLE,
|
|
68
68
|
completedWrap: e
|
|
69
|
-
}),
|
|
70
|
-
if (
|
|
71
|
-
if (e === d.SUCCESS) return
|
|
69
|
+
}), Y = (e) => $e.has(e), Ze = (e) => e === d.IDLE || e === d.FAILED || e === d.REJECTED, be = (e, t) => Xe[e].has(t), ke = (e) => {
|
|
70
|
+
if (Y(e)) return q.LOADING;
|
|
71
|
+
if (e === d.SUCCESS) return q.SUCCESS;
|
|
72
72
|
if (e === d.FAILED || e === d.REJECTED)
|
|
73
|
-
return
|
|
73
|
+
return q.FAILED;
|
|
74
74
|
}, et = (e) => {
|
|
75
|
-
if (e === d.WRAPPING) return
|
|
76
|
-
if (e === d.APPROVING) return
|
|
75
|
+
if (e === d.WRAPPING) return Q.WRAP;
|
|
76
|
+
if (e === d.APPROVING) return Q.APPROVE;
|
|
77
77
|
if (e === d.SIGNING || e === d.SUBMITTING)
|
|
78
|
-
return
|
|
78
|
+
return Q.CREATE;
|
|
79
79
|
}, ge = (e) => {
|
|
80
80
|
if (e instanceof Error) return e.message;
|
|
81
81
|
if (typeof e == "string") return e;
|
|
@@ -94,7 +94,7 @@ const $e = /* @__PURE__ */ new Set([
|
|
|
94
94
|
message: t.replace(/^error\s*:/i, "").replace(/,\s*code\s*:\s*-?\d+/i, "").trim() || "Unknown error",
|
|
95
95
|
code: tt(e) || (n ? Number(n[1]) : 0)
|
|
96
96
|
};
|
|
97
|
-
},
|
|
97
|
+
}, E = (e) => {
|
|
98
98
|
if (e)
|
|
99
99
|
try {
|
|
100
100
|
const t = e();
|
|
@@ -130,16 +130,16 @@ const $e = /* @__PURE__ */ new Set([
|
|
|
130
130
|
};
|
|
131
131
|
for (const r of n.all)
|
|
132
132
|
switch (r.status) {
|
|
133
|
-
case
|
|
133
|
+
case J.Open:
|
|
134
134
|
n.open.push(r);
|
|
135
135
|
break;
|
|
136
|
-
case
|
|
136
|
+
case J.Completed:
|
|
137
137
|
n.completed.push(r);
|
|
138
138
|
break;
|
|
139
|
-
case
|
|
139
|
+
case J.Cancelled:
|
|
140
140
|
n.cancelled.push(r);
|
|
141
141
|
break;
|
|
142
|
-
case
|
|
142
|
+
case J.Expired:
|
|
143
143
|
n.expired.push(r);
|
|
144
144
|
break;
|
|
145
145
|
}
|
|
@@ -157,12 +157,12 @@ const $e = /* @__PURE__ */ new Set([
|
|
|
157
157
|
for (const i of e) {
|
|
158
158
|
if (i.version !== 2) continue;
|
|
159
159
|
const s = r.get(i.historyKey);
|
|
160
|
-
!s || s.progress === i.progress || (o.push(s), s.status ===
|
|
160
|
+
!s || s.progress === i.progress || (o.push(s), s.status === J.Completed && E(() => {
|
|
161
161
|
var a;
|
|
162
162
|
return (a = n == null ? void 0 : n.onOrderFilled) == null ? void 0 : a.call(n, s);
|
|
163
163
|
}));
|
|
164
164
|
}
|
|
165
|
-
o.length > 0 &&
|
|
165
|
+
o.length > 0 && E(() => {
|
|
166
166
|
var i;
|
|
167
167
|
return (i = n == null ? void 0 : n.onOrdersProgressUpdate) == null ? void 0 : i.call(n, o);
|
|
168
168
|
});
|
|
@@ -204,13 +204,13 @@ const $e = /* @__PURE__ */ new Set([
|
|
|
204
204
|
cancelOrders: {},
|
|
205
205
|
currentExecution: re()
|
|
206
206
|
}), Oe = { isFetching: !1 }, pe = { isFetching: !1 }, dt = (e) => new Promise((t) => setTimeout(t, e)), ut = (e) => {
|
|
207
|
-
let t = 0, n, r, o = 0, i, s, a, c = !1,
|
|
208
|
-
return ze((
|
|
209
|
-
const
|
|
207
|
+
let t = 0, n, r, o = 0, i, s, a, c = !1, f = 0, O = 0, u, l, h;
|
|
208
|
+
return ze((m, S) => {
|
|
209
|
+
const R = async () => {
|
|
210
210
|
if (!n || !r) return;
|
|
211
211
|
if (i) return i;
|
|
212
|
-
const g = ++o,
|
|
213
|
-
|
|
212
|
+
const g = ++o, P = r;
|
|
213
|
+
m((I) => ({
|
|
214
214
|
client: {
|
|
215
215
|
key: n,
|
|
216
216
|
data: I.client.data,
|
|
@@ -223,8 +223,8 @@ const $e = /* @__PURE__ */ new Set([
|
|
|
223
223
|
for (let A = 0; A < 3; A++) {
|
|
224
224
|
if (g !== o) return;
|
|
225
225
|
try {
|
|
226
|
-
const y = await
|
|
227
|
-
return g !== o ? void 0 : (
|
|
226
|
+
const y = await P();
|
|
227
|
+
return g !== o ? void 0 : (m({
|
|
228
228
|
client: { key: n, data: y, isFetching: !1 }
|
|
229
229
|
}), y);
|
|
230
230
|
} catch (y) {
|
|
@@ -232,170 +232,174 @@ const $e = /* @__PURE__ */ new Set([
|
|
|
232
232
|
A < 2 && await dt(2 ** A * 1e3);
|
|
233
233
|
}
|
|
234
234
|
}
|
|
235
|
-
g === o &&
|
|
235
|
+
g === o && m({
|
|
236
236
|
client: { key: n, error: I, isFetching: !1 }
|
|
237
237
|
});
|
|
238
238
|
})();
|
|
239
239
|
return i = p, p.finally(() => {
|
|
240
240
|
i === p && (i = void 0);
|
|
241
241
|
}), p;
|
|
242
|
-
},
|
|
243
|
-
if (!g &&
|
|
244
|
-
return
|
|
245
|
-
if (
|
|
246
|
-
|
|
247
|
-
|
|
242
|
+
}, T = async (g = !1, P = !1) => {
|
|
243
|
+
if (!g && f === 0 || !s || !a)
|
|
244
|
+
return S().orders.data;
|
|
245
|
+
if (u) {
|
|
246
|
+
if (!P) return u;
|
|
247
|
+
const L = s;
|
|
248
|
+
return await u, s !== L ? void 0 : T(g, P);
|
|
249
|
+
}
|
|
250
|
+
const p = ++O, I = a, A = S().orders.data, y = new AbortController();
|
|
251
|
+
l = y, m((L) => ({
|
|
248
252
|
orders: {
|
|
249
253
|
key: s,
|
|
250
|
-
data:
|
|
254
|
+
data: L.orders.data,
|
|
251
255
|
error: void 0,
|
|
252
256
|
isFetching: !0
|
|
253
257
|
}
|
|
254
258
|
}));
|
|
255
|
-
const
|
|
256
|
-
|
|
257
|
-
c,
|
|
258
|
-
|
|
259
|
-
).then(({ orders:
|
|
260
|
-
if (
|
|
261
|
-
c =
|
|
262
|
-
const
|
|
263
|
-
|
|
264
|
-
|
|
259
|
+
const N = I(
|
|
260
|
+
A,
|
|
261
|
+
P ? !1 : c,
|
|
262
|
+
y.signal
|
|
263
|
+
).then(({ orders: L, legacyLoaded: G }) => {
|
|
264
|
+
if (p !== O) return;
|
|
265
|
+
c = G;
|
|
266
|
+
const V = at(
|
|
267
|
+
S().orders.data,
|
|
268
|
+
L
|
|
265
269
|
);
|
|
266
|
-
return
|
|
270
|
+
return m({
|
|
267
271
|
orders: {
|
|
268
272
|
key: s,
|
|
269
|
-
data:
|
|
273
|
+
data: V,
|
|
270
274
|
isFetching: !1
|
|
271
275
|
}
|
|
272
|
-
}),
|
|
273
|
-
}).catch((
|
|
274
|
-
if (
|
|
276
|
+
}), V;
|
|
277
|
+
}).catch((L) => {
|
|
278
|
+
if (p !== O || y.signal.aborted)
|
|
275
279
|
return;
|
|
276
|
-
const
|
|
277
|
-
|
|
280
|
+
const G = L instanceof Error ? L : new Error(String(L));
|
|
281
|
+
m((V) => ({
|
|
278
282
|
orders: {
|
|
279
283
|
key: s,
|
|
280
|
-
data:
|
|
281
|
-
error:
|
|
284
|
+
data: V.orders.data,
|
|
285
|
+
error: G,
|
|
282
286
|
isFetching: !1
|
|
283
287
|
}
|
|
284
288
|
}));
|
|
285
289
|
});
|
|
286
|
-
return
|
|
287
|
-
|
|
288
|
-
}),
|
|
289
|
-
},
|
|
290
|
-
|
|
291
|
-
},
|
|
292
|
-
|
|
290
|
+
return u = N, N.finally(() => {
|
|
291
|
+
u === N && (u = void 0), l === y && (l = void 0);
|
|
292
|
+
}), N;
|
|
293
|
+
}, K = () => {
|
|
294
|
+
T();
|
|
295
|
+
}, M = () => {
|
|
296
|
+
h && (clearInterval(h), h = void 0), typeof window < "u" && window.removeEventListener("focus", K), l == null || l.abort(), l = void 0, u = void 0, O++, m((g) => ({
|
|
293
297
|
orders: { ...g.orders, isFetching: !1 }
|
|
294
298
|
}));
|
|
295
299
|
}, _ = () => {
|
|
296
|
-
!s || !a ||
|
|
297
|
-
|
|
298
|
-
}, it), typeof window < "u" && window.addEventListener("focus",
|
|
300
|
+
!s || !a || h || (T(!0), h = setInterval(() => {
|
|
301
|
+
T();
|
|
302
|
+
}, it), typeof window < "u" && window.addEventListener("focus", K));
|
|
299
303
|
};
|
|
300
304
|
return {
|
|
301
305
|
client: Oe,
|
|
302
306
|
orders: pe,
|
|
303
307
|
state: ct(e),
|
|
304
|
-
configureClient: (g,
|
|
308
|
+
configureClient: (g, P) => {
|
|
305
309
|
if (n === g) {
|
|
306
|
-
r =
|
|
310
|
+
r = P;
|
|
307
311
|
return;
|
|
308
312
|
}
|
|
309
|
-
n = g, r =
|
|
313
|
+
n = g, r = P, o++, i = void 0, m({
|
|
310
314
|
client: g ? { key: g, isFetching: !1 } : Oe
|
|
311
|
-
}), g &&
|
|
315
|
+
}), g && P && R();
|
|
312
316
|
},
|
|
313
|
-
refetchClient:
|
|
314
|
-
configureOrders: (g,
|
|
317
|
+
refetchClient: R,
|
|
318
|
+
configureOrders: (g, P) => {
|
|
315
319
|
if (s === g) {
|
|
316
|
-
a =
|
|
320
|
+
a = P;
|
|
317
321
|
return;
|
|
318
322
|
}
|
|
319
|
-
|
|
323
|
+
M(), s = g, a = P, c = !1, m({
|
|
320
324
|
orders: g ? { key: g, isFetching: !1 } : pe
|
|
321
|
-
}),
|
|
325
|
+
}), f > 0 && _();
|
|
322
326
|
},
|
|
323
|
-
registerOrdersConsumer: () => (
|
|
324
|
-
|
|
327
|
+
registerOrdersConsumer: () => (f++, f === 1 && _(), () => {
|
|
328
|
+
f = Math.max(0, f - 1), f === 0 && M();
|
|
325
329
|
}),
|
|
326
|
-
refetchOrders:
|
|
330
|
+
refetchOrders: T,
|
|
327
331
|
addOrder: (g) => {
|
|
328
|
-
|
|
329
|
-
const p =
|
|
332
|
+
m((P) => {
|
|
333
|
+
const p = P.orders.data;
|
|
330
334
|
return p != null && p.some(
|
|
331
335
|
(I) => I.historyKey === g.historyKey
|
|
332
|
-
) ?
|
|
336
|
+
) ? P : {
|
|
333
337
|
orders: {
|
|
334
|
-
...
|
|
338
|
+
...P.orders,
|
|
335
339
|
data: [g, ...p ?? []]
|
|
336
340
|
}
|
|
337
341
|
};
|
|
338
342
|
});
|
|
339
343
|
},
|
|
340
|
-
updateOrderStatus: (g,
|
|
341
|
-
|
|
344
|
+
updateOrderStatus: (g, P) => {
|
|
345
|
+
m((p) => {
|
|
342
346
|
var I;
|
|
343
347
|
return {
|
|
344
348
|
orders: {
|
|
345
349
|
...p.orders,
|
|
346
350
|
data: (I = p.orders.data) == null ? void 0 : I.map(
|
|
347
|
-
(A) => A.historyKey === g ? { ...A, status:
|
|
351
|
+
(A) => A.historyKey === g ? { ...A, status: P } : A
|
|
348
352
|
)
|
|
349
353
|
}
|
|
350
354
|
};
|
|
351
355
|
});
|
|
352
356
|
},
|
|
353
|
-
updateState: (g) =>
|
|
357
|
+
updateState: (g) => m((P) => ({ state: { ...P.state, ...g } })),
|
|
354
358
|
beginExecution: (g) => {
|
|
355
|
-
let
|
|
356
|
-
return
|
|
359
|
+
let P;
|
|
360
|
+
return m((p) => Ze(p.state.currentExecution.phase) ? (P = {
|
|
357
361
|
...g,
|
|
358
362
|
executionId: ++t,
|
|
359
363
|
phase: d.PREPARING
|
|
360
364
|
}, {
|
|
361
365
|
state: {
|
|
362
366
|
...p.state,
|
|
363
|
-
currentExecution:
|
|
367
|
+
currentExecution: P
|
|
364
368
|
}
|
|
365
|
-
}) : p),
|
|
369
|
+
}) : p), P;
|
|
366
370
|
},
|
|
367
|
-
replaceExecution: (g,
|
|
371
|
+
replaceExecution: (g, P) => {
|
|
368
372
|
let p = !1;
|
|
369
|
-
return
|
|
373
|
+
return m((I) => {
|
|
370
374
|
const A = I.state.currentExecution;
|
|
371
|
-
return A.executionId !== g ||
|
|
372
|
-
state: { ...I.state, currentExecution:
|
|
375
|
+
return A.executionId !== g || P.executionId !== g || !be(A.phase, P.phase) ? I : (p = !0, {
|
|
376
|
+
state: { ...I.state, currentExecution: P }
|
|
373
377
|
});
|
|
374
378
|
}), p;
|
|
375
379
|
},
|
|
376
380
|
returnToOrderForm: () => {
|
|
377
|
-
const g =
|
|
378
|
-
return
|
|
381
|
+
const g = S().state.currentExecution;
|
|
382
|
+
return Y(g.phase) || g.phase === d.SUCCESS ? !1 : (m((P) => ({
|
|
379
383
|
state: {
|
|
380
|
-
...
|
|
384
|
+
...P.state,
|
|
381
385
|
currentExecution: re(g.completedWrap)
|
|
382
386
|
}
|
|
383
387
|
})), !0);
|
|
384
388
|
},
|
|
385
|
-
syncFormDefaults: (g) =>
|
|
389
|
+
syncFormDefaults: (g) => Y(S().state.currentExecution.phase) ? !1 : (m((P) => ({
|
|
386
390
|
state: {
|
|
387
|
-
...
|
|
391
|
+
...P.state,
|
|
388
392
|
...ce(g),
|
|
389
393
|
currentExecution: re()
|
|
390
394
|
}
|
|
391
395
|
})), !0),
|
|
392
396
|
startNewOrder: (g) => {
|
|
393
|
-
const { state:
|
|
394
|
-
return
|
|
397
|
+
const { state: P } = S();
|
|
398
|
+
return Y(P.currentExecution.phase) ? !1 : (m((p) => ({
|
|
395
399
|
state: {
|
|
396
400
|
...p.state,
|
|
397
401
|
...ce(g),
|
|
398
|
-
isMarketOrder:
|
|
402
|
+
isMarketOrder: P.isMarketOrder,
|
|
399
403
|
currentExecution: re()
|
|
400
404
|
}
|
|
401
405
|
})), !0);
|
|
@@ -406,7 +410,7 @@ const $e = /* @__PURE__ */ new Set([
|
|
|
406
410
|
var n;
|
|
407
411
|
const t = (n = e.overrides) == null ? void 0 : n.state;
|
|
408
412
|
return {
|
|
409
|
-
isMarketOrder: e.module ===
|
|
413
|
+
isMarketOrder: e.module === b.LIMIT ? !1 : t == null ? void 0 : t.isMarketOrder,
|
|
410
414
|
tradeCount: t == null ? void 0 : t.tradeCount,
|
|
411
415
|
tradeInterval: t == null ? void 0 : t.tradeInterval,
|
|
412
416
|
orderDuration: t == null ? void 0 : t.orderDuration,
|
|
@@ -415,49 +419,49 @@ const $e = /* @__PURE__ */ new Set([
|
|
|
415
419
|
triggerPricePercent: t == null ? void 0 : t.triggerPricePercent,
|
|
416
420
|
limitPricePercent: t == null ? void 0 : t.limitPricePercent
|
|
417
421
|
};
|
|
418
|
-
},
|
|
422
|
+
}, Ne = le(null), lt = ({
|
|
419
423
|
children: e,
|
|
420
424
|
initialState: t
|
|
421
425
|
}) => {
|
|
422
426
|
const [n] = Ke(() => ut(t));
|
|
423
|
-
return /* @__PURE__ */
|
|
424
|
-
},
|
|
425
|
-
const e = me(
|
|
427
|
+
return /* @__PURE__ */ D(Ne.Provider, { value: n, children: e });
|
|
428
|
+
}, z = () => {
|
|
429
|
+
const e = me(Ne);
|
|
426
430
|
if (e === null)
|
|
427
431
|
throw new Error("useSpotStore must be used within SpotProvider");
|
|
428
432
|
return e;
|
|
429
|
-
},
|
|
430
|
-
const t =
|
|
433
|
+
}, w = (e) => {
|
|
434
|
+
const t = z();
|
|
431
435
|
return je(t, e);
|
|
432
|
-
}, mt = { isFetching: !1 },
|
|
433
|
-
const { partner: e, chainId: t, isSupportedChain: n } =
|
|
436
|
+
}, mt = { isFetching: !1 }, Z = () => {
|
|
437
|
+
const { partner: e, chainId: t, isSupportedChain: n } = x(), r = z(), o = w((O) => O.client), i = !!(t && n), s = i ? `${e}:${t}` : void 0, a = o.key === s ? o : mt, c = v(() => t ? Ue(e, t) : Promise.reject(
|
|
434
438
|
new Error("Spot is unavailable on the connected chain")
|
|
435
439
|
), [t, e]);
|
|
436
|
-
|
|
440
|
+
X(() => {
|
|
437
441
|
r.getState().configureClient(s, i ? c : void 0);
|
|
438
442
|
}, [i, s, c, r]);
|
|
439
|
-
const
|
|
443
|
+
const f = v(() => {
|
|
440
444
|
if (!i || !s) return Promise.resolve(void 0);
|
|
441
445
|
const O = r.getState();
|
|
442
446
|
return O.configureClient(s, c), O.refetchClient();
|
|
443
447
|
}, [i, s, c, r]);
|
|
444
|
-
return
|
|
448
|
+
return C(
|
|
445
449
|
() => ({
|
|
446
450
|
data: a.data,
|
|
447
451
|
error: a.error,
|
|
448
452
|
isLoading: i && !a.data && a.error === void 0,
|
|
449
453
|
isFetching: a.isFetching,
|
|
450
|
-
refetch:
|
|
454
|
+
refetch: f
|
|
451
455
|
}),
|
|
452
|
-
[a, i,
|
|
456
|
+
[a, i, f]
|
|
453
457
|
);
|
|
454
458
|
}, gt = ({
|
|
455
459
|
error: e,
|
|
456
460
|
retry: t,
|
|
457
461
|
isRetrying: n
|
|
458
462
|
}) => /* @__PURE__ */ ue("div", { className: "spot-client-error-fallback", role: "alert", children: [
|
|
459
|
-
/* @__PURE__ */
|
|
460
|
-
/* @__PURE__ */
|
|
463
|
+
/* @__PURE__ */ D("p", { children: e.message || "Unable to load Spot configuration." }),
|
|
464
|
+
/* @__PURE__ */ D(
|
|
461
465
|
"button",
|
|
462
466
|
{
|
|
463
467
|
type: "button",
|
|
@@ -471,11 +475,11 @@ const $e = /* @__PURE__ */ new Set([
|
|
|
471
475
|
children: e,
|
|
472
476
|
fallback: t = gt
|
|
473
477
|
}) => {
|
|
474
|
-
const { partner: n, chainId: r, isSupportedChain: o, minTradeSizeUsd: i } =
|
|
475
|
-
await
|
|
476
|
-
}, [
|
|
477
|
-
return
|
|
478
|
-
!s || !r || !o ||
|
|
478
|
+
const { partner: n, chainId: r, isSupportedChain: o, minTradeSizeUsd: i } = x(), { data: s, error: a, isFetching: c, refetch: f } = Z(), O = v(async () => {
|
|
479
|
+
await f();
|
|
480
|
+
}, [f]);
|
|
481
|
+
return X(() => {
|
|
482
|
+
!s || !r || !o || U.onFetchedConfig(
|
|
479
483
|
s.rePermitData,
|
|
480
484
|
n,
|
|
481
485
|
ve(n, r),
|
|
@@ -483,7 +487,7 @@ const $e = /* @__PURE__ */ new Set([
|
|
|
483
487
|
);
|
|
484
488
|
}, [r, s, o, i, n]), /* @__PURE__ */ ue(We, { children: [
|
|
485
489
|
e,
|
|
486
|
-
!s && a && o ? /* @__PURE__ */
|
|
490
|
+
!s && a && o ? /* @__PURE__ */ D(
|
|
487
491
|
t,
|
|
488
492
|
{
|
|
489
493
|
error: a,
|
|
@@ -495,12 +499,12 @@ const $e = /* @__PURE__ */ new Set([
|
|
|
495
499
|
}, ft = ({
|
|
496
500
|
resetErrorBoundary: e
|
|
497
501
|
}) => /* @__PURE__ */ ue("div", { className: "twap-error-fallback", role: "alert", children: [
|
|
498
|
-
/* @__PURE__ */
|
|
499
|
-
/* @__PURE__ */
|
|
502
|
+
/* @__PURE__ */ D("p", { children: "Something went wrong" }),
|
|
503
|
+
/* @__PURE__ */ D("button", { type: "button", onClick: e, children: "Retry" })
|
|
500
504
|
] }), ht = ({
|
|
501
505
|
children: e,
|
|
502
506
|
fallback: t = ft
|
|
503
|
-
}) => /* @__PURE__ */
|
|
507
|
+
}) => /* @__PURE__ */ D(St, { fallback: t, children: e });
|
|
504
508
|
class St extends Ve {
|
|
505
509
|
constructor() {
|
|
506
510
|
super(...arguments);
|
|
@@ -513,13 +517,13 @@ class St extends Ve {
|
|
|
513
517
|
return { error: n };
|
|
514
518
|
}
|
|
515
519
|
componentDidCatch(n) {
|
|
516
|
-
|
|
520
|
+
U.onCrash(n);
|
|
517
521
|
}
|
|
518
522
|
render() {
|
|
519
523
|
const { error: n } = this.state;
|
|
520
524
|
if (n) {
|
|
521
525
|
const r = this.props.fallback;
|
|
522
|
-
return /* @__PURE__ */
|
|
526
|
+
return /* @__PURE__ */ D(
|
|
523
527
|
r,
|
|
524
528
|
{
|
|
525
529
|
error: n,
|
|
@@ -535,13 +539,13 @@ const Et = ({
|
|
|
535
539
|
defaults: t,
|
|
536
540
|
scopeKey: n
|
|
537
541
|
}) => {
|
|
538
|
-
const r =
|
|
542
|
+
const r = z(), o = w(
|
|
539
543
|
(s) => s.state.currentExecution.phase
|
|
540
544
|
), i = He(n);
|
|
541
|
-
return
|
|
542
|
-
i.current === n ||
|
|
545
|
+
return X(() => {
|
|
546
|
+
i.current === n || Y(o) || r.getState().syncFormDefaults(t) && (i.current = n);
|
|
543
547
|
}, [t, o, n, r]), e;
|
|
544
|
-
},
|
|
548
|
+
}, Le = le(null), It = ({ children: e }) => {
|
|
545
549
|
const {
|
|
546
550
|
inputToken: t,
|
|
547
551
|
outputToken: n,
|
|
@@ -551,25 +555,25 @@ const Et = ({
|
|
|
551
555
|
outputTokenUsdPrice: s,
|
|
552
556
|
minTradeSizeUsd: a,
|
|
553
557
|
inputBalanceRaw: c,
|
|
554
|
-
displayFeePercent:
|
|
558
|
+
displayFeePercent: f,
|
|
555
559
|
priceProtectionPercent: O,
|
|
556
|
-
module:
|
|
557
|
-
} =
|
|
560
|
+
module: u
|
|
561
|
+
} = x(), l = w((I) => I.state.tradeCount), h = w((I) => I.state.tradeInterval), m = w((I) => I.state.orderDuration), S = w(
|
|
558
562
|
(I) => I.state.limitPriceUi
|
|
559
|
-
),
|
|
563
|
+
), R = w(
|
|
560
564
|
(I) => I.state.triggerPriceUi
|
|
561
|
-
),
|
|
565
|
+
), T = w(
|
|
562
566
|
(I) => I.state.limitPricePercent
|
|
563
|
-
),
|
|
567
|
+
), K = w(
|
|
564
568
|
(I) => I.state.triggerPricePercent
|
|
565
|
-
),
|
|
569
|
+
), M = w(
|
|
566
570
|
(I) => I.state.isPriceInverted
|
|
567
|
-
), _ =
|
|
571
|
+
), _ = w((I) => I.state.isMarketOrder), g = w((I) => {
|
|
568
572
|
const A = I.state.currentExecution;
|
|
569
573
|
return A.phase !== d.IDLE ? A.form : void 0;
|
|
570
|
-
}),
|
|
574
|
+
}), P = C(
|
|
571
575
|
() => ({
|
|
572
|
-
module:
|
|
576
|
+
module: u,
|
|
573
577
|
inputTokenDecimals: (t == null ? void 0 : t.decimals) ?? 0,
|
|
574
578
|
outputTokenDecimals: (n == null ? void 0 : n.decimals) ?? 0,
|
|
575
579
|
quotedOutputAmountRaw: o,
|
|
@@ -577,60 +581,60 @@ const Et = ({
|
|
|
577
581
|
outputTokenUsdPrice: s,
|
|
578
582
|
minTradeSizeUsd: a,
|
|
579
583
|
priceProtectionPercent: O,
|
|
580
|
-
displayFeePercent:
|
|
584
|
+
displayFeePercent: f,
|
|
581
585
|
inputBalanceRaw: c,
|
|
582
586
|
userInput: {
|
|
583
587
|
inputAmountUi: r,
|
|
584
588
|
isMarketOrder: !!_,
|
|
585
|
-
tradeCount:
|
|
586
|
-
tradeInterval:
|
|
587
|
-
orderDuration:
|
|
588
|
-
limitPriceUi:
|
|
589
|
-
limitPricePercent:
|
|
590
|
-
triggerPriceUi:
|
|
591
|
-
triggerPricePercent:
|
|
592
|
-
isPriceInverted:
|
|
589
|
+
tradeCount: l,
|
|
590
|
+
tradeInterval: h,
|
|
591
|
+
orderDuration: m,
|
|
592
|
+
limitPriceUi: S,
|
|
593
|
+
limitPricePercent: T,
|
|
594
|
+
triggerPriceUi: R,
|
|
595
|
+
triggerPricePercent: K,
|
|
596
|
+
isPriceInverted: M
|
|
593
597
|
}
|
|
594
598
|
}),
|
|
595
599
|
[
|
|
596
600
|
n == null ? void 0 : n.decimals,
|
|
597
601
|
s,
|
|
598
|
-
|
|
602
|
+
f,
|
|
599
603
|
o,
|
|
600
604
|
a,
|
|
601
|
-
|
|
605
|
+
u,
|
|
602
606
|
O,
|
|
603
607
|
c,
|
|
604
608
|
t == null ? void 0 : t.decimals,
|
|
605
609
|
i,
|
|
606
|
-
|
|
610
|
+
M,
|
|
607
611
|
_,
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
u,
|
|
612
|
+
T,
|
|
613
|
+
K,
|
|
611
614
|
l,
|
|
612
615
|
m,
|
|
613
|
-
|
|
616
|
+
h,
|
|
617
|
+
S,
|
|
614
618
|
r,
|
|
615
|
-
|
|
619
|
+
R
|
|
616
620
|
]
|
|
617
|
-
), p =
|
|
618
|
-
const I = De(
|
|
621
|
+
), p = C(() => {
|
|
622
|
+
const I = De(P);
|
|
619
623
|
return t && n ? I : {
|
|
620
624
|
...I,
|
|
621
625
|
isReady: !1,
|
|
622
626
|
canSubmit: !1
|
|
623
627
|
};
|
|
624
|
-
}, [t, n,
|
|
625
|
-
return /* @__PURE__ */
|
|
626
|
-
},
|
|
627
|
-
const e = me(
|
|
628
|
+
}, [t, n, P]);
|
|
629
|
+
return /* @__PURE__ */ D(Le.Provider, { value: g ?? p, children: e });
|
|
630
|
+
}, W = () => {
|
|
631
|
+
const e = me(Le);
|
|
628
632
|
if (!e)
|
|
629
633
|
throw new Error("useOrderForm must be used within OrderFormProvider");
|
|
630
634
|
return e;
|
|
631
635
|
}, Ot = (e, t) => {
|
|
632
|
-
|
|
633
|
-
!e.chainId || !t ||
|
|
636
|
+
X(() => {
|
|
637
|
+
!e.chainId || !t || U.init(
|
|
634
638
|
e.partner,
|
|
635
639
|
e.minTradeSizeUsd,
|
|
636
640
|
e.chainId,
|
|
@@ -644,28 +648,28 @@ const Et = ({
|
|
|
644
648
|
t
|
|
645
649
|
]);
|
|
646
650
|
}, pt = (e) => {
|
|
647
|
-
var
|
|
648
|
-
const t =
|
|
649
|
-
() =>
|
|
651
|
+
var u, l, h, m, S, R, T, K, M, _, g, P;
|
|
652
|
+
const t = C(
|
|
653
|
+
() => Ge(e.partner),
|
|
650
654
|
[e.partner]
|
|
651
|
-
), n = !!(e.chainId && t.includes(e.chainId)), r = (
|
|
655
|
+
), n = !!(e.chainId && t.includes(e.chainId)), r = (u = e.wrappedNativeToken) == null ? void 0 : u.address, o = !!(r && ($((l = e.inputToken) == null ? void 0 : l.address) && fe(((h = e.outputToken) == null ? void 0 : h.address) || "", r) || fe(((m = e.inputToken) == null ? void 0 : m.address) || "", r) && $((S = e.outputToken) == null ? void 0 : S.address))), i = o ? ee(e.inputAmountUi, (R = e.outputToken) == null ? void 0 : R.decimals) : e.marketQuote.isLoading ? void 0 : e.marketQuote.quotedOutputAmountRaw, s = o ? !1 : e.marketQuote.isLoading, a = o ? !1 : e.marketQuote.noLiquidity, c = C(
|
|
652
656
|
() => Te({
|
|
653
657
|
module: e.module,
|
|
654
658
|
overrides: e.overrides
|
|
655
659
|
}),
|
|
656
660
|
[e.module, e.overrides]
|
|
657
|
-
),
|
|
661
|
+
), f = JSON.stringify([
|
|
658
662
|
e.partner,
|
|
659
663
|
e.chainId,
|
|
660
664
|
e.module,
|
|
661
|
-
(
|
|
662
|
-
(
|
|
663
|
-
(
|
|
665
|
+
(T = e.inputToken) == null ? void 0 : T.address,
|
|
666
|
+
(K = e.inputToken) == null ? void 0 : K.decimals,
|
|
667
|
+
(M = e.outputToken) == null ? void 0 : M.address,
|
|
664
668
|
(_ = e.outputToken) == null ? void 0 : _.decimals,
|
|
665
669
|
(g = e.wrappedNativeToken) == null ? void 0 : g.address,
|
|
666
|
-
(
|
|
670
|
+
(P = e.wrappedNativeToken) == null ? void 0 : P.decimals,
|
|
667
671
|
c
|
|
668
|
-
]), O =
|
|
672
|
+
]), O = C(
|
|
669
673
|
() => ({
|
|
670
674
|
inputAmountUi: e.inputAmountUi,
|
|
671
675
|
minTradeSizeUsd: e.minTradeSizeUsd,
|
|
@@ -715,81 +719,75 @@ const Et = ({
|
|
|
715
719
|
i
|
|
716
720
|
]
|
|
717
721
|
);
|
|
718
|
-
return { initialState: c, formScopeKey:
|
|
719
|
-
},
|
|
722
|
+
return { initialState: c, formScopeKey: f, runtime: O };
|
|
723
|
+
}, Ht = (e) => {
|
|
720
724
|
const { initialState: t, formScopeKey: n, runtime: r } = pt(e);
|
|
721
|
-
return Ot(e, r.isSupportedChain), /* @__PURE__ */
|
|
725
|
+
return Ot(e, r.isSupportedChain), /* @__PURE__ */ D(Ye, { value: r, children: /* @__PURE__ */ D(lt, { initialState: t, children: /* @__PURE__ */ D(ht, { fallback: e.errorFallback, children: /* @__PURE__ */ D(
|
|
722
726
|
Et,
|
|
723
727
|
{
|
|
724
728
|
defaults: t,
|
|
725
729
|
scopeKey: n,
|
|
726
|
-
children: /* @__PURE__ */
|
|
730
|
+
children: /* @__PURE__ */ D(Pt, { fallback: e.clientErrorFallback, children: /* @__PURE__ */ D(It, { children: e.children }) })
|
|
727
731
|
}
|
|
728
732
|
) }) }) });
|
|
729
|
-
},
|
|
730
|
-
const { account: e, partner: t, chainId: n, supportLegacyOrders: r, callbacks: o } =
|
|
733
|
+
}, jt = (e, t) => C(() => ie(t, e), [e, t]), At = { isFetching: !1 }, Pe = () => {
|
|
734
|
+
const { account: e, partner: t, chainId: n, supportLegacyOrders: r, callbacks: o } = x(), { data: i } = Z(), s = z(), a = !!(e && i), c = a ? JSON.stringify([
|
|
731
735
|
e,
|
|
732
736
|
i == null ? void 0 : i.exchangeAddress,
|
|
733
737
|
t,
|
|
734
738
|
n,
|
|
735
739
|
r
|
|
736
|
-
]) : void 0,
|
|
737
|
-
async (
|
|
740
|
+
]) : void 0, f = v(
|
|
741
|
+
async (u, l, h) => {
|
|
738
742
|
if (!e || !i)
|
|
739
743
|
return { orders: [], legacyLoaded: !1 };
|
|
740
|
-
const
|
|
741
|
-
signal:
|
|
744
|
+
const m = r && !l, S = await i.getAccountOrders({
|
|
745
|
+
signal: h,
|
|
742
746
|
account: e,
|
|
743
|
-
legacyOrders:
|
|
747
|
+
legacyOrders: m
|
|
744
748
|
});
|
|
745
|
-
return st(
|
|
746
|
-
orders: r && !
|
|
747
|
-
legacyLoaded:
|
|
749
|
+
return st(u, S, o), {
|
|
750
|
+
orders: r && !m ? ot(S, u) : S,
|
|
751
|
+
legacyLoaded: l || m
|
|
748
752
|
};
|
|
749
753
|
},
|
|
750
754
|
[e, o, i, r]
|
|
751
755
|
);
|
|
752
|
-
|
|
753
|
-
s.getState().configureOrders(c, a ?
|
|
754
|
-
}, [a, c,
|
|
755
|
-
const O = v(() => {
|
|
756
|
+
X(() => {
|
|
757
|
+
s.getState().configureOrders(c, a ? f : void 0);
|
|
758
|
+
}, [a, c, f, s]);
|
|
759
|
+
const O = v((u = !1) => {
|
|
756
760
|
if (!a || !c) return Promise.resolve(void 0);
|
|
757
|
-
const
|
|
758
|
-
return
|
|
759
|
-
}, [a, c,
|
|
761
|
+
const l = s.getState();
|
|
762
|
+
return l.configureOrders(c, f), l.refetchOrders(!0, u);
|
|
763
|
+
}, [a, c, f, s]);
|
|
760
764
|
return { enabled: a, key: c, refetch: O };
|
|
761
765
|
}, wt = () => {
|
|
762
766
|
Pe();
|
|
763
|
-
const e =
|
|
767
|
+
const e = z();
|
|
764
768
|
return v(
|
|
765
769
|
(t) => e.getState().addOrder(t),
|
|
766
770
|
[e]
|
|
767
771
|
);
|
|
768
772
|
}, vt = () => {
|
|
769
|
-
const e =
|
|
770
|
-
return v(
|
|
771
|
-
(t, n) => e.getState().updateOrderStatus(t, n),
|
|
772
|
-
[e]
|
|
773
|
-
);
|
|
774
|
-
}, Ct = () => {
|
|
775
|
-
const e = H();
|
|
773
|
+
const e = z();
|
|
776
774
|
return v(
|
|
777
775
|
() => e.getState().refetchOrders(),
|
|
778
776
|
[e]
|
|
779
777
|
);
|
|
780
|
-
},
|
|
781
|
-
const e =
|
|
778
|
+
}, zt = () => {
|
|
779
|
+
const e = w((c) => c.orders), t = w(
|
|
782
780
|
(c) => c.registerOrdersConsumer
|
|
783
781
|
), { enabled: n, key: r, refetch: o } = Pe(), i = e.key === r ? e : At;
|
|
784
|
-
|
|
785
|
-
const s =
|
|
782
|
+
X(() => t(), [t]);
|
|
783
|
+
const s = C(
|
|
786
784
|
() => i.data === void 0 ? void 0 : Ee(i.data),
|
|
787
785
|
[i.data]
|
|
788
786
|
), a = v(async () => {
|
|
789
787
|
const c = await o();
|
|
790
788
|
return c === void 0 ? void 0 : Ee(c);
|
|
791
789
|
}, [o]);
|
|
792
|
-
return
|
|
790
|
+
return C(
|
|
793
791
|
() => ({
|
|
794
792
|
data: s,
|
|
795
793
|
error: i.error,
|
|
@@ -800,20 +798,20 @@ const Et = ({
|
|
|
800
798
|
}),
|
|
801
799
|
[i, s, n, a]
|
|
802
800
|
);
|
|
803
|
-
},
|
|
801
|
+
}, Ct = 60, Rt = () => {
|
|
804
802
|
const { refetch: e } = Pe();
|
|
805
803
|
return v(
|
|
806
|
-
async (t) => {
|
|
807
|
-
for (let
|
|
808
|
-
const
|
|
809
|
-
if (!
|
|
804
|
+
async (t, n = !1) => {
|
|
805
|
+
for (let r = 0; r < Ct; r++) {
|
|
806
|
+
const o = await e(n);
|
|
807
|
+
if (!o)
|
|
810
808
|
throw new Error("orders not found");
|
|
811
|
-
const
|
|
812
|
-
(
|
|
809
|
+
const i = o.find(
|
|
810
|
+
(s) => s.historyKey === t
|
|
813
811
|
);
|
|
814
|
-
if ((
|
|
812
|
+
if ((i == null ? void 0 : i.status) === J.Cancelled)
|
|
815
813
|
return;
|
|
816
|
-
await new Promise((
|
|
814
|
+
await new Promise((s) => setTimeout(s, 1e3));
|
|
817
815
|
}
|
|
818
816
|
throw new Error(
|
|
819
817
|
"Timed out waiting for order cancellation to be confirmed"
|
|
@@ -821,10 +819,10 @@ const Et = ({
|
|
|
821
819
|
},
|
|
822
820
|
[e]
|
|
823
821
|
);
|
|
824
|
-
},
|
|
825
|
-
const e =
|
|
822
|
+
}, yt = () => {
|
|
823
|
+
const e = z(), t = w((r) => r.updateState);
|
|
826
824
|
return {
|
|
827
|
-
cancelOrders:
|
|
825
|
+
cancelOrders: w((r) => r.state.cancelOrders),
|
|
828
826
|
setCancelOrder: (r, o) => {
|
|
829
827
|
const i = e.getState().state.cancelOrders;
|
|
830
828
|
t({
|
|
@@ -836,89 +834,89 @@ const Et = ({
|
|
|
836
834
|
t({ cancelOrders: s });
|
|
837
835
|
}
|
|
838
836
|
};
|
|
839
|
-
},
|
|
837
|
+
}, Tt = (e) => ({
|
|
840
838
|
...e,
|
|
841
|
-
status:
|
|
842
|
-
}),
|
|
843
|
-
const { account: t, walletInteractions: n, callbacks: r } =
|
|
844
|
-
cancelOrders:
|
|
845
|
-
setCancelOrder:
|
|
846
|
-
clearCancelOrder:
|
|
847
|
-
} =
|
|
839
|
+
status: J.Cancelled
|
|
840
|
+
}), Jt = (e) => {
|
|
841
|
+
const { account: t, walletInteractions: n, callbacks: r } = x(), { data: o } = Z(), i = Rt(), {
|
|
842
|
+
cancelOrders: s,
|
|
843
|
+
setCancelOrder: a,
|
|
844
|
+
clearCancelOrder: c
|
|
845
|
+
} = yt(), f = v(async () => {
|
|
848
846
|
const u = e == null ? void 0 : e.historyKey;
|
|
849
847
|
try {
|
|
850
848
|
if (!t) throw new Error("missing account");
|
|
851
849
|
if (!e) throw new Error("order is required");
|
|
852
850
|
if (!o) throw new Error("Spot client is unavailable");
|
|
853
|
-
const
|
|
854
|
-
|
|
855
|
-
var
|
|
856
|
-
return (
|
|
857
|
-
}),
|
|
858
|
-
() =>
|
|
851
|
+
const l = e.historyKey;
|
|
852
|
+
a(l, { status: q.LOADING }), E(() => {
|
|
853
|
+
var R;
|
|
854
|
+
return (R = r == null ? void 0 : r.onCancelOrderRequest) == null ? void 0 : R.call(r, e);
|
|
855
|
+
}), E(
|
|
856
|
+
() => U.onCancelOrderRequest(
|
|
859
857
|
[e.version === 1 ? e.id.toString() : e.hash],
|
|
860
858
|
e.version
|
|
861
859
|
)
|
|
862
860
|
);
|
|
863
|
-
const
|
|
864
|
-
if (!
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
861
|
+
const h = o.getCancelOrderRequest(e), m = await n.cancelOrder(h);
|
|
862
|
+
if (!m) throw new Error("failed to cancel order");
|
|
863
|
+
E(() => U.onCancelOrderSuccess(m)), a(l, {
|
|
864
|
+
status: q.LOADING,
|
|
865
|
+
txHash: m
|
|
866
|
+
}), await i(l, e.version === 1);
|
|
867
|
+
const S = Tt(e);
|
|
868
|
+
return a(l, {
|
|
869
|
+
status: q.SUCCESS,
|
|
870
|
+
txHash: m
|
|
871
|
+
}), E(
|
|
871
872
|
() => {
|
|
872
|
-
var
|
|
873
|
-
return (
|
|
874
|
-
order:
|
|
875
|
-
txHash:
|
|
873
|
+
var R;
|
|
874
|
+
return (R = r == null ? void 0 : r.onCancelOrderSuccess) == null ? void 0 : R.call(r, {
|
|
875
|
+
order: S,
|
|
876
|
+
txHash: m
|
|
876
877
|
});
|
|
877
878
|
}
|
|
878
|
-
),
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
var l;
|
|
887
|
-
return (l = r == null ? void 0 : r.onCancelOrderFailed) == null ? void 0 : l.call(r, ne(m));
|
|
879
|
+
), m;
|
|
880
|
+
} catch (l) {
|
|
881
|
+
Ce(l) ? u && c(u) : (u && a(u, {
|
|
882
|
+
status: q.FAILED,
|
|
883
|
+
error: ge(l)
|
|
884
|
+
}), E(() => U.onCancelOrderError(l))), E(() => {
|
|
885
|
+
var h;
|
|
886
|
+
return (h = r == null ? void 0 : r.onCancelOrderFailed) == null ? void 0 : h.call(r, ne(l));
|
|
888
887
|
});
|
|
889
888
|
}
|
|
890
889
|
}, [
|
|
891
890
|
t,
|
|
892
891
|
r,
|
|
893
|
-
|
|
892
|
+
c,
|
|
894
893
|
o,
|
|
895
894
|
e,
|
|
896
895
|
i,
|
|
897
|
-
|
|
898
|
-
s,
|
|
896
|
+
a,
|
|
899
897
|
n
|
|
900
|
-
]),
|
|
901
|
-
const u =
|
|
898
|
+
]), O = C(() => {
|
|
899
|
+
const u = s[(e == null ? void 0 : e.historyKey) || ""];
|
|
902
900
|
return {
|
|
903
|
-
isLoading: (u == null ? void 0 : u.status) ===
|
|
901
|
+
isLoading: (u == null ? void 0 : u.status) === q.LOADING,
|
|
904
902
|
disabled: !!(e && !o),
|
|
905
|
-
isSuccess: (u == null ? void 0 : u.status) ===
|
|
906
|
-
isError: (u == null ? void 0 : u.status) ===
|
|
903
|
+
isSuccess: (u == null ? void 0 : u.status) === q.SUCCESS,
|
|
904
|
+
isError: (u == null ? void 0 : u.status) === q.FAILED,
|
|
907
905
|
error: u == null ? void 0 : u.error,
|
|
908
906
|
txHash: u == null ? void 0 : u.txHash
|
|
909
907
|
};
|
|
910
|
-
}, [
|
|
911
|
-
return
|
|
912
|
-
},
|
|
913
|
-
const { module: e, values: t } =
|
|
914
|
-
if (t.isMarketOrder && e ===
|
|
908
|
+
}, [s, e, o]);
|
|
909
|
+
return C(() => ({ cancelOrder: f, ...O }), [f, O]);
|
|
910
|
+
}, Qt = () => {
|
|
911
|
+
const { module: e, values: t } = W();
|
|
912
|
+
if (t.isMarketOrder && e === b.STOP_LOSS)
|
|
915
913
|
return te.TRIGGER_MARKET_PRICE;
|
|
916
|
-
if (e ===
|
|
914
|
+
if (e === b.LIMIT || e === b.TWAP)
|
|
917
915
|
return t.isMarketOrder ? te.MARKET_PRICE : te.LIMIT_PRICE;
|
|
918
|
-
},
|
|
919
|
-
const { callbacks: e } =
|
|
916
|
+
}, Yt = () => {
|
|
917
|
+
const { callbacks: e } = x(), t = w((a) => a.updateState), { schedule: n } = W(), { duration: r } = n, o = v(
|
|
920
918
|
(a) => {
|
|
921
|
-
t({ orderDuration: a }),
|
|
919
|
+
t({ orderDuration: a }), E(() => {
|
|
922
920
|
var c;
|
|
923
921
|
return (c = e == null ? void 0 : e.onOrderDurationChange) == null ? void 0 : c.call(e, a);
|
|
924
922
|
});
|
|
@@ -936,7 +934,7 @@ const Et = ({
|
|
|
936
934
|
},
|
|
937
935
|
[r.value, o]
|
|
938
936
|
);
|
|
939
|
-
return
|
|
937
|
+
return C(
|
|
940
938
|
() => ({
|
|
941
939
|
duration: r,
|
|
942
940
|
onChange: o,
|
|
@@ -947,10 +945,10 @@ const Et = ({
|
|
|
947
945
|
}),
|
|
948
946
|
[r, o, i, s, n]
|
|
949
947
|
);
|
|
950
|
-
},
|
|
951
|
-
const { callbacks: e } =
|
|
948
|
+
}, $t = () => {
|
|
949
|
+
const { callbacks: e } = x(), t = w((a) => a.updateState), { schedule: n } = W(), { fillDelay: r } = n, o = v(
|
|
952
950
|
(a) => {
|
|
953
|
-
t({ tradeInterval: a }),
|
|
951
|
+
t({ tradeInterval: a }), E(() => {
|
|
954
952
|
var c;
|
|
955
953
|
return (c = e == null ? void 0 : e.onTradeIntervalChange) == null ? void 0 : c.call(e, a);
|
|
956
954
|
});
|
|
@@ -966,7 +964,7 @@ const Et = ({
|
|
|
966
964
|
(a) => o({ unit: a, value: r.value }),
|
|
967
965
|
[r.value, o]
|
|
968
966
|
);
|
|
969
|
-
return
|
|
967
|
+
return C(
|
|
970
968
|
() => ({
|
|
971
969
|
onInputChange: i,
|
|
972
970
|
onUnitSelect: s,
|
|
@@ -980,7 +978,7 @@ const Et = ({
|
|
|
980
978
|
}, B = (e, t) => ({
|
|
981
979
|
raw: e || "",
|
|
982
980
|
ui: ie(e, t)
|
|
983
|
-
}), Nt = (e, t, n) =>
|
|
981
|
+
}), Nt = (e, t, n) => C(() => !e || !t || !n ? [] : e.map((r) => ({
|
|
984
982
|
rawFill: r,
|
|
985
983
|
inputToken: t,
|
|
986
984
|
outputToken: n,
|
|
@@ -994,22 +992,22 @@ const Et = ({
|
|
|
994
992
|
t.decimals,
|
|
995
993
|
n.decimals
|
|
996
994
|
)
|
|
997
|
-
})), [e, t, n]),
|
|
998
|
-
const { chainId: r, partner: o } =
|
|
995
|
+
})), [e, t, n]), Xt = (e, t, n) => {
|
|
996
|
+
const { chainId: r, partner: o } = x(), i = C(() => {
|
|
999
997
|
if (!(!t || !n || !e || e.isMarketPrice))
|
|
1000
|
-
return
|
|
998
|
+
return Me(
|
|
1001
999
|
e,
|
|
1002
1000
|
t.decimals,
|
|
1003
1001
|
n.decimals
|
|
1004
1002
|
);
|
|
1005
|
-
}, [t, e, n]), s =
|
|
1003
|
+
}, [t, e, n]), s = C(() => {
|
|
1006
1004
|
if (!(!t || !n || !e))
|
|
1007
1005
|
return _e(
|
|
1008
1006
|
e,
|
|
1009
1007
|
t.decimals,
|
|
1010
1008
|
n.decimals
|
|
1011
1009
|
);
|
|
1012
|
-
}, [t, e, n]), a =
|
|
1010
|
+
}, [t, e, n]), a = C(() => {
|
|
1013
1011
|
if (!(!t || !n || !e))
|
|
1014
1012
|
return Re(
|
|
1015
1013
|
e.srcAmountFilled,
|
|
@@ -1017,15 +1015,15 @@ const Et = ({
|
|
|
1017
1015
|
t.decimals,
|
|
1018
1016
|
n.decimals
|
|
1019
1017
|
);
|
|
1020
|
-
}, [t, e, n]), c =
|
|
1018
|
+
}, [t, e, n]), c = C(() => e ? Be(
|
|
1021
1019
|
e,
|
|
1022
1020
|
r ? ve(o, r) : void 0
|
|
1023
|
-
) : 0, [e, o, r]),
|
|
1024
|
-
return
|
|
1021
|
+
) : 0, [e, o, r]), f = Nt(e == null ? void 0 : e.fills, t, n);
|
|
1022
|
+
return C(() => {
|
|
1025
1023
|
if (e != null && e.id)
|
|
1026
1024
|
return {
|
|
1027
1025
|
original: e,
|
|
1028
|
-
fills:
|
|
1026
|
+
fills: f,
|
|
1029
1027
|
inputToken: t,
|
|
1030
1028
|
outputToken: n,
|
|
1031
1029
|
orderType: e.type,
|
|
@@ -1073,7 +1071,7 @@ const Et = ({
|
|
|
1073
1071
|
};
|
|
1074
1072
|
}, [
|
|
1075
1073
|
e,
|
|
1076
|
-
|
|
1074
|
+
f,
|
|
1077
1075
|
t,
|
|
1078
1076
|
n,
|
|
1079
1077
|
c,
|
|
@@ -1081,96 +1079,96 @@ const Et = ({
|
|
|
1081
1079
|
s,
|
|
1082
1080
|
a
|
|
1083
1081
|
]);
|
|
1084
|
-
},
|
|
1085
|
-
const { marketPriceLoading: e } =
|
|
1082
|
+
}, Zt = () => {
|
|
1083
|
+
const { marketPriceLoading: e } = x(), t = W().errors.primary;
|
|
1086
1084
|
return e ? void 0 : t;
|
|
1087
|
-
},
|
|
1088
|
-
const { marketPriceLoading: e, inputToken: t, outputToken: n, callbacks: r } =
|
|
1089
|
-
(
|
|
1090
|
-
c({ limitPriceUi:
|
|
1091
|
-
var
|
|
1092
|
-
return (
|
|
1093
|
-
}),
|
|
1094
|
-
var
|
|
1095
|
-
return (
|
|
1085
|
+
}, bt = () => {
|
|
1086
|
+
const { marketPriceLoading: e, inputToken: t, outputToken: n, callbacks: r } = x(), { limitPrice: o, values: i, module: s, isInverted: a } = W(), c = w((m) => m.updateState), f = v(
|
|
1087
|
+
(m) => {
|
|
1088
|
+
c({ limitPriceUi: m, limitPricePercent: null }), E(() => {
|
|
1089
|
+
var S;
|
|
1090
|
+
return (S = r == null ? void 0 : r.onLimitPriceChange) == null ? void 0 : S.call(r, m || "");
|
|
1091
|
+
}), E(() => {
|
|
1092
|
+
var S;
|
|
1093
|
+
return (S = r == null ? void 0 : r.onLimitPricePercentChange) == null ? void 0 : S.call(r, "");
|
|
1096
1094
|
});
|
|
1097
1095
|
},
|
|
1098
1096
|
[r, c]
|
|
1099
1097
|
), O = v(
|
|
1100
|
-
(
|
|
1098
|
+
(m) => {
|
|
1101
1099
|
c({
|
|
1102
1100
|
limitPriceUi: void 0,
|
|
1103
|
-
limitPricePercent:
|
|
1104
|
-
}),
|
|
1105
|
-
var
|
|
1106
|
-
return (
|
|
1107
|
-
}),
|
|
1108
|
-
var
|
|
1109
|
-
return (
|
|
1101
|
+
limitPricePercent: m
|
|
1102
|
+
}), E(() => {
|
|
1103
|
+
var S;
|
|
1104
|
+
return (S = r == null ? void 0 : r.onLimitPriceChange) == null ? void 0 : S.call(r, "");
|
|
1105
|
+
}), E(() => {
|
|
1106
|
+
var S;
|
|
1107
|
+
return (S = r == null ? void 0 : r.onLimitPricePercentChange) == null ? void 0 : S.call(r, m || "");
|
|
1110
1108
|
});
|
|
1111
1109
|
},
|
|
1112
1110
|
[r, c]
|
|
1113
|
-
),
|
|
1111
|
+
), u = v(() => {
|
|
1114
1112
|
c({
|
|
1115
1113
|
limitPriceUi: void 0,
|
|
1116
1114
|
limitPricePercent: void 0
|
|
1117
1115
|
});
|
|
1118
|
-
}, [c]),
|
|
1116
|
+
}, [c]), l = !i.isMarketOrder, h = v(() => {
|
|
1119
1117
|
c({
|
|
1120
1118
|
isMarketOrder: !i.isMarketOrder,
|
|
1121
1119
|
...i.isMarketOrder ? {} : { isPriceInverted: !1 },
|
|
1122
|
-
...!i.isMarketOrder && s ===
|
|
1120
|
+
...!i.isMarketOrder && s === b.STOP_LOSS ? { limitPricePercent: void 0 } : {}
|
|
1123
1121
|
});
|
|
1124
1122
|
}, [s, c, i.isMarketOrder]);
|
|
1125
|
-
return
|
|
1123
|
+
return C(
|
|
1126
1124
|
() => ({
|
|
1127
1125
|
price: o.display,
|
|
1128
1126
|
canonicalPriceRaw: o.raw,
|
|
1129
1127
|
error: o.error,
|
|
1130
|
-
onInputChange:
|
|
1128
|
+
onInputChange: f,
|
|
1131
1129
|
onPercentageChange: O,
|
|
1132
|
-
onReset:
|
|
1130
|
+
onReset: u,
|
|
1133
1131
|
inputToken: t,
|
|
1134
1132
|
outputToken: n,
|
|
1135
1133
|
displayInputToken: a ? n : t,
|
|
1136
1134
|
displayOutputToken: a ? t : n,
|
|
1137
1135
|
percentage: o.percentage,
|
|
1138
1136
|
isLoading: !!e,
|
|
1139
|
-
isEnabled:
|
|
1140
|
-
toggle:
|
|
1137
|
+
isEnabled: l,
|
|
1138
|
+
toggle: h,
|
|
1141
1139
|
isTypedValue: o.isTypedValue
|
|
1142
1140
|
}),
|
|
1143
1141
|
[
|
|
1144
1142
|
t,
|
|
1145
1143
|
a,
|
|
1146
|
-
|
|
1144
|
+
l,
|
|
1147
1145
|
o,
|
|
1148
1146
|
e,
|
|
1149
|
-
|
|
1147
|
+
f,
|
|
1150
1148
|
O,
|
|
1151
|
-
|
|
1149
|
+
u,
|
|
1152
1150
|
n,
|
|
1153
|
-
|
|
1151
|
+
h
|
|
1154
1152
|
]
|
|
1155
1153
|
);
|
|
1156
|
-
},
|
|
1157
|
-
const { marketPriceLoading: e } =
|
|
1158
|
-
return
|
|
1154
|
+
}, kt = () => {
|
|
1155
|
+
const { marketPriceLoading: e } = x(), { outputAmount: t } = W();
|
|
1156
|
+
return C(
|
|
1159
1157
|
() => ({
|
|
1160
1158
|
amount: t,
|
|
1161
1159
|
isLoading: !!e
|
|
1162
1160
|
}),
|
|
1163
1161
|
[e, t]
|
|
1164
1162
|
);
|
|
1165
|
-
},
|
|
1166
|
-
const { inputToken: e, outputToken: t } =
|
|
1163
|
+
}, er = () => {
|
|
1164
|
+
const { inputToken: e, outputToken: t } = x(), n = w((c) => c.updateState), { isInverted: r, values: o } = W(), i = w((c) => c.state.triggerPriceUi), s = w((c) => c.state.limitPriceUi), a = v(() => {
|
|
1167
1165
|
n({
|
|
1168
1166
|
isPriceInverted: !r,
|
|
1169
1167
|
...i !== void 0 ? { triggerPriceUi: he(i) } : {},
|
|
1170
1168
|
...s !== void 0 ? { limitPriceUi: he(s) } : {}
|
|
1171
1169
|
});
|
|
1172
1170
|
}, [n, r, i, s]);
|
|
1173
|
-
return
|
|
1171
|
+
return C(
|
|
1174
1172
|
() => ({
|
|
1175
1173
|
onInvert: a,
|
|
1176
1174
|
isInverted: r,
|
|
@@ -1182,7 +1180,7 @@ const Et = ({
|
|
|
1182
1180
|
}),
|
|
1183
1181
|
[e, r, a, t, o.isMarketOrder]
|
|
1184
1182
|
);
|
|
1185
|
-
}, Ae = 3,
|
|
1183
|
+
}, Ae = 3, Lt = 3e3, Ft = (e) => new Promise((t) => setTimeout(t, e)), de = (e, t) => {
|
|
1186
1184
|
if (!/^\d+$/.test(e))
|
|
1187
1185
|
throw new Error(
|
|
1188
1186
|
`${t} must be a non-negative integer base-unit amount`
|
|
@@ -1199,15 +1197,15 @@ const Et = ({
|
|
|
1199
1197
|
spenderAddress: e.spenderAddress
|
|
1200
1198
|
});
|
|
1201
1199
|
return de(o || "0", "Allowance") >= de(r, "Input amount");
|
|
1202
|
-
},
|
|
1200
|
+
}, xt = (e) => {
|
|
1203
1201
|
if (!e.client) throw new Error("Spot client is unavailable");
|
|
1204
1202
|
if (!e.isSupportedChain || !e.chainId)
|
|
1205
1203
|
throw new Error("Spot is unavailable on the connected chain");
|
|
1206
1204
|
if (!e.account) throw new Error("missing account");
|
|
1207
1205
|
if (!e.inputToken) throw new Error("missing inputToken");
|
|
1208
1206
|
if (!e.outputToken) throw new Error("missing outputToken");
|
|
1209
|
-
const t =
|
|
1210
|
-
if (!t ||
|
|
1207
|
+
const t = $(e.inputToken.address) ? e.wrappedNativeToken : e.inputToken;
|
|
1208
|
+
if (!t || $(t.address))
|
|
1211
1209
|
throw new Error("missing wrappedNativeToken for native input");
|
|
1212
1210
|
if (!e.form.canSubmit)
|
|
1213
1211
|
throw new Error("Order form is not submittable");
|
|
@@ -1221,7 +1219,7 @@ const Et = ({
|
|
|
1221
1219
|
client: e.client,
|
|
1222
1220
|
inputAmountRaw: n
|
|
1223
1221
|
};
|
|
1224
|
-
},
|
|
1222
|
+
}, Ut = ({
|
|
1225
1223
|
account: e,
|
|
1226
1224
|
chainId: t,
|
|
1227
1225
|
inputToken: n,
|
|
@@ -1229,8 +1227,8 @@ const Et = ({
|
|
|
1229
1227
|
preparedOrder: o
|
|
1230
1228
|
}) => {
|
|
1231
1229
|
const { form: i, values: s } = o;
|
|
1232
|
-
|
|
1233
|
-
() =>
|
|
1230
|
+
E(
|
|
1231
|
+
() => U.onRequestOrder({
|
|
1234
1232
|
account: e,
|
|
1235
1233
|
chainId: t,
|
|
1236
1234
|
module: i.module,
|
|
@@ -1247,7 +1245,7 @@ const Et = ({
|
|
|
1247
1245
|
chunksAmount: s.totalTrades
|
|
1248
1246
|
})
|
|
1249
1247
|
);
|
|
1250
|
-
},
|
|
1248
|
+
}, Dt = async (e) => {
|
|
1251
1249
|
const {
|
|
1252
1250
|
form: t,
|
|
1253
1251
|
walletInteractions: n,
|
|
@@ -1257,198 +1255,198 @@ const Et = ({
|
|
|
1257
1255
|
getCurrentExecution: s,
|
|
1258
1256
|
beginExecution: a,
|
|
1259
1257
|
replaceExecution: c,
|
|
1260
|
-
wait:
|
|
1258
|
+
wait: f = Ft
|
|
1261
1259
|
} = e;
|
|
1262
1260
|
let O;
|
|
1263
1261
|
try {
|
|
1264
|
-
O =
|
|
1262
|
+
O = xt(e);
|
|
1265
1263
|
} catch (A) {
|
|
1266
|
-
const y = ne(A),
|
|
1264
|
+
const y = ne(A), N = se(A), L = a({
|
|
1267
1265
|
form: t,
|
|
1268
1266
|
inputToken: e.inputToken,
|
|
1269
1267
|
outputToken: e.outputToken,
|
|
1270
1268
|
chainId: e.chainId
|
|
1271
1269
|
});
|
|
1272
|
-
throw
|
|
1273
|
-
...
|
|
1270
|
+
throw L && c(L.executionId, {
|
|
1271
|
+
...L,
|
|
1274
1272
|
phase: d.FAILED,
|
|
1275
1273
|
error: y,
|
|
1276
|
-
parsedError:
|
|
1277
|
-
}),
|
|
1274
|
+
parsedError: N
|
|
1275
|
+
}), E(
|
|
1278
1276
|
() => {
|
|
1279
|
-
var
|
|
1280
|
-
return (
|
|
1277
|
+
var G;
|
|
1278
|
+
return (G = r == null ? void 0 : r.onSubmitOrderFailed) == null ? void 0 : G.call(r, N);
|
|
1281
1279
|
}
|
|
1282
1280
|
), y;
|
|
1283
1281
|
}
|
|
1284
1282
|
const {
|
|
1285
|
-
account:
|
|
1286
|
-
chainId:
|
|
1287
|
-
inputToken:
|
|
1288
|
-
orderInputToken:
|
|
1289
|
-
outputToken:
|
|
1290
|
-
client:
|
|
1291
|
-
inputAmountRaw:
|
|
1292
|
-
} = O,
|
|
1293
|
-
execution:
|
|
1294
|
-
account:
|
|
1295
|
-
chainId:
|
|
1296
|
-
inputTokenAddress:
|
|
1297
|
-
inputAmountRaw:
|
|
1283
|
+
account: u,
|
|
1284
|
+
chainId: l,
|
|
1285
|
+
inputToken: h,
|
|
1286
|
+
orderInputToken: m,
|
|
1287
|
+
outputToken: S,
|
|
1288
|
+
client: R,
|
|
1289
|
+
inputAmountRaw: T
|
|
1290
|
+
} = O, K = s(), M = rt({
|
|
1291
|
+
execution: K,
|
|
1292
|
+
account: u,
|
|
1293
|
+
chainId: l,
|
|
1294
|
+
inputTokenAddress: h.address,
|
|
1295
|
+
inputAmountRaw: T
|
|
1298
1296
|
}), _ = a({
|
|
1299
1297
|
form: t,
|
|
1300
|
-
inputToken:
|
|
1301
|
-
outputToken:
|
|
1302
|
-
chainId:
|
|
1303
|
-
completedWrap:
|
|
1304
|
-
wrapTxHash:
|
|
1298
|
+
inputToken: h,
|
|
1299
|
+
outputToken: S,
|
|
1300
|
+
chainId: l,
|
|
1301
|
+
completedWrap: M,
|
|
1302
|
+
wrapTxHash: M == null ? void 0 : M.txHash
|
|
1305
1303
|
});
|
|
1306
1304
|
if (!_) return;
|
|
1307
1305
|
const g = _.executionId;
|
|
1308
|
-
let
|
|
1306
|
+
let P = _;
|
|
1309
1307
|
const p = (A, y = {}) => {
|
|
1310
|
-
const
|
|
1311
|
-
...
|
|
1308
|
+
const N = {
|
|
1309
|
+
...P,
|
|
1312
1310
|
...y,
|
|
1313
1311
|
executionId: g,
|
|
1314
1312
|
phase: A
|
|
1315
1313
|
};
|
|
1316
|
-
if (!c(g,
|
|
1314
|
+
if (!c(g, N))
|
|
1317
1315
|
throw new Error("Execution is no longer current");
|
|
1318
|
-
|
|
1316
|
+
P = N;
|
|
1319
1317
|
}, I = (A, y = {}) => {
|
|
1320
|
-
const
|
|
1321
|
-
...
|
|
1318
|
+
const N = {
|
|
1319
|
+
...P,
|
|
1322
1320
|
...y,
|
|
1323
1321
|
executionId: g,
|
|
1324
1322
|
phase: A
|
|
1325
1323
|
};
|
|
1326
|
-
return c(g,
|
|
1324
|
+
return c(g, N) ? (P = N, !0) : !1;
|
|
1327
1325
|
};
|
|
1328
1326
|
try {
|
|
1329
|
-
const A =
|
|
1330
|
-
client:
|
|
1327
|
+
const A = $(h.address) && !M, y = !await we({
|
|
1328
|
+
client: R,
|
|
1331
1329
|
walletInteractions: n,
|
|
1332
|
-
tokenAddress:
|
|
1333
|
-
inputAmountRaw:
|
|
1334
|
-
}),
|
|
1335
|
-
A &&
|
|
1336
|
-
let
|
|
1330
|
+
tokenAddress: m.address,
|
|
1331
|
+
inputAmountRaw: T
|
|
1332
|
+
}), N = [];
|
|
1333
|
+
A && N.push(Q.WRAP), y && N.push(Q.APPROVE), N.push(Q.CREATE);
|
|
1334
|
+
let L = 0;
|
|
1337
1335
|
if (p(d.PREPARING, {
|
|
1338
|
-
pendingSteps:
|
|
1339
|
-
totalSteps:
|
|
1340
|
-
stepIndex:
|
|
1336
|
+
pendingSteps: N,
|
|
1337
|
+
totalSteps: N.length,
|
|
1338
|
+
stepIndex: L,
|
|
1341
1339
|
hasApproval: !y
|
|
1342
1340
|
}), A) {
|
|
1343
|
-
p(d.WRAPPING),
|
|
1344
|
-
const
|
|
1345
|
-
|
|
1341
|
+
p(d.WRAPPING), E(() => U.onWrapRequest()), E(r == null ? void 0 : r.onWrapRequest);
|
|
1342
|
+
const F = await n.wrapNativeToken(
|
|
1343
|
+
T
|
|
1346
1344
|
);
|
|
1347
|
-
if (!
|
|
1345
|
+
if (!F) throw new Error("failed to wrap input token");
|
|
1348
1346
|
const j = {
|
|
1349
|
-
account:
|
|
1350
|
-
chainId:
|
|
1351
|
-
inputTokenAddress:
|
|
1352
|
-
inputAmountRaw:
|
|
1353
|
-
txHash:
|
|
1347
|
+
account: u,
|
|
1348
|
+
chainId: l,
|
|
1349
|
+
inputTokenAddress: h.address,
|
|
1350
|
+
inputAmountRaw: T,
|
|
1351
|
+
txHash: F
|
|
1354
1352
|
};
|
|
1355
|
-
|
|
1356
|
-
wrapTxHash:
|
|
1353
|
+
L++, p(d.WRAPPING, {
|
|
1354
|
+
wrapTxHash: F,
|
|
1357
1355
|
completedWrap: j,
|
|
1358
|
-
stepIndex:
|
|
1359
|
-
}),
|
|
1356
|
+
stepIndex: L
|
|
1357
|
+
}), E(() => U.onWrapSuccess(F)), E(
|
|
1360
1358
|
() => {
|
|
1361
|
-
var
|
|
1362
|
-
return (
|
|
1363
|
-
txHash:
|
|
1364
|
-
amount: ie(
|
|
1359
|
+
var H;
|
|
1360
|
+
return (H = r == null ? void 0 : r.onWrapSuccess) == null ? void 0 : H.call(r, {
|
|
1361
|
+
txHash: F,
|
|
1362
|
+
amount: ie(T, m.decimals)
|
|
1365
1363
|
});
|
|
1366
1364
|
}
|
|
1367
1365
|
);
|
|
1368
1366
|
}
|
|
1369
1367
|
if (y) {
|
|
1370
|
-
p(d.APPROVING),
|
|
1371
|
-
const
|
|
1372
|
-
tokenAddress:
|
|
1373
|
-
amount:
|
|
1374
|
-
spenderAddress:
|
|
1368
|
+
p(d.APPROVING), E(() => U.onApproveRequest()), E(r == null ? void 0 : r.onApproveRequest);
|
|
1369
|
+
const F = await n.approveToken({
|
|
1370
|
+
tokenAddress: m.address,
|
|
1371
|
+
amount: T,
|
|
1372
|
+
spenderAddress: R.spenderAddress
|
|
1375
1373
|
});
|
|
1376
|
-
if (!
|
|
1377
|
-
p(d.APPROVING, { approveTxHash:
|
|
1374
|
+
if (!F) throw new Error("failed to approve token");
|
|
1375
|
+
p(d.APPROVING, { approveTxHash: F });
|
|
1378
1376
|
let j = !1;
|
|
1379
|
-
for (let
|
|
1380
|
-
client:
|
|
1377
|
+
for (let H = 0; H < Ae && (j = await we({
|
|
1378
|
+
client: R,
|
|
1381
1379
|
walletInteractions: n,
|
|
1382
|
-
tokenAddress:
|
|
1383
|
-
inputAmountRaw:
|
|
1384
|
-
}), !j);
|
|
1385
|
-
|
|
1380
|
+
tokenAddress: m.address,
|
|
1381
|
+
inputAmountRaw: T
|
|
1382
|
+
}), !j); H++)
|
|
1383
|
+
H < Ae - 1 && await f(Lt);
|
|
1386
1384
|
if (!j)
|
|
1387
1385
|
throw new Error(
|
|
1388
|
-
`Insufficient ${
|
|
1386
|
+
`Insufficient ${m.symbol} allowance to perform the swap. Please approve the token first.`
|
|
1389
1387
|
);
|
|
1390
|
-
|
|
1388
|
+
L++, p(d.APPROVING, {
|
|
1391
1389
|
hasApproval: !0,
|
|
1392
|
-
stepIndex:
|
|
1393
|
-
}),
|
|
1390
|
+
stepIndex: L
|
|
1391
|
+
}), E(() => U.onApproveSuccess(F)), E(
|
|
1394
1392
|
() => {
|
|
1395
|
-
var
|
|
1396
|
-
return (
|
|
1397
|
-
txHash:
|
|
1398
|
-
token:
|
|
1399
|
-
amount: ie(
|
|
1393
|
+
var H;
|
|
1394
|
+
return (H = r == null ? void 0 : r.onApproveSuccess) == null ? void 0 : H.call(r, {
|
|
1395
|
+
txHash: F,
|
|
1396
|
+
token: m,
|
|
1397
|
+
amount: ie(T, m.decimals)
|
|
1400
1398
|
});
|
|
1401
1399
|
}
|
|
1402
1400
|
);
|
|
1403
1401
|
}
|
|
1404
1402
|
p(d.SIGNING);
|
|
1405
|
-
const
|
|
1403
|
+
const G = R.prepareOrder({
|
|
1406
1404
|
form: t,
|
|
1407
|
-
inputTokenAddress:
|
|
1408
|
-
outputTokenAddress:
|
|
1409
|
-
swapperAddress:
|
|
1405
|
+
inputTokenAddress: m.address,
|
|
1406
|
+
outputTokenAddress: S.address,
|
|
1407
|
+
swapperAddress: u
|
|
1410
1408
|
});
|
|
1411
|
-
p(d.SIGNING, { preparedOrder:
|
|
1412
|
-
account:
|
|
1413
|
-
chainId:
|
|
1414
|
-
inputToken:
|
|
1415
|
-
outputToken:
|
|
1416
|
-
preparedOrder:
|
|
1417
|
-
}),
|
|
1418
|
-
let
|
|
1409
|
+
p(d.SIGNING, { preparedOrder: G }), Ut({
|
|
1410
|
+
account: u,
|
|
1411
|
+
chainId: l,
|
|
1412
|
+
inputToken: h,
|
|
1413
|
+
outputToken: S,
|
|
1414
|
+
preparedOrder: G
|
|
1415
|
+
}), E(() => U.onSignOrderRequest(G.order)), E(r == null ? void 0 : r.onSignOrderRequest);
|
|
1416
|
+
let V;
|
|
1419
1417
|
try {
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
),
|
|
1423
|
-
var
|
|
1424
|
-
return (
|
|
1418
|
+
V = await n.signOrder(
|
|
1419
|
+
G.signingRequest
|
|
1420
|
+
), E(() => U.onSignOrderSuccess(V)), E(() => {
|
|
1421
|
+
var F;
|
|
1422
|
+
return (F = r == null ? void 0 : r.onSignOrderSuccess) == null ? void 0 : F.call(r, V);
|
|
1425
1423
|
});
|
|
1426
|
-
} catch (
|
|
1427
|
-
throw
|
|
1424
|
+
} catch (F) {
|
|
1425
|
+
throw E(() => U.onSignOrderError(F)), E(() => {
|
|
1428
1426
|
var j;
|
|
1429
|
-
return (j = r == null ? void 0 : r.onSignOrderError) == null ? void 0 : j.call(r, ne(
|
|
1430
|
-
}),
|
|
1427
|
+
return (j = r == null ? void 0 : r.onSignOrderError) == null ? void 0 : j.call(r, ne(F));
|
|
1428
|
+
}), F;
|
|
1431
1429
|
}
|
|
1432
1430
|
p(d.SUBMITTING);
|
|
1433
|
-
const k = await
|
|
1431
|
+
const k = await R.submitOrder(G.order, V);
|
|
1434
1432
|
return p(d.SUCCESS, {
|
|
1435
1433
|
orderId: k.id.toString()
|
|
1436
|
-
}),
|
|
1437
|
-
var
|
|
1438
|
-
return (
|
|
1434
|
+
}), E(() => o(k)), E(() => i()), E(() => {
|
|
1435
|
+
var F;
|
|
1436
|
+
return (F = r == null ? void 0 : r.onOrderCreated) == null ? void 0 : F.call(r, k);
|
|
1439
1437
|
}), k;
|
|
1440
1438
|
} catch (A) {
|
|
1441
|
-
const y =
|
|
1439
|
+
const y = P.phase, N = ne(A), L = Ce(A);
|
|
1442
1440
|
throw I(
|
|
1443
|
-
|
|
1441
|
+
L ? d.REJECTED : d.FAILED,
|
|
1444
1442
|
{
|
|
1445
|
-
error:
|
|
1443
|
+
error: N,
|
|
1446
1444
|
parsedError: se(A)
|
|
1447
1445
|
}
|
|
1448
|
-
), y === d.WRAPPING ?
|
|
1449
|
-
var
|
|
1450
|
-
return (
|
|
1451
|
-
}),
|
|
1446
|
+
), y === d.WRAPPING ? E(() => U.onWrapError(A)) : y === d.APPROVING && E(() => U.onApproveError(A)), E(L ? r == null ? void 0 : r.onSubmitOrderRejected : () => {
|
|
1447
|
+
var G;
|
|
1448
|
+
return (G = r == null ? void 0 : r.onSubmitOrderFailed) == null ? void 0 : G.call(r, se(A));
|
|
1449
|
+
}), N;
|
|
1452
1450
|
}
|
|
1453
1451
|
}, Gt = () => {
|
|
1454
1452
|
const {
|
|
@@ -1460,66 +1458,66 @@ const Et = ({
|
|
|
1460
1458
|
callbacks: i,
|
|
1461
1459
|
account: s,
|
|
1462
1460
|
walletInteractions: a
|
|
1463
|
-
} =
|
|
1461
|
+
} = x(), { data: c } = Z(), f = wt(), O = vt(), u = W(), l = z();
|
|
1464
1462
|
return v(() => {
|
|
1465
|
-
|
|
1463
|
+
Dt({
|
|
1466
1464
|
account: s,
|
|
1467
1465
|
chainId: r,
|
|
1468
1466
|
isSupportedChain: o,
|
|
1469
1467
|
inputToken: e,
|
|
1470
1468
|
outputToken: t,
|
|
1471
1469
|
wrappedNativeToken: n,
|
|
1472
|
-
form:
|
|
1470
|
+
form: u,
|
|
1473
1471
|
client: c,
|
|
1474
1472
|
walletInteractions: a,
|
|
1475
1473
|
callbacks: i,
|
|
1476
|
-
addNewOrder:
|
|
1474
|
+
addNewOrder: f,
|
|
1477
1475
|
refetchActiveOrders: O,
|
|
1478
|
-
getCurrentExecution: () =>
|
|
1479
|
-
beginExecution:
|
|
1480
|
-
replaceExecution:
|
|
1476
|
+
getCurrentExecution: () => l.getState().state.currentExecution,
|
|
1477
|
+
beginExecution: l.getState().beginExecution,
|
|
1478
|
+
replaceExecution: l.getState().replaceExecution
|
|
1481
1479
|
}).catch(() => {
|
|
1482
1480
|
});
|
|
1483
1481
|
}, [
|
|
1484
1482
|
s,
|
|
1485
|
-
|
|
1483
|
+
f,
|
|
1486
1484
|
i,
|
|
1487
1485
|
r,
|
|
1488
1486
|
c,
|
|
1489
|
-
|
|
1487
|
+
u,
|
|
1490
1488
|
e,
|
|
1491
1489
|
o,
|
|
1492
1490
|
t,
|
|
1493
1491
|
n,
|
|
1494
1492
|
O,
|
|
1495
|
-
|
|
1493
|
+
l,
|
|
1496
1494
|
a
|
|
1497
1495
|
]);
|
|
1498
|
-
},
|
|
1499
|
-
const e =
|
|
1496
|
+
}, Mt = () => {
|
|
1497
|
+
const e = w((n) => n.state.currentExecution), t = w(
|
|
1500
1498
|
(n) => n.returnToOrderForm
|
|
1501
1499
|
);
|
|
1502
|
-
return
|
|
1500
|
+
return C(
|
|
1503
1501
|
() => ({ ...e, returnToOrderForm: t }),
|
|
1504
1502
|
[e, t]
|
|
1505
1503
|
);
|
|
1506
|
-
},
|
|
1507
|
-
const e =
|
|
1504
|
+
}, tr = () => {
|
|
1505
|
+
const e = Mt(), {
|
|
1508
1506
|
inputToken: t,
|
|
1509
1507
|
outputToken: n,
|
|
1510
1508
|
chainId: r,
|
|
1511
1509
|
isSupportedChain: o,
|
|
1512
1510
|
module: i,
|
|
1513
1511
|
overrides: s
|
|
1514
|
-
} =
|
|
1512
|
+
} = x(), { data: a, isLoading: c } = Z(), f = Gt(), O = w((R) => R.startNewOrder), u = v(() => f(), [f]), l = v(
|
|
1515
1513
|
() => O(Te({ module: i, overrides: s })),
|
|
1516
1514
|
[i, s, O]
|
|
1517
|
-
),
|
|
1518
|
-
return
|
|
1515
|
+
), h = ke(e.phase), m = et(e.phase), S = Y(e.phase);
|
|
1516
|
+
return C(() => ({
|
|
1519
1517
|
phase: e.phase,
|
|
1520
|
-
status:
|
|
1518
|
+
status: h,
|
|
1521
1519
|
error: e.parsedError,
|
|
1522
|
-
currentStep:
|
|
1520
|
+
currentStep: m,
|
|
1523
1521
|
currentStepIndex: e.stepIndex,
|
|
1524
1522
|
approvalTxHash: e.approveTxHash,
|
|
1525
1523
|
wrapTxHash: e.wrapTxHash,
|
|
@@ -1528,30 +1526,30 @@ const Et = ({
|
|
|
1528
1526
|
inputToken: e.inputToken ?? t,
|
|
1529
1527
|
outputToken: e.outputToken ?? n,
|
|
1530
1528
|
chainId: e.chainId ?? r,
|
|
1531
|
-
submitOrder:
|
|
1532
|
-
startNewOrder:
|
|
1529
|
+
submitOrder: u,
|
|
1530
|
+
startNewOrder: l,
|
|
1533
1531
|
returnToOrderForm: e.returnToOrderForm,
|
|
1534
|
-
isExecuting:
|
|
1532
|
+
isExecuting: S,
|
|
1535
1533
|
isSuccess: e.phase === d.SUCCESS,
|
|
1536
1534
|
isFailed: e.phase === d.FAILED,
|
|
1537
1535
|
isRejected: e.phase === d.REJECTED,
|
|
1538
1536
|
isPreparingOrder: e.phase === d.PREPARING || o && c && !a,
|
|
1539
|
-
canDismiss: !
|
|
1537
|
+
canDismiss: !S
|
|
1540
1538
|
}), [
|
|
1541
1539
|
a,
|
|
1542
|
-
|
|
1540
|
+
m,
|
|
1543
1541
|
t,
|
|
1544
1542
|
n,
|
|
1545
1543
|
r,
|
|
1546
1544
|
c,
|
|
1547
|
-
|
|
1545
|
+
S,
|
|
1548
1546
|
o,
|
|
1547
|
+
l,
|
|
1549
1548
|
u,
|
|
1550
|
-
|
|
1551
|
-
m,
|
|
1549
|
+
h,
|
|
1552
1550
|
e
|
|
1553
1551
|
]);
|
|
1554
|
-
},
|
|
1552
|
+
}, rr = () => {
|
|
1555
1553
|
const {
|
|
1556
1554
|
inputToken: e,
|
|
1557
1555
|
outputToken: t,
|
|
@@ -1561,24 +1559,24 @@ const Et = ({
|
|
|
1561
1559
|
inputAmountUi: i,
|
|
1562
1560
|
marketPriceLoading: s,
|
|
1563
1561
|
isSupportedChain: a
|
|
1564
|
-
} =
|
|
1565
|
-
(
|
|
1566
|
-
),
|
|
1567
|
-
return
|
|
1568
|
-
disabled:
|
|
1569
|
-
loading:
|
|
1570
|
-
}), [
|
|
1571
|
-
},
|
|
1572
|
-
const { inputToken: e, outputToken: t, callbacks: n } =
|
|
1562
|
+
} = x(), c = W(), { data: f, isLoading: O } = Z(), u = w(
|
|
1563
|
+
(T) => T.state.currentExecution.phase
|
|
1564
|
+
), l = Y(u), h = !!(e && $(e.address) && (!n || $(n.address))), m = s || !c.isReady || r === void 0, S = l || a && O && !f || !!(e && t && i && m), R = !!(!c.canSubmit || l || !a || !f || o || S || !e || !t || h);
|
|
1565
|
+
return C(() => ({
|
|
1566
|
+
disabled: R,
|
|
1567
|
+
loading: S
|
|
1568
|
+
}), [R, S]);
|
|
1569
|
+
}, nr = () => {
|
|
1570
|
+
const { inputToken: e, outputToken: t, callbacks: n } = x(), r = w((s) => s.updateState), { trades: o } = W(), i = v(
|
|
1573
1571
|
(s) => {
|
|
1574
|
-
r({ tradeCount: s }),
|
|
1572
|
+
r({ tradeCount: s }), E(() => {
|
|
1575
1573
|
var a;
|
|
1576
1574
|
return (a = n == null ? void 0 : n.onTradeCountChange) == null ? void 0 : a.call(n, s);
|
|
1577
1575
|
});
|
|
1578
1576
|
},
|
|
1579
1577
|
[n, r]
|
|
1580
1578
|
);
|
|
1581
|
-
return
|
|
1579
|
+
return C(
|
|
1582
1580
|
() => ({
|
|
1583
1581
|
totalTrades: o.totalTrades,
|
|
1584
1582
|
maxTrades: o.maxTrades,
|
|
@@ -1592,48 +1590,48 @@ const Et = ({
|
|
|
1592
1590
|
}),
|
|
1593
1591
|
[e, i, t, o]
|
|
1594
1592
|
);
|
|
1595
|
-
},
|
|
1596
|
-
const { marketPriceLoading: e, inputToken: t, outputToken: n, callbacks: r } =
|
|
1597
|
-
(
|
|
1598
|
-
c({ triggerPriceUi:
|
|
1599
|
-
var
|
|
1600
|
-
return (
|
|
1601
|
-
}),
|
|
1602
|
-
var
|
|
1603
|
-
return (
|
|
1593
|
+
}, ir = () => {
|
|
1594
|
+
const { marketPriceLoading: e, inputToken: t, outputToken: n, callbacks: r } = x(), { marketPrice: o, trades: i, triggerPrice: s, isInverted: a } = W(), c = w((l) => l.updateState), f = v(
|
|
1595
|
+
(l) => {
|
|
1596
|
+
c({ triggerPriceUi: l, triggerPricePercent: null }), E(() => {
|
|
1597
|
+
var h;
|
|
1598
|
+
return (h = r == null ? void 0 : r.onTriggerPriceChange) == null ? void 0 : h.call(r, l || "");
|
|
1599
|
+
}), E(() => {
|
|
1600
|
+
var h;
|
|
1601
|
+
return (h = r == null ? void 0 : r.onTriggerPricePercentChange) == null ? void 0 : h.call(r, "");
|
|
1604
1602
|
});
|
|
1605
1603
|
},
|
|
1606
1604
|
[r, c]
|
|
1607
1605
|
), O = v(
|
|
1608
|
-
(
|
|
1606
|
+
(l) => {
|
|
1609
1607
|
c({
|
|
1610
1608
|
triggerPriceUi: void 0,
|
|
1611
|
-
triggerPricePercent:
|
|
1612
|
-
}),
|
|
1613
|
-
var
|
|
1614
|
-
return (
|
|
1615
|
-
}),
|
|
1616
|
-
var
|
|
1617
|
-
return (
|
|
1609
|
+
triggerPricePercent: l
|
|
1610
|
+
}), E(() => {
|
|
1611
|
+
var h;
|
|
1612
|
+
return (h = r == null ? void 0 : r.onTriggerPriceChange) == null ? void 0 : h.call(r, "");
|
|
1613
|
+
}), E(() => {
|
|
1614
|
+
var h;
|
|
1615
|
+
return (h = r == null ? void 0 : r.onTriggerPricePercentChange) == null ? void 0 : h.call(r, l || "");
|
|
1618
1616
|
});
|
|
1619
1617
|
},
|
|
1620
1618
|
[r, c]
|
|
1621
|
-
),
|
|
1619
|
+
), u = v(() => {
|
|
1622
1620
|
c({
|
|
1623
1621
|
triggerPricePercent: void 0,
|
|
1624
1622
|
triggerPriceUi: void 0
|
|
1625
1623
|
});
|
|
1626
1624
|
}, [c]);
|
|
1627
|
-
return
|
|
1625
|
+
return C(
|
|
1628
1626
|
() => ({
|
|
1629
1627
|
price: s.display,
|
|
1630
1628
|
canonicalPriceRaw: s.raw,
|
|
1631
1629
|
outputAmountPerTrade: i.triggerOutputAmountPerTrade,
|
|
1632
1630
|
error: s.error,
|
|
1633
|
-
onInputChange:
|
|
1631
|
+
onInputChange: f,
|
|
1634
1632
|
onPercentageChange: O,
|
|
1635
1633
|
percentage: s.percentage,
|
|
1636
|
-
onReset:
|
|
1634
|
+
onReset: u,
|
|
1637
1635
|
inputToken: t,
|
|
1638
1636
|
outputToken: n,
|
|
1639
1637
|
displayInputToken: a ? n : t,
|
|
@@ -1646,9 +1644,9 @@ const Et = ({
|
|
|
1646
1644
|
a,
|
|
1647
1645
|
o.raw,
|
|
1648
1646
|
e,
|
|
1649
|
-
|
|
1647
|
+
f,
|
|
1650
1648
|
O,
|
|
1651
|
-
|
|
1649
|
+
u,
|
|
1652
1650
|
n,
|
|
1653
1651
|
i.triggerOutputAmountPerTrade,
|
|
1654
1652
|
s
|
|
@@ -1657,54 +1655,54 @@ const Et = ({
|
|
|
1657
1655
|
};
|
|
1658
1656
|
qe(Qe.version);
|
|
1659
1657
|
export {
|
|
1660
|
-
|
|
1658
|
+
ar as DISCLAIMER_URL,
|
|
1661
1659
|
te as Disclaimer,
|
|
1662
1660
|
d as ExecutionPhase,
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1661
|
+
q as ExecutionStatus,
|
|
1662
|
+
cr as InputErrors,
|
|
1663
|
+
dr as Module,
|
|
1664
|
+
ur as ORBS_LOGO,
|
|
1665
|
+
lr as ORBS_SLTP_FAQ_URL,
|
|
1666
|
+
mr as ORBS_TWAP_FAQ_URL,
|
|
1667
|
+
gr as ORBS_WEBSITE_URL,
|
|
1668
|
+
Pr as OrderFilter,
|
|
1669
|
+
fr as OrderStatus,
|
|
1670
|
+
hr as OrderType,
|
|
1671
|
+
Sr as Partners,
|
|
1672
|
+
Er as SPOT_VERSION,
|
|
1673
|
+
Ht as SpotProvider,
|
|
1674
|
+
Q as Steps,
|
|
1675
|
+
Ir as TimeUnit,
|
|
1676
|
+
Or as calculateOrderForm,
|
|
1677
|
+
pr as createClient,
|
|
1678
|
+
Ar as eqIgnoreCase,
|
|
1679
|
+
wr as getOrderExecutionRate,
|
|
1680
|
+
vr as getOrderFillDelayMillis,
|
|
1681
|
+
Cr as getOrderLimitPriceRate,
|
|
1682
|
+
Rr as getPartnerChains,
|
|
1683
|
+
yr as getPartners,
|
|
1684
|
+
Tr as getTriggerPriceRate,
|
|
1687
1685
|
Nr as getTwapConfig,
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1686
|
+
Lr as invertPriceInput,
|
|
1687
|
+
Fr as isNativeAddress,
|
|
1688
|
+
xr as isTxRejected,
|
|
1689
|
+
Ur as toAmountRaw,
|
|
1690
|
+
Dr as toAmountUI,
|
|
1691
|
+
jt as useAmountUi,
|
|
1692
|
+
Jt as useCancelOrder,
|
|
1693
|
+
Z as useClient,
|
|
1694
|
+
Qt as useDisclaimer,
|
|
1695
|
+
Yt as useDuration,
|
|
1696
|
+
tr as useExecution,
|
|
1697
|
+
$t as useFillDelay,
|
|
1698
|
+
Xt as useHistoryOrder,
|
|
1699
|
+
Zt as useInputErrors,
|
|
1700
|
+
bt as useLimitPrice,
|
|
1701
|
+
W as useOrderForm,
|
|
1702
|
+
zt as useOrders,
|
|
1703
|
+
kt as useOutputAmount,
|
|
1704
|
+
er as usePriceDisplay,
|
|
1705
|
+
rr as useSubmitButton,
|
|
1706
|
+
nr as useTrades,
|
|
1707
|
+
ir as useTriggerPrice
|
|
1710
1708
|
};
|