btc-wallet 0.5.99-beta → 0.5.100-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
@@ -3923,6 +3923,21 @@ function getPublicKeyBase58() {
3923
3923
  return publicKeyBase58;
3924
3924
  });
3925
3925
  }
3926
+ function getAddressByPublicKeyBase58(btcPublicKeyBase58) {
3927
+ const publicKey = bs582.decode(btcPublicKeyBase58);
3928
+ const uncompressedPublicKey = Buffer.concat([Buffer.from([4]), publicKey]);
3929
+ const compressedPublicKeyUint8 = ecc.pointCompress(uncompressedPublicKey, true);
3930
+ const compressedPublicKey = Buffer.from(compressedPublicKeyUint8);
3931
+ const p2pkh = bitcoin.payments.p2pkh({ pubkey: uncompressedPublicKey }).address;
3932
+ const p2sh = bitcoin.payments.p2sh({
3933
+ redeem: bitcoin.payments.p2pkh({ pubkey: uncompressedPublicKey })
3934
+ }).address;
3935
+ const p2wpkh = bitcoin.payments.p2wpkh({ pubkey: compressedPublicKey }).address;
3936
+ const p2wsh = bitcoin.payments.p2wsh({
3937
+ redeem: bitcoin.payments.p2pkh({ pubkey: compressedPublicKey })
3938
+ }).address;
3939
+ return { p2pkh, p2sh, p2wpkh, p2wsh };
3940
+ }
3926
3941
  function signMessage(message) {
3927
3942
  return __async(this, null, function* () {
3928
3943
  const { signMessage: signMessage2, getPublicKey } = getBtcProvider();
@@ -5377,7 +5392,7 @@ function getGroup(state) {
5377
5392
 
5378
5393
  // src/index.ts
5379
5394
  var getVersion = () => {
5380
- return "0.5.99-beta";
5395
+ return "0.5.100-beta";
5381
5396
  };
5382
5397
  if (typeof window !== "undefined") {
5383
5398
  window.__BTC_WALLET_VERSION = getVersion();
@@ -5408,6 +5423,7 @@ export {
5408
5423
  checkSatoshiWhitelist,
5409
5424
  estimateDepositAmount,
5410
5425
  executeBTCDepositAndAction,
5426
+ getAddressByPublicKeyBase58,
5411
5427
  getBtcBalance,
5412
5428
  getBtcGasPrice,
5413
5429
  getBtcUtxos,