@dripfi/drip-sdk 1.4.9 → 1.4.11

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.
Files changed (53) hide show
  1. package/README.md +206 -45
  2. package/dist/PerqApi.d.ts +22 -20
  3. package/dist/PerqApi.js +127 -92
  4. package/dist/PerqSdk.d.ts +35 -70
  5. package/dist/PerqSdk.js +51 -534
  6. package/dist/abi/ERC20.json +222 -0
  7. package/dist/contracts/ERC20TokenContract.d.ts +10 -0
  8. package/dist/contracts/ERC20TokenContract.js +34 -0
  9. package/dist/contracts/PerqSwapAndRecyclerContract.d.ts +3 -2
  10. package/dist/contracts/PerqSwapAndRecyclerContract.js +2 -2
  11. package/dist/contracts/PerqTokenRecyclerContract.d.ts +3 -2
  12. package/dist/contracts/PerqTokenRecyclerContract.js +2 -2
  13. package/dist/contracts/PerqVestingContract.d.ts +3 -2
  14. package/dist/contracts/PerqVestingContract.js +2 -2
  15. package/dist/subpackages/LitePackage.d.ts +16 -0
  16. package/dist/subpackages/LitePackage.js +102 -0
  17. package/dist/subpackages/LoyaltyCardsPackage.d.ts +12 -0
  18. package/dist/subpackages/LoyaltyCardsPackage.js +34 -0
  19. package/dist/subpackages/PoolsPackage.d.ts +16 -0
  20. package/dist/subpackages/PoolsPackage.js +52 -0
  21. package/dist/subpackages/RecyclerPackage.d.ts +13 -0
  22. package/dist/subpackages/RecyclerPackage.js +87 -0
  23. package/dist/subpackages/SignHandlerPackage.d.ts +8 -0
  24. package/dist/subpackages/SignHandlerPackage.js +33 -0
  25. package/dist/subpackages/TokenUtilsPackage.d.ts +13 -0
  26. package/dist/subpackages/TokenUtilsPackage.js +66 -0
  27. package/dist/subpackages/UserPackage.d.ts +10 -0
  28. package/dist/subpackages/UserPackage.js +36 -0
  29. package/dist/subpackages/V2Package.d.ts +24 -0
  30. package/dist/subpackages/V2Package.js +207 -0
  31. package/dist/subpackages/VestingPackage.d.ts +14 -0
  32. package/dist/subpackages/VestingPackage.js +112 -0
  33. package/dist/types/ChainId.d.ts +5 -0
  34. package/dist/types/ChainId.js +7 -0
  35. package/dist/types/DeployedProject.d.ts +4 -0
  36. package/dist/types/DetailedProjectData.d.ts +34 -0
  37. package/dist/types/DetailedProjectData.js +2 -0
  38. package/dist/types/Earnings.d.ts +11 -0
  39. package/dist/types/Earnings.js +2 -0
  40. package/dist/types/LinkWalletPayload.d.ts +4 -2
  41. package/dist/types/LinkedPodWallets.d.ts +5 -0
  42. package/dist/types/LinkedPodWallets.js +2 -0
  43. package/dist/types/MigrationOption.d.ts +6 -0
  44. package/dist/types/MigrationOption.js +2 -0
  45. package/dist/types/MyPerqData.d.ts +10 -10
  46. package/dist/types/PerqConfig.d.ts +5 -3
  47. package/dist/types/PerqConfig.js +12 -10
  48. package/dist/types/ReducedProjectData.d.ts +22 -0
  49. package/dist/types/ReducedProjectData.js +2 -0
  50. package/dist/types/VaultData.d.ts +33 -0
  51. package/dist/types/VaultData.js +2 -0
  52. package/dist/types/index.d.ts +8 -2
  53. package/package.json +2 -2
package/README.md CHANGED
@@ -8,7 +8,14 @@ The Drip SDK is a TypeScript library designed to interact with the Perq protocol
8
8
 
