@dripfi/drip-sdk 1.3.6 → 1.3.8
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/.prettierrc +10 -0
- package/.vscode/settings.json +11 -16
- package/CHANGELOG.md +12 -0
- package/README.md +1 -1
- package/dist/DripApi.d.ts +1 -1
- package/dist/DripApi.js +303 -365
- package/dist/DripConfig.js +26 -31
- package/dist/DripSdk.d.ts +1 -6
- package/dist/DripSdk.js +476 -654
- package/dist/contracts/BaseDripContract.js +1 -0
- package/dist/contracts/DripSwapAndRecyclerContract.js +11 -24
- package/dist/contracts/DripTokenContract.js +10 -23
- package/dist/contracts/DripTokenRecyclerContract.js +5 -16
- package/dist/contracts/PerqVestingContract.js +41 -64
- package/dist/index.d.ts +1 -1
- package/dist/test.js +18 -29
- package/dist/types/MyPerqData.d.ts +11 -39
- package/dist/types/UserVaultBalance.d.ts +1 -1
- package/eslint.config.mjs +43 -0
- package/package.json +27 -23
- package/.eslintrc.json +0 -38
package/dist/DripConfig.js
CHANGED
@@ -1,13 +1,4 @@
|
|
1
1
|
"use strict";
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
-
});
|
10
|
-
};
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
3
|
exports.DripConfig = exports.Chain = exports.PERQ_TOKEN_DECIMALS = exports.NULL_ADDRESS = void 0;
|
13
4
|
const spool_v2_sdk_1 = require("@spool.fi/spool-v2-sdk");
|
@@ -31,6 +22,14 @@ const VESTING_ADDRESS_MAINNET = '0x5e19C155C30bDEB83FCFE20a3b6f6Eda34B746c5';
|
|
31
22
|
const DRIP_TOKEN_ADDRESS_MAINNET = '0x2a414884a549ef5716bc1a4e648d3dc03f08b2cf';
|
32
23
|
const PROD_BACKEND_ROUTE = 'https://perq.finance';
|
33
24
|
class DripConfig {
|
25
|
+
internalConfig;
|
26
|
+
dripRoute;
|
27
|
+
swapAndDepositContractAddress;
|
28
|
+
smartVaultManagerAddress;
|
29
|
+
dripTokenAddress;
|
30
|
+
dripTokenRecyclerAddress;
|
31
|
+
dripSwapAndRecyclerAddress;
|
32
|
+
perqVestingAddress;
|
34
33
|
constructor(chain, dripRoute) {
|
35
34
|
switch (chain) {
|
36
35
|
case Chain.MAINNET:
|
@@ -51,29 +50,25 @@ class DripConfig {
|
|
51
50
|
break;
|
52
51
|
}
|
53
52
|
}
|
54
|
-
getSwapAndDepositContractAddress(signer) {
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
return this.swapAndDepositContractAddress;
|
64
|
-
});
|
53
|
+
async getSwapAndDepositContractAddress(signer) {
|
54
|
+
if (!signer) {
|
55
|
+
throw Error('No signer provided');
|
56
|
+
}
|
57
|
+
if (!this.swapAndDepositContractAddress) {
|
58
|
+
const contract = await this.internalConfig.getChainAddresses(signer);
|
59
|
+
this.swapAndDepositContractAddress = contract.IDepositSwap;
|
60
|
+
}
|
61
|
+
return this.swapAndDepositContractAddress;
|
65
62
|
}
|
66
|
-
getSmartVaultManagerAddress(signer) {
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
return this.smartVaultManagerAddress;
|
76
|
-
});
|
63
|
+
async getSmartVaultManagerAddress(signer) {
|
64
|
+
if (!signer) {
|
65
|
+
throw Error('No signer provided');
|
66
|
+
}
|
67
|
+
if (!this.smartVaultManagerAddress) {
|
68
|
+
const contract = await this.internalConfig.getChainAddresses(signer);
|
69
|
+
this.smartVaultManagerAddress = contract.ISmartVaultManager;
|
70
|
+
}
|
71
|
+
return this.smartVaultManagerAddress;
|
77
72
|
}
|
78
73
|
}
|
79
74
|
exports.DripConfig = DripConfig;
|
package/dist/DripSdk.d.ts
CHANGED
@@ -39,7 +39,7 @@ export default class DripSdk {
|
|
39
39
|
getUserBoostedNfts(vaultAddress: string): Promise<string[]>;
|
40
40
|
getRewardsPerHour(vaultAddress: string): Promise<number>;
|
41
41
|
getRewards(): Promise<UserRewards>;
|
42
|
-
getMyPerqBalance(): Promise<MyPerqData>;
|
42
|
+
getMyPerqBalance(): Promise<MyPerqData[]>;
|
43
43
|
getUserVaultBalance(vaultAddress: string): Promise<UserVaultBalance>;
|
44
44
|
fastWithdraw(vaultAddress: string, amountToWithdraw?: string): Promise<string>;
|
45
45
|
swapAndDeposit(fromTokenAddress: string, toTokenAddress: string, fromTokenAmount: string, vaultAddress: string, ethAmount?: string): Promise<string>;
|
@@ -76,11 +76,6 @@ export default class DripSdk {
|
|
76
76
|
private getEnrichedPayload;
|
77
77
|
private generateRedeemBagStruct;
|
78
78
|
private getERC20Precission;
|
79
|
-
private calculatePendingDeposits;
|
80
|
-
private calculateAllDeposits;
|
81
|
-
private calculateBalanceForDNFT;
|
82
|
-
private checkIfUserHasWithdrawsToClaim;
|
83
|
-
private calculateAllWithdrawalBalances;
|
84
79
|
private getTokenAllowanceForDeposit;
|
85
80
|
private getTokenAllowanceForSwapAndDeposit;
|
86
81
|
private getERC20TokenAllowance;
|