@compass-labs/api-sdk 2.2.79 → 2.2.80

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.
Files changed (134) hide show
  1. package/README.md +5 -3
  2. package/codeSamples_typescript.yaml +6 -0
  3. package/dist/commonjs/funcs/creditCreditRebalance.d.ts +45 -0
  4. package/dist/commonjs/funcs/creditCreditRebalance.d.ts.map +1 -0
  5. package/dist/commonjs/funcs/creditCreditRebalance.js +146 -0
  6. package/dist/commonjs/funcs/creditCreditRebalance.js.map +1 -0
  7. package/dist/commonjs/lib/config.d.ts +2 -2
  8. package/dist/commonjs/lib/config.js +2 -2
  9. package/dist/commonjs/models/components/creditrebalancepreview.d.ts +38 -0
  10. package/dist/commonjs/models/components/creditrebalancepreview.d.ts.map +1 -0
  11. package/dist/commonjs/models/components/creditrebalancepreview.js +67 -0
  12. package/dist/commonjs/models/components/creditrebalancepreview.js.map +1 -0
  13. package/dist/commonjs/models/components/creditrebalancerequest.d.ts +54 -0
  14. package/dist/commonjs/models/components/creditrebalancerequest.d.ts.map +1 -0
  15. package/dist/commonjs/models/components/creditrebalancerequest.js +67 -0
  16. package/dist/commonjs/models/components/creditrebalancerequest.js.map +1 -0
  17. package/dist/commonjs/models/components/creditrebalanceresponse.d.ts +27 -0
  18. package/dist/commonjs/models/components/creditrebalanceresponse.d.ts.map +1 -0
  19. package/dist/commonjs/models/components/creditrebalanceresponse.js +61 -0
  20. package/dist/commonjs/models/components/creditrebalanceresponse.js.map +1 -0
  21. package/dist/commonjs/models/components/creditunlooprequest.d.ts +4 -4
  22. package/dist/commonjs/models/components/creditunlooprequest.d.ts.map +1 -1
  23. package/dist/commonjs/models/components/creditunlooprequest.js +5 -5
  24. package/dist/commonjs/models/components/creditunlooprequest.js.map +1 -1
  25. package/dist/commonjs/models/components/index.d.ts +7 -0
  26. package/dist/commonjs/models/components/index.d.ts.map +1 -1
  27. package/dist/commonjs/models/components/index.js +7 -0
  28. package/dist/commonjs/models/components/index.js.map +1 -1
  29. package/dist/commonjs/models/components/loopedpositioncurrentstate.d.ts +4 -4
  30. package/dist/commonjs/models/components/loopedpositioncurrentstate.d.ts.map +1 -1
  31. package/dist/commonjs/models/components/loopedpositioncurrentstate.js +5 -4
  32. package/dist/commonjs/models/components/loopedpositioncurrentstate.js.map +1 -1
  33. package/dist/commonjs/models/components/rebalancedirection.d.ts +21 -0
  34. package/dist/commonjs/models/components/rebalancedirection.d.ts.map +1 -0
  35. package/dist/commonjs/models/components/rebalancedirection.js +55 -0
  36. package/dist/commonjs/models/components/rebalancedirection.js.map +1 -0
  37. package/dist/commonjs/models/components/rebalancetarget.d.ts +97 -0
  38. package/dist/commonjs/models/components/rebalancetarget.d.ts.map +1 -0
  39. package/dist/commonjs/models/components/rebalancetarget.js +85 -0
  40. package/dist/commonjs/models/components/rebalancetarget.js.map +1 -0
  41. package/dist/commonjs/models/components/rebalancetargetpreview.d.ts +96 -0
  42. package/dist/commonjs/models/components/rebalancetargetpreview.d.ts.map +1 -0
  43. package/dist/commonjs/models/components/rebalancetargetpreview.js +92 -0
  44. package/dist/commonjs/models/components/rebalancetargetpreview.js.map +1 -0
  45. package/dist/commonjs/models/components/routingswappreview.d.ts +32 -0
  46. package/dist/commonjs/models/components/routingswappreview.d.ts.map +1 -0
  47. package/dist/commonjs/models/components/routingswappreview.js +61 -0
  48. package/dist/commonjs/models/components/routingswappreview.js.map +1 -0
  49. package/dist/commonjs/sdk/credit.d.ts +34 -0
  50. package/dist/commonjs/sdk/credit.d.ts.map +1 -1
  51. package/dist/commonjs/sdk/credit.js +37 -0
  52. package/dist/commonjs/sdk/credit.js.map +1 -1
  53. package/dist/esm/funcs/creditCreditRebalance.d.ts +45 -0
  54. package/dist/esm/funcs/creditCreditRebalance.d.ts.map +1 -0
  55. package/dist/esm/funcs/creditCreditRebalance.js +110 -0
  56. package/dist/esm/funcs/creditCreditRebalance.js.map +1 -0
  57. package/dist/esm/lib/config.d.ts +2 -2
  58. package/dist/esm/lib/config.js +2 -2
  59. package/dist/esm/models/components/creditrebalancepreview.d.ts +38 -0
  60. package/dist/esm/models/components/creditrebalancepreview.d.ts.map +1 -0
  61. package/dist/esm/models/components/creditrebalancepreview.js +30 -0
  62. package/dist/esm/models/components/creditrebalancepreview.js.map +1 -0
  63. package/dist/esm/models/components/creditrebalancerequest.d.ts +54 -0
  64. package/dist/esm/models/components/creditrebalancerequest.d.ts.map +1 -0
  65. package/dist/esm/models/components/creditrebalancerequest.js +29 -0
  66. package/dist/esm/models/components/creditrebalancerequest.js.map +1 -0
  67. package/dist/esm/models/components/creditrebalanceresponse.d.ts +27 -0
  68. package/dist/esm/models/components/creditrebalanceresponse.d.ts.map +1 -0
  69. package/dist/esm/models/components/creditrebalanceresponse.js +24 -0
  70. package/dist/esm/models/components/creditrebalanceresponse.js.map +1 -0
  71. package/dist/esm/models/components/creditunlooprequest.d.ts +4 -4
  72. package/dist/esm/models/components/creditunlooprequest.d.ts.map +1 -1
  73. package/dist/esm/models/components/creditunlooprequest.js +3 -3
  74. package/dist/esm/models/components/creditunlooprequest.js.map +1 -1
  75. package/dist/esm/models/components/index.d.ts +7 -0
  76. package/dist/esm/models/components/index.d.ts.map +1 -1
  77. package/dist/esm/models/components/index.js +7 -0
  78. package/dist/esm/models/components/index.js.map +1 -1
  79. package/dist/esm/models/components/loopedpositioncurrentstate.d.ts +4 -4
  80. package/dist/esm/models/components/loopedpositioncurrentstate.d.ts.map +1 -1
  81. package/dist/esm/models/components/loopedpositioncurrentstate.js +4 -3
  82. package/dist/esm/models/components/loopedpositioncurrentstate.js.map +1 -1
  83. package/dist/esm/models/components/rebalancedirection.d.ts +21 -0
  84. package/dist/esm/models/components/rebalancedirection.d.ts.map +1 -0
  85. package/dist/esm/models/components/rebalancedirection.js +19 -0
  86. package/dist/esm/models/components/rebalancedirection.js.map +1 -0
  87. package/dist/esm/models/components/rebalancetarget.d.ts +97 -0
  88. package/dist/esm/models/components/rebalancetarget.d.ts.map +1 -0
  89. package/dist/esm/models/components/rebalancetarget.js +45 -0
  90. package/dist/esm/models/components/rebalancetarget.js.map +1 -0
  91. package/dist/esm/models/components/rebalancetargetpreview.d.ts +96 -0
  92. package/dist/esm/models/components/rebalancetargetpreview.d.ts.map +1 -0
  93. package/dist/esm/models/components/rebalancetargetpreview.js +55 -0
  94. package/dist/esm/models/components/rebalancetargetpreview.js.map +1 -0
  95. package/dist/esm/models/components/routingswappreview.d.ts +32 -0
  96. package/dist/esm/models/components/routingswappreview.d.ts.map +1 -0
  97. package/dist/esm/models/components/routingswappreview.js +24 -0
  98. package/dist/esm/models/components/routingswappreview.js.map +1 -0
  99. package/dist/esm/sdk/credit.d.ts +34 -0
  100. package/dist/esm/sdk/credit.d.ts.map +1 -1
  101. package/dist/esm/sdk/credit.js +37 -0
  102. package/dist/esm/sdk/credit.js.map +1 -1
  103. package/docs/models/components/creditrebalancepreview.md +44 -0
  104. package/docs/models/components/creditrebalancerequest.md +37 -0
  105. package/docs/models/components/creditrebalancerequestmaxslippagepercent.md +19 -0
  106. package/docs/models/components/creditrebalanceresponse.md +27 -0
  107. package/docs/models/components/creditunlooprequest.md +1 -1
  108. package/docs/models/components/{targetmultiplier.md → creditunlooprequesttargetmultiplier.md} +1 -1
  109. package/docs/models/components/loopedpositioncurrentstate.md +1 -1
  110. package/docs/models/components/{healthfactorscope.md → loopedpositioncurrentstatehealthfactorscope.md} +3 -3
  111. package/docs/models/components/rebalancedirection.md +17 -0
  112. package/docs/models/components/rebalancetarget.md +32 -0
  113. package/docs/models/components/rebalancetargetmaxslippagepercent.md +19 -0
  114. package/docs/models/components/rebalancetargetpreview.md +44 -0
  115. package/docs/models/components/rebalancetargetpreviewhealthfactorscope.md +17 -0
  116. package/docs/models/components/rebalancetargettargetmultiplier.md +19 -0
  117. package/docs/models/components/routingswappreview.md +27 -0
  118. package/docs/models/components/targetequityusd.md +19 -0
  119. package/docs/sdks/credit/README.md +124 -0
  120. package/openapi_prepped_for_speakeasy.json +465 -0
  121. package/package.json +1 -1
  122. package/src/funcs/creditCreditRebalance.ts +198 -0
  123. package/src/lib/config.ts +2 -2
  124. package/src/models/components/creditrebalancepreview.ts +80 -0
  125. package/src/models/components/creditrebalancerequest.ts +104 -0
  126. package/src/models/components/creditrebalanceresponse.ts +65 -0
  127. package/src/models/components/creditunlooprequest.ts +10 -8
  128. package/src/models/components/index.ts +7 -0
  129. package/src/models/components/loopedpositioncurrentstate.ts +10 -7
  130. package/src/models/components/rebalancedirection.ts +28 -0
  131. package/src/models/components/rebalancetarget.ts +178 -0
  132. package/src/models/components/rebalancetargetpreview.ts +163 -0
  133. package/src/models/components/routingswappreview.ts +64 -0
  134. package/src/sdk/credit.ts +45 -0
