coin json
This commit is contained in:
parent
3a99b23cb3
commit
b473c0a31f
@ -164,15 +164,18 @@ Coin.prototype.toJSON = function toJSON() {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
Coin.fromJSON = function fromJSON(json) {
|
Coin.fromJSON = function fromJSON(json) {
|
||||||
return Coin.fromOptions({
|
return new Coin().fromJSON(json);
|
||||||
version: json.version,
|
};
|
||||||
height: json.height,
|
|
||||||
value: utils.satoshi(json.value),
|
Coin.prototype.fromJSON = function fromJSON(json) {
|
||||||
script: bcoin.script.fromRaw(new Buffer(json.script, 'hex')),
|
this.version = json.version;
|
||||||
coinbase: json.coinbase,
|
this.height = json.height;
|
||||||
hash: json.hash ? utils.revHex(json.hash) : null,
|
this.value = utils.satoshi(json.value);
|
||||||
index: json.index
|
this.script = bcoin.script.fromRaw(new Buffer(json.script, 'hex'));
|
||||||
});
|
this.coinbase = json.coinbase;
|
||||||
|
this.hash = json.hash ? utils.revHex(json.hash) : null;
|
||||||
|
this.index = json.index;
|
||||||
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -108,9 +108,7 @@ Outpoint.prototype.inspect = function inspect() {
|
|||||||
* @constructor
|
* @constructor
|
||||||
* @param {NakedInput} options
|
* @param {NakedInput} options
|
||||||
* @param {Boolean?} mutable
|
* @param {Boolean?} mutable
|
||||||
* @property {Object} prevout - Outpoint.
|
* @property {Outpoint} prevout - Outpoint.
|
||||||
* @property {Hash} prevout.hash - Previous transaction hash.
|
|
||||||
* @property {Number} prevout.index - Previous output index.
|
|
||||||
* @property {Script} script - Input script / scriptSig.
|
* @property {Script} script - Input script / scriptSig.
|
||||||
* @property {Number} sequence - nSequence.
|
* @property {Number} sequence - nSequence.
|
||||||
* @property {Witness} witness - Witness (empty if not present).
|
* @property {Witness} witness - Witness (empty if not present).
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user