@rhinestone/1auth 0.1.0 → 0.1.2

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.
@@ -8,13 +8,13 @@ interface ThemeConfig {
8
8
  accent?: string;
9
9
  }
10
10
  interface PasskeyProviderConfig {
11
- /** Base URL of the auth API (Next.js server) */
12
- providerUrl: string;
13
- /** Client identifier for this application */
14
- clientId: string;
11
+ /** Base URL of the auth API. Defaults to https://passkey.1auth.box */
12
+ providerUrl?: string;
13
+ /** Client identifier for this application (optional for development) */
14
+ clientId?: string;
15
15
  /** Optional redirect URL for redirect flow */
16
16
  redirectUrl?: string;
17
- /** Optional URL of the dialog UI (Vite app). Defaults to providerUrl + /dialog */
17
+ /** Optional URL of the dialog UI. Defaults to providerUrl */
18
18
  dialogUrl?: string;
19
19
  /** Optional theme configuration for the dialog */
20
20
  theme?: ThemeConfig;
@@ -45,6 +45,22 @@ interface RegisterResult {
45
45
  message: string;
46
46
  };
47
47
  }
48
+ /**
49
+ * Result of the connect modal (lightweight connection without passkey auth)
50
+ */
51
+ interface ConnectResult {
52
+ success: boolean;
53
+ /** Username of the connected account */
54
+ username?: string;
55
+ /** Whether this was auto-connected (user had auto-connect enabled) */
56
+ autoConnected?: boolean;
57
+ /** Action to take when connection was not successful */
58
+ action?: "switch" | "cancel";
59
+ error?: {
60
+ code: string;
61
+ message: string;
62
+ };
63
+ }
48
64
  /**
49
65
  * Options for the authenticate() method
50
66
  */
