@dripfi/drip-sdk 1.4.9 → 1.4.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/README.md +206 -45
- package/dist/PerqApi.d.ts +22 -20
- package/dist/PerqApi.js +127 -92
- package/dist/PerqSdk.d.ts +35 -70
- package/dist/PerqSdk.js +51 -534
- package/dist/abi/ERC20.json +222 -0
- package/dist/contracts/ERC20TokenContract.d.ts +10 -0
- package/dist/contracts/ERC20TokenContract.js +34 -0
- package/dist/contracts/PerqSwapAndRecyclerContract.d.ts +3 -2
- package/dist/contracts/PerqSwapAndRecyclerContract.js +2 -2
- package/dist/contracts/PerqTokenRecyclerContract.d.ts +3 -2
- package/dist/contracts/PerqTokenRecyclerContract.js +2 -2
- package/dist/contracts/PerqVestingContract.d.ts +3 -2
- package/dist/contracts/PerqVestingContract.js +2 -2
- package/dist/subpackages/LitePackage.d.ts +16 -0
- package/dist/subpackages/LitePackage.js +102 -0
- package/dist/subpackages/LoyaltyCardsPackage.d.ts +12 -0
- package/dist/subpackages/LoyaltyCardsPackage.js +34 -0
- package/dist/subpackages/PoolsPackage.d.ts +16 -0
- package/dist/subpackages/PoolsPackage.js +52 -0
- package/dist/subpackages/RecyclerPackage.d.ts +13 -0
- package/dist/subpackages/RecyclerPackage.js +87 -0
- package/dist/subpackages/SignHandlerPackage.d.ts +8 -0
- package/dist/subpackages/SignHandlerPackage.js +33 -0
- package/dist/subpackages/TokenUtilsPackage.d.ts +13 -0
- package/dist/subpackages/TokenUtilsPackage.js +66 -0
- package/dist/subpackages/UserPackage.d.ts +10 -0
- package/dist/subpackages/UserPackage.js +36 -0
- package/dist/subpackages/V2Package.d.ts +24 -0
- package/dist/subpackages/V2Package.js +207 -0
- package/dist/subpackages/VestingPackage.d.ts +14 -0
- package/dist/subpackages/VestingPackage.js +112 -0
- package/dist/types/ChainId.d.ts +5 -0
- package/dist/types/ChainId.js +7 -0
- package/dist/types/DeployedProject.d.ts +4 -0
- package/dist/types/DetailedProjectData.d.ts +34 -0
- package/dist/types/DetailedProjectData.js +2 -0
- package/dist/types/Earnings.d.ts +11 -0
- package/dist/types/Earnings.js +2 -0
- package/dist/types/LinkWalletPayload.d.ts +4 -2
- package/dist/types/LinkedPodWallets.d.ts +5 -0
- package/dist/types/LinkedPodWallets.js +2 -0
- package/dist/types/MigrationOption.d.ts +6 -0
- package/dist/types/MigrationOption.js +2 -0
- package/dist/types/MyPerqData.d.ts +10 -10
- package/dist/types/PerqConfig.d.ts +5 -3
- package/dist/types/PerqConfig.js +12 -10
- package/dist/types/ReducedProjectData.d.ts +22 -0
- package/dist/types/ReducedProjectData.js +2 -0
- package/dist/types/VaultData.d.ts +33 -0
- package/dist/types/VaultData.js +2 -0
- package/dist/types/index.d.ts +8 -2
- package/package.json +2 -2
package/dist/PerqApi.js
CHANGED
@@ -4,12 +4,12 @@ const ethers_1 = require("ethers");
|
|
4
4
|
const PERQ_TOKEN_DECIMALS = 18;
|
5
5
|
const WETH_TOKEN_ADDRESS = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2';
|
6
6
|
class PerqApi {
|
7
|
-
|
8
|
-
constructor(
|
9
|
-
this.
|
7
|
+
perqSdk;
|
8
|
+
constructor(perqSdk) {
|
9
|
+
this.perqSdk = perqSdk;
|
10
10
|
}
|
11
|
-
async
|
12
|
-
const res = await fetch(`${this.route}/api-be/api/vault`);
|
11
|
+
async fetchAllPools() {
|
12
|
+
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/vault`);
|
13
13
|
if (res.ok) {
|
14
14
|
const data = (await res.json());
|
15
15
|
return data;
|
@@ -18,44 +18,28 @@ class PerqApi {
|
|
18
18
|
throw Error(`${await res.text()}`);
|
19
19
|
}
|
20
20
|
}
|
21
|
-
async
|
22
|
-
const res = await fetch(`${this.route}/api-be/api/
|
23
|
-
if (res.ok) {
|
24
|
-
const data = await res.json();
|
25
|
-
return data.usdPricePerToken;
|
26
|
-
}
|
27
|
-
else {
|
28
|
-
throw Error(`${await res.text()}`);
|
29
|
-
}
|
30
|
-
}
|
31
|
-
async getExpectedSwapResult(fromTokenAddress, toTokenAddress, amount, decimals) {
|
32
|
-
const parsedAmount = ethers_1.ethers.utils.parseUnits(amount, decimals);
|
33
|
-
const queryParams = new URLSearchParams({
|
34
|
-
from: fromTokenAddress,
|
35
|
-
to: toTokenAddress,
|
36
|
-
amount: parsedAmount.toString(),
|
37
|
-
});
|
38
|
-
const res = await fetch(`${this.route}/api-be/api/1inch/swap?${queryParams}`);
|
21
|
+
async fetchPoolV2Details(vaultAddress) {
|
22
|
+
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/vault/${vaultAddress}`);
|
39
23
|
if (res.ok) {
|
40
|
-
const data = await res.json();
|
24
|
+
const data = (await res.json());
|
41
25
|
return data;
|
42
26
|
}
|
43
27
|
else {
|
44
28
|
throw Error(`${await res.text()}`);
|
45
29
|
}
|
46
30
|
}
|
47
|
-
async
|
48
|
-
const res = await fetch(`${this.route}/api-be/api/
|
31
|
+
async fetchPoolLiteDetails(vaultAddress, onChainProjectId) {
|
32
|
+
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/vault/${vaultAddress}?onChainProjectId=${onChainProjectId}`);
|
49
33
|
if (res.ok) {
|
50
|
-
const data = await res.json();
|
34
|
+
const data = (await res.json());
|
51
35
|
return data;
|
52
36
|
}
|
53
37
|
else {
|
54
38
|
throw Error(`${await res.text()}`);
|
55
39
|
}
|
56
40
|
}
|
57
|
-
async
|
58
|
-
const res = await fetch(`${this.route}/api-be/api/
|
41
|
+
async fetchAllProjects() {
|
42
|
+
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/projects`);
|
59
43
|
if (res.ok) {
|
60
44
|
const data = await res.json();
|
61
45
|
return data;
|
@@ -64,69 +48,55 @@ class PerqApi {
|
|
64
48
|
throw Error(`${await res.text()}`);
|
65
49
|
}
|
66
50
|
}
|
67
|
-
async
|
68
|
-
const res = await fetch(`${this.route}/api-be/api/
|
51
|
+
async fetchProjetctDetails(projectName) {
|
52
|
+
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/projects/${projectName}`);
|
69
53
|
if (res.ok) {
|
70
|
-
const data =
|
54
|
+
const data = await res.json();
|
71
55
|
return data;
|
72
56
|
}
|
73
57
|
else {
|
74
58
|
throw Error(`${await res.text()}`);
|
75
59
|
}
|
76
60
|
}
|
77
|
-
async
|
78
|
-
const res = await fetch(`${this.route}/api-be/api/
|
61
|
+
async fetchTokenPrice(tokenName) {
|
62
|
+
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/tokenPrice?tokenName=${tokenName}`);
|
79
63
|
if (res.ok) {
|
80
64
|
const data = await res.json();
|
81
|
-
return data.
|
82
|
-
}
|
83
|
-
else {
|
84
|
-
throw Error(`${await res.text()}`);
|
85
|
-
}
|
86
|
-
}
|
87
|
-
async getSwapInfo(fromTokenAddress, toTokenAddress, amount, fromAddress) {
|
88
|
-
if (fromTokenAddress === toTokenAddress && fromTokenAddress === WETH_TOKEN_ADDRESS) {
|
89
|
-
return [];
|
90
|
-
}
|
91
|
-
//TODO: Replace the /1/ in this string with dynamic chainId
|
92
|
-
const url = `${this.route}/oneinch?getRequest=/swap/v6.0/1/swap?fromTokenAddress=${fromTokenAddress}%26toTokenAddress=${toTokenAddress}%26amount=${amount.toString()}%26fromAddress=${fromAddress}%26slippage=0.1%26disableEstimate=true%26allowPartialFill=false%26includeTokensInfo=true`;
|
93
|
-
const res = await fetch(url);
|
94
|
-
if (res.ok) {
|
95
|
-
const data = (await res.json());
|
96
|
-
return [
|
97
|
-
{
|
98
|
-
swapTarget: data.tx.to,
|
99
|
-
token: data.srcToken.address,
|
100
|
-
swapCallData: data.tx.data,
|
101
|
-
},
|
102
|
-
];
|
65
|
+
return data.usdPricePerToken;
|
103
66
|
}
|
104
67
|
else {
|
105
68
|
throw Error(`${await res.text()}`);
|
106
69
|
}
|
107
70
|
}
|
108
|
-
async
|
109
|
-
const
|
71
|
+
async getExpectedSwapResult(fromTokenAddress, toTokenAddress, amount, decimals, chainId) {
|
72
|
+
const parsedAmount = ethers_1.ethers.utils.parseUnits(amount, decimals);
|
73
|
+
const queryParams = new URLSearchParams({
|
74
|
+
from: fromTokenAddress,
|
75
|
+
to: toTokenAddress,
|
76
|
+
amount: parsedAmount.toString(),
|
77
|
+
chainId: chainId,
|
78
|
+
});
|
79
|
+
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/1inch/swap?${queryParams}`);
|
110
80
|
if (res.ok) {
|
111
|
-
const data =
|
81
|
+
const data = await res.json();
|
112
82
|
return data;
|
113
83
|
}
|
114
84
|
else {
|
115
85
|
throw Error(`${await res.text()}`);
|
116
86
|
}
|
117
87
|
}
|
118
|
-
async
|
119
|
-
const res = await fetch(`${this.route}/api-be/api/
|
88
|
+
async getUserBoostedNfts(walletAddress, vaultAddress) {
|
89
|
+
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/user/${walletAddress}/nftBoost/${vaultAddress}`);
|
120
90
|
if (res.ok) {
|
121
|
-
const data =
|
91
|
+
const data = await res.json();
|
122
92
|
return data;
|
123
93
|
}
|
124
94
|
else {
|
125
95
|
throw Error(`${await res.text()}`);
|
126
96
|
}
|
127
97
|
}
|
128
|
-
async
|
129
|
-
const res = await fetch(`${this.route}/api-be/api/
|
98
|
+
async fetchPoolStats() {
|
99
|
+
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/vaultStats`);
|
130
100
|
if (res.ok) {
|
131
101
|
const data = await res.json();
|
132
102
|
return data;
|
@@ -135,38 +105,48 @@ class PerqApi {
|
|
135
105
|
throw Error(`${await res.text()}`);
|
136
106
|
}
|
137
107
|
}
|
138
|
-
async
|
139
|
-
const res = await fetch(`${this.route}/api-be/api/
|
108
|
+
async fetchRewardsPerHour(walletAddress, vaultAddress) {
|
109
|
+
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/user/${walletAddress}/rewardsPerHour/${vaultAddress}`);
|
140
110
|
if (res.ok) {
|
141
|
-
const data =
|
142
|
-
return data;
|
111
|
+
const data = await res.json();
|
112
|
+
return data.rewardsPerHour;
|
143
113
|
}
|
144
114
|
else {
|
145
115
|
throw Error(`${await res.text()}`);
|
146
116
|
}
|
147
117
|
}
|
148
|
-
async
|
149
|
-
|
118
|
+
async getSwapInfo(fromTokenAddress, toTokenAddress, amount, fromAddress, chainId) {
|
119
|
+
if (fromTokenAddress === toTokenAddress && fromTokenAddress === WETH_TOKEN_ADDRESS) {
|
120
|
+
return [];
|
121
|
+
}
|
122
|
+
const url = `${this.perqSdk.perqConfig.route}/oneinch?getRequest=/swap/v6.0/${chainId}/swap?fromTokenAddress=${fromTokenAddress}%26toTokenAddress=${toTokenAddress}%26amount=${amount.toString()}%26fromAddress=${fromAddress}%26slippage=0.1%26disableEstimate=true%26allowPartialFill=false%26includeTokensInfo=true`;
|
123
|
+
const res = await fetch(url);
|
150
124
|
if (res.ok) {
|
151
125
|
const data = (await res.json());
|
152
|
-
return
|
126
|
+
return [
|
127
|
+
{
|
128
|
+
swapTarget: data.tx.to,
|
129
|
+
token: data.srcToken.address,
|
130
|
+
swapCallData: data.tx.data,
|
131
|
+
},
|
132
|
+
];
|
153
133
|
}
|
154
134
|
else {
|
155
135
|
throw Error(`${await res.text()}`);
|
156
136
|
}
|
157
137
|
}
|
158
|
-
async
|
159
|
-
const res = await fetch(`${this.route}/api-be/api/spool/
|
138
|
+
async fetchEnrichedUserWNFTForPool(vaultAddress, walletAddress) {
|
139
|
+
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/spool/user/${walletAddress}/wNft/${vaultAddress}`);
|
160
140
|
if (res.ok) {
|
161
|
-
const data =
|
141
|
+
const data = await res.json();
|
162
142
|
return data;
|
163
143
|
}
|
164
144
|
else {
|
165
145
|
throw Error(`${await res.text()}`);
|
166
146
|
}
|
167
147
|
}
|
168
|
-
async
|
169
|
-
const res = await fetch(`${this.route}/api-be/api/spool/
|
148
|
+
async fetchAssetPerSvtAtBlock(vaultAddress, blocknumber) {
|
149
|
+
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/spool/assetBalance/${blocknumber}/${vaultAddress}`);
|
170
150
|
if (res.ok) {
|
171
151
|
const data = (await res.json());
|
172
152
|
return data;
|
@@ -176,7 +156,7 @@ class PerqApi {
|
|
176
156
|
}
|
177
157
|
}
|
178
158
|
async fetchUserRewards(walletAddress) {
|
179
|
-
const res = await fetch(`${this.route}/api-be/api/user/${walletAddress}/rewards`);
|
159
|
+
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/user/${walletAddress}/rewards`);
|
180
160
|
if (res.ok) {
|
181
161
|
const data = await res.json();
|
182
162
|
return data;
|
@@ -186,7 +166,7 @@ class PerqApi {
|
|
186
166
|
}
|
187
167
|
}
|
188
168
|
async fetchAllLoyaltyCards() {
|
189
|
-
const res = await fetch(`${this.route}/api-be/api/loyaltyCards/all`);
|
169
|
+
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/loyaltyCards/all`);
|
190
170
|
if (res.ok) {
|
191
171
|
const data = await res.json();
|
192
172
|
return data.map((card) => ({
|
@@ -202,7 +182,7 @@ class PerqApi {
|
|
202
182
|
}
|
203
183
|
}
|
204
184
|
async fetchOwnedLoyaltyCard(walletAddress) {
|
205
|
-
const res = await fetch(`${this.route}/api-be/api/user/${walletAddress}/loyaltyCards/owned`);
|
185
|
+
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/user/${walletAddress}/loyaltyCards/owned`);
|
206
186
|
if (res.status === 204) {
|
207
187
|
return {};
|
208
188
|
}
|
@@ -221,7 +201,7 @@ class PerqApi {
|
|
221
201
|
}
|
222
202
|
}
|
223
203
|
async fetchBeansBalance(walletAddress) {
|
224
|
-
const res = await fetch(`${this.route}/api-be/api/user/${walletAddress}/beans/balance`);
|
204
|
+
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/user/${walletAddress}/beans/balance`);
|
225
205
|
if (res.ok) {
|
226
206
|
const data = await res.json();
|
227
207
|
const beansBalance = {
|
@@ -236,7 +216,7 @@ class PerqApi {
|
|
236
216
|
}
|
237
217
|
async upgradeLoyaltyCard(signedPayload) {
|
238
218
|
const { signerAddress } = signedPayload;
|
239
|
-
const res = await fetch(`${this.route}/api-be/api/user/${signerAddress}/loyaltyCards/upgrade`, {
|
219
|
+
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/user/${signerAddress}/loyaltyCards/upgrade`, {
|
240
220
|
method: 'POST',
|
241
221
|
headers: {
|
242
222
|
'Content-Type': 'application/json',
|
@@ -258,7 +238,7 @@ class PerqApi {
|
|
258
238
|
}
|
259
239
|
}
|
260
240
|
async fetchMyPerqData(userAddress) {
|
261
|
-
const res = await fetch(`${this.route}/api-be/api/user/${userAddress}/myperq`);
|
241
|
+
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/user/${userAddress}/myperq`);
|
262
242
|
if (res.ok) {
|
263
243
|
const data = await res.json();
|
264
244
|
return data;
|
@@ -268,7 +248,7 @@ class PerqApi {
|
|
268
248
|
}
|
269
249
|
}
|
270
250
|
async getSwapPerqForBeansInfo() {
|
271
|
-
const res = await fetch(`${this.route}/api-be/api/swap/price`, {});
|
251
|
+
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/swap/price`, {});
|
272
252
|
if (res.ok) {
|
273
253
|
const data = await res.json();
|
274
254
|
return data;
|
@@ -278,7 +258,7 @@ class PerqApi {
|
|
278
258
|
}
|
279
259
|
}
|
280
260
|
async fetchBeansHistory(walletAddress) {
|
281
|
-
const res = await fetch(`${this.route}/api-be/api/user/${walletAddress}/beans/history`);
|
261
|
+
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/user/${walletAddress}/beans/history`);
|
282
262
|
if (res.ok) {
|
283
263
|
const data = await res.json();
|
284
264
|
const result = data.map((element) => {
|
@@ -302,7 +282,7 @@ class PerqApi {
|
|
302
282
|
}
|
303
283
|
}
|
304
284
|
async linkSuiWalletWithEthWallet(signedPayload) {
|
305
|
-
const res = await fetch(`${this.route}/api-be/api/user/suiWallet`, {
|
285
|
+
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/user/suiWallet`, {
|
306
286
|
method: 'POST',
|
307
287
|
headers: {
|
308
288
|
'Content-Type': 'application/json',
|
@@ -316,8 +296,23 @@ class PerqApi {
|
|
316
296
|
throw Error(`${await res.text()}`);
|
317
297
|
}
|
318
298
|
}
|
319
|
-
async
|
320
|
-
const res = await fetch(`${this.route}/api-be/api/user/
|
299
|
+
async linkNearWalletWithEthWallet(signedPayload) {
|
300
|
+
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/user/nearWallet`, {
|
301
|
+
method: 'POST',
|
302
|
+
headers: {
|
303
|
+
'Content-Type': 'application/json',
|
304
|
+
},
|
305
|
+
body: JSON.stringify(signedPayload),
|
306
|
+
});
|
307
|
+
if (res.ok) {
|
308
|
+
return true;
|
309
|
+
}
|
310
|
+
else {
|
311
|
+
throw Error(`${await res.text()}`);
|
312
|
+
}
|
313
|
+
}
|
314
|
+
async getPodWallets(walletAddress) {
|
315
|
+
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/user/podWallets/${walletAddress}`);
|
321
316
|
if (res.ok) {
|
322
317
|
const data = await res.json();
|
323
318
|
return data.suiWalletAddr;
|
@@ -327,7 +322,7 @@ class PerqApi {
|
|
327
322
|
}
|
328
323
|
}
|
329
324
|
async getNonceEnrichedPayload(payload) {
|
330
|
-
const res = await fetch(`${this.route}/api-be/api/nonce`, {
|
325
|
+
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/nonce`, {
|
331
326
|
method: 'POST',
|
332
327
|
headers: {
|
333
328
|
'Content-Type': 'application/json',
|
@@ -341,10 +336,50 @@ class PerqApi {
|
|
341
336
|
// Return the enriched payload without the extra nesting
|
342
337
|
return enrichedPayload.payload;
|
343
338
|
}
|
344
|
-
async
|
345
|
-
const
|
346
|
-
|
347
|
-
|
339
|
+
async fetchV2PoolUserBalance(userAddress, vaultAddress) {
|
340
|
+
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/user/v2/balance/${userAddress}/${vaultAddress}`);
|
341
|
+
if (res.ok) {
|
342
|
+
return await res.json();
|
343
|
+
}
|
344
|
+
else {
|
345
|
+
throw Error(`${await res.text()}`);
|
346
|
+
}
|
347
|
+
}
|
348
|
+
async fetchLitePoolUserBalance(userAddress, vaultAddress, onChainProjectId) {
|
349
|
+
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/user/lite/balance/${userAddress}/${vaultAddress}/${onChainProjectId}`);
|
350
|
+
if (res.ok) {
|
351
|
+
const data = await res.json();
|
352
|
+
return {
|
353
|
+
hasWithdrawsToClaim: false,
|
354
|
+
userBalance: data.userBalance,
|
355
|
+
pendingUserBalance: '0',
|
356
|
+
pendingWithdrawalBalance: '0',
|
357
|
+
claimableBalance: '0',
|
358
|
+
};
|
359
|
+
}
|
360
|
+
else {
|
361
|
+
throw Error(`${await res.text()}`);
|
362
|
+
}
|
363
|
+
}
|
364
|
+
async fetchEarnings(userAddress, projectName) {
|
365
|
+
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/user/${userAddress}/earnings/${projectName}`);
|
366
|
+
if (res.ok) {
|
367
|
+
const data = await res.json();
|
368
|
+
return data;
|
369
|
+
}
|
370
|
+
else {
|
371
|
+
throw Error(`${await res.text()}`);
|
372
|
+
}
|
373
|
+
}
|
374
|
+
async fetchMigrationOptions(vaultAddress, onChainProjectId) {
|
375
|
+
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/migration/options/${vaultAddress}/${onChainProjectId}`);
|
376
|
+
if (res.ok) {
|
377
|
+
const data = await res.json();
|
378
|
+
return data;
|
379
|
+
}
|
380
|
+
else {
|
381
|
+
throw Error(`${await res.text()}`);
|
382
|
+
}
|
348
383
|
}
|
349
384
|
}
|
350
385
|
exports.default = PerqApi;
|
package/dist/PerqSdk.d.ts
CHANGED
@@ -1,72 +1,37 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
3
|
-
import
|
1
|
+
import { Signer, ethers } from 'ethers';
|
2
|
+
import { PerqConfig } from './types';
|
3
|
+
import PerqApi from './PerqApi';
|
4
|
+
import { PerqSwapAndRecyclerContract, PerqTokenRecyclerContract, PerqVestingContract } from './contracts';
|
5
|
+
import VestingPackage from './subpackages/VestingPackage';
|
6
|
+
import LitePackage from './subpackages/LitePackage';
|
7
|
+
import V2Package from './subpackages/V2Package';
|
8
|
+
import RecyclerPackage from './subpackages/RecyclerPackage';
|
9
|
+
import LoyaltyCardsPackage from './subpackages/LoyaltyCardsPackage';
|
10
|
+
import { YelayLiteSdk } from '@yelay-lite/sdk';
|
11
|
+
import TokenUtilsPackage from './subpackages/TokenUtilsPackage';
|
12
|
+
import UserPackage from './subpackages/UserPackage';
|
13
|
+
import SignHandlerPackage from './subpackages/SignHandlerPackage';
|
14
|
+
import PoolsPackage from './subpackages/PoolsPackage';
|
15
|
+
import { SpoolSdk } from '@spool.fi/spool-v2-sdk';
|
16
|
+
import { PerqSupportedChainId } from './types/PerqConfig';
|
4
17
|
export default class PerqSdk {
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
getTokenAllowanceForRecycler(tokenAddress: string): Promise<BigNumber>;
|
25
|
-
getTokenAllowanceForSwapAndRecycler(tokenAddress: string): Promise<BigNumber>;
|
26
|
-
getExpectedSwapResult(fromTokenAddress: string, toTokenAddress: string, amount: string, decimals: number): Promise<string>;
|
27
|
-
getUserBoostedNfts(vaultAddress: string): Promise<string[]>;
|
28
|
-
getRewardsPerHour(vaultAddress: string): Promise<number>;
|
29
|
-
getRewards(): Promise<UserRewards>;
|
30
|
-
getMyPerqBalance(): Promise<MyPerqData[]>;
|
31
|
-
getUserVaultBalance(vaultAddress: string): Promise<UserVaultBalance>;
|
32
|
-
fastWithdraw(vaultAddress: string, amountToWithdraw?: string): Promise<string>;
|
33
|
-
swapAndDeposit(fromTokenAddress: string, toTokenAddress: string, fromTokenAmount: string, vaultAddress: string, ethAmount?: string): Promise<string>;
|
34
|
-
newSwapAndDeposit(fromTokenAddress: string, toTokenAddress: string, fromTokenAmount: string, vaultAddress: string, ethAmount?: string): Promise<string>;
|
35
|
-
private doSwapAndDeposit;
|
36
|
-
withdraw(vaultAddress: string, amountToWithdraw?: string): Promise<string>;
|
37
|
-
claimWithdraws(vaultAddress: string): Promise<string>;
|
38
|
-
getBeansBalance(): Promise<BeansBalance>;
|
39
|
-
getBeansHistory(): Promise<BeanEntry[]>;
|
40
|
-
recycleTokens(tokenAddress: string | undefined, amountToRecycle: string, beneficiary: string | undefined, price: string, deadline: string, signature: string): Promise<string>;
|
41
|
-
swapAndRecycleETH(beneficiary: string, path: string[], minAmountOutWithDecimals: string, amountOfEth: string, price: string, deadline: string, signature: string): Promise<string>;
|
42
|
-
swapAndRecycleERC20(beneficiary: string, path: string[], minAmountOutWithDecimals: string, amountInWithDecimals: string, price: string, deadline: string, signature: string): Promise<string>;
|
43
|
-
upgradeLoyaltyCard(index: number): Promise<LoyaltyCard>;
|
44
|
-
getOwnedLoyaltyCard(): Promise<LoyaltyCard>;
|
45
|
-
getAllLoyaltyCards(): Promise<LoyaltyCard[]>;
|
46
|
-
approveTokenForRecycler(tokenAddress: string, amount: string): Promise<string>;
|
47
|
-
approveTokenForSwapAndRecycler(tokenAddress: string, amount: string): Promise<string>;
|
48
|
-
approveTokenForSwapAndDeposit(tokenAddress: string, amount: string): Promise<string>;
|
49
|
-
approveTokenForDeposit(tokenAddress: string, amount: string): Promise<string>;
|
50
|
-
getPerqTokenContractAddress(): string;
|
51
|
-
getSwapPerqForBeansInfo(): Promise<PerqToBeansSwapInfo>;
|
52
|
-
transferErc20Token(tokenAddress: string, amount: string, receiver: string): Promise<string>;
|
53
|
-
wrapEther(amount: string, tokenAddress: string): Promise<string>;
|
54
|
-
getVestingStart(): Promise<string>;
|
55
|
-
getVestingEnd(): Promise<string>;
|
56
|
-
getVestedAmount(beneficiary: string): Promise<string>;
|
57
|
-
getReleasableAmount(beneficiary: string): Promise<string>;
|
58
|
-
getReleasableTotalAmount(beneficiary: string): Promise<string>;
|
59
|
-
getAllVestingInfo(beneficiaryAddress: string): Promise<VestingInfo>;
|
60
|
-
claimVestedPerq(amount: string): Promise<string>;
|
61
|
-
burnVestedPerq(amount: string, price: string, deadline: string, signature: string): Promise<string>;
|
62
|
-
linkSuiWalletWithEthWallet(suiWalletAddress: string): Promise<boolean>;
|
63
|
-
getLinkedSuiWallet(): Promise<string>;
|
64
|
-
signPayload<T>(payload: T): Promise<NonceEnrichedSignedPayload<T>>;
|
65
|
-
private getEnrichedPayload;
|
66
|
-
private generateRedeemBagStruct;
|
67
|
-
private getERC20Precission;
|
68
|
-
private getTokenAllowanceForDeposit;
|
69
|
-
private getTokenAllowanceForSwapAndDeposit;
|
70
|
-
private getERC20TokenAllowance;
|
71
|
-
private approveToken;
|
18
|
+
perqApi: PerqApi;
|
19
|
+
signer?: Signer;
|
20
|
+
lite: LitePackage;
|
21
|
+
v2: V2Package;
|
22
|
+
vesting: VestingPackage;
|
23
|
+
recycler: RecyclerPackage;
|
24
|
+
loyaltyCards: LoyaltyCardsPackage;
|
25
|
+
tokenUtils: TokenUtilsPackage;
|
26
|
+
user: UserPackage;
|
27
|
+
signHandler: SignHandlerPackage;
|
28
|
+
pools: PoolsPackage;
|
29
|
+
perqConfig: PerqConfig;
|
30
|
+
yelayLiteSdk?: YelayLiteSdk;
|
31
|
+
spoolSdk?: SpoolSdk;
|
32
|
+
perqVestingContract: PerqVestingContract;
|
33
|
+
perqTokenRecyclerContract: PerqTokenRecyclerContract;
|
34
|
+
perqSwapAndRecyclerContract: PerqSwapAndRecyclerContract;
|
35
|
+
constructor(perqConfig: PerqConfig, chainId: PerqSupportedChainId, provider?: ethers.providers.JsonRpcProvider);
|
36
|
+
updateSigner(newSigner: Signer, chainId: PerqSupportedChainId): Promise<void>;
|
72
37
|
}
|