@carrot-protocol/http-client 0.2.60 → 0.2.61

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
@@ -13,6 +13,7 @@ export declare class Client {
13
13
  getHistoricalVaultApy(vault: anchor.web3.PublicKey, interval: VaultHistoricalInterval): Promise<HistoricalVaultApyResponse>;
14
14
  getUserPerformance(vault: anchor.web3.PublicKey, wallets: anchor.web3.PublicKey[]): Promise<UserPerformanceResponse>;
15
15
  getHistoricalVaultNav(vault: anchor.web3.PublicKey, interval: VaultHistoricalInterval): Promise<HistoricalVaultNavResponse>;
16
+ getVaultOhlc(vault: anchor.web3.PublicKey): Promise<VaultOhlcResponse>;
16
17
  issue(vault: anchor.web3.PublicKey, assetMint: anchor.web3.PublicKey, amount: anchor.BN): Promise<string>;
17
18
  redeem(vault: anchor.web3.PublicKey, assetMint: anchor.web3.PublicKey, amount: anchor.BN): Promise<string>;
18
19
  checkWallet(wallet: anchor.web3.PublicKey): Promise<CheckWalletResponse>;
@@ -121,3 +122,14 @@ export interface PortfolioValue {
121
122
  runningTotalDepositsUsd: number;
122
123
  portfolioValueUsd: number;
123
124
  }
125
+ export interface VaultOhlcResponse {
126
+ vault: anchor.web3.PublicKey;
127
+ data: OhlcEntry[];
128
+ }
129
+ export interface OhlcEntry {
130
+ time: number;
131
+ open: number;
132
+ high: number;
133
+ low: number;
134
+ close: number;
135
+ }
package/dist/index.js CHANGED
@@ -205,6 +205,20 @@ class Client {
205
205
  };
206
206
  return historicalVaultNavResponse;
207
207
  }
208
+ async getVaultOhlc(vault) {
209
+ const url = new URL(`${this.baseUrl}/vaultOhlc?vault=${vault.toString()}`);
210
+ const response = await (0, cross_fetch_1.default)(url, {
211
+ method: "GET",
212
+ headers: this.headers,
213
+ });
214
+ checkResponse(response);
215
+ const body = await response.json();
216
+ const vaultOhlcResponse = {
217
+ vault,
218
+ data: body,
219
+ };
220
+ return vaultOhlcResponse;
221
+ }
208
222
  // Issues new assets to a specified vault
209
223
  async issue(vault, assetMint, amount) {
210
224
  // error if provider is undefined
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carrot-protocol/http-client",
3
- "version": "0.2.60",
3
+ "version": "0.2.61",
4
4
  "description": "interact with carrot api",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -21,7 +21,7 @@
21
21
  ],
22
22
  "dependencies": {
23
23
  "@coral-xyz/anchor": "0.29.0",
24
- "@carrot-protocol/common": "0.2.58",
24
+ "@carrot-protocol/common": "0.2.60",
25
25
  "bs58": "^5.0.0",
26
26
  "cross-fetch": "^4.0.0"
27
27
  },