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

Execute send transaction from Viem client #222

Merged
merged 3 commits into from
Jan 2, 2025

Conversation

carlosfebres
Copy link
Contributor

Summary

To enable execution from more complex wallet clients (e.g. smart wallet account clients), the send transaction Viem function is usually overwritten to handle sending these transactions. Viem currently doesn't support the execution of smart accounts in their default send transaction function.

Viem uses a getAction util function to execute a given function on the client or default to Viem's default function, which I believe should be used within the SDK.

@chybisov
Copy link
Member

chybisov commented Dec 9, 2024

@carlosfebres hey, thank you for the PR. Could you please describe your use case more and which smart wallets you use?

PR makes sense, we need to see if there are any more places we need to use getAction 👀

@carlosfebres
Copy link
Contributor Author

carlosfebres commented Jan 2, 2025

Hey @chybisov! We are using a Kernel wallet to hold the funds, and we want it to use LiFi without using an EOA as a middleware. The changes required to make it work are minimal; this will be very useful for anyone trying LiFi with a smart wallet account.

As a rule of thumb, the getAction function should be used when calling a Viem client.

@chybisov
Copy link
Member

chybisov commented Jan 2, 2025

@carlosfebres hey, thank you for getting back and making the PR. I replaced some other wallet actions with getAction util.

@chybisov chybisov merged commit 2580dbe into lifinance:main Jan 2, 2025
@carlosfebres carlosfebres deleted the viem-send-transaction branch January 8, 2025 04:11
@caffeinum
Copy link

this sounds amazing! is there a guide/integration example?

for our smart account wallet, currently we're pretending to be a multisig, and batch transactions manually

I would love to migrate to a cleaner approach.

@chybisov
Copy link
Member

chybisov commented Jan 8, 2025

@caffeinum Hey, can you please share your use case in more detail and what example you are looking for. This PR adds the ability to execute transactions through LI.FI SDK using smart accounts specific sendTransaction method, when it is part of the provided WalletClient, e.g. https://docs.pimlico.io/permissionless/reference/smart-account-actions/sendTransaction

Some docs: https://docs.li.fi/integrate-li.fi-sdk/configure-sdk-providers

@caffeinum
Copy link

caffeinum commented Jan 8, 2025

@chybisov sure! We're already using LiFi SDK in our smart wallet app, however currently I have a clunky wrapper-adapter that pretends to be a multisig, to support batching. If smart wallet usecase is the one already supported by SDK, I would love to re-integrate properly.

We're using ZeroDev kernel account:

"@zerodev/ecdsa-validator": "^5.4.1",
"@zerodev/sdk": "^5.4.9",

We also have a group chat in telegram with Li.Fi team – is it best to ask there?

@chybisov
Copy link
Member

chybisov commented Jan 8, 2025

@caffeinum we can move this discussion to tg, I have the same handle there and you can add me to the group if I'm not yet there 🙂

Looking at their documentation, yes, it should work fine. There is no example for zerodev/sdk as of now, but I'll try to add one in the future.

Also, we are almost ready with native batching using Wallet Call API #224 https://eips.ethereum.org/EIPS/eip-5792
We did this to improve Safe integration, but it would also benefit other smart accounts if they support this standard.

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

Successfully merging this pull request may close these issues.

3 participants