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.

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()