RelayActions.createAccount
Viem Action for instantiating a new Porto Account. Uses wallet_prepareUpgradeAccount
and wallet_upgradeAccount
under the hood.
Usage
example.ts
import { RelayActions, Key } from 'porto/viem'
import { client } from './config'
const account = await RelayActions.createAccount(client, {
authorizeKeys: [Key.createSecp256k1()],
})
Parameters
authorizeKeys
- Type:
readonly Key.Key[]
Keys to authorize on the account.
delegation
- Type:
Address.Address
Delegation address for the account.
feeToken
- Type:
Address.Address
Fee token address to cover gas fees.
Return Value
type CreateAccountReturnType = {
/** Account address */
address: `0x${string}`
/** Authorized keys on the account */
keys: Key.Key[]
/** Account type */
type: 'porto'
}
Returns a new Porto Account with the specified authorized keys.