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...'import { Account, createClient } from 'viem/tempo'
export const client = createClient({
account: Account.fromSecp256k1('0x...'),
})Return Value
Address
The configurable account address.
Parameters
owners
- Type:
readonly { owner: Address; weight: number }[]
The initial owners. Owners are normalized into canonical address order.
await client.accounts.deriveAccount({
owners: [{ owner: '0x...', weight: 1 }],
threshold: 1,
})salt
- Type:
Hex - Default:
0x0000000000000000000000000000000000000000000000000000000000000000
The 32-byte config salt.
await client.accounts.deriveAccount({
owners: [{ owner: '0x...', weight: 1 }],
salt: '0x0000000000000000000000000000000000000000000000000000000000000001',
threshold: 1,
})threshold
- Type:
number
The approval weight required to authorize the account.
await client.accounts.deriveAccount({
owners: [{ owner: '0x...', weight: 1 }],
threshold: 1,
})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.