btc-wallet 0.5.94-beta → 0.5.95-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
@@ -2988,7 +2988,7 @@ function getWalletConfig(env) {
2988
2988
  });
2989
2989
  }
2990
2990
  var nearRpcUrls = {
2991
- mainnet: ["https://free.rpc.fastnear.com", "https://near.lava.build"],
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 = {
@@ -4362,11 +4362,25 @@ function calculateWithdraw(_0) {
4362
4362
  }
4363
4363
  const userSatoshis = Number(satoshis);
4364
4364
  const maxBtcFee = Number(brgConfig.max_btc_gas_fee);
4365
- const { inputs, outputs, fee } = coinselect(
4365
+ let { inputs, outputs, fee } = coinselect(
4366
4366
  utxos,
4367
4367
  [{ address: btcAddress, value: userSatoshis }],
4368
4368
  Math.ceil(feeRate)
4369
4369
  );
4370
+ if (inputs && inputs.length > 10) {
4371
+ const filteredUtxos = utxos.filter((utxo) => utxo.value >= userSatoshis);
4372
+ console.log("filteredUtxos", filteredUtxos);
4373
+ if (filteredUtxos.length > 0) {
4374
+ const result = coinselect(
4375
+ filteredUtxos,
4376
+ [{ address: btcAddress, value: userSatoshis }],
4377
+ Math.ceil(feeRate)
4378
+ );
4379
+ inputs = result.inputs;
4380
+ outputs = result.outputs;
4381
+ fee = result.fee;
4382
+ }
4383
+ }
4370
4384
  const newInputs = inputs;
4371
4385
  let newOutputs = outputs;
4372
4386
  let newFee = fee;
@@ -5340,7 +5354,7 @@ function getGroup(state) {
5340
5354
 
5341
5355
  // src/index.ts
5342
5356
  var getVersion = () => {
5343
- return "0.5.94-beta";
5357
+ return "0.5.95-beta";
5344
5358
  };
5345
5359
  if (typeof window !== "undefined") {
5346
5360
  window.__BTC_WALLET_VERSION = getVersion();