Skip to Content
ViemOverview

Viem

After instantiating the SDK (which is explained here), you’re allowed to use the following methods from viem.

To use the following methods, please make sure the user is authenticated.

Since 1.9.0, viem is a peer dependency — your application installs it, and the SDK uses that same copy. The values returned below are viem’s own types, so they only line up with your createWalletClient, createBundlerClient and friends when there is a single copy of viem in your tree. If TypeScript reports two structurally identical viem types as incompatible, you have a duplicate; check with npm ls viem.

toLocalAccount()

Parameters

void

Returns

Promise<LocalAccount> (see LocalAccount)

Example

const user = await sdk.viem.toLocalAccount()

toSmartAccount()

Parameters

CurrentUserToLightSmartAccountParams object containing:

Returns

Promise<LightSmartAccount> (see LocalAccount)

Example

import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http('YOUR_RPC_URL'), }) const smartAccount = await sdk.viem.toSmartAccount({ owner: localAccount, // from `toLocalAccount()` client, })

getPaymasterClient()

Parameters

void

Returns

Promise<PaymasterClient> (see PaymasterClient)

Example

import { PaymasterClient } from 'viem/account-abstraction' const paymasterClient: PaymasterClient = await sdk.viem.getPaymasterClient()
Last updated on