IoTeX client
Public Member Functions | List of all members
iotex::Account Class Reference

Public Member Functions

 Account ()
 Construct a new Account object with a new randomly generated address.
 
 Account (uint8_t privateKey[IOTEX_PRIVATE_KEY_SIZE])
 Construct a new Account object from an existing private key. More...
 
void getIotexAddress (char buffer[IOTEX_ADDRESS_C_STRING_SIZE])
 Get the IoTeX address as a null terminated string. More...
 
void getEthereumAddress (char buffer[ETH_ADDRESS_C_STRING_SIZE])
 Get the Ethereum address as a null terminated string. More...
 
void getEthereumAddressBytes (uint8_t buffer[ETH_ADDRESS_SIZE])
 Get the Ethereum address as a byte array. More...
 
void getPublicKey (uint8_t buffer[IOTEX_PUBLIC_KEY_SIZE])
 Get the public key as a byte array. More...
 
void getPublicKeyString (char buffer[IOTEX_PUBLIC_KEY_C_STRING_SIZE])
 Get the public key as a null terminated string. More...
 
void getPrivateKey (uint8_t buffer[IOTEX_PRIVATE_KEY_SIZE])
 Get the private key as a byte array. More...
 
void getPrivateKeyString (char buffer[IOTEX_PRIVATE_KEY_C_STRING_SIZE])
 Get the private key as a null terminated string. More...
 
void signMessage (const uint8_t *message, size_t size, uint8_t signature[IOTEX_SIGNATURE_SIZE])
 Singns a message. More...
 
void signTokenTransferAction (iotex::ResponseTypes::ActionCore_Transfer &transfer, uint8_t signature[IOTEX_SIGNATURE_SIZE])
 Signs a token transfer action. More...
 
void signExecutionAction (iotex::ResponseTypes::ActionCore_Execution &execution, uint8_t signature[IOTEX_SIGNATURE_SIZE], uint8_t hash[IOTEX_HASH_SIZE]=nullptr)
 Signs an execution action. More...
 
template<typename TAPI >
ResultCode sendTokenTransferAction (Connection< TAPI > &conn, uint64_t nonce, uint64_t gasLimit, const char *gasPrice, const char *amount, const char *recipient, uint8_t hash[IOTEX_HASH_SIZE])
 Sends a token transfer action to the blockchain. More...
 
template<typename TAPI >
ResultCode sendExecutionAction (Connection< TAPI > &conn, uint64_t nonce, uint64_t gasLimit, const char *gasPrice, const char *amount, const char contract[IOTEX_ADDRESS_C_STRING_SIZE], IotexString data, uint8_t hash[IOTEX_HASH_SIZE])
 Sends an execution action to the blockchain. More...
 
 Account (Random *pRandomGenerator, Encoder *pEncoder, Signer *pSigner, uint8_t privateKey[IOTEX_PRIVATE_KEY_SIZE]=nullptr)
 

Constructor & Destructor Documentation

◆ Account()

Account::Account ( uint8_t  privateKey[IOTEX_PRIVATE_KEY_SIZE])

Construct a new Account object from an existing private key.

Parameters
privateKeyThe private key

Member Function Documentation

◆ getEthereumAddress()

void Account::getEthereumAddress ( char  buffer[ETH_ADDRESS_C_STRING_SIZE])

Get the Ethereum address as a null terminated string.

Parameters
[out]buffer

◆ getEthereumAddressBytes()

void Account::getEthereumAddressBytes ( uint8_t  buffer[ETH_ADDRESS_SIZE])

Get the Ethereum address as a byte array.

Parameters
[out]buffer

◆ getIotexAddress()

void Account::getIotexAddress ( char  buffer[IOTEX_ADDRESS_C_STRING_SIZE])

Get the IoTeX address as a null terminated string.

Parameters
[out]buffer

◆ getPrivateKey()

void Account::getPrivateKey ( uint8_t  buffer[IOTEX_PRIVATE_KEY_SIZE])

Get the private key as a byte array.

Parameters
[out]buffer

◆ getPrivateKeyString()

void Account::getPrivateKeyString ( char  buffer[IOTEX_PRIVATE_KEY_C_STRING_SIZE])

Get the private key as a null terminated string.

Parameters
[out]buffer

◆ getPublicKey()

void Account::getPublicKey ( uint8_t  buffer[IOTEX_PUBLIC_KEY_SIZE])

Get the public key as a byte array.

Parameters
[out]buffer

◆ getPublicKeyString()

void Account::getPublicKeyString ( char  buffer[IOTEX_PUBLIC_KEY_C_STRING_SIZE])

Get the public key as a null terminated string.

Parameters
[out]buffer

◆ sendExecutionAction()

template<typename TAPI >
ResultCode iotex::Account::sendExecutionAction ( Connection< TAPI > &  conn,
uint64_t  nonce,
uint64_t  gasLimit,
const char *  gasPrice,
const char *  amount,
const char  contract[IOTEX_ADDRESS_C_STRING_SIZE],
IotexString  data,
uint8_t  hash[IOTEX_HASH_SIZE] 
)
inline

Sends an execution action to the blockchain.

Template Parameters
TAPI
Parameters
connThe connection object
nonceThe account nonce
gasLimitThe gas limit for the action
gasPriceThe gas price for the action
amountThe amount. Can be zero
contractThe contract IoTeX address
dataThe action data
[out]hashThe action hash if successful
Returns
ResultCode Sucess or an error code

◆ sendTokenTransferAction()

template<typename TAPI >
ResultCode iotex::Account::sendTokenTransferAction ( Connection< TAPI > &  conn,
uint64_t  nonce,
uint64_t  gasLimit,
const char *  gasPrice,
const char *  amount,
const char *  recipient,
uint8_t  hash[IOTEX_HASH_SIZE] 
)
inline

Sends a token transfer action to the blockchain.

Template Parameters
TAPI
Parameters
connThe connection object
nonceThe account nonce
gasLimitThe gas limit for the action
gasPriceThe gas price for the action
amountThe amount to transfer
recipientThe recipient IoTeX address as a null terminated string
[out]hashThe action hash if successful
Returns
ResultCode Sucess or an error code

◆ signExecutionAction()

void Account::signExecutionAction ( iotex::ResponseTypes::ActionCore_Execution execution,
uint8_t  signature[IOTEX_SIGNATURE_SIZE],
uint8_t  hash[IOTEX_HASH_SIZE] = nullptr 
)

Signs an execution action.

Parameters
executionThe execution object
signatureThe execution signature as a byte array
[out]hashOptional. The execution hash as a byte array

◆ signMessage()

void Account::signMessage ( const uint8_t *  message,
size_t  size,
uint8_t  signature[IOTEX_SIGNATURE_SIZE] 
)

Singns a message.

Parameters
messageThe mesage as a byte array
sizeThe message sze in bytes
[out]signatureThe signed message as a byte array

◆ signTokenTransferAction()

void Account::signTokenTransferAction ( iotex::ResponseTypes::ActionCore_Transfer transfer,
uint8_t  signature[IOTEX_SIGNATURE_SIZE] 
)

Signs a token transfer action.

Parameters
transferThe transfer object
[out]signatureThe transfer signature as a byte array

The documentation for this class was generated from the following files: