@gearbox-protocol/ui-kit 3.9.0 → 3.10.0
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.
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { MultiAssetCellProps } from '../../assets-list-cell';
|
|
2
2
|
import { LocaleKeys } from '../../../locale';
|
|
3
|
+
import { TokenMetaInfo } from '../../../types/common';
|
|
3
4
|
import { PoolDTO, PoolTableCellContext, PoolTableColumnDef } from './types';
|
|
4
5
|
import type * as React from "react";
|
|
5
6
|
interface ColumnHeaderOptions {
|
|
@@ -15,86 +16,86 @@ interface ColumnHeaderOptions {
|
|
|
15
16
|
*
|
|
16
17
|
* Used in both charts and client-v3.
|
|
17
18
|
*/
|
|
18
|
-
export declare function poolColumn<P extends PoolDTO = PoolDTO>(options?: ColumnHeaderOptions & {
|
|
19
|
-
renderDescription?: (ctx: PoolTableCellContext<P>) => React.ReactNode;
|
|
19
|
+
export declare function poolColumn<P extends PoolDTO = PoolDTO, T extends TokenMetaInfo = TokenMetaInfo>(options?: ColumnHeaderOptions & {
|
|
20
|
+
renderDescription?: (ctx: PoolTableCellContext<P, T>) => React.ReactNode;
|
|
20
21
|
/** Custom pool name formatter. Defaults to "TOKEN vN" for v3 pools. */
|
|
21
|
-
getPoolName?: (ctx: PoolTableCellContext<P>) => string;
|
|
22
|
+
getPoolName?: (ctx: PoolTableCellContext<P, T>) => string;
|
|
22
23
|
width?: string;
|
|
23
|
-
}): PoolTableColumnDef<P>;
|
|
24
|
+
}): PoolTableColumnDef<P, T>;
|
|
24
25
|
/**
|
|
25
26
|
* Total supply column — shows total expected liquidity in USD and native token.
|
|
26
27
|
*
|
|
27
28
|
* Used in both charts and client-v3.
|
|
28
29
|
*/
|
|
29
|
-
export declare function supplyColumn<P extends PoolDTO = PoolDTO>(options?: ColumnHeaderOptions & {
|
|
30
|
+
export declare function supplyColumn<P extends PoolDTO = PoolDTO, T extends TokenMetaInfo = TokenMetaInfo>(options?: ColumnHeaderOptions & {
|
|
30
31
|
width?: string;
|
|
31
32
|
sortField?: string;
|
|
32
33
|
hideOnMedium?: boolean;
|
|
33
|
-
}): PoolTableColumnDef<P>;
|
|
34
|
+
}): PoolTableColumnDef<P, T>;
|
|
34
35
|
/**
|
|
35
36
|
* Supply APY column — shows compound APY with tooltip breakdown.
|
|
36
37
|
*
|
|
37
38
|
* Used in both charts and client-v3.
|
|
38
39
|
*/
|
|
39
|
-
export declare function supplyApyColumn<P extends PoolDTO = PoolDTO>(options?: ColumnHeaderOptions & {
|
|
40
|
+
export declare function supplyApyColumn<P extends PoolDTO = PoolDTO, T extends TokenMetaInfo = TokenMetaInfo>(options?: ColumnHeaderOptions & {
|
|
40
41
|
width?: string;
|
|
41
42
|
sortField?: string;
|
|
42
|
-
}): PoolTableColumnDef<P>;
|
|
43
|
+
}): PoolTableColumnDef<P, T>;
|
|
43
44
|
/**
|
|
44
45
|
* Total borrowed column — shows total borrowed in USD and native token.
|
|
45
46
|
*
|
|
46
47
|
* Used in both charts and client-v3.
|
|
47
48
|
*/
|
|
48
|
-
export declare function borrowedColumn<P extends PoolDTO = PoolDTO>(options?: ColumnHeaderOptions & {
|
|
49
|
+
export declare function borrowedColumn<P extends PoolDTO = PoolDTO, T extends TokenMetaInfo = TokenMetaInfo>(options?: ColumnHeaderOptions & {
|
|
49
50
|
width?: string;
|
|
50
|
-
}): PoolTableColumnDef<P>;
|
|
51
|
+
}): PoolTableColumnDef<P, T>;
|
|
51
52
|
/**
|
|
52
53
|
* Borrow APY column — formatted borrow rate (`percentageTemplate`: **basis points**, 10_000 = 100%).
|
|
53
54
|
*
|
|
54
55
|
* Prefer `pool.borrowAPY` when the backend (or adapter) fills it; otherwise pass `getBorrowRate`.
|
|
55
56
|
*/
|
|
56
|
-
export declare function borrowApyColumn<P extends PoolDTO = PoolDTO>(options?: ColumnHeaderOptions & {
|
|
57
|
+
export declare function borrowApyColumn<P extends PoolDTO = PoolDTO, T extends TokenMetaInfo = TokenMetaInfo>(options?: ColumnHeaderOptions & {
|
|
57
58
|
width?: string;
|
|
58
59
|
/** Custom getter for borrow rate (basis points). Used when `pool.borrowAPY` is undefined. */
|
|
59
60
|
getBorrowRate?: (pool: P) => number;
|
|
60
|
-
}): PoolTableColumnDef<P>;
|
|
61
|
+
}): PoolTableColumnDef<P, T>;
|
|
61
62
|
/**
|
|
62
63
|
* Utilization column — `pool.utilization` (0–100) with a progress bar.
|
|
63
64
|
*/
|
|
64
|
-
export declare function utilizationColumn<P extends PoolDTO = PoolDTO>(options?: ColumnHeaderOptions & {
|
|
65
|
+
export declare function utilizationColumn<P extends PoolDTO = PoolDTO, T extends TokenMetaInfo = TokenMetaInfo>(options?: ColumnHeaderOptions & {
|
|
65
66
|
width?: string;
|
|
66
67
|
sortField?: string;
|
|
67
|
-
}): PoolTableColumnDef<P>;
|
|
68
|
+
}): PoolTableColumnDef<P, T>;
|
|
68
69
|
/**
|
|
69
70
|
* Collateral / assets column — shows a list of collateral asset icons.
|
|
70
71
|
*
|
|
71
72
|
* Default: reads `pool.collateralTokens` and renders {@link AssetsListCell}.
|
|
72
73
|
* Override with `cell` / `mobileCell` for custom asset shapes (e.g. client-v3 quota objects).
|
|
73
74
|
*/
|
|
74
|
-
export declare function collateralColumn<P extends PoolDTO = PoolDTO>(options?: ColumnHeaderOptions & {
|
|
75
|
+
export declare function collateralColumn<P extends PoolDTO = PoolDTO, T extends TokenMetaInfo = TokenMetaInfo>(options?: ColumnHeaderOptions & {
|
|
75
76
|
width?: string;
|
|
76
77
|
gapBefore?: "sm" | "md" | "none";
|
|
77
|
-
cell?: (ctx: PoolTableCellContext<P>) => React.ReactNode;
|
|
78
|
-
mobileCell?: (ctx: PoolTableCellContext<P>) => React.ReactNode;
|
|
78
|
+
cell?: (ctx: PoolTableCellContext<P, T>) => React.ReactNode;
|
|
79
|
+
mobileCell?: (ctx: PoolTableCellContext<P, T>) => React.ReactNode;
|
|
79
80
|
align?: "left" | "right";
|
|
80
81
|
/** @default 5 */
|
|
81
82
|
maxAssets?: number;
|
|
82
83
|
options?: MultiAssetCellProps["options"];
|
|
83
|
-
}): PoolTableColumnDef<P>;
|
|
84
|
+
}): PoolTableColumnDef<P, T>;
|
|
84
85
|
/**
|
|
85
86
|
* User balance column (client-v3 style) — USD + amount in pool token.
|
|
86
87
|
*
|
|
87
88
|
* Default: `pool.userBalanceInUSD`, `pool.userBalance`, `pool.poolTokenSymbol` (and underlying decimals for formatting).
|
|
88
89
|
*/
|
|
89
|
-
export declare function balanceColumn<P extends PoolDTO = PoolDTO>(options?: ColumnHeaderOptions & {
|
|
90
|
+
export declare function balanceColumn<P extends PoolDTO = PoolDTO, T extends TokenMetaInfo = TokenMetaInfo>(options?: ColumnHeaderOptions & {
|
|
90
91
|
width?: string;
|
|
91
92
|
className?: string;
|
|
92
93
|
headerClassName?: string;
|
|
93
94
|
sortField?: string;
|
|
94
|
-
cell?: (ctx: PoolTableCellContext<P>) => React.ReactNode;
|
|
95
|
-
}): PoolTableColumnDef<P>;
|
|
95
|
+
cell?: (ctx: PoolTableCellContext<P, T>) => React.ReactNode;
|
|
96
|
+
}): PoolTableColumnDef<P, T>;
|
|
96
97
|
/**
|
|
97
98
|
* Generic custom column — convenience helper to create a column with minimal boilerplate.
|
|
98
99
|
*/
|
|
99
|
-
export declare function customColumn<P extends PoolDTO = PoolDTO>(def: PoolTableColumnDef<P>): PoolTableColumnDef<P>;
|
|
100
|
+
export declare function customColumn<P extends PoolDTO = PoolDTO, T extends TokenMetaInfo = TokenMetaInfo>(def: PoolTableColumnDef<P, T>): PoolTableColumnDef<P, T>;
|
|
100
101
|
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TokenMetaInfo } from '../../../types/common';
|
|
1
2
|
import { PoolDTO, PoolTableProps } from './types';
|
|
2
3
|
/**
|
|
3
4
|
* PoolTable — configurable pool table constructor component.
|
|
@@ -29,4 +30,4 @@ import { PoolDTO, PoolTableProps } from './types';
|
|
|
29
30
|
* <PoolTable columns={columns} rows={rows} loading={isLoading} sort={sort} />
|
|
30
31
|
* ```
|
|
31
32
|
*/
|
|
32
|
-
export declare function PoolTable<P extends PoolDTO = PoolDTO>({ columns, rows, loading, partialLoading, error, emptyContent, skeletonRows, rowHeight, size, mobileColumnsXs, mobileColumnsMd, className, wrapperClassName, sort, rowTestId, loaderTestId, }: PoolTableProps<P>): import("react/jsx-runtime").JSX.Element | null;
|
|
33
|
+
export declare function PoolTable<P extends PoolDTO = PoolDTO, T extends TokenMetaInfo = TokenMetaInfo>({ columns, rows, loading, partialLoading, error, emptyContent, skeletonRows, rowHeight, size, mobileColumnsXs, mobileColumnsMd, className, wrapperClassName, sort, rowTestId, loaderTestId, }: PoolTableProps<P, T>): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -54,11 +54,11 @@ export interface PoolApyDTO {
|
|
|
54
54
|
loading7DAgo?: boolean;
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
|
-
export interface PoolTableCellContext<P extends PoolDTO = PoolDTO> {
|
|
57
|
+
export interface PoolTableCellContext<P extends PoolDTO = PoolDTO, T extends TokenMetaInfo = TokenMetaInfo> {
|
|
58
58
|
pool: P;
|
|
59
|
-
tokensList: Record<Address,
|
|
59
|
+
tokensList: Record<Address, T> | undefined;
|
|
60
60
|
/** Underlying token meta (resolved from `pool.underlyingToken`). */
|
|
61
|
-
underlyingToken:
|
|
61
|
+
underlyingToken: T | undefined;
|
|
62
62
|
apy: PoolApyDTO | undefined;
|
|
63
63
|
/** Points / rewards data for tooltip. */
|
|
64
64
|
points: Array<PoolAPYPointsTip> | undefined;
|
|
@@ -72,13 +72,13 @@ export interface PoolTableColumnSortDef {
|
|
|
72
72
|
field: string;
|
|
73
73
|
defaultDirection?: "asc" | "desc";
|
|
74
74
|
}
|
|
75
|
-
export interface PoolTableColumnDef<P extends PoolDTO = PoolDTO> {
|
|
75
|
+
export interface PoolTableColumnDef<P extends PoolDTO = PoolDTO, T extends TokenMetaInfo = TokenMetaInfo> {
|
|
76
76
|
id: string;
|
|
77
77
|
header: React.ReactNode | ((sort: PoolTableColumnSortState | undefined) => React.ReactNode);
|
|
78
78
|
headerTip?: React.ReactNode;
|
|
79
79
|
headerClassName?: string;
|
|
80
|
-
cell: (ctx: PoolTableCellContext<P>) => React.ReactNode;
|
|
81
|
-
mobileCell?: (ctx: PoolTableCellContext<P>) => React.ReactNode;
|
|
80
|
+
cell: (ctx: PoolTableCellContext<P, T>) => React.ReactNode;
|
|
81
|
+
mobileCell?: (ctx: PoolTableCellContext<P, T>) => React.ReactNode;
|
|
82
82
|
mobileTitle?: React.ReactNode;
|
|
83
83
|
hideOnMobile?: boolean;
|
|
84
84
|
width?: string;
|
|
@@ -92,18 +92,18 @@ export interface PoolTableColumnSortState {
|
|
|
92
92
|
direction: SortDirection;
|
|
93
93
|
onSort: () => void;
|
|
94
94
|
}
|
|
95
|
-
export interface PoolTableRowDTO<P extends PoolDTO = PoolDTO> {
|
|
95
|
+
export interface PoolTableRowDTO<P extends PoolDTO = PoolDTO, T extends TokenMetaInfo = TokenMetaInfo> {
|
|
96
96
|
pool: P;
|
|
97
|
-
tokensList: Record<Address,
|
|
97
|
+
tokensList: Record<Address, T> | undefined;
|
|
98
98
|
apy: PoolApyDTO | undefined;
|
|
99
99
|
points: Array<PoolAPYPointsTip> | undefined;
|
|
100
100
|
chainId: number;
|
|
101
101
|
href?: string;
|
|
102
102
|
loading?: boolean;
|
|
103
103
|
}
|
|
104
|
-
export interface PoolTableProps<P extends PoolDTO = PoolDTO> {
|
|
105
|
-
columns: Array<PoolTableColumnDef<P>>;
|
|
106
|
-
rows: Array<PoolTableRowDTO<P>> | undefined;
|
|
104
|
+
export interface PoolTableProps<P extends PoolDTO = PoolDTO, T extends TokenMetaInfo = TokenMetaInfo> {
|
|
105
|
+
columns: Array<PoolTableColumnDef<P, T>>;
|
|
106
|
+
rows: Array<PoolTableRowDTO<P, T>> | undefined;
|
|
107
107
|
loading?: boolean;
|
|
108
108
|
partialLoading?: boolean;
|
|
109
109
|
error?: Error | null;
|