@carrot-protocol/boost-http-client 0.2.15-group-refactor1-dev-d9350a8 → 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 +1 -1
- 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,8 +207,7 @@ class Client {
|
|
|
199
207
|
liabilityBalanceUi: Number(b.liabilityBalanceUi),
|
|
200
208
|
liabilityValue: Number(b.liabilityValue),
|
|
201
209
|
price: Number(b.price),
|
|
202
|
-
|
|
203
|
-
liquidationPriceChangePercentage: Number(b.liquidationPriceChangePercentage),
|
|
210
|
+
liquidation,
|
|
204
211
|
});
|
|
205
212
|
}
|
|
206
213
|
// create clend account
|
package/dist/types.d.ts
CHANGED
|
@@ -108,8 +108,11 @@ export interface ClendAccountBalance {
|
|
|
108
108
|
liabilityBalanceUi: number;
|
|
109
109
|
liabilityValue: number;
|
|
110
110
|
price: number;
|
|
111
|
-
|
|
112
|
-
|
|
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
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,10 +232,7 @@ export class Client {
|
|
|
222
232
|
liabilityBalanceUi: Number(b.liabilityBalanceUi),
|
|
223
233
|
liabilityValue: Number(b.liabilityValue),
|
|
224
234
|
price: Number(b.price),
|
|
225
|
-
|
|
226
|
-
liquidationPriceChangePercentage: Number(
|
|
227
|
-
b.liquidationPriceChangePercentage,
|
|
228
|
-
),
|
|
235
|
+
liquidation,
|
|
229
236
|
});
|
|
230
237
|
}
|
|
231
238
|
|
package/src/types.ts
CHANGED
|
@@ -123,8 +123,12 @@ export interface ClendAccountBalance {
|
|
|
123
123
|
liabilityBalanceUi: number;
|
|
124
124
|
liabilityValue: number;
|
|
125
125
|
price: number;
|
|
126
|
-
|
|
127
|
-
|
|
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 {
|