Skip to content

Sequence diagram for dapp sponsorship check via relayer feeOptions #654

@Dargon789

Description

@Dargon789

Reviewer's Guide

Introduces explicit sponsorship and failure signalling throughout the relayer fee-options pipeline, adds a dedicated sponsorship check API for dapps, updates wallet fee-option transaction building (including undeployed wallets), extends userdata with active device management, removes several unsupported networks, tightens relayer tests, and bumps various package/tooling versions.

Sequence diagram for dapp sponsorship check via relayer feeOptions

sequenceDiagram
  actor User
  participant DappClient
  participant ChainSessionManager
  participant Wallet
  participant Relayer
  participant RpcRelayer
  participant RelayerClient

  User->>DappClient: isSponsored(chainId, transactions)
  DappClient->>ChainSessionManager: isSponsored(calls)
  ChainSessionManager->>ChainSessionManager: _buildAndSignCalls(callsToSend)
  ChainSessionManager->>Wallet: buildFeeOptionsTransaction(provider, payload)
  Wallet-->>ChainSessionManager: { to, data }
  ChainSessionManager->>Relayer: feeOptions(walletAddress, chainId, to, callsToSend, data)
  Relayer->>RpcRelayer: feeOptions(wallet, chainId, to, calls, data)
  RpcRelayer->>RelayerClient: feeOptions({ wallet, to, data })
  RelayerClient-->>RpcRelayer: FeeOptionsReturn(sponsored, options, quote)
  RpcRelayer-->>Relayer: { options, quote, sponsored, failed? }
  Relayer-->>ChainSessionManager: { options, quote, sponsored, failed? }
  ChainSessionManager-->>DappClient: sponsored === true && !failed
  DappClient-->>User: boolean isSponsored
Loading

File-Level Changes

Change Details Files
Propagate explicit sponsorship and failure flags through relayer fee options/tokens and update all relayer implementations and consumers accordingly.
  • Extend Relayer interface feeTokens/feeOptions to return sponsored and failed markers alongside existing fields.
  • Update RpcRelayer, SequenceRelayer, LocalRelayer, PkRelayer, and EIP6963Relayer to implement the new contract, including error handling paths for feeTokens/feeOptions.
  • Adjust RpcRelayer.feeOptions to accept prebuilt transaction data, forward sponsored flag from server, and return failed:true on error.
  • Update relayer tests to assert new behavior for non-object inputs, sponsored propagation, and error handling in feeOptions/feeTokens.
packages/services/relayer/src/relayer/relayer.ts
packages/services/relayer/src/relayer/rpc-relayer/index.ts
packages/services/relayer/src/relayer/standard/sequence.ts
packages/services/relayer/src/relayer/standard/local.ts
packages/services/relayer/src/relayer/standard/eip6963.ts
packages/services/relayer/src/relayer/standard/pk-relayer.ts
packages/services/relayer/test/relayer/relayer.test.ts
packages/services/relayer/src/relayer/rpc-relayer/relayer.gen.ts
Add wallet-side fee-options transaction construction with stub signatures, including support for undeployed wallets, and wire it into WDK transaction relayer option discovery.
  • Introduce FeeOptionsStubSignature and utilities to stub topology signatures and build a serialized signature with unrecovered signer leaves.
  • Add Wallet.buildFeeOptionsTransaction to build the correct execute call data and route through guest module plus deploy call for undeployed wallets.
  • Change Transactions.update to operate on calls payloads only, using buildFeeOptionsTransaction output when calling relayer.feeOptions and passing along sponsored/failed flags onto StandardRelayerOption.
  • Add dedicated tests to verify Wallet.buildFeeOptionsTransaction behavior for deployed vs undeployed wallets and that StandardRelayerOption sponsored/failed defaults for local/PK relayers are correct.
