2

I have an instance of a Gizmo contract created by a Factory but I can't hook into it from JS.

> gizmoInst = web3.eth.contract(gizmoABI).at(gizmoAddr)
Error: INVALID_PARAMS: Invalid method parameters (invalid name and/or type) recognised

Any clues?

  • I can't connect to any contracts using the web3.eth.contract methods. – o0ragman0o May 18 '16 at 4:57
  • did you deploy it on test or private network and try to access it on main, sorry to ask this dumb question but it happened to me once ;) – euri10 May 18 '16 at 6:37
  • I'm trying this in Mix console so it's just Mix's sealed blocks. I haven't deployed anything to the chains yet because I can't get past this issue. – o0ragman0o May 18 '16 at 7:06
2

The error was that I was passing a stringified ABI to web3.eth.contract(ABI) and not an array object.

1

if you're using Mix the access to the contract is just done using contracts["contractName"] . if you follow the tutorial here, they write a contract called Rating. the way to access it in the javascript code is the following :

var res = contracts["Rating"].contract.ratings(param);

Si I'd try to access it through contracts["Gizmo"] or whatever name you called it.

  • The problem is that Gizmo is dynamically created by a Factory contract and so doesn't exist in the contracts[] object. – o0ragman0o May 18 '16 at 7:37
  • did you have successfully mined it after creation ? – euri10 May 18 '16 at 7:43
  • yes and the Factory contract can see it fine and read it's publics – o0ragman0o May 18 '16 at 8:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.