Differentiate between source return types

This commit is contained in:
2026-05-09 20:07:52 +09:00
parent fd2158a465
commit cd4f6a56a5
+10 -5
View File
@@ -783,9 +783,13 @@ contract_code(ID) ->
end.
-spec contract_source(ID) -> {ok, Bytecode} | {error, Reason}
when ID :: contract_id(),
Bytecode :: contract_byte_array(),
-spec contract_source(ID) -> Result
when ID :: contract_id(),
Result :: {ok, Source}
| {project, Bundle}
| {error, Reason},
Source :: string(),
Bundle :: [{FilePath :: string(), Contents :: binary()}],
Reason :: chain_error() | string().
%% @doc
%% Retrieve the code of a contract as represented on chain.
@@ -805,8 +809,9 @@ extract(Blobby) ->
extract2(TarBaby) ->
case erl_tar:extract({binary, TarBaby}, [memory, compressed]) of
{ok, Project} -> {ok, Project};
Error ->
{ok, Bundle} ->
{project, Bundle};
Error ->
io:format("Dis chit happen: ~tp~n", [Error]),
{ok, TarBaby}
end.