|
@ -14,9 +14,9 @@ class Psbt extends bip174_1.Psbt { |
|
|
constructor(opts = {}) { |
|
|
constructor(opts = {}) { |
|
|
super(); |
|
|
super(); |
|
|
// set defaults
|
|
|
// set defaults
|
|
|
this.setVersion(2); |
|
|
|
|
|
this.opts = Object.assign({}, DEFAULT_OPTS, opts); |
|
|
this.opts = Object.assign({}, DEFAULT_OPTS, opts); |
|
|
this.__TX = transaction_1.Transaction.fromBuffer(this.globalMap.unsignedTx); |
|
|
this.__TX = transaction_1.Transaction.fromBuffer(this.globalMap.unsignedTx); |
|
|
|
|
|
this.setVersion(2); |
|
|
// set cache
|
|
|
// set cache
|
|
|
const self = this; |
|
|
const self = this; |
|
|
delete this.globalMap.unsignedTx; |
|
|
delete this.globalMap.unsignedTx; |
|
@ -44,6 +44,16 @@ class Psbt extends bip174_1.Psbt { |
|
|
dpew(this, '__TX_BUF_CACHE', false, true); |
|
|
dpew(this, '__TX_BUF_CACHE', false, true); |
|
|
dpew(this, 'opts', false, true); |
|
|
dpew(this, 'opts', false, true); |
|
|
} |
|
|
} |
|
|
|
|
|
setVersion(version) { |
|
|
|
|
|
this.__TX.version = version; |
|
|
|
|
|
this.__TX_BUF_CACHE = undefined; |
|
|
|
|
|
return this; |
|
|
|
|
|
} |
|
|
|
|
|
setLocktime(locktime) { |
|
|
|
|
|
this.__TX.locktime = locktime; |
|
|
|
|
|
this.__TX_BUF_CACHE = undefined; |
|
|
|
|
|
return this; |
|
|
|
|
|
} |
|
|
addInput(inputData) { |
|
|
addInput(inputData) { |
|
|
const self = this; |
|
|
const self = this; |
|
|
const inputAdder = (_inputData, txBuf) => { |
|
|
const inputAdder = (_inputData, txBuf) => { |
|
|