AccountHD class¶
-
class
AccountHD
()¶ An object of this class is not created using the
new
operator, but is returned by the static functionsImportFromMnemonic()
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
ofAccountHD()
class.Checks for control sum and imports a Mnemonic phrase.This is essentially a factory method for instantiating an object ofAccountHD()
class.Using returned object you can further create a sequence of key pairs (objects ofAddr()
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
ofAddr()
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 ofAddr()
class bysImportPrivateKeyStrHex()
orsGenerateNew()
methods.
-
addrFindByName
(name)¶ Arguments: - name (string) – The name (alias) of the Address to search for.
Returns: An
object
ofAddr()
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
ofAddr()
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).