Elrondex.Transaction (Elrondex v0.1.1) View Source
Link to this section Summary
Functions
Returns raw data to sign in JSON format.
Prepares a transaction to be done on certain network.
Calculates the gas limit for certain transaction.
Prepares the nonce of a transaction.
Signs a transaction.
Verifies the signature of a transaction.
Creates a new transaction.
Link to this section Functions
Returns raw data to sign in JSON format.
Arguments
tr
- the transaction
Examples
iex> Elrondex.Test.Bob.transfer_1_egld_to_alice()
...> |> Elrondex.Transaction.data_to_sign()
"{"nonce":1,
"value":"1000000000000000000",
"receiver":"erd18n5zgmet82jvqag9n8pcvzdzlgqr3jhqxld2z6nwxzekh4cwt6ps87zfmu",
"sender":"erd1edmdkecu95u6aj9ehd0lf3d97qw85k86pkqqdu5029zcydslg7qs3tdc59",
"gasPrice":10
,"gasLimit":100
,"chainID":"T"}"
Prepares a transaction to be done on certain network.
Arguments
tr
- the transaction details- 'network' - the network used for that transaction
Calculates the gas limit for certain transaction.
Arguments
tr
- the transaction details- 'network' - the network used for that transaction
Prepares the nonce of a transaction.
Arguments
tr
- the transaction details- 'nonce' - the nonce (integer)
Signs a transaction.
Arguments
tr
- the transaction to be signed
Examples
iex> Elrondex.Test.Bob.transfer_1_egld_to_alice()
...> |> Elrondex.Transaction.sign()
...> |> Map.get(:signature)
"89c2d0de0612b99ba51235801b3e6488d9fb5e1b33c7d858afd0517df9258056a5d07b573a211ccd4c99f4f130ef6dcfdccd30079feb53c9d5775970b97fc802"
Verifies the signature of a transaction.
Arguments
tr
- the signed transaction- 'account' - the account that signs the transaction
Examples
iex> Elrondex.Test.Bob.transfer_1_egld_to_alice()
...> |> Elrondex.Transaction.sign()
...> |> Elrondex.Transaction.sign_verify()
true
Creates a new transaction.
Arguments
account
- the account that signs the transaction, called 'sender'.receiver
- the receiver who receives native EGLD amount sent by sender.value
- the native EGLD amount sent from sender to receiver.data
- the data associated to the transaction.