New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@bitgo-beta/utxo-lib

Package Overview
Dependencies
Maintainers
2
Versions
1175
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 4.0.1-alpha.18 to 4.0.1-alpha.19

7

dist/src/bitgo/psbt/fromHalfSigned.js

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

}
if (!outputScripts_1.hasWitnessData(parsedInput.scriptType) && !nonWitnessUtxo) {
// Because Zcash directly hashes the value for non-segwit transactions, we do not need to check indirectly
// with the previous transaction. Therefore, we can treat Zcash non-segwit transactions as Bitcoin
// segwit transactions
if (!outputScripts_1.hasWitnessData(parsedInput.scriptType) && !nonWitnessUtxo && __1.getMainnet(tx.network) !== __1.networks.zcash) {
throw new Error(`scriptType ${parsedInput.scriptType} requires prevTx Buffer`);

@@ -89,2 +92,2 @@ }

exports.unsign = unsign;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZnJvbUhhbGZTaWduZWQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvYml0Z28vcHNidC9mcm9tSGFsZlNpZ25lZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFDQSw2QkFBeUQ7QUFFekQsOENBQXFEO0FBQ3JELDRDQUEyRDtBQUMzRCxvREFBa0Q7QUFFbEQsU0FBUyxhQUFhLENBQW9DLENBQTBCO0lBQ2xGLE9BQU8sTUFBTSxDQUFDLFdBQVcsQ0FBQyxNQUFNLENBQUMsT0FBTyxDQUFDLENBQUMsQ0FBQyxDQUFDLE1BQU0sQ0FBQyxDQUFDLENBQUMsQ0FBQyxFQUFFLENBQUMsQ0FBQyxFQUFFLEVBQUUsQ0FBQyxDQUFDLEtBQUssU0FBUyxDQUFDLENBQU0sQ0FBQzt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BkYXRlID0gZ2V0SW5wdXRVcGRhdGUodHgsIHZpbiwgcHJldk91dHMpO1xuICAgIGlucHV0LndpdG5lc3MgPSBbXTtcbiAgICBpbnB1dC5zY3JpcHQgPSBCdWZmZXIuYWxsb2MoMCk7XG4gICAgcmV0dXJuIHVwZGF0ZTtcbiAgfSk7XG59XG4iXX0=

@@ -10,3 +10,4 @@ /// <reference types="node" />

}, amountType?: 'number' | 'bigint'): UtxoTransaction<TNumber>;
export declare function createPsbtFromBuffer(buf: Buffer, network: Network): UtxoPsbt<UtxoTransaction<bigint>>;
export declare function createPsbtFromBuffer(buf: Buffer, network: Network, bip32PathsAbsolute?: boolean): UtxoPsbt<UtxoTransaction<bigint>>;
export declare function createPsbtFromHex(hex: string, network: Network, bip32PathsAbsolute?: boolean): UtxoPsbt<UtxoTransaction<bigint>>;
export declare function createPsbtFromTransaction(tx: UtxoTransaction<bigint>, prevOuts: TxOutput<bigint>[]): UtxoPsbt<UtxoTransaction<bigint>>;

@@ -13,0 +14,0 @@ export declare function createTransactionFromHex<TNumber extends number | bigint = number>(hex: string, network: Network, amountType?: 'number' | 'bigint'): UtxoTransaction<TNumber>;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createTransactionBuilderFromTransaction = exports.createTransactionBuilderForNetwork = exports.createPsbtForNetwork = exports.setPsbtDefaults = exports.setTransactionBuilderDefaults = exports.getDefaultTransactionVersion = exports.createTransactionFromHex = exports.createPsbtFromTransaction = exports.createPsbtFromBuffer = exports.createTransactionFromBuffer = void 0;
exports.createTransactionBuilderFromTransaction = exports.createTransactionBuilderForNetwork = exports.createPsbtForNetwork = exports.setPsbtDefaults = exports.setTransactionBuilderDefaults = exports.getDefaultTransactionVersion = exports.createTransactionFromHex = exports.createPsbtFromTransaction = exports.createPsbtFromHex = exports.createPsbtFromBuffer = exports.createTransactionFromBuffer = void 0;
const networks_1 = require("../networks");

