@bluxcc/react 0.1.0 → 0.1.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.
- package/LICENSE +80 -0
- package/README.md +101 -1
- package/dist/assets/Icons.d.ts +12 -1
- package/dist/assets/bluxLogo.d.ts +3 -1
- package/dist/assets/logos.d.ts +6 -1
- package/dist/chains.d.ts +8 -0
- package/dist/components/Button/buttonVariants.d.ts +2 -2
- package/dist/components/Button/index.d.ts +13 -6
- package/dist/components/CardItem/index.d.ts +10 -0
- package/dist/components/Input/OTPInput.d.ts +3 -0
- package/dist/components/Input/index.d.ts +16 -0
- package/dist/components/Modal/Header/index.d.ts +3 -3
- package/dist/components/Modal/index.d.ts +3 -4
- package/dist/components/Transaction/History/index.d.ts +10 -0
- package/dist/components/Transaction/Summery/index.d.ts +9 -0
- package/dist/constants/index.d.ts +6 -2
- package/dist/containers/BluxModal/content.d.ts +11 -0
- package/dist/containers/BluxModal/index.d.ts +7 -0
- package/dist/containers/ConnectModal/content.d.ts +11 -0
- package/dist/containers/ConnectModal/index.d.ts +2 -1
- package/dist/containers/Pages/Activity/index.d.ts +3 -0
- package/dist/containers/Pages/ConfirmCode/index.d.ts +3 -0
- package/dist/containers/Pages/OnBoarding/index.d.ts +7 -0
- package/dist/containers/Pages/Profile/index.d.ts +3 -0
- package/dist/containers/Pages/Send/index.d.ts +3 -0
- package/dist/containers/Pages/SignTransaction/index.d.ts +3 -0
- package/dist/containers/Pages/Successful/index.d.ts +3 -0
- package/dist/containers/Pages/Waiting/index.d.ts +3 -0
- package/dist/context/provider.d.ts +1 -1
- package/dist/hooks/useAccount.d.ts +12 -0
- package/dist/hooks/useBlux.d.ts +4 -2
- package/dist/hooks/useGoogleFont.d.ts +1 -4
- package/dist/index.cjs.js +1406 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.esm.js +1399 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/types/index.d.ts +95 -23
- package/dist/useStellar/index.d.ts +2 -0
- package/dist/useStellar/useBalance.d.ts +8 -0
- package/dist/utils/BN.d.ts +3 -0
- package/dist/utils/capitalizeFirstLetter.d.ts +2 -0
- package/dist/utils/getBorderRadius.d.ts +2 -1
- package/dist/utils/getContrastColor.d.ts +2 -0
- package/dist/utils/getHorizonServer.d.ts +6 -0
- package/dist/utils/getInitialHeight.d.ts +2 -0
- package/dist/utils/getNetworkByPassphrase.d.ts +1 -0
- package/dist/utils/getNetworkPassphrase.d.ts +1 -0
- package/dist/utils/getTransactionDetails.d.ts +6 -0
- package/dist/utils/handleIcons.d.ts +2 -1
- package/dist/utils/handleLogos.d.ts +3 -0
- package/dist/utils/humanizeAmount.d.ts +3 -0
- package/dist/utils/initializeRabetMobile.d.ts +2 -1
- package/dist/utils/mappedWallets.d.ts +6 -3
- package/dist/utils/signTransactionHandler.d.ts +3 -0
- package/dist/utils/stellar/getExplorerUrl.d.ts +2 -0
- package/dist/utils/stellar/getNetworkByPassphrase.d.ts +2 -0
- package/dist/utils/stellar/getNetworkPassphrase.d.ts +2 -0
- package/dist/utils/stellar/getStellarServer.d.ts +6 -0
- package/dist/utils/stellar/getTransactionDetails.d.ts +7 -0
- package/dist/utils/stellar/signTransaction.d.ts +3 -0
- package/dist/utils/stellar/submitTransaction.d.ts +3 -0
- package/dist/utils/submitTransaction.d.ts +2 -0
- package/dist/wallets/configs/albedoConfig.d.ts +2 -2
- package/dist/wallets/configs/freighterConfig.d.ts +2 -2
- package/dist/wallets/configs/lobstrConfig.d.ts +2 -2
- package/dist/wallets/configs/rabetConfig.d.ts +2 -2
- package/dist/wallets/configs/xbullConfig.d.ts +2 -2
- package/dist/wallets/walletsConfig.d.ts +2 -2
- package/package.json +9 -16
package/dist/types/index.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import { Horizon } from '@stellar/stellar-sdk';
|
|
2
|
+
import { HorizonApi } from '@stellar/stellar-sdk/lib/horizon';
|
|
3
|
+
/**
|
|
4
|
+
* Enum representing the supported wallets in the system.
|
|
5
|
+
*/
|
|
1
6
|
export declare enum SupportedWallets {
|
|
2
7
|
Rabet = "Rabet",
|
|
3
8
|
Albedo = "Albedo",
|
|
@@ -5,6 +10,9 @@ export declare enum SupportedWallets {
|
|
|
5
10
|
Xbull = "xBull",
|
|
6
11
|
Lobstr = "LOBSTR"
|
|
7
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Enum defining the various Stellar network environments.
|
|
15
|
+
*/
|
|
8
16
|
export declare enum WalletNetwork {
|
|
9
17
|
PUBLIC = "Public Global Stellar Network ; September 2015",
|
|
10
18
|
TESTNET = "Test SDF Network ; September 2015",
|
|
@@ -12,23 +20,56 @@ export declare enum WalletNetwork {
|
|
|
12
20
|
SANDBOX = "Local Sandbox Stellar Network ; September 2022",
|
|
13
21
|
STANDALONE = "Standalone Network ; February 2017"
|
|
14
22
|
}
|
|
23
|
+
export interface AccountData {
|
|
24
|
+
id: string;
|
|
25
|
+
sequence: string;
|
|
26
|
+
subentry_count: number;
|
|
27
|
+
thresholds: Horizon.HorizonApi.AccountThresholds;
|
|
28
|
+
balances: Horizon.HorizonApi.BalanceLine[];
|
|
29
|
+
xlmBalance: string;
|
|
30
|
+
transactions?: Horizon.ServerApi.TransactionRecord[];
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Configuration options for the provider.
|
|
34
|
+
*/
|
|
15
35
|
export interface IProviderConfig {
|
|
16
36
|
appName: string;
|
|
17
|
-
|
|
37
|
+
appLogo?: string;
|
|
38
|
+
network: string;
|
|
18
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Information about the connected wallet.
|
|
42
|
+
*/
|
|
19
43
|
export interface WalletInfo {
|
|
20
|
-
name: SupportedWallets
|
|
44
|
+
name: SupportedWallets;
|
|
21
45
|
address: string | null;
|
|
22
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* User-related information within the context.
|
|
49
|
+
*/
|
|
23
50
|
export interface IUser {
|
|
24
51
|
wallet: WalletInfo | null;
|
|
25
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Context state management interface.
|
|
55
|
+
*/
|
|
26
56
|
export interface ContextState {
|
|
27
|
-
value:
|
|
28
|
-
setValue: React.Dispatch<React.SetStateAction<
|
|
57
|
+
value: ContextInterface;
|
|
58
|
+
setValue: React.Dispatch<React.SetStateAction<ContextInterface>>;
|
|
59
|
+
route: Routes;
|
|
60
|
+
setRoute: React.Dispatch<React.SetStateAction<Routes>>;
|
|
29
61
|
}
|
|
30
|
-
|
|
62
|
+
/**
|
|
63
|
+
* Supported font options for UI customization.
|
|
64
|
+
*/
|
|
65
|
+
export type SupportedFonts = 'Manrope' | 'Inter' | 'JetBrains Mono' | 'Lora';
|
|
66
|
+
/**
|
|
67
|
+
* Supported corner radius styles for UI elements.
|
|
68
|
+
*/
|
|
31
69
|
export type CornerRadius = 'none' | 'full' | 'sm' | 'md' | 'lg';
|
|
70
|
+
/**
|
|
71
|
+
* Appearance customization options.
|
|
72
|
+
*/
|
|
32
73
|
export interface IAppearance {
|
|
33
74
|
theme: 'light' | 'dark';
|
|
34
75
|
background: string;
|
|
@@ -38,41 +79,72 @@ export interface IAppearance {
|
|
|
38
79
|
cornerRadius: CornerRadius;
|
|
39
80
|
cover: string;
|
|
40
81
|
}
|
|
41
|
-
|
|
82
|
+
/**
|
|
83
|
+
* Structure of the global context values.
|
|
84
|
+
*/
|
|
85
|
+
export interface ContextInterface {
|
|
42
86
|
config: IProviderConfig;
|
|
43
87
|
appearance: IAppearance;
|
|
44
88
|
user: IUser;
|
|
45
|
-
|
|
46
|
-
|
|
89
|
+
isModalOpen: boolean;
|
|
90
|
+
isReady: boolean;
|
|
47
91
|
isDemo: boolean;
|
|
48
92
|
isAuthenticated: boolean;
|
|
49
|
-
|
|
93
|
+
availableWallets: WalletInterface[];
|
|
94
|
+
waitingStatus: 'connecting' | 'signing';
|
|
95
|
+
signTransaction: {
|
|
96
|
+
xdr: string;
|
|
97
|
+
resolver: ((value: HorizonApi.SubmitTransactionResponse) => void) | null;
|
|
98
|
+
result: HorizonApi.SubmitTransactionResponse | null;
|
|
99
|
+
};
|
|
50
100
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
101
|
+
/**
|
|
102
|
+
* Enum defining different modal views.
|
|
103
|
+
*/
|
|
104
|
+
export declare enum Routes {
|
|
105
|
+
ONBOARDING = "ONBOARDING",// View for selecting a wallet
|
|
106
|
+
WAITING = "WAITING",// View for connection process
|
|
107
|
+
SUCCESSFUL = "SUCCESSFUL",// View for connection success process
|
|
108
|
+
PROFILE = "PROFILE",// User profile view
|
|
109
|
+
SIGN_TRANSACTION = "SIGN_TRANSACTION",// User sign transaction view
|
|
110
|
+
SEND = "SEND",// User sign transaction view
|
|
111
|
+
ACTIVITY = "ACTIVITY"
|
|
55
112
|
}
|
|
56
|
-
|
|
57
|
-
|
|
113
|
+
/**
|
|
114
|
+
* Modal state management interface.
|
|
115
|
+
*/
|
|
116
|
+
export interface ModalRoute {
|
|
117
|
+
route: Routes;
|
|
58
118
|
showAllWallets: boolean;
|
|
59
119
|
}
|
|
120
|
+
/**
|
|
121
|
+
* Defines the heights for different modal views.
|
|
122
|
+
*/
|
|
60
123
|
export interface ModalHeights {
|
|
61
|
-
[
|
|
62
|
-
[
|
|
63
|
-
[
|
|
124
|
+
[Routes.PROFILE]: number;
|
|
125
|
+
[Routes.WAITING]: number;
|
|
126
|
+
[Routes.ONBOARDING]: number;
|
|
127
|
+
[Routes.SUCCESSFUL]: number;
|
|
128
|
+
[Routes.SIGN_TRANSACTION]: number;
|
|
129
|
+
[Routes.SEND]: number;
|
|
130
|
+
[Routes.ACTIVITY]: number;
|
|
64
131
|
}
|
|
132
|
+
/**
|
|
133
|
+
* Represents the result of a successful wallet connection.
|
|
134
|
+
*/
|
|
65
135
|
export interface ConnectResult {
|
|
66
136
|
publicKey: string;
|
|
67
137
|
}
|
|
138
|
+
/**
|
|
139
|
+
* Represents the result of a signed transaction.
|
|
140
|
+
*/
|
|
68
141
|
export interface SignResult {
|
|
69
142
|
signedXdr: string;
|
|
70
143
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
export interface WalletActions {
|
|
144
|
+
/**
|
|
145
|
+
* Defines the available actions for interacting with a wallet.
|
|
146
|
+
*/
|
|
147
|
+
export interface WalletInterface {
|
|
76
148
|
name: SupportedWallets;
|
|
77
149
|
website: string;
|
|
78
150
|
isAvailable: () => Promise<boolean> | boolean;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { HORIZON_SERVERS } from '../constants';
|
|
2
|
+
import { Horizon } from '@stellar/stellar-sdk';
|
|
3
|
+
type HorizonServer = Horizon.Server;
|
|
4
|
+
type NetworkKey = keyof typeof HORIZON_SERVERS;
|
|
5
|
+
export declare const getHorizonServer: (network: NetworkKey) => HorizonServer;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getNetworkByPassphrase: (passphrase: string) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getNetworkPassphrase: (network: string) => string;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const getTransactionDetails: (xdr: string, networkPassPhrase: string) => {
|
|
2
|
+
action: "createAccount" | "payment" | "pathPaymentStrictReceive" | "pathPaymentStrictSend" | "createPassiveSellOffer" | "manageSellOffer" | "manageBuyOffer" | "setOptions" | "changeTrust" | "allowTrust" | "accountMerge" | "inflation" | "manageData" | "bumpSequence" | "createClaimableBalance" | "claimClaimableBalance" | "beginSponsoringFutureReserves" | "endSponsoringFutureReserves" | "revokeSponsorship" | "clawback" | "clawbackClaimableBalance" | "setTrustLineFlags" | "liquidityPoolDeposit" | "liquidityPoolWithdraw" | "invokeHostFunction" | "extendFootprintTtl" | "restoreFootprint";
|
|
3
|
+
operations: number;
|
|
4
|
+
sender: string;
|
|
5
|
+
estimatedFee: number;
|
|
6
|
+
};
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
declare const initializeRabetMobile: () => void;
|
|
2
|
+
export default initializeRabetMobile;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { WalletInterface } from '../types';
|
|
2
|
+
export type MappedWallet = {
|
|
3
|
+
wallet: WalletInterface;
|
|
3
4
|
isAvailable: boolean;
|
|
4
|
-
}
|
|
5
|
+
};
|
|
6
|
+
declare const getMappedWallets: () => Promise<MappedWallet[]>;
|
|
7
|
+
export default getMappedWallets;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { HorizonApi } from '@stellar/stellar-sdk/lib/horizon';
|
|
2
|
+
import { WalletActions } from '../types';
|
|
3
|
+
export declare const signTransactionHandler: (wallet: WalletActions, xdr: string, address: string, networkPassphrase: string, resolver: ((value: HorizonApi.SubmitTransactionResponse) => void) | null) => Promise<HorizonApi.SubmitTransactionResponse>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Horizon } from '@stellar/stellar-sdk';
|
|
2
|
+
import { HORIZON_SERVERS } from '../../constants';
|
|
3
|
+
type HorizonServer = Horizon.Server;
|
|
4
|
+
type NetworkKey = keyof typeof HORIZON_SERVERS;
|
|
5
|
+
declare const getStellarServer: (network: NetworkKey) => HorizonServer;
|
|
6
|
+
export default getStellarServer;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
declare const getTransactionDetails: (xdr: string) => {
|
|
2
|
+
action: "createAccount" | "payment" | "pathPaymentStrictReceive" | "pathPaymentStrictSend" | "createPassiveSellOffer" | "manageSellOffer" | "manageBuyOffer" | "setOptions" | "changeTrust" | "allowTrust" | "accountMerge" | "inflation" | "manageData" | "bumpSequence" | "createClaimableBalance" | "claimClaimableBalance" | "beginSponsoringFutureReserves" | "endSponsoringFutureReserves" | "revokeSponsorship" | "clawback" | "clawbackClaimableBalance" | "setTrustLineFlags" | "liquidityPoolDeposit" | "liquidityPoolWithdraw" | "invokeHostFunction" | "extendFootprintTtl" | "restoreFootprint";
|
|
3
|
+
operations: number;
|
|
4
|
+
sender: string;
|
|
5
|
+
estimatedFee: number;
|
|
6
|
+
};
|
|
7
|
+
export default getTransactionDetails;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { WalletInterface } from '../../types';
|
|
2
|
+
declare const signTransaction: (wallet: WalletInterface, xdr: string, address: string, network: string) => Promise<import("@stellar/stellar-sdk/lib/horizon").HorizonApi.SubmitTransactionResponse>;
|
|
3
|
+
export default signTransaction;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const albedoConfig:
|
|
1
|
+
import { WalletInterface } from '../../types';
|
|
2
|
+
export declare const albedoConfig: WalletInterface;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const freighterConfig:
|
|
1
|
+
import { WalletInterface } from '../../types';
|
|
2
|
+
export declare const freighterConfig: WalletInterface;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const lobstrConfig:
|
|
1
|
+
import { WalletInterface } from '../../types';
|
|
2
|
+
export declare const lobstrConfig: WalletInterface;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const rabetConfig:
|
|
1
|
+
import { WalletInterface } from '../../types';
|
|
2
|
+
export declare const rabetConfig: WalletInterface;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const xBullConfig:
|
|
1
|
+
import { WalletInterface } from '../../types';
|
|
2
|
+
export declare const xBullConfig: WalletInterface;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { SupportedWallets,
|
|
2
|
-
export declare const walletsConfig: Record<SupportedWallets,
|
|
1
|
+
import { SupportedWallets, WalletInterface } from '../types';
|
|
2
|
+
export declare const walletsConfig: Record<SupportedWallets, WalletInterface>;
|
package/package.json
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bluxcc/react",
|
|
3
|
-
"author": "Blux",
|
|
4
|
-
"version": "0.1.
|
|
3
|
+
"author": "Blux team",
|
|
4
|
+
"version": "0.1.2",
|
|
5
5
|
"homepage": "https://blux.cc",
|
|
6
6
|
"description": "Connecting to the Stellar Ecosystem and Beyond",
|
|
7
|
-
"publishConfig": {
|
|
8
|
-
"access": "public"
|
|
9
|
-
},
|
|
10
7
|
"repository": {
|
|
11
8
|
"type": "git",
|
|
12
|
-
"url": "git+https://github.com/bluxcc"
|
|
9
|
+
"url": "git+https://github.com/bluxcc/blux"
|
|
13
10
|
},
|
|
14
11
|
"type": "module",
|
|
15
12
|
"main": "dist/index.esm.js",
|
|
@@ -23,24 +20,23 @@
|
|
|
23
20
|
}
|
|
24
21
|
},
|
|
25
22
|
"engines": {
|
|
26
|
-
"node": ">=
|
|
23
|
+
"node": ">=14.0.0"
|
|
27
24
|
},
|
|
28
25
|
"files": [
|
|
29
26
|
"dist"
|
|
30
27
|
],
|
|
31
28
|
"scripts": {
|
|
32
|
-
"dev": "rollup -c rollup.config.js --watch",
|
|
33
|
-
"build": "rollup -c rollup.config.js"
|
|
34
|
-
"prepare": "rollup -c rollup.config.js",
|
|
35
|
-
"lint": "eslint src -c eslint.config.js"
|
|
29
|
+
"dev": "rollup -c rollup.config.dev.js --watch",
|
|
30
|
+
"build": "rollup -c rollup.config.prod.js"
|
|
36
31
|
},
|
|
37
32
|
"peerDependencies": {
|
|
38
33
|
"@albedo-link/intent": "^0.12.0",
|
|
39
34
|
"@creit.tech/xbull-wallet-connect": "^0.3.0",
|
|
40
35
|
"@lobstrco/signer-extension-api": "^1.0.0-beta.0",
|
|
41
36
|
"@stellar/freighter-api": "^3.0.0",
|
|
42
|
-
"
|
|
43
|
-
"react
|
|
37
|
+
"@stellar/stellar-sdk": "^13.1.0",
|
|
38
|
+
"react": ">=17.0.0",
|
|
39
|
+
"react-dom": ">=17.0.0"
|
|
44
40
|
},
|
|
45
41
|
"devDependencies": {
|
|
46
42
|
"@eslint/js": "^9.17.0",
|
|
@@ -65,9 +61,6 @@
|
|
|
65
61
|
"typescript": "^5.7.2",
|
|
66
62
|
"typescript-eslint": "^8.19.1"
|
|
67
63
|
},
|
|
68
|
-
"dependencies": {
|
|
69
|
-
"clsx": "^2.1.1"
|
|
70
|
-
},
|
|
71
64
|
"optionalDependencies": {
|
|
72
65
|
"@rollup/rollup-darwin-x64": "4.30.1",
|
|
73
66
|
"@rollup/rollup-linux-x64-gnu": "4.6.1"
|