decane-connect-kit 2.7.6 → 2.8.1
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 +328 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +40 -6
- package/dist/index.d.ts +40 -6
- package/dist/index.js +328 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -92,7 +92,7 @@ interface DecaneConnectConfig {
|
|
|
92
92
|
appId: string;
|
|
93
93
|
apiKey: string;
|
|
94
94
|
chains: Chain[];
|
|
95
|
-
authMethods: Array<'google' | 'email' | 'kingschat'>;
|
|
95
|
+
authMethods: Array<'google' | 'email' | 'phone' | 'kingschat'>;
|
|
96
96
|
/**
|
|
97
97
|
* Scopes requested from KingsChat at sign-in. Defaults to
|
|
98
98
|
* `['send_chat_message']`, which is what KingsChat's own SDK asks for and is
|
|
@@ -315,6 +315,23 @@ interface DecaneConnect {
|
|
|
315
315
|
providerId?: string;
|
|
316
316
|
}): Promise<ConnectResult>;
|
|
317
317
|
verifyEmailCode(email: string, code: string): Promise<ConnectResult>;
|
|
318
|
+
/**
|
|
319
|
+
* Send a 6-digit sign-in code by SMS (delivered via Termii).
|
|
320
|
+
*
|
|
321
|
+
* `phone` must be **E.164** — `+2348012345678`. Local formats like
|
|
322
|
+
* `08012345678` are rejected rather than guessed at: the wallet is derived
|
|
323
|
+
* from the number, so guessing a country would either merge two people onto
|
|
324
|
+
* one wallet or split one person across two. Collect the country in your UI.
|
|
325
|
+
*
|
|
326
|
+
* Always resolves, whether or not the number has an account — the backend
|
|
327
|
+
* answers identically either way so this cannot be used to discover who is
|
|
328
|
+
* registered. Follow with {@link verifyPhoneCode}.
|
|
329
|
+
*/
|
|
330
|
+
connectWithPhone(phone: string): Promise<{
|
|
331
|
+
codeRequired: true;
|
|
332
|
+
}>;
|
|
333
|
+
/** Verify the SMS code and open the wallet. Pass the same E.164 number. */
|
|
334
|
+
verifyPhoneCode(phone: string, code: string): Promise<ConnectResult>;
|
|
318
335
|
unlock(): Promise<void>;
|
|
319
336
|
isUnlocked(): boolean;
|
|
320
337
|
/**
|
|
@@ -503,6 +520,8 @@ declare class ApiClient {
|
|
|
503
520
|
authKingsChat(accessToken: string): Promise<AuthResult>;
|
|
504
521
|
authEmailStart(email: string): Promise<void>;
|
|
505
522
|
authEmailVerify(email: string, code: string): Promise<AuthResult>;
|
|
523
|
+
authPhoneStart(phone: string): Promise<void>;
|
|
524
|
+
authPhoneVerify(phone: string, code: string): Promise<AuthResult>;
|
|
506
525
|
getAddresses(jwt: string): Promise<{
|
|
507
526
|
evm: string | null;
|
|
508
527
|
solana: string | null;
|
|
@@ -668,7 +687,7 @@ interface DecaneProvider {
|
|
|
668
687
|
type ConnectMode = "all" | "social" | "wallets" | "evm" | "solana" | "tron" | "evm+social" | "solana+social" | "tron+social" | "evm+tron" | "evm+tron+social";
|
|
669
688
|
interface SocialConfig {
|
|
670
689
|
apiKey: string;
|
|
671
|
-
authMethods?: ("google" | "email" | "kingschat")[];
|
|
690
|
+
authMethods?: ("google" | "email" | "phone" | "kingschat")[];
|
|
672
691
|
/**
|
|
673
692
|
* Scopes requested from KingsChat. Defaults to `['send_chat_message']`, which
|
|
674
693
|
* is what KingsChat's own SDK asks for and is enough to establish identity.
|
|
@@ -1052,13 +1071,17 @@ interface WalletSelectorProps {
|
|
|
1052
1071
|
theme?: "light" | "dark" | "auto";
|
|
1053
1072
|
networks?: "evm" | "solana" | "tron" | "bitcoin" | "all";
|
|
1054
1073
|
mode?: ConnectMode;
|
|
1055
|
-
socialAuthMethods?: ("google" | "email" | "kingschat")[];
|
|
1074
|
+
socialAuthMethods?: ("google" | "email" | "phone" | "kingschat")[];
|
|
1056
1075
|
onGoogleSignIn?: () => Promise<void>;
|
|
1057
1076
|
onKingsChatSignIn?: () => Promise<void>;
|
|
1058
1077
|
onEmailStart?: (email: string) => Promise<{
|
|
1059
1078
|
codeRequired: true;
|
|
1060
1079
|
}>;
|
|
1061
1080
|
onEmailVerify?: (email: string, code: string) => Promise<void>;
|
|
1081
|
+
onPhoneStart?: (phone: string) => Promise<{
|
|
1082
|
+
codeRequired: true;
|
|
1083
|
+
}>;
|
|
1084
|
+
onPhoneVerify?: (phone: string, code: string) => Promise<void>;
|
|
1062
1085
|
/** Button text for the developer's own auth system, e.g. "Continue with Acme Inc". Omitted entirely when not configured. */
|
|
1063
1086
|
customAuthLabel?: string;
|
|
1064
1087
|
onCustomAuthSignIn?: () => Promise<void>;
|
|
@@ -1068,7 +1091,7 @@ interface WalletSelectorProps {
|
|
|
1068
1091
|
passkeyAddress?: string | null;
|
|
1069
1092
|
onPasskeySignIn?: () => Promise<unknown>;
|
|
1070
1093
|
}
|
|
1071
|
-
declare function WalletSelector({ provider, open, onClose, onConnect, theme, networks, mode, socialAuthMethods, onGoogleSignIn, onKingsChatSignIn, onEmailStart, onEmailVerify, customAuthLabel, onCustomAuthSignIn, canUsePasskey, passkeyAddress, onPasskeySignIn, }: WalletSelectorProps): React.ReactPortal | null;
|
|
1094
|
+
declare function WalletSelector({ provider, open, onClose, onConnect, theme, networks, mode, socialAuthMethods, onGoogleSignIn, onKingsChatSignIn, onEmailStart, onEmailVerify, onPhoneStart, onPhoneVerify, customAuthLabel, onCustomAuthSignIn, canUsePasskey, passkeyAddress, onPasskeySignIn, }: WalletSelectorProps): React.ReactPortal | null;
|
|
1072
1095
|
|
|
1073
1096
|
type Theme = "light" | "dark" | "auto";
|
|
1074
1097
|
interface SocialAuthState {
|
|
@@ -1131,7 +1154,11 @@ interface SocialWalletModalProps {
|
|
|
1131
1154
|
codeRequired: true;
|
|
1132
1155
|
}>;
|
|
1133
1156
|
onEmailVerify: (email: string, code: string) => Promise<void>;
|
|
1134
|
-
|
|
1157
|
+
onPhoneStart?: (phone: string) => Promise<{
|
|
1158
|
+
codeRequired: true;
|
|
1159
|
+
}>;
|
|
1160
|
+
onPhoneVerify?: (phone: string, code: string) => Promise<void>;
|
|
1161
|
+
authMethods?: Array<"google" | "email" | "phone" | "kingschat">;
|
|
1135
1162
|
customAuthLabel?: string;
|
|
1136
1163
|
onCustomAuthSignIn?: () => Promise<void>;
|
|
1137
1164
|
canUsePasskey?: boolean;
|
|
@@ -1148,7 +1175,7 @@ interface SocialWalletModalProps {
|
|
|
1148
1175
|
rpcUrls?: Record<string, string>;
|
|
1149
1176
|
chains?: string[];
|
|
1150
1177
|
}
|
|
1151
|
-
declare function SocialWalletModal({ open, onClose, theme, socialAuth, onUnlock, onDisconnect, onGoogleSignIn, onKingsChatSignIn, onEmailStart, onEmailVerify, authMethods, customAuthLabel, onCustomAuthSignIn, canUsePasskey, passkeyAddress, onPasskeySignIn, onRotateShares, onExportPortableBackup, rpcUrls, chains, }: SocialWalletModalProps): React.ReactPortal | null;
|
|
1178
|
+
declare function SocialWalletModal({ open, onClose, theme, socialAuth, onUnlock, onDisconnect, onGoogleSignIn, onKingsChatSignIn, onEmailStart, onEmailVerify, onPhoneStart, onPhoneVerify, authMethods, customAuthLabel, onCustomAuthSignIn, canUsePasskey, passkeyAddress, onPasskeySignIn, onRotateShares, onExportPortableBackup, rpcUrls, chains, }: SocialWalletModalProps): React.ReactPortal | null;
|
|
1152
1179
|
|
|
1153
1180
|
declare function DecaneMark({ size, muted }: {
|
|
1154
1181
|
size?: number;
|
|
@@ -1178,17 +1205,24 @@ declare function useSocialAuth(): {
|
|
|
1178
1205
|
isCreatingWallet: boolean;
|
|
1179
1206
|
needsReconnect: boolean;
|
|
1180
1207
|
googleLoading: boolean;
|
|
1208
|
+
kingschatLoading: boolean;
|
|
1181
1209
|
emailLoading: boolean;
|
|
1210
|
+
phoneLoading: boolean;
|
|
1182
1211
|
tokenLoading: boolean;
|
|
1183
1212
|
customLoading: boolean;
|
|
1184
1213
|
customAuthLabel: string | undefined;
|
|
1185
1214
|
error: string | null;
|
|
1186
1215
|
clearError: () => void;
|
|
1187
1216
|
signInWithGoogle: () => Promise<void>;
|
|
1217
|
+
signInWithKingsChat: () => Promise<void>;
|
|
1188
1218
|
sendEmailCode: (email: string) => Promise<{
|
|
1189
1219
|
codeRequired: true;
|
|
1190
1220
|
}>;
|
|
1191
1221
|
confirmEmailCode: (email: string, code: string) => Promise<void>;
|
|
1222
|
+
sendPhoneCode: (phone: string) => Promise<{
|
|
1223
|
+
codeRequired: true;
|
|
1224
|
+
}>;
|
|
1225
|
+
confirmPhoneCode: (phone: string, code: string) => Promise<void>;
|
|
1192
1226
|
signInWithToken: (token: string, opts?: {
|
|
1193
1227
|
providerId?: string;
|
|
1194
1228
|
}) => Promise<void>;
|
package/dist/index.d.ts
CHANGED
|
@@ -92,7 +92,7 @@ interface DecaneConnectConfig {
|
|
|
92
92
|
appId: string;
|
|
93
93
|
apiKey: string;
|
|
94
94
|
chains: Chain[];
|
|
95
|
-
authMethods: Array<'google' | 'email' | 'kingschat'>;
|
|
95
|
+
authMethods: Array<'google' | 'email' | 'phone' | 'kingschat'>;
|
|
96
96
|
/**
|
|
97
97
|
* Scopes requested from KingsChat at sign-in. Defaults to
|
|
98
98
|
* `['send_chat_message']`, which is what KingsChat's own SDK asks for and is
|
|
@@ -315,6 +315,23 @@ interface DecaneConnect {
|
|
|
315
315
|
providerId?: string;
|
|
316
316
|
}): Promise<ConnectResult>;
|
|
317
317
|
verifyEmailCode(email: string, code: string): Promise<ConnectResult>;
|
|
318
|
+
/**
|
|
319
|
+
* Send a 6-digit sign-in code by SMS (delivered via Termii).
|
|
320
|
+
*
|
|
321
|
+
* `phone` must be **E.164** — `+2348012345678`. Local formats like
|
|
322
|
+
* `08012345678` are rejected rather than guessed at: the wallet is derived
|
|
323
|
+
* from the number, so guessing a country would either merge two people onto
|
|
324
|
+
* one wallet or split one person across two. Collect the country in your UI.
|
|
325
|
+
*
|
|
326
|
+
* Always resolves, whether or not the number has an account — the backend
|
|
327
|
+
* answers identically either way so this cannot be used to discover who is
|
|
328
|
+
* registered. Follow with {@link verifyPhoneCode}.
|
|
329
|
+
*/
|
|
330
|
+
connectWithPhone(phone: string): Promise<{
|
|
331
|
+
codeRequired: true;
|
|
332
|
+
}>;
|
|
333
|
+
/** Verify the SMS code and open the wallet. Pass the same E.164 number. */
|
|
334
|
+
verifyPhoneCode(phone: string, code: string): Promise<ConnectResult>;
|
|
318
335
|
unlock(): Promise<void>;
|
|
319
336
|
isUnlocked(): boolean;
|
|
320
337
|
/**
|
|
@@ -503,6 +520,8 @@ declare class ApiClient {
|
|
|
503
520
|
authKingsChat(accessToken: string): Promise<AuthResult>;
|
|
504
521
|
authEmailStart(email: string): Promise<void>;
|
|
505
522
|
authEmailVerify(email: string, code: string): Promise<AuthResult>;
|
|
523
|
+
authPhoneStart(phone: string): Promise<void>;
|
|
524
|
+
authPhoneVerify(phone: string, code: string): Promise<AuthResult>;
|
|
506
525
|
getAddresses(jwt: string): Promise<{
|
|
507
526
|
evm: string | null;
|
|
508
527
|
solana: string | null;
|
|
@@ -668,7 +687,7 @@ interface DecaneProvider {
|
|
|
668
687
|
type ConnectMode = "all" | "social" | "wallets" | "evm" | "solana" | "tron" | "evm+social" | "solana+social" | "tron+social" | "evm+tron" | "evm+tron+social";
|
|
669
688
|
interface SocialConfig {
|
|
670
689
|
apiKey: string;
|
|
671
|
-
authMethods?: ("google" | "email" | "kingschat")[];
|
|
690
|
+
authMethods?: ("google" | "email" | "phone" | "kingschat")[];
|
|
672
691
|
/**
|
|
673
692
|
* Scopes requested from KingsChat. Defaults to `['send_chat_message']`, which
|
|
674
693
|
* is what KingsChat's own SDK asks for and is enough to establish identity.
|
|
@@ -1052,13 +1071,17 @@ interface WalletSelectorProps {
|
|
|
1052
1071
|
theme?: "light" | "dark" | "auto";
|
|
1053
1072
|
networks?: "evm" | "solana" | "tron" | "bitcoin" | "all";
|
|
1054
1073
|
mode?: ConnectMode;
|
|
1055
|
-
socialAuthMethods?: ("google" | "email" | "kingschat")[];
|
|
1074
|
+
socialAuthMethods?: ("google" | "email" | "phone" | "kingschat")[];
|
|
1056
1075
|
onGoogleSignIn?: () => Promise<void>;
|
|
1057
1076
|
onKingsChatSignIn?: () => Promise<void>;
|
|
1058
1077
|
onEmailStart?: (email: string) => Promise<{
|
|
1059
1078
|
codeRequired: true;
|
|
1060
1079
|
}>;
|
|
1061
1080
|
onEmailVerify?: (email: string, code: string) => Promise<void>;
|
|
1081
|
+
onPhoneStart?: (phone: string) => Promise<{
|
|
1082
|
+
codeRequired: true;
|
|
1083
|
+
}>;
|
|
1084
|
+
onPhoneVerify?: (phone: string, code: string) => Promise<void>;
|
|
1062
1085
|
/** Button text for the developer's own auth system, e.g. "Continue with Acme Inc". Omitted entirely when not configured. */
|
|
1063
1086
|
customAuthLabel?: string;
|
|
1064
1087
|
onCustomAuthSignIn?: () => Promise<void>;
|
|
@@ -1068,7 +1091,7 @@ interface WalletSelectorProps {
|
|
|
1068
1091
|
passkeyAddress?: string | null;
|
|
1069
1092
|
onPasskeySignIn?: () => Promise<unknown>;
|
|
1070
1093
|
}
|
|
1071
|
-
declare function WalletSelector({ provider, open, onClose, onConnect, theme, networks, mode, socialAuthMethods, onGoogleSignIn, onKingsChatSignIn, onEmailStart, onEmailVerify, customAuthLabel, onCustomAuthSignIn, canUsePasskey, passkeyAddress, onPasskeySignIn, }: WalletSelectorProps): React.ReactPortal | null;
|
|
1094
|
+
declare function WalletSelector({ provider, open, onClose, onConnect, theme, networks, mode, socialAuthMethods, onGoogleSignIn, onKingsChatSignIn, onEmailStart, onEmailVerify, onPhoneStart, onPhoneVerify, customAuthLabel, onCustomAuthSignIn, canUsePasskey, passkeyAddress, onPasskeySignIn, }: WalletSelectorProps): React.ReactPortal | null;
|
|
1072
1095
|
|
|
1073
1096
|
type Theme = "light" | "dark" | "auto";
|
|
1074
1097
|
interface SocialAuthState {
|
|
@@ -1131,7 +1154,11 @@ interface SocialWalletModalProps {
|
|
|
1131
1154
|
codeRequired: true;
|
|
1132
1155
|
}>;
|
|
1133
1156
|
onEmailVerify: (email: string, code: string) => Promise<void>;
|
|
1134
|
-
|
|
1157
|
+
onPhoneStart?: (phone: string) => Promise<{
|
|
1158
|
+
codeRequired: true;
|
|
1159
|
+
}>;
|
|
1160
|
+
onPhoneVerify?: (phone: string, code: string) => Promise<void>;
|
|
1161
|
+
authMethods?: Array<"google" | "email" | "phone" | "kingschat">;
|
|
1135
1162
|
customAuthLabel?: string;
|
|
1136
1163
|
onCustomAuthSignIn?: () => Promise<void>;
|
|
1137
1164
|
canUsePasskey?: boolean;
|
|
@@ -1148,7 +1175,7 @@ interface SocialWalletModalProps {
|
|
|
1148
1175
|
rpcUrls?: Record<string, string>;
|
|
1149
1176
|
chains?: string[];
|
|
1150
1177
|
}
|
|
1151
|
-
declare function SocialWalletModal({ open, onClose, theme, socialAuth, onUnlock, onDisconnect, onGoogleSignIn, onKingsChatSignIn, onEmailStart, onEmailVerify, authMethods, customAuthLabel, onCustomAuthSignIn, canUsePasskey, passkeyAddress, onPasskeySignIn, onRotateShares, onExportPortableBackup, rpcUrls, chains, }: SocialWalletModalProps): React.ReactPortal | null;
|
|
1178
|
+
declare function SocialWalletModal({ open, onClose, theme, socialAuth, onUnlock, onDisconnect, onGoogleSignIn, onKingsChatSignIn, onEmailStart, onEmailVerify, onPhoneStart, onPhoneVerify, authMethods, customAuthLabel, onCustomAuthSignIn, canUsePasskey, passkeyAddress, onPasskeySignIn, onRotateShares, onExportPortableBackup, rpcUrls, chains, }: SocialWalletModalProps): React.ReactPortal | null;
|
|
1152
1179
|
|
|
1153
1180
|
declare function DecaneMark({ size, muted }: {
|
|
1154
1181
|
size?: number;
|
|
@@ -1178,17 +1205,24 @@ declare function useSocialAuth(): {
|
|
|
1178
1205
|
isCreatingWallet: boolean;
|
|
1179
1206
|
needsReconnect: boolean;
|
|
1180
1207
|
googleLoading: boolean;
|
|
1208
|
+
kingschatLoading: boolean;
|
|
1181
1209
|
emailLoading: boolean;
|
|
1210
|
+
phoneLoading: boolean;
|
|
1182
1211
|
tokenLoading: boolean;
|
|
1183
1212
|
customLoading: boolean;
|
|
1184
1213
|
customAuthLabel: string | undefined;
|
|
1185
1214
|
error: string | null;
|
|
1186
1215
|
clearError: () => void;
|
|
1187
1216
|
signInWithGoogle: () => Promise<void>;
|
|
1217
|
+
signInWithKingsChat: () => Promise<void>;
|
|
1188
1218
|
sendEmailCode: (email: string) => Promise<{
|
|
1189
1219
|
codeRequired: true;
|
|
1190
1220
|
}>;
|
|
1191
1221
|
confirmEmailCode: (email: string, code: string) => Promise<void>;
|
|
1222
|
+
sendPhoneCode: (phone: string) => Promise<{
|
|
1223
|
+
codeRequired: true;
|
|
1224
|
+
}>;
|
|
1225
|
+
confirmPhoneCode: (phone: string, code: string) => Promise<void>;
|
|
1192
1226
|
signInWithToken: (token: string, opts?: {
|
|
1193
1227
|
providerId?: string;
|
|
1194
1228
|
}) => Promise<void>;
|