btc-wallet 0.5.38-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/README.md +5 -1
- package/dist/core/btcUtils.d.ts +2 -0
- package/dist/index.js +3 -9
- package/dist/index.js.map +2 -2
- package/esm/index.js +3 -9
- package/esm/index.js.map +2 -2
- package/package.json +1 -1
package/esm/index.js
CHANGED
@@ -3876,8 +3876,6 @@ function calculateGasFee(account, amount, feeRate) {
|
|
3876
3876
|
}
|
3877
3877
|
function getBtcBalance(account, option) {
|
3878
3878
|
return __async(this, null, function* () {
|
3879
|
-
const env = (option == null ? void 0 : option.env) || "mainnet";
|
3880
|
-
let csna = "";
|
3881
3879
|
if (!account) {
|
3882
3880
|
const res = yield retryOperation(getBtcProvider, (res2) => !!res2.account);
|
3883
3881
|
if (!res.account) {
|
@@ -3885,7 +3883,6 @@ function getBtcBalance(account, option) {
|
|
3885
3883
|
return { rawBalance: 0, balance: 0, availableBalance: 0 };
|
3886
3884
|
}
|
3887
3885
|
account = res.account;
|
3888
|
-
csna = yield getCsnaAccountId(env);
|
3889
3886
|
}
|
3890
3887
|
const utxos = yield getBtcUtxos(account);
|
3891
3888
|
const btcDecimals = 8;
|
@@ -3893,11 +3890,8 @@ function getBtcBalance(account, option) {
|
|
3893
3890
|
const balance = rawBalance / __pow(10, btcDecimals);
|
3894
3891
|
const estimatedFee = yield calculateGasFee(account, rawBalance);
|
3895
3892
|
let availableRawBalance = (rawBalance - estimatedFee).toFixed(0);
|
3896
|
-
if (csna) {
|
3897
|
-
const { protocolFee, repayAmount } = yield getDepositAmount(rawBalance.toString(),
|
3898
|
-
env,
|
3899
|
-
csna
|
3900
|
-
});
|
3893
|
+
if (option == null ? void 0 : option.csna) {
|
3894
|
+
const { protocolFee, repayAmount } = yield getDepositAmount(rawBalance.toString(), option);
|
3901
3895
|
availableRawBalance = new Big2(availableRawBalance).minus(protocolFee).minus(repayAmount).toFixed(0);
|
3902
3896
|
}
|
3903
3897
|
const availableBalance = new Big2(availableRawBalance).div(__pow(10, btcDecimals)).round(btcDecimals, Big2.roundDown).toNumber();
|
@@ -4855,7 +4849,7 @@ function getGroup(state) {
|
|
4855
4849
|
|
4856
4850
|
// src/index.ts
|
4857
4851
|
var getVersion = () => {
|
4858
|
-
return "0.5.
|
4852
|
+
return "0.5.39-beta";
|
4859
4853
|
};
|
4860
4854
|
if (typeof window !== "undefined") {
|
4861
4855
|
window.__BTC_WALLET_VERSION = getVersion();
|