makerdao / multicall.js

Multicall.js: A JavaScript blockchain state management library for dapps
MIT License
421 stars 97 forks source link

vals can be null in decodeParameters and lib crashes #40

Open Elyx0 opened 3 years ago

Elyx0 commented 3 years ago
function decodeParameters(types, vals) {
  return defaultAbiCoder.decode(types, '0x' + vals.replace(/0x/i, ''));
}

vals being null the replace crashes the whole stuff.

Coming from

            outerResultsDecoded = decodeParameters(['uint256', 'bytes[]'], outerResults);

with outerResults being undefined.

returnDataMeta is the correct length.

testmulticall.js TypeError: Cannot read property 'replace' of undefined
    at rs (multicall.esm.js:24)
    at multicall.esm.js:264
    at c (runtime.js:63)
Elyx0 commented 3 years ago

It fixed itself. No clue, maybe the RPC hit quotas... any other idea why vals could be undefined?