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.
@@ -1,7 +1,7 @@
1
1
  import type { ENV } from '../config';
2
- import { checkBridgeTransactionStatus, calculateGasLimit } from '../utils/satoshi';
2
+ import { checkBridgeTransactionStatus, calculateGasLimit, calculateGasStrategy } from '../utils/satoshi';
3
3
  import type { FinalExecutionOutcome, Transaction } from '@near-wallet-selector/core';
4
- export { calculateGasLimit, checkBridgeTransactionStatus };
4
+ export { calculateGasLimit, calculateGasStrategy, checkBridgeTransactionStatus };
5
5
  type CheckGasTokenDebtReturnType<T extends boolean> = T extends true ? void : {
6
6
  receiver_id: string;
7
7
  amount: string;
@@ -30,6 +30,8 @@ export declare function sendBitcoin(address: string, amount: number, feeRate: nu
30
30
  export declare function signMessage(message: string): Promise<{
31
31
  signature: string;
32
32
  publicKey: string;
33
+ signatureBase58: any;
34
+ publicKeyBase58: any;
33
35
  }>;
34
36
  /** estimate deposit receive amount, deduct protocol fee and repay amount */
35
37
  export declare function estimateDepositAmount(amount: string, option?: {
package/dist/index.js CHANGED
@@ -107,6 +107,7 @@ __export(src_exports, {
107
107
  btcRpcUrls: () => btcRpcUrls,
108
108
  calculateGasFee: () => calculateGasFee,
109
109
  calculateGasLimit: () => calculateGasLimit,
110
+ calculateGasStrategy: () => calculateGasStrategy,
110
111
  calculateWithdraw: () => calculateWithdraw,
111
112
  checkBridgeTransactionStatus: () => checkBridgeTransactionStatus,
112
113
  checkGasTokenDebt: () => checkGasTokenDebt,
@@ -3829,6 +3830,7 @@ function getPredictedGasAmount(_0) {
3829
3830
  var bitcoin = __toESM(require("bitcoinjs-lib"), 1);
3830
3831
  var import_coinselect = __toESM(require("coinselect"), 1);
3831
3832
  var ecc = __toESM(require("@bitcoinerlab/secp256k1"), 1);
3833
+ var import_bs582 = __toESM(require("bs58"), 1);
3832
3834
  bitcoin.initEccLib(ecc);
3833
3835
  var NEAR_STORAGE_DEPOSIT_AMOUNT = "1250000000000000000000";
3834
3836
  var NBTC_STORAGE_DEPOSIT_AMOUNT = 800;
@@ -3978,7 +3980,28 @@ function signMessage(message) {
3978
3980
  const { signMessage: signMessage2, getPublicKey } = getBtcProvider();
3979
3981
  const publicKey = yield getPublicKey();
3980
3982
  const signature = yield signMessage2(message);
3981
- return { signature, publicKey };
3983
+ const signatureBase58 = import_bs582.default.encode(Buffer.from(signature, "base64"));
3984
+ const publicKeyBuffer = Buffer.from(publicKey, "hex");
3985
+ let uncompressedPublicKey;
3986
+ if (publicKeyBuffer.length === 33) {
3987
+ const decompressed = ecc.pointCompress(publicKeyBuffer, false);
3988
+ if (!decompressed) {
3989
+ throw new Error("Failed to decompress public key");
3990
+ }
3991
+ uncompressedPublicKey = decompressed;
3992
+ } else if (publicKeyBuffer.length === 65) {
3993
+ uncompressedPublicKey = publicKeyBuffer;
3994
+ } else {
3995
+ throw new Error(`Invalid public key length: ${publicKeyBuffer.length}`);
3996
+ }
3997
+ const publicKeyWithoutPrefix = uncompressedPublicKey.subarray(1);
3998
+ const publicKeyBase58 = import_bs582.default.encode(publicKeyWithoutPrefix);
3999
+ return {
4000
+ signature,
4001
+ publicKey,
4002
+ signatureBase58,
4003
+ publicKeyBase58
4004
+ };
3982
4005
  });
3983
4006
  }
3984
4007
  function estimateDepositAmount(amount, option) {
@@ -5425,7 +5448,7 @@ function getGroup(state) {
5425
5448
 
5426
5449
  // src/index.ts
5427
5450
  var getVersion = () => {
5428
- return "0.5.95-beta";
5451
+ return "0.5.97-beta";
5429
5452
  };
5430
5453
  if (typeof window !== "undefined") {
5431
5454
  window.__BTC_WALLET_VERSION = getVersion();