Skip to content

AccountConfig

Configurable account configuration utilities (TIP-1107).

Configurable accounts have weighted owners and an approval threshold that can change without changing the account address. Derives the stable account address from the initial configuration, computes configuration commitments, and computes the owner approval digest that owners sign.

TIP-1107 · TIP-1114

Examples

import { AccountConfig } from 'ox/tempo'
 
const initialConfig = AccountConfig.from({
  threshold: 2,
  owners: [
    { owner: '0x1111111111111111111111111111111111111111', weight: 1 },
    { owner: '0x2222222222222222222222222222222222222222', weight: 1 },
  ],
})
 
const account = AccountConfig.getAddress(initialConfig)

Functions

NameDescription
AccountConfig.assertAsserts that an AccountConfig.Config is valid.
AccountConfig.fromNormalizes an AccountConfig.Config.
AccountConfig.fromRpcConverts a JSON-RPC account configuration to its domain representation.
AccountConfig.fromTupleConverts an RLP AccountConfig.Tuple back to a AccountConfig.Config.
AccountConfig.fromUpgradeDerives the configuration an existing account installs when it migrates in place with the upgradeAccount precompile call (TIP-1113).
AccountConfig.getAddressDerives the stable configurable account address.
AccountConfig.getCommitmentComputes the commitment for an account configuration.
AccountConfig.getSignPayloadComputes the digest a configurable account owner approves (signs).
AccountConfig.toRpcConverts an account configuration to its JSON-RPC representation.
AccountConfig.toTupleConverts a AccountConfig.Config to its RLP tuple form.
AccountConfig.updateDerives the configuration that replaces the current one in an owner update.
AccountConfig.validateValidates an AccountConfig.Config. Returns true if valid, false otherwise.

Errors

NameDescription
AccountConfig.InvalidConfigErrorThrown when an account config is invalid.

Types

NameDescription
AccountConfig.ConfigComplete account configuration witness.
AccountConfig.InputInput accepted when constructing an account configuration.
AccountConfig.OwnerAccount config owner entry.
AccountConfig.RpcJSON-RPC representation of an account configuration.
AccountConfig.TupleRLP tuple representation of a AccountConfig.Config.