AccountHD class

class AccountHD()

An object of this class is not created using the new operator, but is returned by the static function sImportFromMnemonic() importing a Mnemonic phrase.

Static methods

sNewMnemonic()
Returns:A string containing generated Mnemonic phrase.
Generates a new mnemonic phrase.
Example:
var mnemonic_rs = Module.UnoSemuxAccountHD.sNewMnemonic();

if (typeof mnemonic_rs.error != "undefined") {
    console.log(mnemonic_rs.error);
} else {
    console.log("New mnemonic phrase '" + mnemonic_rs.res + "'");
}
sImportFromMnemonic(mnemonic, password)
Arguments:
  • mnemonic (string) – A Mnemonic phrase.
  • password (string) – A password (can be empty).
Returns:

An object of AccountHD() class.

Checks for control sum and imports a Mnemonic phrase.
This is essentially a factory method for instantiating an object of AccountHD() class.
Using returned object you can further create a sequence of key pairs (objects of Addr() class).
Example:
function ImportMnemonicPhrase() {

    var mnemonic = prompt("Please enter your mnemonic phrase: ");
    var password = "";  // optional

    // Import mnemonic phrase (transform it into AccountHD)
    var account_hd_rs = Module.UnoSemuxAccountHD.sImportFromMnemonic(mnemonic, password);

    if (typeof account_hd_rs.error != "undefined") {
        // If check of mnemonic phrase fails
        console.log(account_hd_rs.error);
    } else {
        var account_hd = account_hd_rs.res;
    }

Class methods

addrAddNextHD()
Returns:An object of Addr() class.
Derives the next key pair (HD Address) from the HD Account.
Example:
// Generate the next HD address
var next_hd_addr_rs = account_hd.addrAddNextHD();

if (typeof next_hd_addr_rs.error != "undefined") {
    console.log(next_hd_addr_rs.error);
} else {
    var next_hd_addr = next_hd_addr_rs.res;
}
addrAdd(address)
Arguments:
Returns:

void.

Add the non-HD Address to the collection of Addresses.
You can create such an object of Addr() class by sImportPrivateKeyStrHex() or sGenerateNew() methods.
addrFindByName(name)
Arguments:
  • name (string) – The name (alias) of the Address to search for.
Returns:

An object of Addr() class.

Finds the Address by its name (alias).
addrFindByHexStr(hex)
Arguments:
  • hex (string) – A hex form of the Address to search for.
Returns:

An object of Addr() class.

Finds the Address by its HEX representation.
addrHexStrByName(name)
Arguments:
  • name (string) – The name (alias) of the Address.
Returns:

A string containing the HEX representation of an Address.

Returns a HEX representation of the Address by its name (alias).
addrDeleteByName(name)
Arguments:
  • name (string) – The name (alias) of the Address to be deleted.
Returns:

void.

Deletes the Address having the given name.
addrDeleteByHexStr(hex)
Arguments:
  • name (string) – A hex form of the Address to be deleted.
Returns:

void.

Deletes the Address by its HEX representation.