0

Logging response from JavaScript promise API call is showing [object object] in the console window? how to wait for the result and log?.

below is the following code for which I am getting [object][object].

const estimateGas = (to, data, network) =>
  new Promise((resolve,reject) =>
  axios.post(getUriByNetwork(network), {
  jsonrpc : "2.0",
  method : "eth_estimateGas",
  params : [{
  "to": to
  }],
  id : 1
})
.then(function (response) {
resolve(response)
console.log(` estimateGas ${response}`)
})
.catch(reject)
)

0 Answers0