@carrot-protocol/boost-http-client 0.2.15-group-refactor1-dev-a674ad3 → 0.2.15-group-refactor1-dev-647d298
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 +15 -0
- package/dist/types.d.ts +13 -0
- package/package.json +2 -2
- package/src/index.ts +18 -0
- package/src/types.ts +18 -0
package/dist/index.js
CHANGED
|
@@ -134,10 +134,12 @@ class Client {
|
|
|
134
134
|
assetBalance: new anchor_1.BN(b.assetBalance, "hex"),
|
|
135
135
|
assetBalanceUi: Number(b.assetBalanceUi),
|
|
136
136
|
assetValue: Number(b.assetValue),
|
|
137
|
+
assetEmissionsApy: Number(b.assetEmissionsApy),
|
|
137
138
|
liabilityBalance: new anchor_1.BN(b.liabilityBalance, "hex"),
|
|
138
139
|
liabilityBalanceUi: Number(b.liabilityBalanceUi),
|
|
139
140
|
liabilityValue: Number(b.liabilityValue),
|
|
140
141
|
liabilityBorrowCostApy: Number(b.liabilityBorrowCostApy),
|
|
142
|
+
liabilityEmissionsApy: Number(b.liabilityEmissionsApy),
|
|
141
143
|
price: Number(b.price),
|
|
142
144
|
liquidation,
|
|
143
145
|
};
|
|
@@ -149,6 +151,7 @@ class Client {
|
|
|
149
151
|
netValue: Number(rawClendAccount.netValue),
|
|
150
152
|
netApy: Number(rawClendAccount.netApy),
|
|
151
153
|
pnl: Number(rawClendAccount.pnl),
|
|
154
|
+
totalEmissionsApy: Number(rawClendAccount.totalEmissionsApy),
|
|
152
155
|
totalAssetValue: Number(rawClendAccount.totalAssetValue),
|
|
153
156
|
totalLiabilityValue: Number(rawClendAccount.totalLiabilityValue),
|
|
154
157
|
healthFactorNotional: Number(rawClendAccount.healthFactorNotional),
|
|
@@ -385,6 +388,17 @@ function getDummyProvider() {
|
|
|
385
388
|
});
|
|
386
389
|
}
|
|
387
390
|
function parseBank(bankJson) {
|
|
391
|
+
let bankEmissions = null;
|
|
392
|
+
if (bankJson.emissions) {
|
|
393
|
+
bankEmissions = {
|
|
394
|
+
emissionsMode: bankJson.emissions.emissionsMode,
|
|
395
|
+
emissionsApy: Number(bankJson.emissions.emissionsApy),
|
|
396
|
+
emissionsMint: new anchor_1.web3.PublicKey(bankJson.emissions.emissionsMint),
|
|
397
|
+
emissionsTokenPrice: Number(bankJson.emissions.emissionsTokenPrice),
|
|
398
|
+
emissionsRateUi: Number(bankJson.emissions.emissionsRateUi),
|
|
399
|
+
emissionsRemainingUi: Number(bankJson.emissions.emissionsRemainingUi),
|
|
400
|
+
};
|
|
401
|
+
}
|
|
388
402
|
return {
|
|
389
403
|
mint: new anchor_1.web3.PublicKey(bankJson.mint),
|
|
390
404
|
key: new anchor_1.web3.PublicKey(bankJson.key),
|
|
@@ -410,5 +424,6 @@ function parseBank(bankJson) {
|
|
|
410
424
|
depositLimitUi: Number(bankJson.depositLimitUi),
|
|
411
425
|
borrowLimit: new anchor_1.BN(bankJson.borrowLimit, "hex"),
|
|
412
426
|
borrowLimitUi: Number(bankJson.borrowLimitUi),
|
|
427
|
+
emissions: bankEmissions,
|
|
413
428
|
};
|
|
414
429
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -102,6 +102,7 @@ export interface ClendAccount {
|
|
|
102
102
|
netValue: number;
|
|
103
103
|
netApy: number;
|
|
104
104
|
pnl: number;
|
|
105
|
+
totalEmissionsApy: number;
|
|
105
106
|
totalAssetValue: number;
|
|
106
107
|
totalLiabilityValue: number;
|
|
107
108
|
healthFactorNotional: number;
|
|
@@ -118,10 +119,12 @@ export interface ClendAccountBalance {
|
|
|
118
119
|
assetBalance: BN;
|
|
119
120
|
assetBalanceUi: number;
|
|
120
121
|
assetValue: number;
|
|
122
|
+
assetEmissionsApy: number;
|
|
121
123
|
liabilityBalance: BN;
|
|
122
124
|
liabilityBalanceUi: number;
|
|
123
125
|
liabilityValue: number;
|
|
124
126
|
liabilityBorrowCostApy: number;
|
|
127
|
+
liabilityEmissionsApy: number;
|
|
125
128
|
price: number;
|
|
126
129
|
liquidation: ClendAccountAssetLiquidation | null;
|
|
127
130
|
}
|
|
@@ -157,7 +160,17 @@ export interface Bank {
|
|
|
157
160
|
depositLimitUi: number;
|
|
158
161
|
borrowLimit: BN;
|
|
159
162
|
borrowLimitUi: number;
|
|
163
|
+
emissions: BankEmissions | null;
|
|
160
164
|
}
|
|
165
|
+
export interface BankEmissions {
|
|
166
|
+
emissionsMode: BankEmissionsMode;
|
|
167
|
+
emissionsApy: number;
|
|
168
|
+
emissionsMint: web3.PublicKey;
|
|
169
|
+
emissionsTokenPrice: number;
|
|
170
|
+
emissionsRateUi: number;
|
|
171
|
+
emissionsRemainingUi: number;
|
|
172
|
+
}
|
|
173
|
+
export type BankEmissionsMode = "LENDING_ONLY" | "BORROW_ONLY" | "LENDING_AND_BORROWING";
|
|
161
174
|
export interface ClendAccountTxSummary {
|
|
162
175
|
txSig: string;
|
|
163
176
|
time: Date;
|
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-647d298",
|
|
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.8-group-refactor1-dev-
|
|
17
|
+
"@carrot-protocol/clend-common": "0.1.8-group-refactor1-dev-0c262b0",
|
|
18
18
|
"axios": "^1.8.3",
|
|
19
19
|
"bs58": "^6.0.0",
|
|
20
20
|
"decimal.js": "^10.5.0"
|
package/src/index.ts
CHANGED
|
@@ -23,6 +23,8 @@ import {
|
|
|
23
23
|
ClendAccountAssetLiquidation,
|
|
24
24
|
GetGroupsResponse,
|
|
25
25
|
GroupAndBanks,
|
|
26
|
+
BankEmissions,
|
|
27
|
+
BankEmissionsMode,
|
|
26
28
|
} from "./types";
|
|
27
29
|
import encode from "bs58";
|
|
28
30
|
|
|
@@ -155,10 +157,12 @@ export class Client {
|
|
|
155
157
|
assetBalance: new BN(b.assetBalance, "hex"),
|
|
156
158
|
assetBalanceUi: Number(b.assetBalanceUi),
|
|
157
159
|
assetValue: Number(b.assetValue),
|
|
160
|
+
assetEmissionsApy: Number(b.assetEmissionsApy),
|
|
158
161
|
liabilityBalance: new BN(b.liabilityBalance, "hex"),
|
|
159
162
|
liabilityBalanceUi: Number(b.liabilityBalanceUi),
|
|
160
163
|
liabilityValue: Number(b.liabilityValue),
|
|
161
164
|
liabilityBorrowCostApy: Number(b.liabilityBorrowCostApy),
|
|
165
|
+
liabilityEmissionsApy: Number(b.liabilityEmissionsApy),
|
|
162
166
|
price: Number(b.price),
|
|
163
167
|
liquidation,
|
|
164
168
|
};
|
|
@@ -171,6 +175,7 @@ export class Client {
|
|
|
171
175
|
netValue: Number(rawClendAccount.netValue),
|
|
172
176
|
netApy: Number(rawClendAccount.netApy),
|
|
173
177
|
pnl: Number(rawClendAccount.pnl),
|
|
178
|
+
totalEmissionsApy: Number(rawClendAccount.totalEmissionsApy),
|
|
174
179
|
totalAssetValue: Number(rawClendAccount.totalAssetValue),
|
|
175
180
|
totalLiabilityValue: Number(rawClendAccount.totalLiabilityValue),
|
|
176
181
|
healthFactorNotional: Number(rawClendAccount.healthFactorNotional),
|
|
@@ -515,6 +520,18 @@ function getDummyProvider(): AnchorProvider {
|
|
|
515
520
|
}
|
|
516
521
|
|
|
517
522
|
function parseBank(bankJson: any): Bank {
|
|
523
|
+
let bankEmissions: BankEmissions | null = null;
|
|
524
|
+
if (bankJson.emissions) {
|
|
525
|
+
bankEmissions = {
|
|
526
|
+
emissionsMode: bankJson.emissions.emissionsMode as BankEmissionsMode,
|
|
527
|
+
emissionsApy: Number(bankJson.emissions.emissionsApy),
|
|
528
|
+
emissionsMint: new web3.PublicKey(bankJson.emissions.emissionsMint),
|
|
529
|
+
emissionsTokenPrice: Number(bankJson.emissions.emissionsTokenPrice),
|
|
530
|
+
emissionsRateUi: Number(bankJson.emissions.emissionsRateUi),
|
|
531
|
+
emissionsRemainingUi: Number(bankJson.emissions.emissionsRemainingUi),
|
|
532
|
+
};
|
|
533
|
+
}
|
|
534
|
+
|
|
518
535
|
return {
|
|
519
536
|
mint: new web3.PublicKey(bankJson.mint),
|
|
520
537
|
key: new web3.PublicKey(bankJson.key),
|
|
@@ -540,5 +557,6 @@ function parseBank(bankJson: any): Bank {
|
|
|
540
557
|
depositLimitUi: Number(bankJson.depositLimitUi),
|
|
541
558
|
borrowLimit: new BN(bankJson.borrowLimit, "hex"),
|
|
542
559
|
borrowLimitUi: Number(bankJson.borrowLimitUi),
|
|
560
|
+
emissions: bankEmissions,
|
|
543
561
|
};
|
|
544
562
|
}
|
package/src/types.ts
CHANGED
|
@@ -118,6 +118,7 @@ export interface ClendAccount {
|
|
|
118
118
|
netValue: number;
|
|
119
119
|
netApy: number;
|
|
120
120
|
pnl: number;
|
|
121
|
+
totalEmissionsApy: number;
|
|
121
122
|
totalAssetValue: number;
|
|
122
123
|
totalLiabilityValue: number;
|
|
123
124
|
healthFactorNotional: number;
|
|
@@ -135,10 +136,12 @@ export interface ClendAccountBalance {
|
|
|
135
136
|
assetBalance: BN;
|
|
136
137
|
assetBalanceUi: number;
|
|
137
138
|
assetValue: number;
|
|
139
|
+
assetEmissionsApy: number;
|
|
138
140
|
liabilityBalance: BN;
|
|
139
141
|
liabilityBalanceUi: number;
|
|
140
142
|
liabilityValue: number;
|
|
141
143
|
liabilityBorrowCostApy: number;
|
|
144
|
+
liabilityEmissionsApy: number;
|
|
142
145
|
price: number;
|
|
143
146
|
liquidation: ClendAccountAssetLiquidation | null;
|
|
144
147
|
}
|
|
@@ -177,8 +180,23 @@ export interface Bank {
|
|
|
177
180
|
depositLimitUi: number;
|
|
178
181
|
borrowLimit: BN;
|
|
179
182
|
borrowLimitUi: number;
|
|
183
|
+
emissions: BankEmissions | null;
|
|
180
184
|
}
|
|
181
185
|
|
|
186
|
+
export interface BankEmissions {
|
|
187
|
+
emissionsMode: BankEmissionsMode;
|
|
188
|
+
emissionsApy: number;
|
|
189
|
+
emissionsMint: web3.PublicKey;
|
|
190
|
+
emissionsTokenPrice: number;
|
|
191
|
+
emissionsRateUi: number;
|
|
192
|
+
emissionsRemainingUi: number;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export type BankEmissionsMode =
|
|
196
|
+
| "LENDING_ONLY"
|
|
197
|
+
| "BORROW_ONLY"
|
|
198
|
+
| "LENDING_AND_BORROWING";
|
|
199
|
+
|
|
182
200
|
export interface ClendAccountTxSummary {
|
|
183
201
|
txSig: string;
|
|
184
202
|
time: Date;
|