@multiversx/sdk-dapp-liquidity 1.1.1-alpha.1 → 1.1.1-alpha.2

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.1-alpha.1",
31
+ "version": "1.1.1-alpha.2",
32
32
  "main": "index.js",
33
33
  "module": "index.mjs",
34
34
  "types": "index.d.ts",
@@ -519,16 +519,25 @@ const Transfer = ({
519
519
  }, [secondTokenAmount]);
520
520
  React.useEffect(() => {
521
521
  if (latestMvxTransactionHash) {
522
- const txHash = latestMvxTransactionHash;
523
- resetMvxTransactionHash == null ? void 0 : resetMvxTransactionHash();
524
- onSuccessfullySentTransaction == null ? void 0 : onSuccessfullySentTransaction([txHash]);
525
- sendTransactions({
526
- transactions: latestTransactions,
527
- provider: (rate == null ? void 0 : rate.provider) ?? types_providerType.ProviderType.None,
528
- url: helpers_getApiURL.getApiURL() ?? "",
529
- token: nativeAuthToken ?? ""
530
- });
531
- setLatestTransactions([]);
522
+ try {
523
+ const txHash = latestMvxTransactionHash;
524
+ sendTransactions({
525
+ transactions: latestTransactions.map((tx) => ({ ...tx, txHash })),
526
+ provider: (rate == null ? void 0 : rate.provider) ?? types_providerType.ProviderType.None,
527
+ url: helpers_getApiURL.getApiURL() ?? "",
528
+ token: nativeAuthToken ?? ""
529
+ });
530
+ onSuccessfullySentTransaction == null ? void 0 : onSuccessfullySentTransaction([txHash]);
531
+ } catch (err) {
532
+ console.error("Error while sending transactions:", err);
533
+ onFailedSentTransaction == null ? void 0 : onFailedSentTransaction(
534
+ "An error occurred while sending the transaction"
535
+ );
536
+ return;
537
+ } finally {
538
+ resetMvxTransactionHash == null ? void 0 : resetMvxTransactionHash();
539
+ setLatestTransactions([]);
540
+ }
532
541
  }
533
542
  }, [
534
543
  latestMvxTransactionHash,
@@ -516,16 +516,25 @@ const Transfer = ({
516
516
  }, [secondTokenAmount]);
517
517
  useEffect(() => {
518
518
  if (latestMvxTransactionHash) {
519
- const txHash = latestMvxTransactionHash;
520
- resetMvxTransactionHash == null ? void 0 : resetMvxTransactionHash();
521
- onSuccessfullySentTransaction == null ? void 0 : onSuccessfullySentTransaction([txHash]);
522
- sendTransactions({
523
- transactions: latestTransactions,
524
- provider: (rate == null ? void 0 : rate.provider) ?? ProviderType.None,
525
- url: getApiURL() ?? "",
526
- token: nativeAuthToken ?? ""
527
- });
528
- setLatestTransactions([]);
519
+ try {
520
+ const txHash = latestMvxTransactionHash;
521
+ sendTransactions({
522
+ transactions: latestTransactions.map((tx) => ({ ...tx, txHash })),
523
+ provider: (rate == null ? void 0 : rate.provider) ?? ProviderType.None,
524
+ url: getApiURL() ?? "",
525
+ token: nativeAuthToken ?? ""
526
+ });
527
+ onSuccessfullySentTransaction == null ? void 0 : onSuccessfullySentTransaction([txHash]);
528
+ } catch (err) {
529
+ console.error("Error while sending transactions:", err);
530
+ onFailedSentTransaction == null ? void 0 : onFailedSentTransaction(
531
+ "An error occurred while sending the transaction"
532
+ );
533
+ return;
534
+ } finally {
535
+ resetMvxTransactionHash == null ? void 0 : resetMvxTransactionHash();
536
+ setLatestTransactions([]);
537
+ }
529
538
  }
530
539
  }, [
531
540
  latestMvxTransactionHash,