Class: MoneroUtils

MoneroUtils()

Collection of Monero utilitlies.

Constructor

new MoneroUtils()

Source:

Methods

(async, static) getCoreUtils()

Get Monero Core utils for client-side crypto and binary requests.
Source:

(static) getLastTxPubKey(txExtra)

Decodes tx extra according to https://cryptonote.org/cns/cns005.txt and returns the last tx pub key. TODO: use c++ bridge for this
Parameters:
Name Type Description
txExtra is an array of tx extra bytes
Source:
Returns:
the last pub key as a hexidecimal string

(static) kvLine(key, value, indent, newline, ignoreUndefined) → {string}

Returns a human-friendly key value line.
Parameters:
Name Type Default Description
key is the key
value is the value
indent 0 indents the line
newline true specifies if the string should be terminated with a newline or not
ignoreUndefined true specifies if undefined values should return an empty string
Source:
Returns:
is the human-friendly key value line
Type
string

(static) mergeTx(txs, tx)

Merges a transaction into a list of existing transactions.
Parameters:
Name Type Description
txs are existing transactions to merge into
tx is the transaction to merge into the list
Source:

(static) paymentIdsEqual(paymentId1, paymentId2)

Determines if two payment ids are functionally equal. For example, 03284e41c342f032 and 03284e41c342f032000000000000000000000000000000000000000000000000 are considered equal.
Parameters:
Name Type Description
paymentId1 is a payment id to compare
paymentId2 is a payment id to compare
Source:
Returns:
true if the payment ids are equal, false otherwise

(static) reconcile(val1, val2, config, errMsg)

Reconciles two values. TODO: remove custom error message
Parameters:
Name Type Description
val1 is a value to reconcile
val2 is a value to reconcile
config specifies reconciliation configuration config.resolveDefined uses defined value if true or undefined, undefined if false config.resolveTrue uses true over false if true, false over true if false, must be equal if undefined config.resolveMax uses max over min if true, min over max if false, must be equal if undefined
errMsg is the error message to throw if the values cannot be reconciled (optional)
Source:
Throws:
if the values cannot be reconciled
Type
Error
Returns:
the reconciled value if reconcilable

(static) safeSet(obj, getFn, setFn, val, config, errMsg)

Sets the given value ensuring a previous value is not overwritten. TODO: remove for portability because function passing not supported in other languages, use reconcile only
Parameters:
Name Type Description
obj is the object to invoke the getter and setter on
getFn gets the current value
setFn sets the current value
val is the value to set iff it does not overwrite a previous value
config specifies reconciliation configuration config.resolveDefined uses defined value if true or undefined, undefined if false config.resolveTrue uses true over false if true, false over true if false, must be equal if undefined config.resolveMax uses max over min if true, min over max if false, must be equal if undefined
errMsg is the error message to throw if the values cannot be reconciled (optional)
Source: