This commit is contained in:
Craig Everett 2026-04-06 17:28:31 +09:00
parent 9365c33351
commit acd84d65a8

View File

@ -27,6 +27,7 @@
fundef = none :: none | fun_def(), fundef = none :: none | fun_def(),
build = none :: none | map(), build = none :: none | map(),
args = [] :: [#w{}], args = [] :: [#w{}],
kp = #w{} :: #w{},
ttl = #w{} :: #w{}, ttl = #w{} :: #w{},
gasprice = #w{} :: #w{}, gasprice = #w{} :: #w{},
gas = #w{} :: #w{}, gas = #w{} :: #w{},
@ -121,7 +122,7 @@ init({Prefs, {FunName, FunType}, ConID, Build, Selected, Keys}) ->
State = State =
#s{wx = Wx, frame = Frame, j = J, prefs = Prefs, #s{wx = Wx, frame = Frame, j = J, prefs = Prefs,
con_id = ConID, build = Build, con_id = ConID, build = Build,
args = Args, keypicker = KeyPicker, args = Args, kp = KeyPicker,
ttl = TTL_T, gasprice = GasPriceT, gas = GasT, amount = AmountT, ttl = TTL_T, gasprice = GasPriceT, gas = GasT, amount = AmountT,
action = Action, copy = Copy}, action = Action, copy = Copy},
{Frame, State}. {Frame, State}.
@ -276,12 +277,31 @@ engage(State = #s{con_id = ConID, build = Build, fundef = {Name, Type}}, ChainID
end. end.
params(#s{ttl = #w{wx = TTL}, params(State = #s{kp = #w{wx = KeyPicker}}) ->
gasprice = #w{wx = GasPrice}, ID = wxChoice:getString(KeyPicker, wxChoice:getSelection(KeyPicker)),
gas = #w{wx = Gas}, PK = unicode:characters_to_binary(ID),
amount = #w{wx = Amount}, case hz:next_nonce(PK) of
}) -> {ok, Nonce} -> params2(State, PK, Nonce);
Error -> handle_troubling(State, Error)
end.
params2(State, PK, Nonce) ->
Params = extract(State),
params2(#s{ttl = #w{wx = TTL_T},
gasprice = #w{wx = GasPriceT},
gas = #w{wx = GasT},
amount = #w{wx = AmountT}},
PK,
Nonce) ->
TTL = wxTextCtrl:getValue(TTL_T),
GasPrice = wxTextCtrl:getValue(GasPriceT),
extract(State) -> extract(State, {none, none, none, none}).
extract(State = #s{ttl = W}, {none, none, none, none}) ->
extract(State = #s{gasprice = W}, {TTL, none, none, none}) ->
extract(State = #s{gas = W}, {TTL, GP, none, none}) ->
extract(State = #s{amount = W}, {TTL, GP, Gas, none}) ->
args(#s{args = ArgFields}) -> args(#s{args = ArgFields}) ->
@ -312,10 +332,11 @@ do_call2(State, SignedTX) ->
Error -> handle_troubling(State, Error) Error -> handle_troubling(State, Error)
end. end.
do_dry_run(State, ConID, TX) -> do_dry_run(State, ConID, TX) ->
case hz:dry_run(TX) of case hz:dry_run(TX) of
{ok, Result} -> gd_v_devman:dryrun_result(ConID, Result); {ok, Result} -> update_info(State#s{tx_info = Result});
Other -> gd_v_devmam:trouble({error, ConID, Other}) Other -> handle_troubling(State, {error, ConID, Other})
end. end.
@ -332,7 +353,7 @@ check_tx(State = #s{tx_data = #{"tx_hash" := TXHash} = TXData, tx_info = none})
Error -> Error ->
handle_troubling(State, Error) handle_troubling(State, Error)
end; end;
check_tx(State = #s{tx_info = TXInfo}) -> check_tx(State) ->
ok = tell("Nothing to check"), ok = tell("Nothing to check"),
State. State.