@compass-labs/api-sdk 2.2.79 → 2.2.80-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -3
- package/codeSamples_typescript.yaml +6 -0
- package/dist/commonjs/funcs/creditCreditRebalance.d.ts +45 -0
- package/dist/commonjs/funcs/creditCreditRebalance.d.ts.map +1 -0
- package/dist/commonjs/funcs/creditCreditRebalance.js +146 -0
- package/dist/commonjs/funcs/creditCreditRebalance.js.map +1 -0
- package/dist/commonjs/lib/config.d.ts +2 -2
- package/dist/commonjs/lib/config.js +2 -2
- package/dist/commonjs/models/components/creditrebalancepreview.d.ts +38 -0
- package/dist/commonjs/models/components/creditrebalancepreview.d.ts.map +1 -0
- package/dist/commonjs/models/components/creditrebalancepreview.js +67 -0
- package/dist/commonjs/models/components/creditrebalancepreview.js.map +1 -0
- package/dist/commonjs/models/components/creditrebalancerequest.d.ts +54 -0
- package/dist/commonjs/models/components/creditrebalancerequest.d.ts.map +1 -0
- package/dist/commonjs/models/components/creditrebalancerequest.js +67 -0
- package/dist/commonjs/models/components/creditrebalancerequest.js.map +1 -0
- package/dist/commonjs/models/components/creditrebalanceresponse.d.ts +27 -0
- package/dist/commonjs/models/components/creditrebalanceresponse.d.ts.map +1 -0
- package/dist/commonjs/models/components/creditrebalanceresponse.js +61 -0
- package/dist/commonjs/models/components/creditrebalanceresponse.js.map +1 -0
- package/dist/commonjs/models/components/creditunlooprequest.d.ts +4 -4
- package/dist/commonjs/models/components/creditunlooprequest.d.ts.map +1 -1
- package/dist/commonjs/models/components/creditunlooprequest.js +5 -5
- package/dist/commonjs/models/components/creditunlooprequest.js.map +1 -1
- package/dist/commonjs/models/components/index.d.ts +7 -0
- package/dist/commonjs/models/components/index.d.ts.map +1 -1
- package/dist/commonjs/models/components/index.js +7 -0
- package/dist/commonjs/models/components/index.js.map +1 -1
- package/dist/commonjs/models/components/loopedpositioncurrentstate.d.ts +4 -4
- package/dist/commonjs/models/components/loopedpositioncurrentstate.d.ts.map +1 -1
- package/dist/commonjs/models/components/loopedpositioncurrentstate.js +5 -4
- package/dist/commonjs/models/components/loopedpositioncurrentstate.js.map +1 -1
- package/dist/commonjs/models/components/rebalancedirection.d.ts +21 -0
- package/dist/commonjs/models/components/rebalancedirection.d.ts.map +1 -0
- package/dist/commonjs/models/components/rebalancedirection.js +55 -0
- package/dist/commonjs/models/components/rebalancedirection.js.map +1 -0
- package/dist/commonjs/models/components/rebalancetarget.d.ts +97 -0
- package/dist/commonjs/models/components/rebalancetarget.d.ts.map +1 -0
- package/dist/commonjs/models/components/rebalancetarget.js +85 -0
- package/dist/commonjs/models/components/rebalancetarget.js.map +1 -0
- package/dist/commonjs/models/components/rebalancetargetpreview.d.ts +96 -0
- package/dist/commonjs/models/components/rebalancetargetpreview.d.ts.map +1 -0
- package/dist/commonjs/models/components/rebalancetargetpreview.js +92 -0
- package/dist/commonjs/models/components/rebalancetargetpreview.js.map +1 -0
- package/dist/commonjs/models/components/routingswappreview.d.ts +32 -0
- package/dist/commonjs/models/components/routingswappreview.d.ts.map +1 -0
- package/dist/commonjs/models/components/routingswappreview.js +61 -0
- package/dist/commonjs/models/components/routingswappreview.js.map +1 -0
- package/dist/commonjs/sdk/credit.d.ts +34 -0
- package/dist/commonjs/sdk/credit.d.ts.map +1 -1
- package/dist/commonjs/sdk/credit.js +37 -0
- package/dist/commonjs/sdk/credit.js.map +1 -1
- package/dist/esm/funcs/creditCreditRebalance.d.ts +45 -0
- package/dist/esm/funcs/creditCreditRebalance.d.ts.map +1 -0
- package/dist/esm/funcs/creditCreditRebalance.js +110 -0
- package/dist/esm/funcs/creditCreditRebalance.js.map +1 -0
- package/dist/esm/lib/config.d.ts +2 -2
- package/dist/esm/lib/config.js +2 -2
- package/dist/esm/models/components/creditrebalancepreview.d.ts +38 -0
- package/dist/esm/models/components/creditrebalancepreview.d.ts.map +1 -0
- package/dist/esm/models/components/creditrebalancepreview.js +30 -0
- package/dist/esm/models/components/creditrebalancepreview.js.map +1 -0
- package/dist/esm/models/components/creditrebalancerequest.d.ts +54 -0
- package/dist/esm/models/components/creditrebalancerequest.d.ts.map +1 -0
- package/dist/esm/models/components/creditrebalancerequest.js +29 -0
- package/dist/esm/models/components/creditrebalancerequest.js.map +1 -0
- package/dist/esm/models/components/creditrebalanceresponse.d.ts +27 -0
- package/dist/esm/models/components/creditrebalanceresponse.d.ts.map +1 -0
- package/dist/esm/models/components/creditrebalanceresponse.js +24 -0
- package/dist/esm/models/components/creditrebalanceresponse.js.map +1 -0
- package/dist/esm/models/components/creditunlooprequest.d.ts +4 -4
- package/dist/esm/models/components/creditunlooprequest.d.ts.map +1 -1
- package/dist/esm/models/components/creditunlooprequest.js +3 -3
- package/dist/esm/models/components/creditunlooprequest.js.map +1 -1
- package/dist/esm/models/components/index.d.ts +7 -0
- package/dist/esm/models/components/index.d.ts.map +1 -1
- package/dist/esm/models/components/index.js +7 -0
- package/dist/esm/models/components/index.js.map +1 -1
- package/dist/esm/models/components/loopedpositioncurrentstate.d.ts +4 -4
- package/dist/esm/models/components/loopedpositioncurrentstate.d.ts.map +1 -1
- package/dist/esm/models/components/loopedpositioncurrentstate.js +4 -3
- package/dist/esm/models/components/loopedpositioncurrentstate.js.map +1 -1
- package/dist/esm/models/components/rebalancedirection.d.ts +21 -0
- package/dist/esm/models/components/rebalancedirection.d.ts.map +1 -0
- package/dist/esm/models/components/rebalancedirection.js +19 -0
- package/dist/esm/models/components/rebalancedirection.js.map +1 -0
- package/dist/esm/models/components/rebalancetarget.d.ts +97 -0
- package/dist/esm/models/components/rebalancetarget.d.ts.map +1 -0
- package/dist/esm/models/components/rebalancetarget.js +45 -0
- package/dist/esm/models/components/rebalancetarget.js.map +1 -0
- package/dist/esm/models/components/rebalancetargetpreview.d.ts +96 -0
- package/dist/esm/models/components/rebalancetargetpreview.d.ts.map +1 -0
- package/dist/esm/models/components/rebalancetargetpreview.js +55 -0
- package/dist/esm/models/components/rebalancetargetpreview.js.map +1 -0
- package/dist/esm/models/components/routingswappreview.d.ts +32 -0
- package/dist/esm/models/components/routingswappreview.d.ts.map +1 -0
- package/dist/esm/models/components/routingswappreview.js +24 -0
- package/dist/esm/models/components/routingswappreview.js.map +1 -0
- package/dist/esm/sdk/credit.d.ts +34 -0
- package/dist/esm/sdk/credit.d.ts.map +1 -1
- package/dist/esm/sdk/credit.js +37 -0
- package/dist/esm/sdk/credit.js.map +1 -1
- package/docs/models/components/creditrebalancepreview.md +44 -0
- package/docs/models/components/creditrebalancerequest.md +37 -0
- package/docs/models/components/creditrebalancerequestmaxslippagepercent.md +19 -0
- package/docs/models/components/creditrebalanceresponse.md +27 -0
- package/docs/models/components/creditunlooprequest.md +1 -1
- package/docs/models/components/{targetmultiplier.md → creditunlooprequesttargetmultiplier.md} +1 -1
- package/docs/models/components/loopedpositioncurrentstate.md +1 -1
- package/docs/models/components/{healthfactorscope.md → loopedpositioncurrentstatehealthfactorscope.md} +3 -3
- package/docs/models/components/rebalancedirection.md +17 -0
- package/docs/models/components/rebalancetarget.md +32 -0
- package/docs/models/components/rebalancetargetmaxslippagepercent.md +19 -0
- package/docs/models/components/rebalancetargetpreview.md +44 -0
- package/docs/models/components/rebalancetargetpreviewhealthfactorscope.md +17 -0
- package/docs/models/components/rebalancetargettargetmultiplier.md +19 -0
- package/docs/models/components/routingswappreview.md +27 -0
- package/docs/models/components/targetequityusd.md +19 -0
- package/docs/sdks/credit/README.md +124 -0
- package/openapi_prepped_for_speakeasy.json +465 -0
- package/package.json +1 -1
- package/src/funcs/creditCreditRebalance.ts +198 -0
- package/src/lib/config.ts +2 -2
- package/src/models/components/creditrebalancepreview.ts +80 -0
- package/src/models/components/creditrebalancerequest.ts +104 -0
- package/src/models/components/creditrebalanceresponse.ts +65 -0
- package/src/models/components/creditunlooprequest.ts +10 -8
- package/src/models/components/index.ts +7 -0
- package/src/models/components/loopedpositioncurrentstate.ts +10 -7
- package/src/models/components/rebalancedirection.ts +28 -0
- package/src/models/components/rebalancetarget.ts +178 -0
- package/src/models/components/rebalancetargetpreview.ts +163 -0
- package/src/models/components/routingswappreview.ts +64 -0
- package/src/sdk/credit.ts +45 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import * as z from "zod/v3";
|
|
2
|
+
import { ClosedEnum } from "../../types/enums.js";
|
|
3
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
4
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
5
|
+
import { CreditProtocol } from "./creditprotocol.js";
|
|
6
|
+
import { LoopLegPreview } from "./looplegpreview.js";
|
|
7
|
+
import { RebalanceDirection } from "./rebalancedirection.js";
|
|
8
|
+
import { UnloopLegPreview } from "./unlooplegpreview.js";
|
|
9
|
+
/**
|
|
10
|
+
* '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.
|
|
11
|
+
*/
|
|
12
|
+
export declare const RebalanceTargetPreviewHealthFactorScope: {
|
|
13
|
+
readonly Market: "market";
|
|
14
|
+
readonly Account: "account";
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* '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.
|
|
18
|
+
*/
|
|
19
|
+
export type RebalanceTargetPreviewHealthFactorScope = ClosedEnum<typeof RebalanceTargetPreviewHealthFactorScope>;
|
|
20
|
+
/**
|
|
21
|
+
* Projected end state of ONE named target, computed on guaranteed swap floors.
|
|
22
|
+
*/
|
|
23
|
+
export type RebalanceTargetPreview = {
|
|
24
|
+
/**
|
|
25
|
+
* Which lending protocol a credit action targets.
|
|
26
|
+
*
|
|
27
|
+
* @remarks
|
|
28
|
+
*
|
|
29
|
+
* ``AAVE`` is the default so existing callers (which never send a ``protocol``
|
|
30
|
+
* field) keep hitting the unchanged Aave code path. ``EULER`` opts in to the
|
|
31
|
+
* Euler V2 path, where the market is identified by EVK vault address(es).
|
|
32
|
+
* ``MORPHO`` identifies Morpho Blue lending markets (bytes32 market id) and is
|
|
33
|
+
* currently read-only: positions and market discovery only — transaction
|
|
34
|
+
* builders land with the looping work (COM-7106/7107/7108), so transact
|
|
35
|
+
* endpoints reject it with a 422.
|
|
36
|
+
*/
|
|
37
|
+
protocol: CreditProtocol;
|
|
38
|
+
/**
|
|
39
|
+
* Morpho only: the bytes32 market id of this position.
|
|
40
|
+
*/
|
|
41
|
+
marketId?: string | null | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Collateral token address (echoes the request target; joins against /v2/credit/looped_positions).
|
|
44
|
+
*/
|
|
45
|
+
collateralToken: string;
|
|
46
|
+
/**
|
|
47
|
+
* Borrow token address (echoes the request target).
|
|
48
|
+
*/
|
|
49
|
+
borrowToken: string;
|
|
50
|
+
/**
|
|
51
|
+
* What the plan does to one named target.
|
|
52
|
+
*/
|
|
53
|
+
direction: RebalanceDirection;
|
|
54
|
+
/**
|
|
55
|
+
* On-chain legs planned for this target (loop + unloop iterations); 0 for a noop.
|
|
56
|
+
*/
|
|
57
|
+
legs: number;
|
|
58
|
+
/**
|
|
59
|
+
* Per-iteration unwind breakdown — populated for releasers (close / shrink / lever_down).
|
|
60
|
+
*/
|
|
61
|
+
unloopLegs?: Array<UnloopLegPreview> | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* Per-iteration loop breakdown — populated for consumers (open / grow / lever_up).
|
|
64
|
+
*/
|
|
65
|
+
loopLegs?: Array<LoopLegPreview> | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* Guaranteed minimum collateral supplied to this position after the rebalance (token units).
|
|
68
|
+
*/
|
|
69
|
+
resultingCollateral: string;
|
|
70
|
+
/**
|
|
71
|
+
* Projected debt owed by this position after the rebalance (borrow-token units); 0 on a close.
|
|
72
|
+
*/
|
|
73
|
+
resultingDebt: string;
|
|
74
|
+
/**
|
|
75
|
+
* 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.
|
|
76
|
+
*/
|
|
77
|
+
resultingMultiplier: string;
|
|
78
|
+
/**
|
|
79
|
+
* 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.
|
|
80
|
+
*/
|
|
81
|
+
resultingHealthFactor: string;
|
|
82
|
+
/**
|
|
83
|
+
* '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.
|
|
84
|
+
*/
|
|
85
|
+
healthFactorScope: RebalanceTargetPreviewHealthFactorScope;
|
|
86
|
+
/**
|
|
87
|
+
* 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.
|
|
88
|
+
*/
|
|
89
|
+
estimatedMaxDust: string;
|
|
90
|
+
};
|
|
91
|
+
/** @internal */
|
|
92
|
+
export declare const RebalanceTargetPreviewHealthFactorScope$inboundSchema: z.ZodNativeEnum<typeof RebalanceTargetPreviewHealthFactorScope>;
|
|
93
|
+
/** @internal */
|
|
94
|
+
export declare const RebalanceTargetPreview$inboundSchema: z.ZodType<RebalanceTargetPreview, z.ZodTypeDef, unknown>;
|
|
95
|
+
export declare function rebalanceTargetPreviewFromJSON(jsonString: string): SafeParseResult<RebalanceTargetPreview, SDKValidationError>;
|
|
96
|
+
//# sourceMappingURL=rebalancetargetpreview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rebalancetargetpreview.d.ts","sourceRoot":"","sources":["../../../../src/models/components/rebalancetargetpreview.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAG5B,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAA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CAAuC,CACR,CAAC;AAEzD,gBAAgB;AAChB,eAAO,MAAM,oCAAoC,EAAE,CAAC,CAAC,OAAO,CAC1D,sBAAsB,EACtB,CAAC,CAAC,UAAU,EACZ,OAAO,CA8BP,CAAC;AAEH,wBAAgB,8BAA8B,CAC5C,UAAU,EAAE,MAAM,GACjB,eAAe,CAAC,sBAAsB,EAAE,kBAAkB,CAAC,CAM7D"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.RebalanceTargetPreview$inboundSchema = exports.RebalanceTargetPreviewHealthFactorScope$inboundSchema = exports.RebalanceTargetPreviewHealthFactorScope = void 0;
|
|
40
|
+
exports.rebalanceTargetPreviewFromJSON = rebalanceTargetPreviewFromJSON;
|
|
41
|
+
const z = __importStar(require("zod/v3"));
|
|
42
|
+
const primitives_js_1 = require("../../lib/primitives.js");
|
|
43
|
+
const schemas_js_1 = require("../../lib/schemas.js");
|
|
44
|
+
const creditprotocol_js_1 = require("./creditprotocol.js");
|
|
45
|
+
const looplegpreview_js_1 = require("./looplegpreview.js");
|
|
46
|
+
const rebalancedirection_js_1 = require("./rebalancedirection.js");
|
|
47
|
+
const unlooplegpreview_js_1 = require("./unlooplegpreview.js");
|
|
48
|
+
/**
|
|
49
|
+
* '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.
|
|
50
|
+
*/
|
|
51
|
+
exports.RebalanceTargetPreviewHealthFactorScope = {
|
|
52
|
+
Market: "market",
|
|
53
|
+
Account: "account",
|
|
54
|
+
};
|
|
55
|
+
/** @internal */
|
|
56
|
+
exports.RebalanceTargetPreviewHealthFactorScope$inboundSchema = z
|
|
57
|
+
.nativeEnum(exports.RebalanceTargetPreviewHealthFactorScope);
|
|
58
|
+
/** @internal */
|
|
59
|
+
exports.RebalanceTargetPreview$inboundSchema = z.object({
|
|
60
|
+
protocol: creditprotocol_js_1.CreditProtocol$inboundSchema,
|
|
61
|
+
market_id: z.nullable(z.string()).optional(),
|
|
62
|
+
collateral_token: z.string(),
|
|
63
|
+
borrow_token: z.string(),
|
|
64
|
+
direction: rebalancedirection_js_1.RebalanceDirection$inboundSchema,
|
|
65
|
+
legs: z.number().int(),
|
|
66
|
+
unloop_legs: z.array(unlooplegpreview_js_1.UnloopLegPreview$inboundSchema).optional(),
|
|
67
|
+
loop_legs: z.array(looplegpreview_js_1.LoopLegPreview$inboundSchema).optional(),
|
|
68
|
+
resulting_collateral: z.string(),
|
|
69
|
+
resulting_debt: z.string(),
|
|
70
|
+
resulting_multiplier: z.string(),
|
|
71
|
+
resulting_health_factor: z.string(),
|
|
72
|
+
health_factor_scope: exports.RebalanceTargetPreviewHealthFactorScope$inboundSchema,
|
|
73
|
+
estimated_max_dust: z.string(),
|
|
74
|
+
}).transform((v) => {
|
|
75
|
+
return (0, primitives_js_1.remap)(v, {
|
|
76
|
+
"market_id": "marketId",
|
|
77
|
+
"collateral_token": "collateralToken",
|
|
78
|
+
"borrow_token": "borrowToken",
|
|
79
|
+
"unloop_legs": "unloopLegs",
|
|
80
|
+
"loop_legs": "loopLegs",
|
|
81
|
+
"resulting_collateral": "resultingCollateral",
|
|
82
|
+
"resulting_debt": "resultingDebt",
|
|
83
|
+
"resulting_multiplier": "resultingMultiplier",
|
|
84
|
+
"resulting_health_factor": "resultingHealthFactor",
|
|
85
|
+
"health_factor_scope": "healthFactorScope",
|
|
86
|
+
"estimated_max_dust": "estimatedMaxDust",
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
function rebalanceTargetPreviewFromJSON(jsonString) {
|
|
90
|
+
return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.RebalanceTargetPreview$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'RebalanceTargetPreview' from JSON`);
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=rebalancetargetpreview.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rebalancetargetpreview.js","sourceRoot":"","sources":["../../../../src/models/components/rebalancetargetpreview.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C,CAAC,EAAE;QACf,WAAW,EAAE,UAAU;QACvB,kBAAkB,EAAE,iBAAiB;QACrC,cAAc,EAAE,aAAa;QAC7B,aAAa,EAAE,YAAY;QAC3B,WAAW,EAAE,UAAU;QACvB,sBAAsB,EAAE,qBAAqB;QAC7C,gBAAgB,EAAE,eAAe;QACjC,sBAAsB,EAAE,qBAAqB;QAC7C,yBAAyB,EAAE,uBAAuB;QAClD,qBAAqB,EAAE,mBAAmB;QAC1C,oBAAoB,EAAE,kBAAkB;KACzC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,SAAgB,8BAA8B,CAC5C,UAAkB;IAElB,OAAO,IAAA,sBAAS,EACd,UAAU,EACV,CAAC,CAAC,EAAE,EAAE,CAAC,4CAAoC,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAChE,oDAAoD,CACrD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as z from "zod/v3";
|
|
2
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
3
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
4
|
+
/**
|
|
5
|
+
* One Phase-B capital-routing swap that moves freed tokens between positions.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
*
|
|
9
|
+
* Book-level: it is not attributable to a single target.
|
|
10
|
+
*/
|
|
11
|
+
export type RoutingSwapPreview = {
|
|
12
|
+
/**
|
|
13
|
+
* Token sold by the Credit Account into this routing swap.
|
|
14
|
+
*/
|
|
15
|
+
tokenIn: string;
|
|
16
|
+
/**
|
|
17
|
+
* Token bought and delivered to fund a consuming position.
|
|
18
|
+
*/
|
|
19
|
+
tokenOut: string;
|
|
20
|
+
/**
|
|
21
|
+
* Token-in amount the Credit Account gives up to this swap.
|
|
22
|
+
*/
|
|
23
|
+
amountIn: string;
|
|
24
|
+
/**
|
|
25
|
+
* 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.
|
|
26
|
+
*/
|
|
27
|
+
minAmountOut: string;
|
|
28
|
+
};
|
|
29
|
+
/** @internal */
|
|
30
|
+
export declare const RoutingSwapPreview$inboundSchema: z.ZodType<RoutingSwapPreview, z.ZodTypeDef, unknown>;
|
|
31
|
+
export declare function routingSwapPreviewFromJSON(jsonString: string): SafeParseResult<RoutingSwapPreview, SDKValidationError>;
|
|
32
|
+
//# sourceMappingURL=routingswappreview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routingswappreview.d.ts","sourceRoot":"","sources":["../../../../src/models/components/routingswappreview.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAG5B,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAErE;;;;;;GAMG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,gBAAgB;AAChB,eAAO,MAAM,gCAAgC,EAAE,CAAC,CAAC,OAAO,CACtD,kBAAkB,EAClB,CAAC,CAAC,UAAU,EACZ,OAAO,CAaP,CAAC;AAEH,wBAAgB,0BAA0B,CACxC,UAAU,EAAE,MAAM,GACjB,eAAe,CAAC,kBAAkB,EAAE,kBAAkB,CAAC,CAMzD"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.RoutingSwapPreview$inboundSchema = void 0;
|
|
40
|
+
exports.routingSwapPreviewFromJSON = routingSwapPreviewFromJSON;
|
|
41
|
+
const z = __importStar(require("zod/v3"));
|
|
42
|
+
const primitives_js_1 = require("../../lib/primitives.js");
|
|
43
|
+
const schemas_js_1 = require("../../lib/schemas.js");
|
|
44
|
+
/** @internal */
|
|
45
|
+
exports.RoutingSwapPreview$inboundSchema = z.object({
|
|
46
|
+
token_in: z.string(),
|
|
47
|
+
token_out: z.string(),
|
|
48
|
+
amount_in: z.string(),
|
|
49
|
+
min_amount_out: z.string(),
|
|
50
|
+
}).transform((v) => {
|
|
51
|
+
return (0, primitives_js_1.remap)(v, {
|
|
52
|
+
"token_in": "tokenIn",
|
|
53
|
+
"token_out": "tokenOut",
|
|
54
|
+
"amount_in": "amountIn",
|
|
55
|
+
"min_amount_out": "minAmountOut",
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
function routingSwapPreviewFromJSON(jsonString) {
|
|
59
|
+
return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.RoutingSwapPreview$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'RoutingSwapPreview' from JSON`);
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=routingswappreview.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routingswappreview.js","sourceRoot":"","sources":["../../../../src/models/components/routingswappreview.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqDH,gEAQC;AA3DD,0CAA4B;AAC5B,2DAA0D;AAC1D,qDAAiD;AA8BjD,gBAAgB;AACH,QAAA,gCAAgC,GAIzC,CAAC,CAAC,MAAM,CAAC;IACX,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE;CAC3B,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE;IACjB,OAAO,IAAA,qBAAM,EAAC,CAAC,EAAE;QACf,UAAU,EAAE,SAAS;QACrB,WAAW,EAAE,UAAU;QACvB,WAAW,EAAE,UAAU;QACvB,gBAAgB,EAAE,cAAc;KACjC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,SAAgB,0BAA0B,CACxC,UAAkB;IAElB,OAAO,IAAA,sBAAS,EACd,UAAU,EACV,CAAC,CAAC,EAAE,EAAE,CAAC,wCAAgC,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAC5D,gDAAgD,CACjD,CAAC;AACJ,CAAC"}
|
|
@@ -138,6 +138,40 @@ export declare class Credit extends ClientSDK {
|
|
|
138
138
|
* open loops via /v2/credit/looped_positions.
|
|
139
139
|
*/
|
|
140
140
|
creditUnloop(request: components.CreditUnloopRequest, options?: RequestOptions): Promise<components.CreditUnloopResponse>;
|
|
141
|
+
/**
|
|
142
|
+
* Rebalance the leveraged credit book
|
|
143
|
+
*
|
|
144
|
+
* @remarks
|
|
145
|
+
* Rebalance the leveraged credit book in ONE atomic transaction.
|
|
146
|
+
*
|
|
147
|
+
* List only the positions to change — anything not named is left untouched;
|
|
148
|
+
* remove a position with close=true. Each target states an end state:
|
|
149
|
+
* target_equity_usd (net USD committed) × target_multiplier.
|
|
150
|
+
*
|
|
151
|
+
* Releasing targets run first (each unwind/delever frees tokens into the Credit
|
|
152
|
+
* Account), the freed tokens are then routed by swaps at a GUARANTEED minimum
|
|
153
|
+
* output (enforced on-chain), and consuming targets run last — so moving a
|
|
154
|
+
* levered position between markets, token pairs, or protocols (Aave ↔ Morpho) is
|
|
155
|
+
* simply a close plus an open in the same transaction.
|
|
156
|
+
*
|
|
157
|
+
* Net book growth is funded from the Credit Account's existing idle balance —
|
|
158
|
+
* fund it first via /v2/credit/transfer; a net release stays in the Credit
|
|
159
|
+
* Account as idle balance. Any swap surplus above the guaranteed floors also
|
|
160
|
+
* stays in the Credit Account (preview.estimated_max_dust) — recoverable, never
|
|
161
|
+
* lost.
|
|
162
|
+
*
|
|
163
|
+
* A book already at its target returns transaction: null with the preview — the
|
|
164
|
+
* call is idempotent and safe to drive from a converge-to-target loop.
|
|
165
|
+
*
|
|
166
|
+
* A rebalance too large for one transaction is rejected with a 422 — split it
|
|
167
|
+
* into two calls. Every deleveraging step keeps the health factor ≥ 1.02 and
|
|
168
|
+
* every leveraging step respects the protocol's borrow limits; Aave targets share
|
|
169
|
+
* one account-level health factor, which the preview reports.
|
|
170
|
+
*
|
|
171
|
+
* For protocol=MORPHO pass a market_id from /v2/credit/morpho_markets; inspect the
|
|
172
|
+
* current book via /v2/credit/looped_positions.
|
|
173
|
+
*/
|
|
174
|
+
creditRebalance(request: components.CreditRebalanceRequest, options?: RequestOptions): Promise<components.CreditRebalanceResponse>;
|
|
141
175
|
/**
|
|
142
176
|
* Transfer tokens to/from Credit Account
|
|
143
177
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credit.d.ts","sourceRoot":"","sources":["../../../src/sdk/credit.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"credit.d.ts","sourceRoot":"","sources":["../../../src/sdk/credit.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,UAAU,MAAM,+BAA+B,CAAC;AAC5D,OAAO,KAAK,UAAU,MAAM,+BAA+B,CAAC;AAG5D,qBAAa,MAAO,SAAQ,SAAS;IACnC;;;;;;;;OAQG;IACG,eAAe,CACnB,OAAO,EAAE,UAAU,CAAC,wBAAwB,EAC5C,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,UAAU,CAAC,uBAAuB,CAAC;IAQ9C;;;;;;;;OAQG;IACG,cAAc,CAClB,OAAO,EAAE,UAAU,CAAC,uBAAuB,EAC3C,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,UAAU,CAAC,sBAAsB,CAAC;IAQ7C;;;;;;;;;;;;OAYG;IACG,qBAAqB,CACzB,OAAO,EAAE,UAAU,CAAC,8BAA8B,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,CAClB,OAAO,EAAE,UAAU,CAAC,qBAAqB,EACzC,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,UAAU,CAAC,sBAAsB,CAAC;IAQ7C;;;;;;;;;;;;;OAaG;IACG,WAAW,CACf,OAAO,EAAE,UAAU,CAAC,kBAAkB,EACtC,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,UAAU,CAAC,mBAAmB,CAAC;IAQ1C;;;;;;;;OAQG;IACG,YAAY,CAChB,OAAO,EAAE,UAAU,CAAC,mBAAmB,EACvC,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,UAAU,CAAC,oBAAoB,CAAC;CAO5C"}
|
|
@@ -13,6 +13,7 @@ const creditCreditLoop_js_1 = require("../funcs/creditCreditLoop.js");
|
|
|
13
13
|
const creditCreditLoopedPositions_js_1 = require("../funcs/creditCreditLoopedPositions.js");
|
|
14
14
|
const creditCreditMorphoMarkets_js_1 = require("../funcs/creditCreditMorphoMarkets.js");
|
|
15
15
|
const creditCreditPositions_js_1 = require("../funcs/creditCreditPositions.js");
|
|
16
|
+
const creditCreditRebalance_js_1 = require("../funcs/creditCreditRebalance.js");
|
|
16
17
|
const creditCreditRepay_js_1 = require("../funcs/creditCreditRepay.js");
|
|
17
18
|
const creditCreditTransfer_js_1 = require("../funcs/creditCreditTransfer.js");
|
|
18
19
|
const creditCreditUnloop_js_1 = require("../funcs/creditCreditUnloop.js");
|
|
@@ -173,6 +174,42 @@ class Credit extends sdks_js_1.ClientSDK {
|
|
|
173
174
|
async creditUnloop(request, options) {
|
|
174
175
|
return (0, fp_js_1.unwrapAsync)((0, creditCreditUnloop_js_1.creditCreditUnloop)(this, request, options));
|
|
175
176
|
}
|
|
177
|
+
/**
|
|
178
|
+
* Rebalance the leveraged credit book
|
|
179
|
+
*
|
|
180
|
+
* @remarks
|
|
181
|
+
* Rebalance the leveraged credit book in ONE atomic transaction.
|
|
182
|
+
*
|
|
183
|
+
* List only the positions to change — anything not named is left untouched;
|
|
184
|
+
* remove a position with close=true. Each target states an end state:
|
|
185
|
+
* target_equity_usd (net USD committed) × target_multiplier.
|
|
186
|
+
*
|
|
187
|
+
* Releasing targets run first (each unwind/delever frees tokens into the Credit
|
|
188
|
+
* Account), the freed tokens are then routed by swaps at a GUARANTEED minimum
|
|
189
|
+
* output (enforced on-chain), and consuming targets run last — so moving a
|
|
190
|
+
* levered position between markets, token pairs, or protocols (Aave ↔ Morpho) is
|
|
191
|
+
* simply a close plus an open in the same transaction.
|
|
192
|
+
*
|
|
193
|
+
* Net book growth is funded from the Credit Account's existing idle balance —
|
|
194
|
+
* fund it first via /v2/credit/transfer; a net release stays in the Credit
|
|
195
|
+
* Account as idle balance. Any swap surplus above the guaranteed floors also
|
|
196
|
+
* stays in the Credit Account (preview.estimated_max_dust) — recoverable, never
|
|
197
|
+
* lost.
|
|
198
|
+
*
|
|
199
|
+
* A book already at its target returns transaction: null with the preview — the
|
|
200
|
+
* call is idempotent and safe to drive from a converge-to-target loop.
|
|
201
|
+
*
|
|
202
|
+
* A rebalance too large for one transaction is rejected with a 422 — split it
|
|
203
|
+
* into two calls. Every deleveraging step keeps the health factor ≥ 1.02 and
|
|
204
|
+
* every leveraging step respects the protocol's borrow limits; Aave targets share
|
|
205
|
+
* one account-level health factor, which the preview reports.
|
|
206
|
+
*
|
|
207
|
+
* For protocol=MORPHO pass a market_id from /v2/credit/morpho_markets; inspect the
|
|
208
|
+
* current book via /v2/credit/looped_positions.
|
|
209
|
+
*/
|
|
210
|
+
async creditRebalance(request, options) {
|
|
211
|
+
return (0, fp_js_1.unwrapAsync)((0, creditCreditRebalance_js_1.creditCreditRebalance)(this, request, options));
|
|
212
|
+
}
|
|
176
213
|
/**
|
|
177
214
|
* Transfer tokens to/from Credit Account
|
|
178
215
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credit.js","sourceRoot":"","sources":["../../../src/sdk/credit.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,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version":3,"file":"credit.js","sourceRoot":"","sources":["../../../src/sdk/credit.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,8EAAwE;AACxE,0EAAoE;AACpE,0EAAoE;AACpE,wFAAkF;AAClF,sFAAgF;AAChF,sEAAgE;AAChE,4FAAsF;AACtF,wFAAkF;AAClF,gFAA0E;AAC1E,gFAA0E;AAC1E,wEAAkE;AAClE,8EAAwE;AACxE,0EAAoE;AACpE,4CAA2D;AAG3D,0CAA6C;AAE7C,MAAa,MAAO,SAAQ,mBAAS;IACnC;;;;;;;;OAQG;IACH,KAAK,CAAC,eAAe,CACnB,OAA4C,EAC5C,OAAwB;QAExB,OAAO,IAAA,mBAAW,EAAC,IAAA,gDAAqB,EACtC,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,cAAc,CAClB,OAA2C,EAC3C,OAAwB;QAExB,OAAO,IAAA,mBAAW,EAAC,IAAA,8CAAoB,EACrC,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,KAAK,CAAC,qBAAqB,CACzB,OAAkD,EAClD,OAAwB;QAExB,OAAO,IAAA,mBAAW,EAAC,IAAA,4DAA2B,EAC5C,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;OAUG;IACH,KAAK,CAAC,kBAAkB,CACtB,OAA+C,EAC/C,OAAwB;QAExB,OAAO,IAAA,mBAAW,EAAC,IAAA,sDAAwB,EACzC,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;OAUG;IACH,KAAK,CAAC,mBAAmB,CACvB,OAAgD,EAChD,OAAwB;QAExB,OAAO,IAAA,mBAAW,EAAC,IAAA,wDAAyB,EAC1C,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;I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wB;QAExB,OAAO,IAAA,mBAAW,EAAC,IAAA,wCAAiB,EAClC,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,YAAY,CAChB,OAAuC,EACvC,OAAwB;QAExB,OAAO,IAAA,mBAAW,EAAC,IAAA,0CAAkB,EACnC,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;CACF;AAtVD,wBAsVC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { CompassApiSDKCore } from "../core.js";
|
|
2
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
3
|
+
import * as components from "../models/components/index.js";
|
|
4
|
+
import { CompassAPISDKError } from "../models/errors/compassapisdkerror.js";
|
|
5
|
+
import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../models/errors/httpclienterrors.js";
|
|
6
|
+
import * as errors from "../models/errors/index.js";
|
|
7
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
8
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
9
|
+
import { APIPromise } from "../types/async.js";
|
|
10
|
+
import { Result } from "../types/fp.js";
|
|
11
|
+
/**
|
|
12
|
+
* Rebalance the leveraged credit book
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* Rebalance the leveraged credit book in ONE atomic transaction.
|
|
16
|
+
*
|
|
17
|
+
* List only the positions to change — anything not named is left untouched;
|
|
18
|
+
* remove a position with close=true. Each target states an end state:
|
|
19
|
+
* target_equity_usd (net USD committed) × target_multiplier.
|
|
20
|
+
*
|
|
21
|
+
* Releasing targets run first (each unwind/delever frees tokens into the Credit
|
|
22
|
+
* Account), the freed tokens are then routed by swaps at a GUARANTEED minimum
|
|
23
|
+
* output (enforced on-chain), and consuming targets run last — so moving a
|
|
24
|
+
* levered position between markets, token pairs, or protocols (Aave ↔ Morpho) is
|
|
25
|
+
* simply a close plus an open in the same transaction.
|
|
26
|
+
*
|
|
27
|
+
* Net book growth is funded from the Credit Account's existing idle balance —
|
|
28
|
+
* fund it first via /v2/credit/transfer; a net release stays in the Credit
|
|
29
|
+
* Account as idle balance. Any swap surplus above the guaranteed floors also
|
|
30
|
+
* stays in the Credit Account (preview.estimated_max_dust) — recoverable, never
|
|
31
|
+
* lost.
|
|
32
|
+
*
|
|
33
|
+
* A book already at its target returns transaction: null with the preview — the
|
|
34
|
+
* call is idempotent and safe to drive from a converge-to-target loop.
|
|
35
|
+
*
|
|
36
|
+
* A rebalance too large for one transaction is rejected with a 422 — split it
|
|
37
|
+
* into two calls. Every deleveraging step keeps the health factor ≥ 1.02 and
|
|
38
|
+
* every leveraging step respects the protocol's borrow limits; Aave targets share
|
|
39
|
+
* one account-level health factor, which the preview reports.
|
|
40
|
+
*
|
|
41
|
+
* For protocol=MORPHO pass a market_id from /v2/credit/morpho_markets; inspect the
|
|
42
|
+
* current book via /v2/credit/looped_positions.
|
|
43
|
+
*/
|
|
44
|
+
export declare function creditCreditRebalance(client: CompassApiSDKCore, request: components.CreditRebalanceRequest, options?: RequestOptions): APIPromise<Result<components.CreditRebalanceResponse, errors.HTTPValidationError | CompassAPISDKError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
45
|
+
//# sourceMappingURL=creditCreditRebalance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"creditCreditRebalance.d.ts","sourceRoot":"","sources":["../../../src/funcs/creditCreditRebalance.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAM/C,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGhD,OAAO,KAAK,UAAU,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACtB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,MAAM,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AACtF,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAW,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,iBAAiB,EACzB,OAAO,EAAE,UAAU,CAAC,sBAAsB,EAC1C,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CACX,MAAM,CACJ,UAAU,CAAC,uBAAuB,EAChC,MAAM,CAAC,mBAAmB,GAC1B,kBAAkB,GAClB,uBAAuB,GACvB,eAAe,GACf,mBAAmB,GACnB,mBAAmB,GACnB,mBAAmB,GACnB,qBAAqB,GACrB,kBAAkB,CACrB,CACF,CAMA"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
import { encodeJSON } from "../lib/encodings.js";
|
|
5
|
+
import { matchStatusCode } from "../lib/http.js";
|
|
6
|
+
import * as M from "../lib/matchers.js";
|
|
7
|
+
import { compactMap } from "../lib/primitives.js";
|
|
8
|
+
import { safeParse } from "../lib/schemas.js";
|
|
9
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
10
|
+
import { pathToFunc } from "../lib/url.js";
|
|
11
|
+
import * as components from "../models/components/index.js";
|
|
12
|
+
import * as errors from "../models/errors/index.js";
|
|
13
|
+
import { APIPromise } from "../types/async.js";
|
|
14
|
+
/**
|
|
15
|
+
* Rebalance the leveraged credit book
|
|
16
|
+
*
|
|
17
|
+
* @remarks
|
|
18
|
+
* Rebalance the leveraged credit book in ONE atomic transaction.
|
|
19
|
+
*
|
|
20
|
+
* List only the positions to change — anything not named is left untouched;
|
|
21
|
+
* remove a position with close=true. Each target states an end state:
|
|
22
|
+
* target_equity_usd (net USD committed) × target_multiplier.
|
|
23
|
+
*
|
|
24
|
+
* Releasing targets run first (each unwind/delever frees tokens into the Credit
|
|
25
|
+
* Account), the freed tokens are then routed by swaps at a GUARANTEED minimum
|
|
26
|
+
* output (enforced on-chain), and consuming targets run last — so moving a
|
|
27
|
+
* levered position between markets, token pairs, or protocols (Aave ↔ Morpho) is
|
|
28
|
+
* simply a close plus an open in the same transaction.
|
|
29
|
+
*
|
|
30
|
+
* Net book growth is funded from the Credit Account's existing idle balance —
|
|
31
|
+
* fund it first via /v2/credit/transfer; a net release stays in the Credit
|
|
32
|
+
* Account as idle balance. Any swap surplus above the guaranteed floors also
|
|
33
|
+
* stays in the Credit Account (preview.estimated_max_dust) — recoverable, never
|
|
34
|
+
* lost.
|
|
35
|
+
*
|
|
36
|
+
* A book already at its target returns transaction: null with the preview — the
|
|
37
|
+
* call is idempotent and safe to drive from a converge-to-target loop.
|
|
38
|
+
*
|
|
39
|
+
* A rebalance too large for one transaction is rejected with a 422 — split it
|
|
40
|
+
* into two calls. Every deleveraging step keeps the health factor ≥ 1.02 and
|
|
41
|
+
* every leveraging step respects the protocol's borrow limits; Aave targets share
|
|
42
|
+
* one account-level health factor, which the preview reports.
|
|
43
|
+
*
|
|
44
|
+
* For protocol=MORPHO pass a market_id from /v2/credit/morpho_markets; inspect the
|
|
45
|
+
* current book via /v2/credit/looped_positions.
|
|
46
|
+
*/
|
|
47
|
+
export function creditCreditRebalance(client, request, options) {
|
|
48
|
+
return new APIPromise($do(client, request, options));
|
|
49
|
+
}
|
|
50
|
+
async function $do(client, request, options) {
|
|
51
|
+
const parsed = safeParse(request, (value) => components.CreditRebalanceRequest$outboundSchema.parse(value), "Input validation failed");
|
|
52
|
+
if (!parsed.ok) {
|
|
53
|
+
return [parsed, { status: "invalid" }];
|
|
54
|
+
}
|
|
55
|
+
const payload = parsed.value;
|
|
56
|
+
const body = encodeJSON("body", payload, { explode: true });
|
|
57
|
+
const path = pathToFunc("/v2/credit/rebalance")();
|
|
58
|
+
const headers = new Headers(compactMap({
|
|
59
|
+
"Content-Type": "application/json",
|
|
60
|
+
Accept: "application/json",
|
|
61
|
+
}));
|
|
62
|
+
const secConfig = await extractSecurity(client._options.apiKeyAuth);
|
|
63
|
+
const securityInput = secConfig == null ? {} : { apiKeyAuth: secConfig };
|
|
64
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
65
|
+
const context = {
|
|
66
|
+
options: client._options,
|
|
67
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
68
|
+
operationID: "v2_credit_rebalance",
|
|
69
|
+
oAuth2Scopes: null,
|
|
70
|
+
resolvedSecurity: requestSecurity,
|
|
71
|
+
securitySource: client._options.apiKeyAuth,
|
|
72
|
+
retryConfig: options?.retries
|
|
73
|
+
|| client._options.retryConfig
|
|
74
|
+
|| { strategy: "none" },
|
|
75
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
76
|
+
};
|
|
77
|
+
const requestRes = client._createRequest(context, {
|
|
78
|
+
security: requestSecurity,
|
|
79
|
+
method: "POST",
|
|
80
|
+
baseURL: options?.serverURL,
|
|
81
|
+
path: path,
|
|
82
|
+
headers: headers,
|
|
83
|
+
body: body,
|
|
84
|
+
userAgent: client._options.userAgent,
|
|
85
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
86
|
+
}, options);
|
|
87
|
+
if (!requestRes.ok) {
|
|
88
|
+
return [requestRes, { status: "invalid" }];
|
|
89
|
+
}
|
|
90
|
+
const req = requestRes.value;
|
|
91
|
+
const doResult = await client._do(req, {
|
|
92
|
+
context,
|
|
93
|
+
isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
|
|
94
|
+
retryConfig: context.retryConfig,
|
|
95
|
+
retryCodes: context.retryCodes,
|
|
96
|
+
});
|
|
97
|
+
if (!doResult.ok) {
|
|
98
|
+
return [doResult, { status: "request-error", request: req }];
|
|
99
|
+
}
|
|
100
|
+
const response = doResult.value;
|
|
101
|
+
const responseFields = {
|
|
102
|
+
HttpMeta: { Response: response, Request: req },
|
|
103
|
+
};
|
|
104
|
+
const [result] = await M.match(M.json(200, components.CreditRebalanceResponse$inboundSchema), M.jsonErr(422, errors.HTTPValidationError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
105
|
+
if (!result.ok) {
|
|
106
|
+
return [result, { status: "complete", request: req, response }];
|
|
107
|
+
}
|
|
108
|
+
return [result, { status: "complete", request: req, response }];
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=creditCreditRebalance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"creditCreditRebalance.js","sourceRoot":"","sources":["../../../src/funcs/creditCreditRebalance.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,CAAC,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,KAAK,UAAU,MAAM,+BAA+B,CAAC;AAS5D,OAAO,KAAK,MAAM,MAAM,2BAA2B,CAAC;AAGpD,OAAO,EAAW,UAAU,EAAE,MAAM,mBAAmB,CAAC;AA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-
readonly genVersion: "2.
|
|
36
|
-
readonly userAgent: "speakeasy-sdk/typescript 2.0.0 2.
|
|
35
|
+
readonly genVersion: "2.916.2";
|
|
36
|
+
readonly userAgent: "speakeasy-sdk/typescript 2.0.0 2.916.2 0.0.1 @compass-labs/api-sdk";
|
|
37
37
|
};
|
|
38
38
|
//# sourceMappingURL=config.d.ts.map
|
package/dist/esm/lib/config.js
CHANGED
|
@@ -28,7 +28,7 @@ export const SDK_METADATA = {
|
|
|
28
28
|
language: "typescript",
|
|
29
29
|
openapiDocVersion: "0.0.1",
|
|
30
30
|
sdkVersion: "2.0.0",
|
|
31
|
-
genVersion: "2.
|
|
32
|
-
userAgent: "speakeasy-sdk/typescript 2.0.0 2.
|
|
31
|
+
genVersion: "2.916.2",
|
|
32
|
+
userAgent: "speakeasy-sdk/typescript 2.0.0 2.916.2 0.0.1 @compass-labs/api-sdk",
|
|
33
33
|
};
|
|
34
34
|
//# sourceMappingURL=config.js.map
|