CityOfZion / neon-js

Javascript libraries that allow the applications to interact with NEO blockchain
https://docs.coz.io/neo3/neon-js/index.html
MIT License
184 stars 166 forks source link

Unable to get Balance object on Testnet #263

Closed conscott closed 6 years ago

conscott commented 6 years ago

It seems

api.neonDB.getBalance('TestNet', addr)

times out and

api.neoscan.getBalance('TestNet, addr) 

is unable to find balances for Testnet Addresses that do have a NEO/GAS balance

Because of this, I am unable to test http://cityofzion.io/neon-js/docs/en/adv_multitx.html

Additionally, trying to use intents with doInvoke fails because it gets:

"This balance does not contain any GAS!" (even though it does).

uvmetal commented 6 years ago

FYI I can't reproduce this as described above when testing directly against neoscan-testnet.io/api/test_net/v1/get_balance/address.

An old account that has a balance yields the following:

screen shot 2018-05-30 at 1 05 50 pm

A new account that has no balance shows:

screen shot 2018-05-30 at 1 05 04 pm

So it looks like something to do with neoscan-testnet.

For S&Gs I reviewed the neoscan.js code at:

https://github.com/CityOfZion/neon-js/blob/c6a169a82a4d037e00dccd424f53cdc818d6b3ae/src/api/neoscan.js#L70

and I must admit I don't understand why that line is even there. It appears to return a new balance if the address does not match the response.data.address and if the balance is null. It appears to be error checking for cases against the second screenshot above but :man_shrugging:.

I was working on something related and thought I'd share my 2 cents.

Salud

conscott commented 6 years ago

Thank you for the response.

For my address I am looking at AL8abuPwBMmmvaj1EttZr6B6R7NDoXBsm6, the RPC interface gives expected balance:

curl -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"getaccountstate", "params": ["AL8abuPwBMmmvaj1EttZr6B6R7NDoXBsm6"], "id": 3}' seed2.neo.org:20332

but NeoScan API does not: https://neoscan-testnet.io/api/test_net/v1/get_balance/AL8abuPwBMmmvaj1EttZr6B6R7NDoXBsm6

Curious if anyone knows why.

uvmetal commented 6 years ago

That would be an issue with https://github.com/CityOfZion/neo-scan. Maybe open an issue there.

conscott commented 6 years ago

You are right. Have opened an issue there :)

Closing this one.