@secondlayer/stacks 6.4.1 → 6.5.0
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/dist/shared/{stacks-esm-ss9ap75h.js → stacks-esm-47b3bb9e.js} +2 -2
- package/dist/shared/stacks-esm-51sysw9g.js +7 -0
- package/dist/shared/stacks-esm-51sysw9g.js.map +10 -0
- package/dist/shared/{stacks-esm-z0rq3ejt.js → stacks-esm-fb1gh99a.js} +4 -7
- package/dist/shared/{stacks-esm-z0rq3ejt.js.map → stacks-esm-fb1gh99a.js.map} +4 -5
- package/dist/shared/{stacks-esm-e2qhfgke.js → stacks-esm-ph2fd7hg.js} +8 -4
- package/dist/shared/{stacks-esm-e2qhfgke.js.map → stacks-esm-ph2fd7hg.js.map} +3 -3
- package/dist/shared/stacks-esm-zvpv6a06.js +28 -0
- package/dist/shared/stacks-esm-zvpv6a06.js.map +10 -0
- package/dist/src/accounts/index.cjs +7 -3
- package/dist/src/accounts/index.cjs.map +3 -3
- package/dist/src/accounts/index.js +1 -1
- package/dist/src/bitcoin/index.cjs +7 -3
- package/dist/src/bitcoin/index.cjs.map +3 -3
- package/dist/src/bitcoin/index.d.cts +6 -5
- package/dist/src/bitcoin/index.d.ts +6 -5
- package/dist/src/bitcoin/index.js +12 -23
- package/dist/src/bitcoin/index.js.map +3 -4
- package/dist/src/pox/index.cjs +7 -3
- package/dist/src/pox/index.cjs.map +3 -3
- package/dist/src/pox/index.js +2 -2
- package/dist/src/pox5/index.cjs +7 -3
- package/dist/src/pox5/index.cjs.map +3 -3
- package/dist/src/pox5/index.js +7 -5
- package/dist/src/pox5/index.js.map +2 -2
- package/dist/src/sbtc/index.cjs +173 -15
- package/dist/src/sbtc/index.cjs.map +10 -7
- package/dist/src/sbtc/index.d.cts +117 -5
- package/dist/src/sbtc/index.d.ts +117 -5
- package/dist/src/sbtc/index.js +152 -9
- package/dist/src/sbtc/index.js.map +7 -6
- package/package.json +1 -1
- /package/dist/shared/{stacks-esm-ss9ap75h.js.map → stacks-esm-47b3bb9e.js.map} +0 -0
package/dist/src/pox/index.cjs
CHANGED
|
@@ -3996,10 +3996,12 @@ function formatBitcoinAddress(parsed, network = "mainnet") {
|
|
|
3996
3996
|
function toPubkeyBytes(publicKey) {
|
|
3997
3997
|
return typeof publicKey === "string" ? hexToBytes(publicKey) : publicKey;
|
|
3998
3998
|
}
|
|
3999
|
-
function taprootTweakPubkey(xonly) {
|
|
3999
|
+
function taprootTweakPubkey(xonly, merkleRoot) {
|
|
4000
4000
|
if (xonly.length !== 32)
|
|
4001
4001
|
throw new Error(`Expected 32-byte x-only pubkey, got ${xonly.length}`);
|
|
4002
|
-
|
|
4002
|
+
if (merkleRoot && merkleRoot.length !== 32)
|
|
4003
|
+
throw new Error(`Expected 32-byte merkle root, got ${merkleRoot.length}`);
|
|
4004
|
+
const tweak = merkleRoot ? import_secp256k13.schnorr.utils.taggedHash("TapTweak", xonly, merkleRoot) : import_secp256k13.schnorr.utils.taggedHash("TapTweak", xonly);
|
|
4003
4005
|
const t = BigInt(`0x${Array.from(tweak, (b) => b.toString(16).padStart(2, "0")).join("")}`);
|
|
4004
4006
|
if (t >= import_secp256k13.secp256k1.Point.Fn.ORDER)
|
|
4005
4007
|
throw new Error("Invalid tap tweak (exceeds curve order)");
|
|
@@ -4019,6 +4021,8 @@ function publicKeyToP2trAddress(publicKey, network = "mainnet") {
|
|
|
4019
4021
|
const xonly = pubkey.length === 33 ? pubkey.slice(1) : pubkey.length === 32 ? pubkey : undefined;
|
|
4020
4022
|
if (!xonly)
|
|
4021
4023
|
throw new Error(`Expected 33-byte compressed or 32-byte x-only pubkey, got ${pubkey.length}`);
|
|
4024
|
+
if (pubkey.length === 33 && pubkey[0] !== 2 && pubkey[0] !== 3)
|
|
4025
|
+
throw new Error(`Expected a compressed pubkey prefix 0x02 or 0x03, got 0x${pubkey[0]?.toString(16).padStart(2, "0")}`);
|
|
4022
4026
|
const params = NETWORK_PARAMS[network];
|
|
4023
4027
|
const outputKey = taprootTweakPubkey(xonly);
|
|
4024
4028
|
return import_base5.bech32m.encode(params.hrp, [1, ...import_base5.bech32m.toWords(outputKey)]);
|
|
@@ -4275,5 +4279,5 @@ function pox() {
|
|
|
4275
4279
|
});
|
|
4276
4280
|
}
|
|
4277
4281
|
|
|
4278
|
-
//# debugId=
|
|
4282
|
+
//# debugId=E076D1C30755B23264756E2164756E21
|
|
4279
4283
|
//# sourceMappingURL=index.cjs.map
|