@bluxcc/core 0.3.0 → 0.3.2

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.
@@ -0,0 +1,2 @@
1
+ declare const OtherSocials: () => import("react/jsx-runtime").JSX.Element;
2
+ export default OtherSocials;
@@ -0,0 +1,7 @@
1
+ type SocialLoginButtonProps = {
2
+ provider: string;
3
+ onClick: (provider: string) => void;
4
+ nameOnly?: boolean;
5
+ };
6
+ declare const SocialLoginButton: ({ provider, onClick, nameOnly, }: SocialLoginButtonProps) => import("react/jsx-runtime").JSX.Element;
7
+ export default SocialLoginButton;
@@ -0,0 +1,6 @@
1
+ type TelegramWidgetProps = {
2
+ botUsername: string;
3
+ onAuth: (user: Record<string, unknown>) => void;
4
+ };
5
+ declare const TelegramWidget: ({ botUsername, onAuth }: TelegramWidgetProps) => import("react/jsx-runtime").JSX.Element;
6
+ export default TelegramWidget;
@@ -1,5 +1,5 @@
1
1
  declare const getTransactionDetails: (xdr: string, network: string) => {
2
- action: "accountMerge" | "allowTrust" | "beginSponsoringFutureReserves" | "bumpSequence" | "changeTrust" | "claimClaimableBalance" | "clawbackClaimableBalance" | "clawback" | "createAccount" | "createClaimableBalance" | "createPassiveSellOffer" | "endSponsoringFutureReserves" | "extendFootprintTtl" | "inflation" | "invokeHostFunction" | "liquidityPoolDeposit" | "liquidityPoolWithdraw" | "manageBuyOffer" | "manageData" | "manageSellOffer" | "pathPaymentStrictReceive" | "pathPaymentStrictSend" | "payment" | "restoreFootprint" | "revokeAccountSponsorship" | "revokeClaimableBalanceSponsorship" | "revokeDataSponsorship" | "revokeLiquidityPoolSponsorship" | "revokeOfferSponsorship" | "revokeSignerSponsorship" | "revokeTrustlineSponsorship" | "setOptions" | "setTrustLineFlags";
2
+ action: "pathPaymentStrictSend" | "pathPaymentStrictReceive" | "payment" | "createAccount" | "createClaimableBalance" | "accountMerge" | "allowTrust" | "beginSponsoringFutureReserves" | "bumpSequence" | "changeTrust" | "claimClaimableBalance" | "clawbackClaimableBalance" | "clawback" | "createPassiveSellOffer" | "endSponsoringFutureReserves" | "extendFootprintTtl" | "inflation" | "invokeHostFunction" | "liquidityPoolDeposit" | "liquidityPoolWithdraw" | "manageBuyOffer" | "manageData" | "manageSellOffer" | "restoreFootprint" | "revokeAccountSponsorship" | "revokeClaimableBalanceSponsorship" | "revokeDataSponsorship" | "revokeLiquidityPoolSponsorship" | "revokeOfferSponsorship" | "revokeSignerSponsorship" | "revokeTrustlineSponsorship" | "setOptions" | "setTrustLineFlags";
3
3
  operations: number;
4
4
  sender: string;
5
5
  receiver: string;
@@ -0,0 +1,26 @@
1
+ import { Horizon } from '@stellar/stellar-sdk';
2
+ import { IAsset } from '../types';
3
+ export type MoneygramMemoType = 'text' | 'id' | 'hash';
4
+ export type MoneygramSession = {
5
+ url: string;
6
+ id: string;
7
+ token: string;
8
+ transferServer: string;
9
+ };
10
+ export type MoneygramWithdrawDetails = {
11
+ amount: string;
12
+ destination: string;
13
+ memo: string;
14
+ memoType: MoneygramMemoType;
15
+ };
16
+ export declare const isMoneygramNetwork: (network: string) => boolean;
17
+ export declare const moneygramUsdc: (network: string) => IAsset;
18
+ export declare const startMoneygramWithdraw: ({ address, network, lang, sign, signal, }: {
19
+ address: string;
20
+ network: string;
21
+ lang?: string;
22
+ sign: (xdr: string) => Promise<string>;
23
+ signal?: AbortSignal;
24
+ }) => Promise<MoneygramSession>;
25
+ export declare const waitForMoneygramTransfer: (session: MoneygramSession, signal?: AbortSignal) => Promise<MoneygramWithdrawDetails>;
26
+ export declare const assertHorizon: (horizon?: Horizon.Server) => Horizon.Server;
@@ -1,4 +1,4 @@
1
- import { Horizon } from "@stellar/stellar-sdk";
2
- import { IAsset } from "../types";
3
- declare const paymentTransaction: (memo: string, amount: string, destinationAddress: string, asset: IAsset, sourceAddress: string, server: Horizon.Server, networkPassphrase: string) => Promise<string>;
1
+ import { Horizon } from '@stellar/stellar-sdk';
2
+ import { IAsset } from '../types';
3
+ declare const paymentTransaction: (memo: string, amount: string, destinationAddress: string, asset: IAsset, sourceAddress: string, server: Horizon.Server, networkPassphrase: string, memoType?: "text" | "id" | "hash") => Promise<string>;
4
4
  export default paymentTransaction;
package/dist/store.d.ts CHANGED
@@ -1,8 +1,7 @@
1
1
  import { Horizon, rpc } from '@stellar/stellar-sdk';
2
2
  import { SignClient } from '@walletconnect/sign-client/dist/types/client';
3
3
  import { Route } from './enums';
4
- import { UseBalancesResult } from './hooks/useBalances';
5
- import { UseTransactionsResult } from './hooks/useTransactions';
4
+ import type { UseBalancesResult } from './hooks/useBalances';
6
5
  import Emitter, { BluxEventMap } from './utils/events';
7
6
  import { IAsset, IWallet, IAppearance, AssetMetaMap, ICustomToken, ICustomTokens, ISignMessage, IInternalConfig, ISendTransaction, AuthenticateApiResponse, ISignAuthEntry } from './types';
8
7
  export type AlertType = 'error' | 'success' | 'warn' | 'none' | 'copy';
@@ -78,7 +77,7 @@ export interface IStoreProperties {
78
77
  loginError?: string;
79
78
  balances: UseBalancesResult;
80
79
  balanceValues: Record<string, string>;
81
- transactions: UseTransactionsResult;
80
+ accountRefreshNonce: number;
82
81
  selectAsset: ISelectAsset;
83
82
  detailsAsset?: IAsset;
84
83
  customTokens: ICustomTokens;
@@ -93,6 +92,7 @@ export interface IStoreProperties {
93
92
  }
94
93
  export interface IStoreMethods {
95
94
  connectEmail: (email: string) => void;
95
+ connectSms: (phone: string) => void;
96
96
  connectSocial: (provider: string) => void;
97
97
  connectWallet: (walletName: string) => void;
98
98
  connectWalletSuccessful: (publicKey: string, passphrase: string) => void;
@@ -120,7 +120,7 @@ export interface IStoreMethods {
120
120
  setCustomTokenBalances: (network: 'mainnet' | 'testnet', balances: Record<number, string>) => void;
121
121
  setBalancesTab: (tab: 'assets' | 'tokens') => void;
122
122
  setDetailsToken: (token: ICustomToken | undefined) => void;
123
- setTransactions: (transactions: UseTransactionsResult) => void;
123
+ bumpAccountRefresh: () => void;
124
124
  setWalletConnectClient: (client: SignClient, connection: any) => void;
125
125
  cleanUp: (method: 'sendTransaction' | 'signMessage' | 'signAuthEntry') => void;
126
126
  setNetworkSyncDisabled: (isDisabled: boolean) => void;
package/dist/types.d.ts CHANGED
@@ -10,7 +10,7 @@ type LooseString = string & {};
10
10
  /** Block explorer used to build account/transaction links. */
11
11
  export type IExplorer = 'steexp' | 'stellarchain' | 'stellarexpert' | 'lumenscan';
12
12
  /** Social login providers supported by Blux. */
13
- export type ISocialProvider = 'google';
13
+ export type ISocialProvider = 'google' | 'apple' | 'discord' | 'telegram' | 'meta' | 'github' | 'farcaster' | 'tiktok' | 'linkedin' | 'twitch' | 'kick' | 'spotify' | 'instagram' | 'microsoft' | 'gitlab' | 'twitter' | 'steam';
14
14
  /** Login methods to offer in the modal. */
15
15
  export type ILoginMethods = Array<'wallet' | 'sms' | 'email' | 'passkey' | ISocialProvider>;
16
16
  /** Canonical names of the wallets Blux can integrate with. */
@@ -42,7 +42,7 @@ export interface ITrezorMetaData {
42
42
  }
43
43
  /** Configuration passed to {@link createConfig}. */
44
44
  export interface IConfig {
45
- /** Your Blux app id, from the Blux dashboard. Required for email/passkey/social login. */
45
+ /** Your Blux app id, from the Blux dashboard. Required for email/SMS/passkey/social login. */
46
46
  appId: string;
47
47
  /** Display name of your app, shown in wallet prompts and UI. */
48
48
  appName: string;
@@ -56,11 +56,11 @@ export interface IConfig {
56
56
  lang?: LanguageKey;
57
57
  /** Block explorer used for links. Defaults to `'stellarchain'`. */
58
58
  explorer?: IExplorer;
59
- /** Persist the session across reloads. Defaults to `false`. */
59
+ /** Persist the session across page reloads. Defaults to `false` and should remain `false` in most scenarios. */
60
60
  isPersistent?: boolean;
61
61
  /** Show Blux's built-in signing/approval UIs. When `false`, signing happens headlessly. Defaults to `true`. */
62
62
  showWalletUIs?: boolean;
63
- /** Login methods to offer. Defaults to `['wallet']`. */
63
+ /** Login methods to offer. Defaults to `['wallet']`. `'sms'` is shown only when `/auth/validate` reports a paid plan. */
64
64
  loginMethods?: Array<ILoginMethods[number] | LooseString>;
65
65
  /** Custom Horizon/Soroban endpoints per network; required for custom networks. */
66
66
  transports?: ITransports;
@@ -259,6 +259,12 @@ export interface ISignAuthEntry {
259
259
  export interface ISocialConfigEntry {
260
260
  provider: string;
261
261
  displayName: string;
262
+ /** Login mechanism from /auth/validate: oauth2, steam, farcaster, or telegram. */
263
+ kind?: string;
264
+ /** Telegram bot username the on-page widget needs; empty for other providers. */
265
+ publicId?: string;
266
+ /** Telegram Mini App / in-app login is enabled for this project. */
267
+ miniApps?: boolean;
262
268
  }
263
269
  export interface AuthenticateApiResponse {
264
270
  isValid: boolean;
@@ -267,5 +273,9 @@ export interface AuthenticateApiResponse {
267
273
  terms: string;
268
274
  socials: string[];
269
275
  socialsConfig: ISocialConfigEntry[];
276
+ /** Entitled billing plan of the account that owns this app. */
277
+ plan: string;
278
+ /** True when the account is on a paid plan and may offer SMS login. */
279
+ smsEnabled: boolean;
270
280
  }
271
281
  export {};
@@ -9,7 +9,7 @@ type ApiPasskeyChallenge = {
9
9
  export declare const authenticateAppId: (appId: string) => Promise<AuthenticateApiResponse>;
10
10
  export declare const apiPasskeyChallenge: (appId: string, authValue: string) => Promise<ApiPasskeyChallenge>;
11
11
  export declare const apiPasskeyVerify: (appId: string, challenge: ApiPasskeyChallenge, passkeyResult: PasskeyFlowResult) => Promise<string>;
12
- export declare const apiSendOtp: (appId: string, authValue: string) => Promise<boolean>;
12
+ export declare const apiSendOtp: (appId: string, authValue: string, authMethod?: "email" | "sms") => Promise<boolean>;
13
13
  type ApiWalletChallenge = {
14
14
  challenge_xdr?: string;
15
15
  challenge?: string;
@@ -48,4 +48,5 @@ export type ApiGroupedTokens = {
48
48
  export declare const apiGetTokens: (JWT: string) => Promise<ApiGroupedTokens>;
49
49
  export declare const apiAddToken: (JWT: string, contractAddress: string, network: "mainnet" | "testnet") => Promise<ApiTokenView>;
50
50
  export declare const apiDeleteToken: (JWT: string, tokenId: number) => Promise<boolean>;
51
+ export declare const apiTelegramLogin: (appId: string, payload: Record<string, unknown>) => Promise<string>;
51
52
  export {};
@@ -2,7 +2,6 @@ import { Asset, Horizon } from '@stellar/stellar-sdk';
2
2
  import translations from '../constants/locales';
3
3
  import { Route, SupportedWallet } from '../enums';
4
4
  import { IAsset, IWallet, IExplorer, LanguageKey, ITransports, IWalletNames, ILoginMethods } from '../types';
5
- import { INetworkTransports } from '../constants/networkDetails';
6
5
  export declare const bufferToBase64Url: (buf: ArrayBuffer) => string;
7
6
  export declare const base64UrlToBuffer: (value: string) => ArrayBuffer;
8
7
  export declare const getAssetTitle: (asset: Horizon.HorizonApi.BalanceLineNative | Horizon.HorizonApi.BalanceLineAsset<"credit_alphanum4"> | Horizon.HorizonApi.BalanceLineAsset<"credit_alphanum12"> | Horizon.HorizonApi.BalanceLineLiquidityPool) => string;
@@ -34,7 +33,7 @@ export declare const getExplorerUrl: (networkPassphrase: string, explorerProvide
34
33
  export declare const getMappedWallets: (walletNames: IWalletNames) => Promise<IWallet[]>;
35
34
  export declare const getRecentConnectionMethod: () => SupportedWallet[];
36
35
  export declare const getNetworkByPassphrase: (passphrase: string) => string;
37
- export declare const getNetworkRpc: (network: string, transports: ITransports) => INetworkTransports;
36
+ export { getNetworkRpc } from './networkRpc';
38
37
  export declare const canonicalWalletName: (name: string) => string;
39
38
  export declare const loginMethodsIncludeWallet: (loginMethods: ILoginMethods | string[] | undefined) => boolean;
40
39
  export declare const getSortedCheckedWallets: (wallets: IWallet[], priorityNames?: string[]) => IWallet[];
@@ -55,3 +54,4 @@ export declare const getNetworkNamesFromPassphrase: (userNetworks: string[]) =>
55
54
  export declare const validateOrderWallets: (orderWallets: string[] | undefined) => string[];
56
55
  export declare const validateNetworkOptions: (networks: string[], defaultNetwork: string | undefined, transports: ITransports | undefined) => void;
57
56
  export declare const validateInput: (type: string, value: string) => boolean;
57
+ export declare const isUSCanadaPhone: (raw: string) => boolean;
@@ -0,0 +1,7 @@
1
+ import { ITransports } from '../types';
2
+ import { INetworkTransports } from '../constants/networkDetails';
3
+ /**
4
+ * Resolves Horizon and Soroban URLs for a passphrase, overlaying any custom
5
+ * transports from config.
6
+ */
7
+ export declare const getNetworkRpc: (network: string, transports: ITransports) => INetworkTransports;
@@ -1,12 +1,21 @@
1
+ import type { ComponentType } from 'react';
1
2
  import CDNFiles from '../constants/cdnFiles';
2
3
  import { ILoginMethods, AuthenticateApiResponse } from '../types';
3
4
  type SocialProviderMeta = {
4
5
  displayName: string;
5
- icon: CDNFiles;
6
+ icon: CDNFiles | ComponentType<{
7
+ fill?: string;
8
+ }>;
6
9
  };
7
10
  export declare const SOCIAL_PROVIDERS: Record<string, SocialProviderMeta>;
11
+ export declare const canonicalSocialName: (method: string) => string;
8
12
  export declare const isSocialProvider: (method: string) => boolean;
13
+ export declare const getSocialDisplayName: (provider: string) => string;
9
14
  export declare const getEnabledSocials: (loginMethods: ILoginMethods | string[], apiResponse?: AuthenticateApiResponse) => string[];
15
+ export declare const telegramBotUsername: (apiResponse?: AuthenticateApiResponse) => string;
16
+ export declare const telegramMiniAppsEnabled: (apiResponse?: AuthenticateApiResponse) => boolean;
17
+ export declare const telegramWebAppInitData: () => string;
18
+ export declare const isTelegramLogin: (provider: string, apiResponse?: AuthenticateApiResponse) => boolean;
10
19
  export type ISocialSession = {
11
20
  provider: string;
12
21
  popup: Window | null;
@@ -15,5 +24,6 @@ export type ISocialSession = {
15
24
  export declare const getActiveSocialSession: () => ISocialSession | null;
16
25
  export declare const cancelActiveSocialSession: () => void;
17
26
  export declare const beginSocialLogin: (provider: string, appId: string) => ISocialSession;
27
+ export declare const startSocialLogin: (provider: string, appId: string, apiResponse?: AuthenticateApiResponse) => void;
18
28
  export declare const awaitSocialLogin: (session: ISocialSession) => Promise<string>;
19
29
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bluxcc/core",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "homepage": "https://blux.cc",
5
5
  "description": "Blux is a wallet infra for the Stellar network",
6
6
  "type": "module",