@dripfi/drip-sdk 1.4.3-yelay-lite-11 → 1.4.3-yelay-lite-12

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
@@ -53,26 +53,25 @@ const perqSdk = new PerqSdk(perqConfig, provider);
53
53
 
54
54
  Core methods available directly on the SDK instance:
55
55
 
56
- | Method | Description |
57
- | ------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
58
- | `updateSigner(newSigner: Signer): Promise<void>` | Updates the signer for the SDK instance and all its modules. |
59
-
56
+ | Method | Description |
57
+ | ------------------------------------------------ | ------------------------------------------------------------ |
58
+ | `updateSigner(newSigner: Signer): Promise<void>` | Updates the signer for the SDK instance and all its modules. |
60
59
 
61
60
  ## Lite Vaults
62
61
 
63
62
  Access Lite vault methods through `sdk.lite`:
64
63
 
65
- | Method | Description |
66
- | --------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------- |
67
- | `getAllVaults(): Promise<VaultData[]>` | Fetches all Lite vaults. |
68
- | `getVaultDetails(vaultAddress: string, onChainProjectId: number): Promise<VaultData>` | Fetches Lite vault details. |
69
- | `deposit(tokenAddress: string, vaultAddress: string, onChainProjectId: number, amount: string): Promise<string>` | Deposits into Lite vault. |
70
- | `withdraw(tokenAddress: string, vaultAddress: string, onChainProjectId: number, amount: string): Promise<string>` | Withdraws from Lite vault. |
71
- | `swapAndDeposit(fromTokenAddress: string, toTokenAddress: string, amount: string, vaultAddress: string, onChainProjectId: number): Promise<string>` | Swaps and deposits into Lite vault. |
72
- | `wrapAndDepositEth(vaultAddress: string, onChainProjectId: number, amount: string): Promise<string>`| Wraps ETH and deposits. |
73
- | `getSwapAndDepositAllowance(tokenAddress: string): Promise<string>`| Fetches the allowance for swap and deposit operations. |
74
- | `approveSwapAndDeposit(tokenAddress: string, amount: string): Promise<string>` | Approves a token for swap and deposit operations. |
75
- | `getExpectedSwapResult(fromTokenAddress: string,toTokenAddress: string,amount: string,decimals: number): Promise<string>`| Calculates the expected result of a swap operation. |
64
+ | Method | Description |
65
+ | --------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------ |
66
+ | `getAllVaults(): Promise<VaultData[]>` | Fetches all Lite vaults. |
67
+ | `getVaultDetails(vaultAddress: string, onChainProjectId: number): Promise<VaultData>` | Fetches Lite vault details. |
68
+ | `deposit(tokenAddress: string, vaultAddress: string, onChainProjectId: number, amount: string): Promise<string>` | Deposits into Lite vault. |
69
+ | `withdraw(tokenAddress: string, vaultAddress: string, onChainProjectId: number, amount: string): Promise<string>` | Withdraws from Lite vault. |
70
+ | `swapAndDeposit(fromTokenAddress: string, toTokenAddress: string, amount: string, vaultAddress: string, onChainProjectId: number): Promise<string>` | Swaps and deposits into Lite vault. |
71
+ | `wrapAndDepositEth(vaultAddress: string, onChainProjectId: number, amount: string): Promise<string>` | Wraps ETH and deposits. |
72
+ | `getSwapAndDepositAllowance(tokenAddress: string): Promise<string>` | Fetches the allowance for swap and deposit operations. |
73
+ | `approveSwapAndDeposit(tokenAddress: string, amount: string): Promise<string>` | Approves a token for swap and deposit operations. |
74
+ | `getExpectedSwapResult(fromTokenAddress: string,toTokenAddress: string,amount: string,decimals: number): Promise<string>` | Calculates the expected result of a swap operation. |
76
75
 
77
76
  ## Loyalty Cards
78
77
 
@@ -102,56 +101,51 @@ Access vesting methods through `sdk.vesting`:
102
101
  | `claimVestedPerq(amount: string): Promise<string>` | Claims vested Perq. |
103
102
  | `burnVestedPerq(amount: string, price: string, deadline: string, signature: string): Promise<string>` | Burns vested Perq. |
104
103
 
105
-
106
104
  ## Pools
107
105
 
108
106
  Access pools methods through `sdk.pools`:
109
107
 
