Merge branch 'uw-native_tokens' into 'master'

Add native_token encoding support

See merge request ioecs/aeserialization!23
This commit is contained in:
Ulf Wiger 2024-07-26 11:36:12 +00:00
commit c0bf7b5b74
6 changed files with 25 additions and 3 deletions

View File

@ -1,4 +1,4 @@
{erl_opts, [debug_info]}.
{deps, [ {base58, {git, "https://github.com/aeternity/erl-base58.git", {ref, "60a3356"}}}
, {enacl, {git, "https://github.com/aeternity/enacl.git", {ref, "67fceef"}}}
, {enacl, {git, "https://gitlab.com/ioecs/enacl.git", {ref, "4eb7ec70"}}}
]}.

View File

@ -3,6 +3,6 @@
{ref,"60a335668a60328a29f9731b67c4a0e9e3d50ab6"}},
0},
{<<"enacl">>,
{git,"https://github.com/aeternity/enacl.git",
{ref,"67fceef42c0d055570f2e67b571f8d1f8de2f204"}},
{git,"https://gitlab.com/ioecs/enacl.git",
{ref,"4eb7ec70084ba7c87b1af8797c4c4e90c84f95a2"}},
0}].

View File

@ -35,6 +35,7 @@
| associate_chain
| signature
| name
| native_token
| commitment
| peer_pubkey
| state
@ -170,6 +171,7 @@ id2type(channel) -> channel;
id2type(commitment) -> commitment;
id2type(contract) -> contract_pubkey;
id2type(name) -> name;
id2type(native_token) -> native_token;
id2type(oracle) -> oracle_pubkey.
type2id(account_pubkey) -> account;
@ -178,6 +180,7 @@ type2id(channel) -> channel;
type2id(commitment) -> commitment;
type2id(contract_pubkey) -> contract;
type2id(name) -> name;
type2id(native_token) -> native_token;
type2id(oracle_pubkey) -> oracle.
type2enc(key_block_hash) -> ?BASE58;
@ -204,6 +207,7 @@ type2enc(signature) -> ?BASE58;
type2enc(commitment) -> ?BASE58;
type2enc(peer_pubkey) -> ?BASE58;
type2enc(name) -> ?BASE58;
type2enc(native_token) -> ?BASE58;
type2enc(state) -> ?BASE64;
type2enc(poi) -> ?BASE64;
type2enc(state_trees) -> ?BASE64;
@ -237,6 +241,7 @@ type2pfx(signature) -> <<"sg">>;
type2pfx(commitment) -> <<"cm">>;
type2pfx(peer_pubkey) -> <<"pp">>;
type2pfx(name) -> <<"nm">>;
type2pfx(native_token) -> <<"nt">>;
type2pfx(state) -> <<"st">>;
type2pfx(poi) -> <<"pi">>;
type2pfx(state_trees) -> <<"ss">>;
@ -269,6 +274,7 @@ pfx2type(<<"sg">>) -> signature;
pfx2type(<<"cm">>) -> commitment;
pfx2type(<<"pp">>) -> peer_pubkey;
pfx2type(<<"nm">>) -> name;
pfx2type(<<"nt">>) -> native_token;
pfx2type(<<"st">>) -> state;
pfx2type(<<"pi">>) -> poi;
pfx2type(<<"ss">>) -> state_trees;
@ -301,6 +307,7 @@ byte_size_for_type(account_seckey) -> 32;
byte_size_for_type(associate_chain) -> 32;
byte_size_for_type(signature) -> 64;
byte_size_for_type(name) -> not_applicable;
byte_size_for_type(native_token) -> 32;
byte_size_for_type(commitment) -> 32;
byte_size_for_type(peer_pubkey) -> 32;
byte_size_for_type(state) -> 32;

View File

@ -105,6 +105,12 @@ tag(micro_block) -> 101;
tag(light_micro_block) -> 102;
tag(testimony) -> 110;
tag(testimony_tx) -> 111;
tag(nt_native_token) -> 120;
tag(nt_create_tx) -> 121;
tag(nt_mint_tx) -> 122;
tag(nt_finalize_tx) -> 123;
tag(nt_trade_tx) -> 124;
tag(nt_burn_tx) -> 125;
tag(pof) -> 200.
rev_tag(10) -> account;
@ -176,4 +182,10 @@ rev_tag(101) -> micro_block;
rev_tag(102) -> light_micro_block;
rev_tag(110) -> testimony;
rev_tag(111) -> testimony_tx;
rev_tag(120) -> nt_native_token;
rev_tag(121) -> nt_create_tx;
rev_tag(122) -> nt_mint_tx;
rev_tag(123) -> nt_finalize_tx;
rev_tag(124) -> nt_trade_tx;
rev_tag(125) -> nt_burn_tx;
rev_tag(200) -> pof.

View File

@ -103,6 +103,7 @@ encode_tag(oracle) -> 4;
encode_tag(contract) -> 5;
encode_tag(channel) -> 6;
encode_tag(associate_chain) -> 7;
encode_tag(native_token) -> 8;
encode_tag(Other) -> error({illegal_id_tag_name, Other}).
decode_tag(1) -> account;
@ -112,4 +113,5 @@ decode_tag(4) -> oracle;
decode_tag(5) -> contract;
decode_tag(6) -> channel;
decode_tag(7) -> associate_chain;
decode_tag(8) -> native_token;
decode_tag(X) -> error({illegal_id_tag, X}).

View File

@ -20,6 +20,7 @@
, {account_pubkey , 32}
, {signature , 64}
, {name , not_applicable}
, {native_token , 32}
, {commitment , 32}
, {peer_pubkey , 32}
, {state , 32}