Update documentation with API changes for toJSON.
This commit is contained in:
parent
a50fccef4d
commit
e64581e4eb
|
@ -68,7 +68,7 @@ var multiSigTx = new Transaction()
|
||||||
.change(address);
|
.change(address);
|
||||||
|
|
||||||
var signature = multiSigTx.getSignatures(privateKey)[0];
|
var signature = multiSigTx.getSignatures(privateKey)[0];
|
||||||
console.log(signature.toJSON());
|
console.log(JSON.stringify(signature));
|
||||||
console.log(signature.toObject());
|
console.log(signature.toObject());
|
||||||
console.log(signature.signature.toString()); // Outputs a DER signature
|
console.log(signature.signature.toString()); // Outputs a DER signature
|
||||||
console.log(signature.sigtype);
|
console.log(signature.sigtype);
|
||||||
|
@ -144,7 +144,7 @@ To remove all outputs, you can use `clearOutputs()`, which preserves change outp
|
||||||
There are a series of methods used for serialization:
|
There are a series of methods used for serialization:
|
||||||
|
|
||||||
* `toObject`: Returns a plain JavaScript object with no methods and enough information to fully restore the state of this transaction. Using other serialization methods (except for `toJSON`) will cause a some information to be lost.
|
* `toObject`: Returns a plain JavaScript object with no methods and enough information to fully restore the state of this transaction. Using other serialization methods (except for `toJSON`) will cause a some information to be lost.
|
||||||
* `toJSON`: Returns a string with a JSON-encoded version of the output for `toObject`.
|
* `toJSON`: Will be called when using `JSON.stringify` to return JSON-encoded string using the output from `toObject`.
|
||||||
* `toString` or `uncheckedSerialize`: Returns an hexadecimal serialization of the transaction, in the [serialization format for bitcoin](https://bitcoin.org/en/developer-reference#raw-transaction-format).
|
* `toString` or `uncheckedSerialize`: Returns an hexadecimal serialization of the transaction, in the [serialization format for bitcoin](https://bitcoin.org/en/developer-reference#raw-transaction-format).
|
||||||
* `serialize`: Does a series of checks before serializing the transaction
|
* `serialize`: Does a series of checks before serializing the transaction
|
||||||
* `inspect`: Returns a string with some information about the transaction (currently a string formated as `<Transaction 000...000>`, that only shows the serialized value of the transaction.
|
* `inspect`: Returns a string with some information about the transaction (currently a string formated as `<Transaction 000...000>`, that only shows the serialized value of the transaction.
|
||||||
|
|
Loading…
Reference in New Issue