Right now I have to call the approval function on every single token. Is there a way I can do this in fewer transactions?
-
Assuming that you're using openzeppeling contracts; it depends on who is the owner of the token; only the token owner can approve an address as operator of the token– CasareaferDec 6, 2022 at 3:03
-
for EOA(Externally Owned Account) it is not possible, because you cannot batch transactions. I think a workaround is to use a multi-sig wallet with 1 signer (EOA) and this wallet will be the owner of the tokens– Majd TLDec 6, 2022 at 10:19
2 Answers
You can submit multiple transactions at once using Gnosis' multisend lib: https://github.com/gnosis/ethers-multisend
You can find some higher level explanations here: https://help.gnosis-safe.io/en/articles/4680071-transaction-builder
-
Multisend requires on delegateCall. You cannot use delegateCall when approving erc20 and erc721 tokens. Dec 9, 2022 at 20:05
If you want a quick solution for this we've made a quick front-end called BlockBucket which is a simple Token MultiSender which batches your transactions from a CSV upload.
Created a bit of a walkthrough video on how to use it here: https://youtu.be/OFOnIUXMbWE