@multiversx/sdk-dapp-liquidity 2.2.0 → 2.3.0-alpha.0
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/helpers/assertConfirmRateData.d.ts +19 -0
- package/helpers/assertConfirmRateData.js +2 -0
- package/helpers/assertConfirmRateData.mjs +29 -0
- package/helpers/isValidAddressForChainType.js +1 -1
- package/helpers/isValidAddressForChainType.mjs +28 -16
- package/helpers/tests/assertConfirmRateData.spec.d.ts +1 -0
- package/helpers/tests/assertConfirmRateData.spec.js +2 -0
- package/helpers/tests/assertConfirmRateData.spec.mjs +77 -0
- package/helpers/tests/isValidAddressForChainType.spec.js +1 -1
- package/helpers/tests/isValidAddressForChainType.spec.mjs +49 -15
- package/package.json +1 -6
- package/reactjs/adapters/SuiAdapter.js +1 -1
- package/reactjs/adapters/SuiAdapter.mjs +91 -88
- package/reactjs/components/BridgeForm/Deposit.js +1 -1
- package/reactjs/components/BridgeForm/Deposit.mjs +250 -247
- package/reactjs/components/BridgeForm/Transfer.js +1 -1
- package/reactjs/components/BridgeForm/Transfer.mjs +228 -225
- package/reactjs/hooks/useBridgeFormik.d.ts +1 -0
- package/reactjs/hooks/useBridgeFormik.js +1 -1
- package/reactjs/hooks/useBridgeFormik.mjs +97 -84
- package/reactjs/hooks/useNamespaceAddress.d.ts +19 -0
- package/reactjs/hooks/useNamespaceAddress.js +2 -0
- package/reactjs/hooks/useNamespaceAddress.mjs +16 -0
- package/types/errors.d.ts +15 -0
- package/types/errors.js +1 -1
- package/types/errors.mjs +12 -0
|
@@ -1,41 +1,42 @@
|
|
|
1
|
-
import { jsx as r, Fragment as
|
|
2
|
-
import { formatAmount as
|
|
3
|
-
import { useAppKitNetwork as
|
|
4
|
-
import
|
|
5
|
-
import { useRef as
|
|
6
|
-
import { toast as
|
|
7
|
-
import { useBridgeTokenSelection as
|
|
8
|
-
import { MVX_CHAIN_IDS as
|
|
9
|
-
import { getApiURL as
|
|
1
|
+
import { jsx as r, Fragment as pi, jsxs as s } from "react/jsx-runtime";
|
|
2
|
+
import { formatAmount as ui } from "@multiversx/sdk-dapp-utils/out/helpers/formatAmount";
|
|
3
|
+
import { useAppKitNetwork as hi } from "@reown/appkit/react";
|
|
4
|
+
import fi from "lodash/debounce";
|
|
5
|
+
import { useRef as gi, useState as C, useMemo as m, useCallback as d, useEffect as I } from "react";
|
|
6
|
+
import { toast as fe } from "react-toastify";
|
|
7
|
+
import { useBridgeTokenSelection as qi } from "./hooks/useBridgeTokenSelection.mjs";
|
|
8
|
+
import { MVX_CHAIN_IDS as ge } from "../../../constants/index.mjs";
|
|
9
|
+
import { getApiURL as vi } from "../../../helpers/getApiURL.mjs";
|
|
10
10
|
import "../../constants/index.mjs";
|
|
11
|
-
import { safeImageUrl as
|
|
11
|
+
import { safeImageUrl as T } from "../../../helpers/safeImageUrl.mjs";
|
|
12
12
|
import "@solana/web3.js";
|
|
13
13
|
import "bitcoinjs-lib";
|
|
14
14
|
import "viem";
|
|
15
|
-
import { ChainType as
|
|
16
|
-
import { ProviderType as
|
|
17
|
-
import { useWeb3App as
|
|
18
|
-
import { sameBridgeApiChainId as
|
|
15
|
+
import { ChainType as bi } from "../../../types/chainType.mjs";
|
|
16
|
+
import { ProviderType as Ci } from "../../../types/providerType.mjs";
|
|
17
|
+
import { useWeb3App as qe } from "../../context/useWeb3App.mjs";
|
|
18
|
+
import { sameBridgeApiChainId as ee, toBridgeApiChainId as Ii } from "../../helpers/resolveBridgeApiChainId.mjs";
|
|
19
19
|
import "yup";
|
|
20
20
|
import "@multiversx/sdk-dapp-utils/out/helpers/parseAmount";
|
|
21
21
|
import "bignumber.js";
|
|
22
|
-
import { useAccount as
|
|
22
|
+
import { useAccount as xi } from "../../hooks/useAccount.mjs";
|
|
23
23
|
import "axios";
|
|
24
|
-
import { useBridgeFormik as
|
|
25
|
-
import { useFetchBridgeData as
|
|
26
|
-
import { useBridgeApiChainId as
|
|
24
|
+
import { useBridgeFormik as Ai, BridgeFormikValuesEnum as F } from "../../hooks/useBridgeFormik.mjs";
|
|
25
|
+
import { useFetchBridgeData as Ni } from "../../hooks/useFetchBridgeData.mjs";
|
|
26
|
+
import { useBridgeApiChainId as Bi } from "../../hooks/useBridgeApiChainId.mjs";
|
|
27
27
|
import "@tanstack/react-query";
|
|
28
|
-
import { useGetChainId as
|
|
29
|
-
import { useSendTransactions as
|
|
28
|
+
import { useGetChainId as wi } from "../../hooks/useGetChainId.mjs";
|
|
29
|
+
import { useSendTransactions as yi } from "../../hooks/useSendTransactions.mjs";
|
|
30
30
|
import "@reown/appkit-adapter-solana/react";
|
|
31
31
|
import "wagmi";
|
|
32
32
|
import "@reown/appkit-controllers";
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
33
|
+
import { useNamespaceAddress as Ei } from "../../hooks/useNamespaceAddress.mjs";
|
|
34
|
+
import { useInvalidateHistoryQuery as Di } from "../../queries/useGetHistory.query.mjs";
|
|
35
|
+
import { useGetRateMutation as Oi } from "../../queries/useGetRate.mutation.mjs";
|
|
36
|
+
import { mxClsx as ve } from "../../utils/mxClsx.mjs";
|
|
36
37
|
import { AmountCard as be } from "../AmountCard/AmountCard.mjs";
|
|
37
|
-
import { AmountInput as
|
|
38
|
-
import { MxButton as
|
|
38
|
+
import { AmountInput as Ce } from "../AmountInput/AmountInput.mjs";
|
|
39
|
+
import { MxButton as Mi } from "../base/MxButton/MxButton.mjs";
|
|
39
40
|
import "../base/MxCard/MxCard.mjs";
|
|
40
41
|
import "../base/MxLink/MxLink.mjs";
|
|
41
42
|
import "../base/MxSearch/MxSearch.mjs";
|
|
@@ -45,247 +46,248 @@ import "@headlessui/react";
|
|
|
45
46
|
import "react-dom";
|
|
46
47
|
import "react-popper";
|
|
47
48
|
import "../base/MxTooltip/components/TooltipContainer/TooltipContainer.mjs";
|
|
48
|
-
import { BridgeHistory as
|
|
49
|
-
import { BridgeConnectButton as
|
|
50
|
-
import { MvxConnectButton as
|
|
51
|
-
import { BridgeAccountDisplay as
|
|
52
|
-
import { MvxAccountDisplay as
|
|
53
|
-
import { ToggleDirection as
|
|
54
|
-
import { TokenSelector as
|
|
49
|
+
import { BridgeHistory as Ri } from "../BridgeHistory/BridgeHistory.mjs";
|
|
50
|
+
import { BridgeConnectButton as Vi } from "../Connect/BridgeConnectButton.mjs";
|
|
51
|
+
import { MvxConnectButton as Li } from "../Connect/MvxConnectButton.mjs";
|
|
52
|
+
import { BridgeAccountDisplay as Fi } from "../Connect/BridgeAccountDisplay.mjs";
|
|
53
|
+
import { MvxAccountDisplay as Ui } from "../Connect/MvxAccountDisplay.mjs";
|
|
54
|
+
import { ToggleDirection as ji } from "../ToggleDirection/ToggleDirection.mjs";
|
|
55
|
+
import { TokenSelector as Ie } from "../TokenSelector/TokenSelector.mjs";
|
|
55
56
|
let U;
|
|
56
|
-
const
|
|
57
|
-
mvxChainId:
|
|
58
|
-
mvxAddress:
|
|
59
|
-
username:
|
|
60
|
-
callbackRoute:
|
|
61
|
-
firstTokenIdentifier:
|
|
57
|
+
const Wt = ({
|
|
58
|
+
mvxChainId: E,
|
|
59
|
+
mvxAddress: a,
|
|
60
|
+
username: xe,
|
|
61
|
+
callbackRoute: Ae = "/",
|
|
62
|
+
firstTokenIdentifier: Ne,
|
|
62
63
|
secondTokenIdentifier: Be,
|
|
63
|
-
firstTokenAmount:
|
|
64
|
+
firstTokenAmount: D,
|
|
64
65
|
secondTokenAmount: x,
|
|
65
|
-
refetchTrigger:
|
|
66
|
-
showHistory:
|
|
67
|
-
forcedDestinationTokenSymbol:
|
|
68
|
-
onSuccessfullySentTransaction:
|
|
66
|
+
refetchTrigger: we,
|
|
67
|
+
showHistory: ye,
|
|
68
|
+
forcedDestinationTokenSymbol: Ee,
|
|
69
|
+
onSuccessfullySentTransaction: p,
|
|
69
70
|
onFailedSentTransaction: f,
|
|
70
71
|
onHistoryClose: O,
|
|
71
|
-
onMvxConnect:
|
|
72
|
+
onMvxConnect: ie,
|
|
72
73
|
onMvxDisconnect: De,
|
|
73
|
-
onNavigate:
|
|
74
|
-
onChangeDirection:
|
|
74
|
+
onNavigate: Oe,
|
|
75
|
+
onChangeDirection: Me
|
|
75
76
|
}) => {
|
|
76
|
-
var
|
|
77
|
-
const
|
|
78
|
-
options:
|
|
77
|
+
var ue, he;
|
|
78
|
+
const Re = gi(null), [j, Ve] = C(!1), [Le, Fe] = C(1), [P, te] = C(0), [re, oe] = C([]), u = xi(), { switchNetwork: ne } = hi(), ae = Di(), {
|
|
79
|
+
options: se,
|
|
79
80
|
supportedChains: A,
|
|
80
81
|
nativeAuthToken: W,
|
|
81
|
-
bridgeOnly:
|
|
82
|
-
} =
|
|
83
|
-
signMvxTransactions:
|
|
84
|
-
resetMvxTransactionHash:
|
|
85
|
-
latestMvxTransactionHash:
|
|
86
|
-
} =
|
|
87
|
-
evmTokensWithBalances:
|
|
88
|
-
mvxTokensWithBalances:
|
|
89
|
-
isTokensLoading:
|
|
90
|
-
isLoadingEvmTokensBalances:
|
|
91
|
-
isLoadingMvxTokensBalances:
|
|
92
|
-
chains:
|
|
93
|
-
isChainsLoading:
|
|
94
|
-
} =
|
|
95
|
-
refetchTrigger:
|
|
96
|
-
mvxAddress:
|
|
97
|
-
mvxApiURL:
|
|
98
|
-
}),
|
|
99
|
-
(e) => e.chainId.toString() ===
|
|
100
|
-
), [
|
|
101
|
-
mutate:
|
|
102
|
-
data:
|
|
103
|
-
isPending:
|
|
82
|
+
bridgeOnly: Ue
|
|
83
|
+
} = qe(), G = wi(), le = Bi(), ce = yi(), {
|
|
84
|
+
signMvxTransactions: Q,
|
|
85
|
+
resetMvxTransactionHash: _,
|
|
86
|
+
latestMvxTransactionHash: $
|
|
87
|
+
} = qe(), {
|
|
88
|
+
evmTokensWithBalances: je,
|
|
89
|
+
mvxTokensWithBalances: Pe,
|
|
90
|
+
isTokensLoading: We,
|
|
91
|
+
isLoadingEvmTokensBalances: Ge,
|
|
92
|
+
isLoadingMvxTokensBalances: Qe,
|
|
93
|
+
chains: N = [],
|
|
94
|
+
isChainsLoading: _e
|
|
95
|
+
} = Ni({
|
|
96
|
+
refetchTrigger: we,
|
|
97
|
+
mvxAddress: a,
|
|
98
|
+
mvxApiURL: se.mvxApiURL
|
|
99
|
+
}), z = We || Ge || Qe || _e, $e = m(() => A.find((e) => ee(e.id, G)), [G, A]), g = m(() => N.find(
|
|
100
|
+
(e) => e.chainId.toString() === E.toString()
|
|
101
|
+
), [G, N]), {
|
|
102
|
+
mutate: ze,
|
|
103
|
+
data: o,
|
|
104
|
+
isPending: B,
|
|
104
105
|
error: q
|
|
105
|
-
} =
|
|
106
|
+
} = Oi(), w = ((ue = q == null ? void 0 : q.response) == null ? void 0 : ue.status) === 400 ? (he = q == null ? void 0 : q.response) == null ? void 0 : he.data.message : void 0, He = d(
|
|
106
107
|
(e) => {
|
|
107
|
-
const
|
|
108
|
-
(
|
|
108
|
+
const b = A.find(
|
|
109
|
+
(di) => ee(di.id, e.id)
|
|
109
110
|
);
|
|
110
|
-
|
|
111
|
+
b && ne(b);
|
|
111
112
|
},
|
|
112
113
|
[A, ne]
|
|
113
114
|
), {
|
|
114
115
|
firstToken: i,
|
|
115
116
|
secondToken: t,
|
|
116
|
-
fromOptions:
|
|
117
|
-
toOptions:
|
|
117
|
+
fromOptions: Ke,
|
|
118
|
+
toOptions: Xe,
|
|
118
119
|
selectedChainOption: y,
|
|
119
|
-
onChangeFirstSelect:
|
|
120
|
-
onChangeSecondSelect:
|
|
121
|
-
handleChangeDirection:
|
|
122
|
-
} =
|
|
123
|
-
chains:
|
|
124
|
-
activeChain:
|
|
120
|
+
onChangeFirstSelect: Ye,
|
|
121
|
+
onChangeSecondSelect: ke,
|
|
122
|
+
handleChangeDirection: Je
|
|
123
|
+
} = qi({
|
|
124
|
+
chains: N,
|
|
125
|
+
activeChain: $e,
|
|
125
126
|
sdkChains: A,
|
|
126
|
-
switchNetwork:
|
|
127
|
-
fromTokens:
|
|
128
|
-
toTokens:
|
|
129
|
-
firstTokenIdentifier:
|
|
127
|
+
switchNetwork: He,
|
|
128
|
+
fromTokens: Pe,
|
|
129
|
+
toTokens: je,
|
|
130
|
+
firstTokenIdentifier: Ne,
|
|
130
131
|
secondTokenIdentifier: Be,
|
|
131
|
-
forcedDestinationTokenSymbol:
|
|
132
|
-
isTokensLoading:
|
|
133
|
-
mvxChainId:
|
|
134
|
-
callbackRoute:
|
|
135
|
-
onNavigate:
|
|
136
|
-
}),
|
|
137
|
-
|
|
138
|
-
}, [
|
|
139
|
-
(e) =>
|
|
140
|
-
) ?? y : y, [t == null ? void 0 : t.chainId,
|
|
141
|
-
() =>
|
|
142
|
-
[t == null ? void 0 : t.chainId,
|
|
143
|
-
),
|
|
144
|
-
|
|
145
|
-
!e || !Number(e) || !
|
|
132
|
+
forcedDestinationTokenSymbol: Ee,
|
|
133
|
+
isTokensLoading: z,
|
|
134
|
+
mvxChainId: E,
|
|
135
|
+
callbackRoute: Ae,
|
|
136
|
+
onNavigate: Oe
|
|
137
|
+
}), Ze = () => {
|
|
138
|
+
Je(), Me();
|
|
139
|
+
}, [l, Se] = C(D ?? ""), [M, R] = C(x ?? ""), Te = m(() => i ? ge.includes(i.chainId.toString()) : !1, [i == null ? void 0 : i.chainId]), ei = m(() => t ? ge.includes(t.chainId.toString()) : !1, [t == null ? void 0 : t.chainId]), n = m(() => t ? N.find(
|
|
140
|
+
(e) => ee(e.chainId, t.chainId)
|
|
141
|
+
) ?? y : y, [t == null ? void 0 : t.chainId, N, y]), V = m(
|
|
142
|
+
() => Ii(t == null ? void 0 : t.chainId) ?? le,
|
|
143
|
+
[t == null ? void 0 : t.chainId, le]
|
|
144
|
+
), ii = Ei(n == null ? void 0 : n.chainType), me = u.address, de = u.isConnected && !!me, H = l !== "" && M !== "", K = d(
|
|
145
|
+
fi(async (e) => {
|
|
146
|
+
!e || !Number(e) || !u.address || !(i != null && i.address) || !(t != null && t.address) || !y || !V || ze({
|
|
146
147
|
nativeAuthToken: W ?? "",
|
|
147
148
|
body: {
|
|
148
149
|
tokenIn: i.address,
|
|
149
150
|
amountIn: e,
|
|
150
|
-
fromChainId:
|
|
151
|
+
fromChainId: E,
|
|
151
152
|
tokenOut: t.address,
|
|
152
153
|
toChainId: V
|
|
153
154
|
}
|
|
154
155
|
});
|
|
155
156
|
}, 500),
|
|
156
157
|
[
|
|
157
|
-
|
|
158
|
+
u.address,
|
|
158
159
|
V,
|
|
159
160
|
i == null ? void 0 : i.address,
|
|
160
161
|
t == null ? void 0 : t.address,
|
|
161
162
|
y
|
|
162
163
|
]
|
|
163
|
-
),
|
|
164
|
-
|
|
165
|
-
}, []),
|
|
164
|
+
), c = d((e) => {
|
|
165
|
+
Se(() => e);
|
|
166
|
+
}, []), v = d((e) => {
|
|
166
167
|
R(() => e);
|
|
167
|
-
}, []),
|
|
168
|
+
}, []), ti = d(() => {
|
|
168
169
|
O == null || O();
|
|
169
|
-
}, [O]),
|
|
170
|
-
const e =
|
|
170
|
+
}, [O]), ri = d(() => {
|
|
171
|
+
const e = ui({
|
|
171
172
|
decimals: i == null ? void 0 : i.decimals,
|
|
172
173
|
input: (i == null ? void 0 : i.balance) ?? "0",
|
|
173
174
|
addCommas: !1,
|
|
174
175
|
digits: 4
|
|
175
176
|
});
|
|
176
|
-
h.setFieldValue("firstAmount", e),
|
|
177
|
-
}, [i == null ? void 0 : i.balance, i == null ? void 0 : i.decimals,
|
|
177
|
+
h.setFieldValue("firstAmount", e), c(e);
|
|
178
|
+
}, [i == null ? void 0 : i.balance, i == null ? void 0 : i.decimals, c]), oi = d(
|
|
178
179
|
async (e) => {
|
|
179
|
-
|
|
180
|
+
c(""), v(""), ae(), ae(), p == null || p(e);
|
|
180
181
|
},
|
|
181
182
|
[
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
183
|
+
c,
|
|
184
|
+
v,
|
|
185
|
+
p
|
|
185
186
|
]
|
|
186
|
-
),
|
|
187
|
+
), ni = d(
|
|
187
188
|
async ({ transactions: e }) => {
|
|
188
|
-
|
|
189
|
+
te(() => e.length);
|
|
189
190
|
try {
|
|
190
|
-
if (!
|
|
191
|
+
if (!Q)
|
|
191
192
|
throw new Error("signMvxTransactions function is not provided");
|
|
192
|
-
await
|
|
193
|
-
} catch (
|
|
194
|
-
console.error(
|
|
193
|
+
await Q(e), oe(e);
|
|
194
|
+
} catch (b) {
|
|
195
|
+
console.error(b), fe.dismiss(), fe.error("Transaction cancelled"), f == null || f("Transaction cancelled"), te(0), si(), c(""), v("");
|
|
195
196
|
}
|
|
196
197
|
},
|
|
197
198
|
[
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
199
|
+
me,
|
|
200
|
+
c,
|
|
201
|
+
v,
|
|
201
202
|
W,
|
|
202
|
-
|
|
203
|
-
|
|
203
|
+
oi,
|
|
204
|
+
Q
|
|
204
205
|
]
|
|
205
206
|
), {
|
|
206
207
|
formik: h,
|
|
207
|
-
firstAmountError:
|
|
208
|
-
secondAmountError:
|
|
209
|
-
fromChainError:
|
|
208
|
+
firstAmountError: X,
|
|
209
|
+
secondAmountError: Y,
|
|
210
|
+
fromChainError: k,
|
|
210
211
|
senderAddressError: J,
|
|
211
212
|
receiverAddressError: Z,
|
|
213
|
+
confirmRateError: S,
|
|
212
214
|
handleBlur: L,
|
|
213
|
-
handleChange:
|
|
214
|
-
handleSubmit:
|
|
215
|
-
resetSwapForm:
|
|
216
|
-
} =
|
|
217
|
-
isMvxConnected: !!
|
|
218
|
-
rate:
|
|
219
|
-
sender:
|
|
220
|
-
receiver:
|
|
215
|
+
handleChange: pe,
|
|
216
|
+
handleSubmit: ai,
|
|
217
|
+
resetSwapForm: si
|
|
218
|
+
} = Ai({
|
|
219
|
+
isMvxConnected: !!a,
|
|
220
|
+
rate: o,
|
|
221
|
+
sender: a ?? "",
|
|
222
|
+
receiver: ii ?? "",
|
|
221
223
|
firstToken: i,
|
|
222
|
-
firstAmount:
|
|
223
|
-
fromChainId:
|
|
224
|
+
firstAmount: l,
|
|
225
|
+
fromChainId: E,
|
|
224
226
|
toChainId: V,
|
|
225
227
|
secondToken: t,
|
|
226
228
|
secondAmount: M,
|
|
227
|
-
setForceRefetchRate:
|
|
228
|
-
senderChainType:
|
|
229
|
-
receiverChainType:
|
|
230
|
-
onSubmit:
|
|
231
|
-
}),
|
|
232
|
-
return I(() => (
|
|
233
|
-
|
|
234
|
-
}, 50 * 1e3), () => clearInterval(U)), [
|
|
235
|
-
|
|
236
|
-
}, [
|
|
229
|
+
setForceRefetchRate: Fe,
|
|
230
|
+
senderChainType: bi.mvx,
|
|
231
|
+
receiverChainType: n == null ? void 0 : n.chainType,
|
|
232
|
+
onSubmit: ni
|
|
233
|
+
}), li = !!(X || Y || k || w || J || Z || S), ci = m(() => l !== "" ? w ?? X : void 0, [X, l, w]), mi = m(() => M !== "" ? k ?? Y : void 0, [k, Y, M]);
|
|
234
|
+
return I(() => (l || R(""), K(l), U && clearInterval(U), U = setInterval(() => {
|
|
235
|
+
K(l);
|
|
236
|
+
}, 50 * 1e3), () => clearInterval(U)), [l, Le, K]), I(() => {
|
|
237
|
+
o != null && o.amountOut && (h.setFieldValue(F.secondAmount, o.amountOut), R(o.amountOut));
|
|
238
|
+
}, [o == null ? void 0 : o.amountOut]), I(() => {
|
|
237
239
|
w && (h.setFieldValue(F.secondAmount, "0"), R("0"));
|
|
238
240
|
}, [w]), I(() => {
|
|
239
|
-
|
|
241
|
+
D && (h.setFieldValue(
|
|
240
242
|
F.firstAmount,
|
|
241
|
-
|
|
242
|
-
),
|
|
243
|
+
D
|
|
244
|
+
), c(D));
|
|
243
245
|
}, []), I(() => {
|
|
244
246
|
x && (h.setFieldValue(
|
|
245
247
|
F.secondAmount,
|
|
246
248
|
x
|
|
247
|
-
),
|
|
249
|
+
), v(x));
|
|
248
250
|
}, [x]), I(() => {
|
|
249
|
-
if (
|
|
251
|
+
if ($)
|
|
250
252
|
try {
|
|
251
|
-
const e =
|
|
252
|
-
|
|
253
|
-
transactions:
|
|
254
|
-
...
|
|
253
|
+
const e = $;
|
|
254
|
+
ce({
|
|
255
|
+
transactions: re.map((b) => ({
|
|
256
|
+
...b,
|
|
255
257
|
txHash: e,
|
|
256
|
-
receiver:
|
|
258
|
+
receiver: u.address
|
|
257
259
|
})),
|
|
258
|
-
provider: (
|
|
259
|
-
url:
|
|
260
|
+
provider: (o == null ? void 0 : o.provider) ?? Ci.None,
|
|
261
|
+
url: vi() ?? "",
|
|
260
262
|
token: W ?? ""
|
|
261
|
-
}),
|
|
263
|
+
}), p == null || p([e]);
|
|
262
264
|
} catch (e) {
|
|
263
265
|
console.error("Error while sending transactions:", e), f == null || f(
|
|
264
266
|
"An error occurred while sending the transaction"
|
|
265
267
|
);
|
|
266
268
|
return;
|
|
267
269
|
} finally {
|
|
268
|
-
|
|
270
|
+
_ == null || _(), oe([]);
|
|
269
271
|
}
|
|
270
272
|
}, [
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
]), /* @__PURE__ */ r(
|
|
273
|
+
$,
|
|
274
|
+
re,
|
|
275
|
+
o == null ? void 0 : o.provider,
|
|
276
|
+
ce
|
|
277
|
+
]), /* @__PURE__ */ r(pi, { children: /* @__PURE__ */ s(
|
|
276
278
|
"form",
|
|
277
279
|
{
|
|
278
|
-
ref:
|
|
280
|
+
ref: Re,
|
|
279
281
|
noValidate: !0,
|
|
280
282
|
className: "liq-flex liq-flex-col liq-gap-1 liq-relative",
|
|
281
283
|
autoComplete: "off",
|
|
282
|
-
onSubmit:
|
|
284
|
+
onSubmit: ai,
|
|
283
285
|
children: [
|
|
284
|
-
|
|
286
|
+
ye && /* @__PURE__ */ r(Ri, { mvxAddress: a, onClose: ti }),
|
|
285
287
|
/* @__PURE__ */ s(
|
|
286
288
|
be,
|
|
287
289
|
{
|
|
288
|
-
className:
|
|
290
|
+
className: ve(
|
|
289
291
|
"liq-pb-8 liq-pt-6 hover:liq-bg-neutral-700/50 sm:liq-pb-6",
|
|
290
292
|
{
|
|
291
293
|
"liq-pointer-events-none": j,
|
|
@@ -296,58 +298,58 @@ const Ft = ({
|
|
|
296
298
|
/* @__PURE__ */ s("div", { className: "liq-flex liq-items-center liq-gap-1", children: [
|
|
297
299
|
/* @__PURE__ */ r("span", { children: "From" }),
|
|
298
300
|
/* @__PURE__ */ r(
|
|
299
|
-
|
|
301
|
+
Ui,
|
|
300
302
|
{
|
|
301
|
-
accountAddress:
|
|
302
|
-
chainIcon:
|
|
303
|
-
username:
|
|
304
|
-
accountExplorerUrl: `${
|
|
303
|
+
accountAddress: a,
|
|
304
|
+
chainIcon: T(g == null ? void 0 : g.pngUrl),
|
|
305
|
+
username: xe,
|
|
306
|
+
accountExplorerUrl: `${se.mvxExplorerAddress}/accounts/${a}`,
|
|
305
307
|
showTag: !0,
|
|
306
308
|
onDisconnect: De,
|
|
307
|
-
onConnect:
|
|
309
|
+
onConnect: ie
|
|
308
310
|
}
|
|
309
311
|
)
|
|
310
312
|
] }),
|
|
311
313
|
J && /* @__PURE__ */ r("div", { className: "liq-text-red-400 liq-text-xs liq-mt-1", children: J }),
|
|
312
314
|
/* @__PURE__ */ s("div", { className: "liq-flex liq-justify-between liq-gap-1", children: [
|
|
313
315
|
/* @__PURE__ */ r(
|
|
314
|
-
|
|
316
|
+
Ce,
|
|
315
317
|
{
|
|
316
318
|
inputName: "firstAmount",
|
|
317
319
|
inputValue: h.values.firstAmount,
|
|
318
|
-
amountError:
|
|
320
|
+
amountError: ci,
|
|
319
321
|
disabled: !1,
|
|
320
|
-
onInputDebounceChange:
|
|
321
|
-
onInputChange:
|
|
322
|
+
onInputDebounceChange: c,
|
|
323
|
+
onInputChange: pe,
|
|
322
324
|
onBlur: L
|
|
323
325
|
}
|
|
324
326
|
),
|
|
325
327
|
/* @__PURE__ */ r(
|
|
326
|
-
|
|
328
|
+
Ie,
|
|
327
329
|
{
|
|
328
330
|
name: "firstToken",
|
|
329
|
-
disabled:
|
|
330
|
-
options:
|
|
331
|
-
areOptionsLoading:
|
|
332
|
-
isMvxSelector:
|
|
331
|
+
disabled: B,
|
|
332
|
+
options: Ke,
|
|
333
|
+
areOptionsLoading: z,
|
|
334
|
+
isMvxSelector: Te,
|
|
333
335
|
isDestination: !1,
|
|
334
336
|
color: "neutral-850",
|
|
335
|
-
onChange:
|
|
337
|
+
onChange: Ye,
|
|
336
338
|
onBlur: L,
|
|
337
|
-
onMaxBtnClick:
|
|
339
|
+
onMaxBtnClick: ri,
|
|
338
340
|
selectedOption: i,
|
|
339
|
-
onTokenSelectorDisplay: (e) =>
|
|
341
|
+
onTokenSelectorDisplay: (e) => Ve(e)
|
|
340
342
|
}
|
|
341
343
|
)
|
|
342
344
|
] })
|
|
343
345
|
]
|
|
344
346
|
}
|
|
345
347
|
),
|
|
346
|
-
/* @__PURE__ */ r("div", { className: "liq-absolute liq-left-[6%] liq-top-[40%] -liq-mt-1 liq-z-10", children:
|
|
348
|
+
/* @__PURE__ */ r("div", { className: "liq-absolute liq-left-[6%] liq-top-[40%] -liq-mt-1 liq-z-10", children: Ue && /* @__PURE__ */ r(ji, { onChangeDirection: Ze }) }),
|
|
347
349
|
/* @__PURE__ */ s(
|
|
348
350
|
be,
|
|
349
351
|
{
|
|
350
|
-
className:
|
|
352
|
+
className: ve(
|
|
351
353
|
"liq-pb-8 liq-pt-6 hover:liq-bg-neutral-700/50 sm:liq-pb-6",
|
|
352
354
|
{
|
|
353
355
|
"liq-pointer-events-none": j
|
|
@@ -357,38 +359,39 @@ const Ft = ({
|
|
|
357
359
|
/* @__PURE__ */ s("div", { className: "liq-flex liq-items-center liq-gap-1", children: [
|
|
358
360
|
/* @__PURE__ */ r("span", { children: "To" }),
|
|
359
361
|
/* @__PURE__ */ r(
|
|
360
|
-
|
|
362
|
+
Fi,
|
|
361
363
|
{
|
|
362
|
-
disabled:
|
|
363
|
-
activeChain:
|
|
364
|
+
disabled: B,
|
|
365
|
+
activeChain: n
|
|
364
366
|
}
|
|
365
367
|
)
|
|
366
368
|
] }),
|
|
367
369
|
Z && /* @__PURE__ */ r("div", { className: "liq-text-red-400 liq-text-xs liq-mt-1", children: Z }),
|
|
370
|
+
S && /* @__PURE__ */ r("div", { className: "liq-text-red-400 liq-text-xs liq-mt-1", children: S }),
|
|
368
371
|
/* @__PURE__ */ s("div", { className: "liq-flex liq-justify-between liq-gap-1", children: [
|
|
369
372
|
/* @__PURE__ */ r(
|
|
370
|
-
|
|
373
|
+
Ce,
|
|
371
374
|
{
|
|
372
375
|
inputName: "secondAmount",
|
|
373
376
|
inputValue: h.values.secondAmount,
|
|
374
|
-
amountError:
|
|
377
|
+
amountError: mi,
|
|
375
378
|
disabled: !1,
|
|
376
|
-
onInputDebounceChange:
|
|
377
|
-
onInputChange:
|
|
379
|
+
onInputDebounceChange: v,
|
|
380
|
+
onInputChange: pe,
|
|
378
381
|
onBlur: L
|
|
379
382
|
}
|
|
380
383
|
),
|
|
381
384
|
/* @__PURE__ */ r(
|
|
382
|
-
|
|
385
|
+
Ie,
|
|
383
386
|
{
|
|
384
387
|
name: "secondToken",
|
|
385
|
-
disabled:
|
|
388
|
+
disabled: B,
|
|
386
389
|
omitDisableClass: !0,
|
|
387
|
-
options:
|
|
388
|
-
areOptionsLoading:
|
|
389
|
-
isMvxSelector:
|
|
390
|
+
options: Xe,
|
|
391
|
+
areOptionsLoading: z,
|
|
392
|
+
isMvxSelector: ei,
|
|
390
393
|
color: "neutral-850",
|
|
391
|
-
onChange:
|
|
394
|
+
onChange: ke,
|
|
392
395
|
onBlur: L,
|
|
393
396
|
selectedOption: t
|
|
394
397
|
}
|
|
@@ -398,49 +401,49 @@ const Ft = ({
|
|
|
398
401
|
}
|
|
399
402
|
),
|
|
400
403
|
/* @__PURE__ */ s("div", { className: "liq-flex liq-items-center liq-justify-center", children: [
|
|
401
|
-
!
|
|
402
|
-
|
|
404
|
+
!a && /* @__PURE__ */ r(
|
|
405
|
+
Li,
|
|
403
406
|
{
|
|
404
|
-
mvxAccountAddress:
|
|
405
|
-
icon:
|
|
406
|
-
onClick:
|
|
407
|
+
mvxAccountAddress: a,
|
|
408
|
+
icon: T(g == null ? void 0 : g.pngUrl),
|
|
409
|
+
onClick: ie
|
|
407
410
|
}
|
|
408
411
|
),
|
|
409
|
-
|
|
410
|
-
|
|
412
|
+
a && !de && /* @__PURE__ */ r(
|
|
413
|
+
Vi,
|
|
411
414
|
{
|
|
412
415
|
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",
|
|
413
|
-
disabled:
|
|
414
|
-
activeChain:
|
|
416
|
+
disabled: B,
|
|
417
|
+
activeChain: n
|
|
415
418
|
}
|
|
416
419
|
),
|
|
417
|
-
|
|
418
|
-
|
|
420
|
+
a && de && /* @__PURE__ */ s(
|
|
421
|
+
Mi,
|
|
419
422
|
{
|
|
420
423
|
"data-testid": "submit-button",
|
|
421
424
|
type: "submit",
|
|
422
425
|
variant: "neutral-850",
|
|
423
426
|
className: "liq-w-full disabled:liq-bg-neutral-850/50 liq-py-3 hover:enabled:liq-bg-primary !liq-text-primary-200",
|
|
424
|
-
disabled: !
|
|
427
|
+
disabled: !H || B || !a || !u.address || li,
|
|
425
428
|
children: [
|
|
426
|
-
|
|
429
|
+
H && /* @__PURE__ */ s("div", { className: "liq-flex liq-justify-center liq-items-center liq-gap-2", children: [
|
|
427
430
|
/* @__PURE__ */ r("div", { children: "Transfer to " }),
|
|
428
431
|
/* @__PURE__ */ r(
|
|
429
432
|
"img",
|
|
430
433
|
{
|
|
431
|
-
src:
|
|
434
|
+
src: T(n == null ? void 0 : n.pngUrl),
|
|
432
435
|
alt: "",
|
|
433
436
|
className: "liq-h-[1.5rem] liq-w-[1.5rem] liq-rounded-lg"
|
|
434
437
|
}
|
|
435
438
|
),
|
|
436
|
-
/* @__PURE__ */ r("div", { children:
|
|
439
|
+
/* @__PURE__ */ r("div", { children: n == null ? void 0 : n.networkName })
|
|
437
440
|
] }),
|
|
438
|
-
!
|
|
441
|
+
!H && /* @__PURE__ */ r("span", { className: "liq-text-neutral-100", children: "Enter amount" })
|
|
439
442
|
]
|
|
440
443
|
}
|
|
441
444
|
)
|
|
442
445
|
] }),
|
|
443
|
-
|
|
446
|
+
u.address && P > 0 && /* @__PURE__ */ r("div", { className: "liq-flex liq-items-center liq-justify-center liq-text-neutral-300 liq-text-sm", children: /* @__PURE__ */ s("div", { children: [
|
|
444
447
|
"You will be asked to sign ",
|
|
445
448
|
P,
|
|
446
449
|
" ",
|
|
@@ -453,5 +456,5 @@ const Ft = ({
|
|
|
453
456
|
) });
|
|
454
457
|
};
|
|
455
458
|
export {
|
|
456
|
-
|
|
459
|
+
Wt as Transfer
|
|
457
460
|
};
|