@@ -33,3 +33,3 @@ const UtxoPsbt_1 = require("./UtxoPsbt");

exports.createTransactionFromBuffer = createTransactionFromBuffer;
function createPsbtFromBuffer(buf, network) {
function createPsbtFromBuffer(buf, network, bip32PathsAbsolute = false) {
switch (networks_1.getMainnet(network)) {

@@ -42,7 +42,7 @@ case networks_1.networks.bitcoin:

case networks_1.networks.litecoin:
return UtxoPsbt_1.UtxoPsbt.fromBuffer(buf, { network });
return UtxoPsbt_1.UtxoPsbt.fromBuffer(buf, { network, bip32PathsAbsolute });
case networks_1.networks.dash:
return DashPsbt_1.DashPsbt.fromBuffer(buf, { network });
return DashPsbt_1.DashPsbt.fromBuffer(buf, { network, bip32PathsAbsolute });
case networks_1.networks.zcash:
return ZcashPsbt_1.ZcashPsbt.fromBuffer(buf, { network });
return ZcashPsbt_1.ZcashPsbt.fromBuffer(buf, { network, bip32PathsAbsolute });
}

@@ -53,2 +53,6 @@ /* istanbul ignore next */

exports.createPsbtFromBuffer = createPsbtFromBuffer;
function createPsbtFromHex(hex, network, bip32PathsAbsolute = false) {
return createPsbtFromBuffer(Buffer.from(hex, 'hex'), network, bip32PathsAbsolute);
}
exports.createPsbtFromHex = createPsbtFromHex;
function createPsbtFromTransaction(tx, prevOuts) {

@@ -211,2 +215,2 @@ switch (networks_1.getMainnet(tx.network)) {

exports.createTransactionBuilderFromTransaction = createTransactionBuilderFromTransaction;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHJhbnNhY3Rpb24uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvYml0Z28vdHJhbnNhY3Rpb24udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBRUEsMENBQTREO0FBRTVELHlDQUFnRDtBQUNoRCx1REFBb0Q7QUFDcEQscUVBQWtFO0FBQ2xFLDhDQUEyQztBQUMzQyw0REFBeUQ7QUFDekQsMEVBQXVFO0FBQ3ZFLGlEQUE4QztBQUM5Qyw2RUFBMEU7QUFDMUUsK0RBQTBFO0FBRTFFLFNBQ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XR3b3Jrcy5iaXRjb2luY2FzaDpcbiAgICBjYXNlIG5ldHdvcmtzLmJpdGNvaW5zdjpcbiAgICBjYXNlIG5ldHdvcmtzLmJpdGNvaW5nb2xkOlxuICAgIGNhc2UgbmV0d29ya3MuZG9nZWNvaW46XG4gICAgY2FzZSBuZXR3b3Jrcy5lY2FzaDpcbiAgICBjYXNlIG5ldHdvcmtzLmxpdGVjb2luOlxuICAgICAgcmV0dXJuIFV0eG9UcmFuc2FjdGlvbkJ1aWxkZXIuZnJvbVRyYW5zYWN0aW9uPFROdW1iZXI+KHR4LCB1bmRlZmluZWQsIHByZXZPdXRwdXRzKTtcbiAgICBjYXNlIG5ldHdvcmtzLmRhc2g6XG4gICAgICByZXR1cm4gRGFzaFRyYW5zYWN0aW9uQnVpbGRlci5mcm9tVHJhbnNhY3Rpb248VE51bWJlcj4oXG4gICAgICAgIHR4IGFzIERhc2hUcmFuc2FjdGlvbjxUTnVtYmVyPixcbiAgICAgICAgdW5kZWZpbmVkLFxuICAgICAgICBwcmV2T3V0cHV0cyBhcyBUeE91dHB1dDxUTnVtYmVyPltdXG4gICAgICApO1xuICAgIGNhc2UgbmV0d29ya3MuemNhc2g6XG4gICAgICByZXR1cm4gWmNhc2hUcmFuc2FjdGlvbkJ1aWxkZXIuZnJvbVRyYW5zYWN0aW9uPFROdW1iZXI+KFxuICAgICAgICB0eCBhcyBaY2FzaFRyYW5zYWN0aW9uPFROdW1iZXI+LFxuICAgICAgICB1bmRlZmluZWQsXG4gICAgICAgIHByZXZPdXRwdXRzIGFzIFR4T3V0cHV0PFROdW1iZXI+W11cbiAgICAgICk7XG4gIH1cblxuICB0aHJvdyBuZXcgRXJyb3IoYGludmFsaWQgbmV0d29ya2ApO1xufVxuIl19

@@ -28,2 +28,3 @@ /// <reference types="node" />

maximumFeeRate?: number;
bip32PathsAbsolute?: boolean;
}

@@ -30,0 +31,0 @@ export declare class UtxoPsbt<Tx extends UtxoTransaction<bigint>> extends Psbt {

@@ -29,3 +29,5 @@ "use strict";

};
const psbtBase = bip174_1.Psbt.fromBuffer(buffer, transactionFromBuffer);
const psbtBase = bip174_1.Psbt.fromBuffer(buffer, transactionFromBuffer, {
bip32PathsAbsolute: opts.bip32PathsAbsolute,
});
const psbt = this.createPsbt(opts, psbtBase);

@@ -36,3 +38,3 @@ // Upstream checks for duplicate inputs here, but it seems to be of dubious value.

static fromHex(data, opts) {
return UtxoPsbt.fromBuffer(Buffer.from(data, 'hex'), opts);
return this.fromBuffer(Buffer.from(data, 'hex'), opts);
}

@@ -100,3 +102,3 @@ toHex() {

psbt.updateInput(index, update);
psbt.updateInput(index, { witnessUtxo: prevOutputs[index] });
psbt.updateInput(index, { witnessUtxo: { script: prevOutputs[index].script, value: prevOutputs[index].value } });
});

@@ -369,2 +371,2 @@ return psbt;

exports.UtxoPsbt = UtxoPsbt;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiVXR4b1BzYnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvYml0Z28vVXR4b1BzYnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsbUNBQTBDO0FBRTFDLGdEQUFxRDtBQUNyRCwrREFBc0U7QUFFdEUsMEJBQTZHO0FBQzdHLHVEQUFvRDtBQUNwRCx1Q0FBZ0Q7QUFDaEQsb0RBQThDO0FBQzlDLDBEQUErQztBQUMvQyxtREFBbUQ7QUFDbkQsNkNBQThDO0FBOEI5QywyRUFBMkU7QUFDM0UsOEVBQThFO0FBQzlFLGlFQUFpRTtBQUNqRSxNQUFhLFFBQTZDLFNBQVEsUUFBSTtJQUMxRCxNQUFNLENBQUMscUJBQXFCLENBQUMsTUFBYyxFQUFFLE9BQWdCO1FBQ3JFLE9BQU8saUNBQWUsQ0FBQyxVQUFVLENBQVMsTUFBTSxFQUFFLEtBQUssRUFBRSxRQUFRLEVBQUUsT0FBTyxDQUFDLENBQUM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R4b0hhc2gpKSB7XG4gICAgICAgICAgdGhyb3cgbmV3IEVycm9yKGBOb24td2l0bmVzcyBVVFhPIGhhc2ggZm9yIGlucHV0ICMke2l9IGRvZXNuJ3QgbWF0Y2ggdGhlIGhhc2ggc3BlY2lmaWVkIGluIHRoZSBwcmV2b3V0YCk7XG4gICAgICAgIH1cblxuICAgICAgICBjb25zdCBwcmV2b3V0SW5kZXggPSB0eElucHV0c1tpXS5pbmRleDtcbiAgICAgICAgcHJldm91dCA9IG5vbldpdG5lc3NVdHhvVHgub3V0c1twcmV2b3V0SW5kZXhdO1xuICAgICAgfSBlbHNlIGlmIChpbnB1dC53aXRuZXNzVXR4bykge1xuICAgICAgICBwcmV2b3V0ID0gaW5wdXQud2l0bmVzc1V0eG87XG4gICAgICB9IGVsc2Uge1xuICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ05lZWQgYSBVdHhvIGlucHV0IGl0ZW0gZm9yIHNpZ25pbmcnKTtcbiAgICAgIH1cbiAgICAgIHByZXZvdXRTY3JpcHRzLnB1c2gocHJldm91dC5zY3JpcHQpO1xuICAgICAgcHJldm91dFZhbHVlcy5wdXNoKHByZXZvdXQudmFsdWUpO1xuICAgIH0pO1xuICAgIGNvbnN0IGhhc2ggPSB0aGlzLnR4Lmhhc2hGb3JXaXRuZXNzVjEoaW5wdXRJbmRleCwgcHJldm91dFNjcmlwdHMsIHByZXZvdXRWYWx1ZXMsIHNpZ2hhc2hUeXBlLCBsZWFmSGFzaCk7XG4gICAgcmV0dXJuIHsgaGFzaCwgc2lnaGFzaFR5cGUgfTtcbiAgfVxufVxuIl19
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.addWalletUnspentToPsbt = exports.addReplayProtectionUnspentToPsbt = exports.verifySignatureWithUnspent = exports.signInputWithUnspent = exports.isWalletUnspent = void 0;
const __1 = require("../..");
const outputScripts_1 = require("../outputScripts");

@@ -44,3 +45,7 @@ const address_1 = require("../../address");

const { txid, vout } = Unspent_1.toPrevOutput(u, network);
if (!Unspent_1.isUnspentWithPrevTx(u)) {
const isZcash = __1.getMainnet(network) !== __1.networks.zcash;
// Because Zcash directly hashes the value for non-segwit transactions, we do not need to check indirectly
// with the previous transaction. Therefore, we can treat Zcash non-segwit transactions as Bitcoin
// segwit transactions
if (!Unspent_1.isUnspentWithPrevTx(u) && !isZcash) {
throw new Error('Error, require previous tx to add to PSBT');

@@ -51,5 +56,7 @@ }

index: vout,
nonWitnessUtxo: u.prevTx,
redeemScript,
});
if (!isZcash) {
psbt.updateInput(vout, { nonWitnessUtxo: u.prevTx });
}
}

