@bluxcc/core 0.2.1 → 0.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.
@@ -0,0 +1,2 @@
1
+ declare const AcceptTermsAndPrivacy: () => import("react/jsx-runtime").JSX.Element;
2
+ export default AcceptTermsAndPrivacy;
@@ -0,0 +1,2 @@
1
+ declare function FundMeCrypto(): import("react/jsx-runtime").JSX.Element;
2
+ export default FundMeCrypto;
@@ -0,0 +1,2 @@
1
+ declare function FundMe(): import("react/jsx-runtime").JSX.Element;
2
+ export default FundMe;
@@ -1,4 +1,4 @@
1
- import { IStore } from '../../store';
2
1
  import { IWallet } from '../../types';
2
+ import { IStore } from '../../store';
3
3
  declare const connectWalletProcess: (store: IStore, wallet: IWallet) => Promise<void>;
4
4
  export default connectWalletProcess;
@@ -0,0 +1,3 @@
1
+ export declare const completeLoginProcess: () => void;
2
+ declare const continueLoginProcess: () => void;
3
+ export default continueLoginProcess;
@@ -0,0 +1,2 @@
1
+ declare const loginResolver: () => void;
2
+ export default loginResolver;
package/dist/store.d.ts CHANGED
@@ -3,9 +3,19 @@ import { SignClient } from '@walletconnect/sign-client/dist/types/client';
3
3
  import { Route } from './enums';
4
4
  import { UseBalancesResult } from './hooks/useBalances';
5
5
  import { UseTransactionsResult } from './hooks/useTransactions';
6
- import { IAsset, IWallet, ISignMessage, IInternalConfig, ISendTransaction, IAppearance, AuthenticateApiResponse } from './types';
7
- export type WaitingStatus = 'login' | 'sendTransaction' | 'signMessage';
6
+ import Emitter, { BluxEventMap } from './utils/events';
7
+ import { IAsset, IWallet, IAppearance, ISignMessage, IInternalConfig, ISendTransaction, AuthenticateApiResponse } from './types';
8
8
  export type AlertType = 'error' | 'success' | 'warn' | 'none' | 'copy';
