Numerous settings are available when initialising the core API via Onz-JS. Please see the examples below.
The provision of settings is optional, therefore initialising without any arguments var ONZ = onz.api();
yields the defaults.
Address: The Onz address for recipient and sender of the transactions.
Limit: The number of transactions to retrieve. Minimum: 1, Maximum: 1000.
Offset: The number of records to offset the query from, e.g. a given offset of 10 excludes the first 10 records from the yielded results.
sendRequest
gives full access to the Onz core API. It accepts any valid endpoint and parameters.
The provided secret is intercepted and never transmitted over the network.
Use ONZ.setNode();
without any arguments to automatically choose a new random node.
Yields an object containing arrays of network categorised peers:
{ official: [...], ssl: [...], testnet: [...], localhost: [...] }
Used to calculate unique identifiers.
In order maintain formatting it is advised to wrap the resulting output within a pre
tag.
Combines the signMessageWithSecret and printSignedMessage functions.
Returns null if invalid, or the original message if valid.
Where message is a UTF-8 message, secret a passphrase and recipientPublicKey the publicKey in hex.
ReturningReturns an object with the encrypted message and a nonce. Both are necessary in order to decrypt the message.
Where encrypted message is the hex format of the encrypted message, nonce also hex. The secret as the passphrase of the recipient and the sender publicKey in hex.
ReturningIf successfull, returns the plain text of the senders message.