iota_lib v0.0.1 Iota.Utils

This module provides various utility functions to handle IOTA’s quirks.

Link to this section Summary

Functions

Transforms a string of trytes returned by :trytes into a Transaction structure

Turns a tryte-encoded string into a list of trits. The string length has to be a multiple of 2

Returns a tryte-encoded version of string argument str. This will handle any kind of string with valid characters

Converts a string containing the heptavigesimal representation of a tryte-encoded number into an integer

Link to this section Functions

Link to this function as_string(trytes)
as_string(String.t()) :: String.t()
Link to this function as_transaction(trytes)
as_transaction(String.t()) ::
  Iota.Transaction.t() |
  {atom(), String.t()}

Transforms a string of trytes returned by :trytes into a Transaction structure.

> Iota.Utils.as_transaction("AHEAJD...")
%Iota.Transaction{...}
Link to this function as_trits(num)
as_trits(String.t()) :: [-1..1] | {atom(), String.t()}
as_trits(integer()) :: [-1..1]

Turns a tryte-encoded string into a list of trits. The string length has to be a multiple of 2.

> Iota.Utils.as_trits("CLOUD9")
[]
Link to this function as_trytes(str)
as_trytes(String.t()) :: String.t()

Returns a tryte-encoded version of string argument str. This will handle any kind of string with valid characters.

Link to this function trytes_to_int(str)
trytes_to_int(String.t()) :: integer() | {atom(), String.t()}

Converts a string containing the heptavigesimal representation of a tryte-encoded number into an integer.

> Iota.Utils.trytes_to_int("9SISTERS")
205803034065