diff --git a/src/hz.erl b/src/hz.erl index 0e2271b..9200e89 100644 --- a/src/hz.erl +++ b/src/hz.erl @@ -788,9 +788,9 @@ contract_code(ID) -> Result :: {ok, Source} | {project, Bundle} | {error, Reason}, - Source :: string(), + Source :: binary(), Bundle :: [{FilePath :: string(), Contents :: binary()}], - Reason :: chain_error() | string(). + Reason :: chain_error() | string(). %% @doc %% Retrieve the code of a contract as represented on chain. @@ -809,6 +809,8 @@ extract(Blobby) -> extract2(TarBaby) -> case erl_tar:extract({binary, TarBaby}, [memory, compressed]) of + {ok, [{_File, Source}]} -> + {ok, Source}; {ok, Bundle} -> {project, Bundle}; Error -> @@ -895,6 +897,11 @@ request(Path) -> hz_man:request(unicode:characters_to_list(Path)). +-spec request(Path, Payload) -> {ok, Value} | {error, Reason} + when Path :: unicode:charlist(), + Payload :: unicode:charlist(), + Value :: map(), + Reason :: hz:chain_error(). request(Path, Payload) -> hz_man:request(unicode:characters_to_list(Path), Payload). @@ -930,7 +937,7 @@ contract_create(CreatorID, Path, InitArgs) -> Gas = 500000, GasPrice = min_gas_price(), contract_create(CreatorID, Nonce, - Amount, TTL, Gas, GasPrice, + Gas, GasPrice, Amount, TTL, Path, InitArgs); Error -> Error