-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JSON-like data structure #9
Comments
A minimal working example: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Background
We can write EOSIO application with any languages, but JavaScript is widely used and eosjs is considered as de facto. On the contract side, multi_index or action arguments written in C++ require static types unlike its interface written in JavaScript.
In nodeos, we already use
fc::variant
which can accept the value that fits the predefined set of types.https://github.com/EOSIO/fc/blob/0b45f08f/include/fc/variant.hpp#L193-L204
eosio::any
(Intentionally, I avoid using the namejson
, because the detailed specification can be different to support extended features.) supports various type of values by one type.Implementation
eosio.cdt:
https://github.com/turnpike/blanc/blob/feature/built_in_type-any/libraries/eosiolib/core/eosio/any.hpp
eosjs:
conr2d/eosjs@056b4b0
Above implementation utilizes
std::variant
infra, so doesn't need consensus change.haderech/eos@a932ffb
For utilizing the benefit of
eosio::any
completely, it's necessary to add new built-in typeany
. Nodeos adopting this can accept JSON directly or return pretty stringified result when queryingeosio::any
data. Whether adopting built-in type or not doesn't affect data exchange between nodes. (Not consensus change, but interface-level difference)Without built-in type support:
With built-in type support:
The text was updated successfully, but these errors were encountered: