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