Make Contract Calls Great Again #35

Merged
zxq9 merged 37 commits from iface3 into master 2026-05-10 15:39:25 +09:00
Showing only changes of commit ca933a33db - Show all commits
+2 -8
View File
@@ -87,7 +87,7 @@ tx_info(Win) ->
%%% Startup Functions %%% Startup Functions
start_link(Args) -> start_link(Args) ->
wx_object:start_link({local, ?MODULE}, ?MODULE, Args, []). wx_object:start_link(?MODULE, Args, []).
init({Prefs, FunDef = {FunName, FunIlk}, ConID, Build, Selected, Keys}) -> init({Prefs, FunDef = {FunName, FunIlk}, ConID, Build, Selected, Keys}) ->
@@ -472,8 +472,7 @@ dry_run2(State = #s{funret = ReturnType,
State. State.
check_tx(State = #s{frame = Frame, check_tx(State = #s{j = J,
j = J,
fundef = {_, init}, fundef = {_, init},
tx_data = #{"tx_hash" := TXHash}, tx_data = #{"tx_hash" := TXHash},
tx_info = none, tx_info = none,
@@ -485,7 +484,6 @@ check_tx(State = #s{frame = Frame,
ok = tell(info, "Contract deployed: ~p", [Info]), ok = tell(info, "Contract deployed: ~p", [Info]),
_ = wxButton:disable(ActionB), _ = wxButton:disable(ActionB),
ok = gd_con:open_contract(ConID), ok = gd_con:open_contract(ConID),
ok = wxWindow:destroy(Frame),
self() ! retire, self() ! retire,
State; State;
{error, "Tx not mined"} -> {error, "Tx not mined"} ->
@@ -502,7 +500,6 @@ check_tx(State = #s{frame = Frame,
end; end;
check_tx(State = #s{j = J, check_tx(State = #s{j = J,
funret = ReturnType, funret = ReturnType,
con_id = ConID,
tx_data = #{"tx_hash" := TXHash}, tx_data = #{"tx_hash" := TXHash},
tx_info = none, tx_info = none,
status = submitted, status = submitted,
@@ -512,7 +509,6 @@ check_tx(State = #s{j = J,
info = #w{wx = InfoT}}) -> info = #w{wx = InfoT}}) ->
case hz:tx_info(TXHash) of case hz:tx_info(TXHash) of
{ok, Info = #{"call_info" := #{"return_type" := "ok", {ok, Info = #{"call_info" := #{"return_type" := "ok",
"contract_id" := ConID,
"return_value" := ReturnCB}}} -> "return_value" := ReturnCB}}} ->
FormattedInfo = io_lib:format("~tp", [Info]), FormattedInfo = io_lib:format("~tp", [Info]),
_ = wxButton:enable(CopyB), _ = wxButton:enable(CopyB),
@@ -520,7 +516,6 @@ check_tx(State = #s{j = J,
ReturnV = hz:decode_bytearray(ReturnCB, {sophia, ReturnType}), ReturnV = hz:decode_bytearray(ReturnCB, {sophia, ReturnType}),
ok = wxTextCtrl:setValue(ReturnT, ReturnV), ok = wxTextCtrl:setValue(ReturnT, ReturnV),
ok = wxTextCtrl:setValue(InfoT, FormattedInfo), ok = wxTextCtrl:setValue(InfoT, FormattedInfo),
ok = gd_con:show_call(ConID, Info, false),
State#s{status = included, tx_info = Info}; State#s{status = included, tx_info = Info};
{ok, Reason = #{"call_info" := #{"return_type" := "revert", "return_value" := ReturnCB}}} -> {ok, Reason = #{"call_info" := #{"return_type" := "revert", "return_value" := ReturnCB}}} ->
_ = wxButton:enable(CopyB), _ = wxButton:enable(CopyB),
@@ -529,7 +524,6 @@ check_tx(State = #s{j = J,
ok = wxTextCtrl:setValue(ReturnT, ReturnV), ok = wxTextCtrl:setValue(ReturnT, ReturnV),
FormattedInfo = io_lib:format("~tp", [Reason]), FormattedInfo = io_lib:format("~tp", [Reason]),
ok = wxTextCtrl:setValue(InfoT, FormattedInfo), ok = wxTextCtrl:setValue(InfoT, FormattedInfo),
ok = gd_con:show_call(ConID, Reason, false),
State#s{status = rejected, tx_info = Reason}; State#s{status = rejected, tx_info = Reason};
{error, "Tx not mined"} -> {error, "Tx not mined"} ->
ok = wxTextCtrl:setValue(InfoT, J("[Transaction not yet mined.]")), ok = wxTextCtrl:setValue(InfoT, J("[Transaction not yet mined.]")),