@bluxcc/core 0.2.4 → 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.
- package/README.md +2 -1
- package/dist/assets/index.d.ts +8 -0
- package/dist/components/Transaction/History/index.d.ts +2 -0
- package/dist/constants/assets.d.ts +8 -0
- package/dist/enums.d.ts +6 -1
- package/dist/exports/core/index.d.ts +2 -0
- package/dist/exports/core/readContracts.d.ts +5 -1
- package/dist/exports/core/writeContract.d.ts +2 -0
- package/dist/hooks/useLang.d.ts +1 -1
- package/dist/hooks/useMaxAmount.d.ts +3 -0
- package/dist/index.cjs.js +14 -14
- package/dist/index.esm.js +14 -14
- package/dist/pages/Onboarding/Passkey/index.d.ts +9 -0
- package/dist/pages/Onboarding/Socials/index.d.ts +2 -0
- package/dist/pages/Profile/Balances/BalanceDetails/index.d.ts +1 -1
- package/dist/pages/Profile/Balances/index.d.ts +1 -1
- package/dist/store.d.ts +4 -0
- package/dist/types.d.ts +19 -3
- package/dist/utils/api.d.ts +9 -0
- package/dist/utils/helpers.d.ts +13 -3
- package/dist/utils/initializeTrezor.d.ts +8 -0
- package/dist/utils/socialLogin.d.ts +24 -0
- package/dist/wallets/cactuslink.d.ts +2 -0
- package/dist/wallets/fordefi.d.ts +2 -0
- package/dist/wallets/trezor.d.ts +2 -0
- package/package.json +3 -2
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type PasskeyFlowResult = {
|
|
2
|
+
step: 'login';
|
|
3
|
+
credential: PublicKeyCredential;
|
|
4
|
+
} | {
|
|
5
|
+
step: 'register';
|
|
6
|
+
credential: PublicKeyCredential;
|
|
7
|
+
};
|
|
8
|
+
declare const PasskeyOnboardingPage: () => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export default PasskeyOnboardingPage;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const BalanceDetails: () => import("react/jsx-runtime").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: () =>
|
|
1
|
+
declare const Balances: () => import("react/jsx-runtime").JSX.Element;
|
|
2
2
|
export default Balances;
|
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
|
|
7
|
-
export type
|
|
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 {};
|
package/dist/utils/api.d.ts
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import { IUser } from '../store';
|
|
2
2
|
import { AuthenticateApiResponse } from '../types';
|
|
3
|
+
import { PasskeyFlowResult } from '../pages/Onboarding/Passkey';
|
|
4
|
+
type ApiPasskeyChallenge = {
|
|
5
|
+
user_id: string;
|
|
6
|
+
challenge: string;
|
|
7
|
+
challenge_id: number;
|
|
8
|
+
};
|
|
3
9
|
export declare const authenticateAppId: (appId: string) => Promise<AuthenticateApiResponse>;
|
|
10
|
+
export declare const apiSocialLogin: (appId: string, provider: string, code: string) => Promise<string>;
|
|
11
|
+
export declare const apiRegisterPasskeyChallenge: (appId: string) => Promise<ApiPasskeyChallenge>;
|
|
12
|
+
export declare const apiRegisterPasskey: (appId: string, challenge: ApiPasskeyChallenge, passkeyResult: PasskeyFlowResult) => Promise<string>;
|
|
4
13
|
export declare const apiSendOtp: (appId: string, authValue: string) => Promise<boolean>;
|
|
5
14
|
export declare const apiStoreWalletConnection: (appId: string, walletName: string, walletAddress: string) => Promise<boolean>;
|
|
6
15
|
export declare const apiVerifyOtp: (appId: string, user: IUser, otp: string) => Promise<string>;
|
package/dist/utils/helpers.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { Route, SupportedWallet } from '../enums';
|
|
|
4
4
|
import { IAsset, IWallet, IExplorer, LanguageKey, ITransports, IWalletNames } from '../types';
|
|
5
5
|
import { INetworkTransports } from '../constants/networkDetails';
|
|
6
6
|
import { HorizonApi } from '@stellar/stellar-sdk/lib/horizon';
|
|
7
|
+
export declare const bufferToBase64Url: (buf: ArrayBuffer) => string;
|
|
7
8
|
export declare const getAssetTitle: (asset: HorizonApi.BalanceLineNative | HorizonApi.BalanceLineAsset<"credit_alphanum4"> | HorizonApi.BalanceLineAsset<"credit_alphanum12"> | HorizonApi.BalanceLineLiquidityPool) => string;
|
|
8
9
|
export declare const getAssetSubtitle: (asset: HorizonApi.BalanceLineNative | HorizonApi.BalanceLineAsset<"credit_alphanum4"> | HorizonApi.BalanceLineAsset<"credit_alphanum12"> | HorizonApi.BalanceLineLiquidityPool) => string;
|
|
9
10
|
export declare const iAssetToAsset: (asset: IAsset) => Asset;
|
|
@@ -15,6 +16,13 @@ export declare const addXLMToBalances: (balances: IAsset[]) => {
|
|
|
15
16
|
}[];
|
|
16
17
|
export declare const fetcher: <T>(url: string, options: RequestInit) => Promise<T>;
|
|
17
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;
|
|
18
26
|
export declare const balanceToAsset: (balance: Horizon.HorizonApi.BalanceLine) => IAsset;
|
|
19
27
|
export declare const capitalizeFirstLetter: (str: string) => string;
|
|
20
28
|
export declare const copyText: (text: string) => Promise<void>;
|
|
@@ -27,19 +35,21 @@ export declare const getMappedWallets: (walletNames: IWalletNames) => Promise<IW
|
|
|
27
35
|
export declare const getRecentConnectionMethod: () => SupportedWallet[];
|
|
28
36
|
export declare const getNetworkByPassphrase: (passphrase: string) => string;
|
|
29
37
|
export declare const getNetworkRpc: (network: string, transports: ITransports) => INetworkTransports;
|
|
30
|
-
export declare const
|
|
38
|
+
export declare const canonicalWalletName: (name: string) => string;
|
|
39
|
+
export declare const getSortedCheckedWallets: (wallets: IWallet[], priorityNames?: string[]) => IWallet[];
|
|
31
40
|
export declare const getWalletNetwork: (wallet: IWallet) => Promise<string>;
|
|
32
|
-
export declare const handleLoadWallets: (walletNames: IWalletNames) => Promise<IWallet[]>;
|
|
41
|
+
export declare const handleLoadWallets: (walletNames: IWalletNames, orderWallets?: string[]) => Promise<IWallet[]>;
|
|
33
42
|
export declare const hexToRgba: (hex: string, alpha?: number) => string;
|
|
34
43
|
export declare const humanizeAmount: (amount: number | string, big?: boolean) => string;
|
|
35
44
|
export declare const initializeRabetMobile: () => void;
|
|
36
45
|
export declare const isBackgroundDark: (bgColor: string) => boolean;
|
|
37
|
-
export declare const loadWallets: (excludedWallets: IWalletNames) => Promise<IWallet[]>;
|
|
46
|
+
export declare const loadWallets: (excludedWallets: IWalletNames, orderWallets?: string[]) => Promise<IWallet[]>;
|
|
38
47
|
export declare const setRecentConnectionMethod: (walletName: SupportedWallet) => void;
|
|
39
48
|
export declare const shortenAddress: (address: string, numChars?: number) => string;
|
|
40
49
|
export declare const timeout: (waiter: number) => Promise<unknown>;
|
|
41
50
|
export declare const toTitleFormat: (str: string) => string;
|
|
42
51
|
export declare const translate: (key: keyof typeof translations, lang: LanguageKey, vars?: Record<string, string>) => string;
|
|
43
52
|
export declare const getNetworkNamesFromPassphrase: (userNetworks: string[]) => string[];
|
|
53
|
+
export declare const validateOrderWallets: (orderWallets: string[] | undefined) => string[];
|
|
44
54
|
export declare const validateNetworkOptions: (networks: string[], defaultNetwork: string | undefined, transports: ITransports | undefined) => void;
|
|
45
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 {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bluxcc/core",
|
|
3
|
-
"version": "0.2.
|
|
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
|
}
|