View Source OnFlow (on_flow v0.13.0)
Link to this section Summary
Functions
Creates a Flow account. Note that an existing account must be passed in as the first argument, since internally this is executed as a transaction on the existing account.
Deploys a contract to an account. This just takes in existing account credentials, the name of the contract, and the contract code. Internally, this is just a single-signer, single-authorizer transaction.
Executes a script on the Flow network to show account data.
Returns a binary of the latest block ID. This is typically used as a reference ID when sending transactions to the network.
Fetches the transaction result for a given transaction ID.
Sends a transaction. Options
Link to this section Types
@type account() :: OnFlow.Entities.Account.t()
@type address() :: binary()
@type error() :: {:error, GRPC.RPCError.t()}
@type hex_string() :: String.t()
@type transaction_result() :: {:ok | :error, OnFlow.TransactionResponse.t()} | {:error, :timeout}
Link to this section Functions
@spec create_account(OnFlow.Credentials.t(), hex_string(), keyword()) :: {:ok, hex_string()} | transaction_result()
Creates a Flow account. Note that an existing account must be passed in as the first argument, since internally this is executed as a transaction on the existing account.
Available options are:
:gas_limit
- the maximum amount of gas to use for the transaction. Defaults to 100.
On success, it returns {:ok, address}
, where address
is a hex-encoded
representation of the address.
On failure, it returns {:error, response}
or {:error, :timeout}
.
@spec deploy_contract(OnFlow.Credentials.t(), String.t(), String.t(), keyword()) :: transaction_result()
Deploys a contract to an account. This just takes in existing account credentials, the name of the contract, and the contract code. Internally, this is just a single-signer, single-authorizer transaction.
Options:
:gas_limit
- the maximum amount of gas to use for the transaction. Defaults to 100.:update
- eithertrue
orfalse
to update a previously deployed contract with the same name.
Executes a script on the Flow network to show account data.
Returns a binary of the latest block ID. This is typically used as a reference ID when sending transactions to the network.
Fetches the transaction result for a given transaction ID.
@spec send_transaction( String.t(), [OnFlow.Credentials.t()] | OnFlow.Credentials.t(), non_neg_integer(), keyword() ) :: transaction_result()
Sends a transaction. Options:
:args
- the list of objects that will be sent along with the transaction. This must be an Elixir list that can be encoded to JSON.:authorizers
- a list of authorizing%Credentials{}
structs to authorize the transaction.:payer
- a hex-encoded address or%Credentials{}
struct that will pay for the transaction.:wait_until_sealed
- eithertrue
orfalse
. Note that if the transaction is not sealed after 30 seconds, this will return{:error, :timeout}
. Defaults totrue
.