@bluxcc/react 0.1.5 → 0.1.7

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 (36) hide show
  1. package/dist/assets/Icons.d.ts +1 -0
  2. package/dist/components/Modal/Backdrop/index.d.ts +2 -1
  3. package/dist/components/Modal/index.d.ts +2 -1
  4. package/dist/components/Transaction/History/index.d.ts +8 -6
  5. package/dist/components/Transaction/Summery/index.d.ts +1 -1
  6. package/dist/constants/index.d.ts +2 -1
  7. package/dist/constants/networkDetails.d.ts +8 -0
  8. package/dist/containers/BluxModal/content.d.ts +4 -2
  9. package/dist/containers/Pages/WrongNetwork/index.d.ts +3 -0
  10. package/dist/context/provider.d.ts +2 -2
  11. package/dist/context/useCheckWalletNetwork.d.ts +3 -0
  12. package/dist/hooks/useAccount.d.ts +1 -1
  13. package/dist/hooks/useBlux.d.ts +2 -1
  14. package/dist/hooks/useCheckProvider.d.ts +2 -0
  15. package/dist/hooks/useCustomNetwork.d.ts +7 -0
  16. package/dist/index.cjs.js +1 -1
  17. package/dist/index.cjs.js.map +1 -1
  18. package/dist/index.d.ts +2 -2
  19. package/dist/index.esm.js +1 -1
  20. package/dist/index.esm.js.map +1 -1
  21. package/dist/networks.d.ts +1 -1
  22. package/dist/types/index.d.ts +20 -8
  23. package/dist/useStellar/index.d.ts +6 -2
  24. package/dist/useStellar/useAccount.d.ts +12 -0
  25. package/dist/useStellar/useBalance.d.ts +11 -6
  26. package/dist/useStellar/useNetwork.d.ts +2 -0
  27. package/dist/useStellar/useSwitchNetwork.d.ts +5 -0
  28. package/dist/useStellar/useTransactions.d.ts +18 -0
  29. package/dist/utils/formatDate.d.ts +2 -0
  30. package/dist/utils/getWalletNetwork.d.ts +1 -1
  31. package/dist/utils/network/getNetworkRpc.d.ts +4 -0
  32. package/dist/utils/stellar/getTransactionDetails.d.ts +2 -2
  33. package/dist/utils/stellar/signTransaction.d.ts +1 -1
  34. package/dist/utils/stellar/submitTransaction.d.ts +2 -1
  35. package/dist/utils/toTitleFormat.d.ts +2 -0
  36. package/package.json +3 -1
