Velua / eth-multicall

MIT License
7 stars 5 forks source link

Small confusion #1

Closed JhonnyJason closed 3 years ago

JhonnyJason commented 3 years ago

Hello @Velua,

I did not get the code in it's full depth - it's very difficult to read typescript :sweat_smile: xD

But what I am initially confused about is this part of the example code

const tokens = addresses.map((address) => {
   const token = new web3.eth.Contract(ABIERC20Token, address);
   return {
     symbol: token.methods.symbol(),
     decimals: token.methods.decimals(),
   };
 });

token.methods.symbol() isn't this already triggering the calls? I know it is async. But still it would already trigger it, wouldn't it?

Maybe we could have a talk or PMs somewhere to discuss multicall in generall as I am on a quest to get a reasonably simple working package - as I did not find any yet^^ and yours is one of the better ones with slight the problem that I cannot bundle it xD So the attempt would be to extract the good parts from all the packages I could find - write the simplemost one in nice JS.

Cheers!

Velua commented 3 years ago

Thanks! I never imagined anyone else using this package other than the Bancor project I use it in.

token.methods.symbol() isn't this already triggering the calls? I know it is async. But still it would already trigger it, wouldn't it?

Negative! It gets called with token.methods.symbol().call() which happens under the hood.

Reach out to me on Telegram at my website else email me. Will like to look into your bundling issue, would be nice if there was some more users of this library. @JhonnyJason

JhonnyJason commented 3 years ago

Ahhh yhea awesome, thank you for clarification!