Don't expose witness on Psbt.txInputs
This commit is contained in:
parent
e7345d5446
commit
2d4a3b9354
3 changed files with 8 additions and 9 deletions
|
@ -115,7 +115,6 @@ class Psbt {
|
||||||
index: input.index,
|
index: input.index,
|
||||||
script: bufferutils_1.cloneBuffer(input.script),
|
script: bufferutils_1.cloneBuffer(input.script),
|
||||||
sequence: input.sequence,
|
sequence: input.sequence,
|
||||||
witness: input.witness.map(buffer => bufferutils_1.cloneBuffer(buffer)),
|
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
get txOutputs() {
|
get txOutputs() {
|
||||||
|
|
|
@ -11,6 +11,7 @@ import {
|
||||||
Transaction as ITransaction,
|
Transaction as ITransaction,
|
||||||
TransactionFromBuffer,
|
TransactionFromBuffer,
|
||||||
TransactionInput,
|
TransactionInput,
|
||||||
|
TransactionOutput,
|
||||||
} from 'bip174/src/lib/interfaces';
|
} from 'bip174/src/lib/interfaces';
|
||||||
import { checkForInput } from 'bip174/src/lib/utils';
|
import { checkForInput } from 'bip174/src/lib/utils';
|
||||||
import { fromOutputScript, toOutputScript } from './address';
|
import { fromOutputScript, toOutputScript } from './address';
|
||||||
|
@ -24,7 +25,7 @@ import {
|
||||||
import { bitcoin as btcNetwork, Network } from './networks';
|
import { bitcoin as btcNetwork, Network } from './networks';
|
||||||
import * as payments from './payments';
|
import * as payments from './payments';
|
||||||
import * as bscript from './script';
|
import * as bscript from './script';
|
||||||
import { Input, Output, Transaction } from './transaction';
|
import { Output, Transaction } from './transaction';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* These are the default arguments for a Psbt instance.
|
* These are the default arguments for a Psbt instance.
|
||||||
|
@ -145,17 +146,16 @@ export class Psbt {
|
||||||
this.setLocktime(locktime);
|
this.setLocktime(locktime);
|
||||||
}
|
}
|
||||||
|
|
||||||
get txInputs(): Input[] {
|
get txInputs(): TransactionInput[] {
|
||||||
return this.__CACHE.__TX.ins.map(input => ({
|
return this.__CACHE.__TX.ins.map(input => ({
|
||||||
hash: cloneBuffer(input.hash),
|
hash: cloneBuffer(input.hash),
|
||||||
index: input.index,
|
index: input.index,
|
||||||
script: cloneBuffer(input.script),
|
script: cloneBuffer(input.script),
|
||||||
sequence: input.sequence,
|
sequence: input.sequence,
|
||||||
witness: input.witness.map(buffer => cloneBuffer(buffer)),
|
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
get txOutputs(): Output[] {
|
get txOutputs(): TransactionOutput[] {
|
||||||
return this.__CACHE.__TX.outs.map(output => ({
|
return this.__CACHE.__TX.outs.map(output => ({
|
||||||
script: cloneBuffer(output.script),
|
script: cloneBuffer(output.script),
|
||||||
value: output.value,
|
value: output.value,
|
||||||
|
|
8
types/psbt.d.ts
vendored
8
types/psbt.d.ts
vendored
|
@ -1,8 +1,8 @@
|
||||||
import { Psbt as PsbtBase } from 'bip174';
|
import { Psbt as PsbtBase } from 'bip174';
|
||||||
import { KeyValue, PsbtGlobalUpdate, PsbtInput, PsbtInputUpdate, PsbtOutput, PsbtOutputUpdate, TransactionInput } from 'bip174/src/lib/interfaces';
|
import { KeyValue, PsbtGlobalUpdate, PsbtInput, PsbtInputUpdate, PsbtOutput, PsbtOutputUpdate, TransactionInput, TransactionOutput } from 'bip174/src/lib/interfaces';
|
||||||
import { Signer, SignerAsync } from './ecpair';
|
import { Signer, SignerAsync } from './ecpair';
|
||||||
import { Network } from './networks';
|
import { Network } from './networks';
|
||||||
import { Input, Output, Transaction } from './transaction';
|
import { Transaction } from './transaction';
|
||||||
/**
|
/**
|
||||||
* Psbt class can parse and generate a PSBT binary based off of the BIP174.
|
* Psbt class can parse and generate a PSBT binary based off of the BIP174.
|
||||||
* There are 6 roles that this class fulfills. (Explained in BIP174)
|
* There are 6 roles that this class fulfills. (Explained in BIP174)
|
||||||
|
@ -46,8 +46,8 @@ export declare class Psbt {
|
||||||
readonly inputCount: number;
|
readonly inputCount: number;
|
||||||
version: number;
|
version: number;
|
||||||
locktime: number;
|
locktime: number;
|
||||||
readonly txInputs: Input[];
|
readonly txInputs: TransactionInput[];
|
||||||
readonly txOutputs: Output[];
|
readonly txOutputs: TransactionOutput[];
|
||||||
combine(...those: Psbt[]): this;
|
combine(...those: Psbt[]): this;
|
||||||
clone(): Psbt;
|
clone(): Psbt;
|
||||||
setMaximumFeeRate(satoshiPerByte: number): void;
|
setMaximumFeeRate(satoshiPerByte: number): void;
|
||||||
|
|
Loading…
Add table
Reference in a new issue