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

Research: Can/which SDK packages can support batch transactions with minimal development #245

Open
Graeme-Code opened this issue Oct 29, 2021 · 7 comments

Comments

@Graeme-Code
Copy link

Graeme-Code commented Oct 29, 2021

Background:

1inch has introduced batch transactions for their Safe App. The experience is glorious.
To my knowledge, it is the only "Dapp as a Safe App" that does this. We know from looking at data that most common transactions come from Defi protocols:

  • Uniswap
  • SushiSwap
  • Balancer
  • Aave

Problem:

1inch did the integration via the javascript SDK, it comes with more flexibility than say the web3 modules or onboard.js packages but requires more understanding and work to intergrate.

What can we do?

The purpose of this ticket is to answer the following questions:

  • Can we build or add to the existing packages (onboard.js, web3 modals) to facilitate batch transactions?
  • If yes, how much effort is required by the Dapp developer to facilitate batch transactions?
  • If no, how would a Dapp that uses a package like onboard.js(or other) leverage batch transactions?

What should the research unlock?

If we know that it is possible to facilitate batch transactions via existing web3 wallet libraries, then we can push it as a default standard. If it can't be done, then we need to incentivize and encourage dapp developers through promotion and placement in the Safe Apps UI.

@mmv08
Copy link
Member

mmv08 commented Nov 18, 2021

The biggest obstacle for broader batch transactions support is that only smart contract wallets support them. So it's tough to make a one-stop solution that would use batch transactions for SC wallets and fall back to regular transactions for an EOA wallet. dApp developers need to implement conditional logic for sending txs 1-by-1 or as a batch depending on a wallet.

The only possible way to batch transactions with a Safe is to use the safe-apps-sdk package. It works fine for apps explicitly tailored for the Safe, but not for existing dApps because most of the dapps work with eth providers following EIP-1193. Our solutions (bnc-onboard, safe-apps-provider) that compile with the standard don't allow batching.

I think the best way to go with is a solution as wallet-agnostic as possible. I believe that SC wallets will eventually overtake EOAs and that there will be some standards for batching transactions in the future, and our solution can serve as a base.

My proposed solution is to support Argent's wc_multicall RPC method in the safe-apps-provider package and WalletConnect Safe App. It has the same method signature for Gnosis' multisend, so it's trivial to implement. And by doing that, the two most popular smart contract wallets will share the same method for batching transactions.

cc @rmeissner @sche

@sche
Copy link

sche commented Nov 19, 2021

Thanks @mikheevm
I have added a problem statement here safe-global/safe-pm#1

@mmv08
Copy link
Member

mmv08 commented Nov 22, 2021

My proposed solution is to support Argent's wc_multicall RPC method in the safe-apps-provider package and WalletConnect Safe App. It has the same method signature for Gnosis' multisend, so it's trivial to implement. And by doing that, the two most popular smart contract wallets will share the same method for batching transactions.

cc @rmeissner @sche

It turns out that argent's multicall is not an RPC method, it's a fake ABI that is then mapped to a different method on a smart contract on the app side:

  • ABI
"function wc_multiCall((address to, uint256 value, bytes data)[] _transactions)"

Personally, not a big fan of this approach. I've asked them if they're interested in collaborating in a shared RPC method.

@mmv08
Copy link
Member

mmv08 commented Nov 25, 2021

I shared a proposal doc in this issue for team review

@mmv08
Copy link
Member

mmv08 commented Dec 3, 2021

I would appreciate your feedback on the second round of wallet_batchTransaction RPC proposal, this time it is EOA “compatible”, and the transaction types are exactly the same as in eth_sendTransaction. https://hackmd.io/HFHohGDbRSGgUFI2rk22bA?view

@mmv08
Copy link
Member

mmv08 commented Dec 9, 2021

Update: Argent team said they would be happy to support this too.

@dasanra
Copy link
Collaborator

dasanra commented Sep 22, 2022

@clemoon

@mmv08 mmv08 removed their assignment Aug 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants