@carrot-protocol/boost-http-client 0.2.16-group-refactor1-dev-50c976e → 0.2.16-token22-dev-158437a
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.d.ts +16 -8
- package/dist/index.js +220 -134
- package/dist/types.d.ts +100 -20
- package/dist/utils.d.ts +0 -2
- package/dist/utils.js +0 -9
- package/package.json +2 -2
- package/src/index.ts +329 -155
- package/src/types.ts +116 -21
- package/src/utils.ts +0 -8
package/dist/types.d.ts
CHANGED
|
@@ -3,14 +3,43 @@ export interface SendRequest {
|
|
|
3
3
|
userRequestId: string;
|
|
4
4
|
txns: string[];
|
|
5
5
|
}
|
|
6
|
+
/**
|
|
7
|
+
* Request to deposit collateral
|
|
8
|
+
*/
|
|
9
|
+
export interface DepositRequest {
|
|
10
|
+
owner: web3.PublicKey;
|
|
11
|
+
clendGroup: web3.PublicKey;
|
|
12
|
+
clendAccount: web3.PublicKey | null;
|
|
13
|
+
inputTokenMint: web3.PublicKey;
|
|
14
|
+
depositAmountUi: number;
|
|
15
|
+
}
|
|
16
|
+
export interface DepositResponse {
|
|
17
|
+
userRequestId: string;
|
|
18
|
+
unsignedBase64Tx: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Request to withdraw collateral
|
|
22
|
+
*/
|
|
23
|
+
export interface WithdrawRequest {
|
|
24
|
+
clendAccount: web3.PublicKey;
|
|
25
|
+
outputTokenMint: web3.PublicKey;
|
|
26
|
+
withdrawAmountUi: number;
|
|
27
|
+
withdrawAll: boolean;
|
|
28
|
+
}
|
|
29
|
+
export interface WithdrawResponse {
|
|
30
|
+
userRequestId: string;
|
|
31
|
+
unsignedBase64Tx: string;
|
|
32
|
+
}
|
|
6
33
|
/**
|
|
7
34
|
* Request to deposit collateral and create a leveraged position
|
|
8
35
|
*/
|
|
9
36
|
export interface DepositLeverageRequest {
|
|
10
37
|
owner: web3.PublicKey;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
38
|
+
clendGroup: web3.PublicKey;
|
|
39
|
+
clendAccount: web3.PublicKey | null;
|
|
40
|
+
inputTokenMint: web3.PublicKey;
|
|
41
|
+
assetTokenMint: web3.PublicKey;
|
|
42
|
+
liabilityTokenMint: web3.PublicKey;
|
|
14
43
|
depositAmountUi: number;
|
|
15
44
|
leverage: number;
|
|
16
45
|
slippageBps: number;
|
|
@@ -26,7 +55,9 @@ export interface DepositLeverageResponse {
|
|
|
26
55
|
* Request to adjust the leverage of an existing position
|
|
27
56
|
*/
|
|
28
57
|
export interface AdjustLeverageRequest {
|
|
29
|
-
|
|
58
|
+
clendAccount: web3.PublicKey;
|
|
59
|
+
assetTokenMint: web3.PublicKey;
|
|
60
|
+
liabilityTokenMint: web3.PublicKey;
|
|
30
61
|
leverage: number;
|
|
31
62
|
slippageBps: number;
|
|
32
63
|
}
|
|
@@ -41,8 +72,10 @@ export interface AdjustLeverageResponse {
|
|
|
41
72
|
* Request to withdraw from a leveraged position
|
|
42
73
|
*/
|
|
43
74
|
export interface WithdrawLeverageRequest {
|
|
44
|
-
|
|
45
|
-
|
|
75
|
+
clendAccount: web3.PublicKey;
|
|
76
|
+
outputTokenMint: web3.PublicKey;
|
|
77
|
+
assetTokenMint: web3.PublicKey;
|
|
78
|
+
liabilityTokenMint: web3.PublicKey;
|
|
46
79
|
withdrawAmountUi: number;
|
|
47
80
|
slippageBps: number;
|
|
48
81
|
withdrawAll: boolean;
|
|
@@ -54,52 +87,88 @@ export interface WithdrawLeverageResponse {
|
|
|
54
87
|
userRequestId: string;
|
|
55
88
|
unsignedBase64Tx: string;
|
|
56
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* Request to withdraw emissions from a bank
|
|
92
|
+
*/
|
|
93
|
+
export interface WithdrawEmissionsRequest {
|
|
94
|
+
owner: web3.PublicKey;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Response for withdraw emissions operation
|
|
98
|
+
*/
|
|
99
|
+
export interface WithdrawEmissionsResponse {
|
|
100
|
+
userRequestId: string;
|
|
101
|
+
unsignedBase64Tx: string;
|
|
102
|
+
}
|
|
103
|
+
export interface GetGroupsResponse {
|
|
104
|
+
groups: GroupAndBanks[];
|
|
105
|
+
}
|
|
57
106
|
export interface GetGroupResponse {
|
|
107
|
+
group: GroupAndBanks;
|
|
108
|
+
}
|
|
109
|
+
export interface GroupAndBanks {
|
|
110
|
+
group: web3.PublicKey;
|
|
111
|
+
groupName: string;
|
|
58
112
|
banks: Bank[];
|
|
59
113
|
}
|
|
60
114
|
export interface GetUserRequest {
|
|
61
|
-
|
|
62
|
-
|
|
115
|
+
groups: web3.PublicKey[];
|
|
116
|
+
user: web3.PublicKey;
|
|
117
|
+
getClendAccountSummary: boolean;
|
|
63
118
|
}
|
|
64
119
|
export interface GetUserResponse {
|
|
65
120
|
wallet: UserWallet;
|
|
66
|
-
|
|
67
|
-
|
|
121
|
+
clendAccounts: {
|
|
122
|
+
clendAccount: ClendAccount;
|
|
123
|
+
summary: ClendAccountTxSummary[];
|
|
124
|
+
}[];
|
|
68
125
|
}
|
|
69
126
|
export interface UserWallet {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
127
|
+
balances: UserBalance[];
|
|
128
|
+
}
|
|
129
|
+
export interface UserBalance {
|
|
130
|
+
mint: web3.PublicKey;
|
|
131
|
+
balance: BN;
|
|
132
|
+
balanceUi: number;
|
|
76
133
|
}
|
|
77
134
|
export interface ClendAccount {
|
|
78
|
-
|
|
135
|
+
key: web3.PublicKey;
|
|
136
|
+
group: web3.PublicKey;
|
|
137
|
+
balances: ClendAccountBalance[];
|
|
79
138
|
netValue: number;
|
|
80
139
|
netApy: number;
|
|
81
140
|
pnl: number;
|
|
141
|
+
totalEmissionsApy: number;
|
|
82
142
|
totalAssetValue: number;
|
|
83
143
|
totalLiabilityValue: number;
|
|
84
144
|
healthFactorNotional: number;
|
|
85
145
|
healthFactorRiskAdjusted: number;
|
|
86
146
|
notionalLeverage: number;
|
|
87
147
|
riskAdjustedLeverage: number;
|
|
88
|
-
liquidationPrice: number;
|
|
89
|
-
liquidationPriceChangePercentage: number;
|
|
90
148
|
notionalLtv: number;
|
|
91
149
|
riskAdjustedLtv: number;
|
|
92
150
|
}
|
|
93
|
-
export interface
|
|
151
|
+
export interface ClendAccountBalance {
|
|
94
152
|
mint: web3.PublicKey;
|
|
95
153
|
bank: web3.PublicKey;
|
|
154
|
+
tokenYieldApy: number;
|
|
96
155
|
assetBalance: BN;
|
|
97
156
|
assetBalanceUi: number;
|
|
98
157
|
assetValue: number;
|
|
158
|
+
assetEmissionsApy: number;
|
|
99
159
|
liabilityBalance: BN;
|
|
100
160
|
liabilityBalanceUi: number;
|
|
101
161
|
liabilityValue: number;
|
|
162
|
+
liabilityBorrowCostApy: number;
|
|
163
|
+
liabilityEmissionsApy: number;
|
|
164
|
+
emissionsOutstandingAndUnclaimed: BN;
|
|
165
|
+
emissionsOutstandingAndUnclaimedUi: number;
|
|
102
166
|
price: number;
|
|
167
|
+
liquidation: ClendAccountAssetLiquidation | null;
|
|
168
|
+
}
|
|
169
|
+
export interface ClendAccountAssetLiquidation {
|
|
170
|
+
price: number;
|
|
171
|
+
changePercentage: number;
|
|
103
172
|
}
|
|
104
173
|
export interface GetBankResponse {
|
|
105
174
|
bank: Bank;
|
|
@@ -108,6 +177,7 @@ export interface Bank {
|
|
|
108
177
|
group: web3.PublicKey;
|
|
109
178
|
key: web3.PublicKey;
|
|
110
179
|
mint: web3.PublicKey;
|
|
180
|
+
tokenYieldApy: number;
|
|
111
181
|
supplyApy: number;
|
|
112
182
|
borrowApy: number;
|
|
113
183
|
utilizationRate: number;
|
|
@@ -128,7 +198,17 @@ export interface Bank {
|
|
|
128
198
|
depositLimitUi: number;
|
|
129
199
|
borrowLimit: BN;
|
|
130
200
|
borrowLimitUi: number;
|
|
201
|
+
emissions: BankEmissions | null;
|
|
202
|
+
}
|
|
203
|
+
export interface BankEmissions {
|
|
204
|
+
emissionsMode: BankEmissionsMode;
|
|
205
|
+
emissionsApy: number;
|
|
206
|
+
emissionsMint: web3.PublicKey;
|
|
207
|
+
emissionsTokenPrice: number;
|
|
208
|
+
emissionsRate: BN;
|
|
209
|
+
emissionsRemainingUi: number;
|
|
131
210
|
}
|
|
211
|
+
export type BankEmissionsMode = "LENDING_ONLY" | "BORROW_ONLY" | "LENDING_AND_BORROWING";
|
|
132
212
|
export interface ClendAccountTxSummary {
|
|
133
213
|
txSig: string;
|
|
134
214
|
time: Date;
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import { web3 } from "@coral-xyz/anchor";
|
|
2
2
|
import { ClendAccount } from "./types";
|
|
3
3
|
export declare function netValueInToken(clendAccount: ClendAccount, tokenMint: web3.PublicKey): number;
|
|
4
|
-
export declare function getProductionGroups(): web3.PublicKey[];
|
|
5
|
-
export declare function getStagingGroups(): web3.PublicKey[];
|
package/dist/utils.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.netValueInToken = netValueInToken;
|
|
4
|
-
exports.getProductionGroups = getProductionGroups;
|
|
5
|
-
exports.getStagingGroups = getStagingGroups;
|
|
6
|
-
const anchor_1 = require("@coral-xyz/anchor");
|
|
7
4
|
// returns the net value of the clend account in a given tokens price
|
|
8
5
|
function netValueInToken(clendAccount, tokenMint) {
|
|
9
6
|
const clendAccountTokenBalance = clendAccount.balances.find((balance) => balance.mint.equals(tokenMint));
|
|
@@ -12,9 +9,3 @@ function netValueInToken(clendAccount, tokenMint) {
|
|
|
12
9
|
}
|
|
13
10
|
return clendAccount.netValue / clendAccountTokenBalance.price;
|
|
14
11
|
}
|
|
15
|
-
function getProductionGroups() {
|
|
16
|
-
return [new anchor_1.web3.PublicKey("9bCWxAXFdWQ9GcZTSU3G636T6EyGXYMgaWR74yc7QZz8")];
|
|
17
|
-
}
|
|
18
|
-
function getStagingGroups() {
|
|
19
|
-
return [new anchor_1.web3.PublicKey("HKMDWLBK7yUmorSx9argg2rYcro6KoWf41N57FccKRP5")];
|
|
20
|
-
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carrot-protocol/boost-http-client",
|
|
3
|
-
"version": "0.2.16-
|
|
3
|
+
"version": "0.2.16-token22-dev-158437a",
|
|
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-19efede",
|
|
18
18
|
"axios": "^1.8.3",
|
|
19
19
|
"bs58": "^6.0.0",
|
|
20
20
|
"decimal.js": "^10.5.0"
|