我正在尝试使用JSON RPC,使用节点js请求方法。我正在使用本地客户端洞穴,当我调用请求时,我会收到错误消息
代码:-32700,“message”:“无法解析请求:json:无法将数组解组为类型为rpc.RPCRequest的Go值”
getAddressBalance = function() {
var url = "http://localhost:1337/rpc"; //connecting to local burrow client
var address = "0128AB28AADFB73433C4C3495A618C019097E158";// address got 300000 balance in account ;
var Balance={
id:"0",
method:"getBalance",
params:{address},
jsonrpc:"2.0",
}
var options = {
"method": "POST",
"url": url,
"headers": {
"content-type": "application/json"
},
"body": Balance,
"json": true
};
//Request burrow client
request(options, function(error, response, decoded) {
if (error) throw new Error(error);
console.log(response);
console.log(decoded);
});