@dripfi/drip-sdk 1.4.30 → 1.4.32

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
@@ -160,12 +160,13 @@ Access pools methods through `sdk.pools`:
160
160
 
161
161
  Access user methods through `sdk.user`:
162
162
 
163
- | Method | Description |
164
- | -------------------------------------------------------------------------- | ----------------------------------------------------------- |
165
- | `linkSuiWalletWithEthWallet(suiWalletAddress: string): Promise<boolean>` | Links a Sui wallet with an Ethereum wallet. |
166
- | `linkNearWalletWithEthWallet(nearWalletAddress: string): Promise<boolean>` | Links a Near wallet with an Ethereum wallet. |
167
- | `getLinkedPodWallets(): Promise<LinkedPodWallets>` | Retrieves all wallets linked to the user's Ethereum wallet. |
168
- | `getEarnings(projectName: string): Promise<Earnings>` | Retrieves the user earnings for each project's vaults |
163
+ | Method | Description |
164
+ | ------------------------------------------------------------------------------ | ----------------------------------------------------------- |
165
+ | `linkSuiWalletWithEthWallet(suiWalletAddress: string): Promise<boolean>` | Links a Sui wallet with an Ethereum wallet. |
166
+ | `linkNearWalletWithEthWallet(nearWalletAddress: string): Promise<boolean>` | Links a Near wallet with an Ethereum wallet. |
167
+ | `linkSolanaWalletWithEthWallet(solanaWalletAddress: string): Promise<boolean>` | Links a Solana wallet with an Ethereum wallet. |
168
+ | `getLinkedPodWallets(): Promise<LinkedPodWallets>` | Retrieves all wallets linked to the user's Ethereum wallet. |
169
+ | `getEarnings(projectName: string): Promise<Earnings>` | Retrieves the user earnings for each project's vaults |
169
170
 
170
171
  ### Recycler
171
172
 
@@ -505,6 +506,7 @@ type BasePayload<T> = {
505
506
  type LinkedPodWallets = {
506
507
  suiWalletAddr: string;
507
508
  nearWalletAddr: string;
509
+ solanaWalletAddr: string;
508
510
  };
509
511
 
510
512
  type NonceEnrichedPayload<T> = T & {
package/dist/PerqApi.d.ts CHANGED
@@ -6,6 +6,7 @@ import MigrationOption from './types/MigrationOption';
6
6
  import ProjectHistoricalTvl from './types/ProjectHistoricalTvl';
7
7
  import ClaimSpecialEditionLoyaltyCardPayload from './types/ClaimSpecialEditionLoyaltyCardPayload';
8
8
  import OverallStats from './types/OverallStats';
9
+ import { SolanaWalletPayload } from './types/LinkWalletPayload';
9
10
  export default class PerqApi {
10
11
  private perqSdk;
11
12
  constructor(perqSdk: PerqSdk);
@@ -37,6 +38,7 @@ export default class PerqApi {
37
38
  fetchBeansHistory(walletAddress: string): Promise<BeanEntry[]>;
38
39
  linkSuiWalletWithEthWallet(signedPayload: NonceEnrichedSignedPayload<SuiWalletPayload>): Promise<boolean>;
39
40
  linkNearWalletWithEthWallet(signedPayload: NonceEnrichedSignedPayload<NearWalletPayload>): Promise<boolean>;
41
+ linkSolanaWalletWithEthWallet(signedPayload: NonceEnrichedSignedPayload<SolanaWalletPayload>): Promise<boolean>;
40
42
  getPodWallets(walletAddress: string): Promise<LinkedPodWallets>;
41
43
  getNonceEnrichedPayload<T>(payload: T): Promise<NonceEnrichedPayload<T>>;
42
44
  fetchLitePoolUserBalance(userAddress: string, vaultAddress: string, onChainProjectId: number): Promise<string>;
package/dist/PerqApi.js CHANGED
@@ -385,6 +385,21 @@ class PerqApi {
385
385
  throw Error(`${await res.text()}`);
386
386
  }
387
387
  }
388
+ async linkSolanaWalletWithEthWallet(signedPayload) {
389
+ const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/user/solanaWallet`, {
390
+ method: 'POST',
391
+ headers: {
392
+ 'Content-Type': 'application/json',
393
+ },
394
+ body: JSON.stringify(signedPayload),
395
+ });
396
+ if (res.ok) {
397
+ return true;
398
+ }
399
+ else {
400
+ throw Error(`${await res.text()}`);
401
+ }
402
+ }
388
403
  async getPodWallets(walletAddress) {
389
404
  const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/user/podWallets/${walletAddress}`);
390
405
  if (res.ok) {
@@ -12,17 +12,14 @@ class SiloVaultOperations {
12
12
  }
13
13
  async getAllowance(params) {
14
14
  const { sourceTokenAddress, vaultAddress, amount } = params;
15
- console.log(`🚀 ~ silo getAllowance called with these params:`, { sourceTokenAddress, vaultAddress, amount });
16
15
  if (!this.perqSdk.siloPackage) {
17
16
  throw new Error('Silo package not initialized. Please provide a signer.');
18
17
  }
19
18
  try {
20
19
  // For Silo, we use the standard ERC20 allowance
21
20
  const allowance = await this.perqSdk.tokenUtils.getERC20TokenAllowance(vaultAddress, sourceTokenAddress);
22
- console.log('🚀 ~ allowance:', allowance);
23
21
  // Get required amount with correct decimals
24
22
  const requiredAmount = await this.perqSdk.tokenUtils.parseAmountWithDecimals(amount, sourceTokenAddress);
25
- console.log('🚀 ~ requiredAmount:', requiredAmount.toString());
26
23
  return allowance.gte(requiredAmount);
27
24
  }
28
25
  catch (error) {
@@ -32,7 +29,6 @@ class SiloVaultOperations {
32
29
  }
33
30
  async approveAllowance(params) {
34
31
  const { sourceTokenAddress, vaultAddress, amount } = params;
35
- console.log(`🚀 ~ silo approveAllowance called with these params:`, { sourceTokenAddress, vaultAddress, amount });
36
32
  if (!this.perqSdk.siloPackage) {
37
33
  throw new Error('Silo package not initialized. Please provide a signer.');
38
34
  }
@@ -41,23 +37,19 @@ class SiloVaultOperations {
41
37
  }
42
38
  async deposit(params) {
43
39
  const { amount, vaultAddress, sourceTokenAddress } = params;
44
- console.log(`🚀 ~ silo deposit called with these params:`, { amount, vaultAddress });
45
40
  if (!this.perqSdk.siloPackage) {
46
41
  throw new Error('Silo package not initialized. Please provide a signer.');
47
42
  }
48
43
  const parsedAmount = await this.perqSdk.tokenUtils.parseAmountWithDecimals(amount, sourceTokenAddress);
49
- console.log('🚀 ~ parsedAmount:', parsedAmount.toString());
50
44
  const tx = await this.perqSdk.siloPackage.deposit(parsedAmount.toString(), vaultAddress);
51
45
  return this.extractTransactionHash(tx);
52
46
  }
53
47
  async withdraw(params) {
54
48
  const { amount, vaultAddress, tokenAddress } = params;
55
- console.log(`🚀 ~ silo withdraw called with these params:`, { amount, vaultAddress, tokenAddress });
56
49
  if (!this.perqSdk.siloPackage) {
57
50
  throw new Error('Silo package not initialized. Please provide a signer.');
58
51
  }
59
52
  const parsedAmount = await this.perqSdk.tokenUtils.parseAmountWithDecimals(amount, tokenAddress);
60
- console.log('🚀 ~ parsedAmount:', parsedAmount.toString());
61
53
  return await this.handleSiloWithdraw(tokenAddress, vaultAddress, parsedAmount.toString());
62
54
  }
63
55
  async getBalance(vaultAddress, tokenAddress) {
@@ -65,20 +57,16 @@ class SiloVaultOperations {
65
57
  throw new Error('Signer not initialized');
66
58
  }
67
59
  const balance = await this.perqSdk.siloPackage.getBalanceInAssets(vaultAddress);
68
- console.log('🚀 ~ balance:', balance);
69
60
  const formattedBalance = await this.perqSdk.tokenUtils.formatAmountWithDecimals(balance, tokenAddress);
70
- console.log('🚀 ~ formattedBalance:', formattedBalance);
71
61
  return formattedBalance;
72
62
  }
73
63
  /**
74
64
  * Handles Silo withdraw with automatic full/partial withdraw detection
75
65
  */
76
66
  async handleSiloWithdraw(tokenAddress, vaultAddress, amount) {
77
- console.log(`🚀 ~ silo handleSiloWithdraw called with these params:`, { tokenAddress, vaultAddress, amount });
78
67
  let userBalance = ethers_1.BigNumber.from(0);
79
68
  try {
80
69
  userBalance = await this.perqSdk.siloPackage.getBalanceInAssets(vaultAddress);
81
- console.log('🚀 ~ userBalance:', userBalance.toString());
82
70
  }
83
71
  catch (error) {
84
72
  console.error('Error getting user balance for silo withdraw: ', error);
@@ -102,8 +90,6 @@ class SiloVaultOperations {
102
90
  */
103
91
  async handleSiloFullWithdraw(vaultAddress) {
104
92
  const balanceInShares = await this.perqSdk.siloPackage.getBalanceInShares(vaultAddress);
105
- console.log('🚀 ~ balanceInShares:', balanceInShares);
106
- console.log('🚀 ~ perqSdk.siloPackage!.redeem:', { balanceInShares: balanceInShares.toString(), vaultAddress });
107
93
  const tx = await this.perqSdk.siloPackage.redeem(balanceInShares.toString(), vaultAddress);
108
94
  return this.extractTransactionHash(tx);
109
95
  }
@@ -111,10 +97,6 @@ class SiloVaultOperations {
111
97
  * Handles a partial withdraw from a Silo vault
112
98
  */
113
99
  async handleSiloPartialWithdraw(vaultAddress, parsedWithdrawAmount) {
114
- console.log('🚀 ~ perqSdk.siloPackage!.withdraw:', {
115
- parsedWithdrawAmount: parsedWithdrawAmount.toString(),
116
- vaultAddress,
117
- });
118
100
  const tx = await this.perqSdk.siloPackage.withdraw(parsedWithdrawAmount.toString(), vaultAddress);
119
101
  return this.extractTransactionHash(tx);
120
102
  }
@@ -122,7 +104,6 @@ class SiloVaultOperations {
122
104
  * Extracts transaction hash from various transaction response formats
123
105
  */
124
106
  extractTransactionHash(tx) {
125
- console.log('🚀 ~ extractTransactionHash called with tx:', tx);
126
107
  if (typeof tx === 'string') {
127
108
  return tx;
128
109
  }
@@ -6,5 +6,6 @@ export default class UserPackage {
6
6
  getEarnings(projectName: string): Promise<Earnings>;
7
7
  linkSuiWalletWithEthWallet(suiWalletAddress: string): Promise<boolean>;
8
8
  linkNearWalletWithEthWallet(nearWalletAddress: string): Promise<boolean>;
9
+ linkSolanaWalletWithEthWallet(solanaWalletAddress: string): Promise<boolean>;
9
10
  getLinkedPodWallets(): Promise<LinkedPodWallets>;
10
11
  }
@@ -25,6 +25,13 @@ class UserPackage {
25
25
  const signedPayload = await this.perqSdk.signHandler.signPayload(payload);
26
26
  return this.perqSdk.perqApi.linkNearWalletWithEthWallet(signedPayload);
27
27
  }
28
+ async linkSolanaWalletWithEthWallet(solanaWalletAddress) {
29
+ const payload = {
30
+ solanaWalletAddr: solanaWalletAddress,
31
+ };
32
+ const signedPayload = await this.perqSdk.signHandler.signPayload(payload);
33
+ return this.perqSdk.perqApi.linkSolanaWalletWithEthWallet(signedPayload);
34
+ }
28
35
  async getLinkedPodWallets() {
29
36
  if (!this.perqSdk.signer) {
30
37
  throw new Error('No signer provided');
@@ -9,29 +9,20 @@ class YelayVaultOperations {
9
9
  }
10
10
  async getAllowance(params) {
11
11
  const { sourceTokenAddress, vaultAddress, onChainProjectId, amount } = params;
12
- console.log(`🚀 ~ yelay getAllowance with these params: `, {
13
- sourceTokenAddress,
14
- vaultAddress,
15
- onChainProjectId,
16
- amount,
17
- });
18
12
  if (!onChainProjectId || onChainProjectId === -1) {
19
13
  throw new Error('OnChainProjectId is required for Yelay vaults');
20
14
  }
21
15
  const depositType = this.determineDepositType(params);
22
- console.log('🚀 ~ depositType: ', depositType);
23
16
  try {
24
17
  let allowance;
25
18
  switch (depositType) {
26
19
  case 'direct': {
27
20
  allowance = await this.perqSdk.tokenUtils.getERC20TokenAllowance(vaultAddress, sourceTokenAddress);
28
- console.log('🚀 ~ direct deposit allowance: ', allowance);
29
21
  break;
30
22
  }
31
23
  case 'swap': {
32
24
  const allowanceString = await this.perqSdk.lite.getSwapAndDepositAllowance(sourceTokenAddress);
33
25
  allowance = ethers_1.BigNumber.from(allowanceString);
34
- console.log('🚀 ~ swapAndDeposit allowance: ', allowance);
35
26
  break;
36
27
  }
37
28
  case 'wrap': {
@@ -51,12 +42,6 @@ class YelayVaultOperations {
51
42
  }
52
43
  async approveAllowance(params) {
53
44
  const { sourceTokenAddress, vaultAddress, amount, onChainProjectId } = params;
54
- console.log(`🚀 ~ yelay approveAllowance called with these params:`, {
55
- sourceTokenAddress,
56
- vaultAddress,
57
- amount,
58
- onChainProjectId,
59
- });
60
45
  if (!onChainProjectId || onChainProjectId === -1) {
61
46
  throw new Error('OnChainProjectId is required for Yelay vaults');
62
47
  }
@@ -74,41 +59,16 @@ class YelayVaultOperations {
74
59
  }
75
60
  async deposit(params) {
76
61
  const { sourceTokenAddress, vaultTokenAddress, vaultAddress, amount, onChainProjectId } = params;
77
- console.log(`🚀 ~ yelay deposit called with these params: `, {
78
- sourceTokenAddress,
79
- vaultTokenAddress,
80
- vaultAddress,
81
- amount,
82
- onChainProjectId,
83
- });
84
62
  if (!onChainProjectId || onChainProjectId === -1) {
85
63
  throw new Error('OnChainProjectId is required for Yelay vaults');
86
64
  }
87
65
  const depositType = this.determineDepositType(params);
88
66
  switch (depositType) {
89
67
  case 'direct':
90
- console.log('🚀 ~ this.perqSdk.lite.deposit called', {
91
- sourceTokenAddress,
92
- vaultAddress,
93
- onChainProjectId,
94
- amount,
95
- });
96
68
  return await this.perqSdk.lite.deposit(sourceTokenAddress, vaultAddress, onChainProjectId, amount);
97
69
  case 'wrap':
98
- console.log('🚀 ~ this.perqSdk.lite.wrapAndDepositEth called', {
99
- vaultAddress,
100
- onChainProjectId,
101
- amount,
102
- });
103
70
  return await this.perqSdk.lite.wrapAndDepositEth(vaultAddress, onChainProjectId, amount);
104
71
  case 'swap':
105
- console.log('🚀 ~ this.perqSdk.lite.swapAndDeposit called', {
106
- sourceTokenAddress,
107
- vaultTokenAddress,
108
- amount,
109
- vaultAddress,
110
- onChainProjectId,
111
- });
112
72
  return await this.perqSdk.lite.swapAndDeposit(sourceTokenAddress, vaultTokenAddress, amount, vaultAddress, onChainProjectId);
113
73
  default:
114
74
  throw new Error(`Unsupported deposit type: ${depositType}`);
@@ -116,30 +76,13 @@ class YelayVaultOperations {
116
76
  }
117
77
  async withdraw(params) {
118
78
  const { amount, tokenAddress, vaultAddress, onChainProjectId } = params;
119
- console.log(`🚀 ~ yelay withdraw called with these params:`, {
120
- amount,
121
- tokenAddress,
122
- vaultAddress,
123
- onChainProjectId,
124
- });
125
79
  if (!onChainProjectId || onChainProjectId === -1) {
126
80
  throw new Error('OnChainProjectId is required for Yelay vaults');
127
81
  }
128
- console.log('🚀 ~ this.perqSdk.lite.withdraw called', {
129
- tokenAddress,
130
- vaultAddress,
131
- onChainProjectId,
132
- amount,
133
- });
134
82
  return await this.perqSdk.lite.withdraw(tokenAddress, vaultAddress, onChainProjectId, amount);
135
83
  }
136
84
  async getBalance(vaultAddress, _, onChainProjectId) {
137
- console.log('🚀 ~ this.perqSdk.pools.getUserPoolBalance called with: ', {
138
- vaultAddress,
139
- onChainProjectId,
140
- });
141
85
  const balance = await this.perqSdk.pools.getUserPoolBalance(vaultAddress, onChainProjectId);
142
- console.log('🚀 ~ balance: ', balance);
143
86
  return balance;
144
87
  }
145
88
  determineDepositType(params) {
@@ -4,3 +4,6 @@ export type SuiWalletPayload = {
4
4
  export type NearWalletPayload = {
5
5
  nearWalletAddr: string;
6
6
  };
7
+ export type SolanaWalletPayload = {
8
+ solanaWalletAddr: string;
9
+ };
@@ -1,5 +1,6 @@
1
1
  type LinkedPodWallets = {
2
2
  suiWalletAddr: string;
3
3
  nearWalletAddr: string;
4
+ solanaWalletAddr: string;
4
5
  };
5
6
  export default LinkedPodWallets;
@@ -6,7 +6,7 @@ import DeployedProject, { ProjectBacker } from './DeployedProject';
6
6
  import DeployedVault from './DeployedVault';
7
7
  import DepositToken from './DepositToken';
8
8
  import ELoyaltyCardTier from './ELoyaltyCardTier';
9
- import { NearWalletPayload, SuiWalletPayload } from './LinkWalletPayload';
9
+ import { NearWalletPayload, SuiWalletPayload, SolanaWalletPayload } from './LinkWalletPayload';
10
10
  import LoyaltyCard from './LoyaltyCard';
11
11
  import MyPerqData from './MyPerqData';
12
12
  import NFTBoost from './NFTBoost';
@@ -31,4 +31,4 @@ import YelayVersion from './YelayVersion';
31
31
  import Earnings from './Earnings';
32
32
  import LinkedPodWallets from './LinkedPodWallets';
33
33
  import MigrationOption from './MigrationOption';
34
- export { Asset, BasePayload, BeanEntry, BeansBalance, DeployedProject, DeployedVault, DepositToken, DetailedProjectData, ELoyaltyCardTier, NearWalletPayload, SuiWalletPayload, LinkedPodWallets, LoyaltyCard, MigrationOption, MyPerqData, NFTBoost, NonceEnrichedPayload, NonceEnrichedSignedPayload, PerqConfig, PerqToBeansSwapInfo, ProjectBacker, QLFastRedeem, ReducedProjectData, RewardType, SpecialEditionLoyaltyCard, Strategy, StretchGoal, SwapInfo, UpgradeLoyaltyCardPayload, UserRewards, VaultData, VaultReward, VaultStats, VaultType, VaultOperationParams, DepositType, VestingInfo, YelayVersion, Earnings, };
34
+ export { Asset, BasePayload, BeanEntry, BeansBalance, DeployedProject, DeployedVault, DepositToken, DetailedProjectData, ELoyaltyCardTier, NearWalletPayload, SuiWalletPayload, SolanaWalletPayload, LinkedPodWallets, LoyaltyCard, MigrationOption, MyPerqData, NFTBoost, NonceEnrichedPayload, NonceEnrichedSignedPayload, PerqConfig, PerqToBeansSwapInfo, ProjectBacker, QLFastRedeem, ReducedProjectData, RewardType, SpecialEditionLoyaltyCard, Strategy, StretchGoal, SwapInfo, UpgradeLoyaltyCardPayload, UserRewards, VaultData, VaultReward, VaultStats, VaultType, VaultOperationParams, DepositType, VestingInfo, YelayVersion, Earnings, };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dripfi/drip-sdk",
3
- "version": "1.4.30",
3
+ "version": "1.4.32",
4
4
  "description": "Drip SDK",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",