ex_plasma v0.1.0 ExPlasma.Client
This module provides functions to talk to the contract directly.
Link to this section Summary
Functions
Adds an exit queue for the given vault and token address.
Deposit a transaction to the contracts.
Process exits in Plasma. This will allow you to process your a specific exit or a set number of exits.
Start a Standard Exit
Submits a block to the contract.
Link to this section Functions
add_exit_queue(vault_id, token_address, options \\ %{})
add_exit_queue(non_neg_integer(), binary(), map()) :: tuple()
Adds an exit queue for the given vault and token address.
deposit(tx_bytes, options \\ %{})
deposit(ExPlasma.Transaction.t() | binary(), map() | list()) :: tuple()
Deposit a transaction to the contracts.
Examples
Deposit 1 ETH to the contracts.
alias ExPlasma.Client alias ExPlasma.Utxo alias ExPlasma.Transaction.Deposit
owner_address = "0x22d491Bde2303f2f43325b2108D26f1eAbA1e32b" currency_address = "0x0000000000000000000000000000000000000000"
%Utxo{owner: owner_address, currency_address: currency_address, amount: 1} |> Deposit.new() |> Client.deposit()
process_exits(exit_id, options)
process_exits(non_neg_integer(), map()) :: tuple()
Process exits in Plasma. This will allow you to process your a specific exit or a set number of exits.
start_standard_exit(tx_bytes, options)
Start a Standard Exit
- tx_bytes - The encoded hash of the transaction that created the utxo.
- owner - Who's starting the standard exit.
- utxo_pos - The position of the utxo.
- proof - The merkle proof.
- output_guard_pre_image - TBD
Example
%Utxo{owner: owner_address, currency_address: currency_address, amount: 1} |> Deposit.new() |> Transaction.encode() |> Client.start_standard_exit(%{
from: authority_address(),
utxo_pos: utxo_pos,
proof: proof
})
submit_block(block_hash, options \\ %{})
submit_block(ExPlasma.Block.t() | String.t(), map()) :: tuple()
Submits a block to the contract.
Example
input_utxo = %Utxo{blknum: 0, oindex: 0, txindex: 0} output_utxo = %Utxo{owner: owner_address, currency: currency_address, amount: 1} payment = Payment.new(%{inputs: [input_utxo], outputs: [output_utxo]})
[payment] |> Block.new() |> Client.submit_block()