@rhinestone/1auth 0.7.4 → 0.7.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/{chunk-IHBVEU33.mjs → chunk-6AHEN3FA.mjs} +1 -1
  2. package/dist/chunk-6AHEN3FA.mjs.map +1 -0
  3. package/dist/{chunk-UXBBB7AV.mjs → chunk-E4YZS7FZ.mjs} +68 -32
  4. package/dist/chunk-E4YZS7FZ.mjs.map +1 -0
  5. package/dist/{client-D4HVy1KF.d.mts → client-C8QSA1th.d.mts} +22 -17
  6. package/dist/{client-CuASptX3.d.ts → client-Dn6mL7BZ.d.ts} +22 -17
  7. package/dist/headless.d.mts +2 -2
  8. package/dist/headless.d.ts +2 -2
  9. package/dist/headless.js +4 -6
  10. package/dist/headless.js.map +1 -1
  11. package/dist/headless.mjs +4 -6
  12. package/dist/headless.mjs.map +1 -1
  13. package/dist/index.d.mts +163 -22
  14. package/dist/index.d.ts +163 -22
  15. package/dist/index.js +210 -116
  16. package/dist/index.js.map +1 -1
  17. package/dist/index.mjs +143 -86
  18. package/dist/index.mjs.map +1 -1
  19. package/dist/{provider-6JoziYDq.d.ts → provider-BsVmPgkQ.d.ts} +22 -3
  20. package/dist/{provider-CAQT7Gqx.d.mts → provider-CJv38fIK.d.mts} +22 -3
  21. package/dist/react.d.mts +9 -4
  22. package/dist/react.d.ts +9 -4
  23. package/dist/react.js +4 -7
  24. package/dist/react.js.map +1 -1
  25. package/dist/react.mjs +4 -7
  26. package/dist/react.mjs.map +1 -1
  27. package/dist/server.d.mts +2 -2
  28. package/dist/server.d.ts +2 -2
  29. package/dist/server.js.map +1 -1
  30. package/dist/server.mjs +1 -1
  31. package/dist/{types-C0jKNT_t.d.mts → types-Dzm5lZK-.d.mts} +33 -51
  32. package/dist/{types-C0jKNT_t.d.ts → types-Dzm5lZK-.d.ts} +33 -51
  33. package/dist/{verify-CnOwPq78.d.ts → verify-0VXQpQBJ.d.mts} +4 -6
  34. package/dist/{verify-aWdi5O2z.d.mts → verify-9UgxLSdo.d.ts} +4 -6
  35. package/dist/wagmi.d.mts +3 -3
  36. package/dist/wagmi.d.ts +3 -3
  37. package/dist/wagmi.js +67 -31
  38. package/dist/wagmi.js.map +1 -1
  39. package/dist/wagmi.mjs +1 -1
  40. package/package.json +1 -1
  41. package/dist/chunk-IHBVEU33.mjs.map +0 -1
  42. package/dist/chunk-UXBBB7AV.mjs.map +0 -1
package/dist/index.d.mts CHANGED
@@ -1,12 +1,13 @@
1
- import { O as OneAuthClient } from './client-D4HVy1KF.mjs';
1
+ import { O as OneAuthClient } from './client-C8QSA1th.mjs';
2
2
  import { Abi, Address, LocalAccount, WalletClient, Hash } from 'viem';
3
3
  import { Permission } from '@rhinestone/sdk';
4
4
  export { Permission } from '@rhinestone/sdk';
