Eos: Tables is empty in abi file generated by eosiocpp -g

Created on 2 Aug 2018  路  15Comments  路  Source: EOSIO/eos

When using eosiocpp -g to generate an abi file, the "tables" field is empty.
version: mainnet-1.1.1
eg. eosiocpp -g eosio.token.abi eosio.token.cpp

Support

Most helpful comment

So you've made a wrong usage of the "get balance" method.
Usage: cleos get currency balance contract account [symbol]
the "contract" should be the account name which you deployed your contract on, here is "vcchaintest3", not "vcctoken".
try cleos -u http://dev.cryptolions.io:38888 get currency balance vcchaintest3 vcchaintest3 BBQ

All 15 comments

Same issue. I read the issue ttps://github.com/EOSIO/eos/issues/4186 .
And i added //@and comment

         //@abi table accounts
         struct account {
            asset    balance;

            uint64_t primary_key()const { return balance.symbol.name(); }
         };

But other error occur when I run eosiocpp -g

abi_generation_exception: Unable to generate abi
false: Unable to guess index type

image
I tried to add the comment like above as I learned from others, but it still does not work, the tables were created but the cleos get currency balance still does not work

That command doesn't work for native contract (eosio.XXXX)
I think you should try to use script eosio_build.sh

@quocle108 It doesn't work with user-defined contracts either, "eosio.token" is just an example.
BTW, i don't think there's any difference between user-defined contracts and system constracts

I've found that the name of the struct MUST be less then 13 characters (excludes "_"), then adding the @abi macro.
Note that the table name in the @abi macro should be the same with the one in typedef.

@yiran-ever hi Li Cheng, so i tried to keep the table name in the @abi the same with the one in typedef, but still unable to get the currency balance :(

here is how i changed my hpp file:
image

here is how the new generated abi table looks like:
image

this is what the eosio.token default abi looks like(how should my abi table supposed to look like):
image

I NOTICED THAT THE Key_names and Key_types have been changed in the new generated abi table!

And here is the result: :(
image

@KennyLiu25775 don't know how you deployed your contract. I tried cleos --url http://dev.cryptolions.io:38888 get abi vcctoken, but got errors.

@yiran-ever Hi , so did your code work? Would you mind posting a picture of how you add the @abi comment? thanks!

1

I did exactly what you did with your hpp file, but i still got error :( :(
image


image

cleos -u http://dev.cryptolions.io:38888 get abi vcctoken still not working. Maybe you can post a picture of how you deployed the contract?

Yeah sure, here was how I deployed the contract, I think i did it correctly?
image
Oh and just FYI if you wanna see my abi maybe you wanna try this command and it works, thanks @yiran-ever
cleos -u http://dev.cryptolions.io:38888 get abi vcchaintest3

So you've made a wrong usage of the "get balance" method.
Usage: cleos get currency balance contract account [symbol]
the "contract" should be the account name which you deployed your contract on, here is "vcchaintest3", not "vcctoken".
try cleos -u http://dev.cryptolions.io:38888 get currency balance vcchaintest3 vcchaintest3 BBQ

@yiran-ever Thank you so much my friend. My mistake haha, problem solved!

But I do think the command description is little misleading, I dont know if it is just for me but it specifically asked for the name of the contract. In this case, maybe it should say "the account name which you deployed your contract"?

image

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zxf969175364 picture zxf969175364  路  3Comments

hoopslb picture hoopslb  路  3Comments

jcalfee picture jcalfee  路  3Comments

jiazechen picture jiazechen  路  3Comments

IvanYakimov picture IvanYakimov  路  3Comments