@carrot-protocol/http-client 0.2.75-historical1-dev-a41cb35 → 0.2.75-poolapy1-dev-e2aaa14
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 +3 -2
- package/dist/index.js +13 -2
- package/dist/types.d.ts +6 -0
- package/package.json +1 -1
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 {
|
|
@@ -14,10 +14,11 @@ export declare class Client {
|
|
|
14
14
|
getUser(vault: anchor.web3.PublicKey): Promise<UserResponse>;
|
|
15
15
|
getHistoricalVaultApy(vault: anchor.web3.PublicKey, interval: VaultHistoricalInterval): Promise<HistoricalVaultApyResponse>;
|
|
16
16
|
getUserPerformance(vault: anchor.web3.PublicKey, wallets: anchor.web3.PublicKey[]): Promise<UserPerformanceResponse>;
|
|
17
|
-
getHistoricalVaultNav(vault: anchor.web3.PublicKey, interval: VaultHistoricalInterval
|
|
17
|
+
getHistoricalVaultNav(vault: anchor.web3.PublicKey, interval: VaultHistoricalInterval): Promise<HistoricalVaultNavResponse>;
|
|
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
|
@@ -195,8 +195,8 @@ class Client {
|
|
|
195
195
|
return getUserPerformanceResponse;
|
|
196
196
|
}
|
|
197
197
|
// Retrieves historical NAV data for a specific vault
|
|
198
|
-
async getHistoricalVaultNav(vault, interval
|
|
199
|
-
const url = new URL(`${this.baseUrl}/historicalVaultNav?vault=${vault.toString()}&interval=${interval}
|
|
198
|
+
async getHistoricalVaultNav(vault, interval) {
|
|
199
|
+
const url = new URL(`${this.baseUrl}/historicalVaultNav?vault=${vault.toString()}&interval=${interval}`);
|
|
200
200
|
const response = await (0, cross_fetch_1.default)(url, {
|
|
201
201
|
method: "GET",
|
|
202
202
|
headers: this.headers,
|
|
@@ -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,10 @@ export interface GetCarrotBoostJitWithdrawIxnsRequest {
|
|
|
126
126
|
export interface GetCarrotBoostJitWithdrawIxnsResponse {
|
|
127
127
|
instructions: anchor.web3.TransactionInstruction[];
|
|
128
128
|
}
|
|
129
|
+
export interface GetLatestPoolApyResponse {
|
|
130
|
+
poolName: string;
|
|
131
|
+
supplyApy: number;
|
|
132
|
+
borrowApy: number;
|
|
133
|
+
time: Date;
|
|
134
|
+
}
|
|
129
135
|
export {};
|