110
- | Method | Description |
111
- | -------------------------------------------------------------------- | -------------------------------------- |
112
- | `getUserPoolBalance(vaultAddress: string, onChainProjectId: number): Promise<UserVaultBalance>` | Fetches the user's balance in a specific pool. |
113
- | `getAllPools(): Promise<VaultData[]>` | Fetches all available pools. |
114
- | `getMyPerqBalance(): Promise<MyPerqData[]>` | Fetches the user's Perq balance. |
115
- | `getPoolDetails(vaultAddress: string, onChainProjectId: number): Promise<VaultData>` | Fetches the details of a specific pool. |
116
- | `getAllProjects(): Promise<ReducedProjectData[]>` | Fetches all available projects. |
117
- | `getProjectDetails(projectName: string): Promise<DetailedProjectData>` | Fetches the details of a specific project. |
118
- | `getPoolStats(): Promise<VaultStats>` | Fetches the statistics of a pool. |
119
- | `getRewardsPerHour(vaultAddress: string): Promise<number>` | Calculates the rewards per hour for a specific pool. |
120
- | `getUserBoostedNfts(vaultAddress: string): Promise<string[]>` | Fetches the user's boosted NFTs for a specific pool. |
121
- | `getRewards(): Promise<UserRewards>` | Fetches the user's rewards. |
122
-
108
+ | Method | Description |
109
+ | ----------------------------------------------------------------------------------------------- | ---------------------------------------------------- |
110
+ | `getUserPoolBalance(vaultAddress: string, onChainProjectId: number): Promise<UserVaultBalance>` | Fetches the user's balance in a specific pool. |
111
+ | `getAllPools(): Promise<VaultData[]>` | Fetches all available pools. |
112
+ | `getMyPerqBalance(): Promise<MyPerqData[]>` | Fetches the user's Perq balance. |
113
+ | `getPoolDetails(vaultAddress: string, onChainProjectId: number): Promise<VaultData>` | Fetches the details of a specific pool. |
114
+ | `getAllProjects(): Promise<ReducedProjectData[]>` | Fetches all available projects. |
115
+ | `getProjectDetails(projectName: string): Promise<DetailedProjectData>` | Fetches the details of a specific project. |
116
+ | `getPoolStats(): Promise<VaultStats>` | Fetches the statistics of a pool. |
117
+ | `getRewardsPerHour(vaultAddress: string): Promise<number>` | Calculates the rewards per hour for a specific pool. |
118
+ | `getUserBoostedNfts(vaultAddress: string): Promise<string[]>` | Fetches the user's boosted NFTs for a specific pool. |
119
+ | `getRewards(): Promise<UserRewards>` | Fetches the user's rewards. |
123
120
 
124
121
  ## User
125
122
 
126
123
  Access user methods through `sdk.user`:
127
124
 
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
-
125
+ | Method | Description |
126
+ | ------------------------------------------------------------------------ | ---------------------------------------------------------------------- |
127
+ | `linkSuiWalletWithEthWallet(suiWalletAddress: string): Promise<boolean>` | Links a Sui wallet with an Ethereum wallet. |
128
+ | `getLinkedSuiWallet(): Promise<string>` | Retrieves the Sui wallet address linked to the user's Ethereum wallet. |
129
+ | `getEarnings(projectName: string): Promise<Earnings>` | Retrieves the user earnings for each project's vaults |
135
130
 
136
131
  ## Recycler
137
132
 
138
133
  Access recycler methods through `sdk.recycler`:
139
134
 
140
-
141
- | Method | Description |
142
- | -------------------------------------------------------------------- | -------------------------------------- |
143
- | `getTokenAllowanceForRecycler(tokenAddress: string): Promise<BigNumber>` | Retrieves the token allowance for the recycler contract. |
144
- | `getTokenAllowanceForSwapAndRecycler(tokenAddress: string): Promise<BigNumber>` | Retrieves the token allowance for the swap and recycler contract. |
135
+ | Method | Description |
136
+ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
137
+ | `getTokenAllowanceForRecycler(tokenAddress: string): Promise<BigNumber>` | Retrieves the token allowance for the recycler contract. |
138
+ | `getTokenAllowanceForSwapAndRecycler(tokenAddress: string): Promise<BigNumber>` | Retrieves the token allowance for the swap and recycler contract. |
145
139
  | `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. |
146
- | `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. |
147
- | `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. |
148
- | `approveTokenForRecycler(tokenAddress: string, amount: string): Promise<string>` | Approves a token for use with the recycler contract. |
149
- | `approveTokenForSwapAndRecycler(tokenAddress: string, amount: string): Promise<string>` | Approves a token for use with the swap and recycler contract. |
140
+ | `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. |
141
+ | `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. |
142
+ | `approveTokenForRecycler(tokenAddress: string, amount: string): Promise<string>` | Approves a token for use with the recycler contract. |
143
+ | `approveTokenForSwapAndRecycler(tokenAddress: string, amount: string): Promise<string>` | Approves a token for use with the swap and recycler contract. |
150
144
 
151
145
  ## Token Utils
152
146
 
153
147
  Access token utils methods through `sdk.tokenUtils`:
154
- | Method | Description |
148
+ | Method | Description |
155
149
  | -------------------------------------------------------------------- | -------------------------------------- |
156
150
  | `getTokenPrice(tokenName: string): Promise<number>` | Fetches the current price of a given token."perq", "weth" "eth" and "wbtc" are supported |
157
151
  | `getAllowance(tokenAddress: string, spender: string): Promise<string>` | Retrieves the current allowance for a token. |
@@ -161,10 +155,6 @@ Access token utils methods through `sdk.tokenUtils`:
161
155
  | `getERC20TokenAllowance(spender: string, tokenAddress: string): Promise<BigNumber>` | Retrieves the allowance for a specific ERC20 token. |
162
156
  | `getPerqTokenContractAddress(): string` | Returns the contract address of the Perq token. |
163
157
 
164
-
165
-
166
-
167
-
168
158
  ## Sign Handler
169
159
 
170
160
  Access signing methods through `sdk.signHandler`:
@@ -438,15 +428,15 @@ type NonceEnrichedSignedPayload<T> = {
438
428
  type PerqConfig = {
439
429
  route: string;
440
430
  spoolSdkConfig: SDKConfig;
441
- yelayLiteSdkConfig: sdkConfig,
431
+ yelayLiteSdkConfig: sdkConfig;
442
432
  perqTokenAddress: string;
443
433
  perqTokenRecyclerAddress: string;
444
434
  perqSwapAndRecyclerAddress: string;
445
435
  perqVestingAddress: string;
446
436
  swapAndDepositContractAddress: string;
447
437
  smartVaultManagerContractAddress: string;
448
- ethereumSwapperAddress: string,
449
- baseSwapperAddress: string,
438
+ ethereumSwapperAddress: string;
439
+ baseSwapperAddress: string;
450
440
  };
451
441
 
452
442
  type PerqToBeansSwapInfo = {
@@ -538,7 +528,7 @@ type VaultData = {
538
528
  coingeckoId?: string;
539
529
  expectedTge?: string;
540
530
  chainId: ChainId;
541
- poolType: VaultType;
531
+ distributionType: VaultType;
542
532
  strategies: Strategy[];
543
533
  rewards: VaultReward[];
544
534
  stretchGoals: StretchGoal[];
@@ -655,7 +645,6 @@ type Earnings = {
655
645
  earningPerHour: string;
656
646
  };
657
647
  };
658
-
659
648
  ```
