decane-connect-kit 2.2.7 → 2.3.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/dist/index.cjs +370 -59
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +81 -1
- package/dist/index.d.ts +81 -1
- package/dist/index.js +369 -60
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -294,6 +294,40 @@ interface BalanceResult {
|
|
|
294
294
|
decimals: number;
|
|
295
295
|
}
|
|
296
296
|
|
|
297
|
+
interface Eip1193Provider {
|
|
298
|
+
request(args: {
|
|
299
|
+
method: string;
|
|
300
|
+
params?: unknown[] | object;
|
|
301
|
+
}): Promise<unknown>;
|
|
302
|
+
on(event: string, handler: (...args: unknown[]) => void): this;
|
|
303
|
+
removeListener(event: string, handler: (...args: unknown[]) => void): this;
|
|
304
|
+
/** Marks this as the Decane provider (parallel to wallets' isMetaMask etc.). */
|
|
305
|
+
readonly isDecane: true;
|
|
306
|
+
}
|
|
307
|
+
interface EthereumProviderOptions {
|
|
308
|
+
/** Initial chain id (numeric). Defaults to the first configured EVM chain, else 1. */
|
|
309
|
+
chainId?: number;
|
|
310
|
+
/** Per-chain RPC overrides ('evm:8453' -> url). Falls back to Decane's defaults. */
|
|
311
|
+
rpcUrls?: Record<string, string>;
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Build an EIP-1193 provider over a connected Decane social client.
|
|
315
|
+
*
|
|
316
|
+
* `signAuthorization` (EIP-7702) is wired only when the client exposes it — that
|
|
317
|
+
* requires the TEE signer to support the authorization signing path.
|
|
318
|
+
*/
|
|
319
|
+
declare function createEthereumProvider(client: DecaneConnect & {
|
|
320
|
+
signAuthorization?: (req: {
|
|
321
|
+
chainId: number;
|
|
322
|
+
address: string;
|
|
323
|
+
nonce: number;
|
|
324
|
+
}) => Promise<{
|
|
325
|
+
yParity: number;
|
|
326
|
+
r: string;
|
|
327
|
+
s: string;
|
|
328
|
+
}>;
|
|
329
|
+
}, opts?: EthereumProviderOptions): Eip1193Provider;
|
|
330
|
+
|
|
297
331
|
type Chain = `evm:${number}` | `solana:${'mainnet' | 'devnet'}`;
|
|
298
332
|
interface DecaneConnectConfig {
|
|
299
333
|
/** Dashboard project ID (public). Sent with every request so the backend can
|
|
@@ -328,6 +362,13 @@ interface DecaneConnectConfig {
|
|
|
328
362
|
rpName?: string;
|
|
329
363
|
rpcUrls?: Record<string, string>;
|
|
330
364
|
teeUrl?: string;
|
|
365
|
+
/**
|
|
366
|
+
* Persist the live session (handle + JWT) in sessionStorage so a page RELOAD
|
|
367
|
+
* silently resumes it — no repeat passkey/sign-in. Survives reloads, cleared
|
|
368
|
+
* on tab close. Default true. Set false to require a fresh unlock on every
|
|
369
|
+
* page load (stricter, but the reload friction that motivated this returns).
|
|
370
|
+
*/
|
|
371
|
+
persistSession?: boolean;
|
|
331
372
|
/** Offer to save a recovery-share file at signup. Default true. Never blocks onboarding. */
|
|
332
373
|
offerRecoveryAtSignup?: boolean;
|
|
333
374
|
/** Ask the user whether they want a recovery share and, if so, a password for it. */
|
|
@@ -439,6 +480,30 @@ interface DecaneConnect {
|
|
|
439
480
|
sendTransaction(req: SendTransactionRequest): Promise<string>;
|
|
440
481
|
/** Sign EIP-712 typed data (EVM only). Throws on a Solana chain. */
|
|
441
482
|
signTypedData(req: SignTypedDataRequest): Promise<string>;
|
|
483
|
+
/**
|
|
484
|
+
* A standard EIP-1193 Ethereum provider backed by this wallet — drop it into
|
|
485
|
+
* viem (`custom(provider)`), wagmi, or ethers (`BrowserProvider`). Signing
|
|
486
|
+
* goes through the TEE; reads are forwarded to the chain RPC. Memoized, so
|
|
487
|
+
* repeated calls return the same instance (safe for wagmi).
|
|
488
|
+
*/
|
|
489
|
+
getEthereumProvider(opts?: {
|
|
490
|
+
chainId?: number;
|
|
491
|
+
}): Eip1193Provider;
|
|
492
|
+
/**
|
|
493
|
+
* Sign an EIP-7702 authorization, delegating this EOA to `address` on
|
|
494
|
+
* `chainId`. Enables account-abstraction / sponsored-gas flows: pair the
|
|
495
|
+
* returned {yParity, r, s} into a type-4 transaction's authorizationList.
|
|
496
|
+
* Requires a TEE signer that supports the 7702 path.
|
|
497
|
+
*/
|
|
498
|
+
signAuthorization(req: {
|
|
499
|
+
chainId: number;
|
|
500
|
+
address: string;
|
|
501
|
+
nonce: number;
|
|
502
|
+
}): Promise<{
|
|
503
|
+
yParity: number;
|
|
504
|
+
r: string;
|
|
505
|
+
s: string;
|
|
506
|
+
}>;
|
|
442
507
|
signSolanaTransaction(tx: Uint8Array): Promise<Uint8Array>;
|
|
443
508
|
disconnect(): Promise<void>;
|
|
444
509
|
getAddresses(): {
|
|
@@ -859,6 +924,18 @@ declare function useSocialWallet(): {
|
|
|
859
924
|
chain: string;
|
|
860
925
|
balance: BalanceResult | null;
|
|
861
926
|
}[]>;
|
|
927
|
+
signAuthorization: (req: {
|
|
928
|
+
chainId: number;
|
|
929
|
+
address: string;
|
|
930
|
+
nonce: number;
|
|
931
|
+
}) => Promise<{
|
|
932
|
+
yParity: number;
|
|
933
|
+
r: string;
|
|
934
|
+
s: string;
|
|
935
|
+
}>;
|
|
936
|
+
getEthereumProvider: (opts?: {
|
|
937
|
+
chainId?: number;
|
|
938
|
+
}) => Eip1193Provider;
|
|
862
939
|
rotateShares: (opts: {
|
|
863
940
|
password: string;
|
|
864
941
|
passwordHint?: string;
|
|
@@ -880,6 +957,9 @@ declare function useSocialBalance(chain?: string): {
|
|
|
880
957
|
error: string | null;
|
|
881
958
|
refetch: () => Promise<void>;
|
|
882
959
|
};
|
|
960
|
+
declare function useEthereumProvider(opts?: {
|
|
961
|
+
chainId?: number;
|
|
962
|
+
}): Eip1193Provider | null;
|
|
883
963
|
declare function useDecane(): {
|
|
884
964
|
provider: DecaneProvider;
|
|
885
965
|
wallets: UnifiedWalletAccount[];
|
|
@@ -952,4 +1032,4 @@ declare function useSignTypedData(): {
|
|
|
952
1032
|
reset: () => void;
|
|
953
1033
|
};
|
|
954
1034
|
|
|
955
|
-
export { type ActiveSession, AttestationError, type AuthResult, BUILT_IN_CHAINS, type BalanceResult, 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, DecaneLogo, DecaneMark, type DecaneProvider, DecaneWordmark, ExportNotAuthorizedError, InvalidApiKeyError, InvalidPinError, InvalidRecoveryFileError, NetworkError, NewDeviceError, OriginNotAllowedError, type PortableBackup, PromptPinNotConfiguredError, ReconnectRequiredError, RecoveryFailedError, type RecoveryProgress, type RecoveryShareFile, RecoveryWalletMismatchError, type SdkEvent, type SendTransactionRequest, SessionExpiredError, ShareCorruptedError, type SignMessageRequest, type SignTypedDataRequest, type SocialAuthState, type SocialConfig, SocialWalletModal, type Theme, type TxParams, type UnifiedWalletAccount, UnlockRequiredError, UserCancelledError, WalletSelector, WebAuthnNotSupportedError, type WrappedShareMeta, WrongPasswordError, createDecane, createDecaneConnect, startEmailAuth, useChainSwitch, useDecane, useSendTransaction, useSignMessage, useSignTypedData, useSocialAuth, useSocialBalance, useSocialWallet, useWalletSelector, verifyEmailCode };
|
|
1035
|
+
export { type ActiveSession, AttestationError, type AuthResult, BUILT_IN_CHAINS, type BalanceResult, 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, DecaneLogo, DecaneMark, type DecaneProvider, DecaneWordmark, type Eip1193Provider, type EthereumProviderOptions, ExportNotAuthorizedError, InvalidApiKeyError, InvalidPinError, InvalidRecoveryFileError, NetworkError, NewDeviceError, OriginNotAllowedError, type PortableBackup, PromptPinNotConfiguredError, ReconnectRequiredError, RecoveryFailedError, type RecoveryProgress, type RecoveryShareFile, RecoveryWalletMismatchError, type SdkEvent, type SendTransactionRequest, SessionExpiredError, ShareCorruptedError, type SignMessageRequest, type SignTypedDataRequest, type SocialAuthState, type SocialConfig, SocialWalletModal, type Theme, type TxParams, type UnifiedWalletAccount, UnlockRequiredError, UserCancelledError, WalletSelector, WebAuthnNotSupportedError, type WrappedShareMeta, WrongPasswordError, createDecane, createDecaneConnect, createEthereumProvider, startEmailAuth, useChainSwitch, useDecane, useEthereumProvider, useSendTransaction, useSignMessage, useSignTypedData, useSocialAuth, useSocialBalance, useSocialWallet, useWalletSelector, verifyEmailCode };
|
package/dist/index.d.ts
CHANGED
|
@@ -294,6 +294,40 @@ interface BalanceResult {
|
|
|
294
294
|
decimals: number;
|
|
295
295
|
}
|
|
296
296
|
|
|
297
|
+
interface Eip1193Provider {
|
|
298
|
+
request(args: {
|
|
299
|
+
method: string;
|
|
300
|
+
params?: unknown[] | object;
|
|
301
|
+
}): Promise<unknown>;
|
|
302
|
+
on(event: string, handler: (...args: unknown[]) => void): this;
|
|
303
|
+
removeListener(event: string, handler: (...args: unknown[]) => void): this;
|
|
304
|
+
/** Marks this as the Decane provider (parallel to wallets' isMetaMask etc.). */
|
|
305
|
+
readonly isDecane: true;
|
|
306
|
+
}
|
|
307
|
+
interface EthereumProviderOptions {
|
|
308
|
+
/** Initial chain id (numeric). Defaults to the first configured EVM chain, else 1. */
|
|
309
|
+
chainId?: number;
|
|
310
|
+
/** Per-chain RPC overrides ('evm:8453' -> url). Falls back to Decane's defaults. */
|
|
311
|
+
rpcUrls?: Record<string, string>;
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Build an EIP-1193 provider over a connected Decane social client.
|
|
315
|
+
*
|
|
316
|
+
* `signAuthorization` (EIP-7702) is wired only when the client exposes it — that
|
|
317
|
+
* requires the TEE signer to support the authorization signing path.
|
|
318
|
+
*/
|
|
319
|
+
declare function createEthereumProvider(client: DecaneConnect & {
|
|
320
|
+
signAuthorization?: (req: {
|
|
321
|
+
chainId: number;
|
|
322
|
+
address: string;
|
|
323
|
+
nonce: number;
|
|
324
|
+
}) => Promise<{
|
|
325
|
+
yParity: number;
|
|
326
|
+
r: string;
|
|
327
|
+
s: string;
|
|
328
|
+
}>;
|
|
329
|
+
}, opts?: EthereumProviderOptions): Eip1193Provider;
|
|
330
|
+
|
|
297
331
|
type Chain = `evm:${number}` | `solana:${'mainnet' | 'devnet'}`;
|
|
298
332
|
interface DecaneConnectConfig {
|
|
299
333
|
/** Dashboard project ID (public). Sent with every request so the backend can
|
|
@@ -328,6 +362,13 @@ interface DecaneConnectConfig {
|
|
|
328
362
|
rpName?: string;
|
|
329
363
|
rpcUrls?: Record<string, string>;
|
|
330
364
|
teeUrl?: string;
|
|
365
|
+
/**
|
|
366
|
+
* Persist the live session (handle + JWT) in sessionStorage so a page RELOAD
|
|
367
|
+
* silently resumes it — no repeat passkey/sign-in. Survives reloads, cleared
|
|
368
|
+
* on tab close. Default true. Set false to require a fresh unlock on every
|
|
369
|
+
* page load (stricter, but the reload friction that motivated this returns).
|
|
370
|
+
*/
|
|
371
|
+
persistSession?: boolean;
|
|
331
372
|
/** Offer to save a recovery-share file at signup. Default true. Never blocks onboarding. */
|
|
332
373
|
offerRecoveryAtSignup?: boolean;
|
|
333
374
|
/** Ask the user whether they want a recovery share and, if so, a password for it. */
|
|
@@ -439,6 +480,30 @@ interface DecaneConnect {
|
|
|
439
480
|
sendTransaction(req: SendTransactionRequest): Promise<string>;
|
|
440
481
|
/** Sign EIP-712 typed data (EVM only). Throws on a Solana chain. */
|
|
441
482
|
signTypedData(req: SignTypedDataRequest): Promise<string>;
|
|
483
|
+
/**
|
|
484
|
+
* A standard EIP-1193 Ethereum provider backed by this wallet — drop it into
|
|
485
|
+
* viem (`custom(provider)`), wagmi, or ethers (`BrowserProvider`). Signing
|
|
486
|
+
* goes through the TEE; reads are forwarded to the chain RPC. Memoized, so
|
|
487
|
+
* repeated calls return the same instance (safe for wagmi).
|
|
488
|
+
*/
|
|
489
|
+
getEthereumProvider(opts?: {
|
|
490
|
+
chainId?: number;
|
|
491
|
+
}): Eip1193Provider;
|
|
492
|
+
/**
|
|
493
|
+
* Sign an EIP-7702 authorization, delegating this EOA to `address` on
|
|
494
|
+
* `chainId`. Enables account-abstraction / sponsored-gas flows: pair the
|
|
495
|
+
* returned {yParity, r, s} into a type-4 transaction's authorizationList.
|
|
496
|
+
* Requires a TEE signer that supports the 7702 path.
|
|
497
|
+
*/
|
|
498
|
+
signAuthorization(req: {
|
|
499
|
+
chainId: number;
|
|
500
|
+
address: string;
|
|
501
|
+
nonce: number;
|
|
502
|
+
}): Promise<{
|
|
503
|
+
yParity: number;
|
|
504
|
+
r: string;
|
|
505
|
+
s: string;
|
|
506
|
+
}>;
|
|
442
507
|
signSolanaTransaction(tx: Uint8Array): Promise<Uint8Array>;
|
|
443
508
|
disconnect(): Promise<void>;
|
|
444
509
|
getAddresses(): {
|
|
@@ -859,6 +924,18 @@ declare function useSocialWallet(): {
|
|
|
859
924
|
chain: string;
|
|
860
925
|
balance: BalanceResult | null;
|
|
861
926
|
}[]>;
|
|
927
|
+
signAuthorization: (req: {
|
|
928
|
+
chainId: number;
|
|
929
|
+
address: string;
|
|
930
|
+
nonce: number;
|
|
931
|
+
}) => Promise<{
|
|
932
|
+
yParity: number;
|
|
933
|
+
r: string;
|
|
934
|
+
s: string;
|
|
935
|
+
}>;
|
|
936
|
+
getEthereumProvider: (opts?: {
|
|
937
|
+
chainId?: number;
|
|
938
|
+
}) => Eip1193Provider;
|
|
862
939
|
rotateShares: (opts: {
|
|
863
940
|
password: string;
|
|
864
941
|
passwordHint?: string;
|
|
@@ -880,6 +957,9 @@ declare function useSocialBalance(chain?: string): {
|
|
|
880
957
|
error: string | null;
|
|
881
958
|
refetch: () => Promise<void>;
|
|
882
959
|
};
|
|
960
|
+
declare function useEthereumProvider(opts?: {
|
|
961
|
+
chainId?: number;
|
|
962
|
+
}): Eip1193Provider | null;
|
|
883
963
|
declare function useDecane(): {
|
|
884
964
|
provider: DecaneProvider;
|
|
885
965
|
wallets: UnifiedWalletAccount[];
|
|
@@ -952,4 +1032,4 @@ declare function useSignTypedData(): {
|
|
|
952
1032
|
reset: () => void;
|
|
953
1033
|
};
|
|
954
1034
|
|
|
955
|
-
export { type ActiveSession, AttestationError, type AuthResult, BUILT_IN_CHAINS, type BalanceResult, 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, DecaneLogo, DecaneMark, type DecaneProvider, DecaneWordmark, ExportNotAuthorizedError, InvalidApiKeyError, InvalidPinError, InvalidRecoveryFileError, NetworkError, NewDeviceError, OriginNotAllowedError, type PortableBackup, PromptPinNotConfiguredError, ReconnectRequiredError, RecoveryFailedError, type RecoveryProgress, type RecoveryShareFile, RecoveryWalletMismatchError, type SdkEvent, type SendTransactionRequest, SessionExpiredError, ShareCorruptedError, type SignMessageRequest, type SignTypedDataRequest, type SocialAuthState, type SocialConfig, SocialWalletModal, type Theme, type TxParams, type UnifiedWalletAccount, UnlockRequiredError, UserCancelledError, WalletSelector, WebAuthnNotSupportedError, type WrappedShareMeta, WrongPasswordError, createDecane, createDecaneConnect, startEmailAuth, useChainSwitch, useDecane, useSendTransaction, useSignMessage, useSignTypedData, useSocialAuth, useSocialBalance, useSocialWallet, useWalletSelector, verifyEmailCode };
|
|
1035
|
+
export { type ActiveSession, AttestationError, type AuthResult, BUILT_IN_CHAINS, type BalanceResult, 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, DecaneLogo, DecaneMark, type DecaneProvider, DecaneWordmark, type Eip1193Provider, type EthereumProviderOptions, ExportNotAuthorizedError, InvalidApiKeyError, InvalidPinError, InvalidRecoveryFileError, NetworkError, NewDeviceError, OriginNotAllowedError, type PortableBackup, PromptPinNotConfiguredError, ReconnectRequiredError, RecoveryFailedError, type RecoveryProgress, type RecoveryShareFile, RecoveryWalletMismatchError, type SdkEvent, type SendTransactionRequest, SessionExpiredError, ShareCorruptedError, type SignMessageRequest, type SignTypedDataRequest, type SocialAuthState, type SocialConfig, SocialWalletModal, type Theme, type TxParams, type UnifiedWalletAccount, UnlockRequiredError, UserCancelledError, WalletSelector, WebAuthnNotSupportedError, type WrappedShareMeta, WrongPasswordError, createDecane, createDecaneConnect, createEthereumProvider, startEmailAuth, useChainSwitch, useDecane, useEthereumProvider, useSendTransaction, useSignMessage, useSignTypedData, useSocialAuth, useSocialBalance, useSocialWallet, useWalletSelector, verifyEmailCode };
|