I am creating a contract of storing all the names and address of the users.
Then I returning the array of the names and address.
contract demo{
address public user;
uint public i=0;
function demo(){
user=msg.sender;
}
address[10] users;
bytes32[10] name;
function add(bytes32 _name){
users[i]=user;
name[i]=_name;
i++;
}
function get_names() returns(bytes32[10]){
return name;
}
function get_address() returns(address[10]){
return users;
}
}
when I call the get_names function using web3, it did not returning the names of all the added users.
please help me what to do...
here is the code of web3
mycontract=web3.eth.contract(ABIArray).at(contract_Address);
console.log(mycontract);
var defaultAccount = web3.eth.defaultAccount;
mycontract.get_names(function(err,res){
console.log("get_names "+res);
TemplateVar.set(template, "counter", res);
})
mycontract.get_address(function(err,res){
console.log("get_address "+res);
TemplateVar.set(template, "counter1", res);
})
mycontract.i(function(err,res){
console.log("i "+res);
TemplateVar.set(template, "counter2", res);
})
And the returned value is not an array of names or address.