Export PSBT getter types

This commit is contained in:
Luke Childs 2020-04-27 16:46:07 +07:00
commit de0bbf51e5
4 changed files with 22 additions and 9 deletions

View file

@ -9,7 +9,7 @@ import * as script from './script';
export { ECPair, address, bip32, crypto, networks, payments, script };
export { Block } from './block';
export { Psbt } from './psbt';
export { Psbt, PsbtTxInput, PsbtTxOutput } from './psbt';
export { OPS as opcodes } from './script';
export { Transaction } from './transaction';
export { TransactionBuilder } from './transaction_builder';

View file

@ -11,7 +11,6 @@ import {
Transaction as ITransaction,
TransactionFromBuffer,
TransactionInput,
TransactionOutput,
} from 'bip174/src/lib/interfaces';
import { checkForInput, checkForOutput } from 'bip174/src/lib/utils';
import { fromOutputScript, toOutputScript } from './address';
@ -27,6 +26,14 @@ import * as payments from './payments';
import * as bscript from './script';
import { Output, Transaction } from './transaction';
export interface PsbtTxInput extends TransactionInput {
hash: Buffer;
}
export interface PsbtTxOutput extends Output {
address: string;
}
/**
* These are the default arguments for a Psbt instance.
*/
@ -146,7 +153,7 @@ export class Psbt {
this.setLocktime(locktime);
}
get txInputs(): TransactionInput[] {
get txInputs(): PsbtTxInput[] {
return this.__CACHE.__TX.ins.map(input => ({
hash: cloneBuffer(input.hash),
index: input.index,
@ -154,7 +161,7 @@ export class Psbt {
}));
}
get txOutputs(): TransactionOutput[] {
get txOutputs(): PsbtTxOutput[] {
return this.__CACHE.__TX.outs.map(output => ({
script: cloneBuffer(output.script),
value: output.value,