Merge pull request #1436 from bitcoinjs/fixNames

Fix names (Quick fix)
This commit is contained in:
Jonathan Underwood 2019-07-19 17:26:53 +09:00 committed by GitHub
commit 1803b64f61
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 27 additions and 20 deletions

View file

@ -1,3 +1,7 @@
# 5.1.1
__changed__
- Name inconsistencies for Psbt class. (Quick fix)
# 5.1.0
__added__
- A new `Psbt` class for creating, distributing, combining, signing, and compiling Transactions (#1425)

2
package-lock.json generated
View file

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

View file

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

View file

@ -42,7 +42,7 @@ const DEFAULT_OPTS = {
* data for updateOutput.
* For a list of what attributes should be what types. Check the bip174 library.
* Also, check the integration tests for some examples of usage.
* Signer: There are a few methods. signAllInputs and signAsync, which will search all input
* Signer: There are a few methods. signAllInputs and signAllInputsAsync, which will search all input
* information for your pubkey or pubkeyhash, and only sign inputs where it finds
* your info. Or you can explicitly sign a specific input with signInput and
* signInputAsync. For the async methods you can create a SignerAsync object
@ -295,7 +295,7 @@ class Psbt {
}
return this;
}
signHDAsync(
signAllInputsHDAsync(
hdKeyPair,
sighashTypes = [transaction_1.Transaction.SIGHASH_ALL],
) {
@ -380,7 +380,10 @@ class Psbt {
}
return this;
}
signAsync(keyPair, sighashTypes = [transaction_1.Transaction.SIGHASH_ALL]) {
signAllInputsAsync(
keyPair,
sighashTypes = [transaction_1.Transaction.SIGHASH_ALL],
) {
return new Promise((resolve, reject) => {
if (!keyPair || !keyPair.publicKey)
return reject(new Error('Need Signer to sign input'));

View file

@ -132,7 +132,7 @@ describe('bitcoinjs-lib (transactions with psbt)', () => {
signer2.signAllInputs(alice2.keys[0]);
// If your signer object's sign method returns a promise, use the following
// await signer2.signAsync(alice2.keys[0])
// await signer2.signAllInputsAsync(alice2.keys[0])
// encode to send back to combiner (signer 1 and 2 are not near each other)
const s1text = signer1.toBase64();

View file

@ -219,14 +219,14 @@ describe(`Psbt`, () => {
})
})
describe('signAsync', () => {
describe('signAllInputsAsync', () => {
fixtures.signInput.checks.forEach(f => {
if (f.description === 'checks the input exists') return
it(f.description, async () => {
if (f.shouldSign) {
const psbtThatShouldsign = Psbt.fromBase64(f.shouldSign.psbt)
assert.doesNotReject(async () => {
await psbtThatShouldsign.signAsync(
await psbtThatShouldsign.signAllInputsAsync(
ECPair.fromWIF(f.shouldSign.WIF),
f.shouldSign.sighashTypes || undefined,
)
@ -236,13 +236,13 @@ describe(`Psbt`, () => {
if (f.shouldThrow) {
const psbtThatShouldThrow = Psbt.fromBase64(f.shouldThrow.psbt)
assert.rejects(async () => {
await psbtThatShouldThrow.signAsync(
await psbtThatShouldThrow.signAllInputsAsync(
ECPair.fromWIF(f.shouldThrow.WIF),
f.shouldThrow.sighashTypes || undefined,
)
}, new RegExp('No inputs were signed'))
assert.rejects(async () => {
await psbtThatShouldThrow.signAsync()
await psbtThatShouldThrow.signAllInputsAsync()
}, new RegExp('Need Signer to sign input'))
}
})
@ -345,13 +345,13 @@ describe(`Psbt`, () => {
})
})
describe('signHDAsync', () => {
describe('signAllInputsHDAsync', () => {
fixtures.signInputHD.checks.forEach(f => {
it(f.description, async () => {
if (f.shouldSign) {
const psbtThatShouldsign = Psbt.fromBase64(f.shouldSign.psbt)
assert.doesNotReject(async () => {
await psbtThatShouldsign.signHDAsync(
await psbtThatShouldsign.signAllInputsHDAsync(
bip32.fromBase58(f.shouldSign.xprv),
f.shouldSign.sighashTypes || undefined,
)
@ -361,13 +361,13 @@ describe(`Psbt`, () => {
if (f.shouldThrow) {
const psbtThatShouldThrow = Psbt.fromBase64(f.shouldThrow.psbt)
assert.rejects(async () => {
await psbtThatShouldThrow.signHDAsync(
await psbtThatShouldThrow.signAllInputsHDAsync(
bip32.fromBase58(f.shouldThrow.xprv),
f.shouldThrow.sighashTypes || undefined,
)
}, new RegExp('No inputs were signed'))
assert.rejects(async () => {
await psbtThatShouldThrow.signHDAsync()
await psbtThatShouldThrow.signAllInputsHDAsync()
}, new RegExp('Need HDSigner to sign input'))
}
})

View file

@ -58,7 +58,7 @@ const DEFAULT_OPTS: PsbtOpts = {
* data for updateOutput.
* For a list of what attributes should be what types. Check the bip174 library.
* Also, check the integration tests for some examples of usage.
* Signer: There are a few methods. signAllInputs and signAsync, which will search all input
* Signer: There are a few methods. signAllInputs and signAllInputsAsync, which will search all input
* information for your pubkey or pubkeyhash, and only sign inputs where it finds
* your info. Or you can explicitly sign a specific input with signInput and
* signInputAsync. For the async methods you can create a SignerAsync object
@ -351,7 +351,7 @@ export class Psbt {
return this;
}
signHDAsync(
signAllInputsHDAsync(
hdKeyPair: HDSigner | HDSignerAsync,
sighashTypes: number[] = [Transaction.SIGHASH_ALL],
): Promise<void> {
@ -454,7 +454,7 @@ export class Psbt {
return this;
}
signAsync(
signAllInputsAsync(
keyPair: Signer | SignerAsync,
sighashTypes: number[] = [Transaction.SIGHASH_ALL],
): Promise<void> {

6
types/psbt.d.ts vendored
View file

@ -19,7 +19,7 @@ import { Transaction } from './transaction';
* data for updateOutput.
* For a list of what attributes should be what types. Check the bip174 library.
* Also, check the integration tests for some examples of usage.
* Signer: There are a few methods. signAllInputs and signAsync, which will search all input
* Signer: There are a few methods. signAllInputs and signAllInputsAsync, which will search all input
* information for your pubkey or pubkeyhash, and only sign inputs where it finds
* your info. Or you can explicitly sign a specific input with signInput and
* signInputAsync. For the async methods you can create a SignerAsync object
@ -62,11 +62,11 @@ export declare class Psbt {
validateSignaturesOfAllInputs(): boolean;
validateSignaturesOfInput(inputIndex: number, pubkey?: Buffer): boolean;
signAllInputsHD(hdKeyPair: HDSigner, sighashTypes?: number[]): this;
signHDAsync(hdKeyPair: HDSigner | HDSignerAsync, sighashTypes?: number[]): Promise<void>;
signAllInputsHDAsync(hdKeyPair: HDSigner | HDSignerAsync, sighashTypes?: number[]): Promise<void>;
signInputHD(inputIndex: number, hdKeyPair: HDSigner, sighashTypes?: number[]): this;
signInputHDAsync(inputIndex: number, hdKeyPair: HDSigner | HDSignerAsync, sighashTypes?: number[]): Promise<void>;
signAllInputs(keyPair: Signer, sighashTypes?: number[]): this;
signAsync(keyPair: Signer | SignerAsync, sighashTypes?: number[]): Promise<void>;
signAllInputsAsync(keyPair: Signer | SignerAsync, sighashTypes?: number[]): Promise<void>;
signInput(inputIndex: number, keyPair: Signer, sighashTypes?: number[]): this;
signInputAsync(inputIndex: number, keyPair: Signer | SignerAsync, sighashTypes?: number[]): Promise<void>;
toBuffer(): Buffer;