diff --git a/src/hz.erl b/src/hz.erl index 57862b2..f48f4dd 100644 --- a/src/hz.erl +++ b/src/hz.erl @@ -45,7 +45,7 @@ acc/1, acc_at_height/2, acc_at_block_id/2, acc_pending_txs/1, next_nonce/1, - dry_run/1, dry_run/2, dry_run/3, + dry_run/1, dry_run/2, dry_run/3, dry_run_map/1, tx/1, tx_info/1, post_tx/1, contract/1, contract_code/1, @@ -643,6 +643,12 @@ dry_run(TX, Accounts, KBHash) -> JSON = zj:binary_encode(DryData), request("/v3/dry_run", JSON). + +dry_run_map(Map) -> + JSON = zj:binary_encode(Map), + request("/v3/dry_run", JSON). + + -spec decode_bytearray_fate(EncodedStr) -> {ok, Result} | {error, Reason} when EncodedStr :: binary() | string(), Result :: none | term(), @@ -762,18 +768,6 @@ contract_code(ID) -> contract_poi(ID) -> request(["/v3/contracts/", ID, "/poi"]). -% TODO -%oracle(ID) -> -% request(["/v3/oracles/", ID]). - -% TODO -%oracle_queries(ID) -> -% request(["/v3/oracles/", ID, "/queries"]). - -% TODO -%oracle_queries_by_id(OracleID, QueryID) -> -% request(["/v3/oracles/", OracleID, "/queries/", QueryID]). - -spec name(Name) -> {ok, Info} | {error, Reason} when Name :: string(), % _ ++ ".chain" @@ -797,7 +791,7 @@ name(Name) -> when Pubkey :: peer_pubkey(), Reason :: term(). % FIXME %% @doc -%% Returns the given node's public key, assuming there an AE node is reachable at +%% Returns the given node's public key, assuming a node is reachable at %% the given address. peer_pubkey() -> @@ -1014,6 +1008,18 @@ contract_create(CreatorID, Nonce, Amount, TTL, Gas, GasPrice, Path, InitArgs) -> end. +-spec contract_create_built(CreatorID, Compiled, InitArgs) -> Result + when CreatorID :: unicode:chardata(), + Compiled :: map(), + InitArgs :: [string()], + Result :: {ok, CreateTX} | {error, Reason}, + CreateTX :: binary(), + Reason :: file:posix() | term(). +%% @doc +%% This function takes the compiler output (instead of starting from source), +%% and returns the unsigned create contract call data with default values. +%% For more control over exactly what those values are, use create_contract/8. + contract_create_built(CreatorID, Compiled, InitArgs) -> case next_nonce(CreatorID) of {ok, Nonce} -> diff --git a/zomp.meta b/zomp.meta index 8363088..3de14e3 100644 --- a/zomp.meta +++ b/zomp.meta @@ -2,16 +2,16 @@ {type,app}. {modules,[]}. {prefix,"hz"}. -{desc,"Gajumaru interoperation library"}. {author,"Craig Everett"}. +{desc,"Gajumaru interoperation library"}. {package_id,{"otpr","hakuzaru",{0,2,0}}}. -{deps,[{"otpr","erl_base58",{0,1,0}}, +{deps,[{"otpr","gmbytecode",{3,4,1}}, + {"otpr","gmserialization",{0,1,2}}, + {"otpr","base58",{0,1,1}}, + {"otpr","eblake2",{1,0,1}}, {"otpr","ec_utils",{1,0,0}}, - {"otpr","aebytecode",{3,2,1}}, {"otpr","aesophia",{7,1,2}}, - {"otpr","aeserialization",{0,1,0}}, {"otpr","zj",{1,1,0}}, - {"otpr","eblake2",{1,0,0}}, {"otpr","getopt",{1,0,2}}]}. {key_name,none}. {a_email,"ceverett@tsuriai.jp"}. @@ -20,6 +20,5 @@ {file_exts,[]}. {license,"MIT"}. {repo_url,"https://gitlab.com/ioecs/hakuzaru"}. -{tags,["aeternity","qpq","gajumaru","blockchain","hakuzaru","crypto","ae", - "defi"]}. +{tags,["qpq","gajumaru","blockchain","hakuzaru","crypto","defi"]}. {ws_url,"https://gitlab.com/ioecs/hakuzaru"}.