@carrot-protocol/http-client 0.2.13-api-cache-dev-874414e → 0.2.13-api-cache-dev-9dee0a2
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 +2 -2
- package/dist/index.js +6 -6
- package/package.json +4 -2
package/dist/index.d.ts
CHANGED
|
@@ -6,8 +6,8 @@ export declare class Client {
|
|
|
6
6
|
private headers;
|
|
7
7
|
constructor(baseUrl: string, provider: anchor.AnchorProvider);
|
|
8
8
|
index(): Promise<void>;
|
|
9
|
-
getVault(vault: anchor.web3.PublicKey,
|
|
10
|
-
getVaultPerformance(vault: anchor.web3.PublicKey): Promise<VaultPerformance>;
|
|
9
|
+
getVault(vault: anchor.web3.PublicKey, useCache: boolean): Promise<Vault>;
|
|
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: VaultHistoricalApyInterval): Promise<HistoricalVaultApyResponse>;
|
|
13
13
|
issue(vault: anchor.web3.PublicKey, assetMint: anchor.web3.PublicKey, amount: anchor.BN): Promise<string>;
|
package/dist/index.js
CHANGED
|
@@ -44,8 +44,8 @@ class Client {
|
|
|
44
44
|
const body = await response.json();
|
|
45
45
|
console.log(JSON.stringify(body, undefined, 2));
|
|
46
46
|
}
|
|
47
|
-
async getVault(vault,
|
|
48
|
-
const url = new URL(`${this.baseUrl}/vault?vault=${vault.toString()}&
|
|
47
|
+
async getVault(vault, useCache) {
|
|
48
|
+
const url = new URL(`${this.baseUrl}/vault?vault=${vault.toString()}&useCache=${useCache}`);
|
|
49
49
|
const response = await (0, cross_fetch_1.default)(url, {
|
|
50
50
|
method: "GET",
|
|
51
51
|
headers: this.headers,
|
|
@@ -53,10 +53,10 @@ class Client {
|
|
|
53
53
|
checkResponse(response);
|
|
54
54
|
const rawBody = await response.json();
|
|
55
55
|
let body = JSON.parse(JSON.stringify(rawBody));
|
|
56
|
-
body.address =
|
|
56
|
+
body.address = vault;
|
|
57
57
|
body.authority = new anchor.web3.PublicKey(body.authority);
|
|
58
58
|
body.shares = new anchor.web3.PublicKey(body.shares);
|
|
59
|
-
body.sharesSupply = new anchor.BN(body.sharesSupply);
|
|
59
|
+
body.sharesSupply = new anchor.BN(body.sharesSupply, "hex");
|
|
60
60
|
body.assets = body.assets.map((asset) => ({
|
|
61
61
|
...asset,
|
|
62
62
|
assetId: Number(asset.assetId),
|
|
@@ -85,8 +85,8 @@ class Client {
|
|
|
85
85
|
}));
|
|
86
86
|
return body;
|
|
87
87
|
}
|
|
88
|
-
async getVaultPerformance(vault) {
|
|
89
|
-
const url = new URL(`${this.baseUrl}/performance?vault=${vault.toString()}`);
|
|
88
|
+
async getVaultPerformance(vault, useCache) {
|
|
89
|
+
const url = new URL(`${this.baseUrl}/performance?vault=${vault.toString()}&useCache=${useCache}`);
|
|
90
90
|
const response = await (0, cross_fetch_1.default)(url, {
|
|
91
91
|
method: "GET",
|
|
92
92
|
headers: this.headers,
|
package/package.json
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carrot-protocol/http-client",
|
|
3
|
-
"version": "0.2.13-api-cache-dev-
|
|
3
|
+
"version": "0.2.13-api-cache-dev-9dee0a2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"
|
|
8
|
+
"clean": "rm -rf dist node_modules",
|
|
9
|
+
"build": "npm run clean && npm i && tsc && npm pack",
|
|
10
|
+
"build:dirty": "npm run clean && npm i && tsc && npm pack",
|
|
9
11
|
"fmt:check": "prettier --check src/",
|
|
10
12
|
"fmt": "prettier --write src/"
|
|
11
13
|
},
|