This commit is contained in:
2026-05-14 14:52:36 +09:00
parent 903a32931d
commit c4a2f12657
5 changed files with 634 additions and 20 deletions
+17 -14
View File
@@ -54,7 +54,8 @@
-type state() :: #s{}.
-type ui_name() :: gd_v_netman
| gd_v_wallman
| gd_v_devman.
| gd_v_doomweaver
| gd_v_express.
@@ -242,8 +243,8 @@ open_contract(ConID) ->
when ConID :: string(),
DevmanToFront :: boolean().
%% @doc
%% Ask the controller to tell the devman interface to open a deployed contract.
%% The controller will start the devman if it isn't already on.
%% Ask the controller to tell the doomweaver interface to open a deployed contract.
%% The controller will start the doomweaver if it isn't already on.
open_contract(ConID, DevmanToFront) when is_binary(ConID) ->
gen_server:cast(?MODULE, {open_contract, ConID, DevmanToFront});
@@ -266,9 +267,9 @@ show_call(ConID, Info) ->
Info :: map(),
DevmanToFront :: boolean().
%% @doc
%% Ask the controller to tell the devman interface to dislpay the result of a call
%% Ask the controller to tell the doomweaver interface to dislpay the result of a call
%% to the indicated contract. Opens the contract in question if it isn't alread open.
%% Starts the devman if it isn't already running.
%% Starts the doomweaver if it isn't already running.
show_call(ConID, Info, DevmanToFront) when is_binary(ConID) ->
gen_server:cast(?MODULE, {show_call, ConID, Info, DevmanToFront});
@@ -653,13 +654,15 @@ do_show_ui(Name, ToFront, State = #s{tasks = Tasks, prefs = Prefs}) ->
State#s{tasks = [UI | Tasks]}
end.
task_data(gd_v_netman, #s{wallet = #wallet{nets = Nets}}) ->
task_data(gd_v_netman, #s{wallet = #wallet{nets = Nets}}) ->
Nets;
task_data(gd_v_netman, #s{wallet = none}) ->
task_data(gd_v_netman, #s{wallet = none}) ->
[];
task_data(gd_v_wallman, #s{wallets = Wallets}) ->
task_data(gd_v_wallman, #s{wallets = Wallets}) ->
Wallets;
task_data(gd_v_devman, #s{}) ->
task_data(gd_v_doomweaver, #s{}) ->
[];
task_data(gd_v_express, #s{}) ->
[].
@@ -1063,15 +1066,15 @@ do_drop_key(ID, State = #s{wallet = W, wallets = Wallets, pass = Pass}) ->
do_open_contract(ConID, ToFront, State) ->
NewState = do_show_ui(gd_v_devman, ToFront, State),
ok = gd_v_devman:open_contract(ConID),
NewState = do_show_ui(gd_v_doomweaver, ToFront, State),
ok = gd_v_doomweaver:open_contract(ConID),
NewState.
do_show_call(ConID, Info, ToFront, State) ->
NewState = do_show_ui(gd_v_devman, ToFront, State),
ok = gd_v_devman:open_contract(ConID),
ok = gd_v_devman:call_result(ConID, Info),
NewState = do_show_ui(gd_v_doomweaver, ToFront, State),
ok = gd_v_doomweaver:open_contract(ConID),
ok = gd_v_doomweaver:call_result(ConID, Info),
NewState.