import { O as OneAuthClient } from './client-B0vb_deA.mjs'; export { O as OneAuthError } from './errors-Blx9IVF_.mjs'; import { P as PasskeyProviderConfig, C as CloseOnStatus, T as ThemeConfig, h as SignerType, i as IntentCall, j as SendIntentResult } from './types-BN6cCuAd.mjs'; export { ac as AssetBalance, ad as AssetBalanceBucket, ae as AssetsResponse, y as AuthFlow, A as AuthResult, z as AuthWithModalOptions, F as AuthenticateOptions, G as AuthenticateResult, Y as BalanceRequirement, at as BatchIntentItem, aw as BatchIntentItemResult, ah as CheckConsentOptions, ai as CheckConsentResult, D as ConnectResult, ag as ConsentData, af as ConsentField, B as CreateAccountWithModalOptions, n as CreateCrossChainPermissionInput, w as CreateSigningRequestResponse, o as CrossChainPermit, p as CrossChainSettlementLayer, Q as EIP712Domain, U as EIP712TypeField, R as EIP712Types, E as EmbedOptions, a7 as ExecuteIntentResponse, ab as GetAssetsOptions, ar as GrantPermissionContractMetadata, al as GrantPermissionsOptions, am as GrantPermissionsResult, a9 as IntentHistoryItem, a8 as IntentHistoryOptions, aa as IntentHistoryResult, a3 as IntentQuote, a4 as IntentStatus, a1 as IntentTokenRequest, an as ListSessionGrantsOptions, ao as ListSessionGrantsResult, L as LoginWithModalOptions, $ as OneAuthCandidateError, _ as OneAuthErrorDetails, a0 as OneAuthResultError, aB as OneAuthTelemetryAttributeValue, aC as OneAuthTelemetryAttributes, aD as OneAuthTelemetryConfig, aE as OneAuthTelemetryEvent, aF as OneAuthTelemetryEventName, aG as OneAuthTelemetryFlow, aH as OneAuthTelemetryTraceContext, a5 as OrchestratorStatus, v as PasskeyCredentials, ay as PrepareBatchIntentResponse, a6 as PrepareIntentResponse, ax as PreparedBatchIntent, aj as RequestConsentOptions, ak as RequestConsentResult, k as SIGNING_ERROR_CODES, au as SendBatchIntentOptions, av as SendBatchIntentResult, a2 as SendIntentOptions, aq as SessionGrantChain, ap as SessionGrantRecord, K as SignMessageOptions, M as SignMessageResult, N as SignTypedDataOptions, O as SignTypedDataResult, t as SigningError, u as SigningErrorCode, q as SigningRequestOptions, x as SigningRequestStatus, r as SigningResult, J as SigningResultBase, s as SigningSuccess, as as SmartSessionPolicy, az as SponsorshipCallbackConfig, S as SponsorshipConfig, aA as SponsorshipUrlConfig, V as TransactionAction, Z as TransactionDetails, X as TransactionFees, W as WebAuthnSignature, m as createCrossChainPermission, l as isSigningErrorCode } from './types-BN6cCuAd.mjs'; import { Abi, Address, LocalAccount, WalletClient, Hash } from 'viem'; import { Permission } from '@rhinestone/sdk'; export { Permission } from '@rhinestone/sdk'; import { O as OneAuthProvider } from './provider-CNDrBzGs.mjs'; export { a as OneAuthProviderOptions, c as createOneAuthProvider } from './provider-CNDrBzGs.mjs'; import { P as PasskeyWalletClientConfig, S as SendCallsParams } from './verify-CEzkfM92.mjs'; export { C as ChainFilterOptions, E as ETHEREUM_MESSAGE_PREFIX, p as TokenConfig, T as TransactionCall, e as encodeWebAuthnSignature, b as getAllSupportedChainsAndTokens, f as getChainById, i as getChainExplorerUrl, j as getChainRpcUrl, g as getSupportedChainIds, a as getSupportedChains, d as getSupportedTokenSymbols, c as getSupportedTokens, l as getTokenAddress, n as getTokenDecimals, m as getTokenSymbol, h as hashCalls, q as hashMessage, k as isTestnet, o as isTokenAddressSupported, r as resolveTokenAddress, v as verifyMessageHash } from './verify-CEzkfM92.mjs'; import * as react_jsx_runtime from 'react/jsx-runtime'; import * as React from 'react'; type DefinePermissionsConfig = Permission & { /** Optional human-readable name surfaced in the review UI. */ name?: string; }; interface DefinedPermissions { /** * v2 SmartSession permissions, ready to pass to * `OneAuthClient.grantPermissions({ ...definePermissions(...) })`. * * Always a single-element array so the `...spread` pattern works cleanly * with `grantPermissions`, which accepts `permissions: Permission[]`. * * Widened to `Permission` (rather than `Permission`) so the * spread composes with `GrantPermissionsOptions.permissions: Permission[]`. * The SDK's v2 `Permission` includes conditional `SpendingLimitField` / * `ValueLimitField` types that break covariance over `TAbi`, so an inferred * narrow `Permission` is no longer assignable to `Permission`. * We keep `TAbi` on the type parameter so `contracts[].abi` retains its * narrow shape for the review UI. */ permissions: [Permission]; /** * Contract metadata for the permission review UI. The address and ABI * here mirror the entry in `permissions[0]`; `name` is optional and * purely cosmetic (it's never sent to a contract). */ contracts: Array<{ address: Address; name?: string; abi: TAbi; }>; } /** * Build a v2 SmartSession `Permission` from an ABI + function map. * * The Rhinestone SDK derives function selectors and universal-action * calldata offsets from the ABI internally, so app code no longer needs * to spell out raw 4-byte selectors or parameter indices. The accepted * shape is the SDK's own `Permission` plus an optional `name` for * the review UI. * * @example * const permissions = definePermissions({ * address: USDC, * abi: erc20Abi, * name: "USDC", * functions: { * transfer: { * params: { to: { condition: "equal", value: RECIPIENT } }, * }, * }, * }); * * await oneAuth.grantPermissions({ ...permissions, sessionKeyAddress }); */ declare function definePermissions(config: DefinePermissionsConfig): DefinedPermissions; /** * One-call connect entry point for 1auth. * * `createOneAuthConnection` is the ergonomic front door for integrators who * want a single function that: * 1. opens the 1auth dialog so the user picks **1auth passkey** *or* a * **traditional wallet** (WalletConnect / injected), and * 2. hands back a ready-to-use EIP-1193 provider plus the connected * `{ address, signerType }`. * * When the user picks a traditional wallet (an EOA), the returned provider * forwards `eth_sendTransaction` / `personal_sign` / `signTypedData` / * `wallet_sendCalls` straight to that wallet's native RPC — **no Rhinestone * intents**. When they pick a passkey, transactions route through 1auth intents * exactly as before. The app writes one downstream code path either way. * * This is purely additive: `OneAuthClient.connect()` and * `createOneAuthProvider()` are unchanged and remain the lower-level building * blocks this factory composes. * * @module */ /** * Provider-shaping options that apply on top of the passkey client config. * Mirrors the relevant {@link createOneAuthProvider} options. */ interface OneAuthConnectionOptions { /** * Chain the returned provider reports via `eth_chainId` and uses as the * default intent target. Defaults to `8453` (Base). Ignored for EOA sessions * beyond the reported chain id — an EOA transacts on whatever chain its * wallet is on. */ defaultChainId?: number; /** * localStorage key the session is persisted under. Defaults to `"1auth-user"`. * Override only to run multiple independent connections on one origin. */ storageKey?: string; /** Forwarded to the provider for passkey intent sends. */ closeOn?: CloseOnStatus; waitForHash?: boolean; hashTimeoutMs?: number; hashIntervalMs?: number; /** * Opt in to offering a **traditional wallet as the account signer**. When * `true`, the dialog's wallet path connects the chosen EOA as the signer (a * `signerType: "eoa"` session whose transactions bypass Rhinestone intents). * * **Defaults to `false`** — by default the app gets 1auth smart accounts + * intents, and the wallet path (if the user picks it) still bootstraps a * passkey account. Passkey selection is unaffected either way. Can be * overridden per call via {@link OneAuthConnectOptions.eoaConnect}. */ eoaConnect?: boolean; } /** Full config form: constructs the client for you. Only `clientId` is practically required. */ type OneAuthConnectionConfig = PasskeyProviderConfig & OneAuthConnectionOptions; /** Reuse form: bring your own configured {@link OneAuthClient}. */ type OneAuthConnectionConfigWithClient = { client: OneAuthClient; } & OneAuthConnectionOptions; /** Options accepted by {@link OneAuthConnection.connect}. */ interface OneAuthConnectOptions { theme?: ThemeConfig; /** Applies only to the auth-modal fallback path (email/OAuth entry). */ oauthEnabled?: boolean; /** * Per-call override of {@link OneAuthConnectionOptions.eoaConnect}. Defaults * to the connection's config value (which itself defaults to `false`). */ eoaConnect?: boolean; } /** * The resolved session. Discriminated on `signerType` so callers can branch on * EOA vs passkey with full type safety. */ interface OneAuthSession { /** `"eoa"` = traditional wallet (plain tx, no intents). `"passkey"` = 1auth smart account (intents). */ signerType: SignerType; address: `0x${string}`; /** The same {@link OneAuthProvider} instance exposed on the connection. */ provider: OneAuthProvider; /** Chain id the provider reports (see {@link OneAuthConnectionOptions.defaultChainId}). */ chainId: number; /** True when a returning user was reconnected with no visible UI. */ autoConnected: boolean; } /** Error thrown by {@link OneAuthConnection.connect} when the user cancels or auth fails. */ interface OneAuthConnectError { code: string; message: string; } /** The handle returned by {@link createOneAuthConnection}. */ interface OneAuthConnection { /** The underlying client — escape hatch for `signMessage`, history, the account dialog, etc. */ client: OneAuthClient; /** Ready-to-use EIP-1193 provider. Stable across reconnects. */ provider: OneAuthProvider; /** * Open the 1auth dialog so the user picks passkey OR a traditional wallet. * Binds the resulting session to {@link OneAuthConnection.provider} before it * resolves, so a send issued immediately after routes correctly. * * @throws {@link OneAuthConnectError} shape (`{ code, message }`) on cancel/failure. */ connect: (options?: OneAuthConnectOptions) => Promise; /** Current session read from persisted state, or `null`. Never opens a dialog. */ getSession: () => OneAuthSession | null; /** Clear the session and emit `accountsChanged([])` / `disconnect`. */ disconnect: () => Promise; /** * Subscribe to session changes (connect/disconnect). Returns an unsubscribe * function. Sugar over `provider.on("accountsChanged", …)`. */ subscribe: (listener: (session: OneAuthSession | null) => void) => () => void; } /** * Create a one-call 1auth connection. * * @example Zero-boilerplate * ```typescript * import { createOneAuthConnection } from "@rhinestone/1auth"; * import { createWalletClient, custom } from "viem"; * import { base } from "viem/chains"; * * const conn = createOneAuthConnection({ clientId: "my-app" }); * const session = await conn.connect(); // user picks passkey OR wallet * * const walletClient = createWalletClient({ * account: session.address, * chain: base, * transport: custom(session.provider), * }); * // Same call for both signer types; EOA bypasses intents, passkey uses them. * await walletClient.sendTransaction({ to: "0x…", value: 1n }); * ``` * * @example Reuse an existing client * ```typescript * const client = new OneAuthClient({ clientId: "my-app", sponsorship }); * const conn = createOneAuthConnection({ client, defaultChainId: 8453 }); * const { address, signerType, provider } = await conn.connect(); * ``` */ declare function createOneAuthConnection(config: OneAuthConnectionConfig): OneAuthConnection; declare function createOneAuthConnection(config: OneAuthConnectionConfigWithClient): OneAuthConnection; /** * viem LocalAccount adapter for 1auth passkey-controlled smart accounts. * * Bridges viem's `LocalAccount` interface to the 1auth passkey service so that * any viem-based library (e.g. permissionless, viem itself) can use a passkey * account without handling WebAuthn directly. All cryptographic operations are * delegated to the passkey service via `OneAuthClient`. * * @module */ type PasskeyAccount = LocalAccount<"1auth"> & { /** Smart account address used as the canonical signer identity. */ accountAddress: Address; }; /** * Creates a viem `LocalAccount` that delegates signing to the 1auth passkey service. * * The returned account satisfies the `LocalAccount` interface expected by viem's * `createWalletClient` and similar APIs. `signTransaction` is explicitly unsupported * because 1auth uses the intent/bundler model instead of raw signed transactions — * callers should use `sendIntent` (via `eth_sendTransaction` on the provider) instead. * * All signing operations encode the resulting WebAuthn signature with * `encodeWebAuthnSignature` so the output is directly usable with ERC-1271 * on-chain verification. * * @param client - A configured `OneAuthClient` instance * @param params.address - The EVM address of the user's smart account * @returns A `PasskeyAccount` extending `LocalAccount<"1auth">` * * @example * ```typescript * import { createWalletClient, http } from "viem"; * import { base } from "viem/chains"; * import { OneAuthClient, createPasskeyAccount } from "@rhinestone/1auth"; * * const client = new OneAuthClient({ clientId: "my-app" }); * const account = createPasskeyAccount(client, { * address: "0xYourSmartAccountAddress", * }); * * const walletClient = createWalletClient({ * account, * chain: base, * transport: http(), * }); * * const signature = await walletClient.signMessage({ message: "Hello" }); * ``` */ declare function createPasskeyAccount(client: OneAuthClient, params: { address: Address; }): PasskeyAccount; /** * @file viem WalletClient factory backed by passkey signing. * * {@link createPasskeyWalletClient} returns a standard viem `WalletClient` * augmented with a `sendCalls` method for batched ERC-4337 intents. All * signing operations open the 1auth passkey modal so that private keys never * leave the secure enclave on the user's device. * * The factory is framework-agnostic — it works in any environment that can * run viem (React, Vue, plain Node.js scripts, etc.). */ /** * Extended WalletClient with passkey signing and batch transaction support */ type PasskeyWalletClient = WalletClient & { /** * Send multiple calls as a single batched transaction * Opens the passkey modal for user approval */ sendCalls: (params: SendCallsParams) => Promise; }; /** * Create a viem-compatible WalletClient that uses passkeys for signing * * @example * ```typescript * import { createPasskeyWalletClient } from '@rhinestone/1auth'; * import { baseSepolia } from 'viem/chains'; * import { http } from 'viem'; * * const walletClient = createPasskeyWalletClient({ * accountAddress: '0x...', * providerUrl: 'https://passkey.1auth.app', * clientId: 'my-dapp', * chain: baseSepolia, * transport: http(), * }); * * // Standard viem API * const hash = await walletClient.sendTransaction({ * to: '0x...', * data: '0x...', * value: 0n, * }); * * // Batched transactions * const batchHash = await walletClient.sendCalls({ * calls: [ * { to: '0x...', data: '0x...' }, * { to: '0x...', data: '0x...' }, * ], * }); * ``` */ declare function createPasskeyWalletClient(config: PasskeyWalletClientConfig): PasskeyWalletClient; /** Identity used to sign a queued batch. Account address is the sole identity. */ interface BatchQueueIdentity { /** Smart account address of the signer. */ accountAddress: string; } /** * A batched call in the queue */ interface BatchedCall { /** Unique ID for removal */ id: string; /** The actual call data */ call: IntentCall; /** Chain ID for execution */ targetChain: number; /** Timestamp when added */ addedAt: number; } declare function getChainName(chainId: number): string; /** * Batch queue context value */ interface BatchQueueContextValue { /** Current queue of batched calls */ queue: BatchedCall[]; /** Chain ID of the current batch (from first call) */ batchChainId: number | null; /** Add a call to the batch */ addToBatch: (call: IntentCall, targetChain: number) => { success: boolean; error?: string; }; /** Remove a call from the batch */ removeFromBatch: (id: string) => void; /** Clear all calls from the batch */ clearBatch: () => void; /** Sign and execute all batched calls. A bare string is treated as the account address. */ signAll: (identity?: string | BatchQueueIdentity) => Promise; /** Whether the widget is expanded */ isExpanded: boolean; /** Set widget expanded state */ setExpanded: (expanded: boolean) => void; /** Whether signing is in progress */ isSigning: boolean; /** Animation trigger for bounce effect */ animationTrigger: number; } /** * Hook to access the batch queue context */ declare function useBatchQueue(): BatchQueueContextValue; interface BatchQueueProviderProps { /** The OneAuthClient instance */ client: OneAuthClient; /** Account address for localStorage persistence and account lookup. */ accountAddress?: string; /** Children to render */ children: React.ReactNode; } /** * Provider component for the batch queue */ declare function BatchQueueProvider({ client, accountAddress, children, }: BatchQueueProviderProps): react_jsx_runtime.JSX.Element; /** * @file Floating UI widget for the 1auth batch transaction queue. * * Renders a fixed-position card anchored to the bottom-right of the viewport * that shows how many calls are queued and on which chain. The widget is * invisible while the queue is empty and mounts itself into the React tree * wherever `BatchQueueProvider` wraps the application. * * CSS keyframe animations are injected into `document.head` once on mount * via {@link injectStyles} so that no stylesheet import is required from the * consumer's bundler. */ interface BatchQueueWidgetProps { /** Callback when "Sign All" is clicked. */ onSignAll: () => void; } /** * Floating widget that displays the current batch transaction queue. * * Renders nothing while the queue is empty. When calls are present it shows a * fixed card in the bottom-right corner of the viewport with: * - A count badge and optional chain name in the header. * - A "Sign All" button that invokes `onSignAll` to begin the signing ceremony. * - An expandable list of queued calls with per-item remove buttons revealed * on hover and a "Clear batch" footer to discard all pending calls at once. * * A brief scale animation (`batch-bounce-in`) plays each time a new call is * added to the queue to draw the user's attention without interrupting flow. * * Must be rendered inside a `BatchQueueProvider`. * * @param props.onSignAll - Called when the user clicks "Sign All". The * implementor is responsible for resolving the account identity and passing * it to `useBatchQueue().signAll({ accountAddress })`. */ declare function BatchQueueWidget({ onSignAll }: BatchQueueWidgetProps): react_jsx_runtime.JSX.Element | null; export { type BatchQueueContextValue, type BatchQueueIdentity, BatchQueueProvider, type BatchQueueProviderProps, BatchQueueWidget, type BatchQueueWidgetProps, type BatchedCall, CloseOnStatus, type DefinePermissionsConfig, type DefinedPermissions, IntentCall, OneAuthClient, type OneAuthConnectError, type OneAuthConnectOptions, type OneAuthConnection, type OneAuthConnectionConfig, type OneAuthConnectionConfigWithClient, type OneAuthConnectionOptions, OneAuthProvider, type OneAuthSession, type PasskeyAccount, PasskeyProviderConfig, type PasskeyWalletClient, PasskeyWalletClientConfig, SendCallsParams, SendIntentResult, SignerType, ThemeConfig, createOneAuthConnection, createPasskeyAccount, createPasskeyWalletClient, definePermissions, getChainName, useBatchQueue };