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]
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 : permissionsFlow 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]File-Level Changes
packages/wallet/dapp-client/src/utils/index.tspackages/wallet/dapp-client/src/index.tspackages/wallet/wdk/CHANGELOG.mdpackages/wallet/dapp-client/CHANGELOG.mdpackages/wallet/core/CHANGELOG.mdpackages/services/relayer/CHANGELOG.mdpackages/services/api/CHANGELOG.mdpackages/services/builder/CHANGELOG.mdpackages/services/guard/CHANGELOG.mdpackages/services/identity-instrument/CHANGELOG.mdpackages/services/indexer/CHANGELOG.mdpackages/services/marketplace/CHANGELOG.mdpackages/services/metadata/CHANGELOG.mdpackages/services/userdata/CHANGELOG.mdpackages/utils/abi/CHANGELOG.mdpackages/wallet/primitives/CHANGELOG.mdpackages/services/api/package.jsonpackages/services/builder/package.jsonpackages/services/guard/package.jsonpackages/services/identity-instrument/package.jsonpackages/services/indexer/package.jsonpackages/services/marketplace/package.jsonpackages/services/metadata/package.jsonpackages/services/relayer/package.jsonpackages/services/userdata/package.jsonpackages/utils/abi/package.jsonpackages/wallet/core/package.jsonpackages/wallet/dapp-client/package.jsonpackages/wallet/primitives/package.jsonpackages/wallet/wdk/package.json.changeset/tiny-files-chew.mdTips and commands
Interacting with Sourcery
@sourcery-ai reviewon the pull request.issue from a review comment by replying to it. You can also reply to a
review comment with
@sourcery-ai issueto create an issue from it.@sourcery-aianywhere in the pullrequest title to generate a title at any time. You can also comment
@sourcery-ai titleon the pull request to (re-)generate the title at any time.@sourcery-ai summaryanywhere inthe pull request body to generate a PR summary at any time exactly where you
want it. You can also comment
@sourcery-ai summaryon the pull request to(re-)generate the summary at any time.
@sourcery-ai guideon the pullrequest to (re-)generate the reviewer's guide at any time.
@sourcery-ai resolveon thepull request to resolve all Sourcery comments. Useful if you've already
addressed all the comments and don't want to see them anymore.
@sourcery-ai dismisson the pullrequest 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 reviewto trigger a new review!Customizing Your Experience
Access your dashboard to:
summary, the reviewer's guide, and others.
Getting Help
Originally posted by @sourcery-ai[bot] in #220 (comment)