@gearbox-protocol/ui-kit 3.6.0-next.1 → 3.6.0-next.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.
- package/dist/cjs/components/compound-apy/compound-apy.cjs +1 -1
- package/dist/cjs/components/index.cjs +1 -1
- package/dist/cjs/components/pool-apy-tooltip/pool-apy-tooltip.cjs +1 -1
- package/dist/cjs/components/pool-assets-table/index.cjs +1 -0
- package/dist/cjs/components/{PoolsAssetsTable/TableHead.cjs → pool-assets-table/pool-assets-table-head.cjs} +1 -1
- package/dist/cjs/components/{PoolsAssetsTable/PoolAssetsLine.cjs → pool-assets-table/pool-assets-table-row.cjs} +1 -1
- package/dist/cjs/components/pool-assets-table/pool-assets-table.cjs +1 -0
- package/dist/cjs/components/pool-credit-managers-table/index.cjs +1 -0
- package/dist/cjs/components/pool-credit-managers-table/pool-credit-managers-table-head.cjs +1 -0
- package/dist/cjs/components/pool-credit-managers-table/pool-credit-managers-table-row.cjs +1 -0
- package/dist/cjs/components/pool-credit-managers-table/pool-credit-managers-table.cjs +1 -0
- package/dist/cjs/components/pool-credit-managers-table/pool-credit-managers-table.test-ids.cjs +1 -0
- package/dist/cjs/components/pool-credit-managers-table/types.cjs +1 -0
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/locale/en.json.cjs +1 -1
- package/dist/esm/components/compound-apy/compound-apy.js +1 -1
- package/dist/esm/components/index.js +384 -372
- package/dist/esm/components/pool-apy-tooltip/pool-apy-tooltip.js +75 -69
- package/dist/esm/components/pool-assets-table/index.js +8 -0
- package/dist/esm/components/{PoolsAssetsTable/TableHead.js → pool-assets-table/pool-assets-table-head.js} +4 -2
- package/dist/esm/components/{PoolsAssetsTable/PoolAssetsLine.js → pool-assets-table/pool-assets-table-row.js} +5 -5
- package/dist/esm/components/pool-assets-table/pool-assets-table.js +43 -0
- package/dist/esm/components/pool-credit-managers-table/index.js +10 -0
- package/dist/esm/components/pool-credit-managers-table/pool-credit-managers-table-head.js +54 -0
- package/dist/esm/components/pool-credit-managers-table/pool-credit-managers-table-row.js +71 -0
- package/dist/esm/components/pool-credit-managers-table/pool-credit-managers-table.js +42 -0
- package/dist/esm/components/pool-credit-managers-table/pool-credit-managers-table.test-ids.js +6 -0
- package/dist/esm/components/pool-credit-managers-table/types.js +1 -0
- package/dist/esm/index.js +511 -499
- package/dist/esm/locale/en.json.js +5 -1
- package/dist/types/components/composites/pool-table/pool-table-backend-contract.types.d.ts +168 -17
- package/dist/types/components/index.d.ts +2 -1
- package/dist/types/components/pool-apy-tooltip/pool-apy-tooltip.d.ts +2 -1
- package/dist/types/components/pool-assets-table/index.d.ts +7 -0
- package/dist/types/components/pool-assets-table/pool-assets-table-head.d.ts +6 -0
- package/dist/types/components/pool-assets-table/pool-assets-table-row.d.ts +11 -0
- package/dist/types/components/{PoolsAssetsTable/index.d.ts → pool-assets-table/pool-assets-table.d.ts} +2 -3
- package/dist/types/components/{PoolsAssetsTable → pool-assets-table}/types.d.ts +2 -1
- package/dist/types/components/pool-credit-managers-table/index.d.ts +8 -0
- package/dist/types/components/pool-credit-managers-table/pool-credit-managers-table-head.d.ts +6 -0
- package/dist/types/components/pool-credit-managers-table/pool-credit-managers-table-row.d.ts +11 -0
- package/dist/types/components/pool-credit-managers-table/pool-credit-managers-table.d.ts +10 -0
- package/dist/types/components/pool-credit-managers-table/pool-credit-managers-table.test-ids.d.ts +4 -0
- package/dist/types/components/pool-credit-managers-table/types.d.ts +24 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/locale/en.json.d.ts +6 -1
- package/package.json +1 -1
- package/dist/cjs/components/PoolsAssetsTable/index.cjs +0 -1
- package/dist/esm/components/PoolsAssetsTable/index.js +0 -43
- package/dist/types/components/PoolsAssetsTable/PoolAssetsLine.d.ts +0 -12
- package/dist/types/components/PoolsAssetsTable/TableHead.d.ts +0 -7
- /package/dist/cjs/components/{PoolsAssetsTable → pool-assets-table}/types.cjs +0 -0
- /package/dist/esm/components/{PoolsAssetsTable → pool-assets-table}/types.js +0 -0
|
@@ -59,7 +59,11 @@ const e = {
|
|
|
59
59
|
"components.poolAssetsTable.asset": "Asset",
|
|
60
60
|
"components.poolAssetsTable.rate": "Effective rate",
|
|
61
61
|
"components.poolAssetsTable.limits": "Limits Usage",
|
|
62
|
-
"components.poolAssetsTable.usage": "{amount} of {total}"
|
|
62
|
+
"components.poolAssetsTable.usage": "{amount} of {total}",
|
|
63
|
+
"components.poolAssetsTable.head.name": "Credit Manager",
|
|
64
|
+
"components.poolAssetsTable.head.currentDebt": "Current Debt",
|
|
65
|
+
"components.poolAssetsTable.head.assets": "Asset LT",
|
|
66
|
+
"components.poolCreditManagersTable.assets": "{amount} assets"
|
|
63
67
|
};
|
|
64
68
|
export {
|
|
65
69
|
e as default
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* ==================================
|
|
4
4
|
*
|
|
5
5
|
* Self-contained type definitions for the pool-list endpoint response.
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* locally (e.g. SDK + `tokensList` on each row).
|
|
6
|
+
* Consumers (`@gearbox-protocol/ui-kit`, `charts`, `client-v3`) map these fields
|
|
7
|
+
* into the `PoolTable` component and resolve token metadata (icons, decimals, titles)
|
|
8
|
+
* locally (e.g. SDK + `tokensList` on each row in the app layer).
|
|
9
9
|
*
|
|
10
10
|
* Copy this file into your backend repo — it has **zero npm dependencies**.
|
|
11
11
|
*
|
|
@@ -19,6 +19,72 @@
|
|
|
19
19
|
* The client converts them back via `BigInt(value)`.
|
|
20
20
|
* - `Address` → `0x`-prefixed hex string, lower-case preferred.
|
|
21
21
|
*
|
|
22
|
+
* ## Unit conventions (critical — do not mix)
|
|
23
|
+
*
|
|
24
|
+
* - **`depositAPY`**, **`PoolApyDTO.totalAPY`**, **`PoolBaseApyDTO.apy`**, **`PoolExtraRewardApyDTO.apy`**:
|
|
25
|
+
* **percent** (e.g. `5.2` means 5.2%).
|
|
26
|
+
* - **`borrowAPY`**: **basis points** (`10_000` = 100%). The Borrow APY column uses the same
|
|
27
|
+
* formatter as elsewhere in the app.
|
|
28
|
+
* - **`utilization`**: **percent** in the `0–100` range (not 0–1).
|
|
29
|
+
* - **`expectedLiquidity`**, **`totalBorrowed`**, **`userBalance`**: raw amounts in **underlying /
|
|
30
|
+
* pool token units** (see field docs). Serialize as decimal strings in JSON.
|
|
31
|
+
* - **`*InUSD` fields**: plain `number` (USD).
|
|
32
|
+
*
|
|
33
|
+
* ## Mapping guide — gearbox-backend PR #84 → this contract
|
|
34
|
+
*
|
|
35
|
+
* The PR introduces `PoolOpportunity`, `MarketInfo`, `MarketMetrics`, `YieldBreakdown`, and
|
|
36
|
+
* discriminated `Incentive` (tokens | points). **The HTTP response shape stays
|
|
37
|
+
* {@link PoolTableListResponse}** so existing frontends do not need rewrites. On the server,
|
|
38
|
+
* **project** PR #84 types into the DTOs below.
|
|
39
|
+
*
|
|
40
|
+
* ### `PoolTableRowDTO` from `PoolOpportunity` + optional wallet snapshot
|
|
41
|
+
*
|
|
42
|
+
* - **`pool`**: Build {@link PoolDTO} from `MarketInfo` + latest `MarketMetrics` (and
|
|
43
|
+
* `PoolOpportunity.collaterals` for addresses). See {@link PoolDTO} block comments.
|
|
44
|
+
* - **`apy`**: Build {@link PoolApyDTO} from `PoolOpportunity.yield` (`YieldBreakdown`) and
|
|
45
|
+
* token incentives inside `yield.incentives`. See {@link PoolApyDTO}.
|
|
46
|
+
* - **`points`**: Map each **active** points incentive to {@link PoolApyPointDTO}.
|
|
47
|
+
* Source: `yield.incentives` where `incentive.type === "points"` (or your PR #84 equivalent).
|
|
48
|
+
* Use `[]` or omit when none.
|
|
49
|
+
* - **`chainId`**: Same as `MarketInfo.chainId` / row pool identity (required for table context).
|
|
50
|
+
* - **`href`**: Optional deep link; app may still build locally.
|
|
51
|
+
*
|
|
52
|
+
* ### `PoolDTO` from `MarketInfo` + `MarketMetrics` + `PoolOpportunity`
|
|
53
|
+
*
|
|
54
|
+
* | Contract field | Suggested PR #84 source |
|
|
55
|
+
* | --- | --- |
|
|
56
|
+
* | `address` | `MarketInfo.address` (pool contract) |
|
|
57
|
+
* | `underlyingToken` | `MarketInfo.underlyingAsset` |
|
|
58
|
+
* | `name` | `MarketInfo.name` |
|
|
59
|
+
* | `version` | `MarketInfo.version` (semver-like int as in PR) |
|
|
60
|
+
* | `network` | Derive human label from `chainId` (e.g. "Arbitrum") — **not** necessarily in PR types |
|
|
61
|
+
* | `chainId` | `MarketInfo.chainId` |
|
|
62
|
+
* | `marketConfigurator` | `MarketInfo.marketConfiguratorAddress` |
|
|
63
|
+
* | `expectedLiquidity` | `MarketMetrics.expected` (underlying units → bigint / JSON string) |
|
|
64
|
+
* | `expectedLiquidityInUSD` | `MarketMetrics.expectedUSD` |
|
|
65
|
+
* | `totalBorrowed` | `MarketMetrics.borrowed` |
|
|
66
|
+
* | `totalBorrowedInUSD` | `MarketMetrics.borrowedUSD` |
|
|
67
|
+
* | `utilization` | e.g. `(borrowed / expected) * 100` when `expected > 0`, else `0` — **percent 0–100** |
|
|
68
|
+
* | `depositAPY` | **Percent**: if PR stores annualized rate as fraction (e.g. `0.052`), multiply by `100`. If already percent, pass through. Align with `YieldBreakdown.base` / supply side. |
|
|
69
|
+
* | `borrowAPY` | **Basis points**: if PR `MarketMetrics.baseInterestRate` is a fraction, use `* 10_000`. If already bps, pass through. |
|
|
70
|
+
* | `collateralTokens` | `PoolOpportunity.collaterals.map(c => c.token.address)` (or active subset you expose) |
|
|
71
|
+
* | `userBalanceInUSD` | From `UserPoolPosition` / wallet-aware layer when `wallet` query present |
|
|
72
|
+
* | `userBalance` | Same — position size in pool/deposit token units |
|
|
73
|
+
* | `poolTokenSymbol` | Diesel / pool share symbol if distinct from underlying (app-specific) |
|
|
74
|
+
* | `hasPoints` | `true` if any points incentive is active, e.g. `yield.incentives.some(i => i.type === "points" && i.isActive)` |
|
|
75
|
+
*
|
|
76
|
+
* ### `PoolApyDTO` from `YieldBreakdown` + incentives
|
|
77
|
+
*
|
|
78
|
+
* - **`totalAPY`**: `YieldBreakdown.totalApy` (must be **percent**, consistent with UI).
|
|
79
|
+
* - **`baseAPY`**: At minimum `[{ type: "supplyAPY", apy: YieldBreakdown.base }]`. Add `{ type: "tokenYield", apy }` entries if your model splits organic yield further.
|
|
80
|
+
* - **`extraAPY`**: For each **token** incentive in `YieldBreakdown.incentives` with `type === "tokens"`, map to {@link PoolExtraRewardApyDTO} (see that interface).
|
|
81
|
+
* - **`externalAPY`**: Optional — only if you expose an external protocol boost; shape is {@link PoolExternalApyDTO}.
|
|
82
|
+
* - **`apy7DAgo`**: Optional — requires a **stored snapshot** (e.g. `MarketDetailResponse.metrics7DAgo` in PR #84). Build {@link PoolApy7DaysAgoDTO} the same way as current `apy` for that snapshot. Omit if unavailable.
|
|
83
|
+
*
|
|
84
|
+
* ### `PoolApyPointDTO` from points `Incentive`
|
|
85
|
+
*
|
|
86
|
+
* Map each points program to one row. Align with UI `PoolAPYPointsTip`: `amount`, `name`, `tokenTitle`, `fullTip`, `reward.*`.
|
|
87
|
+
*
|
|
22
88
|
* @packageDocumentation
|
|
23
89
|
*/
|
|
24
90
|
type Address = `0x${string}`;
|
|
@@ -29,11 +95,24 @@ type Address = `0x${string}`;
|
|
|
29
95
|
* "rows": [ … ]
|
|
30
96
|
* }
|
|
31
97
|
* ```
|
|
98
|
+
*
|
|
99
|
+
* **PR #84:** Keep this envelope. Populate `rows` by mapping each internal `PoolOpportunity`
|
|
100
|
+
* (plus metrics and optional user position) into {@link PoolTableRowDTO} — do not replace
|
|
101
|
+
* with a raw `PoolOpportunity[]` at the root if you want zero frontend changes.
|
|
32
102
|
*/
|
|
33
103
|
export interface PoolTableListResponse {
|
|
34
104
|
/** One entry per pool visible in the table. */
|
|
35
105
|
rows: PoolTableRowDTO[];
|
|
36
106
|
}
|
|
107
|
+
/**
|
|
108
|
+
* One table row. Apps pass this (with `tokensList` filled client-side) into `PoolTable`.
|
|
109
|
+
*
|
|
110
|
+
* **PR #84 assembly:**
|
|
111
|
+
* - **`pool`**: {@link PoolDTO} from `MarketInfo` + `MarketMetrics` + collateral list on `PoolOpportunity`.
|
|
112
|
+
* - **`apy`**: {@link PoolApyDTO} from `PoolOpportunity.yield` (`YieldBreakdown`); split token vs points as documented on {@link PoolApyDTO} and {@link PoolApyPointDTO}.
|
|
113
|
+
* - **`points`**: derived from **points** incentives only (not duplicated inside `apy.extraAPY`).
|
|
114
|
+
* - **`chainId`**: must match the pool’s chain.
|
|
115
|
+
*/
|
|
37
116
|
export interface PoolTableRowDTO {
|
|
38
117
|
pool: PoolDTO;
|
|
39
118
|
/** Supply / deposit APY breakdown (column + tooltip). */
|
|
@@ -44,55 +123,102 @@ export interface PoolTableRowDTO {
|
|
|
44
123
|
/** Deep-link to pool detail page (client can also build this locally). */
|
|
45
124
|
href?: string;
|
|
46
125
|
}
|
|
126
|
+
/**
|
|
127
|
+
* Flat pool fields for columns (supply, borrowed, utilization, borrow APY, collateral icons, etc.).
|
|
128
|
+
*
|
|
129
|
+
* **PR #84:** Compose from `MarketInfo` + `MarketMetrics` + `PoolOpportunity.collaterals`.
|
|
130
|
+
* See the file-level mapping table for field-by-field sources.
|
|
131
|
+
*/
|
|
47
132
|
export interface PoolDTO {
|
|
133
|
+
/** **PR #84:** `MarketInfo.address`. */
|
|
48
134
|
address: Address;
|
|
135
|
+
/** **PR #84:** `MarketInfo.underlyingAsset`. */
|
|
49
136
|
underlyingToken: Address;
|
|
50
|
-
/** Display name, e.g. "USDC v3". */
|
|
137
|
+
/** Display name, e.g. "USDC v3". **PR #84:** `MarketInfo.name`. */
|
|
51
138
|
name?: string;
|
|
52
|
-
/** Semver-like integer: 300 = v3, 310 = v3.1, etc. */
|
|
139
|
+
/** Semver-like integer: 300 = v3, 310 = v3.1, etc. **PR #84:** `MarketInfo.version`. */
|
|
53
140
|
version?: number;
|
|
54
|
-
/** Human-readable network label, e.g. "Mainnet", "Arbitrum". */
|
|
141
|
+
/** Human-readable network label, e.g. "Mainnet", "Arbitrum". Derive from `chainId` if not in PR types. */
|
|
55
142
|
network?: string;
|
|
143
|
+
/** **PR #84:** `MarketInfo.chainId`. */
|
|
56
144
|
chainId?: number;
|
|
57
|
-
/** Market configurator address (
|
|
145
|
+
/** Market configurator address (curator badge). **PR #84:** `MarketInfo.marketConfiguratorAddress`. */
|
|
58
146
|
marketConfigurator?: Address;
|
|
59
|
-
/**
|
|
147
|
+
/**
|
|
148
|
+
* Total supplied liquidity in underlying token (bigint → string in JSON).
|
|
149
|
+
* **PR #84:** `MarketMetrics.expected` in underlying units.
|
|
150
|
+
*/
|
|
60
151
|
expectedLiquidity?: bigint;
|
|
61
|
-
/** Same value converted to USD. */
|
|
152
|
+
/** Same value converted to USD. **PR #84:** `MarketMetrics.expectedUSD`. */
|
|
62
153
|
expectedLiquidityInUSD?: number;
|
|
63
|
-
/**
|
|
154
|
+
/**
|
|
155
|
+
* Total borrowed in underlying token (bigint → string in JSON).
|
|
156
|
+
* **PR #84:** `MarketMetrics.borrowed`.
|
|
157
|
+
*/
|
|
64
158
|
totalBorrowed?: bigint;
|
|
65
|
-
/** Same value converted to USD. */
|
|
159
|
+
/** Same value converted to USD. **PR #84:** `MarketMetrics.borrowedUSD`. */
|
|
66
160
|
totalBorrowedInUSD?: number;
|
|
67
|
-
/**
|
|
161
|
+
/**
|
|
162
|
+
* Utilization ratio, 0–100 (percent).
|
|
163
|
+
* **PR #84:** e.g. `(borrowed / expected) * 100` with safe zero handling.
|
|
164
|
+
*/
|
|
68
165
|
utilization?: number;
|
|
69
|
-
/**
|
|
166
|
+
/**
|
|
167
|
+
* Base deposit APY, already in **percent** (e.g. `5.2` = 5.2%).
|
|
168
|
+
* **PR #84:** Align with supply-side APY; convert from fractional rate if needed (`* 100`).
|
|
169
|
+
*/
|
|
70
170
|
depositAPY?: number;
|
|
71
171
|
/**
|
|
72
172
|
* Borrow rate for the "Borrow APY" column.
|
|
73
173
|
* Unit: **basis points** (10 000 = 100%).
|
|
174
|
+
* **PR #84:** Map from `MarketMetrics.baseInterestRate`; convert fraction → bps (`* 10_000`) if applicable.
|
|
74
175
|
*/
|
|
75
176
|
borrowAPY?: number;
|
|
76
177
|
/**
|
|
77
178
|
* Active collateral token addresses for the "Collateral" column.
|
|
78
179
|
* Token symbols/decimals for display are resolved on the client (no server-side
|
|
79
180
|
* token dictionary in this response).
|
|
181
|
+
* **PR #84:** `PoolOpportunity.collaterals.map(c => c.token.address)` (or your filtered list).
|
|
80
182
|
*/
|
|
81
183
|
collateralTokens?: Address[];
|
|
82
|
-
/**
|
|
184
|
+
/**
|
|
185
|
+
* User's pool position value in USD ("Your Balance" column).
|
|
186
|
+
* **PR #84:** When wallet is requested, from `UserPoolPosition` / similar (e.g. `depositSizeUsd`).
|
|
187
|
+
*/
|
|
83
188
|
userBalanceInUSD?: number;
|
|
84
|
-
/**
|
|
189
|
+
/**
|
|
190
|
+
* User's position amount in pool/deposit token (bigint → string).
|
|
191
|
+
* **PR #84:** e.g. `UserPoolPosition.depositSize` in token units.
|
|
192
|
+
*/
|
|
85
193
|
userBalance?: bigint;
|
|
86
194
|
/** Pool deposit token symbol, e.g. `"edgeUSDC"`. */
|
|
87
195
|
poolTokenSymbol?: string;
|
|
88
|
-
/**
|
|
196
|
+
/**
|
|
197
|
+
* `true` when the pool has active points/rewards (shows indicator icon).
|
|
198
|
+
* **PR #84:** e.g. any active `type === "points"` incentive in `yield.incentives`.
|
|
199
|
+
*/
|
|
89
200
|
hasPoints?: boolean;
|
|
90
201
|
}
|
|
202
|
+
/**
|
|
203
|
+
* Supply APY breakdown for {@link CompoundAPY} / tooltip. All APY numbers here are **percent**.
|
|
204
|
+
*
|
|
205
|
+
* **PR #84:** Build from `PoolOpportunity.yield` (`YieldBreakdown`):
|
|
206
|
+
* - `totalAPY` ← `totalApy`
|
|
207
|
+
* - `baseAPY` ← at least one `supplyAPY` row from `base`; add `tokenYield` rows if split
|
|
208
|
+
* - `extraAPY` ← token incentives only (see {@link PoolExtraRewardApyDTO})
|
|
209
|
+
* - `apy7DAgo` ← optional second snapshot if you persist `metrics7DAgo` / historical yield
|
|
210
|
+
*/
|
|
91
211
|
export interface PoolApyDTO {
|
|
92
|
-
/** Total combined supply APY in percent (`8.33` = 8.33%). */
|
|
212
|
+
/** Total combined supply APY in percent (`8.33` = 8.33%). **PR #84:** `YieldBreakdown.totalApy`. */
|
|
93
213
|
totalAPY: number;
|
|
214
|
+
/** **PR #84:** From `YieldBreakdown.base` (+ optional extra base rows). */
|
|
94
215
|
baseAPY: PoolBaseApyDTO[];
|
|
216
|
+
/**
|
|
217
|
+
* Token reward APY lines (not points — points go to {@link PoolTableRowDTO.points}).
|
|
218
|
+
* **PR #84:** `yield.incentives` filtered to `type === "tokens"`.
|
|
219
|
+
*/
|
|
95
220
|
extraAPY: PoolExtraRewardApyDTO[];
|
|
221
|
+
/** Optional external boost (e.g. third-party protocol). */
|
|
96
222
|
externalAPY?: PoolExternalApyDTO;
|
|
97
223
|
/** Snapshot from 7 days ago (for 1D / 7D comparison in tooltip). */
|
|
98
224
|
apy7DAgo?: PoolApy7DaysAgoDTO;
|
|
@@ -102,6 +228,14 @@ export interface PoolBaseApyDTO {
|
|
|
102
228
|
/** Already in percent. */
|
|
103
229
|
apy: number;
|
|
104
230
|
}
|
|
231
|
+
/**
|
|
232
|
+
* One line in "extra APY" (liquidity mining, etc.). **Percent** for `apy`.
|
|
233
|
+
*
|
|
234
|
+
* **PR #84 (token incentive):**
|
|
235
|
+
* - `apy` ← `TokenReward.apy` (or incentive-level APY if that’s where you store it)
|
|
236
|
+
* - `rewardToken` ← `TokenReward.rewardToken.address` (hex string)
|
|
237
|
+
* - `rewardTokenSymbol` ← `TokenReward.rewardToken.symbol`
|
|
238
|
+
*/
|
|
105
239
|
export interface PoolExtraRewardApyDTO {
|
|
106
240
|
/** Extra reward APY in percent. */
|
|
107
241
|
apy: number;
|
|
@@ -116,12 +250,29 @@ export interface PoolExternalApyDTO {
|
|
|
116
250
|
/** Source name, e.g. "Curve". */
|
|
117
251
|
name: string;
|
|
118
252
|
}
|
|
253
|
+
/**
|
|
254
|
+
* Historical snapshot for tooltip 1D / 7D columns. Same units as {@link PoolApyDTO}.
|
|
255
|
+
*
|
|
256
|
+
* **PR #84:** Fill from your stored 7d metrics / APY snapshot when available; omit otherwise.
|
|
257
|
+
*/
|
|
119
258
|
export interface PoolApy7DaysAgoDTO {
|
|
120
259
|
totalAPY?: number;
|
|
121
260
|
baseAPY?: PoolBaseApyDTO[];
|
|
122
261
|
extraAPY?: PoolExtraRewardApyDTO[];
|
|
123
262
|
externalAPY?: PoolExternalApyDTO;
|
|
124
263
|
}
|
|
264
|
+
/**
|
|
265
|
+
* One points program row for the APY tooltip. Matches UI `PoolAPYPointsTip` shape.
|
|
266
|
+
*
|
|
267
|
+
* **PR #84:** Map from a **points** `Incentive` / `PointsIncentive` (discriminated union):
|
|
268
|
+
* - `amount` — formatted string for display, e.g. `"2.5x"` from `PointsReward.multiplier`
|
|
269
|
+
* - `name` — `PointsReward.name` or program title
|
|
270
|
+
* - `tokenTitle` — optional; helps icon copy (e.g. underlying symbol)
|
|
271
|
+
* - `fullTip` — **pre-formatted** human-readable tooltip body (UI-ready)
|
|
272
|
+
* - `reward.duration` — human string (e.g. from `startsAt` / `endsAt`) or omit
|
|
273
|
+
* - `reward.condition` — e.g. `"deposit" | "cross-chain-deposit" | "holding"` if your model has it
|
|
274
|
+
* - `reward.name` / `reward.type` — for points icon / labeling in the UI
|
|
275
|
+
*/
|
|
125
276
|
export interface PoolApyPointDTO {
|
|
126
277
|
/** Formatted amount string, e.g. "2.5x". */
|
|
127
278
|
amount: string;
|
|
@@ -78,11 +78,12 @@ export * from './not-found';
|
|
|
78
78
|
export * from './options-list';
|
|
79
79
|
export * from './overflow';
|
|
80
80
|
export * from './overflow-container';
|
|
81
|
-
export * from './PoolsAssetsTable';
|
|
82
81
|
export * from './page-title';
|
|
83
82
|
export * from './percent-indicator';
|
|
84
83
|
export * from './points-icon';
|
|
85
84
|
export * from './pool-apy-tooltip';
|
|
85
|
+
export * from './pool-assets-table';
|
|
86
|
+
export * from './pool-credit-managers-table';
|
|
86
87
|
export * from './pool-indicator-icon';
|
|
87
88
|
export * from './pool-points-indicator';
|
|
88
89
|
export * from './progress';
|
|
@@ -18,7 +18,8 @@ interface ExternalAPYData {
|
|
|
18
18
|
totalValue: number;
|
|
19
19
|
apy: number;
|
|
20
20
|
name: string;
|
|
21
|
-
|
|
21
|
+
/** When omitted, the block renders a plain name + APY line (no i18n id). */
|
|
22
|
+
tooltip?: LocaleKeys;
|
|
22
23
|
}
|
|
23
24
|
interface APY7DAgoData {
|
|
24
25
|
totalAPY?: number;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type * from './pool-assets-table';
|
|
2
|
+
export * from './pool-assets-table';
|
|
3
|
+
export type * from './pool-assets-table-head';
|
|
4
|
+
export * from './pool-assets-table-head';
|
|
5
|
+
export type * from './pool-assets-table-row';
|
|
6
|
+
export * from './pool-assets-table-row';
|
|
7
|
+
export type * from './types';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { PoolAssetsTableSort } from './types';
|
|
3
|
+
export interface PoolAssetsTableHeadProps {
|
|
4
|
+
readonly sort: PoolAssetsTableSort;
|
|
5
|
+
}
|
|
6
|
+
export declare function PoolAssetsTableHead({ sort, }: PoolAssetsTableHeadProps): React.ReactElement;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TokenData } from '@gearbox-protocol/sdk/common-utils';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
import { PoolAssetsTableQuotaRow } from './types';
|
|
4
|
+
export interface PoolAssetsTableRowProps {
|
|
5
|
+
readonly poolName: string;
|
|
6
|
+
readonly token: TokenData;
|
|
7
|
+
readonly currentQuota: PoolAssetsTableQuotaRow;
|
|
8
|
+
readonly underlyingToken: TokenData;
|
|
9
|
+
readonly last: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare function PoolAssetsTableRow({ poolName, token, currentQuota, underlyingToken, last, }: PoolAssetsTableRowProps): React.ReactElement;
|
|
@@ -2,12 +2,11 @@ import { TokenData } from '@gearbox-protocol/sdk/common-utils';
|
|
|
2
2
|
import { default as React } from 'react';
|
|
3
3
|
import { Address } from 'viem';
|
|
4
4
|
import { PoolAssetsTableQuotaRow, PoolAssetsTableSort } from './types';
|
|
5
|
-
export
|
|
6
|
-
export interface PoolAssetsTableViewProps {
|
|
5
|
+
export interface PoolAssetsTableProps {
|
|
7
6
|
readonly list: ReadonlyArray<PoolAssetsTableQuotaRow>;
|
|
8
7
|
readonly poolName: string;
|
|
9
8
|
readonly sort: PoolAssetsTableSort;
|
|
10
9
|
readonly tokensList: Record<Address, TokenData>;
|
|
11
10
|
readonly underlyingToken: TokenData;
|
|
12
11
|
}
|
|
13
|
-
export declare function
|
|
12
|
+
export declare function PoolAssetsTable({ list, poolName, sort, tokensList, underlyingToken, }: PoolAssetsTableProps): React.ReactElement | null;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Address } from 'viem';
|
|
2
2
|
import { SortField, SortSetterFunction } from '../../hooks';
|
|
3
3
|
export type PoolAssetsSortFields = "name" | "rate" | "usage";
|
|
4
|
+
/** Sort controller passed to `PoolAssetsTable` */
|
|
4
5
|
export interface PoolAssetsTableSort {
|
|
5
6
|
readonly state: SortField<PoolAssetsSortFields> | null;
|
|
6
7
|
readonly set: SortSetterFunction<PoolAssetsSortFields>;
|
|
@@ -8,7 +9,7 @@ export interface PoolAssetsTableSort {
|
|
|
8
9
|
export interface PoolAssetsFilterState {
|
|
9
10
|
readonly sort: PoolAssetsTableSort;
|
|
10
11
|
}
|
|
11
|
-
/** Quota fields
|
|
12
|
+
/** Quota fields for one asset row (compatible with sdk QuotaInfo) */
|
|
12
13
|
export interface PoolAssetsTableQuotaRow {
|
|
13
14
|
readonly token: Address;
|
|
14
15
|
readonly limit: bigint;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type * from './pool-credit-managers-table';
|
|
2
|
+
export * from './pool-credit-managers-table';
|
|
3
|
+
export * from './pool-credit-managers-table.test-ids';
|
|
4
|
+
export type * from './pool-credit-managers-table-head';
|
|
5
|
+
export * from './pool-credit-managers-table-head';
|
|
6
|
+
export type * from './pool-credit-managers-table-row';
|
|
7
|
+
export * from './pool-credit-managers-table-row';
|
|
8
|
+
export type * from './types';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { PoolCreditManagersTableSort } from './types';
|
|
3
|
+
export interface PoolCreditManagersTableHeadProps {
|
|
4
|
+
readonly sort: PoolCreditManagersTableSort;
|
|
5
|
+
}
|
|
6
|
+
export declare function PoolCreditManagersTableHead({ sort, }: PoolCreditManagersTableHeadProps): React.ReactElement;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TokenData } from '@gearbox-protocol/sdk/common-utils';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
import { PoolCreditManagerRow } from './types';
|
|
4
|
+
export interface PoolCreditManagersTableRowProps {
|
|
5
|
+
readonly creditManager: PoolCreditManagerRow;
|
|
6
|
+
readonly last: boolean;
|
|
7
|
+
readonly onClick: () => void;
|
|
8
|
+
readonly totalDebtMoney: bigint;
|
|
9
|
+
readonly underlyingToken: TokenData | undefined;
|
|
10
|
+
}
|
|
11
|
+
export declare function PoolCreditManagersTableRow({ creditManager, last, onClick, totalDebtMoney, underlyingToken, }: PoolCreditManagersTableRowProps): React.ReactElement | null;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { TokenData } from '@gearbox-protocol/sdk/common-utils';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
import { PoolCreditManagerRow, PoolCreditManagersTableRowDto, PoolCreditManagersTableSort } from './types';
|
|
4
|
+
export interface PoolCreditManagersTableProps<TRow extends PoolCreditManagerRow = PoolCreditManagerRow> {
|
|
5
|
+
readonly handleSelectCM: (cm: TRow) => () => void;
|
|
6
|
+
readonly rows: ReadonlyArray<PoolCreditManagersTableRowDto<TRow>>;
|
|
7
|
+
readonly sort: PoolCreditManagersTableSort;
|
|
8
|
+
readonly underlyingToken: TokenData | undefined;
|
|
9
|
+
}
|
|
10
|
+
export declare function PoolCreditManagersTable<TRow extends PoolCreditManagerRow = PoolCreditManagerRow>({ handleSelectCM, rows, sort, underlyingToken, }: PoolCreditManagersTableProps<TRow>): React.ReactElement | null;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Address } from 'viem';
|
|
2
|
+
import { SortField, SortSetterFunction } from '../../hooks';
|
|
3
|
+
export type PoolCreditManagersSortFields = "name" | "currentDebt" | "assets";
|
|
4
|
+
/** Sort controller passed to `PoolCreditManagersTable` */
|
|
5
|
+
export interface PoolCreditManagersTableSort {
|
|
6
|
+
readonly state: SortField<PoolCreditManagersSortFields> | null;
|
|
7
|
+
readonly set: SortSetterFunction<PoolCreditManagersSortFields>;
|
|
8
|
+
}
|
|
9
|
+
export interface PoolCreditManagersFilterState {
|
|
10
|
+
readonly sort: PoolCreditManagersTableSort;
|
|
11
|
+
}
|
|
12
|
+
/** One credit manager row (compatible with CreditManagerData_Legacy) */
|
|
13
|
+
export interface PoolCreditManagerRow {
|
|
14
|
+
readonly address: Address;
|
|
15
|
+
readonly name: string;
|
|
16
|
+
readonly totalDebt: bigint;
|
|
17
|
+
readonly collateralTokens: readonly unknown[];
|
|
18
|
+
readonly underlyingToken: Address;
|
|
19
|
+
}
|
|
20
|
+
/** Row data + computed USD total for the table body */
|
|
21
|
+
export interface PoolCreditManagersTableRowDto<TRow extends PoolCreditManagerRow = PoolCreditManagerRow> {
|
|
22
|
+
readonly creditManager: TRow;
|
|
23
|
+
readonly totalDebtMoney: bigint;
|
|
24
|
+
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -77,11 +77,12 @@ export * from './components/not-found';
|
|
|
77
77
|
export * from './components/options-list';
|
|
78
78
|
export * from './components/overflow';
|
|
79
79
|
export * from './components/overflow-container';
|
|
80
|
-
export * from './components/PoolsAssetsTable';
|
|
81
80
|
export * from './components/page-title';
|
|
82
81
|
export * from './components/percent-indicator';
|
|
83
82
|
export * from './components/points-icon';
|
|
84
83
|
export * from './components/pool-apy-tooltip';
|
|
84
|
+
export * from './components/pool-assets-table';
|
|
85
|
+
export * from './components/pool-credit-managers-table';
|
|
85
86
|
export * from './components/pool-indicator-icon';
|
|
86
87
|
export * from './components/pool-points-indicator';
|
|
87
88
|
export * from './components/progress';
|
|
@@ -74,7 +74,12 @@ declare const _default: {
|
|
|
74
74
|
"components.poolAssetsTable.asset": "Asset",
|
|
75
75
|
"components.poolAssetsTable.rate": "Effective rate",
|
|
76
76
|
"components.poolAssetsTable.limits": "Limits Usage",
|
|
77
|
-
"components.poolAssetsTable.usage": "{amount} of {total}"
|
|
77
|
+
"components.poolAssetsTable.usage": "{amount} of {total}",
|
|
78
|
+
"components.poolAssetsTable.head.name": "Credit Manager",
|
|
79
|
+
"components.poolAssetsTable.head.currentDebt": "Current Debt",
|
|
80
|
+
"components.poolAssetsTable.head.assets": "Asset LT",
|
|
81
|
+
|
|
82
|
+
"components.poolCreditManagersTable.assets": "{amount} assets"
|
|
78
83
|
}
|
|
79
84
|
;
|
|
80
85
|
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime");require("react");require("@gearbox-protocol/sdk/common-utils");require("@gearbox-protocol/sdk");const b=require("../../hooks/use-media-query.cjs"),o=require("../table/grid-table.cjs"),d=require("./PoolAssetsLine.cjs"),T=require("./TableHead.cjs");function p({list:r,poolName:t,sort:i,tokensList:n,underlyingToken:a}){const l=b.useIsMobile(),u=l?"1fr":"1fr 180px 1fr";return e.jsxs(o.GridTable,{cols:u,gap:0,size:"lg",wrapperClassName:"overflow-visible",children:[!l&&e.jsx(o.GridTableHeader,{children:e.jsx(T.TableHead,{sort:i})}),e.jsx(o.GridTableBody,{children:r.map((s,c)=>e.jsx(d.PoolAssetsLine,{poolName:t,currentQuota:s,token:n[s.token],underlyingToken:a,last:c===r.length-1},s.token))})]})}exports.PoolAssetsTableView=p;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { jsxs as n, jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import "react";
|
|
3
|
-
import "@gearbox-protocol/sdk/common-utils";
|
|
4
|
-
import "@gearbox-protocol/sdk";
|
|
5
|
-
import { useIsMobile as p } from "../../hooks/use-media-query.js";
|
|
6
|
-
import { GridTable as d, GridTableHeader as f, GridTableBody as c } from "../table/grid-table.js";
|
|
7
|
-
import { PoolAssetsLine as b } from "./PoolAssetsLine.js";
|
|
8
|
-
import { TableHead as g } from "./TableHead.js";
|
|
9
|
-
function v({
|
|
10
|
-
list: e,
|
|
11
|
-
poolName: l,
|
|
12
|
-
sort: s,
|
|
13
|
-
tokensList: t,
|
|
14
|
-
underlyingToken: m
|
|
15
|
-
}) {
|
|
16
|
-
const i = p();
|
|
17
|
-
return /* @__PURE__ */ n(
|
|
18
|
-
d,
|
|
19
|
-
{
|
|
20
|
-
cols: i ? "1fr" : "1fr 180px 1fr",
|
|
21
|
-
gap: 0,
|
|
22
|
-
size: "lg",
|
|
23
|
-
wrapperClassName: "overflow-visible",
|
|
24
|
-
children: [
|
|
25
|
-
!i && /* @__PURE__ */ r(f, { children: /* @__PURE__ */ r(g, { sort: s }) }),
|
|
26
|
-
/* @__PURE__ */ r(c, { children: e.map((o, a) => /* @__PURE__ */ r(
|
|
27
|
-
b,
|
|
28
|
-
{
|
|
29
|
-
poolName: l,
|
|
30
|
-
currentQuota: o,
|
|
31
|
-
token: t[o.token],
|
|
32
|
-
underlyingToken: m,
|
|
33
|
-
last: a === e.length - 1
|
|
34
|
-
},
|
|
35
|
-
o.token
|
|
36
|
-
)) })
|
|
37
|
-
]
|
|
38
|
-
}
|
|
39
|
-
);
|
|
40
|
-
}
|
|
41
|
-
export {
|
|
42
|
-
v as PoolAssetsTableView
|
|
43
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { TokenData } from '@gearbox-protocol/sdk/common-utils';
|
|
2
|
-
import { default as React } from 'react';
|
|
3
|
-
import { PoolAssetsTableQuotaRow } from './types';
|
|
4
|
-
interface PoolAssetsLineProps {
|
|
5
|
-
poolName: string;
|
|
6
|
-
token: TokenData;
|
|
7
|
-
currentQuota: PoolAssetsTableQuotaRow;
|
|
8
|
-
underlyingToken: TokenData;
|
|
9
|
-
last: boolean;
|
|
10
|
-
}
|
|
11
|
-
export declare function PoolAssetsLine({ poolName, token, currentQuota, underlyingToken, last, }: PoolAssetsLineProps): React.ReactElement;
|
|
12
|
-
export {};
|
|
File without changes
|
|
File without changes
|