btc-wallet 0.3.20 → 0.3.22

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.
@@ -1,6 +1,7 @@
1
1
  import type { ProviderService } from '@near-wallet-selector/core/src/lib/services';
2
+ import { providers } from 'near-api-js';
2
3
  export declare function nearCallFunction<T>(contractId: string, methodName: string, args: any, options: {
3
4
  network?: string;
4
5
  provider?: ProviderService;
5
6
  }): Promise<T>;
6
- export declare function pollTransactionStatuses(network: string, hashes: string[]): Promise<any[]>;
7
+ export declare function pollTransactionStatuses(network: string, hashes: string[]): Promise<providers.FinalExecutionOutcome[]>;
package/esm/index.js CHANGED
@@ -2788,10 +2788,10 @@ function pollTransactionStatuses(network, hashes) {
2788
2788
  currentAttempt++;
2789
2789
  const promises = Array.from(pendingHashes).map((hash) => __async(this, null, function* () {
2790
2790
  try {
2791
- const result = yield provider.txStatus(hash, "unused", "FINAL");
2792
- if (result && result.status) {
2793
- console.log(`Transaction ${hash} result:`, result);
2794
- results.set(hash, result);
2791
+ const result2 = yield provider.txStatus(hash, "unused", "FINAL");
2792
+ if (result2 && result2.status) {
2793
+ console.log(`Transaction ${hash} result:`, result2);
2794
+ results.set(hash, result2);
2795
2795
  pendingHashes.delete(hash);
2796
2796
  }
2797
2797
  } catch (error) {
@@ -2811,7 +2811,8 @@ function pollTransactionStatuses(network, hashes) {
2811
2811
  yield delay(1e4);
2812
2812
  }
2813
2813
  }
2814
- return hashes.map((hash) => results.get(hash));
2814
+ const result = hashes.map((hash) => results.get(hash)).filter(Boolean);
2815
+ return result;
2815
2816
  });
2816
2817
  }
2817
2818
 
@@ -3343,6 +3344,7 @@ function executeBTCDepositAndAction(_0) {
3343
3344
  amount,
3344
3345
  feeRate,
3345
3346
  fixedAmount = true,
3347
+ pollResult = true,
3346
3348
  isDev = false
3347
3349
  }) {
3348
3350
  var _a;
@@ -3426,6 +3428,9 @@ function executeBTCDepositAndAction(_0) {
3426
3428
  postActions: postActionsStr,
3427
3429
  extraMsg: depositMsg.extra_msg
3428
3430
  });
3431
+ if (!pollResult) {
3432
+ return txHash;
3433
+ }
3429
3434
  const checkTransactionStatusRes = yield checkBridgeTransactionStatus(config.base_url, txHash);
3430
3435
  console.log("checkBridgeTransactionStatus resp:", checkTransactionStatusRes);
3431
3436
  const network = yield getNetwork();
@@ -3923,7 +3928,7 @@ function setupBTCWallet({
3923
3928
 
3924
3929
  // src/index.ts
3925
3930
  var getVersion = () => {
3926
- return "0.3.20";
3931
+ return "0.3.22";
3927
3932
  };
3928
3933
  if (typeof window !== "undefined") {
3929
3934
  window.__BTC_WALLET_VERSION = getVersion();