@@ -1,4 +1,4 @@
1
- import { Networks } from "@stellar/stellar-sdk";
1
+ import { Networks } from '@stellar/stellar-sdk';
2
2
  export declare const networks: {
3
3
  mainnet: Networks;
4
4
  testnet: Networks;
@@ -1,7 +1,6 @@
1
- import { Horizon } from '@stellar/stellar-sdk';
1
+ import { Horizon, rpc } from '@stellar/stellar-sdk';
2
2
  import { HorizonApi } from '@stellar/stellar-sdk/lib/horizon';
3
3
  import { Url } from '../utils/network/url';
4
- import { Fallback } from '../utils/network/fallback';
5
4
  /**
6
5
  * Enum representing the supported wallets in the system.
7
6
  */
@@ -32,8 +31,8 @@ export interface AccountData {
32
31
  transactions?: Horizon.ServerApi.TransactionRecord[];
33
32
  }
34
33
  interface IServers {
35
- horizon?: Url | Fallback;
36
- soroban?: Url | Fallback;
34
+ horizon: Url;
35
+ soroban: Url;
37
36
  }
38
37
  export type ITransports = Record<string, IServers>;
39
38
  /**
@@ -42,6 +41,7 @@ export type ITransports = Record<string, IServers>;
42
41
  export interface IProviderConfig {
43
42
  appName: string;
44
43
  networks: string[];
44
+ defaultNetwork: string;
45
45
  appearance?: Partial<IAppearance>;
46
46
  transports?: ITransports;
47
47
  loginMethods?: Array<'wallet' | 'email' | 'sms' | 'google' | 'twitter' | 'discord' | 'github' | 'passkey'>;
@@ -81,21 +81,23 @@ export interface ContextState {
81
81
  /**
82
82
  * Supported font options for UI customization.
83
83
  */
84
- export type SupportedFonts = 'Manrope' | 'Inter' | 'JetBrains Mono' | 'Lora';
85
84
  /**
86
85
  * Supported corner radius styles for UI elements.
87
86
  */
88
- export type CornerRadius = 'none' | 'full' | 'sm' | 'md' | 'lg';
89
87
  /**
90
88
  * Appearance customization options.
91
89
  */
92
90
  export interface IAppearance {
93
91
  theme: 'light' | 'dark';
94
92
  background: string;
93
+ bgField: string;
95
94
  accent: string;
96
95
  textColor: string;
97
- font: SupportedFonts | string;
98
- cornerRadius: CornerRadius | string;
96
+ font: string;
97
+ cornerRadius: string;
98
+ borderColor: string;
99
+ borderWidth: string;
100
+ includeBorders: boolean;
99
101
  logo?: React.ImgHTMLAttributes<HTMLImageElement>['src'];
100
102
  }
101
103
  /**
@@ -110,17 +112,24 @@ export interface ContextInterface {
110
112
  isAuthenticated: boolean;
111
113
  availableWallets: WalletInterface[];
112
114
  waitingStatus: 'connecting' | 'signing';
115
+ activeNetwork: string;
113
116
  signTransaction: {
114
117
  xdr: string;
118
+ network: string;
115
119
  resolver: ((value: HorizonApi.SubmitTransactionResponse) => void) | null;
116
120
  result: HorizonApi.SubmitTransactionResponse | null;
117
121
  };
122
+ servers: {
123
+ horizon: Horizon.Server;
124
+ soroban: rpc.Server;
125
+ };
118
126
  }
119
127
  /**
120
128
  * Enum defining different modal views.
121
129
  */
122
130
  export declare enum Routes {
123
131
  ONBOARDING = "ONBOARDING",// View for selecting a wallet
132
+ WRONG_NETWORK = "WRONG_NETWORK",// View for selecting a wallet
124
133
  WAITING = "WAITING",// View for connection process
125
134
  SUCCESSFUL = "SUCCESSFUL",// View for connection success process
126
135
  PROFILE = "PROFILE",// User profile view
@@ -165,6 +174,9 @@ export interface GetNetworkResult {
165
174
  network: string;
166
175
  passphrase: string;
167
176
  }
177
+ export interface ISendTransactionOptions {
178
+ network?: string;
179
+ }
168
180
  /**
169
181
  * Defines the available actions for interacting with a wallet.
170
182
  */
@@ -1,2 +1,6 @@
1
- import useBalance from "./useBalance";
2
- export { useBalance, };
1
+ import useAccount from './useAccount';
2
+ import useBalance from './useBalance';
3
+ import useNetwork from './useNetwork';
4
+ import useTransactions from './useTransactions';
5
+ import useSwitchNetwork from './useSwitchNetwork';
6
+ export { useAccount, useBalance, useNetwork, useTransactions, useSwitchNetwork, };
@@ -0,0 +1,12 @@
1
+ import { Horizon } from '@stellar/stellar-sdk';
2
+ interface UseAccountProps {
3
+ address?: string;
4
+ network?: string;
5
+ }
6
+ interface UseAccountResult {
7
+ loading: boolean;
8
+ error: Error | null;
9
+ account: Horizon.AccountResponse | null;
10
+ }
11
+ declare const useAccount: (params?: UseAccountProps) => UseAccountResult;
12
+ export default useAccount;
@@ -1,8 +1,13 @@
1
- type UseBalanceParameters = {
2
- address: string;
3
- blockNumber?: number;
4
- chainId?: number;
5
- enabled?: boolean;
1
+ import { Asset } from "@stellar/stellar-sdk";
2
+ type UseBalanceParams = {
3
+ address?: string;
4
+ network?: string;
5
+ asset?: string | Asset;
6
6
  };
7
- declare const useBalance: (_params: UseBalanceParameters) => number;
7
+ interface UseBalanceResult {
8
+ loading: boolean;
9
+ error: Error | null;
10
+ balance: string | null;
11
+ }
12
+ declare const useBalance: ({ asset, address, network }: UseBalanceParams) => UseBalanceResult;
8
13
  export default useBalance;
@@ -0,0 +1,2 @@
1
+ declare const useNetwork: () => string;
2
+ export default useNetwork;
@@ -0,0 +1,5 @@
1
+ declare const useSwitchNetwork: () => {
2
+ switchNetwork: (newNetwork: string) => void;
3
+ networks: string[];
4
+ };
5
+ export default useSwitchNetwork;
@@ -0,0 +1,18 @@
1
+ import { Horizon } from '@stellar/stellar-sdk';
2
+ interface UseTransactionsProps<T extends boolean = false> {
3
+ limit?: number;
4
+ address?: string;
5
+ network?: string;
6
+ includeOperations?: T;
7
+ }
8
+ interface TransactionRecordWithOperations extends Omit<Horizon.ServerApi.TransactionRecord, 'operations'> {
9
+ operations: Horizon.ServerApi.OperationRecord[];
10
+ }
11
+ type TransactionRecord<T extends boolean> = T extends true ? TransactionRecordWithOperations : Horizon.ServerApi.TransactionRecord;
12
+ interface UseTransactionsResult<T extends boolean> {
13
+ loading: boolean;
14
+ error: Error | null;
15
+ transactions: TransactionRecord<T>[] | null;
16
+ }
17
+ declare const useTransactions: <T extends boolean = false>(params?: UseTransactionsProps<T>) => UseTransactionsResult<T>;
18
+ export default useTransactions;
@@ -0,0 +1,2 @@
1
+ declare const formatDate: (isoString: string) => string;
2
+ export default formatDate;
@@ -1,3 +1,3 @@
1
1
  import { WalletInterface } from '../types';
2
- declare const getWalletNetwork: (wallet: WalletInterface, networks: string[]) => Promise<string>;
2
+ declare const getWalletNetwork: (wallet: WalletInterface) => Promise<string>;
3
3
  export default getWalletNetwork;
@@ -0,0 +1,4 @@
1
+ import { ITransports } from "../../types";
2
+ import { NetworkDetails } from "../../constants/networkDetails";
3
+ declare const getNetworkRpc: (network: string, transports: ITransports) => NetworkDetails;
4
+ export default getNetworkRpc;
@@ -1,5 +1,5 @@
1
- declare const getTransactionDetails: (xdr: string) => {
2
- action: "payment" | "createAccount" | "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";
1
+ declare const getTransactionDetails: (xdr: string, network: 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
3
  operations: number;
4
4
  sender: string;
5
5
  estimatedFee: number;
@@ -1,3 +1,3 @@
1
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>;
2
+ declare const signTransaction: (wallet: WalletInterface, xdr: string, address: string, network: string) => Promise<string>;
3
3
  export default signTransaction;
@@ -1,3 +1,4 @@
1
1
  import { Horizon } from '@stellar/stellar-sdk';
2
- declare const submitTransaction: (xdr: string, network: string) => Promise<Horizon.HorizonApi.SubmitTransactionResponse>;
2
+ import { ITransports } from '../../types';
3
+ declare const submitTransaction: (xdr: string, network: string, transports: ITransports) => Promise<Horizon.HorizonApi.SubmitTransactionResponse>;
3
4
  export default submitTransaction;
@@ -0,0 +1,2 @@
1
+ declare const toTitleFormat: (str: string) => string;
2
+ export default toTitleFormat;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bluxcc/react",
3
3
  "author": "Blux team",
4
- "version": "0.1.5",
4
+ "version": "0.1.7",
5
5
  "homepage": "https://blux.cc",
6
6
  "description": "Connecting to the Stellar Ecosystem and Beyond",
7
7
  "repository": {
@@ -54,6 +54,8 @@
54
54
  "eslint-plugin-react-hooks": "^5.1.0",
55
55
  "globals": "^15.14.0",
56
56
  "postcss": "^8.4.49",
57
+ "prettier": "^3.5.3",
58
+ "prettier-plugin-tailwindcss": "^0.6.11",
57
59
  "rollup": "^4.29.1",
58
60
  "rollup-plugin-peer-deps-external": "^2.2.4",
59
61
  "rollup-plugin-postcss": "^4.0.2",