@bluxcc/core 0.3.2 → 0.3.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/constants/assets.d.ts +10 -1
- package/dist/exports/blux.d.ts +11 -17
- package/dist/exports/exportedStore.d.ts +4 -0
- package/dist/exports/index.d.ts +2 -1
- package/dist/exports/loginMethods.d.ts +93 -0
- package/dist/index.cjs.js +14 -14
- package/dist/index.esm.js +14 -14
- package/dist/pages/Onboarding/Passkey/index.d.ts +0 -7
- package/dist/stellar/processes/connectWalletProcess.d.ts +10 -2
- package/dist/stellar/processes/hydrateUserFromJwt.d.ts +8 -0
- package/dist/store.d.ts +9 -1
- package/dist/types.d.ts +7 -1
- package/dist/utils/api.d.ts +1 -1
- package/dist/utils/passkey.d.ts +14 -0
- package/package.json +1 -1
|
@@ -23,4 +23,13 @@ export declare const MAINNET_EURC: {
|
|
|
23
23
|
assetBalance: string;
|
|
24
24
|
assetType: string;
|
|
25
25
|
};
|
|
26
|
-
export declare const
|
|
26
|
+
export declare const isPublicNetwork: (network: string) => boolean;
|
|
27
|
+
export declare const isTestnetNetwork: (network: string) => boolean;
|
|
28
|
+
/** Circle USDC for the active network. Testnet uses Circle's test issuer. */
|
|
29
|
+
export declare const usdcForNetwork: (network: string) => IAsset;
|
|
30
|
+
/**
|
|
31
|
+
* Curated logos are pubnet-only. Map a well-known testnet (or same-network)
|
|
32
|
+
* issuer to the pubnet issuer whose icon we should reuse.
|
|
33
|
+
*/
|
|
34
|
+
export declare const pubnetLogoIssuer: (assetCode: string, assetIssuer: string) => string | undefined;
|
|
35
|
+
export declare const getSuggestedAssets: (network: string) => IAsset[];
|
package/dist/exports/blux.d.ts
CHANGED
|
@@ -1,18 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* @param isSilent - When `true`, tries to restore a recent session without opening the modal.
|
|
6
|
-
* @returns A promise that resolves to the authenticated user.
|
|
7
|
-
*/
|
|
8
|
-
export declare const _login: (isSilent: boolean) => Promise<IUser>;
|
|
9
|
-
/**
|
|
10
|
-
* Opens the Blux modal so the user can connect a wallet or sign in, resolving
|
|
11
|
-
* once authenticated. Waits for the SDK to finish initializing first.
|
|
12
|
-
*
|
|
13
|
-
* @returns The authenticated user.
|
|
14
|
-
*/
|
|
15
|
-
export declare const login: () => Promise<IUser>;
|
|
1
|
+
import { loginWallet } from './loginMethods';
|
|
2
|
+
export { _login } from './loginMethods';
|
|
3
|
+
export { login, loginEmail, loginOAuth, loginPasskey, loginSms, loginWallet, } from './loginMethods';
|
|
4
|
+
export type { LoginCodeApi, LoginCodeFn, LoginOAuthOptions, } from './loginMethods';
|
|
16
5
|
/**
|
|
17
6
|
* Signs a transaction XDR with the connected wallet, without submitting it.
|
|
18
7
|
*
|
|
@@ -59,7 +48,12 @@ export declare const signAuthEntry: (authEntry: string, options?: {
|
|
|
59
48
|
* Each method carries its own documentation; the getters expose live auth state.
|
|
60
49
|
*/
|
|
61
50
|
export declare const blux: {
|
|
62
|
-
login: () => Promise<IUser>;
|
|
51
|
+
login: () => Promise<import("../store").IUser>;
|
|
52
|
+
loginEmail: import("./loginMethods").LoginCodeFn;
|
|
53
|
+
loginSms: import("./loginMethods").LoginCodeFn;
|
|
54
|
+
loginOAuth: (provider: import("../types").ISocialProvider | string, options?: import("./loginMethods").LoginOAuthOptions) => Promise<import("../store").IUser>;
|
|
55
|
+
loginPasskey: () => Promise<import("../store").IUser>;
|
|
56
|
+
loginWallet: typeof loginWallet;
|
|
63
57
|
logout: () => void;
|
|
64
58
|
fundMe: () => void;
|
|
65
59
|
profile: () => void;
|
|
@@ -79,5 +73,5 @@ export declare const blux: {
|
|
|
79
73
|
/** Whether a user is currently authenticated. */
|
|
80
74
|
readonly isAuthenticated: boolean;
|
|
81
75
|
/** The currently authenticated user, or `undefined` when logged out. */
|
|
82
|
-
readonly user: IUser | undefined;
|
|
76
|
+
readonly user: import("../store").IUser | undefined;
|
|
83
77
|
};
|
|
@@ -8,6 +8,10 @@ export interface IExportedStore {
|
|
|
8
8
|
isAuthenticated: boolean;
|
|
9
9
|
};
|
|
10
10
|
stellar?: IStellarConfig;
|
|
11
|
+
/** Installed wallets currently offered in the picker. */
|
|
12
|
+
wallets: Array<{
|
|
13
|
+
name: string;
|
|
14
|
+
}>;
|
|
11
15
|
}
|
|
12
16
|
export declare const exportedStore: import("zustand").StoreApi<IExportedStore>;
|
|
13
17
|
export declare const syncExportedStore: (mainStore: typeof store) => () => void;
|
package/dist/exports/index.d.ts
CHANGED
|
@@ -2,11 +2,12 @@ import { BluxEventMap, ReadOnlyEmitter } from '../utils/events';
|
|
|
2
2
|
export type { IAppearance, IConfig, IExplorer, ILoginMethods, IServers, ISocialProvider, ITrezorMetaData, ITransports, IWalletConnectMetaData, IWalletNames, LanguageKey, } from '../types';
|
|
3
3
|
export type { IUser } from '../store';
|
|
4
4
|
export type { IExportedStore } from './exportedStore';
|
|
5
|
+
export type { LoginCodeApi, LoginCodeFn, LoginOAuthOptions } from './blux';
|
|
5
6
|
export { Asset } from '@stellar/stellar-sdk';
|
|
6
7
|
export * as StellarSdk from '@stellar/stellar-sdk';
|
|
7
8
|
export * from './core';
|
|
8
9
|
export * as core from './core';
|
|
9
|
-
export { blux } from './blux';
|
|
10
|
+
export { blux, loginEmail, loginSms, loginOAuth, loginPasskey, loginWallet, } from './blux';
|
|
10
11
|
export { BluxEvent } from '../utils/events';
|
|
11
12
|
export { getState, subscribe, getInitialState, useExportedStore, } from './exportedStore';
|
|
12
13
|
export declare const setAppearance: (newAppearance: Partial<import("../types").IAppearance>) => void;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { ISocialProvider } from '../types';
|
|
2
|
+
import { IUser } from '../store';
|
|
3
|
+
/** sendCode + loginWithCode pair returned by {@link loginEmail} / {@link loginSms}. */
|
|
4
|
+
export type LoginCodeApi = {
|
|
5
|
+
/** Send a one-time code to the identifier (email address or phone number). */
|
|
6
|
+
sendCode: (identifier: string) => Promise<void>;
|
|
7
|
+
/**
|
|
8
|
+
* Verify the one-time code and complete login.
|
|
9
|
+
*
|
|
10
|
+
* @returns The authenticated user.
|
|
11
|
+
*/
|
|
12
|
+
loginWithCode: (identifier: string, code: string) => Promise<IUser>;
|
|
13
|
+
};
|
|
14
|
+
/** {@link loginEmail} / {@link loginSms}: call it for the hook-shaped pair, or use the methods directly. */
|
|
15
|
+
export type LoginCodeFn = (() => LoginCodeApi) & LoginCodeApi;
|
|
16
|
+
/**
|
|
17
|
+
* Internal login driver. Prefer the public {@link login}.
|
|
18
|
+
*
|
|
19
|
+
* @param isSilent - When `true`, tries to restore a recent session without opening the modal.
|
|
20
|
+
* @returns A promise that resolves to the authenticated user.
|
|
21
|
+
*/
|
|
22
|
+
export declare const _login: (isSilent: boolean) => Promise<IUser>;
|
|
23
|
+
/**
|
|
24
|
+
* Opens the Blux modal so the user can connect a wallet or sign in, resolving
|
|
25
|
+
* once authenticated. Waits for the SDK to finish initializing first.
|
|
26
|
+
*
|
|
27
|
+
* @returns The authenticated user.
|
|
28
|
+
*/
|
|
29
|
+
export declare const login: () => Promise<IUser>;
|
|
30
|
+
/**
|
|
31
|
+
* Headless email login. Mirrors Privy's `sendCode` + `loginWithCode` so a React
|
|
32
|
+
* hook can wrap this directly:
|
|
33
|
+
*
|
|
34
|
+
* ```ts
|
|
35
|
+
* const { sendCode, loginWithCode } = blux.loginEmail();
|
|
36
|
+
* await sendCode('user@example.com');
|
|
37
|
+
* const user = await loginWithCode('user@example.com', '123456');
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* `blux.loginEmail.sendCode(...)` works the same way without calling the function.
|
|
41
|
+
* Does not open the Blux modal; render your own email / OTP UI.
|
|
42
|
+
*/
|
|
43
|
+
export declare const loginEmail: LoginCodeFn;
|
|
44
|
+
/**
|
|
45
|
+
* Headless SMS login. Same shape as {@link loginEmail}:
|
|
46
|
+
*
|
|
47
|
+
* ```ts
|
|
48
|
+
* const { sendCode, loginWithCode } = blux.loginSms();
|
|
49
|
+
* await sendCode('+15555555555');
|
|
50
|
+
* const user = await loginWithCode('+15555555555', '123456');
|
|
51
|
+
* ```
|
|
52
|
+
*
|
|
53
|
+
* Does not open the Blux modal. SMS must be in `loginMethods` and the app must
|
|
54
|
+
* be on a paid plan (`smsEnabled` from `/auth/validate`).
|
|
55
|
+
*/
|
|
56
|
+
export declare const loginSms: LoginCodeFn;
|
|
57
|
+
export type LoginOAuthOptions = {
|
|
58
|
+
/**
|
|
59
|
+
* Telegram Login Widget user object, or `{ init_data }` from a Telegram Mini
|
|
60
|
+
* App. Required for Telegram unless Mini App init data is already on `window`.
|
|
61
|
+
*/
|
|
62
|
+
telegramUser?: Record<string, unknown>;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Headless social login. Opens the provider popup (must run from a click
|
|
66
|
+
* handler so the browser does not block it) and resolves with the user.
|
|
67
|
+
*
|
|
68
|
+
* Telegram cannot use that popup (the bot is bound to this origin). Pass the
|
|
69
|
+
* widget payload as `options.telegramUser`, or call this from a Mini App where
|
|
70
|
+
* init data is present. To show Blux's Telegram widget instead, use {@link login}.
|
|
71
|
+
*
|
|
72
|
+
* @param provider - A social name from {@link ISocialProvider} (`'google'`, `'apple'`, ...).
|
|
73
|
+
* @param options - Telegram-only extras.
|
|
74
|
+
*/
|
|
75
|
+
export declare const loginOAuth: (provider: ISocialProvider | string, options?: LoginOAuthOptions) => Promise<IUser>;
|
|
76
|
+
/**
|
|
77
|
+
* Headless passkey login. Triggers the WebAuthn ceremony (register on first
|
|
78
|
+
* visit, assert on later visits) and resolves with the user. Must run from a
|
|
79
|
+
* user gesture. Does not open the Blux modal.
|
|
80
|
+
*/
|
|
81
|
+
export declare const loginPasskey: () => Promise<IUser>;
|
|
82
|
+
/**
|
|
83
|
+
* Wallet login.
|
|
84
|
+
*
|
|
85
|
+
* - No argument: opens the Blux onboarding modal showing only the scrollable
|
|
86
|
+
* wallet list (email / SMS / social / passkey rows are hidden).
|
|
87
|
+
* - With a wallet name (`'freighter'`, `'rabet'`, ...): opens that wallet's
|
|
88
|
+
* own prompt and never the Blux modal. WalletConnect is the exception and
|
|
89
|
+
* still uses the Blux QR screen.
|
|
90
|
+
*
|
|
91
|
+
* @returns The authenticated user.
|
|
92
|
+
*/
|
|
93
|
+
export declare function loginWallet(walletName?: string): Promise<IUser>;
|