@compass-labs/api-sdk 2.2.103 → 2.2.104
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/lib/config.d.ts +2 -2
- package/dist/commonjs/lib/config.js +2 -2
- package/dist/commonjs/lib/encodings.d.ts +10 -9
- package/dist/commonjs/lib/encodings.d.ts.map +1 -1
- package/dist/commonjs/lib/encodings.js +29 -13
- package/dist/commonjs/lib/encodings.js.map +1 -1
- package/dist/commonjs/models/components/accountsummary.d.ts +3 -7
- 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/builder.d.ts +1 -1
- package/dist/commonjs/models/components/collateralposition.d.ts +3 -7
- 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 +3 -7
- 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 +3 -7
- 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 +3 -7
- 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/creditloopedpositionsresponse.d.ts +3 -3
- package/dist/commonjs/models/components/creditlooprequest.d.ts +3 -7
- package/dist/commonjs/models/components/creditlooprequest.d.ts.map +1 -1
- package/dist/commonjs/models/components/creditlooprequest.js.map +1 -1
- package/dist/commonjs/models/components/creditprotocol.d.ts +6 -14
- package/dist/commonjs/models/components/creditprotocol.d.ts.map +1 -1
- package/dist/commonjs/models/components/creditprotocol.js +3 -7
- package/dist/commonjs/models/components/creditprotocol.js.map +1 -1
- package/dist/commonjs/models/components/creditrepayparams.d.ts +3 -7
- 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 +3 -7
- 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 +3 -7
- 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 +3 -7
- package/dist/commonjs/models/components/creditunlooprequest.d.ts.map +1 -1
- package/dist/commonjs/models/components/creditunlooprequest.js.map +1 -1
- package/dist/commonjs/models/components/creditwithdrawparams.d.ts +3 -7
- 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 +3 -7
- 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 +15 -7
- package/dist/commonjs/models/components/loopedposition.d.ts.map +1 -1
- package/dist/commonjs/models/components/loopedposition.js +6 -0
- package/dist/commonjs/models/components/loopedposition.js.map +1 -1
- package/dist/commonjs/models/components/loopedpositioncurrentstate.d.ts +3 -3
- package/dist/commonjs/models/components/loopedpositioncurrentstate.js +1 -1
- package/dist/commonjs/models/components/rebalancetarget.d.ts +3 -7
- 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 +3 -7
- package/dist/commonjs/models/components/rebalancetargetpreview.d.ts.map +1 -1
- package/dist/commonjs/models/components/rebalancetargetpreview.js.map +1 -1
- package/dist/esm/lib/config.d.ts +2 -2
- package/dist/esm/lib/config.js +2 -2
- package/dist/esm/lib/encodings.d.ts +10 -9
- package/dist/esm/lib/encodings.d.ts.map +1 -1
- package/dist/esm/lib/encodings.js +29 -13
- package/dist/esm/lib/encodings.js.map +1 -1
- package/dist/esm/models/components/accountsummary.d.ts +3 -7
- 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/builder.d.ts +1 -1
- package/dist/esm/models/components/collateralposition.d.ts +3 -7
- 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 +3 -7
- 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 +3 -7
- 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 +3 -7
- 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/creditloopedpositionsresponse.d.ts +3 -3
- package/dist/esm/models/components/creditlooprequest.d.ts +3 -7
- package/dist/esm/models/components/creditlooprequest.d.ts.map +1 -1
- package/dist/esm/models/components/creditlooprequest.js.map +1 -1
- package/dist/esm/models/components/creditprotocol.d.ts +6 -14
- package/dist/esm/models/components/creditprotocol.d.ts.map +1 -1
- package/dist/esm/models/components/creditprotocol.js +3 -7
- package/dist/esm/models/components/creditprotocol.js.map +1 -1
- package/dist/esm/models/components/creditrepayparams.d.ts +3 -7
- 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 +3 -7
- 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 +3 -7
- 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 +3 -7
- package/dist/esm/models/components/creditunlooprequest.d.ts.map +1 -1
- package/dist/esm/models/components/creditunlooprequest.js.map +1 -1
- package/dist/esm/models/components/creditwithdrawparams.d.ts +3 -7
- 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 +3 -7
- 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 +15 -7
- package/dist/esm/models/components/loopedposition.d.ts.map +1 -1
- package/dist/esm/models/components/loopedposition.js +6 -0
- package/dist/esm/models/components/loopedposition.js.map +1 -1
- package/dist/esm/models/components/loopedpositioncurrentstate.d.ts +3 -3
- package/dist/esm/models/components/loopedpositioncurrentstate.js +1 -1
- package/dist/esm/models/components/rebalancetarget.d.ts +3 -7
- 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 +3 -7
- package/dist/esm/models/components/rebalancetargetpreview.d.ts.map +1 -1
- package/dist/esm/models/components/rebalancetargetpreview.js.map +1 -1
- package/docs/models/components/accountsummary.md +11 -11
- package/docs/models/components/builder.md +4 -4
- 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/creditloopedpositionsresponse.md +6 -6
- package/docs/models/components/creditlooprequest.md +19 -19
- package/docs/models/components/creditprotocol.md +3 -7
- package/docs/models/components/creditrepayparams.md +10 -10
- package/docs/models/components/creditrepayrequest.md +20 -20
- package/docs/models/components/creditsupplyparams.md +9 -9
- package/docs/models/components/creditunlooprequest.md +17 -17
- package/docs/models/components/creditwithdrawparams.md +9 -9
- package/docs/models/components/debtposition.md +16 -16
- package/docs/models/components/loopedposition.md +17 -14
- package/docs/models/components/loopedpositioncurrentstate.md +1 -1
- package/docs/models/components/loopedpositioncurrentstatehealthfactorscope.md +1 -1
- package/docs/models/components/rebalancetarget.md +10 -10
- package/docs/models/components/rebalancetargetpreview.md +16 -16
- package/examples/node_modules/tsx/dist/cjs/api/index.cjs +1 -1
- package/examples/node_modules/tsx/dist/cjs/api/index.mjs +1 -1
- package/examples/node_modules/tsx/dist/cjs/index.cjs +1 -1
- package/examples/node_modules/tsx/dist/cjs/index.mjs +1 -1
- package/examples/node_modules/tsx/dist/cli.cjs +1 -1
- package/examples/node_modules/tsx/dist/cli.mjs +1 -1
- package/examples/node_modules/tsx/dist/esm/api/index.cjs +1 -1
- package/examples/node_modules/tsx/dist/esm/api/index.mjs +1 -1
- package/examples/node_modules/tsx/dist/esm/index.cjs +1 -1
- package/examples/node_modules/tsx/dist/esm/index.mjs +1 -1
- package/examples/node_modules/tsx/dist/index-D1vYaNWZ.cjs +14 -0
- package/examples/node_modules/tsx/dist/index-DCefr8NP.mjs +14 -0
- package/examples/node_modules/tsx/dist/loader.cjs +1 -1
- package/examples/node_modules/tsx/dist/loader.mjs +1 -1
- package/examples/node_modules/tsx/dist/package-B1lIY_Tn.cjs +1 -0
- package/examples/node_modules/tsx/dist/package-BL7Whz21.mjs +1 -0
- package/examples/node_modules/tsx/dist/{register-C9AniqUt.mjs → register-DHgpdRjs.mjs} +1 -1
- package/examples/node_modules/tsx/dist/{register-Ciecs-Zx.cjs → register-DjPW2kSr.cjs} +2 -2
- package/examples/node_modules/tsx/dist/{register-C557imBs.cjs → register-OY9cqBEN.cjs} +1 -1
- package/examples/node_modules/tsx/dist/{register-C4vWVmug.mjs → register-SoqaU4rg.mjs} +1 -1
- package/examples/node_modules/tsx/dist/repl.cjs +1 -1
- package/examples/node_modules/tsx/dist/repl.mjs +1 -1
- package/examples/node_modules/tsx/dist/{require-DDxgG93A.cjs → require-Blr_8TcJ.cjs} +1 -1
- package/examples/node_modules/tsx/dist/{require-CywAB2e6.mjs → require-Cuv-0BLU.mjs} +1 -1
- package/examples/node_modules/tsx/package.json +1 -1
- package/examples/package-lock.json +3 -3
- package/openapi_prepped_for_speakeasy.json +43 -7
- package/package.json +1 -1
- package/src/lib/config.ts +2 -2
- package/src/lib/encodings.ts +58 -23
- package/src/models/components/accountsummary.ts +3 -7
- package/src/models/components/builder.ts +1 -1
- package/src/models/components/collateralposition.ts +3 -7
- package/src/models/components/creditborrowparams.ts +3 -7
- package/src/models/components/creditborrowrequest.ts +3 -7
- package/src/models/components/creditenablecollateralparams.ts +3 -7
- package/src/models/components/creditloopedpositionsresponse.ts +3 -3
- package/src/models/components/creditlooprequest.ts +3 -7
- package/src/models/components/creditprotocol.ts +6 -14
- package/src/models/components/creditrepayparams.ts +3 -7
- package/src/models/components/creditrepayrequest.ts +3 -7
- package/src/models/components/creditsupplyparams.ts +3 -7
- package/src/models/components/creditunlooprequest.ts +3 -7
- package/src/models/components/creditwithdrawparams.ts +3 -7
- package/src/models/components/debtposition.ts +3 -7
- package/src/models/components/loopedposition.ts +21 -7
- package/src/models/components/loopedpositioncurrentstate.ts +3 -3
- package/src/models/components/rebalancetarget.ts +3 -7
- package/src/models/components/rebalancetargetpreview.ts +3 -7
- package/examples/node_modules/tsx/dist/index-6kqi0x0U.cjs +0 -14
- package/examples/node_modules/tsx/dist/index-DQtFPMc2.mjs +0 -14
- package/examples/node_modules/tsx/dist/package-B13bX4zz.mjs +0 -1
- package/examples/node_modules/tsx/dist/package-sd2gMcZx.cjs +0 -1
package/src/lib/encodings.ts
CHANGED
|
@@ -12,10 +12,41 @@ export class EncodingError extends Error {
|
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
export type CharEncoding = "percent" | "percentExceptReserved" | "none";
|
|
16
|
+
|
|
17
|
+
const reservedEscapes = /%(2[346bcf]|3[abdf]|40|5[bd])/gi;
|
|
18
|
+
|
|
19
|
+
function encodeKeyChars(
|
|
20
|
+
v: string,
|
|
21
|
+
charEncoding: CharEncoding | undefined,
|
|
22
|
+
): string {
|
|
23
|
+
return encodeChars(
|
|
24
|
+
v,
|
|
25
|
+
charEncoding === "percentExceptReserved" ? "percent" : charEncoding,
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function encodeChars(
|
|
30
|
+
v: string,
|
|
31
|
+
charEncoding: CharEncoding | undefined,
|
|
32
|
+
): string {
|
|
33
|
+
switch (charEncoding) {
|
|
34
|
+
case "percent":
|
|
35
|
+
return encodeURIComponent(v);
|
|
36
|
+
case "percentExceptReserved":
|
|
37
|
+
return encodeURIComponent(v).replace(
|
|
38
|
+
reservedEscapes,
|
|
39
|
+
(m) => decodeURIComponent(m),
|
|
40
|
+
);
|
|
41
|
+
default:
|
|
42
|
+
return v;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
15
46
|
export function encodeMatrix(
|
|
16
47
|
key: string,
|
|
17
48
|
value: unknown,
|
|
18
|
-
options?: { explode?: boolean; charEncoding?:
|
|
49
|
+
options?: { explode?: boolean; charEncoding?: CharEncoding },
|
|
19
50
|
): string | undefined {
|
|
20
51
|
let out = "";
|
|
21
52
|
const pairs: [string, unknown][] = options?.explode
|
|
@@ -27,7 +58,7 @@ export function encodeMatrix(
|
|
|
27
58
|
}
|
|
28
59
|
|
|
29
60
|
const encodeString = (v: string) => {
|
|
30
|
-
return options?.charEncoding
|
|
61
|
+
return encodeChars(v, options?.charEncoding);
|
|
31
62
|
};
|
|
32
63
|
const encodeValue = (v: unknown) => encodeString(serializeValue(v));
|
|
33
64
|
|
|
@@ -52,7 +83,7 @@ export function encodeMatrix(
|
|
|
52
83
|
return;
|
|
53
84
|
}
|
|
54
85
|
|
|
55
|
-
const keyPrefix =
|
|
86
|
+
const keyPrefix = encodeKeyChars(pk, options?.charEncoding);
|
|
56
87
|
tmp = `${keyPrefix}=${encValue}`;
|
|
57
88
|
// trim trailing '=' if value was empty
|
|
58
89
|
if (tmp === `${keyPrefix}=`) {
|
|
@@ -73,7 +104,7 @@ export function encodeMatrix(
|
|
|
73
104
|
export function encodeLabel(
|
|
74
105
|
key: string,
|
|
75
106
|
value: unknown,
|
|
76
|
-
options?: { explode?: boolean; charEncoding?:
|
|
107
|
+
options?: { explode?: boolean; charEncoding?: CharEncoding },
|
|
77
108
|
): string | undefined {
|
|
78
109
|
let out = "";
|
|
79
110
|
const pairs: [string, unknown][] = options?.explode
|
|
@@ -85,7 +116,7 @@ export function encodeLabel(
|
|
|
85
116
|
}
|
|
86
117
|
|
|
87
118
|
const encodeString = (v: string) => {
|
|
88
|
-
return options?.charEncoding
|
|
119
|
+
return encodeChars(v, options?.charEncoding);
|
|
89
120
|
};
|
|
90
121
|
const encodeValue = (v: unknown) => encodeString(serializeValue(v));
|
|
91
122
|
|
|
@@ -103,7 +134,7 @@ export function encodeLabel(
|
|
|
103
134
|
encValue = mapped?.join("").slice(1);
|
|
104
135
|
} else {
|
|
105
136
|
const k = options?.explode && isPlainObject(value)
|
|
106
|
-
? `${
|
|
137
|
+
? `${encodeKeyChars(pk, options?.charEncoding)}=`
|
|
107
138
|
: "";
|
|
108
139
|
encValue = `${k}${encodeValue(pv)}`;
|
|
109
140
|
}
|
|
@@ -117,14 +148,14 @@ export function encodeLabel(
|
|
|
117
148
|
type FormEncoder = (
|
|
118
149
|
key: string,
|
|
119
150
|
value: unknown,
|
|
120
|
-
options?: { explode?: boolean; charEncoding?:
|
|
151
|
+
options?: { explode?: boolean; charEncoding?: CharEncoding },
|
|
121
152
|
) => string | undefined;
|
|
122
153
|
|
|
123
154
|
function formEncoder(sep: string): FormEncoder {
|
|
124
155
|
return (
|
|
125
156
|
key: string,
|
|
126
157
|
value: unknown,
|
|
127
|
-
options?: { explode?: boolean; charEncoding?:
|
|
158
|
+
options?: { explode?: boolean; charEncoding?: CharEncoding },
|
|
128
159
|
) => {
|
|
129
160
|
let out = "";
|
|
130
161
|
const pairs: [string, unknown][] = options?.explode
|
|
@@ -136,7 +167,7 @@ function formEncoder(sep: string): FormEncoder {
|
|
|
136
167
|
}
|
|
137
168
|
|
|
138
169
|
const encodeString = (v: string) => {
|
|
139
|
-
return options?.charEncoding
|
|
170
|
+
return encodeChars(v, options?.charEncoding);
|
|
140
171
|
};
|
|
141
172
|
|
|
142
173
|
const encodeValue = (v: unknown) => encodeString(serializeValue(v));
|
|
@@ -163,7 +194,7 @@ function formEncoder(sep: string): FormEncoder {
|
|
|
163
194
|
return;
|
|
164
195
|
}
|
|
165
196
|
|
|
166
|
-
tmp = `${
|
|
197
|
+
tmp = `${encodeKeyChars(pk, options?.charEncoding)}=${encValue}`;
|
|
167
198
|
|
|
168
199
|
// If we end up with the nothing then skip forward
|
|
169
200
|
if (!tmp || tmp === "=") {
|
|
@@ -184,7 +215,7 @@ export const encodePipeDelimited = formEncoder("|");
|
|
|
184
215
|
export function encodeBodyForm(
|
|
185
216
|
key: string,
|
|
186
217
|
value: unknown,
|
|
187
|
-
options?: { explode?: boolean; charEncoding?:
|
|
218
|
+
options?: { explode?: boolean; charEncoding?: CharEncoding },
|
|
188
219
|
): string {
|
|
189
220
|
let out = "";
|
|
190
221
|
const pairs: [string, unknown][] = options?.explode
|
|
@@ -192,7 +223,7 @@ export function encodeBodyForm(
|
|
|
192
223
|
: [[key, value]];
|
|
193
224
|
|
|
194
225
|
const encodeString = (v: string) => {
|
|
195
|
-
return options?.charEncoding
|
|
226
|
+
return encodeChars(v, options?.charEncoding);
|
|
196
227
|
};
|
|
197
228
|
|
|
198
229
|
const encodeValue = (v: unknown) => encodeString(serializeValue(v));
|
|
@@ -211,7 +242,7 @@ export function encodeBodyForm(
|
|
|
211
242
|
encValue = `${encodeValue(pv)}`;
|
|
212
243
|
}
|
|
213
244
|
|
|
214
|
-
tmp = `${
|
|
245
|
+
tmp = `${encodeKeyChars(pk, options?.charEncoding)}=${encValue}`;
|
|
215
246
|
|
|
216
247
|
// If we end up with the nothing then skip forward
|
|
217
248
|
if (!tmp || tmp === "=") {
|
|
@@ -227,7 +258,7 @@ export function encodeBodyForm(
|
|
|
227
258
|
export function encodeDeepObject(
|
|
228
259
|
key: string,
|
|
229
260
|
value: unknown,
|
|
230
|
-
options?: { charEncoding?:
|
|
261
|
+
options?: { charEncoding?: CharEncoding },
|
|
231
262
|
): string | undefined {
|
|
232
263
|
if (value == null) {
|
|
233
264
|
return;
|
|
@@ -245,7 +276,7 @@ export function encodeDeepObject(
|
|
|
245
276
|
export function encodeDeepObjectObject(
|
|
246
277
|
key: string,
|
|
247
278
|
value: unknown,
|
|
248
|
-
options?: { charEncoding?:
|
|
279
|
+
options?: { charEncoding?: CharEncoding },
|
|
249
280
|
): string | undefined {
|
|
250
281
|
if (value == null) {
|
|
251
282
|
return;
|
|
@@ -254,7 +285,7 @@ export function encodeDeepObjectObject(
|
|
|
254
285
|
let out = "";
|
|
255
286
|
|
|
256
287
|
const encodeString = (v: string) => {
|
|
257
|
-
return options?.charEncoding
|
|
288
|
+
return encodeChars(v, options?.charEncoding);
|
|
258
289
|
};
|
|
259
290
|
|
|
260
291
|
if (!isPlainObject(value)) {
|
|
@@ -278,7 +309,9 @@ export function encodeDeepObjectObject(
|
|
|
278
309
|
|
|
279
310
|
const pairs: unknown[] = Array.isArray(cv) ? cv : [cv];
|
|
280
311
|
const encoded = mapDefined(pairs, (v) => {
|
|
281
|
-
return `${
|
|
312
|
+
return `${encodeKeyChars(pk, options?.charEncoding)}=${
|
|
313
|
+
encodeString(serializeValue(v))
|
|
314
|
+
}`;
|
|
282
315
|
})?.join("&");
|
|
283
316
|
|
|
284
317
|
out += encoded == null ? "" : `&${encoded}`;
|
|
@@ -290,25 +323,27 @@ export function encodeDeepObjectObject(
|
|
|
290
323
|
export function encodeJSON(
|
|
291
324
|
key: string,
|
|
292
325
|
value: unknown,
|
|
293
|
-
options?: { explode?: boolean; charEncoding?:
|
|
326
|
+
options?: { explode?: boolean; charEncoding?: CharEncoding },
|
|
294
327
|
): string | undefined {
|
|
295
328
|
if (typeof value === "undefined") {
|
|
296
329
|
return;
|
|
297
330
|
}
|
|
298
331
|
|
|
299
332
|
const encodeString = (v: string) => {
|
|
300
|
-
return options?.charEncoding
|
|
333
|
+
return encodeChars(v, options?.charEncoding);
|
|
301
334
|
};
|
|
302
335
|
|
|
303
336
|
const encVal = encodeString(JSON.stringify(value, jsonReplacer));
|
|
304
337
|
|
|
305
|
-
return options?.explode
|
|
338
|
+
return options?.explode
|
|
339
|
+
? encVal
|
|
340
|
+
: `${encodeKeyChars(key, options?.charEncoding)}=${encVal}`;
|
|
306
341
|
}
|
|
307
342
|
|
|
308
343
|
export const encodeSimple = (
|
|
309
344
|
key: string,
|
|
310
345
|
value: unknown,
|
|
311
|
-
options?: { explode?: boolean; charEncoding?:
|
|
346
|
+
options?: { explode?: boolean; charEncoding?: CharEncoding },
|
|
312
347
|
): string | undefined => {
|
|
313
348
|
let out = "";
|
|
314
349
|
const pairs: [string, unknown][] = options?.explode
|
|
@@ -320,7 +355,7 @@ export const encodeSimple = (
|
|
|
320
355
|
}
|
|
321
356
|
|
|
322
357
|
const encodeString = (v: string) => {
|
|
323
|
-
return options?.charEncoding
|
|
358
|
+
return encodeChars(v, options?.charEncoding);
|
|
324
359
|
};
|
|
325
360
|
const encodeValue = (v: unknown) => encodeString(serializeValue(v));
|
|
326
361
|
|
|
@@ -426,7 +461,7 @@ export function queryJoin(...args: (string | undefined)[]): string {
|
|
|
426
461
|
|
|
427
462
|
type QueryEncoderOptions = {
|
|
428
463
|
explode?: boolean;
|
|
429
|
-
charEncoding?:
|
|
464
|
+
charEncoding?: CharEncoding;
|
|
430
465
|
allowEmptyValue?: string[];
|
|
431
466
|
};
|
|
432
467
|
|
|
@@ -39,13 +39,9 @@ export type AccountSummary = {
|
|
|
39
39
|
* chain's Aave V3 deployment); MORPHO on Ethereum, Base, Arbitrum and HyperEVM
|
|
40
40
|
* (where it is Felix); EULER on Ethereum, Base, Arbitrum and BSC.
|
|
41
41
|
*
|
|
42
|
-
* All three support ``/v2/credit/loop
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* silently absent there rather than an error, so read it from
|
|
46
|
-
* ``/v2/credit/positions`` instead. (EULER still appears in the
|
|
47
|
-
* ``looped_positions`` response enum because this enum is shared; it is never
|
|
48
|
-
* emitted.)
|
|
42
|
+
* All three support ``/v2/credit/loop``, ``/v2/credit/unloop`` and
|
|
43
|
+
* ``/v2/credit/looped_positions``. The one gap is ``/v2/credit/rebalance``,
|
|
44
|
+
* which rejects EULER with a 422.
|
|
49
45
|
*/
|
|
50
46
|
protocol?: CreditProtocol | undefined;
|
|
51
47
|
/**
|
|
@@ -14,7 +14,7 @@ export type Builder = {
|
|
|
14
14
|
*/
|
|
15
15
|
address: string;
|
|
16
16
|
/**
|
|
17
|
-
* Maximum fee rate the end-user authorizes for this builder, in Hyperliquid grammar (e.g. '0.01%'). Must end with '%'
|
|
17
|
+
* Maximum fee rate the end-user authorizes for this builder, in Hyperliquid grammar (e.g. '0.01%'). Must end with '%', use at most 0.001% precision (one tenth of a basis point) and be at most 0.1%, Hyperliquid's cap on perps builder fees. The fee is charged on top of Hyperliquid's own trading fee.
|
|
18
18
|
*/
|
|
19
19
|
maxFeeRate: string;
|
|
20
20
|
};
|
|
@@ -42,13 +42,9 @@ export type CollateralPosition = {
|
|
|
42
42
|
* chain's Aave V3 deployment); MORPHO on Ethereum, Base, Arbitrum and HyperEVM
|
|
43
43
|
* (where it is Felix); EULER on Ethereum, Base, Arbitrum and BSC.
|
|
44
44
|
*
|
|
45
|
-
* All three support ``/v2/credit/loop
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
* silently absent there rather than an error, so read it from
|
|
49
|
-
* ``/v2/credit/positions`` instead. (EULER still appears in the
|
|
50
|
-
* ``looped_positions`` response enum because this enum is shared; it is never
|
|
51
|
-
* emitted.)
|
|
45
|
+
* All three support ``/v2/credit/loop``, ``/v2/credit/unloop`` and
|
|
46
|
+
* ``/v2/credit/looped_positions``. The one gap is ``/v2/credit/rebalance``,
|
|
47
|
+
* which rejects EULER with a 422.
|
|
52
48
|
*/
|
|
53
49
|
protocol?: CreditProtocol | undefined;
|
|
54
50
|
/**
|
|
@@ -65,13 +65,9 @@ export type CreditBorrowParams = {
|
|
|
65
65
|
* chain's Aave V3 deployment); MORPHO on Ethereum, Base, Arbitrum and HyperEVM
|
|
66
66
|
* (where it is Felix); EULER on Ethereum, Base, Arbitrum and BSC.
|
|
67
67
|
*
|
|
68
|
-
* All three support ``/v2/credit/loop
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
* silently absent there rather than an error, so read it from
|
|
72
|
-
* ``/v2/credit/positions`` instead. (EULER still appears in the
|
|
73
|
-
* ``looped_positions`` response enum because this enum is shared; it is never
|
|
74
|
-
* emitted.)
|
|
68
|
+
* All three support ``/v2/credit/loop``, ``/v2/credit/unloop`` and
|
|
69
|
+
* ``/v2/credit/looped_positions``. The one gap is ``/v2/credit/rebalance``,
|
|
70
|
+
* which rejects EULER with a 422.
|
|
75
71
|
*/
|
|
76
72
|
protocol?: CreditProtocol | undefined;
|
|
77
73
|
/**
|
|
@@ -78,13 +78,9 @@ export type CreditBorrowRequest = {
|
|
|
78
78
|
* chain's Aave V3 deployment); MORPHO on Ethereum, Base, Arbitrum and HyperEVM
|
|
79
79
|
* (where it is Felix); EULER on Ethereum, Base, Arbitrum and BSC.
|
|
80
80
|
*
|
|
81
|
-
* All three support ``/v2/credit/loop
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
* silently absent there rather than an error, so read it from
|
|
85
|
-
* ``/v2/credit/positions`` instead. (EULER still appears in the
|
|
86
|
-
* ``looped_positions`` response enum because this enum is shared; it is never
|
|
87
|
-
* emitted.)
|
|
81
|
+
* All three support ``/v2/credit/loop``, ``/v2/credit/unloop`` and
|
|
82
|
+
* ``/v2/credit/looped_positions``. The one gap is ``/v2/credit/rebalance``,
|
|
83
|
+
* which rejects EULER with a 422.
|
|
88
84
|
*/
|
|
89
85
|
protocol?: CreditProtocol | undefined;
|
|
90
86
|
/**
|
|
@@ -40,13 +40,9 @@ export type CreditEnableCollateralParams = {
|
|
|
40
40
|
* chain's Aave V3 deployment); MORPHO on Ethereum, Base, Arbitrum and HyperEVM
|
|
41
41
|
* (where it is Felix); EULER on Ethereum, Base, Arbitrum and BSC.
|
|
42
42
|
*
|
|
43
|
-
* All three support ``/v2/credit/loop
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
* silently absent there rather than an error, so read it from
|
|
47
|
-
* ``/v2/credit/positions`` instead. (EULER still appears in the
|
|
48
|
-
* ``looped_positions`` response enum because this enum is shared; it is never
|
|
49
|
-
* emitted.)
|
|
43
|
+
* All three support ``/v2/credit/loop``, ``/v2/credit/unloop`` and
|
|
44
|
+
* ``/v2/credit/looped_positions``. The one gap is ``/v2/credit/rebalance``,
|
|
45
|
+
* which rejects EULER with a 422.
|
|
50
46
|
*/
|
|
51
47
|
protocol?: CreditProtocol | undefined;
|
|
52
48
|
/**
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
} from "./loopedposition.js";
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
|
-
* Looped positions across Aave V3
|
|
20
|
+
* Looped positions across Aave V3, Morpho Blue and Euler V2 for a credit account.
|
|
21
21
|
*/
|
|
22
22
|
export type CreditLoopedPositionsResponse = {
|
|
23
23
|
/**
|
|
@@ -25,11 +25,11 @@ export type CreditLoopedPositionsResponse = {
|
|
|
25
25
|
*/
|
|
26
26
|
creditAccountAddress: string;
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
28
|
+
* Every leveraged position the account holds, across Aave, Morpho and Euler — each with its live state, lifetime totals and full transaction history, whether it is still open or already closed.
|
|
29
29
|
*/
|
|
30
30
|
positions?: Array<LoopedPosition> | undefined;
|
|
31
31
|
/**
|
|
32
|
-
* Aave account-level summary (health factor, LTV, borrow capacity). Present when the account holds any open Aave looped position, since Aave collateral is pooled and health is account-level. Null for Morpho
|
|
32
|
+
* Aave account-level summary (health factor, LTV, borrow capacity). Present when the account holds any open Aave looped position, since Aave collateral is pooled and health is account-level. Null for accounts with no open Aave loop — Morpho and Euler positions carry their own isolated health factor on each position instead.
|
|
33
33
|
*/
|
|
34
34
|
aaveAccountSummary?: AccountSummary | null | undefined;
|
|
35
35
|
};
|
|
@@ -94,13 +94,9 @@ export type CreditLoopRequest = {
|
|
|
94
94
|
* chain's Aave V3 deployment); MORPHO on Ethereum, Base, Arbitrum and HyperEVM
|
|
95
95
|
* (where it is Felix); EULER on Ethereum, Base, Arbitrum and BSC.
|
|
96
96
|
*
|
|
97
|
-
* All three support ``/v2/credit/loop
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
* silently absent there rather than an error, so read it from
|
|
101
|
-
* ``/v2/credit/positions`` instead. (EULER still appears in the
|
|
102
|
-
* ``looped_positions`` response enum because this enum is shared; it is never
|
|
103
|
-
* emitted.)
|
|
97
|
+
* All three support ``/v2/credit/loop``, ``/v2/credit/unloop`` and
|
|
98
|
+
* ``/v2/credit/looped_positions``. The one gap is ``/v2/credit/rebalance``,
|
|
99
|
+
* which rejects EULER with a 422.
|
|
104
100
|
*/
|
|
105
101
|
protocol?: CreditProtocol | undefined;
|
|
106
102
|
/**
|
|
@@ -22,13 +22,9 @@ import { ClosedEnum } from "../../types/enums.js";
|
|
|
22
22
|
* chain's Aave V3 deployment); MORPHO on Ethereum, Base, Arbitrum and HyperEVM
|
|
23
23
|
* (where it is Felix); EULER on Ethereum, Base, Arbitrum and BSC.
|
|
24
24
|
*
|
|
25
|
-
* All three support ``/v2/credit/loop
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* silently absent there rather than an error, so read it from
|
|
29
|
-
* ``/v2/credit/positions`` instead. (EULER still appears in the
|
|
30
|
-
* ``looped_positions`` response enum because this enum is shared; it is never
|
|
31
|
-
* emitted.)
|
|
25
|
+
* All three support ``/v2/credit/loop``, ``/v2/credit/unloop`` and
|
|
26
|
+
* ``/v2/credit/looped_positions``. The one gap is ``/v2/credit/rebalance``,
|
|
27
|
+
* which rejects EULER with a 422.
|
|
32
28
|
*/
|
|
33
29
|
export const CreditProtocol = {
|
|
34
30
|
Aave: "AAVE",
|
|
@@ -52,13 +48,9 @@ export const CreditProtocol = {
|
|
|
52
48
|
* chain's Aave V3 deployment); MORPHO on Ethereum, Base, Arbitrum and HyperEVM
|
|
53
49
|
* (where it is Felix); EULER on Ethereum, Base, Arbitrum and BSC.
|
|
54
50
|
*
|
|
55
|
-
* All three support ``/v2/credit/loop
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
* silently absent there rather than an error, so read it from
|
|
59
|
-
* ``/v2/credit/positions`` instead. (EULER still appears in the
|
|
60
|
-
* ``looped_positions`` response enum because this enum is shared; it is never
|
|
61
|
-
* emitted.)
|
|
51
|
+
* All three support ``/v2/credit/loop``, ``/v2/credit/unloop`` and
|
|
52
|
+
* ``/v2/credit/looped_positions``. The one gap is ``/v2/credit/rebalance``,
|
|
53
|
+
* which rejects EULER with a 422.
|
|
62
54
|
*/
|
|
63
55
|
export type CreditProtocol = ClosedEnum<typeof CreditProtocol>;
|
|
64
56
|
|
|
@@ -56,13 +56,9 @@ export type CreditRepayParams = {
|
|
|
56
56
|
* chain's Aave V3 deployment); MORPHO on Ethereum, Base, Arbitrum and HyperEVM
|
|
57
57
|
* (where it is Felix); EULER on Ethereum, Base, Arbitrum and BSC.
|
|
58
58
|
*
|
|
59
|
-
* All three support ``/v2/credit/loop
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
* silently absent there rather than an error, so read it from
|
|
63
|
-
* ``/v2/credit/positions`` instead. (EULER still appears in the
|
|
64
|
-
* ``looped_positions`` response enum because this enum is shared; it is never
|
|
65
|
-
* emitted.)
|
|
59
|
+
* All three support ``/v2/credit/loop``, ``/v2/credit/unloop`` and
|
|
60
|
+
* ``/v2/credit/looped_positions``. The one gap is ``/v2/credit/rebalance``,
|
|
61
|
+
* which rejects EULER with a 422.
|
|
66
62
|
*/
|
|
67
63
|
protocol?: CreditProtocol | undefined;
|
|
68
64
|
/**
|
|
@@ -73,13 +73,9 @@ export type CreditRepayRequest = {
|
|
|
73
73
|
* chain's Aave V3 deployment); MORPHO on Ethereum, Base, Arbitrum and HyperEVM
|
|
74
74
|
* (where it is Felix); EULER on Ethereum, Base, Arbitrum and BSC.
|
|
75
75
|
*
|
|
76
|
-
* All three support ``/v2/credit/loop
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
* silently absent there rather than an error, so read it from
|
|
80
|
-
* ``/v2/credit/positions`` instead. (EULER still appears in the
|
|
81
|
-
* ``looped_positions`` response enum because this enum is shared; it is never
|
|
82
|
-
* emitted.)
|
|
76
|
+
* All three support ``/v2/credit/loop``, ``/v2/credit/unloop`` and
|
|
77
|
+
* ``/v2/credit/looped_positions``. The one gap is ``/v2/credit/rebalance``,
|
|
78
|
+
* which rejects EULER with a 422.
|
|
83
79
|
*/
|
|
84
80
|
protocol?: CreditProtocol | undefined;
|
|
85
81
|
/**
|
|
@@ -44,13 +44,9 @@ export type CreditSupplyParams = {
|
|
|
44
44
|
* chain's Aave V3 deployment); MORPHO on Ethereum, Base, Arbitrum and HyperEVM
|
|
45
45
|
* (where it is Felix); EULER on Ethereum, Base, Arbitrum and BSC.
|
|
46
46
|
*
|
|
47
|
-
* All three support ``/v2/credit/loop
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* silently absent there rather than an error, so read it from
|
|
51
|
-
* ``/v2/credit/positions`` instead. (EULER still appears in the
|
|
52
|
-
* ``looped_positions`` response enum because this enum is shared; it is never
|
|
53
|
-
* emitted.)
|
|
47
|
+
* All three support ``/v2/credit/loop``, ``/v2/credit/unloop`` and
|
|
48
|
+
* ``/v2/credit/looped_positions``. The one gap is ``/v2/credit/rebalance``,
|
|
49
|
+
* which rejects EULER with a 422.
|
|
54
50
|
*/
|
|
55
51
|
protocol?: CreditProtocol | undefined;
|
|
56
52
|
/**
|
|
@@ -86,13 +86,9 @@ export type CreditUnloopRequest = {
|
|
|
86
86
|
* chain's Aave V3 deployment); MORPHO on Ethereum, Base, Arbitrum and HyperEVM
|
|
87
87
|
* (where it is Felix); EULER on Ethereum, Base, Arbitrum and BSC.
|
|
88
88
|
*
|
|
89
|
-
* All three support ``/v2/credit/loop
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
* silently absent there rather than an error, so read it from
|
|
93
|
-
* ``/v2/credit/positions`` instead. (EULER still appears in the
|
|
94
|
-
* ``looped_positions`` response enum because this enum is shared; it is never
|
|
95
|
-
* emitted.)
|
|
89
|
+
* All three support ``/v2/credit/loop``, ``/v2/credit/unloop`` and
|
|
90
|
+
* ``/v2/credit/looped_positions``. The one gap is ``/v2/credit/rebalance``,
|
|
91
|
+
* which rejects EULER with a 422.
|
|
96
92
|
*/
|
|
97
93
|
protocol?: CreditProtocol | undefined;
|
|
98
94
|
/**
|
|
@@ -44,13 +44,9 @@ export type CreditWithdrawParams = {
|
|
|
44
44
|
* chain's Aave V3 deployment); MORPHO on Ethereum, Base, Arbitrum and HyperEVM
|
|
45
45
|
* (where it is Felix); EULER on Ethereum, Base, Arbitrum and BSC.
|
|
46
46
|
*
|
|
47
|
-
* All three support ``/v2/credit/loop
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* silently absent there rather than an error, so read it from
|
|
51
|
-
* ``/v2/credit/positions`` instead. (EULER still appears in the
|
|
52
|
-
* ``looped_positions`` response enum because this enum is shared; it is never
|
|
53
|
-
* emitted.)
|
|
47
|
+
* All three support ``/v2/credit/loop``, ``/v2/credit/unloop`` and
|
|
48
|
+
* ``/v2/credit/looped_positions``. The one gap is ``/v2/credit/rebalance``,
|
|
49
|
+
* which rejects EULER with a 422.
|
|
54
50
|
*/
|
|
55
51
|
protocol?: CreditProtocol | undefined;
|
|
56
52
|
/**
|
|
@@ -42,13 +42,9 @@ export type DebtPosition = {
|
|
|
42
42
|
* chain's Aave V3 deployment); MORPHO on Ethereum, Base, Arbitrum and HyperEVM
|
|
43
43
|
* (where it is Felix); EULER on Ethereum, Base, Arbitrum and BSC.
|
|
44
44
|
*
|
|
45
|
-
* All three support ``/v2/credit/loop
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
* silently absent there rather than an error, so read it from
|
|
49
|
-
* ``/v2/credit/positions`` instead. (EULER still appears in the
|
|
50
|
-
* ``looped_positions`` response enum because this enum is shared; it is never
|
|
51
|
-
* emitted.)
|
|
45
|
+
* All three support ``/v2/credit/loop``, ``/v2/credit/unloop`` and
|
|
46
|
+
* ``/v2/credit/looped_positions``. The one gap is ``/v2/credit/rebalance``,
|
|
47
|
+
* which rejects EULER with a 422.
|
|
52
48
|
*/
|
|
53
49
|
protocol?: CreditProtocol | undefined;
|
|
54
50
|
/**
|
|
@@ -58,19 +58,27 @@ export type LoopedPosition = {
|
|
|
58
58
|
* chain's Aave V3 deployment); MORPHO on Ethereum, Base, Arbitrum and HyperEVM
|
|
59
59
|
* (where it is Felix); EULER on Ethereum, Base, Arbitrum and BSC.
|
|
60
60
|
*
|
|
61
|
-
* All three support ``/v2/credit/loop
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
* silently absent there rather than an error, so read it from
|
|
65
|
-
* ``/v2/credit/positions`` instead. (EULER still appears in the
|
|
66
|
-
* ``looped_positions`` response enum because this enum is shared; it is never
|
|
67
|
-
* emitted.)
|
|
61
|
+
* All three support ``/v2/credit/loop``, ``/v2/credit/unloop`` and
|
|
62
|
+
* ``/v2/credit/looped_positions``. The one gap is ``/v2/credit/rebalance``,
|
|
63
|
+
* which rejects EULER with a 422.
|
|
68
64
|
*/
|
|
69
65
|
protocol: CreditProtocol;
|
|
70
66
|
/**
|
|
71
67
|
* Morpho only: the bytes32 id of the isolated market.
|
|
72
68
|
*/
|
|
73
69
|
marketId?: string | null | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* Euler only: the EVC sub-account (0-255) holding this position. Euler isolates each loop in its own sub-account, so this is part of the position's identity — two loops on the same vault pair in different sub-accounts are two separate positions.
|
|
72
|
+
*/
|
|
73
|
+
subAccountId?: number | null | undefined;
|
|
74
|
+
/**
|
|
75
|
+
* Euler only: the EVK vault holding the collateral. Euler markets are identified by their vault pair rather than by a market id, and the same underlying token can back several different vaults.
|
|
76
|
+
*/
|
|
77
|
+
collateralVault?: string | null | undefined;
|
|
78
|
+
/**
|
|
79
|
+
* Euler only: the EVK controller vault the debt is owed to.
|
|
80
|
+
*/
|
|
81
|
+
borrowVault?: string | null | undefined;
|
|
74
82
|
/**
|
|
75
83
|
* Address of the collateral token.
|
|
76
84
|
*/
|
|
@@ -126,6 +134,9 @@ export const LoopedPosition$inboundSchema: z.ZodType<
|
|
|
126
134
|
> = z.object({
|
|
127
135
|
protocol: CreditProtocol$inboundSchema,
|
|
128
136
|
market_id: z.nullable(z.string()).optional(),
|
|
137
|
+
sub_account_id: z.nullable(z.number().int()).optional(),
|
|
138
|
+
collateral_vault: z.nullable(z.string()).optional(),
|
|
139
|
+
borrow_vault: z.nullable(z.string()).optional(),
|
|
129
140
|
collateral_token: z.string(),
|
|
130
141
|
collateral_symbol: z.string(),
|
|
131
142
|
debt_token: z.string(),
|
|
@@ -141,6 +152,9 @@ export const LoopedPosition$inboundSchema: z.ZodType<
|
|
|
141
152
|
}).transform((v) => {
|
|
142
153
|
return remap$(v, {
|
|
143
154
|
"market_id": "marketId",
|
|
155
|
+
"sub_account_id": "subAccountId",
|
|
156
|
+
"collateral_vault": "collateralVault",
|
|
157
|
+
"borrow_vault": "borrowVault",
|
|
144
158
|
"collateral_token": "collateralToken",
|
|
145
159
|
"collateral_symbol": "collateralSymbol",
|
|
146
160
|
"debt_token": "debtToken",
|
|
@@ -10,14 +10,14 @@ import { Result as SafeParseResult } from "../../types/fp.js";
|
|
|
10
10
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
* 'market'
|
|
13
|
+
* How widely this health factor applies. 'market' means it is isolated rather than account-wide: a Morpho market's collateral backs only that market's debt, and an Euler sub-account's collateral backs only its own controller's debt. Note that an Euler figure is scoped to the SUB-ACCOUNT, so if several positions share one sub-account they all report the same health factor and are liquidated together — it is not each position's independent 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.
|
|
14
14
|
*/
|
|
15
15
|
export const LoopedPositionCurrentStateHealthFactorScope = {
|
|
16
16
|
Market: "market",
|
|
17
17
|
Account: "account",
|
|
18
18
|
} as const;
|
|
19
19
|
/**
|
|
20
|
-
* 'market'
|
|
20
|
+
* How widely this health factor applies. 'market' means it is isolated rather than account-wide: a Morpho market's collateral backs only that market's debt, and an Euler sub-account's collateral backs only its own controller's debt. Note that an Euler figure is scoped to the SUB-ACCOUNT, so if several positions share one sub-account they all report the same health factor and are liquidated together — it is not each position's independent 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.
|
|
21
21
|
*/
|
|
22
22
|
export type LoopedPositionCurrentStateHealthFactorScope = ClosedEnum<
|
|
23
23
|
typeof LoopedPositionCurrentStateHealthFactorScope
|
|
@@ -56,7 +56,7 @@ export type LoopedPositionCurrentState = {
|
|
|
56
56
|
*/
|
|
57
57
|
healthFactor?: string | null | undefined;
|
|
58
58
|
/**
|
|
59
|
-
* 'market'
|
|
59
|
+
* How widely this health factor applies. 'market' means it is isolated rather than account-wide: a Morpho market's collateral backs only that market's debt, and an Euler sub-account's collateral backs only its own controller's debt. Note that an Euler figure is scoped to the SUB-ACCOUNT, so if several positions share one sub-account they all report the same health factor and are liquidated together — it is not each position's independent 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.
|
|
60
60
|
*/
|
|
61
61
|
healthFactorScope: LoopedPositionCurrentStateHealthFactorScope;
|
|
62
62
|
/**
|
|
@@ -51,13 +51,9 @@ export type RebalanceTarget = {
|
|
|
51
51
|
* chain's Aave V3 deployment); MORPHO on Ethereum, Base, Arbitrum and HyperEVM
|
|
52
52
|
* (where it is Felix); EULER on Ethereum, Base, Arbitrum and BSC.
|
|
53
53
|
*
|
|
54
|
-
* All three support ``/v2/credit/loop
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
* silently absent there rather than an error, so read it from
|
|
58
|
-
* ``/v2/credit/positions`` instead. (EULER still appears in the
|
|
59
|
-
* ``looped_positions`` response enum because this enum is shared; it is never
|
|
60
|
-
* emitted.)
|
|
54
|
+
* All three support ``/v2/credit/loop``, ``/v2/credit/unloop`` and
|
|
55
|
+
* ``/v2/credit/looped_positions``. The one gap is ``/v2/credit/rebalance``,
|
|
56
|
+
* which rejects EULER with a 422.
|
|
61
57
|
*/
|
|
62
58
|
protocol?: CreditProtocol | undefined;
|
|
63
59
|
/**
|