Export PSBT getter types
This commit is contained in:
parent
361ea7c098
commit
de0bbf51e5
4 changed files with 22 additions and 9 deletions
|
@ -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';
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue