@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/src/types.ts CHANGED
@@ -1,19 +1,52 @@
1
1
  import { BN, web3 } from "@coral-xyz/anchor";
2
2
 
3
- // Represents a request to send a transaction
3
+ // Send a tx
4
4
  export interface SendRequest {
5
5
  userRequestId: string;
6
6
  txns: string[];
7
7
  }
8
8
 
9
+ /**
10
+ * Request to deposit collateral
11
+ */
12
+ export interface DepositRequest {
13
+ owner: web3.PublicKey;
14
+ clendGroup: web3.PublicKey;
15
+ clendAccount: web3.PublicKey | null;
16
+ inputTokenMint: web3.PublicKey;
17
+ depositAmountUi: number;
18
+ }
19
+
20
+ export interface DepositResponse {
21
+ userRequestId: string;
22
+ unsignedBase64Tx: string;
23
+ }
24
+
25
+ /**
26
+ * Request to withdraw collateral
27
+ */
28
+ export interface WithdrawRequest {
29
+ clendAccount: web3.PublicKey;
30
+ outputTokenMint: web3.PublicKey;
31
+ withdrawAmountUi: number;
32
+ withdrawAll: boolean;
33
+ }
34
+
35
+ export interface WithdrawResponse {
36
+ userRequestId: string;
37
+ unsignedBase64Tx: string;
38
+ }
39
+
9
40
  /**
10
41
  * Request to deposit collateral and create a leveraged position
11
42
  */
12
43
  export interface DepositLeverageRequest {
13
44
  owner: web3.PublicKey;
14
- inputMint: web3.PublicKey;
15
- assetMint: web3.PublicKey;
16
- liabilityMint: web3.PublicKey;
45
+ clendGroup: web3.PublicKey;
46
+ clendAccount: web3.PublicKey | null;
47
+ inputTokenMint: web3.PublicKey;
48
+ assetTokenMint: web3.PublicKey;
49
+ liabilityTokenMint: web3.PublicKey;
17
50
  depositAmountUi: number;
18
51
  leverage: number;
19
52
  slippageBps: number;
@@ -31,7 +64,9 @@ export interface DepositLeverageResponse {
31
64
  * Request to adjust the leverage of an existing position
32
65
  */
33
66
  export interface AdjustLeverageRequest {
34
- owner: web3.PublicKey;
67
+ clendAccount: web3.PublicKey;
68
+ assetTokenMint: web3.PublicKey;
69
+ liabilityTokenMint: web3.PublicKey;
35
70
  leverage: number;
36
71
  slippageBps: number;
37
72
  }
@@ -48,8 +83,10 @@ export interface AdjustLeverageResponse {
48
83
  * Request to withdraw from a leveraged position
49
84
  */
50
85
  export interface WithdrawLeverageRequest {
51
- owner: web3.PublicKey;
52
- selectedTokenMint: web3.PublicKey;
86
+ clendAccount: web3.PublicKey;
87
+ outputTokenMint: web3.PublicKey;
88
+ assetTokenMint: web3.PublicKey;
89
+ liabilityTokenMint: web3.PublicKey;
53
90
  withdrawAmountUi: number;
54
91
  slippageBps: number;
55
92
  withdrawAll: boolean;
@@ -63,57 +100,99 @@ export interface WithdrawLeverageResponse {
63
100
  unsignedBase64Tx: string;
64
101
  }
65
102
 
103
+ /**
104
+ * Request to withdraw emissions from a bank
105
+ */
106
+ export interface WithdrawEmissionsRequest {
107
+ owner: web3.PublicKey;
108
+ }
109
+
110
+ /**
111
+ * Response for withdraw emissions operation
112
+ */
113
+ export interface WithdrawEmissionsResponse {
114
+ userRequestId: string;
115
+ unsignedBase64Tx: string;
116
+ }
117
+
118
+ export interface GetGroupsResponse {
119
+ groups: GroupAndBanks[];
120
+ }
121
+
66
122
  export interface GetGroupResponse {
123
+ group: GroupAndBanks;
124
+ }
125
+
126
+ export interface GroupAndBanks {
127
+ group: web3.PublicKey;
128
+ groupName: string;
67
129
  banks: Bank[];
68
130
  }
69
131
 
70
132
  export interface GetUserRequest {
71
- user?: web3.PublicKey;
72
- getClendAccountSummary?: boolean;
133
+ groups: web3.PublicKey[];
134
+ user: web3.PublicKey;
135
+ getClendAccountSummary: boolean;
73
136
  }
74
137
 
75
138
  export interface GetUserResponse {
76
139
  wallet: UserWallet;
77
- clendAccount: ClendAccount | undefined;
78
- summary: ClendAccountTxSummary[];
140
+ clendAccounts: {
141
+ clendAccount: ClendAccount;
142
+ summary: ClendAccountTxSummary[];
143
+ }[];
79
144
  }
80
145
 
81
146
  export interface UserWallet {
82
- usdcBalance: BN;
83
- usdcBalanceUi: number;
84
- jlpBalance: BN;
85
- jlpBalanceUi: number;
86
- solBalance: BN;
87
- solBalanceUi: number;
147
+ balances: UserBalance[];
148
+ }
149
+
150
+ export interface UserBalance {
151
+ mint: web3.PublicKey;
152
+ balance: BN;
153
+ balanceUi: number;
88
154
  }
89
155
 
90
156
  export interface ClendAccount {
91
- balances: Balance[];
157
+ key: web3.PublicKey;
158
+ group: web3.PublicKey;
159
+ balances: ClendAccountBalance[];
92
160
  netValue: number;
93
161
  netApy: number;
94
162
  pnl: number;
163
+ totalEmissionsApy: number;
95
164
  totalAssetValue: number;
96
165
  totalLiabilityValue: number;
97
166
  healthFactorNotional: number;
98
167
  healthFactorRiskAdjusted: number;
99
168
  notionalLeverage: number;
100
169
  riskAdjustedLeverage: number;
101
- liquidationPrice: number;
102
- liquidationPriceChangePercentage: number;
103
170
  notionalLtv: number;
104
171
  riskAdjustedLtv: number;
105
172
  }
106
173
 
107
- export interface Balance {
174
+ export interface ClendAccountBalance {
108
175
  mint: web3.PublicKey;
109
176
  bank: web3.PublicKey;
177
+ tokenYieldApy: number;
110
178
  assetBalance: BN;
111
179
  assetBalanceUi: number;
112
180
  assetValue: number;
181
+ assetEmissionsApy: number;
113
182
  liabilityBalance: BN;
114
183
  liabilityBalanceUi: number;
115
184
  liabilityValue: number;
185
+ liabilityBorrowCostApy: number;
186
+ liabilityEmissionsApy: number;
187
+ emissionsOutstandingAndUnclaimed: BN;
188
+ emissionsOutstandingAndUnclaimedUi: number;
116
189
  price: number;
190
+ liquidation: ClendAccountAssetLiquidation | null;
191
+ }
192
+
193
+ export interface ClendAccountAssetLiquidation {
194
+ price: number;
195
+ changePercentage: number;
117
196
  }
118
197
 
119
198
  export interface GetBankResponse {
@@ -124,6 +203,7 @@ export interface Bank {
124
203
  group: web3.PublicKey;
125
204
  key: web3.PublicKey;
126
205
  mint: web3.PublicKey;
206
+ tokenYieldApy: number;
127
207
  supplyApy: number;
128
208
  borrowApy: number;
129
209
  utilizationRate: number;
@@ -144,8 +224,23 @@ export interface Bank {
144
224
  depositLimitUi: number;
145
225
  borrowLimit: BN;
146
226
  borrowLimitUi: number;
227
+ emissions: BankEmissions | null;
147
228
  }
148
229
 
230
+ export interface BankEmissions {
231
+ emissionsMode: BankEmissionsMode;
232
+ emissionsApy: number;
233
+ emissionsMint: web3.PublicKey;
234
+ emissionsTokenPrice: number;
235
+ emissionsRate: BN;
236
+ emissionsRemainingUi: number;
237
+ }
238
+
239
+ export type BankEmissionsMode =
240
+ | "LENDING_ONLY"
241
+ | "BORROW_ONLY"
242
+ | "LENDING_AND_BORROWING";
243
+
149
244
  export interface ClendAccountTxSummary {
150
245
  txSig: string;
151
246
  time: Date;
package/src/utils.ts CHANGED
@@ -15,11 +15,3 @@ export function netValueInToken(
15
15
 
16
16
  return clendAccount.netValue / clendAccountTokenBalance.price;
17
17
  }
18
-
19
- export function getProductionGroups(): web3.PublicKey[] {
20
- return [new web3.PublicKey("9bCWxAXFdWQ9GcZTSU3G636T6EyGXYMgaWR74yc7QZz8")];
21
- }
22
-
23
- export function getStagingGroups(): web3.PublicKey[] {
24
- return [new web3.PublicKey("HKMDWLBK7yUmorSx9argg2rYcro6KoWf41N57FccKRP5")];
25
- }