Skip to content
LogoLogo

accounts.deriveAccount

Derives a configurable account address from an initial config with the configurable account precompile. The precompile validates the config and derives the address with the chain's recovery factory.

To derive the address without a network request, use Account.fromConfig with address: 'infer'.

Usage

import { client } from './viem.config'
 
const address = await client.accounts.deriveAccount({
  owners: [
    { owner: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266', weight: 1 },
    { owner: '0x70997970C51812dc3A010C7d01b50e0d17dc79C8', weight: 1 },
  ],
  threshold: 2,
})
'0x...'

Return Type

type ReturnType = Address

The configurable account address.

Parameters

owners

  • Type: readonly { owner: Address; weight: number }[]

The initial owners. Owners are normalized into canonical address order.

salt

  • Type: Hex
  • Default: 0x0000000000000000000000000000000000000000000000000000000000000000

The 32-byte config salt.

threshold

  • Type: number

The approval weight required to authorize the account.

blockNumber (optional)

  • Type: bigint

Block number to read the state from.

blockOverrides (optional)

  • Type: BlockOverrides

Block overrides to apply to the state.

blockTag (optional)

  • Type: BlockTag

Block tag to read the state from.

stateOverride (optional)

  • Type: StateOverride

State override to apply.