@multiversx/sdk-dapp-liquidity 1.1.0-alpha.23 → 1.1.0-alpha.25

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
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "homepage": "https://github.com/multiversx/mx-sdk-dapp-liquidity#readme",
30
30
  "license": "MIT",
31
- "version": "1.1.0-alpha.23",
31
+ "version": "1.1.0-alpha.25",
32
32
  "main": "index.js",
33
33
  "module": "index.mjs",
34
34
  "types": "index.d.ts",
@@ -6,6 +6,8 @@ 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;
11
13
  forcedDestinationTokenSymbol?: string;
@@ -16,5 +18,5 @@ interface BridgeFormProps {
16
18
  onMvxDisconnect?: () => void;
17
19
  onNavigate?: (url: string, options?: object) => void;
18
20
  }
19
- export declare const BridgeForm: ({ mvxChainId, mvxAddress, username, nativeAuthToken, callbackRoute, firstTokenIdentifier, secondTokenIdentifier, refetchTrigger, showHistory, forcedDestinationTokenSymbol, 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;
20
22
  export {};
@@ -125,6 +125,8 @@ const BridgeForm = ({
125
125
  callbackRoute = "/",
126
126
  firstTokenIdentifier,
127
127
  secondTokenIdentifier,
128
+ firstTokenAmount,
129
+ secondTokenAmount,
128
130
  refetchTrigger,
129
131
  showHistory,
130
132
  forcedDestinationTokenSymbol,
@@ -178,9 +180,9 @@ const BridgeForm = ({
178
180
  } = reactjs_queries_useGetRate_mutation.useGetRateMutation();
179
181
  const rateValidationError = ((_a = rateError == null ? void 0 : rateError.response) == null ? void 0 : _a.status) === 400 ? (_b = rateError == null ? void 0 : rateError.response) == null ? void 0 : _b.data.message : void 0;
180
182
  const [firstToken, setFirstToken] = React.useState();
181
- const [firstAmount, setFirstAmount] = React.useState("");
183
+ const [firstAmount, setFirstAmount] = React.useState(firstTokenAmount ?? "");
182
184
  const [secondToken, setSecondToken] = React.useState();
183
- const [secondAmount, setSecondAmount] = React.useState("");
185
+ const [secondAmount, setSecondAmount] = React.useState(secondTokenAmount ?? "");
184
186
  const bridgeAddress = account.address;
185
187
  const isAuthenticated = account.isConnected && Boolean(bridgeAddress);
186
188
  const fromOptions = React.useMemo(
@@ -615,6 +617,24 @@ const BridgeForm = ({
615
617
  };
616
618
  });
617
619
  }, [mvxTokensWithBalances, secondToken == null ? void 0 : secondToken.address]);
620
+ React.useEffect(() => {
621
+ if (firstTokenAmount) {
622
+ formik.setFieldValue(
623
+ reactjs_hooks_useBridgeFormik.BridgeFormikValuesEnum.firstAmount,
624
+ firstTokenAmount
625
+ );
626
+ handleOnChangeFirstAmount(firstTokenAmount);
627
+ }
628
+ }, []);
629
+ React.useEffect(() => {
630
+ if (secondTokenAmount) {
631
+ formik.setFieldValue(
632
+ reactjs_hooks_useBridgeFormik.BridgeFormikValuesEnum.secondAmount,
633
+ secondTokenAmount
634
+ );
635
+ handleOnChangeSecondAmount(secondTokenAmount);
636
+ }
637
+ }, [secondTokenAmount]);
618
638
  return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(
619
639
  "form",
620
640
  {
@@ -122,6 +122,8 @@ const BridgeForm = ({
122
122
  callbackRoute = "/",
123
123
  firstTokenIdentifier,
124
124
  secondTokenIdentifier,
125
+ firstTokenAmount,
126
+ secondTokenAmount,
125
127
  refetchTrigger,
126
128
  showHistory,
127
129
  forcedDestinationTokenSymbol,
@@ -175,9 +177,9 @@ const BridgeForm = ({
175
177
  } = useGetRateMutation();
176
178
  const rateValidationError = ((_a = rateError == null ? void 0 : rateError.response) == null ? void 0 : _a.status) === 400 ? (_b = rateError == null ? void 0 : rateError.response) == null ? void 0 : _b.data.message : void 0;
177
179
  const [firstToken, setFirstToken] = useState();
178
- const [firstAmount, setFirstAmount] = useState("");
180
+ const [firstAmount, setFirstAmount] = useState(firstTokenAmount ?? "");
179
181
  const [secondToken, setSecondToken] = useState();
180
- const [secondAmount, setSecondAmount] = useState("");
182
+ const [secondAmount, setSecondAmount] = useState(secondTokenAmount ?? "");
181
183
  const bridgeAddress = account.address;
182
184
  const isAuthenticated = account.isConnected && Boolean(bridgeAddress);
183
185
  const fromOptions = useMemo(
@@ -612,6 +614,24 @@ const BridgeForm = ({
612
614
  };
613
615
  });
614
616
  }, [mvxTokensWithBalances, secondToken == null ? void 0 : secondToken.address]);
617
+ useEffect(() => {
618
+ if (firstTokenAmount) {
619
+ formik.setFieldValue(
620
+ BridgeFormikValuesEnum.firstAmount,
621
+ firstTokenAmount
622
+ );
623
+ handleOnChangeFirstAmount(firstTokenAmount);
624
+ }
625
+ }, []);
626
+ useEffect(() => {
627
+ if (secondTokenAmount) {
628
+ formik.setFieldValue(
629
+ BridgeFormikValuesEnum.secondAmount,
630
+ secondTokenAmount
631
+ );
632
+ handleOnChangeSecondAmount(secondTokenAmount);
633
+ }
634
+ }, [secondTokenAmount]);
615
635
  return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
616
636
  "form",
617
637
  {