@carrot-protocol/http-client 0.2.51 → 0.2.53-add-wallet-performance-dev-e6aacf5

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 CHANGED
@@ -10,6 +10,7 @@ export declare class Client {
10
10
  getVaultPerformance(vault: anchor.web3.PublicKey, useCache: boolean): Promise<VaultPerformance>;
11
11
  getUser(vault: anchor.web3.PublicKey): Promise<UserResponse>;
12
12
  getHistoricalVaultApy(vault: anchor.web3.PublicKey, interval: VaultHistoricalInterval): Promise<HistoricalVaultApyResponse>;
13
+ getUserPerformance(vault: anchor.web3.PublicKey, users: string): Promise<UserPerformanceResponse>;
13
14
  getHistoricalVaultNav(vault: anchor.web3.PublicKey, interval: VaultHistoricalInterval): Promise<HistoricalVaultNavResponse>;
14
15
  issue(vault: anchor.web3.PublicKey, assetMint: anchor.web3.PublicKey, amount: anchor.BN): Promise<string>;
15
16
  redeem(vault: anchor.web3.PublicKey, assetMint: anchor.web3.PublicKey, amount: anchor.BN): Promise<string>;
@@ -88,4 +89,49 @@ declare const allowedIntervals: readonly ["HOUR", "DAY", "WEEK"];
88
89
  export type VaultHistoricalInterval = (typeof allowedIntervals)[number];
89
90
  export declare function isValidVaultHistoricalInterval(interval: string): interval is VaultHistoricalInterval;
90
91
  export declare function prepareUnsignedTx(connection: anchor.web3.Connection, payer: anchor.web3.PublicKey, ixns: anchor.web3.TransactionInstruction[], lutAddr?: anchor.web3.PublicKey, additionalSigner?: anchor.AnchorProvider): Promise<string>;
92
+ export interface UserPerformanceResponse {
93
+ vault: anchor.web3.PublicKey;
94
+ users: string;
95
+ data: PerformanceData;
96
+ }
97
+ export interface PerformanceData {
98
+ crtAmountUi: number;
99
+ crtCurrentPrice: number;
100
+ crtCurrentValue: number;
101
+ holderSince: string;
102
+ stats: Stat[];
103
+ txCount: number;
104
+ txList: Transaction[];
105
+ runningCrtTotals: RunningTotal[];
106
+ portfolioValue: PortfolioValue[];
107
+ }
108
+ export interface Stat {
109
+ label: string;
110
+ value: number;
111
+ }
112
+ export interface Transaction {
113
+ block_time: number;
114
+ time: string;
115
+ activity_type: string;
116
+ amount: number;
117
+ flow: string;
118
+ trans_id: string;
119
+ wallet: string;
120
+ crtPrice: number;
121
+ crtValue: number;
122
+ cashFlow: number;
123
+ dateObject: string;
124
+ }
125
+ export interface RunningTotal {
126
+ date: string;
127
+ runningTotalCRT: number;
128
+ runningTotalDeposits: number;
129
+ }
130
+ export interface PortfolioValue {
131
+ date: number;
132
+ price: number;
133
+ runningTotalCRT: number;
134
+ runningTotalDeposits: number;
135
+ portfolioValue: number;
136
+ }
91
137
  export {};
package/dist/index.js CHANGED
@@ -161,6 +161,21 @@ class Client {
161
161
  };
162
162
  return historicalVaultApyResponse;
163
163
  }
164
+ async getUserPerformance(vault, users) {
165
+ const url = new URL(`${this.baseUrl}/userPerformance?vault=${vault.toString()}&users=${users}`);
166
+ const response = await (0, cross_fetch_1.default)(url, {
167
+ method: "GET",
168
+ headers: this.headers,
169
+ });
170
+ checkResponse(response);
171
+ const body = await response.json();
172
+ const getUserPerformanceResponse = {
173
+ vault,
174
+ users,
175
+ data: body,
176
+ };
177
+ return getUserPerformanceResponse;
178
+ }
164
179
  async getHistoricalVaultNav(vault, interval) {
165
180
  const url = new URL(`${this.baseUrl}/historicalVaultNav?vault=${vault.toString()}&interval=${interval}`);
166
181
  const response = await (0, cross_fetch_1.default)(url, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carrot-protocol/http-client",
3
- "version": "0.2.51",
3
+ "version": "0.2.53-add-wallet-performance-dev-e6aacf5",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",