@@ -70,3 +77,6 @@ exports.addReplayProtectionUnspentToPsbt = addReplayProtectionUnspentToPsbt;

const inputIndex = psbt.inputCount - 1;
if (!chains_1.isSegwit(u.chain)) {
// Because Zcash directly hashes the value for non-segwit transactions, we do not need to check indirectly
// with the previous transaction. Therefore, we can treat Zcash non-segwit transactions as Bitcoin
// segwit transactions
if (!chains_1.isSegwit(u.chain) && __1.getMainnet(network) !== __1.networks.zcash) {
if (!Unspent_1.isUnspentWithPrevTx(u)) {

@@ -110,2 +120,2 @@ throw new Error('Error, require previous tx to add to PSBT');

exports.addWalletUnspentToPsbt = addWalletUnspentToPsbt;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiVW5zcGVudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9iaXRnby93YWxsZXQvVW5zcGVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFFQSxvREFBcUc7QUFDckcsMkNBQStDO0FBQy9DLDRDQUE0RTtBQUs1RSx3Q0FBcUc7QUFDckcscUNBQStDO0FBWS9DLFNBQWdCLGVBQWUsQ0FBa0MsQ0FBbUI7SUFDbEYsT0FBUSxDQUE0QixDQUFDLEtBQUssS0FBSyxTQUFTLENBQUM7QUFDM0QsQ0FBQztBQUZELDBDQUVDO0FBRUQsU0FBZ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V2FsbGV0S2V5c1trZXldLCB1LmNoYWluLCB1LmluZGV4KSxcbiAgICAgICAgbWFzdGVyRmluZ2VycHJpbnQ6IHJvb3RXYWxsZXRLZXlzW2tleV0uZmluZ2VycHJpbnQsXG4gICAgICB9KSksXG4gICAgfSk7XG4gIH0gZWxzZSB7XG4gICAgY29uc3QgeyB3aXRuZXNzU2NyaXB0LCByZWRlZW1TY3JpcHQgfSA9IGNyZWF0ZU91dHB1dFNjcmlwdDJvZjMod2FsbGV0S2V5cy5wdWJsaWNLZXlzLCBzY3JpcHRUeXBlKTtcbiAgICBwc2J0LnVwZGF0ZUlucHV0KGlucHV0SW5kZXgsIHtcbiAgICAgIGJpcDMyRGVyaXZhdGlvbjogWzAsIDEsIDJdLm1hcCgoaWR4KSA9PiAoe1xuICAgICAgICBwdWJrZXk6IHdhbGxldEtleXMudHJpcGxlW2lkeF0ucHVibGljS2V5LFxuICAgICAgICBwYXRoOiB3YWxsZXRLZXlzLnBhdGhzW2lkeF0sXG4gICAgICAgIG1hc3RlckZpbmdlcnByaW50OiByb290V2FsbGV0S2V5cy50cmlwbGVbaWR4XS5maW5nZXJwcmludCxcbiAgICAgIH0pKSxcbiAgICB9KTtcbiAgICBpZiAod2l0bmVzc1NjcmlwdCkge1xuICAgICAgcHNidC51cGRhdGVJbnB1dChpbnB1dEluZGV4LCB7IHdpdG5lc3NTY3JpcHQgfSk7XG4gICAgfVxuICAgIGlmIChyZWRlZW1TY3JpcHQpIHtcbiAgICAgIHBzYnQudXBkYXRlSW5wdXQoaW5wdXRJbmRleCwgeyByZWRlZW1TY3JpcHQgfSk7XG4gICAgfVxuICB9XG59XG4iXX0=
/// <reference types="node" />
import { PsbtOpts, UtxoPsbt } from '../UtxoPsbt';
import { ZcashTransaction } from './ZcashTransaction';
import { Network } from '../../';
import { Network, Signer } from '../../';
import { Psbt as PsbtBase } from 'bip174';
import { UtxoTransaction } from '../UtxoTransaction';
import { ValidateSigFunction } from 'bitcoinjs-lib/src/psbt';
export declare class ZcashPsbt extends UtxoPsbt<ZcashTransaction<bigint>> {

@@ -19,3 +20,2 @@ protected static transactionFromBuffer(buffer: Buffer, network: Network): ZcashTransaction<bigint>;

static fromBuffer(buffer: Buffer, opts: PsbtOpts): UtxoPsbt<UtxoTransaction<bigint>>;
static fromHex(data: string, opts: PsbtOpts): UtxoPsbt<UtxoTransaction<bigint>>;
/**

@@ -30,2 +30,5 @@ * If it is a version 4 transaction, add the consensus branch id to

setDefaultsForVersion(network: Network, version: number): void;
signInput(inputIndex: number, keyPair: Signer, sighashTypes?: number[]): this;
validateSignaturesOfInput(inputIndex: number, validator: ValidateSigFunction, pubkey?: Buffer): boolean;
private withUnsafeSignNonSegwitTrue;
private setPropertyCheckSignatures;

@@ -32,0 +35,0 @@ setConsensusBranchId(consensusBranchId: number): void;

@@ -68,5 +68,2 @@ "use strict";

}
static fromHex(data, opts) {
return ZcashPsbt.fromBuffer(Buffer.from(data, 'hex'), opts);
}
/**

@@ -115,2 +112,20 @@ * If it is a version 4 transaction, add the consensus branch id to

}
// For Zcash transactions, we do not have to have non-witness UTXO data for non-segwit
// transactions because zcash hashes the value directly. Thus, it is unnecessary to have
// the previous transaction hash on the unspent.
signInput(inputIndex, keyPair, sighashTypes) {
return this.withUnsafeSignNonSegwitTrue(super.signInput.bind(this, inputIndex, keyPair, sighashTypes));
}
validateSignaturesOfInput(inputIndex, validator, pubkey) {
return this.withUnsafeSignNonSegwitTrue(super.validateSignaturesOfInput.bind(this, inputIndex, validator, pubkey));
}
withUnsafeSignNonSegwitTrue(fn) {
this.__CACHE.__UNSAFE_SIGN_NONSEGWIT = true;
try {
return fn();
}
finally {
this.__CACHE.__UNSAFE_SIGN_NONSEGWIT = false;
}
}
setPropertyCheckSignatures(propName, value) {

@@ -137,2 +152,2 @@ if (this.tx[propName] === value) {

exports.ZcashPsbt = ZcashPsbt;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiWmNhc2hQc2J0Lmpz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JvcE5hbWU6IGtleW9mIFpjYXNoVHJhbnNhY3Rpb248YmlnaW50PiwgdmFsdWU6IHVua25vd24pIHtcbiAgICBpZiAodGhpcy50eFtwcm9wTmFtZV0gPT09IHZhbHVlKSB7XG4gICAgICByZXR1cm47XG4gICAgfVxuICAgIHRoaXMuY2hlY2tGb3JTaWduYXR1cmVzKHByb3BOYW1lKTtcbiAgICB0aGlzLnR4W3Byb3BOYW1lXSA9IHZhbHVlIGFzIGFueTtcbiAgfVxuXG4gIHNldENvbnNlbnN1c0JyYW5jaElkKGNvbnNlbnN1c0JyYW5jaElkOiBudW1iZXIpOiB2b2lkIHtcbiAgICB0eXBlZm9yY2UodHlwZXMuVUludDMyLCBjb25zZW5zdXNCcmFuY2hJZCk7XG4gICAgdGhpcy5zZXRQcm9wZXJ0eUNoZWNrU2lnbmF0dXJlcygnY29uc2Vuc3VzQnJhbmNoSWQnLCBjb25zZW5zdXNCcmFuY2hJZCk7XG4gIH1cblxuICBzZXRWZXJzaW9uR3JvdXBJZCh2ZXJzaW9uR3JvdXBJZDogbnVtYmVyKTogdm9pZCB7XG4gICAgdHlwZWZvcmNlKHR5cGVzLlVJbnQzMiwgdmVyc2lvbkdyb3VwSWQpO1xuICAgIHRoaXMuc2V0UHJvcGVydHlDaGVja1NpZ25hdHVyZXMoJ3ZlcnNpb25Hcm91cElkJywgdmVyc2lvbkdyb3VwSWQpO1xuICB9XG5cbiAgc2V0RXhwaXJ5SGVpZ2h0KGV4cGlyeUhlaWdodDogbnVtYmVyKTogdm9pZCB7XG4gICAgdHlwZWZvcmNlKHR5cGVzLlVJbnQzMiwgZXhwaXJ5SGVpZ2h0KTtcbiAgICB0aGlzLnNldFByb3BlcnR5Q2hlY2tTaWduYXR1cmVzKCdleHBpcnlIZWlnaHQnLCBleHBpcnlIZWlnaHQpO1xuICB9XG59XG4iXX0=
{
"name": "@bitgo-beta/utxo-lib",
"version": "4.0.1-alpha.18",
"version": "4.0.1-alpha.19",
"description": "Client-side Bitcoin JavaScript library",

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

"dependencies": {
"@bitgo-beta/blake2b": "3.2.1-alpha.18",
"@bitgo-beta/blake2b": "3.2.1-alpha.19",
"@noble/secp256k1": "1.6.3",
"bip174": "npm:@bitgo/bip174@3.0.0",
"bip174": "npm:@bitgo-forks/bip174@3.0.0-rc.1",
"bip32": "^3.0.1",
"bitcoin-ops": "^1.3.0",
"bitcoinjs-lib": "npm:@bitgo-forks/bitcoinjs-lib@7.0.0-rc.7",
"bitcoinjs-lib": "npm:@bitgo-forks/bitcoinjs-lib@7.1.0-master.2",
"bn.js": "^5.2.1",

@@ -85,3 +85,3 @@ "bs58check": "^2.1.2",

"license": "MIT",
"gitHead": "c23bdc490ff56808d70ae95906e73d5df3cc8fdc"
"gitHead": "06391d8184045ac259eb95397f93257c810b804d"
}

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

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