@dripfi/drip-sdk 1.4.34 → 1.4.35-beta.2

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 (150) hide show
  1. package/package.json +11 -12
  2. package/dist/PerqApi.d.ts +0 -49
  3. package/dist/PerqApi.js +0 -475
  4. package/dist/PerqSdk.d.ts +0 -40
  5. package/dist/PerqSdk.js +0 -75
  6. package/dist/abi/ERC20.json +0 -222
  7. package/dist/abi/SlotBurnTokenAbi.json +0 -130
  8. package/dist/abi/WethTokenAbi.json +0 -25
  9. package/dist/abi/index.d.ts +0 -411
  10. package/dist/abi/index.js +0 -23
  11. package/dist/abi/perq/BridgeMainnetPerqToSonicAbi.json +0 -598
  12. package/dist/abi/perq/BridgeSonicPerqToMainnetAbi.json +0 -733
  13. package/dist/abi/perq/PerqSwapAndRecyclerAbi.json +0 -95
  14. package/dist/abi/perq/PerqTokenAbi.json +0 -48
  15. package/dist/abi/perq/PerqVestingAbi.json +0 -126
  16. package/dist/abi/perq/TokenRecyclerAbi.json +0 -41
  17. package/dist/constants.d.ts +0 -2
  18. package/dist/constants.js +0 -5
  19. package/dist/contracts/BaseContract.d.ts +0 -7
  20. package/dist/contracts/BaseContract.js +0 -16
  21. package/dist/contracts/BridgeMainnetPerqToSonicContract.d.ts +0 -9
  22. package/dist/contracts/BridgeMainnetPerqToSonicContract.js +0 -48
  23. package/dist/contracts/BridgeSonicPerqToMainnetContract.d.ts +0 -9
  24. package/dist/contracts/BridgeSonicPerqToMainnetContract.js +0 -47
  25. package/dist/contracts/ERC20TokenContract.d.ts +0 -10
  26. package/dist/contracts/ERC20TokenContract.js +0 -34
  27. package/dist/contracts/SlotBurnTokenContract.d.ts +0 -8
  28. package/dist/contracts/SlotBurnTokenContract.js +0 -26
  29. package/dist/contracts/index.d.ts +0 -9
  30. package/dist/contracts/index.js +0 -22
  31. package/dist/contracts/perq/PerqSwapAndRecyclerContract.d.ts +0 -8
  32. package/dist/contracts/perq/PerqSwapAndRecyclerContract.js +0 -28
  33. package/dist/contracts/perq/PerqTokenContract.d.ts +0 -7
  34. package/dist/contracts/perq/PerqTokenContract.js +0 -26
  35. package/dist/contracts/perq/PerqTokenRecyclerContract.d.ts +0 -7
  36. package/dist/contracts/perq/PerqTokenRecyclerContract.js +0 -20
  37. package/dist/contracts/perq/PerqVestingContract.d.ts +0 -13
  38. package/dist/contracts/perq/PerqVestingContract.js +0 -56
  39. package/dist/index.d.ts +0 -5
  40. package/dist/index.js +0 -28
  41. package/dist/subpackages/BridgePerqPackage.d.ts +0 -36
  42. package/dist/subpackages/BridgePerqPackage.js +0 -205
  43. package/dist/subpackages/LitePackage.d.ts +0 -19
  44. package/dist/subpackages/LitePackage.js +0 -106
  45. package/dist/subpackages/LoyaltyCardsPackage.d.ts +0 -21
  46. package/dist/subpackages/LoyaltyCardsPackage.js +0 -123
  47. package/dist/subpackages/PoolsPackage.d.ts +0 -21
  48. package/dist/subpackages/PoolsPackage.js +0 -58
  49. package/dist/subpackages/RecyclerPackage.d.ts +0 -13
  50. package/dist/subpackages/RecyclerPackage.js +0 -87
  51. package/dist/subpackages/SignHandlerPackage.d.ts +0 -8
  52. package/dist/subpackages/SignHandlerPackage.js +0 -33
  53. package/dist/subpackages/SiloPackage.d.ts +0 -18
  54. package/dist/subpackages/SiloPackage.js +0 -112
  55. package/dist/subpackages/SiloVaultOperations.d.ts +0 -31
  56. package/dist/subpackages/SiloVaultOperations.js +0 -119
  57. package/dist/subpackages/TokenUtilsPackage.d.ts +0 -27
  58. package/dist/subpackages/TokenUtilsPackage.js +0 -93
  59. package/dist/subpackages/UserPackage.d.ts +0 -11
  60. package/dist/subpackages/UserPackage.js +0 -43
  61. package/dist/subpackages/VaultHandlerPackage.d.ts +0 -54
  62. package/dist/subpackages/VaultHandlerPackage.js +0 -107
  63. package/dist/subpackages/VestingPackage.d.ts +0 -14
  64. package/dist/subpackages/VestingPackage.js +0 -112
  65. package/dist/subpackages/YelayVaultOperations.d.ts +0 -13
  66. package/dist/subpackages/YelayVaultOperations.js +0 -107
  67. package/dist/types/Asset.d.ts +0 -5
  68. package/dist/types/Asset.js +0 -2
  69. package/dist/types/BeanEntry.d.ts +0 -12
  70. package/dist/types/BeanEntry.js +0 -2
  71. package/dist/types/BeansBalance.d.ts +0 -5
  72. package/dist/types/BeansBalance.js +0 -2
  73. package/dist/types/BridgePerq.d.ts +0 -14
  74. package/dist/types/BridgePerq.js +0 -2
  75. package/dist/types/ChainId.d.ts +0 -7
  76. package/dist/types/ChainId.js +0 -9
  77. package/dist/types/ClaimSpecialEditionLoyaltyCardPayload.d.ts +0 -4
  78. package/dist/types/ClaimSpecialEditionLoyaltyCardPayload.js +0 -2
  79. package/dist/types/DeployedProject.d.ts +0 -55
  80. package/dist/types/DeployedProject.js +0 -2
  81. package/dist/types/DeployedVault.d.ts +0 -14
  82. package/dist/types/DeployedVault.js +0 -2
  83. package/dist/types/DepositToken.d.ts +0 -8
  84. package/dist/types/DepositToken.js +0 -2
  85. package/dist/types/DetailedProjectData.d.ts +0 -34
  86. package/dist/types/DetailedProjectData.js +0 -2
  87. package/dist/types/DistributionToken.d.ts +0 -6
  88. package/dist/types/DistributionToken.js +0 -2
  89. package/dist/types/ELoyaltyCardTier.d.ts +0 -10
  90. package/dist/types/ELoyaltyCardTier.js +0 -13
  91. package/dist/types/Earnings.d.ts +0 -11
  92. package/dist/types/Earnings.js +0 -2
  93. package/dist/types/LinkWalletPayload.d.ts +0 -9
  94. package/dist/types/LinkWalletPayload.js +0 -2
  95. package/dist/types/LinkedPodWallets.d.ts +0 -6
  96. package/dist/types/LinkedPodWallets.js +0 -2
  97. package/dist/types/LoyaltyCard.d.ts +0 -11
  98. package/dist/types/LoyaltyCard.js +0 -2
  99. package/dist/types/MigrationOption.d.ts +0 -6
  100. package/dist/types/MigrationOption.js +0 -2
  101. package/dist/types/MyPerqData.d.ts +0 -19
  102. package/dist/types/MyPerqData.js +0 -2
  103. package/dist/types/NFTBoost.d.ts +0 -10
  104. package/dist/types/NFTBoost.js +0 -2
  105. package/dist/types/OverallStats.d.ts +0 -7
  106. package/dist/types/OverallStats.js +0 -2
  107. package/dist/types/PerqConfig.d.ts +0 -18
  108. package/dist/types/PerqConfig.js +0 -37
  109. package/dist/types/PerqToBeansSwapInfo.d.ts +0 -8
  110. package/dist/types/PerqToBeansSwapInfo.js +0 -2
  111. package/dist/types/ProjectHistoricalTvl.d.ts +0 -4
  112. package/dist/types/ProjectHistoricalTvl.js +0 -2
  113. package/dist/types/QLFastRedeem.d.ts +0 -16
  114. package/dist/types/QLFastRedeem.js +0 -2
  115. package/dist/types/ReducedProjectData.d.ts +0 -21
  116. package/dist/types/ReducedProjectData.js +0 -2
  117. package/dist/types/SdkType.d.ts +0 -2
  118. package/dist/types/SdkType.js +0 -2
  119. package/dist/types/SignedPayload.d.ts +0 -12
  120. package/dist/types/SignedPayload.js +0 -2
  121. package/dist/types/SlotMachineSpinCost.d.ts +0 -7
  122. package/dist/types/SlotMachineSpinCost.js +0 -2
  123. package/dist/types/SpecialEditionLoyaltyCard.d.ts +0 -9
  124. package/dist/types/SpecialEditionLoyaltyCard.js +0 -2
  125. package/dist/types/Strategy.d.ts +0 -9
  126. package/dist/types/Strategy.js +0 -2
  127. package/dist/types/StretchGoal.d.ts +0 -5
  128. package/dist/types/StretchGoal.js +0 -2
  129. package/dist/types/SwapInfo.d.ts +0 -6
  130. package/dist/types/SwapInfo.js +0 -2
  131. package/dist/types/UpgradeLoyaltyCardPayload.d.ts +0 -4
  132. package/dist/types/UpgradeLoyaltyCardPayload.js +0 -2
  133. package/dist/types/UserRewards.d.ts +0 -6
  134. package/dist/types/UserRewards.js +0 -2
  135. package/dist/types/VaultData.d.ts +0 -32
  136. package/dist/types/VaultData.js +0 -2
  137. package/dist/types/VaultOperationParams.d.ts +0 -12
  138. package/dist/types/VaultOperationParams.js +0 -2
  139. package/dist/types/VaultReward.d.ts +0 -16
  140. package/dist/types/VaultReward.js +0 -4
  141. package/dist/types/VaultStats.d.ts +0 -6
  142. package/dist/types/VaultStats.js +0 -2
  143. package/dist/types/VaultType.d.ts +0 -3
  144. package/dist/types/VaultType.js +0 -4
  145. package/dist/types/VestingInfo.d.ts +0 -8
  146. package/dist/types/VestingInfo.js +0 -2
  147. package/dist/types/YelayVersion.d.ts +0 -2
  148. package/dist/types/YelayVersion.js +0 -2
  149. package/dist/types/index.d.ts +0 -34
  150. package/dist/types/index.js +0 -8
