Skip to content

ServerActions.prepareUpgradeAccount

Viem Action for preparing an EOA to be upgraded to a Porto Account. Uses wallet_prepareUpgradeAccount under the hood.

Usage

example.ts
import { ServerActions, Key } from 'porto/viem'
import { client } from './config'
 
const adminKey = Key.createSecp256k1({ role: 'admin' })
 
const prepared = await ServerActions.prepareUpgradeAccount(client, { 
  address: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', 
  authorizeKeys: [adminKey], 
}) 

Parameters

address

  • Type: Address.Address

Address of the EOA account to upgrade.

authorizeKeys

  • Type: readonly Key.Key[]

Keys to authorize on the upgraded account.

delegation

  • Type: Address.Address

Contract address to delegate to. Defaults to the account proxy contract.

feeToken

  • Type: Address.Address

Token to use for transaction fees.

permissionsFeeLimit

  • Type: bigint

Fee limit for session key permissions.

Return Value

See wallet_prepareUpgradeAccount.