Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

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

[[email protected], [email protected], [email protected], OS:[email protected]]

@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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Addressing a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants