@bluxcc/react 0.1.1 → 0.1.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.
Files changed (68) hide show
  1. package/README.md +2 -2
  2. package/dist/assets/Icons.d.ts +14 -1
  3. package/dist/assets/bluxLogo.d.ts +3 -1
  4. package/dist/assets/logos.d.ts +12 -6
  5. package/dist/chains.d.ts +8 -0
  6. package/dist/components/Button/index.d.ts +13 -6
  7. package/dist/components/CardItem/index.d.ts +14 -0
  8. package/dist/components/Input/OTPInput.d.ts +8 -0
  9. package/dist/components/Input/index.d.ts +16 -0
  10. package/dist/components/Modal/Header/index.d.ts +3 -3
  11. package/dist/components/Modal/index.d.ts +3 -5
  12. package/dist/components/Transaction/History/index.d.ts +10 -0
  13. package/dist/components/Transaction/Summery/index.d.ts +9 -0
  14. package/dist/constants/index.d.ts +6 -4
  15. package/dist/containers/BluxModal/content.d.ts +11 -0
  16. package/dist/containers/BluxModal/index.d.ts +7 -0
  17. package/dist/containers/ConnectModal/content.d.ts +11 -0
  18. package/dist/containers/ConnectModal/index.d.ts +2 -1
  19. package/dist/containers/Pages/Activity/index.d.ts +3 -0
  20. package/dist/containers/Pages/ConfirmCode/index.d.ts +3 -0
  21. package/dist/containers/Pages/OnBoarding/index.d.ts +7 -0
  22. package/dist/containers/Pages/Profile/index.d.ts +3 -0
  23. package/dist/containers/Pages/Send/index.d.ts +3 -0
  24. package/dist/containers/Pages/SignTransaction/index.d.ts +3 -0
  25. package/dist/containers/Pages/Successful/index.d.ts +3 -0
  26. package/dist/containers/Pages/Waiting/index.d.ts +3 -0
  27. package/dist/context/provider.d.ts +3 -4
  28. package/dist/hooks/useAccount.d.ts +12 -0
  29. package/dist/hooks/useBlux.d.ts +4 -2
  30. package/dist/index.cjs.js +1 -1
  31. package/dist/index.cjs.js.map +1 -1
  32. package/dist/index.d.ts +3 -0
  33. package/dist/index.esm.js +1 -1
  34. package/dist/index.esm.js.map +1 -1
  35. package/dist/networks.d.ts +8 -0
  36. package/dist/types/index.d.ts +114 -23
  37. package/dist/useStellar/index.d.ts +2 -0
  38. package/dist/useStellar/useBalance.d.ts +8 -0
  39. package/dist/utils/BN.d.ts +3 -0
  40. package/dist/utils/capitalizeFirstLetter.d.ts +2 -0
  41. package/dist/utils/getBorderRadius.d.ts +2 -1
  42. package/dist/utils/getContrastColor.d.ts +2 -0
  43. package/dist/utils/getHorizonServer.d.ts +6 -0
  44. package/dist/utils/getInitialHeight.d.ts +2 -0
  45. package/dist/utils/getNetworkByPassphrase.d.ts +1 -2
  46. package/dist/utils/getTransactionDetails.d.ts +6 -0
  47. package/dist/utils/handleIcons.d.ts +2 -1
  48. package/dist/utils/handleLogos.d.ts +3 -0
  49. package/dist/utils/humanizeAmount.d.ts +3 -0
  50. package/dist/utils/initializeRabetMobile.d.ts +2 -1
  51. package/dist/utils/mappedWallets.d.ts +4 -3
  52. package/dist/utils/setWalletNetwork.d.ts +3 -0
  53. package/dist/utils/signTransactionHandler.d.ts +3 -0
  54. package/dist/utils/stellar/getExplorerUrl.d.ts +2 -0
  55. package/dist/utils/stellar/getNetworkByPassphrase.d.ts +2 -0
  56. package/dist/utils/stellar/getNetworkPassphrase.d.ts +2 -0
  57. package/dist/utils/stellar/getStellarServer.d.ts +6 -0
  58. package/dist/utils/stellar/getTransactionDetails.d.ts +7 -0
  59. package/dist/utils/stellar/signTransaction.d.ts +3 -0
  60. package/dist/utils/stellar/submitTransaction.d.ts +3 -0
  61. package/dist/utils/submitTransaction.d.ts +2 -0
  62. package/dist/wallets/configs/albedoConfig.d.ts +2 -2
  63. package/dist/wallets/configs/freighterConfig.d.ts +2 -2
  64. package/dist/wallets/configs/lobstrConfig.d.ts +2 -2
  65. package/dist/wallets/configs/rabetConfig.d.ts +2 -2
  66. package/dist/wallets/configs/xbullConfig.d.ts +2 -2
  67. package/dist/wallets/walletsConfig.d.ts +2 -2
  68. package/package.json +4 -8
