@dripfi/drip-sdk 1.4.27 → 1.4.28-bridge-perq-1

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/README.md CHANGED
@@ -120,6 +120,7 @@ Access pools methods through `sdk.pools`:
120
120
  | `getAllProjects(): Promise<ReducedProjectData[]>` | Fetches all available projects. |
121
121
  | `getProjectDetails(projectName: string): Promise<DetailedProjectData>` | Fetches the details of a specific project. |
122
122
  | `getPoolStats(): Promise<VaultStats>` | Fetches the statistics of a pool. |
123
+ | `getOverallStats(): Promise<OverallStats>` | Fetches different stats |
123
124
  | `getRewardsPerHour(vaultAddress: string): Promise<number>` | Calculates the rewards per hour for a specific pool. |
124
125
  | `getUserBoostedNfts(vaultAddress: string): Promise<string[]>` | Fetches the user's boosted NFTs for a specific pool. |
125
126
  | `getRewards(): Promise<UserRewards>` | Fetches the user's rewards. |
@@ -281,6 +282,38 @@ const txHash = await lite.withdraw(
281
282
  );
282
283
  ```
283
284
 
285
+ ### `checkMainnetToSonicBridgeApproval(amount: string): Promise<boolean>`
286
+
287
+ I want to check if the User approved the bridge contract to bridge 10 PERQ from MAINNET to SONIC
288
+
289
+ ```typescript
290
+ const hasApprovedAmount = await dripSdk.bridge.checkMainnetToSonicBridgeApproval('10');
291
+ ```
292
+
293
+ ### `approveMainnetToSonicBridge(amount: string): Promise<string>`
294
+
295
+ I want to approve to bridge 10 PERQ from MAINNET to SONIC
296
+
297
+ ```typescript
298
+ const txHash = await dripSdk.bridge.approveMainnetToSonicBridge('10');
299
+ ```
300
+
301
+ ### `bridgeMainnetToSonic(amount: string): Promise<string>`
302
+
303
+ I want to bridge 10 PERQ from MAINNET to SONIC
304
+
305
+ ```typescript
306
+ const txHash = await dripSdk.bridge.bridgeMainnetToSonic('10');
307
+ ```
308
+
309
+ ### `bridgeSonicToMainnet(amount: string): Promise<string>`
310
+
311
+ I want to bridge 10 PERQ from SONIC to MAINNET
312
+
313
+ ```typescript
314
+ const txHash = await dripSdk.bridge.bridgeSonicToMainnet('10');
315
+ ```
316
+
284
317
  ## Types
285
318
 
286
319
  ```typescript
