btc-wallet 0.5.95-beta → 0.5.97-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
@@ -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,28 @@ function signMessage(message) {
3905
3906
  const { signMessage: signMessage2, getPublicKey } = getBtcProvider();
3906
3907
  const publicKey = yield getPublicKey();
3907
3908
  const signature = yield signMessage2(message);
3908
- return { signature, publicKey };
3909
+ const signatureBase58 = bs582.encode(Buffer.from(signature, "base64"));
3910
+ const publicKeyBuffer = Buffer.from(publicKey, "hex");
3911
+ let uncompressedPublicKey;
3912
+ if (publicKeyBuffer.length === 33) {
3913
+ const decompressed = ecc.pointCompress(publicKeyBuffer, false);
3914
+ if (!decompressed) {
3915
+ throw new Error("Failed to decompress public key");
3916
+ }
3917
+ uncompressedPublicKey = decompressed;
3918
+ } else if (publicKeyBuffer.length === 65) {
3919
+ uncompressedPublicKey = publicKeyBuffer;
3920
+ } else {
3921
+ throw new Error(`Invalid public key length: ${publicKeyBuffer.length}`);
3922
+ }
3923
+ const publicKeyWithoutPrefix = uncompressedPublicKey.subarray(1);
3924
+ const publicKeyBase58 = bs582.encode(publicKeyWithoutPrefix);
3925
+ return {
3926
+ signature,
3927
+ publicKey,
3928
+ signatureBase58,
3929
+ publicKeyBase58
3930
+ };
3909
3931
  });
3910
3932
  }
3911
3933
  function estimateDepositAmount(amount, option) {
@@ -5354,7 +5376,7 @@ function getGroup(state) {
5354
5376
 
5355
5377
  // src/index.ts
5356
5378
  var getVersion = () => {
5357
- return "0.5.95-beta";
5379
+ return "0.5.97-beta";
5358
5380
  };
5359
5381
  if (typeof window !== "undefined") {
5360
5382
  window.__BTC_WALLET_VERSION = getVersion();
@@ -5377,6 +5399,7 @@ export {
5377
5399
  btcRpcUrls,
5378
5400
  calculateGasFee,
5379
5401
  calculateGasLimit,
5402
+ calculateGasStrategy,
5380
5403
  calculateWithdraw,
5381
5404
  checkBridgeTransactionStatus,
5382
5405
  checkGasTokenDebt,