Transaction: Use Script toString for transaction JSON output
This commit is contained in:
parent
b544b0594d
commit
ad4bc9324f
|
@ -45,7 +45,7 @@ Input.prototype.toObject = function toObject() {
|
||||||
prevTxId: this.prevTxId.toString('hex'),
|
prevTxId: this.prevTxId.toString('hex'),
|
||||||
outputIndex: this.outputIndex,
|
outputIndex: this.outputIndex,
|
||||||
sequenceNumber: this.sequenceNumber,
|
sequenceNumber: this.sequenceNumber,
|
||||||
script: this._scriptBuffer.toString('hex')
|
script: this._script.toString()
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ Object.defineProperty(Output.prototype, 'satoshis', {
|
||||||
if (num instanceof BN) {
|
if (num instanceof BN) {
|
||||||
this._satoshis = num;
|
this._satoshis = num;
|
||||||
} else {
|
} else {
|
||||||
this._satoshis = BN().fromNumber(num);
|
this._satoshis = BN(num, 'hex');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -54,7 +54,7 @@ Output.prototype._fromObject = function(param) {
|
||||||
Output.prototype.toObject = function toObject() {
|
Output.prototype.toObject = function toObject() {
|
||||||
return {
|
return {
|
||||||
satoshis: this.satoshis,
|
satoshis: this.satoshis,
|
||||||
script: this._scriptBuffer.toString('hex')
|
script: this._script.toString()
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -68,10 +68,10 @@ var tx_1_json = JSON.stringify({
|
||||||
prevTxId:"a477af6b2667c29670467e4e0728b685ee07b240235771862318e29ddbe58458",
|
prevTxId:"a477af6b2667c29670467e4e0728b685ee07b240235771862318e29ddbe58458",
|
||||||
outputIndex:0,
|
outputIndex:0,
|
||||||
sequenceNumber:4294967295,
|
sequenceNumber:4294967295,
|
||||||
script:"473044022013fa3089327b50263029265572ae1b022a91d10ac80eb4f32f291c914533670b02200d8a5ed5f62634a7e1a0dc9188a3cc460a986267ae4d58faf50c79105431327501210223078d2942df62c45621d209fab84ea9a7a23346201b7727b9b45a29c4e76f5e"}],
|
script:'71 0x3044022013fa3089327b50263029265572ae1b022a91d10ac80eb4f32f291c914533670b02200d8a5ed5f62634a7e1a0dc9188a3cc460a986267ae4d58faf50c79105431327501 33 0x0223078d2942df62c45621d209fab84ea9a7a23346201b7727b9b45a29c4e76f5e'}],
|
||||||
outputs:[{
|
outputs:[{
|
||||||
satoshis:1010000,
|
satoshis:1010000,
|
||||||
script:"76a9147821c0a3768aa9d1a37e16cf76002aef5373f1a888ac"
|
script:'OP_DUP OP_HASH160 20 0x7821c0a3768aa9d1a37e16cf76002aef5373f1a8 OP_EQUALVERIFY OP_CHECKSIG'
|
||||||
}],
|
}],
|
||||||
nLockTime:0
|
nLockTime:0
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue