Current section

Files

Jump to
nimiq_rpc src nimiq_rpc@internal@example@example.erl
Raw

src/nimiq_rpc@internal@example@example.erl

-module(nimiq_rpc@internal@example@example).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-export([main/0]).
-if(?OTP_RELEASE >= 27).
-define(MODULEDOC(Str), -moduledoc(Str)).
-define(DOC(Str), -doc(Str)).
-else.
-define(MODULEDOC(Str), -compile([])).
-define(DOC(Str), -compile([])).
-endif.
?MODULEDOC(false).
-file("src/nimiq_rpc/internal/example/example.gleam", 16).
?DOC(false).
-spec get_heights(
gleam@erlang@process:subject(nimiq_rpc@internal@fiber@src@fiber@backend:message())
) -> {integer(), integer(), integer()}.
get_heights(Client) ->
_assert_subject = begin
_pipe = Client,
nimiq_rpc@blockchain:get_block_number(_pipe)
end,
{ok, Height} = case _assert_subject of
{ok, _} -> _assert_subject;
_assert_fail ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
value => _assert_fail,
module => <<"nimiq_rpc/internal/example/example"/utf8>>,
function => <<"get_heights"/utf8>>,
line => 17})
end,
gleam@io:debug(Height),
_assert_subject@1 = begin
_pipe@1 = Client,
nimiq_rpc@blockchain:get_batch_number(_pipe@1)
end,
{ok, Batch} = case _assert_subject@1 of
{ok, _} -> _assert_subject@1;
_assert_fail@1 ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
value => _assert_fail@1,
module => <<"nimiq_rpc/internal/example/example"/utf8>>,
function => <<"get_heights"/utf8>>,
line => 20})
end,
gleam@io:debug(Batch),
{Height, Batch, 0}.
-file("src/nimiq_rpc/internal/example/example.gleam", 29).
?DOC(false).
-spec get_accounts(
gleam@erlang@process:subject(nimiq_rpc@internal@fiber@src@fiber@backend:message())
) -> nimiq_rpc@primitives@account:account().
get_accounts(Client) ->
_assert_subject = begin
_pipe = Client,
nimiq_rpc@blockchain:get_account_by_address(
_pipe,
<<"NQ07 0000 0000 0000 0000 0000 0000 0000 0000"/utf8>>
)
end,
{ok, Basic_account} = case _assert_subject of
{ok, _} -> _assert_subject;
_assert_fail ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
value => _assert_fail,
module => <<"nimiq_rpc/internal/example/example"/utf8>>,
function => <<"get_accounts"/utf8>>,
line => 30})
end,
_ = case Basic_account of
{basic, _, _} ->
gleam@io:debug(Basic_account);
_ ->
erlang:error(#{gleam_error => panic,
message => <<"Expected Basic account"/utf8>>,
module => <<"nimiq_rpc/internal/example/example"/utf8>>,
function => <<"get_accounts"/utf8>>,
line => 39})
end,
_assert_subject@1 = begin
_pipe@1 = Client,
nimiq_rpc@blockchain:get_account_by_address(
_pipe@1,
<<"NQ37 JJN3 P9QA EP99 JFPP HVHH CNL9 QG4R 7L7D"/utf8>>
)
end,
{ok, Vesting_contract} = case _assert_subject@1 of
{ok, _} -> _assert_subject@1;
_assert_fail@1 ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
value => _assert_fail@1,
module => <<"nimiq_rpc/internal/example/example"/utf8>>,
function => <<"get_accounts"/utf8>>,
line => 42})
end,
_ = case Vesting_contract of
{vesting, _, _, _, _, _, _, _} ->
gleam@io:debug(Vesting_contract);
_ ->
erlang:error(#{gleam_error => panic,
message => <<"Expected Vesting account"/utf8>>,
module => <<"nimiq_rpc/internal/example/example"/utf8>>,
function => <<"get_accounts"/utf8>>,
line => 51})
end,
_assert_subject@2 = begin
_pipe@2 = Client,
nimiq_rpc@blockchain:get_account_by_address(
_pipe@2,
<<"NQ04 0F84 VMAQ EN3H YDYP 4B9R XSRB 6XD2 CPSM"/utf8>>
)
end,
{ok, Htlc_contract} = case _assert_subject@2 of
{ok, _} -> _assert_subject@2;
_assert_fail@2 ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
value => _assert_fail@2,
module => <<"nimiq_rpc/internal/example/example"/utf8>>,
function => <<"get_accounts"/utf8>>,
line => 54})
end,
_ = case Htlc_contract of
{htlc, _, _, _, _, _, _, _, _} ->
gleam@io:debug(Htlc_contract);
_ ->
erlang:error(#{gleam_error => panic,
message => <<"Expected HTLC account"/utf8>>,
module => <<"nimiq_rpc/internal/example/example"/utf8>>,
function => <<"get_accounts"/utf8>>,
line => 63})
end,
_assert_subject@3 = begin
_pipe@3 = Client,
nimiq_rpc@blockchain:get_account_by_address(
_pipe@3,
<<"NQ77 0000 0000 0000 0000 0000 0000 0000 0001"/utf8>>
)
end,
{ok, Staking_contract} = case _assert_subject@3 of
{ok, _} -> _assert_subject@3;
_assert_fail@3 ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
value => _assert_fail@3,
module => <<"nimiq_rpc/internal/example/example"/utf8>>,
function => <<"get_accounts"/utf8>>,
line => 66})
end,
_ = case Staking_contract of
{staking, _, _} ->
gleam@io:debug(Staking_contract);
_ ->
erlang:error(#{gleam_error => panic,
message => <<"Expected Staking account"/utf8>>,
module => <<"nimiq_rpc/internal/example/example"/utf8>>,
function => <<"get_accounts"/utf8>>,
line => 75})
end.
-file("src/nimiq_rpc/internal/example/example.gleam", 79).
?DOC(false).
-spec get_transactions(
gleam@erlang@process:subject(nimiq_rpc@internal@fiber@src@fiber@backend:message())
) -> integer().
get_transactions(Client) ->
_assert_subject = begin
_pipe = Client,
nimiq_rpc@blockchain:get_transaction_hashes_by_address(
_pipe,
<<"NQ07 0000 0000 0000 0000 0000 0000 0000 0000"/utf8>>,
{some, 1},
none
)
end,
{ok, Hashes} = case _assert_subject of
{ok, _} -> _assert_subject;
_assert_fail ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
value => _assert_fail,
module => <<"nimiq_rpc/internal/example/example"/utf8>>,
function => <<"get_transactions"/utf8>>,
line => 80})
end,
gleam@io:debug(Hashes),
_assert_subject@1 = begin
_pipe@1 = Client,
nimiq_rpc@blockchain:get_transaction_by_hash(
_pipe@1,
begin
_pipe@2 = Hashes,
_pipe@3 = gleam@list:first(_pipe@2),
gleam@result:unwrap(_pipe@3, <<""/utf8>>)
end
)
end,
{ok, Transaction} = case _assert_subject@1 of
{ok, _} -> _assert_subject@1;
_assert_fail@1 ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
value => _assert_fail@1,
module => <<"nimiq_rpc/internal/example/example"/utf8>>,
function => <<"get_transactions"/utf8>>,
line => 89})
end,
gleam@io:debug(Transaction),
_assert_subject@2 = begin
_pipe@4 = Client,
nimiq_rpc@blockchain:get_transactions_by_block_number(
_pipe@4,
erlang:element(4, Transaction)
)
end,
{ok, Transactions} = case _assert_subject@2 of
{ok, _} -> _assert_subject@2;
_assert_fail@2 ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
value => _assert_fail@2,
module => <<"nimiq_rpc/internal/example/example"/utf8>>,
function => <<"get_transactions"/utf8>>,
line => 96})
end,
gleam@io:debug(
begin
_pipe@5 = Transactions,
erlang:length(_pipe@5)
end
),
_assert_subject@3 = begin
_pipe@6 = Client,
nimiq_rpc@blockchain:get_transactions_by_address(
_pipe@6,
erlang:element(8, Transaction),
{some, 1},
none
)
end,
{ok, Transactions@1} = case _assert_subject@3 of
{ok, _} -> _assert_subject@3;
_assert_fail@3 ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
value => _assert_fail@3,
module => <<"nimiq_rpc/internal/example/example"/utf8>>,
function => <<"get_transactions"/utf8>>,
line => 101})
end,
gleam@io:debug(
begin
_pipe@7 = Transactions@1,
erlang:length(_pipe@7)
end
).
-file("src/nimiq_rpc/internal/example/example.gleam", 107).
?DOC(false).
-spec get_slots(
gleam@erlang@process:subject(nimiq_rpc@internal@fiber@src@fiber@backend:message()),
integer()
) -> integer().
get_slots(Client, Height) ->
_assert_subject = begin
_pipe = Client,
nimiq_rpc@blockchain:get_slot_at(_pipe, Height, none)
end,
{ok, Slot} = case _assert_subject of
{ok, _} -> _assert_subject;
_assert_fail ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
value => _assert_fail,
module => <<"nimiq_rpc/internal/example/example"/utf8>>,
function => <<"get_slots"/utf8>>,
line => 108})
end,
gleam@io:debug(Slot),
_assert_subject@1 = begin
_pipe@1 = Client,
nimiq_rpc@blockchain:get_current_penalized_slots(_pipe@1)
end,
{ok, Slots} = case _assert_subject@1 of
{ok, _} -> _assert_subject@1;
_assert_fail@1 ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
value => _assert_fail@1,
module => <<"nimiq_rpc/internal/example/example"/utf8>>,
function => <<"get_slots"/utf8>>,
line => 111})
end,
gleam@io:debug(
begin
_pipe@2 = erlang:element(3, Slots),
erlang:length(_pipe@2)
end
),
_assert_subject@2 = begin
_pipe@3 = Client,
nimiq_rpc@blockchain:get_previous_penalized_slots(_pipe@3)
end,
{ok, Slots@1} = case _assert_subject@2 of
{ok, _} -> _assert_subject@2;
_assert_fail@2 ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
value => _assert_fail@2,
module => <<"nimiq_rpc/internal/example/example"/utf8>>,
function => <<"get_slots"/utf8>>,
line => 114})
end,
gleam@io:debug(
begin
_pipe@4 = erlang:element(3, Slots@1),
erlang:length(_pipe@4)
end
).
-file("src/nimiq_rpc/internal/example/example.gleam", 118).
?DOC(false).
-spec get_validator(
gleam@erlang@process:subject(nimiq_rpc@internal@fiber@src@fiber@backend:message())
) -> nimiq_rpc@primitives@validator:validator().
get_validator(Client) ->
_assert_subject = begin
_pipe = Client,
nimiq_rpc@blockchain:get_validator_by_address(
_pipe,
<<"NQ57 UQJL 5A3H N45M 1FHS 2454 C7L5 BTE6 KEU1"/utf8>>
)
end,
{ok, Validator} = case _assert_subject of
{ok, _} -> _assert_subject;
_assert_fail ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
value => _assert_fail,
module => <<"nimiq_rpc/internal/example/example"/utf8>>,
function => <<"get_validator"/utf8>>,
line => 119})
end,
gleam@io:debug(Validator).
-file("src/nimiq_rpc/internal/example/example.gleam", 127).
?DOC(false).
-spec get_staker(
gleam@erlang@process:subject(nimiq_rpc@internal@fiber@src@fiber@backend:message())
) -> nimiq_rpc@primitives@staker:staker().
get_staker(Client) ->
_assert_subject = begin
_pipe = Client,
nimiq_rpc@blockchain:get_staker_by_address(
_pipe,
<<"NQ96 A1CY 9EXQ P2AR F12X 883K L14S QV44 3HUH"/utf8>>
)
end,
{ok, Staker} = case _assert_subject of
{ok, _} -> _assert_subject;
_assert_fail ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
value => _assert_fail,
module => <<"nimiq_rpc/internal/example/example"/utf8>>,
function => <<"get_staker"/utf8>>,
line => 128})
end,
gleam@io:debug(Staker).
-file("src/nimiq_rpc/internal/example/example.gleam", 136).
?DOC(false).
-spec get_blocks(
gleam@erlang@process:subject(nimiq_rpc@internal@fiber@src@fiber@backend:message())
) -> nil.
get_blocks(Client) ->
_assert_subject = begin
_pipe = Client,
nimiq_rpc@blockchain:get_latest_block(_pipe, {some, false})
end,
{ok, Head} = case _assert_subject of
{ok, _} -> _assert_subject;
_assert_fail ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
value => _assert_fail,
module => <<"nimiq_rpc/internal/example/example"/utf8>>,
function => <<"get_blocks"/utf8>>,
line => 137})
end,
gleam@io:debug(Head),
Is_election_block@2 = case Head of
{micro, _, _, _, _, _, _, Head_height, _, _, _, _, _, _, _, _, _, _, _} ->
_assert_subject@1 = begin
_pipe@1 = Client,
nimiq_rpc@policy:get_last_macro_block(_pipe@1, Head_height)
end,
{ok, Macro_height} = case _assert_subject@1 of
{ok, _} -> _assert_subject@1;
_assert_fail@1 ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
value => _assert_fail@1,
module => <<"nimiq_rpc/internal/example/example"/utf8>>,
function => <<"get_blocks"/utf8>>,
line => 141})
end,
_assert_subject@2 = begin
_pipe@2 = Client,
nimiq_rpc@blockchain:get_block_by_number(
_pipe@2,
Macro_height,
{some, false}
)
end,
{ok, Macro_block} = case _assert_subject@2 of
{ok, _} -> _assert_subject@2;
_assert_fail@2 ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
value => _assert_fail@2,
module => <<"nimiq_rpc/internal/example/example"/utf8>>,
function => <<"get_blocks"/utf8>>,
line => 143})
end,
gleam@io:debug(Macro_block),
case Macro_block of
{macro,
_,
_,
_,
_,
_,
_,
_,
_,
_,
_,
_,
_,
_,
_,
_,
Is_election_block,
_,
_,
_,
_,
_} ->
Is_election_block;
_ ->
false
end;
{macro,
_,
_,
_,
_,
_,
_,
Head_height@1,
_,
_,
_,
_,
_,
_,
_,
_,
Is_election_block@1,
_,
_,
_,
_,
_} ->
_assert_subject@3 = begin
_pipe@3 = Client,
nimiq_rpc@blockchain:get_block_by_number(
_pipe@3,
Head_height@1 - 1,
{some, false}
)
end,
{ok, Micro_block} = case _assert_subject@3 of
{ok, _} -> _assert_subject@3;
_assert_fail@3 ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
value => _assert_fail@3,
module => <<"nimiq_rpc/internal/example/example"/utf8>>,
function => <<"get_blocks"/utf8>>,
line => 153})
end,
gleam@io:debug(Micro_block),
Is_election_block@1
end,
case Is_election_block@2 of
true ->
nil;
false ->
_assert_subject@4 = begin
_pipe@4 = Client,
nimiq_rpc@policy:get_last_election_block(
_pipe@4,
erlang:element(8, Head)
)
end,
{ok, Election_head} = case _assert_subject@4 of
{ok, _} -> _assert_subject@4;
_assert_fail@4 ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
value => _assert_fail@4,
module => <<"nimiq_rpc/internal/example/example"/utf8>>,
function => <<"get_blocks"/utf8>>,
line => 166})
end,
_assert_subject@5 = begin
_pipe@5 = Client,
nimiq_rpc@blockchain:get_block_by_number(
_pipe@5,
Election_head,
{some, false}
)
end,
{ok, Election_block} = case _assert_subject@5 of
{ok, _} -> _assert_subject@5;
_assert_fail@5 ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
value => _assert_fail@5,
module => <<"nimiq_rpc/internal/example/example"/utf8>>,
function => <<"get_blocks"/utf8>>,
line => 168})
end,
gleam@io:debug(Election_block),
nil
end.
-file("src/nimiq_rpc/internal/example/example.gleam", 176).
?DOC(false).
-spec get_inherents(
gleam@erlang@process:subject(nimiq_rpc@internal@fiber@src@fiber@backend:message()),
integer()
) -> integer().
get_inherents(Client, Batch) ->
_assert_subject = begin
_pipe = Client,
nimiq_rpc@blockchain:get_inherents_by_batch_number(_pipe, Batch - 1)
end,
{ok, Inherents} = case _assert_subject of
{ok, _} -> _assert_subject;
_assert_fail ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
value => _assert_fail,
module => <<"nimiq_rpc/internal/example/example"/utf8>>,
function => <<"get_inherents"/utf8>>,
line => 177})
end,
gleam@io:debug(
begin
_pipe@1 = Inherents,
erlang:length(_pipe@1)
end
).
-file("src/nimiq_rpc/internal/example/example.gleam", 182).
?DOC(false).
-spec get_policy(
gleam@erlang@process:subject(nimiq_rpc@internal@fiber@src@fiber@backend:message()),
integer()
) -> {ok, boolean()} | {error, binary()}.
get_policy(Client, Height) ->
_assert_subject = begin
_pipe = Client,
nimiq_rpc@policy:get_policy_constants(_pipe)
end,
{ok, Constants} = case _assert_subject of
{ok, _} -> _assert_subject;
_assert_fail ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
value => _assert_fail,
module => <<"nimiq_rpc/internal/example/example"/utf8>>,
function => <<"get_policy"/utf8>>,
line => 183})
end,
gleam@io:debug(Constants),
_assert_subject@1 = begin
_pipe@1 = Client,
nimiq_rpc@policy:get_election_block_before(_pipe@1, Height)
end,
{ok, Election_height} = case _assert_subject@1 of
{ok, _} -> _assert_subject@1;
_assert_fail@1 ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
value => _assert_fail@1,
module => <<"nimiq_rpc/internal/example/example"/utf8>>,
function => <<"get_policy"/utf8>>,
line => 186})
end,
_assert_subject@2 = begin
_pipe@2 = Client,
nimiq_rpc@policy:is_election_block_at(_pipe@2, Election_height)
end,
{ok, true} = case _assert_subject@2 of
{ok, true} -> _assert_subject@2;
_assert_fail@2 ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
value => _assert_fail@2,
module => <<"nimiq_rpc/internal/example/example"/utf8>>,
function => <<"get_policy"/utf8>>,
line => 188})
end,
_assert_subject@3 = begin
_pipe@3 = Client,
nimiq_rpc@policy:is_election_block_at(_pipe@3, Election_height - 1)
end,
{ok, false} = case _assert_subject@3 of
{ok, false} -> _assert_subject@3;
_assert_fail@3 ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
value => _assert_fail@3,
module => <<"nimiq_rpc/internal/example/example"/utf8>>,
function => <<"get_policy"/utf8>>,
line => 189})
end,
_assert_subject@4 = begin
_pipe@4 = Client,
nimiq_rpc@policy:is_macro_block_at(_pipe@4, Election_height)
end,
{ok, true} = case _assert_subject@4 of
{ok, true} -> _assert_subject@4;
_assert_fail@4 ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
value => _assert_fail@4,
module => <<"nimiq_rpc/internal/example/example"/utf8>>,
function => <<"get_policy"/utf8>>,
line => 191})
end,
_assert_subject@5 = begin
_pipe@5 = Client,
nimiq_rpc@policy:is_macro_block_at(_pipe@5, Election_height - 1)
end,
{ok, false} = case _assert_subject@5 of
{ok, false} -> _assert_subject@5;
_assert_fail@5 ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
value => _assert_fail@5,
module => <<"nimiq_rpc/internal/example/example"/utf8>>,
function => <<"get_policy"/utf8>>,
line => 192})
end,
_assert_subject@6 = begin
_pipe@6 = Client,
nimiq_rpc@policy:is_micro_block_at(_pipe@6, Election_height)
end,
{ok, false} = case _assert_subject@6 of
{ok, false} -> _assert_subject@6;
_assert_fail@6 ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
value => _assert_fail@6,
module => <<"nimiq_rpc/internal/example/example"/utf8>>,
function => <<"get_policy"/utf8>>,
line => 193})
end,
_assert_subject@7 = begin
_pipe@7 = Client,
nimiq_rpc@policy:is_micro_block_at(_pipe@7, Election_height - 1)
end,
{ok, true} = case _assert_subject@7 of
{ok, true} -> _assert_subject@7;
_assert_fail@7 ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
value => _assert_fail@7,
module => <<"nimiq_rpc/internal/example/example"/utf8>>,
function => <<"get_policy"/utf8>>,
line => 194})
end.
-file("src/nimiq_rpc/internal/example/example.gleam", 197).
?DOC(false).
-spec main() -> {ok, boolean()} | {error, binary()}.
main() ->
_pipe = dot_env:new_with_path(
<<"src/nimiq_rpc/internal/example/.env"/utf8>>
),
dot_env:load(_pipe),
_assert_subject = dot_env_ffi:get_env(<<"RPC_URL"/utf8>>),
{ok, Url} = case _assert_subject of
{ok, _} -> _assert_subject;
_assert_fail ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
value => _assert_fail,
module => <<"nimiq_rpc/internal/example/example"/utf8>>,
function => <<"main"/utf8>>,
line => 200})
end,
_assert_subject@1 = dot_env_ffi:get_env(<<"RPC_USERNAME"/utf8>>),
{ok, Username} = case _assert_subject@1 of
{ok, _} -> _assert_subject@1;
_assert_fail@1 ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
value => _assert_fail@1,
module => <<"nimiq_rpc/internal/example/example"/utf8>>,
function => <<"main"/utf8>>,
line => 201})
end,
_assert_subject@2 = dot_env_ffi:get_env(<<"RPC_PASSWORD"/utf8>>),
{ok, Password} = case _assert_subject@2 of
{ok, _} -> _assert_subject@2;
_assert_fail@2 ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
value => _assert_fail@2,
module => <<"nimiq_rpc/internal/example/example"/utf8>>,
function => <<"main"/utf8>>,
line => 202})
end,
Client = nimiq_rpc:client_with_auth(Url, Username, Password),
{Height, Batch, _} = get_heights(Client),
get_accounts(Client),
get_transactions(Client),
get_slots(Client, Height),
get_validator(Client),
get_staker(Client),
get_blocks(Client),
get_inherents(Client, Batch),
get_policy(Client, Height).