Skip to content

feat(tempo): infer multisig config from account in prepareTransactionRequest#4713

Merged
jxom merged 2 commits into
mainfrom
jxom/multisig-account-dx
Jun 4, 2026
Merged

feat(tempo): infer multisig config from account in prepareTransactionRequest#4713
jxom merged 2 commits into
mainfrom
jxom/multisig-account-dx

Conversation

@jxom
Copy link
Copy Markdown
Member

@jxom jxom commented Jun 4, 2026

Follow-up DX improvement to the native multisig support added in #4710 (the feature is still unreleased).

What changed

  • Account.fromMultisig accepts a raw config — it normalizes via MultisigConfig.from internally, so callers don't need to call it themselves.
  • Multisig config is inferred from the account — pass the multisig account to prepareTransactionRequest and omit the multisig field. The runtime inference lives in chainConfig.ts (derives the config from account.source === 'multisig', sets from, keeps the multisig account as sender).
  • The prepared request carries the multisig account as sender, so it doesn't need to be re-passed to sendTransaction.
import { Account } from 'viem/tempo'

const account = Account.fromMultisig({
  threshold: 2,
  owners: [
    { owner: owner_1.address, weight: 1 },
    { owner: owner_2.address, weight: 1 },
  ],
})

const request = await client.prepareTransactionRequest({
  account,
  feeToken: '0x20c0000000000000000000000000000000000001',
  to: '0xcafebabecafebabecafebabecafebabecafebabe',
  value: 1n,
})

const signature_1 = await client.signTransaction({ ...request, account: owner_1 })
const signature_2 = await client.signTransaction({ ...request, account: owner_2 })

const hash = await client.sendTransaction({
  ...request,
  signatures: [signature_1, signature_2],
})

Notes

  • No changes to shared core (prepareTransactionRequest.ts is untouched). A tempo-exclusive field (calls/feeToken/multisig) narrows the prepared request's type to tempo.
  • Updated the existing (unreleased) changeset and docs to the simplified API.
  • Added a runtime test (infer multisig from account); full multisig e2e suite passes (5/5) against a multisig-enabled localnet.

…Request

Multisig transactions no longer need a `multisig` field — pass the
`Account.fromMultisig` account to `prepareTransactionRequest` and the
config is inferred from it. `fromMultisig` also accepts a raw config
(normalized internally), and the prepared request carries the multisig
account as sender so it doesn't need re-passing to `sendTransaction`.

Amp-Thread-ID: https://ampcode.com/threads/T-019e8cab-fd02-709f-9185-a2766192718b
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jun 4, 2026

⚠️ No Changeset found

Latest commit: f444620

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes changesets to release 1 package
Name Type
viem Minor

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 4, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
viem Ready Ready Preview, Comment Jun 4, 2026 11:41am

Request Review

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Jun 4, 2026

Open in StackBlitz

npm i https://pkg.pr.new/viem@4713

commit: f444620

@jxom jxom disabled auto-merge June 4, 2026 11:42
@jxom jxom enabled auto-merge (squash) June 4, 2026 11:42
@jxom jxom disabled auto-merge June 4, 2026 11:42
@jxom jxom merged commit f5ae20d into main Jun 4, 2026
30 of 32 checks passed
@jxom jxom deleted the jxom/multisig-account-dx branch June 4, 2026 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant