Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@bitgo-beta/utxo-lib

Package Overview
Dependencies
Maintainers
2
Versions
1115
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bitgo-beta/utxo-lib - npm Package Compare versions

Comparing version 2.4.2-beta.76 to 2.4.2-beta.77

4

dist/src/bitgo/outputScripts.d.ts

@@ -13,2 +13,6 @@ /// <reference types="node" />

/**
* @return true iff scriptType requires witness data
*/
export declare function hasWitnessData(scriptType: ScriptType): scriptType is 'p2shP2wsh' | 'p2wsh' | 'p2tr';
/**
* @param network

@@ -15,0 +19,0 @@ * @param scriptType

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createSpendScriptP2tr = exports.getLeafHash = exports.createPaymentP2tr = exports.toXOnlyPublicKey = exports.createOutputScript2of3 = exports.createOutputScriptP2shP2pk = exports.scriptType2Of3AsPrevOutType = exports.isSupportedScriptType = exports.isScriptType2Of3 = exports.scriptTypes2Of3 = exports.scriptTypeP2shP2pk = exports.scriptTypeForChain = void 0;
exports.createSpendScriptP2tr = exports.getLeafHash = exports.createPaymentP2tr = exports.toXOnlyPublicKey = exports.createOutputScript2of3 = exports.createOutputScriptP2shP2pk = exports.scriptType2Of3AsPrevOutType = exports.isSupportedScriptType = exports.hasWitnessData = exports.isScriptType2Of3 = exports.scriptTypes2Of3 = exports.scriptTypeP2shP2pk = exports.scriptTypeForChain = void 0;
const assert = require("assert");

@@ -18,2 +18,9 @@ const bitcoinjs = require("bitcoinjs-lib");

/**
* @return true iff scriptType requires witness data
*/
function hasWitnessData(scriptType) {
return ['p2shP2wsh', 'p2wsh', 'p2tr'].includes(scriptType);
}
exports.hasWitnessData = hasWitnessData;
/**
* @param network

@@ -227,2 +234,2 @@ * @param scriptType

}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3V0cHV0U2NyaXB0cy5qcyIsInNvdX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mQgdXNlcitiYWNrdXAgYW5kIGJpdGdvK2JhY2t1cCAyLW9mLTIgc2NyaXB0cyBvbmUgbGV2ZWwgZGVlcGVyLlxuICogQHBhcmFtIHB1YmtleXMgLSBhIHB1YmtleSBhcnJheSBjb250YWluaW5nIHRoZSB1c2VyIGtleSwgYmFja3VwIGtleSwgYW5kIGJpdGdvIGtleSBpbiB0aGF0IG9yZGVyXG4gKiBAcmV0dXJucyB7e3NjcmlwdFB1YktleX19XG4gKi9cbmZ1bmN0aW9uIGNyZWF0ZVRhcHJvb3RTY3JpcHQyb2YzKHB1YmtleXM6IFRyaXBsZTxCdWZmZXI+KTogU3BlbmRhYmxlU2NyaXB0IHtcbiAgY29uc3QgeyBvdXRwdXQgfSA9IGNyZWF0ZVBheW1lbnRQMnRyKHB1YmtleXMpO1xuICBhc3NlcnQoQnVmZmVyLmlzQnVmZmVyKG91dHB1dCkpO1xuICByZXR1cm4ge1xuICAgIHNjcmlwdFB1YktleTogb3V0cHV0LFxuICB9O1xufVxuIl19

@@ -18,2 +18,4 @@ /// <reference types="node" />

pubScript: Buffer;
redeemScript: Buffer | undefined;
witnessScript: Buffer | undefined;
}

@@ -20,0 +22,0 @@ /**

27

dist/src/bitgo/parseInput.js

@@ -6,2 +6,3 @@ "use strict";

const bitcoinjs_lib_1 = require("bitcoinjs-lib");
const outputScripts_1 = require("./outputScripts");
const types_1 = require("./types");

@@ -155,3 +156,3 @@ function isPlaceholderSignature(v) {

};
function parseP2ms(decScript, params) {
function parseP2ms(decScript, scriptType) {
const pattern2Of3 = ['OP_2', ':pubkey', ':pubkey', ':pubkey', 'OP_3', 'OP_CHECKMULTISIG'];

@@ -172,6 +173,8 @@ const match = matchScriptSome(decScript, [

return {
...params,
scriptType,
publicKeys: redeemScript.match[':pubkey'],
pubScript: redeemScript.buffer,
signatures: match[':signature'],
redeemScript: scriptType === 'p2sh' ? redeemScript.buffer : undefined,
witnessScript: scriptType === 'p2shP2wsh' || scriptType === 'p2wsh' ? redeemScript.buffer : undefined,
};

@@ -183,5 +186,3 @@ }

}
return parseP2ms(p.script, {
scriptType: 'p2sh',
});
return parseP2ms(p.script, 'p2sh');
};

@@ -192,5 +193,3 @@ const parseP2shP2wsh2Of3 = (p) => {

}
return parseP2ms(p.witness, {
scriptType: 'p2shP2wsh',
});
return { ...parseP2ms(p.witness, 'p2shP2wsh'), redeemScript: p.script[0] };
};

@@ -201,5 +200,3 @@ const parseP2wsh2Of3 = (p) => {

}
return parseP2ms(p.witness, {
scriptType: 'p2wsh',
});
return parseP2ms(p.witness, 'p2wsh');
};

@@ -263,2 +260,5 @@ const parseP2tr2Of3 = (p) => {

const result = parseSignatureScript(input);
if (!outputScripts_1.isScriptType2Of3(result.scriptType)) {
throw new Error(`invalid script type`);
}
if (!result.signatures) {

@@ -270,8 +270,5 @@ throw new Error(`missing signatures`);

}
if (!result.pubScript || result.pubScript.length === 0) {
throw new Error(`pubScript missing or empty`);
}
return result;
}
exports.parseSignatureScript2Of3 = parseSignatureScript2Of3;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGFyc2VJbnB1dC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9iaXRnby9wYXJzZUlucHV0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLHVDQUF1QztBQUN2QyxpREFBMkQ7QUFHM0QsbUNBQW1DO0FBRW5DLFNBQWdCLHNCQUFzQixDQUFDLENBQWtCO0lBQ3ZELElBQUksTUFBTSxDQUFDLFFBQVEsQ0FBQyxDQUFDLENBQUMsRUFBRTtRQUN0QixPQUFPLENBQUMsQ0FBQyxNQUFNLEtBQUssQ0FBQyxDQUFDO0tBQ3ZCO0lBQ0QsT0FBTyxDQUFDLEtBQUssQ0FBQyxDQUFDO0FBQ2pCLENBQUM7QUFMRCx3REFLQztBQXVGRCxTQUFTLGdCQUFnQjtJQUN2QixPQUFPO1FBQ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@@ /// <reference types="node" />

import { UtxoTransaction } from '../UtxoTransaction';
export declare function getInputUpdate(tx: UtxoTransaction<bigint>, vin: number, prevOut: TxOutput<bigint> & {
export declare function getInputUpdate(tx: UtxoTransaction<bigint>, vin: number, prevOuts: (TxOutput<bigint> & {
prevTx?: Buffer;
}): PsbtInputUpdate;
})[]): PsbtInputUpdate;
/**

@@ -13,9 +13,7 @@ * Takes a partially signed transaction and removes the scripts and signatures.

* Inputs must be one of:
* * P2PKH
* * P2SH 2-of-3
* * P2WSH 2-of-3
* * P2WPKH
* * P2SH -> P2WSH 2-of-3
* * P2SH -> P2WPKH
* * P2TR script path 2-of-2
* - p2shP2pk
* - p2sh 2-of-3
* - p2shP2wsh 2-of-3
* - p2wsh 2-of-3
* - p2tr script path 2-of-2
*

@@ -22,0 +20,0 @@ * @param tx the partially signed transaction

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.unsign = exports.getInputUpdate = void 0;
const opcodes = require("bitcoin-ops");
const __1 = require("../..");
const scriptTypes_1 = require("./scriptTypes");
/**
* @param hashFn
* @param script
* @param stack
*
* @return partial signatures for a 2of3 p2ms script
*/
function matchSignatures(hashFn, script, stack) {
const partialSig = [];
const publicKeys = __1.payments.p2ms({ output: script }).pubkeys;
if (!publicKeys || publicKeys.length !== 3) {
throw new Error('Invalid multisig script');
const parseInput_1 = require("../parseInput");
const signature_1 = require("../signature");
const outputScripts_1 = require("../outputScripts");
function omitUndefined(v) {
return Object.fromEntries(Object.entries(v).filter(([k, v]) => v !== undefined));
}
function getInputUpdate(tx, vin, prevOuts) {
const nonWitnessUtxo = prevOuts[vin].prevTx;
const { script, witness } = tx.ins[vin];
if (script.length === 0 && witness.length === 0) {
return nonWitnessUtxo ? { nonWitnessUtxo } : {};
}
for (const sig of stack.slice(1)) {
// Ignore extra empty element re MULTISIG bug
if (!Buffer.isBuffer(sig) || sig.length === 0)
continue;
const { signature, hashType } = __1.ScriptSignature.decode(sig);
const hash = hashFn(hashType);
let signatureMatched = false;
for (const pubkey of publicKeys) {
if (__1.ecc.verify(hash, pubkey, signature)) {
signatureMatched = true;
partialSig.push({ pubkey, signature: sig });
break;
}
}
if (!signatureMatched) {
throw new Error('Invalid signature in partially signed transaction');
}
const parsedInput = parseInput_1.parseSignatureScript(tx.ins[vin]);
function getPartialSigs() {
return signature_1.getSignaturesWithPublicKeys(tx, vin, prevOuts, parsedInput.publicKeys).flatMap((signature, i) => signature
? [
{
pubkey: parsedInput.publicKeys[i],
signature,
},
]
: []);
}
return partialSig;
}
function getInputUpdate(tx, vin, prevOut) {
const input = tx.ins[vin];
const update = {};
if (prevOut.prevTx) {
update.nonWitnessUtxo = prevOut.prevTx;
if (!outputScripts_1.hasWitnessData(parsedInput.scriptType) && !nonWitnessUtxo) {
throw new Error(`scriptType ${parsedInput.scriptType} requires prevTx Buffer`);
}
let redeemScript;
if (input.script && input.script.length) {
const decompiledScriptSig = __1.script.decompile(input.script);
if (!decompiledScriptSig) {
throw new Error('Invalid scriptSig, failed to decompile');
}
if ((!input.witness || !input.witness.length) && decompiledScriptSig.length === 2) {
throw new Error();
}
redeemScript = decompiledScriptSig.pop();
if (!Buffer.isBuffer(redeemScript)) {
throw new Error('Invalid redeem script');
}
update.redeemScript = redeemScript;
if (opcodes.OP_0 !== redeemScript[0] || ![22, 34].includes(redeemScript.length)) {
// P2SH -> 2-of-3
const hashFn = (hashType) => tx.hashForSignature(vin, redeemScript, hashType, prevOut.value);
update.partialSig = matchSignatures(hashFn, redeemScript, decompiledScriptSig);
return update;
}
}
if (input.witness && input.witness.length) {
const witness = input.witness;
if (witness.length > 2 && witness[witness.length - 1][0] === 0x50) {
throw new Error('Annex not supported');
}
if (witness.length === 1) {
// Taproot key path
update.tapKeySig = witness.pop();
return update;
}
if (scriptTypes_1.isTaproot(prevOut.script)) {
// Taproot script path
const controlBlock = witness.pop();
const script = witness.pop();
if (!controlBlock || !script)
throw new Error('Unexpected witness structure');
const leafVersion = controlBlock[0] & 0xfe;
update.tapLeafScript = [{ controlBlock, script, leafVersion }];
const publicKeys = __1.payments.p2tr_ns({ output: script }, { eccLib: __1.ecc }).pubkeys;
if (!publicKeys || publicKeys.length !== 2) {
throw new Error('expected 2 pubkeys');
switch (parsedInput.scriptType) {
case 'p2shP2pk':
return {
nonWitnessUtxo,
partialSig: [{ pubkey: parsedInput.publicKeys[0], signature: parsedInput.signatures[0] }],
};
case 'p2sh':
case 'p2wsh':
case 'p2shP2wsh':
return omitUndefined({
nonWitnessUtxo,
partialSig: getPartialSigs(),
redeemScript: parsedInput.redeemScript,
witnessScript: parsedInput.witnessScript,
});
case 'p2tr':
if (!('controlBlock' in parsedInput)) {
throw new Error(`keypath not implemented`);
}
if (witness.length !== 2) {
throw new Error(`expected exactly 2 signatures, got ${witness.length}`);
}
update.tapScriptSig = [];
let signature;
while ((signature = witness.pop()) !== undefined) {
if (signature.length === 0) {
publicKeys.shift(); // No signature for this key
continue;
}
const leafHash = __1.taproot.getTapleafHash(__1.ecc, controlBlock, script);
const pubkey = publicKeys.shift();
if (!pubkey)
throw new Error("Impossible, known 2-length things didn't match");
update.tapScriptSig.push({ signature, pubkey, leafHash });
}
}
else if (scriptTypes_1.isP2wsh(prevOut.script, redeemScript)) {
const witnessScript = witness.pop();
if (!witnessScript)
throw new Error('Invalid witness structure');
update.witnessScript = witnessScript;
const decompiledWitnessScript = __1.script.decompile(witnessScript);
if (!decompiledWitnessScript) {
throw new Error('Invalid witnessScript, failed to decompile');
}
const hashFn = (hashType) => tx.hashForWitnessV0(vin, witnessScript, prevOut.value, hashType);
update.partialSig = matchSignatures(hashFn, witnessScript, witness);
}
else if (scriptTypes_1.isP2wpkh(prevOut.script, redeemScript)) {
if (witness.length === 2) {
const pubkey = witness.pop();
const signature = witness.pop();
if (!Buffer.isBuffer(pubkey) || !Buffer.isBuffer(signature)) {
throw new Error('Invalid pubkey or signature');
}
update.partialSig = [{ pubkey, signature }];
}
return update;
}
const leafHash = __1.taproot.getTapleafHash(__1.ecc, parsedInput.controlBlock, parsedInput.pubScript);
return {
tapLeafScript: [
{
controlBlock: parsedInput.controlBlock,
script: parsedInput.pubScript,
leafVersion: parsedInput.leafVersion,
},
],
tapScriptSig: getPartialSigs().map((obj) => ({ ...obj, leafHash })),
};
}
return update;
}

@@ -137,9 +68,7 @@ exports.getInputUpdate = getInputUpdate;

* Inputs must be one of:
* * P2PKH
* * P2SH 2-of-3
* * P2WSH 2-of-3
* * P2WPKH
* * P2SH -> P2WSH 2-of-3
* * P2SH -> P2WPKH
* * P2TR script path 2-of-2
* - p2shP2pk
* - p2sh 2-of-3
* - p2shP2wsh 2-of-3
* - p2wsh 2-of-3
* - p2tr script path 2-of-2
*

@@ -153,3 +82,3 @@ * @param tx the partially signed transaction

return tx.ins.map((input, vin) => {
const update = getInputUpdate(tx, vin, prevOuts[vin]);
const update = getInputUpdate(tx, vin, prevOuts);
input.witness = [];

@@ -161,2 +90,2 @@ input.script = Buffer.alloc(0);

exports.unsign = unsign;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZnJvbUhhbGZTaWduZWQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvYml0Z28vcHNidC9mcm9tSGFsZlNpZ25lZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFDQSx1Q0FBdUM7QUFDdkMsNkJBQThHO0FBRTlHLCtDQUE2RDtBQUU3RDs7Ozs7O0dBTUc7QUFDSCxTQUFTLGVBQWUsQ0FBQyxNQUFvQyxFQUFFLE1BQWMsRUFBRSxLQUFZO0lBQ3pGLE1BQU0sVUFBVSxHQUFpQixFQUFFLENBQUM7SUFDcEMsTUFBTSxVQUFVLEdBQUcsWUFBUSxDQUFDLElBQUksQ0FBQyxFQUFFLE1BQU0sRUFBRSxNQUFNLEVBQUUsQ0FBQyxDQUFDLE9BQU8sQ0FBQztJQUM3RCxJQUFJLENBQUMsVUFBVSxJQUFJLFVBQ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NcbiAqICAtIHAydHIgc2NyaXB0IHBhdGggMi1vZi0yXG4gKlxuICogQHBhcmFtIHR4IHRoZSBwYXJ0aWFsbHkgc2lnbmVkIHRyYW5zYWN0aW9uXG4gKiBAcGFyYW0gcHJldk91dHNcbiAqXG4gKiBAcmV0dXJuIHRoZSByZW1vdmVkIHNjcmlwdHMgYW5kIHNpZ25hdHVyZXMsIHJlYWR5IHRvIGJlIGFkZGVkIHRvIGEgUFNCVFxuICovXG5leHBvcnQgZnVuY3Rpb24gdW5zaWduKHR4OiBVdHhvVHJhbnNhY3Rpb248YmlnaW50PiwgcHJldk91dHM6IFR4T3V0cHV0PGJpZ2ludD5bXSk6IFBzYnRJbnB1dFVwZGF0ZVtdIHtcbiAgcmV0dXJuIHR4Lmlucy5tYXAoKGlucHV0LCB2aW4pID0+IHtcbiAgICBjb25zdCB1cGRhdGUgPSBnZXRJbnB1dFVwZGF0ZSh0eCwgdmluLCBwcmV2T3V0cyk7XG4gICAgaW5wdXQud2l0bmVzcyA9IFtdO1xuICAgIGlucHV0LnNjcmlwdCA9IEJ1ZmZlci5hbGxvYygwKTtcbiAgICByZXR1cm4gdXBkYXRlO1xuICB9KTtcbn1cbiJdfQ==

@@ -29,3 +29,8 @@ /// <reference types="node" />

/** Set to the public key that signed for the signature */
signedBy: Buffer | undefined;
signedBy: Buffer;
/** Set to the signature buffer */
signature: Buffer;
} | {
signedBy: undefined;
signature: undefined;
};

@@ -55,2 +60,10 @@ /**

* @param inputIndex
* @param prevOutputs
* @param publicKeys
* @return array with signature corresponding to n-th key, undefined if no match found
*/
export declare function getSignaturesWithPublicKeys<TNumber extends number | bigint>(transaction: UtxoTransaction<TNumber>, inputIndex: number, prevOutputs: TxOutput<TNumber>[], publicKeys: Buffer[]): Array<Buffer | undefined>;
/**
* @param transaction
* @param inputIndex
* @param prevOutputs - transaction outputs for inputs

@@ -57,0 +70,0 @@ * @param publicKeys - public keys to check signatures for

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.signInput2Of3 = exports.signInputP2shP2pk = exports.getDefaultSigHash = exports.verifySignatureWithPublicKey = exports.verifySignatureWithPublicKeys = exports.verifySignature = exports.getSignatureVerifications = void 0;
exports.signInput2Of3 = exports.signInputP2shP2pk = exports.getDefaultSigHash = exports.verifySignatureWithPublicKey = exports.verifySignatureWithPublicKeys = exports.getSignaturesWithPublicKeys = exports.verifySignature = exports.getSignatureVerifications = void 0;
const bitcoinjs_lib_1 = require("bitcoinjs-lib");

@@ -43,3 +43,3 @@ const UtxoTransaction_1 = require("./UtxoTransaction");

if (signatureBuffer === 0 || signatureBuffer.length === 0) {
return { signedBy: undefined };
return { signedBy: undefined, signature: undefined };
}

@@ -69,6 +69,6 @@ let hashType = bitcoinjs_lib_1.Transaction.SIGHASH_DEFAULT;

if (signedBy.length === 0) {
return { signedBy: undefined };
return { signedBy: undefined, signature: undefined };
}
if (signedBy.length === 1) {
return { signedBy: signedBy[0] };
return { signedBy: signedBy[0], signature: signatureBuffer };
}

@@ -92,6 +92,6 @@ throw new Error(`illegal state: signed by multiple public keys`);

if (signedBy.length === 0) {
return { signedBy: undefined };
return { signedBy: undefined, signature: undefined };
}
if (signedBy.length === 1) {
return { signedBy: signedBy[0] };
return { signedBy: signedBy[0], signature: signatureBuffer };
}

@@ -136,7 +136,7 @@ throw new Error(`illegal state: signed by multiple public keys`);

* @param inputIndex
* @param prevOutputs - transaction outputs for inputs
* @param publicKeys - public keys to check signatures for
* @return array of booleans indicating a valid signature for every pubkey in _publicKeys_
* @param prevOutputs
* @param publicKeys
* @return array with signature corresponding to n-th key, undefined if no match found
*/
function verifySignatureWithPublicKeys(transaction, inputIndex, prevOutputs, publicKeys) {
function getSignaturesWithPublicKeys(transaction, inputIndex, prevOutputs, publicKeys) {
if (transaction.ins.length !== prevOutputs.length) {

@@ -146,4 +146,18 @@ throw new Error(`input length must match prevOutputs length`);

const signatureVerifications = getSignatureVerifications(transaction, inputIndex, prevOutputs[inputIndex].value, {}, prevOutputs);
return publicKeys.map((publicKey) => !!signatureVerifications.find((v) => isSignatureByPublicKey(v, publicKey)));
return publicKeys.map((publicKey) => {
const v = signatureVerifications.find((v) => isSignatureByPublicKey(v, publicKey));
return v ? v.signature : undefined;
});
}
exports.getSignaturesWithPublicKeys = getSignaturesWithPublicKeys;
/**
* @param transaction
* @param inputIndex
* @param prevOutputs - transaction outputs for inputs
* @param publicKeys - public keys to check signatures for
* @return array of booleans indicating a valid signature for every pubkey in _publicKeys_
*/
function verifySignatureWithPublicKeys(transaction, inputIndex, prevOutputs, publicKeys) {
return getSignaturesWithPublicKeys(transaction, inputIndex, prevOutputs, publicKeys).map((s) => s !== undefined);
}
exports.verifySignatureWithPublicKeys = verifySignatureWithPublicKeys;

@@ -212,2 +226,2 @@ /**

exports.signInput2Of3 = signInput2Of3;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2lnbmF0dXJlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2JpdGdvL3NpZ25hdHVyZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFFQSxpREFBZ0Y7QUFFaEYsdURBQW9EO0FBRXBELG1EQU15QjtBQUV6QiwwQ0FBNEQ7QUFDNUQsNENBQTZDO0FBQzdDLDZDQUF3RDtBQTBCeEQ7Ozs7Ozs7OztHQVNHO0FBQ0gsU0FBZ0IseUJBQXlCLENBQ3ZDLFdBQXFDLEVBQ3JDLFVBQWtCLEVBQ2xCLE1BQWUsRUFDZix1QkFBNkMsRUFBRSxFQUMvQyxXQUFpQztJQUVqQywwQkFBMEI7SUFDMUIsSUFBSSxDQUFDLFdBQVcsQ0FBQyxHQUFHLEVBQUU7UUFDcEIsTUFBTSxJQUFJLEtBQUssQ0FBQyxxQkFBcUIsQ0FBQyxDQUFDO0tBQ3hDO0lBRUQsTUFBTSxLQUFLLEdBQUcsV0FBVyxDQUFDLEdBQUcsQ0FBQyxVQ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VlbVNjcmlwdCwgd2l0bmVzc1NjcmlwdCB9ID0gY3JlYXRlT3V0cHV0U2NyaXB0Mm9mMyhwdWJrZXlzLCBzY3JpcHRUeXBlKSk7XG4gIH1cblxuICBrZXlQYWlyLm5ldHdvcmsgPSB0eEJ1aWxkZXIubmV0d29yaztcblxuICB0eEJ1aWxkZXIuc2lnbih7XG4gICAgdmluLFxuICAgIHByZXZPdXRTY3JpcHRUeXBlLFxuICAgIGtleVBhaXIsXG4gICAgaGFzaFR5cGU6IGdldERlZmF1bHRTaWdIYXNoKHR4QnVpbGRlci5uZXR3b3JrIGFzIE5ldHdvcmssIHNjcmlwdFR5cGUpLFxuICAgIHJlZGVlbVNjcmlwdCxcbiAgICB3aXRuZXNzU2NyaXB0LFxuICAgIHdpdG5lc3NWYWx1ZTogYW1vdW50LFxuICAgIGNvbnRyb2xCbG9jayxcbiAgfSk7XG59XG4iXX0=
{
"name": "@bitgo-beta/utxo-lib",
"version": "2.4.2-beta.76",
"version": "2.4.2-beta.77",
"description": "Client-side Bitcoin JavaScript library",

@@ -49,3 +49,3 @@ "main": "./dist/src/index.js",

"dependencies": {
"@bitgo-beta/blake2b": "3.0.4-beta.76",
"@bitgo-beta/blake2b": "3.0.4-beta.77",
"@noble/secp256k1": "1.6.3",

@@ -85,3 +85,3 @@ "bip174": "npm:@bitgo/bip174@3.0.0",

"license": "MIT",
"gitHead": "d4ad78755cb4e04c276c0abef320c6255d419899"
"gitHead": "818c5662e6f028069dcd156ad018b3a046d35fff"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc