@dripfi/drip-sdk 1.4.7 → 1.4.9-yelay-lite

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/CHANGELOG.md CHANGED
@@ -96,3 +96,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
96
96
  ### Added
97
97
 
98
98
  - Added method `getSwapAndDepositTokenAllowanceForCurrency` to the `PerqSdk`
99
+
100
+ ## [1.4.8] - 2025-02-14
101
+
102
+ ### Changed
103
+
104
+ - Updated `PerqApi` to use the new 1inch API endpoint
105
+
106
+ ## [1.4.9] - 2025-02-14
107
+
108
+ ### Added
109
+
110
+ - Added method `linkSuiWalletWithEthWallet` to the `PerqSdk`
111
+ - Added method `getLinkedSuiWallet` to the `PerqSdk`
package/dist/PerqApi.d.ts CHANGED
@@ -1,14 +1,17 @@
1
1
  import { BigNumber } from 'ethers';
2
- import { Vault, SwapInfo, QLFastRedeem, UserRewards, VaultStats, MyPerqData, LoyaltyCard, BeansBalance, PerqToBeansSwapInfo, BeanEntry, NonceEnrichedSignedPayload, NonceEnrichedPayload, UpgradeLoyaltyCardPayload } from './types';
2
+ import { SwapInfo, QLFastRedeem, UserRewards, VaultStats, MyPerqData, LoyaltyCard, BeansBalance, PerqToBeansSwapInfo, BeanEntry, NonceEnrichedSignedPayload, NonceEnrichedPayload, UpgradeLoyaltyCardPayload, ReducedProjectData, DetailedProjectData, LinkWalletPayload } from './types';
3
+ import CachedVaultData from './types/VaultData';
3
4
  export default class PerqApi {
4
5
  route: string;
5
6
  constructor(route: string);
6
- fetchAllVaults(): Promise<Vault[]>;
7
+ fetchAllVaults(): Promise<CachedVaultData[]>;
8
+ fetchVaultDetails(vaultAddress: string, yliteProjectId: number): Promise<CachedVaultData>;
9
+ fetchAllProjects(): Promise<ReducedProjectData[]>;
10
+ fetchProjetctDetails(projectName: string): Promise<DetailedProjectData>;
7
11
  fetchTokenPrice(tokenName: string): Promise<number>;
8
12
  getExpectedSwapResult(fromTokenAddress: string, toTokenAddress: string, amount: string, decimals: number): Promise<string>;
9
13
  getUserBoostedNfts(walletAddress: string, vaultAddress: string): Promise<string[]>;
10
14
  fetchVaultStats(): Promise<VaultStats>;
11
- fetchVaultDetails(vaultAddress: string): Promise<Vault>;
12
15
  fetchRewardsPerHour(walletAddress: string, vaultAddress: string): Promise<number>;
13
16
  getSwapInfo(fromTokenAddress: string, toTokenAddress: string, amount: BigNumber, fromAddress: string): Promise<SwapInfo[]>;
14
17
  fetchUserSVTBalance(vaultAddress: string, walletAddress: string): Promise<BigNumber>;
@@ -26,6 +29,8 @@ export default class PerqApi {
26
29
  fetchMyPerqData(userAddress: string): Promise<MyPerqData[]>;
27
30
  getSwapPerqForBeansInfo(): Promise<PerqToBeansSwapInfo>;
28
31
  fetchBeansHistory(walletAddress: string): Promise<BeanEntry[]>;
32
+ linkSuiWalletWithEthWallet(signedPayload: NonceEnrichedSignedPayload<LinkWalletPayload>): Promise<boolean>;
33
+ getLinkedSuiWallet(walletAddress: string): Promise<string>;
29
34
  getNonceEnrichedPayload<T>(payload: T): Promise<NonceEnrichedPayload<T>>;
30
35
  fetchUserVaultDeposits(userAddress: string, vaultAddress: string): Promise<{
31
36
  pending: number;
package/dist/PerqApi.js CHANGED
@@ -9,7 +9,7 @@ class PerqApi {
9
9
  this.route = route;
10
10
  }
11
11
  async fetchAllVaults() {
12
- const res = await fetch(`${this.route}/api-be/api/vault`);
12
+ const res = await fetch(`${this.route}/api-be/api/vault/yelay-lite`);
13
13
  if (res.ok) {
14
14
  const data = (await res.json());
15
15
  return data;
@@ -18,6 +18,36 @@ class PerqApi {
18
18
  throw Error(`${await res.text()}`);
19
19
  }
20
20
  }
21
+ async fetchVaultDetails(vaultAddress, yliteProjectId) {
22
+ const res = await fetch(`${this.route}/api-be/api/vault/yelay-lite/${vaultAddress}/${yliteProjectId}`);
23
+ if (res.ok) {
24
+ const data = (await res.json());
25
+ return data;
26
+ }
27
+ else {
28
+ throw Error(`${await res.text()}`);
29
+ }
30
+ }
31
+ async fetchAllProjects() {
32
+ const res = await fetch(`${this.route}/api-be/api/projects`);
33
+ if (res.ok) {
34
+ const data = await res.json();
35
+ return data;
36
+ }
37
+ else {
38
+ throw Error(`${await res.text()}`);
39
+ }
40
+ }
41
+ async fetchProjetctDetails(projectName) {
42
+ const res = await fetch(`${this.route}/api-be/api/projects/${projectName}`);
43
+ if (res.ok) {
44
+ const data = await res.json();
45
+ return data;
46
+ }
47
+ else {
48
+ throw Error(`${await res.text()}`);
49
+ }
50
+ }
21
51
  async fetchTokenPrice(tokenName) {
22
52
  const res = await fetch(`${this.route}/api-be/api/tokenPrice?tokenName=${tokenName}`);
23
53
  if (res.ok) {
@@ -64,16 +94,6 @@ class PerqApi {
64
94
  throw Error(`${await res.text()}`);
65
95
  }
66
96
  }
67
- async fetchVaultDetails(vaultAddress) {
68
- const res = await fetch(`${this.route}/api-be/api/vault/${vaultAddress}`);
69
- if (res.ok) {
70
- const data = (await res.json());
71
- return data;
72
- }
73
- else {
74
- throw Error(`${await res.text()}`);
75
- }
76
- }
77
97
  async fetchRewardsPerHour(walletAddress, vaultAddress) {
78
98
  const res = await fetch(`${this.route}/api-be/api/user/${walletAddress}/rewardsPerHour/${vaultAddress}`);
79
99
  if (res.ok) {
@@ -88,14 +108,15 @@ class PerqApi {
88
108
  if (fromTokenAddress === toTokenAddress && fromTokenAddress === WETH_TOKEN_ADDRESS) {
89
109
  return [];
90
110
  }
91
- const url = `${this.route}/oneinch?getRequest=/swap/v5.2/1/swap?fromTokenAddress=${fromTokenAddress}%26toTokenAddress=${toTokenAddress}%26amount=${amount.toString()}%26fromAddress=${fromAddress}%26slippage=0.1%26disableEstimate=true%26allowPartialFill=false%26includeTokensInfo=true`;
111
+ //TODO: Replace the /1/ in this string with dynamic chainId
112
+ const url = `${this.route}/oneinch?getRequest=/swap/v6.0/1/swap?fromTokenAddress=${fromTokenAddress}%26toTokenAddress=${toTokenAddress}%26amount=${amount.toString()}%26fromAddress=${fromAddress}%26slippage=0.1%26disableEstimate=true%26allowPartialFill=false%26includeTokensInfo=true`;
92
113
  const res = await fetch(url);
93
114
  if (res.ok) {
94
115
  const data = (await res.json());
95
116
  return [
96
117
  {
97
118
  swapTarget: data.tx.to,
98
- token: data.fromToken.address,
119
+ token: data.srcToken.address,
99
120
  swapCallData: data.tx.data,
100
121
  },
101
122
  ];
@@ -300,6 +321,31 @@ class PerqApi {
300
321
  throw Error(`${await res.text()}`);
301
322
  }
302
323
  }
324
+ async linkSuiWalletWithEthWallet(signedPayload) {
325
+ const res = await fetch(`${this.route}/api-be/api/user/suiWallet`, {
326
+ method: 'POST',
327
+ headers: {
328
+ 'Content-Type': 'application/json',
329
+ },
330
+ body: JSON.stringify(signedPayload),
331
+ });
332
+ if (res.ok) {
333
+ return true;
334
+ }
335
+ else {
336
+ throw Error(`${await res.text()}`);
337
+ }
338
+ }
339
+ async getLinkedSuiWallet(walletAddress) {
340
+ const res = await fetch(`${this.route}/api-be/api/user/suiWallet/${walletAddress}`);
341
+ if (res.ok) {
342
+ const data = await res.json();
343
+ return data.suiWalletAddr;
344
+ }
345
+ else {
346
+ throw Error(`${await res.text()}`);
347
+ }
348
+ }
303
349
  async getNonceEnrichedPayload(payload) {
304
350
  const res = await fetch(`${this.route}/api-be/api/nonce`, {
305
351
  method: 'POST',
package/dist/PerqSdk.d.ts CHANGED
@@ -1,6 +1,7 @@
1
- import { BigNumber, Signer } from 'ethers';
2
- import { Vault, UserRewards, VaultStats, UserVaultBalance, LoyaltyCard, NonceEnrichedSignedPayload, MyPerqData, BeansBalance, BeanEntry, PerqToBeansSwapInfo, VestingInfo } from './types';
3
- import { PerqConfig } from './types/index';
1
+ import { BigNumber, Signer, ethers } from 'ethers';
2
+ import { UserRewards, VaultStats, UserVaultBalance, LoyaltyCard, NonceEnrichedSignedPayload, MyPerqData, BeansBalance, BeanEntry, PerqToBeansSwapInfo, VestingInfo, PerqConfig, ReducedProjectData } from './types';
3
+ import DetailedProjectData from './types/DetailedProjectData';
4
+ import VaultData from './types/VaultData';
4
5
  export default class PerqSdk {
5
6
  private perqApi;
6
7
  private perqConfig;
@@ -10,12 +11,16 @@ export default class PerqSdk {
10
11
  private perqVestingContract;
11
12
  private spoolSdk?;
12
13
  private signer?;
13
- constructor(perqConfig: PerqConfig, signer?: Signer);
14
- getAllVaults(): Promise<Vault[]>;
15
- getVaultDetails(vaultAddress: string): Promise<Vault>;
14
+ private yelayLiteSdk?;
15
+ constructor(perqConfig: PerqConfig, provider?: ethers.providers.JsonRpcProvider);
16
+ getAllProjects(): Promise<ReducedProjectData[]>;
17
+ getProjectDetails(projectName: string): Promise<DetailedProjectData>;
18
+ getAllVaults(): Promise<VaultData[]>;
19
+ getVaultDetails(vaultAddress: string, yliteProjectId?: number): Promise<VaultData>;
16
20
  getVaultStats(): Promise<VaultStats>;
17
21
  getTokenPrice(tokenName: string): Promise<number>;
18
22
  updateSigner(newSigner: Signer): Promise<void>;
23
+ yelayLiteDeposit(tokenAddress: string, vaultAddress: string, yliteProjectId: number, amount: string): Promise<string>;
19
24
  newDeposit(tokenAddress: string, vaultAddress: string, amount: string): Promise<string>;
20
25
  deposit(tokenAddress: string, vaultAddress: string, amount: string): Promise<string>;
21
26
  private doDeposit;
@@ -28,12 +33,14 @@ export default class PerqSdk {
28
33
  getRewardsPerHour(vaultAddress: string): Promise<number>;
29
34
  getRewards(): Promise<UserRewards>;
30
35
  getMyPerqBalance(): Promise<MyPerqData[]>;
36
+ getYelayLiteUserVaultBalance(vaultAddress: string, yliteProjectId: number): Promise<BigNumber>;
31
37
  getUserVaultBalance(vaultAddress: string): Promise<UserVaultBalance>;
32
38
  fastWithdraw(vaultAddress: string, amountToWithdraw?: string): Promise<string>;
33
39
  swapAndDeposit(fromTokenAddress: string, toTokenAddress: string, fromTokenAmount: string, vaultAddress: string, ethAmount?: string): Promise<string>;
34
40
  newSwapAndDeposit(fromTokenAddress: string, toTokenAddress: string, fromTokenAmount: string, vaultAddress: string, ethAmount?: string): Promise<string>;
35
41
  private doSwapAndDeposit;
36
42
  withdraw(vaultAddress: string, amountToWithdraw?: string): Promise<string>;
43
+ yelayLiteWithdraw(tokenAddress: string, vaultAddress: string, yliteProjectId: number, amount: string): Promise<string>;
37
44
  claimWithdraws(vaultAddress: string): Promise<string>;
38
45
  getBeansBalance(): Promise<BeansBalance>;
39
46
  getBeansHistory(): Promise<BeanEntry[]>;
@@ -49,6 +56,8 @@ export default class PerqSdk {
49
56
  approveTokenForDeposit(tokenAddress: string, amount: string): Promise<string>;
50
57
  getPerqTokenContractAddress(): string;
51
58
  getSwapPerqForBeansInfo(): Promise<PerqToBeansSwapInfo>;
59
+ getAllowance(tokenAddress: string, spender: string): Promise<BigNumber>;
60
+ approveAllowance(tokenAddress: string, amount: string, spenderAddress: string): Promise<string>;
52
61
  transferErc20Token(tokenAddress: string, amount: string, receiver: string): Promise<string>;
53
62
  wrapEther(amount: string, tokenAddress: string): Promise<string>;
54
63
  getVestingStart(): Promise<string>;
@@ -59,12 +68,15 @@ export default class PerqSdk {
59
68
  getAllVestingInfo(beneficiaryAddress: string): Promise<VestingInfo>;
60
69
  claimVestedPerq(amount: string): Promise<string>;
61
70
  burnVestedPerq(amount: string, price: string, deadline: string, signature: string): Promise<string>;
71
+ linkSuiWalletWithEthWallet(suiWalletAddress: string): Promise<boolean>;
72
+ getLinkedSuiWallet(): Promise<string>;
62
73
  signPayload<T>(payload: T): Promise<NonceEnrichedSignedPayload<T>>;
63
74
  private getEnrichedPayload;
64
75
  private generateRedeemBagStruct;
65
76
  private getERC20Precission;
66
77
  private getTokenAllowanceForDeposit;
67
78
  private getTokenAllowanceForSwapAndDeposit;
68
- private getERC20TokenAllowance;
69
- private approveToken;
79
+ getERC20TokenAllowance(spender: string, tokenAddress: string): Promise<BigNumber>;
80
+ approveToken(tokenAddress: string, amount: string, spender: string): Promise<string>;
81
+ yelayLiteWrapAndDepositEth(vaultAddress: string, yliteProjectId: number, amount: string): Promise<any>;
70
82
  }
package/dist/PerqSdk.js CHANGED
@@ -9,6 +9,8 @@ const spool_v2_sdk_1 = require("@spool.fi/spool-v2-sdk");
9
9
  const PerqApi_1 = __importDefault(require("./PerqApi"));
10
10
  const contracts_1 = require("./contracts");
11
11
  const WethTokenAbi_json_1 = __importDefault(require("./abi/WethTokenAbi.json"));
12
+ const sdk_1 = require("@yelay-lite/sdk");
13
+ const WETH_DECIMAL_PRECISION = 18;
12
14
  class PerqSdk {
13
15
  perqApi;
14
16
  perqConfig;
@@ -18,23 +20,35 @@ class PerqSdk {
18
20
  perqVestingContract;
19
21
  spoolSdk;
20
22
  signer;
21
- constructor(perqConfig, signer) {
22
- this.signer = signer;
23
- if (this.signer) {
24
- this.spoolSdk = new spool_v2_sdk_1.SpoolSdk(perqConfig.spoolSdkConfig, this.signer);
23
+ yelayLiteSdk;
24
+ constructor(perqConfig, provider) {
25
+ const newSigner = provider?.getSigner();
26
+ if (provider && newSigner) {
27
+ this.signer = newSigner;
28
+ this.yelayLiteSdk = new sdk_1.YelayLiteSdk({
29
+ backendUrl: perqConfig.yelayLiteBackendUrl,
30
+ provider: provider,
31
+ });
32
+ this.spoolSdk = new spool_v2_sdk_1.SpoolSdk(perqConfig.spoolSdkConfig, newSigner);
25
33
  }
26
34
  this.perqConfig = perqConfig;
27
35
  this.perqApi = new PerqApi_1.default(perqConfig.route);
28
- this.perqTokenContract = new contracts_1.PerqTokenContract(perqConfig.perqTokenAddress, signer);
29
- this.perqTokenRecyclerContract = new contracts_1.PerqTokenRecyclerContract(perqConfig.perqTokenRecyclerAddress, signer);
30
- this.perqSwapAndRecyclerContract = new contracts_1.PerqSwapAndRecyclerContract(perqConfig.perqSwapAndRecyclerAddress, signer);
31
- this.perqVestingContract = new contracts_1.PerqVestingContract(perqConfig.perqVestingAddress, signer);
36
+ this.perqTokenContract = new contracts_1.PerqTokenContract(perqConfig.perqTokenAddress, newSigner);
37
+ this.perqTokenRecyclerContract = new contracts_1.PerqTokenRecyclerContract(perqConfig.perqTokenRecyclerAddress, newSigner);
38
+ this.perqSwapAndRecyclerContract = new contracts_1.PerqSwapAndRecyclerContract(perqConfig.perqSwapAndRecyclerAddress, newSigner);
39
+ this.perqVestingContract = new contracts_1.PerqVestingContract(perqConfig.perqVestingAddress, newSigner);
40
+ }
41
+ async getAllProjects() {
42
+ return this.perqApi.fetchAllProjects();
43
+ }
44
+ async getProjectDetails(projectName) {
45
+ return this.perqApi.fetchProjetctDetails(projectName);
32
46
  }
33
47
  async getAllVaults() {
34
48
  return this.perqApi.fetchAllVaults();
35
49
  }
36
- async getVaultDetails(vaultAddress) {
37
- return this.perqApi.fetchVaultDetails(vaultAddress);
50
+ async getVaultDetails(vaultAddress, yliteProjectId) {
51
+ return this.perqApi.fetchVaultDetails(vaultAddress, yliteProjectId ?? -1);
38
52
  }
39
53
  async getVaultStats() {
40
54
  return this.perqApi.fetchVaultStats();
@@ -50,6 +64,18 @@ class PerqSdk {
50
64
  this.perqSwapAndRecyclerContract.updateSigner(newSigner);
51
65
  this.perqVestingContract.updateSigner(newSigner);
52
66
  }
67
+ async yelayLiteDeposit(tokenAddress, vaultAddress, yliteProjectId, amount) {
68
+ if (!this.signer) {
69
+ throw Error('No signer provided');
70
+ }
71
+ const decimals = await this.getERC20Precission(tokenAddress);
72
+ const parsedAmountToDeposit = ethers_1.ethers.utils.parseUnits(amount, decimals);
73
+ const res = await this.yelayLiteSdk.deposit(this.signer, vaultAddress, yliteProjectId, BigInt(parsedAmountToDeposit.toString()));
74
+ if (!res.success || !res.hash) {
75
+ throw Error(`Error depositing ${amount} into vault ${vaultAddress} and yliteProjectId: ${yliteProjectId}`);
76
+ }
77
+ return res.hash;
78
+ }
53
79
  async newDeposit(tokenAddress, vaultAddress, amount) {
54
80
  return this.doDeposit(tokenAddress, vaultAddress, amount, false);
55
81
  }
@@ -133,6 +159,14 @@ class PerqSdk {
133
159
  const myPerqBalance = this.perqApi.fetchMyPerqData(userAddress);
134
160
  return myPerqBalance;
135
161
  }
162
+ async getYelayLiteUserVaultBalance(vaultAddress, yliteProjectId) {
163
+ if (!this.signer) {
164
+ throw Error('No signer provided');
165
+ }
166
+ const userAddress = await this.signer.getAddress();
167
+ const balance = await this.yelayLiteSdk.balanceOf(vaultAddress, yliteProjectId, userAddress);
168
+ return balance;
169
+ }
136
170
  async getUserVaultBalance(vaultAddress) {
137
171
  if (!this.signer) {
138
172
  throw Error('No signer provided');
@@ -210,7 +244,7 @@ class PerqSdk {
210
244
  }
211
245
  }
212
246
  const fromToken = ethers_1.ethers.utils.parseUnits(amountWithDecimals.toString(), decimals);
213
- const swapInfo = await this.perqApi.getSwapInfo(fromTokenAddress, toTokenAddress, fromToken, userAddress);
247
+ const swapInfo = await this.perqApi.getSwapInfo(fromTokenAddress, toTokenAddress, fromToken, this.perqConfig.swapperAddress);
214
248
  const swapDepositBagStruct = {
215
249
  inTokens: [fromTokenAddress],
216
250
  inAmounts: [fromToken],
@@ -240,6 +274,18 @@ class PerqSdk {
240
274
  const redeemTxReceipt = await redeemTx.wait();
241
275
  return redeemTxReceipt.transactionHash;
242
276
  }
277
+ async yelayLiteWithdraw(tokenAddress, vaultAddress, yliteProjectId, amount) {
278
+ if (!this.signer) {
279
+ throw Error('No signer provided');
280
+ }
281
+ const decimals = await this.getERC20Precission(tokenAddress);
282
+ const parsedAmountToWithdraw = ethers_1.ethers.utils.parseUnits(amount, decimals);
283
+ const res = await this.yelayLiteSdk.redeem(this.signer, vaultAddress, yliteProjectId, BigInt(parsedAmountToWithdraw.toString()));
284
+ if (!res.success || !res.hash) {
285
+ throw Error('Error withdrawing from vault');
286
+ }
287
+ return res.hash;
288
+ }
243
289
  async claimWithdraws(vaultAddress) {
244
290
  const userAddress = await this.signer.getAddress();
245
291
  if (!this.signer) {
@@ -287,15 +333,6 @@ class PerqSdk {
287
333
  if (this.perqConfig.perqSwapAndRecyclerAddress === ethers_1.ethers.constants.AddressZero) {
288
334
  throw Error('Recycler contract address not defined');
289
335
  }
290
- console.log('swap and recycle ERC-20 with this: ', {
291
- beneficiary,
292
- path,
293
- amountInWithDecimals,
294
- minAmountOutWithDecimals,
295
- price,
296
- deadline,
297
- signature,
298
- });
299
336
  const swapAndRecycleTx = await this.perqSwapAndRecyclerContract.swapAndRecycle(beneficiary, path, amountInWithDecimals, minAmountOutWithDecimals, price, deadline, signature);
300
337
  const receipt = await swapAndRecycleTx.wait();
301
338
  return receipt.transactionHash;
@@ -344,6 +381,15 @@ class PerqSdk {
344
381
  async getSwapPerqForBeansInfo() {
345
382
  return this.perqApi.getSwapPerqForBeansInfo();
346
383
  }
384
+ async getAllowance(tokenAddress, spender) {
385
+ const allowance = await this.getERC20TokenAllowance(spender, tokenAddress);
386
+ return allowance;
387
+ }
388
+ async approveAllowance(tokenAddress, amount, spenderAddress) {
389
+ const decimals = await this.getERC20Precission(tokenAddress);
390
+ const amountWithDecimals = parseFloat(parseFloat(amount).toFixed(decimals));
391
+ return await this.approveToken(tokenAddress, amountWithDecimals.toString(), spenderAddress);
392
+ }
347
393
  async transferErc20Token(tokenAddress, amount, receiver) {
348
394
  if (!this.signer) {
349
395
  throw Error('No signer provided');
@@ -467,6 +513,20 @@ class PerqSdk {
467
513
  throw new Error('Failed to get total releasable amount: Unknown error');
468
514
  }
469
515
  }
516
+ async linkSuiWalletWithEthWallet(suiWalletAddress) {
517
+ const payload = {
518
+ suiWalletAddr: suiWalletAddress,
519
+ };
520
+ const signedPayload = await this.signPayload(payload);
521
+ return this.perqApi.linkSuiWalletWithEthWallet(signedPayload);
522
+ }
523
+ async getLinkedSuiWallet() {
524
+ if (!this.signer) {
525
+ throw new Error('No signer provided');
526
+ }
527
+ const walletAddr = await this.signer.getAddress();
528
+ return this.perqApi.getLinkedSuiWallet(walletAddr);
529
+ }
470
530
  async signPayload(payload) {
471
531
  if (!this.signer) {
472
532
  throw new Error('No signer provided');
@@ -543,5 +603,15 @@ class PerqSdk {
543
603
  const receipt = await approveTx.wait();
544
604
  return receipt.transactionHash;
545
605
  }
606
+ async yelayLiteWrapAndDepositEth(vaultAddress, yliteProjectId, amount) {
607
+ if (!this.signer) {
608
+ throw Error('No signer provided');
609
+ }
610
+ const parsedAmount = ethers_1.ethers.utils.parseUnits(amount, WETH_DECIMAL_PRECISION);
611
+ const res = await this.yelayLiteSdk.depositEth(this.signer, vaultAddress, yliteProjectId, BigInt(parsedAmount.toString()));
612
+ if (!res.success || res.hash === undefined) {
613
+ throw Error(`Error wrapping and depositing ether to vault ${vaultAddress}`);
614
+ }
615
+ }
546
616
  }
547
617
  exports.default = PerqSdk;
@@ -39,6 +39,8 @@ type DeployedProject = {
39
39
  bannerImage?: string;
40
40
  rewardImage?: string;
41
41
  rewardTooltipName?: string;
42
+ liveUntil: string;
43
+ liveFrom: string;
42
44
  };
43
45
  export default DeployedProject;
44
46
  export type ProjectBacker = {
@@ -0,0 +1,33 @@
1
+ import { ProjectBacker } from './DeployedProject';
2
+ import { ReducedProjectData } from './ReducedProjectData';
3
+ import StretchGoal from './StretchGoal';
4
+ import VaultData from './VaultData';
5
+ type DetailedProjectData = ReducedProjectData & {
6
+ content: string;
7
+ telegramLink: string;
8
+ twitterLink: string;
9
+ mediumLink: string;
10
+ deckLink: string;
11
+ roadmapLink: string;
12
+ economicsLink: string;
13
+ discordLink: string;
14
+ docsLink: string;
15
+ whitepaperLink: string;
16
+ litepaperLink: string;
17
+ websiteLink: string;
18
+ networks: string[];
19
+ supplyAtLaunch: number;
20
+ fdv: number;
21
+ totalSupply: number;
22
+ projectType: string;
23
+ yelayVersion: string;
24
+ wikiLink: string;
25
+ youTubeLink: string;
26
+ tikTokLink: string;
27
+ stretchGoals: StretchGoal[];
28
+ projectRewardText: string;
29
+ backers: ProjectBacker[];
30
+ protocols: string[];
31
+ vaults: VaultData[];
32
+ };
33
+ export default DetailedProjectData;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ type LinkWalletPayload = {
2
+ suiWalletAddr: string;
3
+ };
4
+ export default LinkWalletPayload;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,11 +1,10 @@
1
- import { Asset, Vault } from './index';
2
- type MyPerqData = Vault & {
3
- claimable: number;
1
+ import VaultData from './VaultData';
2
+ import { Asset } from './index';
3
+ type MyPerqBalance = {
4
4
  pendingDeposits: number;
5
- pendingWithdraws: number;
6
5
  currentlyDeposited: number;
7
- ethPrice: number;
8
- btcPrice: number;
6
+ pendingWithdraws: number;
7
+ claimable: number;
9
8
  tokenRewards: {
10
9
  [token_address: string]: Asset & {
11
10
  amount: number;
@@ -13,4 +12,9 @@ type MyPerqData = Vault & {
13
12
  };
14
13
  };
15
14
  };
15
+ type MyPerqData = VaultData & MyPerqBalance & {
16
+ ethPrice: number;
17
+ btcPrice: number;
18
+ combinedTvl: number;
19
+ };
16
20
  export default MyPerqData;
@@ -7,7 +7,9 @@ type PerqConfig = {
7
7
  perqSwapAndRecyclerAddress: string;
8
8
  perqVestingAddress: string;
9
9
  swapAndDepositContractAddress: string;
10
+ swapperAddress: string;
10
11
  smartVaultManagerContractAddress: string;
12
+ yelayLiteBackendUrl: string;
11
13
  };
12
14
  export default PerqConfig;
13
15
  export declare const PRODUCTION: PerqConfig;
@@ -10,7 +10,9 @@ exports.PRODUCTION = {
10
10
  perqSwapAndRecyclerAddress: '0x15ED53964E6a5EcbEBAb80A0Fc68c2297b0eaA8D',
11
11
  perqVestingAddress: '0x5e19C155C30bDEB83FCFE20a3b6f6Eda34B746c5',
12
12
  swapAndDepositContractAddress: '0xd8534197bd587f8226d12e0c864ef2cae6f82f5c',
13
+ swapperAddress: '0x33e52c206d584550193e642c8982f2fff6339994',
13
14
  smartVaultManagerContractAddress: '0x23daf34e2b9af02a74dc19cb52af727b19403874',
15
+ yelayLiteBackendUrl: '',
14
16
  };
15
17
  exports.DEVELOPMENT = {
16
18
  route: 'https://dev.perq.finance',
@@ -20,5 +22,7 @@ exports.DEVELOPMENT = {
20
22
  perqSwapAndRecyclerAddress: '0xA4ed357FF233731860Ec8D0446FD95756d564014',
21
23
  perqVestingAddress: '0x1d3B9E32a7139718f94BE32c797682fFf2D1bE60',
22
24
  swapAndDepositContractAddress: '0x5fb08e00de169f041711206a0995410884080177',
25
+ swapperAddress: '0xE411921ee9EeDfEFd7b9Ae15bF232bd36949Fcbc',
23
26
  smartVaultManagerContractAddress: '0x2638d6c0b4ef6dee04050fa0b07ca62500435747',
27
+ yelayLiteBackendUrl: 'https://lite.dev.yelay.io',
24
28
  };
@@ -0,0 +1,20 @@
1
+ import DepositToken from './DepositToken';
2
+ import VaultType from './VaultType';
3
+ export type ReducedProjectData = {
4
+ projectName: string;
5
+ logo: string;
6
+ bannerImage: string;
7
+ rewardImage: string;
8
+ rewardTooltipName: string;
9
+ projectInfoText: string;
10
+ projectType: string;
11
+ poolType: VaultType;
12
+ liveUntil: string;
13
+ liveFrom: string;
14
+ tvlUsd: number;
15
+ tvl: number;
16
+ vAPY: number;
17
+ peakTVL: number;
18
+ isFeatured: boolean;
19
+ currencies: DepositToken[];
20
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,29 @@
1
+ import DepositToken from './DepositToken';
2
+ import Strategy from './Strategy';
3
+ import StretchGoal from './StretchGoal';
4
+ import VaultRewardData from './VaultRewardData';
5
+ import VaultType from './VaultType';
6
+ type VaultData = {
7
+ depositToken: DepositToken;
8
+ vaultAddress: string;
9
+ tvlUsd: number;
10
+ avgTvl: number;
11
+ tokenPrice: number;
12
+ change24h: number;
13
+ volume24h: number;
14
+ peakTvl: number;
15
+ onChainProjectId: number;
16
+ isActive: boolean;
17
+ rewards: VaultRewardData[];
18
+ projectName: string;
19
+ projectLogo: string;
20
+ projectType: string;
21
+ poolType: VaultType;
22
+ strategies: Strategy[];
23
+ liveFrom: string;
24
+ liveUntil: string;
25
+ isYelayLiteVault: boolean;
26
+ yelayLiteProjectId: number;
27
+ stretchGoals: StretchGoal[];
28
+ };
29
+ export default VaultData;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,9 @@
1
+ type VaultRewardData = {
2
+ type: 'token' | 'points';
3
+ name: string;
4
+ symbol: string;
5
+ decimals: number;
6
+ tokenAddress: string;
7
+ id?: number;
8
+ };
9
+ export default VaultRewardData;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,11 @@
1
+ type YelayLiteVault = {
2
+ id: number;
3
+ depositTokenAddress: string;
4
+ depositTokenSymbol: string;
5
+ decimals: number;
6
+ projectName: string;
7
+ projectLogo: string;
8
+ address: string;
9
+ apy: string;
10
+ };
11
+ export default YelayLiteVault;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,10 +1,12 @@
1
1
  import Asset from './Asset';
2
2
  import BeanEntry from './BeanEntry';
3
3
  import BeansBalance from './BeansBalance';
4
+ import DetailedProjectData from './DetailedProjectData';
4
5
  import DeployedProject, { ProjectBacker } from './DeployedProject';
5
6
  import DeployedVault from './DeployedVault';
6
7
  import DepositToken from './DepositToken';
7
8
  import ELoyaltyCardTier from './ELoyaltyCardTier';
9
+ import LinkWalletPayload from './LinkWalletPayload';
8
10
  import LoyaltyCard from './LoyaltyCard';
9
11
  import MyPerqData from './MyPerqData';
10
12
  import NFTBoost from './NFTBoost';
@@ -12,6 +14,7 @@ import PerqConfig from './PerqConfig';
12
14
  import PerqToBeansSwapInfo from './PerqToBeansSwapInfo';
13
15
  import QLFastRedeem from './QLFastRedeem';
14
16
  import { BasePayload, NonceEnrichedPayload, NonceEnrichedSignedPayload } from './SignedPayload';
17
+ import { ReducedProjectData } from './ReducedProjectData';
15
18
  import Strategy from './Strategy';
16
19
  import StretchGoal from './StretchGoal';
17
20
  import SwapInfo from './SwapInfo';
@@ -19,9 +22,11 @@ import UpgradeLoyaltyCardPayload from './UpgradeLoyaltyCardPayload';
19
22
  import UserRewards from './UserRewards';
20
23
  import UserVaultBalance from './UserVaultBalance';
21
24
  import Vault from './Vault';
25
+ import VaultData from './VaultData';
22
26
  import VaultReward, { RewardType } from './VaultReward';
23
27
  import VaultStats from './VaultStats';
24
28
  import VaultType from './VaultType';
25
29
  import VestingInfo from './VestingInfo';
26
30
  import YelayVersion from './YelayVersion';
27
- export { Asset, BasePayload, BeanEntry, BeansBalance, DeployedProject, DeployedVault, DepositToken, ELoyaltyCardTier, LoyaltyCard, MyPerqData, NFTBoost, NonceEnrichedPayload, NonceEnrichedSignedPayload, PerqConfig, PerqToBeansSwapInfo, ProjectBacker, QLFastRedeem, RewardType, Strategy, StretchGoal, SwapInfo, UpgradeLoyaltyCardPayload, UserRewards, UserVaultBalance, Vault, VaultReward, VaultStats, VaultType, VestingInfo, YelayVersion, };
31
+ import YelayLiteVault from './YelayLiteVault';
32
+ export { Asset, BasePayload, BeanEntry, BeansBalance, DeployedProject, DeployedVault, DepositToken, DetailedProjectData, ELoyaltyCardTier, LinkWalletPayload, LoyaltyCard, MyPerqData, NFTBoost, NonceEnrichedPayload, NonceEnrichedSignedPayload, PerqConfig, PerqToBeansSwapInfo, ProjectBacker, QLFastRedeem, ReducedProjectData, RewardType, Strategy, StretchGoal, SwapInfo, UpgradeLoyaltyCardPayload, UserRewards, UserVaultBalance, Vault, VaultData, VaultReward, VaultStats, VaultType, VestingInfo, YelayVersion, YelayLiteVault, };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dripfi/drip-sdk",
3
- "version": "1.4.7",
3
+ "version": "1.4.9-yelay-lite",
4
4
  "description": "Drip SDK",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -13,8 +13,8 @@
13
13
  "pretty": "prettier --write \"./**/*.{js,jsx,mjs,cjs,ts,tsx,json}\""
14
14
  },
15
15
  "dependencies": {
16
+ "@yelay-lite/sdk": "0.0.15",
16
17
  "@spool.fi/spool-v2-sdk": "2.0.53",
17
- "@yelay-lite/sdk": "0.0.11",
18
18
  "ethers": "^5.7.2"
19
19
  },
20
20
  "author": "",