Comparing version 0.0.13 to 0.0.14
{ | ||
"name": "bip174", | ||
"version": "0.0.13", | ||
"version": "0.0.14", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "src/lib/psbt.js", |
@@ -9,3 +9,3 @@ 'use strict'; | ||
throw new Error( | ||
'Decode Error: could not decode redeemScript with key 0x' + | ||
'Decode Error: could not decode unsignedTx with key 0x' + | ||
keyVal.key.toString('hex'), | ||
@@ -12,0 +12,0 @@ ); |
/// <reference types="node" /> | ||
import * as globalXpub from './global/globalXpub'; | ||
import * as unsignedTx from './global/unsignedTx'; | ||
@@ -12,2 +13,3 @@ import * as finalScriptSig from './input/finalScriptSig'; | ||
unsignedTx: typeof unsignedTx; | ||
globalXpub: typeof globalXpub; | ||
checkPubkey: (keyVal: import("../interfaces").KeyValue) => Buffer | undefined; | ||
@@ -14,0 +16,0 @@ }; |
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
const typeFields_1 = require('../typeFields'); | ||
const globalXpub = require('./global/globalXpub'); | ||
const unsignedTx = require('./global/unsignedTx'); | ||
@@ -18,2 +19,3 @@ const finalScriptSig = require('./input/finalScriptSig'); | ||
unsignedTx, | ||
globalXpub, | ||
// pass an Array of key bytes that require pubkey beside the key | ||
@@ -20,0 +22,0 @@ checkPubkey: checkPubkey.makeChecker([]), |
@@ -9,2 +9,3 @@ /// <reference types="node" /> | ||
unsignedTx?: UnsignedTx; | ||
globalXpub?: GlobalXpub; | ||
} | ||
@@ -31,2 +32,8 @@ export interface PsbtInput { | ||
export declare type UnsignedTx = Buffer; | ||
export interface GlobalXpub { | ||
extendedPubkey: Buffer; | ||
masterFingerprint: Buffer; | ||
path: string; | ||
} | ||
export declare function isGlobalXpub(data: any): data is GlobalXpub; | ||
export interface PartialSig { | ||
@@ -33,0 +40,0 @@ pubkey: Buffer; |
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
function isGlobalXpub(data) { | ||
return ( | ||
Buffer.isBuffer(data.extendedPubkey) && | ||
Buffer.isBuffer(data.masterFingerprint) && | ||
typeof data.path === 'string' && | ||
data.extendedPubkey.length === 78 && | ||
[2, 3].includes(data.extendedPubkey[45]) && | ||
data.masterFingerprint.length === 4 | ||
); | ||
} | ||
exports.isGlobalXpub = isGlobalXpub; | ||
function isPartialSig(data) { | ||
@@ -4,0 +15,0 @@ return ( |
@@ -150,2 +150,5 @@ 'use strict'; | ||
break; | ||
case typeFields_1.GlobalTypes.GLOBAL_XPUB: | ||
globalMap.globalXpub = convert.globals.globalXpub.decode(keyVal); | ||
break; | ||
default: | ||
@@ -152,0 +155,0 @@ // This will allow inclusion during serialization. |
/// <reference types="node" /> | ||
import { Bip32Derivation, FinalScriptSig, FinalScriptWitness, KeyValue, NonWitnessUtxo, PartialSig, PorCommitment, PsbtGlobal, PsbtInput, PsbtOutput, RedeemScript, SighashType, TransactionInput, TransactionIOCountGetter, TransactionLocktimeSetter, TransactionOutput, TransactionVersionSetter, WitnessScript, WitnessUtxo } from './interfaces'; | ||
import { Bip32Derivation, FinalScriptSig, FinalScriptWitness, GlobalXpub, KeyValue, NonWitnessUtxo, PartialSig, PorCommitment, PsbtGlobal, PsbtInput, PsbtOutput, RedeemScript, SighashType, TransactionInput, TransactionIOCountGetter, TransactionLocktimeSetter, TransactionOutput, TransactionVersionSetter, WitnessScript, WitnessUtxo } from './interfaces'; | ||
export declare class Psbt { | ||
@@ -17,2 +17,3 @@ static fromTransaction<T extends typeof Psbt>(this: T, txBuf: Buffer, txCountGetter?: TransactionIOCountGetter): InstanceType<T>; | ||
setLocktime(locktime: number, transactionLocktimeSetter?: TransactionLocktimeSetter): this; | ||
addGlobalXpubToGlobal(globalXpub: GlobalXpub): this; | ||
addNonWitnessUtxoToInput(inputIndex: number, nonWitnessUtxo: NonWitnessUtxo): this; | ||
@@ -19,0 +20,0 @@ addWitnessUtxoToInput(inputIndex: number, witnessUtxo: WitnessUtxo): this; |
@@ -91,2 +91,12 @@ 'use strict'; | ||
} | ||
addGlobalXpubToGlobal(globalXpub) { | ||
if (!interfaces_1.isGlobalXpub(globalXpub)) { | ||
throw new Error( | ||
'globalXpub should be { masterFingerprint: Buffer; extendedPubkey: ' + | ||
'Buffer; path: string; }', | ||
); | ||
} | ||
this.globalMap.globalXpub = globalXpub; | ||
return this; | ||
} | ||
addNonWitnessUtxoToInput(inputIndex, nonWitnessUtxo) { | ||
@@ -93,0 +103,0 @@ const input = utils_1.checkForInput(this.inputs, inputIndex); |
export declare enum GlobalTypes { | ||
UNSIGNED_TX = 0 | ||
UNSIGNED_TX = 0, | ||
GLOBAL_XPUB = 1 | ||
} | ||
@@ -4,0 +5,0 @@ export declare const GLOBAL_TYPE_NAMES: string[]; |
@@ -6,4 +6,5 @@ 'use strict'; | ||
GlobalTypes[(GlobalTypes['UNSIGNED_TX'] = 0)] = 'UNSIGNED_TX'; | ||
GlobalTypes[(GlobalTypes['GLOBAL_XPUB'] = 1)] = 'GLOBAL_XPUB'; | ||
})((GlobalTypes = exports.GlobalTypes || (exports.GlobalTypes = {}))); | ||
exports.GLOBAL_TYPE_NAMES = ['unsignedTx']; | ||
exports.GLOBAL_TYPE_NAMES = ['unsignedTx', 'globalXpub']; | ||
var InputTypes; | ||
@@ -10,0 +11,0 @@ (function(InputTypes) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
82814
51
2202