EOSIO / eosjs

General purpose library for the EOSIO blockchain.
http://eosio.github.io/eosjs
MIT License
1.43k stars 463 forks source link

"Table stat is not specified in the ABI" when creating an account #95

Closed sss-CRS-sss closed 6 years ago

sss-CRS-sss commented 6 years ago

When i push transactions "create account and buy&delegate.." got error: api error => {message: "Table stat is not specified in the ABI", file: "chain_plugin.cpp", line_number: 335, method: "get_table_type"} v1/chain/get_currency_stats {"code":"eosio","symbol":"EOS"} The parameter must pass eosio.token, not eosio

jcalfee commented 6 years ago

Thanks, I'm investigating .. Which version of nodeosd are you using?

Keep in mind another change in 4.1 was to renamed EOS to SYS which is in eosjs master (version 12.x) ..

jcalfee commented 6 years ago

published eosjs@12.0.1

sss-CRS-sss commented 6 years ago

eosjs@12.0.1 working, ty!

sim31 commented 6 years ago

I'm getting a similar error:

api error => {message: "Table stat is not specified in the ABI", file: "chain_plugin.cpp", line_number: 335, method: "get_table_type"}file: "chain_plugin.cpp"line_number: 335message: "Table stat is not specified in the ABI"method: "get_table_type"__proto__: Object http://localhost:8888/v1/chain/get_currency_stats {"code":"polleos","symbol":"EOS"}

Note that it's trying to access currency stats in polleos contract for some reason, but this contract is not a token contract.

My abi can be found here. And I'm trying to use it like this:

polleos.newtokenpoll(pollData.question, pollData.options, pollData.token, opts);

Where pollData.token is something like:

pollData.token = {
  value:  "4,EOS",
  contract: "eosio.token"
};
jcalfee commented 6 years ago

A "symbol" is just the precision and 7 letter symbol without specifying any contract 4,SYM. If you send a symbol to a custom contract like polleos it thinks that polleos has its own token called EOS.

Now, I do see I'm missing a type called extended_symbol. I see you tried to create it but that may not work entirely because it needs to programmatically support a string format 4,SYM@contract. So I will add this soon.

I have extended_asset which is all this plus a precision and amount: 1.0000 4,SYM@contract .. Don't think that will help you though. I'll let you know when this type is ready and published.

leefernandes commented 6 years ago

@jcalfee with eosjs ^13.0.0 I'm seeing this error response from getCurrentBalance & getCurrencyStats with a token I've created using the eosio.token contract (https://github.com/EOSIO/eos/tree/master/contracts/eosio.token). Additionally I'm not confident on the expected value for param code. Is this the account's code hash?

cleos works

cleos get currency balance test tester
75.0000 TEST
100.0000 TEST

but I'm not having success with eosjs getCurrentBalance

eos.getCurrencyBalance({
  code: "eosio",
  symbol: "TEST",
  account: "tester",
})
{  
   "code":500,
   "message":"Internal Service Error",
   "error":{  
      "code":3060003,
      "name":"contract_table_query_exception",
      "what":"Contract Table Query Exception",
      "details":[  
         {  
            "message":"Table accounts is not specified in the ABI",
            "file":"chain_plugin.cpp",
            "line_number":570,
            "method":"get_table_type"
         }
      ]
   }
}
leefernandes commented 6 years ago

@jcalfee Just got a successful response by passing the token contract name as the code param value. Sweet!

eos.getCurrencyBalance({
  code: "test",
  symbol: "TEST",
  account: "tester",
})
[
    "75.0000 TEST",
    "100.0000 TEST"
]
gavinwyf commented 5 years ago

Code is equivalent to contract name ? Why?

jeffreyssmith2nd commented 5 years ago

@gavinwyf That's the terminology used by the blockchain https://developers.eos.io/eosio-nodeos/reference#get_code

CaliosD commented 5 years ago

I wonder what the corresponding code for the newest version looks like... I didn't find it anywhere. =_+

AndrewVV commented 5 years ago

This is my worked example:

{ "code" : "eosio.token", "account" : "eosandrewvv1", "symbol": "EOS" }


[ "100.0000 EOS" ]