@carrot-protocol/boost-http-client 0.2.15-group-refactor1-dev-72c1344 → 0.2.15-group-refactor1-dev-5488543
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 +8 -3
- package/dist/types.d.ts +4 -0
- package/package.json +1 -1
- package/src/index.ts +8 -3
- package/src/types.ts +4 -0
package/dist/index.js
CHANGED
|
@@ -107,6 +107,7 @@ class Client {
|
|
|
107
107
|
async getUser(groups, user, getClendAccountSummary) {
|
|
108
108
|
const body = await handleApiCall(() => this.http.get(`/user?user=${user.toString()}&groups=${groups.map((g) => g.toString()).join(",")}&getClendAccountSummary=${getClendAccountSummary}`));
|
|
109
109
|
const jsonRawResponse = JSON.parse(body);
|
|
110
|
+
console.log(JSON.stringify(jsonRawResponse, null, 2));
|
|
110
111
|
// parse balances
|
|
111
112
|
const walletBalances = [];
|
|
112
113
|
for (const b of jsonRawResponse.wallet.balances) {
|
|
@@ -202,9 +203,13 @@ class Client {
|
|
|
202
203
|
assetBalance: new anchor_1.BN(b.assetBalance, "hex"),
|
|
203
204
|
assetBalanceUi: Number(b.assetBalanceUi),
|
|
204
205
|
assetValue: Number(b.assetValue),
|
|
206
|
+
assetYieldBps: Number(b.assetYieldBps),
|
|
207
|
+
assetYieldApy: Number(b.assetYieldApy),
|
|
205
208
|
liabilityBalance: new anchor_1.BN(b.liabilityBalance, "hex"),
|
|
206
209
|
liabilityBalanceUi: Number(b.liabilityBalanceUi),
|
|
207
210
|
liabilityValue: Number(b.liabilityValue),
|
|
211
|
+
liabilityBorrowCostBps: Number(b.liabilityBorrowCostBps),
|
|
212
|
+
liabilityBorrowCostApy: Number(b.liabilityBorrowCostApy),
|
|
208
213
|
price: Number(b.price),
|
|
209
214
|
liquidation,
|
|
210
215
|
});
|
|
@@ -269,11 +274,11 @@ class Client {
|
|
|
269
274
|
const body = await handleApiCall(() => this.http.get(`/group?group=${groupAddress.toString()}`));
|
|
270
275
|
const marketJson = JSON.parse(body);
|
|
271
276
|
const group = {
|
|
272
|
-
group: new anchor_1.web3.PublicKey(marketJson.group),
|
|
273
|
-
groupName: marketJson.groupName,
|
|
277
|
+
group: new anchor_1.web3.PublicKey(marketJson.group.group),
|
|
278
|
+
groupName: marketJson.group.groupName,
|
|
274
279
|
banks: [],
|
|
275
280
|
};
|
|
276
|
-
for (const bankJson of marketJson.banks) {
|
|
281
|
+
for (const bankJson of marketJson.group.banks) {
|
|
277
282
|
const bank = parseBank(bankJson);
|
|
278
283
|
group.banks.push(bank);
|
|
279
284
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -117,9 +117,13 @@ export interface ClendAccountBalance {
|
|
|
117
117
|
assetBalance: BN;
|
|
118
118
|
assetBalanceUi: number;
|
|
119
119
|
assetValue: number;
|
|
120
|
+
assetYieldBps: number;
|
|
121
|
+
assetYieldApy: number;
|
|
120
122
|
liabilityBalance: BN;
|
|
121
123
|
liabilityBalanceUi: number;
|
|
122
124
|
liabilityValue: number;
|
|
125
|
+
liabilityBorrowCostBps: number;
|
|
126
|
+
liabilityBorrowCostApy: number;
|
|
123
127
|
price: number;
|
|
124
128
|
liquidation: ClendAccountAssetLiquidation | null;
|
|
125
129
|
}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -119,6 +119,7 @@ export class Client {
|
|
|
119
119
|
);
|
|
120
120
|
|
|
121
121
|
const jsonRawResponse: any = JSON.parse(body);
|
|
122
|
+
console.log(JSON.stringify(jsonRawResponse, null, 2));
|
|
122
123
|
|
|
123
124
|
// parse balances
|
|
124
125
|
const walletBalances: UserBalance[] = [];
|
|
@@ -227,9 +228,13 @@ export class Client {
|
|
|
227
228
|
assetBalance: new BN(b.assetBalance, "hex"),
|
|
228
229
|
assetBalanceUi: Number(b.assetBalanceUi),
|
|
229
230
|
assetValue: Number(b.assetValue),
|
|
231
|
+
assetYieldBps: Number(b.assetYieldBps),
|
|
232
|
+
assetYieldApy: Number(b.assetYieldApy),
|
|
230
233
|
liabilityBalance: new BN(b.liabilityBalance, "hex"),
|
|
231
234
|
liabilityBalanceUi: Number(b.liabilityBalanceUi),
|
|
232
235
|
liabilityValue: Number(b.liabilityValue),
|
|
236
|
+
liabilityBorrowCostBps: Number(b.liabilityBorrowCostBps),
|
|
237
|
+
liabilityBorrowCostApy: Number(b.liabilityBorrowCostApy),
|
|
233
238
|
price: Number(b.price),
|
|
234
239
|
liquidation,
|
|
235
240
|
});
|
|
@@ -310,11 +315,11 @@ export class Client {
|
|
|
310
315
|
|
|
311
316
|
const marketJson: any = JSON.parse(body);
|
|
312
317
|
const group: GroupAndBanks = {
|
|
313
|
-
group: new web3.PublicKey(marketJson.group),
|
|
314
|
-
groupName: marketJson.groupName,
|
|
318
|
+
group: new web3.PublicKey(marketJson.group.group),
|
|
319
|
+
groupName: marketJson.group.groupName,
|
|
315
320
|
banks: [],
|
|
316
321
|
};
|
|
317
|
-
for (const bankJson of marketJson.banks) {
|
|
322
|
+
for (const bankJson of marketJson.group.banks) {
|
|
318
323
|
const bank = parseBank(bankJson);
|
|
319
324
|
group.banks.push(bank);
|
|
320
325
|
}
|
package/src/types.ts
CHANGED
|
@@ -134,9 +134,13 @@ export interface ClendAccountBalance {
|
|
|
134
134
|
assetBalance: BN;
|
|
135
135
|
assetBalanceUi: number;
|
|
136
136
|
assetValue: number;
|
|
137
|
+
assetYieldBps: number;
|
|
138
|
+
assetYieldApy: number;
|
|
137
139
|
liabilityBalance: BN;
|
|
138
140
|
liabilityBalanceUi: number;
|
|
139
141
|
liabilityValue: number;
|
|
142
|
+
liabilityBorrowCostBps: number;
|
|
143
|
+
liabilityBorrowCostApy: number;
|
|
140
144
|
price: number;
|
|
141
145
|
liquidation: ClendAccountAssetLiquidation | null;
|
|
142
146
|
}
|