Skip to content

AccountConfig.update

Derives the configuration that replaces the current one in an owner update.

Mirrors the updateConfig precompile (TIP-1109): keeps the current salt, increments the version by one, and replaces the owners and threshold. Owners are sorted into canonical order and the next configuration is validated. The account address does not change.

Imports

Named
import { AccountConfig } from 'ox/tempo'

Examples

import { AccountConfig } from 'ox/tempo'
 
const initialConfig = AccountConfig.from({
  owners: [
    { owner: '0x1111111111111111111111111111111111111111', weight: 1 },
  ],
  threshold: 1,
})
 
const config = AccountConfig.update(initialConfig, {
  owners: [
    { owner: '0x2222222222222222222222222222222222222222', weight: 1 },
  ],
  threshold: 1,
})
// config.version === 1n, with the initial salt

Definition

function update<numberType>(
  config: Input<bigint | number, numberType>,
  options: update.Options<numberType>,
): Config<bigint, numberType>

Source: src/tempo/AccountConfig.ts

Parameters

config

  • Type: Input<bigint | number, numberType>

The current account config.

config.owners

  • Type: readonly Owner[]

Weighted owner list (strictly ascending by owner address).

config.salt

  • Type: 0x${string}
  • Optional

Caller-chosen 32-byte salt mixed into the derived account address. Defaults to the zero salt (AccountConfig.zeroSalt) when omitted.

config.threshold

  • Type: numberType

Minimum total owner weight required to authorize a transaction.

config.version

  • Type: versionType
  • Optional

Configuration version as a safe integer or bigint. Defaults to 0n.

options

  • Type: update.Options<numberType>

The replacement owners and threshold.

options.owners

  • Type: readonly Owner[]

Replacement weighted owners. Sorted into canonical order.

options.threshold

  • Type: numberType

Replacement minimum total owner weight required for authorization.

Return Type

The next account config.

Config<bigint, numberType>