Add new encode function interface

This commit is contained in:
Robert Virding
2019-02-26 02:01:00 +01:00
parent 931f2d3dcb
commit 6f582af83e
2 changed files with 53 additions and 20 deletions
+2 -2
View File
@@ -85,7 +85,7 @@ json_string() = binary()
### Exports
#### encode(ContractString) -> JSONstring
#### encode(ContractString) -> {ok,JSONstring} | {error,ErrorString}
Types
@@ -114,7 +114,7 @@ This is an example of using the ACI generator from an Erlang shell. The file cal
``` erlang
1> {ok,Contract} = file:read_file("aci_test.aes").
{ok,<<"contract Answers =\n record state = { a : answers }\n type answers() = map(string, int)\n\n stateful function"...>>}
2> Encoding = aeso_aci:encode(Contract).
2> {ok,Encoding} = aeso_aci:encode(Contract).
<<"{\"contract\":{\"name\":\"Answers\",\"type_defs\":[{\"name\":\"state\",\"vars\":[],\"typedef\":\"{a : map(string,int)}\"},{\"name\":\"ans"...>>
3> file:write_file("aci_test.aci", Encoding).
ok