I have two simple constant functions in a contract:
function fun1 (address A) constant returns (uint) {
return mappingAS[A].length;
}
function fun2 (address A, uint V) constant returns (string, uint) {
return (mappingAS[A][V], mappingBE[mappingAS[A][V]][(mappingBE[mappingAS[A][V]].length)-1].timeStamp);
}
(Note: the first returns a length of an array (from mapping "address => string[]") and the other one returns values from an exact position in another array (which is as well stored in a mapping "string[] => struct[]")
Now both of these constant functions seem to work in the Mist GUI (contract watch) but if I try to call them through web3:
contractA.fun1(address).call()
contractA.fun2(address, position).call()
I still have to sign those calls as transactions (with password) and a transaction hash gets returned instead.
Contract and ABI are correctly assigned:
var contractA = web3.eth.contract(contractABI).at(contractAddress)
I'm using standard Mist's geth parameters. Should I somehow change the parameters of geth?
Thanks for any hints.
contractA.fun2.call(address, position)
. Did you try that?