Improve property names

This commit is contained in:
Luke Childs 2020-04-26 15:34:11 +07:00
parent f7034350e9
commit c68986231c
4 changed files with 14 additions and 14 deletions

View file

@ -97,13 +97,13 @@ class Psbt {
get inputCount() {
return this.data.inputs.length;
}
get txVersion() {
get version() {
return this.__CACHE.__TX.version;
}
get txLocktime() {
get locktime() {
return this.__CACHE.__TX.locktime;
}
get txInputs() {
get inputs() {
return this.__CACHE.__TX.ins.map(input => {
return {
hash: bufferutils_1.cloneBuffer(input.hash),
@ -114,7 +114,7 @@ class Psbt {
};
});
}
get txOutputs() {
get outputs() {
return this.__CACHE.__TX.outs.map(output => {
return {
script: bufferutils_1.cloneBuffer(output.script),

View file

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

View file

@ -129,15 +129,15 @@ export class Psbt {
return this.data.inputs.length;
}
get txVersion(): number {
get version(): number {
return this.__CACHE.__TX.version;
}
get txLocktime(): number {
get locktime(): number {
return this.__CACHE.__TX.locktime;
}
get txInputs(): Input[] {
get inputs(): Input[] {
return this.__CACHE.__TX.ins.map(input => {
return {
hash: cloneBuffer(input.hash),
@ -149,7 +149,7 @@ export class Psbt {
});
}
get txOutputs(): Output[] {
get outputs(): Output[] {
return this.__CACHE.__TX.outs.map(output => {
return {
script: cloneBuffer(output.script),

8
types/psbt.d.ts vendored
View file

@ -44,10 +44,10 @@ export declare class Psbt {
private opts;
constructor(opts?: PsbtOptsOptional, data?: PsbtBase);
readonly inputCount: number;
readonly txVersion: number;
readonly txLocktime: number;
readonly txInputs: Input[];
readonly txOutputs: Output[];
readonly version: number;
readonly locktime: number;
readonly inputs: Input[];
readonly outputs: Output[];
combine(...those: Psbt[]): this;
clone(): Psbt;
setMaximumFeeRate(satoshiPerByte: number): void;