Current section

Files

Jump to
nimiq_rpc src nimiq_rpc@primitives@slot.erl
Raw

src/nimiq_rpc@primitives@slot.erl

-module(nimiq_rpc@primitives@slot).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src/nimiq_rpc/primitives/slot.gleam").
-export([slot_decoder/0, disabled_slots_decoder/0]).
-export_type([slot/0, disabled_slots/0]).
-type slot() :: {slot, integer(), binary(), binary()}.
-type disabled_slots() :: {disabled_slots, integer(), list(integer())}.
-file("src/nimiq_rpc/primitives/slot.gleam", 7).
-spec slot_decoder() -> gleam@dynamic@decode:decoder(slot()).
slot_decoder() ->
gleam@dynamic@decode:field(
<<"slotNumber"/utf8>>,
{decoder, fun gleam@dynamic@decode:decode_int/1},
fun(Slot_number) ->
gleam@dynamic@decode:field(
<<"validator"/utf8>>,
{decoder, fun gleam@dynamic@decode:decode_string/1},
fun(Validator) ->
gleam@dynamic@decode:field(
<<"publicKey"/utf8>>,
{decoder, fun gleam@dynamic@decode:decode_string/1},
fun(Public_key) ->
gleam@dynamic@decode:success(
{slot, Slot_number, Validator, Public_key}
)
end
)
end
)
end
).
-file("src/nimiq_rpc/primitives/slot.gleam", 18).
-spec disabled_slots_decoder() -> gleam@dynamic@decode:decoder(disabled_slots()).
disabled_slots_decoder() ->
gleam@dynamic@decode:field(
<<"blockNumber"/utf8>>,
{decoder, fun gleam@dynamic@decode:decode_int/1},
fun(Block_number) ->
gleam@dynamic@decode:field(
<<"disabled"/utf8>>,
gleam@dynamic@decode:list(
{decoder, fun gleam@dynamic@decode:decode_int/1}
),
fun(Disabled) ->
gleam@dynamic@decode:success(
{disabled_slots, Block_number, Disabled}
)
end
)
end
).