Name change
This commit is contained in:
parent
80691524df
commit
f4a9dbcaf8
@ -1,10 +0,0 @@
|
||||
{application,clutch,
|
||||
[{description,"A desktop client for the Gajumaru network of blockchain networks"},
|
||||
{registered,[]},
|
||||
{included_applications,[]},
|
||||
{applications,[stdlib,kernel,sasl,ssl]},
|
||||
{vsn,"0.5.0"},
|
||||
{modules,[clutch,gmc_con,gmc_grids,gmc_gui,gmc_jt,
|
||||
gmc_key_master,gmc_sup,gmc_v,gmc_v_devman,
|
||||
gmc_v_netman,gmc_v_wallman]},
|
||||
{mod,{clutch,[]}}]}.
|
9
ebin/gajudesk.app
Normal file
9
ebin/gajudesk.app
Normal file
@ -0,0 +1,9 @@
|
||||
{application,gajudesk,
|
||||
[{description,"A desktop client for the Gajumaru network of blockchain networks"},
|
||||
{registered,[]},
|
||||
{included_applications,[]},
|
||||
{applications,[stdlib,kernel,sasl,ssl]},
|
||||
{vsn,"0.5.1"},
|
||||
{modules,[gajudesk,gd_con,gd_grids,gd_gui,gd_jt,gd_key_master,
|
||||
gd_sup,gd_v,gd_v_devman,gd_v_netman,gd_v_wallman]},
|
||||
{mod,{gajudesk,[]}}]}.
|
@ -44,21 +44,21 @@
|
||||
|
||||
-record(poa,
|
||||
{name = "" :: string(),
|
||||
id = <<>> :: clutch:id(),
|
||||
id = <<>> :: gajudesk:id(),
|
||||
balances = [#balance{}] :: [#balance{}],
|
||||
history = [] :: [clutch:tx()],
|
||||
checked = never :: never | clutch:ts()}).
|
||||
history = [] :: [gajudesk:tx()],
|
||||
checked = never :: never | gajudesk:ts()}).
|
||||
|
||||
|
||||
-record(key,
|
||||
{name = "" :: string(),
|
||||
id = <<>> :: clutch:id(),
|
||||
id = <<>> :: gajudesk:id(),
|
||||
pair = #{} :: #{public := binary(), secret := binary()},
|
||||
type = {{eddsa, ed25519}, 256} :: {Cipher :: term(), Size :: pos_integer()}}).
|
||||
|
||||
|
||||
-record(tx,
|
||||
{id = none :: none | clutch:id(),
|
||||
{id = none :: none | gajudesk:id(),
|
||||
amount = 0 :: non_neg_integer(),
|
||||
type = spend :: atom(),
|
||||
status = submitted :: submitted | mined | rejected | failed,
|
||||
@ -66,8 +66,8 @@
|
||||
|
||||
|
||||
-record(spend_tx,
|
||||
{sender_id = <<>> :: clutch:id(),
|
||||
recipient_id = <<>> :: clutch:id(),
|
||||
{sender_id = <<>> :: gajudesk:id(),
|
||||
recipient_id = <<>> :: gajudesk:id(),
|
||||
amount = 0 :: non_neg_integer(),
|
||||
gas_price = 0 :: non_neg_integer(),
|
||||
gas = 0 :: non_neg_integer(),
|
||||
@ -84,7 +84,7 @@
|
||||
chain_id = <<"groot.devnet">> :: binary(),
|
||||
endpoint = #node{} :: #node{},
|
||||
nets = [#net{}] :: [#net{}],
|
||||
txs = #{} :: clutch:key_txs()}).
|
||||
txs = #{} :: gajudesk:key_txs()}).
|
||||
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
%%% @doc
|
||||
%%% Clutch
|
||||
%%% GajuDesk
|
||||
%%% @end
|
||||
|
||||
-module(clutch).
|
||||
-vsn("0.5.0").
|
||||
-module(gajudesk).
|
||||
-vsn("0.5.1").
|
||||
-behavior(application).
|
||||
-author("Craig Everett <craigeverett@qpq.swiss>").
|
||||
-copyright("QPQ AG <info@qpq.swiss>").
|
||||
@ -15,7 +15,7 @@
|
||||
-export_type([id/0, key/0, poa/0, tx/0, ts/0, key_txs/0]).
|
||||
|
||||
-include("$zx_include/zx_logger.hrl").
|
||||
-include("gmc.hrl").
|
||||
-include("gd.hrl").
|
||||
|
||||
|
||||
-type id() :: binary().
|
||||
@ -37,7 +37,7 @@ ts() ->
|
||||
%% OTP, not to be called by user code.
|
||||
%%
|
||||
%% NOTE:
|
||||
%% The commented out second argument would come from ebin/clutch.app's 'mod'
|
||||
%% The commented out second argument would come from ebin/gajudesk.app's 'mod'
|
||||
%% section, which is difficult to define dynamically so is not used by default
|
||||
%% here (if you need this, you already know how to change it).
|
||||
%%
|
||||
@ -47,6 +47,7 @@ ts() ->
|
||||
%% See: http://erlang.org/doc/apps/kernel/application.html
|
||||
|
||||
start(normal, _Args) ->
|
||||
{ok, CWD} = file:get_cwd(),
|
||||
ok =
|
||||
case net_kernel:stop() of
|
||||
ok ->
|
||||
@ -60,7 +61,9 @@ start(normal, _Args) ->
|
||||
ok = application:ensure_started(hakuzaru),
|
||||
ok = application:ensure_started(zxwidgets),
|
||||
ok = application:ensure_started(sophia),
|
||||
gmc_sup:start_link().
|
||||
Result = gd_sup:start_link(),
|
||||
ok = file:set_cwd(CWD),
|
||||
Result.
|
||||
|
||||
|
||||
-spec stop(term()) -> ok.
|
@ -2,8 +2,8 @@
|
||||
%%% GajuDesk Controller
|
||||
%%% @end
|
||||
|
||||
-module(gmc_con).
|
||||
-vsn("0.5.0").
|
||||
-module(gd_con).
|
||||
-vsn("0.5.1").
|
||||
-author("Craig Everett <craigeverett@qpq.swiss>").
|
||||
-copyright("QPQ AG <info@qpq.swiss>").
|
||||
-license("GPL-3.0-or-later").
|
||||
@ -25,7 +25,7 @@
|
||||
handle_call/3, handle_cast/2, handle_info/2]).
|
||||
-include("$zx_include/zx_logger.hrl").
|
||||
|
||||
-include("gmc.hrl").
|
||||
-include("gd.hrl").
|
||||
|
||||
|
||||
%%% Type and Record Definitions
|
||||
@ -49,9 +49,9 @@
|
||||
|
||||
|
||||
-type state() :: #s{}.
|
||||
-type ui_name() :: gmc_v_netman
|
||||
| gmc_v_wallman
|
||||
| gmc_v_devman.
|
||||
-type ui_name() :: gd_v_netman
|
||||
| gd_v_wallman
|
||||
| gd_v_devman.
|
||||
|
||||
|
||||
|
||||
@ -127,7 +127,7 @@ refresh() ->
|
||||
|
||||
|
||||
-spec nonce(ID) -> {ok, Nonce} | {error, Reason}
|
||||
when ID :: clutch:id(),
|
||||
when ID :: gajudesk:id(),
|
||||
Nonce :: integer(),
|
||||
Reason :: term(). % FIXME
|
||||
|
||||
@ -136,7 +136,7 @@ nonce(ID) ->
|
||||
|
||||
|
||||
-spec spend(KeyID, TX) -> ok
|
||||
when KeyID :: clutch:id(),
|
||||
when KeyID :: gajudesk:id(),
|
||||
TX :: #spend_tx{}.
|
||||
|
||||
spend(KeyID, TX) ->
|
||||
@ -171,8 +171,8 @@ sign_tx(Request) ->
|
||||
|
||||
|
||||
-spec sign_call(ConID, PubKey, TX) -> ok
|
||||
when ConID :: clutch:id(),
|
||||
PubKey :: clutch:id(),
|
||||
when ConID :: gajudesk:id(),
|
||||
PubKey :: gajudesk:id(),
|
||||
TX :: binary().
|
||||
|
||||
sign_call(ConID, PubKey, TX) ->
|
||||
@ -180,7 +180,7 @@ sign_call(ConID, PubKey, TX) ->
|
||||
|
||||
|
||||
-spec dry_run(ConID, TX) -> ok
|
||||
when ConID :: clutch:id(),
|
||||
when ConID :: gajudesk:id(),
|
||||
TX :: binary().
|
||||
|
||||
dry_run(ConID, TX) ->
|
||||
@ -189,14 +189,14 @@ dry_run(ConID, TX) ->
|
||||
|
||||
-spec deploy(Build, Params, InitArgs) -> Result
|
||||
when Build :: map(),
|
||||
Params :: {PK :: clutch:id(),
|
||||
Params :: {PK :: gajudesk:id(),
|
||||
Nonce :: non_neg_integer(),
|
||||
TTL :: pos_integer(),
|
||||
GasP :: pos_integer(),
|
||||
Gas :: pos_integer(),
|
||||
Amount :: pos_integer()},
|
||||
InitArgs :: [Arg :: string()],
|
||||
Result :: {ok, TX_Hash :: clutch:id()}
|
||||
Result :: {ok, TX_Hash :: gajudesk:id()}
|
||||
| {error, Reason},
|
||||
Reason :: term(). % FIXME
|
||||
|
||||
@ -231,7 +231,7 @@ recover_key(Mnemonic) ->
|
||||
|
||||
|
||||
-spec mnemonic(ID) -> {ok, Mnemonic} | error
|
||||
when ID :: clutch:id(),
|
||||
when ID :: gajudesk:id(),
|
||||
Mnemonic :: string().
|
||||
|
||||
mnemonic(ID) ->
|
||||
@ -239,7 +239,7 @@ mnemonic(ID) ->
|
||||
|
||||
|
||||
-spec rename_key(ID, NewName) -> ok
|
||||
when ID :: clutch:id(),
|
||||
when ID :: gajudesk:id(),
|
||||
NewName :: string().
|
||||
|
||||
rename_key(ID, NewName) ->
|
||||
@ -247,14 +247,14 @@ rename_key(ID, NewName) ->
|
||||
|
||||
|
||||
-spec drop_key(ID) -> ok
|
||||
when ID :: clutch:id().
|
||||
when ID :: gajudesk:id().
|
||||
|
||||
drop_key(ID) ->
|
||||
gen_server:cast(?MODULE, {drop_key, ID}).
|
||||
|
||||
|
||||
-spec list_keys() -> Result
|
||||
when Result :: {ok, Selected :: non_neg_integer(), Keys :: [clutch:id()]}
|
||||
when Result :: {ok, Selected :: non_neg_integer(), Keys :: [gajudesk:id()]}
|
||||
| error.
|
||||
|
||||
list_keys() ->
|
||||
@ -302,7 +302,7 @@ save(Module, Prefs) ->
|
||||
| {shutdown, term()}
|
||||
| term().
|
||||
%% @private
|
||||
%% Called by gmc_sup.
|
||||
%% Called by gd_sup.
|
||||
|
||||
start_link() ->
|
||||
gen_server:start_link({local, ?MODULE}, ?MODULE, none, []).
|
||||
@ -314,11 +314,11 @@ init(none) ->
|
||||
ok = log(info, "Starting"),
|
||||
process_flag(sensitive, true),
|
||||
Prefs = read_prefs(),
|
||||
GUI_Prefs = maps:get(gmc_gui, Prefs, #{}),
|
||||
Window = gmc_gui:start_link(GUI_Prefs),
|
||||
GUI_Prefs = maps:get(gd_gui, Prefs, #{}),
|
||||
Window = gd_gui:start_link(GUI_Prefs),
|
||||
Wallets = get_prefs(wallets, Prefs, []),
|
||||
State = #s{window = Window, wallets = Wallets, prefs = Prefs},
|
||||
NewState = do_show_ui(gmc_v_wallman, State),
|
||||
NewState = do_show_ui(gd_v_wallman, State),
|
||||
{ok, NewState}.
|
||||
|
||||
|
||||
@ -379,8 +379,8 @@ handle_cast({open_wallet, Path, Phrase}, State) ->
|
||||
{noreply, NewState};
|
||||
handle_cast(close_wallet, State) ->
|
||||
NextState = do_close_wallet(State),
|
||||
ok = gmc_gui:show([]),
|
||||
NewState = do_show_ui(gmc_v_wallman, NextState),
|
||||
ok = gd_gui:show([]),
|
||||
NewState = do_show_ui(gd_v_wallman, NextState),
|
||||
{noreply, NewState};
|
||||
handle_cast({new_wallet, Name, Path, Password}, State) ->
|
||||
NewState = do_new_wallet(Name, Path, Password, State),
|
||||
@ -513,13 +513,13 @@ do_show_ui(Name, State = #s{tasks = Tasks, prefs = Prefs}) ->
|
||||
State#s{tasks = [UI | Tasks]}
|
||||
end.
|
||||
|
||||
task_data(gmc_v_netman, #s{wallet = #wallet{nets = Nets}}) ->
|
||||
task_data(gd_v_netman, #s{wallet = #wallet{nets = Nets}}) ->
|
||||
Nets;
|
||||
task_data(gmc_v_netman, #s{wallet = none}) ->
|
||||
task_data(gd_v_netman, #s{wallet = none}) ->
|
||||
[];
|
||||
task_data(gmc_v_wallman, #s{wallets = Wallets}) ->
|
||||
task_data(gd_v_wallman, #s{wallets = Wallets}) ->
|
||||
Wallets;
|
||||
task_data(gmc_v_devman, #s{}) ->
|
||||
task_data(gd_v_devman, #s{}) ->
|
||||
[].
|
||||
|
||||
|
||||
@ -547,7 +547,7 @@ do_set_sole_node(New = #node{ip = IP, external = Port}, State = #s{wallet = W})
|
||||
NewState = State#s{wallet = NewWallet},
|
||||
do_refresh(NewState);
|
||||
Error ->
|
||||
gmc_gui:trouble(Error),
|
||||
gd_gui:trouble(Error),
|
||||
State
|
||||
end.
|
||||
|
||||
@ -561,7 +561,7 @@ do_refresh(State = #s{wallet = #wallet{endpoint = Node}}) ->
|
||||
{ok, ChainID} ->
|
||||
do_refresh2(ChainID, State);
|
||||
Error ->
|
||||
ok = gmc_gui:trouble({do_refresh, 1, Error}),
|
||||
ok = gd_gui:trouble({do_refresh, 1, Error}),
|
||||
State
|
||||
end.
|
||||
|
||||
@ -579,7 +579,7 @@ do_refresh2(ChainID, State = #s{wallet = W = #wallet{poas = POAs}}) ->
|
||||
This#poa{balances = [Gaju]}
|
||||
end,
|
||||
NewPOAs = lists:map(CheckBalance, POAs),
|
||||
ok = gmc_gui:show(NewPOAs),
|
||||
ok = gd_gui:show(NewPOAs),
|
||||
NewW = W#wallet{chain_id = ChainID, poas = NewPOAs},
|
||||
State#s{wallet = NewW}.
|
||||
|
||||
@ -590,7 +590,7 @@ ensure_hz_set(Node = #node{ip = IP, external = Port}) ->
|
||||
case hz:status() of
|
||||
{ok, #{"network_id" := ChainID}} ->
|
||||
ok = hz:network_id(ChainID),
|
||||
ok = gmc_gui:chain(ChainID, Node),
|
||||
ok = gd_gui:chain(ChainID, Node),
|
||||
{ok, list_to_binary(ChainID)};
|
||||
{error, no_nodes} ->
|
||||
ok = hz:chain_nodes([{IP, Port}]),
|
||||
@ -613,9 +613,9 @@ ensure_hz_set(Node = #node{ip = IP, external = Port}) ->
|
||||
%%% Chain operations
|
||||
|
||||
do_grids(String) ->
|
||||
case gmc_grids:parse(String) of
|
||||
case gd_grids:parse(String) of
|
||||
{ok, Instruction} -> do_grids2(Instruction);
|
||||
Error -> gmc_gui:trouble(Error)
|
||||
Error -> gd_gui:trouble(Error)
|
||||
end.
|
||||
|
||||
do_grids2({{sign, http}, URL}) ->
|
||||
@ -623,14 +623,14 @@ do_grids2({{sign, http}, URL}) ->
|
||||
case httpc:request(URL) of
|
||||
{ok, {{_, 200, _}, _, JSON}} -> do_grids_sig(JSON, URL);
|
||||
{error, socket_closed_remotely} -> log(info, "Socket closed remotely.");
|
||||
Error -> gmc_gui:trouble(Error)
|
||||
Error -> gd_gui:trouble(Error)
|
||||
end;
|
||||
do_grids2({{sign, https}, URL}) ->
|
||||
ok = log(info, "Making request to ~p", [URL]),
|
||||
case httpc:request(URL) of
|
||||
{ok, {{_, 200, _}, _, JSON}} -> do_grids_sig(JSON, URL);
|
||||
{error, socket_closed_remotely} -> log(info, "Socket closed remotely.");
|
||||
Error -> gmc_gui:trouble(Error)
|
||||
Error -> gd_gui:trouble(Error)
|
||||
end;
|
||||
do_grids2(Instruction) ->
|
||||
tell("GRIDS: ~tp", [Instruction]).
|
||||
@ -639,15 +639,15 @@ do_grids_sig(JSON, URL) ->
|
||||
ok = log(info, "Received: ~p", [JSON]),
|
||||
case zj:decode(JSON) of
|
||||
{ok, GRIDS} -> do_grids_sig2(GRIDS#{"url" => URL});
|
||||
Error -> gmc_gui:trouble(Error)
|
||||
Error -> gd_gui:trouble(Error)
|
||||
end.
|
||||
|
||||
do_grids_sig2(Request = #{"grids" := 1, "type" := "message"}) ->
|
||||
gmc_gui:grids_mess_sig(Request);
|
||||
gd_gui:grids_mess_sig(Request);
|
||||
do_grids_sig2(Request = #{"grids" := 1, "type" := "tx"}) ->
|
||||
gmc_gui:grids_mess_sig(Request);
|
||||
gd_gui:grids_mess_sig(Request);
|
||||
do_grids_sig2(WTF) ->
|
||||
gmc_gui:trouble({trash, WTF}).
|
||||
gd_gui:trouble({trash, WTF}).
|
||||
|
||||
|
||||
do_sign_mess(Request = #{"public_id" := ID, "payload" := Message},
|
||||
@ -657,7 +657,7 @@ do_sign_mess(Request = #{"public_id" := ID, "payload" := Message},
|
||||
Sig = base64:encode(sign_message(list_to_binary(Message), SecKey)),
|
||||
do_sign_mess2(Request#{"signature" => Sig});
|
||||
false ->
|
||||
gmc_gui:trouble({bad_key, ID})
|
||||
gd_gui:trouble({bad_key, ID})
|
||||
end.
|
||||
|
||||
do_sign_mess2(Request = #{"url" := URL}) ->
|
||||
@ -673,7 +673,7 @@ do_sign_mess2(Request = #{"url" := URL}) ->
|
||||
case httpc:request(post, {URL, [], "application/json", Response}, [], []) of
|
||||
{ok, {{_, 200, _}, _, JSON}} -> log(info, "Signature posted: ~p", [JSON]);
|
||||
{error, socket_closed_remotely} -> tell("Yep, closed remotely.");
|
||||
Error -> gmc_gui:trouble(Error)
|
||||
Error -> gd_gui:trouble(Error)
|
||||
end.
|
||||
|
||||
|
||||
@ -717,7 +717,7 @@ do_sign_tx(Request = #{"public_id" := ID, "payload" := CallData, "network_id" :=
|
||||
SignedTX = sign_tx_hash(BinaryTX, SecKey, BinNID),
|
||||
do_sign_tx2(Request#{"signed" => true, "payload" := SignedTX});
|
||||
false ->
|
||||
gmc_gui:trouble({bad_key, ID})
|
||||
gd_gui:trouble({bad_key, ID})
|
||||
end.
|
||||
|
||||
do_sign_tx2(Request = #{"url" := URL}) ->
|
||||
@ -733,7 +733,7 @@ do_sign_tx2(Request = #{"url" := URL}) ->
|
||||
case httpc:request(post, {URL, [], "application/json", Response}, [], []) of
|
||||
{ok, {{_, 200, _}, _, JSON}} -> log(info, "Signed TX posted: ~p", [JSON]);
|
||||
{error, socket_closed_remotely} -> log(info, "Socket closed remotely.");
|
||||
Error -> gmc_gui:trouble(Error)
|
||||
Error -> gd_gui:trouble(Error)
|
||||
end.
|
||||
|
||||
sign_tx_hash(Unsigned, SecKey, NetworkID) ->
|
||||
@ -764,30 +764,30 @@ do_sign_call(#s{wallet = #wallet{keys = Keys, chain_id = ChainID}},
|
||||
ok = tell("TX succeded with: ~p", [TXHash]),
|
||||
do_sign_call2(ConID, Data);
|
||||
{ok, WTF} ->
|
||||
gmc_v_devman:trouble({error, WTF});
|
||||
gd_v_devman:trouble({error, WTF});
|
||||
Error ->
|
||||
gmc_v_devman:trouble(Error)
|
||||
gd_v_devman:trouble(Error)
|
||||
end;
|
||||
do_sign_call(_, _, _, _) ->
|
||||
gmc_v_devman:trouble({error, no_chain}).
|
||||
gd_v_devman:trouble({error, no_chain}).
|
||||
|
||||
do_sign_call2(ConID, #{"tx_hash" := TXHash}) ->
|
||||
case hz:tx_info(TXHash) of
|
||||
{ok, CallInfo = #{"call_info" := #{"return_type" := "ok"}}} ->
|
||||
gmc_v_devman:call_result(ConID, CallInfo);
|
||||
gd_v_devman:call_result(ConID, CallInfo);
|
||||
{error, "Tx not mined"} ->
|
||||
gmc_v_devman:trouble({tx_hash, TXHash});
|
||||
gd_v_devman:trouble({tx_hash, TXHash});
|
||||
{ok, Reason = #{"call_info" := #{"return_type" := "revert"}}} ->
|
||||
gmc_v_devman:trouble({error, Reason});
|
||||
gd_v_devman:trouble({error, Reason});
|
||||
Error ->
|
||||
gmc_v_devman:trouble(Error)
|
||||
gd_v_devman:trouble(Error)
|
||||
end.
|
||||
|
||||
|
||||
do_dry_run(ConID, TX) ->
|
||||
case hz:dry_run(TX) of
|
||||
{ok, Result} -> gmc_v_devman:dryrun_result(ConID, Result);
|
||||
Other -> gmc_v_devmam:trouble({error, ConID, Other})
|
||||
{ok, Result} -> gd_v_devman:dryrun_result(ConID, Result);
|
||||
Other -> gd_v_devmam:trouble({error, ConID, Other})
|
||||
end.
|
||||
|
||||
|
||||
@ -886,7 +886,7 @@ do_make_key(Name, Seed, base64, Transform, State) ->
|
||||
{ok, Bin} ->
|
||||
do_make_key2(Name, Bin, Transform, State);
|
||||
{error, Reason} ->
|
||||
ok = gmc_gui:trouble({error, {base64, Reason}}),
|
||||
ok = gd_gui:trouble({error, {base64, Reason}}),
|
||||
State
|
||||
end;
|
||||
do_make_key(Name, Seed, base58, Transform, State) ->
|
||||
@ -895,27 +895,27 @@ do_make_key(Name, Seed, base58, Transform, State) ->
|
||||
Bin = base58:base58_to_binary(Seed),
|
||||
do_make_key2(Name, Bin, Transform, State);
|
||||
false ->
|
||||
ok = gmc_gui:trouble({error, {base58, badarg}}),
|
||||
ok = gd_gui:trouble({error, {base58, badarg}}),
|
||||
State
|
||||
end.
|
||||
|
||||
|
||||
do_make_key2(_, _, _, State = #s{wallet = none}) ->
|
||||
ok = gmc_gui:trouble("No wallet selected!"),
|
||||
do_show_ui(gmc_v_wallman, State);
|
||||
ok = gd_gui:trouble("No wallet selected!"),
|
||||
do_show_ui(gd_v_wallman, State);
|
||||
do_make_key2(Name, Bin, Transform,
|
||||
State = #s{wallet = Current, wallets = Wallets, pass = Pass}) ->
|
||||
#wallet{name = WalletName, poas = POAs, keys = Keys} = Current,
|
||||
T = transform(Transform),
|
||||
Seed = T(Bin),
|
||||
Key = #key{name = KeyName, id = ID} = gmc_key_master:make_key(Name, Seed),
|
||||
Key = #key{name = KeyName, id = ID} = gd_key_master:make_key(Name, Seed),
|
||||
POA = #poa{name = KeyName, id = ID},
|
||||
NewKeys = [Key | Keys],
|
||||
NewPOAs = [POA | POAs],
|
||||
Updated = Current#wallet{poas = NewPOAs, keys = NewKeys},
|
||||
RW = lists:keyfind(WalletName, #wr.name, Wallets),
|
||||
ok = save_wallet(RW, Pass, Updated),
|
||||
ok = gmc_gui:show(NewPOAs),
|
||||
ok = gd_gui:show(NewPOAs),
|
||||
State#s{wallet = Updated}.
|
||||
|
||||
|
||||
@ -947,23 +947,23 @@ t_xor(B, A) ->
|
||||
|
||||
|
||||
do_recover_key(Mnemonic, State) ->
|
||||
case gmc_key_master:decode(Mnemonic) of
|
||||
case gd_key_master:decode(Mnemonic) of
|
||||
{ok, Seed} ->
|
||||
do_recover_key2(Seed, State);
|
||||
Error ->
|
||||
ok = gmc_gui:trouble(Error),
|
||||
ok = gd_gui:trouble(Error),
|
||||
State
|
||||
end.
|
||||
|
||||
do_recover_key2(Seed, State = #s{wallet = Current, wallets = Wallets, pass = Pass}) ->
|
||||
#wallet{name = WalletName, keys = Keys, poas = POAs} = Current,
|
||||
Recovered = #key{id = ID, name = AccName} = gmc_key_master:make_key("", Seed),
|
||||
Recovered = #key{id = ID, name = AccName} = gd_key_master:make_key("", Seed),
|
||||
case lists:keymember(ID, #key.id, Keys) of
|
||||
false ->
|
||||
NewKeys = [Recovered | Keys],
|
||||
POA = #poa{name = AccName, id = ID},
|
||||
NewPOAs = [POA | POAs],
|
||||
ok = gmc_gui:show(NewPOAs),
|
||||
ok = gd_gui:show(NewPOAs),
|
||||
Updated = Current#wallet{poas = NewPOAs, keys = NewKeys},
|
||||
RW = lists:keyfind(WalletName, #wr.name, Wallets),
|
||||
ok = save_wallet(RW, Pass, Updated),
|
||||
@ -976,7 +976,7 @@ do_recover_key2(Seed, State = #s{wallet = Current, wallets = Wallets, pass = Pas
|
||||
do_mnemonic(ID, #s{wallet = #wallet{keys = Keys}}) ->
|
||||
case lists:keyfind(ID, #key.id, Keys) of
|
||||
#key{pair = #{secret := <<K:32/binary, _/binary>>}} ->
|
||||
Mnemonic = gmc_key_master:encode(K),
|
||||
Mnemonic = gd_key_master:encode(K),
|
||||
{ok, Mnemonic};
|
||||
false ->
|
||||
{error, bad_key}
|
||||
@ -992,7 +992,7 @@ do_deploy(Build,
|
||||
Nonce, Amount, TTL, Gas, GasPrice,
|
||||
Build, InitArgs) of
|
||||
{ok, CreateTX} -> do_deploy2(SecKey, CreateTX, ChainID);
|
||||
Error -> gmc_v_devman:trouble(Error)
|
||||
Error -> gd_v_devman:trouble(Error)
|
||||
end.
|
||||
|
||||
do_deploy2(SecKey, CreateTX, ChainID) ->
|
||||
@ -1003,21 +1003,21 @@ do_deploy2(SecKey, CreateTX, ChainID) ->
|
||||
ok = tell("Contract deploy TX succeded with: ~p", [TXHash]),
|
||||
do_deploy3(Data);
|
||||
{ok, WTF} ->
|
||||
gmc_v_devman:trouble({error, WTF});
|
||||
gd_v_devman:trouble({error, WTF});
|
||||
Error ->
|
||||
gmc_v_devman:trouble(Error)
|
||||
gd_v_devman:trouble(Error)
|
||||
end.
|
||||
|
||||
do_deploy3(#{"tx_hash" := TXHash}) ->
|
||||
case hz:tx_info(TXHash) of
|
||||
{ok, #{"call_info" := #{"return_type" := "ok", "contract_id" := ConID}}} ->
|
||||
gmc_v_devman:open_contract(ConID);
|
||||
gd_v_devman:open_contract(ConID);
|
||||
{error, "Tx not mined"} ->
|
||||
gmc_v_devman:trouble({tx_hash, TXHash});
|
||||
gd_v_devman:trouble({tx_hash, TXHash});
|
||||
{ok, Reason = #{"call_info" := #{"return_type" := "revert"}}} ->
|
||||
gmc_v_devman:trouble({error, Reason});
|
||||
gd_v_devman:trouble({error, Reason});
|
||||
Error ->
|
||||
gmc_v_devman:trouble(Error)
|
||||
gd_v_devman:trouble(Error)
|
||||
end.
|
||||
|
||||
|
||||
@ -1028,7 +1028,7 @@ do_rename_key(ID, NewName, State = #s{wallet = W}) ->
|
||||
NewPOAs = lists:keystore(ID, #poa.id, POAs, A#poa{name = NewName}),
|
||||
NewKeys = lists:keystore(ID, #key.id, Keys, K#key{name = NewName}),
|
||||
NewWallet = W#wallet{poas = NewPOAs, keys = NewKeys},
|
||||
ok = gmc_gui:show(NewPOAs),
|
||||
ok = gd_gui:show(NewPOAs),
|
||||
State#s{wallet = NewWallet}.
|
||||
|
||||
|
||||
@ -1037,7 +1037,7 @@ do_drop_key(ID, State = #s{wallet = W}) ->
|
||||
NewPOAs = lists:keydelete(ID, #poa.id, POAs),
|
||||
NewKeys = lists:keydelete(ID, #key.id, Keys),
|
||||
NewWallet = W#wallet{poas = NewPOAs, keys = NewKeys},
|
||||
ok = gmc_gui:show(NewPOAs),
|
||||
ok = gd_gui:show(NewPOAs),
|
||||
State#s{wallet = NewWallet}.
|
||||
|
||||
|
||||
@ -1045,16 +1045,16 @@ do_open_wallet(Path, Phrase, State) ->
|
||||
Pass = pass(Phrase),
|
||||
case read(Path, Pass) of
|
||||
{ok, Recovered = #wallet{name = Name, poas = POAs, endpoint = Node}} ->
|
||||
ok = gmc_gui:show(POAs),
|
||||
ok = gmc_gui:wallet(Name),
|
||||
ok = gd_gui:show(POAs),
|
||||
ok = gd_gui:wallet(Name),
|
||||
ok =
|
||||
case ensure_hz_set(Node) of
|
||||
{ok, ChainID} -> gmc_gui:chain(ChainID, Node);
|
||||
Error -> gmc_gui:trouble(Error)
|
||||
{ok, ChainID} -> gd_gui:chain(ChainID, Node);
|
||||
Error -> gd_gui:trouble(Error)
|
||||
end,
|
||||
State#s{pass = Pass, wallet = Recovered};
|
||||
Error ->
|
||||
ok = gmc_gui:trouble(Error),
|
||||
ok = gd_gui:trouble(Error),
|
||||
New = default_wallet(),
|
||||
State#s{wallet = New}
|
||||
end.
|
||||
@ -1113,8 +1113,8 @@ do_new_wallet(Name, Path, Password, State = #s{wallets = Wallets, prefs = Prefs}
|
||||
Entry = #wr{name = Name, path = Path, pass = HasPass},
|
||||
New = #wallet{name = Name},
|
||||
ok = save_wallet(Entry, Pass, New),
|
||||
ok = gmc_gui:show([]),
|
||||
ok = gmc_gui:wallet(Name),
|
||||
ok = gd_gui:show([]),
|
||||
ok = gd_gui:wallet(Name),
|
||||
NewWallets = [Entry | Wallets],
|
||||
NewPrefs = put_prefs(wallets, NewWallets, Prefs),
|
||||
ok = persist(NewPrefs),
|
||||
@ -1132,13 +1132,13 @@ do_import_wallet(Name, Path, Password, State = #s{wallets = Wallets}) ->
|
||||
{false, false} ->
|
||||
do_import_wallet2(Name, Path, Password, State);
|
||||
{true, false} ->
|
||||
ok = gmc_gui:trouble({error, name_exists}),
|
||||
ok = gd_gui:trouble({error, name_exists}),
|
||||
State;
|
||||
{false, true} ->
|
||||
ok = gmc_gui:trouble({error, path_exists}),
|
||||
ok = gd_gui:trouble({error, path_exists}),
|
||||
State;
|
||||
{true, true} ->
|
||||
ok = gmc_gui:trouble("Whoa! This exact wallet already exists!"),
|
||||
ok = gd_gui:trouble("Whoa! This exact wallet already exists!"),
|
||||
State
|
||||
end.
|
||||
|
||||
@ -1153,12 +1153,12 @@ do_import_wallet2(Name, Path, Password, State = #s{wallets = Wallets, prefs = Pr
|
||||
NewPrefs = put_prefs(wallets, NewWallets, Prefs),
|
||||
ok = save_wallet(Record, Pass, Imported),
|
||||
ok = persist(NewPrefs),
|
||||
ok = gmc_gui:show(POAs),
|
||||
ok = gmc_gui:chain(ChainID, Endpoint),
|
||||
ok = gmc_gui:wallet(Name),
|
||||
ok = gd_gui:show(POAs),
|
||||
ok = gd_gui:chain(ChainID, Endpoint),
|
||||
ok = gd_gui:wallet(Name),
|
||||
State#s{wallet = Imported, wallets = NewWallets, prefs = NewPrefs};
|
||||
Error ->
|
||||
ok = gmc_gui:trouble(Error),
|
||||
ok = gd_gui:trouble(Error),
|
||||
State
|
||||
end.
|
||||
|
||||
@ -1177,17 +1177,17 @@ do_drop_wallet(Path, Delete, State = #s{tasks = Tasks,
|
||||
ok =
|
||||
case Name =:= CurrentName of
|
||||
true ->
|
||||
ok = gmc_gui:show([]),
|
||||
ok = gmc_gui:wallet(none),
|
||||
ok = gmc_gui:chain(none, none);
|
||||
ok = gd_gui:show([]),
|
||||
ok = gd_gui:wallet(none),
|
||||
ok = gd_gui:chain(none, none);
|
||||
false ->
|
||||
ok
|
||||
end,
|
||||
ok = maybe_clean(Delete, Path),
|
||||
NewPrefs = put_prefs(wallets, NewWallets, Prefs),
|
||||
ok = persist(NewPrefs),
|
||||
#ui{wx = WallMan} = lists:keyfind(gmc_v_wallman, #ui.name, Tasks),
|
||||
ok = gmc_v_wallman:show(WallMan, NewWallets),
|
||||
#ui{wx = WallMan} = lists:keyfind(gd_v_wallman, #ui.name, Tasks),
|
||||
ok = gd_v_wallman:show(WallMan, NewWallets),
|
||||
State#s{wallets = NewWallets, prefs = NewPrefs};
|
||||
false ->
|
||||
State
|
||||
@ -1196,7 +1196,7 @@ do_drop_wallet(Path, Delete, State = #s{tasks = Tasks,
|
||||
maybe_clean(true, Path) ->
|
||||
case file:delete(Path) of
|
||||
ok -> ok;
|
||||
Error -> gmc_gui:trouble(Error)
|
||||
Error -> gd_gui:trouble(Error)
|
||||
end;
|
||||
maybe_clean(false, _) ->
|
||||
ok.
|
||||
@ -1279,4 +1279,4 @@ persist(Prefs) ->
|
||||
|
||||
|
||||
prefs_path() ->
|
||||
filename:join(zx_lib:path(etc, "otpr", "clutch"), "prefs.eterms").
|
||||
filename:join(zx_lib:path(etc, "otpr", "gajudesk"), "prefs.eterms").
|
@ -36,8 +36,8 @@
|
||||
%%% wallets that are not capable of compiling contract source.
|
||||
%%% @end
|
||||
|
||||
-module(gmc_grids).
|
||||
-vsn("0.5.0").
|
||||
-module(gd_grids).
|
||||
-vsn("0.5.1").
|
||||
-author("Craig Everett <craigeverett@qpq.swiss>").
|
||||
-copyright("QPQ AG <info@qpq.swiss>").
|
||||
-license("GPL-3.0-or-later").
|
||||
@ -52,7 +52,7 @@
|
||||
| {{sign | mess, http | https}, URL},
|
||||
Location :: Node :: {inet:ip_address() | inet:hostname(), inet:port_number()}
|
||||
| Chain :: binary(),
|
||||
Recipient :: clutch:id(),
|
||||
Recipient :: gajudesk:id(),
|
||||
Amount :: non_neg_integer(),
|
||||
Payload :: binary(),
|
||||
URL :: string(),
|
@ -2,8 +2,8 @@
|
||||
%%% GajuDesk GUI
|
||||
%%% @end
|
||||
|
||||
-module(gmc_gui).
|
||||
-vsn("0.5.0").
|
||||
-module(gd_gui).
|
||||
-vsn("0.5.1").
|
||||
-author("Craig Everett <craigeverett@qpq.swiss>").
|
||||
-copyright("QPQ AG <info@qpq.swiss>").
|
||||
-license("GPL-3.0-or-later").
|
||||
@ -16,7 +16,7 @@
|
||||
-export([init/1, terminate/2, code_change/3,
|
||||
handle_call/3, handle_cast/2, handle_info/2, handle_event/2]).
|
||||
-include("$zx_include/zx_logger.hrl").
|
||||
-include("gmc.hrl").
|
||||
-include("gd.hrl").
|
||||
|
||||
|
||||
-record(w,
|
||||
@ -35,7 +35,7 @@
|
||||
lang = en :: en | jp,
|
||||
j = none :: none | fun(),
|
||||
prefs = #{} :: #{atom() := term()},
|
||||
accounts = [] :: [clutch:poa()],
|
||||
accounts = [] :: [gajudesk:poa()],
|
||||
picker = none :: none | wx:wx_object(),
|
||||
id = {#w{}, #w{}} :: labeled(),
|
||||
balance = {#w{}, #w{}} :: labeled(),
|
||||
@ -85,11 +85,11 @@ start_link(Accounts) ->
|
||||
init(Prefs) ->
|
||||
ok = log(info, "GUI starting..."),
|
||||
Lang = maps:get(lang, Prefs, en_us),
|
||||
Trans = gmc_jt:read_translations(?MODULE),
|
||||
J = gmc_jt:j(Lang, Trans),
|
||||
Trans = gd_jt:read_translations(?MODULE),
|
||||
J = gd_jt:j(Lang, Trans),
|
||||
|
||||
Wx = wx:new(),
|
||||
Frame = wxFrame:new(Wx, ?wxID_ANY, J("Gajumaru Clutch")),
|
||||
Frame = wxFrame:new(Wx, ?wxID_ANY, J("GajuDesk")),
|
||||
MainSz = wxBoxSizer:new(?wxVERTICAL),
|
||||
Picker = wxListBox:new(Frame, ?wxID_ANY, [{style, ?wxLC_SINGLE_SEL}]),
|
||||
|
||||
@ -196,7 +196,7 @@ init(Prefs) ->
|
||||
ok = wxFrame:setSizer(Frame, MainSz),
|
||||
ok = wxSizer:layout(MainSz),
|
||||
|
||||
ok = gmc_v:safe_size(Frame, Prefs),
|
||||
ok = gd_v:safe_size(Frame, Prefs),
|
||||
|
||||
ok = wxFrame:connect(Frame, command_button_clicked),
|
||||
ok = wxFrame:connect(Frame, close_window),
|
||||
@ -318,8 +318,8 @@ handle_event(#wx{event = #wxClose{}}, State = #s{frame = Frame, prefs = Prefs})
|
||||
{X, Y, W, H}
|
||||
end,
|
||||
NewPrefs = maps:put(geometry, Geometry, Prefs),
|
||||
ok = gmc_con:save(?MODULE, NewPrefs),
|
||||
ok = gmc_con:stop(),
|
||||
ok = gd_con:save(?MODULE, NewPrefs),
|
||||
ok = gd_con:stop(),
|
||||
ok = wxWindow:destroy(Frame),
|
||||
{noreply, State};
|
||||
handle_event(Event, State) ->
|
||||
@ -346,22 +346,22 @@ terminate(Reason, State) ->
|
||||
%%% Doers
|
||||
|
||||
refresh(State) ->
|
||||
ok = gmc_con:refresh(),
|
||||
ok = gd_con:refresh(),
|
||||
State.
|
||||
|
||||
|
||||
wallman(State) ->
|
||||
ok = gmc_con:show_ui(gmc_v_wallman),
|
||||
ok = gd_con:show_ui(gd_v_wallman),
|
||||
State.
|
||||
|
||||
|
||||
netman(State) ->
|
||||
ok = gmc_con:show_ui(gmc_v_netman),
|
||||
ok = gd_con:show_ui(gd_v_netman),
|
||||
State.
|
||||
|
||||
|
||||
devman(State) ->
|
||||
ok = gmc_con:show_ui(gmc_v_devman),
|
||||
ok = gd_con:show_ui(gd_v_devman),
|
||||
State.
|
||||
|
||||
|
||||
@ -427,7 +427,7 @@ add_node2(Address, PortCtrls) ->
|
||||
end,
|
||||
[E, I, R, C, M] = lists:map(fun numerify_port/1, PortCtrls),
|
||||
New = #node{ip = IP, external = E, internal = I, rosetta = R, channel = C, mdw = M},
|
||||
gmc_con:set_sole_node(New).
|
||||
gd_con:set_sole_node(New).
|
||||
|
||||
numerify_port(Ctrl) ->
|
||||
case wxTextCtrl:getValue(Ctrl) of
|
||||
@ -513,7 +513,7 @@ make_key(State = #s{frame = Frame, j = J}) ->
|
||||
1 -> {sha2, 256};
|
||||
2 -> {x_or, 256}
|
||||
end,
|
||||
gmc_con:make_key(Type, Size, Name, Seed, Encoding, Transform);
|
||||
gd_con:make_key(Type, Size, Name, Seed, Encoding, Transform);
|
||||
?wxID_CANCEL ->
|
||||
ok
|
||||
end,
|
||||
@ -542,7 +542,7 @@ recover_key(State = #s{frame = Frame, j = J}) ->
|
||||
case wxDialog:showModal(Dialog) of
|
||||
?wxID_OK ->
|
||||
Mnemonic = wxTextCtrl:getValue(MnemTx),
|
||||
gmc_con:recover_key(Mnemonic);
|
||||
gd_con:recover_key(Mnemonic);
|
||||
?wxID_CANCEL ->
|
||||
ok
|
||||
end,
|
||||
@ -560,7 +560,7 @@ show_mnemonic(State = #s{picker = Picker}) ->
|
||||
|
||||
show_mnemonic(Selected, State = #s{frame = Frame, j = J, accounts = Accounts}) ->
|
||||
#poa{id = ID} = lists:nth(Selected, Accounts),
|
||||
{ok, Mnemonic} = gmc_con:mnemonic(ID),
|
||||
{ok, Mnemonic} = gd_con:mnemonic(ID),
|
||||
Dialog = wxDialog:new(Frame, ?wxID_ANY, J("Mnemonic")),
|
||||
Sizer = wxBoxSizer:new(?wxVERTICAL),
|
||||
MnemSz = wxStaticBoxSizer:new(?wxVERTICAL, Dialog, [{label, J("Recovery Phrase")}]),
|
||||
@ -619,7 +619,7 @@ rename_key(Selected, State = #s{frame = Frame, j = J, accounts = Accounts}) ->
|
||||
case wxDialog:showModal(Dialog) of
|
||||
?wxID_OK ->
|
||||
NewName = wxTextCtrl:getValue(NameTx),
|
||||
gmc_con:rename_key(ID, NewName);
|
||||
gd_con:rename_key(ID, NewName);
|
||||
?wxID_CANCEL ->
|
||||
ok
|
||||
end,
|
||||
@ -655,7 +655,7 @@ drop_key(Selected, State = #s{frame = Frame, j = J, accounts = Accounts, prefs =
|
||||
NewPrefs =
|
||||
case wxDialog:showModal(Dialog) of
|
||||
?wxID_OK ->
|
||||
gmc_con:drop_key(ID),
|
||||
gd_con:drop_key(ID),
|
||||
case Selected =:= length(Accounts) of
|
||||
true -> maps:put(selected, Selected - 2, Prefs);
|
||||
false -> Prefs
|
||||
@ -711,7 +711,7 @@ spend(State = #s{picker = Picker}) ->
|
||||
|
||||
spend(Selected, State = #s{accounts = Accounts}) ->
|
||||
POA = #poa{id = ID} = lists:nth(Selected, Accounts),
|
||||
case gmc_con:nonce(ID) of
|
||||
case gd_con:nonce(ID) of
|
||||
{ok, Nonce} ->
|
||||
{ok, #{"top_block_height" := Height}} = hz:status(),
|
||||
spend2(POA, Nonce, Height, State);
|
||||
@ -815,7 +815,7 @@ clean_spend(ID, TX = #spend_tx{gas = S}) when is_list(S) ->
|
||||
clean_spend(ID, TX = #spend_tx{payload = S}) when is_list(S) ->
|
||||
clean_spend(ID, TX#spend_tx{payload = list_to_binary(S)});
|
||||
clean_spend(ID, TX) ->
|
||||
gmc_con:spend(ID, TX).
|
||||
gd_con:spend(ID, TX).
|
||||
|
||||
decode_account_id(S) when is_list(S) ->
|
||||
decode_account_id(list_to_binary(S));
|
||||
@ -855,7 +855,7 @@ grids_dialogue(State = #s{frame = Frame, j = J}) ->
|
||||
?wxID_OK ->
|
||||
case wxTextCtrl:getValue(URL_Tx) of
|
||||
"" -> ok;
|
||||
String -> gmc_con:grids(String)
|
||||
String -> gd_con:grids(String)
|
||||
end;
|
||||
?wxID_CANCEL ->
|
||||
ok
|
||||
@ -878,7 +878,7 @@ do_selection(Selected,
|
||||
[#balance{total = Pucks}] = Balances,
|
||||
ok = wxStaticText:setLabel(I, ID),
|
||||
ok = wxStaticText:setLabel(B, price_to_string(Pucks)),
|
||||
ok = gmc_con:selected(OneBasedIndex),
|
||||
ok = gd_con:selected(OneBasedIndex),
|
||||
NewPrefs = maps:put(selected, Selected, Prefs),
|
||||
State#s{prefs = NewPrefs};
|
||||
do_selection(_, State) ->
|
||||
@ -955,7 +955,7 @@ do_ask_password(#s{frame = Frame, prefs = Prefs, j = J}) ->
|
||||
Path =
|
||||
maps:get(last,
|
||||
Prefs,
|
||||
filename:join(zx_lib:path(var, "otpr", "clutch"), "default.gaju")),
|
||||
filename:join(zx_lib:path(var, "otpr", "gajudesk"), "default.gaju")),
|
||||
ok =
|
||||
case wxDialog:showModal(Dialog) of
|
||||
?wxID_OK ->
|
||||
@ -964,9 +964,9 @@ do_ask_password(#s{frame = Frame, prefs = Prefs, j = J}) ->
|
||||
"" -> none;
|
||||
P -> P
|
||||
end,
|
||||
gmc_con:open_wallet(Path, Phrase);
|
||||
gd_con:open_wallet(Path, Phrase);
|
||||
?wxID_CANCEL ->
|
||||
gmc_con:open_wallet(Path, none)
|
||||
gd_con:open_wallet(Path, none)
|
||||
end,
|
||||
wxDialog:destroy(Dialog).
|
||||
|
||||
@ -1029,7 +1029,7 @@ do_grids_mess_sig2(Request = #{"grids" := 1,
|
||||
ok = wxFrame:center(Dialog),
|
||||
ok =
|
||||
case wxDialog:showModal(Dialog) of
|
||||
?wxID_OK -> gmc_con:sign_mess(Request);
|
||||
?wxID_OK -> gd_con:sign_mess(Request);
|
||||
?wxID_CANCEL -> ok
|
||||
end,
|
||||
wxDialog:destroy(Dialog);
|
||||
@ -1085,7 +1085,7 @@ do_grids_mess_sig2(Request = #{"grids" := 1,
|
||||
ok = wxFrame:center(Dialog),
|
||||
ok =
|
||||
case wxDialog:showModal(Dialog) of
|
||||
?wxID_OK -> gmc_con:sign_tx(Request);
|
||||
?wxID_OK -> gd_con:sign_tx(Request);
|
||||
?wxID_CANCEL -> ok
|
||||
end,
|
||||
wxDialog:destroy(Dialog);
|
@ -14,8 +14,8 @@
|
||||
%%% read, where `j/2' could be called any number of times without a disk read if the
|
||||
%%% translation library is retained).
|
||||
|
||||
-module(gmc_jt).
|
||||
-vsn("0.5.0").
|
||||
-module(gd_jt).
|
||||
-vsn("0.5.1").
|
||||
-export([read_translations/1, j/2, oneshot_j/2]).
|
||||
|
||||
|
@ -7,13 +7,13 @@
|
||||
%%% code.
|
||||
%%% @end
|
||||
|
||||
-module(gmc_key_master).
|
||||
-vsn("0.5.0").
|
||||
-module(gd_key_master).
|
||||
-vsn("0.5.1").
|
||||
|
||||
|
||||
-export([make_key/2, encode/1, decode/1]).
|
||||
-export([lcg/1]).
|
||||
-include("gmc.hrl").
|
||||
-include("gd.hrl").
|
||||
|
||||
|
||||
make_key("", <<>>) ->
|
@ -1,5 +1,5 @@
|
||||
%%% @doc
|
||||
%%% Clutch Top-level Supervisor
|
||||
%%% GajuDesk Top-level Supervisor
|
||||
%%%
|
||||
%%% The very top level supervisor in the system. It only has one service branch: the
|
||||
%%% "con" (program controller). The con is the
|
||||
@ -11,8 +11,8 @@
|
||||
%%% See: http://zxq9.com/archives/1311
|
||||
%%% @end
|
||||
|
||||
-module(gmc_sup).
|
||||
-vsn("0.5.0").
|
||||
-module(gd_sup).
|
||||
-vsn("0.5.1").
|
||||
-behaviour(supervisor).
|
||||
-author("Craig Everett <craigeverett@qpq.swiss>").
|
||||
-copyright("QPQ AG <info@qpq.swiss>").
|
||||
@ -36,11 +36,11 @@ start_link() ->
|
||||
|
||||
init([]) ->
|
||||
RestartStrategy = {one_for_one, 0, 60},
|
||||
Controller = {gmc_con,
|
||||
{gmc_con, start_link, []},
|
||||
Controller = {gd_con,
|
||||
{gd_con, start_link, []},
|
||||
permanent,
|
||||
5000,
|
||||
worker,
|
||||
[gmc_con]},
|
||||
[gd_con]},
|
||||
Children = [Controller],
|
||||
{ok, {RestartStrategy, Children}}.
|
@ -1,5 +1,5 @@
|
||||
-module(gmc_v).
|
||||
-vsn("0.5.0").
|
||||
-module(gd_v).
|
||||
-vsn("0.5.1").
|
||||
-author("Craig Everett <craigeverett@qpq.swiss>").
|
||||
-copyright("QPQ AG <info@qpq.swiss>").
|
||||
-license("GPL-3.0-or-later").
|
@ -1,11 +1,11 @@
|
||||
-module(gmc_v_devman).
|
||||
-vsn("0.5.0").
|
||||
-module(gd_v_devman).
|
||||
-vsn("0.5.1").
|
||||
-author("Craig Everett <craigeverett@qpq.swiss>").
|
||||
-copyright("QPQ AG <info@qpq.swiss>").
|
||||
-license("GPL-3.0-or-later").
|
||||
|
||||
-behavior(wx_object).
|
||||
%-behavior(gmc_v).
|
||||
%-behavior(gd_v).
|
||||
-include_lib("wx/include/wx.hrl").
|
||||
-export([to_front/1]).
|
||||
-export([set_manifest/1, open_contract/1, call_result/2, dryrun_result/2, trouble/1]).
|
||||
@ -13,7 +13,7 @@
|
||||
-export([init/1, terminate/2, code_change/3,
|
||||
handle_call/3, handle_cast/2, handle_info/2, handle_event/2]).
|
||||
-include("$zx_include/zx_logger.hrl").
|
||||
-include("gmc.hrl").
|
||||
-include("gd.hrl").
|
||||
|
||||
% Widgets
|
||||
-record(w,
|
||||
@ -85,7 +85,7 @@ open_contract(Address) ->
|
||||
|
||||
|
||||
-spec call_result(ConID, CallInfo) -> ok
|
||||
when ConID :: clutch:id(),
|
||||
when ConID :: gajudesk:id(),
|
||||
CallInfo :: map().
|
||||
|
||||
call_result(ConID, CallInfo) ->
|
||||
@ -93,7 +93,7 @@ call_result(ConID, CallInfo) ->
|
||||
|
||||
|
||||
-spec dryrun_result(ConID, CallInfo) -> ok
|
||||
when ConID :: clutch:id(),
|
||||
when ConID :: gajudesk:id(),
|
||||
CallInfo :: map().
|
||||
|
||||
dryrun_result(ConID, CallInfo) ->
|
||||
@ -117,8 +117,8 @@ start_link(Args) ->
|
||||
|
||||
init({Prefs, Manifest}) ->
|
||||
Lang = maps:get(lang, Prefs, en_us),
|
||||
Trans = gmc_jt:read_translations(?MODULE),
|
||||
J = gmc_jt:j(Lang, Trans),
|
||||
Trans = gd_jt:read_translations(?MODULE),
|
||||
J = gd_jt:j(Lang, Trans),
|
||||
Wx = wx:new(),
|
||||
Frame = wxFrame:new(Wx, ?wxID_ANY, J("Contracts")),
|
||||
|
||||
@ -137,7 +137,7 @@ init({Prefs, Manifest}) ->
|
||||
_ = wxSizer:add(MainSz, TopBook, zxw:flags(wide)),
|
||||
_ = wxFrame:setSizer(Frame, MainSz),
|
||||
_ = wxSizer:layout(MainSz),
|
||||
ok = gmc_v:safe_size(Frame, Prefs),
|
||||
ok = gd_v:safe_size(Frame, Prefs),
|
||||
ok = wxFrame:connect(Frame, close_window),
|
||||
ok = wxFrame:connect(Frame, command_button_clicked),
|
||||
ok = wxFrame:center(Frame),
|
||||
@ -267,7 +267,7 @@ handle_event(#wx{event = #wxClose{}}, State = #s{frame = Frame, prefs = Prefs})
|
||||
{X, Y, W, H}
|
||||
end,
|
||||
NewPrefs = maps:put(geometry, Geometry, Prefs),
|
||||
ok = gmc_con:save(?MODULE, NewPrefs),
|
||||
ok = gd_con:save(?MODULE, NewPrefs),
|
||||
ok = wxWindow:destroy(Frame),
|
||||
{noreply, State};
|
||||
handle_event(Event, State) ->
|
||||
@ -302,7 +302,7 @@ clicked(State = #s{cons = {Consbook, Contracts}}, Name) ->
|
||||
end.
|
||||
|
||||
clicked2(State, Contract, Name) ->
|
||||
case gmc_con:list_keys() of
|
||||
case gd_con:list_keys() of
|
||||
{ok, 0, []} ->
|
||||
handle_troubling(State, "No keys exist in the current wallet.");
|
||||
{ok, Selected, Keys} ->
|
||||
@ -433,11 +433,11 @@ clicked4(State,
|
||||
end.
|
||||
|
||||
do_call(State, ConID, CallerID, UnsignedTX) ->
|
||||
ok = gmc_con:sign_call(ConID, CallerID, UnsignedTX),
|
||||
ok = gd_con:sign_call(ConID, CallerID, UnsignedTX),
|
||||
State.
|
||||
|
||||
do_dry_run(State, ConID, TX) ->
|
||||
ok = gmc_con:dry_run(ConID, TX),
|
||||
ok = gd_con:dry_run(ConID, TX),
|
||||
State.
|
||||
|
||||
|
||||
@ -602,7 +602,7 @@ deploy2(State, Source) ->
|
||||
end.
|
||||
|
||||
deploy3(State, Build) ->
|
||||
case gmc_con:list_keys() of
|
||||
case gd_con:list_keys() of
|
||||
{ok, 0, []} ->
|
||||
handle_troubling(State, "No keys exist in the current wallet.");
|
||||
{ok, Selected, Keys} ->
|
||||
@ -694,7 +694,7 @@ deploy4(State = #s{frame = Frame, j = J}, Build = #{aci := ACI}, Selected, Keys)
|
||||
|
||||
deploy5(State, Build, Params, Args) ->
|
||||
tell(info, "Build: ~p", [Build]),
|
||||
ok = gmc_con:deploy(Build, Params, Args),
|
||||
ok = gd_con:deploy(Build, Params, Args),
|
||||
State.
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
-module(gmc_v_netman).
|
||||
-vsn("0.5.0").
|
||||
-module(gd_v_netman).
|
||||
-vsn("0.5.1").
|
||||
-author("Craig Everett <zxq9@zxq9.com>").
|
||||
-copyright("QPQ AG <info@qpq.swiss>").
|
||||
-license("GPL-3.0-or-later").
|
||||
|
||||
-behavior(wx_object).
|
||||
%-behavior(gmc_v).
|
||||
%-behavior(gd_v).
|
||||
-include_lib("wx/include/wx.hrl").
|
||||
-export([to_front/1]).
|
||||
-export([set_manifest/1]).
|
||||
@ -13,7 +13,7 @@
|
||||
-export([init/1, terminate/2, code_change/3,
|
||||
handle_call/3, handle_cast/2, handle_info/2, handle_event/2]).
|
||||
-include("$zx_include/zx_logger.hrl").
|
||||
-include("gmc.hrl").
|
||||
-include("gd.hrl").
|
||||
|
||||
|
||||
-record(w,
|
||||
@ -61,8 +61,8 @@ start_link(Args) ->
|
||||
|
||||
init({Prefs, Manifest}) ->
|
||||
Lang = maps:get(lang, Prefs, en_us),
|
||||
Trans = gmc_jt:read_translations(?MODULE),
|
||||
J = gmc_jt:j(Lang, Trans),
|
||||
Trans = gd_jt:read_translations(?MODULE),
|
||||
J = gd_jt:j(Lang, Trans),
|
||||
Wx = wx:new(),
|
||||
Frame = wxFrame:new(Wx, ?wxID_ANY, J("Networks")),
|
||||
|
||||
@ -96,7 +96,7 @@ init({Prefs, Manifest}) ->
|
||||
_ = wxFrame:setSizer(Frame, MainSz),
|
||||
_ = wxSizer:layout(MainSz),
|
||||
|
||||
ok = gmc_v:safe_size(Frame, Prefs),
|
||||
ok = gd_v:safe_size(Frame, Prefs),
|
||||
|
||||
ok = wxFrame:connect(Frame, close_window),
|
||||
ok = wxFrame:connect(Frame, command_button_clicked),
|
||||
@ -216,7 +216,7 @@ handle_event(#wx{event = #wxClose{}}, State = #s{frame = Frame, prefs = Prefs})
|
||||
{X, Y, W, H}
|
||||
end,
|
||||
NewPrefs = maps:put(geometry, Geometry, Prefs),
|
||||
ok = gmc_con:save(?MODULE, NewPrefs),
|
||||
ok = gd_con:save(?MODULE, NewPrefs),
|
||||
ok = wxWindow:destroy(Frame),
|
||||
{noreply, State};
|
||||
handle_event(Event, State) ->
|
||||
@ -298,7 +298,7 @@ add_node2(Address, PortCtrls) ->
|
||||
end,
|
||||
[E, I, R, C, M] = lists:map(fun numerify_port/1, PortCtrls),
|
||||
New = #node{ip = IP, external = E, internal = I, rosetta = R, channel = C, mdw = M},
|
||||
gmc_con:add_node(New).
|
||||
gd_con:add_node(New).
|
||||
|
||||
numerify_port(Ctrl) ->
|
||||
case wxTextCtrl:getValue(Ctrl) of
|
||||
@ -326,6 +326,6 @@ drop_network(State = #s{nets = Nets, book = Book}) ->
|
||||
ok;
|
||||
Index ->
|
||||
#net{id = ID} = lists:nth(Index + 1, Nets),
|
||||
gmc_con:drop_network(ID)
|
||||
gd_con:drop_network(ID)
|
||||
end,
|
||||
State.
|
@ -1,11 +1,11 @@
|
||||
-module(gmc_v_wallman).
|
||||
-vsn("0.5.0").
|
||||
-module(gd_v_wallman).
|
||||
-vsn("0.5.1").
|
||||
-author("Craig Everett <zxq9@zxq9.com>").
|
||||
-copyright("QPQ AG <info@qpq.swiss>").
|
||||
-license("GPL-3.0-or-later").
|
||||
|
||||
-behavior(wx_object).
|
||||
%-behavior(gmc_v).
|
||||
%-behavior(gd_v).
|
||||
-include_lib("wx/include/wx.hrl").
|
||||
-export([to_front/1]).
|
||||
-export([show/2]).
|
||||
@ -13,7 +13,7 @@
|
||||
-export([init/1, terminate/2, code_change/3,
|
||||
handle_call/3, handle_cast/2, handle_info/2, handle_event/2]).
|
||||
-include("$zx_include/zx_logger.hrl").
|
||||
-include("gmc.hrl").
|
||||
-include("gd.hrl").
|
||||
|
||||
|
||||
-record(w,
|
||||
@ -57,8 +57,8 @@ start_link(Args) ->
|
||||
|
||||
init({Prefs, Manifest}) ->
|
||||
Lang = maps:get(lang, Prefs, en_us),
|
||||
Trans = gmc_jt:read_translations(?MODULE),
|
||||
J = gmc_jt:j(Lang, Trans),
|
||||
Trans = gd_jt:read_translations(?MODULE),
|
||||
J = gd_jt:j(Lang, Trans),
|
||||
Wx = wx:new(),
|
||||
Frame = wxFrame:new(Wx, ?wxID_ANY, J("Wallets")),
|
||||
|
||||
@ -89,7 +89,7 @@ init({Prefs, Manifest}) ->
|
||||
ok = wxFrame:setSizer(Frame, MainSz),
|
||||
ok = wxSizer:layout(MainSz),
|
||||
|
||||
ok = gmc_v:safe_size(Frame, Prefs),
|
||||
ok = gd_v:safe_size(Frame, Prefs),
|
||||
|
||||
ok = wxFrame:connect(Frame, command_button_clicked),
|
||||
ok = wxFrame:connect(Frame, close_window),
|
||||
@ -183,7 +183,7 @@ do_close(#s{frame = Frame, prefs = Prefs}) ->
|
||||
{X, Y, W, H}
|
||||
end,
|
||||
NewPrefs = maps:put(geometry, Geometry, Prefs),
|
||||
ok = gmc_con:save(?MODULE, NewPrefs),
|
||||
ok = gd_con:save(?MODULE, NewPrefs),
|
||||
ok = wxWindow:destroy(Frame).
|
||||
|
||||
|
||||
@ -205,7 +205,7 @@ do_open2(Selected, State = #s{wallets = Wallets}) ->
|
||||
#wr{pass = true, path = Path} ->
|
||||
do_open3(Path, State);
|
||||
#wr{pass = false, path = Path} ->
|
||||
ok = gmc_con:open_wallet(Path, none),
|
||||
ok = gd_con:open_wallet(Path, none),
|
||||
ok = do_close(State),
|
||||
State
|
||||
end.
|
||||
@ -235,7 +235,7 @@ do_open3(Path, State = #s{frame = Frame, j = J}) ->
|
||||
State;
|
||||
Phrase ->
|
||||
ok = wxDialog:destroy(Dialog),
|
||||
ok = gmc_con:open_wallet(Path, Phrase),
|
||||
ok = gd_con:open_wallet(Path, Phrase),
|
||||
ok = do_close(State),
|
||||
State
|
||||
end;
|
||||
@ -246,7 +246,7 @@ do_open3(Path, State = #s{frame = Frame, j = J}) ->
|
||||
|
||||
|
||||
do_new(State = #s{frame = Frame, j = J, prefs = Prefs}) ->
|
||||
DefaultDir = maps:get(dir, Prefs, zx_lib:path(var, "otpr", "clutch")),
|
||||
DefaultDir = maps:get(dir, Prefs, zx_lib:path(var, "otpr", "gajudesk")),
|
||||
Options =
|
||||
[{message, J("Save Location")},
|
||||
{defaultDir, DefaultDir},
|
||||
@ -328,11 +328,11 @@ do_new2(Path, J, Frame) ->
|
||||
do_new3(_, _, bad) ->
|
||||
abort;
|
||||
do_new3(Name, Path, Pass) ->
|
||||
gmc_con:new_wallet(Name, Path, Pass).
|
||||
gd_con:new_wallet(Name, Path, Pass).
|
||||
|
||||
|
||||
do_import(State = #s{frame = Frame, j = J, prefs = Prefs}) ->
|
||||
DefaultDir = maps:get(dir, Prefs, zx_lib:path(var, "otpr", "clutch")),
|
||||
DefaultDir = maps:get(dir, Prefs, zx_lib:path(var, "otpr", "gajudesk")),
|
||||
Options =
|
||||
[{message, J("Select Wallet File")},
|
||||
{defaultDir, DefaultDir},
|
||||
@ -399,7 +399,7 @@ do_import2(Dir, File, J, Frame) ->
|
||||
"" -> none;
|
||||
P -> P
|
||||
end,
|
||||
gmc_con:import_wallet(Name, Path, Pass);
|
||||
gd_con:import_wallet(Name, Path, Pass);
|
||||
?wxID_CANCEL ->
|
||||
abort
|
||||
end,
|
||||
@ -444,7 +444,7 @@ do_drop(Selected, State = #s{j = J, frame = Frame, wallets = Wallets}) ->
|
||||
case wxDialog:showModal(Dialog) of
|
||||
?wxID_OK ->
|
||||
Delete = wxCheckBox:getValue(DeleteCheck),
|
||||
gmc_con:drop_wallet(Path, Delete);
|
||||
gd_con:drop_wallet(Path, Delete);
|
||||
?wxID_CANCEL ->
|
||||
ok
|
||||
end,
|
@ -1,10 +1,10 @@
|
||||
{name,"Clutch"}.
|
||||
{type,gui}.
|
||||
{modules,[]}.
|
||||
{prefix,"gmc"}.
|
||||
{author,"Craig Everett"}.
|
||||
{prefix,"gd"}.
|
||||
{desc,"A desktop client for the Gajumaru network of blockchain networks"}.
|
||||
{package_id,{"otpr","clutch",{0,5,0}}}.
|
||||
{author,"Craig Everett"}.
|
||||
{package_id,{"otpr","gajudesk",{0,5,1}}}.
|
||||
{deps,[{"otpr","hakuzaru",{0,4,0}},
|
||||
{"otpr","gmserialization",{0,1,3}},
|
||||
{"otpr","sophia",{9,0,0}},
|
||||
@ -21,7 +21,7 @@
|
||||
{copyright,"QPQ AG"}.
|
||||
{file_exts,[]}.
|
||||
{license,"GPL-3.0-or-later"}.
|
||||
{repo_url,"https://gitlab.com/ioecs/clutch"}.
|
||||
{repo_url,"https://git.qpq.swiss/QPQ-AG/GajuDesk"}.
|
||||
{tags,["gaju","gm","gajumaru","wallet","blockchain","cryptocurrency","crypto",
|
||||
"puck"]}.
|
||||
{ws_url,"https://gajumaru.io"}.
|
||||
|
Loading…
x
Reference in New Issue
Block a user