cb is not defined
relaxbao opened this issue · 0 comments
relaxbao commented
ethjs-query
Description
hello , when i use the eth.getBalance('0x04D43d123C04884177b55E4c70A50F348fE82df5',cb)
i get the following error , is there something wrong with my code ?
(node:15526) UnhandledPromiseRejectionWarning: ReferenceError: cb is not defined
at getbalance (/home/linfang/workspace/uport/ethr-did/src/main.js:22:81)
at Object.<anonymous> (/home/linfang/workspace/uport/ethr-did/src/main.js:26:1)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
(node:15526) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:15526) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
here is my code :
let HttpProvider = require('ethjs-provider-http')
const Eth = require('ethjs-query');
const provider = new HttpProvider('http://localhost:7545')
const eth = new Eth( new HttpProvider('http://localhost:7545'));
async function getbalance() {
let value = await eth.getBalance('0x04D43d123C04884177b55E4c70A50F348fE82df5',cb)
console.log(value)
}
getbalance()
when i changed the getBalsnce with removing the cb
: eth.getBalance('0x04D43d123C04884177b55E4c70A50F348fE82df5',)
,
it returned
<BN: 56b060b1d14f70000>
(node:15984) [DEP0079] DeprecationWarning: Custom inspection function on Objects via .inspect() is deprecated
acctually, the balance of the account is 99.95 ETH
how can I get the right balance ?
thank you very much ~