Merge pull request #1578 from bitcoinjs/psbt-nonstandard-output-fix
Handle non-standard output types in Psbt.txOutputs
This commit is contained in:
commit
9e2a8fe45a
5 changed files with 28 additions and 12 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
# 5.1.9
|
||||||
|
__fixed__
|
||||||
|
- Fixed errors for psbt.txOutputs getter (#1578)
|
||||||
|
|
||||||
# 5.1.8
|
# 5.1.8
|
||||||
__fixed__
|
__fixed__
|
||||||
- Throw errors when p2wsh or p2wpkh contain uncompressed pubkeys (#1573)
|
- Throw errors when p2wsh or p2wpkh contain uncompressed pubkeys (#1573)
|
||||||
|
|
2
package-lock.json
generated
2
package-lock.json
generated
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "bitcoinjs-lib",
|
"name": "bitcoinjs-lib",
|
||||||
"version": "5.1.8",
|
"version": "5.1.9",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "bitcoinjs-lib",
|
"name": "bitcoinjs-lib",
|
||||||
"version": "5.1.8",
|
"version": "5.1.9",
|
||||||
"description": "Client-side Bitcoin JavaScript library",
|
"description": "Client-side Bitcoin JavaScript library",
|
||||||
"main": "./src/index.js",
|
"main": "./src/index.js",
|
||||||
"types": "./types/index.d.ts",
|
"types": "./types/index.d.ts",
|
||||||
|
|
16
src/psbt.js
16
src/psbt.js
|
@ -117,11 +117,17 @@ class Psbt {
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
get txOutputs() {
|
get txOutputs() {
|
||||||
return this.__CACHE.__TX.outs.map(output => ({
|
return this.__CACHE.__TX.outs.map(output => {
|
||||||
script: bufferutils_1.cloneBuffer(output.script),
|
let address;
|
||||||
value: output.value,
|
try {
|
||||||
address: address_1.fromOutputScript(output.script, this.opts.network),
|
address = address_1.fromOutputScript(output.script, this.opts.network);
|
||||||
}));
|
} catch (_) {}
|
||||||
|
return {
|
||||||
|
script: bufferutils_1.cloneBuffer(output.script),
|
||||||
|
value: output.value,
|
||||||
|
address,
|
||||||
|
};
|
||||||
|
});
|
||||||
}
|
}
|
||||||
combine(...those) {
|
combine(...those) {
|
||||||
this.data.combine(...those.map(o => o.data));
|
this.data.combine(...those.map(o => o.data));
|
||||||
|
|
|
@ -155,11 +155,17 @@ export class Psbt {
|
||||||
}
|
}
|
||||||
|
|
||||||
get txOutputs(): TransactionOutput[] {
|
get txOutputs(): TransactionOutput[] {
|
||||||
return this.__CACHE.__TX.outs.map(output => ({
|
return this.__CACHE.__TX.outs.map(output => {
|
||||||
script: cloneBuffer(output.script),
|
let address;
|
||||||
value: output.value,
|
try {
|
||||||
address: fromOutputScript(output.script, this.opts.network),
|
address = fromOutputScript(output.script, this.opts.network);
|
||||||
}));
|
} catch (_) {}
|
||||||
|
return {
|
||||||
|
script: cloneBuffer(output.script),
|
||||||
|
value: output.value,
|
||||||
|
address,
|
||||||
|
};
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
combine(...those: Psbt[]): this {
|
combine(...those: Psbt[]): this {
|
||||||
|
|
Loading…
Add table
Reference in a new issue