Addr class¶
- class Addr()¶
This class is designed to work with a specific key pair (not with an HD wallet or an HD Group).
Static methods¶
The class has no static methods.
Class methods¶
- address()¶
- Returns
A
string
containing a Public-address (without leading ‘0x’).
Method to get a HEX representation of itself (aka Public-address).Example://New HD address from HD group var hdAddr = GetRes(window.crypto_core_wallet.generate_next_hd_address(crypto_core_hdGroupId)); var addrStrHex = GetRes(hdAddr.address()); console.log("New address: " + "0x" + addrStrHex);
- sign_transaction(transaction)¶
- Arguments
transaction – An object of
Transaction()
class.
- Returns
An
object
ofTransactionSign()
class.
Performs a signature of aTransaction()
object.Example:var transaction = GetRes(Module.CryptoCoreTransaction.new_transaction( network_type, transaction_type, String(to), String(value), String(fee), String(nonce), String(d.getTime()), String(data), String(gas), String(gas_price) )); console.log("Sign transaction..."); var transaction_sign = GetRes(hdAddr.sign_transaction(transaction)); var transaction_hash = GetRes(transaction_sign.hash()); console.log("Transaction hash '" + transaction_hash + "'"); var transaction_sign_hex_encoded = GetRes(transaction_sign.encode()); console.log("Transaction sign hex str '" + transaction_sign_hex_encoded + "'");
- nonce()¶
- Returns
A
string
containing the current Nonce (string representation of SINT64 - max value is 9,223,372,036,854,775,807).
Method to get the current Nonce, which was set byset_nonce()
method or was incremented byinc_nonce()
method.
- set_nonce(nonce)¶
- Arguments
nonce (string) – A string representation of Nonce to set.
- Returns
void
.
Set the Nonce for this Address.
- inc_nonce()¶
- Returns
A
string
containing the incremented Nonce.
Method to increment the current Nonce.
- private_key()¶
- Returns
A
string
HEX representation of the private key part of this Address.
Method to get the HEX representation of the private key part of this Address.
- name()¶
- Returns
A
string
containing the name of this Address if any name was set byset_name()
method.
Method to set recognizable name to this Address.