{in,out}puts => tx{In,Out}puts

This commit is contained in:
Luke Childs 2020-04-26 18:07:09 +07:00
parent 6c616bff78
commit e7345d5446
4 changed files with 8 additions and 8 deletions

View file

@ -109,7 +109,7 @@ class Psbt {
set locktime(locktime) {
this.setLocktime(locktime);
}
get inputs() {
get txInputs() {
return this.__CACHE.__TX.ins.map(input => ({
hash: bufferutils_1.cloneBuffer(input.hash),
index: input.index,
@ -118,7 +118,7 @@ class Psbt {
witness: input.witness.map(buffer => bufferutils_1.cloneBuffer(buffer)),
}));
}
get outputs() {
get txOutputs() {
return this.__CACHE.__TX.outs.map(output => ({
script: bufferutils_1.cloneBuffer(output.script),
value: output.value,

View file

@ -523,9 +523,9 @@ describe(`Psbt`, () => {
});
assert.strictEqual(psbt.inputCount, 1);
assert.strictEqual(psbt.inputs[0].sequence, 0xffffffff);
assert.strictEqual(psbt.txInputs[0].sequence, 0xffffffff);
psbt.setInputSequence(0, 0);
assert.strictEqual(psbt.inputs[0].sequence, 0);
assert.strictEqual(psbt.txInputs[0].sequence, 0);
});
it('throws if input index is too high', () => {

View file

@ -145,7 +145,7 @@ export class Psbt {
this.setLocktime(locktime);
}
get inputs(): Input[] {
get txInputs(): Input[] {
return this.__CACHE.__TX.ins.map(input => ({
hash: cloneBuffer(input.hash),
index: input.index,
@ -155,7 +155,7 @@ export class Psbt {
}));
}
get outputs(): Output[] {
get txOutputs(): Output[] {
return this.__CACHE.__TX.outs.map(output => ({
script: cloneBuffer(output.script),
value: output.value,

4
types/psbt.d.ts vendored
View file

@ -46,8 +46,8 @@ export declare class Psbt {
readonly inputCount: number;
version: number;
locktime: number;
readonly inputs: Input[];
readonly outputs: Output[];
readonly txInputs: Input[];
readonly txOutputs: Output[];
combine(...those: Psbt[]): this;
clone(): Psbt;
setMaximumFeeRate(satoshiPerByte: number): void;