eosjs icon indicating copy to clipboard operation
eosjs copied to clipboard

TypeError: Cannot read property 'JsonRpc' of undefined

Open yashwanth2804 opened this issue 8 years ago • 4 comments

Version of EOSJS beta

Describe the bug giving issue while I am providing process.env.REACT_APP_EOSIO_HTTP_URL valid end point

TypeError: Cannot read property 'JsonRpc' of undefined
new EOSIOClient
src/utils/eosio-client.js:8
   5 | console.log("^^^^^^^^^^^^^^^^^")
   6 | console.log(process.env.REACT_APP_EOSIO_HTTP_URL)
   7 | console.log("^^^^^^^^^^^^^^^^^")
>  8 | const rpc = new eosjs.Rpc.JsonRpc(process.env.REACT_APP_EOSIO_HTTP_URL)
   9 | const signatureProvider = new eosjs.SignatureProvider([process.env.REACT_APP_EOSIO_PRIVATE_KEY])
  10 | this.contractAccount = contractAccount
  11 | this.eos = new eosjs.Api({ rpc, signatureProvider })

yashwanth2804 avatar Oct 10 '18 11:10 yashwanth2804

use import {Rpc, SignatureProvider, Api} from 'eosjs'

and const rpc = new Rpc.JsonRpc( ... const sp = new SignatureProvider( ... const api = new Api( ...

iKest avatar Oct 10 '18 11:10 iKest

Still not working I changed to what u suggsted

jsonrpc That too while in import statement it showing thi warning

[ts]
Could not find a declaration file for module 'eosjs'.

yashwanth2804 avatar Oct 10 '18 11:10 yashwanth2804

need to see import eosjs code section

iKest avatar Oct 10 '18 11:10 iKest

Thank you I solved the issue, i un knowningly changed that [language] to typescript, with this effect every node module not imported after resetting worked fine . After changing from typescript to babel woking fine screenshot from 2018-10-10 17-50-42

yashwanth2804 avatar Oct 10 '18 12:10 yashwanth2804