@bluxcc/core 0.2.5 → 0.2.6

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.
Files changed (64) hide show
  1. package/README.md +2 -1
  2. package/dist/assets/index.d.ts +13 -6
  3. package/dist/components/AssetsList/index.d.ts +1 -1
  4. package/dist/components/Button/index.d.ts +1 -1
  5. package/dist/components/CDNImage.d.ts +1 -1
  6. package/dist/components/CardItem/index.d.ts +1 -1
  7. package/dist/components/CardItem/variants/button.d.ts +1 -1
  8. package/dist/components/CardItem/variants/input.d.ts +1 -1
  9. package/dist/components/Divider/index.d.ts +1 -1
  10. package/dist/components/Header/index.d.ts +1 -1
  11. package/dist/components/Input/index.d.ts +1 -1
  12. package/dist/components/Link/index.d.ts +1 -1
  13. package/dist/components/Modal/index.d.ts +1 -1
  14. package/dist/components/Provider.d.ts +1 -1
  15. package/dist/components/QRCode/index.d.ts +1 -1
  16. package/dist/components/TabBox/index.d.ts +1 -1
  17. package/dist/components/Transaction/History/index.d.ts +3 -1
  18. package/dist/components/Transaction/Summary/index.d.ts +1 -1
  19. package/dist/constants/assets.d.ts +8 -0
  20. package/dist/enums.d.ts +5 -1
  21. package/dist/exports/core/index.d.ts +2 -0
  22. package/dist/exports/core/readContracts.d.ts +5 -1
  23. package/dist/exports/core/writeContract.d.ts +2 -0
  24. package/dist/hooks/useLang.d.ts +1 -1
  25. package/dist/hooks/useMaxAmount.d.ts +3 -0
  26. package/dist/index.cjs.js +14 -14
  27. package/dist/index.esm.js +14 -14
  28. package/dist/pages/About/index.d.ts +1 -1
  29. package/dist/pages/AcceptTermsAndPrivacy/index.d.ts +1 -2
  30. package/dist/pages/Failed/index.d.ts +1 -1
  31. package/dist/pages/FundMe/FundMeCrypto/index.d.ts +1 -1
  32. package/dist/pages/FundMe/index.d.ts +1 -2
  33. package/dist/pages/Onboarding/OTP/index.d.ts +1 -1
  34. package/dist/pages/Onboarding/Passkey/index.d.ts +1 -1
  35. package/dist/pages/Onboarding/Socials/index.d.ts +2 -0
  36. package/dist/pages/Onboarding/index.d.ts +1 -2
  37. package/dist/pages/Profile/Activity/index.d.ts +1 -1
  38. package/dist/pages/Profile/Balances/AddToken/index.d.ts +1 -2
  39. package/dist/pages/Profile/Balances/BalanceDetails/index.d.ts +1 -1
  40. package/dist/pages/Profile/Balances/index.d.ts +1 -1
  41. package/dist/pages/Profile/Receive/index.d.ts +1 -1
  42. package/dist/pages/Profile/SelectAsset/index.d.ts +1 -2
  43. package/dist/pages/Profile/Send/index.d.ts +1 -2
  44. package/dist/pages/Profile/Swap/AssetBox/index.d.ts +1 -1
  45. package/dist/pages/Profile/Swap/index.d.ts +1 -1
  46. package/dist/pages/Profile/index.d.ts +1 -1
  47. package/dist/pages/SendTransaction/index.d.ts +1 -1
  48. package/dist/pages/SignMessage/index.d.ts +1 -1
  49. package/dist/pages/Successful/index.d.ts +1 -1
  50. package/dist/pages/Waiting/index.d.ts +1 -1
  51. package/dist/pages/WalletConnect/index.d.ts +1 -1
  52. package/dist/pages/WrongNetwork/index.d.ts +1 -1
  53. package/dist/store.d.ts +4 -0
  54. package/dist/types.d.ts +19 -3
  55. package/dist/utils/animatedGradient.d.ts +1 -1
  56. package/dist/utils/api.d.ts +1 -0
  57. package/dist/utils/helpers.d.ts +12 -3
  58. package/dist/utils/initializeTrezor.d.ts +8 -0
  59. package/dist/utils/socialLogin.d.ts +24 -0
  60. package/dist/utils/walletLogos.d.ts +1 -1
  61. package/dist/wallets/cactuslink.d.ts +2 -0
  62. package/dist/wallets/fordefi.d.ts +2 -0
  63. package/dist/wallets/trezor.d.ts +2 -0
  64. package/package.json +3 -2
