Merge branch 'master' into issue_1477
This commit is contained in:
commit
16303115ac
7 changed files with 109 additions and 39 deletions
80
.github/workflows/main_ci.yml
vendored
Normal file
80
.github/workflows/main_ci.yml
vendored
Normal file
|
@ -0,0 +1,80 @@
|
||||||
|
name: Run Tests
|
||||||
|
|
||||||
|
on: [push]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
unit:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: 12
|
||||||
|
registry-url: https://registry.npmjs.org/
|
||||||
|
- run: npm ci
|
||||||
|
- run: npm run unit
|
||||||
|
coverage:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: 12
|
||||||
|
registry-url: https://registry.npmjs.org/
|
||||||
|
- run: npm ci
|
||||||
|
- run: npm run coverage
|
||||||
|
integration:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
services:
|
||||||
|
regtest:
|
||||||
|
image: junderw/bitcoinjs-regtest-server@sha256:a46ec1a651ca5b1a5408f2b2526ea5f435421dd2bc2f28fae3bc33e1fd614552
|
||||||
|
ports:
|
||||||
|
- 8080:8080
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: 12
|
||||||
|
registry-url: https://registry.npmjs.org/
|
||||||
|
- run: npm ci
|
||||||
|
- run: APIURL=http://127.0.0.1:8080/1 npm run integration
|
||||||
|
format:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: 12
|
||||||
|
registry-url: https://registry.npmjs.org/
|
||||||
|
- run: npm ci
|
||||||
|
- run: npm run format:ci
|
||||||
|
gitdiff:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: 12
|
||||||
|
registry-url: https://registry.npmjs.org/
|
||||||
|
- run: npm ci
|
||||||
|
- run: npm run gitdiff:ci
|
||||||
|
lint:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: 12
|
||||||
|
registry-url: https://registry.npmjs.org/
|
||||||
|
- run: npm ci
|
||||||
|
- run: npm run lint
|
||||||
|
lint-tests:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: 12
|
||||||
|
registry-url: https://registry.npmjs.org/
|
||||||
|
- run: npm ci
|
||||||
|
- run: npm run lint:tests
|
29
.travis.yml
29
.travis.yml
|
@ -1,29 +0,0 @@
|
||||||
sudo: false
|
|
||||||
language: node_js
|
|
||||||
services:
|
|
||||||
- docker
|
|
||||||
before_install:
|
|
||||||
- if [ $TEST_SUITE = "integration" ]; then
|
|
||||||
docker pull junderw/bitcoinjs-regtest-server &&
|
|
||||||
docker run -d -p 127.0.0.1:8080:8080 junderw/bitcoinjs-regtest-server &&
|
|
||||||
docker ps -a;
|
|
||||||
fi
|
|
||||||
node_js:
|
|
||||||
- "8"
|
|
||||||
- "lts/*"
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- node_js: "lts/*"
|
|
||||||
env: TEST_SUITE=format:ci
|
|
||||||
- node_js: "lts/*"
|
|
||||||
env: TEST_SUITE=gitdiff:ci
|
|
||||||
- node_js: "lts/*"
|
|
||||||
env: TEST_SUITE=lint
|
|
||||||
- node_js: "lts/*"
|
|
||||||
env: TEST_SUITE=lint:tests
|
|
||||||
- node_js: "lts/*"
|
|
||||||
env: TEST_SUITE=coverage
|
|
||||||
env:
|
|
||||||
- TEST_SUITE=unit
|
|
||||||
- TEST_SUITE=integration APIURL=http://127.0.0.1:8080/1
|
|
||||||
script: npm run-script $TEST_SUITE
|
|
|
@ -30,6 +30,7 @@ Mistakes and bugs happen, but with your help in resolving and reporting [issues]
|
||||||
## Documentation
|
## Documentation
|
||||||
Presently, we do not have any formal documentation other than our [examples](#examples), please [ask for help](https://github.com/bitcoinjs/bitcoinjs-lib/issues/new) if our examples aren't enough to guide you.
|
Presently, we do not have any formal documentation other than our [examples](#examples), please [ask for help](https://github.com/bitcoinjs/bitcoinjs-lib/issues/new) if our examples aren't enough to guide you.
|
||||||
|
|
||||||
|
You can find a [Web UI](https://bitcoincore.tech/apps/bitcoinjs-ui/index.html) that covers most of the `psbt.ts`, `transaction.ts` and `p2*.ts` APIs [here](https://bitcoincore.tech/apps/bitcoinjs-ui/index.html).
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
``` bash
|
``` bash
|
||||||
|
|
12
package-lock.json
generated
12
package-lock.json
generated
|
@ -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",
|
||||||
|
|
|
@ -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"
|
||||||
|
|
|
@ -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
11
types/psbt.d.ts
vendored
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue