{"version":3,"sources":["../src/permissions.ts","../src/crossChainPermissions.ts","../src/connection.ts","../src/account.ts","../src/walletClient/index.ts","../src/batch/BatchQueueContext.tsx","../src/batch/BatchQueueWidget.tsx"],"sourcesContent":["import type { Abi, Address } from \"viem\";\nimport type { Permission } from \"@rhinestone/sdk\";\n\nexport type DefinePermissionsConfig<TAbi extends Abi> = Permission<TAbi> & {\n  /** Optional human-readable name surfaced in the review UI. */\n  name?: string;\n};\n\nexport interface DefinedPermissions<TAbi extends Abi = Abi> {\n  /**\n   * v2 SmartSession permissions, ready to pass to\n   * `OneAuthClient.grantPermissions({ ...definePermissions(...) })`.\n   *\n   * Always a single-element array so the `...spread` pattern works cleanly\n   * with `grantPermissions`, which accepts `permissions: Permission[]`.\n   *\n   * Widened to `Permission<Abi>` (rather than `Permission<TAbi>`) so the\n   * spread composes with `GrantPermissionsOptions.permissions: Permission<Abi>[]`.\n   * The SDK's v2 `Permission<TAbi>` includes conditional `SpendingLimitField<TFn>` /\n   * `ValueLimitField<TFn>` types that break covariance over `TAbi`, so an inferred\n   * narrow `Permission<erc20Abi>` is no longer assignable to `Permission<Abi>`.\n   * We keep `TAbi` on the type parameter so `contracts[].abi` retains its\n   * narrow shape for the review UI.\n   */\n  permissions: [Permission<Abi>];\n  /**\n   * Contract metadata for the permission review UI. The address and ABI\n   * here mirror the entry in `permissions[0]`; `name` is optional and\n   * purely cosmetic (it's never sent to a contract).\n   */\n  contracts: Array<{\n    address: Address;\n    name?: string;\n    abi: TAbi;\n  }>;\n}\n\n/**\n * Build a v2 SmartSession `Permission` from an ABI + function map.\n *\n * The Rhinestone SDK derives function selectors and universal-action\n * calldata offsets from the ABI internally, so app code no longer needs\n * to spell out raw 4-byte selectors or parameter indices. The accepted\n * shape is the SDK's own `Permission<TAbi>` plus an optional `name` for\n * the review UI.\n *\n * @example\n * const permissions = definePermissions({\n *   address: USDC,\n *   abi: erc20Abi,\n *   name: \"USDC\",\n *   functions: {\n *     transfer: {\n *       params: { to: { condition: \"equal\", value: RECIPIENT } },\n *     },\n *   },\n * });\n *\n * await oneAuth.grantPermissions({ ...permissions, sessionKeyAddress });\n */\nexport function definePermissions<const TAbi extends Abi>(\n  config: DefinePermissionsConfig<TAbi>,\n): DefinedPermissions<TAbi> {\n  const { name, ...permission } = config;\n  return {\n    permissions: [permission as unknown as Permission<Abi>],\n    contracts: [\n      {\n        address: config.address,\n        name,\n        abi: config.abi,\n      },\n    ],\n  };\n}\n","import { isAddress, type Address, type Chain } from \"viem\";\n\nimport { getTokenAddress } from \"./registry\";\n\nexport type CrossChainSettlementLayer = \"SAME_CHAIN\" | \"ECO\" | \"ACROSS\";\n\nexport interface CrossChainPermit {\n  /** Allowed source legs: chain + token, with an optional amount cap. */\n  from: Array<{ chain: Chain; token: Address; maxAmount?: bigint }>;\n  /** Allowed destination legs: chain + token, with an optional recipient pin. */\n  to: Array<{ chain: Chain; token: Address; recipient?: Address | \"any\" }>;\n  /** Upper bound on the Permit2 deadline, expressed as Unix seconds. */\n  validUntil?: bigint;\n  /** Lower bound on the Permit2 deadline, expressed as Unix seconds. */\n  validAfter?: bigint;\n  /** Per-destination fill-deadline windows, expressed as Unix seconds. */\n  fillDeadline?: Array<{ chain: Chain; min?: bigint; max?: bigint }>;\n  /** When true, the destination recipient must be the smart account. */\n  recipientIsAccount?: boolean;\n  /** Allowed settlement layers. Omit or pass an empty array to allow any supported layer. */\n  settlementLayers?: CrossChainSettlementLayer[];\n}\n\ninterface FromLeg {\n  chain: Chain;\n  token: Address | string;\n  maxAmount?: bigint;\n}\n\ninterface ToLeg {\n  chain: Chain;\n  token: Address | string;\n  recipient?: Address | \"any\";\n}\n\nexport interface CreateCrossChainPermissionInput {\n  /** Source chain + token, with an optional amount cap. Pass an array for multi-leg permits. */\n  from: FromLeg | FromLeg[];\n  /** Destination chain + token, with an optional recipient pin. Pass an array for fan-out destinations. */\n  to: ToLeg | ToLeg[];\n  /** Upper bound on the Permit2 deadline. Accepts Unix-seconds bigint or Date. */\n  validUntil?: bigint | Date;\n  /** Lower bound on the Permit2 deadline. Accepts Unix-seconds bigint or Date. */\n  validAfter?: bigint | Date;\n  /** Per-destination fill-deadline windows, expressed as Unix seconds. */\n  fillDeadline?: Array<{ chain: Chain; min?: bigint; max?: bigint }>;\n  /**\n   * Allow the destination recipient to differ from the smart account.\n   * Defaults to false so bridge permissions are bridge-to-self unless the\n   * caller explicitly broadens the grant.\n   */\n  allowRecipientNotAccount?: boolean;\n  /** Settlement layers this session is permitted to use. */\n  settlementLayers?: CrossChainSettlementLayer[];\n}\n\nfunction toUnixSecondsBigint(input: bigint | Date): bigint {\n  if (typeof input === \"bigint\") return input;\n  // Permit2 deadlines are Unix seconds; Date stores milliseconds.\n  return BigInt(Math.floor(input.getTime() / 1000));\n}\n\nfunction resolveTokenForChain(token: Address | string, chainId: number): Address {\n  return isAddress(token, { strict: false }) ? token : getTokenAddress(token, chainId);\n}\n\n/**\n * Build a CrossChainPermit for Permit2-backed bridge settlement.\n *\n * The returned object is JSON-safe after callers stringify bigint fields at\n * the iframe/API boundary and can be passed as\n * `grantPermissions({ crossChainPermits: [...] })`.\n */\nexport function createCrossChainPermission(\n  input: CreateCrossChainPermissionInput,\n): CrossChainPermit {\n  const fromLegs = Array.isArray(input.from) ? input.from : [input.from];\n  const toLegs = Array.isArray(input.to) ? input.to : [input.to];\n\n  if (fromLegs.length === 0) {\n    throw new Error(\"createCrossChainPermission: `from` must contain at least one leg\");\n  }\n  if (toLegs.length === 0) {\n    throw new Error(\"createCrossChainPermission: `to` must contain at least one leg\");\n  }\n\n  const validUntil =\n    input.validUntil !== undefined ? toUnixSecondsBigint(input.validUntil) : undefined;\n  const validAfter =\n    input.validAfter !== undefined ? toUnixSecondsBigint(input.validAfter) : undefined;\n\n  // Catch a broken time window before the user reaches the passkey dialog.\n  if (validUntil !== undefined && validAfter !== undefined && validAfter > validUntil) {\n    throw new Error(\n      `createCrossChainPermission: validAfter (${validAfter}) is greater than validUntil (${validUntil})`,\n    );\n  }\n\n  return {\n    from: fromLegs.map((leg) => ({\n      chain: leg.chain,\n      token: resolveTokenForChain(leg.token, leg.chain.id),\n      maxAmount: leg.maxAmount,\n    })),\n    to: toLegs.map((leg) => ({\n      chain: leg.chain,\n      token: resolveTokenForChain(leg.token, leg.chain.id),\n      recipient: leg.recipient,\n    })),\n    validUntil,\n    validAfter,\n    fillDeadline: input.fillDeadline,\n    recipientIsAccount: !input.allowRecipientNotAccount,\n    settlementLayers: input.settlementLayers,\n  };\n}\n","/**\n * One-call connect entry point for 1auth.\n *\n * `createOneAuthConnection` is the ergonomic front door for integrators who\n * want a single function that:\n *   1. opens the 1auth dialog so the user picks **1auth passkey** *or* a\n *      **traditional wallet** (WalletConnect / injected), and\n *   2. hands back a ready-to-use EIP-1193 provider plus the connected\n *      `{ address, signerType }`.\n *\n * When the user picks a traditional wallet (an EOA), the returned provider\n * forwards `eth_sendTransaction` / `personal_sign` / `signTypedData` /\n * `wallet_sendCalls` straight to that wallet's native RPC — **no Rhinestone\n * intents**. When they pick a passkey, transactions route through 1auth intents\n * exactly as before. The app writes one downstream code path either way.\n *\n * This is purely additive: `OneAuthClient.connect()` and\n * `createOneAuthProvider()` are unchanged and remain the lower-level building\n * blocks this factory composes.\n *\n * @module\n */\n\nimport { OneAuthClient } from \"./client\";\nimport { createOneAuthProvider, type OneAuthProvider } from \"./provider\";\nimport type {\n  CloseOnStatus,\n  PasskeyProviderConfig,\n  SignerType,\n  ThemeConfig,\n} from \"./types\";\n\n/**\n * Default chain the returned provider reports and uses as the intent target\n * when a send omits an explicit chain. Base mainnet.\n */\nconst DEFAULT_CHAIN_ID = 8453;\n\n/**\n * Provider-shaping options that apply on top of the passkey client config.\n * Mirrors the relevant {@link createOneAuthProvider} options.\n */\nexport interface OneAuthConnectionOptions {\n  /**\n   * Chain the returned provider reports via `eth_chainId` and uses as the\n   * default intent target. Defaults to `8453` (Base). Ignored for EOA sessions\n   * beyond the reported chain id — an EOA transacts on whatever chain its\n   * wallet is on.\n   */\n  defaultChainId?: number;\n  /**\n   * localStorage key the session is persisted under. Defaults to `\"1auth-user\"`.\n   * Override only to run multiple independent connections on one origin.\n   */\n  storageKey?: string;\n  /** Forwarded to the provider for passkey intent sends. */\n  closeOn?: CloseOnStatus;\n  waitForHash?: boolean;\n  hashTimeoutMs?: number;\n  hashIntervalMs?: number;\n  /**\n   * Opt in to offering a **traditional wallet as the account signer**. When\n   * `true`, the dialog's wallet path connects the chosen EOA as the signer (a\n   * `signerType: \"eoa\"` session whose transactions bypass Rhinestone intents).\n   *\n   * **Defaults to `false`** — by default the app gets 1auth smart accounts +\n   * intents, and the wallet path (if the user picks it) still bootstraps a\n   * passkey account. Passkey selection is unaffected either way. Can be\n   * overridden per call via {@link OneAuthConnectOptions.eoaConnect}.\n   */\n  eoaConnect?: boolean;\n}\n\n/** Full config form: constructs the client for you. Only `clientId` is practically required. */\nexport type OneAuthConnectionConfig = PasskeyProviderConfig &\n  OneAuthConnectionOptions;\n\n/** Reuse form: bring your own configured {@link OneAuthClient}. */\nexport type OneAuthConnectionConfigWithClient = {\n  client: OneAuthClient;\n} & OneAuthConnectionOptions;\n\n/** Options accepted by {@link OneAuthConnection.connect}. */\nexport interface OneAuthConnectOptions {\n  theme?: ThemeConfig;\n  /** Applies only to the auth-modal fallback path (email/OAuth entry). */\n  oauthEnabled?: boolean;\n  /**\n   * Per-call override of {@link OneAuthConnectionOptions.eoaConnect}. Defaults\n   * to the connection's config value (which itself defaults to `false`).\n   */\n  eoaConnect?: boolean;\n}\n\n/**\n * The resolved session. Discriminated on `signerType` so callers can branch on\n * EOA vs passkey with full type safety.\n */\nexport interface OneAuthSession {\n  /** `\"eoa\"` = traditional wallet (plain tx, no intents). `\"passkey\"` = 1auth smart account (intents). */\n  signerType: SignerType;\n  address: `0x${string}`;\n  /** The same {@link OneAuthProvider} instance exposed on the connection. */\n  provider: OneAuthProvider;\n  /** Chain id the provider reports (see {@link OneAuthConnectionOptions.defaultChainId}). */\n  chainId: number;\n  /** True when a returning user was reconnected with no visible UI. */\n  autoConnected: boolean;\n}\n\n/** Error thrown by {@link OneAuthConnection.connect} when the user cancels or auth fails. */\nexport interface OneAuthConnectError {\n  code: string;\n  message: string;\n}\n\n/** The handle returned by {@link createOneAuthConnection}. */\nexport interface OneAuthConnection {\n  /** The underlying client — escape hatch for `signMessage`, history, the account dialog, etc. */\n  client: OneAuthClient;\n  /** Ready-to-use EIP-1193 provider. Stable across reconnects. */\n  provider: OneAuthProvider;\n  /**\n   * Open the 1auth dialog so the user picks passkey OR a traditional wallet.\n   * Binds the resulting session to {@link OneAuthConnection.provider} before it\n   * resolves, so a send issued immediately after routes correctly.\n   *\n   * @throws {@link OneAuthConnectError} shape (`{ code, message }`) on cancel/failure.\n   */\n  connect: (options?: OneAuthConnectOptions) => Promise<OneAuthSession>;\n  /** Current session read from persisted state, or `null`. Never opens a dialog. */\n  getSession: () => OneAuthSession | null;\n  /** Clear the session and emit `accountsChanged([])` / `disconnect`. */\n  disconnect: () => Promise<void>;\n  /**\n   * Subscribe to session changes (connect/disconnect). Returns an unsubscribe\n   * function. Sugar over `provider.on(\"accountsChanged\", …)`.\n   */\n  subscribe: (listener: (session: OneAuthSession | null) => void) => () => void;\n}\n\n/**\n * Reads the persisted session for this connection's storage key. Kept in this\n * module (rather than reaching into the provider) so `getSession` works without\n * a prior `connect()` — e.g. on a page reload where the app rehydrates.\n */\nfunction readStoredSession(\n  storageKey: string,\n  provider: OneAuthProvider,\n  chainId: number,\n): OneAuthSession | null {\n  if (typeof window === \"undefined\") return null;\n  try {\n    // Bare `localStorage` (not `window.localStorage`) to match provider.ts and\n    // client.ts — in a browser they are identical, and it keeps the storage\n    // access consistent across the SDK.\n    const raw = localStorage.getItem(storageKey);\n    if (!raw) return null;\n    const parsed = JSON.parse(raw) as {\n      address?: `0x${string}`;\n      signerType?: SignerType;\n    };\n    if (!parsed?.address) return null;\n    return {\n      // Absent signerType = legacy passkey session (backwards compatible).\n      signerType: parsed.signerType === \"eoa\" ? \"eoa\" : \"passkey\",\n      address: parsed.address,\n      provider,\n      chainId,\n      autoConnected: false,\n    };\n  } catch {\n    return null;\n  }\n}\n\n/**\n * Create a one-call 1auth connection.\n *\n * @example Zero-boilerplate\n * ```typescript\n * import { createOneAuthConnection } from \"@rhinestone/1auth\";\n * import { createWalletClient, custom } from \"viem\";\n * import { base } from \"viem/chains\";\n *\n * const conn = createOneAuthConnection({ clientId: \"my-app\" });\n * const session = await conn.connect(); // user picks passkey OR wallet\n *\n * const walletClient = createWalletClient({\n *   account: session.address,\n *   chain: base,\n *   transport: custom(session.provider),\n * });\n * // Same call for both signer types; EOA bypasses intents, passkey uses them.\n * await walletClient.sendTransaction({ to: \"0x…\", value: 1n });\n * ```\n *\n * @example Reuse an existing client\n * ```typescript\n * const client = new OneAuthClient({ clientId: \"my-app\", sponsorship });\n * const conn = createOneAuthConnection({ client, defaultChainId: 8453 });\n * const { address, signerType, provider } = await conn.connect();\n * ```\n */\nexport function createOneAuthConnection(\n  config: OneAuthConnectionConfig,\n): OneAuthConnection;\nexport function createOneAuthConnection(\n  config: OneAuthConnectionConfigWithClient,\n): OneAuthConnection;\nexport function createOneAuthConnection(\n  config: OneAuthConnectionConfig | OneAuthConnectionConfigWithClient,\n): OneAuthConnection {\n  const {\n    defaultChainId,\n    storageKey: storageKeyOption,\n    closeOn,\n    waitForHash,\n    hashTimeoutMs,\n    hashIntervalMs,\n    eoaConnect: eoaConnectConfig,\n    ...clientConfig\n  } = config as OneAuthConnectionConfig & OneAuthConnectionConfigWithClient;\n\n  // Reuse a supplied client, or construct one from the passkey config.\n  const client =\n    \"client\" in config && config.client\n      ? config.client\n      : new OneAuthClient(clientConfig as PasskeyProviderConfig);\n\n  const chainId = defaultChainId ?? DEFAULT_CHAIN_ID;\n  const storageKey = storageKeyOption ?? \"1auth-user\";\n\n  const provider = createOneAuthProvider({\n    client,\n    chainId,\n    storageKey,\n    closeOn,\n    waitForHash,\n    hashTimeoutMs,\n    hashIntervalMs,\n  });\n\n  const getSession = (): OneAuthSession | null =>\n    readStoredSession(storageKey, provider, chainId);\n\n  const connect = async (\n    options?: OneAuthConnectOptions,\n  ): Promise<OneAuthSession> => {\n    // Wallet-as-signer is opt-in (default false → smart accounts + intents).\n    // Per-call option wins over the connection's config default.\n    const eoaConnect = options?.eoaConnect ?? eoaConnectConfig ?? false;\n    const result = await client.connect({ ...options, eoaConnect });\n    if (!result.success || !result.user?.address) {\n      const error: OneAuthConnectError = result.error ?? {\n        code: \"USER_CANCELLED\",\n        message: \"Connection was cancelled\",\n      };\n      throw Object.assign(new Error(error.message), { code: error.code });\n    }\n\n    const signerType: SignerType =\n      result.signerType === \"eoa\" ? \"eoa\" : \"passkey\";\n\n    // Bind before returning so a transaction issued in the same tick routes to\n    // the wallet (EOA) rather than falling back to passkey intents.\n    provider.setSession({ address: result.user.address, signerType });\n\n    return {\n      signerType,\n      address: result.user.address,\n      provider,\n      chainId,\n      autoConnected: result.autoConnected ?? false,\n    };\n  };\n\n  const disconnect = async (): Promise<void> => {\n    await provider.disconnect();\n  };\n\n  const subscribe = (\n    listener: (session: OneAuthSession | null) => void,\n  ): (() => void) => {\n    const onAccountsChanged = (...args: unknown[]) => {\n      const accounts = args[0] as unknown[] | undefined;\n      listener(\n        accounts && accounts.length > 0 ? getSession() : null,\n      );\n    };\n    provider.on(\"accountsChanged\", onAccountsChanged);\n    return () => provider.removeListener(\"accountsChanged\", onAccountsChanged);\n  };\n\n  return { client, provider, connect, getSession, disconnect, subscribe };\n}\n","/**\n * viem LocalAccount adapter for 1auth passkey-controlled smart accounts.\n *\n * Bridges viem's `LocalAccount` interface to the 1auth passkey service so that\n * any viem-based library (e.g. permissionless, viem itself) can use a passkey\n * account without handling WebAuthn directly. All cryptographic operations are\n * delegated to the passkey service via `OneAuthClient`.\n *\n * @module\n */\n\nimport {\n  bytesToString,\n  hexToString,\n  isHex,\n  type Address,\n  type LocalAccount,\n  type SignableMessage,\n  type TypedData,\n  type TypedDataDefinition,\n} from \"viem\";\nimport { toAccount } from \"viem/accounts\";\nimport { OneAuthClient } from \"./client\";\nimport type { EIP712Domain, EIP712Types } from \"./types\";\nimport { toOneAuthError } from \"./errors\";\nimport { encodeWebAuthnSignature } from \"./walletClient/utils\";\n\nexport type PasskeyAccount = LocalAccount<\"1auth\"> & {\n  /** Smart account address used as the canonical signer identity. */\n  accountAddress: Address;\n};\n\n/**\n * Creates a viem `LocalAccount` that delegates signing to the 1auth passkey service.\n *\n * The returned account satisfies the `LocalAccount` interface expected by viem's\n * `createWalletClient` and similar APIs. `signTransaction` is explicitly unsupported\n * because 1auth uses the intent/bundler model instead of raw signed transactions —\n * callers should use `sendIntent` (via `eth_sendTransaction` on the provider) instead.\n *\n * All signing operations encode the resulting WebAuthn signature with\n * `encodeWebAuthnSignature` so the output is directly usable with ERC-1271\n * on-chain verification.\n *\n * @param client - A configured `OneAuthClient` instance\n * @param params.address - The EVM address of the user's smart account\n * @returns A `PasskeyAccount` extending `LocalAccount<\"1auth\">`\n *\n * @example\n * ```typescript\n * import { createWalletClient, http } from \"viem\";\n * import { base } from \"viem/chains\";\n * import { OneAuthClient, createPasskeyAccount } from \"@rhinestone/1auth\";\n *\n * const client = new OneAuthClient({ clientId: \"my-app\" });\n * const account = createPasskeyAccount(client, {\n *   address: \"0xYourSmartAccountAddress\",\n * });\n *\n * const walletClient = createWalletClient({\n *   account,\n *   chain: base,\n *   transport: http(),\n * });\n *\n * const signature = await walletClient.signMessage({ message: \"Hello\" });\n * ```\n */\nexport function createPasskeyAccount(\n  client: OneAuthClient,\n  params: { address: Address }\n): PasskeyAccount {\n  const { address } = params;\n\n  /**\n   * Converts viem's polymorphic `SignableMessage` type to a plain string.\n   *\n   * viem allows messages to be passed as a plain string, a hex-encoded string under\n   * the `{ raw: Hex }` form, or raw bytes under the `{ raw: Uint8Array }` form. The\n   * passkey service only accepts plain strings, so this helper normalises all three\n   * variants. Hex values are decoded to their UTF-8 representation; if decoding fails\n   * (e.g. the hex is not valid UTF-8) the raw hex string is passed through unchanged.\n   *\n   * @param message - viem `SignableMessage` in any of its supported forms\n   * @returns Plain string representation of the message\n   */\n  const normalizeMessage = (message: SignableMessage): string => {\n    if (typeof message === \"string\") return message;\n    const raw = message.raw;\n    if (isHex(raw)) {\n      try {\n        return hexToString(raw);\n      } catch {\n        return raw;\n      }\n    }\n    return bytesToString(raw);\n  };\n\n  const account = toAccount({\n    address,\n    signMessage: async ({ message }: { message: SignableMessage }) => {\n      const result = await client.signMessage({\n        accountAddress: address,\n        message: normalizeMessage(message),\n      });\n      if (!result.success) {\n        throw toOneAuthError(result.error, \"Signing failed\", \"SIGNING_FAILED\");\n      }\n      if (!result.signature) {\n        throw toOneAuthError(undefined, \"No signature received\", \"SIGNING_FAILED\");\n      }\n      return encodeWebAuthnSignature(result.signature);\n    },\n    signTransaction: async () => {\n      throw new Error(\"signTransaction not supported; use sendIntent\");\n    },\n    signTypedData: async <\n      const typedData extends TypedData | Record<string, unknown>,\n      primaryType extends keyof typedData | \"EIP712Domain\" = keyof typedData\n    >(\n      typedData: TypedDataDefinition<typedData, primaryType>\n    ) => {\n      if (!typedData.domain || !typedData.types || !typedData.primaryType) {\n        throw new Error(\"Invalid typed data\");\n      }\n      const domainInput = typedData.domain as Partial<EIP712Domain>;\n      if (!domainInput.name || !domainInput.version) {\n        throw new Error(\"Typed data domain must include name and version\");\n      }\n      const domain: EIP712Domain = {\n        name: domainInput.name,\n        version: domainInput.version,\n        // viem uses bigint for chainId in typed data; the passkey service expects number\n        chainId:\n          typeof domainInput.chainId === \"bigint\"\n            ? Number(domainInput.chainId)\n            : domainInput.chainId,\n        verifyingContract: domainInput.verifyingContract,\n        salt: domainInput.salt,\n      };\n      const rawTypes =\n        typedData.types as Record<string, readonly { name: string; type: string }[]>;\n      // Strip any extra fields (e.g. readonly markers) that viem attaches to type\n      // entries — the passkey service expects plain { name, type } objects.\n      const normalizedTypes = Object.fromEntries(\n        Object.entries(rawTypes).map(([key, fields]) => [\n          key,\n          fields.map((field) => ({ name: field.name, type: field.type })),\n        ])\n      ) as EIP712Types;\n      const result = await client.signTypedData({\n        accountAddress: address,\n        domain,\n        types: normalizedTypes,\n        primaryType: typedData.primaryType as string,\n        message: typedData.message as Record<string, unknown>,\n      });\n      if (!result.success) {\n        throw toOneAuthError(result.error, \"Signing failed\", \"SIGNING_FAILED\");\n      }\n      if (!result.signature) {\n        throw toOneAuthError(undefined, \"No signature received\", \"SIGNING_FAILED\");\n      }\n      return encodeWebAuthnSignature(result.signature);\n    },\n  });\n\n  return {\n    ...(account as LocalAccount<\"1auth\">),\n    accountAddress: address,\n  };\n}\n","/**\n * @file viem WalletClient factory backed by passkey signing.\n *\n * {@link createPasskeyWalletClient} returns a standard viem `WalletClient`\n * augmented with a `sendCalls` method for batched ERC-4337 intents. All\n * signing operations open the 1auth passkey modal so that private keys never\n * leave the secure enclave on the user's device.\n *\n * The factory is framework-agnostic — it works in any environment that can\n * run viem (React, Vue, plain Node.js scripts, etc.).\n */\n\nimport {\n  createWalletClient,\n  hashTypedData,\n  toHex,\n  type WalletClient,\n  type Hash,\n  type SignableMessage,\n  type TypedDataDefinition,\n} from 'viem';\nimport { toAccount } from 'viem/accounts';\nimport { OneAuthClient } from '../client';\nimport type { IntentCall, IntentTokenRequest } from '../types';\nimport { toOneAuthError } from '../errors';\nimport type {\n  PasskeyWalletClientConfig,\n  SendCallsParams,\n  TransactionCall,\n} from './types';\nimport {\n  encodeWebAuthnSignature,\n  hashCalls,\n  buildTransactionReview,\n} from './utils';\n\nexport type { PasskeyWalletClientConfig, TransactionCall, SendCallsParams } from './types';\nexport { encodeWebAuthnSignature, hashCalls } from './utils';\n\n/**\n * Extended WalletClient with passkey signing and batch transaction support\n */\nexport type PasskeyWalletClient = WalletClient & {\n  /**\n   * Send multiple calls as a single batched transaction\n   * Opens the passkey modal for user approval\n   */\n  sendCalls: (params: SendCallsParams) => Promise<Hash>;\n};\n\n/**\n * Convert viem's message union into the string-only SDK message surface.\n */\nfunction formatSignableMessage(message: SignableMessage): string {\n  if (typeof message === 'string') return message;\n  return typeof message.raw === 'string' ? message.raw : toHex(message.raw);\n}\n\n/**\n * Create a viem-compatible WalletClient that uses passkeys for signing\n *\n * @example\n * ```typescript\n * import { createPasskeyWalletClient } from '@rhinestone/1auth';\n * import { baseSepolia } from 'viem/chains';\n * import { http } from 'viem';\n *\n * const walletClient = createPasskeyWalletClient({\n *   accountAddress: '0x...',\n *   providerUrl: 'https://passkey.1auth.app',\n *   clientId: 'my-dapp',\n *   chain: baseSepolia,\n *   transport: http(),\n * });\n *\n * // Standard viem API\n * const hash = await walletClient.sendTransaction({\n *   to: '0x...',\n *   data: '0x...',\n *   value: 0n,\n * });\n *\n * // Batched transactions\n * const batchHash = await walletClient.sendCalls({\n *   calls: [\n *     { to: '0x...', data: '0x...' },\n *     { to: '0x...', data: '0x...' },\n *   ],\n * });\n * ```\n */\nexport function createPasskeyWalletClient(\n  config: PasskeyWalletClientConfig\n): PasskeyWalletClient {\n  const identity = {\n    accountAddress: config.accountAddress,\n  };\n\n  const provider = new OneAuthClient({\n    providerUrl: config.providerUrl,\n    clientId: config.clientId,\n    dialogUrl: config.dialogUrl,\n    theme: config.theme,\n    blind_signing: config.blind_signing,\n    testnets: config.testnets,\n    sponsorship: config.sponsorship,\n  });\n\n  /**\n   * Sign an arbitrary message using the passkey modal.\n   *\n   * Hashes the message with EIP-191 (`hashMessage`) before passing it to the\n   * modal as the WebAuthn challenge so the on-chain verifier receives a\n   * deterministic, typed hash rather than raw user data.\n   *\n   * @param message - A plain string or a `{ raw: Hex | Uint8Array }` object\n   *   as accepted by viem's `SignableMessage`.\n   * @returns ABI-encoded WebAuthn signature as a `0x`-prefixed hex string.\n   */\n  const signMessageImpl = async (message: SignableMessage): Promise<`0x${string}`> => {\n    const result = await provider.signMessage({\n      ...identity,\n      message: formatSignableMessage(message),\n      description: 'Sign message',\n    });\n\n    if (!result.success) {\n      throw toOneAuthError(result.error, 'Signing failed', 'SIGNING_FAILED');\n    }\n\n    if (!result.signature) {\n      throw toOneAuthError(undefined, 'No signature received', 'SIGNING_FAILED');\n    }\n\n    return encodeWebAuthnSignature(result.signature);\n  };\n\n  /**\n   * Sign a single transaction object using the passkey modal.\n   *\n   * Normalises the transaction into a `TransactionCall` array, computes a\n   * deterministic hash over the calls with {@link hashCalls}, then presents\n   * the transaction for user approval before encoding the resulting WebAuthn\n   * signature.\n   *\n   * @param transaction - A viem transaction request object containing at least\n   *   `to`, and optionally `data` and `value`.\n   * @returns ABI-encoded WebAuthn signature as a `0x`-prefixed hex string.\n   */\n  const signTransactionImpl = async (transaction: any): Promise<`0x${string}`> => {\n    const calls: TransactionCall[] = [\n      {\n        to: transaction.to!,\n        data: transaction.data,\n        value: transaction.value,\n      },\n    ];\n\n    const hash = hashCalls(calls);\n\n    const result = await provider.signWithModal({\n      challenge: hash,\n      ...identity,\n      description: 'Sign transaction',\n      transaction: buildTransactionReview(calls),\n    });\n\n    if (!result.success) {\n      throw toOneAuthError(result.error, 'Signing failed', 'SIGNING_FAILED');\n    }\n\n    if (!result.signature) {\n      throw toOneAuthError(undefined, 'No signature received', 'SIGNING_FAILED');\n    }\n\n    return encodeWebAuthnSignature(result.signature);\n  };\n\n  /**\n   * Sign EIP-712 typed data using the passkey modal.\n   *\n   * Hashes the structured data with viem's `hashTypedData` (which applies the\n   * EIP-712 domain separator and struct hashing) and presents the primary type\n   * name to the user as a human-readable label inside the signing dialog.\n   *\n   * @param typedData - EIP-712 typed data definition including `domain`,\n   *   `types`, `primaryType`, and `message`.\n   * @returns ABI-encoded WebAuthn signature as a `0x`-prefixed hex string.\n   */\n  const signTypedDataImpl = async (typedData: any): Promise<`0x${string}`> => {\n    const hash = hashTypedData(typedData as TypedDataDefinition);\n\n    const result = await provider.signWithModal({\n      challenge: hash,\n      ...identity,\n      description: 'Sign typed data',\n      transaction: {\n        actions: [\n          {\n            type: 'custom',\n            label: 'Sign Data',\n            sublabel: typedData.primaryType || 'Typed Data',\n          },\n        ],\n      },\n    });\n\n    if (!result.success) {\n      throw toOneAuthError(result.error, 'Signing failed', 'SIGNING_FAILED');\n    }\n\n    if (!result.signature) {\n      throw toOneAuthError(undefined, 'No signature received', 'SIGNING_FAILED');\n    }\n\n    return encodeWebAuthnSignature(result.signature);\n  };\n\n  /**\n   * Build the intent payload shared by `sendTransaction` and `sendCalls`.\n   *\n   * Converts `TransactionCall` objects (viem-style, with bigint values) into\n   * `IntentCall` objects (serialisable, with string values) expected by the\n   * passkey service. The target chain defaults to `config.chain.id` when no\n   * override is provided.\n   *\n   * @param calls - One or more transaction calls to include in the intent.\n   * @param targetChainOverride - Optional chain ID; overrides `config.chain.id`\n   *   when the intent should execute on a chain different from the client's\n   *   default (e.g. cross-chain intent routing).\n   * @param extra - Optional token request and source asset metadata forwarded\n   *   to the Rhinestone orchestrator for cross-chain bridging intents.\n   * @returns A plain object ready to spread into `provider.sendIntent(...)`.\n   */\n  const buildIntentPayload = async (\n    calls: TransactionCall[],\n    targetChainOverride?: number,\n    extra?: { tokenRequests?: IntentTokenRequest[]; sourceAssets?: string[] },\n  ) => {\n    const targetChain = targetChainOverride ?? config.chain.id;\n    const intentCalls: IntentCall[] = calls.map((call) => ({\n      to: call.to,\n      data: call.data || \"0x\",\n      value: call.value !== undefined ? call.value.toString() : \"0\",\n      label: call.label,\n      sublabel: call.sublabel,\n      icon: call.icon,\n      abi: call.abi,\n    }));\n\n    return {\n      accountAddress: config.accountAddress,\n      targetChain,\n      calls: intentCalls,\n    };\n  };\n\n  // toAccount returns a generic LocalAccount<string> but viem's WalletClient\n  // constructor expects LocalAccount<\"custom\"> — the type assertion satisfies\n  // this constraint without changing runtime behaviour.\n  const account = toAccount({\n    address: config.accountAddress,\n    signMessage: ({ message }) => signMessageImpl(message),\n    signTransaction: signTransactionImpl,\n    signTypedData: signTypedDataImpl as any,\n  });\n\n  // Create the base wallet client\n  const client = createWalletClient({\n    account,\n    chain: config.chain,\n    transport: config.transport,\n  });\n\n  // Extend with sendCalls for batched transactions\n  const extendedClient = Object.assign(client, {\n    /**\n     * Send a single transaction via intent flow\n     */\n    async sendTransaction(transaction: any): Promise<Hash> {\n      const targetChain =\n        typeof transaction.chainId === \"number\"\n          ? transaction.chainId\n          : transaction.chain?.id;\n      const calls: TransactionCall[] = [\n        {\n          to: transaction.to!,\n          data: transaction.data || \"0x\",\n          value: transaction.value,\n        },\n      ];\n\n      const intentPayload = await buildIntentPayload(calls, targetChain);\n      const result = await provider.sendIntent({\n        ...intentPayload,\n        waitForHash: config.waitForHash ?? true,\n        hashTimeoutMs: config.hashTimeoutMs,\n        hashIntervalMs: config.hashIntervalMs,\n      });\n\n      if (!result.success) {\n        throw toOneAuthError(result.error, \"Transaction failed\", \"INTENT_FAILED\");\n      }\n      if (!result.transactionHash) {\n        throw toOneAuthError(undefined, \"No transaction hash received\", \"HASH_UNAVAILABLE\");\n      }\n\n      return result.transactionHash as Hash;\n    },\n    /**\n     * Send multiple calls as a single batched transaction\n     */\n    async sendCalls(params: SendCallsParams): Promise<Hash> {\n      const { calls, chainId: targetChain, tokenRequests, sourceAssets, sourceChainId } = params;\n      const intentPayload = await buildIntentPayload(calls, targetChain, { tokenRequests, sourceAssets });\n      const result = await provider.sendIntent({\n        ...intentPayload,\n        tokenRequests,\n        sourceAssets,\n        sourceChainId,\n        waitForHash: config.waitForHash ?? true,\n        hashTimeoutMs: config.hashTimeoutMs,\n        hashIntervalMs: config.hashIntervalMs,\n      });\n\n      if (!result.success) {\n        throw toOneAuthError(result.error, \"Transaction failed\", \"INTENT_FAILED\");\n      }\n      if (!result.transactionHash) {\n        throw toOneAuthError(undefined, \"No transaction hash received\", \"HASH_UNAVAILABLE\");\n      }\n\n      return result.transactionHash as Hash;\n    },\n  });\n\n  return extendedClient as PasskeyWalletClient;\n}\n","import * as React from \"react\";\nimport type { OneAuthClient } from \"../client\";\nimport type { IntentCall, SendIntentResult } from \"../types\";\nimport { getChainName as getRegistryChainName } from \"../registry\";\n\n/** Identity used to sign a queued batch. Account address is the sole identity. */\nexport interface BatchQueueIdentity {\n  /** Smart account address of the signer. */\n  accountAddress: string;\n}\n\n/**\n * A batched call in the queue\n */\nexport interface BatchedCall {\n  /** Unique ID for removal */\n  id: string;\n  /** The actual call data */\n  call: IntentCall;\n  /** Chain ID for execution */\n  targetChain: number;\n  /** Timestamp when added */\n  addedAt: number;\n}\n\nexport function getChainName(chainId: number): string {\n  return getRegistryChainName(chainId);\n}\n\n/**\n * Batch queue context value\n */\nexport interface BatchQueueContextValue {\n  /** Current queue of batched calls */\n  queue: BatchedCall[];\n  /** Chain ID of the current batch (from first call) */\n  batchChainId: number | null;\n  /** Add a call to the batch */\n  addToBatch: (call: IntentCall, targetChain: number) => { success: boolean; error?: string };\n  /** Remove a call from the batch */\n  removeFromBatch: (id: string) => void;\n  /** Clear all calls from the batch */\n  clearBatch: () => void;\n  /** Sign and execute all batched calls. A bare string is treated as the account address. */\n  signAll: (identity?: string | BatchQueueIdentity) => Promise<SendIntentResult>;\n  /** Whether the widget is expanded */\n  isExpanded: boolean;\n  /** Set widget expanded state */\n  setExpanded: (expanded: boolean) => void;\n  /** Whether signing is in progress */\n  isSigning: boolean;\n  /** Animation trigger for bounce effect */\n  animationTrigger: number;\n}\n\nconst BatchQueueContext = React.createContext<BatchQueueContextValue | null>(null);\n\n/**\n * Hook to access the batch queue context\n */\nexport function useBatchQueue(): BatchQueueContextValue {\n  const context = React.useContext(BatchQueueContext);\n  if (!context) {\n    throw new Error(\"useBatchQueue must be used within a BatchQueueProvider\");\n  }\n  return context;\n}\n\n/**\n * Generate a unique ID for a batched call\n */\nfunction generateId(): string {\n  return `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;\n}\n\n/**\n * localStorage key for persisting the batch queue.\n *\n * Queues are keyed by account address — the sole account identity.\n */\nfunction getStorageKey(identity?: { accountAddress?: string }): string {\n  const key = identity?.accountAddress;\n  return key ? `1auth_batch_queue_${key.toLowerCase()}` : \"1auth_batch_queue_anonymous\";\n}\n\n/** Normalize a `signAll(address)` string or identity object against provider props into one shape. */\nfunction resolveIdentity(\n  passedIdentity: string | BatchQueueIdentity | undefined,\n  providerIdentity: { accountAddress?: string },\n): { accountAddress?: string } {\n  if (typeof passedIdentity === \"string\") {\n    // A bare string is the account address — the canonical (and only) identity.\n    return { accountAddress: passedIdentity };\n  }\n  return {\n    accountAddress: passedIdentity?.accountAddress ?? providerIdentity.accountAddress,\n  };\n}\n\nexport interface BatchQueueProviderProps {\n  /** The OneAuthClient instance */\n  client: OneAuthClient;\n  /** Account address for localStorage persistence and account lookup. */\n  accountAddress?: string;\n  /** Children to render */\n  children: React.ReactNode;\n}\n\n/**\n * Provider component for the batch queue\n */\nexport function BatchQueueProvider({\n  client,\n  accountAddress,\n  children,\n}: BatchQueueProviderProps) {\n  const [queue, setQueue] = React.useState<BatchedCall[]>([]);\n  const [isExpanded, setExpanded] = React.useState(false);\n  const [isSigning, setIsSigning] = React.useState(false);\n  const [animationTrigger, setAnimationTrigger] = React.useState(0);\n\n  const providerIdentity = React.useMemo(\n    () => ({ accountAddress }),\n    [accountAddress],\n  );\n\n  // Derive batch chain from first call in queue\n  const batchChainId = queue.length > 0 ? queue[0].targetChain : null;\n\n  // Load queue from localStorage on mount\n  React.useEffect(() => {\n    const storageKey = getStorageKey(providerIdentity);\n    try {\n      const stored = localStorage.getItem(storageKey);\n      if (stored) {\n        const parsed = JSON.parse(stored) as BatchedCall[];\n        // Validate the structure\n        if (Array.isArray(parsed) && parsed.every(item =>\n          typeof item.id === 'string' &&\n          typeof item.call === 'object' &&\n          typeof item.targetChain === 'number'\n        )) {\n          setQueue(parsed);\n        }\n      }\n    } catch {\n      // Ignore localStorage errors\n    }\n  }, [providerIdentity]);\n\n  // Save queue to localStorage when it changes\n  React.useEffect(() => {\n    const storageKey = getStorageKey(providerIdentity);\n    try {\n      if (queue.length > 0) {\n        localStorage.setItem(storageKey, JSON.stringify(queue));\n      } else {\n        localStorage.removeItem(storageKey);\n      }\n    } catch {\n      // Ignore localStorage errors\n    }\n  }, [queue, providerIdentity]);\n\n  const addToBatch = React.useCallback((call: IntentCall, targetChain: number): { success: boolean; error?: string } => {\n    // Check if trying to add to a batch with a different chain\n    if (batchChainId !== null && batchChainId !== targetChain) {\n      return {\n        success: false,\n        error: `Batch is set to ${getChainName(batchChainId)}. Sign current batch first or clear it.`,\n      };\n    }\n\n    const batchedCall: BatchedCall = {\n      id: generateId(),\n      call,\n      targetChain,\n      addedAt: Date.now(),\n    };\n\n    setQueue(prev => [...prev, batchedCall]);\n    setAnimationTrigger(prev => prev + 1);\n\n    return { success: true };\n  }, [batchChainId]);\n\n  const removeFromBatch = React.useCallback((id: string) => {\n    setQueue(prev => prev.filter(item => item.id !== id));\n  }, []);\n\n  const clearBatch = React.useCallback(() => {\n    setQueue([]);\n    setExpanded(false);\n  }, []);\n\n  const signAll = React.useCallback(async (\n    identity?: string | BatchQueueIdentity,\n  ): Promise<SendIntentResult> => {\n    if (queue.length === 0) {\n      return {\n        success: false,\n        intentId: \"\",\n        status: \"failed\",\n        error: {\n          code: \"EMPTY_BATCH\",\n          message: \"No calls in batch to sign\",\n        },\n      };\n    }\n\n    const signer = resolveIdentity(identity, providerIdentity);\n    if (!signer.accountAddress) {\n      return {\n        success: false,\n        intentId: \"\",\n        status: \"failed\",\n        error: {\n          code: \"MISSING_IDENTITY\",\n          message: \"Batch signing requires an accountAddress\",\n        },\n      };\n    }\n\n    const targetChain = queue[0].targetChain;\n    const calls = queue.map(item => item.call);\n\n    setIsSigning(true);\n\n    try {\n      const result = await client.sendIntent({\n        accountAddress: signer.accountAddress,\n        targetChain,\n        calls,\n      });\n\n      if (result.success) {\n        // Clear the batch on success\n        clearBatch();\n      }\n\n      return result;\n    } finally {\n      setIsSigning(false);\n    }\n  }, [queue, client, clearBatch, providerIdentity]);\n\n  const value: BatchQueueContextValue = {\n    queue,\n    batchChainId,\n    addToBatch,\n    removeFromBatch,\n    clearBatch,\n    signAll,\n    isExpanded,\n    setExpanded,\n    isSigning,\n    animationTrigger,\n  };\n\n  return (\n    <BatchQueueContext.Provider value={value}>\n      {children}\n    </BatchQueueContext.Provider>\n  );\n}\n","/**\n * @file Floating UI widget for the 1auth batch transaction queue.\n *\n * Renders a fixed-position card anchored to the bottom-right of the viewport\n * that shows how many calls are queued and on which chain. The widget is\n * invisible while the queue is empty and mounts itself into the React tree\n * wherever `BatchQueueProvider` wraps the application.\n *\n * CSS keyframe animations are injected into `document.head` once on mount\n * via {@link injectStyles} so that no stylesheet import is required from the\n * consumer's bundler.\n */\n\nimport * as React from \"react\";\nimport { useBatchQueue, getChainName } from \"./BatchQueueContext\";\n\n// batch-bounce-in: played on the whole widget when a new call is added to the\n// queue — a subtle scale pop that draws attention without being distracting.\n// batch-item-bounce: reserved for future per-item jiggle feedback (not\n// currently triggered by default, available via inline animation assignment).\nconst ANIMATION_STYLES = `\n@keyframes batch-bounce-in {\n  0% { transform: scale(0.8); opacity: 0; }\n  50% { transform: scale(1.05); }\n  100% { transform: scale(1); opacity: 1; }\n}\n@keyframes batch-item-bounce {\n  0%, 100% { transform: translateX(0); }\n  25% { transform: translateX(-2px); }\n  75% { transform: translateX(2px); }\n}\n`;\n\n/**\n * Inject the widget's CSS keyframe animations into `document.head`.\n *\n * Uses a stable element ID (`\"batch-queue-widget-styles\"`) as a guard so the\n * style tag is only inserted once even if the component mounts multiple times\n * (e.g. during React strict-mode double-invocation or hot reloads). No-ops in\n * non-browser environments (SSR/Node) where `document` is undefined.\n */\nfunction injectStyles() {\n  if (typeof document === \"undefined\") return;\n  const styleId = \"batch-queue-widget-styles\";\n  if (document.getElementById(styleId)) return;\n\n  const style = document.createElement(\"style\");\n  style.id = styleId;\n  style.textContent = ANIMATION_STYLES;\n  document.head.appendChild(style);\n}\n\n// Fixed bottom-right positioning keeps the widget out of the page flow so it\n// never displaces content. z-index 50 sits above typical page elements but\n// below full-screen modals (which usually start at 100+).\nconst widgetStyles: React.CSSProperties = {\n  position: \"fixed\",\n  bottom: \"16px\",\n  right: \"16px\",\n  zIndex: 50,\n  backgroundColor: \"#18181b\",\n  color: \"#ffffff\",\n  borderRadius: \"12px\",\n  boxShadow: \"0 4px 12px rgba(0,0,0,0.3)\",\n  minWidth: \"240px\",\n  maxWidth: \"360px\",\n  fontFamily: \"system-ui, -apple-system, sans-serif\",\n  fontSize: \"14px\",\n  overflow: \"hidden\",\n};\n\nconst headerStyles: React.CSSProperties = {\n  display: \"flex\",\n  alignItems: \"center\",\n  justifyContent: \"space-between\",\n  padding: \"12px 16px\",\n  cursor: \"pointer\",\n  userSelect: \"none\",\n};\n\nconst headerLeftStyles: React.CSSProperties = {\n  display: \"flex\",\n  alignItems: \"center\",\n  gap: \"8px\",\n};\n\nconst counterBadgeStyles: React.CSSProperties = {\n  backgroundColor: \"#ffffff\",\n  color: \"#18181b\",\n  borderRadius: \"9999px\",\n  padding: \"2px 8px\",\n  fontSize: \"12px\",\n  fontWeight: 600,\n};\n\nconst chainBadgeStyles: React.CSSProperties = {\n  backgroundColor: \"rgba(255,255,255,0.15)\",\n  color: \"#a1a1aa\",\n  borderRadius: \"4px\",\n  padding: \"2px 6px\",\n  fontSize: \"11px\",\n};\n\nconst signAllButtonStyles: React.CSSProperties = {\n  backgroundColor: \"#ffffff\",\n  color: \"#18181b\",\n  border: \"none\",\n  borderRadius: \"6px\",\n  padding: \"6px 12px\",\n  fontSize: \"13px\",\n  fontWeight: 500,\n  cursor: \"pointer\",\n  transition: \"background-color 0.15s\",\n};\n\nconst signAllButtonHoverStyles: React.CSSProperties = {\n  backgroundColor: \"#e4e4e7\",\n};\n\nconst signAllButtonDisabledStyles: React.CSSProperties = {\n  opacity: 0.5,\n  cursor: \"not-allowed\",\n};\n\nconst listContainerStyles: React.CSSProperties = {\n  maxHeight: \"300px\",\n  overflowY: \"auto\",\n  borderTop: \"1px solid #27272a\",\n};\n\nconst callItemStyles: React.CSSProperties = {\n  display: \"flex\",\n  alignItems: \"flex-start\",\n  padding: \"10px 16px\",\n  borderBottom: \"1px solid #27272a\",\n  position: \"relative\",\n};\n\nconst callItemLastStyles: React.CSSProperties = {\n  borderBottom: \"none\",\n};\n\nconst callContentStyles: React.CSSProperties = {\n  flex: 1,\n  minWidth: 0,\n};\n\nconst callLabelStyles: React.CSSProperties = {\n  fontWeight: 500,\n  marginBottom: \"2px\",\n};\n\nconst callSublabelStyles: React.CSSProperties = {\n  color: \"#a1a1aa\",\n  fontSize: \"12px\",\n  overflow: \"hidden\",\n  textOverflow: \"ellipsis\",\n  whiteSpace: \"nowrap\",\n};\n\nconst removeButtonStyles: React.CSSProperties = {\n  position: \"absolute\",\n  left: \"8px\",\n  top: \"50%\",\n  transform: \"translateY(-50%)\",\n  backgroundColor: \"#dc2626\",\n  color: \"#ffffff\",\n  border: \"none\",\n  borderRadius: \"4px\",\n  width: \"20px\",\n  height: \"20px\",\n  display: \"flex\",\n  alignItems: \"center\",\n  justifyContent: \"center\",\n  cursor: \"pointer\",\n  fontSize: \"14px\",\n  opacity: 0,\n  transition: \"opacity 0.15s\",\n};\n\nconst removeButtonVisibleStyles: React.CSSProperties = {\n  opacity: 1,\n};\n\nconst clearButtonStyles: React.CSSProperties = {\n  display: \"block\",\n  width: \"100%\",\n  padding: \"10px 16px\",\n  backgroundColor: \"transparent\",\n  color: \"#a1a1aa\",\n  border: \"none\",\n  borderTop: \"1px solid #27272a\",\n  fontSize: \"12px\",\n  cursor: \"pointer\",\n  textAlign: \"center\",\n  transition: \"color 0.15s\",\n};\n\nconst clearButtonHoverStyles: React.CSSProperties = {\n  color: \"#ffffff\",\n};\n\n/**\n * Animated chevron arrow used as the expand/collapse indicator in the widget\n * header. Points downward when the list is expanded and rotates 90° counter-\n * clockwise (points right) when collapsed, providing a clear affordance for\n * the toggle action.\n *\n * @param down - `true` when the queue list is expanded (chevron points down).\n */\nfunction ChevronIcon({ down }: { down: boolean }) {\n  return (\n    <svg\n      width=\"16\"\n      height=\"16\"\n      viewBox=\"0 0 24 24\"\n      fill=\"none\"\n      stroke=\"currentColor\"\n      strokeWidth=\"2\"\n      strokeLinecap=\"round\"\n      strokeLinejoin=\"round\"\n      style={{\n        transition: \"transform 0.2s\",\n        transform: down ? \"rotate(0deg)\" : \"rotate(-90deg)\",\n      }}\n    >\n      <path d=\"m6 9 6 6 6-6\" />\n    </svg>\n  );\n}\n\nexport interface BatchQueueWidgetProps {\n  /** Callback when \"Sign All\" is clicked. */\n  onSignAll: () => void;\n}\n\n/**\n * Floating widget that displays the current batch transaction queue.\n *\n * Renders nothing while the queue is empty. When calls are present it shows a\n * fixed card in the bottom-right corner of the viewport with:\n * - A count badge and optional chain name in the header.\n * - A \"Sign All\" button that invokes `onSignAll` to begin the signing ceremony.\n * - An expandable list of queued calls with per-item remove buttons revealed\n *   on hover and a \"Clear batch\" footer to discard all pending calls at once.\n *\n * A brief scale animation (`batch-bounce-in`) plays each time a new call is\n * added to the queue to draw the user's attention without interrupting flow.\n *\n * Must be rendered inside a `BatchQueueProvider`.\n *\n * @param props.onSignAll - Called when the user clicks \"Sign All\". The\n *   implementor is responsible for resolving the account identity and passing\n *   it to `useBatchQueue().signAll({ accountAddress })`.\n */\nexport function BatchQueueWidget({ onSignAll }: BatchQueueWidgetProps) {\n  const {\n    queue,\n    batchChainId,\n    removeFromBatch,\n    clearBatch,\n    isExpanded,\n    setExpanded,\n    isSigning,\n    animationTrigger,\n  } = useBatchQueue();\n\n  const [hoveredItemId, setHoveredItemId] = React.useState<string | null>(null);\n  const [isSignAllHovered, setIsSignAllHovered] = React.useState(false);\n  const [isClearHovered, setIsClearHovered] = React.useState(false);\n  const [shouldAnimate, setShouldAnimate] = React.useState(false);\n\n  // Inject CSS animations on mount\n  React.useEffect(() => {\n    injectStyles();\n  }, []);\n\n  // Trigger bounce animation when item is added\n  React.useEffect(() => {\n    if (animationTrigger > 0) {\n      setShouldAnimate(true);\n      const timer = setTimeout(() => setShouldAnimate(false), 300);\n      return () => clearTimeout(timer);\n    }\n  }, [animationTrigger]);\n\n  // Don't render if queue is empty\n  if (queue.length === 0) {\n    return null;\n  }\n\n  const handleHeaderClick = () => {\n    setExpanded(!isExpanded);\n  };\n\n  const handleSignAllClick = (e: React.MouseEvent) => {\n    e.stopPropagation(); // Don't toggle expand\n    if (!isSigning) {\n      onSignAll();\n    }\n  };\n\n  const animatedWidgetStyles: React.CSSProperties = {\n    ...widgetStyles,\n    animation: shouldAnimate ? \"batch-bounce-in 0.3s ease-out\" : undefined,\n  };\n\n  const currentSignAllStyles: React.CSSProperties = {\n    ...signAllButtonStyles,\n    ...(isSignAllHovered && !isSigning ? signAllButtonHoverStyles : {}),\n    ...(isSigning ? signAllButtonDisabledStyles : {}),\n  };\n\n  return (\n    <div style={animatedWidgetStyles}>\n      {/* Header - always visible */}\n      <div style={headerStyles} onClick={handleHeaderClick}>\n        <div style={headerLeftStyles}>\n          <ChevronIcon down={isExpanded} />\n          <span style={counterBadgeStyles}>{queue.length}</span>\n          <span>call{queue.length !== 1 ? \"s\" : \"\"} queued</span>\n          {batchChainId && (\n            <span style={chainBadgeStyles}>{getChainName(batchChainId)}</span>\n          )}\n        </div>\n        <button\n          style={currentSignAllStyles}\n          onClick={handleSignAllClick}\n          onMouseEnter={() => setIsSignAllHovered(true)}\n          onMouseLeave={() => setIsSignAllHovered(false)}\n          disabled={isSigning}\n        >\n          {isSigning ? \"Signing...\" : \"Sign All\"}\n        </button>\n      </div>\n\n      {/* Expanded list of calls */}\n      {isExpanded && (\n        <>\n          <div style={listContainerStyles}>\n            {queue.map((item, index) => {\n              const isHovered = hoveredItemId === item.id;\n              const isLast = index === queue.length - 1;\n\n              return (\n                <div\n                  key={item.id}\n                  style={{\n                    ...callItemStyles,\n                    ...(isLast ? callItemLastStyles : {}),\n                    paddingLeft: isHovered ? \"36px\" : \"16px\",\n                    transition: \"padding-left 0.15s\",\n                  }}\n                  onMouseEnter={() => setHoveredItemId(item.id)}\n                  onMouseLeave={() => setHoveredItemId(null)}\n                >\n                  <button\n                    style={{\n                      ...removeButtonStyles,\n                      ...(isHovered ? removeButtonVisibleStyles : {}),\n                    }}\n                    onClick={() => removeFromBatch(item.id)}\n                    title=\"Remove from batch\"\n                  >\n                    &times;\n                  </button>\n                  <div style={callContentStyles}>\n                    <div style={callLabelStyles}>\n                      {item.call.label || \"Contract Call\"}\n                    </div>\n                    {item.call.sublabel && (\n                      <div style={callSublabelStyles}>{item.call.sublabel}</div>\n                    )}\n                    {!item.call.sublabel && item.call.to && (\n                      <div style={callSublabelStyles}>\n                        To: {item.call.to.slice(0, 6)}...{item.call.to.slice(-4)}\n                      </div>\n                    )}\n                  </div>\n                </div>\n              );\n            })}\n          </div>\n\n          {/* Clear batch button */}\n          <button\n            style={{\n              ...clearButtonStyles,\n              ...(isClearHovered ? clearButtonHoverStyles : {}),\n            }}\n            onClick={clearBatch}\n            onMouseEnter={() => setIsClearHovered(true)}\n            onMouseLeave={() => setIsClearHovered(false)}\n          >\n            Clear batch\n          </button>\n        </>\n      )}\n    </div>\n  );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4DO,SAAS,kBACd,QAC0B;AAC1B,QAAM,EAAE,MAAM,GAAG,WAAW,IAAI;AAChC,SAAO;AAAA,IACL,aAAa,CAAC,UAAwC;AAAA,IACtD,WAAW;AAAA,MACT;AAAA,QACE,SAAS,OAAO;AAAA,QAChB;AAAA,QACA,KAAK,OAAO;AAAA,MACd;AAAA,IACF;AAAA,EACF;AACF;;;AC1EA,SAAS,iBAA2C;AAwDpD,SAAS,oBAAoB,OAA8B;AACzD,MAAI,OAAO,UAAU,SAAU,QAAO;AAEtC,SAAO,OAAO,KAAK,MAAM,MAAM,QAAQ,IAAI,GAAI,CAAC;AAClD;AAEA,SAAS,qBAAqB,OAAyB,SAA0B;AAC/E,SAAO,UAAU,OAAO,EAAE,QAAQ,MAAM,CAAC,IAAI,QAAQ,gBAAgB,OAAO,OAAO;AACrF;AASO,SAAS,2BACd,OACkB;AAClB,QAAM,WAAW,MAAM,QAAQ,MAAM,IAAI,IAAI,MAAM,OAAO,CAAC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