It looks like you're new here. If you want to get involved, click one of these buttons!
o0ragman0o
Posts: 1,246Member, Moderator mod
contract GizmoThe gizmo creates fine and I can get a Gizmo.val returned through Factory.getGizmoVal().
{
int public val;
function Gizmo(int v) {
val = v;
}
}
contract Factory
{
Gizmo public gizmoAddr;
function Create(int _value) returns (Gizmo) {
gizmoAddr = new Gizmo(_value);
return gizmoAddr;
}
function getGizmoVal() constant returns (int) {
return gizmoAddr.val();
}
}
var gizmoABI = [{"constant":true, "inputs":[], "name":"val", "outputs":[{"name":"", "type":"int256"}], "type":"function"},
{"constant":true, "inputs":[], "name":"Val", "outputs":[{"name":"", "type":"int256"}], "type":"function"},
{"inputs":[{"name":"v", "type":"int256"}], "type":"constructor"}],
gizmoAddr,
gizmoInst,
gizmo = web3.eth.contract(gizmoABI);
function create() {
var val = document.getElementById('key').value;
gizmoAddr = contracts['Factory'].contract.Create(val,{from: web3.eth.accounts[0],gas:200000});
gizmoInst = gizmo.at(gizmoAddr);
}
The gizmoAddr that is returned to JS is different from Factory.gizmoAddr which appears to be the correct one. However, trying gizmoInst = gizmo.at(gizmoAddr); in the console fails with > gizmoInst = gizmo.at(gizmoAddr);
Error: INVALID_PARAMS: Invalid method parameters (invalid name and/or type) recognised
Comments
as described in the web.js docs