btc-wallet 0.5.88-beta → 0.5.89-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/dist/core/btcUtils.d.ts +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +2 -2
- package/esm/index.js +4 -4
- package/esm/index.js.map +2 -2
- package/package.json +1 -1
package/dist/core/btcUtils.d.ts
CHANGED
@@ -13,7 +13,7 @@ export declare function checkGasTokenDebt<T extends boolean>({ csna, btcAccount,
|
|
13
13
|
env: ENV;
|
14
14
|
autoDeposit?: T;
|
15
15
|
}): Promise<CheckGasTokenDebtReturnType<T>>;
|
16
|
-
export declare function getBtcGasPrice(): Promise<number>;
|
16
|
+
export declare function getBtcGasPrice(type?: 'fastest' | 'halfHour' | 'hour' | 'economy' | 'minimum'): Promise<number>;
|
17
17
|
export declare function getBtcUtxos(account: string): Promise<{
|
18
18
|
value: number;
|
19
19
|
status: {
|
package/dist/index.js
CHANGED
@@ -3910,14 +3910,14 @@ function checkGasTokenDebt(_0) {
|
|
3910
3910
|
}
|
3911
3911
|
});
|
3912
3912
|
}
|
3913
|
-
function getBtcGasPrice() {
|
3913
|
+
function getBtcGasPrice(type = "halfHour") {
|
3914
3914
|
return __async(this, null, function* () {
|
3915
3915
|
const network = yield getNetwork();
|
3916
3916
|
const defaultFeeRate = network === "mainnet" ? 5 : 2500;
|
3917
3917
|
try {
|
3918
3918
|
const btcRpcUrl = yield getBtcRpcUrl();
|
3919
3919
|
const res = yield fetch(`${btcRpcUrl}/v1/fees/recommended`).then((res2) => res2.json());
|
3920
|
-
const feeRate = res
|
3920
|
+
const feeRate = res[type + "Fee"] ? Number(res[type + "Fee"]) : defaultFeeRate;
|
3921
3921
|
return feeRate;
|
3922
3922
|
} catch (error) {
|
3923
3923
|
return defaultFeeRate;
|
@@ -3938,7 +3938,7 @@ function calculateGasFee(account, amount, feeRate) {
|
|
3938
3938
|
const _feeRate = feeRate || (yield getBtcGasPrice());
|
3939
3939
|
const utxos = yield getBtcUtxos(account);
|
3940
3940
|
const { fee } = (0, import_coinselect.default)(utxos, [{ address: account, value: amount }], Math.ceil(_feeRate));
|
3941
|
-
console.log("calculateGasFee fee:", fee);
|
3941
|
+
console.log("calculateGasFee fee:", fee, "feeRate:", _feeRate);
|
3942
3942
|
return fee;
|
3943
3943
|
});
|
3944
3944
|
}
|
@@ -5411,7 +5411,7 @@ function getGroup(state) {
|
|
5411
5411
|
|
5412
5412
|
// src/index.ts
|
5413
5413
|
var getVersion = () => {
|
5414
|
-
return "0.5.
|
5414
|
+
return "0.5.89-beta";
|
5415
5415
|
};
|
5416
5416
|
if (typeof window !== "undefined") {
|
5417
5417
|
window.__BTC_WALLET_VERSION = getVersion();
|