@carrot-protocol/boost-http-client 0.2.16-group-refactor1-dev-50c976e → 0.2.16-token22-dev-998073e

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