@kasufinance/kasu-sdk 2.12.0 → 2.13.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/README.md +26 -1
- package/dist/bundle.cjs.js +871 -41
- package/dist/bundle.esm.js +868 -43
- package/dist/domain/index.d.ts +2 -0
- package/dist/domain/index.js +1 -0
- package/dist/domain/index.js.map +1 -1
- package/dist/domain/pool-tvl.d.ts +62 -0
- package/dist/domain/pool-tvl.js +22 -0
- package/dist/domain/pool-tvl.js.map +1 -0
- package/dist/facade/chain-configs.js +24 -0
- package/dist/facade/chain-configs.js.map +1 -1
- package/dist/facade/kasu.d.ts +2 -0
- package/dist/facade/kasu.js +13 -5
- package/dist/facade/kasu.js.map +1 -1
- package/dist/facade/strategies.d.ts +20 -0
- package/dist/facade/strategies.js +22 -0
- package/dist/facade/strategies.js.map +1 -1
- package/dist/facade/types.d.ts +20 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/kasu-sdk.d.ts +9 -1
- package/dist/kasu-sdk.js +2 -2
- package/dist/kasu-sdk.js.map +1 -1
- package/dist/sdk-config.d.ts +20 -0
- package/dist/sdk-config.js +3 -1
- package/dist/sdk-config.js.map +1 -1
- package/dist/services/DataService/data-service.d.ts +81 -1
- package/dist/services/DataService/data-service.js +211 -6
- package/dist/services/DataService/data-service.js.map +1 -1
- package/dist/services/DataService/tvl-history.d.ts +296 -0
- package/dist/services/DataService/tvl-history.js +558 -0
- package/dist/services/DataService/tvl-history.js.map +1 -0
- package/dist/services/Portfolio/yield-history.d.ts +1 -16
- package/dist/services/Portfolio/yield-history.js +2 -29
- package/dist/services/Portfolio/yield-history.js.map +1 -1
- package/dist/services/shared.d.ts +16 -0
- package/dist/services/shared.js +30 -0
- package/dist/services/shared.js.map +1 -1
- package/package.json +1 -1
- package/src/domain/index.ts +3 -0
- package/src/domain/pool-tvl.ts +66 -0
- package/src/facade/chain-configs.ts +26 -0
- package/src/facade/kasu.ts +20 -2
- package/src/facade/strategies.ts +26 -0
- package/src/facade/types.ts +20 -0
- package/src/index.ts +9 -0
- package/src/kasu-sdk.ts +19 -2
- package/src/sdk-config.ts +22 -0
- package/src/services/DataService/data-service.ts +296 -6
- package/src/services/DataService/tvl-history.ts +853 -0
- package/src/services/Portfolio/yield-history.ts +2 -35
- package/src/services/shared.ts +38 -1
package/README.md
CHANGED
|
@@ -116,7 +116,7 @@ You can also pass a whole `ChainConfigEntry` instead of a chain key.
|
|
|
116
116
|
|
|
117
117
|
| Facade | Methods | Purpose |
|
|
118
118
|
| ----------------- | ----------------------------------------------------------------------------------------------------------------------- | ------------------------------- |
|
|
119
|
-
| `kasu.strategies` | `getAll()`, `getVisible()`, `getById()`, `getPlatformStats()`, `getPerformanceFeePercent()`, `calculateDepositLimits()`, `getRiskPerformance(poolId)`, `getOriginator(poolId)` | Browse pools, APY, capacity, risk, originator |
|
|
119
|
+
| `kasu.strategies` | `getAll()`, `getVisible()`, `getById()`, `getPlatformStats()`, `getPerformanceFeePercent()`, `calculateDepositLimits()`, `getRiskPerformance(poolId)`, `getOriginator(poolId)`, `getPoolTvlHistory(poolId)` | Browse pools, APY, capacity, risk, originator, TVL history |
|
|
120
120
|
| `kasu.deposits` | `deposit()`, `withdraw()`, `withdrawMax()`, `buildKycParams()`, `isClearingPending()` | Submit transactions |
|
|
121
121
|
| `kasu.portfolio` | `getPositions()`, `getYieldHistory()`, `getTransactionHistory()`, `getRequestStates()` | Lender balances, yield, per-cycle earnings (net, in the chain's own stable token), history |
|
|
122
122
|
| `kasu.flows` | `deposit(ports)`, `withdraw(ports?)` | Headless transaction pipelines |
|
|
@@ -142,6 +142,31 @@ slightly more than lifetime interest (up to about 0.2 %, top-ups are valued at
|
|
|
142
142
|
today's share price), so show "earned to date" from the lifetime figure, not
|
|
143
143
|
from the sum of the bars.
|
|
144
144
|
|
|
145
|
+
`kasu.strategies.getPoolTvlHistory(poolId, { fromEpoch?, count?, timeoutMs?,
|
|
146
|
+
signal? })` returns the strategy's TVL (total lent by everyone) as
|
|
147
|
+
`{ epochId, timestamp, tvl, kind }[]`, ascending in time: one
|
|
148
|
+
`kind: 'clearing'` point per finished clearing, read at the block it finished
|
|
149
|
+
in, then one `kind: 'current'` point. `tvl` is in the deployment's own stable
|
|
150
|
+
token (AUDD on XDC AUDD — convert before showing USD) and is on-chain plus
|
|
151
|
+
off-chain TVL, the same `poolTvl` sum `tvl.total` uses; `timestamp` is unix
|
|
152
|
+
seconds. Plot by `timestamp`, not `epochId`: epoch numbers can jump, and
|
|
153
|
+
clearings run in one block share a point in time.
|
|
154
|
+
|
|
155
|
+
The `current` point is the subgraph's latest balance plus the off-chain TVL
|
|
156
|
+
read at `latest`, so it equals `strategy.tvl.total` when both calls' reads
|
|
157
|
+
succeed. `tvl.total` falls back to an off-chain 0 when its own read fails;
|
|
158
|
+
the history throws instead.
|
|
159
|
+
|
|
160
|
+
The off-chain part at old blocks needs RPCs that serve PAST state (archive
|
|
161
|
+
nodes). Built-in chains carry public ones (`historyRpcUrls`, tried in order,
|
|
162
|
+
10 s per call), but they are RATE-LIMITED and shared: **partners should pass
|
|
163
|
+
their own archive provider** — `Kasu.create({ chain, historyProvider })` — or
|
|
164
|
+
their own `configOverrides.historyRpcUrls`. A failed past-state read throws
|
|
165
|
+
(after retries); it never becomes 0. Final blocks are cached per SDK
|
|
166
|
+
instance, so a second call reads only what is new. `timeoutMs` (default
|
|
167
|
+
30 s) and `signal` bound the call and reject with
|
|
168
|
+
`PoolTvlHistoryTimeoutError` / `PoolTvlHistoryAbortedError`.
|
|
169
|
+
|
|
145
170
|
## Domain helpers
|
|
146
171
|
|
|
147
172
|
Pure functions shared by every Kasu frontend. They return **numbers and codes,
|