@@ -1,43 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- class UserPackage {
4
- perqSdk;
5
- constructor(perqSdk) {
6
- this.perqSdk = perqSdk;
7
- }
8
- async getEarnings(projectName) {
9
- if (!this.perqSdk.signer) {
10
- throw new Error('No signer provided');
11
- }
12
- return this.perqSdk.perqApi.fetchEarnings(await this.perqSdk.signer.getAddress(), projectName);
13
- }
14
- async linkSuiWalletWithEthWallet(suiWalletAddress) {
15
- const payload = {
16
- suiWalletAddr: suiWalletAddress,
17
- };
18
- const signedPayload = await this.perqSdk.signHandler.signPayload(payload);
19
- return this.perqSdk.perqApi.linkSuiWalletWithEthWallet(signedPayload);
20
- }
21
- async linkNearWalletWithEthWallet(nearWalletAddress) {
22
- const payload = {
23
- nearWalletAddr: nearWalletAddress,
24
- };
25
- const signedPayload = await this.perqSdk.signHandler.signPayload(payload);
26
- return this.perqSdk.perqApi.linkNearWalletWithEthWallet(signedPayload);
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
- }
35
- async getLinkedPodWallets() {
36
- if (!this.perqSdk.signer) {
37
- throw new Error('No signer provided');
38
- }
39
- const walletAddr = await this.perqSdk.signer.getAddress();
40
- return this.perqSdk.perqApi.getPodWallets(walletAddr);
41
- }
42
- }
43
- exports.default = UserPackage;
@@ -1,54 +0,0 @@
1
- import PerqSdk from '../PerqSdk';
2
- import SdkType from '../types/SdkType';
3
- import { VaultOperationParams } from '../types/VaultOperationParams';
4
- export interface WithdrawParams {
5
- amount: string;
6
- sdkType: SdkType;
7
- tokenAddress: string;
8
- vaultAddress: string;
9
- onChainProjectId?: number;
10
- }
11
- export interface GetBalanceParams {
12
- sdkType: SdkType;
13
- tokenAddress: string;
14
- vaultAddress: string;
15
- onChainProjectId?: number;
16
- }
17
- export interface VaultOperations {
18
- getAllowance(params: VaultOperationParams): Promise<boolean>;
19
- approveAllowance(params: VaultOperationParams): Promise<string>;
20
- deposit(params: VaultOperationParams): Promise<string>;
21
- withdraw(params: WithdrawParams): Promise<string>;
22
- getBalance(vaultAddress: string, tokenAddress?: string, onChainProjectId?: number): Promise<string>;
23
- }
24
- export default class VaultHandler {
25
- private perqSdk;
26
- constructor(perqSdk: PerqSdk);
27
- /**
28
- * Get allowance for vault operations
29
- * Returns true if the user has approved sufficient allowance for the specified amount
30
- */
31
- getAllowance(params: VaultOperationParams): Promise<boolean>;
32
- /**
33
- * Approve allowance for vault operations
34
- * Automatically determines the correct approval method based on deposit type
35
- */
36
- approveAllowance(params: VaultOperationParams): Promise<string>;
37
- /**
38
- * Deposit to vault
39
- * Automatically determines the correct deposit method based on deposit type
40
- */
41
- deposit(params: VaultOperationParams): Promise<string>;
42
- /**
43
- * Withdraw from vault
44
- */
45
- withdraw(params: WithdrawParams): Promise<string>;
46
- /**
47
- * Get the balance of the vault
48
- */
49
- getBalance(params: GetBalanceParams): Promise<string>;
50
- /**
51
- * Get the appropriate SDK handler based on SDK type
52
- */
53
- private getSdkHandler;
54
- }
@@ -1,107 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const YelayVaultOperations_1 = require("./YelayVaultOperations");
4
- const SiloVaultOperations_1 = require("./SiloVaultOperations");
5
- class VaultHandler {
6
- perqSdk;
7
- constructor(perqSdk) {
8
- this.perqSdk = perqSdk;
9
- }
10
- /**
11
- * Get allowance for vault operations
12
- * Returns true if the user has approved sufficient allowance for the specified amount
13
- */
14
- async getAllowance(params) {
15
- if (!this.perqSdk.signer) {
16
- throw Error('No signer provided');
17
- }
18
- try {
19
- const sdkHandler = this.getSdkHandler(params.sdkType);
20
- return await sdkHandler.getAllowance(params);
21
- }
22
- catch (error) {
23
- console.error('Error getting allowance:', error);
24
- throw error;
25
- }
26
- }
27
- /**
28
- * Approve allowance for vault operations
29
- * Automatically determines the correct approval method based on deposit type
30
- */
31
- async approveAllowance(params) {
32
- if (!this.perqSdk.signer) {
33
- throw Error('No signer provided');
34
- }
35
- try {
36
- const sdkHandler = this.getSdkHandler(params.sdkType);
37
- return await sdkHandler.approveAllowance(params);
38
- }
39
- catch (error) {
40
- console.error('Error approving allowance:', error);
41
- throw error;
42
- }
43
- }
44
- /**
45
- * Deposit to vault
46
- * Automatically determines the correct deposit method based on deposit type
47
- */
48
- async deposit(params) {
49
- if (!this.perqSdk.signer) {
50
- throw Error('No signer provided');
51
- }
52
- try {
53
- const sdkHandler = this.getSdkHandler(params.sdkType);
54
- return await sdkHandler.deposit(params);
55
- }
56
- catch (error) {
57
- console.error('Error depositing to vault:', error);
58
- throw error;
59
- }
60
- }
61
- /**
62
- * Withdraw from vault
63
- */
64
- async withdraw(params) {
65
- if (!this.perqSdk.signer) {
66
- throw Error('No signer provided');
67
- }
68
- try {
69
- const sdkHandler = this.getSdkHandler(params.sdkType);
70
- return await sdkHandler.withdraw(params);
71
- }
72
- catch (error) {
73
- console.error('Error withdrawing from vault:', error);
74
- throw error;
75
- }
76
- }
77
- /**
78
- * Get the balance of the vault
79
- */
80
- async getBalance(params) {
81
- if (!this.perqSdk.signer) {
82
- throw Error('No signer provided');
83
- }
84
- try {
85
- const sdkHandler = this.getSdkHandler(params.sdkType);
86
- return await sdkHandler.getBalance(params.vaultAddress, params.tokenAddress, params.onChainProjectId);
87
- }
88
- catch (error) {
89
- console.error('Error withdrawing from vault:', error);
90
- throw error;
91
- }
92
- }
93
- /**
94
- * Get the appropriate SDK handler based on SDK type
95
- */
96
- getSdkHandler(sdkType) {
97
- switch (sdkType) {
98
- case 'yelay':
99
- return new YelayVaultOperations_1.YelayVaultOperations(this.perqSdk);
100
- case 'silo':
101
- return new SiloVaultOperations_1.SiloVaultOperations(this.perqSdk);
102
- default:
103
- throw new Error(`Unsupported SDK type: ${sdkType}`);
104
- }
105
- }
106
- }
107
- exports.default = VaultHandler;
@@ -1,14 +0,0 @@
1
- import { VestingInfo } from '../types';
2
- import PerqSdk from '../PerqSdk';
3
- export default class VestingPackage {
4
- perqSdk: PerqSdk;
5
- constructor(perqSdk: PerqSdk);
6
- getVestingStart(): Promise<string>;
7
- getVestingEnd(): Promise<string>;
8
- getVestedAmount(beneficiary: string): Promise<string>;
9
- getReleasableAmount(beneficiary: string): Promise<string>;
10
- getReleasableTotalAmount(beneficiary: string): Promise<string>;
11
- claimVestedPerq(amount: string): Promise<string>;
12
- burnVestedPerq(amount: string, price: string, deadline: string, signature: string): Promise<string>;
13
- getAllVestingInfo(beneficiaryAddress: string): Promise<VestingInfo>;
14
- }
@@ -1,112 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const utils_1 = require("ethers/lib/utils");
4
- class VestingPackage {
5
- perqSdk;
6
- constructor(perqSdk) {
7
- this.perqSdk = perqSdk;
8
- }
9
- async getVestingStart() {
10
- try {
11
- const startBigNumber = await this.perqSdk.perqVestingContract.start();
12
- return startBigNumber.toString();
13
- }
14
- catch (error) {
15
- if (error instanceof Error) {
16
- throw new Error(`Failed to get vesting start time: ${error.message}`);
17
- }
18
- throw new Error('Failed to get vesting start time: Unknown error');
19
- }
20
- }
21
- async getVestingEnd() {
22
- try {
23
- const endBigNumber = await this.perqSdk.perqVestingContract.end();
24
- return endBigNumber.toString();
25
- }
26
- catch (error) {
27
- if (error instanceof Error) {
28
- throw new Error(`Failed to get vesting end time: ${error.message}`);
29
- }
30
- throw new Error('Failed to get vesting end time: Unknown error');
31
- }
32
- }
33
- async getVestedAmount(beneficiary) {
34
- try {
35
- const vestedAmount = await this.perqSdk.perqVestingContract.vested(beneficiary);
36
- return (0, utils_1.formatUnits)(vestedAmount, 18);
37
- }
38
- catch (error) {
39
- if (error instanceof Error) {
40
- throw new Error(`Failed to get vested amount: ${error.message}`);
41
- }
42
- throw new Error('Failed to get vested amount: Unknown error');
43
- }
44
- }
45
- async getReleasableAmount(beneficiary) {
46
- try {
47
- const releasableAmount = await this.perqSdk.perqVestingContract.releasable(beneficiary);
48
- return (0, utils_1.formatUnits)(releasableAmount, 18);
49
- }
50
- catch (error) {
51
- if (error instanceof Error) {
52
- throw new Error(`Failed to get releasable amount: ${error.message}`);
53
- }
54
- throw new Error('Failed to get releasable amount: Unknown error');
55
- }
56
- }
57
- async getReleasableTotalAmount(beneficiary) {
58
- try {
59
- const releasableTotalAmount = await this.perqSdk.perqVestingContract.releasableTotal(beneficiary);
60
- return (0, utils_1.formatUnits)(releasableTotalAmount, 18);
61
- }
62
- catch (error) {
63
- if (error instanceof Error) {
64
- throw new Error(`Failed to get total releasable amount: ${error.message}`);
65
- }
66
- throw new Error('Failed to get total releasable amount: Unknown error');
67
- }
68
- }
69
- async claimVestedPerq(amount) {
70
- try {
71
- const claimTx = await this.perqSdk.perqVestingContract.claim(amount);
72
- const txReceipt = await claimTx.wait();
73
- return txReceipt.transactionHash;
74
- }
75
- catch (error) {
76
- if (error instanceof Error) {
77
- throw new Error(`Failed to get total releasable amount: ${error.message}`);
78
- }
79
- throw new Error('Failed to get total releasable amount: Unknown error');
80
- }
81
- }
82
- async burnVestedPerq(amount, price, deadline, signature) {
83
- try {
84
- const burnTx = await this.perqSdk.perqVestingContract.burn(amount, price, deadline, signature);
85
- const txReceipt = await burnTx.wait();
86
- return txReceipt.transactionHash;
87
- }
88
- catch (error) {
89
- if (error instanceof Error) {
90
- throw new Error(`Failed to get total releasable amount: ${error.message}`);
91
- }
92
- throw new Error('Failed to get total releasable amount: Unknown error');
93
- }
94
- }
95
- async getAllVestingInfo(beneficiaryAddress) {
96
- const [startTimestamp, endTimestamp, vested, releasable, releasableTotal] = await Promise.all([
97
- this.getVestingStart(),
98
- this.getVestingEnd(),
99
- this.getVestedAmount(beneficiaryAddress),
100
- this.getReleasableAmount(beneficiaryAddress),
101
- this.getReleasableTotalAmount(beneficiaryAddress),
102
- ]);
103
- return {
104
- startTimestamp,
105
- endTimestamp,
106
- vested,
107
- releasable,
108
- releasableTotal,
109
- };
110
- }
111
- }
112
- exports.default = VestingPackage;
@@ -1,13 +0,0 @@
1
- import PerqSdk from '../PerqSdk';
2
- import { VaultOperationParams } from '../types/VaultOperationParams';
3
- import { VaultOperations, WithdrawParams } from './VaultHandlerPackage';
4
- export declare class YelayVaultOperations implements VaultOperations {
5
- private perqSdk;
6
- constructor(perqSdk: PerqSdk);
7
- getAllowance(params: VaultOperationParams): Promise<boolean>;
8
- approveAllowance(params: VaultOperationParams): Promise<string>;
9
- deposit(params: VaultOperationParams): Promise<string>;
10
- withdraw(params: WithdrawParams): Promise<string>;
11
- getBalance(vaultAddress: string, _: string, onChainProjectId: number): Promise<string>;
12
- private determineDepositType;
13
- }
@@ -1,107 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.YelayVaultOperations = void 0;
4
- const ethers_1 = require("ethers");
5
- class YelayVaultOperations {
6
- perqSdk;
7
- constructor(perqSdk) {
8
- this.perqSdk = perqSdk;
9
- }
10
- async getAllowance(params) {
11
- const { sourceTokenAddress, vaultAddress, onChainProjectId, amount } = params;
12
- if (!onChainProjectId || onChainProjectId === -1) {
13
- throw new Error('OnChainProjectId is required for Yelay vaults');
14
- }
15
- const depositType = this.determineDepositType(params);
16
- try {
17
- let allowance;
18
- switch (depositType) {
19
- case 'direct': {
20
- allowance = await this.perqSdk.tokenUtils.getERC20TokenAllowance(vaultAddress, sourceTokenAddress);
21
- break;
22
- }
23
- case 'swap': {
24
- const allowanceString = await this.perqSdk.lite.getSwapAndDepositAllowance(sourceTokenAddress);
25
- allowance = ethers_1.BigNumber.from(allowanceString);
26
- break;
27
- }
28
- case 'wrap': {
29
- return true;
30
- }
31
- default:
32
- throw new Error(`Unsupported deposit type: ${depositType}`);
33
- }
34
- // Get required amount with correct decimals
35
- const requiredAmount = await this.perqSdk.tokenUtils.parseAmountWithDecimals(amount, sourceTokenAddress);
36
- return allowance.gte(requiredAmount);
37
- }
38
- catch (error) {
39
- console.error('Error checking allowance:', error);
40
- return false;
41
- }
42
- }
43
- async approveAllowance(params) {
44
- const { sourceTokenAddress, vaultAddress, amount, onChainProjectId } = params;
45
- if (!onChainProjectId || onChainProjectId === -1) {
46
- throw new Error('OnChainProjectId is required for Yelay vaults');
47
- }
48
- const depositType = this.determineDepositType(params);
49
- switch (depositType) {
50
- case 'direct':
51
- return await this.perqSdk.tokenUtils.approveAllowance(sourceTokenAddress, amount, vaultAddress);
52
- case 'wrap':
53
- throw new Error("Can't approve a native token");
54
- case 'swap':
55
- return await this.perqSdk.lite.approveSwapAndDeposit(sourceTokenAddress, amount);
56
- default:
57
- throw new Error(`Unsupported deposit type: ${depositType}`);
58
- }
59
- }
60
- async deposit(params) {
61
- const { sourceTokenAddress, vaultTokenAddress, vaultAddress, amount, onChainProjectId } = params;
62
- if (!onChainProjectId || onChainProjectId === -1) {
63
- throw new Error('OnChainProjectId is required for Yelay vaults');
64
- }
65
- const depositType = this.determineDepositType(params);
66
- switch (depositType) {
67
- case 'direct':
68
- return await this.perqSdk.lite.deposit(sourceTokenAddress, vaultAddress, onChainProjectId, amount);
69
- case 'wrap':
70
- return await this.perqSdk.lite.wrapAndDepositEth(vaultAddress, onChainProjectId, amount);
71
- case 'swap':
72
- return await this.perqSdk.lite.swapAndDeposit(sourceTokenAddress, vaultTokenAddress, amount, vaultAddress, onChainProjectId);
73
- default:
74
- throw new Error(`Unsupported deposit type: ${depositType}`);
75
- }
76
- }
77
- async withdraw(params) {
78
- const { amount, tokenAddress, vaultAddress, onChainProjectId } = params;
79
- if (!onChainProjectId || onChainProjectId === -1) {
80
- throw new Error('OnChainProjectId is required for Yelay vaults');
81
- }
82
- return await this.perqSdk.lite.withdraw(tokenAddress, vaultAddress, onChainProjectId, amount);
83
- }
84
- async getBalance(vaultAddress, _, onChainProjectId) {
85
- const balance = await this.perqSdk.pools.getUserPoolBalance(vaultAddress, onChainProjectId);
86
- return balance;
87
- }
88
- determineDepositType(params) {
89
- const { sourceTokenSymbol, vaultTokenSymbol } = params;
90
- if (!sourceTokenSymbol || !vaultTokenSymbol) {
91
- return 'direct';
92
- }
93
- const lowerSourceToken = sourceTokenSymbol.toLowerCase();
94
- const lowerVaultToken = vaultTokenSymbol.toLowerCase();
95
- // Check if it's ETH wrap deposit
96
- if (lowerSourceToken === 'eth' || lowerSourceToken === 's') {
97
- return 'wrap';
98
- }
99
- // Check if it's a direct deposit (same token)
100
- if (lowerSourceToken === lowerVaultToken) {
101
- return 'direct';
102
- }
103
- // Otherwise it's a swap deposit
104
- return 'swap';
105
- }
106
- }
107
- exports.YelayVaultOperations = YelayVaultOperations;
@@ -1,5 +0,0 @@
1
- type Asset = {
2
- decimals: number;
3
- symbol: string;
4
- };
5
- export default Asset;
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,12 +0,0 @@
1
- type BeanEntry = {
2
- address: string;
3
- reason: string;
4
- recycledAmount: string;
5
- beansAmount: string;
6
- beansSum: string;
7
- amountDepositedInUsd: string;
8
- createdAt: string;
9
- chainId: number;
10
- nonce: number;
11
- };
12
- export default BeanEntry;
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,5 +0,0 @@
1
- type BeansBalance = {
2
- balance: string;
3
- bonusesClaimed: string[];
4
- };
5
- export default BeansBalance;
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,14 +0,0 @@
1
- import { ethers } from 'ethers';
2
- export interface SendParam {
3
- dstEid: number;
4
- to: string;
5
- amountLD: ethers.BigNumber;
6
- minAmountLD: ethers.BigNumber;
7
- extraOptions: string;
8
- composeMsg: string;
9
- oftCmd: string;
10
- }
11
- export interface MessagingFee {
12
- nativeFee: ethers.BigNumber;
13
- lzTokenFee: ethers.BigNumber;
14
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,7 +0,0 @@
1
- export declare const BASE_CHAIN_ID = 8453;
2
- export declare const ETHEREUM_CHAIN_ID = 1;
3
- export declare const ETHEREUM_SEPOLIA_CHAIN_ID = 11155111;
4
- export declare const ARBITRUM_CHAIN_ID = 42161;
5
- export declare const SONIC_CHAIN_ID = 146;
6
- export declare const AVALANCHE_CHAIN_ID = 43114;
7
- export type ChainId = typeof BASE_CHAIN_ID | typeof ETHEREUM_CHAIN_ID | typeof ETHEREUM_SEPOLIA_CHAIN_ID | typeof ARBITRUM_CHAIN_ID | typeof SONIC_CHAIN_ID | typeof AVALANCHE_CHAIN_ID;
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AVALANCHE_CHAIN_ID = exports.SONIC_CHAIN_ID = exports.ARBITRUM_CHAIN_ID = exports.ETHEREUM_SEPOLIA_CHAIN_ID = exports.ETHEREUM_CHAIN_ID = exports.BASE_CHAIN_ID = void 0;
4
- exports.BASE_CHAIN_ID = 8453;
5
- exports.ETHEREUM_CHAIN_ID = 1;
6
- exports.ETHEREUM_SEPOLIA_CHAIN_ID = 11155111;
7
- exports.ARBITRUM_CHAIN_ID = 42161;
8
- exports.SONIC_CHAIN_ID = 146;
9
- exports.AVALANCHE_CHAIN_ID = 43114;
@@ -1,4 +0,0 @@
1
- type ClaimSpecialEditionLoyaltyCardPayload = {
2
- cardId: string;
3
- };
4
- export default ClaimSpecialEditionLoyaltyCardPayload;
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,55 +0,0 @@
1
- import { DistributionToken } from './DistributionToken';
2
- import { YelayVersion, StretchGoal } from './index';
3
- type DeployedProject = {
4
- id: number | undefined;
5
- projectName: string;
6
- owners: string[];
7
- logo: string;
8
- telegramLink: string;
9
- twitterLink: string;
10
- mediumLink: string;
11
- deckLink: string;
12
- roadmapLink: string;
13
- economicsLink: string;
14
- discordLink: string;
15
- docsLink: string;
16
- whitepaperLink: string;
17
- litepaperLink: string;
18
- websiteLink: string;
19
- supplyAtLaunch: number;
20
- fdv: number;
21
- latestRoundPriceInUsd: number;
22
- totalSupply: number;
23
- disabledTgePrice: boolean;
24
- backers: ProjectBacker[];
25
- networks: string[];
26
- content: string;
27
- tgeDate?: string;
28
- tgePrice?: number;
29
- vAPY?: number;
30
- wikiLink: string;
31
- youTubeLink: string;
32
- tikTokLink: string;
33
- stretchGoals: StretchGoal[];
34
- projectInfoText: string;
35
- projectRewardText: string;
36
- coingeckoId?: string;
37
- projectType: string;
38
- isFeatured: boolean;
39
- yelayVersion: YelayVersion;
40
- bannerImage?: string;
41
- rewardImage?: string;
42
- rewardTooltipName?: string;
43
- liveUntil: string;
44
- liveFrom: string;
45
- distributionType: string;
46
- isHidden: boolean;
47
- siloVaults: string[];
48
- distributionTokens: DistributionToken[];
49
- };
50
- export default DeployedProject;
51
- export type ProjectBacker = {
52
- name: string;
53
- image: string;
54
- link: string;
55
- };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,14 +0,0 @@
1
- import { DeployedProject, VaultReward, VaultType } from './index';
2
- type DeployedVault = {
3
- projectId: number;
4
- vaultAddress: string;
5
- liveUntil: string;
6
- liveFrom: string;
7
- type: VaultType;
8
- depositTokenId: string;
9
- rewards: VaultReward[];
10
- project?: DeployedProject;
11
- coingeckoId?: string;
12
- expectedTge?: string;
13
- };
14
- export default DeployedVault;
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,8 +0,0 @@
1
- type DepositToken = {
2
- name: string;
3
- symbol: string;
4
- roundingDecimals: number;
5
- precisionDecimals: number;
6
- tokenAddress: string;
7
- };
8
- export default DepositToken;
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,34 +0,0 @@
1
- import { ProjectBacker } from './DeployedProject';
2
- import { ReducedProjectData } from './ReducedProjectData';
3
- import StretchGoal from './StretchGoal';
4
- import VaultData from './VaultData';
5
- import YelayVersion from './YelayVersion';
6
- type DetailedProjectData = ReducedProjectData & {
7
- supplyAtLaunch: number;
8
- fdv: number;
9
- totalSupply: number;
10
- content: string;
11
- telegramLink: string;
12
- twitterLink: string;
13
- mediumLink: string;
14
- deckLink: string;
15
- roadmapLink: string;
16
- economicsLink: string;
17
- discordLink: string;
18
- docsLink: string;
19
- whitepaperLink: string;
20
- litepaperLink: string;
21
- websiteLink: string;
22
- projectType: string;
23
- wikiLink: string;
24
- youTubeLink: string;
25
- tikTokLink: string;
26
- projectRewardText: string;
27
- networks: string[];
28
- protocols: string[];
29
- yelayVersion: YelayVersion;
30
- stretchGoals: StretchGoal[];
31
- backers: ProjectBacker[];
32
- vaults: VaultData[];
33
- };
34
- export default DetailedProjectData;