Skip to content

0xsequence#1008#653

Open
Dargon789 wants to merge 20 commits into
Dargon789:Initial-project-structure-wagmifrom
0xsequence:master
Open

0xsequence#1008#653
Dargon789 wants to merge 20 commits into
Dargon789:Initial-project-structure-wagmifrom
0xsequence:master

Conversation

@Dargon789

@Dargon789 Dargon789 commented Jun 5, 2026

Copy link
Copy Markdown
Owner

Summary by Sourcery

Propagate explicit relayer sponsorship and failure signals through wallet, dapp client, and relayer APIs while updating fee option handling, adding active device userdata APIs, pruning unused networks, tightening tests, and refreshing tooling and TypeScript/Next configurations.

New Features:

  • Expose explicit sponsorship checks via DappClient.isSponsored and ChainSessionManager.isSponsored, backed by relayer feeOptions sponsorship metadata.
  • Add active device management APIs in userdata (list, put, delete) and corresponding client types.
  • Introduce Wallet.buildFeeOptionsTransaction to build deploy-aware payloads for relayer fee option simulations.

Bug Fixes:

  • Ensure Relayer.isRelayer safely returns false for non-object inputs instead of throwing.
  • Correct relayer feeOptions and feeTokens handling to propagate sponsorship and failure states instead of silently treating errors as successful empty responses.
  • Fix ERC-4337 and standard relayer option construction to carry sponsored/failed flags consistently, avoiding misclassification of sponsorship.

Enhancements:

  • Remove support for several deprecated networks and testnets from wallet primitives network definitions.
  • Extend relayer RPC and standard implementations to accept pre-built transaction data and EIP-7702 authorization, and to include sponsorship signals across implementations.
  • Improve wallet fee option preparation by stubbing signatures topology-aware and ensuring undeployed wallets simulate via guest-module deploy+execute flows.
  • Export runtime helpers to narrow relayer option types and update tests to validate sponsored/failed semantics for local and PK relayers.
  • Update docs and web TypeScript configs to handle CSS side-effect modules and align repo TypeScript usage with v6 across packages.

Build:

  • Bump pnpm minimum release age policy, upgrade dev tooling versions (TypeScript, Next.js, Prettier, Turbo, Lefthook, Syncpack), and refresh workspace package versions and constraints.

CI:

  • Introduce a Claude Code GitHub Action workflow to respond to repository comments and reviews via Anthropic Claude.

Documentation:

  • Document sponsorship semantics and relayer fee handling changes in multiple package changelogs, including wallet WDK, dapp client, relayer, and core services.

Tests:

  • Add coverage for Wallet.buildFeeOptionsTransaction behavior on deployed vs undeployed wallets.
  • Extend relayer tests to validate RpcRelayer feeOptions payload construction, sponsored flag propagation, and error handling for feeOptions and feeTokens.
  • Adjust existing tests to reflect non-throwing Relayer.isRelayer behavior and new feeOptions return shape.