@@ -1,2 +1,2 @@
1
- declare const About: () => import("react").JSX.Element;
1
+ declare const About: () => import("react/jsx-runtime").JSX.Element;
2
2
  export default About;
@@ -1,3 +1,2 @@
1
- import { JSX } from 'react';
2
- declare const AcceptTermsAndPrivacy: () => JSX.Element;
1
+ declare const AcceptTermsAndPrivacy: () => import("react/jsx-runtime").JSX.Element;
3
2
  export default AcceptTermsAndPrivacy;
@@ -1,2 +1,2 @@
1
- declare const Failed: () => import("react").JSX.Element;
1
+ declare const Failed: () => import("react/jsx-runtime").JSX.Element;
2
2
  export default Failed;
@@ -1,2 +1,2 @@
1
- declare const FundMeCrypto: () => import("react").JSX.Element;
1
+ declare const FundMeCrypto: () => import("react/jsx-runtime").JSX.Element;
2
2
  export default FundMeCrypto;
@@ -1,3 +1,2 @@
1
- import { JSX } from 'react';
2
- declare function FundMe(): JSX.Element;
1
+ declare function FundMe(): import("react/jsx-runtime").JSX.Element;
3
2
  export default FundMe;
@@ -1,2 +1,2 @@
1
- declare const OTP: () => import("react").JSX.Element;
1
+ declare const OTP: () => import("react/jsx-runtime").JSX.Element;
2
2
  export default OTP;
@@ -5,5 +5,5 @@ export type PasskeyFlowResult = {
5
5
  step: 'register';
6
6
  credential: PublicKeyCredential;
7
7
  };
8
- declare const PasskeyOnboardingPage: () => import("react").JSX.Element;
8
+ declare const PasskeyOnboardingPage: () => import("react/jsx-runtime").JSX.Element;
9
9
  export default PasskeyOnboardingPage;
@@ -0,0 +1,2 @@
1
+ declare const SocialsOnboarding: () => import("react/jsx-runtime").JSX.Element;
2
+ export default SocialsOnboarding;
@@ -1,3 +1,2 @@
1
- import React from 'react';
2
- declare const Onboarding: () => React.JSX.Element;
1
+ declare const Onboarding: () => import("react/jsx-runtime").JSX.Element;
3
2
  export default Onboarding;
@@ -1,2 +1,2 @@
1
- declare const Activity: () => import("react").JSX.Element;
1
+ declare const Activity: () => import("react/jsx-runtime").JSX.Element;
2
2
  export default Activity;
@@ -1,3 +1,2 @@
1
- import React from 'react';
2
- declare const AddToken: () => React.JSX.Element;
1
+ declare const AddToken: () => import("react/jsx-runtime").JSX.Element;
3
2
  export default AddToken;
@@ -1,2 +1,2 @@
1
- declare const BalanceDetails: () => import("react").JSX.Element;
1
+ declare const BalanceDetails: () => import("react/jsx-runtime").JSX.Element | null;
2
2
  export default BalanceDetails;
@@ -1,2 +1,2 @@
1
- declare const Balances: () => import("react").JSX.Element | "Loading" | "Error, try again.";
1
+ declare const Balances: () => import("react/jsx-runtime").JSX.Element;
2
2
  export default Balances;
@@ -1,2 +1,2 @@
1
- declare const Receive: () => import("react").JSX.Element;
1
+ declare const Receive: () => import("react/jsx-runtime").JSX.Element;
2
2
  export default Receive;
