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.
@@ -50,6 +50,11 @@ export declare function getDepositAmount(amount: string, option?: {
50
50
  minDepositAmount: number;
51
51
  }>;
52
52
  export declare function getCsnaAccountId(env: ENV): Promise<string>;
53
+ export declare function checkNewAccount({ csna, btcAccount, env, }: {
54
+ csna?: string;
55
+ btcAccount?: string;
56
+ env?: ENV;
57
+ }): Promise<boolean>;
53
58
  interface ExecuteBTCDepositAndActionParams<T extends boolean = true> {
54
59
  action?: {
55
60
  receiver_id: string;
package/dist/index.js CHANGED
@@ -110,6 +110,7 @@ __export(src_exports, {
110
110
  calculateWithdraw: () => calculateWithdraw,
111
111
  checkBridgeTransactionStatus: () => checkBridgeTransactionStatus,
112
112
  checkGasTokenDebt: () => checkGasTokenDebt,
113
+ checkNewAccount: () => checkNewAccount,
113
114
  checkSatoshiWhitelist: () => checkSatoshiWhitelist,
114
115
  estimateDepositAmount: () => estimateDepositAmount,
115
116
  executeBTCDepositAndAction: () => executeBTCDepositAndAction,
@@ -3872,12 +3873,8 @@ function checkGasTokenDebt(_0) {
3872
3873
  autoDeposit
3873
3874
  }) {
3874
3875
  var _a, _b, _c;
3876
+ const isNewAccount = yield checkNewAccount({ csna, btcAccount, env });
3875
3877
  const accountInfo = yield getAccountInfo({ csna, env });
3876
- const bridgeTransactions = yield hasBridgeTransaction({
3877
- env,
3878
- btcAccount
3879
- });
3880
- const isNewAccount = !(accountInfo == null ? void 0 : accountInfo.nonce) && !bridgeTransactions;
3881
3878
  const debtAmount = new import_big2.default(((_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();
3882
3879
  const relayerFeeAmount = isNewAccount ? NBTC_STORAGE_DEPOSIT_AMOUNT : ((_c = accountInfo == null ? void 0 : accountInfo.relayer_fee) == null ? void 0 : _c.amount) || 0;
3883
3880
  const hasDebtArrears = new import_big2.default(debtAmount).gt(0);
@@ -4040,6 +4037,30 @@ function getCsnaAccountId(env) {
4040
4037
  return csna;
4041
4038
  });
4042
4039
  }
4040
+ function checkNewAccount(_0) {
4041
+ return __async(this, arguments, function* ({
4042
+ csna,
4043
+ btcAccount,
4044
+ env = "mainnet"
4045
+ }) {
4046
+ try {
4047
+ const _csna = csna || (yield getCsnaAccountId(env));
4048
+ const _btcAccount = btcAccount || getBtcProvider().account;
4049
+ if (!_csna || !_btcAccount)
4050
+ return false;
4051
+ const accountInfo = yield getAccountInfo({ csna: _csna, env });
4052
+ const bridgeTransactions = yield hasBridgeTransaction({
4053
+ env,
4054
+ btcAccount: _btcAccount
4055
+ });
4056
+ const isNewAccount = !(accountInfo == null ? void 0 : accountInfo.nonce) && !bridgeTransactions;
4057
+ return isNewAccount;
4058
+ } catch (error) {
4059
+ console.error("checkNewAccount error:", error);
4060
+ return false;
4061
+ }
4062
+ });
4063
+ }
4043
4064
  function checkDepositDisabledAddress() {
4044
4065
  var _a;
4045
4066
  const data = (_a = storageStore("SATOSHI_WALLET_XVERSE")) == null ? void 0 : _a.get(
@@ -5390,7 +5411,7 @@ function getGroup(state) {
5390
5411
 
5391
5412
  // src/index.ts
5392
5413
  var getVersion = () => {
5393
- return "0.5.87-beta";
5414
+ return "0.5.88-beta";
5394
5415
  };
5395
5416
  if (typeof window !== "undefined") {
5396
5417
  window.__BTC_WALLET_VERSION = getVersion();