@compass-labs/api-sdk 2.2.101 → 2.2.103
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/commonjs/funcs/creditCreditBorrow.d.ts +1 -1
- package/dist/commonjs/funcs/creditCreditBorrow.js +1 -1
- package/dist/commonjs/funcs/creditCreditLoop.d.ts +8 -22
- package/dist/commonjs/funcs/creditCreditLoop.d.ts.map +1 -1
- package/dist/commonjs/funcs/creditCreditLoop.js +8 -22
- package/dist/commonjs/funcs/creditCreditLoop.js.map +1 -1
- package/dist/commonjs/funcs/creditCreditLoopedPositions.d.ts +8 -7
- package/dist/commonjs/funcs/creditCreditLoopedPositions.d.ts.map +1 -1
- package/dist/commonjs/funcs/creditCreditLoopedPositions.js +8 -7
- package/dist/commonjs/funcs/creditCreditLoopedPositions.js.map +1 -1
- package/dist/commonjs/funcs/creditCreditRebalance.d.ts +11 -34
- package/dist/commonjs/funcs/creditCreditRebalance.d.ts.map +1 -1
- package/dist/commonjs/funcs/creditCreditRebalance.js +11 -34
- package/dist/commonjs/funcs/creditCreditRebalance.js.map +1 -1
- package/dist/commonjs/funcs/creditCreditRepay.d.ts +1 -1
- package/dist/commonjs/funcs/creditCreditRepay.js +1 -1
- package/dist/commonjs/funcs/creditCreditUnloop.d.ts +7 -38
- package/dist/commonjs/funcs/creditCreditUnloop.d.ts.map +1 -1
- package/dist/commonjs/funcs/creditCreditUnloop.js +7 -38
- package/dist/commonjs/funcs/creditCreditUnloop.js.map +1 -1
- package/dist/commonjs/lib/config.d.ts +2 -2
- package/dist/commonjs/lib/config.js +2 -2
- package/dist/commonjs/models/components/accountsummary.d.ts +18 -5
- package/dist/commonjs/models/components/accountsummary.d.ts.map +1 -1
- package/dist/commonjs/models/components/accountsummary.js.map +1 -1
- package/dist/commonjs/models/components/collateralposition.d.ts +18 -5
- package/dist/commonjs/models/components/collateralposition.d.ts.map +1 -1
- package/dist/commonjs/models/components/collateralposition.js.map +1 -1
- package/dist/commonjs/models/components/creditborrowparams.d.ts +18 -5
- package/dist/commonjs/models/components/creditborrowparams.d.ts.map +1 -1
- package/dist/commonjs/models/components/creditborrowparams.js.map +1 -1
- package/dist/commonjs/models/components/creditborrowrequest.d.ts +18 -5
- package/dist/commonjs/models/components/creditborrowrequest.d.ts.map +1 -1
- package/dist/commonjs/models/components/creditborrowrequest.js.map +1 -1
- package/dist/commonjs/models/components/creditenablecollateralparams.d.ts +18 -5
- package/dist/commonjs/models/components/creditenablecollateralparams.d.ts.map +1 -1
- package/dist/commonjs/models/components/creditenablecollateralparams.js.map +1 -1
- package/dist/commonjs/models/components/creditlooprequest.d.ts +27 -14
- package/dist/commonjs/models/components/creditlooprequest.d.ts.map +1 -1
- package/dist/commonjs/models/components/creditlooprequest.js +1 -1
- package/dist/commonjs/models/components/creditlooprequest.js.map +1 -1
- package/dist/commonjs/models/components/creditloopresponse.d.ts +7 -7
- package/dist/commonjs/models/components/creditloopresponse.js +3 -3
- package/dist/commonjs/models/components/creditloopresponse.js.map +1 -1
- package/dist/commonjs/models/components/creditprotocol.d.ts +36 -10
- package/dist/commonjs/models/components/creditprotocol.d.ts.map +1 -1
- package/dist/commonjs/models/components/creditprotocol.js +18 -5
- package/dist/commonjs/models/components/creditprotocol.js.map +1 -1
- package/dist/commonjs/models/components/creditrepayparams.d.ts +18 -5
- package/dist/commonjs/models/components/creditrepayparams.d.ts.map +1 -1
- package/dist/commonjs/models/components/creditrepayparams.js.map +1 -1
- package/dist/commonjs/models/components/creditrepayrequest.d.ts +18 -5
- package/dist/commonjs/models/components/creditrepayrequest.d.ts.map +1 -1
- package/dist/commonjs/models/components/creditrepayrequest.js.map +1 -1
- package/dist/commonjs/models/components/creditsupplyparams.d.ts +18 -5
- package/dist/commonjs/models/components/creditsupplyparams.d.ts.map +1 -1
- package/dist/commonjs/models/components/creditsupplyparams.js.map +1 -1
- package/dist/commonjs/models/components/creditunlooprequest.d.ts +23 -10
- package/dist/commonjs/models/components/creditunlooprequest.d.ts.map +1 -1
- package/dist/commonjs/models/components/creditunlooprequest.js +1 -1
- package/dist/commonjs/models/components/creditunlooprequest.js.map +1 -1
- package/dist/commonjs/models/components/creditunloopresponse.d.ts +7 -7
- package/dist/commonjs/models/components/creditunloopresponse.js +3 -3
- package/dist/commonjs/models/components/creditunloopresponse.js.map +1 -1
- package/dist/commonjs/models/components/creditwithdrawparams.d.ts +18 -5
- package/dist/commonjs/models/components/creditwithdrawparams.d.ts.map +1 -1
- package/dist/commonjs/models/components/creditwithdrawparams.js.map +1 -1
- package/dist/commonjs/models/components/debtposition.d.ts +18 -5
- package/dist/commonjs/models/components/debtposition.d.ts.map +1 -1
- package/dist/commonjs/models/components/debtposition.js.map +1 -1
- package/dist/commonjs/models/components/loopedposition.d.ts +18 -5
- package/dist/commonjs/models/components/loopedposition.d.ts.map +1 -1
- package/dist/commonjs/models/components/loopedposition.js.map +1 -1
- package/dist/commonjs/models/components/rebalancetarget.d.ts +18 -5
- package/dist/commonjs/models/components/rebalancetarget.d.ts.map +1 -1
- package/dist/commonjs/models/components/rebalancetarget.js.map +1 -1
- package/dist/commonjs/models/components/rebalancetargetpreview.d.ts +18 -5
- package/dist/commonjs/models/components/rebalancetargetpreview.d.ts.map +1 -1
- package/dist/commonjs/models/components/rebalancetargetpreview.js.map +1 -1
- package/dist/commonjs/models/components/swapinfo.d.ts +2 -2
- package/dist/commonjs/sdk/credit.d.ts +44 -111
- package/dist/commonjs/sdk/credit.d.ts.map +1 -1
- package/dist/commonjs/sdk/credit.js +44 -111
- package/dist/commonjs/sdk/credit.js.map +1 -1
- package/dist/esm/funcs/creditCreditBorrow.d.ts +1 -1
- package/dist/esm/funcs/creditCreditBorrow.js +1 -1
- package/dist/esm/funcs/creditCreditLoop.d.ts +8 -22
- package/dist/esm/funcs/creditCreditLoop.d.ts.map +1 -1
- package/dist/esm/funcs/creditCreditLoop.js +8 -22
- package/dist/esm/funcs/creditCreditLoop.js.map +1 -1
- package/dist/esm/funcs/creditCreditLoopedPositions.d.ts +8 -7
- package/dist/esm/funcs/creditCreditLoopedPositions.d.ts.map +1 -1
- package/dist/esm/funcs/creditCreditLoopedPositions.js +8 -7
- package/dist/esm/funcs/creditCreditLoopedPositions.js.map +1 -1
- package/dist/esm/funcs/creditCreditRebalance.d.ts +11 -34
- package/dist/esm/funcs/creditCreditRebalance.d.ts.map +1 -1
- package/dist/esm/funcs/creditCreditRebalance.js +11 -34
- package/dist/esm/funcs/creditCreditRebalance.js.map +1 -1
- package/dist/esm/funcs/creditCreditRepay.d.ts +1 -1
- package/dist/esm/funcs/creditCreditRepay.js +1 -1
- package/dist/esm/funcs/creditCreditUnloop.d.ts +7 -38
- package/dist/esm/funcs/creditCreditUnloop.d.ts.map +1 -1
- package/dist/esm/funcs/creditCreditUnloop.js +7 -38
- package/dist/esm/funcs/creditCreditUnloop.js.map +1 -1
- package/dist/esm/lib/config.d.ts +2 -2
- package/dist/esm/lib/config.js +2 -2
- package/dist/esm/models/components/accountsummary.d.ts +18 -5
- package/dist/esm/models/components/accountsummary.d.ts.map +1 -1
- package/dist/esm/models/components/accountsummary.js.map +1 -1
- package/dist/esm/models/components/collateralposition.d.ts +18 -5
- package/dist/esm/models/components/collateralposition.d.ts.map +1 -1
- package/dist/esm/models/components/collateralposition.js.map +1 -1
- package/dist/esm/models/components/creditborrowparams.d.ts +18 -5
- package/dist/esm/models/components/creditborrowparams.d.ts.map +1 -1
- package/dist/esm/models/components/creditborrowparams.js.map +1 -1
- package/dist/esm/models/components/creditborrowrequest.d.ts +18 -5
- package/dist/esm/models/components/creditborrowrequest.d.ts.map +1 -1
- package/dist/esm/models/components/creditborrowrequest.js.map +1 -1
- package/dist/esm/models/components/creditenablecollateralparams.d.ts +18 -5
- package/dist/esm/models/components/creditenablecollateralparams.d.ts.map +1 -1
- package/dist/esm/models/components/creditenablecollateralparams.js.map +1 -1
- package/dist/esm/models/components/creditlooprequest.d.ts +27 -14
- package/dist/esm/models/components/creditlooprequest.d.ts.map +1 -1
- package/dist/esm/models/components/creditlooprequest.js +1 -1
- package/dist/esm/models/components/creditlooprequest.js.map +1 -1
- package/dist/esm/models/components/creditloopresponse.d.ts +7 -7
- package/dist/esm/models/components/creditloopresponse.js +3 -3
- package/dist/esm/models/components/creditloopresponse.js.map +1 -1
- package/dist/esm/models/components/creditprotocol.d.ts +36 -10
- package/dist/esm/models/components/creditprotocol.d.ts.map +1 -1
- package/dist/esm/models/components/creditprotocol.js +18 -5
- package/dist/esm/models/components/creditprotocol.js.map +1 -1
- package/dist/esm/models/components/creditrepayparams.d.ts +18 -5
- package/dist/esm/models/components/creditrepayparams.d.ts.map +1 -1
- package/dist/esm/models/components/creditrepayparams.js.map +1 -1
- package/dist/esm/models/components/creditrepayrequest.d.ts +18 -5
- package/dist/esm/models/components/creditrepayrequest.d.ts.map +1 -1
- package/dist/esm/models/components/creditrepayrequest.js.map +1 -1
- package/dist/esm/models/components/creditsupplyparams.d.ts +18 -5
- package/dist/esm/models/components/creditsupplyparams.d.ts.map +1 -1
- package/dist/esm/models/components/creditsupplyparams.js.map +1 -1
- package/dist/esm/models/components/creditunlooprequest.d.ts +23 -10
- package/dist/esm/models/components/creditunlooprequest.d.ts.map +1 -1
- package/dist/esm/models/components/creditunlooprequest.js +1 -1
- package/dist/esm/models/components/creditunlooprequest.js.map +1 -1
- package/dist/esm/models/components/creditunloopresponse.d.ts +7 -7
- package/dist/esm/models/components/creditunloopresponse.js +3 -3
- package/dist/esm/models/components/creditunloopresponse.js.map +1 -1
- package/dist/esm/models/components/creditwithdrawparams.d.ts +18 -5
- package/dist/esm/models/components/creditwithdrawparams.d.ts.map +1 -1
- package/dist/esm/models/components/creditwithdrawparams.js.map +1 -1
- package/dist/esm/models/components/debtposition.d.ts +18 -5
- package/dist/esm/models/components/debtposition.d.ts.map +1 -1
- package/dist/esm/models/components/debtposition.js.map +1 -1
- package/dist/esm/models/components/loopedposition.d.ts +18 -5
- package/dist/esm/models/components/loopedposition.d.ts.map +1 -1
- package/dist/esm/models/components/loopedposition.js.map +1 -1
- package/dist/esm/models/components/rebalancetarget.d.ts +18 -5
- package/dist/esm/models/components/rebalancetarget.d.ts.map +1 -1
- package/dist/esm/models/components/rebalancetarget.js.map +1 -1
- package/dist/esm/models/components/rebalancetargetpreview.d.ts +18 -5
- package/dist/esm/models/components/rebalancetargetpreview.d.ts.map +1 -1
- package/dist/esm/models/components/rebalancetargetpreview.js.map +1 -1
- package/dist/esm/models/components/swapinfo.d.ts +2 -2
- package/dist/esm/sdk/credit.d.ts +44 -111
- package/dist/esm/sdk/credit.d.ts.map +1 -1
- package/dist/esm/sdk/credit.js +44 -111
- package/dist/esm/sdk/credit.js.map +1 -1
- package/docs/models/components/accountsummary.md +11 -11
- package/docs/models/components/collateralposition.md +17 -17
- package/docs/models/components/creditborrowparams.md +11 -11
- package/docs/models/components/creditborrowrequest.md +21 -21
- package/docs/models/components/creditenablecollateralparams.md +7 -7
- package/docs/models/components/creditlooprequest.md +19 -19
- package/docs/models/components/creditlooprequestchain.md +1 -1
- package/docs/models/components/creditlooprequestinitialcollateralamount.md +1 -1
- package/docs/models/components/creditlooprequestloantovalue.md +1 -1
- package/docs/models/components/creditloopresponse.md +9 -9
- package/docs/models/components/creditloopresponseswapprovider.md +3 -3
- package/docs/models/components/creditprotocol.md +18 -5
- package/docs/models/components/creditrepayparams.md +10 -10
- package/docs/models/components/creditrepayrequest.md +20 -20
- package/docs/models/components/creditsupplyparams.md +9 -9
- package/docs/models/components/creditunlooprequest.md +17 -17
- package/docs/models/components/creditunlooprequestchain.md +1 -1
- package/docs/models/components/creditunloopresponse.md +9 -9
- package/docs/models/components/creditunloopresponseswapprovider.md +3 -3
- package/docs/models/components/creditwithdrawparams.md +9 -9
- package/docs/models/components/debtposition.md +16 -16
- package/docs/models/components/loopedposition.md +14 -14
- package/docs/models/components/rebalancetarget.md +10 -10
- package/docs/models/components/rebalancetargetpreview.md +16 -16
- package/docs/models/components/swapinfo.md +10 -10
- package/docs/sdks/credit/README.md +40 -107
- package/openapi_prepped_for_speakeasy.json +32 -32
- package/package.json +1 -1
- package/src/funcs/creditCreditBorrow.ts +1 -1
- package/src/funcs/creditCreditLoop.ts +8 -22
- package/src/funcs/creditCreditLoopedPositions.ts +8 -7
- package/src/funcs/creditCreditRebalance.ts +11 -34
- package/src/funcs/creditCreditRepay.ts +1 -1
- package/src/funcs/creditCreditUnloop.ts +7 -38
- package/src/lib/config.ts +2 -2
- package/src/models/components/accountsummary.ts +18 -5
- package/src/models/components/collateralposition.ts +18 -5
- package/src/models/components/creditborrowparams.ts +18 -5
- package/src/models/components/creditborrowrequest.ts +18 -5
- package/src/models/components/creditenablecollateralparams.ts +18 -5
- package/src/models/components/creditlooprequest.ts +27 -14
- package/src/models/components/creditloopresponse.ts +7 -7
- package/src/models/components/creditprotocol.ts +36 -10
- package/src/models/components/creditrepayparams.ts +18 -5
- package/src/models/components/creditrepayrequest.ts +18 -5
- package/src/models/components/creditsupplyparams.ts +18 -5
- package/src/models/components/creditunlooprequest.ts +23 -10
- package/src/models/components/creditunloopresponse.ts +7 -7
- package/src/models/components/creditwithdrawparams.ts +18 -5
- package/src/models/components/debtposition.ts +18 -5
- package/src/models/components/loopedposition.ts +18 -5
- package/src/models/components/rebalancetarget.ts +18 -5
- package/src/models/components/rebalancetargetpreview.ts +18 -5
- package/src/models/components/swapinfo.ts +2 -2
- package/src/sdk/credit.ts +44 -111
|
@@ -6020,7 +6020,7 @@
|
|
|
6020
6020
|
"Credit"
|
|
6021
6021
|
],
|
|
6022
6022
|
"summary": "List looped (leveraged) credit positions",
|
|
6023
|
-
"description": "List
|
|
6023
|
+
"description": "List the leveraged positions held by an owner's Credit Account.\n\nPositions are reconstructed from on-chain history rather than from API calls,\nso a loop assembled by hand through /v2/credit/bundle is recognised the same\nway as one opened through /v2/credit/loop. Only activity inside the Credit\nAccount is visible \u2014 leverage the owner holds directly in their wallet is not.\n\nSee the [Leveraged Looping guide](https://docs.compasslabs.ai/v2/Products/Looping)\nfor protocol coverage and how to read leverage, health factor and net APY.",
|
|
6024
6024
|
"operationId": "v2_credit_looped_positions",
|
|
6025
6025
|
"parameters": [
|
|
6026
6026
|
{
|
|
@@ -6289,7 +6289,7 @@
|
|
|
6289
6289
|
"Credit"
|
|
6290
6290
|
],
|
|
6291
6291
|
"summary": "Borrow against collateral",
|
|
6292
|
-
"description": "Borrow an asset from Aave using a Credit Account.\n\nBundles an optional swap, collateral supply, and borrow into a single atomic Safe transaction.\n\n- If `token_in` equals `collateral_token`, the tokens are supplied directly as collateral.\n- If `token_in` differs from `collateral_token`, a swap is performed first
|
|
6292
|
+
"description": "Borrow an asset from Aave using a Credit Account.\n\nBundles an optional swap, collateral supply, and borrow into a single atomic Safe transaction.\n\n- If `token_in` equals `collateral_token`, the tokens are supplied directly as collateral.\n- If `token_in` differs from `collateral_token`, a market swap is performed first.\n\nThe Credit Account must already be created via `/v2/credit/create_account` and funded with `token_in`.",
|
|
6293
6293
|
"operationId": "v2_credit_borrow",
|
|
6294
6294
|
"requestBody": {
|
|
6295
6295
|
"content": {
|
|
@@ -6332,7 +6332,7 @@
|
|
|
6332
6332
|
"Credit"
|
|
6333
6333
|
],
|
|
6334
6334
|
"summary": "Open a leveraged loop",
|
|
6335
|
-
"description": "Open a leveraged
|
|
6335
|
+
"description": "Open a leveraged position in ONE atomic transaction.\n\nSupply collateral, borrow against it, swap the borrowed token back to\ncollateral, repeat \u2014 until total collateral reaches multiplier x\ninitial_collateral_amount. If any step fails the whole transaction reverts,\nso a position is never left half-built.\n\nSee the [Leveraged Looping guide](https://docs.compasslabs.ai/v2/Products/Looping)\nfor chain coverage, market discovery, vault-share collateral, HyperEVM\nspecifics and the full error list.",
|
|
6336
6336
|
"operationId": "v2_credit_loop",
|
|
6337
6337
|
"requestBody": {
|
|
6338
6338
|
"content": {
|
|
@@ -6375,7 +6375,7 @@
|
|
|
6375
6375
|
"Credit"
|
|
6376
6376
|
],
|
|
6377
6377
|
"summary": "Unwind a leveraged loop",
|
|
6378
|
-
"description": "Unwind
|
|
6378
|
+
"description": "Unwind a leveraged position in ONE atomic transaction.\n\nWithdraw collateral, swap it back to the borrow token, repay, repeat \u2014 until\nthe position reaches target_multiplier, or until the debt is cleared exactly\nif you omit it. If any step fails the whole transaction reverts.\n\nSee the [Leveraged Looping guide](https://docs.compasslabs.ai/v2/Products/Looping)\nfor chain coverage, vault-share collateral, shared Aave reserves and the full\nerror list.",
|
|
6379
6379
|
"operationId": "v2_credit_unloop",
|
|
6380
6380
|
"requestBody": {
|
|
6381
6381
|
"content": {
|
|
@@ -6418,7 +6418,7 @@
|
|
|
6418
6418
|
"Credit"
|
|
6419
6419
|
],
|
|
6420
6420
|
"summary": "Rebalance the leveraged credit book",
|
|
6421
|
-
"description": "
|
|
6421
|
+
"description": "Move one or more leveraged positions to the state you want, in ONE atomic\ntransaction.\n\nList the positions to change and the end state you want for each. The API\nworks out whether that means opening, growing, shrinking, delevering or\nclosing, and does them all together.\n\nMoney freed by shrinking or closing one position pays for growing or opening\nanother, so shifting funds between positions needs no new deposit. Any\nshortfall is taken from the Credit Account's idle balance, and the call\nreturns 422 if that does not cover it either.\n\nSee the [Leveraged Looping guide](https://docs.compasslabs.ai/v2/Products/Looping)\nfor protocol and chain coverage, capital routing and the full error list.",
|
|
6422
6422
|
"operationId": "v2_credit_rebalance",
|
|
6423
6423
|
"requestBody": {
|
|
6424
6424
|
"content": {
|
|
@@ -6504,7 +6504,7 @@
|
|
|
6504
6504
|
"Credit"
|
|
6505
6505
|
],
|
|
6506
6506
|
"summary": "Repay debt and withdraw collateral",
|
|
6507
|
-
"description": "Repay an Aave debt and withdraw collateral from a Credit Account.\n\nBundles repayment, collateral withdrawal, and an optional swap into a single atomic Safe transaction.\n\n- If `token_out` is None or equals `withdraw_token`, the withdrawn collateral is kept as-is.\n- If `token_out` differs from `withdraw_token`, a swap is performed after withdrawal
|
|
6507
|
+
"description": "Repay an Aave debt and withdraw collateral from a Credit Account.\n\nBundles repayment, collateral withdrawal, and an optional swap into a single atomic Safe transaction.\n\n- If `token_out` is None or equals `withdraw_token`, the withdrawn collateral is kept as-is.\n- If `token_out` differs from `withdraw_token`, a market swap is performed after withdrawal.\n\nThe Credit Account must already have a borrow position created via `/v2/credit/borrow`.\nThe repay_token must be available in the Credit Account (or pulled from EOA via Permit2).",
|
|
6508
6508
|
"operationId": "v2_credit_repay",
|
|
6509
6509
|
"requestBody": {
|
|
6510
6510
|
"content": {
|
|
@@ -13138,12 +13138,12 @@
|
|
|
13138
13138
|
"tempo"
|
|
13139
13139
|
],
|
|
13140
13140
|
"title": "Chain",
|
|
13141
|
-
"description": "Blockchain network.",
|
|
13141
|
+
"description": "Blockchain network. Not every protocol is deployed on every chain \u2014 see the protocol field \u2014 and a chain with no credit venue at all returns a 422 naming the chains that do.",
|
|
13142
13142
|
"example": "ethereum"
|
|
13143
13143
|
},
|
|
13144
13144
|
"protocol": {
|
|
13145
13145
|
"$ref": "#/components/schemas/CreditProtocol",
|
|
13146
|
-
"description": "Lending protocol to loop into: AAVE, MORPHO, or EULER.",
|
|
13146
|
+
"description": "Lending protocol to loop into: AAVE, MORPHO, or EULER. On chain=hyperevm, AAVE is Hyperlend and MORPHO is Felix; EULER is not deployed there.",
|
|
13147
13147
|
"example": "AAVE"
|
|
13148
13148
|
},
|
|
13149
13149
|
"market_id": {
|
|
@@ -13214,7 +13214,7 @@
|
|
|
13214
13214
|
}
|
|
13215
13215
|
],
|
|
13216
13216
|
"title": "Initial Collateral Amount",
|
|
13217
|
-
"description": "Collateral (in token units)
|
|
13217
|
+
"description": "Collateral (in token units) that the Credit Account must ALREADY hold when this is called \u2014 the loop never pulls from the owner's wallet mid-transaction. Fund the account first via /v2/credit/transfer (action=DEPOSIT).",
|
|
13218
13218
|
"example": 1
|
|
13219
13219
|
},
|
|
13220
13220
|
"multiplier": {
|
|
@@ -13245,7 +13245,7 @@
|
|
|
13245
13245
|
}
|
|
13246
13246
|
],
|
|
13247
13247
|
"title": "Loan To Value",
|
|
13248
|
-
"description": "Per-iteration borrow LTV in percent. Must not exceed the protocol's maximum for the market (Aave reserve/e-mode LTV; Morpho LLTV with a safety margin); borrows are sized slightly inside the requested value so no leg sits on the protocol's revert boundary.",
|
|
13248
|
+
"description": "Per-iteration borrow LTV in percent. Must not exceed the protocol's maximum for the market (Aave reserve/e-mode LTV; Morpho LLTV with a safety margin; Euler's borrow LTV for the collateral vault); borrows are sized slightly inside the requested value so no leg sits on the protocol's revert boundary.",
|
|
13249
13249
|
"example": 70
|
|
13250
13250
|
},
|
|
13251
13251
|
"max_slippage_percent": {
|
|
@@ -13275,7 +13275,7 @@
|
|
|
13275
13275
|
}
|
|
13276
13276
|
],
|
|
13277
13277
|
"title": "Emode Category",
|
|
13278
|
-
"description": "Aave only: e-mode category to enable before looping (higher LTV for correlated pairs, e.g. ETH-correlated)."
|
|
13278
|
+
"description": "Aave only: e-mode category to enable before looping (higher LTV for correlated pairs, e.g. ETH-correlated). Both tokens must belong to the category or the build returns a 422. On Hyperlend (chain=hyperevm) category 1 is the HYPE-correlated set covering wstHYPE and WHYPE."
|
|
13279
13279
|
},
|
|
13280
13280
|
"gas_sponsorship": {
|
|
13281
13281
|
"type": "boolean",
|
|
@@ -13286,7 +13286,7 @@
|
|
|
13286
13286
|
"preview": {
|
|
13287
13287
|
"type": "boolean",
|
|
13288
13288
|
"title": "Preview",
|
|
13289
|
-
"description": "If true, build a display ESTIMATE: no firm RFQ quote is ever requested (quote_expires_at stays null)
|
|
13289
|
+
"description": "If true, build a display ESTIMATE: no firm RFQ quote is ever requested (quote_expires_at stays null). NOTE that this guarantees only that no firm quote was spent \u2014 it does not guarantee an absent transaction: on a pair no firm provider covers, and under pricing=market, the call still falls through to the aggregator and returns a signable transaction. How the estimate is priced follows `pricing`: on a firm-covered pair under 'auto' or 'firm' it is computed from the firm provider's live price levels (indicative); otherwise swap legs are priced by the default aggregator. Set it on every call made while a user is exploring parameters, and leave it false only for the build they actually intend to sign \u2014 firm quotes are single-use maker commitments, and requesting them for displays that are never executed degrades the pricing this API is offered.",
|
|
13290
13290
|
"example": false
|
|
13291
13291
|
},
|
|
13292
13292
|
"pricing": {
|
|
@@ -13337,7 +13337,7 @@
|
|
|
13337
13337
|
"type": "null"
|
|
13338
13338
|
}
|
|
13339
13339
|
],
|
|
13340
|
-
"description": "Unsigned transaction for direct execution by the owner. Present when gas_sponsorship=false \u2014 except firm-priced previews (preview=true
|
|
13340
|
+
"description": "Unsigned transaction for direct execution by the owner. Present when gas_sponsorship=false \u2014 except firm-priced previews (preview=true on a firm-priced build), which carry numbers only: the firm quotes are fetched at execution time, so there is no payload to sign yet."
|
|
13341
13341
|
},
|
|
13342
13342
|
"eip_712": {
|
|
13343
13343
|
"anyOf": [
|
|
@@ -13364,12 +13364,12 @@
|
|
|
13364
13364
|
"swap_provider": {
|
|
13365
13365
|
"type": "string",
|
|
13366
13366
|
"enum": [
|
|
13367
|
-
"
|
|
13368
|
-
"
|
|
13367
|
+
"market",
|
|
13368
|
+
"firm"
|
|
13369
13369
|
],
|
|
13370
13370
|
"title": "Swap Provider",
|
|
13371
|
-
"description": "
|
|
13372
|
-
"example": "
|
|
13371
|
+
"description": "Identifies which route priced the swap leg(s): 'market' \u2014 a DEX aggregator (iterative loop across pool liquidity, slippage-bounded floors) \u2014 or 'firm' \u2014 zero-slippage quotes, one per swap leg, each partially filled at the leg's size (exact fills, zero dust). On preview=true responses 'firm' means the numbers are INDICATIVE, computed from live maker price levels without spending any quote; execution fetches the firm quotes at signing time. Always present, including on fallbacks. This is the authoritative firm-vs-market signal and clients do need to read it: `pricing` is only what was REQUESTED (under 'auto' a firm build can fall back to market transparently), and `quote_expires_at` is absent on every preview \u2014 so neither substitutes for this field.",
|
|
13372
|
+
"example": "market"
|
|
13373
13373
|
},
|
|
13374
13374
|
"quote_expires_at": {
|
|
13375
13375
|
"anyOf": [
|
|
@@ -13382,7 +13382,7 @@
|
|
|
13382
13382
|
}
|
|
13383
13383
|
],
|
|
13384
13384
|
"title": "Quote Expires At",
|
|
13385
|
-
"description": "Deadline of the firm swap quotes (the earliest across the loop's swap legs) \u2014 sign and broadcast before it or the transaction reverts on-chain; refresh by re-calling this endpoint (discard the previous payload). Present only on executable
|
|
13385
|
+
"description": "Deadline of the firm swap quotes (the earliest across the loop's swap legs) \u2014 sign and broadcast before it or the transaction reverts on-chain; refresh by re-calling this endpoint (discard the previous payload). Present only on executable firm-priced builds; null on previews (no quote is spent for a preview)."
|
|
13386
13386
|
},
|
|
13387
13387
|
"max_firm_multiplier": {
|
|
13388
13388
|
"anyOf": [
|
|
@@ -13529,7 +13529,7 @@
|
|
|
13529
13529
|
"MORPHO"
|
|
13530
13530
|
],
|
|
13531
13531
|
"title": "CreditProtocol",
|
|
13532
|
-
"description": "Which lending protocol a credit action targets.\n\n``AAVE`` is the default so existing callers (which never send a ``protocol``\nfield) keep hitting the unchanged Aave code path. ``MORPHO`` identifies Morpho
|
|
13532
|
+
"description": "Which lending protocol a credit action targets.\n\n``AAVE`` is the default so existing callers (which never send a ``protocol``\nfield) keep hitting the unchanged Aave code path; markets are named by token\nsymbol. ``MORPHO`` identifies Morpho Blue lending markets by their bytes32\n``market_id``. ``EULER`` identifies Euler V2 markets by their EVK\n``collateral_vault`` + ``borrow_vault`` addresses and supports isolated\nper-sub-account positions (``sub_account_id``).\n\nDeployment is per chain, so a valid protocol can still 422 on a given chain:\nAAVE on Ethereum, Base, Arbitrum, BSC and HyperEVM (where it is Hyperlend, the\nchain's Aave V3 deployment); MORPHO on Ethereum, Base, Arbitrum and HyperEVM\n(where it is Felix); EULER on Ethereum, Base, Arbitrum and BSC.\n\nAll three support ``/v2/credit/loop`` and ``/v2/credit/unloop``. EULER does\nNOT: ``/v2/credit/rebalance`` rejects it with a 422, and\n``/v2/credit/looped_positions`` covers only AAVE and MORPHO \u2014 an Euler loop is\nsilently absent there rather than an error, so read it from\n``/v2/credit/positions`` instead. (EULER still appears in the\n``looped_positions`` response enum because this enum is shared; it is never\nemitted.)"
|
|
13533
13533
|
},
|
|
13534
13534
|
"CreditRebalancePreview": {
|
|
13535
13535
|
"properties": {
|
|
@@ -14385,12 +14385,12 @@
|
|
|
14385
14385
|
"tempo"
|
|
14386
14386
|
],
|
|
14387
14387
|
"title": "Chain",
|
|
14388
|
-
"description": "Blockchain network.",
|
|
14388
|
+
"description": "Blockchain network. Not every protocol is deployed on every chain \u2014 see the protocol field \u2014 and a chain with no credit venue at all returns a 422 naming the chains that do.",
|
|
14389
14389
|
"example": "ethereum"
|
|
14390
14390
|
},
|
|
14391
14391
|
"protocol": {
|
|
14392
14392
|
"$ref": "#/components/schemas/CreditProtocol",
|
|
14393
|
-
"description": "Lending protocol to unwind: AAVE, MORPHO, or EULER.",
|
|
14393
|
+
"description": "Lending protocol to unwind: AAVE, MORPHO, or EULER. On chain=hyperevm, AAVE is Hyperlend and MORPHO is Felix; EULER is not deployed there.",
|
|
14394
14394
|
"example": "AAVE"
|
|
14395
14395
|
},
|
|
14396
14396
|
"market_id": {
|
|
@@ -14485,7 +14485,7 @@
|
|
|
14485
14485
|
"allow_partial": {
|
|
14486
14486
|
"type": "boolean",
|
|
14487
14487
|
"title": "Allow Partial",
|
|
14488
|
-
"description": "If the target cannot be reached in one transaction (
|
|
14488
|
+
"description": "If the target cannot be reached in one transaction, return the maximum-progress plan (preview.fully_unwound=false) instead of a 400. This can happen because every withdrawal is sized to keep the health factor at or above 1.02 at that step, so a position opened very close to its liquidation threshold runs out of headroom before the target is met. A second unloop call, now from a much lower leverage, finishes the job.",
|
|
14489
14489
|
"example": false
|
|
14490
14490
|
},
|
|
14491
14491
|
"gas_sponsorship": {
|
|
@@ -14497,7 +14497,7 @@
|
|
|
14497
14497
|
"preview": {
|
|
14498
14498
|
"type": "boolean",
|
|
14499
14499
|
"title": "Preview",
|
|
14500
|
-
"description": "If true, build a display estimate only \u2014 no single-use firm quote is ever spent. On a firm-covered unwind (pricing 'auto' or 'firm') the numbers are firm-INDICATIVE, priced off the firm
|
|
14500
|
+
"description": "If true, build a display estimate only \u2014 no single-use firm quote is ever spent. NOTE that this guarantees only that no firm quote was spent \u2014 it does not guarantee an absent transaction: on an unwind no firm provider covers, and under pricing=market, the call still falls through to the aggregator and returns a signable transaction. On a firm-covered unwind (pricing 'auto' or 'firm') the numbers are firm-INDICATIVE, priced off the firm provider's live maker levels; otherwise they are market-priced with slippage-bounded floors. Under pricing='firm' a preview no firm provider can serve returns the advisory alone (preview=null + firm_available). Set it on every parameter-exploration call and omit it only on the build the user is about to sign.",
|
|
14501
14501
|
"example": false
|
|
14502
14502
|
},
|
|
14503
14503
|
"pricing": {
|
|
@@ -14543,7 +14543,7 @@
|
|
|
14543
14543
|
"type": "null"
|
|
14544
14544
|
}
|
|
14545
14545
|
],
|
|
14546
|
-
"description": "Unsigned transaction for direct execution by the owner. Present when gas_sponsorship=false \u2014 except firm-priced previews (preview=true
|
|
14546
|
+
"description": "Unsigned transaction for direct execution by the owner. Present when gas_sponsorship=false \u2014 except firm-priced previews (preview=true on a firm-priced build), which carry numbers only: the firm quotes are fetched at execution time, so there is no payload to sign yet."
|
|
14547
14547
|
},
|
|
14548
14548
|
"eip_712": {
|
|
14549
14549
|
"anyOf": [
|
|
@@ -14570,12 +14570,12 @@
|
|
|
14570
14570
|
"swap_provider": {
|
|
14571
14571
|
"type": "string",
|
|
14572
14572
|
"enum": [
|
|
14573
|
-
"
|
|
14574
|
-
"
|
|
14573
|
+
"market",
|
|
14574
|
+
"firm"
|
|
14575
14575
|
],
|
|
14576
14576
|
"title": "Swap Provider",
|
|
14577
|
-
"description": "
|
|
14578
|
-
"example": "
|
|
14577
|
+
"description": "Identifies which route priced the swap leg(s): 'market' \u2014 a DEX aggregator (pool liquidity, slippage-bounded floors) \u2014 or 'firm' \u2014 quotes, one per swap leg, each partially filled at the leg's size. On preview=true responses 'firm' means the numbers are INDICATIVE, computed from live maker price levels without spending any quote; execution fetches the firm quotes at signing time. Always present, including on fallbacks. This is the authoritative firm-vs-market signal and clients do need to read it: `pricing` is only what was REQUESTED (under 'auto' a firm build can fall back to market transparently), and `quote_expires_at` is absent on every preview \u2014 so neither substitutes for this field.",
|
|
14578
|
+
"example": "market"
|
|
14579
14579
|
},
|
|
14580
14580
|
"quote_expires_at": {
|
|
14581
14581
|
"anyOf": [
|
|
@@ -14588,7 +14588,7 @@
|
|
|
14588
14588
|
}
|
|
14589
14589
|
],
|
|
14590
14590
|
"title": "Quote Expires At",
|
|
14591
|
-
"description": "Deadline of the firm swap quotes (the earliest across the unwind's swap legs) \u2014 sign and broadcast before it or the transaction reverts on-chain; refresh by re-calling this endpoint (discard the previous payload). Present only on executable
|
|
14591
|
+
"description": "Deadline of the firm swap quotes (the earliest across the unwind's swap legs) \u2014 sign and broadcast before it or the transaction reverts on-chain; refresh by re-calling this endpoint (discard the previous payload). Present only on executable firm-priced builds; null on previews (no quote is spent for a preview)."
|
|
14592
14592
|
},
|
|
14593
14593
|
"firm_available": {
|
|
14594
14594
|
"anyOf": [
|
|
@@ -16906,7 +16906,7 @@
|
|
|
16906
16906
|
"properties": {
|
|
16907
16907
|
"protocol": {
|
|
16908
16908
|
"$ref": "#/components/schemas/CreditProtocol",
|
|
16909
|
-
"description": "Lending protocol this position is on
|
|
16909
|
+
"description": "Lending protocol this position is on. Only AAVE and MORPHO are ever returned; EULER is present in the enum because it is shared with the transact endpoints, but Euler loops are not listed here \u2014 read them from /v2/credit/positions."
|
|
16910
16910
|
},
|
|
16911
16911
|
"market_id": {
|
|
16912
16912
|
"anyOf": [
|
|
@@ -25196,7 +25196,7 @@
|
|
|
25196
25196
|
}
|
|
25197
25197
|
],
|
|
25198
25198
|
"title": "Router",
|
|
25199
|
-
"description": "The outbound counterparty when it is the
|
|
25199
|
+
"description": "The outbound counterparty when it is the swap router itself. Null when the swap settled from an executor contract (informational only \u2014 never required to detect the swap)."
|
|
25200
25200
|
}
|
|
25201
25201
|
},
|
|
25202
25202
|
"additionalProperties": false,
|
|
@@ -25210,7 +25210,7 @@
|
|
|
25210
25210
|
"bought_amount"
|
|
25211
25211
|
],
|
|
25212
25212
|
"title": "SwapInfo",
|
|
25213
|
-
"description": "The DEX swap leg detected inside a loop transaction.\n\nEvidence is token-filtered and executor-proof: the sold (debt) token left the\naccount to a non-protocol counterparty and the bought (collateral) token\narrived from a non-protocol counterparty.
|
|
25213
|
+
"description": "The DEX swap leg detected inside a loop transaction.\n\nEvidence is token-filtered and executor-proof: the sold (debt) token left the\naccount to a non-protocol counterparty and the bought (collateral) token\narrived from a non-protocol counterparty. Aggregator fills often settle from an\nexecutor contract, so the router is recorded only when it happens to be the\noutbound counterparty \u2014 it is never required for detection."
|
|
25214
25214
|
},
|
|
25215
25215
|
"SyPosition": {
|
|
25216
25216
|
"properties": {
|
package/package.json
CHANGED
|
@@ -35,7 +35,7 @@ import { Result } from "../types/fp.js";
|
|
|
35
35
|
* Bundles an optional swap, collateral supply, and borrow into a single atomic Safe transaction.
|
|
36
36
|
*
|
|
37
37
|
* - If `token_in` equals `collateral_token`, the tokens are supplied directly as collateral.
|
|
38
|
-
* - If `token_in` differs from `collateral_token`, a swap is performed first
|
|
38
|
+
* - If `token_in` differs from `collateral_token`, a market swap is performed first.
|
|
39
39
|
*
|
|
40
40
|
* The Credit Account must already be created via `/v2/credit/create_account` and funded with `token_in`.
|
|
41
41
|
*/
|
|
@@ -30,30 +30,16 @@ import { Result } from "../types/fp.js";
|
|
|
30
30
|
* Open a leveraged loop
|
|
31
31
|
*
|
|
32
32
|
* @remarks
|
|
33
|
-
* Open a leveraged
|
|
33
|
+
* Open a leveraged position in ONE atomic transaction.
|
|
34
34
|
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* in the Credit Account (the preview reports the bound as estimated_max_dust).
|
|
40
|
-
* Very large loops relative to pool depth can still exceed the slippage
|
|
41
|
-
* tolerance through their own cumulative price impact — size accordingly or
|
|
42
|
-
* raise max_slippage_percent. Conversely, the geometric tail can shrink below
|
|
43
|
-
* the swap router's minimum routable size; when it does the loop simply ends
|
|
44
|
-
* early on that supply — the achieved multiplier is still guaranteed within
|
|
45
|
-
* 0.5% of the request or the call returns a clean 400.
|
|
35
|
+
* Supply collateral, borrow against it, swap the borrowed token back to
|
|
36
|
+
* collateral, repeat — until total collateral reaches multiplier x
|
|
37
|
+
* initial_collateral_amount. If any step fails the whole transaction reverts,
|
|
38
|
+
* so a position is never left half-built.
|
|
46
39
|
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* net asset value instead of swapping the share token on a DEX — share tokens
|
|
51
|
-
* have no honest DEX route. A direct share-token route is only ever used when
|
|
52
|
-
* it prices within 1% of net asset value.
|
|
53
|
-
*
|
|
54
|
-
* The Credit Account must already hold initial_collateral_amount of
|
|
55
|
-
* collateral_token. For protocol=MORPHO pass a market_id from
|
|
56
|
-
* /v2/credit/morpho_markets.
|
|
40
|
+
* See the [Leveraged Looping guide](https://docs.compasslabs.ai/v2/Products/Looping)
|
|
41
|
+
* for chain coverage, market discovery, vault-share collateral, HyperEVM
|
|
42
|
+
* specifics and the full error list.
|
|
57
43
|
*/
|
|
58
44
|
export function creditCreditLoop(
|
|
59
45
|
client: CompassApiSDKCore,
|
|
@@ -31,14 +31,15 @@ import { Result } from "../types/fp.js";
|
|
|
31
31
|
* List looped (leveraged) credit positions
|
|
32
32
|
*
|
|
33
33
|
* @remarks
|
|
34
|
-
* List
|
|
34
|
+
* List the leveraged positions held by an owner's Credit Account.
|
|
35
35
|
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
36
|
+
* Positions are reconstructed from on-chain history rather than from API calls,
|
|
37
|
+
* so a loop assembled by hand through /v2/credit/bundle is recognised the same
|
|
38
|
+
* way as one opened through /v2/credit/loop. Only activity inside the Credit
|
|
39
|
+
* Account is visible — leverage the owner holds directly in their wallet is not.
|
|
40
|
+
*
|
|
41
|
+
* See the [Leveraged Looping guide](https://docs.compasslabs.ai/v2/Products/Looping)
|
|
42
|
+
* for protocol coverage and how to read leverage, health factor and net APY.
|
|
42
43
|
*/
|
|
43
44
|
export function creditCreditLoopedPositions(
|
|
44
45
|
client: CompassApiSDKCore,
|
|
@@ -30,43 +30,20 @@ import { Result } from "../types/fp.js";
|
|
|
30
30
|
* Rebalance the leveraged credit book
|
|
31
31
|
*
|
|
32
32
|
* @remarks
|
|
33
|
-
*
|
|
33
|
+
* Move one or more leveraged positions to the state you want, in ONE atomic
|
|
34
|
+
* transaction.
|
|
34
35
|
*
|
|
35
|
-
* List
|
|
36
|
-
*
|
|
37
|
-
*
|
|
36
|
+
* List the positions to change and the end state you want for each. The API
|
|
37
|
+
* works out whether that means opening, growing, shrinking, delevering or
|
|
38
|
+
* closing, and does them all together.
|
|
38
39
|
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* simply a close plus an open in the same transaction. Conversions involving an
|
|
44
|
-
* ERC-4626 vault-share token (e.g. a Morpho vault token like steakUSDC) go
|
|
45
|
-
* through the vault's own deposit/redeem at net asset value rather than a DEX
|
|
46
|
-
* swap of the share token.
|
|
40
|
+
* Money freed by shrinking or closing one position pays for growing or opening
|
|
41
|
+
* another, so shifting funds between positions needs no new deposit. Any
|
|
42
|
+
* shortfall is taken from the Credit Account's idle balance, and the call
|
|
43
|
+
* returns 422 if that does not cover it either.
|
|
47
44
|
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* Account as idle balance. Any swap surplus above the guaranteed floors also
|
|
51
|
-
* stays in the Credit Account (preview.estimated_max_dust) — recoverable, never
|
|
52
|
-
* lost.
|
|
53
|
-
*
|
|
54
|
-
* A book already at its target returns transaction: null with the preview — the
|
|
55
|
-
* call is idempotent and safe to drive from a converge-to-target loop.
|
|
56
|
-
*
|
|
57
|
-
* A rebalance too large for one transaction is rejected with a 422 — split it
|
|
58
|
-
* into two calls. Every deleveraging step keeps the health factor ≥ 1.02 and
|
|
59
|
-
* every leveraging step respects the protocol's borrow limits; Aave targets share
|
|
60
|
-
* one account-level health factor, which the preview reports.
|
|
61
|
-
*
|
|
62
|
-
* Dust tails and routing swaps below the swap router's minimum routable size do
|
|
63
|
-
* not fail the call: a releasing target that cannot fully unwind returns its
|
|
64
|
-
* honest residual in the preview, and an unroutable routing swap is skipped
|
|
65
|
-
* (its uncovered amount only 422s the rebalance if it breaches the funding
|
|
66
|
-
* tolerance).
|
|
67
|
-
*
|
|
68
|
-
* For protocol=MORPHO pass a market_id from /v2/credit/morpho_markets; inspect the
|
|
69
|
-
* current book via /v2/credit/looped_positions.
|
|
45
|
+
* See the [Leveraged Looping guide](https://docs.compasslabs.ai/v2/Products/Looping)
|
|
46
|
+
* for protocol and chain coverage, capital routing and the full error list.
|
|
70
47
|
*/
|
|
71
48
|
export function creditCreditRebalance(
|
|
72
49
|
client: CompassApiSDKCore,
|
|
@@ -35,7 +35,7 @@ import { Result } from "../types/fp.js";
|
|
|
35
35
|
* Bundles repayment, collateral withdrawal, and an optional swap into a single atomic Safe transaction.
|
|
36
36
|
*
|
|
37
37
|
* - If `token_out` is None or equals `withdraw_token`, the withdrawn collateral is kept as-is.
|
|
38
|
-
* - If `token_out` differs from `withdraw_token`, a swap is performed after withdrawal
|
|
38
|
+
* - If `token_out` differs from `withdraw_token`, a market swap is performed after withdrawal.
|
|
39
39
|
*
|
|
40
40
|
* The Credit Account must already have a borrow position created via `/v2/credit/borrow`.
|
|
41
41
|
* The repay_token must be available in the Credit Account (or pulled from EOA via Permit2).
|
|
@@ -30,46 +30,15 @@ import { Result } from "../types/fp.js";
|
|
|
30
30
|
* Unwind a leveraged loop
|
|
31
31
|
*
|
|
32
32
|
* @remarks
|
|
33
|
-
* Unwind
|
|
33
|
+
* Unwind a leveraged position in ONE atomic transaction.
|
|
34
34
|
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* step; any positive surplus stays in the Credit Account as borrow-token dust
|
|
39
|
-
* (the preview reports the bound as estimated_max_dust).
|
|
35
|
+
* Withdraw collateral, swap it back to the borrow token, repay, repeat — until
|
|
36
|
+
* the position reaches target_multiplier, or until the debt is cleared exactly
|
|
37
|
+
* if you omit it. If any step fails the whole transaction reverts.
|
|
40
38
|
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* instead of swapping the share token on a DEX; a direct share-token route is
|
|
45
|
-
* only ever used when it prices within 1% of net asset value.
|
|
46
|
-
*
|
|
47
|
-
* Omit target_multiplier for a full close: the debt is cleared exactly —
|
|
48
|
-
* accrued interest included — and the pair collateral is returned to the Credit
|
|
49
|
-
* Account. Pass 1 to clear the debt but keep the collateral supplied, or a value
|
|
50
|
-
* above 1 to delever to that multiplier (it must be below the position's current
|
|
51
|
-
* multiplier).
|
|
52
|
-
*
|
|
53
|
-
* Each withdrawal is sized to keep the position's health factor ≥ 1.02 at that
|
|
54
|
-
* step, so a position opened very close to the liquidation threshold may need
|
|
55
|
-
* more than one transaction to fully close — set allow_partial=true to return
|
|
56
|
-
* the maximum single-transaction progress (preview.fully_unwound=false), then
|
|
57
|
-
* call unloop again to finish. Very large unwinds relative to pool depth can
|
|
58
|
-
* still exceed the slippage tolerance through their own cumulative price impact.
|
|
59
|
-
*
|
|
60
|
-
* Positions are unwound as far as the swap router can route; on a router-minimum
|
|
61
|
-
* stop the engine still withdraws all collateral not needed to back the residual,
|
|
62
|
-
* and completes a true full close whenever the unwind's own guaranteed swap
|
|
63
|
-
* surpluses (or the Credit Account's idle balance) cover the remainder — a
|
|
64
|
-
* residual below the router's minimum routable size never fails the call, it is
|
|
65
|
-
* reported honestly in the preview (fully_unwound=false).
|
|
66
|
-
*
|
|
67
|
-
* When other open Aave loops share this position's collateral reserve, a full
|
|
68
|
-
* close withdraws only this position's attributed share of the pooled collateral
|
|
69
|
-
* (event-ledger bookkeeping), leaving the rest supplied for the other positions.
|
|
70
|
-
*
|
|
71
|
-
* For protocol=MORPHO pass a market_id from /v2/credit/morpho_markets; inspect
|
|
72
|
-
* open loops via /v2/credit/looped_positions.
|
|
39
|
+
* See the [Leveraged Looping guide](https://docs.compasslabs.ai/v2/Products/Looping)
|
|
40
|
+
* for chain coverage, vault-share collateral, shared Aave reserves and the full
|
|
41
|
+
* error list.
|
|
73
42
|
*/
|
|
74
43
|
export function creditCreditUnloop(
|
|
75
44
|
client: CompassApiSDKCore,
|
package/src/lib/config.ts
CHANGED
|
@@ -62,7 +62,7 @@ export const SDK_METADATA = {
|
|
|
62
62
|
language: "typescript",
|
|
63
63
|
openapiDocVersion: "0.0.1",
|
|
64
64
|
sdkVersion: "2.0.0",
|
|
65
|
-
genVersion: "2.
|
|
65
|
+
genVersion: "2.932.9",
|
|
66
66
|
userAgent:
|
|
67
|
-
"speakeasy-sdk/typescript 2.0.0 2.
|
|
67
|
+
"speakeasy-sdk/typescript 2.0.0 2.932.9 0.0.1 @compass-labs/api-sdk",
|
|
68
68
|
} as const;
|
|
@@ -28,11 +28,24 @@ export type AccountSummary = {
|
|
|
28
28
|
* @remarks
|
|
29
29
|
*
|
|
30
30
|
* ``AAVE`` is the default so existing callers (which never send a ``protocol``
|
|
31
|
-
* field) keep hitting the unchanged Aave code path
|
|
32
|
-
* Blue lending markets by their bytes32
|
|
33
|
-
* V2 markets by their EVK
|
|
34
|
-
*
|
|
35
|
-
*
|
|
31
|
+
* field) keep hitting the unchanged Aave code path; markets are named by token
|
|
32
|
+
* symbol. ``MORPHO`` identifies Morpho Blue lending markets by their bytes32
|
|
33
|
+
* ``market_id``. ``EULER`` identifies Euler V2 markets by their EVK
|
|
34
|
+
* ``collateral_vault`` + ``borrow_vault`` addresses and supports isolated
|
|
35
|
+
* per-sub-account positions (``sub_account_id``).
|
|
36
|
+
*
|
|
37
|
+
* Deployment is per chain, so a valid protocol can still 422 on a given chain:
|
|
38
|
+
* AAVE on Ethereum, Base, Arbitrum, BSC and HyperEVM (where it is Hyperlend, the
|
|
39
|
+
* chain's Aave V3 deployment); MORPHO on Ethereum, Base, Arbitrum and HyperEVM
|
|
40
|
+
* (where it is Felix); EULER on Ethereum, Base, Arbitrum and BSC.
|
|
41
|
+
*
|
|
42
|
+
* All three support ``/v2/credit/loop`` and ``/v2/credit/unloop``. EULER does
|
|
43
|
+
* NOT: ``/v2/credit/rebalance`` rejects it with a 422, and
|
|
44
|
+
* ``/v2/credit/looped_positions`` covers only AAVE and MORPHO — an Euler loop is
|
|
45
|
+
* silently absent there rather than an error, so read it from
|
|
46
|
+
* ``/v2/credit/positions`` instead. (EULER still appears in the
|
|
47
|
+
* ``looped_positions`` response enum because this enum is shared; it is never
|
|
48
|
+
* emitted.)
|
|
36
49
|
*/
|
|
37
50
|
protocol?: CreditProtocol | undefined;
|
|
38
51
|
/**
|
|
@@ -31,11 +31,24 @@ export type CollateralPosition = {
|
|
|
31
31
|
* @remarks
|
|
32
32
|
*
|
|
33
33
|
* ``AAVE`` is the default so existing callers (which never send a ``protocol``
|
|
34
|
-
* field) keep hitting the unchanged Aave code path
|
|
35
|
-
* Blue lending markets by their bytes32
|
|
36
|
-
* V2 markets by their EVK
|
|
37
|
-
*
|
|
38
|
-
*
|
|
34
|
+
* field) keep hitting the unchanged Aave code path; markets are named by token
|
|
35
|
+
* symbol. ``MORPHO`` identifies Morpho Blue lending markets by their bytes32
|
|
36
|
+
* ``market_id``. ``EULER`` identifies Euler V2 markets by their EVK
|
|
37
|
+
* ``collateral_vault`` + ``borrow_vault`` addresses and supports isolated
|
|
38
|
+
* per-sub-account positions (``sub_account_id``).
|
|
39
|
+
*
|
|
40
|
+
* Deployment is per chain, so a valid protocol can still 422 on a given chain:
|
|
41
|
+
* AAVE on Ethereum, Base, Arbitrum, BSC and HyperEVM (where it is Hyperlend, the
|
|
42
|
+
* chain's Aave V3 deployment); MORPHO on Ethereum, Base, Arbitrum and HyperEVM
|
|
43
|
+
* (where it is Felix); EULER on Ethereum, Base, Arbitrum and BSC.
|
|
44
|
+
*
|
|
45
|
+
* All three support ``/v2/credit/loop`` and ``/v2/credit/unloop``. EULER does
|
|
46
|
+
* NOT: ``/v2/credit/rebalance`` rejects it with a 422, and
|
|
47
|
+
* ``/v2/credit/looped_positions`` covers only AAVE and MORPHO — an Euler loop is
|
|
48
|
+
* silently absent there rather than an error, so read it from
|
|
49
|
+
* ``/v2/credit/positions`` instead. (EULER still appears in the
|
|
50
|
+
* ``looped_positions`` response enum because this enum is shared; it is never
|
|
51
|
+
* emitted.)
|
|
39
52
|
*/
|
|
40
53
|
protocol?: CreditProtocol | undefined;
|
|
41
54
|
/**
|
|
@@ -54,11 +54,24 @@ export type CreditBorrowParams = {
|
|
|
54
54
|
* @remarks
|
|
55
55
|
*
|
|
56
56
|
* ``AAVE`` is the default so existing callers (which never send a ``protocol``
|
|
57
|
-
* field) keep hitting the unchanged Aave code path
|
|
58
|
-
* Blue lending markets by their bytes32
|
|
59
|
-
* V2 markets by their EVK
|
|
60
|
-
*
|
|
61
|
-
*
|
|
57
|
+
* field) keep hitting the unchanged Aave code path; markets are named by token
|
|
58
|
+
* symbol. ``MORPHO`` identifies Morpho Blue lending markets by their bytes32
|
|
59
|
+
* ``market_id``. ``EULER`` identifies Euler V2 markets by their EVK
|
|
60
|
+
* ``collateral_vault`` + ``borrow_vault`` addresses and supports isolated
|
|
61
|
+
* per-sub-account positions (``sub_account_id``).
|
|
62
|
+
*
|
|
63
|
+
* Deployment is per chain, so a valid protocol can still 422 on a given chain:
|
|
64
|
+
* AAVE on Ethereum, Base, Arbitrum, BSC and HyperEVM (where it is Hyperlend, the
|
|
65
|
+
* chain's Aave V3 deployment); MORPHO on Ethereum, Base, Arbitrum and HyperEVM
|
|
66
|
+
* (where it is Felix); EULER on Ethereum, Base, Arbitrum and BSC.
|
|
67
|
+
*
|
|
68
|
+
* All three support ``/v2/credit/loop`` and ``/v2/credit/unloop``. EULER does
|
|
69
|
+
* NOT: ``/v2/credit/rebalance`` rejects it with a 422, and
|
|
70
|
+
* ``/v2/credit/looped_positions`` covers only AAVE and MORPHO — an Euler loop is
|
|
71
|
+
* silently absent there rather than an error, so read it from
|
|
72
|
+
* ``/v2/credit/positions`` instead. (EULER still appears in the
|
|
73
|
+
* ``looped_positions`` response enum because this enum is shared; it is never
|
|
74
|
+
* emitted.)
|
|
62
75
|
*/
|
|
63
76
|
protocol?: CreditProtocol | undefined;
|
|
64
77
|
/**
|