@@ -1,3 +1,2 @@
1
- import React from 'react';
2
- declare const SelectAsset: () => React.JSX.Element;
1
+ declare const SelectAsset: () => import("react/jsx-runtime").JSX.Element;
3
2
  export default SelectAsset;
@@ -1,3 +1,2 @@
1
- import React from 'react';
2
- declare const SendForm: () => React.JSX.Element;
1
+ declare const SendForm: () => import("react/jsx-runtime").JSX.Element;
3
2
  export default SendForm;
@@ -3,5 +3,5 @@ type AssetBoxProps = {
3
3
  asset: IAsset;
4
4
  handleOpenAssets: () => void;
5
5
  };
6
- declare const AssetBox: ({ handleOpenAssets, asset }: AssetBoxProps) => import("react").JSX.Element;
6
+ declare const AssetBox: ({ handleOpenAssets, asset }: AssetBoxProps) => import("react/jsx-runtime").JSX.Element;
7
7
  export default AssetBox;
@@ -1,2 +1,2 @@
1
- declare const Swap: () => import("react").JSX.Element;
1
+ declare const Swap: () => import("react/jsx-runtime").JSX.Element;
2
2
  export default Swap;
@@ -1,2 +1,2 @@
1
- declare const Profile: () => import("react").JSX.Element;
1
+ declare const Profile: () => import("react/jsx-runtime").JSX.Element;
2
2
  export default Profile;
@@ -1,2 +1,2 @@
1
- declare const SendTransaction: () => import("react").JSX.Element;
1
+ declare const SendTransaction: () => import("react/jsx-runtime").JSX.Element;
2
2
  export default SendTransaction;
@@ -1,2 +1,2 @@
1
- declare const SignMessage: () => import("react").JSX.Element | null;
1
+ declare const SignMessage: () => import("react/jsx-runtime").JSX.Element | null;
2
2
  export default SignMessage;
@@ -1,2 +1,2 @@
1
- declare const Successful: () => import("react").JSX.Element;
1
+ declare const Successful: () => import("react/jsx-runtime").JSX.Element;
2
2
  export default Successful;
@@ -1,2 +1,2 @@
1
- declare const Waiting: () => import("react").JSX.Element;
1
+ declare const Waiting: () => import("react/jsx-runtime").JSX.Element;
2
2
  export default Waiting;
@@ -1,2 +1,2 @@
1
- declare const WalletConnect: () => import("react").JSX.Element | null;
1
+ declare const WalletConnect: () => import("react/jsx-runtime").JSX.Element | null;
2
2
  export default WalletConnect;
@@ -1,2 +1,2 @@
1
- declare const WrongNetwork: () => import("react").JSX.Element;
1
+ declare const WrongNetwork: () => import("react/jsx-runtime").JSX.Element;
2
2
  export default WrongNetwork;
package/dist/store.d.ts CHANGED
@@ -39,6 +39,7 @@ export interface ISelectAsset {
39
39
  sendAsset: IAsset;
40
40
  swapToAsset: IAsset;
41
41
  swapFromAsset: IAsset;
42
+ userPicked?: boolean;
42
43
  }
