btc-wallet 0.5.18-beta → 0.5.20-beta

Sign up to get free protection for your applications and to get access to all the features.
package/esm/index.js CHANGED
@@ -3226,12 +3226,13 @@ function checkBridgeTransactionStatus(url, txHash) {
3226
3226
  maxPollingAttempts: 60,
3227
3227
  shouldStopPolling: (res) => {
3228
3228
  var _a;
3229
- return res.result_code === 0 && [4, 102].includes(((_a = res.result_data) == null ? void 0 : _a.Status) || 0);
3229
+ const status = ((_a = res.result_data) == null ? void 0 : _a.Status) || 0;
3230
+ return res.result_code === 0 && (status === 4 || status >= 50);
3230
3231
  }
3231
3232
  });
3232
3233
  console.log("checkTransactionStatus resp:", { result_code, result_message, result_data });
3233
3234
  if ((result_data == null ? void 0 : result_data.Status) !== 4) {
3234
- throw new Error(result_message);
3235
+ throw new Error(result_message || `Transaction failed, status: ${result_data == null ? void 0 : result_data.Status}`);
3235
3236
  }
3236
3237
  return result_data;
3237
3238
  });
@@ -3244,12 +3245,13 @@ function checkBtcTransactionStatus(url, sig) {
3244
3245
  maxPollingAttempts: 60,
3245
3246
  shouldStopPolling: (res) => {
3246
3247
  var _a;
3247
- return res.result_code === 0 && [3, 101, 102].includes(((_a = res.result_data) == null ? void 0 : _a.Status) || 0);
3248
+ const status = ((_a = res.result_data) == null ? void 0 : _a.Status) || 0;
3249
+ return res.result_code === 0 && (status === 3 || status >= 10);
3248
3250
  }
3249
3251
  });
3250
3252
  console.log("checkBtcTransactionStatus resp:", { result_code, result_message, result_data });
3251
3253
  if ((result_data == null ? void 0 : result_data.Status) !== 3) {
3252
- throw new Error(result_message);
3254
+ throw new Error(result_message || `Transaction failed, status: ${result_data == null ? void 0 : result_data.Status}`);
3253
3255
  }
3254
3256
  return result_data;
3255
3257
  });
@@ -4414,7 +4416,6 @@ var BTCWallet = (_0) => __async(void 0, [_0], function* ({
4414
4416
  const btcPublicKey = yield btcContext.getPublicKey();
4415
4417
  if (btcPublicKey) {
4416
4418
  yield getNearAccountByBtcPublicKey(btcPublicKey);
4417
- yield checkSatoshiWhitelist(btcContext.account, env);
4418
4419
  removeWalletButton();
4419
4420
  setupWalletButton(env, wallet, btcContext);
4420
4421
  }
@@ -4574,6 +4575,7 @@ var BTCWallet = (_0) => __async(void 0, [_0], function* ({
4574
4575
  const btcContext = window.btcContext;
4575
4576
  const csna = state_default.getAccount();
4576
4577
  const accountInfo = yield getAccountInfo({ csna, env });
4578
+ yield checkGasTokenDebt(csna, env, true);
4577
4579
  const trans = [...params.transactions];
4578
4580
  console.log("signAndSendTransactions raw trans:", trans);
4579
4581
  const { transferGasTransaction, useNearPayGas, gasLimit } = yield calculateGasStrategy({
@@ -4674,7 +4676,7 @@ function setupBTCWallet({
4674
4676
 
4675
4677
  // src/index.ts
4676
4678
  var getVersion = () => {
4677
- return "0.5.18-beta";
4679
+ return "0.5.20-beta";
4678
4680
  };
4679
4681
  if (typeof window !== "undefined") {
4680
4682
  window.__BTC_WALLET_VERSION = getVersion();