@0xsquid/ui 0.14.0 → 0.15.1
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/dist/cjs/index.js +3794 -291
- package/dist/cjs/types/components/controls/NumericInput.d.ts +28 -8
- package/dist/cjs/types/components/layout/SwapConfiguration.d.ts +2 -4
- package/dist/cjs/types/core/numbers.d.ts +23 -0
- package/dist/cjs/types/types/components.d.ts +1 -0
- package/dist/esm/index.js +3795 -292
- package/dist/esm/types/components/controls/NumericInput.d.ts +28 -8
- package/dist/esm/types/components/layout/SwapConfiguration.d.ts +2 -4
- package/dist/esm/types/core/numbers.d.ts +23 -0
- package/dist/esm/types/types/components.d.ts +1 -0
- package/dist/index.css +24 -0
- package/dist/index.d.ts +30 -12
- package/package.json +2 -1
|
@@ -1,11 +1,31 @@
|
|
|
1
|
-
import
|
|
2
|
-
interface
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { SwapDirection } from '../../types/components';
|
|
2
|
+
interface Token {
|
|
3
|
+
price: number;
|
|
4
|
+
symbol: string;
|
|
5
|
+
decimals: number;
|
|
6
|
+
}
|
|
7
|
+
interface NumericInputProps {
|
|
8
|
+
token: Token;
|
|
9
|
+
onAmountChange: (tokenAmount: string) => void;
|
|
10
|
+
forcedAmount?: string;
|
|
11
|
+
maxDecimals?: {
|
|
12
|
+
token: number;
|
|
13
|
+
usd: number;
|
|
14
|
+
};
|
|
15
|
+
formatIfVerySmall?: {
|
|
16
|
+
token: string;
|
|
17
|
+
usd: string;
|
|
18
|
+
};
|
|
19
|
+
showDetails?: boolean;
|
|
20
|
+
isLoading?: boolean;
|
|
21
|
+
error?: {
|
|
22
|
+
message: string;
|
|
23
|
+
};
|
|
7
24
|
balance?: string;
|
|
8
|
-
|
|
25
|
+
priceImpactPercentage?: string;
|
|
26
|
+
criticalPriceImpactPercentage?: number;
|
|
27
|
+
direction?: SwapDirection;
|
|
28
|
+
amountUsd?: string;
|
|
9
29
|
}
|
|
10
|
-
export declare
|
|
30
|
+
export declare function NumericInput({ priceImpactPercentage, balance, error, criticalPriceImpactPercentage, token, onAmountChange, forcedAmount, maxDecimals, formatIfVerySmall, showDetails, isLoading, direction, amountUsd, }: NumericInputProps): import("react/jsx-runtime").JSX.Element;
|
|
11
31
|
export {};
|
|
@@ -4,7 +4,7 @@ interface SwapConfigurationProps {
|
|
|
4
4
|
priceImpactPercentage?: string;
|
|
5
5
|
amount?: string;
|
|
6
6
|
forcedAmount?: string;
|
|
7
|
-
|
|
7
|
+
amountUsd?: string;
|
|
8
8
|
tokenPrice?: number;
|
|
9
9
|
balance?: string;
|
|
10
10
|
isFetching?: boolean;
|
|
@@ -23,13 +23,11 @@ interface SwapConfigurationProps {
|
|
|
23
23
|
onAmountChange?: (amount: string) => void;
|
|
24
24
|
onWalletButtonClick?: () => void;
|
|
25
25
|
onAssetsButtonClick?: () => void;
|
|
26
|
-
onBalanceButtonClick?: () => void;
|
|
27
26
|
error?: {
|
|
28
27
|
message: string;
|
|
29
28
|
};
|
|
30
29
|
criticalPriceImpactPercentage?: number;
|
|
31
30
|
emptyAddressLabel?: string;
|
|
32
|
-
onSwapAmountButtonClick?: () => void;
|
|
33
31
|
}
|
|
34
|
-
export declare function SwapConfiguration({
|
|
32
|
+
export declare function SwapConfiguration({ amount, tokenPrice, isFetching, chain, token, direction, onAmountChange, onWalletButtonClick, onAssetsButtonClick, address, emptyAddressLabel, balance, criticalPriceImpactPercentage, error, priceImpactPercentage, amountUsd, }: SwapConfigurationProps): import("react/jsx-runtime").JSX.Element;
|
|
35
33
|
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convert token amount to USD
|
|
3
|
+
* @param {string|number} tokenAmount - The amount of tokens
|
|
4
|
+
* @param {string|number} tokenPrice - The price of one token in USD
|
|
5
|
+
* @returns {BigNumber} - The equivalent amount in USD
|
|
6
|
+
*/
|
|
7
|
+
export declare function convertTokenAmountToUSD(tokenAmount: string | number, tokenPrice: string | number, maxDecimals?: number): string;
|
|
8
|
+
/**
|
|
9
|
+
* Convert USD to token amount
|
|
10
|
+
* @param {string|number} usdAmount - The amount in USD
|
|
11
|
+
* @param {string|number} tokenPrice - The price of one token in USD
|
|
12
|
+
* @param {number} maxDecimals - The maximum number of decimals
|
|
13
|
+
* @returns {BigNumber} - The equivalent amount of tokens
|
|
14
|
+
*/
|
|
15
|
+
export declare function convertUSDToTokenAmount(usdAmount: string | number, tokenPrice: string | number, maxDecimals: number): string;
|
|
16
|
+
/**
|
|
17
|
+
* Formats a number to the en-US number format
|
|
18
|
+
*
|
|
19
|
+
* @param amount - The number to format
|
|
20
|
+
* @returns The formatted string
|
|
21
|
+
*/
|
|
22
|
+
export declare function formatAmount(amount: number | bigint | string): string;
|
|
23
|
+
export declare function trimExtraDecimals(value: string, maxDecimals?: number): string;
|
|
@@ -26,3 +26,4 @@ export declare enum SwapState {
|
|
|
26
26
|
export type DetailsToolbarState = 'full' | 'loading' | 'empty' | 'error';
|
|
27
27
|
export type ThemeType = 'light' | 'dark';
|
|
28
28
|
export type SwapStepItemStatus = 'pending' | 'waiting' | 'ongoing' | 'executed' | 'success' | 'error' | 'warning';
|
|
29
|
+
export type InputMode = 'token' | 'price';
|