Elrondex.Transaction (Elrondex v0.1.1) View Source

Link to this section Summary

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"}"
Link to this function

is_required_sign_field(field)

View Source
Link to this function

prepare(tr, network, nonce \\ nil)

View Source

Prepares a transaction to be done on certain network.

Arguments

  • tr - the transaction details
  • 'network' - the network used for that transaction
Link to this function

prepare_gas_limit(tr, network)

View Source

Calculates the gas limit for certain transaction.

Arguments

  • tr - the transaction details
  • 'network' - the network used for that transaction
Link to this function

prepare_network(tr, network)

View Source
Link to this function

prepare_nonce(tr, nonce)

View Source

Prepares the nonce of a transaction.

Arguments

  • tr - the transaction details
  • 'nonce' - the nonce (integer)
Link to this function

prepare_sign_field(tr, field)

View Source
Link to this function

prepare_sign_field_base64(field, value)

View Source
Link to this function

prepare_sign_field_number(field, value)

View Source
Link to this function

prepare_sign_field_string(field, value)

View Source

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"
Link to this function

sign_verify(tr, account)

View Source

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
Link to this function

transaction(account, receiver, value, data \\ nil)

View Source

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.