Fix TransactionBuilder types
This commit is contained in:
parent
1c24201a46
commit
d951423a35
2 changed files with 11 additions and 11 deletions
|
@ -134,8 +134,8 @@ export class TransactionBuilder {
|
||||||
addInput(
|
addInput(
|
||||||
txHash: Buffer | string | Transaction,
|
txHash: Buffer | string | Transaction,
|
||||||
vout: number,
|
vout: number,
|
||||||
sequence: number,
|
sequence?: number,
|
||||||
prevOutScript: Buffer,
|
prevOutScript?: Buffer,
|
||||||
): number {
|
): number {
|
||||||
if (!this.__canModifyInputs()) {
|
if (!this.__canModifyInputs()) {
|
||||||
throw new Error('No, this would invalidate signatures');
|
throw new Error('No, this would invalidate signatures');
|
||||||
|
@ -188,10 +188,10 @@ export class TransactionBuilder {
|
||||||
sign(
|
sign(
|
||||||
vin: number,
|
vin: number,
|
||||||
keyPair: ECPairInterface,
|
keyPair: ECPairInterface,
|
||||||
redeemScript: Buffer,
|
redeemScript?: Buffer,
|
||||||
hashType: number,
|
hashType?: number,
|
||||||
witnessValue: number,
|
witnessValue?: number,
|
||||||
witnessScript: Buffer,
|
witnessScript?: Buffer,
|
||||||
): void {
|
): void {
|
||||||
// TODO: remove keyPair.network matching in 4.0.0
|
// TODO: remove keyPair.network matching in 4.0.0
|
||||||
if (keyPair.network && keyPair.network !== this.network)
|
if (keyPair.network && keyPair.network !== this.network)
|
||||||
|
@ -267,7 +267,7 @@ export class TransactionBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
const signature = keyPair.sign(signatureHash);
|
const signature = keyPair.sign(signatureHash);
|
||||||
input.signatures![i] = bscript.signature.encode(signature, hashType);
|
input.signatures![i] = bscript.signature.encode(signature, hashType!);
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -679,8 +679,8 @@ function expandOutput(script: Buffer, ourPubKey?: Buffer): TxbOutput {
|
||||||
function prepareInput(
|
function prepareInput(
|
||||||
input: TxbInput,
|
input: TxbInput,
|
||||||
ourPubKey: Buffer,
|
ourPubKey: Buffer,
|
||||||
redeemScript: Buffer,
|
redeemScript?: Buffer,
|
||||||
witnessScript: Buffer,
|
witnessScript?: Buffer,
|
||||||
): TxbInput {
|
): TxbInput {
|
||||||
if (redeemScript && witnessScript) {
|
if (redeemScript && witnessScript) {
|
||||||
const p2wsh = payments.p2wsh({
|
const p2wsh = payments.p2wsh({
|
||||||
|
|
4
types/transaction_builder.d.ts
vendored
4
types/transaction_builder.d.ts
vendored
|
@ -12,11 +12,11 @@ export declare class TransactionBuilder {
|
||||||
constructor(network?: Network, maximumFeeRate?: number);
|
constructor(network?: Network, maximumFeeRate?: number);
|
||||||
setLockTime(locktime: number): void;
|
setLockTime(locktime: number): void;
|
||||||
setVersion(version: number): void;
|
setVersion(version: number): void;
|
||||||
addInput(txHash: Buffer | string | Transaction, vout: number, sequence: number, prevOutScript: Buffer): number;
|
addInput(txHash: Buffer | string | Transaction, vout: number, sequence?: number, prevOutScript?: Buffer): number;
|
||||||
addOutput(scriptPubKey: string | Buffer, value: number): number;
|
addOutput(scriptPubKey: string | Buffer, value: number): number;
|
||||||
build(): Transaction;
|
build(): Transaction;
|
||||||
buildIncomplete(): Transaction;
|
buildIncomplete(): Transaction;
|
||||||
sign(vin: number, keyPair: ECPairInterface, redeemScript: Buffer, hashType: number, witnessValue: number, witnessScript: Buffer): void;
|
sign(vin: number, keyPair: ECPairInterface, redeemScript?: Buffer, hashType?: number, witnessValue?: number, witnessScript?: Buffer): void;
|
||||||
private __addInputUnsafe;
|
private __addInputUnsafe;
|
||||||
private __build;
|
private __build;
|
||||||
private __canModifyInputs;
|
private __canModifyInputs;
|
||||||
|
|
Loading…
Reference in a new issue