@tonconnect/ui 2.0.3-beta.1 → 2.0.3-beta.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/lib/index.cjs CHANGED
@@ -11099,7 +11099,6 @@ class TonConnectUI {
11099
11099
  });
11100
11100
  return result;
11101
11101
  } catch (e2) {
11102
- this.tracker.trackTransactionSigningFailed(this.wallet, tx, e2.message);
11103
11102
  widgetController.setAction({
11104
11103
  name: "transaction-canceled",
11105
11104
  showNotification: notifications2.includes("error"),
@@ -11206,6 +11205,7 @@ class TonConnectUI {
11206
11205
  return new Promise((resolve, reject) => {
11207
11206
  const { transaction, signal } = options;
11208
11207
  if (signal.aborted) {
11208
+ this.tracker.trackTransactionSigningFailed(this.wallet, transaction, "Transaction was cancelled");
11209
11209
  return reject(new TonConnectUIError("Transaction was not sent"));
11210
11210
  }
11211
11211
  const onTransactionHandler = (transaction2) => __async(this, null, function* () {
@@ -11214,14 +11214,18 @@ class TonConnectUI {
11214
11214
  const onErrorsHandler = (reason) => {
11215
11215
  reject(reason);
11216
11216
  };
11217
- this.connector.sendTransaction(transaction, { onRequestSent, signal }).then((result) => onTransactionHandler(result)).catch((reason) => onErrorsHandler(reason));
11218
- signal.addEventListener(
11219
- "abort",
11220
- () => {
11221
- reject(new TonConnectUIError("Transaction was not sent"));
11222
- },
11223
- { once: true }
11224
- );
11217
+ const onCanceledHandler = () => {
11218
+ this.tracker.trackTransactionSigningFailed(this.wallet, transaction, "Transaction was cancelled");
11219
+ reject(new TonConnectUIError("Transaction was not sent"));
11220
+ };
11221
+ signal.addEventListener("abort", onCanceledHandler, { once: true });
11222
+ this.connector.sendTransaction(transaction, { onRequestSent, signal }).then((result) => {
11223
+ signal.removeEventListener("abort", onCanceledHandler);
11224
+ return onTransactionHandler(result);
11225
+ }).catch((reason) => {
11226
+ signal.removeEventListener("abort", onCanceledHandler);
11227
+ return onErrorsHandler(reason);
11228
+ });
11225
11229
  });
11226
11230
  });
11227
11231
  }