From c31bcac249ccba6411bc522bdbdbc7943680653a Mon Sep 17 00:00:00 2001 From: Dimitar Ivanov Date: Fri, 26 Jul 2024 13:38:58 +0300 Subject: [PATCH] Add entries --- src/aeser_api_encoder.erl | 7 +++++++ src/aeser_chain_objects.erl | 10 ++++++++++ src/aeser_id.erl | 7 +++++-- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/aeser_api_encoder.erl b/src/aeser_api_encoder.erl index ec449cb..5e081df 100644 --- a/src/aeser_api_encoder.erl +++ b/src/aeser_api_encoder.erl @@ -33,6 +33,7 @@ | account_pubkey | account_seckey | associate_chain + | entry | signature | name | native_token @@ -172,6 +173,7 @@ id2type(commitment) -> commitment; id2type(contract) -> contract_pubkey; id2type(name) -> name; id2type(native_token) -> native_token; +id2type(entry) -> entry; id2type(oracle) -> oracle_pubkey. type2id(account_pubkey) -> account; @@ -181,6 +183,7 @@ type2id(commitment) -> commitment; type2id(contract_pubkey) -> contract; type2id(name) -> name; type2id(native_token) -> native_token; +type2id(entry) -> entry; type2id(oracle_pubkey) -> oracle. type2enc(key_block_hash) -> ?BASE58; @@ -214,6 +217,7 @@ type2enc(state_trees) -> ?BASE64; type2enc(call_state_tree) -> ?BASE64; type2enc(mp_tree_hash) -> ?BASE58; type2enc(hash) -> ?BASE58; +type2enc(entry) -> ?BASE64; type2enc(bytearray) -> ?BASE64. @@ -248,6 +252,7 @@ type2pfx(state_trees) -> <<"ss">>; type2pfx(call_state_tree) -> <<"cs">>; type2pfx(mp_tree_hash) -> <<"mt">>; type2pfx(hash) -> <<"hs">>; +type2pfx(entry) -> <<"en">>; type2pfx(bytearray) -> <<"ba">>. pfx2type(<<"kh">>) -> key_block_hash; @@ -281,6 +286,7 @@ pfx2type(<<"ss">>) -> state_trees; pfx2type(<<"cs">>) -> call_state_tree; pfx2type(<<"mt">>) -> mp_tree_hash; pfx2type(<<"hs">>) -> hash; +pfx2type(<<"en">>) -> entry; pfx2type(<<"ba">>) -> bytearray. -spec byte_size_for_type(known_type()) -> non_neg_integer() | not_applicable. @@ -316,6 +322,7 @@ byte_size_for_type(state_trees) -> not_applicable; byte_size_for_type(call_state_tree) -> not_applicable; byte_size_for_type(mp_tree_hash) -> 32; byte_size_for_type(hash) -> 32; +byte_size_for_type(entry) -> not_applicable; byte_size_for_type(bytearray) -> not_applicable. diff --git a/src/aeser_chain_objects.erl b/src/aeser_chain_objects.erl index 8743a2e..79e5e56 100644 --- a/src/aeser_chain_objects.erl +++ b/src/aeser_chain_objects.erl @@ -88,6 +88,7 @@ tag(nameservice_mtree) -> 624; tag(oracles_mtree) -> 625; tag(accounts_mtree) -> 626; tag(acs_mtree) -> 627; +tag(entries_mtree) -> 628; tag(compiler_sophia) -> 70; tag(ga_attach_tx) -> 80; tag(ga_meta_tx) -> 81; @@ -111,6 +112,10 @@ tag(nt_mint_tx) -> 122; tag(nt_finalize_tx) -> 123; tag(nt_trade_tx) -> 124; tag(nt_burn_tx) -> 125; +tag(entry) -> 140; +tag(entry_create_tx) -> 141; +tag(entry_transfer_tx) -> 142; +tag(entry_destroy_tx) -> 143; tag(pof) -> 200. rev_tag(10) -> account; @@ -165,6 +170,7 @@ rev_tag(624) -> nameservice_mtree; rev_tag(625) -> oracles_mtree; rev_tag(626) -> accounts_mtree; rev_tag(627) -> acs_mtree; +rev_tag(628) -> entries_mtree; rev_tag(70) -> compiler_sophia; rev_tag(80) -> ga_attach_tx; rev_tag(81) -> ga_meta_tx; @@ -188,4 +194,8 @@ 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(140) -> entry; +rev_tag(141) -> entry_create_tx; +rev_tag(142) -> entry_transfer_tx; +rev_tag(143) -> entry_destroy_tx; rev_tag(200) -> pof. diff --git a/src/aeser_id.erl b/src/aeser_id.erl index ba47beb..3c354fd 100644 --- a/src/aeser_id.erl +++ b/src/aeser_id.erl @@ -26,7 +26,7 @@ -type tag() :: 'account' | 'oracle' | 'name' | 'commitment' | 'contract' | 'channel' - | 'associate_chain' . + | 'associate_chain' | 'entry' . -type val() :: <<_:256>>. -opaque(id() :: #id{}). @@ -45,7 +45,8 @@ ___TAG___ =:= commitment; ___TAG___ =:= contract; ___TAG___ =:= channel; - ___TAG___ =:= associate_chain + ___TAG___ =:= associate_chain; + ___TAG___ =:= entry ). -define(IS_VAL(___VAL___), byte_size(___VAL___) =:= 32). @@ -104,6 +105,7 @@ encode_tag(contract) -> 5; encode_tag(channel) -> 6; encode_tag(associate_chain) -> 7; encode_tag(native_token) -> 8; +encode_tag(entry) -> 9; encode_tag(Other) -> error({illegal_id_tag_name, Other}). decode_tag(1) -> account; @@ -114,4 +116,5 @@ decode_tag(5) -> contract; decode_tag(6) -> channel; decode_tag(7) -> associate_chain; decode_tag(8) -> native_token; +decode_tag(9) -> entry; decode_tag(X) -> error({illegal_id_tag, X}).