@dripfi/drip-sdk 1.3.3 → 1.3.5
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/dist/DripApi.d.ts +4 -0
- package/dist/DripApi.js +7 -0
- package/dist/DripConfig.js +1 -1
- package/dist/DripSdk.js +5 -21
- package/package.json +1 -1
package/dist/DripApi.d.ts
CHANGED
@@ -42,4 +42,8 @@ export default class DripApi {
|
|
42
42
|
getSwapPerqForBeansInfo(): Promise<PerqToBeansSwapInfo>;
|
43
43
|
fetchBeansHistory(walletAddress: string): Promise<BeanEntry[]>;
|
44
44
|
getNonceEnrichedPayload<T>(payload: T): Promise<NonceEnrichedPayload<T>>;
|
45
|
+
fetchUserVaultDeposits(userAddress: string, vaultAddress: string): Promise<{
|
46
|
+
pending: number;
|
47
|
+
deposited: number;
|
48
|
+
}>;
|
45
49
|
}
|
package/dist/DripApi.js
CHANGED
@@ -395,5 +395,12 @@ class DripApi {
|
|
395
395
|
return enrichedPayload.payload;
|
396
396
|
});
|
397
397
|
}
|
398
|
+
fetchUserVaultDeposits(userAddress, vaultAddress) {
|
399
|
+
return __awaiter(this, void 0, void 0, function* () {
|
400
|
+
const response = yield fetch(`${this.route}/api-be/api/user/${userAddress}/deposits/${vaultAddress}`);
|
401
|
+
const data = yield response.json();
|
402
|
+
return data;
|
403
|
+
});
|
404
|
+
}
|
398
405
|
}
|
399
406
|
exports.default = DripApi;
|
package/dist/DripConfig.js
CHANGED
@@ -23,7 +23,7 @@ const RECYCLER_ADDRESS_SEPOLIA = '0x07F2264E199D62afe07E8288eC9D36d155fc3f24';
|
|
23
23
|
const SWAP_AND_RECYCLER_ADDRESS_SEPOLIA = '0xA4ed357FF233731860Ec8D0446FD95756d564014';
|
24
24
|
const VESTING_ADDRESS_SEPOLIA = '0x1d3B9E32a7139718f94BE32c797682fFf2D1bE60';
|
25
25
|
const DRIP_TOKEN_ADDRESS_SEPOLIA = '0x707B4Cc05645713d8Ea04FBC7192A0f2c1503d6E';
|
26
|
-
const DEV_BACKEND_ROUTE = 'https://dev.
|
26
|
+
const DEV_BACKEND_ROUTE = 'https://dev.perq.finance';
|
27
27
|
const SUBGRAPH_URL_MAINNET = 'https://subgraph.satsuma-prod.com/49eb322da234/solidant/spool-v2/api';
|
28
28
|
const RECYCLER_ADDRESS_MAINNET = '0x2FdcdB17799557Dce6f26921f12B7FA1DbcD79FA';
|
29
29
|
const SWAP_AND_RECYCLER_ADDRESS_MAINNET = '0x15ED53964E6a5EcbEBAb80A0Fc68c2297b0eaA8D';
|
package/dist/DripSdk.js
CHANGED
@@ -171,29 +171,13 @@ class DripSdk {
|
|
171
171
|
throw Error('No signer provided');
|
172
172
|
}
|
173
173
|
const userAddress = yield this.signer.getAddress();
|
174
|
-
// Parallel fetch of vault,
|
175
|
-
const [vault,
|
174
|
+
// Parallel fetch of vault, deposits and wnfts
|
175
|
+
const [vault, userVaultBalance, userWnftsForVault] = yield Promise.all([
|
176
176
|
this.getVaultDetails(vaultAddress),
|
177
|
-
this.dripApi.
|
177
|
+
this.dripApi.fetchUserVaultDeposits(userAddress, vaultAddress),
|
178
178
|
this.dripApi.fetchAllUserWNFTForVault(vaultAddress, userAddress),
|
179
179
|
]);
|
180
180
|
const decimals = yield this.getERC20Precission(vault.depositToken.tokenAddress);
|
181
|
-
// Calculate deposits
|
182
|
-
let pendingDeposits = ethers_1.BigNumber.from(0);
|
183
|
-
let currentlyDeposited = ethers_1.BigNumber.from(0);
|
184
|
-
for (const dnft of userDnftsForVault) {
|
185
|
-
if (dnft.assets && dnft.assets[0]) {
|
186
|
-
const amount = ethers_1.ethers.utils.parseUnits(dnft.assets[0].toString(), decimals);
|
187
|
-
if (!dnft.isDHWFinished) {
|
188
|
-
// Pending deposits (not yet processed)
|
189
|
-
pendingDeposits = pendingDeposits.add(amount);
|
190
|
-
}
|
191
|
-
else {
|
192
|
-
// Processed deposits
|
193
|
-
currentlyDeposited = currentlyDeposited.add(amount);
|
194
|
-
}
|
195
|
-
}
|
196
|
-
}
|
197
181
|
// Calculate withdrawals
|
198
182
|
let pendingWithdraws = ethers_1.BigNumber.from(0);
|
199
183
|
let claimable = ethers_1.BigNumber.from(0);
|
@@ -214,8 +198,8 @@ class DripSdk {
|
|
214
198
|
}
|
215
199
|
return {
|
216
200
|
hasWithdrawsToClaim: claimable.gt(0),
|
217
|
-
userBalance:
|
218
|
-
pendingUserBalance:
|
201
|
+
userBalance: userVaultBalance.deposited.toString(),
|
202
|
+
pendingUserBalance: userVaultBalance.pending.toString(),
|
219
203
|
pendingWithdrawalBalance: ethers_1.ethers.utils.formatUnits(pendingWithdraws, decimals),
|
220
204
|
withdrawableBalance: ethers_1.ethers.utils.formatUnits(claimable, decimals),
|
221
205
|
};
|