@dripfi/drip-sdk 1.4.21 → 1.4.22

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/PerqApi.d.ts CHANGED
@@ -3,6 +3,7 @@ import { SwapInfo, UserRewards, VaultStats, MyPerqData, LoyaltyCard, BeansBalanc
3
3
  import VaultData from './types/VaultData';
4
4
  import PerqSdk from './PerqSdk';
5
5
  import MigrationOption from './types/MigrationOption';
6
+ import ProjectHistoricalTvl from './types/ProjectHistoricalTvl';
6
7
  export default class PerqApi {
7
8
  private perqSdk;
8
9
  constructor(perqSdk: PerqSdk);
@@ -34,4 +35,5 @@ export default class PerqApi {
34
35
  fetchLitePoolUserBalance(userAddress: string, vaultAddress: string, onChainProjectId: number): Promise<string>;
35
36
  fetchEarnings(userAddress: string, projectName: string): Promise<Earnings>;
36
37
  fetchMigrationOptions(vaultAddress: string, onChainProjectId: number): Promise<MigrationOption[]>;
38
+ fetchHistoricalTvl(projectName: string): Promise<ProjectHistoricalTvl>;
37
39
  }
package/dist/PerqApi.js CHANGED
@@ -366,5 +366,15 @@ class PerqApi {
366
366
  throw Error(`${await res.text()}`);
367
367
  }
368
368
  }
369
+ async fetchHistoricalTvl(projectName) {
370
+ const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/projects/tvl/${projectName}`);
371
+ if (res.ok) {
372
+ const data = await res.json();
373
+ return data;
374
+ }
375
+ else {
376
+ throw Error(`${await res.text()}`);
377
+ }
378
+ }
369
379
  }
370
380
  exports.default = PerqApi;
@@ -1,6 +1,7 @@
1
1
  import PerqSdk from '../PerqSdk';
2
2
  import MigrationOption from '../types/MigrationOption';
3
3
  import { PerqSupportedChainId } from '../types/PerqConfig';
4
+ import ProjectHistoricalTvl from '../types/ProjectHistoricalTvl';
4
5
  export default class LitePackage {
5
6
  perqSdk: PerqSdk;
6
7
  constructor(perqSdk: PerqSdk);
@@ -14,4 +15,5 @@ export default class LitePackage {
14
15
  getExpectedSwapResult(fromTokenAddress: string, toTokenAddress: string, amount: string, decimals: number, chainId: PerqSupportedChainId): Promise<string>;
15
16
  getMigrationOptions(vaultAddress: string, onChainProjectId: number): Promise<MigrationOption[]>;
16
17
  migrateDepositToOtherProject(tokenAddress: string, vaultAddress: string, fromProjectId: number, toProjectId: number, amount: string): Promise<string>;
18
+ getHistoricalTvl(projectName: string): Promise<ProjectHistoricalTvl>;
17
19
  }
@@ -98,5 +98,9 @@ class LitePackage {
98
98
  const res = await this.perqSdk.yelayLiteSdk.vaults.migrate(vaultAddress, fromProjectId, toProjectId, BigInt(parsedAmountToDeposit.toString()));
99
99
  return res.hash;
100
100
  }
101
+ async getHistoricalTvl(projectName) {
102
+ const res = await this.perqSdk.perqApi.fetchHistoricalTvl(projectName);
103
+ return res;
104
+ }
101
105
  }
102
106
  exports.default = LitePackage;
@@ -0,0 +1,4 @@
1
+ type ProjectHistoricalTvl = {
2
+ [timestamp: number]: number;
3
+ };
4
+ export default ProjectHistoricalTvl;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dripfi/drip-sdk",
3
- "version": "1.4.21",
3
+ "version": "1.4.22",
4
4
  "description": "Drip SDK",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",