> ## Documentation Index
> Fetch the complete documentation index at: https://www.dynamic.xyz/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Gas sponsorship & smart wallets

> The React SDK exposed smart accounts through useSmartWallets and configured gas sponsorship behind the widget. In the JavaScript SDK smart wallets come from the ZeroDev extension and gas sponsorship is a set of EVM functions you call.

The React SDK grouped account abstraction under a single `useSmartWallets()` hook, created the smart account for you, and only ever *displayed* the smart wallet (and its underlying signer) inside the widget — there were no dedicated smart-wallet screens. The JavaScript SDK makes account abstraction explicit: you enable it with the ZeroDev extension, build user operations yourself, and sponsor gas with EVM functions.

## Enabling smart wallets

`useSmartWallets()` becomes the ZeroDev extension. Register it once when you configure the client (alongside your chain extensions); it adds the smart-wallet provider so accounts and user operations are available. See [Adding the ZeroDev extension](/docs/javascript/reference/zerodev/adding-zerodev-extension) for the full setup, and [ZeroDev → native gas sponsorship](/docs/overview/migrations/zerodev-to-native-gas-sponsorship) if you're moving off a previous ZeroDev integration.

```typescript theme={"system"}
import { addZerodevExtension } from '@dynamic-labs-sdk/zerodev';

// client: your created DynamicClient — register alongside your other extensions
addZerodevExtension(client);
```

In React, register the extension before rendering `DynamicProvider` — the call is the same.

## Smart account and its signer

| React SDK (`useSmartWallets()`) | JavaScript SDK                                                              |
| ------------------------------- | --------------------------------------------------------------------------- |
| the smart account client        | `createKernelClientForWalletAccount()` (`@dynamic-labs-sdk/zerodev`)        |
| `getEOAWallet()` (owner signer) | `getOwnerWalletAccountForSmartWalletAccount()` (`@dynamic-labs-sdk/client`) |

`getOwnerWalletAccountForSmartWalletAccount({ smartWalletAccount })` returns the `WalletAccount` that signs for a smart wallet — use it to show the smart wallet address alongside its owner, the one display the widget used to render.

```typescript theme={"system"}
import { getOwnerWalletAccountForSmartWalletAccount } from '@dynamic-labs-sdk/client';
import { createKernelClientForWalletAccount } from '@dynamic-labs-sdk/zerodev';

// smartWalletAccount: a WalletAccount from getWalletAccounts()
const owner = getOwnerWalletAccountForSmartWalletAccount({
  smartWalletAccount,
});

const kernelClient = await createKernelClientForWalletAccount({
  walletAccount: smartWalletAccount,
});
```

In React, read the wallet list with `useGetWalletAccounts()` and pass the smart wallet into these same functions.

## Sponsoring gas

Sponsorship is explicit and lives in the chain packages. On EVM you check whether it's enabled and send a sponsored transaction; with ZeroDev smart wallets you send a user operation and let the paymaster cover gas.

| Path                   | JavaScript SDK                                                                                                               |
| ---------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| EVM sponsored transfer | `isEvmGasSponsorshipEnabled()`, `sendSponsoredTransaction()`, `getEVMSponsoredTransactionStatus()` (`@dynamic-labs-sdk/evm`) |
| EIP-7702 delegation    | `sign7702Authorization()`, `activate7702Delegation()`, `is7702DelegationActive()` (`@dynamic-labs-sdk/evm`)                  |
| ZeroDev user operation | `canSponsorUserOperation()`, `sendUserOperation()`, `simulateZerodevUserOperation()` (`@dynamic-labs-sdk/zerodev`)           |

```typescript theme={"system"}
import {
  isEvmGasSponsorshipEnabled,
  sendSponsoredTransaction,
} from '@dynamic-labs-sdk/evm';

// walletAccount: the WalletAccount to send from
if (await isEvmGasSponsorshipEnabled({ walletAccount })) {
  const { transactionHash } = await sendSponsoredTransaction({
    walletAccount,
    transaction,
  });
}
```

There's no dedicated React hook — gas sponsorship is configured via extensions, so call these functions directly from your transaction handler.

Before sending, `canSponsorUserOperation()` (ZeroDev) and `isEvmGasSponsorshipEnabled()` (EVM) let you decide whether to offer a gasless path or fall back to the user paying — and `estimateUserOperationGas()` / `calculateFeeForUserOperation()` give you the numbers to show.

## What you now build

Smart wallets and sponsorship are configured through extensions and dashboard settings — there is no smart-wallet UI to migrate. What you build is:

* **The smart-wallet display** — showing the smart account address and its owner signer.
* **Sponsored vs. self-paid choice** — using the `canSponsor` / `isEnabled` checks to decide what to offer.
* **Transaction confirmation** — sponsored and user-operation transactions confirm through the same confirmation UI you build for any transaction: [**Transaction confirmation & simulation** (Building UI)](/docs/javascript/building-ui/transaction-confirmation).

## Errors you now own

| Error / situation                      | What to do                                                                                        |
| -------------------------------------- | ------------------------------------------------------------------------------------------------- |
| `EvmGasSponsorshipNotEnabledError`     | Sponsorship isn't configured for this project/chain — fall back to the user paying gas.           |
| `SponsorTransactionError`              | The sponsored send failed — surface the reason and offer a self-paid retry.                       |
| `isGasSponsorshipError(error)` is true | A ZeroDev user operation couldn't be sponsored — check `canSponsorUserOperation()` and fall back. |

## Reference

Each function above has a dedicated reference page:

* **ZeroDev smart wallets** — [Adding the extension](/docs/javascript/reference/zerodev/adding-zerodev-extension) · [Create kernel client](/docs/javascript/reference/zerodev/create-kernel-client-for-wallet-account) · [Get smart-wallet signer](/docs/javascript/reference/zerodev/get-signer-for-smart-wallet-account)
* **Sponsoring user operations** — [Can sponsor](/docs/javascript/reference/zerodev/can-sponsor-user-operation) · [Send user operation](/docs/javascript/reference/zerodev/send-user-operation) · [Simulate](/docs/javascript/reference/zerodev/simulate-zerodev-user-operation) · [Estimate gas](/docs/javascript/reference/zerodev/estimate-user-operation-gas) · [Calculate fee](/docs/javascript/reference/zerodev/calculate-fee-for-user-operation) · [Gas-sponsorship quickstart](/docs/javascript/reference/zerodev/gas-sponsorship-quickstart)
* **EVM gas sponsorship** — [Overview](/docs/javascript/reference/evm/evm-gas-sponsorship) · [Send sponsored transaction](/docs/javascript/reference/evm/send-sponsored-transaction) · [Managing EIP-7702 delegation](/docs/javascript/reference/evm/managing-7702-delegation)

## See also

* [Transaction confirmation & simulation (Building UI)](/docs/javascript/building-ui/transaction-confirmation) — confirm sponsored and user-operation transactions
* [Integrating chains](/docs/javascript/migrating-from-react/integrating-chains) — register the extensions that enable smart wallets
* [Transactions & balance](/docs/javascript/migrating-from-react/transactions-and-balance) — send and read transactions
