Skip to content

Sequence diagram for DappClient.isSponsored flow using relayer.feeOptions #642

@Dargon789

Description

@Dargon789

Reviewer's Guide

Propagates explicit sponsorship and error signals from relayer fee endpoints through the relayer interface, wallet WDK, and dapp client, and adds a high-level isSponsored API, while bumping turbo and publishing patch/minor releases of affected packages.

Sequence diagram for DappClient.isSponsored flow using relayer.feeOptions

sequenceDiagram
  participant DappClient
  participant ChainSessionManager
  participant Relayer

  DappClient->>DappClient: getOrInitializeChainManager(chainId)
  DappClient->>ChainSessionManager: isSponsored(transactions)

  ChainSessionManager->>ChainSessionManager: _buildAndSignCalls(callsToSend)
  ChainSessionManager->>ChainSessionManager: _fingerprintCalls(callsToSend)

  ChainSessionManager->>Relayer: feeOptions(walletAddress, chainId, signedCall.to, callsToSend, signedCall.data)
  Relayer-->>ChainSessionManager: { options, quote, sponsored, failed }

  alt [feeOptions.sponsored === true && !feeOptions.failed]
    ChainSessionManager-->>DappClient: true
  else [otherwise or on error]
    ChainSessionManager-->>DappClient: false
  end
Loading

File-Level Changes

Change Details Files
Extend relayer interfaces and implementations to surface sponsorship and error state from feeOptions/feeTokens and add tests for the new behavior.
  • Relayer interface feeTokens return type now includes an optional failed flag to indicate swallowed server/transport errors.
  • Relayer interface feeOptions return type now includes sponsored and optional failed flags, and all concrete relayers (RpcRelayer, SequenceRelayer, LocalRelayer, EIP6963Relayer, PkRelayer) are updated to match.
  • RpcRelayer.feeOptions now forwards sponsored from the server response and returns sponsored:false, failed:true on errors instead of silently returning an empty options array.
  • RpcRelayer.feeTokens now returns failed:true on errors and logs a warning.
  • LocalRelayer.feeOptions now returns an explicit sponsored:false instead of omitting the field.
  • SequenceRelayer.feeOptions now forwards sponsored from the underlying service.feeOptions call.
  • EIP6963Relayer and PkRelayer are updated to pass through the widened feeTokens and feeOptions results.
  • Relayer tests are extended to assert sponsored propagation and failed semantics for feeOptions and 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
Expose sponsorship/error metadata on StandardRelayerOption and wire it through transaction construction with additional tests.
  • StandardRelayerOption type now includes optional sponsored and failed fields to carry relayer-level sponsorship and error state down to the wallet layer.
  • Transactions sequence implementation now sets sponsored and failed on the synthetic empty StandardRelayerOption and on each mapped option from feeOptions.
  • Transactions tests assert that for LocalRelayer/PkRelayer sponsored is explicitly false and failed is undefined, ensuring deterministic semantics for relayers that never sponsor.
packages/wallet/wdk/src/sequence/types/transaction-request.ts
packages/wallet/wdk/src/sequence/types/index.ts
packages/wallet/wdk/src/sequence/transactions.ts
packages/wallet/wdk/test/transactions.test.ts
Add high-level isSponsored helpers on ChainSessionManager and DappClient that rely on the explicit sponsored signal instead of inferring from empty fee options.
  • ChainSessionManager gains an isSponsored(calls) method that builds/signs calls, caches the signed payload fingerprint, invokes relayer.feeOptions, and returns true only when feeOptions.sponsored is true and not failed.
  • ChainSessionManager.isSponsored wraps its logic in a try/catch, logs a warning on failure, and returns false on any error or missing wallet address.
  • DappClient adds an isSponsored(chainId, transactions) method that delegates to ChainSessionManager.isSponsored, with documentation recommending it over inferring sponsorship from getFeeOptions results.
packages/wallet/dapp-client/src/ChainSessionManager.ts
packages/wallet/dapp-client/src/DappClient.ts
Document the sponsorship/error-signal behavior and new APIs in package changelogs and bump package versions accordingly.
  • @0xsequence/relayer changelog documents the new sponsored and failed fields on feeOptions/feeTokens and their semantics, version bumped to 3.1.0.
  • @0xsequence/wallet-wdk changelog documents propagation of sponsored/failed through StandardRelayerOption and re-export of runtime type guards, version bumped to 3.1.0.
  • @0xsequence/dapp-client changelog documents the new isSponsored APIs and guidance on using them, version bumped to 3.1.0.
  • Multiple service and wallet packages (api, builder, guard, identity-instrument, indexer, marketplace, metadata, userdata, abi, wallet-core, wallet-primitives) have patch-level version bumps referencing the relayer sponsored-fees fix.
packages/services/relayer/CHANGELOG.md
packages/wallet/wdk/CHANGELOG.md
packages/wallet/dapp-client/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
packages/wallet/core/CHANGELOG.md
packages/wallet/primitives/CHANGELOG.md
Update build tooling and package versions to align with the new release.
  • Root devDependency on turbo is bumped from 2.9.8 to 2.9.14.
  • Package.json versions for relayer, wallet-core, dapp-client, wallet-wdk, wallet-primitives, services, and utils are updated to the new patch/minor versions.
  • Lockfile is updated to reflect the new turbo and internal package versions.
package.json
packages/services/api/package.json
packages/services/builder/package.json
packages/services/guard/package.json
packages/services/identity-instrument/package.json
packages/services/indexer/package.json
packages/services/marketplace/package.json
packages/services/metadata/package.json
packages/services/relayer/package.json
packages/services/userdata/package.json
packages/utils/abi/package.json
packages/wallet/core/package.json
packages/wallet/dapp-client/package.json
packages/wallet/primitives/package.json
packages/wallet/wdk/package.json
pnpm-lock.yaml

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 #641 (comment)

Metadata

Metadata

Assignees

Labels

dependenciesPull requests that update a dependency filedocumentationImprovements or additions to documentation

Projects

Status
Done
Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions