@multiversx/sdk-dapp-liquidity 2.3.0-alpha.1 → 2.3.0-alpha.3
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 +155 -147
- package/reactjs/components/BridgeForm/Transfer.js +1 -1
- package/reactjs/components/BridgeForm/Transfer.mjs +99 -94
- package/reactjs/components/Connect/BridgeAccountDisplay.js +1 -1
- package/reactjs/components/Connect/BridgeAccountDisplay.mjs +59 -58
- package/reactjs/hooks/useDisconnectOnChainTypeChange.d.ts +12 -0
- package/reactjs/hooks/useDisconnectOnChainTypeChange.js +2 -0
- package/reactjs/hooks/useDisconnectOnChainTypeChange.mjs +13 -0
|
@@ -3,36 +3,37 @@ 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
|
|
9
|
-
import { toast as
|
|
10
|
-
import { useBridgeTokenSelection as
|
|
11
|
-
import { resolveSigningChainType as
|
|
12
|
-
import { MVX_CHAIN_IDS as
|
|
13
|
-
import { getApiURL 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
|
+
import { toast as P } from "react-toastify";
|
|
10
|
+
import { useBridgeTokenSelection as Ui } from "./hooks/useBridgeTokenSelection.mjs";
|
|
11
|
+
import { resolveSigningChainType as ji } from "./utils/bridgeFormHelpers.mjs";
|
|
12
|
+
import { MVX_CHAIN_IDS as Ue } from "../../../constants/index.mjs";
|
|
13
|
+
import { getApiURL as ki } from "../../../helpers/getApiURL.mjs";
|
|
14
14
|
import "../../constants/index.mjs";
|
|
15
15
|
import { safeImageUrl as z } from "../../../helpers/safeImageUrl.mjs";
|
|
16
16
|
import "@solana/web3.js";
|
|
17
17
|
import "bitcoinjs-lib";
|
|
18
18
|
import "viem";
|
|
19
|
-
import { ChainType as
|
|
19
|
+
import { ChainType as V } from "../../../types/chainType.mjs";
|
|
20
20
|
import { useWeb3App as Hi } from "../../context/useWeb3App.mjs";
|
|
21
|
-
import { sameBridgeApiChainId as
|
|
21
|
+
import { sameBridgeApiChainId as me, 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 {
|
|
32
|
-
import {
|
|
33
|
-
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";
|
|
33
|
+
import { mxClsx as je } from "../../utils/mxClsx.mjs";
|
|
34
|
+
import { AmountCard as ke } 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,99 +42,101 @@ 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 at } from "../ToggleDirection/ToggleDirection.mjs";
|
|
52
53
|
import { TokenSelector as Oe } from "../TokenSelector/TokenSelector.mjs";
|
|
53
54
|
let Q;
|
|
54
|
-
const
|
|
55
|
+
const on = ({
|
|
55
56
|
mvxChainId: _,
|
|
56
57
|
mvxAddress: c,
|
|
57
58
|
username: We,
|
|
58
59
|
callbackRoute: Xe = "/",
|
|
59
60
|
firstTokenIdentifier: ze,
|
|
60
61
|
secondTokenIdentifier: Ge,
|
|
61
|
-
firstTokenAmount:
|
|
62
|
+
firstTokenAmount: F,
|
|
62
63
|
secondTokenAmount: C,
|
|
63
64
|
refetchTrigger: Qe,
|
|
64
65
|
showHistory: _e,
|
|
65
66
|
forcedDestinationTokenSymbol: $e,
|
|
66
|
-
onSuccessfullySentTransaction:
|
|
67
|
+
onSuccessfullySentTransaction: L,
|
|
67
68
|
onFailedSentTransaction: I,
|
|
68
|
-
onHistoryClose:
|
|
69
|
-
onMvxConnect:
|
|
69
|
+
onHistoryClose: U,
|
|
70
|
+
onMvxConnect: ue,
|
|
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), pe = Le(void 0), [$, Te] = B(!1), [j, A] = B(!1), [ei, ii] = B(1), [K, Y] = B(0), ti = Wi(), { switchNetwork: he } = Vi(), ge = Ji(), {
|
|
77
|
+
config: fe,
|
|
78
|
+
options: qe,
|
|
78
79
|
supportedChains: w,
|
|
79
80
|
nativeAuthToken: J,
|
|
80
81
|
bridgeOnly: ni
|
|
81
|
-
} = Hi(), Z =
|
|
82
|
+
} = Hi(), Z = _i(), be = Xi(), {
|
|
82
83
|
evmTokensWithBalances: ri,
|
|
83
|
-
mvxTokensWithBalances:
|
|
84
|
-
isTokensLoading:
|
|
84
|
+
mvxTokensWithBalances: ai,
|
|
85
|
+
isTokensLoading: oi,
|
|
85
86
|
isLoadingEvmTokensBalances: si,
|
|
86
87
|
isLoadingMvxTokensBalances: li,
|
|
87
88
|
chains: D = [],
|
|
88
89
|
isChainsLoading: ci
|
|
89
|
-
} =
|
|
90
|
+
} = Qi({
|
|
90
91
|
refetchTrigger: Qe,
|
|
91
92
|
mvxAddress: c,
|
|
92
|
-
mvxApiURL:
|
|
93
|
-
}), T =
|
|
93
|
+
mvxApiURL: qe.mvxApiURL
|
|
94
|
+
}), T = oi || si || li || ci, di = g(() => w.find((i) => me(i.id, Z)), [Z, w]), s = g(() => D.find(
|
|
94
95
|
(i) => i.chainId.toString() === _.toString()
|
|
95
|
-
), [Z, D]), { evm:
|
|
96
|
+
), [Z, D]), { evm: ve, solana: Ie, bitcoin: xe, sui: ye } = Yi(), Be = Ki(), {
|
|
96
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
103
|
const v = w.find(
|
|
103
|
-
(d) =>
|
|
104
|
+
(d) => me(d.id, i.id)
|
|
104
105
|
);
|
|
105
|
-
v &&
|
|
106
|
+
v && he(v);
|
|
106
107
|
},
|
|
107
|
-
[w,
|
|
108
|
+
[w, he]
|
|
108
109
|
), {
|
|
109
110
|
firstToken: e,
|
|
110
111
|
secondToken: o,
|
|
111
|
-
fromOptions:
|
|
112
|
+
fromOptions: E,
|
|
112
113
|
toOptions: pi,
|
|
113
114
|
selectedChainOption: r,
|
|
114
|
-
onChangeFirstSelect:
|
|
115
|
+
onChangeFirstSelect: ee,
|
|
115
116
|
onChangeSecondSelect: hi,
|
|
116
117
|
handleChangeDirection: gi
|
|
117
|
-
} =
|
|
118
|
+
} = Ui({
|
|
118
119
|
chains: D,
|
|
119
120
|
activeChain: di,
|
|
120
121
|
sdkChains: w,
|
|
121
122
|
switchNetwork: ui,
|
|
122
123
|
fromTokens: ri,
|
|
123
|
-
toTokens:
|
|
124
|
+
toTokens: ai,
|
|
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
|
-
}), fi = g(() => e ?
|
|
131
|
-
(i) =>
|
|
131
|
+
}), fi = g(() => e ? Ue.includes(e.chainId.toString()) : !1, [e == null ? void 0 : e.chainId]), qi = g(() => o ? Ue.includes(o.chainId.toString()) : !1, [o == null ? void 0 : o.chainId]), [u, bi] = B(F ?? ""), [k, H] = B(C ?? ""), a = g(() => e ? D.find(
|
|
132
|
+
(i) => me(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
|
-
|
|
134
|
+
() => Oi(e == null ? void 0 : e.chainId) ?? be,
|
|
135
|
+
[e == null ? void 0 : e.chainId, be]
|
|
136
|
+
);
|
|
137
|
+
Gi(a == null ? void 0 : a.chainType);
|
|
138
|
+
const q = $i(a == null ? void 0 : a.chainType), Ne = q, Ce = ti.isConnected && !!q, ie = u !== "" && k !== "", te = f(
|
|
139
|
+
Li(async (i) => {
|
|
137
140
|
!i || !Number(i) || !q || !(e != null && e.address) || !(o != null && o.address) || !r || !O || mi({
|
|
138
141
|
nativeAuthToken: J ?? "",
|
|
139
142
|
body: {
|
|
@@ -154,11 +157,11 @@ const rn = ({
|
|
|
154
157
|
]
|
|
155
158
|
), p = f((i) => {
|
|
156
159
|
bi(() => i);
|
|
157
|
-
}, []),
|
|
160
|
+
}, []), y = f((i) => {
|
|
158
161
|
H(() => i);
|
|
159
162
|
}, []), vi = f(() => {
|
|
160
|
-
|
|
161
|
-
}, [
|
|
163
|
+
U == null || U();
|
|
164
|
+
}, [U]), 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",
|
|
@@ -168,28 +171,33 @@ const rn = ({
|
|
|
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(""), ge(), ge(), L == null || L(i);
|
|
172
175
|
},
|
|
173
176
|
[
|
|
174
177
|
p,
|
|
175
|
-
|
|
176
|
-
|
|
178
|
+
y,
|
|
179
|
+
L
|
|
177
180
|
]
|
|
178
181
|
), xi = () => {
|
|
179
182
|
gi(), Je();
|
|
180
183
|
};
|
|
181
184
|
N(() => {
|
|
182
|
-
const i =
|
|
183
|
-
if (
|
|
184
|
-
const v =
|
|
185
|
+
const i = pe.current;
|
|
186
|
+
if (pe.current = r == null ? void 0 : r.chainId, !!i && (r == null ? void 0 : r.chainId) !== (e == null ? void 0 : e.chainId)) {
|
|
187
|
+
const v = E == null ? void 0 : E.find(
|
|
185
188
|
(d) => d.chainId.toString() === (r == null ? void 0 : r.chainId)
|
|
186
189
|
);
|
|
187
190
|
if (!v)
|
|
188
191
|
return;
|
|
189
|
-
|
|
192
|
+
ee(v);
|
|
190
193
|
}
|
|
191
|
-
}, [
|
|
192
|
-
|
|
194
|
+
}, [
|
|
195
|
+
r == null ? void 0 : r.chainId,
|
|
196
|
+
e == null ? void 0 : e.chainId,
|
|
197
|
+
E,
|
|
198
|
+
ee
|
|
199
|
+
]);
|
|
200
|
+
const yi = f(
|
|
193
201
|
async ({
|
|
194
202
|
transactions: i,
|
|
195
203
|
provider: v
|
|
@@ -198,13 +206,13 @@ const rn = ({
|
|
|
198
206
|
const d = [];
|
|
199
207
|
A(!0), Y(() => i.length);
|
|
200
208
|
try {
|
|
201
|
-
let
|
|
209
|
+
let M = -1;
|
|
202
210
|
for (const t of i) {
|
|
203
|
-
++
|
|
211
|
+
++M;
|
|
204
212
|
try {
|
|
205
|
-
switch (
|
|
206
|
-
case
|
|
207
|
-
const h = await
|
|
213
|
+
switch (ji(t, a)) {
|
|
214
|
+
case V.evm: {
|
|
215
|
+
const h = await ve.signTransaction({
|
|
208
216
|
...t,
|
|
209
217
|
value: BigInt(t.value),
|
|
210
218
|
gas: BigInt(t.gasLimit),
|
|
@@ -213,10 +221,10 @@ const rn = ({
|
|
|
213
221
|
if (!h || (d.push({
|
|
214
222
|
...t,
|
|
215
223
|
txHash: h
|
|
216
|
-
}),
|
|
224
|
+
}), M === i.length - 1 || !h))
|
|
217
225
|
break;
|
|
218
|
-
const X = await
|
|
219
|
-
|
|
226
|
+
const X = await Fi(
|
|
227
|
+
fe,
|
|
220
228
|
{
|
|
221
229
|
confirmations: 1,
|
|
222
230
|
hash: h
|
|
@@ -228,27 +236,27 @@ const rn = ({
|
|
|
228
236
|
});
|
|
229
237
|
break;
|
|
230
238
|
}
|
|
231
|
-
case
|
|
239
|
+
case V.sol:
|
|
232
240
|
if (!t.instructions || !t.feePayer)
|
|
233
241
|
break;
|
|
234
|
-
const
|
|
242
|
+
const de = await Ie.signTransaction({
|
|
235
243
|
feePayer: t.feePayer,
|
|
236
244
|
instructions: t.instructions,
|
|
237
245
|
recentBlockhash: t.recentBlockhash
|
|
238
246
|
});
|
|
239
|
-
if (!
|
|
247
|
+
if (!de)
|
|
240
248
|
break;
|
|
241
249
|
d.push({
|
|
242
250
|
...t,
|
|
243
|
-
txHash:
|
|
251
|
+
txHash: de
|
|
244
252
|
});
|
|
245
253
|
break;
|
|
246
|
-
case
|
|
254
|
+
case V.btc:
|
|
247
255
|
if (!t.bitcoinParams) {
|
|
248
256
|
console.error("No bitcoin params");
|
|
249
257
|
break;
|
|
250
258
|
}
|
|
251
|
-
const Si = await
|
|
259
|
+
const Si = await xe.signTransaction(
|
|
252
260
|
t.bitcoinParams
|
|
253
261
|
);
|
|
254
262
|
d.push({
|
|
@@ -256,75 +264,75 @@ const rn = ({
|
|
|
256
264
|
txHash: Si
|
|
257
265
|
});
|
|
258
266
|
break;
|
|
259
|
-
case
|
|
267
|
+
case V.sui: {
|
|
260
268
|
const h = (Re = t.suiParams) == null ? void 0 : Re.transactionBytes, X = (Ee = t.suiParams) == null ? void 0 : Ee.sender;
|
|
261
269
|
if (!h || !X) {
|
|
262
270
|
console.error("No Sui transaction bytes or sender address");
|
|
263
271
|
break;
|
|
264
272
|
}
|
|
265
|
-
const
|
|
273
|
+
const Fe = await ye.signTransaction({
|
|
266
274
|
transaction: h,
|
|
267
275
|
address: X
|
|
268
276
|
});
|
|
269
|
-
if (!
|
|
277
|
+
if (!Fe)
|
|
270
278
|
break;
|
|
271
279
|
d.push({
|
|
272
280
|
...t,
|
|
273
281
|
suiParams: {
|
|
274
282
|
...t.suiParams,
|
|
275
|
-
signature:
|
|
283
|
+
signature: Fe
|
|
276
284
|
}
|
|
277
285
|
});
|
|
278
286
|
break;
|
|
279
287
|
}
|
|
280
288
|
default:
|
|
281
|
-
|
|
289
|
+
P.error("Provider not supported"), A(!1);
|
|
282
290
|
return;
|
|
283
291
|
}
|
|
284
292
|
Y(
|
|
285
|
-
() => i.length - 1 -
|
|
293
|
+
() => i.length - 1 - M
|
|
286
294
|
);
|
|
287
295
|
} catch {
|
|
288
|
-
|
|
296
|
+
P.dismiss(), P.error("Transaction aborted"), I == null || I("Transaction aborted"), A(!1);
|
|
289
297
|
return;
|
|
290
298
|
}
|
|
291
299
|
}
|
|
292
|
-
const { data:
|
|
300
|
+
const { data: ce } = await Be({
|
|
293
301
|
transactions: d,
|
|
294
302
|
provider: v,
|
|
295
|
-
url:
|
|
303
|
+
url: ki() ?? "",
|
|
296
304
|
token: J ?? ""
|
|
297
|
-
}), Pe = ((Me =
|
|
305
|
+
}), Pe = ((Me = ce.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 : ce.batchId ? [ce.batchId] : [];
|
|
298
306
|
Ae(Di), A(!1);
|
|
299
|
-
} catch (
|
|
300
|
-
console.error(
|
|
307
|
+
} catch (M) {
|
|
308
|
+
console.error(M), P.dismiss(), P.error("Transaction cancelled"), I == null || I("Transaction cancelled"), A(!1), Y(0), Ni(), p(""), y("");
|
|
301
309
|
}
|
|
302
310
|
},
|
|
303
311
|
[
|
|
304
|
-
|
|
312
|
+
a == null ? void 0 : a.chainType,
|
|
305
313
|
Ne,
|
|
306
|
-
|
|
314
|
+
fe,
|
|
307
315
|
p,
|
|
308
|
-
|
|
316
|
+
y,
|
|
309
317
|
J,
|
|
310
318
|
Ae,
|
|
311
319
|
Be,
|
|
312
|
-
|
|
313
|
-
be.signTransaction,
|
|
320
|
+
xe.signTransaction,
|
|
314
321
|
ve.signTransaction,
|
|
315
|
-
|
|
322
|
+
Ie.signTransaction,
|
|
323
|
+
ye.signTransaction
|
|
316
324
|
]
|
|
317
325
|
), {
|
|
318
326
|
formik: b,
|
|
319
|
-
firstAmountError:
|
|
320
|
-
secondAmountError:
|
|
321
|
-
fromChainError:
|
|
327
|
+
firstAmountError: ne,
|
|
328
|
+
secondAmountError: re,
|
|
329
|
+
fromChainError: ae,
|
|
322
330
|
senderAddressError: oe,
|
|
323
|
-
receiverAddressError:
|
|
324
|
-
confirmRateError:
|
|
331
|
+
receiverAddressError: se,
|
|
332
|
+
confirmRateError: le,
|
|
325
333
|
handleBlur: W,
|
|
326
334
|
handleChange: we,
|
|
327
|
-
handleSubmit:
|
|
335
|
+
handleSubmit: Bi,
|
|
328
336
|
resetSwapForm: Ni
|
|
329
337
|
} = zi({
|
|
330
338
|
isMvxConnected: !!c,
|
|
@@ -336,28 +344,28 @@ const rn = ({
|
|
|
336
344
|
fromChainId: O,
|
|
337
345
|
toChainId: _,
|
|
338
346
|
secondToken: o,
|
|
339
|
-
secondAmount:
|
|
347
|
+
secondAmount: k,
|
|
340
348
|
setForceRefetchRate: ii,
|
|
341
|
-
senderChainType:
|
|
342
|
-
receiverChainType:
|
|
343
|
-
onSubmit:
|
|
344
|
-
}), Ci = !!(
|
|
345
|
-
return N(() => (u || H(""),
|
|
346
|
-
|
|
347
|
-
}, 50 * 1e3), () => clearInterval(Q)), [u, ei,
|
|
349
|
+
senderChainType: a == null ? void 0 : a.chainType,
|
|
350
|
+
receiverChainType: V.mvx,
|
|
351
|
+
onSubmit: yi
|
|
352
|
+
}), Ci = !!(ne || re || ae || R || oe || se || le), Ai = g(() => u !== "" ? R ?? ne : void 0, [ne, u, R]), wi = g(() => k !== "" ? ae ?? re : void 0, [ae, re, k]);
|
|
353
|
+
return N(() => (u || H(""), te(u), Q && clearInterval(Q), Q = setInterval(() => {
|
|
354
|
+
te(u);
|
|
355
|
+
}, 50 * 1e3), () => clearInterval(Q)), [u, ei, te]), N(() => {
|
|
348
356
|
m != null && m.amountOut && (b.setFieldValue(G.secondAmount, m.amountOut), H(m.amountOut));
|
|
349
357
|
}, [m == null ? void 0 : m.amountOut]), N(() => {
|
|
350
358
|
R && (b.setFieldValue(G.secondAmount, "0"), H("0"));
|
|
351
359
|
}, [R]), N(() => {
|
|
352
|
-
|
|
360
|
+
F && (b.setFieldValue(
|
|
353
361
|
G.firstAmount,
|
|
354
|
-
|
|
355
|
-
), p(
|
|
362
|
+
F
|
|
363
|
+
), p(F));
|
|
356
364
|
}, []), N(() => {
|
|
357
365
|
C && (b.setFieldValue(
|
|
358
366
|
G.secondAmount,
|
|
359
367
|
C
|
|
360
|
-
),
|
|
368
|
+
), y(C));
|
|
361
369
|
}, [C]), /* @__PURE__ */ n(Ri, { children: /* @__PURE__ */ l(
|
|
362
370
|
"form",
|
|
363
371
|
{
|
|
@@ -365,13 +373,13 @@ const rn = ({
|
|
|
365
373
|
noValidate: !0,
|
|
366
374
|
className: "liq-flex liq-flex-col liq-gap-1 liq-relative",
|
|
367
375
|
autoComplete: "off",
|
|
368
|
-
onSubmit:
|
|
376
|
+
onSubmit: Bi,
|
|
369
377
|
children: [
|
|
370
|
-
_e && /* @__PURE__ */ n(
|
|
378
|
+
_e && /* @__PURE__ */ n(et, { mvxAddress: c, onClose: vi }),
|
|
371
379
|
/* @__PURE__ */ l(
|
|
372
|
-
|
|
380
|
+
ke,
|
|
373
381
|
{
|
|
374
|
-
className:
|
|
382
|
+
className: je(
|
|
375
383
|
"liq-pb-8 liq-pt-6 hover:liq-bg-neutral-700/50 sm:liq-pb-6",
|
|
376
384
|
{
|
|
377
385
|
"liq-pointer-events-none": $,
|
|
@@ -382,10 +390,10 @@ const rn = ({
|
|
|
382
390
|
/* @__PURE__ */ l("div", { className: "liq-flex liq-items-center liq-gap-1", children: [
|
|
383
391
|
/* @__PURE__ */ n("span", { children: "From" }),
|
|
384
392
|
/* @__PURE__ */ n(
|
|
385
|
-
|
|
393
|
+
nt,
|
|
386
394
|
{
|
|
387
395
|
disabled: S,
|
|
388
|
-
activeChain:
|
|
396
|
+
activeChain: a
|
|
389
397
|
}
|
|
390
398
|
)
|
|
391
399
|
] }),
|
|
@@ -408,12 +416,12 @@ const rn = ({
|
|
|
408
416
|
{
|
|
409
417
|
name: "firstToken",
|
|
410
418
|
disabled: S,
|
|
411
|
-
options:
|
|
419
|
+
options: E,
|
|
412
420
|
areOptionsLoading: T,
|
|
413
421
|
isMvxSelector: fi,
|
|
414
422
|
isDestination: !1,
|
|
415
423
|
color: "neutral-850",
|
|
416
|
-
onChange:
|
|
424
|
+
onChange: ee,
|
|
417
425
|
onBlur: W,
|
|
418
426
|
onMaxBtnClick: Ii,
|
|
419
427
|
selectedOption: e,
|
|
@@ -424,11 +432,11 @@ const rn = ({
|
|
|
424
432
|
]
|
|
425
433
|
}
|
|
426
434
|
),
|
|
427
|
-
/* @__PURE__ */ n("div", { className: "liq-absolute liq-left-[6%] liq-top-[40%] -liq-mt-1 liq-z-10", children: ni && /* @__PURE__ */ n(
|
|
435
|
+
/* @__PURE__ */ n("div", { className: "liq-absolute liq-left-[6%] liq-top-[40%] -liq-mt-1 liq-z-10", children: ni && /* @__PURE__ */ n(at, { onChangeDirection: xi }) }),
|
|
428
436
|
/* @__PURE__ */ l(
|
|
429
|
-
|
|
437
|
+
ke,
|
|
430
438
|
{
|
|
431
|
-
className:
|
|
439
|
+
className: je(
|
|
432
440
|
"liq-pb-8 liq-pt-6 hover:liq-bg-neutral-700/50 sm:liq-pb-6",
|
|
433
441
|
{
|
|
434
442
|
"liq-pointer-events-none": $
|
|
@@ -438,20 +446,20 @@ const rn = ({
|
|
|
438
446
|
/* @__PURE__ */ l("div", { className: "liq-flex liq-items-center liq-gap-1", children: [
|
|
439
447
|
/* @__PURE__ */ n("span", { children: "To" }),
|
|
440
448
|
/* @__PURE__ */ n(
|
|
441
|
-
|
|
449
|
+
rt,
|
|
442
450
|
{
|
|
443
451
|
accountAddress: c,
|
|
444
|
-
chainIcon: z(
|
|
452
|
+
chainIcon: z(s == null ? void 0 : s.pngUrl),
|
|
445
453
|
username: We,
|
|
446
|
-
accountExplorerUrl: `${
|
|
454
|
+
accountExplorerUrl: `${qe.mvxExplorerAddress}/accounts/${c}`,
|
|
447
455
|
showTag: !0,
|
|
448
456
|
onDisconnect: Ke,
|
|
449
|
-
onConnect:
|
|
457
|
+
onConnect: ue
|
|
450
458
|
}
|
|
451
459
|
)
|
|
452
460
|
] }),
|
|
453
|
-
ae && /* @__PURE__ */ n("div", { className: "liq-text-red-400 liq-text-xs liq-mt-1", children: ae }),
|
|
454
461
|
se && /* @__PURE__ */ n("div", { className: "liq-text-red-400 liq-text-xs liq-mt-1", children: se }),
|
|
462
|
+
le && /* @__PURE__ */ n("div", { className: "liq-text-red-400 liq-text-xs liq-mt-1", children: le }),
|
|
455
463
|
/* @__PURE__ */ l("div", { className: "liq-flex liq-justify-between liq-gap-1", children: [
|
|
456
464
|
/* @__PURE__ */ n(
|
|
457
465
|
He,
|
|
@@ -460,7 +468,7 @@ const rn = ({
|
|
|
460
468
|
inputValue: b.values.secondAmount,
|
|
461
469
|
amountError: wi,
|
|
462
470
|
disabled: !1,
|
|
463
|
-
onInputDebounceChange:
|
|
471
|
+
onInputDebounceChange: y,
|
|
464
472
|
onInputChange: we,
|
|
465
473
|
onBlur: W
|
|
466
474
|
}
|
|
@@ -486,43 +494,43 @@ const rn = ({
|
|
|
486
494
|
),
|
|
487
495
|
/* @__PURE__ */ l("div", { className: "liq-flex liq-items-center liq-justify-center", children: [
|
|
488
496
|
!c && /* @__PURE__ */ n(
|
|
489
|
-
|
|
497
|
+
tt,
|
|
490
498
|
{
|
|
491
499
|
mvxAccountAddress: c,
|
|
492
|
-
icon: z(
|
|
493
|
-
onClick:
|
|
500
|
+
icon: z(s == null ? void 0 : s.pngUrl),
|
|
501
|
+
onClick: ue
|
|
494
502
|
}
|
|
495
503
|
),
|
|
496
504
|
c && !Ce && /* @__PURE__ */ n(
|
|
497
|
-
|
|
505
|
+
it,
|
|
498
506
|
{
|
|
499
507
|
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
508
|
disabled: S,
|
|
501
|
-
activeChain:
|
|
509
|
+
activeChain: a
|
|
502
510
|
}
|
|
503
511
|
),
|
|
504
512
|
c && Ce && /* @__PURE__ */ l(
|
|
505
|
-
|
|
513
|
+
Ti,
|
|
506
514
|
{
|
|
507
515
|
type: "submit",
|
|
508
516
|
variant: "neutral-850",
|
|
509
517
|
className: "liq-w-full disabled:liq-bg-neutral-850/50 liq-py-3 hover:enabled:liq-bg-primary !liq-text-primary-200",
|
|
510
|
-
disabled: !
|
|
518
|
+
disabled: !ie || S || !c || !q || Ci || j,
|
|
511
519
|
children: [
|
|
512
|
-
|
|
520
|
+
ie && !j && /* @__PURE__ */ l("div", { className: "liq-flex liq-justify-center liq-items-center liq-gap-2", children: [
|
|
513
521
|
/* @__PURE__ */ n("div", { children: "Deposit on " }),
|
|
514
522
|
/* @__PURE__ */ n(
|
|
515
523
|
"img",
|
|
516
524
|
{
|
|
517
|
-
src: z(
|
|
525
|
+
src: z(s == null ? void 0 : s.pngUrl),
|
|
518
526
|
alt: "",
|
|
519
527
|
className: "liq-h-[1.5rem] liq-w-[1.5rem] liq-rounded-lg"
|
|
520
528
|
}
|
|
521
529
|
),
|
|
522
530
|
/* @__PURE__ */ n("div", { children: "MultiversX" })
|
|
523
531
|
] }),
|
|
524
|
-
!
|
|
525
|
-
|
|
532
|
+
!ie && !j && /* @__PURE__ */ n("span", { className: "liq-text-neutral-100", children: "Enter amount" }),
|
|
533
|
+
j && /* @__PURE__ */ l("div", { className: "liq-flex liq-justify-center liq-items-center liq-gap-2", children: [
|
|
526
534
|
/* @__PURE__ */ n(
|
|
527
535
|
Mi,
|
|
528
536
|
{
|
|
@@ -535,7 +543,7 @@ const rn = ({
|
|
|
535
543
|
/* @__PURE__ */ n(
|
|
536
544
|
"img",
|
|
537
545
|
{
|
|
538
|
-
src: z(
|
|
546
|
+
src: z(s == null ? void 0 : s.pngUrl),
|
|
539
547
|
alt: "",
|
|
540
548
|
className: "liq-h-[1.5rem] liq-w-[1.5rem] liq-rounded-lg"
|
|
541
549
|
}
|
|
@@ -559,5 +567,5 @@ const rn = ({
|
|
|
559
567
|
) });
|
|
560
568
|
};
|
|
561
569
|
export {
|
|
562
|
-
|
|
570
|
+
on as Deposit
|
|
563
571
|
};
|