decane-connect-kit 1.0.1 → 1.0.3

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/dist/index.d.cts CHANGED
@@ -72,12 +72,23 @@ interface DecaneProvider {
72
72
  readonly activeSession: ActiveSession | null;
73
73
  readonly activeChain: string | null;
74
74
  }
75
+ type ConnectMode = "all" | "social" | "wallets" | "evm" | "solana" | "tron" | "evm+social" | "solana+social" | "tron+social" | "evm+tron" | "evm+tron+social";
76
+ interface SocialConfig {
77
+ apiKey: string;
78
+ authMethods?: ("google" | "email")[];
79
+ promptPin?: () => Promise<string>;
80
+ apiBaseUrl?: string;
81
+ chains?: string[];
82
+ rpcUrls?: Record<string, string>;
83
+ }
75
84
  interface DecaneConfig {
76
85
  chains?: ChainDescriptor[];
77
86
  supportedChainIds?: string[];
78
87
  networks?: "evm" | "solana" | "tron" | "bitcoin" | "all";
79
88
  defaultChain?: string;
80
89
  theme?: "light" | "dark" | "auto";
90
+ mode?: ConnectMode;
91
+ social?: SocialConfig;
81
92
  }
82
93
  interface EIP1193Provider {
83
94
  request(args: {
@@ -122,6 +133,226 @@ interface BitcoinProvider {
122
133
 
123
134
  declare function createDecane(config?: DecaneConfig): DecaneProvider;
124
135
 
136
+ interface PhraseGenerationResult {
137
+ phrase: string;
138
+ challenge: Array<{
139
+ position: number;
140
+ expected: string;
141
+ }>;
142
+ }
143
+
144
+ declare class ApiClient {
145
+ private readonly baseUrl;
146
+ private readonly apiKey;
147
+ constructor(baseUrl: string, apiKey: string);
148
+ private _request;
149
+ getGoogleInitUrl(): Promise<{
150
+ url: string;
151
+ }>;
152
+ authEmailStart(email: string): Promise<void>;
153
+ authEmailVerify(email: string, code: string): Promise<AuthResult>;
154
+ getAddresses(jwt: string): Promise<{
155
+ evm: string | null;
156
+ solana: string | null;
157
+ }>;
158
+ putShare(jwt: string, share: {
159
+ ciphertext: Uint8Array;
160
+ iv: Uint8Array;
161
+ wrappedShareMeta: WrappedShareMeta;
162
+ evmAddress: string;
163
+ solanaAddress: string;
164
+ }): Promise<void>;
165
+ revoke(jwt: string): Promise<void>;
166
+ hasRecoveryBackup(jwt: string): Promise<boolean>;
167
+ getRecoveryBackup(jwt: string): Promise<{
168
+ wrappedDeviceShare: Uint8Array;
169
+ iv: Uint8Array;
170
+ unlockMethod: 'passkey';
171
+ credentialId: Uint8Array;
172
+ prfSalt: Uint8Array;
173
+ formatVersion: number;
174
+ } | null>;
175
+ putRecoveryBackup(jwt: string, backup: {
176
+ wrappedDeviceShare: Uint8Array;
177
+ iv: Uint8Array;
178
+ unlockMethod: 'passkey';
179
+ credentialId: Uint8Array;
180
+ prfSalt: Uint8Array;
181
+ }): Promise<void>;
182
+ deleteRecoveryBackup(jwt: string): Promise<void>;
183
+ markPhraseSaved(jwt: string): Promise<void>;
184
+ }
185
+
186
+ type RecoveryProgress = {
187
+ type: 'passkey-attempt';
188
+ } | {
189
+ type: 'passkey-failed';
190
+ reason: string;
191
+ } | {
192
+ type: 'phrase-prompt';
193
+ } | {
194
+ type: 'phrase-verifying';
195
+ };
196
+
197
+ type Chain = `evm:${number}` | `solana:${'mainnet' | 'devnet'}`;
198
+ interface DecaneConnectConfig {
199
+ apiKey: string;
200
+ chains: Chain[];
201
+ authMethods: Array<'google' | 'email'>;
202
+ apiBaseUrl?: string;
203
+ sessionDurationMinutes?: number;
204
+ promptPin?: () => Promise<string>;
205
+ rpId?: string;
206
+ rpName?: string;
207
+ rpcUrls?: Record<string, string>;
208
+ teeUrl?: string;
209
+ /** Offer phrase generation during signup. Default true. */
210
+ offerPhraseAtSignup?: boolean;
211
+ /** Show the phrase to the user; return their confirmation answers. */
212
+ onPhraseGenerated?: (result: PhraseGenerationResult) => Promise<{
213
+ userConfirmed: boolean;
214
+ userAnswers: Array<{
215
+ position: number;
216
+ word: string;
217
+ }>;
218
+ }>;
219
+ /** Prompt for a phrase during recovery. Return null to cancel. */
220
+ promptForRecoveryPhrase?: () => Promise<string | null>;
221
+ /** Recovery stage callbacks, for dApp UI. */
222
+ onRecoveryProgress?: (event: RecoveryProgress) => void;
223
+ }
224
+ interface ConnectResult {
225
+ addresses: {
226
+ evm?: string;
227
+ solana?: string;
228
+ };
229
+ isNewUser: boolean;
230
+ }
231
+ interface SignMessageRequest {
232
+ chain: Chain;
233
+ message: string | Uint8Array;
234
+ }
235
+ interface SendTransactionRequest {
236
+ chain: Chain;
237
+ to: string;
238
+ value?: bigint;
239
+ data?: string;
240
+ gasLimit?: bigint;
241
+ gasPrice?: bigint;
242
+ }
243
+ type SdkEvent = 'connected' | 'disconnected' | 'session-expired' | 'session-started';
244
+ interface DecaneConnect {
245
+ connect(): Promise<ConnectResult>;
246
+ connectWithGoogle(): Promise<ConnectResult>;
247
+ connectWithEmail(email: string): Promise<{
248
+ codeRequired: true;
249
+ }>;
250
+ verifyEmailCode(email: string, code: string): Promise<ConnectResult>;
251
+ unlock(): Promise<void>;
252
+ isUnlocked(): boolean;
253
+ sessionExpiresAt(): number | null;
254
+ signMessage(req: SignMessageRequest): Promise<string>;
255
+ sendTransaction(req: SendTransactionRequest): Promise<string>;
256
+ signSolanaTransaction(tx: Uint8Array): Promise<Uint8Array>;
257
+ disconnect(): Promise<void>;
258
+ getAddresses(): {
259
+ evm?: string;
260
+ solana?: string;
261
+ } | null;
262
+ /** Generate a recovery phrase. Re-prompts for unlock; does not cache the share. */
263
+ generateRecoveryPhrase(): Promise<PhraseGenerationResult>;
264
+ /** Record that the user confirmed they saved the phrase. */
265
+ markPhraseSaved(challenge: Array<{
266
+ position: number;
267
+ expected: string;
268
+ }>, userAnswers: Array<{
269
+ position: number;
270
+ word: string;
271
+ }>): Promise<boolean>;
272
+ /** Whether a wrapped-share backup exists on the server. */
273
+ hasBackup(): Promise<boolean>;
274
+ /** Delete the server-side backup. Disables Flow A recovery. */
275
+ deleteBackup(): Promise<void>;
276
+ on(event: SdkEvent, handler: (...args: unknown[]) => void): void;
277
+ off(event: SdkEvent, handler: (...args: unknown[]) => void): void;
278
+ }
279
+ interface WrappedShareMeta {
280
+ unlockMethod: 'passkey' | 'pin';
281
+ credentialId?: string;
282
+ prfSalt?: string;
283
+ pinSalt?: string;
284
+ pinIterations?: number;
285
+ }
286
+ interface AuthResult {
287
+ jwt: string;
288
+ isNewUser: boolean;
289
+ hasShare: boolean;
290
+ userId: string;
291
+ }
292
+
293
+ declare function createDecaneConnect(config: DecaneConnectConfig): Promise<DecaneConnect>;
294
+
295
+ /**
296
+ * Sends a 6-digit magic-link code to the user's email.
297
+ * Always returns void regardless of whether the email exists (prevents enumeration).
298
+ */
299
+ declare function startEmailAuth(api: ApiClient, email: string): Promise<void>;
300
+ /**
301
+ * Verifies the 6-digit code and exchanges it for a JWT.
302
+ */
303
+ declare function verifyEmailCode(api: ApiClient, email: string, code: string): Promise<AuthResult>;
304
+
305
+ declare class DecaneConnectError extends Error {
306
+ code: string;
307
+ retryable: boolean;
308
+ constructor(code: string, message: string, retryable?: boolean);
309
+ }
310
+ declare class InvalidApiKeyError extends DecaneConnectError {
311
+ constructor();
312
+ }
313
+ declare class OriginNotAllowedError extends DecaneConnectError {
314
+ constructor(origin: string);
315
+ }
316
+ declare class SessionExpiredError extends DecaneConnectError {
317
+ constructor();
318
+ }
319
+ declare class UnlockRequiredError extends DecaneConnectError {
320
+ constructor();
321
+ }
322
+ declare class UserCancelledError extends DecaneConnectError {
323
+ constructor();
324
+ }
325
+ declare class WebAuthnNotSupportedError extends DecaneConnectError {
326
+ constructor();
327
+ }
328
+ declare class InvalidPinError extends DecaneConnectError {
329
+ constructor();
330
+ }
331
+ declare class CallSequenceError extends DecaneConnectError {
332
+ constructor(msg: string);
333
+ }
334
+ declare class NetworkError extends DecaneConnectError {
335
+ constructor();
336
+ }
337
+ declare class ShareCorruptedError extends DecaneConnectError {
338
+ constructor();
339
+ }
340
+ declare class NewDeviceError extends DecaneConnectError {
341
+ constructor();
342
+ }
343
+ declare class PromptPinNotConfiguredError extends DecaneConnectError {
344
+ constructor();
345
+ }
346
+ declare class AttestationError extends DecaneConnectError {
347
+ constructor(msg: string);
348
+ }
349
+ declare class RecoveryFailedError extends DecaneConnectError {
350
+ constructor(reason: string);
351
+ }
352
+ declare class InvalidPhraseError extends DecaneConnectError {
353
+ constructor();
354
+ }
355
+
125
356
  declare class DecaneError extends Error {
126
357
  code: DecaneErrorCode;
127
358
  constructor(code: DecaneErrorCode, message: string);
@@ -217,16 +448,91 @@ interface WalletSelectorProps {
217
448
  onConnect: (wallet: UnifiedWalletAccount, preference?: ChainType) => void;
218
449
  theme?: "light" | "dark" | "auto";
219
450
  networks?: "evm" | "solana" | "tron" | "bitcoin" | "all";
451
+ mode?: ConnectMode;
452
+ socialAuthMethods?: ("google" | "email")[];
453
+ onGoogleSignIn?: () => Promise<void>;
454
+ onEmailStart?: (email: string) => Promise<{
455
+ codeRequired: true;
456
+ }>;
457
+ onEmailVerify?: (email: string, code: string) => Promise<void>;
220
458
  }
221
- declare function WalletSelector({ provider, open, onClose, onConnect, theme, networks, }: WalletSelectorProps): React.ReactPortal | null;
459
+ declare function WalletSelector({ provider, open, onClose, onConnect, theme, networks, mode, socialAuthMethods, onGoogleSignIn, onEmailStart, onEmailVerify, }: WalletSelectorProps): React.ReactPortal | null;
222
460
 
223
461
  type Theme = "light" | "dark" | "auto";
462
+ interface SocialAuthState {
463
+ addresses: {
464
+ evm?: string;
465
+ solana?: string;
466
+ } | null;
467
+ isNewUser: boolean;
468
+ isUnlocked: boolean;
469
+ sessionExpiresAt: number | null;
470
+ }
224
471
  interface DecaneKitProps {
225
472
  config?: DecaneConfig;
226
473
  children: ReactNode;
227
474
  }
228
475
  declare function DecaneKit({ config, children }: DecaneKitProps): React.JSX.Element;
229
476
 
477
+ interface SocialWalletModalProps {
478
+ open: boolean;
479
+ onClose: () => void;
480
+ theme?: "light" | "dark" | "auto";
481
+ socialAuth: SocialAuthState;
482
+ onUnlock: () => Promise<void>;
483
+ onDisconnect: () => Promise<void>;
484
+ }
485
+ declare function SocialWalletModal({ open, onClose, theme, socialAuth, onUnlock, onDisconnect, }: SocialWalletModalProps): React.ReactPortal | null;
486
+
487
+ declare function useSocialAuth(): {
488
+ isConnected: boolean;
489
+ isUnlocked: boolean;
490
+ isNewUser: boolean;
491
+ addresses: {
492
+ evm?: string;
493
+ solana?: string;
494
+ } | null;
495
+ sessionExpiresAt: number | null;
496
+ googleLoading: boolean;
497
+ emailLoading: boolean;
498
+ error: string | null;
499
+ clearError: () => void;
500
+ signInWithGoogle: () => Promise<void>;
501
+ sendEmailCode: (email: string) => Promise<{
502
+ codeRequired: true;
503
+ }>;
504
+ confirmEmailCode: (email: string, code: string) => Promise<void>;
505
+ unlock: () => Promise<void>;
506
+ disconnect: () => Promise<void>;
507
+ };
508
+ declare function useSocialWallet(): {
509
+ isConnected: boolean;
510
+ isUnlocked: boolean;
511
+ isNewUser: boolean;
512
+ addresses: {
513
+ evm?: string;
514
+ solana?: string;
515
+ } | null;
516
+ sessionExpiresAt: number | null;
517
+ modalOpen: boolean;
518
+ openModal: () => void;
519
+ closeModal: () => void;
520
+ unlock: () => Promise<void>;
521
+ disconnect: () => Promise<void>;
522
+ signMessage: (chain: string, message: string | Uint8Array) => Promise<string>;
523
+ sendTransaction: (req: {
524
+ chain: string;
525
+ to: string;
526
+ value?: bigint;
527
+ data?: string;
528
+ gasLimit?: bigint;
529
+ gasPrice?: bigint;
530
+ }) => Promise<string>;
531
+ signSolanaTransaction: (tx: Uint8Array) => Promise<Uint8Array<ArrayBufferLike>>;
532
+ loading: boolean;
533
+ error: string | null;
534
+ clearError: () => void;
535
+ };
230
536
  declare function useDecane(): {
231
537
  provider: DecaneProvider;
232
538
  wallets: UnifiedWalletAccount[];
@@ -299,4 +605,4 @@ declare function useSignTypedData(): {
299
605
  reset: () => void;
300
606
  };
301
607
 
302
- export { type ActiveSession, BUILT_IN_CHAINS, type CAIP25Method, type CAIP25SessionRequest, type CAIP25SessionResult, CHAINS, type ChainDescriptor, type ChainId, type ChainScope, type ChainSupport, type ChainType, type DecaneConfig, DecaneError, DecaneErrorCode, DecaneKit, type DecaneProvider, type Theme, type TxParams, type UnifiedWalletAccount, WalletSelector, createDecane, useChainSwitch, useDecane, useSendTransaction, useSignMessage, useSignTypedData, useWalletSelector };
608
+ export { type ActiveSession, AttestationError, type AuthResult, BUILT_IN_CHAINS, type CAIP25Method, type CAIP25SessionRequest, type CAIP25SessionResult, CHAINS, CallSequenceError, type Chain, type ChainDescriptor, type ChainId, type ChainScope, type ChainSupport, type ChainType, type ConnectMode, type ConnectResult, type DecaneConfig, type DecaneConnect, type DecaneConnectConfig, DecaneConnectError, DecaneError, DecaneErrorCode, DecaneKit, type DecaneProvider, InvalidApiKeyError, InvalidPhraseError, InvalidPinError, NetworkError, NewDeviceError, OriginNotAllowedError, type PhraseGenerationResult, PromptPinNotConfiguredError, RecoveryFailedError, type RecoveryProgress, type SdkEvent, type SendTransactionRequest, SessionExpiredError, ShareCorruptedError, type SignMessageRequest, type SocialAuthState, type SocialConfig, SocialWalletModal, type Theme, type TxParams, type UnifiedWalletAccount, UnlockRequiredError, UserCancelledError, WalletSelector, WebAuthnNotSupportedError, type WrappedShareMeta, createDecane, createDecaneConnect, startEmailAuth, useChainSwitch, useDecane, useSendTransaction, useSignMessage, useSignTypedData, useSocialAuth, useSocialWallet, useWalletSelector, verifyEmailCode };
package/dist/index.d.ts CHANGED
@@ -72,12 +72,23 @@ interface DecaneProvider {
72
72
  readonly activeSession: ActiveSession | null;
73
73
  readonly activeChain: string | null;
74
74
  }
75
+ type ConnectMode = "all" | "social" | "wallets" | "evm" | "solana" | "tron" | "evm+social" | "solana+social" | "tron+social" | "evm+tron" | "evm+tron+social";
76
+ interface SocialConfig {
77
+ apiKey: string;
78
+ authMethods?: ("google" | "email")[];
79
+ promptPin?: () => Promise<string>;
80
+ apiBaseUrl?: string;
81
+ chains?: string[];
82
+ rpcUrls?: Record<string, string>;
83
+ }
75
84
  interface DecaneConfig {
76
85
  chains?: ChainDescriptor[];
77
86
  supportedChainIds?: string[];
78
87
  networks?: "evm" | "solana" | "tron" | "bitcoin" | "all";
79
88
  defaultChain?: string;
80
89
  theme?: "light" | "dark" | "auto";
90
+ mode?: ConnectMode;
91
+ social?: SocialConfig;
81
92
  }
82
93
  interface EIP1193Provider {
83
94
  request(args: {
@@ -122,6 +133,226 @@ interface BitcoinProvider {
122
133
 
123
134
  declare function createDecane(config?: DecaneConfig): DecaneProvider;
124
135
 
136
+ interface PhraseGenerationResult {
137
+ phrase: string;
138
+ challenge: Array<{
139
+ position: number;
140
+ expected: string;
141
+ }>;
142
+ }
143
+
144
+ declare class ApiClient {
145
+ private readonly baseUrl;
146
+ private readonly apiKey;
147
+ constructor(baseUrl: string, apiKey: string);
148
+ private _request;
149
+ getGoogleInitUrl(): Promise<{
150
+ url: string;
151
+ }>;
152
+ authEmailStart(email: string): Promise<void>;
153
+ authEmailVerify(email: string, code: string): Promise<AuthResult>;
154
+ getAddresses(jwt: string): Promise<{
155
+ evm: string | null;
156
+ solana: string | null;
157
+ }>;
158
+ putShare(jwt: string, share: {
159
+ ciphertext: Uint8Array;
160
+ iv: Uint8Array;
161
+ wrappedShareMeta: WrappedShareMeta;
162
+ evmAddress: string;
163
+ solanaAddress: string;
164
+ }): Promise<void>;
165
+ revoke(jwt: string): Promise<void>;
166
+ hasRecoveryBackup(jwt: string): Promise<boolean>;
167
+ getRecoveryBackup(jwt: string): Promise<{
168
+ wrappedDeviceShare: Uint8Array;
169
+ iv: Uint8Array;
170
+ unlockMethod: 'passkey';
171
+ credentialId: Uint8Array;
172
+ prfSalt: Uint8Array;
173
+ formatVersion: number;
174
+ } | null>;
175
+ putRecoveryBackup(jwt: string, backup: {
176
+ wrappedDeviceShare: Uint8Array;
177
+ iv: Uint8Array;
178
+ unlockMethod: 'passkey';
179
+ credentialId: Uint8Array;
180
+ prfSalt: Uint8Array;
181
+ }): Promise<void>;
182
+ deleteRecoveryBackup(jwt: string): Promise<void>;
183
+ markPhraseSaved(jwt: string): Promise<void>;
184
+ }
185
+
186
+ type RecoveryProgress = {
187
+ type: 'passkey-attempt';
188
+ } | {
189
+ type: 'passkey-failed';
190
+ reason: string;
191
+ } | {
192
+ type: 'phrase-prompt';
193
+ } | {
194
+ type: 'phrase-verifying';
195
+ };
196
+
197
+ type Chain = `evm:${number}` | `solana:${'mainnet' | 'devnet'}`;
198
+ interface DecaneConnectConfig {
199
+ apiKey: string;
200
+ chains: Chain[];
201
+ authMethods: Array<'google' | 'email'>;
202
+ apiBaseUrl?: string;
203
+ sessionDurationMinutes?: number;
204
+ promptPin?: () => Promise<string>;
205
+ rpId?: string;
206
+ rpName?: string;
207
+ rpcUrls?: Record<string, string>;
208
+ teeUrl?: string;
209
+ /** Offer phrase generation during signup. Default true. */
210
+ offerPhraseAtSignup?: boolean;
211
+ /** Show the phrase to the user; return their confirmation answers. */
212
+ onPhraseGenerated?: (result: PhraseGenerationResult) => Promise<{
213
+ userConfirmed: boolean;
214
+ userAnswers: Array<{
215
+ position: number;
216
+ word: string;
217
+ }>;
218
+ }>;
219
+ /** Prompt for a phrase during recovery. Return null to cancel. */
220
+ promptForRecoveryPhrase?: () => Promise<string | null>;
221
+ /** Recovery stage callbacks, for dApp UI. */
222
+ onRecoveryProgress?: (event: RecoveryProgress) => void;
223
+ }
224
+ interface ConnectResult {
225
+ addresses: {
226
+ evm?: string;
227
+ solana?: string;
228
+ };
229
+ isNewUser: boolean;
230
+ }
231
+ interface SignMessageRequest {
232
+ chain: Chain;
233
+ message: string | Uint8Array;
234
+ }
235
+ interface SendTransactionRequest {
236
+ chain: Chain;
237
+ to: string;
238
+ value?: bigint;
239
+ data?: string;
240
+ gasLimit?: bigint;
241
+ gasPrice?: bigint;
242
+ }
243
+ type SdkEvent = 'connected' | 'disconnected' | 'session-expired' | 'session-started';
244
+ interface DecaneConnect {
245
+ connect(): Promise<ConnectResult>;
246
+ connectWithGoogle(): Promise<ConnectResult>;
247
+ connectWithEmail(email: string): Promise<{
248
+ codeRequired: true;
249
+ }>;
250
+ verifyEmailCode(email: string, code: string): Promise<ConnectResult>;
251
+ unlock(): Promise<void>;
252
+ isUnlocked(): boolean;
253
+ sessionExpiresAt(): number | null;
254
+ signMessage(req: SignMessageRequest): Promise<string>;
255
+ sendTransaction(req: SendTransactionRequest): Promise<string>;
256
+ signSolanaTransaction(tx: Uint8Array): Promise<Uint8Array>;
257
+ disconnect(): Promise<void>;
258
+ getAddresses(): {
259
+ evm?: string;
260
+ solana?: string;
261
+ } | null;
262
+ /** Generate a recovery phrase. Re-prompts for unlock; does not cache the share. */
263
+ generateRecoveryPhrase(): Promise<PhraseGenerationResult>;
264
+ /** Record that the user confirmed they saved the phrase. */
265
+ markPhraseSaved(challenge: Array<{
266
+ position: number;
267
+ expected: string;
268
+ }>, userAnswers: Array<{
269
+ position: number;
270
+ word: string;
271
+ }>): Promise<boolean>;
272
+ /** Whether a wrapped-share backup exists on the server. */
273
+ hasBackup(): Promise<boolean>;
274
+ /** Delete the server-side backup. Disables Flow A recovery. */
275
+ deleteBackup(): Promise<void>;
276
+ on(event: SdkEvent, handler: (...args: unknown[]) => void): void;
277
+ off(event: SdkEvent, handler: (...args: unknown[]) => void): void;
278
+ }
279
+ interface WrappedShareMeta {
280
+ unlockMethod: 'passkey' | 'pin';
281
+ credentialId?: string;
282
+ prfSalt?: string;
283
+ pinSalt?: string;
284
+ pinIterations?: number;
285
+ }
286
+ interface AuthResult {
287
+ jwt: string;
288
+ isNewUser: boolean;
289
+ hasShare: boolean;
290
+ userId: string;
291
+ }
292
+
293
+ declare function createDecaneConnect(config: DecaneConnectConfig): Promise<DecaneConnect>;
294
+
295
+ /**
296
+ * Sends a 6-digit magic-link code to the user's email.
297
+ * Always returns void regardless of whether the email exists (prevents enumeration).
298
+ */
299
+ declare function startEmailAuth(api: ApiClient, email: string): Promise<void>;
300
+ /**
301
+ * Verifies the 6-digit code and exchanges it for a JWT.
302
+ */
303
+ declare function verifyEmailCode(api: ApiClient, email: string, code: string): Promise<AuthResult>;
304
+
305
+ declare class DecaneConnectError extends Error {
306
+ code: string;
307
+ retryable: boolean;
308
+ constructor(code: string, message: string, retryable?: boolean);
309
+ }
310
+ declare class InvalidApiKeyError extends DecaneConnectError {
311
+ constructor();
312
+ }
313
+ declare class OriginNotAllowedError extends DecaneConnectError {
314
+ constructor(origin: string);
315
+ }
316
+ declare class SessionExpiredError extends DecaneConnectError {
317
+ constructor();
318
+ }
319
+ declare class UnlockRequiredError extends DecaneConnectError {
320
+ constructor();
321
+ }
322
+ declare class UserCancelledError extends DecaneConnectError {
323
+ constructor();
324
+ }
325
+ declare class WebAuthnNotSupportedError extends DecaneConnectError {
326
+ constructor();
327
+ }
328
+ declare class InvalidPinError extends DecaneConnectError {
329
+ constructor();
330
+ }
331
+ declare class CallSequenceError extends DecaneConnectError {
332
+ constructor(msg: string);
333
+ }
334
+ declare class NetworkError extends DecaneConnectError {
335
+ constructor();
336
+ }
337
+ declare class ShareCorruptedError extends DecaneConnectError {
338
+ constructor();
339
+ }
340
+ declare class NewDeviceError extends DecaneConnectError {
341
+ constructor();
342
+ }
343
+ declare class PromptPinNotConfiguredError extends DecaneConnectError {
344
+ constructor();
345
+ }
346
+ declare class AttestationError extends DecaneConnectError {
347
+ constructor(msg: string);
348
+ }
349
+ declare class RecoveryFailedError extends DecaneConnectError {
350
+ constructor(reason: string);
351
+ }
352
+ declare class InvalidPhraseError extends DecaneConnectError {
353
+ constructor();
354
+ }
355
+
125
356
  declare class DecaneError extends Error {
126
357
  code: DecaneErrorCode;
127
358
  constructor(code: DecaneErrorCode, message: string);
@@ -217,16 +448,91 @@ interface WalletSelectorProps {
217
448
  onConnect: (wallet: UnifiedWalletAccount, preference?: ChainType) => void;
218
449
  theme?: "light" | "dark" | "auto";
219
450
  networks?: "evm" | "solana" | "tron" | "bitcoin" | "all";
451
+ mode?: ConnectMode;
452
+ socialAuthMethods?: ("google" | "email")[];
453
+ onGoogleSignIn?: () => Promise<void>;
454
+ onEmailStart?: (email: string) => Promise<{
455
+ codeRequired: true;
456
+ }>;
457
+ onEmailVerify?: (email: string, code: string) => Promise<void>;
220
458
  }
221
- declare function WalletSelector({ provider, open, onClose, onConnect, theme, networks, }: WalletSelectorProps): React.ReactPortal | null;
459
+ declare function WalletSelector({ provider, open, onClose, onConnect, theme, networks, mode, socialAuthMethods, onGoogleSignIn, onEmailStart, onEmailVerify, }: WalletSelectorProps): React.ReactPortal | null;
222
460
 
223
461
  type Theme = "light" | "dark" | "auto";
462
+ interface SocialAuthState {
463
+ addresses: {
464
+ evm?: string;
465
+ solana?: string;
466
+ } | null;
467
+ isNewUser: boolean;
468
+ isUnlocked: boolean;
469
+ sessionExpiresAt: number | null;
470
+ }
224
471
  interface DecaneKitProps {
225
472
  config?: DecaneConfig;
226
473
  children: ReactNode;
227
474
  }
228
475
  declare function DecaneKit({ config, children }: DecaneKitProps): React.JSX.Element;
229
476
 
477
+ interface SocialWalletModalProps {
478
+ open: boolean;
479
+ onClose: () => void;
480
+ theme?: "light" | "dark" | "auto";
481
+ socialAuth: SocialAuthState;
482
+ onUnlock: () => Promise<void>;
483
+ onDisconnect: () => Promise<void>;
484
+ }
485
+ declare function SocialWalletModal({ open, onClose, theme, socialAuth, onUnlock, onDisconnect, }: SocialWalletModalProps): React.ReactPortal | null;
486
+
487
+ declare function useSocialAuth(): {
488
+ isConnected: boolean;
489
+ isUnlocked: boolean;
490
+ isNewUser: boolean;
491
+ addresses: {
492
+ evm?: string;
493
+ solana?: string;
494
+ } | null;
495
+ sessionExpiresAt: number | null;
496
+ googleLoading: boolean;
497
+ emailLoading: boolean;
498
+ error: string | null;
499
+ clearError: () => void;
500
+ signInWithGoogle: () => Promise<void>;
501
+ sendEmailCode: (email: string) => Promise<{
502
+ codeRequired: true;
503
+ }>;
504
+ confirmEmailCode: (email: string, code: string) => Promise<void>;
505
+ unlock: () => Promise<void>;
506
+ disconnect: () => Promise<void>;
507
+ };
508
+ declare function useSocialWallet(): {
509
+ isConnected: boolean;
510
+ isUnlocked: boolean;
511
+ isNewUser: boolean;
512
+ addresses: {
513
+ evm?: string;
514
+ solana?: string;
515
+ } | null;
516
+ sessionExpiresAt: number | null;
517
+ modalOpen: boolean;
518
+ openModal: () => void;
519
+ closeModal: () => void;
520
+ unlock: () => Promise<void>;
521
+ disconnect: () => Promise<void>;
522
+ signMessage: (chain: string, message: string | Uint8Array) => Promise<string>;
523
+ sendTransaction: (req: {
524
+ chain: string;
525
+ to: string;
526
+ value?: bigint;
527
+ data?: string;
528
+ gasLimit?: bigint;
529
+ gasPrice?: bigint;
530
+ }) => Promise<string>;
531
+ signSolanaTransaction: (tx: Uint8Array) => Promise<Uint8Array<ArrayBufferLike>>;
532
+ loading: boolean;
533
+ error: string | null;
534
+ clearError: () => void;
535
+ };
230
536
  declare function useDecane(): {
231
537
  provider: DecaneProvider;
232
538
  wallets: UnifiedWalletAccount[];
@@ -299,4 +605,4 @@ declare function useSignTypedData(): {
299
605
  reset: () => void;
300
606
  };
301
607
 
302
- export { type ActiveSession, BUILT_IN_CHAINS, type CAIP25Method, type CAIP25SessionRequest, type CAIP25SessionResult, CHAINS, type ChainDescriptor, type ChainId, type ChainScope, type ChainSupport, type ChainType, type DecaneConfig, DecaneError, DecaneErrorCode, DecaneKit, type DecaneProvider, type Theme, type TxParams, type UnifiedWalletAccount, WalletSelector, createDecane, useChainSwitch, useDecane, useSendTransaction, useSignMessage, useSignTypedData, useWalletSelector };
608
+ export { type ActiveSession, AttestationError, type AuthResult, BUILT_IN_CHAINS, type CAIP25Method, type CAIP25SessionRequest, type CAIP25SessionResult, CHAINS, CallSequenceError, type Chain, type ChainDescriptor, type ChainId, type ChainScope, type ChainSupport, type ChainType, type ConnectMode, type ConnectResult, type DecaneConfig, type DecaneConnect, type DecaneConnectConfig, DecaneConnectError, DecaneError, DecaneErrorCode, DecaneKit, type DecaneProvider, InvalidApiKeyError, InvalidPhraseError, InvalidPinError, NetworkError, NewDeviceError, OriginNotAllowedError, type PhraseGenerationResult, PromptPinNotConfiguredError, RecoveryFailedError, type RecoveryProgress, type SdkEvent, type SendTransactionRequest, SessionExpiredError, ShareCorruptedError, type SignMessageRequest, type SocialAuthState, type SocialConfig, SocialWalletModal, type Theme, type TxParams, type UnifiedWalletAccount, UnlockRequiredError, UserCancelledError, WalletSelector, WebAuthnNotSupportedError, type WrappedShareMeta, createDecane, createDecaneConnect, startEmailAuth, useChainSwitch, useDecane, useSendTransaction, useSignMessage, useSignTypedData, useSocialAuth, useSocialWallet, useWalletSelector, verifyEmailCode };