btc-wallet 0.5.98-beta → 0.5.99-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.
@@ -27,11 +27,10 @@ export declare function getBtcBalance(account?: string): Promise<{
27
27
  availableBalance: number;
28
28
  }>;
29
29
  export declare function sendBitcoin(address: string, amount: number, feeRate: number): Promise<string>;
30
+ export declare function getPublicKeyBase58(): Promise<any>;
30
31
  export declare function signMessage(message: string): Promise<{
31
32
  signature: string;
32
33
  publicKey: string;
33
- signatureBase58: any;
34
- publicKeyBase58: any;
35
34
  }>;
36
35
  /** estimate deposit receive amount, deduct protocol fee and repay amount */
37
36
  export declare function estimateDepositAmount(amount: string, option?: {
package/dist/index.js CHANGED
@@ -120,6 +120,7 @@ __export(src_exports, {
120
120
  getBtcUtxos: () => getBtcUtxos,
121
121
  getCsnaAccountId: () => getCsnaAccountId,
122
122
  getDepositAmount: () => getDepositAmount,
123
+ getPublicKeyBase58: () => getPublicKeyBase58,
123
124
  getVersion: () => getVersion,
124
125
  getWalletConfig: () => getWalletConfig,
125
126
  getWithdrawTransaction: () => getWithdrawTransaction,
@@ -3975,21 +3976,10 @@ function sendBitcoin(address, amount, feeRate) {
3975
3976
  return txHash;
3976
3977
  });
3977
3978
  }
3978
- function signMessage(message) {
3979
+ function getPublicKeyBase58() {
3979
3980
  return __async(this, null, function* () {
3980
- const { signMessage: signMessage2, getPublicKey } = getBtcProvider();
3981
+ const { getPublicKey } = getBtcProvider();
3981
3982
  const publicKey = yield getPublicKey();
3982
- const signature = yield signMessage2(message);
3983
- const signatureBuffer = Buffer.from(signature, "base64");
3984
- let signatureWithoutPrefix;
3985
- if (signatureBuffer.length === 65) {
3986
- signatureWithoutPrefix = signatureBuffer.subarray(1);
3987
- } else if (signatureBuffer.length === 64) {
3988
- signatureWithoutPrefix = signatureBuffer;
3989
- } else {
3990
- throw new Error(`Invalid signature length: ${signatureBuffer.length}`);
3991
- }
3992
- const signatureBase58 = import_bs582.default.encode(signatureWithoutPrefix);
3993
3983
  const publicKeyBuffer = Buffer.from(publicKey, "hex");
3994
3984
  let uncompressedPublicKey;
3995
3985
  if (publicKeyBuffer.length === 33) {
@@ -4005,12 +3995,15 @@ function signMessage(message) {
4005
3995
  }
4006
3996
  const publicKeyWithoutPrefix = uncompressedPublicKey.subarray(1);
4007
3997
  const publicKeyBase58 = import_bs582.default.encode(publicKeyWithoutPrefix);
4008
- return {
4009
- signature,
4010
- publicKey,
4011
- signatureBase58,
4012
- publicKeyBase58
4013
- };
3998
+ return publicKeyBase58;
3999
+ });
4000
+ }
4001
+ function signMessage(message) {
4002
+ return __async(this, null, function* () {
4003
+ const { signMessage: signMessage2, getPublicKey } = getBtcProvider();
4004
+ const publicKey = yield getPublicKey();
4005
+ const signature = yield signMessage2(message);
4006
+ return { signature, publicKey };
4014
4007
  });
4015
4008
  }
4016
4009
  function estimateDepositAmount(amount, option) {
@@ -5457,7 +5450,7 @@ function getGroup(state) {
5457
5450
 
5458
5451
  // src/index.ts
5459
5452
  var getVersion = () => {
5460
- return "0.5.98-beta";
5453
+ return "0.5.99-beta";
5461
5454
  };
5462
5455
  if (typeof window !== "undefined") {
5463
5456
  window.__BTC_WALLET_VERSION = getVersion();