btc-wallet 0.5.85-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,
@@ -3048,7 +3049,7 @@ var walletConfig = {
3048
3049
  nearTokenDecimals: 24,
3049
3050
  accountContractId: "acc.ref-labs.near",
3050
3051
  bridgeContractId: "btc-connector.bridge.near",
3051
- walletUrl: "https://wallet.satoshibridge.top",
3052
+ walletUrl: "https://wallet.satos.network",
3052
3053
  bridgeUrl: "https://ramp.satos.network"
3053
3054
  }
3054
3055
  };
@@ -3060,7 +3061,7 @@ function getWalletConfig(env) {
3060
3061
  });
3061
3062
  }
3062
3063
  var nearRpcUrls = {
3063
- mainnet: ["https://near.lava.build", "https://free.rpc.fastnear.com"],
3064
+ mainnet: ["https://free.rpc.fastnear.com", "https://near.lava.build"],
3064
3065
  testnet: ["https://rpc.testnet.near.org"]
3065
3066
  };
3066
3067
  var btcRpcUrls = {
@@ -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.85-beta";
5414
+ return "0.5.88-beta";
5394
5415
  };
5395
5416
  if (typeof window !== "undefined") {
5396
5417
  window.__BTC_WALLET_VERSION = getVersion();