Recommended: JavaScript SDK for React Native
While this SDK is still supported, we recommend using newer JavaScript SDK, which is optimized for React Native, but also comes with a host of other benefits.
@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:- expo
- npm
- yarn
- bun
- pnpm
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:
Shell
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:
metro.config.js
.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:- expo
- npm
- yarn
- bun
- pnpm
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:dynamicClient.ts
The
fast-text-encoding import is only required when using Expo SDK 53 and below. Expo SDK 54 and above have built-in text encoding support.Usage
Now that you have the ZeroDev module in your Dynamic client, you can get the ZeroDev kernel client by using theclient.zeroDev.createKernelClient method. Here is an example:
dynamicClient.ts

You can also use the
ZerodevBundlerProvider.Alchemy or ZerodevBundlerProvider.Gelato provider to use the Alchemy or Gelato bundler services.You can either use PaymasterTypeEnum.SPONSOR to sponsor all transactions or PaymasterTypeEnum.NONE to send a non-sponsored transaction.Examples
Sponsored Transactions
Sponsored transactions allow users to interact with your dApp without paying gas fees. The gas costs are covered by your application through a paymaster service.Simple Sponsored Transaction with sendTransaction
The kernel client exposes a viem-style sendTransaction method that accepts a calls array. Because paymaster: PaymasterTypeEnum.SPONSOR was set when creating the client, every call sent through it is sponsored — you do not pass any per-transaction sponsorship flag.
Basic Sponsored Transaction
Here’s how to send a sponsored transaction:Sponsored Transaction with Custom Configuration
You can customize the paymaster and bundler settings for different use cases:Troubleshooting: AA20 account not deployed
If a sponsored user operation fails with an error like:
Conditionally Sponsored Transactions
If your app decides at runtime whether to sponsor a transaction — for example, your backend evaluates each transaction and returns a sponsorship decision — pass that decision as thepaymaster value when creating the kernel client. PaymasterTypeEnum.SPONSOR sends the transaction through your paymaster; PaymasterTypeEnum.NONE creates a kernel client without a paymaster, so the user pays the gas.
With
PaymasterTypeEnum.NONE, gas is paid in the network’s native token from
the smart wallet’s balance. For kernel smart accounts this is the smart
wallet’s contract address (a different address from the signing wallet); for
EIP-7702 wallets the smart wallet is the user’s own wallet address. Either
way, that address must hold enough native token to cover the transaction.