@carrot-protocol/boost-http-client 0.2.15 → 0.2.16-group-refactor1-dev-50c976e

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,6 +1,6 @@
1
1
  import { BN, web3 } from "@coral-xyz/anchor";
2
2
 
3
- // Send a tx
3
+ // Represents a request to send a transaction
4
4
  export interface SendRequest {
5
5
  userRequestId: string;
6
6
  txns: string[];
@@ -11,11 +11,9 @@ export interface SendRequest {
11
11
  */
12
12
  export interface DepositLeverageRequest {
13
13
  owner: web3.PublicKey;
14
- clendGroup: web3.PublicKey;
15
- clendAccount: web3.PublicKey | null;
16
- inputTokenMint: web3.PublicKey;
17
- assetTokenMint: web3.PublicKey;
18
- liabilityTokenMint: web3.PublicKey;
14
+ inputMint: web3.PublicKey;
15
+ assetMint: web3.PublicKey;
16
+ liabilityMint: web3.PublicKey;
19
17
  depositAmountUi: number;
20
18
  leverage: number;
21
19
  slippageBps: number;
@@ -33,9 +31,7 @@ export interface DepositLeverageResponse {
33
31
  * Request to adjust the leverage of an existing position
34
32
  */
35
33
  export interface AdjustLeverageRequest {
36
- clendAccount: web3.PublicKey;
37
- assetTokenMint: web3.PublicKey;
38
- liabilityTokenMint: web3.PublicKey;
34
+ owner: web3.PublicKey;
39
35
  leverage: number;
40
36
  slippageBps: number;
41
37
  }
@@ -52,10 +48,8 @@ export interface AdjustLeverageResponse {
52
48
  * Request to withdraw from a leveraged position
53
49
  */
54
50
  export interface WithdrawLeverageRequest {
55
- clendAccount: web3.PublicKey;
56
- outputTokenMint: web3.PublicKey;
57
- assetTokenMint: web3.PublicKey;
58
- liabilityTokenMint: web3.PublicKey;
51
+ owner: web3.PublicKey;
52
+ selectedTokenMint: web3.PublicKey;
59
53
  withdrawAmountUi: number;
60
54
  slippageBps: number;
61
55
  withdrawAll: boolean;
@@ -69,99 +63,57 @@ export interface WithdrawLeverageResponse {
69
63
  unsignedBase64Tx: string;
70
64
  }
71
65
 
72
- /**
73
- * Request to withdraw emissions from a bank
74
- */
75
- export interface WithdrawEmissionsRequest {
76
- owner: web3.PublicKey;
77
- }
78
-
79
- /**
80
- * Response for withdraw emissions operation
81
- */
82
- export interface WithdrawEmissionsResponse {
83
- userRequestId: string;
84
- unsignedBase64Tx: string;
85
- }
86
-
87
- export interface GetGroupsResponse {
88
- groups: GroupAndBanks[];
89
- }
90
-
91
66
  export interface GetGroupResponse {
92
- group: GroupAndBanks;
93
- }
94
-
95
- export interface GroupAndBanks {
96
- group: web3.PublicKey;
97
- groupName: string;
98
67
  banks: Bank[];
99
68
  }
100
69
 
101
70
  export interface GetUserRequest {
102
- groups: web3.PublicKey[];
103
- user: web3.PublicKey;
104
- getClendAccountSummary: boolean;
71
+ user?: web3.PublicKey;
72
+ getClendAccountSummary?: boolean;
105
73
  }
106
74
 
107
75
  export interface GetUserResponse {
108
76
  wallet: UserWallet;
109
- clendAccounts: {
110
- clendAccount: ClendAccount;
111
- summary: ClendAccountTxSummary[];
112
- }[];
77
+ clendAccount: ClendAccount | undefined;
78
+ summary: ClendAccountTxSummary[];
113
79
  }
114
80
 
115
81
  export interface UserWallet {
116
- balances: UserBalance[];
117
- }
118
-
119
- export interface UserBalance {
120
- mint: web3.PublicKey;
121
- balance: BN;
122
- balanceUi: number;
82
+ usdcBalance: BN;
83
+ usdcBalanceUi: number;
84
+ jlpBalance: BN;
85
+ jlpBalanceUi: number;
86
+ solBalance: BN;
87
+ solBalanceUi: number;
123
88
  }
124
89
 
125
90
  export interface ClendAccount {
126
- key: web3.PublicKey;
127
- group: web3.PublicKey;
128
- balances: ClendAccountBalance[];
91
+ balances: Balance[];
129
92
  netValue: number;
130
93
  netApy: number;
131
94
  pnl: number;
132
- totalEmissionsApy: number;
133
95
  totalAssetValue: number;
134
96
  totalLiabilityValue: number;
135
97
  healthFactorNotional: number;
136
98
  healthFactorRiskAdjusted: number;
137
99
  notionalLeverage: number;
138
100
  riskAdjustedLeverage: number;
101
+ liquidationPrice: number;
102
+ liquidationPriceChangePercentage: number;
139
103
  notionalLtv: number;
140
104
  riskAdjustedLtv: number;
141
105
  }
142
106
 
143
- export interface ClendAccountBalance {
107
+ export interface Balance {
144
108
  mint: web3.PublicKey;
145
109
  bank: web3.PublicKey;
146
- tokenYieldApy: number;
147
110
  assetBalance: BN;
148
111
  assetBalanceUi: number;
149
112
  assetValue: number;
150
- assetEmissionsApy: number;
151
113
  liabilityBalance: BN;
152
114
  liabilityBalanceUi: number;
153
115
  liabilityValue: number;
154
- liabilityBorrowCostApy: number;
155
- liabilityEmissionsApy: number;
156
- emissionsOutstandingAndUnclaimed: BN;
157
- emissionsOutstandingAndUnclaimedUi: number;
158
- price: number;
159
- liquidation: ClendAccountAssetLiquidation | null;
160
- }
161
-
162
- export interface ClendAccountAssetLiquidation {
163
116
  price: number;
164
- changePercentage: number;
165
117
  }
166
118
 
167
119
  export interface GetBankResponse {
@@ -172,7 +124,6 @@ export interface Bank {
172
124
  group: web3.PublicKey;
173
125
  key: web3.PublicKey;
174
126
  mint: web3.PublicKey;
175
- tokenYieldApy: number;
176
127
  supplyApy: number;
177
128
  borrowApy: number;
178
129
  utilizationRate: number;
@@ -193,23 +144,8 @@ export interface Bank {
193
144
  depositLimitUi: number;
194
145
  borrowLimit: BN;
195
146
  borrowLimitUi: number;
196
- emissions: BankEmissions | null;
197
- }
198
-
199
- export interface BankEmissions {
200
- emissionsMode: BankEmissionsMode;
201
- emissionsApy: number;
202
- emissionsMint: web3.PublicKey;
203
- emissionsTokenPrice: number;
204
- emissionsRate: BN;
205
- emissionsRemainingUi: number;
206
147
  }
207
148
 
208
- export type BankEmissionsMode =
209
- | "LENDING_ONLY"
210
- | "BORROW_ONLY"
211
- | "LENDING_AND_BORROWING";
212
-
213
149
  export interface ClendAccountTxSummary {
214
150
  txSig: string;
215
151
  time: Date;
package/src/utils.ts CHANGED
@@ -15,3 +15,11 @@ 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
+ }