9
9
  - [Installation](#installation)
10
10
  - [Usage](#usage)
11
- - [Methods](#methods)
11
+ - [Modules](#modules)
12
+ - [Core SDK](#core-sdk)
13
+ - [V2 Vaults](#v2-vaults)
14
+ - [Lite Vaults](#lite-vaults)
15
+ - [Loyalty Cards](#loyalty-cards)
16
+ - [Vesting](#vesting)
17
+ - [Recycler](#recycler)
18
+ - [Sign Handler](#sign-handler)
12
19
  - [Examples](#examples)
13
20
  - [Types](#types)
14
21
  - [Abis](#abis)
@@ -31,52 +38,134 @@ import { PerqConfig } from '@dripfi/drip-sdk';
31
38
  Initialize the SDK with your Drip configuration and an optional signer:
32
39
 
33
40
  ```typescript
34
-
35
41
  const perqConfig: PerqConfig = PRODUCTION // if targeting ethereum mainnet
36
42
 
37
43
  const perqConfig: PerqConfig = DEVELOPMENT // if targeting sepolia testnet
38
44
 
39
- const signer: ethers.Signer = /* your Signer instance */;
45
+ const perqSupportedChainId: PerqSupportedChainId = ETHEREUM_CHAIN_ID // if targeting ethereum mainnet for lite vaults
40
46
 
41
- const perqSdk = new PerqSdk(perqConfig, signer);
42
- ```
47
+ const perqSupportedChainId: PerqSupportedChainId = BASE_CHAIN_ID // if targeting base for lite vaults
43
48
 
44
- # Methods
45
-
46
- | Name | Description |
47
- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
48
- | `getAllVaults(): Promise<Vault[]>` | Fetches details of all Perq Vaults. |
49
- | `getVaultDetails(vaultAddress: string): Promise<Vault>` | Fetches details of a specific Perq Vault identified by its address. |
50
- | `getVaultStats(): Promise<VaultStats>` | Returns some overall Perq stats |
51
- | `getTokenPrice(tokenName: string): Promise<number>` | Returns the price for the given token (only works for weth at the moment) |
52
- | `updateSigner(newSigner: Signer): Promise<void>` | Updates the signer for the SDK instance. |
53
- | `deposit(tokenAddress: string, vaultAddress: string, amount: string): Promise<string>` | The deposit function allows you to deposit tokens into a specific vault. Returns txHash. |
54
- | `getExpectedSwapResult(fromTokenAddress: string, toTokenAddress: string, amount: string, decimals: number): Promise<string>` | Returns the expected amount of tokens to get from a swap |
55
- | `getRewardsPerHour(vaultAddress: string): Promise<string[]>` | Returns an estimated amount of tokens the user will receive in 1 hour as reward. It considers boost nfts the user owns for the estimation. |
56
- | `getRewards(): Promise<UserRewards>` | Fetches the current user's rewards points for each vault. |
57
- | `getUserVaultBalance(): Promise<UserVaultBalance>` | Fetches the user's balance for a specific Perq Vault. |
58
- | `fastWithdraw(vault: Vault, amountToWithdraw?: string): Promise<string>` | For users who prefer not to wait for withdrawals to be processed, there is a Fast Withdrawal method. While this approach is more gas-intensive, as users bear the cost of executing the withdrawal process themselves, it allows for instant access to the withdrawn tokens. When utilizing Fast Withdrawal, users immediately receive the tokens, eliminating the need to initiate the 'claimWithdrawal' process separately. Returns txHash. |
59
- | `swapAndDeposit(fromTokenAddress: string, toTokenAddress: string, fromTokenAmount: string, vaultAddress: string, ethAmount?: string): Promise<string>` | The swapAndDeposit function allows you to deposit a different token or ether and it will take care of swapping to the correct token before making the deposit. Returns txHash. |
60
- | `withdraw(vault: Vault, amountToWithdraw?: string): Promise<string>` | Withdraws tokens from a vault. After withdrawing, you must wait for the withdrawal to be processed by the 'DoHardWork' function, and then you can claim those tokens using claimWithdraws(). Returns txHash. |
61
- | `claimWithdraws(vaultAddress: string): Promise<string>` | After the withdrawal has been processed by the 'DoHardWork' function, the 'claimWithdraws' function transfers the withdrawn tokens to their personal account. Returns txHash. |
62
- | `getTokenAllowanceForCurrency(tokenAddress: string): Promise<string>` | Retrieves the token allowance for a specific currency. |
63
- | `getTokenAllowanceForRecycler(tokenAddress: string): Promise<BigNumber>` | Retrieves the token allowance for the recycler contract. |
64
- | `getTokenAllowanceForSwapAndRecycler(tokenAddress: string): Promise<BigNumber>` | Retrieves the token allowance for the swap and recycler contract. |
65
- | `getUserBoostedNfts(vaultAddress: string): Promise<string[]>` | Retrieves an array of boosted NFT addresses owned by the user. |
66
- | `getRewardsPerHour(vaultAddress: string): Promise<number> ` | Returns an estimated amount of tokens the user will receive in one hour as a reward for the given vault |
67
- | `newDeposit(tokenAddress: string, vaultAddress: string, amount: string): Promise<string>` | Allows for a new deposit without checking for allowance. |
68
- | `newSwapAndDeposit(fromTokenAddress: string, toTokenAddress: string, fromTokenAmount: string, vaultAddress: string, ethAmount?: string): Promise<string> ` | Allows for a new swap and deposit without checking for allowance. |
69
- | `getAllVestingInfo(beneficiaryAddress: string): Promise<VestingInfo>` | Retrieves all vesting information for a specified beneficiary. |
70
- | `getVestingStart(): Promise<string>` | Retrieves the start time of the vesting period. |
71
- | `getVestingEnd(): Promise<string>` | Retrieves the end time of the vesting period. |
72
- | `getBeansHistory(): Promise<BeanEntry[]> ` | Retrieves the user's beans history of tx |
73
- | `getBeansBalance(): Promise<BeansBalance> ` | Retrieves the user's beans balance. |
74
- | `getMyPerqBalance(): Promise<MyPerqData>` | Retrieves the user's Perq balance data. |
75
- | `upgradeLoyaltyCard(index: number): Promise<LoyaltyCard>` | Upgrades the user's loyalty card. |
76
- | `getOwnedLoyaltyCard(): Promise<LoyaltyCard>` | Fetches the currently owned loyalty card of the connected wallet. |
77
- | `getAllLoyaltyCards(): Promise<LoyaltyCard[]>` | Fetches all available loyalty cards. |
49
+ const provider: ethers.providers.JsonRpcProvider = /* your Web3Provider instance */;
78
50
 
79
- ---
51
+ const perqSdk = new PerqSdk(perqConfig, perqSupportedChainId, provider?: ethers.providers.JsonRpcProvider);
52
+ ```
53
+
54
+ # Modules
55
+
56
+ ## Core SDK
57
+
58
+ Core methods available directly on the SDK instance:
59
+
60
+ | Method | Description |
61
+ | ------------------------------------------------ | ------------------------------------------------------------ |
62
+ | `updateSigner(newSigner: Signer): Promise<void>` | Updates the signer for the SDK instance and all its modules. |
63
+
64
+ ## Lite Vaults
65
+
66
+ Access Lite vault methods through `sdk.lite`:
67
+
68
+ | Method | Description |
69
+ | --------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------ |
70
+ | `getAllVaults(): Promise<VaultData[]>` | Fetches all Lite vaults. |
71
+ | `getVaultDetails(vaultAddress: string, onChainProjectId: number): Promise<VaultData>` | Fetches Lite vault details. |
72
+ | `deposit(tokenAddress: string, vaultAddress: string, onChainProjectId: number, amount: string): Promise<string>` | Deposits into Lite vault. |
73
+ | `withdraw(tokenAddress: string, vaultAddress: string, onChainProjectId: number, amount: string): Promise<string>` | Withdraws from Lite vault. |
74
+ | `swapAndDeposit(fromTokenAddress: string, toTokenAddress: string, amount: string, vaultAddress: string, onChainProjectId: number): Promise<string>` | Swaps and deposits into Lite vault. |
75
+ | `wrapAndDepositEth(vaultAddress: string, onChainProjectId: number, amount: string): Promise<string>` | Wraps ETH and deposits. |
76
+ | `getSwapAndDepositAllowance(tokenAddress: string): Promise<string>` | Fetches the allowance for swap and deposit operations. |
77
+ | `approveSwapAndDeposit(tokenAddress: string, amount: string): Promise<string>` | Approves a token for swap and deposit operations. |
78
+ | `getExpectedSwapResult(fromTokenAddress: string,toTokenAddress: string,amount: string,decimals: number): Promise<string>` | Calculates the expected result of a swap operation. |
79
+
80
+ ## Loyalty Cards
81
+
82
+ Access loyalty card methods through `sdk.loyaltyCards`:
83
+
84
+ | Method | Description |
85
+ | --------------------------------------------------------- | --------------------------------- |
86
+ | `getBeansBalance(): Promise<BeansBalance>` | Gets user's beans balance. |
87
+ | `getBeansHistory(): Promise<BeanEntry[]>` | Gets user's beans history. |
88
+ | `getSwapPerqForBeansInfo(): Promise<PerqToBeansSwapInfo>` | Gets swap info for Perq to beans. |
89
+ | `upgradeLoyaltyCard(index: number): Promise<LoyaltyCard>` | Upgrades loyalty card. |
90
+ | `getOwnedLoyaltyCard(): Promise<LoyaltyCard>` | Gets user's owned loyalty card. |
91
+ | `getAllLoyaltyCards(): Promise<LoyaltyCard[]>` | Gets all available loyalty cards. |
92
+
93
+ ## Vesting
94
+
95
+ Access vesting methods through `sdk.vesting`:
96
+
97
+ | Method | Description |
98
+ | ----------------------------------------------------------------------------------------------------- | ----------------------------- |
99
+ | `getVestingStart(): Promise<string>` | Gets vesting start time. |
100
+ | `getVestingEnd(): Promise<string>` | Gets vesting end time. |
101
+ | `getVestedAmount(beneficiary: string): Promise<string>` | Gets vested amount. |
102
+ | `getReleasableAmount(beneficiary: string): Promise<string>` | Gets releasable amount. |
103
+ | `getReleasableTotalAmount(beneficiary: string): Promise<string>` | Gets total releasable amount. |
104
+ | `getAllVestingInfo(beneficiaryAddress: string): Promise<VestingInfo>` | Gets all vesting info. |
105
+ | `claimVestedPerq(amount: string): Promise<string>` | Claims vested Perq. |
106
+ | `burnVestedPerq(amount: string, price: string, deadline: string, signature: string): Promise<string>` | Burns vested Perq. |
107
+
108
+ ## Pools
109
+
110
+ Access pools methods through `sdk.pools`:
111
+
112
+ | Method | Description |
113
+ | ----------------------------------------------------------------------------------------------- | ---------------------------------------------------- |
114
+ | `getUserPoolBalance(vaultAddress: string, onChainProjectId: number): Promise<UserVaultBalance>` | Fetches the user's balance in a specific pool. |
115
+ | `getAllPools(): Promise<VaultData[]>` | Fetches all available pools. |
116
+ | `getMyPerqBalance(): Promise<MyPerqData[]>` | Fetches the user's Perq balance. |
117
+ | `getPoolDetails(vaultAddress: string, onChainProjectId: number): Promise<VaultData>` | Fetches the details of a specific pool. |
118
+ | `getAllProjects(): Promise<ReducedProjectData[]>` | Fetches all available projects. |
119
+ | `getProjectDetails(projectName: string): Promise<DetailedProjectData>` | Fetches the details of a specific project. |
120
+ | `getPoolStats(): Promise<VaultStats>` | Fetches the statistics of a pool. |
121
+ | `getRewardsPerHour(vaultAddress: string): Promise<number>` | Calculates the rewards per hour for a specific pool. |
122
+ | `getUserBoostedNfts(vaultAddress: string): Promise<string[]>` | Fetches the user's boosted NFTs for a specific pool. |
123
+ | `getRewards(): Promise<UserRewards>` | Fetches the user's rewards. |
124
+
125
+ ## User
126
+
127
+ Access user methods through `sdk.user`:
128
+
129
+ | Method | Description |
130
+ | ------------------------------------------------------------------------ | ---------------------------------------------------------------------- |
131
+ | `linkSuiWalletWithEthWallet(suiWalletAddress: string): Promise<boolean>` | Links a Sui wallet with an Ethereum wallet. |
132
+ | `getLinkedSuiWallet(): Promise<string>` | Retrieves the Sui wallet address linked to the user's Ethereum wallet. |
133
+ | `getEarnings(projectName: string): Promise<Earnings>` | Retrieves the user earnings for each project's vaults |
134
+
135
+ ## Recycler
136
+
137
+ Access recycler methods through `sdk.recycler`:
138
+
139
+ | Method | Description |
140
+ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
141
+ | `getTokenAllowanceForRecycler(tokenAddress: string): Promise<BigNumber>` | Retrieves the token allowance for the recycler contract. |
142
+ | `getTokenAllowanceForSwapAndRecycler(tokenAddress: string): Promise<BigNumber>` | Retrieves the token allowance for the swap and recycler contract. |
143
+ | `async recycleTokens(tokenAddress: string = this.perqSdk.perqConfig.perqTokenAddress,amountToRecycle: string,beneficiary: string = ethers.constants.AddressZero,price: string,deadline: string,signature: string): Promise<string>` | Initiates the recycling of tokens for a given beneficiary, price, and deadline. |
144
+ | `swapAndRecycleETH(beneficiary: string,path: string[],minAmountOutWithDecimals: string,amountOfEth: string,price: string,deadline: string,signature: string): Promise<string>` | Executes a swap and recycling operation for ETH. |
145
+ | `swapAndRecycleERC20(beneficiary: string,path: string[],minAmountOutWithDecimals: string,amountInWithDecimals: string,price: string, deadline: string,signature: string): Promise<string>` | Executes a swap and recycling operation for ERC20 tokens. |
146
+ | `approveTokenForRecycler(tokenAddress: string, amount: string): Promise<string>` | Approves a token for use with the recycler contract. |
147
+ | `approveTokenForSwapAndRecycler(tokenAddress: string, amount: string): Promise<string>` | Approves a token for use with the swap and recycler contract. |
148
+
149
+ ## Token Utils
150
+
151
+ Access token utils methods through `sdk.tokenUtils`:
152
+ | Method | Description |
153
+ | -------------------------------------------------------------------- | -------------------------------------- |
154
+ | `getTokenPrice(tokenName: string): Promise<number>` | Fetches the current price of a given token."perq", "weth" "eth" and "wbtc" are supported |
155
+ | `getAllowance(tokenAddress: string, spender: string): Promise<string>` | Retrieves the current allowance for a token. |
156
+ | `approveAllowance(tokenAddress: string, amount: string, spenderAddress: string): Promise<string>` | Approves a specific amount of tokens for use by a spender. |
157
+ | `transferErc20Token(tokenAddress: string, amount: string, receiver: string): Promise<string>` | Transfers a specified amount of ERC20 tokens to a receiver. |
158
+ | `wrapEther(amount: string, tokenAddress: string): Promise<string>` | Wraps a specified amount of Ether into a WETH token. |
159
+ | `getERC20TokenAllowance(spender: string, tokenAddress: string): Promise<BigNumber>` | Retrieves the allowance for a specific ERC20 token. |
160
+ | `getPerqTokenContractAddress(): string` | Returns the contract address of the Perq token. |
161
+
162
+ ## Sign Handler
163
+
164
+ Access signing methods through `sdk.signHandler`:
165
+
166
+ | Method | Description |
167
+ | -------------------------------------------------------------------- | -------------------------------------- |
168
+ | `signPayload<T>(payload: T): Promise<NonceEnrichedSignedPayload<T>>` | Signs a payload with nonce enrichment. |
80
169
 
81
170
  # Examples
82
171
 
@@ -225,11 +314,6 @@ type BeansBalance = {
225
314
  bonusesClaimed: string[];
226
315
  };
227
316
 
228
- enum Chain {
229
- MAINNET = 'mainnet',
230
- SEPOLIA = 'sepolia',
231
- }
232
-
233
317
  type DeployedProject = {
234
318
  id: number | undefined;
235
319
  projectName: string;
@@ -348,12 +432,15 @@ type NonceEnrichedSignedPayload<T> = {
348
432
  type PerqConfig = {
349
433
  route: string;
350
434
  spoolSdkConfig: SDKConfig;
435
+ yelayLiteSdkConfig: sdkConfig;
351
436
  perqTokenAddress: string;
352
437
  perqTokenRecyclerAddress: string;
353
438
  perqSwapAndRecyclerAddress: string;
354
439
  perqVestingAddress: string;
355
440
  swapAndDepositContractAddress: string;
356
441
  smartVaultManagerContractAddress: string;
442
+ ethereumSwapperAddress: string;
443
+ baseSwapperAddress: string;
357
444
  };
358
445
 
359
446
  type PerqToBeansSwapInfo = {
@@ -423,6 +510,34 @@ type UserVaultBalance = {
423
510
  claimableBalance: string;
424
511
  };
425
512
 
513
+ type VaultData = {
514
+ depositToken: DepositToken;
515
+ vaultAddress: string;
516
+ projectName: string;
517
+ projectLogo: string;
518
+ projectType: string;
519
+ liveFrom: string;
520
+ liveUntil: string;
521
+ apy: number;
522
+ tvlUsd: number;
523
+ avgTvl: number;
524
+ tokenPrice: number;
525
+ change24h: number;
526
+ volume24h: number;
527
+ peakTvl: number;
528
+ onChainProjectId: number;
529
+ combinedTvl: number;
530
+ isActive: boolean;
531
+ owners: string[];
532
+ coingeckoId?: string;
533
+ expectedTge?: string;
534
+ chainId: ChainId;
535
+ distributionType: VaultType;
536
+ strategies: Strategy[];
537
+ rewards: VaultReward[];
538
+ stretchGoals: StretchGoal[];
539
+ };
540
+
426
541
  type Vault = {
427
542
  vaultName: string;
428
543
  vaultAddress: string;
@@ -488,6 +603,52 @@ type VestingInfo = {
488
603
  };
489
604
 
490
605
  type YelayVersion = 'v2' | 'lite';
606
+
607
+ // Additional Types:
608
+
609
+ type DetailedProjectData = {
610
+ // Project details
611
+ id: number;
612
+ projectName: string;
613
+ description: string;
614
+ // ... other project details
615
+ };
616
+
617
+ type ReducedProjectData = {
618
+ id: number;
619
+ projectName: string;
620
+ // ... reduced project information
621
+ };
622
+
623
+ type RewardType = 'token' | 'points';
624
+
625
+ type SDKConfig = {
626
+ chainId: number;
627
+ rpcUrl: string;
628
+ // ... other SDK configuration
629
+ };
630
+
631
+ const BASE_CHAIN_ID = 8453;
632
+ const ETHEREUM_CHAIN_ID = 1;
633
+ const ETHEREUM_SEPOLIA_CHAIN_ID = 11155111;
634
+ const ARBITRUM_CHAIN_ID = 42161;
635
+
636
+ type ChainId =
637
+ | typeof BASE_CHAIN_ID
638
+ | typeof ETHEREUM_CHAIN_ID
639
+ | typeof ETHEREUM_SEPOLIA_CHAIN_ID
640
+ | typeof ARBITRUM_CHAIN_ID;
641
+
642
+ type Earnings = {
643
+ [vaultAddress: string]: {
644
+ onChainProjectId: number;
645
+ precisionDecimals: number;
646
+ amountEarned: string;
647
+ symbol: string;
648
+ deposit: string;
649
+ earningPerHour: string;
650
+ };
651
+ };
491
652
  ```
492
653
 
493
654
  # Abis
package/dist/PerqApi.d.ts CHANGED
@@ -1,23 +1,24 @@
1
1
  import { BigNumber } from 'ethers';
2
- import { Vault, SwapInfo, QLFastRedeem, UserRewards, VaultStats, MyPerqData, LoyaltyCard, BeansBalance, PerqToBeansSwapInfo, BeanEntry, NonceEnrichedSignedPayload, NonceEnrichedPayload, UpgradeLoyaltyCardPayload, LinkWalletPayload } from './types';
2
+ import { SwapInfo, UserRewards, VaultStats, MyPerqData, LoyaltyCard, BeansBalance, PerqToBeansSwapInfo, BeanEntry, NonceEnrichedSignedPayload, NonceEnrichedPayload, UpgradeLoyaltyCardPayload, ReducedProjectData, DetailedProjectData, UserVaultBalance, Earnings, LinkedPodWallets, SuiWalletPayload, NearWalletPayload } from './types';
3
+ import VaultData from './types/VaultData';
4
+ import PerqSdk from './PerqSdk';
5
+ import MigrationOption from './types/MigrationOption';
3
6
  export default class PerqApi {
4
- route: string;
5
- constructor(route: string);
6
- fetchAllVaults(): Promise<Vault[]>;
7
+ private perqSdk;
8
+ constructor(perqSdk: PerqSdk);
9
+ fetchAllPools(): Promise<VaultData[]>;
10
+ fetchPoolV2Details(vaultAddress: string): Promise<VaultData>;
11
+ fetchPoolLiteDetails(vaultAddress: string, onChainProjectId: number): Promise<VaultData>;
12
+ fetchAllProjects(): Promise<ReducedProjectData[]>;
13
+ fetchProjetctDetails(projectName: string): Promise<DetailedProjectData>;
7
14
  fetchTokenPrice(tokenName: string): Promise<number>;
8
- getExpectedSwapResult(fromTokenAddress: string, toTokenAddress: string, amount: string, decimals: number): Promise<string>;
15
+ getExpectedSwapResult(fromTokenAddress: string, toTokenAddress: string, amount: string, decimals: number, chainId: string): Promise<string>;
9
16
  getUserBoostedNfts(walletAddress: string, vaultAddress: string): Promise<string[]>;
10
- fetchVaultStats(): Promise<VaultStats>;
11
- fetchVaultDetails(vaultAddress: string): Promise<Vault>;
17
+ fetchPoolStats(): Promise<VaultStats>;
12
18
  fetchRewardsPerHour(walletAddress: string, vaultAddress: string): Promise<number>;
13
- getSwapInfo(fromTokenAddress: string, toTokenAddress: string, amount: BigNumber, fromAddress: string): Promise<SwapInfo[]>;
14
- fetchUserSVTBalance(vaultAddress: string, walletAddress: string): Promise<BigNumber>;
15
- fetchUserBalance(vaultAddress: string, walletAddress: string): Promise<Record<string, string>>;
16
- fetchEnrichedUserWNFTForVault(vaultAddress: string, walletAddress: string): Promise<any[]>;
17
- fetchAllUserWNFTForVault(vaultAddress: string, walletAddress: string): Promise<any[]>;
18
- fetchAllUserDNFTForVault(vaultAddress: string, walletAddress: string): Promise<any[]>;
19
+ getSwapInfo(fromTokenAddress: string, toTokenAddress: string, amount: BigNumber, fromAddress: string, chainId: number): Promise<SwapInfo[]>;
20
+ fetchEnrichedUserWNFTForPool(vaultAddress: string, walletAddress: string): Promise<any[]>;
19
21
  fetchAssetPerSvtAtBlock(vaultAddress: string, blocknumber: number): Promise<BigNumber>;
20
- fetchFastWithdrawNFTs(vaultAddress: string, walletAddress: string): Promise<QLFastRedeem[]>;
21
22
  fetchUserRewards(walletAddress: string): Promise<UserRewards>;
22
23
  fetchAllLoyaltyCards(): Promise<LoyaltyCard[]>;
23
24
  fetchOwnedLoyaltyCard(walletAddress: string): Promise<LoyaltyCard>;
@@ -26,11 +27,12 @@ export default class PerqApi {
26
27
  fetchMyPerqData(userAddress: string): Promise<MyPerqData[]>;
27
28
  getSwapPerqForBeansInfo(): Promise<PerqToBeansSwapInfo>;
28
29
  fetchBeansHistory(walletAddress: string): Promise<BeanEntry[]>;
29
- linkSuiWalletWithEthWallet(signedPayload: NonceEnrichedSignedPayload<LinkWalletPayload>): Promise<boolean>;
30
- getLinkedSuiWallet(walletAddress: string): Promise<string>;
30
+ linkSuiWalletWithEthWallet(signedPayload: NonceEnrichedSignedPayload<SuiWalletPayload>): Promise<boolean>;
31
+ linkNearWalletWithEthWallet(signedPayload: NonceEnrichedSignedPayload<NearWalletPayload>): Promise<boolean>;
32
+ getPodWallets(walletAddress: string): Promise<LinkedPodWallets>;
31
33
  getNonceEnrichedPayload<T>(payload: T): Promise<NonceEnrichedPayload<T>>;
32
- fetchUserVaultDeposits(userAddress: string, vaultAddress: string): Promise<{
33
- pending: number;
34
- deposited: number;
35
- }>;
34
+ fetchV2PoolUserBalance(userAddress: string, vaultAddress: string): Promise<UserVaultBalance>;
35
+ fetchLitePoolUserBalance(userAddress: string, vaultAddress: string, onChainProjectId: number): Promise<UserVaultBalance>;
36
+ fetchEarnings(userAddress: string, projectName: string): Promise<Earnings>;
37
+ fetchMigrationOptions(vaultAddress: string, onChainProjectId: number): Promise<MigrationOption[]>;
36
38
  }