utxo-lib 1.0.7 → 1.0.9
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/src/base_crypto.d.ts +14 -0
- package/dist/src/base_crypto.d.ts.map +1 -0
- package/dist/src/base_crypto.js +215 -0
- package/dist/src/bitgo/Musig2.js +2 -3
- package/dist/src/bitgo/UtxoPsbt.js +12 -20
- package/dist/src/bitgo/UtxoTransaction.js +2 -2
- package/dist/src/bitgo/outputScripts.js +3 -3
- package/dist/src/bitgo/parseInput.js +2 -2
- package/dist/src/bitgo/psbt/scriptTypes.js +3 -3
- package/dist/src/bitgo/wallet/chains.d.ts +1 -1
- package/dist/src/bitgo/zcash/ZcashPsbt.js +2 -3
- package/dist/src/bitgo/zcash/ZcashTransaction.js +2 -2
- package/dist/src/musig.d.ts +391 -0
- package/dist/src/musig.d.ts.map +1 -0
- package/dist/src/musig.js +461 -0
- package/dist/src/noble_ecc.d.ts +1 -1
- package/dist/src/noble_ecc.d.ts.map +1 -1
- package/dist/src/noble_ecc.js +5 -5
- package/dist/src/payments/p2tr.js +9 -13
- package/dist/src/payments/p2tr_ns.js +2 -3
- package/dist/src/taproot.js +2 -3
- package/dist/src/transaction_builder.js +2 -2
- package/package.json +1 -2
package/dist/src/taproot.js
CHANGED
@@ -373,12 +373,11 @@ function getTaptreeRoot(ecc, controlBlock, tapscript, tapleafHash) {
|
|
373
373
|
}
|
374
374
|
exports.getTaptreeRoot = getTaptreeRoot;
|
375
375
|
function getTweakedOutputKey(payment) {
|
376
|
-
var _a;
|
377
376
|
assert(payment.output);
|
378
377
|
if (payment.output.length === 34) {
|
379
|
-
return
|
378
|
+
return payment.output?.subarray(2);
|
380
379
|
}
|
381
380
|
throw new Error(`invalid p2tr tweaked output key size ${payment.output.length}`);
|
382
381
|
}
|
383
382
|
exports.getTweakedOutputKey = getTweakedOutputKey;
|
384
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFwcm9vdC5qcyIsInNvdXJjZVJvb3QiOiIiL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