This commit is contained in:
2026-09-29 16:21:11 -07:00
parent 7538ac2299
commit a2a2d69df2
+86 -42
View File
@@ -29,6 +29,17 @@ help_screen() ->
show this menu show this menu
rq debug rq debug
show variables show variables
rq addr names
rq addr names.aes
rq ctstr names
rq ctstr names.aes deployed address of names
rq my
rq my everything all
rq my akstr my akstr
rq my rbx_tuples
rq my tuples my rbx_tuples
rq query ak_... hz:acc("ak_...")
rq query ct_... hz:contract("ak_...")
rq src names.aes print contract source rq src names.aes print contract source
rq src rubicon.aes print contract source rq src rubicon.aes print contract source
""". """.
@@ -52,12 +63,45 @@ rq_noshell(Args) ->
%% @private %% @private
%% dispatch function %% dispatch function
rq_II(["debug" | Args]) -> rq_debug(Args); rq_II(Args) ->
rq_II(["src" | Args]) -> rq_src(Args); case Args of
rq_II(["-h" | Args]) -> rq_help(Args); [Addr, Names] when ((Addr =:= "addr") orelse Addr =:= "ctstr") andalso
rq_II(["--help" | Args]) -> rq_help(Args); (Names =:= "names.aes" orelse Names =:= "names") ->
rq_II(BadArgs) -> badargs(BadArgs). io:format("~ts~n", [nct_ctstr()]);
["debug" | Rest] ->
rq_debug(Rest);
["my"] -> rq_my(everything);
["my", "everything"] -> rq_my(everything);
["my", "addr"] -> rq_my(akstr);
["my", "akstr"] -> rq_my(akstr);
["my", "rbx_tuples"] -> rq_my(rbx_tuples);
["my", "tuples"] -> rq_my(rbx_tuples);
["query" | Args2] -> rq_query(Args2);
["src" | Args2] -> rq_src(Args2);
["-h" | Args2] -> rq_help(Args2);
["--help" | Args2] -> rq_help(Args2);
BadArgs -> badargs(BadArgs)
end.
rq_my(everything) ->
rq_my(akstr),
rq_my(rbx_tuples);
rq_my(akstr) ->
io:format("~ts~n", [my_akstr()]);
rq_my(rbx_tuples) ->
io:format("~tp~n", [my_rbx_tuples()]).
rq_query([Ak = "ak_" ++ _ | Rest]) ->
{ok, X} = hz:acc(Ak),
io:format("~tp~n", [X]),
rq_query(Rest);
rq_query([Ct = "ct_" ++ _ | Rest]) ->
{ok, X} = hz:contract(Ct),
io:format("~tp~n", [X]),
rq_query(Rest);
rq_query([]) ->
ok.
rq_src(["names.aes"]) -> rq_src(["names.aes"]) ->
{ok, Bytes} = file:read_file(nct_filepath()), {ok, Bytes} = file:read_file(nct_filepath()),
@@ -177,6 +221,15 @@ my_keypair() ->
my_seed() -> my_seed() ->
crypto:hash(sha3_512, <<"p@ssw0rd">>). crypto:hash(sha3_512, <<"p@ssw0rd">>).
my_rbx_tuples() ->
NoiseStr = "Noise_NK_25519_ChaChaPoly_BLAKE2b",
ServicePubkey = <<116, 159, 91, 248, 138, 250, 73, 40, 231, 50,
81, 110, 137, 163, 44, 76, 48, 130, 225, 95,
168, 121, 93, 44, 148, 42, 180, 103, 11, 40,
168, 96>>,
NoisePrologue = <<>>,
[{"127.0.0.1", 6969, "tcp", NoiseStr, ServicePubkey, NoisePrologue}].
%% hz setup %% hz setup
hz() -> hz() ->
@@ -186,46 +239,37 @@ hz() ->
hz_nodes() -> hz_nodes() ->
[ {"tsuriai.jp", 4013} [ {"tsuriai.jp", 4013}
, {"groot.testnet.gajumaru.io", 3013}
]. ].
%%% deploying %% deploying
%deploy_rct_with(RbxTuples) -> deploy_rct_with(RbxTuples) ->
% case hz:contract_create(my_akstr(), rct_filepath(), [RbxTuples]) of case hz:contract_create(my_akstr(), rct_filepath(), [RbxTuples]) of
% {ok, CreateTx} -> {ok, CreateTx} ->
% deploy_rct_II(CreateTx); deploy_rct_II(CreateTx);
% Error -> Error ->
% io:format("you are a failure: ~tp~n", [Error]), io:format("you are a failure: ~tp~n", [Error]),
% error(Error) error(Error)
% end. end.
%
%deploy_rct_II(UnsignedCreateTx) -> deploy_rct_II(UnsignedCreateTx) ->
% SecretKey = my_secret_key(), SecretKey = my_secret_key(),
% case hz:sign_tx(UnsignedCreateTx, SecretKey) of case hz:sign_tx(UnsignedCreateTx, SecretKey) of
% {ok, SignedTx} -> {ok, SignedTx} ->
% deploy_rct_III(SignedTx); deploy_rct_III(SignedTx);
% Error -> Error ->
% io:format("you are a failure II: ~tp~n", [Error]), io:format("you are a failure II: ~tp~n", [Error]),
% error(Error) error(Error)
% end. end.
%
%
%deploy_rct_III(SignedCreateTx) ->
% case hz:post_tx(SignedCreateTx) of
% {ok, Result_III} ->
% io:format("Result the third: ~tp~n", [Result_III]);
% Error ->
% io:format("you are a failure III: ~tp~n", [Error]),
% error(Error)
% end.
%my_rbx_tuples() ->
% NoiseStr = "Noise_NK_25519_ChaChaPoly_BLAKE2b",
% ServicePubkey = <<116, 159, 91, 248, 138, 250, 73, 40, 231, 50,
% 81, 110, 137, 163, 44, 76, 48, 130, 225, 95,
% 168, 121, 93, 44, 148, 42, 180, 103, 11, 40,
% 168, 96>>,
% NoisePrologue = <<>>,
% [{"127.0.0.1", 6969, "tcp", NoiseStr, ServicePubkey, NoisePrologue}].
deploy_rct_III(SignedCreateTx) ->
case hz:post_tx(SignedCreateTx) of
{ok, Result_III} ->
io:format("Result the third: ~tp~n", [Result_III]);
Error ->
io:format("you are a failure III: ~tp~n", [Error]),
error(Error)
end.