Skip to content

accountId

Gets the accountId of the smart account as defined in ERC-7579. Check out this guide for a complete tutorial.

Usage

example.ts
import { erc7579Actions } from "permissionless/actions/erc7579"
import { owner } from "../owner"
import { toSafeSmartAccount } from "permissionless/accounts"
 
const safeAccount = await toSafeSmartAccount({
	client: publicClient,
	owners: [owner],
	entryPoint: {
		address: entryPoint07Address,
		version: "0.7",
	}, // global entrypoint
	version: "1.4.1",
})
 
// Extend the client with the ERC7579 actions
const smartAccountClient = createSmartAccountClient({
	account: safeAccount,
	chain: sepolia,
	bundlerTransport: http(pimlicoUrl),
	paymaster: pimlicoClient,
	userOperation: {
		estimateFeesPerGas: async () => {
			return (await pimlicoClient.getUserOperationGasPrice()).fast
		},
	},
}).extend(erc7579Actions())
 
const accountId = await smartAccountClient.accountId()
 

Returns

  • Type: string

The account id of the smart account.

Parameters

account (optional)

  • Type: SmartAccount

If your SmartAccountClient doesn't have an account, you should provide one here.