#1470 Bring over TransactionInput & TransactionOutputfrom BIP174

This commit is contained in:
Vlad Stan 2020-11-26 19:23:01 +02:00
parent 533d6c2e6d
commit 6661e3d5c4
2 changed files with 21 additions and 3 deletions

View file

@ -11,8 +11,6 @@ import {
PsbtOutputUpdate, PsbtOutputUpdate,
Transaction as ITransaction, Transaction as ITransaction,
TransactionFromBuffer, TransactionFromBuffer,
TransactionInput,
TransactionOutput,
} from 'bip174/src/lib/interfaces'; } from 'bip174/src/lib/interfaces';
import { checkForInput, checkForOutput } from 'bip174/src/lib/utils'; import { checkForInput, checkForOutput } from 'bip174/src/lib/utils';
import { fromOutputScript, toOutputScript } from './address'; import { fromOutputScript, toOutputScript } from './address';
@ -28,10 +26,21 @@ import * as payments from './payments';
import * as bscript from './script'; import * as bscript from './script';
import { Output, Transaction } from './transaction'; import { Output, Transaction } from './transaction';
export interface TransactionInput {
hash: string | Buffer;
index: number;
sequence?: number;
}
export interface PsbtTxInput extends TransactionInput { export interface PsbtTxInput extends TransactionInput {
hash: Buffer; hash: Buffer;
} }
export interface TransactionOutput {
script: Buffer;
value: number;
}
export interface PsbtTxOutput extends TransactionOutput { export interface PsbtTxOutput extends TransactionOutput {
address: string | undefined; address: string | undefined;
} }

11
types/psbt.d.ts vendored
View file

@ -1,11 +1,20 @@
import { Psbt as PsbtBase } from 'bip174'; import { Psbt as PsbtBase } from 'bip174';
import { KeyValue, PsbtGlobalUpdate, PsbtInput, PsbtInputUpdate, PsbtOutput, PsbtOutputUpdate, TransactionInput, TransactionOutput } from 'bip174/src/lib/interfaces'; import { KeyValue, PsbtGlobalUpdate, PsbtInput, PsbtInputUpdate, PsbtOutput, PsbtOutputUpdate } from 'bip174/src/lib/interfaces';
import { Signer, SignerAsync } from './ecpair'; import { Signer, SignerAsync } from './ecpair';
import { Network } from './networks'; import { Network } from './networks';
import { Transaction } from './transaction'; import { Transaction } from './transaction';
export interface TransactionInput {
hash: string | Buffer;
index: number;
sequence?: number;
}
export interface PsbtTxInput extends TransactionInput { export interface PsbtTxInput extends TransactionInput {
hash: Buffer; hash: Buffer;
} }
export interface TransactionOutput {
script: Buffer;
value: number;
}
export interface PsbtTxOutput extends TransactionOutput { export interface PsbtTxOutput extends TransactionOutput {
address: string | undefined; address: string | undefined;
} }