EOSIO / eosjs

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

Instantiating with Eos.Testnet() fetches against localhost endpoint #27

Closed wethinkagile closed 6 years ago

wethinkagile commented 6 years ago

I use this.eos = Eos.Testnet(); as per README, but it tries to connect to localhost.

{ FetchError: request to http://127.0.0.1:8888/v1/chain/get_block failed, reason: connect ECONNREFUSED 127.0.0.1:8888

Or do I have to run eosc and eos_walletd locally and point that one against testnet1?

This works however:

    const config = {
      httpEndpoint: 'http://testnet1.eos.io'
    };

Would be great to clarify this and a bit more context (in the README?) even if trivial problem.

jcalfee commented 6 years ago

Thanks for being patient.. I was on another branch for eosjs dawn3..

having a look today.. I'm thinking for CORS reasons I can just direct the testnet to this node: http://t1readonly.eos.io

jcalfee commented 6 years ago

eosjs@6.1.9

nsjames commented 6 years ago

Perhaps these should be consolidated into a singular constructor now to prepare for the multi chains that will be launched in June. Default to localhost with the ability to specify httpEndpoint as per usual.

jcalfee commented 6 years ago

The thinking is that there will be Testnet, or Staging, and Mainnet where there are different data-structures behind it. httpEndpoint is accepted in every case. Maybe the constructors should be named by version (dawn2, dawn3, etc) instead of environment.