Skip to content

Commit f070f0e

Browse files
cpb8010Copilot
andauthored
Apply suggestions from code review
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 1e1b129 commit f070f0e

File tree

4 files changed

+23
-4
lines changed
  • packages
    • auth-server
    • sdk-4337/src/client/actions
    • sdk-platforms/rust/zksync-sso-erc4337/crates/zksync-sso-erc4337-ffi-web/src/account/modular_smart_account/session

4 files changed

+23
-4
lines changed

packages/auth-server/components/session/row/Row.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
v-if="sessionState"
2121
:status="sessionState.status"
2222
:is-expired="isExpired"
23+
<!-- TODO: created-at is hardcoded to 0 because the current session data
24+
does not include a creation timestamp. Update this when a real
25+
created-at value is available or when SessionRowExpiry is changed
26+
to not rely on created-at for active sessions. -->
2327
:created-at="0"
2428
:expires-at="expiresAt"
2529
:now="now"

packages/auth-server/pages/dashboard/sessions.vue

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<span
2828
v-if="!sessions?.length && !sessionsInProgress && !sessionsFetchError"
2929
data-testid="empty-sessions-message"
30-
class="font-thin block text 2xl text-neutral-500 text-center"
30+
class="font-thin block text-2xl text-neutral-500 text-center"
3131
>No active sessions...</span>
3232
<div
3333
v-else
@@ -104,7 +104,19 @@ const convertSessionSpec = (wasmSpec: WasmSessionSpec): SessionSpec => {
104104
if (limit.limitType === "Unlimited") limitType = LimitType.Unlimited;
105105
else if (limit.limitType === "Lifetime") limitType = LimitType.Lifetime;
106106
else if (limit.limitType === "Allowance") limitType = LimitType.Allowance;
107-
else limitType = Number(limit.limitType) as LimitType;
107+
else {
108+
const numericLimitType = Number(limit.limitType);
109+
if (Number.isNaN(numericLimitType)) {
110+
console.warn(
111+
"Unexpected limitType value received from WASM:",
112+
limit.limitType,
113+
);
114+
// Fallback to a safe default to avoid propagating an invalid enum value
115+
limitType = LimitType.Unlimited;
116+
} else {
117+
limitType = numericLimitType as LimitType;
118+
}
119+
}
108120
109121
return {
110122
limitType,
@@ -157,7 +169,7 @@ const {
157169
rpcUrl,
158170
contracts: {
159171
sessionValidator: contracts.sessionValidator,
160-
entryPoint: contracts.entryPoint || "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108",
172+
entryPoint: (contracts as any).entryPoint || "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108",
161173
accountFactory: contracts.factory,
162174
webauthnValidator: contracts.webauthnValidator,
163175
eoaValidator: contracts.eoaValidator,

packages/sdk-4337/src/client/actions/sessions.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,9 @@ export type ListActiveSessionsReturnType = {
542542
* rpcUrl: "https://sepolia.era.zksync.dev",
543543
* contracts: {
544544
* sessionValidator: "0x...",
545+
* webauthnValidator: "0x...",
546+
* eoaValidator: "0x...",
547+
* guardianExecutor: "0x...",
545548
* entryPoint: "0x...",
546549
* accountFactory: "0x...",
547550
* },

packages/sdk-platforms/rust/zksync-sso-erc4337/crates/zksync-sso-erc4337-ffi-web/src/account/modular_smart_account/session/list.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use zksync_sso_erc4337_core::{
1414
/// # Parameters
1515
/// * `rpc_url` - RPC URL for the blockchain network
1616
/// * `account_address` - Address of the smart account
17-
/// * `contracts_json` - JSON string containing contract addresses (sessionValidator, entryPoint, accountFactory)
17+
/// * `contracts_json` - JSON string containing contract addresses (entryPoint, accountFactory, webauthnValidator, eoaValidator, sessionValidator, guardianExecutor)
1818
///
1919
/// # Returns
2020
/// Promise that resolves to a JSON array of active sessions with session_hash and session_spec

0 commit comments

Comments
 (0)