How can I use @web3auth/coinbase-adapter with Viem’s Coinbase Smart Wallet (Coinbase Smart Wallet · Viem)? In their example, the owner is configured using a private key:
Currently, in my app, I use the Coinbase adapter as an EIP-1193 private wallet configured through the Web3Auth provider, which works fine. However, it lacks the features of an ERC-4337 smart wallet. I’d prefer to use Viem’s smart account functions instead.
Thanks for reaching out. You’re trying to integrate the @web3auth/coinbase-adapter with Viem’s Coinbase Smart Wallet for ERC-4337, and you’re looking to utilize Viem’s smart account functions instead of the EIP-1193 private wallet setup. Let’s try to get you on the right path!
Steps to Approach:
Understand Viem’s Configuration:
Viem’s example configures the owner using a private key.
You’ll aim to use Web3Auth with this setup to replace the manual private key provision.
Integration Strategy:
Determine if Web3Auth can provide the required abstraction layer to act like the private key owner Viem expects. This might require mapping the Web3Auth provider’s functionality to work with toCoinbaseSmartAccount.
Check Web3Auth Support and Available Features:
Verify if @web3auth/coinbase-adapter supports functionality beyond EIP-1193, like what is needed for Viem’s smart account.
Proposed Steps:
Bridge Web3Auth with Viem’s Configuration:
Try exploring ways to extract the necessary account info from Web3Auth that Viem can utilize as the owner.
Investigate if Web3Auth can simulate or provide an interface that mimics passing a private key as required by the Viem configuration.
Next Steps:
Ensure your Web3Auth and Coinbase adapter setup can be integrated or adapted to fulfill the requirements of Viem’s setup. This might involve checking if Web3Auth can use some middleware or custom method to match these prerequisites.
If you have any additional code snippets or setup details you can share, feel free! This will help refine and tackle any remaining integration challenges.
Is this information helpful for what you need to achieve? Let me know how I can assist further!
Note: This response was generated by an AI bot and may require further verification. The Web3Auth support team has tracked this issue and will be responding as soon as possible.
Hey, I checked the documentation, and you can’t use the Viem’s Coinbase Smart Wallet with Web3Auth, when you use Web3Auth account/ External Wallets the provider is JSON-RPC provider, and Viem only accepts the LocalAccount or WebAuthnAccount. Hence the example shows private key and passkey.
I specifically want to use the Coinbase Smart Wallet as a connection option for our application, allowing users to interact with the app via their Smart Wallet rather than as an EIP-1193 wallet. Using the Coinbase Smart Wallet as an EIP-1193 wallet eliminates the ability to sponsor transactions. Additionally, handling the Coinbase Wallet separately undermines the purpose of integrating Web3Auth into our architecture and significantly complicates the codebase. For context, we already use Safe + Pimlico for users connecting through the Google verifier on Web3Auth.
Using the EIP-1193 provider with Pimlico AA works, so I suppose that should also be doable with Coinbase Smart Wallet. For example this is my Pimlico config using Web3Auth provider:
Got it, one way around is to use the JSON-RPC methods supported by the Smart Wallet directly. For instance, you can use the EIP1193Provider you get from Web3Auth, and request the specific methods.