我正在尝试使用meteor HTTP
复制以下curl命令 curl -X POST --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":83}' http://localhost:8545
该命令来自here
这就是我的尝试:
HTTP.call('POST',"http://localhost:8545",{data:{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":83}},function(res,error){console.log(res)})
但它返回null。 curl命令提供{"jsonrpc":"2.0","id":83,"result":"(the blocknumber)"}
答案 0 :(得分:1)
你必须交换错误和res params。
HTTP.call('POST',"http://localhost:8545",{data:{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":83}},function(error, res){console.log(res)})