@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.mjs CHANGED
@@ -11094,7 +11094,6 @@ class TonConnectUI {
11094
11094
  });
11095
11095
  return result;
11096
11096
  } catch (e2) {
11097
- this.tracker.trackTransactionSigningFailed(this.wallet, tx, e2.message);
11098
11097
  widgetController.setAction({
11099
11098
  name: "transaction-canceled",
11100
11099
  showNotification: notifications2.includes("error"),
@@ -11201,6 +11200,7 @@ class TonConnectUI {
11201
11200
  return new Promise((resolve, reject) => {
11202
11201
  const { transaction, signal } = options;
11203
11202
  if (signal.aborted) {
11203
+ this.tracker.trackTransactionSigningFailed(this.wallet, transaction, "Transaction was cancelled");
11204
11204
  return reject(new TonConnectUIError("Transaction was not sent"));
11205
11205
  }
11206
11206
  const onTransactionHandler = (transaction2) => __async(this, null, function* () {
@@ -11209,14 +11209,18 @@ class TonConnectUI {
11209
11209
  const onErrorsHandler = (reason) => {
11210
11210
  reject(reason);
11211
11211
  };
11212
- this.connector.sendTransaction(transaction, { onRequestSent, signal }).then((result) => onTransactionHandler(result)).catch((reason) => onErrorsHandler(reason));
11213
- signal.addEventListener(
11214
- "abort",
11215
- () => {
11216
- reject(new TonConnectUIError("Transaction was not sent"));
11217
- },
11218
- { once: true }
11219
- );
11212
+ const onCanceledHandler = () => {
11213
+ this.tracker.trackTransactionSigningFailed(this.wallet, transaction, "Transaction was cancelled");
11214
+ reject(new TonConnectUIError("Transaction was not sent"));
11215
+ };
11216
+ signal.addEventListener("abort", onCanceledHandler, { once: true });
11217
+ this.connector.sendTransaction(transaction, { onRequestSent, signal }).then((result) => {
11218
+ signal.removeEventListener("abort", onCanceledHandler);
11219
+ return onTransactionHandler(result);
11220
+ }).catch((reason) => {
11221
+ signal.removeEventListener("abort", onCanceledHandler);
11222
+ return onErrorsHandler(reason);
11223
+ });
11220
11224
  });
11221
11225
  });
11222
11226
  }