Move sign, spend, account decode, etc to lib

This commit is contained in:
2025-03-05 22:29:30 +09:00
parent b6cb79d81e
commit 10e3a0b1c3
2 changed files with 177 additions and 35 deletions
+2 -21
View File
@@ -16,8 +16,7 @@
-license("MIT").
%% Admin functions
-export([network_id/0, network_id/1,
tls/0, tls/1,
-export([tls/0, tls/1,
chain_nodes/0, chain_nodes/1,
timeout/0, timeout/1]).
@@ -44,8 +43,7 @@
req = none :: none | binary()}).
-record(s,
{network_id = "gm_mainnet" :: string(),
tls = false :: boolean(),
{tls = false :: boolean(),
chain_nodes = {[], []} :: {[hz:chain_node()], [hz:chain_node()]},
sticky = none :: none | hz:chain_node(),
fetchers = [] :: [#fetcher{}],
@@ -58,19 +56,6 @@
%%% Service Interface
-spec network_id() -> Name
when Name :: hz:network_id().
network_id() ->
gen_server:call(?MODULE, network_id).
-spec network_id(Name) -> ok
when Name :: hz:network_id().
network_id(Name) ->
gen_server:cast(?MODULE, {network_id, Name}).
-spec tls() -> boolean().
@@ -163,8 +148,6 @@ init(none) ->
handle_call({request, Request}, From, State) ->
NewState = do_request(Request, From, State),
{noreply, NewState};
handle_call(network_id, _, State = #s{network_id = Name}) ->
{reply, Name, State};
handle_call(tls, _, State = #s{tls = TLS}) ->
{reply, TLS, State};
handle_call(chain_nodes, _, State = #s{chain_nodes = {Wait, Used}}) ->
@@ -177,8 +160,6 @@ handle_call(Unexpected, From, State) ->
{noreply, State}.
handle_cast({network_id, Name}, State) ->
{noreply, State#s{network_id = Name}};
handle_cast({tls, Boolean}, State) ->
NewState = do_tls(Boolean, State),
{noreply, NewState};