packages/wallet/core/src/wallet.ts
packages/wallet/wdk/src/sequence/transactions.ts
packages/wallet/wdk/src/sequence/types/transaction-request.ts
packages/wallet/wdk/src/sequence/types/index.ts
packages/wallet/wdk/test/transactions.test.ts
packages/wallet/core/test/wallet-fee-options.test.ts
Expose high-level sponsorship checking APIs in the dapp client and chain session manager, relying on the new sponsored/failed semantics, and ensure feeOptions requests use prebuilt transaction data.
  • Update ChainSessionManager.getFeeOptions to pass signedCall.data through to relayer.feeOptions.
  • Add ChainSessionManager.isSponsored to build/sign calls, cache fingerprints, call relayer.feeOptions with transaction data, and interpret sponsored:true && !failed as positive sponsorship.
  • Add DappClient.isSponsored to delegate to ChainSessionManager.isSponsored, with clear docs warning against inferring sponsorship from empty fee options.
  • Extend dapp-client tests/CHANGLEOG to cover the new API and behavior.
packages/wallet/dapp-client/src/ChainSessionManager.ts
packages/wallet/dapp-client/src/DappClient.ts
packages/wallet/dapp-client/CHANGELOG.md
Extend userdata service client with active device management and update generated schema metadata.
  • Regenerate userdata.gen.ts to include ActiveDevice and ActiveDeviceProps models and related request/response types.
  • Add listActiveDevices, putActiveDevice, and deleteActiveDevice methods to the UserData client interface and implementation.
  • Update Webrpc schema hash and header comment to reflect the new RIDL schema version.
packages/services/userdata/src/userdata.gen.ts
Remove support for several deprecated or unused networks from wallet primitives and associated network list, and update network-related changelog entries.
  • Delete chain IDs and Network entries for Polygon zkEVM, Xai (mainnet & Sepolia), Blast (mainnet & Sepolia), TOY testnet, Monad testnet, Incentiv (mainnet & testnets), Sandbox testnet, and Etherlink testnet.
  • Ensure ALL network array aligns with the reduced ChainId set, keeping remaining networks intact.
  • Document the network updates in relevant changelogs as part of broader relayer/network maintenance.
packages/wallet/primitives/src/network.ts
packages/wallet/primitives/CHANGELOG.md
packages/wallet/wdk/CHANGELOG.md
packages/wallet/core/CHANGELOG.md
packages/wallet/dapp-client/CHANGELOG.md
packages/services/relayer/CHANGELOG.md
packages/services/api/CHANGELOG.md
packages/services/builder/CHANGELOG.md
packages/services/guard/CHANGELOG.md
packages/services/identity-instrument/CHANGELOG.md
packages/services/indexer/CHANGELOG.md
packages/services/marketplace/CHANGELOG.md
packages/services/metadata/CHANGELOG.md
packages/services/userdata/CHANGELOG.md
packages/utils/abi/CHANGELOG.md
Align tooling, TypeScript, Next.js, and workspace configuration for the monorepo.
  • Bump various devDependencies (lefthook, prettier, syncpack, turbo, typescript) and update pnpm and pnpm-workspace minimumReleaseAge and overrides.
  • Update multiple package.json files across services, wallet packages, extras, and repo tooling to use TypeScript 6.0.3 and bump versions reflecting relayer/sponsorship changes.
  • Adjust Next.js tsconfig includes to account for CSS side-effect typings, and add a shared next-css-side-effect.d.ts module declaration.
  • Tighten primitives-cli tsconfig to include Node types and bump its typescript devDependency, and add a CLAUDE GitHub workflow for bot assistance.
package.json
pnpm-workspace.yaml
extras/docs/tsconfig.json
extras/web/tsconfig.json
packages/wallet/primitives-cli/tsconfig.json
packages/wallet/primitives-cli/package.json
extras/docs/package.json
extras/web/package.json
packages/services/*/package.json
packages/utils/abi/package.json
packages/wallet/*/package.json
repo/eslint-config/package.json
repo/ui/package.json
.github/workflows/claude.yml
repo/typescript-config/next-css-side-effect.d.ts

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Originally posted by @sourcery-ai[bot] in #653 (comment)

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingdependenciesPull requests that update a dependency filedocumentationImprovements or additions to documentationduplicateThis issue or pull request already existsenhancementNew feature or requestgood first issueGood for newcomers

Projects

Status
Backlog
Status
Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions