Merge pull request #1656 from bitcoincoretech/issue_1470b

#1470 Bring over TransactionInput & TransactionOutputfrom BIP174; update tiny-secp256k1 to v1.1.5
This commit is contained in:
Jonathan Underwood 2021-02-04 14:10:28 +09:00 committed by GitHub
commit 9267387206
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 10 deletions

12
package-lock.json generated
View file

@ -1495,9 +1495,9 @@
"dev": true "dev": true
}, },
"nan": { "nan": {
"version": "2.14.0", "version": "2.14.2",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz", "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.2.tgz",
"integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==" "integrity": "sha512-M2ufzIiINKCuDfBSAUr1vWQ+vuVcA9kqx8JJUsbQi6yf1uGRyb7HfpdfUr5qLXf3B/t8dPvcjhKMmlfnP47EzQ=="
}, },
"node-environment-flags": { "node-environment-flags": {
"version": "1.0.6", "version": "1.0.6",
@ -2246,9 +2246,9 @@
} }
}, },
"tiny-secp256k1": { "tiny-secp256k1": {
"version": "1.1.1", "version": "1.1.6",
"resolved": "https://registry.npmjs.org/tiny-secp256k1/-/tiny-secp256k1-1.1.1.tgz", "resolved": "https://registry.npmjs.org/tiny-secp256k1/-/tiny-secp256k1-1.1.6.tgz",
"integrity": "sha512-jA9WalQuhKun1svJrAVi9Vu8aUWKMfR7nMV903kHjrHTTY/IFa0petSq+Jk/Mv447dGD9LC8fGsmGRubBbcNng==", "integrity": "sha512-FmqJZGduTyvsr2cF3375fqGHUovSwDi/QytexX1Se4BPuPZpTE5Ftp5fg+EFSuEf3lhZqgCRjEG3ydUQ/aNiwA==",
"requires": { "requires": {
"bindings": "^1.3.0", "bindings": "^1.3.0",
"bn.js": "^4.11.8", "bn.js": "^4.11.8",

View file

@ -60,7 +60,7 @@
"merkle-lib": "^2.0.10", "merkle-lib": "^2.0.10",
"pushdata-bitcoin": "^1.0.1", "pushdata-bitcoin": "^1.0.1",
"randombytes": "^2.0.1", "randombytes": "^2.0.1",
"tiny-secp256k1": "^1.1.1", "tiny-secp256k1": "^1.1.6",
"typeforce": "^1.11.3", "typeforce": "^1.11.3",
"varuint-bitcoin": "^1.0.4", "varuint-bitcoin": "^1.0.4",
"wif": "^2.0.1" "wif": "^2.0.1"

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;
} }