Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

web3.js 1.0.0-beta.41 batch.execute() : Error: Given input "function (err, res) {....}" is not a number. #2289

Closed
kim-keepcoding opened this issue Feb 1, 2019 · 1 comment · Fixed by #2320
Labels
Bug Addressing a bug

Comments

@kim-keepcoding
Copy link

const contract = new web3.eth.Contract(abi, address);

const batch = new web3.BatchRequest();
function callback(err,res){
    console.log(err,res)
}
batch.add(contract.methods.balance(address).call.request({from: '0x0000000000000000000000000000000000000000'}, callback));
batch.execute();

work fine with
web3.eth.getBalance.request( "0x0000000000000000000000000000000000000000", "latest", callback )

Expected behavior

execute batch and log callback properly

Actual behavior

throw Error

Steps to reproduce the behavior

  1. [First step]
  2. [Second step]
  3. [and so on...]

Error Logs

Error: Given input "function callback(err,res){
    console.log(err,res)
}" is not a number.
    at Object.numberToHex (node_modules/web3-utils/dist/web3-utils.cjs.js:114:11)
    at inputBlockNumberFormatter (node_modules/web3-core-helpers/dist/web3-core-helpers.cjs.js:37:16)
    at Object.inputDefaultBlockNumberFormatter (node_modules/web3-core-helpers/dist/web3-core-helpers.cjs.js:25:10)
    at CallContractMethod.beforeExecution (node_modules/web3-core-method/dist/web3-core-method.cjs.js:1217:44)

Versions

[NPM@6.4.1, Node@v8.12.0, Web3.js@1.0.0-beta.41, OS:macOs@10.14.2]

@nivida
Copy link
Contributor

nivida commented Feb 3, 2019

Thanks for creating this issue!

I will check this and probably directly fix it tomorrow.

@nivida nivida added the Bug Addressing a bug label Feb 3, 2019
@nivida nivida mentioned this issue Feb 4, 2019
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Addressing a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants