Browse Source

Merge pull request #1469 from bitcoinjs/fixPsbt

Fix PsbtOutputExtended address support
psbt-tx-getters
Jonathan Underwood 6 years ago
committed by GitHub
parent
commit
e2dea8289a
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      CHANGELOG.md
  2. 2
      package-lock.json
  3. 2
      package.json
  4. 13
      ts_src/psbt.ts
  5. 11
      types/psbt.d.ts

4
CHANGELOG.md

@ -1,3 +1,7 @@
# 5.1.6
__fixed__
- `PsbtOutputExtended` did not support using the address attribute properly. It is now fixed.
# 5.1.5
__added__
- `Psbt` now has `getFee(): number` for use when all inputs are finalized. It returns the satoshi fee of the transaction. Calling getFee, getFeeRate, or extractTransaction will cache these values so if you call one after the other, the second call will return immediately.

2
package-lock.json

@ -1,6 +1,6 @@
{
"name": "bitcoinjs-lib",
"version": "5.1.5",
"version": "5.1.6",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

2
package.json

@ -1,6 +1,6 @@
{
"name": "bitcoinjs-lib",
"version": "5.1.5",
"version": "5.1.6",
"description": "Client-side Bitcoin JavaScript library",
"main": "./src/index.js",
"types": "./types/index.d.ts",

13
ts_src/psbt.ts

@ -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

@ -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 {
/**

Loading…
Cancel
Save