GajuDesk/include/gmc.hrl
2024-10-07 22:18:54 +09:00

84 lines
2.8 KiB
Erlang

% Node, Chain and Net represent the physical network.
-record(node,
{ip = {161,97,102,143} :: inet:ip_address(),
external = 3013 :: 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 = "mint.devnet" :: string(),
coins = ["gaju"] :: [string()],
nodes = [#node{}] :: [#node{}]}).
-record(net,
{id = "devnet" :: string(),
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 = "mint.devnet" :: string(),
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 = [{"mint.devnet", 0}] :: [{Chain :: string(), non_neg_integer()}]}).
-record(poa,
{name = "" :: string(),
id = <<>> :: clutch:id(),
balances = [#balance{}] :: [#balance{}],
history = [] :: [clutch:tx()],
checked = never :: never | clutch:ts()}).
-record(key,
{name = "" :: string(),
id = <<>> :: clutch:id(),
pair = #{} :: #{public := binary(), secret := binary()},
type = {{eddsa, ed25519}, 256} :: {Cipher :: term(), Size :: pos_integer()}}).
-record(tx,
{id = none :: none | clutch:id(),
amount = 0 :: non_neg_integer(),
type = spend :: spend | atom()}).
-record(spend_tx,
{sender_id = <<>> :: clutch:id(),
recipient_id = <<>> :: clutch: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 = 1 :: integer(),
poas = [] :: [#poa{}],
keys = [] :: [#key{}],
pass = none :: none | binary(),
network_id = <<"mint.devnet">> :: binary(),
chains = [#chain{}] :: [#chain{}]}).