Packages

Ethereum library for Gleam - JSON-RPC client, transaction signing, ABI encoding, and wallet management on the BEAM

Current section

Files

Jump to
gleeth src gleeth@commands@balance.erl
Raw

src/gleeth@commands@balance.erl

-module(gleeth@commands@balance).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src/gleeth/commands/balance.gleam").
-export([execute/3]).
-file("src/gleeth/commands/balance.gleam", 11).
-spec execute(
gleeth@provider:provider(),
list(binary()),
gleam@option:option(binary())
) -> {ok, nil} | {error, gleeth@rpc@types:gleeth_error()}.
execute(Provider, Addresses, File) ->
case {Addresses, File} of
{[Single_address], none} ->
gleam@result:'try'(
gleeth@rpc@methods:get_balance(Provider, Single_address),
fun(Balance) ->
gleeth@ethereum@formatting:print_balance(
Single_address,
Balance
),
{ok, nil}
end
);
{_, _} ->
gleeth@commands@parallel_balance:execute_parallel(
Provider,
Addresses,
File
)
end.