5
- import { h as IntentCall, i as SendIntentResult } from './types-C0jKNT_t.mjs';
6
- export { a7 as AssetBalance, a8 as AssetBalanceBucket, a9 as AssetsResponse, u as AuthFlow, A as AuthResult, v as AuthWithModalOptions, z as AuthenticateOptions, B as AuthenticateResult, R as BalanceRequirement, ap as BatchIntentItem, as as BatchIntentItemResult, ad as CheckConsentOptions, ae as CheckConsentResult, a0 as CloseOnStatus, y as ConnectResult, ac as ConsentData, ab as ConsentField, w as CreateAccountWithModalOptions, C as CreateCrossChainPermissionInput, r as CreateSigningRequestResponse, k as CrossChainPermit, l as CrossChainSettlementLayer, M as EIP712Domain, O as EIP712TypeField, N as EIP712Types, E as EmbedOptions, a2 as ExecuteIntentResponse, a6 as GetAssetsOptions, an as GrantPermissionContractMetadata, ah as GrantPermissionsOptions, ai as GrantPermissionsResult, a4 as IntentHistoryItem, a3 as IntentHistoryOptions, a5 as IntentHistoryResult, Z as IntentQuote, _ as IntentStatus, X as IntentTokenRequest, aj as ListSessionGrantsOptions, ak as ListSessionGrantsResult, L as LoginWithModalOptions, ax as OneAuthTelemetryAttributeValue, ay as OneAuthTelemetryAttributes, az as OneAuthTelemetryConfig, aA as OneAuthTelemetryEvent, aB as OneAuthTelemetryEventName, aC as OneAuthTelemetryFlow, aD as OneAuthTelemetryTraceContext, $ as OrchestratorStatus, t as PasskeyCredential, P as PasskeyProviderConfig, au as PrepareBatchIntentResponse, a1 as PrepareIntentResponse, at as PreparedBatchIntent, af as RequestConsentOptions, ag as RequestConsentResult, aq as SendBatchIntentOptions, ar as SendBatchIntentResult, Y as SendIntentOptions, am as SessionGrantChain, al as SessionGrantRecord, F as SignMessageOptions, G as SignMessageResult, J as SignTypedDataOptions, K as SignTypedDataResult, x as SignerType, p as SigningError, q as SigningErrorCode, m as SigningRequestOptions, s as SigningRequestStatus, n as SigningResult, D as SigningResultBase, o as SigningSuccess, ao as SmartSessionPolicy, av as SponsorshipCallbackConfig, S as SponsorshipConfig, aw as SponsorshipUrlConfig, aa as ThemeConfig, T as TransactionAction, V as TransactionDetails, Q as TransactionFees, U as UserPasskeysResponse, W as WebAuthnSignature, j as createCrossChainPermission } from './types-C0jKNT_t.mjs';
7
- export { O as OneAuthProvider, a as OneAuthProviderOptions, c as createOneAuthProvider } from './provider-CAQT7Gqx.mjs';
8
- import { P as PasskeyWalletClientConfig, S as SendCallsParams } from './verify-aWdi5O2z.mjs';
9
- 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-aWdi5O2z.mjs';
5
+ import { P as PasskeyProviderConfig, C as CloseOnStatus, T as ThemeConfig, h as SignerType, i as IntentCall, j as SendIntentResult } from './types-Dzm5lZK-.mjs';
6
+ export { a8 as AssetBalance, a9 as AssetBalanceBucket, aa as AssetsResponse, w as AuthFlow, A as AuthResult, x as AuthWithModalOptions, B as AuthenticateOptions, D as AuthenticateResult, X as BalanceRequirement, ap as BatchIntentItem, as as BatchIntentItemResult, ad as CheckConsentOptions, ae as CheckConsentResult, z as ConnectResult, ac as ConsentData, ab as ConsentField, y as CreateAccountWithModalOptions, l as CreateCrossChainPermissionInput, t as CreateSigningRequestResponse, m as CrossChainPermit, n as CrossChainSettlementLayer, N as EIP712Domain, Q as EIP712TypeField, O as EIP712Types, E as EmbedOptions, a3 as ExecuteIntentResponse, a7 as GetAssetsOptions, an as GrantPermissionContractMetadata, ah as GrantPermissionsOptions, ai as GrantPermissionsResult, a5 as IntentHistoryItem, a4 as IntentHistoryOptions, a6 as IntentHistoryResult, $ as IntentQuote, a0 as IntentStatus, Z as IntentTokenRequest, aj as ListSessionGrantsOptions, ak as ListSessionGrantsResult, L as LoginWithModalOptions, ax as OneAuthTelemetryAttributeValue, ay as OneAuthTelemetryAttributes, az as OneAuthTelemetryConfig, aA as OneAuthTelemetryEvent, aB as OneAuthTelemetryEventName, aC as OneAuthTelemetryFlow, aD as OneAuthTelemetryTraceContext, a1 as OrchestratorStatus, v as PasskeyCredential, au as PrepareBatchIntentResponse, a2 as PrepareIntentResponse, at as PreparedBatchIntent, af as RequestConsentOptions, ag as RequestConsentResult, aq as SendBatchIntentOptions, ar as SendBatchIntentResult, _ as SendIntentOptions, am as SessionGrantChain, al as SessionGrantRecord, G as SignMessageOptions, J as SignMessageResult, K as SignTypedDataOptions, M as SignTypedDataResult, r as SigningError, s as SigningErrorCode, o as SigningRequestOptions, u as SigningRequestStatus, p as SigningResult, F as SigningResultBase, q as SigningSuccess, ao as SmartSessionPolicy, av as SponsorshipCallbackConfig, S as SponsorshipConfig, aw as SponsorshipUrlConfig, R as TransactionAction, Y as TransactionDetails, V as TransactionFees, U as UserPasskeysResponse, W as WebAuthnSignature, k as createCrossChainPermission } from './types-Dzm5lZK-.mjs';
7
+ import { O as OneAuthProvider } from './provider-CJv38fIK.mjs';
8
+ export { a as OneAuthProviderOptions, c as createOneAuthProvider } from './provider-CJv38fIK.mjs';
9
+ import { P as PasskeyWalletClientConfig, S as SendCallsParams } from './verify-0VXQpQBJ.mjs';
10
+ 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-0VXQpQBJ.mjs';
10
11
  import * as react_jsx_runtime from 'react/jsx-runtime';
11
12
  import * as React from 'react';
12
13
 
