@compass-labs/api-sdk 2.2.114-rc.0 → 2.2.115
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/codeSamples_typescript.yaml +2 -2
- package/dist/commonjs/models/components/index.d.ts +1 -0
- package/dist/commonjs/models/components/index.d.ts.map +1 -1
- package/dist/commonjs/models/components/index.js +1 -0
- package/dist/commonjs/models/components/index.js.map +1 -1
- package/dist/commonjs/models/components/loopedposition.d.ts +5 -0
- package/dist/commonjs/models/components/loopedposition.d.ts.map +1 -1
- package/dist/commonjs/models/components/loopedposition.js +2 -0
- package/dist/commonjs/models/components/loopedposition.js.map +1 -1
- package/dist/commonjs/models/components/loopedpositionhistoryentry.d.ts +16 -1
- package/dist/commonjs/models/components/loopedpositionhistoryentry.d.ts.map +1 -1
- package/dist/commonjs/models/components/loopedpositionhistoryentry.js +12 -1
- package/dist/commonjs/models/components/loopedpositionhistoryentry.js.map +1 -1
- package/dist/commonjs/models/components/loopedpositionpnl.d.ts +36 -0
- package/dist/commonjs/models/components/loopedpositionpnl.d.ts.map +1 -0
- package/dist/commonjs/models/components/loopedpositionpnl.js +59 -0
- package/dist/commonjs/models/components/loopedpositionpnl.js.map +1 -0
- package/dist/commonjs/models/components/marketallocation.d.ts +5 -1
- package/dist/commonjs/models/components/marketallocation.d.ts.map +1 -1
- package/dist/commonjs/models/components/marketallocation.js +2 -0
- package/dist/commonjs/models/components/marketallocation.js.map +1 -1
- package/dist/commonjs/models/components/swapinfo.d.ts +8 -8
- package/dist/commonjs/models/operations/v2earnpendlemarkets.d.ts +5 -5
- package/dist/commonjs/models/operations/v2earnpendlemarkets.d.ts.map +1 -1
- package/dist/commonjs/models/operations/v2earnpendlemarkets.js +1 -1
- package/dist/commonjs/models/operations/v2earnpendlemarkets.js.map +1 -1
- package/dist/commonjs/models/operations/v2earnvaults.d.ts +5 -5
- package/dist/commonjs/models/operations/v2earnvaults.d.ts.map +1 -1
- package/dist/commonjs/models/operations/v2earnvaults.js +1 -1
- package/dist/commonjs/models/operations/v2earnvaults.js.map +1 -1
- package/dist/esm/models/components/index.d.ts +1 -0
- package/dist/esm/models/components/index.d.ts.map +1 -1
- package/dist/esm/models/components/index.js +1 -0
- package/dist/esm/models/components/index.js.map +1 -1
- package/dist/esm/models/components/loopedposition.d.ts +5 -0
- package/dist/esm/models/components/loopedposition.d.ts.map +1 -1
- package/dist/esm/models/components/loopedposition.js +2 -0
- package/dist/esm/models/components/loopedposition.js.map +1 -1
- package/dist/esm/models/components/loopedpositionhistoryentry.d.ts +16 -1
- package/dist/esm/models/components/loopedpositionhistoryentry.d.ts.map +1 -1
- package/dist/esm/models/components/loopedpositionhistoryentry.js +11 -0
- package/dist/esm/models/components/loopedpositionhistoryentry.js.map +1 -1
- package/dist/esm/models/components/loopedpositionpnl.d.ts +36 -0
- package/dist/esm/models/components/loopedpositionpnl.d.ts.map +1 -0
- package/dist/esm/models/components/loopedpositionpnl.js +22 -0
- package/dist/esm/models/components/loopedpositionpnl.js.map +1 -0
- package/dist/esm/models/components/marketallocation.d.ts +5 -1
- package/dist/esm/models/components/marketallocation.d.ts.map +1 -1
- package/dist/esm/models/components/marketallocation.js +2 -0
- package/dist/esm/models/components/marketallocation.js.map +1 -1
- package/dist/esm/models/components/swapinfo.d.ts +8 -8
- package/dist/esm/models/operations/v2earnpendlemarkets.d.ts +5 -5
- package/dist/esm/models/operations/v2earnpendlemarkets.d.ts.map +1 -1
- package/dist/esm/models/operations/v2earnpendlemarkets.js +1 -1
- package/dist/esm/models/operations/v2earnpendlemarkets.js.map +1 -1
- package/dist/esm/models/operations/v2earnvaults.d.ts +5 -5
- package/dist/esm/models/operations/v2earnvaults.d.ts.map +1 -1
- package/dist/esm/models/operations/v2earnvaults.js +1 -1
- package/dist/esm/models/operations/v2earnvaults.js.map +1 -1
- package/docs/models/components/flowbasis.md +15 -0
- package/docs/models/components/loopedposition.md +1 -0
- package/docs/models/components/loopedpositionhistoryentry.md +13 -11
- package/docs/models/components/loopedpositionpnl.md +27 -0
- package/docs/models/components/marketallocation.md +12 -11
- package/docs/models/components/swapinfo.md +8 -8
- package/docs/models/operations/v2earnpendlemarketsrequest.md +10 -10
- package/docs/models/operations/v2earnvaultsrequest.md +12 -12
- package/docs/sdks/earn/README.md +4 -4
- package/openapi_prepped_for_speakeasy.json +126 -27
- package/package.json +1 -1
- package/src/models/components/index.ts +1 -0
- package/src/models/components/loopedposition.ts +9 -0
- package/src/models/components/loopedpositionhistoryentry.ts +23 -1
- package/src/models/components/loopedpositionpnl.ts +66 -0
- package/src/models/components/marketallocation.ts +7 -1
- package/src/models/components/swapinfo.ts +8 -8
- package/src/models/operations/v2earnpendlemarkets.ts +6 -6
- package/src/models/operations/v2earnvaults.ts +6 -6
|
@@ -4972,17 +4972,6 @@
|
|
|
4972
4972
|
"description": "List ERC-4626 yield vaults across DeFi venues.\n\nReturns vault data including APY, TVL, and underlying asset information. Use this endpoint to discover yield opportunities, compare rates across venues, or build vault selection interfaces.\n\nSupports dozens of vaults and markets like Morpho and other ERC-4626 compatible yield venues.\n\nTo deposit into a vault, use the [manage endpoint](https://docs.compasslabs.ai/v2/api-reference/earn/manage-earn-position) with `venue_type=VAULTS`.",
|
|
4973
4973
|
"operationId": "v2_earn_vaults",
|
|
4974
4974
|
"parameters": [
|
|
4975
|
-
{
|
|
4976
|
-
"name": "order_by",
|
|
4977
|
-
"in": "query",
|
|
4978
|
-
"required": true,
|
|
4979
|
-
"schema": {
|
|
4980
|
-
"type": "string",
|
|
4981
|
-
"title": "Order By",
|
|
4982
|
-
"example": "tvl_usd"
|
|
4983
|
-
},
|
|
4984
|
-
"description": "The field to order the results by."
|
|
4985
|
-
},
|
|
4986
4975
|
{
|
|
4987
4976
|
"name": "direction",
|
|
4988
4977
|
"in": "query",
|
|
@@ -5040,6 +5029,17 @@
|
|
|
5040
5029
|
},
|
|
5041
5030
|
"description": "Optional chain filter. If not provided, returns vaults for all chains."
|
|
5042
5031
|
},
|
|
5032
|
+
{
|
|
5033
|
+
"name": "order_by",
|
|
5034
|
+
"in": "query",
|
|
5035
|
+
"required": false,
|
|
5036
|
+
"schema": {
|
|
5037
|
+
"type": "string",
|
|
5038
|
+
"title": "Order By",
|
|
5039
|
+
"example": "tvl_usd"
|
|
5040
|
+
},
|
|
5041
|
+
"description": "Field to order the vaults by. One of: tvl_usd, liquidity_usd, deposit_cap_usd, apy_7d, apy_30d, apy_90d. Defaults to tvl_usd; unknown values also fall back to tvl_usd."
|
|
5042
|
+
},
|
|
5043
5043
|
{
|
|
5044
5044
|
"name": "asset_symbol",
|
|
5045
5045
|
"in": "query",
|
|
@@ -5221,17 +5221,6 @@
|
|
|
5221
5221
|
"description": "List Pendle yield trading markets with TVL and implied APY.\n\nReturns Pendle market data including Principal Token (PT), Standardized Yield (SY),\nand Yield Token (YT) addresses, along with market expiry, TVL, and implied APY.\n\nUse this endpoint to discover yield trading opportunities, compare rates across\nPendle markets, or build market selection interfaces.\n\nAPY values are returned in percentage format (e.g., 5.25 means 5.25%). Markets\nwithout complete metadata or statistics are excluded.",
|
|
5222
5222
|
"operationId": "v2_earn_pendle_markets",
|
|
5223
5223
|
"parameters": [
|
|
5224
|
-
{
|
|
5225
|
-
"name": "order_by",
|
|
5226
|
-
"in": "query",
|
|
5227
|
-
"required": true,
|
|
5228
|
-
"schema": {
|
|
5229
|
-
"type": "string",
|
|
5230
|
-
"title": "Order By",
|
|
5231
|
-
"example": "tvl_usd"
|
|
5232
|
-
},
|
|
5233
|
-
"description": "The field to order the results by."
|
|
5234
|
-
},
|
|
5235
5224
|
{
|
|
5236
5225
|
"name": "direction",
|
|
5237
5226
|
"in": "query",
|
|
@@ -5289,6 +5278,17 @@
|
|
|
5289
5278
|
},
|
|
5290
5279
|
"description": "Optional chain filter. If not provided, returns markets for all chains."
|
|
5291
5280
|
},
|
|
5281
|
+
{
|
|
5282
|
+
"name": "order_by",
|
|
5283
|
+
"in": "query",
|
|
5284
|
+
"required": false,
|
|
5285
|
+
"schema": {
|
|
5286
|
+
"type": "string",
|
|
5287
|
+
"title": "Order By",
|
|
5288
|
+
"example": "tvl_usd"
|
|
5289
|
+
},
|
|
5290
|
+
"description": "Field to order the markets by. One of: tvl_usd, implied_apy. Defaults to tvl_usd; unknown values also fall back to tvl_usd."
|
|
5291
|
+
},
|
|
5292
5292
|
{
|
|
5293
5293
|
"name": "underlying_symbol",
|
|
5294
5294
|
"in": "query",
|
|
@@ -17166,6 +17166,17 @@
|
|
|
17166
17166
|
"$ref": "#/components/schemas/LoopedPositionTotals",
|
|
17167
17167
|
"description": "Lifetime totals across the position's history."
|
|
17168
17168
|
},
|
|
17169
|
+
"pnl": {
|
|
17170
|
+
"anyOf": [
|
|
17171
|
+
{
|
|
17172
|
+
"$ref": "#/components/schemas/LoopedPositionPnl"
|
|
17173
|
+
},
|
|
17174
|
+
{
|
|
17175
|
+
"type": "null"
|
|
17176
|
+
}
|
|
17177
|
+
],
|
|
17178
|
+
"description": "Profit or loss since the position opened, for OPEN and CLOSED positions alike. Null when it cannot be stated honestly: the position's recorded history is incomplete (it starts after the opening, or does not add up to what the position holds now), a transaction could not be priced, the position's current value could not be read or separated from another position's, or a transaction's legs cannot be told apart from another position's."
|
|
17179
|
+
},
|
|
17169
17180
|
"history": {
|
|
17170
17181
|
"items": {
|
|
17171
17182
|
"$ref": "#/components/schemas/LoopedPositionHistoryEntry"
|
|
@@ -17446,7 +17457,7 @@
|
|
|
17446
17457
|
"type": "null"
|
|
17447
17458
|
}
|
|
17448
17459
|
],
|
|
17449
|
-
"description": "The swap leg
|
|
17460
|
+
"description": "The swap leg of a loop (debt sold for collateral) or an unwind (collateral sold for debt), when the transaction shows one."
|
|
17450
17461
|
},
|
|
17451
17462
|
"events": {
|
|
17452
17463
|
"items": {
|
|
@@ -17456,6 +17467,34 @@
|
|
|
17456
17467
|
"title": "Events",
|
|
17457
17468
|
"description": "The raw lending events that make up this transaction (Morpho supply_collateral maps to 'supply', withdraw_collateral to 'withdraw').",
|
|
17458
17469
|
"example": []
|
|
17470
|
+
},
|
|
17471
|
+
"equity_flow_quote": {
|
|
17472
|
+
"anyOf": [
|
|
17473
|
+
{
|
|
17474
|
+
"type": "string"
|
|
17475
|
+
},
|
|
17476
|
+
{
|
|
17477
|
+
"type": "null"
|
|
17478
|
+
}
|
|
17479
|
+
],
|
|
17480
|
+
"title": "Equity Flow Quote",
|
|
17481
|
+
"description": "Equity this transaction put into the position (positive) or took out of it (negative), in the debt token, valued when it landed. 0 for a liquidation, whose loss stays in the position's equity. Null when the transaction could not be valued."
|
|
17482
|
+
},
|
|
17483
|
+
"flow_basis": {
|
|
17484
|
+
"anyOf": [
|
|
17485
|
+
{
|
|
17486
|
+
"type": "string",
|
|
17487
|
+
"enum": [
|
|
17488
|
+
"swap",
|
|
17489
|
+
"oracle"
|
|
17490
|
+
]
|
|
17491
|
+
},
|
|
17492
|
+
{
|
|
17493
|
+
"type": "null"
|
|
17494
|
+
}
|
|
17495
|
+
],
|
|
17496
|
+
"title": "Flow Basis",
|
|
17497
|
+
"description": "How equity_flow_quote was measured. 'swap': from this transaction's own swap, so the swap's cost shows up in PnL. 'oracle': from the net amounts at the market price; on a loop or unwind that folds the swap's cost into the flow instead. Null for a liquidation and for a transaction that could not be valued."
|
|
17459
17498
|
}
|
|
17460
17499
|
},
|
|
17461
17500
|
"additionalProperties": false,
|
|
@@ -17471,6 +17510,53 @@
|
|
|
17471
17510
|
"title": "LoopedPositionHistoryEntry",
|
|
17472
17511
|
"description": "One transaction in a looped position's lifetime."
|
|
17473
17512
|
},
|
|
17513
|
+
"LoopedPositionPnl": {
|
|
17514
|
+
"properties": {
|
|
17515
|
+
"total_pnl_quote": {
|
|
17516
|
+
"anyOf": [
|
|
17517
|
+
{
|
|
17518
|
+
"type": "string"
|
|
17519
|
+
},
|
|
17520
|
+
{
|
|
17521
|
+
"type": "null"
|
|
17522
|
+
}
|
|
17523
|
+
],
|
|
17524
|
+
"title": "Total Pnl Quote",
|
|
17525
|
+
"description": "Profit or loss since the position opened, in the position's debt token: what the position is worth now, plus everything taken out, minus everything put in, each valued when it happened. It includes the entry and exit swap costs, the carry (what the collateral earned minus the interest paid) and the collateral's price move against the debt token. Realized once the position is closed, unrealized while it is open. Where a loop or unwind's own swap could not be used (its history entry has flow_basis 'oracle'), that swap's cost is not counted and the figure reads higher by roughly that amount.\n\nMeasured in the debt token, not USD: on a correlated loop (wstHYPE against WHYPE, wstETH against WETH) a positive figure here can still be a USD loss when the debt token itself falls. total_pnl_usd carries that."
|
|
17526
|
+
},
|
|
17527
|
+
"total_pnl_percent": {
|
|
17528
|
+
"anyOf": [
|
|
17529
|
+
{
|
|
17530
|
+
"type": "string"
|
|
17531
|
+
},
|
|
17532
|
+
{
|
|
17533
|
+
"type": "null"
|
|
17534
|
+
}
|
|
17535
|
+
],
|
|
17536
|
+
"title": "Total Pnl Percent",
|
|
17537
|
+
"description": "total_pnl_quote as a percentage of the equity put in (e.g. 4.2 = 4.2%): the return on the capital contributed, not annualized."
|
|
17538
|
+
},
|
|
17539
|
+
"total_pnl_usd": {
|
|
17540
|
+
"anyOf": [
|
|
17541
|
+
{
|
|
17542
|
+
"type": "string"
|
|
17543
|
+
},
|
|
17544
|
+
{
|
|
17545
|
+
"type": "null"
|
|
17546
|
+
}
|
|
17547
|
+
],
|
|
17548
|
+
"title": "Total Pnl Usd",
|
|
17549
|
+
"description": "Profit or loss since the position opened, in USD: each flow at the debt token's USD price when it happened, the position's current value at its price now. Unlike total_pnl_quote it includes the debt token's own USD move. Null when any of those prices is unavailable."
|
|
17550
|
+
}
|
|
17551
|
+
},
|
|
17552
|
+
"additionalProperties": false,
|
|
17553
|
+
"type": "object",
|
|
17554
|
+
"required": [
|
|
17555
|
+
"total_pnl_quote"
|
|
17556
|
+
],
|
|
17557
|
+
"title": "LoopedPositionPnl",
|
|
17558
|
+
"description": "What a looped position has made or lost since it opened.\n\nMeasured in the position's debt token (the quote), with USD alongside.\nEvery transaction is an equity flow valued when it landed: a loop's\nprincipal goes in, an unwind's proceeds come out. PnL is what the position\nis worth now plus everything taken out, minus everything put in; each\nhistory entry carries its own flow in equity_flow_quote."
|
|
17559
|
+
},
|
|
17474
17560
|
"LoopedPositionTotals": {
|
|
17475
17561
|
"properties": {
|
|
17476
17562
|
"total_collateral_added": {
|
|
@@ -17590,7 +17676,20 @@
|
|
|
17590
17676
|
"lltv": {
|
|
17591
17677
|
"type": "string",
|
|
17592
17678
|
"title": "Lltv",
|
|
17593
|
-
"description": "Liquidation Loan-To-Value ratio as a raw uint256 string
|
|
17679
|
+
"description": "Liquidation Loan-To-Value ratio as a raw uint256 string scaled by 1e18 (e.g., '860000000000000000' = 86%). Kept for backward compatibility; prefer `lltv_percent`."
|
|
17680
|
+
},
|
|
17681
|
+
"lltv_percent": {
|
|
17682
|
+
"anyOf": [
|
|
17683
|
+
{
|
|
17684
|
+
"type": "string",
|
|
17685
|
+
"pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
|
|
17686
|
+
},
|
|
17687
|
+
{
|
|
17688
|
+
"type": "null"
|
|
17689
|
+
}
|
|
17690
|
+
],
|
|
17691
|
+
"title": "Lltv Percent",
|
|
17692
|
+
"description": "Liquidation Loan-To-Value in percent (e.g. 86 means a position is liquidatable once debt exceeds 86% of collateral value). Same scale as `lltv` on /v2/credit/morpho_markets."
|
|
17594
17693
|
},
|
|
17595
17694
|
"supply_cap": {
|
|
17596
17695
|
"anyOf": [
|
|
@@ -25144,7 +25243,7 @@
|
|
|
25144
25243
|
"sold_token": {
|
|
25145
25244
|
"type": "string",
|
|
25146
25245
|
"title": "Sold Token",
|
|
25147
|
-
"description": "
|
|
25246
|
+
"description": "The token leaving the account: the debt token on a loop, the collateral token on an unwind."
|
|
25148
25247
|
},
|
|
25149
25248
|
"sold_symbol": {
|
|
25150
25249
|
"type": "string",
|
|
@@ -25159,7 +25258,7 @@
|
|
|
25159
25258
|
"bought_token": {
|
|
25160
25259
|
"type": "string",
|
|
25161
25260
|
"title": "Bought Token",
|
|
25162
|
-
"description": "
|
|
25261
|
+
"description": "The token arriving in the account: the collateral token on a loop, the debt token on an unwind."
|
|
25163
25262
|
},
|
|
25164
25263
|
"bought_symbol": {
|
|
25165
25264
|
"type": "string",
|
|
@@ -25195,7 +25294,7 @@
|
|
|
25195
25294
|
"bought_amount"
|
|
25196
25295
|
],
|
|
25197
25296
|
"title": "SwapInfo",
|
|
25198
|
-
"description": "The
|
|
25297
|
+
"description": "The swap leg detected inside a loop or unwind transaction.\n\nEvidence is token-filtered and executor-proof: the sold token left the\naccount to a non-protocol counterparty and the bought token arrived from a\nnon-protocol counterparty. Aggregator fills often settle from an executor\ncontract, so the router is recorded only when it happens to be the outbound\ncounterparty \u2014 it is never required for detection."
|
|
25199
25298
|
},
|
|
25200
25299
|
"SyPosition": {
|
|
25201
25300
|
"properties": {
|
package/package.json
CHANGED
|
@@ -168,6 +168,7 @@ export * from "./listaavemarketsresponse.js";
|
|
|
168
168
|
export * from "./loopedposition.js";
|
|
169
169
|
export * from "./loopedpositioncurrentstate.js";
|
|
170
170
|
export * from "./loopedpositionhistoryentry.js";
|
|
171
|
+
export * from "./loopedpositionpnl.js";
|
|
171
172
|
export * from "./loopedpositiontotals.js";
|
|
172
173
|
export * from "./looplegpreview.js";
|
|
173
174
|
export * from "./lpbalance.js";
|
|
@@ -20,6 +20,10 @@ import {
|
|
|
20
20
|
LoopedPositionHistoryEntry,
|
|
21
21
|
LoopedPositionHistoryEntry$inboundSchema,
|
|
22
22
|
} from "./loopedpositionhistoryentry.js";
|
|
23
|
+
import {
|
|
24
|
+
LoopedPositionPnl,
|
|
25
|
+
LoopedPositionPnl$inboundSchema,
|
|
26
|
+
} from "./loopedpositionpnl.js";
|
|
23
27
|
import {
|
|
24
28
|
LoopedPositionTotals,
|
|
25
29
|
LoopedPositionTotals$inboundSchema,
|
|
@@ -114,6 +118,10 @@ export type LoopedPosition = {
|
|
|
114
118
|
* Lifetime totals across all of a looped position's transactions.
|
|
115
119
|
*/
|
|
116
120
|
totals: LoopedPositionTotals;
|
|
121
|
+
/**
|
|
122
|
+
* Profit or loss since the position opened, for OPEN and CLOSED positions alike. Null when it cannot be stated honestly: the position's recorded history is incomplete (it starts after the opening, or does not add up to what the position holds now), a transaction could not be priced, the position's current value could not be read or separated from another position's, or a transaction's legs cannot be told apart from another position's.
|
|
123
|
+
*/
|
|
124
|
+
pnl?: LoopedPositionPnl | null | undefined;
|
|
117
125
|
/**
|
|
118
126
|
* All transactions for this position, chronological.
|
|
119
127
|
*/
|
|
@@ -147,6 +155,7 @@ export const LoopedPosition$inboundSchema: z.ZodType<
|
|
|
147
155
|
).optional(),
|
|
148
156
|
current: z.nullable(LoopedPositionCurrentState$inboundSchema).optional(),
|
|
149
157
|
totals: LoopedPositionTotals$inboundSchema,
|
|
158
|
+
pnl: z.nullable(LoopedPositionPnl$inboundSchema).optional(),
|
|
150
159
|
history: z.array(LoopedPositionHistoryEntry$inboundSchema).optional(),
|
|
151
160
|
}).transform((v) => {
|
|
152
161
|
return remap$(v, {
|
|
@@ -30,6 +30,12 @@ export const Classification = {
|
|
|
30
30
|
*/
|
|
31
31
|
export type Classification = ClosedEnum<typeof Classification>;
|
|
32
32
|
|
|
33
|
+
export const FlowBasis = {
|
|
34
|
+
Swap: "swap",
|
|
35
|
+
Oracle: "oracle",
|
|
36
|
+
} as const;
|
|
37
|
+
export type FlowBasis = ClosedEnum<typeof FlowBasis>;
|
|
38
|
+
|
|
33
39
|
/**
|
|
34
40
|
* One transaction in a looped position's lifetime.
|
|
35
41
|
*/
|
|
@@ -63,13 +69,21 @@ export type LoopedPositionHistoryEntry = {
|
|
|
63
69
|
*/
|
|
64
70
|
debtDelta: string;
|
|
65
71
|
/**
|
|
66
|
-
* The swap leg
|
|
72
|
+
* The swap leg of a loop (debt sold for collateral) or an unwind (collateral sold for debt), when the transaction shows one.
|
|
67
73
|
*/
|
|
68
74
|
swap?: SwapInfo | null | undefined;
|
|
69
75
|
/**
|
|
70
76
|
* The raw lending events that make up this transaction (Morpho supply_collateral maps to 'supply', withdraw_collateral to 'withdraw').
|
|
71
77
|
*/
|
|
72
78
|
events?: Array<CreditEvent> | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* Equity this transaction put into the position (positive) or took out of it (negative), in the debt token, valued when it landed. 0 for a liquidation, whose loss stays in the position's equity. Null when the transaction could not be valued.
|
|
81
|
+
*/
|
|
82
|
+
equityFlowQuote?: string | null | undefined;
|
|
83
|
+
/**
|
|
84
|
+
* How equity_flow_quote was measured. 'swap': from this transaction's own swap, so the swap's cost shows up in PnL. 'oracle': from the net amounts at the market price; on a loop or unwind that folds the swap's cost into the flow instead. Null for a liquidation and for a transaction that could not be valued.
|
|
85
|
+
*/
|
|
86
|
+
flowBasis?: FlowBasis | null | undefined;
|
|
73
87
|
};
|
|
74
88
|
|
|
75
89
|
/** @internal */
|
|
@@ -77,6 +91,10 @@ export const Classification$inboundSchema: z.ZodNativeEnum<
|
|
|
77
91
|
typeof Classification
|
|
78
92
|
> = z.nativeEnum(Classification);
|
|
79
93
|
|
|
94
|
+
/** @internal */
|
|
95
|
+
export const FlowBasis$inboundSchema: z.ZodNativeEnum<typeof FlowBasis> = z
|
|
96
|
+
.nativeEnum(FlowBasis);
|
|
97
|
+
|
|
80
98
|
/** @internal */
|
|
81
99
|
export const LoopedPositionHistoryEntry$inboundSchema: z.ZodType<
|
|
82
100
|
LoopedPositionHistoryEntry,
|
|
@@ -94,6 +112,8 @@ export const LoopedPositionHistoryEntry$inboundSchema: z.ZodType<
|
|
|
94
112
|
debt_delta: z.string(),
|
|
95
113
|
swap: z.nullable(SwapInfo$inboundSchema).optional(),
|
|
96
114
|
events: z.array(CreditEvent$inboundSchema).optional(),
|
|
115
|
+
equity_flow_quote: z.nullable(z.string()).optional(),
|
|
116
|
+
flow_basis: z.nullable(FlowBasis$inboundSchema).optional(),
|
|
97
117
|
}).transform((v) => {
|
|
98
118
|
return remap$(v, {
|
|
99
119
|
"transaction_hash": "transactionHash",
|
|
@@ -101,6 +121,8 @@ export const LoopedPositionHistoryEntry$inboundSchema: z.ZodType<
|
|
|
101
121
|
"block_timestamp": "blockTimestamp",
|
|
102
122
|
"collateral_delta": "collateralDelta",
|
|
103
123
|
"debt_delta": "debtDelta",
|
|
124
|
+
"equity_flow_quote": "equityFlowQuote",
|
|
125
|
+
"flow_basis": "flowBasis",
|
|
104
126
|
});
|
|
105
127
|
});
|
|
106
128
|
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* What a looped position has made or lost since it opened.
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
*
|
|
16
|
+
* Measured in the position's debt token (the quote), with USD alongside.
|
|
17
|
+
* Every transaction is an equity flow valued when it landed: a loop's
|
|
18
|
+
* principal goes in, an unwind's proceeds come out. PnL is what the position
|
|
19
|
+
* is worth now plus everything taken out, minus everything put in; each
|
|
20
|
+
* history entry carries its own flow in equity_flow_quote.
|
|
21
|
+
*/
|
|
22
|
+
export type LoopedPositionPnl = {
|
|
23
|
+
/**
|
|
24
|
+
* Profit or loss since the position opened, in the position's debt token: what the position is worth now, plus everything taken out, minus everything put in, each valued when it happened. It includes the entry and exit swap costs, the carry (what the collateral earned minus the interest paid) and the collateral's price move against the debt token. Realized once the position is closed, unrealized while it is open. Where a loop or unwind's own swap could not be used (its history entry has flow_basis 'oracle'), that swap's cost is not counted and the figure reads higher by roughly that amount.
|
|
25
|
+
*
|
|
26
|
+
* @remarks
|
|
27
|
+
*
|
|
28
|
+
* Measured in the debt token, not USD: on a correlated loop (wstHYPE against WHYPE, wstETH against WETH) a positive figure here can still be a USD loss when the debt token itself falls. total_pnl_usd carries that.
|
|
29
|
+
*/
|
|
30
|
+
totalPnlQuote: string | null;
|
|
31
|
+
/**
|
|
32
|
+
* total_pnl_quote as a percentage of the equity put in (e.g. 4.2 = 4.2%): the return on the capital contributed, not annualized.
|
|
33
|
+
*/
|
|
34
|
+
totalPnlPercent?: string | null | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* Profit or loss since the position opened, in USD: each flow at the debt token's USD price when it happened, the position's current value at its price now. Unlike total_pnl_quote it includes the debt token's own USD move. Null when any of those prices is unavailable.
|
|
37
|
+
*/
|
|
38
|
+
totalPnlUsd?: string | null | undefined;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/** @internal */
|
|
42
|
+
export const LoopedPositionPnl$inboundSchema: z.ZodType<
|
|
43
|
+
LoopedPositionPnl,
|
|
44
|
+
z.ZodTypeDef,
|
|
45
|
+
unknown
|
|
46
|
+
> = z.object({
|
|
47
|
+
total_pnl_quote: z.nullable(z.string()),
|
|
48
|
+
total_pnl_percent: z.nullable(z.string()).optional(),
|
|
49
|
+
total_pnl_usd: z.nullable(z.string()).optional(),
|
|
50
|
+
}).transform((v) => {
|
|
51
|
+
return remap$(v, {
|
|
52
|
+
"total_pnl_quote": "totalPnlQuote",
|
|
53
|
+
"total_pnl_percent": "totalPnlPercent",
|
|
54
|
+
"total_pnl_usd": "totalPnlUsd",
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
export function loopedPositionPnlFromJSON(
|
|
59
|
+
jsonString: string,
|
|
60
|
+
): SafeParseResult<LoopedPositionPnl, SDKValidationError> {
|
|
61
|
+
return safeParse(
|
|
62
|
+
jsonString,
|
|
63
|
+
(x) => LoopedPositionPnl$inboundSchema.parse(JSON.parse(x)),
|
|
64
|
+
`Failed to parse 'LoopedPositionPnl' from JSON`,
|
|
65
|
+
);
|
|
66
|
+
}
|
|
@@ -33,9 +33,13 @@ export type MarketAllocation = {
|
|
|
33
33
|
*/
|
|
34
34
|
collateralTokenSymbol?: string | null | undefined;
|
|
35
35
|
/**
|
|
36
|
-
* Liquidation Loan-To-Value ratio as a raw uint256 string
|
|
36
|
+
* Liquidation Loan-To-Value ratio as a raw uint256 string scaled by 1e18 (e.g., '860000000000000000' = 86%). Kept for backward compatibility; prefer `lltv_percent`.
|
|
37
37
|
*/
|
|
38
38
|
lltv: string;
|
|
39
|
+
/**
|
|
40
|
+
* Liquidation Loan-To-Value in percent (e.g. 86 means a position is liquidatable once debt exceeds 86% of collateral value). Same scale as `lltv` on /v2/credit/morpho_markets.
|
|
41
|
+
*/
|
|
42
|
+
lltvPercent?: string | null | undefined;
|
|
39
43
|
/**
|
|
40
44
|
* Maximum amount the vault is allowed to supply to this market, as a raw uint184 string in the smallest token unit.
|
|
41
45
|
*/
|
|
@@ -62,6 +66,7 @@ export const MarketAllocation$inboundSchema: z.ZodType<
|
|
|
62
66
|
collateral_token: z.string(),
|
|
63
67
|
collateral_token_symbol: z.nullable(z.string()).optional(),
|
|
64
68
|
lltv: z.string(),
|
|
69
|
+
lltv_percent: z.nullable(z.string()).optional(),
|
|
65
70
|
supply_cap: z.nullable(z.string()).optional(),
|
|
66
71
|
supply_assets: z.nullable(z.string()).optional(),
|
|
67
72
|
allocation_pct: z.nullable(z.number()).optional(),
|
|
@@ -72,6 +77,7 @@ export const MarketAllocation$inboundSchema: z.ZodType<
|
|
|
72
77
|
"loan_token_symbol": "loanTokenSymbol",
|
|
73
78
|
"collateral_token": "collateralToken",
|
|
74
79
|
"collateral_token_symbol": "collateralTokenSymbol",
|
|
80
|
+
"lltv_percent": "lltvPercent",
|
|
75
81
|
"supply_cap": "supplyCap",
|
|
76
82
|
"supply_assets": "supplyAssets",
|
|
77
83
|
"allocation_pct": "allocationPct",
|
|
@@ -9,19 +9,19 @@ import { Result as SafeParseResult } from "../../types/fp.js";
|
|
|
9
9
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
* The
|
|
12
|
+
* The swap leg detected inside a loop or unwind transaction.
|
|
13
13
|
*
|
|
14
14
|
* @remarks
|
|
15
15
|
*
|
|
16
|
-
* Evidence is token-filtered and executor-proof: the sold
|
|
17
|
-
* account to a non-protocol counterparty and the bought
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
16
|
+
* Evidence is token-filtered and executor-proof: the sold token left the
|
|
17
|
+
* account to a non-protocol counterparty and the bought token arrived from a
|
|
18
|
+
* non-protocol counterparty. Aggregator fills often settle from an executor
|
|
19
|
+
* contract, so the router is recorded only when it happens to be the outbound
|
|
20
|
+
* counterparty — it is never required for detection.
|
|
21
21
|
*/
|
|
22
22
|
export type SwapInfo = {
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
24
|
+
* The token leaving the account: the debt token on a loop, the collateral token on an unwind.
|
|
25
25
|
*/
|
|
26
26
|
soldToken: string;
|
|
27
27
|
/**
|
|
@@ -33,7 +33,7 @@ export type SwapInfo = {
|
|
|
33
33
|
*/
|
|
34
34
|
soldAmount: string;
|
|
35
35
|
/**
|
|
36
|
-
*
|
|
36
|
+
* The token arriving in the account: the collateral token on a loop, the debt token on an unwind.
|
|
37
37
|
*/
|
|
38
38
|
boughtToken: string;
|
|
39
39
|
/**
|
|
@@ -27,10 +27,6 @@ export type V2EarnPendleMarketsDirection = ClosedEnum<
|
|
|
27
27
|
export type V2EarnPendleMarketsMinTvlUsd = number | string;
|
|
28
28
|
|
|
29
29
|
export type V2EarnPendleMarketsRequest = {
|
|
30
|
-
/**
|
|
31
|
-
* The field to order the results by.
|
|
32
|
-
*/
|
|
33
|
-
orderBy: string;
|
|
34
30
|
/**
|
|
35
31
|
* The direction to order the results by.
|
|
36
32
|
*/
|
|
@@ -47,6 +43,10 @@ export type V2EarnPendleMarketsRequest = {
|
|
|
47
43
|
* Optional chain filter. If not provided, returns markets for all chains.
|
|
48
44
|
*/
|
|
49
45
|
chain?: components.Chain | null | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Field to order the markets by. One of: tvl_usd, implied_apy. Defaults to tvl_usd; unknown values also fall back to tvl_usd.
|
|
48
|
+
*/
|
|
49
|
+
orderBy?: string | undefined;
|
|
50
50
|
/**
|
|
51
51
|
* Filter markets by underlying asset symbol (e.g., 'USDC', 'WETH').
|
|
52
52
|
*/
|
|
@@ -84,11 +84,11 @@ export function v2EarnPendleMarketsMinTvlUsdToJSON(
|
|
|
84
84
|
|
|
85
85
|
/** @internal */
|
|
86
86
|
export type V2EarnPendleMarketsRequest$Outbound = {
|
|
87
|
-
order_by: string;
|
|
88
87
|
direction?: string | undefined;
|
|
89
88
|
offset?: number | undefined;
|
|
90
89
|
limit?: number | undefined;
|
|
91
90
|
chain?: string | null | undefined;
|
|
91
|
+
order_by?: string | undefined;
|
|
92
92
|
underlying_symbol?: string | null | undefined;
|
|
93
93
|
min_tvl_usd?: number | string | null | undefined;
|
|
94
94
|
};
|
|
@@ -99,11 +99,11 @@ export const V2EarnPendleMarketsRequest$outboundSchema: z.ZodType<
|
|
|
99
99
|
z.ZodTypeDef,
|
|
100
100
|
V2EarnPendleMarketsRequest
|
|
101
101
|
> = z.object({
|
|
102
|
-
orderBy: z.string(),
|
|
103
102
|
direction: V2EarnPendleMarketsDirection$outboundSchema.optional(),
|
|
104
103
|
offset: z.number().int().optional(),
|
|
105
104
|
limit: z.number().int().optional(),
|
|
106
105
|
chain: z.nullable(components.Chain$outboundSchema).optional(),
|
|
106
|
+
orderBy: z.string().optional(),
|
|
107
107
|
underlyingSymbol: z.nullable(z.string()).optional(),
|
|
108
108
|
minTvlUsd: z.nullable(z.union([z.number(), z.string()])).optional(),
|
|
109
109
|
}).transform((v) => {
|
|
@@ -35,10 +35,6 @@ export type MinLiquidityUsd = number | string;
|
|
|
35
35
|
export type MinDepositCapUsd = number | string;
|
|
36
36
|
|
|
37
37
|
export type V2EarnVaultsRequest = {
|
|
38
|
-
/**
|
|
39
|
-
* The field to order the results by.
|
|
40
|
-
*/
|
|
41
|
-
orderBy: string;
|
|
42
38
|
/**
|
|
43
39
|
* The direction to order the results by.
|
|
44
40
|
*/
|
|
@@ -55,6 +51,10 @@ export type V2EarnVaultsRequest = {
|
|
|
55
51
|
* Optional chain filter. If not provided, returns vaults for all chains.
|
|
56
52
|
*/
|
|
57
53
|
chain?: components.Chain | null | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* Field to order the vaults by. One of: tvl_usd, liquidity_usd, deposit_cap_usd, apy_7d, apy_30d, apy_90d. Defaults to tvl_usd; unknown values also fall back to tvl_usd.
|
|
56
|
+
*/
|
|
57
|
+
orderBy?: string | undefined;
|
|
58
58
|
/**
|
|
59
59
|
* Filter vaults by underlying asset symbol (e.g., 'USDC', 'WETH').
|
|
60
60
|
*/
|
|
@@ -132,11 +132,11 @@ export function minDepositCapUsdToJSON(
|
|
|
132
132
|
|
|
133
133
|
/** @internal */
|
|
134
134
|
export type V2EarnVaultsRequest$Outbound = {
|
|
135
|
-
order_by: string;
|
|
136
135
|
direction?: string | undefined;
|
|
137
136
|
offset?: number | undefined;
|
|
138
137
|
limit?: number | undefined;
|
|
139
138
|
chain?: string | null | undefined;
|
|
139
|
+
order_by?: string | undefined;
|
|
140
140
|
asset_symbol?: string | null | undefined;
|
|
141
141
|
min_tvl_usd?: number | string | null | undefined;
|
|
142
142
|
min_liquidity_usd?: number | string | null | undefined;
|
|
@@ -149,11 +149,11 @@ export const V2EarnVaultsRequest$outboundSchema: z.ZodType<
|
|
|
149
149
|
z.ZodTypeDef,
|
|
150
150
|
V2EarnVaultsRequest
|
|
151
151
|
> = z.object({
|
|
152
|
-
orderBy: z.string(),
|
|
153
152
|
direction: V2EarnVaultsDirection$outboundSchema.optional(),
|
|
154
153
|
offset: z.number().int().optional(),
|
|
155
154
|
limit: z.number().int().optional(),
|
|
156
155
|
chain: z.nullable(components.Chain$outboundSchema).optional(),
|
|
156
|
+
orderBy: z.string().optional(),
|
|
157
157
|
assetSymbol: z.nullable(z.string()).optional(),
|
|
158
158
|
minTvlUsd: z.nullable(z.union([z.number(), z.string()])).optional(),
|
|
159
159
|
minLiquidityUsd: z.nullable(z.union([z.number(), z.string()])).optional(),
|