Fix PsbtOutputExtended address support

This commit is contained in:
junderw 2019-09-02 18:41:31 +09:00
parent 07a2769949
commit d2d368b8cd
No known key found for this signature in database
GPG key ID: B256185D3A971908
2 changed files with 20 additions and 4 deletions

View file

@ -11,7 +11,6 @@ import {
Transaction as ITransaction,
TransactionFromBuffer,
TransactionInput,
TransactionOutput,
} from 'bip174/src/lib/interfaces';
import { checkForInput } from 'bip174/src/lib/utils';
import { toOutputScript } from './address';
@ -624,7 +623,17 @@ interface PsbtOpts {
interface PsbtInputExtended extends PsbtInput, TransactionInput {}
interface PsbtOutputExtended extends PsbtOutput, TransactionOutput {}
type PsbtOutputExtended = PsbtOutputExtendedAddress | PsbtOutputExtendedScript;
interface PsbtOutputExtendedAddress extends PsbtOutput {
address: string;
value: number;
}
interface PsbtOutputExtendedScript extends PsbtOutput {
script: Buffer;
value: number;
}
interface HDSignerBase {
/**

11
types/psbt.d.ts vendored
View file

@ -1,6 +1,6 @@
/// <reference types="node" />
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, TransactionInput } from 'bip174/src/lib/interfaces';
import { Signer, SignerAsync } from './ecpair';
import { Network } from './networks';
import { Transaction } from './transaction';
@ -87,7 +87,14 @@ interface PsbtOptsOptional {
}
interface PsbtInputExtended extends PsbtInput, TransactionInput {
}
interface PsbtOutputExtended extends PsbtOutput, TransactionOutput {
declare type PsbtOutputExtended = PsbtOutputExtendedAddress | PsbtOutputExtendedScript;
interface PsbtOutputExtendedAddress extends PsbtOutput {
address: string;
value: number;
}
interface PsbtOutputExtendedScript extends PsbtOutput {
script: Buffer;
value: number;
}
interface HDSignerBase {
/**