Custom Key Providers
If you are using a third-party service to manage private keys, you can integrate it with ZeroDev as long as it provides a signer or an RPC provider interface (or you could implement the interface yourself).
Signer
Ethers
import { getZeroDevSigner } from '@zerodevapp/sdk'
const signer = await getZeroDevSigner({
projectId: "<project id>",
owner: <your signer>,
})
Example using a private key signer:
Full Code (Editable)
Result
Loading...
RPC Provider
Ethers
import { getZeroDevSigner, getRPCProviderOwner } from '@zerodevapp/sdk'
const signer = await getZeroDevSigner({
projectId: "<project id>",
owner: getRPCProviderOwner(rpcProvider),
})
Example using MetaMask as an owner (only works if you have MetaMask installed):
Full Code (Editable)
Result
Loading...
Wagmi
import { ZeroDevConnector } from '@zerodevapp/wagmi'
import { getPrivateKeyOwner } from '@zerodevapp/sdk'
const connector = new ZeroDevConnector({chains, options: {
projectId: <your-project-id>,
owner: getRPCProviderOwner(<provider>),
}})
Example:
Full Code (Editable)
Result
Loading...
You can also "wrap" an existing Wagmi connect with enhanceConnectorWithAA
, which will create an AA wallet and use the connector as a signer/owner for the AA wallet.
import { enhanceConnectorWithAA } from '@zerodevapp/wagmi'
import { MetaMaskConnector } from 'wagmi/connectors/metaMask'
const client = createClient({
connectors: [
enhanceConnectorWithAA(
new MetaMaskConnector({ chains }),
{ projectId: "<your-project-id>" }
),
],
})
Full Code (Editable)
Result
Loading...