btc-wallet 0.5.94-beta → 0.5.96-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 +4 -2
- package/dist/index.js +27 -4
- package/dist/index.js.map +3 -3
- package/esm/index.js +27 -4
- package/esm/index.js.map +3 -3
- package/package.json +2 -2
package/esm/index.js
CHANGED
|
@@ -2988,7 +2988,7 @@ function getWalletConfig(env) {
|
|
|
2988
2988
|
});
|
|
2989
2989
|
}
|
|
2990
2990
|
var nearRpcUrls = {
|
|
2991
|
-
mainnet: ["https://
|
|
2991
|
+
mainnet: ["https://near.lava.build", "https://free.rpc.fastnear.com"],
|
|
2992
2992
|
testnet: ["https://rpc.testnet.near.org"]
|
|
2993
2993
|
};
|
|
2994
2994
|
var btcRpcUrls = {
|
|
@@ -3756,6 +3756,7 @@ function getPredictedGasAmount(_0) {
|
|
|
3756
3756
|
import * as bitcoin from "bitcoinjs-lib";
|
|
3757
3757
|
import coinselect from "coinselect";
|
|
3758
3758
|
import * as ecc from "@bitcoinerlab/secp256k1";
|
|
3759
|
+
import bs582 from "bs58";
|
|
3759
3760
|
bitcoin.initEccLib(ecc);
|
|
3760
3761
|
var NEAR_STORAGE_DEPOSIT_AMOUNT = "1250000000000000000000";
|
|
3761
3762
|
var NBTC_STORAGE_DEPOSIT_AMOUNT = 800;
|
|
@@ -3905,7 +3906,14 @@ function signMessage(message) {
|
|
|
3905
3906
|
const { signMessage: signMessage2, getPublicKey } = getBtcProvider();
|
|
3906
3907
|
const publicKey = yield getPublicKey();
|
|
3907
3908
|
const signature = yield signMessage2(message);
|
|
3908
|
-
|
|
3909
|
+
const signatureBase58 = bs582.encode(Buffer.from(signature, "base64"));
|
|
3910
|
+
const publicKeyBase58 = bs582.encode(Buffer.from(publicKey, "hex"));
|
|
3911
|
+
return {
|
|
3912
|
+
signature,
|
|
3913
|
+
publicKey,
|
|
3914
|
+
signatureBase58,
|
|
3915
|
+
publicKeyBase58
|
|
3916
|
+
};
|
|
3909
3917
|
});
|
|
3910
3918
|
}
|
|
3911
3919
|
function estimateDepositAmount(amount, option) {
|
|
@@ -4362,11 +4370,25 @@ function calculateWithdraw(_0) {
|
|
|
4362
4370
|
}
|
|
4363
4371
|
const userSatoshis = Number(satoshis);
|
|
4364
4372
|
const maxBtcFee = Number(brgConfig.max_btc_gas_fee);
|
|
4365
|
-
|
|
4373
|
+
let { inputs, outputs, fee } = coinselect(
|
|
4366
4374
|
utxos,
|
|
4367
4375
|
[{ address: btcAddress, value: userSatoshis }],
|
|
4368
4376
|
Math.ceil(feeRate)
|
|
4369
4377
|
);
|
|
4378
|
+
if (inputs && inputs.length > 10) {
|
|
4379
|
+
const filteredUtxos = utxos.filter((utxo) => utxo.value >= userSatoshis);
|
|
4380
|
+
console.log("filteredUtxos", filteredUtxos);
|
|
4381
|
+
if (filteredUtxos.length > 0) {
|
|
4382
|
+
const result = coinselect(
|
|
4383
|
+
filteredUtxos,
|
|
4384
|
+
[{ address: btcAddress, value: userSatoshis }],
|
|
4385
|
+
Math.ceil(feeRate)
|
|
4386
|
+
);
|
|
4387
|
+
inputs = result.inputs;
|
|
4388
|
+
outputs = result.outputs;
|
|
4389
|
+
fee = result.fee;
|
|
4390
|
+
}
|
|
4391
|
+
}
|
|
4370
4392
|
const newInputs = inputs;
|
|
4371
4393
|
let newOutputs = outputs;
|
|
4372
4394
|
let newFee = fee;
|
|
@@ -5340,7 +5362,7 @@ function getGroup(state) {
|
|
|
5340
5362
|
|
|
5341
5363
|
// src/index.ts
|
|
5342
5364
|
var getVersion = () => {
|
|
5343
|
-
return "0.5.
|
|
5365
|
+
return "0.5.96-beta";
|
|
5344
5366
|
};
|
|
5345
5367
|
if (typeof window !== "undefined") {
|
|
5346
5368
|
window.__BTC_WALLET_VERSION = getVersion();
|
|
@@ -5363,6 +5385,7 @@ export {
|
|
|
5363
5385
|
btcRpcUrls,
|
|
5364
5386
|
calculateGasFee,
|
|
5365
5387
|
calculateGasLimit,
|
|
5388
|
+
calculateGasStrategy,
|
|
5366
5389
|
calculateWithdraw,
|
|
5367
5390
|
checkBridgeTransactionStatus,
|
|
5368
5391
|
checkGasTokenDebt,
|