@carrot-protocol/http-client 0.2.74 → 0.2.75-poolapy1-dev-bc32090

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
@@ -1,6 +1,6 @@
1
1
  import * as anchor from "@coral-xyz/anchor";
2
2
  import { Vault, VaultPerformance } from "@carrot-protocol/common";
3
- import { CheckWalletResponse, ClaimReferralCodeResponse, GetCarrotBoostJitDepositIxnsRequest, GetCarrotBoostJitDepositIxnsResponse, GetCarrotBoostJitWithdrawIxnsRequest, GetCarrotBoostJitWithdrawIxnsResponse, GetReferralCodesResponse, HistoricalVaultApyResponse, HistoricalVaultNavResponse, UserPerformanceResponse, UserResponse, VaultHistoricalInterval, VaultOhlcResponse } from "./types";
3
+ import { CheckWalletResponse, ClaimReferralCodeResponse, GetCarrotBoostJitDepositIxnsRequest, GetCarrotBoostJitDepositIxnsResponse, GetCarrotBoostJitWithdrawIxnsRequest, GetCarrotBoostJitWithdrawIxnsResponse, GetLatestPoolApyResponse, GetReferralCodesResponse, HistoricalVaultApyResponse, HistoricalVaultNavResponse, UserPerformanceResponse, UserResponse, VaultHistoricalInterval, VaultOhlcResponse } from "./types";
4
4
  export * as Common from "@carrot-protocol/common";
5
5
  export * from "./types";
6
6
  export declare class Client {
@@ -18,6 +18,7 @@ export declare class Client {
18
18
  getVaultOhlc(vault: anchor.web3.PublicKey): Promise<VaultOhlcResponse>;
19
19
  issue(vault: anchor.web3.PublicKey, assetMint: anchor.web3.PublicKey, amount: anchor.BN): Promise<string>;
20
20
  redeem(vault: anchor.web3.PublicKey, assetMint: anchor.web3.PublicKey, amount: anchor.BN): Promise<string>;
21
+ getLatestPoolApy(poolNames: string[]): Promise<GetLatestPoolApyResponse>;
21
22
  checkWallet(wallet: anchor.web3.PublicKey): Promise<CheckWalletResponse>;
22
23
  claimReferralCode(wallet: anchor.web3.PublicKey, code: string): Promise<ClaimReferralCodeResponse>;
23
24
  getReferralCodes(wallet: anchor.web3.PublicKey): Promise<GetReferralCodesResponse>;
package/dist/index.js CHANGED
@@ -267,6 +267,17 @@ class Client {
267
267
  const txSig = await this.send(redeemResponse.tx);
268
268
  return txSig;
269
269
  }
270
+ async getLatestPoolApy(poolNames) {
271
+ const url = new URL(`${this.baseUrl}/latestPoolApy?poolNames=${poolNames.join(",")}`);
272
+ const response = await (0, cross_fetch_1.default)(url, {
273
+ method: "GET",
274
+ headers: this.headers,
275
+ });
276
+ checkResponse(response);
277
+ const responseBody = await response.json();
278
+ const body = JSON.parse(JSON.stringify(responseBody));
279
+ return body;
280
+ }
270
281
  // Checks the status of a specified wallet
271
282
  async checkWallet(wallet) {
272
283
  const url = new URL(`${this.baseUrl}/checkWallet?wallet=${wallet.toString()}`);
package/dist/types.d.ts CHANGED
@@ -126,4 +126,13 @@ export interface GetCarrotBoostJitWithdrawIxnsRequest {
126
126
  export interface GetCarrotBoostJitWithdrawIxnsResponse {
127
127
  instructions: anchor.web3.TransactionInstruction[];
128
128
  }
129
+ export interface GetLatestPoolApyRequest {
130
+ poolNames: string[];
131
+ }
132
+ export interface GetLatestPoolApyResponse {
133
+ poolName: string;
134
+ supplyApy: number;
135
+ borrowApy: number;
136
+ time: Date;
137
+ }
129
138
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carrot-protocol/http-client",
3
- "version": "0.2.74",
3
+ "version": "0.2.75-poolapy1-dev-bc32090",
4
4
  "description": "interact with carrot api",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",