btc-wallet 0.5.37-beta → 0.5.39-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
@@ -3874,7 +3874,7 @@ function calculateGasFee(account, amount, feeRate) {
3874
3874
  return fee;
3875
3875
  });
3876
3876
  }
3877
- function getBtcBalance(account) {
3877
+ function getBtcBalance(account, option) {
3878
3878
  return __async(this, null, function* () {
3879
3879
  if (!account) {
3880
3880
  const res = yield retryOperation(getBtcProvider, (res2) => !!res2.account);
@@ -3889,7 +3889,11 @@ function getBtcBalance(account) {
3889
3889
  const rawBalance = (utxos == null ? void 0 : utxos.reduce((acc, cur) => acc + cur.value, 0)) || 0;
3890
3890
  const balance = rawBalance / __pow(10, btcDecimals);
3891
3891
  const estimatedFee = yield calculateGasFee(account, rawBalance);
3892
- const availableRawBalance = (rawBalance - estimatedFee).toFixed(0);
3892
+ let availableRawBalance = (rawBalance - estimatedFee).toFixed(0);
3893
+ if (option == null ? void 0 : option.csna) {
3894
+ const { protocolFee, repayAmount } = yield getDepositAmount(rawBalance.toString(), option);
3895
+ availableRawBalance = new Big2(availableRawBalance).minus(protocolFee).minus(repayAmount).toFixed(0);
3896
+ }
3893
3897
  const availableBalance = new Big2(availableRawBalance).div(__pow(10, btcDecimals)).round(btcDecimals, Big2.roundDown).toNumber();
3894
3898
  return {
3895
3899
  rawBalance,
@@ -4845,7 +4849,7 @@ function getGroup(state) {
4845
4849
 
4846
4850
  // src/index.ts
4847
4851
  var getVersion = () => {
4848
- return "0.5.37-beta";
4852
+ return "0.5.39-beta";
4849
4853
  };
4850
4854
  if (typeof window !== "undefined") {
4851
4855
  window.__BTC_WALLET_VERSION = getVersion();