@@ -77,7 +93,7 @@ interface AuthenticateResult {
77
93
  signature?: WebAuthnSignature;
78
94
  /**
79
95
  * The hash that was actually signed (so apps can verify server-side).
80
- * Computed as: keccak256("\x19Passkey Signed Message:\n" + len + challenge)
96
+ * Computed as: keccak256("\x19Ethereum Signed Message:\n" + len + challenge) (EIP-191)
81
97
  */
82
98
  signedHash?: `0x${string}`;
83
99
  error?: {
@@ -112,8 +128,8 @@ interface SignMessageResult {
112
128
  /** The message that was signed */
113
129
  signedMessage?: string;
114
130
  /**
115
- * The hash that was actually signed (with domain separator).
116
- * Computed as: keccak256("\x19Passkey Signed Message:\n" + len + message)
131
+ * The hash that was actually signed (EIP-191 format).
132
+ * Computed as: keccak256("\x19Ethereum Signed Message:\n" + len + message)
117
133
  * Use hashMessage() from the SDK to verify this matches your original message.
118
134
  */
119
135
  signedHash?: `0x${string}`;
@@ -186,8 +202,14 @@ interface PasskeyCredentials {
186
202
  interface SigningSuccess {
187
203
  success: true;
188
204
  requestId?: string;
189
- signature: WebAuthnSignature;
205
+ /** WebAuthn signature - present for message/typedData signing */
206
+ signature?: WebAuthnSignature;
207
+ /** Array of signatures for multi-origin cross-chain intents (one per source chain) */
208
+ originSignatures?: WebAuthnSignature[];
209
+ /** Credentials of the passkey used for signing - present for message/typedData signing */
190
210
  passkey?: PasskeyCredentials;
211
+ /** Intent ID - present for intent signing (after execute in dialog) */
212
+ intentId?: string;
191
213
  }
192
214
  type SigningErrorCode = "USER_REJECTED" | "EXPIRED" | "INVALID_REQUEST" | "NETWORK_ERROR" | "POPUP_BLOCKED" | "SIGNING_FAILED" | "UNKNOWN";
193
215
  interface EmbedOptions {
@@ -242,19 +264,21 @@ interface IntentCall {
242
264
  interface IntentTokenRequest {
243
265
  /** Token contract address */
244
266
  token: string;
245
- /** Amount (as string for serialization) */
246
- amount: string;
267
+ /** Amount in base units (use parseUnits for decimals) */
268
+ amount: bigint;
247
269
  }
248
270
  /**
249
- * A signed intent request from a merchant backend
250
- * This provides XSS protection by ensuring calls were constructed server-side
271
+ * A signed intent request from a backend.
272
+ * This provides XSS protection by ensuring calls were constructed server-side.
251
273
  */
252
- interface MerchantSignedIntent {
253
- /** Merchant ID (from seed/registration) */
254
- merchantId: string;
274
+ interface DeveloperSignedIntent {
275
+ /** Developer ID (clientId). Mapped to merchantId for the API. */
276
+ developerId?: string;
277
+ /** Wire field used by the API (same value as developerId) */
278
+ merchantId?: string;
255
279
  /** Target chain ID */
256
280
  targetChain: number;
257
- /** Calls to execute (signed by merchant) */
281
+ /** Calls to execute (signed by developer) */
258
282
  calls: IntentCall[];
259
283
  /** Username of the signer */
260
284
  username?: string;
@@ -271,6 +295,16 @@ interface MerchantSignedIntent {
271
295
  /** Optional token requests */
272
296
  tokenRequests?: IntentTokenRequest[];
273
297
  }
298
+ /** @deprecated Use DeveloperSignedIntent instead */
299
+ type MerchantSignedIntent = DeveloperSignedIntent;
300
+ type IntentSigner = (params: {
301
+ username: string;
302
+ accountAddress?: string;
303
+ targetChain: number;
304
+ calls: IntentCall[];
305
+ tokenRequests?: IntentTokenRequest[];
306
+ sourceAssets?: string[];
307
+ }) => Promise<DeveloperSignedIntent>;
274
308
  /**
275
309
  * Options for sendIntent
276
310
  */
@@ -289,13 +323,19 @@ interface SendIntentOptions {
289
323
  * Example: ['USDC'] or ['0x...'] to only use USDC as input.
290
324
  */
291
325
  sourceAssets?: string[];
326
+ /**
327
+ * Source chain ID for the assets.
328
+ * When specified with sourceAssets containing addresses, tells orchestrator
329
+ * which chain to look for those tokens on.
330
+ */
331
+ sourceChainId?: number;
292
332
  /** When to close the dialog and return success. Defaults to "preconfirmed" */
293
333
  closeOn?: CloseOnStatus;
294
334
  /**
295
- * Pre-signed intent from merchant backend (XSS protected)
335
+ * Pre-signed intent from developer backend (XSS protected)
296
336
  * If provided, username/targetChain/calls/tokenRequests are ignored
297
337
  */
298
- signedIntent?: MerchantSignedIntent;
338
+ signedIntent?: DeveloperSignedIntent;
299
339
  /**
300
340
  * Wait for a transaction hash before resolving.
301
341
  * Defaults to false to preserve existing behavior.
@@ -329,7 +369,7 @@ interface IntentQuote {
329
369
  /**
330
370
  * Status of an intent (local states)
331
371
  */
332
- type IntentStatus = "pending" | "quoted" | "signed" | "submitted" | "completed" | "failed" | "expired";
372
+ type IntentStatus = "pending" | "quoted" | "signed" | "submitted" | "claimed" | "preconfirmed" | "filled" | "completed" | "failed" | "expired" | "unknown";
333
373
  /**
334
374
  * Orchestrator status (from Rhinestone)
335
375
  * These are the statuses we can receive when polling
@@ -367,13 +407,25 @@ interface SendIntentResult {
367
407
  * Prepare intent response from auth service
368
408
  */
369
409
  interface PrepareIntentResponse {
370
- intentId: string;
371
410
  quote: IntentQuote;
372
411
  transaction: TransactionDetails;
373
412
  challenge: string;
374
413
  expiresAt: string;
375
414
  /** Account address for the sign dialog to detect self-transfer vs external send */
376
415
  accountAddress?: string;
416
+ /** Serialized PreparedTransactionData from orchestrator - needed for execute */
417
+ intentOp: string;
418
+ /** User ID for creating intent record on execute */
419
+ userId: string;
420
+ /** Target chain ID */
421
+ targetChain: number;
422
+ /** JSON stringified calls */
423
+ calls: string;
424
+ /** Origin message hashes for multi-source cross-chain intents */
425
+ originMessages?: Array<{
426
+ chainId: number;
427
+ messageHash: string;
428
+ }>;
377
429
  }
378
430
  /**
379
431
  * Execute intent response from auth service
@@ -384,6 +436,8 @@ interface ExecuteIntentResponse {
384
436
  operationId?: string;
385
437
  status: IntentStatus;
386
438
  transactionHash?: string;
439
+ /** Transaction result data needed for waiting via POST /api/intent/wait */
440
+ transactionResult?: unknown;
387
441
  error?: {
388
442
  code: string;
389
443
  message: string;
@@ -397,8 +451,8 @@ interface SendSwapOptions {
397
451
  username: string;
398
452
  /** Target chain ID where swap executes */
399
453
  targetChain: number;
400
- /** Token to swap from (address or supported symbol like 'ETH', 'USDC') */
401
- fromToken: string;
454
+ /** Token to swap from (address or supported symbol like 'ETH', 'USDC'). Omit to let the orchestrator pick. */
455
+ fromToken?: string;
402
456
  /** Token to swap to (address or supported symbol) */
403
457
  toToken: string;
404
458
  /** Amount to swap in human-readable format (e.g., "0.1") */
@@ -410,6 +464,11 @@ interface SendSwapOptions {
410
464
  * This constrains which tokens the orchestrator can use as input.
411
465
  */
412
466
  sourceAssets?: string[];
467
+ /**
468
+ * Source chain ID for the assets. When specified, the orchestrator will only
469
+ * look for source assets on this specific chain.
470
+ */
471
+ sourceChainId?: number;
413
472
  /** When to close the dialog. Defaults to "preconfirmed" */
414
473
  closeOn?: CloseOnStatus;
415
474
  /** Wait for a transaction hash before resolving. */
@@ -423,8 +482,8 @@ interface SendSwapOptions {
423
482
  * Quote information from DEX aggregator
424
483
  */
425
484
  interface SwapQuote {
426
- /** Token being sold */
427
- fromToken: string;
485
+ /** Token being sold (undefined when orchestrator picks) */
486
+ fromToken?: string;
428
487
  /** Token being bought */
429
488
  toToken: string;
430
489
  /** Amount of fromToken being sold */
@@ -509,8 +568,149 @@ interface SignTypedDataResult {
509
568
  message: string;
510
569
  };
511
570
  }
571
+ /**
572
+ * Options for querying intent history
573
+ */
574
+ interface IntentHistoryOptions {
575
+ /** Maximum number of intents to return (default: 50, max: 100) */
576
+ limit?: number;
577
+ /** Number of intents to skip for pagination */
578
+ offset?: number;
579
+ /** Filter by intent status */
580
+ status?: IntentStatus;
581
+ /** Filter by creation date (ISO string) - intents created on or after this date */
582
+ from?: string;
583
+ /** Filter by creation date (ISO string) - intents created on or before this date */
584
+ to?: string;
585
+ }
586
+ /**
587
+ * Single intent item in history response
588
+ */
589
+ interface IntentHistoryItem {
590
+ /** Intent identifier (orchestrator's ID, used as primary key) */
591
+ intentId: string;
592
+ /** Current status of the intent */
593
+ status: IntentStatus;
594
+ /** Transaction hash (if completed) */
595
+ transactionHash?: string;
596
+ /** Target chain ID */
597
+ targetChain: number;
598
+ /** Calls that were executed */
599
+ calls: IntentCall[];
600
+ /** When the intent was created (ISO string) */
601
+ createdAt: string;
602
+ /** When the intent was last updated (ISO string) */
603
+ updatedAt: string;
604
+ }
605
+ /**
606
+ * Result of getIntentHistory
607
+ */
608
+ interface IntentHistoryResult {
609
+ /** List of intents */
610
+ intents: IntentHistoryItem[];
611
+ /** Total count of matching intents */
612
+ total: number;
613
+ /** Whether there are more intents beyond this page */
614
+ hasMore: boolean;
615
+ }
616
+ /**
617
+ * A single intent within a batch
618
+ */
619
+ interface BatchIntentItem {
620
+ /** Target chain ID */
621
+ targetChain: number;
622
+ /** Calls to execute on the target chain */
623
+ calls: IntentCall[];
624
+ /** Optional token requests */
625
+ tokenRequests?: IntentTokenRequest[];
626
+ /** Constrain which tokens can be used as input */
627
+ sourceAssets?: string[];
628
+ /** Source chain ID for the assets */
629
+ sourceChainId?: number;
630
+ }
631
+ /**
632
+ * Options for sendBatchIntent
633
+ */
634
+ interface SendBatchIntentOptions {
635
+ /** Username of the signer */
636
+ username: string;
637
+ /** Array of intents to execute as a batch */
638
+ intents: BatchIntentItem[];
639
+ /** When to close the dialog for each intent. Defaults to "preconfirmed" */
640
+ closeOn?: CloseOnStatus;
641
+ }
642
+ /**
643
+ * Result for a single intent within a batch
644
+ */
645
+ interface BatchIntentItemResult {
646
+ /** Index in the original batch */
647
+ index: number;
648
+ /** Whether this intent succeeded */
649
+ success: boolean;
650
+ /** Intent ID from orchestrator */
651
+ intentId: string;
652
+ /** Current status */
653
+ status: IntentStatus;
654
+ /** Error details if failed */
655
+ error?: {
656
+ code: string;
657
+ message: string;
658
+ };
659
+ }
660
+ /**
661
+ * Result of sendBatchIntent
662
+ */
663
+ interface SendBatchIntentResult {
664
+ /** Whether ALL intents succeeded */
665
+ success: boolean;
666
+ /** Per-intent results */
667
+ results: BatchIntentItemResult[];
668
+ /** Count of successful intents */
669
+ successCount: number;
670
+ /** Count of failed intents */
671
+ failureCount: number;
672
+ }
673
+ /**
674
+ * Prepared intent data within a batch response
675
+ */
676
+ interface PreparedBatchIntent {
677
+ /** Index in the original batch */
678
+ index: number;
679
+ /** Quote from orchestrator */
680
+ quote: IntentQuote;
681
+ /** Decoded transaction details for UI */
682
+ transaction: TransactionDetails;
683
+ /** Serialized PreparedTransactionData from orchestrator */
684
+ intentOp: string;
685
+ /** Expiry for this specific intent */
686
+ expiresAt: string;
687
+ /** Target chain ID */
688
+ targetChain: number;
689
+ /** JSON stringified calls */
690
+ calls: string;
691
+ /** Origin message hashes for this intent */
692
+ originMessages: Array<{
693
+ chainId: number;
694
+ messageHash: string;
695
+ }>;
696
+ }
697
+ /**
698
+ * Prepare batch intent response from auth service
699
+ */
700
+ interface PrepareBatchIntentResponse {
701
+ /** Per-intent prepared data */
702
+ intents: PreparedBatchIntent[];
703
+ /** Shared challenge (merkle root of ALL origin hashes across ALL intents) */
704
+ challenge: string;
705
+ /** User ID */
706
+ userId: string;
707
+ /** Account address */
708
+ accountAddress?: string;
709
+ /** Global expiry (earliest of all intent expiries) */
710
+ expiresAt: string;
711
+ }
512
712
 
513
- declare class PasskeyProviderClient {
713
+ declare class OneAuthClient {
514
714
  private config;
515
715
  private theme;
516
716
  constructor(config: PasskeyProviderConfig);
@@ -539,18 +739,41 @@ declare class PasskeyProviderClient {
539
739
  /**
540
740
  * Get the configured client ID
541
741
  */
542
- getClientId(): string;
742
+ getClientId(): string | undefined;
543
743
  private waitForTransactionHash;
544
744
  /**
545
- * Show Porto-style "Get started" auth dialog (combines sign in + sign up)
546
- * This is the recommended method for authentication - shows a modal overlay
547
- * with both sign in and create account options.
745
+ * Open the auth dialog (sign in + sign up).
548
746
  */
549
747
  authWithModal(options?: {
550
748
  username?: string;
551
749
  theme?: ThemeConfig;
552
750
  oauthEnabled?: boolean;
553
751
  }): Promise<LoginResult | RegisterResult>;
752
+ /**
753
+ * Open the connect dialog (lightweight connection without passkey auth).
754
+ *
755
+ * This method shows a simple connection confirmation dialog that doesn't
756
+ * require a passkey signature. Users can optionally enable "auto-connect"
757
+ * to skip this dialog in the future.
758
+ *
759
+ * If the user has never connected before, this will return action: "switch"
760
+ * to indicate that the full auth modal should be opened instead.
761
+ *
762
+ * @example
763
+ * ```typescript
764
+ * const result = await client.connectWithModal();
765
+ *
766
+ * if (result.success) {
767
+ * console.log('Connected as:', result.username);
768
+ * } else if (result.action === 'switch') {
769
+ * // User needs to sign in first
770
+ * const authResult = await client.authWithModal();
771
+ * }
772
+ * ```
773
+ */
774
+ connectWithModal(options?: {
775
+ theme?: ThemeConfig;
776
+ }): Promise<ConnectResult>;
554
777
  /**
555
778
  * Authenticate a user with an optional challenge to sign.
556
779
  *
@@ -587,7 +810,7 @@ declare class PasskeyProviderClient {
587
810
  theme?: ThemeConfig;
588
811
  }): Promise<AuthenticateResult>;
589
812
  /**
590
- * Show signing in a modal overlay (Porto-style iframe dialog)
813
+ * Show signing in a modal overlay (iframe dialog)
591
814
  */
592
815
  signWithModal(options: SigningRequestOptions & {
593
816
  theme?: ThemeConfig;
@@ -622,6 +845,34 @@ declare class PasskeyProviderClient {
622
845
  * ```
623
846
  */
624
847
  sendIntent(options: SendIntentOptions): Promise<SendIntentResult>;
848
+ /**
849
+ * Send a batch of intents for multi-chain execution with a single passkey tap.
850
+ *
851
+ * This method prepares multiple intents, shows a paginated review,
852
+ * and signs all intents with a single passkey tap via a shared merkle tree.
853
+ *
854
+ * @example
855
+ * ```typescript
856
+ * const result = await client.sendBatchIntent({
857
+ * username: 'alice',
858
+ * intents: [
859
+ * {
860
+ * targetChain: 8453, // Base
861
+ * calls: [{ to: '0x...', data: '0x...', label: 'Swap on Base' }],
862
+ * },
863
+ * {
864
+ * targetChain: 42161, // Arbitrum
865
+ * calls: [{ to: '0x...', data: '0x...', label: 'Mint on Arbitrum' }],
866
+ * },
867
+ * ],
868
+ * });
869
+ *
870
+ * if (result.success) {
871
+ * console.log(`${result.successCount} intents submitted`);
872
+ * }
873
+ * ```
874
+ */
875
+ sendBatchIntent(options: SendBatchIntentOptions): Promise<SendBatchIntentResult>;
625
876
  /**
626
877
  * Send transaction status to the dialog iframe
627
878
  */
@@ -634,6 +885,11 @@ declare class PasskeyProviderClient {
634
885
  * Wait for signing result (simplified - no requestId matching)
635
886
  */
636
887
  private waitForSigningResponse;
888
+ /**
889
+ * Wait for signing result with auto-refresh support
890
+ * This method handles both signing results and quote refresh requests from the dialog
891
+ */
892
+ private waitForSigningWithRefresh;
637
893
  /**
638
894
  * Wait for the dialog to be closed
639
895
  */
@@ -645,6 +901,26 @@ declare class PasskeyProviderClient {
645
901
  * that hasn't completed yet.
646
902
  */
647
903
  getIntentStatus(intentId: string): Promise<SendIntentResult>;
904
+ /**
905
+ * Get the history of intents for the authenticated user.
906
+ *
907
+ * Requires an active session (user must be logged in).
908
+ *
909
+ * @example
910
+ * ```typescript
911
+ * // Get recent intents
912
+ * const history = await client.getIntentHistory({ limit: 10 });
913
+ *
914
+ * // Filter by status
915
+ * const pending = await client.getIntentHistory({ status: 'pending' });
916
+ *
917
+ * // Filter by date range
918
+ * const lastWeek = await client.getIntentHistory({
919
+ * from: new Date(Date.now() - 7 * 24 * 60 * 60 * 1000).toISOString(),
920
+ * });
921
+ * ```
922
+ */
923
+ getIntentHistory(options?: IntentHistoryOptions): Promise<IntentHistoryResult>;
648
924
  /**
649
925
  * Send a swap intent through the Rhinestone orchestrator
650
926
  *
@@ -764,14 +1040,26 @@ declare class PasskeyProviderClient {
764
1040
  private createSigningRequest;
765
1041
  private openPopup;
766
1042
  /**
767
- * Create a modal dialog with an iframe inside (Porto-style overlay)
1043
+ * Wait for the dialog iframe to signal ready, then send init data.
1044
+ * Also handles early close (X button, escape, backdrop) during the ready phase.
1045
+ * Returns true if dialog is ready, false if it was closed before becoming ready.
1046
+ */
1047
+ private waitForDialogReady;
1048
+ /**
1049
+ * Create a modal dialog with an iframe inside.
768
1050
  */
769
1051
  private createModalDialog;
770
1052
  private waitForModalAuthResponse;
1053
+ /**
1054
+ * Open a popup for auth and wait for the result.
1055
+ * Used when iframe mode fails (e.g., due to password manager interference).
1056
+ */
1057
+ private waitForPopupAuthResponse;
771
1058
  private waitForAuthenticateResponse;
1059
+ private waitForConnectResponse;
772
1060
  private waitForModalSigningResponse;
773
1061
  private waitForPopupResponse;
774
1062
  private fetchSigningResult;
775
1063
  }
776
1064
 
777
- export { type AuthenticateOptions as A, type BalanceRequirement as B, type CreateSigningRequestResponse as C, type ExecuteIntentResponse as D, type EmbedOptions as E, type SendSwapOptions as F, type SendSwapResult as G, type SwapQuote as H, type IntentCall as I, type ThemeConfig as J, type LoginOptions as L, type MerchantSignedIntent as M, type OrchestratorStatus as O, PasskeyProviderClient as P, type RegisterOptions as R, type SendIntentResult as S, type TransactionAction as T, type UserPasskeysResponse as U, type WebAuthnSignature as W, type PasskeyProviderConfig as a, type SigningRequestOptions as b, type SigningResult as c, type SigningSuccess as d, type SigningError as e, type SigningErrorCode as f, type SigningRequestStatus as g, type PasskeyCredential as h, type RegisterResult as i, type LoginResult as j, type AuthenticateResult as k, type SignMessageOptions as l, type SignMessageResult as m, type SignTypedDataOptions as n, type SignTypedDataResult as o, type EIP712Domain as p, type EIP712Types as q, type EIP712TypeField as r, type TransactionFees as s, type TransactionDetails as t, type IntentTokenRequest as u, type SendIntentOptions as v, type IntentQuote as w, type IntentStatus as x, type CloseOnStatus as y, type PrepareIntentResponse as z };
1065
+ export { type TransactionAction as $, type AuthenticateOptions as A, type BalanceRequirement as B, type CloseOnStatus as C, type DeveloperSignedIntent as D, type EIP712Domain as E, type SendSwapOptions as F, type SendSwapResult as G, type SignMessageOptions as H, type IntentSigner as I, type SignMessageResult as J, type SignTypedDataOptions as K, type LoginOptions as L, type MerchantSignedIntent as M, type SignTypedDataResult as N, OneAuthClient as O, type PasskeyCredential as P, type SigningError as Q, type RegisterOptions as R, type SendIntentResult as S, type SigningErrorCode as T, type SigningRequestOptions as U, type SigningRequestStatus as V, type WebAuthnSignature as W, type SigningResult as X, type SigningSuccess as Y, type SwapQuote as Z, type ThemeConfig as _, type IntentCall as a, type TransactionDetails as a0, type TransactionFees as a1, type UserPasskeysResponse as a2, type AuthenticateResult as b, type BatchIntentItem as c, type BatchIntentItemResult as d, type ConnectResult as e, type CreateSigningRequestResponse as f, type EIP712TypeField as g, type EIP712Types as h, type EmbedOptions as i, type ExecuteIntentResponse as j, type IntentHistoryItem as k, type IntentHistoryOptions as l, type IntentHistoryResult as m, type IntentQuote as n, type IntentStatus as o, type IntentTokenRequest as p, type LoginResult as q, type OrchestratorStatus as r, type PasskeyProviderConfig as s, type PrepareBatchIntentResponse as t, type PrepareIntentResponse as u, type PreparedBatchIntent as v, type RegisterResult as w, type SendBatchIntentOptions as x, type SendBatchIntentResult as y, type SendIntentOptions as z };
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
- import { P as PasskeyProviderClient, W as WebAuthnSignature, I as IntentCall, S as SendIntentResult } from './client-C1inywuT.mjs';
2
- export { A as AuthenticateOptions, k as AuthenticateResult, B as BalanceRequirement, y as CloseOnStatus, C as CreateSigningRequestResponse, p as EIP712Domain, r as EIP712TypeField, q as EIP712Types, E as EmbedOptions, D as ExecuteIntentResponse, w as IntentQuote, x as IntentStatus, u as IntentTokenRequest, L as LoginOptions, j as LoginResult, M as MerchantSignedIntent, O as OrchestratorStatus, h as PasskeyCredential, a as PasskeyProviderConfig, z as PrepareIntentResponse, R as RegisterOptions, i as RegisterResult, v as SendIntentOptions, F as SendSwapOptions, G as SendSwapResult, l as SignMessageOptions, m as SignMessageResult, n as SignTypedDataOptions, o as SignTypedDataResult, e as SigningError, f as SigningErrorCode, b as SigningRequestOptions, g as SigningRequestStatus, c as SigningResult, d as SigningSuccess, H as SwapQuote, J as ThemeConfig, T as TransactionAction, t as TransactionDetails, s as TransactionFees, U as UserPasskeysResponse } from './client-C1inywuT.mjs';
3
- export { P as PasskeyProvider, a as PasskeyProviderOptions, c as createPasskeyProvider } from './provider-Dgh51NRc.mjs';
4
- import { Address, LocalAccount, Chain, Transport, Hex, WalletClient, Hash } from 'viem';
1
+ import { O as OneAuthClient, I as IntentSigner, W as WebAuthnSignature, a as IntentCall, S as SendIntentResult } from './client-DyYGKWj3.mjs';
2
+ export { A as AuthenticateOptions, b as AuthenticateResult, B as BalanceRequirement, c as BatchIntentItem, d as BatchIntentItemResult, C as CloseOnStatus, e as ConnectResult, f as CreateSigningRequestResponse, D as DeveloperSignedIntent, E as EIP712Domain, g as EIP712TypeField, h as EIP712Types, i as EmbedOptions, j as ExecuteIntentResponse, k as IntentHistoryItem, l as IntentHistoryOptions, m as IntentHistoryResult, n as IntentQuote, o as IntentStatus, p as IntentTokenRequest, L as LoginOptions, q as LoginResult, M as MerchantSignedIntent, r as OrchestratorStatus, P as PasskeyCredential, s as PasskeyProviderConfig, t as PrepareBatchIntentResponse, u as PrepareIntentResponse, v as PreparedBatchIntent, R as RegisterOptions, w as RegisterResult, x as SendBatchIntentOptions, y as SendBatchIntentResult, z as SendIntentOptions, F as SendSwapOptions, G as SendSwapResult, H as SignMessageOptions, J as SignMessageResult, K as SignTypedDataOptions, N as SignTypedDataResult, Q as SigningError, T as SigningErrorCode, U as SigningRequestOptions, V as SigningRequestStatus, X as SigningResult, Y as SigningSuccess, Z as SwapQuote, _ as ThemeConfig, $ as TransactionAction, a0 as TransactionDetails, a1 as TransactionFees, a2 as UserPasskeysResponse } from './client-DyYGKWj3.mjs';
3
+ export { O as OneAuthProvider, a as OneAuthProviderOptions, P as PasskeyProvider, b as PasskeyProviderOptions, c as createOneAuthProvider, d as createPasskeyProvider } from './provider-Ctr7HQHR.mjs';
4
+ import { LocalAccount, Address, Hex, Chain, Transport, WalletClient, Hash } from 'viem';
5
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
6
  import * as React from 'react';
7
7
  export { getTokenAddress, getTokenDecimals } from '@rhinestone/sdk';
@@ -9,7 +9,7 @@ export { getTokenAddress, getTokenDecimals } from '@rhinestone/sdk';
9
9
  type PasskeyAccount = LocalAccount<"1auth"> & {
10
10
  username: string;
11
11
  };
12
- declare function createPasskeyAccount(client: PasskeyProviderClient, params: {
12
+ declare function createPasskeyAccount(client: OneAuthClient, params: {
13
13
  address: Address;
14
14
  username: string;
15
15
  }): PasskeyAccount;
@@ -22,12 +22,14 @@ interface PasskeyWalletClientConfig {
22
22
  accountAddress: Address;
23
23
  /** Username for the passkey provider */
24
24
  username: string;
25
- /** Base URL of the auth API */
26
- providerUrl: string;
25
+ /** Base URL of the auth API (defaults to https://passkey.1auth.box) */
26
+ providerUrl?: string;
27
27
  /** Client identifier for this application */
28
28
  clientId: string;
29
29
  /** Optional URL of the dialog UI */
30
30
  dialogUrl?: string;
31
+ /** Optional signer for developer-protected intents */
32
+ signIntent?: IntentSigner;
31
33
  /** Chain configuration */
32
34
  chain: Chain;
33
35
  /** Transport (e.g., http(), webSocket()) */
@@ -60,6 +62,13 @@ interface TransactionCall {
60
62
  interface SendCallsParams {
61
63
  /** Array of calls to execute */
62
64
  calls: TransactionCall[];
65
+ /** Optional chain id override */
66
+ chainId?: number;
67
+ /** Optional token requests for orchestrator output (what tokens/amounts to deliver) */
68
+ tokenRequests?: {
69
+ token: string;
70
+ amount: bigint;
71
+ }[];
63
72
  }
64
73
 
65
74
  /**
@@ -99,7 +108,7 @@ type PasskeyWalletClient = WalletClient & {
99
108
  * const walletClient = createPasskeyWalletClient({
100
109
  * accountAddress: '0x...',
101
110
  * username: 'alice',
102
- * providerUrl: 'https://auth.example.com',
111
+ * providerUrl: 'https://passkey.1auth.box',
103
112
  * clientId: 'my-dapp',
104
113
  * chain: baseSepolia,
105
114
  * transport: http(),
@@ -170,8 +179,8 @@ interface BatchQueueContextValue {
170
179
  */
171
180
  declare function useBatchQueue(): BatchQueueContextValue;
172
181
  interface BatchQueueProviderProps {
173
- /** The PasskeyProviderClient instance */
174
- client: PasskeyProviderClient;
182
+ /** The OneAuthClient instance */
183
+ client: OneAuthClient;
175
184
  /** Optional username for localStorage persistence key */
176
185
  username?: string;
177
186
  /** Children to render */
@@ -219,18 +228,22 @@ declare function getTokenSymbol(tokenAddress: Address, chainId: number): string;
219
228
  declare function isTokenAddressSupported(tokenAddress: Address, chainId: number): boolean;
220
229
 
221
230
  /**
222
- * The domain separator prefix used for passkey message signing.
223
- * This ensures message signatures cannot be replayed for transaction signing.
231
+ * The EIP-191 prefix used for personal message signing.
232
+ * This is the standard Ethereum message prefix for `personal_sign`.
224
233
  */
225
- declare const PASSKEY_MESSAGE_PREFIX = "\u0019Passkey Signed Message:\n";
234
+ declare const ETHEREUM_MESSAGE_PREFIX = "\u0019Ethereum Signed Message:\n";
226
235
  /**
227
- * Hash a message with the passkey domain separator.
236
+ * @deprecated Use ETHEREUM_MESSAGE_PREFIX instead. Kept for backwards compatibility.
237
+ */
238
+ declare const PASSKEY_MESSAGE_PREFIX = "\u0019Ethereum Signed Message:\n";
239
+ /**
240
+ * Hash a message with the EIP-191 Ethereum prefix.
228
241
  *
229
242
  * This is the same hashing function used by the passkey sign dialog.
230
243
  * Use this to verify that the `signedHash` returned from `signMessage()`
231
244
  * matches your original message.
232
245
  *
233
- * Format: keccak256("\x19Passkey Signed Message:\n" + len + message)
246
+ * Format: keccak256("\x19Ethereum Signed Message:\n" + len + message)
234
247
  *
235
248
  * @example
236
249
  * ```typescript
@@ -264,4 +277,4 @@ declare function hashMessage(message: string): `0x${string}`;
264
277
  */
265
278
  declare function verifyMessageHash(message: string, signedHash: string | undefined): boolean;
266
279
 
267
- export { type BatchQueueContextValue, BatchQueueProvider, type BatchQueueProviderProps, BatchQueueWidget, type BatchQueueWidgetProps, type BatchedCall, type ChainFilterOptions, IntentCall, PASSKEY_MESSAGE_PREFIX, type PasskeyAccount, PasskeyProviderClient, type PasskeyWalletClient, type PasskeyWalletClientConfig, type SendCallsParams, SendIntentResult, type TokenConfig, type TransactionCall, WebAuthnSignature, createPasskeyAccount, createPasskeyWalletClient, encodeWebAuthnSignature, getAllSupportedChainsAndTokens, getChainById, getChainExplorerUrl, getChainName, getChainRpcUrl, getSupportedChainIds, getSupportedChains, getSupportedTokenSymbols, getSupportedTokens, getTokenSymbol, hashCalls, hashMessage, isTestnet, isTokenAddressSupported, resolveTokenAddress, useBatchQueue, verifyMessageHash };
280
+ export { type BatchQueueContextValue, BatchQueueProvider, type BatchQueueProviderProps, BatchQueueWidget, type BatchQueueWidgetProps, type BatchedCall, type ChainFilterOptions, ETHEREUM_MESSAGE_PREFIX, IntentCall, IntentSigner, OneAuthClient, PASSKEY_MESSAGE_PREFIX, type PasskeyAccount, OneAuthClient as PasskeyProviderClient, type PasskeyWalletClient, type PasskeyWalletClientConfig, type SendCallsParams, SendIntentResult, type TokenConfig, type TransactionCall, WebAuthnSignature, createPasskeyAccount, createPasskeyWalletClient, encodeWebAuthnSignature, getAllSupportedChainsAndTokens, getChainById, getChainExplorerUrl, getChainName, getChainRpcUrl, getSupportedChainIds, getSupportedChains, getSupportedTokenSymbols, getSupportedTokens, getTokenSymbol, hashCalls, hashMessage, isTestnet, isTokenAddressSupported, resolveTokenAddress, useBatchQueue, verifyMessageHash };