@dripfi/drip-sdk 1.4.16 → 1.4.18
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 +110 -126
- package/dist/PerqApi.d.ts +2 -3
- package/dist/PerqApi.js +1 -16
- package/dist/subpackages/PoolsPackage.d.ts +2 -2
- package/dist/types/MyPerqData.d.ts +1 -3
- package/dist/types/index.d.ts +1 -3
- package/package.json +1 -1
- package/dist/types/UserVaultBalance.d.ts +0 -8
- package/dist/types/UserVaultBalance.js +0 -2
- package/dist/types/Vault.d.ts +0 -35
- package/dist/types/Vault.js +0 -2
package/README.md
CHANGED
@@ -10,7 +10,6 @@ The Drip SDK is a TypeScript library designed to interact with the Perq protocol
|
|
10
10
|
- [Usage](#usage)
|
11
11
|
- [Modules](#modules)
|
12
12
|
- [Core SDK](#core-sdk)
|
13
|
-
- [V2 Vaults](#v2-vaults)
|
14
13
|
- [Lite Vaults](#lite-vaults)
|
15
14
|
- [Loyalty Cards](#loyalty-cards)
|
16
15
|
- [Vesting](#vesting)
|
@@ -20,7 +19,7 @@ The Drip SDK is a TypeScript library designed to interact with the Perq protocol
|
|
20
19
|
- [Types](#types)
|
21
20
|
- [Abis](#abis)
|
22
21
|
|
23
|
-
|
22
|
+
## Installation
|
24
23
|
|
25
24
|
To use the Drip SDK in your project, you can install it via npm or yarn:
|
26
25
|
|
@@ -28,7 +27,7 @@ To use the Drip SDK in your project, you can install it via npm or yarn:
|
|
28
27
|
npm i @dripfi/drip-sdk
|
29
28
|
```
|
30
29
|
|
31
|
-
|
30
|
+
## Usage
|
32
31
|
|
33
32
|
```typescript
|
34
33
|
import PerqSdk from '@drip/sdk';
|
@@ -51,9 +50,9 @@ const provider: ethers.providers.JsonRpcProvider = /* your Web3Provider instance
|
|
51
50
|
const perqSdk = new PerqSdk(perqConfig, perqSupportedChainId, provider?: ethers.providers.JsonRpcProvider);
|
52
51
|
```
|
53
52
|
|
54
|
-
|
53
|
+
## Modules
|
55
54
|
|
56
|
-
|
55
|
+
### Core SDK
|
57
56
|
|
58
57
|
Core methods available directly on the SDK instance:
|
59
58
|
|
@@ -61,7 +60,7 @@ Core methods available directly on the SDK instance:
|
|
61
60
|
| ------------------------------------------------ | ------------------------------------------------------------ |
|
62
61
|
| `updateSigner(newSigner: Signer): Promise<void>` | Updates the signer for the SDK instance and all its modules. |
|
63
62
|
|
64
|
-
|
63
|
+
### Lite Vaults
|
65
64
|
|
66
65
|
Access Lite vault methods through `sdk.lite`:
|
67
66
|
|
@@ -77,7 +76,7 @@ Access Lite vault methods through `sdk.lite`:
|
|
77
76
|
| `approveSwapAndDeposit(tokenAddress: string, amount: string): Promise<string>` | Approves a token for swap and deposit operations. |
|
78
77
|
| `getExpectedSwapResult(fromTokenAddress: string,toTokenAddress: string,amount: string,decimals: number, chainId: PerqSupportedChainId): Promise<string>` | Calculates the expected result of a swap operation on a specific chain. |
|
79
78
|
|
80
|
-
|
79
|
+
### Loyalty Cards
|
81
80
|
|
82
81
|
Access loyalty card methods through `sdk.loyaltyCards`:
|
83
82
|
|
@@ -90,7 +89,7 @@ Access loyalty card methods through `sdk.loyaltyCards`:
|
|
90
89
|
| `getOwnedLoyaltyCard(): Promise<LoyaltyCard>` | Gets user's owned loyalty card. |
|
91
90
|
| `getAllLoyaltyCards(): Promise<LoyaltyCard[]>` | Gets all available loyalty cards. |
|
92
91
|
|
93
|
-
|
92
|
+
### Vesting
|
94
93
|
|
95
94
|
Access vesting methods through `sdk.vesting`:
|
96
95
|
|
@@ -105,34 +104,35 @@ Access vesting methods through `sdk.vesting`:
|
|
105
104
|
| `claimVestedPerq(amount: string): Promise<string>` | Claims vested Perq. |
|
106
105
|
| `burnVestedPerq(amount: string, price: string, deadline: string, signature: string): Promise<string>` | Burns vested Perq. |
|
107
106
|
|
108
|
-
|
107
|
+
### Pools
|
109
108
|
|
110
109
|
Access pools methods through `sdk.pools`:
|
111
110
|
|
112
|
-
| Method
|
113
|
-
|
|
114
|
-
| `getUserPoolBalance(vaultAddress: string, onChainProjectId: number): Promise<
|
115
|
-
| `getAllPools(): Promise<VaultData[]>`
|
116
|
-
| `getMyPerqBalance(): Promise<MyPerqData[]>`
|
117
|
-
| `getPoolDetails(vaultAddress: string, onChainProjectId: number): Promise<VaultData>`
|
118
|
-
| `getAllProjects(): Promise<ReducedProjectData[]>`
|
119
|
-
| `getProjectDetails(projectName: string): Promise<DetailedProjectData>`
|
120
|
-
| `getPoolStats(): Promise<VaultStats>`
|
121
|
-
| `getRewardsPerHour(vaultAddress: string): Promise<number>`
|
122
|
-
| `getUserBoostedNfts(vaultAddress: string): Promise<string[]>`
|
123
|
-
| `getRewards(): Promise<UserRewards>`
|
124
|
-
|
125
|
-
|
111
|
+
| Method | Description |
|
112
|
+
| ------------------------------------------------------------------------------------- | ---------------------------------------------------- |
|
113
|
+
| `getUserPoolBalance(vaultAddress: string, onChainProjectId: number): Promise<string>` | Fetches the user's balance in a specific pool. |
|
114
|
+
| `getAllPools(): Promise<VaultData[]>` | Fetches all available pools. |
|
115
|
+
| `getMyPerqBalance(): Promise<MyPerqData[]>` | Fetches the user's Perq balance. |
|
116
|
+
| `getPoolDetails(vaultAddress: string, onChainProjectId: number): Promise<VaultData>` | Fetches the details of a specific pool. |
|
117
|
+
| `getAllProjects(): Promise<ReducedProjectData[]>` | Fetches all available projects. |
|
118
|
+
| `getProjectDetails(projectName: string): Promise<DetailedProjectData>` | Fetches the details of a specific project. |
|
119
|
+
| `getPoolStats(): Promise<VaultStats>` | Fetches the statistics of a pool. |
|
120
|
+
| `getRewardsPerHour(vaultAddress: string): Promise<number>` | Calculates the rewards per hour for a specific pool. |
|
121
|
+
| `getUserBoostedNfts(vaultAddress: string): Promise<string[]>` | Fetches the user's boosted NFTs for a specific pool. |
|
122
|
+
| `getRewards(): Promise<UserRewards>` | Fetches the user's rewards. |
|
123
|
+
|
124
|
+
### User
|
126
125
|
|
127
126
|
Access user methods through `sdk.user`:
|
128
127
|
|
129
|
-
| Method
|
130
|
-
|
|
131
|
-
| `linkSuiWalletWithEthWallet(suiWalletAddress: string): Promise<boolean>`
|
132
|
-
| `
|
133
|
-
| `
|
128
|
+
| Method | Description |
|
129
|
+
| -------------------------------------------------------------------------- | ----------------------------------------------------------- |
|
130
|
+
| `linkSuiWalletWithEthWallet(suiWalletAddress: string): Promise<boolean>` | Links a Sui wallet with an Ethereum wallet. |
|
131
|
+
| `linkNearWalletWithEthWallet(nearWalletAddress: string): Promise<boolean>` | Links a Near wallet with an Ethereum wallet. |
|
132
|
+
| `getLinkedPodWallets(): Promise<LinkedPodWallets>` | Retrieves all wallets linked to the user's Ethereum wallet. |
|
133
|
+
| `getEarnings(projectName: string): Promise<Earnings>` | Retrieves the user earnings for each project's vaults |
|
134
134
|
|
135
|
-
|
135
|
+
### Recycler
|
136
136
|
|
137
137
|
Access recycler methods through `sdk.recycler`:
|
138
138
|
|
@@ -146,10 +146,12 @@ Access recycler methods through `sdk.recycler`:
|
|
146
146
|
| `approveTokenForRecycler(tokenAddress: string, amount: string): Promise<string>` | Approves a token for use with the recycler contract. |
|
147
147
|
| `approveTokenForSwapAndRecycler(tokenAddress: string, amount: string): Promise<string>` | Approves a token for use with the swap and recycler contract. |
|
148
148
|
|
149
|
-
|
149
|
+
### Token Utils
|
150
150
|
|
151
151
|
Access token utils methods through `sdk.tokenUtils`:
|
152
|
+
|
152
153
|
| Method | Description |
|
154
|
+
|
153
155
|
| -------------------------------------------------------------------- | -------------------------------------- |
|
154
156
|
| `getTokenPrice(tokenName: string): Promise<number>` | Fetches the current price of a given token."perq", "weth" "eth" and "wbtc" are supported |
|
155
157
|
| `getAllowance(tokenAddress: string, spender: string): Promise<string>` | Retrieves the current allowance for a token. |
|
@@ -159,7 +161,7 @@ Access token utils methods through `sdk.tokenUtils`:
|
|
159
161
|
| `getERC20TokenAllowance(spender: string, tokenAddress: string): Promise<BigNumber>` | Retrieves the allowance for a specific ERC20 token. |
|
160
162
|
| `getPerqTokenContractAddress(): string` | Returns the contract address of the Perq token. |
|
161
163
|
|
162
|
-
|
164
|
+
### Sign Handler
|
163
165
|
|
164
166
|
Access signing methods through `sdk.signHandler`:
|
165
167
|
|
@@ -167,7 +169,7 @@ Access signing methods through `sdk.signHandler`:
|
|
167
169
|
| -------------------------------------------------------------------- | -------------------------------------- |
|
168
170
|
| `signPayload<T>(payload: T): Promise<NonceEnrichedSignedPayload<T>>` | Signs a payload with nonce enrichment. |
|
169
171
|
|
170
|
-
|
172
|
+
## Examples
|
171
173
|
|
172
174
|
### `deposit(tokenAddress: string, vaultAddress: string, amount: string): Promise<string>`
|
173
175
|
|
@@ -192,78 +194,54 @@ const txHash = await deposit(USDC_TOKEN_ADDRESS, VAULT_ADDRESS, '100')
|
|
192
194
|
|
193
195
|
> [!NOTE]
|
194
196
|
> Allowance is calculated by the deposit method, based on the current allowance and the required
|
195
|
-
|
197
|
+
>
|
196
198
|
> [!IMPORTANT]
|
197
199
|
> 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)
|
198
200
|
|
199
201
|
---
|
200
202
|
|
201
|
-
### `swapAndDeposit(fromTokenAddress: string, toTokenAddress: string, fromTokenAmount: string, vaultAddress: string,
|
203
|
+
### `swapAndDeposit(fromTokenAddress: string, toTokenAddress: string, fromTokenAmount: string, vaultAddress: string, onChainProjectId: number): Promise<string>`
|
202
204
|
|
203
|
-
I want to deposit 1.
|
205
|
+
I want to deposit 1.5 ETH in a WETH vault:
|
204
206
|
|
205
207
|
```typescript
|
206
|
-
WETH_TOKEN_ADDRESS = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" --> WETH contract address
|
208
|
+
WETH_TOKEN_ADDRESS = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" --> WETH contract address example
|
207
209
|
|
210
|
+
// For depositing ETH into WETH pool you have to provide the WETH tokens address as a toTokenAddress as ETH itself doesn't have an address
|
208
211
|
const txHash = await swapAndDeposit(WETH_TOKEN_ADDRESS, WETH_TOKEN_ADDRESS, '0', vaultAddress, '1.5')
|
209
212
|
```
|
210
213
|
|
211
|
-
|
212
|
-
|
213
|
-
> [!IMPORTANT]
|
214
|
-
> 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)
|
215
|
-
|
216
|
-
---
|
217
|
-
|
218
|
-
### `withdraw(vault: Vault, amountToWithdraw?: string): Promise<string>`
|
219
|
-
|
220
|
-
```typescript
|
221
|
-
const userBalanceObject = await getUserBalance();
|
222
|
-
const balance = userBalanceObject.userbalance;
|
223
|
-
```
|
224
|
-
|
225
|
-
> [!NOTE]
|
226
|
-
> If i check balance, that is the max amount I can withdraw
|
227
|
-
|
228
|
-
I want to withdraw 100 USDC from the 1st vault fetched. ---> Let's assume the first vault is a USDC vault for simplicity
|
229
|
-
Fetch vaults returned by getAllVault() and pass the vault you want to withdraw from, and the amount to withdraw (100 in this example)
|
214
|
+
I want to deposit 100 DAI in a USDC vault:
|
230
215
|
|
231
216
|
```typescript
|
232
|
-
|
233
|
-
const vaultToWithdrawFrom = vaults[0];
|
234
|
-
|
235
|
-
const txHash = await withdraw(vaultToWithdrawFrom, '100');
|
236
|
-
```
|
237
|
-
|
238
|
-
if you want to withdraw all funds in the vault, don't specify the amountToWithdraw:
|
217
|
+
DAI_TOKEN_ADDRESS = "0x6b175474e89094c44da98b954eedeac495271d0f" --> DAI contract address example
|
239
218
|
|
240
|
-
|
241
|
-
const txHash = await
|
219
|
+
// Assuming you already have the data of the vault
|
220
|
+
const txHash = await swapAndDeposit(DAI_TOKEN_ADDRESS, vault.depositToken.tokenAdrress, '100', vault.vaultAddress, vault.onChainProjectId)
|
242
221
|
```
|
243
222
|
|
244
223
|
> [!IMPORTANT]
|
245
|
-
>
|
224
|
+
> 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)
|
246
225
|
|
247
226
|
---
|
248
227
|
|
249
|
-
### `
|
250
|
-
|
251
|
-
```typescript
|
252
|
-
const userBalanceObject = await getUserBalance();
|
253
|
-
const hasWithdrawsToClaim = userBalanceObject.hasWithdrawsToClaim;
|
254
|
-
```
|
228
|
+
### `migrateDepositToOtherProject(tokenAddress: string, vaultAddress: string, onChainProjectId: number, targetOnChainProjectId, amount: string): Promise<string>`
|
255
229
|
|
256
|
-
|
230
|
+
I want to migrate 50 USDC from projectA to projectB. ---> Let's assume we already fetched the data for these projects and selected the USDC pool of projectA which is called selectedPool in this example
|
257
231
|
|
258
232
|
```typescript
|
259
|
-
const txHash = await
|
233
|
+
const txHash = await lite.migrateDepositToOtherProject(
|
234
|
+
selectedPool.depositToken.tokenAddress,
|
235
|
+
selectedPool.vaultAddress,
|
236
|
+
selectedPool.onChainProjectId,
|
237
|
+
projectB.onChainProjectId || -1,
|
238
|
+
'50',
|
239
|
+
);
|
260
240
|
```
|
261
241
|
|
262
|
-
It will transfer all available funds withdrawn with withdraw() function, to your address
|
263
|
-
|
264
242
|
---
|
265
243
|
|
266
|
-
### `
|
244
|
+
### `withdraw(tokenAddress: string, vaultAddress: string, onChainProjectId: number, amount: string): Promise<string>`
|
267
245
|
|
268
246
|
```typescript
|
269
247
|
const userBalanceObject = await getUserBalance();
|
@@ -273,23 +251,34 @@ const balance = userBalanceObject.userbalance;
|
|
273
251
|
> [!NOTE]
|
274
252
|
> If i check balance, that is the max amount I can withdraw
|
275
253
|
|
276
|
-
I want to withdraw
|
277
|
-
Fetch vaults returned by getAllVault() and pass the vault you want to withdraw from, and the amount to withdraw (
|
254
|
+
I want to withdraw 100 USDC from the 1st vault fetched. ---> Let's assume the first vault is a USDC vault for simplicity
|
255
|
+
Fetch vaults returned by getAllVault() and pass the vault you want to withdraw from, and the amount to withdraw (100 in this example)
|
278
256
|
|
279
257
|
```typescript
|
280
|
-
const
|
281
|
-
|
282
|
-
|
283
|
-
|
258
|
+
const txHash = await lite.withdraw(
|
259
|
+
vaultToWithdrawFrom.depositToken.tokenAddress,
|
260
|
+
vaultToWithdrawFrom.vaultAddress,
|
261
|
+
vaultToWithdrawFrom.onChainProjectId,
|
262
|
+
'100',
|
263
|
+
);
|
284
264
|
```
|
285
265
|
|
286
|
-
|
266
|
+
I want to withdraw 3.55 WETH from the 1st vault fetched. ---> Let's assume the first vault is a WETH vault for simplicity
|
267
|
+
Fetch vaults returned by getAllVault() and pass the vault you want to withdraw from, and the amount to withdraw (3.55 in this example)
|
287
268
|
|
288
269
|
```typescript
|
289
|
-
const
|
270
|
+
const vaults = await sdk.pools.getAllPools();
|
271
|
+
const vaultToWithdrawFrom = vaults[0];
|
272
|
+
|
273
|
+
const txHash = await lite.withdraw(
|
274
|
+
vaultToWithdrawFrom.depositToken.tokenAddress,
|
275
|
+
vaultToWithdrawFrom.vaultAddress,
|
276
|
+
vaultToWithdrawFrom.onChainProjectId,
|
277
|
+
'3.55',
|
278
|
+
);
|
290
279
|
```
|
291
280
|
|
292
|
-
|
281
|
+
## Types
|
293
282
|
|
294
283
|
```typescript
|
295
284
|
type Asset = {
|
@@ -395,13 +384,17 @@ type LoyaltyCard = {
|
|
395
384
|
boost: number;
|
396
385
|
};
|
397
386
|
|
398
|
-
type
|
399
|
-
claimable: number;
|
400
|
-
pendingDeposits: number;
|
401
|
-
pendingWithdraws: number;
|
387
|
+
type MyPerqBalance = {
|
402
388
|
currentlyDeposited: number;
|
389
|
+
earnedRewards: number;
|
390
|
+
earnedRewardsUsd: number;
|
391
|
+
rewardsPerHour: number;
|
392
|
+
};
|
393
|
+
|
394
|
+
type MyPerqData = VaultData & MyPerqBalance {
|
403
395
|
ethPrice: number;
|
404
|
-
|
396
|
+
btcPrice: number;
|
397
|
+
distributionType: VaultType;
|
405
398
|
};
|
406
399
|
|
407
400
|
type NFTBoost = {
|
@@ -418,6 +411,11 @@ type BasePayload<T> = {
|
|
418
411
|
payload: T;
|
419
412
|
};
|
420
413
|
|
414
|
+
type LinkedPodWallets = {
|
415
|
+
suiWalletAddr: string;
|
416
|
+
nearWalletAddr: string;
|
417
|
+
};
|
418
|
+
|
421
419
|
type NonceEnrichedPayload<T> = T & {
|
422
420
|
deadline: number;
|
423
421
|
signature: string;
|
@@ -501,14 +499,6 @@ type UserRewards = {
|
|
501
499
|
[vaultAddress: string]: { [rewardPointsName: string]: number };
|
502
500
|
};
|
503
501
|
|
504
|
-
type UserVaultBalance = {
|
505
|
-
hasWithdrawsToClaim: boolean;
|
506
|
-
userBalance: string;
|
507
|
-
pendingUserBalance: string;
|
508
|
-
pendingWithdrawalBalance: string;
|
509
|
-
claimableBalance: string;
|
510
|
-
};
|
511
|
-
|
512
502
|
type VaultData = {
|
513
503
|
depositToken: DepositToken;
|
514
504
|
vaultAddress: string;
|
@@ -537,38 +527,32 @@ type VaultData = {
|
|
537
527
|
stretchGoals: StretchGoal[];
|
538
528
|
};
|
539
529
|
|
540
|
-
type
|
541
|
-
vaultName: string;
|
542
|
-
vaultAddress: string;
|
543
|
-
apy: number;
|
544
|
-
tvr: number;
|
545
|
-
protocols: string[];
|
530
|
+
type VaultData = {
|
546
531
|
depositToken: DepositToken;
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
532
|
+
vaultAddress: string;
|
533
|
+
projectName: string;
|
534
|
+
projectLogo: string;
|
535
|
+
projectType: string;
|
551
536
|
liveFrom: string;
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
tgePrice?: number;
|
557
|
-
maxAmountOfTokens?: number;
|
558
|
-
project: DeployedProject;
|
559
|
-
projectId: number;
|
560
|
-
coingeckoId?: string;
|
561
|
-
depositTokenId: string;
|
562
|
-
expectedTge?: string;
|
537
|
+
liveUntil: string;
|
538
|
+
apy: number;
|
539
|
+
tvlUsd: number;
|
540
|
+
avgTvl: number;
|
563
541
|
tokenPrice: number;
|
564
542
|
change24h: number;
|
565
543
|
volume24h: number;
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
544
|
+
peakTvl: number;
|
545
|
+
onChainProjectId: number;
|
546
|
+
combinedTvl: number;
|
547
|
+
isActive: boolean;
|
548
|
+
owners: string[];
|
549
|
+
coingeckoId?: string;
|
550
|
+
expectedTge?: string;
|
551
|
+
chainId: ChainId;
|
552
|
+
strategies: Strategy[];
|
553
|
+
stretchGoals: StretchGoal[];
|
554
|
+
rewards: VaultReward[];
|
555
|
+
rewardTooltipName: string;
|
572
556
|
};
|
573
557
|
|
574
558
|
type VaultReward = {
|
@@ -652,7 +636,7 @@ type Earnings = {
|
|
652
636
|
};
|
653
637
|
```
|
654
638
|
|
655
|
-
|
639
|
+
## Abis
|
656
640
|
|
657
641
|
- PERQ_SWAP_AND_RECYCLER_ABI
|
658
642
|
|
package/dist/PerqApi.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { BigNumber } from 'ethers';
|
2
|
-
import { SwapInfo, UserRewards, VaultStats, MyPerqData, LoyaltyCard, BeansBalance, PerqToBeansSwapInfo, BeanEntry, NonceEnrichedSignedPayload, NonceEnrichedPayload, UpgradeLoyaltyCardPayload, ReducedProjectData, DetailedProjectData,
|
2
|
+
import { SwapInfo, UserRewards, VaultStats, MyPerqData, LoyaltyCard, BeansBalance, PerqToBeansSwapInfo, BeanEntry, NonceEnrichedSignedPayload, NonceEnrichedPayload, UpgradeLoyaltyCardPayload, ReducedProjectData, DetailedProjectData, Earnings, LinkedPodWallets, SuiWalletPayload, NearWalletPayload } from './types';
|
3
3
|
import VaultData from './types/VaultData';
|
4
4
|
import PerqSdk from './PerqSdk';
|
5
5
|
import MigrationOption from './types/MigrationOption';
|
@@ -31,8 +31,7 @@ export default class PerqApi {
|
|
31
31
|
linkNearWalletWithEthWallet(signedPayload: NonceEnrichedSignedPayload<NearWalletPayload>): Promise<boolean>;
|
32
32
|
getPodWallets(walletAddress: string): Promise<LinkedPodWallets>;
|
33
33
|
getNonceEnrichedPayload<T>(payload: T): Promise<NonceEnrichedPayload<T>>;
|
34
|
-
|
35
|
-
fetchLitePoolUserBalance(userAddress: string, vaultAddress: string, onChainProjectId: number): Promise<UserVaultBalance>;
|
34
|
+
fetchLitePoolUserBalance(userAddress: string, vaultAddress: string, onChainProjectId: number): Promise<string>;
|
36
35
|
fetchEarnings(userAddress: string, projectName: string): Promise<Earnings>;
|
37
36
|
fetchMigrationOptions(vaultAddress: string, onChainProjectId: number): Promise<MigrationOption[]>;
|
38
37
|
}
|
package/dist/PerqApi.js
CHANGED
@@ -336,26 +336,11 @@ class PerqApi {
|
|
336
336
|
// Return the enriched payload without the extra nesting
|
337
337
|
return enrichedPayload.payload;
|
338
338
|
}
|
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
339
|
async fetchLitePoolUserBalance(userAddress, vaultAddress, onChainProjectId) {
|
349
340
|
const res = await fetch(`${this.perqSdk.perqConfig.route}/api-be/api/user/lite/balance/${userAddress}/${vaultAddress}/${onChainProjectId}`);
|
350
341
|
if (res.ok) {
|
351
342
|
const data = await res.json();
|
352
|
-
return
|
353
|
-
hasWithdrawsToClaim: false,
|
354
|
-
userBalance: data.userBalance,
|
355
|
-
pendingUserBalance: '0',
|
356
|
-
pendingWithdrawalBalance: '0',
|
357
|
-
claimableBalance: '0',
|
358
|
-
};
|
343
|
+
return data.userBalance;
|
359
344
|
}
|
360
345
|
else {
|
361
346
|
throw Error(`${await res.text()}`);
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import PerqSdk from '../PerqSdk';
|
2
|
-
import { DetailedProjectData, MyPerqData, ReducedProjectData, UserRewards,
|
2
|
+
import { DetailedProjectData, MyPerqData, ReducedProjectData, UserRewards, VaultData, VaultStats } from '../types';
|
3
3
|
export default class PoolsPackage {
|
4
4
|
private perqSdk;
|
5
5
|
constructor(perqSdk: PerqSdk);
|
6
|
-
getUserPoolBalance(vaultAddress: string, onChainProjectId: number): Promise<
|
6
|
+
getUserPoolBalance(vaultAddress: string, onChainProjectId: number): Promise<string>;
|
7
7
|
getAllPools(): Promise<VaultData[]>;
|
8
8
|
getMyPerqBalance(): Promise<MyPerqData[]>;
|
9
9
|
getPoolDetails(vaultAddress: string, onChainProjectId: number): Promise<VaultData>;
|
@@ -1,11 +1,9 @@
|
|
1
1
|
import VaultData from './VaultData';
|
2
2
|
import VaultType from './VaultType';
|
3
3
|
type MyPerqBalance = {
|
4
|
-
pendingDeposits: number;
|
5
4
|
currentlyDeposited: number;
|
6
|
-
pendingWithdraws: number;
|
7
|
-
claimable: number;
|
8
5
|
earnedRewards: number;
|
6
|
+
earnedRewardsUsd: number;
|
9
7
|
rewardsPerHour: number;
|
10
8
|
};
|
11
9
|
type MyPerqData = VaultData & MyPerqBalance & {
|
package/dist/types/index.d.ts
CHANGED
@@ -20,8 +20,6 @@ import StretchGoal from './StretchGoal';
|
|
20
20
|
import SwapInfo from './SwapInfo';
|
21
21
|
import UpgradeLoyaltyCardPayload from './UpgradeLoyaltyCardPayload';
|
22
22
|
import UserRewards from './UserRewards';
|
23
|
-
import UserVaultBalance from './UserVaultBalance';
|
24
|
-
import Vault from './Vault';
|
25
23
|
import VaultData from './VaultData';
|
26
24
|
import VaultReward, { RewardType } from './VaultReward';
|
27
25
|
import VaultStats from './VaultStats';
|
@@ -31,4 +29,4 @@ import YelayVersion from './YelayVersion';
|
|
31
29
|
import Earnings from './Earnings';
|
32
30
|
import LinkedPodWallets from './LinkedPodWallets';
|
33
31
|
import MigrationOption from './MigrationOption';
|
34
|
-
export { Asset, BasePayload, BeanEntry, BeansBalance, DeployedProject, DeployedVault, DepositToken, DetailedProjectData, ELoyaltyCardTier, NearWalletPayload, SuiWalletPayload, LinkedPodWallets, LoyaltyCard, MigrationOption, MyPerqData, NFTBoost, NonceEnrichedPayload, NonceEnrichedSignedPayload, PerqConfig, PerqToBeansSwapInfo, ProjectBacker, QLFastRedeem, ReducedProjectData, RewardType, Strategy, StretchGoal, SwapInfo, UpgradeLoyaltyCardPayload, UserRewards,
|
32
|
+
export { Asset, BasePayload, BeanEntry, BeansBalance, DeployedProject, DeployedVault, DepositToken, DetailedProjectData, ELoyaltyCardTier, NearWalletPayload, SuiWalletPayload, LinkedPodWallets, LoyaltyCard, MigrationOption, MyPerqData, NFTBoost, NonceEnrichedPayload, NonceEnrichedSignedPayload, PerqConfig, PerqToBeansSwapInfo, ProjectBacker, QLFastRedeem, ReducedProjectData, RewardType, Strategy, StretchGoal, SwapInfo, UpgradeLoyaltyCardPayload, UserRewards, VaultData, VaultReward, VaultStats, VaultType, VestingInfo, YelayVersion, Earnings, };
|
package/package.json
CHANGED
package/dist/types/Vault.d.ts
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
import { DepositToken, VaultType, NFTBoost, Strategy, DeployedProject, VaultReward, RewardType } from './index';
|
2
|
-
type Vault = {
|
3
|
-
vaultName: string;
|
4
|
-
vaultAddress: string;
|
5
|
-
apy: number;
|
6
|
-
tvr: number;
|
7
|
-
protocols: string[];
|
8
|
-
depositToken: DepositToken;
|
9
|
-
type: VaultType;
|
10
|
-
rewards: VaultReward[];
|
11
|
-
rewardType: RewardType;
|
12
|
-
liveUntil: string;
|
13
|
-
liveFrom: string;
|
14
|
-
liveUntilFormatted: string;
|
15
|
-
hasPoolEnded: boolean;
|
16
|
-
boosters: NFTBoost[];
|
17
|
-
strategies: Strategy[];
|
18
|
-
tgePrice?: number;
|
19
|
-
maxAmountOfTokens?: number;
|
20
|
-
project: DeployedProject;
|
21
|
-
projectId: number;
|
22
|
-
coingeckoId?: string;
|
23
|
-
depositTokenId: string;
|
24
|
-
expectedTge?: string;
|
25
|
-
tokenPrice: number;
|
26
|
-
change24h: number;
|
27
|
-
volume24h: number;
|
28
|
-
projectFeatured: boolean;
|
29
|
-
avgTvl: string;
|
30
|
-
peakTvl: string;
|
31
|
-
amountOfDepositors: number;
|
32
|
-
boostedTvl: number;
|
33
|
-
projectVAPY?: number;
|
34
|
-
};
|
35
|
-
export default Vault;
|
package/dist/types/Vault.js
DELETED