@dripfi/drip-sdk 1.0.9 → 1.0.11

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/.eslintrc.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "env": {
3
+ "browser": true,
4
+ "es2021": true
5
+ },
6
+ "extends": [
7
+ "eslint:recommended",
8
+ "plugin:@typescript-eslint/recommended"
9
+ ],
10
+ "parser": "@typescript-eslint/parser",
11
+ "parserOptions": {
12
+ "ecmaVersion": "latest",
13
+ "sourceType": "module"
14
+ },
15
+ "plugins": [
16
+ "@typescript-eslint"
17
+ ],
18
+ "rules": {
19
+ "quotes": [
20
+ "error",
21
+ "single"
22
+ ],
23
+ "semi": "off",
24
+ "@typescript-eslint/semi": "error",
25
+ "@typescript-eslint/no-explicit-any": "off",
26
+ "curly": "error"
27
+ },
28
+ "overrides": [
29
+ {
30
+ "files": [
31
+ "tests/**/*"
32
+ ],
33
+ "env": {
34
+ "jest": true
35
+ }
36
+ }
37
+ ]
38
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "editor.defaultFormatter": "dbaeumer.vscode-eslint",
3
+ "editor.codeActionsOnSave": {
4
+ "source.fixAll.eslint": "explicit"
5
+ },
6
+ "editor.formatOnSave": true,
7
+ "[javascript]": {
8
+ "editor.defaultFormatter": "dbaeumer.vscode-eslint"
9
+ },
10
+ "[typescript]": {
11
+ "editor.defaultFormatter": "dbaeumer.vscode-eslint"
12
+ },
13
+ "eslint.workingDirectories": [
14
+ {"directory": "./src", "changeProcessCWD": true},
15
+ ]
16
+ }
17
+
package/README.md CHANGED
@@ -4,7 +4,14 @@
4
4
 
5
5
  The Drip SDK is a TypeScript library designed to interact with the Drip protocol. It provides methods to retrieve information about Drip Vaults, manage user authentication, and fetch user balances.
6
6
 
