From cd4f6a56a5d2cbb74e06c63e1671cec0436cf8c3 Mon Sep 17 00:00:00 2001 From: Craig Everett Date: Sat, 9 May 2026 20:07:52 +0900 Subject: [PATCH] Differentiate between source return types --- src/hz.erl | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/hz.erl b/src/hz.erl index 2827f79..88893c6 100644 --- a/src/hz.erl +++ b/src/hz.erl @@ -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.