Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/tempo-multisig-accounts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"viem": minor
---

**Tempo:** Added experimental native multisig account support. Use `Account.fromMultisig` (and the re-exported `MultisigConfig` from `ox/tempo`) to derive a multisig sender, prepare a transaction with `multisig: config`, collect owner approvals via `signTransaction`, and broadcast with the collected `signatures`.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"ethers": "^6.15.0",
"knip": "^5.64.0",
"micro-eth-signer": "^0.14.0",
"ox": "0.14.27",
"ox": "0.14.29",
"permissionless": "^0.2.57",
"prool": "~0.2.3",
"publint": "^0.2.12",
Expand Down
38 changes: 19 additions & 19 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

102 changes: 102 additions & 0 deletions site/pages/tempo/accounts/account.fromMultisig.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# `Account.fromMultisig`

Instantiates an Account from a [native multisig](https://docs.tempo.xyz/protocol/transactions)
(`MultisigConfig`) configuration.

:::warning
**Experimental.** Native multisig support is experimental and may change in a future release.
It is not yet available on Tempo mainnet or testnet.
:::

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 [`sendTransaction`](/docs/actions/wallet/sendTransaction) flow,
passing the prepared request (carrying the collected owner `signatures`) through to the
chain serializer, which combines the approvals into the multisig signature envelope.

:::tip
For the full transaction flow (preparing a request, collecting owner approvals, and
broadcasting), see the [Multisig Transactions](/tempo/guides/multisig-transactions) guide.
:::

## Usage

```ts twoslash
import { Account, MultisigConfig } from 'viem/tempo'

const owner_1 = Account.fromSecp256k1(
'0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80'
)
const owner_2 = Account.fromSecp256k1(
'0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d'
)

// Define the multisig configuration (2-of-2).
const config = MultisigConfig.from({
threshold: 2,
owners: [
{ owner: owner_1.address, weight: 1 },
{ owner: owner_2.address, weight: 1 },
],
})

// Instantiate the multisig account.
const account = Account.fromMultisig(config)

console.log('Address:', account.address)
```

## Return Type

The return type is backwards compatible with Viem's `Account` type, with the multisig
`config` attached.

```ts
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'
}
```

:::warning
`Account.fromMultisig` is for **broadcasting / sender identity** only. Calling `sign`,
`signMessage`, or `signTypedData` on the returned account throws – owner approvals are
produced separately by signing a prepared request with an owner account (see
[Multisig Transactions](/tempo/guides/multisig-transactions)).
:::

## 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.threshold

- **Type:** `number`

The total owner weight required to authorize a transaction.

#### config.owners

- **Type:** `readonly { owner: Address; weight: number }[]`

The list of owners and their voting weights.

#### config.salt (optional)

- **Type:** `Hex`

Optional salt used to derive a distinct multisig address for the same owner set.
3 changes: 2 additions & 1 deletion site/pages/tempo/accounts/index.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Accounts

Tempo.ts provides Viem-compatible [Local Accounts](https://viem.sh/docs/accounts/local) that support multiple signature schemes including **secp256k1**, **P256**, and **WebAuthn (passkeys)**.
Tempo.ts provides Viem-compatible [Local Accounts](https://viem.sh/docs/accounts/local) that support multiple signature schemes including **secp256k1**, **P256**, and **WebAuthn (passkeys)**, as well as **native multisig** accounts.

These accounts are fully backwards compatible with Viem APIs, meaning you can use them any Viem Action that accepts an `account`.

Expand Down Expand Up @@ -38,3 +38,4 @@ const hash = await client.sendTransactionSync({
| [`fromWebAuthnP256`](/tempo/accounts/account.fromWebAuthnP256) | Create an account from a WebAuthn credential (passkeys) |
| [`fromWebCryptoP256`](/tempo/accounts/account.fromWebCryptoP256) | Create an account from a WebCrypto P256 key pair |
| [`fromP256`](/tempo/accounts/account.fromP256) | Create an account from a P256 private key |
| [`fromMultisig`](/tempo/accounts/account.fromMultisig) | Create an account from a native multisig configuration |
Loading
Loading