98 lines
3.2 KiB
Erlang
98 lines
3.2 KiB
Erlang
%% Node, Chain and Net represent the physical network.
|
|
|
|
-record(node,
|
|
{ip = {161,97,102,143} :: string() | inet:ip_address(),
|
|
external = 3013 :: none | inet:port_number(), % 3013
|
|
internal = none :: none | inet:port_number(), % 3113
|
|
rosetta = none :: none | inet:port_number(), % 8080
|
|
channel = none :: none | inet:port_number(), % 3014
|
|
mdw = none :: none | inet:port_number()}). % 4000
|
|
|
|
|
|
-record(chain,
|
|
{id = <<"groot.devnet">> :: binary(),
|
|
coins = ["gaju"] :: [string()],
|
|
nodes = [#node{}] :: [#node{}]}).
|
|
|
|
|
|
-record(net,
|
|
{id = <<"devnet">> :: binary(),
|
|
chains = [#chain{}] :: [#chain{}]}).
|
|
|
|
|
|
|
|
%% AC and Coin represent the financial authority graph for a given coin.
|
|
|
|
-record(ac,
|
|
{id = none :: string(),
|
|
acs = [] :: [#ac{}]}).
|
|
|
|
|
|
-record(coin,
|
|
{id = "gaju" :: string(),
|
|
mint = <<"groot.devnet">> :: binary(),
|
|
acs = [#ac{}] :: [#ac{}]}).
|
|
|
|
|
|
|
|
%% Balance, POA, Key, TXs, all culminate in capturing a complete Wallet view.
|
|
-record(balance,
|
|
{coin = "gaju" :: string(),
|
|
total = 0 :: non_neg_integer(),
|
|
dist = [{<<"groot.devnet">>, 0}] :: [{Chain :: binary(), non_neg_integer()}]}).
|
|
|
|
|
|
-record(poa,
|
|
{name = "" :: string(),
|
|
id = <<>> :: gajudesk:id(),
|
|
balances = [#balance{}] :: [#balance{}],
|
|
history = [] :: [gajudesk:tx()],
|
|
checked = never :: never | gajudesk:ts()}).
|
|
|
|
|
|
-record(key,
|
|
{name = "" :: string(),
|
|
id = <<>> :: gajudesk:id(),
|
|
pair = #{} :: #{public := binary(), secret := binary()},
|
|
type = {{eddsa, ed25519}, 256} :: {Cipher :: term(), Size :: pos_integer()}}).
|
|
|
|
|
|
-record(tx,
|
|
{id = none :: none | gajudesk:id(),
|
|
amount = 0 :: non_neg_integer(),
|
|
type = spend :: atom(),
|
|
status = submitted :: submitted | mined | rejected | failed,
|
|
meta = "" :: string()}).
|
|
|
|
|
|
-record(spend_tx,
|
|
{sender_id = <<>> :: gajudesk:id(),
|
|
recipient_id = <<>> :: gajudesk:id(),
|
|
amount = 0 :: non_neg_integer(),
|
|
gas_price = 0 :: non_neg_integer(),
|
|
gas = 0 :: non_neg_integer(),
|
|
ttl = 1 :: pos_integer(),
|
|
nonce = 0 :: non_neg_integer(),
|
|
payload = <<>> :: binary()}).
|
|
|
|
|
|
-record(wallet,
|
|
{version = 2 :: integer(),
|
|
name = "" :: string(),
|
|
poas = [] :: [#poa{}],
|
|
keys = [] :: [#key{}],
|
|
chain_id = <<"groot.devnet">> :: binary(),
|
|
endpoint = #node{} :: #node{},
|
|
nets = [#net{}] :: [#net{}],
|
|
txs = #{} :: gajudesk:key_txs()}).
|
|
|
|
|
|
|
|
%% Niche registered elements
|
|
|
|
% WR: Wallet Registration
|
|
-record(wr,
|
|
{name = "" :: string(),
|
|
path = "" :: file:filename(),
|
|
pass = false :: boolean()}).
|