Skip to content

Class diagram for new explicit session helper types #221

@Dargon789

Description

@Dargon789

Reviewer's Guide

Adds explicit session configuration helpers and exports in the dapp client to support EOA login flows, exposes additional primitives, and bumps all related package versions/changelogs to 3.0.0-beta.9.

Class diagram for new explicit session helper types

classDiagram
  class SessionDuration {
    +number days
    +number hours
    +number minutes
  }

  class NativeTokenSpending {
    +bigint valueLimit
    +Address.Address[] allowedRecipients
  }

  class ExplicitSessionParams {
    +number chainId
    +SessionDuration expiresIn
    +Permission.Permission[] permissions
    +NativeTokenSpending nativeTokenSpending
  }

  class ExplicitSessionConfig {
    +number chainId
    +bigint valueLimit
    +bigint deadline
    +Permission.Permission[] permissions
  }

  class Permission {
  }

  class Address {
  }

  ExplicitSessionParams --> SessionDuration : has
  ExplicitSessionParams --> NativeTokenSpending : optional
  ExplicitSessionParams --> Permission : uses
  NativeTokenSpending --> Address : allowedRecipients
  ExplicitSessionConfig --> Permission : permissions
Loading

Flow diagram for createExplicitSessionConfig helper

flowchart TD
  A[start createExplicitSessionConfig] --> B[Read params.chainId, params.expiresIn, params.permissions, params.nativeTokenSpending]
  B --> C[Compute nowInSeconds from Date.now]
  C --> D[Normalize expiresIn days, hours, minutes with defaults 0]
  D --> E[Compute sessionLifetimeSeconds = days*86400 + hours*3600 + minutes*60]
  E --> F[Compute deadline = nowInSeconds + BigInt of sessionLifetimeSeconds]
  F --> G{params.permissions length > 0?}
  G -- no --> H[Throw Error: at least one permission required]
  G -- yes --> I[Extract nativeTokenSpending]
  I --> J[Set valueLimit = nativeTokenSpending.valueLimit or 0n]
  J --> K[Copy nativeTokenReceivers from nativeTokenSpending.allowedRecipients or empty array]
  K --> L[Map nativeTokenReceivers to nativeTokenSpendingPermissions with target and empty rules]
  L --> M[Build ExplicitSessionConfig object]
  M --> M1[chainId = params.chainId]
  M1 --> M2[valueLimit = valueLimit]
  M2 --> M3[deadline = deadline]
  M3 --> M4[permissions = params.permissions concatenated with nativeTokenSpendingPermissions]
  M4 --> N[return ExplicitSessionConfig]
  N --> O[end createExplicitSessionConfig]
Loading

File-Level Changes

Change Details Files
Introduce helper types and factory for building ExplicitSessionConfig with optional native token spending constraints.
  • Add SessionDuration, NativeTokenSpending, and ExplicitSessionParams types to describe session lifetimes, permissions, and native token limits.
  • Implement createExplicitSessionConfig to compute a deadline from relative durations, validate presence of permissions, derive value limits and per-recipient spending permissions, and return an ExplicitSessionConfig.
  • Re-export VALUE_FORWARDER_ADDRESS constant from dapp-client utils.
packages/wallet/dapp-client/src/utils/index.ts
Expand dapp-client public API surface for session helpers, network utilities, and primitives needed by new login flows.
  • Export createExplicitSessionConfig, VALUE_FORWARDER_ADDRESS, and session parameter types from the dapp-client entrypoint.
  • Re-export getNetwork, getRelayerUrl, and getRpcUrl from utils through the main dapp-client index.
  • Add Network to the set of primitives re-exported from @0xsequence/wallet-primitives.
packages/wallet/dapp-client/src/index.ts
Version bump and changelog entries for 3.0.0-beta.9 across services, wallet, and utility packages to reflect dapp client EOA login updates.
  • Add 3.0.0-beta.9 sections to multiple package changelogs referencing dapp client EOA login updates and dependency bumps.
  • Increment package.json versions from 3.0.0-beta.8 to 3.0.0-beta.9 for affected packages.
  • Add a changeset file describing patch releases for the touched packages.
packages/wallet/wdk/CHANGELOG.md
packages/wallet/dapp-client/CHANGELOG.md
packages/wallet/core/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
packages/wallet/primitives/CHANGELOG.md
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
.changeset/tiny-files-chew.md

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions