@dripfi/drip-sdk 1.3.12 → 1.4.1

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
@@ -40,3 +40,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
40
40
  ### Added
41
41
 
42
42
  - The properites `bannerImage` and `rewardImage` were added to the `DeployedProject` type
43
+
44
+ ## [1.4.0] - 2025-01-28
45
+
46
+ ### Changed
47
+
48
+ - Renamed `DripSdk` to `PerqSdk`
49
+ - Renamed `DripApi` to `PerqApi`
50
+ - Renamed perq contracts `Drip` to `Perq`
51
+ - `PerqSdk` takes new param `PerqConfig` in constructor
52
+ - Moved `DripConfig` methods to fetch contracts address as constants into `PRODUCTION` and `DEVELOPMENT`
53
+
54
+ ### Added
55
+
56
+ - `PerqConfig` type, used to initiallize `PerqSdk`
57
+ - `PRODUCTION` and `DEVELOPMENT` instances of `PerqConfig`
58
+
59
+ ### Removed
60
+
61
+ - types `NULL_ADDRESS`, `Chain`
62
+ - class `DripConfig`
63
+
64
+ ## [1.4.1] - 2025-01-29
65
+
66
+ ### Added
67
+
68
+ - The properites `rewardTooltipName` was added to the `DeployedProject` type
package/README.md CHANGED
@@ -24,21 +24,21 @@ npm i @dripfi/drip-sdk
24
24
  # Usage
25
25
 
26
26
  ```typescript
27
- import DripSdk from '@drip/sdk';
28
- import { DripConfig, Chain } from '@dripfi/drip-sdk';
27
+ import PerqSdk from '@drip/sdk';
28
+ import { PerqConfig } from '@dripfi/drip-sdk';
29
29
  ```
30
30
 
31
31
  Initialize the SDK with your Drip configuration and an optional signer:
32
32
 
33
33
  ```typescript
34
34
 
35
- const chain: Chain = Chain.MAINNET // if targeting ethereum mainnet
35
+ const perqConfig: PerqConfig = PRODUCTION // if targeting ethereum mainnet
36
36
 
37
- const chain: Chain = Chain.SEPOLIA // if targeting sepolia testnet
37
+ const perqConfig: PerqConfig = DEVELOPMENT // if targeting sepolia testnet
38
38
 
39
39
  const signer: ethers.Signer = /* your Signer instance */;
40
40
 
41
- const dripSdk = new DripSdk(chain, signer);
41
+ const perqSdk = new PerqSdk(perqConfig, signer);
42
42
  ```
43
43
 
44
44
  # Methods
@@ -269,6 +269,7 @@ type DeployedProject = {
269
269
  yelayVersion: YelayVersion;
270
270
  bannerImage?: string;
271
271
  rewardImage?: string;
272
+ rewardTooltipName?: string;
272
273
  };
273
274
 
