Skip to content

Commit

Permalink
Merge pull request #8 from EOSIO/variant
Browse files Browse the repository at this point in the history
ABI 1.1 support
  • Loading branch information
tbfleming authored Sep 19, 2018
2 parents 1b38fd6 + c7f86bb commit b073742
Show file tree
Hide file tree
Showing 5 changed files with 1,257 additions and 289 deletions.
6 changes: 4 additions & 2 deletions src/abieos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ extern "C" abieos_bool abieos_set_abi(abieos_context* context, uint64_t contract
abi_def def{};
if (!json_to_native(def, abi))
return false;
check_abi_version(def.version);
auto c = create_contract(def);
context->contracts.insert({name{contract}, std::move(c)});
return true;
Expand All @@ -112,6 +113,7 @@ extern "C" abieos_bool abieos_set_abi_bin(abieos_context* context, uint64_t cont
context->last_error = "abi parse error";
if (!data || !size)
throw std::runtime_error("no data");
check_abi_version(input_buffer{data, data + size});
abi_def def{};
if (!bin_to_native(def, {data, data + size}))
return false;
Expand Down Expand Up @@ -183,8 +185,8 @@ extern "C" const char* abieos_bin_to_json(abieos_context* context, uint64_t cont
const char* data, size_t size) {
fix_null_str(type);
return handle_exceptions(context, nullptr, [&]() -> const char* {
if (!data || !size)
throw std::runtime_error("no data");
if (!data)
size = 0;
context->last_error = "binary decode error";
auto contract_it = context->contracts.find(::abieos::name{contract});
if (contract_it == context->contracts.end())
Expand Down
Loading

0 comments on commit b073742

Please sign in to comment.