@@ -0,0 +1,8 @@
1
+ import { Networks } from "@stellar/stellar-sdk";
2
+ export declare const networks: {
3
+ mainnet: Networks;
4
+ testnet: Networks;
5
+ sandbox: Networks;
6
+ futurenet: Networks;
7
+ standalone: Networks;
8
+ };
@@ -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,25 +20,67 @@ 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
+ interface IServers {
33
+ horizon?: string;
34
+ soroban?: string;
35
+ }
36
+ export type ITransports = Record<string, IServers>;
37
+ /**
38
+ * Configuration options for the provider.
39
+ */
15
40
  export interface IProviderConfig {
16
41
  appName: string;
17
42
  appLogo?: string;
18
- networkPassphrase: string;
19
- network: 'mainnet' | 'testnet' | 'futurenet' | 'sandbox' | 'standalone';
43
+ networks: string[];
44
+ appearance: IAppearance;
45
+ transports?: ITransports;
46
+ loginMethods?: Array<'wallet' | 'email' | 'sms' | 'google' | 'twitter' | 'discord' | 'github' | 'passkey'>;
20
47
  }
48
+ /**
49
+ * Information about the connected wallet.
50
+ */
21
51
  export interface WalletInfo {
22
- name: SupportedWallets | null;
52
+ passphrase: string;
53
+ name: SupportedWallets;
23
54
  address: string | null;
24
55
  }
56
+ /**
57
+ * User-related information within the context.
58
+ */
25
59
  export interface IUser {
26
60
  wallet: WalletInfo | null;
61
+ email: string | null;
62
+ phoneNumber: number | null;
27
63
  }
64
+ /**
65
+ * Context state management interface.
66
+ */
28
67
  export interface ContextState {
29
- value: ContextValues;
30
- setValue: React.Dispatch<React.SetStateAction<ContextValues>>;
68
+ value: ContextInterface;
69
+ setValue: React.Dispatch<React.SetStateAction<ContextInterface>>;
70
+ route: Routes;
71
+ setRoute: React.Dispatch<React.SetStateAction<Routes>>;
31
72
  }
32
- export type SupportedFonts = 'Manrope' | 'Inter' | 'JetBrains Mono' | 'Roboto';
73
+ /**
74
+ * Supported font options for UI customization.
75
+ */
76
+ export type SupportedFonts = 'Manrope' | 'Inter' | 'JetBrains Mono' | 'Lora';
77
+ /**
78
+ * Supported corner radius styles for UI elements.
79
+ */
33
80
  export type CornerRadius = 'none' | 'full' | 'sm' | 'md' | 'lg';