274
275
  type DeployedVault = {
@@ -480,11 +481,11 @@ type YelayVersion = 'v2' | 'lite';
480
481
 
481
482
  # Abis
482
483
 
483
- - DRIP_SWAP_AND_RECYCLER_ABI
484
+ - PERQ_SWAP_AND_RECYCLER_ABI
484
485
 
485
486
  - WETH_TOKEN_ABI
486
487
 
487
- - DRIP_TOKEN_ABI
488
+ - PERQ_TOKEN_ABI
488
489
 
489
490
  - TOKEN_RECYCLER_ABI
490
491
 
@@ -1,6 +1,6 @@
1
1
  import { BigNumber } from 'ethers';
2
2
  import { Vault, SwapInfo, QLFastRedeem, UserRewards, VaultStats, MyPerqData, LoyaltyCard, BeansBalance, PerqToBeansSwapInfo, BeanEntry, NonceEnrichedSignedPayload, NonceEnrichedPayload, UpgradeLoyaltyCardPayload } from './types';
3
- export default class DripApi {
3
+ export default class PerqApi {
4
4
  route: string;
5
5
  constructor(route: string);
6
6
  fetchAllVaults(): Promise<Vault[]>;
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const ethers_1 = require("ethers");
4
- const DripConfig_1 = require("./DripConfig");
4
+ const PERQ_TOKEN_DECIMALS = 18;
5
5
  const WETH_TOKEN_ADDRESS = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2';
6
- class DripApi {
6
+ class PerqApi {
7
7
  route;
8
8
  constructor(route) {
9
9
  this.route = route;
@@ -192,7 +192,7 @@ class DripApi {
192
192
  id: card.id,
193
193
  tier: card.tier,
194
194
  level: card.level,
195
- cost: parseFloat(ethers_1.ethers.utils.formatUnits(card.cost.toString(), DripConfig_1.PERQ_TOKEN_DECIMALS)),
195
+ cost: parseFloat(ethers_1.ethers.utils.formatUnits(card.cost.toString(), PERQ_TOKEN_DECIMALS)),
196
196
  boost: card.boost,
197
197
  }));
198
198
  }
@@ -211,7 +211,7 @@ class DripApi {
211
211
  id: data.id,
212
212
  tier: data.tier,
213
213
  level: data.level,
214
- cost: parseFloat(ethers_1.ethers.utils.formatUnits(data.cost.toString(), DripConfig_1.PERQ_TOKEN_DECIMALS)),
214
+ cost: parseFloat(ethers_1.ethers.utils.formatUnits(data.cost.toString(), PERQ_TOKEN_DECIMALS)),
215
215
  boost: data.boost,
216
216
  };
217
217
  }
@@ -224,7 +224,7 @@ class DripApi {
224
224
  if (res.ok) {
225
225
  const data = await res.json();
226
226
  const beansBalance = {
227
- balance: ethers_1.ethers.utils.formatUnits(data.balance, DripConfig_1.PERQ_TOKEN_DECIMALS),
227
+ balance: ethers_1.ethers.utils.formatUnits(data.balance, PERQ_TOKEN_DECIMALS),
228
228
  bonusesClaimed: data.bonusesClaimed,
229
229
  };
230
230
  return beansBalance;
@@ -248,7 +248,7 @@ class DripApi {
248
248
  id: data.id,
249
249
  tier: data.tier,
250
250
  level: data.level,
251
- cost: parseFloat(ethers_1.ethers.utils.formatUnits(data.cost.toString(), DripConfig_1.PERQ_TOKEN_DECIMALS)),
251
+ cost: parseFloat(ethers_1.ethers.utils.formatUnits(data.cost.toString(), PERQ_TOKEN_DECIMALS)),
252
252
  boost: data.boost,
253
253
  };
254
254
  }
@@ -321,4 +321,4 @@ class DripApi {
321
321
  return data;
322
322
  }
323
323
  }
324
- exports.default = DripApi;
324
+ exports.default = PerqApi;
@@ -1,20 +1,21 @@
1
1
  import { BigNumber, Signer } from 'ethers';
2
- import { Vault, Chain, UserRewards, VaultStats, UserVaultBalance, LoyaltyCard, NonceEnrichedSignedPayload, MyPerqData, BeansBalance, BeanEntry, PerqToBeansSwapInfo, VestingInfo } from './types';
3
- export default class DripSdk {
4
- private dripApi;
5
- private dripTokenContract;
6
- private dripTokenRecyclerContract;
7
- private dripSwapAndRecyclerContract;
2
+ import { Vault, UserRewards, VaultStats, UserVaultBalance, LoyaltyCard, NonceEnrichedSignedPayload, MyPerqData, BeansBalance, BeanEntry, PerqToBeansSwapInfo, VestingInfo } from './types';
3
+ import { PerqConfig } from './types/PerqConfig';
4
+ export default class PerqSdk {
5
+ private perqApi;
6
+ private perqConfig;
7
+ private perqTokenContract;
8
+ private perqTokenRecyclerContract;
9
+ private perqSwapAndRecyclerContract;
8
10
  private perqVestingContract;
9
11
  private spoolSdk?;
10
12
  private signer?;
11
- private dripConfig;
12
- constructor(chain: Chain, signer?: Signer, dripRoute?: string);
13
+ constructor(perqConfig: PerqConfig, signer?: Signer);
13
14
  getAllVaults(): Promise<Vault[]>;
14
15
  getVaultDetails(vaultAddress: string): Promise<Vault>;
15
16
  getVaultStats(): Promise<VaultStats>;
16
17
  getTokenPrice(tokenName: string): Promise<number>;
17
- updateSigner(newSigner: Signer): void;
18
+ updateSigner(newSigner: Signer): Promise<void>;
18
19
  newDeposit(tokenAddress: string, vaultAddress: string, amount: string): Promise<string>;
19
20
  deposit(tokenAddress: string, vaultAddress: string, amount: string): Promise<string>;
20
21
  private doDeposit;
@@ -45,7 +46,7 @@ export default class DripSdk {
45
46
  approveTokenForSwapAndRecycler(tokenAddress: string, amount: string): Promise<string>;
46
47
  approveTokenForSwapAndDeposit(tokenAddress: string, amount: string): Promise<string>;
47
48
  approveTokenForDeposit(tokenAddress: string, amount: string): Promise<string>;
48
- getDripTokenContractAddress(): string;
49
+ getPerqTokenContractAddress(): string;
49
50
  getSwapPerqForBeansInfo(): Promise<PerqToBeansSwapInfo>;
50
51
  transferErc20Token(tokenAddress: string, amount: string, receiver: string): Promise<string>;
51
52
  wrapEther(amount: string, tokenAddress: string): Promise<string>;
@@ -6,51 +6,49 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const ethers_1 = require("ethers");
7
7
  const utils_1 = require("ethers/lib/utils");
8
8
  const spool_v2_sdk_1 = require("@spool.fi/spool-v2-sdk");
9
- const DripConfig_1 = require("./DripConfig");
10
- const DripApi_1 = __importDefault(require("./DripApi"));
11
- const PerqTokenContract_1 = __importDefault(require("./contracts/PerqTokenContract"));
12
- const PerqTokenRecyclerContract_1 = __importDefault(require("./contracts/PerqTokenRecyclerContract"));
13
- const PerqSwapAndRecyclerContract_1 = __importDefault(require("./contracts/PerqSwapAndRecyclerContract"));
14
- const PerqVestingContract_1 = __importDefault(require("./contracts/PerqVestingContract"));
9
+ const PerqApi_1 = __importDefault(require("./PerqApi"));
10
+ const contracts_1 = require("./contracts");
15
11
  const WethTokenAbi_json_1 = __importDefault(require("./abi/WethTokenAbi.json"));
16
- class DripSdk {
17
- dripApi;
18
- dripTokenContract;
19
- dripTokenRecyclerContract;
20
- dripSwapAndRecyclerContract;
12
+ class PerqSdk {
13
+ perqApi;
14
+ perqConfig;
15
+ perqTokenContract;
16
+ perqTokenRecyclerContract;
17
+ perqSwapAndRecyclerContract;
21
18
  perqVestingContract;
22
19
  spoolSdk;
23
20
  signer;
24
- dripConfig;
25
- constructor(chain, signer, dripRoute) {
26
- this.signer = signer;
27
- this.dripConfig = new DripConfig_1.DripConfig(chain, dripRoute);
28
- if (signer) {
29
- this.spoolSdk = new spool_v2_sdk_1.SpoolSdk(this.dripConfig.internalConfig, signer);
21
+ constructor(perqConfig, signer) {
22
+ if (this.signer) {
23
+ this.spoolSdk = new spool_v2_sdk_1.SpoolSdk(perqConfig.spoolSdkConfig, this.signer);
30
24
  }
31
- this.dripApi = new DripApi_1.default(this.dripConfig.dripRoute);
32
- this.dripTokenContract = new PerqTokenContract_1.default(this.dripConfig.dripTokenAddress, signer);
33
- this.dripTokenRecyclerContract = new PerqTokenRecyclerContract_1.default(this.dripConfig.dripTokenRecyclerAddress, signer);
34
- this.dripSwapAndRecyclerContract = new PerqSwapAndRecyclerContract_1.default(this.dripConfig.dripSwapAndRecyclerAddress, signer);
35
- this.perqVestingContract = new PerqVestingContract_1.default(this.dripConfig.perqVestingAddress, signer);
25
+ this.perqConfig = perqConfig;
26
+ this.signer = signer;
27
+ 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
32
  }
37
33
  async getAllVaults() {
38
- return this.dripApi.fetchAllVaults();
34
+ return this.perqApi.fetchAllVaults();
39
35
  }
40
36
  async getVaultDetails(vaultAddress) {
41
- return this.dripApi.fetchVaultDetails(vaultAddress);
37
+ return this.perqApi.fetchVaultDetails(vaultAddress);
42
38
  }
43
39
  async getVaultStats() {
44
- return this.dripApi.fetchVaultStats();
40
+ return this.perqApi.fetchVaultStats();
45
41
  }
46
42
  async getTokenPrice(tokenName) {
47
- return this.dripApi.fetchTokenPrice(tokenName);
43
+ return this.perqApi.fetchTokenPrice(tokenName);
48
44
  }
49
- updateSigner(newSigner) {
45
+ async updateSigner(newSigner) {
50
46
  this.signer = newSigner;
51
- this.spoolSdk = new spool_v2_sdk_1.SpoolSdk(this.dripConfig.internalConfig, newSigner);
52
- this.dripTokenContract.updateSigner(newSigner);
53
- this.dripTokenRecyclerContract.updateSigner(newSigner);
47
+ this.spoolSdk = new spool_v2_sdk_1.SpoolSdk(this.perqConfig.spoolSdkConfig, newSigner);
48
+ this.perqTokenContract.updateSigner(newSigner);
49
+ this.perqTokenRecyclerContract.updateSigner(newSigner);
50
+ this.perqSwapAndRecyclerContract.updateSigner(newSigner);
51
+ this.perqVestingContract.updateSigner(newSigner);
54
52
  }
55
53
  async newDeposit(tokenAddress, vaultAddress, amount) {
56
54
  return this.doDeposit(tokenAddress, vaultAddress, amount, false);
@@ -97,35 +95,35 @@ class DripSdk {
97
95
  if (!this.signer) {
98
96
  throw Error('No signer provided');
99
97
  }
100
- const allowance = await this.getERC20TokenAllowance(this.dripTokenRecyclerContract.getContractAddress(), tokenAddress);
98
+ const allowance = await this.getERC20TokenAllowance(this.perqTokenRecyclerContract.getContractAddress(), tokenAddress);
101
99
  return allowance;
102
100
  }
103
101
  async getTokenAllowanceForSwapAndRecycler(tokenAddress) {
104
102
  if (!this.signer) {
105
103
  throw Error('No signer provided');
106
104
  }
107
- const allowance = await this.getERC20TokenAllowance(this.dripSwapAndRecyclerContract.getContractAddress(), tokenAddress);
105
+ const allowance = await this.getERC20TokenAllowance(this.perqSwapAndRecyclerContract.getContractAddress(), tokenAddress);
108
106
  return allowance;
109
107
  }
110
108
  async getExpectedSwapResult(fromTokenAddress, toTokenAddress, amount, decimals) {
111
- return this.dripApi.getExpectedSwapResult(fromTokenAddress, toTokenAddress, amount, decimals);
109
+ return this.perqApi.getExpectedSwapResult(fromTokenAddress, toTokenAddress, amount, decimals);
112
110
  }
113
111
  async getUserBoostedNfts(vaultAddress) {
114
112
  const userAddress = await this.signer.getAddress();
115
- return this.dripApi.getUserBoostedNfts(userAddress, vaultAddress);
113
+ return this.perqApi.getUserBoostedNfts(userAddress, vaultAddress);
116
114
  }
117
115
  async getRewardsPerHour(vaultAddress) {
118
116
  const userAddress = await this.signer.getAddress();
119
- return this.dripApi.fetchRewardsPerHour(userAddress, vaultAddress);
117
+ return this.perqApi.fetchRewardsPerHour(userAddress, vaultAddress);
120
118
  }
121
119
  async getRewards() {
122
120
  const userAddress = await this.signer.getAddress();
123
- const userRewards = this.dripApi.fetchUserRewards(userAddress);
121
+ const userRewards = this.perqApi.fetchUserRewards(userAddress);
124
122
  return userRewards;
125
123
  }
126
124
  async getMyPerqBalance() {
127
125
  const userAddress = await this.signer.getAddress();
128
- const myPerqBalance = this.dripApi.fetchMyPerqData(userAddress);
126
+ const myPerqBalance = this.perqApi.fetchMyPerqData(userAddress);
129
127
  return myPerqBalance;
130
128
  }
131
129
  async getUserVaultBalance(vaultAddress) {
@@ -136,8 +134,8 @@ class DripSdk {
136
134
  // Parallel fetch of vault, deposits and wnfts
137
135
  const [vault, userVaultBalance, userWnftsForVault] = await Promise.all([
138
136
  this.getVaultDetails(vaultAddress),
139
- this.dripApi.fetchUserVaultDeposits(userAddress, vaultAddress),
140
- this.dripApi.fetchAllUserWNFTForVault(vaultAddress, userAddress),
137
+ this.perqApi.fetchUserVaultDeposits(userAddress, vaultAddress),
138
+ this.perqApi.fetchAllUserWNFTForVault(vaultAddress, userAddress),
141
139
  ]);
142
140
  const decimals = await this.getERC20Precission(vault.depositToken.tokenAddress);
143
141
  // Calculate withdrawals
@@ -146,7 +144,7 @@ class DripSdk {
146
144
  for (const wnft of userWnftsForVault) {
147
145
  if (!wnft.isBurned && wnft.svtWithdrawn) {
148
146
  const currentBlockNumber = wnft.blockNumber - 1;
149
- const assetsPerSvtAtBlock = await this.dripApi.fetchAssetPerSvtAtBlock(vaultAddress, currentBlockNumber);
147
+ const assetsPerSvtAtBlock = await this.perqApi.fetchAssetPerSvtAtBlock(vaultAddress, currentBlockNumber);
150
148
  const estimatedValueOfNFT = ethers_1.BigNumber.from(ethers_1.ethers.utils.formatUnits(ethers_1.BigNumber.from(wnft.svtWithdrawn).mul(assetsPerSvtAtBlock), 36).split('.')[0]);
151
149
  if (wnft.isDHWFinished) {
152
150
  // Processed and claimable
@@ -204,7 +202,7 @@ class DripSdk {
204
202
  }
205
203
  }
206
204
  const fromToken = ethers_1.ethers.utils.parseUnits(amountWithDecimals.toString(), decimals);
207
- const swapInfo = await this.dripApi.getSwapInfo(fromTokenAddress, toTokenAddress, fromToken, userAddress);
205
+ const swapInfo = await this.perqApi.getSwapInfo(fromTokenAddress, toTokenAddress, fromToken, userAddress);
208
206
  const swapDepositBagStruct = {
209
207
  inTokens: [fromTokenAddress],
210
208
  inAmounts: [fromToken],
@@ -239,7 +237,7 @@ class DripSdk {
239
237
  if (!this.signer) {
240
238
  throw Error('No signer provided');
241
239
  }
242
- const wnfts = await this.dripApi.fetchEnrichedUserWNFTForVault(vaultAddress, userAddress);
240
+ const wnfts = await this.perqApi.fetchEnrichedUserWNFTForVault(vaultAddress, userAddress);
243
241
  //! Shares come as Strings instead of BigNumber from our Backend
244
242
  const nftIds = wnfts
245
243
  .filter((item) => !item.isBurned && ethers_1.BigNumber.from(item.shares).gt(ethers_1.BigNumber.from('0')) && item.isDHWFinished)
@@ -253,32 +251,32 @@ class DripSdk {
253
251
  }
254
252
  async getBeansBalance() {
255
253
  const userAddress = await this.signer.getAddress();
256
- return this.dripApi.fetchBeansBalance(userAddress);
254
+ return this.perqApi.fetchBeansBalance(userAddress);
257
255
  }
258
256
  async getBeansHistory() {
259
257
  const userAddress = await this.signer.getAddress();
260
- return this.dripApi.fetchBeansHistory(userAddress);
258
+ return this.perqApi.fetchBeansHistory(userAddress);
261
259
  }
262
- async recycleTokens(tokenAddress = this.dripConfig.dripTokenAddress, amountToRecycle, beneficiary = DripConfig_1.NULL_ADDRESS, price, deadline, signature) {
263
- if (this.dripConfig.dripTokenRecyclerAddress === DripConfig_1.NULL_ADDRESS) {
260
+ async recycleTokens(tokenAddress = this.perqConfig.perqTokenAddress, amountToRecycle, beneficiary = ethers_1.ethers.constants.AddressZero, price, deadline, signature) {
261
+ if (this.perqConfig.perqTokenRecyclerAddress === ethers_1.ethers.constants.AddressZero) {
264
262
  throw Error('Recycler contract address not defined');
265
263
  }
266
264
  const decimals = await this.getERC20Precission(tokenAddress);
267
265
  const amountWithDecimals = ethers_1.ethers.utils.parseUnits(amountToRecycle, decimals).toString();
268
- const recycleTx = await this.dripTokenRecyclerContract.recycle(amountWithDecimals, beneficiary, price, deadline, signature);
266
+ const recycleTx = await this.perqTokenRecyclerContract.recycle(amountWithDecimals, beneficiary, price, deadline, signature);
269
267
  const receipt = await recycleTx.wait();
270
268
  return receipt.transactionHash;
271
269
  }
272
270
  async swapAndRecycleETH(beneficiary, path, minAmountOutWithDecimals, amountOfEth, price, deadline, signature) {
273
- if (this.dripConfig.dripSwapAndRecyclerAddress === DripConfig_1.NULL_ADDRESS) {
271
+ if (this.perqConfig.perqSwapAndRecyclerAddress === ethers_1.ethers.constants.AddressZero) {
274
272
  throw Error('Recycler contract address not defined');
275
273
  }
276
- const swapAndRecycleTx = await this.dripSwapAndRecyclerContract.swapETHAndRecycle(beneficiary, path, minAmountOutWithDecimals, amountOfEth, price, deadline, signature);
274
+ const swapAndRecycleTx = await this.perqSwapAndRecyclerContract.swapETHAndRecycle(beneficiary, path, minAmountOutWithDecimals, amountOfEth, price, deadline, signature);
277
275
  const receipt = await swapAndRecycleTx.wait();
278
276
  return receipt.transactionHash;
279
277
  }
280
278
  async swapAndRecycleERC20(beneficiary, path, minAmountOutWithDecimals, amountInWithDecimals, price, deadline, signature) {
281
- if (this.dripConfig.dripSwapAndRecyclerAddress === DripConfig_1.NULL_ADDRESS) {
279
+ if (this.perqConfig.perqSwapAndRecyclerAddress === ethers_1.ethers.constants.AddressZero) {
282
280
  throw Error('Recycler contract address not defined');
283
281
  }
284
282
  console.log('swap and recycle ERC-20 with this: ', {
@@ -290,7 +288,7 @@ class DripSdk {
290
288
  deadline,
291
289
  signature,
292
290
  });
293
- const swapAndRecycleTx = await this.dripSwapAndRecyclerContract.swapAndRecycle(beneficiary, path, amountInWithDecimals, minAmountOutWithDecimals, price, deadline, signature);
291
+ const swapAndRecycleTx = await this.perqSwapAndRecyclerContract.swapAndRecycle(beneficiary, path, amountInWithDecimals, minAmountOutWithDecimals, price, deadline, signature);
294
292
  const receipt = await swapAndRecycleTx.wait();
295
293
  return receipt.transactionHash;
296
294
  }
@@ -299,52 +297,44 @@ class DripSdk {
299
297
  index,
300
298
  };
301
299
  const signedPayload = await this.signPayload(payload);
302
- return this.dripApi.upgradeLoyaltyCard(signedPayload);
300
+ return this.perqApi.upgradeLoyaltyCard(signedPayload);
303
301
  }
304
302
  async getOwnedLoyaltyCard() {
305
303
  const signerAddress = await this.signer.getAddress();
306
- return this.dripApi.fetchOwnedLoyaltyCard(signerAddress);
304
+ return this.perqApi.fetchOwnedLoyaltyCard(signerAddress);
307
305
  }
308
306
  async getAllLoyaltyCards() {
309
- return this.dripApi.fetchAllLoyaltyCards();
307
+ return this.perqApi.fetchAllLoyaltyCards();
310
308
  }
311
309
  async approveTokenForRecycler(tokenAddress, amount) {
312
310
  if (!this.signer) {
313
311
  throw Error('No signer provided');
314
312
  }
315
- if (this.dripConfig.dripTokenRecyclerAddress === DripConfig_1.NULL_ADDRESS) {
313
+ if (this.perqConfig.perqTokenRecyclerAddress === ethers_1.ethers.constants.AddressZero) {
316
314
  throw Error('Recycler contract address not defined');
317
315
  }
318
- return await this.approveToken(tokenAddress, amount, this.dripConfig.dripTokenRecyclerAddress);
316
+ return await this.approveToken(tokenAddress, amount, this.perqConfig.perqTokenRecyclerAddress);
319
317
  }
320
318
  async approveTokenForSwapAndRecycler(tokenAddress, amount) {
321
319
  if (!this.signer) {
322
320
  throw Error('No signer provided');
323
321
  }
324
- if (this.dripConfig.dripSwapAndRecyclerAddress === DripConfig_1.NULL_ADDRESS) {
322
+ if (this.perqConfig.perqSwapAndRecyclerAddress === ethers_1.ethers.constants.AddressZero) {
325
323
  throw Error('Recycler contract address not defined');
326
324
  }
327
- return await this.approveToken(tokenAddress, amount, this.dripConfig.dripSwapAndRecyclerAddress);
325
+ return await this.approveToken(tokenAddress, amount, this.perqConfig.perqSwapAndRecyclerAddress);
328
326
  }
329
327
  async approveTokenForSwapAndDeposit(tokenAddress, amount) {
330
- if (!this.signer) {
331
- throw Error('No signer provided');
332
- }
333
- const swapAndDepositContractAddress = await this.dripConfig.getSwapAndDepositContractAddress(this.signer);
334
- return await this.approveToken(tokenAddress, amount, swapAndDepositContractAddress);
328
+ return await this.approveToken(tokenAddress, amount, this.perqConfig.swapAndDepositContractAddress);
335
329
  }
336
330
  async approveTokenForDeposit(tokenAddress, amount) {
337
- if (!this.signer) {
338
- throw Error('No signer provided');
339
- }
340
- const smartVaultManagerAddress = await this.dripConfig.getSmartVaultManagerAddress(this.signer);
341
- return await this.approveToken(tokenAddress, amount, smartVaultManagerAddress);
331
+ return await this.approveToken(tokenAddress, amount, this.perqConfig.smartVaultManagerContractAddress);
342
332
  }
343
- getDripTokenContractAddress() {
344
- return this.dripConfig.dripTokenAddress;
333
+ getPerqTokenContractAddress() {
334
+ return this.perqConfig.perqTokenAddress;
345
335
  }
346
336
  async getSwapPerqForBeansInfo() {
347
- return this.dripApi.getSwapPerqForBeansInfo();
337
+ return this.perqApi.getSwapPerqForBeansInfo();
348
338
  }
349
339
  async transferErc20Token(tokenAddress, amount, receiver) {
350
340
  if (!this.signer) {
@@ -491,7 +481,7 @@ class DripSdk {
491
481
  };
492
482
  }
493
483
  async getEnrichedPayload(payload) {
494
- return this.dripApi.getNonceEnrichedPayload(payload.payload);
484
+ return this.perqApi.getNonceEnrichedPayload(payload.payload);
495
485
  }
496
486
  async generateRedeemBagStruct(vault, signerAddress, amountToWithdraw) {
497
487
  if (!this.spoolSdk) {
@@ -521,20 +511,10 @@ class DripSdk {
521
511
  return decimals;
522
512
  }
523
513
  async getTokenAllowanceForDeposit(tokenAddress) {
524
- if (!this.signer) {
525
- throw Error('No signer provided');
526
- }
527
- const smartVaultManagerAddress = await this.dripConfig.getSmartVaultManagerAddress(this.signer);
528
- const allowance = await this.getERC20TokenAllowance(smartVaultManagerAddress, tokenAddress);
529
- return allowance;
514
+ return await this.getERC20TokenAllowance(this.perqConfig.smartVaultManagerContractAddress, tokenAddress);
530
515
  }
531
516
  async getTokenAllowanceForSwapAndDeposit(tokenAddress) {
532
- if (!this.signer) {
533
- throw Error('No signer provided');
534
- }
535
- const swapAndDepositAddress = await this.dripConfig.getSwapAndDepositContractAddress(this.signer);
536
- const allowance = await this.getERC20TokenAllowance(swapAndDepositAddress, tokenAddress);
537
- return allowance;
517
+ return await this.getERC20TokenAllowance(this.perqConfig.swapAndDepositContractAddress, tokenAddress);
538
518
  }
539
519
  async getERC20TokenAllowance(spender, tokenAddress) {
540
520
  if (!this.signer) {
@@ -556,4 +536,4 @@ class DripSdk {
556
536
  return receipt.transactionHash;
557
537
  }
558
538
  }
559
- exports.default = DripSdk;
539
+ exports.default = PerqSdk;
@@ -1,5 +1,5 @@
1
1
  import { ethers } from 'ethers';
2
- export default abstract class BaseDripContract {
2
+ export default abstract class BasePerqContract {
3
3
  protected contract: ethers.Contract;
4
4
  constructor(address: string, abi: ethers.ContractInterface, signer?: ethers.Signer);
5
5
  updateSigner(newSigner: ethers.Signer): void;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const ethers_1 = require("ethers");
4
- class BaseDripContract {
4
+ class BasePerqContract {
5
5
  contract;
6
6
  constructor(address, abi, signer) {
7
7
  this.contract = new ethers_1.ethers.Contract(address, abi, signer);
@@ -13,4 +13,4 @@ class BaseDripContract {
13
13
  return this.contract.address;
14
14
  }
15
15
  }
16
- exports.default = BaseDripContract;
16
+ exports.default = BasePerqContract;
@@ -6,18 +6,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const ethers_1 = require("ethers");
7
7
  const PerqSwapAndRecyclerAbi_json_1 = __importDefault(require("../abi/PerqSwapAndRecyclerAbi.json"));
8
8
  const BasePerqContract_1 = __importDefault(require("./BasePerqContract"));
9
- const DripConfig_1 = require("../DripConfig");
10
9
  class PerqSwapAndRecyclerContract extends BasePerqContract_1.default {
11
10
  constructor(address, signer) {
12
11
  super(address, new ethers_1.ethers.utils.Interface(PerqSwapAndRecyclerAbi_json_1.default), signer);
13
12
  }
14
- async swapAndRecycle(beneficiary = DripConfig_1.NULL_ADDRESS, path, amountInWithDecimals, minAmountOutWithDecimals, price, deadline, signature) {
13
+ async swapAndRecycle(beneficiary = ethers_1.ethers.constants.AddressZero, path, amountInWithDecimals, minAmountOutWithDecimals, price, deadline, signature) {
15
14
  if (!this.contract.signer) {
16
15
  throw Error('No signer provided');
17
16
  }
18
17
  return await this.contract.swapAndRecycle(beneficiary, path, amountInWithDecimals, minAmountOutWithDecimals, price, deadline, signature);
19
18
  }
20
- async swapETHAndRecycle(beneficiary = DripConfig_1.NULL_ADDRESS, path, minAmountOutWithDecimals, amountInEth, price, deadline, signature) {
19
+ async swapETHAndRecycle(beneficiary = ethers_1.ethers.constants.AddressZero, path, minAmountOutWithDecimals, amountInEth, price, deadline, signature) {
21
20
  if (!this.contract.signer) {
22
21
  throw Error('No signer provided');
23
22
  }
@@ -1,6 +1,6 @@
1
1
  import { ContractTransaction, ethers } from 'ethers';
2
- import BaseDripContract from './BasePerqContract';
3
- export default class DripTokenRecyclerContract extends BaseDripContract {
2
+ import BasePerqContract from './BasePerqContract';
3
+ export default class PerqTokenRecyclerContract extends BasePerqContract {
4
4
  constructor(address: string, signer?: ethers.Signer);
5
5
  recycle(amountToRecycle: string, beneficiary: string | undefined, price: string, deadline: string, signature: string): Promise<ContractTransaction>;
6
6
  }
@@ -6,16 +6,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const ethers_1 = require("ethers");
7
7
  const TokenRecyclerAbi_json_1 = __importDefault(require("../abi/TokenRecyclerAbi.json"));
8
8
  const BasePerqContract_1 = __importDefault(require("./BasePerqContract"));
9
- const DripConfig_1 = require("../DripConfig");
10
- class DripTokenRecyclerContract extends BasePerqContract_1.default {
9
+ class PerqTokenRecyclerContract extends BasePerqContract_1.default {
11
10
  constructor(address, signer) {
12
11
  super(address, new ethers_1.ethers.utils.Interface(TokenRecyclerAbi_json_1.default), signer);
13
12
  }
14
- async recycle(amountToRecycle, beneficiary = DripConfig_1.NULL_ADDRESS, price, deadline, signature) {
13
+ async recycle(amountToRecycle, beneficiary = ethers_1.ethers.constants.AddressZero, price, deadline, signature) {
15
14
  if (!this.contract.signer) {
16
15
  throw Error('No signer provided');
17
16
  }
18
17
  return await this.contract.recycle(amountToRecycle, beneficiary, price, deadline, signature);
19
18
  }
20
19
  }
21
- exports.default = DripTokenRecyclerContract;
20
+ exports.default = PerqTokenRecyclerContract;
@@ -3,11 +3,4 @@ import PerqSwapAndRecyclerContract from './PerqSwapAndRecyclerContract';
3
3
  import PerqTokenRecyclerContract from './PerqTokenRecyclerContract';
4
4
  import PerqTokenContract from './PerqTokenContract';
5
5
  import PerqVestingContract from './PerqVestingContract';
6
- declare const _default: {
7
- BasePerqContract: typeof BasePerqContract;
8
- PerqSwapAndRecyclerContract: typeof PerqSwapAndRecyclerContract;
9
- PerqTokenRecyclerContract: typeof PerqTokenRecyclerContract;
10
- PerqTokenContract: typeof PerqTokenContract;
11
- PerqVestingContract: typeof PerqVestingContract;
12
- };
13
- export default _default;
6
+ export { BasePerqContract, PerqSwapAndRecyclerContract, PerqTokenRecyclerContract, PerqTokenContract, PerqVestingContract, };
@@ -3,15 +3,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.PerqVestingContract = exports.PerqTokenContract = exports.PerqTokenRecyclerContract = exports.PerqSwapAndRecyclerContract = exports.BasePerqContract = void 0;
6
7
  const BasePerqContract_1 = __importDefault(require("./BasePerqContract"));
8
+ exports.BasePerqContract = BasePerqContract_1.default;
7
9
  const PerqSwapAndRecyclerContract_1 = __importDefault(require("./PerqSwapAndRecyclerContract"));
10
+ exports.PerqSwapAndRecyclerContract = PerqSwapAndRecyclerContract_1.default;
8
11
  const PerqTokenRecyclerContract_1 = __importDefault(require("./PerqTokenRecyclerContract"));
12
+ exports.PerqTokenRecyclerContract = PerqTokenRecyclerContract_1.default;
9
13
  const PerqTokenContract_1 = __importDefault(require("./PerqTokenContract"));
14
+ exports.PerqTokenContract = PerqTokenContract_1.default;
10
15
  const PerqVestingContract_1 = __importDefault(require("./PerqVestingContract"));
11
- exports.default = {
12
- BasePerqContract: BasePerqContract_1.default,
13
- PerqSwapAndRecyclerContract: PerqSwapAndRecyclerContract_1.default,
14
- PerqTokenRecyclerContract: PerqTokenRecyclerContract_1.default,
15
- PerqTokenContract: PerqTokenContract_1.default,
16
- PerqVestingContract: PerqVestingContract_1.default,
17
- };
16
+ exports.PerqVestingContract = PerqVestingContract_1.default;
package/dist/index.d.ts CHANGED
@@ -1,14 +1,5 @@
1
- import DripSdk from './DripSdk';
2
- import DRIP_SWAP_AND_RECYCLER_ABI from './abi/PerqSwapAndRecyclerAbi.json';
3
- import WETH_TOKEN_ABI from './abi/WethTokenAbi.json';
4
- import DRIP_TOKEN_ABI from './abi/PerqTokenAbi.json';
5
- import TOKEN_RECYCLER_ABI from './abi/TokenRecyclerAbi.json';
6
- import PERQ_VESTING_ABI from './abi/PerqVestingAbi.json';
1
+ import PerqSdk from './PerqSdk';
7
2
  import abi from './abi';
3
+ import { DEVELOPMENT, PRODUCTION } from './types/PerqConfig';
8
4
  export * from './types';
9
- export { DRIP_SWAP_AND_RECYCLER_ABI, // TODO REMOVE THIS LINE
10
- WETH_TOKEN_ABI, // TODO REMOVE THIS LINE
11
- DRIP_TOKEN_ABI, // TODO REMOVE THIS LINE
12
- TOKEN_RECYCLER_ABI, // TODO REMOVE THIS LINE
13
- PERQ_VESTING_ABI, // TODO REMOVE THIS LINE
14
- DripSdk, abi, };
5
+ export { PerqSdk, DEVELOPMENT, PRODUCTION, abi, };
package/dist/index.js CHANGED
@@ -17,20 +17,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
17
17
  return (mod && mod.__esModule) ? mod : { "default": mod };
18
18
  };
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.abi = exports.DripSdk = exports.PERQ_VESTING_ABI = exports.TOKEN_RECYCLER_ABI = exports.DRIP_TOKEN_ABI = exports.WETH_TOKEN_ABI = exports.DRIP_SWAP_AND_RECYCLER_ABI = void 0;
21
- const DripSdk_1 = __importDefault(require("./DripSdk"));
22
- exports.DripSdk = DripSdk_1.default;
23
- const PerqSwapAndRecyclerAbi_json_1 = __importDefault(require("./abi/PerqSwapAndRecyclerAbi.json")); // TODO REMOVE THIS LINE
24
- exports.DRIP_SWAP_AND_RECYCLER_ABI = PerqSwapAndRecyclerAbi_json_1.default;
25
- const WethTokenAbi_json_1 = __importDefault(require("./abi/WethTokenAbi.json")); // TODO REMOVE THIS LINE
26
- exports.WETH_TOKEN_ABI = WethTokenAbi_json_1.default;
27
- const PerqTokenAbi_json_1 = __importDefault(require("./abi/PerqTokenAbi.json")); // TODO REMOVE THIS LINE
28
- exports.DRIP_TOKEN_ABI = PerqTokenAbi_json_1.default;
29
- const TokenRecyclerAbi_json_1 = __importDefault(require("./abi/TokenRecyclerAbi.json")); // TODO REMOVE THIS LINE
30
- exports.TOKEN_RECYCLER_ABI = TokenRecyclerAbi_json_1.default;
31
- const PerqVestingAbi_json_1 = __importDefault(require("./abi/PerqVestingAbi.json")); // TODO REMOVE THIS LINE
32
- exports.PERQ_VESTING_ABI = PerqVestingAbi_json_1.default;
33
- // FROM NOW ON, THIS IS THE NEW STRUCTURE:
20
+ exports.abi = exports.PRODUCTION = exports.DEVELOPMENT = exports.PerqSdk = void 0;
21
+ const PerqSdk_1 = __importDefault(require("./PerqSdk"));
22
+ exports.PerqSdk = PerqSdk_1.default;
34
23
  const abi_1 = __importDefault(require("./abi"));
35
24
  exports.abi = abi_1.default;
25
+ const PerqConfig_1 = require("./types/PerqConfig");
26
+ Object.defineProperty(exports, "DEVELOPMENT", { enumerable: true, get: function () { return PerqConfig_1.DEVELOPMENT; } });
27
+ Object.defineProperty(exports, "PRODUCTION", { enumerable: true, get: function () { return PerqConfig_1.PRODUCTION; } });
36
28
  __exportStar(require("./types"), exports);
@@ -38,6 +38,7 @@ type DeployedProject = {
38
38
  yelayVersion: YelayVersion;
39
39
  bannerImage?: string;
40
40
  rewardImage?: string;
41
+ rewardTooltipName?: string;
41
42
  };
42
43
  export default DeployedProject;
43
44
  export type ProjectBacker = {
@@ -0,0 +1,13 @@
1
+ import { SDKConfig } from '@spool.fi/spool-v2-sdk';
2
+ export type PerqConfig = {
3
+ route: string;
4
+ spoolSdkConfig: SDKConfig;
5
+ perqTokenAddress: string;
6
+ perqTokenRecyclerAddress: string;
7
+ perqSwapAndRecyclerAddress: string;
8
+ perqVestingAddress: string;
9
+ swapAndDepositContractAddress: string;
10
+ smartVaultManagerContractAddress: string;
11
+ };
12
+ export declare const PRODUCTION: PerqConfig;
13
+ export declare const DEVELOPMENT: PerqConfig;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEVELOPMENT = exports.PRODUCTION = void 0;
4
+ const spool_v2_sdk_1 = require("@spool.fi/spool-v2-sdk");
5
+ exports.PRODUCTION = {
6
+ route: 'https://perq.finance',
7
+ spoolSdkConfig: (0, spool_v2_sdk_1.getMainnetConfig)('https://subgraph.satsuma-prod.com/49eb322da234/solidant/spool-v2/api'),
8
+ perqTokenAddress: '0x2a414884a549ef5716bc1a4e648d3dc03f08b2cf',
9
+ perqTokenRecyclerAddress: '0x2FdcdB17799557Dce6f26921f12B7FA1DbcD79FA',
10
+ perqSwapAndRecyclerAddress: '0x15ED53964E6a5EcbEBAb80A0Fc68c2297b0eaA8D',
11
+ perqVestingAddress: '0x5e19C155C30bDEB83FCFE20a3b6f6Eda34B746c5',
12
+ swapAndDepositContractAddress: '0xd8534197bd587f8226d12e0c864ef2cae6f82f5c',
13
+ smartVaultManagerContractAddress: '0x23daf34e2b9af02a74dc19cb52af727b19403874',
14
+ };
15
+ exports.DEVELOPMENT = {
16
+ route: 'https://dev.perq.finance',
17
+ spoolSdkConfig: (0, spool_v2_sdk_1.getSepoliaConfig)('https://subgraph.satsuma-prod.com/49eb322da234/solidant/spool-v2-sepolia/api'),
18
+ perqTokenAddress: '0x707B4Cc05645713d8Ea04FBC7192A0f2c1503d6E',
19
+ perqTokenRecyclerAddress: '0x07F2264E199D62afe07E8288eC9D36d155fc3f24',
20
+ perqSwapAndRecyclerAddress: '0xA4ed357FF233731860Ec8D0446FD95756d564014',
21
+ perqVestingAddress: '0x1d3B9E32a7139718f94BE32c797682fFf2D1bE60',
22
+ swapAndDepositContractAddress: '0x5fb08e00de169f041711206a0995410884080177',
23
+ smartVaultManagerContractAddress: '0x2638d6c0b4ef6dee04050fa0b07ca62500435747',
24
+ };
@@ -1,7 +1,6 @@
1
1
  import Asset from './Asset';
2
2
  import BeanEntry from './BeanEntry';
3
3
  import BeansBalance from './BeansBalance';
4
- import Chain from './Chain';
5
4
  import DeployedProject, { ProjectBacker } from './DeployedProject';
6
5
  import DeployedVault from './DeployedVault';
7
6
  import DepositToken from './DepositToken';
@@ -24,4 +23,4 @@ import VaultStats from './VaultStats';
24
23
  import VaultType from './VaultType';
25
24
  import VestingInfo from './VestingInfo';
26
25
  import YelayVersion from './YelayVersion';
27
- export { Asset, BasePayload, BeanEntry, BeansBalance, Chain, DeployedProject, DeployedVault, DepositToken, ELoyaltyCardTier, LoyaltyCard, MyPerqData, NFTBoost, NonceEnrichedPayload, NonceEnrichedSignedPayload, PerqToBeansSwapInfo, ProjectBacker, QLFastRedeem, RewardType, Strategy, StretchGoal, SwapInfo, UpgradeLoyaltyCardPayload, UserRewards, UserVaultBalance, Vault, VaultReward, VaultStats, VaultType, VestingInfo, YelayVersion, };
26
+ export { Asset, BasePayload, BeanEntry, BeansBalance, DeployedProject, DeployedVault, DepositToken, ELoyaltyCardTier, LoyaltyCard, MyPerqData, NFTBoost, NonceEnrichedPayload, NonceEnrichedSignedPayload, PerqToBeansSwapInfo, ProjectBacker, QLFastRedeem, RewardType, Strategy, StretchGoal, SwapInfo, UpgradeLoyaltyCardPayload, UserRewards, UserVaultBalance, Vault, VaultReward, VaultStats, VaultType, VestingInfo, YelayVersion, };
@@ -3,8 +3,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ELoyaltyCardTier = exports.Chain = void 0;
7
- const Chain_1 = __importDefault(require("./Chain"));
8
- exports.Chain = Chain_1.default;
6
+ exports.ELoyaltyCardTier = void 0;
9
7
  const ELoyaltyCardTier_1 = __importDefault(require("./ELoyaltyCardTier"));
10
8
  exports.ELoyaltyCardTier = ELoyaltyCardTier_1.default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dripfi/drip-sdk",
3
- "version": "1.3.12",
3
+ "version": "1.4.1",
4
4
  "description": "Drip SDK",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,18 +0,0 @@
1
- import { Signer } from 'ethers';
2
- import { SDKConfig } from '@spool.fi/spool-v2-sdk';
3
- import { Chain } from './types';
4
- export declare const NULL_ADDRESS = "0x0000000000000000000000000000000000000000";
5
- export declare const PERQ_TOKEN_DECIMALS = 18;
6
- export declare class DripConfig {
7
- internalConfig: SDKConfig;
8
- dripRoute: string;
9
- swapAndDepositContractAddress: string | undefined;
10
- smartVaultManagerAddress: string | undefined;
11
- dripTokenAddress: string;
12
- dripTokenRecyclerAddress: string;
13
- dripSwapAndRecyclerAddress: string;
14
- perqVestingAddress: string;
15
- constructor(chain: Chain, dripRoute?: string);
16
- getSwapAndDepositContractAddress(signer: Signer): Promise<string>;
17
- getSmartVaultManagerAddress(signer: Signer): Promise<string>;
18
- }
@@ -1,70 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DripConfig = exports.PERQ_TOKEN_DECIMALS = exports.NULL_ADDRESS = void 0;
4
- const spool_v2_sdk_1 = require("@spool.fi/spool-v2-sdk");
5
- const types_1 = require("./types");
6
- exports.NULL_ADDRESS = '0x0000000000000000000000000000000000000000';
7
- exports.PERQ_TOKEN_DECIMALS = 18;
8
- const SUBGRAPH_URL_SEPOLIA = 'https://subgraph.satsuma-prod.com/49eb322da234/solidant/spool-v2-sepolia/api';
9
- const RECYCLER_ADDRESS_SEPOLIA = '0x07F2264E199D62afe07E8288eC9D36d155fc3f24';
10
- const SWAP_AND_RECYCLER_ADDRESS_SEPOLIA = '0xA4ed357FF233731860Ec8D0446FD95756d564014';
11
- const VESTING_ADDRESS_SEPOLIA = '0x1d3B9E32a7139718f94BE32c797682fFf2D1bE60';
12
- const DRIP_TOKEN_ADDRESS_SEPOLIA = '0x707B4Cc05645713d8Ea04FBC7192A0f2c1503d6E';
13
- const DEV_BACKEND_ROUTE = 'https://dev.perq.finance';
14
- const SUBGRAPH_URL_MAINNET = 'https://subgraph.satsuma-prod.com/49eb322da234/solidant/spool-v2/api';
15
- const RECYCLER_ADDRESS_MAINNET = '0x2FdcdB17799557Dce6f26921f12B7FA1DbcD79FA';
16
- const SWAP_AND_RECYCLER_ADDRESS_MAINNET = '0x15ED53964E6a5EcbEBAb80A0Fc68c2297b0eaA8D';
17
- const VESTING_ADDRESS_MAINNET = '0x5e19C155C30bDEB83FCFE20a3b6f6Eda34B746c5';
18
- const DRIP_TOKEN_ADDRESS_MAINNET = '0x2a414884a549ef5716bc1a4e648d3dc03f08b2cf';
19
- const PROD_BACKEND_ROUTE = 'https://perq.finance';
20
- class DripConfig {
21
- internalConfig;
22
- dripRoute;
23
- swapAndDepositContractAddress;
24
- smartVaultManagerAddress;
25
- dripTokenAddress;
26
- dripTokenRecyclerAddress;
27
- dripSwapAndRecyclerAddress;
28
- perqVestingAddress;
29
- constructor(chain, dripRoute) {
30
- switch (chain) {
31
- case types_1.Chain.MAINNET:
32
- this.internalConfig = (0, spool_v2_sdk_1.getMainnetConfig)(SUBGRAPH_URL_MAINNET);
33
- this.dripRoute = dripRoute !== undefined ? dripRoute : PROD_BACKEND_ROUTE;
34
- this.dripTokenAddress = DRIP_TOKEN_ADDRESS_MAINNET;
35
- this.dripTokenRecyclerAddress = RECYCLER_ADDRESS_MAINNET;
36
- this.dripSwapAndRecyclerAddress = SWAP_AND_RECYCLER_ADDRESS_MAINNET;
37
- this.perqVestingAddress = VESTING_ADDRESS_MAINNET;
38
- break;
39
- case types_1.Chain.SEPOLIA:
40
- this.internalConfig = (0, spool_v2_sdk_1.getSepoliaConfig)(SUBGRAPH_URL_SEPOLIA);
41
- this.dripRoute = dripRoute !== undefined ? dripRoute : DEV_BACKEND_ROUTE;
42
- this.dripTokenAddress = DRIP_TOKEN_ADDRESS_SEPOLIA;
43
- this.dripTokenRecyclerAddress = RECYCLER_ADDRESS_SEPOLIA;
44
- this.dripSwapAndRecyclerAddress = SWAP_AND_RECYCLER_ADDRESS_SEPOLIA;
45
- this.perqVestingAddress = VESTING_ADDRESS_SEPOLIA;
46
- break;
47
- }
48
- }
49
- async getSwapAndDepositContractAddress(signer) {
50
- if (!signer) {
51
- throw Error('No signer provided');
52
- }
53
- if (!this.swapAndDepositContractAddress) {
54
- const contract = await this.internalConfig.getChainAddresses(signer);
55
- this.swapAndDepositContractAddress = contract.IDepositSwap;
56
- }
57
- return this.swapAndDepositContractAddress;
58
- }
59
- async getSmartVaultManagerAddress(signer) {
60
- if (!signer) {
61
- throw Error('No signer provided');
62
- }
63
- if (!this.smartVaultManagerAddress) {
64
- const contract = await this.internalConfig.getChainAddresses(signer);
65
- this.smartVaultManagerAddress = contract.ISmartVaultManager;
66
- }
67
- return this.smartVaultManagerAddress;
68
- }
69
- }
70
- exports.DripConfig = DripConfig;
@@ -1,4 +0,0 @@
1
- export default class PerqApi {
2
- route: string;
3
- constructor(route: string);
4
- }
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- class PerqApi {
4
- route;
5
- constructor(route) {
6
- this.route = route;
7
- }
8
- }
9
- exports.default = PerqApi;
@@ -1,5 +0,0 @@
1
- import { Chain } from '../index';
2
- export declare class PerqConfig {
3
- perqRoute: string;
4
- constructor(chain: Chain, perqRoute?: string);
5
- }
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PerqConfig = void 0;
4
- const index_1 = require("../index");
5
- const PROD_BACKEND_ROUTE = 'https://perq.finance';
6
- const DEV_BACKEND_ROUTE = 'https://dev.perq.finance';
7
- class PerqConfig {
8
- perqRoute;
9
- constructor(chain, perqRoute) {
10
- switch (chain) {
11
- case index_1.Chain.MAINNET:
12
- this.perqRoute = perqRoute !== undefined ? perqRoute : PROD_BACKEND_ROUTE;
13
- break;
14
- case index_1.Chain.SEPOLIA:
15
- this.perqRoute = perqRoute !== undefined ? perqRoute : DEV_BACKEND_ROUTE;
16
- break;
17
- }
18
- }
19
- }
20
- exports.PerqConfig = PerqConfig;
@@ -1,9 +0,0 @@
1
- import { Signer } from 'ethers';
2
- import { Chain } from '../index';
3
- export default class PerqSdk {
4
- private perqApi;
5
- private perqConfig;
6
- private signer?;
7
- private yelayLiteSdk;
8
- constructor(chain: Chain, signer?: Signer, perqRoute?: string);
9
- }
@@ -1,26 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const sdk_1 = require("@yelay-lite/sdk");
7
- const PerqApi_1 = __importDefault(require("./PerqApi"));
8
- const PerqConfig_1 = require("./PerqConfig");
9
- const YELAY_LITE_BACKEND_URL = 'http://134.209.255.15:3000';
10
- const BASE_RPC_URL = 'https://sly-virulent-pallet.base-mainnet.quiknode.pro/22e8158f3fe6a39562769d29f885d4102f08715a/';
11
- class PerqSdk {
12
- perqApi;
13
- perqConfig;
14
- signer;
15
- yelayLiteSdk;
16
- constructor(chain, signer, perqRoute) {
17
- this.signer = signer;
18
- this.perqConfig = new PerqConfig_1.PerqConfig(chain, perqRoute);
19
- this.perqApi = new PerqApi_1.default(this.perqConfig.perqRoute);
20
- this.yelayLiteSdk = new sdk_1.YelayLiteSdk({
21
- backendUrl: YELAY_LITE_BACKEND_URL,
22
- rpcUrl: BASE_RPC_URL,
23
- });
24
- }
25
- }
26
- exports.default = PerqSdk;
@@ -1,5 +0,0 @@
1
- declare enum Chain {
2
- MAINNET = "mainnet",
3
- SEPOLIA = "sepolia"
4
- }
5
- export default Chain;
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var Chain;
4
- (function (Chain) {
5
- Chain["MAINNET"] = "mainnet";
6
- Chain["SEPOLIA"] = "sepolia";
7
- })(Chain || (Chain = {}));
8
- exports.default = Chain;