43
44
  export interface ILoginPromise {
44
45
  isSilent: boolean;
@@ -76,6 +77,7 @@ export interface IStoreProperties {
76
77
  balances: UseBalancesResult;
77
78
  transactions: UseTransactionsResult;
78
79
  selectAsset: ISelectAsset;
80
+ detailsAsset?: IAsset;
79
81
  walletConnect?: {
80
82
  connection: any;
81
83
  client: SignClient;
@@ -85,6 +87,7 @@ export interface IStoreProperties {
85
87
  }
86
88
  export interface IStoreMethods {
87
89
  connectEmail: (email: string) => void;
90
+ connectSocial: (provider: string) => void;
88
91
  connectWallet: (walletName: string) => void;
89
92
  connectWalletSuccessful: (publicKey: string, passphrase: string) => void;
90
93
  closeModal: () => void;
@@ -103,6 +106,7 @@ export interface IStoreMethods {
103
106
  setDynamicTitle: (title: string) => void;
104
107
  setBalances: (balances: UseBalancesResult) => void;
105
108
  setSelectAsset: (selectAsset: ISelectAsset) => void;
109
+ setDetailsAsset: (asset: IAsset | undefined) => void;
106
110
  setTransactions: (transactions: UseTransactionsResult) => void;
107
111
  setWalletConnectClient: (client: SignClient, connection: any) => void;
108
112
  cleanUp: (method: 'sendTransaction' | 'signMessage') => void;
package/dist/types.d.ts CHANGED
@@ -1,10 +1,11 @@
1
1
  import { Horizon } from '@stellar/stellar-sdk';
2
2
  import { SupportedWallet } from './enums';
3
- export type LanguageKey = 'en';
3
+ export type LanguageKey = 'en' | 'es' | 'pt' | 'fr' | 'de' | 'ru' | 'zh' | 'ja' | 'ko';
4
4
  export type ITransports = Record<string, IServers>;
5
5
  export type IExplorer = 'steexp' | 'stellarchain' | 'stellarexpert' | 'lumenscan';
6
- export type ILoginMethods = Array<'wallet' | 'sms' | 'email' | 'passkey'>;
7
- export type IWalletNames = Array<'rabet' | 'albedo' | 'freighter' | 'xbull' | 'lobstr' | 'hana' | 'hot' | 'klever'>;
6
+ export type ISocialProvider = 'google';
7
+ export type ILoginMethods = Array<'wallet' | 'sms' | 'email' | 'passkey' | ISocialProvider>;
8
+ export type IWalletNames = Array<'rabet' | 'albedo' | 'freighter' | 'xbull' | 'lobstr' | 'hana' | 'hot' | 'klever' | 'cactuslink' | 'fordefi' | 'trezor'>;
8
9
  interface IServers {
9
10
  horizon: string;
10
11
  soroban: string;
@@ -15,6 +16,10 @@ export interface IWalletConnectMetaData {
15
16
  projectId: string;
16
17
  description: string;
17
18
  }
19
+ export interface ITrezorMetaData {
20
+ email: string;
21
+ appUrl?: string;
22
+ }
18
23
  export interface IConfig {
19
24
  appId: string;
20
25
  appName: string;
@@ -28,7 +33,9 @@ export interface IConfig {
28
33
  loginMethods?: ILoginMethods | string[];
29
34
  transports?: ITransports;
30
35
  excludeWallets?: IWalletNames;
36
+ orderWallets?: IWalletNames | string[];
31
37
  walletConnect?: IWalletConnectMetaData;
38
+ trezor?: ITrezorMetaData;
32
39
  promptOnWrongNetwork?: boolean;
33
40
  }
34
41
  export interface IInternalConfig extends IConfig {
@@ -39,6 +46,7 @@ export interface IInternalConfig extends IConfig {
39
46
  defaultNetwork: string;
40
47
  lang: LanguageKey;
41
48
  excludeWallets: IWalletNames;
49
+ orderWallets?: string[];
42
50
  promptOnWrongNetwork: boolean;
43
51
  }
44
52
  export interface IAppearance {
@@ -124,10 +132,18 @@ export interface ISignAuthEntry {
124
132
  rejecter: (reason: any) => void;
125
133
  resolver: (value: string) => void;
126
134
  }
135
+ export interface ISocialConfigEntry {
136
+ provider: string;
137
+ displayName: string;
138
+ clientId: string;
139
+ redirectUri: string;
140
+ }
127
141
  export interface AuthenticateApiResponse {
128
142
  isValid: boolean;
129
143
  message: string;
130
144
  privacyPolicy: string;
131
145
  terms: string;
146
+ socials: string[];
147
+ socialsConfig: ISocialConfigEntry[];
132
148
  }
133
149
  export {};
@@ -14,5 +14,5 @@ type AnimatedGradientType = {
14
14
  size?: string;
15
15
  style?: React.CSSProperties;
16
16
  };
17
- declare const AnimatedGradient: ({ theme, className, children, animationSpeed, onClick, style, size, }: AnimatedGradientType) => React.JSX.Element;
17
+ declare const AnimatedGradient: ({ theme, className, children, animationSpeed, onClick, style, size, }: AnimatedGradientType) => import("react/jsx-runtime").JSX.Element;
18
18
  export default AnimatedGradient;
@@ -7,6 +7,7 @@ type ApiPasskeyChallenge = {
7
7
  challenge_id: number;
8
8
  };
9
9
  export declare const authenticateAppId: (appId: string) => Promise<AuthenticateApiResponse>;
10
+ export declare const apiSocialLogin: (appId: string, provider: string, code: string) => Promise<string>;
10
11
  export declare const apiRegisterPasskeyChallenge: (appId: string) => Promise<ApiPasskeyChallenge>;
11
12
  export declare const apiRegisterPasskey: (appId: string, challenge: ApiPasskeyChallenge, passkeyResult: PasskeyFlowResult) => Promise<string>;
12
13
  export declare const apiSendOtp: (appId: string, authValue: string) => Promise<boolean>;
@@ -16,6 +16,13 @@ export declare const addXLMToBalances: (balances: IAsset[]) => {
16
16
  }[];
17
17
  export declare const fetcher: <T>(url: string, options: RequestInit) => Promise<T>;
18
18
  export declare const isChangeTrustNeeded: (to: string, asset: IAsset, balances: Horizon.HorizonApi.BalanceLine[]) => boolean;
19
+ export declare const getLiveAssetBalance: (asset: IAsset, balances: Horizon.HorizonApi.BalanceLine[]) => string;
20
+ export interface IReserveInfo {
21
+ subentryCount: number;
22
+ numSponsoring: number;
23
+ numSponsored: number;
24
+ }
25
+ export declare const getMaxSpendableAmount: (asset: IAsset, balances: Horizon.HorizonApi.BalanceLine[], reserve: IReserveInfo | null) => string;
19
26
  export declare const balanceToAsset: (balance: Horizon.HorizonApi.BalanceLine) => IAsset;
20
27
  export declare const capitalizeFirstLetter: (str: string) => string;
21
28
  export declare const copyText: (text: string) => Promise<void>;
@@ -28,19 +35,21 @@ export declare const getMappedWallets: (walletNames: IWalletNames) => Promise<IW
28
35
  export declare const getRecentConnectionMethod: () => SupportedWallet[];
29
36
  export declare const getNetworkByPassphrase: (passphrase: string) => string;
30
37
  export declare const getNetworkRpc: (network: string, transports: ITransports) => INetworkTransports;
31
- export declare const getSortedCheckedWallets: (wallets: IWallet[]) => IWallet[];
38
+ export declare const canonicalWalletName: (name: string) => string;
39
+ export declare const getSortedCheckedWallets: (wallets: IWallet[], priorityNames?: string[]) => IWallet[];
32
40
  export declare const getWalletNetwork: (wallet: IWallet) => Promise<string>;
33
- export declare const handleLoadWallets: (walletNames: IWalletNames) => Promise<IWallet[]>;
41
+ export declare const handleLoadWallets: (walletNames: IWalletNames, orderWallets?: string[]) => Promise<IWallet[]>;
34
42
  export declare const hexToRgba: (hex: string, alpha?: number) => string;
35
43
  export declare const humanizeAmount: (amount: number | string, big?: boolean) => string;
36
44
  export declare const initializeRabetMobile: () => void;
37
45
  export declare const isBackgroundDark: (bgColor: string) => boolean;
38
- export declare const loadWallets: (excludedWallets: IWalletNames) => Promise<IWallet[]>;
46
+ export declare const loadWallets: (excludedWallets: IWalletNames, orderWallets?: string[]) => Promise<IWallet[]>;
39
47
  export declare const setRecentConnectionMethod: (walletName: SupportedWallet) => void;
40
48
  export declare const shortenAddress: (address: string, numChars?: number) => string;
41
49
  export declare const timeout: (waiter: number) => Promise<unknown>;
42
50
  export declare const toTitleFormat: (str: string) => string;
43
51
  export declare const translate: (key: keyof typeof translations, lang: LanguageKey, vars?: Record<string, string>) => string;
44
52
  export declare const getNetworkNamesFromPassphrase: (userNetworks: string[]) => string[];
53
+ export declare const validateOrderWallets: (orderWallets: string[] | undefined) => string[];
45
54
  export declare const validateNetworkOptions: (networks: string[], defaultNetwork: string | undefined, transports: ITransports | undefined) => void;
46
55
  export declare const validateInput: (type: string, value: string) => boolean;
@@ -0,0 +1,8 @@
1
+ import { ITrezorMetaData } from '../types';
2
+ /**
3
+ * Trezor Connect requires a manifest (app name, url and contact email) before
4
+ * it can be used, so it is only initialized when the dApp provides the
5
+ * `trezor` property in its Blux config.
6
+ */
7
+ export declare const initializeTrezor: (trezor: ITrezorMetaData, appName: string) => Promise<void>;
8
+ export declare const waitForTrezor: () => Promise<void>;
@@ -0,0 +1,24 @@
1
+ import CDNFiles from '../constants/cdnFiles';
2
+ import { ILoginMethods, ISocialConfigEntry, AuthenticateApiResponse } from '../types';
3
+ type SocialProviderMeta = {
4
+ displayName: string;
5
+ authUrl: string;
6
+ scopes: string[];
7
+ icon: CDNFiles;
8
+ extraParams?: Record<string, string>;
9
+ };
10
+ export declare const SOCIAL_PROVIDERS: Record<string, SocialProviderMeta>;
11
+ export declare const isSocialProvider: (method: string) => boolean;
12
+ export declare const getEnabledSocials: (loginMethods: ILoginMethods | string[], apiResponse?: AuthenticateApiResponse) => string[];
13
+ export type ISocialSession = {
14
+ provider: string;
15
+ popup: Window | null;
16
+ state: string;
17
+ redirectUri: string;
18
+ error?: string;
19
+ };
20
+ export declare const getActiveSocialSession: () => ISocialSession | null;
21
+ export declare const cancelActiveSocialSession: () => void;
22
+ export declare const beginSocialLogin: (provider: string, socialsConfig: ISocialConfigEntry[]) => ISocialSession;
23
+ export declare const awaitSocialAuthCode: (session: ISocialSession) => Promise<string>;
24
+ export {};
@@ -1,2 +1,2 @@
1
- declare const handleLogos: (walletName: string, isDark: boolean, size?: "small" | "large") => import("react").JSX.Element | null;
1
+ declare const handleLogos: (walletName: string, isDark: boolean, size?: "small" | "large") => import("react/jsx-runtime").JSX.Element | null;
2
2
  export default handleLogos;
@@ -0,0 +1,2 @@
1
+ import { IWallet } from '../types';
2
+ export declare const cactusLinkConfig: IWallet;
@@ -0,0 +1,2 @@
1
+ import { IWallet } from '../types';
2
+ export declare const fordefiConfig: IWallet;
@@ -0,0 +1,2 @@
1
+ import { IWallet } from '../types';
2
+ export declare const trezorConfig: IWallet;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bluxcc/core",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "homepage": "https://blux.cc",
5
5
  "description": "Blux is a wallet infra for the Stellar network",
6
6
  "type": "module",
@@ -72,6 +72,7 @@
72
72
  },
73
73
  "dependencies": {
74
74
  "@hot-wallet/sdk": "^1.0.11",
75
- "@ledgerhq/hw-transport-webusb": "^6.29.12"
75
+ "@ledgerhq/hw-transport-webusb": "^6.29.12",
76
+ "@trezor/connect-web": "^10.0.0-alpha.1"
76
77
  }
77
78
  }