@multiversx/sdk-dapp-liquidity 2.3.0-alpha.0 → 2.3.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/reactjs/components/BridgeForm/Deposit.js +1 -1
- package/reactjs/components/BridgeForm/Deposit.mjs +156 -153
- package/reactjs/components/BridgeForm/Transfer.js +1 -1
- package/reactjs/components/BridgeForm/Transfer.mjs +145 -142
- package/reactjs/components/Connect/BridgeAccountDisplay.js +1 -1
- package/reactjs/components/Connect/BridgeAccountDisplay.mjs +45 -44
- package/reactjs/hooks/useDisconnectOnChainTypeChange.d.ts +12 -0
- package/reactjs/hooks/useDisconnectOnChainTypeChange.js +2 -0
- package/reactjs/hooks/useDisconnectOnChainTypeChange.mjs +13 -0
|
@@ -3,13 +3,13 @@ import { faSpinner as Ei } from "@fortawesome/free-solid-svg-icons/faSpinner";
|
|
|
3
3
|
import { FontAwesomeIcon as Mi } from "@fortawesome/react-fontawesome";
|
|
4
4
|
import { formatAmount as Pi } from "@multiversx/sdk-dapp-utils/out/helpers/formatAmount";
|
|
5
5
|
import { useAppKitNetwork as Vi } from "@reown/appkit/react";
|
|
6
|
-
import { waitForTransactionReceipt as
|
|
7
|
-
import
|
|
8
|
-
import { useRef as
|
|
6
|
+
import { waitForTransactionReceipt as Fi } from "@wagmi/core";
|
|
7
|
+
import Li from "lodash/debounce";
|
|
8
|
+
import { useRef as Le, useState as B, useMemo as g, useCallback as f, useEffect as N } from "react";
|
|
9
9
|
import { toast as M } from "react-toastify";
|
|
10
|
-
import { useBridgeTokenSelection as
|
|
10
|
+
import { useBridgeTokenSelection as ki } from "./hooks/useBridgeTokenSelection.mjs";
|
|
11
11
|
import { resolveSigningChainType as Ui } from "./utils/bridgeFormHelpers.mjs";
|
|
12
|
-
import { MVX_CHAIN_IDS as
|
|
12
|
+
import { MVX_CHAIN_IDS as ke } from "../../../constants/index.mjs";
|
|
13
13
|
import { getApiURL as ji } from "../../../helpers/getApiURL.mjs";
|
|
14
14
|
import "../../constants/index.mjs";
|
|
15
15
|
import { safeImageUrl as z } from "../../../helpers/safeImageUrl.mjs";
|
|
@@ -18,21 +18,22 @@ import "bitcoinjs-lib";
|
|
|
18
18
|
import "viem";
|
|
19
19
|
import { ChainType as P } from "../../../types/chainType.mjs";
|
|
20
20
|
import { useWeb3App as Hi } from "../../context/useWeb3App.mjs";
|
|
21
|
-
import { sameBridgeApiChainId as
|
|
21
|
+
import { sameBridgeApiChainId as de, toBridgeApiChainId as Oi } from "../../helpers/resolveBridgeApiChainId.mjs";
|
|
22
22
|
import { useAccount as Wi } from "../../hooks/useAccount.mjs";
|
|
23
23
|
import { useBridgeApiChainId as Xi } from "../../hooks/useBridgeApiChainId.mjs";
|
|
24
24
|
import { useBridgeFormik as zi, BridgeFormikValuesEnum as G } from "../../hooks/useBridgeFormik.mjs";
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
25
|
+
import { useDisconnectOnChainTypeChange as Gi } from "../../hooks/useDisconnectOnChainTypeChange.mjs";
|
|
26
|
+
import { useFetchBridgeData as Qi } from "../../hooks/useFetchBridgeData.mjs";
|
|
27
|
+
import { useGetChainId as _i } from "../../hooks/useGetChainId.mjs";
|
|
28
|
+
import { useNamespaceAddress as $i } from "../../hooks/useNamespaceAddress.mjs";
|
|
29
|
+
import { useSendTransactions as Ki } from "../../hooks/useSendTransactions.mjs";
|
|
30
|
+
import { useSignTransaction as Yi } from "../../hooks/useSignTransaction.mjs";
|
|
31
|
+
import { useInvalidateHistoryQuery as Ji } from "../../queries/useGetHistory.query.mjs";
|
|
32
|
+
import { useGetRateMutation as Zi } from "../../queries/useGetRate.mutation.mjs";
|
|
32
33
|
import { mxClsx as Ue } from "../../utils/mxClsx.mjs";
|
|
33
34
|
import { AmountCard as je } from "../AmountCard/AmountCard.mjs";
|
|
34
35
|
import { AmountInput as He } from "../AmountInput/AmountInput.mjs";
|
|
35
|
-
import { MxButton as
|
|
36
|
+
import { MxButton as Ti } from "../base/MxButton/MxButton.mjs";
|
|
36
37
|
import "../base/MxCard/MxCard.mjs";
|
|
37
38
|
import "../base/MxLink/MxLink.mjs";
|
|
38
39
|
import "../base/MxSearch/MxSearch.mjs";
|
|
@@ -41,17 +42,17 @@ import "@headlessui/react";
|
|
|
41
42
|
import "react-dom";
|
|
42
43
|
import "react-popper";
|
|
43
44
|
import "../base/MxTooltip/components/TooltipContainer/TooltipContainer.mjs";
|
|
44
|
-
import { BridgeHistory as
|
|
45
|
-
import { BridgeConnectButton as
|
|
45
|
+
import { BridgeHistory as et } from "../BridgeHistory/BridgeHistory.mjs";
|
|
46
|
+
import { BridgeConnectButton as it } from "../Connect/BridgeConnectButton.mjs";
|
|
46
47
|
import "wagmi";
|
|
47
|
-
import { MvxConnectButton as
|
|
48
|
-
import { BridgeAccountDisplay as
|
|
49
|
-
import { MvxAccountDisplay as
|
|
48
|
+
import { MvxConnectButton as tt } from "../Connect/MvxConnectButton.mjs";
|
|
49
|
+
import { BridgeAccountDisplay as nt } from "../Connect/BridgeAccountDisplay.mjs";
|
|
50
|
+
import { MvxAccountDisplay as rt } from "../Connect/MvxAccountDisplay.mjs";
|
|
50
51
|
import "@reown/appkit-controllers";
|
|
51
|
-
import { ToggleDirection as
|
|
52
|
+
import { ToggleDirection as ot } from "../ToggleDirection/ToggleDirection.mjs";
|
|
52
53
|
import { TokenSelector as Oe } from "../TokenSelector/TokenSelector.mjs";
|
|
53
54
|
let Q;
|
|
54
|
-
const
|
|
55
|
+
const an = ({
|
|
55
56
|
mvxChainId: _,
|
|
56
57
|
mvxAddress: c,
|
|
57
58
|
username: We,
|
|
@@ -63,78 +64,80 @@ const rn = ({
|
|
|
63
64
|
refetchTrigger: Qe,
|
|
64
65
|
showHistory: _e,
|
|
65
66
|
forcedDestinationTokenSymbol: $e,
|
|
66
|
-
onSuccessfullySentTransaction:
|
|
67
|
-
onFailedSentTransaction:
|
|
68
|
-
onHistoryClose:
|
|
69
|
-
onMvxConnect:
|
|
67
|
+
onSuccessfullySentTransaction: F,
|
|
68
|
+
onFailedSentTransaction: I,
|
|
69
|
+
onHistoryClose: L,
|
|
70
|
+
onMvxConnect: me,
|
|
70
71
|
onMvxDisconnect: Ke,
|
|
71
72
|
onNavigate: Ye,
|
|
72
73
|
onChangeDirection: Je
|
|
73
74
|
}) => {
|
|
74
75
|
var De, Se;
|
|
75
|
-
const Ze =
|
|
76
|
-
config:
|
|
77
|
-
options:
|
|
76
|
+
const Ze = Le(null), ue = Le(void 0), [$, Te] = B(!1), [k, A] = B(!1), [ei, ii] = B(1), [K, Y] = B(0), ti = Wi(), { switchNetwork: pe } = Vi(), he = Ji(), {
|
|
77
|
+
config: ge,
|
|
78
|
+
options: fe,
|
|
78
79
|
supportedChains: w,
|
|
79
80
|
nativeAuthToken: J,
|
|
80
|
-
bridgeOnly:
|
|
81
|
-
} = Hi(), Z =
|
|
82
|
-
evmTokensWithBalances:
|
|
83
|
-
mvxTokensWithBalances:
|
|
81
|
+
bridgeOnly: ni
|
|
82
|
+
} = Hi(), Z = _i(), qe = Xi(), {
|
|
83
|
+
evmTokensWithBalances: ri,
|
|
84
|
+
mvxTokensWithBalances: oi,
|
|
84
85
|
isTokensLoading: ai,
|
|
85
|
-
isLoadingEvmTokensBalances:
|
|
86
|
-
isLoadingMvxTokensBalances:
|
|
86
|
+
isLoadingEvmTokensBalances: si,
|
|
87
|
+
isLoadingMvxTokensBalances: li,
|
|
87
88
|
chains: D = [],
|
|
88
|
-
isChainsLoading:
|
|
89
|
-
} =
|
|
89
|
+
isChainsLoading: ci
|
|
90
|
+
} = Qi({
|
|
90
91
|
refetchTrigger: Qe,
|
|
91
92
|
mvxAddress: c,
|
|
92
|
-
mvxApiURL:
|
|
93
|
-
}), T = ai ||
|
|
93
|
+
mvxApiURL: fe.mvxApiURL
|
|
94
|
+
}), T = ai || si || li || ci, di = g(() => w.find((i) => de(i.id, Z)), [Z, w]), s = g(() => D.find(
|
|
94
95
|
(i) => i.chainId.toString() === _.toString()
|
|
95
|
-
), [Z, D]), { evm:
|
|
96
|
-
mutate:
|
|
96
|
+
), [Z, D]), { evm: be, solana: ve, bitcoin: Ie, sui: xe } = Yi(), ye = Ki(), {
|
|
97
|
+
mutate: mi,
|
|
97
98
|
data: m,
|
|
98
99
|
isPending: S,
|
|
99
100
|
error: x
|
|
100
|
-
} =
|
|
101
|
+
} = Zi(), R = ((De = x == null ? void 0 : x.response) == null ? void 0 : De.status) === 400 ? (Se = x == null ? void 0 : x.response) == null ? void 0 : Se.data.message : void 0, ui = f(
|
|
101
102
|
(i) => {
|
|
102
|
-
const
|
|
103
|
-
(d) =>
|
|
103
|
+
const v = w.find(
|
|
104
|
+
(d) => de(d.id, i.id)
|
|
104
105
|
);
|
|
105
|
-
|
|
106
|
+
v && pe(v);
|
|
106
107
|
},
|
|
107
|
-
[w,
|
|
108
|
+
[w, pe]
|
|
108
109
|
), {
|
|
109
110
|
firstToken: e,
|
|
110
111
|
secondToken: a,
|
|
111
112
|
fromOptions: U,
|
|
112
|
-
toOptions:
|
|
113
|
+
toOptions: pi,
|
|
113
114
|
selectedChainOption: r,
|
|
114
|
-
onChangeFirstSelect:
|
|
115
|
-
onChangeSecondSelect:
|
|
116
|
-
handleChangeDirection:
|
|
117
|
-
} =
|
|
115
|
+
onChangeFirstSelect: Be,
|
|
116
|
+
onChangeSecondSelect: hi,
|
|
117
|
+
handleChangeDirection: gi
|
|
118
|
+
} = ki({
|
|
118
119
|
chains: D,
|
|
119
|
-
activeChain:
|
|
120
|
+
activeChain: di,
|
|
120
121
|
sdkChains: w,
|
|
121
|
-
switchNetwork:
|
|
122
|
-
fromTokens:
|
|
123
|
-
toTokens:
|
|
122
|
+
switchNetwork: ui,
|
|
123
|
+
fromTokens: ri,
|
|
124
|
+
toTokens: oi,
|
|
124
125
|
firstTokenIdentifier: ze,
|
|
125
126
|
secondTokenIdentifier: Ge,
|
|
126
127
|
forcedDestinationTokenSymbol: $e,
|
|
127
128
|
isTokensLoading: T,
|
|
128
129
|
callbackRoute: Xe,
|
|
129
130
|
onNavigate: Ye
|
|
130
|
-
}),
|
|
131
|
-
(i) =>
|
|
131
|
+
}), fi = g(() => e ? ke.includes(e.chainId.toString()) : !1, [e == null ? void 0 : e.chainId]), qi = g(() => a ? ke.includes(a.chainId.toString()) : !1, [a == null ? void 0 : a.chainId]), [u, bi] = B(V ?? ""), [j, H] = B(C ?? ""), o = g(() => e ? D.find(
|
|
132
|
+
(i) => de(i.chainId, e.chainId)
|
|
132
133
|
) ?? r : r, [e == null ? void 0 : e.chainId, D, r]), O = g(
|
|
133
|
-
() => Oi(e == null ? void 0 : e.chainId) ??
|
|
134
|
-
[e == null ? void 0 : e.chainId,
|
|
135
|
-
)
|
|
136
|
-
|
|
137
|
-
|
|
134
|
+
() => Oi(e == null ? void 0 : e.chainId) ?? qe,
|
|
135
|
+
[e == null ? void 0 : e.chainId, qe]
|
|
136
|
+
);
|
|
137
|
+
Gi(o == null ? void 0 : o.chainType);
|
|
138
|
+
const q = $i(o == null ? void 0 : o.chainType), Ne = q, Ce = ti.isConnected && !!q, ee = u !== "" && j !== "", ie = f(
|
|
139
|
+
Li(async (i) => {
|
|
140
|
+
!i || !Number(i) || !q || !(e != null && e.address) || !(a != null && a.address) || !r || !O || mi({
|
|
138
141
|
nativeAuthToken: J ?? "",
|
|
139
142
|
body: {
|
|
140
143
|
tokenIn: e.address,
|
|
@@ -146,53 +149,53 @@ const rn = ({
|
|
|
146
149
|
});
|
|
147
150
|
}, 500),
|
|
148
151
|
[
|
|
149
|
-
|
|
152
|
+
q,
|
|
150
153
|
O,
|
|
151
154
|
e == null ? void 0 : e.address,
|
|
152
155
|
a == null ? void 0 : a.address,
|
|
153
156
|
r
|
|
154
157
|
]
|
|
155
158
|
), p = f((i) => {
|
|
156
|
-
|
|
157
|
-
}, []),
|
|
159
|
+
bi(() => i);
|
|
160
|
+
}, []), y = f((i) => {
|
|
158
161
|
H(() => i);
|
|
159
162
|
}, []), vi = f(() => {
|
|
160
|
-
|
|
161
|
-
}, [
|
|
163
|
+
L == null || L();
|
|
164
|
+
}, [L]), Ii = f(() => {
|
|
162
165
|
const i = Pi({
|
|
163
166
|
decimals: e == null ? void 0 : e.decimals,
|
|
164
167
|
input: (e == null ? void 0 : e.balance) ?? "0",
|
|
165
168
|
addCommas: !1,
|
|
166
169
|
digits: 4
|
|
167
170
|
});
|
|
168
|
-
|
|
171
|
+
b.setFieldValue("firstAmount", i), p(i);
|
|
169
172
|
}, [e == null ? void 0 : e.balance, e == null ? void 0 : e.decimals, p]), Ae = f(
|
|
170
173
|
async (i) => {
|
|
171
|
-
p(""),
|
|
174
|
+
p(""), y(""), he(), he(), F == null || F(i);
|
|
172
175
|
},
|
|
173
176
|
[
|
|
174
177
|
p,
|
|
175
|
-
|
|
176
|
-
|
|
178
|
+
y,
|
|
179
|
+
F
|
|
177
180
|
]
|
|
178
181
|
), xi = () => {
|
|
179
|
-
|
|
182
|
+
gi(), Je();
|
|
180
183
|
};
|
|
181
184
|
N(() => {
|
|
182
|
-
const i =
|
|
183
|
-
if (
|
|
184
|
-
const
|
|
185
|
+
const i = ue.current;
|
|
186
|
+
if (ue.current = r == null ? void 0 : r.chainId, !!i && (r == null ? void 0 : r.chainId) !== (e == null ? void 0 : e.chainId)) {
|
|
187
|
+
const v = U == null ? void 0 : U.find(
|
|
185
188
|
(d) => d.chainId.toString() === (r == null ? void 0 : r.chainId)
|
|
186
189
|
);
|
|
187
|
-
if (!
|
|
190
|
+
if (!v)
|
|
188
191
|
return;
|
|
189
|
-
|
|
192
|
+
Be(v);
|
|
190
193
|
}
|
|
191
194
|
}, [r == null ? void 0 : r.chainId]);
|
|
192
|
-
const
|
|
195
|
+
const yi = f(
|
|
193
196
|
async ({
|
|
194
197
|
transactions: i,
|
|
195
|
-
provider:
|
|
198
|
+
provider: v
|
|
196
199
|
}) => {
|
|
197
200
|
var Re, Ee, Me;
|
|
198
201
|
const d = [];
|
|
@@ -202,21 +205,21 @@ const rn = ({
|
|
|
202
205
|
for (const t of i) {
|
|
203
206
|
++E;
|
|
204
207
|
try {
|
|
205
|
-
switch (Ui(t,
|
|
208
|
+
switch (Ui(t, o)) {
|
|
206
209
|
case P.evm: {
|
|
207
|
-
const h = await
|
|
210
|
+
const h = await be.signTransaction({
|
|
208
211
|
...t,
|
|
209
212
|
value: BigInt(t.value),
|
|
210
213
|
gas: BigInt(t.gasLimit),
|
|
211
|
-
account:
|
|
214
|
+
account: Ne
|
|
212
215
|
});
|
|
213
216
|
if (!h || (d.push({
|
|
214
217
|
...t,
|
|
215
218
|
txHash: h
|
|
216
219
|
}), E === i.length - 1 || !h))
|
|
217
220
|
break;
|
|
218
|
-
const X = await
|
|
219
|
-
|
|
221
|
+
const X = await Fi(
|
|
222
|
+
ge,
|
|
220
223
|
{
|
|
221
224
|
confirmations: 1,
|
|
222
225
|
hash: h
|
|
@@ -231,16 +234,16 @@ const rn = ({
|
|
|
231
234
|
case P.sol:
|
|
232
235
|
if (!t.instructions || !t.feePayer)
|
|
233
236
|
break;
|
|
234
|
-
const
|
|
237
|
+
const ce = await ve.signTransaction({
|
|
235
238
|
feePayer: t.feePayer,
|
|
236
239
|
instructions: t.instructions,
|
|
237
240
|
recentBlockhash: t.recentBlockhash
|
|
238
241
|
});
|
|
239
|
-
if (!
|
|
242
|
+
if (!ce)
|
|
240
243
|
break;
|
|
241
244
|
d.push({
|
|
242
245
|
...t,
|
|
243
|
-
txHash:
|
|
246
|
+
txHash: ce
|
|
244
247
|
});
|
|
245
248
|
break;
|
|
246
249
|
case P.btc:
|
|
@@ -248,7 +251,7 @@ const rn = ({
|
|
|
248
251
|
console.error("No bitcoin params");
|
|
249
252
|
break;
|
|
250
253
|
}
|
|
251
|
-
const Si = await
|
|
254
|
+
const Si = await Ie.signTransaction(
|
|
252
255
|
t.bitcoinParams
|
|
253
256
|
);
|
|
254
257
|
d.push({
|
|
@@ -262,17 +265,17 @@ const rn = ({
|
|
|
262
265
|
console.error("No Sui transaction bytes or sender address");
|
|
263
266
|
break;
|
|
264
267
|
}
|
|
265
|
-
const
|
|
268
|
+
const Fe = await xe.signTransaction({
|
|
266
269
|
transaction: h,
|
|
267
270
|
address: X
|
|
268
271
|
});
|
|
269
|
-
if (!
|
|
272
|
+
if (!Fe)
|
|
270
273
|
break;
|
|
271
274
|
d.push({
|
|
272
275
|
...t,
|
|
273
276
|
suiParams: {
|
|
274
277
|
...t.suiParams,
|
|
275
|
-
signature:
|
|
278
|
+
signature: Fe
|
|
276
279
|
}
|
|
277
280
|
});
|
|
278
281
|
break;
|
|
@@ -285,51 +288,51 @@ const rn = ({
|
|
|
285
288
|
() => i.length - 1 - E
|
|
286
289
|
);
|
|
287
290
|
} catch {
|
|
288
|
-
M.dismiss(), M.error("Transaction aborted"),
|
|
291
|
+
M.dismiss(), M.error("Transaction aborted"), I == null || I("Transaction aborted"), A(!1);
|
|
289
292
|
return;
|
|
290
293
|
}
|
|
291
294
|
}
|
|
292
|
-
const { data:
|
|
295
|
+
const { data: le } = await ye({
|
|
293
296
|
transactions: d,
|
|
294
|
-
provider:
|
|
297
|
+
provider: v,
|
|
295
298
|
url: ji() ?? "",
|
|
296
299
|
token: J ?? ""
|
|
297
|
-
}), Pe = ((Me =
|
|
300
|
+
}), Pe = ((Me = le.transactions) == null ? void 0 : Me.map((t) => t.txHash).filter((t) => !!t)) ?? [], Ve = d.map((t) => t.txHash).filter((t) => !!t), Di = Pe.length > 0 ? Pe : Ve.length > 0 ? Ve : le.batchId ? [le.batchId] : [];
|
|
298
301
|
Ae(Di), A(!1);
|
|
299
302
|
} catch (E) {
|
|
300
|
-
console.error(E), M.dismiss(), M.error("Transaction cancelled"),
|
|
303
|
+
console.error(E), M.dismiss(), M.error("Transaction cancelled"), I == null || I("Transaction cancelled"), A(!1), Y(0), Ni(), p(""), y("");
|
|
301
304
|
}
|
|
302
305
|
},
|
|
303
306
|
[
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
+
o == null ? void 0 : o.chainType,
|
|
308
|
+
Ne,
|
|
309
|
+
ge,
|
|
307
310
|
p,
|
|
308
|
-
|
|
311
|
+
y,
|
|
309
312
|
J,
|
|
310
313
|
Ae,
|
|
311
314
|
ye,
|
|
312
|
-
xe.signTransaction,
|
|
313
|
-
ve.signTransaction,
|
|
314
315
|
Ie.signTransaction,
|
|
315
|
-
|
|
316
|
+
be.signTransaction,
|
|
317
|
+
ve.signTransaction,
|
|
318
|
+
xe.signTransaction
|
|
316
319
|
]
|
|
317
320
|
), {
|
|
318
|
-
formik:
|
|
319
|
-
firstAmountError:
|
|
320
|
-
secondAmountError:
|
|
321
|
-
fromChainError:
|
|
321
|
+
formik: b,
|
|
322
|
+
firstAmountError: te,
|
|
323
|
+
secondAmountError: ne,
|
|
324
|
+
fromChainError: re,
|
|
322
325
|
senderAddressError: oe,
|
|
323
|
-
receiverAddressError:
|
|
324
|
-
confirmRateError:
|
|
326
|
+
receiverAddressError: ae,
|
|
327
|
+
confirmRateError: se,
|
|
325
328
|
handleBlur: W,
|
|
326
329
|
handleChange: we,
|
|
327
|
-
handleSubmit:
|
|
330
|
+
handleSubmit: Bi,
|
|
328
331
|
resetSwapForm: Ni
|
|
329
332
|
} = zi({
|
|
330
333
|
isMvxConnected: !!c,
|
|
331
334
|
rate: m,
|
|
332
|
-
sender:
|
|
335
|
+
sender: q ?? "",
|
|
333
336
|
receiver: c ?? "",
|
|
334
337
|
firstToken: e,
|
|
335
338
|
firstAmount: u,
|
|
@@ -338,26 +341,26 @@ const rn = ({
|
|
|
338
341
|
secondToken: a,
|
|
339
342
|
secondAmount: j,
|
|
340
343
|
setForceRefetchRate: ii,
|
|
341
|
-
senderChainType:
|
|
344
|
+
senderChainType: o == null ? void 0 : o.chainType,
|
|
342
345
|
receiverChainType: P.mvx,
|
|
343
|
-
onSubmit:
|
|
344
|
-
}), Ci = !!(
|
|
345
|
-
return N(() => (u || H(""),
|
|
346
|
-
|
|
347
|
-
}, 50 * 1e3), () => clearInterval(Q)), [u, ei,
|
|
348
|
-
m != null && m.amountOut && (
|
|
346
|
+
onSubmit: yi
|
|
347
|
+
}), Ci = !!(te || ne || re || R || oe || ae || se), Ai = g(() => u !== "" ? R ?? te : void 0, [te, u, R]), wi = g(() => j !== "" ? re ?? ne : void 0, [re, ne, j]);
|
|
348
|
+
return N(() => (u || H(""), ie(u), Q && clearInterval(Q), Q = setInterval(() => {
|
|
349
|
+
ie(u);
|
|
350
|
+
}, 50 * 1e3), () => clearInterval(Q)), [u, ei, ie]), N(() => {
|
|
351
|
+
m != null && m.amountOut && (b.setFieldValue(G.secondAmount, m.amountOut), H(m.amountOut));
|
|
349
352
|
}, [m == null ? void 0 : m.amountOut]), N(() => {
|
|
350
|
-
R && (
|
|
353
|
+
R && (b.setFieldValue(G.secondAmount, "0"), H("0"));
|
|
351
354
|
}, [R]), N(() => {
|
|
352
|
-
V && (
|
|
355
|
+
V && (b.setFieldValue(
|
|
353
356
|
G.firstAmount,
|
|
354
357
|
V
|
|
355
358
|
), p(V));
|
|
356
359
|
}, []), N(() => {
|
|
357
|
-
C && (
|
|
360
|
+
C && (b.setFieldValue(
|
|
358
361
|
G.secondAmount,
|
|
359
362
|
C
|
|
360
|
-
),
|
|
363
|
+
), y(C));
|
|
361
364
|
}, [C]), /* @__PURE__ */ n(Ri, { children: /* @__PURE__ */ l(
|
|
362
365
|
"form",
|
|
363
366
|
{
|
|
@@ -365,9 +368,9 @@ const rn = ({
|
|
|
365
368
|
noValidate: !0,
|
|
366
369
|
className: "liq-flex liq-flex-col liq-gap-1 liq-relative",
|
|
367
370
|
autoComplete: "off",
|
|
368
|
-
onSubmit:
|
|
371
|
+
onSubmit: Bi,
|
|
369
372
|
children: [
|
|
370
|
-
_e && /* @__PURE__ */ n(
|
|
373
|
+
_e && /* @__PURE__ */ n(et, { mvxAddress: c, onClose: vi }),
|
|
371
374
|
/* @__PURE__ */ l(
|
|
372
375
|
je,
|
|
373
376
|
{
|
|
@@ -382,10 +385,10 @@ const rn = ({
|
|
|
382
385
|
/* @__PURE__ */ l("div", { className: "liq-flex liq-items-center liq-gap-1", children: [
|
|
383
386
|
/* @__PURE__ */ n("span", { children: "From" }),
|
|
384
387
|
/* @__PURE__ */ n(
|
|
385
|
-
|
|
388
|
+
nt,
|
|
386
389
|
{
|
|
387
390
|
disabled: S,
|
|
388
|
-
activeChain:
|
|
391
|
+
activeChain: o
|
|
389
392
|
}
|
|
390
393
|
)
|
|
391
394
|
] }),
|
|
@@ -395,7 +398,7 @@ const rn = ({
|
|
|
395
398
|
He,
|
|
396
399
|
{
|
|
397
400
|
inputName: "firstAmount",
|
|
398
|
-
inputValue:
|
|
401
|
+
inputValue: b.values.firstAmount,
|
|
399
402
|
amountError: Ai,
|
|
400
403
|
disabled: !1,
|
|
401
404
|
onInputDebounceChange: p,
|
|
@@ -410,10 +413,10 @@ const rn = ({
|
|
|
410
413
|
disabled: S,
|
|
411
414
|
options: U,
|
|
412
415
|
areOptionsLoading: T,
|
|
413
|
-
isMvxSelector:
|
|
416
|
+
isMvxSelector: fi,
|
|
414
417
|
isDestination: !1,
|
|
415
418
|
color: "neutral-850",
|
|
416
|
-
onChange:
|
|
419
|
+
onChange: Be,
|
|
417
420
|
onBlur: W,
|
|
418
421
|
onMaxBtnClick: Ii,
|
|
419
422
|
selectedOption: e,
|
|
@@ -424,7 +427,7 @@ const rn = ({
|
|
|
424
427
|
]
|
|
425
428
|
}
|
|
426
429
|
),
|
|
427
|
-
/* @__PURE__ */ n("div", { className: "liq-absolute liq-left-[6%] liq-top-[40%] -liq-mt-1 liq-z-10", children:
|
|
430
|
+
/* @__PURE__ */ n("div", { className: "liq-absolute liq-left-[6%] liq-top-[40%] -liq-mt-1 liq-z-10", children: ni && /* @__PURE__ */ n(ot, { onChangeDirection: xi }) }),
|
|
428
431
|
/* @__PURE__ */ l(
|
|
429
432
|
je,
|
|
430
433
|
{
|
|
@@ -438,29 +441,29 @@ const rn = ({
|
|
|
438
441
|
/* @__PURE__ */ l("div", { className: "liq-flex liq-items-center liq-gap-1", children: [
|
|
439
442
|
/* @__PURE__ */ n("span", { children: "To" }),
|
|
440
443
|
/* @__PURE__ */ n(
|
|
441
|
-
|
|
444
|
+
rt,
|
|
442
445
|
{
|
|
443
446
|
accountAddress: c,
|
|
444
|
-
chainIcon: z(
|
|
447
|
+
chainIcon: z(s == null ? void 0 : s.pngUrl),
|
|
445
448
|
username: We,
|
|
446
|
-
accountExplorerUrl: `${
|
|
449
|
+
accountExplorerUrl: `${fe.mvxExplorerAddress}/accounts/${c}`,
|
|
447
450
|
showTag: !0,
|
|
448
451
|
onDisconnect: Ke,
|
|
449
|
-
onConnect:
|
|
452
|
+
onConnect: me
|
|
450
453
|
}
|
|
451
454
|
)
|
|
452
455
|
] }),
|
|
456
|
+
ae && /* @__PURE__ */ n("div", { className: "liq-text-red-400 liq-text-xs liq-mt-1", children: ae }),
|
|
453
457
|
se && /* @__PURE__ */ n("div", { className: "liq-text-red-400 liq-text-xs liq-mt-1", children: se }),
|
|
454
|
-
le && /* @__PURE__ */ n("div", { className: "liq-text-red-400 liq-text-xs liq-mt-1", children: le }),
|
|
455
458
|
/* @__PURE__ */ l("div", { className: "liq-flex liq-justify-between liq-gap-1", children: [
|
|
456
459
|
/* @__PURE__ */ n(
|
|
457
460
|
He,
|
|
458
461
|
{
|
|
459
462
|
inputName: "secondAmount",
|
|
460
|
-
inputValue:
|
|
463
|
+
inputValue: b.values.secondAmount,
|
|
461
464
|
amountError: wi,
|
|
462
465
|
disabled: !1,
|
|
463
|
-
onInputDebounceChange:
|
|
466
|
+
onInputDebounceChange: y,
|
|
464
467
|
onInputChange: we,
|
|
465
468
|
onBlur: W
|
|
466
469
|
}
|
|
@@ -471,11 +474,11 @@ const rn = ({
|
|
|
471
474
|
name: "secondToken",
|
|
472
475
|
disabled: S,
|
|
473
476
|
omitDisableClass: !0,
|
|
474
|
-
options:
|
|
477
|
+
options: pi,
|
|
475
478
|
areOptionsLoading: T,
|
|
476
|
-
isMvxSelector:
|
|
479
|
+
isMvxSelector: qi,
|
|
477
480
|
color: "neutral-850",
|
|
478
|
-
onChange:
|
|
481
|
+
onChange: hi,
|
|
479
482
|
onBlur: W,
|
|
480
483
|
selectedOption: a
|
|
481
484
|
}
|
|
@@ -486,43 +489,43 @@ const rn = ({
|
|
|
486
489
|
),
|
|
487
490
|
/* @__PURE__ */ l("div", { className: "liq-flex liq-items-center liq-justify-center", children: [
|
|
488
491
|
!c && /* @__PURE__ */ n(
|
|
489
|
-
|
|
492
|
+
tt,
|
|
490
493
|
{
|
|
491
494
|
mvxAccountAddress: c,
|
|
492
|
-
icon: z(
|
|
493
|
-
onClick:
|
|
495
|
+
icon: z(s == null ? void 0 : s.pngUrl),
|
|
496
|
+
onClick: me
|
|
494
497
|
}
|
|
495
498
|
),
|
|
496
499
|
c && !Ce && /* @__PURE__ */ n(
|
|
497
|
-
|
|
500
|
+
it,
|
|
498
501
|
{
|
|
499
502
|
className: "liq-w-full liq-rounded-xl liq-bg-neutral-850/50 liq-px-8 liq-py-3 liq-font-semibold liq-text-primary-200 liq-transition-colors liq-duration-200 hover:enabled:liq-bg-primary-700/80 disabled:liq-opacity-50",
|
|
500
503
|
disabled: S,
|
|
501
|
-
activeChain:
|
|
504
|
+
activeChain: o
|
|
502
505
|
}
|
|
503
506
|
),
|
|
504
507
|
c && Ce && /* @__PURE__ */ l(
|
|
505
|
-
|
|
508
|
+
Ti,
|
|
506
509
|
{
|
|
507
510
|
type: "submit",
|
|
508
511
|
variant: "neutral-850",
|
|
509
512
|
className: "liq-w-full disabled:liq-bg-neutral-850/50 liq-py-3 hover:enabled:liq-bg-primary !liq-text-primary-200",
|
|
510
|
-
disabled: !
|
|
513
|
+
disabled: !ee || S || !c || !q || Ci || k,
|
|
511
514
|
children: [
|
|
512
|
-
|
|
515
|
+
ee && !k && /* @__PURE__ */ l("div", { className: "liq-flex liq-justify-center liq-items-center liq-gap-2", children: [
|
|
513
516
|
/* @__PURE__ */ n("div", { children: "Deposit on " }),
|
|
514
517
|
/* @__PURE__ */ n(
|
|
515
518
|
"img",
|
|
516
519
|
{
|
|
517
|
-
src: z(
|
|
520
|
+
src: z(s == null ? void 0 : s.pngUrl),
|
|
518
521
|
alt: "",
|
|
519
522
|
className: "liq-h-[1.5rem] liq-w-[1.5rem] liq-rounded-lg"
|
|
520
523
|
}
|
|
521
524
|
),
|
|
522
525
|
/* @__PURE__ */ n("div", { children: "MultiversX" })
|
|
523
526
|
] }),
|
|
524
|
-
!
|
|
525
|
-
|
|
527
|
+
!ee && !k && /* @__PURE__ */ n("span", { className: "liq-text-neutral-100", children: "Enter amount" }),
|
|
528
|
+
k && /* @__PURE__ */ l("div", { className: "liq-flex liq-justify-center liq-items-center liq-gap-2", children: [
|
|
526
529
|
/* @__PURE__ */ n(
|
|
527
530
|
Mi,
|
|
528
531
|
{
|
|
@@ -535,7 +538,7 @@ const rn = ({
|
|
|
535
538
|
/* @__PURE__ */ n(
|
|
536
539
|
"img",
|
|
537
540
|
{
|
|
538
|
-
src: z(
|
|
541
|
+
src: z(s == null ? void 0 : s.pngUrl),
|
|
539
542
|
alt: "",
|
|
540
543
|
className: "liq-h-[1.5rem] liq-w-[1.5rem] liq-rounded-lg"
|
|
541
544
|
}
|
|
@@ -546,7 +549,7 @@ const rn = ({
|
|
|
546
549
|
}
|
|
547
550
|
)
|
|
548
551
|
] }),
|
|
549
|
-
|
|
552
|
+
q && K > 0 && /* @__PURE__ */ n("div", { className: "liq-flex liq-items-center liq-justify-center liq-text-neutral-300 liq-text-sm", children: /* @__PURE__ */ l("div", { children: [
|
|
550
553
|
"You will be asked to sign ",
|
|
551
554
|
K,
|
|
552
555
|
" ",
|
|
@@ -559,5 +562,5 @@ const rn = ({
|
|
|
559
562
|
) });
|
|
560
563
|
};
|
|
561
564
|
export {
|
|
562
|
-
|
|
565
|
+
an as Deposit
|
|
563
566
|
};
|