660
649
 
661
650
  # Abis
@@ -10,4 +10,5 @@ export default class LitePackage {
10
10
  withdraw(tokenAddress: string, vaultAddress: string, onChainProjectId: number, amount: string): Promise<string>;
11
11
  wrapAndDepositEth(vaultAddress: string, onChainProjectId: number, amount: string): Promise<any>;
12
12
  getExpectedSwapResult(fromTokenAddress: string, toTokenAddress: string, amount: string, decimals: number): Promise<string>;
13
+ migrateDepositToOtherProject(tokenAddress: string, vaultAddress: string, fromProjectId: number, toProjectId: number, amount: string): Promise<string>;
13
14
  }
@@ -84,5 +84,16 @@ class LitePackage {
84
84
  async getExpectedSwapResult(fromTokenAddress, toTokenAddress, amount, decimals) {
85
85
  return this.perqSdk.perqApi.getExpectedSwapResult(fromTokenAddress, toTokenAddress, amount, decimals, ChainId_1.BASE_CHAIN_ID.toString());
86
86
  }
87
+ async migrateDepositToOtherProject(tokenAddress, vaultAddress, fromProjectId, toProjectId, amount) {
88
+ if (!this.perqSdk.signer) {
89
+ throw Error('No signer provided');
90
+ }
91
+ this.validateChain(this.perqSdk.signer, vaultAddress, fromProjectId);
92
+ const tokenContract = new ERC20TokenContract_1.default(tokenAddress, this.perqSdk.signer);
93
+ const decimals = await tokenContract.getPrecission();
94
+ const parsedAmountToDeposit = ethers_1.ethers.utils.parseUnits(amount, decimals);
95
+ const res = await this.perqSdk.yelayLiteSdk.vaults.migrate(vaultAddress, fromProjectId, toProjectId, BigInt(parsedAmountToDeposit.toString()));
96
+ return res.hash;
97
+ }
87
98
  }
88
99
  exports.default = LitePackage;
@@ -8,7 +8,7 @@ export type ReducedProjectData = {
8
8
  rewardTooltipName: string;
9
9
  projectInfoText: string;
10
10
  projectType: string;
11
- poolType: VaultType;
11
+ distributionType: VaultType;
12
12
  liveUntil: string;
13
13
  liveFrom: string;
14
14
  tvlUsd: number;
@@ -26,7 +26,7 @@ type VaultData = {
26
26
  coingeckoId?: string;
27
27
  expectedTge?: string;
28
28
  chainId: ChainId;
29
- poolType: VaultType;
29
+ distributionType: VaultType;
30
30
  strategies: Strategy[];
31
31
  stretchGoals: StretchGoal[];
32
32
  rewards: VaultReward[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dripfi/drip-sdk",
3
- "version": "1.4.3-yelay-lite-11",
3
+ "version": "1.4.3-yelay-lite-12",
4
4
  "description": "Drip SDK",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",