7
- ## Installation
7
+ ## Table of Contents
8
+ - [Installation](#installation)
9
+ - [Usage](#usage)
10
+ - [Methods](#methods)
11
+ - [Examples](#examples)
12
+ - [Types](#types)
13
+
14
+ # Installation
8
15
 
9
16
  To use the Drip SDK in your project, you can install it via npm or yarn:
10
17
 
@@ -12,7 +19,7 @@ To use the Drip SDK in your project, you can install it via npm or yarn:
12
19
  npm i @dripfi/drip-sdk
13
20
  ```
14
21
 
15
- ## Usage
22
+ # Usage
16
23
 
17
24
  ```typescript
18
25
  import DripSdk from '@drip/sdk'
@@ -32,44 +39,146 @@ const signer: ethers.Signer = /* your Signer instance */;
32
39
  const dripSdk = new DripSdk(dripConfig, signer);
33
40
  ```
34
41
 
35
- ## Methods
42
+ # Methods
43
+
44
+ | Name | Requires authentication | Description |
45
+ | ------ | ------ | ----------- |
46
+ | `getAllVaults(): Promise<Vault[]>`| No | Fetches details of all Drip Vaults. |
47
+ | `getVaultDetails(vaultAddress: string): Promise<Vault>` | NO | Fetches details of a specific Drip Vault identified by its address. |
48
+ | `authenticate(): Promise<boolean>` | NO | Initiates the user authentication process and returns a boolean indicating success. |
49
+ | `isUserAuthenticated(): Promise<AuthenticationStatus>` | NO | Checks if the user is authenticated and returns authentication status along with relevant information. |
50
+ | `updateSigner(newSigner: Signer): Promise<void>`| NO | Updates the signer for the SDK instance. |
51
+ | `getUserBalance(vault: Vault): Promise<UserBalance>` | YES | Fetches the user's balance for a specific Drip Vault. |
52
+ | `deposit(tokenAddress: string, vaultAddress: string, amount: string): Promise<string>` | NO | The deposit function allows you to deposit tokens into a specific vault. Returns txHash. |
53
+ | `swapAndDeposit(fromTokenAddress: string, toTokenAddress: string, fromTokenAmount: string, vaultAddress: string, ethAmount?: string): Promise<string>` | YES | The swapAndDeposit function allows you to deposit a different token or ether and it will take care of swapping to the correct token before making the deposit. Returns txHash. |
54
+ | `withdraw(vault: Vault, amountToWithdraw?: string): Promise<string>` | YES | Withdraws tokens from a vault. After withdrawing, you must wait for the withdrawal to be processed by the 'DoHardWork' function, and then you can claim those tokens using claimWithdraws(). Returns txHash. |
55
+ | `claimWithdraws(vaultAddress: string): Promise<string>` | YES | After the withdrawal has been processed by the 'DoHardWork' function, the 'claimWithdraws' function transfers the withdrawn tokens to their personal account. Returns txHash. |
56
+ | `fastWithdraw(vault: Vault, amountToWithdraw?: string): Promise<string>` | YES | For users who prefer not to wait for withdrawals to be processed, there is a Fast Withdrawal method. While this approach is more gas-intensive, as users bear the cost of executing the withdrawal process themselves, it allows for instant access to the withdrawn tokens. When utilizing Fast Withdrawal, users immediately receive the tokens, eliminating the need to initiate the 'claimWithdrawal' process separately. Returns txHash. |
57
+
58
+
59
+ > [!IMPORTANT]
60
+ > **You must authenticate once for every wallet you want to use**
36
61
 
37
- - `getAllVaults(): Promise<Vault[]>`
38
- Fetches details of all Drip Vaults.
62
+ ---
39
63
 
40
- - `getVaultDetails(vaultAddress: string): Promise<Vault> `
41
- Fetches details of a specific Drip Vault identified by its address.
64
+ # Examples
42
65
 
43
- - `authenticate(): Promise<boolean>`
44
- Initiates the user authentication process and returns a boolean indicating success.
66
+ ### `deposit(tokenAddress: string, vaultAddress: string, amount: string): Promise<string>`
67
+
68
+ I want to deposit 100 USDC in a USDC vault:
69
+ ```typescript
70
+ USDC_TOKEN_ADDRESS = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" --> USDC contract address in tenderly environment
71
+ ```
72
+ you can get vault token address from the vault.depositToken.tokenAddress
45
73
 
46
- - `isUserAuthenticated(): Promise<AuthenticationStatus>`
47
- Checks if the user is authenticated and returns authentication status along with relevant information.
74
+ ```typescript
75
+ VAULT_ADDRESS = "0x...c167" --> Check vaults returned by getAllVaults() and get vault address like: vault.vaultAddress
48
76
 
49
- - `updateSigner(newSigner: Signer): Promise<void>`
50
- Updates the signer for the SDK instance.
77
+ const txHash = await deposit(USDC_TOKEN_ADDRESS, VAULT_ADDRESS, '100')
78
+ ```
51
79
 
52
- - `getUserBalance(vault: Vault): Promise<UserBalance>`
53
- Fetches the user's balance for a specific Drip Vault.
80
+ > [!NOTE]
81
+ > User will be prompted with 2 tx:
82
+ > 1st to approve token usage
83
+ > 2nd to deposit the funds in the vault
54
84
 
55
- - `deposit(tokenAddress: string, vaultAddress: string, amount: string): Promise<void>`
56
- The deposit function allows you to deposit tokens into a specific vault.
85
+ > [!NOTE]
86
+ > Allowance is calculated by the deposit method, based on the current allowance and the required
57
87
 
58
- - `swapAndDeposit(fromTokenAddress: string, toTokenAddress: string, fromTokenAmount: string, vaultAddress: string, ethAmount?: string): Promise<void>`
59
- The swapAndDeposit function allows you to deposit a different token or ether and it will take care of swapping to the correct token before making the deposit
88
+ > [!IMPORTANT]
89
+ > Amount should be formatted, not parsed. In the example we want to deposit 100 USDC so we just input that value instead of adding 6 decimals (100000000)
60
90
 
61
- - `withdraw(vault: Vault, amountToWithdraw?: string): Promise<void>`
62
- Withdraws tokens from a vault. After withdrawing, you must wait for the withdrawal to be processed by the 'DoHardWork' function, and then you can claim those tokens using claimWithdraws()
91
+ ---
63
92
 
64
- - `claimWithdraws(vaultAddress: string): Promise<void>`
65
- After the withdrawal has been processed by the 'DoHardWork' function, the 'claimWithdraws' function transfers the withdrawn tokens to their personal account.
93
+ ### `swapAndDeposit(fromTokenAddress: string, toTokenAddress: string, fromTokenAmount: string, vaultAddress: string, ethAmount?: string): Promise<string>`
66
94
 
67
- - `fastWithdraw(vault: Vault, amountToWithdraw?: string): Promise<void>`
68
- For users who prefer not to wait for withdrawals to be processed, there is a Fast Withdrawal method. While this approach is more gas-intensive, as users bear the cost of executing the withdrawal process themselves, it allows for instant access to the withdrawn tokens. When utilizing Fast Withdrawal, users immediately receive the tokens, eliminating the need to initiate the 'claimWithdrawal' process separately.
95
+ I want to deposit 1.5ETH in a WETH vault:
69
96
 
70
- ## Types
97
+ ```typescript
98
+ WETH_TOKEN_ADDRESS = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" --> WETH contract address in tenderly environment
71
99
 
100
+ const txHash = await swapAndDeposit(WETH_TOKEN_ADDRESS, WETH_TOKEN_ADDRESS, '0', vaultAddress, '1.5')
72
101
  ```
102
+ you can get vault token address from the vault.depositToken.tokenAddress
103
+
104
+ > [!IMPORTANT]
105
+ > ethAmount and fromTokenAmount should be formatted, not parsed. In the example we want to deposit 1.5 WETH so we just input that value instead of adding 18 decimals (1500000000000000000)
106
+
107
+ ---
108
+
109
+ ### `withdraw(vault: Vault, amountToWithdraw?: string): Promise<string>`
110
+
111
+ ```typescript
112
+ const userBalanceObject = await getUserBalance()
113
+ const balance = userBalanceObject.userbalance
114
+ ```
115
+ > [!NOTE]
116
+ > If i check balance, that is the max amount I can withdraw
117
+
118
+ I want to withdraw 100 USDC from the 1st vault fetched. ---> Let's assume the first vault is a USDC vault for simplicity
119
+ Fetch vaults returned by getAllVault() and pass the vault you want to withdraw from, and the amount to withdraw (100 in this example)
120
+
121
+ ```typescript
122
+ const vaults = await getAllVaults()
123
+ const vaultToWithdrawFrom = vaults[0]
124
+
125
+ const txHash = await withdraw(vaultToWithdrawFrom, '100')
126
+ ```
127
+
128
+ if you want to withdraw all funds in the vault, don't specify the amountToWithdraw:
129
+
130
+ ```typescript
131
+ const txHash = await withdraw(vaultToWithdrawFrom)
132
+ ```
133
+ > [!IMPORTANT]
134
+ > you will have to claim your withdraws after DHW is processed to transfer the withdrawn funds to your wallet
135
+
136
+ ---
137
+
138
+ ### `claimWithdraws(vaultAddress: string): Promise<string>`
139
+
140
+ ```typescript
141
+ const userBalanceObject = await getUserBalance()
142
+ const hasWithdrawsToClaim = userBalanceObject.hasWithdrawsToClaim
143
+ ```
144
+ if hasWithdrawsToClaim is true you have available funds to transfer to your address
145
+
146
+ ```typescript
147
+ const txHash = await claimWithdraws()
148
+ ```
149
+ It will transfer all available funds withdrawn with withdraw() function, to your address
150
+
151
+ ---
152
+
153
+ ### `fastWithdraw(vault: Vault, amountToWithdraw?: string): Promise<string>`
154
+
155
+ ```typescript
156
+ const userBalanceObject = await getUserBalance()
157
+ const balance = userBalanceObject.userbalance
158
+ ```
159
+
160
+ > [!NOTE]
161
+ > If i check balance, that is the max amount I can withdraw
162
+
163
+ I want to withdraw 3.55 WETH from the 1st vault fetched. ---> Let's assume the first vault is a WETH vault for simplicity
164
+ Fetch vaults returned by getAllVault() and pass the vault you want to withdraw from, and the amount to withdraw (3.55 in this example)
165
+
166
+ ```typescript
167
+ const vaults = await getAllVaults()
168
+ const vaultToWithdrawFrom = vaults[0]
169
+
170
+ const txHash = await fastWithdraw(vaultToWithdrawFrom, '3.55')
171
+ ```
172
+
173
+ if you want to withdraw all funds in the vault, don't specify the amountToWithdraw, like:
174
+
175
+ ```typescript
176
+ const txHash = await fastWithdraw(vaultToWithdrawFrom)
177
+ ```
178
+
179
+ # Types
180
+
181
+ ```typescript
73
182
  type Vault = {
74
183
  vaultName: string
75
184
  vaultAddress: string
@@ -117,7 +226,7 @@ type NFTBoost = {
117
226
  multiplier: number
118
227
  nftAddress: string
119
228
  network: string
120
- initialBlock: number // needs to be the block when rewards was deployed
229
+ initialBlock: number
121
230
  imagePath: string
122
231
  }
123
232
 
@@ -130,7 +239,11 @@ interface StretchGoal {
130
239
  }
131
240
 
132
241
  type RewardsInformation = {
133
- [tokenAddress: string]: { blockNumber: string; rewardrate: string; timestamp: string; endTime: string }
242
+ [tokenAddress: string]: {
243
+ blockNumber: string;
244
+ rewardrate: string;
245
+ timestamp: string;
246
+ endTime: string }
134
247
  }
135
248
 
136
249
  type Strategy = {
@@ -167,4 +280,13 @@ type SwapInfo = {
167
280
  token: string
168
281
  swapCallData: any
169
282
  }
283
+
284
+ type UserBalance = {
285
+ hasWithdrawsToClaim: boolean
286
+ userBalance: string
287
+ pendingUserBalance: string
288
+ pendingWithdrawalBalance: string
289
+ withdrawableBalance: string
290
+ };
291
+
170
292
  ```
package/dist/DripApi.d.ts CHANGED
@@ -11,6 +11,7 @@ export default class DripApi {
11
11
  fetchUserSVTBalance(vaultAddress: string, walletAddress: string, token: string): Promise<BigNumber>;
12
12
  fetchUserBalance(vaultAddress: string, walletAddress: string, token: string): Promise<Record<string, string>>;
13
13
  fetchEnrichedUserDNFTForVault(vaultAddress: string, walletAddress: string, token: string): Promise<any[]>;
14
+ fetchEnrichedUserWNFTForVault(vaultAddress: string, walletAddress: string, token: string): Promise<any[]>;
14
15
  fetchUserSVTFromNfts(vaultAddress: string, userAddress: string, dnfts: number[], token: string): Promise<BigNumber[]>;
15
16
  fetchAllUserWNFTForVault(vaultAddress: string, walletAddress: string, token: string): Promise<any[]>;
16
17
  fetchAllUserDNFTForVault(vaultAddress: string, walletAddress: string, token: string): Promise<any[]>;
package/dist/DripApi.js CHANGED
@@ -78,6 +78,17 @@ class DripApi {
78
78
  return data;
79
79
  });
80
80
  }
81
+ fetchEnrichedUserWNFTForVault(vaultAddress, walletAddress, token) {
82
+ return __awaiter(this, void 0, void 0, function* () {
83
+ const headers = new Headers();
84
+ headers.append('Authorization', token);
85
+ const res = yield fetch(`/api-be/api/spool/user/wNft/${walletAddress}/${vaultAddress}`, {
86
+ headers,
87
+ });
88
+ const data = yield res.json();
89
+ return data;
90
+ });
91
+ }
81
92
  fetchUserSVTFromNfts(vaultAddress, userAddress, dnfts, token) {
82
93
  return __awaiter(this, void 0, void 0, function* () {
83
94
  const headers = new Headers();
@@ -18,8 +18,9 @@ class DripConfig {
18
18
  }
19
19
  getSwapAndDepositContractAddress(signer) {
20
20
  return __awaiter(this, void 0, void 0, function* () {
21
- if (!signer)
21
+ if (!signer) {
22
22
  throw Error('No signer provided');
23
+ }
23
24
  if (!this.swapAndDepositContractAddress) {
24
25
  const contract = yield this.internalConfig.getChainAddresses(signer);
25
26
  this.swapAndDepositContractAddress = contract.IDepositSwap;
@@ -29,8 +30,9 @@ class DripConfig {
29
30
  }
30
31
  getSmartVaultManagerAddress(signer) {
31
32
  return __awaiter(this, void 0, void 0, function* () {
32
- if (!signer)
33
+ if (!signer) {
33
34
  throw Error('No signer provided');
35
+ }
34
36
  if (!this.smartVaultManagerAddress) {
35
37
  const contract = yield this.internalConfig.getChainAddresses(signer);
36
38
  this.smartVaultManagerAddress = contract.ISmartVaultManager;
package/dist/DripSdk.d.ts CHANGED
@@ -15,11 +15,11 @@ export default class DripSdk {
15
15
  isUserAuthenticated(): Promise<AuthenticationStatus>;
16
16
  updateSigner(newSigner: Signer): void;
17
17
  getUserBalance(vault: Vault): Promise<UserBalance>;
18
- fastWithdraw(vault: Vault, amountToWithdraw?: string): Promise<void>;
19
- deposit(tokenAddress: string, vaultAddress: string, amount: string): Promise<void>;
20
- swapAndDeposit(fromTokenAddress: string, toTokenAddress: string, fromTokenAmount: string, vaultAddress: string, ethAmount?: string): Promise<void>;
21
- withdraw(vault: Vault, amountToWithdraw?: string): Promise<void>;
22
- claimWithdraws(vaultAddress: string): Promise<void>;
18
+ fastWithdraw(vault: Vault, amountToWithdraw?: string): Promise<string>;
19
+ deposit(tokenAddress: string, vaultAddress: string, amount: string): Promise<string>;
20
+ swapAndDeposit(fromTokenAddress: string, toTokenAddress: string, fromTokenAmount: string, vaultAddress: string, ethAmount?: string): Promise<string>;
21
+ withdraw(vault: Vault, amountToWithdraw?: string): Promise<string>;
22
+ claimWithdraws(vaultAddress: string): Promise<string>;
23
23
  private generateOldRedeemBagStruct;
24
24
  private generateNewRedeemBagStruct;
25
25
  private getAllSvts;
@@ -32,7 +32,6 @@ export default class DripSdk {
32
32
  private calculateBalanceForDNFT;
33
33
  private checkIfUserHasWithdrawsToClaim;
34
34
  private shouldUseNewWithdrawLogic;
35
- private generateToken;
36
35
  private calculateAllWithdrawalBalances;
37
36
  private getTokenAllowanceForSwapAndDepositContractAddress;
38
37
  private approveTokenForSwapAndDepositContract;
package/dist/DripSdk.js CHANGED
@@ -41,8 +41,9 @@ class DripSdk {
41
41
  authenticate() {
42
42
  return __awaiter(this, void 0, void 0, function* () {
43
43
  try {
44
- if (!this.signer)
44
+ if (!this.signer) {
45
45
  throw Error('No signer provided');
46
+ }
46
47
  const address = yield this.signer.getAddress();
47
48
  const cookieName = `auth_${address.toLowerCase()}`;
48
49
  const token = yield web3_token_1.default.sign((msg) => __awaiter(this, void 0, void 0, function* () { return yield this.signer.signMessage(msg); }), {
@@ -90,15 +91,16 @@ class DripSdk {
90
91
  getUserBalance(vault) {
91
92
  return __awaiter(this, void 0, void 0, function* () {
92
93
  const authData = yield this.isUserAuthenticated();
93
- if (!authData.isAuthenticated)
94
+ if (!authData.isAuthenticated) {
94
95
  throw Error(`User not authenticated: ${authData.message}`);
96
+ }
95
97
  const userAddress = authData.address;
96
98
  const token = authData.token;
97
99
  const dnfts = yield this.dripApi.fetchAllUserDNFTForVault(vault.vaultAddress, userAddress, token);
98
100
  const wnfts = yield this.dripApi.fetchAllUserWNFTForVault(vault.vaultAddress, userAddress, token);
99
101
  const decimals = yield this.getERC20Precission(vault.depositToken.tokenAddress);
100
102
  if (this.shouldUseNewWithdrawLogic(userAddress, vault)) {
101
- const [estimatedPendingWithdrawalBalance, estimatedWithdrawableBalance] = yield this.calculateAllWithdrawalBalances(wnfts, vault.vaultAddress, decimals);
103
+ const [estimatedPendingWithdrawalBalance, estimatedWithdrawableBalance] = yield this.calculateAllWithdrawalBalances(wnfts, vault.vaultAddress, decimals, token);
102
104
  const hasWithdrawsToClaim = this.checkIfUserHasWithdrawsToClaim(wnfts);
103
105
  const pendingDeposits = this.calculatePendingDeposits(dnfts, decimals);
104
106
  const userBalance = this.calculateAllDeposits(dnfts, decimals).sub(pendingDeposits);
@@ -113,10 +115,10 @@ class DripSdk {
113
115
  else {
114
116
  const allDeposits = this.calculateDepositsOld(dnfts, decimals);
115
117
  const pendingDeposits = this.calculatePendingDepositsOld(dnfts, decimals);
116
- const [estimatedPendingWithdrawalBalance, estimatedWithdrawableBalance, estimatedWithdrawals] = yield this.calculateAllWithdrawalBalances(wnfts, vault.vaultAddress, decimals);
117
- const fastWithdrawBalance = yield this.calculateFastWithdrawBalancesOld(vault.vaultAddress, userAddress, decimals);
118
+ const [estimatedPendingWithdrawalBalance, estimatedWithdrawableBalance, estimatedWithdrawals] = yield this.calculateAllWithdrawalBalances(wnfts, vault.vaultAddress, decimals, token);
119
+ const fastWithdrawBalance = yield this.calculateFastWithdrawBalancesOld(authData.token, vault.vaultAddress, userAddress, decimals);
118
120
  const hasWithdrawsToClaim = this.checkIfUserHasWithdrawsToClaim(wnfts);
119
- let balance = allDeposits
121
+ const balance = allDeposits
120
122
  .sub(estimatedWithdrawals)
121
123
  .sub(estimatedWithdrawableBalance)
122
124
  .sub(estimatedPendingWithdrawalBalance)
@@ -133,105 +135,144 @@ class DripSdk {
133
135
  }
134
136
  fastWithdraw(vault, amountToWithdraw) {
135
137
  return __awaiter(this, void 0, void 0, function* () {
136
- // if (!this.signer) throw Error('No signer provided')
137
- // try {
138
- // const signerAddress = await this.signer.getAddress()
139
- // if (!signerAddress) throw Error('Error fetching address')
140
- // const redeemBagStruct: RedeemBagStruct = this.shouldUseNewWithdrawLogic(signerAddress, vault)
141
- // ? await this.generateNewRedeemBagStruct(vault, signerAddress, amountToWithdraw)
142
- // : await this.generateOldRedeemBagStruct(vault, signerAddress, amountToWithdraw)
143
- // const currentBlockNumber = await this.signer.provider?.getBlockNumber()
144
- // if (!currentBlockNumber) throw Error('Error fetching block number')
145
- // const redeemTx = await this.spoolSdk?.redeemFast(
146
- // redeemBagStruct,
147
- // signerAddress.toLowerCase(),
148
- // currentBlockNumber,
149
- // )
150
- // const redeemTxReceipt = await redeemTx!.wait()
151
- // } catch (error) {
152
- // console.log(error)
153
- // }
138
+ var _a, _b;
139
+ const authData = yield this.isUserAuthenticated();
140
+ if (!authData.isAuthenticated) {
141
+ throw Error(`User not authenticated: ${authData.message}`);
142
+ }
143
+ if (!this.signer) {
144
+ throw Error('No signer provided');
145
+ }
146
+ const signerAddress = yield this.signer.getAddress();
147
+ if (!signerAddress) {
148
+ throw Error('Error fetching address');
149
+ }
150
+ const redeemBagStruct = this.shouldUseNewWithdrawLogic(signerAddress, vault)
151
+ ? yield this.generateNewRedeemBagStruct(authData.token, vault, signerAddress, amountToWithdraw)
152
+ : yield this.generateOldRedeemBagStruct(authData.token, vault, signerAddress, amountToWithdraw);
153
+ const currentBlockNumber = yield ((_a = this.signer.provider) === null || _a === void 0 ? void 0 : _a.getBlockNumber());
154
+ if (!currentBlockNumber) {
155
+ throw Error('Error fetching block number');
156
+ }
157
+ const redeemTx = yield ((_b = this.spoolSdk) === null || _b === void 0 ? void 0 : _b.redeemFast(redeemBagStruct, signerAddress.toLowerCase(), currentBlockNumber));
158
+ const txReceipt = yield redeemTx.wait();
159
+ return txReceipt.transactionHash;
154
160
  });
155
161
  }
156
162
  deposit(tokenAddress, vaultAddress, amount) {
157
163
  return __awaiter(this, void 0, void 0, function* () {
158
- // if (!this.signer) throw Error('No signer provided')
159
- // const currentTokenAllowance = await this.getTokenAllowanceForDeposit(tokenAddress)
160
- // const decimals = await this.getERC20Precission(tokenAddress)
161
- // let amountToWithdrawFixedDecimals = parseFloat(amount).toFixed(decimals)
162
- // const amountToDeposit = ethers.utils.parseUnits(amountToWithdrawFixedDecimals, decimals)
163
- // if (amountToDeposit.gt(currentTokenAllowance)) {
164
- // const requiredTokenAllowance = amountToDeposit.sub(currentTokenAllowance)
165
- // await this.approveTokenForDeposit(tokenAddress, requiredTokenAllowance)
166
- // }
167
- // const signerAddress = await this.signer.getAddress()
168
- // if (!signerAddress) throw Error('Error fetching address')
169
- // const depositBagStruct: DepositBagStruct = {
170
- // smartVault: vaultAddress,
171
- // assets: [amountToDeposit],
172
- // receiver: signerAddress,
173
- // referral: ethers.constants.AddressZero,
174
- // doFlush: false,
175
- // }
176
- // const depositTx = await this.spoolSdk!.deposit(depositBagStruct)
177
- // await depositTx.wait()
164
+ if (!this.signer) {
165
+ throw Error('No signer provided');
166
+ }
167
+ const currentTokenAllowance = yield this.getTokenAllowanceForDeposit(tokenAddress);
168
+ const decimals = yield this.getERC20Precission(tokenAddress);
169
+ const amountToWithdrawFixedDecimals = parseFloat(amount).toFixed(decimals);
170
+ const amountToDeposit = ethers_1.ethers.utils.parseUnits(amountToWithdrawFixedDecimals, decimals);
171
+ if (amountToDeposit.gt(currentTokenAllowance)) {
172
+ const requiredTokenAllowance = amountToDeposit.sub(currentTokenAllowance);
173
+ yield this.approveTokenForDeposit(tokenAddress, requiredTokenAllowance);
174
+ }
175
+ const signerAddress = yield this.signer.getAddress();
176
+ if (!signerAddress) {
177
+ throw Error('Error fetching address');
178
+ }
179
+ const depositBagStruct = {
180
+ smartVault: vaultAddress,
181
+ assets: [amountToDeposit],
182
+ receiver: signerAddress,
183
+ referral: ethers_1.ethers.constants.AddressZero,
184
+ doFlush: false,
185
+ };
186
+ const depositTx = yield this.spoolSdk.deposit(depositBagStruct);
187
+ const txReceipt = yield depositTx.wait();
188
+ return txReceipt.transactionHash;
178
189
  });
179
190
  }
180
191
  swapAndDeposit(fromTokenAddress, toTokenAddress, fromTokenAmount, vaultAddress, ethAmount) {
181
192
  return __awaiter(this, void 0, void 0, function* () {
182
- // if (!this.signer) throw Error('No signer provided')
183
- // const decimals = await this.getERC20Precission(fromTokenAddress)
184
- // const amountToWithdrawFixedDecimals = parseFloat(fromTokenAmount).toFixed(decimals)
185
- // const fromToken = ethers.utils.parseUnits(amountToWithdrawFixedDecimals, decimals)
186
- // const signerAddress = await this.signer.getAddress()
187
- // if (fromToken.gt(BigNumber.from(0))) {
188
- // const currentTokenAllowance = await this.getTokenAllowanceForSwapAndDepositContractAddress(fromTokenAddress)
189
- // if (fromToken.gt(currentTokenAllowance)) {
190
- // await this.approveTokenForSwapAndDepositContract(fromTokenAddress, fromToken.sub(currentTokenAllowance))
191
- // }
192
- // }
193
- // const swapInfo = await this.dripApi.getSwapInfo(fromTokenAddress, toTokenAddress, fromToken, signerAddress)
194
- // const swapDepositBagStruct = {
195
- // inTokens: [fromTokenAddress],
196
- // inAmounts: [fromToken],
197
- // smartVault: vaultAddress,
198
- // swapInfo,
199
- // receiver: signerAddress,
200
- // referral: ethers.constants.AddressZero,
201
- // doFlush: false,
202
- // }
203
- // let swapAndDepositRequest: ethers.ContractTransaction | undefined
204
- // if (ethAmount) {
205
- // const eth = ethers.utils.parseEther(ethAmount)
206
- // swapAndDepositRequest = await this.spoolSdk?.swapAndDeposit(swapDepositBagStruct, { value: eth })
207
- // } else {
208
- // swapAndDepositRequest = await this.spoolSdk?.swapAndDeposit(swapDepositBagStruct)
209
- // }
210
- // await swapAndDepositRequest?.wait()
193
+ const authData = yield this.isUserAuthenticated();
194
+ if (!authData.isAuthenticated) {
195
+ throw Error(`User not authenticated: ${authData.message}`);
196
+ }
197
+ if (!this.signer) {
198
+ throw Error('No signer provided');
199
+ }
200
+ const decimals = yield this.getERC20Precission(fromTokenAddress);
201
+ const amountToWithdrawFixedDecimals = parseFloat(fromTokenAmount).toFixed(decimals);
202
+ const fromToken = ethers_1.ethers.utils.parseUnits(amountToWithdrawFixedDecimals, decimals);
203
+ const signerAddress = yield this.signer.getAddress();
204
+ if (fromToken.gt(ethers_1.BigNumber.from(0))) {
205
+ const currentTokenAllowance = yield this.getTokenAllowanceForSwapAndDepositContractAddress(fromTokenAddress);
206
+ if (fromToken.gt(currentTokenAllowance)) {
207
+ yield this.approveTokenForSwapAndDepositContract(fromTokenAddress, fromToken.sub(currentTokenAllowance));
208
+ }
209
+ }
210
+ const swapInfo = yield this.dripApi.getSwapInfo(fromTokenAddress, toTokenAddress, fromToken, signerAddress);
211
+ const swapDepositBagStruct = {
212
+ inTokens: [fromTokenAddress],
213
+ inAmounts: [fromToken],
214
+ smartVault: vaultAddress,
215
+ swapInfo,
216
+ receiver: signerAddress,
217
+ referral: ethers_1.ethers.constants.AddressZero,
218
+ doFlush: false,
219
+ };
220
+ const swapAndDepositRequest = ethAmount
221
+ ? yield this.spoolSdk.swapAndDeposit(swapDepositBagStruct, { value: ethers_1.ethers.utils.parseEther(ethAmount) })
222
+ : yield this.spoolSdk.swapAndDeposit(swapDepositBagStruct);
223
+ const txReceipt = yield swapAndDepositRequest.wait();
224
+ return txReceipt === null || txReceipt === void 0 ? void 0 : txReceipt.transactionHash;
211
225
  });
212
226
  }
213
227
  withdraw(vault, amountToWithdraw) {
214
228
  return __awaiter(this, void 0, void 0, function* () {
215
- // if (!this.signer) throw Error('No signer provided')
216
- // try {
217
- // const signerAddress = await this.signer.getAddress()
218
- // if (!signerAddress) throw Error('Error fetching address')
219
- // const redeemBagStruct: RedeemBagStruct = this.shouldUseNewWithdrawLogic(signerAddress, vault)
220
- // ? await this.generateNewRedeemBagStruct(vault, signerAddress, amountToWithdraw)
221
- // : await this.generateOldRedeemBagStruct(vault, signerAddress, amountToWithdraw)
222
- // const redeemTx = await this.spoolSdk!.redeem(redeemBagStruct, signerAddress.toLowerCase(), false)
223
- // const redeemTxReceipt = await redeemTx.wait()
224
- // } catch (error) {
225
- // console.log(error)
226
- // }
229
+ const authData = yield this.isUserAuthenticated();
230
+ if (!authData.isAuthenticated) {
231
+ throw Error(`User not authenticated: ${authData.message}`);
232
+ }
233
+ if (!this.signer) {
234
+ throw Error('No signer provided');
235
+ }
236
+ const signerAddress = yield this.signer.getAddress();
237
+ if (!signerAddress) {
238
+ throw Error('Error fetching address');
239
+ }
240
+ const redeemBagStruct = this.shouldUseNewWithdrawLogic(signerAddress, vault)
241
+ ? yield this.generateNewRedeemBagStruct(authData.token, vault, signerAddress, amountToWithdraw)
242
+ : yield this.generateOldRedeemBagStruct(authData.token, vault, signerAddress, amountToWithdraw);
243
+ const redeemTx = yield this.spoolSdk.redeem(redeemBagStruct, signerAddress.toLowerCase(), false);
244
+ const redeemTxReceipt = yield redeemTx.wait();
245
+ return redeemTxReceipt.transactionHash;
227
246
  });
228
247
  }
229
248
  claimWithdraws(vaultAddress) {
230
- return __awaiter(this, void 0, void 0, function* () { });
249
+ return __awaiter(this, void 0, void 0, function* () {
250
+ const authData = yield this.isUserAuthenticated();
251
+ if (!authData.isAuthenticated) {
252
+ throw Error(`User not authenticated: ${authData.message}`);
253
+ }
254
+ if (!this.signer) {
255
+ throw Error('No signer provided');
256
+ }
257
+ const signerAddress = yield this.signer.getAddress();
258
+ if (!signerAddress) {
259
+ throw Error('Error fetching address');
260
+ }
261
+ const wnfts = yield this.dripApi.fetchEnrichedUserWNFTForVault(vaultAddress, signerAddress, authData.token);
262
+ //! Shares come as Strings instead of BigNumber from our Backend
263
+ const nftIds = wnfts
264
+ .filter((item) => !item.isBurned && ethers_1.BigNumber.from(item.shares).gt(ethers_1.BigNumber.from('0')) && item.isDHWFinished)
265
+ .map((item) => item.nftId.toString());
266
+ const nftAmounts = wnfts
267
+ .filter((item) => !item.isBurned && ethers_1.BigNumber.from(item.shares).gt(ethers_1.BigNumber.from('0')) && item.isDHWFinished)
268
+ .map((item) => item.shares.toString());
269
+ const claimWithdrawTx = yield this.spoolSdk.claimWithdrawal(vaultAddress, nftIds, nftAmounts, signerAddress.toLowerCase());
270
+ const txReceipt = yield claimWithdrawTx.wait();
271
+ return txReceipt.transactionHash;
272
+ });
231
273
  }
232
- generateOldRedeemBagStruct(vault, signerAddress, amountToWithdraw) {
274
+ generateOldRedeemBagStruct(token, vault, signerAddress, amountToWithdraw) {
233
275
  return __awaiter(this, void 0, void 0, function* () {
234
- const token = yield this.generateToken();
235
276
  const dnfts = yield this.dripApi.fetchEnrichedUserDNFTForVault(vault.vaultAddress, signerAddress, token);
236
277
  const userBalance = yield this.dripApi.fetchUserBalance(vault.vaultAddress, signerAddress, token);
237
278
  const totalTokenBalance = ethers_1.BigNumber.from(userBalance[vault.depositToken.tokenAddress]);
@@ -244,7 +285,7 @@ class DripSdk {
244
285
  }
245
286
  else {
246
287
  //! Not a MAX Withdraw (calculate the shares to withdraw)
247
- let amountToWithdrawFixedDecimals = parseFloat(amountToWithdraw).toFixed(decimals);
288
+ const amountToWithdrawFixedDecimals = parseFloat(amountToWithdraw).toFixed(decimals);
248
289
  sharesToWithdraw = ethers_1.ethers.utils
249
290
  .parseUnits(amountToWithdrawFixedDecimals, decimals)
250
291
  .mul(totalShares)
@@ -267,32 +308,32 @@ class DripSdk {
267
308
  };
268
309
  });
269
310
  }
270
- generateNewRedeemBagStruct(vault, signerAddress, amountToWithdraw) {
311
+ generateNewRedeemBagStruct(token, vault, signerAddress, amountToWithdraw) {
271
312
  return __awaiter(this, void 0, void 0, function* () {
272
- const token = yield this.generateToken();
273
313
  const decimals = yield this.getERC20Precission(vault.depositToken.tokenAddress.toLowerCase());
274
314
  const withdrawAll = !amountToWithdraw;
275
315
  const initialAmountToWithdraw = ethers_1.ethers.utils.parseUnits(amountToWithdraw || '0', decimals);
276
316
  let totalAmountToWithdraw = initialAmountToWithdraw;
277
317
  let dnfts = yield this.dripApi.fetchEnrichedUserDNFTForVault(vault.vaultAddress.toLowerCase(), signerAddress, token);
278
- dnfts = yield this.getAllSvts(vault.vaultAddress.toLowerCase(), signerAddress, dnfts);
318
+ dnfts = yield this.getAllSvts(vault.vaultAddress.toLowerCase(), signerAddress, dnfts, token);
279
319
  let shares = ethers_1.BigNumber.from(0);
280
- let nftIds = [];
281
- let nftAmounts = [];
320
+ const nftIds = [];
321
+ const nftAmounts = [];
282
322
  let index = 0;
283
323
  while (dnfts[index] && (totalAmountToWithdraw.gt(0) || withdrawAll)) {
284
324
  const dnft = dnfts[index];
285
325
  const userBalance = this.calculateBalanceForDNFT(dnft, decimals);
286
326
  if (userBalance.gt(0)) {
287
- let amountToWithdraw = totalAmountToWithdraw;
327
+ const amountToWithdraw = totalAmountToWithdraw;
288
328
  const userSvts = dnft.svts;
289
329
  let svtsToWithdraw = ethers_1.BigNumber.from(0);
290
330
  let nftAmount = ethers_1.BigNumber.from(0);
291
331
  if (amountToWithdraw.gte(userBalance) || withdrawAll) {
292
332
  nftAmount = dnft.shares;
293
333
  svtsToWithdraw = userSvts;
294
- if (!withdrawAll)
334
+ if (!withdrawAll) {
295
335
  totalAmountToWithdraw = totalAmountToWithdraw.sub(userBalance);
336
+ }
296
337
  }
297
338
  else {
298
339
  nftAmount = amountToWithdraw.mul(dnft.shares).div(userBalance);
@@ -313,9 +354,8 @@ class DripSdk {
313
354
  };
314
355
  });
315
356
  }
316
- getAllSvts(vaultAddress, userAddress, dnfts) {
357
+ getAllSvts(vaultAddress, userAddress, dnfts, token) {
317
358
  return __awaiter(this, void 0, void 0, function* () {
318
- const token = yield this.generateToken();
319
359
  const svts = yield this.dripApi.fetchUserSVTFromNfts(vaultAddress, userAddress, dnfts.map((element) => parseInt(element.nftId)), token);
320
360
  const result = dnfts.map((element, index) => {
321
361
  return { nftId: element.nftId, assets: element.assets, shares: element.shares, svts: svts[index] };
@@ -325,19 +365,20 @@ class DripSdk {
325
365
  }
326
366
  getERC20Precission(tokenAddress) {
327
367
  return __awaiter(this, void 0, void 0, function* () {
328
- if (!this.signer)
368
+ if (!this.signer) {
329
369
  throw Error('No signer provided');
370
+ }
330
371
  const signerAddress = yield this.signer.getAddress();
331
- if (!signerAddress)
372
+ if (!signerAddress) {
332
373
  throw Error('Error fetching address');
374
+ }
333
375
  const erc20Instance = spool_v2_sdk_1.ERC20__factory.connect(tokenAddress, this.signer);
334
376
  const decimals = yield erc20Instance.decimals();
335
377
  return decimals;
336
378
  });
337
379
  }
338
- calculateFastWithdrawBalancesOld(vaultAddress, userAddress, decimals) {
380
+ calculateFastWithdrawBalancesOld(token, vaultAddress, userAddress, decimals) {
339
381
  return __awaiter(this, void 0, void 0, function* () {
340
- const token = yield this.generateToken();
341
382
  const fastWithdrawNFTs = yield this.dripApi.fetchFastWithdrawNFTs(vaultAddress, userAddress, token);
342
383
  let fastWithdrawBalance = 0;
343
384
  for (const wnft of fastWithdrawNFTs) {
@@ -414,19 +455,11 @@ class DripSdk {
414
455
  }
415
456
  return vault.newWithdraw;
416
457
  }
417
- generateToken() {
418
- return __awaiter(this, void 0, void 0, function* () {
419
- if (!this.signer)
420
- throw Error('No signer provided');
421
- const token = yield web3_token_1.default.sign((msg) => __awaiter(this, void 0, void 0, function* () { return yield this.signer.signMessage(msg); }), '1d');
422
- return token;
423
- });
424
- }
425
- calculateAllWithdrawalBalances(wnfts, vaultAddress, decimals) {
458
+ calculateAllWithdrawalBalances(wnfts, vaultAddress, decimals, token) {
426
459
  return __awaiter(this, void 0, void 0, function* () {
427
- if (!this.signer)
460
+ if (!this.signer) {
428
461
  throw Error('No signer provided');
429
- const userAddress = yield this.signer.getAddress();
462
+ }
430
463
  let estimatedPendingWithdrawalBalance = ethers_1.BigNumber.from(0);
431
464
  let estimatedWithdrawableBalance = ethers_1.BigNumber.from(0);
432
465
  let withdrawals = 0;
@@ -437,7 +470,6 @@ class DripSdk {
437
470
  continue;
438
471
  }
439
472
  const currentBlockNumber = wnft.blockNumber - 1;
440
- const token = yield this.generateToken();
441
473
  const assetsPerSvtAtBlock = yield this.dripApi.fetchAssetPerSvtAtBlock(vaultAddress, currentBlockNumber, token);
442
474
  const estimatedValueOfNFT = ethers_1.BigNumber.from(parseInt(ethers_1.ethers.utils.formatUnits(ethers_1.BigNumber.from(wnft.svtWithdrawn).mul(assetsPerSvtAtBlock), 36)).toString());
443
475
  if (wnft.isDHWFinished) {
@@ -457,11 +489,13 @@ class DripSdk {
457
489
  }
458
490
  getTokenAllowanceForSwapAndDepositContractAddress(tokenAddress) {
459
491
  return __awaiter(this, void 0, void 0, function* () {
460
- if (!this.signer)
492
+ if (!this.signer) {
461
493
  throw Error('No signer provided');
494
+ }
462
495
  const signerAddress = yield this.signer.getAddress();
463
- if (!signerAddress)
496
+ if (!signerAddress) {
464
497
  throw Error('Error fetching address');
498
+ }
465
499
  const erc20Instance = spool_v2_sdk_1.ERC20__factory.connect(tokenAddress, this.signer);
466
500
  const swapAndDepositAddress = yield this.dripConfig.getSwapAndDepositContractAddress(this.signer);
467
501
  const allowance = yield erc20Instance.allowance(signerAddress, swapAndDepositAddress);
@@ -470,8 +504,9 @@ class DripSdk {
470
504
  }
471
505
  approveTokenForSwapAndDepositContract(tokenAddress, amount) {
472
506
  return __awaiter(this, void 0, void 0, function* () {
473
- if (!this.signer)
507
+ if (!this.signer) {
474
508
  throw Error('No signer provided');
509
+ }
475
510
  const swapAndDepositContractAddress = yield this.dripConfig.getSwapAndDepositContractAddress(this.signer);
476
511
  const erc20Instance = spool_v2_sdk_1.ERC20__factory.connect(tokenAddress, this.signer);
477
512
  const approveTx = yield erc20Instance.approve(swapAndDepositContractAddress, amount);
@@ -480,11 +515,13 @@ class DripSdk {
480
515
  }
481
516
  getTokenAllowanceForDeposit(tokenAddress) {
482
517
  return __awaiter(this, void 0, void 0, function* () {
483
- if (!this.signer)
518
+ if (!this.signer) {
484
519
  throw Error('No signer provided');
520
+ }
485
521
  const signerAddress = yield this.signer.getAddress();
486
- if (!signerAddress)
522
+ if (!signerAddress) {
487
523
  throw Error('Error fetching address');
524
+ }
488
525
  const erc20Instance = spool_v2_sdk_1.ERC20__factory.connect(tokenAddress, this.signer);
489
526
  const smartVaultManagerAddress = yield this.dripConfig.getSmartVaultManagerAddress(this.signer);
490
527
  const allowance = yield erc20Instance.allowance(signerAddress, smartVaultManagerAddress);
@@ -493,8 +530,9 @@ class DripSdk {
493
530
  }
494
531
  approveTokenForDeposit(tokenAddress, amount) {
495
532
  return __awaiter(this, void 0, void 0, function* () {
496
- if (!this.signer)
533
+ if (!this.signer) {
497
534
  throw Error('No signer provided');
535
+ }
498
536
  const smartVaultManagerAddress = yield this.dripConfig.getSmartVaultManagerAddress(this.signer);
499
537
  const erc20Instance = spool_v2_sdk_1.ERC20__factory.connect(tokenAddress, this.signer);
500
538
  const approveTx = yield erc20Instance.approve(smartVaultManagerAddress, amount);
package/package.json CHANGED
@@ -1,27 +1,27 @@
1
1
  {
2
2
  "name": "@dripfi/drip-sdk",
3
- "version": "1.0.9",
3
+ "version": "1.0.11",
4
4
  "description": "Drip SDK",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "scripts": {
8
8
  "prepublish": "npm run build",
9
9
  "build": "tsc",
10
- "format": "prettier --write .",
11
10
  "test": "echo \"Error: no test specified\" && exit 1"
12
11
  },
13
12
  "dependencies": {
14
13
  "@spool.fi/spool-v2-sdk": "1.0.14",
15
14
  "ethers": "^5.7.2",
16
- "web3-token": "^1.0.6",
17
- "js-cookie": "^3.0.5"
15
+ "js-cookie": "^3.0.5",
16
+ "web3-token": "^1.0.6"
18
17
  },
19
18
  "author": "",
20
19
  "license": "ISC",
21
20
  "devDependencies": {
22
- "typescript": "^5.4.5",
23
21
  "@types/js-cookie": "^3.0.6",
24
- "prettier": "3.2.5",
25
- "prettier-plugin-tailwindcss": "^0.5.12"
22
+ "@typescript-eslint/eslint-plugin": "^7.12.0",
23
+ "@typescript-eslint/parser": "^7.12.0",
24
+ "eslint": "^8.57.0",
25
+ "typescript": "^5.4.5"
26
26
  }
27
27
  }
package/.prettierignore DELETED
@@ -1,2 +0,0 @@
1
- dist/
2
- node_modules/
package/.prettierrc DELETED
@@ -1,11 +0,0 @@
1
- {
2
- "printWidth": 120,
3
- "useTabs": false,
4
- "tabWidth": 2,
5
- "singleQuote": true,
6
- "jsxSingleQuote": true,
7
- "semi": false,
8
- "trailingComma": "all",
9
- "arrowParens": "always",
10
- "plugins": ["prettier-plugin-tailwindcss"]
11
- }
package/dist/test.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import { ethers } from 'ethers';
2
- export declare const signer: ethers.Wallet;
package/dist/test.js DELETED
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.signer = void 0;
4
- const ethers_1 = require("ethers");
5
- const _1 = require(".");
6
- const dripProdConfig = new _1.DripConfig('https://subgraph.satsuma-prod.com/49eb322da234/solidant/spool-v2/api', 'https://pricefeed.v2.spool.fi/', 'https://rewards.v2.spool.fi/', 'https://fastwithdraw.v2.spool.fi/', {
7
- 1: {
8
- ISmartVaultManager: '0x23Daf34e2b9Af02A74dC19cB52Af727B19403874',
9
- IDepositSwap: '0xd8534197Bd587F8226d12E0C864ef2CaE6f82f5C',
10
- ISmartVaultFactory: '0x8049Fc710D4a1Deea6a6bCeF772C166CEd7A82F5',
11
- IDepositManager: '0x823Ba38992825FF37E72B6c3D669a09173B8F7bf',
12
- IRewardManager: '0xd8d2C1C3C7982272e3e12dEC5aF681433fdcf003',
13
- IStrategyRegistry: '0x554c6bCB54656390aca0a0af38CA954dbE653F15',
14
- ISpoolLens: '0x8aa6174333F75421903b2B5c70DdF8DA5D84f74F',
15
- },
16
- }, 'http://localhost:7070');
17
- const provider = new ethers_1.ethers.providers.StaticJsonRpcProvider('https://mainnet.infura.io/v3/fa1bf2cea12147559c9634e80be76d61', 1);
18
- exports.signer = new ethers_1.ethers.Wallet('6ffc226f7b7769e27124317372c9dbb579a324e67e97bf07131bf2f59ec0f4fe', provider);
19
- const dripSdk = new _1.DripSdk(dripProdConfig, exports.signer);
20
- // dripSdk.isUserAuthenticated().then((result) => {
21
- // console.log(result)
22
- // }).catch((error) => {
23
- // console.log(error)
24
- // })