Skip to content

feat(provider): serve wallet_authorizeChallenge and expose provider.mpp#645

Merged
jxom merged 3 commits into
mainfrom
parv/provider-mpp
Jun 12, 2026
Merged

feat(provider): serve wallet_authorizeChallenge and expose provider.mpp#645
jxom merged 3 commits into
mainfrom
parv/provider-mpp

Conversation

@parvahuja

@parvahuja parvahuja commented Jun 11, 2026

Copy link
Copy Markdown
Member

Summary

  • Serve the wallet_authorizeChallenge wallet RPC: apps and agents hand the provider a serialized MPP Challenge and get back a complete authorization credential, paid through the connected account's access keys (the same internal mppx method clients the fetch integration uses). Challenges targeting chains outside the provider's configured set are rejected instead of settling on the default chain.
  • Advertise mpp: { status: 'supported' } per chain in wallet_getCapabilities (iff the handler will serve).
  • Expose provider.mpp = { fetch, methods } instead of discarding the Mppx.create handler — the payment-aware scoped fetch and pre-wired method clients for runtimes where the global fetch polyfill is unavailable (e.g. Cloudflare Workers) or for handing to an MCP client wrapper.
  • Re-entrancy guard: the provider's internal mppx clients answer nested wallet_authorizeChallenge with 4200, so the wallet's own payment machinery never re-enters the handler (it signs locally, as today). This also stops mutating the shared cached client with an attached account.
  • Docs: RPC page, capability, and the mpp provider handle.

Client-side counterpart (probes the capability and calls the RPC for JSON-RPC accounts): wevm/mppx#540. Independently shippable — until the client side lands, the RPC is simply unused; the wire protocol degrades gracefully in both directions.

Validation

  • tsc -b, lint/format; 490 unit tests including the re-entrancy termination regression test and the foreign-chain rejection test. Localnet suites (mppx.localnet.test.ts) require a running localnet — exercised in CI.

@vercel

vercel Bot commented Jun 11, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
accounts-site Ready Ready Preview, Comment Jun 12, 2026 12:41am

Request Review

@pkg-pr-new

pkg-pr-new Bot commented Jun 11, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/tempoxyz/accounts@645

commit: 91cec00

@github-actions

github-actions Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor
Worker Preview
Wagmi https://d03a22c8-accounts-wagmi.porto.workers.dev

@github-actions

github-actions Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor
Worker Preview
Playground https://c15dc265-accounts-playground.porto.workers.dev

Comment thread src/core/Provider.ts
feePayer?: string | undefined
}): ViemClient<Transport, typeof tempo>
/** Payment-aware `fetch` and MPP method clients. `undefined` when MPP is disabled. */
mpp: mpp.Mpp | undefined

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to return this now?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, nevermind, I see. Works

@parvahuja parvahuja force-pushed the parv/provider-mpp branch from 26ba2e5 to 91cec00 Compare June 12, 2026 00:10
@parvahuja parvahuja changed the title feat(provider): serve mpp_authorize and expose provider.mpp feat(provider): serve wallet_authorizeChallenge and expose provider.mpp Jun 12, 2026
@parvahuja parvahuja marked this pull request as ready for review June 12, 2026 00:17
@jxom jxom merged commit 426bb87 into main Jun 12, 2026
11 of 12 checks passed
@jxom jxom deleted the parv/provider-mpp branch June 12, 2026 00:36
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.

2 participants