@dynamic-labs/zerodev-extension
package to create a ZeroDev kernel client for a wallet.
Here is how you can set up and create a kernel client.
The
@dynamic-labs/zerodev-extension
depends on the Viem Extension, so before going through this setup, make sure to have the Viem Extension set up and working. Viem Extension SetupSetup
Install ZeroDevExtension
Install the @dynamic-labs/zerodev-extension package:Shell
Resolve File Resolution Error (Optional)
When running the ZeroDevExtension in your React Native application, you might encounter an error where Metro cannot resolve thepaymasterClient.js
file. This issue occurs because Metro tries to load paymasterClient.js
, but the actual file is named paymasterClient.ts
.
To fix this, you need to customize Metro’s resolver in your metro.config.js
file to handle TypeScript file extensions properly.
Generate metro.config.js for Expo Projects
If you don’t have ametro.config.js
file in your project, you can generate one using the following command:
Customize Metro Resolver
Add the following code to yourmetro.config.js
file to instruct Metro to resolve .ts
files when it cannot find the corresponding .js
files:
.ts
files when it fails to find .js
files, which fixes the resolution error for the paymasterClient
file.
Events Polyfill
ZeroDevExtension requires a polyfill for the Node.js events module. You can install the events polyfill using one of the following commands:Shell
Integrate with your Dynamic client
To include the ZeroDev module in your Dynamic client, you need to extend the client with the ZeroDev extension:Usage
Now that you have the ZeroDev module in your Dynamic client, you can get the ZeroDev kernel client by using thedynamicClient.zeroDev.createKernelClient
method. Here is an example: