Account.fromMultisig
Instantiates an Account from a native multisig
(MultisigConfig) configuration.
The returned account represents the multisig sender: its address is derived from the
config. It does not hold a key and cannot sign primitives directly (sign, signMessage,
signTypedData throw). Instead, it is used purely to broadcast a multisig transaction:
it drives the standard send flow,
passing the prepared request (carrying the collected owner signatures) through to the
chain serializer, which combines the approvals into the multisig signature envelope.
Usage
import { } from 'viem/tempo'
const = .(
'0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80'
)
const = .(
'0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d'
)
// Instantiate the multisig account (2-of-2) from its owners and threshold.
const = .({
: 2,
: [
{ : ., : 1 },
{ : ., : 1 },
],
})
.('Address:', .)Account.fromMultisig accepts a raw config and normalizes it internally (via
MultisigConfig.from), so you don't need to call MultisigConfig.from yourself. You can
still pass a pre-built MultisigConfig.Config if you have one.
Return Value
The return type is backwards compatible with Viem's Account type, with the multisig
config attached.
type ReturnType = MultisigAccount
type MultisigAccount = Account & {
/** Account address, derived from the multisig config. */
address: Address
/** Multisig config (normalized via `MultisigConfig.from`). */
config: MultisigConfig.Config
/** Account source. */
source: 'multisig'
/** Account type. */
type: 'local'
}Parameters
config
- Type:
MultisigConfig.Config
The multisig configuration, created with MultisigConfig.from. The config is normalized
(owners sorted into canonical ascending order) before the address is derived.
config.owners
- Type:
readonly { owner: Address; weight: number }[]
The list of owners and their voting weights.
config.salt
- Type:
Hex
Optional salt used to derive a distinct multisig address for the same owner set.
config.threshold
- Type:
number
The total owner weight required to authorize a transaction.