@rhinestone/1auth 0.1.1 → 0.4.0
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.
- package/README.md +130 -0
- package/dist/{chunk-U7KZ4XMQ.mjs → chunk-X73ALCGW.mjs} +202 -36
- package/dist/chunk-X73ALCGW.mjs.map +1 -0
- package/dist/{client-B-HGKKaJ.d.mts → client-DKuPEx83.d.mts} +462 -27
- package/dist/{client-B-HGKKaJ.d.ts → client-DKuPEx83.d.ts} +462 -27
- package/dist/index.d.mts +19 -10
- package/dist/index.d.ts +19 -10
- package/dist/index.js +1417 -282
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1235 -266
- package/dist/index.mjs.map +1 -1
- package/dist/provider-CmJarV7y.d.mts +33 -0
- package/dist/provider-Dj5l4bWn.d.ts +33 -0
- package/dist/react.d.mts +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/react.js +16 -9
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +16 -9
- package/dist/react.mjs.map +1 -1
- package/dist/wagmi.d.mts +3 -3
- package/dist/wagmi.d.ts +3 -3
- package/dist/wagmi.js +193 -37
- package/dist/wagmi.js.map +1 -1
- package/dist/wagmi.mjs +1 -1
- package/package.json +19 -5
- package/dist/chunk-U7KZ4XMQ.mjs.map +0 -1
- package/dist/provider-CDIRlA4y.d.mts +0 -25
- package/dist/provider-Cy1StrOe.d.ts +0 -25
|
@@ -10,8 +10,8 @@ interface ThemeConfig {
|
|
|
10
10
|
interface PasskeyProviderConfig {
|
|
11
11
|
/** Base URL of the auth API. Defaults to https://passkey.1auth.box */
|
|
12
12
|
providerUrl?: string;
|
|
13
|
-
/** Client identifier for this application */
|
|
14
|
-
clientId
|
|
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
17
|
/** Optional URL of the dialog UI. Defaults to providerUrl */
|
|
@@ -25,6 +25,7 @@ interface LoginOptions {
|
|
|
25
25
|
interface LoginResult {
|
|
26
26
|
success: boolean;
|
|
27
27
|
username?: string;
|
|
28
|
+
address?: string;
|
|
28
29
|
user?: {
|
|
29
30
|
id: string;
|
|
30
31
|
username: string;
|
|
@@ -40,6 +41,25 @@ interface RegisterOptions {
|
|
|
40
41
|
interface RegisterResult {
|
|
41
42
|
success: boolean;
|
|
42
43
|
username?: string;
|
|
44
|
+
address?: string;
|
|
45
|
+
error?: {
|
|
46
|
+
code: string;
|
|
47
|
+
message: string;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Result of the connect modal (lightweight connection without passkey auth)
|
|
52
|
+
*/
|
|
53
|
+
interface ConnectResult {
|
|
54
|
+
success: boolean;
|
|
55
|
+
/** Username of the connected account */
|
|
56
|
+
username?: string;
|
|
57
|
+
/** Account address */
|
|
58
|
+
address?: string;
|
|
59
|
+
/** Whether this was auto-connected (user had auto-connect enabled) */
|
|
60
|
+
autoConnected?: boolean;
|
|
61
|
+
/** Action to take when connection was not successful */
|
|
62
|
+
action?: "switch" | "cancel";
|
|
43
63
|
error?: {
|
|
44
64
|
code: string;
|
|
45
65
|
message: string;
|
|
@@ -77,7 +97,7 @@ interface AuthenticateResult {
|
|
|
77
97
|
signature?: WebAuthnSignature;
|
|
78
98
|
/**
|
|
79
99
|
* The hash that was actually signed (so apps can verify server-side).
|
|
80
|
-
* Computed as: keccak256("\
|
|
100
|
+
* Computed as: keccak256("\x19Ethereum Signed Message:\n" + len + challenge) (EIP-191)
|
|
81
101
|
*/
|
|
82
102
|
signedHash?: `0x${string}`;
|
|
83
103
|
error?: {
|
|
@@ -89,8 +109,10 @@ interface AuthenticateResult {
|
|
|
89
109
|
* Options for signMessage
|
|
90
110
|
*/
|
|
91
111
|
interface SignMessageOptions {
|
|
92
|
-
/** Username of the signer */
|
|
93
|
-
username
|
|
112
|
+
/** Username of the signer (required if accountAddress is not provided) */
|
|
113
|
+
username?: string;
|
|
114
|
+
/** Account address of the signer (alternative to username) */
|
|
115
|
+
accountAddress?: string;
|
|
94
116
|
/** Human-readable message to sign */
|
|
95
117
|
message: string;
|
|
96
118
|
/** Optional custom challenge (defaults to message hash) */
|
|
@@ -112,8 +134,8 @@ interface SignMessageResult {
|
|
|
112
134
|
/** The message that was signed */
|
|
113
135
|
signedMessage?: string;
|
|
114
136
|
/**
|
|
115
|
-
* The hash that was actually signed (
|
|
116
|
-
* Computed as: keccak256("\
|
|
137
|
+
* The hash that was actually signed (EIP-191 format).
|
|
138
|
+
* Computed as: keccak256("\x19Ethereum Signed Message:\n" + len + message)
|
|
117
139
|
* Use hashMessage() from the SDK to verify this matches your original message.
|
|
118
140
|
*/
|
|
119
141
|
signedHash?: `0x${string}`;
|
|
@@ -125,12 +147,26 @@ interface SignMessageResult {
|
|
|
125
147
|
message: string;
|
|
126
148
|
};
|
|
127
149
|
}
|
|
150
|
+
interface ClearSignData {
|
|
151
|
+
decoded: boolean;
|
|
152
|
+
verified: boolean;
|
|
153
|
+
functionName?: string;
|
|
154
|
+
intent?: string;
|
|
155
|
+
args?: Array<{
|
|
156
|
+
name: string;
|
|
157
|
+
type: string;
|
|
158
|
+
value: string;
|
|
159
|
+
label?: string;
|
|
160
|
+
}>;
|
|
161
|
+
selector?: string;
|
|
162
|
+
}
|
|
128
163
|
interface TransactionAction {
|
|
129
|
-
type: 'send' | 'receive' | 'approve' | 'swap' | 'mint' | 'custom';
|
|
164
|
+
type: 'send' | 'receive' | 'approve' | 'swap' | 'mint' | 'custom' | 'module_install';
|
|
130
165
|
label: string;
|
|
131
166
|
sublabel?: string;
|
|
132
167
|
amount?: string;
|
|
133
168
|
icon?: string;
|
|
169
|
+
clearSign?: ClearSignData;
|
|
134
170
|
}
|
|
135
171
|
interface TransactionFees {
|
|
136
172
|
estimated: string;
|
|
@@ -186,8 +222,14 @@ interface PasskeyCredentials {
|
|
|
186
222
|
interface SigningSuccess {
|
|
187
223
|
success: true;
|
|
188
224
|
requestId?: string;
|
|
189
|
-
signature
|
|
225
|
+
/** WebAuthn signature - present for message/typedData signing */
|
|
226
|
+
signature?: WebAuthnSignature;
|
|
227
|
+
/** Array of signatures for multi-origin cross-chain intents (one per source chain) */
|
|
228
|
+
originSignatures?: WebAuthnSignature[];
|
|
229
|
+
/** Credentials of the passkey used for signing - present for message/typedData signing */
|
|
190
230
|
passkey?: PasskeyCredentials;
|
|
231
|
+
/** Intent ID - present for intent signing (after execute in dialog) */
|
|
232
|
+
intentId?: string;
|
|
191
233
|
}
|
|
192
234
|
type SigningErrorCode = "USER_REJECTED" | "EXPIRED" | "INVALID_REQUEST" | "NETWORK_ERROR" | "POPUP_BLOCKED" | "SIGNING_FAILED" | "UNKNOWN";
|
|
193
235
|
interface EmbedOptions {
|
|
@@ -242,21 +284,21 @@ interface IntentCall {
|
|
|
242
284
|
interface IntentTokenRequest {
|
|
243
285
|
/** Token contract address */
|
|
244
286
|
token: string;
|
|
245
|
-
/** Amount (
|
|
246
|
-
amount:
|
|
287
|
+
/** Amount in base units (use parseUnits for decimals) */
|
|
288
|
+
amount: bigint;
|
|
247
289
|
}
|
|
248
290
|
/**
|
|
249
291
|
* A signed intent request from a backend.
|
|
250
292
|
* This provides XSS protection by ensuring calls were constructed server-side.
|
|
251
293
|
*/
|
|
252
|
-
interface
|
|
294
|
+
interface DeveloperSignedIntent {
|
|
253
295
|
/** Developer ID (clientId). Mapped to merchantId for the API. */
|
|
254
296
|
developerId?: string;
|
|
255
297
|
/** Wire field used by the API (same value as developerId) */
|
|
256
298
|
merchantId?: string;
|
|
257
299
|
/** Target chain ID */
|
|
258
300
|
targetChain: number;
|
|
259
|
-
/** Calls to execute (signed by
|
|
301
|
+
/** Calls to execute (signed by developer) */
|
|
260
302
|
calls: IntentCall[];
|
|
261
303
|
/** Username of the signer */
|
|
262
304
|
username?: string;
|
|
@@ -273,6 +315,8 @@ interface MerchantSignedIntent {
|
|
|
273
315
|
/** Optional token requests */
|
|
274
316
|
tokenRequests?: IntentTokenRequest[];
|
|
275
317
|
}
|
|
318
|
+
/** @deprecated Use DeveloperSignedIntent instead */
|
|
319
|
+
type MerchantSignedIntent = DeveloperSignedIntent;
|
|
276
320
|
type IntentSigner = (params: {
|
|
277
321
|
username: string;
|
|
278
322
|
accountAddress?: string;
|
|
@@ -280,13 +324,15 @@ type IntentSigner = (params: {
|
|
|
280
324
|
calls: IntentCall[];
|
|
281
325
|
tokenRequests?: IntentTokenRequest[];
|
|
282
326
|
sourceAssets?: string[];
|
|
283
|
-
}) => Promise<
|
|
327
|
+
}) => Promise<DeveloperSignedIntent>;
|
|
284
328
|
/**
|
|
285
329
|
* Options for sendIntent
|
|
286
330
|
*/
|
|
287
331
|
interface SendIntentOptions {
|
|
288
332
|
/** Username of the signer (for unsigned requests) */
|
|
289
333
|
username?: string;
|
|
334
|
+
/** Account address of the signer (alternative to username for unsigned requests) */
|
|
335
|
+
accountAddress?: string;
|
|
290
336
|
/** Target chain ID (for unsigned requests) */
|
|
291
337
|
targetChain?: number;
|
|
292
338
|
/** Calls to execute on the target chain (for unsigned requests) */
|
|
@@ -299,13 +345,19 @@ interface SendIntentOptions {
|
|
|
299
345
|
* Example: ['USDC'] or ['0x...'] to only use USDC as input.
|
|
300
346
|
*/
|
|
301
347
|
sourceAssets?: string[];
|
|
348
|
+
/**
|
|
349
|
+
* Source chain ID for the assets.
|
|
350
|
+
* When specified with sourceAssets containing addresses, tells orchestrator
|
|
351
|
+
* which chain to look for those tokens on.
|
|
352
|
+
*/
|
|
353
|
+
sourceChainId?: number;
|
|
302
354
|
/** When to close the dialog and return success. Defaults to "preconfirmed" */
|
|
303
355
|
closeOn?: CloseOnStatus;
|
|
304
356
|
/**
|
|
305
|
-
* Pre-signed intent from
|
|
357
|
+
* Pre-signed intent from developer backend (XSS protected)
|
|
306
358
|
* If provided, username/targetChain/calls/tokenRequests are ignored
|
|
307
359
|
*/
|
|
308
|
-
signedIntent?:
|
|
360
|
+
signedIntent?: DeveloperSignedIntent;
|
|
309
361
|
/**
|
|
310
362
|
* Wait for a transaction hash before resolving.
|
|
311
363
|
* Defaults to false to preserve existing behavior.
|
|
@@ -339,7 +391,7 @@ interface IntentQuote {
|
|
|
339
391
|
/**
|
|
340
392
|
* Status of an intent (local states)
|
|
341
393
|
*/
|
|
342
|
-
type IntentStatus = "pending" | "quoted" | "signed" | "submitted" | "completed" | "failed" | "expired";
|
|
394
|
+
type IntentStatus = "pending" | "quoted" | "signed" | "submitted" | "claimed" | "preconfirmed" | "filled" | "completed" | "failed" | "expired" | "unknown";
|
|
343
395
|
/**
|
|
344
396
|
* Orchestrator status (from Rhinestone)
|
|
345
397
|
* These are the statuses we can receive when polling
|
|
@@ -377,13 +429,27 @@ interface SendIntentResult {
|
|
|
377
429
|
* Prepare intent response from auth service
|
|
378
430
|
*/
|
|
379
431
|
interface PrepareIntentResponse {
|
|
380
|
-
intentId: string;
|
|
381
432
|
quote: IntentQuote;
|
|
382
433
|
transaction: TransactionDetails;
|
|
383
434
|
challenge: string;
|
|
384
435
|
expiresAt: string;
|
|
385
436
|
/** Account address for the sign dialog to detect self-transfer vs external send */
|
|
386
437
|
accountAddress?: string;
|
|
438
|
+
/** Serialized PreparedTransactionData from orchestrator - needed for execute */
|
|
439
|
+
intentOp: string;
|
|
440
|
+
/** User ID for creating intent record on execute */
|
|
441
|
+
userId: string;
|
|
442
|
+
/** Target chain ID */
|
|
443
|
+
targetChain: number;
|
|
444
|
+
/** JSON stringified calls */
|
|
445
|
+
calls: string;
|
|
446
|
+
/** Origin message hashes for multi-source cross-chain intents */
|
|
447
|
+
originMessages?: Array<{
|
|
448
|
+
chainId: number;
|
|
449
|
+
messageHash: string;
|
|
450
|
+
}>;
|
|
451
|
+
/** Serialized DigestResult from module SDK (EIP-712 wrapped challenge + merkle proofs) */
|
|
452
|
+
digestResult?: string;
|
|
387
453
|
}
|
|
388
454
|
/**
|
|
389
455
|
* Execute intent response from auth service
|
|
@@ -394,6 +460,8 @@ interface ExecuteIntentResponse {
|
|
|
394
460
|
operationId?: string;
|
|
395
461
|
status: IntentStatus;
|
|
396
462
|
transactionHash?: string;
|
|
463
|
+
/** Transaction result data needed for waiting via POST /api/intent/wait */
|
|
464
|
+
transactionResult?: unknown;
|
|
397
465
|
error?: {
|
|
398
466
|
code: string;
|
|
399
467
|
message: string;
|
|
@@ -407,8 +475,8 @@ interface SendSwapOptions {
|
|
|
407
475
|
username: string;
|
|
408
476
|
/** Target chain ID where swap executes */
|
|
409
477
|
targetChain: number;
|
|
410
|
-
/** Token to swap from (address or supported symbol like 'ETH', 'USDC') */
|
|
411
|
-
fromToken
|
|
478
|
+
/** Token to swap from (address or supported symbol like 'ETH', 'USDC'). Omit to let the orchestrator pick. */
|
|
479
|
+
fromToken?: string;
|
|
412
480
|
/** Token to swap to (address or supported symbol) */
|
|
413
481
|
toToken: string;
|
|
414
482
|
/** Amount to swap in human-readable format (e.g., "0.1") */
|
|
@@ -420,6 +488,11 @@ interface SendSwapOptions {
|
|
|
420
488
|
* This constrains which tokens the orchestrator can use as input.
|
|
421
489
|
*/
|
|
422
490
|
sourceAssets?: string[];
|
|
491
|
+
/**
|
|
492
|
+
* Source chain ID for the assets. When specified, the orchestrator will only
|
|
493
|
+
* look for source assets on this specific chain.
|
|
494
|
+
*/
|
|
495
|
+
sourceChainId?: number;
|
|
423
496
|
/** When to close the dialog. Defaults to "preconfirmed" */
|
|
424
497
|
closeOn?: CloseOnStatus;
|
|
425
498
|
/** Wait for a transaction hash before resolving. */
|
|
@@ -433,8 +506,8 @@ interface SendSwapOptions {
|
|
|
433
506
|
* Quote information from DEX aggregator
|
|
434
507
|
*/
|
|
435
508
|
interface SwapQuote {
|
|
436
|
-
/** Token being sold */
|
|
437
|
-
fromToken
|
|
509
|
+
/** Token being sold (undefined when orchestrator picks) */
|
|
510
|
+
fromToken?: string;
|
|
438
511
|
/** Token being bought */
|
|
439
512
|
toToken: string;
|
|
440
513
|
/** Amount of fromToken being sold */
|
|
@@ -487,8 +560,10 @@ type EIP712Types = {
|
|
|
487
560
|
* Options for signTypedData
|
|
488
561
|
*/
|
|
489
562
|
interface SignTypedDataOptions {
|
|
490
|
-
/** Username of the signer */
|
|
491
|
-
username
|
|
563
|
+
/** Username of the signer (required if accountAddress is not provided) */
|
|
564
|
+
username?: string;
|
|
565
|
+
/** Account address of the signer (alternative to username) */
|
|
566
|
+
accountAddress?: string;
|
|
492
567
|
/** EIP-712 domain parameters */
|
|
493
568
|
domain: EIP712Domain;
|
|
494
569
|
/** Type definitions for all types used in the message */
|
|
@@ -519,6 +594,218 @@ interface SignTypedDataResult {
|
|
|
519
594
|
message: string;
|
|
520
595
|
};
|
|
521
596
|
}
|
|
597
|
+
/**
|
|
598
|
+
* Options for querying intent history
|
|
599
|
+
*/
|
|
600
|
+
interface IntentHistoryOptions {
|
|
601
|
+
/** Maximum number of intents to return (default: 50, max: 100) */
|
|
602
|
+
limit?: number;
|
|
603
|
+
/** Number of intents to skip for pagination */
|
|
604
|
+
offset?: number;
|
|
605
|
+
/** Filter by intent status */
|
|
606
|
+
status?: IntentStatus;
|
|
607
|
+
/** Filter by creation date (ISO string) - intents created on or after this date */
|
|
608
|
+
from?: string;
|
|
609
|
+
/** Filter by creation date (ISO string) - intents created on or before this date */
|
|
610
|
+
to?: string;
|
|
611
|
+
}
|
|
612
|
+
/**
|
|
613
|
+
* Single intent item in history response
|
|
614
|
+
*/
|
|
615
|
+
interface IntentHistoryItem {
|
|
616
|
+
/** Intent identifier (orchestrator's ID, used as primary key) */
|
|
617
|
+
intentId: string;
|
|
618
|
+
/** Current status of the intent */
|
|
619
|
+
status: IntentStatus;
|
|
620
|
+
/** Transaction hash (if completed) */
|
|
621
|
+
transactionHash?: string;
|
|
622
|
+
/** Target chain ID */
|
|
623
|
+
targetChain: number;
|
|
624
|
+
/** Calls that were executed */
|
|
625
|
+
calls: IntentCall[];
|
|
626
|
+
/** When the intent was created (ISO string) */
|
|
627
|
+
createdAt: string;
|
|
628
|
+
/** When the intent was last updated (ISO string) */
|
|
629
|
+
updatedAt: string;
|
|
630
|
+
}
|
|
631
|
+
/**
|
|
632
|
+
* Result of getIntentHistory
|
|
633
|
+
*/
|
|
634
|
+
interface IntentHistoryResult {
|
|
635
|
+
/** List of intents */
|
|
636
|
+
intents: IntentHistoryItem[];
|
|
637
|
+
/** Total count of matching intents */
|
|
638
|
+
total: number;
|
|
639
|
+
/** Whether there are more intents beyond this page */
|
|
640
|
+
hasMore: boolean;
|
|
641
|
+
}
|
|
642
|
+
/**
|
|
643
|
+
* A single intent within a batch
|
|
644
|
+
*/
|
|
645
|
+
interface BatchIntentItem {
|
|
646
|
+
/** Target chain ID */
|
|
647
|
+
targetChain: number;
|
|
648
|
+
/** Calls to execute on the target chain */
|
|
649
|
+
calls?: IntentCall[];
|
|
650
|
+
/** Optional token requests */
|
|
651
|
+
tokenRequests?: IntentTokenRequest[];
|
|
652
|
+
/** Constrain which tokens can be used as input */
|
|
653
|
+
sourceAssets?: string[];
|
|
654
|
+
/** Source chain ID for the assets */
|
|
655
|
+
sourceChainId?: number;
|
|
656
|
+
/** Install an ERC-7579 module instead of executing calls */
|
|
657
|
+
moduleInstall?: {
|
|
658
|
+
moduleType: "validator" | "executor" | "fallback" | "hook";
|
|
659
|
+
moduleAddress: string;
|
|
660
|
+
initData?: string;
|
|
661
|
+
};
|
|
662
|
+
}
|
|
663
|
+
/**
|
|
664
|
+
* Options for sendBatchIntent
|
|
665
|
+
*/
|
|
666
|
+
interface SendBatchIntentOptions {
|
|
667
|
+
/** Username of the signer */
|
|
668
|
+
username?: string;
|
|
669
|
+
/** Account address of the signer (alternative to username) */
|
|
670
|
+
accountAddress?: string;
|
|
671
|
+
/** Array of intents to execute as a batch */
|
|
672
|
+
intents: BatchIntentItem[];
|
|
673
|
+
/** When to close the dialog for each intent. Defaults to "preconfirmed" */
|
|
674
|
+
closeOn?: CloseOnStatus;
|
|
675
|
+
}
|
|
676
|
+
/**
|
|
677
|
+
* Result for a single intent within a batch
|
|
678
|
+
*/
|
|
679
|
+
interface BatchIntentItemResult {
|
|
680
|
+
/** Index in the original batch */
|
|
681
|
+
index: number;
|
|
682
|
+
/** Whether this intent succeeded */
|
|
683
|
+
success: boolean;
|
|
684
|
+
/** Intent ID from orchestrator */
|
|
685
|
+
intentId: string;
|
|
686
|
+
/** Current status */
|
|
687
|
+
status: IntentStatus;
|
|
688
|
+
/** Error details if failed */
|
|
689
|
+
error?: {
|
|
690
|
+
code: string;
|
|
691
|
+
message: string;
|
|
692
|
+
};
|
|
693
|
+
}
|
|
694
|
+
/**
|
|
695
|
+
* Result of sendBatchIntent
|
|
696
|
+
*/
|
|
697
|
+
interface SendBatchIntentResult {
|
|
698
|
+
/** Whether ALL intents succeeded */
|
|
699
|
+
success: boolean;
|
|
700
|
+
/** Per-intent results */
|
|
701
|
+
results: BatchIntentItemResult[];
|
|
702
|
+
/** Count of successful intents */
|
|
703
|
+
successCount: number;
|
|
704
|
+
/** Count of failed intents */
|
|
705
|
+
failureCount: number;
|
|
706
|
+
/** Top-level error message when batch-prepare itself fails */
|
|
707
|
+
error?: string;
|
|
708
|
+
}
|
|
709
|
+
/**
|
|
710
|
+
* Prepared intent data within a batch response
|
|
711
|
+
*/
|
|
712
|
+
interface PreparedBatchIntent {
|
|
713
|
+
/** Index in the original batch */
|
|
714
|
+
index: number;
|
|
715
|
+
/** Quote from orchestrator */
|
|
716
|
+
quote: IntentQuote;
|
|
717
|
+
/** Decoded transaction details for UI */
|
|
718
|
+
transaction: TransactionDetails;
|
|
719
|
+
/** Serialized PreparedTransactionData from orchestrator */
|
|
720
|
+
intentOp: string;
|
|
721
|
+
/** Expiry for this specific intent */
|
|
722
|
+
expiresAt: string;
|
|
723
|
+
/** Target chain ID */
|
|
724
|
+
targetChain: number;
|
|
725
|
+
/** JSON stringified calls */
|
|
726
|
+
calls: string;
|
|
727
|
+
/** Origin message hashes for this intent */
|
|
728
|
+
originMessages: Array<{
|
|
729
|
+
chainId: number;
|
|
730
|
+
messageHash: string;
|
|
731
|
+
}>;
|
|
732
|
+
}
|
|
733
|
+
/**
|
|
734
|
+
* Prepare batch intent response from auth service
|
|
735
|
+
*/
|
|
736
|
+
interface PrepareBatchIntentResponse {
|
|
737
|
+
/** Per-intent prepared data (successful quotes only) */
|
|
738
|
+
intents: PreparedBatchIntent[];
|
|
739
|
+
/** Intents that failed to get quotes (unsupported chains, etc.) */
|
|
740
|
+
failedIntents?: Array<{
|
|
741
|
+
index: number;
|
|
742
|
+
targetChain: number;
|
|
743
|
+
error: string;
|
|
744
|
+
}>;
|
|
745
|
+
/** Shared challenge (merkle root of ALL origin hashes across ALL intents) */
|
|
746
|
+
challenge: string;
|
|
747
|
+
/** User ID */
|
|
748
|
+
userId: string;
|
|
749
|
+
/** Account address */
|
|
750
|
+
accountAddress?: string;
|
|
751
|
+
/** Global expiry (earliest of all intent expiries) */
|
|
752
|
+
expiresAt: string;
|
|
753
|
+
}
|
|
754
|
+
/** Fields available for consent sharing */
|
|
755
|
+
type ConsentField = "email" | "deviceNames";
|
|
756
|
+
/** Shared data returned from consent */
|
|
757
|
+
interface ConsentData {
|
|
758
|
+
email?: string;
|
|
759
|
+
deviceNames?: string[];
|
|
760
|
+
}
|
|
761
|
+
/** Options for checkConsent (read-only, no dialog) */
|
|
762
|
+
interface CheckConsentOptions {
|
|
763
|
+
/** Username of the account (required if accountAddress not provided) */
|
|
764
|
+
username?: string;
|
|
765
|
+
/** Account address (alternative to username) */
|
|
766
|
+
accountAddress?: string;
|
|
767
|
+
/** Fields to check */
|
|
768
|
+
fields: ConsentField[];
|
|
769
|
+
/** Override clientId from SDK config */
|
|
770
|
+
clientId?: string;
|
|
771
|
+
}
|
|
772
|
+
/** Result of checkConsent */
|
|
773
|
+
interface CheckConsentResult {
|
|
774
|
+
/** Whether consent has been granted for ALL requested fields */
|
|
775
|
+
hasConsent: boolean;
|
|
776
|
+
/** Shared data (present when hasConsent is true) */
|
|
777
|
+
data?: ConsentData;
|
|
778
|
+
/** When consent was granted (ISO timestamp) */
|
|
779
|
+
grantedAt?: string;
|
|
780
|
+
}
|
|
781
|
+
/** Options for requestConsent (opens dialog if needed) */
|
|
782
|
+
interface RequestConsentOptions {
|
|
783
|
+
/** Username of the account (required if accountAddress not provided) */
|
|
784
|
+
username?: string;
|
|
785
|
+
/** Account address (alternative to username) */
|
|
786
|
+
accountAddress?: string;
|
|
787
|
+
/** Fields to request access to */
|
|
788
|
+
fields: ConsentField[];
|
|
789
|
+
/** Override clientId from SDK config */
|
|
790
|
+
clientId?: string;
|
|
791
|
+
/** Theme configuration */
|
|
792
|
+
theme?: ThemeConfig;
|
|
793
|
+
}
|
|
794
|
+
/** Result of requestConsent */
|
|
795
|
+
interface RequestConsentResult {
|
|
796
|
+
success: boolean;
|
|
797
|
+
/** Shared data (present when success is true) */
|
|
798
|
+
data?: ConsentData;
|
|
799
|
+
/** When consent was granted (ISO timestamp) */
|
|
800
|
+
grantedAt?: string;
|
|
801
|
+
/** Whether data came from an existing grant (no dialog shown) */
|
|
802
|
+
cached?: boolean;
|
|
803
|
+
/** Error details */
|
|
804
|
+
error?: {
|
|
805
|
+
code: "USER_REJECTED" | "USER_CANCELLED" | "INVALID_REQUEST" | "NETWORK_ERROR" | "UNKNOWN";
|
|
806
|
+
message: string;
|
|
807
|
+
};
|
|
808
|
+
}
|
|
522
809
|
|
|
523
810
|
declare class OneAuthClient {
|
|
524
811
|
private config;
|
|
@@ -549,7 +836,7 @@ declare class OneAuthClient {
|
|
|
549
836
|
/**
|
|
550
837
|
* Get the configured client ID
|
|
551
838
|
*/
|
|
552
|
-
getClientId(): string;
|
|
839
|
+
getClientId(): string | undefined;
|
|
553
840
|
private waitForTransactionHash;
|
|
554
841
|
/**
|
|
555
842
|
* Open the auth dialog (sign in + sign up).
|
|
@@ -559,6 +846,66 @@ declare class OneAuthClient {
|
|
|
559
846
|
theme?: ThemeConfig;
|
|
560
847
|
oauthEnabled?: boolean;
|
|
561
848
|
}): Promise<LoginResult | RegisterResult>;
|
|
849
|
+
/**
|
|
850
|
+
* Open the connect dialog (lightweight connection without passkey auth).
|
|
851
|
+
*
|
|
852
|
+
* This method shows a simple connection confirmation dialog that doesn't
|
|
853
|
+
* require a passkey signature. Users can optionally enable "auto-connect"
|
|
854
|
+
* to skip this dialog in the future.
|
|
855
|
+
*
|
|
856
|
+
* If the user has never connected before, this will return action: "switch"
|
|
857
|
+
* to indicate that the full auth modal should be opened instead.
|
|
858
|
+
*
|
|
859
|
+
* @example
|
|
860
|
+
* ```typescript
|
|
861
|
+
* const result = await client.connectWithModal();
|
|
862
|
+
*
|
|
863
|
+
* if (result.success) {
|
|
864
|
+
* console.log('Connected as:', result.username);
|
|
865
|
+
* } else if (result.action === 'switch') {
|
|
866
|
+
* // User needs to sign in first
|
|
867
|
+
* const authResult = await client.authWithModal();
|
|
868
|
+
* }
|
|
869
|
+
* ```
|
|
870
|
+
*/
|
|
871
|
+
connectWithModal(options?: {
|
|
872
|
+
theme?: ThemeConfig;
|
|
873
|
+
}): Promise<ConnectResult>;
|
|
874
|
+
/**
|
|
875
|
+
* Check if a user has already granted consent for the requested fields.
|
|
876
|
+
* This is a read-only check — no dialog is shown.
|
|
877
|
+
*
|
|
878
|
+
* @example
|
|
879
|
+
* ```typescript
|
|
880
|
+
* const result = await client.checkConsent({
|
|
881
|
+
* username: "alice",
|
|
882
|
+
* fields: ["email"],
|
|
883
|
+
* });
|
|
884
|
+
* if (result.hasConsent) {
|
|
885
|
+
* console.log(result.data?.email);
|
|
886
|
+
* }
|
|
887
|
+
* ```
|
|
888
|
+
*/
|
|
889
|
+
checkConsent(options: CheckConsentOptions): Promise<CheckConsentResult>;
|
|
890
|
+
/**
|
|
891
|
+
* Request consent from the user to share their data.
|
|
892
|
+
*
|
|
893
|
+
* First checks if consent was already granted (returns cached data immediately).
|
|
894
|
+
* If not, opens the consent dialog where the user can review and approve sharing.
|
|
895
|
+
*
|
|
896
|
+
* @example
|
|
897
|
+
* ```typescript
|
|
898
|
+
* const result = await client.requestConsent({
|
|
899
|
+
* username: "alice",
|
|
900
|
+
* fields: ["email", "deviceNames"],
|
|
901
|
+
* });
|
|
902
|
+
* if (result.success) {
|
|
903
|
+
* console.log(result.data?.email);
|
|
904
|
+
* console.log(result.cached); // true if no dialog was shown
|
|
905
|
+
* }
|
|
906
|
+
* ```
|
|
907
|
+
*/
|
|
908
|
+
requestConsent(options: RequestConsentOptions): Promise<RequestConsentResult>;
|
|
562
909
|
/**
|
|
563
910
|
* Authenticate a user with an optional challenge to sign.
|
|
564
911
|
*
|
|
@@ -595,7 +942,7 @@ declare class OneAuthClient {
|
|
|
595
942
|
theme?: ThemeConfig;
|
|
596
943
|
}): Promise<AuthenticateResult>;
|
|
597
944
|
/**
|
|
598
|
-
* Show signing in a modal overlay (
|
|
945
|
+
* Show signing in a modal overlay (iframe dialog)
|
|
599
946
|
*/
|
|
600
947
|
signWithModal(options: SigningRequestOptions & {
|
|
601
948
|
theme?: ThemeConfig;
|
|
@@ -630,6 +977,34 @@ declare class OneAuthClient {
|
|
|
630
977
|
* ```
|
|
631
978
|
*/
|
|
632
979
|
sendIntent(options: SendIntentOptions): Promise<SendIntentResult>;
|
|
980
|
+
/**
|
|
981
|
+
* Send a batch of intents for multi-chain execution with a single passkey tap.
|
|
982
|
+
*
|
|
983
|
+
* This method prepares multiple intents, shows a paginated review,
|
|
984
|
+
* and signs all intents with a single passkey tap via a shared merkle tree.
|
|
985
|
+
*
|
|
986
|
+
* @example
|
|
987
|
+
* ```typescript
|
|
988
|
+
* const result = await client.sendBatchIntent({
|
|
989
|
+
* username: 'alice',
|
|
990
|
+
* intents: [
|
|
991
|
+
* {
|
|
992
|
+
* targetChain: 8453, // Base
|
|
993
|
+
* calls: [{ to: '0x...', data: '0x...', label: 'Swap on Base' }],
|
|
994
|
+
* },
|
|
995
|
+
* {
|
|
996
|
+
* targetChain: 42161, // Arbitrum
|
|
997
|
+
* calls: [{ to: '0x...', data: '0x...', label: 'Mint on Arbitrum' }],
|
|
998
|
+
* },
|
|
999
|
+
* ],
|
|
1000
|
+
* });
|
|
1001
|
+
*
|
|
1002
|
+
* if (result.success) {
|
|
1003
|
+
* console.log(`${result.successCount} intents submitted`);
|
|
1004
|
+
* }
|
|
1005
|
+
* ```
|
|
1006
|
+
*/
|
|
1007
|
+
sendBatchIntent(options: SendBatchIntentOptions): Promise<SendBatchIntentResult>;
|
|
633
1008
|
/**
|
|
634
1009
|
* Send transaction status to the dialog iframe
|
|
635
1010
|
*/
|
|
@@ -642,10 +1017,37 @@ declare class OneAuthClient {
|
|
|
642
1017
|
* Wait for signing result (simplified - no requestId matching)
|
|
643
1018
|
*/
|
|
644
1019
|
private waitForSigningResponse;
|
|
1020
|
+
/**
|
|
1021
|
+
* Wait for signing result with auto-refresh support
|
|
1022
|
+
* This method handles both signing results and quote refresh requests from the dialog
|
|
1023
|
+
*/
|
|
1024
|
+
private waitForSigningWithRefresh;
|
|
645
1025
|
/**
|
|
646
1026
|
* Wait for the dialog to be closed
|
|
647
1027
|
*/
|
|
648
1028
|
private waitForDialogClose;
|
|
1029
|
+
/**
|
|
1030
|
+
* Inject a preconnect link tag to pre-warm DNS + TLS for a given URL.
|
|
1031
|
+
*/
|
|
1032
|
+
private injectPreconnect;
|
|
1033
|
+
/**
|
|
1034
|
+
* Wait for the dialog iframe to signal ready without sending init data.
|
|
1035
|
+
* Returns a sendInit function the caller uses once prepare data is available.
|
|
1036
|
+
*/
|
|
1037
|
+
private waitForDialogReadyDeferred;
|
|
1038
|
+
/**
|
|
1039
|
+
* Prepare an intent by calling the orchestrator for a quote.
|
|
1040
|
+
* Returns the prepare response and the origin tier from the response header.
|
|
1041
|
+
*/
|
|
1042
|
+
private prepareIntent;
|
|
1043
|
+
/**
|
|
1044
|
+
* Prepare a batch intent by calling the orchestrator for quotes on all intents.
|
|
1045
|
+
*/
|
|
1046
|
+
private prepareBatchIntent;
|
|
1047
|
+
/**
|
|
1048
|
+
* Send a prepare error message to the dialog iframe.
|
|
1049
|
+
*/
|
|
1050
|
+
private sendPrepareError;
|
|
649
1051
|
/**
|
|
650
1052
|
* Poll for intent status
|
|
651
1053
|
*
|
|
@@ -653,6 +1055,26 @@ declare class OneAuthClient {
|
|
|
653
1055
|
* that hasn't completed yet.
|
|
654
1056
|
*/
|
|
655
1057
|
getIntentStatus(intentId: string): Promise<SendIntentResult>;
|
|
1058
|
+
/**
|
|
1059
|
+
* Get the history of intents for the authenticated user.
|
|
1060
|
+
*
|
|
1061
|
+
* Requires an active session (user must be logged in).
|
|
1062
|
+
*
|
|
1063
|
+
* @example
|
|
1064
|
+
* ```typescript
|
|
1065
|
+
* // Get recent intents
|
|
1066
|
+
* const history = await client.getIntentHistory({ limit: 10 });
|
|
1067
|
+
*
|
|
1068
|
+
* // Filter by status
|
|
1069
|
+
* const pending = await client.getIntentHistory({ status: 'pending' });
|
|
1070
|
+
*
|
|
1071
|
+
* // Filter by date range
|
|
1072
|
+
* const lastWeek = await client.getIntentHistory({
|
|
1073
|
+
* from: new Date(Date.now() - 7 * 24 * 60 * 60 * 1000).toISOString(),
|
|
1074
|
+
* });
|
|
1075
|
+
* ```
|
|
1076
|
+
*/
|
|
1077
|
+
getIntentHistory(options?: IntentHistoryOptions): Promise<IntentHistoryResult>;
|
|
656
1078
|
/**
|
|
657
1079
|
* Send a swap intent through the Rhinestone orchestrator
|
|
658
1080
|
*
|
|
@@ -771,15 +1193,28 @@ declare class OneAuthClient {
|
|
|
771
1193
|
getPasskeys(username: string): Promise<PasskeyCredential[]>;
|
|
772
1194
|
private createSigningRequest;
|
|
773
1195
|
private openPopup;
|
|
1196
|
+
/**
|
|
1197
|
+
* Wait for the dialog iframe to signal ready, then send init data.
|
|
1198
|
+
* Also handles early close (X button, escape, backdrop) during the ready phase.
|
|
1199
|
+
* Returns true if dialog is ready, false if it was closed before becoming ready.
|
|
1200
|
+
*/
|
|
1201
|
+
private waitForDialogReady;
|
|
774
1202
|
/**
|
|
775
1203
|
* Create a modal dialog with an iframe inside.
|
|
776
1204
|
*/
|
|
777
1205
|
private createModalDialog;
|
|
778
1206
|
private waitForModalAuthResponse;
|
|
1207
|
+
/**
|
|
1208
|
+
* Open a popup for auth and wait for the result.
|
|
1209
|
+
* Used when iframe mode fails (e.g., due to password manager interference).
|
|
1210
|
+
*/
|
|
1211
|
+
private waitForPopupAuthResponse;
|
|
779
1212
|
private waitForAuthenticateResponse;
|
|
1213
|
+
private waitForConnectResponse;
|
|
1214
|
+
private waitForConsentResponse;
|
|
780
1215
|
private waitForModalSigningResponse;
|
|
781
1216
|
private waitForPopupResponse;
|
|
782
1217
|
private fetchSigningResult;
|
|
783
1218
|
}
|
|
784
1219
|
|
|
785
|
-
export { type AuthenticateOptions as A, type BalanceRequirement as B, type CreateSigningRequestResponse as C, type
|
|
1220
|
+
export { type CheckConsentOptions as $, type AuthenticateOptions as A, type BalanceRequirement as B, type CreateSigningRequestResponse as C, type DeveloperSignedIntent as D, type EmbedOptions as E, type CloseOnStatus as F, type PrepareIntentResponse as G, type ExecuteIntentResponse as H, type IntentSigner as I, type IntentHistoryOptions as J, type IntentHistoryItem as K, type LoginOptions as L, type MerchantSignedIntent as M, type IntentHistoryResult as N, OneAuthClient as O, type PasskeyProviderConfig as P, type SendSwapOptions as Q, type RegisterOptions as R, type SendIntentResult as S, type TransactionAction as T, type UserPasskeysResponse as U, type SendSwapResult as V, type WebAuthnSignature as W, type SwapQuote as X, type ThemeConfig as Y, type ConsentField as Z, type ConsentData as _, type IntentCall as a, type CheckConsentResult as a0, type RequestConsentOptions as a1, type RequestConsentResult as a2, type BatchIntentItem as a3, type SendBatchIntentOptions as a4, type SendBatchIntentResult as a5, type BatchIntentItemResult as a6, type PreparedBatchIntent as a7, type PrepareBatchIntentResponse as a8, 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 ConnectResult as k, type AuthenticateResult as l, type SignMessageOptions as m, type SignMessageResult as n, type SignTypedDataOptions as o, type SignTypedDataResult as p, type EIP712Domain as q, type EIP712Types as r, type EIP712TypeField as s, type TransactionFees as t, type TransactionDetails as u, type IntentTokenRequest as v, type SendIntentOptions as w, type IntentQuote as x, type IntentStatus as y, type OrchestratorStatus as z };
|