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