Skip to content

AccountConfig.fromUpgrade

Derives the configuration an existing account installs when it migrates in place with the upgradeAccount precompile call (TIP-1113).

The account keeps its address. Its salt is keccak256("tempo:configurable-account:upgrade" || account) and its version is 1n. Owners are sorted into canonical order and the config is validated. The account itself may be listed as an owner.

Imports

Named
import { AccountConfig } from 'ox/tempo'

Examples

import { AccountConfig } from 'ox/tempo'
 
const config = AccountConfig.fromUpgrade(
  '0x3333333333333333333333333333333333333333',
  {
    owners: [
      {
        owner: '0x1111111111111111111111111111111111111111',
        weight: 1
      }
    ],
    threshold: 1
  }
)
// config.version === 1n

Definition

function fromUpgrade<numberType>(
  account: Address.Address,
  options: fromUpgrade.Options<numberType>,
): Config<1n, numberType>

Source: src/tempo/AccountConfig.ts

Parameters

account

  • Type: Address.Address

The account migrating in place.

options

  • Type: fromUpgrade.Options<numberType>

The owners and threshold to install.

options.owners

  • Type: readonly Owner[]

Weighted owners to install. Sorted into canonical order.

options.threshold

  • Type: numberType

Minimum total owner weight required for authorization.

Return Type

The installed account config.

Config<1n, numberType>