Skip to content

Commit 1803b64

Browse files
authored
Merge pull request #1436 from bitcoinjs/fixNames
Fix names (Quick fix)
2 parents f75aebc + 3b44133 commit 1803b64

File tree

8 files changed

+27
-20
lines changed

8 files changed

+27
-20
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 5.1.1
2+
__changed__
3+
- Name inconsistencies for Psbt class. (Quick fix)
4+
15
# 5.1.0
26
__added__
37
- A new `Psbt` class for creating, distributing, combining, signing, and compiling Transactions (#1425)

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bitcoinjs-lib",
3-
"version": "5.1.0",
3+
"version": "5.1.1",
44
"description": "Client-side Bitcoin JavaScript library",
55
"main": "./src/index.js",
66
"types": "./types/index.d.ts",

src/psbt.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const DEFAULT_OPTS = {
4242
* data for updateOutput.
4343
* For a list of what attributes should be what types. Check the bip174 library.
4444
* Also, check the integration tests for some examples of usage.
45-
* Signer: There are a few methods. signAllInputs and signAsync, which will search all input
45+
* Signer: There are a few methods. signAllInputs and signAllInputsAsync, which will search all input
4646
* information for your pubkey or pubkeyhash, and only sign inputs where it finds
4747
* your info. Or you can explicitly sign a specific input with signInput and
4848
* signInputAsync. For the async methods you can create a SignerAsync object
@@ -295,7 +295,7 @@ class Psbt {
295295
}
296296
return this;
297297
}
298-
signHDAsync(
298+
signAllInputsHDAsync(
299299
hdKeyPair,
300300
sighashTypes = [transaction_1.Transaction.SIGHASH_ALL],
301301
) {
@@ -380,7 +380,10 @@ class Psbt {
380380
}
381381
return this;
382382
}
383-
signAsync(keyPair, sighashTypes = [transaction_1.Transaction.SIGHASH_ALL]) {
383+
signAllInputsAsync(
384+
keyPair,
385+
sighashTypes = [transaction_1.Transaction.SIGHASH_ALL],
386+
) {
384387
return new Promise((resolve, reject) => {
385388
if (!keyPair || !keyPair.publicKey)
386389
return reject(new Error('Need Signer to sign input'));

test/integration/transactions-psbt.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ describe('bitcoinjs-lib (transactions with psbt)', () => {
132132
signer2.signAllInputs(alice2.keys[0]);
133133

134134
// If your signer object's sign method returns a promise, use the following
135-
// await signer2.signAsync(alice2.keys[0])
135+
// await signer2.signAllInputsAsync(alice2.keys[0])
136136

137137
// encode to send back to combiner (signer 1 and 2 are not near each other)
138138
const s1text = signer1.toBase64();

test/psbt.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -219,14 +219,14 @@ describe(`Psbt`, () => {
219219
})
220220
})
221221

222-
describe('signAsync', () => {
222+
describe('signAllInputsAsync', () => {
223223
fixtures.signInput.checks.forEach(f => {
224224
if (f.description === 'checks the input exists') return
225225
it(f.description, async () => {
226226
if (f.shouldSign) {
227227
const psbtThatShouldsign = Psbt.fromBase64(f.shouldSign.psbt)
228228
assert.doesNotReject(async () => {
229-
await psbtThatShouldsign.signAsync(
229+
await psbtThatShouldsign.signAllInputsAsync(
230230
ECPair.fromWIF(f.shouldSign.WIF),
231231
f.shouldSign.sighashTypes || undefined,
232232
)
@@ -236,13 +236,13 @@ describe(`Psbt`, () => {
236236
if (f.shouldThrow) {
237237
const psbtThatShouldThrow = Psbt.fromBase64(f.shouldThrow.psbt)
238238
assert.rejects(async () => {
239-
await psbtThatShouldThrow.signAsync(
239+
await psbtThatShouldThrow.signAllInputsAsync(
240240
ECPair.fromWIF(f.shouldThrow.WIF),
241241
f.shouldThrow.sighashTypes || undefined,
242242
)
243243
}, new RegExp('No inputs were signed'))
244244
assert.rejects(async () => {
245-
await psbtThatShouldThrow.signAsync()
245+
await psbtThatShouldThrow.signAllInputsAsync()
246246
}, new RegExp('Need Signer to sign input'))
247247
}
248248
})
@@ -345,13 +345,13 @@ describe(`Psbt`, () => {
345345
})
346346
})
347347

348-
describe('signHDAsync', () => {
348+
describe('signAllInputsHDAsync', () => {
349349
fixtures.signInputHD.checks.forEach(f => {
350350
it(f.description, async () => {
351351
if (f.shouldSign) {
352352
const psbtThatShouldsign = Psbt.fromBase64(f.shouldSign.psbt)
353353
assert.doesNotReject(async () => {
354-
await psbtThatShouldsign.signHDAsync(
354+
await psbtThatShouldsign.signAllInputsHDAsync(
355355
bip32.fromBase58(f.shouldSign.xprv),
356356
f.shouldSign.sighashTypes || undefined,
357357
)
@@ -361,13 +361,13 @@ describe(`Psbt`, () => {
361361
if (f.shouldThrow) {
362362
const psbtThatShouldThrow = Psbt.fromBase64(f.shouldThrow.psbt)
363363
assert.rejects(async () => {
364-
await psbtThatShouldThrow.signHDAsync(
364+
await psbtThatShouldThrow.signAllInputsHDAsync(
365365
bip32.fromBase58(f.shouldThrow.xprv),
366366
f.shouldThrow.sighashTypes || undefined,
367367
)
368368
}, new RegExp('No inputs were signed'))
369369
assert.rejects(async () => {
370-
await psbtThatShouldThrow.signHDAsync()
370+
await psbtThatShouldThrow.signAllInputsHDAsync()
371371
}, new RegExp('Need HDSigner to sign input'))
372372
}
373373
})

ts_src/psbt.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ const DEFAULT_OPTS: PsbtOpts = {
5858
* data for updateOutput.
5959
* For a list of what attributes should be what types. Check the bip174 library.
6060
* Also, check the integration tests for some examples of usage.
61-
* Signer: There are a few methods. signAllInputs and signAsync, which will search all input
61+
* Signer: There are a few methods. signAllInputs and signAllInputsAsync, which will search all input
6262
* information for your pubkey or pubkeyhash, and only sign inputs where it finds
6363
* your info. Or you can explicitly sign a specific input with signInput and
6464
* signInputAsync. For the async methods you can create a SignerAsync object
@@ -351,7 +351,7 @@ export class Psbt {
351351
return this;
352352
}
353353

354-
signHDAsync(
354+
signAllInputsHDAsync(
355355
hdKeyPair: HDSigner | HDSignerAsync,
356356
sighashTypes: number[] = [Transaction.SIGHASH_ALL],
357357
): Promise<void> {
@@ -454,7 +454,7 @@ export class Psbt {
454454
return this;
455455
}
456456

457-
signAsync(
457+
signAllInputsAsync(
458458
keyPair: Signer | SignerAsync,
459459
sighashTypes: number[] = [Transaction.SIGHASH_ALL],
460460
): Promise<void> {

types/psbt.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { Transaction } from './transaction';
1919
* data for updateOutput.
2020
* For a list of what attributes should be what types. Check the bip174 library.
2121
* Also, check the integration tests for some examples of usage.
22-
* Signer: There are a few methods. signAllInputs and signAsync, which will search all input
22+
* Signer: There are a few methods. signAllInputs and signAllInputsAsync, which will search all input
2323
* information for your pubkey or pubkeyhash, and only sign inputs where it finds
2424
* your info. Or you can explicitly sign a specific input with signInput and
2525
* signInputAsync. For the async methods you can create a SignerAsync object
@@ -62,11 +62,11 @@ export declare class Psbt {
6262
validateSignaturesOfAllInputs(): boolean;
6363
validateSignaturesOfInput(inputIndex: number, pubkey?: Buffer): boolean;
6464
signAllInputsHD(hdKeyPair: HDSigner, sighashTypes?: number[]): this;
65-
signHDAsync(hdKeyPair: HDSigner | HDSignerAsync, sighashTypes?: number[]): Promise<void>;
65+
signAllInputsHDAsync(hdKeyPair: HDSigner | HDSignerAsync, sighashTypes?: number[]): Promise<void>;
6666
signInputHD(inputIndex: number, hdKeyPair: HDSigner, sighashTypes?: number[]): this;
6767
signInputHDAsync(inputIndex: number, hdKeyPair: HDSigner | HDSignerAsync, sighashTypes?: number[]): Promise<void>;
6868
signAllInputs(keyPair: Signer, sighashTypes?: number[]): this;
69-
signAsync(keyPair: Signer | SignerAsync, sighashTypes?: number[]): Promise<void>;
69+
signAllInputsAsync(keyPair: Signer | SignerAsync, sighashTypes?: number[]): Promise<void>;
7070
signInput(inputIndex: number, keyPair: Signer, sighashTypes?: number[]): this;
7171
signInputAsync(inputIndex: number, keyPair: Signer | SignerAsync, sighashTypes?: number[]): Promise<void>;
7272
toBuffer(): Buffer;

0 commit comments

Comments
 (0)