81
+ /**
82
+ * Appearance customization options.
83
+ */
34
84
  export interface IAppearance {
35
85
  theme: 'light' | 'dark';
36
86
  background: string;
@@ -40,37 +90,77 @@ export interface IAppearance {
40
90
  cornerRadius: CornerRadius;
41
91
  cover: string;
42
92
  }
43
- export interface ContextValues {
93
+ /**
94
+ * Structure of the global context values.
95
+ */
96
+ export interface ContextInterface {
44
97
  config: IProviderConfig;
45
- appearance: IAppearance;
46
98
  user: IUser;
47
- openModal: boolean;
48
- ready: boolean;
99
+ isModalOpen: boolean;
100
+ isReady: boolean;
49
101
  isDemo: boolean;
50
102
  isAuthenticated: boolean;
51
- isConnecting: boolean;
103
+ availableWallets: WalletInterface[];
104
+ waitingStatus: 'connecting' | 'signing';
105
+ signTransaction: {
106
+ xdr: string;
107
+ resolver: ((value: HorizonApi.SubmitTransactionResponse) => void) | null;
108
+ result: HorizonApi.SubmitTransactionResponse | null;
109
+ };
52
110
  }
53
- export declare enum ModalView {
54
- CHOOSE_WALLET = "CHOOSE_WALLET",
55
- CONNECTING = "CONNECTING",
56
- PROFILE = "PROFILE"
111
+ /**
112
+ * Enum defining different modal views.
113
+ */
114
+ export declare enum Routes {
115
+ ONBOARDING = "ONBOARDING",// View for selecting a wallet
116
+ WAITING = "WAITING",// View for connection process
117
+ SUCCESSFUL = "SUCCESSFUL",// View for connection success process
118
+ PROFILE = "PROFILE",// User profile view
119
+ SIGN_TRANSACTION = "SIGN_TRANSACTION",// User sign transaction view
120
+ SEND = "SEND",// User sign transaction view
121
+ ACTIVITY = "ACTIVITY",// User sign transaction view
122
+ OTP = "OTP"
57
123
  }
58
- export interface ModalState {
59
- view: ModalView;
124
+ /**
125
+ * Modal state management interface.
126
+ */
127
+ export interface ModalRoute {
128
+ route: Routes;
60
129
  showAllWallets: boolean;
61
130
  }
131
+ /**
132
+ * Defines the heights for different modal views.
133
+ */
62
134
  export interface ModalHeights {
63
- [ModalView.PROFILE]: number;
64
- [ModalView.CONNECTING]: number;
65
- [ModalView.CHOOSE_WALLET]: number;
135
+ [Routes.PROFILE]: number;
136
+ [Routes.WAITING]: number;
137
+ [Routes.ONBOARDING]: number;
138
+ [Routes.SUCCESSFUL]: number;
139
+ [Routes.SIGN_TRANSACTION]: number;
140
+ [Routes.SEND]: number;
141
+ [Routes.ACTIVITY]: number;
142
+ [Routes.OTP]: number;
66
143
  }
144
+ /**
145
+ * Represents the result of a successful wallet connection.
146
+ */
67
147
  export interface ConnectResult {
68
148
  publicKey: string;
69
149
  }
150
+ /**
151
+ * Represents the result of a signed transaction.
152
+ */
70
153
  export interface SignResult {
71
154
  signedXdr: string;
72
155
  }
73
- export interface WalletActions {
156
+ export interface GetNetworkResult {
157
+ network: string;
158
+ passphrase: string;
159
+ }
160
+ /**
161
+ * Defines the available actions for interacting with a wallet.
162
+ */
163
+ export interface WalletInterface {
74
164
  name: SupportedWallets;
75
165
  website: string;
76
166
  isAvailable: () => Promise<boolean> | boolean;
@@ -88,9 +178,9 @@ export interface WalletActions {
88
178
  submit?: boolean;
89
179
  }) => Promise<string>;
90
180
  disconnect?: () => Promise<void>;
91
- getNetwork?: () => Promise<{
181
+ getNetwork: () => Promise<{
92
182
  network: string;
93
- networkPassphrase: string;
183
+ passphrase: string;
94
184
  }>;
95
185
  signMessage?: (message: string, options?: {
96
186
  networkPassphrase?: string;
@@ -109,3 +199,4 @@ export interface WalletActions {
109
199
  signerPublicKey?: string;
110
200
  }>;
111
201
  }
202
+ export {};
@@ -0,0 +1,2 @@
1
+ import useBalance from "./useBalance";
2
+ export { useBalance, };
@@ -0,0 +1,8 @@
1
+ type UseBalanceParameters = {
2
+ address: string;
3
+ blockNumber?: number;
4
+ chainId?: number;
5
+ enabled?: boolean;
6
+ };
7
+ declare const useBalance: (_params: UseBalanceParameters) => number;
8
+ export default useBalance;
@@ -0,0 +1,3 @@
1
+ import BigNumber from 'bignumber.js';
2
+ declare const BN: typeof BigNumber;
3
+ export default BN;
@@ -0,0 +1,2 @@
1
+ declare const capitalizeFirstLetter: (str: string) => string;
2
+ export default capitalizeFirstLetter;
@@ -1,2 +1,3 @@
1
1
  import { CornerRadius } from '../types';
2
- export declare const getBorderRadius: (cornerRadius: CornerRadius) => string;
2
+ declare const getBorderRadius: (cornerRadius: CornerRadius) => string;
3
+ export default getBorderRadius;
@@ -0,0 +1,2 @@
1
+ declare const getContrastColor: (bgColor: string) => string;
2
+ export default getContrastColor;
@@ -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,2 @@
1
+ import { Routes } from '../types';
2
+ export declare const getInitialHeight: (route: Routes) => number;
@@ -1,2 +1 @@
1
- import { WalletNetwork } from '../types';
2
- export declare const getNetworkByPassphrase: (passphrase: string) => WalletNetwork;
1
+ export declare const getNetworkByPassphrase: (passphrase: 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,2 +1,3 @@
1
1
  import React from 'react';
2
- export declare const handleIcons: (walletName: string) => React.JSX.Element | null;
2
+ declare const handleIcons: (walletName: string) => React.JSX.Element | null;
3
+ export default handleIcons;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const handleLogos: (walletName: string) => React.JSX.Element | null;
3
+ export default handleLogos;
@@ -0,0 +1,3 @@
1
+ export declare function sevenDigit(number: number | string): string;
2
+ declare function humanizeAmount(amount: number | string, big?: boolean): string;
3
+ export default humanizeAmount;
@@ -1 +1,2 @@
1
- export declare const initializeRabetMobile: () => void;
1
+ declare const initializeRabetMobile: () => void;
2
+ export default initializeRabetMobile;
@@ -1,6 +1,7 @@
1
- import { WalletActions } from '../types';
1
+ import { WalletInterface } from '../types';
2
2
  export type MappedWallet = {
3
- wallet: WalletActions;
3
+ wallet: WalletInterface;
4
4
  isAvailable: boolean;
5
5
  };
6
- export declare const getMappedWallets: () => Promise<MappedWallet[]>;
6
+ declare const getMappedWallets: () => Promise<MappedWallet[]>;
7
+ export default getMappedWallets;
@@ -0,0 +1,3 @@
1
+ import { WalletInterface } from "../types";
2
+ declare const setWalletNetwork: (wallet: WalletInterface, networks: string[]) => Promise<string>;
3
+ export default setWalletNetwork;
@@ -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,2 @@
1
+ declare const getExplorerUrl: (networkPassphrase: string, endpoint: string) => string;
2
+ export default getExplorerUrl;
@@ -0,0 +1,2 @@
1
+ declare const getNetworkByPassphrase: (passphrase: string) => string;
2
+ export default getNetworkByPassphrase;
@@ -0,0 +1,2 @@
1
+ declare const getNetworkPassphrase: (network: string) => string;
2
+ export default getNetworkPassphrase;
@@ -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;
@@ -0,0 +1,3 @@
1
+ import { Horizon } from '@stellar/stellar-sdk';
2
+ declare const submitTransaction: (xdr: string, network: string) => Promise<Horizon.HorizonApi.SubmitTransactionResponse>;
3
+ export default submitTransaction;
@@ -0,0 +1,2 @@
1
+ import { Horizon } from '@stellar/stellar-sdk';
2
+ export declare const submitTransaction: (xdr: string, networkPassPhrase: string) => Promise<Horizon.HorizonApi.SubmitTransactionResponse>;
@@ -1,2 +1,2 @@
1
- import { WalletActions } from '../../types';
2
- export declare const albedoConfig: WalletActions;
1
+ import { WalletInterface } from '../../types';
2
+ export declare const albedoConfig: WalletInterface;
@@ -1,2 +1,2 @@
1
- import { WalletActions } from '../../types';
2
- export declare const freighterConfig: WalletActions;
1
+ import { WalletInterface } from '../../types';
2
+ export declare const freighterConfig: WalletInterface;
@@ -1,2 +1,2 @@
1
- import { WalletActions } from '../../types';
2
- export declare const lobstrConfig: WalletActions;
1
+ import { WalletInterface } from '../../types';
2
+ export declare const lobstrConfig: WalletInterface;
@@ -1,2 +1,2 @@
1
- import { WalletActions } from '../../types';
2
- export declare const rabetConfig: WalletActions;
1
+ import { WalletInterface } from '../../types';
2
+ export declare const rabetConfig: WalletInterface;
@@ -1,2 +1,2 @@
1
- import { WalletActions } from '../../types';
2
- export declare const xBullConfig: WalletActions;
1
+ import { WalletInterface } from '../../types';
2
+ export declare const xBullConfig: WalletInterface;
@@ -1,2 +1,2 @@
1
- import { SupportedWallets, WalletActions } from '../types';
2
- export declare const walletsConfig: Record<SupportedWallets, WalletActions>;
1
+ import { SupportedWallets, WalletInterface } from '../types';
2
+ export declare const walletsConfig: Record<SupportedWallets, WalletInterface>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bluxcc/react",
3
3
  "author": "Blux team",
4
- "version": "0.1.1",
4
+ "version": "0.1.3",
5
5
  "homepage": "https://blux.cc",
6
6
  "description": "Connecting to the Stellar Ecosystem and Beyond",
7
7
  "repository": {
@@ -26,16 +26,15 @@
26
26
  "dist"
27
27
  ],
28
28
  "scripts": {
29
- "dev": "rollup -c rollup.config.js --watch",
30
- "build": "rollup -c rollup.config.js",
31
- "prepare": "rollup -c rollup.config.js",
32
- "lint": "eslint src -c eslint.config.js"
29
+ "dev": "rollup -c rollup.config.dev.js --watch",
30
+ "build": "rollup -c rollup.config.prod.js"
33
31
  },
34
32
  "peerDependencies": {
35
33
  "@albedo-link/intent": "^0.12.0",
36
34
  "@creit.tech/xbull-wallet-connect": "^0.3.0",
37
35
  "@lobstrco/signer-extension-api": "^1.0.0-beta.0",
38
36
  "@stellar/freighter-api": "^3.0.0",
37
+ "@stellar/stellar-sdk": "^13.1.0",
39
38
  "react": ">=17.0.0",
40
39
  "react-dom": ">=17.0.0"
41
40
  },
@@ -62,9 +61,6 @@
62
61
  "typescript": "^5.7.2",
63
62
  "typescript-eslint": "^8.19.1"
64
63
  },
65
- "dependencies": {
66
- "clsx": "^2.1.1"
67
- },
68
64
  "optionalDependencies": {
69
65
  "@rollup/rollup-darwin-x64": "4.30.1",
70
66
  "@rollup/rollup-linux-x64-gnu": "4.6.1"