High-level entry point: holds the operator identity and the network's node address book, builds and submits Consensus Service transactions, retries across nodes on transient failures, and fetches receipts.
client = Hedera.Client.testnet(operator_id, operator_key)
{:ok, %{precheck_code: 0}} = Hedera.Client.submit_message(client, topic_id, "payload")
Summary
Functions
Associate tokens with account. The account must sign; when it is not the
operator, pass its key via signers: [account_key] in opts.
Burn amount of a token from the treasury. Needs the supply key.
Create a new HTS token. See Hedera.Transaction.token_create/1 for opts
(:treasury is required). The new token's id is in the receipt's token_id.
Create a new HCS topic (open, unless :memo given).
Mint amount of (or :metadata for) a token. Needs the supply key.
Submit a message to an HCS topic (retries across nodes on transient errors).
Build a testnet client (with the full testnet node address book).
Fetch a transaction's consensus receipt, polling until final (free query).
Transfer HBAR between accounts (retries across nodes on transient errors).
Transfer an HTS token between accounts. moves is a list of
{%AccountId{}, amount} pairs that must net to zero (debits negative).
Types
@type result() :: %{ precheck_code: integer(), ok?: boolean(), transaction_id: Hedera.TransactionId.t() }
@type t() :: %Hedera.Client{ nodes: [Hedera.Network.node_info()], operator_id: Hedera.AccountId.t(), operator_key: Hedera.PrivateKey.t() }
Functions
@spec associate_token(t(), Hedera.AccountId.t(), [Hedera.TokenId.t()], keyword()) :: {:ok, result()} | {:error, term()}
Associate tokens with account. The account must sign; when it is not the
operator, pass its key via signers: [account_key] in opts.
@spec burn_token(t(), Hedera.TokenId.t(), non_neg_integer(), keyword()) :: {:ok, result()} | {:error, term()}
Burn amount of a token from the treasury. Needs the supply key.
Create a new HTS token. See Hedera.Transaction.token_create/1 for opts
(:treasury is required). The new token's id is in the receipt's token_id.
Create a new HCS topic (open, unless :memo given).
@spec mint_token(t(), Hedera.TokenId.t(), non_neg_integer(), keyword()) :: {:ok, result()} | {:error, term()}
Mint amount of (or :metadata for) a token. Needs the supply key.
@spec submit_message(t(), Hedera.TopicId.t(), binary()) :: {:ok, result()} | {:error, term()}
Submit a message to an HCS topic (retries across nodes on transient errors).
@spec testnet(Hedera.AccountId.t(), Hedera.PrivateKey.t()) :: t()
Build a testnet client (with the full testnet node address book).
@spec transaction_receipt(t(), Hedera.TransactionId.t(), keyword()) :: {:ok, Hedera.Receipt.t()} | {:error, term()}
Fetch a transaction's consensus receipt, polling until final (free query).
@spec transfer_hbar(t(), [{Hedera.AccountId.t(), integer()}], keyword()) :: {:ok, result()} | {:error, term()}
Transfer HBAR between accounts (retries across nodes on transient errors).
transfers is a list of {%AccountId{}, amount_in_tinybars} pairs; debits are
negative, credits positive, and they must net to zero.
Hedera.Client.transfer_hbar(client, [{from, -1}, {to, 1}])
@spec transfer_token( t(), Hedera.TokenId.t(), [{Hedera.AccountId.t(), integer()}], keyword() ) :: {:ok, result()} | {:error, term()}
Transfer an HTS token between accounts. moves is a list of
{%AccountId{}, amount} pairs that must net to zero (debits negative).