Skip to content

Server Actions

Porto provides a set of Server Actions for Wallet & Account Developers. These Actions are designed to be used with a Viem Client that is connected to the Porto RPC Server.

import { createClient, http } from 'viem' 
import { Chains } from 'porto' 
import { Key, ServerActions } from 'porto/viem'
 
// Instantiate a Viem Client with Porto-compatible Chain. 
const client = createClient({ 
  chain: Chains.baseSepolia, 
  transport: http(), 
}) 
 
const account = await ServerActions.createAccount(client, { 
  authorizeKeys: [Key.createSecp256k1()], 
}) 

ActionDescription
createAccountCreate a new Porto Account.
getCallsStatusRetrieve the status of a call bundle.
getCapabilitiesRetrieve the capabilities of the RPC server.
getKeysRetrieve all keys associated with an account.
healthRetrieve the health of the server.
prepareCallsPrepare a bundle of calls for execution.
prepareUpgradeAccountPrepare an EOA to be upgraded to a Porto Account.
sendPreparedCallsSend a prepared and signed call bundle.
upgradeAccountUpgrade an EOA to a Porto Account.
verifySignatureVerify a signature.