btc-wallet 0.3.19 → 0.3.21

Sign up to get free protection for your applications and to get access to all the features.
@@ -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 | undefined)[]>;
package/esm/index.js CHANGED
@@ -3343,6 +3343,7 @@ function executeBTCDepositAndAction(_0) {
3343
3343
  amount,
3344
3344
  feeRate,
3345
3345
  fixedAmount = true,
3346
+ pollResult = true,
3346
3347
  isDev = false
3347
3348
  }) {
3348
3349
  var _a;
@@ -3426,6 +3427,9 @@ function executeBTCDepositAndAction(_0) {
3426
3427
  postActions: postActionsStr,
3427
3428
  extraMsg: depositMsg.extra_msg
3428
3429
  });
3430
+ if (!pollResult) {
3431
+ return txHash;
3432
+ }
3429
3433
  const checkTransactionStatusRes = yield checkBridgeTransactionStatus(config.base_url, txHash);
3430
3434
  console.log("checkBridgeTransactionStatus resp:", checkTransactionStatusRes);
3431
3435
  const network = yield getNetwork();
@@ -3873,10 +3877,12 @@ var BTCWallet = (_0) => __async(void 0, [_0], function* ({
3873
3877
  return;
3874
3878
  const btcNetwork = yield btcContext.getNetwork();
3875
3879
  console.log("btcNetwork:", btcNetwork, network);
3876
- if (network === "mainnet" && btcNetwork !== "livenet") {
3877
- yield btcContext.switchNetwork("livenet");
3878
- } else if (network === "testnet" && btcNetwork !== "testnet") {
3879
- yield btcContext.switchNetwork("testnet");
3880
+ const networkMap = {
3881
+ livenet: ["mainnet"],
3882
+ testnet: ["testnet", "dev"]
3883
+ };
3884
+ if (!networkMap[btcNetwork].includes(network)) {
3885
+ yield btcContext.switchNetwork(btcNetwork === "livenet" ? "testnet" : "livenet");
3880
3886
  }
3881
3887
  });
3882
3888
  }
@@ -3921,7 +3927,7 @@ function setupBTCWallet({
3921
3927
 
3922
3928
  // src/index.ts
3923
3929
  var getVersion = () => {
3924
- return "0.3.19";
3930
+ return "0.3.21";
3925
3931
  };
3926
3932
  if (typeof window !== "undefined") {
3927
3933
  window.__BTC_WALLET_VERSION = getVersion();