@@ -0,0 +1,19 @@
1
+ # CreditRebalanceRequestMaxSlippagePercent
2
+
3
+ Request-level per-swap slippage tolerance in percent (including routing swaps). A per-target max_slippage_percent overrides it where set.
4
+
5
+
6
+ ## Supported Types
7
+
8
+ ### `number`
9
+
10
+ ```typescript
11
+ const value: number = 1284.03;
12
+ ```
13
+
14
+ ### `string`
15
+
16
+ ```typescript
17
+ const value: string = "0.5";
18
+ ```
19
+
@@ -0,0 +1,27 @@
1
+ # CreditRebalanceResponse
2
+
3
+ The atomic rebalance transaction plus its guaranteed-floor preview.
4
+
5
+ ## Example Usage
6
+
7
+ ```typescript
8
+ import { CreditRebalanceResponse } from "@compass-labs/api-sdk/models/components";
9
+
10
+ let value: CreditRebalanceResponse = {
11
+ preview: {
12
+ netEquityMovedUsd: "<value>",
13
+ totalLegs: 255852,
14
+ routingSwaps: [],
15
+ estimatedMaxDust: "<value>",
16
+ perTarget: [],
17
+ },
18
+ };
19
+ ```
20
+
21
+ ## Fields
22
+
23
+ | Field | Type | Required | Description |
24
+ | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
25
+ | `transaction` | [components.UnsignedTransaction](../../models/components/unsignedtransaction.md) | :heavy_minus_sign: | Unsigned transaction for direct execution by the owner. Present when gas_sponsorship=false. Null when the book is already at its target — nothing to execute. |
26
+ | `eip712` | [components.BatchedSafeOperationsResponseOutput](../../models/components/batchedsafeoperationsresponseoutput.md) | :heavy_minus_sign: | EIP-712 typed data for gas-sponsored execution. Present when gas_sponsorship=true. |
27
+ | `preview` | [components.CreditRebalancePreview](../../models/components/creditrebalancepreview.md) | :heavy_check_mark: | Projected end state of the whole rebalance, computed on GUARANTEED swap floors. |
@@ -31,7 +31,7 @@ let value: CreditUnloopRequest = {
31
31
  | `marketId` | *string* | :heavy_minus_sign: | Morpho only: the bytes32 market id (from /v2/credit/morpho_markets). Required when protocol=MORPHO. | |
32
32
  | `collateralToken` | *string* | :heavy_check_mark: | Token supplied as collateral in the loop being unwound. For MORPHO it must be the market's collateral token. | WETH |
33
33
  | `borrowToken` | *string* | :heavy_check_mark: | Token borrowed in the loop; withdrawn collateral is swapped back to it and used to repay. For MORPHO it must be the market's loan token. | USDC |
34
- | `targetMultiplier` | *components.TargetMultiplier* | :heavy_minus_sign: | Target leverage after the unwind. Omit (null) for a FULL unwind: the debt is cleared exactly — accrued interest included — and all pair collateral is withdrawn back to the Credit Account. `1` runs the same exact debt close but leaves the collateral supplied (earning). A value greater than 1 delevers the position to that multiplier. Must be below the position's current multiplier. | |
34
+ | `targetMultiplier` | *components.CreditUnloopRequestTargetMultiplier* | :heavy_minus_sign: | Target leverage after the unwind. Omit (null) for a FULL unwind: the debt is cleared exactly — accrued interest included — and all pair collateral is withdrawn back to the Credit Account. `1` runs the same exact debt close but leaves the collateral supplied (earning). A value greater than 1 delevers the position to that multiplier. Must be below the position's current multiplier. | |
35
35
  | `maxSlippagePercent` | *components.CreditUnloopRequestMaxSlippagePercent* | :heavy_minus_sign: | Per-swap slippage tolerance in percent. Unwind dust is bounded by this per iteration, so tighter slippage means less dust. | 0.5 |
36
36
  | `allowPartial` | *boolean* | :heavy_minus_sign: | If the target cannot be reached in one transaction (e.g. a position opened very close to the liquidation threshold), return the maximum-progress plan (preview.fully_unwound=false) instead of a 400. A second unloop call, now from a much lower leverage, finishes the job. | false |
37
37
  | `gasSponsorship` | *boolean* | :heavy_minus_sign: | If true, returns EIP-712 typed data for gas-sponsored execution instead of an unsigned transaction. | false |
@@ -1,4 +1,4 @@
1
- # TargetMultiplier
1
+ # CreditUnloopRequestTargetMultiplier
2
2
 
3
3
  Target leverage after the unwind. Omit (null) for a FULL unwind: the debt is cleared exactly — accrued interest included — and all pair collateral is withdrawn back to the Credit Account. `1` runs the same exact debt close but leaves the collateral supplied (earning). A value greater than 1 delevers the position to that multiplier. Must be below the position's current multiplier.
4
4
 
@@ -25,4 +25,4 @@ let value: LoopedPositionCurrentState = {
25
25
  | `netUsdValue` | *string* | :heavy_minus_sign: | Net position value in USD (collateral - debt); null if unpriced. |
26
26
  | `leverage` | *string* | :heavy_minus_sign: | Leverage multiplier: collateral_usd / (collateral_usd - debt_usd). Null when unpriced or net value is non-positive. |
27
27
  | `healthFactor` | *string* | :heavy_minus_sign: | Health factor. Above 1 is safe; below 1 risks liquidation. See health_factor_scope for what it covers. |
28
- | `healthFactorScope` | [components.HealthFactorScope](../../models/components/healthfactorscope.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 — see aave_account_summary for the account-level figures. |
28
+ | `healthFactorScope` | [components.LoopedPositionCurrentStateHealthFactorScope](../../models/components/loopedpositioncurrentstatehealthfactorscope.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 — see aave_account_summary for the account-level figures. |
@@ -1,13 +1,13 @@
1
- # HealthFactorScope
1
+ # LoopedPositionCurrentStateHealthFactorScope
2
2
 
3
3
  '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 — see aave_account_summary for the account-level figures.
4
4
 
5
5
  ## Example Usage
6
6
 
7
7
  ```typescript
8
- import { HealthFactorScope } from "@compass-labs/api-sdk/models/components";
8
+ import { LoopedPositionCurrentStateHealthFactorScope } from "@compass-labs/api-sdk/models/components";
9
9
 
10
- let value: HealthFactorScope = "market";
10
+ let value: LoopedPositionCurrentStateHealthFactorScope = "account";
11
11
  ```
12
12
 
13
13
  ## Values
@@ -0,0 +1,17 @@
1
+ # RebalanceDirection
2
+
3
+ What the plan does to one named target.
4
+
5
+ ## Example Usage
6
+
7
+ ```typescript
8
+ import { RebalanceDirection } from "@compass-labs/api-sdk/models/components";
9
+
10
+ let value: RebalanceDirection = "open";
11
+ ```
12
+
13
+ ## Values
14
+
15
+ ```typescript
16
+ "open" | "close" | "grow" | "shrink" | "lever_up" | "lever_down" | "noop"
17
+ ```
@@ -0,0 +1,32 @@
1
+ # RebalanceTarget
2
+
3
+ The desired end-state of ONE position in the Credit Account.
4
+
5
+ Scoped-declarative: only positions named in ``targets`` are touched; anything
6
+ unlisted is left as-is. Set ``close=true`` to fully unwind a position — never
7
+ ``target_equity_usd=0``.
8
+
9
+ ## Example Usage
10
+
11
+ ```typescript
12
+ import { RebalanceTarget } from "@compass-labs/api-sdk/models/components";
13
+
14
+ let value: RebalanceTarget = {
15
+ collateralToken: "<value>",
16
+ borrowToken: "<value>",
17
+ close: false,
18
+ };
19
+ ```
20
+
21
+ ## Fields
22
+
23
+ | Field | Type | Required | Description | Example |
24
+ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
25
+ | `protocol` | [components.CreditProtocol](../../models/components/creditprotocol.md) | :heavy_minus_sign: | 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. ``EULER`` opts in to the<br/>Euler V2 path, where the market is identified by EVK vault address(es).<br/>``MORPHO`` identifies Morpho Blue lending markets (bytes32 market id) and is<br/>currently read-only: positions and market discovery only — transaction<br/>builders land with the looping work (COM-7106/7107/7108), so transact<br/>endpoints reject it with a 422. | |
26
+ | `marketId` | *string* | :heavy_minus_sign: | Morpho only: the bytes32 market id (from /v2/credit/morpho_markets). Required when protocol=MORPHO. | |
27
+ | `collateralToken` | *string* | :heavy_check_mark: | Token supplied as collateral for this position. For MORPHO it must be the market's collateral token. | |
28
+ | `borrowToken` | *string* | :heavy_check_mark: | Token borrowed against the collateral for this position. For MORPHO it must be the market's loan token. | |
29
+ | `targetEquityUsd` | *components.TargetEquityUsd* | :heavy_minus_sign: | SIZE knob: the net value (collateral − debt, in USD) to commit to this position; total collateral ≈ target_equity_usd × target_multiplier. To remove a position use close=true, never target_equity_usd=0. | |
30
+ | `targetMultiplier` | *components.RebalanceTargetTargetMultiplier* | :heavy_minus_sign: | LEVERAGE knob: total collateral exposure ÷ equity. 1 means unlevered supplied collateral. The protocol maximum is enforced when the plan is built. | |
31
+ | `close` | *boolean* | :heavy_minus_sign: | If true, fully unwind this position: the debt is cleared exactly (accrued interest included) and the pair collateral is returned to the Credit Account. | false |
32
+ | `maxSlippagePercent` | *components.RebalanceTargetMaxSlippagePercent* | :heavy_minus_sign: | Per-target override of the request-level per-swap slippage tolerance in percent. | |
@@ -0,0 +1,19 @@
1
+ # RebalanceTargetMaxSlippagePercent
2
+
3
+ Per-target override of the request-level per-swap slippage tolerance in percent.
4
+
5
+
6
+ ## Supported Types
7
+
8
+ ### `number`
9
+
10
+ ```typescript
11
+ const value: number = 1284.03;
12
+ ```
13
+
14
+ ### `string`
15
+
16
+ ```typescript
17
+ const value: string = "<value>";
18
+ ```
19
+
@@ -0,0 +1,44 @@
1
+ # RebalanceTargetPreview
2
+
3
+ Projected end state of ONE named target, computed on guaranteed swap floors.
4
+
5
+ ## Example Usage
6
+
7
+ ```typescript
8
+ import { RebalanceTargetPreview } from "@compass-labs/api-sdk/models/components";
9
+
10
+ let value: RebalanceTargetPreview = {
11
+ protocol: "EULER",
12
+ collateralToken: "<value>",
13
+ borrowToken: "<value>",
14
+ direction: "lever_down",
15
+ legs: 71235,
16
+ unloopLegs: [],
17
+ loopLegs: [],
18
+ resultingCollateral: "<value>",
19
+ resultingDebt: "<value>",
20
+ resultingMultiplier: "<value>",
21
+ resultingHealthFactor: "<value>",
22
+ healthFactorScope: "account",
23
+ estimatedMaxDust: "<value>",
24
+ };
25
+ ```
26
+
27
+ ## Fields
28
+
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. ``EULER`` opts in to the<br/>Euler V2 path, where the market is identified by EVK vault address(es).<br/>``MORPHO`` identifies Morpho Blue lending markets (bytes32 market id) and is<br/>currently read-only: positions and market discovery only — transaction<br/>builders land with the looping work (COM-7106/7107/7108), so transact<br/>endpoints reject it with a 422. | |
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. | |
@@ -0,0 +1,17 @@
1
+ # RebalanceTargetPreviewHealthFactorScope
2
+
3
+ '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.
4
+
5
+ ## Example Usage
6
+
7
+ ```typescript
8
+ import { RebalanceTargetPreviewHealthFactorScope } from "@compass-labs/api-sdk/models/components";
9
+
10
+ let value: RebalanceTargetPreviewHealthFactorScope = "account";
11
+ ```
12
+
13
+ ## Values
14
+
15
+ ```typescript
16
+ "market" | "account"
17
+ ```
@@ -0,0 +1,19 @@
1
+ # RebalanceTargetTargetMultiplier
2
+
3
+ LEVERAGE knob: total collateral exposure ÷ equity. 1 means unlevered supplied collateral. The protocol maximum is enforced when the plan is built.
4
+
5
+
6
+ ## Supported Types
7
+
8
+ ### `number`
9
+
10
+ ```typescript
11
+ const value: number = 1284.03;
12
+ ```
13
+
14
+ ### `string`
15
+
16
+ ```typescript
17
+ const value: string = "<value>";
18
+ ```
19
+
@@ -0,0 +1,27 @@
1
+ # RoutingSwapPreview
2
+
3
+ One Phase-B capital-routing swap that moves freed tokens between positions.
4
+
5
+ Book-level: it is not attributable to a single target.
6
+
7
+ ## Example Usage
8
+
9
+ ```typescript
10
+ import { RoutingSwapPreview } from "@compass-labs/api-sdk/models/components";
11
+
12
+ let value: RoutingSwapPreview = {
13
+ tokenIn: "<value>",
14
+ tokenOut: "<value>",
15
+ amountIn: "<value>",
16
+ minAmountOut: "<value>",
17
+ };
18
+ ```
19
+
20
+ ## Fields
21
+
22
+ | Field | Type | Required | Description |
23
+ | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
24
+ | `tokenIn` | *string* | :heavy_check_mark: | Token sold by the Credit Account into this routing swap. |
25
+ | `tokenOut` | *string* | :heavy_check_mark: | Token bought and delivered to fund a consuming position. |
26
+ | `amountIn` | *string* | :heavy_check_mark: | Token-in amount the Credit Account gives up to this swap. |
27
+ | `minAmountOut` | *string* | :heavy_check_mark: | Guaranteed minimum output (token-out units), enforced on-chain by the swap's minimum-return. Any fill above it stays in the Credit Account as recoverable dust. |
@@ -0,0 +1,19 @@
1
+ # TargetEquityUsd
2
+
3
+ SIZE knob: the net value (collateral − debt, in USD) to commit to this position; total collateral ≈ target_equity_usd × target_multiplier. To remove a position use close=true, never target_equity_usd=0.
4
+
5
+
6
+ ## Supported Types
7
+
8
+ ### `number`
9
+
10
+ ```typescript
11
+ const value: number = 1284.03;
12
+ ```
13
+
14
+ ### `string`
15
+
16
+ ```typescript
17
+ const value: string = "<value>";
18
+ ```
19
+