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
|
||||
__fixed__
|
||||
- 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",
|
||||
"version": "5.1.8",
|
||||
"version": "5.1.9",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "bitcoinjs-lib",
|
||||
"version": "5.1.8",
|
||||
"version": "5.1.9",
|
||||
"description": "Client-side Bitcoin JavaScript library",
|
||||
"main": "./src/index.js",
|
||||
"types": "./types/index.d.ts",
|
||||
|
|
16
src/psbt.js
16
src/psbt.js
|
@ -117,11 +117,17 @@ class Psbt {
|
|||
}));
|
||||
}
|
||||
get txOutputs() {
|
||||
return this.__CACHE.__TX.outs.map(output => ({
|
||||
script: bufferutils_1.cloneBuffer(output.script),
|
||||
value: output.value,
|
||||
address: address_1.fromOutputScript(output.script, this.opts.network),
|
||||
}));
|
||||
return this.__CACHE.__TX.outs.map(output => {
|
||||
let address;
|
||||
try {
|
||||
address = address_1.fromOutputScript(output.script, this.opts.network);
|
||||
} catch (_) {}
|
||||
return {
|
||||
script: bufferutils_1.cloneBuffer(output.script),
|
||||
value: output.value,
|
||||
address,
|
||||
};
|
||||
});
|
||||
}
|
||||
combine(...those) {
|
||||
this.data.combine(...those.map(o => o.data));
|
||||
|
|
|
@ -155,11 +155,17 @@ export class Psbt {
|
|||
}
|
||||
|
||||
get txOutputs(): TransactionOutput[] {
|
||||
return this.__CACHE.__TX.outs.map(output => ({
|
||||
script: cloneBuffer(output.script),
|
||||
value: output.value,
|
||||
address: fromOutputScript(output.script, this.opts.network),
|
||||
}));
|
||||
return this.__CACHE.__TX.outs.map(output => {
|
||||
let address;
|
||||
try {
|
||||
address = fromOutputScript(output.script, this.opts.network);
|
||||
} catch (_) {}
|
||||
return {
|
||||
script: cloneBuffer(output.script),
|
||||
value: output.value,
|
||||
address,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
combine(...those: Psbt[]): this {
|
||||
|
|
Loading…
Reference in a new issue