decane-connect-kit 2.2.1 → 2.2.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
@@ -283,6 +283,17 @@ interface PortableBackup {
283
283
  createdAt: string;
284
284
  }
285
285
 
286
+ interface BalanceResult {
287
+ /** Smallest unit — wei for EVM, lamports for Solana. */
288
+ raw: bigint;
289
+ /** Human-readable amount in whole native units, e.g. "1.2345". */
290
+ formatted: string;
291
+ /** Native currency symbol, e.g. "ETH", "MATIC", "SOL". */
292
+ symbol: string;
293
+ /** Decimals of the native currency (18 for EVM, 9 for Solana). */
294
+ decimals: number;
295
+ }
296
+
286
297
  type Chain = `evm:${number}` | `solana:${'mainnet' | 'devnet'}`;
287
298
  interface DecaneConnectConfig {
288
299
  /** Dashboard project ID (public). Sent with every request so the backend can
@@ -369,6 +380,13 @@ interface SendTransactionRequest {
369
380
  gasLimit?: bigint;
370
381
  gasPrice?: bigint;
371
382
  }
383
+ interface SignTypedDataRequest {
384
+ chain: Chain;
385
+ domain: Record<string, unknown>;
386
+ types: Record<string, unknown>;
387
+ message: Record<string, unknown>;
388
+ primaryType?: string;
389
+ }
372
390
  type SdkEvent = 'connected' | 'disconnected' | 'session-expired' | 'session-started';
373
391
  interface DecaneConnect {
374
392
  connect(): Promise<ConnectResult>;
@@ -419,12 +437,26 @@ interface DecaneConnect {
419
437
  sessionExpiresAt(): number | null;
420
438
  signMessage(req: SignMessageRequest): Promise<string>;
421
439
  sendTransaction(req: SendTransactionRequest): Promise<string>;
440
+ /** Sign EIP-712 typed data (EVM only). Throws on a Solana chain. */
441
+ signTypedData(req: SignTypedDataRequest): Promise<string>;
422
442
  signSolanaTransaction(tx: Uint8Array): Promise<Uint8Array>;
423
443
  disconnect(): Promise<void>;
424
444
  getAddresses(): {
425
445
  evm?: string;
426
446
  solana?: string;
427
447
  } | null;
448
+ /**
449
+ * Native-token balance for a chain (defaults to the first configured EVM
450
+ * chain, else Solana). Read-only public data — works even while the wallet
451
+ * is locked. Returns raw (wei/lamports), a human `formatted` string, the
452
+ * native `symbol`, and `decimals`.
453
+ */
454
+ getBalance(chain?: string): Promise<BalanceResult>;
455
+ /** Native balances across every configured chain the wallet has an address for. */
456
+ getBalances(): Promise<Array<{
457
+ chain: string;
458
+ balance: BalanceResult | null;
459
+ }>>;
428
460
  /**
429
461
  * Voluntary share rotation — after a suspected device compromise, or just
430
462
  * to invalidate an old recovery file. Requires a fresh WebAuthn assertion.
@@ -733,6 +765,19 @@ interface SocialWalletModalProps {
733
765
  }
734
766
  declare function SocialWalletModal({ open, onClose, theme, socialAuth, onUnlock, onDisconnect, onGoogleSignIn, onEmailStart, onEmailVerify, authMethods, customAuthLabel, onCustomAuthSignIn, onRotateShares, onExportPortableBackup, rpcUrls, chains, }: SocialWalletModalProps): React.ReactPortal | null;
735
767
 
768
+ declare function DecaneMark({ size, muted }: {
769
+ size?: number;
770
+ muted?: boolean;
771
+ }): React.JSX.Element;
772
+ declare function DecaneWordmark({ size, muted }: {
773
+ size?: number;
774
+ muted?: boolean;
775
+ }): React.JSX.Element;
776
+ declare function DecaneLogo({ size, muted }: {
777
+ size?: number;
778
+ muted?: boolean;
779
+ }): React.JSX.Element;
780
+
736
781
  declare function useSocialAuth(): {
737
782
  isConnected: boolean;
738
783
  isUnlocked: boolean;
@@ -787,6 +832,18 @@ declare function useSocialWallet(): {
787
832
  gasPrice?: bigint;
788
833
  }) => Promise<string>;
789
834
  signSolanaTransaction: (tx: Uint8Array) => Promise<Uint8Array<ArrayBufferLike>>;
835
+ signTypedData: (req: {
836
+ chain: string;
837
+ domain: Record<string, unknown>;
838
+ types: Record<string, unknown>;
839
+ message: Record<string, unknown>;
840
+ primaryType?: string;
841
+ }) => Promise<string>;
842
+ getBalance: (chain?: string) => Promise<BalanceResult>;
843
+ getBalances: () => Promise<{
844
+ chain: string;
845
+ balance: BalanceResult | null;
846
+ }[]>;
790
847
  rotateShares: (opts: {
791
848
  password: string;
792
849
  passwordHint?: string;
@@ -802,6 +859,12 @@ declare function useSocialWallet(): {
802
859
  error: string | null;
803
860
  clearError: () => void;
804
861
  };
862
+ declare function useSocialBalance(chain?: string): {
863
+ balance: BalanceResult | null;
864
+ loading: boolean;
865
+ error: string | null;
866
+ refetch: () => Promise<void>;
867
+ };
805
868
  declare function useDecane(): {
806
869
  provider: DecaneProvider;
807
870
  wallets: UnifiedWalletAccount[];
@@ -874,4 +937,4 @@ declare function useSignTypedData(): {
874
937
  reset: () => void;
875
938
  };
876
939
 
877
- 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, 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 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, useSocialWallet, useWalletSelector, verifyEmailCode };
940
+ 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 };
package/dist/index.d.ts CHANGED
@@ -283,6 +283,17 @@ interface PortableBackup {
283
283
  createdAt: string;
284
284
  }
285
285
 
286
+ interface BalanceResult {
287
+ /** Smallest unit — wei for EVM, lamports for Solana. */
288
+ raw: bigint;
289
+ /** Human-readable amount in whole native units, e.g. "1.2345". */
290
+ formatted: string;
291
+ /** Native currency symbol, e.g. "ETH", "MATIC", "SOL". */
292
+ symbol: string;
293
+ /** Decimals of the native currency (18 for EVM, 9 for Solana). */
294
+ decimals: number;
295
+ }
296
+
286
297
  type Chain = `evm:${number}` | `solana:${'mainnet' | 'devnet'}`;