@@ -433,15 +466,15 @@ type NonceEnrichedSignedPayload<T> = {
433
466
 
434
467
  type PerqConfig = {
435
468
  route: string;
436
- yelayLiteSdkConfig: sdkConfig;
437
469
  perqTokenAddress: string;
438
470
  perqTokenRecyclerAddress: string;
439
471
  perqSwapAndRecyclerAddress: string;
440
472
  perqVestingAddress: string;
441
473
  swapAndDepositContractAddress: string;
442
- smartVaultManagerContractAddress: string;
443
474
  ethereumSwapperAddress: string;
444
- baseSwapperAddress: string;
475
+ smartVaultManagerContractAddress: string,
476
+ bridgeMainnetPerqToSonicAddress: string;
477
+ bridgeSonicPerqToMainnetAddress: string;
445
478
  };
446
479
 
447
480
  type PerqToBeansSwapInfo = {
@@ -683,16 +716,22 @@ type Earnings = {
683
716
  earningPerHour: string;
684
717
  };
685
718
  };
719
+
720
+ type OverallStats = {
721
+ activeProjects: number;
722
+ totalTvl: number;
723
+ totalYieldUsd: number;
724
+ totalUsers: number;
725
+ };
726
+
686
727
  ```
687
728
 
688
729
  ## Abis
689
730
 
690
731
  - PERQ_SWAP_AND_RECYCLER_ABI
691
-
692
732
  - WETH_TOKEN_ABI
693
-
694
733
  - PERQ_TOKEN_ABI
695
-
696
734
  - TOKEN_RECYCLER_ABI
697
-
698
735
  - PERQ_VESTING_ABI
736
+ - BRIDGE_SONIC_PERQ_TO_MAINNET_ABI
737
+ - BRIDGE_MAINNET_PERQ_TO_SONIC_ABI
package/dist/PerqApi.d.ts CHANGED
@@ -5,6 +5,7 @@ import PerqSdk from './PerqSdk';
5
5
  import MigrationOption from './types/MigrationOption';
6
6
  import ProjectHistoricalTvl from './types/ProjectHistoricalTvl';
7
7
  import ClaimSpecialEditionLoyaltyCardPayload from './types/ClaimSpecialEditionLoyaltyCardPayload';
8
+ import OverallStats from './types/OverallStats';
8
9
  export default class PerqApi {
9
10
  private perqSdk;
10
11
  constructor(perqSdk: PerqSdk);
@@ -17,6 +18,7 @@ export default class PerqApi {
17
18
  getExpectedSwapResult(fromTokenAddress: string, toTokenAddress: string, amount: string, decimals: number, chainId: string): Promise<string>;
18
19
  getUserBoostedNfts(walletAddress: string, vaultAddress: string): Promise<string[]>;
19
20
  fetchPoolStats(): Promise<VaultStats>;
21
+ fetchOverallStats(): Promise<OverallStats>;
20
22
  fetchRewardsPerHour(walletAddress: string, vaultAddress: string): Promise<number>;
21
23
  getSwapInfo(fromTokenAddress: string, toTokenAddress: string, amount: BigNumber, fromAddress: string, chainId: number): Promise<SwapInfo[]>;
22
24
  fetchEnrichedUserWNFTForPool(vaultAddress: string, walletAddress: string): Promise<any[]>;
package/dist/PerqApi.js CHANGED
@@ -105,6 +105,16 @@ class PerqApi {
105
105
  throw Error(`${await res.text()}`);
106
106
  }
107
107
  }
108
+ async fetchOverallStats() {
109
+ const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/overallStats`);
110
+ if (res.ok) {
111
+ const data = await res.json();
112
+ return data;
113
+ }
114
+ else {
115
+ throw Error(`${await res.text()}`);
116
+ }
117
+ }
108
118
  async fetchRewardsPerHour(walletAddress, vaultAddress) {
109
119
  const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/user/${walletAddress}/rewardsPerHour/${vaultAddress}`);
110
120
  if (res.ok) {
package/dist/PerqSdk.d.ts CHANGED
@@ -3,6 +3,7 @@ import { PerqConfig } from './types';
3
3
  import PerqApi from './PerqApi';
4
4
  import { PerqSwapAndRecyclerContract, PerqTokenRecyclerContract, PerqVestingContract } from './contracts';
5
5
  import VestingPackage from './subpackages/VestingPackage';
6
+ import BridgePerqPackage from './subpackages/BridgePerqPackage';
6
7
  import LitePackage from './subpackages/LitePackage';
7
8
  import RecyclerPackage from './subpackages/RecyclerPackage';
8
9
  import LoyaltyCardsPackage from './subpackages/LoyaltyCardsPackage';
@@ -17,6 +18,7 @@ export default class PerqSdk {
17
18
  signer?: Signer;
18
19
  lite: LitePackage;
19
20
  vesting: VestingPackage;
21
+ bridge: BridgePerqPackage;
20
22
  recycler: RecyclerPackage;
21
23
  loyaltyCards: LoyaltyCardsPackage;
22
24
  tokenUtils: TokenUtilsPackage;
package/dist/PerqSdk.js CHANGED
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const PerqApi_1 = __importDefault(require("./PerqApi"));
7
7
  const contracts_1 = require("./contracts");
8
8
  const VestingPackage_1 = __importDefault(require("./subpackages/VestingPackage"));
9
+ const BridgePerqPackage_1 = __importDefault(require("./subpackages/BridgePerqPackage"));
9
10
  const LitePackage_1 = __importDefault(require("./subpackages/LitePackage"));
10
11
  const RecyclerPackage_1 = __importDefault(require("./subpackages/RecyclerPackage"));
11
12
  const LoyaltyCardsPackage_1 = __importDefault(require("./subpackages/LoyaltyCardsPackage"));
@@ -19,6 +20,7 @@ class PerqSdk {
19
20
  signer;
20
21
  lite;
21
22
  vesting;
23
+ bridge;
22
24
  recycler;
23
25
  loyaltyCards;
24
26
  tokenUtils;
@@ -38,6 +40,7 @@ class PerqSdk {
38
40
  this.yelayLiteSdk = new sdk_1.YelayLiteSdk(this.signer, chainId, false);
39
41
  }
40
42
  this.vesting = new VestingPackage_1.default(this);
43
+ this.bridge = new BridgePerqPackage_1.default(this);
41
44
  this.lite = new LitePackage_1.default(this);
42
45
  this.recycler = new RecyclerPackage_1.default(this);
43
46
  this.loyaltyCards = new LoyaltyCardsPackage_1.default(this);
@@ -56,6 +59,7 @@ class PerqSdk {
56
59
  this.perqVestingContract = new contracts_1.PerqVestingContract(this);
57
60
  this.perqTokenRecyclerContract = new contracts_1.PerqTokenRecyclerContract(this);
58
61
  this.perqSwapAndRecyclerContract = new contracts_1.PerqSwapAndRecyclerContract(this);
62
+ this.bridge = new BridgePerqPackage_1.default(this);
59
63
  }
60
64
  }
61
65
  exports.default = PerqSdk;