eos icon indicating copy to clipboard operation
eos copied to clipboard

what is the latest way to generate an abi file

Open yankunsam opened this issue 8 years ago • 8 comments

➜ eosio.system git:(master) ✗ eosiocpp -g eosio.system.abi eosio.system.hpp 1419166ms thread-0 abi_generator.hpp:68 ricardian_contracts ] Warning, no ricardian clauses found for

1420685ms thread-0 main.cpp:105 main ] 999999 abi_generation_exception: Unable to generate abi false: types can only be: vector, struct, class or a built-in type. (double) {"type":"double"} thread-0 abi_generator.cpp:626 add_type

{}
thread-0  abi_generator.cpp:299 handle_decl

{"decl_location":"/Users/sam/Public/eos/contracts/eosio.system/eosio.system.hpp:84:11"}
thread-0  abi_generator.cpp:44 handle_tagdecl_definition

1420685ms thread-0 main.cpp:105 main ] output: {"version":"eosio::abi/1.0","types":[],"structs":[],"actions":[],"tables":[],"ricardian_clauses":[],"error_messages":[],"abi_extensions":[]}

yankunsam avatar Jun 08 '18 09:06 yankunsam

I am seeing the same issue when I use eosiocpp -n to create scaffolding and then compile, my abi is flat and wen i set contract it works but can call the action as it is not defined in abi "version": "eosio::abi/1.0", "types": [], "structs": [], "actions": [], "tables": [], "ricardian_clauses": [], "error_messages": [], "abi_extensions": []

PatientDirected avatar Jun 08 '18 20:06 PatientDirected

Found the issue - use eosiocpp -g beta1.abi beta1.cpp

use cpp file not recommended hpp file as 2nd param

PatientDirected avatar Jun 08 '18 20:06 PatientDirected

@PatientDirected BY cpp file, also issues:

➜ eosio.system git:(master) ✗ eosiocpp -g eosio.system.abi eosio.system.cpp In file included from /Users/sam/Public/eos/contracts/eosio.system/eosio.system.cpp:4: /Users/sam/Public/eos/contracts/eosio.system/producer_pay.cpp:3:10: fatal error: 'eosio.token/eosio.token.hpp' file not found #include <eosio.token/eosio.token.hpp> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 415302ms thread-0 main.cpp:105 main ] 999999 abi_generation_exception: Unable to generate abi res: {} thread-0 abi_generator.hpp:367 MacroExpands 415302ms thread-0 main.cpp:105 main ] output: {"version":"eosio::abi/1.0","types":[],"structs":[],"actions":[],"tables":[],"ricardian_clauses":[],"error_messages":[],"abi_extensions":[]} ➜ eosio.system git:(master) ✗

yankunsam avatar Jun 08 '18 21:06 yankunsam

@yankunsam

Just edit file "eosio.token.cpp", replace #include <eosio.token/eosio.token.hpp> with #include <eosio.token.hpp>.

isha-padalia avatar Jun 13 '18 10:06 isha-padalia

please use "eosiocpp -g <abiFile> <cppFile> to generate abi file. Please notice this method doesn't work with native contract eosio.token.cpp

taokayan avatar Jun 25 '18 09:06 taokayan

@taokayan can you provide explanation why is it not working with that contract?

What about for a contract that has the code copied from eosio.token?

dominic-healid avatar Jun 26 '18 01:06 dominic-healid

@taokayan Sorry for the long time, I write and compile a contract as dice. It works now.

yankunsam avatar Jun 26 '18 07:06 yankunsam

@taokayan Could you explain why eosiocpp -g <abiFile> <cppFile> doesnt work with the eosio.token.cpp file? I'm encountering the same problem.

craigbranscom avatar Jul 06 '18 22:07 craigbranscom