@carrot-protocol/boost-http-client 0.2.15-group-refactor1-dev-8bcd756 → 0.2.15-group-refactor1-dev-1ee3fdf
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/index.js +9 -2
- package/dist/types.d.ts +5 -2
- package/package.json +2 -2
- package/src/index.ts +11 -4
- package/src/types.ts +6 -2
package/dist/index.js
CHANGED
|
@@ -189,6 +189,14 @@ class Client {
|
|
|
189
189
|
// parse lending account balances
|
|
190
190
|
const clendAccountBalances = [];
|
|
191
191
|
for (const b of ca.balances) {
|
|
192
|
+
// parse liquidation data if exists
|
|
193
|
+
const liquidation = b.liquidation
|
|
194
|
+
? {
|
|
195
|
+
price: Number(b.liquidation.price),
|
|
196
|
+
changePercentage: Number(b.liquidation.changePercentage),
|
|
197
|
+
}
|
|
198
|
+
: null;
|
|
199
|
+
// create clend account balance
|
|
192
200
|
clendAccountBalances.push({
|
|
193
201
|
mint: new anchor_1.web3.PublicKey(b.mint),
|
|
194
202
|
bank: new anchor_1.web3.PublicKey(b.bank),
|
|
@@ -199,6 +207,7 @@ class Client {
|
|
|
199
207
|
liabilityBalanceUi: Number(b.liabilityBalanceUi),
|
|
200
208
|
liabilityValue: Number(b.liabilityValue),
|
|
201
209
|
price: Number(b.price),
|
|
210
|
+
liquidation,
|
|
202
211
|
});
|
|
203
212
|
}
|
|
204
213
|
// create clend account
|
|
@@ -213,8 +222,6 @@ class Client {
|
|
|
213
222
|
healthFactorRiskAdjusted: Number(ca.healthFactorRiskAdjusted),
|
|
214
223
|
notionalLeverage: Number(ca.notionalLeverage),
|
|
215
224
|
riskAdjustedLeverage: Number(ca.riskAdjustedLeverage),
|
|
216
|
-
liquidationPrice: Number(ca.liquidationPrice),
|
|
217
|
-
liquidationPriceChangePercentage: Number(ca.liquidationPriceChangePercentage),
|
|
218
225
|
notionalLtv: Number(ca.notionalLtv),
|
|
219
226
|
riskAdjustedLtv: Number(ca.riskAdjustedLtv),
|
|
220
227
|
};
|
package/dist/types.d.ts
CHANGED
|
@@ -95,8 +95,6 @@ export interface ClendAccount {
|
|
|
95
95
|
healthFactorRiskAdjusted: number;
|
|
96
96
|
notionalLeverage: number;
|
|
97
97
|
riskAdjustedLeverage: number;
|
|
98
|
-
liquidationPrice: number;
|
|
99
|
-
liquidationPriceChangePercentage: number;
|
|
100
98
|
notionalLtv: number;
|
|
101
99
|
riskAdjustedLtv: number;
|
|
102
100
|
}
|
|
@@ -110,6 +108,11 @@ export interface ClendAccountBalance {
|
|
|
110
108
|
liabilityBalanceUi: number;
|
|
111
109
|
liabilityValue: number;
|
|
112
110
|
price: number;
|
|
111
|
+
liquidation: ClendAccountAssetLiquidation | null;
|
|
112
|
+
}
|
|
113
|
+
export interface ClendAccountAssetLiquidation {
|
|
114
|
+
price: number;
|
|
115
|
+
changePercentage: number;
|
|
113
116
|
}
|
|
114
117
|
export interface GetBankResponse {
|
|
115
118
|
bank: Bank;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carrot-protocol/boost-http-client",
|
|
3
|
-
"version": "0.2.15-group-refactor1-dev-
|
|
3
|
+
"version": "0.2.15-group-refactor1-dev-1ee3fdf",
|
|
4
4
|
"description": "HTTP client for Carrot Boost",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@coral-xyz/anchor": "^0.29.0",
|
|
17
|
-
"@carrot-protocol/clend-common": "0.1.
|
|
17
|
+
"@carrot-protocol/clend-common": "0.1.8-group-refactor1-dev-cb4b228",
|
|
18
18
|
"axios": "^1.8.3",
|
|
19
19
|
"bs58": "^6.0.0",
|
|
20
20
|
"decimal.js": "^10.5.0"
|
package/src/index.ts
CHANGED
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
ClendAccountTxSummary,
|
|
21
21
|
UserRequest,
|
|
22
22
|
UserBalance,
|
|
23
|
+
ClendAccountAssetLiquidation,
|
|
23
24
|
} from "./types";
|
|
24
25
|
import encode from "bs58";
|
|
25
26
|
|
|
@@ -212,6 +213,15 @@ export class Client {
|
|
|
212
213
|
// parse lending account balances
|
|
213
214
|
const clendAccountBalances: ClendAccountBalance[] = [];
|
|
214
215
|
for (const b of (ca as any).balances) {
|
|
216
|
+
// parse liquidation data if exists
|
|
217
|
+
const liquidation: ClendAccountAssetLiquidation | null = b.liquidation
|
|
218
|
+
? {
|
|
219
|
+
price: Number(b.liquidation.price),
|
|
220
|
+
changePercentage: Number(b.liquidation.changePercentage),
|
|
221
|
+
}
|
|
222
|
+
: null;
|
|
223
|
+
|
|
224
|
+
// create clend account balance
|
|
215
225
|
clendAccountBalances.push({
|
|
216
226
|
mint: new web3.PublicKey(b.mint),
|
|
217
227
|
bank: new web3.PublicKey(b.bank),
|
|
@@ -222,6 +232,7 @@ export class Client {
|
|
|
222
232
|
liabilityBalanceUi: Number(b.liabilityBalanceUi),
|
|
223
233
|
liabilityValue: Number(b.liabilityValue),
|
|
224
234
|
price: Number(b.price),
|
|
235
|
+
liquidation,
|
|
225
236
|
});
|
|
226
237
|
}
|
|
227
238
|
|
|
@@ -239,10 +250,6 @@ export class Client {
|
|
|
239
250
|
),
|
|
240
251
|
notionalLeverage: Number((ca as any).notionalLeverage),
|
|
241
252
|
riskAdjustedLeverage: Number((ca as any).riskAdjustedLeverage),
|
|
242
|
-
liquidationPrice: Number((ca as any).liquidationPrice),
|
|
243
|
-
liquidationPriceChangePercentage: Number(
|
|
244
|
-
(ca as any).liquidationPriceChangePercentage,
|
|
245
|
-
),
|
|
246
253
|
notionalLtv: Number((ca as any).notionalLtv),
|
|
247
254
|
riskAdjustedLtv: Number((ca as any).riskAdjustedLtv),
|
|
248
255
|
};
|
package/src/types.ts
CHANGED
|
@@ -109,8 +109,6 @@ export interface ClendAccount {
|
|
|
109
109
|
healthFactorRiskAdjusted: number;
|
|
110
110
|
notionalLeverage: number;
|
|
111
111
|
riskAdjustedLeverage: number;
|
|
112
|
-
liquidationPrice: number;
|
|
113
|
-
liquidationPriceChangePercentage: number;
|
|
114
112
|
notionalLtv: number;
|
|
115
113
|
riskAdjustedLtv: number;
|
|
116
114
|
}
|
|
@@ -125,6 +123,12 @@ export interface ClendAccountBalance {
|
|
|
125
123
|
liabilityBalanceUi: number;
|
|
126
124
|
liabilityValue: number;
|
|
127
125
|
price: number;
|
|
126
|
+
liquidation: ClendAccountAssetLiquidation | null;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export interface ClendAccountAssetLiquidation {
|
|
130
|
+
price: number;
|
|
131
|
+
changePercentage: number;
|
|
128
132
|
}
|
|
129
133
|
|
|
130
134
|
export interface GetBankResponse {
|