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
(opens in a new tab))
Example
const user = await sdk.viem.toLocalAccount();
toSmartAccount()
Parameters
CurrentUserToLightSmartAccountParams
owner
:LocalAccount
(opens in a new tab)client
:Client
(opens in a new tab)
Returns
Promise<LightSmartAccount>
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,
});