Issue proper explorer URLs
This commit is contained in:
+1
-1
@@ -3,7 +3,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(gajudesk).
|
||||
-vsn("0.5.6").
|
||||
-vsn("0.6.0").
|
||||
-behavior(application).
|
||||
-author("Craig Everett <craigeverett@qpq.swiss>").
|
||||
-copyright("QPQ AG <info@qpq.swiss>").
|
||||
|
||||
+18
-2
@@ -3,7 +3,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(gd_con).
|
||||
-vsn("0.5.6").
|
||||
-vsn("0.6.0").
|
||||
-author("Craig Everett <craigeverett@qpq.swiss>").
|
||||
-copyright("QPQ AG <info@qpq.swiss>").
|
||||
-license("GPL-3.0-or-later").
|
||||
@@ -11,7 +11,7 @@
|
||||
-behavior(gen_server).
|
||||
-export([show_ui/1,
|
||||
open_wallet/2, close_wallet/0, new_wallet/3, import_wallet/3, drop_wallet/2,
|
||||
selected/1,
|
||||
selected/1, network/0,
|
||||
password/2,
|
||||
refresh/0,
|
||||
nonce/1, spend/1, chain/1, grids/1, sign_mess/1, sign_tx/1, sign_call/3, dry_run/2,
|
||||
@@ -112,6 +112,13 @@ selected(Index) ->
|
||||
gen_server:cast(?MODULE, {selected, Index}).
|
||||
|
||||
|
||||
-spec network() -> {ok, NetworkID} | none
|
||||
when NetworkID :: binary().
|
||||
|
||||
network() ->
|
||||
gen_server:call(?MODULE, network).
|
||||
|
||||
|
||||
-spec password(Old, New) -> ok
|
||||
when Old :: none | string(),
|
||||
New :: none | string().
|
||||
@@ -353,6 +360,9 @@ handle_call(list_keys, _, State) ->
|
||||
handle_call({nonce, ID}, _, State) ->
|
||||
Response = do_nonce(ID),
|
||||
{reply, Response, State};
|
||||
handle_call(network, _, State) ->
|
||||
Response = do_network(State),
|
||||
{reply, Response, State};
|
||||
handle_call({save, Module, Prefs}, _, State) ->
|
||||
NewState = do_save(Module, Prefs, State),
|
||||
{reply, ok, NewState};
|
||||
@@ -785,6 +795,12 @@ do_nonce(ID) ->
|
||||
hz:next_nonce(ID).
|
||||
|
||||
|
||||
do_network(#s{wallet = none}) ->
|
||||
none;
|
||||
do_network(#s{wallet = #wallet{chain_id = ChainID}}) ->
|
||||
{ok, ChainID}.
|
||||
|
||||
|
||||
|
||||
%%% State Operations
|
||||
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(gd_grids).
|
||||
-vsn("0.5.6").
|
||||
-vsn("0.6.0").
|
||||
-author("Craig Everett <craigeverett@qpq.swiss>").
|
||||
-copyright("QPQ AG <info@qpq.swiss>").
|
||||
-license("GPL-3.0-or-later").
|
||||
|
||||
+22
-10
@@ -3,7 +3,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(gd_gui).
|
||||
-vsn("0.5.6").
|
||||
-vsn("0.6.0").
|
||||
-author("Craig Everett <craigeverett@qpq.swiss>").
|
||||
-copyright("QPQ AG <info@qpq.swiss>").
|
||||
-license("GPL-3.0-or-later").
|
||||
@@ -691,15 +691,27 @@ copy_to_clipboard(String) ->
|
||||
end.
|
||||
|
||||
|
||||
www(State = #s{id = {_, #w{wx = ID_T}}}) ->
|
||||
String = wxStaticText:getLabel(ID_T),
|
||||
URL = unicode:characters_to_list(["https://aescan.io/accounts/", String]),
|
||||
ok =
|
||||
case wx_misc:launchDefaultBrowser(URL) of
|
||||
true -> log(info, "Opened in browser: ~ts", [URL]);
|
||||
false -> log(info, "Failed to open browser: ~ts", [URL])
|
||||
end,
|
||||
State.
|
||||
www(State = #s{id = {_, #w{wx = ID_T}}, j = J}) ->
|
||||
case wxStaticText:getLabel(ID_T) of
|
||||
"" ->
|
||||
ok = handle_troubling(State, J("No key selected.")),
|
||||
State;
|
||||
ID ->
|
||||
ok = www2(State, ID),
|
||||
State
|
||||
end.
|
||||
|
||||
www2(State = #s{j = J}, AccountID) ->
|
||||
case gd_con:network() of
|
||||
{ok, ChainID} ->
|
||||
URL = unicode:characters_to_list(["https://", ChainID, ".gajumaru.io/account/", AccountID]),
|
||||
case wx_misc:launchDefaultBrowser(URL) of
|
||||
true -> log(info, "Opened in browser: ~ts", [URL]);
|
||||
false -> log(info, "Failed to open browser: ~ts", [URL])
|
||||
end;
|
||||
none ->
|
||||
handle_troubling(State, J("No chain assigned."))
|
||||
end.
|
||||
|
||||
|
||||
spend(State = #s{accounts = []}) ->
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
%%% translation library is retained).
|
||||
|
||||
-module(gd_jt).
|
||||
-vsn("0.5.6").
|
||||
-vsn("0.6.0").
|
||||
-export([read_translations/1, j/2, oneshot_j/2]).
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
-module(gd_sophia_editor).
|
||||
-vsn("0.5.6").
|
||||
-vsn("0.6.0").
|
||||
-export([new/1, update/2,
|
||||
get_text/1, set_text/2]).
|
||||
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(gd_sup).
|
||||
-vsn("0.5.6").
|
||||
-vsn("0.6.0").
|
||||
-behaviour(supervisor).
|
||||
-author("Craig Everett <craigeverett@qpq.swiss>").
|
||||
-copyright("QPQ AG <info@qpq.swiss>").
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
-module(gd_v).
|
||||
-vsn("0.5.6").
|
||||
-vsn("0.6.0").
|
||||
-author("Craig Everett <craigeverett@qpq.swiss>").
|
||||
-copyright("QPQ AG <info@qpq.swiss>").
|
||||
-license("GPL-3.0-or-later").
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
-module(gd_v_devman).
|
||||
-vsn("0.5.6").
|
||||
-vsn("0.6.0").
|
||||
-author("Craig Everett <craigeverett@qpq.swiss>").
|
||||
-copyright("QPQ AG <info@qpq.swiss>").
|
||||
-license("GPL-3.0-or-later").
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
-module(gd_v_netman).
|
||||
-vsn("0.5.6").
|
||||
-vsn("0.6.0").
|
||||
-author("Craig Everett <zxq9@zxq9.com>").
|
||||
-copyright("QPQ AG <info@qpq.swiss>").
|
||||
-license("GPL-3.0-or-later").
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
-module(gd_v_wallman).
|
||||
-vsn("0.5.6").
|
||||
-vsn("0.6.0").
|
||||
-author("Craig Everett <zxq9@zxq9.com>").
|
||||
-copyright("QPQ AG <info@qpq.swiss>").
|
||||
-license("GPL-3.0-or-later").
|
||||
|
||||
Reference in New Issue
Block a user