btc-wallet 0.5.87-beta → 0.5.88-beta

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/esm/index.js CHANGED
@@ -3800,12 +3800,8 @@ function checkGasTokenDebt(_0) {
3800
3800
  autoDeposit
3801
3801
  }) {
3802
3802
  var _a, _b, _c;
3803
+ const isNewAccount = yield checkNewAccount({ csna, btcAccount, env });
3803
3804
  const accountInfo = yield getAccountInfo({ csna, env });
3804
- const bridgeTransactions = yield hasBridgeTransaction({
3805
- env,
3806
- btcAccount
3807
- });
3808
- const isNewAccount = !(accountInfo == null ? void 0 : accountInfo.nonce) && !bridgeTransactions;
3809
3805
  const debtAmount = new Big2(((_a = accountInfo == null ? void 0 : accountInfo.debt_info) == null ? void 0 : _a.near_gas_debt_amount) || 0).plus(((_b = accountInfo == null ? void 0 : accountInfo.debt_info) == null ? void 0 : _b.protocol_fee_debt_amount) || 0).toString();
3810
3806
  const relayerFeeAmount = isNewAccount ? NBTC_STORAGE_DEPOSIT_AMOUNT : ((_c = accountInfo == null ? void 0 : accountInfo.relayer_fee) == null ? void 0 : _c.amount) || 0;
3811
3807
  const hasDebtArrears = new Big2(debtAmount).gt(0);
@@ -3968,6 +3964,30 @@ function getCsnaAccountId(env) {
3968
3964
  return csna;
3969
3965
  });
3970
3966
  }
3967
+ function checkNewAccount(_0) {
3968
+ return __async(this, arguments, function* ({
3969
+ csna,
3970
+ btcAccount,
3971
+ env = "mainnet"
3972
+ }) {
3973
+ try {
3974
+ const _csna = csna || (yield getCsnaAccountId(env));
3975
+ const _btcAccount = btcAccount || getBtcProvider().account;
3976
+ if (!_csna || !_btcAccount)
3977
+ return false;
3978
+ const accountInfo = yield getAccountInfo({ csna: _csna, env });
3979
+ const bridgeTransactions = yield hasBridgeTransaction({
3980
+ env,
3981
+ btcAccount: _btcAccount
3982
+ });
3983
+ const isNewAccount = !(accountInfo == null ? void 0 : accountInfo.nonce) && !bridgeTransactions;
3984
+ return isNewAccount;
3985
+ } catch (error) {
3986
+ console.error("checkNewAccount error:", error);
3987
+ return false;
3988
+ }
3989
+ });
3990
+ }
3971
3991
  function checkDepositDisabledAddress() {
3972
3992
  var _a;
3973
3993
  const data = (_a = storageStore("SATOSHI_WALLET_XVERSE")) == null ? void 0 : _a.get(
@@ -5320,7 +5340,7 @@ function getGroup(state) {
5320
5340
 
5321
5341
  // src/index.ts
5322
5342
  var getVersion = () => {
5323
- return "0.5.87-beta";
5343
+ return "0.5.88-beta";
5324
5344
  };
5325
5345
  if (typeof window !== "undefined") {
5326
5346
  window.__BTC_WALLET_VERSION = getVersion();
@@ -5346,6 +5366,7 @@ export {
5346
5366
  calculateWithdraw,
5347
5367
  checkBridgeTransactionStatus,
5348
5368
  checkGasTokenDebt,
5369
+ checkNewAccount,
5349
5370
  checkSatoshiWhitelist,
5350
5371
  estimateDepositAmount,
5351
5372
  executeBTCDepositAndAction,