btc-wallet 0.5.41-beta → 0.5.42-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/README.md CHANGED
@@ -103,11 +103,7 @@ Get the native BTC balance for a given Bitcoin address.
103
103
  ```typescript
104
104
  import { getBtcBalance } from 'btc-wallet';
105
105
 
106
- const balance = await getBtcBalance(address: string, option?: {
107
- /** if csna is provided, available balance will be calculated protocol fee and repay amount */
108
- csna?: string;
109
- env?: ENV;
110
- });
106
+ const balance = await getBtcBalance(address: string);
111
107
  // Returns balance in satoshis
112
108
  ```
113
109
 
@@ -16,11 +16,7 @@ export declare function getBtcUtxos(account: string): Promise<{
16
16
  };
17
17
  }[]>;
18
18
  export declare function calculateGasFee(account: string, amount: number, feeRate?: number): Promise<any>;
19
- export declare function getBtcBalance(account?: string, option?: {
20
- /** if csna is provided, available balance will be calculated protocol fee and repay amount */
21
- csna?: string;
22
- env?: ENV;
23
- }): Promise<{
19
+ export declare function getBtcBalance(account?: string): Promise<{
24
20
  rawBalance: number;
25
21
  balance: number;
26
22
  availableBalance: number;
package/dist/index.js CHANGED
@@ -3943,7 +3943,7 @@ function calculateGasFee(account, amount, feeRate) {
3943
3943
  return fee;
3944
3944
  });
3945
3945
  }
3946
- function getBtcBalance(account, option) {
3946
+ function getBtcBalance(account) {
3947
3947
  return __async(this, null, function* () {
3948
3948
  if (!account) {
3949
3949
  const res = yield retryOperation(getBtcProvider, (res2) => !!res2.account);
@@ -3958,11 +3958,7 @@ function getBtcBalance(account, option) {
3958
3958
  const rawBalance = (utxos == null ? void 0 : utxos.reduce((acc, cur) => acc + cur.value, 0)) || 0;
3959
3959
  const balance = rawBalance / __pow(10, btcDecimals);
3960
3960
  const estimatedFee = yield calculateGasFee(account, rawBalance);
3961
- let availableRawBalance = (rawBalance - estimatedFee).toFixed(0);
3962
- if (option == null ? void 0 : option.csna) {
3963
- const { protocolFee, repayAmount } = yield getDepositAmount(rawBalance.toString(), option);
3964
- availableRawBalance = new import_big2.default(availableRawBalance).minus(protocolFee).minus(repayAmount).toFixed(0);
3965
- }
3961
+ const availableRawBalance = (rawBalance - estimatedFee).toFixed(0);
3966
3962
  const availableBalance = new import_big2.default(availableRawBalance).div(__pow(10, btcDecimals)).round(btcDecimals, import_big2.default.roundDown).toNumber();
3967
3963
  return {
3968
3964
  rawBalance,
@@ -4921,7 +4917,7 @@ function getGroup(state) {
4921
4917
 
4922
4918
  // src/index.ts
4923
4919
  var getVersion = () => {
4924
- return "0.5.41-beta";
4920
+ return "0.5.42-beta";
4925
4921
  };
4926
4922
  if (typeof window !== "undefined") {
4927
4923
  window.__BTC_WALLET_VERSION = getVersion();