EOSIO / eos

An open source smart contract platform
https://developers.eos.io/manuals/eos
MIT License
11.27k stars 3.6k forks source link

what is the latest way to generate an abi file #3942

Closed yankunsam closed 6 years ago

yankunsam commented 6 years ago

➜ 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":[]}

PatientDirected commented 6 years ago

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 commented 6 years ago

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

use cpp file not recommended hpp file as 2nd param

yankunsam commented 6 years ago

@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) ✗

isha-padalia commented 6 years ago

@yankunsam

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

taokayan commented 6 years ago

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

dominic-healid commented 6 years ago

@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?

yankunsam commented 6 years ago

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

craigbranscom commented 6 years ago

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