I want to convert string data to address type.I know that we can directly use address type in the parameters, but for some reason I want to convert it from string to address.
sample code
function check(string _address,string _name,string _password) public returns (string)
{
address add=address(_address);
if(!checkUser(add))
{
Useraccnts.push(add)-1;
Users storage myuser=users[add];
myuser.name=_name;
myuser.password=_password;
return "true";
}
else
{
return "false";
}
}
I got JSON-RPC: internal error while executing this function. so I want to check whether it would be resolved if I change the address to a string. If you know how to resolve the JSON-RPC error please help me out.
registerUser: function() {
var self = this;
var acc=account;
var name=document.getElementById("name").value;
var password=document.getElementById("password").value;
var meta;
CoinFlipper.deployed().then(function(instance) {
meta = instance;
return meta.check.call(acc,name,password).then(function (value) { },
I'm using the above function in app.js.
Error: Invalid JSON RPC response: {"id":6,"jsonrpc":"2.0","error":{"code":-32603}} at Object.InvalidResponse (app.js:10374)
_address
as address instead of string:function check(address _address,string _name,string _password)
so the parsing is done in the client side.check
function?.