corbanbrook and others added 20 commits May 4, 2026 14:14
Bumps [next](https://github.com/vercel/next.js) from 15.5.14 to 15.5.15.
- [Release notes](https://github.com/vercel/next.js/releases)
- [Changelog](https://github.com/vercel/next.js/blob/canary/release.js)
- [Commits](vercel/next.js@v15.5.14...v15.5.15)

---
updated-dependencies:
- dependency-name: next
  dependency-version: 15.5.15
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
#1007)

* feat(relayer): propagate sponsored signal and mark swallowed errors

`RpcRelayer.feeOptions` now forwards the server's `sponsored: boolean` to
callers, and both `feeOptions` and `feeTokens` mark their swallowed-error
returns with `failed: true`. The `Relayer` interface and all bundled
implementations (Rpc, Sequence, Local, EIP6963, Pk) are widened to match.

Additive change: existing consumers ignoring the new fields are unaffected.
Downstream sponsorship classifiers should switch from `!feeOption` inference
to `sponsored === true` so a real subsidy is no longer indistinguishable
from a swallowed `/FeeOptions` error.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* feat(wallet-wdk): carry sponsored/failed on StandardRelayerOption

`StandardRelayerOption` gains optional `sponsored` and `failed` fields,
populated on both construction branches in `transactions.ts` from the
relayer SDK's new `feeOptions` return. `isStandardRelayerOption` /
`isERC4337RelayerOption` are re-exported so consumers can narrow before
reading the new fields.

UI consumers that classified sponsorship by "no fee option attached"
should switch to `sponsored === true` to distinguish a real subsidy from
a swallowed `/FeeOptions` error.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* feat(dapp-client): add isSponsored for explicit sponsorship checks

`DappClient.isSponsored(chainId, transactions)` and
`ChainSessionManager.isSponsored(calls)` return true only when the
relayer's `/FeeOptions` endpoint explicitly reports sponsorship; any
error, network failure, or absence of sponsorship returns false. A true
result is always safe to surface as "free gas" in UI.

Prefer this over inferring sponsorship from an empty `getFeeOptions`
array — a swallowed `/FeeOptions` error produces the same empty shape as
a real subsidy. `getFeeOptions` is unchanged.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
Bumps [turbo](https://github.com/vercel/turborepo) from 2.9.8 to 2.9.14.
- [Release notes](https://github.com/vercel/turborepo/releases)
- [Changelog](https://github.com/vercel/turborepo/blob/main/RELEASE.md)
- [Commits](vercel/turborepo@v2.9.8...v2.9.14)

---
updated-dependencies:
- dependency-name: turbo
  dependency-version: 2.9.14
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@bolt-new-by-stackblitz

Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@codesandbox

codesandbox Bot commented Jun 5, 2026

Copy link
Copy Markdown

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

@sourcery-ai

sourcery-ai Bot commented Jun 5, 2026

Copy link
Copy Markdown

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

@snyk-io

snyk-io Bot commented Jun 5, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've found 3 issues, and left some high level feedback:

  • In wallet-fee-options.test.ts, consider deriving FEE_OPTIONS_STUB_SIGNATURE via the same buildFeeOptionsStubSignature logic or a shared helper instead of hardcoding the hex literal, so the test stays aligned if the stub signature encoding ever changes.
  • ChainSessionManager.getFeeOptions and ChainSessionManager.isSponsored duplicate the same call mapping and _buildAndSignCalls logic; extracting a shared helper for building callsToSend and signedCall would reduce drift and make future changes to the signing flow easier to keep consistent.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `wallet-fee-options.test.ts`, consider deriving `FEE_OPTIONS_STUB_SIGNATURE` via the same `buildFeeOptionsStubSignature` logic or a shared helper instead of hardcoding the hex literal, so the test stays aligned if the stub signature encoding ever changes.
- `ChainSessionManager.getFeeOptions` and `ChainSessionManager.isSponsored` duplicate the same call mapping and `_buildAndSignCalls` logic; extracting a shared helper for building `callsToSend` and `signedCall` would reduce drift and make future changes to the signing flow easier to keep consistent.

## Individual Comments

### Comment 1
<location path="packages/services/relayer/src/relayer/standard/eip6963.ts" line_range="40" />
<code_context>
     calls: Payload.Call[],
-  ): Promise<{ options: FeeOption[]; quote?: FeeQuote }> {
+    data?: Hex.Hex,
+  ): Promise<{ options: FeeOption[]; quote?: FeeQuote; sponsored: boolean; failed?: boolean }> {
     // IMPORTANT:
     // The relayer FeeOptions endpoint simulates `eth_call(to, data)`.
</code_context>
<issue_to_address>
**issue (bug_risk):** Forward the new optional `data` argument through the EIP6963 relayer adapter.

`Relayer.feeOptions` now accepts `data?: Hex.Hex`, but `EIP6963Relayer.feeOptions` still calls `this.relayer.feeOptions(wallet, chainId, to, calls)` and drops `data`. This will break callers that rely on a fully-built transaction (e.g. undeployed wallets where `to`/`data` are significant). Please update the adapter signature to include `data?: Hex.Hex` and forward it to the inner relayer to preserve behavior.
</issue_to_address>

### Comment 2
<location path="packages/services/relayer/src/relayer/standard/pk-relayer.ts" line_range="124" />
<code_context>
     calls: Payload.Call[],
-  ): Promise<{ options: FeeOption[]; quote?: FeeQuote }> {
+    data?: Hex.Hex,
+  ): Promise<{ options: FeeOption[]; quote?: FeeQuote; sponsored: boolean; failed?: boolean }> {
     // IMPORTANT:
     // The relayer FeeOptions endpoint simulates `eth_call(to, data)`.
</code_context>
<issue_to_address>
**issue (bug_risk):** Propagate the optional `transactionData`/`data` argument in the PK relayer wrapper.

`PkRelayer.feeOptions` still doesn’t accept or forward the new `data?: Hex.Hex` argument to the inner relayer. If a caller supplies a pre-built transaction payload, this wrapper will ignore it and force the inner relayer to reconstruct `data`, which can change the intended behavior. Please add `data?: Hex.Hex` to the method signature and pass it through to `this.relayer.feeOptions(...)` to match the `Relayer` interface and the other adapters.
</issue_to_address>

### Comment 3
<location path="packages/wallet/dapp-client/src/ChainSessionManager.ts" line_range="890" />
<code_context>
+   * sponsorship all return `false`, so a `true` result is always safe to
+   * surface as "free gas" in UI.
+   */
+  async isSponsored(calls: Transaction[]): Promise<boolean> {
+    const callsToSend = calls.map((tx) => ({
+      to: tx.to,
</code_context>
<issue_to_address>
**issue (complexity):** Consider extracting the common build/sign/cache/relayer-call logic into a shared private helper used by both getFeeOptions and isSponsored.

You can reduce duplication by extracting the shared “build → sign → cache → call relayer” flow into a private helper and reusing it from both `getFeeOptions` and `isSponsored`.

For example:

```ts
private async _fetchFeeOptions(
  calls: Transaction[],
): Promise<Awaited<ReturnType<typeof this.relayer.feeOptions>>> {
  const callsToSend = calls.map((tx) => ({
    to: tx.to,
    value: tx.value,
    data: tx.data,
    gasLimit: tx.gasLimit ?? BigInt(0),
    delegateCall: tx.delegateCall ?? false,
    onlyFallback: tx.onlyFallback ?? false,
    behaviorOnError: tx.behaviorOnError ?? ('revert' as const),
  }))

  const signedCall = await this._buildAndSignCalls(callsToSend)
  const fingerprint = this._fingerprintCalls(callsToSend)
  if (fingerprint) {
    this.lastSignedCallCache = {
      fingerprint,
      signedCall,
      createdAtMs: Date.now(),
    }
  }

  const walletAddress = this.walletAddress
  if (!walletAddress) throw new InitializationError('Wallet is not initialized.')

  return this.relayer.feeOptions(
    walletAddress,
    this.chainId,
    signedCall.to,
    callsToSend,
    signedCall.data,
  )
}
```

Then `getFeeOptions` and `isSponsored` become thin wrappers:

```ts
async getFeeOptions(calls: Transaction[]) {
  try {
    const feeOptions = await this._fetchFeeOptions(calls)
    return feeOptions.options
  } catch (err) {
    throw new FeeOptionError(
      `Failed to get fee options: ${err instanceof Error ? err.message : String(err)}`,
    )
  }
}
```

```ts
async isSponsored(calls: Transaction[]): Promise<boolean> {
  try {
    const feeOptions = await this._fetchFeeOptions(calls)
    return feeOptions.sponsored === true && !feeOptions.failed
  } catch (err) {
    console.warn(
      `isSponsored check failed for chain ${this.chainId}:`,
      err instanceof Error ? err.message : String(err),
    )
    return false
  }
}
```

This keeps all existing behavior (including caching and the extra `signedCall.data` argument) in one place, avoids divergence between `getFeeOptions` and `isSponsored`, and reduces cognitive load.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread packages/services/relayer/src/relayer/standard/eip6963.ts
Comment thread packages/services/relayer/src/relayer/standard/pk-relayer.ts
Comment thread packages/wallet/dapp-client/src/ChainSessionManager.ts
@Dargon789 Dargon789 linked an issue Jun 5, 2026 that may be closed by this pull request

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request upgrades TypeScript to version 6.0.3 and updates various tooling dependencies across the workspace. It introduces explicit sponsorship and error-tracking fields (sponsored and failed) to the relayer and wallet SDKs, alongside a new buildFeeOptionsTransaction helper to handle fee options simulations for both deployed and undeployed wallets. A critical piece of feedback highlights that the removal of multiple supported network configurations (such as Polygon zkEVM, Xai, and Blast) from the primitives package is a breaking change that should either be reverted or accompanied by a major version bump and proper documentation.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread packages/wallet/primitives/src/network.ts
@Dargon789 Dargon789 self-assigned this Jun 5, 2026
@Dargon789 Dargon789 added the bug Something isn't working label Jun 5, 2026
@Dargon789 Dargon789 added documentation Improvements or additions to documentation duplicate This issue or pull request already exists enhancement New feature or request good first issue Good for newcomers dependencies Pull requests that update a dependency file labels Jun 5, 2026
@Dargon789 Dargon789 linked an issue Jun 5, 2026 that may be closed by this pull request
@mergify mergify Bot mentioned this pull request Jun 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working dependencies Pull requests that update a dependency file documentation Improvements or additions to documentation duplicate This issue or pull request already exists enhancement New feature or request good first issue Good for newcomers

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

Sequence diagram for wagmi dApp wallet connection flow Sequence diagram for dapp sponsorship check via relayer feeOptions

5 participants