@compass-labs/api-sdk 2.2.100 → 2.2.102
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 +31 -18
- package/dist/commonjs/models/components/creditlooprequest.d.ts.map +1 -1
- package/dist/commonjs/models/components/creditlooprequest.js +5 -6
- package/dist/commonjs/models/components/creditlooprequest.js.map +1 -1
- package/dist/commonjs/models/components/creditloopresponse.d.ts +5 -5
- package/dist/commonjs/models/components/creditloopresponse.js +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 +42 -10
- package/dist/commonjs/models/components/creditunlooprequest.d.ts.map +1 -1
- package/dist/commonjs/models/components/creditunlooprequest.js +13 -2
- package/dist/commonjs/models/components/creditunlooprequest.js.map +1 -1
- package/dist/commonjs/models/components/creditunloopresponse.d.ts +8 -8
- package/dist/commonjs/models/components/creditunloopresponse.d.ts.map +1 -1
- package/dist/commonjs/models/components/creditunloopresponse.js +2 -2
- 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 +31 -18
- package/dist/esm/models/components/creditlooprequest.d.ts.map +1 -1
- package/dist/esm/models/components/creditlooprequest.js +4 -5
- package/dist/esm/models/components/creditlooprequest.js.map +1 -1
- package/dist/esm/models/components/creditloopresponse.d.ts +5 -5
- package/dist/esm/models/components/creditloopresponse.js +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 +42 -10
- package/dist/esm/models/components/creditunlooprequest.d.ts.map +1 -1
- package/dist/esm/models/components/creditunlooprequest.js +12 -1
- package/dist/esm/models/components/creditunlooprequest.js.map +1 -1
- package/dist/esm/models/components/creditunloopresponse.d.ts +8 -8
- package/dist/esm/models/components/creditunloopresponse.d.ts.map +1 -1
- package/dist/esm/models/components/creditunloopresponse.js +2 -2
- 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/{pricing.md → creditlooprequestpricing.md} +3 -3
- package/docs/models/components/creditloopresponse.md +8 -8
- package/docs/models/components/creditloopresponseswapprovider.md +1 -1
- 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 -16
- package/docs/models/components/creditunlooprequestchain.md +1 -1
- package/docs/models/components/creditunlooprequestpricing.md +17 -0
- package/docs/models/components/creditunloopresponse.md +10 -10
- package/docs/models/components/creditunloopresponseswapprovider.md +1 -1
- 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 +47 -29
- 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 +36 -20
- package/src/models/components/creditloopresponse.ts +5 -5
- 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 +49 -10
- package/src/models/components/creditunloopresponse.ts +9 -9
- 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
|
@@ -26,19 +26,19 @@ let value: RebalanceTargetPreview = {
|
|
|
26
26
|
|
|
27
27
|
## Fields
|
|
28
28
|
|
|
29
|
-
| Field
|
|
30
|
-
|
|
|
31
|
-
| `protocol`
|
|
32
|
-
| `marketId`
|
|
33
|
-
| `collateralToken`
|
|
34
|
-
| `borrowToken`
|
|
35
|
-
| `direction`
|
|
36
|
-
| `legs`
|
|
37
|
-
| `unloopLegs`
|
|
38
|
-
| `loopLegs`
|
|
39
|
-
| `resultingCollateral`
|
|
40
|
-
| `resultingDebt`
|
|
41
|
-
| `resultingMultiplier`
|
|
42
|
-
| `resultingHealthFactor`
|
|
43
|
-
| `healthFactorScope`
|
|
44
|
-
| `estimatedMaxDust`
|
|
29
|
+
| Field | Type | Required | Description | Example |
|
|
30
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
31
|
+
| `protocol` | [components.CreditProtocol](../../models/components/creditprotocol.md) | :heavy_check_mark: | Which lending protocol a credit action targets.<br/><br/>``AAVE`` is the default so existing callers (which never send a ``protocol``<br/>field) keep hitting the unchanged Aave code path; markets are named by token<br/>symbol. ``MORPHO`` identifies Morpho Blue lending markets by their bytes32<br/>``market_id``. ``EULER`` identifies Euler V2 markets by their EVK<br/>``collateral_vault`` + ``borrow_vault`` addresses and supports isolated<br/>per-sub-account positions (``sub_account_id``).<br/><br/>Deployment is per chain, so a valid protocol can still 422 on a given chain:<br/>AAVE on Ethereum, Base, Arbitrum, BSC and HyperEVM (where it is Hyperlend, the<br/>chain's Aave V3 deployment); MORPHO on Ethereum, Base, Arbitrum and HyperEVM<br/>(where it is Felix); EULER on Ethereum, Base, Arbitrum and BSC.<br/><br/>All three support ``/v2/credit/loop`` and ``/v2/credit/unloop``. EULER does<br/>NOT: ``/v2/credit/rebalance`` rejects it with a 422, and<br/>``/v2/credit/looped_positions`` covers only AAVE and MORPHO — an Euler loop is<br/>silently absent there rather than an error, so read it from<br/>``/v2/credit/positions`` instead. (EULER still appears in the<br/>``looped_positions`` response enum because this enum is shared; it is never<br/>emitted.) | |
|
|
32
|
+
| `marketId` | *string* | :heavy_minus_sign: | Morpho only: the bytes32 market id of this position. | |
|
|
33
|
+
| `collateralToken` | *string* | :heavy_check_mark: | Collateral token address (echoes the request target; joins against /v2/credit/looped_positions). | |
|
|
34
|
+
| `borrowToken` | *string* | :heavy_check_mark: | Borrow token address (echoes the request target). | |
|
|
35
|
+
| `direction` | [components.RebalanceDirection](../../models/components/rebalancedirection.md) | :heavy_check_mark: | What the plan does to one named target. | |
|
|
36
|
+
| `legs` | *number* | :heavy_check_mark: | On-chain legs planned for this target (loop + unloop iterations); 0 for a noop. | |
|
|
37
|
+
| `unloopLegs` | [components.UnloopLegPreview](../../models/components/unlooplegpreview.md)[] | :heavy_minus_sign: | Per-iteration unwind breakdown — populated for releasers (close / shrink / lever_down). | [] |
|
|
38
|
+
| `loopLegs` | [components.LoopLegPreview](../../models/components/looplegpreview.md)[] | :heavy_minus_sign: | Per-iteration loop breakdown — populated for consumers (open / grow / lever_up). | [] |
|
|
39
|
+
| `resultingCollateral` | *string* | :heavy_check_mark: | Guaranteed minimum collateral supplied to this position after the rebalance (token units). | |
|
|
40
|
+
| `resultingDebt` | *string* | :heavy_check_mark: | Projected debt owed by this position after the rebalance (borrow-token units); 0 on a close. | |
|
|
41
|
+
| `resultingMultiplier` | *string* | :heavy_check_mark: | Projected leverage of this position after the rebalance; 1 when the debt is cleared. Never promises more leverage (or, when deleveraging, more deleverage) than is guaranteed. | |
|
|
42
|
+
| `resultingHealthFactor` | *string* | :heavy_check_mark: | Projected health factor of this position after the rebalance. Never overstated at the 1.0 boundary — a liquidatable position is never presented as safe. See health_factor_scope for what it covers. | |
|
|
43
|
+
| `healthFactorScope` | [components.RebalanceTargetPreviewHealthFactorScope](../../models/components/rebalancetargetpreviewhealthfactorscope.md) | :heavy_check_mark: | 'market' for Morpho (isolated per-market health). 'account' for Aave: collateral is pooled, so all collateral backs all debt and this health factor is shared by every Aave position on the account. | |
|
|
44
|
+
| `estimatedMaxDust` | *string* | :heavy_check_mark: | Upper bound of surplus this target's own swaps can leave in the Credit Account (sum of each swap's quote minus its guaranteed floor). Routing swaps are counted book-level, not here. It accumulates in the Credit Account, is recoverable, and is never lost. | |
|
|
@@ -4,7 +4,7 @@ The DEX swap leg detected inside a loop transaction.
|
|
|
4
4
|
|
|
5
5
|
Evidence is token-filtered and executor-proof: the sold (debt) token left the
|
|
6
6
|
account to a non-protocol counterparty and the bought (collateral) token
|
|
7
|
-
arrived from a non-protocol counterparty.
|
|
7
|
+
arrived from a non-protocol counterparty. Aggregator fills often settle from an
|
|
8
8
|
executor contract, so the router is recorded only when it happens to be the
|
|
9
9
|
outbound counterparty — it is never required for detection.
|
|
10
10
|
|
|
@@ -25,12 +25,12 @@ let value: SwapInfo = {
|
|
|
25
25
|
|
|
26
26
|
## Fields
|
|
27
27
|
|
|
28
|
-
| Field
|
|
29
|
-
|
|
|
30
|
-
| `soldToken`
|
|
31
|
-
| `soldSymbol`
|
|
32
|
-
| `soldAmount`
|
|
33
|
-
| `boughtToken`
|
|
34
|
-
| `boughtSymbol`
|
|
35
|
-
| `boughtAmount`
|
|
36
|
-
| `router`
|
|
28
|
+
| Field | Type | Required | Description |
|
|
29
|
+
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
30
|
+
| `soldToken` | *string* | :heavy_check_mark: | Token sold in the swap (the borrowed/debt token). |
|
|
31
|
+
| `soldSymbol` | *string* | :heavy_check_mark: | Symbol of the sold token. |
|
|
32
|
+
| `soldAmount` | *string* | :heavy_check_mark: | Amount of the sold token. |
|
|
33
|
+
| `boughtToken` | *string* | :heavy_check_mark: | Token bought in the swap (the collateral token). |
|
|
34
|
+
| `boughtSymbol` | *string* | :heavy_check_mark: | Symbol of the bought token. |
|
|
35
|
+
| `boughtAmount` | *string* | :heavy_check_mark: | Amount of the bought token. |
|
|
36
|
+
| `router` | *string* | :heavy_minus_sign: | The outbound counterparty when it is the swap router itself. Null when the swap settled from an executor contract (informational only — never required to detect the swap). |
|
|
@@ -178,14 +178,15 @@ run();
|
|
|
178
178
|
|
|
179
179
|
## creditLoopedPositions
|
|
180
180
|
|
|
181
|
-
List
|
|
181
|
+
List the leveraged positions held by an owner's Credit Account.
|
|
182
182
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
183
|
+
Positions are reconstructed from on-chain history rather than from API calls,
|
|
184
|
+
so a loop assembled by hand through /v2/credit/bundle is recognised the same
|
|
185
|
+
way as one opened through /v2/credit/loop. Only activity inside the Credit
|
|
186
|
+
Account is visible — leverage the owner holds directly in their wallet is not.
|
|
187
|
+
|
|
188
|
+
See the [Leveraged Looping guide](https://docs.compasslabs.ai/v2/Products/Looping)
|
|
189
|
+
for protocol coverage and how to read leverage, health factor and net APY.
|
|
189
190
|
|
|
190
191
|
### Example Usage
|
|
191
192
|
|
|
@@ -518,7 +519,7 @@ Borrow an asset from Aave using a Credit Account.
|
|
|
518
519
|
Bundles an optional swap, collateral supply, and borrow into a single atomic Safe transaction.
|
|
519
520
|
|
|
520
521
|
- If `token_in` equals `collateral_token`, the tokens are supplied directly as collateral.
|
|
521
|
-
- If `token_in` differs from `collateral_token`, a swap is performed first
|
|
522
|
+
- If `token_in` differs from `collateral_token`, a market swap is performed first.
|
|
522
523
|
|
|
523
524
|
The Credit Account must already be created via `/v2/credit/create_account` and funded with `token_in`.
|
|
524
525
|
|
|
@@ -612,30 +613,16 @@ run();
|
|
|
612
613
|
|
|
613
614
|
## creditLoop
|
|
614
615
|
|
|
615
|
-
Open a leveraged
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
the swap router's minimum routable size; when it does the loop simply ends
|
|
626
|
-
early on that supply — the achieved multiplier is still guaranteed within
|
|
627
|
-
0.5% of the request or the call returns a clean 400.
|
|
628
|
-
|
|
629
|
-
When the collateral token is itself an ERC-4626 vault share (e.g. a Morpho
|
|
630
|
-
vault token like steakUSDC), each conversion swaps the borrow token to the
|
|
631
|
-
vault's underlying asset and mints the shares via the vault's own deposit at
|
|
632
|
-
net asset value instead of swapping the share token on a DEX — share tokens
|
|
633
|
-
have no honest DEX route. A direct share-token route is only ever used when
|
|
634
|
-
it prices within 1% of net asset value.
|
|
635
|
-
|
|
636
|
-
The Credit Account must already hold initial_collateral_amount of
|
|
637
|
-
collateral_token. For protocol=MORPHO pass a market_id from
|
|
638
|
-
/v2/credit/morpho_markets.
|
|
616
|
+
Open a leveraged position in ONE atomic transaction.
|
|
617
|
+
|
|
618
|
+
Supply collateral, borrow against it, swap the borrowed token back to
|
|
619
|
+
collateral, repeat — until total collateral reaches multiplier x
|
|
620
|
+
initial_collateral_amount. If any step fails the whole transaction reverts,
|
|
621
|
+
so a position is never left half-built.
|
|
622
|
+
|
|
623
|
+
See the [Leveraged Looping guide](https://docs.compasslabs.ai/v2/Products/Looping)
|
|
624
|
+
for chain coverage, market discovery, vault-share collateral, HyperEVM
|
|
625
|
+
specifics and the full error list.
|
|
639
626
|
|
|
640
627
|
### Example Usage
|
|
641
628
|
|
|
@@ -727,46 +714,15 @@ run();
|
|
|
727
714
|
|
|
728
715
|
## creditUnloop
|
|
729
716
|
|
|
730
|
-
Unwind
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
vault token like steakUSDC), each conversion redeems the shares through the
|
|
740
|
-
vault at net asset value and swaps the underlying asset to the borrow token
|
|
741
|
-
instead of swapping the share token on a DEX; a direct share-token route is
|
|
742
|
-
only ever used when it prices within 1% of net asset value.
|
|
743
|
-
|
|
744
|
-
Omit target_multiplier for a full close: the debt is cleared exactly —
|
|
745
|
-
accrued interest included — and the pair collateral is returned to the Credit
|
|
746
|
-
Account. Pass 1 to clear the debt but keep the collateral supplied, or a value
|
|
747
|
-
above 1 to delever to that multiplier (it must be below the position's current
|
|
748
|
-
multiplier).
|
|
749
|
-
|
|
750
|
-
Each withdrawal is sized to keep the position's health factor ≥ 1.02 at that
|
|
751
|
-
step, so a position opened very close to the liquidation threshold may need
|
|
752
|
-
more than one transaction to fully close — set allow_partial=true to return
|
|
753
|
-
the maximum single-transaction progress (preview.fully_unwound=false), then
|
|
754
|
-
call unloop again to finish. Very large unwinds relative to pool depth can
|
|
755
|
-
still exceed the slippage tolerance through their own cumulative price impact.
|
|
756
|
-
|
|
757
|
-
Positions are unwound as far as the swap router can route; on a router-minimum
|
|
758
|
-
stop the engine still withdraws all collateral not needed to back the residual,
|
|
759
|
-
and completes a true full close whenever the unwind's own guaranteed swap
|
|
760
|
-
surpluses (or the Credit Account's idle balance) cover the remainder — a
|
|
761
|
-
residual below the router's minimum routable size never fails the call, it is
|
|
762
|
-
reported honestly in the preview (fully_unwound=false).
|
|
763
|
-
|
|
764
|
-
When other open Aave loops share this position's collateral reserve, a full
|
|
765
|
-
close withdraws only this position's attributed share of the pooled collateral
|
|
766
|
-
(event-ledger bookkeeping), leaving the rest supplied for the other positions.
|
|
767
|
-
|
|
768
|
-
For protocol=MORPHO pass a market_id from /v2/credit/morpho_markets; inspect
|
|
769
|
-
open loops via /v2/credit/looped_positions.
|
|
717
|
+
Unwind a leveraged position in ONE atomic transaction.
|
|
718
|
+
|
|
719
|
+
Withdraw collateral, swap it back to the borrow token, repay, repeat — until
|
|
720
|
+
the position reaches target_multiplier, or until the debt is cleared exactly
|
|
721
|
+
if you omit it. If any step fails the whole transaction reverts.
|
|
722
|
+
|
|
723
|
+
See the [Leveraged Looping guide](https://docs.compasslabs.ai/v2/Products/Looping)
|
|
724
|
+
for chain coverage, vault-share collateral, shared Aave reserves and the full
|
|
725
|
+
error list.
|
|
770
726
|
|
|
771
727
|
### Example Usage
|
|
772
728
|
|
|
@@ -854,43 +810,20 @@ run();
|
|
|
854
810
|
|
|
855
811
|
## creditRebalance
|
|
856
812
|
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
List only the positions to change — anything not named is left untouched;
|
|
860
|
-
remove a position with close=true. Each target states an end state:
|
|
861
|
-
target_equity_usd (net USD committed) × target_multiplier.
|
|
862
|
-
|
|
863
|
-
Releasing targets run first (each unwind/delever frees tokens into the Credit
|
|
864
|
-
Account), the freed tokens are then routed by swaps at a GUARANTEED minimum
|
|
865
|
-
output (enforced on-chain), and consuming targets run last — so moving a
|
|
866
|
-
levered position between markets, token pairs, or protocols (Aave ↔ Morpho) is
|
|
867
|
-
simply a close plus an open in the same transaction. Conversions involving an
|
|
868
|
-
ERC-4626 vault-share token (e.g. a Morpho vault token like steakUSDC) go
|
|
869
|
-
through the vault's own deposit/redeem at net asset value rather than a DEX
|
|
870
|
-
swap of the share token.
|
|
871
|
-
|
|
872
|
-
Net book growth is funded from the Credit Account's existing idle balance —
|
|
873
|
-
fund it first via /v2/credit/transfer; a net release stays in the Credit
|
|
874
|
-
Account as idle balance. Any swap surplus above the guaranteed floors also
|
|
875
|
-
stays in the Credit Account (preview.estimated_max_dust) — recoverable, never
|
|
876
|
-
lost.
|
|
877
|
-
|
|
878
|
-
A book already at its target returns transaction: null with the preview — the
|
|
879
|
-
call is idempotent and safe to drive from a converge-to-target loop.
|
|
813
|
+
Move one or more leveraged positions to the state you want, in ONE atomic
|
|
814
|
+
transaction.
|
|
880
815
|
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
one account-level health factor, which the preview reports.
|
|
816
|
+
List the positions to change and the end state you want for each. The API
|
|
817
|
+
works out whether that means opening, growing, shrinking, delevering or
|
|
818
|
+
closing, and does them all together.
|
|
885
819
|
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
tolerance).
|
|
820
|
+
Money freed by shrinking or closing one position pays for growing or opening
|
|
821
|
+
another, so shifting funds between positions needs no new deposit. Any
|
|
822
|
+
shortfall is taken from the Credit Account's idle balance, and the call
|
|
823
|
+
returns 422 if that does not cover it either.
|
|
891
824
|
|
|
892
|
-
|
|
893
|
-
|
|
825
|
+
See the [Leveraged Looping guide](https://docs.compasslabs.ai/v2/Products/Looping)
|
|
826
|
+
for protocol and chain coverage, capital routing and the full error list.
|
|
894
827
|
|
|
895
828
|
### Example Usage
|
|
896
829
|
|
|
@@ -1083,7 +1016,7 @@ Repay an Aave debt and withdraw collateral from a Credit Account.
|
|
|
1083
1016
|
Bundles repayment, collateral withdrawal, and an optional swap into a single atomic Safe transaction.
|
|
1084
1017
|
|
|
1085
1018
|
- If `token_out` is None or equals `withdraw_token`, the withdrawn collateral is kept as-is.
|
|
1086
|
-
- If `token_out` differs from `withdraw_token`, a swap is performed after withdrawal
|
|
1019
|
+
- If `token_out` differs from `withdraw_token`, a market swap is performed after withdrawal.
|
|
1087
1020
|
|
|
1088
1021
|
The Credit Account must already have a borrow position created via `/v2/credit/borrow`.
|
|
1089
1022
|
The repay_token must be available in the Credit Account (or pulled from EOA via Permit2).
|