Fix error modal calls. Can open a contract with a TX hash.

This commit is contained in:
Craig Everett 2025-02-27 18:58:51 +09:00
parent d9c9f2a794
commit af69159eb5
13 changed files with 50 additions and 26 deletions

View File

@ -3,8 +3,8 @@
{registered,[]},
{included_applications,[]},
{applications,[stdlib,kernel,sasl,ssl]},
{vsn,"0.3.0"},
{vsn,"0.3.1"},
{modules,[clutch,gmc_con,gmc_grids,gmc_gui,gmc_jt,
gmc_key_master,gmc_sup,gmc_v,gmc_v_netman,
gmc_v_wallman]},
gmc_key_master,gmc_sup,gmc_v,gmc_v_devman,
gmc_v_netman,gmc_v_wallman]},
{mod,{clutch,[]}}]}.

View File

@ -3,7 +3,7 @@
%%% @end
-module(clutch).
-vsn("0.3.0").
-vsn("0.3.1").
-behavior(application).
-author("Craig Everett <craigeverett@qpq.swiss>").
-copyright("QPQ AG <info@qpq.swiss>").

View File

@ -3,7 +3,7 @@
%%% @end
-module(gmc_con).
-vsn("0.3.0").
-vsn("0.3.1").
-author("Craig Everett <craigeverett@qpq.swiss>").
-copyright("QPQ AG <info@qpq.swiss>").
-license("GPL-3.0-or-later").

View File

@ -37,7 +37,7 @@
%%% @end
-module(gmc_grids).
-vsn("0.3.0").
-vsn("0.3.1").
-author("Craig Everett <craigeverett@qpq.swiss>").
-copyright("QPQ AG <info@qpq.swiss>").
-license("GPL-3.0-or-later").

View File

@ -3,7 +3,7 @@
%%% @end
-module(gmc_gui).
-vsn("0.3.0").
-vsn("0.3.1").
-author("Craig Everett <craigeverett@qpq.swiss>").
-copyright("QPQ AG <info@qpq.swiss>").
-license("GPL-3.0-or-later").

View File

@ -15,7 +15,7 @@
%%% translation library is retained).
-module(gmc_jt).
-vsn("0.3.0").
-vsn("0.3.1").
-export([read_translations/1, j/2, oneshot_j/2]).

View File

@ -8,7 +8,7 @@
%%% @end
-module(gmc_key_master).
-vsn("0.3.0").
-vsn("0.3.1").
-export([make_key/2, encode/1, decode/1]).

View File

@ -12,7 +12,7 @@
%%% @end
-module(gmc_sup).
-vsn("0.3.0").
-vsn("0.3.1").
-behaviour(supervisor).
-author("Craig Everett <craigeverett@qpq.swiss>").
-copyright("QPQ AG <info@qpq.swiss>").

View File

@ -1,5 +1,5 @@
-module(gmc_v).
-vsn("0.3.0").
-vsn("0.3.1").
-author("Craig Everett <craigeverett@qpq.swiss>").
-copyright("QPQ AG <info@qpq.swiss>").
-license("GPL-3.0-or-later").

View File

@ -1,5 +1,5 @@
-module(gmc_v_devman).
-vsn("0.3.0").
-vsn("0.3.1").
-author("Craig Everett <craigeverett@qpq.swiss>").
-copyright("QPQ AG <info@qpq.swiss>").
-license("GPL-3.0-or-later").
@ -428,12 +428,12 @@ add_code_page2(State = #s{j = J}, {file, File}) ->
add_code_page(State, {file, File}, Code);
Error ->
Message = io_lib:format(J("Opening ~p failed with: ~p"), [File, Error]),
ok = handle_troubling(Message, State),
ok = handle_troubling(State, Message),
State
end;
{error, Reason} ->
Message = io_lib:format(J("Opening ~p failed with: ~p"), [File, Reason]),
ok = handle_troubling(Message, State),
ok = handle_troubling(State, Message),
State
end;
add_code_page2(State, {hash, Address}) ->
@ -734,8 +734,20 @@ open_hash(State = #s{frame = Frame, j = J}) ->
end,
ok = wxDialog:destroy(Dialog),
case Choice of
{ok, Address} -> open_hash2(State, Address);
cancel -> State
{ok, Address = "ct_" ++ _} -> open_hash2(State, Address);
{ok, Address = "th_" ++ _} -> get_contract_from_tx(State, Address);
{ok, Turd} -> handle_troubling(State, {bad_address, Turd});
cancel -> State
end.
get_contract_from_tx(State, Address) ->
case hz:tx_info(Address) of
{ok, #{"call_info" := #{"contract_id" := Contract}}} ->
open_hash2(State, Contract);
{ok, Other} ->
handle_troubling(State, {bad_address, Other});
Error ->
handle_troubling(State, Error)
end.
open_hash2(State, Address) ->
@ -743,7 +755,7 @@ open_hash2(State, Address) ->
{ok, Source} ->
open_hash3(State, Address, Source);
Error ->
ok = handle_troubling(Error, State),
ok = handle_troubling(State, Error),
State
end.
@ -950,8 +962,20 @@ load(State = #s{frame = Frame, j = J}) ->
end,
ok = wxDialog:destroy(Dialog),
case Choice of
{ok, Address} -> load2(State, Address);
cancel -> State
{ok, Address = "ct_" ++ _} -> load2(State, Address);
{ok, Address = "th_" ++ _} -> load_from_tx(State, Address);
{ok, Turd} -> handle_troubling(State, {bad_address, Turd});
cancel -> State
end.
load_from_tx(State, Address) ->
case hz:tx_info(Address) of
{ok, #{"call_info" := #{"contract_id" := Contract}}} ->
load2(State, Contract);
{ok, Other} ->
handle_troubling(State, {bad_address, Other});
Error ->
handle_troubling(State, Error)
end.
load2(State, Address) ->
@ -959,7 +983,7 @@ load2(State, Address) ->
{ok, Source} ->
load3(State, Address, Source);
Error ->
ok = handle_troubling(Error, State),
ok = handle_troubling(State, Error),
State
end.

View File

@ -1,5 +1,5 @@
-module(gmc_v_netman).
-vsn("0.3.0").
-vsn("0.3.1").
-author("Craig Everett <zxq9@zxq9.com>").
-copyright("QPQ AG <info@qpq.swiss>").
-license("GPL-3.0-or-later").

View File

@ -1,5 +1,5 @@
-module(gmc_v_wallman).
-vsn("0.3.0").
-vsn("0.3.1").
-author("Craig Everett <zxq9@zxq9.com>").
-copyright("QPQ AG <info@qpq.swiss>").
-license("GPL-3.0-or-later").

View File

@ -2,14 +2,14 @@
{type,gui}.
{modules,[]}.
{prefix,"gmc"}.
{author,"Craig Everett"}.
{desc,"A desktop client for the Gajumaru network of blockchain networks"}.
{package_id,{"otpr","clutch",{0,3,0}}}.
{deps,[{"otpr","sophia",{9,0,0}},
{author,"Craig Everett"}.
{package_id,{"otpr","clutch",{0,3,1}}}.
{deps,[{"otpr","gmserialization",{0,1,3}},
{"otpr","sophia",{9,0,0}},
{"otpr","hakuzaru",{0,3,0}},
{"otpr","gmbytecode",{3,4,1}},
{"otpr","lom",{1,0,0}},
{"otpr","gmserialization",{0,1,2}},
{"otpr","zj",{1,1,0}},
{"otpr","erl_base58",{0,1,0}},
{"otpr","eblake2",{1,0,0}},