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"
 
const safeAccount = await signerToSafeSmartAccount(publicClient, {
	signer,
	safeVersion: "1.4.1",
	entryPoint: ENTRYPOINT_ADDRESS_V07,
	safe4337ModuleAddress: "0x7579EE8307284F293B1927136486880611F20002",
	erc7579LaunchpadAddress: "0x7579011aB74c46090561ea277Ba79D510c6C00ff",
	attesters: ["0x000000333034E9f539ce08819E12c1b8Cb29084d"], // This address belongs to Rhinestone. By designating them as attesters, you authorize that only modules explicitly approved by Rhinestone can be installed on your safe.
	attestersThreshold: 1,
})
 
// Extend the client with the ERC7579 actions
const smartAccountClient = createSmartAccountClient({
	account: safeAccount,
	entryPoint: ENTRYPOINT_ADDRESS_V07,
	chain: sepolia,
	bundlerTransport: http(bundlerUrl),
	middleware: {
		gasPrice: async () => {
			return (await pimlicoBundlerClient.getUserOperationGasPrice()).fast
		},
		sponsorUserOperation: pimlicoBundlerClient.sponsorUserOperation,
	},
}).extend(erc7579Actions({ entryPoint: ENTRYPOINT_ADDRESS_V07 }))
 
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.