287
298
  interface DecaneConnectConfig {
288
299
  /** Dashboard project ID (public). Sent with every request so the backend can
@@ -369,6 +380,13 @@ interface SendTransactionRequest {
369
380
  gasLimit?: bigint;
370
381
  gasPrice?: bigint;
371
382
  }
383
+ interface SignTypedDataRequest {
384
+ chain: Chain;
385
+ domain: Record<string, unknown>;
386
+ types: Record<string, unknown>;
387
+ message: Record<string, unknown>;
388
+ primaryType?: string;
389
+ }
372
390
  type SdkEvent = 'connected' | 'disconnected' | 'session-expired' | 'session-started';
373
391
  interface DecaneConnect {
374
392
  connect(): Promise<ConnectResult>;
@@ -419,12 +437,26 @@ interface DecaneConnect {
419
437
  sessionExpiresAt(): number | null;
420
438
  signMessage(req: SignMessageRequest): Promise<string>;
421
439
  sendTransaction(req: SendTransactionRequest): Promise<string>;
440
+ /** Sign EIP-712 typed data (EVM only). Throws on a Solana chain. */
441
+ signTypedData(req: SignTypedDataRequest): Promise<string>;
422
442
  signSolanaTransaction(tx: Uint8Array): Promise<Uint8Array>;
423
443
  disconnect(): Promise<void>;
424
444
  getAddresses(): {
425
445
  evm?: string;
426
446
  solana?: string;
427
447
  } | null;
448
+ /**
449
+ * Native-token balance for a chain (defaults to the first configured EVM
450
+ * chain, else Solana). Read-only public data — works even while the wallet
451
+ * is locked. Returns raw (wei/lamports), a human `formatted` string, the
452
+ * native `symbol`, and `decimals`.
453
+ */
454
+ getBalance(chain?: string): Promise<BalanceResult>;
455
+ /** Native balances across every configured chain the wallet has an address for. */
456
+ getBalances(): Promise<Array<{
457
+ chain: string;
458
+ balance: BalanceResult | null;
459
+ }>>;
428
460
  /**
429
461
  * Voluntary share rotation — after a suspected device compromise, or just
430
462
  * to invalidate an old recovery file. Requires a fresh WebAuthn assertion.
@@ -733,6 +765,19 @@ interface SocialWalletModalProps {
733
765
  }
734
766
  declare function SocialWalletModal({ open, onClose, theme, socialAuth, onUnlock, onDisconnect, onGoogleSignIn, onEmailStart, onEmailVerify, authMethods, customAuthLabel, onCustomAuthSignIn, onRotateShares, onExportPortableBackup, rpcUrls, chains, }: SocialWalletModalProps): React.ReactPortal | null;
735
767
 
768
+ declare function DecaneMark({ size, muted }: {
769
+ size?: number;
770
+ muted?: boolean;
771
+ }): React.JSX.Element;
772
+ declare function DecaneWordmark({ size, muted }: {
773
+ size?: number;
774
+ muted?: boolean;
775
+ }): React.JSX.Element;
776
+ declare function DecaneLogo({ size, muted }: {
777
+ size?: number;
778
+ muted?: boolean;
779
+ }): React.JSX.Element;
780
+
736
781
  declare function useSocialAuth(): {
737
782
  isConnected: boolean;
738
783
  isUnlocked: boolean;
@@ -787,6 +832,18 @@ declare function useSocialWallet(): {
787
832
  gasPrice?: bigint;
788
833
  }) => Promise<string>;
789
834
  signSolanaTransaction: (tx: Uint8Array) => Promise<Uint8Array<ArrayBufferLike>>;
835
+ signTypedData: (req: {
836
+ chain: string;
837
+ domain: Record<string, unknown>;
838
+ types: Record<string, unknown>;
839
+ message: Record<string, unknown>;
840
+ primaryType?: string;
841
+ }) => Promise<string>;
842
+ getBalance: (chain?: string) => Promise<BalanceResult>;
843
+ getBalances: () => Promise<{
844
+ chain: string;
845
+ balance: BalanceResult | null;
846
+ }[]>;
790
847
  rotateShares: (opts: {
791
848
  password: string;
792
849
  passwordHint?: string;
@@ -802,6 +859,12 @@ declare function useSocialWallet(): {
802
859
  error: string | null;
803
860
  clearError: () => void;
804
861
  };
862
+ declare function useSocialBalance(chain?: string): {
863
+ balance: BalanceResult | null;
864
+ loading: boolean;
865
+ error: string | null;
866
+ refetch: () => Promise<void>;
867
+ };
805
868
  declare function useDecane(): {
806
869
  provider: DecaneProvider;
807
870
  wallets: UnifiedWalletAccount[];
@@ -874,4 +937,4 @@ declare function useSignTypedData(): {
874
937
  reset: () => void;
875
938
  };
876
939
 
877
- 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, 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 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, useSocialWallet, useWalletSelector, verifyEmailCode };
940
+ 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 };