9
+ export type WaitingStatus = 'login' | 'sendTransaction' | 'signMessage';
10
+ export interface ILogo {
11
+ id: number;
12
+ name: string;
13
+ content: string;
14
+ default_values?: {
15
+ name: string;
16
+ value: string;
17
+ }[];
18
+ }
9
19
  export interface IUser {
10
20
  address: string;
11
21
  identifier?: string;
@@ -30,7 +40,15 @@ export interface ISelectAsset {
30
40
  swapToAsset: IAsset;
31
41
  swapFromAsset: IAsset;
32
42
  }
43
+ export interface ILoginPromise {
44
+ isSilent: boolean;
45
+ promise: Promise<IUser>;
46
+ rejecter: (reason: any) => void;
47
+ resolver: (value: IUser) => void;
48
+ }
33
49
  export interface IStoreProperties {
50
+ logos: ILogo[] | null;
51
+ emitter: Emitter<BluxEventMap>;
34
52
  auth?: IAuth;
35
53
  config: IInternalConfig;
36
54
  user?: IUser;
@@ -53,6 +71,7 @@ export interface IStoreProperties {
53
71
  stellar?: IStellarConfig;
54
72
  sendTransaction?: ISendTransaction;
55
73
  signMessage?: ISignMessage;
74
+ login?: ILoginPromise;
56
75
  balances: UseBalancesResult;
57
76
  transactions: UseTransactionsResult;
58
77
  selectAsset: ISelectAsset;
@@ -90,6 +109,8 @@ export interface IStoreMethods {
90
109
  setApiResponse: (res: AuthenticateApiResponse) => void;
91
110
  setAuth: (a: IAuth) => void;
92
111
  setIsAuthenticated: (isAuthenticated: boolean) => void;
112
+ setLogin: (loginDetails: ILoginPromise | undefined) => void;
113
+ setLogos: (logos: ILogo[]) => void;
93
114
  }
94
115
  export interface IStore extends IStoreProperties, IStoreMethods {
95
116
  }
package/dist/types.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Horizon } from '@stellar/stellar-sdk';
2
2
  import { SupportedWallet } from './enums';
3
- export type LanguageKey = 'en' | 'es';
3
+ export type LanguageKey = 'en';
4
4
  export type ITransports = Record<string, IServers>;
5
5
  export type IExplorer = 'steexp' | 'stellarchain' | 'stellarexpert' | 'lumenscan';
6
6
  export type ILoginMethods = Array<'wallet' | 'sms' | 'email' | 'passkey'>;
@@ -120,5 +120,7 @@ export interface ISignMessage {
120
120
  export interface AuthenticateApiResponse {
121
121
  isValid: boolean;
122
122
  message: string;
123
+ privacyPolicy: string;
124
+ terms: string;
123
125
  }
124
126
  export {};
@@ -1,7 +1,8 @@
1
- import { AuthenticateApiResponse } from '../types';
2
1
  import { IUser } from '../store';
2
+ import { AuthenticateApiResponse } from '../types';
3
3
  export declare const authenticateAppId: (appId: string) => Promise<AuthenticateApiResponse>;
4
4
  export declare const apiSendOtp: (appId: string, authValue: string) => Promise<boolean>;
5
+ export declare const apiStoreWalletConnection: (appId: string, walletName: string, walletAddress: string) => Promise<boolean>;
5
6
  export declare const apiVerifyOtp: (appId: string, user: IUser, otp: string) => Promise<string>;
6
7
  type ApiGetUserResponse = {
7
8
  auth_method: string;
@@ -9,12 +10,6 @@ type ApiGetUserResponse = {
9
10
  public_key: string;
10
11
  };
11
12
  export declare const apiGetUser: (JWT: string) => Promise<ApiGetUserResponse>;
12
- type ApiSignMessageResponse = {
13
- signature?: string;
14
- };
15
- type ApiSignTransactionResponse = {
16
- signed_xdr?: string;
17
- };
18
- export declare const apiSignMessage: (JWT: string, message: string) => Promise<ApiSignMessageResponse>;
19
- export declare const apiSignTransaction: (JWT: string, xdr: string, network: string) => Promise<ApiSignTransactionResponse>;
13
+ export declare const apiSignMessage: (JWT: string, message: string) => Promise<string>;
14
+ export declare const apiSignTransaction: (JWT: string, xdr: string, network: string) => Promise<string>;
20
15
  export {};
@@ -0,0 +1,3 @@
1
+ export declare const setRecentLoginConfig: (authMethod: string, authValue: string, timestamp?: number) => void;
2
+ export declare const clearRecentLoginConfig: () => void;
3
+ export declare const checkRecentLogins: () => Promise<boolean>;
@@ -0,0 +1,49 @@
1
+ import type { IUser } from '../store';
2
+ export type IErrorPayload = {
3
+ message: string;
4
+ code?: string | number;
5
+ cause?: unknown;
6
+ };
7
+ export type INetwork = {
8
+ previousNetwork: string;
9
+ network: string;
10
+ };
11
+ export declare enum BluxEvent {
12
+ LoggedIn = "blux:logged_in",
13
+ LoggedOut = "blux:logged_out",
14
+ NetworkChanged = "blux:network_changed",// payload: INetwork
15
+ ModalOpened = "blux:modal_opened",// payload: { modal: string; reason?: string; meta?: any }
16
+ ModalClosed = "blux:modal_closed"
17
+ }
18
+ export type BluxEventMap = {
19
+ [BluxEvent.LoggedIn]: {
20
+ user: IUser;
21
+ };
22
+ [BluxEvent.LoggedOut]: void;
23
+ [BluxEvent.NetworkChanged]: INetwork;
24
+ [BluxEvent.ModalOpened]: {
25
+ modal: string;
26
+ reason?: string;
27
+ meta?: any;
28
+ };
29
+ [BluxEvent.ModalClosed]: {
30
+ modal: string;
31
+ reason?: string;
32
+ meta?: any;
33
+ };
34
+ };
35
+ export type ReadOnlyEmitter<E> = {
36
+ on: <K extends keyof E>(event: K, handler: (payload: E[K]) => void) => () => void;
37
+ once: <K extends keyof E>(event: K, handler: (payload: E[K]) => void) => () => void;
38
+ off: <K extends keyof E>(event: K, handler: (payload: E[K]) => void) => void;
39
+ };
40
+ type Handler<T> = (payload: T) => void;
41
+ declare class Emitter<Events extends Record<string, any>> {
42
+ private handlers;
43
+ on<K extends keyof Events>(event: K, handler: Handler<Events[K]>): () => void;
44
+ off<K extends keyof Events>(event: K, handler: Handler<Events[K]>): void;
45
+ once<K extends keyof Events>(event: K, handler: Handler<Events[K]>): () => void;
46
+ emit<K extends keyof Events>(event: K, payload: Events[K]): void;
47
+ clear(event?: keyof Events): void;
48
+ }
49
+ export default Emitter;
@@ -0,0 +1 @@
1
+ export declare const preloadLogos: () => Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bluxcc/core",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "homepage": "https://blux.cc",
5
5
  "description": "Blux is a wallet infra for the Stellar network",
6
6
  "type": "module",
@@ -42,7 +42,7 @@
42
42
  "@ledgerhq/hw-app-str": "^7.2.8",
43
43
  "@lobstrco/signer-extension-api": "^1.0.0-beta.0",
44
44
  "@stellar/freighter-api": "^5.0.0",
45
- "@stellar/stellar-sdk": "^14.5.0",
45
+ "@stellar/stellar-sdk": "^15.0.1",
46
46
  "@walletconnect/core": "^2.21.9",
47
47
  "@walletconnect/sign-client": "^2.21.9",
48
48
  "qrcode.react": "^4.2.0",
@@ -1,108 +0,0 @@
1
- export declare const AboutIcon: ({ fill }: {
2
- fill?: string;
3
- }) => import("react/jsx-runtime").JSX.Element;
4
- export declare const ArrowRight: ({ fill }: {
5
- fill?: string;
6
- }) => import("react/jsx-runtime").JSX.Element;
7
- export declare const ArrowLeft: ({ fill }: {
8
- fill?: string;
9
- }) => import("react/jsx-runtime").JSX.Element;
10
- export declare const Close: ({ fill }: {
11
- fill?: string;
12
- }) => import("react/jsx-runtime").JSX.Element;
13
- export declare const Loading: ({ fill }: {
14
- fill?: string;
15
- }) => import("react/jsx-runtime").JSX.Element;
16
- export declare const Search: ({ fill }: {
17
- fill?: string;
18
- }) => import("react/jsx-runtime").JSX.Element;
19
- export declare const GreenCheck: ({ fill }: {
20
- fill?: string;
21
- }) => import("react/jsx-runtime").JSX.Element;
22
- export declare const LogOut: ({ fill }: {
23
- fill?: string;
24
- }) => import("react/jsx-runtime").JSX.Element;
25
- export declare const Copy: ({ fill }: {
26
- fill?: string;
27
- }) => import("react/jsx-runtime").JSX.Element;
28
- export declare const LargeCopy: ({ fill }: {
29
- fill?: string;
30
- }) => import("react/jsx-runtime").JSX.Element;
31
- export declare const History: ({ fill }: {
32
- fill?: string;
33
- }) => import("react/jsx-runtime").JSX.Element;
34
- export declare const Send: ({ fill }: {
35
- fill?: string;
36
- }) => import("react/jsx-runtime").JSX.Element;
37
- export declare const ArrowDropUp: ({ fill }: {
38
- fill?: string;
39
- }) => import("react/jsx-runtime").JSX.Element;
40
- export declare const ArrowDropDown: ({ fill }: {
41
- fill?: string;
42
- }) => import("react/jsx-runtime").JSX.Element;
43
- export declare const RedAlert: () => import("react/jsx-runtime").JSX.Element;
44
- export declare const Upstream: () => import("react/jsx-runtime").JSX.Element;
45
- export declare const MultiOperation: () => import("react/jsx-runtime").JSX.Element;
46
- export declare const Downstream: () => import("react/jsx-runtime").JSX.Element;
47
- export declare const Globe: () => import("react/jsx-runtime").JSX.Element;
48
- export declare const SmallEmailIcon: ({ fill }: {
49
- fill?: string;
50
- }) => import("react/jsx-runtime").JSX.Element;
51
- export declare const EmailIcon: ({ fill }: {
52
- fill?: string;
53
- }) => import("react/jsx-runtime").JSX.Element;
54
- export declare const RedExclamation: () => import("react/jsx-runtime").JSX.Element;
55
- export declare const WrongNetworkIcon: () => import("react/jsx-runtime").JSX.Element;
56
- export declare const SwapIcon: ({ fill }: {
57
- fill?: string;
58
- }) => import("react/jsx-runtime").JSX.Element;
59
- export declare const SmallSwapIcon: ({ fill }: {
60
- fill?: string;
61
- }) => import("react/jsx-runtime").JSX.Element;
62
- export declare const ReceiveIcon: ({ fill }: {
63
- fill?: string;
64
- }) => import("react/jsx-runtime").JSX.Element;
65
- export declare const BalancesIcon: ({ fill }: {
66
- fill?: string;
67
- }) => import("react/jsx-runtime").JSX.Element;
68
- export declare const NFTsIcon: ({ fill }: {
69
- fill?: string;
70
- }) => import("react/jsx-runtime").JSX.Element;
71
- export declare const AssetsIcon: ({ fill }: {
72
- fill?: string;
73
- }) => import("react/jsx-runtime").JSX.Element;
74
- export declare const TokenIcon: ({ fill }: {
75
- fill?: string;
76
- }) => import("react/jsx-runtime").JSX.Element;
77
- export declare const PlusIcon: ({ fill }: {
78
- fill?: string;
79
- }) => import("react/jsx-runtime").JSX.Element;
80
- export declare const OpenEye: ({ fill }: {
81
- fill?: string;
82
- }) => import("react/jsx-runtime").JSX.Element;
83
- export declare const CloseEye: ({ fill }: {
84
- fill?: string;
85
- }) => import("react/jsx-runtime").JSX.Element;
86
- export declare const WarnIcon: () => import("react/jsx-runtime").JSX.Element;
87
- export declare const ErrorIcon: () => import("react/jsx-runtime").JSX.Element;
88
- export declare const CopyIcon: () => import("react/jsx-runtime").JSX.Element;
89
- export declare const SuccessIcon: () => import("react/jsx-runtime").JSX.Element;
90
- export declare const KeyIcon: ({ fill }: {
91
- fill?: string;
92
- }) => import("react/jsx-runtime").JSX.Element;
93
- export declare const ChipIcon: ({ fill }: {
94
- fill?: string;
95
- }) => import("react/jsx-runtime").JSX.Element;
96
- export declare const ShieldIcon: ({ fill }: {
97
- fill?: string;
98
- }) => import("react/jsx-runtime").JSX.Element;
99
- export declare const WalletIcon: ({ fill }: {
100
- fill?: string;
101
- }) => import("react/jsx-runtime").JSX.Element;
102
- export declare const QuestionMark: ({ fill }: {
103
- fill?: string;
104
- }) => import("react/jsx-runtime").JSX.Element;
105
- export declare const SmallQuestionMark: ({ fill }: {
106
- fill?: string;
107
- }) => import("react/jsx-runtime").JSX.Element;
108
- export declare const GrayCube: () => import("react/jsx-runtime").JSX.Element;
@@ -1,33 +0,0 @@
1
- export declare const AlbedoLogo: () => import("react/jsx-runtime").JSX.Element;
2
- export declare const HanaLogo: ({ fill }: {
3
- fill?: string;
4
- }) => import("react/jsx-runtime").JSX.Element;
5
- export declare const HotLogo: () => import("react/jsx-runtime").JSX.Element;
6
- export declare const RabetLogo: ({ fill }: {
7
- fill?: string;
8
- }) => import("react/jsx-runtime").JSX.Element;
9
- export declare const FreighterLogo: ({ fill }: {
10
- fill?: string;
11
- }) => import("react/jsx-runtime").JSX.Element;
12
- export declare const DarkFreighterLogo: () => import("react/jsx-runtime").JSX.Element;
13
- export declare const XBullLogo: ({ fill }: {
14
- fill?: string;
15
- }) => import("react/jsx-runtime").JSX.Element;
16
- export declare const LobstrLogo: ({ fill }: {
17
- fill?: string;
18
- }) => import("react/jsx-runtime").JSX.Element;
19
- export declare const StellarLogo: ({ fill }: {
20
- fill?: string;
21
- }) => import("react/jsx-runtime").JSX.Element;
22
- export declare const StellarSmallLogo: ({ fill }: {
23
- fill?: string;
24
- }) => import("react/jsx-runtime").JSX.Element;
25
- export declare const GoogleLogo: () => import("react/jsx-runtime").JSX.Element;
26
- export declare const WalletConnectLogo: ({ fill, background, }: {
27
- fill?: string;
28
- background?: string;
29
- }) => import("react/jsx-runtime").JSX.Element;
30
- export declare const KleverLogo: () => import("react/jsx-runtime").JSX.Element;
31
- export declare const LedgerLogo: ({ fill }: {
32
- fill?: string;
33
- }) => import("react/jsx-runtime").JSX.Element;
@@ -1,8 +0,0 @@
1
- declare const BluxLogo: ({ fill }: {
2
- fill?: string;
3
- }) => import("react/jsx-runtime").JSX.Element;
4
- export default BluxLogo;
5
- export declare const SmallBlux: ({ fill, background, }: {
6
- fill?: string;
7
- background?: string;
8
- }) => import("react/jsx-runtime").JSX.Element;
@@ -1 +0,0 @@
1
- export {};