@multiversx/sdk-dapp-liquidity 1.1.0-alpha.22 → 1.1.0-alpha.24
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
CHANGED
|
@@ -6,8 +6,11 @@ interface BridgeFormProps {
|
|
|
6
6
|
callbackRoute?: string;
|
|
7
7
|
firstTokenIdentifier?: string;
|
|
8
8
|
secondTokenIdentifier?: string;
|
|
9
|
+
firstTokenAmount?: string;
|
|
10
|
+
secondTokenAmount?: string;
|
|
9
11
|
refetchTrigger?: number;
|
|
10
12
|
showHistory?: boolean;
|
|
13
|
+
forcedDestinationTokenSymbol?: string;
|
|
11
14
|
onSuccessfullySentTransaction?: (txHashes?: string[]) => void;
|
|
12
15
|
onFailedSentTransaction?: (message?: string) => void;
|
|
13
16
|
onHistoryClose?: () => void;
|
|
@@ -15,5 +18,5 @@ interface BridgeFormProps {
|
|
|
15
18
|
onMvxDisconnect?: () => void;
|
|
16
19
|
onNavigate?: (url: string, options?: object) => void;
|
|
17
20
|
}
|
|
18
|
-
export declare const BridgeForm: ({ mvxChainId, mvxAddress, username, nativeAuthToken, callbackRoute, firstTokenIdentifier, secondTokenIdentifier, refetchTrigger, showHistory, onSuccessfullySentTransaction, onFailedSentTransaction, onHistoryClose, onMvxConnect, onMvxDisconnect, onNavigate }: BridgeFormProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export declare const BridgeForm: ({ mvxChainId, mvxAddress, username, nativeAuthToken, callbackRoute, firstTokenIdentifier, secondTokenIdentifier, firstTokenAmount, secondTokenAmount, refetchTrigger, showHistory, forcedDestinationTokenSymbol, onSuccessfullySentTransaction, onFailedSentTransaction, onHistoryClose, onMvxConnect, onMvxDisconnect, onNavigate }: BridgeFormProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
22
|
export {};
|
|
@@ -125,8 +125,11 @@ const BridgeForm = ({
|
|
|
125
125
|
callbackRoute = "/",
|
|
126
126
|
firstTokenIdentifier,
|
|
127
127
|
secondTokenIdentifier,
|
|
128
|
+
firstTokenAmount,
|
|
129
|
+
secondTokenAmount,
|
|
128
130
|
refetchTrigger,
|
|
129
131
|
showHistory,
|
|
132
|
+
forcedDestinationTokenSymbol,
|
|
130
133
|
onSuccessfullySentTransaction,
|
|
131
134
|
onFailedSentTransaction,
|
|
132
135
|
onHistoryClose,
|
|
@@ -194,6 +197,15 @@ const BridgeForm = ({
|
|
|
194
197
|
);
|
|
195
198
|
const getAvailableTokens = React.useCallback(
|
|
196
199
|
(option) => {
|
|
200
|
+
if (forcedDestinationTokenSymbol) {
|
|
201
|
+
const forcedToken = mvxTokensWithBalances == null ? void 0 : mvxTokensWithBalances.find(
|
|
202
|
+
(mvxToken) => mvxToken.symbol.toLowerCase() === forcedDestinationTokenSymbol.toLowerCase()
|
|
203
|
+
);
|
|
204
|
+
if (forcedToken) {
|
|
205
|
+
return [forcedToken];
|
|
206
|
+
}
|
|
207
|
+
return [];
|
|
208
|
+
}
|
|
197
209
|
if (!(option == null ? void 0 : option.availableTokens)) {
|
|
198
210
|
return [];
|
|
199
211
|
}
|
|
@@ -605,6 +617,16 @@ const BridgeForm = ({
|
|
|
605
617
|
};
|
|
606
618
|
});
|
|
607
619
|
}, [mvxTokensWithBalances, secondToken == null ? void 0 : secondToken.address]);
|
|
620
|
+
React.useEffect(() => {
|
|
621
|
+
if (firstTokenAmount) {
|
|
622
|
+
handleOnChangeFirstAmount(firstTokenAmount);
|
|
623
|
+
}
|
|
624
|
+
}, [firstTokenAmount]);
|
|
625
|
+
React.useEffect(() => {
|
|
626
|
+
if (secondTokenAmount) {
|
|
627
|
+
handleOnChangeSecondAmount(secondTokenAmount);
|
|
628
|
+
}
|
|
629
|
+
}, [secondTokenAmount]);
|
|
608
630
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
609
631
|
"form",
|
|
610
632
|
{
|
|
@@ -122,8 +122,11 @@ const BridgeForm = ({
|
|
|
122
122
|
callbackRoute = "/",
|
|
123
123
|
firstTokenIdentifier,
|
|
124
124
|
secondTokenIdentifier,
|
|
125
|
+
firstTokenAmount,
|
|
126
|
+
secondTokenAmount,
|
|
125
127
|
refetchTrigger,
|
|
126
128
|
showHistory,
|
|
129
|
+
forcedDestinationTokenSymbol,
|
|
127
130
|
onSuccessfullySentTransaction,
|
|
128
131
|
onFailedSentTransaction,
|
|
129
132
|
onHistoryClose,
|
|
@@ -191,6 +194,15 @@ const BridgeForm = ({
|
|
|
191
194
|
);
|
|
192
195
|
const getAvailableTokens = useCallback(
|
|
193
196
|
(option) => {
|
|
197
|
+
if (forcedDestinationTokenSymbol) {
|
|
198
|
+
const forcedToken = mvxTokensWithBalances == null ? void 0 : mvxTokensWithBalances.find(
|
|
199
|
+
(mvxToken) => mvxToken.symbol.toLowerCase() === forcedDestinationTokenSymbol.toLowerCase()
|
|
200
|
+
);
|
|
201
|
+
if (forcedToken) {
|
|
202
|
+
return [forcedToken];
|
|
203
|
+
}
|
|
204
|
+
return [];
|
|
205
|
+
}
|
|
194
206
|
if (!(option == null ? void 0 : option.availableTokens)) {
|
|
195
207
|
return [];
|
|
196
208
|
}
|
|
@@ -602,6 +614,16 @@ const BridgeForm = ({
|
|
|
602
614
|
};
|
|
603
615
|
});
|
|
604
616
|
}, [mvxTokensWithBalances, secondToken == null ? void 0 : secondToken.address]);
|
|
617
|
+
useEffect(() => {
|
|
618
|
+
if (firstTokenAmount) {
|
|
619
|
+
handleOnChangeFirstAmount(firstTokenAmount);
|
|
620
|
+
}
|
|
621
|
+
}, [firstTokenAmount]);
|
|
622
|
+
useEffect(() => {
|
|
623
|
+
if (secondTokenAmount) {
|
|
624
|
+
handleOnChangeSecondAmount(secondTokenAmount);
|
|
625
|
+
}
|
|
626
|
+
}, [secondTokenAmount]);
|
|
605
627
|
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
|
|
606
628
|
"form",
|
|
607
629
|
{
|