@gearbox-protocol/ui-kit 3.4.0 → 3.5.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.
- package/dist/cjs/components/assets-list-cell/assets-list-cell.cjs +1 -1
- package/dist/cjs/components/block-sync/block-sync.cjs +1 -1
- package/dist/cjs/components/checkbox/checkbox-labeled.cjs +1 -1
- package/dist/cjs/components/client-adapters/styled-rounded-image/styled-rounded-image.cjs +1 -1
- package/dist/cjs/components/complex-input/complex-input.cjs +1 -1
- package/dist/cjs/components/composites/index.cjs +1 -0
- package/dist/cjs/components/composites/pool-table/columns.cjs +1 -0
- package/dist/cjs/components/composites/pool-table/index.cjs +1 -0
- package/dist/cjs/components/composites/pool-table/pool-table-backend-contract.types.cjs +1 -0
- package/dist/cjs/components/composites/pool-table/pool-table.cjs +1 -0
- package/dist/cjs/components/composites/pool-table/types.cjs +1 -0
- package/dist/cjs/components/compound-apy/compound-apy.cjs +1 -1
- package/dist/cjs/components/detailed-page-title/detailed-page-title.cjs +1 -1
- package/dist/cjs/components/index.cjs +1 -1
- package/dist/cjs/components/markdown-viewer/markdown-viewer.cjs +1 -1
- package/dist/cjs/components/pool-apy-tooltip/pool-apy-tooltip.cjs +1 -1
- package/dist/cjs/components/time-to-liquidation/time-to-liquidation.cjs +1 -1
- package/dist/cjs/components/tokens-list-cell/tokens-list-cell.cjs +1 -1
- package/dist/cjs/components/tooltip/simple-tooltip.cjs +1 -1
- package/dist/cjs/components/with-copy/with-copy.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/esm/components/assets-list-cell/assets-list-cell.js +7 -7
- package/dist/esm/components/block-sync/block-sync.js +7 -7
- package/dist/esm/components/checkbox/checkbox-labeled.js +7 -7
- package/dist/esm/components/client-adapters/styled-rounded-image/styled-rounded-image.js +7 -7
- package/dist/esm/components/complex-input/complex-input.js +7 -7
- package/dist/esm/components/composites/index.js +14 -0
- package/dist/esm/components/composites/pool-table/columns.js +248 -0
- package/dist/esm/components/composites/pool-table/index.js +14 -0
- package/dist/esm/components/composites/pool-table/pool-table-backend-contract.types.js +1 -0
- package/dist/esm/components/composites/pool-table/pool-table.js +190 -0
- package/dist/esm/components/composites/pool-table/types.js +1 -0
- package/dist/esm/components/compound-apy/compound-apy.js +41 -41
- package/dist/esm/components/detailed-page-title/detailed-page-title.js +12 -12
- package/dist/esm/components/index.js +644 -632
- package/dist/esm/components/markdown-viewer/markdown-viewer.js +7 -7
- package/dist/esm/components/pool-apy-tooltip/pool-apy-tooltip.js +11 -11
- package/dist/esm/components/time-to-liquidation/time-to-liquidation.js +7 -7
- package/dist/esm/components/tokens-list-cell/tokens-list-cell.js +7 -7
- package/dist/esm/components/tooltip/simple-tooltip.js +64 -60
- package/dist/esm/components/with-copy/with-copy.js +7 -7
- package/dist/esm/index.js +748 -736
- package/dist/globals.css +1 -1
- package/dist/types/components/composites/index.d.ts +1 -0
- package/dist/types/components/composites/pool-table/columns.d.ts +98 -0
- package/dist/types/components/composites/pool-table/index.d.ts +3 -0
- package/dist/types/components/composites/pool-table/pool-table-backend-contract.types.d.ts +160 -0
- package/dist/types/components/composites/pool-table/pool-table.d.ts +32 -0
- package/dist/types/components/composites/pool-table/types.d.ts +127 -0
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './pool-table';
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { PoolDTO, PoolTableCellContext, PoolTableColumnDef } from './types';
|
|
2
|
+
import type * as React from "react";
|
|
3
|
+
/**
|
|
4
|
+
* Pool name column — displays token icon, pool name and optional description.
|
|
5
|
+
*
|
|
6
|
+
* Used in both charts and client-v3.
|
|
7
|
+
*/
|
|
8
|
+
export declare function poolColumn<P extends PoolDTO = PoolDTO>(options?: {
|
|
9
|
+
header?: React.ReactNode;
|
|
10
|
+
renderDescription?: (ctx: PoolTableCellContext<P>) => React.ReactNode;
|
|
11
|
+
/** Custom pool name formatter. Defaults to "TOKEN vN" for v3 pools. */
|
|
12
|
+
getPoolName?: (ctx: PoolTableCellContext<P>) => string;
|
|
13
|
+
width?: string;
|
|
14
|
+
}): PoolTableColumnDef<P>;
|
|
15
|
+
/**
|
|
16
|
+
* Total supply column — shows total expected liquidity in USD and native token.
|
|
17
|
+
*
|
|
18
|
+
* Used in both charts and client-v3.
|
|
19
|
+
*/
|
|
20
|
+
export declare function supplyColumn<P extends PoolDTO = PoolDTO>(options?: {
|
|
21
|
+
header?: React.ReactNode;
|
|
22
|
+
width?: string;
|
|
23
|
+
sortField?: string;
|
|
24
|
+
hideOnMedium?: boolean;
|
|
25
|
+
}): PoolTableColumnDef<P>;
|
|
26
|
+
/**
|
|
27
|
+
* Supply APY column — shows compound APY with tooltip breakdown.
|
|
28
|
+
*
|
|
29
|
+
* Used in both charts and client-v3.
|
|
30
|
+
*/
|
|
31
|
+
export declare function supplyApyColumn<P extends PoolDTO = PoolDTO>(options?: {
|
|
32
|
+
header?: React.ReactNode;
|
|
33
|
+
headerTip?: React.ReactNode;
|
|
34
|
+
width?: string;
|
|
35
|
+
sortField?: string;
|
|
36
|
+
}): PoolTableColumnDef<P>;
|
|
37
|
+
/**
|
|
38
|
+
* Total borrowed column — shows total borrowed in USD and native token.
|
|
39
|
+
*
|
|
40
|
+
* Used in both charts and client-v3.
|
|
41
|
+
*/
|
|
42
|
+
export declare function borrowedColumn<P extends PoolDTO = PoolDTO>(options?: {
|
|
43
|
+
header?: React.ReactNode;
|
|
44
|
+
width?: string;
|
|
45
|
+
}): PoolTableColumnDef<P>;
|
|
46
|
+
/**
|
|
47
|
+
* Borrow APY column — formatted borrow rate (`percentageTemplate`: **basis points**, 10_000 = 100%).
|
|
48
|
+
*
|
|
49
|
+
* Prefer `pool.borrowAPY` when the backend (or adapter) fills it; otherwise pass `getBorrowRate`.
|
|
50
|
+
*/
|
|
51
|
+
export declare function borrowApyColumn<P extends PoolDTO = PoolDTO>(options?: {
|
|
52
|
+
header?: React.ReactNode;
|
|
53
|
+
headerTip?: React.ReactNode;
|
|
54
|
+
width?: string;
|
|
55
|
+
/** Custom getter for borrow rate (basis points). Used when `pool.borrowAPY` is undefined. */
|
|
56
|
+
getBorrowRate?: (pool: P) => number;
|
|
57
|
+
}): PoolTableColumnDef<P>;
|
|
58
|
+
/**
|
|
59
|
+
* Utilization column — `pool.utilization` (0–100) with a progress bar.
|
|
60
|
+
*/
|
|
61
|
+
export declare function utilizationColumn<P extends PoolDTO = PoolDTO>(options?: {
|
|
62
|
+
header?: React.ReactNode;
|
|
63
|
+
width?: string;
|
|
64
|
+
sortField?: string;
|
|
65
|
+
}): PoolTableColumnDef<P>;
|
|
66
|
+
/**
|
|
67
|
+
* Collateral / assets column — shows a list of collateral asset icons.
|
|
68
|
+
*
|
|
69
|
+
* Default: reads `pool.collateralTokens` and renders {@link AssetsListCell}.
|
|
70
|
+
* Override with `cell` / `mobileCell` for custom asset shapes (e.g. client-v3 quota objects).
|
|
71
|
+
*/
|
|
72
|
+
export declare function collateralColumn<P extends PoolDTO = PoolDTO>(options?: {
|
|
73
|
+
header?: React.ReactNode;
|
|
74
|
+
width?: string;
|
|
75
|
+
gapBefore?: "sm" | "md" | "none";
|
|
76
|
+
cell?: (ctx: PoolTableCellContext<P>) => React.ReactNode;
|
|
77
|
+
mobileCell?: (ctx: PoolTableCellContext<P>) => React.ReactNode;
|
|
78
|
+
align?: "left" | "right";
|
|
79
|
+
/** @default 5 */
|
|
80
|
+
maxAssets?: number;
|
|
81
|
+
}): PoolTableColumnDef<P>;
|
|
82
|
+
/**
|
|
83
|
+
* User balance column (client-v3 style) — USD + amount in pool token.
|
|
84
|
+
*
|
|
85
|
+
* Default: `pool.userBalanceInUSD`, `pool.userBalance`, `pool.poolTokenSymbol` (and underlying decimals for formatting).
|
|
86
|
+
*/
|
|
87
|
+
export declare function balanceColumn<P extends PoolDTO = PoolDTO>(options?: {
|
|
88
|
+
header?: React.ReactNode;
|
|
89
|
+
width?: string;
|
|
90
|
+
className?: string;
|
|
91
|
+
headerClassName?: string;
|
|
92
|
+
sortField?: string;
|
|
93
|
+
cell?: (ctx: PoolTableCellContext<P>) => React.ReactNode;
|
|
94
|
+
}): PoolTableColumnDef<P>;
|
|
95
|
+
/**
|
|
96
|
+
* Generic custom column — convenience helper to create a column with minimal boilerplate.
|
|
97
|
+
*/
|
|
98
|
+
export declare function customColumn<P extends PoolDTO = PoolDTO>(def: PoolTableColumnDef<P>): PoolTableColumnDef<P>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { balanceColumn, borrowApyColumn, borrowedColumn, collateralColumn, customColumn, poolColumn, supplyApyColumn, supplyColumn, utilizationColumn, } from './columns';
|
|
2
|
+
export { PoolTable } from './pool-table';
|
|
3
|
+
export type { PoolApyDTO, PoolDTO, PoolTableCellContext, PoolTableColumnDef, PoolTableColumnSortDef, PoolTableColumnSortState, PoolTableProps, PoolTableRowDTO, } from './types';
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pool Table — Backend API Contract
|
|
3
|
+
* ==================================
|
|
4
|
+
*
|
|
5
|
+
* Self-contained type definitions for the pool-list endpoint response.
|
|
6
|
+
* The client maps this response 1-to-1 into the `PoolTable` component from
|
|
7
|
+
* `@gearbox-protocol/ui-kit`.
|
|
8
|
+
*
|
|
9
|
+
* Copy this file into your backend repo — it has **zero npm dependencies**.
|
|
10
|
+
*
|
|
11
|
+
* ## Quick start
|
|
12
|
+
*
|
|
13
|
+
* Implement one endpoint that returns {@link PoolTableListResponse}.
|
|
14
|
+
*
|
|
15
|
+
* ## JSON serialization
|
|
16
|
+
*
|
|
17
|
+
* - `bigint` fields → decimal **strings** (`"13190000000000000000000000"`).
|
|
18
|
+
* The client converts them back via `BigInt(value)`.
|
|
19
|
+
* - `Address` → `0x`-prefixed hex string, lower-case preferred.
|
|
20
|
+
*
|
|
21
|
+
* @packageDocumentation
|
|
22
|
+
*/
|
|
23
|
+
type Address = `0x${string}`;
|
|
24
|
+
/**
|
|
25
|
+
* ```jsonc
|
|
26
|
+
* GET /v1/pools?chainIds=1,42161&wallet=0x…
|
|
27
|
+
* {
|
|
28
|
+
* "tokens": { "0xabc…": { "symbol":"USDC", "title":"USDC", "decimals":6 } },
|
|
29
|
+
* "rows": [ … ]
|
|
30
|
+
* }
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export interface PoolTableListResponse {
|
|
34
|
+
/** One entry per pool visible in the table. */
|
|
35
|
+
rows: PoolTableRowDTO[];
|
|
36
|
+
/**
|
|
37
|
+
* Global token dictionary shared by all rows.
|
|
38
|
+
* Must contain **at least** every `underlyingToken`, every address in
|
|
39
|
+
* `collateralTokens`, and every `rewardToken` from `apy.extraAPY`.
|
|
40
|
+
*
|
|
41
|
+
* Key = lower-case token address.
|
|
42
|
+
*/
|
|
43
|
+
tokens: Record<Address, TokenMetaDTO>;
|
|
44
|
+
}
|
|
45
|
+
export interface PoolTableRowDTO {
|
|
46
|
+
pool: PoolDTO;
|
|
47
|
+
/** Supply / deposit APY breakdown (column + tooltip). */
|
|
48
|
+
apy?: PoolApyDTO | null;
|
|
49
|
+
/** Points / rewards for the APY tooltip. `null` or `[]` = no points. */
|
|
50
|
+
points?: PoolApyPointDTO[] | null;
|
|
51
|
+
chainId: number;
|
|
52
|
+
/** Deep-link to pool detail page (client can also build this locally). */
|
|
53
|
+
href?: string;
|
|
54
|
+
}
|
|
55
|
+
export interface PoolDTO {
|
|
56
|
+
address: Address;
|
|
57
|
+
underlyingToken: Address;
|
|
58
|
+
/** Display name, e.g. "USDC v3". */
|
|
59
|
+
name?: string;
|
|
60
|
+
/** Semver-like integer: 300 = v3, 310 = v3.1, etc. */
|
|
61
|
+
version?: number;
|
|
62
|
+
/** Human-readable network label, e.g. "Mainnet", "Arbitrum". */
|
|
63
|
+
network?: string;
|
|
64
|
+
chainId?: number;
|
|
65
|
+
/** Market configurator address (rendered as curator badge). */
|
|
66
|
+
marketConfigurator?: Address;
|
|
67
|
+
/** Total supplied liquidity in underlying token (bigint → string in JSON). */
|
|
68
|
+
expectedLiquidity?: bigint;
|
|
69
|
+
/** Same value converted to USD. */
|
|
70
|
+
expectedLiquidityInUSD?: number;
|
|
71
|
+
/** Total borrowed in underlying token (bigint → string in JSON). */
|
|
72
|
+
totalBorrowed?: bigint;
|
|
73
|
+
/** Same value converted to USD. */
|
|
74
|
+
totalBorrowedInUSD?: number;
|
|
75
|
+
/** Utilization ratio, 0–100 (percent). */
|
|
76
|
+
utilization?: number;
|
|
77
|
+
/** Base deposit APY, already in **percent** (e.g. `5.2` = 5.2%). */
|
|
78
|
+
depositAPY?: number;
|
|
79
|
+
/**
|
|
80
|
+
* Borrow rate for the "Borrow APY" column.
|
|
81
|
+
* Unit: **basis points** (10 000 = 100%).
|
|
82
|
+
*/
|
|
83
|
+
borrowAPY?: number;
|
|
84
|
+
/** Active collateral token addresses for the "Collateral" column. */
|
|
85
|
+
collateralTokens?: Address[];
|
|
86
|
+
/** User's pool position value in USD ("Your Balance" column). */
|
|
87
|
+
userBalanceInUSD?: number;
|
|
88
|
+
/** User's position amount in pool/deposit token (bigint → string). */
|
|
89
|
+
userBalance?: bigint;
|
|
90
|
+
/** Pool deposit token symbol, e.g. `"edgeUSDC"`. */
|
|
91
|
+
poolTokenSymbol?: string;
|
|
92
|
+
/** `true` when the pool has active points/rewards (shows indicator icon). */
|
|
93
|
+
hasPoints?: boolean;
|
|
94
|
+
}
|
|
95
|
+
export interface PoolApyDTO {
|
|
96
|
+
/** Total combined supply APY in percent (`8.33` = 8.33%). */
|
|
97
|
+
totalAPY: number;
|
|
98
|
+
baseAPY: PoolBaseApyDTO[];
|
|
99
|
+
extraAPY: PoolExtraRewardApyDTO[];
|
|
100
|
+
externalAPY?: PoolExternalApyDTO;
|
|
101
|
+
/** Snapshot from 7 days ago (for 1D / 7D comparison in tooltip). */
|
|
102
|
+
apy7DAgo?: PoolApy7DaysAgoDTO;
|
|
103
|
+
}
|
|
104
|
+
export interface PoolBaseApyDTO {
|
|
105
|
+
type: "supplyAPY" | "tokenYield";
|
|
106
|
+
/** Already in percent. */
|
|
107
|
+
apy: number;
|
|
108
|
+
}
|
|
109
|
+
export interface PoolExtraRewardApyDTO {
|
|
110
|
+
/** Extra reward APY in percent. */
|
|
111
|
+
apy: number;
|
|
112
|
+
/** Reward token address (hex). */
|
|
113
|
+
rewardToken: string;
|
|
114
|
+
/** Reward token ticker, e.g. "ARB", "GEAR". */
|
|
115
|
+
rewardTokenSymbol: string;
|
|
116
|
+
}
|
|
117
|
+
export interface PoolExternalApyDTO {
|
|
118
|
+
totalValue: number;
|
|
119
|
+
value?: number;
|
|
120
|
+
/** Source name, e.g. "Curve". */
|
|
121
|
+
name: string;
|
|
122
|
+
/** i18n key or free-form string for tooltip. */
|
|
123
|
+
tooltip?: string;
|
|
124
|
+
}
|
|
125
|
+
export interface PoolApy7DaysAgoDTO {
|
|
126
|
+
totalAPY?: number;
|
|
127
|
+
baseAPY?: PoolBaseApyDTO[];
|
|
128
|
+
extraAPY?: PoolExtraRewardApyDTO[];
|
|
129
|
+
externalAPY?: PoolExternalApyDTO;
|
|
130
|
+
}
|
|
131
|
+
export interface PoolApyPointDTO {
|
|
132
|
+
/** Formatted amount string, e.g. "2.5x". */
|
|
133
|
+
amount: string;
|
|
134
|
+
/** Program / reward name, e.g. "Gearbox Points". */
|
|
135
|
+
name: string;
|
|
136
|
+
/** Token title for icon lookup. */
|
|
137
|
+
tokenTitle?: string;
|
|
138
|
+
/** Full tooltip text (already formatted, UI-ready). */
|
|
139
|
+
fullTip: string;
|
|
140
|
+
reward?: PoolApyPointRewardHintDTO;
|
|
141
|
+
}
|
|
142
|
+
export interface PoolApyPointRewardHintDTO {
|
|
143
|
+
duration?: string;
|
|
144
|
+
condition?: string;
|
|
145
|
+
name?: string;
|
|
146
|
+
type?: string;
|
|
147
|
+
}
|
|
148
|
+
export interface TokenMetaDTO {
|
|
149
|
+
/** Ticker, e.g. "USDC". */
|
|
150
|
+
symbol: string;
|
|
151
|
+
/** Human-readable name, e.g. "USD Coin". */
|
|
152
|
+
title?: string;
|
|
153
|
+
/** URL or static asset path for the token icon. */
|
|
154
|
+
icon?: string;
|
|
155
|
+
/** Full token name (rarely different from title). */
|
|
156
|
+
name?: string;
|
|
157
|
+
/** Token decimals — required for correct amount formatting on the client. */
|
|
158
|
+
decimals: number;
|
|
159
|
+
}
|
|
160
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { PoolDTO, PoolTableProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* PoolTable — configurable pool table constructor component.
|
|
4
|
+
*
|
|
5
|
+
* Accepts an array of column definitions (built-in + custom) and row data.
|
|
6
|
+
* Handles loading skeletons, error states, empty states, mobile layout,
|
|
7
|
+
* and partial loading out of the box.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* import {
|
|
12
|
+
* PoolTable,
|
|
13
|
+
* poolColumn,
|
|
14
|
+
* supplyColumn,
|
|
15
|
+
* supplyApyColumn,
|
|
16
|
+
* borrowedColumn,
|
|
17
|
+
* utilizationColumn,
|
|
18
|
+
* customColumn,
|
|
19
|
+
* } from "@gearbox-protocol/ui-kit";
|
|
20
|
+
*
|
|
21
|
+
* const columns = [
|
|
22
|
+
* poolColumn({ renderDescription: (ctx) => <Curator ... /> }),
|
|
23
|
+
* supplyColumn(),
|
|
24
|
+
* supplyApyColumn(),
|
|
25
|
+
* borrowedColumn(),
|
|
26
|
+
* utilizationColumn(),
|
|
27
|
+
* ];
|
|
28
|
+
*
|
|
29
|
+
* <PoolTable columns={columns} rows={rows} loading={isLoading} sort={sort} />
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare function PoolTable<P extends PoolDTO = PoolDTO>({ columns, rows, loading, partialLoading, error, emptyContent, skeletonRows, rowHeight, size, mobileColumnsXs, mobileColumnsMd, className, wrapperClassName, sort, }: PoolTableProps<P>): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { Address } from 'viem';
|
|
2
|
+
import { ExternalAPYData, ExtraRewardApy, PoolBaseAPY } from '../../compound-apy';
|
|
3
|
+
import { SortDirection } from '../../head-cell';
|
|
4
|
+
import { PoolAPYPointsTip } from '../../pool-apy-tooltip';
|
|
5
|
+
import { TokenMetaInfo } from '../../../types/common';
|
|
6
|
+
import type * as React from "react";
|
|
7
|
+
export interface PoolDTO {
|
|
8
|
+
address: Address;
|
|
9
|
+
underlyingToken: Address;
|
|
10
|
+
/** Display name, e.g. "USDC v3". */
|
|
11
|
+
name?: string;
|
|
12
|
+
/** Semver-like integer: 300 = v3, 310 = v3.1, etc. */
|
|
13
|
+
version?: number;
|
|
14
|
+
/** Human-readable network label (e.g. "Mainnet", "Arbitrum"). */
|
|
15
|
+
network?: string;
|
|
16
|
+
chainId?: number;
|
|
17
|
+
/** Market configurator address (curator badge in client-v3). */
|
|
18
|
+
marketConfigurator?: Address;
|
|
19
|
+
expectedLiquidity?: bigint;
|
|
20
|
+
expectedLiquidityInUSD?: number;
|
|
21
|
+
totalBorrowed?: bigint;
|
|
22
|
+
totalBorrowedInUSD?: number;
|
|
23
|
+
/** Utilization ratio, 0–100 (percent). */
|
|
24
|
+
utilization?: number;
|
|
25
|
+
/** Deposit APY (already percent). */
|
|
26
|
+
depositAPY?: number;
|
|
27
|
+
/**
|
|
28
|
+
* Borrow rate for the Borrow APY column.
|
|
29
|
+
* **Basis points** (10_000 = 100%), compatible with `percentageTemplate`.
|
|
30
|
+
*/
|
|
31
|
+
borrowAPY?: number;
|
|
32
|
+
/** Active collateral token addresses. */
|
|
33
|
+
collateralTokens?: Address[];
|
|
34
|
+
/** User position in this pool — USD. */
|
|
35
|
+
userBalanceInUSD?: number;
|
|
36
|
+
/** User position — amount in pool/deposit token. */
|
|
37
|
+
userBalance?: bigint;
|
|
38
|
+
/** Pool / deposit token symbol (e.g. "edgeUSDC"). */
|
|
39
|
+
poolTokenSymbol?: string;
|
|
40
|
+
/** Whether this pool has active points/rewards (shows indicator icon). */
|
|
41
|
+
hasPoints?: boolean;
|
|
42
|
+
}
|
|
43
|
+
export interface PoolApyDTO {
|
|
44
|
+
totalAPY: number;
|
|
45
|
+
baseAPY: Array<PoolBaseAPY>;
|
|
46
|
+
extraAPY: Array<ExtraRewardApy>;
|
|
47
|
+
externalAPY?: ExternalAPYData;
|
|
48
|
+
/** Snapshot from 7 days ago (1D / 7D comparison in tooltip). */
|
|
49
|
+
apy7DAgo?: {
|
|
50
|
+
totalAPY?: number;
|
|
51
|
+
baseAPY?: Array<PoolBaseAPY>;
|
|
52
|
+
extraAPY?: Array<ExtraRewardApy>;
|
|
53
|
+
externalAPY?: ExternalAPYData;
|
|
54
|
+
loading7DAgo?: boolean;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
export interface PoolTableCellContext<P extends PoolDTO = PoolDTO> {
|
|
58
|
+
pool: P;
|
|
59
|
+
tokensList: Record<Address, TokenMetaInfo> | undefined;
|
|
60
|
+
/** Underlying token meta (resolved from `pool.underlyingToken`). */
|
|
61
|
+
underlyingToken: TokenMetaInfo | undefined;
|
|
62
|
+
apy: PoolApyDTO | undefined;
|
|
63
|
+
/** Points / rewards data for tooltip. */
|
|
64
|
+
points: Array<PoolAPYPointsTip> | undefined;
|
|
65
|
+
/** Whether prices are still loading. */
|
|
66
|
+
loading?: boolean;
|
|
67
|
+
chainId: number;
|
|
68
|
+
/** Whether the current viewport is mobile. */
|
|
69
|
+
isMobile?: boolean;
|
|
70
|
+
}
|
|
71
|
+
export interface PoolTableColumnSortDef {
|
|
72
|
+
field: string;
|
|
73
|
+
defaultDirection?: "asc" | "desc";
|
|
74
|
+
}
|
|
75
|
+
export interface PoolTableColumnDef<P extends PoolDTO = PoolDTO> {
|
|
76
|
+
id: string;
|
|
77
|
+
header: React.ReactNode | ((sort: PoolTableColumnSortState | undefined) => React.ReactNode);
|
|
78
|
+
headerTip?: React.ReactNode;
|
|
79
|
+
headerClassName?: string;
|
|
80
|
+
cell: (ctx: PoolTableCellContext<P>) => React.ReactNode;
|
|
81
|
+
mobileCell?: (ctx: PoolTableCellContext<P>) => React.ReactNode;
|
|
82
|
+
mobileTitle?: React.ReactNode;
|
|
83
|
+
hideOnMobile?: boolean;
|
|
84
|
+
width?: string;
|
|
85
|
+
align?: "left" | "right" | "center";
|
|
86
|
+
gapBefore?: "sm" | "md" | "none";
|
|
87
|
+
sort?: PoolTableColumnSortDef;
|
|
88
|
+
hideOnMedium?: boolean;
|
|
89
|
+
className?: string;
|
|
90
|
+
}
|
|
91
|
+
export interface PoolTableColumnSortState {
|
|
92
|
+
direction: SortDirection;
|
|
93
|
+
onSort: () => void;
|
|
94
|
+
}
|
|
95
|
+
export interface PoolTableRowDTO<P extends PoolDTO = PoolDTO> {
|
|
96
|
+
pool: P;
|
|
97
|
+
tokensList: Record<Address, TokenMetaInfo> | undefined;
|
|
98
|
+
apy: PoolApyDTO | undefined;
|
|
99
|
+
points: Array<PoolAPYPointsTip> | undefined;
|
|
100
|
+
chainId: number;
|
|
101
|
+
href?: string;
|
|
102
|
+
loading?: boolean;
|
|
103
|
+
}
|
|
104
|
+
export interface PoolTableProps<P extends PoolDTO = PoolDTO> {
|
|
105
|
+
columns: Array<PoolTableColumnDef<P>>;
|
|
106
|
+
rows: Array<PoolTableRowDTO<P>> | undefined;
|
|
107
|
+
loading?: boolean;
|
|
108
|
+
partialLoading?: boolean;
|
|
109
|
+
error?: Error | null;
|
|
110
|
+
emptyContent?: React.ReactNode;
|
|
111
|
+
skeletonRows?: number;
|
|
112
|
+
rowHeight?: number;
|
|
113
|
+
size?: "sm" | "default" | "lg";
|
|
114
|
+
/** @default 3 */
|
|
115
|
+
mobileColumnsXs?: number;
|
|
116
|
+
/** @default 3 */
|
|
117
|
+
mobileColumnsMd?: number;
|
|
118
|
+
className?: string;
|
|
119
|
+
wrapperClassName?: string;
|
|
120
|
+
sort?: {
|
|
121
|
+
state: {
|
|
122
|
+
field: string;
|
|
123
|
+
sort: "asc" | "desc";
|
|
124
|
+
} | null;
|
|
125
|
+
set: (field: string, startFromSort?: "asc" | "desc") => void;
|
|
126
|
+
};
|
|
127
|
+
}
|
|
@@ -24,6 +24,7 @@ export * from './checkbox-item';
|
|
|
24
24
|
export * from './client-adapters';
|
|
25
25
|
export * from './colored-text';
|
|
26
26
|
export * from './complex-input';
|
|
27
|
+
export * from './composites';
|
|
27
28
|
export type { ExternalAPYData, ExtraRewardApy, PoolBaseAPY, } from './compound-apy';
|
|
28
29
|
export * from './compound-apy';
|
|
29
30
|
export * from './confirm-menu';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ export * from './components/checkbox';
|
|
|
24
24
|
export * from './components/client-adapters';
|
|
25
25
|
export * from './components/colored-text';
|
|
26
26
|
export * from './components/complex-input';
|
|
27
|
+
export * from './components/composites';
|
|
27
28
|
export * from './components/compound-apy';
|
|
28
29
|
export * from './components/confirm-menu';
|
|
29
30
|
export * from './components/credit-session-status';
|