@@ -67,6 +68,155 @@ interface DefinedPermissions<TAbi extends Abi = Abi> {
67
68
  */
68
69
  declare function definePermissions<const TAbi extends Abi>(config: DefinePermissionsConfig<TAbi>): DefinedPermissions<TAbi>;
69
70
 
71
+ /**
72
+ * One-call connect entry point for 1auth.
73
+ *
74
+ * `createOneAuthConnection` is the ergonomic front door for integrators who
75
+ * want a single function that:
76
+ * 1. opens the 1auth dialog so the user picks **1auth passkey** *or* a
77
+ * **traditional wallet** (WalletConnect / injected), and
78
+ * 2. hands back a ready-to-use EIP-1193 provider plus the connected
79
+ * `{ address, signerType }`.
80
+ *
81
+ * When the user picks a traditional wallet (an EOA), the returned provider
82
+ * forwards `eth_sendTransaction` / `personal_sign` / `signTypedData` /
83
+ * `wallet_sendCalls` straight to that wallet's native RPC — **no Rhinestone
84
+ * intents**. When they pick a passkey, transactions route through 1auth intents
85
+ * exactly as before. The app writes one downstream code path either way.
86
+ *
87
+ * This is purely additive: `OneAuthClient.connect()` and
88
+ * `createOneAuthProvider()` are unchanged and remain the lower-level building
89
+ * blocks this factory composes.
90
+ *
91
+ * @module
92
+ */
93
+
94
+ /**
95
+ * Provider-shaping options that apply on top of the passkey client config.
96
+ * Mirrors the relevant {@link createOneAuthProvider} options.
97
+ */
98
+ interface OneAuthConnectionOptions {
99
+ /**
100
+ * Chain the returned provider reports via `eth_chainId` and uses as the
101
+ * default intent target. Defaults to `8453` (Base). Ignored for EOA sessions
102
+ * beyond the reported chain id — an EOA transacts on whatever chain its
103
+ * wallet is on.
104
+ */
105
+ defaultChainId?: number;
106
+ /**
107
+ * localStorage key the session is persisted under. Defaults to `"1auth-user"`.
108
+ * Override only to run multiple independent connections on one origin.
109
+ */
110
+ storageKey?: string;
111
+ /** Forwarded to the provider for passkey intent sends. */
112
+ closeOn?: CloseOnStatus;
113
+ waitForHash?: boolean;
114
+ hashTimeoutMs?: number;
115
+ hashIntervalMs?: number;
116
+ /**
117
+ * Opt in to offering a **traditional wallet as the account signer**. When
118
+ * `true`, the dialog's wallet path connects the chosen EOA as the signer (a
119
+ * `signerType: "eoa"` session whose transactions bypass Rhinestone intents).
120
+ *
121
+ * **Defaults to `false`** — by default the app gets 1auth smart accounts +
122
+ * intents, and the wallet path (if the user picks it) still bootstraps a
123
+ * passkey account. Passkey selection is unaffected either way. Can be
124
+ * overridden per call via {@link OneAuthConnectOptions.eoaConnect}.
125
+ */
126
+ eoaConnect?: boolean;
127
+ }
128
+ /** Full config form: constructs the client for you. Only `clientId` is practically required. */
129
+ type OneAuthConnectionConfig = PasskeyProviderConfig & OneAuthConnectionOptions;
130
+ /** Reuse form: bring your own configured {@link OneAuthClient}. */
131
+ type OneAuthConnectionConfigWithClient = {
132
+ client: OneAuthClient;
133
+ } & OneAuthConnectionOptions;
134
+ /** Options accepted by {@link OneAuthConnection.connect}. */
135
+ interface OneAuthConnectOptions {
136
+ theme?: ThemeConfig;
137
+ /** Applies only to the auth-modal fallback path (email/OAuth entry). */
138
+ oauthEnabled?: boolean;
139
+ /**
140
+ * Per-call override of {@link OneAuthConnectionOptions.eoaConnect}. Defaults
141
+ * to the connection's config value (which itself defaults to `false`).
142
+ */
143
+ eoaConnect?: boolean;
144
+ }
145
+ /**
146
+ * The resolved session. Discriminated on `signerType` so callers can branch on
147
+ * EOA vs passkey with full type safety.
148
+ */
149
+ interface OneAuthSession {
150
+ /** `"eoa"` = traditional wallet (plain tx, no intents). `"passkey"` = 1auth smart account (intents). */
151
+ signerType: SignerType;
152
+ address: `0x${string}`;
153
+ /** The same {@link OneAuthProvider} instance exposed on the connection. */
154
+ provider: OneAuthProvider;
155
+ /** Chain id the provider reports (see {@link OneAuthConnectionOptions.defaultChainId}). */
156
+ chainId: number;
157
+ /** True when a returning user was reconnected with no visible UI. */
158
+ autoConnected: boolean;
159
+ }
160
+ /** Error thrown by {@link OneAuthConnection.connect} when the user cancels or auth fails. */
161
+ interface OneAuthConnectError {
162
+ code: string;
163
+ message: string;
164
+ }
165
+ /** The handle returned by {@link createOneAuthConnection}. */
166
+ interface OneAuthConnection {
167
+ /** The underlying client — escape hatch for `signMessage`, history, the account dialog, etc. */
168
+ client: OneAuthClient;
169
+ /** Ready-to-use EIP-1193 provider. Stable across reconnects. */
170
+ provider: OneAuthProvider;
171
+ /**
172
+ * Open the 1auth dialog so the user picks passkey OR a traditional wallet.
173
+ * Binds the resulting session to {@link OneAuthConnection.provider} before it
174
+ * resolves, so a send issued immediately after routes correctly.
175
+ *
176
+ * @throws {@link OneAuthConnectError} shape (`{ code, message }`) on cancel/failure.
177
+ */
178
+ connect: (options?: OneAuthConnectOptions) => Promise<OneAuthSession>;
179
+ /** Current session read from persisted state, or `null`. Never opens a dialog. */
180
+ getSession: () => OneAuthSession | null;
181
+ /** Clear the session and emit `accountsChanged([])` / `disconnect`. */
182
+ disconnect: () => Promise<void>;
183
+ /**
184
+ * Subscribe to session changes (connect/disconnect). Returns an unsubscribe
185
+ * function. Sugar over `provider.on("accountsChanged", …)`.
186
+ */
187
+ subscribe: (listener: (session: OneAuthSession | null) => void) => () => void;
188
+ }
189
+ /**
190
+ * Create a one-call 1auth connection.
191
+ *
192
+ * @example Zero-boilerplate
193
+ * ```typescript
194
+ * import { createOneAuthConnection } from "@rhinestone/1auth";
195
+ * import { createWalletClient, custom } from "viem";
196
+ * import { base } from "viem/chains";
197
+ *
198
+ * const conn = createOneAuthConnection({ clientId: "my-app" });
199
+ * const session = await conn.connect(); // user picks passkey OR wallet
200
+ *
201
+ * const walletClient = createWalletClient({
202
+ * account: session.address,
203
+ * chain: base,
204
+ * transport: custom(session.provider),
205
+ * });
206
+ * // Same call for both signer types; EOA bypasses intents, passkey uses them.
207
+ * await walletClient.sendTransaction({ to: "0x…", value: 1n });
208
+ * ```
209
+ *
210
+ * @example Reuse an existing client
211
+ * ```typescript
212
+ * const client = new OneAuthClient({ clientId: "my-app", sponsorship });
213
+ * const conn = createOneAuthConnection({ client, defaultChainId: 8453 });
214
+ * const { address, signerType, provider } = await conn.connect();
215
+ * ```
216
+ */
217
+ declare function createOneAuthConnection(config: OneAuthConnectionConfig): OneAuthConnection;
218
+ declare function createOneAuthConnection(config: OneAuthConnectionConfigWithClient): OneAuthConnection;
219
+
70
220
  /**
71
221
  * viem LocalAccount adapter for 1auth passkey-controlled smart accounts.
72
222
  *
@@ -79,8 +229,6 @@ declare function definePermissions<const TAbi extends Abi>(config: DefinePermiss
79
229
  */
80
230
 
81
231
  type PasskeyAccount = LocalAccount<"1auth"> & {
82
- /** Optional username hint retained for legacy integrations. */
83
- username?: string;
84
232
  /** Smart account address used as the canonical signer identity. */
85
233
  accountAddress: Address;
86
234
  };
@@ -98,7 +246,6 @@ type PasskeyAccount = LocalAccount<"1auth"> & {
98
246
  *
99
247
  * @param client - A configured `OneAuthClient` instance
100
248
  * @param params.address - The EVM address of the user's smart account
101
- * @param params.username - Optional 1auth username hint for older accounts
102
249
  * @returns A `PasskeyAccount` extending `LocalAccount<"1auth">`
103
250
  *
104
251
  * @example
@@ -123,7 +270,6 @@ type PasskeyAccount = LocalAccount<"1auth"> & {
123
270
  */
124
271
  declare function createPasskeyAccount(client: OneAuthClient, params: {
125
272
  address: Address;
126
- username?: string;
127
273
  }): PasskeyAccount;
128
274
 
129
275
  /**
@@ -159,7 +305,6 @@ type PasskeyWalletClient = WalletClient & {
159
305
  *
160
306
  * const walletClient = createPasskeyWalletClient({
161
307
  * accountAddress: '0x...',
162
- * username: 'alice',
163
308
  * providerUrl: 'https://passkey.1auth.app',
164
309
  * clientId: 'my-dapp',
165
310
  * chain: baseSepolia,
@@ -184,12 +329,10 @@ type PasskeyWalletClient = WalletClient & {
184
329
  */
185
330
  declare function createPasskeyWalletClient(config: PasskeyWalletClientConfig): PasskeyWalletClient;
186
331
 
187
- /** Identity used to sign a queued batch. Account address is the canonical path. */
332
+ /** Identity used to sign a queued batch. Account address is the sole identity. */
188
333
  interface BatchQueueIdentity {
189
- /** Optional username hint for legacy accounts. */
190
- username?: string;
191
334
  /** Smart account address of the signer. */
192
- accountAddress?: string;
335
+ accountAddress: string;
193
336
  }
194
337
  /**
195
338
  * A batched call in the queue
@@ -222,7 +365,7 @@ interface BatchQueueContextValue {
222
365
  removeFromBatch: (id: string) => void;
223
366
  /** Clear all calls from the batch */
224
367
  clearBatch: () => void;
225
- /** Sign and execute all batched calls */
368
+ /** Sign and execute all batched calls. A bare string is treated as the account address. */
226
369
  signAll: (identity?: string | BatchQueueIdentity) => Promise<SendIntentResult>;
227
370
  /** Whether the widget is expanded */
228
371
  isExpanded: boolean;
@@ -240,9 +383,7 @@ declare function useBatchQueue(): BatchQueueContextValue;
240
383
  interface BatchQueueProviderProps {
241
384
  /** The OneAuthClient instance */
242
385
  client: OneAuthClient;
243
- /** Optional username for legacy localStorage persistence and account lookup. */
244
- username?: string;
245
- /** Optional account address for address-only sessions and persistence. */
386
+ /** Account address for localStorage persistence and account lookup. */
246
387
  accountAddress?: string;
247
388
  /** Children to render */
248
389
  children: React.ReactNode;
@@ -250,7 +391,7 @@ interface BatchQueueProviderProps {
250
391
  /**
251
392
  * Provider component for the batch queue
252
393
  */
253
- declare function BatchQueueProvider({ client, username, accountAddress, children, }: BatchQueueProviderProps): react_jsx_runtime.JSX.Element;
394
+ declare function BatchQueueProvider({ client, accountAddress, children, }: BatchQueueProviderProps): react_jsx_runtime.JSX.Element;
254
395
 
255
396
  /**
256
397
  * @file Floating UI widget for the 1auth batch transaction queue.
@@ -285,8 +426,8 @@ interface BatchQueueWidgetProps {
285
426
  *
286
427
  * @param props.onSignAll - Called when the user clicks "Sign All". The
287
428
  * implementor is responsible for resolving the account identity and passing
288
- * it to `useBatchQueue().signAll({ accountAddress, username })`.
429
+ * it to `useBatchQueue().signAll({ accountAddress })`.
289
430
  */
290
431
  declare function BatchQueueWidget({ onSignAll }: BatchQueueWidgetProps): react_jsx_runtime.JSX.Element | null;
291
432
 
292
- export { type BatchQueueContextValue, type BatchQueueIdentity, BatchQueueProvider, type BatchQueueProviderProps, BatchQueueWidget, type BatchQueueWidgetProps, type BatchedCall, type DefinePermissionsConfig, type DefinedPermissions, IntentCall, OneAuthClient, type PasskeyAccount, type PasskeyWalletClient, PasskeyWalletClientConfig, SendCallsParams, SendIntentResult, createPasskeyAccount, createPasskeyWalletClient, definePermissions, getChainName, useBatchQueue };
433
+ 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 };
package/dist/index.d.ts CHANGED
@@ -1,12 +1,13 @@
1
- import { O as OneAuthClient } from './client-CuASptX3.js';
1
+ import { O as OneAuthClient } from './client-Dn6mL7BZ.js';
2
2
  import { Abi, Address, LocalAccount, WalletClient, Hash } from 'viem';
3
3
  import { Permission } from '@rhinestone/sdk';
4
4
  export { Permission } from '@rhinestone/sdk';
5
- import { h as IntentCall, i as SendIntentResult } from './types-C0jKNT_t.js';
6
- export { a7 as AssetBalance, a8 as AssetBalanceBucket, a9 as AssetsResponse, u as AuthFlow, A as AuthResult, v as AuthWithModalOptions, z as AuthenticateOptions, B as AuthenticateResult, R as BalanceRequirement, ap as BatchIntentItem, as as BatchIntentItemResult, ad as CheckConsentOptions, ae as CheckConsentResult, a0 as CloseOnStatus, y as ConnectResult, ac as ConsentData, ab as ConsentField, w as CreateAccountWithModalOptions, C as CreateCrossChainPermissionInput, r as CreateSigningRequestResponse, k as CrossChainPermit, l as CrossChainSettlementLayer, M as EIP712Domain, O as EIP712TypeField, N as EIP712Types, E as EmbedOptions, a2 as ExecuteIntentResponse, a6 as GetAssetsOptions, an as GrantPermissionContractMetadata, ah as GrantPermissionsOptions, ai as GrantPermissionsResult, a4 as IntentHistoryItem, a3 as IntentHistoryOptions, a5 as IntentHistoryResult, Z as IntentQuote, _ as IntentStatus, X as IntentTokenRequest, aj as ListSessionGrantsOptions, ak as ListSessionGrantsResult, L as LoginWithModalOptions, ax as OneAuthTelemetryAttributeValue, ay as OneAuthTelemetryAttributes, az as OneAuthTelemetryConfig, aA as OneAuthTelemetryEvent, aB as OneAuthTelemetryEventName, aC as OneAuthTelemetryFlow, aD as OneAuthTelemetryTraceContext, $ as OrchestratorStatus, t as PasskeyCredential, P as PasskeyProviderConfig, au as PrepareBatchIntentResponse, a1 as PrepareIntentResponse, at as PreparedBatchIntent, af as RequestConsentOptions, ag as RequestConsentResult, aq as SendBatchIntentOptions, ar as SendBatchIntentResult, Y as SendIntentOptions, am as SessionGrantChain, al as SessionGrantRecord, F as SignMessageOptions, G as SignMessageResult, J as SignTypedDataOptions, K as SignTypedDataResult, x as SignerType, p as SigningError, q as SigningErrorCode, m as SigningRequestOptions, s as SigningRequestStatus, n as SigningResult, D as SigningResultBase, o as SigningSuccess, ao as SmartSessionPolicy, av as SponsorshipCallbackConfig, S as SponsorshipConfig, aw as SponsorshipUrlConfig, aa as ThemeConfig, T as TransactionAction, V as TransactionDetails, Q as TransactionFees, U as UserPasskeysResponse, W as WebAuthnSignature, j as createCrossChainPermission } from './types-C0jKNT_t.js';
7
- export { O as OneAuthProvider, a as OneAuthProviderOptions, c as createOneAuthProvider } from './provider-6JoziYDq.js';
8
- import { P as PasskeyWalletClientConfig, S as SendCallsParams } from './verify-CnOwPq78.js';
9
- 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-CnOwPq78.js';
5
+ import { P as PasskeyProviderConfig, C as CloseOnStatus, T as ThemeConfig, h as SignerType, i as IntentCall, j as SendIntentResult } from './types-Dzm5lZK-.js';
6
+ export { a8 as AssetBalance, a9 as AssetBalanceBucket, aa as AssetsResponse, w as AuthFlow, A as AuthResult, x as AuthWithModalOptions, B as AuthenticateOptions, D as AuthenticateResult, X as BalanceRequirement, ap as BatchIntentItem, as as BatchIntentItemResult, ad as CheckConsentOptions, ae as CheckConsentResult, z as ConnectResult, ac as ConsentData, ab as ConsentField, y as CreateAccountWithModalOptions, l as CreateCrossChainPermissionInput, t as CreateSigningRequestResponse, m as CrossChainPermit, n as CrossChainSettlementLayer, N as EIP712Domain, Q as EIP712TypeField, O as EIP712Types, E as EmbedOptions, a3 as ExecuteIntentResponse, a7 as GetAssetsOptions, an as GrantPermissionContractMetadata, ah as GrantPermissionsOptions, ai as GrantPermissionsResult, a5 as IntentHistoryItem, a4 as IntentHistoryOptions, a6 as IntentHistoryResult, $ as IntentQuote, a0 as IntentStatus, Z as IntentTokenRequest, aj as ListSessionGrantsOptions, ak as ListSessionGrantsResult, L as LoginWithModalOptions, ax as OneAuthTelemetryAttributeValue, ay as OneAuthTelemetryAttributes, az as OneAuthTelemetryConfig, aA as OneAuthTelemetryEvent, aB as OneAuthTelemetryEventName, aC as OneAuthTelemetryFlow, aD as OneAuthTelemetryTraceContext, a1 as OrchestratorStatus, v as PasskeyCredential, au as PrepareBatchIntentResponse, a2 as PrepareIntentResponse, at as PreparedBatchIntent, af as RequestConsentOptions, ag as RequestConsentResult, aq as SendBatchIntentOptions, ar as SendBatchIntentResult, _ as SendIntentOptions, am as SessionGrantChain, al as SessionGrantRecord, G as SignMessageOptions, J as SignMessageResult, K as SignTypedDataOptions, M as SignTypedDataResult, r as SigningError, s as SigningErrorCode, o as SigningRequestOptions, u as SigningRequestStatus, p as SigningResult, F as SigningResultBase, q as SigningSuccess, ao as SmartSessionPolicy, av as SponsorshipCallbackConfig, S as SponsorshipConfig, aw as SponsorshipUrlConfig, R as TransactionAction, Y as TransactionDetails, V as TransactionFees, U as UserPasskeysResponse, W as WebAuthnSignature, k as createCrossChainPermission } from './types-Dzm5lZK-.js';
7
+ import { O as OneAuthProvider } from './provider-BsVmPgkQ.js';
8
+ export { a as OneAuthProviderOptions, c as createOneAuthProvider } from './provider-BsVmPgkQ.js';
9
+ import { P as PasskeyWalletClientConfig, S as SendCallsParams } from './verify-9UgxLSdo.js';
10
+ 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-9UgxLSdo.js';
10
11
  import * as react_jsx_runtime from 'react/jsx-runtime';
11
12
  import * as React from 'react';
12
13
 
@@ -67,6 +68,155 @@ interface DefinedPermissions<TAbi extends Abi = Abi> {
67
68
  */
68
69
  declare function definePermissions<const TAbi extends Abi>(config: DefinePermissionsConfig<TAbi>): DefinedPermissions<TAbi>;
69
70
 
71
+ /**
72
+ * One-call connect entry point for 1auth.
73
+ *
74
+ * `createOneAuthConnection` is the ergonomic front door for integrators who
75
+ * want a single function that:
76
+ * 1. opens the 1auth dialog so the user picks **1auth passkey** *or* a
77
+ * **traditional wallet** (WalletConnect / injected), and
78
+ * 2. hands back a ready-to-use EIP-1193 provider plus the connected
79
+ * `{ address, signerType }`.
80
+ *
81
+ * When the user picks a traditional wallet (an EOA), the returned provider
82
+ * forwards `eth_sendTransaction` / `personal_sign` / `signTypedData` /
83
+ * `wallet_sendCalls` straight to that wallet's native RPC — **no Rhinestone
84
+ * intents**. When they pick a passkey, transactions route through 1auth intents
85
+ * exactly as before. The app writes one downstream code path either way.
86
+ *
87
+ * This is purely additive: `OneAuthClient.connect()` and
88
+ * `createOneAuthProvider()` are unchanged and remain the lower-level building
89
+ * blocks this factory composes.
90
+ *
91
+ * @module
92
+ */
93
+
94
+ /**
95
+ * Provider-shaping options that apply on top of the passkey client config.
96
+ * Mirrors the relevant {@link createOneAuthProvider} options.
97
+ */
98
+ interface OneAuthConnectionOptions {
99
+ /**
100
+ * Chain the returned provider reports via `eth_chainId` and uses as the
101
+ * default intent target. Defaults to `8453` (Base). Ignored for EOA sessions
102
+ * beyond the reported chain id — an EOA transacts on whatever chain its
103
+ * wallet is on.
104
+ */
105
+ defaultChainId?: number;
106
+ /**
107
+ * localStorage key the session is persisted under. Defaults to `"1auth-user"`.
108
+ * Override only to run multiple independent connections on one origin.
109
+ */
110
+ storageKey?: string;
111
+ /** Forwarded to the provider for passkey intent sends. */
112
+ closeOn?: CloseOnStatus;
113
+ waitForHash?: boolean;
114
+ hashTimeoutMs?: number;
115
+ hashIntervalMs?: number;
116
+ /**
117
+ * Opt in to offering a **traditional wallet as the account signer**. When
118
+ * `true`, the dialog's wallet path connects the chosen EOA as the signer (a
119
+ * `signerType: "eoa"` session whose transactions bypass Rhinestone intents).
120
+ *
121
+ * **Defaults to `false`** — by default the app gets 1auth smart accounts +
122
+ * intents, and the wallet path (if the user picks it) still bootstraps a
123
+ * passkey account. Passkey selection is unaffected either way. Can be
124
+ * overridden per call via {@link OneAuthConnectOptions.eoaConnect}.
125
+ */
126
+ eoaConnect?: boolean;
127
+ }
128
+ /** Full config form: constructs the client for you. Only `clientId` is practically required. */
129
+ type OneAuthConnectionConfig = PasskeyProviderConfig & OneAuthConnectionOptions;
130
+ /** Reuse form: bring your own configured {@link OneAuthClient}. */
131
+ type OneAuthConnectionConfigWithClient = {
132
+ client: OneAuthClient;
133
+ } & OneAuthConnectionOptions;
134
+ /** Options accepted by {@link OneAuthConnection.connect}. */
135
+ interface OneAuthConnectOptions {
136
+ theme?: ThemeConfig;
137
+ /** Applies only to the auth-modal fallback path (email/OAuth entry). */
138
+ oauthEnabled?: boolean;
139
+ /**
140
+ * Per-call override of {@link OneAuthConnectionOptions.eoaConnect}. Defaults
141
+ * to the connection's config value (which itself defaults to `false`).
142
+ */
143
+ eoaConnect?: boolean;
144
+ }
145
+ /**
146
+ * The resolved session. Discriminated on `signerType` so callers can branch on
147
+ * EOA vs passkey with full type safety.
148
+ */
149
+ interface OneAuthSession {
150
+ /** `"eoa"` = traditional wallet (plain tx, no intents). `"passkey"` = 1auth smart account (intents). */
151
+ signerType: SignerType;
152
+ address: `0x${string}`;
153
+ /** The same {@link OneAuthProvider} instance exposed on the connection. */
154
+ provider: OneAuthProvider;
155
+ /** Chain id the provider reports (see {@link OneAuthConnectionOptions.defaultChainId}). */
156
+ chainId: number;
157
+ /** True when a returning user was reconnected with no visible UI. */
158
+ autoConnected: boolean;
159
+ }
160
+ /** Error thrown by {@link OneAuthConnection.connect} when the user cancels or auth fails. */
161
+ interface OneAuthConnectError {
162
+ code: string;
163
+ message: string;
164
+ }
165
+ /** The handle returned by {@link createOneAuthConnection}. */
166
+ interface OneAuthConnection {
167
+ /** The underlying client — escape hatch for `signMessage`, history, the account dialog, etc. */
168
+ client: OneAuthClient;
169
+ /** Ready-to-use EIP-1193 provider. Stable across reconnects. */
170
+ provider: OneAuthProvider;
171
+ /**
172
+ * Open the 1auth dialog so the user picks passkey OR a traditional wallet.
173
+ * Binds the resulting session to {@link OneAuthConnection.provider} before it
174
+ * resolves, so a send issued immediately after routes correctly.
175
+ *
176
+ * @throws {@link OneAuthConnectError} shape (`{ code, message }`) on cancel/failure.
177
+ */
178
+ connect: (options?: OneAuthConnectOptions) => Promise<OneAuthSession>;
179
+ /** Current session read from persisted state, or `null`. Never opens a dialog. */
180
+ getSession: () => OneAuthSession | null;
181
+ /** Clear the session and emit `accountsChanged([])` / `disconnect`. */
182
+ disconnect: () => Promise<void>;
183
+ /**
184
+ * Subscribe to session changes (connect/disconnect). Returns an unsubscribe
185
+ * function. Sugar over `provider.on("accountsChanged", …)`.
186
+ */
187
+ subscribe: (listener: (session: OneAuthSession | null) => void) => () => void;
188
+ }
189
+ /**
190
+ * Create a one-call 1auth connection.
191
+ *
192
+ * @example Zero-boilerplate
193
+ * ```typescript
194
+ * import { createOneAuthConnection } from "@rhinestone/1auth";
195
+ * import { createWalletClient, custom } from "viem";
196
+ * import { base } from "viem/chains";
197
+ *
198
+ * const conn = createOneAuthConnection({ clientId: "my-app" });
199
+ * const session = await conn.connect(); // user picks passkey OR wallet
200
+ *
201
+ * const walletClient = createWalletClient({
202
+ * account: session.address,
203
+ * chain: base,
204
+ * transport: custom(session.provider),
205
+ * });
206
+ * // Same call for both signer types; EOA bypasses intents, passkey uses them.
207
+ * await walletClient.sendTransaction({ to: "0x…", value: 1n });
208
+ * ```
209
+ *
210
+ * @example Reuse an existing client
211
+ * ```typescript
212
+ * const client = new OneAuthClient({ clientId: "my-app", sponsorship });
213
+ * const conn = createOneAuthConnection({ client, defaultChainId: 8453 });
214
+ * const { address, signerType, provider } = await conn.connect();
215
+ * ```
216
+ */
217
+ declare function createOneAuthConnection(config: OneAuthConnectionConfig): OneAuthConnection;
218
+ declare function createOneAuthConnection(config: OneAuthConnectionConfigWithClient): OneAuthConnection;
219
+
70
220
  /**
71
221
  * viem LocalAccount adapter for 1auth passkey-controlled smart accounts.
72
222
  *
@@ -79,8 +229,6 @@ declare function definePermissions<const TAbi extends Abi>(config: DefinePermiss
79
229
  */
80
230
 
81
231
  type PasskeyAccount = LocalAccount<"1auth"> & {
82
- /** Optional username hint retained for legacy integrations. */
83
- username?: string;
84
232
  /** Smart account address used as the canonical signer identity. */
85
233
  accountAddress: Address;
86
234
  };
@@ -98,7 +246,6 @@ type PasskeyAccount = LocalAccount<"1auth"> & {
98
246
  *
99
247
  * @param client - A configured `OneAuthClient` instance
100
248
  * @param params.address - The EVM address of the user's smart account
101
- * @param params.username - Optional 1auth username hint for older accounts
102
249
  * @returns A `PasskeyAccount` extending `LocalAccount<"1auth">`
103
250
  *
104
251
  * @example
@@ -123,7 +270,6 @@ type PasskeyAccount = LocalAccount<"1auth"> & {
123
270
  */
124
271
  declare function createPasskeyAccount(client: OneAuthClient, params: {
125
272
  address: Address;
126
- username?: string;
127
273
  }): PasskeyAccount;
128
274
 
129
275
  /**
@@ -159,7 +305,6 @@ type PasskeyWalletClient = WalletClient & {
159
305
  *
160
306
  * const walletClient = createPasskeyWalletClient({
161
307
  * accountAddress: '0x...',
162
- * username: 'alice',
163
308
  * providerUrl: 'https://passkey.1auth.app',
164
309
  * clientId: 'my-dapp',
165
310
  * chain: baseSepolia,
@@ -184,12 +329,10 @@ type PasskeyWalletClient = WalletClient & {
184
329
  */
185
330
  declare function createPasskeyWalletClient(config: PasskeyWalletClientConfig): PasskeyWalletClient;
186
331
 
187
- /** Identity used to sign a queued batch. Account address is the canonical path. */
332
+ /** Identity used to sign a queued batch. Account address is the sole identity. */
188
333
  interface BatchQueueIdentity {
189
- /** Optional username hint for legacy accounts. */
190
- username?: string;
191
334
  /** Smart account address of the signer. */
192
- accountAddress?: string;
335
+ accountAddress: string;
193
336
  }
194
337
  /**
195
338
  * A batched call in the queue
@@ -222,7 +365,7 @@ interface BatchQueueContextValue {
222
365
  removeFromBatch: (id: string) => void;
223
366
  /** Clear all calls from the batch */
224
367
  clearBatch: () => void;
225
- /** Sign and execute all batched calls */
368
+ /** Sign and execute all batched calls. A bare string is treated as the account address. */
226
369
  signAll: (identity?: string | BatchQueueIdentity) => Promise<SendIntentResult>;
227
370
  /** Whether the widget is expanded */
228
371
  isExpanded: boolean;
@@ -240,9 +383,7 @@ declare function useBatchQueue(): BatchQueueContextValue;
240
383
  interface BatchQueueProviderProps {
241
384
  /** The OneAuthClient instance */
242
385
  client: OneAuthClient;
243
- /** Optional username for legacy localStorage persistence and account lookup. */
244
- username?: string;
245
- /** Optional account address for address-only sessions and persistence. */
386
+ /** Account address for localStorage persistence and account lookup. */
246
387
  accountAddress?: string;
247
388
  /** Children to render */
248
389
  children: React.ReactNode;
@@ -250,7 +391,7 @@ interface BatchQueueProviderProps {
250
391
  /**
251
392
  * Provider component for the batch queue
252
393
  */
253
- declare function BatchQueueProvider({ client, username, accountAddress, children, }: BatchQueueProviderProps): react_jsx_runtime.JSX.Element;
394
+ declare function BatchQueueProvider({ client, accountAddress, children, }: BatchQueueProviderProps): react_jsx_runtime.JSX.Element;
254
395
 
255
396
  /**
256
397
  * @file Floating UI widget for the 1auth batch transaction queue.
@@ -285,8 +426,8 @@ interface BatchQueueWidgetProps {
285
426
  *
286
427
  * @param props.onSignAll - Called when the user clicks "Sign All". The
287
428
  * implementor is responsible for resolving the account identity and passing
288
- * it to `useBatchQueue().signAll({ accountAddress, username })`.
429
+ * it to `useBatchQueue().signAll({ accountAddress })`.
289
430
  */
290
431
  declare function BatchQueueWidget({ onSignAll }: BatchQueueWidgetProps): react_jsx_runtime.JSX.Element | null;
291
432
 
292
- export { type BatchQueueContextValue, type BatchQueueIdentity, BatchQueueProvider, type BatchQueueProviderProps, BatchQueueWidget, type BatchQueueWidgetProps, type BatchedCall, type DefinePermissionsConfig, type DefinedPermissions, IntentCall, OneAuthClient, type PasskeyAccount, type PasskeyWalletClient, PasskeyWalletClientConfig, SendCallsParams, SendIntentResult, createPasskeyAccount, createPasskeyWalletClient, definePermissions, getChainName, useBatchQueue };
433
+ 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 };